@bytechain.cn/colamd 2.7.8-rc.1 → 2.7.8-rc.2
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/main/chunks/docx-export.js +648 -116
- package/dist/main/chunks/math-export.js +161 -0
- package/dist/main/index.js +35 -1
- package/dist/preload/index.js +2 -0
- package/dist/renderer/assets/{2DXBBFLN-ocNdN1uw.js → 2DXBBFLN-BQWZeEOZ.js} +4 -4
- package/dist/renderer/assets/{46IJ22JX-CW4U2qxX.js → 46IJ22JX-CR0BA3Ks.js} +5 -5
- package/dist/renderer/assets/{4TTDE5I4-D8ms4N1R.js → 4TTDE5I4-BdBL5ywh.js} +3 -3
- package/dist/renderer/assets/{4UF3HTLV-BzqW54nj.js → 4UF3HTLV-BYMrPeBv.js} +4 -4
- package/dist/renderer/assets/{AAXQQPKT-ZKol9lXb.js → AAXQQPKT-CTS7qJK7.js} +8 -8
- package/dist/renderer/assets/{AKE5O7KZ-H-pe0TLq.js → AKE5O7KZ-pEeLbu6F.js} +5 -5
- package/dist/renderer/assets/{BNMLP6AG-CozSAPVO.js → BNMLP6AG-CbkwmI8G.js} +7 -7
- package/dist/renderer/assets/{DR6PKOQU-BT2uwVtN.js → DR6PKOQU-C6Iahoa3.js} +3 -3
- package/dist/renderer/assets/{E4RJ7UJB-DJpjg8i0.js → E4RJ7UJB-D58gl0M0.js} +6 -6
- package/dist/renderer/assets/{ELSXBIJH-ByLiLwVh.js → ELSXBIJH-DpS4enQ6.js} +1 -1
- package/dist/renderer/assets/{ERTIBQVS-DtgkV5Er.js → ERTIBQVS-DD8jjKTj.js} +4 -4
- package/dist/renderer/assets/{F653G4FO-D3eJtPrn.js → F653G4FO-DoDhFXEy.js} +8 -8
- package/dist/renderer/assets/{FKCDD66M-CCYmJoGO.js → FKCDD66M-B0wYO26L.js} +1 -1
- package/dist/renderer/assets/{FP7KDXVC-vZ0TYC0r.js → FP7KDXVC-B0LUknwq.js} +6 -6
- package/dist/renderer/assets/{FT5I3RHX-Brm3_Qt0.js → FT5I3RHX-GdBjTcHf.js} +7 -7
- package/dist/renderer/assets/{GY35JXOZ-BeQu6w03.js → GY35JXOZ-Dg2P-i-d.js} +4 -4
- package/dist/renderer/assets/{H5EEJPP2-BWYooK0Y.js → H5EEJPP2-C3d8qkta.js} +9 -9
- package/dist/renderer/assets/{HWDLEDTA-Dsh9L_sn.js → HWDLEDTA-Rm5NjB2N.js} +1 -1
- package/dist/renderer/assets/{JZWSX6AR-C70mE9_I.js → JZWSX6AR-qgXs8q-t.js} +2 -2
- package/dist/renderer/assets/{KQOEJWJY-B5PiIUbK.js → KQOEJWJY-mqwm7WG0.js} +1 -1
- package/dist/renderer/assets/{KS3BB3KE-DS5zytZe.js → KS3BB3KE-ufj8X6Wa.js} +5 -5
- package/dist/renderer/assets/{KXJRRZHI-h3IoWNmT.js → KXJRRZHI-C7vOZ5ie.js} +3 -3
- package/dist/renderer/assets/{MFVI5XKI-DBluxjPi.js → MFVI5XKI-DQ5z-nMh.js} +1 -1
- package/dist/renderer/assets/{MWY2J62P-BhNMmpkI.js → MWY2J62P-DUIamY6F.js} +5 -5
- package/dist/renderer/assets/{MXGNCBL2-ERnAcXsb.js → MXGNCBL2-DqeFe7Wj.js} +5 -5
- package/dist/renderer/assets/{N6DAJLIZ-CCw9Llff.js → N6DAJLIZ-CvgcQPUI.js} +2 -2
- package/dist/renderer/assets/{NU5M23IW-BiuqBfD9.js → NU5M23IW-DpTeCZq5.js} +5 -5
- package/dist/renderer/assets/{NV4XNBIS-eb9rHXjC.js → NV4XNBIS-wuvA_U-J.js} +7 -7
- package/dist/renderer/assets/{OGLU4SIR-wmQFiy7F.js → OGLU4SIR-CJL7p3WR.js} +5 -5
- package/dist/renderer/assets/{OUNS5N76-C60GppNV.js → OUNS5N76-CQVdszCS.js} +6 -6
- package/dist/renderer/assets/{PU4ISKXV-CkkIdjfm.js → PU4ISKXV-Bcshpks1.js} +5 -5
- package/dist/renderer/assets/{PUZGS23X-D8xumSyi.js → PUZGS23X-B8gmR_q3.js} +1 -1
- package/dist/renderer/assets/{Q3IYVLG5-DeTmPOTn.js → Q3IYVLG5-B-qlhAM-.js} +5 -5
- package/dist/renderer/assets/{QYHQDLKZ-DqOBYl5L.js → QYHQDLKZ-EFOsxom5.js} +9 -9
- package/dist/renderer/assets/{RZSVICHU-DIzmobkX.js → RZSVICHU-B4a4ijU5.js} +1 -1
- package/dist/renderer/assets/{UEXXS2NB-CYDWJ2KO.js → UEXXS2NB-BYEZA17b.js} +1 -1
- package/dist/renderer/assets/{UHTQJXKL-HX94GYaC.js → UHTQJXKL-Dr2lF0X7.js} +5 -5
- package/dist/renderer/assets/{URA2L2QI-khybz_tg.js → URA2L2QI-CpWV8ZqC.js} +1 -1
- package/dist/renderer/assets/{UXCHDUKG-QXpNrHim.js → UXCHDUKG-BhvBbCG9.js} +5 -5
- package/dist/renderer/assets/{VKNV3BUX-C2O2Bs2U.js → VKNV3BUX-BYO3cWfq.js} +6 -6
- package/dist/renderer/assets/{VMV7XPHP-D1gPv1dO.js → VMV7XPHP-Cv3j51G-.js} +1 -1
- package/dist/renderer/assets/{WEVWDWVA-DG15XyXu.js → WEVWDWVA-Bk5T2zs5.js} +1 -1
- package/dist/renderer/assets/{XRRJ35LF-DmN6YDeJ.js → XRRJ35LF-BmKX-UhN.js} +4 -4
- package/dist/renderer/assets/{YFKBLVVN-DeryBzcE.js → YFKBLVVN-BsN6JCME.js} +4 -4
- package/dist/renderer/assets/{YHRE5QGZ-DwPShfQy.js → YHRE5QGZ-BfqB5qTM.js} +7 -7
- package/dist/renderer/assets/{ZF3OVT4B-DHBhtnZM.js → ZF3OVT4B-71e7gqxT.js} +3 -3
- package/dist/renderer/assets/{index-DpKK1T1J.js → index-2bn6g3NY.js} +1 -1
- package/dist/renderer/assets/{index-B9Bbyah6.js → index-7XM2a0Z_.js} +3 -3
- package/dist/renderer/assets/{index-D1MMw9tV.js → index-BZI3MrwX.js} +1 -1
- package/dist/renderer/assets/{index-CGuZJqP1.js → index-BfRf6YNA.js} +276 -61
- package/dist/renderer/assets/{index-CgES-9Rd.js → index-BkXNa75_.js} +1 -1
- package/dist/renderer/assets/{index-xTPwwfve.js → index-C-S_Yg_y.js} +1 -1
- package/dist/renderer/assets/{index-Ur2F7eWX.js → index-CMEBb_j9.js} +1 -1
- package/dist/renderer/assets/{index-B06HNuaq.js → index-CcV4JcXV.js} +3 -3
- package/dist/renderer/assets/{index-m-tHhRHA.js → index-CeRIIlMp.js} +1 -1
- package/dist/renderer/assets/{index-CVN17YgJ.js → index-Cz6s0BAO.js} +1 -1
- package/dist/renderer/assets/{index-CHTW9ZSi.js → index-D3xwJ3eb.js} +1 -1
- package/dist/renderer/assets/{index-DEcNnx9-.js → index-DNjOyVpF.js} +1 -1
- package/dist/renderer/assets/{index-CY9PQWw8.js → index-DXBizOwH.js} +1 -1
- package/dist/renderer/assets/{index-toqSlBnN.js → index-DrX0ymyh.js} +1 -1
- package/dist/renderer/assets/{index-DqNxG-Ug.js → index-DwT_NY9Q.js} +1 -1
- package/dist/renderer/assets/{index-JyyTb9ao.js → index-FbcCt5ge.js} +1 -1
- package/dist/renderer/assets/{index-BouhGB9m.js → index-KXmfqOLZ.js} +1 -1
- package/dist/renderer/assets/{index-DvMk4oid.js → index-S_JLIQUn.js} +1 -1
- package/dist/renderer/assets/{index-sM1jjx0F.js → index-VDcE-MZS.js} +3 -3
- package/dist/renderer/assets/{index-BbOLrTvz.js → index-eE3MJT-Z.js} +1 -1
- package/dist/renderer/assets/{index-DZhqeNYh.js → index-fPGCpVWp.js} +1 -1
- package/dist/renderer/assets/{index-BF0P_ZMG.js → index-iM3KwPgz.js} +1 -1
- package/dist/renderer/assets/{lazy-BH99YeD2.js → lazy-SjZiJQmj.js} +3 -3
- package/dist/renderer/assets/{web-CXfy2WqP.js → web-BSnrlb26.js} +1 -1
- package/dist/renderer/assets/{web-CTn_ehbD.js → web-GpaN5nX1.js} +1 -1
- package/dist/renderer/assets/{web-B00tb1nG.js → web-raTBZuvw.js} +2 -2
- package/dist/renderer/index.html +1 -1
- package/package.json +1 -1
- package/themes/contract.json +1 -1
|
@@ -12072,10 +12072,10 @@ function Item(fun, array) {
|
|
|
12072
12072
|
}
|
|
12073
12073
|
function noop() {
|
|
12074
12074
|
}
|
|
12075
|
-
var browser, process, cachedSetTimeout, cachedClearTimeout, queue, draining, currentQueue, queueIndex, browserExports, process$1;
|
|
12075
|
+
var browser, process$1, cachedSetTimeout, cachedClearTimeout, queue, draining, currentQueue, queueIndex, browserExports, process$1$1;
|
|
12076
12076
|
var init_dist = __esmMin((() => {
|
|
12077
12077
|
browser = { exports: {} };
|
|
12078
|
-
process = browser.exports = {};
|
|
12078
|
+
process$1 = browser.exports = {};
|
|
12079
12079
|
(function() {
|
|
12080
12080
|
try {
|
|
12081
12081
|
if (typeof setTimeout === "function") cachedSetTimeout = setTimeout;
|
|
@@ -12093,7 +12093,7 @@ var init_dist = __esmMin((() => {
|
|
|
12093
12093
|
queue = [];
|
|
12094
12094
|
draining = false;
|
|
12095
12095
|
queueIndex = -1;
|
|
12096
|
-
process.nextTick = function(fun) {
|
|
12096
|
+
process$1.nextTick = function(fun) {
|
|
12097
12097
|
var args = new Array(arguments.length - 1);
|
|
12098
12098
|
if (arguments.length > 1) for (var i = 1; i < arguments.length; i++) args[i - 1] = arguments[i];
|
|
12099
12099
|
queue.push(new Item(fun, args));
|
|
@@ -12102,38 +12102,38 @@ var init_dist = __esmMin((() => {
|
|
|
12102
12102
|
Item.prototype.run = function() {
|
|
12103
12103
|
this.fun.apply(null, this.array);
|
|
12104
12104
|
};
|
|
12105
|
-
process.title = "browser";
|
|
12106
|
-
process.browser = true;
|
|
12107
|
-
process.env = {};
|
|
12108
|
-
process.argv = [];
|
|
12109
|
-
process.version = "";
|
|
12110
|
-
process.versions = {};
|
|
12111
|
-
process.on = noop;
|
|
12112
|
-
process.addListener = noop;
|
|
12113
|
-
process.once = noop;
|
|
12114
|
-
process.off = noop;
|
|
12115
|
-
process.removeListener = noop;
|
|
12116
|
-
process.removeAllListeners = noop;
|
|
12117
|
-
process.emit = noop;
|
|
12118
|
-
process.prependListener = noop;
|
|
12119
|
-
process.prependOnceListener = noop;
|
|
12120
|
-
process.listeners = function(name) {
|
|
12105
|
+
process$1.title = "browser";
|
|
12106
|
+
process$1.browser = true;
|
|
12107
|
+
process$1.env = {};
|
|
12108
|
+
process$1.argv = [];
|
|
12109
|
+
process$1.version = "";
|
|
12110
|
+
process$1.versions = {};
|
|
12111
|
+
process$1.on = noop;
|
|
12112
|
+
process$1.addListener = noop;
|
|
12113
|
+
process$1.once = noop;
|
|
12114
|
+
process$1.off = noop;
|
|
12115
|
+
process$1.removeListener = noop;
|
|
12116
|
+
process$1.removeAllListeners = noop;
|
|
12117
|
+
process$1.emit = noop;
|
|
12118
|
+
process$1.prependListener = noop;
|
|
12119
|
+
process$1.prependOnceListener = noop;
|
|
12120
|
+
process$1.listeners = function(name) {
|
|
12121
12121
|
return [];
|
|
12122
12122
|
};
|
|
12123
|
-
process.binding = function(name) {
|
|
12123
|
+
process$1.binding = function(name) {
|
|
12124
12124
|
throw new Error("process.binding is not supported");
|
|
12125
12125
|
};
|
|
12126
|
-
process.cwd = function() {
|
|
12126
|
+
process$1.cwd = function() {
|
|
12127
12127
|
return "/";
|
|
12128
12128
|
};
|
|
12129
|
-
process.chdir = function(dir) {
|
|
12129
|
+
process$1.chdir = function(dir) {
|
|
12130
12130
|
throw new Error("process.chdir is not supported");
|
|
12131
12131
|
};
|
|
12132
|
-
process.umask = function() {
|
|
12132
|
+
process$1.umask = function() {
|
|
12133
12133
|
return 0;
|
|
12134
12134
|
};
|
|
12135
12135
|
browserExports = browser.exports;
|
|
12136
|
-
process$1 = /* @__PURE__ */ getDefaultExportFromCjs(browserExports);
|
|
12136
|
+
process$1$1 = /* @__PURE__ */ getDefaultExportFromCjs(browserExports);
|
|
12137
12137
|
}));
|
|
12138
12138
|
var require_stream_browser = /* @__PURE__ */ __commonJSMin(((exports$1, module2) => {
|
|
12139
12139
|
module2.exports = require_events().EventEmitter;
|
|
@@ -14298,8 +14298,8 @@ var require_types = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
|
14298
14298
|
var BigIntSupported = typeof BigInt !== "undefined";
|
|
14299
14299
|
var SymbolSupported = typeof Symbol !== "undefined";
|
|
14300
14300
|
var ObjectToString = uncurryThis(Object.prototype.toString);
|
|
14301
|
-
var
|
|
14302
|
-
var
|
|
14301
|
+
var numberValue2 = uncurryThis(Number.prototype.valueOf);
|
|
14302
|
+
var stringValue2 = uncurryThis(String.prototype.valueOf);
|
|
14303
14303
|
var booleanValue = uncurryThis(Boolean.prototype.valueOf);
|
|
14304
14304
|
if (BigIntSupported) var bigIntValue = uncurryThis(BigInt.prototype.valueOf);
|
|
14305
14305
|
if (SymbolSupported) var symbolValue = uncurryThis(Symbol.prototype.valueOf);
|
|
@@ -14452,11 +14452,11 @@ var require_types = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
|
14452
14452
|
}
|
|
14453
14453
|
exports$1.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;
|
|
14454
14454
|
function isNumberObject(value) {
|
|
14455
|
-
return checkBoxedPrimitive(value,
|
|
14455
|
+
return checkBoxedPrimitive(value, numberValue2);
|
|
14456
14456
|
}
|
|
14457
14457
|
exports$1.isNumberObject = isNumberObject;
|
|
14458
14458
|
function isStringObject(value) {
|
|
14459
|
-
return checkBoxedPrimitive(value,
|
|
14459
|
+
return checkBoxedPrimitive(value, stringValue2);
|
|
14460
14460
|
}
|
|
14461
14461
|
exports$1.isStringObject = isStringObject;
|
|
14462
14462
|
function isBooleanObject(value) {
|
|
@@ -14538,15 +14538,15 @@ var require_util = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
|
14538
14538
|
return str;
|
|
14539
14539
|
};
|
|
14540
14540
|
exports$1.deprecate = function(fn, msg) {
|
|
14541
|
-
if (typeof process$1 !== "undefined" && process$1.noDeprecation === true) return fn;
|
|
14542
|
-
if (typeof process$1 === "undefined") return function() {
|
|
14541
|
+
if (typeof process$1$1 !== "undefined" && process$1$1.noDeprecation === true) return fn;
|
|
14542
|
+
if (typeof process$1$1 === "undefined") return function() {
|
|
14543
14543
|
return exports$1.deprecate(fn, msg).apply(this, arguments);
|
|
14544
14544
|
};
|
|
14545
14545
|
var warned = false;
|
|
14546
14546
|
function deprecated() {
|
|
14547
14547
|
if (!warned) {
|
|
14548
|
-
if (process$1.throwDeprecation) throw new Error(msg);
|
|
14549
|
-
else if (process$1.traceDeprecation) console.trace(msg);
|
|
14548
|
+
if (process$1$1.throwDeprecation) throw new Error(msg);
|
|
14549
|
+
else if (process$1$1.traceDeprecation) console.trace(msg);
|
|
14550
14550
|
else console.error(msg);
|
|
14551
14551
|
warned = true;
|
|
14552
14552
|
}
|
|
@@ -14556,15 +14556,15 @@ var require_util = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
|
14556
14556
|
};
|
|
14557
14557
|
var debugs = {};
|
|
14558
14558
|
var debugEnvRegex = /^$/;
|
|
14559
|
-
if (process$1.env.NODE_DEBUG) {
|
|
14560
|
-
var debugEnv = process$1.env.NODE_DEBUG;
|
|
14559
|
+
if (process$1$1.env.NODE_DEBUG) {
|
|
14560
|
+
var debugEnv = process$1$1.env.NODE_DEBUG;
|
|
14561
14561
|
debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase();
|
|
14562
14562
|
debugEnvRegex = new RegExp("^" + debugEnv + "$", "i");
|
|
14563
14563
|
}
|
|
14564
14564
|
exports$1.debuglog = function(set) {
|
|
14565
14565
|
set = set.toUpperCase();
|
|
14566
14566
|
if (!debugs[set]) if (debugEnvRegex.test(set)) {
|
|
14567
|
-
var pid = process$1.pid;
|
|
14567
|
+
var pid = process$1$1.pid;
|
|
14568
14568
|
debugs[set] = function() {
|
|
14569
14569
|
var msg = exports$1.format.apply(exports$1, arguments);
|
|
14570
14570
|
console.error("%s %d: %s", set, pid, msg);
|
|
@@ -14901,9 +14901,9 @@ var require_util = /* @__PURE__ */ __commonJSMin(((exports$1) => {
|
|
|
14901
14901
|
return maybeCb.apply(self2, arguments);
|
|
14902
14902
|
};
|
|
14903
14903
|
original.apply(this, args).then(function(ret) {
|
|
14904
|
-
process$1.nextTick(cb.bind(null, null, ret));
|
|
14904
|
+
process$1$1.nextTick(cb.bind(null, null, ret));
|
|
14905
14905
|
}, function(rej) {
|
|
14906
|
-
process$1.nextTick(callbackifyOnRejected.bind(null, rej, cb));
|
|
14906
|
+
process$1$1.nextTick(callbackifyOnRejected.bind(null, rej, cb));
|
|
14907
14907
|
});
|
|
14908
14908
|
}
|
|
14909
14909
|
Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));
|
|
@@ -15158,10 +15158,10 @@ var require_destroy = /* @__PURE__ */ __commonJSMin(((exports$1, module2) => {
|
|
|
15158
15158
|
if (readableDestroyed || writableDestroyed) {
|
|
15159
15159
|
if (cb) cb(err);
|
|
15160
15160
|
else if (err) {
|
|
15161
|
-
if (!this._writableState) process$1.nextTick(emitErrorNT, this, err);
|
|
15161
|
+
if (!this._writableState) process$1$1.nextTick(emitErrorNT, this, err);
|
|
15162
15162
|
else if (!this._writableState.errorEmitted) {
|
|
15163
15163
|
this._writableState.errorEmitted = true;
|
|
15164
|
-
process$1.nextTick(emitErrorNT, this, err);
|
|
15164
|
+
process$1$1.nextTick(emitErrorNT, this, err);
|
|
15165
15165
|
}
|
|
15166
15166
|
}
|
|
15167
15167
|
return this;
|
|
@@ -15169,15 +15169,15 @@ var require_destroy = /* @__PURE__ */ __commonJSMin(((exports$1, module2) => {
|
|
|
15169
15169
|
if (this._readableState) this._readableState.destroyed = true;
|
|
15170
15170
|
if (this._writableState) this._writableState.destroyed = true;
|
|
15171
15171
|
this._destroy(err || null, function(err2) {
|
|
15172
|
-
if (!cb && err2) if (!_this._writableState) process$1.nextTick(emitErrorAndCloseNT, _this, err2);
|
|
15172
|
+
if (!cb && err2) if (!_this._writableState) process$1$1.nextTick(emitErrorAndCloseNT, _this, err2);
|
|
15173
15173
|
else if (!_this._writableState.errorEmitted) {
|
|
15174
15174
|
_this._writableState.errorEmitted = true;
|
|
15175
|
-
process$1.nextTick(emitErrorAndCloseNT, _this, err2);
|
|
15176
|
-
} else process$1.nextTick(emitCloseNT, _this);
|
|
15175
|
+
process$1$1.nextTick(emitErrorAndCloseNT, _this, err2);
|
|
15176
|
+
} else process$1$1.nextTick(emitCloseNT, _this);
|
|
15177
15177
|
else if (cb) {
|
|
15178
|
-
process$1.nextTick(emitCloseNT, _this);
|
|
15178
|
+
process$1$1.nextTick(emitCloseNT, _this);
|
|
15179
15179
|
cb(err2);
|
|
15180
|
-
} else process$1.nextTick(emitCloseNT, _this);
|
|
15180
|
+
} else process$1$1.nextTick(emitCloseNT, _this);
|
|
15181
15181
|
});
|
|
15182
15182
|
return this;
|
|
15183
15183
|
}
|
|
@@ -15464,7 +15464,7 @@ var require__stream_writable = /* @__PURE__ */ __commonJSMin(((exports$1, module
|
|
|
15464
15464
|
function writeAfterEnd(stream, cb) {
|
|
15465
15465
|
var er = new ERR_STREAM_WRITE_AFTER_END();
|
|
15466
15466
|
errorOrDestroy(stream, er);
|
|
15467
|
-
process$1.nextTick(cb, er);
|
|
15467
|
+
process$1$1.nextTick(cb, er);
|
|
15468
15468
|
}
|
|
15469
15469
|
function validChunk(stream, state, chunk, cb) {
|
|
15470
15470
|
var er;
|
|
@@ -15472,7 +15472,7 @@ var require__stream_writable = /* @__PURE__ */ __commonJSMin(((exports$1, module
|
|
|
15472
15472
|
else if (typeof chunk !== "string" && !state.objectMode) er = new ERR_INVALID_ARG_TYPE("chunk", ["string", "Buffer"], chunk);
|
|
15473
15473
|
if (er) {
|
|
15474
15474
|
errorOrDestroy(stream, er);
|
|
15475
|
-
process$1.nextTick(cb, er);
|
|
15475
|
+
process$1$1.nextTick(cb, er);
|
|
15476
15476
|
return false;
|
|
15477
15477
|
}
|
|
15478
15478
|
return true;
|
|
@@ -15581,8 +15581,8 @@ var require__stream_writable = /* @__PURE__ */ __commonJSMin(((exports$1, module
|
|
|
15581
15581
|
function onwriteError(stream, state, sync, er, cb) {
|
|
15582
15582
|
--state.pendingcb;
|
|
15583
15583
|
if (sync) {
|
|
15584
|
-
process$1.nextTick(cb, er);
|
|
15585
|
-
process$1.nextTick(finishMaybe, stream, state);
|
|
15584
|
+
process$1$1.nextTick(cb, er);
|
|
15585
|
+
process$1$1.nextTick(finishMaybe, stream, state);
|
|
15586
15586
|
stream._writableState.errorEmitted = true;
|
|
15587
15587
|
errorOrDestroy(stream, er);
|
|
15588
15588
|
} else {
|
|
@@ -15608,7 +15608,7 @@ var require__stream_writable = /* @__PURE__ */ __commonJSMin(((exports$1, module
|
|
|
15608
15608
|
else {
|
|
15609
15609
|
var finished = needFinish(state) || stream.destroyed;
|
|
15610
15610
|
if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(stream, state);
|
|
15611
|
-
if (sync) process$1.nextTick(afterWrite, stream, state, finished, cb);
|
|
15611
|
+
if (sync) process$1$1.nextTick(afterWrite, stream, state, finished, cb);
|
|
15612
15612
|
else afterWrite(stream, state, finished, cb);
|
|
15613
15613
|
}
|
|
15614
15614
|
}
|
|
@@ -15708,7 +15708,7 @@ var require__stream_writable = /* @__PURE__ */ __commonJSMin(((exports$1, module
|
|
|
15708
15708
|
if (!state.prefinished && !state.finalCalled) if (typeof stream._final === "function" && !state.destroyed) {
|
|
15709
15709
|
state.pendingcb++;
|
|
15710
15710
|
state.finalCalled = true;
|
|
15711
|
-
process$1.nextTick(callFinal, stream, state);
|
|
15711
|
+
process$1$1.nextTick(callFinal, stream, state);
|
|
15712
15712
|
} else {
|
|
15713
15713
|
state.prefinished = true;
|
|
15714
15714
|
stream.emit("prefinish");
|
|
@@ -15732,7 +15732,7 @@ var require__stream_writable = /* @__PURE__ */ __commonJSMin(((exports$1, module
|
|
|
15732
15732
|
function endWritable(stream, state, cb) {
|
|
15733
15733
|
state.ending = true;
|
|
15734
15734
|
finishMaybe(stream, state);
|
|
15735
|
-
if (cb) if (state.finished) process$1.nextTick(cb);
|
|
15735
|
+
if (cb) if (state.finished) process$1$1.nextTick(cb);
|
|
15736
15736
|
else stream.once("finish", cb);
|
|
15737
15737
|
state.ended = true;
|
|
15738
15738
|
stream.writable = false;
|
|
@@ -15815,7 +15815,7 @@ var require__stream_duplex = /* @__PURE__ */ __commonJSMin(((exports$1, module2)
|
|
|
15815
15815
|
});
|
|
15816
15816
|
function onend() {
|
|
15817
15817
|
if (this._writableState.ended) return;
|
|
15818
|
-
process$1.nextTick(onEndNT, this);
|
|
15818
|
+
process$1$1.nextTick(onEndNT, this);
|
|
15819
15819
|
}
|
|
15820
15820
|
function onEndNT(self2) {
|
|
15821
15821
|
self2.end();
|
|
@@ -16232,7 +16232,7 @@ var require_async_iterator = /* @__PURE__ */ __commonJSMin(((exports$1, module2)
|
|
|
16232
16232
|
}
|
|
16233
16233
|
}
|
|
16234
16234
|
function onReadable(iter) {
|
|
16235
|
-
process$1.nextTick(readAndResolve, iter);
|
|
16235
|
+
process$1$1.nextTick(readAndResolve, iter);
|
|
16236
16236
|
}
|
|
16237
16237
|
function wrapForNext(lastPromise, iter) {
|
|
16238
16238
|
return function(resolve, reject) {
|
|
@@ -16257,7 +16257,7 @@ var require_async_iterator = /* @__PURE__ */ __commonJSMin(((exports$1, module2)
|
|
|
16257
16257
|
if (error !== null) return Promise.reject(error);
|
|
16258
16258
|
if (this[kEnded]) return Promise.resolve(createIterResult(void 0, true));
|
|
16259
16259
|
if (this[kStream].destroyed) return new Promise(function(resolve, reject) {
|
|
16260
|
-
process$1.nextTick(function() {
|
|
16260
|
+
process$1$1.nextTick(function() {
|
|
16261
16261
|
if (_this[kError]) reject(_this[kError]);
|
|
16262
16262
|
else resolve(createIterResult(void 0, true));
|
|
16263
16263
|
});
|
|
@@ -16655,7 +16655,7 @@ var require__stream_readable = /* @__PURE__ */ __commonJSMin(((exports$1, module
|
|
|
16655
16655
|
if (!state.emittedReadable) {
|
|
16656
16656
|
debug("emitReadable", state.flowing);
|
|
16657
16657
|
state.emittedReadable = true;
|
|
16658
|
-
process$1.nextTick(emitReadable_, stream);
|
|
16658
|
+
process$1$1.nextTick(emitReadable_, stream);
|
|
16659
16659
|
}
|
|
16660
16660
|
}
|
|
16661
16661
|
function emitReadable_(stream) {
|
|
@@ -16671,7 +16671,7 @@ var require__stream_readable = /* @__PURE__ */ __commonJSMin(((exports$1, module
|
|
|
16671
16671
|
function maybeReadMore(stream, state) {
|
|
16672
16672
|
if (!state.readingMore) {
|
|
16673
16673
|
state.readingMore = true;
|
|
16674
|
-
process$1.nextTick(maybeReadMore_, stream, state);
|
|
16674
|
+
process$1$1.nextTick(maybeReadMore_, stream, state);
|
|
16675
16675
|
}
|
|
16676
16676
|
}
|
|
16677
16677
|
function maybeReadMore_(stream, state) {
|
|
@@ -16702,8 +16702,8 @@ var require__stream_readable = /* @__PURE__ */ __commonJSMin(((exports$1, module
|
|
|
16702
16702
|
}
|
|
16703
16703
|
state.pipesCount += 1;
|
|
16704
16704
|
debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);
|
|
16705
|
-
var endFn = (!pipeOpts || pipeOpts.end !== false) && dest !== process$1.stdout && dest !== process$1.stderr ? onend : unpipe;
|
|
16706
|
-
if (state.endEmitted) process$1.nextTick(endFn);
|
|
16705
|
+
var endFn = (!pipeOpts || pipeOpts.end !== false) && dest !== process$1$1.stdout && dest !== process$1$1.stderr ? onend : unpipe;
|
|
16706
|
+
if (state.endEmitted) process$1$1.nextTick(endFn);
|
|
16707
16707
|
else src.once("end", endFn);
|
|
16708
16708
|
dest.on("unpipe", onunpipe);
|
|
16709
16709
|
function onunpipe(readable, unpipeInfo) {
|
|
@@ -16831,7 +16831,7 @@ var require__stream_readable = /* @__PURE__ */ __commonJSMin(((exports$1, module
|
|
|
16831
16831
|
state.emittedReadable = false;
|
|
16832
16832
|
debug("on readable", state.length, state.reading);
|
|
16833
16833
|
if (state.length) emitReadable(this);
|
|
16834
|
-
else if (!state.reading) process$1.nextTick(nReadingNextTick, this);
|
|
16834
|
+
else if (!state.reading) process$1$1.nextTick(nReadingNextTick, this);
|
|
16835
16835
|
}
|
|
16836
16836
|
}
|
|
16837
16837
|
return res;
|
|
@@ -16839,12 +16839,12 @@ var require__stream_readable = /* @__PURE__ */ __commonJSMin(((exports$1, module
|
|
|
16839
16839
|
Readable.prototype.addListener = Readable.prototype.on;
|
|
16840
16840
|
Readable.prototype.removeListener = function(ev, fn) {
|
|
16841
16841
|
var res = Stream.prototype.removeListener.call(this, ev, fn);
|
|
16842
|
-
if (ev === "readable") process$1.nextTick(updateReadableListening, this);
|
|
16842
|
+
if (ev === "readable") process$1$1.nextTick(updateReadableListening, this);
|
|
16843
16843
|
return res;
|
|
16844
16844
|
};
|
|
16845
16845
|
Readable.prototype.removeAllListeners = function(ev) {
|
|
16846
16846
|
var res = Stream.prototype.removeAllListeners.apply(this, arguments);
|
|
16847
|
-
if (ev === "readable" || ev === void 0) process$1.nextTick(updateReadableListening, this);
|
|
16847
|
+
if (ev === "readable" || ev === void 0) process$1$1.nextTick(updateReadableListening, this);
|
|
16848
16848
|
return res;
|
|
16849
16849
|
};
|
|
16850
16850
|
function updateReadableListening(self2) {
|
|
@@ -16870,7 +16870,7 @@ var require__stream_readable = /* @__PURE__ */ __commonJSMin(((exports$1, module
|
|
|
16870
16870
|
function resume(stream, state) {
|
|
16871
16871
|
if (!state.resumeScheduled) {
|
|
16872
16872
|
state.resumeScheduled = true;
|
|
16873
|
-
process$1.nextTick(resume_, stream, state);
|
|
16873
|
+
process$1$1.nextTick(resume_, stream, state);
|
|
16874
16874
|
}
|
|
16875
16875
|
}
|
|
16876
16876
|
function resume_(stream, state) {
|
|
@@ -16982,7 +16982,7 @@ var require__stream_readable = /* @__PURE__ */ __commonJSMin(((exports$1, module
|
|
|
16982
16982
|
debug("endReadable", state.endEmitted);
|
|
16983
16983
|
if (!state.endEmitted) {
|
|
16984
16984
|
state.ended = true;
|
|
16985
|
-
process$1.nextTick(endReadableNT, state, stream);
|
|
16985
|
+
process$1$1.nextTick(endReadableNT, state, stream);
|
|
16986
16986
|
}
|
|
16987
16987
|
}
|
|
16988
16988
|
function endReadableNT(state, stream) {
|
|
@@ -19218,8 +19218,12 @@ var BuilderElement = class extends XmlComponent {
|
|
|
19218
19218
|
var AlignmentType = {
|
|
19219
19219
|
/** Align Start */
|
|
19220
19220
|
START: "start",
|
|
19221
|
+
/** Align Center */
|
|
19222
|
+
CENTER: "center",
|
|
19221
19223
|
/** Align Left */
|
|
19222
|
-
LEFT: "left"
|
|
19224
|
+
LEFT: "left",
|
|
19225
|
+
/** Align Right */
|
|
19226
|
+
RIGHT: "right"
|
|
19223
19227
|
};
|
|
19224
19228
|
var createAlignment = (type) => new BuilderElement({
|
|
19225
19229
|
name: "w:jc",
|
|
@@ -24564,6 +24568,8 @@ var Media = class {
|
|
|
24564
24568
|
}
|
|
24565
24569
|
};
|
|
24566
24570
|
var LevelFormat = {
|
|
24571
|
+
/** Decimal numbering (1, 2, 3...). */
|
|
24572
|
+
DECIMAL: "decimal",
|
|
24567
24573
|
/** Bullet points. */
|
|
24568
24574
|
BULLET: "bullet"
|
|
24569
24575
|
};
|
|
@@ -25665,6 +25671,35 @@ var File = class {
|
|
|
25665
25671
|
return this.fontWrapper;
|
|
25666
25672
|
}
|
|
25667
25673
|
};
|
|
25674
|
+
var Footer = class {
|
|
25675
|
+
constructor(options = { children: [] }) {
|
|
25676
|
+
_defineProperty(this, "options", void 0);
|
|
25677
|
+
this.options = options;
|
|
25678
|
+
}
|
|
25679
|
+
};
|
|
25680
|
+
var FootNoteReferenceRunAttributes = class extends XmlAttributeComponent {
|
|
25681
|
+
constructor(..._args) {
|
|
25682
|
+
super(..._args);
|
|
25683
|
+
_defineProperty(this, "xmlKeys", { id: "w:id" });
|
|
25684
|
+
}
|
|
25685
|
+
};
|
|
25686
|
+
var FootnoteReference = class extends XmlComponent {
|
|
25687
|
+
constructor(id) {
|
|
25688
|
+
super("w:footnoteReference");
|
|
25689
|
+
this.root.push(new FootNoteReferenceRunAttributes({ id }));
|
|
25690
|
+
}
|
|
25691
|
+
};
|
|
25692
|
+
var FootnoteReferenceRun = class extends Run {
|
|
25693
|
+
/**
|
|
25694
|
+
* Creates a new footnote reference run.
|
|
25695
|
+
*
|
|
25696
|
+
* @param id - Unique identifier linking to the footnote content
|
|
25697
|
+
*/
|
|
25698
|
+
constructor(id) {
|
|
25699
|
+
super({ style: "FootnoteReference" });
|
|
25700
|
+
this.root.push(new FootnoteReference(id));
|
|
25701
|
+
}
|
|
25702
|
+
};
|
|
25668
25703
|
var require_jszip_min = /* @__PURE__ */ __commonJSMin(((exports$1, module2) => {
|
|
25669
25704
|
init_dist$1();
|
|
25670
25705
|
init_dist();
|
|
@@ -28669,7 +28704,7 @@ var require_jszip_min = /* @__PURE__ */ __commonJSMin(((exports$1, module2) => {
|
|
|
28669
28704
|
if (!r2.setImmediate) {
|
|
28670
28705
|
var i, s, t2, a, o = 1, h = {}, u = false, l = r2.document, e3 = Object.getPrototypeOf && Object.getPrototypeOf(r2);
|
|
28671
28706
|
e3 = e3 && e3.setTimeout ? e3 : r2, i = "[object process]" === {}.toString.call(r2.process) ? function(e4) {
|
|
28672
|
-
process$1.nextTick(function() {
|
|
28707
|
+
process$1$1.nextTick(function() {
|
|
28673
28708
|
c(e4);
|
|
28674
28709
|
});
|
|
28675
28710
|
} : (function() {
|
|
@@ -28770,7 +28805,7 @@ var require_xml = /* @__PURE__ */ __commonJSMin(((exports$1, module2) => {
|
|
|
28770
28805
|
var stream = options.stream ? new Stream() : null, output = "", interrupted = false, indent2 = !options.indent ? "" : options.indent === true ? DEFAULT_INDENT : options.indent, instant = true;
|
|
28771
28806
|
function delay(func) {
|
|
28772
28807
|
if (!instant) func();
|
|
28773
|
-
else process$1.nextTick(func);
|
|
28808
|
+
else process$1$1.nextTick(func);
|
|
28774
28809
|
}
|
|
28775
28810
|
function append(interrupt, out) {
|
|
28776
28811
|
if (out !== void 0) output += out;
|
|
@@ -29555,6 +29590,114 @@ var Packer = class Packer2 {
|
|
|
29555
29590
|
}
|
|
29556
29591
|
};
|
|
29557
29592
|
_defineProperty(Packer, "compiler", new Compiler());
|
|
29593
|
+
const DEFAULT_STYLE = {
|
|
29594
|
+
text: "24292F",
|
|
29595
|
+
secondaryText: "656D76",
|
|
29596
|
+
link: "0969DA",
|
|
29597
|
+
bodyFontStack: "Segoe UI, Helvetica, Arial, sans-serif",
|
|
29598
|
+
monoFontStack: "Consolas, Menlo, monospace",
|
|
29599
|
+
bodySize: 16,
|
|
29600
|
+
lineHeight: 1.75,
|
|
29601
|
+
inlineCodeBackground: "EFF1F3",
|
|
29602
|
+
codeBlockBackground: "F6F8FA",
|
|
29603
|
+
codeBlockText: "24292F",
|
|
29604
|
+
highlightBackground: "FFF3BF",
|
|
29605
|
+
blockquoteBorder: "D0D7DE",
|
|
29606
|
+
border: "D0D7DE",
|
|
29607
|
+
tableHeaderBackground: "F6F8FA"
|
|
29608
|
+
};
|
|
29609
|
+
const HEADING_SCALE = [1.9, 1.55, 1.3, 1.12, 1, 1];
|
|
29610
|
+
function hexColor(value, fallback) {
|
|
29611
|
+
if (typeof value !== "string") return fallback;
|
|
29612
|
+
const raw = value.trim().replace(/^#/, "");
|
|
29613
|
+
if (/^[0-9a-f]{3}$/i.test(raw)) return raw.split("").map((digit) => digit + digit).join("").toUpperCase();
|
|
29614
|
+
if (/^[0-9a-f]{6}$/i.test(raw)) return raw.toUpperCase();
|
|
29615
|
+
if (/^[0-9a-f]{8}$/i.test(raw)) return raw.slice(0, 6).toUpperCase();
|
|
29616
|
+
return fallback;
|
|
29617
|
+
}
|
|
29618
|
+
function stringValue(value, fallback) {
|
|
29619
|
+
return typeof value === "string" && value.trim() !== "" ? value.trim() : fallback;
|
|
29620
|
+
}
|
|
29621
|
+
function numberValue(value, fallback, min, max) {
|
|
29622
|
+
return typeof value === "number" && Number.isFinite(value) ? Math.min(max, Math.max(min, value)) : fallback;
|
|
29623
|
+
}
|
|
29624
|
+
const FRONTMATTER_MAPPING = /^[ \t]*(?:[\p{L}\p{N}_][\p{L}\p{N}_.-]*|"(?:[^"\\\n]|\\.)*"|'(?:[^'\\\n]|\\.)*')[ \t]*:([ \t]|$)/mu;
|
|
29625
|
+
function frontmatterEnd(text2) {
|
|
29626
|
+
if (!text2.startsWith("---")) return 0;
|
|
29627
|
+
const firstLineEnd = text2.indexOf("\n");
|
|
29628
|
+
if (firstLineEnd === -1) return 0;
|
|
29629
|
+
if (text2.slice(0, firstLineEnd).trim() !== "---") return 0;
|
|
29630
|
+
const rest = text2.slice(firstLineEnd + 1);
|
|
29631
|
+
const close = /^(?:---|\.\.\.)[ \t]*$/m.exec(rest);
|
|
29632
|
+
if (!close) return 0;
|
|
29633
|
+
const body = rest.slice(0, close.index);
|
|
29634
|
+
if (!FRONTMATTER_MAPPING.test(body)) return 0;
|
|
29635
|
+
return firstLineEnd + 1 + close.index + close[0].length;
|
|
29636
|
+
}
|
|
29637
|
+
function normalizeImageSizes(raw) {
|
|
29638
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
|
|
29639
|
+
const sizes = {};
|
|
29640
|
+
for (const [name, value] of Object.entries(raw)) {
|
|
29641
|
+
if (!value || typeof value !== "object") continue;
|
|
29642
|
+
const width = value.width;
|
|
29643
|
+
const height = value.height;
|
|
29644
|
+
if (typeof width === "number" && Number.isFinite(width) && width > 0 && typeof height === "number" && Number.isFinite(height) && height > 0) {
|
|
29645
|
+
sizes[name] = { width: Math.min(4e3, width), height: Math.min(4e3, height) };
|
|
29646
|
+
}
|
|
29647
|
+
}
|
|
29648
|
+
return Object.keys(sizes).length > 0 ? sizes : void 0;
|
|
29649
|
+
}
|
|
29650
|
+
function normalizeStyle(raw) {
|
|
29651
|
+
const source = typeof raw === "object" && raw !== null ? raw : {};
|
|
29652
|
+
const blockquoteBackground = typeof source.blockquoteBackground === "string" ? hexColor(source.blockquoteBackground, "") : "";
|
|
29653
|
+
return {
|
|
29654
|
+
text: hexColor(source.text, DEFAULT_STYLE.text),
|
|
29655
|
+
secondaryText: hexColor(source.secondaryText, DEFAULT_STYLE.secondaryText),
|
|
29656
|
+
link: hexColor(source.link, DEFAULT_STYLE.link),
|
|
29657
|
+
bodyFontStack: stringValue(source.bodyFontStack, DEFAULT_STYLE.bodyFontStack),
|
|
29658
|
+
monoFontStack: stringValue(source.monoFontStack, DEFAULT_STYLE.monoFontStack),
|
|
29659
|
+
bodySize: numberValue(source.bodySize, DEFAULT_STYLE.bodySize, 8, 40),
|
|
29660
|
+
lineHeight: numberValue(source.lineHeight, DEFAULT_STYLE.lineHeight, 1, 3),
|
|
29661
|
+
inlineCodeBackground: hexColor(source.inlineCodeBackground, DEFAULT_STYLE.inlineCodeBackground),
|
|
29662
|
+
codeBlockBackground: hexColor(source.codeBlockBackground, DEFAULT_STYLE.codeBlockBackground),
|
|
29663
|
+
codeBlockText: hexColor(source.codeBlockText, DEFAULT_STYLE.codeBlockText),
|
|
29664
|
+
highlightBackground: hexColor(source.highlightBackground, DEFAULT_STYLE.highlightBackground),
|
|
29665
|
+
blockquoteBorder: hexColor(source.blockquoteBorder, DEFAULT_STYLE.blockquoteBorder),
|
|
29666
|
+
blockquoteBackground: blockquoteBackground !== "" ? blockquoteBackground : null,
|
|
29667
|
+
border: hexColor(source.border, DEFAULT_STYLE.border),
|
|
29668
|
+
tableHeaderBackground: hexColor(source.tableHeaderBackground, DEFAULT_STYLE.tableHeaderBackground)
|
|
29669
|
+
};
|
|
29670
|
+
}
|
|
29671
|
+
function fontName(stack, mono) {
|
|
29672
|
+
const generic = /* @__PURE__ */ new Set([
|
|
29673
|
+
"serif",
|
|
29674
|
+
"sans-serif",
|
|
29675
|
+
"monospace",
|
|
29676
|
+
"system-ui",
|
|
29677
|
+
"ui-sans-serif",
|
|
29678
|
+
"ui-monospace",
|
|
29679
|
+
"cursive",
|
|
29680
|
+
"fantasy",
|
|
29681
|
+
"-apple-system",
|
|
29682
|
+
"blinkmacsystemfont"
|
|
29683
|
+
]);
|
|
29684
|
+
const families = stack.split(",").map((family) => family.trim().replace(/^["']|["']$/g, "")).filter((family) => family !== "" && !generic.has(family.toLowerCase()));
|
|
29685
|
+
const platform = process.platform;
|
|
29686
|
+
const preferred = mono ? platform === "win32" ? ["consolas", "cascadia code", "fira code", "menlo"] : platform === "darwin" ? ["sf mono", "menlo", "fira code", "consolas"] : ["dejavu sans mono", "liberation mono", "noto sans mono"] : platform === "win32" ? ["segoe ui", "microsoft yahei", "noto sans"] : platform === "darwin" ? ["helvetica neue", "helvetica", "noto sans"] : ["noto sans", "dejavu sans"];
|
|
29687
|
+
for (const name of preferred) {
|
|
29688
|
+
const hit = families.find((family) => family.toLowerCase() === name);
|
|
29689
|
+
if (hit) return hit;
|
|
29690
|
+
}
|
|
29691
|
+
if (families[0]) return families[0];
|
|
29692
|
+
if (mono) return platform === "win32" ? "Consolas" : platform === "darwin" ? "Menlo" : "DejaVu Sans Mono";
|
|
29693
|
+
return platform === "win32" ? "Segoe UI" : platform === "darwin" ? "Helvetica Neue" : "Noto Sans";
|
|
29694
|
+
}
|
|
29695
|
+
function halfPoints(px) {
|
|
29696
|
+
return Math.max(2, Math.round(px * 1.5));
|
|
29697
|
+
}
|
|
29698
|
+
function emTwips(px, em) {
|
|
29699
|
+
return Math.round(px * em * 15);
|
|
29700
|
+
}
|
|
29558
29701
|
function headingForDepth(depth) {
|
|
29559
29702
|
const headings = [
|
|
29560
29703
|
HeadingLevel.HEADING_1,
|
|
@@ -29571,28 +29714,99 @@ function textContent(node2) {
|
|
|
29571
29714
|
if (node2.type === "break") return "\n";
|
|
29572
29715
|
return node2.children?.map(textContent).join("") ?? "";
|
|
29573
29716
|
}
|
|
29574
|
-
function
|
|
29717
|
+
function textRuns(text2, context, style) {
|
|
29718
|
+
if (!text2.includes("==")) return [new TextRun({ text: text2, ...style })];
|
|
29719
|
+
const runs = [];
|
|
29720
|
+
const pattern = /==([^=\n]+)==/g;
|
|
29721
|
+
let cursor = 0;
|
|
29722
|
+
for (const match of text2.matchAll(pattern)) {
|
|
29723
|
+
const index2 = match.index ?? 0;
|
|
29724
|
+
if (index2 > cursor) runs.push(new TextRun({ text: text2.slice(cursor, index2), ...style }));
|
|
29725
|
+
runs.push(new TextRun({
|
|
29726
|
+
text: match[1] ?? "",
|
|
29727
|
+
...style,
|
|
29728
|
+
shading: { fill: context.style.highlightBackground }
|
|
29729
|
+
}));
|
|
29730
|
+
cursor = index2 + match[0].length;
|
|
29731
|
+
}
|
|
29732
|
+
if (cursor === 0) return [new TextRun({ text: text2, ...style })];
|
|
29733
|
+
if (cursor < text2.length) runs.push(new TextRun({ text: text2.slice(cursor), ...style }));
|
|
29734
|
+
return runs;
|
|
29735
|
+
}
|
|
29736
|
+
function inlineRuns(nodes, context, style = {}) {
|
|
29575
29737
|
if (!nodes) return [];
|
|
29576
29738
|
const runs = [];
|
|
29577
29739
|
for (const node2 of nodes) {
|
|
29578
29740
|
if (node2.type === "text") {
|
|
29579
|
-
runs.push(
|
|
29741
|
+
runs.push(...textRuns(node2.value ?? "", context, style));
|
|
29580
29742
|
} else if (node2.type === "break") {
|
|
29581
29743
|
runs.push(new TextRun({ break: 1, ...style }));
|
|
29582
29744
|
} else if (node2.type === "inlineCode") {
|
|
29583
|
-
runs.push(new TextRun({
|
|
29745
|
+
runs.push(new TextRun({
|
|
29746
|
+
text: node2.value ?? "",
|
|
29747
|
+
font: context.monoFont,
|
|
29748
|
+
size: context.codeSizeHalf,
|
|
29749
|
+
shading: { fill: context.style.inlineCodeBackground },
|
|
29750
|
+
...style
|
|
29751
|
+
}));
|
|
29584
29752
|
} else if (node2.type === "strong") {
|
|
29585
|
-
runs.push(...inlineRuns(node2.children, { ...style, bold: true }));
|
|
29753
|
+
runs.push(...inlineRuns(node2.children, context, { ...style, bold: true }));
|
|
29586
29754
|
} else if (node2.type === "emphasis") {
|
|
29587
|
-
runs.push(...inlineRuns(node2.children, { ...style, italics: true }));
|
|
29755
|
+
runs.push(...inlineRuns(node2.children, context, { ...style, italics: true }));
|
|
29588
29756
|
} else if (node2.type === "delete") {
|
|
29589
|
-
runs.push(...inlineRuns(node2.children, { ...style, strike: true }));
|
|
29757
|
+
runs.push(...inlineRuns(node2.children, context, { ...style, strike: true }));
|
|
29590
29758
|
} else if (node2.type === "link" && node2.url) {
|
|
29591
|
-
runs.push(new ExternalHyperlink({
|
|
29759
|
+
runs.push(new ExternalHyperlink({
|
|
29760
|
+
link: node2.url,
|
|
29761
|
+
children: inlineRuns(node2.children, context, {
|
|
29762
|
+
...style,
|
|
29763
|
+
color: context.style.link,
|
|
29764
|
+
underline: { type: UnderlineType.SINGLE }
|
|
29765
|
+
})
|
|
29766
|
+
}));
|
|
29767
|
+
} else if (node2.type === "footnoteReference") {
|
|
29768
|
+
const id = node2.identifier ? context.footnoteIds.get(node2.identifier) : void 0;
|
|
29769
|
+
runs.push(id ? new FootnoteReferenceRun(id) : new TextRun({ text: node2.label ?? "", superScript: true }));
|
|
29770
|
+
} else if (node2.type === "html") {
|
|
29771
|
+
const value = node2.value ?? "";
|
|
29772
|
+
if (/^<br\b/i.test(value)) {
|
|
29773
|
+
runs.push(new TextRun({ break: 1, ...style }));
|
|
29774
|
+
} else {
|
|
29775
|
+
const img = /^<img\b[^>]*?\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(value);
|
|
29776
|
+
if (img) {
|
|
29777
|
+
const url = img[1] ?? img[2] ?? img[3] ?? "";
|
|
29778
|
+
const altMatch = /\balt\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(value);
|
|
29779
|
+
const alt = altMatch?.[1] ?? altMatch?.[2] ?? altMatch?.[3] ?? "";
|
|
29780
|
+
const loaded = loadImage({ url }, context);
|
|
29781
|
+
if (loaded) {
|
|
29782
|
+
runs.push(new ImageRun({
|
|
29783
|
+
type: "png",
|
|
29784
|
+
data: loaded.image.toPNG(),
|
|
29785
|
+
transformation: imageSize(loaded.image, loaded.target),
|
|
29786
|
+
altText: alt ? { name: alt } : void 0
|
|
29787
|
+
}));
|
|
29788
|
+
}
|
|
29789
|
+
}
|
|
29790
|
+
}
|
|
29592
29791
|
} else if (node2.type === "image") {
|
|
29593
|
-
|
|
29792
|
+
const loaded = loadImage(node2, context);
|
|
29793
|
+
if (loaded) {
|
|
29794
|
+
runs.push(new ImageRun({
|
|
29795
|
+
type: "png",
|
|
29796
|
+
data: loaded.image.toPNG(),
|
|
29797
|
+
transformation: imageSize(loaded.image, loaded.target),
|
|
29798
|
+
altText: node2.alt ? { name: node2.alt } : void 0
|
|
29799
|
+
}));
|
|
29800
|
+
} else {
|
|
29801
|
+
runs.push(new TextRun({
|
|
29802
|
+
text: node2.alt ? `[${node2.alt}]` : "[image]",
|
|
29803
|
+
italics: true,
|
|
29804
|
+
color: context.style.secondaryText,
|
|
29805
|
+
...style
|
|
29806
|
+
}));
|
|
29807
|
+
}
|
|
29594
29808
|
} else {
|
|
29595
|
-
runs.push(...inlineRuns(node2.children, style));
|
|
29809
|
+
runs.push(...inlineRuns(node2.children, context, style));
|
|
29596
29810
|
}
|
|
29597
29811
|
}
|
|
29598
29812
|
return runs;
|
|
@@ -29607,88 +29821,406 @@ function imagePath(url, sourcePath) {
|
|
|
29607
29821
|
if (!sourcePath) return null;
|
|
29608
29822
|
return require$$1.isAbsolute(url) ? url : require$$1.resolve(require$$1.dirname(sourcePath), decodeURIComponent(url));
|
|
29609
29823
|
}
|
|
29610
|
-
|
|
29611
|
-
|
|
29824
|
+
const REMOTE_TIMEOUT_MS = 15e3;
|
|
29825
|
+
const REMOTE_MAX_BYTES = 20 * 1024 * 1024;
|
|
29826
|
+
async function downloadImage(url) {
|
|
29827
|
+
try {
|
|
29828
|
+
const response = await fetch(url, {
|
|
29829
|
+
signal: AbortSignal.timeout(REMOTE_TIMEOUT_MS),
|
|
29830
|
+
headers: { "User-Agent": "ColaMD", Accept: "image/*" }
|
|
29831
|
+
});
|
|
29832
|
+
if (!response.ok) return null;
|
|
29833
|
+
const declared = Number(response.headers.get("content-length") ?? 0);
|
|
29834
|
+
if (declared > REMOTE_MAX_BYTES) return null;
|
|
29835
|
+
const buffer = Buffer.from(await response.arrayBuffer());
|
|
29836
|
+
if (buffer.length === 0 || buffer.length > REMOTE_MAX_BYTES) return null;
|
|
29837
|
+
const image2 = require$$1$1.nativeImage.createFromBuffer(buffer);
|
|
29838
|
+
if (image2.isEmpty()) return null;
|
|
29839
|
+
return `data:image/png;base64,${image2.toPNG().toString("base64")}`;
|
|
29840
|
+
} catch {
|
|
29841
|
+
return null;
|
|
29842
|
+
}
|
|
29843
|
+
}
|
|
29844
|
+
function collectRemoteImageUrls(nodes, urls) {
|
|
29845
|
+
for (const node2 of nodes ?? []) {
|
|
29846
|
+
if (node2.type === "image" && node2.url && /^https?:/i.test(node2.url)) urls.add(node2.url);
|
|
29847
|
+
if (node2.type === "html" && node2.value) {
|
|
29848
|
+
const img = /<img\b[^>]*\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(node2.value);
|
|
29849
|
+
const src = img?.[1] ?? img?.[2] ?? img?.[3];
|
|
29850
|
+
if (src && /^https?:/i.test(src)) urls.add(src);
|
|
29851
|
+
}
|
|
29852
|
+
collectRemoteImageUrls(node2.children, urls);
|
|
29853
|
+
}
|
|
29854
|
+
}
|
|
29855
|
+
async function remoteImagesFor(tree) {
|
|
29856
|
+
const urls = /* @__PURE__ */ new Set();
|
|
29857
|
+
collectRemoteImageUrls(tree.children, urls);
|
|
29858
|
+
if (urls.size === 0) return {};
|
|
29859
|
+
const entries = await Promise.all([...urls].map(async (url) => [url, await downloadImage(url)]));
|
|
29860
|
+
return Object.fromEntries(entries.filter((entry) => entry[1] !== null));
|
|
29861
|
+
}
|
|
29862
|
+
function loadImage(node2, context) {
|
|
29863
|
+
const inlineData = node2.url && /^data:image\//i.test(node2.url) ? node2.url : void 0;
|
|
29864
|
+
const dataURL = node2.url ? context.images?.[node2.url] ?? inlineData : void 0;
|
|
29612
29865
|
const image2 = dataURL ? require$$1$1.nativeImage.createFromDataURL(dataURL) : (() => {
|
|
29613
|
-
const path2 = node2.url ? imagePath(node2.url, sourcePath) : null;
|
|
29866
|
+
const path2 = node2.url ? imagePath(node2.url, context.sourcePath) : null;
|
|
29614
29867
|
return path2 ? require$$1$1.nativeImage.createFromPath(path2) : null;
|
|
29615
29868
|
})();
|
|
29616
|
-
if (!image2 || image2.isEmpty()) return
|
|
29617
|
-
|
|
29618
|
-
|
|
29869
|
+
if (!image2 || image2.isEmpty()) return null;
|
|
29870
|
+
return { image: image2, target: node2.url ? context.imageSizes?.[node2.url] : void 0 };
|
|
29871
|
+
}
|
|
29872
|
+
function imageSize(image2, target, targetMax = { width: 600, height: 420 }) {
|
|
29873
|
+
if (target) {
|
|
29874
|
+
const scale2 = Math.min(1, targetMax.width / target.width, targetMax.height / target.height);
|
|
29875
|
+
return {
|
|
29876
|
+
width: Math.max(1, Math.round(target.width * scale2)),
|
|
29877
|
+
height: Math.max(1, Math.round(target.height * scale2))
|
|
29878
|
+
};
|
|
29879
|
+
}
|
|
29880
|
+
const natural = image2.getSize();
|
|
29881
|
+
const scale = Math.min(1, 560 / natural.width, 420 / natural.height);
|
|
29882
|
+
return {
|
|
29883
|
+
width: Math.max(1, Math.round(natural.width * scale)),
|
|
29884
|
+
height: Math.max(1, Math.round(natural.height * scale))
|
|
29885
|
+
};
|
|
29886
|
+
}
|
|
29887
|
+
function imageParagraph(node2, context) {
|
|
29888
|
+
const loaded = loadImage(node2, context);
|
|
29889
|
+
if (!loaded) {
|
|
29890
|
+
return new Paragraph({
|
|
29891
|
+
children: [new TextRun({ text: node2.alt ? `[${node2.alt}]` : "[image]", italics: true })]
|
|
29892
|
+
});
|
|
29893
|
+
}
|
|
29894
|
+
const url = node2.url ?? "";
|
|
29895
|
+
const size = imageSize(
|
|
29896
|
+
loaded.image,
|
|
29897
|
+
loaded.target,
|
|
29898
|
+
/colamd-html-/.test(url) ? { width: 600, height: 800 } : void 0
|
|
29899
|
+
);
|
|
29619
29900
|
return new Paragraph({
|
|
29901
|
+
alignment: AlignmentType.CENTER,
|
|
29902
|
+
spacing: { before: emTwips(context.style.bodySize, 1.2), after: emTwips(context.style.bodySize, 1.2) },
|
|
29620
29903
|
children: [new ImageRun({
|
|
29621
29904
|
type: "png",
|
|
29622
|
-
data:
|
|
29623
|
-
transformation:
|
|
29905
|
+
data: loaded.image.toPNG(),
|
|
29906
|
+
transformation: size,
|
|
29907
|
+
altText: node2.alt ? { name: node2.alt } : void 0
|
|
29624
29908
|
})]
|
|
29625
29909
|
});
|
|
29626
29910
|
}
|
|
29627
|
-
function
|
|
29911
|
+
function alignmentFor(align) {
|
|
29912
|
+
if (align === "center") return AlignmentType.CENTER;
|
|
29913
|
+
if (align === "right") return AlignmentType.RIGHT;
|
|
29914
|
+
return AlignmentType.LEFT;
|
|
29915
|
+
}
|
|
29916
|
+
function tableForNode(node2, context) {
|
|
29917
|
+
const border = { style: BorderStyle.SINGLE, size: 6, color: context.style.border };
|
|
29628
29918
|
return new Table({
|
|
29629
29919
|
width: { size: 100, type: WidthType.PERCENTAGE },
|
|
29630
|
-
|
|
29631
|
-
|
|
29632
|
-
|
|
29920
|
+
borders: {
|
|
29921
|
+
top: border,
|
|
29922
|
+
bottom: border,
|
|
29923
|
+
left: border,
|
|
29924
|
+
right: border,
|
|
29925
|
+
insideHorizontal: border,
|
|
29926
|
+
insideVertical: border
|
|
29927
|
+
},
|
|
29928
|
+
rows: (node2.children ?? []).map((row, rowIndex) => new TableRow({
|
|
29929
|
+
// 表头在跨页时重复,并且带主题底色。
|
|
29930
|
+
tableHeader: rowIndex === 0,
|
|
29931
|
+
children: (row.children ?? []).map((cell, cellIndex) => new TableCell({
|
|
29932
|
+
shading: rowIndex === 0 ? { fill: context.style.tableHeaderBackground } : void 0,
|
|
29933
|
+
margins: { top: 120, bottom: 120, left: 180, right: 180 },
|
|
29934
|
+
children: [new Paragraph({
|
|
29935
|
+
alignment: alignmentFor(node2.align?.[cellIndex]),
|
|
29936
|
+
spacing: { before: 0, after: 0, line: 240, lineRule: LineRuleType.AUTO },
|
|
29937
|
+
children: inlineRuns(cell.children, context, rowIndex === 0 ? { bold: true } : {})
|
|
29938
|
+
})]
|
|
29633
29939
|
}))
|
|
29634
29940
|
}))
|
|
29635
29941
|
});
|
|
29636
29942
|
}
|
|
29637
|
-
function
|
|
29943
|
+
function codeParagraph(node2, context, extra = {}) {
|
|
29944
|
+
const lines = (node2.value ?? "").replace(/\n+$/, "").split("\n");
|
|
29945
|
+
const children = lines.map((line, index2) => line === "" ? new TextRun({ text: "", break: 1 }) : new TextRun({
|
|
29946
|
+
text: line,
|
|
29947
|
+
break: index2 > 0 ? 1 : void 0,
|
|
29948
|
+
font: context.monoFont,
|
|
29949
|
+
size: context.codeSizeHalf,
|
|
29950
|
+
color: context.style.codeBlockText
|
|
29951
|
+
}));
|
|
29952
|
+
const codeLine = Math.max(240, Math.round(context.paragraphLine * 0.9));
|
|
29953
|
+
const codePad = emTwips(context.style.bodySize, 1);
|
|
29954
|
+
return new Paragraph({
|
|
29955
|
+
// 引用里的代码块要保留自己的底色与行距,所以代码块的属性写在 extra 之后。
|
|
29956
|
+
...extra,
|
|
29957
|
+
shading: { fill: context.style.codeBlockBackground },
|
|
29958
|
+
spacing: { before: codePad, after: codePad, line: codeLine, lineRule: LineRuleType.AUTO },
|
|
29959
|
+
children
|
|
29960
|
+
});
|
|
29961
|
+
}
|
|
29962
|
+
function blockquoteNodes(node2, context) {
|
|
29963
|
+
const quote = {
|
|
29964
|
+
border: {
|
|
29965
|
+
left: { color: context.style.blockquoteBorder, space: 12, style: BorderStyle.SINGLE, size: 24 }
|
|
29966
|
+
},
|
|
29967
|
+
indent: { left: 240 },
|
|
29968
|
+
shading: context.style.blockquoteBackground ? { fill: context.style.blockquoteBackground } : void 0,
|
|
29969
|
+
spacing: { after: emTwips(context.style.bodySize, 0.5) }
|
|
29970
|
+
};
|
|
29971
|
+
const childStyle = { color: context.style.secondaryText };
|
|
29972
|
+
const output = [];
|
|
29973
|
+
for (const child of node2.children ?? []) {
|
|
29974
|
+
if (child.type === "paragraph" || child.type === "heading") {
|
|
29975
|
+
output.push(new Paragraph({ ...quote, children: inlineRuns(child.children, context, childStyle) }));
|
|
29976
|
+
} else if (child.type === "list") {
|
|
29977
|
+
const start = child.start ?? 1;
|
|
29978
|
+
for (const [index2, item] of (child.children ?? []).entries()) {
|
|
29979
|
+
const first = item.children?.find((entry) => entry.type === "paragraph");
|
|
29980
|
+
const prefix = child.ordered ? `${start + index2}. ` : "• ";
|
|
29981
|
+
output.push(new Paragraph({
|
|
29982
|
+
...quote,
|
|
29983
|
+
indent: { left: 600, hanging: 240 },
|
|
29984
|
+
children: [
|
|
29985
|
+
new TextRun({ text: prefix, ...childStyle }),
|
|
29986
|
+
...inlineRuns(first?.children, context, childStyle)
|
|
29987
|
+
]
|
|
29988
|
+
}));
|
|
29989
|
+
}
|
|
29990
|
+
} else if (child.type === "code") {
|
|
29991
|
+
output.push(codeParagraph(child, context, quote));
|
|
29992
|
+
} else if (child.type === "thematicBreak") {
|
|
29993
|
+
output.push(new Paragraph({
|
|
29994
|
+
...quote,
|
|
29995
|
+
border: { bottom: { color: context.style.border, space: 1, style: BorderStyle.SINGLE, size: 6 } }
|
|
29996
|
+
}));
|
|
29997
|
+
} else {
|
|
29998
|
+
output.push(new Paragraph({
|
|
29999
|
+
...quote,
|
|
30000
|
+
children: [new TextRun({ text: textContent(child), ...childStyle })]
|
|
30001
|
+
}));
|
|
30002
|
+
}
|
|
30003
|
+
}
|
|
30004
|
+
return output;
|
|
30005
|
+
}
|
|
30006
|
+
function prepareLists(nodes, state) {
|
|
30007
|
+
for (const node2 of nodes ?? []) {
|
|
30008
|
+
if (node2.type === "list") {
|
|
30009
|
+
node2.instance = state.next;
|
|
30010
|
+
state.next += 1;
|
|
30011
|
+
if (node2.ordered) state.starts.add(node2.start ?? 1);
|
|
30012
|
+
}
|
|
30013
|
+
prepareLists(node2.children, state);
|
|
30014
|
+
}
|
|
30015
|
+
}
|
|
30016
|
+
function bulletLevels() {
|
|
30017
|
+
const marks = ["•", "○", "■"];
|
|
30018
|
+
return Array.from({ length: 9 }, (_, level) => ({
|
|
30019
|
+
level,
|
|
30020
|
+
format: LevelFormat.BULLET,
|
|
30021
|
+
text: marks[level % marks.length],
|
|
30022
|
+
alignment: AlignmentType.LEFT,
|
|
30023
|
+
style: { paragraph: { indent: { left: 360 + level * 360, hanging: 240 } } }
|
|
30024
|
+
}));
|
|
30025
|
+
}
|
|
30026
|
+
function decimalLevels(start) {
|
|
30027
|
+
return Array.from({ length: 9 }, (_, level) => ({
|
|
30028
|
+
level,
|
|
30029
|
+
format: LevelFormat.DECIMAL,
|
|
30030
|
+
text: `%${level + 1}.`,
|
|
30031
|
+
alignment: AlignmentType.LEFT,
|
|
30032
|
+
...level === 0 ? { start } : {},
|
|
30033
|
+
style: { paragraph: { indent: { left: 360 + level * 360, hanging: 240 } } }
|
|
30034
|
+
}));
|
|
30035
|
+
}
|
|
30036
|
+
function numberingConfig(starts) {
|
|
30037
|
+
return {
|
|
30038
|
+
config: [
|
|
30039
|
+
{ reference: "bullet", levels: bulletLevels() },
|
|
30040
|
+
...[...starts].sort((left, right) => left - right).map((start) => ({
|
|
30041
|
+
reference: `ordered-${start}`,
|
|
30042
|
+
levels: decimalLevels(start)
|
|
30043
|
+
}))
|
|
30044
|
+
]
|
|
30045
|
+
};
|
|
30046
|
+
}
|
|
30047
|
+
function prepareFootnotes(nodes, ids) {
|
|
30048
|
+
for (const node2 of nodes ?? []) {
|
|
30049
|
+
if (node2.type === "footnoteDefinition") continue;
|
|
30050
|
+
if (node2.type === "footnoteReference" && node2.identifier && !ids.has(node2.identifier)) {
|
|
30051
|
+
ids.set(node2.identifier, ids.size + 1);
|
|
30052
|
+
}
|
|
30053
|
+
prepareFootnotes(node2.children, ids);
|
|
30054
|
+
}
|
|
30055
|
+
}
|
|
30056
|
+
function blockNodes(nodes, context, listDepth = 0) {
|
|
29638
30057
|
if (!nodes) return [];
|
|
29639
30058
|
const output = [];
|
|
29640
30059
|
for (const node2 of nodes) {
|
|
29641
30060
|
if (node2.type === "heading") {
|
|
29642
|
-
output.push(new Paragraph({ heading: headingForDepth(node2.depth ?? 1), children: inlineRuns(node2.children) }));
|
|
30061
|
+
output.push(new Paragraph({ heading: headingForDepth(node2.depth ?? 1), children: inlineRuns(node2.children, context) }));
|
|
29643
30062
|
} else if (node2.type === "paragraph") {
|
|
29644
30063
|
const image2 = node2.children?.length === 1 && node2.children[0]?.type === "image" ? node2.children[0] : null;
|
|
29645
|
-
output.push(image2 ? imageParagraph(image2,
|
|
30064
|
+
output.push(image2 ? imageParagraph(image2, context) : new Paragraph({ children: inlineRuns(node2.children, context) }));
|
|
29646
30065
|
} else if (node2.type === "image") {
|
|
29647
|
-
output.push(imageParagraph(node2,
|
|
30066
|
+
output.push(imageParagraph(node2, context));
|
|
29648
30067
|
} else if (node2.type === "blockquote") {
|
|
29649
|
-
output.push(
|
|
29650
|
-
children: [new TextRun({ text: textContent(node2), italics: true })],
|
|
29651
|
-
indent: { left: 720 },
|
|
29652
|
-
border: { left: { color: "AEB7C2", space: 8, style: "single", size: 12 } }
|
|
29653
|
-
}));
|
|
30068
|
+
output.push(...blockquoteNodes(node2, context));
|
|
29654
30069
|
} else if (node2.type === "code") {
|
|
29655
|
-
output.push(
|
|
29656
|
-
children: [new TextRun({ text: node2.value ?? "", font: "Menlo", size: 18 })],
|
|
29657
|
-
shading: { fill: "F1F3F5" },
|
|
29658
|
-
spacing: { before: 120, after: 120 }
|
|
29659
|
-
}));
|
|
30070
|
+
output.push(codeParagraph(node2, context));
|
|
29660
30071
|
} else if (node2.type === "list") {
|
|
29661
30072
|
const start = node2.start ?? 1;
|
|
29662
|
-
for (const
|
|
30073
|
+
for (const item of node2.children ?? []) {
|
|
29663
30074
|
const first = item.children?.find((child) => child.type === "paragraph");
|
|
29664
|
-
const
|
|
29665
|
-
|
|
29666
|
-
|
|
29667
|
-
|
|
29668
|
-
|
|
29669
|
-
|
|
29670
|
-
|
|
30075
|
+
const itemPad = emTwips(context.style.bodySize, 0.5);
|
|
30076
|
+
if (typeof item.checked === "boolean") {
|
|
30077
|
+
output.push(new Paragraph({
|
|
30078
|
+
children: [
|
|
30079
|
+
new TextRun({
|
|
30080
|
+
text: item.checked ? "☑ " : "☐ ",
|
|
30081
|
+
color: item.checked ? context.style.link : context.style.secondaryText
|
|
30082
|
+
}),
|
|
30083
|
+
...inlineRuns(first?.children, context)
|
|
30084
|
+
],
|
|
30085
|
+
indent: { left: 360 + listDepth * 360, hanging: 240 },
|
|
30086
|
+
spacing: { after: itemPad }
|
|
30087
|
+
}));
|
|
30088
|
+
} else {
|
|
30089
|
+
output.push(new Paragraph({
|
|
30090
|
+
children: inlineRuns(first?.children, context),
|
|
30091
|
+
numbering: node2.ordered ? { reference: `ordered-${start}`, level: listDepth, instance: node2.instance ?? 0 } : { reference: "bullet", level: listDepth, instance: 0 },
|
|
30092
|
+
spacing: { after: itemPad }
|
|
30093
|
+
}));
|
|
30094
|
+
}
|
|
30095
|
+
output.push(...blockNodes(item.children?.filter((child) => child !== first), context, listDepth + 1));
|
|
29671
30096
|
}
|
|
29672
30097
|
} else if (node2.type === "table") {
|
|
29673
|
-
output.push(tableForNode(node2));
|
|
30098
|
+
output.push(tableForNode(node2, context));
|
|
29674
30099
|
} else if (node2.type === "thematicBreak") {
|
|
29675
|
-
output.push(new Paragraph({ border: { bottom: { color:
|
|
30100
|
+
output.push(new Paragraph({ border: { bottom: { color: context.style.border, space: 1, style: BorderStyle.SINGLE, size: 6 } } }));
|
|
29676
30101
|
} else if (node2.type === "html") {
|
|
29677
|
-
output.push(new Paragraph({
|
|
30102
|
+
output.push(new Paragraph({
|
|
30103
|
+
children: [new TextRun({ text: node2.value ?? "", font: context.monoFont, size: context.codeSizeHalf, color: context.style.secondaryText })]
|
|
30104
|
+
}));
|
|
29678
30105
|
} else if (node2.type === "footnoteDefinition") {
|
|
29679
|
-
|
|
30106
|
+
continue;
|
|
29680
30107
|
} else {
|
|
29681
|
-
output.push(...blockNodes(node2.children,
|
|
30108
|
+
output.push(...blockNodes(node2.children, context, listDepth));
|
|
29682
30109
|
}
|
|
29683
30110
|
}
|
|
29684
30111
|
return output;
|
|
29685
30112
|
}
|
|
30113
|
+
function buildFootnotes(tree, context) {
|
|
30114
|
+
const definitions = (tree.children ?? []).filter((node2) => node2.type === "footnoteDefinition" && node2.identifier && context.footnoteIds.has(node2.identifier));
|
|
30115
|
+
if (definitions.length === 0) return void 0;
|
|
30116
|
+
const footnotes = {};
|
|
30117
|
+
for (const definition2 of definitions) {
|
|
30118
|
+
const id = context.footnoteIds.get(definition2.identifier ?? "");
|
|
30119
|
+
if (!id) continue;
|
|
30120
|
+
const children = blockNodes(definition2.children, context).filter((child) => child instanceof Paragraph);
|
|
30121
|
+
footnotes[String(id)] = { children: children.length > 0 ? children : [new Paragraph({ children: [] })] };
|
|
30122
|
+
}
|
|
30123
|
+
return footnotes;
|
|
30124
|
+
}
|
|
30125
|
+
function documentStyles(context) {
|
|
30126
|
+
const font = {
|
|
30127
|
+
ascii: context.bodyFont,
|
|
30128
|
+
hAnsi: context.bodyFont,
|
|
30129
|
+
eastAsia: context.bodyFont,
|
|
30130
|
+
cs: context.bodyFont
|
|
30131
|
+
};
|
|
30132
|
+
const headingLine = Math.round(context.paragraphLine * (1.35 / 1.75));
|
|
30133
|
+
const footnoteLine = Math.round(context.paragraphLine * (1.4 / 1.75));
|
|
30134
|
+
const bodyPadAfter = emTwips(context.style.bodySize, 0.75);
|
|
30135
|
+
const bodyPadBefore = Math.round(bodyPadAfter * 0.33);
|
|
30136
|
+
const heading2 = (level) => {
|
|
30137
|
+
const px = context.style.bodySize * HEADING_SCALE[level - 1];
|
|
30138
|
+
return {
|
|
30139
|
+
run: { bold: true, color: context.style.text, size: halfPoints(px) },
|
|
30140
|
+
paragraph: {
|
|
30141
|
+
outlineLevel: level - 1,
|
|
30142
|
+
keepNext: true,
|
|
30143
|
+
keepLines: true,
|
|
30144
|
+
spacing: {
|
|
30145
|
+
before: emTwips(px, 1.4),
|
|
30146
|
+
after: emTwips(px, 0.6),
|
|
30147
|
+
line: headingLine,
|
|
30148
|
+
lineRule: LineRuleType.AUTO
|
|
30149
|
+
}
|
|
30150
|
+
}
|
|
30151
|
+
};
|
|
30152
|
+
};
|
|
30153
|
+
return {
|
|
30154
|
+
default: {
|
|
30155
|
+
document: {
|
|
30156
|
+
run: { font, size: context.bodySizeHalf, color: context.style.text },
|
|
30157
|
+
paragraph: {
|
|
30158
|
+
spacing: {
|
|
30159
|
+
line: context.paragraphLine,
|
|
30160
|
+
lineRule: LineRuleType.AUTO,
|
|
30161
|
+
before: bodyPadBefore,
|
|
30162
|
+
after: bodyPadAfter
|
|
30163
|
+
}
|
|
30164
|
+
}
|
|
30165
|
+
},
|
|
30166
|
+
heading1: heading2(1),
|
|
30167
|
+
heading2: heading2(2),
|
|
30168
|
+
heading3: heading2(3),
|
|
30169
|
+
heading4: heading2(4),
|
|
30170
|
+
heading5: heading2(5),
|
|
30171
|
+
heading6: heading2(6),
|
|
30172
|
+
footnoteText: {
|
|
30173
|
+
run: { size: context.codeSizeHalf, color: context.style.secondaryText },
|
|
30174
|
+
paragraph: {
|
|
30175
|
+
spacing: { after: 60, line: footnoteLine, lineRule: LineRuleType.AUTO }
|
|
30176
|
+
}
|
|
30177
|
+
}
|
|
30178
|
+
}
|
|
30179
|
+
};
|
|
30180
|
+
}
|
|
29686
30181
|
async function markdownToDocx(input) {
|
|
29687
|
-
const
|
|
30182
|
+
const style = normalizeStyle(input.style);
|
|
30183
|
+
const source = input.content;
|
|
30184
|
+
const frontmatter = frontmatterEnd(source);
|
|
30185
|
+
const body = frontmatter > 0 ? source.slice(frontmatter) : source;
|
|
30186
|
+
const tree = unified().use(remarkParse).use(remarkGfm).parse(body);
|
|
30187
|
+
const footnoteIds = /* @__PURE__ */ new Map();
|
|
30188
|
+
prepareFootnotes(tree.children, footnoteIds);
|
|
30189
|
+
const listState = { next: 0, starts: /* @__PURE__ */ new Set() };
|
|
30190
|
+
prepareLists(tree.children, listState);
|
|
30191
|
+
const remoteImages = await remoteImagesFor(tree);
|
|
30192
|
+
const context = {
|
|
30193
|
+
style,
|
|
30194
|
+
bodyFont: fontName(style.bodyFontStack, false),
|
|
30195
|
+
monoFont: fontName(style.monoFontStack, true),
|
|
30196
|
+
bodySizeHalf: halfPoints(style.bodySize),
|
|
30197
|
+
paragraphLine: Math.round(style.lineHeight * 240),
|
|
30198
|
+
codeSizeHalf: halfPoints(style.bodySize * 0.875),
|
|
30199
|
+
footnoteIds,
|
|
30200
|
+
sourcePath: input.sourcePath,
|
|
30201
|
+
images: { ...remoteImages, ...input.images },
|
|
30202
|
+
imageSizes: normalizeImageSizes(input.imageSizes)
|
|
30203
|
+
};
|
|
30204
|
+
const footnotes = buildFootnotes(tree, context);
|
|
30205
|
+
const pageNumber = new TextRun({
|
|
30206
|
+
children: [PageNumber.CURRENT, " / ", PageNumber.TOTAL_PAGES],
|
|
30207
|
+
size: context.codeSizeHalf,
|
|
30208
|
+
color: style.secondaryText
|
|
30209
|
+
});
|
|
29688
30210
|
const document2 = new File({
|
|
29689
30211
|
creator: "ColaMD",
|
|
29690
30212
|
title: input.sourcePath ? require$$1.basename(input.sourcePath, require$$1.extname(input.sourcePath)) : "Untitled",
|
|
29691
|
-
|
|
30213
|
+
styles: documentStyles(context),
|
|
30214
|
+
numbering: numberingConfig(listState.starts),
|
|
30215
|
+
...footnotes ? { footnotes } : {},
|
|
30216
|
+
sections: [{
|
|
30217
|
+
footers: {
|
|
30218
|
+
default: new Footer({
|
|
30219
|
+
children: [new Paragraph({ alignment: AlignmentType.CENTER, children: [pageNumber] })]
|
|
30220
|
+
})
|
|
30221
|
+
},
|
|
30222
|
+
children: blockNodes(tree.children, context)
|
|
30223
|
+
}]
|
|
29692
30224
|
});
|
|
29693
30225
|
return Packer.toBuffer(document2);
|
|
29694
30226
|
}
|