cn-font-split
Version:
划时代的字体切割工具,CJK与任何字符!支持 otf、ttf、woff2 字体多线程切割,完美地细颗粒度地进行包大小控制。A revolutionary font subetter that supports CJK and any characters! It enables multi-threaded subset of otf, ttf, and woff2 fonts, allowing for precise control over package size.
1,211 lines (1,210 loc) • 48.9 kB
JavaScript
import * as i from "google-protobuf";
var d;
((g) => {
((h) => {
h[h.UNSPECIFIED = 0] = "UNSPECIFIED", h[h.OUTPUT_DATA = 1] = "OUTPUT_DATA", h[h.END = 2] = "END";
})(g.EventName || (g.EventName = {}));
class o extends i.Message {
#e = [[2], [5], [6], [9], [10], [11], [13], [14], [15], [18], [20], [8], [21], [22], [23], [24], [25]];
constructor(e) {
super(), i.Message.initialize(this, Array.isArray(e) ? e : [], 0, -1, [7], this.#e), !Array.isArray(e) && typeof e == "object" && ("input" in e && e.input != null && (this.input = e.input), "outDir" in e && e.outDir != null && (this.outDir = e.outDir), "css" in e && e.css != null && (this.css = e.css), "targetType" in e && e.targetType != null && (this.targetType = e.targetType), "subsets" in e && e.subsets != null && (this.subsets = e.subsets), "chunkSize" in e && e.chunkSize != null && (this.chunkSize = e.chunkSize), "chunkSizeTolerance" in e && e.chunkSizeTolerance != null && (this.chunkSizeTolerance = e.chunkSizeTolerance), "maxAllowSubsetsCount" in e && e.maxAllowSubsetsCount != null && (this.maxAllowSubsetsCount = e.maxAllowSubsetsCount), "testHtml" in e && e.testHtml != null && (this.testHtml = e.testHtml), "reporter" in e && e.reporter != null && (this.reporter = e.reporter), "previewImage" in e && e.previewImage != null && (this.previewImage = e.previewImage), "renameOutputFont" in e && e.renameOutputFont != null && (this.renameOutputFont = e.renameOutputFont), "buildMode" in e && e.buildMode != null && (this.buildMode = e.buildMode), "languageAreas" in e && e.languageAreas != null && (this.languageAreas = e.languageAreas), "multiThreads" in e && e.multiThreads != null && (this.multiThreads = e.multiThreads), "fontFeature" in e && e.fontFeature != null && (this.fontFeature = e.fontFeature), "reduceMins" in e && e.reduceMins != null && (this.reduceMins = e.reduceMins), "autoSubset" in e && e.autoSubset != null && (this.autoSubset = e.autoSubset), "subsetRemainChars" in e && e.subsetRemainChars != null && (this.subsetRemainChars = e.subsetRemainChars));
}
get input() {
return i.Message.getFieldWithDefault(this, 1, new Uint8Array(0));
}
set input(e) {
i.Message.setField(this, 1, e);
}
get outDir() {
return i.Message.getFieldWithDefault(this, 2, "");
}
set outDir(e) {
i.Message.setOneofField(this, 2, this.#e[0], e);
}
get hasOutDir() {
return i.Message.getField(this, 2) != null;
}
get css() {
return i.Message.getWrapperField(this, o.CssProperties, 5);
}
set css(e) {
i.Message.setOneofWrapperField(this, 5, this.#e[1], e);
}
get hasCss() {
return i.Message.getField(this, 5) != null;
}
get targetType() {
return i.Message.getFieldWithDefault(this, 6, "");
}
set targetType(e) {
i.Message.setOneofField(this, 6, this.#e[2], e);
}
get hasTargetType() {
return i.Message.getField(this, 6) != null;
}
get subsets() {
return i.Message.getFieldWithDefault(this, 7, []);
}
set subsets(e) {
i.Message.setField(this, 7, e);
}
get chunkSize() {
return i.Message.getFieldWithDefault(this, 9, 0);
}
set chunkSize(e) {
i.Message.setOneofField(this, 9, this.#e[3], e);
}
get hasChunkSize() {
return i.Message.getField(this, 9) != null;
}
get chunkSizeTolerance() {
return i.Message.getFieldWithDefault(this, 10, 0);
}
set chunkSizeTolerance(e) {
i.Message.setOneofField(this, 10, this.#e[4], e);
}
get hasChunkSizeTolerance() {
return i.Message.getField(this, 10) != null;
}
get maxAllowSubsetsCount() {
return i.Message.getFieldWithDefault(this, 11, 0);
}
set maxAllowSubsetsCount(e) {
i.Message.setOneofField(this, 11, this.#e[5], e);
}
get hasMaxAllowSubsetsCount() {
return i.Message.getField(this, 11) != null;
}
get testHtml() {
return i.Message.getFieldWithDefault(this, 13, !1);
}
set testHtml(e) {
i.Message.setOneofField(this, 13, this.#e[6], e);
}
get hasTestHtml() {
return i.Message.getField(this, 13) != null;
}
get reporter() {
return i.Message.getFieldWithDefault(this, 14, !1);
}
set reporter(e) {
i.Message.setOneofField(this, 14, this.#e[7], e);
}
get hasReporter() {
return i.Message.getField(this, 14) != null;
}
get previewImage() {
return i.Message.getWrapperField(this, o.PreviewImage, 15);
}
set previewImage(e) {
i.Message.setOneofWrapperField(this, 15, this.#e[8], e);
}
get hasPreviewImage() {
return i.Message.getField(this, 15) != null;
}
get renameOutputFont() {
return i.Message.getFieldWithDefault(this, 18, "");
}
set renameOutputFont(e) {
i.Message.setOneofField(this, 18, this.#e[9], e);
}
get hasRenameOutputFont() {
return i.Message.getField(this, 18) != null;
}
get buildMode() {
return i.Message.getFieldWithDefault(this, 20, "");
}
set buildMode(e) {
i.Message.setOneofField(this, 20, this.#e[10], e);
}
get hasBuildMode() {
return i.Message.getField(this, 20) != null;
}
get languageAreas() {
return i.Message.getFieldWithDefault(this, 8, !1);
}
set languageAreas(e) {
i.Message.setOneofField(this, 8, this.#e[11], e);
}
get hasLanguageAreas() {
return i.Message.getField(this, 8) != null;
}
get multiThreads() {
return i.Message.getFieldWithDefault(this, 21, !1);
}
set multiThreads(e) {
i.Message.setOneofField(this, 21, this.#e[12], e);
}
get hasMultiThreads() {
return i.Message.getField(this, 21) != null;
}
get fontFeature() {
return i.Message.getFieldWithDefault(this, 22, !1);
}
set fontFeature(e) {
i.Message.setOneofField(this, 22, this.#e[13], e);
}
get hasFontFeature() {
return i.Message.getField(this, 22) != null;
}
get reduceMins() {
return i.Message.getFieldWithDefault(this, 23, !1);
}
set reduceMins(e) {
i.Message.setOneofField(this, 23, this.#e[14], e);
}
get hasReduceMins() {
return i.Message.getField(this, 23) != null;
}
get autoSubset() {
return i.Message.getFieldWithDefault(this, 24, !1);
}
set autoSubset(e) {
i.Message.setOneofField(this, 24, this.#e[15], e);
}
get hasAutoSubset() {
return i.Message.getField(this, 24) != null;
}
get subsetRemainChars() {
return i.Message.getFieldWithDefault(this, 25, !1);
}
set subsetRemainChars(e) {
i.Message.setOneofField(this, 25, this.#e[16], e);
}
get hasSubsetRemainChars() {
return i.Message.getField(this, 25) != null;
}
get _out_dir() {
return {
0: "none",
2: "outDir"
}[i.Message.computeOneofCase(this, [2])];
}
get _css() {
return {
0: "none",
5: "css"
}[i.Message.computeOneofCase(this, [5])];
}
get _target_type() {
return {
0: "none",
6: "targetType"
}[i.Message.computeOneofCase(this, [6])];
}
get _chunk_size() {
return {
0: "none",
9: "chunkSize"
}[i.Message.computeOneofCase(this, [9])];
}
get _chunk_size_tolerance() {
return {
0: "none",
10: "chunkSizeTolerance"
}[i.Message.computeOneofCase(this, [10])];
}
get _max_allow_subsets_count() {
return {
0: "none",
11: "maxAllowSubsetsCount"
}[i.Message.computeOneofCase(this, [11])];
}
get _test_html() {
return {
0: "none",
13: "testHtml"
}[i.Message.computeOneofCase(this, [13])];
}
get _reporter() {
return {
0: "none",
14: "reporter"
}[i.Message.computeOneofCase(this, [14])];
}
get _preview_image() {
return {
0: "none",
15: "previewImage"
}[i.Message.computeOneofCase(this, [15])];
}
get _rename_output_font() {
return {
0: "none",
18: "renameOutputFont"
}[i.Message.computeOneofCase(this, [18])];
}
get _build_mode() {
return {
0: "none",
20: "buildMode"
}[i.Message.computeOneofCase(this, [20])];
}
get _language_areas() {
return {
0: "none",
8: "languageAreas"
}[i.Message.computeOneofCase(this, [8])];
}
get _multi_threads() {
return {
0: "none",
21: "multiThreads"
}[i.Message.computeOneofCase(this, [21])];
}
get _font_feature() {
return {
0: "none",
22: "fontFeature"
}[i.Message.computeOneofCase(this, [22])];
}
get _reduce_mins() {
return {
0: "none",
23: "reduceMins"
}[i.Message.computeOneofCase(this, [23])];
}
get _auto_subset() {
return {
0: "none",
24: "autoSubset"
}[i.Message.computeOneofCase(this, [24])];
}
get _subset_remain_chars() {
return {
0: "none",
25: "subsetRemainChars"
}[i.Message.computeOneofCase(this, [25])];
}
static fromObject(e) {
const n = new o({});
return e.input != null && (n.input = e.input), e.outDir != null && (n.outDir = e.outDir), e.css != null && (n.css = o.CssProperties.fromObject(e.css)), e.targetType != null && (n.targetType = e.targetType), e.subsets != null && (n.subsets = e.subsets), e.chunkSize != null && (n.chunkSize = e.chunkSize), e.chunkSizeTolerance != null && (n.chunkSizeTolerance = e.chunkSizeTolerance), e.maxAllowSubsetsCount != null && (n.maxAllowSubsetsCount = e.maxAllowSubsetsCount), e.testHtml != null && (n.testHtml = e.testHtml), e.reporter != null && (n.reporter = e.reporter), e.previewImage != null && (n.previewImage = o.PreviewImage.fromObject(e.previewImage)), e.renameOutputFont != null && (n.renameOutputFont = e.renameOutputFont), e.buildMode != null && (n.buildMode = e.buildMode), e.languageAreas != null && (n.languageAreas = e.languageAreas), e.multiThreads != null && (n.multiThreads = e.multiThreads), e.fontFeature != null && (n.fontFeature = e.fontFeature), e.reduceMins != null && (n.reduceMins = e.reduceMins), e.autoSubset != null && (n.autoSubset = e.autoSubset), e.subsetRemainChars != null && (n.subsetRemainChars = e.subsetRemainChars), n;
}
toObject() {
const e = {};
return this.input != null && (e.input = this.input), this.outDir != null && (e.outDir = this.outDir), this.css != null && (e.css = this.css.toObject()), this.targetType != null && (e.targetType = this.targetType), this.subsets != null && (e.subsets = this.subsets), this.chunkSize != null && (e.chunkSize = this.chunkSize), this.chunkSizeTolerance != null && (e.chunkSizeTolerance = this.chunkSizeTolerance), this.maxAllowSubsetsCount != null && (e.maxAllowSubsetsCount = this.maxAllowSubsetsCount), this.testHtml != null && (e.testHtml = this.testHtml), this.reporter != null && (e.reporter = this.reporter), this.previewImage != null && (e.previewImage = this.previewImage.toObject()), this.renameOutputFont != null && (e.renameOutputFont = this.renameOutputFont), this.buildMode != null && (e.buildMode = this.buildMode), this.languageAreas != null && (e.languageAreas = this.languageAreas), this.multiThreads != null && (e.multiThreads = this.multiThreads), this.fontFeature != null && (e.fontFeature = this.fontFeature), this.reduceMins != null && (e.reduceMins = this.reduceMins), this.autoSubset != null && (e.autoSubset = this.autoSubset), this.subsetRemainChars != null && (e.subsetRemainChars = this.subsetRemainChars), e;
}
serialize(e) {
const n = e || new i.BinaryWriter();
if (this.input.length && n.writeBytes(1, this.input), this.hasOutDir && n.writeString(2, this.outDir), this.hasCss && n.writeMessage(5, this.css, () => this.css.serialize(n)), this.hasTargetType && n.writeString(6, this.targetType), this.subsets.length && n.writeRepeatedBytes(7, this.subsets), this.hasChunkSize && n.writeInt32(9, this.chunkSize), this.hasChunkSizeTolerance && n.writeFloat(10, this.chunkSizeTolerance), this.hasMaxAllowSubsetsCount && n.writeInt32(11, this.maxAllowSubsetsCount), this.hasTestHtml && n.writeBool(13, this.testHtml), this.hasReporter && n.writeBool(14, this.reporter), this.hasPreviewImage && n.writeMessage(15, this.previewImage, () => this.previewImage.serialize(n)), this.hasRenameOutputFont && n.writeString(18, this.renameOutputFont), this.hasBuildMode && n.writeString(20, this.buildMode), this.hasLanguageAreas && n.writeBool(8, this.languageAreas), this.hasMultiThreads && n.writeBool(21, this.multiThreads), this.hasFontFeature && n.writeBool(22, this.fontFeature), this.hasReduceMins && n.writeBool(23, this.reduceMins), this.hasAutoSubset && n.writeBool(24, this.autoSubset), this.hasSubsetRemainChars && n.writeBool(25, this.subsetRemainChars), !e)
return n.getResultBuffer();
}
static deserialize(e) {
const n = e instanceof i.BinaryReader ? e : new i.BinaryReader(e), l = new o();
for (; n.nextField() && !n.isEndGroup(); )
switch (n.getFieldNumber()) {
case 1:
l.input = n.readBytes();
break;
case 2:
l.outDir = n.readString();
break;
case 5:
n.readMessage(l.css, () => l.css = o.CssProperties.deserialize(n));
break;
case 6:
l.targetType = n.readString();
break;
case 7:
i.Message.addToRepeatedField(l, 7, n.readBytes());
break;
case 9:
l.chunkSize = n.readInt32();
break;
case 10:
l.chunkSizeTolerance = n.readFloat();
break;
case 11:
l.maxAllowSubsetsCount = n.readInt32();
break;
case 13:
l.testHtml = n.readBool();
break;
case 14:
l.reporter = n.readBool();
break;
case 15:
n.readMessage(l.previewImage, () => l.previewImage = o.PreviewImage.deserialize(n));
break;
case 18:
l.renameOutputFont = n.readString();
break;
case 20:
l.buildMode = n.readString();
break;
case 8:
l.languageAreas = n.readBool();
break;
case 21:
l.multiThreads = n.readBool();
break;
case 22:
l.fontFeature = n.readBool();
break;
case 23:
l.reduceMins = n.readBool();
break;
case 24:
l.autoSubset = n.readBool();
break;
case 25:
l.subsetRemainChars = n.readBool();
break;
default:
n.skipField();
}
return l;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(e) {
return o.deserialize(e);
}
}
g.InputTemplate = o, ((h) => {
class e extends i.Message {
#e = [[1], [2], [3], [4], [11], [12], [13], [8], [9]];
constructor(t) {
super(), i.Message.initialize(this, Array.isArray(t) ? t : [], 0, -1, [5, 6], this.#e), !Array.isArray(t) && typeof t == "object" && ("fontFamily" in t && t.fontFamily != null && (this.fontFamily = t.fontFamily), "fontWeight" in t && t.fontWeight != null && (this.fontWeight = t.fontWeight), "fontStyle" in t && t.fontStyle != null && (this.fontStyle = t.fontStyle), "fontDisplay" in t && t.fontDisplay != null && (this.fontDisplay = t.fontDisplay), "localFamily" in t && t.localFamily != null && (this.localFamily = t.localFamily), "polyfill" in t && t.polyfill != null && (this.polyfill = t.polyfill), "commentBase" in t && t.commentBase != null && (this.commentBase = t.commentBase), "commentNameTable" in t && t.commentNameTable != null && (this.commentNameTable = t.commentNameTable), "commentUnicodes" in t && t.commentUnicodes != null && (this.commentUnicodes = t.commentUnicodes), "compress" in t && t.compress != null && (this.compress = t.compress), "fileName" in t && t.fileName != null && (this.fileName = t.fileName));
}
get fontFamily() {
return i.Message.getFieldWithDefault(this, 1, "");
}
set fontFamily(t) {
i.Message.setOneofField(this, 1, this.#e[0], t);
}
get hasFontFamily() {
return i.Message.getField(this, 1) != null;
}
get fontWeight() {
return i.Message.getFieldWithDefault(this, 2, "");
}
set fontWeight(t) {
i.Message.setOneofField(this, 2, this.#e[1], t);
}
get hasFontWeight() {
return i.Message.getField(this, 2) != null;
}
get fontStyle() {
return i.Message.getFieldWithDefault(this, 3, "");
}
set fontStyle(t) {
i.Message.setOneofField(this, 3, this.#e[2], t);
}
get hasFontStyle() {
return i.Message.getField(this, 3) != null;
}
get fontDisplay() {
return i.Message.getFieldWithDefault(this, 4, "");
}
set fontDisplay(t) {
i.Message.setOneofField(this, 4, this.#e[3], t);
}
get hasFontDisplay() {
return i.Message.getField(this, 4) != null;
}
get localFamily() {
return i.Message.getFieldWithDefault(this, 5, []);
}
set localFamily(t) {
i.Message.setField(this, 5, t);
}
get polyfill() {
return i.Message.getRepeatedWrapperField(this, h.PolyfillType, 6);
}
set polyfill(t) {
i.Message.setRepeatedWrapperField(this, 6, t);
}
get commentBase() {
return i.Message.getFieldWithDefault(this, 11, !1);
}
set commentBase(t) {
i.Message.setOneofField(this, 11, this.#e[4], t);
}
get hasCommentBase() {
return i.Message.getField(this, 11) != null;
}
get commentNameTable() {
return i.Message.getFieldWithDefault(this, 12, !1);
}
set commentNameTable(t) {
i.Message.setOneofField(this, 12, this.#e[5], t);
}
get hasCommentNameTable() {
return i.Message.getField(this, 12) != null;
}
get commentUnicodes() {
return i.Message.getFieldWithDefault(this, 13, !1);
}
set commentUnicodes(t) {
i.Message.setOneofField(this, 13, this.#e[6], t);
}
get hasCommentUnicodes() {
return i.Message.getField(this, 13) != null;
}
get compress() {
return i.Message.getFieldWithDefault(this, 8, !1);
}
set compress(t) {
i.Message.setOneofField(this, 8, this.#e[7], t);
}
get hasCompress() {
return i.Message.getField(this, 8) != null;
}
get fileName() {
return i.Message.getFieldWithDefault(this, 9, "");
}
set fileName(t) {
i.Message.setOneofField(this, 9, this.#e[8], t);
}
get hasFileName() {
return i.Message.getField(this, 9) != null;
}
get _font_family() {
return {
0: "none",
1: "fontFamily"
}[i.Message.computeOneofCase(this, [1])];
}
get _font_weight() {
return {
0: "none",
2: "fontWeight"
}[i.Message.computeOneofCase(this, [2])];
}
get _font_style() {
return {
0: "none",
3: "fontStyle"
}[i.Message.computeOneofCase(this, [3])];
}
get _font_display() {
return {
0: "none",
4: "fontDisplay"
}[i.Message.computeOneofCase(this, [4])];
}
get _comment_base() {
return {
0: "none",
11: "commentBase"
}[i.Message.computeOneofCase(this, [11])];
}
get _comment_name_table() {
return {
0: "none",
12: "commentNameTable"
}[i.Message.computeOneofCase(this, [12])];
}
get _comment_unicodes() {
return {
0: "none",
13: "commentUnicodes"
}[i.Message.computeOneofCase(this, [13])];
}
get _compress() {
return {
0: "none",
8: "compress"
}[i.Message.computeOneofCase(this, [8])];
}
get _file_name() {
return {
0: "none",
9: "fileName"
}[i.Message.computeOneofCase(this, [9])];
}
static fromObject(t) {
const s = new e({});
return t.fontFamily != null && (s.fontFamily = t.fontFamily), t.fontWeight != null && (s.fontWeight = t.fontWeight), t.fontStyle != null && (s.fontStyle = t.fontStyle), t.fontDisplay != null && (s.fontDisplay = t.fontDisplay), t.localFamily != null && (s.localFamily = t.localFamily), t.polyfill != null && (s.polyfill = t.polyfill.map((r) => h.PolyfillType.fromObject(r))), t.commentBase != null && (s.commentBase = t.commentBase), t.commentNameTable != null && (s.commentNameTable = t.commentNameTable), t.commentUnicodes != null && (s.commentUnicodes = t.commentUnicodes), t.compress != null && (s.compress = t.compress), t.fileName != null && (s.fileName = t.fileName), s;
}
toObject() {
const t = {};
return this.fontFamily != null && (t.fontFamily = this.fontFamily), this.fontWeight != null && (t.fontWeight = this.fontWeight), this.fontStyle != null && (t.fontStyle = this.fontStyle), this.fontDisplay != null && (t.fontDisplay = this.fontDisplay), this.localFamily != null && (t.localFamily = this.localFamily), this.polyfill != null && (t.polyfill = this.polyfill.map((s) => s.toObject())), this.commentBase != null && (t.commentBase = this.commentBase), this.commentNameTable != null && (t.commentNameTable = this.commentNameTable), this.commentUnicodes != null && (t.commentUnicodes = this.commentUnicodes), this.compress != null && (t.compress = this.compress), this.fileName != null && (t.fileName = this.fileName), t;
}
serialize(t) {
const s = t || new i.BinaryWriter();
if (this.hasFontFamily && s.writeString(1, this.fontFamily), this.hasFontWeight && s.writeString(2, this.fontWeight), this.hasFontStyle && s.writeString(3, this.fontStyle), this.hasFontDisplay && s.writeString(4, this.fontDisplay), this.localFamily.length && s.writeRepeatedString(5, this.localFamily), this.polyfill.length && s.writeRepeatedMessage(6, this.polyfill, (r) => r.serialize(s)), this.hasCommentBase && s.writeBool(11, this.commentBase), this.hasCommentNameTable && s.writeBool(12, this.commentNameTable), this.hasCommentUnicodes && s.writeBool(13, this.commentUnicodes), this.hasCompress && s.writeBool(8, this.compress), this.hasFileName && s.writeString(9, this.fileName), !t)
return s.getResultBuffer();
}
static deserialize(t) {
const s = t instanceof i.BinaryReader ? t : new i.BinaryReader(t), r = new e();
for (; s.nextField() && !s.isEndGroup(); )
switch (s.getFieldNumber()) {
case 1:
r.fontFamily = s.readString();
break;
case 2:
r.fontWeight = s.readString();
break;
case 3:
r.fontStyle = s.readString();
break;
case 4:
r.fontDisplay = s.readString();
break;
case 5:
i.Message.addToRepeatedField(r, 5, s.readString());
break;
case 6:
s.readMessage(r.polyfill, () => i.Message.addToRepeatedWrapperField(r, 6, h.PolyfillType.deserialize(s), h.PolyfillType));
break;
case 11:
r.commentBase = s.readBool();
break;
case 12:
r.commentNameTable = s.readBool();
break;
case 13:
r.commentUnicodes = s.readBool();
break;
case 8:
r.compress = s.readBool();
break;
case 9:
r.fileName = s.readString();
break;
default:
s.skipField();
}
return r;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(t) {
return e.deserialize(t);
}
}
h.CssProperties = e;
class n extends i.Message {
#e = [];
constructor(t) {
super(), i.Message.initialize(this, Array.isArray(t) ? t : [], 0, -1, [], this.#e), !Array.isArray(t) && typeof t == "object" && ("name" in t && t.name != null && (this.name = t.name), "format" in t && t.format != null && (this.format = t.format));
}
get name() {
return i.Message.getFieldWithDefault(this, 1, "");
}
set name(t) {
i.Message.setField(this, 1, t);
}
get format() {
return i.Message.getFieldWithDefault(this, 2, "");
}
set format(t) {
i.Message.setField(this, 2, t);
}
static fromObject(t) {
const s = new n({});
return t.name != null && (s.name = t.name), t.format != null && (s.format = t.format), s;
}
toObject() {
const t = {};
return this.name != null && (t.name = this.name), this.format != null && (t.format = this.format), t;
}
serialize(t) {
const s = t || new i.BinaryWriter();
if (this.name.length && s.writeString(1, this.name), this.format.length && s.writeString(2, this.format), !t)
return s.getResultBuffer();
}
static deserialize(t) {
const s = t instanceof i.BinaryReader ? t : new i.BinaryReader(t), r = new n();
for (; s.nextField() && !s.isEndGroup(); )
switch (s.getFieldNumber()) {
case 1:
r.name = s.readString();
break;
case 2:
r.format = s.readString();
break;
default:
s.skipField();
}
return r;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(t) {
return n.deserialize(t);
}
}
h.PolyfillType = n;
class l extends i.Message {
#e = [];
constructor(t) {
super(), i.Message.initialize(this, Array.isArray(t) ? t : [], 0, -1, [], this.#e), !Array.isArray(t) && typeof t == "object" && ("text" in t && t.text != null && (this.text = t.text), "name" in t && t.name != null && (this.name = t.name));
}
get text() {
return i.Message.getFieldWithDefault(this, 1, "");
}
set text(t) {
i.Message.setField(this, 1, t);
}
get name() {
return i.Message.getFieldWithDefault(this, 2, "");
}
set name(t) {
i.Message.setField(this, 2, t);
}
static fromObject(t) {
const s = new l({});
return t.text != null && (s.text = t.text), t.name != null && (s.name = t.name), s;
}
toObject() {
const t = {};
return this.text != null && (t.text = this.text), this.name != null && (t.name = this.name), t;
}
serialize(t) {
const s = t || new i.BinaryWriter();
if (this.text.length && s.writeString(1, this.text), this.name.length && s.writeString(2, this.name), !t)
return s.getResultBuffer();
}
static deserialize(t) {
const s = t instanceof i.BinaryReader ? t : new i.BinaryReader(t), r = new l();
for (; s.nextField() && !s.isEndGroup(); )
switch (s.getFieldNumber()) {
case 1:
r.text = s.readString();
break;
case 2:
r.name = s.readString();
break;
default:
s.skipField();
}
return r;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(t) {
return l.deserialize(t);
}
}
h.PreviewImage = l;
})(o = g.InputTemplate || (g.InputTemplate = {}));
class f extends i.Message {
#e = [[3]];
constructor(e) {
super(), i.Message.initialize(this, Array.isArray(e) ? e : [], 0, -1, [], this.#e), !Array.isArray(e) && typeof e == "object" && ("event" in e && e.event != null && (this.event = e.event), "message" in e && e.message != null && (this.message = e.message), "data" in e && e.data != null && (this.data = e.data));
}
get event() {
return i.Message.getFieldWithDefault(
this,
1,
0
/* UNSPECIFIED */
);
}
set event(e) {
i.Message.setField(this, 1, e);
}
get message() {
return i.Message.getFieldWithDefault(this, 2, "");
}
set message(e) {
i.Message.setField(this, 2, e);
}
get data() {
return i.Message.getFieldWithDefault(this, 3, new Uint8Array(0));
}
set data(e) {
i.Message.setOneofField(this, 3, this.#e[0], e);
}
get hasData() {
return i.Message.getField(this, 3) != null;
}
get _data() {
return {
0: "none",
3: "data"
}[i.Message.computeOneofCase(this, [3])];
}
static fromObject(e) {
const n = new f({});
return e.event != null && (n.event = e.event), e.message != null && (n.message = e.message), e.data != null && (n.data = e.data), n;
}
toObject() {
const e = {};
return this.event != null && (e.event = this.event), this.message != null && (e.message = this.message), this.data != null && (e.data = this.data), e;
}
serialize(e) {
const n = e || new i.BinaryWriter();
if (this.event != 0 && n.writeEnum(1, this.event), this.message.length && n.writeString(2, this.message), this.hasData && n.writeBytes(3, this.data), !e)
return n.getResultBuffer();
}
static deserialize(e) {
const n = e instanceof i.BinaryReader ? e : new i.BinaryReader(e), l = new f();
for (; n.nextField() && !n.isEndGroup(); )
switch (n.getFieldNumber()) {
case 1:
l.event = n.readEnum();
break;
case 2:
l.message = n.readString();
break;
case 3:
l.data = n.readBytes();
break;
default:
n.skipField();
}
return l;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(e) {
return f.deserialize(e);
}
}
g.EventMessage = f;
class c extends i.Message {
#e = [];
constructor(e) {
super(), i.Message.initialize(this, Array.isArray(e) ? e : [], 0, -1, [1], this.#e), !Array.isArray(e) && typeof e == "object" && "messages" in e && e.messages != null && (this.messages = e.messages);
}
get messages() {
return i.Message.getRepeatedWrapperField(this, f, 1);
}
set messages(e) {
i.Message.setRepeatedWrapperField(this, 1, e);
}
static fromObject(e) {
const n = new c({});
return e.messages != null && (n.messages = e.messages.map((l) => f.fromObject(l))), n;
}
toObject() {
const e = {};
return this.messages != null && (e.messages = this.messages.map((n) => n.toObject())), e;
}
serialize(e) {
const n = e || new i.BinaryWriter();
if (this.messages.length && n.writeRepeatedMessage(1, this.messages, (l) => l.serialize(n)), !e)
return n.getResultBuffer();
}
static deserialize(e) {
const n = e instanceof i.BinaryReader ? e : new i.BinaryReader(e), l = new c();
for (; n.nextField() && !n.isEndGroup(); )
switch (n.getFieldNumber()) {
case 1:
n.readMessage(l.messages, () => i.Message.addToRepeatedWrapperField(l, 1, f.deserialize(n), f));
break;
default:
n.skipField();
}
return l;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(e) {
return c.deserialize(e);
}
}
g.MultiMessages = c;
class u extends i.Message {
#e = [];
constructor(e) {
super(), i.Message.initialize(this, Array.isArray(e) ? e : [], 0, -1, [25, 26], this.#e), !Array.isArray(e) && typeof e == "object" && ("version" in e && e.version != null && (this.version = e.version), "css" in e && e.css != null && (this.css = e.css), "platform" in e && e.platform != null && (this.platform = e.platform), "bundleMessage" in e && e.bundleMessage != null && (this.bundleMessage = e.bundleMessage), "nameTable" in e && e.nameTable != null && (this.nameTable = e.nameTable), "subsetDetail" in e && e.subsetDetail != null && (this.subsetDetail = e.subsetDetail));
}
get version() {
return i.Message.getFieldWithDefault(this, 1, "");
}
set version(e) {
i.Message.setField(this, 1, e);
}
get css() {
return i.Message.getWrapperField(this, u.Css, 2);
}
set css(e) {
i.Message.setWrapperField(this, 2, e);
}
get hasCss() {
return i.Message.getField(this, 2) != null;
}
get platform() {
return i.Message.getFieldWithDefault(this, 3, "");
}
set platform(e) {
i.Message.setField(this, 3, e);
}
get bundleMessage() {
return i.Message.getWrapperField(this, u.BundleMessage, 24);
}
set bundleMessage(e) {
i.Message.setWrapperField(this, 24, e);
}
get hasBundleMessage() {
return i.Message.getField(this, 24) != null;
}
get nameTable() {
return i.Message.getRepeatedWrapperField(this, u.NameTable, 25);
}
set nameTable(e) {
i.Message.setRepeatedWrapperField(this, 25, e);
}
get subsetDetail() {
return i.Message.getRepeatedWrapperField(this, u.SubsetDetail, 26);
}
set subsetDetail(e) {
i.Message.setRepeatedWrapperField(this, 26, e);
}
static fromObject(e) {
const n = new u({});
return e.version != null && (n.version = e.version), e.css != null && (n.css = u.Css.fromObject(e.css)), e.platform != null && (n.platform = e.platform), e.bundleMessage != null && (n.bundleMessage = u.BundleMessage.fromObject(e.bundleMessage)), e.nameTable != null && (n.nameTable = e.nameTable.map((l) => u.NameTable.fromObject(l))), e.subsetDetail != null && (n.subsetDetail = e.subsetDetail.map((l) => u.SubsetDetail.fromObject(l))), n;
}
toObject() {
const e = {};
return this.version != null && (e.version = this.version), this.css != null && (e.css = this.css.toObject()), this.platform != null && (e.platform = this.platform), this.bundleMessage != null && (e.bundleMessage = this.bundleMessage.toObject()), this.nameTable != null && (e.nameTable = this.nameTable.map((n) => n.toObject())), this.subsetDetail != null && (e.subsetDetail = this.subsetDetail.map((n) => n.toObject())), e;
}
serialize(e) {
const n = e || new i.BinaryWriter();
if (this.version.length && n.writeString(1, this.version), this.hasCss && n.writeMessage(2, this.css, () => this.css.serialize(n)), this.platform.length && n.writeString(3, this.platform), this.hasBundleMessage && n.writeMessage(24, this.bundleMessage, () => this.bundleMessage.serialize(n)), this.nameTable.length && n.writeRepeatedMessage(25, this.nameTable, (l) => l.serialize(n)), this.subsetDetail.length && n.writeRepeatedMessage(26, this.subsetDetail, (l) => l.serialize(n)), !e)
return n.getResultBuffer();
}
static deserialize(e) {
const n = e instanceof i.BinaryReader ? e : new i.BinaryReader(e), l = new u();
for (; n.nextField() && !n.isEndGroup(); )
switch (n.getFieldNumber()) {
case 1:
l.version = n.readString();
break;
case 2:
n.readMessage(l.css, () => l.css = u.Css.deserialize(n));
break;
case 3:
l.platform = n.readString();
break;
case 24:
n.readMessage(l.bundleMessage, () => l.bundleMessage = u.BundleMessage.deserialize(n));
break;
case 25:
n.readMessage(l.nameTable, () => i.Message.addToRepeatedWrapperField(l, 25, u.NameTable.deserialize(n), u.NameTable));
break;
case 26:
n.readMessage(l.subsetDetail, () => i.Message.addToRepeatedWrapperField(l, 26, u.SubsetDetail.deserialize(n), u.SubsetDetail));
break;
default:
n.skipField();
}
return l;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(e) {
return u.deserialize(e);
}
}
g.OutputReport = u, ((h) => {
class e extends i.Message {
#e = [];
constructor(s) {
super(), i.Message.initialize(this, Array.isArray(s) ? s : [], 0, -1, [], this.#e), !Array.isArray(s) && typeof s == "object" && ("platform" in s && s.platform != null && (this.platform = s.platform), "language" in s && s.language != null && (this.language = s.language), "name" in s && s.name != null && (this.name = s.name), "value" in s && s.value != null && (this.value = s.value));
}
get platform() {
return i.Message.getFieldWithDefault(this, 1, "");
}
set platform(s) {
i.Message.setField(this, 1, s);
}
get language() {
return i.Message.getFieldWithDefault(this, 2, "");
}
set language(s) {
i.Message.setField(this, 2, s);
}
get name() {
return i.Message.getFieldWithDefault(this, 3, "");
}
set name(s) {
i.Message.setField(this, 3, s);
}
get value() {
return i.Message.getFieldWithDefault(this, 4, "");
}
set value(s) {
i.Message.setField(this, 4, s);
}
static fromObject(s) {
const r = new e({});
return s.platform != null && (r.platform = s.platform), s.language != null && (r.language = s.language), s.name != null && (r.name = s.name), s.value != null && (r.value = s.value), r;
}
toObject() {
const s = {};
return this.platform != null && (s.platform = this.platform), this.language != null && (s.language = this.language), this.name != null && (s.name = this.name), this.value != null && (s.value = this.value), s;
}
serialize(s) {
const r = s || new i.BinaryWriter();
if (this.platform.length && r.writeString(1, this.platform), this.language.length && r.writeString(2, this.language), this.name.length && r.writeString(3, this.name), this.value.length && r.writeString(4, this.value), !s)
return r.getResultBuffer();
}
static deserialize(s) {
const r = s instanceof i.BinaryReader ? s : new i.BinaryReader(s), a = new e();
for (; r.nextField() && !r.isEndGroup(); )
switch (r.getFieldNumber()) {
case 1:
a.platform = r.readString();
break;
case 2:
a.language = r.readString();
break;
case 3:
a.name = r.readString();
break;
case 4:
a.value = r.readString();
break;
default:
r.skipField();
}
return a;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(s) {
return e.deserialize(s);
}
}
h.NameTable = e;
class n extends i.Message {
#e = [];
constructor(s) {
super(), i.Message.initialize(this, Array.isArray(s) ? s : [], 0, -1, [4], this.#e), !Array.isArray(s) && typeof s == "object" && ("id" in s && s.id != null && (this.id = s.id), "hash" in s && s.hash != null && (this.hash = s.hash), "fileName" in s && s.fileName != null && (this.fileName = s.fileName), "bytes" in s && s.bytes != null && (this.bytes = s.bytes), "chars" in s && s.chars != null && (this.chars = s.chars), "duration" in s && s.duration != null && (this.duration = s.duration));
}
get id() {
return i.Message.getFieldWithDefault(this, 1, 0);
}
set id(s) {
i.Message.setField(this, 1, s);
}
get hash() {
return i.Message.getFieldWithDefault(this, 2, "");
}
set hash(s) {
i.Message.setField(this, 2, s);
}
get fileName() {
return i.Message.getFieldWithDefault(this, 6, "");
}
set fileName(s) {
i.Message.setField(this, 6, s);
}
get bytes() {
return i.Message.getFieldWithDefault(this, 3, 0);
}
set bytes(s) {
i.Message.setField(this, 3, s);
}
get chars() {
return i.Message.getFieldWithDefault(this, 4, []);
}
set chars(s) {
i.Message.setField(this, 4, s);
}
get duration() {
return i.Message.getFieldWithDefault(this, 5, 0);
}
set duration(s) {
i.Message.setField(this, 5, s);
}
static fromObject(s) {
const r = new n({});
return s.id != null && (r.id = s.id), s.hash != null && (r.hash = s.hash), s.fileName != null && (r.fileName = s.fileName), s.bytes != null && (r.bytes = s.bytes), s.chars != null && (r.chars = s.chars), s.duration != null && (r.duration = s.duration), r;
}
toObject() {
const s = {};
return this.id != null && (s.id = this.id), this.hash != null && (s.hash = this.hash), this.fileName != null && (s.fileName = this.fileName), this.bytes != null && (s.bytes = this.bytes), this.chars != null && (s.chars = this.chars), this.duration != null && (s.duration = this.duration), s;
}
serialize(s) {
const r = s || new i.BinaryWriter();
if (this.id != 0 && r.writeUint32(1, this.id), this.hash.length && r.writeString(2, this.hash), this.fileName.length && r.writeString(6, this.fileName), this.bytes != 0 && r.writeUint32(3, this.bytes), this.chars.length && r.writePackedUint32(4, this.chars), this.duration != 0 && r.writeUint32(5, this.duration), !s)
return r.getResultBuffer();
}
static deserialize(s) {
const r = s instanceof i.BinaryReader ? s : new i.BinaryReader(s), a = new n();
for (; r.nextField() && !r.isEndGroup(); )
switch (r.getFieldNumber()) {
case 1:
a.id = r.readUint32();
break;
case 2:
a.hash = r.readString();
break;
case 6:
a.fileName = r.readString();
break;
case 3:
a.bytes = r.readUint32();
break;
case 4:
a.chars = r.readPackedUint32();
break;
case 5:
a.duration = r.readUint32();
break;
default:
r.skipField();
}
return a;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(s) {
return n.deserialize(s);
}
}
h.SubsetDetail = n;
class l extends i.Message {
#e = [];
constructor(s) {
super(), i.Message.initialize(this, Array.isArray(s) ? s : [], 0, -1, [], this.#e), !Array.isArray(s) && typeof s == "object" && ("originSize" in s && s.originSize != null && (this.originSize = s.originSize), "bundledSize" in s && s.bundledSize != null && (this.bundledSize = s.bundledSize), "originBytes" in s && s.originBytes != null && (this.originBytes = s.originBytes), "bundledBytes" in s && s.bundledBytes != null && (this.bundledBytes = s.bundledBytes));
}
get originSize() {
return i.Message.getFieldWithDefault(this, 1, 0);
}
set originSize(s) {
i.Message.setField(this, 1, s);
}
get bundledSize() {
return i.Message.getFieldWithDefault(this, 2, 0);
}
set bundledSize(s) {
i.Message.setField(this, 2, s);
}
get originBytes() {
return i.Message.getFieldWithDefault(this, 3, 0);
}
set originBytes(s) {
i.Message.setField(this, 3, s);
}
get bundledBytes() {
return i.Message.getFieldWithDefault(this, 4, 0);
}
set bundledBytes(s) {
i.Message.setField(this, 4, s);
}
static fromObject(s) {
const r = new l({});
return s.originSize != null && (r.originSize = s.originSize), s.bundledSize != null && (r.bundledSize = s.bundledSize), s.originBytes != null && (r.originBytes = s.originBytes), s.bundledBytes != null && (r.bundledBytes = s.bundledBytes), r;
}
toObject() {
const s = {};
return this.originSize != null && (s.originSize = this.originSize), this.bundledSize != null && (s.bundledSize = this.bundledSize), this.originBytes != null && (s.originBytes = this.originBytes), this.bundledBytes != null && (s.bundledBytes = this.bundledBytes), s;
}
serialize(s) {
const r = s || new i.BinaryWriter();
if (this.originSize != 0 && r.writeUint32(1, this.originSize), this.bundledSize != 0 && r.writeUint32(2, this.bundledSize), this.originBytes != 0 && r.writeUint32(3, this.originBytes), this.bundledBytes != 0 && r.writeUint32(4, this.bundledBytes), !s)
return r.getResultBuffer();
}
static deserialize(s) {
const r = s instanceof i.BinaryReader ? s : new i.BinaryReader(s), a = new l();
for (; r.nextField() && !r.isEndGroup(); )
switch (r.getFieldNumber()) {
case 1:
a.originSize = r.readUint32();
break;
case 2:
a.bundledSize = r.readUint32();
break;
case 3:
a.originBytes = r.readUint32();
break;
case 4:
a.bundledBytes = r.readUint32();
break;
default:
r.skipField();
}
return a;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(s) {
return l.deserialize(s);
}
}
h.BundleMessage = l;
class m extends i.Message {
#e = [];
constructor(s) {
super(), i.Message.initialize(this, Array.isArray(s) ? s : [], 0, -1, [], this.#e), !Array.isArray(s) && typeof s == "object" && ("family" in s && s.family != null && (this.family = s.family), "style" in s && s.style != null && (this.style = s.style), "weight" in s && s.weight != null && (this.weight = s.weight), "display" in s && s.display != null && (this.display = s.display));
}
get family() {
return i.Message.getFieldWithDefault(this, 1, "");
}
set family(s) {
i.Message.setField(this, 1, s);
}
get style() {
return i.Message.getFieldWithDefault(this, 2, "");
}
set style(s) {
i.Message.setField(this, 2, s);
}
get weight() {
return i.Message.getFieldWithDefault(this, 3, "");
}
set weight(s) {
i.Message.setField(this, 3, s);
}
get display() {
return i.Message.getFieldWithDefault(this, 4, "");
}
set display(s) {
i.Message.setField(this, 4, s);
}
static fromObject(s) {
const r = new m({});
return s.family != null && (r.family = s.family), s.style != null && (r.style = s.style), s.weight != null && (r.weight = s.weight), s.display != null && (r.display = s.display), r;
}
toObject() {
const s = {};
return this.family != null && (s.family = this.family), this.style != null && (s.style = this.style), this.weight != null && (s.weight = this.weight), this.display != null && (s.display = this.display), s;
}
serialize(s) {
const r = s || new i.BinaryWriter();
if (this.family.length && r.writeString(1, this.family), this.style.length && r.writeString(2, this.style), this.weight.length && r.writeString(3, this.weight), this.display.length && r.writeString(4, this.display), !s)
return r.getResultBuffer();
}
static deserialize(s) {
const r = s instanceof i.BinaryReader ? s : new i.BinaryReader(s), a = new m();
for (; r.nextField() && !r.isEndGroup(); )
switch (r.getFieldNumber()) {
case 1:
a.family = r.readString();
break;
case 2:
a.style = r.readString();
break;
case 3:
a.weight = r.readString();
break;
case 4:
a.display = r.readString();
break;
default:
r.skipField();
}
return a;
}
serializeBinary() {
return this.serialize();
}
static deserializeBinary(s) {
return m.deserialize(s);
}
}
h.Css = m;
})(u = g.OutputReport || (g.OutputReport = {}));
})(d || (d = {}));
export {
d as api_interface
};
//# sourceMappingURL=index.mjs.map