@superdoc-dev/mcp 0.11.0-next.12 → 0.11.0-next.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2367 -1031
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -52211,7 +52211,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
|
|
|
52211
52211
|
emptyOptions2 = {};
|
|
52212
52212
|
});
|
|
52213
52213
|
|
|
52214
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
52214
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-BVWG4qnQ.es.js
|
|
52215
52215
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
52216
52216
|
const fieldValue = extension$1.config[field];
|
|
52217
52217
|
if (typeof fieldValue === "function")
|
|
@@ -86325,6 +86325,315 @@ function translateMark(mark) {
|
|
|
86325
86325
|
}
|
|
86326
86326
|
return markElement;
|
|
86327
86327
|
}
|
|
86328
|
+
function isSettled(status) {
|
|
86329
|
+
return SETTLED_STATUSES.includes(status);
|
|
86330
|
+
}
|
|
86331
|
+
function normalizeFamilyKey$1(family$1) {
|
|
86332
|
+
return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
86333
|
+
}
|
|
86334
|
+
function sortPairs(pairs) {
|
|
86335
|
+
return pairs.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
86336
|
+
}
|
|
86337
|
+
function deriveBundledSubstitutes() {
|
|
86338
|
+
const substitutes = {};
|
|
86339
|
+
for (const row of SUBSTITUTION_EVIDENCE)
|
|
86340
|
+
if (row.policyAction === "substitute" && row.physicalFamily)
|
|
86341
|
+
substitutes[normalizeFamilyKey$1(row.logicalFamily)] = row.physicalFamily;
|
|
86342
|
+
return Object.freeze(substitutes);
|
|
86343
|
+
}
|
|
86344
|
+
function deriveCategoryFallbacks() {
|
|
86345
|
+
const fallbacks = {};
|
|
86346
|
+
for (const row of SUBSTITUTION_EVIDENCE)
|
|
86347
|
+
if (row.policyAction === "category_fallback" && row.physicalFamily)
|
|
86348
|
+
fallbacks[normalizeFamilyKey$1(row.logicalFamily)] = row.physicalFamily;
|
|
86349
|
+
return Object.freeze(fallbacks);
|
|
86350
|
+
}
|
|
86351
|
+
function stripFamilyQuotes(family$1) {
|
|
86352
|
+
return family$1.trim().replace(/^["']|["']$/g, "");
|
|
86353
|
+
}
|
|
86354
|
+
function splitStack(cssFontFamily) {
|
|
86355
|
+
return cssFontFamily.split(",").map((part) => part.trim()).filter(Boolean);
|
|
86356
|
+
}
|
|
86357
|
+
function createFontResolver() {
|
|
86358
|
+
return new FontResolver;
|
|
86359
|
+
}
|
|
86360
|
+
function resolveFontFamily(logicalFamily) {
|
|
86361
|
+
return defaultResolver.resolveFontFamily(logicalFamily);
|
|
86362
|
+
}
|
|
86363
|
+
function resolvePhysicalFamily(cssFontFamily) {
|
|
86364
|
+
return defaultResolver.resolvePhysicalFamily(cssFontFamily);
|
|
86365
|
+
}
|
|
86366
|
+
function resolveFace(logicalFamily, face, hasFace) {
|
|
86367
|
+
return defaultResolver.resolveFace(logicalFamily, face, hasFace);
|
|
86368
|
+
}
|
|
86369
|
+
function getFontConfigVersion() {
|
|
86370
|
+
return fontConfigVersion;
|
|
86371
|
+
}
|
|
86372
|
+
function bumpFontConfigVersion() {
|
|
86373
|
+
return fontConfigVersion += 1;
|
|
86374
|
+
}
|
|
86375
|
+
function fourFaces(filePrefix) {
|
|
86376
|
+
return [
|
|
86377
|
+
{
|
|
86378
|
+
weight: "normal",
|
|
86379
|
+
style: "normal",
|
|
86380
|
+
file: `${filePrefix}-Regular.woff2`
|
|
86381
|
+
},
|
|
86382
|
+
{
|
|
86383
|
+
weight: "bold",
|
|
86384
|
+
style: "normal",
|
|
86385
|
+
file: `${filePrefix}-Bold.woff2`
|
|
86386
|
+
},
|
|
86387
|
+
{
|
|
86388
|
+
weight: "normal",
|
|
86389
|
+
style: "italic",
|
|
86390
|
+
file: `${filePrefix}-Italic.woff2`
|
|
86391
|
+
},
|
|
86392
|
+
{
|
|
86393
|
+
weight: "bold",
|
|
86394
|
+
style: "italic",
|
|
86395
|
+
file: `${filePrefix}-BoldItalic.woff2`
|
|
86396
|
+
}
|
|
86397
|
+
];
|
|
86398
|
+
}
|
|
86399
|
+
function family(name, filePrefix, license) {
|
|
86400
|
+
return {
|
|
86401
|
+
family: name,
|
|
86402
|
+
license,
|
|
86403
|
+
faces: fourFaces(filePrefix)
|
|
86404
|
+
};
|
|
86405
|
+
}
|
|
86406
|
+
function withTrailingSlash(base$1) {
|
|
86407
|
+
return base$1.endsWith("/") ? base$1 : `${base$1}/`;
|
|
86408
|
+
}
|
|
86409
|
+
function joinUrl(base$1, file2) {
|
|
86410
|
+
return `${withTrailingSlash(base$1)}${file2}`;
|
|
86411
|
+
}
|
|
86412
|
+
function weightToken(weight) {
|
|
86413
|
+
return weight === "bold" ? "700" : "400";
|
|
86414
|
+
}
|
|
86415
|
+
function bundledAssetSignature(resolve) {
|
|
86416
|
+
const family$1 = BUNDLED_MANIFEST[0];
|
|
86417
|
+
const face = family$1?.faces[0];
|
|
86418
|
+
if (!family$1 || !face)
|
|
86419
|
+
return "";
|
|
86420
|
+
return resolve({
|
|
86421
|
+
file: face.file,
|
|
86422
|
+
family: family$1.family,
|
|
86423
|
+
weight: weightToken(face.weight),
|
|
86424
|
+
style: face.style,
|
|
86425
|
+
source: "bundled-substitute"
|
|
86426
|
+
});
|
|
86427
|
+
}
|
|
86428
|
+
function installBundledSubstitutes(registry2, options = {}) {
|
|
86429
|
+
const resolve = options.resolveAssetUrl ?? ((context) => joinUrl(options.assetBaseUrl ?? defaultAssetBase, context.file));
|
|
86430
|
+
const signature = bundledAssetSignature(resolve);
|
|
86431
|
+
const installed = installedRegistries.get(registry2);
|
|
86432
|
+
if (installed !== undefined) {
|
|
86433
|
+
if (installed !== signature)
|
|
86434
|
+
console.warn(`[superdoc] bundled fonts are already registered for this document from "${installed}"; a later fonts config resolving to "${signature}" is ignored. Use one fonts.assetBaseUrl / fonts.resolveAssetUrl per document.`);
|
|
86435
|
+
return;
|
|
86436
|
+
}
|
|
86437
|
+
installedRegistries.set(registry2, signature);
|
|
86438
|
+
for (const family$1 of BUNDLED_MANIFEST)
|
|
86439
|
+
for (const face of family$1.faces) {
|
|
86440
|
+
const context = {
|
|
86441
|
+
file: face.file,
|
|
86442
|
+
family: family$1.family,
|
|
86443
|
+
weight: weightToken(face.weight),
|
|
86444
|
+
style: face.style,
|
|
86445
|
+
source: "bundled-substitute"
|
|
86446
|
+
};
|
|
86447
|
+
registry2.register({
|
|
86448
|
+
family: family$1.family,
|
|
86449
|
+
source: `url(${resolve(context)})`,
|
|
86450
|
+
descriptors: {
|
|
86451
|
+
weight: face.weight,
|
|
86452
|
+
style: face.style
|
|
86453
|
+
}
|
|
86454
|
+
});
|
|
86455
|
+
}
|
|
86456
|
+
}
|
|
86457
|
+
function buildFontReport(logicalFamilies, registry2, resolver$1) {
|
|
86458
|
+
const seen = /* @__PURE__ */ new Set;
|
|
86459
|
+
const report = [];
|
|
86460
|
+
for (const logical of logicalFamilies) {
|
|
86461
|
+
if (!logical || seen.has(logical))
|
|
86462
|
+
continue;
|
|
86463
|
+
seen.add(logical);
|
|
86464
|
+
const { physicalFamily, reason } = resolver$1 ? resolver$1.resolveFontFamily(logical) : resolveFontFamily(logical);
|
|
86465
|
+
const loadStatus = registry2.getStatus(physicalFamily);
|
|
86466
|
+
report.push({
|
|
86467
|
+
logicalFamily: logical,
|
|
86468
|
+
physicalFamily,
|
|
86469
|
+
reason,
|
|
86470
|
+
loadStatus,
|
|
86471
|
+
exportFamily: logical,
|
|
86472
|
+
missing: reason === "category_fallback" || isSettled(loadStatus) && loadStatus !== "loaded"
|
|
86473
|
+
});
|
|
86474
|
+
}
|
|
86475
|
+
return report;
|
|
86476
|
+
}
|
|
86477
|
+
function buildFaceReport(usedFaces, registry2, resolver$1) {
|
|
86478
|
+
const hasFace = (family$1, weight, style) => registry2.hasFace(family$1, weight, style);
|
|
86479
|
+
const seen = /* @__PURE__ */ new Set;
|
|
86480
|
+
const report = [];
|
|
86481
|
+
for (const { logicalFamily, weight, style } of usedFaces) {
|
|
86482
|
+
if (!logicalFamily)
|
|
86483
|
+
continue;
|
|
86484
|
+
const key = `${logicalFamily.toLowerCase()}|${weight}|${style}`;
|
|
86485
|
+
if (seen.has(key))
|
|
86486
|
+
continue;
|
|
86487
|
+
seen.add(key);
|
|
86488
|
+
const face = {
|
|
86489
|
+
weight,
|
|
86490
|
+
style
|
|
86491
|
+
};
|
|
86492
|
+
const { physicalFamily, reason } = resolver$1 ? resolver$1.resolveFace(logicalFamily, face, hasFace) : resolveFace(logicalFamily, face, hasFace);
|
|
86493
|
+
const loadStatus = registry2.getFaceStatus({
|
|
86494
|
+
family: physicalFamily,
|
|
86495
|
+
weight,
|
|
86496
|
+
style
|
|
86497
|
+
});
|
|
86498
|
+
const missing = reason === "fallback_face_absent" || reason === "category_fallback" || isSettled(loadStatus) && loadStatus !== "loaded";
|
|
86499
|
+
report.push({
|
|
86500
|
+
logicalFamily,
|
|
86501
|
+
physicalFamily: reason === "registered_face" ? logicalFamily : physicalFamily,
|
|
86502
|
+
reason,
|
|
86503
|
+
loadStatus,
|
|
86504
|
+
exportFamily: logicalFamily,
|
|
86505
|
+
missing,
|
|
86506
|
+
face
|
|
86507
|
+
});
|
|
86508
|
+
}
|
|
86509
|
+
return report;
|
|
86510
|
+
}
|
|
86511
|
+
function parseEmbeddingPolicy(bytes) {
|
|
86512
|
+
const view = bytes instanceof ArrayBuffer ? new DataView(bytes) : new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
86513
|
+
if (view.byteLength < SFNT_TABLE_DIR_OFFSET)
|
|
86514
|
+
return null;
|
|
86515
|
+
const numTables = view.getUint16(4);
|
|
86516
|
+
let os2Offset = -1;
|
|
86517
|
+
for (let i$1 = 0;i$1 < numTables; i$1 += 1) {
|
|
86518
|
+
const record3 = SFNT_TABLE_DIR_OFFSET + i$1 * SFNT_TABLE_RECORD_SIZE;
|
|
86519
|
+
if (record3 + SFNT_TABLE_RECORD_SIZE > view.byteLength)
|
|
86520
|
+
return null;
|
|
86521
|
+
if (String.fromCharCode(view.getUint8(record3), view.getUint8(record3 + 1), view.getUint8(record3 + 2), view.getUint8(record3 + 3)) === "OS/2") {
|
|
86522
|
+
os2Offset = view.getUint32(record3 + 8);
|
|
86523
|
+
break;
|
|
86524
|
+
}
|
|
86525
|
+
}
|
|
86526
|
+
if (os2Offset < 0 || os2Offset + OS2_MIN_LENGTH > view.byteLength)
|
|
86527
|
+
return null;
|
|
86528
|
+
const usWeightClass = view.getUint16(os2Offset + OS2_USWEIGHTCLASS);
|
|
86529
|
+
const fsType = view.getUint16(os2Offset + OS2_FSTYPE);
|
|
86530
|
+
const fsSelection = view.getUint16(os2Offset + OS2_FSSELECTION);
|
|
86531
|
+
return {
|
|
86532
|
+
fsType,
|
|
86533
|
+
face: {
|
|
86534
|
+
weight: usWeightClass >= BOLD_WEIGHT_THRESHOLD ? "700" : "400",
|
|
86535
|
+
style: (fsSelection & FS_SELECTION_ITALIC) !== 0 ? "italic" : "normal"
|
|
86536
|
+
},
|
|
86537
|
+
embeddable: (fsType & FS_TYPE_RESTRICTED) === 0
|
|
86538
|
+
};
|
|
86539
|
+
}
|
|
86540
|
+
function quoteFamily(family$1) {
|
|
86541
|
+
return `"${family$1.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
86542
|
+
}
|
|
86543
|
+
function canonicalizeFontSource(source) {
|
|
86544
|
+
const match = /^\s*url\(\s*([\s\S]*?)\s*\)\s*$/i.exec(source);
|
|
86545
|
+
if (!match)
|
|
86546
|
+
return source;
|
|
86547
|
+
let inner = match[1].trim();
|
|
86548
|
+
if (inner.startsWith('"') && inner.endsWith('"') || inner.startsWith("'") && inner.endsWith("'"))
|
|
86549
|
+
inner = inner.slice(1, -1);
|
|
86550
|
+
return `url(${JSON.stringify(inner)})`;
|
|
86551
|
+
}
|
|
86552
|
+
function normalizeFamilyKey(family$1) {
|
|
86553
|
+
return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
86554
|
+
}
|
|
86555
|
+
function normalizeWeight(weight) {
|
|
86556
|
+
if (weight === undefined)
|
|
86557
|
+
return "400";
|
|
86558
|
+
const w = String(weight).trim().toLowerCase();
|
|
86559
|
+
if (w === "bold" || w === "bolder")
|
|
86560
|
+
return "700";
|
|
86561
|
+
const n = Number(w);
|
|
86562
|
+
return Number.isFinite(n) && n >= 600 ? "700" : "400";
|
|
86563
|
+
}
|
|
86564
|
+
function normalizeStyle(style) {
|
|
86565
|
+
if (!style)
|
|
86566
|
+
return "normal";
|
|
86567
|
+
const s = style.trim().toLowerCase();
|
|
86568
|
+
return s.startsWith("italic") || s.startsWith("oblique") ? "italic" : "normal";
|
|
86569
|
+
}
|
|
86570
|
+
function faceKeyOf(family$1, weight, style) {
|
|
86571
|
+
return `${normalizeFamilyKey(family$1)}|${weight}|${style}`;
|
|
86572
|
+
}
|
|
86573
|
+
function faceProbe(family$1, weight, style, size) {
|
|
86574
|
+
return `${style === "italic" ? "italic " : ""}${weight} ${size} ${quoteFamily(family$1)}`;
|
|
86575
|
+
}
|
|
86576
|
+
function getFontRegistryFor(fontSet, FontFaceCtor) {
|
|
86577
|
+
if (!fontSet) {
|
|
86578
|
+
if (!domlessRegistry)
|
|
86579
|
+
domlessRegistry = new FontRegistry({});
|
|
86580
|
+
return domlessRegistry;
|
|
86581
|
+
}
|
|
86582
|
+
let registry2 = registriesByFontSet.get(fontSet);
|
|
86583
|
+
if (!registry2) {
|
|
86584
|
+
registry2 = new FontRegistry({
|
|
86585
|
+
fontSet,
|
|
86586
|
+
FontFaceCtor
|
|
86587
|
+
});
|
|
86588
|
+
registriesByFontSet.set(fontSet, registry2);
|
|
86589
|
+
}
|
|
86590
|
+
return registry2;
|
|
86591
|
+
}
|
|
86592
|
+
function classifyOffering(policyAction, verdict, physicalFamily, bundled) {
|
|
86593
|
+
if (policyAction === "preserve_only")
|
|
86594
|
+
return "preserve_only";
|
|
86595
|
+
if (policyAction === "customer_supplied" || physicalFamily == null)
|
|
86596
|
+
return "customer_supplied";
|
|
86597
|
+
if (policyAction === "category_fallback")
|
|
86598
|
+
return "category_fallback";
|
|
86599
|
+
if (!bundled)
|
|
86600
|
+
return "requires_asset";
|
|
86601
|
+
return verdict === "metric_safe" ? "default" : "qualified";
|
|
86602
|
+
}
|
|
86603
|
+
function deriveOfferings() {
|
|
86604
|
+
const offerings = SUBSTITUTION_EVIDENCE.map((row) => {
|
|
86605
|
+
const bundled = row.physicalFamily != null && BUNDLED_FAMILIES.has(row.physicalFamily);
|
|
86606
|
+
return {
|
|
86607
|
+
logicalFamily: row.logicalFamily,
|
|
86608
|
+
physicalFamily: row.physicalFamily,
|
|
86609
|
+
generic: row.physicalFamily && PHYSICAL_GENERIC[row.physicalFamily] || "sans-serif",
|
|
86610
|
+
offering: classifyOffering(row.policyAction, row.verdict, row.physicalFamily, bundled),
|
|
86611
|
+
bundled,
|
|
86612
|
+
verdict: row.verdict,
|
|
86613
|
+
evidenceId: row.evidenceId
|
|
86614
|
+
};
|
|
86615
|
+
});
|
|
86616
|
+
return Object.freeze(offerings);
|
|
86617
|
+
}
|
|
86618
|
+
function getDefaultFontOfferings() {
|
|
86619
|
+
const rank$1 = (name) => {
|
|
86620
|
+
const i$1 = DEFAULT_FONT_ORDER.indexOf(name);
|
|
86621
|
+
return i$1 === -1 ? DEFAULT_FONT_ORDER.length : i$1;
|
|
86622
|
+
};
|
|
86623
|
+
return FONT_OFFERINGS.filter((o) => o.offering === "default").sort((a, b) => rank$1(a.logicalFamily) - rank$1(b.logicalFamily));
|
|
86624
|
+
}
|
|
86625
|
+
function fontOfferingStack(offering) {
|
|
86626
|
+
return `${offering.logicalFamily}, ${offering.generic}`;
|
|
86627
|
+
}
|
|
86628
|
+
function fontOfferingRenderStack(offering) {
|
|
86629
|
+
return offering.physicalFamily ? `${offering.physicalFamily}, ${offering.generic}` : fontOfferingStack(offering);
|
|
86630
|
+
}
|
|
86631
|
+
function getDefaultFontFamilyOptions() {
|
|
86632
|
+
return getDefaultFontOfferings().map((offering) => ({
|
|
86633
|
+
label: offering.logicalFamily,
|
|
86634
|
+
value: fontOfferingStack(offering)
|
|
86635
|
+
}));
|
|
86636
|
+
}
|
|
86328
86637
|
function writeAppStatistics(convertedXml, stats) {
|
|
86329
86638
|
const elements = ensureElements$1(ensureAppPropertiesRoot(convertedXml));
|
|
86330
86639
|
upsertSimpleElement(elements, "Words", String(stats.words));
|
|
@@ -98749,7 +99058,7 @@ var isRegExp = (value) => {
|
|
|
98749
99058
|
if (encodedAttrs && Object.keys(encodedAttrs).length > 0)
|
|
98750
99059
|
translated.attrs = { ...encodedAttrs };
|
|
98751
99060
|
return translated;
|
|
98752
|
-
}, config$35, translator$4, EAST_ASIAN_CHARACTER_REGEX, containsEastAsianCharacters = (text$2) => EAST_ASIAN_CHARACTER_REGEX.test(text$2), resolveFontFamily = (textStyleAttrs, text$2) => {
|
|
99061
|
+
}, config$35, translator$4, EAST_ASIAN_CHARACTER_REGEX, containsEastAsianCharacters = (text$2) => EAST_ASIAN_CHARACTER_REGEX.test(text$2), resolveFontFamily$1 = (textStyleAttrs, text$2) => {
|
|
98753
99062
|
if (!text$2)
|
|
98754
99063
|
return textStyleAttrs;
|
|
98755
99064
|
const eastAsiaFont = textStyleAttrs?.eastAsiaFontFamily;
|
|
@@ -99562,7 +99871,7 @@ var isRegExp = (value) => {
|
|
|
99562
99871
|
...textStyleMark.attrs || {},
|
|
99563
99872
|
...mark.attrs || {}
|
|
99564
99873
|
};
|
|
99565
|
-
textStyleMark.attrs = resolveFontFamily(textStyleMark.attrs, child?.text);
|
|
99874
|
+
textStyleMark.attrs = resolveFontFamily$1(textStyleMark.attrs, child?.text);
|
|
99566
99875
|
}
|
|
99567
99876
|
return false;
|
|
99568
99877
|
}
|
|
@@ -113056,7 +113365,537 @@ var isRegExp = (value) => {
|
|
|
113056
113365
|
tags.push(`</${name}>`);
|
|
113057
113366
|
return tags;
|
|
113058
113367
|
}
|
|
113059
|
-
},
|
|
113368
|
+
}, SETTLED_STATUSES, SUBSTITUTION_EVIDENCE, BUNDLED_SUBSTITUTES, CATEGORY_FALLBACKS, FontResolver = class {
|
|
113369
|
+
#overrides = /* @__PURE__ */ new Map;
|
|
113370
|
+
#embedded = /* @__PURE__ */ new Map;
|
|
113371
|
+
#version = 0;
|
|
113372
|
+
#cachedSignature = null;
|
|
113373
|
+
map(logicalFamily, physicalFamily) {
|
|
113374
|
+
const key = normalizeFamilyKey$1(logicalFamily);
|
|
113375
|
+
const physical = physicalFamily?.trim();
|
|
113376
|
+
if (!key || !physical)
|
|
113377
|
+
return;
|
|
113378
|
+
if (this.#overrides.get(key) === physical)
|
|
113379
|
+
return;
|
|
113380
|
+
if (key === normalizeFamilyKey$1(physical)) {
|
|
113381
|
+
if (this.#overrides.delete(key)) {
|
|
113382
|
+
this.#version += 1;
|
|
113383
|
+
this.#cachedSignature = null;
|
|
113384
|
+
}
|
|
113385
|
+
return;
|
|
113386
|
+
}
|
|
113387
|
+
this.#overrides.set(key, physical);
|
|
113388
|
+
this.#version += 1;
|
|
113389
|
+
this.#cachedSignature = null;
|
|
113390
|
+
}
|
|
113391
|
+
unmap(logicalFamily) {
|
|
113392
|
+
if (this.#overrides.delete(normalizeFamilyKey$1(logicalFamily))) {
|
|
113393
|
+
this.#version += 1;
|
|
113394
|
+
this.#cachedSignature = null;
|
|
113395
|
+
}
|
|
113396
|
+
}
|
|
113397
|
+
mapEmbedded(logicalFamily, physicalFamily) {
|
|
113398
|
+
const key = normalizeFamilyKey$1(logicalFamily);
|
|
113399
|
+
const physical = physicalFamily?.trim();
|
|
113400
|
+
if (!key || !physical)
|
|
113401
|
+
return;
|
|
113402
|
+
if (this.#embedded.get(key) === physical)
|
|
113403
|
+
return;
|
|
113404
|
+
this.#embedded.set(key, physical);
|
|
113405
|
+
this.#version += 1;
|
|
113406
|
+
this.#cachedSignature = null;
|
|
113407
|
+
}
|
|
113408
|
+
clearEmbedded() {
|
|
113409
|
+
if (this.#embedded.size === 0)
|
|
113410
|
+
return;
|
|
113411
|
+
this.#embedded.clear();
|
|
113412
|
+
this.#version += 1;
|
|
113413
|
+
this.#cachedSignature = null;
|
|
113414
|
+
}
|
|
113415
|
+
reset() {
|
|
113416
|
+
if (this.#overrides.size === 0 && this.#embedded.size === 0)
|
|
113417
|
+
return;
|
|
113418
|
+
this.#overrides.clear();
|
|
113419
|
+
this.#embedded.clear();
|
|
113420
|
+
this.#version += 1;
|
|
113421
|
+
this.#cachedSignature = null;
|
|
113422
|
+
}
|
|
113423
|
+
get version() {
|
|
113424
|
+
return this.#version;
|
|
113425
|
+
}
|
|
113426
|
+
get signature() {
|
|
113427
|
+
if (this.#cachedSignature !== null)
|
|
113428
|
+
return this.#cachedSignature;
|
|
113429
|
+
if (this.#overrides.size === 0 && this.#embedded.size === 0)
|
|
113430
|
+
this.#cachedSignature = "";
|
|
113431
|
+
else {
|
|
113432
|
+
const overridePairs = sortPairs([...this.#overrides.entries()]);
|
|
113433
|
+
this.#cachedSignature = this.#embedded.size === 0 ? JSON.stringify(overridePairs) : JSON.stringify({
|
|
113434
|
+
o: overridePairs,
|
|
113435
|
+
e: sortPairs([...this.#embedded.entries()])
|
|
113436
|
+
});
|
|
113437
|
+
}
|
|
113438
|
+
return this.#cachedSignature;
|
|
113439
|
+
}
|
|
113440
|
+
#physicalFor(bareFamily) {
|
|
113441
|
+
const key = normalizeFamilyKey$1(bareFamily);
|
|
113442
|
+
const override = this.#overrides.get(key);
|
|
113443
|
+
if (override)
|
|
113444
|
+
return {
|
|
113445
|
+
physical: override,
|
|
113446
|
+
reason: "custom_mapping"
|
|
113447
|
+
};
|
|
113448
|
+
const bundled = BUNDLED_SUBSTITUTES[key];
|
|
113449
|
+
if (bundled)
|
|
113450
|
+
return {
|
|
113451
|
+
physical: bundled,
|
|
113452
|
+
reason: "bundled_substitute"
|
|
113453
|
+
};
|
|
113454
|
+
const category = CATEGORY_FALLBACKS[key];
|
|
113455
|
+
if (category)
|
|
113456
|
+
return {
|
|
113457
|
+
physical: category,
|
|
113458
|
+
reason: "category_fallback"
|
|
113459
|
+
};
|
|
113460
|
+
return {
|
|
113461
|
+
physical: bareFamily,
|
|
113462
|
+
reason: "as_requested"
|
|
113463
|
+
};
|
|
113464
|
+
}
|
|
113465
|
+
#resolveFaceLadder(primary, face, hasFace) {
|
|
113466
|
+
const key = normalizeFamilyKey$1(primary);
|
|
113467
|
+
const override = this.#overrides.get(key);
|
|
113468
|
+
if (override && hasFace(override, face.weight, face.style))
|
|
113469
|
+
return {
|
|
113470
|
+
physical: override,
|
|
113471
|
+
reason: "custom_mapping"
|
|
113472
|
+
};
|
|
113473
|
+
const embedded = this.#embedded.get(key);
|
|
113474
|
+
if (embedded && hasFace(embedded, face.weight, face.style))
|
|
113475
|
+
return {
|
|
113476
|
+
physical: embedded,
|
|
113477
|
+
reason: "registered_face"
|
|
113478
|
+
};
|
|
113479
|
+
if (hasFace(primary, face.weight, face.style))
|
|
113480
|
+
return {
|
|
113481
|
+
physical: primary,
|
|
113482
|
+
reason: "registered_face"
|
|
113483
|
+
};
|
|
113484
|
+
const bundled = BUNDLED_SUBSTITUTES[key];
|
|
113485
|
+
if (bundled && hasFace(bundled, face.weight, face.style))
|
|
113486
|
+
return {
|
|
113487
|
+
physical: bundled,
|
|
113488
|
+
reason: "bundled_substitute"
|
|
113489
|
+
};
|
|
113490
|
+
const category = CATEGORY_FALLBACKS[key];
|
|
113491
|
+
if (category && hasFace(category, face.weight, face.style))
|
|
113492
|
+
return {
|
|
113493
|
+
physical: category,
|
|
113494
|
+
reason: "category_fallback"
|
|
113495
|
+
};
|
|
113496
|
+
if (override || bundled)
|
|
113497
|
+
return {
|
|
113498
|
+
physical: primary,
|
|
113499
|
+
reason: "fallback_face_absent"
|
|
113500
|
+
};
|
|
113501
|
+
return {
|
|
113502
|
+
physical: primary,
|
|
113503
|
+
reason: "as_requested"
|
|
113504
|
+
};
|
|
113505
|
+
}
|
|
113506
|
+
resolveFontFamily(logicalFamily) {
|
|
113507
|
+
const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
|
|
113508
|
+
const { physical, reason } = this.#physicalFor(primary);
|
|
113509
|
+
return {
|
|
113510
|
+
logicalFamily,
|
|
113511
|
+
physicalFamily: stripFamilyQuotes(physical),
|
|
113512
|
+
reason
|
|
113513
|
+
};
|
|
113514
|
+
}
|
|
113515
|
+
resolvePhysicalFamily(cssFontFamily) {
|
|
113516
|
+
if (!cssFontFamily)
|
|
113517
|
+
return cssFontFamily;
|
|
113518
|
+
const parts = splitStack(cssFontFamily);
|
|
113519
|
+
if (parts.length === 0)
|
|
113520
|
+
return cssFontFamily;
|
|
113521
|
+
const { physical, reason } = this.#physicalFor(parts[0]);
|
|
113522
|
+
if (reason === "as_requested")
|
|
113523
|
+
return cssFontFamily;
|
|
113524
|
+
return [physical, ...parts.slice(1)].join(", ");
|
|
113525
|
+
}
|
|
113526
|
+
resolveFace(logicalFamily, face, hasFace) {
|
|
113527
|
+
const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
|
|
113528
|
+
const { physical, reason } = this.#resolveFaceLadder(primary, face, hasFace);
|
|
113529
|
+
return {
|
|
113530
|
+
logicalFamily,
|
|
113531
|
+
physicalFamily: stripFamilyQuotes(physical),
|
|
113532
|
+
reason
|
|
113533
|
+
};
|
|
113534
|
+
}
|
|
113535
|
+
resolvePhysicalFamilyForFace(cssFontFamily, face, hasFace) {
|
|
113536
|
+
if (!cssFontFamily)
|
|
113537
|
+
return cssFontFamily;
|
|
113538
|
+
const parts = splitStack(cssFontFamily);
|
|
113539
|
+
if (parts.length === 0)
|
|
113540
|
+
return cssFontFamily;
|
|
113541
|
+
const { physical } = this.#resolveFaceLadder(parts[0], face, hasFace);
|
|
113542
|
+
if (normalizeFamilyKey$1(physical) !== normalizeFamilyKey$1(parts[0]))
|
|
113543
|
+
return [physical, ...parts.slice(1)].join(", ");
|
|
113544
|
+
return cssFontFamily;
|
|
113545
|
+
}
|
|
113546
|
+
resolvePrimaryPhysicalFamily(family$1) {
|
|
113547
|
+
const primary = splitStack(family$1)[0] ?? family$1;
|
|
113548
|
+
return this.#physicalFor(primary).physical;
|
|
113549
|
+
}
|
|
113550
|
+
resolvePhysicalFamilies(families) {
|
|
113551
|
+
const out = /* @__PURE__ */ new Set;
|
|
113552
|
+
for (const family$1 of families)
|
|
113553
|
+
if (family$1)
|
|
113554
|
+
out.add(this.resolvePrimaryPhysicalFamily(family$1));
|
|
113555
|
+
return [...out];
|
|
113556
|
+
}
|
|
113557
|
+
}, defaultResolver, DEFAULT_FONT_MEASURE_CONTEXT, fontConfigVersion = 0, BUNDLED_MANIFEST, defaultAssetBase = "/fonts/", installedRegistries, FS_TYPE_RESTRICTED = 2, FS_SELECTION_ITALIC = 1, BOLD_WEIGHT_THRESHOLD = 600, SFNT_TABLE_DIR_OFFSET = 12, SFNT_TABLE_RECORD_SIZE = 16, OS2_USWEIGHTCLASS = 4, OS2_FSTYPE = 8, OS2_FSSELECTION = 62, OS2_MIN_LENGTH, DEFAULT_FONT_LOAD_TIMEOUT_MS = 3000, DEFAULT_PROBE_SIZE = "16px", FontRegistry = class {
|
|
113558
|
+
#fontSet;
|
|
113559
|
+
#FontFaceCtor;
|
|
113560
|
+
#probeSize;
|
|
113561
|
+
#scheduleTimeout;
|
|
113562
|
+
#cancelTimeout;
|
|
113563
|
+
#managed = /* @__PURE__ */ new Map;
|
|
113564
|
+
#facesByKey = /* @__PURE__ */ new Map;
|
|
113565
|
+
#status = /* @__PURE__ */ new Map;
|
|
113566
|
+
#sources = /* @__PURE__ */ new Map;
|
|
113567
|
+
#warnedFailures = /* @__PURE__ */ new Set;
|
|
113568
|
+
#inflight = /* @__PURE__ */ new Map;
|
|
113569
|
+
#faceStatus = /* @__PURE__ */ new Map;
|
|
113570
|
+
#faceInflight = /* @__PURE__ */ new Map;
|
|
113571
|
+
#faceSources = /* @__PURE__ */ new Map;
|
|
113572
|
+
#facesByFamily = /* @__PURE__ */ new Map;
|
|
113573
|
+
#providerFaceKeys = /* @__PURE__ */ new Set;
|
|
113574
|
+
#warnedFaceFailures = /* @__PURE__ */ new Set;
|
|
113575
|
+
constructor(options = {}) {
|
|
113576
|
+
this.#fontSet = options.fontSet ?? null;
|
|
113577
|
+
this.#FontFaceCtor = options.FontFaceCtor ?? null;
|
|
113578
|
+
this.#probeSize = options.probeSize ?? DEFAULT_PROBE_SIZE;
|
|
113579
|
+
this.#scheduleTimeout = options.scheduleTimeout ?? ((cb, ms) => globalThis.setTimeout(cb, ms));
|
|
113580
|
+
this.#cancelTimeout = options.cancelTimeout ?? ((handle2) => globalThis.clearTimeout(handle2));
|
|
113581
|
+
}
|
|
113582
|
+
register(descriptor) {
|
|
113583
|
+
const { family: family$1, source, descriptors: descriptors$1 } = descriptor;
|
|
113584
|
+
const identitySource = typeof source === "string" ? canonicalizeFontSource(source) : source;
|
|
113585
|
+
const weight = normalizeWeight(descriptors$1?.weight);
|
|
113586
|
+
const style = normalizeStyle(descriptors$1?.style);
|
|
113587
|
+
const key = faceKeyOf(family$1, weight, style);
|
|
113588
|
+
if (typeof identitySource === "string") {
|
|
113589
|
+
const existingSource = this.#faceSources.get(key);
|
|
113590
|
+
if (existingSource === identitySource)
|
|
113591
|
+
return {
|
|
113592
|
+
family: family$1,
|
|
113593
|
+
status: this.getStatus(family$1),
|
|
113594
|
+
changed: false
|
|
113595
|
+
};
|
|
113596
|
+
if (existingSource !== undefined)
|
|
113597
|
+
throw new Error(`[superdoc] font face "${key}" is already registered from a different source ("${existingSource}"); a registered face's source cannot be replaced`);
|
|
113598
|
+
}
|
|
113599
|
+
if (this.#FontFaceCtor && this.#fontSet) {
|
|
113600
|
+
const face = new this.#FontFaceCtor(family$1, source, {
|
|
113601
|
+
...descriptors$1,
|
|
113602
|
+
weight,
|
|
113603
|
+
style
|
|
113604
|
+
});
|
|
113605
|
+
this.#fontSet.add(face);
|
|
113606
|
+
this.#addManagedFace(family$1, key, face);
|
|
113607
|
+
}
|
|
113608
|
+
if (typeof source === "string") {
|
|
113609
|
+
const list$1 = this.#sources.get(family$1) ?? [];
|
|
113610
|
+
if (!list$1.includes(source))
|
|
113611
|
+
list$1.push(source);
|
|
113612
|
+
this.#sources.set(family$1, list$1);
|
|
113613
|
+
}
|
|
113614
|
+
if (!this.#status.has(family$1))
|
|
113615
|
+
this.#status.set(family$1, "unloaded");
|
|
113616
|
+
this.#providerFaceKeys.add(key);
|
|
113617
|
+
this.#trackFace(family$1, key);
|
|
113618
|
+
if (!this.#faceStatus.has(key))
|
|
113619
|
+
this.#faceStatus.set(key, "unloaded");
|
|
113620
|
+
if (typeof identitySource === "string" && !this.#faceSources.has(key))
|
|
113621
|
+
this.#faceSources.set(key, identitySource);
|
|
113622
|
+
return {
|
|
113623
|
+
family: family$1,
|
|
113624
|
+
status: this.getStatus(family$1),
|
|
113625
|
+
changed: true
|
|
113626
|
+
};
|
|
113627
|
+
}
|
|
113628
|
+
#trackFace(family$1, key) {
|
|
113629
|
+
const fam = normalizeFamilyKey(family$1);
|
|
113630
|
+
const set3 = this.#facesByFamily.get(fam) ?? /* @__PURE__ */ new Set;
|
|
113631
|
+
set3.add(key);
|
|
113632
|
+
this.#facesByFamily.set(fam, set3);
|
|
113633
|
+
}
|
|
113634
|
+
isManaged(family$1) {
|
|
113635
|
+
return this.#managed.has(family$1);
|
|
113636
|
+
}
|
|
113637
|
+
registerOwnedFace(descriptor) {
|
|
113638
|
+
const { family: family$1, source, weight, style } = descriptor;
|
|
113639
|
+
if (!this.#FontFaceCtor || !this.#fontSet)
|
|
113640
|
+
return null;
|
|
113641
|
+
const key = faceKeyOf(family$1, weight, style);
|
|
113642
|
+
const face = new this.#FontFaceCtor(family$1, source, {
|
|
113643
|
+
weight,
|
|
113644
|
+
style
|
|
113645
|
+
});
|
|
113646
|
+
this.#fontSet.add(face);
|
|
113647
|
+
this.#addManagedFace(family$1, key, face);
|
|
113648
|
+
this.#providerFaceKeys.add(key);
|
|
113649
|
+
if (!this.#status.has(family$1))
|
|
113650
|
+
this.#status.set(family$1, "unloaded");
|
|
113651
|
+
this.#trackFace(family$1, key);
|
|
113652
|
+
if (!this.#faceStatus.has(key))
|
|
113653
|
+
this.#faceStatus.set(key, "unloaded");
|
|
113654
|
+
let released = false;
|
|
113655
|
+
return () => {
|
|
113656
|
+
if (released)
|
|
113657
|
+
return false;
|
|
113658
|
+
released = true;
|
|
113659
|
+
return this.#removeManagedFace(family$1, key, face);
|
|
113660
|
+
};
|
|
113661
|
+
}
|
|
113662
|
+
#addManagedFace(family$1, key, face) {
|
|
113663
|
+
this.#managed.set(family$1, face);
|
|
113664
|
+
let set3 = this.#facesByKey.get(key);
|
|
113665
|
+
if (!set3) {
|
|
113666
|
+
set3 = /* @__PURE__ */ new Set;
|
|
113667
|
+
this.#facesByKey.set(key, set3);
|
|
113668
|
+
}
|
|
113669
|
+
set3.add(face);
|
|
113670
|
+
}
|
|
113671
|
+
#removeManagedFace(family$1, key, face) {
|
|
113672
|
+
const set3 = this.#facesByKey.get(key);
|
|
113673
|
+
if (!set3 || !set3.delete(face))
|
|
113674
|
+
return false;
|
|
113675
|
+
if (typeof this.#fontSet?.delete === "function")
|
|
113676
|
+
this.#fontSet.delete(face);
|
|
113677
|
+
if (set3.size > 0)
|
|
113678
|
+
return true;
|
|
113679
|
+
this.#facesByKey.delete(key);
|
|
113680
|
+
this.#providerFaceKeys.delete(key);
|
|
113681
|
+
this.#faceStatus.delete(key);
|
|
113682
|
+
this.#faceSources.delete(key);
|
|
113683
|
+
const fam = normalizeFamilyKey(family$1);
|
|
113684
|
+
const keys$1 = this.#facesByFamily.get(fam);
|
|
113685
|
+
if (keys$1) {
|
|
113686
|
+
keys$1.delete(key);
|
|
113687
|
+
if (keys$1.size === 0) {
|
|
113688
|
+
this.#facesByFamily.delete(fam);
|
|
113689
|
+
this.#managed.delete(family$1);
|
|
113690
|
+
this.#status.delete(family$1);
|
|
113691
|
+
this.#sources.delete(family$1);
|
|
113692
|
+
}
|
|
113693
|
+
}
|
|
113694
|
+
return true;
|
|
113695
|
+
}
|
|
113696
|
+
getStatus(family$1) {
|
|
113697
|
+
const statuses = [];
|
|
113698
|
+
const faceKeys = this.#facesByFamily.get(normalizeFamilyKey(family$1));
|
|
113699
|
+
if (faceKeys)
|
|
113700
|
+
for (const k of faceKeys)
|
|
113701
|
+
statuses.push(this.#faceStatus.get(k) ?? "unloaded");
|
|
113702
|
+
const legacy = this.#status.get(family$1);
|
|
113703
|
+
if (legacy)
|
|
113704
|
+
statuses.push(legacy);
|
|
113705
|
+
if (statuses.length === 0)
|
|
113706
|
+
return "unloaded";
|
|
113707
|
+
for (const s of [
|
|
113708
|
+
"failed",
|
|
113709
|
+
"timed_out",
|
|
113710
|
+
"fallback_used",
|
|
113711
|
+
"loaded",
|
|
113712
|
+
"loading",
|
|
113713
|
+
"unloaded"
|
|
113714
|
+
])
|
|
113715
|
+
if (statuses.includes(s))
|
|
113716
|
+
return s;
|
|
113717
|
+
return "unloaded";
|
|
113718
|
+
}
|
|
113719
|
+
hasFace(family$1, weight, style) {
|
|
113720
|
+
const key = faceKeyOf(family$1, weight, style);
|
|
113721
|
+
return this.#providerFaceKeys.has(key) && this.#faceStatus.get(key) !== "failed";
|
|
113722
|
+
}
|
|
113723
|
+
isAvailable(family$1) {
|
|
113724
|
+
if (!this.#fontSet)
|
|
113725
|
+
return false;
|
|
113726
|
+
try {
|
|
113727
|
+
return this.#fontSet.check(`${this.#probeSize} ${quoteFamily(family$1)}`);
|
|
113728
|
+
} catch {
|
|
113729
|
+
return false;
|
|
113730
|
+
}
|
|
113731
|
+
}
|
|
113732
|
+
awaitFace(family$1, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
|
|
113733
|
+
if (this.#status.get(family$1) === "loaded")
|
|
113734
|
+
return Promise.resolve({
|
|
113735
|
+
family: family$1,
|
|
113736
|
+
status: "loaded"
|
|
113737
|
+
});
|
|
113738
|
+
const existing = this.#inflight.get(family$1);
|
|
113739
|
+
if (existing)
|
|
113740
|
+
return existing;
|
|
113741
|
+
const probe = this.#loadOne(family$1, timeoutMs).finally(() => {
|
|
113742
|
+
this.#inflight.delete(family$1);
|
|
113743
|
+
});
|
|
113744
|
+
this.#inflight.set(family$1, probe);
|
|
113745
|
+
return probe;
|
|
113746
|
+
}
|
|
113747
|
+
async awaitFaces(families, options = {}) {
|
|
113748
|
+
const unique = [...new Set(families)];
|
|
113749
|
+
const timeoutMs = options.timeoutMs ?? 3000;
|
|
113750
|
+
return Promise.all(unique.map((family$1) => this.awaitFace(family$1, timeoutMs)));
|
|
113751
|
+
}
|
|
113752
|
+
getRequiredFaces(families, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
|
|
113753
|
+
return [...new Set(families)].map((family$1) => ({
|
|
113754
|
+
family: family$1,
|
|
113755
|
+
status: this.getStatus(family$1),
|
|
113756
|
+
ready: this.awaitFace(family$1, timeoutMs)
|
|
113757
|
+
}));
|
|
113758
|
+
}
|
|
113759
|
+
getStates() {
|
|
113760
|
+
return [...this.#status.entries()].map(([family$1, status]) => ({
|
|
113761
|
+
family: family$1,
|
|
113762
|
+
status
|
|
113763
|
+
}));
|
|
113764
|
+
}
|
|
113765
|
+
getFaceStatus(request) {
|
|
113766
|
+
return this.#faceStatus.get(faceKeyOf(request.family, request.weight, request.style)) ?? "unloaded";
|
|
113767
|
+
}
|
|
113768
|
+
awaitFaceRequest(request, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
|
|
113769
|
+
const key = faceKeyOf(request.family, request.weight, request.style);
|
|
113770
|
+
if (this.#faceStatus.get(key) === "loaded")
|
|
113771
|
+
return Promise.resolve({
|
|
113772
|
+
request,
|
|
113773
|
+
status: "loaded"
|
|
113774
|
+
});
|
|
113775
|
+
const existing = this.#faceInflight.get(key);
|
|
113776
|
+
if (existing)
|
|
113777
|
+
return existing;
|
|
113778
|
+
const probe = this.#loadOneFace(request, key, timeoutMs).finally(() => {
|
|
113779
|
+
this.#faceInflight.delete(key);
|
|
113780
|
+
});
|
|
113781
|
+
this.#faceInflight.set(key, probe);
|
|
113782
|
+
return probe;
|
|
113783
|
+
}
|
|
113784
|
+
async awaitFaceRequests(requests, options = {}) {
|
|
113785
|
+
const timeoutMs = options.timeoutMs ?? 3000;
|
|
113786
|
+
const seen = /* @__PURE__ */ new Set;
|
|
113787
|
+
const unique = [];
|
|
113788
|
+
for (const r of requests) {
|
|
113789
|
+
const key = faceKeyOf(r.family, r.weight, r.style);
|
|
113790
|
+
if (seen.has(key))
|
|
113791
|
+
continue;
|
|
113792
|
+
seen.add(key);
|
|
113793
|
+
unique.push(r);
|
|
113794
|
+
}
|
|
113795
|
+
return Promise.all(unique.map((r) => this.awaitFaceRequest(r, timeoutMs)));
|
|
113796
|
+
}
|
|
113797
|
+
async#loadOneFace(request, key, timeoutMs) {
|
|
113798
|
+
this.#trackFace(request.family, key);
|
|
113799
|
+
const fontSet = this.#fontSet;
|
|
113800
|
+
if (!fontSet) {
|
|
113801
|
+
this.#faceStatus.set(key, "fallback_used");
|
|
113802
|
+
return {
|
|
113803
|
+
request,
|
|
113804
|
+
status: "fallback_used"
|
|
113805
|
+
};
|
|
113806
|
+
}
|
|
113807
|
+
this.#faceStatus.set(key, "loading");
|
|
113808
|
+
const probe = faceProbe(request.family, request.weight, request.style, this.#probeSize);
|
|
113809
|
+
const TIMEOUT = Symbol("timeout");
|
|
113810
|
+
let handle2;
|
|
113811
|
+
const timeout = new Promise((resolve) => {
|
|
113812
|
+
handle2 = this.#scheduleTimeout(() => resolve(TIMEOUT), timeoutMs);
|
|
113813
|
+
});
|
|
113814
|
+
try {
|
|
113815
|
+
const settled = await Promise.race([fontSet.load(probe), timeout]);
|
|
113816
|
+
if (settled === TIMEOUT) {
|
|
113817
|
+
this.#faceStatus.set(key, "timed_out");
|
|
113818
|
+
return {
|
|
113819
|
+
request,
|
|
113820
|
+
status: "timed_out"
|
|
113821
|
+
};
|
|
113822
|
+
}
|
|
113823
|
+
const status = settled.length > 0 ? "loaded" : "fallback_used";
|
|
113824
|
+
this.#faceStatus.set(key, status);
|
|
113825
|
+
return {
|
|
113826
|
+
request,
|
|
113827
|
+
status
|
|
113828
|
+
};
|
|
113829
|
+
} catch {
|
|
113830
|
+
this.#faceStatus.set(key, "failed");
|
|
113831
|
+
this.#warnFaceFailureOnce(request, key);
|
|
113832
|
+
return {
|
|
113833
|
+
request,
|
|
113834
|
+
status: "failed"
|
|
113835
|
+
};
|
|
113836
|
+
} finally {
|
|
113837
|
+
this.#cancelTimeout(handle2);
|
|
113838
|
+
}
|
|
113839
|
+
}
|
|
113840
|
+
#warnFaceFailureOnce(request, key) {
|
|
113841
|
+
if (this.#warnedFaceFailures.has(key))
|
|
113842
|
+
return;
|
|
113843
|
+
this.#warnedFaceFailures.add(key);
|
|
113844
|
+
const src = this.#faceSources.get(key);
|
|
113845
|
+
const detail = src ? ` from ${src}` : "";
|
|
113846
|
+
console.warn(`[superdoc] font face failed to load: "${request.family}" ${request.weight} ${request.style}${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
|
|
113847
|
+
}
|
|
113848
|
+
async#loadOne(family$1, timeoutMs) {
|
|
113849
|
+
const fontSet = this.#fontSet;
|
|
113850
|
+
if (!fontSet) {
|
|
113851
|
+
this.#status.set(family$1, "fallback_used");
|
|
113852
|
+
return {
|
|
113853
|
+
family: family$1,
|
|
113854
|
+
status: "fallback_used"
|
|
113855
|
+
};
|
|
113856
|
+
}
|
|
113857
|
+
this.#status.set(family$1, "loading");
|
|
113858
|
+
const probe = `${this.#probeSize} ${quoteFamily(family$1)}`;
|
|
113859
|
+
const TIMEOUT = Symbol("timeout");
|
|
113860
|
+
let handle2;
|
|
113861
|
+
const timeout = new Promise((resolve) => {
|
|
113862
|
+
handle2 = this.#scheduleTimeout(() => resolve(TIMEOUT), timeoutMs);
|
|
113863
|
+
});
|
|
113864
|
+
try {
|
|
113865
|
+
const settled = await Promise.race([fontSet.load(probe), timeout]);
|
|
113866
|
+
if (settled === TIMEOUT) {
|
|
113867
|
+
this.#status.set(family$1, "timed_out");
|
|
113868
|
+
return {
|
|
113869
|
+
family: family$1,
|
|
113870
|
+
status: "timed_out"
|
|
113871
|
+
};
|
|
113872
|
+
}
|
|
113873
|
+
const status = settled.length > 0 ? "loaded" : "fallback_used";
|
|
113874
|
+
this.#status.set(family$1, status);
|
|
113875
|
+
return {
|
|
113876
|
+
family: family$1,
|
|
113877
|
+
status
|
|
113878
|
+
};
|
|
113879
|
+
} catch {
|
|
113880
|
+
this.#status.set(family$1, "failed");
|
|
113881
|
+
this.#warnLoadFailureOnce(family$1);
|
|
113882
|
+
return {
|
|
113883
|
+
family: family$1,
|
|
113884
|
+
status: "failed"
|
|
113885
|
+
};
|
|
113886
|
+
} finally {
|
|
113887
|
+
this.#cancelTimeout(handle2);
|
|
113888
|
+
}
|
|
113889
|
+
}
|
|
113890
|
+
#warnLoadFailureOnce(family$1) {
|
|
113891
|
+
if (this.#warnedFailures.has(family$1))
|
|
113892
|
+
return;
|
|
113893
|
+
this.#warnedFailures.add(family$1);
|
|
113894
|
+
const sources = this.#sources.get(family$1);
|
|
113895
|
+
const detail = sources && sources.length ? ` from ${sources.join(", ")}` : "";
|
|
113896
|
+
console.warn(`[superdoc] font asset failed to load for "${family$1}"${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
|
|
113897
|
+
}
|
|
113898
|
+
}, registriesByFontSet, domlessRegistry = null, PHYSICAL_GENERIC, BUNDLED_FAMILIES, FONT_OFFERINGS, DEFAULT_FONT_ORDER, prepareCommentParaIds = (comment) => {
|
|
113060
113899
|
return {
|
|
113061
113900
|
...comment,
|
|
113062
113901
|
commentParaId: generateDocxRandomId()
|
|
@@ -117032,7 +117871,7 @@ var isRegExp = (value) => {
|
|
|
117032
117871
|
state.kern = kernNode.attributes["w:val"];
|
|
117033
117872
|
}
|
|
117034
117873
|
}, SuperConverter;
|
|
117035
|
-
var
|
|
117874
|
+
var init_SuperConverter_BVWG4qnQ_es = __esm(() => {
|
|
117036
117875
|
init_rolldown_runtime_Bg48TavK_es();
|
|
117037
117876
|
init_jszip_C49i9kUs_es();
|
|
117038
117877
|
init_xml_js_CqGKpaft_es();
|
|
@@ -154351,6 +155190,246 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
154351
155190
|
gutter: "0"
|
|
154352
155191
|
})
|
|
154353
155192
|
});
|
|
155193
|
+
SETTLED_STATUSES = [
|
|
155194
|
+
"loaded",
|
|
155195
|
+
"failed",
|
|
155196
|
+
"timed_out",
|
|
155197
|
+
"fallback_used"
|
|
155198
|
+
];
|
|
155199
|
+
SUBSTITUTION_EVIDENCE = Object.freeze([
|
|
155200
|
+
{
|
|
155201
|
+
evidenceId: "calibri",
|
|
155202
|
+
logicalFamily: "Calibri",
|
|
155203
|
+
physicalFamily: "Carlito",
|
|
155204
|
+
verdict: "metric_safe",
|
|
155205
|
+
faces: {
|
|
155206
|
+
regular: true,
|
|
155207
|
+
bold: true,
|
|
155208
|
+
italic: true,
|
|
155209
|
+
boldItalic: true
|
|
155210
|
+
},
|
|
155211
|
+
advance: {
|
|
155212
|
+
meanDelta: 0,
|
|
155213
|
+
maxDelta: 0
|
|
155214
|
+
},
|
|
155215
|
+
gates: {
|
|
155216
|
+
static: "pass",
|
|
155217
|
+
metric: "pass",
|
|
155218
|
+
layout: "pass",
|
|
155219
|
+
ship: "pass"
|
|
155220
|
+
},
|
|
155221
|
+
policyAction: "substitute",
|
|
155222
|
+
measurementRefs: ["calibri__carlito#analytic_advance#2026-06-03", "calibri__carlito#face_aggregate#2026-06-03"],
|
|
155223
|
+
candidateLicense: "OFL-1.1",
|
|
155224
|
+
exportRule: "preserve_original_name"
|
|
155225
|
+
},
|
|
155226
|
+
{
|
|
155227
|
+
evidenceId: "cambria",
|
|
155228
|
+
logicalFamily: "Cambria",
|
|
155229
|
+
physicalFamily: "Caladea",
|
|
155230
|
+
verdict: "visual_only",
|
|
155231
|
+
faceVerdicts: {
|
|
155232
|
+
regular: "metric_safe",
|
|
155233
|
+
bold: "metric_safe",
|
|
155234
|
+
italic: "metric_safe",
|
|
155235
|
+
boldItalic: "visual_only"
|
|
155236
|
+
},
|
|
155237
|
+
glyphExceptions: [{
|
|
155238
|
+
slot: "boldItalic",
|
|
155239
|
+
codepoint: 96,
|
|
155240
|
+
advanceDelta: 0.231,
|
|
155241
|
+
note: "Caladea Bold Italic grave accent (U+0060) advance diverges ~23% from Cambria; lines containing it reflow."
|
|
155242
|
+
}],
|
|
155243
|
+
faces: {
|
|
155244
|
+
regular: true,
|
|
155245
|
+
bold: true,
|
|
155246
|
+
italic: true,
|
|
155247
|
+
boldItalic: true
|
|
155248
|
+
},
|
|
155249
|
+
advance: {
|
|
155250
|
+
meanDelta: 0.0002378,
|
|
155251
|
+
maxDelta: 0.2310758
|
|
155252
|
+
},
|
|
155253
|
+
gates: {
|
|
155254
|
+
static: "pass",
|
|
155255
|
+
metric: "pass",
|
|
155256
|
+
layout: "not_run",
|
|
155257
|
+
ship: "pass"
|
|
155258
|
+
},
|
|
155259
|
+
policyAction: "substitute",
|
|
155260
|
+
measurementRefs: [
|
|
155261
|
+
"cambria_regular__caladea#regular#w400#d2f6cad3#analytic_advance#2026-06-04",
|
|
155262
|
+
"cambria_bold__caladea#bold#w700#74eda4fc#analytic_advance#2026-06-04",
|
|
155263
|
+
"cambria_italic__caladea#italic#w400#9c968bf6#analytic_advance#2026-06-04",
|
|
155264
|
+
"cambria_boldItalic__caladea#boldItalic#w700#f47a35ad#analytic_advance#2026-06-04"
|
|
155265
|
+
],
|
|
155266
|
+
candidateLicense: "Apache-2.0",
|
|
155267
|
+
exportRule: "preserve_original_name"
|
|
155268
|
+
},
|
|
155269
|
+
{
|
|
155270
|
+
evidenceId: "arial",
|
|
155271
|
+
logicalFamily: "Arial",
|
|
155272
|
+
physicalFamily: "Liberation Sans",
|
|
155273
|
+
verdict: "metric_safe",
|
|
155274
|
+
faces: {
|
|
155275
|
+
regular: true,
|
|
155276
|
+
bold: true,
|
|
155277
|
+
italic: true,
|
|
155278
|
+
boldItalic: true
|
|
155279
|
+
},
|
|
155280
|
+
advance: {
|
|
155281
|
+
meanDelta: 0,
|
|
155282
|
+
maxDelta: 0
|
|
155283
|
+
},
|
|
155284
|
+
gates: {
|
|
155285
|
+
static: "pass",
|
|
155286
|
+
metric: "pass",
|
|
155287
|
+
layout: "not_run",
|
|
155288
|
+
ship: "pass"
|
|
155289
|
+
},
|
|
155290
|
+
policyAction: "substitute",
|
|
155291
|
+
measurementRefs: ["arial__liberation-sans#analytic_advance#2026-06-03"],
|
|
155292
|
+
candidateLicense: "OFL-1.1",
|
|
155293
|
+
exportRule: "preserve_original_name"
|
|
155294
|
+
},
|
|
155295
|
+
{
|
|
155296
|
+
evidenceId: "times-new-roman",
|
|
155297
|
+
logicalFamily: "Times New Roman",
|
|
155298
|
+
physicalFamily: "Liberation Serif",
|
|
155299
|
+
verdict: "metric_safe",
|
|
155300
|
+
faces: {
|
|
155301
|
+
regular: true,
|
|
155302
|
+
bold: true,
|
|
155303
|
+
italic: true,
|
|
155304
|
+
boldItalic: true
|
|
155305
|
+
},
|
|
155306
|
+
advance: {
|
|
155307
|
+
meanDelta: 0,
|
|
155308
|
+
maxDelta: 0
|
|
155309
|
+
},
|
|
155310
|
+
gates: {
|
|
155311
|
+
static: "pass",
|
|
155312
|
+
metric: "pass",
|
|
155313
|
+
layout: "not_run",
|
|
155314
|
+
ship: "pass"
|
|
155315
|
+
},
|
|
155316
|
+
policyAction: "substitute",
|
|
155317
|
+
measurementRefs: ["times-new-roman__liberation-serif#analytic_advance#2026-06-03"],
|
|
155318
|
+
candidateLicense: "OFL-1.1",
|
|
155319
|
+
exportRule: "preserve_original_name"
|
|
155320
|
+
},
|
|
155321
|
+
{
|
|
155322
|
+
evidenceId: "courier-new",
|
|
155323
|
+
logicalFamily: "Courier New",
|
|
155324
|
+
physicalFamily: "Liberation Mono",
|
|
155325
|
+
verdict: "metric_safe",
|
|
155326
|
+
faces: {
|
|
155327
|
+
regular: true,
|
|
155328
|
+
bold: true,
|
|
155329
|
+
italic: true,
|
|
155330
|
+
boldItalic: true
|
|
155331
|
+
},
|
|
155332
|
+
advance: {
|
|
155333
|
+
meanDelta: 0,
|
|
155334
|
+
maxDelta: 0
|
|
155335
|
+
},
|
|
155336
|
+
gates: {
|
|
155337
|
+
static: "pass",
|
|
155338
|
+
metric: "pass",
|
|
155339
|
+
layout: "not_run",
|
|
155340
|
+
ship: "pass"
|
|
155341
|
+
},
|
|
155342
|
+
policyAction: "substitute",
|
|
155343
|
+
measurementRefs: ["courier-new__liberation-mono#analytic_advance#2026-06-03"],
|
|
155344
|
+
candidateLicense: "OFL-1.1",
|
|
155345
|
+
exportRule: "preserve_original_name"
|
|
155346
|
+
},
|
|
155347
|
+
{
|
|
155348
|
+
evidenceId: "helvetica",
|
|
155349
|
+
logicalFamily: "Helvetica",
|
|
155350
|
+
physicalFamily: "Liberation Sans",
|
|
155351
|
+
verdict: "metric_safe",
|
|
155352
|
+
faces: {
|
|
155353
|
+
regular: true,
|
|
155354
|
+
bold: true,
|
|
155355
|
+
italic: true,
|
|
155356
|
+
boldItalic: true
|
|
155357
|
+
},
|
|
155358
|
+
advance: {
|
|
155359
|
+
meanDelta: 0,
|
|
155360
|
+
maxDelta: 0
|
|
155361
|
+
},
|
|
155362
|
+
gates: {
|
|
155363
|
+
static: "not_run",
|
|
155364
|
+
metric: "pass",
|
|
155365
|
+
layout: "not_run",
|
|
155366
|
+
ship: "fail"
|
|
155367
|
+
},
|
|
155368
|
+
policyAction: "substitute",
|
|
155369
|
+
measurementRefs: ["helvetica__liberation-sans#analytic_advance#2026-06-03"],
|
|
155370
|
+
candidateLicense: "OFL-1.1",
|
|
155371
|
+
exportRule: "preserve_original_name"
|
|
155372
|
+
},
|
|
155373
|
+
{
|
|
155374
|
+
evidenceId: "calibri-light",
|
|
155375
|
+
logicalFamily: "Calibri Light",
|
|
155376
|
+
physicalFamily: "Carlito",
|
|
155377
|
+
verdict: "visual_only",
|
|
155378
|
+
faces: {
|
|
155379
|
+
regular: false,
|
|
155380
|
+
bold: false,
|
|
155381
|
+
italic: false,
|
|
155382
|
+
boldItalic: false
|
|
155383
|
+
},
|
|
155384
|
+
advance: {
|
|
155385
|
+
meanDelta: 0.0148,
|
|
155386
|
+
maxDelta: 0.066
|
|
155387
|
+
},
|
|
155388
|
+
gates: {
|
|
155389
|
+
static: "not_run",
|
|
155390
|
+
metric: "fail",
|
|
155391
|
+
layout: "not_run",
|
|
155392
|
+
ship: "fail"
|
|
155393
|
+
},
|
|
155394
|
+
policyAction: "category_fallback",
|
|
155395
|
+
measurementRefs: ["calibri-light__carlito#analytic_advance#2026-06-05"],
|
|
155396
|
+
candidateLicense: "OFL-1.1",
|
|
155397
|
+
exportRule: "preserve_original_name"
|
|
155398
|
+
}
|
|
155399
|
+
]);
|
|
155400
|
+
BUNDLED_SUBSTITUTES = deriveBundledSubstitutes();
|
|
155401
|
+
CATEGORY_FALLBACKS = deriveCategoryFallbacks();
|
|
155402
|
+
defaultResolver = new FontResolver;
|
|
155403
|
+
DEFAULT_FONT_MEASURE_CONTEXT = Object.freeze({
|
|
155404
|
+
resolvePhysical: (cssFontFamily, _face) => resolvePhysicalFamily(cssFontFamily),
|
|
155405
|
+
fontSignature: ""
|
|
155406
|
+
});
|
|
155407
|
+
BUNDLED_MANIFEST = Object.freeze([
|
|
155408
|
+
family("Carlito", "Carlito", "OFL-1.1"),
|
|
155409
|
+
family("Caladea", "Caladea", "Apache-2.0"),
|
|
155410
|
+
family("Liberation Sans", "LiberationSans", "OFL-1.1"),
|
|
155411
|
+
family("Liberation Serif", "LiberationSerif", "OFL-1.1"),
|
|
155412
|
+
family("Liberation Mono", "LiberationMono", "OFL-1.1")
|
|
155413
|
+
]);
|
|
155414
|
+
installedRegistries = /* @__PURE__ */ new WeakMap;
|
|
155415
|
+
OS2_MIN_LENGTH = OS2_FSSELECTION + 2;
|
|
155416
|
+
registriesByFontSet = /* @__PURE__ */ new WeakMap;
|
|
155417
|
+
PHYSICAL_GENERIC = Object.freeze({
|
|
155418
|
+
Carlito: "sans-serif",
|
|
155419
|
+
Caladea: "serif",
|
|
155420
|
+
"Liberation Sans": "sans-serif",
|
|
155421
|
+
"Liberation Serif": "serif",
|
|
155422
|
+
"Liberation Mono": "monospace"
|
|
155423
|
+
});
|
|
155424
|
+
BUNDLED_FAMILIES = new Set(BUNDLED_MANIFEST.map((f2) => f2.family));
|
|
155425
|
+
FONT_OFFERINGS = deriveOfferings();
|
|
155426
|
+
DEFAULT_FONT_ORDER = [
|
|
155427
|
+
"Calibri",
|
|
155428
|
+
"Arial",
|
|
155429
|
+
"Courier New",
|
|
155430
|
+
"Times New Roman",
|
|
155431
|
+
"Helvetica"
|
|
155432
|
+
];
|
|
154354
155433
|
ALL_COMMENT_TARGETS = COMMENT_FILE_BASENAMES;
|
|
154355
155434
|
REL_ID_NUMERIC_PATTERN = /rId|mi/g;
|
|
154356
155435
|
FOOTNOTES_CONFIG$1 = {
|
|
@@ -155167,10 +156246,10 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
155167
156246
|
return fontsNode.elements.find((el) => el?.attributes?.["w:name"] === fontName) || null;
|
|
155168
156247
|
}
|
|
155169
156248
|
static getFallbackFromFontTable(docx, fontName) {
|
|
155170
|
-
const family = SuperConverter2.getFontTableEntry(docx, fontName)?.elements?.find((child) => child.name === "w:family")?.attributes?.["w:val"];
|
|
155171
|
-
if (!family)
|
|
156249
|
+
const family$1 = SuperConverter2.getFontTableEntry(docx, fontName)?.elements?.find((child) => child.name === "w:family")?.attributes?.["w:val"];
|
|
156250
|
+
if (!family$1)
|
|
155172
156251
|
return null;
|
|
155173
|
-
return FONT_FAMILY_FALLBACKS[family.toLowerCase()] || DEFAULT_GENERIC_FALLBACK;
|
|
156252
|
+
return FONT_FAMILY_FALLBACKS[family$1.toLowerCase()] || DEFAULT_GENERIC_FALLBACK;
|
|
155174
156253
|
}
|
|
155175
156254
|
static toCssFontFamily(fontName, docx) {
|
|
155176
156255
|
if (!fontName)
|
|
@@ -155600,13 +156679,16 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
155600
156679
|
for (const font of fontsToInclude) {
|
|
155601
156680
|
const filePath = elements.find((el) => el.attributes.Id === font.attributes["r:id"])?.attributes?.Target;
|
|
155602
156681
|
if (!filePath)
|
|
155603
|
-
|
|
155604
|
-
const
|
|
155605
|
-
if (!
|
|
155606
|
-
|
|
155607
|
-
const ttfBuffer = deobfuscateFont(
|
|
156682
|
+
continue;
|
|
156683
|
+
const fontUint8Array = this.fonts[`word/${filePath}`];
|
|
156684
|
+
if (!fontUint8Array?.buffer)
|
|
156685
|
+
continue;
|
|
156686
|
+
const ttfBuffer = deobfuscateFont(fontUint8Array.buffer.slice(fontUint8Array.byteOffset, fontUint8Array.byteOffset + fontUint8Array.byteLength), font.attributes["w:fontKey"]);
|
|
155608
156687
|
if (!ttfBuffer)
|
|
155609
|
-
|
|
156688
|
+
continue;
|
|
156689
|
+
const policy = parseEmbeddingPolicy(ttfBuffer);
|
|
156690
|
+
if (!(policy ? policy.embeddable : false))
|
|
156691
|
+
continue;
|
|
155610
156692
|
const blob = new Blob([ttfBuffer], { type: "font/ttf" });
|
|
155611
156693
|
const fontUrl = URL.createObjectURL(blob);
|
|
155612
156694
|
const isNormal = font.name.includes("Regular");
|
|
@@ -155631,6 +156713,48 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
155631
156713
|
fontsImported
|
|
155632
156714
|
};
|
|
155633
156715
|
}
|
|
156716
|
+
getEmbeddedFontFaces() {
|
|
156717
|
+
const fontTable = this.convertedXml["word/fontTable.xml"];
|
|
156718
|
+
if (!fontTable || !Object.keys(this.fonts).length)
|
|
156719
|
+
return [];
|
|
156720
|
+
const embedElements = (fontTable.elements?.find((el) => el.name === "w:fonts")?.elements?.filter((el) => el.elements?.some((nested) => nested?.attributes?.["r:id"] && nested?.attributes?.["w:fontKey"])) ?? []).flatMap((entry) => (entry.elements ?? []).filter((el) => el.name?.startsWith("w:embed")).map((el) => ({
|
|
156721
|
+
embed: el,
|
|
156722
|
+
family: entry.attributes?.["w:name"]
|
|
156723
|
+
})));
|
|
156724
|
+
const relElements = this.convertedXml["word/_rels/fontTable.xml.rels"]?.elements?.find((el) => el.name === "Relationships")?.elements ?? [];
|
|
156725
|
+
const faceFromEmbedName = (name = "") => ({
|
|
156726
|
+
weight: /bold/i.test(name) ? "700" : "400",
|
|
156727
|
+
style: /italic/i.test(name) ? "italic" : "normal"
|
|
156728
|
+
});
|
|
156729
|
+
const faces = [];
|
|
156730
|
+
for (const { embed, family: family$1 } of embedElements) {
|
|
156731
|
+
const relationshipId = embed.attributes?.["r:id"];
|
|
156732
|
+
const fontKey = embed.attributes?.["w:fontKey"];
|
|
156733
|
+
if (!family$1 || !relationshipId || !fontKey)
|
|
156734
|
+
continue;
|
|
156735
|
+
const filePath = relElements.find((el) => el.attributes?.Id === relationshipId)?.attributes?.Target;
|
|
156736
|
+
if (!filePath)
|
|
156737
|
+
continue;
|
|
156738
|
+
const fontUint8Array = this.fonts[`word/${filePath}`];
|
|
156739
|
+
if (!fontUint8Array?.buffer)
|
|
156740
|
+
continue;
|
|
156741
|
+
const ttf = deobfuscateFont(fontUint8Array.buffer.slice(fontUint8Array.byteOffset, fontUint8Array.byteOffset + fontUint8Array.byteLength), fontKey);
|
|
156742
|
+
if (!ttf)
|
|
156743
|
+
continue;
|
|
156744
|
+
const policy = parseEmbeddingPolicy(ttf);
|
|
156745
|
+
const fallback = faceFromEmbedName(embed.name);
|
|
156746
|
+
faces.push({
|
|
156747
|
+
family: family$1,
|
|
156748
|
+
source: ttf,
|
|
156749
|
+
weight: policy?.face.weight ?? fallback.weight,
|
|
156750
|
+
style: policy?.face.style ?? fallback.style,
|
|
156751
|
+
fsType: policy?.fsType ?? null,
|
|
156752
|
+
embeddable: policy ? policy.embeddable : false,
|
|
156753
|
+
relationshipId
|
|
156754
|
+
});
|
|
156755
|
+
}
|
|
156756
|
+
return faces;
|
|
156757
|
+
}
|
|
155634
156758
|
getDocumentInternalId() {
|
|
155635
156759
|
const settingsLocation = "word/settings.xml";
|
|
155636
156760
|
if (!this.convertedXml[settingsLocation])
|
|
@@ -156092,7 +157216,7 @@ var init_SuperConverter_bEQ45IUD_es = __esm(() => {
|
|
|
156092
157216
|
};
|
|
156093
157217
|
});
|
|
156094
157218
|
|
|
156095
|
-
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-
|
|
157219
|
+
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-JvWvpCga.es.js
|
|
156096
157220
|
function parseSizeUnit(val = "0") {
|
|
156097
157221
|
const length = val.toString() || "0";
|
|
156098
157222
|
const value = Number.parseFloat(length);
|
|
@@ -166425,8 +167549,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, normalizeActorId = (value) => {
|
|
|
166425
167549
|
}
|
|
166426
167550
|
};
|
|
166427
167551
|
};
|
|
166428
|
-
var
|
|
166429
|
-
|
|
167552
|
+
var init_create_headless_toolbar_JvWvpCga_es = __esm(() => {
|
|
167553
|
+
init_SuperConverter_BVWG4qnQ_es();
|
|
166430
167554
|
init_uuid_qzgm05fK_es();
|
|
166431
167555
|
init_constants_D9qj59G2_es();
|
|
166432
167556
|
init_dist_B8HfvhaK_es();
|
|
@@ -174992,12 +176116,12 @@ var require_shared_cjs = __commonJS((exports) => {
|
|
|
174992
176116
|
return res.join(`
|
|
174993
176117
|
`);
|
|
174994
176118
|
}
|
|
174995
|
-
function
|
|
176119
|
+
function normalizeStyle2(value) {
|
|
174996
176120
|
if (isArray2(value)) {
|
|
174997
176121
|
const res = {};
|
|
174998
176122
|
for (let i4 = 0;i4 < value.length; i4++) {
|
|
174999
176123
|
const item = value[i4];
|
|
175000
|
-
const normalized = isString(item) ? parseStringStyle(item) :
|
|
176124
|
+
const normalized = isString(item) ? parseStringStyle(item) : normalizeStyle2(item);
|
|
175001
176125
|
if (normalized) {
|
|
175002
176126
|
for (const key2 in normalized) {
|
|
175003
176127
|
res[key2] = normalized[key2];
|
|
@@ -175065,7 +176189,7 @@ var require_shared_cjs = __commonJS((exports) => {
|
|
|
175065
176189
|
props.class = normalizeClass(klass);
|
|
175066
176190
|
}
|
|
175067
176191
|
if (style) {
|
|
175068
|
-
props.style =
|
|
176192
|
+
props.style = normalizeStyle2(style);
|
|
175069
176193
|
}
|
|
175070
176194
|
return props;
|
|
175071
176195
|
}
|
|
@@ -175315,7 +176439,7 @@ var require_shared_cjs = __commonJS((exports) => {
|
|
|
175315
176439
|
exports.normalizeClass = normalizeClass;
|
|
175316
176440
|
exports.normalizeCssVarValue = normalizeCssVarValue;
|
|
175317
176441
|
exports.normalizeProps = normalizeProps;
|
|
175318
|
-
exports.normalizeStyle =
|
|
176442
|
+
exports.normalizeStyle = normalizeStyle2;
|
|
175319
176443
|
exports.objectToString = objectToString;
|
|
175320
176444
|
exports.parseStringStyle = parseStringStyle;
|
|
175321
176445
|
exports.propsToAttrMap = propsToAttrMap;
|
|
@@ -221110,7 +222234,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
221110
222234
|
init_remark_gfm_BhnWr3yf_es();
|
|
221111
222235
|
});
|
|
221112
222236
|
|
|
221113
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
222237
|
+
// ../../packages/superdoc/dist/chunks/src-x_i3LADL.es.js
|
|
221114
222238
|
function deleteProps(obj, propOrProps) {
|
|
221115
222239
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
221116
222240
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -242289,9 +243413,9 @@ function findDonorMarkerFont(abstract) {
|
|
|
242289
243413
|
continue;
|
|
242290
243414
|
if (rFontsHasSymbolFont(rFonts))
|
|
242291
243415
|
continue;
|
|
242292
|
-
const
|
|
242293
|
-
if (
|
|
242294
|
-
return
|
|
243416
|
+
const family2 = readRFontsFamily(rFonts);
|
|
243417
|
+
if (family2)
|
|
243418
|
+
return family2;
|
|
242295
243419
|
}
|
|
242296
243420
|
}
|
|
242297
243421
|
function normalizeLevelFontForNumFmt(lvlEl, newNumFmt) {
|
|
@@ -261440,238 +262564,6 @@ function computeTabWidth(currentPos, justification, tabs, hangingIndent, firstLi
|
|
|
261440
262564
|
tabWidth = nextDefaultTabStop - currentPos;
|
|
261441
262565
|
return tabWidth;
|
|
261442
262566
|
}
|
|
261443
|
-
function isSettled(status) {
|
|
261444
|
-
return SETTLED_STATUSES.includes(status);
|
|
261445
|
-
}
|
|
261446
|
-
function normalizeFamilyKey$2(family$1) {
|
|
261447
|
-
return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
261448
|
-
}
|
|
261449
|
-
function deriveBundledSubstitutes() {
|
|
261450
|
-
const substitutes = {};
|
|
261451
|
-
for (const row2 of SUBSTITUTION_EVIDENCE)
|
|
261452
|
-
if (row2.policyAction === "substitute" && row2.physicalFamily)
|
|
261453
|
-
substitutes[normalizeFamilyKey$2(row2.logicalFamily)] = row2.physicalFamily;
|
|
261454
|
-
return Object.freeze(substitutes);
|
|
261455
|
-
}
|
|
261456
|
-
function deriveCategoryFallbacks() {
|
|
261457
|
-
const fallbacks = {};
|
|
261458
|
-
for (const row2 of SUBSTITUTION_EVIDENCE)
|
|
261459
|
-
if (row2.policyAction === "category_fallback" && row2.physicalFamily)
|
|
261460
|
-
fallbacks[normalizeFamilyKey$2(row2.logicalFamily)] = row2.physicalFamily;
|
|
261461
|
-
return Object.freeze(fallbacks);
|
|
261462
|
-
}
|
|
261463
|
-
function stripFamilyQuotes(family$1) {
|
|
261464
|
-
return family$1.trim().replace(/^["']|["']$/g, "");
|
|
261465
|
-
}
|
|
261466
|
-
function splitStack(cssFontFamily) {
|
|
261467
|
-
return cssFontFamily.split(",").map((part) => part.trim()).filter(Boolean);
|
|
261468
|
-
}
|
|
261469
|
-
function createFontResolver() {
|
|
261470
|
-
return new FontResolver;
|
|
261471
|
-
}
|
|
261472
|
-
function resolveFontFamily2(logicalFamily) {
|
|
261473
|
-
return defaultResolver.resolveFontFamily(logicalFamily);
|
|
261474
|
-
}
|
|
261475
|
-
function resolvePhysicalFamily(cssFontFamily) {
|
|
261476
|
-
return defaultResolver.resolvePhysicalFamily(cssFontFamily);
|
|
261477
|
-
}
|
|
261478
|
-
function resolveFace(logicalFamily, face, hasFace) {
|
|
261479
|
-
return defaultResolver.resolveFace(logicalFamily, face, hasFace);
|
|
261480
|
-
}
|
|
261481
|
-
function getFontConfigVersion() {
|
|
261482
|
-
return fontConfigVersion;
|
|
261483
|
-
}
|
|
261484
|
-
function bumpFontConfigVersion() {
|
|
261485
|
-
return fontConfigVersion += 1;
|
|
261486
|
-
}
|
|
261487
|
-
function fourFaces(filePrefix) {
|
|
261488
|
-
return [
|
|
261489
|
-
{
|
|
261490
|
-
weight: "normal",
|
|
261491
|
-
style: "normal",
|
|
261492
|
-
file: `${filePrefix}-Regular.woff2`
|
|
261493
|
-
},
|
|
261494
|
-
{
|
|
261495
|
-
weight: "bold",
|
|
261496
|
-
style: "normal",
|
|
261497
|
-
file: `${filePrefix}-Bold.woff2`
|
|
261498
|
-
},
|
|
261499
|
-
{
|
|
261500
|
-
weight: "normal",
|
|
261501
|
-
style: "italic",
|
|
261502
|
-
file: `${filePrefix}-Italic.woff2`
|
|
261503
|
-
},
|
|
261504
|
-
{
|
|
261505
|
-
weight: "bold",
|
|
261506
|
-
style: "italic",
|
|
261507
|
-
file: `${filePrefix}-BoldItalic.woff2`
|
|
261508
|
-
}
|
|
261509
|
-
];
|
|
261510
|
-
}
|
|
261511
|
-
function family(name, filePrefix, license) {
|
|
261512
|
-
return {
|
|
261513
|
-
family: name,
|
|
261514
|
-
license,
|
|
261515
|
-
faces: fourFaces(filePrefix)
|
|
261516
|
-
};
|
|
261517
|
-
}
|
|
261518
|
-
function withTrailingSlash(base4) {
|
|
261519
|
-
return base4.endsWith("/") ? base4 : `${base4}/`;
|
|
261520
|
-
}
|
|
261521
|
-
function joinUrl(base4, file2) {
|
|
261522
|
-
return `${withTrailingSlash(base4)}${file2}`;
|
|
261523
|
-
}
|
|
261524
|
-
function weightToken(weight) {
|
|
261525
|
-
return weight === "bold" ? "700" : "400";
|
|
261526
|
-
}
|
|
261527
|
-
function bundledAssetSignature(resolve2) {
|
|
261528
|
-
const family$1 = BUNDLED_MANIFEST[0];
|
|
261529
|
-
const face = family$1?.faces[0];
|
|
261530
|
-
if (!family$1 || !face)
|
|
261531
|
-
return "";
|
|
261532
|
-
return resolve2({
|
|
261533
|
-
file: face.file,
|
|
261534
|
-
family: family$1.family,
|
|
261535
|
-
weight: weightToken(face.weight),
|
|
261536
|
-
style: face.style,
|
|
261537
|
-
source: "bundled-substitute"
|
|
261538
|
-
});
|
|
261539
|
-
}
|
|
261540
|
-
function installBundledSubstitutes(registry3, options = {}) {
|
|
261541
|
-
const resolve2 = options.resolveAssetUrl ?? ((context) => joinUrl(options.assetBaseUrl ?? defaultAssetBase, context.file));
|
|
261542
|
-
const signature = bundledAssetSignature(resolve2);
|
|
261543
|
-
const installed = installedRegistries.get(registry3);
|
|
261544
|
-
if (installed !== undefined) {
|
|
261545
|
-
if (installed !== signature)
|
|
261546
|
-
console.warn(`[superdoc] bundled fonts are already registered for this document from "${installed}"; a later fonts config resolving to "${signature}" is ignored. Use one fonts.assetBaseUrl / fonts.resolveAssetUrl per document.`);
|
|
261547
|
-
return;
|
|
261548
|
-
}
|
|
261549
|
-
installedRegistries.set(registry3, signature);
|
|
261550
|
-
for (const family$1 of BUNDLED_MANIFEST)
|
|
261551
|
-
for (const face of family$1.faces) {
|
|
261552
|
-
const context = {
|
|
261553
|
-
file: face.file,
|
|
261554
|
-
family: family$1.family,
|
|
261555
|
-
weight: weightToken(face.weight),
|
|
261556
|
-
style: face.style,
|
|
261557
|
-
source: "bundled-substitute"
|
|
261558
|
-
};
|
|
261559
|
-
registry3.register({
|
|
261560
|
-
family: family$1.family,
|
|
261561
|
-
source: `url(${resolve2(context)})`,
|
|
261562
|
-
descriptors: {
|
|
261563
|
-
weight: face.weight,
|
|
261564
|
-
style: face.style
|
|
261565
|
-
}
|
|
261566
|
-
});
|
|
261567
|
-
}
|
|
261568
|
-
}
|
|
261569
|
-
function buildFontReport(logicalFamilies, registry3, resolver2) {
|
|
261570
|
-
const seen = /* @__PURE__ */ new Set;
|
|
261571
|
-
const report = [];
|
|
261572
|
-
for (const logical of logicalFamilies) {
|
|
261573
|
-
if (!logical || seen.has(logical))
|
|
261574
|
-
continue;
|
|
261575
|
-
seen.add(logical);
|
|
261576
|
-
const { physicalFamily, reason } = resolver2 ? resolver2.resolveFontFamily(logical) : resolveFontFamily2(logical);
|
|
261577
|
-
const loadStatus = registry3.getStatus(physicalFamily);
|
|
261578
|
-
report.push({
|
|
261579
|
-
logicalFamily: logical,
|
|
261580
|
-
physicalFamily,
|
|
261581
|
-
reason,
|
|
261582
|
-
loadStatus,
|
|
261583
|
-
exportFamily: logical,
|
|
261584
|
-
missing: reason === "category_fallback" || isSettled(loadStatus) && loadStatus !== "loaded"
|
|
261585
|
-
});
|
|
261586
|
-
}
|
|
261587
|
-
return report;
|
|
261588
|
-
}
|
|
261589
|
-
function buildFaceReport(usedFaces, registry3, resolver2) {
|
|
261590
|
-
const hasFace = (family$1, weight, style2) => registry3.hasFace(family$1, weight, style2);
|
|
261591
|
-
const seen = /* @__PURE__ */ new Set;
|
|
261592
|
-
const report = [];
|
|
261593
|
-
for (const { logicalFamily, weight, style: style2 } of usedFaces) {
|
|
261594
|
-
if (!logicalFamily)
|
|
261595
|
-
continue;
|
|
261596
|
-
const key2 = `${logicalFamily.toLowerCase()}|${weight}|${style2}`;
|
|
261597
|
-
if (seen.has(key2))
|
|
261598
|
-
continue;
|
|
261599
|
-
seen.add(key2);
|
|
261600
|
-
const face = {
|
|
261601
|
-
weight,
|
|
261602
|
-
style: style2
|
|
261603
|
-
};
|
|
261604
|
-
const { physicalFamily, reason } = resolver2 ? resolver2.resolveFace(logicalFamily, face, hasFace) : resolveFace(logicalFamily, face, hasFace);
|
|
261605
|
-
const loadStatus = registry3.getFaceStatus({
|
|
261606
|
-
family: physicalFamily,
|
|
261607
|
-
weight,
|
|
261608
|
-
style: style2
|
|
261609
|
-
});
|
|
261610
|
-
const missing = reason === "fallback_face_absent" || reason === "category_fallback" || isSettled(loadStatus) && loadStatus !== "loaded";
|
|
261611
|
-
report.push({
|
|
261612
|
-
logicalFamily,
|
|
261613
|
-
physicalFamily,
|
|
261614
|
-
reason,
|
|
261615
|
-
loadStatus,
|
|
261616
|
-
exportFamily: logicalFamily,
|
|
261617
|
-
missing,
|
|
261618
|
-
face
|
|
261619
|
-
});
|
|
261620
|
-
}
|
|
261621
|
-
return report;
|
|
261622
|
-
}
|
|
261623
|
-
function quoteFamily(family$1) {
|
|
261624
|
-
return `"${family$1.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
261625
|
-
}
|
|
261626
|
-
function canonicalizeFontSource(source) {
|
|
261627
|
-
const match$1 = /^\s*url\(\s*([\s\S]*?)\s*\)\s*$/i.exec(source);
|
|
261628
|
-
if (!match$1)
|
|
261629
|
-
return source;
|
|
261630
|
-
let inner = match$1[1].trim();
|
|
261631
|
-
if (inner.startsWith('"') && inner.endsWith('"') || inner.startsWith("'") && inner.endsWith("'"))
|
|
261632
|
-
inner = inner.slice(1, -1);
|
|
261633
|
-
return `url(${JSON.stringify(inner)})`;
|
|
261634
|
-
}
|
|
261635
|
-
function normalizeFamilyKey$1(family$1) {
|
|
261636
|
-
return family$1.trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
261637
|
-
}
|
|
261638
|
-
function normalizeWeight(weight) {
|
|
261639
|
-
if (weight === undefined)
|
|
261640
|
-
return "400";
|
|
261641
|
-
const w = String(weight).trim().toLowerCase();
|
|
261642
|
-
if (w === "bold" || w === "bolder")
|
|
261643
|
-
return "700";
|
|
261644
|
-
const n = Number(w);
|
|
261645
|
-
return Number.isFinite(n) && n >= 600 ? "700" : "400";
|
|
261646
|
-
}
|
|
261647
|
-
function normalizeStyle$1(style2) {
|
|
261648
|
-
if (!style2)
|
|
261649
|
-
return "normal";
|
|
261650
|
-
const s2 = style2.trim().toLowerCase();
|
|
261651
|
-
return s2.startsWith("italic") || s2.startsWith("oblique") ? "italic" : "normal";
|
|
261652
|
-
}
|
|
261653
|
-
function faceKeyOf$1(family$1, weight, style2) {
|
|
261654
|
-
return `${normalizeFamilyKey$1(family$1)}|${weight}|${style2}`;
|
|
261655
|
-
}
|
|
261656
|
-
function faceProbe(family$1, weight, style2, size$1) {
|
|
261657
|
-
return `${style2 === "italic" ? "italic " : ""}${weight} ${size$1} ${quoteFamily(family$1)}`;
|
|
261658
|
-
}
|
|
261659
|
-
function getFontRegistryFor(fontSet, FontFaceCtor) {
|
|
261660
|
-
if (!fontSet) {
|
|
261661
|
-
if (!domlessRegistry)
|
|
261662
|
-
domlessRegistry = new FontRegistry({});
|
|
261663
|
-
return domlessRegistry;
|
|
261664
|
-
}
|
|
261665
|
-
let registry3 = registriesByFontSet.get(fontSet);
|
|
261666
|
-
if (!registry3) {
|
|
261667
|
-
registry3 = new FontRegistry({
|
|
261668
|
-
fontSet,
|
|
261669
|
-
FontFaceCtor
|
|
261670
|
-
});
|
|
261671
|
-
registriesByFontSet.set(fontSet, registry3);
|
|
261672
|
-
}
|
|
261673
|
-
return registry3;
|
|
261674
|
-
}
|
|
261675
262567
|
function isResolvedFragmentWithBorders(item) {
|
|
261676
262568
|
return item !== undefined && item.kind === "fragment" && "paragraphBorders" in item && item.paragraphBorders !== undefined;
|
|
261677
262569
|
}
|
|
@@ -269667,8 +270559,8 @@ function isTextRun$3(run2) {
|
|
|
269667
270559
|
function fontString(run2) {
|
|
269668
270560
|
const textRun = isTextRun$3(run2) ? run2 : null;
|
|
269669
270561
|
const size$1 = textRun?.fontSize ?? 16;
|
|
269670
|
-
const
|
|
269671
|
-
return `${textRun?.italic ? "italic " : ""}${textRun?.bold ? "bold " : ""}${size$1}px ${
|
|
270562
|
+
const family2 = textRun?.fontFamily ?? "Arial";
|
|
270563
|
+
return `${textRun?.italic ? "italic " : ""}${textRun?.bold ? "bold " : ""}${size$1}px ${family2}`.trim();
|
|
269672
270564
|
}
|
|
269673
270565
|
function runText(run2) {
|
|
269674
270566
|
if (isEmptySdtPlaceholderRun(run2))
|
|
@@ -280514,8 +281406,8 @@ function ensureEndnoteMarker(blocks2, id2, endnoteNumberById, endnoteNumberForma
|
|
|
280514
281406
|
}
|
|
280515
281407
|
runs2.unshift(markerRun);
|
|
280516
281408
|
}
|
|
280517
|
-
function
|
|
280518
|
-
return
|
|
281409
|
+
function normalizeFamilyKey2(family2) {
|
|
281410
|
+
return family2.trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
280519
281411
|
}
|
|
280520
281412
|
function normalizeWeightToken(weight) {
|
|
280521
281413
|
if (!weight)
|
|
@@ -280532,8 +281424,8 @@ function normalizeStyleToken(style2) {
|
|
|
280532
281424
|
const s2 = style2.trim().toLowerCase();
|
|
280533
281425
|
return s2.startsWith("italic") || s2.startsWith("oblique") ? "italic" : "normal";
|
|
280534
281426
|
}
|
|
280535
|
-
function
|
|
280536
|
-
return `${
|
|
281427
|
+
function faceKeyOf2(family2, weight, style2) {
|
|
281428
|
+
return `${normalizeFamilyKey2(family2)}|${weight}|${style2}`;
|
|
280537
281429
|
}
|
|
280538
281430
|
function summarize(results) {
|
|
280539
281431
|
const summary = emptySummary();
|
|
@@ -280557,9 +281449,9 @@ function summarizeFaces(results) {
|
|
|
280557
281449
|
worstByFamily.set(request.family, status);
|
|
280558
281450
|
}
|
|
280559
281451
|
const summary = emptySummary();
|
|
280560
|
-
for (const [
|
|
281452
|
+
for (const [family2, status] of worstByFamily) {
|
|
280561
281453
|
summary.results.push({
|
|
280562
|
-
family:
|
|
281454
|
+
family: family2,
|
|
280563
281455
|
status
|
|
280564
281456
|
});
|
|
280565
281457
|
if (status === "loaded")
|
|
@@ -280601,6 +281493,13 @@ function defaultInvalidate() {
|
|
|
280601
281493
|
function toCssFontSource(url2) {
|
|
280602
281494
|
return /^\s*url\(/i.test(url2) ? url2 : `url(${JSON.stringify(url2)})`;
|
|
280603
281495
|
}
|
|
281496
|
+
function nextEmbeddedNamespace() {
|
|
281497
|
+
embeddedDocumentCounter += 1;
|
|
281498
|
+
return `__superdoc_embedded_${embeddedDocumentCounter}__`;
|
|
281499
|
+
}
|
|
281500
|
+
function sanitizeFamilyToken(family2) {
|
|
281501
|
+
return family2.replace(/[^A-Za-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "font";
|
|
281502
|
+
}
|
|
280604
281503
|
function defaultScheduleMicrotask(callback) {
|
|
280605
281504
|
if (typeof queueMicrotask === "function") {
|
|
280606
281505
|
queueMicrotask(callback);
|
|
@@ -280630,14 +281529,14 @@ function makeResolveFace(resolver2, hasFace) {
|
|
|
280630
281529
|
};
|
|
280631
281530
|
};
|
|
280632
281531
|
return (logical) => {
|
|
280633
|
-
const r$1 =
|
|
281532
|
+
const r$1 = resolveFontFamily(logical);
|
|
280634
281533
|
return {
|
|
280635
281534
|
physicalFamily: r$1.physicalFamily,
|
|
280636
281535
|
reason: r$1.reason
|
|
280637
281536
|
};
|
|
280638
281537
|
};
|
|
280639
281538
|
}
|
|
280640
|
-
function collect(acc, node2,
|
|
281539
|
+
function collect(acc, node2, resolveFace2) {
|
|
280641
281540
|
if (!node2 || typeof node2.fontFamily !== "string" || !node2.fontFamily)
|
|
280642
281541
|
return;
|
|
280643
281542
|
const weight = node2.bold === true ? "700" : "400";
|
|
@@ -280648,7 +281547,7 @@ function collect(acc, node2, resolveFace$1) {
|
|
|
280648
281547
|
const usedKey = `${logicalPrimary.toLowerCase()}|${weight}|${style2}`;
|
|
280649
281548
|
if (acc.usedFaces.has(usedKey))
|
|
280650
281549
|
return;
|
|
280651
|
-
const { physicalFamily, reason } =
|
|
281550
|
+
const { physicalFamily, reason } = resolveFace2(node2.fontFamily, {
|
|
280652
281551
|
weight,
|
|
280653
281552
|
style: style2
|
|
280654
281553
|
});
|
|
@@ -280674,7 +281573,7 @@ function collect(acc, node2, resolveFace$1) {
|
|
|
280674
281573
|
});
|
|
280675
281574
|
}
|
|
280676
281575
|
}
|
|
280677
|
-
function collectRuns(acc, runs2,
|
|
281576
|
+
function collectRuns(acc, runs2, resolveFace2) {
|
|
280678
281577
|
if (!runs2)
|
|
280679
281578
|
return;
|
|
280680
281579
|
for (const run2 of runs2) {
|
|
@@ -280683,48 +281582,48 @@ function collectRuns(acc, runs2, resolveFace$1) {
|
|
|
280683
281582
|
collect(acc, {
|
|
280684
281583
|
...bearing,
|
|
280685
281584
|
fontFamily: "Arial"
|
|
280686
|
-
},
|
|
281585
|
+
}, resolveFace2);
|
|
280687
281586
|
else
|
|
280688
|
-
collect(acc, bearing,
|
|
281587
|
+
collect(acc, bearing, resolveFace2);
|
|
280689
281588
|
}
|
|
280690
281589
|
}
|
|
280691
|
-
function collectParagraph(acc, paragraph2,
|
|
281590
|
+
function collectParagraph(acc, paragraph2, resolveFace2) {
|
|
280692
281591
|
if (!paragraph2)
|
|
280693
281592
|
return;
|
|
280694
|
-
collectRuns(acc, paragraph2.runs,
|
|
280695
|
-
collect(acc, paragraph2.attrs?.wordLayout?.marker?.run,
|
|
280696
|
-
collect(acc, paragraph2.attrs?.dropCapDescriptor?.run,
|
|
281593
|
+
collectRuns(acc, paragraph2.runs, resolveFace2);
|
|
281594
|
+
collect(acc, paragraph2.attrs?.wordLayout?.marker?.run, resolveFace2);
|
|
281595
|
+
collect(acc, paragraph2.attrs?.dropCapDescriptor?.run, resolveFace2);
|
|
280697
281596
|
}
|
|
280698
|
-
function collectTable(acc, table2,
|
|
281597
|
+
function collectTable(acc, table2, resolveFace2) {
|
|
280699
281598
|
for (const row2 of table2.rows)
|
|
280700
281599
|
for (const cell2 of row2.cells) {
|
|
280701
|
-
collectParagraph(acc, cell2.paragraph,
|
|
281600
|
+
collectParagraph(acc, cell2.paragraph, resolveFace2);
|
|
280702
281601
|
if (cell2.blocks)
|
|
280703
281602
|
for (const b$1 of cell2.blocks)
|
|
280704
|
-
collectBlock(acc, b$1,
|
|
281603
|
+
collectBlock(acc, b$1, resolveFace2);
|
|
280705
281604
|
}
|
|
280706
281605
|
}
|
|
280707
|
-
function collectList(acc, list5,
|
|
281606
|
+
function collectList(acc, list5, resolveFace2) {
|
|
280708
281607
|
for (const item of list5.items)
|
|
280709
|
-
collectParagraph(acc, item.paragraph,
|
|
281608
|
+
collectParagraph(acc, item.paragraph, resolveFace2);
|
|
280710
281609
|
}
|
|
280711
|
-
function collectBlock(acc, block,
|
|
281610
|
+
function collectBlock(acc, block, resolveFace2) {
|
|
280712
281611
|
switch (block.kind) {
|
|
280713
281612
|
case "paragraph":
|
|
280714
|
-
collectParagraph(acc, block,
|
|
281613
|
+
collectParagraph(acc, block, resolveFace2);
|
|
280715
281614
|
break;
|
|
280716
281615
|
case "table":
|
|
280717
|
-
collectTable(acc, block,
|
|
281616
|
+
collectTable(acc, block, resolveFace2);
|
|
280718
281617
|
break;
|
|
280719
281618
|
case "list":
|
|
280720
|
-
collectList(acc, block,
|
|
281619
|
+
collectList(acc, block, resolveFace2);
|
|
280721
281620
|
break;
|
|
280722
281621
|
default:
|
|
280723
281622
|
break;
|
|
280724
281623
|
}
|
|
280725
281624
|
}
|
|
280726
281625
|
function planFontFaces(blocks2, resolver2, hasFace) {
|
|
280727
|
-
const
|
|
281626
|
+
const resolveFace2 = makeResolveFace(resolver2, hasFace);
|
|
280728
281627
|
const acc = {
|
|
280729
281628
|
requiredFaces: /* @__PURE__ */ new Map,
|
|
280730
281629
|
usedFaces: /* @__PURE__ */ new Map,
|
|
@@ -280732,7 +281631,7 @@ function planFontFaces(blocks2, resolver2, hasFace) {
|
|
|
280732
281631
|
};
|
|
280733
281632
|
if (blocks2)
|
|
280734
281633
|
for (const block of blocks2)
|
|
280735
|
-
collectBlock(acc, block,
|
|
281634
|
+
collectBlock(acc, block, resolveFace2);
|
|
280736
281635
|
return {
|
|
280737
281636
|
requiredFaces: [...acc.requiredFaces.values()],
|
|
280738
281637
|
usedFaces: [...acc.usedFaces.values()],
|
|
@@ -302641,443 +303540,7 @@ menclose::after {
|
|
|
302641
303540
|
const minReadablePx = getMinimumReadableTextStartPx(markerContentEndPx, gutterWidthPx);
|
|
302642
303541
|
return Math.max(nextTabStopPx, minReadablePx);
|
|
302643
303542
|
}
|
|
302644
|
-
},
|
|
302645
|
-
#overrides = /* @__PURE__ */ new Map;
|
|
302646
|
-
#version = 0;
|
|
302647
|
-
#cachedSignature = null;
|
|
302648
|
-
map(logicalFamily, physicalFamily) {
|
|
302649
|
-
const key2 = normalizeFamilyKey$2(logicalFamily);
|
|
302650
|
-
const physical = physicalFamily?.trim();
|
|
302651
|
-
if (!key2 || !physical)
|
|
302652
|
-
return;
|
|
302653
|
-
if (this.#overrides.get(key2) === physical)
|
|
302654
|
-
return;
|
|
302655
|
-
if (key2 === normalizeFamilyKey$2(physical)) {
|
|
302656
|
-
if (this.#overrides.delete(key2)) {
|
|
302657
|
-
this.#version += 1;
|
|
302658
|
-
this.#cachedSignature = null;
|
|
302659
|
-
}
|
|
302660
|
-
return;
|
|
302661
|
-
}
|
|
302662
|
-
this.#overrides.set(key2, physical);
|
|
302663
|
-
this.#version += 1;
|
|
302664
|
-
this.#cachedSignature = null;
|
|
302665
|
-
}
|
|
302666
|
-
unmap(logicalFamily) {
|
|
302667
|
-
if (this.#overrides.delete(normalizeFamilyKey$2(logicalFamily))) {
|
|
302668
|
-
this.#version += 1;
|
|
302669
|
-
this.#cachedSignature = null;
|
|
302670
|
-
}
|
|
302671
|
-
}
|
|
302672
|
-
reset() {
|
|
302673
|
-
if (this.#overrides.size === 0)
|
|
302674
|
-
return;
|
|
302675
|
-
this.#overrides.clear();
|
|
302676
|
-
this.#version += 1;
|
|
302677
|
-
this.#cachedSignature = null;
|
|
302678
|
-
}
|
|
302679
|
-
get version() {
|
|
302680
|
-
return this.#version;
|
|
302681
|
-
}
|
|
302682
|
-
get signature() {
|
|
302683
|
-
if (this.#cachedSignature !== null)
|
|
302684
|
-
return this.#cachedSignature;
|
|
302685
|
-
this.#cachedSignature = this.#overrides.size === 0 ? "" : JSON.stringify([...this.#overrides.entries()].sort(([a2], [b$1]) => a2 < b$1 ? -1 : a2 > b$1 ? 1 : 0));
|
|
302686
|
-
return this.#cachedSignature;
|
|
302687
|
-
}
|
|
302688
|
-
#physicalFor(bareFamily) {
|
|
302689
|
-
const key2 = normalizeFamilyKey$2(bareFamily);
|
|
302690
|
-
const override = this.#overrides.get(key2);
|
|
302691
|
-
if (override)
|
|
302692
|
-
return {
|
|
302693
|
-
physical: override,
|
|
302694
|
-
reason: "custom_mapping"
|
|
302695
|
-
};
|
|
302696
|
-
const bundled = BUNDLED_SUBSTITUTES[key2];
|
|
302697
|
-
if (bundled)
|
|
302698
|
-
return {
|
|
302699
|
-
physical: bundled,
|
|
302700
|
-
reason: "bundled_substitute"
|
|
302701
|
-
};
|
|
302702
|
-
const category = CATEGORY_FALLBACKS[key2];
|
|
302703
|
-
if (category)
|
|
302704
|
-
return {
|
|
302705
|
-
physical: category,
|
|
302706
|
-
reason: "category_fallback"
|
|
302707
|
-
};
|
|
302708
|
-
return {
|
|
302709
|
-
physical: bareFamily,
|
|
302710
|
-
reason: "as_requested"
|
|
302711
|
-
};
|
|
302712
|
-
}
|
|
302713
|
-
#resolveFaceLadder(primary, face, hasFace) {
|
|
302714
|
-
const key2 = normalizeFamilyKey$2(primary);
|
|
302715
|
-
const override = this.#overrides.get(key2);
|
|
302716
|
-
if (override && hasFace(override, face.weight, face.style))
|
|
302717
|
-
return {
|
|
302718
|
-
physical: override,
|
|
302719
|
-
reason: "custom_mapping"
|
|
302720
|
-
};
|
|
302721
|
-
if (hasFace(primary, face.weight, face.style))
|
|
302722
|
-
return {
|
|
302723
|
-
physical: primary,
|
|
302724
|
-
reason: "registered_face"
|
|
302725
|
-
};
|
|
302726
|
-
const bundled = BUNDLED_SUBSTITUTES[key2];
|
|
302727
|
-
if (bundled && hasFace(bundled, face.weight, face.style))
|
|
302728
|
-
return {
|
|
302729
|
-
physical: bundled,
|
|
302730
|
-
reason: "bundled_substitute"
|
|
302731
|
-
};
|
|
302732
|
-
const category = CATEGORY_FALLBACKS[key2];
|
|
302733
|
-
if (category && hasFace(category, face.weight, face.style))
|
|
302734
|
-
return {
|
|
302735
|
-
physical: category,
|
|
302736
|
-
reason: "category_fallback"
|
|
302737
|
-
};
|
|
302738
|
-
if (override || bundled)
|
|
302739
|
-
return {
|
|
302740
|
-
physical: primary,
|
|
302741
|
-
reason: "fallback_face_absent"
|
|
302742
|
-
};
|
|
302743
|
-
return {
|
|
302744
|
-
physical: primary,
|
|
302745
|
-
reason: "as_requested"
|
|
302746
|
-
};
|
|
302747
|
-
}
|
|
302748
|
-
resolveFontFamily(logicalFamily) {
|
|
302749
|
-
const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
|
|
302750
|
-
const { physical, reason } = this.#physicalFor(primary);
|
|
302751
|
-
return {
|
|
302752
|
-
logicalFamily,
|
|
302753
|
-
physicalFamily: stripFamilyQuotes(physical),
|
|
302754
|
-
reason
|
|
302755
|
-
};
|
|
302756
|
-
}
|
|
302757
|
-
resolvePhysicalFamily(cssFontFamily) {
|
|
302758
|
-
if (!cssFontFamily)
|
|
302759
|
-
return cssFontFamily;
|
|
302760
|
-
const parts = splitStack(cssFontFamily);
|
|
302761
|
-
if (parts.length === 0)
|
|
302762
|
-
return cssFontFamily;
|
|
302763
|
-
const { physical, reason } = this.#physicalFor(parts[0]);
|
|
302764
|
-
if (reason === "as_requested")
|
|
302765
|
-
return cssFontFamily;
|
|
302766
|
-
return [physical, ...parts.slice(1)].join(", ");
|
|
302767
|
-
}
|
|
302768
|
-
resolveFace(logicalFamily, face, hasFace) {
|
|
302769
|
-
const primary = splitStack(logicalFamily)[0] ?? logicalFamily;
|
|
302770
|
-
const { physical, reason } = this.#resolveFaceLadder(primary, face, hasFace);
|
|
302771
|
-
return {
|
|
302772
|
-
logicalFamily,
|
|
302773
|
-
physicalFamily: stripFamilyQuotes(physical),
|
|
302774
|
-
reason
|
|
302775
|
-
};
|
|
302776
|
-
}
|
|
302777
|
-
resolvePhysicalFamilyForFace(cssFontFamily, face, hasFace) {
|
|
302778
|
-
if (!cssFontFamily)
|
|
302779
|
-
return cssFontFamily;
|
|
302780
|
-
const parts = splitStack(cssFontFamily);
|
|
302781
|
-
if (parts.length === 0)
|
|
302782
|
-
return cssFontFamily;
|
|
302783
|
-
const { physical } = this.#resolveFaceLadder(parts[0], face, hasFace);
|
|
302784
|
-
if (normalizeFamilyKey$2(physical) !== normalizeFamilyKey$2(parts[0]))
|
|
302785
|
-
return [physical, ...parts.slice(1)].join(", ");
|
|
302786
|
-
return cssFontFamily;
|
|
302787
|
-
}
|
|
302788
|
-
resolvePrimaryPhysicalFamily(family$1) {
|
|
302789
|
-
const primary = splitStack(family$1)[0] ?? family$1;
|
|
302790
|
-
return this.#physicalFor(primary).physical;
|
|
302791
|
-
}
|
|
302792
|
-
resolvePhysicalFamilies(families) {
|
|
302793
|
-
const out = /* @__PURE__ */ new Set;
|
|
302794
|
-
for (const family$1 of families)
|
|
302795
|
-
if (family$1)
|
|
302796
|
-
out.add(this.resolvePrimaryPhysicalFamily(family$1));
|
|
302797
|
-
return [...out];
|
|
302798
|
-
}
|
|
302799
|
-
}, defaultResolver, DEFAULT_FONT_MEASURE_CONTEXT, fontConfigVersion = 0, BUNDLED_MANIFEST, defaultAssetBase = "/fonts/", installedRegistries, DEFAULT_FONT_LOAD_TIMEOUT_MS = 3000, DEFAULT_PROBE_SIZE = "16px", FontRegistry = class {
|
|
302800
|
-
#fontSet;
|
|
302801
|
-
#FontFaceCtor;
|
|
302802
|
-
#probeSize;
|
|
302803
|
-
#scheduleTimeout;
|
|
302804
|
-
#cancelTimeout;
|
|
302805
|
-
#managed = /* @__PURE__ */ new Map;
|
|
302806
|
-
#status = /* @__PURE__ */ new Map;
|
|
302807
|
-
#sources = /* @__PURE__ */ new Map;
|
|
302808
|
-
#warnedFailures = /* @__PURE__ */ new Set;
|
|
302809
|
-
#inflight = /* @__PURE__ */ new Map;
|
|
302810
|
-
#faceStatus = /* @__PURE__ */ new Map;
|
|
302811
|
-
#faceInflight = /* @__PURE__ */ new Map;
|
|
302812
|
-
#faceSources = /* @__PURE__ */ new Map;
|
|
302813
|
-
#facesByFamily = /* @__PURE__ */ new Map;
|
|
302814
|
-
#providerFaceKeys = /* @__PURE__ */ new Set;
|
|
302815
|
-
#warnedFaceFailures = /* @__PURE__ */ new Set;
|
|
302816
|
-
constructor(options = {}) {
|
|
302817
|
-
this.#fontSet = options.fontSet ?? null;
|
|
302818
|
-
this.#FontFaceCtor = options.FontFaceCtor ?? null;
|
|
302819
|
-
this.#probeSize = options.probeSize ?? DEFAULT_PROBE_SIZE;
|
|
302820
|
-
this.#scheduleTimeout = options.scheduleTimeout ?? ((cb, ms) => globalThis.setTimeout(cb, ms));
|
|
302821
|
-
this.#cancelTimeout = options.cancelTimeout ?? ((handle3) => globalThis.clearTimeout(handle3));
|
|
302822
|
-
}
|
|
302823
|
-
register(descriptor) {
|
|
302824
|
-
const { family: family$1, source, descriptors: descriptors2 } = descriptor;
|
|
302825
|
-
const identitySource = typeof source === "string" ? canonicalizeFontSource(source) : source;
|
|
302826
|
-
const weight = normalizeWeight(descriptors2?.weight);
|
|
302827
|
-
const style2 = normalizeStyle$1(descriptors2?.style);
|
|
302828
|
-
const key2 = faceKeyOf$1(family$1, weight, style2);
|
|
302829
|
-
if (typeof identitySource === "string") {
|
|
302830
|
-
const existingSource = this.#faceSources.get(key2);
|
|
302831
|
-
if (existingSource === identitySource)
|
|
302832
|
-
return {
|
|
302833
|
-
family: family$1,
|
|
302834
|
-
status: this.getStatus(family$1),
|
|
302835
|
-
changed: false
|
|
302836
|
-
};
|
|
302837
|
-
if (existingSource !== undefined)
|
|
302838
|
-
throw new Error(`[superdoc] font face "${key2}" is already registered from a different source ("${existingSource}"); a registered face's source cannot be replaced`);
|
|
302839
|
-
}
|
|
302840
|
-
if (this.#FontFaceCtor && this.#fontSet) {
|
|
302841
|
-
const face = new this.#FontFaceCtor(family$1, source, {
|
|
302842
|
-
...descriptors2,
|
|
302843
|
-
weight,
|
|
302844
|
-
style: style2
|
|
302845
|
-
});
|
|
302846
|
-
this.#fontSet.add(face);
|
|
302847
|
-
this.#managed.set(family$1, face);
|
|
302848
|
-
}
|
|
302849
|
-
if (typeof source === "string") {
|
|
302850
|
-
const list5 = this.#sources.get(family$1) ?? [];
|
|
302851
|
-
if (!list5.includes(source))
|
|
302852
|
-
list5.push(source);
|
|
302853
|
-
this.#sources.set(family$1, list5);
|
|
302854
|
-
}
|
|
302855
|
-
if (!this.#status.has(family$1))
|
|
302856
|
-
this.#status.set(family$1, "unloaded");
|
|
302857
|
-
this.#providerFaceKeys.add(key2);
|
|
302858
|
-
this.#trackFace(family$1, key2);
|
|
302859
|
-
if (!this.#faceStatus.has(key2))
|
|
302860
|
-
this.#faceStatus.set(key2, "unloaded");
|
|
302861
|
-
if (typeof identitySource === "string" && !this.#faceSources.has(key2))
|
|
302862
|
-
this.#faceSources.set(key2, identitySource);
|
|
302863
|
-
return {
|
|
302864
|
-
family: family$1,
|
|
302865
|
-
status: this.getStatus(family$1),
|
|
302866
|
-
changed: true
|
|
302867
|
-
};
|
|
302868
|
-
}
|
|
302869
|
-
#trackFace(family$1, key2) {
|
|
302870
|
-
const fam = normalizeFamilyKey$1(family$1);
|
|
302871
|
-
const set3 = this.#facesByFamily.get(fam) ?? /* @__PURE__ */ new Set;
|
|
302872
|
-
set3.add(key2);
|
|
302873
|
-
this.#facesByFamily.set(fam, set3);
|
|
302874
|
-
}
|
|
302875
|
-
isManaged(family$1) {
|
|
302876
|
-
return this.#managed.has(family$1);
|
|
302877
|
-
}
|
|
302878
|
-
getStatus(family$1) {
|
|
302879
|
-
const statuses = [];
|
|
302880
|
-
const faceKeys = this.#facesByFamily.get(normalizeFamilyKey$1(family$1));
|
|
302881
|
-
if (faceKeys)
|
|
302882
|
-
for (const k$1 of faceKeys)
|
|
302883
|
-
statuses.push(this.#faceStatus.get(k$1) ?? "unloaded");
|
|
302884
|
-
const legacy = this.#status.get(family$1);
|
|
302885
|
-
if (legacy)
|
|
302886
|
-
statuses.push(legacy);
|
|
302887
|
-
if (statuses.length === 0)
|
|
302888
|
-
return "unloaded";
|
|
302889
|
-
for (const s2 of [
|
|
302890
|
-
"failed",
|
|
302891
|
-
"timed_out",
|
|
302892
|
-
"fallback_used",
|
|
302893
|
-
"loaded",
|
|
302894
|
-
"loading",
|
|
302895
|
-
"unloaded"
|
|
302896
|
-
])
|
|
302897
|
-
if (statuses.includes(s2))
|
|
302898
|
-
return s2;
|
|
302899
|
-
return "unloaded";
|
|
302900
|
-
}
|
|
302901
|
-
hasFace(family$1, weight, style2) {
|
|
302902
|
-
const key2 = faceKeyOf$1(family$1, weight, style2);
|
|
302903
|
-
return this.#providerFaceKeys.has(key2) && this.#faceStatus.get(key2) !== "failed";
|
|
302904
|
-
}
|
|
302905
|
-
isAvailable(family$1) {
|
|
302906
|
-
if (!this.#fontSet)
|
|
302907
|
-
return false;
|
|
302908
|
-
try {
|
|
302909
|
-
return this.#fontSet.check(`${this.#probeSize} ${quoteFamily(family$1)}`);
|
|
302910
|
-
} catch {
|
|
302911
|
-
return false;
|
|
302912
|
-
}
|
|
302913
|
-
}
|
|
302914
|
-
awaitFace(family$1, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
|
|
302915
|
-
if (this.#status.get(family$1) === "loaded")
|
|
302916
|
-
return Promise.resolve({
|
|
302917
|
-
family: family$1,
|
|
302918
|
-
status: "loaded"
|
|
302919
|
-
});
|
|
302920
|
-
const existing = this.#inflight.get(family$1);
|
|
302921
|
-
if (existing)
|
|
302922
|
-
return existing;
|
|
302923
|
-
const probe = this.#loadOne(family$1, timeoutMs).finally(() => {
|
|
302924
|
-
this.#inflight.delete(family$1);
|
|
302925
|
-
});
|
|
302926
|
-
this.#inflight.set(family$1, probe);
|
|
302927
|
-
return probe;
|
|
302928
|
-
}
|
|
302929
|
-
async awaitFaces(families, options = {}) {
|
|
302930
|
-
const unique$2 = [...new Set(families)];
|
|
302931
|
-
const timeoutMs = options.timeoutMs ?? 3000;
|
|
302932
|
-
return Promise.all(unique$2.map((family$1) => this.awaitFace(family$1, timeoutMs)));
|
|
302933
|
-
}
|
|
302934
|
-
getRequiredFaces(families, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
|
|
302935
|
-
return [...new Set(families)].map((family$1) => ({
|
|
302936
|
-
family: family$1,
|
|
302937
|
-
status: this.getStatus(family$1),
|
|
302938
|
-
ready: this.awaitFace(family$1, timeoutMs)
|
|
302939
|
-
}));
|
|
302940
|
-
}
|
|
302941
|
-
getStates() {
|
|
302942
|
-
return [...this.#status.entries()].map(([family$1, status]) => ({
|
|
302943
|
-
family: family$1,
|
|
302944
|
-
status
|
|
302945
|
-
}));
|
|
302946
|
-
}
|
|
302947
|
-
getFaceStatus(request) {
|
|
302948
|
-
return this.#faceStatus.get(faceKeyOf$1(request.family, request.weight, request.style)) ?? "unloaded";
|
|
302949
|
-
}
|
|
302950
|
-
awaitFaceRequest(request, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS) {
|
|
302951
|
-
const key2 = faceKeyOf$1(request.family, request.weight, request.style);
|
|
302952
|
-
if (this.#faceStatus.get(key2) === "loaded")
|
|
302953
|
-
return Promise.resolve({
|
|
302954
|
-
request,
|
|
302955
|
-
status: "loaded"
|
|
302956
|
-
});
|
|
302957
|
-
const existing = this.#faceInflight.get(key2);
|
|
302958
|
-
if (existing)
|
|
302959
|
-
return existing;
|
|
302960
|
-
const probe = this.#loadOneFace(request, key2, timeoutMs).finally(() => {
|
|
302961
|
-
this.#faceInflight.delete(key2);
|
|
302962
|
-
});
|
|
302963
|
-
this.#faceInflight.set(key2, probe);
|
|
302964
|
-
return probe;
|
|
302965
|
-
}
|
|
302966
|
-
async awaitFaceRequests(requests, options = {}) {
|
|
302967
|
-
const timeoutMs = options.timeoutMs ?? 3000;
|
|
302968
|
-
const seen = /* @__PURE__ */ new Set;
|
|
302969
|
-
const unique$2 = [];
|
|
302970
|
-
for (const r$1 of requests) {
|
|
302971
|
-
const key2 = faceKeyOf$1(r$1.family, r$1.weight, r$1.style);
|
|
302972
|
-
if (seen.has(key2))
|
|
302973
|
-
continue;
|
|
302974
|
-
seen.add(key2);
|
|
302975
|
-
unique$2.push(r$1);
|
|
302976
|
-
}
|
|
302977
|
-
return Promise.all(unique$2.map((r$1) => this.awaitFaceRequest(r$1, timeoutMs)));
|
|
302978
|
-
}
|
|
302979
|
-
async#loadOneFace(request, key2, timeoutMs) {
|
|
302980
|
-
this.#trackFace(request.family, key2);
|
|
302981
|
-
const fontSet = this.#fontSet;
|
|
302982
|
-
if (!fontSet) {
|
|
302983
|
-
this.#faceStatus.set(key2, "fallback_used");
|
|
302984
|
-
return {
|
|
302985
|
-
request,
|
|
302986
|
-
status: "fallback_used"
|
|
302987
|
-
};
|
|
302988
|
-
}
|
|
302989
|
-
this.#faceStatus.set(key2, "loading");
|
|
302990
|
-
const probe = faceProbe(request.family, request.weight, request.style, this.#probeSize);
|
|
302991
|
-
const TIMEOUT = Symbol("timeout");
|
|
302992
|
-
let handle3;
|
|
302993
|
-
const timeout$1 = new Promise((resolve2) => {
|
|
302994
|
-
handle3 = this.#scheduleTimeout(() => resolve2(TIMEOUT), timeoutMs);
|
|
302995
|
-
});
|
|
302996
|
-
try {
|
|
302997
|
-
const settled = await Promise.race([fontSet.load(probe), timeout$1]);
|
|
302998
|
-
if (settled === TIMEOUT) {
|
|
302999
|
-
this.#faceStatus.set(key2, "timed_out");
|
|
303000
|
-
return {
|
|
303001
|
-
request,
|
|
303002
|
-
status: "timed_out"
|
|
303003
|
-
};
|
|
303004
|
-
}
|
|
303005
|
-
const status = settled.length > 0 ? "loaded" : "fallback_used";
|
|
303006
|
-
this.#faceStatus.set(key2, status);
|
|
303007
|
-
return {
|
|
303008
|
-
request,
|
|
303009
|
-
status
|
|
303010
|
-
};
|
|
303011
|
-
} catch {
|
|
303012
|
-
this.#faceStatus.set(key2, "failed");
|
|
303013
|
-
this.#warnFaceFailureOnce(request, key2);
|
|
303014
|
-
return {
|
|
303015
|
-
request,
|
|
303016
|
-
status: "failed"
|
|
303017
|
-
};
|
|
303018
|
-
} finally {
|
|
303019
|
-
this.#cancelTimeout(handle3);
|
|
303020
|
-
}
|
|
303021
|
-
}
|
|
303022
|
-
#warnFaceFailureOnce(request, key2) {
|
|
303023
|
-
if (this.#warnedFaceFailures.has(key2))
|
|
303024
|
-
return;
|
|
303025
|
-
this.#warnedFaceFailures.add(key2);
|
|
303026
|
-
const src = this.#faceSources.get(key2);
|
|
303027
|
-
const detail = src ? ` from ${src}` : "";
|
|
303028
|
-
console.warn(`[superdoc] font face failed to load: "${request.family}" ${request.weight} ${request.style}${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
|
|
303029
|
-
}
|
|
303030
|
-
async#loadOne(family$1, timeoutMs) {
|
|
303031
|
-
const fontSet = this.#fontSet;
|
|
303032
|
-
if (!fontSet) {
|
|
303033
|
-
this.#status.set(family$1, "fallback_used");
|
|
303034
|
-
return {
|
|
303035
|
-
family: family$1,
|
|
303036
|
-
status: "fallback_used"
|
|
303037
|
-
};
|
|
303038
|
-
}
|
|
303039
|
-
this.#status.set(family$1, "loading");
|
|
303040
|
-
const probe = `${this.#probeSize} ${quoteFamily(family$1)}`;
|
|
303041
|
-
const TIMEOUT = Symbol("timeout");
|
|
303042
|
-
let handle3;
|
|
303043
|
-
const timeout$1 = new Promise((resolve2) => {
|
|
303044
|
-
handle3 = this.#scheduleTimeout(() => resolve2(TIMEOUT), timeoutMs);
|
|
303045
|
-
});
|
|
303046
|
-
try {
|
|
303047
|
-
const settled = await Promise.race([fontSet.load(probe), timeout$1]);
|
|
303048
|
-
if (settled === TIMEOUT) {
|
|
303049
|
-
this.#status.set(family$1, "timed_out");
|
|
303050
|
-
return {
|
|
303051
|
-
family: family$1,
|
|
303052
|
-
status: "timed_out"
|
|
303053
|
-
};
|
|
303054
|
-
}
|
|
303055
|
-
const status = settled.length > 0 ? "loaded" : "fallback_used";
|
|
303056
|
-
this.#status.set(family$1, status);
|
|
303057
|
-
return {
|
|
303058
|
-
family: family$1,
|
|
303059
|
-
status
|
|
303060
|
-
};
|
|
303061
|
-
} catch {
|
|
303062
|
-
this.#status.set(family$1, "failed");
|
|
303063
|
-
this.#warnLoadFailureOnce(family$1);
|
|
303064
|
-
return {
|
|
303065
|
-
family: family$1,
|
|
303066
|
-
status: "failed"
|
|
303067
|
-
};
|
|
303068
|
-
} finally {
|
|
303069
|
-
this.#cancelTimeout(handle3);
|
|
303070
|
-
}
|
|
303071
|
-
}
|
|
303072
|
-
#warnLoadFailureOnce(family$1) {
|
|
303073
|
-
if (this.#warnedFailures.has(family$1))
|
|
303074
|
-
return;
|
|
303075
|
-
this.#warnedFailures.add(family$1);
|
|
303076
|
-
const sources = this.#sources.get(family$1);
|
|
303077
|
-
const detail = sources && sources.length ? ` from ${sources.join(", ")}` : "";
|
|
303078
|
-
console.warn(`[superdoc] font asset failed to load for "${family$1}"${detail}. Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
|
|
303079
|
-
}
|
|
303080
|
-
}, registriesByFontSet, domlessRegistry = null, hashParagraphBorder$2 = (border) => {
|
|
303543
|
+
}, hashParagraphBorder$2 = (border) => {
|
|
303081
303544
|
const parts = [];
|
|
303082
303545
|
if (border.style !== undefined)
|
|
303083
303546
|
parts.push(`s:${border.style}`);
|
|
@@ -310990,8 +311453,8 @@ menclose::after {
|
|
|
310990
311453
|
return typeof width === "number" ? width : 0;
|
|
310991
311454
|
}, isLineBreakRun$1 = (run2) => run2.kind === "lineBreak" || run2.kind === "break" && run2.breakType === "line", markerFontString = (run2) => {
|
|
310992
311455
|
const size$1 = run2?.fontSize ?? 16;
|
|
310993
|
-
const
|
|
310994
|
-
return `${run2?.italic ? "italic " : ""}${run2?.bold ? "bold " : ""}${size$1}px ${
|
|
311456
|
+
const family2 = run2?.fontFamily ?? "Arial";
|
|
311457
|
+
return `${run2?.italic ? "italic " : ""}${run2?.bold ? "bold " : ""}${size$1}px ${family2}`.trim();
|
|
310995
311458
|
}, buildTabStopsPx$1 = (indent2, tabs, tabIntervalTwips) => {
|
|
310996
311459
|
const paragraphIndentTwips = {
|
|
310997
311460
|
left: pxToTwips$1(sanitizeIndent$1(indent2?.left)),
|
|
@@ -318433,7 +318896,7 @@ menclose::after {
|
|
|
318433
318896
|
const usedFaces = this.#getUsedFaces?.() ?? [];
|
|
318434
318897
|
const faceRows = buildFaceReport(usedFaces, registry3, resolver2);
|
|
318435
318898
|
const usedFamilies = new Set(usedFaces.map((u) => u.logicalFamily.toLowerCase()));
|
|
318436
|
-
const declaredRows = buildFontReport(declared.filter((
|
|
318899
|
+
const declaredRows = buildFontReport(declared.filter((family2) => family2 && !usedFamilies.has(family2.toLowerCase())), registry3, resolver2);
|
|
318437
318900
|
return [...faceRows, ...declaredRows];
|
|
318438
318901
|
}
|
|
318439
318902
|
async ensureReadyForMeasure() {
|
|
@@ -318451,7 +318914,7 @@ menclose::after {
|
|
|
318451
318914
|
}
|
|
318452
318915
|
const keyed = required2.map((r$1) => ({
|
|
318453
318916
|
request: r$1,
|
|
318454
|
-
key:
|
|
318917
|
+
key: faceKeyOf2(r$1.family, r$1.weight, r$1.style)
|
|
318455
318918
|
}));
|
|
318456
318919
|
const signature = keyed.map((k$1) => k$1.key).sort().join("|");
|
|
318457
318920
|
if (signature === this.#requiredSignature && keyed.every((k$1) => registry3.getFaceStatus(k$1.request) === "loaded") && this.#lastSummary)
|
|
@@ -318468,7 +318931,7 @@ menclose::after {
|
|
|
318468
318931
|
}
|
|
318469
318932
|
const failedKeys = [];
|
|
318470
318933
|
for (const result of results) {
|
|
318471
|
-
const key2 =
|
|
318934
|
+
const key2 = faceKeyOf2(result.request.family, result.request.weight, result.request.style);
|
|
318472
318935
|
if (result.status === "loaded")
|
|
318473
318936
|
this.#seenAvailableFaces.add(key2);
|
|
318474
318937
|
else if (result.status === "failed" && !this.#seenFailedFaces.has(key2)) {
|
|
@@ -318490,7 +318953,7 @@ menclose::after {
|
|
|
318490
318953
|
return this.#lastSummary ?? emptySummary();
|
|
318491
318954
|
}
|
|
318492
318955
|
const signature = required2.slice().sort().join("|");
|
|
318493
|
-
if (signature === this.#requiredSignature && required2.every((
|
|
318956
|
+
if (signature === this.#requiredSignature && required2.every((family2) => registry3.getStatus(family2) === "loaded") && this.#lastSummary)
|
|
318494
318957
|
return this.#lastSummary;
|
|
318495
318958
|
this.#requiredSignature = signature;
|
|
318496
318959
|
this.#requiredFamilies = new Set(required2);
|
|
@@ -318578,7 +319041,7 @@ menclose::after {
|
|
|
318578
319041
|
return;
|
|
318579
319042
|
const changedKeys = [];
|
|
318580
319043
|
if (this.#requiredFaceKeys.size > 0) {
|
|
318581
|
-
const loadedFaceKeys = new Set(faces.map((face) =>
|
|
319044
|
+
const loadedFaceKeys = new Set(faces.map((face) => faceKeyOf2(face.family, normalizeWeightToken(face.weight), normalizeStyleToken(face.style))));
|
|
318582
319045
|
for (const key2 of this.#requiredFaceKeys) {
|
|
318583
319046
|
if (this.#seenAvailableFaces.has(key2))
|
|
318584
319047
|
continue;
|
|
@@ -318588,13 +319051,13 @@ menclose::after {
|
|
|
318588
319051
|
}
|
|
318589
319052
|
}
|
|
318590
319053
|
} else {
|
|
318591
|
-
const loadedFamilies = new Set(faces.map((face) =>
|
|
318592
|
-
for (const
|
|
318593
|
-
if (this.#seenAvailable.has(
|
|
319054
|
+
const loadedFamilies = new Set(faces.map((face) => normalizeFamilyKey2(face.family)));
|
|
319055
|
+
for (const family2 of this.#requiredFamilies) {
|
|
319056
|
+
if (this.#seenAvailable.has(family2))
|
|
318594
319057
|
continue;
|
|
318595
|
-
if (loadedFamilies.has(
|
|
318596
|
-
this.#seenAvailable.add(
|
|
318597
|
-
changedKeys.push(
|
|
319058
|
+
if (loadedFamilies.has(normalizeFamilyKey2(family2))) {
|
|
319059
|
+
this.#seenAvailable.add(family2);
|
|
319060
|
+
changedKeys.push(normalizeFamilyKey2(family2));
|
|
318598
319061
|
}
|
|
318599
319062
|
}
|
|
318600
319063
|
}
|
|
@@ -318611,7 +319074,7 @@ menclose::after {
|
|
|
318611
319074
|
#flushLateFontLoads() {
|
|
318612
319075
|
this.#requestReflow();
|
|
318613
319076
|
}
|
|
318614
|
-
}, FACE_STATUS_PRIORITY, DocumentFontController = class {
|
|
319077
|
+
}, FACE_STATUS_PRIORITY, embeddedDocumentCounter = 0, DocumentFontController = class {
|
|
318615
319078
|
#resolver;
|
|
318616
319079
|
#getGate;
|
|
318617
319080
|
#onDocumentFontConfigApplied;
|
|
@@ -318619,6 +319082,10 @@ menclose::after {
|
|
|
318619
319082
|
#runtimeReflowQueued = false;
|
|
318620
319083
|
#runtimeReflowToken = 0;
|
|
318621
319084
|
#runtimeAvailabilityChanged = false;
|
|
319085
|
+
#embeddedDisposers = [];
|
|
319086
|
+
#embeddedNamespace = nextEmbeddedNamespace();
|
|
319087
|
+
#embeddedPhysical = /* @__PURE__ */ new Map;
|
|
319088
|
+
#embeddedGeneration = 0;
|
|
318622
319089
|
constructor(deps) {
|
|
318623
319090
|
this.#resolver = deps.resolver;
|
|
318624
319091
|
this.#getGate = deps.getGate;
|
|
@@ -318631,16 +319098,18 @@ menclose::after {
|
|
|
318631
319098
|
}
|
|
318632
319099
|
unmap(families) {
|
|
318633
319100
|
const before = this.#resolver.signature;
|
|
318634
|
-
for (const
|
|
318635
|
-
this.#resolver.unmap(
|
|
319101
|
+
for (const family2 of Array.isArray(families) ? families : [families])
|
|
319102
|
+
this.#resolver.unmap(family2);
|
|
318636
319103
|
this.#reflowIfChanged(before);
|
|
318637
319104
|
}
|
|
318638
319105
|
reset() {
|
|
318639
319106
|
this.#cancelPendingRuntimeReflow();
|
|
319107
|
+
this.#releaseEmbeddedFaces();
|
|
318640
319108
|
this.#resolver.reset();
|
|
318641
319109
|
}
|
|
318642
319110
|
dispose() {
|
|
318643
319111
|
this.#cancelPendingRuntimeReflow();
|
|
319112
|
+
this.#releaseEmbeddedFaces();
|
|
318644
319113
|
}
|
|
318645
319114
|
applyInitialConfig(config3) {
|
|
318646
319115
|
this.#cancelPendingRuntimeReflow();
|
|
@@ -318651,6 +319120,43 @@ menclose::after {
|
|
|
318651
319120
|
if (registered$1)
|
|
318652
319121
|
this.#getGate()?.invalidateCachesForConfigRegistration();
|
|
318653
319122
|
}
|
|
319123
|
+
applyEmbeddedFaces(faces) {
|
|
319124
|
+
this.#releaseEmbeddedFaces();
|
|
319125
|
+
if (!faces?.length)
|
|
319126
|
+
return;
|
|
319127
|
+
const registry3 = this.#getGate()?.resolveRegistry();
|
|
319128
|
+
if (!registry3)
|
|
319129
|
+
return;
|
|
319130
|
+
this.#embeddedGeneration += 1;
|
|
319131
|
+
let registered$1 = false;
|
|
319132
|
+
for (const face of faces) {
|
|
319133
|
+
if (!face?.embeddable)
|
|
319134
|
+
continue;
|
|
319135
|
+
const physicalFamily = this.#physicalFamilyFor(face.family);
|
|
319136
|
+
const release = registry3.registerOwnedFace({
|
|
319137
|
+
family: physicalFamily,
|
|
319138
|
+
source: face.source,
|
|
319139
|
+
weight: face.weight,
|
|
319140
|
+
style: face.style
|
|
319141
|
+
});
|
|
319142
|
+
if (release) {
|
|
319143
|
+
this.#embeddedDisposers.push(release);
|
|
319144
|
+
this.#resolver.mapEmbedded(face.family, physicalFamily);
|
|
319145
|
+
registered$1 = true;
|
|
319146
|
+
}
|
|
319147
|
+
}
|
|
319148
|
+
if (registered$1)
|
|
319149
|
+
this.#getGate()?.invalidateCachesForConfigRegistration();
|
|
319150
|
+
}
|
|
319151
|
+
#physicalFamilyFor(logicalFamily) {
|
|
319152
|
+
const key2 = logicalFamily.trim().toLowerCase();
|
|
319153
|
+
let physical = this.#embeddedPhysical.get(key2);
|
|
319154
|
+
if (!physical) {
|
|
319155
|
+
physical = `${this.#embeddedNamespace}${this.#embeddedGeneration}_${this.#embeddedPhysical.size}_${sanitizeFamilyToken(logicalFamily)}`;
|
|
319156
|
+
this.#embeddedPhysical.set(key2, physical);
|
|
319157
|
+
}
|
|
319158
|
+
return physical;
|
|
319159
|
+
}
|
|
318654
319160
|
add(families) {
|
|
318655
319161
|
let committed = false;
|
|
318656
319162
|
try {
|
|
@@ -318672,17 +319178,17 @@ menclose::after {
|
|
|
318672
319178
|
throw new Error("[superdoc] fonts.add: the font registry is not ready yet");
|
|
318673
319179
|
let changed = false;
|
|
318674
319180
|
for (const entry of families) {
|
|
318675
|
-
const
|
|
319181
|
+
const family2 = entry?.family;
|
|
318676
319182
|
const faces = entry?.faces;
|
|
318677
|
-
if (typeof
|
|
319183
|
+
if (typeof family2 !== "string" || !family2.trim())
|
|
318678
319184
|
throw new Error('[superdoc] fonts.add: each family needs a non-empty "family" name');
|
|
318679
319185
|
if (!Array.isArray(faces) || faces.length === 0)
|
|
318680
|
-
throw new Error(`[superdoc] fonts.add: family "${
|
|
319186
|
+
throw new Error(`[superdoc] fonts.add: family "${family2}" needs at least one face in "faces"`);
|
|
318681
319187
|
for (const face of faces) {
|
|
318682
319188
|
if (!face || typeof face.source !== "string" || !face.source.trim())
|
|
318683
|
-
throw new Error(`[superdoc] fonts.add: family "${
|
|
319189
|
+
throw new Error(`[superdoc] fonts.add: family "${family2}" has a face with no "source" URL`);
|
|
318684
319190
|
if (registry3.register({
|
|
318685
|
-
family:
|
|
319191
|
+
family: family2,
|
|
318686
319192
|
source: toCssFontSource(face.source),
|
|
318687
319193
|
descriptors: {
|
|
318688
319194
|
weight: face.weight == null ? undefined : String(face.weight),
|
|
@@ -318702,7 +319208,7 @@ menclose::after {
|
|
|
318702
319208
|
const registry3 = this.#getGate()?.resolveRegistry();
|
|
318703
319209
|
if (!registry3)
|
|
318704
319210
|
throw new Error("[superdoc] fonts.preload: the font registry is not ready yet");
|
|
318705
|
-
const hasFace = (
|
|
319211
|
+
const hasFace = (family2, weight, style2) => registry3.hasFace(family2, weight, style2);
|
|
318706
319212
|
const face = {
|
|
318707
319213
|
weight: "400",
|
|
318708
319214
|
style: "normal"
|
|
@@ -318748,6 +319254,13 @@ menclose::after {
|
|
|
318748
319254
|
this.#runtimeReflowQueued = false;
|
|
318749
319255
|
this.#runtimeReflowToken += 1;
|
|
318750
319256
|
}
|
|
319257
|
+
#releaseEmbeddedFaces() {
|
|
319258
|
+
for (const release of this.#embeddedDisposers)
|
|
319259
|
+
release();
|
|
319260
|
+
this.#embeddedDisposers.length = 0;
|
|
319261
|
+
this.#embeddedPhysical.clear();
|
|
319262
|
+
this.#resolver.clearEmbedded();
|
|
319263
|
+
}
|
|
318751
319264
|
}, DEFAULT_SEMANTIC_FOOTNOTE_HEADING_STYLE, NATIVE_SELECTION_STYLES = `
|
|
318752
319265
|
/* Hide native browser selection on layout engine content.
|
|
318753
319266
|
* We render our own selection overlay via PresentationEditor's #localSelectionLayer
|
|
@@ -318825,13 +319338,13 @@ menclose::after {
|
|
|
318825
319338
|
return;
|
|
318826
319339
|
console.log(...args$1);
|
|
318827
319340
|
}, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions, TRACKED_MARK_NAMES;
|
|
318828
|
-
var
|
|
319341
|
+
var init_src_x_i3LADL_es = __esm(() => {
|
|
318829
319342
|
init_rolldown_runtime_Bg48TavK_es();
|
|
318830
|
-
|
|
319343
|
+
init_SuperConverter_BVWG4qnQ_es();
|
|
318831
319344
|
init_jszip_C49i9kUs_es();
|
|
318832
319345
|
init_xml_js_CqGKpaft_es();
|
|
318833
319346
|
init_uuid_qzgm05fK_es();
|
|
318834
|
-
|
|
319347
|
+
init_create_headless_toolbar_JvWvpCga_es();
|
|
318835
319348
|
init_constants_D9qj59G2_es();
|
|
318836
319349
|
init_dist_B8HfvhaK_es();
|
|
318837
319350
|
init_unified_Dsuw2be5_es();
|
|
@@ -339477,44 +339990,15 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
339477
339990
|
};
|
|
339478
339991
|
}
|
|
339479
339992
|
}, [["__scopeId", "data-v-d25821a5"]]);
|
|
339480
|
-
TOOLBAR_FONTS =
|
|
339481
|
-
|
|
339482
|
-
|
|
339483
|
-
|
|
339484
|
-
|
|
339485
|
-
|
|
339486
|
-
|
|
339487
|
-
"data-item": "btn-fontFamily-option"
|
|
339488
|
-
}
|
|
339489
|
-
},
|
|
339490
|
-
{
|
|
339491
|
-
label: "Arial",
|
|
339492
|
-
key: "Arial, sans-serif",
|
|
339493
|
-
fontWeight: 400,
|
|
339494
|
-
props: {
|
|
339495
|
-
style: { fontFamily: "Arial, sans-serif" },
|
|
339496
|
-
"data-item": "btn-fontFamily-option"
|
|
339497
|
-
}
|
|
339498
|
-
},
|
|
339499
|
-
{
|
|
339500
|
-
label: "Courier New",
|
|
339501
|
-
key: "Courier New, monospace",
|
|
339502
|
-
fontWeight: 400,
|
|
339503
|
-
props: {
|
|
339504
|
-
style: { fontFamily: "Courier New, monospace" },
|
|
339505
|
-
"data-item": "btn-fontFamily-option"
|
|
339506
|
-
}
|
|
339507
|
-
},
|
|
339508
|
-
{
|
|
339509
|
-
label: "Times New Roman",
|
|
339510
|
-
key: "Times New Roman, serif",
|
|
339511
|
-
fontWeight: 400,
|
|
339512
|
-
props: {
|
|
339513
|
-
style: { fontFamily: "Times New Roman, serif" },
|
|
339514
|
-
"data-item": "btn-fontFamily-option"
|
|
339515
|
-
}
|
|
339993
|
+
TOOLBAR_FONTS = getDefaultFontOfferings().map((offering) => ({
|
|
339994
|
+
label: offering.logicalFamily,
|
|
339995
|
+
key: fontOfferingStack(offering),
|
|
339996
|
+
fontWeight: 400,
|
|
339997
|
+
props: {
|
|
339998
|
+
style: { fontFamily: fontOfferingRenderStack(offering) },
|
|
339999
|
+
"data-item": "btn-fontFamily-option"
|
|
339516
340000
|
}
|
|
339517
|
-
|
|
340001
|
+
}));
|
|
339518
340002
|
TOOLBAR_FONT_SIZES = [
|
|
339519
340003
|
{
|
|
339520
340004
|
label: "8",
|
|
@@ -345827,229 +346311,6 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
345827
346311
|
wave: 1,
|
|
345828
346312
|
doubleWave: 2
|
|
345829
346313
|
};
|
|
345830
|
-
SETTLED_STATUSES = [
|
|
345831
|
-
"loaded",
|
|
345832
|
-
"failed",
|
|
345833
|
-
"timed_out",
|
|
345834
|
-
"fallback_used"
|
|
345835
|
-
];
|
|
345836
|
-
SUBSTITUTION_EVIDENCE = Object.freeze([
|
|
345837
|
-
{
|
|
345838
|
-
evidenceId: "calibri",
|
|
345839
|
-
logicalFamily: "Calibri",
|
|
345840
|
-
physicalFamily: "Carlito",
|
|
345841
|
-
verdict: "metric_safe",
|
|
345842
|
-
faces: {
|
|
345843
|
-
regular: true,
|
|
345844
|
-
bold: true,
|
|
345845
|
-
italic: true,
|
|
345846
|
-
boldItalic: true
|
|
345847
|
-
},
|
|
345848
|
-
advance: {
|
|
345849
|
-
meanDelta: 0,
|
|
345850
|
-
maxDelta: 0
|
|
345851
|
-
},
|
|
345852
|
-
gates: {
|
|
345853
|
-
static: "pass",
|
|
345854
|
-
metric: "pass",
|
|
345855
|
-
layout: "pass",
|
|
345856
|
-
ship: "pass"
|
|
345857
|
-
},
|
|
345858
|
-
policyAction: "substitute",
|
|
345859
|
-
measurementRefs: ["calibri__carlito#analytic_advance#2026-06-03", "calibri__carlito#face_aggregate#2026-06-03"],
|
|
345860
|
-
candidateLicense: "OFL-1.1",
|
|
345861
|
-
exportRule: "preserve_original_name"
|
|
345862
|
-
},
|
|
345863
|
-
{
|
|
345864
|
-
evidenceId: "cambria",
|
|
345865
|
-
logicalFamily: "Cambria",
|
|
345866
|
-
physicalFamily: "Caladea",
|
|
345867
|
-
verdict: "visual_only",
|
|
345868
|
-
faceVerdicts: {
|
|
345869
|
-
regular: "metric_safe",
|
|
345870
|
-
bold: "metric_safe",
|
|
345871
|
-
italic: "metric_safe",
|
|
345872
|
-
boldItalic: "visual_only"
|
|
345873
|
-
},
|
|
345874
|
-
glyphExceptions: [{
|
|
345875
|
-
slot: "boldItalic",
|
|
345876
|
-
codepoint: 96,
|
|
345877
|
-
advanceDelta: 0.231,
|
|
345878
|
-
note: "Caladea Bold Italic grave accent (U+0060) advance diverges ~23% from Cambria; lines containing it reflow."
|
|
345879
|
-
}],
|
|
345880
|
-
faces: {
|
|
345881
|
-
regular: true,
|
|
345882
|
-
bold: true,
|
|
345883
|
-
italic: true,
|
|
345884
|
-
boldItalic: true
|
|
345885
|
-
},
|
|
345886
|
-
advance: {
|
|
345887
|
-
meanDelta: 0.0002378,
|
|
345888
|
-
maxDelta: 0.2310758
|
|
345889
|
-
},
|
|
345890
|
-
gates: {
|
|
345891
|
-
static: "pass",
|
|
345892
|
-
metric: "pass",
|
|
345893
|
-
layout: "not_run",
|
|
345894
|
-
ship: "pass"
|
|
345895
|
-
},
|
|
345896
|
-
policyAction: "substitute",
|
|
345897
|
-
measurementRefs: [
|
|
345898
|
-
"cambria_regular__caladea#regular#w400#d2f6cad3#analytic_advance#2026-06-04",
|
|
345899
|
-
"cambria_bold__caladea#bold#w700#74eda4fc#analytic_advance#2026-06-04",
|
|
345900
|
-
"cambria_italic__caladea#italic#w400#9c968bf6#analytic_advance#2026-06-04",
|
|
345901
|
-
"cambria_boldItalic__caladea#boldItalic#w700#f47a35ad#analytic_advance#2026-06-04"
|
|
345902
|
-
],
|
|
345903
|
-
candidateLicense: "Apache-2.0",
|
|
345904
|
-
exportRule: "preserve_original_name"
|
|
345905
|
-
},
|
|
345906
|
-
{
|
|
345907
|
-
evidenceId: "arial",
|
|
345908
|
-
logicalFamily: "Arial",
|
|
345909
|
-
physicalFamily: "Liberation Sans",
|
|
345910
|
-
verdict: "metric_safe",
|
|
345911
|
-
faces: {
|
|
345912
|
-
regular: true,
|
|
345913
|
-
bold: true,
|
|
345914
|
-
italic: true,
|
|
345915
|
-
boldItalic: true
|
|
345916
|
-
},
|
|
345917
|
-
advance: {
|
|
345918
|
-
meanDelta: 0,
|
|
345919
|
-
maxDelta: 0
|
|
345920
|
-
},
|
|
345921
|
-
gates: {
|
|
345922
|
-
static: "pass",
|
|
345923
|
-
metric: "pass",
|
|
345924
|
-
layout: "not_run",
|
|
345925
|
-
ship: "pass"
|
|
345926
|
-
},
|
|
345927
|
-
policyAction: "substitute",
|
|
345928
|
-
measurementRefs: ["arial__liberation-sans#analytic_advance#2026-06-03"],
|
|
345929
|
-
candidateLicense: "OFL-1.1",
|
|
345930
|
-
exportRule: "preserve_original_name"
|
|
345931
|
-
},
|
|
345932
|
-
{
|
|
345933
|
-
evidenceId: "times-new-roman",
|
|
345934
|
-
logicalFamily: "Times New Roman",
|
|
345935
|
-
physicalFamily: "Liberation Serif",
|
|
345936
|
-
verdict: "metric_safe",
|
|
345937
|
-
faces: {
|
|
345938
|
-
regular: true,
|
|
345939
|
-
bold: true,
|
|
345940
|
-
italic: true,
|
|
345941
|
-
boldItalic: true
|
|
345942
|
-
},
|
|
345943
|
-
advance: {
|
|
345944
|
-
meanDelta: 0,
|
|
345945
|
-
maxDelta: 0
|
|
345946
|
-
},
|
|
345947
|
-
gates: {
|
|
345948
|
-
static: "pass",
|
|
345949
|
-
metric: "pass",
|
|
345950
|
-
layout: "not_run",
|
|
345951
|
-
ship: "pass"
|
|
345952
|
-
},
|
|
345953
|
-
policyAction: "substitute",
|
|
345954
|
-
measurementRefs: ["times-new-roman__liberation-serif#analytic_advance#2026-06-03"],
|
|
345955
|
-
candidateLicense: "OFL-1.1",
|
|
345956
|
-
exportRule: "preserve_original_name"
|
|
345957
|
-
},
|
|
345958
|
-
{
|
|
345959
|
-
evidenceId: "courier-new",
|
|
345960
|
-
logicalFamily: "Courier New",
|
|
345961
|
-
physicalFamily: "Liberation Mono",
|
|
345962
|
-
verdict: "metric_safe",
|
|
345963
|
-
faces: {
|
|
345964
|
-
regular: true,
|
|
345965
|
-
bold: true,
|
|
345966
|
-
italic: true,
|
|
345967
|
-
boldItalic: true
|
|
345968
|
-
},
|
|
345969
|
-
advance: {
|
|
345970
|
-
meanDelta: 0,
|
|
345971
|
-
maxDelta: 0
|
|
345972
|
-
},
|
|
345973
|
-
gates: {
|
|
345974
|
-
static: "pass",
|
|
345975
|
-
metric: "pass",
|
|
345976
|
-
layout: "not_run",
|
|
345977
|
-
ship: "pass"
|
|
345978
|
-
},
|
|
345979
|
-
policyAction: "substitute",
|
|
345980
|
-
measurementRefs: ["courier-new__liberation-mono#analytic_advance#2026-06-03"],
|
|
345981
|
-
candidateLicense: "OFL-1.1",
|
|
345982
|
-
exportRule: "preserve_original_name"
|
|
345983
|
-
},
|
|
345984
|
-
{
|
|
345985
|
-
evidenceId: "helvetica",
|
|
345986
|
-
logicalFamily: "Helvetica",
|
|
345987
|
-
physicalFamily: "Liberation Sans",
|
|
345988
|
-
verdict: "metric_safe",
|
|
345989
|
-
faces: {
|
|
345990
|
-
regular: true,
|
|
345991
|
-
bold: true,
|
|
345992
|
-
italic: true,
|
|
345993
|
-
boldItalic: true
|
|
345994
|
-
},
|
|
345995
|
-
advance: {
|
|
345996
|
-
meanDelta: 0,
|
|
345997
|
-
maxDelta: 0
|
|
345998
|
-
},
|
|
345999
|
-
gates: {
|
|
346000
|
-
static: "not_run",
|
|
346001
|
-
metric: "pass",
|
|
346002
|
-
layout: "not_run",
|
|
346003
|
-
ship: "fail"
|
|
346004
|
-
},
|
|
346005
|
-
policyAction: "substitute",
|
|
346006
|
-
measurementRefs: ["helvetica__liberation-sans#analytic_advance#2026-06-03"],
|
|
346007
|
-
candidateLicense: "OFL-1.1",
|
|
346008
|
-
exportRule: "preserve_original_name"
|
|
346009
|
-
},
|
|
346010
|
-
{
|
|
346011
|
-
evidenceId: "calibri-light",
|
|
346012
|
-
logicalFamily: "Calibri Light",
|
|
346013
|
-
physicalFamily: "Carlito",
|
|
346014
|
-
verdict: "visual_only",
|
|
346015
|
-
faces: {
|
|
346016
|
-
regular: false,
|
|
346017
|
-
bold: false,
|
|
346018
|
-
italic: false,
|
|
346019
|
-
boldItalic: false
|
|
346020
|
-
},
|
|
346021
|
-
advance: {
|
|
346022
|
-
meanDelta: 0.0148,
|
|
346023
|
-
maxDelta: 0.066
|
|
346024
|
-
},
|
|
346025
|
-
gates: {
|
|
346026
|
-
static: "not_run",
|
|
346027
|
-
metric: "fail",
|
|
346028
|
-
layout: "not_run",
|
|
346029
|
-
ship: "fail"
|
|
346030
|
-
},
|
|
346031
|
-
policyAction: "category_fallback",
|
|
346032
|
-
measurementRefs: ["calibri-light__carlito#analytic_advance#2026-06-05"],
|
|
346033
|
-
candidateLicense: "OFL-1.1",
|
|
346034
|
-
exportRule: "preserve_original_name"
|
|
346035
|
-
}
|
|
346036
|
-
]);
|
|
346037
|
-
BUNDLED_SUBSTITUTES = deriveBundledSubstitutes();
|
|
346038
|
-
CATEGORY_FALLBACKS = deriveCategoryFallbacks();
|
|
346039
|
-
defaultResolver = new FontResolver;
|
|
346040
|
-
DEFAULT_FONT_MEASURE_CONTEXT = Object.freeze({
|
|
346041
|
-
resolvePhysical: (cssFontFamily, _face) => resolvePhysicalFamily(cssFontFamily),
|
|
346042
|
-
fontSignature: ""
|
|
346043
|
-
});
|
|
346044
|
-
BUNDLED_MANIFEST = Object.freeze([
|
|
346045
|
-
family("Carlito", "Carlito", "OFL-1.1"),
|
|
346046
|
-
family("Caladea", "Caladea", "Apache-2.0"),
|
|
346047
|
-
family("Liberation Sans", "LiberationSans", "OFL-1.1"),
|
|
346048
|
-
family("Liberation Serif", "LiberationSerif", "OFL-1.1"),
|
|
346049
|
-
family("Liberation Mono", "LiberationMono", "OFL-1.1")
|
|
346050
|
-
]);
|
|
346051
|
-
installedRegistries = /* @__PURE__ */ new WeakMap;
|
|
346052
|
-
registriesByFontSet = /* @__PURE__ */ new WeakMap;
|
|
346053
346314
|
PX_PER_PT$12 = 96 / 72;
|
|
346054
346315
|
BORDER_SIDES2 = [
|
|
346055
346316
|
"top",
|
|
@@ -347335,7 +347596,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
347335
347596
|
});
|
|
347336
347597
|
#fontPlanBlocks = null;
|
|
347337
347598
|
#fontPlan = null;
|
|
347338
|
-
#hasFace = (
|
|
347599
|
+
#hasFace = (family2, weight, style2) => this.#fontGate ? this.#fontGate.resolveRegistry().hasFace(family2, weight, style2) : false;
|
|
347339
347600
|
#lastFontsChangedKey = null;
|
|
347340
347601
|
#lastFontsChangedVersion = -1;
|
|
347341
347602
|
#lastFontsChangedPayload = null;
|
|
@@ -347642,6 +347903,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
347642
347903
|
}
|
|
347643
347904
|
});
|
|
347644
347905
|
this.#fontController.applyInitialConfig(this.#options.fontAssets);
|
|
347906
|
+
this.#applyEmbeddedDocumentFonts();
|
|
347645
347907
|
if (typeof this.#options.disableContextMenu === "boolean")
|
|
347646
347908
|
this.setContextMenuDisabled(this.#options.disableContextMenu);
|
|
347647
347909
|
this.#setupHeaderFooterSession();
|
|
@@ -348647,6 +348909,10 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
348647
348909
|
async preloadFonts(families) {
|
|
348648
348910
|
await this.#fontController.preload(families);
|
|
348649
348911
|
}
|
|
348912
|
+
#applyEmbeddedDocumentFonts() {
|
|
348913
|
+
const converter = this.#editor.converter;
|
|
348914
|
+
this.#fontController.applyEmbeddedFaces(converter?.getEmbeddedFontFaces?.());
|
|
348915
|
+
}
|
|
348650
348916
|
#requestFontReflow() {
|
|
348651
348917
|
this.#layoutState = {
|
|
348652
348918
|
...this.#layoutState,
|
|
@@ -349942,6 +350208,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
349942
350208
|
this.#fontController.reset();
|
|
349943
350209
|
this.#layoutFontSignature = "";
|
|
349944
350210
|
this.#fontController.applyInitialConfig(this.#options.fontAssets);
|
|
350211
|
+
this.#applyEmbeddedDocumentFonts();
|
|
349945
350212
|
this.#resetFontReportStateForDocumentChange();
|
|
349946
350213
|
this.#refreshHeaderFooterStructureThenRerender({ purgeCachedEditors: true });
|
|
349947
350214
|
};
|
|
@@ -353911,11 +354178,251 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
353911
354178
|
]);
|
|
353912
354179
|
});
|
|
353913
354180
|
|
|
353914
|
-
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-
|
|
353915
|
-
var MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
|
|
353916
|
-
var
|
|
353917
|
-
|
|
353918
|
-
|
|
354181
|
+
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-B66Edat2.es.js
|
|
354182
|
+
var headlessToolbarConstants, MOD_ALIASES, ALT_ALIASES, CTRL_ALIASES, SHIFT_ALIASES, BUILTIN_CONTEXT_MENU_GROUPS, BUILTIN_GROUP_ORDER, RESERVED_PROXY_PROPERTY_NAMES, ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
|
|
354183
|
+
var init_create_super_doc_ui_B66Edat2_es = __esm(() => {
|
|
354184
|
+
init_SuperConverter_BVWG4qnQ_es();
|
|
354185
|
+
init_create_headless_toolbar_JvWvpCga_es();
|
|
354186
|
+
headlessToolbarConstants = {
|
|
354187
|
+
DEFAULT_TEXT_ALIGN_OPTIONS: [
|
|
354188
|
+
{
|
|
354189
|
+
label: "Left",
|
|
354190
|
+
value: "left"
|
|
354191
|
+
},
|
|
354192
|
+
{
|
|
354193
|
+
label: "Center",
|
|
354194
|
+
value: "center"
|
|
354195
|
+
},
|
|
354196
|
+
{
|
|
354197
|
+
label: "Right",
|
|
354198
|
+
value: "right"
|
|
354199
|
+
},
|
|
354200
|
+
{
|
|
354201
|
+
label: "Justify",
|
|
354202
|
+
value: "justify"
|
|
354203
|
+
}
|
|
354204
|
+
],
|
|
354205
|
+
DEFAULT_LINE_HEIGHT_OPTIONS: [
|
|
354206
|
+
{
|
|
354207
|
+
label: "1.00",
|
|
354208
|
+
value: 1
|
|
354209
|
+
},
|
|
354210
|
+
{
|
|
354211
|
+
label: "1.15",
|
|
354212
|
+
value: 1.15
|
|
354213
|
+
},
|
|
354214
|
+
{
|
|
354215
|
+
label: "1.50",
|
|
354216
|
+
value: 1.5
|
|
354217
|
+
},
|
|
354218
|
+
{
|
|
354219
|
+
label: "2.00",
|
|
354220
|
+
value: 2
|
|
354221
|
+
},
|
|
354222
|
+
{
|
|
354223
|
+
label: "2.50",
|
|
354224
|
+
value: 2.5
|
|
354225
|
+
},
|
|
354226
|
+
{
|
|
354227
|
+
label: "3.00",
|
|
354228
|
+
value: 3
|
|
354229
|
+
}
|
|
354230
|
+
],
|
|
354231
|
+
DEFAULT_ZOOM_OPTIONS: [
|
|
354232
|
+
{
|
|
354233
|
+
label: "50%",
|
|
354234
|
+
value: 50
|
|
354235
|
+
},
|
|
354236
|
+
{
|
|
354237
|
+
label: "75%",
|
|
354238
|
+
value: 75
|
|
354239
|
+
},
|
|
354240
|
+
{
|
|
354241
|
+
label: "90%",
|
|
354242
|
+
value: 90
|
|
354243
|
+
},
|
|
354244
|
+
{
|
|
354245
|
+
label: "100%",
|
|
354246
|
+
value: 100
|
|
354247
|
+
},
|
|
354248
|
+
{
|
|
354249
|
+
label: "125%",
|
|
354250
|
+
value: 125
|
|
354251
|
+
},
|
|
354252
|
+
{
|
|
354253
|
+
label: "150%",
|
|
354254
|
+
value: 150
|
|
354255
|
+
},
|
|
354256
|
+
{
|
|
354257
|
+
label: "200%",
|
|
354258
|
+
value: 200
|
|
354259
|
+
}
|
|
354260
|
+
],
|
|
354261
|
+
DEFAULT_DOCUMENT_MODE_OPTIONS: [
|
|
354262
|
+
{
|
|
354263
|
+
label: "Editing",
|
|
354264
|
+
value: "editing",
|
|
354265
|
+
description: "Edit document directly"
|
|
354266
|
+
},
|
|
354267
|
+
{
|
|
354268
|
+
label: "Suggesting",
|
|
354269
|
+
value: "suggesting",
|
|
354270
|
+
description: "Edits become suggestions"
|
|
354271
|
+
},
|
|
354272
|
+
{
|
|
354273
|
+
label: "Viewing",
|
|
354274
|
+
value: "viewing",
|
|
354275
|
+
description: "View clean version of document only"
|
|
354276
|
+
}
|
|
354277
|
+
],
|
|
354278
|
+
DEFAULT_FONT_SIZE_OPTIONS: [
|
|
354279
|
+
{
|
|
354280
|
+
label: "8",
|
|
354281
|
+
value: "8pt"
|
|
354282
|
+
},
|
|
354283
|
+
{
|
|
354284
|
+
label: "9",
|
|
354285
|
+
value: "9pt"
|
|
354286
|
+
},
|
|
354287
|
+
{
|
|
354288
|
+
label: "10",
|
|
354289
|
+
value: "10pt"
|
|
354290
|
+
},
|
|
354291
|
+
{
|
|
354292
|
+
label: "11",
|
|
354293
|
+
value: "11pt"
|
|
354294
|
+
},
|
|
354295
|
+
{
|
|
354296
|
+
label: "12",
|
|
354297
|
+
value: "12pt"
|
|
354298
|
+
},
|
|
354299
|
+
{
|
|
354300
|
+
label: "14",
|
|
354301
|
+
value: "14pt"
|
|
354302
|
+
},
|
|
354303
|
+
{
|
|
354304
|
+
label: "18",
|
|
354305
|
+
value: "18pt"
|
|
354306
|
+
},
|
|
354307
|
+
{
|
|
354308
|
+
label: "24",
|
|
354309
|
+
value: "24pt"
|
|
354310
|
+
},
|
|
354311
|
+
{
|
|
354312
|
+
label: "30",
|
|
354313
|
+
value: "30pt"
|
|
354314
|
+
},
|
|
354315
|
+
{
|
|
354316
|
+
label: "36",
|
|
354317
|
+
value: "36pt"
|
|
354318
|
+
},
|
|
354319
|
+
{
|
|
354320
|
+
label: "48",
|
|
354321
|
+
value: "48pt"
|
|
354322
|
+
},
|
|
354323
|
+
{
|
|
354324
|
+
label: "60",
|
|
354325
|
+
value: "60pt"
|
|
354326
|
+
},
|
|
354327
|
+
{
|
|
354328
|
+
label: "72",
|
|
354329
|
+
value: "72pt"
|
|
354330
|
+
},
|
|
354331
|
+
{
|
|
354332
|
+
label: "96",
|
|
354333
|
+
value: "96pt"
|
|
354334
|
+
}
|
|
354335
|
+
],
|
|
354336
|
+
DEFAULT_FONT_FAMILY_OPTIONS: getDefaultFontFamilyOptions(),
|
|
354337
|
+
DEFAULT_TEXT_COLOR_OPTIONS: [
|
|
354338
|
+
{
|
|
354339
|
+
label: "Black",
|
|
354340
|
+
value: "#000000"
|
|
354341
|
+
},
|
|
354342
|
+
{
|
|
354343
|
+
label: "Dark Gray",
|
|
354344
|
+
value: "#434343"
|
|
354345
|
+
},
|
|
354346
|
+
{
|
|
354347
|
+
label: "Gray",
|
|
354348
|
+
value: "#666666"
|
|
354349
|
+
},
|
|
354350
|
+
{
|
|
354351
|
+
label: "Light Gray",
|
|
354352
|
+
value: "#999999"
|
|
354353
|
+
},
|
|
354354
|
+
{
|
|
354355
|
+
label: "Red",
|
|
354356
|
+
value: "#ff0000"
|
|
354357
|
+
},
|
|
354358
|
+
{
|
|
354359
|
+
label: "Orange",
|
|
354360
|
+
value: "#ff9900"
|
|
354361
|
+
},
|
|
354362
|
+
{
|
|
354363
|
+
label: "Yellow",
|
|
354364
|
+
value: "#ffff00"
|
|
354365
|
+
},
|
|
354366
|
+
{
|
|
354367
|
+
label: "Green",
|
|
354368
|
+
value: "#00ff00"
|
|
354369
|
+
},
|
|
354370
|
+
{
|
|
354371
|
+
label: "Cyan",
|
|
354372
|
+
value: "#00ffff"
|
|
354373
|
+
},
|
|
354374
|
+
{
|
|
354375
|
+
label: "Blue",
|
|
354376
|
+
value: "#0000ff"
|
|
354377
|
+
},
|
|
354378
|
+
{
|
|
354379
|
+
label: "Purple",
|
|
354380
|
+
value: "#9900ff"
|
|
354381
|
+
},
|
|
354382
|
+
{
|
|
354383
|
+
label: "Magenta",
|
|
354384
|
+
value: "#ff00ff"
|
|
354385
|
+
},
|
|
354386
|
+
{
|
|
354387
|
+
label: "None",
|
|
354388
|
+
value: "none"
|
|
354389
|
+
}
|
|
354390
|
+
],
|
|
354391
|
+
DEFAULT_HIGHLIGHT_COLOR_OPTIONS: [
|
|
354392
|
+
{
|
|
354393
|
+
label: "Yellow",
|
|
354394
|
+
value: "#ffff00"
|
|
354395
|
+
},
|
|
354396
|
+
{
|
|
354397
|
+
label: "Green",
|
|
354398
|
+
value: "#00ff00"
|
|
354399
|
+
},
|
|
354400
|
+
{
|
|
354401
|
+
label: "Cyan",
|
|
354402
|
+
value: "#00ffff"
|
|
354403
|
+
},
|
|
354404
|
+
{
|
|
354405
|
+
label: "Pink",
|
|
354406
|
+
value: "#ff00ff"
|
|
354407
|
+
},
|
|
354408
|
+
{
|
|
354409
|
+
label: "Blue",
|
|
354410
|
+
value: "#0000ff"
|
|
354411
|
+
},
|
|
354412
|
+
{
|
|
354413
|
+
label: "Red",
|
|
354414
|
+
value: "#ff0000"
|
|
354415
|
+
},
|
|
354416
|
+
{
|
|
354417
|
+
label: "Orange",
|
|
354418
|
+
value: "#ff9900"
|
|
354419
|
+
},
|
|
354420
|
+
{
|
|
354421
|
+
label: "None",
|
|
354422
|
+
value: "none"
|
|
354423
|
+
}
|
|
354424
|
+
]
|
|
354425
|
+
};
|
|
353919
354426
|
MOD_ALIASES = new Set([
|
|
353920
354427
|
"Mod",
|
|
353921
354428
|
"Meta",
|
|
@@ -353957,16 +354464,16 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
|
|
|
353957
354464
|
|
|
353958
354465
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
353959
354466
|
var init_super_editor_es = __esm(() => {
|
|
353960
|
-
|
|
353961
|
-
|
|
354467
|
+
init_src_x_i3LADL_es();
|
|
354468
|
+
init_SuperConverter_BVWG4qnQ_es();
|
|
353962
354469
|
init_jszip_C49i9kUs_es();
|
|
353963
354470
|
init_xml_js_CqGKpaft_es();
|
|
353964
|
-
|
|
354471
|
+
init_create_headless_toolbar_JvWvpCga_es();
|
|
353965
354472
|
init_constants_D9qj59G2_es();
|
|
353966
354473
|
init_dist_B8HfvhaK_es();
|
|
353967
354474
|
init_unified_Dsuw2be5_es();
|
|
353968
354475
|
init_DocxZipper_Bu2Fhqkw_es();
|
|
353969
|
-
|
|
354476
|
+
init_create_super_doc_ui_B66Edat2_es();
|
|
353970
354477
|
init_ui_C5PAS9hY_es();
|
|
353971
354478
|
init_eventemitter3_BnGqBE_Q_es();
|
|
353972
354479
|
init_errors_CNaD6vcg_es();
|
|
@@ -422645,7 +423152,7 @@ var init_east_asian_regex = __esm(() => {
|
|
|
422645
423152
|
});
|
|
422646
423153
|
|
|
422647
423154
|
// ../../packages/super-editor/src/editors/v1/core/super-converter/v3/handlers/w/r/helpers/helpers.js
|
|
422648
|
-
var containsEastAsianCharacters2 = (text7) => EAST_ASIAN_CHARACTER_REGEX2.test(text7),
|
|
423155
|
+
var containsEastAsianCharacters2 = (text7) => EAST_ASIAN_CHARACTER_REGEX2.test(text7), resolveFontFamily2 = (textStyleAttrs, text7) => {
|
|
422649
423156
|
if (!text7)
|
|
422650
423157
|
return textStyleAttrs;
|
|
422651
423158
|
const eastAsiaFont = textStyleAttrs?.eastAsiaFontFamily;
|
|
@@ -424296,7 +424803,7 @@ var XML_NODE_NAME13 = "w:r", SD_KEY_NAME2 = "run", REFERENCE_RUN_STYLE_BY_XML_NA
|
|
|
424296
424803
|
if (seenTypes.has(mark2.type)) {
|
|
424297
424804
|
if (mark2.type === "textStyle") {
|
|
424298
424805
|
textStyleMark.attrs = { ...textStyleMark.attrs || {}, ...mark2.attrs || {} };
|
|
424299
|
-
textStyleMark.attrs =
|
|
424806
|
+
textStyleMark.attrs = resolveFontFamily2(textStyleMark.attrs, child?.text);
|
|
424300
424807
|
}
|
|
424301
424808
|
return false;
|
|
424302
424809
|
}
|
|
@@ -455437,6 +455944,788 @@ var init_exporter = __esm(() => {
|
|
|
455437
455944
|
});
|
|
455438
455945
|
});
|
|
455439
455946
|
|
|
455947
|
+
// ../../shared/font-system/src/types.ts
|
|
455948
|
+
var init_types8 = () => {};
|
|
455949
|
+
|
|
455950
|
+
// ../../shared/font-system/src/substitution-evidence.ts
|
|
455951
|
+
var SUBSTITUTION_EVIDENCE2;
|
|
455952
|
+
var init_substitution_evidence = __esm(() => {
|
|
455953
|
+
SUBSTITUTION_EVIDENCE2 = Object.freeze([
|
|
455954
|
+
{
|
|
455955
|
+
evidenceId: "calibri",
|
|
455956
|
+
logicalFamily: "Calibri",
|
|
455957
|
+
physicalFamily: "Carlito",
|
|
455958
|
+
verdict: "metric_safe",
|
|
455959
|
+
faces: { regular: true, bold: true, italic: true, boldItalic: true },
|
|
455960
|
+
advance: { meanDelta: 0, maxDelta: 0 },
|
|
455961
|
+
gates: { static: "pass", metric: "pass", layout: "pass", ship: "pass" },
|
|
455962
|
+
policyAction: "substitute",
|
|
455963
|
+
measurementRefs: ["calibri__carlito#analytic_advance#2026-06-03", "calibri__carlito#face_aggregate#2026-06-03"],
|
|
455964
|
+
candidateLicense: "OFL-1.1",
|
|
455965
|
+
exportRule: "preserve_original_name"
|
|
455966
|
+
},
|
|
455967
|
+
{
|
|
455968
|
+
evidenceId: "cambria",
|
|
455969
|
+
logicalFamily: "Cambria",
|
|
455970
|
+
physicalFamily: "Caladea",
|
|
455971
|
+
verdict: "visual_only",
|
|
455972
|
+
faceVerdicts: { regular: "metric_safe", bold: "metric_safe", italic: "metric_safe", boldItalic: "visual_only" },
|
|
455973
|
+
glyphExceptions: [
|
|
455974
|
+
{
|
|
455975
|
+
slot: "boldItalic",
|
|
455976
|
+
codepoint: 96,
|
|
455977
|
+
advanceDelta: 0.231,
|
|
455978
|
+
note: "Caladea Bold Italic grave accent (U+0060) advance diverges ~23% from Cambria; lines containing it reflow."
|
|
455979
|
+
}
|
|
455980
|
+
],
|
|
455981
|
+
faces: { regular: true, bold: true, italic: true, boldItalic: true },
|
|
455982
|
+
advance: { meanDelta: 0.0002378, maxDelta: 0.2310758 },
|
|
455983
|
+
gates: { static: "pass", metric: "pass", layout: "not_run", ship: "pass" },
|
|
455984
|
+
policyAction: "substitute",
|
|
455985
|
+
measurementRefs: [
|
|
455986
|
+
"cambria_regular__caladea#regular#w400#d2f6cad3#analytic_advance#2026-06-04",
|
|
455987
|
+
"cambria_bold__caladea#bold#w700#74eda4fc#analytic_advance#2026-06-04",
|
|
455988
|
+
"cambria_italic__caladea#italic#w400#9c968bf6#analytic_advance#2026-06-04",
|
|
455989
|
+
"cambria_boldItalic__caladea#boldItalic#w700#f47a35ad#analytic_advance#2026-06-04"
|
|
455990
|
+
],
|
|
455991
|
+
candidateLicense: "Apache-2.0",
|
|
455992
|
+
exportRule: "preserve_original_name"
|
|
455993
|
+
},
|
|
455994
|
+
{
|
|
455995
|
+
evidenceId: "arial",
|
|
455996
|
+
logicalFamily: "Arial",
|
|
455997
|
+
physicalFamily: "Liberation Sans",
|
|
455998
|
+
verdict: "metric_safe",
|
|
455999
|
+
faces: { regular: true, bold: true, italic: true, boldItalic: true },
|
|
456000
|
+
advance: { meanDelta: 0, maxDelta: 0 },
|
|
456001
|
+
gates: { static: "pass", metric: "pass", layout: "not_run", ship: "pass" },
|
|
456002
|
+
policyAction: "substitute",
|
|
456003
|
+
measurementRefs: ["arial__liberation-sans#analytic_advance#2026-06-03"],
|
|
456004
|
+
candidateLicense: "OFL-1.1",
|
|
456005
|
+
exportRule: "preserve_original_name"
|
|
456006
|
+
},
|
|
456007
|
+
{
|
|
456008
|
+
evidenceId: "times-new-roman",
|
|
456009
|
+
logicalFamily: "Times New Roman",
|
|
456010
|
+
physicalFamily: "Liberation Serif",
|
|
456011
|
+
verdict: "metric_safe",
|
|
456012
|
+
faces: { regular: true, bold: true, italic: true, boldItalic: true },
|
|
456013
|
+
advance: { meanDelta: 0, maxDelta: 0 },
|
|
456014
|
+
gates: { static: "pass", metric: "pass", layout: "not_run", ship: "pass" },
|
|
456015
|
+
policyAction: "substitute",
|
|
456016
|
+
measurementRefs: ["times-new-roman__liberation-serif#analytic_advance#2026-06-03"],
|
|
456017
|
+
candidateLicense: "OFL-1.1",
|
|
456018
|
+
exportRule: "preserve_original_name"
|
|
456019
|
+
},
|
|
456020
|
+
{
|
|
456021
|
+
evidenceId: "courier-new",
|
|
456022
|
+
logicalFamily: "Courier New",
|
|
456023
|
+
physicalFamily: "Liberation Mono",
|
|
456024
|
+
verdict: "metric_safe",
|
|
456025
|
+
faces: { regular: true, bold: true, italic: true, boldItalic: true },
|
|
456026
|
+
advance: { meanDelta: 0, maxDelta: 0 },
|
|
456027
|
+
gates: { static: "pass", metric: "pass", layout: "not_run", ship: "pass" },
|
|
456028
|
+
policyAction: "substitute",
|
|
456029
|
+
measurementRefs: ["courier-new__liberation-mono#analytic_advance#2026-06-03"],
|
|
456030
|
+
candidateLicense: "OFL-1.1",
|
|
456031
|
+
exportRule: "preserve_original_name"
|
|
456032
|
+
},
|
|
456033
|
+
{
|
|
456034
|
+
evidenceId: "helvetica",
|
|
456035
|
+
logicalFamily: "Helvetica",
|
|
456036
|
+
physicalFamily: "Liberation Sans",
|
|
456037
|
+
verdict: "metric_safe",
|
|
456038
|
+
faces: { regular: true, bold: true, italic: true, boldItalic: true },
|
|
456039
|
+
advance: { meanDelta: 0, maxDelta: 0 },
|
|
456040
|
+
gates: { static: "not_run", metric: "pass", layout: "not_run", ship: "fail" },
|
|
456041
|
+
policyAction: "substitute",
|
|
456042
|
+
measurementRefs: ["helvetica__liberation-sans#analytic_advance#2026-06-03"],
|
|
456043
|
+
candidateLicense: "OFL-1.1",
|
|
456044
|
+
exportRule: "preserve_original_name"
|
|
456045
|
+
},
|
|
456046
|
+
{
|
|
456047
|
+
evidenceId: "calibri-light",
|
|
456048
|
+
logicalFamily: "Calibri Light",
|
|
456049
|
+
physicalFamily: "Carlito",
|
|
456050
|
+
verdict: "visual_only",
|
|
456051
|
+
faces: { regular: false, bold: false, italic: false, boldItalic: false },
|
|
456052
|
+
advance: { meanDelta: 0.0148, maxDelta: 0.066 },
|
|
456053
|
+
gates: { static: "not_run", metric: "fail", layout: "not_run", ship: "fail" },
|
|
456054
|
+
policyAction: "category_fallback",
|
|
456055
|
+
measurementRefs: ["calibri-light__carlito#analytic_advance#2026-06-05"],
|
|
456056
|
+
candidateLicense: "OFL-1.1",
|
|
456057
|
+
exportRule: "preserve_original_name"
|
|
456058
|
+
}
|
|
456059
|
+
]);
|
|
456060
|
+
});
|
|
456061
|
+
|
|
456062
|
+
// ../../shared/font-system/src/resolver.ts
|
|
456063
|
+
function normalizeFamilyKey3(family2) {
|
|
456064
|
+
return family2.trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
456065
|
+
}
|
|
456066
|
+
function sortPairs2(pairs) {
|
|
456067
|
+
return pairs.sort(([a2], [b2]) => a2 < b2 ? -1 : a2 > b2 ? 1 : 0);
|
|
456068
|
+
}
|
|
456069
|
+
function deriveBundledSubstitutes2() {
|
|
456070
|
+
const substitutes = {};
|
|
456071
|
+
for (const row2 of SUBSTITUTION_EVIDENCE2) {
|
|
456072
|
+
if (row2.policyAction === "substitute" && row2.physicalFamily) {
|
|
456073
|
+
substitutes[normalizeFamilyKey3(row2.logicalFamily)] = row2.physicalFamily;
|
|
456074
|
+
}
|
|
456075
|
+
}
|
|
456076
|
+
return Object.freeze(substitutes);
|
|
456077
|
+
}
|
|
456078
|
+
function deriveCategoryFallbacks2() {
|
|
456079
|
+
const fallbacks = {};
|
|
456080
|
+
for (const row2 of SUBSTITUTION_EVIDENCE2) {
|
|
456081
|
+
if (row2.policyAction === "category_fallback" && row2.physicalFamily) {
|
|
456082
|
+
fallbacks[normalizeFamilyKey3(row2.logicalFamily)] = row2.physicalFamily;
|
|
456083
|
+
}
|
|
456084
|
+
}
|
|
456085
|
+
return Object.freeze(fallbacks);
|
|
456086
|
+
}
|
|
456087
|
+
function stripFamilyQuotes2(family2) {
|
|
456088
|
+
return family2.trim().replace(/^["']|["']$/g, "");
|
|
456089
|
+
}
|
|
456090
|
+
function splitStack2(cssFontFamily) {
|
|
456091
|
+
return cssFontFamily.split(",").map((part) => part.trim()).filter(Boolean);
|
|
456092
|
+
}
|
|
456093
|
+
|
|
456094
|
+
class FontResolver2 {
|
|
456095
|
+
#overrides = new Map;
|
|
456096
|
+
#embedded = new Map;
|
|
456097
|
+
#version = 0;
|
|
456098
|
+
#cachedSignature = null;
|
|
456099
|
+
map(logicalFamily, physicalFamily) {
|
|
456100
|
+
const key2 = normalizeFamilyKey3(logicalFamily);
|
|
456101
|
+
const physical = physicalFamily?.trim();
|
|
456102
|
+
if (!key2 || !physical)
|
|
456103
|
+
return;
|
|
456104
|
+
if (this.#overrides.get(key2) === physical)
|
|
456105
|
+
return;
|
|
456106
|
+
if (key2 === normalizeFamilyKey3(physical)) {
|
|
456107
|
+
if (this.#overrides.delete(key2)) {
|
|
456108
|
+
this.#version += 1;
|
|
456109
|
+
this.#cachedSignature = null;
|
|
456110
|
+
}
|
|
456111
|
+
return;
|
|
456112
|
+
}
|
|
456113
|
+
this.#overrides.set(key2, physical);
|
|
456114
|
+
this.#version += 1;
|
|
456115
|
+
this.#cachedSignature = null;
|
|
456116
|
+
}
|
|
456117
|
+
unmap(logicalFamily) {
|
|
456118
|
+
if (this.#overrides.delete(normalizeFamilyKey3(logicalFamily))) {
|
|
456119
|
+
this.#version += 1;
|
|
456120
|
+
this.#cachedSignature = null;
|
|
456121
|
+
}
|
|
456122
|
+
}
|
|
456123
|
+
mapEmbedded(logicalFamily, physicalFamily) {
|
|
456124
|
+
const key2 = normalizeFamilyKey3(logicalFamily);
|
|
456125
|
+
const physical = physicalFamily?.trim();
|
|
456126
|
+
if (!key2 || !physical)
|
|
456127
|
+
return;
|
|
456128
|
+
if (this.#embedded.get(key2) === physical)
|
|
456129
|
+
return;
|
|
456130
|
+
this.#embedded.set(key2, physical);
|
|
456131
|
+
this.#version += 1;
|
|
456132
|
+
this.#cachedSignature = null;
|
|
456133
|
+
}
|
|
456134
|
+
clearEmbedded() {
|
|
456135
|
+
if (this.#embedded.size === 0)
|
|
456136
|
+
return;
|
|
456137
|
+
this.#embedded.clear();
|
|
456138
|
+
this.#version += 1;
|
|
456139
|
+
this.#cachedSignature = null;
|
|
456140
|
+
}
|
|
456141
|
+
reset() {
|
|
456142
|
+
if (this.#overrides.size === 0 && this.#embedded.size === 0)
|
|
456143
|
+
return;
|
|
456144
|
+
this.#overrides.clear();
|
|
456145
|
+
this.#embedded.clear();
|
|
456146
|
+
this.#version += 1;
|
|
456147
|
+
this.#cachedSignature = null;
|
|
456148
|
+
}
|
|
456149
|
+
get version() {
|
|
456150
|
+
return this.#version;
|
|
456151
|
+
}
|
|
456152
|
+
get signature() {
|
|
456153
|
+
if (this.#cachedSignature !== null)
|
|
456154
|
+
return this.#cachedSignature;
|
|
456155
|
+
if (this.#overrides.size === 0 && this.#embedded.size === 0) {
|
|
456156
|
+
this.#cachedSignature = "";
|
|
456157
|
+
} else {
|
|
456158
|
+
const overridePairs = sortPairs2([...this.#overrides.entries()]);
|
|
456159
|
+
this.#cachedSignature = this.#embedded.size === 0 ? JSON.stringify(overridePairs) : JSON.stringify({ o: overridePairs, e: sortPairs2([...this.#embedded.entries()]) });
|
|
456160
|
+
}
|
|
456161
|
+
return this.#cachedSignature;
|
|
456162
|
+
}
|
|
456163
|
+
#physicalFor(bareFamily) {
|
|
456164
|
+
const key2 = normalizeFamilyKey3(bareFamily);
|
|
456165
|
+
const override = this.#overrides.get(key2);
|
|
456166
|
+
if (override)
|
|
456167
|
+
return { physical: override, reason: "custom_mapping" };
|
|
456168
|
+
const bundled = BUNDLED_SUBSTITUTES2[key2];
|
|
456169
|
+
if (bundled)
|
|
456170
|
+
return { physical: bundled, reason: "bundled_substitute" };
|
|
456171
|
+
const category = CATEGORY_FALLBACKS2[key2];
|
|
456172
|
+
if (category)
|
|
456173
|
+
return { physical: category, reason: "category_fallback" };
|
|
456174
|
+
return { physical: bareFamily, reason: "as_requested" };
|
|
456175
|
+
}
|
|
456176
|
+
#resolveFaceLadder(primary, face, hasFace) {
|
|
456177
|
+
const key2 = normalizeFamilyKey3(primary);
|
|
456178
|
+
const override = this.#overrides.get(key2);
|
|
456179
|
+
if (override && hasFace(override, face.weight, face.style)) {
|
|
456180
|
+
return { physical: override, reason: "custom_mapping" };
|
|
456181
|
+
}
|
|
456182
|
+
const embedded2 = this.#embedded.get(key2);
|
|
456183
|
+
if (embedded2 && hasFace(embedded2, face.weight, face.style)) {
|
|
456184
|
+
return { physical: embedded2, reason: "registered_face" };
|
|
456185
|
+
}
|
|
456186
|
+
if (hasFace(primary, face.weight, face.style)) {
|
|
456187
|
+
return { physical: primary, reason: "registered_face" };
|
|
456188
|
+
}
|
|
456189
|
+
const bundled = BUNDLED_SUBSTITUTES2[key2];
|
|
456190
|
+
if (bundled && hasFace(bundled, face.weight, face.style)) {
|
|
456191
|
+
return { physical: bundled, reason: "bundled_substitute" };
|
|
456192
|
+
}
|
|
456193
|
+
const category = CATEGORY_FALLBACKS2[key2];
|
|
456194
|
+
if (category && hasFace(category, face.weight, face.style)) {
|
|
456195
|
+
return { physical: category, reason: "category_fallback" };
|
|
456196
|
+
}
|
|
456197
|
+
if (override || bundled) {
|
|
456198
|
+
return { physical: primary, reason: "fallback_face_absent" };
|
|
456199
|
+
}
|
|
456200
|
+
return { physical: primary, reason: "as_requested" };
|
|
456201
|
+
}
|
|
456202
|
+
resolveFontFamily(logicalFamily) {
|
|
456203
|
+
const parts = splitStack2(logicalFamily);
|
|
456204
|
+
const primary = parts[0] ?? logicalFamily;
|
|
456205
|
+
const { physical, reason } = this.#physicalFor(primary);
|
|
456206
|
+
return { logicalFamily, physicalFamily: stripFamilyQuotes2(physical), reason };
|
|
456207
|
+
}
|
|
456208
|
+
resolvePhysicalFamily(cssFontFamily) {
|
|
456209
|
+
if (!cssFontFamily)
|
|
456210
|
+
return cssFontFamily;
|
|
456211
|
+
const parts = splitStack2(cssFontFamily);
|
|
456212
|
+
if (parts.length === 0)
|
|
456213
|
+
return cssFontFamily;
|
|
456214
|
+
const { physical, reason } = this.#physicalFor(parts[0]);
|
|
456215
|
+
if (reason === "as_requested")
|
|
456216
|
+
return cssFontFamily;
|
|
456217
|
+
return [physical, ...parts.slice(1)].join(", ");
|
|
456218
|
+
}
|
|
456219
|
+
resolveFace(logicalFamily, face, hasFace) {
|
|
456220
|
+
const parts = splitStack2(logicalFamily);
|
|
456221
|
+
const primary = parts[0] ?? logicalFamily;
|
|
456222
|
+
const { physical, reason } = this.#resolveFaceLadder(primary, face, hasFace);
|
|
456223
|
+
return { logicalFamily, physicalFamily: stripFamilyQuotes2(physical), reason };
|
|
456224
|
+
}
|
|
456225
|
+
resolvePhysicalFamilyForFace(cssFontFamily, face, hasFace) {
|
|
456226
|
+
if (!cssFontFamily)
|
|
456227
|
+
return cssFontFamily;
|
|
456228
|
+
const parts = splitStack2(cssFontFamily);
|
|
456229
|
+
if (parts.length === 0)
|
|
456230
|
+
return cssFontFamily;
|
|
456231
|
+
const { physical } = this.#resolveFaceLadder(parts[0], face, hasFace);
|
|
456232
|
+
if (normalizeFamilyKey3(physical) !== normalizeFamilyKey3(parts[0])) {
|
|
456233
|
+
return [physical, ...parts.slice(1)].join(", ");
|
|
456234
|
+
}
|
|
456235
|
+
return cssFontFamily;
|
|
456236
|
+
}
|
|
456237
|
+
resolvePrimaryPhysicalFamily(family2) {
|
|
456238
|
+
const parts = splitStack2(family2);
|
|
456239
|
+
const primary = parts[0] ?? family2;
|
|
456240
|
+
return this.#physicalFor(primary).physical;
|
|
456241
|
+
}
|
|
456242
|
+
resolvePhysicalFamilies(families) {
|
|
456243
|
+
const out = new Set;
|
|
456244
|
+
for (const family2 of families) {
|
|
456245
|
+
if (family2)
|
|
456246
|
+
out.add(this.resolvePrimaryPhysicalFamily(family2));
|
|
456247
|
+
}
|
|
456248
|
+
return [...out];
|
|
456249
|
+
}
|
|
456250
|
+
}
|
|
456251
|
+
function resolvePhysicalFamily2(cssFontFamily) {
|
|
456252
|
+
return defaultResolver2.resolvePhysicalFamily(cssFontFamily);
|
|
456253
|
+
}
|
|
456254
|
+
var BUNDLED_SUBSTITUTES2, CATEGORY_FALLBACKS2, defaultResolver2, DEFAULT_FONT_MEASURE_CONTEXT2;
|
|
456255
|
+
var init_resolver = __esm(() => {
|
|
456256
|
+
init_substitution_evidence();
|
|
456257
|
+
BUNDLED_SUBSTITUTES2 = deriveBundledSubstitutes2();
|
|
456258
|
+
CATEGORY_FALLBACKS2 = deriveCategoryFallbacks2();
|
|
456259
|
+
defaultResolver2 = new FontResolver2;
|
|
456260
|
+
DEFAULT_FONT_MEASURE_CONTEXT2 = Object.freeze({
|
|
456261
|
+
resolvePhysical: (cssFontFamily, _face) => resolvePhysicalFamily2(cssFontFamily),
|
|
456262
|
+
fontSignature: ""
|
|
456263
|
+
});
|
|
456264
|
+
});
|
|
456265
|
+
// ../../shared/font-system/src/bundled-manifest.ts
|
|
456266
|
+
function fourFaces2(filePrefix) {
|
|
456267
|
+
return [
|
|
456268
|
+
{ weight: "normal", style: "normal", file: `${filePrefix}-Regular.woff2` },
|
|
456269
|
+
{ weight: "bold", style: "normal", file: `${filePrefix}-Bold.woff2` },
|
|
456270
|
+
{ weight: "normal", style: "italic", file: `${filePrefix}-Italic.woff2` },
|
|
456271
|
+
{ weight: "bold", style: "italic", file: `${filePrefix}-BoldItalic.woff2` }
|
|
456272
|
+
];
|
|
456273
|
+
}
|
|
456274
|
+
function family2(name, filePrefix, license) {
|
|
456275
|
+
return { family: name, license, faces: fourFaces2(filePrefix) };
|
|
456276
|
+
}
|
|
456277
|
+
var BUNDLED_MANIFEST2;
|
|
456278
|
+
var init_bundled_manifest = __esm(() => {
|
|
456279
|
+
BUNDLED_MANIFEST2 = Object.freeze([
|
|
456280
|
+
family2("Carlito", "Carlito", "OFL-1.1"),
|
|
456281
|
+
family2("Caladea", "Caladea", "Apache-2.0"),
|
|
456282
|
+
family2("Liberation Sans", "LiberationSans", "OFL-1.1"),
|
|
456283
|
+
family2("Liberation Serif", "LiberationSerif", "OFL-1.1"),
|
|
456284
|
+
family2("Liberation Mono", "LiberationMono", "OFL-1.1")
|
|
456285
|
+
]);
|
|
456286
|
+
});
|
|
456287
|
+
|
|
456288
|
+
// ../../shared/font-system/src/bundled.ts
|
|
456289
|
+
var installedRegistries2;
|
|
456290
|
+
var init_bundled = __esm(() => {
|
|
456291
|
+
init_bundled_manifest();
|
|
456292
|
+
init_bundled_manifest();
|
|
456293
|
+
installedRegistries2 = new WeakMap;
|
|
456294
|
+
});
|
|
456295
|
+
|
|
456296
|
+
// ../../shared/font-system/src/report.ts
|
|
456297
|
+
var init_report = __esm(() => {
|
|
456298
|
+
init_resolver();
|
|
456299
|
+
init_types8();
|
|
456300
|
+
});
|
|
456301
|
+
|
|
456302
|
+
// ../../shared/font-system/src/os2.ts
|
|
456303
|
+
function parseEmbeddingPolicy2(bytes) {
|
|
456304
|
+
const view = bytes instanceof ArrayBuffer ? new DataView(bytes) : new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
456305
|
+
if (view.byteLength < SFNT_TABLE_DIR_OFFSET2)
|
|
456306
|
+
return null;
|
|
456307
|
+
const numTables = view.getUint16(4);
|
|
456308
|
+
let os2Offset = -1;
|
|
456309
|
+
for (let i5 = 0;i5 < numTables; i5 += 1) {
|
|
456310
|
+
const record3 = SFNT_TABLE_DIR_OFFSET2 + i5 * SFNT_TABLE_RECORD_SIZE2;
|
|
456311
|
+
if (record3 + SFNT_TABLE_RECORD_SIZE2 > view.byteLength)
|
|
456312
|
+
return null;
|
|
456313
|
+
const tag = String.fromCharCode(view.getUint8(record3), view.getUint8(record3 + 1), view.getUint8(record3 + 2), view.getUint8(record3 + 3));
|
|
456314
|
+
if (tag === "OS/2") {
|
|
456315
|
+
os2Offset = view.getUint32(record3 + 8);
|
|
456316
|
+
break;
|
|
456317
|
+
}
|
|
456318
|
+
}
|
|
456319
|
+
if (os2Offset < 0 || os2Offset + OS2_MIN_LENGTH2 > view.byteLength)
|
|
456320
|
+
return null;
|
|
456321
|
+
const usWeightClass = view.getUint16(os2Offset + OS2_USWEIGHTCLASS2);
|
|
456322
|
+
const fsType = view.getUint16(os2Offset + OS2_FSTYPE2);
|
|
456323
|
+
const fsSelection = view.getUint16(os2Offset + OS2_FSSELECTION2);
|
|
456324
|
+
const weight = usWeightClass >= BOLD_WEIGHT_THRESHOLD2 ? "700" : "400";
|
|
456325
|
+
const style2 = (fsSelection & FS_SELECTION_ITALIC2) !== 0 ? "italic" : "normal";
|
|
456326
|
+
return {
|
|
456327
|
+
fsType,
|
|
456328
|
+
face: { weight, style: style2 },
|
|
456329
|
+
embeddable: (fsType & FS_TYPE_RESTRICTED2) === 0
|
|
456330
|
+
};
|
|
456331
|
+
}
|
|
456332
|
+
var FS_TYPE_RESTRICTED2 = 2, FS_SELECTION_ITALIC2 = 1, BOLD_WEIGHT_THRESHOLD2 = 600, SFNT_TABLE_DIR_OFFSET2 = 12, SFNT_TABLE_RECORD_SIZE2 = 16, OS2_USWEIGHTCLASS2 = 4, OS2_FSTYPE2 = 8, OS2_FSSELECTION2 = 62, OS2_MIN_LENGTH2;
|
|
456333
|
+
var init_os2 = __esm(() => {
|
|
456334
|
+
OS2_MIN_LENGTH2 = OS2_FSSELECTION2 + 2;
|
|
456335
|
+
});
|
|
456336
|
+
|
|
456337
|
+
// ../../shared/font-system/src/registry.ts
|
|
456338
|
+
function quoteFamily2(family3) {
|
|
456339
|
+
return `"${family3.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
456340
|
+
}
|
|
456341
|
+
function canonicalizeFontSource2(source) {
|
|
456342
|
+
const match2 = /^\s*url\(\s*([\s\S]*?)\s*\)\s*$/i.exec(source);
|
|
456343
|
+
if (!match2)
|
|
456344
|
+
return source;
|
|
456345
|
+
let inner = match2[1].trim();
|
|
456346
|
+
if (inner.startsWith('"') && inner.endsWith('"') || inner.startsWith("'") && inner.endsWith("'")) {
|
|
456347
|
+
inner = inner.slice(1, -1);
|
|
456348
|
+
}
|
|
456349
|
+
return `url(${JSON.stringify(inner)})`;
|
|
456350
|
+
}
|
|
456351
|
+
function normalizeFamilyKey4(family3) {
|
|
456352
|
+
return family3.trim().replace(/^["']|["']$/g, "").toLowerCase();
|
|
456353
|
+
}
|
|
456354
|
+
function normalizeWeight2(weight) {
|
|
456355
|
+
if (weight === undefined)
|
|
456356
|
+
return "400";
|
|
456357
|
+
const w = String(weight).trim().toLowerCase();
|
|
456358
|
+
if (w === "bold" || w === "bolder")
|
|
456359
|
+
return "700";
|
|
456360
|
+
const n = Number(w);
|
|
456361
|
+
return Number.isFinite(n) && n >= 600 ? "700" : "400";
|
|
456362
|
+
}
|
|
456363
|
+
function normalizeStyle3(style2) {
|
|
456364
|
+
if (!style2)
|
|
456365
|
+
return "normal";
|
|
456366
|
+
const s2 = style2.trim().toLowerCase();
|
|
456367
|
+
return s2.startsWith("italic") || s2.startsWith("oblique") ? "italic" : "normal";
|
|
456368
|
+
}
|
|
456369
|
+
function faceKeyOf3(family3, weight, style2) {
|
|
456370
|
+
return `${normalizeFamilyKey4(family3)}|${weight}|${style2}`;
|
|
456371
|
+
}
|
|
456372
|
+
function faceProbe2(family3, weight, style2, size3) {
|
|
456373
|
+
const stylePart = style2 === "italic" ? "italic " : "";
|
|
456374
|
+
return `${stylePart}${weight} ${size3} ${quoteFamily2(family3)}`;
|
|
456375
|
+
}
|
|
456376
|
+
|
|
456377
|
+
class FontRegistry2 {
|
|
456378
|
+
#fontSet;
|
|
456379
|
+
#FontFaceCtor;
|
|
456380
|
+
#probeSize;
|
|
456381
|
+
#scheduleTimeout;
|
|
456382
|
+
#cancelTimeout;
|
|
456383
|
+
#managed = new Map;
|
|
456384
|
+
#facesByKey = new Map;
|
|
456385
|
+
#status = new Map;
|
|
456386
|
+
#sources = new Map;
|
|
456387
|
+
#warnedFailures = new Set;
|
|
456388
|
+
#inflight = new Map;
|
|
456389
|
+
#faceStatus = new Map;
|
|
456390
|
+
#faceInflight = new Map;
|
|
456391
|
+
#faceSources = new Map;
|
|
456392
|
+
#facesByFamily = new Map;
|
|
456393
|
+
#providerFaceKeys = new Set;
|
|
456394
|
+
#warnedFaceFailures = new Set;
|
|
456395
|
+
constructor(options = {}) {
|
|
456396
|
+
this.#fontSet = options.fontSet ?? null;
|
|
456397
|
+
this.#FontFaceCtor = options.FontFaceCtor ?? null;
|
|
456398
|
+
this.#probeSize = options.probeSize ?? DEFAULT_PROBE_SIZE2;
|
|
456399
|
+
this.#scheduleTimeout = options.scheduleTimeout ?? ((cb, ms) => globalThis.setTimeout(cb, ms));
|
|
456400
|
+
this.#cancelTimeout = options.cancelTimeout ?? ((handle4) => globalThis.clearTimeout(handle4));
|
|
456401
|
+
}
|
|
456402
|
+
register(descriptor) {
|
|
456403
|
+
const { family: family3, source, descriptors: descriptors3 } = descriptor;
|
|
456404
|
+
const identitySource = typeof source === "string" ? canonicalizeFontSource2(source) : source;
|
|
456405
|
+
const weight = normalizeWeight2(descriptors3?.weight);
|
|
456406
|
+
const style2 = normalizeStyle3(descriptors3?.style);
|
|
456407
|
+
const key2 = faceKeyOf3(family3, weight, style2);
|
|
456408
|
+
if (typeof identitySource === "string") {
|
|
456409
|
+
const existingSource = this.#faceSources.get(key2);
|
|
456410
|
+
if (existingSource === identitySource)
|
|
456411
|
+
return { family: family3, status: this.getStatus(family3), changed: false };
|
|
456412
|
+
if (existingSource !== undefined) {
|
|
456413
|
+
throw new Error(`[superdoc] font face "${key2}" is already registered from a different source ` + `("${existingSource}"); a registered face's source cannot be replaced`);
|
|
456414
|
+
}
|
|
456415
|
+
}
|
|
456416
|
+
if (this.#FontFaceCtor && this.#fontSet) {
|
|
456417
|
+
const face = new this.#FontFaceCtor(family3, source, { ...descriptors3, weight, style: style2 });
|
|
456418
|
+
this.#fontSet.add(face);
|
|
456419
|
+
this.#addManagedFace(family3, key2, face);
|
|
456420
|
+
}
|
|
456421
|
+
if (typeof source === "string") {
|
|
456422
|
+
const list8 = this.#sources.get(family3) ?? [];
|
|
456423
|
+
if (!list8.includes(source))
|
|
456424
|
+
list8.push(source);
|
|
456425
|
+
this.#sources.set(family3, list8);
|
|
456426
|
+
}
|
|
456427
|
+
if (!this.#status.has(family3))
|
|
456428
|
+
this.#status.set(family3, "unloaded");
|
|
456429
|
+
this.#providerFaceKeys.add(key2);
|
|
456430
|
+
this.#trackFace(family3, key2);
|
|
456431
|
+
if (!this.#faceStatus.has(key2))
|
|
456432
|
+
this.#faceStatus.set(key2, "unloaded");
|
|
456433
|
+
if (typeof identitySource === "string" && !this.#faceSources.has(key2))
|
|
456434
|
+
this.#faceSources.set(key2, identitySource);
|
|
456435
|
+
return { family: family3, status: this.getStatus(family3), changed: true };
|
|
456436
|
+
}
|
|
456437
|
+
#trackFace(family3, key2) {
|
|
456438
|
+
const fam = normalizeFamilyKey4(family3);
|
|
456439
|
+
const set3 = this.#facesByFamily.get(fam) ?? new Set;
|
|
456440
|
+
set3.add(key2);
|
|
456441
|
+
this.#facesByFamily.set(fam, set3);
|
|
456442
|
+
}
|
|
456443
|
+
isManaged(family3) {
|
|
456444
|
+
return this.#managed.has(family3);
|
|
456445
|
+
}
|
|
456446
|
+
registerOwnedFace(descriptor) {
|
|
456447
|
+
const { family: family3, source, weight, style: style2 } = descriptor;
|
|
456448
|
+
if (!this.#FontFaceCtor || !this.#fontSet)
|
|
456449
|
+
return null;
|
|
456450
|
+
const key2 = faceKeyOf3(family3, weight, style2);
|
|
456451
|
+
const face = new this.#FontFaceCtor(family3, source, { weight, style: style2 });
|
|
456452
|
+
this.#fontSet.add(face);
|
|
456453
|
+
this.#addManagedFace(family3, key2, face);
|
|
456454
|
+
this.#providerFaceKeys.add(key2);
|
|
456455
|
+
if (!this.#status.has(family3))
|
|
456456
|
+
this.#status.set(family3, "unloaded");
|
|
456457
|
+
this.#trackFace(family3, key2);
|
|
456458
|
+
if (!this.#faceStatus.has(key2))
|
|
456459
|
+
this.#faceStatus.set(key2, "unloaded");
|
|
456460
|
+
let released = false;
|
|
456461
|
+
return () => {
|
|
456462
|
+
if (released)
|
|
456463
|
+
return false;
|
|
456464
|
+
released = true;
|
|
456465
|
+
return this.#removeManagedFace(family3, key2, face);
|
|
456466
|
+
};
|
|
456467
|
+
}
|
|
456468
|
+
#addManagedFace(family3, key2, face) {
|
|
456469
|
+
this.#managed.set(family3, face);
|
|
456470
|
+
let set3 = this.#facesByKey.get(key2);
|
|
456471
|
+
if (!set3) {
|
|
456472
|
+
set3 = new Set;
|
|
456473
|
+
this.#facesByKey.set(key2, set3);
|
|
456474
|
+
}
|
|
456475
|
+
set3.add(face);
|
|
456476
|
+
}
|
|
456477
|
+
#removeManagedFace(family3, key2, face) {
|
|
456478
|
+
const set3 = this.#facesByKey.get(key2);
|
|
456479
|
+
if (!set3 || !set3.delete(face))
|
|
456480
|
+
return false;
|
|
456481
|
+
if (typeof this.#fontSet?.delete === "function")
|
|
456482
|
+
this.#fontSet.delete(face);
|
|
456483
|
+
if (set3.size > 0)
|
|
456484
|
+
return true;
|
|
456485
|
+
this.#facesByKey.delete(key2);
|
|
456486
|
+
this.#providerFaceKeys.delete(key2);
|
|
456487
|
+
this.#faceStatus.delete(key2);
|
|
456488
|
+
this.#faceSources.delete(key2);
|
|
456489
|
+
const fam = normalizeFamilyKey4(family3);
|
|
456490
|
+
const keys7 = this.#facesByFamily.get(fam);
|
|
456491
|
+
if (keys7) {
|
|
456492
|
+
keys7.delete(key2);
|
|
456493
|
+
if (keys7.size === 0) {
|
|
456494
|
+
this.#facesByFamily.delete(fam);
|
|
456495
|
+
this.#managed.delete(family3);
|
|
456496
|
+
this.#status.delete(family3);
|
|
456497
|
+
this.#sources.delete(family3);
|
|
456498
|
+
}
|
|
456499
|
+
}
|
|
456500
|
+
return true;
|
|
456501
|
+
}
|
|
456502
|
+
getStatus(family3) {
|
|
456503
|
+
const statuses = [];
|
|
456504
|
+
const faceKeys = this.#facesByFamily.get(normalizeFamilyKey4(family3));
|
|
456505
|
+
if (faceKeys)
|
|
456506
|
+
for (const k2 of faceKeys)
|
|
456507
|
+
statuses.push(this.#faceStatus.get(k2) ?? "unloaded");
|
|
456508
|
+
const legacy = this.#status.get(family3);
|
|
456509
|
+
if (legacy)
|
|
456510
|
+
statuses.push(legacy);
|
|
456511
|
+
if (statuses.length === 0)
|
|
456512
|
+
return "unloaded";
|
|
456513
|
+
const priority = ["failed", "timed_out", "fallback_used", "loaded", "loading", "unloaded"];
|
|
456514
|
+
for (const s2 of priority)
|
|
456515
|
+
if (statuses.includes(s2))
|
|
456516
|
+
return s2;
|
|
456517
|
+
return "unloaded";
|
|
456518
|
+
}
|
|
456519
|
+
hasFace(family3, weight, style2) {
|
|
456520
|
+
const key2 = faceKeyOf3(family3, weight, style2);
|
|
456521
|
+
return this.#providerFaceKeys.has(key2) && this.#faceStatus.get(key2) !== "failed";
|
|
456522
|
+
}
|
|
456523
|
+
isAvailable(family3) {
|
|
456524
|
+
if (!this.#fontSet)
|
|
456525
|
+
return false;
|
|
456526
|
+
try {
|
|
456527
|
+
return this.#fontSet.check(`${this.#probeSize} ${quoteFamily2(family3)}`);
|
|
456528
|
+
} catch {
|
|
456529
|
+
return false;
|
|
456530
|
+
}
|
|
456531
|
+
}
|
|
456532
|
+
awaitFace(family3, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS2) {
|
|
456533
|
+
if (this.#status.get(family3) === "loaded") {
|
|
456534
|
+
return Promise.resolve({ family: family3, status: "loaded" });
|
|
456535
|
+
}
|
|
456536
|
+
const existing = this.#inflight.get(family3);
|
|
456537
|
+
if (existing)
|
|
456538
|
+
return existing;
|
|
456539
|
+
const probe = this.#loadOne(family3, timeoutMs).finally(() => {
|
|
456540
|
+
this.#inflight.delete(family3);
|
|
456541
|
+
});
|
|
456542
|
+
this.#inflight.set(family3, probe);
|
|
456543
|
+
return probe;
|
|
456544
|
+
}
|
|
456545
|
+
async awaitFaces(families, options = {}) {
|
|
456546
|
+
const unique2 = [...new Set(families)];
|
|
456547
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_FONT_LOAD_TIMEOUT_MS2;
|
|
456548
|
+
return Promise.all(unique2.map((family3) => this.awaitFace(family3, timeoutMs)));
|
|
456549
|
+
}
|
|
456550
|
+
getRequiredFaces(families, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS2) {
|
|
456551
|
+
return [...new Set(families)].map((family3) => ({
|
|
456552
|
+
family: family3,
|
|
456553
|
+
status: this.getStatus(family3),
|
|
456554
|
+
ready: this.awaitFace(family3, timeoutMs)
|
|
456555
|
+
}));
|
|
456556
|
+
}
|
|
456557
|
+
getStates() {
|
|
456558
|
+
return [...this.#status.entries()].map(([family3, status]) => ({ family: family3, status }));
|
|
456559
|
+
}
|
|
456560
|
+
getFaceStatus(request) {
|
|
456561
|
+
return this.#faceStatus.get(faceKeyOf3(request.family, request.weight, request.style)) ?? "unloaded";
|
|
456562
|
+
}
|
|
456563
|
+
awaitFaceRequest(request, timeoutMs = DEFAULT_FONT_LOAD_TIMEOUT_MS2) {
|
|
456564
|
+
const key2 = faceKeyOf3(request.family, request.weight, request.style);
|
|
456565
|
+
if (this.#faceStatus.get(key2) === "loaded") {
|
|
456566
|
+
return Promise.resolve({ request, status: "loaded" });
|
|
456567
|
+
}
|
|
456568
|
+
const existing = this.#faceInflight.get(key2);
|
|
456569
|
+
if (existing)
|
|
456570
|
+
return existing;
|
|
456571
|
+
const probe = this.#loadOneFace(request, key2, timeoutMs).finally(() => {
|
|
456572
|
+
this.#faceInflight.delete(key2);
|
|
456573
|
+
});
|
|
456574
|
+
this.#faceInflight.set(key2, probe);
|
|
456575
|
+
return probe;
|
|
456576
|
+
}
|
|
456577
|
+
async awaitFaceRequests(requests, options = {}) {
|
|
456578
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_FONT_LOAD_TIMEOUT_MS2;
|
|
456579
|
+
const seen = new Set;
|
|
456580
|
+
const unique2 = [];
|
|
456581
|
+
for (const r2 of requests) {
|
|
456582
|
+
const key2 = faceKeyOf3(r2.family, r2.weight, r2.style);
|
|
456583
|
+
if (seen.has(key2))
|
|
456584
|
+
continue;
|
|
456585
|
+
seen.add(key2);
|
|
456586
|
+
unique2.push(r2);
|
|
456587
|
+
}
|
|
456588
|
+
return Promise.all(unique2.map((r2) => this.awaitFaceRequest(r2, timeoutMs)));
|
|
456589
|
+
}
|
|
456590
|
+
async#loadOneFace(request, key2, timeoutMs) {
|
|
456591
|
+
this.#trackFace(request.family, key2);
|
|
456592
|
+
const fontSet = this.#fontSet;
|
|
456593
|
+
if (!fontSet) {
|
|
456594
|
+
this.#faceStatus.set(key2, "fallback_used");
|
|
456595
|
+
return { request, status: "fallback_used" };
|
|
456596
|
+
}
|
|
456597
|
+
this.#faceStatus.set(key2, "loading");
|
|
456598
|
+
const probe = faceProbe2(request.family, request.weight, request.style, this.#probeSize);
|
|
456599
|
+
const TIMEOUT = Symbol("timeout");
|
|
456600
|
+
let handle4;
|
|
456601
|
+
const timeout2 = new Promise((resolve2) => {
|
|
456602
|
+
handle4 = this.#scheduleTimeout(() => resolve2(TIMEOUT), timeoutMs);
|
|
456603
|
+
});
|
|
456604
|
+
try {
|
|
456605
|
+
const settled = await Promise.race([fontSet.load(probe), timeout2]);
|
|
456606
|
+
if (settled === TIMEOUT) {
|
|
456607
|
+
this.#faceStatus.set(key2, "timed_out");
|
|
456608
|
+
return { request, status: "timed_out" };
|
|
456609
|
+
}
|
|
456610
|
+
const faces = settled;
|
|
456611
|
+
const status = faces.length > 0 ? "loaded" : "fallback_used";
|
|
456612
|
+
this.#faceStatus.set(key2, status);
|
|
456613
|
+
return { request, status };
|
|
456614
|
+
} catch {
|
|
456615
|
+
this.#faceStatus.set(key2, "failed");
|
|
456616
|
+
this.#warnFaceFailureOnce(request, key2);
|
|
456617
|
+
return { request, status: "failed" };
|
|
456618
|
+
} finally {
|
|
456619
|
+
this.#cancelTimeout(handle4);
|
|
456620
|
+
}
|
|
456621
|
+
}
|
|
456622
|
+
#warnFaceFailureOnce(request, key2) {
|
|
456623
|
+
if (this.#warnedFaceFailures.has(key2))
|
|
456624
|
+
return;
|
|
456625
|
+
this.#warnedFaceFailures.add(key2);
|
|
456626
|
+
const src = this.#faceSources.get(key2);
|
|
456627
|
+
const detail = src ? ` from ${src}` : "";
|
|
456628
|
+
console.warn(`[superdoc] font face failed to load: "${request.family}" ${request.weight} ${request.style}${detail}. ` + `Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
|
|
456629
|
+
}
|
|
456630
|
+
async#loadOne(family3, timeoutMs) {
|
|
456631
|
+
const fontSet = this.#fontSet;
|
|
456632
|
+
if (!fontSet) {
|
|
456633
|
+
this.#status.set(family3, "fallback_used");
|
|
456634
|
+
return { family: family3, status: "fallback_used" };
|
|
456635
|
+
}
|
|
456636
|
+
this.#status.set(family3, "loading");
|
|
456637
|
+
const probe = `${this.#probeSize} ${quoteFamily2(family3)}`;
|
|
456638
|
+
const TIMEOUT = Symbol("timeout");
|
|
456639
|
+
let handle4;
|
|
456640
|
+
const timeout2 = new Promise((resolve2) => {
|
|
456641
|
+
handle4 = this.#scheduleTimeout(() => resolve2(TIMEOUT), timeoutMs);
|
|
456642
|
+
});
|
|
456643
|
+
try {
|
|
456644
|
+
const settled = await Promise.race([fontSet.load(probe), timeout2]);
|
|
456645
|
+
if (settled === TIMEOUT) {
|
|
456646
|
+
this.#status.set(family3, "timed_out");
|
|
456647
|
+
return { family: family3, status: "timed_out" };
|
|
456648
|
+
}
|
|
456649
|
+
const faces = settled;
|
|
456650
|
+
const status = faces.length > 0 ? "loaded" : "fallback_used";
|
|
456651
|
+
this.#status.set(family3, status);
|
|
456652
|
+
return { family: family3, status };
|
|
456653
|
+
} catch {
|
|
456654
|
+
this.#status.set(family3, "failed");
|
|
456655
|
+
this.#warnLoadFailureOnce(family3);
|
|
456656
|
+
return { family: family3, status: "failed" };
|
|
456657
|
+
} finally {
|
|
456658
|
+
this.#cancelTimeout(handle4);
|
|
456659
|
+
}
|
|
456660
|
+
}
|
|
456661
|
+
#warnLoadFailureOnce(family3) {
|
|
456662
|
+
if (this.#warnedFailures.has(family3))
|
|
456663
|
+
return;
|
|
456664
|
+
this.#warnedFailures.add(family3);
|
|
456665
|
+
const sources = this.#sources.get(family3);
|
|
456666
|
+
const detail = sources && sources.length ? ` from ${sources.join(", ")}` : "";
|
|
456667
|
+
console.warn(`[superdoc] font asset failed to load for "${family3}"${detail}. ` + `Check fonts.assetBaseUrl / fonts.resolveAssetUrl so the bundled .woff2 are served.`);
|
|
456668
|
+
}
|
|
456669
|
+
}
|
|
456670
|
+
var DEFAULT_FONT_LOAD_TIMEOUT_MS2 = 3000, DEFAULT_PROBE_SIZE2 = "16px", registriesByFontSet2;
|
|
456671
|
+
var init_registry2 = __esm(() => {
|
|
456672
|
+
registriesByFontSet2 = new WeakMap;
|
|
456673
|
+
});
|
|
456674
|
+
|
|
456675
|
+
// ../../shared/font-system/src/font-offerings.ts
|
|
456676
|
+
function classifyOffering2(policyAction, verdict, physicalFamily, bundled) {
|
|
456677
|
+
if (policyAction === "preserve_only")
|
|
456678
|
+
return "preserve_only";
|
|
456679
|
+
if (policyAction === "customer_supplied" || physicalFamily == null)
|
|
456680
|
+
return "customer_supplied";
|
|
456681
|
+
if (policyAction === "category_fallback")
|
|
456682
|
+
return "category_fallback";
|
|
456683
|
+
if (!bundled)
|
|
456684
|
+
return "requires_asset";
|
|
456685
|
+
return verdict === "metric_safe" ? "default" : "qualified";
|
|
456686
|
+
}
|
|
456687
|
+
function deriveOfferings2() {
|
|
456688
|
+
const offerings = SUBSTITUTION_EVIDENCE2.map((row2) => {
|
|
456689
|
+
const bundled = row2.physicalFamily != null && BUNDLED_FAMILIES2.has(row2.physicalFamily);
|
|
456690
|
+
return {
|
|
456691
|
+
logicalFamily: row2.logicalFamily,
|
|
456692
|
+
physicalFamily: row2.physicalFamily,
|
|
456693
|
+
generic: row2.physicalFamily && PHYSICAL_GENERIC2[row2.physicalFamily] || "sans-serif",
|
|
456694
|
+
offering: classifyOffering2(row2.policyAction, row2.verdict, row2.physicalFamily, bundled),
|
|
456695
|
+
bundled,
|
|
456696
|
+
verdict: row2.verdict,
|
|
456697
|
+
evidenceId: row2.evidenceId
|
|
456698
|
+
};
|
|
456699
|
+
});
|
|
456700
|
+
return Object.freeze(offerings);
|
|
456701
|
+
}
|
|
456702
|
+
var PHYSICAL_GENERIC2, BUNDLED_FAMILIES2, FONT_OFFERINGS2;
|
|
456703
|
+
var init_font_offerings = __esm(() => {
|
|
456704
|
+
init_substitution_evidence();
|
|
456705
|
+
init_bundled_manifest();
|
|
456706
|
+
PHYSICAL_GENERIC2 = Object.freeze({
|
|
456707
|
+
Carlito: "sans-serif",
|
|
456708
|
+
Caladea: "serif",
|
|
456709
|
+
"Liberation Sans": "sans-serif",
|
|
456710
|
+
"Liberation Serif": "serif",
|
|
456711
|
+
"Liberation Mono": "monospace"
|
|
456712
|
+
});
|
|
456713
|
+
BUNDLED_FAMILIES2 = new Set(BUNDLED_MANIFEST2.map((f2) => f2.family));
|
|
456714
|
+
FONT_OFFERINGS2 = deriveOfferings2();
|
|
456715
|
+
});
|
|
456716
|
+
|
|
456717
|
+
// ../../shared/font-system/src/index.ts
|
|
456718
|
+
var init_src5 = __esm(() => {
|
|
456719
|
+
init_types8();
|
|
456720
|
+
init_resolver();
|
|
456721
|
+
init_resolver();
|
|
456722
|
+
init_bundled();
|
|
456723
|
+
init_report();
|
|
456724
|
+
init_os2();
|
|
456725
|
+
init_registry2();
|
|
456726
|
+
init_font_offerings();
|
|
456727
|
+
});
|
|
456728
|
+
|
|
455440
456729
|
// ../../packages/super-editor/src/editors/v1/core/super-converter/v2/exporter/commentsExporter.js
|
|
455441
456730
|
var prepareCommentParaIds2 = (comment2) => {
|
|
455442
456731
|
const newComment = {
|
|
@@ -457901,6 +459190,7 @@ var init_SuperConverter = __esm(() => {
|
|
|
457901
459190
|
init_normalizeDuplicateBlockIdentitiesInContent();
|
|
457902
459191
|
init_preProcessPageFieldsOnly();
|
|
457903
459192
|
init_helpers();
|
|
459193
|
+
init_src5();
|
|
457904
459194
|
init_base_list_definitions();
|
|
457905
459195
|
init_exporter_docx_defs();
|
|
457906
459196
|
init_commentsExporter();
|
|
@@ -457984,10 +459274,10 @@ var init_SuperConverter = __esm(() => {
|
|
|
457984
459274
|
}
|
|
457985
459275
|
static getFallbackFromFontTable(docx, fontName) {
|
|
457986
459276
|
const fontEntry = SuperConverter3.getFontTableEntry(docx, fontName);
|
|
457987
|
-
const
|
|
457988
|
-
if (!
|
|
459277
|
+
const family3 = fontEntry?.elements?.find((child) => child.name === "w:family")?.attributes?.["w:val"];
|
|
459278
|
+
if (!family3)
|
|
457989
459279
|
return null;
|
|
457990
|
-
const mapped = FONT_FAMILY_FALLBACKS3[
|
|
459280
|
+
const mapped = FONT_FAMILY_FALLBACKS3[family3.toLowerCase()];
|
|
457991
459281
|
return mapped || DEFAULT_GENERIC_FALLBACK3;
|
|
457992
459282
|
}
|
|
457993
459283
|
static toCssFontFamily(fontName, docx) {
|
|
@@ -458450,14 +459740,17 @@ var init_SuperConverter = __esm(() => {
|
|
|
458450
459740
|
for (const font of fontsToInclude) {
|
|
458451
459741
|
const filePath = elements.find((el) => el.attributes.Id === font.attributes["r:id"])?.attributes?.Target;
|
|
458452
459742
|
if (!filePath)
|
|
458453
|
-
|
|
459743
|
+
continue;
|
|
458454
459744
|
const fontUint8Array = this.fonts[`word/${filePath}`];
|
|
458455
|
-
|
|
458456
|
-
|
|
458457
|
-
|
|
459745
|
+
if (!fontUint8Array?.buffer)
|
|
459746
|
+
continue;
|
|
459747
|
+
const fontBuffer = fontUint8Array.buffer.slice(fontUint8Array.byteOffset, fontUint8Array.byteOffset + fontUint8Array.byteLength);
|
|
458458
459748
|
const ttfBuffer = deobfuscateFont2(fontBuffer, font.attributes["w:fontKey"]);
|
|
458459
459749
|
if (!ttfBuffer)
|
|
458460
|
-
|
|
459750
|
+
continue;
|
|
459751
|
+
const policy = parseEmbeddingPolicy2(ttfBuffer);
|
|
459752
|
+
if (!(policy ? policy.embeddable : false))
|
|
459753
|
+
continue;
|
|
458461
459754
|
const blob = new Blob([ttfBuffer], { type: "font/ttf" });
|
|
458462
459755
|
const fontUrl = URL.createObjectURL(blob);
|
|
458463
459756
|
const isNormal = font.name.includes("Regular");
|
|
@@ -458483,6 +459776,49 @@ var init_SuperConverter = __esm(() => {
|
|
|
458483
459776
|
fontsImported
|
|
458484
459777
|
};
|
|
458485
459778
|
}
|
|
459779
|
+
getEmbeddedFontFaces() {
|
|
459780
|
+
const fontTable = this.convertedXml["word/fontTable.xml"];
|
|
459781
|
+
if (!fontTable || !Object.keys(this.fonts).length)
|
|
459782
|
+
return [];
|
|
459783
|
+
const wFonts = fontTable.elements?.find((el) => el.name === "w:fonts");
|
|
459784
|
+
const embeddedEntries = wFonts?.elements?.filter((el) => el.elements?.some((nested) => nested?.attributes?.["r:id"] && nested?.attributes?.["w:fontKey"])) ?? [];
|
|
459785
|
+
const embedElements = embeddedEntries.flatMap((entry) => (entry.elements ?? []).filter((el) => el.name?.startsWith("w:embed")).map((el) => ({ embed: el, family: entry.attributes?.["w:name"] })));
|
|
459786
|
+
const rels = this.convertedXml["word/_rels/fontTable.xml.rels"];
|
|
459787
|
+
const relElements = rels?.elements?.find((el) => el.name === "Relationships")?.elements ?? [];
|
|
459788
|
+
const faceFromEmbedName = (name = "") => ({
|
|
459789
|
+
weight: /bold/i.test(name) ? "700" : "400",
|
|
459790
|
+
style: /italic/i.test(name) ? "italic" : "normal"
|
|
459791
|
+
});
|
|
459792
|
+
const faces = [];
|
|
459793
|
+
for (const { embed, family: family3 } of embedElements) {
|
|
459794
|
+
const relationshipId = embed.attributes?.["r:id"];
|
|
459795
|
+
const fontKey = embed.attributes?.["w:fontKey"];
|
|
459796
|
+
if (!family3 || !relationshipId || !fontKey)
|
|
459797
|
+
continue;
|
|
459798
|
+
const filePath = relElements.find((el) => el.attributes?.Id === relationshipId)?.attributes?.Target;
|
|
459799
|
+
if (!filePath)
|
|
459800
|
+
continue;
|
|
459801
|
+
const fontUint8Array = this.fonts[`word/${filePath}`];
|
|
459802
|
+
if (!fontUint8Array?.buffer)
|
|
459803
|
+
continue;
|
|
459804
|
+
const sourceBytes = fontUint8Array.buffer.slice(fontUint8Array.byteOffset, fontUint8Array.byteOffset + fontUint8Array.byteLength);
|
|
459805
|
+
const ttf = deobfuscateFont2(sourceBytes, fontKey);
|
|
459806
|
+
if (!ttf)
|
|
459807
|
+
continue;
|
|
459808
|
+
const policy = parseEmbeddingPolicy2(ttf);
|
|
459809
|
+
const fallback = faceFromEmbedName(embed.name);
|
|
459810
|
+
faces.push({
|
|
459811
|
+
family: family3,
|
|
459812
|
+
source: ttf,
|
|
459813
|
+
weight: policy?.face.weight ?? fallback.weight,
|
|
459814
|
+
style: policy?.face.style ?? fallback.style,
|
|
459815
|
+
fsType: policy?.fsType ?? null,
|
|
459816
|
+
embeddable: policy ? policy.embeddable : false,
|
|
459817
|
+
relationshipId
|
|
459818
|
+
});
|
|
459819
|
+
}
|
|
459820
|
+
return faces;
|
|
459821
|
+
}
|
|
458486
459822
|
getDocumentInternalId() {
|
|
458487
459823
|
const settingsLocation = "word/settings.xml";
|
|
458488
459824
|
if (!this.convertedXml[settingsLocation]) {
|
|
@@ -480636,9 +481972,9 @@ function findDonorMarkerFont2(abstract) {
|
|
|
480636
481972
|
continue;
|
|
480637
481973
|
if (rFontsHasSymbolFont2(rFonts))
|
|
480638
481974
|
continue;
|
|
480639
|
-
const
|
|
480640
|
-
if (
|
|
480641
|
-
return
|
|
481975
|
+
const family3 = readRFontsFamily2(rFonts);
|
|
481976
|
+
if (family3)
|
|
481977
|
+
return family3;
|
|
480642
481978
|
}
|
|
480643
481979
|
return;
|
|
480644
481980
|
}
|