UNPKG

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,201 lines (1,200 loc) 44.2 kB
import * as e from "google-protobuf"; //#region src/gen/index.ts var t; (function(t) { t.EventName = /* @__PURE__ */ function(e) { return e[e.UNSPECIFIED = 0] = "UNSPECIFIED", e[e.OUTPUT_DATA = 1] = "OUTPUT_DATA", e[e.END = 2] = "END", e; }({}); class n extends e.Message { #e = [ [2], [5], [6], [9], [10], [11], [13], [14], [15], [18], [20], [8], [21], [22], [23], [24], [25] ]; constructor(t) { super(), e.Message.initialize(this, Array.isArray(t) ? t : [], 0, -1, [7], this.#e), !Array.isArray(t) && typeof t == "object" && ("input" in t && t.input != null && (this.input = t.input), "outDir" in t && t.outDir != null && (this.outDir = t.outDir), "css" in t && t.css != null && (this.css = t.css), "targetType" in t && t.targetType != null && (this.targetType = t.targetType), "subsets" in t && t.subsets != null && (this.subsets = t.subsets), "chunkSize" in t && t.chunkSize != null && (this.chunkSize = t.chunkSize), "chunkSizeTolerance" in t && t.chunkSizeTolerance != null && (this.chunkSizeTolerance = t.chunkSizeTolerance), "maxAllowSubsetsCount" in t && t.maxAllowSubsetsCount != null && (this.maxAllowSubsetsCount = t.maxAllowSubsetsCount), "testHtml" in t && t.testHtml != null && (this.testHtml = t.testHtml), "reporter" in t && t.reporter != null && (this.reporter = t.reporter), "previewImage" in t && t.previewImage != null && (this.previewImage = t.previewImage), "renameOutputFont" in t && t.renameOutputFont != null && (this.renameOutputFont = t.renameOutputFont), "buildMode" in t && t.buildMode != null && (this.buildMode = t.buildMode), "languageAreas" in t && t.languageAreas != null && (this.languageAreas = t.languageAreas), "multiThreads" in t && t.multiThreads != null && (this.multiThreads = t.multiThreads), "fontFeature" in t && t.fontFeature != null && (this.fontFeature = t.fontFeature), "reduceMins" in t && t.reduceMins != null && (this.reduceMins = t.reduceMins), "autoSubset" in t && t.autoSubset != null && (this.autoSubset = t.autoSubset), "subsetRemainChars" in t && t.subsetRemainChars != null && (this.subsetRemainChars = t.subsetRemainChars)); } get input() { return e.Message.getFieldWithDefault(this, 1, new Uint8Array()); } set input(t) { e.Message.setField(this, 1, t); } get outDir() { return e.Message.getFieldWithDefault(this, 2, ""); } set outDir(t) { e.Message.setOneofField(this, 2, this.#e[0], t); } get hasOutDir() { return e.Message.getField(this, 2) != null; } get css() { return e.Message.getWrapperField(this, n.CssProperties, 5); } set css(t) { e.Message.setOneofWrapperField(this, 5, this.#e[1], t); } get hasCss() { return e.Message.getField(this, 5) != null; } get targetType() { return e.Message.getFieldWithDefault(this, 6, ""); } set targetType(t) { e.Message.setOneofField(this, 6, this.#e[2], t); } get hasTargetType() { return e.Message.getField(this, 6) != null; } get subsets() { return e.Message.getFieldWithDefault(this, 7, []); } set subsets(t) { e.Message.setField(this, 7, t); } get chunkSize() { return e.Message.getFieldWithDefault(this, 9, 0); } set chunkSize(t) { e.Message.setOneofField(this, 9, this.#e[3], t); } get hasChunkSize() { return e.Message.getField(this, 9) != null; } get chunkSizeTolerance() { return e.Message.getFieldWithDefault(this, 10, 0); } set chunkSizeTolerance(t) { e.Message.setOneofField(this, 10, this.#e[4], t); } get hasChunkSizeTolerance() { return e.Message.getField(this, 10) != null; } get maxAllowSubsetsCount() { return e.Message.getFieldWithDefault(this, 11, 0); } set maxAllowSubsetsCount(t) { e.Message.setOneofField(this, 11, this.#e[5], t); } get hasMaxAllowSubsetsCount() { return e.Message.getField(this, 11) != null; } get testHtml() { return e.Message.getFieldWithDefault(this, 13, !1); } set testHtml(t) { e.Message.setOneofField(this, 13, this.#e[6], t); } get hasTestHtml() { return e.Message.getField(this, 13) != null; } get reporter() { return e.Message.getFieldWithDefault(this, 14, !1); } set reporter(t) { e.Message.setOneofField(this, 14, this.#e[7], t); } get hasReporter() { return e.Message.getField(this, 14) != null; } get previewImage() { return e.Message.getWrapperField(this, n.PreviewImage, 15); } set previewImage(t) { e.Message.setOneofWrapperField(this, 15, this.#e[8], t); } get hasPreviewImage() { return e.Message.getField(this, 15) != null; } get renameOutputFont() { return e.Message.getFieldWithDefault(this, 18, ""); } set renameOutputFont(t) { e.Message.setOneofField(this, 18, this.#e[9], t); } get hasRenameOutputFont() { return e.Message.getField(this, 18) != null; } get buildMode() { return e.Message.getFieldWithDefault(this, 20, ""); } set buildMode(t) { e.Message.setOneofField(this, 20, this.#e[10], t); } get hasBuildMode() { return e.Message.getField(this, 20) != null; } get languageAreas() { return e.Message.getFieldWithDefault(this, 8, !1); } set languageAreas(t) { e.Message.setOneofField(this, 8, this.#e[11], t); } get hasLanguageAreas() { return e.Message.getField(this, 8) != null; } get multiThreads() { return e.Message.getFieldWithDefault(this, 21, !1); } set multiThreads(t) { e.Message.setOneofField(this, 21, this.#e[12], t); } get hasMultiThreads() { return e.Message.getField(this, 21) != null; } get fontFeature() { return e.Message.getFieldWithDefault(this, 22, !1); } set fontFeature(t) { e.Message.setOneofField(this, 22, this.#e[13], t); } get hasFontFeature() { return e.Message.getField(this, 22) != null; } get reduceMins() { return e.Message.getFieldWithDefault(this, 23, !1); } set reduceMins(t) { e.Message.setOneofField(this, 23, this.#e[14], t); } get hasReduceMins() { return e.Message.getField(this, 23) != null; } get autoSubset() { return e.Message.getFieldWithDefault(this, 24, !1); } set autoSubset(t) { e.Message.setOneofField(this, 24, this.#e[15], t); } get hasAutoSubset() { return e.Message.getField(this, 24) != null; } get subsetRemainChars() { return e.Message.getFieldWithDefault(this, 25, !1); } set subsetRemainChars(t) { e.Message.setOneofField(this, 25, this.#e[16], t); } get hasSubsetRemainChars() { return e.Message.getField(this, 25) != null; } get _out_dir() { return { 0: "none", 2: "outDir" }[e.Message.computeOneofCase(this, [2])]; } get _css() { return { 0: "none", 5: "css" }[e.Message.computeOneofCase(this, [5])]; } get _target_type() { return { 0: "none", 6: "targetType" }[e.Message.computeOneofCase(this, [6])]; } get _chunk_size() { return { 0: "none", 9: "chunkSize" }[e.Message.computeOneofCase(this, [9])]; } get _chunk_size_tolerance() { return { 0: "none", 10: "chunkSizeTolerance" }[e.Message.computeOneofCase(this, [10])]; } get _max_allow_subsets_count() { return { 0: "none", 11: "maxAllowSubsetsCount" }[e.Message.computeOneofCase(this, [11])]; } get _test_html() { return { 0: "none", 13: "testHtml" }[e.Message.computeOneofCase(this, [13])]; } get _reporter() { return { 0: "none", 14: "reporter" }[e.Message.computeOneofCase(this, [14])]; } get _preview_image() { return { 0: "none", 15: "previewImage" }[e.Message.computeOneofCase(this, [15])]; } get _rename_output_font() { return { 0: "none", 18: "renameOutputFont" }[e.Message.computeOneofCase(this, [18])]; } get _build_mode() { return { 0: "none", 20: "buildMode" }[e.Message.computeOneofCase(this, [20])]; } get _language_areas() { return { 0: "none", 8: "languageAreas" }[e.Message.computeOneofCase(this, [8])]; } get _multi_threads() { return { 0: "none", 21: "multiThreads" }[e.Message.computeOneofCase(this, [21])]; } get _font_feature() { return { 0: "none", 22: "fontFeature" }[e.Message.computeOneofCase(this, [22])]; } get _reduce_mins() { return { 0: "none", 23: "reduceMins" }[e.Message.computeOneofCase(this, [23])]; } get _auto_subset() { return { 0: "none", 24: "autoSubset" }[e.Message.computeOneofCase(this, [24])]; } get _subset_remain_chars() { return { 0: "none", 25: "subsetRemainChars" }[e.Message.computeOneofCase(this, [25])]; } static fromObject(e) { let t = new n({}); return e.input != null && (t.input = e.input), e.outDir != null && (t.outDir = e.outDir), e.css != null && (t.css = n.CssProperties.fromObject(e.css)), e.targetType != null && (t.targetType = e.targetType), e.subsets != null && (t.subsets = e.subsets), e.chunkSize != null && (t.chunkSize = e.chunkSize), e.chunkSizeTolerance != null && (t.chunkSizeTolerance = e.chunkSizeTolerance), e.maxAllowSubsetsCount != null && (t.maxAllowSubsetsCount = e.maxAllowSubsetsCount), e.testHtml != null && (t.testHtml = e.testHtml), e.reporter != null && (t.reporter = e.reporter), e.previewImage != null && (t.previewImage = n.PreviewImage.fromObject(e.previewImage)), e.renameOutputFont != null && (t.renameOutputFont = e.renameOutputFont), e.buildMode != null && (t.buildMode = e.buildMode), e.languageAreas != null && (t.languageAreas = e.languageAreas), e.multiThreads != null && (t.multiThreads = e.multiThreads), e.fontFeature != null && (t.fontFeature = e.fontFeature), e.reduceMins != null && (t.reduceMins = e.reduceMins), e.autoSubset != null && (t.autoSubset = e.autoSubset), e.subsetRemainChars != null && (t.subsetRemainChars = e.subsetRemainChars), t; } toObject() { let 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(t) { let n = t || new e.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), !t) return n.getResultBuffer(); } static deserialize(t) { let r = t instanceof e.BinaryReader ? t : new e.BinaryReader(t), i = new n(); for (; r.nextField() && !r.isEndGroup();) switch (r.getFieldNumber()) { case 1: i.input = r.readBytes(); break; case 2: i.outDir = r.readString(); break; case 5: r.readMessage(i.css, () => i.css = n.CssProperties.deserialize(r)); break; case 6: i.targetType = r.readString(); break; case 7: e.Message.addToRepeatedField(i, 7, r.readBytes()); break; case 9: i.chunkSize = r.readInt32(); break; case 10: i.chunkSizeTolerance = r.readFloat(); break; case 11: i.maxAllowSubsetsCount = r.readInt32(); break; case 13: i.testHtml = r.readBool(); break; case 14: i.reporter = r.readBool(); break; case 15: r.readMessage(i.previewImage, () => i.previewImage = n.PreviewImage.deserialize(r)); break; case 18: i.renameOutputFont = r.readString(); break; case 20: i.buildMode = r.readString(); break; case 8: i.languageAreas = r.readBool(); break; case 21: i.multiThreads = r.readBool(); break; case 22: i.fontFeature = r.readBool(); break; case 23: i.reduceMins = r.readBool(); break; case 24: i.autoSubset = r.readBool(); break; case 25: i.subsetRemainChars = r.readBool(); break; default: r.skipField(); } return i; } serializeBinary() { return this.serialize(); } static deserializeBinary(e) { return n.deserialize(e); } } t.InputTemplate = n, (function(t) { class r extends e.Message { #e = [ [1], [2], [3], [4], [11], [12], [13], [8], [9] ]; constructor(t) { super(), e.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 e.Message.getFieldWithDefault(this, 1, ""); } set fontFamily(t) { e.Message.setOneofField(this, 1, this.#e[0], t); } get hasFontFamily() { return e.Message.getField(this, 1) != null; } get fontWeight() { return e.Message.getFieldWithDefault(this, 2, ""); } set fontWeight(t) { e.Message.setOneofField(this, 2, this.#e[1], t); } get hasFontWeight() { return e.Message.getField(this, 2) != null; } get fontStyle() { return e.Message.getFieldWithDefault(this, 3, ""); } set fontStyle(t) { e.Message.setOneofField(this, 3, this.#e[2], t); } get hasFontStyle() { return e.Message.getField(this, 3) != null; } get fontDisplay() { return e.Message.getFieldWithDefault(this, 4, ""); } set fontDisplay(t) { e.Message.setOneofField(this, 4, this.#e[3], t); } get hasFontDisplay() { return e.Message.getField(this, 4) != null; } get localFamily() { return e.Message.getFieldWithDefault(this, 5, []); } set localFamily(t) { e.Message.setField(this, 5, t); } get polyfill() { return e.Message.getRepeatedWrapperField(this, n.PolyfillType, 6); } set polyfill(t) { e.Message.setRepeatedWrapperField(this, 6, t); } get commentBase() { return e.Message.getFieldWithDefault(this, 11, !1); } set commentBase(t) { e.Message.setOneofField(this, 11, this.#e[4], t); } get hasCommentBase() { return e.Message.getField(this, 11) != null; } get commentNameTable() { return e.Message.getFieldWithDefault(this, 12, !1); } set commentNameTable(t) { e.Message.setOneofField(this, 12, this.#e[5], t); } get hasCommentNameTable() { return e.Message.getField(this, 12) != null; } get commentUnicodes() { return e.Message.getFieldWithDefault(this, 13, !1); } set commentUnicodes(t) { e.Message.setOneofField(this, 13, this.#e[6], t); } get hasCommentUnicodes() { return e.Message.getField(this, 13) != null; } get compress() { return e.Message.getFieldWithDefault(this, 8, !1); } set compress(t) { e.Message.setOneofField(this, 8, this.#e[7], t); } get hasCompress() { return e.Message.getField(this, 8) != null; } get fileName() { return e.Message.getFieldWithDefault(this, 9, ""); } set fileName(t) { e.Message.setOneofField(this, 9, this.#e[8], t); } get hasFileName() { return e.Message.getField(this, 9) != null; } get _font_family() { return { 0: "none", 1: "fontFamily" }[e.Message.computeOneofCase(this, [1])]; } get _font_weight() { return { 0: "none", 2: "fontWeight" }[e.Message.computeOneofCase(this, [2])]; } get _font_style() { return { 0: "none", 3: "fontStyle" }[e.Message.computeOneofCase(this, [3])]; } get _font_display() { return { 0: "none", 4: "fontDisplay" }[e.Message.computeOneofCase(this, [4])]; } get _comment_base() { return { 0: "none", 11: "commentBase" }[e.Message.computeOneofCase(this, [11])]; } get _comment_name_table() { return { 0: "none", 12: "commentNameTable" }[e.Message.computeOneofCase(this, [12])]; } get _comment_unicodes() { return { 0: "none", 13: "commentUnicodes" }[e.Message.computeOneofCase(this, [13])]; } get _compress() { return { 0: "none", 8: "compress" }[e.Message.computeOneofCase(this, [8])]; } get _file_name() { return { 0: "none", 9: "fileName" }[e.Message.computeOneofCase(this, [9])]; } static fromObject(e) { let t = new r({}); return e.fontFamily != null && (t.fontFamily = e.fontFamily), e.fontWeight != null && (t.fontWeight = e.fontWeight), e.fontStyle != null && (t.fontStyle = e.fontStyle), e.fontDisplay != null && (t.fontDisplay = e.fontDisplay), e.localFamily != null && (t.localFamily = e.localFamily), e.polyfill != null && (t.polyfill = e.polyfill.map((e) => n.PolyfillType.fromObject(e))), e.commentBase != null && (t.commentBase = e.commentBase), e.commentNameTable != null && (t.commentNameTable = e.commentNameTable), e.commentUnicodes != null && (t.commentUnicodes = e.commentUnicodes), e.compress != null && (t.compress = e.compress), e.fileName != null && (t.fileName = e.fileName), t; } toObject() { let e = {}; return this.fontFamily != null && (e.fontFamily = this.fontFamily), this.fontWeight != null && (e.fontWeight = this.fontWeight), this.fontStyle != null && (e.fontStyle = this.fontStyle), this.fontDisplay != null && (e.fontDisplay = this.fontDisplay), this.localFamily != null && (e.localFamily = this.localFamily), this.polyfill != null && (e.polyfill = this.polyfill.map((e) => e.toObject())), this.commentBase != null && (e.commentBase = this.commentBase), this.commentNameTable != null && (e.commentNameTable = this.commentNameTable), this.commentUnicodes != null && (e.commentUnicodes = this.commentUnicodes), this.compress != null && (e.compress = this.compress), this.fileName != null && (e.fileName = this.fileName), e; } serialize(t) { let n = t || new e.BinaryWriter(); if (this.hasFontFamily && n.writeString(1, this.fontFamily), this.hasFontWeight && n.writeString(2, this.fontWeight), this.hasFontStyle && n.writeString(3, this.fontStyle), this.hasFontDisplay && n.writeString(4, this.fontDisplay), this.localFamily.length && n.writeRepeatedString(5, this.localFamily), this.polyfill.length && n.writeRepeatedMessage(6, this.polyfill, (e) => e.serialize(n)), this.hasCommentBase && n.writeBool(11, this.commentBase), this.hasCommentNameTable && n.writeBool(12, this.commentNameTable), this.hasCommentUnicodes && n.writeBool(13, this.commentUnicodes), this.hasCompress && n.writeBool(8, this.compress), this.hasFileName && n.writeString(9, this.fileName), !t) return n.getResultBuffer(); } static deserialize(t) { let i = t instanceof e.BinaryReader ? t : new e.BinaryReader(t), a = new r(); for (; i.nextField() && !i.isEndGroup();) switch (i.getFieldNumber()) { case 1: a.fontFamily = i.readString(); break; case 2: a.fontWeight = i.readString(); break; case 3: a.fontStyle = i.readString(); break; case 4: a.fontDisplay = i.readString(); break; case 5: e.Message.addToRepeatedField(a, 5, i.readString()); break; case 6: i.readMessage(a.polyfill, () => e.Message.addToRepeatedWrapperField(a, 6, n.PolyfillType.deserialize(i), n.PolyfillType)); break; case 11: a.commentBase = i.readBool(); break; case 12: a.commentNameTable = i.readBool(); break; case 13: a.commentUnicodes = i.readBool(); break; case 8: a.compress = i.readBool(); break; case 9: a.fileName = i.readString(); break; default: i.skipField(); } return a; } serializeBinary() { return this.serialize(); } static deserializeBinary(e) { return r.deserialize(e); } } t.CssProperties = r; class i extends e.Message { #e = []; constructor(t) { super(), e.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 e.Message.getFieldWithDefault(this, 1, ""); } set name(t) { e.Message.setField(this, 1, t); } get format() { return e.Message.getFieldWithDefault(this, 2, ""); } set format(t) { e.Message.setField(this, 2, t); } static fromObject(e) { let t = new i({}); return e.name != null && (t.name = e.name), e.format != null && (t.format = e.format), t; } toObject() { let e = {}; return this.name != null && (e.name = this.name), this.format != null && (e.format = this.format), e; } serialize(t) { let n = t || new e.BinaryWriter(); if (this.name.length && n.writeString(1, this.name), this.format.length && n.writeString(2, this.format), !t) return n.getResultBuffer(); } static deserialize(t) { let n = t instanceof e.BinaryReader ? t : new e.BinaryReader(t), r = new i(); for (; n.nextField() && !n.isEndGroup();) switch (n.getFieldNumber()) { case 1: r.name = n.readString(); break; case 2: r.format = n.readString(); break; default: n.skipField(); } return r; } serializeBinary() { return this.serialize(); } static deserializeBinary(e) { return i.deserialize(e); } } t.PolyfillType = i; class a extends e.Message { #e = []; constructor(t) { super(), e.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 e.Message.getFieldWithDefault(this, 1, ""); } set text(t) { e.Message.setField(this, 1, t); } get name() { return e.Message.getFieldWithDefault(this, 2, ""); } set name(t) { e.Message.setField(this, 2, t); } static fromObject(e) { let t = new a({}); return e.text != null && (t.text = e.text), e.name != null && (t.name = e.name), t; } toObject() { let e = {}; return this.text != null && (e.text = this.text), this.name != null && (e.name = this.name), e; } serialize(t) { let n = t || new e.BinaryWriter(); if (this.text.length && n.writeString(1, this.text), this.name.length && n.writeString(2, this.name), !t) return n.getResultBuffer(); } static deserialize(t) { let n = t instanceof e.BinaryReader ? t : new e.BinaryReader(t), r = new a(); for (; n.nextField() && !n.isEndGroup();) switch (n.getFieldNumber()) { case 1: r.text = n.readString(); break; case 2: r.name = n.readString(); break; default: n.skipField(); } return r; } serializeBinary() { return this.serialize(); } static deserializeBinary(e) { return a.deserialize(e); } } t.PreviewImage = a; })(n ||= t.InputTemplate ||= {}); class r extends e.Message { #e = [[3]]; constructor(t) { super(), e.Message.initialize(this, Array.isArray(t) ? t : [], 0, -1, [], this.#e), !Array.isArray(t) && typeof t == "object" && ("event" in t && t.event != null && (this.event = t.event), "message" in t && t.message != null && (this.message = t.message), "data" in t && t.data != null && (this.data = t.data)); } get event() { return e.Message.getFieldWithDefault(this, 1, 0); } set event(t) { e.Message.setField(this, 1, t); } get message() { return e.Message.getFieldWithDefault(this, 2, ""); } set message(t) { e.Message.setField(this, 2, t); } get data() { return e.Message.getFieldWithDefault(this, 3, new Uint8Array()); } set data(t) { e.Message.setOneofField(this, 3, this.#e[0], t); } get hasData() { return e.Message.getField(this, 3) != null; } get _data() { return { 0: "none", 3: "data" }[e.Message.computeOneofCase(this, [3])]; } static fromObject(e) { let t = new r({}); return e.event != null && (t.event = e.event), e.message != null && (t.message = e.message), e.data != null && (t.data = e.data), t; } toObject() { let 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(t) { let n = t || new e.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), !t) return n.getResultBuffer(); } static deserialize(t) { let n = t instanceof e.BinaryReader ? t : new e.BinaryReader(t), i = new r(); for (; n.nextField() && !n.isEndGroup();) switch (n.getFieldNumber()) { case 1: i.event = n.readEnum(); break; case 2: i.message = n.readString(); break; case 3: i.data = n.readBytes(); break; default: n.skipField(); } return i; } serializeBinary() { return this.serialize(); } static deserializeBinary(e) { return r.deserialize(e); } } t.EventMessage = r; class i extends e.Message { #e = []; constructor(t) { super(), e.Message.initialize(this, Array.isArray(t) ? t : [], 0, -1, [1], this.#e), !Array.isArray(t) && typeof t == "object" && "messages" in t && t.messages != null && (this.messages = t.messages); } get messages() { return e.Message.getRepeatedWrapperField(this, r, 1); } set messages(t) { e.Message.setRepeatedWrapperField(this, 1, t); } static fromObject(e) { let t = new i({}); return e.messages != null && (t.messages = e.messages.map((e) => r.fromObject(e))), t; } toObject() { let e = {}; return this.messages != null && (e.messages = this.messages.map((e) => e.toObject())), e; } serialize(t) { let n = t || new e.BinaryWriter(); if (this.messages.length && n.writeRepeatedMessage(1, this.messages, (e) => e.serialize(n)), !t) return n.getResultBuffer(); } static deserialize(t) { let n = t instanceof e.BinaryReader ? t : new e.BinaryReader(t), a = new i(); for (; n.nextField() && !n.isEndGroup();) switch (n.getFieldNumber()) { case 1: n.readMessage(a.messages, () => e.Message.addToRepeatedWrapperField(a, 1, r.deserialize(n), r)); break; default: n.skipField(); } return a; } serializeBinary() { return this.serialize(); } static deserializeBinary(e) { return i.deserialize(e); } } t.MultiMessages = i; class a extends e.Message { #e = []; constructor(t) { super(), e.Message.initialize(this, Array.isArray(t) ? t : [], 0, -1, [25, 26], this.#e), !Array.isArray(t) && typeof t == "object" && ("version" in t && t.version != null && (this.version = t.version), "css" in t && t.css != null && (this.css = t.css), "platform" in t && t.platform != null && (this.platform = t.platform), "bundleMessage" in t && t.bundleMessage != null && (this.bundleMessage = t.bundleMessage), "nameTable" in t && t.nameTable != null && (this.nameTable = t.nameTable), "subsetDetail" in t && t.subsetDetail != null && (this.subsetDetail = t.subsetDetail)); } get version() { return e.Message.getFieldWithDefault(this, 1, ""); } set version(t) { e.Message.setField(this, 1, t); } get css() { return e.Message.getWrapperField(this, a.Css, 2); } set css(t) { e.Message.setWrapperField(this, 2, t); } get hasCss() { return e.Message.getField(this, 2) != null; } get platform() { return e.Message.getFieldWithDefault(this, 3, ""); } set platform(t) { e.Message.setField(this, 3, t); } get bundleMessage() { return e.Message.getWrapperField(this, a.BundleMessage, 24); } set bundleMessage(t) { e.Message.setWrapperField(this, 24, t); } get hasBundleMessage() { return e.Message.getField(this, 24) != null; } get nameTable() { return e.Message.getRepeatedWrapperField(this, a.NameTable, 25); } set nameTable(t) { e.Message.setRepeatedWrapperField(this, 25, t); } get subsetDetail() { return e.Message.getRepeatedWrapperField(this, a.SubsetDetail, 26); } set subsetDetail(t) { e.Message.setRepeatedWrapperField(this, 26, t); } static fromObject(e) { let t = new a({}); return e.version != null && (t.version = e.version), e.css != null && (t.css = a.Css.fromObject(e.css)), e.platform != null && (t.platform = e.platform), e.bundleMessage != null && (t.bundleMessage = a.BundleMessage.fromObject(e.bundleMessage)), e.nameTable != null && (t.nameTable = e.nameTable.map((e) => a.NameTable.fromObject(e))), e.subsetDetail != null && (t.subsetDetail = e.subsetDetail.map((e) => a.SubsetDetail.fromObject(e))), t; } toObject() { let 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((e) => e.toObject())), this.subsetDetail != null && (e.subsetDetail = this.subsetDetail.map((e) => e.toObject())), e; } serialize(t) { let n = t || new e.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, (e) => e.serialize(n)), this.subsetDetail.length && n.writeRepeatedMessage(26, this.subsetDetail, (e) => e.serialize(n)), !t) return n.getResultBuffer(); } static deserialize(t) { let n = t instanceof e.BinaryReader ? t : new e.BinaryReader(t), r = new a(); for (; n.nextField() && !n.isEndGroup();) switch (n.getFieldNumber()) { case 1: r.version = n.readString(); break; case 2: n.readMessage(r.css, () => r.css = a.Css.deserialize(n)); break; case 3: r.platform = n.readString(); break; case 24: n.readMessage(r.bundleMessage, () => r.bundleMessage = a.BundleMessage.deserialize(n)); break; case 25: n.readMessage(r.nameTable, () => e.Message.addToRepeatedWrapperField(r, 25, a.NameTable.deserialize(n), a.NameTable)); break; case 26: n.readMessage(r.subsetDetail, () => e.Message.addToRepeatedWrapperField(r, 26, a.SubsetDetail.deserialize(n), a.SubsetDetail)); break; default: n.skipField(); } return r; } serializeBinary() { return this.serialize(); } static deserializeBinary(e) { return a.deserialize(e); } } t.OutputReport = a, (function(t) { class n extends e.Message { #e = []; constructor(t) { super(), e.Message.initialize(this, Array.isArray(t) ? t : [], 0, -1, [], this.#e), !Array.isArray(t) && typeof t == "object" && ("platform" in t && t.platform != null && (this.platform = t.platform), "language" in t && t.language != null && (this.language = t.language), "name" in t && t.name != null && (this.name = t.name), "value" in t && t.value != null && (this.value = t.value)); } get platform() { return e.Message.getFieldWithDefault(this, 1, ""); } set platform(t) { e.Message.setField(this, 1, t); } get language() { return e.Message.getFieldWithDefault(this, 2, ""); } set language(t) { e.Message.setField(this, 2, t); } get name() { return e.Message.getFieldWithDefault(this, 3, ""); } set name(t) { e.Message.setField(this, 3, t); } get value() { return e.Message.getFieldWithDefault(this, 4, ""); } set value(t) { e.Message.setField(this, 4, t); } static fromObject(e) { let t = new n({}); return e.platform != null && (t.platform = e.platform), e.language != null && (t.language = e.language), e.name != null && (t.name = e.name), e.value != null && (t.value = e.value), t; } toObject() { let e = {}; return this.platform != null && (e.platform = this.platform), this.language != null && (e.language = this.language), this.name != null && (e.name = this.name), this.value != null && (e.value = this.value), e; } serialize(t) { let n = t || new e.BinaryWriter(); if (this.platform.length && n.writeString(1, this.platform), this.language.length && n.writeString(2, this.language), this.name.length && n.writeString(3, this.name), this.value.length && n.writeString(4, this.value), !t) return n.getResultBuffer(); } static deserialize(t) { let r = t instanceof e.BinaryReader ? t : new e.BinaryReader(t), i = new n(); for (; r.nextField() && !r.isEndGroup();) switch (r.getFieldNumber()) { case 1: i.platform = r.readString(); break; case 2: i.language = r.readString(); break; case 3: i.name = r.readString(); break; case 4: i.value = r.readString(); break; default: r.skipField(); } return i; } serializeBinary() { return this.serialize(); } static deserializeBinary(e) { return n.deserialize(e); } } t.NameTable = n; class r extends e.Message { #e = []; constructor(t) { super(), e.Message.initialize(this, Array.isArray(t) ? t : [], 0, -1, [4], this.#e), !Array.isArray(t) && typeof t == "object" && ("id" in t && t.id != null && (this.id = t.id), "hash" in t && t.hash != null && (this.hash = t.hash), "fileName" in t && t.fileName != null && (this.fileName = t.fileName), "bytes" in t && t.bytes != null && (this.bytes = t.bytes), "chars" in t && t.chars != null && (this.chars = t.chars), "duration" in t && t.duration != null && (this.duration = t.duration)); } get id() { return e.Message.getFieldWithDefault(this, 1, 0); } set id(t) { e.Message.setField(this, 1, t); } get hash() { return e.Message.getFieldWithDefault(this, 2, ""); } set hash(t) { e.Message.setField(this, 2, t); } get fileName() { return e.Message.getFieldWithDefault(this, 6, ""); } set fileName(t) { e.Message.setField(this, 6, t); } get bytes() { return e.Message.getFieldWithDefault(this, 3, 0); } set bytes(t) { e.Message.setField(this, 3, t); } get chars() { return e.Message.getFieldWithDefault(this, 4, []); } set chars(t) { e.Message.setField(this, 4, t); } get duration() { return e.Message.getFieldWithDefault(this, 5, 0); } set duration(t) { e.Message.setField(this, 5, t); } static fromObject(e) { let t = new r({}); return e.id != null && (t.id = e.id), e.hash != null && (t.hash = e.hash), e.fileName != null && (t.fileName = e.fileName), e.bytes != null && (t.bytes = e.bytes), e.chars != null && (t.chars = e.chars), e.duration != null && (t.duration = e.duration), t; } toObject() { let e = {}; return this.id != null && (e.id = this.id), this.hash != null && (e.hash = this.hash), this.fileName != null && (e.fileName = this.fileName), this.bytes != null && (e.bytes = this.bytes), this.chars != null && (e.chars = this.chars), this.duration != null && (e.duration = this.duration), e; } serialize(t) { let n = t || new e.BinaryWriter(); if (this.id != 0 && n.writeUint32(1, this.id), this.hash.length && n.writeString(2, this.hash), this.fileName.length && n.writeString(6, this.fileName), this.bytes != 0 && n.writeUint32(3, this.bytes), this.chars.length && n.writePackedUint32(4, this.chars), this.duration != 0 && n.writeUint32(5, this.duration), !t) return n.getResultBuffer(); } static deserialize(t) { let n = t instanceof e.BinaryReader ? t : new e.BinaryReader(t), i = new r(); for (; n.nextField() && !n.isEndGroup();) switch (n.getFieldNumber()) { case 1: i.id = n.readUint32(); break; case 2: i.hash = n.readString(); break; case 6: i.fileName = n.readString(); break; case 3: i.bytes = n.readUint32(); break; case 4: i.chars = n.readPackedUint32(); break; case 5: i.duration = n.readUint32(); break; default: n.skipField(); } return i; } serializeBinary() { return this.serialize(); } static deserializeBinary(e) { return r.deserialize(e); } } t.SubsetDetail = r; class i extends e.Message { #e = []; constructor(t) { super(), e.Message.initialize(this, Array.isArray(t) ? t : [], 0, -1, [], this.#e), !Array.isArray(t) && typeof t == "object" && ("originSize" in t && t.originSize != null && (this.originSize = t.originSize), "bundledSize" in t && t.bundledSize != null && (this.bundledSize = t.bundledSize), "originBytes" in t && t.originBytes != null && (this.originBytes = t.originBytes), "bundledBytes" in t && t.bundledBytes != null && (this.bundledBytes = t.bundledBytes)); } get originSize() { return e.Message.getFieldWithDefault(this, 1, 0); } set originSize(t) { e.Message.setField(this, 1, t); } get bundledSize() { return e.Message.getFieldWithDefault(this, 2, 0); } set bundledSize(t) { e.Message.setField(this, 2, t); } get originBytes() { return e.Message.getFieldWithDefault(this, 3, 0); } set originBytes(t) { e.Message.setField(this, 3, t); } get bundledBytes() { return e.Message.getFieldWithDefault(this, 4, 0); } set bundledBytes(t) { e.Message.setField(this, 4, t); } static fromObject(e) { let t = new i({}); return e.originSize != null && (t.originSize = e.originSize), e.bundledSize != null && (t.bundledSize = e.bundledSize), e.originBytes != null && (t.originBytes = e.originBytes), e.bundledBytes != null && (t.bundledBytes = e.bundledBytes), t; } toObject() { let e = {}; return this.originSize != null && (e.originSize = this.originSize), this.bundledSize != null && (e.bundledSize = this.bundledSize), this.originBytes != null && (e.originBytes = this.originBytes), this.bundledBytes != null && (e.bundledBytes = this.bundledBytes), e; } serialize(t) { let n = t || new e.BinaryWriter(); if (this.originSize != 0 && n.writeUint32(1, this.originSize), this.bundledSize != 0 && n.writeUint32(2, this.bundledSize), this.originBytes != 0 && n.writeUint32(3, this.originBytes), this.bundledBytes != 0 && n.writeUint32(4, this.bundledBytes), !t) return n.getResultBuffer(); } static deserialize(t) { let n = t instanceof e.BinaryReader ? t : new e.BinaryReader(t), r = new i(); for (; n.nextField() && !n.isEndGroup();) switch (n.getFieldNumber()) { case 1: r.originSize = n.readUint32(); break; case 2: r.bundledSize = n.readUint32(); break; case 3: r.originBytes = n.readUint32(); break; case 4: r.bundledBytes = n.readUint32(); break; default: n.skipField(); } return r; } serializeBinary() { return this.serialize(); } static deserializeBinary(e) { return i.deserialize(e); } } t.BundleMessage = i; class a extends e.Message { #e = []; constructor(t) { super(), e.Message.initialize(this, Array.isArray(t) ? t : [], 0, -1, [], this.#e), !Array.isArray(t) && typeof t == "object" && ("family" in t && t.family != null && (this.family = t.family), "style" in t && t.style != null && (this.style = t.style), "weight" in t && t.weight != null && (this.weight = t.weight), "display" in t && t.display != null && (this.display = t.display)); } get family() { return e.Message.getFieldWithDefault(this, 1, ""); } set family(t) { e.Message.setField(this, 1, t); } get style() { return e.Message.getFieldWithDefault(this, 2, ""); } set style(t) { e.Message.setField(this, 2, t); } get weight() { return e.Message.getFieldWithDefault(this, 3, ""); } set weight(t) { e.Message.setField(this, 3, t); } get display() { return e.Message.getFieldWithDefault(this, 4, ""); } set display(t) { e.Message.setField(this, 4, t); } static fromObject(e) { let t = new a({}); return e.family != null && (t.family = e.family), e.style != null && (t.style = e.style), e.weight != null && (t.weight = e.weight), e.display != null && (t.display = e.display), t; } toObject() { let e = {}; return this.family != null && (e.family = this.family), this.style != null && (e.style = this.style), this.weight != null && (e.weight = this.weight), this.display != null && (e.display = this.display), e; } serialize(t) { let n = t || new e.BinaryWriter(); if (this.family.length && n.writeString(1, this.family), this.style.length && n.writeString(2, this.style), this.weight.length && n.writeString(3, this.weight), this.display.length && n.writeString(4, this.display), !t) return n.getResultBuffer(); } static deserialize(t) { let n = t instanceof e.BinaryReader ? t : new e.BinaryReader(t), r = new a(); for (; n.nextField() && !n.isEndGroup();) switch (n.getFieldNumber()) { case 1: r.family = n.readString(); break; case 2: r.style = n.readString(); break; case 3: r.weight = n.readString(); break; case 4: r.display = n.readString(); break; default: n.skipField(); } return r; } serializeBinary() { return this.serialize(); } static deserializeBinary(e) { return a.deserialize(e); } } t.Css = a; })(a ||= t.OutputReport ||= {}); })(t ||= {}); //#endregion export { t as api_interface }; //# sourceMappingURL=index.mjs.map