@harbour-enterprises/superdoc 1.17.0-next.22 → 1.17.0-next.24
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/chunks/{DocxZipper-B5QHkGwk.cjs → DocxZipper-B8xyRRbO.cjs} +10 -4
- package/dist/chunks/{DocxZipper-CXjNiywL.es.js → DocxZipper-B9Uo1uiZ.es.js} +10 -4
- package/dist/chunks/{SuperConverter-Da2sHpq1.es.js → SuperConverter-Dpef8fg5.es.js} +226 -123
- package/dist/chunks/{SuperConverter-D7RZNOcI.cjs → SuperConverter-e9yseZkD.cjs} +226 -123
- package/dist/chunks/{constants-CpniKo9Z.cjs → constants-C-hTr4No.cjs} +24 -0
- package/dist/chunks/{constants-DBKi0Amm.es.js → constants-Dw0kAsLd.es.js} +19 -1
- package/dist/chunks/{src-B58kawL4.cjs → src-CFQV4CPU.cjs} +166 -43
- package/dist/chunks/{src-nkjmbRm8.es.js → src-DDnXuxKk.es.js} +166 -43
- package/dist/super-editor/converter.cjs +2 -2
- package/dist/super-editor/converter.es.js +2 -2
- package/dist/super-editor/docx-zipper.cjs +2 -2
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/src/core/DocxZipper.d.ts.map +1 -1
- package/dist/super-editor/src/core/super-converter/helpers.d.ts.map +1 -1
- package/dist/super-editor/src/core/super-converter/v3/handlers/wp/helpers/decode-image-node-helpers.d.ts.map +1 -1
- package/dist/super-editor/src/core/super-converter/v3/handlers/wp/helpers/encode-image-node-helpers.d.ts.map +1 -1
- package/dist/super-editor/src/core/super-converter/v3/handlers/wp/helpers/rtfjs/emfjs/Bitmap.d.ts +1 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/wp/helpers/rtfjs/emfjs/Bitmap.d.ts.map +1 -1
- package/dist/super-editor/src/core/super-converter/v3/handlers/wp/helpers/rtfjs/emfjs/EMFRecords.d.ts +2 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/wp/helpers/rtfjs/emfjs/EMFRecords.d.ts.map +1 -1
- package/dist/super-editor/src/core/super-converter/v3/handlers/wp/helpers/rtfjs/emfjs/GDIContext.d.ts +3 -0
- package/dist/super-editor/src/core/super-converter/v3/handlers/wp/helpers/rtfjs/emfjs/GDIContext.d.ts.map +1 -1
- package/dist/super-editor/src/core/super-converter/v3/handlers/wp/helpers/rtfjs/emfjs/Renderer.d.ts.map +1 -1
- package/dist/super-editor/src/extensions/comment/comments-plugin.d.ts.map +1 -1
- package/dist/super-editor/src/extensions/image/image.d.ts.map +1 -1
- package/dist/super-editor/src/extensions/track-changes/track-changes.d.ts.map +1 -1
- package/dist/super-editor.cjs +4 -4
- package/dist/super-editor.es.js +4 -4
- package/dist/superdoc/src/stores/comments-store.d.ts.map +1 -1
- package/dist/superdoc.cjs +15 -7
- package/dist/superdoc.es.js +15 -7
- package/dist/superdoc.umd.js +426 -168
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-Dp2H1eGw.cjs");
|
|
2
2
|
const require_jszip = require("./jszip-DCT9QYaK.cjs");
|
|
3
3
|
const require_xml_js = require("./xml-js--DznO7Gk.cjs");
|
|
4
|
-
const require_constants = require("./constants-
|
|
4
|
+
const require_constants = require("./constants-C-hTr4No.cjs");
|
|
5
5
|
const DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
6
6
|
const PDF = "application/pdf";
|
|
7
7
|
const HTML = "text/html";
|
|
@@ -1477,8 +1477,8 @@ var DocxZipper = class {
|
|
|
1477
1477
|
this.mediaFiles[name] = fileBase64;
|
|
1478
1478
|
} else {
|
|
1479
1479
|
const fileBase64 = await zipEntry.async("base64");
|
|
1480
|
-
|
|
1481
|
-
|
|
1480
|
+
let extension = this.getFileExtension(name)?.toLowerCase();
|
|
1481
|
+
const imageTypes = new Set([
|
|
1482
1482
|
"png",
|
|
1483
1483
|
"jpg",
|
|
1484
1484
|
"jpeg",
|
|
@@ -1489,7 +1489,13 @@ var DocxZipper = class {
|
|
|
1489
1489
|
"wmf",
|
|
1490
1490
|
"svg",
|
|
1491
1491
|
"webp"
|
|
1492
|
-
])
|
|
1492
|
+
]);
|
|
1493
|
+
let detectedType = null;
|
|
1494
|
+
if (!imageTypes.has(extension) || extension === "tmp") {
|
|
1495
|
+
detectedType = require_constants.detectImageType(fileBase64);
|
|
1496
|
+
if (detectedType) extension = detectedType;
|
|
1497
|
+
}
|
|
1498
|
+
if (imageTypes.has(extension)) {
|
|
1493
1499
|
this.mediaFiles[name] = `data:image/${extension};base64,${fileBase64}`;
|
|
1494
1500
|
const blob = await zipEntry.async("blob");
|
|
1495
1501
|
const fileObj = new File([blob], name, { type: blob.type });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { o as __toESM } from "./rolldown-runtime-B2q5OVn9.es.js";
|
|
2
2
|
import { t as require_jszip_min } from "./jszip-ChlR43oI.es.js";
|
|
3
3
|
import { t as require_lib } from "./xml-js-DLE8mr0n.es.js";
|
|
4
|
-
import {
|
|
4
|
+
import { d as detectImageType, h as getContentTypesFromXml, o as base64ToUint8Array, t as COMMENT_FILE_BASENAMES } from "./constants-Dw0kAsLd.es.js";
|
|
5
5
|
const DOCX = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
6
6
|
const PDF = "application/pdf";
|
|
7
7
|
const HTML = "text/html";
|
|
@@ -1477,8 +1477,8 @@ var DocxZipper = class {
|
|
|
1477
1477
|
this.mediaFiles[name] = fileBase64;
|
|
1478
1478
|
} else {
|
|
1479
1479
|
const fileBase64 = await zipEntry.async("base64");
|
|
1480
|
-
|
|
1481
|
-
|
|
1480
|
+
let extension = this.getFileExtension(name)?.toLowerCase();
|
|
1481
|
+
const imageTypes = new Set([
|
|
1482
1482
|
"png",
|
|
1483
1483
|
"jpg",
|
|
1484
1484
|
"jpeg",
|
|
@@ -1489,7 +1489,13 @@ var DocxZipper = class {
|
|
|
1489
1489
|
"wmf",
|
|
1490
1490
|
"svg",
|
|
1491
1491
|
"webp"
|
|
1492
|
-
])
|
|
1492
|
+
]);
|
|
1493
|
+
let detectedType = null;
|
|
1494
|
+
if (!imageTypes.has(extension) || extension === "tmp") {
|
|
1495
|
+
detectedType = detectImageType(fileBase64);
|
|
1496
|
+
if (detectedType) extension = detectedType;
|
|
1497
|
+
}
|
|
1498
|
+
if (imageTypes.has(extension)) {
|
|
1493
1499
|
this.mediaFiles[name] = `data:image/${extension};base64,${fileBase64}`;
|
|
1494
1500
|
const blob = await zipEntry.async("blob");
|
|
1495
1501
|
const fileObj = new File([blob], name, { type: blob.type });
|
|
@@ -2,7 +2,7 @@ import { o as __toESM, r as __export, t as __commonJSMin } from "./rolldown-runt
|
|
|
2
2
|
import { a as init_dist, i as global } from "./jszip-ChlR43oI.es.js";
|
|
3
3
|
import { t as require_lib } from "./xml-js-DLE8mr0n.es.js";
|
|
4
4
|
import { t as v4_default } from "./uuid-2IzDu5nl.es.js";
|
|
5
|
-
import { A as
|
|
5
|
+
import { A as ptToTwips, C as normalizeHexColor, D as pixelsToTwips, E as pixelsToEmu, F as twipsToInches, I as twipsToLines, L as twipsToPixels, M as resolveShadingFillColor, N as rgbToHex, O as pointsToTwips, P as rotToDegrees, R as twipsToPt, S as linesToTwips, T as pixelsToEightPoints, _ as getHexColorFromDocxSystem, a as HYPERLINK_RELATIONSHIP_TYPE, b as inchesToTwips, f as eighthPointsToPixels, g as getDocxHighlightKeywordFromHex, i as HEADER_RELATIONSHIP_TYPE, j as resolveOpcTargetPath, k as polygonToObj, l as degreesToRot, m as getArrayBufferFromUrl, n as COMMENT_RELATIONSHIP_TYPES, o as base64ToUint8Array, p as emuToPixels, r as FOOTER_RELATIONSHIP_TYPE, s as computeCrc32Hex, t as COMMENT_FILE_BASENAMES, u as deobfuscateFont, v as halfPointToPoints, w as objToPolygon, x as isValidHexColor } from "./constants-Dw0kAsLd.es.js";
|
|
6
6
|
import { t as unified } from "./unified-BRHLwnjP.es.js";
|
|
7
7
|
import { r as stringifyPosition } from "./lib-HnbxUP96.es.js";
|
|
8
8
|
import { s as toString } from "./lib-DAB30bX1.es.js";
|
|
@@ -11519,6 +11519,155 @@ var Blob$2 = class Blob$2 {
|
|
|
11519
11519
|
return ret;
|
|
11520
11520
|
}
|
|
11521
11521
|
};
|
|
11522
|
+
var BitmapCoreHeader$1 = class {
|
|
11523
|
+
constructor(reader, skipsize) {
|
|
11524
|
+
if (skipsize) reader.skip(4);
|
|
11525
|
+
this.width = reader.readUint16();
|
|
11526
|
+
this.height = reader.readUint16();
|
|
11527
|
+
this.planes = reader.readUint16();
|
|
11528
|
+
this.bitcount = reader.readUint16();
|
|
11529
|
+
}
|
|
11530
|
+
colors() {
|
|
11531
|
+
return this.bitcount <= 8 ? 1 << this.bitcount : 0;
|
|
11532
|
+
}
|
|
11533
|
+
};
|
|
11534
|
+
var BitmapInfoHeader$1 = class {
|
|
11535
|
+
constructor(reader, skipsize) {
|
|
11536
|
+
if (skipsize) reader.skip(4);
|
|
11537
|
+
this.width = reader.readInt32();
|
|
11538
|
+
this.height = reader.readInt32();
|
|
11539
|
+
this.planes = reader.readUint16();
|
|
11540
|
+
this.bitcount = reader.readUint16();
|
|
11541
|
+
this.compression = reader.readUint32();
|
|
11542
|
+
this.sizeimage = reader.readUint32();
|
|
11543
|
+
this.xpelspermeter = reader.readInt32();
|
|
11544
|
+
this.ypelspermeter = reader.readInt32();
|
|
11545
|
+
this.clrused = reader.readUint32();
|
|
11546
|
+
this.clrimportant = reader.readUint32();
|
|
11547
|
+
}
|
|
11548
|
+
colors() {
|
|
11549
|
+
if (this.clrused !== 0) return this.clrused < 256 ? this.clrused : 256;
|
|
11550
|
+
else return this.bitcount > 8 ? 0 : 1 << this.bitcount;
|
|
11551
|
+
}
|
|
11552
|
+
};
|
|
11553
|
+
var BitmapInfo$1 = class {
|
|
11554
|
+
constructor(reader, usergb) {
|
|
11555
|
+
this._usergb = usergb;
|
|
11556
|
+
const hdrsize = reader.readUint32();
|
|
11557
|
+
this._infosize = hdrsize;
|
|
11558
|
+
if (hdrsize === Helper$1.GDI.BITMAPCOREHEADER_SIZE) {
|
|
11559
|
+
this._header = new BitmapCoreHeader$1(reader, false);
|
|
11560
|
+
this._infosize += this._header.colors() * (usergb ? 3 : 2);
|
|
11561
|
+
} else {
|
|
11562
|
+
this._header = new BitmapInfoHeader$1(reader, false);
|
|
11563
|
+
const masks = this._header.compression === Helper$1.GDI.BitmapCompression.BI_BITFIELDS ? 3 : 0;
|
|
11564
|
+
if (hdrsize <= Helper$1.GDI.BITMAPINFOHEADER_SIZE + masks * 4) this._infosize = Helper$1.GDI.BITMAPINFOHEADER_SIZE + masks * 4;
|
|
11565
|
+
this._infosize += this._header.colors() * (usergb ? 4 : 2);
|
|
11566
|
+
}
|
|
11567
|
+
}
|
|
11568
|
+
getWidth() {
|
|
11569
|
+
return this._header.width;
|
|
11570
|
+
}
|
|
11571
|
+
getHeight() {
|
|
11572
|
+
return Math.abs(this._header.height);
|
|
11573
|
+
}
|
|
11574
|
+
infosize() {
|
|
11575
|
+
return this._infosize;
|
|
11576
|
+
}
|
|
11577
|
+
header() {
|
|
11578
|
+
return this._header;
|
|
11579
|
+
}
|
|
11580
|
+
};
|
|
11581
|
+
var DIBitmap$1 = class {
|
|
11582
|
+
constructor(reader, bitmapInfo) {
|
|
11583
|
+
this._reader = reader;
|
|
11584
|
+
this._offset = reader.pos;
|
|
11585
|
+
this._location = bitmapInfo;
|
|
11586
|
+
this._info = new BitmapInfo$1(reader, true);
|
|
11587
|
+
}
|
|
11588
|
+
getWidth() {
|
|
11589
|
+
return this._info.getWidth();
|
|
11590
|
+
}
|
|
11591
|
+
getHeight() {
|
|
11592
|
+
return this._info.getHeight();
|
|
11593
|
+
}
|
|
11594
|
+
totalSize() {
|
|
11595
|
+
return this._location.header.size + this._location.data.size;
|
|
11596
|
+
}
|
|
11597
|
+
makeBitmapFileHeader() {
|
|
11598
|
+
const buf = /* @__PURE__ */ new ArrayBuffer(14);
|
|
11599
|
+
const view = new Uint8Array(buf);
|
|
11600
|
+
view[0] = 66;
|
|
11601
|
+
view[1] = 77;
|
|
11602
|
+
Helper$1._writeUint32Val(view, 2, this.totalSize() + 14);
|
|
11603
|
+
Helper$1._writeUint32Val(view, 10, this._info.infosize() + 14);
|
|
11604
|
+
return Helper$1._blobToBinary(view);
|
|
11605
|
+
}
|
|
11606
|
+
convertToPNG(bitmapData, width, height, hasAlpha) {
|
|
11607
|
+
const canvas = document.createElement("canvas");
|
|
11608
|
+
canvas.width = width;
|
|
11609
|
+
canvas.height = Math.abs(height);
|
|
11610
|
+
const ctx = canvas.getContext("2d");
|
|
11611
|
+
if (!ctx) throw new Error("Unable to get canvas context for PNG conversion");
|
|
11612
|
+
const imageData = ctx.createImageData(width, Math.abs(height));
|
|
11613
|
+
const pixels = imageData.data;
|
|
11614
|
+
const rowSize = width * 32 + 31 >>> 5 << 2;
|
|
11615
|
+
const absHeight = Math.abs(height);
|
|
11616
|
+
const topDown = height < 0;
|
|
11617
|
+
let alphaUsed = false;
|
|
11618
|
+
if (hasAlpha) for (let y = 0; y < absHeight && !alphaUsed; y++) {
|
|
11619
|
+
const srcY = topDown ? y : absHeight - 1 - y;
|
|
11620
|
+
for (let x = 0; x < width && !alphaUsed; x++) if (bitmapData[srcY * rowSize + x * 4 + 3] > 0) alphaUsed = true;
|
|
11621
|
+
}
|
|
11622
|
+
for (let y = 0; y < absHeight; y++) {
|
|
11623
|
+
const srcY = topDown ? y : absHeight - 1 - y;
|
|
11624
|
+
for (let x = 0; x < width; x++) {
|
|
11625
|
+
const srcOffset = srcY * rowSize + x * 4;
|
|
11626
|
+
const dstOffset = (y * width + x) * 4;
|
|
11627
|
+
pixels[dstOffset] = bitmapData[srcOffset + 2];
|
|
11628
|
+
pixels[dstOffset + 1] = bitmapData[srcOffset + 1];
|
|
11629
|
+
pixels[dstOffset + 2] = bitmapData[srcOffset];
|
|
11630
|
+
pixels[dstOffset + 3] = alphaUsed ? bitmapData[srcOffset + 3] : 255;
|
|
11631
|
+
}
|
|
11632
|
+
}
|
|
11633
|
+
ctx.putImageData(imageData, 0, 0);
|
|
11634
|
+
return canvas.toDataURL("image/png");
|
|
11635
|
+
}
|
|
11636
|
+
base64ref() {
|
|
11637
|
+
const prevpos = this._reader.pos;
|
|
11638
|
+
this._reader.seek(this._offset);
|
|
11639
|
+
const header = this._info.header();
|
|
11640
|
+
if (header instanceof BitmapInfoHeader$1 && header.compression != null) switch (header.compression) {
|
|
11641
|
+
case Helper$1.GDI.BitmapCompression.BI_JPEG:
|
|
11642
|
+
this._reader.seek(this._location.data.off);
|
|
11643
|
+
const jpegData = "data:image/jpeg;base64," + btoa(this._reader.readBinary(this._location.data.size));
|
|
11644
|
+
this._reader.seek(prevpos);
|
|
11645
|
+
return jpegData;
|
|
11646
|
+
case Helper$1.GDI.BitmapCompression.BI_PNG:
|
|
11647
|
+
this._reader.seek(this._location.data.off);
|
|
11648
|
+
const pngData = "data:image/png;base64," + btoa(this._reader.readBinary(this._location.data.size));
|
|
11649
|
+
this._reader.seek(prevpos);
|
|
11650
|
+
return pngData;
|
|
11651
|
+
}
|
|
11652
|
+
if (header instanceof BitmapInfoHeader$1 && header.bitcount === 32) {
|
|
11653
|
+
this._reader.seek(this._location.data.off);
|
|
11654
|
+
const bitmapBytes = new Uint8Array(this._location.data.size);
|
|
11655
|
+
const bitmapData = this._reader.readBinary(this._location.data.size);
|
|
11656
|
+
for (let i = 0; i < this._location.data.size; i++) bitmapBytes[i] = bitmapData.charCodeAt(i);
|
|
11657
|
+
const pngDataUrl = this.convertToPNG(bitmapBytes, header.width, header.height, true);
|
|
11658
|
+
this._reader.seek(prevpos);
|
|
11659
|
+
return pngDataUrl;
|
|
11660
|
+
}
|
|
11661
|
+
let data = this.makeBitmapFileHeader();
|
|
11662
|
+
this._reader.seek(this._location.header.off);
|
|
11663
|
+
data += this._reader.readBinary(this._location.header.size);
|
|
11664
|
+
this._reader.seek(this._location.data.off);
|
|
11665
|
+
data += this._reader.readBinary(this._location.data.size);
|
|
11666
|
+
const ref = "data:image/bmp;base64," + btoa(data);
|
|
11667
|
+
this._reader.seek(prevpos);
|
|
11668
|
+
return ref;
|
|
11669
|
+
}
|
|
11670
|
+
};
|
|
11522
11671
|
var PointS$1 = class PointS$1 {
|
|
11523
11672
|
constructor(reader, x, y) {
|
|
11524
11673
|
if (reader != null) {
|
|
@@ -11917,118 +12066,6 @@ var Scan$1 = class Scan$1 {
|
|
|
11917
12066
|
return this.scanlines.length > 0;
|
|
11918
12067
|
}
|
|
11919
12068
|
};
|
|
11920
|
-
var BitmapCoreHeader$1 = class {
|
|
11921
|
-
constructor(reader, skipsize) {
|
|
11922
|
-
if (skipsize) reader.skip(4);
|
|
11923
|
-
this.width = reader.readUint16();
|
|
11924
|
-
this.height = reader.readUint16();
|
|
11925
|
-
this.planes = reader.readUint16();
|
|
11926
|
-
this.bitcount = reader.readUint16();
|
|
11927
|
-
}
|
|
11928
|
-
colors() {
|
|
11929
|
-
return this.bitcount <= 8 ? 1 << this.bitcount : 0;
|
|
11930
|
-
}
|
|
11931
|
-
};
|
|
11932
|
-
var BitmapInfoHeader$1 = class {
|
|
11933
|
-
constructor(reader, skipsize) {
|
|
11934
|
-
if (skipsize) reader.skip(4);
|
|
11935
|
-
this.width = reader.readInt32();
|
|
11936
|
-
this.height = reader.readInt32();
|
|
11937
|
-
this.planes = reader.readUint16();
|
|
11938
|
-
this.bitcount = reader.readUint16();
|
|
11939
|
-
this.compression = reader.readUint32();
|
|
11940
|
-
this.sizeimage = reader.readUint32();
|
|
11941
|
-
this.xpelspermeter = reader.readInt32();
|
|
11942
|
-
this.ypelspermeter = reader.readInt32();
|
|
11943
|
-
this.clrused = reader.readUint32();
|
|
11944
|
-
this.clrimportant = reader.readUint32();
|
|
11945
|
-
}
|
|
11946
|
-
colors() {
|
|
11947
|
-
if (this.clrused !== 0) return this.clrused < 256 ? this.clrused : 256;
|
|
11948
|
-
else return this.bitcount > 8 ? 0 : 1 << this.bitcount;
|
|
11949
|
-
}
|
|
11950
|
-
};
|
|
11951
|
-
var BitmapInfo$1 = class {
|
|
11952
|
-
constructor(reader, usergb) {
|
|
11953
|
-
this._usergb = usergb;
|
|
11954
|
-
const hdrsize = reader.readUint32();
|
|
11955
|
-
this._infosize = hdrsize;
|
|
11956
|
-
if (hdrsize === Helper$1.GDI.BITMAPCOREHEADER_SIZE) {
|
|
11957
|
-
this._header = new BitmapCoreHeader$1(reader, false);
|
|
11958
|
-
this._infosize += this._header.colors() * (usergb ? 3 : 2);
|
|
11959
|
-
} else {
|
|
11960
|
-
this._header = new BitmapInfoHeader$1(reader, false);
|
|
11961
|
-
const masks = this._header.compression === Helper$1.GDI.BitmapCompression.BI_BITFIELDS ? 3 : 0;
|
|
11962
|
-
if (hdrsize <= Helper$1.GDI.BITMAPINFOHEADER_SIZE + masks * 4) this._infosize = Helper$1.GDI.BITMAPINFOHEADER_SIZE + masks * 4;
|
|
11963
|
-
this._infosize += this._header.colors() * (usergb ? 4 : 2);
|
|
11964
|
-
}
|
|
11965
|
-
}
|
|
11966
|
-
getWidth() {
|
|
11967
|
-
return this._header.width;
|
|
11968
|
-
}
|
|
11969
|
-
getHeight() {
|
|
11970
|
-
return Math.abs(this._header.height);
|
|
11971
|
-
}
|
|
11972
|
-
infosize() {
|
|
11973
|
-
return this._infosize;
|
|
11974
|
-
}
|
|
11975
|
-
header() {
|
|
11976
|
-
return this._header;
|
|
11977
|
-
}
|
|
11978
|
-
};
|
|
11979
|
-
var DIBitmap$1 = class {
|
|
11980
|
-
constructor(reader, bitmapInfo) {
|
|
11981
|
-
this._reader = reader;
|
|
11982
|
-
this._offset = reader.pos;
|
|
11983
|
-
this._location = bitmapInfo;
|
|
11984
|
-
this._info = new BitmapInfo$1(reader, true);
|
|
11985
|
-
}
|
|
11986
|
-
getWidth() {
|
|
11987
|
-
return this._info.getWidth();
|
|
11988
|
-
}
|
|
11989
|
-
getHeight() {
|
|
11990
|
-
return this._info.getHeight();
|
|
11991
|
-
}
|
|
11992
|
-
totalSize() {
|
|
11993
|
-
return this._location.header.size + this._location.data.size;
|
|
11994
|
-
}
|
|
11995
|
-
makeBitmapFileHeader() {
|
|
11996
|
-
const buf = /* @__PURE__ */ new ArrayBuffer(14);
|
|
11997
|
-
const view = new Uint8Array(buf);
|
|
11998
|
-
view[0] = 66;
|
|
11999
|
-
view[1] = 77;
|
|
12000
|
-
Helper$1._writeUint32Val(view, 2, this.totalSize() + 14);
|
|
12001
|
-
Helper$1._writeUint32Val(view, 10, this._info.infosize() + 14);
|
|
12002
|
-
return Helper$1._blobToBinary(view);
|
|
12003
|
-
}
|
|
12004
|
-
base64ref() {
|
|
12005
|
-
const prevpos = this._reader.pos;
|
|
12006
|
-
this._reader.seek(this._offset);
|
|
12007
|
-
let mime = "image/bmp";
|
|
12008
|
-
const header = this._info.header();
|
|
12009
|
-
let data;
|
|
12010
|
-
if (header instanceof BitmapInfoHeader$1 && header.compression != null) switch (header.compression) {
|
|
12011
|
-
case Helper$1.GDI.BitmapCompression.BI_JPEG:
|
|
12012
|
-
mime = "data:image/jpeg";
|
|
12013
|
-
break;
|
|
12014
|
-
case Helper$1.GDI.BitmapCompression.BI_PNG:
|
|
12015
|
-
mime = "data:image/png";
|
|
12016
|
-
break;
|
|
12017
|
-
default:
|
|
12018
|
-
data = this.makeBitmapFileHeader();
|
|
12019
|
-
break;
|
|
12020
|
-
}
|
|
12021
|
-
else data = this.makeBitmapFileHeader();
|
|
12022
|
-
this._reader.seek(this._location.header.offset);
|
|
12023
|
-
if (data != null) data += this._reader.readBinary(this._location.header.size);
|
|
12024
|
-
else data = this._reader.readBinary(this._location.header.size);
|
|
12025
|
-
this._reader.seek(this._location.data.offset);
|
|
12026
|
-
data += this._reader.readBinary(this._location.data.size);
|
|
12027
|
-
const ref = "data:" + mime + ";base64," + btoa(data);
|
|
12028
|
-
this._reader.seek(prevpos);
|
|
12029
|
-
return ref;
|
|
12030
|
-
}
|
|
12031
|
-
};
|
|
12032
12069
|
var ColorRef$1 = class ColorRef$1 {
|
|
12033
12070
|
constructor(reader, r, g, b) {
|
|
12034
12071
|
if (reader != null) {
|
|
@@ -12244,6 +12281,9 @@ var EmfHeader = class {
|
|
|
12244
12281
|
}
|
|
12245
12282
|
}
|
|
12246
12283
|
}
|
|
12284
|
+
getBounds() {
|
|
12285
|
+
return this.bounds;
|
|
12286
|
+
}
|
|
12247
12287
|
toString() {
|
|
12248
12288
|
return "{bounds: " + this.bounds.toString() + ", frame: " + this.frame.toString() + ", description: " + this.description + "}";
|
|
12249
12289
|
}
|
|
@@ -12352,11 +12392,11 @@ var EMFRecords = class {
|
|
|
12352
12392
|
const cbBits = reader.readUint32();
|
|
12353
12393
|
const pen = new Pen$1(reader, {
|
|
12354
12394
|
header: {
|
|
12355
|
-
off: offBmi,
|
|
12395
|
+
off: curpos + offBmi,
|
|
12356
12396
|
size: cbBmi
|
|
12357
12397
|
},
|
|
12358
12398
|
data: {
|
|
12359
|
-
off: offBits,
|
|
12399
|
+
off: curpos + offBits,
|
|
12360
12400
|
size: cbBits
|
|
12361
12401
|
}
|
|
12362
12402
|
});
|
|
@@ -12594,6 +12634,37 @@ var EMFRecords = class {
|
|
|
12594
12634
|
});
|
|
12595
12635
|
break;
|
|
12596
12636
|
}
|
|
12637
|
+
case Helper$1.GDI.RecordType.EMR_STRETCHDIBITS: {
|
|
12638
|
+
new RectL(reader);
|
|
12639
|
+
const xDest = reader.readInt32();
|
|
12640
|
+
const yDest = reader.readInt32();
|
|
12641
|
+
const xSrc = reader.readInt32();
|
|
12642
|
+
const ySrc = reader.readInt32();
|
|
12643
|
+
const cxSrc = reader.readInt32();
|
|
12644
|
+
const cySrc = reader.readInt32();
|
|
12645
|
+
const offBmiSrc = reader.readUint32();
|
|
12646
|
+
const cbBmiSrc = reader.readUint32();
|
|
12647
|
+
const offBitsSrc = reader.readUint32();
|
|
12648
|
+
const cbBitsSrc = reader.readUint32();
|
|
12649
|
+
const iUsageSrc = reader.readUint32();
|
|
12650
|
+
const dwRop = reader.readUint32();
|
|
12651
|
+
const cxDest = reader.readInt32();
|
|
12652
|
+
const cyDest = reader.readInt32();
|
|
12653
|
+
const dib = new DIBitmap$1(reader, {
|
|
12654
|
+
header: {
|
|
12655
|
+
off: curpos + offBmiSrc,
|
|
12656
|
+
size: cbBmiSrc
|
|
12657
|
+
},
|
|
12658
|
+
data: {
|
|
12659
|
+
off: curpos + offBitsSrc,
|
|
12660
|
+
size: cbBitsSrc
|
|
12661
|
+
}
|
|
12662
|
+
});
|
|
12663
|
+
this._records.push((gdi) => {
|
|
12664
|
+
gdi.stretchDibBits(xSrc, ySrc, cxSrc, cySrc, xDest, yDest, cxDest, cyDest, dwRop, iUsageSrc, dib);
|
|
12665
|
+
});
|
|
12666
|
+
break;
|
|
12667
|
+
}
|
|
12597
12668
|
case Helper$1.GDI.RecordType.EMR_POLYLINE:
|
|
12598
12669
|
case Helper$1.GDI.RecordType.EMR_POLYLINETO:
|
|
12599
12670
|
case Helper$1.GDI.RecordType.EMR_POLYPOLYLINE:
|
|
@@ -12636,7 +12707,6 @@ var EMFRecords = class {
|
|
|
12636
12707
|
case Helper$1.GDI.RecordType.EMR_MASKBLT:
|
|
12637
12708
|
case Helper$1.GDI.RecordType.EMR_PLGBLT:
|
|
12638
12709
|
case Helper$1.GDI.RecordType.EMR_SETDIBITSTODEVICE:
|
|
12639
|
-
case Helper$1.GDI.RecordType.EMR_STRETCHDIBITS:
|
|
12640
12710
|
case Helper$1.GDI.RecordType.EMR_EXTCREATEFONTINDIRECTW:
|
|
12641
12711
|
case Helper$1.GDI.RecordType.EMR_EXTTEXTOUTA:
|
|
12642
12712
|
case Helper$1.GDI.RecordType.EMR_EXTTEXTOUTW:
|
|
@@ -12683,6 +12753,9 @@ var EMFRecords = class {
|
|
|
12683
12753
|
}
|
|
12684
12754
|
if (!all) throw new EMFJSError("Could not read all records");
|
|
12685
12755
|
}
|
|
12756
|
+
getBounds() {
|
|
12757
|
+
return this._header.getBounds();
|
|
12758
|
+
}
|
|
12686
12759
|
play(gdi) {
|
|
12687
12760
|
const len = this._records.length;
|
|
12688
12761
|
for (let i = 0; i < len; i++) this._records[i](gdi);
|
|
@@ -12832,6 +12905,9 @@ var GDIContext$1 = class {
|
|
|
12832
12905
|
this.state.mapmode = mode;
|
|
12833
12906
|
this.state._svggroup = null;
|
|
12834
12907
|
}
|
|
12908
|
+
getMapMode() {
|
|
12909
|
+
return this.state.mapmode;
|
|
12910
|
+
}
|
|
12835
12911
|
setWindowOrgEx(x, y) {
|
|
12836
12912
|
Helper$1.log("[gdi] setWindowOrgEx: x=" + x + " y=" + y);
|
|
12837
12913
|
this.state.wx = x;
|
|
@@ -12880,6 +12956,20 @@ var GDIContext$1 = class {
|
|
|
12880
12956
|
setStretchBltMode(stretchMode) {
|
|
12881
12957
|
Helper$1.log("[gdi] setStretchBltMode: stretchMode=" + stretchMode);
|
|
12882
12958
|
}
|
|
12959
|
+
stretchDibBits(srcX, srcY, srcW, srcH, dstX, dstY, dstW, dstH, rasterOp, colorUsage, dib) {
|
|
12960
|
+
Helper$1.log("[gdi] stretchDibBits: srcX=" + srcX + " srcY=" + srcY + " srcW=" + srcW + " srcH=" + srcH + " dstX=" + dstX + " dstY=" + dstY + " dstW=" + dstW + " dstH=" + dstH + " rasterOp=0x" + rasterOp.toString(16));
|
|
12961
|
+
srcX = this._todevX(srcX);
|
|
12962
|
+
srcY = this._todevY(srcY);
|
|
12963
|
+
srcW = this._todevW(srcW);
|
|
12964
|
+
srcH = this._todevH(srcH);
|
|
12965
|
+
dstX = this._todevX(dstX);
|
|
12966
|
+
dstY = this._todevY(dstY);
|
|
12967
|
+
dstW = this._todevW(dstW);
|
|
12968
|
+
dstH = this._todevH(dstH);
|
|
12969
|
+
Helper$1.log("[gdi] stretchDibBits: TRANSLATED: srcX=" + srcX + " srcY=" + srcY + " srcW=" + srcW + " srcH=" + srcH + " dstX=" + dstX + " dstY=" + dstY + " dstW=" + dstW + " dstH=" + dstH + " rasterOp=0x" + rasterOp.toString(16));
|
|
12970
|
+
this._pushGroup();
|
|
12971
|
+
this._svg.image(this.state._svggroup, dstX, dstY, dstW, dstH, dib.base64ref());
|
|
12972
|
+
}
|
|
12883
12973
|
rectangle(rect, rw, rh) {
|
|
12884
12974
|
Helper$1.log("[gdi] rectangle: rect=" + rect.toString() + " with pen " + this.state.selected.pen.toString() + " and brush " + this.state.selected.brush.toString());
|
|
12885
12975
|
const bottom = this._todevY(rect.bottom);
|
|
@@ -13327,14 +13417,16 @@ var Renderer$1 = class {
|
|
|
13327
13417
|
}
|
|
13328
13418
|
render(info) {
|
|
13329
13419
|
const svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
13330
|
-
|
|
13420
|
+
const emfBounds = this._img.getBounds();
|
|
13421
|
+
const gdi = this._render(new SVG(svgElement), info.mapMode, emfBounds.width, emfBounds.height, emfBounds.width, emfBounds.height);
|
|
13331
13422
|
svgElement.setAttribute("viewBox", [
|
|
13332
13423
|
0,
|
|
13333
13424
|
0,
|
|
13334
|
-
|
|
13335
|
-
|
|
13425
|
+
emfBounds.width,
|
|
13426
|
+
emfBounds.height
|
|
13336
13427
|
].join(" "));
|
|
13337
|
-
|
|
13428
|
+
const preserveAspectRatio = gdi.getMapMode() === Helper$1.GDI.MapMode.MM_ANISOTROPIC ? "none" : "xMidYMid meet";
|
|
13429
|
+
svgElement.setAttribute("preserveAspectRatio", preserveAspectRatio);
|
|
13338
13430
|
svgElement.setAttribute("width", info.width);
|
|
13339
13431
|
svgElement.setAttribute("height", info.height);
|
|
13340
13432
|
return svgElement;
|
|
@@ -13356,6 +13448,7 @@ var Renderer$1 = class {
|
|
|
13356
13448
|
Helper$1.log("[EMF] BEGIN RENDERING --->");
|
|
13357
13449
|
this._img.render(gdi);
|
|
13358
13450
|
Helper$1.log("[EMF] <--- DONE RENDERING");
|
|
13451
|
+
return gdi;
|
|
13359
13452
|
}
|
|
13360
13453
|
};
|
|
13361
13454
|
var EMF = class {
|
|
@@ -13366,6 +13459,13 @@ var EMF = class {
|
|
|
13366
13459
|
render(gdi) {
|
|
13367
13460
|
this._records.play(gdi);
|
|
13368
13461
|
}
|
|
13462
|
+
getBounds() {
|
|
13463
|
+
const bounds = this._records.getBounds();
|
|
13464
|
+
return {
|
|
13465
|
+
width: bounds.right - bounds.left,
|
|
13466
|
+
height: bounds.bottom - bounds.top
|
|
13467
|
+
};
|
|
13468
|
+
}
|
|
13369
13469
|
};
|
|
13370
13470
|
var WMFJSError = class extends Error {
|
|
13371
13471
|
constructor(message) {
|
|
@@ -16530,6 +16630,7 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
16530
16630
|
const blipFill = picture.elements.find((el) => el.name === "pic:blipFill");
|
|
16531
16631
|
const blip = blipFill?.elements.find((el) => el.name === "a:blip");
|
|
16532
16632
|
if (!blip) return null;
|
|
16633
|
+
const hasGrayscale = blip.elements?.some((el) => el.name === "a:grayscl");
|
|
16533
16634
|
const stretch = blipFill?.elements?.find((el) => el.name === "a:stretch");
|
|
16534
16635
|
const fillRect = stretch?.elements?.find((el) => el.name === "a:fillRect");
|
|
16535
16636
|
const srcRect = blipFill?.elements?.find((el) => el.name === "a:srcRect");
|
|
@@ -16625,7 +16726,8 @@ function handleImageNode(node, params, isAnchor) {
|
|
|
16625
16726
|
originalAttributes: node.attributes,
|
|
16626
16727
|
rId: relAttributes["Id"],
|
|
16627
16728
|
...order.length ? { drawingChildOrder: order } : {},
|
|
16628
|
-
...originalChildren.length ? { originalDrawingChildren: originalChildren } : {}
|
|
16729
|
+
...originalChildren.length ? { originalDrawingChildren: originalChildren } : {},
|
|
16730
|
+
...hasGrayscale ? { grayscale: true } : {}
|
|
16629
16731
|
}
|
|
16630
16732
|
};
|
|
16631
16733
|
}
|
|
@@ -25587,7 +25689,8 @@ const translateImageNode = (params) => {
|
|
|
25587
25689
|
elements: [
|
|
25588
25690
|
{
|
|
25589
25691
|
name: "a:blip",
|
|
25590
|
-
attributes: { "r:embed": imageId }
|
|
25692
|
+
attributes: { "r:embed": imageId },
|
|
25693
|
+
...attrs.grayscale ? { elements: [{ name: "a:grayscl" }] } : {}
|
|
25591
25694
|
},
|
|
25592
25695
|
...rawSrcRect ? [rawSrcRect] : [],
|
|
25593
25696
|
{
|
|
@@ -36996,7 +37099,7 @@ var SuperConverter = class SuperConverter {
|
|
|
36996
37099
|
static getStoredSuperdocVersion(docx) {
|
|
36997
37100
|
return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
|
|
36998
37101
|
}
|
|
36999
|
-
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.17.0-next.
|
|
37102
|
+
static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.17.0-next.24") {
|
|
37000
37103
|
return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
|
|
37001
37104
|
}
|
|
37002
37105
|
static generateWordTimestamp() {
|