Files
StudyDiary-20261009/.obsidian/plugins/note-to-red/main.js

7785 lines
1.1 MiB
JavaScript
Raw Normal View History

2026-10-09 22:06:40 +08:00
/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __esm = (fn, res) => function __init() {
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// node_modules/jszip/dist/jszip.min.js
var require_jszip_min = __commonJS({
"node_modules/jszip/dist/jszip.min.js"(exports, module2) {
!function(e) {
if ("object" == typeof exports && "undefined" != typeof module2)
module2.exports = e();
else if ("function" == typeof define && define.amd)
define([], e);
else {
("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).JSZip = e();
}
}(function() {
return function s(a, o, h) {
function u(r, e2) {
if (!o[r]) {
if (!a[r]) {
var t = "function" == typeof require && require;
if (!e2 && t)
return t(r, true);
if (l)
return l(r, true);
var n = new Error("Cannot find module '" + r + "'");
throw n.code = "MODULE_NOT_FOUND", n;
}
var i = o[r] = { exports: {} };
a[r][0].call(i.exports, function(e3) {
var t2 = a[r][1][e3];
return u(t2 || e3);
}, i, i.exports, s, a, o, h);
}
return o[r].exports;
}
for (var l = "function" == typeof require && require, e = 0; e < h.length; e++)
u(h[e]);
return u;
}({ 1: [function(e, t, r) {
"use strict";
var d = e("./utils"), c = e("./support"), p = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
r.encode = function(e2) {
for (var t2, r2, n, i, s, a, o, h = [], u = 0, l = e2.length, f = l, c2 = "string" !== d.getTypeOf(e2); u < e2.length; )
f = l - u, n = c2 ? (t2 = e2[u++], r2 = u < l ? e2[u++] : 0, u < l ? e2[u++] : 0) : (t2 = e2.charCodeAt(u++), r2 = u < l ? e2.charCodeAt(u++) : 0, u < l ? e2.charCodeAt(u++) : 0), i = t2 >> 2, s = (3 & t2) << 4 | r2 >> 4, a = 1 < f ? (15 & r2) << 2 | n >> 6 : 64, o = 2 < f ? 63 & n : 64, h.push(p.charAt(i) + p.charAt(s) + p.charAt(a) + p.charAt(o));
return h.join("");
}, r.decode = function(e2) {
var t2, r2, n, i, s, a, o = 0, h = 0, u = "data:";
if (e2.substr(0, u.length) === u)
throw new Error("Invalid base64 input, it looks like a data url.");
var l, f = 3 * (e2 = e2.replace(/[^A-Za-z0-9+/=]/g, "")).length / 4;
if (e2.charAt(e2.length - 1) === p.charAt(64) && f--, e2.charAt(e2.length - 2) === p.charAt(64) && f--, f % 1 != 0)
throw new Error("Invalid base64 input, bad content length.");
for (l = c.uint8array ? new Uint8Array(0 | f) : new Array(0 | f); o < e2.length; )
t2 = p.indexOf(e2.charAt(o++)) << 2 | (i = p.indexOf(e2.charAt(o++))) >> 4, r2 = (15 & i) << 4 | (s = p.indexOf(e2.charAt(o++))) >> 2, n = (3 & s) << 6 | (a = p.indexOf(e2.charAt(o++))), l[h++] = t2, 64 !== s && (l[h++] = r2), 64 !== a && (l[h++] = n);
return l;
};
}, { "./support": 30, "./utils": 32 }], 2: [function(e, t, r) {
"use strict";
var n = e("./external"), i = e("./stream/DataWorker"), s = e("./stream/Crc32Probe"), a = e("./stream/DataLengthProbe");
function o(e2, t2, r2, n2, i2) {
this.compressedSize = e2, this.uncompressedSize = t2, this.crc32 = r2, this.compression = n2, this.compressedContent = i2;
}
o.prototype = { getContentWorker: function() {
var e2 = new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")), t2 = this;
return e2.on("end", function() {
if (this.streamInfo.data_length !== t2.uncompressedSize)
throw new Error("Bug : uncompressed data size mismatch");
}), e2;
}, getCompressedWorker: function() {
return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression);
} }, o.createWorkerFrom = function(e2, t2, r2) {
return e2.pipe(new s()).pipe(new a("uncompressedSize")).pipe(t2.compressWorker(r2)).pipe(new a("compressedSize")).withStreamInfo("compression", t2);
}, t.exports = o;
}, { "./external": 6, "./stream/Crc32Probe": 25, "./stream/DataLengthProbe": 26, "./stream/DataWorker": 27 }], 3: [function(e, t, r) {
"use strict";
var n = e("./stream/GenericWorker");
r.STORE = { magic: "\0\0", compressWorker: function() {
return new n("STORE compression");
}, uncompressWorker: function() {
return new n("STORE decompression");
} }, r.DEFLATE = e("./flate");
}, { "./flate": 7, "./stream/GenericWorker": 28 }], 4: [function(e, t, r) {
"use strict";
var n = e("./utils");
var o = function() {
for (var e2, t2 = [], r2 = 0; r2 < 256; r2++) {
e2 = r2;
for (var n2 = 0; n2 < 8; n2++)
e2 = 1 & e2 ? 3988292384 ^ e2 >>> 1 : e2 >>> 1;
t2[r2] = e2;
}
return t2;
}();
t.exports = function(e2, t2) {
return void 0 !== e2 && e2.length ? "string" !== n.getTypeOf(e2) ? function(e3, t3, r2, n2) {
var i = o, s = n2 + r2;
e3 ^= -1;
for (var a = n2; a < s; a++)
e3 = e3 >>> 8 ^ i[255 & (e3 ^ t3[a])];
return -1 ^ e3;
}(0 | t2, e2, e2.length, 0) : function(e3, t3, r2, n2) {
var i = o, s = n2 + r2;
e3 ^= -1;
for (var a = n2; a < s; a++)
e3 = e3 >>> 8 ^ i[255 & (e3 ^ t3.charCodeAt(a))];
return -1 ^ e3;
}(0 | t2, e2, e2.length, 0) : 0;
};
}, { "./utils": 32 }], 5: [function(e, t, r) {
"use strict";
r.base64 = false, r.binary = false, r.dir = false, r.createFolders = true, r.date = null, r.compression = null, r.compressionOptions = null, r.comment = null, r.unixPermissions = null, r.dosPermissions = null;
}, {}], 6: [function(e, t, r) {
"use strict";
var n = null;
n = "undefined" != typeof Promise ? Promise : e("lie"), t.exports = { Promise: n };
}, { lie: 37 }], 7: [function(e, t, r) {
"use strict";
var n = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Uint32Array, i = e("pako"), s = e("./utils"), a = e("./stream/GenericWorker"), o = n ? "uint8array" : "array";
function h(e2, t2) {
a.call(this, "FlateWorker/" + e2), this._pako = null, this._pakoAction = e2, this._pakoOptions = t2, this.meta = {};
}
r.magic = "\b\0", s.inherits(h, a), h.prototype.processChunk = function(e2) {
this.meta = e2.meta, null === this._pako && this._createPako(), this._pako.push(s.transformTo(o, e2.data), false);
}, h.prototype.flush = function() {
a.prototype.flush.call(this), null === this._pako && this._createPako(), this._pako.push([], true);
}, h.prototype.cleanUp = function() {
a.prototype.cleanUp.call(this), this._pako = null;
}, h.prototype._createPako = function() {
this._pako = new i[this._pakoAction]({ raw: true, level: this._pakoOptions.level || -1 });
var t2 = this;
this._pako.onData = function(e2) {
t2.push({ data: e2, meta: t2.meta });
};
}, r.compressWorker = function(e2) {
return new h("Deflate", e2);
}, r.uncompressWorker = function() {
return new h("Inflate", {});
};
}, { "./stream/GenericWorker": 28, "./utils": 32, pako: 38 }], 8: [function(e, t, r) {
"use strict";
function A(e2, t2) {
var r2, n2 = "";
for (r2 = 0; r2 < t2; r2++)
n2 += String.fromCharCode(255 & e2), e2 >>>= 8;
return n2;
}
function n(e2, t2, r2, n2, i2, s2) {
var a, o, h = e2.file, u = e2.compression, l = s2 !== O.utf8encode, f = I.transformTo("string", s2(h.name)), c = I.transformTo("string", O.utf8encode(h.name)), d = h.comment, p = I.transformTo("string", s2(d)), m = I.transformTo("string", O.utf8encode(d)), _ = c.length !== h.name.length, g = m.length !== d.length, b = "", v = "", y = "", w = h.dir, k = h.date, x = { crc32: 0, compressedSize: 0, uncompressedSize: 0 };
t2 && !r2 || (x.crc32 = e2.crc32, x.compressedSize = e2.compressedSize, x.uncompressedSize = e2.uncompressedSize);
var S = 0;
t2 && (S |= 8), l || !_ && !g || (S |= 2048);
var z = 0, C = 0;
w && (z |= 16), "UNIX" === i2 ? (C = 798, z |= function(e3, t3) {
var r3 = e3;
return e3 || (r3 = t3 ? 16893 : 33204), (65535 & r3) << 16;
}(h.unixPermissions, w)) : (C = 20, z |= function(e3) {
return 63 & (e3 || 0);
}(h.dosPermissions)), a = k.getUTCHours(), a <<= 6, a |= k.getUTCMinutes(), a <<= 5, a |= k.getUTCSeconds() / 2, o = k.getUTCFullYear() - 1980, o <<= 4, o |= k.getUTCMonth() + 1, o <<= 5, o |= k.getUTCDate(), _ && (v = A(1, 1) + A(B(f), 4) + c, b += "up" + A(v.length, 2) + v), g && (y = A(1, 1) + A(B(p), 4) + m, b += "uc" + A(y.length, 2) + y);
var E = "";
return E += "\n\0", E += A(S, 2), E += u.magic, E += A(a, 2), E += A(o, 2), E += A(x.crc32, 4), E += A(x.compressedSize, 4), E += A(x.uncompressedSize, 4), E += A(f.length, 2), E += A(b.length, 2), { fileRecord: R.LOCAL_FILE_HEADER + E + f + b, dirRecord: R.CENTRAL_FILE_HEADER + A(C, 2) + E + A(p.length, 2) + "\0\0\0\0" + A(z, 4) + A(n2, 4) + f + b + p };
}
var I = e("../utils"), i = e("../stream/GenericWorker"), O = e("../utf8"), B = e("../crc32"), R = e("../signature");
function s(e2, t2, r2, n2) {
i.call(this, "ZipFileWorker"), this.bytesWritten = 0, this.zipComment = t2, this.zipPlatform = r2, this.encodeFileName = n2, this.streamFiles = e2, this.accumulate = false, this.contentBuffer = [], this.dirRecords = [], this.currentSourceOffset = 0, this.entriesCount = 0, this.currentFile = null, this._sources = [];
}
I.inherits(s, i), s.prototype.push = function(e2) {
var t2 = e2.meta.percent || 0, r2 = this.entriesCount, n2 = this._sources.length;
this.accumulate ? this.contentBuffer.push(e2) : (this.bytesWritten += e2.data.length, i.prototype.push.call(this, { data: e2.data, meta: { currentFile: this.currentFile, percent: r2 ? (t2 + 100 * (r2 - n2 - 1)) / r2 : 100 } }));
}, s.prototype.openedSource = function(e2) {
this.currentSourceOffset = this.bytesWritten, this.currentFile = e2.file.name;
var t2 = this.streamFiles && !e2.file.dir;
if (t2) {
var r2 = n(e2, t2, false, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
this.push({ data: r2.fileRecord, meta: { percent: 0 } });
} else
this.accumulate = true;
}, s.prototype.closedSource = function(e2) {
this.accumulate = false;
var t2 = this.streamFiles && !e2.file.dir, r2 = n(e2, t2, true, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
if (this.dirRecords.push(r2.dirRecord), t2)
this.push({ data: function(e3) {
return R.DATA_DESCRIPTOR + A(e3.crc32, 4) + A(e3.compressedSize, 4) + A(e3.uncompressedSize, 4);
}(e2), meta: { percent: 100 } });
else
for (this.push({ data: r2.fileRecord, meta: { percent: 0 } }); this.contentBuffer.length; )
this.push(this.contentBuffer.shift());
this.currentFile = null;
}, s.prototype.flush = function() {
for (var e2 = this.bytesWritten, t2 = 0; t2 < this.dirRecords.length; t2++)
this.push({ data: this.dirRecords[t2], meta: { percent: 100 } });
var r2 = this.bytesWritten - e2, n2 = function(e3, t3, r3, n3, i2) {
var s2 = I.transformTo("string", i2(n3));
return R.CENTRAL_DIRECTORY_END + "\0\0\0\0" + A(e3, 2) + A(e3, 2) + A(t3, 4) + A(r3, 4) + A(s2.length, 2) + s2;
}(this.dirRecords.length, r2, e2, this.zipComment, this.encodeFileName);
this.push({ data: n2, meta: { percent: 100 } });
}, s.prototype.prepareNextSource = function() {
this.previous = this._sources.shift(), this.openedSource(this.previous.streamInfo), this.isPaused ? this.previous.pause() : this.previous.resume();
}, s.prototype.registerPrevious = function(e2) {
this._sources.push(e2);
var t2 = this;
return e2.on("data", function(e3) {
t2.processChunk(e3);
}), e2.on("end", function() {
t2.closedSource(t2.previous.streamInfo), t2._sources.length ? t2.prepareNextSource() : t2.end();
}), e2.on("error", function(e3) {
t2.error(e3);
}), this;
}, s.prototype.resume = function() {
return !!i.prototype.resume.call(this) && (!this.previous && this._sources.length ? (this.prepareNextSource(), true) : this.previous || this._sources.length || this.generatedError ? void 0 : (this.end(), true));
}, s.prototype.error = function(e2) {
var t2 = this._sources;
if (!i.prototype.error.call(this, e2))
return false;
for (var r2 = 0; r2 < t2.length; r2++)
try {
t2[r2].error(e2);
} catch (e3) {
}
return true;
}, s.prototype.lock = function() {
i.prototype.lock.call(this);
for (var e2 = this._sources, t2 = 0; t2 < e2.length; t2++)
e2[t2].lock();
}, t.exports = s;
}, { "../crc32": 4, "../signature": 23, "../stream/GenericWorker": 28, "../utf8": 31, "../utils": 32 }], 9: [function(e, t, r) {
"use strict";
var u = e("../compressions"), n = e("./ZipFileWorker");
r.generateWorker = function(e2, a, t2) {
var o = new n(a.streamFiles, t2, a.platform, a.encodeFileName), h = 0;
try {
e2.forEach(function(e3, t3) {
h++;
var r2 = function(e4, t4) {
var r3 = e4 || t4, n3 = u[r3];
if (!n3)
throw new Error(r3 + " is not a valid compression method !");
return n3;
}(t3.options.compression, a.compression), n2 = t3.options.compressionOptions || a.compressionOptions || {}, i = t3.dir, s = t3.date;
t3._compressWorker(r2, n2).withStreamInfo("file", { name: e3, dir: i, date: s, comment: t3.comment || "", unixPermissions: t3.unixPermissions, dosPermissions: t3.dosPermissions }).pipe(o);
}), o.entriesCount = h;
} catch (e3) {
o.error(e3);
}
return o;
};
}, { "../compressions": 3, "./ZipFileWorker": 8 }], 10: [function(e, t, r) {
"use strict";
function n() {
if (!(this instanceof n))
return new n();
if (arguments.length)
throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");
this.files = /* @__PURE__ */ Object.create(null), this.comment = null, this.root = "", this.clone = function() {
var e2 = new n();
for (var t2 in this)
"function" != typeof this[t2] && (e2[t2] = this[t2]);
return e2;
};
}
(n.prototype = e("./object")).loadAsync = e("./load"), n.support = e("./support"), n.defaults = e("./defaults"), n.version = "3.10.1", n.loadAsync = function(e2, t2) {
return new n().loadAsync(e2, t2);
}, n.external = e("./external"), t.exports = n;
}, { "./defaults": 5, "./external": 6, "./load": 11, "./object": 15, "./support": 30 }], 11: [function(e, t, r) {
"use strict";
var u = e("./utils"), i = e("./external"), n = e("./utf8"), s = e("./zipEntries"), a = e("./stream/Crc32Probe"), l = e("./nodejsUtils");
function f(n2) {
return new i.Promise(function(e2, t2) {
var r2 = n2.decompressed.getContentWorker().pipe(new a());
r2.on("error", function(e3) {
t2(e3);
}).on("end", function() {
r2.streamInfo.crc32 !== n2.decompressed.crc32 ? t2(new Error("Corrupted zip : CRC32 mismatch")) : e2();
}).resume();
});
}
t.exports = function(e2, o) {
var h = this;
return o = u.extend(o || {}, { base64: false, checkCRC32: false, optimizedBinaryString: false, createFolders: false, decodeFileName: n.utf8decode }), l.isNode && l.isStream(e2) ? i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")) : u.prepareContent("the loaded zip file", e2, true, o.optimizedBinaryString, o.base64).then(function(e3) {
var t2 = new s(o);
return t2.load(e3), t2;
}).then(function(e3) {
var t2 = [i.Promise.resolve(e3)], r2 = e3.files;
if (o.checkCRC32)
for (var n2 = 0; n2 < r2.length; n2++)
t2.push(f(r2[n2]));
return i.Promise.all(t2);
}).then(function(e3) {
for (var t2 = e3.shift(), r2 = t2.files, n2 = 0; n2 < r2.length; n2++) {
var i2 = r2[n2], s2 = i2.fileNameStr, a2 = u.resolve(i2.fileNameStr);
h.file(a2, i2.decompressed, { binary: true, optimizedBinaryString: true, date: i2.date, dir: i2.dir, comment: i2.fileCommentStr.length ? i2.fileCommentStr : null, unixPermissions: i2.unixPermissions, dosPermissions: i2.dosPermissions, createFolders: o.createFolders }), i2.dir || (h.file(a2).unsafeOriginalName = s2);
}
return t2.zipComment.length && (h.comment = t2.zipComment), h;
});
};
}, { "./external": 6, "./nodejsUtils": 14, "./stream/Crc32Probe": 25, "./utf8": 31, "./utils": 32, "./zipEntries": 33 }], 12: [function(e, t, r) {
"use strict";
var n = e("../utils"), i = e("../stream/GenericWorker");
function s(e2, t2) {
i.call(this, "Nodejs stream input adapter for " + e2), this._upstreamEnded = false, this._bindStream(t2);
}
n.inherits(s, i), s.prototype._bindStream = function(e2) {
var t2 = this;
(this._stream = e2).pause(), e2.on("data", function(e3) {
t2.push({ data: e3, meta: { percent: 0 } });
}).on("error", function(e3) {
t2.isPaused ? this.generatedError = e3 : t2.error(e3);
}).on("end", function() {
t2.isPaused ? t2._upstreamEnded = true : t2.end();
});
}, s.prototype.pause = function() {
return !!i.prototype.pause.call(this) && (this._stream.pause(), true);
}, s.prototype.resume = function() {
return !!i.prototype.resume.call(this) && (this._upstreamEnded ? this.end() : this._stream.resume(), true);
}, t.exports = s;
}, { "../stream/GenericWorker": 28, "../utils": 32 }], 13: [function(e, t, r) {
"use strict";
var i = e("readable-stream").Readable;
function n(e2, t2, r2) {
i.call(this, t2), this._helper = e2;
var n2 = this;
e2.on("data", function(e3, t3) {
n2.push(e3) || n2._helper.pause(), r2 && r2(t3);
}).on("error", function(e3) {
n2.emit("error", e3);
}).on("end", function() {
n2.push(null);
});
}
e("../utils").inherits(n, i), n.prototype._read = function() {
this._helper.resume();
}, t.exports = n;
}, { "../utils": 32, "readable-stream": 16 }], 14: [function(e, t, r) {
"use strict";
t.exports = { isNode: "undefined" != typeof Buffer, newBufferFrom: function(e2, t2) {
if (Buffer.from && Buffer.from !== Uint8Array.from)
return Buffer.from(e2, t2);
if ("number" == typeof e2)
throw new Error('The "data" argument must not be a number');
return new Buffer(e2, t2);
}, allocBuffer: function(e2) {
if (Buffer.alloc)
return Buffer.alloc(e2);
var t2 = new Buffer(e2);
return t2.fill(0), t2;
}, isBuffer: function(e2) {
return Buffer.isBuffer(e2);
}, isStream: function(e2) {
return e2 && "function" == typeof e2.on && "function" == typeof e2.pause && "function" == typeof e2.resume;
} };
}, {}], 15: [function(e, t, r) {
"use strict";
function s(e2, t2, r2) {
var n2, i2 = u.getTypeOf(t2), s2 = u.extend(r2 || {}, f);
s2.date = s2.date || new Date(), null !== s2.compression && (s2.compression = s2.compression.toUpperCase()), "string" == typeof s2.unixPermissions && (s2.unixPermissions = parseInt(s2.unixPermissions, 8)), s2.unixPermissions && 16384 & s2.unixPermissions && (s2.dir = true), s2.dosPermissions && 16 & s2.dosPermissions && (s2.dir = true), s2.dir && (e2 = g(e2)), s2.createFolders && (n2 = _(e2)) && b.call(this, n2, true);
var a2 = "string" === i2 && false === s2.binary && false === s2.base64;
r2 && void 0 !== r2.binary || (s2.binary = !a2), (t2 instanceof c && 0 === t2.uncompressedSize || s2.dir || !t2 || 0 === t2.length) && (s2.base64 = false, s2.binary = true, t2 = "", s2.compression = "STORE", i2 = "string");
var o2 = null;
o2 = t2 instanceof c || t2 instanceof l ? t2 : p.isNode && p.isStream(t2) ? new m(e2, t2) : u.prepareContent(e2, t2, s2.binary, s2.optimizedBinaryString, s2.base64);
var h2 = new d(e2, o2, s2);
this.files[e2] = h2;
}
var i = e("./utf8"), u = e("./utils"), l = e("./stream/GenericWorker"), a = e("./stream/StreamHelper"), f = e("./defaults"), c = e("./compressedObject"), d = e("./zipObject"), o = e("./generate"), p = e("./nodejsUtils"), m = e("./nodejs/NodejsStreamInputAdapter"), _ = function(e2) {
"/" === e2.slice(-1) && (e2 = e2.substring(0, e2.length - 1));
var t2 = e2.lastIndexOf("/");
return 0 < t2 ? e2.substring(0, t2) : "";
}, g = function(e2) {
return "/" !== e2.slice(-1) && (e2 += "/"), e2;
}, b = function(e2, t2) {
return t2 = void 0 !== t2 ? t2 : f.createFolders, e2 = g(e2), this.files[e2] || s.call(this, e2, null, { dir: true, createFolders: t2 }), this.files[e2];
};
function h(e2) {
return "[object RegExp]" === Object.prototype.toString.call(e2);
}
var n = { load: function() {
throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
}, forEach: function(e2) {
var t2, r2, n2;
for (t2 in this.files)
n2 = this.files[t2], (r2 = t2.slice(this.root.length, t2.length)) && t2.slice(0, this.root.length) === this.root && e2(r2, n2);
}, filter: function(r2) {
var n2 = [];
return this.forEach(function(e2, t2) {
r2(e2, t2) && n2.push(t2);
}), n2;
}, file: function(e2, t2, r2) {
if (1 !== arguments.length)
return e2 = this.root + e2, s.call(this, e2, t2, r2), this;
if (h(e2)) {
var n2 = e2;
return this.filter(function(e3, t3) {
return !t3.dir && n2.test(e3);
});
}
var i2 = this.files[this.root + e2];
return i2 && !i2.dir ? i2 : null;
}, folder: function(r2) {
if (!r2)
return this;
if (h(r2))
return this.filter(function(e3, t3) {
return t3.dir && r2.test(e3);
});
var e2 = this.root + r2, t2 = b.call(this, e2), n2 = this.clone();
return n2.root = t2.name, n2;
}, remove: function(r2) {
r2 = this.root + r2;
var e2 = this.files[r2];
if (e2 || ("/" !== r2.slice(-1) && (r2 += "/"), e2 = this.files[r2]), e2 && !e2.dir)
delete this.files[r2];
else
for (var t2 = this.filter(function(e3, t3) {
return t3.name.slice(0, r2.length) === r2;
}), n2 = 0; n2 < t2.length; n2++)
delete this.files[t2[n2].name];
return this;
}, generate: function() {
throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
}, generateInternalStream: function(e2) {
var t2, r2 = {};
try {
if ((r2 = u.extend(e2 || {}, { streamFiles: false, compression: "STORE", compressionOptions: null, type: "", platform: "DOS", comment: null, mimeType: "application/zip", encodeFileName: i.utf8encode })).type = r2.type.toLowerCase(), r2.compression = r2.compression.toUpperCase(), "binarystring" === r2.type && (r2.type = "string"), !r2.type)
throw new Error("No output type specified.");
u.checkSupport(r2.type), "darwin" !== r2.platform && "freebsd" !== r2.platform && "linux" !== r2.platform && "sunos" !== r2.platform || (r2.platform = "UNIX"), "win32" === r2.platform && (r2.platform = "DOS");
var n2 = r2.comment || this.comment || "";
t2 = o.generateWorker(this, r2, n2);
} catch (e3) {
(t2 = new l("error")).error(e3);
}
return new a(t2, r2.type || "string", r2.mimeType);
}, generateAsync: function(e2, t2) {
return this.generateInternalStream(e2).accumulate(t2);
}, generateNodeStream: function(e2, t2) {
return (e2 = e2 || {}).type || (e2.type = "nodebuffer"), this.generateInternalStream(e2).toNodejsStream(t2);
} };
t.exports = n;
}, { "./compressedObject": 2, "./defaults": 5, "./generate": 9, "./nodejs/NodejsStreamInputAdapter": 12, "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31, "./utils": 32, "./zipObject": 35 }], 16: [function(e, t, r) {
"use strict";
t.exports = e("stream");
}, { stream: void 0 }], 17: [function(e, t, r) {
"use strict";
var n = e("./DataReader");
function i(e2) {
n.call(this, e2);
for (var t2 = 0; t2 < this.data.length; t2++)
e2[t2] = 255 & e2[t2];
}
e("../utils").inherits(i, n), i.prototype.byteAt = function(e2) {
return this.data[this.zero + e2];
}, i.prototype.lastIndexOfSignature = function(e2) {
for (var t2 = e2.charCodeAt(0), r2 = e2.charCodeAt(1), n2 = e2.charCodeAt(2), i2 = e2.charCodeAt(3), s = this.length - 4; 0 <= s; --s)
if (this.data[s] === t2 && this.data[s + 1] === r2 && this.data[s + 2] === n2 && this.data[s + 3] === i2)
return s - this.zero;
return -1;
}, i.prototype.readAndCheckSignature = function(e2) {
var t2 = e2.charCodeAt(0), r2 = e2.charCodeAt(1), n2 = e2.charCodeAt(2), i2 = e2.charCodeAt(3), s = this.readData(4);
return t2 === s[0] && r2 === s[1] && n2 === s[2] && i2 === s[3];
}, i.prototype.readData = function(e2) {
if (this.checkOffset(e2), 0 === e2)
return [];
var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2);
return this.index += e2, t2;
}, t.exports = i;
}, { "../utils": 32, "./DataReader": 18 }], 18: [function(e, t, r) {
"use strict";
var n = e("../utils");
function i(e2) {
this.data = e2, this.length = e2.length, this.index = 0, this.zero = 0;
}
i.prototype = { checkOffset: function(e2) {
this.checkIndex(this.index + e2);
}, checkIndex: function(e2) {
if (this.length < this.zero + e2 || e2 < 0)
throw new Error("End of data reached (data length = " + this.length + ", asked index = " + e2 + "). Corrupted zip ?");
}, setIndex: function(e2) {
this.checkIndex(e2), this.index = e2;
}, skip: function(e2) {
this.setIndex(this.index + e2);
}, byteAt: function() {
}, readInt: function(e2) {
var t2, r2 = 0;
for (this.checkOffset(e2), t2 = this.index + e2 - 1; t2 >= this.index; t2--)
r2 = (r2 << 8) + this.byteAt(t2);
return this.index += e2, r2;
}, readString: function(e2) {
return n.transformTo("string", this.readData(e2));
}, readData: function() {
}, lastIndexOfSignature: function() {
}, readAndCheckSignature: function() {
}, readDate: function() {
var e2 = this.readInt(4);
return new Date(Date.UTC(1980 + (e2 >> 25 & 127), (e2 >> 21 & 15) - 1, e2 >> 16 & 31, e2 >> 11 & 31, e2 >> 5 & 63, (31 & e2) << 1));
} }, t.exports = i;
}, { "../utils": 32 }], 19: [function(e, t, r) {
"use strict";
var n = e("./Uint8ArrayReader");
function i(e2) {
n.call(this, e2);
}
e("../utils").inherits(i, n), i.prototype.readData = function(e2) {
this.checkOffset(e2);
var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2);
return this.index += e2, t2;
}, t.exports = i;
}, { "../utils": 32, "./Uint8ArrayReader": 21 }], 20: [function(e, t, r) {
"use strict";
var n = e("./DataReader");
function i(e2) {
n.call(this, e2);
}
e("../utils").inherits(i, n), i.prototype.byteAt = function(e2) {
return this.data.charCodeAt(this.zero + e2);
}, i.prototype.lastIndexOfSignature = function(e2) {
return this.data.lastIndexOf(e2) - this.zero;
}, i.prototype.readAndCheckSignature = function(e2) {
return e2 === this.readData(4);
}, i.prototype.readData = function(e2) {
this.checkOffset(e2);
var t2 = this.data.slice(this.zero + this.index, this.zero + this.index + e2);
return this.index += e2, t2;
}, t.exports = i;
}, { "../utils": 32, "./DataReader": 18 }], 21: [function(e, t, r) {
"use strict";
var n = e("./ArrayReader");
function i(e2) {
n.call(this, e2);
}
e("../utils").inherits(i, n), i.prototype.readData = function(e2) {
if (this.checkOffset(e2), 0 === e2)
return new Uint8Array(0);
var t2 = this.data.subarray(this.zero + this.index, this.zero + this.index + e2);
return this.index += e2, t2;
}, t.exports = i;
}, { "../utils": 32, "./ArrayReader": 17 }], 22: [function(e, t, r) {
"use strict";
var n = e("../utils"), i = e("../support"), s = e("./ArrayReader"), a = e("./StringReader"), o = e("./NodeBufferReader"), h = e("./Uint8ArrayReader");
t.exports = function(e2) {
var t2 = n.getTypeOf(e2);
return n.checkSupport(t2), "string" !== t2 || i.uint8array ? "nodebuffer" === t2 ? new o(e2) : i.uint8array ? new h(n.transformTo("uint8array", e2)) : new s(n.transformTo("array", e2)) : new a(e2);
};
}, { "../support": 30, "../utils": 32, "./ArrayReader": 17, "./NodeBufferReader": 19, "./StringReader": 20, "./Uint8ArrayReader": 21 }], 23: [function(e, t, r) {
"use strict";
r.LOCAL_FILE_HEADER = "PK", r.CENTRAL_FILE_HEADER = "PK", r.CENTRAL_DIRECTORY_END = "PK", r.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK\x07", r.ZIP64_CENTRAL_DIRECTORY_END = "PK", r.DATA_DESCRIPTOR = "PK\x07\b";
}, {}], 24: [function(e, t, r) {
"use strict";
var n = e("./GenericWorker"), i = e("../utils");
function s(e2) {
n.call(this, "ConvertWorker to " + e2), this.destType = e2;
}
i.inherits(s, n), s.prototype.processChunk = function(e2) {
this.push({ data: i.transformTo(this.destType, e2.data), meta: e2.meta });
}, t.exports = s;
}, { "../utils": 32, "./GenericWorker": 28 }], 25: [function(e, t, r) {
"use strict";
var n = e("./GenericWorker"), i = e("../crc32");
function s() {
n.call(this, "Crc32Probe"), this.withStreamInfo("crc32", 0);
}
e("../utils").inherits(s, n), s.prototype.processChunk = function(e2) {
this.streamInfo.crc32 = i(e2.data, this.streamInfo.crc32 || 0), this.push(e2);
}, t.exports = s;
}, { "../crc32": 4, "../utils": 32, "./GenericWorker": 28 }], 26: [function(e, t, r) {
"use strict";
var n = e("../utils"), i = e("./GenericWorker");
function s(e2) {
i.call(this, "DataLengthProbe for " + e2), this.propName = e2, this.withStreamInfo(e2, 0);
}
n.inherits(s, i), s.prototype.processChunk = function(e2) {
if (e2) {
var t2 = this.streamInfo[this.propName] || 0;
this.streamInfo[this.propName] = t2 + e2.data.length;
}
i.prototype.processChunk.call(this, e2);
}, t.exports = s;
}, { "../utils": 32, "./GenericWorker": 28 }], 27: [function(e, t, r) {
"use strict";
var n = e("../utils"), i = e("./GenericWorker");
function s(e2) {
i.call(this, "DataWorker");
var t2 = this;
this.dataIsReady = false, this.index = 0, this.max = 0, this.data = null, this.type = "", this._tickScheduled = false, e2.then(function(e3) {
t2.dataIsReady = true, t2.data = e3, t2.max = e3 && e3.length || 0, t2.type = n.getTypeOf(e3), t2.isPaused || t2._tickAndRepeat();
}, function(e3) {
t2.error(e3);
});
}
n.inherits(s, i), s.prototype.cleanUp = function() {
i.prototype.cleanUp.call(this), this.data = null;
}, s.prototype.resume = function() {
return !!i.prototype.resume.call(this) && (!this._tickScheduled && this.dataIsReady && (this._tickScheduled = true, n.delay(this._tickAndRepeat, [], this)), true);
}, s.prototype._tickAndRepeat = function() {
this._tickScheduled = false, this.isPaused || this.isFinished || (this._tick(), this.isFinished || (n.delay(this._tickAndRepeat, [], this), this._tickScheduled = true));
}, s.prototype._tick = function() {
if (this.isPaused || this.isFinished)
return false;
var e2 = null, t2 = Math.min(this.max, this.index + 16384);
if (this.index >= this.max)
return this.end();
switch (this.type) {
case "string":
e2 = this.data.substring(this.index, t2);
break;
case "uint8array":
e2 = this.data.subarray(this.index, t2);
break;
case "array":
case "nodebuffer":
e2 = this.data.slice(this.index, t2);
}
return this.index = t2, this.push({ data: e2, meta: { percent: this.max ? this.index / this.max * 100 : 0 } });
}, t.exports = s;
}, { "../utils": 32, "./GenericWorker": 28 }], 28: [function(e, t, r) {
"use strict";
function n(e2) {
this.name = e2 || "default", this.streamInfo = {}, this.generatedError = null, this.extraStreamInfo = {}, this.isPaused = true, this.isFinished = false, this.isLocked = false, this._listeners = { data: [], end: [], error: [] }, this.previous = null;
}
n.prototype = { push: function(e2) {
this.emit("data", e2);
}, end: function() {
if (this.isFinished)
return false;
this.flush();
try {
this.emit("end"), this.cleanUp(), this.isFinished = true;
} catch (e2) {
this.emit("error", e2);
}
return true;
}, error: function(e2) {
return !this.isFinished && (this.isPaused ? this.generatedError = e2 : (this.isFinished = true, this.emit("error", e2), this.previous && this.previous.error(e2), this.cleanUp()), true);
}, on: function(e2, t2) {
return this._listeners[e2].push(t2), this;
}, cleanUp: function() {
this.streamInfo = this.generatedError = this.extraStreamInfo = null, this._listeners = [];
}, emit: function(e2, t2) {
if (this._listeners[e2])
for (var r2 = 0; r2 < this._listeners[e2].length; r2++)
this._listeners[e2][r2].call(this, t2);
}, pipe: function(e2) {
return e2.registerPrevious(this);
}, registerPrevious: function(e2) {
if (this.isLocked)
throw new Error("The stream '" + this + "' has already been used.");
this.streamInfo = e2.streamInfo, this.mergeStreamInfo(), this.previous = e2;
var t2 = this;
return e2.on("data", function(e3) {
t2.processChunk(e3);
}), e2.on("end", function() {
t2.end();
}), e2.on("error", function(e3) {
t2.error(e3);
}), this;
}, pause: function() {
return !this.isPaused && !this.isFinished && (this.isPaused = true, this.previous && this.previous.pause(), true);
}, resume: function() {
if (!this.isPaused || this.isFinished)
return false;
var e2 = this.isPaused = false;
return this.generatedError && (this.error(this.generatedError), e2 = true), this.previous && this.previous.resume(), !e2;
}, flush: function() {
}, processChunk: function(e2) {
this.push(e2);
}, withStreamInfo: function(e2, t2) {
return this.extraStreamInfo[e2] = t2, this.mergeStreamInfo(), this;
}, mergeStreamInfo: function() {
for (var e2 in this.extraStreamInfo)
Object.prototype.hasOwnProperty.call(this.extraStreamInfo, e2) && (this.streamInfo[e2] = this.extraStreamInfo[e2]);
}, lock: function() {
if (this.isLocked)
throw new Error("The stream '" + this + "' has already been used.");
this.isLocked = true, this.previous && this.previous.lock();
}, toString: function() {
var e2 = "Worker " + this.name;
return this.previous ? this.previous + " -> " + e2 : e2;
} }, t.exports = n;
}, {}], 29: [function(e, t, r) {
"use strict";
var h = e("../utils"), i = e("./ConvertWorker"), s = e("./GenericWorker"), u = e("../base64"), n = e("../support"), a = e("../external"), o = null;
if (n.nodestream)
try {
o = e("../nodejs/NodejsStreamOutputAdapter");
} catch (e2) {
}
function l(e2, o2) {
return new a.Promise(function(t2, r2) {
var n2 = [], i2 = e2._internalType, s2 = e2._outputType, a2 = e2._mimeType;
e2.on("data", function(e3, t3) {
n2.push(e3), o2 && o2(t3);
}).on("error", function(e3) {
n2 = [], r2(e3);
}).on("end", function() {
try {
var e3 = function(e4, t3, r3) {
switch (e4) {
case "blob":
return h.newBlob(h.transformTo("arraybuffer", t3), r3);
case "base64":
return u.encode(t3);
default:
return h.transformTo(e4, t3);
}
}(s2, function(e4, t3) {
var r3, n3 = 0, i3 = null, s3 = 0;
for (r3 = 0; r3 < t3.length; r3++)
s3 += t3[r3].length;
switch (e4) {
case "string":
return t3.join("");
case "array":
return Array.prototype.concat.apply([], t3);
case "uint8array":
for (i3 = new Uint8Array(s3), r3 = 0; r3 < t3.length; r3++)
i3.set(t3[r3], n3), n3 += t3[r3].length;
return i3;
case "nodebuffer":
return Buffer.concat(t3);
default:
throw new Error("concat : unsupported type '" + e4 + "'");
}
}(i2, n2), a2);
t2(e3);
} catch (e4) {
r2(e4);
}
n2 = [];
}).resume();
});
}
function f(e2, t2, r2) {
var n2 = t2;
switch (t2) {
case "blob":
case "arraybuffer":
n2 = "uint8array";
break;
case "base64":
n2 = "string";
}
try {
this._internalType = n2, this._outputType = t2, this._mimeType = r2, h.checkSupport(n2), this._worker = e2.pipe(new i(n2)), e2.lock();
} catch (e3) {
this._worker = new s("error"), this._worker.error(e3);
}
}
f.prototype = { accumulate: function(e2) {
return l(this, e2);
}, on: function(e2, t2) {
var r2 = this;
return "data" === e2 ? this._worker.on(e2, function(e3) {
t2.call(r2, e3.data, e3.meta);
}) : this._worker.on(e2, function() {
h.delay(t2, arguments, r2);
}), this;
}, resume: function() {
return h.delay(this._worker.resume, [], this._worker), this;
}, pause: function() {
return this._worker.pause(), this;
}, toNodejsStream: function(e2) {
if (h.checkSupport("nodestream"), "nodebuffer" !== this._outputType)
throw new Error(this._outputType + " is not supported by this method");
return new o(this, { objectMode: "nodebuffer" !== this._outputType }, e2);
} }, t.exports = f;
}, { "../base64": 1, "../external": 6, "../nodejs/NodejsStreamOutputAdapter": 13, "../support": 30, "../utils": 32, "./ConvertWorker": 24, "./GenericWorker": 28 }], 30: [function(e, t, r) {
"use strict";
if (r.base64 = true, r.array = true, r.string = true, r.arraybuffer = "undefined" != typeof ArrayBuffer && "undefined" != typeof Uint8Array, r.nodebuffer = "undefined" != typeof Buffer, r.uint8array = "undefined" != typeof Uint8Array, "undefined" == typeof ArrayBuffer)
r.blob = false;
else {
var n = new ArrayBuffer(0);
try {
r.blob = 0 === new Blob([n], { type: "application/zip" }).size;
} catch (e2) {
try {
var i = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
i.append(n), r.blob = 0 === i.getBlob("application/zip").size;
} catch (e3) {
r.blob = false;
}
}
}
try {
r.nodestream = !!e("readable-stream").Readable;
} catch (e2) {
r.nodestream = false;
}
}, { "readable-stream": 16 }], 31: [function(e, t, s) {
"use strict";
for (var o = e("./utils"), h = e("./support"), r = e("./nodejsUtils"), n = e("./stream/GenericWorker"), u = new Array(256), i = 0; i < 256; i++)
u[i] = 252 <= i ? 6 : 248 <= i ? 5 : 240 <= i ? 4 : 224 <= i ? 3 : 192 <= i ? 2 : 1;
u[254] = u[254] = 1;
function a() {
n.call(this, "utf-8 decode"), this.leftOver = null;
}
function l() {
n.call(this, "utf-8 encode");
}
s.utf8encode = function(e2) {
return h.nodebuffer ? r.newBufferFrom(e2, "utf-8") : function(e3) {
var t2, r2, n2, i2, s2, a2 = e3.length, o2 = 0;
for (i2 = 0; i2 < a2; i2++)
55296 == (64512 & (r2 = e3.charCodeAt(i2))) && i2 + 1 < a2 && 56320 == (64512 & (n2 = e3.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), o2 += r2 < 128 ? 1 : r2 < 2048 ? 2 : r2 < 65536 ? 3 : 4;
for (t2 = h.uint8array ? new Uint8Array(o2) : new Array(o2), i2 = s2 = 0; s2 < o2; i2++)
55296 == (64512 & (r2 = e3.charCodeAt(i2))) && i2 + 1 < a2 && 56320 == (64512 & (n2 = e3.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), r2 < 128 ? t2[s2++] = r2 : (r2 < 2048 ? t2[s2++] = 192 | r2 >>> 6 : (r2 < 65536 ? t2[s2++] = 224 | r2 >>> 12 : (t2[s2++] = 240 | r2 >>> 18, t2[s2++] = 128 | r2 >>> 12 & 63), t2[s2++] = 128 | r2 >>> 6 & 63), t2[s2++] = 128 | 63 & r2);
return t2;
}(e2);
}, s.utf8decode = function(e2) {
return h.nodebuffer ? o.transformTo("nodebuffer", e2).toString("utf-8") : function(e3) {
var t2, r2, n2, i2, s2 = e3.length, a2 = new Array(2 * s2);
for (t2 = r2 = 0; t2 < s2; )
if ((n2 = e3[t2++]) < 128)
a2[r2++] = n2;
else if (4 < (i2 = u[n2]))
a2[r2++] = 65533, t2 += i2 - 1;
else {
for (n2 &= 2 === i2 ? 31 : 3 === i2 ? 15 : 7; 1 < i2 && t2 < s2; )
n2 = n2 << 6 | 63 & e3[t2++], i2--;
1 < i2 ? a2[r2++] = 65533 : n2 < 65536 ? a2[r2++] = n2 : (n2 -= 65536, a2[r2++] = 55296 | n2 >> 10 & 1023, a2[r2++] = 56320 | 1023 & n2);
}
return a2.length !== r2 && (a2.subarray ? a2 = a2.subarray(0, r2) : a2.length = r2), o.applyFromCharCode(a2);
}(e2 = o.transformTo(h.uint8array ? "uint8array" : "array", e2));
}, o.inherits(a, n), a.prototype.processChunk = function(e2) {
var t2 = o.transformTo(h.uint8array ? "uint8array" : "array", e2.data);
if (this.leftOver && this.leftOver.length) {
if (h.uint8array) {
var r2 = t2;
(t2 = new Uint8Array(r2.length + this.leftOver.length)).set(this.leftOver, 0), t2.set(r2, this.leftOver.length);
} else
t2 = this.leftOver.concat(t2);
this.leftOver = null;
}
var n2 = function(e3, t3) {
var r3;
for ((t3 = t3 || e3.length) > e3.length && (t3 = e3.length), r3 = t3 - 1; 0 <= r3 && 128 == (192 & e3[r3]); )
r3--;
return r3 < 0 ? t3 : 0 === r3 ? t3 : r3 + u[e3[r3]] > t3 ? r3 : t3;
}(t2), i2 = t2;
n2 !== t2.length && (h.uint8array ? (i2 = t2.subarray(0, n2), this.leftOver = t2.subarray(n2, t2.length)) : (i2 = t2.slice(0, n2), this.leftOver = t2.slice(n2, t2.length))), this.push({ data: s.utf8decode(i2), meta: e2.meta });
}, a.prototype.flush = function() {
this.leftOver && this.leftOver.length && (this.push({ data: s.utf8decode(this.leftOver), meta: {} }), this.leftOver = null);
}, s.Utf8DecodeWorker = a, o.inherits(l, n), l.prototype.processChunk = function(e2) {
this.push({ data: s.utf8encode(e2.data), meta: e2.meta });
}, s.Utf8EncodeWorker = l;
}, { "./nodejsUtils": 14, "./stream/GenericWorker": 28, "./support": 30, "./utils": 32 }], 32: [function(e, t, a) {
"use strict";
var o = e("./support"), h = e("./base64"), r = e("./nodejsUtils"), u = e("./external");
function n(e2) {
return e2;
}
function l(e2, t2) {
for (var r2 = 0; r2 < e2.length; ++r2)
t2[r2] = 255 & e2.charCodeAt(r2);
return t2;
}
e("setimmediate"), a.newBlob = function(t2, r2) {
a.checkSupport("blob");
try {
return new Blob([t2], { type: r2 });
} catch (e2) {
try {
var n2 = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
return n2.append(t2), n2.getBlob(r2);
} catch (e3) {
throw new Error("Bug : can't construct the Blob.");
}
}
};
var i = { stringifyByChunk: function(e2, t2, r2) {
var n2 = [], i2 = 0, s2 = e2.length;
if (s2 <= r2)
return String.fromCharCode.apply(null, e2);
for (; i2 < s2; )
"array" === t2 || "nodebuffer" === t2 ? n2.push(String.fromCharCode.apply(null, e2.slice(i2, Math.min(i2 + r2, s2)))) : n2.push(String.fromCharCode.apply(null, e2.subarray(i2, Math.min(i2 + r2, s2)))), i2 += r2;
return n2.join("");
}, stringifyByChar: function(e2) {
for (var t2 = "", r2 = 0; r2 < e2.length; r2++)
t2 += String.fromCharCode(e2[r2]);
return t2;
}, applyCanBeUsed: { uint8array: function() {
try {
return o.uint8array && 1 === String.fromCharCode.apply(null, new Uint8Array(1)).length;
} catch (e2) {
return false;
}
}(), nodebuffer: function() {
try {
return o.nodebuffer && 1 === String.fromCharCode.apply(null, r.allocBuffer(1)).length;
} catch (e2) {
return false;
}
}() } };
function s(e2) {
var t2 = 65536, r2 = a.getTypeOf(e2), n2 = true;
if ("uint8array" === r2 ? n2 = i.applyCanBeUsed.uint8array : "nodebuffer" === r2 && (n2 = i.applyCanBeUsed.nodebuffer), n2)
for (; 1 < t2; )
try {
return i.stringifyByChunk(e2, r2, t2);
} catch (e3) {
t2 = Math.floor(t2 / 2);
}
return i.stringifyByChar(e2);
}
function f(e2, t2) {
for (var r2 = 0; r2 < e2.length; r2++)
t2[r2] = e2[r2];
return t2;
}
a.applyFromCharCode = s;
var c = {};
c.string = { string: n, array: function(e2) {
return l(e2, new Array(e2.length));
}, arraybuffer: function(e2) {
return c.string.uint8array(e2).buffer;
}, uint8array: function(e2) {
return l(e2, new Uint8Array(e2.length));
}, nodebuffer: function(e2) {
return l(e2, r.allocBuffer(e2.length));
} }, c.array = { string: s, array: n, arraybuffer: function(e2) {
return new Uint8Array(e2).buffer;
}, uint8array: function(e2) {
return new Uint8Array(e2);
}, nodebuffer: function(e2) {
return r.newBufferFrom(e2);
} }, c.arraybuffer = { string: function(e2) {
return s(new Uint8Array(e2));
}, array: function(e2) {
return f(new Uint8Array(e2), new Array(e2.byteLength));
}, arraybuffer: n, uint8array: function(e2) {
return new Uint8Array(e2);
}, nodebuffer: function(e2) {
return r.newBufferFrom(new Uint8Array(e2));
} }, c.uint8array = { string: s, array: function(e2) {
return f(e2, new Array(e2.length));
}, arraybuffer: function(e2) {
return e2.buffer;
}, uint8array: n, nodebuffer: function(e2) {
return r.newBufferFrom(e2);
} }, c.nodebuffer = { string: s, array: function(e2) {
return f(e2, new Array(e2.length));
}, arraybuffer: function(e2) {
return c.nodebuffer.uint8array(e2).buffer;
}, uint8array: function(e2) {
return f(e2, new Uint8Array(e2.length));
}, nodebuffer: n }, a.transformTo = function(e2, t2) {
if (t2 = t2 || "", !e2)
return t2;
a.checkSupport(e2);
var r2 = a.getTypeOf(t2);
return c[r2][e2](t2);
}, a.resolve = function(e2) {
for (var t2 = e2.split("/"), r2 = [], n2 = 0; n2 < t2.length; n2++) {
var i2 = t2[n2];
"." === i2 || "" === i2 && 0 !== n2 && n2 !== t2.length - 1 || (".." === i2 ? r2.pop() : r2.push(i2));
}
return r2.join("/");
}, a.getTypeOf = function(e2) {
return "string" == typeof e2 ? "string" : "[object Array]" === Object.prototype.toString.call(e2) ? "array" : o.nodebuffer && r.isBuffer(e2) ? "nodebuffer" : o.uint8array && e2 instanceof Uint8Array ? "uint8array" : o.arraybuffer && e2 instanceof ArrayBuffer ? "arraybuffer" : void 0;
}, a.checkSupport = function(e2) {
if (!o[e2.toLowerCase()])
throw new Error(e2 + " is not supported by this platform");
}, a.MAX_VALUE_16BITS = 65535, a.MAX_VALUE_32BITS = -1, a.pretty = function(e2) {
var t2, r2, n2 = "";
for (r2 = 0; r2 < (e2 || "").length; r2++)
n2 += "\\x" + ((t2 = e2.charCodeAt(r2)) < 16 ? "0" : "") + t2.toString(16).toUpperCase();
return n2;
}, a.delay = function(e2, t2, r2) {
setImmediate(function() {
e2.apply(r2 || null, t2 || []);
});
}, a.inherits = function(e2, t2) {
function r2() {
}
r2.prototype = t2.prototype, e2.prototype = new r2();
}, a.extend = function() {
var e2, t2, r2 = {};
for (e2 = 0; e2 < arguments.length; e2++)
for (t2 in arguments[e2])
Object.prototype.hasOwnProperty.call(arguments[e2], t2) && void 0 === r2[t2] && (r2[t2] = arguments[e2][t2]);
return r2;
}, a.prepareContent = function(r2, e2, n2, i2, s2) {
return u.Promise.resolve(e2).then(function(n3) {
return o.blob && (n3 instanceof Blob || -1 !== ["[object File]", "[object Blob]"].indexOf(Object.prototype.toString.call(n3))) && "undefined" != typeof FileReader ? new u.Promise(function(t2, r3) {
var e3 = new FileReader();
e3.onload = function(e4) {
t2(e4.target.result);
}, e3.onerror = function(e4) {
r3(e4.target.error);
}, e3.readAsArrayBuffer(n3);
}) : n3;
}).then(function(e3) {
var t2 = a.getTypeOf(e3);
return t2 ? ("arraybuffer" === t2 ? e3 = a.transformTo("uint8array", e3) : "string" === t2 && (s2 ? e3 = h.decode(e3) : n2 && true !== i2 && (e3 = function(e4) {
return l(e4, o.uint8array ? new Uint8Array(e4.length) : new Array(e4.length));
}(e3))), e3) : u.Promise.reject(new Error("Can't read the data of '" + r2 + "'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));
});
};
}, { "./base64": 1, "./external": 6, "./nodejsUtils": 14, "./support": 30, setimmediate: 54 }], 33: [function(e, t, r) {
"use strict";
var n = e("./reader/readerFor"), i = e("./utils"), s = e("./signature"), a = e("./zipEntry"), o = e("./support");
function h(e2) {
this.files = [], this.loadOptions = e2;
}
h.prototype = { checkSignature: function(e2) {
if (!this.reader.readAndCheckSignature(e2)) {
this.reader.index -= 4;
var t2 = this.reader.readString(4);
throw new Error("Corrupted zip or bug: unexpected signature (" + i.pretty(t2) + ", expected " + i.pretty(e2) + ")");
}
}, isSignature: function(e2, t2) {
var r2 = this.reader.index;
this.reader.setIndex(e2);
var n2 = this.reader.readString(4) === t2;
return this.reader.setIndex(r2), n2;
}, readBlockEndOfCentral: function() {
this.diskNumber = this.reader.readInt(2), this.diskWithCentralDirStart = this.reader.readInt(2), this.centralDirRecordsOnThisDisk = this.reader.readInt(2), this.centralDirRecords = this.reader.readInt(2), this.centralDirSize = this.reader.readInt(4), this.centralDirOffset = this.reader.readInt(4), this.zipCommentLength = this.reader.readInt(2);
var e2 = this.reader.readData(this.zipCommentLength), t2 = o.uint8array ? "uint8array" : "array", r2 = i.transformTo(t2, e2);
this.zipComment = this.loadOptions.decodeFileName(r2);
}, readBlockZip64EndOfCentral: function() {
this.zip64EndOfCentralSize = this.reader.readInt(8), this.reader.skip(4), this.diskNumber = this.reader.readInt(4), this.diskWithCentralDirStart = this.reader.readInt(4), this.centralDirRecordsOnThisDisk = this.reader.readInt(8), this.centralDirRecords = this.reader.readInt(8), this.centralDirSize = this.reader.readInt(8), this.centralDirOffset = this.reader.readInt(8), this.zip64ExtensibleData = {};
for (var e2, t2, r2, n2 = this.zip64EndOfCentralSize - 44; 0 < n2; )
e2 = this.reader.readInt(2), t2 = this.reader.readInt(4), r2 = this.reader.readData(t2), this.zip64ExtensibleData[e2] = { id: e2, length: t2, value: r2 };
}, readBlockZip64EndOfCentralLocator: function() {
if (this.diskWithZip64CentralDirStart = this.reader.readInt(4), this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8), this.disksCount = this.reader.readInt(4), 1 < this.disksCount)
throw new Error("Multi-volumes zip are not supported");
}, readLocalFiles: function() {
var e2, t2;
for (e2 = 0; e2 < this.files.length; e2++)
t2 = this.files[e2], this.reader.setIndex(t2.localHeaderOffset), this.checkSignature(s.LOCAL_FILE_HEADER), t2.readLocalPart(this.reader), t2.handleUTF8(), t2.processAttributes();
}, readCentralDir: function() {
var e2;
for (this.reader.setIndex(this.centralDirOffset); this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER); )
(e2 = new a({ zip64: this.zip64 }, this.loadOptions)).readCentralPart(this.reader), this.files.push(e2);
if (this.centralDirRecords !== this.files.length && 0 !== this.centralDirRecords && 0 === this.files.length)
throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length);
}, readEndOfCentral: function() {
var e2 = this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);
if (e2 < 0)
throw !this.isSignature(0, s.LOCAL_FILE_HEADER) ? new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html") : new Error("Corrupted zip: can't find end of central directory");
this.reader.setIndex(e2);
var t2 = e2;
if (this.checkSignature(s.CENTRAL_DIRECTORY_END), this.readBlockEndOfCentral(), this.diskNumber === i.MAX_VALUE_16BITS || this.diskWithCentralDirStart === i.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === i.MAX_VALUE_16BITS || this.centralDirRecords === i.MAX_VALUE_16BITS || this.centralDirSize === i.MAX_VALUE_32BITS || this.centralDirOffset === i.MAX_VALUE_32BITS) {
if (this.zip64 = true, (e2 = this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR)) < 0)
throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");
if (this.reader.setIndex(e2), this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR), this.readBlockZip64EndOfCentralLocator(), !this.isSignature(this.relativeOffsetEndOfZip64CentralDir, s.ZIP64_CENTRAL_DIRECTORY_END) && (this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END), this.relativeOffsetEndOfZip64CentralDir < 0))
throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");
this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir), this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END), this.readBlockZip64EndOfCentral();
}
var r2 = this.centralDirOffset + this.centralDirSize;
this.zip64 && (r2 += 20, r2 += 12 + this.zip64EndOfCentralSize);
var n2 = t2 - r2;
if (0 < n2)
this.isSignature(t2, s.CENTRAL_FILE_HEADER) || (this.reader.zero = n2);
else if (n2 < 0)
throw new Error("Corrupted zip: missing " + Math.abs(n2) + " bytes.");
}, prepareReader: function(e2) {
this.reader = n(e2);
}, load: function(e2) {
this.prepareReader(e2), this.readEndOfCentral(), this.readCentralDir(), this.readLocalFiles();
} }, t.exports = h;
}, { "./reader/readerFor": 22, "./signature": 23, "./support": 30, "./utils": 32, "./zipEntry": 34 }], 34: [function(e, t, r) {
"use strict";
var n = e("./reader/readerFor"), s = e("./utils"), i = e("./compressedObject"), a = e("./crc32"), o = e("./utf8"), h = e("./compressions"), u = e("./support");
function l(e2, t2) {
this.options = e2, this.loadOptions = t2;
}
l.prototype = { isEncrypted: function() {
return 1 == (1 & this.bitFlag);
}, useUTF8: function() {
return 2048 == (2048 & this.bitFlag);
}, readLocalPart: function(e2) {
var t2, r2;
if (e2.skip(22), this.fileNameLength = e2.readInt(2), r2 = e2.readInt(2), this.fileName = e2.readData(this.fileNameLength), e2.skip(r2), -1 === this.compressedSize || -1 === this.uncompressedSize)
throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");
if (null === (t2 = function(e3) {
for (var t3 in h)
if (Object.prototype.hasOwnProperty.call(h, t3) && h[t3].magic === e3)
return h[t3];
return null;
}(this.compressionMethod)))
throw new Error("Corrupted zip : compression " + s.pretty(this.compressionMethod) + " unknown (inner file : " + s.transformTo("string", this.fileName) + ")");
this.decompressed = new i(this.compressedSize, this.uncompressedSize, this.crc32, t2, e2.readData(this.compressedSize));
}, readCentralPart: function(e2) {
this.versionMadeBy = e2.readInt(2), e2.skip(2), this.bitFlag = e2.readInt(2), this.compressionMethod = e2.readString(2), this.date = e2.readDate(), this.crc32 = e2.readInt(4), this.compressedSize = e2.readInt(4), this.uncompressedSize = e2.readInt(4);
var t2 = e2.readInt(2);
if (this.extraFieldsLength = e2.readInt(2), this.fileCommentLength = e2.readInt(2), this.diskNumberStart = e2.readInt(2), this.internalFileAttributes = e2.readInt(2), this.externalFileAttributes = e2.readInt(4), this.localHeaderOffset = e2.readInt(4), this.isEncrypted())
throw new Error("Encrypted zip are not supported");
e2.skip(t2), this.readExtraFields(e2), this.parseZIP64ExtraField(e2), this.fileComment = e2.readData(this.fileCommentLength);
}, processAttributes: function() {
this.unixPermissions = null, this.dosPermissions = null;
var e2 = this.versionMadeBy >> 8;
this.dir = !!(16 & this.externalFileAttributes), 0 == e2 && (this.dosPermissions = 63 & this.externalFileAttributes), 3 == e2 && (this.unixPermissions = this.externalFileAttributes >> 16 & 65535), this.dir || "/" !== this.fileNameStr.slice(-1) || (this.dir = true);
}, parseZIP64ExtraField: function() {
if (this.extraFields[1]) {
var e2 = n(this.extraFields[1].value);
this.uncompressedSize === s.MAX_VALUE_32BITS && (this.uncompressedSize = e2.readInt(8)), this.compressedSize === s.MAX_VALUE_32BITS && (this.compressedSize = e2.readInt(8)), this.localHeaderOffset === s.MAX_VALUE_32BITS && (this.localHeaderOffset = e2.readInt(8)), this.diskNumberStart === s.MAX_VALUE_32BITS && (this.diskNumberStart = e2.readInt(4));
}
}, readExtraFields: function(e2) {
var t2, r2, n2, i2 = e2.index + this.extraFieldsLength;
for (this.extraFields || (this.extraFields = {}); e2.index + 4 < i2; )
t2 = e2.readInt(2), r2 = e2.readInt(2), n2 = e2.readData(r2), this.extraFields[t2] = { id: t2, length: r2, value: n2 };
e2.setIndex(i2);
}, handleUTF8: function() {
var e2 = u.uint8array ? "uint8array" : "array";
if (this.useUTF8())
this.fileNameStr = o.utf8decode(this.fileName), this.fileCommentStr = o.utf8decode(this.fileComment);
else {
var t2 = this.findExtraFieldUnicodePath();
if (null !== t2)
this.fileNameStr = t2;
else {
var r2 = s.transformTo(e2, this.fileName);
this.fileNameStr = this.loadOptions.decodeFileName(r2);
}
var n2 = this.findExtraFieldUnicodeComment();
if (null !== n2)
this.fileCommentStr = n2;
else {
var i2 = s.transformTo(e2, this.fileComment);
this.fileCommentStr = this.loadOptions.decodeFileName(i2);
}
}
}, findExtraFieldUnicodePath: function() {
var e2 = this.extraFields[28789];
if (e2) {
var t2 = n(e2.value);
return 1 !== t2.readInt(1) ? null : a(this.fileName) !== t2.readInt(4) ? null : o.utf8decode(t2.readData(e2.length - 5));
}
return null;
}, findExtraFieldUnicodeComment: function() {
var e2 = this.extraFields[25461];
if (e2) {
var t2 = n(e2.value);
return 1 !== t2.readInt(1) ? null : a(this.fileComment) !== t2.readInt(4) ? null : o.utf8decode(t2.readData(e2.length - 5));
}
return null;
} }, t.exports = l;
}, { "./compressedObject": 2, "./compressions": 3, "./crc32": 4, "./reader/readerFor": 22, "./support": 30, "./utf8": 31, "./utils": 32 }], 35: [function(e, t, r) {
"use strict";
function n(e2, t2, r2) {
this.name = e2, this.dir = r2.dir, this.date = r2.date, this.comment = r2.comment, this.unixPermissions = r2.unixPermissions, this.dosPermissions = r2.dosPermissions, this._data = t2, this._dataBinary = r2.binary, this.options = { compression: r2.compression, compressionOptions: r2.compressionOptions };
}
var s = e("./stream/StreamHelper"), i = e("./stream/DataWorker"), a = e("./utf8"), o = e("./compressedObject"), h = e("./stream/GenericWorker");
n.prototype = { internalStream: function(e2) {
var t2 = null, r2 = "string";
try {
if (!e2)
throw new Error("No output type specified.");
var n2 = "string" === (r2 = e2.toLowerCase()) || "text" === r2;
"binarystring" !== r2 && "text" !== r2 || (r2 = "string"), t2 = this._decompressWorker();
var i2 = !this._dataBinary;
i2 && !n2 && (t2 = t2.pipe(new a.Utf8EncodeWorker())), !i2 && n2 && (t2 = t2.pipe(new a.Utf8DecodeWorker()));
} catch (e3) {
(t2 = new h("error")).error(e3);
}
return new s(t2, r2, "");
}, async: function(e2, t2) {
return this.internalStream(e2).accumulate(t2);
}, nodeStream: function(e2, t2) {
return this.internalStream(e2 || "nodebuffer").toNodejsStream(t2);
}, _compressWorker: function(e2, t2) {
if (this._data instanceof o && this._data.compression.magic === e2.magic)
return this._data.getCompressedWorker();
var r2 = this._decompressWorker();
return this._dataBinary || (r2 = r2.pipe(new a.Utf8EncodeWorker())), o.createWorkerFrom(r2, e2, t2);
}, _decompressWorker: function() {
return this._data instanceof o ? this._data.getContentWorker() : this._data instanceof h ? this._data : new i(this._data);
} };
for (var u = ["asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer"], l = function() {
throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
}, f = 0; f < u.length; f++)
n.prototype[u[f]] = l;
t.exports = n;
}, { "./compressedObject": 2, "./stream/DataWorker": 27, "./stream/GenericWorker": 28, "./stream/StreamHelper": 29, "./utf8": 31 }], 36: [function(e, l, t) {
(function(t2) {
"use strict";
var r, n, e2 = t2.MutationObserver || t2.WebKitMutationObserver;
if (e2) {
var i = 0, s = new e2(u), a = t2.document.createTextNode("");
s.observe(a, { characterData: true }), r = function() {
a.data = i = ++i % 2;
};
} else if (t2.setImmediate || void 0 === t2.MessageChannel)
r = "document" in t2 && "onreadystatechange" in t2.document.createElement("script") ? function() {
var e3 = t2.document.createElement("script");
e3.onreadystatechange = function() {
u(), e3.onreadystatechange = null, e3.parentNode.removeChild(e3), e3 = null;
}, t2.document.documentElement.appendChild(e3);
} : function() {
setTimeout(u, 0);
};
else {
var o = new t2.MessageChannel();
o.port1.onmessage = u, r = function() {
o.port2.postMessage(0);
};
}
var h = [];
function u() {
var e3, t3;
n = true;
for (var r2 = h.length; r2; ) {
for (t3 = h, h = [], e3 = -1; ++e3 < r2; )
t3[e3]();
r2 = h.length;
}
n = false;
}
l.exports = function(e3) {
1 !== h.push(e3) || n || r();
};
}).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
}, {}], 37: [function(e, t, r) {
"use strict";
var i = e("immediate");
function u() {
}
var l = {}, s = ["REJECTED"], a = ["FULFILLED"], n = ["PENDING"];
function o(e2) {
if ("function" != typeof e2)
throw new TypeError("resolver must be a function");
this.state = n, this.queue = [], this.outcome = void 0, e2 !== u && d(this, e2);
}
function h(e2, t2, r2) {
this.promise = e2, "function" == typeof t2 && (this.onFulfilled = t2, this.callFulfilled = this.otherCallFulfilled), "function" == typeof r2 && (this.onRejected = r2, this.callRejected = this.otherCallRejected);
}
function f(t2, r2, n2) {
i(function() {
var e2;
try {
e2 = r2(n2);
} catch (e3) {
return l.reject(t2, e3);
}
e2 === t2 ? l.reject(t2, new TypeError("Cannot resolve promise with itself")) : l.resolve(t2, e2);
});
}
function c(e2) {
var t2 = e2 && e2.then;
if (e2 && ("object" == typeof e2 || "function" == typeof e2) && "function" == typeof t2)
return function() {
t2.apply(e2, arguments);
};
}
function d(t2, e2) {
var r2 = false;
function n2(e3) {
r2 || (r2 = true, l.reject(t2, e3));
}
function i2(e3) {
r2 || (r2 = true, l.resolve(t2, e3));
}
var s2 = p(function() {
e2(i2, n2);
});
"error" === s2.status && n2(s2.value);
}
function p(e2, t2) {
var r2 = {};
try {
r2.value = e2(t2), r2.status = "success";
} catch (e3) {
r2.status = "error", r2.value = e3;
}
return r2;
}
(t.exports = o).prototype.finally = function(t2) {
if ("function" != typeof t2)
return this;
var r2 = this.constructor;
return this.then(function(e2) {
return r2.resolve(t2()).then(function() {
return e2;
});
}, function(e2) {
return r2.resolve(t2()).then(function() {
throw e2;
});
});
}, o.prototype.catch = function(e2) {
return this.then(null, e2);
}, o.prototype.then = function(e2, t2) {
if ("function" != typeof e2 && this.state === a || "function" != typeof t2 && this.state === s)
return this;
var r2 = new this.constructor(u);
this.state !== n ? f(r2, this.state === a ? e2 : t2, this.outcome) : this.queue.push(new h(r2, e2, t2));
return r2;
}, h.prototype.callFulfilled = function(e2) {
l.resolve(this.promise, e2);
}, h.prototype.otherCallFulfilled = function(e2) {
f(this.promise, this.onFulfilled, e2);
}, h.prototype.callRejected = function(e2) {
l.reject(this.promise, e2);
}, h.prototype.otherCallRejected = function(e2) {
f(this.promise, this.onRejected, e2);
}, l.resolve = function(e2, t2) {
var r2 = p(c, t2);
if ("error" === r2.status)
return l.reject(e2, r2.value);
var n2 = r2.value;
if (n2)
d(e2, n2);
else {
e2.state = a, e2.outcome = t2;
for (var i2 = -1, s2 = e2.queue.length; ++i2 < s2; )
e2.queue[i2].callFulfilled(t2);
}
return e2;
}, l.reject = function(e2, t2) {
e2.state = s, e2.outcome = t2;
for (var r2 = -1, n2 = e2.queue.length; ++r2 < n2; )
e2.queue[r2].callRejected(t2);
return e2;
}, o.resolve = function(e2) {
if (e2 instanceof this)
return e2;
return l.resolve(new this(u), e2);
}, o.reject = function(e2) {
var t2 = new this(u);
return l.reject(t2, e2);
}, o.all = function(e2) {
var r2 = this;
if ("[object Array]" !== Object.prototype.toString.call(e2))
return this.reject(new TypeError("must be an array"));
var n2 = e2.length, i2 = false;
if (!n2)
return this.resolve([]);
var s2 = new Array(n2), a2 = 0, t2 = -1, o2 = new this(u);
for (; ++t2 < n2; )
h2(e2[t2], t2);
return o2;
function h2(e3, t3) {
r2.resolve(e3).then(function(e4) {
s2[t3] = e4, ++a2 !== n2 || i2 || (i2 = true, l.resolve(o2, s2));
}, function(e4) {
i2 || (i2 = true, l.reject(o2, e4));
});
}
}, o.race = function(e2) {
var t2 = this;
if ("[object Array]" !== Object.prototype.toString.call(e2))
return this.reject(new TypeError("must be an array"));
var r2 = e2.length, n2 = false;
if (!r2)
return this.resolve([]);
var i2 = -1, s2 = new this(u);
for (; ++i2 < r2; )
a2 = e2[i2], t2.resolve(a2).then(function(e3) {
n2 || (n2 = true, l.resolve(s2, e3));
}, function(e3) {
n2 || (n2 = true, l.reject(s2, e3));
});
var a2;
return s2;
};
}, { immediate: 36 }], 38: [function(e, t, r) {
"use strict";
var n = {};
(0, e("./lib/utils/common").assign)(n, e("./lib/deflate"), e("./lib/inflate"), e("./lib/zlib/constants")), t.exports = n;
}, { "./lib/deflate": 39, "./lib/inflate": 40, "./lib/utils/common": 41, "./lib/zlib/constants": 44 }], 39: [function(e, t, r) {
"use strict";
var a = e("./zlib/deflate"), o = e("./utils/common"), h = e("./utils/strings"), i = e("./zlib/messages"), s = e("./zlib/zstream"), u = Object.prototype.toString, l = 0, f = -1, c = 0, d = 8;
function p(e2) {
if (!(this instanceof p))
return new p(e2);
this.options = o.assign({ level: f, method: d, chunkSize: 16384, windowBits: 15, memLevel: 8, strategy: c, to: "" }, e2 || {});
var t2 = this.options;
t2.raw && 0 < t2.windowBits ? t2.windowBits = -t2.windowBits : t2.gzip && 0 < t2.windowBits && t2.windowBits < 16 && (t2.windowBits += 16), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new s(), this.strm.avail_out = 0;
var r2 = a.deflateInit2(this.strm, t2.level, t2.method, t2.windowBits, t2.memLevel, t2.strategy);
if (r2 !== l)
throw new Error(i[r2]);
if (t2.header && a.deflateSetHeader(this.strm, t2.header), t2.dictionary) {
var n2;
if (n2 = "string" == typeof t2.dictionary ? h.string2buf(t2.dictionary) : "[object ArrayBuffer]" === u.call(t2.dictionary) ? new Uint8Array(t2.dictionary) : t2.dictionary, (r2 = a.deflateSetDictionary(this.strm, n2)) !== l)
throw new Error(i[r2]);
this._dict_set = true;
}
}
function n(e2, t2) {
var r2 = new p(t2);
if (r2.push(e2, true), r2.err)
throw r2.msg || i[r2.err];
return r2.result;
}
p.prototype.push = function(e2, t2) {
var r2, n2, i2 = this.strm, s2 = this.options.chunkSize;
if (this.ended)
return false;
n2 = t2 === ~~t2 ? t2 : true === t2 ? 4 : 0, "string" == typeof e2 ? i2.input = h.string2buf(e2) : "[object ArrayBuffer]" === u.call(e2) ? i2.input = new Uint8Array(e2) : i2.input = e2, i2.next_in = 0, i2.avail_in = i2.input.length;
do {
if (0 === i2.avail_out && (i2.output = new o.Buf8(s2), i2.next_out = 0, i2.avail_out = s2), 1 !== (r2 = a.deflate(i2, n2)) && r2 !== l)
return this.onEnd(r2), !(this.ended = true);
0 !== i2.avail_out && (0 !== i2.avail_in || 4 !== n2 && 2 !== n2) || ("string" === this.options.to ? this.onData(h.buf2binstring(o.shrinkBuf(i2.output, i2.next_out))) : this.onData(o.shrinkBuf(i2.output, i2.next_out)));
} while ((0 < i2.avail_in || 0 === i2.avail_out) && 1 !== r2);
return 4 === n2 ? (r2 = a.deflateEnd(this.strm), this.onEnd(r2), this.ended = true, r2 === l) : 2 !== n2 || (this.onEnd(l), !(i2.avail_out = 0));
}, p.prototype.onData = function(e2) {
this.chunks.push(e2);
}, p.prototype.onEnd = function(e2) {
e2 === l && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = o.flattenChunks(this.chunks)), this.chunks = [], this.err = e2, this.msg = this.strm.msg;
}, r.Deflate = p, r.deflate = n, r.deflateRaw = function(e2, t2) {
return (t2 = t2 || {}).raw = true, n(e2, t2);
}, r.gzip = function(e2, t2) {
return (t2 = t2 || {}).gzip = true, n(e2, t2);
};
}, { "./utils/common": 41, "./utils/strings": 42, "./zlib/deflate": 46, "./zlib/messages": 51, "./zlib/zstream": 53 }], 40: [function(e, t, r) {
"use strict";
var c = e("./zlib/inflate"), d = e("./utils/common"), p = e("./utils/strings"), m = e("./zlib/constants"), n = e("./zlib/messages"), i = e("./zlib/zstream"), s = e("./zlib/gzheader"), _ = Object.prototype.toString;
function a(e2) {
if (!(this instanceof a))
return new a(e2);
this.options = d.assign({ chunkSize: 16384, windowBits: 0, to: "" }, e2 || {});
var t2 = this.options;
t2.raw && 0 <= t2.windowBits && t2.windowBits < 16 && (t2.windowBits = -t2.windowBits, 0 === t2.windowBits && (t2.windowBits = -15)), !(0 <= t2.windowBits && t2.windowBits < 16) || e2 && e2.windowBits || (t2.windowBits += 32), 15 < t2.windowBits && t2.windowBits < 48 && 0 == (15 & t2.windowBits) && (t2.windowBits |= 15), this.err = 0, this.msg = "", this.ended = false, this.chunks = [], this.strm = new i(), this.strm.avail_out = 0;
var r2 = c.inflateInit2(this.strm, t2.windowBits);
if (r2 !== m.Z_OK)
throw new Error(n[r2]);
this.header = new s(), c.inflateGetHeader(this.strm, this.header);
}
function o(e2, t2) {
var r2 = new a(t2);
if (r2.push(e2, true), r2.err)
throw r2.msg || n[r2.err];
return r2.result;
}
a.prototype.push = function(e2, t2) {
var r2, n2, i2, s2, a2, o2, h = this.strm, u = this.options.chunkSize, l = this.options.dictionary, f = false;
if (this.ended)
return false;
n2 = t2 === ~~t2 ? t2 : true === t2 ? m.Z_FINISH : m.Z_NO_FLUSH, "string" == typeof e2 ? h.input = p.binstring2buf(e2) : "[object ArrayBuffer]" === _.call(e2) ? h.input = new Uint8Array(e2) : h.input = e2, h.next_in = 0, h.avail_in = h.input.length;
do {
if (0 === h.avail_out && (h.output = new d.Buf8(u), h.next_out = 0, h.avail_out = u), (r2 = c.inflate(h, m.Z_NO_FLUSH)) === m.Z_NEED_DICT && l && (o2 = "string" == typeof l ? p.string2buf(l) : "[object ArrayBuffer]" === _.call(l) ? new Uint8Array(l) : l, r2 = c.inflateSetDictionary(this.strm, o2)), r2 === m.Z_BUF_ERROR && true === f && (r2 = m.Z_OK, f = false), r2 !== m.Z_STREAM_END && r2 !== m.Z_OK)
return this.onEnd(r2), !(this.ended = true);
h.next_out && (0 !== h.avail_out && r2 !== m.Z_STREAM_END && (0 !== h.avail_in || n2 !== m.Z_FINISH && n2 !== m.Z_SYNC_FLUSH) || ("string" === this.options.to ? (i2 = p.utf8border(h.output, h.next_out), s2 = h.next_out - i2, a2 = p.buf2string(h.output, i2), h.next_out = s2, h.avail_out = u - s2, s2 && d.arraySet(h.output, h.output, i2, s2, 0), this.onData(a2)) : this.onData(d.shrinkBuf(h.output, h.next_out)))), 0 === h.avail_in && 0 === h.avail_out && (f = true);
} while ((0 < h.avail_in || 0 === h.avail_out) && r2 !== m.Z_STREAM_END);
return r2 === m.Z_STREAM_END && (n2 = m.Z_FINISH), n2 === m.Z_FINISH ? (r2 = c.inflateEnd(this.strm), this.onEnd(r2), this.ended = true, r2 === m.Z_OK) : n2 !== m.Z_SYNC_FLUSH || (this.onEnd(m.Z_OK), !(h.avail_out = 0));
}, a.prototype.onData = function(e2) {
this.chunks.push(e2);
}, a.prototype.onEnd = function(e2) {
e2 === m.Z_OK && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = d.flattenChunks(this.chunks)), this.chunks = [], this.err = e2, this.msg = this.strm.msg;
}, r.Inflate = a, r.inflate = o, r.inflateRaw = function(e2, t2) {
return (t2 = t2 || {}).raw = true, o(e2, t2);
}, r.ungzip = o;
}, { "./utils/common": 41, "./utils/strings": 42, "./zlib/constants": 44, "./zlib/gzheader": 47, "./zlib/inflate": 49, "./zlib/messages": 51, "./zlib/zstream": 53 }], 41: [function(e, t, r) {
"use strict";
var n = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Int32Array;
r.assign = function(e2) {
for (var t2 = Array.prototype.slice.call(arguments, 1); t2.length; ) {
var r2 = t2.shift();
if (r2) {
if ("object" != typeof r2)
throw new TypeError(r2 + "must be non-object");
for (var n2 in r2)
r2.hasOwnProperty(n2) && (e2[n2] = r2[n2]);
}
}
return e2;
}, r.shrinkBuf = function(e2, t2) {
return e2.length === t2 ? e2 : e2.subarray ? e2.subarray(0, t2) : (e2.length = t2, e2);
};
var i = { arraySet: function(e2, t2, r2, n2, i2) {
if (t2.subarray && e2.subarray)
e2.set(t2.subarray(r2, r2 + n2), i2);
else
for (var s2 = 0; s2 < n2; s2++)
e2[i2 + s2] = t2[r2 + s2];
}, flattenChunks: function(e2) {
var t2, r2, n2, i2, s2, a;
for (t2 = n2 = 0, r2 = e2.length; t2 < r2; t2++)
n2 += e2[t2].length;
for (a = new Uint8Array(n2), t2 = i2 = 0, r2 = e2.length; t2 < r2; t2++)
s2 = e2[t2], a.set(s2, i2), i2 += s2.length;
return a;
} }, s = { arraySet: function(e2, t2, r2, n2, i2) {
for (var s2 = 0; s2 < n2; s2++)
e2[i2 + s2] = t2[r2 + s2];
}, flattenChunks: function(e2) {
return [].concat.apply([], e2);
} };
r.setTyped = function(e2) {
e2 ? (r.Buf8 = Uint8Array, r.Buf16 = Uint16Array, r.Buf32 = Int32Array, r.assign(r, i)) : (r.Buf8 = Array, r.Buf16 = Array, r.Buf32 = Array, r.assign(r, s));
}, r.setTyped(n);
}, {}], 42: [function(e, t, r) {
"use strict";
var h = e("./common"), i = true, s = true;
try {
String.fromCharCode.apply(null, [0]);
} catch (e2) {
i = false;
}
try {
String.fromCharCode.apply(null, new Uint8Array(1));
} catch (e2) {
s = false;
}
for (var u = new h.Buf8(256), n = 0; n < 256; n++)
u[n] = 252 <= n ? 6 : 248 <= n ? 5 : 240 <= n ? 4 : 224 <= n ? 3 : 192 <= n ? 2 : 1;
function l(e2, t2) {
if (t2 < 65537 && (e2.subarray && s || !e2.subarray && i))
return String.fromCharCode.apply(null, h.shrinkBuf(e2, t2));
for (var r2 = "", n2 = 0; n2 < t2; n2++)
r2 += String.fromCharCode(e2[n2]);
return r2;
}
u[254] = u[254] = 1, r.string2buf = function(e2) {
var t2, r2, n2, i2, s2, a = e2.length, o = 0;
for (i2 = 0; i2 < a; i2++)
55296 == (64512 & (r2 = e2.charCodeAt(i2))) && i2 + 1 < a && 56320 == (64512 & (n2 = e2.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), o += r2 < 128 ? 1 : r2 < 2048 ? 2 : r2 < 65536 ? 3 : 4;
for (t2 = new h.Buf8(o), i2 = s2 = 0; s2 < o; i2++)
55296 == (64512 & (r2 = e2.charCodeAt(i2))) && i2 + 1 < a && 56320 == (64512 & (n2 = e2.charCodeAt(i2 + 1))) && (r2 = 65536 + (r2 - 55296 << 10) + (n2 - 56320), i2++), r2 < 128 ? t2[s2++] = r2 : (r2 < 2048 ? t2[s2++] = 192 | r2 >>> 6 : (r2 < 65536 ? t2[s2++] = 224 | r2 >>> 12 : (t2[s2++] = 240 | r2 >>> 18, t2[s2++] = 128 | r2 >>> 12 & 63), t2[s2++] = 128 | r2 >>> 6 & 63), t2[s2++] = 128 | 63 & r2);
return t2;
}, r.buf2binstring = function(e2) {
return l(e2, e2.length);
}, r.binstring2buf = function(e2) {
for (var t2 = new h.Buf8(e2.length), r2 = 0, n2 = t2.length; r2 < n2; r2++)
t2[r2] = e2.charCodeAt(r2);
return t2;
}, r.buf2string = function(e2, t2) {
var r2, n2, i2, s2, a = t2 || e2.length, o = new Array(2 * a);
for (r2 = n2 = 0; r2 < a; )
if ((i2 = e2[r2++]) < 128)
o[n2++] = i2;
else if (4 < (s2 = u[i2]))
o[n2++] = 65533, r2 += s2 - 1;
else {
for (i2 &= 2 === s2 ? 31 : 3 === s2 ? 15 : 7; 1 < s2 && r2 < a; )
i2 = i2 << 6 | 63 & e2[r2++], s2--;
1 < s2 ? o[n2++] = 65533 : i2 < 65536 ? o[n2++] = i2 : (i2 -= 65536, o[n2++] = 55296 | i2 >> 10 & 1023, o[n2++] = 56320 | 1023 & i2);
}
return l(o, n2);
}, r.utf8border = function(e2, t2) {
var r2;
for ((t2 = t2 || e2.length) > e2.length && (t2 = e2.length), r2 = t2 - 1; 0 <= r2 && 128 == (192 & e2[r2]); )
r2--;
return r2 < 0 ? t2 : 0 === r2 ? t2 : r2 + u[e2[r2]] > t2 ? r2 : t2;
};
}, { "./common": 41 }], 43: [function(e, t, r) {
"use strict";
t.exports = function(e2, t2, r2, n) {
for (var i = 65535 & e2 | 0, s = e2 >>> 16 & 65535 | 0, a = 0; 0 !== r2; ) {
for (r2 -= a = 2e3 < r2 ? 2e3 : r2; s = s + (i = i + t2[n++] | 0) | 0, --a; )
;
i %= 65521, s %= 65521;
}
return i | s << 16 | 0;
};
}, {}], 44: [function(e, t, r) {
"use strict";
t.exports = { Z_NO_FLUSH: 0, Z_PARTIAL_FLUSH: 1, Z_SYNC_FLUSH: 2, Z_FULL_FLUSH: 3, Z_FINISH: 4, Z_BLOCK: 5, Z_TREES: 6, Z_OK: 0, Z_STREAM_END: 1, Z_NEED_DICT: 2, Z_ERRNO: -1, Z_STREAM_ERROR: -2, Z_DATA_ERROR: -3, Z_BUF_ERROR: -5, Z_NO_COMPRESSION: 0, Z_BEST_SPEED: 1, Z_BEST_COMPRESSION: 9, Z_DEFAULT_COMPRESSION: -1, Z_FILTERED: 1, Z_HUFFMAN_ONLY: 2, Z_RLE: 3, Z_FIXED: 4, Z_DEFAULT_STRATEGY: 0, Z_BINARY: 0, Z_TEXT: 1, Z_UNKNOWN: 2, Z_DEFLATED: 8 };
}, {}], 45: [function(e, t, r) {
"use strict";
var o = function() {
for (var e2, t2 = [], r2 = 0; r2 < 256; r2++) {
e2 = r2;
for (var n = 0; n < 8; n++)
e2 = 1 & e2 ? 3988292384 ^ e2 >>> 1 : e2 >>> 1;
t2[r2] = e2;
}
return t2;
}();
t.exports = function(e2, t2, r2, n) {
var i = o, s = n + r2;
e2 ^= -1;
for (var a = n; a < s; a++)
e2 = e2 >>> 8 ^ i[255 & (e2 ^ t2[a])];
return -1 ^ e2;
};
}, {}], 46: [function(e, t, r) {
"use strict";
var h, c = e("../utils/common"), u = e("./trees"), d = e("./adler32"), p = e("./crc32"), n = e("./messages"), l = 0, f = 4, m = 0, _ = -2, g = -1, b = 4, i = 2, v = 8, y = 9, s = 286, a = 30, o = 19, w = 2 * s + 1, k = 15, x = 3, S = 258, z = S + x + 1, C = 42, E = 113, A = 1, I = 2, O = 3, B = 4;
function R(e2, t2) {
return e2.msg = n[t2], t2;
}
function T(e2) {
return (e2 << 1) - (4 < e2 ? 9 : 0);
}
function D(e2) {
for (var t2 = e2.length; 0 <= --t2; )
e2[t2] = 0;
}
function F(e2) {
var t2 = e2.state, r2 = t2.pending;
r2 > e2.avail_out && (r2 = e2.avail_out), 0 !== r2 && (c.arraySet(e2.output, t2.pending_buf, t2.pending_out, r2, e2.next_out), e2.next_out += r2, t2.pending_out += r2, e2.total_out += r2, e2.avail_out -= r2, t2.pending -= r2, 0 === t2.pending && (t2.pending_out = 0));
}
function N(e2, t2) {
u._tr_flush_block(e2, 0 <= e2.block_start ? e2.block_start : -1, e2.strstart - e2.block_start, t2), e2.block_start = e2.strstart, F(e2.strm);
}
function U(e2, t2) {
e2.pending_buf[e2.pending++] = t2;
}
function P(e2, t2) {
e2.pending_buf[e2.pending++] = t2 >>> 8 & 255, e2.pending_buf[e2.pending++] = 255 & t2;
}
function L(e2, t2) {
var r2, n2, i2 = e2.max_chain_length, s2 = e2.strstart, a2 = e2.prev_length, o2 = e2.nice_match, h2 = e2.strstart > e2.w_size - z ? e2.strstart - (e2.w_size - z) : 0, u2 = e2.window, l2 = e2.w_mask, f2 = e2.prev, c2 = e2.strstart + S, d2 = u2[s2 + a2 - 1], p2 = u2[s2 + a2];
e2.prev_length >= e2.good_match && (i2 >>= 2), o2 > e2.lookahead && (o2 = e2.lookahead);
do {
if (u2[(r2 = t2) + a2] === p2 && u2[r2 + a2 - 1] === d2 && u2[r2] === u2[s2] && u2[++r2] === u2[s2 + 1]) {
s2 += 2, r2++;
do {
} while (u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && u2[++s2] === u2[++r2] && s2 < c2);
if (n2 = S - (c2 - s2), s2 = c2 - S, a2 < n2) {
if (e2.match_start = t2, o2 <= (a2 = n2))
break;
d2 = u2[s2 + a2 - 1], p2 = u2[s2 + a2];
}
}
} while ((t2 = f2[t2 & l2]) > h2 && 0 != --i2);
return a2 <= e2.lookahead ? a2 : e2.lookahead;
}
function j(e2) {
var t2, r2, n2, i2, s2, a2, o2, h2, u2, l2, f2 = e2.w_size;
do {
if (i2 = e2.window_size - e2.lookahead - e2.strstart, e2.strstart >= f2 + (f2 - z)) {
for (c.arraySet(e2.window, e2.window, f2, f2, 0), e2.match_start -= f2, e2.strstart -= f2, e2.block_start -= f2, t2 = r2 = e2.hash_size; n2 = e2.head[--t2], e2.head[t2] = f2 <= n2 ? n2 - f2 : 0, --r2; )
;
for (t2 = r2 = f2; n2 = e2.prev[--t2], e2.prev[t2] = f2 <= n2 ? n2 - f2 : 0, --r2; )
;
i2 += f2;
}
if (0 === e2.strm.avail_in)
break;
if (a2 = e2.strm, o2 = e2.window, h2 = e2.strstart + e2.lookahead, u2 = i2, l2 = void 0, l2 = a2.avail_in, u2 < l2 && (l2 = u2), r2 = 0 === l2 ? 0 : (a2.avail_in -= l2, c.arraySet(o2, a2.input, a2.next_in, l2, h2), 1 === a2.state.wrap ? a2.adler = d(a2.adler, o2, l2, h2) : 2 === a2.state.wrap && (a2.adler = p(a2.adler, o2, l2, h2)), a2.next_in += l2, a2.total_in += l2, l2), e2.lookahead += r2, e2.lookahead + e2.insert >= x)
for (s2 = e2.strstart - e2.insert, e2.ins_h = e2.window[s2], e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[s2 + 1]) & e2.hash_mask; e2.insert && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[s2 + x - 1]) & e2.hash_mask, e2.prev[s2 & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = s2, s2++, e2.insert--, !(e2.lookahead + e2.insert < x)); )
;
} while (e2.lookahead < z && 0 !== e2.strm.avail_in);
}
function Z(e2, t2) {
for (var r2, n2; ; ) {
if (e2.lookahead < z) {
if (j(e2), e2.lookahead < z && t2 === l)
return A;
if (0 === e2.lookahead)
break;
}
if (r2 = 0, e2.lookahead >= x && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), 0 !== r2 && e2.strstart - r2 <= e2.w_size - z && (e2.match_length = L(e2, r2)), e2.match_length >= x)
if (n2 = u._tr_tally(e2, e2.strstart - e2.match_start, e2.match_length - x), e2.lookahead -= e2.match_length, e2.match_length <= e2.max_lazy_match && e2.lookahead >= x) {
for (e2.match_length--; e2.strstart++, e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart, 0 != --e2.match_length; )
;
e2.strstart++;
} else
e2.strstart += e2.match_length, e2.match_length = 0, e2.ins_h = e2.window[e2.strstart], e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + 1]) & e2.hash_mask;
else
n2 = u._tr_tally(e2, 0, e2.window[e2.strstart]), e2.lookahead--, e2.strstart++;
if (n2 && (N(e2, false), 0 === e2.strm.avail_out))
return A;
}
return e2.insert = e2.strstart < x - 1 ? e2.strstart : x - 1, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : e2.last_lit && (N(e2, false), 0 === e2.strm.avail_out) ? A : I;
}
function W(e2, t2) {
for (var r2, n2, i2; ; ) {
if (e2.lookahead < z) {
if (j(e2), e2.lookahead < z && t2 === l)
return A;
if (0 === e2.lookahead)
break;
}
if (r2 = 0, e2.lookahead >= x && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), e2.prev_length = e2.match_length, e2.prev_match = e2.match_start, e2.match_length = x - 1, 0 !== r2 && e2.prev_length < e2.max_lazy_match && e2.strstart - r2 <= e2.w_size - z && (e2.match_length = L(e2, r2), e2.match_length <= 5 && (1 === e2.strategy || e2.match_length === x && 4096 < e2.strstart - e2.match_start) && (e2.match_length = x - 1)), e2.prev_length >= x && e2.match_length <= e2.prev_length) {
for (i2 = e2.strstart + e2.lookahead - x, n2 = u._tr_tally(e2, e2.strstart - 1 - e2.prev_match, e2.prev_length - x), e2.lookahead -= e2.prev_length - 1, e2.prev_length -= 2; ++e2.strstart <= i2 && (e2.ins_h = (e2.ins_h << e2.hash_shift ^ e2.window[e2.strstart + x - 1]) & e2.hash_mask, r2 = e2.prev[e2.strstart & e2.w_mask] = e2.head[e2.ins_h], e2.head[e2.ins_h] = e2.strstart), 0 != --e2.prev_length; )
;
if (e2.match_available = 0, e2.match_length = x - 1, e2.strstart++, n2 && (N(e2, false), 0 === e2.strm.avail_out))
return A;
} else if (e2.match_available) {
if ((n2 = u._tr_tally(e2, 0, e2.window[e2.strstart - 1])) && N(e2, false), e2.strstart++, e2.lookahead--, 0 === e2.strm.avail_out)
return A;
} else
e2.match_available = 1, e2.strstart++, e2.lookahead--;
}
return e2.match_available && (n2 = u._tr_tally(e2, 0, e2.window[e2.strstart - 1]), e2.match_available = 0), e2.insert = e2.strstart < x - 1 ? e2.strstart : x - 1, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : e2.last_lit && (N(e2, false), 0 === e2.strm.avail_out) ? A : I;
}
function M(e2, t2, r2, n2, i2) {
this.good_length = e2, this.max_lazy = t2, this.nice_length = r2, this.max_chain = n2, this.func = i2;
}
function H() {
this.strm = null, this.status = 0, this.pending_buf = null, this.pending_buf_size = 0, this.pending_out = 0, this.pending = 0, this.wrap = 0, this.gzhead = null, this.gzindex = 0, this.method = v, this.last_flush = -1, this.w_size = 0, this.w_bits = 0, this.w_mask = 0, this.window = null, this.window_size = 0, this.prev = null, this.head = null, this.ins_h = 0, this.hash_size = 0, this.hash_bits = 0, this.hash_mask = 0, this.hash_shift = 0, this.block_start = 0, this.match_length = 0, this.prev_match = 0, this.match_available = 0, this.strstart = 0, this.match_start = 0, this.lookahead = 0, this.prev_length = 0, this.max_chain_length = 0, this.max_lazy_match = 0, this.level = 0, this.strategy = 0, this.good_match = 0, this.nice_match = 0, this.dyn_ltree = new c.Buf16(2 * w), this.dyn_dtree = new c.Buf16(2 * (2 * a + 1)), this.bl_tree = new c.Buf16(2 * (2 * o + 1)), D(this.dyn_ltree), D(this.dyn_dtree), D(this.bl_tree), this.l_desc = null, this.d_desc = null, this.bl_desc = null, this.bl_count = new c.Buf16(k + 1), this.heap = new c.Buf16(2 * s + 1), D(this.heap), this.heap_len = 0, this.heap_max = 0, this.depth = new c.Buf16(2 * s + 1), D(this.depth), this.l_buf = 0, this.lit_bufsize = 0, this.last_lit = 0, this.d_buf = 0, this.opt_len = 0, this.static_len = 0, this.matches = 0, this.insert = 0, this.bi_buf = 0, this.bi_valid = 0;
}
function G(e2) {
var t2;
return e2 && e2.state ? (e2.total_in = e2.total_out = 0, e2.data_type = i, (t2 = e2.state).pending = 0, t2.pending_out = 0, t2.wrap < 0 && (t2.wrap = -t2.wrap), t2.status = t2.wrap ? C : E, e2.adler = 2 === t2.wrap ? 0 : 1, t2.last_flush = l, u._tr_init(t2), m) : R(e2, _);
}
function K(e2) {
var t2 = G(e2);
return t2 === m && function(e3) {
e3.window_size = 2 * e3.w_size, D(e3.head), e3.max_lazy_match = h[e3.level].max_lazy, e3.good_match = h[e3.level].good_length, e3.nice_match = h[e3.level].nice_length, e3.max_chain_length = h[e3.level].max_chain, e3.strstart = 0, e3.block_start = 0, e3.lookahead = 0, e3.insert = 0, e3.match_length = e3.prev_length = x - 1, e3.match_available = 0, e3.ins_h = 0;
}(e2.state), t2;
}
function Y(e2, t2, r2, n2, i2, s2) {
if (!e2)
return _;
var a2 = 1;
if (t2 === g && (t2 = 6), n2 < 0 ? (a2 = 0, n2 = -n2) : 15 < n2 && (a2 = 2, n2 -= 16), i2 < 1 || y < i2 || r2 !== v || n2 < 8 || 15 < n2 || t2 < 0 || 9 < t2 || s2 < 0 || b < s2)
return R(e2, _);
8 === n2 && (n2 = 9);
var o2 = new H();
return (e2.state = o2).strm = e2, o2.wrap = a2, o2.gzhead = null, o2.w_bits = n2, o2.w_size = 1 << o2.w_bits, o2.w_mask = o2.w_size - 1, o2.hash_bits = i2 + 7, o2.hash_size = 1 << o2.hash_bits, o2.hash_mask = o2.hash_size - 1, o2.hash_shift = ~~((o2.hash_bits + x - 1) / x), o2.window = new c.Buf8(2 * o2.w_size), o2.head = new c.Buf16(o2.hash_size), o2.prev = new c.Buf16(o2.w_size), o2.lit_bufsize = 1 << i2 + 6, o2.pending_buf_size = 4 * o2.lit_bufsize, o2.pending_buf = new c.Buf8(o2.pending_buf_size), o2.d_buf = 1 * o2.lit_bufsize, o2.l_buf = 3 * o2.lit_bufsize, o2.level = t2, o2.strategy = s2, o2.method = r2, K(e2);
}
h = [new M(0, 0, 0, 0, function(e2, t2) {
var r2 = 65535;
for (r2 > e2.pending_buf_size - 5 && (r2 = e2.pending_buf_size - 5); ; ) {
if (e2.lookahead <= 1) {
if (j(e2), 0 === e2.lookahead && t2 === l)
return A;
if (0 === e2.lookahead)
break;
}
e2.strstart += e2.lookahead, e2.lookahead = 0;
var n2 = e2.block_start + r2;
if ((0 === e2.strstart || e2.strstart >= n2) && (e2.lookahead = e2.strstart - n2, e2.strstart = n2, N(e2, false), 0 === e2.strm.avail_out))
return A;
if (e2.strstart - e2.block_start >= e2.w_size - z && (N(e2, false), 0 === e2.strm.avail_out))
return A;
}
return e2.insert = 0, t2 === f ? (N(e2, true), 0 === e2.strm.avail_out ? O : B) : (e2.strstart > e2.block_start && (N(e2, false), e2.strm.avail_out), A);
}), new M(4, 4, 8, 4, Z), new M(4, 5, 16, 8, Z), new M(4, 6, 32, 32, Z), new M(4, 4, 16, 16, W), new M(8, 16, 32, 32, W), new M(8, 16, 128, 128, W), new M(8, 32, 128, 256, W), new M(32, 128, 258, 1024, W), new M(32, 258, 258, 4096, W)], r.deflateInit = function(e2, t2) {
return Y(e2, t2, v, 15, 8, 0);
}, r.deflateInit2 = Y, r.deflateReset = K, r.deflateResetKeep = G, r.deflateSetHeader = function(e2, t2) {
return e2 && e2.state ? 2 !== e2.state.wrap ? _ : (e2.state.gzhead = t2, m) : _;
}, r.deflate = function(e2, t2) {
var r2, n2, i2, s2;
if (!e2 || !e2.state || 5 < t2 || t2 < 0)
return e2 ? R(e2, _) : _;
if (n2 = e2.state, !e2.output || !e2.input && 0 !== e2.avail_in || 666 === n2.status && t2 !== f)
return R(e2, 0 === e2.avail_out ? -5 : _);
if (n2.strm = e2, r2 = n2.last_flush, n2.last_flush = t2, n2.status === C)
if (2 === n2.wrap)
e2.adler = 0, U(n2, 31), U(n2, 139), U(n2, 8), n2.gzhead ? (U(n2, (n2.gzhead.text ? 1 : 0) + (n2.gzhead.hcrc ? 2 : 0) + (n2.gzhead.extra ? 4 : 0) + (n2.gzhead.name ? 8 : 0) + (n2.gzhead.comment ? 16 : 0)), U(n2, 255 & n2.gzhead.time), U(n2, n2.gzhead.time >> 8 & 255), U(n2, n2.gzhead.time >> 16 & 255), U(n2, n2.gzhead.time >> 24 & 255), U(n2, 9 === n2.level ? 2 : 2 <= n2.strategy || n2.level < 2 ? 4 : 0), U(n2, 255 & n2.gzhead.os), n2.gzhead.extra && n2.gzhead.extra.length && (U(n2, 255 & n2.gzhead.extra.length), U(n2, n2.gzhead.extra.length >> 8 & 255)), n2.gzhead.hcrc && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending, 0)), n2.gzindex = 0, n2.status = 69) : (U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 0), U(n2, 9 === n2.level ? 2 : 2 <= n2.strategy || n2.level < 2 ? 4 : 0), U(n2, 3), n2.status = E);
else {
var a2 = v + (n2.w_bits - 8 << 4) << 8;
a2 |= (2 <= n2.strategy || n2.level < 2 ? 0 : n2.level < 6 ? 1 : 6 === n2.level ? 2 : 3) << 6, 0 !== n2.strstart && (a2 |= 32), a2 += 31 - a2 % 31, n2.status = E, P(n2, a2), 0 !== n2.strstart && (P(n2, e2.adler >>> 16), P(n2, 65535 & e2.adler)), e2.adler = 1;
}
if (69 === n2.status)
if (n2.gzhead.extra) {
for (i2 = n2.pending; n2.gzindex < (65535 & n2.gzhead.extra.length) && (n2.pending !== n2.pending_buf_size || (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending !== n2.pending_buf_size)); )
U(n2, 255 & n2.gzhead.extra[n2.gzindex]), n2.gzindex++;
n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), n2.gzindex === n2.gzhead.extra.length && (n2.gzindex = 0, n2.status = 73);
} else
n2.status = 73;
if (73 === n2.status)
if (n2.gzhead.name) {
i2 = n2.pending;
do {
if (n2.pending === n2.pending_buf_size && (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending === n2.pending_buf_size)) {
s2 = 1;
break;
}
s2 = n2.gzindex < n2.gzhead.name.length ? 255 & n2.gzhead.name.charCodeAt(n2.gzindex++) : 0, U(n2, s2);
} while (0 !== s2);
n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), 0 === s2 && (n2.gzindex = 0, n2.status = 91);
} else
n2.status = 91;
if (91 === n2.status)
if (n2.gzhead.comment) {
i2 = n2.pending;
do {
if (n2.pending === n2.pending_buf_size && (n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), F(e2), i2 = n2.pending, n2.pending === n2.pending_buf_size)) {
s2 = 1;
break;
}
s2 = n2.gzindex < n2.gzhead.comment.length ? 255 & n2.gzhead.comment.charCodeAt(n2.gzindex++) : 0, U(n2, s2);
} while (0 !== s2);
n2.gzhead.hcrc && n2.pending > i2 && (e2.adler = p(e2.adler, n2.pending_buf, n2.pending - i2, i2)), 0 === s2 && (n2.status = 103);
} else
n2.status = 103;
if (103 === n2.status && (n2.gzhead.hcrc ? (n2.pending + 2 > n2.pending_buf_size && F(e2), n2.pending + 2 <= n2.pending_buf_size && (U(n2, 255 & e2.adler), U(n2, e2.adler >> 8 & 255), e2.adler = 0, n2.status = E)) : n2.status = E), 0 !== n2.pending) {
if (F(e2), 0 === e2.avail_out)
return n2.last_flush = -1, m;
} else if (0 === e2.avail_in && T(t2) <= T(r2) && t2 !== f)
return R(e2, -5);
if (666 === n2.status && 0 !== e2.avail_in)
return R(e2, -5);
if (0 !== e2.avail_in || 0 !== n2.lookahead || t2 !== l && 666 !== n2.status) {
var o2 = 2 === n2.strategy ? function(e3, t3) {
for (var r3; ; ) {
if (0 === e3.lookahead && (j(e3), 0 === e3.lookahead)) {
if (t3 === l)
return A;
break;
}
if (e3.match_length = 0, r3 = u._tr_tally(e3, 0, e3.window[e3.strstart]), e3.lookahead--, e3.strstart++, r3 && (N(e3, false), 0 === e3.strm.avail_out))
return A;
}
return e3.insert = 0, t3 === f ? (N(e3, true), 0 === e3.strm.avail_out ? O : B) : e3.last_lit && (N(e3, false), 0 === e3.strm.avail_out) ? A : I;
}(n2, t2) : 3 === n2.strategy ? function(e3, t3) {
for (var r3, n3, i3, s3, a3 = e3.window; ; ) {
if (e3.lookahead <= S) {
if (j(e3), e3.lookahead <= S && t3 === l)
return A;
if (0 === e3.lookahead)
break;
}
if (e3.match_length = 0, e3.lookahead >= x && 0 < e3.strstart && (n3 = a3[i3 = e3.strstart - 1]) === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3]) {
s3 = e3.strstart + S;
do {
} while (n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && n3 === a3[++i3] && i3 < s3);
e3.match_length = S - (s3 - i3), e3.match_length > e3.lookahead && (e3.match_length = e3.lookahead);
}
if (e3.match_length >= x ? (r3 = u._tr_tally(e3, 1, e3.match_length - x), e3.lookahead -= e3.match_length, e3.strstart += e3.match_length, e3.match_length = 0) : (r3 = u._tr_tally(e3, 0, e3.window[e3.strstart]), e3.lookahead--, e3.strstart++), r3 && (N(e3, false), 0 === e3.strm.avail_out))
return A;
}
return e3.insert = 0, t3 === f ? (N(e3, true), 0 === e3.strm.avail_out ? O : B) : e3.last_lit && (N(e3, false), 0 === e3.strm.avail_out) ? A : I;
}(n2, t2) : h[n2.level].func(n2, t2);
if (o2 !== O && o2 !== B || (n2.status = 666), o2 === A || o2 === O)
return 0 === e2.avail_out && (n2.last_flush = -1), m;
if (o2 === I && (1 === t2 ? u._tr_align(n2) : 5 !== t2 && (u._tr_stored_block(n2, 0, 0, false), 3 === t2 && (D(n2.head), 0 === n2.lookahead && (n2.strstart = 0, n2.block_start = 0, n2.insert = 0))), F(e2), 0 === e2.avail_out))
return n2.last_flush = -1, m;
}
return t2 !== f ? m : n2.wrap <= 0 ? 1 : (2 === n2.wrap ? (U(n2, 255 & e2.adler), U(n2, e2.adler >> 8 & 255), U(n2, e2.adler >> 16 & 255), U(n2, e2.adler >> 24 & 255), U(n2, 255 & e2.total_in), U(n2, e2.total_in >> 8 & 255), U(n2, e2.total_in >> 16 & 255), U(n2, e2.total_in >> 24 & 255)) : (P(n2, e2.adler >>> 16), P(n2, 65535 & e2.adler)), F(e2), 0 < n2.wrap && (n2.wrap = -n2.wrap), 0 !== n2.pending ? m : 1);
}, r.deflateEnd = function(e2) {
var t2;
return e2 && e2.state ? (t2 = e2.state.status) !== C && 69 !== t2 && 73 !== t2 && 91 !== t2 && 103 !== t2 && t2 !== E && 666 !== t2 ? R(e2, _) : (e2.state = null, t2 === E ? R(e2, -3) : m) : _;
}, r.deflateSetDictionary = function(e2, t2) {
var r2, n2, i2, s2, a2, o2, h2, u2, l2 = t2.length;
if (!e2 || !e2.state)
return _;
if (2 === (s2 = (r2 = e2.state).wrap) || 1 === s2 && r2.status !== C || r2.lookahead)
return _;
for (1 === s2 && (e2.adler = d(e2.adler, t2, l2, 0)), r2.wrap = 0, l2 >= r2.w_size && (0 === s2 && (D(r2.head), r2.strstart = 0, r2.block_start = 0, r2.insert = 0), u2 = new c.Buf8(r2.w_size), c.arraySet(u2, t2, l2 - r2.w_size, r2.w_size, 0), t2 = u2, l2 = r2.w_size), a2 = e2.avail_in, o2 = e2.next_in, h2 = e2.input, e2.avail_in = l2, e2.next_in = 0, e2.input = t2, j(r2); r2.lookahead >= x; ) {
for (n2 = r2.strstart, i2 = r2.lookahead - (x - 1); r2.ins_h = (r2.ins_h << r2.hash_shift ^ r2.window[n2 + x - 1]) & r2.hash_mask, r2.prev[n2 & r2.w_mask] = r2.head[r2.ins_h], r2.head[r2.ins_h] = n2, n2++, --i2; )
;
r2.strstart = n2, r2.lookahead = x - 1, j(r2);
}
return r2.strstart += r2.lookahead, r2.block_start = r2.strstart, r2.insert = r2.lookahead, r2.lookahead = 0, r2.match_length = r2.prev_length = x - 1, r2.match_available = 0, e2.next_in = o2, e2.input = h2, e2.avail_in = a2, r2.wrap = s2, m;
}, r.deflateInfo = "pako deflate (from Nodeca project)";
}, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./messages": 51, "./trees": 52 }], 47: [function(e, t, r) {
"use strict";
t.exports = function() {
this.text = 0, this.time = 0, this.xflags = 0, this.os = 0, this.extra = null, this.extra_len = 0, this.name = "", this.comment = "", this.hcrc = 0, this.done = false;
};
}, {}], 48: [function(e, t, r) {
"use strict";
t.exports = function(e2, t2) {
var r2, n, i, s, a, o, h, u, l, f, c, d, p, m, _, g, b, v, y, w, k, x, S, z, C;
r2 = e2.state, n = e2.next_in, z = e2.input, i = n + (e2.avail_in - 5), s = e2.next_out, C = e2.output, a = s - (t2 - e2.avail_out), o = s + (e2.avail_out - 257), h = r2.dmax, u = r2.wsize, l = r2.whave, f = r2.wnext, c = r2.window, d = r2.hold, p = r2.bits, m = r2.lencode, _ = r2.distcode, g = (1 << r2.lenbits) - 1, b = (1 << r2.distbits) - 1;
e:
do {
p < 15 && (d += z[n++] << p, p += 8, d += z[n++] << p, p += 8), v = m[d & g];
t:
for (; ; ) {
if (d >>>= y = v >>> 24, p -= y, 0 === (y = v >>> 16 & 255))
C[s++] = 65535 & v;
else {
if (!(16 & y)) {
if (0 == (64 & y)) {
v = m[(65535 & v) + (d & (1 << y) - 1)];
continue t;
}
if (32 & y) {
r2.mode = 12;
break e;
}
e2.msg = "invalid literal/length code", r2.mode = 30;
break e;
}
w = 65535 & v, (y &= 15) && (p < y && (d += z[n++] << p, p += 8), w += d & (1 << y) - 1, d >>>= y, p -= y), p < 15 && (d += z[n++] << p, p += 8, d += z[n++] << p, p += 8), v = _[d & b];
r:
for (; ; ) {
if (d >>>= y = v >>> 24, p -= y, !(16 & (y = v >>> 16 & 255))) {
if (0 == (64 & y)) {
v = _[(65535 & v) + (d & (1 << y) - 1)];
continue r;
}
e2.msg = "invalid distance code", r2.mode = 30;
break e;
}
if (k = 65535 & v, p < (y &= 15) && (d += z[n++] << p, (p += 8) < y && (d += z[n++] << p, p += 8)), h < (k += d & (1 << y) - 1)) {
e2.msg = "invalid distance too far back", r2.mode = 30;
break e;
}
if (d >>>= y, p -= y, (y = s - a) < k) {
if (l < (y = k - y) && r2.sane) {
e2.msg = "invalid distance too far back", r2.mode = 30;
break e;
}
if (S = c, (x = 0) === f) {
if (x += u - y, y < w) {
for (w -= y; C[s++] = c[x++], --y; )
;
x = s - k, S = C;
}
} else if (f < y) {
if (x += u + f - y, (y -= f) < w) {
for (w -= y; C[s++] = c[x++], --y; )
;
if (x = 0, f < w) {
for (w -= y = f; C[s++] = c[x++], --y; )
;
x = s - k, S = C;
}
}
} else if (x += f - y, y < w) {
for (w -= y; C[s++] = c[x++], --y; )
;
x = s - k, S = C;
}
for (; 2 < w; )
C[s++] = S[x++], C[s++] = S[x++], C[s++] = S[x++], w -= 3;
w && (C[s++] = S[x++], 1 < w && (C[s++] = S[x++]));
} else {
for (x = s - k; C[s++] = C[x++], C[s++] = C[x++], C[s++] = C[x++], 2 < (w -= 3); )
;
w && (C[s++] = C[x++], 1 < w && (C[s++] = C[x++]));
}
break;
}
}
break;
}
} while (n < i && s < o);
n -= w = p >> 3, d &= (1 << (p -= w << 3)) - 1, e2.next_in = n, e2.next_out = s, e2.avail_in = n < i ? i - n + 5 : 5 - (n - i), e2.avail_out = s < o ? o - s + 257 : 257 - (s - o), r2.hold = d, r2.bits = p;
};
}, {}], 49: [function(e, t, r) {
"use strict";
var I = e("../utils/common"), O = e("./adler32"), B = e("./crc32"), R = e("./inffast"), T = e("./inftrees"), D = 1, F = 2, N = 0, U = -2, P = 1, n = 852, i = 592;
function L(e2) {
return (e2 >>> 24 & 255) + (e2 >>> 8 & 65280) + ((65280 & e2) << 8) + ((255 & e2) << 24);
}
function s() {
this.mode = 0, this.last = false, this.wrap = 0, this.havedict = false, this.flags = 0, this.dmax = 0, this.check = 0, this.total = 0, this.head = null, this.wbits = 0, this.wsize = 0, this.whave = 0, this.wnext = 0, this.window = null, this.hold = 0, this.bits = 0, this.length = 0, this.offset = 0, this.extra = 0, this.lencode = null, this.distcode = null, this.lenbits = 0, this.distbits = 0, this.ncode = 0, this.nlen = 0, this.ndist = 0, this.have = 0, this.next = null, this.lens = new I.Buf16(320), this.work = new I.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, this.back = 0, this.was = 0;
}
function a(e2) {
var t2;
return e2 && e2.state ? (t2 = e2.state, e2.total_in = e2.total_out = t2.total = 0, e2.msg = "", t2.wrap && (e2.adler = 1 & t2.wrap), t2.mode = P, t2.last = 0, t2.havedict = 0, t2.dmax = 32768, t2.head = null, t2.hold = 0, t2.bits = 0, t2.lencode = t2.lendyn = new I.Buf32(n), t2.distcode = t2.distdyn = new I.Buf32(i), t2.sane = 1, t2.back = -1, N) : U;
}
function o(e2) {
var t2;
return e2 && e2.state ? ((t2 = e2.state).wsize = 0, t2.whave = 0, t2.wnext = 0, a(e2)) : U;
}
function h(e2, t2) {
var r2, n2;
return e2 && e2.state ? (n2 = e2.state, t2 < 0 ? (r2 = 0, t2 = -t2) : (r2 = 1 + (t2 >> 4), t2 < 48 && (t2 &= 15)), t2 && (t2 < 8 || 15 < t2) ? U : (null !== n2.window && n2.wbits !== t2 && (n2.window = null), n2.wrap = r2, n2.wbits = t2, o(e2))) : U;
}
function u(e2, t2) {
var r2, n2;
return e2 ? (n2 = new s(), (e2.state = n2).window = null, (r2 = h(e2, t2)) !== N && (e2.state = null), r2) : U;
}
var l, f, c = true;
function j(e2) {
if (c) {
var t2;
for (l = new I.Buf32(512), f = new I.Buf32(32), t2 = 0; t2 < 144; )
e2.lens[t2++] = 8;
for (; t2 < 256; )
e2.lens[t2++] = 9;
for (; t2 < 280; )
e2.lens[t2++] = 7;
for (; t2 < 288; )
e2.lens[t2++] = 8;
for (T(D, e2.lens, 0, 288, l, 0, e2.work, { bits: 9 }), t2 = 0; t2 < 32; )
e2.lens[t2++] = 5;
T(F, e2.lens, 0, 32, f, 0, e2.work, { bits: 5 }), c = false;
}
e2.lencode = l, e2.lenbits = 9, e2.distcode = f, e2.distbits = 5;
}
function Z(e2, t2, r2, n2) {
var i2, s2 = e2.state;
return null === s2.window && (s2.wsize = 1 << s2.wbits, s2.wnext = 0, s2.whave = 0, s2.window = new I.Buf8(s2.wsize)), n2 >= s2.wsize ? (I.arraySet(s2.window, t2, r2 - s2.wsize, s2.wsize, 0), s2.wnext = 0, s2.whave = s2.wsize) : (n2 < (i2 = s2.wsize - s2.wnext) && (i2 = n2), I.arraySet(s2.window, t2, r2 - n2, i2, s2.wnext), (n2 -= i2) ? (I.arraySet(s2.window, t2, r2 - n2, n2, 0), s2.wnext = n2, s2.whave = s2.wsize) : (s2.wnext += i2, s2.wnext === s2.wsize && (s2.wnext = 0), s2.whave < s2.wsize && (s2.whave += i2))), 0;
}
r.inflateReset = o, r.inflateReset2 = h, r.inflateResetKeep = a, r.inflateInit = function(e2) {
return u(e2, 15);
}, r.inflateInit2 = u, r.inflate = function(e2, t2) {
var r2, n2, i2, s2, a2, o2, h2, u2, l2, f2, c2, d, p, m, _, g, b, v, y, w, k, x, S, z, C = 0, E = new I.Buf8(4), A = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
if (!e2 || !e2.state || !e2.output || !e2.input && 0 !== e2.avail_in)
return U;
12 === (r2 = e2.state).mode && (r2.mode = 13), a2 = e2.next_out, i2 = e2.output, h2 = e2.avail_out, s2 = e2.next_in, n2 = e2.input, o2 = e2.avail_in, u2 = r2.hold, l2 = r2.bits, f2 = o2, c2 = h2, x = N;
e:
for (; ; )
switch (r2.mode) {
case P:
if (0 === r2.wrap) {
r2.mode = 13;
break;
}
for (; l2 < 16; ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
if (2 & r2.wrap && 35615 === u2) {
E[r2.check = 0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0), l2 = u2 = 0, r2.mode = 2;
break;
}
if (r2.flags = 0, r2.head && (r2.head.done = false), !(1 & r2.wrap) || (((255 & u2) << 8) + (u2 >> 8)) % 31) {
e2.msg = "incorrect header check", r2.mode = 30;
break;
}
if (8 != (15 & u2)) {
e2.msg = "unknown compression method", r2.mode = 30;
break;
}
if (l2 -= 4, k = 8 + (15 & (u2 >>>= 4)), 0 === r2.wbits)
r2.wbits = k;
else if (k > r2.wbits) {
e2.msg = "invalid window size", r2.mode = 30;
break;
}
r2.dmax = 1 << k, e2.adler = r2.check = 1, r2.mode = 512 & u2 ? 10 : 12, l2 = u2 = 0;
break;
case 2:
for (; l2 < 16; ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
if (r2.flags = u2, 8 != (255 & r2.flags)) {
e2.msg = "unknown compression method", r2.mode = 30;
break;
}
if (57344 & r2.flags) {
e2.msg = "unknown header flags set", r2.mode = 30;
break;
}
r2.head && (r2.head.text = u2 >> 8 & 1), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l2 = u2 = 0, r2.mode = 3;
case 3:
for (; l2 < 32; ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
r2.head && (r2.head.time = u2), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, E[2] = u2 >>> 16 & 255, E[3] = u2 >>> 24 & 255, r2.check = B(r2.check, E, 4, 0)), l2 = u2 = 0, r2.mode = 4;
case 4:
for (; l2 < 16; ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
r2.head && (r2.head.xflags = 255 & u2, r2.head.os = u2 >> 8), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l2 = u2 = 0, r2.mode = 5;
case 5:
if (1024 & r2.flags) {
for (; l2 < 16; ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
r2.length = u2, r2.head && (r2.head.extra_len = u2), 512 & r2.flags && (E[0] = 255 & u2, E[1] = u2 >>> 8 & 255, r2.check = B(r2.check, E, 2, 0)), l2 = u2 = 0;
} else
r2.head && (r2.head.extra = null);
r2.mode = 6;
case 6:
if (1024 & r2.flags && (o2 < (d = r2.length) && (d = o2), d && (r2.head && (k = r2.head.extra_len - r2.length, r2.head.extra || (r2.head.extra = new Array(r2.head.extra_len)), I.arraySet(r2.head.extra, n2, s2, d, k)), 512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, r2.length -= d), r2.length))
break e;
r2.length = 0, r2.mode = 7;
case 7:
if (2048 & r2.flags) {
if (0 === o2)
break e;
for (d = 0; k = n2[s2 + d++], r2.head && k && r2.length < 65536 && (r2.head.name += String.fromCharCode(k)), k && d < o2; )
;
if (512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, k)
break e;
} else
r2.head && (r2.head.name = null);
r2.length = 0, r2.mode = 8;
case 8:
if (4096 & r2.flags) {
if (0 === o2)
break e;
for (d = 0; k = n2[s2 + d++], r2.head && k && r2.length < 65536 && (r2.head.comment += String.fromCharCode(k)), k && d < o2; )
;
if (512 & r2.flags && (r2.check = B(r2.check, n2, d, s2)), o2 -= d, s2 += d, k)
break e;
} else
r2.head && (r2.head.comment = null);
r2.mode = 9;
case 9:
if (512 & r2.flags) {
for (; l2 < 16; ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
if (u2 !== (65535 & r2.check)) {
e2.msg = "header crc mismatch", r2.mode = 30;
break;
}
l2 = u2 = 0;
}
r2.head && (r2.head.hcrc = r2.flags >> 9 & 1, r2.head.done = true), e2.adler = r2.check = 0, r2.mode = 12;
break;
case 10:
for (; l2 < 32; ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
e2.adler = r2.check = L(u2), l2 = u2 = 0, r2.mode = 11;
case 11:
if (0 === r2.havedict)
return e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l2, 2;
e2.adler = r2.check = 1, r2.mode = 12;
case 12:
if (5 === t2 || 6 === t2)
break e;
case 13:
if (r2.last) {
u2 >>>= 7 & l2, l2 -= 7 & l2, r2.mode = 27;
break;
}
for (; l2 < 3; ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
switch (r2.last = 1 & u2, l2 -= 1, 3 & (u2 >>>= 1)) {
case 0:
r2.mode = 14;
break;
case 1:
if (j(r2), r2.mode = 20, 6 !== t2)
break;
u2 >>>= 2, l2 -= 2;
break e;
case 2:
r2.mode = 17;
break;
case 3:
e2.msg = "invalid block type", r2.mode = 30;
}
u2 >>>= 2, l2 -= 2;
break;
case 14:
for (u2 >>>= 7 & l2, l2 -= 7 & l2; l2 < 32; ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
if ((65535 & u2) != (u2 >>> 16 ^ 65535)) {
e2.msg = "invalid stored block lengths", r2.mode = 30;
break;
}
if (r2.length = 65535 & u2, l2 = u2 = 0, r2.mode = 15, 6 === t2)
break e;
case 15:
r2.mode = 16;
case 16:
if (d = r2.length) {
if (o2 < d && (d = o2), h2 < d && (d = h2), 0 === d)
break e;
I.arraySet(i2, n2, s2, d, a2), o2 -= d, s2 += d, h2 -= d, a2 += d, r2.length -= d;
break;
}
r2.mode = 12;
break;
case 17:
for (; l2 < 14; ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
if (r2.nlen = 257 + (31 & u2), u2 >>>= 5, l2 -= 5, r2.ndist = 1 + (31 & u2), u2 >>>= 5, l2 -= 5, r2.ncode = 4 + (15 & u2), u2 >>>= 4, l2 -= 4, 286 < r2.nlen || 30 < r2.ndist) {
e2.msg = "too many length or distance symbols", r2.mode = 30;
break;
}
r2.have = 0, r2.mode = 18;
case 18:
for (; r2.have < r2.ncode; ) {
for (; l2 < 3; ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
r2.lens[A[r2.have++]] = 7 & u2, u2 >>>= 3, l2 -= 3;
}
for (; r2.have < 19; )
r2.lens[A[r2.have++]] = 0;
if (r2.lencode = r2.lendyn, r2.lenbits = 7, S = { bits: r2.lenbits }, x = T(0, r2.lens, 0, 19, r2.lencode, 0, r2.work, S), r2.lenbits = S.bits, x) {
e2.msg = "invalid code lengths set", r2.mode = 30;
break;
}
r2.have = 0, r2.mode = 19;
case 19:
for (; r2.have < r2.nlen + r2.ndist; ) {
for (; g = (C = r2.lencode[u2 & (1 << r2.lenbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
if (b < 16)
u2 >>>= _, l2 -= _, r2.lens[r2.have++] = b;
else {
if (16 === b) {
for (z = _ + 2; l2 < z; ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
if (u2 >>>= _, l2 -= _, 0 === r2.have) {
e2.msg = "invalid bit length repeat", r2.mode = 30;
break;
}
k = r2.lens[r2.have - 1], d = 3 + (3 & u2), u2 >>>= 2, l2 -= 2;
} else if (17 === b) {
for (z = _ + 3; l2 < z; ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
l2 -= _, k = 0, d = 3 + (7 & (u2 >>>= _)), u2 >>>= 3, l2 -= 3;
} else {
for (z = _ + 7; l2 < z; ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
l2 -= _, k = 0, d = 11 + (127 & (u2 >>>= _)), u2 >>>= 7, l2 -= 7;
}
if (r2.have + d > r2.nlen + r2.ndist) {
e2.msg = "invalid bit length repeat", r2.mode = 30;
break;
}
for (; d--; )
r2.lens[r2.have++] = k;
}
}
if (30 === r2.mode)
break;
if (0 === r2.lens[256]) {
e2.msg = "invalid code -- missing end-of-block", r2.mode = 30;
break;
}
if (r2.lenbits = 9, S = { bits: r2.lenbits }, x = T(D, r2.lens, 0, r2.nlen, r2.lencode, 0, r2.work, S), r2.lenbits = S.bits, x) {
e2.msg = "invalid literal/lengths set", r2.mode = 30;
break;
}
if (r2.distbits = 6, r2.distcode = r2.distdyn, S = { bits: r2.distbits }, x = T(F, r2.lens, r2.nlen, r2.ndist, r2.distcode, 0, r2.work, S), r2.distbits = S.bits, x) {
e2.msg = "invalid distances set", r2.mode = 30;
break;
}
if (r2.mode = 20, 6 === t2)
break e;
case 20:
r2.mode = 21;
case 21:
if (6 <= o2 && 258 <= h2) {
e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l2, R(e2, c2), a2 = e2.next_out, i2 = e2.output, h2 = e2.avail_out, s2 = e2.next_in, n2 = e2.input, o2 = e2.avail_in, u2 = r2.hold, l2 = r2.bits, 12 === r2.mode && (r2.back = -1);
break;
}
for (r2.back = 0; g = (C = r2.lencode[u2 & (1 << r2.lenbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
if (g && 0 == (240 & g)) {
for (v = _, y = g, w = b; g = (C = r2.lencode[w + ((u2 & (1 << v + y) - 1) >> v)]) >>> 16 & 255, b = 65535 & C, !(v + (_ = C >>> 24) <= l2); ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
u2 >>>= v, l2 -= v, r2.back += v;
}
if (u2 >>>= _, l2 -= _, r2.back += _, r2.length = b, 0 === g) {
r2.mode = 26;
break;
}
if (32 & g) {
r2.back = -1, r2.mode = 12;
break;
}
if (64 & g) {
e2.msg = "invalid literal/length code", r2.mode = 30;
break;
}
r2.extra = 15 & g, r2.mode = 22;
case 22:
if (r2.extra) {
for (z = r2.extra; l2 < z; ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
r2.length += u2 & (1 << r2.extra) - 1, u2 >>>= r2.extra, l2 -= r2.extra, r2.back += r2.extra;
}
r2.was = r2.length, r2.mode = 23;
case 23:
for (; g = (C = r2.distcode[u2 & (1 << r2.distbits) - 1]) >>> 16 & 255, b = 65535 & C, !((_ = C >>> 24) <= l2); ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
if (0 == (240 & g)) {
for (v = _, y = g, w = b; g = (C = r2.distcode[w + ((u2 & (1 << v + y) - 1) >> v)]) >>> 16 & 255, b = 65535 & C, !(v + (_ = C >>> 24) <= l2); ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
u2 >>>= v, l2 -= v, r2.back += v;
}
if (u2 >>>= _, l2 -= _, r2.back += _, 64 & g) {
e2.msg = "invalid distance code", r2.mode = 30;
break;
}
r2.offset = b, r2.extra = 15 & g, r2.mode = 24;
case 24:
if (r2.extra) {
for (z = r2.extra; l2 < z; ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
r2.offset += u2 & (1 << r2.extra) - 1, u2 >>>= r2.extra, l2 -= r2.extra, r2.back += r2.extra;
}
if (r2.offset > r2.dmax) {
e2.msg = "invalid distance too far back", r2.mode = 30;
break;
}
r2.mode = 25;
case 25:
if (0 === h2)
break e;
if (d = c2 - h2, r2.offset > d) {
if ((d = r2.offset - d) > r2.whave && r2.sane) {
e2.msg = "invalid distance too far back", r2.mode = 30;
break;
}
p = d > r2.wnext ? (d -= r2.wnext, r2.wsize - d) : r2.wnext - d, d > r2.length && (d = r2.length), m = r2.window;
} else
m = i2, p = a2 - r2.offset, d = r2.length;
for (h2 < d && (d = h2), h2 -= d, r2.length -= d; i2[a2++] = m[p++], --d; )
;
0 === r2.length && (r2.mode = 21);
break;
case 26:
if (0 === h2)
break e;
i2[a2++] = r2.length, h2--, r2.mode = 21;
break;
case 27:
if (r2.wrap) {
for (; l2 < 32; ) {
if (0 === o2)
break e;
o2--, u2 |= n2[s2++] << l2, l2 += 8;
}
if (c2 -= h2, e2.total_out += c2, r2.total += c2, c2 && (e2.adler = r2.check = r2.flags ? B(r2.check, i2, c2, a2 - c2) : O(r2.check, i2, c2, a2 - c2)), c2 = h2, (r2.flags ? u2 : L(u2)) !== r2.check) {
e2.msg = "incorrect data check", r2.mode = 30;
break;
}
l2 = u2 = 0;
}
r2.mode = 28;
case 28:
if (r2.wrap && r2.flags) {
for (; l2 < 32; ) {
if (0 === o2)
break e;
o2--, u2 += n2[s2++] << l2, l2 += 8;
}
if (u2 !== (4294967295 & r2.total)) {
e2.msg = "incorrect length check", r2.mode = 30;
break;
}
l2 = u2 = 0;
}
r2.mode = 29;
case 29:
x = 1;
break e;
case 30:
x = -3;
break e;
case 31:
return -4;
case 32:
default:
return U;
}
return e2.next_out = a2, e2.avail_out = h2, e2.next_in = s2, e2.avail_in = o2, r2.hold = u2, r2.bits = l2, (r2.wsize || c2 !== e2.avail_out && r2.mode < 30 && (r2.mode < 27 || 4 !== t2)) && Z(e2, e2.output, e2.next_out, c2 - e2.avail_out) ? (r2.mode = 31, -4) : (f2 -= e2.avail_in, c2 -= e2.avail_out, e2.total_in += f2, e2.total_out += c2, r2.total += c2, r2.wrap && c2 && (e2.adler = r2.check = r2.flags ? B(r2.check, i2, c2, e2.next_out - c2) : O(r2.check, i2, c2, e2.next_out - c2)), e2.data_type = r2.bits + (r2.last ? 64 : 0) + (12 === r2.mode ? 128 : 0) + (20 === r2.mode || 15 === r2.mode ? 256 : 0), (0 == f2 && 0 === c2 || 4 === t2) && x === N && (x = -5), x);
}, r.inflateEnd = function(e2) {
if (!e2 || !e2.state)
return U;
var t2 = e2.state;
return t2.window && (t2.window = null), e2.state = null, N;
}, r.inflateGetHeader = function(e2, t2) {
var r2;
return e2 && e2.state ? 0 == (2 & (r2 = e2.state).wrap) ? U : ((r2.head = t2).done = false, N) : U;
}, r.inflateSetDictionary = function(e2, t2) {
var r2, n2 = t2.length;
return e2 && e2.state ? 0 !== (r2 = e2.state).wrap && 11 !== r2.mode ? U : 11 === r2.mode && O(1, t2, n2, 0) !== r2.check ? -3 : Z(e2, t2, n2, n2) ? (r2.mode = 31, -4) : (r2.havedict = 1, N) : U;
}, r.inflateInfo = "pako inflate (from Nodeca project)";
}, { "../utils/common": 41, "./adler32": 43, "./crc32": 45, "./inffast": 48, "./inftrees": 50 }], 50: [function(e, t, r) {
"use strict";
var D = e("../utils/common"), F = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0], N = [16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78], U = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0], P = [16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64];
t.exports = function(e2, t2, r2, n, i, s, a, o) {
var h, u, l, f, c, d, p, m, _, g = o.bits, b = 0, v = 0, y = 0, w = 0, k = 0, x = 0, S = 0, z = 0, C = 0, E = 0, A = null, I = 0, O = new D.Buf16(16), B = new D.Buf16(16), R = null, T = 0;
for (b = 0; b <= 15; b++)
O[b] = 0;
for (v = 0; v < n; v++)
O[t2[r2 + v]]++;
for (k = g, w = 15; 1 <= w && 0 === O[w]; w--)
;
if (w < k && (k = w), 0 === w)
return i[s++] = 20971520, i[s++] = 20971520, o.bits = 1, 0;
for (y = 1; y < w && 0 === O[y]; y++)
;
for (k < y && (k = y), b = z = 1; b <= 15; b++)
if (z <<= 1, (z -= O[b]) < 0)
return -1;
if (0 < z && (0 === e2 || 1 !== w))
return -1;
for (B[1] = 0, b = 1; b < 15; b++)
B[b + 1] = B[b] + O[b];
for (v = 0; v < n; v++)
0 !== t2[r2 + v] && (a[B[t2[r2 + v]]++] = v);
if (d = 0 === e2 ? (A = R = a, 19) : 1 === e2 ? (A = F, I -= 257, R = N, T -= 257, 256) : (A = U, R = P, -1), b = y, c = s, S = v = E = 0, l = -1, f = (C = 1 << (x = k)) - 1, 1 === e2 && 852 < C || 2 === e2 && 592 < C)
return 1;
for (; ; ) {
for (p = b - S, _ = a[v] < d ? (m = 0, a[v]) : a[v] > d ? (m = R[T + a[v]], A[I + a[v]]) : (m = 96, 0), h = 1 << b - S, y = u = 1 << x; i[c + (E >> S) + (u -= h)] = p << 24 | m << 16 | _ | 0, 0 !== u; )
;
for (h = 1 << b - 1; E & h; )
h >>= 1;
if (0 !== h ? (E &= h - 1, E += h) : E = 0, v++, 0 == --O[b]) {
if (b === w)
break;
b = t2[r2 + a[v]];
}
if (k < b && (E & f) !== l) {
for (0 === S && (S = k), c += y, z = 1 << (x = b - S); x + S < w && !((z -= O[x + S]) <= 0); )
x++, z <<= 1;
if (C += 1 << x, 1 === e2 && 852 < C || 2 === e2 && 592 < C)
return 1;
i[l = E & f] = k << 24 | x << 16 | c - s | 0;
}
}
return 0 !== E && (i[c + E] = b - S << 24 | 64 << 16 | 0), o.bits = k, 0;
};
}, { "../utils/common": 41 }], 51: [function(e, t, r) {
"use strict";
t.exports = { 2: "need dictionary", 1: "stream end", 0: "", "-1": "file error", "-2": "stream error", "-3": "data error", "-4": "insufficient memory", "-5": "buffer error", "-6": "incompatible version" };
}, {}], 52: [function(e, t, r) {
"use strict";
var i = e("../utils/common"), o = 0, h = 1;
function n(e2) {
for (var t2 = e2.length; 0 <= --t2; )
e2[t2] = 0;
}
var s = 0, a = 29, u = 256, l = u + 1 + a, f = 30, c = 19, _ = 2 * l + 1, g = 15, d = 16, p = 7, m = 256, b = 16, v = 17, y = 18, w = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], k = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13], x = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7], S = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], z = new Array(2 * (l + 2));
n(z);
var C = new Array(2 * f);
n(C);
var E = new Array(512);
n(E);
var A = new Array(256);
n(A);
var I = new Array(a);
n(I);
var O, B, R, T = new Array(f);
function D(e2, t2, r2, n2, i2) {
this.static_tree = e2, this.extra_bits = t2, this.extra_base = r2, this.elems = n2, this.max_length = i2, this.has_stree = e2 && e2.length;
}
function F(e2, t2) {
this.dyn_tree = e2, this.max_code = 0, this.stat_desc = t2;
}
function N(e2) {
return e2 < 256 ? E[e2] : E[256 + (e2 >>> 7)];
}
function U(e2, t2) {
e2.pending_buf[e2.pending++] = 255 & t2, e2.pending_buf[e2.pending++] = t2 >>> 8 & 255;
}
function P(e2, t2, r2) {
e2.bi_valid > d - r2 ? (e2.bi_buf |= t2 << e2.bi_valid & 65535, U(e2, e2.bi_buf), e2.bi_buf = t2 >> d - e2.bi_valid, e2.bi_valid += r2 - d) : (e2.bi_buf |= t2 << e2.bi_valid & 65535, e2.bi_valid += r2);
}
function L(e2, t2, r2) {
P(e2, r2[2 * t2], r2[2 * t2 + 1]);
}
function j(e2, t2) {
for (var r2 = 0; r2 |= 1 & e2, e2 >>>= 1, r2 <<= 1, 0 < --t2; )
;
return r2 >>> 1;
}
function Z(e2, t2, r2) {
var n2, i2, s2 = new Array(g + 1), a2 = 0;
for (n2 = 1; n2 <= g; n2++)
s2[n2] = a2 = a2 + r2[n2 - 1] << 1;
for (i2 = 0; i2 <= t2; i2++) {
var o2 = e2[2 * i2 + 1];
0 !== o2 && (e2[2 * i2] = j(s2[o2]++, o2));
}
}
function W(e2) {
var t2;
for (t2 = 0; t2 < l; t2++)
e2.dyn_ltree[2 * t2] = 0;
for (t2 = 0; t2 < f; t2++)
e2.dyn_dtree[2 * t2] = 0;
for (t2 = 0; t2 < c; t2++)
e2.bl_tree[2 * t2] = 0;
e2.dyn_ltree[2 * m] = 1, e2.opt_len = e2.static_len = 0, e2.last_lit = e2.matches = 0;
}
function M(e2) {
8 < e2.bi_valid ? U(e2, e2.bi_buf) : 0 < e2.bi_valid && (e2.pending_buf[e2.pending++] = e2.bi_buf), e2.bi_buf = 0, e2.bi_valid = 0;
}
function H(e2, t2, r2, n2) {
var i2 = 2 * t2, s2 = 2 * r2;
return e2[i2] < e2[s2] || e2[i2] === e2[s2] && n2[t2] <= n2[r2];
}
function G(e2, t2, r2) {
for (var n2 = e2.heap[r2], i2 = r2 << 1; i2 <= e2.heap_len && (i2 < e2.heap_len && H(t2, e2.heap[i2 + 1], e2.heap[i2], e2.depth) && i2++, !H(t2, n2, e2.heap[i2], e2.depth)); )
e2.heap[r2] = e2.heap[i2], r2 = i2, i2 <<= 1;
e2.heap[r2] = n2;
}
function K(e2, t2, r2) {
var n2, i2, s2, a2, o2 = 0;
if (0 !== e2.last_lit)
for (; n2 = e2.pending_buf[e2.d_buf + 2 * o2] << 8 | e2.pending_buf[e2.d_buf + 2 * o2 + 1], i2 = e2.pending_buf[e2.l_buf + o2], o2++, 0 === n2 ? L(e2, i2, t2) : (L(e2, (s2 = A[i2]) + u + 1, t2), 0 !== (a2 = w[s2]) && P(e2, i2 -= I[s2], a2), L(e2, s2 = N(--n2), r2), 0 !== (a2 = k[s2]) && P(e2, n2 -= T[s2], a2)), o2 < e2.last_lit; )
;
L(e2, m, t2);
}
function Y(e2, t2) {
var r2, n2, i2, s2 = t2.dyn_tree, a2 = t2.stat_desc.static_tree, o2 = t2.stat_desc.has_stree, h2 = t2.stat_desc.elems, u2 = -1;
for (e2.heap_len = 0, e2.heap_max = _, r2 = 0; r2 < h2; r2++)
0 !== s2[2 * r2] ? (e2.heap[++e2.heap_len] = u2 = r2, e2.depth[r2] = 0) : s2[2 * r2 + 1] = 0;
for (; e2.heap_len < 2; )
s2[2 * (i2 = e2.heap[++e2.heap_len] = u2 < 2 ? ++u2 : 0)] = 1, e2.depth[i2] = 0, e2.opt_len--, o2 && (e2.static_len -= a2[2 * i2 + 1]);
for (t2.max_code = u2, r2 = e2.heap_len >> 1; 1 <= r2; r2--)
G(e2, s2, r2);
for (i2 = h2; r2 = e2.heap[1], e2.heap[1] = e2.heap[e2.heap_len--], G(e2, s2, 1), n2 = e2.heap[1], e2.heap[--e2.heap_max] = r2, e2.heap[--e2.heap_max] = n2, s2[2 * i2] = s2[2 * r2] + s2[2 * n2], e2.depth[i2] = (e2.depth[r2] >= e2.depth[n2] ? e2.depth[r2] : e2.depth[n2]) + 1, s2[2 * r2 + 1] = s2[2 * n2 + 1] = i2, e2.heap[1] = i2++, G(e2, s2, 1), 2 <= e2.heap_len; )
;
e2.heap[--e2.heap_max] = e2.heap[1], function(e3, t3) {
var r3, n3, i3, s3, a3, o3, h3 = t3.dyn_tree, u3 = t3.max_code, l2 = t3.stat_desc.static_tree, f2 = t3.stat_desc.has_stree, c2 = t3.stat_desc.extra_bits, d2 = t3.stat_desc.extra_base, p2 = t3.stat_desc.max_length, m2 = 0;
for (s3 = 0; s3 <= g; s3++)
e3.bl_count[s3] = 0;
for (h3[2 * e3.heap[e3.heap_max] + 1] = 0, r3 = e3.heap_max + 1; r3 < _; r3++)
p2 < (s3 = h3[2 * h3[2 * (n3 = e3.heap[r3]) + 1] + 1] + 1) && (s3 = p2, m2++), h3[2 * n3 + 1] = s3, u3 < n3 || (e3.bl_count[s3]++, a3 = 0, d2 <= n3 && (a3 = c2[n3 - d2]), o3 = h3[2 * n3], e3.opt_len += o3 * (s3 + a3), f2 && (e3.static_len += o3 * (l2[2 * n3 + 1] + a3)));
if (0 !== m2) {
do {
for (s3 = p2 - 1; 0 === e3.bl_count[s3]; )
s3--;
e3.bl_count[s3]--, e3.bl_count[s3 + 1] += 2, e3.bl_count[p2]--, m2 -= 2;
} while (0 < m2);
for (s3 = p2; 0 !== s3; s3--)
for (n3 = e3.bl_count[s3]; 0 !== n3; )
u3 < (i3 = e3.heap[--r3]) || (h3[2 * i3 + 1] !== s3 && (e3.opt_len += (s3 - h3[2 * i3 + 1]) * h3[2 * i3], h3[2 * i3 + 1] = s3), n3--);
}
}(e2, t2), Z(s2, u2, e2.bl_count);
}
function X(e2, t2, r2) {
var n2, i2, s2 = -1, a2 = t2[1], o2 = 0, h2 = 7, u2 = 4;
for (0 === a2 && (h2 = 138, u2 = 3), t2[2 * (r2 + 1) + 1] = 65535, n2 = 0; n2 <= r2; n2++)
i2 = a2, a2 = t2[2 * (n2 + 1) + 1], ++o2 < h2 && i2 === a2 || (o2 < u2 ? e2.bl_tree[2 * i2] += o2 : 0 !== i2 ? (i2 !== s2 && e2.bl_tree[2 * i2]++, e2.bl_tree[2 * b]++) : o2 <= 10 ? e2.bl_tree[2 * v]++ : e2.bl_tree[2 * y]++, s2 = i2, u2 = (o2 = 0) === a2 ? (h2 = 138, 3) : i2 === a2 ? (h2 = 6, 3) : (h2 = 7, 4));
}
function V(e2, t2, r2) {
var n2, i2, s2 = -1, a2 = t2[1], o2 = 0, h2 = 7, u2 = 4;
for (0 === a2 && (h2 = 138, u2 = 3), n2 = 0; n2 <= r2; n2++)
if (i2 = a2, a2 = t2[2 * (n2 + 1) + 1], !(++o2 < h2 && i2 === a2)) {
if (o2 < u2)
for (; L(e2, i2, e2.bl_tree), 0 != --o2; )
;
else
0 !== i2 ? (i2 !== s2 && (L(e2, i2, e2.bl_tree), o2--), L(e2, b, e2.bl_tree), P(e2, o2 - 3, 2)) : o2 <= 10 ? (L(e2, v, e2.bl_tree), P(e2, o2 - 3, 3)) : (L(e2, y, e2.bl_tree), P(e2, o2 - 11, 7));
s2 = i2, u2 = (o2 = 0) === a2 ? (h2 = 138, 3) : i2 === a2 ? (h2 = 6, 3) : (h2 = 7, 4);
}
}
n(T);
var q = false;
function J(e2, t2, r2, n2) {
P(e2, (s << 1) + (n2 ? 1 : 0), 3), function(e3, t3, r3, n3) {
M(e3), n3 && (U(e3, r3), U(e3, ~r3)), i.arraySet(e3.pending_buf, e3.window, t3, r3, e3.pending), e3.pending += r3;
}(e2, t2, r2, true);
}
r._tr_init = function(e2) {
q || (function() {
var e3, t2, r2, n2, i2, s2 = new Array(g + 1);
for (n2 = r2 = 0; n2 < a - 1; n2++)
for (I[n2] = r2, e3 = 0; e3 < 1 << w[n2]; e3++)
A[r2++] = n2;
for (A[r2 - 1] = n2, n2 = i2 = 0; n2 < 16; n2++)
for (T[n2] = i2, e3 = 0; e3 < 1 << k[n2]; e3++)
E[i2++] = n2;
for (i2 >>= 7; n2 < f; n2++)
for (T[n2] = i2 << 7, e3 = 0; e3 < 1 << k[n2] - 7; e3++)
E[256 + i2++] = n2;
for (t2 = 0; t2 <= g; t2++)
s2[t2] = 0;
for (e3 = 0; e3 <= 143; )
z[2 * e3 + 1] = 8, e3++, s2[8]++;
for (; e3 <= 255; )
z[2 * e3 + 1] = 9, e3++, s2[9]++;
for (; e3 <= 279; )
z[2 * e3 + 1] = 7, e3++, s2[7]++;
for (; e3 <= 287; )
z[2 * e3 + 1] = 8, e3++, s2[8]++;
for (Z(z, l + 1, s2), e3 = 0; e3 < f; e3++)
C[2 * e3 + 1] = 5, C[2 * e3] = j(e3, 5);
O = new D(z, w, u + 1, l, g), B = new D(C, k, 0, f, g), R = new D(new Array(0), x, 0, c, p);
}(), q = true), e2.l_desc = new F(e2.dyn_ltree, O), e2.d_desc = new F(e2.dyn_dtree, B), e2.bl_desc = new F(e2.bl_tree, R), e2.bi_buf = 0, e2.bi_valid = 0, W(e2);
}, r._tr_stored_block = J, r._tr_flush_block = function(e2, t2, r2, n2) {
var i2, s2, a2 = 0;
0 < e2.level ? (2 === e2.strm.data_type && (e2.strm.data_type = function(e3) {
var t3, r3 = 4093624447;
for (t3 = 0; t3 <= 31; t3++, r3 >>>= 1)
if (1 & r3 && 0 !== e3.dyn_ltree[2 * t3])
return o;
if (0 !== e3.dyn_ltree[18] || 0 !== e3.dyn_ltree[20] || 0 !== e3.dyn_ltree[26])
return h;
for (t3 = 32; t3 < u; t3++)
if (0 !== e3.dyn_ltree[2 * t3])
return h;
return o;
}(e2)), Y(e2, e2.l_desc), Y(e2, e2.d_desc), a2 = function(e3) {
var t3;
for (X(e3, e3.dyn_ltree, e3.l_desc.max_code), X(e3, e3.dyn_dtree, e3.d_desc.max_code), Y(e3, e3.bl_desc), t3 = c - 1; 3 <= t3 && 0 === e3.bl_tree[2 * S[t3] + 1]; t3--)
;
return e3.opt_len += 3 * (t3 + 1) + 5 + 5 + 4, t3;
}(e2), i2 = e2.opt_len + 3 + 7 >>> 3, (s2 = e2.static_len + 3 + 7 >>> 3) <= i2 && (i2 = s2)) : i2 = s2 = r2 + 5, r2 + 4 <= i2 && -1 !== t2 ? J(e2, t2, r2, n2) : 4 === e2.strategy || s2 === i2 ? (P(e2, 2 + (n2 ? 1 : 0), 3), K(e2, z, C)) : (P(e2, 4 + (n2 ? 1 : 0), 3), function(e3, t3, r3, n3) {
var i3;
for (P(e3, t3 - 257, 5), P(e3, r3 - 1, 5), P(e3, n3 - 4, 4), i3 = 0; i3 < n3; i3++)
P(e3, e3.bl_tree[2 * S[i3] + 1], 3);
V(e3, e3.dyn_ltree, t3 - 1), V(e3, e3.dyn_dtree, r3 - 1);
}(e2, e2.l_desc.max_code + 1, e2.d_desc.max_code + 1, a2 + 1), K(e2, e2.dyn_ltree, e2.dyn_dtree)), W(e2), n2 && M(e2);
}, r._tr_tally = function(e2, t2, r2) {
return e2.pending_buf[e2.d_buf + 2 * e2.last_lit] = t2 >>> 8 & 255, e2.pending_buf[e2.d_buf + 2 * e2.last_lit + 1] = 255 & t2, e2.pending_buf[e2.l_buf + e2.last_lit] = 255 & r2, e2.last_lit++, 0 === t2 ? e2.dyn_ltree[2 * r2]++ : (e2.matches++, t2--, e2.dyn_ltree[2 * (A[r2] + u + 1)]++, e2.dyn_dtree[2 * N(t2)]++), e2.last_lit === e2.lit_bufsize - 1;
}, r._tr_align = function(e2) {
P(e2, 2, 3), L(e2, m, z), function(e3) {
16 === e3.bi_valid ? (U(e3, e3.bi_buf), e3.bi_buf = 0, e3.bi_valid = 0) : 8 <= e3.bi_valid && (e3.pending_buf[e3.pending++] = 255 & e3.bi_buf, e3.bi_buf >>= 8, e3.bi_valid -= 8);
}(e2);
};
}, { "../utils/common": 41 }], 53: [function(e, t, r) {
"use strict";
t.exports = function() {
this.input = null, this.next_in = 0, this.avail_in = 0, this.total_in = 0, this.output = null, this.next_out = 0, this.avail_out = 0, this.total_out = 0, this.msg = "", this.state = null, this.data_type = 2, this.adler = 0;
};
}, {}], 54: [function(e, t, r) {
(function(e2) {
!function(r2, n) {
"use strict";
if (!r2.setImmediate) {
var i, s, t2, a, o = 1, h = {}, u = false, l = r2.document, e3 = Object.getPrototypeOf && Object.getPrototypeOf(r2);
e3 = e3 && e3.setTimeout ? e3 : r2, i = "[object process]" === {}.toString.call(r2.process) ? function(e4) {
process.nextTick(function() {
c(e4);
});
} : function() {
if (r2.postMessage && !r2.importScripts) {
var e4 = true, t3 = r2.onmessage;
return r2.onmessage = function() {
e4 = false;
}, r2.postMessage("", "*"), r2.onmessage = t3, e4;
}
}() ? (a = "setImmediate$" + Math.random() + "$", r2.addEventListener ? r2.addEventListener("message", d, false) : r2.attachEvent("onmessage", d), function(e4) {
r2.postMessage(a + e4, "*");
}) : r2.MessageChannel ? ((t2 = new MessageChannel()).port1.onmessage = function(e4) {
c(e4.data);
}, function(e4) {
t2.port2.postMessage(e4);
}) : l && "onreadystatechange" in l.createElement("script") ? (s = l.documentElement, function(e4) {
var t3 = l.createElement("script");
t3.onreadystatechange = function() {
c(e4), t3.onreadystatechange = null, s.removeChild(t3), t3 = null;
}, s.appendChild(t3);
}) : function(e4) {
setTimeout(c, 0, e4);
}, e3.setImmediate = function(e4) {
"function" != typeof e4 && (e4 = new Function("" + e4));
for (var t3 = new Array(arguments.length - 1), r3 = 0; r3 < t3.length; r3++)
t3[r3] = arguments[r3 + 1];
var n2 = { callback: e4, args: t3 };
return h[o] = n2, i(o), o++;
}, e3.clearImmediate = f;
}
function f(e4) {
delete h[e4];
}
function c(e4) {
if (u)
setTimeout(c, 0, e4);
else {
var t3 = h[e4];
if (t3) {
u = true;
try {
!function(e5) {
var t4 = e5.callback, r3 = e5.args;
switch (r3.length) {
case 0:
t4();
break;
case 1:
t4(r3[0]);
break;
case 2:
t4(r3[0], r3[1]);
break;
case 3:
t4(r3[0], r3[1], r3[2]);
break;
default:
t4.apply(n, r3);
}
}(t3);
} finally {
f(e4), u = false;
}
}
}
}
function d(e4) {
e4.source === r2 && "string" == typeof e4.data && 0 === e4.data.indexOf(a) && c(+e4.data.slice(a.length));
}
}("undefined" == typeof self ? void 0 === e2 ? this : e2 : self);
}).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
}, {}] }, {}, [10])(10);
});
}
});
// src/templates/default.json
var require_default = __commonJS({
"src/templates/default.json"(exports, module2) {
module2.exports = {
id: "default",
name: "\u9ED8\u8BA4\u4E3B\u9898",
styles: {
imagePreview: "background-color: #1c1c1e; padding: 28px 24px;",
header: {
avatar: {
container: "width: 40px; height: 40px; border-radius: 12px; overflow: hidden;",
placeholder: "background: #2c2c2e; transition: all 0.3s ease;",
image: "object-fit: cover; transition: transform 0.3s ease;"
},
nameContainer: "display: flex; align-items: center; gap: 8px;",
userName: "font-size: 16px; font-weight: 600; color: #ffffff;",
userId: "font-size: 14px; color: #98989d;",
postTime: "font-size: 13px; color: #636366;",
verifiedIcon: "width: 20px; height: 20px; margin-left: -5px; fill: #1DA1F2;"
},
footer: {
container: "position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px; color: #98989d; font-size: 13px; border-top: 1px solid #2c2c2e; background: #1c1c1e;",
text: "color: inherit; transition: color 0.2s ease; white-space: nowrap;",
separator: "color: #636366;"
},
title: {
h2: {
base: "margin: 0; font-size: 1.5em; letter-spacing: -0.01em; line-height: 1.5;",
content: "font-weight: 600; color: #f2f2f7;",
after: ""
},
h3: {
base: "margin: 26px 0 0; font-size: 1.25em; line-height: 1.5;",
content: "font-weight: 600; color: #f2f2f7;",
after: ""
},
base: {
base: "margin: 22px 0 0; font-size: 1.1em; line-height: 1.5;",
content: "font-weight: 600; color: #f2f2f7;",
after: ""
}
},
paragraph: "line-height: 1.8; margin-bottom: 1.1em; font-size: 15px; color: #f2f2f7;",
emphasis: {
strong: "font-weight: 700; color: #0A84FF;",
em: "font-style: normal; color: #98989d; background: rgba(152,152,157,0.1); padding: 0 4px;",
del: "text-decoration: line-through; color: #636366;"
},
list: {
container: "padding-left: 26px; margin-bottom: 1.1em; color: #d1d1d6;",
item: "margin-bottom: 0.7em; font-size: 15px; color: #d1d1d6; line-height: 1.75;",
taskList: "list-style: none; margin-left: -22px; font-size: 15px; color: #d1d1d6; line-height: 1.75;"
},
code: {
block: "background: #2c2c2e; padding: 1em 1.2em; border-radius: 12px; font-size: 14px; font-family: SF Mono, Menlo, monospace; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; color: #ffffff; margin: 1.3em 0;",
inline: "background: #2c2c2e; padding: 3px 8px; border-radius: 6px; color: #ffffff; font-size: 14px; font-family: SF Mono, Menlo, monospace;"
},
quote: "border-left: 3px solid #0A84FF; padding: 0 0 0 18px; margin: 1.2em 0; color: #f2f2f7; font-style: normal; font-size: 15px; line-height: 1.75;",
image: "max-width: 100%; height: auto; margin: 1.3em auto; border-radius: 12px;",
link: "color: #0A84FF; text-decoration: underline; text-underline-offset: 2px; transition: opacity 0.2s ease;",
table: {
container: "width: 100%; margin: 1.3em 0; border-collapse: separate; border-spacing: 0; border-radius: 12px; overflow: hidden; border: 1px solid #2c2c2e;",
header: "background: #2c2c2e; font-weight: 600; color: #f2f2f7; padding: 12px;",
cell: "padding: 12px; color: #d1d1d6; border-top: 1px solid #2c2c2e;"
},
hr: "border: none; border-top: 1px solid #2c2c2e; margin: 26px 0;",
footnote: {
ref: "color: #98989d; text-decoration: none; font-size: 0.9em;",
backref: "color: #98989d; text-decoration: none; font-size: 0.9em;"
}
}
};
}
});
// src/templates/minimal.json
var require_minimal = __commonJS({
"src/templates/minimal.json"(exports, module2) {
module2.exports = {
id: "minimal",
name: "\u6781\u7B80\u4E3B\u9898",
styles: {
imagePreview: "background-color: #ffffff; padding: 36px 32px;",
header: {
avatar: {
container: "width: 40px; height: 40px; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.05);",
placeholder: "background: #f5f5f5; transition: all 0.2s ease;",
image: "object-fit: cover; transition: transform 0.3s ease;"
},
nameContainer: "display: flex; align-items: center; gap: 8px;",
userName: "font-size: 16px; font-weight: 600; color: #333333; letter-spacing: 0.02em;",
userId: "font-size: 14px; color: #666666;",
postTime: "font-size: 13px; color: #999999;",
verifiedIcon: "width: 20px; height: 20px; margin-left: -5px; fill: #1DA1F2;"
},
footer: {
container: "position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 16px; padding: 16px; color: #999999; font-size: 13px; border-top: 1px solid #eeeeee; background: rgba(250,250,250,0.95); backdrop-filter: blur(8px);",
text: "color: inherit; transition: opacity 0.2s ease; white-space: nowrap;",
separator: "color: #dddddd;"
},
title: {
h2: {
base: "margin: 0; font-size: 1.5em; line-height: 1.5;",
content: "font-weight: 600; color: #333333;",
after: ""
},
h3: {
base: "margin: 32px 0 0; font-size: 1.25em; line-height: 1.5;",
content: "font-weight: 600; color: #333333;",
after: ""
},
base: {
base: "margin: 28px 0 0; font-size: 1.1em; line-height: 1.5;",
content: "font-weight: 600; color: #333333;",
after: ""
}
},
paragraph: "line-height: 1.8; margin-bottom: 1.2em; font-size: 15px; color: #444444;",
emphasis: {
strong: "font-weight: 700; color: #4a4a4a; background: rgba(74,74,74,0.05); padding: 0 2px;",
em: "font-style: normal; color: #6c9eb8; background: rgba(108,158,184,0.05); padding: 0 2px;",
del: "text-decoration: line-through; color: #999999; opacity: 0.8;"
},
list: {
container: "padding-left: 28px; margin-bottom: 1.2em; color: #666666;",
item: "margin-bottom: 0.8em; font-size: 15px; color: #666666; line-height: 1.8;",
taskList: "list-style: none; margin-left: -20px; font-size: 15px; color: #666666; line-height: 1.8;"
},
code: {
block: "background: #f5f5f5; padding: 1.2em; border-radius: 8px; font-size: 14px; font-family: 'SF Mono', Menlo, monospace; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; color: #555555; margin: 1.5em 0; border: 1px solid #eeeeee;",
inline: "background: #f5f5f5; padding: 4px 8px; border-radius: 4px; color: #555555; font-size: 14px; font-family: 'SF Mono', Menlo, monospace; border: 1px solid #eeeeee;"
},
quote: "border-left: 3px solid #eeeeee; padding: 0 0 0 20px; margin: 1.5em 0; color: #666666; font-style: normal; font-size: 15px; line-height: 1.8;",
image: "max-width: 100%; height: auto; margin: 1.5em auto; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.05);",
link: "color: #6c9eb8; text-decoration: none; border-bottom: 1px solid rgba(108,158,184,0.3); transition: all 0.2s ease;",
table: {
container: "width: 100%; margin: 1.5em 0; border-collapse: collapse;",
header: "background: #f5f5f5; font-weight: 600; color: #333333; border-bottom: 2px solid #eeeeee; padding: 14px;",
cell: "padding: 14px; color: #666666; border-bottom: 1px solid #eeeeee;"
},
hr: "border: none; border-top: 1px solid #eeeeee; margin: 32px 0;",
footnote: {
ref: "color: #999999; text-decoration: none; font-size: 0.9em;",
backref: "color: #999999; text-decoration: none; font-size: 0.9em;"
}
}
};
}
});
// src/templates/elegant.json
var require_elegant = __commonJS({
"src/templates/elegant.json"(exports, module2) {
module2.exports = {
id: "elegant",
name: "\u4F18\u96C5\u6697\u8272",
styles: {
imagePreview: "background-color: #1a1721; padding: 32px 28px;",
header: {
avatar: {
container: "width: 40px; height: 40px; border-radius: 14px; overflow: hidden; box-shadow: 0 2px 8px rgba(180,144,255,0.15);",
placeholder: "background: #2a2433; transition: all 0.3s ease;",
image: "object-fit: cover; transition: transform 0.3s ease;"
},
nameContainer: "display: flex; align-items: center; gap: 8px;",
userName: "font-size: 16px; font-weight: 600; color: #e2d9f3; letter-spacing: 0.02em;",
userId: "font-size: 14px; color: #a393c9;",
postTime: "font-size: 13px; color: #6d617f;",
verifiedIcon: "width: 20px; height: 20px; margin-left: -5px; fill: #1DA1F2;"
},
footer: {
container: "position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px; color: #a393c9; font-size: 13px; border-top: 1px solid #2a2433; background: rgba(26,23,33,0.95); backdrop-filter: blur(12px);",
text: "color: inherit; transition: color 0.2s ease; white-space: nowrap;",
separator: "color: #6d617f;"
},
title: {
h2: {
base: "margin: 0; font-size: 1.5em; letter-spacing: -0.01em; line-height: 1.5;",
content: "font-weight: 600; color: #e2d9f3; text-shadow: 0 2px 4px rgba(0,0,0,0.1);",
after: ""
},
h3: {
base: "margin: 28px 0 0; font-size: 1.25em; line-height: 1.5;",
content: "font-weight: 600; color: #e2d9f3;",
after: ""
},
base: {
base: "margin: 24px 0 0; font-size: 1.1em; line-height: 1.5;",
content: "font-weight: 600; color: #e2d9f3;",
after: ""
}
},
paragraph: "line-height: 1.75; margin-bottom: 1.1em; font-size: 15px; color: #c4b8dd;",
emphasis: {
strong: "font-weight: 600; color: #b490ff; text-shadow: 0 1px 2px rgba(180,144,255,0.2);",
em: "font-style: normal; color: #a393c9; background: rgba(163,147,201,0.1); padding: 0 4px; border-radius: 2px;",
del: "text-decoration: line-through; color: #6d617f; opacity: 0.8;"
},
list: {
container: "padding-left: 26px; margin-bottom: 1.2em; color: #c4b8dd;",
item: "margin-bottom: 0.7em; font-size: 15px; color: #c4b8dd; line-height: 1.75;",
taskList: "list-style: none; margin-left: -22px; font-size: 15px; color: #c4b8dd; line-height: 1.75;"
},
code: {
block: "background: #2a2433; padding: 1.2em; border-radius: 14px; font-size: 14px; font-family: 'SF Mono', Menlo, monospace; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; color: #c4b8dd; margin: 1.3em 0; box-shadow: inset 0 4px 12px rgba(0,0,0,0.1); border: 1px solid #3a3443;",
inline: "background: #2a2433; padding: 4px 10px; border-radius: 6px; color: #c4b8dd; font-size: 14px; font-family: 'SF Mono', Menlo, monospace; border: 1px solid #3a3443;"
},
quote: "border-left: 3px solid #b490ff; padding: 0 0 0 18px; margin: 1.5em 0; color: #a393c9; font-style: normal; font-size: 15px; line-height: 1.75; background: rgba(180,144,255,0.05); border-radius: 0 4px 4px 0;",
image: "max-width: 100%; height: auto; margin: 1.5em auto; border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,0.2);",
link: "color: #b490ff; text-decoration: none; transition: all 0.2s ease; border-bottom: 1px solid rgba(180,144,255,0.3);",
table: {
container: "width: 100%; margin: 1.5em 0; border-collapse: separate; border-spacing: 0; border-radius: 14px; overflow: hidden; border: 1px solid #3a3443; box-shadow: 0 4px 12px rgba(0,0,0,0.1);",
header: "background: #2a2433; font-weight: 600; color: #e2d9f3; padding: 14px;",
cell: "padding: 14px; color: #c4b8dd; border-top: 1px solid #3a3443;"
},
hr: "border: none; border-top: 1px solid #3a3443; margin: 32px 0;",
footnote: {
ref: "color: #a393c9; text-decoration: none; font-size: 0.9em;",
backref: "color: #a393c9; text-decoration: none; font-size: 0.9em;"
}
}
};
}
});
// src/templates/cyber.json
var require_cyber = __commonJS({
"src/templates/cyber.json"(exports, module2) {
module2.exports = {
id: "cyber",
name: "\u8D5B\u535A\u670B\u514B",
styles: {
imagePreview: "background-color: #ffffff; padding: 32px 28px;",
header: {
container: "margin-bottom: 10px;",
userInfo: "display: flex; justify-content: space-between; align-items: center; padding: 12px 14px 10px 14px; line-height: normal;",
userLeft: "display: flex; align-items: center; gap: 14px;",
avatar: {
container: "width: 44px; height: 44px; border-radius: 12px; overflow: hidden; cursor: pointer; position: relative; background: linear-gradient(45deg, #ff00ff, #00ffff); box-shadow: 0 0 15px rgba(255, 0, 255, 0.3); transition: all 0.3s ease; &::before { content: ''; position: absolute; inset: 1px; background: #ffffff; border-radius: 11px; z-index: 1; } &::after { content: ''; position: absolute; inset: -2px; background: linear-gradient(45deg, #ff00ff, #00ffff, #05ffa1); border-radius: 14px; z-index: -1; opacity: 0.5; } &:hover { transform: translateY(-2px); box-shadow: 0 0 20px rgba(255, 0, 255, 0.4); &::after { opacity: 0.8; } }",
placeholder: "width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, rgba(255, 0, 255, 0.1), rgba(0, 255, 255, 0.1)); color: #ff00ff; font-size: 18px; text-shadow: 0 0 10px rgba(255, 0, 255, 0.5); position: relative; z-index: 2;",
image: "width: 100%; height: 100%; object-fit: cover; transition: all 0.3s ease; filter: saturate(1.2) contrast(1.1); position: relative; z-index: 2; &:hover { transform: scale(1.05); filter: saturate(1.4) contrast(1.15); }"
},
nameContainer: "display: flex; align-items: center; gap: 8px;",
userName: "font-size: 16px; font-weight: 600; color: #ff00ff; cursor: pointer; transition: all 0.2s ease; text-shadow: 0 0 10px rgba(255, 0, 255, 0.3); &:hover { color: #ff2a6d; }",
userId: "font-size: 14px; color: #00ffff; cursor: pointer; transition: all 0.2s ease; &:hover { color: #05ffa1; }",
postTime: "font-size: 14px; color: #00ffff; cursor: pointer; transition: all 0.2s ease; &:hover { color: #05ffa1; }",
verifiedIcon: "width: 20px; height: 20px; margin-left: -5px; fill: #1DA1F2;"
},
footer: {
container: "margin-top: 20px; padding: 14px 18px; position: absolute; bottom: 5px; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 16px; border-top: 1px solid rgba(0, 255, 255, 0.2); backdrop-filter: blur(8px); background: rgba(255, 255, 255, 0.9);",
text: "color: #00ffff; font-size: 13px; cursor: pointer; transition: all 0.2s ease; white-space: nowrap; line-height: 1; display: inline-flex; align-items: center; vertical-align: middle; &:hover { color: #05ffa1; transform: translateY(-1px); }",
separator: "color: rgba(255, 0, 255, 0.5); font-size: 13px; line-height: 1; display: inline-flex; align-items: center;"
},
title: {
h2: {
base: "margin: 0; font-size: 1.5em; line-height: 1.4; display: block; letter-spacing: -0.01em;",
content: "font-weight: 600; color: #ff00ff; text-shadow: 0 0 10px rgba(255, 0, 255, 0.3);",
after: ""
},
h3: {
base: "margin: 0; font-size: 1.25em; line-height: 1.5; display: block;",
content: "font-weight: 600; color: #00ffff; text-shadow: 0 0 10px rgba(0, 255, 255, 0.3);",
after: ""
},
base: {
base: "margin: 0; font-size: 1.1em; line-height: 1.5; display: block;",
content: "font-weight: 500; color: #05ffa1; text-shadow: 0 0 10px rgba(5, 255, 161, 0.3);",
after: ""
}
},
paragraph: "line-height: 1.8; margin-bottom: 16px; font-size: 16px; color: #333333; text-align: justify; letter-spacing: 0.2px;",
emphasis: {
strong: "font-weight: 700; color: #00ffaa; text-shadow: 0 0 12px #00ffaa80;",
em: "font-style: normal; color: #4dffbe; background: rgba(77,255,190,0.15); padding: 0 4px;",
del: "text-decoration: line-through; color: #2f8f98; opacity: 0.9;"
},
quote: "position: relative; border-left: 4px solid #ff00ff; border-right: 1px solid #f0f0f0; padding: 16px 20px; margin: 1.5em 0; color: #666666; font-size: 16px; line-height: 1.7; background-color: #f8f8f8; border-radius: 6px; font-style: italic; box-shadow: 0 0 15px rgba(255, 0, 255, 0.1);",
code: {
block: "background: #f8f8f8; padding: 16px; border-radius: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 14px; position: relative; margin: 24px 0; line-height: 1.6; color: #333333; border: 1px solid rgba(0, 255, 255, 0.2); box-shadow: 0 0 15px rgba(0, 255, 255, 0.1);",
inline: "background: #f8f8f8; padding: 4px 10px; border-radius: 4px; color: #333333; font-size: 14px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; border: 1px solid rgba(0, 255, 255, 0.2);"
},
list: {
container: "padding-left: 24px; margin: 16px 0; color: #333333;",
item: "margin: 8px 0; font-size: 16px; color: #333333; line-height: 1.8;",
taskList: "list-style: none; margin-left: -22px; font-size: 16px; color: #333333; line-height: 1.8;"
},
table: {
container: "width: 100%; margin: 24px 0; border-collapse: separate; border-spacing: 0; border-radius: 10px; overflow: hidden; border: 1px solid rgba(0, 255, 255, 0.2); box-shadow: 0 0 15px rgba(0, 255, 255, 0.1);",
header: "background: #f8f8f8; font-weight: 600; color: #333333; padding: 14px 18px; border: 1px solid rgba(0, 255, 255, 0.2);",
cell: "padding: 14px 18px; color: #333333; border: 1px solid rgba(0, 255, 255, 0.2); background: #ffffff;"
},
hr: "width: 100%; margin: 32px 0; border: none; height: 2px; background: linear-gradient(90deg, #ff00ff 0%, #00ffff 50%, #05ffa1 100%); box-shadow: 0 0 15px rgba(255, 0, 255, 0.3); border-radius: 4px;",
image: "max-width: 100%; height: auto; margin: 24px auto; display: block; border-radius: 12px; box-shadow: 0 0 20px rgba(255, 0, 255, 0.2);",
link: "color: #00ffaa; text-decoration: none; border-bottom: 2px solid #00ffaa80; transition: all 0.2s ease; text-shadow: 0 0 12px #00ffaa40;",
footnote: {
ref: "color: #4dffbe; text-decoration: none; font-size: 0.9em; font-family: 'JetBrains Mono', monospace;",
backref: "color: #4dffbe; text-decoration: none; font-size: 0.9em; font-family: 'JetBrains Mono', monospace;"
}
}
};
}
});
// src/templates/warm.json
var require_warm = __commonJS({
"src/templates/warm.json"(exports, module2) {
module2.exports = {
id: "warm",
name: "\u6696\u9633\u6587\u827A",
styles: {
imagePreview: "background-color: #fffaf5; padding: 32px 28px;",
header: {
avatar: {
container: "width: 42px; height: 42px; border-radius: 14px; overflow: hidden; box-shadow: 0 4px 16px rgba(184,115,51,0.1); border: 1px solid #b8733380;",
placeholder: "background: linear-gradient(135deg, #fff0e6, #ffe4c4); transition: all 0.3s ease;",
image: "object-fit: cover; transition: transform 0.3s ease; filter: brightness(1.05) contrast(1.02);"
},
nameContainer: "display: flex; align-items: center; gap: 8px;",
userName: "font-size: 17px; font-weight: 600; color: #8b4513; serif; text-shadow: 0 2px 4px rgba(139,69,19,0.1);",
userId: "font-size: 14px; color: #b87333; font-family: 'Noto Serif SC', serif;",
postTime: "font-size: 13px; color: #d2691e; font-style: italic;",
verifiedIcon: "width: 20px; height: 20px; margin-left: -5px; fill: #1DA1F2;"
},
footer: {
container: "position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px; color: #b87333; font-size: 13px; border-top: 1px solid #b8733380; background: rgba(255,250,245,0.95); backdrop-filter: blur(8px);",
text: "color: inherit; transition: color 0.2s ease; font-style: italic; white-space: nowrap;",
separator: "color: #deb887;"
},
title: {
h2: {
base: "margin: 10px 0 0; font-size: 1.6em; letter-spacing: 0.01em; line-height: 1.5;",
content: "font-weight: 600; color: #8b4513; ",
after: ""
},
h3: {
base: "margin: 8px 0 0; font-size: 1.3em; line-height: 1.5;",
content: "font-weight: 600; color: #8b4513; ",
after: ""
},
base: {
base: "margin: 6px 0 0; font-size: 1.15em; line-height: 1.5;",
content: "font-weight: 600; color: #8b4513;",
after: ""
}
},
paragraph: "line-height: 1.75; margin-bottom: 1.1em; font-size: 15px; color: #5a4a42;",
emphasis: {
strong: "font-weight: 600; color: #d2691e; text-shadow: 0 2px 4px rgba(210,105,30,0.1);",
em: "font-style: normal; color: #b87333; background: rgba(184,115,51,0.1); padding: 0 4px; border-left: 2px solid #b8733380;",
del: "text-decoration: line-through; color: #8b4513; opacity: 0.8;"
},
list: {
container: "padding-left: 26px; margin-bottom: 1.2em; color: #6b4423;",
item: "margin-bottom: 0.8em; font-size: 15px; color: #6b4423; line-height: 1.85; font-family: 'Noto Serif SC', serif;",
taskList: "list-style: none; margin-left: -22px; font-size: 15px; color: #6b4423; line-height: 1.85; font-family: 'Noto Serif SC', serif;"
},
code: {
block: "background: #fff6e9; padding: 1.2em; border-radius: 8px; font-size: 14px; font-family: 'Fira Code', monospace; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; color: #8b4513; margin: 1.3em 0; border: 1px solid #b8733380; box-shadow: inset 0 4px 12px rgba(184,115,51,0.05), 0 2px 8px rgba(184,115,51,0.05);",
inline: "background: #fff6e9; padding: 4px 10px; border-radius: 4px; color: #8b4513; font-size: 14px; font-family: 'Fira Code', monospace; border: 1px solid #b8733380;"
},
quote: "border-left: 3px solid #deb887; padding: 0 0 0 20px; margin: 1.3em 0; color: #b87333; font-style: italic; font-size: 15px; line-height: 1.85; font-family: 'Noto Serif SC', serif; background: linear-gradient(to right, rgba(222,184,135,0.1), transparent);",
image: "max-width: 100%; height: auto; margin: 1.5em auto; border-radius: 12px; box-shadow: 0 4px 16px rgba(184,115,51,0.1); border: 1px solid #b8733380;",
link: "color: #d2691e; text-decoration: none; background-image: linear-gradient(to right, #d2691e80, #b8733380); background-size: 0% 1px; background-repeat: no-repeat; background-position: 0 100%; transition: all 0.3s ease; font-family: 'Noto Serif SC', serif;",
table: {
container: "width: 100%; margin: 1.4em 0; border-collapse: separate; border-spacing: 0; border: 1px solid #b8733380; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 12px rgba(184,115,51,0.05);",
header: "background: linear-gradient(135deg, #fff6e9, #fffaf5); font-weight: 600; color: #8b4513; padding: 14px; font-family: 'Noto Serif SC', serif; border-bottom: 2px solid #b8733380;",
cell: "padding: 14px; color: #6b4423; border-top: 1px solid #b8733380; font-family: 'Noto Serif SC', serif;"
},
hr: "border: none; border-top: 2px solid #b8733380; margin: 28px 0; box-shadow: 0 2px 8px rgba(184,115,51,0.05);",
footnote: {
ref: "color: #b87333; text-decoration: none; font-size: 0.9em; font-style: italic;",
backref: "color: #b87333; text-decoration: none; font-size: 0.9em; font-style: italic;"
}
}
};
}
});
// src/templates/forest.json
var require_forest = __commonJS({
"src/templates/forest.json"(exports, module2) {
module2.exports = {
id: "forest",
name: "\u68EE\u6797\u6E05\u6668",
styles: {
imagePreview: "background-color: #1a2420; padding: 32px 28px;",
header: {
avatar: {
container: "width: 40px; height: 40px; border-radius: 14px; overflow: hidden; box-shadow: 0 4px 16px rgba(46,204,113,0.15); border: 1px solid #2ecc7180;",
placeholder: "background: #243830; transition: all 0.3s ease;",
image: "object-fit: cover; transition: transform 0.3s ease; filter: brightness(1.05);"
},
nameContainer: "display: flex; align-items: center; gap: 10px;",
userName: "font-size: 16px; font-weight: 600; color: #2ecc71; text-shadow: 0 2px 4px rgba(46,204,113,0.1);",
userId: "font-size: 14px; color: #27ae60; font-family: 'SF Pro Text';",
postTime: "font-size: 13px; color: #16a085; letter-spacing: 0.02em;",
verifiedIcon: "width: 20px; height: 20px; margin-left: -5px; fill: #1DA1F2;"
},
footer: {
container: "position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px; color: #27ae60; font-size: 13px; border-top: 1px solid #2ecc7140; background: rgba(26,36,32,0.95); backdrop-filter: blur(12px);",
text: "color: inherit; transition: color 0.2s ease; white-space: nowrap;",
separator: "color: #16a085;"
},
title: {
h2: {
base: "margin: 0; font-size: 1.5em; letter-spacing: -0.01em; line-height: 1.5;",
content: "font-weight: 600; color: #2ecc71; text-shadow: 0 2px 4px rgba(46,204,113,0.1);",
after: ""
},
h3: {
base: "margin: 28px 0 0; font-size: 1.25em; line-height: 1.5;",
content: "font-weight: 600; color: #2ecc71;",
after: ""
},
base: {
base: "margin: 24px 0 0; font-size: 1.1em; line-height: 1.5;",
content: "font-weight: 600; color: #2ecc71;",
after: ""
}
},
paragraph: "line-height: 1.8; margin-bottom: 1.1em; font-size: 15px; color: #e8f5e9;",
emphasis: {
strong: "font-weight: 700; color: #2ecc71; text-shadow: 0 2px 4px rgba(46,204,113,0.2);",
em: "font-style: normal; color: #27ae60; background: rgba(39,174,96,0.1); padding: 0 4px; border-radius: 2px;",
del: "text-decoration: line-through; color: #16a085; opacity: 0.8;"
},
list: {
container: "padding-left: 26px; margin-bottom: 1.2em; color: #a8e6cf;",
item: "margin-bottom: 0.7em; font-size: 15px; color: #a8e6cf; line-height: 1.75;",
taskList: "list-style: none; margin-left: -22px; font-size: 15px; color: #a8e6cf; line-height: 1.75;"
},
code: {
block: "background: #243830; padding: 1.2em; border-radius: 14px; font-size: 14px; font-family: 'SF Mono', Menlo, monospace; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; color: #a8e6cf; margin: 1.5em 0; box-shadow: inset 0 4px 12px rgba(0,0,0,0.1); border: 1px solid #2ecc7180;",
inline: "background: #243830; padding: 4px 10px; border-radius: 6px; color: #a8e6cf; font-size: 14px; font-family: 'SF Mono', Menlo, monospace; border: 1px solid #2ecc7180;"
},
quote: "border-left: 3px solid #2ecc71; padding: 0 0 0 20px; margin: 1.5em 0; color: #27ae60; font-style: normal; font-size: 15px; line-height: 1.75; background: rgba(46,204,113,0.05);",
image: "max-width: 100%; height: auto; margin: 1.5em auto; border-radius: 14px; box-shadow: 0 8px 24px rgba(46,204,113,0.1); border: 1px solid #2ecc7180;",
link: "color: #2ecc71; text-decoration: none; border-bottom: 1px solid #2ecc7180; transition: all 0.2s ease; text-shadow: 0 2px 4px rgba(46,204,113,0.1);",
table: {
container: "width: 100%; margin: 1.5em 0; border-collapse: separate; border-spacing: 0; border-radius: 14px; overflow: hidden; border: 1px solid #2ecc7180; box-shadow: 0 4px 12px rgba(46,204,113,0.1);",
header: "background: #243830; font-weight: 600; color: #2ecc71; padding: 14px; border-bottom: 1px solid #2ecc7180;",
cell: "padding: 14px; color: #a8e6cf; border-top: 1px solid #2ecc7180;"
},
hr: "border: none; border-top: 1px solid #2ecc7180; margin: 32px 0; box-shadow: 0 2px 8px rgba(46,204,113,0.1);",
footnote: {
ref: "color: #27ae60; text-decoration: none; font-size: 0.9em;",
backref: "color: #27ae60; text-decoration: none; font-size: 0.9em;"
}
}
};
}
});
// src/templates/ocean.json
var require_ocean = __commonJS({
"src/templates/ocean.json"(exports, module2) {
module2.exports = {
id: "ocean",
name: "\u6DF1\u6D77\u4E4B\u5883",
styles: {
imagePreview: "background-color: #0a192f; padding: 32px 28px;",
header: {
avatar: {
container: "width: 40px; height: 40px; border-radius: 14px; overflow: hidden; box-shadow: 0 4px 16px rgba(64,169,255,0.25); border: 1px solid #1d3552;",
placeholder: "background: linear-gradient(135deg, #112a45, #1d3552); transition: all 0.3s ease;",
image: "object-fit: cover; transition: transform 0.3s ease; filter: brightness(1.1) contrast(1.05);"
},
nameContainer: "display: flex; align-items: center; gap: 10px;",
userName: "font-size: 16px; font-weight: 700; color: #40a9ff; text-shadow: 0 2px 8px rgba(64,169,255,0.2);",
userId: "font-size: 14px; color: #69c0ff; font-family: 'SF Pro Text';",
postTime: "font-size: 13px; color: #91d5ff; letter-spacing: 0.03em;",
verifiedIcon: "width: 20px; height: 20px; margin-left: -5px; fill: #1DA1F2;"
},
footer: {
container: "position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px; color: #69c0ff; font-size: 13px; border-top: 1px solid #1d3552; background: rgba(10,25,47,0.95); backdrop-filter: blur(12px);",
text: "color: inherit; transition: color 0.2s ease; white-space: nowrap;",
separator: "color: #91d5ff;"
},
title: {
h2: {
base: "margin: 0; font-size: 1.5em; letter-spacing: -0.01em; line-height: 1.5;",
content: "font-weight: 700; color: #40a9ff; text-shadow: 0 2px 8px rgba(64,169,255,0.15);",
after: ""
},
h3: {
base: "margin: 28px 0 0; font-size: 1.25em; line-height: 1.5;",
content: "font-weight: 700; color: #40a9ff;",
after: ""
},
base: {
base: "margin: 24px 0 0; font-size: 1.1em; line-height: 1.5;",
content: "font-weight: 700; color: #40a9ff;",
after: ""
}
},
paragraph: "line-height: 1.8; margin-bottom: 1.2em; font-size: 15px; color: #e6f7ff;",
emphasis: {
strong: "font-weight: 700; color: #40a9ff; text-shadow: 0 2px 8px rgba(64,169,255,0.2);",
em: "font-style: normal; color: #69c0ff; background: rgba(105,192,255,0.1); padding: 0 4px; border-left: 2px solid #69c0ff80;",
del: "text-decoration: line-through; color: #91d5ff; opacity: 0.8;"
},
list: {
container: "padding-left: 28px; margin-bottom: 1.2em; color: #bae7ff;",
item: "margin-bottom: 0.8em; font-size: 15px; color: #bae7ff; line-height: 1.8;",
taskList: "list-style: none; margin-left: -24px; font-size: 15px; color: #bae7ff; line-height: 1.8;"
},
code: {
block: "background: #112a45; padding: 1.2em; border-radius: 14px; font-size: 14px; font-family: 'SF Mono', Menlo, monospace; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; color: #bae7ff; margin: 1.5em 0; box-shadow: inset 0 4px 12px rgba(0,0,0,0.15), 0 2px 8px rgba(64,169,255,0.1); border: 1px solid #1d3552;",
inline: "background: #112a45; padding: 4px 10px; border-radius: 6px; color: #bae7ff; font-size: 14px; font-family: 'SF Mono', Menlo, monospace; border: 1px solid #1d3552;"
},
quote: "border-left: 3px solid #40a9ff; padding: 0 0 0 20px; margin: 1.5em 0; color: #69c0ff; font-style: normal; font-size: 15px; line-height: 1.8; background: linear-gradient(to right, rgba(64,169,255,0.05), transparent);",
image: "max-width: 100%; height: auto; margin: 1.5em auto; border-radius: 14px; box-shadow: 0 8px 24px rgba(64,169,255,0.25); border: 1px solid #69c0ff80;",
link: "color: #40a9ff; text-decoration: none; border-bottom: 1px solid rgba(64,169,255,0.3); transition: all 0.2s ease; text-shadow: 0 2px 4px rgba(64,169,255,0.1);",
table: {
container: "width: 100%; margin: 1.5em 0; border-collapse: separate; border-spacing: 0; border-radius: 14px; overflow: hidden; border: 1px solid #1d3552; box-shadow: 0 4px 12px rgba(64,169,255,0.15);",
header: "background: linear-gradient(135deg, #112a45, #0a192f); font-weight: 700; color: #40a9ff; padding: 14px; border-bottom: 2px solid #1d3552;",
cell: "padding: 14px; color: #bae7ff; border-top: 1px solid #1d3552;"
},
hr: "border: none; border-top: 2px solid #1d3552; margin: 32px 0; box-shadow: 0 2px 8px rgba(64,169,255,0.15);",
footnote: {
ref: "color: #69c0ff; text-decoration: none; font-size: 0.9em;",
backref: "color: #69c0ff; text-decoration: none; font-size: 0.9em;"
}
}
};
}
});
// src/templates/sakura.json
var require_sakura = __commonJS({
"src/templates/sakura.json"(exports, module2) {
module2.exports = {
id: "sakura",
name: "\u6A31\u82B1\u98DE\u821E",
styles: {
imagePreview: "background-color: #1f1a1d; padding: 32px 28px;",
header: {
avatar: {
container: "width: 40px; height: 40px; border-radius: 14px; overflow: hidden; box-shadow: 0 4px 16px rgba(255,182,193,0.25); border: 1px solid #ffb6c180;",
placeholder: "background: linear-gradient(135deg, #2d2428, #3a2d33); transition: all 0.3s ease;",
image: "object-fit: cover; transition: transform 0.3s ease; filter: brightness(1.05) contrast(1.02);"
},
nameContainer: "display: flex; align-items: center; gap: 10px;",
userName: "font-size: 16px; font-weight: 700; color: #ffb6c1; text-shadow: 0 2px 8px rgba(255,182,193,0.2);",
userId: "font-size: 14px; color: #ff8da1; font-family: 'SF Pro Text';",
postTime: "font-size: 13px; color: #ff6b88; letter-spacing: 0.03em;",
verifiedIcon: "width: 20px; height: 20px; margin-left: -5px; fill: #1DA1F2;"
},
footer: {
container: "position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px; color: #ff8da1; font-size: 13px; border-top: 1px solid #ffb6c140; background: rgba(31,26,29,0.95); backdrop-filter: blur(12px);",
text: "color: inherit; transition: color 0.2s ease; white-space: nowrap;",
separator: "color: #ff6b88;"
},
title: {
h2: {
base: "margin: 0; font-size: 1.5em; letter-spacing: -0.01em; line-height: 1.5;",
content: "font-weight: 700; color: #ffb6c1; text-shadow: 0 2px 8px rgba(255,182,193,0.15);",
after: ""
},
h3: {
base: "margin: 28px 0 0; font-size: 1.25em; line-height: 1.5;",
content: "font-weight: 700; color: #ffb6c1;",
after: ""
},
base: {
base: "margin: 24px 0 0; font-size: 1.1em; line-height: 1.5;",
content: "font-weight: 700; color: #ffb6c1;",
after: ""
}
},
paragraph: "line-height: 1.8; margin-bottom: 1.2em; font-size: 15px; color: #fff5f7;",
emphasis: {
strong: "font-weight: 700; color: #ff69b4; text-shadow: 0 2px 8px rgba(255,105,180,0.2);",
em: "font-style: normal; color: #ff8da1; background: rgba(255,141,161,0.1); padding: 0 4px; border-left: 2px solid #ff8da180;",
del: "text-decoration: line-through; color: #ff6b88; opacity: 0.8;"
},
list: {
container: "padding-left: 28px; margin-bottom: 1.2em; color: #ffd1d9;",
item: "margin-bottom: 0.8em; font-size: 15px; color: #ffd1d9; line-height: 1.8;",
taskList: "list-style: none; margin-left: -24px; font-size: 15px; color: #ffd1d9; line-height: 1.8;"
},
code: {
block: "background: #2d2428; padding: 1.2em; border-radius: 14px; font-size: 14px; font-family: 'SF Mono', Menlo, monospace; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; color: #ffd1d9; margin: 1.5em 0; box-shadow: inset 0 4px 12px rgba(0,0,0,0.15), 0 2px 8px rgba(255,182,193,0.1); border: 1px solid #ffb6c180;",
inline: "background: #2d2428; padding: 4px 10px; border-radius: 6px; color: #ffd1d9; font-size: 14px; font-family: 'SF Mono', Menlo, monospace; border: 1px solid #ffb6c180;"
},
quote: "border-left: 3px solid #ff8da1; padding: 0 0 0 20px; margin: 1.5em 0; color: #ff8da1; font-style: normal; font-size: 15px; line-height: 1.8; background: linear-gradient(to right, rgba(255,141,161,0.05), transparent);",
image: "max-width: 100%; height: auto; margin: 1.5em auto; border-radius: 14px; box-shadow: 0 8px 24px rgba(255,182,193,0.25); border: 1px solid #ffb6c180;",
link: "color: #ffb6c1; text-decoration: none; border-bottom: 1px solid rgba(255,182,193,0.3); transition: all 0.2s ease; text-shadow: 0 2px 4px rgba(255,182,193,0.1);",
table: {
container: "width: 100%; margin: 1.5em 0; border-collapse: separate; border-spacing: 0; border-radius: 14px; overflow: hidden; border: 1px solid #ffb6c180; box-shadow: 0 4px 12px rgba(255,182,193,0.15);",
header: "background: linear-gradient(135deg, #2d2428, #1f1a1d); font-weight: 700; color: #ffb6c1; padding: 14px; border-bottom: 2px solid #ffb6c180;",
cell: "padding: 14px; color: #ffd1d9; border-top: 1px solid #ffb6c180;"
},
hr: "border: none; border-top: 2px solid #ffb6c180; margin: 32px 0; box-shadow: 0 2px 8px rgba(255,182,193,0.15);",
footnote: {
ref: "color: #ff8da1; text-decoration: none; font-size: 0.9em;",
backref: "color: #ff8da1; text-decoration: none; font-size: 0.9em;"
}
}
};
}
});
// src/templates/starry.json
var require_starry = __commonJS({
"src/templates/starry.json"(exports, module2) {
module2.exports = {
id: "starry",
name: "\u661F\u7A7A\u68A6\u5883",
styles: {
imagePreview: "background-color: #0d0f1a; padding: 32px 28px;",
header: {
avatar: {
container: "width: 40px; height: 40px; border-radius: 14px; overflow: hidden; box-shadow: 0 4px 24px rgba(147,112,219,0.3); border: 1px solid #9370db80;",
placeholder: "background: linear-gradient(135deg, #252640, #1a1b2e); transition: all 0.3s ease;",
image: "object-fit: cover; transition: transform 0.3s ease; filter: brightness(1.1) contrast(1.05);"
},
nameContainer: "display: flex; align-items: center; gap: 10px;",
userName: "font-size: 16px; font-weight: 700; color: #9370db; text-shadow: 0 2px 8px rgba(147,112,219,0.2);",
userId: "font-size: 14px; color: #b19cd9; font-family: 'SF Pro Text';",
postTime: "font-size: 13px; color: #8a7bb5; letter-spacing: 0.03em;",
verifiedIcon: "width: 20px; height: 20px; margin-left: -5px; fill: #1DA1F2;"
},
footer: {
container: "position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px; color: #b19cd9; font-size: 13px; border-top: 1px solid #252640; background: rgba(13,15,26,0.95); backdrop-filter: blur(12px);",
text: "color: inherit; transition: color 0.2s ease; white-space: nowrap;",
separator: "color: #8a7bb5;"
},
title: {
h2: {
base: "margin: 0; font-size: 1.5em; letter-spacing: -0.01em; line-height: 1.5;",
content: "font-weight: 700; color: #9370db; text-shadow: 0 2px 8px rgba(147,112,219,0.15);",
after: ""
},
h3: {
base: "margin: 28px 0 0; font-size: 1.25em; line-height: 1.5;",
content: "font-weight: 700; color: #9370db;",
after: ""
},
base: {
base: "margin: 24px 0 0; font-size: 1.1em; line-height: 1.5;",
content: "font-weight: 700; color: #9370db;",
after: ""
}
},
paragraph: "line-height: 1.8; margin-bottom: 1.2em; font-size: 15px; color: #f0e6ff;",
emphasis: {
strong: "font-weight: 700; color: #9b59b6; text-shadow: 0 2px 8px rgba(155,89,182,0.2);",
em: "font-style: normal; color: #b19cd9; background: rgba(177,156,217,0.1); padding: 0 4px; border-left: 2px solid #b19cd980;",
del: "text-decoration: line-through; color: #8a7bb5; opacity: 0.8;"
},
list: {
container: "padding-left: 28px; margin-bottom: 1.2em; color: #d8cef6;",
item: "margin-bottom: 0.8em; font-size: 15px; color: #d8cef6; line-height: 1.8;",
taskList: "list-style: none; margin-left: -24px; font-size: 15px; color: #d8cef6; line-height: 1.8;"
},
code: {
block: "background: #252640; padding: 1.2em; border-radius: 14px; font-size: 14px; font-family: 'SF Mono', Menlo, monospace; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; color: #d8cef6; margin: 1.5em 0; box-shadow: inset 0 4px 12px rgba(0,0,0,0.15), 0 2px 8px rgba(147,112,219,0.1); border: 1px solid #9370db80;",
inline: "background: #252640; padding: 4px 10px; border-radius: 6px; color: #d8cef6; font-size: 14px; font-family: 'SF Mono', Menlo, monospace; border: 1px solid #9370db80;"
},
quote: "border-left: 3px solid #b19cd9; padding: 0 0 0 20px; margin: 1.5em 0; color: #b19cd9; font-style: normal; font-size: 15px; line-height: 1.8; background: linear-gradient(to right, rgba(177,156,217,0.05), transparent);",
image: "max-width: 100%; height: auto; margin: 1.5em auto; border-radius: 14px; box-shadow: 0 8px 24px rgba(147,112,219,0.25); border: 1px solid #9370db80;",
link: "color: #9370db; text-decoration: none; background-image: linear-gradient(to right, #9370db80, #b19cd980); background-size: 0% 1px; background-repeat: no-repeat; background-position: 0 100%; transition: all 0.3s ease; text-shadow: 0 2px 4px rgba(147,112,219,0.1);",
table: {
container: "width: 100%; margin: 1.5em 0; border-collapse: separate; border-spacing: 0; border-radius: 14px; overflow: hidden; border: 1px solid #9370db80; box-shadow: 0 4px 12px rgba(147,112,219,0.15);",
header: "background: linear-gradient(135deg, #252640, #0d0f1a); font-weight: 700; color: #9370db; padding: 14px; border-bottom: 2px solid #9370db80;",
cell: "padding: 14px; color: #d8cef6; border-top: 1px solid #9370db80;"
},
hr: "border: none; border-top: 2px solid #9370db80; margin: 32px 0; box-shadow: 0 2px 8px rgba(147,112,219,0.15);",
footnote: {
ref: "color: #b19cd9; text-decoration: none; font-size: 0.9em;",
backref: "color: #b19cd9; text-decoration: none; font-size: 0.9em;"
}
}
};
}
});
// src/templates/metal.json
var require_metal = __commonJS({
"src/templates/metal.json"(exports, module2) {
module2.exports = {
id: "metal",
name: "\u91D1\u5C5E\u79D1\u6280",
styles: {
imagePreview: "background-color: #1e2228; padding: 32px 28px;",
header: {
avatar: {
container: "width: 40px; height: 40px; border-radius: 4px; overflow: hidden; box-shadow: 0 4px 16px rgba(192,192,192,0.3); border: 1px solid #4d4d4d80;",
placeholder: "background: #282c34; transition: all 0.3s ease;",
image: "object-fit: cover; transition: transform 0.3s ease; filter: contrast(1.1) saturate(1.2);"
},
nameContainer: "display: flex; align-items: center; gap: 10px;",
userName: "font-size: 16px; font-weight: 700; color: #f0f0f0; text-shadow: 0 2px 4px rgba(0,0,0,0.3);",
userId: "font-size: 14px; color: #a0a0a0; font-family: 'SF Pro Display';",
postTime: "font-size: 13px; color: #808080; letter-spacing: 0.03em;",
verifiedIcon: "width: 20px; height: 20px; margin-left: -5px; fill: #1DA1F2;"
},
footer: {
container: "position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px; color: #a0a0a0; font-size: 13px; border-top: 1px solid #4d4d4d80; background: rgba(30,34,40,0.95); backdrop-filter: blur(12px);",
text: "color: inherit; transition: color 0.2s ease; white-space: nowrap;",
separator: "color: #808080;"
},
title: {
h2: {
base: "margin: 0; font-size: 1.5em; letter-spacing: -0.01em; line-height: 1.5;",
content: "font-weight: 700; color: #f0f0f0; text-shadow: 0 2px 4px rgba(0,0,0,0.3);",
after: ""
},
h3: {
base: "margin: 28px 0 0; font-size: 1.25em; line-height: 1.5;",
content: "font-weight: 700; color: #f0f0f0;",
after: ""
},
base: {
base: "margin: 24px 0 0; font-size: 1.1em; line-height: 1.5;",
content: "font-weight: 700; color: #f0f0f0;",
after: ""
}
},
paragraph: "line-height: 1.8; margin-bottom: 1.1em; font-size: 15px; color: #e0e0e0;",
emphasis: {
strong: "font-weight: 700; color: #4d8ee7; text-shadow: 0 2px 4px rgba(77,142,231,0.2);",
em: "font-style: normal; color: #a0a0a0; background: rgba(160,160,160,0.1); padding: 0 4px; border-left: 2px solid #4d4d4d80;",
del: "text-decoration: line-through; color: #808080; opacity: 0.8;"
},
list: {
container: "padding-left: 26px; margin-bottom: 1.2em; color: #c0c0c0;",
item: "margin-bottom: 0.7em; font-size: 15px; color: #c0c0c0; line-height: 1.75;",
taskList: "list-style: none; margin-left: -22px; font-size: 15px; color: #c0c0c0; line-height: 1.75;"
},
code: {
block: "background: #282c34; padding: 1.2em; border-radius: 4px; font-size: 14px; font-family: 'JetBrains Mono', monospace; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; color: #e0e0e0; margin: 1.5em 0; border: 1px solid #4d4d4d80; box-shadow: inset 0 4px 12px rgba(0,0,0,0.2);",
inline: "background: #282c34; padding: 4px 10px; border-radius: 2px; color: #e0e0e0; font-size: 14px; font-family: 'JetBrains Mono', monospace; border: 1px solid #4d4d4d80;"
},
quote: "border-left: 3px solid #4d8ee7; padding: 0 0 0 20px; margin: 1.5em 0; color: #a0a0a0; font-style: normal; font-size: 15px; line-height: 1.75; background: linear-gradient(to right, rgba(77,142,231,0.1), transparent);",
image: "max-width: 100%; height: auto; margin: 1.5em auto; border-radius: 4px; box-shadow: 0 8px 24px rgba(0,0,0,0.3); border: 1px solid #4d4d4d80;",
link: "color: #4d8ee7; text-decoration: none; border-bottom: 1px solid #4d8ee780; transition: all 0.2s ease; text-shadow: 0 2px 4px rgba(77,142,231,0.1);",
table: {
container: "width: 100%; margin: 1.5em 0; border-collapse: separate; border-spacing: 0; border-radius: 4px; overflow: hidden; border: 1px solid #4d4d4d80; box-shadow: 0 4px 12px rgba(0,0,0,0.2);",
header: "background: linear-gradient(135deg, #282c34, #1e2228); font-weight: 700; color: #4d8ee7; padding: 14px; border-bottom: 2px solid #4d4d4d80;",
cell: "padding: 14px; color: #c0c0c0; border-top: 1px solid #4d4d4d80;"
},
hr: "border: none; border-top: 2px solid #4d4d4d80; margin: 32px 0; box-shadow: 0 2px 8px rgba(0,0,0,0.3);",
footnote: {
ref: "color: #a0a0a0; text-decoration: none; font-size: 0.9em;",
backref: "color: #a0a0a0; text-decoration: none; font-size: 0.9em;"
}
}
};
}
});
// src/templates/yueling.json
var require_yueling = __commonJS({
"src/templates/yueling.json"(exports, module2) {
module2.exports = {
id: "yueling",
name: "\u60A6\u7075\u96C5\u68D5",
styles: {
imagePreview: "background-color: #1c1c1e; padding: 28px 24px;",
header: {
avatar: {
container: "width: 40px; height: 40px; border-radius: 12px; overflow: hidden;",
placeholder: "background: #2c2c2e; transition: all 0.3s ease;",
image: "object-fit: cover; transition: transform 0.3s ease;"
},
nameContainer: "display: flex; align-items: center; gap: 8px;",
userName: "font-size: 16px; font-weight: 600; color: #ffffff;",
userId: "font-size: 14px; color: #98989d;",
postTime: "font-size: 13px; color: #636366;",
verifiedIcon: "width: 20px; height: 20px; margin-left: -5px; fill: #1DA1F2;"
},
footer: {
container: "position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px; color: #98989d; font-size: 13px; border-top: 1px solid #2c2c2e; background: #1c1c1e;",
text: "color: inherit; transition: color 0.2s ease; white-space: nowrap;",
separator: "color: #636366;"
},
title: {
h2: {
base: "margin: 0; font-size: 1.5em; letter-spacing: -0.01em; line-height: 1.5;",
content: "font-weight: 600; color: #f2f2f7;",
after: ""
},
h3: {
base: "margin: 26px 0 0; font-size: 1.25em; line-height: 1.5;",
content: "font-weight: 600; color: #f2f2f7;",
after: ""
},
base: {
base: "margin: 22px 0 0; font-size: 1.1em; line-height: 1.5;",
content: "font-weight: 600; color: #f2f2f7;",
after: ""
}
},
paragraph: "line-height: 1.8; margin-bottom: 1.1em; font-size: 15px; color: #ffffff;",
emphasis: {
strong: "font-weight: 700; color: #c57512;",
em: "font-style: italic; color: #c57512;",
del: "text-decoration: line-through; color: #636366;"
},
list: {
container: "padding-left: 26px; margin-bottom: 1.1em; color: #d1d1d6;",
item: "margin-bottom: 0.7em; font-size: 15px; color: #d1d1d6; line-height: 1.75;",
taskList: "list-style: none; margin-left: -22px; font-size: 15px; color: #d1d1d6; line-height: 1.75;"
},
code: {
block: "background: #2c2c2e; padding: 1em 1.2em; border-radius: 12px; font-size: 14px; font-family: SF Mono, Menlo, monospace; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; color: #ffffff; margin: 1.3em 0;",
inline: "background: #2c2c2e; padding: 3px 8px; border-radius: 6px; color: #ffffff; font-size: 14px; font-family: SF Mono, Menlo, monospace;"
},
quote: "border-left: 3px solid #c57512; padding: 0 0 0 18px; margin: 1.2em 0; color: #f2f2f7; font-style: normal; font-size: 15px; line-height: 1.75;",
image: "max-width: 100%; height: auto; margin: 1.3em auto; border-radius: 12px;",
link: "color: #c57512; text-decoration: underline; text-underline-offset: 2px; transition: opacity 0.2s ease;",
table: {
container: "width: 100%; margin: 1.3em 0; border-collapse: separate; border-spacing: 0; border-radius: 12px; overflow: hidden; border: 1px solid #2c2c2e;",
header: "background: #2c2c2e; font-weight: 600; color: #f2f2f7; padding: 12px;",
cell: "padding: 12px; color: #d1d1d6; border-top: 1px solid #2c2c2e;"
},
hr: "border: none; border-top: 1px solid #2c2c2e; margin: 26px 0;",
footnote: {
ref: "color: #98989d; text-decoration: none; font-size: 0.9em;",
backref: "color: #98989d; text-decoration: none; font-size: 0.9em;"
}
}
};
}
});
// src/templates/index.ts
var templates_exports = {};
__export(templates_exports, {
templates: () => templates
});
var defaultTemplate, minimalTemplate, elegantTemplate, cyberTemplate, warmTemplate, forestTemplate, oceanTemplate, sakuraTemplate, starryTemplate, metalTemplate, yuelingTemplate, templates;
var init_templates = __esm({
"src/templates/index.ts"() {
defaultTemplate = require_default();
minimalTemplate = require_minimal();
elegantTemplate = require_elegant();
cyberTemplate = require_cyber();
warmTemplate = require_warm();
forestTemplate = require_forest();
oceanTemplate = require_ocean();
sakuraTemplate = require_sakura();
starryTemplate = require_starry();
metalTemplate = require_metal();
yuelingTemplate = require_yueling();
templates = {
default: defaultTemplate,
minimal: minimalTemplate,
elegant: elegantTemplate,
cyber: cyberTemplate,
warm: warmTemplate,
forest: forestTemplate,
ocean: oceanTemplate,
sakura: sakuraTemplate,
starry: starryTemplate,
metal: metalTemplate,
yueling: yuelingTemplate
};
}
});
// src/main.ts
var main_exports = {};
__export(main_exports, {
default: () => RedPlugin
});
module.exports = __toCommonJS(main_exports);
var import_obsidian9 = require("obsidian");
// src/view.ts
var import_obsidian3 = require("obsidian");
// src/converter.ts
var RedConverter = class {
static initialize(app, plugin) {
this.app = app;
this.plugin = plugin;
}
static hasValidContent(element) {
var _a, _b;
const settings = (_b = (_a = this.plugin) == null ? void 0 : _a.settingsManager) == null ? void 0 : _b.getSettings();
const headingLevel = (settings == null ? void 0 : settings.headingLevel) || "h1";
const headers = element.querySelectorAll(headingLevel);
return headers.length > 0;
}
static formatContent(element) {
var _a, _b;
const settings = (_b = (_a = this.plugin) == null ? void 0 : _a.settingsManager) == null ? void 0 : _b.getSettings();
const headingLevel = (settings == null ? void 0 : settings.headingLevel) || "h1";
const headers = Array.from(element.querySelectorAll(headingLevel));
if (headers.length === 0) {
element.empty();
const tip = element.createEl("div", {
cls: "red-empty-message",
text: `\u26A0\uFE0F \u6E29\u99A8\u63D0\u793A
\u8BF7\u4F7F\u7528${headingLevel === "h1" ? "\u4E00\u7EA7\u6807\u9898(#)" : "\u4E8C\u7EA7\u6807\u9898(##)"}\u6765\u5206\u5272\u5185\u5BB9
\u6BCF\u4E2A${headingLevel === "h1" ? "\u4E00\u7EA7\u6807\u9898" : "\u4E8C\u7EA7\u6807\u9898"}\u5C06\u751F\u6210\u4E00\u5F20\u72EC\u7ACB\u7684\u56FE\u7247
\u73B0\u5728\u7F16\u8F91\u6587\u6863\uFF0C\u5B9E\u65F6\u9884\u89C8\u6548\u679C`
});
element.dispatchEvent(new CustomEvent("content-validation-change", {
detail: { isValid: false },
bubbles: true
}));
return;
}
element.dispatchEvent(new CustomEvent("content-validation-change", {
detail: { isValid: true },
bubbles: true
}));
const previewContainer = document.createElement("div");
previewContainer.className = "red-preview-container";
const imagePreview = document.createElement("div");
imagePreview.className = "red-image-preview";
const copyButton = document.createElement("button");
copyButton.className = "red-copy-button";
copyButton.innerHTML = '<?xml version="1.0" encoding="UTF-8"?><svg width="20" height="20" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M13 12.4316V7.8125C13 6.2592 14.2592 5 15.8125 5H40.1875C41.7408 5 43 6.2592 43 7.8125V32.1875C43 33.7408 41.7408 35 40.1875 35H35.5163" stroke="#9b9b9b" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M32.1875 13H7.8125C6.2592 13 5 14.2592 5 15.8125V40.1875C5 41.7408 6.2592 43 7.8125 43H32.1875C33.7408 43 35 41.7408 35 40.1875V15.8125C35 14.2592 33.7408 13 32.1875 13Z" fill="none" stroke="#9b9b9b" stroke-width="4" stroke-linejoin="round"/></svg>';
copyButton.title = "\u590D\u5236\u56FE\u7247";
copyButton.setAttribute("aria-label", "\u590D\u5236\u56FE\u7247\u5230\u526A\u8D34\u677F");
previewContainer.appendChild(copyButton);
const headerArea = document.createElement("div");
headerArea.className = "red-preview-header";
const contentArea = document.createElement("div");
contentArea.className = "red-preview-content";
const footerArea = document.createElement("div");
footerArea.className = "red-preview-footer";
const contentContainer = document.createElement("div");
contentContainer.className = "red-content-container";
headers.forEach((header, index) => {
const section = this.createContentSection(header, index);
if (section) {
contentContainer.appendChild(section);
}
});
contentArea.appendChild(contentContainer);
imagePreview.appendChild(headerArea);
imagePreview.appendChild(contentArea);
imagePreview.appendChild(footerArea);
previewContainer.appendChild(imagePreview);
element.empty();
element.appendChild(previewContainer);
const copyEvent = new CustomEvent("copy-button-added", {
detail: { copyButton },
bubbles: true
});
element.dispatchEvent(copyEvent);
}
static createContentSection(header, index) {
var _a, _b;
const settings = (_b = (_a = this.plugin) == null ? void 0 : _a.settingsManager) == null ? void 0 : _b.getSettings();
const headingLevel = (settings == null ? void 0 : settings.headingLevel) || "h1";
let content = [];
let current = header.nextElementSibling;
while (current && current.tagName !== headingLevel.toUpperCase()) {
content.push(current.cloneNode(true));
current = current.nextElementSibling;
}
const pages = [[]];
let currentPage = 0;
content.forEach((el) => {
if (el.tagName === "HR") {
currentPage++;
pages[currentPage] = [];
} else {
if (!pages[currentPage]) {
pages[currentPage] = [];
}
pages[currentPage].push(el);
}
});
if (pages.length === 1 && !content.some((el) => el.tagName === "HR")) {
const section = document.createElement("section");
section.className = "red-content-section";
section.setAttribute("data-index", index.toString());
section.appendChild(header.cloneNode(true));
content.forEach((el) => section.appendChild(el));
this.processElements(section);
return section;
} else {
const fragment = document.createDocumentFragment();
pages.forEach((pageContent, pageIndex) => {
if (pageContent.length === 0)
return;
const section = document.createElement("section");
section.className = "red-content-section";
section.setAttribute("data-index", `${index}-${pageIndex}`);
section.appendChild(header.cloneNode(true));
pageContent.forEach((el) => section.appendChild(el));
this.processElements(section);
fragment.appendChild(section);
});
return fragment;
}
}
static processElements(container) {
if (!container)
return;
container.querySelectorAll("strong, em").forEach((el) => {
el.classList.add("red-emphasis");
});
container.querySelectorAll("a").forEach((el) => {
el.classList.add("red-link");
});
container.querySelectorAll("table").forEach((el) => {
if (el === container.closest("table"))
return;
el.classList.add("red-table");
});
container.querySelectorAll("hr").forEach((el) => {
el.classList.add("red-hr");
});
container.querySelectorAll("del").forEach((el) => {
el.classList.add("red-del");
});
container.querySelectorAll(".task-list-item").forEach((el) => {
el.classList.add("red-task-list-item");
});
container.querySelectorAll(".footnote-ref, .footnote-backref").forEach((el) => {
el.classList.add("red-footnote");
});
container.querySelectorAll("pre code").forEach((el) => {
const pre = el.parentElement;
if (pre) {
pre.classList.add("red-pre");
const dots = document.createElement("div");
dots.className = "red-code-dots";
["red", "yellow", "green"].forEach((color) => {
const dot = document.createElement("span");
dot.className = `red-code-dot red-code-dot-${color}`;
dots.appendChild(dot);
});
pre.insertBefore(dots, pre.firstChild);
const copyButton = pre.querySelector(".copy-code-button");
if (copyButton) {
copyButton.remove();
}
}
});
container.querySelectorAll("span.internal-embed[alt][src]").forEach(async (el) => {
var _a;
const originalSpan = el;
const src = originalSpan.getAttribute("src");
const alt = originalSpan.getAttribute("alt");
if (!src)
return;
try {
const linktext = src.split("|")[0];
const file = this.app.metadataCache.getFirstLinkpathDest(linktext, "");
if (file) {
const absolutePath = this.app.vault.adapter.getResourcePath(file.path);
const newImg = document.createElement("img");
newImg.src = absolutePath;
if (alt)
newImg.alt = alt;
newImg.className = "red-image";
(_a = originalSpan.parentNode) == null ? void 0 : _a.replaceChild(newImg, originalSpan);
}
} catch (error) {
console.error("\u56FE\u7247\u5904\u7406\u5931\u8D25:", error);
}
});
container.querySelectorAll("blockquote").forEach((el) => {
el.classList.add("red-blockquote");
el.querySelectorAll("p").forEach((p) => {
p.classList.add("red-blockquote-p");
});
});
}
};
// node_modules/html-to-image/es/util.js
function resolveUrl(url, baseUrl) {
if (url.match(/^[a-z]+:\/\//i)) {
return url;
}
if (url.match(/^\/\//)) {
return window.location.protocol + url;
}
if (url.match(/^[a-z]+:/i)) {
return url;
}
const doc = document.implementation.createHTMLDocument();
const base = doc.createElement("base");
const a = doc.createElement("a");
doc.head.appendChild(base);
doc.body.appendChild(a);
if (baseUrl) {
base.href = baseUrl;
}
a.href = url;
return a.href;
}
var uuid = (() => {
let counter = 0;
const random = () => (
// eslint-disable-next-line no-bitwise
`0000${(Math.random() * 36 ** 4 << 0).toString(36)}`.slice(-4)
);
return () => {
counter += 1;
return `u${random()}${counter}`;
};
})();
function toArray(arrayLike) {
const arr = [];
for (let i = 0, l = arrayLike.length; i < l; i++) {
arr.push(arrayLike[i]);
}
return arr;
}
var styleProps = null;
function getStyleProperties(options = {}) {
if (styleProps) {
return styleProps;
}
if (options.includeStyleProperties) {
styleProps = options.includeStyleProperties;
return styleProps;
}
styleProps = toArray(window.getComputedStyle(document.documentElement));
return styleProps;
}
function px(node, styleProperty) {
const win = node.ownerDocument.defaultView || window;
const val = win.getComputedStyle(node).getPropertyValue(styleProperty);
return val ? parseFloat(val.replace("px", "")) : 0;
}
function getNodeWidth(node) {
const leftBorder = px(node, "border-left-width");
const rightBorder = px(node, "border-right-width");
return node.clientWidth + leftBorder + rightBorder;
}
function getNodeHeight(node) {
const topBorder = px(node, "border-top-width");
const bottomBorder = px(node, "border-bottom-width");
return node.clientHeight + topBorder + bottomBorder;
}
function getImageSize(targetNode, options = {}) {
const width = options.width || getNodeWidth(targetNode);
const height = options.height || getNodeHeight(targetNode);
return { width, height };
}
function getPixelRatio() {
let ratio;
let FINAL_PROCESS;
try {
FINAL_PROCESS = process;
} catch (e) {
}
const val = FINAL_PROCESS && FINAL_PROCESS.env ? FINAL_PROCESS.env.devicePixelRatio : null;
if (val) {
ratio = parseInt(val, 10);
if (Number.isNaN(ratio)) {
ratio = 1;
}
}
return ratio || window.devicePixelRatio || 1;
}
var canvasDimensionLimit = 16384;
function checkCanvasDimensions(canvas) {
if (canvas.width > canvasDimensionLimit || canvas.height > canvasDimensionLimit) {
if (canvas.width > canvasDimensionLimit && canvas.height > canvasDimensionLimit) {
if (canvas.width > canvas.height) {
canvas.height *= canvasDimensionLimit / canvas.width;
canvas.width = canvasDimensionLimit;
} else {
canvas.width *= canvasDimensionLimit / canvas.height;
canvas.height = canvasDimensionLimit;
}
} else if (canvas.width > canvasDimensionLimit) {
canvas.height *= canvasDimensionLimit / canvas.width;
canvas.width = canvasDimensionLimit;
} else {
canvas.width *= canvasDimensionLimit / canvas.height;
canvas.height = canvasDimensionLimit;
}
}
}
function canvasToBlob(canvas, options = {}) {
if (canvas.toBlob) {
return new Promise((resolve) => {
canvas.toBlob(resolve, options.type ? options.type : "image/png", options.quality ? options.quality : 1);
});
}
return new Promise((resolve) => {
const binaryString = window.atob(canvas.toDataURL(options.type ? options.type : void 0, options.quality ? options.quality : void 0).split(",")[1]);
const len = binaryString.length;
const binaryArray = new Uint8Array(len);
for (let i = 0; i < len; i += 1) {
binaryArray[i] = binaryString.charCodeAt(i);
}
resolve(new Blob([binaryArray], {
type: options.type ? options.type : "image/png"
}));
});
}
function createImage(url) {
return new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => {
img.decode().then(() => {
requestAnimationFrame(() => resolve(img));
});
};
img.onerror = reject;
img.crossOrigin = "anonymous";
img.decoding = "async";
img.src = url;
});
}
async function svgToDataURL(svg) {
return Promise.resolve().then(() => new XMLSerializer().serializeToString(svg)).then(encodeURIComponent).then((html) => `data:image/svg+xml;charset=utf-8,${html}`);
}
async function nodeToDataURL(node, width, height) {
const xmlns = "http://www.w3.org/2000/svg";
const svg = document.createElementNS(xmlns, "svg");
const foreignObject = document.createElementNS(xmlns, "foreignObject");
svg.setAttribute("width", `${width}`);
svg.setAttribute("height", `${height}`);
svg.setAttribute("viewBox", `0 0 ${width} ${height}`);
foreignObject.setAttribute("width", "100%");
foreignObject.setAttribute("height", "100%");
foreignObject.setAttribute("x", "0");
foreignObject.setAttribute("y", "0");
foreignObject.setAttribute("externalResourcesRequired", "true");
svg.appendChild(foreignObject);
foreignObject.appendChild(node);
return svgToDataURL(svg);
}
var isInstanceOfElement = (node, instance) => {
if (node instanceof instance)
return true;
const nodePrototype = Object.getPrototypeOf(node);
if (nodePrototype === null)
return false;
return nodePrototype.constructor.name === instance.name || isInstanceOfElement(nodePrototype, instance);
};
// node_modules/html-to-image/es/clone-pseudos.js
function formatCSSText(style) {
const content = style.getPropertyValue("content");
return `${style.cssText} content: '${content.replace(/'|"/g, "")}';`;
}
function formatCSSProperties(style, options) {
return getStyleProperties(options).map((name) => {
const value = style.getPropertyValue(name);
const priority = style.getPropertyPriority(name);
return `${name}: ${value}${priority ? " !important" : ""};`;
}).join(" ");
}
function getPseudoElementStyle(className, pseudo, style, options) {
const selector = `.${className}:${pseudo}`;
const cssText = style.cssText ? formatCSSText(style) : formatCSSProperties(style, options);
return document.createTextNode(`${selector}{${cssText}}`);
}
function clonePseudoElement(nativeNode, clonedNode, pseudo, options) {
const style = window.getComputedStyle(nativeNode, pseudo);
const content = style.getPropertyValue("content");
if (content === "" || content === "none") {
return;
}
const className = uuid();
try {
clonedNode.className = `${clonedNode.className} ${className}`;
} catch (err) {
return;
}
const styleElement = document.createElement("style");
styleElement.appendChild(getPseudoElementStyle(className, pseudo, style, options));
clonedNode.appendChild(styleElement);
}
function clonePseudoElements(nativeNode, clonedNode, options) {
clonePseudoElement(nativeNode, clonedNode, ":before", options);
clonePseudoElement(nativeNode, clonedNode, ":after", options);
}
// node_modules/html-to-image/es/mimes.js
var WOFF = "application/font-woff";
var JPEG = "image/jpeg";
var mimes = {
woff: WOFF,
woff2: WOFF,
ttf: "application/font-truetype",
eot: "application/vnd.ms-fontobject",
png: "image/png",
jpg: JPEG,
jpeg: JPEG,
gif: "image/gif",
tiff: "image/tiff",
svg: "image/svg+xml",
webp: "image/webp"
};
function getExtension(url) {
const match = /\.([^./]*?)$/g.exec(url);
return match ? match[1] : "";
}
function getMimeType(url) {
const extension = getExtension(url).toLowerCase();
return mimes[extension] || "";
}
// node_modules/html-to-image/es/dataurl.js
function getContentFromDataUrl(dataURL) {
return dataURL.split(/,/)[1];
}
function isDataUrl(url) {
return url.search(/^(data:)/) !== -1;
}
function makeDataUrl(content, mimeType) {
return `data:${mimeType};base64,${content}`;
}
async function fetchAsDataURL(url, init, process2) {
const res = await fetch(url, init);
if (res.status === 404) {
throw new Error(`Resource "${res.url}" not found`);
}
const blob = await res.blob();
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onerror = reject;
reader.onloadend = () => {
try {
resolve(process2({ res, result: reader.result }));
} catch (error) {
reject(error);
}
};
reader.readAsDataURL(blob);
});
}
var cache = {};
function getCacheKey(url, contentType, includeQueryParams) {
let key = url.replace(/\?.*/, "");
if (includeQueryParams) {
key = url;
}
if (/ttf|otf|eot|woff2?/i.test(key)) {
key = key.replace(/.*\//, "");
}
return contentType ? `[${contentType}]${key}` : key;
}
async function resourceToDataURL(resourceUrl, contentType, options) {
const cacheKey = getCacheKey(resourceUrl, contentType, options.includeQueryParams);
if (cache[cacheKey] != null) {
return cache[cacheKey];
}
if (options.cacheBust) {
resourceUrl += (/\?/.test(resourceUrl) ? "&" : "?") + new Date().getTime();
}
let dataURL;
try {
const content = await fetchAsDataURL(resourceUrl, options.fetchRequestInit, ({ res, result }) => {
if (!contentType) {
contentType = res.headers.get("Content-Type") || "";
}
return getContentFromDataUrl(result);
});
dataURL = makeDataUrl(content, contentType);
} catch (error) {
dataURL = options.imagePlaceholder || "";
let msg = `Failed to fetch resource: ${resourceUrl}`;
if (error) {
msg = typeof error === "string" ? error : error.message;
}
if (msg) {
console.warn(msg);
}
}
cache[cacheKey] = dataURL;
return dataURL;
}
// node_modules/html-to-image/es/clone-node.js
async function cloneCanvasElement(canvas) {
const dataURL = canvas.toDataURL();
if (dataURL === "data:,") {
return canvas.cloneNode(false);
}
return createImage(dataURL);
}
async function cloneVideoElement(video, options) {
if (video.currentSrc) {
const canvas = document.createElement("canvas");
const ctx = canvas.getContext("2d");
canvas.width = video.clientWidth;
canvas.height = video.clientHeight;
ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
const dataURL2 = canvas.toDataURL();
return createImage(dataURL2);
}
const poster = video.poster;
const contentType = getMimeType(poster);
const dataURL = await resourceToDataURL(poster, contentType, options);
return createImage(dataURL);
}
async function cloneIFrameElement(iframe, options) {
var _a;
try {
if ((_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentDocument) === null || _a === void 0 ? void 0 : _a.body) {
return await cloneNode(iframe.contentDocument.body, options, true);
}
} catch (_b) {
}
return iframe.cloneNode(false);
}
async function cloneSingleNode(node, options) {
if (isInstanceOfElement(node, HTMLCanvasElement)) {
return cloneCanvasElement(node);
}
if (isInstanceOfElement(node, HTMLVideoElement)) {
return cloneVideoElement(node, options);
}
if (isInstanceOfElement(node, HTMLIFrameElement)) {
return cloneIFrameElement(node, options);
}
return node.cloneNode(isSVGElement(node));
}
var isSlotElement = (node) => node.tagName != null && node.tagName.toUpperCase() === "SLOT";
var isSVGElement = (node) => node.tagName != null && node.tagName.toUpperCase() === "SVG";
async function cloneChildren(nativeNode, clonedNode, options) {
var _a, _b;
if (isSVGElement(clonedNode)) {
return clonedNode;
}
let children = [];
if (isSlotElement(nativeNode) && nativeNode.assignedNodes) {
children = toArray(nativeNode.assignedNodes());
} else if (isInstanceOfElement(nativeNode, HTMLIFrameElement) && ((_a = nativeNode.contentDocument) === null || _a === void 0 ? void 0 : _a.body)) {
children = toArray(nativeNode.contentDocument.body.childNodes);
} else {
children = toArray(((_b = nativeNode.shadowRoot) !== null && _b !== void 0 ? _b : nativeNode).childNodes);
}
if (children.length === 0 || isInstanceOfElement(nativeNode, HTMLVideoElement)) {
return clonedNode;
}
await children.reduce((deferred, child) => deferred.then(() => cloneNode(child, options)).then((clonedChild) => {
if (clonedChild) {
clonedNode.appendChild(clonedChild);
}
}), Promise.resolve());
return clonedNode;
}
function cloneCSSStyle(nativeNode, clonedNode, options) {
const targetStyle = clonedNode.style;
if (!targetStyle) {
return;
}
const sourceStyle = window.getComputedStyle(nativeNode);
if (sourceStyle.cssText) {
targetStyle.cssText = sourceStyle.cssText;
targetStyle.transformOrigin = sourceStyle.transformOrigin;
} else {
getStyleProperties(options).forEach((name) => {
let value = sourceStyle.getPropertyValue(name);
if (name === "font-size" && value.endsWith("px")) {
const reducedFont = Math.floor(parseFloat(value.substring(0, value.length - 2))) - 0.1;
value = `${reducedFont}px`;
}
if (isInstanceOfElement(nativeNode, HTMLIFrameElement) && name === "display" && value === "inline") {
value = "block";
}
if (name === "d" && clonedNode.getAttribute("d")) {
value = `path(${clonedNode.getAttribute("d")})`;
}
targetStyle.setProperty(name, value, sourceStyle.getPropertyPriority(name));
});
}
}
function cloneInputValue(nativeNode, clonedNode) {
if (isInstanceOfElement(nativeNode, HTMLTextAreaElement)) {
clonedNode.innerHTML = nativeNode.value;
}
if (isInstanceOfElement(nativeNode, HTMLInputElement)) {
clonedNode.setAttribute("value", nativeNode.value);
}
}
function cloneSelectValue(nativeNode, clonedNode) {
if (isInstanceOfElement(nativeNode, HTMLSelectElement)) {
const clonedSelect = clonedNode;
const selectedOption = Array.from(clonedSelect.children).find((child) => nativeNode.value === child.getAttribute("value"));
if (selectedOption) {
selectedOption.setAttribute("selected", "");
}
}
}
function decorate(nativeNode, clonedNode, options) {
if (isInstanceOfElement(clonedNode, Element)) {
cloneCSSStyle(nativeNode, clonedNode, options);
clonePseudoElements(nativeNode, clonedNode, options);
cloneInputValue(nativeNode, clonedNode);
cloneSelectValue(nativeNode, clonedNode);
}
return clonedNode;
}
async function ensureSVGSymbols(clone, options) {
const uses = clone.querySelectorAll ? clone.querySelectorAll("use") : [];
if (uses.length === 0) {
return clone;
}
const processedDefs = {};
for (let i = 0; i < uses.length; i++) {
const use = uses[i];
const id = use.getAttribute("xlink:href");
if (id) {
const exist = clone.querySelector(id);
const definition = document.querySelector(id);
if (!exist && definition && !processedDefs[id]) {
processedDefs[id] = await cloneNode(definition, options, true);
}
}
}
const nodes = Object.values(processedDefs);
if (nodes.length) {
const ns = "http://www.w3.org/1999/xhtml";
const svg = document.createElementNS(ns, "svg");
svg.setAttribute("xmlns", ns);
svg.style.position = "absolute";
svg.style.width = "0";
svg.style.height = "0";
svg.style.overflow = "hidden";
svg.style.display = "none";
const defs = document.createElementNS(ns, "defs");
svg.appendChild(defs);
for (let i = 0; i < nodes.length; i++) {
defs.appendChild(nodes[i]);
}
clone.appendChild(svg);
}
return clone;
}
async function cloneNode(node, options, isRoot) {
if (!isRoot && options.filter && !options.filter(node)) {
return null;
}
return Promise.resolve(node).then((clonedNode) => cloneSingleNode(clonedNode, options)).then((clonedNode) => cloneChildren(node, clonedNode, options)).then((clonedNode) => decorate(node, clonedNode, options)).then((clonedNode) => ensureSVGSymbols(clonedNode, options));
}
// node_modules/html-to-image/es/embed-resources.js
var URL_REGEX = /url\((['"]?)([^'"]+?)\1\)/g;
var URL_WITH_FORMAT_REGEX = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g;
var FONT_SRC_REGEX = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
function toRegex(url) {
const escaped = url.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
return new RegExp(`(url\\(['"]?)(${escaped})(['"]?\\))`, "g");
}
function parseURLs(cssText) {
const urls = [];
cssText.replace(URL_REGEX, (raw, quotation, url) => {
urls.push(url);
return raw;
});
return urls.filter((url) => !isDataUrl(url));
}
async function embed(cssText, resourceURL, baseURL, options, getContentFromUrl) {
try {
const resolvedURL = baseURL ? resolveUrl(resourceURL, baseURL) : resourceURL;
const contentType = getMimeType(resourceURL);
let dataURL;
if (getContentFromUrl) {
const content = await getContentFromUrl(resolvedURL);
dataURL = makeDataUrl(content, contentType);
} else {
dataURL = await resourceToDataURL(resolvedURL, contentType, options);
}
return cssText.replace(toRegex(resourceURL), `$1${dataURL}$3`);
} catch (error) {
}
return cssText;
}
function filterPreferredFontFormat(str, { preferredFontFormat }) {
return !preferredFontFormat ? str : str.replace(FONT_SRC_REGEX, (match) => {
while (true) {
const [src, , format] = URL_WITH_FORMAT_REGEX.exec(match) || [];
if (!format) {
return "";
}
if (format === preferredFontFormat) {
return `src: ${src};`;
}
}
});
}
function shouldEmbed(url) {
return url.search(URL_REGEX) !== -1;
}
async function embedResources(cssText, baseUrl, options) {
if (!shouldEmbed(cssText)) {
return cssText;
}
const filteredCSSText = filterPreferredFontFormat(cssText, options);
const urls = parseURLs(filteredCSSText);
return urls.reduce((deferred, url) => deferred.then((css) => embed(css, url, baseUrl, options)), Promise.resolve(filteredCSSText));
}
// node_modules/html-to-image/es/embed-images.js
async function embedProp(propName, node, options) {
var _a;
const propValue = (_a = node.style) === null || _a === void 0 ? void 0 : _a.getPropertyValue(propName);
if (propValue) {
const cssString = await embedResources(propValue, null, options);
node.style.setProperty(propName, cssString, node.style.getPropertyPriority(propName));
return true;
}
return false;
}
async function embedBackground(clonedNode, options) {
;
await embedProp("background", clonedNode, options) || await embedProp("background-image", clonedNode, options);
await embedProp("mask", clonedNode, options) || await embedProp("-webkit-mask", clonedNode, options) || await embedProp("mask-image", clonedNode, options) || await embedProp("-webkit-mask-image", clonedNode, options);
}
async function embedImageNode(clonedNode, options) {
const isImageElement = isInstanceOfElement(clonedNode, HTMLImageElement);
if (!(isImageElement && !isDataUrl(clonedNode.src)) && !(isInstanceOfElement(clonedNode, SVGImageElement) && !isDataUrl(clonedNode.href.baseVal))) {
return;
}
const url = isImageElement ? clonedNode.src : clonedNode.href.baseVal;
const dataURL = await resourceToDataURL(url, getMimeType(url), options);
await new Promise((resolve, reject) => {
clonedNode.onload = resolve;
clonedNode.onerror = options.onImageErrorHandler ? (...attributes) => {
try {
resolve(options.onImageErrorHandler(...attributes));
} catch (error) {
reject(error);
}
} : reject;
const image = clonedNode;
if (image.decode) {
image.decode = resolve;
}
if (image.loading === "lazy") {
image.loading = "eager";
}
if (isImageElement) {
clonedNode.srcset = "";
clonedNode.src = dataURL;
} else {
clonedNode.href.baseVal = dataURL;
}
});
}
async function embedChildren(clonedNode, options) {
const children = toArray(clonedNode.childNodes);
const deferreds = children.map((child) => embedImages(child, options));
await Promise.all(deferreds).then(() => clonedNode);
}
async function embedImages(clonedNode, options) {
if (isInstanceOfElement(clonedNode, Element)) {
await embedBackground(clonedNode, options);
await embedImageNode(clonedNode, options);
await embedChildren(clonedNode, options);
}
}
// node_modules/html-to-image/es/apply-style.js
function applyStyle(node, options) {
const { style } = node;
if (options.backgroundColor) {
style.backgroundColor = options.backgroundColor;
}
if (options.width) {
style.width = `${options.width}px`;
}
if (options.height) {
style.height = `${options.height}px`;
}
const manual = options.style;
if (manual != null) {
Object.keys(manual).forEach((key) => {
style[key] = manual[key];
});
}
return node;
}
// node_modules/html-to-image/es/embed-webfonts.js
var cssFetchCache = {};
async function fetchCSS(url) {
let cache2 = cssFetchCache[url];
if (cache2 != null) {
return cache2;
}
const res = await fetch(url);
const cssText = await res.text();
cache2 = { url, cssText };
cssFetchCache[url] = cache2;
return cache2;
}
async function embedFonts(data, options) {
let cssText = data.cssText;
const regexUrl = /url\(["']?([^"')]+)["']?\)/g;
const fontLocs = cssText.match(/url\([^)]+\)/g) || [];
const loadFonts = fontLocs.map(async (loc) => {
let url = loc.replace(regexUrl, "$1");
if (!url.startsWith("https://")) {
url = new URL(url, data.url).href;
}
return fetchAsDataURL(url, options.fetchRequestInit, ({ result }) => {
cssText = cssText.replace(loc, `url(${result})`);
return [loc, result];
});
});
return Promise.all(loadFonts).then(() => cssText);
}
function parseCSS(source) {
if (source == null) {
return [];
}
const result = [];
const commentsRegex = /(\/\*[\s\S]*?\*\/)/gi;
let cssText = source.replace(commentsRegex, "");
const keyframesRegex = new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})", "gi");
while (true) {
const matches = keyframesRegex.exec(cssText);
if (matches === null) {
break;
}
result.push(matches[0]);
}
cssText = cssText.replace(keyframesRegex, "");
const importRegex = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi;
const combinedCSSRegex = "((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})";
const unifiedRegex = new RegExp(combinedCSSRegex, "gi");
while (true) {
let matches = importRegex.exec(cssText);
if (matches === null) {
matches = unifiedRegex.exec(cssText);
if (matches === null) {
break;
} else {
importRegex.lastIndex = unifiedRegex.lastIndex;
}
} else {
unifiedRegex.lastIndex = importRegex.lastIndex;
}
result.push(matches[0]);
}
return result;
}
async function getCSSRules(styleSheets, options) {
const ret = [];
const deferreds = [];
styleSheets.forEach((sheet) => {
if ("cssRules" in sheet) {
try {
toArray(sheet.cssRules || []).forEach((item, index) => {
if (item.type === CSSRule.IMPORT_RULE) {
let importIndex = index + 1;
const url = item.href;
const deferred = fetchCSS(url).then((metadata) => embedFonts(metadata, options)).then((cssText) => parseCSS(cssText).forEach((rule) => {
try {
sheet.insertRule(rule, rule.startsWith("@import") ? importIndex += 1 : sheet.cssRules.length);
} catch (error) {
console.error("Error inserting rule from remote css", {
rule,
error
});
}
})).catch((e) => {
console.error("Error loading remote css", e.toString());
});
deferreds.push(deferred);
}
});
} catch (e) {
const inline = styleSheets.find((a) => a.href == null) || document.styleSheets[0];
if (sheet.href != null) {
deferreds.push(fetchCSS(sheet.href).then((metadata) => embedFonts(metadata, options)).then((cssText) => parseCSS(cssText).forEach((rule) => {
inline.insertRule(rule, inline.cssRules.length);
})).catch((err) => {
console.error("Error loading remote stylesheet", err);
}));
}
console.error("Error inlining remote css file", e);
}
}
});
return Promise.all(deferreds).then(() => {
styleSheets.forEach((sheet) => {
if ("cssRules" in sheet) {
try {
toArray(sheet.cssRules || []).forEach((item) => {
ret.push(item);
});
} catch (e) {
console.error(`Error while reading CSS rules from ${sheet.href}`, e);
}
}
});
return ret;
});
}
function getWebFontRules(cssRules) {
return cssRules.filter((rule) => rule.type === CSSRule.FONT_FACE_RULE).filter((rule) => shouldEmbed(rule.style.getPropertyValue("src")));
}
async function parseWebFontRules(node, options) {
if (node.ownerDocument == null) {
throw new Error("Provided element is not within a Document");
}
const styleSheets = toArray(node.ownerDocument.styleSheets);
const cssRules = await getCSSRules(styleSheets, options);
return getWebFontRules(cssRules);
}
function normalizeFontFamily(font) {
return font.trim().replace(/["']/g, "");
}
function getUsedFonts(node) {
const fonts = /* @__PURE__ */ new Set();
function traverse(node2) {
const fontFamily = node2.style.fontFamily || getComputedStyle(node2).fontFamily;
fontFamily.split(",").forEach((font) => {
fonts.add(normalizeFontFamily(font));
});
Array.from(node2.children).forEach((child) => {
if (child instanceof HTMLElement) {
traverse(child);
}
});
}
traverse(node);
return fonts;
}
async function getWebFontCSS(node, options) {
const rules = await parseWebFontRules(node, options);
const usedFonts = getUsedFonts(node);
const cssTexts = await Promise.all(rules.filter((rule) => usedFonts.has(normalizeFontFamily(rule.style.fontFamily))).map((rule) => {
const baseUrl = rule.parentStyleSheet ? rule.parentStyleSheet.href : null;
return embedResources(rule.cssText, baseUrl, options);
}));
return cssTexts.join("\n");
}
async function embedWebFonts(clonedNode, options) {
const cssText = options.fontEmbedCSS != null ? options.fontEmbedCSS : options.skipFonts ? null : await getWebFontCSS(clonedNode, options);
if (cssText) {
const styleNode = document.createElement("style");
const sytleContent = document.createTextNode(cssText);
styleNode.appendChild(sytleContent);
if (clonedNode.firstChild) {
clonedNode.insertBefore(styleNode, clonedNode.firstChild);
} else {
clonedNode.appendChild(styleNode);
}
}
}
// node_modules/html-to-image/es/index.js
async function toSvg(node, options = {}) {
const { width, height } = getImageSize(node, options);
const clonedNode = await cloneNode(node, options, true);
await embedWebFonts(clonedNode, options);
await embedImages(clonedNode, options);
applyStyle(clonedNode, options);
const datauri = await nodeToDataURL(clonedNode, width, height);
return datauri;
}
async function toCanvas(node, options = {}) {
const { width, height } = getImageSize(node, options);
const svg = await toSvg(node, options);
const img = await createImage(svg);
const canvas = document.createElement("canvas");
const context = canvas.getContext("2d");
const ratio = options.pixelRatio || getPixelRatio();
const canvasWidth = options.canvasWidth || width;
const canvasHeight = options.canvasHeight || height;
canvas.width = canvasWidth * ratio;
canvas.height = canvasHeight * ratio;
if (!options.skipAutoScale) {
checkCanvasDimensions(canvas);
}
canvas.style.width = `${canvasWidth}`;
canvas.style.height = `${canvasHeight}`;
if (options.backgroundColor) {
context.fillStyle = options.backgroundColor;
context.fillRect(0, 0, canvas.width, canvas.height);
}
context.drawImage(img, 0, 0, canvas.width, canvas.height);
return canvas;
}
async function toBlob(node, options = {}) {
const canvas = await toCanvas(node, options);
const blob = await canvasToBlob(canvas);
return blob;
}
// src/downloadManager.ts
var import_jszip = __toESM(require_jszip_min());
var DownloadManager = class {
// 添加共用的导出配置方法
static getExportConfig(imageElement) {
return {
quality: 1,
pixelRatio: 4,
skipFonts: false,
// 添加过滤器,确保所有元素都被包含
filter: (node) => {
return true;
},
// 处理图片加载错误
imagePlaceholder: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="
};
}
static async downloadAllImages(element) {
try {
const zip = new import_jszip.default();
const previewContainer = element.querySelector(".red-preview-container");
if (!previewContainer)
throw new Error("\u627E\u4E0D\u5230\u9884\u89C8\u5BB9\u5668");
const VISIBLE_CLASS = "red-section-visible";
const HIDDEN_CLASS = "red-section-hidden";
const sections = previewContainer.querySelectorAll(".red-content-section");
const totalSections = sections.length;
const originalVisibility = Array.from(sections).map((section) => ({
visible: section.classList.contains(VISIBLE_CLASS),
hidden: section.classList.contains(HIDDEN_CLASS)
}));
for (let i = 0; i < totalSections; i++) {
sections.forEach((section) => {
section.classList.add(HIDDEN_CLASS);
section.classList.remove(VISIBLE_CLASS);
});
sections[i].classList.remove(HIDDEN_CLASS);
sections[i].classList.add(VISIBLE_CLASS);
await new Promise((resolve) => setTimeout(resolve, 300));
const imageElement = element.querySelector(".red-image-preview");
try {
const blob = await toBlob(imageElement, this.getExportConfig(imageElement));
if (blob instanceof Blob) {
zip.file(`\u5C0F\u7EA2\u4E66\u7B14\u8BB0_\u7B2C${i + 1}\u9875.png`, blob);
} else {
throw new Error("\u751F\u6210\u7684\u4E0D\u662F\u6709\u6548\u7684 Blob \u5BF9\u8C61");
}
} catch (err) {
console.warn(`\u7B2C${i + 1}\u9875\u5BFC\u51FA\u5931\u8D25\uFF0C\u5C1D\u8BD5\u5907\u7528\u65B9\u6CD5`, err);
try {
const canvas = await toCanvas(imageElement, this.getExportConfig(imageElement));
const blob = await new Promise((resolve, reject) => {
canvas.toBlob((b) => {
if (b) {
resolve(b);
} else {
reject(new Error("Canvas \u8F6C\u6362\u4E3A Blob \u5931\u8D25"));
}
}, "image/png", 1);
});
zip.file(`\u5C0F\u7EA2\u4E66\u7B14\u8BB0_\u7B2C${i + 1}\u9875.png`, blob);
} catch (canvasErr) {
console.error(`\u7B2C${i + 1}\u9875\u5907\u7528\u5BFC\u51FA\u4E5F\u5931\u8D25`, canvasErr);
}
}
}
sections.forEach((section, index) => {
section.classList.toggle(VISIBLE_CLASS, originalVisibility[index].visible);
section.classList.toggle(HIDDEN_CLASS, originalVisibility[index].hidden);
});
const content = await zip.generateAsync({
type: "blob",
compression: "DEFLATE",
compressionOptions: {
level: 9
}
});
if (!(content instanceof Blob)) {
throw new Error("\u751F\u6210\u7684\u538B\u7F29\u6587\u4EF6\u4E0D\u662F\u6709\u6548\u7684 Blob \u5BF9\u8C61");
}
const url = URL.createObjectURL(content);
const link = Object.assign(document.createElement("a"), {
href: url,
download: `\u5C0F\u7EA2\u4E66\u7B14\u8BB0_${Date.now()}.zip`
});
link.click();
URL.revokeObjectURL(url);
} catch (error) {
console.error("\u5BFC\u51FA\u56FE\u7247\u5931\u8D25:", error);
throw error;
}
}
static async downloadSingleImage(element) {
try {
const imageElement = element.querySelector(".red-image-preview");
if (!imageElement) {
throw new Error("\u627E\u4E0D\u5230\u9884\u89C8\u533A\u57DF");
}
await new Promise((resolve) => setTimeout(resolve, 300));
try {
const blob = await toBlob(imageElement, this.getExportConfig(imageElement));
if (!blob)
throw new Error("Blob \u5BF9\u8C61\u4E3A\u7A7A");
const url = URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = url;
link.download = `\u5C0F\u7EA2\u4E66\u7B14\u8BB0_${new Date().getTime()}.png`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(url);
} catch (err) {
console.warn("\u5BFC\u51FA\u5931\u8D25\uFF0C\u5C1D\u8BD5\u5907\u7528\u65B9\u6CD5", err);
const canvas = await toCanvas(imageElement, this.getExportConfig(imageElement));
canvas.toBlob((blob) => {
if (!blob) {
throw new Error("Canvas \u8F6C\u6362\u4E3A Blob \u5931\u8D25");
}
const url = URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = url;
link.download = `\u5C0F\u7EA2\u4E66\u7B14\u8BB0_${new Date().getTime()}.png`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(url);
}, "image/png", 1);
}
} catch (error) {
console.error("\u5BFC\u51FA\u56FE\u7247\u5931\u8D25:", error);
throw error;
}
}
};
// src/assets/donateQR.ts
var DONATE_QR_BASE64 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAACOcAAAM/CAMAAACnbNSIAAAExWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSfvu78nIGlkPSdXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQnPz4KPHg6eG1wbWV0YSB4bWxuczp4PSdhZG9iZTpuczptZXRhLyc+CjxyZGY6UkRGIHhtbG5z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jcwtoANnvgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHiZmywyR85qoewCY38KWADF8+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGei9dp+sb4mAz0XrtP1jfEQtT7QtoANnvAA
// src/donateManager.ts
var DonateManager = class {
static initialize(app, plugin) {
this.app = app;
this.plugin = plugin;
}
static showDonateModal(container) {
this.overlay = container.createEl("div", {
cls: "mp-donate-overlay"
});
this.modal = this.overlay.createEl("div", {
cls: "mp-about-modal"
});
const closeButton = this.modal.createEl("button", {
cls: "mp-donate-close",
text: "\xD7"
});
const authorSection = this.modal.createEl("div", {
cls: "mp-about-section mp-about-intro-section"
});
authorSection.createEl("h4", {
text: "\u5173\u4E8E\u4F5C\u8005",
cls: "mp-about-title"
});
const introEl = authorSection.createEl("p", {
cls: "mp-about-intro"
});
introEl.appendText("\u4F60\u597D\uFF0C\u6211\u662F");
introEl.createEl("span", {
cls: "mp-about-name",
text: "\u3010\u591C\u534A\u3011"
});
introEl.appendText("\uFF0C\u4E00\u540D");
introEl.createEl("span", {
cls: "mp-about-identity",
text: "\u5168\u804C\u5199\u4F5C\u4E0E\u72EC\u7ACB\u5F00\u53D1\u8005"
});
introEl.appendText("\u3002");
const roleList = authorSection.createEl("div", {
cls: "mp-about-roles"
});
const roleEl = roleList.createEl("p", {
cls: "mp-about-role"
});
roleEl.appendText("\u8FD9\u6B3E\u63D2\u4EF6\u662F\u6211\u4E3A\u4E86\u5728 Obsidian \u5199\u4F5C\u540E\uFF0C");
roleEl.createEl("br");
roleEl.appendText("\u65E0\u9700\u7E41\u7410\u6392\u7248\u4E00\u952E\u5373\u53EF\u53D1\u5E03\u5230\u5C0F\u7EA2\u4E66\u800C\u5F00\u53D1\u7684\u5DE5\u5177\uFF0C");
roleEl.createEl("br");
roleEl.appendText("\u5E0C\u671B\u80FD\u8BA9\u4F60\u7684");
roleEl.createEl("span", {
cls: "mp-about-highlight",
text: "\u6392\u7248\u66F4\u8F7B\u677E"
});
roleEl.appendText("\uFF0C\u8BA9\u4F60\u7684");
roleEl.createEl("span", {
cls: "mp-about-value",
text: "\u521B\u4F5C\u66F4\u9AD8\u6548"
});
roleEl.appendText("\u3002");
const descEl = authorSection.createEl("p", {
cls: "mp-about-desc"
});
descEl.appendText("\u5982\u679C\u8FD9\u6B3E\u63D2\u4EF6\u5BF9\u4F60\u6709\u5E2E\u52A9\uFF0C");
descEl.createEl("br");
descEl.appendText("\u6216\u8005\u4F60\u613F\u610F\u652F\u6301\u6211\u7684\u72EC\u7ACB\u5F00\u53D1\u4E0E\u5199\u4F5C\uFF0C\u6B22\u8FCE\u8BF7\u6211\u559D\u5496\u5561\u2615\uFE0F\u3002");
descEl.createEl("br");
descEl.appendText("\u4F60\u7684\u652F\u6301\u5BF9\u6211\u6765\u8BF4\u610F\u4E49\u91CD\u5927\uFF0C\u5B83\u80FD\u8BA9\u6211\u66F4\u4E13\u6CE8\u5730\u5F00\u53D1\u3001\u5199\u4F5C\u3002");
const donateSection = this.modal.createEl("div", {
cls: "mp-about-section mp-about-donate-section"
});
donateSection.createEl("h4", {
text: "\u8BF7\u6211\u559D\u5496\u5561",
cls: "mp-about-subtitle"
});
const donateQR = donateSection.createEl("div", {
cls: "mp-about-qr"
});
donateQR.createEl("img", {
attr: {
src: DONATE_QR_BASE64,
alt: "\u6253\u8D4F\u4E8C\u7EF4\u7801"
}
});
const mpSection = this.modal.createEl("div", {
cls: "mp-about-section mp-about-mp-section"
});
const mpDescEl = mpSection.createEl("p", {
cls: "mp-about-desc"
});
mpDescEl.appendText("\u5982\u679C\u4F60\u60F3\u4E86\u89E3\u66F4\u591A\u5173\u4E8E\u521B\u4F5C\u3001\u6548\u7387\u5DE5\u5177\u7684\u5C0F\u6280\u5DE7\uFF0C");
mpDescEl.createEl("br");
mpDescEl.appendText("\u6216\u8005\u5173\u6CE8\u6211\u672A\u6765\u7684\u5199\u4F5C\u52A8\u6001\uFF0C\u6B22\u8FCE\u5173\u6CE8\u6211\u7684\u5FAE\u4FE1\u516C\u4F17\u53F7\u3002");
mpSection.createEl("h4", {
text: "\u5FAE\u4FE1\u516C\u4F17\u53F7",
cls: "mp-about-subtitle"
});
const mpQR = mpSection.createEl("div", {
cls: "mp-about-qr"
});
mpQR.createEl("img", {
attr: {
src: MP_QR_BASE64,
alt: "\u516C\u4F17\u53F7\u4E8C\u7EF4\u7801"
}
});
const footerEl = mpSection.createEl("p", {
cls: "mp-about-footer"
});
footerEl.appendText("\u671F\u5F85\u4E0E\u4F60\u4E00\u8D77\uFF0C\u5728\u521B\u4F5C\u7684\u4E16\u754C\u91CC");
footerEl.createEl("strong", {
text: "\u627E\u5230\u5C5E\u4E8E\u81EA\u5DF1\u7684\u610F\u4E49"
});
footerEl.appendText("\u3002");
closeButton.addEventListener("click", () => this.closeDonateModal());
this.overlay.addEventListener("click", (e) => {
if (e.target === this.overlay) {
this.closeDonateModal();
}
});
}
static closeDonateModal() {
if (this.overlay) {
this.overlay.remove();
}
}
};
// src/clipboardManager.ts
var ClipboardManager = class {
static getExportConfig(imageElement) {
return {
quality: 1,
pixelRatio: 4,
skipFonts: false,
filter: (node) => {
return true;
},
imagePlaceholder: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg=="
};
}
static async copyImageToClipboard(element) {
try {
const imageElement = element.querySelector(".red-image-preview");
if (!imageElement) {
throw new Error("\u627E\u4E0D\u5230\u9884\u89C8\u533A\u57DF");
}
await new Promise((resolve) => setTimeout(resolve, 300));
try {
const blob = await toBlob(imageElement, this.getExportConfig(imageElement));
if (!(blob instanceof Blob)) {
throw new Error("\u751F\u6210\u7684\u4E0D\u662F\u6709\u6548\u7684 Blob \u5BF9\u8C61");
}
const clipboardItem = new ClipboardItem({
"image/png": blob
});
await navigator.clipboard.write([clipboardItem]);
return true;
} catch (err) {
console.warn("\u590D\u5236\u5931\u8D25\uFF0C\u5C1D\u8BD5\u5907\u7528\u65B9\u6CD5", err);
const canvas = await toCanvas(imageElement, this.getExportConfig(imageElement));
try {
await new Promise((resolve, reject) => {
canvas.toBlob(async (blob) => {
if (!blob) {
reject(new Error("Canvas \u8F6C\u6362\u4E3A Blob \u5931\u8D25"));
return;
}
try {
const clipboardItem = new ClipboardItem({
"image/png": blob
});
await navigator.clipboard.write([clipboardItem]);
resolve();
} catch (e) {
reject(e);
}
}, "image/png", 1);
});
return true;
} catch (clipboardErr) {
console.error("\u590D\u5236\u5230\u526A\u8D34\u677F\u5931\u8D25", clipboardErr);
return false;
}
}
} catch (error) {
console.error("\u590D\u5236\u56FE\u7247\u5931\u8D25:", error);
return false;
}
}
};
// src/imgTelplate/defaultTemplate.ts
var import_obsidian = require("obsidian");
var DefaultTemplate = class {
constructor(settingsManager, onSettingsUpdate) {
this.settingsManager = settingsManager;
this.onSettingsUpdate = onSettingsUpdate;
this.id = "default";
this.name = "\u9ED8\u8BA4\u6A21\u677F";
this.sections = {
header: true,
content: true,
footer: true
};
}
render(element) {
const sections = element.querySelectorAll(".red-content-section");
const settings = this.settingsManager.getSettings();
sections.forEach((section) => {
const header = element.querySelector(".red-preview-header");
const footer = element.querySelector(".red-preview-footer");
if (this.sections.header && header) {
this.createHeaderContent(header);
}
if (this.sections.footer && footer) {
if (settings.showFooter !== false) {
this.createFooterContent(footer);
} else {
footer.remove();
}
}
});
}
createHeaderContent(headerArea) {
headerArea.empty();
const settings = this.settingsManager.getSettings();
const userInfo = this.createUserInfoContainer(headerArea);
this.createUserLeftSection(userInfo, settings);
if (settings.showTime) {
this.createTimeSection(userInfo, settings);
}
}
createUserInfoContainer(parent) {
return parent.createEl("div", { cls: "red-user-info" });
}
createUserLeftSection(parent, settings) {
const userLeft = parent.createEl("div", { cls: "red-user-left" });
this.createAvatarSection(userLeft, settings);
this.createUserMetaSection(userLeft, settings);
return userLeft;
}
createAvatarSection(parent, settings) {
const avatar = parent.createEl("div", {
cls: "red-user-avatar",
attr: { "title": "\u70B9\u51FB\u4E0A\u4F20\u5934\u50CF" }
});
if (settings.userAvatar) {
avatar.createEl("img", {
attr: {
src: settings.userAvatar,
alt: "\u7528\u6237\u5934\u50CF"
}
});
} else {
const placeholder = avatar.createEl("div", { cls: "red-avatar-placeholder" });
placeholder.createEl("span", {
cls: "red-avatar-upload-icon",
text: "\u{1F4F7}"
});
}
avatar.addEventListener("click", () => this.handleAvatarClick());
}
createUserMetaSection(parent, settings) {
const userMeta = parent.createEl("div", { cls: "red-user-meta" });
const userNameContainer = userMeta.createEl("div", { cls: "red-user-name-container" });
const userName = userNameContainer.createEl("div", {
cls: "red-user-name",
text: settings.userName,
attr: { "title": "\u70B9\u51FB\u7F16\u8F91\u7528\u6237\u540D" }
});
userNameContainer.createEl("span", {
cls: "red-verified-icon",
attr: {
role: "img"
}
}).innerHTML = `<svg viewBox="0 0 22 22" class="r-4qtqp9 r-yyyyoo r-1xvli5t r-bnwqim r-lrvibr r-m6rgpd r-1cvl2hr r-f9ja8p r-og9te1 r-3t4u6i"><g><path d="M20.396 11c-.018-.646-.215-1.275-.57-1.816-.354-.54-.852-.972-1.438-1.246.223-.607.27-1.264.14-1.897-.131-.634-.437-1.218-.882-1.687-.47-.445-1.053-.75-1.687-.882-.633-.13-1.29-.083-1.897.14-.273-.587-.704-1.086-1.245-1.44S11.647 1.62 11 1.604c-.646.017-1.273.213-1.813.568s-.969.854-1.24 1.44c-.608-.223-1.267-.272-1.902-.14-.635.13-1.22.436-1.69.882-.445.47-.749 1.055-.878 1.688-.13.633-.08 1.29.144 1.896-.587.274-1.087.705-1.443 1.245-.356.54-.555 1.17-.574 1.817.02.647.218 1.276.574 1.817.356.54.856.972 1.443 1.245-.224.606-.274 1.263-.144 1.896.13.634.433 1.218.877 1.688.47.443 1.054.747 1.687.878.633.132 1.29.084 1.897-.136.274.586.705 1.084 1.246 1.439.54.354 1.17.551 1.816.569.647-.016 1.276-.213 1.817-.567s.972-.854 1.245-1.44c.604.239 1.266.296 1.903.164.636-.132 1.22-.447 1.68-.907.46-.46.776-1.044.908-1.681s.075-1.299-.165-1.903c.586-.274 1.084-.705 1.439-1.246.354-.54.551-1.17.569-1.816zM9.662 14.85l-3.429-3.428 1.293-1.302 2.072 2.072 4.4-4.794 1.347 1.246z"></path></g></svg>`;
const userId = userMeta.createEl("div", {
cls: "red-user-id",
text: settings.userId,
attr: { "title": "\u70B9\u51FB\u7F16\u8F91\u7528\u6237ID" }
});
userName.addEventListener("click", () => this.handleUserNameEdit(userName));
userId.addEventListener("click", () => this.handleUserIdEdit(userId));
}
createTimeSection(parent, settings) {
const userRight = parent.createEl("div", { cls: "red-user-right" });
userRight.createEl("div", {
cls: "red-post-time",
text: new Date().toLocaleDateString(settings.timeFormat)
});
}
createFooterContent(footerArea) {
footerArea.empty();
const settings = this.settingsManager.getSettings();
const leftText = this.createFooterText(footerArea, settings.footerLeftText);
footerArea.createEl("div", {
cls: "red-footer-separator",
text: "|"
});
const rightText = this.createFooterText(footerArea, settings.footerRightText);
leftText.addEventListener("click", () => this.handleFooterTextEdit(leftText, "left"));
rightText.addEventListener("click", () => this.handleFooterTextEdit(rightText, "right"));
}
createFooterText(parent, text) {
return parent.createEl("div", {
cls: "red-footer-text",
text,
attr: { "title": "\u70B9\u51FB\u7F16\u8F91\u6587\u672C" }
});
}
async handleAvatarClick() {
const input = document.createElement("input");
input.type = "file";
input.accept = "image/*";
input.addEventListener("change", async () => {
var _a;
const file = (_a = input.files) == null ? void 0 : _a[0];
if (file) {
try {
const reader = new FileReader();
reader.onload = async (e) => {
var _a2;
const base64 = (_a2 = e.target) == null ? void 0 : _a2.result;
await this.settingsManager.updateSettings({
userAvatar: base64
});
await this.onSettingsUpdate();
};
reader.readAsDataURL(file);
} catch (error) {
console.error("\u5934\u50CF\u66F4\u65B0\u5931\u8D25:", error);
new import_obsidian.Notice("\u5934\u50CF\u66F4\u65B0\u5931\u8D25");
}
}
});
input.click();
}
async handleUserNameEdit(element) {
const input = document.createElement("input");
input.value = element.textContent || "";
input.className = "red-user-edit-input";
input.placeholder = "\u8BF7\u8F93\u5165\u7528\u6237\u540D";
element.replaceWith(input);
input.focus();
const handleBlur = async () => {
const newName = input.value.trim();
await this.settingsManager.updateSettings({
userName: newName || "\u591C\u534A"
});
await this.onSettingsUpdate();
input.replaceWith(element);
};
input.addEventListener("blur", handleBlur);
input.addEventListener("keypress", async (e) => {
if (e.key === "Enter") {
await handleBlur();
}
});
}
async handleUserIdEdit(element) {
const input = document.createElement("input");
input.value = element.textContent || "";
input.className = "red-user-edit-input";
input.placeholder = "\u8BF7\u8F93\u5165\u7528\u6237ID";
element.replaceWith(input);
input.focus();
const handleBlur = async () => {
const newId = input.value.trim();
await this.settingsManager.updateSettings({
userId: newId || "@Yeban"
});
await this.onSettingsUpdate();
input.replaceWith(element);
};
input.addEventListener("blur", handleBlur);
input.addEventListener("keypress", async (e) => {
if (e.key === "Enter") {
await handleBlur();
}
});
}
async handleFooterTextEdit(element, position) {
const input = document.createElement("input");
input.value = element.textContent || "";
input.className = "red-footer-edit-input";
input.placeholder = "\u8BF7\u8F93\u5165\u9875\u811A\u6587\u672C";
element.replaceWith(input);
input.focus();
const handleBlur = async () => {
const newText = input.value.trim();
const settings = position === "left" ? { footerLeftText: newText || "\u591C\u534A\u8FC7\u540E\uFF0C\u5149\u660E\u4FBF\u542F\u7A0B" } : { footerRightText: newText || "\u6B22\u8FCE\u5173\u6CE8\u516C\u4F17\u53F7\uFF1A\u591C\u534A" };
await this.settingsManager.updateSettings(settings);
await this.onSettingsUpdate();
input.replaceWith(element);
};
input.addEventListener("blur", handleBlur);
input.addEventListener("keypress", async (e) => {
if (e.key === "Enter") {
await handleBlur();
}
});
}
};
// src/imgTelplate/notesTemplate.ts
var NotesTemplate = class {
constructor(settingsManager, onSettingsUpdate) {
this.settingsManager = settingsManager;
this.onSettingsUpdate = onSettingsUpdate;
this.id = "notes";
this.name = "\u5907\u5FD8\u5F55";
this.sections = {
header: true,
content: true,
footer: false
};
}
render(element) {
const sections = element.querySelectorAll(".red-content-section");
sections.forEach(() => {
const header = element.querySelector(".red-preview-header");
if (header) {
header.empty();
header.addClass("red-notes-header");
const headerBar = header.createEl("div", { cls: "red-notes-bar" });
const settings = this.settingsManager.getSettings();
const notesTitle = headerBar.createEl("div", {
cls: "red-notes-title",
text: settings.notesTitle || "\u5907\u5FD8\u5F55",
attr: { "title": "\u70B9\u51FB\u7F16\u8F91\u6807\u9898" }
});
notesTitle.addEventListener("click", () => this.handleTitleEdit(notesTitle));
const cycleButtons = headerBar.createEl("div", { cls: "red-notes-cycle-buttons" });
cycleButtons.createEl("div", { cls: "red-notes-cycle-left" });
cycleButtons.createEl("div", { cls: "red-notes-cycle-right" });
headerBar.createEl("div", { cls: "red-notes-actions" });
}
const footer = element.querySelector(".red-preview-footer");
if (footer && !this.sections.footer) {
footer.empty();
footer.removeAttribute("class");
}
});
}
async handleTitleEdit(element) {
const input = document.createElement("input");
input.value = element.textContent || "";
input.className = "red-notes-edit-input";
input.placeholder = "\u8BF7\u8F93\u5165\u6807\u9898";
element.replaceWith(input);
input.focus();
const handleBlur = async () => {
const newTitle = input.value.trim();
await this.settingsManager.updateSettings({
notesTitle: newTitle || "\u5907\u5FD8\u5F55"
});
await this.onSettingsUpdate();
input.replaceWith(element);
};
input.addEventListener("blur", handleBlur);
input.addEventListener("keypress", async (e) => {
if (e.key === "Enter") {
await handleBlur();
}
});
}
};
// src/imgTemplateManager.ts
var ImgTemplateManager = class {
constructor(settingsManager, onSettingsUpdate, themeManager) {
this.settingsManager = settingsManager;
this.onSettingsUpdate = onSettingsUpdate;
this.themeManager = themeManager;
this.templates = [];
this.currentTemplate = null;
this.initializeTemplates();
}
initializeTemplates() {
this.registerTemplate(new DefaultTemplate(this.settingsManager, this.onSettingsUpdate));
this.registerTemplate(new NotesTemplate(this.settingsManager, this.onSettingsUpdate));
}
registerTemplate(template) {
this.templates.push(template);
}
getImgTemplateOptions() {
return this.templates.map((t) => ({
value: t.id,
label: t.name
}));
}
setCurrentTemplate(id) {
const template = this.templates.find((t) => t.id === id);
if (template) {
this.currentTemplate = template;
}
}
applyTemplate(previewEl, settings) {
if (!this.currentTemplate) {
this.currentTemplate = this.templates[0];
}
if (this.currentTemplate) {
this.currentTemplate.render(previewEl, settings);
this.themeManager.applyTheme(previewEl);
}
}
};
// src/modals/BackgroundSettingModal.ts
var import_obsidian2 = require("obsidian");
// src/assets/backgrounds/bg1.ts
var builtinBg1 = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEABUVFRUWFRgaGhghIx8jITAtKSktMEk0ODQ4NElvRVFFRVFFb2J3YVphd2Kxi3t7i7HMrKKszPjd3fj///////8BFRUVFRYVGBoaGCEjHyMhMC0pKS0wSTQ4NDg0SW9FUUVFUUVvYndhWmF3YrGLe3uLscysoqzM+N3d+P/////////CABEIC7UIyAMBIgACEQEDEQH/xAAbAAEBAQEBAQEBAAAAAAAAAAAAAQIDBAUGB//aAAgBAQAAAAD8dUsNQI1lbEKQsNQhpJVkKnTCVLFnTEpcgFQvTkK6OWsq3mVLkA6YNZOvPJSU1ksiiKSgi2W5AgKN4bwDeAEstiwlsaysBv7vx/OSjrhkWLAdJjeEoBZHbisWFS6uHXkhSAohevKKgumLrLpzdeUKS6zAAG/s/DCoNRrNms2QAWU1JALAdMRbJZUVbN85XSYlSkol3zoiwtu84ayhbOmclgNSQXf7n4n55LvAWAIUWBvOsAIsbzAHTO+YSwBZUsWoiyxvIA68oGoS2awAKgXtwVYAtwqBUVZAA2zKgC+jzU78pAreIaylEWANSU0Z6YgNsKhY0jKjr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AWyCoAtACQFEVFsKJSgBAAAACKKhSAAFICosABFyAAAAUqCgAAWAoKAACVFdvb4ed88RTICBUhbIKhahZYFABCFqRSwFAFAiwAAAACgQlAUkoACwADIAAAAtgCgAKEFBQFgAQL+i+T5fjIEwtIshbItSAWhFAALACKQshUWixQBFgAAAAKBAoQAKgAAAyAAAAAAtAAFEUCgAqCCvd4c/NECSFRUAtELItQqKEUAAAEWKAKAAEAAAAUhRAAAAFEUgVGQAAAAAFoAFAigUCKQVA9hfIkARIAKhaEAsKEi0AAABFAAKAAQFgAAGkRQQLFgmkAoRSLBYyAAAAAClACgABUKhSAK+30HhICLEhbCFBZAFoBFAAAAAAFAKgCBYAEVSKAhUAWFIKRQAIDIAAAAAKWUCxQAAAAsCnX27+dARUJBQFhSKACKigAAAAAWCgABAAFgUACFIAqLAsUAEUisAAAAABaigAoARQACoUfpOPh4BCoJBUBaCKAAhQAAigAKCFCiAQTRAAUKQqBAKgCwoAFQKjAAFgAABSgAUAgCgACk9/p4nzhBSECCotIqCgAAAAIoABQAoIEAChFigAAQFEWBYoCwAAwAAAAAC2CgBSFQCgRQKnsff43wLBYAQshaAEUAAAAARQJVIojSCiAgAKAUQIoIsKQLFhQAAAGAAAAAAUUAAAWCgigB93s+X5YAAQKiwoCKAAAAsAAAoIVRKIBACxUUKQABAUigAAAAAwAAAAAAFKAAAUAAB0/T+b4oAAhQRQAAAAApFgAAKikVQBAEAUAKBAAQoigALAAFCGAAAAAAFpFAAACgART9Pw/PBSABFAigAAAAAAACVSFCgAEAQoAFCAAAEUABUAUBKjAAAAAAC0AAACwFAIs976fzWRYWFgIoAAAAAAFQAAFEaEClQgACKAKQqIoAAVKQAKlSpQJSYAAAAAtkAKUAAABQA9L2Py2RYsBYAAAAFgAFgAAFCKFACiBAigACkAAKgA
// src/assets/backgrounds/bg3.ts
var builtinBg3 = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAcHBwcHBwgICAgLCwoLCxAODQ0OEB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0AAAKAVQKAAFoAAWgCgBaAABQABSgALaALRQFopQLFUKAAUFUAALQAAAc6AAAAAAA0AAACgLQFAAC0AALSwFADQCUAUAAKUAA1QBaUAtBaAUoUABQBoAAWgAAA50AAAAAAC0AAAUAWgFAAKoAAWlAAC0JQAKAAFoAAtoAtKAWiqAKVYoACgLQAAtAAABzoAAAAAAFoAAAKAtAKAAKoAAtKAAFCygLBQALBoAAW0AaFALQtAKUKAAoCqAAC0AAAOdAAAAAAAtAAAFAFoCgACqAAFpQABVhQAFABQKAAqqAWigFotAFLRAoCgFoAAFoAAAc6AAAAAABaAAAFAGgFAAFoAALRQABVk0ACgAAqgAKpQC0UA0FoAqgFAFANAAAKoAAA50AAAAAAC0AAAFALQKAAGgAAaCgAChQAUAAFUAClUAWigGgtAKKBYUFALQAAFUAAAc6AAAAAABaAAAFALQFAADQAAVQKAC2RaAAoAAtAAqigDQUBaFoBS0IFAoC0AAAWgAADnQAAAAAAGgAAAoB
// src/assets/backgrounds/bg5.ts
var builtinBg5 = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAUFBQUFBQUGBgUICAcICAsKCQkKCxEMDQwNDBEaEBMQEBMQGhcbFhUWGxcpIBwcICkvJyUnLzkzMzlHREddXX0BBQUFBQUFBQYGBQgIBwgICwoJCQoLEQwNDA0MERoQExAQExAaFxsWFRYbFykgHBwgKS8nJScvOTMzOUdER11dff/CABEICmsH0AMBIgACEQEDEQH/xAAdAAEBAQACAwEBAAAAAAAAAAAAAQIDBAcICQYF/9oACAEBAAAAAPbIUAoss1miwAoGsgayNZCwNSazrOpQAAAAAsAAKQFlIAsAAWAAAJc6SmdZGsgAACUgAQAZsKAqyoUABVgAGsrNZaS5sazpJrLQAAACwFgAABYBYBYAsAAAACVk1Lk1kAAABAAFkFk3xlAoKSiagAoDWQazrOmbGhI0GaoAAAACxYABSKhYAFgsVFgAABKAELnRnWQ0yAAIAAJYSwAKBQABQANZDWaWUlS50EsUAACwFRYsBY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s1m0FgArUoAAAABqC5AAAWWFIsVLNQBUqVAsAQsAAACKEAXM0hFgAAJSKZBrIgBQABpmrKAAWaKlAAAAAAAAAAWWUJSys6gWFiwSyywAAAAIFS5rNRqSwAAAli5DWQCAKAANRYoWAFWxRFACUAC3NgAAAURSwWLBZUsFSykFILmossAAASgiagQgUgAAlSs2GsggKWAAWNRQACy0UAAACykqNSWAABZQCosCpQixRLCoAIUgAAAEAEpnWSwAABFQgayIFAADUFSygALqVFAAAsVGoSiWAAFIoLKIWKlAigSksVCyAWLAAARYmosGbciwAEpFJSXJbkIBQAGs6EsoABasoAAALKliyxYAAFiiyygQUAACUSkssWEWFgAASiKQCCWAAAASykuQgoAAGhLKAWDSywUAALKLlRKC5ABQCpRKhZUUiygAikALCWAAACUQC4tZLAAAIVFZLc6ygUAayA1lqFJZSxZaqUAAFiwUWJqQsAAoolJRLFhZSCglJYFIASwAAARSBUM2UQABKAlgXLTKFAGsmsjUoAAUm4UAAUgpKUioRYAUFAACWUAAAAEqWUgIAAAlJRAlM6hALAARQlzrLWYFWBrICzQAAspbE0AAAsoWVCyy5BYKLKBKAJUqUABKBKSpNSwjWQAEoAgssCUiLCwAAlRcrNZ1mCgGslhU0AAFJuFAAABZVlRUsQqAKqWUAAlABKAAACVFiAWAAACWBZYZWLAAAM2wuRrAUANZazqUAAFlUsUAAABQFQhYAoLKAAAAEoJQlAIpmwFgEoAAEAmpLILAAEpFgQgUA1k0AAAsUmiaAAAKipVzqArNIFlssVFAAAAABKACKlRYgpAABFAJciVAAAAIXNQligA1KAACxqKzoUAAABZNxZRAlQqykoAAAAAAAASgElgAAAAihLFlyualgACUipZWYKAGhKAAFUEsVQAAALKCpRItzRUWWUAAlAAAAAAQCFQAAABFipYuZUBYAARRKkgUAGkoAAWrEtligAABYVYBRACwCygAAAAAAABFSxcqEAAAASxTIgCwWASpUVKwWWwAUqUAAUUsKAlAALKmkUlSpYKgsFAAAAAAAAAiwJZUWAAASgSxCVWVlIAAJUudZgoADQA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gAAAAlABLLKAAAAAAAAAAAAJQAAAAAAAAAAAAAAAAA
// src/modals/BackgroundSettingModal.ts
var BackgroundSettingModal = class extends import_obsidian2.Modal {
constructor(app, onSubmit, targetPreviewEl, backgroundManager, initialSettings) {
super(app);
this.onSubmit = onSubmit;
this.targetPreviewEl = targetPreviewEl;
this.imageUrl = "";
this.scale = 1;
this.position = { x: 0, y: 0 };
this.previewImage = null;
this.dragEventCleanup = null;
this.initialSettings = initialSettings;
this.backgroundManager = backgroundManager;
this.loadInitialSettings();
}
loadInitialSettings() {
if (this.initialSettings) {
this.imageUrl = this.initialSettings.imageUrl;
this.scale = this.initialSettings.scale;
this.position = { ...this.initialSettings.position };
}
}
onOpen() {
const { contentEl } = this;
contentEl.empty();
const container = contentEl.createEl("div", { cls: "red-background-container" });
container.createEl("h3", { text: "\u80CC\u666F\u56FE\u7247", cls: "red-background-title" });
const builtInBgArea = container.createEl("div", { cls: "red-background-builtins" });
const builtInImages = [builtinBg1, builtinBg2, builtinBg3, builtinBg4, builtinBg5, builtinBg6];
builtInImages.forEach((src) => {
const thumb = builtInBgArea.createEl("img", { attr: { src }, cls: "red-bg-thumb" });
thumb.addEventListener("click", () => {
this.imageUrl = src;
this.scale = 1;
this.position = { x: 0, y: 0 };
if (this.previewImage) {
this.applyBackgroundStyles(this.previewImage, {
imageUrl: this.imageUrl,
scale: this.scale,
position: this.position
});
this.initDragAndScale();
}
this.updateTargetPreview(true);
});
});
const previewArea = container.createEl("div", { cls: "red-background-preview" });
this.previewImage = previewArea.createEl("div", { cls: "red-background-preview-image" });
const controlsArea = container.createEl("div", { cls: "red-background-controls" });
this.createControls(controlsArea);
if (this.imageUrl) {
this.applyBackgroundStyles(this.previewImage, {
imageUrl: this.imageUrl,
scale: this.scale,
position: this.position
});
this.initDragAndScale();
}
}
createControls(container) {
new import_obsidian2.Setting(container).addButton((button) => button.setButtonText("\u9009\u62E9\u56FE\u7247").onClick(() => this.handleImageUpload())).addButton((button) => button.setButtonText("\u6E05\u9664\u56FE\u7247").onClick(() => this.handleClearImage()));
new import_obsidian2.Setting(container).setName("\u7F29\u653E").addSlider((slider) => slider.setLimits(0.1, 2, 0.01).setValue(this.scale).onChange((value) => this.handleScaleChange(value)));
new import_obsidian2.Setting(container).addButton((button) => button.setButtonText("\u786E\u8BA4").setCta().onClick(() => this.handleConfirm())).addButton((button) => button.setButtonText("\u53D6\u6D88").onClick(() => this.handleCancel()));
}
handleImageUpload() {
const input = document.createElement("input");
input.type = "file";
input.accept = "image/*";
input.onchange = async () => {
var _a;
const file = (_a = input.files) == null ? void 0 : _a[0];
if (file) {
const reader = new FileReader();
reader.onload = (e) => {
var _a2;
this.imageUrl = (_a2 = e.target) == null ? void 0 : _a2.result;
if (this.previewImage) {
this.applyBackgroundStyles(this.previewImage, {
imageUrl: this.imageUrl,
scale: this.scale,
position: this.position
});
this.initDragAndScale();
}
this.updateTargetPreview(true);
};
reader.readAsDataURL(file);
}
};
input.click();
}
handleScaleChange(value) {
this.scale = value;
if (this.previewImage) {
this.applyBackgroundStyles(this.previewImage, {
imageUrl: this.imageUrl,
scale: this.scale,
position: this.position
});
}
this.updateTargetPreview(true);
}
handleConfirm() {
const backgroundSettings = {
imageUrl: this.imageUrl,
scale: this.scale,
position: this.position
};
this.onSubmit(backgroundSettings);
this.close();
}
handleCancel() {
this.updateTargetPreview(false);
this.close();
}
initDragAndScale() {
if (!this.previewImage)
return;
let isDragging = false;
let startX, startY;
const handleMouseDown = (e) => {
var _a;
isDragging = true;
startX = e.clientX - this.position.x;
startY = e.clientY - this.position.y;
(_a = this.previewImage) == null ? void 0 : _a.addClass("dragging");
};
const handleMouseMove = (e) => {
if (!isDragging)
return;
this.position.x = e.clientX - startX;
this.position.y = e.clientY - startY;
if (this.previewImage) {
this.applyBackgroundStyles(this.previewImage, {
imageUrl: this.imageUrl,
scale: this.scale,
position: this.position
});
}
this.updateTargetPreview(true);
};
const handleMouseUp = () => {
var _a;
isDragging = false;
(_a = this.previewImage) == null ? void 0 : _a.removeClass("dragging");
};
this.previewImage.addEventListener("mousedown", handleMouseDown);
document.addEventListener("mousemove", handleMouseMove);
document.addEventListener("mouseup", handleMouseUp);
this.dragEventCleanup = () => {
var _a;
(_a = this.previewImage) == null ? void 0 : _a.removeEventListener("mousedown", handleMouseDown);
document.removeEventListener("mousemove", handleMouseMove);
document.removeEventListener("mouseup", handleMouseUp);
};
}
applyBackgroundStyles(element, settings) {
this.backgroundManager.applyBackgroundStyles(element, settings);
}
updateTargetPreview(applyBackground = true) {
var _a;
const previewContainer = this.targetPreviewEl.querySelector(".red-image-preview");
if (!previewContainer)
return;
if (applyBackground && this.imageUrl) {
this.applyBackgroundStyles(previewContainer, {
imageUrl: this.imageUrl,
scale: this.scale,
position: this.position
});
} else if (!applyBackground && ((_a = this.initialSettings) == null ? void 0 : _a.imageUrl)) {
this.applyBackgroundStyles(previewContainer, this.initialSettings);
} else {
this.backgroundManager.clearBackgroundStyles(previewContainer);
}
}
handleClearImage() {
this.imageUrl = "";
this.scale = 1;
this.position = { x: 0, y: 0 };
if (this.previewImage) {
this.previewImage.setAttribute("style", "");
}
const previewContainer = this.targetPreviewEl.querySelector(".red-image-preview");
if (previewContainer) {
this.backgroundManager.clearBackgroundStyles(previewContainer);
}
this.onSubmit({
imageUrl: "",
scale: 1,
position: { x: 0, y: 0 }
});
}
onClose() {
if (this.dragEventCleanup) {
this.dragEventCleanup();
this.dragEventCleanup = null;
}
this.updateTargetPreview(false);
const { contentEl } = this;
contentEl.empty();
}
};
// src/backgroundManager.ts
var BackgroundManager = class {
constructor() {
}
applyBackgroundStyles(element, settings) {
const stylesArray = [
`background-image: url(${settings.imageUrl})`,
`background-size: ${settings.scale * 100}%`,
`background-position: ${settings.position.x}px ${settings.position.y}px`,
`background-repeat: no-repeat`
];
stylesArray.forEach((style) => {
const match = style.match(/([^:]+):(.+)/);
if (match) {
const [, key, value] = match.map((item) => item.trim());
if (key && value) {
element.style[key] = value;
}
}
});
}
clearBackgroundStyles(element) {
const style = element.getAttribute("style") || "";
const clearedStyle = style.replace(/background-image:[^;]+;|background-size:[^;]+;|background-position:[^;]+;|background-repeat:[^;]+;/g, "");
element.setAttribute("style", clearedStyle);
}
};
// src/view.ts
var VIEW_TYPE_RED = "note-to-red";
var RedView = class extends import_obsidian3.ItemView {
// #endregion
// #region 基础视图方法
constructor(leaf, themeManager, settingsManager) {
super(leaf);
this.currentFile = null;
this.updateTimer = null;
this.isPreviewLocked = false;
this.currentImageIndex = 0;
// 添加捐赠提醒相关属性
this.donateCount = 0;
this.lastDonatePrompt = 0;
this.MAX_COUNT_BEFORE_PROMPT = 5;
this.themeManager = themeManager;
this.settingsManager = settingsManager;
this.backgroundManager = new BackgroundManager();
this.imgTemplateManager = new ImgTemplateManager(
this.settingsManager,
this.updatePreview.bind(this),
this.themeManager
);
const settings = this.settingsManager.getSettings();
this.donateCount = settings.donateCount || 0;
this.lastDonatePrompt = settings.lastDonatePrompt || 0;
}
getViewType() {
return VIEW_TYPE_RED;
}
getDisplayText() {
return "\u5C0F\u7EA2\u4E66\u9884\u89C8";
}
getIcon() {
return "image";
}
// #endregion
// #region 视图初始化
async onOpen() {
const container = this.containerEl.children[1];
container.empty();
container.className = "red-view-content";
await this.initializeToolbar(container);
this.initializePreviewArea(container);
this.initializeBottomBar(container);
this.initializeEventListeners();
const currentFile = this.app.workspace.getActiveFile();
await this.onFileOpen(currentFile);
}
async initializeToolbar(container) {
const toolbar = container.createEl("div", { cls: "red-toolbar" });
const controlsGroup = toolbar.createEl("div", { cls: "red-controls-group" });
await this.initializeLockButton(controlsGroup);
await this.initializeTemplateSelect(controlsGroup);
await this.initializeThemeSelect(controlsGroup);
await this.initializeFontSelect(controlsGroup);
await this.initializeFontSizeControls(controlsGroup);
await this.restoreSettings();
}
// 添加背景设置按钮初始化方法
async initializeBackgroundButton(parent) {
const bgButton = parent.createEl("button", {
cls: "red-background-button",
attr: { "aria-label": "\u8BBE\u7F6E\u80CC\u666F\u56FE\u7247" }
});
(0, import_obsidian3.setIcon)(bgButton, "image");
bgButton.addEventListener("click", () => {
const currentSettings = this.settingsManager.getSettings().backgroundSettings;
new BackgroundSettingModal(
this.app,
async (backgroundSettings) => {
await this.settingsManager.updateSettings({ backgroundSettings });
const imagePreview = this.previewEl.querySelector(".red-image-preview");
this.backgroundManager.applyBackgroundStyles(
imagePreview,
backgroundSettings
);
},
this.previewEl,
this.backgroundManager,
currentSettings
).open();
});
}
initializePreviewArea(container) {
const wrapper = container.createEl("div", { cls: "red-preview-wrapper" });
this.previewEl = wrapper.createEl("div", { cls: "red-preview-container" });
const navContainer = wrapper.createEl("div", { cls: "red-nav-container" });
const prevButton = navContainer.createEl("button", {
cls: "red-nav-button",
text: "\u2190"
});
const indicator = navContainer.createEl("span", {
cls: "red-page-indicator",
text: "1/1"
});
const nextButton = navContainer.createEl("button", {
cls: "red-nav-button",
text: "\u2192"
});
this.navigationButtons = { prev: prevButton, next: nextButton, indicator };
prevButton.addEventListener("click", () => this.navigateImages("prev"));
nextButton.addEventListener("click", () => this.navigateImages("next"));
}
updateNavigationState() {
const sections = this.previewEl.querySelectorAll(".red-content-section");
if (!this.navigationButtons)
return;
sections.forEach((section, i) => {
section.classList.toggle("red-section-active", i === this.currentImageIndex);
});
this.navigationButtons.prev.classList.toggle("red-nav-hidden", this.currentImageIndex === 0);
this.navigationButtons.next.classList.toggle("red-nav-hidden", this.currentImageIndex === sections.length - 1);
this.navigationButtons.indicator.textContent = `${this.currentImageIndex + 1}/${sections.length}`;
}
navigateImages(direction) {
const sections = this.previewEl.querySelectorAll(".red-content-section");
if (direction === "prev" && this.currentImageIndex > 0) {
this.currentImageIndex--;
} else if (direction === "next" && this.currentImageIndex < sections.length - 1) {
this.currentImageIndex++;
}
this.updateNavigationState();
}
initializeBottomBar(container) {
const bottomBar = container.createEl("div", { cls: "red-bottom-bar" });
const bottomControlsGroup = bottomBar.createEl("div", { cls: "red-controls-group" });
this.initializeHelpButton(bottomControlsGroup);
this.initializeBackgroundButton(bottomControlsGroup);
this.initializeDonateButton(bottomControlsGroup);
this.initializeExportButtons(bottomControlsGroup);
}
initializeEventListeners() {
this.registerEvent(
this.app.workspace.on("file-open", this.onFileOpen.bind(this))
);
this.registerEvent(
this.app.vault.on("modify", this.onFileModify.bind(this))
);
this.initializeCopyButtonListener();
}
// #endregion
// #region 控件初始化
async initializeLockButton(parent) {
this.lockButton = parent.createEl("button", {
cls: "red-lock-button",
attr: { "aria-label": "\u5173\u95ED\u5B9E\u65F6\u9884\u89C8\u72B6\u6001" }
});
(0, import_obsidian3.setIcon)(this.lockButton, "lock");
this.lockButton.addEventListener("click", () => this.togglePreviewLock());
}
async initializeTemplateSelect(parent) {
var _a;
this.customTemplateSelect = this.createCustomSelect(
parent,
"red-template-select",
await this.getTemplateOptions()
);
this.customTemplateSelect.id = "template-select";
(_a = this.customTemplateSelect.querySelector(".red-select")) == null ? void 0 : _a.addEventListener("change", async (e) => {
const value = e.detail.value;
this.imgTemplateManager.setCurrentTemplate(value);
await this.settingsManager.updateSettings({ templateId: value });
this.imgTemplateManager.applyTemplate(this.previewEl, this.settingsManager.getSettings());
await this.updatePreview();
});
}
async initializeThemeSelect(parent) {
var _a;
this.customThemeSelect = this.createCustomSelect(
parent,
"red-theme-select",
await this.getThemeOptions()
);
this.customThemeSelect.id = "theme-select";
(_a = this.customThemeSelect.querySelector(".red-select")) == null ? void 0 : _a.addEventListener("change", async (e) => {
const value = e.detail.value;
this.themeManager.setCurrentTheme(value);
await this.settingsManager.updateSettings({ themeId: value });
this.themeManager.applyTheme(this.previewEl);
});
}
async initializeFontSelect(parent) {
var _a;
this.customFontSelect = this.createCustomSelect(
parent,
"red-font-select",
this.getFontOptions()
);
this.customFontSelect.id = "font-select";
(_a = this.customFontSelect.querySelector(".red-select")) == null ? void 0 : _a.addEventListener("change", async (e) => {
const value = e.detail.value;
this.themeManager.setFont(value);
await this.settingsManager.updateSettings({ fontFamily: value });
this.themeManager.applyTheme(this.previewEl);
});
}
async initializeFontSizeControls(parent) {
const fontSizeGroup = parent.createEl("div", { cls: "red-font-size-group" });
const decreaseButton = fontSizeGroup.createEl("button", {
cls: "red-font-size-btn",
text: "-"
});
this.fontSizeSelect = fontSizeGroup.createEl("input", {
cls: "red-font-size-input",
type: "text",
value: "16",
attr: {
style: "border: none; outline: none; background: transparent;"
}
});
const increaseButton = fontSizeGroup.createEl("button", {
cls: "red-font-size-btn",
text: "+"
});
const updateFontSize = async () => {
const size = parseInt(this.fontSizeSelect.value);
this.themeManager.setFontSize(size);
await this.settingsManager.updateSettings({ fontSize: size });
this.themeManager.applyTheme(this.previewEl);
};
decreaseButton.addEventListener("click", () => {
const currentSize = parseInt(this.fontSizeSelect.value);
if (currentSize > 12) {
this.fontSizeSelect.value = (currentSize - 1).toString();
updateFontSize();
}
});
increaseButton.addEventListener("click", () => {
const currentSize = parseInt(this.fontSizeSelect.value);
if (currentSize < 30) {
this.fontSizeSelect.value = (currentSize + 1).toString();
updateFontSize();
}
});
this.fontSizeSelect.addEventListener("change", updateFontSize);
}
initializeHelpButton(parent) {
const helpButton = parent.createEl("button", {
cls: "red-help-button",
attr: { "aria-label": "\u4F7F\u7528\u6307\u5357" }
});
(0, import_obsidian3.setIcon)(helpButton, "help");
const headingLevel = this.settingsManager.getSettings().headingLevel || "h1";
parent.createEl("div", {
cls: "red-help-tooltip",
text: `\u4F7F\u7528\u6307\u5357\uFF1A
1. \u6838\u5FC3\u7528\u6CD5\uFF1A\u7528${headingLevel === "h1" ? "\u4E00\u7EA7\u6807\u9898(#)" : "\u4E8C\u7EA7\u6807\u9898(##)"}\u6765\u5206\u5272\u5185\u5BB9\uFF0C\u6BCF\u4E2A\u6807\u9898\u751F\u6210\u4E00\u5F20\u5C0F\u7EA2\u4E66\u914D\u56FE
2. \u5185\u5BB9\u5206\u9875\uFF1A\u5728${headingLevel === "h1" ? "\u4E00\u7EA7\u6807\u9898(#)" : "\u4E8C\u7EA7\u6807\u9898(##)"}\u4E0B\u4F7F\u7528 --- \u53EF\u5C06\u5185\u5BB9\u5206\u5272\u4E3A\u591A\u9875\uFF0C\u6BCF\u9875\u90FD\u4F1A\u5E26\u4E0A\u6807\u9898
3. \u9996\u56FE\u5236\u4F5C\uFF1A\u5355\u72EC\u8C03\u6574\u9996\u8282\u5B57\u53F7\u81F320-24px\uFF0C\u4F7F\u7528\u3010\u4E0B\u8F7D\u5F53\u524D\u9875\u3011\u5BFC\u51FA
4. \u957F\u6587\u4F18\u5316\uFF1A\u5185\u5BB9\u8F83\u591A\u7684\u7AE0\u8282\u53EF\u8C03\u5C0F\u5B57\u53F7\u81F314-16px\u540E\u5355\u72EC\u5BFC\u51FA
5. \u6279\u91CF\u64CD\u4F5C\uFF1A\u4FDD\u6301\u7EDF\u4E00\u5B57\u53F7\u65F6\uFF0C\u7528\u3010\u5BFC\u51FA\u5168\u90E8\u9875\u3011\u6279\u91CF\u751F\u6210
6. \u6A21\u677F\u5207\u6362\uFF1A\u9876\u90E8\u9009\u62E9\u5668\u53EF\u5207\u6362\u4E0D\u540C\u89C6\u89C9\u98CE\u683C
7. \u5B9E\u65F6\u7F16\u8F91\uFF1A\u89E3\u9501\u72B6\u6001(\u{1F513})\u4E0B\u7F16\u8F91\u6587\u6863\u5373\u65F6\u9884\u89C8\u6548\u679C
8. \u652F\u6301\u521B\u4F5C\uFF1A\u70B9\u51FB\u2764\uFE0F\u5173\u4E8E\u4F5C\u8005\u53EF\u8FDB\u884C\u6253\u8D4F\u652F\u6301`
});
}
initializeDonateButton(parent) {
const likeButton = parent.createEl("button", { cls: "red-like-button" });
likeButton.createEl("span", {
text: "\u2764\uFE0F",
attr: { style: "margin-right: 4px" }
});
likeButton.createSpan({ text: "\u5173\u4E8E\u4F5C\u8005" });
likeButton.addEventListener("click", () => {
DonateManager.showDonateModal(this.containerEl);
});
}
initializeExportButtons(parent) {
const singleDownloadButton = parent.createEl("button", {
text: "\u4E0B\u8F7D\u5F53\u524D\u9875",
cls: "red-export-button"
});
singleDownloadButton.addEventListener("click", async () => {
if (this.previewEl) {
if (this.shouldShowDonatePrompt()) {
DonateManager.showDonateModal(this.containerEl);
}
singleDownloadButton.disabled = true;
singleDownloadButton.setText("\u5BFC\u51FA\u4E2D...");
try {
await DownloadManager.downloadSingleImage(this.previewEl);
singleDownloadButton.setText("\u5BFC\u51FA\u6210\u529F");
} catch (error) {
singleDownloadButton.setText("\u5BFC\u51FA\u5931\u8D25");
} finally {
setTimeout(() => {
singleDownloadButton.disabled = false;
singleDownloadButton.setText("\u4E0B\u8F7D\u5F53\u524D\u9875");
}, 2e3);
}
}
});
this.copyButton = parent.createEl("button", {
text: "\u5BFC\u51FA\u5168\u90E8\u9875",
cls: "red-export-button"
});
this.copyButton.addEventListener("click", async () => {
if (this.previewEl) {
if (this.shouldShowDonatePrompt()) {
DonateManager.showDonateModal(this.containerEl);
}
this.copyButton.disabled = true;
this.copyButton.setText("\u5BFC\u51FA\u4E2D...");
try {
await DownloadManager.downloadAllImages(this.previewEl);
this.copyButton.setText("\u5BFC\u51FA\u6210\u529F");
} catch (error) {
this.copyButton.setText("\u5BFC\u51FA\u5931\u8D25");
} finally {
setTimeout(() => {
this.copyButton.disabled = false;
this.copyButton.setText("\u5BFC\u51FA\u5168\u90E8\u9875");
}, 2e3);
}
}
});
}
initializeCopyButtonListener() {
const copyButtonHandler = async (e) => {
const { copyButton } = e.detail;
if (copyButton) {
copyButton.addEventListener("click", async () => {
copyButton.disabled = true;
try {
if (this.shouldShowDonatePrompt()) {
DonateManager.showDonateModal(this.containerEl);
}
await ClipboardManager.copyImageToClipboard(this.previewEl);
new import_obsidian3.Notice("\u56FE\u7247\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F");
} catch (error) {
new import_obsidian3.Notice("\u590D\u5236\u5931\u8D25");
console.error("\u590D\u5236\u56FE\u7247\u5931\u8D25:", error);
} finally {
setTimeout(() => {
copyButton.disabled = false;
}, 1e3);
}
});
}
};
this.containerEl.addEventListener("copy-button-added", copyButtonHandler);
this.register(() => {
this.containerEl.removeEventListener("copy-button-added", copyButtonHandler);
});
}
// #endregion
// #region 设置管理
async restoreSettings() {
const settings = this.settingsManager.getSettings();
if (settings.themeId) {
await this.restoreThemeSettings(settings.themeId);
}
if (settings.fontFamily) {
await this.restoreFontSettings(settings.fontFamily);
}
if (settings.fontSize) {
this.fontSizeSelect.value = settings.fontSize.toString();
this.themeManager.setFontSize(settings.fontSize);
}
if (settings.templateId) {
await this.restoreTemplateSettings(settings.templateId);
}
}
async restoreTemplateSettings(templateId) {
var _a;
const templateSelect = this.customTemplateSelect.querySelector(".red-select-text");
const templateDropdown = this.customTemplateSelect.querySelector(".red-select-dropdown");
if (templateSelect && templateDropdown) {
const option = await this.getTemplateOptions();
const selected = option.find((o) => o.value === templateId);
if (selected) {
templateSelect.textContent = selected.label;
(_a = this.customTemplateSelect.querySelector(".red-select")) == null ? void 0 : _a.setAttribute("data-value", selected.value);
templateDropdown.querySelectorAll(".red-select-item").forEach((el) => {
if (el.getAttribute("data-value") === selected.value) {
el.classList.add("red-selected");
} else {
el.classList.remove("red-selected");
}
});
}
}
this.imgTemplateManager.setCurrentTemplate(templateId);
}
async restoreThemeSettings(themeId) {
var _a;
const templateSelect = this.customThemeSelect.querySelector(".red-select-text");
const templateDropdown = this.customThemeSelect.querySelector(".red-select-dropdown");
if (templateSelect && templateDropdown) {
const option = await this.getThemeOptions();
const selected = option.find((o) => o.value === themeId);
if (selected) {
templateSelect.textContent = selected.label;
(_a = this.customThemeSelect.querySelector(".red-select")) == null ? void 0 : _a.setAttribute("data-value", selected.value);
templateDropdown.querySelectorAll(".red-select-item").forEach((el) => {
if (el.getAttribute("data-value") === selected.value) {
el.classList.add("red-selected");
} else {
el.classList.remove("red-selected");
}
});
}
}
this.themeManager.setCurrentTheme(themeId);
}
async restoreFontSettings(fontFamily) {
var _a;
const fontSelect = this.customFontSelect.querySelector(".red-select-text");
const fontDropdown = this.customFontSelect.querySelector(".red-select-dropdown");
if (fontSelect && fontDropdown) {
const option = this.getFontOptions();
const selected = option.find((o) => o.value === fontFamily);
if (selected) {
fontSelect.textContent = selected.label;
(_a = this.customFontSelect.querySelector(".red-select")) == null ? void 0 : _a.setAttribute("data-value", selected.value);
fontDropdown.querySelectorAll(".red-select-item").forEach((el) => {
if (el.getAttribute("data-value") === selected.value) {
el.classList.add("red-selected");
} else {
el.classList.remove("red-selected");
}
});
}
}
this.themeManager.setFont(fontFamily);
}
// #endregion
// #region 预览更新
async updatePreview() {
if (!this.currentFile)
return;
this.previewEl.empty();
const content = await this.app.vault.cachedRead(this.currentFile);
await import_obsidian3.MarkdownRenderer.render(
this.app,
content,
this.previewEl,
this.currentFile.path,
this
);
RedConverter.formatContent(this.previewEl);
const hasValidContent = RedConverter.hasValidContent(this.previewEl);
if (hasValidContent) {
this.imgTemplateManager.applyTemplate(this.previewEl, this.settingsManager.getSettings());
const settings = this.settingsManager.getSettings();
if (settings.backgroundSettings.imageUrl) {
const previewContainer = this.previewEl.querySelector(".red-image-preview");
if (previewContainer) {
this.backgroundManager.applyBackgroundStyles(previewContainer, settings.backgroundSettings);
}
}
}
this.updateControlsState(hasValidContent);
if (!hasValidContent) {
this.copyButton.setAttribute("title", "\u8BF7\u5148\u6DFB\u52A0\u4E00\u7EA7\u6807\u9898\u5185\u5BB9");
} else {
this.copyButton.removeAttribute("title");
}
this.updateNavigationState();
}
updateControlsState(enabled) {
this.lockButton.disabled = !enabled;
const templateSelect = this.customTemplateSelect.querySelector(".red-select");
const themeSelect = this.customThemeSelect.querySelector(".red-select");
const fontSelect = this.customFontSelect.querySelector(".red-select");
if (templateSelect) {
templateSelect.classList.toggle("disabled", !enabled);
templateSelect.setAttribute("style", `pointer-events: ${enabled ? "auto" : "none"}`);
}
if (themeSelect) {
themeSelect.classList.toggle("disabled", !enabled);
themeSelect.setAttribute("style", `pointer-events: ${enabled ? "auto" : "none"}`);
}
if (fontSelect) {
fontSelect.classList.toggle("disabled", !enabled);
fontSelect.setAttribute("style", `pointer-events: ${enabled ? "auto" : "none"}`);
}
this.fontSizeSelect.disabled = !enabled;
const fontSizeButtons = this.containerEl.querySelectorAll(".red-font-size-btn");
fontSizeButtons.forEach((button) => {
button.disabled = !enabled;
});
this.copyButton.disabled = !enabled;
const singleDownloadButton = this.containerEl.querySelector(".red-export-button");
if (singleDownloadButton) {
singleDownloadButton.disabled = !enabled;
}
}
// #endregion
// #region 文件处理
async onFileOpen(file) {
this.currentFile = file;
this.currentImageIndex = 0;
if (!file || file.extension !== "md") {
this.previewEl.empty();
this.previewEl.createEl("div", {
text: "\u53EA\u80FD\u9884\u89C8 markdown \u6587\u672C\u6587\u6863",
cls: "red-empty-state"
});
this.updateControlsState(false);
return;
}
this.updateControlsState(true);
this.isPreviewLocked = false;
(0, import_obsidian3.setIcon)(this.lockButton, "unlock");
await this.updatePreview();
}
async onFileModify(file) {
if (file === this.currentFile && !this.isPreviewLocked) {
if (this.updateTimer) {
window.clearTimeout(this.updateTimer);
}
this.updateTimer = window.setTimeout(() => {
this.updatePreview();
}, 500);
}
}
async togglePreviewLock() {
this.isPreviewLocked = !this.isPreviewLocked;
const lockIcon = this.isPreviewLocked ? "lock" : "unlock";
const lockStatus = this.isPreviewLocked ? "\u5F00\u542F\u5B9E\u65F6\u9884\u89C8\u72B6\u6001" : "\u5173\u95ED\u5B9E\u65F6\u9884\u89C8\u72B6\u6001";
(0, import_obsidian3.setIcon)(this.lockButton, lockIcon);
this.lockButton.setAttribute("aria-label", lockStatus);
if (!this.isPreviewLocked) {
await this.updatePreview();
}
}
// #region 工具方法
createCustomSelect(parent, className, options) {
var _a;
const container = parent.createEl("div", { cls: `red-select-container ${className}` });
const select = container.createEl("div", { cls: "red-select" });
const selectedText = select.createEl("span", { cls: "red-select-text" });
select.createEl("span", { cls: "red-select-arrow", text: "\u25BE" });
const dropdown = container.createEl("div", { cls: "red-select-dropdown" });
options.forEach((option) => {
const item = dropdown.createEl("div", {
cls: "red-select-item",
text: option.label
});
item.dataset.value = option.value;
item.addEventListener("click", () => {
dropdown.querySelectorAll(".red-select-item").forEach((el) => el.classList.remove("red-selected"));
item.classList.add("red-selected");
selectedText.textContent = option.label;
select.dataset.value = option.value;
dropdown.classList.remove("red-show");
select.dispatchEvent(new CustomEvent("change", {
detail: { value: option.value }
}));
});
});
if (options.length > 0) {
selectedText.textContent = options[0].label;
select.dataset.value = options[0].value;
(_a = dropdown.querySelector(".red-select-item")) == null ? void 0 : _a.classList.add("red-selected");
}
select.addEventListener("click", (e) => {
e.stopPropagation();
dropdown.classList.toggle("red-show");
});
document.addEventListener("click", () => {
dropdown.classList.remove("red-show");
});
return container;
}
async getThemeOptions() {
const templates2 = this.settingsManager.getVisibleThemes();
return templates2.length > 0 ? templates2.map((t) => ({ value: t.id, label: t.name })) : [{ value: "default", label: "\u9ED8\u8BA4\u4E3B\u9898" }];
}
async getTemplateOptions() {
return this.imgTemplateManager.getImgTemplateOptions();
}
getFontOptions() {
return this.settingsManager.getFontOptions();
}
// #endregion
// 检查是否需要显示捐赠弹窗
shouldShowDonatePrompt() {
this.donateCount++;
if (this.settingsManager) {
const settings = this.settingsManager.getSettings();
settings.donateCount = this.donateCount;
this.settingsManager.updateSettings(settings);
}
const now = Date.now();
const oneDayInMs = 24 * 60 * 60 * 1e3;
if (this.donateCount % this.MAX_COUNT_BEFORE_PROMPT === 0 && now - this.lastDonatePrompt > oneDayInMs) {
this.lastDonatePrompt = now;
if (this.settingsManager) {
const settings = this.settingsManager.getSettings();
settings.lastDonatePrompt = this.lastDonatePrompt;
this.settingsManager.updateSettings(settings);
}
return true;
}
return false;
}
};
// src/themeManager.ts
var ThemeManager = class {
constructor(app, settingsManager) {
this.currentFont = "-apple-system";
this.currentFontSize = 16;
this.app = app;
this.settingsManager = settingsManager;
}
setCurrentTheme(id) {
const theme = this.settingsManager.getTheme(id);
if (theme) {
this.currentTheme = theme;
return true;
}
console.error("\u4E3B\u9898\u672A\u627E\u5230:", id);
return false;
}
// 修改 applyTheme 方法
applyTheme(element, theme) {
const styles = theme ? theme.styles : this.currentTheme.styles;
const imagePreview = element.querySelector(".red-image-preview");
if (imagePreview) {
const styleProperties = styles.imagePreview.split(";");
styleProperties.forEach((property) => {
const [key, value] = property.split(":").map((item) => item.trim());
if (key && value) {
imagePreview.style[key] = value;
}
});
}
const header = element.querySelector(".red-preview-header");
if (header) {
header.querySelectorAll(".red-user-avatar").forEach((el) => {
el.setAttribute("style", styles.header.avatar.container);
});
header.querySelectorAll(".red-avatar-placeholder").forEach((el) => {
el.setAttribute("style", styles.header.avatar.placeholder);
});
header.querySelectorAll(".red-user-avatar img").forEach((el) => {
el.setAttribute("style", styles.header.avatar.image);
});
header.querySelectorAll(".red-user-name-container").forEach((el) => {
el.setAttribute("style", styles.header.nameContainer);
});
header.querySelectorAll(".red-user-name").forEach((el) => {
el.setAttribute("style", styles.header.userName);
});
header.querySelectorAll(".red-user-id").forEach((el) => {
el.setAttribute("style", styles.header.userId);
});
header.querySelectorAll(".red-post-time").forEach((el) => {
el.setAttribute("style", styles.header.postTime);
});
header.querySelectorAll(".red-verified-icon").forEach((el) => {
el.setAttribute("style", styles.header.verifiedIcon);
});
}
const footer = element.querySelector(".red-preview-footer");
if (footer) {
footer.setAttribute("style", styles.footer.container);
footer.querySelectorAll(".red-footer-text").forEach((el) => {
el.setAttribute("style", styles.footer.text);
});
footer.querySelectorAll(".red-footer-separator").forEach((el) => {
el.setAttribute("style", styles.footer.separator);
});
}
["h2", "h3", "h4", "h5", "h6"].forEach((tag) => {
element.querySelectorAll(tag).forEach((el) => {
var _a, _b;
if (!el.querySelector(".content")) {
const content = document.createElement("span");
content.className = "content";
while (el.firstChild) {
content.appendChild(el.firstChild);
}
el.appendChild(content);
const after = document.createElement("span");
after.className = "after";
el.appendChild(after);
}
const styleKey = tag === "h4" || tag === "h5" || tag === "h6" ? "base" : tag;
const titleStyle = styles.title[styleKey];
el.setAttribute("style", `${titleStyle.base}; font-family: ${this.currentFont};`);
(_a = el.querySelector(".content")) == null ? void 0 : _a.setAttribute("style", titleStyle.content);
(_b = el.querySelector(".after")) == null ? void 0 : _b.setAttribute("style", titleStyle.after);
});
});
element.querySelectorAll("p").forEach((el) => {
var _a, _b;
if (!((_a = el.parentElement) == null ? void 0 : _a.closest("p")) && !((_b = el.parentElement) == null ? void 0 : _b.closest("blockquote"))) {
el.setAttribute("style", `${styles.paragraph}; font-family: ${this.currentFont}; font-size: ${this.currentFontSize}px;`);
}
});
element.querySelectorAll("ul, ol").forEach((el) => {
el.setAttribute("style", styles.list.container);
});
element.querySelectorAll("li").forEach((el) => {
el.setAttribute("style", `${styles.list.item}; font-family: ${this.currentFont}; font-size: ${this.currentFontSize}px;`);
});
element.querySelectorAll(".task-list-item").forEach((el) => {
el.setAttribute("style", `${styles.list.taskList}; font-family: ${this.currentFont}; font-size: ${this.currentFontSize}px;`);
});
element.querySelectorAll("blockquote").forEach((el) => {
el.setAttribute("style", `${styles.quote}; font-family: ${this.currentFont}; font-size: ${this.currentFontSize}px;`);
});
element.querySelectorAll("pre").forEach((el) => {
el.setAttribute("style", `${styles.code.block}; font-size: ${this.currentFontSize}px;`);
});
element.querySelectorAll("code:not(pre code)").forEach((el) => {
el.setAttribute("style", `${styles.code.inline}; font-size: ${this.currentFontSize}px;`);
});
element.querySelectorAll("a").forEach((el) => {
el.setAttribute("style", styles.link);
});
element.querySelectorAll("strong").forEach((el) => {
el.setAttribute("style", styles.emphasis.strong);
});
element.querySelectorAll("em").forEach((el) => {
el.setAttribute("style", styles.emphasis.em);
});
element.querySelectorAll("del").forEach((el) => {
el.setAttribute("style", styles.emphasis.del);
});
element.querySelectorAll("table").forEach((el) => {
el.setAttribute("style", styles.table.container);
});
element.querySelectorAll("th").forEach((el) => {
el.setAttribute("style", `${styles.table.header}; font-family: ${this.currentFont}; font-size: ${this.currentFontSize}px;`);
});
element.querySelectorAll("td").forEach((el) => {
el.setAttribute("style", `${styles.table.cell}; font-family: ${this.currentFont}; font-size: ${this.currentFontSize}px;`);
});
element.querySelectorAll("hr").forEach((el) => {
el.setAttribute("style", styles.hr);
});
element.querySelectorAll(".footnote-ref").forEach((el) => {
el.setAttribute("style", styles.footnote.ref);
});
element.querySelectorAll(".footnote-backref").forEach((el) => {
el.setAttribute("style", styles.footnote.backref);
});
element.querySelectorAll("img").forEach((el) => {
el.setAttribute("style", styles.image);
const parent = el.parentElement;
if (parent && parent.tagName.toLowerCase() === "p") {
if (parent.childNodes.length === 1) {
parent.classList.add("red-image-container");
}
}
});
}
// 移除不再需要的方法
setFont(fontFamily) {
this.currentFont = fontFamily;
}
setFontSize(size) {
this.currentFontSize = size;
}
};
// src/settings/settings.ts
var import_events = require("events");
var DEFAULT_SETTINGS = {
templateId: "default",
themeId: "default",
fontFamily: 'Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC"',
fontSize: 16,
backgroundId: "",
themes: [],
customThemes: [],
// 修改默认用户信息
userAvatar: "",
// 默认为空,提示用户上传
userName: "\u591C\u534A",
notesTitle: "\u5907\u5FD8\u5F55",
userId: "@Yeban",
showTime: true,
timeFormat: "zh-CN",
headingLevel: "h2",
// 默认使用二级标题
footerLeftText: "\u591C\u534A\u8FC7\u540E\uFF0C\u5149\u660E\u4FBF\u542F\u7A0B",
footerRightText: "\u6B22\u8FCE\u5173\u6CE8\u516C\u4F17\u53F7\uFF1A\u591C\u534A",
customFonts: [
{
value: 'Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, "PingFang SC", Cambria, Cochin, Georgia, Times, "Times New Roman", serif',
label: "\u9ED8\u8BA4\u5B57\u4F53",
isPreset: true
},
{
value: 'SimSun, "\u5B8B\u4F53", serif',
label: "\u5B8B\u4F53",
isPreset: true
},
{
value: 'SimHei, "\u9ED1\u4F53", sans-serif',
label: "\u9ED1\u4F53",
isPreset: true
},
{
value: 'KaiTi, "\u6977\u4F53", serif',
label: "\u6977\u4F53",
isPreset: true
},
{
value: '"Microsoft YaHei", "\u5FAE\u8F6F\u96C5\u9ED1", sans-serif',
label: "\u96C5\u9ED1",
isPreset: true
}
],
backgroundSettings: {
imageUrl: "",
scale: 1,
position: { x: 0, y: 0 }
}
};
var SettingsManager = class extends import_events.EventEmitter {
constructor(plugin) {
super();
this.plugin = plugin;
this.settings = DEFAULT_SETTINGS;
}
async loadSettings() {
let savedData = await this.plugin.loadData();
if (!savedData) {
savedData = {};
}
if (!savedData.themes || savedData.themes.length === 0) {
const { templates: templates2 } = await Promise.resolve().then(() => (init_templates(), templates_exports));
savedData.themes = Object.values(templates2).map((theme) => ({
...theme,
isPreset: true
}));
}
if (!savedData.customThemes) {
savedData.customThemes = [];
}
this.settings = Object.assign({}, DEFAULT_SETTINGS, savedData);
}
// 主题相关方法
getAllThemes() {
return [...this.settings.themes, ...this.settings.customThemes];
}
// 新增:获取可见主题
getVisibleThemes() {
return this.getAllThemes().filter((theme) => theme.isVisible !== false);
}
getTheme(themeId) {
return this.settings.themes.find((theme) => theme.id === themeId) || this.settings.customThemes.find((theme) => theme.id === themeId);
}
async addCustomTheme(theme) {
theme.isPreset = false;
theme.isVisible = true;
this.settings.customThemes.push(theme);
await this.saveSettings();
this.emit("theme-visibility-changed");
}
async updateTheme(themeId, updatedTheme) {
const presetThemeIndex = this.settings.themes.findIndex((t) => t.id === themeId);
if (presetThemeIndex !== -1) {
if ("isVisible" in updatedTheme) {
this.settings.themes[presetThemeIndex] = {
...this.settings.themes[presetThemeIndex],
isVisible: updatedTheme.isVisible
};
await this.saveSettings();
this.emit("theme-visibility-changed");
return true;
}
return false;
}
const customThemeIndex = this.settings.customThemes.findIndex((t) => t.id === themeId);
if (customThemeIndex !== -1) {
this.settings.customThemes[customThemeIndex] = {
...this.settings.customThemes[customThemeIndex],
...updatedTheme
};
await this.saveSettings();
this.emit("theme-visibility-changed");
return true;
}
return false;
}
async removeTheme(themeId) {
const theme = this.getTheme(themeId);
if (theme && !theme.isPreset) {
this.settings.customThemes = this.settings.customThemes.filter((t) => t.id !== themeId);
if (this.settings.themeId === themeId) {
this.settings.themeId = "default";
}
await this.saveSettings();
this.emit("theme-visibility-changed");
return true;
}
return false;
}
async saveSettings() {
await this.plugin.saveData(this.settings);
}
getSettings() {
return this.settings;
}
async updateSettings(settings) {
this.settings = { ...this.settings, ...settings };
await this.saveSettings();
}
getFontOptions() {
return this.settings.customFonts;
}
async addCustomFont(font) {
this.settings.customFonts.push({ ...font, isPreset: false });
await this.saveSettings();
}
async removeFont(value) {
const font = this.settings.customFonts.find((f) => f.value === value);
if (font && !font.isPreset) {
this.settings.customFonts = this.settings.customFonts.filter((f) => f.value !== value);
await this.saveSettings();
}
}
async updateFont(oldValue, newFont) {
const index = this.settings.customFonts.findIndex((f) => f.value === oldValue);
if (index !== -1 && !this.settings.customFonts[index].isPreset) {
this.settings.customFonts[index] = { ...newFont, isPreset: false };
await this.saveSettings();
}
}
};
// src/settings/SettingTab.ts
var import_obsidian8 = require("obsidian");
// src/settings/CreateThemeModal.ts
var import_obsidian5 = require("obsidian");
// src/settings/ThemePreviewModal.ts
var import_obsidian4 = require("obsidian");
var ThemePreviewModal = class extends import_obsidian4.Modal {
constructor(app, settingsManager, theme, themeManager) {
super(app);
this.settingsManager = settingsManager;
this.theme = theme;
this.themeManager = themeManager;
}
onOpen() {
const { contentEl } = this;
contentEl.empty();
contentEl.addClass("theme-preview-modal");
contentEl.createEl("h2", { text: `\u4E3B\u9898\u9884\u89C8: ${this.theme.name}`, cls: "red-theme-title" });
const container = contentEl.createDiv("tp-red-preview-container");
const previewContainer = container.createDiv("red-image-preview");
const settings = this.settingsManager.getSettings();
const header = previewContainer.createDiv("red-preview-header");
const userInfo = header.createEl("div", { cls: "red-user-info" });
const userLeft = userInfo.createEl("div", { cls: "red-user-left" });
const avatar = userLeft.createEl("div", { cls: "red-user-avatar" });
if (settings.userAvatar) {
avatar.createEl("img", {
attr: {
src: settings.userAvatar,
alt: "\u7528\u6237\u5934\u50CF"
}
});
} else {
const placeholder = avatar.createEl("div", { cls: "red-avatar-placeholder" });
placeholder.createEl("span", {
cls: "red-avatar-upload-icon",
text: "\u{1F4F7}"
});
}
const userMeta = userLeft.createEl("div", { cls: "red-user-meta" });
const userNameContainer = userMeta.createEl("div", { cls: "red-user-name-container" });
userNameContainer.createEl("div", { cls: "red-user-name", text: `${settings.userName}` });
userNameContainer.createEl("span", {
cls: "red-verified-icon",
attr: {
"aria-label": "Verified account",
role: "img"
}
}).innerHTML = `<svg viewBox="0 0 22 22" class="r-4qtqp9 r-yyyyoo r-1xvli5t r-bnwqim r-lrvibr r-m6rgpd r-1cvl2hr r-f9ja8p r-og9te1 r-3t4u6i"><g><path d="M20.396 11c-.018-.646-.215-1.275-.57-1.816-.354-.54-.852-.972-1.438-1.246.223-.607.27-1.264.14-1.897-.131-.634-.437-1.218-.882-1.687-.47-.445-1.053-.75-1.687-.882-.633-.13-1.29-.083-1.897.14-.273-.587-.704-1.086-1.245-1.44S11.647 1.62 11 1.604c-.646.017-1.273.213-1.813.568s-.969.854-1.24 1.44c-.608-.223-1.267-.272-1.902-.14-.635.13-1.22.436-1.69.882-.445.47-.749 1.055-.878 1.688-.13.633-.08 1.29.144 1.896-.587.274-1.087.705-1.443 1.245-.356.54-.555 1.17-.574 1.817.02.647.218 1.276.574 1.817.356.54.856.972 1.443 1.245-.224.606-.274 1.263-.144 1.896.13.634.433 1.218.877 1.688.47.443 1.054.747 1.687.878.633.132 1.29.084 1.897-.136.274.586.705 1.084 1.246 1.439.54.354 1.17.551 1.816.569.647-.016 1.276-.213 1.817-.567s.972-.854 1.245-1.44c.604.239 1.266.296 1.903.164.636-.132 1.22-.447 1.68-.907.46-.46.776-1.044.908-1.681s.075-1.299-.165-1.903c.586-.274 1.084-.705 1.439-1.246.354-.54.551-1.17.569-1.816zM9.662 14.85l-3.429-3.428 1.293-1.302 2.072 2.072 4.4-4.794 1.347 1.246z"></path></g></svg>`;
userMeta.createEl("div", { cls: "red-user-id", text: `${settings.userId}` });
const userRight = userInfo.createEl("div", { cls: "red-user-right" });
userRight.createEl("div", { cls: "red-post-time", text: "2025/4/20" });
const content = previewContainer.createDiv("red-preview-content");
content.createEl("h2", { text: "\u63A2\u7D22\u591C\u534A\u63D2\u4EF6\u7684\u65E0\u9650\u53EF\u80FD" });
const paragraph1 = content.createEl("p");
paragraph1.createEl("span", { text: "\u63D2\u4EF6\u63D0\u4F9B\u591A\u79CD" });
paragraph1.createEl("strong", { text: "\u4F18\u96C5\u7684\u64CD\u4F5C\uFF0C" });
paragraph1.createEl("span", { text: "\u52A9\u60A8\u8F7B\u677E\u53D1\u5E03\u7B14\u8BB0\u3002" });
const list = content.createEl("ul");
list.createEl("li", { text: "\u8F7B\u677E\u5B9A\u5236\u4E3B\u9898\u6837\u5F0F" });
list.createEl("li", { text: "\u5B9E\u65F6\u9884\u89C8\u4E3B\u9898\u6548\u679C" });
const quote = content.createEl("blockquote");
quote.createEl("p", { text: "\u201C\u8BA9\u7B14\u8BB0\u53D1\u5E16\u53D8\u5F97\u5982\u6B64\u7B80\u5355\u3002\u201D" });
const codeBlock = content.createEl("pre");
codeBlock.classList.add("red-pre");
const dots = codeBlock.createDiv("red-code-dots");
["red", "yellow", "green"].forEach((color) => {
dots.createSpan({ cls: `red-code-dot red-code-dot-${color}` });
});
codeBlock.createEl("code", { text: 'console.log("\u6B22\u8FCE\u4F7F\u7528\u591C\u534A\u63D2\u4EF6\uFF01");' });
content.createEl("hr");
content.createEl("strong", { text: "\u5982\u679C\u60A8\u89C9\u5F97\u6211\u7684\u63D2\u4EF6\u5BF9\u60A8\u6709\u5E2E\u52A9\uFF0C\u8BF7\u6253\u8D4F\u652F\u6301\u6211\u3002" });
const footer = previewContainer.createDiv("red-preview-footer");
if (footer) {
if (settings.showFooter !== false) {
footer.createEl("div", { cls: "red-footer-text", text: `${settings.footerLeftText}` });
footer.createEl("div", { cls: "red-footer-separator", text: "|" });
footer.createEl("div", { cls: "red-footer-text", text: `${settings.footerRightText}` });
} else {
footer.remove();
}
}
this.themeManager.applyTheme(container, this.theme);
}
onClose() {
const { contentEl } = this;
contentEl.empty();
}
};
// src/settings/CreateThemeModal.ts
var CreateThemeModal = class extends import_obsidian5.Modal {
constructor(app, plugin, onSubmit, existingTheme) {
super(app);
this.showSampleTemplate = false;
this.plugin = plugin;
this.existingTheme = existingTheme;
this.onSubmit = onSubmit;
this.theme = existingTheme ? { ...existingTheme } : {
id: "",
name: "",
description: "",
isPreset: false,
isVisible: true,
styles: this.initializeStyles()
// 使用合并后的初始化方法
};
}
initializeStyles() {
return {
imagePreview: "background-color: #fffaf5; padding: 32px 28px;",
header: {
avatar: {
container: "width: 42px; height: 42px; border-radius: 14px; overflow: hidden; box-shadow: 0 4px 16px rgba(184,115,51,0.1);",
placeholder: "transition: all 0.3s ease;",
image: "object-fit: cover; transition: transform 0.3s ease; filter: brightness(1.05) contrast(1.02);"
},
nameContainer: "display: flex; align-items: center; gap: 8px;",
userName: "font-size: 17px; font-weight: 600; color: #8b4513; serif; text-shadow: 0 2px 4px rgba(139,69,19,0.1);",
userId: "font-size: 14px; color: #b87333; font-family: 'Noto Serif SC', serif;",
postTime: "font-size: 13px; color: #d2691e; font-style: italic;",
verifiedIcon: "width: 20px; height: 20px; margin-left: -5px; fill: #1DA1F2;"
},
footer: {
container: "position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px; color: #b87333; font-size: 13px; border-top: 1px solid #b8733380; background: rgba(255,250,245,0.95); backdrop-filter: blur(8px);",
text: "color: inherit; transition: color 0.2s ease; font-style: italic; white-space: nowrap;",
separator: "color: #deb887;"
},
title: {
h2: {
base: "margin: 10px 0 0; font-size: 1.6em; letter-spacing: 0.01em; line-height: 1.5;",
content: "font-weight: 600; color: #8b4513; ",
after: ""
},
h3: {
base: "margin: 8px 0 0; font-size: 1.3em; line-height: 1.5;",
content: "font-weight: 600; color: #8b4513; ",
after: ""
},
base: {
base: "margin: 6px 0 0; font-size: 1.15em; line-height: 1.5;",
content: "font-weight: 600; color: #8b4513;",
after: ""
}
},
paragraph: "line-height: 1.75; margin-bottom: 1.1em; font-size: 15px; color: #5a4a42;",
emphasis: {
strong: "font-weight: 600; color: #d2691e;",
em: "font-style: normal; color: #b87333; background: rgba(184,115,51,0.1); padding: 0 4px; border-left: 2px solid #b8733380;",
del: "text-decoration: line-through; color: #8b4513; opacity: 0.8;"
},
list: {
container: "padding-left: 26px; margin-bottom: 1.2em; color: #6b4423;",
item: "margin-bottom: 0.8em; font-size: 15px; color: #6b4423; line-height: 1.85; font-family: 'Noto Serif SC', serif;",
taskList: "list-style: none; margin-left: -22px; font-size: 15px; color: #6b4423; line-height: 1.85; font-family: 'Noto Serif SC', serif;"
},
code: {
block: "background: #fff6e9; padding: 1.2em; border-radius: 8px; font-size: 14px; font-family: 'Fira Code', monospace; line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; color: #8b4513; margin: 1.3em 0; border: 1px solid #b8733380; box-shadow: inset 0 4px 12px rgba(184,115,51,0.05), 0 2px 8px rgba(184,115,51,0.05);",
inline: "background: #fff6e9; padding: 4px 10px; border-radius: 4px; color: #8b4513; font-size: 14px; font-family: 'Fira Code', monospace; border: 1px solid #b8733380;"
},
quote: "border-left: 3px solid #deb887; padding: 0 0 0 20px; margin: 1.3em 0; color: #b87333; font-style: italic; font-size: 15px; line-height: 1.85; font-family: 'Noto Serif SC', serif; background: linear-gradient(to right, rgba(222,184,135,0.1), transparent);",
image: "max-width: 100%; height: auto; margin: 1.5em auto; border-radius: 12px; box-shadow: 0 4px 16px rgba(184,115,51,0.1); border: 1px solid #b8733380;",
link: "color: #d2691e; text-decoration: none; background-image: linear-gradient(to right, #d2691e80, #b8733380); background-size: 0% 1px; background-repeat: no-repeat; background-position: 0 100%; transition: all 0.3s ease; font-family: 'Noto Serif SC', serif;",
table: {
container: "width: 100%; margin: 1.4em 0; border-collapse: separate; border-spacing: 0; border: 1px solid #b8733380; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 12px rgba(184,115,51,0.05);",
header: "background: linear-gradient(135deg, #fff6e9, #fffaf5); font-weight: 600; color: #8b4513; padding: 14px; font-family: 'Noto Serif SC', serif; border-bottom: 2px solid #b8733380;",
cell: "padding: 14px; color: #6b4423; border-top: 1px solid #b8733380; font-family: 'Noto Serif SC', serif;"
},
hr: "border: none; border-top: 2px solid #b8733380; margin: 28px 0; box-shadow: 0 2px 8px rgba(184,115,51,0.05);",
footnote: {
ref: "color: #b87333; text-decoration: none; font-size: 0.9em; font-style: italic;",
backref: "color: #b87333; text-decoration: none; font-size: 0.9em; font-style: italic;"
}
};
}
onOpen() {
const { contentEl } = this;
contentEl.empty();
contentEl.addClass("red-theme-modal");
const headerEl = contentEl.createDiv("modal-header");
headerEl.createEl("h2", { text: this.theme.id ? "\u7F16\u8F91\u4E3B\u9898" : "\u65B0\u5EFA\u4E3B\u9898" });
const nameContainer = headerEl.createDiv("name-container");
if (!this.existingTheme) {
new import_obsidian5.Setting(nameContainer).setName("\u662F\u5426\u9009\u62E9\u53C2\u8003\u6A21\u677F").addToggle((toggle) => {
toggle.setValue(this.showSampleTemplate).onChange((value) => {
this.showSampleTemplate = value;
this.themeSelect.style.display = this.showSampleTemplate ? "block" : "none";
});
});
new import_obsidian5.Setting(nameContainer).setName("\u9009\u62E9\u53C2\u8003\u6A21\u677F").addDropdown((dropdown) => {
this.themeSelect = dropdown.addOptions(this.getThemeOptions()).setValue(this.theme.id).onChange((value) => {
const selectedTheme = this.getThemeById(value);
if (selectedTheme) {
this.theme = { ...selectedTheme, id: "", name: "", description: "", isPreset: false };
}
}).selectEl;
this.themeSelect.style.display = this.showSampleTemplate ? "block" : "none";
});
}
new import_obsidian5.Setting(nameContainer).setName("\u4E3B\u9898\u540D\u79F0").addText((text) => {
this.nameInput = text.setPlaceholder("\u8BF7\u8F93\u5165\u4E3B\u9898\u540D\u79F0").setValue(this.theme.name).onChange((value) => {
const trimmedValue = value.trim();
this.theme.name = trimmedValue;
if (!trimmedValue) {
new import_obsidian5.Notice("\u4E3B\u9898\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A");
}
if (!this.theme.id.startsWith("preset-")) {
this.theme.id = this.generateThemeId(trimmedValue || "\u672A\u547D\u540D\u4E3B\u9898");
}
}).inputEl;
setTimeout(() => this.nameInput.focus(), 0);
return text;
});
new import_obsidian5.Setting(nameContainer).setName("\u4E3B\u9898\u63CF\u8FF0").addText((text) => {
text.setPlaceholder("\u8BF7\u8F93\u5165\u4E3B\u9898\u63CF\u8FF0").setValue(this.theme.description).onChange((value) => {
const trimmedValue = value.trim();
this.theme.description = trimmedValue;
});
return text;
});
const scrollContainer = contentEl.createDiv("modal-scroll-container");
const settingContainer = scrollContainer.createDiv("setting-container");
this.addStyleSettings(settingContainer, "\u5168\u5C40\u6837\u5F0F", this.theme.styles);
this.addStyleSettings(settingContainer, "\u80CC\u666F\u6837\u5F0F", this.theme.styles.imagePreview);
this.addStyleSettings(settingContainer, "\u9875\u7709\u6837\u5F0F", this.theme.styles.header);
this.addStyleSettings(settingContainer, "\u9875\u811A\u6837\u5F0F", this.theme.styles.footer);
this.addStyleSettings(settingContainer, "\u6807\u9898\u6837\u5F0F", this.theme.styles.title);
this.addStyleSettings(settingContainer, "\u6BB5\u843D\u6837\u5F0F", this.theme.styles);
this.addStyleSettings(settingContainer, "\u5217\u8868\u6837\u5F0F", this.theme.styles.list);
this.addStyleSettings(settingContainer, "\u5F15\u7528\u6837\u5F0F", this.theme.styles);
this.addStyleSettings(settingContainer, "\u4EE3\u7801\u6837\u5F0F", this.theme.styles.code);
this.addStyleSettings(settingContainer, "\u94FE\u63A5\u6837\u5F0F", this.theme.styles);
this.addStyleSettings(settingContainer, "\u8868\u683C\u6837\u5F0F", this.theme.styles.table);
this.addStyleSettings(settingContainer, "\u5206\u9694\u7EBF\u6837\u5F0F", this.theme.styles);
this.addStyleSettings(settingContainer, "\u811A\u6CE8\u6837\u5F0F", this.theme.styles.footnote);
this.addStyleSettings(settingContainer, "\u56FE\u7247\u6837\u5F0F", this.theme.styles);
const buttonContainer = contentEl.createDiv("modal-button-container");
new import_obsidian5.Setting(buttonContainer).addButton((btn) => btn.setButtonText("\u9884\u89C8").onClick(() => {
const previewModal = new ThemePreviewModal(this.app, this.plugin.settingsManager, this.theme, this.plugin.themeManager);
previewModal.open();
})).addButton((btn) => btn.setButtonText("\u53D6\u6D88").onClick(() => this.close())).addButton((btn) => btn.setButtonText("\u4FDD\u5B58").setCta().onClick(async () => {
if (await this.validateAndSubmit()) {
this.close();
}
}));
this.nameInput.addEventListener("keydown", async (e) => {
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
if (await this.validateAndSubmit()) {
this.close();
}
}
});
}
getThemeOptions() {
const themes = this.plugin.settingsManager.getAllThemes();
const options = {};
themes.forEach((theme) => {
options[theme.id] = theme.name;
});
return options;
}
getThemeById(id) {
return this.plugin.settingsManager.getAllThemes().find((theme) => theme.id === id);
}
addStyleSettings(container, sectionName, styles) {
const section = container.createDiv("style-section");
const header = section.createDiv("style-section-header");
const titleContainer = header.createDiv("style-section-title");
const toggle = titleContainer.createSpan("style-section-toggle");
(0, import_obsidian5.setIcon)(toggle, "chevron-right");
titleContainer.createEl("h3", { text: sectionName });
const resetButton = header.createDiv("style-section-reset");
const resetIcon = resetButton.createSpan("clickable-icon");
(0, import_obsidian5.setIcon)(resetIcon, "reset");
resetButton.addEventListener("click", (e) => {
e.stopPropagation();
const defaultStyles = this.initializeStyles();
switch (sectionName) {
case "\u5168\u5C40\u6837\u5F0F":
this.theme.styles = defaultStyles;
styles = defaultStyles;
break;
case "\u80CC\u666F\u6837\u5F0F":
this.theme.styles.imagePreview = defaultStyles.imagePreview;
styles = defaultStyles.imagePreview;
break;
case "\u9875\u7709\u6837\u5F0F":
this.theme.styles.header = defaultStyles.header;
styles = defaultStyles.header;
break;
case "\u9875\u811A\u6837\u5F0F":
this.theme.styles.footer = defaultStyles.footer;
styles = defaultStyles.footer;
break;
case "\u6807\u9898\u6837\u5F0F":
this.theme.styles.title = defaultStyles.title;
styles = defaultStyles.title;
break;
case "\u6BB5\u843D\u6837\u5F0F":
this.theme.styles.paragraph = defaultStyles.paragraph;
this.theme.styles.emphasis = defaultStyles.emphasis;
styles = { paragraph: defaultStyles.paragraph, emphasis: defaultStyles.emphasis };
break;
case "\u5217\u8868\u6837\u5F0F":
this.theme.styles.list = defaultStyles.list;
styles = defaultStyles.list;
break;
case "\u5F15\u7528\u6837\u5F0F":
this.theme.styles.quote = defaultStyles.quote;
styles = { quote: defaultStyles.quote };
break;
case "\u4EE3\u7801\u6837\u5F0F":
this.theme.styles.code = defaultStyles.code;
styles = defaultStyles.code;
break;
case "\u94FE\u63A5\u6837\u5F0F":
this.theme.styles.link = defaultStyles.link;
styles = { link: defaultStyles.link };
break;
case "\u8868\u683C\u6837\u5F0F":
this.theme.styles.table = defaultStyles.table;
styles = defaultStyles.table;
break;
case "\u5206\u9694\u7EBF\u6837\u5F0F":
this.theme.styles.hr = defaultStyles.hr;
styles = { hr: defaultStyles.hr };
break;
case "\u811A\u6CE8\u6837\u5F0F":
this.theme.styles.footnote = defaultStyles.footnote;
styles = defaultStyles.footnote;
break;
case "\u56FE\u7247\u6837\u5F0F":
this.theme.styles.image = defaultStyles.image;
styles = { image: defaultStyles.image };
break;
}
content.empty();
this.addStyleSettingsContent(content, sectionName, styles);
});
const content = section.createDiv("style-section-content");
this.addStyleSettingsContent(content, sectionName, styles);
header.addEventListener("click", () => {
const isExpanded = !section.hasClass("is-expanded");
section.toggleClass("is-expanded", isExpanded);
(0, import_obsidian5.setIcon)(toggle, isExpanded ? "chevron-down" : "chevron-right");
});
}
// 新增方法,用于处理设置内容
addStyleSettingsContent(content, sectionName, styles) {
switch (sectionName) {
case "\u5168\u5C40\u6837\u5F0F":
this.addGlobalStylesSettings(content, styles);
break;
case "\u80CC\u666F\u6837\u5F0F":
this.addBackGroupStylesSettings(content, styles);
break;
case "\u9875\u7709\u6837\u5F0F":
this.addHeaderSettings(content, styles);
break;
case "\u9875\u811A\u6837\u5F0F":
this.addFooterSettings(content, styles);
break;
case "\u6807\u9898\u6837\u5F0F":
this.addTitleSettings(content, styles);
break;
case "\u6BB5\u843D\u6837\u5F0F":
this.addParagraphAndEmphasisSettings(content, styles);
break;
case "\u5217\u8868\u6837\u5F0F":
this.addListSettings(content, styles);
break;
case "\u5F15\u7528\u6837\u5F0F":
this.addQuoteSettings(content, styles);
break;
case "\u4EE3\u7801\u6837\u5F0F":
this.addCodeSettings(content, styles);
break;
case "\u94FE\u63A5\u6837\u5F0F":
this.addLinkSettings(content, styles);
break;
case "\u8868\u683C\u6837\u5F0F":
this.addTableSettings(content, styles);
break;
case "\u5206\u9694\u7EBF\u6837\u5F0F":
this.addHrSettings(content, styles);
break;
case "\u811A\u6CE8\u6837\u5F0F":
this.addFootnoteSettings(content, styles);
break;
case "\u56FE\u7247\u6837\u5F0F":
this.addImageSettings(content, styles);
break;
}
}
async validateAndSubmit() {
const trimmedName = this.theme.name.trim();
if (!trimmedName) {
new import_obsidian5.Notice("\u4E3B\u9898\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A");
this.nameInput.focus();
return false;
}
if (this.showSampleTemplate && !this.themeSelect.value) {
new import_obsidian5.Notice("\u8BF7\u9009\u62E9\u4E00\u4E2A\u53C2\u8003\u6A21\u677F");
this.themeSelect.focus();
return false;
}
try {
await this.onSubmit(this.theme);
return true;
} catch (error) {
new import_obsidian5.Notice("\u4FDD\u5B58\u5931\u8D25\uFF1A" + error.message, 3e3);
return false;
}
}
generateThemeId(name) {
return name.toLowerCase().replace(/[^a-z0-9\u4e00-\u9fa5]/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "") + "-" + Date.now().toString(36).slice(-4);
}
addGlobalStylesSettings(container, styles) {
const section = container.createDiv("global-style-section");
new import_obsidian5.Setting(section).setName("\u5168\u5C40\u4E3B\u9898\u8272").setDesc("\u4FEE\u6539\u6B64\u989C\u8272\u5C06\u66F4\u65B0\u6240\u6709\u6587\u5B57\u76F8\u5173\u7684\u989C\u8272").addColorPicker((color) => {
var _a;
const defaultColor = ((_a = styles.title.h2.content.match(/color:\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _a[1]) || "#8b4513";
color.setValue(defaultColor).onChange((value) => {
styles.header.userName = styles.header.userName.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
styles.header.userId = styles.header.userId.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}BB`);
styles.header.postTime = styles.header.postTime.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}99`);
styles.header.verifiedIcon = styles.header.verifiedIcon.replace(/background:\s*linear-gradient\([^)]+\)/, `background: linear-gradient(135deg, ${value}, ${value})`).replace(/border:\s*1px\s*solid\s*#[a-fA-F0-9]+80/, `border: 1px solid ${value}80`).replace(/box-shadow:\s*[^;]+;/, `box-shadow: 0 2px 8px ${value}1a;`);
styles.footer.container = styles.footer.container.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}CC`);
styles.footer.container = styles.footer.container.replace(/border-top:\s*1px solid\s*#[a-fA-F0-9]+/, `border-top: 1px solid ${value}40`);
styles.footer.container = styles.footer.container.replace(/background:\s*[^;]+/, `background: linear-gradient(to top, ${value}08, transparent)`);
styles.paragraph = styles.paragraph.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
Object.keys(styles.emphasis).forEach((key) => {
styles.emphasis[key] = styles.emphasis[key].replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
});
["h2", "h3", "base"].forEach((level) => {
styles.title[level].content = styles.title[level].content.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
});
["container", "item", "taskList"].forEach((key) => {
styles.list[key] = styles.list[key].replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
});
styles.quote = styles.quote.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
["block", "inline"].forEach((key) => {
styles.code[key] = styles.code[key].replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
});
styles.link = styles.link.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`).replace(/linear-gradient\([^)]+\)/, `linear-gradient(to right, ${value}80, ${value}80)`);
styles.table.header = styles.table.header.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
styles.table.cell = styles.table.cell.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
["ref", "backref"].forEach((key) => {
styles.footnote[key] = styles.footnote[key].replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
});
styles.image = styles.image.replace(/border:\s*1px solid\s*#[a-fA-F0-9]+80/, `border: 1px solid ${value}80`);
});
});
}
addBackGroupStylesSettings(container, styles) {
const titleSection = container.createDiv("title-level-section");
const styleMap = /* @__PURE__ */ new Map();
if (styles) {
styles.split(";").forEach((style) => {
const [property, value] = style.split(":").map((s) => s.trim());
if (property && value) {
styleMap.set(property, value);
}
});
}
new import_obsidian5.Setting(titleSection).setName("\u80CC\u666F\u989C\u8272").setDesc("\u8BBE\u7F6E\u5185\u5BB9\u533A\u57DF\u7684\u80CC\u666F\u989C\u8272\uFF0C\u5EFA\u8BAE\u4F7F\u7528\u6D45\u8272\u4EE5\u4FDD\u8BC1\u6587\u5B57\u6E05\u6670\u53EF\u89C1").addColorPicker((color) => {
const currentBg = styleMap.get("background-color") || "#fffaf5";
color.setValue(currentBg).onChange((value) => {
styleMap.set("background-color", value);
this.theme.styles.imagePreview = Array.from(styleMap.entries()).map(([prop, val]) => `${prop}: ${val}`).join("; ") + ";";
});
});
new import_obsidian5.Setting(titleSection).setName("\u81EA\u5B9A\u4E49\u6837\u5F0F").setDesc("\u53EF\u4EE5\u6DFB\u52A0\u81EA\u5B9A\u4E49\u7684CSS\u6837\u5F0F\uFF0C\u5982\u5185\u8FB9\u8DDD\u3001\u8FB9\u6846\u7B49\u3002\u4F8B\u5982\uFF1Apadding: 32px 28px; border: 1px solid #ccc;").addTextArea((text) => {
const customStyles = Array.from(styleMap.entries()).filter(([prop]) => prop !== "background-color").map(([prop, val]) => `${prop}: ${val}`).join("; ");
text.setPlaceholder("\u5728\u6B64\u8F93\u5165\u81EA\u5B9A\u4E49CSS\u6837\u5F0F").setValue(customStyles).onChange((value) => {
Array.from(styleMap.keys()).forEach((key) => {
if (key !== "background-color") {
styleMap.delete(key);
}
});
value.split(";").forEach((style) => {
const [property, value2] = style.split(":").map((s) => s.trim());
if (property && value2) {
styleMap.set(property, value2);
}
});
this.theme.styles.imagePreview = Array.from(styleMap.entries()).map(([prop, val]) => `${prop}: ${val}`).join("; ") + ";";
});
text.inputEl.addClass("custom-css-input");
text.inputEl.rows = 4;
return text;
});
}
addHeaderSettings(container, styles) {
const headerSection = container.createDiv("header-section");
new import_obsidian5.Setting(headerSection).setName("\u9875\u7709\u4E3B\u8272\u8C03").setDesc("\u8BBE\u7F6E\u9875\u7709\u533A\u57DF\u7684\u4E3B\u8981\u989C\u8272\uFF0C\u5305\u62EC\u7528\u6237\u540D\u3001ID\u548C\u53D1\u5E03\u65F6\u95F4\u7B49\u5143\u7D20").addColorPicker((color) => {
var _a;
const currentColor = (_a = styles.userName.match(/color:\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _a[1];
color.setValue(currentColor).onChange((value) => {
["userName", "userId", "postTime"].forEach((key) => {
styles[key] = styles[key].replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
});
styles.avatar.container = styles.avatar.container.replace(/box-shadow:\s*0\s*4px\s*16px\s*[^;]+/, `box-shadow: 0 4px 16px ${value}1a`).replace(/border:\s*1px solid\s*#[a-fA-F0-9]+80/, `border: 1px solid ${value}80`);
});
});
new import_obsidian5.Setting(headerSection).setName("\u5934\u50CF\u5706\u89D2").setDesc("\u8BBE\u7F6E\u5934\u50CF\u7684\u5706\u89D2\u5927\u5C0F\uFF08\u5355\u4F4D\uFF1Apx\uFF09\u3002\u8BBE\u7F6E\u4E3A-1\u8868\u793A\u5706\u5F62\uFF0C\u5927\u4E8E1\u5219\u6709\u5706\u89D2").addText((text) => {
var _a;
const currentRadius = ((_a = styles.avatar.container.match(/border-radius:\s*([\d-]+)px/)) == null ? void 0 : _a[1]) || "12";
text.setValue(currentRadius).setPlaceholder("\u8F93\u5165\u5706\u89D2\u5927\u5C0F").onChange((value) => {
let radius;
if (value === "-1") {
radius = "50%";
} else {
const pixelValue = parseInt(value) || 12;
radius = `${pixelValue}px`;
}
styles.avatar.container = styles.avatar.container.replace(/border-radius:\s*[^;]+/, `border-radius: ${radius}`);
});
});
new import_obsidian5.Setting(headerSection).setName("\u8BA4\u8BC1\u56FE\u6807\u989C\u8272").setDesc("\u8BBE\u7F6E\u8BA4\u8BC1\u56FE\u6807\u7684\u989C\u8272").addColorPicker((color) => {
var _a;
const currentColor = ((_a = styles.verifiedIcon.match(/fill:\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _a[1]) || "#1DA1F2";
color.setValue(currentColor).onChange((value) => {
styles.verifiedIcon = styles.verifiedIcon.replace(/fill:\s*[^;]+/, `fill: ${value}`);
if (!styles.verifiedIcon.includes("fill:")) {
styles.verifiedIcon += `; fill: ${value}`;
}
});
});
new import_obsidian5.Setting(headerSection).setName("\u8BA4\u8BC1\u56FE\u6807\u5C3A\u5BF8").setDesc("\u8BBE\u7F6E\u8BA4\u8BC1\u56FE\u6807\u7684\u5BBD\u5EA6\u548C\u9AD8\u5EA6\uFF08\u5355\u4F4D\uFF1Apx\uFF09").addText((text) => {
text.setValue("25").setPlaceholder("\u8F93\u5165\u56FE\u6807\u5C3A\u5BF8").onChange((value) => {
const size = value + "px";
styles.verifiedIcon = styles.verifiedIcon.replace(/width:\s*[^;]+/, `width: ${size}`).replace(/height:\s*[^;]+/, `height: ${size}`);
});
});
new import_obsidian5.Setting(headerSection).setName("\u8BA4\u8BC1\u56FE\u6807\u95F4\u8DDD").setDesc("\u8BBE\u7F6E\u8BA4\u8BC1\u56FE\u6807\u7684\u5DE6\u8FB9\u8DDD\uFF08\u5355\u4F4D\uFF1Apx\uFF09").addText((text) => {
text.setValue("-5").setPlaceholder("\u8F93\u5165\u5DE6\u8FB9\u8DDD").onChange((value) => {
const margin = value + "px";
styles.verifiedIcon = styles.verifiedIcon.replace(/margin-left:\s*[^;]+/, `margin-left: ${margin}`);
});
});
}
addTitleSettings(container, styles) {
["h2", "h3", "base"].forEach((level) => {
const titleSection = container.createDiv("style-section");
const header = titleSection.createDiv("style-section-header");
const titleContainer = header.createDiv("style-section-title");
const toggle = titleContainer.createSpan("style-section-toggle");
(0, import_obsidian5.setIcon)(toggle, "chevron-right");
titleContainer.createEl("h4", { text: level === "base" ? "\u5176\u4ED6\u6807\u9898\u6837\u5F0F" : `${level.toUpperCase()} \u6807\u9898\u6837\u5F0F` });
const content = titleSection.createDiv("style-section-content");
content.style.display = "none";
header.addEventListener("click", () => {
const isExpanded = content.style.display === "none";
content.style.display = isExpanded ? "block" : "none";
(0, import_obsidian5.setIcon)(toggle, isExpanded ? "chevron-down" : "chevron-right");
});
new import_obsidian5.Setting(content).setName("\u5B57\u4F53\u5927\u5C0F").setDesc("\u8BBE\u7F6E\u6807\u9898\u7684\u5B57\u4F53\u5927\u5C0F\uFF08\u5355\u4F4D\uFF1Aem\uFF0C\u76F8\u5BF9\u4E8E\u57FA\u7840\u5B57\u53F7\u7684\u500D\u6570\uFF09").addText((text) => {
var _a;
const currentSize = (_a = styles[level].base.match(/font-size:\s*([\d.]+)em/)) == null ? void 0 : _a[1];
text.setValue(currentSize).onChange((value) => {
const size = parseFloat(value) || 1.15;
styles[level].base = styles[level].base.replace(/font-size:\s*[\d.]+em/, `font-size: ${size}em`);
});
});
new import_obsidian5.Setting(content).setName("\u6587\u672C\u989C\u8272").setDesc("\u8BBE\u7F6E\u6807\u9898\u6587\u5B57\u7684\u989C\u8272").addColorPicker((color) => {
var _a;
const currentColor = (_a = styles[level].content.match(/color:\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _a[1];
color.setValue(currentColor).onChange((value) => {
styles[level].content = styles[level].content.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
});
});
});
}
addFooterSettings(container, styles) {
const footerSection = container.createDiv("footer-section");
new import_obsidian5.Setting(footerSection).setName("\u9875\u811A\u989C\u8272").setDesc("\u8BBE\u7F6E\u9875\u811A\u533A\u57DF\u7684\u6587\u5B57\u989C\u8272\uFF0C\u5305\u62EC\u5206\u9694\u7EBF\u989C\u8272").addColorPicker((color) => {
var _a;
const currentColor = (_a = styles.container.match(/color:\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _a[1];
color.setValue(currentColor).onChange((value) => {
styles.container = styles.container.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`).replace(/border-top:\s*1px solid\s*#[a-fA-F0-9]+80/, `border-top: 1px solid ${value}80`);
styles.text = `color: inherit; transition: color 0.2s ease; font-style: italic; white-space: nowrap;`;
styles.separator = `color: inherit;`;
});
});
new import_obsidian5.Setting(footerSection).setName("\u9875\u811A\u80CC\u666F").setDesc("\u8BBE\u7F6E\u9875\u811A\u533A\u57DF\u7684\u80CC\u666F\u989C\u8272\u548C\u900F\u660E\u5EA6").addColorPicker((color) => {
var _a;
const currentBg = (_a = styles.container.match(/background:\s*([^;]+)/)) == null ? void 0 : _a[1];
color.setValue(currentBg).onChange((value) => {
styles.container = styles.container.replace(/background:\s*[^;]+/, `background: ${value}`);
});
});
new import_obsidian5.Setting(footerSection).setName("\u4E0A\u4E0B\u5185\u8FB9\u8DDD").setDesc("\u8BBE\u7F6E\u9875\u811A\u533A\u57DF\u7684\u4E0A\u4E0B\u5185\u8FB9\u8DDD\uFF08\u5355\u4F4D\uFF1Apx\uFF09").addText((text) => {
let match = styles.container.match(/padding:\s*(\d+)px\s*(\d+)px/);
let paddingTop = "16", paddingLR = "16";
if (match) {
paddingTop = match[1];
paddingLR = match[2];
} else {
let single = styles.container.match(/padding:\s*(\d+)px/);
if (single) {
paddingTop = single[1];
paddingLR = single[1];
}
}
text.setValue(paddingTop).onChange((value) => {
const v = parseInt(value) || 16;
if (styles.container.match(/padding:\s*\d+px\s*\d+px/)) {
styles.container = styles.container.replace(/padding:\s*\d+px\s*\d+px/, `padding: ${v}px ${paddingLR}px`);
} else if (styles.container.match(/padding:\s*\d+px/)) {
styles.container = styles.container.replace(/padding:\s*\d+px/, `padding: ${v}px ${paddingLR}px`);
} else {
styles.container += ` padding: ${v}px ${paddingLR}px;`;
}
});
});
}
addParagraphAndEmphasisSettings(container, styles) {
const paragraphSection = container.createDiv("style-section");
const paragraphHeader = paragraphSection.createDiv("style-section-header");
const paragraphTitleContainer = paragraphHeader.createDiv("style-section-title");
const paragraphToggle = paragraphTitleContainer.createSpan("style-section-toggle");
(0, import_obsidian5.setIcon)(paragraphToggle, "chevron-right");
paragraphTitleContainer.createEl("h4", { text: "\u6BB5\u843D\u6837\u5F0F" });
const paragraphContent = paragraphSection.createDiv("style-section-content");
paragraphContent.style.display = "none";
paragraphHeader.addEventListener("click", () => {
const isExpanded = paragraphContent.style.display === "none";
paragraphContent.style.display = isExpanded ? "block" : "none";
(0, import_obsidian5.setIcon)(paragraphToggle, isExpanded ? "chevron-down" : "chevron-right");
});
new import_obsidian5.Setting(paragraphContent).setName("\u4E0B\u8FB9\u8DDD").setDesc("\u8BBE\u7F6E\u6BB5\u843D\u4E0E\u4E0B\u65B9\u5185\u5BB9\u4E4B\u95F4\u7684\u95F4\u8DDD\uFF08\u5355\u4F4D\uFF1Aem\uFF09").addText((text) => {
var _a;
const currentMargin = (_a = styles.paragraph.match(/margin-bottom:\s*([\d.]+)em/)) == null ? void 0 : _a[1];
text.setValue(currentMargin).onChange((value) => {
const margin = parseFloat(value) || 1.1;
styles.paragraph = styles.paragraph.replace(/margin-bottom:\s*[\d.]+em/, `margin-bottom: ${margin}em`);
});
});
new import_obsidian5.Setting(paragraphContent).setName("\u5B57\u4F53\u5927\u5C0F").setDesc("\u8BBE\u7F6E\u6BB5\u843D\u6587\u672C\u7684\u5B57\u4F53\u5927\u5C0F\uFF08\u5355\u4F4D\uFF1A\u50CF\u7D20\uFF09").addText((text) => {
var _a;
const currentSize = (_a = styles.paragraph.match(/font-size:\s*(\d+)px/)) == null ? void 0 : _a[1];
text.setValue(currentSize).onChange((value) => {
const size = parseInt(value) || 15;
styles.paragraph = styles.paragraph.replace(/font-size:\s*\d+px/, `font-size: ${size}px`);
});
});
new import_obsidian5.Setting(paragraphContent).setName("\u6587\u672C\u989C\u8272").setDesc("\u8BBE\u7F6E\u6BB5\u843D\u6587\u672C\u7684\u989C\u8272").addColorPicker((color) => {
var _a;
const currentColor = (_a = styles.paragraph.match(/color:\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _a[1];
color.setValue(currentColor).onChange((value) => {
styles.paragraph = styles.paragraph.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
});
});
const emphasisSection = container.createDiv("style-section");
const emphasisHeader = emphasisSection.createDiv("style-section-header");
const emphasisTitleContainer = emphasisHeader.createDiv("style-section-title");
const emphasisToggle = emphasisTitleContainer.createSpan("style-section-toggle");
(0, import_obsidian5.setIcon)(emphasisToggle, "chevron-right");
emphasisTitleContainer.createEl("h4", { text: "\u5F3A\u8C03\u6837\u5F0F" });
const emphasisContent = emphasisSection.createDiv("style-section-content");
emphasisContent.style.display = "none";
emphasisHeader.addEventListener("click", () => {
const isExpanded = emphasisContent.style.display === "none";
emphasisContent.style.display = isExpanded ? "block" : "none";
(0, import_obsidian5.setIcon)(emphasisToggle, isExpanded ? "chevron-down" : "chevron-right");
});
new import_obsidian5.Setting(emphasisContent).setName("\u7C97\u4F53\u6837\u5F0F").setDesc("\u8BBE\u7F6E\u7C97\u4F53\u6587\u672C\u7684\u6837\u5F0F").addColorPicker((color) => {
var _a;
const currentColor = (_a = styles.emphasis.strong.match(/color:\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _a[1];
color.setValue(currentColor).onChange((value) => {
styles.emphasis.strong = styles.emphasis.strong.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
});
});
new import_obsidian5.Setting(emphasisContent).setName("\u659C\u4F53\u6837\u5F0F").setDesc("\u8BBE\u7F6E\u659C\u4F53\u6587\u672C\u7684\u6837\u5F0F").addColorPicker((color) => {
var _a;
const currentColor = (_a = styles.emphasis.em.match(/color:\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _a[1];
color.setValue(currentColor).onChange((value) => {
styles.emphasis.em = styles.emphasis.em.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
});
});
new import_obsidian5.Setting(emphasisContent).setName("\u5220\u9664\u7EBF\u6837\u5F0F").setDesc("\u8BBE\u7F6E\u5220\u9664\u7EBF\u6587\u672C\u7684\u6837\u5F0F").addColorPicker((color) => {
var _a;
const currentColor = (_a = styles.emphasis.del.match(/color:\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _a[1];
color.setValue(currentColor).onChange((value) => {
styles.emphasis.del = styles.emphasis.del.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
});
});
}
addListSettings(container, styles) {
const listSection = container.createDiv("list-section");
new import_obsidian5.Setting(listSection).setName("\u5217\u8868\u7F29\u8FDB").setDesc("\u8BBE\u7F6E\u5217\u8868\u7684\u5DE6\u4FA7\u7F29\u8FDB\uFF08\u5355\u4F4D\uFF1A\u50CF\u7D20\uFF09").addText((text) => {
var _a;
const currentPadding = (_a = styles.container.match(/padding-left:\s*(\d+)px/)) == null ? void 0 : _a[1];
text.setValue(currentPadding).onChange((value) => {
const padding = parseInt(value) || 26;
styles.container = styles.container.replace(/padding-left:\s*\d+px/, `padding-left: ${padding}px`);
});
});
new import_obsidian5.Setting(listSection).setName("\u5217\u8868\u9879\u95F4\u8DDD").setDesc("\u8BBE\u7F6E\u5217\u8868\u9879\u4E4B\u95F4\u7684\u95F4\u8DDD\uFF08\u5355\u4F4D\uFF1Aem\uFF09").addText((text) => {
var _a;
const currentMargin = (_a = styles.item.match(/margin-bottom:\s*([\d.]+)em/)) == null ? void 0 : _a[1];
text.setValue(currentMargin).onChange((value) => {
const margin = parseFloat(value) || 0.8;
styles.item = styles.item.replace(/margin-bottom:\s*[\d.]+em/, `margin-bottom: ${margin}em`);
});
});
new import_obsidian5.Setting(listSection).setName("\u5217\u8868\u6587\u672C\u989C\u8272").setDesc("\u8BBE\u7F6E\u5217\u8868\u6587\u672C\u7684\u989C\u8272").addColorPicker((color) => {
var _a;
const currentColor = (_a = styles.item.match(/color:\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _a[1];
color.setValue(currentColor).onChange((value) => {
["container", "item", "taskList"].forEach((key) => {
styles[key] = styles[key].replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
});
});
});
}
addQuoteSettings(container, styles) {
const quoteSection = container.createDiv("quote-section");
new import_obsidian5.Setting(quoteSection).setName("\u5F15\u7528\u8FB9\u6846\u989C\u8272").setDesc("\u8BBE\u7F6E\u5F15\u7528\u5757\u5DE6\u4FA7\u8FB9\u6846\u7684\u989C\u8272").addColorPicker((color) => {
var _a;
const currentColor = (_a = styles.quote.match(/border-left:\s*\d+px\s*solid\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _a[1];
color.setValue(currentColor).onChange((value) => {
styles.quote = styles.quote.replace(/border-left:\s*\d+px\s*solid\s*#[a-fA-F0-9]+/, `border-left: 3px solid ${value}`);
if (styles.quote.includes("linear-gradient")) {
styles.quote = styles.quote.replace(/rgba\([^)]+\)/, `rgba(${parseInt(value.slice(1, 3), 16)},${parseInt(value.slice(3, 5), 16)},${parseInt(value.slice(5, 7), 16)},0.1)`);
}
});
});
new import_obsidian5.Setting(quoteSection).setName("\u5F15\u7528\u6587\u672C\u989C\u8272").setDesc("\u8BBE\u7F6E\u5F15\u7528\u5757\u5185\u6587\u672C\u7684\u989C\u8272").addColorPicker((color) => {
var _a;
const currentColor = (_a = styles.quote.match(/color:\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _a[1];
color.setValue(currentColor).onChange((value) => {
styles.quote = styles.quote.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
});
});
new import_obsidian5.Setting(quoteSection).setName("\u5DE6\u4FA7\u5185\u8FB9\u8DDD").setDesc("\u8BBE\u7F6E\u5F15\u7528\u5757\u5185\u5BB9\u4E0E\u5DE6\u4FA7\u8FB9\u6846\u4E4B\u95F4\u7684\u8DDD\u79BB\uFF08\u5355\u4F4D\uFF1A\u50CF\u7D20\uFF09").addText((text) => {
var _a;
const currentPadding = (_a = styles.quote.match(/padding:\s*0\s*0\s*0\s*(\d+)px/)) == null ? void 0 : _a[1];
text.setValue(currentPadding).onChange((value) => {
const padding = parseInt(value) || 20;
styles.quote = styles.quote.replace(/padding:\s*0\s*0\s*0\s*\d+px/, `padding: 0 0 0 ${padding}px`);
});
});
}
addCodeSettings(container, styles) {
const codeBlockSection = container.createDiv("style-section");
const codeBlockHeader = codeBlockSection.createDiv("style-section-header");
const codeBlockTitleContainer = codeBlockHeader.createDiv("style-section-title");
const codeBlockToggle = codeBlockTitleContainer.createSpan("style-section-toggle");
(0, import_obsidian5.setIcon)(codeBlockToggle, "chevron-right");
codeBlockTitleContainer.createEl("h4", { text: "\u4EE3\u7801\u5757\u6837\u5F0F" });
const codeBlockContent = codeBlockSection.createDiv("style-section-content");
codeBlockContent.style.display = "none";
codeBlockHeader.addEventListener("click", () => {
const isExpanded = codeBlockContent.style.display === "none";
codeBlockContent.style.display = isExpanded ? "block" : "none";
(0, import_obsidian5.setIcon)(codeBlockToggle, isExpanded ? "chevron-down" : "chevron-right");
});
new import_obsidian5.Setting(codeBlockContent).setName("\u6587\u672C\u989C\u8272").setDesc("\u8BBE\u7F6E\u4EE3\u7801\u5757\u5185\u6587\u672C\u7684\u989C\u8272").addColorPicker((color) => {
var _a;
const currentColor = (_a = styles.block.match(/color:\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _a[1];
color.setValue(currentColor).onChange((value) => {
styles.block = styles.block.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
});
});
new import_obsidian5.Setting(codeBlockContent).setName("\u5706\u89D2\u5927\u5C0F").setDesc("\u8BBE\u7F6E\u4EE3\u7801\u5757\u7684\u5706\u89D2\u5927\u5C0F\uFF08\u5355\u4F4D\uFF1A\u50CF\u7D20\uFF09").addText((text) => {
var _a;
const currentRadius = (_a = styles.block.match(/border-radius:\s*(\d+)px/)) == null ? void 0 : _a[1];
text.setValue(currentRadius).onChange((value) => {
const radius = parseInt(value) || 8;
styles.block = styles.block.replace(/border-radius:\s*\d+px/, `border-radius: ${radius}px`);
});
});
const inlineCodeSection = container.createDiv("style-section");
const inlineCodeHeader = inlineCodeSection.createDiv("style-section-header");
const inlineCodeTitleContainer = inlineCodeHeader.createDiv("style-section-title");
const inlineCodeToggle = inlineCodeTitleContainer.createSpan("style-section-toggle");
(0, import_obsidian5.setIcon)(inlineCodeToggle, "chevron-right");
inlineCodeTitleContainer.createEl("h4", { text: "\u884C\u5185\u4EE3\u7801\u6837\u5F0F" });
const inlineCodeContent = inlineCodeSection.createDiv("style-section-content");
inlineCodeContent.style.display = "none";
inlineCodeHeader.addEventListener("click", () => {
const isExpanded = inlineCodeContent.style.display === "none";
inlineCodeContent.style.display = isExpanded ? "block" : "none";
(0, import_obsidian5.setIcon)(inlineCodeToggle, isExpanded ? "chevron-down" : "chevron-right");
});
new import_obsidian5.Setting(inlineCodeContent).setName("\u80CC\u666F\u989C\u8272").setDesc("\u8BBE\u7F6E\u884C\u5185\u4EE3\u7801\u7684\u80CC\u666F\u989C\u8272").addColorPicker((color) => {
var _a;
const currentBg = (_a = styles.inline.match(/background:\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _a[1];
color.setValue(currentBg).onChange((value) => {
styles.inline = styles.inline.replace(/background:\s*#[a-fA-F0-9]+/, `background: ${value}`);
});
});
new import_obsidian5.Setting(inlineCodeContent).setName("\u6587\u672C\u989C\u8272").setDesc("\u8BBE\u7F6E\u884C\u5185\u4EE3\u7801\u7684\u6587\u672C\u989C\u8272").addColorPicker((color) => {
var _a;
const currentColor = (_a = styles.inline.match(/color:\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _a[1];
color.setValue(currentColor).onChange((value) => {
styles.inline = styles.inline.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
});
});
}
addLinkSettings(container, styles) {
const linkSection = container.createDiv("link-section");
new import_obsidian5.Setting(linkSection).setName("\u94FE\u63A5\u989C\u8272").setDesc("\u8BBE\u7F6E\u94FE\u63A5\u6587\u672C\u7684\u989C\u8272").addColorPicker((color) => {
var _a;
const currentColor = (_a = styles.link.match(/color:\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _a[1];
color.setValue(currentColor).onChange((value) => {
styles.link = styles.link.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
if (styles.link.includes("linear-gradient")) {
styles.link = styles.link.replace(/linear-gradient\([^)]+\)/, `linear-gradient(to right, ${value}80, ${value}80)`);
}
});
});
new import_obsidian5.Setting(linkSection).setName("\u4E0B\u5212\u7EBF\u6837\u5F0F").setDesc("\u9009\u62E9\u94FE\u63A5\u7684\u4E0B\u5212\u7EBF\u6837\u5F0F").addDropdown((dropdown) => {
dropdown.addOption("none", "\u65E0\u4E0B\u5212\u7EBF").addOption("underline", "\u5B9E\u7EBF\u4E0B\u5212\u7EBF").addOption("gradient", "\u6E10\u53D8\u4E0B\u5212\u7EBF").setValue(styles.link.includes("text-decoration: none") && !styles.link.includes("background-image") ? "none" : styles.link.includes("text-decoration: underline") ? "underline" : "gradient").onChange((value) => {
var _a;
switch (value) {
case "none":
styles.link = styles.link.replace(/text-decoration:[^;]+;/, "text-decoration: none;").replace(/background-image:[^;]+;/, "").replace(/background-size:[^;]+;/, "").replace(/background-repeat:[^;]+;/, "").replace(/background-position:[^;]+;/, "");
break;
case "underline":
styles.link = styles.link.replace(/text-decoration:[^;]+;/, "text-decoration: underline;").replace(/background-image:[^;]+;/, "").replace(/background-size:[^;]+;/, "").replace(/background-repeat:[^;]+;/, "").replace(/background-position:[^;]+;/, "");
break;
case "gradient":
const color = ((_a = styles.link.match(/color:\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _a[1]) || "#d2691e";
styles.link = styles.link.replace(/text-decoration:[^;]+;/, "text-decoration: none;") + ` background-image: linear-gradient(to right, ${color}80, ${color}80); background-size: 0% 1px; background-repeat: no-repeat; background-position: 0 100%; transition: all 0.3s ease;`;
break;
}
});
});
}
addTableSettings(container, styles) {
const tableSection = container.createDiv("table-section");
new import_obsidian5.Setting(tableSection).setName("\u8868\u683C\u8FB9\u6846\u989C\u8272").setDesc("\u8BBE\u7F6E\u8868\u683C\u8FB9\u6846\u548C\u5206\u9694\u7EBF\u7684\u989C\u8272").addColorPicker((color) => {
var _a;
const currentBorder = (_a = styles.container.match(/border:\s*1px\s*solid\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _a[1];
color.setValue(currentBorder).onChange((value) => {
styles.container = styles.container.replace(/border:\s*1px\s*solid\s*#[a-fA-F0-9]+/, `border: 1px solid ${value}`);
styles.header = styles.header.replace(/border-bottom:\s*\d+px\s*solid\s*#[a-fA-F0-9]+/, `border-bottom: 2px solid ${value}`);
styles.cell = styles.cell.replace(/border-top:\s*1px\s*solid\s*#[a-fA-F0-9]+/, `border-top: 1px solid ${value}`);
});
});
new import_obsidian5.Setting(tableSection).setName("\u8868\u5934\u80CC\u666F").setDesc("\u8BBE\u7F6E\u8868\u683C\u5934\u90E8\u7684\u80CC\u666F\u989C\u8272").addColorPicker((color) => {
var _a, _b;
const currentBg = (_a = styles.header.match(/background:\s*([^;]+)/)) == null ? void 0 : _a[1];
const firstColor = currentBg.includes("linear-gradient") ? (_b = currentBg.match(/linear-gradient\([^,]+,\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _b[1] : currentBg;
color.setValue(firstColor).onChange((value) => {
if (currentBg.includes("linear-gradient")) {
styles.header = styles.header.replace(/background:\s*linear-gradient\([^)]+\)/, `background: linear-gradient(135deg, ${value}, #fffaf5)`);
} else {
styles.header = styles.header.replace(/background:\s*[^;]+/, `background: ${value}`);
}
});
});
new import_obsidian5.Setting(tableSection).setName("\u5706\u89D2\u5927\u5C0F").setDesc("\u8BBE\u7F6E\u8868\u683C\u7684\u5706\u89D2\u5927\u5C0F\uFF08\u5355\u4F4D\uFF1A\u50CF\u7D20\uFF09").addText((text) => {
var _a;
const currentRadius = (_a = styles.container.match(/border-radius:\s*(\d+)px/)) == null ? void 0 : _a[1];
text.setValue(currentRadius).onChange((value) => {
const radius = parseInt(value) || 12;
styles.container = styles.container.replace(/border-radius:\s*\d+px/, `border-radius: ${radius}px`);
});
});
}
addHrSettings(container, styles) {
const hrSection = container.createDiv("hr-section");
new import_obsidian5.Setting(hrSection).setName("\u5206\u9694\u7EBF\u989C\u8272").setDesc("\u8BBE\u7F6E\u6C34\u5E73\u5206\u9694\u7EBF\u7684\u989C\u8272").addColorPicker((color) => {
var _a;
const currentColor = (_a = styles.hr.match(/border-top:\s*\d+px\s*solid\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _a[1];
color.setValue(currentColor).onChange((value) => {
styles.hr = styles.hr.replace(/border-top:\s*\d+px\s*solid\s*#[a-fA-F0-9]+/, `border-top: 2px solid ${value}`);
});
});
new import_obsidian5.Setting(hrSection).setName("\u5206\u9694\u7EBF\u7C97\u7EC6").setDesc("\u8BBE\u7F6E\u6C34\u5E73\u5206\u9694\u7EBF\u7684\u7C97\u7EC6\uFF08\u5355\u4F4D\uFF1A\u50CF\u7D20\uFF09").addText((text) => {
var _a;
const currentWidth = (_a = styles.hr.match(/border-top:\s*(\d+)px/)) == null ? void 0 : _a[1];
text.setValue(currentWidth).onChange((value) => {
const width = parseInt(value) || 2;
styles.hr = styles.hr.replace(/border-top:\s*\d+px/, `border-top: ${width}px`);
});
});
new import_obsidian5.Setting(hrSection).setName("\u4E0A\u4E0B\u8FB9\u8DDD").setDesc("\u8BBE\u7F6E\u5206\u9694\u7EBF\u4E0E\u4E0A\u4E0B\u5185\u5BB9\u7684\u95F4\u8DDD\uFF08\u5355\u4F4D\uFF1A\u50CF\u7D20\uFF09").addText((text) => {
var _a;
const currentMargin = (_a = styles.hr.match(/margin:\s*(\d+)px/)) == null ? void 0 : _a[1];
text.setValue(currentMargin).onChange((value) => {
const margin = parseInt(value) || 28;
styles.hr = styles.hr.replace(/margin:\s*\d+px/, `margin: ${margin}px`);
});
});
}
addFootnoteSettings(container, styles) {
const footnoteSection = container.createDiv("footnote-section");
new import_obsidian5.Setting(footnoteSection).setName("\u811A\u6CE8\u989C\u8272").setDesc("\u8BBE\u7F6E\u811A\u6CE8\u5F15\u7528\u548C\u8FD4\u56DE\u94FE\u63A5\u7684\u989C\u8272").addColorPicker((color) => {
var _a;
const currentColor = (_a = styles.ref.match(/color:\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _a[1];
color.setValue(currentColor).onChange((value) => {
styles.ref = styles.ref.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
styles.backref = styles.backref.replace(/color:\s*#[a-fA-F0-9]+/, `color: ${value}`);
});
});
new import_obsidian5.Setting(footnoteSection).setName("\u5B57\u4F53\u6837\u5F0F").setDesc("\u9009\u62E9\u811A\u6CE8\u7684\u5B57\u4F53\u6837\u5F0F").addDropdown((dropdown) => {
dropdown.addOption("normal", "\u5E38\u89C4").addOption("italic", "\u659C\u4F53").setValue(styles.ref.includes("font-style: italic") ? "italic" : "normal").onChange((value) => {
const style = value === "italic" ? "italic" : "normal";
styles.ref = styles.ref.replace(/font-style:[^;]*;/, `font-style: ${style};`);
styles.backref = styles.backref.replace(/font-style:[^;]*;/, `font-style: ${style};`);
});
});
}
addImageSettings(container, styles) {
const imageSection = container.createDiv("image-section");
new import_obsidian5.Setting(imageSection).setName("\u6700\u5927\u5BBD\u5EA6").setDesc("\u8BBE\u7F6E\u56FE\u7247\u7684\u6700\u5927\u663E\u793A\u5BBD\u5EA6\uFF08\u652F\u6301\u767E\u5206\u6BD4\u6216\u50CF\u7D20\u503C\uFF0C\u4F8B\u5982\uFF1A100% \u6216 800px\uFF09").addText((text) => {
var _a;
const currentWidth = (_a = styles.image.match(/max-width:\s*([^;]+)/)) == null ? void 0 : _a[1];
text.setValue(currentWidth).onChange((value) => {
const isValid = /^\d+(%|px)$/.test(value.trim());
const width = isValid ? value.trim() : "100%";
styles.image = styles.image.replace(/max-width:\s*[^;]+/, `max-width: ${width}`);
});
});
new import_obsidian5.Setting(imageSection).setName("\u8FB9\u8DDD").setDesc("\u8BBE\u7F6E\u56FE\u7247\u4E0E\u4E0A\u4E0B\u6587\u672C\u7684\u95F4\u8DDD\uFF08\u5355\u4F4D\uFF1Aem\uFF09").addText((text) => {
var _a;
const currentMargin = (_a = styles.image.match(/margin:\s*([\d.]+)em/)) == null ? void 0 : _a[1];
text.setValue(currentMargin).onChange((value) => {
const margin = parseFloat(value) || 1.5;
styles.image = styles.image.replace(/margin:\s*[\d.]+em/, `margin: ${margin}em`);
});
});
new import_obsidian5.Setting(imageSection).setName("\u5706\u89D2\u5927\u5C0F").setDesc("\u8BBE\u7F6E\u56FE\u7247\u7684\u5706\u89D2\u7A0B\u5EA6\uFF08\u5355\u4F4D\uFF1A\u50CF\u7D20\uFF09").addText((text) => {
var _a;
const currentRadius = (_a = styles.image.match(/border-radius:\s*(\d+)px/)) == null ? void 0 : _a[1];
text.setValue(currentRadius).onChange((value) => {
const radius = parseInt(value) || 8;
styles.image = styles.image.replace(/border-radius:\s*\d+px/, `border-radius: ${radius}px`);
});
});
new import_obsidian5.Setting(imageSection).setName("\u8FB9\u6846\u989C\u8272").setDesc("\u8BBE\u7F6E\u56FE\u7247\u8FB9\u6846\u7684\u989C\u8272").addColorPicker((color) => {
var _a;
const currentColor = (_a = styles.image.match(/border:\s*1px solid\s*(#[a-fA-F0-9]+)/)) == null ? void 0 : _a[1];
color.setValue(currentColor).onChange((value) => {
styles.image = styles.image.replace(/border:\s*1px solid\s*#[a-fA-F0-9]+80/, `border: 1px solid ${value}80`);
});
});
}
};
// src/settings/CreateFontModal.ts
var import_obsidian6 = require("obsidian");
var CreateFontModal = class extends import_obsidian6.Modal {
constructor(app, onSubmit, existingFont) {
super(app);
this.onSubmit = onSubmit;
this.font = existingFont != null ? existingFont : { value: "", label: "" };
}
onOpen() {
const { contentEl } = this;
contentEl.empty();
contentEl.addClass("red-font-modal");
const headerContainer = contentEl.createDiv({ cls: "rfd-header" });
headerContainer.createEl("h3", { text: this.font.label ? "\u7F16\u8F91\u5B57\u4F53" : "\u6DFB\u52A0\u5B57\u4F53" });
const helpBtnContainer = headerContainer.createDiv({ cls: "rfd-help-trigger" });
const helpBtn = helpBtnContainer.createEl("button", { cls: "rfd-help-btn" });
(0, import_obsidian6.setIcon)(helpBtn, "help-circle");
const helpTooltip = helpBtnContainer.createDiv({ cls: "rfd-help-tooltip" });
helpTooltip.setText(`\u{1F44B} \u5B57\u4F53\u503C\u8BBE\u7F6E\u8BF4\u660E
\u2022 \u5355\u4E2A\u5B57\u4F53\uFF1AArial \u6216 "Microsoft YaHei"
\u2022 \u4E2D\u6587\u5B57\u4F53\uFF1A\u9700\u8981\u540C\u65F6\u8BBE\u7F6E\u4E2D\u82F1\u6587\u540D\u79F0
\u2022 \u5B57\u4F53\u65CF\uFF1A\u6DFB\u52A0 serif/sans-serif
\u2022 \u591A\u4E2A\u5B57\u4F53\u7528\u9017\u53F7\u5206\u9694
\u793A\u4F8B
\u2022 \u5B8B\u4F53\uFF1ASimSun, "\u5B8B\u4F53", serif
\u2022 \u5FAE\u8F6F\u96C5\u9ED1\uFF1A"Microsoft YaHei", "\u5FAE\u8F6F\u96C5\u9ED1", sans-serif`);
new import_obsidian6.Setting(contentEl).setName("\u5B57\u4F53\u540D\u79F0").setDesc("\u663E\u793A\u5728\u4E0B\u62C9\u83DC\u5355\u4E2D\u7684\u540D\u79F0").addText((text) => text.setValue(this.font.label).onChange((value) => this.font.label = value));
new import_obsidian6.Setting(contentEl).setName("\u5B57\u4F53\u503C").setDesc("CSS font-family \u7684\u503C").addText((text) => text.setValue(this.font.value).onChange((value) => this.font.value = value));
new import_obsidian6.Setting(contentEl).addButton((btn) => btn.setButtonText("\u786E\u5B9A").setCta().onClick(() => {
if (!this.font.label || !this.font.value) {
return;
}
this.onSubmit(this.font);
this.close();
})).addButton((btn) => btn.setButtonText("\u53D6\u6D88").onClick(() => this.close()));
}
onClose() {
const { contentEl } = this;
contentEl.empty();
}
};
// src/settings/ConfirmModal.ts
var import_obsidian7 = require("obsidian");
var ConfirmModal = class extends import_obsidian7.Modal {
constructor(app, title, message, onConfirm) {
super(app);
this.title = title;
this.message = message;
this.onConfirm = onConfirm;
this.confirmed = false;
}
onOpen() {
const { contentEl, titleEl } = this;
titleEl.setText(this.title);
contentEl.createEl("p", { text: this.message });
const buttonContainer = contentEl.createDiv({ cls: "modal-button-container" });
buttonContainer.createEl("button", { text: "\u53D6\u6D88" }).addEventListener("click", () => this.close());
const confirmButton = buttonContainer.createEl("button", {
cls: "mod-cta",
text: "\u786E\u8BA4"
});
confirmButton.addEventListener("click", () => {
this.confirmed = true;
this.close();
});
}
onClose() {
const { contentEl } = this;
contentEl.empty();
if (this.confirmed) {
this.onConfirm();
}
}
};
// src/settings/SettingTab.ts
var RedSettingTab = class extends import_obsidian8.PluginSettingTab {
constructor(app, plugin) {
super(app, plugin);
// 修改插件类型以匹配类名
this.expandedSections = /* @__PURE__ */ new Set();
this.plugin = plugin;
}
createSection(containerEl, title, renderContent) {
const section = containerEl.createDiv("settings-section");
const header = section.createDiv("settings-section-header");
const toggle = header.createSpan("settings-section-toggle");
(0, import_obsidian8.setIcon)(toggle, "chevron-right");
header.createEl("h4", { text: title });
const content = section.createDiv("settings-section-content");
renderContent(content);
header.addEventListener("click", () => {
const isExpanded = !section.hasClass("is-expanded");
section.toggleClass("is-expanded", isExpanded);
(0, import_obsidian8.setIcon)(toggle, isExpanded ? "chevron-down" : "chevron-right");
if (isExpanded) {
this.expandedSections.add(title);
} else {
this.expandedSections.delete(title);
}
});
if (this.expandedSections.has(title) || !containerEl.querySelector(".settings-section")) {
section.addClass("is-expanded");
(0, import_obsidian8.setIcon)(toggle, "chevron-down");
this.expandedSections.add(title);
}
return section;
}
display() {
const { containerEl } = this;
containerEl.empty();
containerEl.addClass("red-settings");
containerEl.createEl("h2", { text: "Note to RED \u8BBE\u7F6E" });
this.createSection(containerEl, "\u57FA\u672C\u8BBE\u7F6E", (el) => this.renderBasicSettings(el));
this.createSection(containerEl, "\u4E3B\u9898\u8BBE\u7F6E", (el) => this.renderThemeSettings(el));
}
renderBasicSettings(containerEl) {
const typographySection = containerEl.createDiv("red-settings-subsection");
const typographyHeader = typographySection.createDiv("red-settings-subsection-header");
const typographyToggle = typographyHeader.createSpan("red-settings-subsection-toggle");
(0, import_obsidian8.setIcon)(typographyToggle, "chevron-right");
typographyHeader.createEl("h3", { text: "\u6392\u7248\u7BA1\u7406" });
const typographyContent = typographySection.createDiv("red-settings-subsection-content");
typographyHeader.addEventListener("click", () => {
const isExpanded = !typographySection.hasClass("is-expanded");
typographySection.toggleClass("is-expanded", isExpanded);
(0, import_obsidian8.setIcon)(typographyToggle, isExpanded ? "chevron-down" : "chevron-right");
});
new import_obsidian8.Setting(typographyContent).setName("\u5185\u5BB9\u5206\u5272\u6807\u9898\u7EA7\u522B").setDesc("\u9009\u62E9\u7528\u4E8E\u5206\u5272\u5185\u5BB9\u751F\u6210\u56FE\u7247\u7684\u6807\u9898\u7EA7\u522B\uFF1A").addDropdown(
(dropdown) => dropdown.addOption("h1", "\u4E00\u7EA7\u6807\u9898(#) - \u6309\u5927\u7AE0\u8282\u5206\u5272").addOption("h2", "\u4E8C\u7EA7\u6807\u9898(##) - \u6309\u5C0F\u7AE0\u8282\u5206\u5272").setValue(this.plugin.settingsManager.getSettings().headingLevel).onChange(async (value) => {
await this.plugin.settingsManager.updateSettings({
headingLevel: value
});
new import_obsidian8.Notice("\u6807\u9898\u7EA7\u522B\u8BBE\u7F6E\u5DF2\u66F4\u65B0\uFF0C\u8BF7\u91CD\u542F Obsidian \u6216\u91CD\u65B0\u52A0\u8F7D\u4EE5\u4F7F\u66F4\u6539\u751F\u6548");
})
);
const fontSection = containerEl.createDiv("red-settings-subsection");
const fontHeader = fontSection.createDiv("red-settings-subsection-header");
const fontToggle = fontHeader.createSpan("red-settings-subsection-toggle");
(0, import_obsidian8.setIcon)(fontToggle, "chevron-right");
fontHeader.createEl("h3", { text: "\u5B57\u4F53\u7BA1\u7406" });
const fontContent = fontSection.createDiv("red-settings-subsection-content");
fontHeader.addEventListener("click", () => {
const isExpanded = !fontSection.hasClass("is-expanded");
fontSection.toggleClass("is-expanded", isExpanded);
(0, import_obsidian8.setIcon)(fontToggle, isExpanded ? "chevron-down" : "chevron-right");
});
const fontList = fontContent.createDiv("font-management");
this.plugin.settingsManager.getFontOptions().forEach((font) => {
const fontItem = fontList.createDiv("font-item");
const setting = new import_obsidian8.Setting(fontItem).setName(font.label).setDesc(font.value);
if (!font.isPreset) {
setting.addExtraButton((btn) => btn.setIcon("pencil").setTooltip("\u7F16\u8F91").onClick(() => {
new CreateFontModal(
this.app,
async (updatedFont) => {
await this.plugin.settingsManager.updateFont(font.value, updatedFont);
this.display();
new import_obsidian8.Notice("\u8BF7\u91CD\u542F Obsidian \u6216\u91CD\u65B0\u52A0\u8F7D\u4EE5\u4F7F\u66F4\u6539\u751F\u6548");
},
font
).open();
})).addExtraButton((btn) => btn.setIcon("trash").setTooltip("\u5220\u9664").onClick(() => {
new ConfirmModal(
this.app,
"\u786E\u8BA4\u5220\u9664\u5B57\u4F53",
`\u786E\u5B9A\u8981\u5220\u9664\u300C${font.label}\u300D\u5B57\u4F53\u914D\u7F6E\u5417\uFF1F`,
async () => {
await this.plugin.settingsManager.removeFont(font.value);
this.display();
new import_obsidian8.Notice("\u8BF7\u91CD\u542F Obsidian \u6216\u91CD\u65B0\u52A0\u8F7D\u4EE5\u4F7F\u66F4\u6539\u751F\u6548");
}
).open();
}));
}
});
new import_obsidian8.Setting(fontContent).addButton((btn) => btn.setButtonText("+ \u6DFB\u52A0\u5B57\u4F53").setCta().onClick(() => {
new CreateFontModal(
this.app,
async (newFont) => {
await this.plugin.settingsManager.addCustomFont(newFont);
this.display();
new import_obsidian8.Notice("\u8BF7\u91CD\u542F Obsidian \u6216\u91CD\u65B0\u52A0\u8F7D\u4EE5\u4F7F\u66F4\u6539\u751F\u6548");
}
).open();
}));
}
renderThemeSettings(containerEl) {
const themeVisibilitySection = containerEl.createDiv("red-settings-subsection");
const themeVisibilityHeader = themeVisibilitySection.createDiv("red-settings-subsection-header");
const themeVisibilityToggle = themeVisibilityHeader.createSpan("red-settings-subsection-toggle");
(0, import_obsidian8.setIcon)(themeVisibilityToggle, "chevron-right");
themeVisibilityHeader.createEl("h3", { text: "\u663E\u793A\u8BBE\u7F6E" });
const themeVisibilityContent = themeVisibilitySection.createDiv("red-settings-subsection-content");
themeVisibilityHeader.addEventListener("click", () => {
const isExpanded = !themeVisibilitySection.hasClass("is-expanded");
themeVisibilitySection.toggleClass("is-expanded", isExpanded);
(0, import_obsidian8.setIcon)(themeVisibilityToggle, isExpanded ? "chevron-down" : "chevron-right");
});
new import_obsidian8.Setting(themeVisibilityContent).setName("\u662F\u5426\u663E\u793A\u65F6\u95F4").setDesc("\u63A7\u5236\u662F\u5426\u5728\u4E3B\u9898\u4E2D\u663E\u793A\u9875\u7709\u65F6\u95F4").addToggle(
(toggle) => toggle.setValue(this.plugin.settingsManager.getSettings().showTime !== false).onChange(async (value) => {
await this.plugin.settingsManager.updateSettings({
showTime: value
});
new import_obsidian8.Notice("\u8BF7\u91CD\u542F Obsidian \u6216\u91CD\u65B0\u52A0\u8F7D\u4EE5\u4F7F\u66F4\u6539\u751F\u6548");
})
);
new import_obsidian8.Setting(themeVisibilityContent).setName("\u662F\u5426\u663E\u793A\u9875\u811A").setDesc("\u63A7\u5236\u662F\u5426\u5728\u4E3B\u9898\u4E2D\u663E\u793A\u9875\u811A\u90E8\u5206").addToggle(
(toggle) => toggle.setValue(this.plugin.settingsManager.getSettings().showFooter !== false).onChange(async (value) => {
await this.plugin.settingsManager.updateSettings({
showFooter: value
});
new import_obsidian8.Notice("\u8BF7\u91CD\u542F Obsidian \u6216\u91CD\u65B0\u52A0\u8F7D\u4EE5\u4F7F\u66F4\u6539\u751F\u6548");
})
);
themeVisibilityContent.createEl("hr", { cls: "red-settings-divider" });
const themeSelectionContainer = themeVisibilityContent.createDiv("theme-selection-container");
const allThemesContainer = themeSelectionContainer.createDiv("all-themes-container");
allThemesContainer.createEl("h4", { text: "\u9690\u85CF\u4E3B\u9898" });
const allThemesList = allThemesContainer.createDiv("themes-list");
const controlButtonsContainer = themeSelectionContainer.createDiv("control-buttons-container");
const addButton = controlButtonsContainer.createEl("button", { text: ">" });
const removeButton = controlButtonsContainer.createEl("button", { text: "<" });
const visibleThemesContainer = themeSelectionContainer.createDiv("visible-themes-container");
visibleThemesContainer.createEl("h4", { text: "\u663E\u793A\u4E3B\u9898" });
const visibleThemesList = visibleThemesContainer.createDiv("themes-list");
const allThemes = this.plugin.settingsManager.getAllThemes();
const renderThemeLists = () => {
allThemesList.empty();
visibleThemesList.empty();
allThemes.filter((theme) => theme.isVisible === false).forEach((theme) => {
const themeItem = allThemesList.createDiv("theme-list-item");
themeItem.textContent = theme.name;
themeItem.dataset.themeId = theme.id;
themeItem.addEventListener("click", () => {
themeItem.toggleClass("selected", !themeItem.hasClass("selected"));
});
});
allThemes.filter((theme) => theme.isVisible !== false).forEach((theme) => {
const themeItem = visibleThemesList.createDiv("theme-list-item");
themeItem.textContent = theme.name;
themeItem.dataset.themeId = theme.id;
themeItem.addEventListener("click", () => {
themeItem.toggleClass("selected", !themeItem.hasClass("selected"));
});
});
};
renderThemeLists();
addButton.addEventListener("click", async () => {
const selectedItems = Array.from(allThemesList.querySelectorAll(".theme-list-item.selected"));
if (selectedItems.length === 0)
return;
for (const item of selectedItems) {
const themeId = item.dataset.themeId;
if (!themeId)
continue;
const theme = allThemes.find((t) => t.id === themeId);
if (theme) {
theme.isVisible = true;
await this.plugin.settingsManager.updateTheme(themeId, theme);
}
}
renderThemeLists();
new import_obsidian8.Notice("\u8BF7\u91CD\u542F Obsidian \u6216\u91CD\u65B0\u52A0\u8F7D\u4EE5\u4F7F\u66F4\u6539\u751F\u6548");
});
removeButton.addEventListener("click", async () => {
const selectedItems = Array.from(visibleThemesList.querySelectorAll(".theme-list-item.selected"));
if (selectedItems.length === 0)
return;
for (const item of selectedItems) {
const themeId = item.dataset.themeId;
if (!themeId)
continue;
const theme = allThemes.find((t) => t.id === themeId);
if (theme) {
theme.isVisible = false;
await this.plugin.settingsManager.updateTheme(themeId, theme);
}
}
renderThemeLists();
new import_obsidian8.Notice("\u8BF7\u91CD\u542F Obsidian \u6216\u91CD\u65B0\u52A0\u8F7D\u4EE5\u4F7F\u66F4\u6539\u751F\u6548");
});
const themeList = containerEl.createDiv("theme-management");
themeList.createEl("h4", { text: "\u81EA\u5B9A\u4E49\u4E3B\u9898", cls: "theme-custom-header" });
this.plugin.settingsManager.getAllThemes().filter((theme) => !theme.isPreset).forEach((theme) => {
const themeItem = themeList.createDiv("theme-item");
new import_obsidian8.Setting(themeItem).setName(theme.name).setDesc(theme.description).addExtraButton((btn) => btn.setIcon("eye").setTooltip("\u9884\u89C8").onClick(() => {
new ThemePreviewModal(this.app, this.plugin.settingsManager, theme, this.plugin.themeManager).open();
})).addExtraButton((btn) => btn.setIcon("pencil").setTooltip("\u7F16\u8F91").onClick(() => {
new CreateThemeModal(
this.app,
this.plugin,
(updatedTheme) => {
this.plugin.settingsManager.updateTheme(theme.id, updatedTheme);
this.display();
new import_obsidian8.Notice("\u8BF7\u91CD\u542F Obsidian \u6216\u91CD\u65B0\u52A0\u8F7D\u4EE5\u4F7F\u66F4\u6539\u751F\u6548");
},
theme
).open();
})).addExtraButton((btn) => btn.setIcon("trash").setTooltip("\u5220\u9664").onClick(() => {
new ConfirmModal(
this.app,
"\u786E\u8BA4\u5220\u9664\u4E3B\u9898",
`\u786E\u5B9A\u8981\u5220\u9664\u300C${theme.name}\u300D\u4E3B\u9898\u5417\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002`,
async () => {
await this.plugin.settingsManager.removeTheme(theme.id);
this.display();
new import_obsidian8.Notice("\u8BF7\u91CD\u542F Obsidian \u6216\u91CD\u65B0\u52A0\u8F7D\u4EE5\u4F7F\u66F4\u6539\u751F\u6548");
}
).open();
}));
});
new import_obsidian8.Setting(containerEl).addButton((btn) => btn.setButtonText("+ \u65B0\u5EFA\u4E3B\u9898").setCta().onClick(() => {
new CreateThemeModal(
this.app,
this.plugin,
async (newTheme) => {
await this.plugin.settingsManager.addCustomTheme(newTheme);
this.display();
new import_obsidian8.Notice("\u8BF7\u91CD\u542F Obsidian \u6216\u91CD\u65B0\u52A0\u8F7D\u4EE5\u4F7F\u66F4\u6539\u751F\u6548");
}
).open();
}));
}
};
// src/main.ts
var RedPlugin = class extends import_obsidian9.Plugin {
async onload() {
this.settingsManager = new SettingsManager(this);
await this.settingsManager.loadSettings();
this.themeManager = new ThemeManager(this.app, this.settingsManager);
RedConverter.initialize(this.app, this);
DonateManager.initialize(this.app, this);
this.registerView(
VIEW_TYPE_RED,
(leaf) => new RedView(leaf, this.themeManager, this.settingsManager)
);
this.addCommand({
id: "open-mp-preview",
name: "\u6253\u5F00\u5C0F\u7EA2\u4E66\u56FE\u7247\u9884\u89C8",
callback: async () => {
await this.activateView();
}
});
this.addRibbonIcon("image", "\u6253\u5F00\u5C0F\u7EA2\u4E66\u56FE\u7247\u9884\u89C8", () => {
this.activateView();
});
this.addSettingTab(new RedSettingTab(this.app, this));
}
async activateView() {
const leaves = this.app.workspace.getLeavesOfType(VIEW_TYPE_RED);
if (leaves.length > 0) {
this.app.workspace.revealLeaf(leaves[0]);
return;
}
const rightLeaf = this.app.workspace.getRightLeaf(false);
if (rightLeaf) {
await rightLeaf.setViewState({
type: VIEW_TYPE_RED,
active: true
});
} else {
new import_obsidian9.Notice("\u65E0\u6CD5\u521B\u5EFA\u89C6\u56FE\u9762\u677F");
}
}
};
/*! Bundled license information:
jszip/dist/jszip.min.js:
(*!
JSZip v3.10.1 - A JavaScript class for generating and reading zip files
<http://stuartk.com/jszip>
(c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown.
JSZip uses the library pako released under the MIT license :
https://github.com/nodeca/pako/blob/main/LICENSE
*)
*/
/* nosourcemap */