three-text 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +122 -64
- package/dist/index.js +122 -64
- package/dist/index.min.cjs +565 -563
- package/dist/index.min.js +597 -595
- package/dist/index.umd.js +122 -64
- package/dist/index.umd.min.js +450 -448
- package/dist/types/core/layout/LineBreak.d.ts +0 -1
- package/dist/types/core/layout/LineBreakDelta.d.ts +97 -0
- package/dist/webgpu/index.cjs +15 -5
- package/dist/webgpu/index.js +15 -5
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* three-text v0.4.
|
|
2
|
+
* three-text v0.4.2
|
|
3
3
|
* Copyright (C) 2025 Countertype LLC
|
|
4
4
|
*
|
|
5
5
|
* This program is free software: you can redistribute it and/or modify
|
|
@@ -183,8 +183,8 @@
|
|
|
183
183
|
const SPACE_STRETCH_RATIO = 0.5; // stretch = 50% of space width (fontdimen 3 / fontdimen 2)
|
|
184
184
|
const SPACE_SHRINK_RATIO = 1 / 3; // shrink = 33% of space width (fontdimen 4 / fontdimen 2)
|
|
185
185
|
|
|
186
|
-
// Knuth-Plass line breaking
|
|
187
|
-
// References: tex.web (TeX), linebreak.c (LuaTeX),
|
|
186
|
+
// Knuth-Plass line breaking with Liang hyphenation
|
|
187
|
+
// References: break.lua (SILE), tex.web (TeX), linebreak.c (LuaTeX), pTeX, xeCJK
|
|
188
188
|
var ItemType;
|
|
189
189
|
(function (ItemType) {
|
|
190
190
|
ItemType[ItemType["BOX"] = 0] = "BOX";
|
|
@@ -200,7 +200,7 @@
|
|
|
200
200
|
FitnessClass[FitnessClass["DECENT"] = 2] = "DECENT";
|
|
201
201
|
FitnessClass[FitnessClass["TIGHT"] = 3] = "TIGHT"; // lines shrinking 0.5 to 1.0 of their shrinkability
|
|
202
202
|
})(FitnessClass || (FitnessClass = {}));
|
|
203
|
-
// Active node management with Map for
|
|
203
|
+
// Active node management with Map for lookup by (position, fitness)
|
|
204
204
|
class ActiveNodeList {
|
|
205
205
|
constructor() {
|
|
206
206
|
this.nodesByKey = new Map();
|
|
@@ -220,6 +220,9 @@
|
|
|
220
220
|
existing.previous = node.previous;
|
|
221
221
|
existing.hyphenated = node.hyphenated;
|
|
222
222
|
existing.line = node.line;
|
|
223
|
+
existing.cumWidth = node.cumWidth;
|
|
224
|
+
existing.cumStretch = node.cumStretch;
|
|
225
|
+
existing.cumShrink = node.cumShrink;
|
|
223
226
|
return true;
|
|
224
227
|
}
|
|
225
228
|
return false;
|
|
@@ -269,17 +272,24 @@
|
|
|
269
272
|
class LineBreak {
|
|
270
273
|
// TeX: badness function (tex.web lines 2337-2348)
|
|
271
274
|
// Computes badness = 100 * (t/s)³ where t=adjustment, s=stretchability
|
|
275
|
+
// Simplified from TeX's fixed-point integer arithmetic to floating-point
|
|
276
|
+
//
|
|
277
|
+
// Returns INF_BAD+1 for overfull boxes so they're rejected even when
|
|
278
|
+
// threshold=INF_BAD in emergency pass
|
|
272
279
|
static badness(t, s) {
|
|
273
280
|
if (t === 0)
|
|
274
281
|
return 0;
|
|
275
282
|
if (s <= 0)
|
|
276
283
|
return INF_BAD + 1;
|
|
277
|
-
const r = Math.abs(t
|
|
284
|
+
const r = Math.abs(t / s);
|
|
278
285
|
if (r > 10)
|
|
279
286
|
return INF_BAD + 1;
|
|
280
|
-
return Math.min(Math.round(100 * r
|
|
287
|
+
return Math.min(Math.round(100 * r ** 3), INF_BAD);
|
|
281
288
|
}
|
|
282
|
-
// TeX fitness classification (tex.web lines
|
|
289
|
+
// TeX fitness classification (tex.web lines 16099-16105, 16799-16812)
|
|
290
|
+
// TeX uses badness thresholds 12 and 99, which correspond to ratios ~0.5 and ~1.0
|
|
291
|
+
// We use ratio directly since we compute it anyway. Well, and because SILE does
|
|
292
|
+
// it this way. Thanks Simon :)
|
|
283
293
|
static fitnessClass(ratio) {
|
|
284
294
|
if (ratio < -0.5)
|
|
285
295
|
return FitnessClass.TIGHT; // shrinking significantly
|
|
@@ -289,27 +299,6 @@
|
|
|
289
299
|
return FitnessClass.LOOSE; // stretching 0.5-1.0
|
|
290
300
|
return FitnessClass.VERY_LOOSE; // stretching > 1.0
|
|
291
301
|
}
|
|
292
|
-
// Build prefix sums so we can quickly compute the width/stretch/shrink
|
|
293
|
-
// of any range [a, b] as cumulative[b] - cumulative[a]
|
|
294
|
-
static computeCumulativeWidths(items) {
|
|
295
|
-
const n = items.length + 1;
|
|
296
|
-
const width = new Float64Array(n);
|
|
297
|
-
const stretch = new Float64Array(n);
|
|
298
|
-
const shrink = new Float64Array(n);
|
|
299
|
-
for (let i = 0; i < items.length; i++) {
|
|
300
|
-
const item = items[i];
|
|
301
|
-
width[i + 1] = width[i] + item.width;
|
|
302
|
-
if (item.type === ItemType.GLUE) {
|
|
303
|
-
stretch[i + 1] = stretch[i] + item.stretch;
|
|
304
|
-
shrink[i + 1] = shrink[i] + item.shrink;
|
|
305
|
-
}
|
|
306
|
-
else {
|
|
307
|
-
stretch[i + 1] = stretch[i];
|
|
308
|
-
shrink[i + 1] = shrink[i];
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
return { width, stretch, shrink };
|
|
312
|
-
}
|
|
313
302
|
static findHyphenationPoints(word, language = 'en-us', availablePatterns, lefthyphenmin = DEFAULT_LEFT_HYPHEN_MIN, righthyphenmin = DEFAULT_RIGHT_HYPHEN_MIN) {
|
|
314
303
|
let patternTrie;
|
|
315
304
|
if (availablePatterns && availablePatterns[language]) {
|
|
@@ -435,7 +424,7 @@
|
|
|
435
424
|
);
|
|
436
425
|
}
|
|
437
426
|
static isCJPunctuation(char) {
|
|
438
|
-
return this.isCJClosingPunctuation(char) || this.isCJOpeningPunctuation(char);
|
|
427
|
+
return (this.isCJClosingPunctuation(char) || this.isCJOpeningPunctuation(char));
|
|
439
428
|
}
|
|
440
429
|
static itemizeCJKText(text, measureText, measureTextWidths, context, startOffset = 0, glueParams) {
|
|
441
430
|
const items = [];
|
|
@@ -458,7 +447,9 @@
|
|
|
458
447
|
const char = chars[i];
|
|
459
448
|
const nextChar = i < chars.length - 1 ? chars[i + 1] : null;
|
|
460
449
|
if (/\s/.test(char)) {
|
|
461
|
-
const width = widths
|
|
450
|
+
const width = widths
|
|
451
|
+
? (widths[i] ?? measureText(char))
|
|
452
|
+
: measureText(char);
|
|
462
453
|
items.push({
|
|
463
454
|
type: ItemType.GLUE,
|
|
464
455
|
width,
|
|
@@ -501,11 +492,17 @@
|
|
|
501
492
|
static itemizeParagraph(text, measureText, measureTextWidths, hyphenate, language, availablePatterns, lefthyphenmin, righthyphenmin, context, lineWidth) {
|
|
502
493
|
const items = [];
|
|
503
494
|
const chars = Array.from(text);
|
|
495
|
+
// Inter-character glue for CJK justification
|
|
496
|
+
// Matches pTeX's default \kanjiskip behavior
|
|
504
497
|
let cjkGlueParams;
|
|
505
498
|
const getCjkGlueParams = () => {
|
|
506
499
|
if (!cjkGlueParams) {
|
|
507
500
|
const baseCharWidth = measureText('字');
|
|
508
|
-
cjkGlueParams = {
|
|
501
|
+
cjkGlueParams = {
|
|
502
|
+
width: 0,
|
|
503
|
+
stretch: baseCharWidth * 0.04,
|
|
504
|
+
shrink: baseCharWidth * 0.04
|
|
505
|
+
};
|
|
509
506
|
}
|
|
510
507
|
return cjkGlueParams;
|
|
511
508
|
};
|
|
@@ -613,7 +610,9 @@
|
|
|
613
610
|
}
|
|
614
611
|
}
|
|
615
612
|
}
|
|
616
|
-
else if (hyphenate &&
|
|
613
|
+
else if (hyphenate &&
|
|
614
|
+
segment.length >= lefthyphenmin + righthyphenmin &&
|
|
615
|
+
/^\p{L}+$/u.test(segment)) {
|
|
617
616
|
const hyphenPoints = this.findHyphenationPoints(segment, language, availablePatterns, lefthyphenmin, righthyphenmin);
|
|
618
617
|
if (hyphenPoints.length > 0) {
|
|
619
618
|
let lastPoint = 0;
|
|
@@ -719,9 +718,8 @@
|
|
|
719
718
|
// TeX: line_break inner loop (tex.web lines 16169-17256)
|
|
720
719
|
// Finds optimal breakpoints using Knuth-Plass algorithm
|
|
721
720
|
static lineBreak(items, lineWidth, threshold, emergencyStretch, context) {
|
|
722
|
-
const cumulative = this.computeCumulativeWidths(items);
|
|
723
721
|
const activeNodes = new ActiveNodeList();
|
|
724
|
-
// Start node
|
|
722
|
+
// Start node with zero cumulative width
|
|
725
723
|
activeNodes.insert({
|
|
726
724
|
position: 0,
|
|
727
725
|
line: 0,
|
|
@@ -730,17 +728,41 @@
|
|
|
730
728
|
previous: null,
|
|
731
729
|
hyphenated: false,
|
|
732
730
|
active: true,
|
|
733
|
-
activeIndex: 0
|
|
731
|
+
activeIndex: 0,
|
|
732
|
+
cumWidth: 0,
|
|
733
|
+
cumStretch: 0,
|
|
734
|
+
cumShrink: 0
|
|
734
735
|
});
|
|
736
|
+
// Cumulative width from paragraph start, representing items[0..i-1]
|
|
737
|
+
let cumWidth = 0;
|
|
738
|
+
let cumStretch = 0;
|
|
739
|
+
let cumShrink = 0;
|
|
735
740
|
// Process each item
|
|
736
741
|
for (let i = 0; i < items.length; i++) {
|
|
737
742
|
const item = items[i];
|
|
738
743
|
// Check if this is a legal breakpoint
|
|
739
|
-
const isBreakpoint = (item.type === ItemType.PENALTY &&
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
744
|
+
const isBreakpoint = (item.type === ItemType.PENALTY &&
|
|
745
|
+
item.penalty < INFINITY_PENALTY) ||
|
|
746
|
+
item.type === ItemType.DISCRETIONARY ||
|
|
747
|
+
(item.type === ItemType.GLUE &&
|
|
748
|
+
i > 0 &&
|
|
749
|
+
items[i - 1].type === ItemType.BOX);
|
|
750
|
+
if (!isBreakpoint) {
|
|
751
|
+
// Accumulate width for non-breakpoint items
|
|
752
|
+
if (item.type === ItemType.BOX) {
|
|
753
|
+
cumWidth += item.width;
|
|
754
|
+
}
|
|
755
|
+
else if (item.type === ItemType.GLUE) {
|
|
756
|
+
const glue = item;
|
|
757
|
+
cumWidth += glue.width;
|
|
758
|
+
cumStretch += glue.stretch;
|
|
759
|
+
cumShrink += glue.shrink;
|
|
760
|
+
}
|
|
761
|
+
else if (item.type === ItemType.DISCRETIONARY) {
|
|
762
|
+
cumWidth += item.width;
|
|
763
|
+
}
|
|
743
764
|
continue;
|
|
765
|
+
}
|
|
744
766
|
// Get penalty and flagged status
|
|
745
767
|
let pi = 0;
|
|
746
768
|
let flagged = false;
|
|
@@ -762,23 +784,20 @@
|
|
|
762
784
|
const bestDemerits = [Infinity, Infinity, Infinity, Infinity];
|
|
763
785
|
// Nodes to deactivate
|
|
764
786
|
const toDeactivate = [];
|
|
765
|
-
// Current cumulative values at position i
|
|
766
|
-
const curWidth = cumulative.width[i];
|
|
767
|
-
const curStretch = cumulative.stretch[i];
|
|
768
|
-
const curShrink = cumulative.shrink[i];
|
|
769
787
|
// Try each active node as predecessor
|
|
770
788
|
const active = activeNodes.getActive();
|
|
771
789
|
for (let j = 0; j < active.length; j++) {
|
|
772
790
|
const a = active[j];
|
|
773
|
-
// Line width from a to i
|
|
774
|
-
const lineW =
|
|
775
|
-
const lineStretch =
|
|
776
|
-
const lineShrink =
|
|
791
|
+
// Line width from a to i
|
|
792
|
+
const lineW = cumWidth - a.cumWidth + breakWidth;
|
|
793
|
+
const lineStretch = cumStretch - a.cumStretch;
|
|
794
|
+
const lineShrink = cumShrink - a.cumShrink;
|
|
777
795
|
const shortfall = lineWidth - lineW;
|
|
778
796
|
let ratio;
|
|
779
797
|
if (shortfall > 0) {
|
|
780
798
|
const effectiveStretch = lineStretch + emergencyStretch;
|
|
781
|
-
ratio =
|
|
799
|
+
ratio =
|
|
800
|
+
effectiveStretch > 0 ? shortfall / effectiveStretch : Infinity;
|
|
782
801
|
}
|
|
783
802
|
else if (shortfall < 0) {
|
|
784
803
|
ratio = lineShrink > 0 ? shortfall / lineShrink : -Infinity;
|
|
@@ -788,7 +807,7 @@
|
|
|
788
807
|
}
|
|
789
808
|
// Calculate badness
|
|
790
809
|
const bad = this.badness(shortfall, shortfall > 0 ? lineStretch + emergencyStretch : lineShrink);
|
|
791
|
-
// Check feasibility
|
|
810
|
+
// Check feasibility
|
|
792
811
|
if (ratio < -1) {
|
|
793
812
|
toDeactivate.push(a);
|
|
794
813
|
continue;
|
|
@@ -828,7 +847,10 @@
|
|
|
828
847
|
previous: a,
|
|
829
848
|
hyphenated: flagged,
|
|
830
849
|
active: true,
|
|
831
|
-
activeIndex: -1
|
|
850
|
+
activeIndex: -1,
|
|
851
|
+
cumWidth: cumWidth,
|
|
852
|
+
cumStretch: cumStretch,
|
|
853
|
+
cumShrink: cumShrink
|
|
832
854
|
};
|
|
833
855
|
}
|
|
834
856
|
}
|
|
@@ -845,6 +867,19 @@
|
|
|
845
867
|
if (activeNodes.size() === 0 && pi !== EJECT_PENALTY) {
|
|
846
868
|
return null;
|
|
847
869
|
}
|
|
870
|
+
// Accumulate width after evaluating this breakpoint
|
|
871
|
+
if (item.type === ItemType.BOX) {
|
|
872
|
+
cumWidth += item.width;
|
|
873
|
+
}
|
|
874
|
+
else if (item.type === ItemType.GLUE) {
|
|
875
|
+
const glue = item;
|
|
876
|
+
cumWidth += glue.width;
|
|
877
|
+
cumStretch += glue.stretch;
|
|
878
|
+
cumShrink += glue.shrink;
|
|
879
|
+
}
|
|
880
|
+
else if (item.type === ItemType.DISCRETIONARY) {
|
|
881
|
+
cumWidth += item.width;
|
|
882
|
+
}
|
|
848
883
|
}
|
|
849
884
|
// Find best solution
|
|
850
885
|
let best = null;
|
|
@@ -908,7 +943,8 @@
|
|
|
908
943
|
return allLines;
|
|
909
944
|
}
|
|
910
945
|
let useHyphenation = hyphenate;
|
|
911
|
-
if (useHyphenation &&
|
|
946
|
+
if (useHyphenation &&
|
|
947
|
+
(!hyphenationPatterns || !hyphenationPatterns[language])) {
|
|
912
948
|
logger.warn(`Hyphenation patterns for ${language} not available`);
|
|
913
949
|
useHyphenation = false;
|
|
914
950
|
}
|
|
@@ -930,7 +966,8 @@
|
|
|
930
966
|
if (!width || width === Infinity) {
|
|
931
967
|
const measuredWidth = measureText(text);
|
|
932
968
|
perfLogger.end('LineBreak.breakText');
|
|
933
|
-
return [
|
|
969
|
+
return [
|
|
970
|
+
{
|
|
934
971
|
text,
|
|
935
972
|
originalStart: 0,
|
|
936
973
|
originalEnd: text.length - 1,
|
|
@@ -938,7 +975,8 @@
|
|
|
938
975
|
isLastLine: true,
|
|
939
976
|
naturalWidth: measuredWidth,
|
|
940
977
|
endedWithHyphen: false
|
|
941
|
-
}
|
|
978
|
+
}
|
|
979
|
+
];
|
|
942
980
|
}
|
|
943
981
|
// First pass: without hyphenation
|
|
944
982
|
let items = this.itemizeText(text, measureText, measureTextWidths, false, language, hyphenationPatterns, lefthyphenmin, righthyphenmin, context, width);
|
|
@@ -971,7 +1009,8 @@
|
|
|
971
1009
|
return this.postLineBreak(text, items, breakpoints, width, align, direction, context);
|
|
972
1010
|
}
|
|
973
1011
|
perfLogger.end('LineBreak.breakText');
|
|
974
|
-
return [
|
|
1012
|
+
return [
|
|
1013
|
+
{
|
|
975
1014
|
text,
|
|
976
1015
|
originalStart: 0,
|
|
977
1016
|
originalEnd: text.length - 1,
|
|
@@ -980,25 +1019,30 @@
|
|
|
980
1019
|
isLastLine: true,
|
|
981
1020
|
naturalWidth: measureText(text),
|
|
982
1021
|
endedWithHyphen: false
|
|
983
|
-
}
|
|
1022
|
+
}
|
|
1023
|
+
];
|
|
984
1024
|
}
|
|
985
1025
|
// TeX: post_line_break (tex.web lines 17260-17448)
|
|
986
1026
|
// Creates the actual lines from the computed breakpoints
|
|
987
1027
|
static postLineBreak(text, items, breakpoints, lineWidth, align, direction, context) {
|
|
988
1028
|
if (breakpoints.length === 0) {
|
|
989
|
-
return [
|
|
1029
|
+
return [
|
|
1030
|
+
{
|
|
990
1031
|
text,
|
|
991
1032
|
originalStart: 0,
|
|
992
1033
|
originalEnd: text.length - 1,
|
|
993
1034
|
xOffset: 0
|
|
994
|
-
}
|
|
1035
|
+
}
|
|
1036
|
+
];
|
|
995
1037
|
}
|
|
996
1038
|
const lines = [];
|
|
997
1039
|
let lineStart = 0;
|
|
998
1040
|
for (let i = 0; i < breakpoints.length; i++) {
|
|
999
1041
|
const breakpoint = breakpoints[i];
|
|
1000
1042
|
const willHaveFinalLine = breakpoints[breakpoints.length - 1] + 1 < items.length - 1;
|
|
1001
|
-
const isLastLine = willHaveFinalLine
|
|
1043
|
+
const isLastLine = willHaveFinalLine
|
|
1044
|
+
? false
|
|
1045
|
+
: i === breakpoints.length - 1;
|
|
1002
1046
|
const lineTextParts = [];
|
|
1003
1047
|
let originalStart = -1;
|
|
1004
1048
|
let originalEnd = -1;
|
|
@@ -1008,7 +1052,8 @@
|
|
|
1008
1052
|
for (let j = lineStart; j < breakpoint; j++) {
|
|
1009
1053
|
const item = items[j];
|
|
1010
1054
|
if ((item.type === ItemType.PENALTY && !item.text) ||
|
|
1011
|
-
(item.type === ItemType.DISCRETIONARY &&
|
|
1055
|
+
(item.type === ItemType.DISCRETIONARY &&
|
|
1056
|
+
!item.noBreak)) {
|
|
1012
1057
|
continue;
|
|
1013
1058
|
}
|
|
1014
1059
|
if (item.originIndex !== undefined) {
|
|
@@ -1036,7 +1081,8 @@
|
|
|
1036
1081
|
const breakItem = items[breakpoint];
|
|
1037
1082
|
let endedWithHyphen = false;
|
|
1038
1083
|
if (breakpoint < items.length) {
|
|
1039
|
-
if (breakItem.type === ItemType.PENALTY &&
|
|
1084
|
+
if (breakItem.type === ItemType.PENALTY &&
|
|
1085
|
+
breakItem.flagged) {
|
|
1040
1086
|
lineTextParts.push('-');
|
|
1041
1087
|
naturalWidth += breakItem.width;
|
|
1042
1088
|
endedWithHyphen = true;
|
|
@@ -1102,7 +1148,8 @@
|
|
|
1102
1148
|
if (item.type === ItemType.PENALTY)
|
|
1103
1149
|
continue;
|
|
1104
1150
|
if (item.originIndex !== undefined) {
|
|
1105
|
-
if (finalOriginalStart === -1 ||
|
|
1151
|
+
if (finalOriginalStart === -1 ||
|
|
1152
|
+
item.originIndex < finalOriginalStart) {
|
|
1106
1153
|
finalOriginalStart = item.originIndex;
|
|
1107
1154
|
}
|
|
1108
1155
|
if (item.originIndex > finalOriginalEnd) {
|
|
@@ -4516,7 +4563,14 @@
|
|
|
4516
4563
|
|
|
4517
4564
|
var hb = {exports: {}};
|
|
4518
4565
|
|
|
4519
|
-
var fs = {};
|
|
4566
|
+
var fs = {};
|
|
4567
|
+
const readFileSync = (...args) => {
|
|
4568
|
+
const req = typeof globalThis !== 'undefined' ? globalThis.require : undefined;
|
|
4569
|
+
if (typeof req === 'function') {
|
|
4570
|
+
return req('fs').readFileSync(...args);
|
|
4571
|
+
}
|
|
4572
|
+
throw new Error('fs not available in this environment');
|
|
4573
|
+
};
|
|
4520
4574
|
|
|
4521
4575
|
var fs$1 = {
|
|
4522
4576
|
__proto__: null,
|
|
@@ -4527,7 +4581,7 @@
|
|
|
4527
4581
|
var require$$0 = /*@__PURE__*/getAugmentedNamespace(fs$1);
|
|
4528
4582
|
|
|
4529
4583
|
(function (module, exports) {
|
|
4530
|
-
var createHarfBuzz=(()=>{var _scriptName=typeof document!="undefined"?document.currentScript?.src:undefined;return async function(moduleArg={}){var moduleRtn;var Module=moduleArg;var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof WorkerGlobalScope!="undefined";var ENVIRONMENT_IS_NODE=typeof process=="object"&&process.versions?.node&&process.type!="renderer";var quit_=(status,toThrow)=>{throw toThrow};if(typeof __filename!="undefined"){_scriptName=__filename;}else if(ENVIRONMENT_IS_WORKER){_scriptName=self.location.href;}var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require$$0;scriptDirectory=__dirname+"/";readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(process.argv.length>1){process.argv[1].replace(/\\/g,"/");}process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow};}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href;}catch{}{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)};}readAsync=async url=>{if(isFileURI(url)){return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){resolve(xhr.response);return}reject(xhr.status);};xhr.onerror=reject;xhr.send(null);})}var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)};}}else;console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var ABORT=false;var EXITSTATUS;var isFileURI=filename=>filename.startsWith("file://");var readyPromiseResolve,readyPromiseReject;var wasmMemory;var HEAPU8;var runtimeInitialized=false;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=new Int8Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAP32"]=new Int32Array(b);Module["HEAPU32"]=new Uint32Array(b);Module["HEAPF32"]=new Float32Array(b);new BigInt64Array(b);new BigUint64Array(b);}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift());}}callRuntimeCallbacks(onPreRuns);}function initRuntime(){runtimeInitialized=true;wasmExports["__wasm_call_ctors"]();}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift());}}callRuntimeCallbacks(onPostRuns);}var runDependencies=0;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;Module["monitorRunDependencies"]?.(runDependencies);}function removeRunDependency(id){runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(runDependencies==0){if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback();}}}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject?.(e);throw e}var wasmBinaryFile;function findWasmBinary(){return locateFile("hb.wasm")}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw "both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason);}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation");}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){return {env:wasmImports,wasi_snapshot_preview1:wasmImports}}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;Module["wasmExports"]=wasmExports;wasmMemory=wasmExports["memory"];Module["wasmMemory"]=wasmMemory;updateMemoryViews();wasmTable=wasmExports["__indirect_function_table"];assignWasmExports(wasmExports);removeRunDependency();return wasmExports}addRunDependency();function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){return new Promise((resolve,reject)=>{Module["instantiateWasm"](info,(mod,inst)=>{resolve(receiveInstance(mod));});})}wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status;}}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module);}};var onPostRuns=[];var addOnPostRun=cb=>onPostRuns.push(cb);var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.push(cb);var noExitRuntime=true;var __abort_js=()=>abort("");var runtimeKeepaliveCounter=0;var __emscripten_runtime_keepalive_clear=()=>{noExitRuntime=false;runtimeKeepaliveCounter=0;};var timers={};var handleException=e=>{if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e);};var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){Module["onExit"]?.(code);ABORT=true;}quit_(code,new ExitStatus(code));};var exitJS=(status,implicit)=>{EXITSTATUS=status;_proc_exit(status);};var _exit=exitJS;var maybeExit=()=>{if(!keepRuntimeAlive()){try{_exit(EXITSTATUS);}catch(e){handleException(e);}}};var callUserCallback=func=>{if(ABORT){return}try{func();maybeExit();}catch(e){handleException(e);}};var _emscripten_get_now=()=>performance.now();var __setitimer_js=(which,timeout_ms)=>{if(timers[which]){clearTimeout(timers[which].id);delete timers[which];}if(!timeout_ms)return 0;var id=setTimeout(()=>{delete timers[which];callUserCallback(()=>__emscripten_timeout(which,_emscripten_get_now()));},timeout_ms);timers[which]={id,timeout_ms};return 0};var getHeapMax=()=>2147483648;var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var oldHeapSize=wasmMemory.buffer.byteLength;var pages=(size-oldHeapSize+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var uleb128EncodeWithLen=arr=>{const n=arr.length;return [n%128|128,n>>7,...arr]};var wasmTypeCodes={i:127,p:127,j:126,f:125,d:124,e:111};var generateTypePack=types=>uleb128EncodeWithLen(Array.from(types,type=>{var code=wasmTypeCodes[type];return code}));var convertJsFunctionToWasm=(func,sig)=>{var bytes=Uint8Array.of(0,97,115,109,1,0,0,0,1,...uleb128EncodeWithLen([1,96,...generateTypePack(sig.slice(1)),...generateTypePack(sig[0]==="v"?"":sig[0])]),2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var module=new WebAssembly.Module(bytes);var instance=new WebAssembly.Instance(module,{e:{f:func}});var wrappedFunc=instance.exports["f"];return wrappedFunc};var wasmTable;var getWasmTableEntry=funcPtr=>wasmTable.get(funcPtr);var updateTableMap=(offset,count)=>{if(functionsInTableMap){for(var i=offset;i<offset+count;i++){var item=getWasmTableEntry(i);if(item){functionsInTableMap.set(item,i);}}}};var functionsInTableMap;var getFunctionAddress=func=>{if(!functionsInTableMap){functionsInTableMap=new WeakMap;updateTableMap(0,wasmTable.length);}return functionsInTableMap.get(func)||0};var freeTableIndexes=[];var getEmptyTableSlot=()=>{if(freeTableIndexes.length){return freeTableIndexes.pop()}return wasmTable["grow"](1)};var setWasmTableEntry=(idx,func)=>wasmTable.set(idx,func);var addFunction=(func,sig)=>{var rtn=getFunctionAddress(func);if(rtn){return rtn}var ret=getEmptyTableSlot();try{setWasmTableEntry(ret,func);}catch(err){if(!(err instanceof TypeError)){throw err}var wrapped=convertJsFunctionToWasm(func,sig);setWasmTableEntry(ret,wrapped);}functionsInTableMap.set(func,ret);return ret};var removeFunction=index=>{functionsInTableMap.delete(getWasmTableEntry(index));setWasmTableEntry(index,null);freeTableIndexes.push(index);};{if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["print"])Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(Module["arguments"])Module["arguments"];if(Module["thisProgram"])Module["thisProgram"];}Module["wasmMemory"]=wasmMemory;Module["wasmExports"]=wasmExports;Module["addFunction"]=addFunction;Module["removeFunction"]=removeFunction;var __emscripten_timeout;function assignWasmExports(wasmExports){Module["_hb_blob_create"]=wasmExports["hb_blob_create"];Module["_hb_blob_destroy"]=wasmExports["hb_blob_destroy"];Module["_hb_blob_get_length"]=wasmExports["hb_blob_get_length"];Module["_hb_blob_get_data"]=wasmExports["hb_blob_get_data"];Module["_hb_buffer_serialize_glyphs"]=wasmExports["hb_buffer_serialize_glyphs"];Module["_hb_buffer_create"]=wasmExports["hb_buffer_create"];Module["_hb_buffer_destroy"]=wasmExports["hb_buffer_destroy"];Module["_hb_buffer_get_content_type"]=wasmExports["hb_buffer_get_content_type"];Module["_hb_buffer_set_direction"]=wasmExports["hb_buffer_set_direction"];Module["_hb_buffer_set_script"]=wasmExports["hb_buffer_set_script"];Module["_hb_buffer_set_language"]=wasmExports["hb_buffer_set_language"];Module["_hb_buffer_set_flags"]=wasmExports["hb_buffer_set_flags"];Module["_hb_buffer_set_cluster_level"]=wasmExports["hb_buffer_set_cluster_level"];Module["_hb_buffer_get_length"]=wasmExports["hb_buffer_get_length"];Module["_hb_buffer_get_glyph_infos"]=wasmExports["hb_buffer_get_glyph_infos"];Module["_hb_buffer_get_glyph_positions"]=wasmExports["hb_buffer_get_glyph_positions"];Module["_hb_glyph_info_get_glyph_flags"]=wasmExports["hb_glyph_info_get_glyph_flags"];Module["_hb_buffer_guess_segment_properties"]=wasmExports["hb_buffer_guess_segment_properties"];Module["_hb_buffer_add_utf8"]=wasmExports["hb_buffer_add_utf8"];Module["_hb_buffer_add_utf16"]=wasmExports["hb_buffer_add_utf16"];Module["_hb_buffer_set_message_func"]=wasmExports["hb_buffer_set_message_func"];Module["_hb_language_from_string"]=wasmExports["hb_language_from_string"];Module["_hb_script_from_string"]=wasmExports["hb_script_from_string"];Module["_hb_version"]=wasmExports["hb_version"];Module["_hb_version_string"]=wasmExports["hb_version_string"];Module["_hb_feature_from_string"]=wasmExports["hb_feature_from_string"];Module["_malloc"]=wasmExports["malloc"];Module["_free"]=wasmExports["free"];Module["_hb_draw_funcs_set_move_to_func"]=wasmExports["hb_draw_funcs_set_move_to_func"];Module["_hb_draw_funcs_set_line_to_func"]=wasmExports["hb_draw_funcs_set_line_to_func"];Module["_hb_draw_funcs_set_quadratic_to_func"]=wasmExports["hb_draw_funcs_set_quadratic_to_func"];Module["_hb_draw_funcs_set_cubic_to_func"]=wasmExports["hb_draw_funcs_set_cubic_to_func"];Module["_hb_draw_funcs_set_close_path_func"]=wasmExports["hb_draw_funcs_set_close_path_func"];Module["_hb_draw_funcs_create"]=wasmExports["hb_draw_funcs_create"];Module["_hb_draw_funcs_destroy"]=wasmExports["hb_draw_funcs_destroy"];Module["_hb_face_create"]=wasmExports["hb_face_create"];Module["_hb_face_destroy"]=wasmExports["hb_face_destroy"];Module["_hb_face_reference_table"]=wasmExports["hb_face_reference_table"];Module["_hb_face_get_upem"]=wasmExports["hb_face_get_upem"];Module["_hb_face_collect_unicodes"]=wasmExports["hb_face_collect_unicodes"];Module["_hb_font_draw_glyph"]=wasmExports["hb_font_draw_glyph"];Module["_hb_font_glyph_to_string"]=wasmExports["hb_font_glyph_to_string"];Module["_hb_font_create"]=wasmExports["hb_font_create"];Module["_hb_font_set_variations"]=wasmExports["hb_font_set_variations"];Module["_hb_font_destroy"]=wasmExports["hb_font_destroy"];Module["_hb_font_set_scale"]=wasmExports["hb_font_set_scale"];Module["_hb_set_create"]=wasmExports["hb_set_create"];Module["_hb_set_destroy"]=wasmExports["hb_set_destroy"];Module["_hb_ot_var_get_axis_infos"]=wasmExports["hb_ot_var_get_axis_infos"];Module["_hb_set_get_population"]=wasmExports["hb_set_get_population"];Module["_hb_set_next_many"]=wasmExports["hb_set_next_many"];Module["_hb_shape"]=wasmExports["hb_shape"];__emscripten_timeout=wasmExports["_emscripten_timeout"];}var wasmImports={_abort_js:__abort_js,_emscripten_runtime_keepalive_clear:__emscripten_runtime_keepalive_clear,_setitimer_js:__setitimer_js,emscripten_resize_heap:_emscripten_resize_heap,proc_exit:_proc_exit};var wasmExports=await createWasm();function run(){if(runDependencies>0){dependenciesFulfilled=run;return}preRun();if(runDependencies>0){dependenciesFulfilled=run;return}function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve?.(Module);Module["onRuntimeInitialized"]?.();postRun();}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun();},1);}else {doRun();}}function preInit(){if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].shift()();}}}preInit();run();if(runtimeInitialized){moduleRtn=Module;}else {moduleRtn=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject;});}
|
|
4584
|
+
var createHarfBuzz=(()=>{var _scriptName=typeof document!="undefined"?document.currentScript?.src:undefined;return async function(moduleArg={}){var moduleRtn;var Module=moduleArg;var ENVIRONMENT_IS_WEB=typeof window=="object";var ENVIRONMENT_IS_WORKER=typeof WorkerGlobalScope!="undefined";var ENVIRONMENT_IS_NODE=typeof process=="object"&&process.versions?.node&&process.type!="renderer";var quit_=(status,toThrow)=>{throw toThrow};if(typeof __filename!="undefined"){_scriptName=__filename;}else if(ENVIRONMENT_IS_WORKER){_scriptName=self.location.href;}var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require$$0;scriptDirectory=(typeof __dirname!=="undefined"?__dirname+"/":"");readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(process.argv.length>1){process.argv[1].replace(/\\/g,"/");}process.argv.slice(2);quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow};}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href;}catch{}{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)};}readAsync=async url=>{if(isFileURI(url)){return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){resolve(xhr.response);return}reject(xhr.status);};xhr.onerror=reject;xhr.send(null);})}var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)};}}else;console.log.bind(console);var err=console.error.bind(console);var wasmBinary;var ABORT=false;var EXITSTATUS;var isFileURI=filename=>filename.startsWith("file://");var readyPromiseResolve,readyPromiseReject;var wasmMemory;var HEAPU8;var runtimeInitialized=false;function updateMemoryViews(){var b=wasmMemory.buffer;Module["HEAP8"]=new Int8Array(b);Module["HEAPU8"]=HEAPU8=new Uint8Array(b);Module["HEAP32"]=new Int32Array(b);Module["HEAPU32"]=new Uint32Array(b);Module["HEAPF32"]=new Float32Array(b);new BigInt64Array(b);new BigUint64Array(b);}function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift());}}callRuntimeCallbacks(onPreRuns);}function initRuntime(){runtimeInitialized=true;wasmExports["__wasm_call_ctors"]();}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift());}}callRuntimeCallbacks(onPostRuns);}var runDependencies=0;var dependenciesFulfilled=null;function addRunDependency(id){runDependencies++;Module["monitorRunDependencies"]?.(runDependencies);}function removeRunDependency(id){runDependencies--;Module["monitorRunDependencies"]?.(runDependencies);if(runDependencies==0){if(dependenciesFulfilled){var callback=dependenciesFulfilled;dependenciesFulfilled=null;callback();}}}function abort(what){Module["onAbort"]?.(what);what="Aborted("+what+")";err(what);ABORT=true;what+=". Build with -sASSERTIONS for more info.";var e=new WebAssembly.RuntimeError(what);readyPromiseReject?.(e);throw e}var wasmBinaryFile;function findWasmBinary(){return locateFile("hb.wasm")}function getBinarySync(file){if(file==wasmBinaryFile&&wasmBinary){return new Uint8Array(wasmBinary)}if(readBinary){return readBinary(file)}throw "both async and sync fetching of the wasm failed"}async function getWasmBinary(binaryFile){if(!wasmBinary){try{var response=await readAsync(binaryFile);return new Uint8Array(response)}catch{}}return getBinarySync(binaryFile)}async function instantiateArrayBuffer(binaryFile,imports){try{var binary=await getWasmBinary(binaryFile);var instance=await WebAssembly.instantiate(binary,imports);return instance}catch(reason){err(`failed to asynchronously prepare wasm: ${reason}`);abort(reason);}}async function instantiateAsync(binary,binaryFile,imports){if(!binary&&!isFileURI(binaryFile)&&!ENVIRONMENT_IS_NODE){try{var response=fetch(binaryFile,{credentials:"same-origin"});var instantiationResult=await WebAssembly.instantiateStreaming(response,imports);return instantiationResult}catch(reason){err(`wasm streaming compile failed: ${reason}`);err("falling back to ArrayBuffer instantiation");}}return instantiateArrayBuffer(binaryFile,imports)}function getWasmImports(){return {env:wasmImports,wasi_snapshot_preview1:wasmImports}}async function createWasm(){function receiveInstance(instance,module){wasmExports=instance.exports;Module["wasmExports"]=wasmExports;wasmMemory=wasmExports["memory"];Module["wasmMemory"]=wasmMemory;updateMemoryViews();wasmTable=wasmExports["__indirect_function_table"];assignWasmExports(wasmExports);removeRunDependency();return wasmExports}addRunDependency();function receiveInstantiationResult(result){return receiveInstance(result["instance"])}var info=getWasmImports();if(Module["instantiateWasm"]){return new Promise((resolve,reject)=>{Module["instantiateWasm"](info,(mod,inst)=>{resolve(receiveInstance(mod));});})}wasmBinaryFile??=findWasmBinary();var result=await instantiateAsync(wasmBinary,wasmBinaryFile,info);var exports=receiveInstantiationResult(result);return exports}class ExitStatus{name="ExitStatus";constructor(status){this.message=`Program terminated with exit(${status})`;this.status=status;}}var callRuntimeCallbacks=callbacks=>{while(callbacks.length>0){callbacks.shift()(Module);}};var onPostRuns=[];var addOnPostRun=cb=>onPostRuns.push(cb);var onPreRuns=[];var addOnPreRun=cb=>onPreRuns.push(cb);var noExitRuntime=true;var __abort_js=()=>abort("");var runtimeKeepaliveCounter=0;var __emscripten_runtime_keepalive_clear=()=>{noExitRuntime=false;runtimeKeepaliveCounter=0;};var timers={};var handleException=e=>{if(e instanceof ExitStatus||e=="unwind"){return EXITSTATUS}quit_(1,e);};var keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0;var _proc_exit=code=>{EXITSTATUS=code;if(!keepRuntimeAlive()){Module["onExit"]?.(code);ABORT=true;}quit_(code,new ExitStatus(code));};var exitJS=(status,implicit)=>{EXITSTATUS=status;_proc_exit(status);};var _exit=exitJS;var maybeExit=()=>{if(!keepRuntimeAlive()){try{_exit(EXITSTATUS);}catch(e){handleException(e);}}};var callUserCallback=func=>{if(ABORT){return}try{func();maybeExit();}catch(e){handleException(e);}};var _emscripten_get_now=()=>performance.now();var __setitimer_js=(which,timeout_ms)=>{if(timers[which]){clearTimeout(timers[which].id);delete timers[which];}if(!timeout_ms)return 0;var id=setTimeout(()=>{delete timers[which];callUserCallback(()=>__emscripten_timeout(which,_emscripten_get_now()));},timeout_ms);timers[which]={id,timeout_ms};return 0};var getHeapMax=()=>2147483648;var alignMemory=(size,alignment)=>Math.ceil(size/alignment)*alignment;var growMemory=size=>{var oldHeapSize=wasmMemory.buffer.byteLength;var pages=(size-oldHeapSize+65535)/65536|0;try{wasmMemory.grow(pages);updateMemoryViews();return 1}catch(e){}};var _emscripten_resize_heap=requestedSize=>{var oldSize=HEAPU8.length;requestedSize>>>=0;var maxHeapSize=getHeapMax();if(requestedSize>maxHeapSize){return false}for(var cutDown=1;cutDown<=4;cutDown*=2){var overGrownHeapSize=oldSize*(1+.2/cutDown);overGrownHeapSize=Math.min(overGrownHeapSize,requestedSize+100663296);var newSize=Math.min(maxHeapSize,alignMemory(Math.max(requestedSize,overGrownHeapSize),65536));var replacement=growMemory(newSize);if(replacement){return true}}return false};var uleb128EncodeWithLen=arr=>{const n=arr.length;return [n%128|128,n>>7,...arr]};var wasmTypeCodes={i:127,p:127,j:126,f:125,d:124,e:111};var generateTypePack=types=>uleb128EncodeWithLen(Array.from(types,type=>{var code=wasmTypeCodes[type];return code}));var convertJsFunctionToWasm=(func,sig)=>{var bytes=Uint8Array.of(0,97,115,109,1,0,0,0,1,...uleb128EncodeWithLen([1,96,...generateTypePack(sig.slice(1)),...generateTypePack(sig[0]==="v"?"":sig[0])]),2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var module=new WebAssembly.Module(bytes);var instance=new WebAssembly.Instance(module,{e:{f:func}});var wrappedFunc=instance.exports["f"];return wrappedFunc};var wasmTable;var getWasmTableEntry=funcPtr=>wasmTable.get(funcPtr);var updateTableMap=(offset,count)=>{if(functionsInTableMap){for(var i=offset;i<offset+count;i++){var item=getWasmTableEntry(i);if(item){functionsInTableMap.set(item,i);}}}};var functionsInTableMap;var getFunctionAddress=func=>{if(!functionsInTableMap){functionsInTableMap=new WeakMap;updateTableMap(0,wasmTable.length);}return functionsInTableMap.get(func)||0};var freeTableIndexes=[];var getEmptyTableSlot=()=>{if(freeTableIndexes.length){return freeTableIndexes.pop()}return wasmTable["grow"](1)};var setWasmTableEntry=(idx,func)=>wasmTable.set(idx,func);var addFunction=(func,sig)=>{var rtn=getFunctionAddress(func);if(rtn){return rtn}var ret=getEmptyTableSlot();try{setWasmTableEntry(ret,func);}catch(err){if(!(err instanceof TypeError)){throw err}var wrapped=convertJsFunctionToWasm(func,sig);setWasmTableEntry(ret,wrapped);}functionsInTableMap.set(func,ret);return ret};var removeFunction=index=>{functionsInTableMap.delete(getWasmTableEntry(index));setWasmTableEntry(index,null);freeTableIndexes.push(index);};{if(Module["noExitRuntime"])noExitRuntime=Module["noExitRuntime"];if(Module["print"])Module["print"];if(Module["printErr"])err=Module["printErr"];if(Module["wasmBinary"])wasmBinary=Module["wasmBinary"];if(Module["arguments"])Module["arguments"];if(Module["thisProgram"])Module["thisProgram"];}Module["wasmMemory"]=wasmMemory;Module["wasmExports"]=wasmExports;Module["addFunction"]=addFunction;Module["removeFunction"]=removeFunction;var __emscripten_timeout;function assignWasmExports(wasmExports){Module["_hb_blob_create"]=wasmExports["hb_blob_create"];Module["_hb_blob_destroy"]=wasmExports["hb_blob_destroy"];Module["_hb_blob_get_length"]=wasmExports["hb_blob_get_length"];Module["_hb_blob_get_data"]=wasmExports["hb_blob_get_data"];Module["_hb_buffer_serialize_glyphs"]=wasmExports["hb_buffer_serialize_glyphs"];Module["_hb_buffer_create"]=wasmExports["hb_buffer_create"];Module["_hb_buffer_destroy"]=wasmExports["hb_buffer_destroy"];Module["_hb_buffer_get_content_type"]=wasmExports["hb_buffer_get_content_type"];Module["_hb_buffer_set_direction"]=wasmExports["hb_buffer_set_direction"];Module["_hb_buffer_set_script"]=wasmExports["hb_buffer_set_script"];Module["_hb_buffer_set_language"]=wasmExports["hb_buffer_set_language"];Module["_hb_buffer_set_flags"]=wasmExports["hb_buffer_set_flags"];Module["_hb_buffer_set_cluster_level"]=wasmExports["hb_buffer_set_cluster_level"];Module["_hb_buffer_get_length"]=wasmExports["hb_buffer_get_length"];Module["_hb_buffer_get_glyph_infos"]=wasmExports["hb_buffer_get_glyph_infos"];Module["_hb_buffer_get_glyph_positions"]=wasmExports["hb_buffer_get_glyph_positions"];Module["_hb_glyph_info_get_glyph_flags"]=wasmExports["hb_glyph_info_get_glyph_flags"];Module["_hb_buffer_guess_segment_properties"]=wasmExports["hb_buffer_guess_segment_properties"];Module["_hb_buffer_add_utf8"]=wasmExports["hb_buffer_add_utf8"];Module["_hb_buffer_add_utf16"]=wasmExports["hb_buffer_add_utf16"];Module["_hb_buffer_set_message_func"]=wasmExports["hb_buffer_set_message_func"];Module["_hb_language_from_string"]=wasmExports["hb_language_from_string"];Module["_hb_script_from_string"]=wasmExports["hb_script_from_string"];Module["_hb_version"]=wasmExports["hb_version"];Module["_hb_version_string"]=wasmExports["hb_version_string"];Module["_hb_feature_from_string"]=wasmExports["hb_feature_from_string"];Module["_malloc"]=wasmExports["malloc"];Module["_free"]=wasmExports["free"];Module["_hb_draw_funcs_set_move_to_func"]=wasmExports["hb_draw_funcs_set_move_to_func"];Module["_hb_draw_funcs_set_line_to_func"]=wasmExports["hb_draw_funcs_set_line_to_func"];Module["_hb_draw_funcs_set_quadratic_to_func"]=wasmExports["hb_draw_funcs_set_quadratic_to_func"];Module["_hb_draw_funcs_set_cubic_to_func"]=wasmExports["hb_draw_funcs_set_cubic_to_func"];Module["_hb_draw_funcs_set_close_path_func"]=wasmExports["hb_draw_funcs_set_close_path_func"];Module["_hb_draw_funcs_create"]=wasmExports["hb_draw_funcs_create"];Module["_hb_draw_funcs_destroy"]=wasmExports["hb_draw_funcs_destroy"];Module["_hb_face_create"]=wasmExports["hb_face_create"];Module["_hb_face_destroy"]=wasmExports["hb_face_destroy"];Module["_hb_face_reference_table"]=wasmExports["hb_face_reference_table"];Module["_hb_face_get_upem"]=wasmExports["hb_face_get_upem"];Module["_hb_face_collect_unicodes"]=wasmExports["hb_face_collect_unicodes"];Module["_hb_font_draw_glyph"]=wasmExports["hb_font_draw_glyph"];Module["_hb_font_glyph_to_string"]=wasmExports["hb_font_glyph_to_string"];Module["_hb_font_create"]=wasmExports["hb_font_create"];Module["_hb_font_set_variations"]=wasmExports["hb_font_set_variations"];Module["_hb_font_destroy"]=wasmExports["hb_font_destroy"];Module["_hb_font_set_scale"]=wasmExports["hb_font_set_scale"];Module["_hb_set_create"]=wasmExports["hb_set_create"];Module["_hb_set_destroy"]=wasmExports["hb_set_destroy"];Module["_hb_ot_var_get_axis_infos"]=wasmExports["hb_ot_var_get_axis_infos"];Module["_hb_set_get_population"]=wasmExports["hb_set_get_population"];Module["_hb_set_next_many"]=wasmExports["hb_set_next_many"];Module["_hb_shape"]=wasmExports["hb_shape"];__emscripten_timeout=wasmExports["_emscripten_timeout"];}var wasmImports={_abort_js:__abort_js,_emscripten_runtime_keepalive_clear:__emscripten_runtime_keepalive_clear,_setitimer_js:__setitimer_js,emscripten_resize_heap:_emscripten_resize_heap,proc_exit:_proc_exit};var wasmExports=await createWasm();function run(){if(runDependencies>0){dependenciesFulfilled=run;return}preRun();if(runDependencies>0){dependenciesFulfilled=run;return}function doRun(){Module["calledRun"]=true;if(ABORT)return;initRuntime();readyPromiseResolve?.(Module);Module["onRuntimeInitialized"]?.();postRun();}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(()=>{setTimeout(()=>Module["setStatus"](""),1);doRun();},1);}else {doRun();}}function preInit(){if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].shift()();}}}preInit();run();if(runtimeInitialized){moduleRtn=Module;}else {moduleRtn=new Promise((resolve,reject)=>{readyPromiseResolve=resolve;readyPromiseReject=reject;});}
|
|
4531
4585
|
return moduleRtn}})();{module.exports=createHarfBuzz;module.exports.default=createHarfBuzz;}
|
|
4532
4586
|
} (hb));
|
|
4533
4587
|
|
|
@@ -5511,7 +5565,11 @@
|
|
|
5511
5565
|
for (const pattern of Object.keys(options.color.byText)) {
|
|
5512
5566
|
let index = 0;
|
|
5513
5567
|
while ((index = options.text.indexOf(pattern, index)) !== -1) {
|
|
5514
|
-
byTextMatches.push({
|
|
5568
|
+
byTextMatches.push({
|
|
5569
|
+
pattern,
|
|
5570
|
+
start: index,
|
|
5571
|
+
end: index + pattern.length
|
|
5572
|
+
});
|
|
5515
5573
|
for (let i = index; i < index + pattern.length; i++) {
|
|
5516
5574
|
coloredTextIndices.add(i);
|
|
5517
5575
|
}
|