@m2c2kit/core 0.3.29 → 0.3.31
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/assets/{canvaskit-0.39.1.wasm → canvaskit-0.40.0.wasm} +0 -0
- package/dist/index.d.ts +178 -22
- package/dist/index.js +1040 -584
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +4 -4
- package/package.json +10 -11
package/dist/index.js
CHANGED
|
@@ -43,6 +43,17 @@ var ActionType = /* @__PURE__ */ ((ActionType2) => {
|
|
|
43
43
|
return ActionType2;
|
|
44
44
|
})(ActionType || {});
|
|
45
45
|
|
|
46
|
+
class M2Error extends Error {
|
|
47
|
+
constructor(...params) {
|
|
48
|
+
super(...params);
|
|
49
|
+
this.name = "M2Error";
|
|
50
|
+
Object.setPrototypeOf(this, M2Error.prototype);
|
|
51
|
+
if (Error.captureStackTrace) {
|
|
52
|
+
Error.captureStackTrace(this, M2Error);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
46
57
|
const _Easings = class _Easings {
|
|
47
58
|
static toTypeAsString(easingFunction) {
|
|
48
59
|
switch (easingFunction) {
|
|
@@ -116,7 +127,7 @@ const _Easings = class _Easings {
|
|
|
116
127
|
return "CircularInOut";
|
|
117
128
|
}
|
|
118
129
|
default: {
|
|
119
|
-
throw new
|
|
130
|
+
throw new M2Error("Easings.toTypeAsString(): Unknown easing function");
|
|
120
131
|
}
|
|
121
132
|
}
|
|
122
133
|
}
|
|
@@ -192,7 +203,7 @@ const _Easings = class _Easings {
|
|
|
192
203
|
return _Easings.circularInOut;
|
|
193
204
|
}
|
|
194
205
|
default: {
|
|
195
|
-
throw new
|
|
206
|
+
throw new M2Error(
|
|
196
207
|
`Easings.fromTypeAsString(): Unknown easing function type ${easingType}`
|
|
197
208
|
);
|
|
198
209
|
}
|
|
@@ -394,12 +405,12 @@ const _Timer = class _Timer {
|
|
|
394
405
|
static start(name) {
|
|
395
406
|
const timer = this._timers.filter((t) => t.name === name).find(Boolean);
|
|
396
407
|
if (timer === void 0) {
|
|
397
|
-
throw new
|
|
408
|
+
throw new M2Error(
|
|
398
409
|
`can't start timer. timer with name ${name} does not exist.`
|
|
399
410
|
);
|
|
400
411
|
} else {
|
|
401
412
|
if (timer.stopped === false) {
|
|
402
|
-
throw new
|
|
413
|
+
throw new M2Error(
|
|
403
414
|
`can't start timer. timer with name ${name} is already started.`
|
|
404
415
|
);
|
|
405
416
|
}
|
|
@@ -419,12 +430,12 @@ const _Timer = class _Timer {
|
|
|
419
430
|
static stop(name) {
|
|
420
431
|
const timer = this._timers.filter((t) => t.name === name).find(Boolean);
|
|
421
432
|
if (timer === void 0) {
|
|
422
|
-
throw new
|
|
433
|
+
throw new M2Error(
|
|
423
434
|
`can't stop timer. timer with name ${name} does not exist.`
|
|
424
435
|
);
|
|
425
436
|
}
|
|
426
437
|
if (timer.stopped === true) {
|
|
427
|
-
throw new
|
|
438
|
+
throw new M2Error(
|
|
428
439
|
`can't stop timer. timer with name ${name} is already stopped.`
|
|
429
440
|
);
|
|
430
441
|
}
|
|
@@ -445,7 +456,7 @@ const _Timer = class _Timer {
|
|
|
445
456
|
static elapsed(name) {
|
|
446
457
|
const timer = this._timers.filter((t) => t.name === name).find(Boolean);
|
|
447
458
|
if (timer === void 0) {
|
|
448
|
-
throw new
|
|
459
|
+
throw new M2Error(
|
|
449
460
|
`can't get elapsed time. timer with name ${name} does not exist.`
|
|
450
461
|
);
|
|
451
462
|
}
|
|
@@ -467,7 +478,7 @@ const _Timer = class _Timer {
|
|
|
467
478
|
static remove(name) {
|
|
468
479
|
const timer = this._timers.filter((t) => t.name === name).find(Boolean);
|
|
469
480
|
if (timer === void 0) {
|
|
470
|
-
throw new
|
|
481
|
+
throw new M2Error(
|
|
471
482
|
`can't remove timer. timer with name ${name} does not exist.`
|
|
472
483
|
);
|
|
473
484
|
}
|
|
@@ -761,7 +772,7 @@ class M2c2KitHelpers {
|
|
|
761
772
|
if (typeof value2 === "boolean") {
|
|
762
773
|
return value2.toString();
|
|
763
774
|
}
|
|
764
|
-
throw new
|
|
775
|
+
throw new M2Error(`Error parsing "${value2}" as a string.`);
|
|
765
776
|
}
|
|
766
777
|
function canBeNumber(value2) {
|
|
767
778
|
if (typeof value2 === "number") {
|
|
@@ -781,11 +792,11 @@ class M2c2KitHelpers {
|
|
|
781
792
|
return value2;
|
|
782
793
|
}
|
|
783
794
|
if (typeof value2 !== "string") {
|
|
784
|
-
throw new
|
|
795
|
+
throw new M2Error(`Error parsing "${value2}" as a number.`);
|
|
785
796
|
}
|
|
786
797
|
const n = parseFloat(value2);
|
|
787
798
|
if (Number.isNaN(n)) {
|
|
788
|
-
throw new
|
|
799
|
+
throw new M2Error(`Error parsing "${value2}" as a number.`);
|
|
789
800
|
}
|
|
790
801
|
return n;
|
|
791
802
|
}
|
|
@@ -807,11 +818,11 @@ class M2c2KitHelpers {
|
|
|
807
818
|
return value2;
|
|
808
819
|
}
|
|
809
820
|
if (typeof value2 !== "string") {
|
|
810
|
-
throw new
|
|
821
|
+
throw new M2Error(`Error parsing "${value2}" as an integer.`);
|
|
811
822
|
}
|
|
812
823
|
const n = parseInt(value2);
|
|
813
824
|
if (Number.isNaN(n)) {
|
|
814
|
-
throw new
|
|
825
|
+
throw new M2Error(`Error parsing "${value2}" as an integer.`);
|
|
815
826
|
}
|
|
816
827
|
return n;
|
|
817
828
|
}
|
|
@@ -829,7 +840,7 @@ class M2c2KitHelpers {
|
|
|
829
840
|
return value2;
|
|
830
841
|
}
|
|
831
842
|
if (value2 !== "true" && value2 !== "false") {
|
|
832
|
-
throw new
|
|
843
|
+
throw new M2Error(`Error parsing "${value2}" as a boolean.`);
|
|
833
844
|
}
|
|
834
845
|
return value2 === "true";
|
|
835
846
|
}
|
|
@@ -858,7 +869,7 @@ class M2c2KitHelpers {
|
|
|
858
869
|
return value2;
|
|
859
870
|
}
|
|
860
871
|
if (typeof value2 !== "string") {
|
|
861
|
-
throw new
|
|
872
|
+
throw new M2Error(`Error parsing "${value2}" as an array.`);
|
|
862
873
|
}
|
|
863
874
|
try {
|
|
864
875
|
const a = JSON.parse(value2);
|
|
@@ -871,7 +882,7 @@ class M2c2KitHelpers {
|
|
|
871
882
|
return a;
|
|
872
883
|
}
|
|
873
884
|
}
|
|
874
|
-
throw new
|
|
885
|
+
throw new M2Error(`Error parsing "${value2}" as an array.`);
|
|
875
886
|
}
|
|
876
887
|
function canBeObject(value2) {
|
|
877
888
|
if (typeof value2 === "object" && !Array.isArray(value2) && value2 !== null) {
|
|
@@ -898,7 +909,7 @@ class M2c2KitHelpers {
|
|
|
898
909
|
return value2;
|
|
899
910
|
}
|
|
900
911
|
if (typeof value2 !== "string") {
|
|
901
|
-
throw new
|
|
912
|
+
throw new M2Error(`Error parsing "${value2}" as an object.`);
|
|
902
913
|
}
|
|
903
914
|
try {
|
|
904
915
|
const o = JSON.parse(value2);
|
|
@@ -911,7 +922,7 @@ class M2c2KitHelpers {
|
|
|
911
922
|
return o;
|
|
912
923
|
}
|
|
913
924
|
}
|
|
914
|
-
throw new
|
|
925
|
+
throw new M2Error(`Error parsing "${value2}" as an object.`);
|
|
915
926
|
}
|
|
916
927
|
function canBeNull(value2) {
|
|
917
928
|
if (value2 === null || value2 === "null") {
|
|
@@ -921,7 +932,7 @@ class M2c2KitHelpers {
|
|
|
921
932
|
}
|
|
922
933
|
function asNull(value2) {
|
|
923
934
|
if (value2 !== "null" && value2 !== null) {
|
|
924
|
-
throw new
|
|
935
|
+
throw new M2Error(`Error parsing "${value2}" as null.`);
|
|
925
936
|
}
|
|
926
937
|
return null;
|
|
927
938
|
}
|
|
@@ -944,20 +955,20 @@ class M2c2KitHelpers {
|
|
|
944
955
|
null: asNull
|
|
945
956
|
};
|
|
946
957
|
if (type === void 0) {
|
|
947
|
-
throw new
|
|
958
|
+
throw new M2Error(`Error with "${value}" as a target type.`);
|
|
948
959
|
}
|
|
949
960
|
if (!Array.isArray(type)) {
|
|
950
961
|
if (typeCheckers[type](value)) {
|
|
951
962
|
return typeConverters[type](value);
|
|
952
963
|
}
|
|
953
|
-
throw new
|
|
964
|
+
throw new M2Error(`Error parsing "${value}" as a ${type}.`);
|
|
954
965
|
}
|
|
955
966
|
for (const t of type) {
|
|
956
967
|
if (typeCheckers[t](value)) {
|
|
957
968
|
return typeConverters[t](value);
|
|
958
969
|
}
|
|
959
970
|
}
|
|
960
|
-
throw new
|
|
971
|
+
throw new M2Error(`Error parsing "${value}" as one of ${type}.`);
|
|
961
972
|
}
|
|
962
973
|
/**
|
|
963
974
|
* Load scripts from URLs.
|
|
@@ -1237,7 +1248,7 @@ class M2c2KitHelpers {
|
|
|
1237
1248
|
*/
|
|
1238
1249
|
static isPointInsideRectangle(point, rect) {
|
|
1239
1250
|
if (rect.length !== 4) {
|
|
1240
|
-
throw new
|
|
1251
|
+
throw new M2Error("Invalid input: expected an array of four points");
|
|
1241
1252
|
}
|
|
1242
1253
|
return M2c2KitHelpers.arePointsOnSameSideOfLine(
|
|
1243
1254
|
point,
|
|
@@ -1300,7 +1311,7 @@ class M2c2KitHelpers {
|
|
|
1300
1311
|
*/
|
|
1301
1312
|
static findCentroid(points) {
|
|
1302
1313
|
if (points.length !== 4) {
|
|
1303
|
-
throw new
|
|
1314
|
+
throw new M2Error("Invalid input: expected an array of four points");
|
|
1304
1315
|
}
|
|
1305
1316
|
let xSum = 0;
|
|
1306
1317
|
let ySum = 0;
|
|
@@ -1383,7 +1394,7 @@ function nodeNeedsRotation(node) {
|
|
|
1383
1394
|
}
|
|
1384
1395
|
function rotateRectangle(rect, radians, center) {
|
|
1385
1396
|
if (rect.length !== 4) {
|
|
1386
|
-
throw new
|
|
1397
|
+
throw new M2Error("Invalid input: expected an array of four points");
|
|
1387
1398
|
}
|
|
1388
1399
|
const rotated = [];
|
|
1389
1400
|
for (const p of rect) {
|
|
@@ -1421,7 +1432,7 @@ class Futurable {
|
|
|
1421
1432
|
*/
|
|
1422
1433
|
pushToExpression(value) {
|
|
1423
1434
|
if (value === this) {
|
|
1424
|
-
throw new
|
|
1435
|
+
throw new M2Error(
|
|
1425
1436
|
"Cannot add, subtract, or assign a Futurable with itself."
|
|
1426
1437
|
);
|
|
1427
1438
|
}
|
|
@@ -1760,7 +1771,7 @@ class Action {
|
|
|
1760
1771
|
Action.evaluateRotateAction(action, node, elapsed, dt);
|
|
1761
1772
|
break;
|
|
1762
1773
|
default:
|
|
1763
|
-
throw new
|
|
1774
|
+
throw new M2Error(`Action type not recognized: ${action.type}`);
|
|
1764
1775
|
}
|
|
1765
1776
|
}
|
|
1766
1777
|
static evaluateRepeatingActions(action, now) {
|
|
@@ -1778,7 +1789,7 @@ class Action {
|
|
|
1778
1789
|
action.restartAction(action, now);
|
|
1779
1790
|
} else {
|
|
1780
1791
|
if (action.type === ActionType.RepeatForever) {
|
|
1781
|
-
throw new
|
|
1792
|
+
throw new M2Error("RepeatForever action should never complete");
|
|
1782
1793
|
}
|
|
1783
1794
|
action.duration.assign(action.cumulativeDuration);
|
|
1784
1795
|
action.running = false;
|
|
@@ -1884,7 +1895,7 @@ class Action {
|
|
|
1884
1895
|
}
|
|
1885
1896
|
static evaluatePlayAction(node, action) {
|
|
1886
1897
|
if (node.type !== M2NodeType.SoundPlayer) {
|
|
1887
|
-
throw new
|
|
1898
|
+
throw new M2Error("Play action can only be used with a SoundPlayer");
|
|
1888
1899
|
}
|
|
1889
1900
|
const playAction = action;
|
|
1890
1901
|
const soundPlayer = node;
|
|
@@ -1907,7 +1918,7 @@ class Action {
|
|
|
1907
1918
|
playAction.started = true;
|
|
1908
1919
|
} else {
|
|
1909
1920
|
if (m2Sound.status === M2SoundStatus.Error) {
|
|
1910
|
-
throw new
|
|
1921
|
+
throw new M2Error(
|
|
1911
1922
|
`error loading sound ${m2Sound.soundName} (url ${m2Sound.url})`
|
|
1912
1923
|
);
|
|
1913
1924
|
}
|
|
@@ -2075,13 +2086,17 @@ class Action {
|
|
|
2075
2086
|
*/
|
|
2076
2087
|
static rotate(options) {
|
|
2077
2088
|
if (options.byAngle !== void 0 && options.toAngle !== void 0) {
|
|
2078
|
-
throw new
|
|
2089
|
+
throw new M2Error(
|
|
2090
|
+
"rotate Action: cannot specify both byAngle and toAngle"
|
|
2091
|
+
);
|
|
2079
2092
|
}
|
|
2080
2093
|
if (options.byAngle === void 0 && options.toAngle === void 0) {
|
|
2081
|
-
throw new
|
|
2094
|
+
throw new M2Error(
|
|
2095
|
+
"rotate Action: must specify either byAngle or toAngle"
|
|
2096
|
+
);
|
|
2082
2097
|
}
|
|
2083
2098
|
if (options.toAngle === void 0 && options.shortestUnitArc !== void 0) {
|
|
2084
|
-
throw new
|
|
2099
|
+
throw new M2Error(
|
|
2085
2100
|
"rotate Action: shortestUnitArc can only be specified when toAngle is provided"
|
|
2086
2101
|
);
|
|
2087
2102
|
}
|
|
@@ -2252,7 +2267,7 @@ class RepeatAction extends Action {
|
|
|
2252
2267
|
}
|
|
2253
2268
|
clone() {
|
|
2254
2269
|
if (this.children.length !== 1) {
|
|
2255
|
-
throw new
|
|
2270
|
+
throw new M2Error("Repeat action must have exactly one child");
|
|
2256
2271
|
}
|
|
2257
2272
|
const clonedAction = Action.repeat({
|
|
2258
2273
|
// RepeatAction always has exactly one child
|
|
@@ -2297,7 +2312,7 @@ class RepeatForeverAction extends RepeatAction {
|
|
|
2297
2312
|
}
|
|
2298
2313
|
clone() {
|
|
2299
2314
|
if (this.children.length !== 1) {
|
|
2300
|
-
throw new
|
|
2315
|
+
throw new M2Error("RepeatForever action must have exactly one child");
|
|
2301
2316
|
}
|
|
2302
2317
|
const clonedAction = Action.repeatForever({
|
|
2303
2318
|
// RepeatForeverAction always has exactly one child
|
|
@@ -2982,10 +2997,10 @@ class M2Node {
|
|
|
2982
2997
|
}
|
|
2983
2998
|
// we will override this in each derived class. This method will never be called.
|
|
2984
2999
|
initialize() {
|
|
2985
|
-
throw new
|
|
3000
|
+
throw new M2Error("initialize() called in abstract base class Node.");
|
|
2986
3001
|
}
|
|
2987
3002
|
get completeNodeOptions() {
|
|
2988
|
-
throw new
|
|
3003
|
+
throw new M2Error(
|
|
2989
3004
|
"get completeNodeOptions() called in abstract base class Node."
|
|
2990
3005
|
);
|
|
2991
3006
|
}
|
|
@@ -3055,7 +3070,7 @@ class M2Node {
|
|
|
3055
3070
|
get game() {
|
|
3056
3071
|
const findParentScene = (node) => {
|
|
3057
3072
|
if (!node.parent) {
|
|
3058
|
-
throw new
|
|
3073
|
+
throw new M2Error(`Node ${this} has not been added to a scene.`);
|
|
3059
3074
|
} else if (node.parent.type === M2NodeType.Scene) {
|
|
3060
3075
|
return node.parent;
|
|
3061
3076
|
} else {
|
|
@@ -3097,17 +3112,17 @@ class M2Node {
|
|
|
3097
3112
|
addChild(child) {
|
|
3098
3113
|
const suppressEvents = this.suppressEvents || child.suppressEvents;
|
|
3099
3114
|
if (child === this) {
|
|
3100
|
-
throw new
|
|
3115
|
+
throw new M2Error(
|
|
3101
3116
|
`Cannot add node ${child.toString()} as a child to itself.`
|
|
3102
3117
|
);
|
|
3103
3118
|
}
|
|
3104
3119
|
if (child.type == M2NodeType.Scene) {
|
|
3105
|
-
throw new
|
|
3120
|
+
throw new M2Error(
|
|
3106
3121
|
`Cannot add scene ${child.toString()} as a child to node ${this.toString()}. A scene cannot be the child of a node. A scene can only be added to a game object.`
|
|
3107
3122
|
);
|
|
3108
3123
|
}
|
|
3109
3124
|
if (this.children.filter((c) => c !== child).map((c) => c.name).includes(child.name)) {
|
|
3110
|
-
throw new
|
|
3125
|
+
throw new M2Error(
|
|
3111
3126
|
`Cannot add child node ${child.toString()} to parent node ${this.toString()}. A child with name "${child.name}" already exists on this parent.`
|
|
3112
3127
|
);
|
|
3113
3128
|
}
|
|
@@ -3138,11 +3153,11 @@ class M2Node {
|
|
|
3138
3153
|
}
|
|
3139
3154
|
const firstOtherParent = otherParents.find(Boolean);
|
|
3140
3155
|
if (firstOtherParent === this) {
|
|
3141
|
-
throw new
|
|
3156
|
+
throw new M2Error(
|
|
3142
3157
|
`Cannot add child node ${child.toString()} to parent node ${this.toString()}. This child already exists on this parent. The child cannot be added again.`
|
|
3143
3158
|
);
|
|
3144
3159
|
}
|
|
3145
|
-
throw new
|
|
3160
|
+
throw new M2Error(
|
|
3146
3161
|
`Cannot add child node ${child.toString()} to parent node ${this.toString()}. This child already exists on other parent node: ${firstOtherParent?.toString()}}. Remove the child from the other parent first.`
|
|
3147
3162
|
);
|
|
3148
3163
|
}
|
|
@@ -3181,7 +3196,7 @@ class M2Node {
|
|
|
3181
3196
|
child.parent = void 0;
|
|
3182
3197
|
this.children = this.children.filter((c) => c !== child);
|
|
3183
3198
|
} else {
|
|
3184
|
-
throw new
|
|
3199
|
+
throw new M2Error(
|
|
3185
3200
|
`cannot remove node ${child} from parent ${this} because the node is not currently a child of the parent`
|
|
3186
3201
|
);
|
|
3187
3202
|
}
|
|
@@ -3205,7 +3220,7 @@ class M2Node {
|
|
|
3205
3220
|
removeChildren(children) {
|
|
3206
3221
|
children.forEach((child) => {
|
|
3207
3222
|
if (!this.children.includes(child)) {
|
|
3208
|
-
throw new
|
|
3223
|
+
throw new M2Error(
|
|
3209
3224
|
`cannot remove node ${child} from parent ${this} because the node is not currently a child of the parent`
|
|
3210
3225
|
);
|
|
3211
3226
|
}
|
|
@@ -3224,7 +3239,7 @@ class M2Node {
|
|
|
3224
3239
|
descendant(name) {
|
|
3225
3240
|
const descendant = this.descendants.filter((child) => child.name === name).find(Boolean);
|
|
3226
3241
|
if (descendant === void 0) {
|
|
3227
|
-
throw new
|
|
3242
|
+
throw new M2Error(
|
|
3228
3243
|
`descendant with name ${name} not found on parent ${this.toString()}`
|
|
3229
3244
|
);
|
|
3230
3245
|
}
|
|
@@ -3449,7 +3464,7 @@ class M2Node {
|
|
|
3449
3464
|
additionalExceptionMessage = `. sibling node named "${nodeName}" has not been added to the game object`;
|
|
3450
3465
|
}
|
|
3451
3466
|
if (node === void 0) {
|
|
3452
|
-
throw new
|
|
3467
|
+
throw new M2Error(
|
|
3453
3468
|
"could not find sibling node for constraint" + additionalExceptionMessage
|
|
3454
3469
|
);
|
|
3455
3470
|
}
|
|
@@ -3612,7 +3627,7 @@ class M2Node {
|
|
|
3612
3627
|
}
|
|
3613
3628
|
}
|
|
3614
3629
|
if (siblingConstraint === void 0) {
|
|
3615
|
-
throw new
|
|
3630
|
+
throw new M2Error(
|
|
3616
3631
|
"error getting uuid of sibling constraint" + additionalExceptionMessage
|
|
3617
3632
|
);
|
|
3618
3633
|
}
|
|
@@ -3637,7 +3652,7 @@ class M2Node {
|
|
|
3637
3652
|
uuidsInUpdateOrder.forEach((uuid) => {
|
|
3638
3653
|
const child = this.children.filter((c) => c.uuid === uuid).find(Boolean);
|
|
3639
3654
|
if (child === void 0) {
|
|
3640
|
-
throw new
|
|
3655
|
+
throw new M2Error("error in dag topological sort");
|
|
3641
3656
|
}
|
|
3642
3657
|
childrenInUpdateOrder.push(child);
|
|
3643
3658
|
});
|
|
@@ -3705,7 +3720,7 @@ class M2Node {
|
|
|
3705
3720
|
}
|
|
3706
3721
|
getDrawableOptions() {
|
|
3707
3722
|
if (!this.isDrawable) {
|
|
3708
|
-
throw new
|
|
3723
|
+
throw new M2Error(
|
|
3709
3724
|
"getDrawableOptions() called object that is not IDrawable"
|
|
3710
3725
|
);
|
|
3711
3726
|
}
|
|
@@ -3717,7 +3732,7 @@ class M2Node {
|
|
|
3717
3732
|
}
|
|
3718
3733
|
getTextOptions() {
|
|
3719
3734
|
if (!this.isText) {
|
|
3720
|
-
throw new
|
|
3735
|
+
throw new M2Error("getTextOptions() called object that is not IText");
|
|
3721
3736
|
}
|
|
3722
3737
|
const textOptions = {
|
|
3723
3738
|
text: this.text,
|
|
@@ -3734,7 +3749,7 @@ class M2Node {
|
|
|
3734
3749
|
*/
|
|
3735
3750
|
// get parentScene(): Scene {
|
|
3736
3751
|
// if (this.type === M2NodeType.scene) {
|
|
3737
|
-
// throw new
|
|
3752
|
+
// throw new M2Error(
|
|
3738
3753
|
// `Node ${this} is a scene and cannot have a parent scene`
|
|
3739
3754
|
// );
|
|
3740
3755
|
// }
|
|
@@ -3743,21 +3758,23 @@ class M2Node {
|
|
|
3743
3758
|
// } else if (this.parent) {
|
|
3744
3759
|
// return this.parent.parentScene;
|
|
3745
3760
|
// }
|
|
3746
|
-
// throw new
|
|
3761
|
+
// throw new M2Error(`Node ${this} has not been added to a scene`);
|
|
3747
3762
|
// }
|
|
3748
3763
|
get canvasKit() {
|
|
3749
3764
|
return this.game.canvasKit;
|
|
3750
3765
|
}
|
|
3751
3766
|
get parentSceneAsNode() {
|
|
3752
3767
|
if (this.type === M2NodeType.Scene) {
|
|
3753
|
-
throw new
|
|
3768
|
+
throw new M2Error(
|
|
3769
|
+
`Node ${this} is a scene and cannot have a parent scene`
|
|
3770
|
+
);
|
|
3754
3771
|
}
|
|
3755
3772
|
if (this.parent && this.parent.type === M2NodeType.Scene) {
|
|
3756
3773
|
return this.parent;
|
|
3757
3774
|
} else if (this.parent) {
|
|
3758
3775
|
return this.parent.parentSceneAsNode;
|
|
3759
3776
|
}
|
|
3760
|
-
throw new
|
|
3777
|
+
throw new M2Error(`Node ${this} has not been added to a scene`);
|
|
3761
3778
|
}
|
|
3762
3779
|
get size() {
|
|
3763
3780
|
const node = this;
|
|
@@ -3908,7 +3925,7 @@ class M2Node {
|
|
|
3908
3925
|
if (inDegree.has(edge)) {
|
|
3909
3926
|
const inDegreeCount = inDegree.get(edge);
|
|
3910
3927
|
if (inDegreeCount === void 0) {
|
|
3911
|
-
throw new
|
|
3928
|
+
throw new M2Error(`Could not find inDegree for edge ${edge}`);
|
|
3912
3929
|
}
|
|
3913
3930
|
inDegree.set(edge, inDegreeCount + 1);
|
|
3914
3931
|
} else {
|
|
@@ -3932,7 +3949,7 @@ class M2Node {
|
|
|
3932
3949
|
adjList.get(current)?.forEach((edge) => {
|
|
3933
3950
|
const inDegreeCount = inDegree.get(edge);
|
|
3934
3951
|
if (inDegreeCount === void 0) {
|
|
3935
|
-
throw new
|
|
3952
|
+
throw new M2Error(`Could not find inDegree for edge ${edge}`);
|
|
3936
3953
|
}
|
|
3937
3954
|
if (inDegree.has(edge) && inDegreeCount > 0) {
|
|
3938
3955
|
const newDegree = inDegreeCount - 1;
|
|
@@ -4173,7 +4190,7 @@ class ImageManager {
|
|
|
4173
4190
|
localizeImageUrl(url, locale) {
|
|
4174
4191
|
const extensionIndex = url.lastIndexOf(".");
|
|
4175
4192
|
if (extensionIndex === -1) {
|
|
4176
|
-
throw new
|
|
4193
|
+
throw new M2Error("URL does not have an extension");
|
|
4177
4194
|
}
|
|
4178
4195
|
const localizedUrl = url.slice(0, extensionIndex) + `.${locale}` + url.slice(extensionIndex);
|
|
4179
4196
|
return localizedUrl;
|
|
@@ -4201,7 +4218,7 @@ class ImageManager {
|
|
|
4201
4218
|
browserImages.map((i) => i.imageName)
|
|
4202
4219
|
);
|
|
4203
4220
|
if (duplicateImageNames.length > 0) {
|
|
4204
|
-
throw new
|
|
4221
|
+
throw new M2Error(
|
|
4205
4222
|
`image names must be unique. these image names are duplicated within a game ${this.game.id}: ` + duplicateImageNames.join(", ")
|
|
4206
4223
|
);
|
|
4207
4224
|
}
|
|
@@ -4229,7 +4246,7 @@ class ImageManager {
|
|
|
4229
4246
|
if (error instanceof Error) {
|
|
4230
4247
|
throw error;
|
|
4231
4248
|
} else {
|
|
4232
|
-
throw new
|
|
4249
|
+
throw new M2Error(
|
|
4233
4250
|
`prepareDeferredImage(): unable to render image named ${image.imageName}. image source was ${image.svgString ? "svgString" : `url: ${image.url}`}`
|
|
4234
4251
|
);
|
|
4235
4252
|
}
|
|
@@ -4256,7 +4273,7 @@ class ImageManager {
|
|
|
4256
4273
|
const imgElement = document.createElement("img");
|
|
4257
4274
|
const renderAfterBrowserLoad = (resolve) => {
|
|
4258
4275
|
if (!this.scratchCanvas || !this.ctx || !this.scale) {
|
|
4259
|
-
throw new
|
|
4276
|
+
throw new M2Error("image manager not set up");
|
|
4260
4277
|
}
|
|
4261
4278
|
this.scratchCanvas.width = image.width * this.scale;
|
|
4262
4279
|
this.scratchCanvas.height = image.height * this.scale;
|
|
@@ -4265,14 +4282,14 @@ class ImageManager {
|
|
|
4265
4282
|
this.ctx.drawImage(imgElement, 0, 0, image.width, image.height);
|
|
4266
4283
|
this.scratchCanvas.toBlob((blob) => {
|
|
4267
4284
|
if (!blob) {
|
|
4268
|
-
throw new
|
|
4285
|
+
throw new M2Error(
|
|
4269
4286
|
`renderM2Image(): blob is undefined for ${image.imageName}`
|
|
4270
4287
|
);
|
|
4271
4288
|
}
|
|
4272
4289
|
blob.arrayBuffer().then((buffer) => {
|
|
4273
4290
|
const canvaskitImage = this.canvasKit.MakeImageFromEncoded(buffer);
|
|
4274
4291
|
if (!canvaskitImage) {
|
|
4275
|
-
throw new
|
|
4292
|
+
throw new M2Error(
|
|
4276
4293
|
`could not create image with name "${image.imageName}."`
|
|
4277
4294
|
);
|
|
4278
4295
|
}
|
|
@@ -4308,12 +4325,12 @@ class ImageManager {
|
|
|
4308
4325
|
renderAfterBrowserLoad(resolve);
|
|
4309
4326
|
};
|
|
4310
4327
|
if (!image.svgString && !image.url) {
|
|
4311
|
-
throw new
|
|
4328
|
+
throw new M2Error(
|
|
4312
4329
|
`no svgString or url provided for image named ${image.imageName}`
|
|
4313
4330
|
);
|
|
4314
4331
|
}
|
|
4315
4332
|
if (image.svgString && image.url) {
|
|
4316
|
-
throw new
|
|
4333
|
+
throw new M2Error(
|
|
4317
4334
|
`provide svgString or url. both were provided for image named ${image.imageName}`
|
|
4318
4335
|
);
|
|
4319
4336
|
}
|
|
@@ -4419,7 +4436,9 @@ class ImageManager {
|
|
|
4419
4436
|
document.body.appendChild(this._scratchCanvas);
|
|
4420
4437
|
const context2d = this._scratchCanvas.getContext("2d");
|
|
4421
4438
|
if (context2d === null) {
|
|
4422
|
-
throw new
|
|
4439
|
+
throw new M2Error(
|
|
4440
|
+
"could not get 2d canvas context from scratch canvas"
|
|
4441
|
+
);
|
|
4423
4442
|
}
|
|
4424
4443
|
this.ctx = context2d;
|
|
4425
4444
|
this.scale = window.devicePixelRatio;
|
|
@@ -4432,6 +4451,8 @@ class ImageManager {
|
|
|
4432
4451
|
}
|
|
4433
4452
|
}
|
|
4434
4453
|
|
|
4454
|
+
const STRING_INTERPOLATION_CHARACTERS = "{{}}";
|
|
4455
|
+
const TRANSLATION_INTERPOLATION_CHARACTERS = "[[]]";
|
|
4435
4456
|
class I18n {
|
|
4436
4457
|
/**
|
|
4437
4458
|
* The I18n class localizes text and images.
|
|
@@ -4539,39 +4560,198 @@ class I18n {
|
|
|
4539
4560
|
}
|
|
4540
4561
|
}
|
|
4541
4562
|
/**
|
|
4563
|
+
* Returns the localized text and font information for the given key in the
|
|
4564
|
+
* current locale.
|
|
4542
4565
|
*
|
|
4543
4566
|
* @param key - Translation key
|
|
4544
4567
|
* @param interpolation - Interpolation keys and values to replace
|
|
4545
|
-
* placeholders in the translated text
|
|
4546
|
-
* @returns
|
|
4547
|
-
*
|
|
4568
|
+
* string interpolation placeholders in the translated text
|
|
4569
|
+
* @returns object with the localized text, font information, and whether the
|
|
4570
|
+
* translation is a fallback.
|
|
4548
4571
|
*/
|
|
4549
4572
|
getTextLocalization(key, interpolation) {
|
|
4550
|
-
|
|
4551
|
-
|
|
4573
|
+
const primaryResult = this.attemptTranslation(key, interpolation);
|
|
4574
|
+
if (primaryResult.isFallbackOrMissingTranslation) {
|
|
4575
|
+
const placeholdersResult = this.handleTranslationPlaceholders(
|
|
4576
|
+
key,
|
|
4577
|
+
primaryResult,
|
|
4578
|
+
interpolation
|
|
4579
|
+
);
|
|
4580
|
+
if (placeholdersResult) {
|
|
4581
|
+
if (interpolation !== void 0) {
|
|
4582
|
+
placeholdersResult.text = this.insertInterpolations(
|
|
4583
|
+
STRING_INTERPOLATION_CHARACTERS,
|
|
4584
|
+
placeholdersResult.text,
|
|
4585
|
+
interpolation
|
|
4586
|
+
);
|
|
4587
|
+
}
|
|
4588
|
+
return placeholdersResult;
|
|
4589
|
+
}
|
|
4590
|
+
}
|
|
4591
|
+
return primaryResult;
|
|
4592
|
+
}
|
|
4593
|
+
/**
|
|
4594
|
+
*
|
|
4595
|
+
* @param key - Translation key to be translated
|
|
4596
|
+
* @param interpolation - String interpolation keys and values to replace
|
|
4597
|
+
* @returns result object with the localized text, font
|
|
4598
|
+
*/
|
|
4599
|
+
attemptTranslation(key, interpolation) {
|
|
4552
4600
|
let tf = this.tf(key, interpolation);
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
} else {
|
|
4601
|
+
let isFallbackOrMissingTranslation = false;
|
|
4602
|
+
if (tf?.text === void 0) {
|
|
4556
4603
|
tf = this.tf(key, {
|
|
4557
4604
|
useFallbackLocale: true,
|
|
4558
4605
|
...interpolation
|
|
4559
4606
|
});
|
|
4560
|
-
if (tf === void 0 || tf.text === void 0) {
|
|
4561
|
-
localizedText = key;
|
|
4562
|
-
} else {
|
|
4563
|
-
localizedText = tf.text;
|
|
4564
|
-
}
|
|
4565
4607
|
isFallbackOrMissingTranslation = true;
|
|
4566
4608
|
}
|
|
4609
|
+
const text = tf?.text ?? key;
|
|
4567
4610
|
return {
|
|
4568
|
-
text
|
|
4611
|
+
text,
|
|
4569
4612
|
fontSize: tf?.fontSize,
|
|
4570
4613
|
fontName: tf?.fontName,
|
|
4571
4614
|
fontNames: tf?.fontNames,
|
|
4572
4615
|
isFallbackOrMissingTranslation
|
|
4573
4616
|
};
|
|
4574
4617
|
}
|
|
4618
|
+
/**
|
|
4619
|
+
* Handles translation placeholders in a string.
|
|
4620
|
+
*
|
|
4621
|
+
* @remarks The value of a translation placeholder (text within `[[]]`)
|
|
4622
|
+
* may also contain string interpolation placeholders (`{{}}`), so we need
|
|
4623
|
+
* to handle that as well.
|
|
4624
|
+
*
|
|
4625
|
+
* @param key - Translation key for the string to be localized
|
|
4626
|
+
* @param initialResult - Initial translation result for the string
|
|
4627
|
+
* @param interpolation - Interpolation keys and values to replace
|
|
4628
|
+
* interpolation placeholders in the translated text
|
|
4629
|
+
* @returns result object with the localized text,
|
|
4630
|
+
*/
|
|
4631
|
+
handleTranslationPlaceholders(key, initialResult, interpolation) {
|
|
4632
|
+
const placeholders = this.getTranslationPlaceholders(key);
|
|
4633
|
+
if (placeholders.length === 0) {
|
|
4634
|
+
return null;
|
|
4635
|
+
}
|
|
4636
|
+
const fontProps = {
|
|
4637
|
+
size: /* @__PURE__ */ new Set(),
|
|
4638
|
+
name: /* @__PURE__ */ new Set(),
|
|
4639
|
+
names: /* @__PURE__ */ new Set()
|
|
4640
|
+
};
|
|
4641
|
+
const interpolationMap = {};
|
|
4642
|
+
let isFallbackOrMissingTranslation = false;
|
|
4643
|
+
placeholders.forEach((placeholderKey) => {
|
|
4644
|
+
const placeholderResult = this.translatePlaceholder(
|
|
4645
|
+
placeholderKey,
|
|
4646
|
+
fontProps,
|
|
4647
|
+
interpolation
|
|
4648
|
+
);
|
|
4649
|
+
interpolationMap[placeholderKey] = placeholderResult.text;
|
|
4650
|
+
isFallbackOrMissingTranslation = isFallbackOrMissingTranslation || placeholderResult.isFallback;
|
|
4651
|
+
});
|
|
4652
|
+
this.warnConflictingFontProperties(key, fontProps);
|
|
4653
|
+
const text = this.insertInterpolations(
|
|
4654
|
+
TRANSLATION_INTERPOLATION_CHARACTERS,
|
|
4655
|
+
key,
|
|
4656
|
+
interpolationMap
|
|
4657
|
+
);
|
|
4658
|
+
const fontSize = initialResult.fontSize || (fontProps.size.size > 0 ? [...fontProps.size][0] : void 0);
|
|
4659
|
+
const fontName = initialResult.fontName || (fontProps.name.size > 0 ? [...fontProps.name][0] : void 0);
|
|
4660
|
+
const fontNames = initialResult.fontNames || (fontProps.names.size > 0 ? [...fontProps.names][0].split(",") : void 0);
|
|
4661
|
+
return {
|
|
4662
|
+
text,
|
|
4663
|
+
fontSize,
|
|
4664
|
+
fontName,
|
|
4665
|
+
fontNames,
|
|
4666
|
+
isFallbackOrMissingTranslation
|
|
4667
|
+
};
|
|
4668
|
+
}
|
|
4669
|
+
/**
|
|
4670
|
+
* Translates a translation placeholder key to its text and collects font properties.
|
|
4671
|
+
*
|
|
4672
|
+
* @param placeholderKey - Translation key for the placeholder
|
|
4673
|
+
* @param fontProps - Font properties sets to collect font information
|
|
4674
|
+
* @param interpolation - Interpolation keys and values to replace
|
|
4675
|
+
* string interpolation placeholders in the translated text
|
|
4676
|
+
* @returns result object with the translated text and whether it is a fallback translation
|
|
4677
|
+
*/
|
|
4678
|
+
translatePlaceholder(placeholderKey, fontProps, interpolation) {
|
|
4679
|
+
let tf = this.tf(placeholderKey, interpolation);
|
|
4680
|
+
let isFallback = false;
|
|
4681
|
+
if (tf?.text === void 0) {
|
|
4682
|
+
tf = this.tf(placeholderKey, {
|
|
4683
|
+
useFallbackLocale: true,
|
|
4684
|
+
...interpolation
|
|
4685
|
+
});
|
|
4686
|
+
isFallback = true;
|
|
4687
|
+
}
|
|
4688
|
+
if (tf?.fontSize !== void 0) {
|
|
4689
|
+
fontProps.size.add(tf.fontSize);
|
|
4690
|
+
}
|
|
4691
|
+
if (tf?.fontName !== void 0) {
|
|
4692
|
+
fontProps.name.add(tf.fontName);
|
|
4693
|
+
}
|
|
4694
|
+
if (tf?.fontNames !== void 0) {
|
|
4695
|
+
fontProps.names.add(tf.fontNames.sort().join(","));
|
|
4696
|
+
}
|
|
4697
|
+
return {
|
|
4698
|
+
text: tf?.text ?? placeholderKey,
|
|
4699
|
+
isFallback
|
|
4700
|
+
};
|
|
4701
|
+
}
|
|
4702
|
+
/**
|
|
4703
|
+
* Extracts translation key placeholders from a string.
|
|
4704
|
+
*
|
|
4705
|
+
* @remarks Translation key placeholders are denoted by double square brackets,
|
|
4706
|
+
* e.g., "The translated word is [[RED]]", and RED is a key for translation.
|
|
4707
|
+
*
|
|
4708
|
+
* @param s - string to search for placeholders
|
|
4709
|
+
* @returns an array of placeholders found in the string, without the square
|
|
4710
|
+
* brackets
|
|
4711
|
+
*/
|
|
4712
|
+
getTranslationPlaceholders(s) {
|
|
4713
|
+
const [open, close] = [
|
|
4714
|
+
TRANSLATION_INTERPOLATION_CHARACTERS.slice(0, 2),
|
|
4715
|
+
TRANSLATION_INTERPOLATION_CHARACTERS.slice(2)
|
|
4716
|
+
];
|
|
4717
|
+
const escapedOpen = open.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4718
|
+
const escapedClose = close.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4719
|
+
const regex = new RegExp(`${escapedOpen}(.*?)${escapedClose}`, "g");
|
|
4720
|
+
const matches = s.match(regex);
|
|
4721
|
+
if (!matches) {
|
|
4722
|
+
return [];
|
|
4723
|
+
}
|
|
4724
|
+
return matches.map(
|
|
4725
|
+
(placeholder) => placeholder.slice(open.length, -close.length).trim()
|
|
4726
|
+
);
|
|
4727
|
+
}
|
|
4728
|
+
/**
|
|
4729
|
+
* Logs warnings if the string to be localized has conflicting font
|
|
4730
|
+
* properties.
|
|
4731
|
+
*
|
|
4732
|
+
* @remarks This can happen due to multiple placeholders in the string
|
|
4733
|
+
* that specify different font sizes, font names, or font names arrays.
|
|
4734
|
+
*
|
|
4735
|
+
* @param key - Translation key for which the string is being localized
|
|
4736
|
+
* @param fontProps - font properties sets collected from the placeholders
|
|
4737
|
+
*/
|
|
4738
|
+
warnConflictingFontProperties(key, fontProps) {
|
|
4739
|
+
if (fontProps.size.size > 1) {
|
|
4740
|
+
console.warn(
|
|
4741
|
+
`i18n: placeholders set multiple different font sizes in string to be localized. Only one will be used. String: ${key}`
|
|
4742
|
+
);
|
|
4743
|
+
}
|
|
4744
|
+
if (fontProps.name.size > 1) {
|
|
4745
|
+
console.warn(
|
|
4746
|
+
`i18n: placeholders set multiple different font names within string to be localized. Only one will be used. String: ${key}`
|
|
4747
|
+
);
|
|
4748
|
+
}
|
|
4749
|
+
if (fontProps.names.size > 1) {
|
|
4750
|
+
console.warn(
|
|
4751
|
+
`i18n: placeholders set multiple different font names arrays within string to be localized. Only one will be used. String: ${key}`
|
|
4752
|
+
);
|
|
4753
|
+
}
|
|
4754
|
+
}
|
|
4575
4755
|
/**
|
|
4576
4756
|
* Returns the translation text for the given key in the current locale.
|
|
4577
4757
|
*
|
|
@@ -4604,6 +4784,7 @@ class I18n {
|
|
|
4604
4784
|
const t = this.translation[this.locale]?.[key];
|
|
4605
4785
|
if (this.isStringOrTextWithFontCustomization(t)) {
|
|
4606
4786
|
return this.insertInterpolations(
|
|
4787
|
+
STRING_INTERPOLATION_CHARACTERS,
|
|
4607
4788
|
this.getKeyText(t),
|
|
4608
4789
|
interpolationMap
|
|
4609
4790
|
);
|
|
@@ -4613,6 +4794,7 @@ class I18n {
|
|
|
4613
4794
|
const fallbackT = this.translation[this.fallbackLocale]?.[key];
|
|
4614
4795
|
if (this.isStringOrTextWithFontCustomization(fallbackT)) {
|
|
4615
4796
|
return this.insertInterpolations(
|
|
4797
|
+
STRING_INTERPOLATION_CHARACTERS,
|
|
4616
4798
|
this.getKeyText(fallbackT),
|
|
4617
4799
|
interpolationMap
|
|
4618
4800
|
);
|
|
@@ -4641,6 +4823,7 @@ class I18n {
|
|
|
4641
4823
|
const tf = this.getKeyTextAndFont(t, this.locale);
|
|
4642
4824
|
if (tf.text) {
|
|
4643
4825
|
tf.text = this.insertInterpolations(
|
|
4826
|
+
STRING_INTERPOLATION_CHARACTERS,
|
|
4644
4827
|
tf.text,
|
|
4645
4828
|
interpolationMap
|
|
4646
4829
|
);
|
|
@@ -4657,6 +4840,7 @@ class I18n {
|
|
|
4657
4840
|
);
|
|
4658
4841
|
if (tf.text) {
|
|
4659
4842
|
tf.text = this.insertInterpolations(
|
|
4843
|
+
STRING_INTERPOLATION_CHARACTERS,
|
|
4660
4844
|
tf.text,
|
|
4661
4845
|
interpolationMap
|
|
4662
4846
|
);
|
|
@@ -4713,15 +4897,19 @@ class I18n {
|
|
|
4713
4897
|
return { text, fontSize, fontNames };
|
|
4714
4898
|
}
|
|
4715
4899
|
}
|
|
4716
|
-
insertInterpolations(text, options) {
|
|
4900
|
+
insertInterpolations(specialChars, text, options) {
|
|
4717
4901
|
if (!options) {
|
|
4718
4902
|
return text;
|
|
4719
4903
|
}
|
|
4720
|
-
|
|
4904
|
+
const [open, close] = [specialChars.slice(0, 2), specialChars.slice(2)];
|
|
4905
|
+
const escapedOpen = open.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4906
|
+
const escapedClose = close.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4907
|
+
const regex = new RegExp(`${escapedOpen}(.*?)${escapedClose}`, "g");
|
|
4908
|
+
return text.replace(regex, (_match, key) => {
|
|
4721
4909
|
if (Object.prototype.hasOwnProperty.call(options, key)) {
|
|
4722
4910
|
return options[key];
|
|
4723
4911
|
} else {
|
|
4724
|
-
throw new
|
|
4912
|
+
throw new M2Error(
|
|
4725
4913
|
`insertInterpolations(): placeholder "${key}" not found. Text was ${text}, provided interpolation was ${JSON.stringify(options)}`
|
|
4726
4914
|
);
|
|
4727
4915
|
}
|
|
@@ -4931,7 +5119,7 @@ class EventStore {
|
|
|
4931
5119
|
while (this.events.length > 0 && this.events[0].timestamp <= replayTimestamp) {
|
|
4932
5120
|
const event = this.events.shift();
|
|
4933
5121
|
if (!event) {
|
|
4934
|
-
throw new
|
|
5122
|
+
throw new M2Error("EventStore.dequeueEvents(): undefined event");
|
|
4935
5123
|
}
|
|
4936
5124
|
if (event.sequence !== void 0 && event.sequence > this.replayThoughSequence) {
|
|
4937
5125
|
continue;
|
|
@@ -4951,7 +5139,7 @@ class EventStore {
|
|
|
4951
5139
|
sortEventStore(events) {
|
|
4952
5140
|
events.sort((a, b) => {
|
|
4953
5141
|
if (a.sequence === void 0 || b.sequence === void 0) {
|
|
4954
|
-
throw new
|
|
5142
|
+
throw new M2Error("EventStore.sortEventStore(): undefined sequence");
|
|
4955
5143
|
}
|
|
4956
5144
|
if (a.sequence !== b.sequence) {
|
|
4957
5145
|
return a.sequence - b.sequence;
|
|
@@ -4979,7 +5167,9 @@ const M2FontStatus = {
|
|
|
4979
5167
|
const TAG_NAME = {
|
|
4980
5168
|
UNDERLINE: "u",
|
|
4981
5169
|
ITALIC: "i",
|
|
4982
|
-
BOLD: "b"
|
|
5170
|
+
BOLD: "b",
|
|
5171
|
+
STRIKETHROUGH: "s",
|
|
5172
|
+
OVERLINE: "o"
|
|
4983
5173
|
};
|
|
4984
5174
|
class Label extends M2Node {
|
|
4985
5175
|
/**
|
|
@@ -5011,10 +5201,9 @@ class Label extends M2Node {
|
|
|
5011
5201
|
// public getter/setter is below
|
|
5012
5202
|
this._localize = true;
|
|
5013
5203
|
this.localizedFontNames = [];
|
|
5204
|
+
this.textAfterLocalization = "";
|
|
5014
5205
|
this.plainText = "";
|
|
5015
5206
|
this.styleSegments = [];
|
|
5016
|
-
this.underlinedRanges = [];
|
|
5017
|
-
this.currentBuilderPosition = 0;
|
|
5018
5207
|
handleInterfaceOptions(this, options);
|
|
5019
5208
|
if (options.horizontalAlignmentMode) {
|
|
5020
5209
|
this.horizontalAlignmentMode = options.horizontalAlignmentMode;
|
|
@@ -5055,7 +5244,7 @@ class Label extends M2Node {
|
|
|
5055
5244
|
ckTextAlign = this.canvasKit.TextAlign.Right;
|
|
5056
5245
|
break;
|
|
5057
5246
|
default:
|
|
5058
|
-
throw new
|
|
5247
|
+
throw new M2Error("unknown horizontalAlignmentMode");
|
|
5059
5248
|
}
|
|
5060
5249
|
if (!this.text) {
|
|
5061
5250
|
this.text = "";
|
|
@@ -5066,14 +5255,13 @@ class Label extends M2Node {
|
|
|
5066
5255
|
this.fontColor[2],
|
|
5067
5256
|
this.fontColor[3]
|
|
5068
5257
|
);
|
|
5069
|
-
let textAfterLocalization;
|
|
5070
5258
|
const i18n = this.game.i18n;
|
|
5071
5259
|
if (i18n && this.localize !== false) {
|
|
5072
5260
|
const textLocalization = i18n.getTextLocalization(
|
|
5073
5261
|
this.text,
|
|
5074
5262
|
this.interpolation
|
|
5075
5263
|
);
|
|
5076
|
-
textAfterLocalization = textLocalization.text;
|
|
5264
|
+
this.textAfterLocalization = textLocalization.text;
|
|
5077
5265
|
this.localizedFontSize = textLocalization.fontSize;
|
|
5078
5266
|
this.localizedFontName = textLocalization.fontName;
|
|
5079
5267
|
this.localizedFontNames = textLocalization.fontNames ?? [];
|
|
@@ -5086,15 +5274,13 @@ class Label extends M2Node {
|
|
|
5086
5274
|
);
|
|
5087
5275
|
}
|
|
5088
5276
|
} else {
|
|
5089
|
-
textAfterLocalization = this.text;
|
|
5277
|
+
this.textAfterLocalization = this.text;
|
|
5090
5278
|
}
|
|
5091
|
-
|
|
5092
|
-
this.underlinedRanges = [];
|
|
5093
|
-
const parsedText = this.parseFormattedText(textAfterLocalization);
|
|
5279
|
+
const parsedText = this.parseFormattedText(this.textAfterLocalization);
|
|
5094
5280
|
this.plainText = parsedText.plainText;
|
|
5095
5281
|
this.styleSegments = parsedText.styleSegments;
|
|
5096
5282
|
if (this.fontName && this.fontNames) {
|
|
5097
|
-
throw new
|
|
5283
|
+
throw new M2Error("cannot specify both fontName and fontNames");
|
|
5098
5284
|
}
|
|
5099
5285
|
const fontManager = this.game.fontManager;
|
|
5100
5286
|
const requiredFonts = this.getRequiredLabelFonts(fontManager);
|
|
@@ -5132,13 +5318,6 @@ class Label extends M2Node {
|
|
|
5132
5318
|
} else {
|
|
5133
5319
|
this.backgroundPaint.setColor(this.canvasKit.Color(0, 0, 0, 0));
|
|
5134
5320
|
}
|
|
5135
|
-
if (!this._underlinePaint) {
|
|
5136
|
-
this._underlinePaint = new this.canvasKit.Paint();
|
|
5137
|
-
}
|
|
5138
|
-
this.underlinePaint.setColor(this.fontPaint.getColor());
|
|
5139
|
-
this.underlinePaint.setAlphaf(this.absoluteAlpha);
|
|
5140
|
-
this.underlinePaint.setStyle(this.canvasKit.PaintStyle.Fill);
|
|
5141
|
-
this.underlinePaint.setAntiAlias(true);
|
|
5142
5321
|
const defaultStyle = {
|
|
5143
5322
|
fontFamilies: requiredFonts.map((font) => font.fontName),
|
|
5144
5323
|
fontSize: (this.localizedFontSize ?? this.fontSize) * m2c2Globals.canvasScale,
|
|
@@ -5164,7 +5343,11 @@ class Label extends M2Node {
|
|
|
5164
5343
|
this.fontPaint,
|
|
5165
5344
|
this.backgroundPaint
|
|
5166
5345
|
);
|
|
5167
|
-
this.
|
|
5346
|
+
this.addStyleSegmentsToParagraphBuilder(
|
|
5347
|
+
this.builder,
|
|
5348
|
+
this.styleSegments,
|
|
5349
|
+
defaultStyle
|
|
5350
|
+
);
|
|
5168
5351
|
if (this.paragraph) {
|
|
5169
5352
|
this.paragraph.delete();
|
|
5170
5353
|
}
|
|
@@ -5176,7 +5359,9 @@ class Label extends M2Node {
|
|
|
5176
5359
|
let calculatedWidth = preferredWidth;
|
|
5177
5360
|
if (preferredWidth === 0 || this.layout.width === 0) {
|
|
5178
5361
|
if (this.parent === void 0) {
|
|
5179
|
-
throw new
|
|
5362
|
+
throw new M2Error(
|
|
5363
|
+
"width is set to match parent, but node has no parent"
|
|
5364
|
+
);
|
|
5180
5365
|
}
|
|
5181
5366
|
const marginStart = this.layout.marginStart ?? 0;
|
|
5182
5367
|
const marginEnd = this.layout.marginEnd ?? 0;
|
|
@@ -5209,7 +5394,9 @@ class Label extends M2Node {
|
|
|
5209
5394
|
const validTags = /* @__PURE__ */ new Set([
|
|
5210
5395
|
TAG_NAME.UNDERLINE,
|
|
5211
5396
|
TAG_NAME.BOLD,
|
|
5212
|
-
TAG_NAME.ITALIC
|
|
5397
|
+
TAG_NAME.ITALIC,
|
|
5398
|
+
TAG_NAME.STRIKETHROUGH,
|
|
5399
|
+
TAG_NAME.OVERLINE
|
|
5213
5400
|
]);
|
|
5214
5401
|
const tagPattern = /<\/?([^>]+)>/g;
|
|
5215
5402
|
let lastIndex = 0;
|
|
@@ -5247,13 +5434,13 @@ class Label extends M2Node {
|
|
|
5247
5434
|
plainIndex += beforeTag.length;
|
|
5248
5435
|
if (isClosing) {
|
|
5249
5436
|
if (tagStack.length === 0) {
|
|
5250
|
-
throw new
|
|
5437
|
+
throw new M2Error(
|
|
5251
5438
|
`Label has closing tag </${tagName}> at ${position} without matching opening tag. Text is: ${text}`
|
|
5252
5439
|
);
|
|
5253
5440
|
}
|
|
5254
5441
|
const lastOpenTag = tagStack.pop();
|
|
5255
5442
|
if (lastOpenTag !== tagName) {
|
|
5256
|
-
throw new
|
|
5443
|
+
throw new M2Error(
|
|
5257
5444
|
`Label has improperly nested tags at ${position}. Expected </${lastOpenTag}> but found </${tagName}>. Tags must be properly nested. Text is: ${text}`
|
|
5258
5445
|
);
|
|
5259
5446
|
}
|
|
@@ -5274,7 +5461,7 @@ class Label extends M2Node {
|
|
|
5274
5461
|
}
|
|
5275
5462
|
plainText += text.substring(lastIndex);
|
|
5276
5463
|
if (tagStack.length > 0) {
|
|
5277
|
-
throw new
|
|
5464
|
+
throw new M2Error(
|
|
5278
5465
|
`Label has unclosed format tags: <${tagStack.join(">, <")}>. All tags must be closed. Text is: ${text}`
|
|
5279
5466
|
);
|
|
5280
5467
|
}
|
|
@@ -5303,17 +5490,22 @@ class Label extends M2Node {
|
|
|
5303
5490
|
styleSegments: segments
|
|
5304
5491
|
};
|
|
5305
5492
|
}
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5493
|
+
/**
|
|
5494
|
+
* Adds text segments with consistent styling to the paragraph builder.
|
|
5495
|
+
*
|
|
5496
|
+
* @param builder - {@link ParagraphBuilder}
|
|
5497
|
+
* @param styleSegments - Segments of text with consistent styling
|
|
5498
|
+
* @param defaultStyle - Default style to apply
|
|
5499
|
+
*/
|
|
5500
|
+
addStyleSegmentsToParagraphBuilder(builder, styleSegments, defaultStyle) {
|
|
5501
|
+
if (styleSegments.length === 0) {
|
|
5502
|
+
builder.addText(this.plainText);
|
|
5312
5503
|
} else {
|
|
5313
5504
|
let lastIndex = 0;
|
|
5314
|
-
for (const segment of
|
|
5505
|
+
for (const segment of styleSegments) {
|
|
5315
5506
|
if (segment.start > lastIndex) {
|
|
5316
5507
|
this.addTextWithStyle(
|
|
5508
|
+
builder,
|
|
5317
5509
|
this.plainText.substring(lastIndex, segment.start),
|
|
5318
5510
|
defaultStyle
|
|
5319
5511
|
);
|
|
@@ -5321,8 +5513,8 @@ class Label extends M2Node {
|
|
|
5321
5513
|
const styleModifiers = {};
|
|
5322
5514
|
if (segment.styles.has(TAG_NAME.BOLD)) {
|
|
5323
5515
|
styleModifiers.fontStyle = {
|
|
5324
|
-
...defaultStyle.fontStyle,
|
|
5325
|
-
weight: this.canvasKit.FontWeight.
|
|
5516
|
+
...styleModifiers.fontStyle || defaultStyle.fontStyle,
|
|
5517
|
+
weight: this.canvasKit.FontWeight.Black
|
|
5326
5518
|
};
|
|
5327
5519
|
}
|
|
5328
5520
|
if (segment.styles.has(TAG_NAME.ITALIC)) {
|
|
@@ -5332,9 +5524,35 @@ class Label extends M2Node {
|
|
|
5332
5524
|
};
|
|
5333
5525
|
}
|
|
5334
5526
|
if (segment.styles.has(TAG_NAME.UNDERLINE)) {
|
|
5335
|
-
styleModifiers.
|
|
5527
|
+
styleModifiers.decoration = this.canvasKit.UnderlineDecoration;
|
|
5528
|
+
styleModifiers.decorationThickness = 1;
|
|
5529
|
+
styleModifiers.decorationStyle = this.canvasKit.DecorationStyle.Solid;
|
|
5530
|
+
styleModifiers.decorationColor = this.fontColor;
|
|
5531
|
+
}
|
|
5532
|
+
if (segment.styles.has(TAG_NAME.STRIKETHROUGH)) {
|
|
5533
|
+
styleModifiers.decoration = this.canvasKit.LineThroughDecoration;
|
|
5534
|
+
styleModifiers.decorationThickness = 1;
|
|
5535
|
+
styleModifiers.decorationStyle = this.canvasKit.DecorationStyle.Solid;
|
|
5536
|
+
styleModifiers.decorationColor = this.fontColor;
|
|
5537
|
+
}
|
|
5538
|
+
if (segment.styles.has(TAG_NAME.OVERLINE)) {
|
|
5539
|
+
styleModifiers.decoration = this.canvasKit.OverlineDecoration;
|
|
5540
|
+
styleModifiers.decorationThickness = 1;
|
|
5541
|
+
styleModifiers.decorationStyle = this.canvasKit.DecorationStyle.Solid;
|
|
5542
|
+
styleModifiers.decorationColor = this.fontColor;
|
|
5543
|
+
}
|
|
5544
|
+
const numberOfDecorations = [
|
|
5545
|
+
TAG_NAME.UNDERLINE,
|
|
5546
|
+
TAG_NAME.STRIKETHROUGH,
|
|
5547
|
+
TAG_NAME.OVERLINE
|
|
5548
|
+
].filter((tag) => segment.styles.has(tag)).length;
|
|
5549
|
+
if (numberOfDecorations > 1) {
|
|
5550
|
+
throw new M2Error(
|
|
5551
|
+
`Label does not support multiple text decorations (underline, overline, or strikethrough) on a single text segment. Text is: ${this.textAfterLocalization}`
|
|
5552
|
+
);
|
|
5336
5553
|
}
|
|
5337
5554
|
this.addTextWithStyle(
|
|
5555
|
+
builder,
|
|
5338
5556
|
this.plainText.substring(segment.start, segment.end),
|
|
5339
5557
|
defaultStyle,
|
|
5340
5558
|
styleModifiers
|
|
@@ -5343,33 +5561,31 @@ class Label extends M2Node {
|
|
|
5343
5561
|
}
|
|
5344
5562
|
if (lastIndex < this.plainText.length) {
|
|
5345
5563
|
this.addTextWithStyle(
|
|
5564
|
+
builder,
|
|
5346
5565
|
this.plainText.substring(lastIndex),
|
|
5347
5566
|
defaultStyle
|
|
5348
5567
|
);
|
|
5349
5568
|
}
|
|
5350
5569
|
}
|
|
5351
5570
|
}
|
|
5352
|
-
|
|
5353
|
-
|
|
5571
|
+
/**
|
|
5572
|
+
* Helper that adds text to the paragraph builder with the specified style.
|
|
5573
|
+
*
|
|
5574
|
+
* @param builder - {@link ParagraphBuilder}
|
|
5575
|
+
* @param text - The text to add
|
|
5576
|
+
* @param defaultStyle - The default style to apply
|
|
5577
|
+
* @param styleModifiers - Additional style modifications
|
|
5578
|
+
* @returns void
|
|
5579
|
+
*/
|
|
5580
|
+
addTextWithStyle(builder, text, defaultStyle, styleModifiers = {}) {
|
|
5354
5581
|
if (!text) return;
|
|
5355
5582
|
const style = {
|
|
5356
5583
|
...defaultStyle,
|
|
5357
5584
|
...styleModifiers
|
|
5358
5585
|
};
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
start: currentPosition,
|
|
5363
|
-
end: currentPosition + text.length
|
|
5364
|
-
});
|
|
5365
|
-
}
|
|
5366
|
-
if (!this.builder) {
|
|
5367
|
-
throw new Error("ParagraphBuilder is undefined");
|
|
5368
|
-
}
|
|
5369
|
-
this.builder.pushPaintStyle(style, this.fontPaint, this.backgroundPaint);
|
|
5370
|
-
this.builder.addText(text);
|
|
5371
|
-
this.currentBuilderPosition += text.length;
|
|
5372
|
-
this.builder.pop();
|
|
5586
|
+
builder.pushPaintStyle(style, this.fontPaint, this.backgroundPaint);
|
|
5587
|
+
builder.addText(text);
|
|
5588
|
+
builder.pop();
|
|
5373
5589
|
}
|
|
5374
5590
|
/**
|
|
5375
5591
|
* Determines the M2Font objects that need to be ready in order to draw
|
|
@@ -5401,7 +5617,7 @@ class Label extends M2Node {
|
|
|
5401
5617
|
} else if (this.fontNames !== void 0 && this.fontNames.length > 0) {
|
|
5402
5618
|
requiredFonts = this.fontNames.map((font) => fontManager.fonts[font]);
|
|
5403
5619
|
} else {
|
|
5404
|
-
throw new
|
|
5620
|
+
throw new M2Error("cannot determine required fonts");
|
|
5405
5621
|
}
|
|
5406
5622
|
return requiredFonts;
|
|
5407
5623
|
}
|
|
@@ -5411,9 +5627,7 @@ class Label extends M2Node {
|
|
|
5411
5627
|
this.builder,
|
|
5412
5628
|
this._fontPaint,
|
|
5413
5629
|
// use backing field since it may be undefined
|
|
5414
|
-
this._backgroundPaint
|
|
5415
|
-
// use backing field since it may be undefined
|
|
5416
|
-
this._underlinePaint
|
|
5630
|
+
this._backgroundPaint
|
|
5417
5631
|
// use backing field since it may be undefined
|
|
5418
5632
|
]);
|
|
5419
5633
|
}
|
|
@@ -5578,7 +5792,7 @@ class Label extends M2Node {
|
|
|
5578
5792
|
}
|
|
5579
5793
|
get backgroundPaint() {
|
|
5580
5794
|
if (!this._backgroundPaint) {
|
|
5581
|
-
throw new
|
|
5795
|
+
throw new M2Error("backgroundPaint cannot be undefined");
|
|
5582
5796
|
}
|
|
5583
5797
|
return this._backgroundPaint;
|
|
5584
5798
|
}
|
|
@@ -5587,22 +5801,13 @@ class Label extends M2Node {
|
|
|
5587
5801
|
}
|
|
5588
5802
|
get fontPaint() {
|
|
5589
5803
|
if (!this._fontPaint) {
|
|
5590
|
-
throw new
|
|
5804
|
+
throw new M2Error("fontPaint cannot be undefined");
|
|
5591
5805
|
}
|
|
5592
5806
|
return this._fontPaint;
|
|
5593
5807
|
}
|
|
5594
5808
|
set fontPaint(fontPaint) {
|
|
5595
5809
|
this._fontPaint = fontPaint;
|
|
5596
5810
|
}
|
|
5597
|
-
get underlinePaint() {
|
|
5598
|
-
if (!this._underlinePaint) {
|
|
5599
|
-
throw new Error("underlinePaint cannot be undefined");
|
|
5600
|
-
}
|
|
5601
|
-
return this._underlinePaint;
|
|
5602
|
-
}
|
|
5603
|
-
set underlinePaint(underlinePaint) {
|
|
5604
|
-
this._underlinePaint = underlinePaint;
|
|
5605
|
-
}
|
|
5606
5811
|
/**
|
|
5607
5812
|
* Duplicates a node using deep copy.
|
|
5608
5813
|
*
|
|
@@ -5647,45 +5852,13 @@ class Label extends M2Node {
|
|
|
5647
5852
|
const x = (this.absolutePosition.x - this.size.width * this.anchorPoint.x * this.absoluteScale) * drawScale;
|
|
5648
5853
|
const y = (this.absolutePosition.y - this.size.height * this.anchorPoint.y * this.absoluteScale) * drawScale;
|
|
5649
5854
|
if (this.paragraph === void 0) {
|
|
5650
|
-
throw new
|
|
5855
|
+
throw new M2Error("no paragraph");
|
|
5651
5856
|
}
|
|
5652
5857
|
canvas.drawParagraph(this.paragraph, x, y);
|
|
5653
|
-
if (this.underlinedRanges.length > 0) {
|
|
5654
|
-
this.drawUnderlines(canvas, this.paragraph, x, y);
|
|
5655
|
-
}
|
|
5656
5858
|
canvas.restore();
|
|
5657
5859
|
}
|
|
5658
5860
|
super.drawChildren(canvas);
|
|
5659
5861
|
}
|
|
5660
|
-
drawUnderlines(canvas, paragraph, x, y) {
|
|
5661
|
-
const drawScale = m2c2Globals.canvasScale / this.absoluteScale;
|
|
5662
|
-
for (const range of this.underlinedRanges) {
|
|
5663
|
-
const positions = paragraph.getRectsForRange(
|
|
5664
|
-
range.start,
|
|
5665
|
-
range.end,
|
|
5666
|
-
this.canvasKit.RectHeightStyle.Max,
|
|
5667
|
-
this.canvasKit.RectWidthStyle.Tight
|
|
5668
|
-
);
|
|
5669
|
-
for (const rect of positions) {
|
|
5670
|
-
const rectHeight = rect.rect[3] - rect.rect[1];
|
|
5671
|
-
const underlineVerticalOffset = -rectHeight * 0.08 * drawScale * this.absoluteScale;
|
|
5672
|
-
const lineThickness = rectHeight * 0.04 * drawScale * this.absoluteScale;
|
|
5673
|
-
canvas.drawRect(
|
|
5674
|
-
[
|
|
5675
|
-
x + rect.rect[0],
|
|
5676
|
-
// left
|
|
5677
|
-
y + rect.rect[3] + underlineVerticalOffset,
|
|
5678
|
-
// bottom of text + offset
|
|
5679
|
-
x + rect.rect[2],
|
|
5680
|
-
// right
|
|
5681
|
-
y + rect.rect[3] + underlineVerticalOffset + lineThickness
|
|
5682
|
-
// bottom of text + offset + thickness
|
|
5683
|
-
],
|
|
5684
|
-
this.underlinePaint
|
|
5685
|
-
);
|
|
5686
|
-
}
|
|
5687
|
-
}
|
|
5688
|
-
}
|
|
5689
5862
|
warmup(canvas) {
|
|
5690
5863
|
const i18n = this.game.i18n;
|
|
5691
5864
|
if (i18n && this.localize !== false) {
|
|
@@ -5705,7 +5878,7 @@ class Label extends M2Node {
|
|
|
5705
5878
|
}
|
|
5706
5879
|
this.initialize();
|
|
5707
5880
|
if (!this.paragraph) {
|
|
5708
|
-
throw new
|
|
5881
|
+
throw new M2Error(
|
|
5709
5882
|
`warmup Label node ${this.toString()}: paragraph is undefined`
|
|
5710
5883
|
);
|
|
5711
5884
|
}
|
|
@@ -5774,7 +5947,7 @@ class Scene extends M2Node {
|
|
|
5774
5947
|
*/
|
|
5775
5948
|
get game() {
|
|
5776
5949
|
if (this._game === void 0) {
|
|
5777
|
-
throw new
|
|
5950
|
+
throw new M2Error(`Scene ${this} has not been added to a game.`);
|
|
5778
5951
|
}
|
|
5779
5952
|
return this._game;
|
|
5780
5953
|
}
|
|
@@ -5926,7 +6099,7 @@ class Scene extends M2Node {
|
|
|
5926
6099
|
canvas.scale(1 / drawScale, 1 / drawScale);
|
|
5927
6100
|
M2c2KitHelpers.rotateCanvasForDrawableNode(canvas, this);
|
|
5928
6101
|
if (!this.backgroundPaint) {
|
|
5929
|
-
throw new
|
|
6102
|
+
throw new M2Error(`in Scene ${this}, background paint is undefined.`);
|
|
5930
6103
|
}
|
|
5931
6104
|
if (this.absoluteAlphaChange !== 0) {
|
|
5932
6105
|
this.backgroundPaint.setAlphaf(this.absoluteAlpha);
|
|
@@ -5949,7 +6122,7 @@ class Scene extends M2Node {
|
|
|
5949
6122
|
const drawScale = m2c2Globals.canvasScale / this.absoluteScale;
|
|
5950
6123
|
canvas.scale(1 / drawScale, 1 / drawScale);
|
|
5951
6124
|
if (!this.backgroundPaint) {
|
|
5952
|
-
throw new
|
|
6125
|
+
throw new M2Error(`in Scene ${this}, background paint is undefined.`);
|
|
5953
6126
|
}
|
|
5954
6127
|
canvas.drawRect(
|
|
5955
6128
|
[
|
|
@@ -6008,7 +6181,7 @@ class Shape extends M2Node {
|
|
|
6008
6181
|
}
|
|
6009
6182
|
if (this.shapeIsSvgStringPath()) {
|
|
6010
6183
|
if (options.size !== void 0) {
|
|
6011
|
-
throw new
|
|
6184
|
+
throw new M2Error(
|
|
6012
6185
|
"Size cannot be specified when path is SVG string path"
|
|
6013
6186
|
);
|
|
6014
6187
|
}
|
|
@@ -6016,7 +6189,7 @@ class Shape extends M2Node {
|
|
|
6016
6189
|
this.svgPathRequestedWidth = options.path.width;
|
|
6017
6190
|
this.svgPathRequestedHeight = options.path.height;
|
|
6018
6191
|
if (this.svgPathRequestedHeight !== void 0 && this.svgPathRequestedWidth !== void 0) {
|
|
6019
|
-
throw new
|
|
6192
|
+
throw new M2Error(
|
|
6020
6193
|
"Cannot specify both width and height for SVG string path."
|
|
6021
6194
|
);
|
|
6022
6195
|
}
|
|
@@ -6027,7 +6200,7 @@ class Shape extends M2Node {
|
|
|
6027
6200
|
this.lineWidth = Constants.DEFAULT_PATH_LINE_WIDTH;
|
|
6028
6201
|
}
|
|
6029
6202
|
if (options.circleOfRadius || options.rect) {
|
|
6030
|
-
throw new
|
|
6203
|
+
throw new M2Error(
|
|
6031
6204
|
"Shape must specify only one of: path, circleOfRadius, or rect"
|
|
6032
6205
|
);
|
|
6033
6206
|
}
|
|
@@ -6036,10 +6209,10 @@ class Shape extends M2Node {
|
|
|
6036
6209
|
this.circleOfRadius = options.circleOfRadius;
|
|
6037
6210
|
this.shapeType = ShapeType.Circle;
|
|
6038
6211
|
if (options.size !== void 0) {
|
|
6039
|
-
throw new
|
|
6212
|
+
throw new M2Error("Size cannot be specified for circle shape");
|
|
6040
6213
|
}
|
|
6041
6214
|
if (options.path || options.rect) {
|
|
6042
|
-
throw new
|
|
6215
|
+
throw new M2Error(
|
|
6043
6216
|
"Shape must specify only one of: path, circleOfRadius, or rect"
|
|
6044
6217
|
);
|
|
6045
6218
|
}
|
|
@@ -6062,7 +6235,7 @@ class Shape extends M2Node {
|
|
|
6062
6235
|
}
|
|
6063
6236
|
this.shapeType = ShapeType.Rectangle;
|
|
6064
6237
|
if (options.size !== void 0) {
|
|
6065
|
-
throw new
|
|
6238
|
+
throw new M2Error("Size cannot be specified for rectangle shape");
|
|
6066
6239
|
}
|
|
6067
6240
|
}
|
|
6068
6241
|
if (options.cornerRadius !== void 0) {
|
|
@@ -6117,7 +6290,7 @@ class Shape extends M2Node {
|
|
|
6117
6290
|
if (this.shapeIsSvgStringPath()) {
|
|
6118
6291
|
const pathString = this.path.pathString ?? this.path.svgPathString;
|
|
6119
6292
|
if (!pathString) {
|
|
6120
|
-
throw new
|
|
6293
|
+
throw new M2Error("SVG Path string is null/undefined");
|
|
6121
6294
|
}
|
|
6122
6295
|
if (this.path.svgPathString !== void 0) {
|
|
6123
6296
|
console.warn(
|
|
@@ -6126,7 +6299,7 @@ class Shape extends M2Node {
|
|
|
6126
6299
|
}
|
|
6127
6300
|
this.ckPath = this.canvasKit.Path.MakeFromSVGString(pathString);
|
|
6128
6301
|
if (!this.ckPath) {
|
|
6129
|
-
throw new
|
|
6302
|
+
throw new M2Error("could not make CanvasKit Path from SVG string");
|
|
6130
6303
|
}
|
|
6131
6304
|
const bounds = this.ckPath.getBounds();
|
|
6132
6305
|
this.svgPathWidth = bounds[2] + (bounds[0] < 0 ? Math.abs(bounds[0]) : 0);
|
|
@@ -6144,7 +6317,7 @@ class Shape extends M2Node {
|
|
|
6144
6317
|
}
|
|
6145
6318
|
if (this.shapeIsM2Path()) {
|
|
6146
6319
|
if (this.size.width === 0 || this.size.height === 0 || this.size.width === void 0 || this.size.height === void 0) {
|
|
6147
|
-
throw new
|
|
6320
|
+
throw new M2Error(
|
|
6148
6321
|
"Size of shape must have non-zero height and width when path is M2Path"
|
|
6149
6322
|
);
|
|
6150
6323
|
}
|
|
@@ -6336,7 +6509,7 @@ class Shape extends M2Node {
|
|
|
6336
6509
|
}
|
|
6337
6510
|
}
|
|
6338
6511
|
if (paint === void 0) {
|
|
6339
|
-
throw new
|
|
6512
|
+
throw new M2Error("paint is undefined");
|
|
6340
6513
|
}
|
|
6341
6514
|
canvas.drawLine(
|
|
6342
6515
|
pathOriginX + points[i].x * m2c2Globals.canvasScale,
|
|
@@ -6649,7 +6822,7 @@ class Shape extends M2Node {
|
|
|
6649
6822
|
}
|
|
6650
6823
|
get fillColorPaintAntialiased() {
|
|
6651
6824
|
if (!this._fillColorPaintAntialiased) {
|
|
6652
|
-
throw new
|
|
6825
|
+
throw new M2Error("fillColorPaintAntiAliased is undefined");
|
|
6653
6826
|
}
|
|
6654
6827
|
return this._fillColorPaintAntialiased;
|
|
6655
6828
|
}
|
|
@@ -6658,7 +6831,7 @@ class Shape extends M2Node {
|
|
|
6658
6831
|
}
|
|
6659
6832
|
get strokeColorPaintAntialiased() {
|
|
6660
6833
|
if (!this._strokeColorPaintAntialiased) {
|
|
6661
|
-
throw new
|
|
6834
|
+
throw new M2Error("strokeColorPaintAntiAliased is undefined");
|
|
6662
6835
|
}
|
|
6663
6836
|
return this._strokeColorPaintAntialiased;
|
|
6664
6837
|
}
|
|
@@ -6667,7 +6840,7 @@ class Shape extends M2Node {
|
|
|
6667
6840
|
}
|
|
6668
6841
|
get fillColorPaintNotAntialiased() {
|
|
6669
6842
|
if (!this._fillColorPaintNotAntialiased) {
|
|
6670
|
-
throw new
|
|
6843
|
+
throw new M2Error("fillColorPaintNotAntiAliased is undefined");
|
|
6671
6844
|
}
|
|
6672
6845
|
return this._fillColorPaintNotAntialiased;
|
|
6673
6846
|
}
|
|
@@ -6676,7 +6849,7 @@ class Shape extends M2Node {
|
|
|
6676
6849
|
}
|
|
6677
6850
|
get strokeColorPaintNotAntialiased() {
|
|
6678
6851
|
if (!this._strokeColorPaintNotAntialiased) {
|
|
6679
|
-
throw new
|
|
6852
|
+
throw new M2Error("strokeColorPaintNotAntiAliased is undefined");
|
|
6680
6853
|
}
|
|
6681
6854
|
return this._strokeColorPaintNotAntialiased;
|
|
6682
6855
|
}
|
|
@@ -6774,7 +6947,7 @@ class TextLine extends M2Node {
|
|
|
6774
6947
|
getRequiredTextLineFont(fontManager) {
|
|
6775
6948
|
if (this.game.i18n) {
|
|
6776
6949
|
if (this.localizedFontName !== void 0 && this.localizedFontNames.length !== 0 || this.localizedFontNames.length > 1) {
|
|
6777
|
-
throw new
|
|
6950
|
+
throw new M2Error(
|
|
6778
6951
|
`TextLine supports only one font, but multiple fonts are specified in translation.`
|
|
6779
6952
|
);
|
|
6780
6953
|
}
|
|
@@ -6986,7 +7159,7 @@ class TextLine extends M2Node {
|
|
|
6986
7159
|
const x = this.absolutePosition.x * drawScale;
|
|
6987
7160
|
const y = (this.absolutePosition.y + this.size.height * this.anchorPoint.y * this.absoluteScale) * drawScale;
|
|
6988
7161
|
if (this.paint === void 0 || this.font === void 0) {
|
|
6989
|
-
throw new
|
|
7162
|
+
throw new M2Error(
|
|
6990
7163
|
`in TextLine node ${this}, Paint or Font is undefined.`
|
|
6991
7164
|
);
|
|
6992
7165
|
}
|
|
@@ -7014,7 +7187,7 @@ class TextLine extends M2Node {
|
|
|
7014
7187
|
}
|
|
7015
7188
|
this.initialize();
|
|
7016
7189
|
if (this.paint === void 0 || this.font === void 0) {
|
|
7017
|
-
throw new
|
|
7190
|
+
throw new M2Error(
|
|
7018
7191
|
`warmup TextLine node ${this.toString()}: Paint or Font is undefined.`
|
|
7019
7192
|
);
|
|
7020
7193
|
}
|
|
@@ -7056,7 +7229,7 @@ class Sprite extends M2Node {
|
|
|
7056
7229
|
initialize() {
|
|
7057
7230
|
this.m2Image = this.game.imageManager.getImage(this._imageName);
|
|
7058
7231
|
if (!this.m2Image) {
|
|
7059
|
-
throw new
|
|
7232
|
+
throw new M2Error(
|
|
7060
7233
|
`could not create sprite. the image named ${this._imageName} has not been loaded`
|
|
7061
7234
|
);
|
|
7062
7235
|
}
|
|
@@ -7127,7 +7300,7 @@ class Sprite extends M2Node {
|
|
|
7127
7300
|
}
|
|
7128
7301
|
get paint() {
|
|
7129
7302
|
if (!this._paint) {
|
|
7130
|
-
throw new
|
|
7303
|
+
throw new M2Error(
|
|
7131
7304
|
`in paint getter: Sprite node ${this.toString()} paint is undefined.`
|
|
7132
7305
|
);
|
|
7133
7306
|
}
|
|
@@ -7187,7 +7360,7 @@ class Sprite extends M2Node {
|
|
|
7187
7360
|
this.game.imageManager.prepareDeferredImage(this.m2Image);
|
|
7188
7361
|
}
|
|
7189
7362
|
if (this.m2Image.status === M2ImageStatus.Error) {
|
|
7190
|
-
throw new
|
|
7363
|
+
throw new M2Error(
|
|
7191
7364
|
`error status on image ${this.m2Image.imageName} for Sprite node ${this.toString()}`
|
|
7192
7365
|
);
|
|
7193
7366
|
}
|
|
@@ -7201,12 +7374,12 @@ class Sprite extends M2Node {
|
|
|
7201
7374
|
if (this.m2Image?.status === M2ImageStatus.Ready) {
|
|
7202
7375
|
this.initialize();
|
|
7203
7376
|
if (!this.m2Image) {
|
|
7204
|
-
throw new
|
|
7377
|
+
throw new M2Error(
|
|
7205
7378
|
`in Sprite.warmup(): Sprite node ${this.toString()}: image not loaded.`
|
|
7206
7379
|
);
|
|
7207
7380
|
}
|
|
7208
7381
|
if (!this.m2Image.canvaskitImage) {
|
|
7209
|
-
throw new
|
|
7382
|
+
throw new M2Error(
|
|
7210
7383
|
`in Sprite.warmup(): Sprite node ${this.toString()} image ${this.m2Image.imageName} is undefined.`
|
|
7211
7384
|
);
|
|
7212
7385
|
}
|
|
@@ -7268,10 +7441,10 @@ class M2NodeFactory {
|
|
|
7268
7441
|
createNode(type, compositeType, options) {
|
|
7269
7442
|
const classNameToCreate = compositeType ? compositeType : type;
|
|
7270
7443
|
if (!this.hasClassRegistration(classNameToCreate)) {
|
|
7271
|
-
throw new
|
|
7444
|
+
throw new M2Error(`Unknown node type: ${classNameToCreate}`);
|
|
7272
7445
|
}
|
|
7273
7446
|
if (!m2c2Globals.m2NodeClassRegistry) {
|
|
7274
|
-
throw new
|
|
7447
|
+
throw new M2Error("Node class registry is not initialized.");
|
|
7275
7448
|
}
|
|
7276
7449
|
const classToInstantiate = m2c2Globals.m2NodeClassRegistry[classNameToCreate];
|
|
7277
7450
|
const node = new classToInstantiate(options);
|
|
@@ -7390,7 +7563,7 @@ class FontManager {
|
|
|
7390
7563
|
async fetchFontAsArrayBuffer(font) {
|
|
7391
7564
|
const response = await fetch(font.url);
|
|
7392
7565
|
if (!response.ok) {
|
|
7393
|
-
throw new
|
|
7566
|
+
throw new M2Error(
|
|
7394
7567
|
`cannot fetch font ${font.fontName} at url ${font.url}: ${response.statusText}`
|
|
7395
7568
|
);
|
|
7396
7569
|
}
|
|
@@ -7401,7 +7574,7 @@ class FontManager {
|
|
|
7401
7574
|
this.provider.registerFont(arrayBuffer, font.fontName);
|
|
7402
7575
|
const typeface = this.canvasKit.Typeface.MakeFreeTypeFaceFromData(arrayBuffer);
|
|
7403
7576
|
if (!typeface) {
|
|
7404
|
-
throw new
|
|
7577
|
+
throw new M2Error(
|
|
7405
7578
|
`cannot make typeface for font ${font.fontName} at url ${font.url}`
|
|
7406
7579
|
);
|
|
7407
7580
|
}
|
|
@@ -7438,7 +7611,7 @@ class FontManager {
|
|
|
7438
7611
|
getDefaultFont() {
|
|
7439
7612
|
const defaultFont = Object.values(this.fonts).find((font) => font.default);
|
|
7440
7613
|
if (!defaultFont) {
|
|
7441
|
-
throw new
|
|
7614
|
+
throw new M2Error(
|
|
7442
7615
|
`no default font found; please make sure at least one font is loaded`
|
|
7443
7616
|
);
|
|
7444
7617
|
}
|
|
@@ -7470,7 +7643,7 @@ class FontManager {
|
|
|
7470
7643
|
getTypeface(fontName) {
|
|
7471
7644
|
const typeface = this.fonts[fontName]?.typeface;
|
|
7472
7645
|
if (!typeface) {
|
|
7473
|
-
throw new
|
|
7646
|
+
throw new M2Error(`font ${fontName} not found`);
|
|
7474
7647
|
}
|
|
7475
7648
|
return typeface;
|
|
7476
7649
|
}
|
|
@@ -7497,7 +7670,11 @@ function getAugmentedNamespace(n) {
|
|
|
7497
7670
|
var f = n.default;
|
|
7498
7671
|
if (typeof f == "function") {
|
|
7499
7672
|
var a = function a () {
|
|
7500
|
-
|
|
7673
|
+
var isInstance = false;
|
|
7674
|
+
try {
|
|
7675
|
+
isInstance = this instanceof a;
|
|
7676
|
+
} catch {}
|
|
7677
|
+
if (isInstance) {
|
|
7501
7678
|
return Reflect.construct(f, arguments, this.constructor);
|
|
7502
7679
|
}
|
|
7503
7680
|
return f.apply(this, arguments);
|
|
@@ -7790,272 +7967,276 @@ function requireCanvaskit () {
|
|
|
7790
7967
|
return (
|
|
7791
7968
|
function(moduleArg = {}) {
|
|
7792
7969
|
|
|
7793
|
-
var w=moduleArg,
|
|
7794
|
-
(function(a){a.
|
|
7795
|
-
alphaType:a.AlphaType.Unpremul,colorSpace:a.ColorSpace.SRGB},h=b*c*4,m=a._malloc(h);if(f=a.Surface._makeRasterDirect(f,m,4*b))f.
|
|
7796
|
-
0,0,b[0],b[1],b[2]-b[0],b[3]-b[1]):this.
|
|
7797
|
-
(function(a){a.
|
|
7970
|
+
var w=moduleArg,aa,ca;w.ready=new Promise((a,b)=>{aa=a;ca=b;});
|
|
7971
|
+
(function(a){a.ke=a.ke||[];a.ke.push(function(){a.MakeSWCanvasSurface=function(b){var c=b,f="undefined"!==typeof OffscreenCanvas&&c instanceof OffscreenCanvas;if(!("undefined"!==typeof HTMLCanvasElement&&c instanceof HTMLCanvasElement||f||(c=document.getElementById(b),c)))throw "Canvas with id "+b+" was not found";if(b=a.MakeSurface(c.width,c.height))b.ce=c;return b};a.MakeCanvasSurface||(a.MakeCanvasSurface=a.MakeSWCanvasSurface);a.MakeSurface=function(b,c){var f={width:b,height:c,colorType:a.ColorType.RGBA_8888,
|
|
7972
|
+
alphaType:a.AlphaType.Unpremul,colorSpace:a.ColorSpace.SRGB},h=b*c*4,m=a._malloc(h);if(f=a.Surface._makeRasterDirect(f,m,4*b))f.ce=null,f.Xf=b,f.Tf=c,f.Vf=h,f.wf=m,f.getCanvas().clear(a.TRANSPARENT);return f};a.MakeRasterDirectSurface=function(b,c,f){return a.Surface._makeRasterDirect(b,c.byteOffset,f)};a.Surface.prototype.flush=function(b){a.de(this.be);this._flush();if(this.ce){var c=new Uint8ClampedArray(a.HEAPU8.buffer,this.wf,this.Vf);c=new ImageData(c,this.Xf,this.Tf);b?this.ce.getContext("2d").putImageData(c,
|
|
7973
|
+
0,0,b[0],b[1],b[2]-b[0],b[3]-b[1]):this.ce.getContext("2d").putImageData(c,0,0);}};a.Surface.prototype.dispose=function(){this.wf&&a._free(this.wf);this.delete();};a.de=a.de||function(){};a.mf=a.mf||function(){return null};});})(w);
|
|
7974
|
+
(function(a){a.ke=a.ke||[];a.ke.push(function(){function b(n,p,v){return n&&n.hasOwnProperty(p)?n[p]:v}function c(n){var p=da(ha);ha[p]=n;return p}function f(n){return n.naturalHeight||n.videoHeight||n.displayHeight||n.height}function h(n){return n.naturalWidth||n.videoWidth||n.displayWidth||n.width}function m(n,p,v,E){n.bindTexture(n.TEXTURE_2D,p);E||v.alphaType!==a.AlphaType.Premul||n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,true);return p}function u(n,p,v){v||p.alphaType!==a.AlphaType.Premul||
|
|
7798
7975
|
n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,false);n.bindTexture(n.TEXTURE_2D,null);}a.GetWebGLContext=function(n,p){if(!n)throw "null canvas passed into makeWebGLContext";var v={alpha:b(p,"alpha",1),depth:b(p,"depth",1),stencil:b(p,"stencil",8),antialias:b(p,"antialias",0),premultipliedAlpha:b(p,"premultipliedAlpha",1),preserveDrawingBuffer:b(p,"preserveDrawingBuffer",0),preferLowPowerToHighPerformance:b(p,"preferLowPowerToHighPerformance",0),failIfMajorPerformanceCaveat:b(p,"failIfMajorPerformanceCaveat",
|
|
7799
|
-
0),enableExtensionsByDefault:b(p,"enableExtensionsByDefault",1),explicitSwapControl:b(p,"explicitSwapControl",0),renderViaOffscreenBackBuffer:b(p,"renderViaOffscreenBackBuffer",0)};v.majorVersion=p&&p.majorVersion?p.majorVersion:"undefined"!==typeof WebGL2RenderingContext?2:1;if(v.explicitSwapControl)throw "explicitSwapControl is not supported";n=
|
|
7800
|
-
JSEvents.
|
|
7801
|
-
this._getResourceCacheLimitBytes();};a.GrDirectContext.prototype.getResourceCacheUsageBytes=function(){a.
|
|
7802
|
-
this._MakeOnScreenGLSurface(n,p,v,E):this._MakeOnScreenGLSurface(n,p,v,E,
|
|
7803
|
-
typeof OffscreenCanvas&&E instanceof OffscreenCanvas;if(!("undefined"!==typeof HTMLCanvasElement&&E instanceof HTMLCanvasElement||
|
|
7804
|
-
a.MakeWebGLCanvasSurface;a.Surface.prototype.makeImageFromTexture=function(n,p){a.
|
|
7805
|
-
0,E.RGBA,E.UNSIGNED_BYTE,n):E.texImage2D(E.TEXTURE_2D,0,E.RGBA,E.RGBA,E.UNSIGNED_BYTE,n);u(E,p);this._resetContext();return this.makeImageFromTexture(v,p)};a.Surface.prototype.updateTextureFromSource=function(n,p,v){if(n.
|
|
7806
|
-
n.getColorSpace();p=this._makeImageFromTexture(this.
|
|
7807
|
-
p.width,p.height,0,L.RGBA,L.UNSIGNED_BYTE,n):L.texImage2D(L.TEXTURE_2D,0,L.RGBA,L.RGBA,L.UNSIGNED_BYTE,n);u(L,p,v);return c(y)},freeSrc:function(){}};"VideoFrame"===n.constructor.name&&(E.freeSrc=function(){n.close();});return a.Image._makeFromGenerator(p,E)};a.
|
|
7976
|
+
0),enableExtensionsByDefault:b(p,"enableExtensionsByDefault",1),explicitSwapControl:b(p,"explicitSwapControl",0),renderViaOffscreenBackBuffer:b(p,"renderViaOffscreenBackBuffer",0)};v.majorVersion=p&&p.majorVersion?p.majorVersion:"undefined"!==typeof WebGL2RenderingContext?2:1;if(v.explicitSwapControl)throw "explicitSwapControl is not supported";n=ia(n,v);if(!n)return 0;ja(n);B.xe.getExtension("WEBGL_debug_renderer_info");return n};a.deleteContext=function(n){B===ma[n]&&(B=null);"object"==typeof JSEvents&&
|
|
7977
|
+
JSEvents.Mg(ma[n].xe.canvas);ma[n]&&ma[n].xe.canvas&&(ma[n].xe.canvas.Rf=void 0);ma[n]=null;};a._setTextureCleanup({deleteTexture:function(n,p){var v=ha[p];v&&ma[n].xe.deleteTexture(v);ha[p]=null;}});a.MakeWebGLContext=function(n){if(!this.de(n))return null;var p=this._MakeGrContext();if(!p)return null;p.be=n;var v=p.delete.bind(p);p["delete"]=function(){a.de(this.be);v();}.bind(p);return B.Af=p};a.MakeGrContext=a.MakeWebGLContext;a.GrDirectContext.prototype.getResourceCacheLimitBytes=function(){a.de(this.be);
|
|
7978
|
+
this._getResourceCacheLimitBytes();};a.GrDirectContext.prototype.getResourceCacheUsageBytes=function(){a.de(this.be);this._getResourceCacheUsageBytes();};a.GrDirectContext.prototype.releaseResourcesAndAbandonContext=function(){a.de(this.be);this._releaseResourcesAndAbandonContext();};a.GrDirectContext.prototype.setResourceCacheLimitBytes=function(n){a.de(this.be);this._setResourceCacheLimitBytes(n);};a.MakeOnScreenGLSurface=function(n,p,v,E,G,L){if(!this.de(n.be))return null;p=void 0===G||void 0===L?
|
|
7979
|
+
this._MakeOnScreenGLSurface(n,p,v,E):this._MakeOnScreenGLSurface(n,p,v,E,G,L);if(!p)return null;p.be=n.be;return p};a.MakeRenderTarget=function(){var n=arguments[0];if(!this.de(n.be))return null;if(3===arguments.length){var p=this._MakeRenderTargetWH(n,arguments[1],arguments[2]);if(!p)return null}else if(2===arguments.length){if(p=this._MakeRenderTargetII(n,arguments[1]),!p)return null}else return null;p.be=n.be;return p};a.MakeWebGLCanvasSurface=function(n,p,v){p=p||null;var E=n,G="undefined"!==
|
|
7980
|
+
typeof OffscreenCanvas&&E instanceof OffscreenCanvas;if(!("undefined"!==typeof HTMLCanvasElement&&E instanceof HTMLCanvasElement||G||(E=document.getElementById(n),E)))throw "Canvas with id "+n+" was not found";n=this.GetWebGLContext(E,v);if(!n||0>n)throw "failed to create webgl context: err "+n;n=this.MakeWebGLContext(n);p=this.MakeOnScreenGLSurface(n,E.width,E.height,p);return p?p:(p=E.cloneNode(true),E.parentNode.replaceChild(p,E),p.classList.add("ck-replaced"),a.MakeSWCanvasSurface(p))};a.MakeCanvasSurface=
|
|
7981
|
+
a.MakeWebGLCanvasSurface;a.Surface.prototype.makeImageFromTexture=function(n,p){a.de(this.be);n=c(n);if(p=this._makeImageFromTexture(this.be,n,p))p.cf=n;return p};a.Surface.prototype.makeImageFromTextureSource=function(n,p,v){p||(p={height:f(n),width:h(n),colorType:a.ColorType.RGBA_8888,alphaType:v?a.AlphaType.Premul:a.AlphaType.Unpremul});p.colorSpace||(p.colorSpace=a.ColorSpace.SRGB);a.de(this.be);var E=B.xe;v=m(E,E.createTexture(),p,v);2===B.version?E.texImage2D(E.TEXTURE_2D,0,E.RGBA,p.width,p.height,
|
|
7982
|
+
0,E.RGBA,E.UNSIGNED_BYTE,n):E.texImage2D(E.TEXTURE_2D,0,E.RGBA,E.RGBA,E.UNSIGNED_BYTE,n);u(E,p);this._resetContext();return this.makeImageFromTexture(v,p)};a.Surface.prototype.updateTextureFromSource=function(n,p,v){if(n.cf){a.de(this.be);var E=n.getImageInfo(),G=B.xe,L=m(G,ha[n.cf],E,v);2===B.version?G.texImage2D(G.TEXTURE_2D,0,G.RGBA,h(p),f(p),0,G.RGBA,G.UNSIGNED_BYTE,p):G.texImage2D(G.TEXTURE_2D,0,G.RGBA,G.RGBA,G.UNSIGNED_BYTE,p);u(G,E,v);this._resetContext();ha[n.cf]=null;n.cf=c(L);E.colorSpace=
|
|
7983
|
+
n.getColorSpace();p=this._makeImageFromTexture(this.be,n.cf,E);v=n.ae.ie;G=n.ae.pe;n.ae.ie=p.ae.ie;n.ae.pe=p.ae.pe;p.ae.ie=v;p.ae.pe=G;p.delete();E.colorSpace.delete();}};a.MakeLazyImageFromTextureSource=function(n,p,v){p||(p={height:f(n),width:h(n),colorType:a.ColorType.RGBA_8888,alphaType:v?a.AlphaType.Premul:a.AlphaType.Unpremul});p.colorSpace||(p.colorSpace=a.ColorSpace.SRGB);var E={makeTexture:function(){var G=B,L=G.xe,y=m(L,L.createTexture(),p,v);2===G.version?L.texImage2D(L.TEXTURE_2D,0,L.RGBA,
|
|
7984
|
+
p.width,p.height,0,L.RGBA,L.UNSIGNED_BYTE,n):L.texImage2D(L.TEXTURE_2D,0,L.RGBA,L.RGBA,L.UNSIGNED_BYTE,n);u(L,p,v);return c(y)},freeSrc:function(){}};"VideoFrame"===n.constructor.name&&(E.freeSrc=function(){n.close();});return a.Image._makeFromGenerator(p,E)};a.de=function(n){return n?ja(n):false};a.mf=function(){return B&&B.Af&&!B.Af.isDeleted()?B.Af:null};});})(w);
|
|
7808
7985
|
(function(a){function b(e,d,g,l,t){for(var x=0;x<e.length;x++)d[x*g+(x*t+l+g)%g]=e[x];return d}function c(e){for(var d=e*e,g=Array(d);d--;)g[d]=0===d%(e+1)?1:0;return g}function f(e){return e?e.constructor===Float32Array&&4===e.length:false}function h(e){return (n(255*e[3])<<24|n(255*e[0])<<16|n(255*e[1])<<8|n(255*e[2])<<0)>>>0}function m(e){if(e&&e._ck)return e;if(e instanceof Float32Array){for(var d=Math.floor(e.length/4),g=new Uint32Array(d),l=0;l<d;l++)g[l]=h(e.slice(4*l,4*(l+1)));return g}if(e instanceof
|
|
7809
|
-
Uint32Array)return e;if(e instanceof Array&&e[0]instanceof Float32Array)return e.map(h)}function u(e){if(void 0===e)return 1;var d=parseFloat(e);return e&&-1!==e.indexOf("%")?d/100:d}function n(e){return Math.round(Math.max(0,Math.min(e||0,255)))}function p(e,d){d&&d._ck||a._free(e);}function v(e,d,g){if(!e||!e.length)return
|
|
7810
|
-
if(e instanceof Float32Array)d.
|
|
7811
|
-
9===e.length)return v(e,"HEAPF32",
|
|
7812
|
-
if(16===e.length)return v(e,"HEAPF32"
|
|
7813
|
-
d,g,l){var t=
|
|
7814
|
-
|
|
7986
|
+
Uint32Array)return e;if(e instanceof Array&&e[0]instanceof Float32Array)return e.map(h)}function u(e){if(void 0===e)return 1;var d=parseFloat(e);return e&&-1!==e.indexOf("%")?d/100:d}function n(e){return Math.round(Math.max(0,Math.min(e||0,255)))}function p(e,d){d&&d._ck||a._free(e);}function v(e,d,g){if(!e||!e.length)return X;if(e&&e._ck)return e.byteOffset;var l=a[d].BYTES_PER_ELEMENT;g||(g=a._malloc(e.length*l));a[d].set(e,g/l);return g}function E(e){var d={te:X,count:e.length,colorType:a.ColorType.RGBA_F32};
|
|
7987
|
+
if(e instanceof Float32Array)d.te=v(e,"HEAPF32"),d.count=e.length/4;else if(e instanceof Uint32Array)d.te=v(e,"HEAPU32"),d.colorType=a.ColorType.RGBA_8888;else if(e instanceof Array){if(e&&e.length){for(var g=a._malloc(16*e.length),l=0,t=g/4,x=0;x<e.length;x++)for(var C=0;4>C;C++)a.HEAPF32[t+l]=e[x][C],l++;e=g;}else e=X;d.te=e;}else throw "Invalid argument to copyFlexibleColorArray, Not a color array "+typeof e;return d}function G(e){if(!e)return X;var d=Xb.toTypedArray();if(e.length){if(6===e.length||
|
|
7988
|
+
9===e.length)return v(e,"HEAPF32",Oa),6===e.length&&a.HEAPF32.set(Hd,6+Oa/4),Oa;if(16===e.length)return d[0]=e[0],d[1]=e[1],d[2]=e[3],d[3]=e[4],d[4]=e[5],d[5]=e[7],d[6]=e[12],d[7]=e[13],d[8]=e[15],Oa;throw "invalid matrix size";}if(void 0===e.m11)throw "invalid matrix argument";d[0]=e.m11;d[1]=e.m21;d[2]=e.m41;d[3]=e.m12;d[4]=e.m22;d[5]=e.m42;d[6]=e.m14;d[7]=e.m24;d[8]=e.m44;return Oa}function L(e){if(!e)return X;var d=Yb.toTypedArray();if(e.length){if(16!==e.length&&6!==e.length&&9!==e.length)throw "invalid matrix size";
|
|
7989
|
+
if(16===e.length)return v(e,"HEAPF32",bb);d.fill(0);d[0]=e[0];d[1]=e[1];d[3]=e[2];d[4]=e[3];d[5]=e[4];d[7]=e[5];d[10]=1;d[12]=e[6];d[13]=e[7];d[15]=e[8];6===e.length&&(d[12]=0,d[13]=0,d[15]=1);return bb}if(void 0===e.m11)throw "invalid matrix argument";d[0]=e.m11;d[1]=e.m21;d[2]=e.m31;d[3]=e.m41;d[4]=e.m12;d[5]=e.m22;d[6]=e.m32;d[7]=e.m42;d[8]=e.m13;d[9]=e.m23;d[10]=e.m33;d[11]=e.m43;d[12]=e.m14;d[13]=e.m24;d[14]=e.m34;d[15]=e.m44;return bb}function y(e,d){return v(e,"HEAPF32",d||Va)}function M(e,
|
|
7990
|
+
d,g,l){var t=Zb.toTypedArray();t[0]=e;t[1]=d;t[2]=g;t[3]=l;return Va}function T(e){for(var d=new Float32Array(4),g=0;4>g;g++)d[g]=a.HEAPF32[e/4+g];return d}function S(e,d){return v(e,"HEAPF32",d||ka)}function sa(e,d){return v(e,"HEAPF32",d||$b)}function pa(){for(var e=0,d=0;d<arguments.length-1;d+=2)e+=arguments[d]*arguments[d+1];return e}function ib(e,d,g){for(var l=Array(e.length),t=0;t<g;t++)for(var x=0;x<g;x++){for(var C=0,K=0;K<g;K++)C+=e[g*t+K]*d[g*K+x];l[t*g+x]=C;}return l}function jb(e,d){for(var g=
|
|
7991
|
+
ib(d[0],d[1],e),l=2;l<d.length;)g=ib(g,d[l],e),l++;return g}a.Color=function(e,d,g,l){ void 0===l&&(l=1);return a.Color4f(n(e)/255,n(d)/255,n(g)/255,l)};a.ColorAsInt=function(e,d,g,l){ void 0===l&&(l=255);return (n(l)<<24|n(e)<<16|n(d)<<8|n(g)<<0&268435455)>>>0};a.Color4f=function(e,d,g,l){ void 0===l&&(l=1);return Float32Array.of(e,d,g,l)};Object.defineProperty(a,"TRANSPARENT",{get:function(){return a.Color4f(0,0,0,0)}});Object.defineProperty(a,"BLACK",{get:function(){return a.Color4f(0,0,0,1)}});Object.defineProperty(a,
|
|
7815
7992
|
"WHITE",{get:function(){return a.Color4f(1,1,1,1)}});Object.defineProperty(a,"RED",{get:function(){return a.Color4f(1,0,0,1)}});Object.defineProperty(a,"GREEN",{get:function(){return a.Color4f(0,1,0,1)}});Object.defineProperty(a,"BLUE",{get:function(){return a.Color4f(0,0,1,1)}});Object.defineProperty(a,"YELLOW",{get:function(){return a.Color4f(1,1,0,1)}});Object.defineProperty(a,"CYAN",{get:function(){return a.Color4f(0,1,1,1)}});Object.defineProperty(a,"MAGENTA",{get:function(){return a.Color4f(1,
|
|
7816
7993
|
0,1,1)}});a.getColorComponents=function(e){return [Math.floor(255*e[0]),Math.floor(255*e[1]),Math.floor(255*e[2]),e[3]]};a.parseColorString=function(e,d){e=e.toLowerCase();if(e.startsWith("#")){d=255;switch(e.length){case 9:d=parseInt(e.slice(7,9),16);case 7:var g=parseInt(e.slice(1,3),16);var l=parseInt(e.slice(3,5),16);var t=parseInt(e.slice(5,7),16);break;case 5:d=17*parseInt(e.slice(4,5),16);case 4:g=17*parseInt(e.slice(1,2),16),l=17*parseInt(e.slice(2,3),16),t=17*parseInt(e.slice(3,4),16);}return a.Color(g,
|
|
7817
|
-
l,t,d/255)}return e.startsWith("rgba")?(e=e.slice(5,-1),e=e.split(","),a.Color(+e[0],+e[1],+e[2],u(e[3]))):e.startsWith("rgb")?(e=e.slice(4,-1),e=e.split(","),a.Color(+e[0],+e[1],+e[2],u(e[3]))):e.startsWith("gray(")||e.startsWith("hsl")||!d||(e=d[e],void 0===e)?a.BLACK:e};a.multiplyByAlpha=function(e,d){e=e.slice();e[3]=Math.max(0,Math.min(e[3]*d,1));return e};a.Malloc=function(e,d){var g=a._malloc(d*e.BYTES_PER_ELEMENT);return {_ck:true,length:d,byteOffset:g,
|
|
7818
|
-
t);l._ck=true;return l},toTypedArray:function(){if(this.
|
|
7819
|
-
(C*=4));var
|
|
7820
|
-
|
|
7821
|
-
a.GlyphRunFlags={IsWhiteSpace:a._GlyphRunFlags_isWhiteSpace};a.Path.MakeFromCmds=function(d){var g=v(d,"HEAPF32"),l=a.Path._MakeFromCmds(g,d.length);p(g,d);return l};a.Path.MakeFromVerbsPointsWeights=function(d,g,l){var t=v(d,"HEAPU8"),x=v(g,"HEAPF32"),C=v(l,"HEAPF32"),
|
|
7994
|
+
l,t,d/255)}return e.startsWith("rgba")?(e=e.slice(5,-1),e=e.split(","),a.Color(+e[0],+e[1],+e[2],u(e[3]))):e.startsWith("rgb")?(e=e.slice(4,-1),e=e.split(","),a.Color(+e[0],+e[1],+e[2],u(e[3]))):e.startsWith("gray(")||e.startsWith("hsl")||!d||(e=d[e],void 0===e)?a.BLACK:e};a.multiplyByAlpha=function(e,d){e=e.slice();e[3]=Math.max(0,Math.min(e[3]*d,1));return e};a.Malloc=function(e,d){var g=a._malloc(d*e.BYTES_PER_ELEMENT);return {_ck:true,length:d,byteOffset:g,Je:null,subarray:function(l,t){l=this.toTypedArray().subarray(l,
|
|
7995
|
+
t);l._ck=true;return l},toTypedArray:function(){if(this.Je&&this.Je.length)return this.Je;this.Je=new e(a.HEAPU8.buffer,g,d);this.Je._ck=true;return this.Je}}};a.Free=function(e){a._free(e.byteOffset);e.byteOffset=X;e.toTypedArray=null;e.Je=null;};var Oa=X,Xb,bb=X,Yb,Va=X,Zb,Ca,ka=X,zc,Pa=X,Ac,ac=X,Bc,bc=X,Ab,kb=X,Cc,$b=X,Dc,Ec=X,Hd=Float32Array.of(0,0,1),X=0;a.onRuntimeInitialized=function(){function e(d,g,l,t,x,C,K){C||(C=4*t.width,t.colorType===a.ColorType.RGBA_F16?C*=2:t.colorType===a.ColorType.RGBA_F32&&
|
|
7996
|
+
(C*=4));var O=C*t.height;var P=x?x.byteOffset:a._malloc(O);if(K?!d._readPixels(t,P,C,g,l,K):!d._readPixels(t,P,C,g,l))return x||a._free(P),null;if(x)return x.toTypedArray();switch(t.colorType){case a.ColorType.RGBA_8888:case a.ColorType.RGBA_F16:d=(new Uint8Array(a.HEAPU8.buffer,P,O)).slice();break;case a.ColorType.RGBA_F32:d=(new Float32Array(a.HEAPU8.buffer,P,O)).slice();break;default:return null}a._free(P);return d}Zb=a.Malloc(Float32Array,4);Va=Zb.byteOffset;Yb=a.Malloc(Float32Array,16);bb=Yb.byteOffset;
|
|
7997
|
+
Xb=a.Malloc(Float32Array,9);Oa=Xb.byteOffset;Cc=a.Malloc(Float32Array,12);$b=Cc.byteOffset;Dc=a.Malloc(Float32Array,12);Ec=Dc.byteOffset;Ca=a.Malloc(Float32Array,4);ka=Ca.byteOffset;zc=a.Malloc(Float32Array,4);Pa=zc.byteOffset;Ac=a.Malloc(Float32Array,3);ac=Ac.byteOffset;Bc=a.Malloc(Float32Array,3);bc=Bc.byteOffset;Ab=a.Malloc(Int32Array,4);kb=Ab.byteOffset;a.ColorSpace.SRGB=a.ColorSpace._MakeSRGB();a.ColorSpace.DISPLAY_P3=a.ColorSpace._MakeDisplayP3();a.ColorSpace.ADOBE_RGB=a.ColorSpace._MakeAdobeRGB();
|
|
7998
|
+
a.GlyphRunFlags={IsWhiteSpace:a._GlyphRunFlags_isWhiteSpace};a.Path.MakeFromCmds=function(d){var g=v(d,"HEAPF32"),l=a.Path._MakeFromCmds(g,d.length);p(g,d);return l};a.Path.MakeFromVerbsPointsWeights=function(d,g,l){var t=v(d,"HEAPU8"),x=v(g,"HEAPF32"),C=v(l,"HEAPF32"),K=a.Path._MakeFromVerbsPointsWeights(t,d.length,x,g.length,C,l&&l.length||0);p(t,d);p(x,g);p(C,l);return K};a.Path.prototype.addArc=function(d,g,l){d=S(d);this._addArc(d,g,l);return this};a.Path.prototype.addCircle=function(d,g,l,t){this._addCircle(d,
|
|
7822
7999
|
g,l,!!t);return this};a.Path.prototype.addOval=function(d,g,l){ void 0===l&&(l=1);d=S(d);this._addOval(d,!!g,l);return this};a.Path.prototype.addPath=function(){var d=Array.prototype.slice.call(arguments),g=d[0],l=false;"boolean"===typeof d[d.length-1]&&(l=d.pop());if(1===d.length)this._addPath(g,1,0,0,0,1,0,0,0,1,l);else if(2===d.length)d=d[1],this._addPath(g,d[0],d[1],d[2],d[3],d[4],d[5],d[6]||0,d[7]||0,d[8]||1,l);else if(7===d.length||10===d.length)this._addPath(g,d[1],d[2],d[3],d[4],d[5],d[6],d[7]||
|
|
7823
8000
|
0,d[8]||0,d[9]||1,l);else return null;return this};a.Path.prototype.addPoly=function(d,g){var l=v(d,"HEAPF32");this._addPoly(l,d.length/2,g);p(l,d);return this};a.Path.prototype.addRect=function(d,g){d=S(d);this._addRect(d,!!g);return this};a.Path.prototype.addRRect=function(d,g){d=sa(d);this._addRRect(d,!!g);return this};a.Path.prototype.addVerbsPointsWeights=function(d,g,l){var t=v(d,"HEAPU8"),x=v(g,"HEAPF32"),C=v(l,"HEAPF32");this._addVerbsPointsWeights(t,d.length,x,g.length,C,l&&l.length||0);
|
|
7824
|
-
p(t,d);p(x,g);p(C,l);};a.Path.prototype.arc=function(d,g,l,t,x,C){d=a.LTRBRect(d-l,g-l,d+l,g+l);x=(x-t)/Math.PI*180-360*!!C;C=new a.Path;C.addArc(d,t/Math.PI*180,x);this.addPath(C,true);C.delete();return this};a.Path.prototype.arcToOval=function(d,g,l,t){d=S(d);this._arcToOval(d,g,l,t);return this};a.Path.prototype.arcToRotated=function(d,g,l,t,x,C,
|
|
7825
|
-
function(){this._close();return this};a.Path.prototype.conicTo=function(d,g,l,t,x){this._conicTo(d,g,l,t,x);return this};a.Path.prototype.computeTightBounds=function(d){this._computeTightBounds(
|
|
7826
|
-
(d.set(g),d):g.slice()};a.Path.prototype.lineTo=function(d,g){this._lineTo(d,g);return this};a.Path.prototype.moveTo=function(d,g){this._moveTo(d,g);return this};a.Path.prototype.offset=function(d,g){this._transform(1,0,d,0,1,g,0,0,1);return this};a.Path.prototype.quadTo=function(d,g,l,t){this._quadTo(d,g,l,t);return this};a.Path.prototype.rArcTo=function(d,g,l,t,x,C,
|
|
8001
|
+
p(t,d);p(x,g);p(C,l);};a.Path.prototype.arc=function(d,g,l,t,x,C){d=a.LTRBRect(d-l,g-l,d+l,g+l);x=(x-t)/Math.PI*180-360*!!C;C=new a.Path;C.addArc(d,t/Math.PI*180,x);this.addPath(C,true);C.delete();return this};a.Path.prototype.arcToOval=function(d,g,l,t){d=S(d);this._arcToOval(d,g,l,t);return this};a.Path.prototype.arcToRotated=function(d,g,l,t,x,C,K){this._arcToRotated(d,g,l,!!t,!!x,C,K);return this};a.Path.prototype.arcToTangent=function(d,g,l,t,x){this._arcToTangent(d,g,l,t,x);return this};a.Path.prototype.close=
|
|
8002
|
+
function(){this._close();return this};a.Path.prototype.conicTo=function(d,g,l,t,x){this._conicTo(d,g,l,t,x);return this};a.Path.prototype.computeTightBounds=function(d){this._computeTightBounds(ka);var g=Ca.toTypedArray();return d?(d.set(g),d):g.slice()};a.Path.prototype.cubicTo=function(d,g,l,t,x,C){this._cubicTo(d,g,l,t,x,C);return this};a.Path.prototype.dash=function(d,g,l){return this._dash(d,g,l)?this:null};a.Path.prototype.getBounds=function(d){this._getBounds(ka);var g=Ca.toTypedArray();return d?
|
|
8003
|
+
(d.set(g),d):g.slice()};a.Path.prototype.lineTo=function(d,g){this._lineTo(d,g);return this};a.Path.prototype.moveTo=function(d,g){this._moveTo(d,g);return this};a.Path.prototype.offset=function(d,g){this._transform(1,0,d,0,1,g,0,0,1);return this};a.Path.prototype.quadTo=function(d,g,l,t){this._quadTo(d,g,l,t);return this};a.Path.prototype.rArcTo=function(d,g,l,t,x,C,K){this._rArcTo(d,g,l,t,x,C,K);return this};a.Path.prototype.rConicTo=function(d,g,l,t,x){this._rConicTo(d,g,l,t,x);return this};a.Path.prototype.rCubicTo=
|
|
7827
8004
|
function(d,g,l,t,x,C){this._rCubicTo(d,g,l,t,x,C);return this};a.Path.prototype.rLineTo=function(d,g){this._rLineTo(d,g);return this};a.Path.prototype.rMoveTo=function(d,g){this._rMoveTo(d,g);return this};a.Path.prototype.rQuadTo=function(d,g,l,t){this._rQuadTo(d,g,l,t);return this};a.Path.prototype.stroke=function(d){d=d||{};d.width=d.width||1;d.miter_limit=d.miter_limit||4;d.cap=d.cap||a.StrokeCap.Butt;d.join=d.join||a.StrokeJoin.Miter;d.precision=d.precision||1;return this._stroke(d)?this:null};
|
|
7828
8005
|
a.Path.prototype.transform=function(){if(1===arguments.length){var d=arguments[0];this._transform(d[0],d[1],d[2],d[3],d[4],d[5],d[6]||0,d[7]||0,d[8]||1);}else if(6===arguments.length||9===arguments.length)d=arguments,this._transform(d[0],d[1],d[2],d[3],d[4],d[5],d[6]||0,d[7]||0,d[8]||1);else throw "transform expected to take 1 or 9 arguments. Got "+arguments.length;return this};a.Path.prototype.trim=function(d,g,l){return this._trim(d,g,!!l)?this:null};a.Image.prototype.encodeToBytes=function(d,g){var l=
|
|
7829
|
-
a.
|
|
7830
|
-
function(d,g,l){a.
|
|
7831
|
-
|
|
7832
|
-
this._drawColorInt(d,g||a.BlendMode.SrcOver);};a.Canvas.prototype.drawColorComponents=function(d,g,l,t,x){a.
|
|
7833
|
-
function(d,g,l,t,x,C){a.
|
|
7834
|
-
function(d,g,l,t,x,C){a.
|
|
7835
|
-
if(g&&4>g.length)throw "Need 4 colors";if(l&&8>l.length)throw "Need 4 shader coordinates";a.
|
|
7836
|
-
t,g.length/2,l);p(t,g);};a.Canvas.prototype.drawRRect=function(d,g){a.
|
|
7837
|
-
function(d,g,l,t,x,C,
|
|
7838
|
-
a.Canvas.prototype.getLocalToDevice=function(){this._getLocalToDevice(
|
|
7839
|
-
t){g=S(g);return this._saveLayer(d||null,g,l||null,t||0)};a.Canvas.prototype.writePixels=function(d,g,l,t,x,C,
|
|
7840
|
-
return a.ColorFilter._MakeBlend(d,g,l)};a.ColorFilter.MakeMatrix=function(d){if(!d||20!==d.length)throw "invalid color matrix";var g=v(d,"HEAPF32"),l=a.ColorFilter._makeMatrix(g);p(g,d);return l};a.ContourMeasure.prototype.getPosTan=function(d,g){this._getPosTan(d,
|
|
7841
|
-
function(d,g,l,t,x,C){x=y(x,
|
|
7842
|
-
g,l){d=
|
|
7843
|
-
g){this._getPoint(d,
|
|
7844
|
-
function(d){a.
|
|
7845
|
-
(this.
|
|
7846
|
-
function(d,g){d=
|
|
7847
|
-
g,l,t,x,C,
|
|
7848
|
-
v(C,"HEAPF32");
|
|
7849
|
-
p(g,e.spot);return l};a.LTRBRect=function(e,d,g,l){return Float32Array.of(e,d,g,l)};a.XYWHRect=function(e,d,g,l){return Float32Array.of(e,d,e+g,d+l)};a.LTRBiRect=function(e,d,g,l){return Int32Array.of(e,d,g,l)};a.XYWHiRect=function(e,d,g,l){return Int32Array.of(e,d,e+g,d+l)};a.RRectXY=function(e,d,g){return Float32Array.of(e[0],e[1],e[2],e[3],d,g,d,g,d,g,d,g)};a.MakeAnimatedImageFromEncoded=function(e){e=new Uint8Array(e);var d=a._malloc(e.byteLength);
|
|
7850
|
-
e.byteLength))?e:null};a.MakeImageFromEncoded=function(e){e=new Uint8Array(e);var d=a._malloc(e.byteLength);a.HEAPU8.set(e,d);return (e=a._decodeImage(d,e.byteLength))?e:null};var
|
|
7851
|
-
colorSpace:a.ColorSpace.SRGB},e.data,4*d)};a.MakeImage=function(e,d,g){var l=a._malloc(d.length);a.HEAPU8.set(d,l);return a._MakeImage(e,l,d.length,g)};a.MakeVertices=function(e,d,g,l,t,x){var C=t&&t.length||0,
|
|
7852
|
-
{};a.Matrix.identity=function(){return c(3)};a.Matrix.invert=function(e){var d=e[0]*e[4]*e[8]+e[1]*e[5]*e[6]+e[2]*e[3]*e[7]-e[2]*e[4]*e[6]-e[1]*e[3]*e[8]-e[0]*e[5]*e[7];return d?[(e[4]*e[8]-e[5]*e[7])/d,(e[2]*e[7]-e[1]*e[8])/d,(e[1]*e[5]-e[2]*e[4])/d,(e[5]*e[6]-e[3]*e[8])/d,(e[0]*e[8]-e[2]*e[6])/d,(e[2]*e[3]-e[0]*e[5])/d,(e[3]*e[7]-e[4]*e[6])/d,(e[1]*e[6]-e[0]*e[7])/d,(e[0]*e[4]-e[1]*e[3])/d]:null};a.Matrix.mapPoints=function(e,d){for(var g=0;g<
|
|
7853
|
-
C=e[3]*l+e[4]*t+e[5];d[g]=(e[0]*l+e[1]*t+e[2])/x;d[g+1]=C/x;}return d};a.Matrix.multiply=function(){return
|
|
7854
|
-
c(3),3,2,0)};a.Vector={};a.Vector.dot=function(e,d){return e.map(function(g,l){return g*d[l]}).reduce(function(g,l){return g+l})};a.Vector.lengthSquared=function(e){return a.Vector.dot(e,e)};a.Vector.length=function(e){return Math.sqrt(a.Vector.lengthSquared(e))};a.Vector.mulScalar=function(e,d){return e.map(function(g){return g*d})};a.Vector.add=function(e,d){return e.map(function(g,l){return g+d[l]})};a.Vector.sub=function(e,
|
|
7855
|
-
d){return a.Vector.length(a.Vector.sub(e,d))};a.Vector.normalize=function(e){return a.Vector.mulScalar(e,1/a.Vector.length(e))};a.Vector.cross=function(e,d){return [e[1]*d[2]-e[2]*d[1],e[2]*d[0]-e[0]*d[2],e[0]*d[1]-e[1]*d[0]]};a.M44={};a.M44.identity=function(){return c(4)};a.M44.translated=function(e){return b(e,c(4),4,3,0)};a.M44.scaled=function(e){return b(e,c(4),4,0,1)};a.M44.rotated=function(e,d){return a.M44.rotatedUnitSinCos(a.Vector.normalize(e),
|
|
7856
|
-
function(e,d,g){var l=e[0],t=e[1];e=e[2];var x=1-g;return [x*l*l+g,x*l*t-d*e,x*l*e+d*t,0,x*l*t+d*e,x*t*t+g,x*t*e-d*l,0,x*l*e-d*t,x*t*e+d*l,x*e*e+g,0,0,0,0,1]};a.M44.lookat=function(e,d,g){d=a.Vector.normalize(a.Vector.sub(d,e));g=a.Vector.normalize(g);g=a.Vector.normalize(a.Vector.cross(d,g));var l=a.M44.identity();b(g,l,4,0,0);b(a.Vector.cross(g,d),l,4,1,0);b(a.Vector.mulScalar(d,-1),l,4,2,0);b(e,l,4,3,0);e=a.M44.invert(l);return null===e?a.M44.identity():
|
|
7857
|
-
1/(d-e);g/=2;g=Math.cos(g)/Math.sin(g);return [g,0,0,0,0,g,0,0,0,0,(d+e)*l,2*d*e*l,0,0,-1,1]};a.M44.rc=function(e,d,g){return e[4*d+g]};a.M44.multiply=function(){return
|
|
7858
|
-
1/
|
|
7859
|
-
e[6],e[10],e[14],e[3],e[7],e[11],e[15]]};a.M44.mustInvert=function(e){e=a.M44.invert(e);if(null===e)throw "Matrix not invertible";return e};a.M44.setupCamera=function(e,d,g){var l=a.M44.lookat(g.eye,g.coa,g.up);g=a.M44.perspective(g.near,g.far,g.angle);d=[(e[2]-e[0])/2,(e[3]-e[1])/2,d];e=a.M44.multiply(a.M44.translated([(e[0]+e[2])/2,(e[1]+e[3])/2,0]),a.M44.scaled(d));return a.M44.multiply(e,g,l,a.M44.mustInvert(e))};a.ColorMatrix={};a.ColorMatrix.identity=function(){var e=
|
|
7860
|
-
1;e[6]=1;e[12]=1;e[18]=1;return e};a.ColorMatrix.scaled=function(e,d,g,l){var t=new Float32Array(20);t[0]=e;t[6]=d;t[12]=g;t[18]=l;return t};var
|
|
7861
|
-
x;x++)g[l++]=e[t]*d[x]+e[t+1]*d[x+5]+e[t+2]*d[x+10]+e[t+3]*d[x+15];g[l++]=e[t]*d[4]+e[t+1]*d[9]+e[t+2]*d[14]+e[t+3]*d[19]+e[t+4];}return g};(function(e){e.
|
|
7862
|
-
function l(r){r=r||{};void 0===r.weight&&(r.weight=e.FontWeight.Normal);r.width=r.width||e.FontWidth.Normal;r.slant=r.slant||e.FontSlant.Upright;return r}function t(r){if(!r||!r.length)return
|
|
7863
|
-
y(r.foregroundColor,
|
|
7864
|
-
D.map(function(
|
|
7865
|
-
|
|
7866
|
-
|
|
7867
|
-
e.Paragraph.prototype.getGlyphInfoAt=function(r){return d(this._getGlyphInfoAt(r))};e.Paragraph.prototype.getClosestGlyphInfoAtCoordinate=function(r,D){return d(this._getClosestGlyphInfoAtCoordinate(r,D))};e.TypefaceFontProvider.prototype.registerFont=function(r,D){r=e.Typeface.
|
|
7868
|
-
|
|
7869
|
-
|
|
7870
|
-
r.decorationStyle||e.DecorationStyle.Solid;r.textBaseline=r.textBaseline||e.TextBaseline.Alphabetic;null==r.fontSize&&(r.fontSize=-1);r.letterSpacing=r.letterSpacing||0;r.wordSpacing=r.wordSpacing||0;null==r.heightMultiplier&&(r.heightMultiplier=-1);r.halfLeading=r.halfLeading||false;r.fontStyle=l(r.fontStyle);return r};var
|
|
7871
|
-
function(r,D){C(r.textStyle);D=e.ParagraphBuilder._MakeFromFontProvider(r,D);
|
|
7872
|
-
this._pushStyle(r);
|
|
7873
|
-
r&&r.length||0);p(D,r);};e.ParagraphBuilder.prototype.setGraphemeBreaksUtf8=function(r){var D=v(r,"HEAPU32");this._setGraphemeBreaksUtf8(D,r&&r.length||0);p(D,r);};e.ParagraphBuilder.prototype.setGraphemeBreaksUtf16=function(r){var D=v(r,"HEAPU32");this._setGraphemeBreaksUtf16(D,r&&r.length||0);p(D,r);};e.ParagraphBuilder.prototype.setLineBreaksUtf8=function(r){var D=v(r,"HEAPU32");this._setLineBreaksUtf8(D,r&&r.length||0);p(D,r);};e.ParagraphBuilder.prototype.setLineBreaksUtf16=
|
|
7874
|
-
"HEAPU32");this._setLineBreaksUtf16(D,r&&r.length||0);p(D,r);};});})(w);a.
|
|
7875
|
-
a.
|
|
7876
|
-
d);d=this._getGlyphIDs(t,l-1,d,e);a._free(t);if(0>d)return a._free(e),null;t=new Uint16Array(a.HEAPU8.buffer,e,d);if(g)return g.set(t),a._free(e),g;g=Uint16Array.from(t);a._free(e);return g};a.Font.prototype.getGlyphIntercepts=function(e,d,g,l){var t=v(e,"HEAPU16"),x=v(d,"HEAPF32");return this._getGlyphIntercepts(t,e.length,!(e&&e._ck),x,d.length,!(d&&d._ck),g,l)};a.Font.prototype.getGlyphWidths=function(e,d,g){var l=v(e,"HEAPU16"),t=a._malloc(4*
|
|
7877
|
-
d||null);d=new Float32Array(a.HEAPU8.buffer,t,e.length);p(l,e);if(g)return g.set(d),a._free(t),g;e=Float32Array.from(d);a._free(t);return e};a.FontMgr.FromData=function(){if(!arguments.length)return null;var e=arguments;1===e.length&&Array.isArray(e[0])&&(e=arguments[0]);if(!e.length)return null;for(var d=[],g=[],l=0;l<e.length;l++){var t=new Uint8Array(e[l]),x=v(t,"HEAPU8");d.push(x);g.push(t.byteLength);}d=v(d,"HEAPU32");g=v(g,"HEAPU32");e=a.FontMgr._fromData(d,
|
|
7878
|
-
return e};a.Typeface.
|
|
7879
|
-
function(e,d,g,l){if(e&&e.length&&d&&d.countPoints()){if(1===d.countPoints())return this.MakeFromText(e,g);l||(l=0);var t=g.getGlyphIDs(e);t=g.getGlyphWidths(t);var x=[];d=new a.ContourMeasureIter(d,false,1);for(var C=d.next(),
|
|
7880
|
-
a.TextBlob.MakeFromRSXform=function(e,d,g){var l=
|
|
7881
|
-
|
|
7882
|
-
g);}})};a.RuntimeEffect.MakeForBlender=function(e,d){return a.RuntimeEffect._MakeForBlender(e,{onError:d||function(g){console.log("RuntimeEffect error",g);}})};a.RuntimeEffect.prototype.makeShader=function(e,d){var g=!e._ck,l=v(e,"HEAPF32");d=
|
|
7883
|
-
l,d,x.length,g)};a.RuntimeEffect.prototype.makeBlender=function(e){var d=!e._ck,g=v(e,"HEAPF32");return this._makeBlender(g,4*e.length,d)};});(function(){function e(
|
|
7884
|
-
z:z,"#"+
|
|
7885
|
-
function t(
|
|
7886
|
-
this.
|
|
7887
|
-
this.
|
|
7888
|
-
"globalCompositeOperation",{enumerable:true,get:function(){switch(this.
|
|
7889
|
-
case a.BlendMode.
|
|
7890
|
-
case a.BlendMode.Difference:return "difference";case a.BlendMode.Exclusion:return "exclusion";case a.BlendMode.Hue:return "hue";case a.BlendMode.Saturation:return "saturation";case a.BlendMode.Color:return "color";case a.BlendMode.Luminosity:return "luminosity"}},set:function(k){switch(k){case "source-over":this.
|
|
7891
|
-
a.BlendMode.
|
|
7892
|
-
|
|
7893
|
-
break;case "exclusion":this.
|
|
7894
|
-
set:function(){}});Object.defineProperty(this,"lineCap",{enumerable:true,get:function(){switch(this.
|
|
7895
|
-
set:function(k){isFinite(k)&&(this
|
|
7896
|
-
|
|
7897
|
-
set:function(k){this.
|
|
7898
|
-
q,z,z,0,
|
|
7899
|
-
k&&k.
|
|
7900
|
-
arguments.length;};this.createLinearGradient=function(k,q,z,
|
|
7901
|
-
arguments[4]||k.height()),
|
|
7902
|
-
if(f(this.
|
|
7903
|
-
z),this.
|
|
7904
|
-
k.delete();
|
|
7905
|
-
|
|
7906
|
-
z=this.
|
|
7907
|
-
q,z,
|
|
7908
|
-
this.
|
|
7909
|
-
this.
|
|
7910
|
-
if(this.
|
|
7911
|
-
k.length%2&&Array.prototype.push.apply(k,k);this.
|
|
7912
|
-
this.
|
|
7913
|
-
k?k.
|
|
7914
|
-
this.
|
|
7915
|
-
function(){};this.removeHitRegion=function(){};this.scrollPathIntoView=function(){};Object.defineProperty(this,"canvas",{value:null,writable:false});}function
|
|
7916
|
-
q=q.family;
|
|
7917
|
-
"",
|
|
7918
|
-
|
|
7919
|
-
this.
|
|
7920
|
-
|
|
7921
|
-
F?(
|
|
7922
|
-
z,0,
|
|
7923
|
-
F.quadTo(k,q,z,
|
|
7924
|
-
k;}this.setTransform=function(q){q=[q.a,q.c,q.e,q.b,q.d,q.f,0,0,1];e(q)&&(this._transform=q);};this.
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
.
|
|
7928
|
-
|
|
7929
|
-
.
|
|
7930
|
-
.
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
.
|
|
7934
|
-
1),midnightblue:Float32Array.of(.098,.098,.439,1),mintcream:Float32Array.of(.961,1,.98,1),mistyrose:Float32Array.of(1,.894,.882,1),moccasin:Float32Array.of(1,.894,.71,1),navajowhite:Float32Array.of(1,.871,.678,1),navy:Float32Array.of(0,0,.502,1),oldlace:Float32Array.of(.992,.961,.902,1),olive:Float32Array.of(.502,.502,0,1),olivedrab:Float32Array.of(.42
|
|
7935
|
-
.
|
|
7936
|
-
|
|
7937
|
-
.565,1),slategrey:Float32Array.of(.439,.502,.565,1),snow:Float32Array.of(1,.98,.98,1),springgreen:Float32Array.of(0,1,.498,1),steelblue:Float32Array.of(.275,.51,.706,1),tan:Float32Array.of(.824,.706,.549,1),teal:Float32Array.of(0,.502,.502,1),thistle:Float32Array.of(.847,.749,.847,1),tomato:Float32Array.of(1,.388,.278,1),transparent:Float32Array.of(0,
|
|
7938
|
-
1,1,1),whitesmoke:Float32Array.of(.961,.961,.961,1),yellow:Float32Array.of(1,1,0,1),yellowgreen:Float32Array.of(.604,.804,.196,1)};a._testing.parseColor=g;a._testing.colorToString=d;var
|
|
7939
|
-
function(){if(2===arguments.length){var
|
|
7940
|
-
arguments.length;};})();})(w);var
|
|
7941
|
-
if(
|
|
7942
|
-
a;throw b;};w.inspect=()=>"[Emscripten Module object]";}else if(ya
|
|
7943
|
-
Ea=(a,b,c)=>{var f=new XMLHttpRequest;f.open("GET",a,true);f.responseType="arraybuffer";f.onload=()=>{200==f.status||0==f.status&&f.response?b(f.response):c();};f.onerror=c;f.send(null);};var Ha=w.print||console.log.bind(console),
|
|
7944
|
-
var Ma,
|
|
7945
|
-
function
|
|
7946
|
-
function
|
|
7947
|
-
function
|
|
7948
|
-
var
|
|
7949
|
-
String.fromCharCode(h);}return f},
|
|
7950
|
-
function
|
|
7951
|
-
function
|
|
7952
|
-
function
|
|
7953
|
-
function
|
|
7954
|
-
function
|
|
7955
|
-
function
|
|
7956
|
-
function
|
|
7957
|
-
function
|
|
7958
|
-
function
|
|
7959
|
-
function
|
|
7960
|
-
this.
|
|
7961
|
-
function
|
|
7962
|
-
function
|
|
7963
|
-
var
|
|
7964
|
-
function
|
|
7965
|
-
function
|
|
7966
|
-
b[
|
|
7967
|
-
var
|
|
7968
|
-
function
|
|
7969
|
-
function
|
|
7970
|
-
var
|
|
7971
|
-
f?b+=2:55296<=f&&57343>=f?(b+=4,++c):b+=3;}return b},
|
|
7972
|
-
|
|
7973
|
-
55296<=f&&57343>=f&&++c;b+=4;}return b},
|
|
7974
|
-
function
|
|
7975
|
-
}function
|
|
7976
|
-
function
|
|
7977
|
-
function
|
|
7978
|
-
var
|
|
7979
|
-
function
|
|
7980
|
-
function yd(a){a||(a=
|
|
7981
|
-
var
|
|
7982
|
-
function
|
|
7983
|
-
function
|
|
7984
|
-
h)switch(a){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 36662:case 36663:case 35053:case 35055:case 36010:case 35097:case 35869:case 32874:case 36389:case 35983:case 35368:case 34068:f=0;break;default:
|
|
7985
|
-
0;}catch(m){
|
|
7986
|
-
function
|
|
7987
|
-
function
|
|
7988
|
-
|
|
7989
|
-
|
|
7990
|
-
|
|
7991
|
-
|
|
7992
|
-
|
|
7993
|
-
2)
|
|
7994
|
-
|
|
7995
|
-
|
|
7996
|
-
|
|
7997
|
-
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8005
|
-
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8011
|
-
|
|
8012
|
-
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
"
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
b)
|
|
8023
|
-
|
|
8024
|
-
b,c,
|
|
8025
|
-
|
|
8026
|
-
|
|
8027
|
-
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
(a
|
|
8033
|
-
b
|
|
8034
|
-
c=
|
|
8035
|
-
b)
|
|
8036
|
-
|
|
8037
|
-
b,c,f);},
|
|
8038
|
-
b,c,f);},
|
|
8039
|
-
b,c){Z.
|
|
8040
|
-
b);},
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
b,c,f,
|
|
8044
|
-
f[h+2]=R[c+(4*h+
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
2],
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
w.
|
|
8054
|
-
|
|
8055
|
-
|
|
8056
|
-
|
|
8057
|
-
function
|
|
8058
|
-
|
|
8006
|
+
a.mf();d=d||a.ImageFormat.PNG;g=g||100;return l?this._encodeToBytes(d,g,l):this._encodeToBytes(d,g)};a.Image.prototype.makeShaderCubic=function(d,g,l,t,x){x=G(x);return this._makeShaderCubic(d,g,l,t,x)};a.Image.prototype.makeShaderOptions=function(d,g,l,t,x){x=G(x);return this._makeShaderOptions(d,g,l,t,x)};a.Image.prototype.readPixels=function(d,g,l,t,x){var C=a.mf();return e(this,d,g,l,t,x,C)};a.Canvas.prototype.clear=function(d){a.de(this.be);d=y(d);this._clear(d);};a.Canvas.prototype.clipRRect=
|
|
8007
|
+
function(d,g,l){a.de(this.be);d=sa(d);this._clipRRect(d,g,l);};a.Canvas.prototype.clipRect=function(d,g,l){a.de(this.be);d=S(d);this._clipRect(d,g,l);};a.Canvas.prototype.concat=function(d){a.de(this.be);d=L(d);this._concat(d);};a.Canvas.prototype.drawArc=function(d,g,l,t,x){a.de(this.be);d=S(d);this._drawArc(d,g,l,t,x);};a.Canvas.prototype.drawAtlas=function(d,g,l,t,x,C,K){if(d&&t&&g&&l&&g.length===l.length){a.de(this.be);x||(x=a.BlendMode.SrcOver);var O=v(g,"HEAPF32"),P=v(l,"HEAPF32"),Y=l.length/4,
|
|
8008
|
+
ba=v(m(C),"HEAPU32");if(K&&"B"in K&&"C"in K)this._drawAtlasCubic(d,P,O,ba,Y,x,K.B,K.C,t);else {let r=a.FilterMode.Linear,D=a.MipmapMode.None;K&&(r=K.filter,"mipmap"in K&&(D=K.mipmap));this._drawAtlasOptions(d,P,O,ba,Y,x,r,D,t);}p(O,g);p(P,l);p(ba,C);}};a.Canvas.prototype.drawCircle=function(d,g,l,t){a.de(this.be);this._drawCircle(d,g,l,t);};a.Canvas.prototype.drawColor=function(d,g){a.de(this.be);d=y(d);void 0!==g?this._drawColor(d,g):this._drawColor(d);};a.Canvas.prototype.drawColorInt=function(d,g){a.de(this.be);
|
|
8009
|
+
this._drawColorInt(d,g||a.BlendMode.SrcOver);};a.Canvas.prototype.drawColorComponents=function(d,g,l,t,x){a.de(this.be);d=M(d,g,l,t);void 0!==x?this._drawColor(d,x):this._drawColor(d);};a.Canvas.prototype.drawDRRect=function(d,g,l){a.de(this.be);d=sa(d,$b);g=sa(g,Ec);this._drawDRRect(d,g,l);};a.Canvas.prototype.drawImage=function(d,g,l,t){a.de(this.be);this._drawImage(d,g,l,t||null);};a.Canvas.prototype.drawImageCubic=function(d,g,l,t,x,C){a.de(this.be);this._drawImageCubic(d,g,l,t,x,C||null);};a.Canvas.prototype.drawImageOptions=
|
|
8010
|
+
function(d,g,l,t,x,C){a.de(this.be);this._drawImageOptions(d,g,l,t,x,C||null);};a.Canvas.prototype.drawImageNine=function(d,g,l,t,x){a.de(this.be);g=v(g,"HEAP32",kb);l=S(l);this._drawImageNine(d,g,l,t,x||null);};a.Canvas.prototype.drawImageRect=function(d,g,l,t,x){a.de(this.be);S(g,ka);S(l,Pa);this._drawImageRect(d,ka,Pa,t,!!x);};a.Canvas.prototype.drawImageRectCubic=function(d,g,l,t,x,C){a.de(this.be);S(g,ka);S(l,Pa);this._drawImageRectCubic(d,ka,Pa,t,x,C||null);};a.Canvas.prototype.drawImageRectOptions=
|
|
8011
|
+
function(d,g,l,t,x,C){a.de(this.be);S(g,ka);S(l,Pa);this._drawImageRectOptions(d,ka,Pa,t,x,C||null);};a.Canvas.prototype.drawLine=function(d,g,l,t,x){a.de(this.be);this._drawLine(d,g,l,t,x);};a.Canvas.prototype.drawOval=function(d,g){a.de(this.be);d=S(d);this._drawOval(d,g);};a.Canvas.prototype.drawPaint=function(d){a.de(this.be);this._drawPaint(d);};a.Canvas.prototype.drawParagraph=function(d,g,l){a.de(this.be);this._drawParagraph(d,g,l);};a.Canvas.prototype.drawPatch=function(d,g,l,t,x){if(24>d.length)throw "Need 12 cubic points";
|
|
8012
|
+
if(g&&4>g.length)throw "Need 4 colors";if(l&&8>l.length)throw "Need 4 shader coordinates";a.de(this.be);const C=v(d,"HEAPF32"),K=g?v(m(g),"HEAPU32"):X,O=l?v(l,"HEAPF32"):X;t||(t=a.BlendMode.Modulate);this._drawPatch(C,K,O,t,x);p(O,l);p(K,g);p(C,d);};a.Canvas.prototype.drawPath=function(d,g){a.de(this.be);this._drawPath(d,g);};a.Canvas.prototype.drawPicture=function(d){a.de(this.be);this._drawPicture(d);};a.Canvas.prototype.drawPoints=function(d,g,l){a.de(this.be);var t=v(g,"HEAPF32");this._drawPoints(d,
|
|
8013
|
+
t,g.length/2,l);p(t,g);};a.Canvas.prototype.drawRRect=function(d,g){a.de(this.be);d=sa(d);this._drawRRect(d,g);};a.Canvas.prototype.drawRect=function(d,g){a.de(this.be);d=S(d);this._drawRect(d,g);};a.Canvas.prototype.drawRect4f=function(d,g,l,t,x){a.de(this.be);this._drawRect4f(d,g,l,t,x);};a.Canvas.prototype.drawShadow=function(d,g,l,t,x,C,K){a.de(this.be);var O=v(x,"HEAPF32"),P=v(C,"HEAPF32");g=v(g,"HEAPF32",ac);l=v(l,"HEAPF32",bc);this._drawShadow(d,g,l,t,O,P,K);p(O,x);p(P,C);};a.getShadowLocalBounds=
|
|
8014
|
+
function(d,g,l,t,x,C,K){d=G(d);l=v(l,"HEAPF32",ac);t=v(t,"HEAPF32",bc);if(!this._getShadowLocalBounds(d,g,l,t,x,C,ka))return null;g=Ca.toTypedArray();return K?(K.set(g),K):g.slice()};a.Canvas.prototype.drawTextBlob=function(d,g,l,t){a.de(this.be);this._drawTextBlob(d,g,l,t);};a.Canvas.prototype.drawVertices=function(d,g,l){a.de(this.be);this._drawVertices(d,g,l);};a.Canvas.prototype.getDeviceClipBounds=function(d){this._getDeviceClipBounds(kb);var g=Ab.toTypedArray();d?d.set(g):d=g.slice();return d};
|
|
8015
|
+
a.Canvas.prototype.quickReject=function(d){d=S(d);return this._quickReject(d)};a.Canvas.prototype.getLocalToDevice=function(){this._getLocalToDevice(bb);for(var d=bb,g=Array(16),l=0;16>l;l++)g[l]=a.HEAPF32[d/4+l];return g};a.Canvas.prototype.getTotalMatrix=function(){this._getTotalMatrix(Oa);for(var d=Array(9),g=0;9>g;g++)d[g]=a.HEAPF32[Oa/4+g];return d};a.Canvas.prototype.makeSurface=function(d){d=this._makeSurface(d);d.be=this.be;return d};a.Canvas.prototype.readPixels=function(d,g,l,t,x){a.de(this.be);
|
|
8016
|
+
return e(this,d,g,l,t,x)};a.Canvas.prototype.saveLayer=function(d,g,l,t,x){g=S(g);return this._saveLayer(d||null,g,l||null,t||0,x||a.TileMode.Clamp)};a.Canvas.prototype.writePixels=function(d,g,l,t,x,C,K,O){if(d.byteLength%(g*l))throw "pixels length must be a multiple of the srcWidth * srcHeight";a.de(this.be);var P=d.byteLength/(g*l);C=C||a.AlphaType.Unpremul;K=K||a.ColorType.RGBA_8888;O=O||a.ColorSpace.SRGB;var Y=P*g;P=v(d,"HEAPU8");g=this._writePixels({width:g,height:l,colorType:K,alphaType:C,colorSpace:O},
|
|
8017
|
+
P,Y,t,x);p(P,d);return g};a.ColorFilter.MakeBlend=function(d,g,l){d=y(d);l=l||a.ColorSpace.SRGB;return a.ColorFilter._MakeBlend(d,g,l)};a.ColorFilter.MakeMatrix=function(d){if(!d||20!==d.length)throw "invalid color matrix";var g=v(d,"HEAPF32"),l=a.ColorFilter._makeMatrix(g);p(g,d);return l};a.ContourMeasure.prototype.getPosTan=function(d,g){this._getPosTan(d,ka);d=Ca.toTypedArray();return g?(g.set(d),g):d.slice()};a.ImageFilter.prototype.getOutputBounds=function(d,g,l){d=S(d,ka);g=G(g);this._getOutputBounds(d,
|
|
8018
|
+
g,kb);g=Ab.toTypedArray();return l?(l.set(g),l):g.slice()};a.ImageFilter.MakeDropShadow=function(d,g,l,t,x,C){x=y(x,Va);return a.ImageFilter._MakeDropShadow(d,g,l,t,x,C)};a.ImageFilter.MakeDropShadowOnly=function(d,g,l,t,x,C){x=y(x,Va);return a.ImageFilter._MakeDropShadowOnly(d,g,l,t,x,C)};a.ImageFilter.MakeImage=function(d,g,l,t){l=S(l,ka);t=S(t,Pa);if("B"in g&&"C"in g)return a.ImageFilter._MakeImageCubic(d,g.B,g.C,l,t);const x=g.filter;let C=a.MipmapMode.None;"mipmap"in g&&(C=g.mipmap);return a.ImageFilter._MakeImageOptions(d,
|
|
8019
|
+
x,C,l,t)};a.ImageFilter.MakeMatrixTransform=function(d,g,l){d=G(d);if("B"in g&&"C"in g)return a.ImageFilter._MakeMatrixTransformCubic(d,g.B,g.C,l);const t=g.filter;let x=a.MipmapMode.None;"mipmap"in g&&(x=g.mipmap);return a.ImageFilter._MakeMatrixTransformOptions(d,t,x,l)};a.Paint.prototype.getColor=function(){this._getColor(Va);return T(Va)};a.Paint.prototype.setColor=function(d,g){g=g||null;d=y(d);this._setColor(d,g);};a.Paint.prototype.setColorComponents=function(d,g,l,t,x){x=x||null;d=M(d,g,l,
|
|
8020
|
+
t);this._setColor(d,x);};a.Path.prototype.getPoint=function(d,g){this._getPoint(d,ka);d=Ca.toTypedArray();return g?(g[0]=d[0],g[1]=d[1],g):d.slice(0,2)};a.Picture.prototype.makeShader=function(d,g,l,t,x){t=G(t);x=S(x);return this._makeShader(d,g,l,t,x)};a.Picture.prototype.cullRect=function(d){this._cullRect(ka);var g=Ca.toTypedArray();return d?(d.set(g),d):g.slice()};a.PictureRecorder.prototype.beginRecording=function(d,g){d=S(d);return this._beginRecording(d,!!g)};a.Surface.prototype.getCanvas=function(){var d=
|
|
8021
|
+
this._getCanvas();d.be=this.be;return d};a.Surface.prototype.makeImageSnapshot=function(d){a.de(this.be);d=v(d,"HEAP32",kb);return this._makeImageSnapshot(d)};a.Surface.prototype.makeSurface=function(d){a.de(this.be);d=this._makeSurface(d);d.be=this.be;return d};a.Surface.prototype.Wf=function(d,g){this.Ze||(this.Ze=this.getCanvas());return requestAnimationFrame(function(){a.de(this.be);d(this.Ze);this.flush(g);}.bind(this))};a.Surface.prototype.requestAnimationFrame||(a.Surface.prototype.requestAnimationFrame=
|
|
8022
|
+
a.Surface.prototype.Wf);a.Surface.prototype.Sf=function(d,g){this.Ze||(this.Ze=this.getCanvas());requestAnimationFrame(function(){a.de(this.be);d(this.Ze);this.flush(g);this.dispose();}.bind(this));};a.Surface.prototype.drawOnce||(a.Surface.prototype.drawOnce=a.Surface.prototype.Sf);a.PathEffect.MakeDash=function(d,g){g||(g=0);if(!d.length||1===d.length%2)throw "Intervals array must have even length";var l=v(d,"HEAPF32");g=a.PathEffect._MakeDash(l,d.length,g);p(l,d);return g};a.PathEffect.MakeLine2D=
|
|
8023
|
+
function(d,g){g=G(g);return a.PathEffect._MakeLine2D(d,g)};a.PathEffect.MakePath2D=function(d,g){d=G(d);return a.PathEffect._MakePath2D(d,g)};a.Shader.MakeColor=function(d,g){g=g||null;d=y(d);return a.Shader._MakeColor(d,g)};a.Shader.Blend=a.Shader.MakeBlend;a.Shader.Color=a.Shader.MakeColor;a.Shader.MakeLinearGradient=function(d,g,l,t,x,C,K,O){O=O||null;var P=E(l),Y=v(t,"HEAPF32");K=K||0;C=G(C);var ba=Ca.toTypedArray();ba.set(d);ba.set(g,2);d=a.Shader._MakeLinearGradient(ka,P.te,P.colorType,Y,P.count,
|
|
8024
|
+
x,K,C,O);p(P.te,l);t&&p(Y,t);return d};a.Shader.MakeRadialGradient=function(d,g,l,t,x,C,K,O){O=O||null;var P=E(l),Y=v(t,"HEAPF32");K=K||0;C=G(C);d=a.Shader._MakeRadialGradient(d[0],d[1],g,P.te,P.colorType,Y,P.count,x,K,C,O);p(P.te,l);t&&p(Y,t);return d};a.Shader.MakeSweepGradient=function(d,g,l,t,x,C,K,O,P,Y){Y=Y||null;var ba=E(l),r=v(t,"HEAPF32");K=K||0;O=O||0;P=P||360;C=G(C);d=a.Shader._MakeSweepGradient(d,g,ba.te,ba.colorType,r,ba.count,x,O,P,K,C,Y);p(ba.te,l);t&&p(r,t);return d};a.Shader.MakeTwoPointConicalGradient=
|
|
8025
|
+
function(d,g,l,t,x,C,K,O,P,Y){Y=Y||null;var ba=E(x),r=v(C,"HEAPF32");P=P||0;O=G(O);var D=Ca.toTypedArray();D.set(d);D.set(l,2);d=a.Shader._MakeTwoPointConicalGradient(ka,g,t,ba.te,ba.colorType,r,ba.count,K,P,O,Y);p(ba.te,x);C&&p(r,C);return d};a.Vertices.prototype.bounds=function(d){this._bounds(ka);var g=Ca.toTypedArray();return d?(d.set(g),d):g.slice()};a.ke&&a.ke.forEach(function(d){d();});};a.computeTonalColors=function(e){var d=v(e.ambient,"HEAPF32"),g=v(e.spot,"HEAPF32");this._computeTonalColors(d,
|
|
8026
|
+
g);var l={ambient:T(d),spot:T(g)};p(d,e.ambient);p(g,e.spot);return l};a.LTRBRect=function(e,d,g,l){return Float32Array.of(e,d,g,l)};a.XYWHRect=function(e,d,g,l){return Float32Array.of(e,d,e+g,d+l)};a.LTRBiRect=function(e,d,g,l){return Int32Array.of(e,d,g,l)};a.XYWHiRect=function(e,d,g,l){return Int32Array.of(e,d,e+g,d+l)};a.RRectXY=function(e,d,g){return Float32Array.of(e[0],e[1],e[2],e[3],d,g,d,g,d,g,d,g)};a.MakeAnimatedImageFromEncoded=function(e){e=new Uint8Array(e);var d=a._malloc(e.byteLength);
|
|
8027
|
+
a.HEAPU8.set(e,d);return (e=a._decodeAnimatedImage(d,e.byteLength))?e:null};a.MakeImageFromEncoded=function(e){e=new Uint8Array(e);var d=a._malloc(e.byteLength);a.HEAPU8.set(e,d);return (e=a._decodeImage(d,e.byteLength))?e:null};var lb=null;a.MakeImageFromCanvasImageSource=function(e){var d=e.width,g=e.height;lb||(lb=document.createElement("canvas"));lb.width=d;lb.height=g;var l=lb.getContext("2d",{willReadFrequently:true});l.drawImage(e,0,0);e=l.getImageData(0,0,d,g);return a.MakeImage({width:d,height:g,
|
|
8028
|
+
alphaType:a.AlphaType.Unpremul,colorType:a.ColorType.RGBA_8888,colorSpace:a.ColorSpace.SRGB},e.data,4*d)};a.MakeImage=function(e,d,g){var l=a._malloc(d.length);a.HEAPU8.set(d,l);return a._MakeImage(e,l,d.length,g)};a.MakeVertices=function(e,d,g,l,t,x){var C=t&&t.length||0,K=0;g&&g.length&&(K|=1);l&&l.length&&(K|=2);void 0===x||x||(K|=4);e=new a._VerticesBuilder(e,d.length/2,C,K);v(d,"HEAPF32",e.positions());e.texCoords()&&v(g,"HEAPF32",e.texCoords());e.colors()&&v(m(l),"HEAPU32",e.colors());e.indices()&&
|
|
8029
|
+
v(t,"HEAPU16",e.indices());return e.detach()};a.Matrix={};a.Matrix.identity=function(){return c(3)};a.Matrix.invert=function(e){var d=e[0]*e[4]*e[8]+e[1]*e[5]*e[6]+e[2]*e[3]*e[7]-e[2]*e[4]*e[6]-e[1]*e[3]*e[8]-e[0]*e[5]*e[7];return d?[(e[4]*e[8]-e[5]*e[7])/d,(e[2]*e[7]-e[1]*e[8])/d,(e[1]*e[5]-e[2]*e[4])/d,(e[5]*e[6]-e[3]*e[8])/d,(e[0]*e[8]-e[2]*e[6])/d,(e[2]*e[3]-e[0]*e[5])/d,(e[3]*e[7]-e[4]*e[6])/d,(e[1]*e[6]-e[0]*e[7])/d,(e[0]*e[4]-e[1]*e[3])/d]:null};a.Matrix.mapPoints=function(e,d){for(var g=0;g<
|
|
8030
|
+
d.length;g+=2){var l=d[g],t=d[g+1],x=e[6]*l+e[7]*t+e[8],C=e[3]*l+e[4]*t+e[5];d[g]=(e[0]*l+e[1]*t+e[2])/x;d[g+1]=C/x;}return d};a.Matrix.multiply=function(){return jb(3,arguments)};a.Matrix.rotated=function(e,d,g){d=d||0;g=g||0;var l=Math.sin(e);e=Math.cos(e);return [e,-l,pa(l,g,1-e,d),l,e,pa(-l,d,1-e,g),0,0,1]};a.Matrix.scaled=function(e,d,g,l){g=g||0;l=l||0;var t=b([e,d],c(3),3,0,1);return b([g-e*g,l-d*l],t,3,2,0)};a.Matrix.skewed=function(e,d,g,l){g=g||0;l=l||0;var t=b([e,d],c(3),3,1,-1);return b([-e*
|
|
8031
|
+
g,-d*l],t,3,2,0)};a.Matrix.translated=function(e,d){return b(arguments,c(3),3,2,0)};a.Vector={};a.Vector.dot=function(e,d){return e.map(function(g,l){return g*d[l]}).reduce(function(g,l){return g+l})};a.Vector.lengthSquared=function(e){return a.Vector.dot(e,e)};a.Vector.length=function(e){return Math.sqrt(a.Vector.lengthSquared(e))};a.Vector.mulScalar=function(e,d){return e.map(function(g){return g*d})};a.Vector.add=function(e,d){return e.map(function(g,l){return g+d[l]})};a.Vector.sub=function(e,
|
|
8032
|
+
d){return e.map(function(g,l){return g-d[l]})};a.Vector.dist=function(e,d){return a.Vector.length(a.Vector.sub(e,d))};a.Vector.normalize=function(e){return a.Vector.mulScalar(e,1/a.Vector.length(e))};a.Vector.cross=function(e,d){return [e[1]*d[2]-e[2]*d[1],e[2]*d[0]-e[0]*d[2],e[0]*d[1]-e[1]*d[0]]};a.M44={};a.M44.identity=function(){return c(4)};a.M44.translated=function(e){return b(e,c(4),4,3,0)};a.M44.scaled=function(e){return b(e,c(4),4,0,1)};a.M44.rotated=function(e,d){return a.M44.rotatedUnitSinCos(a.Vector.normalize(e),
|
|
8033
|
+
Math.sin(d),Math.cos(d))};a.M44.rotatedUnitSinCos=function(e,d,g){var l=e[0],t=e[1];e=e[2];var x=1-g;return [x*l*l+g,x*l*t-d*e,x*l*e+d*t,0,x*l*t+d*e,x*t*t+g,x*t*e-d*l,0,x*l*e-d*t,x*t*e+d*l,x*e*e+g,0,0,0,0,1]};a.M44.lookat=function(e,d,g){d=a.Vector.normalize(a.Vector.sub(d,e));g=a.Vector.normalize(g);g=a.Vector.normalize(a.Vector.cross(d,g));var l=a.M44.identity();b(g,l,4,0,0);b(a.Vector.cross(g,d),l,4,1,0);b(a.Vector.mulScalar(d,-1),l,4,2,0);b(e,l,4,3,0);e=a.M44.invert(l);return null===e?a.M44.identity():
|
|
8034
|
+
e};a.M44.perspective=function(e,d,g){var l=1/(d-e);g/=2;g=Math.cos(g)/Math.sin(g);return [g,0,0,0,0,g,0,0,0,0,(d+e)*l,2*d*e*l,0,0,-1,1]};a.M44.rc=function(e,d,g){return e[4*d+g]};a.M44.multiply=function(){return jb(4,arguments)};a.M44.invert=function(e){var d=e[0],g=e[4],l=e[8],t=e[12],x=e[1],C=e[5],K=e[9],O=e[13],P=e[2],Y=e[6],ba=e[10],r=e[14],D=e[3],U=e[7],ea=e[11];e=e[15];var la=d*C-g*x,ta=d*K-l*x,xa=d*O-t*x,Da=g*K-l*C,fa=g*O-t*C,I=l*O-t*K,k=P*U-Y*D,q=P*ea-ba*D,z=P*e-r*D,A=Y*ea-ba*U,F=Y*e-r*U,H=
|
|
8035
|
+
ba*e-r*ea,N=la*H-ta*F+xa*A+Da*z-fa*q+I*k,V=1/N;if(0===N||Infinity===V)return null;la*=V;ta*=V;xa*=V;Da*=V;fa*=V;I*=V;k*=V;q*=V;z*=V;A*=V;F*=V;H*=V;d=[C*H-K*F+O*A,K*z-x*H-O*q,x*F-C*z+O*k,C*q-x*A-K*k,l*F-g*H-t*A,d*H-l*z+t*q,g*z-d*F-t*k,d*A-g*q+l*k,U*I-ea*fa+e*Da,ea*xa-D*I-e*ta,D*fa-U*xa+e*la,U*ta-D*Da-ea*la,ba*fa-Y*I-r*Da,P*I-ba*xa+r*ta,Y*xa-P*fa-r*la,P*Da-Y*ta+ba*la];return d.every(function(qa){return !isNaN(qa)&&Infinity!==qa&&-Infinity!==qa})?d:null};a.M44.transpose=function(e){return [e[0],e[4],e[8],
|
|
8036
|
+
e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]]};a.M44.mustInvert=function(e){e=a.M44.invert(e);if(null===e)throw "Matrix not invertible";return e};a.M44.setupCamera=function(e,d,g){var l=a.M44.lookat(g.eye,g.coa,g.up);g=a.M44.perspective(g.near,g.far,g.angle);d=[(e[2]-e[0])/2,(e[3]-e[1])/2,d];e=a.M44.multiply(a.M44.translated([(e[0]+e[2])/2,(e[1]+e[3])/2,0]),a.M44.scaled(d));return a.M44.multiply(e,g,l,a.M44.mustInvert(e))};a.ColorMatrix={};a.ColorMatrix.identity=function(){var e=
|
|
8037
|
+
new Float32Array(20);e[0]=1;e[6]=1;e[12]=1;e[18]=1;return e};a.ColorMatrix.scaled=function(e,d,g,l){var t=new Float32Array(20);t[0]=e;t[6]=d;t[12]=g;t[18]=l;return t};var Id=[[6,7,11,12],[0,10,2,12],[0,1,5,6]];a.ColorMatrix.rotated=function(e,d,g){var l=a.ColorMatrix.identity();e=Id[e];l[e[0]]=g;l[e[1]]=d;l[e[2]]=-d;l[e[3]]=g;return l};a.ColorMatrix.postTranslate=function(e,d,g,l,t){e[4]+=d;e[9]+=g;e[14]+=l;e[19]+=t;return e};a.ColorMatrix.concat=function(e,d){for(var g=new Float32Array(20),l=0,t=
|
|
8038
|
+
0;20>t;t+=5){for(var x=0;4>x;x++)g[l++]=e[t]*d[x]+e[t+1]*d[x+5]+e[t+2]*d[x+10]+e[t+3]*d[x+15];g[l++]=e[t]*d[4]+e[t+1]*d[9]+e[t+2]*d[14]+e[t+3]*d[19]+e[t+4];}return g};(function(e){e.ke=e.ke||[];e.ke.push(function(){function d(r){r&&(r.dir=0===r.dir?e.TextDirection.RTL:e.TextDirection.LTR);return r}function g(r){if(!r||!r.length)return [];for(var D=[],U=0;U<r.length;U+=5){var ea=e.LTRBRect(r[U],r[U+1],r[U+2],r[U+3]),la=e.TextDirection.LTR;0===r[U+4]&&(la=e.TextDirection.RTL);D.push({rect:ea,dir:la});}e._free(r.byteOffset);
|
|
8039
|
+
return D}function l(r){r=r||{};void 0===r.weight&&(r.weight=e.FontWeight.Normal);r.width=r.width||e.FontWidth.Normal;r.slant=r.slant||e.FontSlant.Upright;return r}function t(r){if(!r||!r.length)return X;for(var D=[],U=0;U<r.length;U++){var ea=x(r[U]);D.push(ea);}return v(D,"HEAPU32")}function x(r){if(O[r])return O[r];var D=na(r)+1,U=e._malloc(D);oa(r,J,U,D);return O[r]=U}function C(r){r._colorPtr=y(r.color);r._foregroundColorPtr=X;r._backgroundColorPtr=X;r._decorationColorPtr=X;r.foregroundColor&&
|
|
8040
|
+
(r._foregroundColorPtr=y(r.foregroundColor,P));r.backgroundColor&&(r._backgroundColorPtr=y(r.backgroundColor,Y));r.decorationColor&&(r._decorationColorPtr=y(r.decorationColor,ba));Array.isArray(r.fontFamilies)&&r.fontFamilies.length?(r._fontFamiliesPtr=t(r.fontFamilies),r._fontFamiliesLen=r.fontFamilies.length):(r._fontFamiliesPtr=X,r._fontFamiliesLen=0);if(r.locale){var D=r.locale;r._localePtr=x(D);r._localeLen=na(D);}else r._localePtr=X,r._localeLen=0;if(Array.isArray(r.shadows)&&r.shadows.length){D=
|
|
8041
|
+
r.shadows;var U=D.map(function(fa){return fa.color||e.BLACK}),ea=D.map(function(fa){return fa.blurRadius||0});r._shadowLen=D.length;for(var la=e._malloc(8*D.length),ta=la/4,xa=0;xa<D.length;xa++){var Da=D[xa].offset||[0,0];e.HEAPF32[ta]=Da[0];e.HEAPF32[ta+1]=Da[1];ta+=2;}r._shadowColorsPtr=E(U).te;r._shadowOffsetsPtr=la;r._shadowBlurRadiiPtr=v(ea,"HEAPF32");}else r._shadowLen=0,r._shadowColorsPtr=X,r._shadowOffsetsPtr=X,r._shadowBlurRadiiPtr=X;Array.isArray(r.fontFeatures)&&r.fontFeatures.length?(D=
|
|
8042
|
+
r.fontFeatures,U=D.map(function(fa){return fa.name}),ea=D.map(function(fa){return fa.value}),r._fontFeatureLen=D.length,r._fontFeatureNamesPtr=t(U),r._fontFeatureValuesPtr=v(ea,"HEAPU32")):(r._fontFeatureLen=0,r._fontFeatureNamesPtr=X,r._fontFeatureValuesPtr=X);Array.isArray(r.fontVariations)&&r.fontVariations.length?(D=r.fontVariations,U=D.map(function(fa){return fa.axis}),ea=D.map(function(fa){return fa.value}),r._fontVariationLen=D.length,r._fontVariationAxesPtr=t(U),r._fontVariationValuesPtr=
|
|
8043
|
+
v(ea,"HEAPF32")):(r._fontVariationLen=0,r._fontVariationAxesPtr=X,r._fontVariationValuesPtr=X);}function K(r){e._free(r._fontFamiliesPtr);e._free(r._shadowColorsPtr);e._free(r._shadowOffsetsPtr);e._free(r._shadowBlurRadiiPtr);e._free(r._fontFeatureNamesPtr);e._free(r._fontFeatureValuesPtr);e._free(r._fontVariationAxesPtr);e._free(r._fontVariationValuesPtr);}e.Paragraph.prototype.getRectsForRange=function(r,D,U,ea){r=this._getRectsForRange(r,D,U,ea);return g(r)};e.Paragraph.prototype.getRectsForPlaceholders=
|
|
8044
|
+
function(){var r=this._getRectsForPlaceholders();return g(r)};e.Paragraph.prototype.getGlyphInfoAt=function(r){return d(this._getGlyphInfoAt(r))};e.Paragraph.prototype.getClosestGlyphInfoAtCoordinate=function(r,D){return d(this._getClosestGlyphInfoAtCoordinate(r,D))};e.TypefaceFontProvider.prototype.registerFont=function(r,D){r=e.Typeface.MakeTypefaceFromData(r);if(!r)return null;D=x(D);this._registerFont(r,D);r.delete();};e.ParagraphStyle=function(r){r.disableHinting=r.disableHinting||false;if(r.ellipsis){var D=
|
|
8045
|
+
r.ellipsis;r._ellipsisPtr=x(D);r._ellipsisLen=na(D);}else r._ellipsisPtr=X,r._ellipsisLen=0;null==r.heightMultiplier&&(r.heightMultiplier=-1);r.maxLines=r.maxLines||0;r.replaceTabCharacters=r.replaceTabCharacters||false;D=(D=r.strutStyle)||{};D.strutEnabled=D.strutEnabled||false;D.strutEnabled&&Array.isArray(D.fontFamilies)&&D.fontFamilies.length?(D._fontFamiliesPtr=t(D.fontFamilies),D._fontFamiliesLen=D.fontFamilies.length):(D._fontFamiliesPtr=X,D._fontFamiliesLen=0);D.fontStyle=l(D.fontStyle);null==D.fontSize&&
|
|
8046
|
+
(D.fontSize=-1);null==D.heightMultiplier&&(D.heightMultiplier=-1);D.halfLeading=D.halfLeading||false;D.leading=D.leading||0;D.forceStrutHeight=D.forceStrutHeight||false;r.strutStyle=D;r.textAlign=r.textAlign||e.TextAlign.Start;r.textDirection=r.textDirection||e.TextDirection.LTR;r.textHeightBehavior=r.textHeightBehavior||e.TextHeightBehavior.All;r.textStyle=e.TextStyle(r.textStyle);r.applyRoundingHack=false!==r.applyRoundingHack;return r};e.TextStyle=function(r){r.color||(r.color=e.BLACK);r.decoration=r.decoration||
|
|
8047
|
+
0;r.decorationThickness=r.decorationThickness||0;r.decorationStyle=r.decorationStyle||e.DecorationStyle.Solid;r.textBaseline=r.textBaseline||e.TextBaseline.Alphabetic;null==r.fontSize&&(r.fontSize=-1);r.letterSpacing=r.letterSpacing||0;r.wordSpacing=r.wordSpacing||0;null==r.heightMultiplier&&(r.heightMultiplier=-1);r.halfLeading=r.halfLeading||false;r.fontStyle=l(r.fontStyle);return r};var O={},P=e._malloc(16),Y=e._malloc(16),ba=e._malloc(16);e.ParagraphBuilder.Make=function(r,D){C(r.textStyle);D=e.ParagraphBuilder._Make(r,
|
|
8048
|
+
D);K(r.textStyle);return D};e.ParagraphBuilder.MakeFromFontProvider=function(r,D){C(r.textStyle);D=e.ParagraphBuilder._MakeFromFontProvider(r,D);K(r.textStyle);return D};e.ParagraphBuilder.MakeFromFontCollection=function(r,D){C(r.textStyle);D=e.ParagraphBuilder._MakeFromFontCollection(r,D);K(r.textStyle);return D};e.ParagraphBuilder.ShapeText=function(r,D,U){let ea=0;for(const la of D)ea+=la.length;if(ea!==r.length)throw "Accumulated block lengths must equal text.length";return e.ParagraphBuilder._ShapeText(r,
|
|
8049
|
+
D,U)};e.ParagraphBuilder.prototype.pushStyle=function(r){C(r);this._pushStyle(r);K(r);};e.ParagraphBuilder.prototype.pushPaintStyle=function(r,D,U){C(r);this._pushPaintStyle(r,D,U);K(r);};e.ParagraphBuilder.prototype.addPlaceholder=function(r,D,U,ea,la){U=U||e.PlaceholderAlignment.Baseline;ea=ea||e.TextBaseline.Alphabetic;this._addPlaceholder(r||0,D||0,U,ea,la||0);};e.ParagraphBuilder.prototype.setWordsUtf8=function(r){var D=v(r,"HEAPU32");this._setWordsUtf8(D,r&&r.length||0);p(D,r);};e.ParagraphBuilder.prototype.setWordsUtf16=
|
|
8050
|
+
function(r){var D=v(r,"HEAPU32");this._setWordsUtf16(D,r&&r.length||0);p(D,r);};e.ParagraphBuilder.prototype.setGraphemeBreaksUtf8=function(r){var D=v(r,"HEAPU32");this._setGraphemeBreaksUtf8(D,r&&r.length||0);p(D,r);};e.ParagraphBuilder.prototype.setGraphemeBreaksUtf16=function(r){var D=v(r,"HEAPU32");this._setGraphemeBreaksUtf16(D,r&&r.length||0);p(D,r);};e.ParagraphBuilder.prototype.setLineBreaksUtf8=function(r){var D=v(r,"HEAPU32");this._setLineBreaksUtf8(D,r&&r.length||0);p(D,r);};e.ParagraphBuilder.prototype.setLineBreaksUtf16=
|
|
8051
|
+
function(r){var D=v(r,"HEAPU32");this._setLineBreaksUtf16(D,r&&r.length||0);p(D,r);};});})(w);a.ke=a.ke||[];a.ke.push(function(){a.Path.prototype.op=function(e,d){return this._op(e,d)?this:null};a.Path.prototype.simplify=function(){return this._simplify()?this:null};});a.ke=a.ke||[];a.ke.push(function(){a.Canvas.prototype.drawText=function(e,d,g,l,t){var x=na(e),C=a._malloc(x+1);oa(e,J,C,x+1);this._drawSimpleText(C,x,d,g,t,l);a._free(C);};a.Canvas.prototype.drawGlyphs=function(e,d,g,l,t,x){if(!(2*e.length<=
|
|
8052
|
+
d.length))throw "Not enough positions for the array of gyphs";a.de(this.be);const C=v(e,"HEAPU16"),K=v(d,"HEAPF32");this._drawGlyphs(e.length,C,K,g,l,t,x);p(K,d);p(C,e);};a.Font.prototype.getGlyphBounds=function(e,d,g){var l=v(e,"HEAPU16"),t=a._malloc(16*e.length);this._getGlyphWidthBounds(l,e.length,X,t,d||null);d=new Float32Array(a.HEAPU8.buffer,t,4*e.length);p(l,e);if(g)return g.set(d),a._free(t),g;e=Float32Array.from(d);a._free(t);return e};a.Font.prototype.getGlyphIDs=function(e,d,g){d||(d=e.length);
|
|
8053
|
+
var l=na(e)+1,t=a._malloc(l);oa(e,J,t,l);e=a._malloc(2*d);d=this._getGlyphIDs(t,l-1,d,e);a._free(t);if(0>d)return a._free(e),null;t=new Uint16Array(a.HEAPU8.buffer,e,d);if(g)return g.set(t),a._free(e),g;g=Uint16Array.from(t);a._free(e);return g};a.Font.prototype.getGlyphIntercepts=function(e,d,g,l){var t=v(e,"HEAPU16"),x=v(d,"HEAPF32");return this._getGlyphIntercepts(t,e.length,!(e&&e._ck),x,d.length,!(d&&d._ck),g,l)};a.Font.prototype.getGlyphWidths=function(e,d,g){var l=v(e,"HEAPU16"),t=a._malloc(4*
|
|
8054
|
+
e.length);this._getGlyphWidthBounds(l,e.length,t,X,d||null);d=new Float32Array(a.HEAPU8.buffer,t,e.length);p(l,e);if(g)return g.set(d),a._free(t),g;e=Float32Array.from(d);a._free(t);return e};a.FontMgr.FromData=function(){if(!arguments.length)return null;var e=arguments;1===e.length&&Array.isArray(e[0])&&(e=arguments[0]);if(!e.length)return null;for(var d=[],g=[],l=0;l<e.length;l++){var t=new Uint8Array(e[l]),x=v(t,"HEAPU8");d.push(x);g.push(t.byteLength);}d=v(d,"HEAPU32");g=v(g,"HEAPU32");e=a.FontMgr._fromData(d,
|
|
8055
|
+
g,e.length);a._free(d);a._free(g);return e};a.Typeface.MakeTypefaceFromData=function(e){e=new Uint8Array(e);var d=v(e,"HEAPU8");return (e=a.Typeface._MakeTypefaceFromData(d,e.byteLength))?e:null};a.Typeface.MakeFreeTypeFaceFromData=a.Typeface.MakeTypefaceFromData;a.Typeface.prototype.getGlyphIDs=function(e,d,g){d||(d=e.length);var l=na(e)+1,t=a._malloc(l);oa(e,J,t,l);e=a._malloc(2*d);d=this._getGlyphIDs(t,l-1,d,e);a._free(t);if(0>d)return a._free(e),null;t=new Uint16Array(a.HEAPU8.buffer,e,d);if(g)return g.set(t),
|
|
8056
|
+
a._free(e),g;g=Uint16Array.from(t);a._free(e);return g};a.TextBlob.MakeOnPath=function(e,d,g,l){if(e&&e.length&&d&&d.countPoints()){if(1===d.countPoints())return this.MakeFromText(e,g);l||(l=0);var t=g.getGlyphIDs(e);t=g.getGlyphWidths(t);var x=[];d=new a.ContourMeasureIter(d,false,1);for(var C=d.next(),K=new Float32Array(4),O=0;O<e.length&&C;O++){var P=t[O];l+=P/2;if(l>C.length()){C.delete();C=d.next();if(!C){e=e.substring(0,O);break}l=P/2;}C.getPosTan(l,K);var Y=K[2],ba=K[3];x.push(Y,ba,K[0]-P/2*Y,
|
|
8057
|
+
K[1]-P/2*ba);l+=P/2;}e=this.MakeFromRSXform(e,x,g);C&&C.delete();d.delete();return e}};a.TextBlob.MakeFromRSXform=function(e,d,g){var l=na(e)+1,t=a._malloc(l);oa(e,J,t,l);e=v(d,"HEAPF32");g=a.TextBlob._MakeFromRSXform(t,l-1,e,g);a._free(t);return g?g:null};a.TextBlob.MakeFromRSXformGlyphs=function(e,d,g){var l=v(e,"HEAPU16");d=v(d,"HEAPF32");g=a.TextBlob._MakeFromRSXformGlyphs(l,2*e.length,d,g);p(l,e);return g?g:null};a.TextBlob.MakeFromGlyphs=function(e,d){var g=v(e,"HEAPU16");d=a.TextBlob._MakeFromGlyphs(g,
|
|
8058
|
+
2*e.length,d);p(g,e);return d?d:null};a.TextBlob.MakeFromText=function(e,d){var g=na(e)+1,l=a._malloc(g);oa(e,J,l,g);e=a.TextBlob._MakeFromText(l,g-1,d);a._free(l);return e?e:null};a.MallocGlyphIDs=function(e){return a.Malloc(Uint16Array,e)};});a.ke=a.ke||[];a.ke.push(function(){a.MakePicture=function(e){e=new Uint8Array(e);var d=a._malloc(e.byteLength);a.HEAPU8.set(e,d);return (e=a._MakePicture(d,e.byteLength))?e:null};});a.ke=a.ke||[];a.ke.push(function(){a.RuntimeEffect.Make=function(e,d){return a.RuntimeEffect._Make(e,
|
|
8059
|
+
{onError:d||function(g){console.log("RuntimeEffect error",g);}})};a.RuntimeEffect.MakeForBlender=function(e,d){return a.RuntimeEffect._MakeForBlender(e,{onError:d||function(g){console.log("RuntimeEffect error",g);}})};a.RuntimeEffect.prototype.makeShader=function(e,d){var g=!e._ck,l=v(e,"HEAPF32");d=G(d);return this._makeShader(l,4*e.length,g,d)};a.RuntimeEffect.prototype.makeShaderWithChildren=function(e,d,g){var l=!e._ck,t=v(e,"HEAPF32");g=G(g);for(var x=[],C=0;C<d.length;C++)x.push(d[C].ae.ie);d=
|
|
8060
|
+
v(x,"HEAPU32");return this._makeShaderWithChildren(t,4*e.length,l,d,x.length,g)};a.RuntimeEffect.prototype.makeBlender=function(e){var d=!e._ck,g=v(e,"HEAPF32");return this._makeBlender(g,4*e.length,d)};});(function(){function e(I){for(var k=0;k<I.length;k++)if(void 0!==I[k]&&!Number.isFinite(I[k]))return false;return true}function d(I){var k=a.getColorComponents(I);I=k[0];var q=k[1],z=k[2];k=k[3];if(1===k)return I=I.toString(16).toLowerCase(),q=q.toString(16).toLowerCase(),z=z.toString(16).toLowerCase(),
|
|
8061
|
+
I=1===I.length?"0"+I:I,q=1===q.length?"0"+q:q,z=1===z.length?"0"+z:z,"#"+I+q+z;k=0===k||1===k?k:k.toFixed(8);return "rgba("+I+", "+q+", "+z+", "+k+")"}function g(I){return a.parseColorString(I,xa)}function l(I){I=Da.exec(I);if(!I)return null;var k=parseFloat(I[4]),q=16;switch(I[5]){case "em":case "rem":q=16*k;break;case "pt":q=4*k/3;break;case "px":q=k;break;case "pc":q=16*k;break;case "in":q=96*k;break;case "cm":q=96*k/2.54;break;case "mm":q=96/25.4*k;break;case "q":q=96/25.4/4*k;break;case "%":q=
|
|
8062
|
+
16/75*k;}return {style:I[1],variant:I[2],weight:I[3],sizePx:q,family:I[6].trim()}}function t(){fa||(fa={"Noto Mono":{"*":a.Typeface.GetDefault()},monospace:{"*":a.Typeface.GetDefault()}});}function x(I){this.ce=I;this.fe=new a.Paint;this.fe.setAntiAlias(true);this.fe.setStrokeMiter(10);this.fe.setStrokeCap(a.StrokeCap.Butt);this.fe.setStrokeJoin(a.StrokeJoin.Miter);this.kf="10px monospace";this.Fe=new a.Font(a.Typeface.GetDefault(),10);this.Fe.setSubpixel(true);this.se=this.ye=a.BLACK;this.Oe=0;this.af=
|
|
8063
|
+
a.TRANSPARENT;this.Qe=this.Pe=0;this.bf=this.Be=1;this.$e=0;this.Ne=[];this.ee=a.BlendMode.SrcOver;this.fe.setStrokeWidth(this.bf);this.fe.setBlendMode(this.ee);this.he=new a.Path;this.je=a.Matrix.identity();this.Ff=[];this.Ue=[];this.Ee=function(){this.he.delete();this.fe.delete();this.Fe.delete();this.Ue.forEach(function(k){k.Ee();});};Object.defineProperty(this,"currentTransform",{enumerable:true,get:function(){return {a:this.je[0],c:this.je[1],e:this.je[2],b:this.je[3],d:this.je[4],f:this.je[5]}},
|
|
8064
|
+
set:function(k){k.a&&this.setTransform(k.a,k.b,k.c,k.d,k.e,k.f);}});Object.defineProperty(this,"fillStyle",{enumerable:true,get:function(){return f(this.se)?d(this.se):this.se},set:function(k){"string"===typeof k?this.se=g(k):k.Me&&(this.se=k);}});Object.defineProperty(this,"font",{enumerable:true,get:function(){return this.kf},set:function(k){var q=l(k);var z=(q.style||"normal")+"|"+(q.variant||"normal")+"|"+(q.weight||"normal");var A=q.family;t();z=fa[A]?fa[A][z]||fa[A]["*"]:a.Typeface.GetDefault();q.typeface=
|
|
8065
|
+
z;q&&(this.Fe.setSize(q.sizePx),this.Fe.setTypeface(q.typeface),this.kf=k);}});Object.defineProperty(this,"globalAlpha",{enumerable:true,get:function(){return this.Be},set:function(k){!isFinite(k)||0>k||1<k||(this.Be=k);}});Object.defineProperty(this,"globalCompositeOperation",{enumerable:true,get:function(){switch(this.ee){case a.BlendMode.SrcOver:return "source-over";case a.BlendMode.DstOver:return "destination-over";case a.BlendMode.Src:return "copy";case a.BlendMode.Dst:return "destination";case a.BlendMode.Clear:return "clear";
|
|
8066
|
+
case a.BlendMode.SrcIn:return "source-in";case a.BlendMode.DstIn:return "destination-in";case a.BlendMode.SrcOut:return "source-out";case a.BlendMode.DstOut:return "destination-out";case a.BlendMode.SrcATop:return "source-atop";case a.BlendMode.DstATop:return "destination-atop";case a.BlendMode.Xor:return "xor";case a.BlendMode.Plus:return "lighter";case a.BlendMode.Multiply:return "multiply";case a.BlendMode.Screen:return "screen";case a.BlendMode.Overlay:return "overlay";case a.BlendMode.Darken:return "darken";
|
|
8067
|
+
case a.BlendMode.Lighten:return "lighten";case a.BlendMode.ColorDodge:return "color-dodge";case a.BlendMode.ColorBurn:return "color-burn";case a.BlendMode.HardLight:return "hard-light";case a.BlendMode.SoftLight:return "soft-light";case a.BlendMode.Difference:return "difference";case a.BlendMode.Exclusion:return "exclusion";case a.BlendMode.Hue:return "hue";case a.BlendMode.Saturation:return "saturation";case a.BlendMode.Color:return "color";case a.BlendMode.Luminosity:return "luminosity"}},set:function(k){switch(k){case "source-over":this.ee=
|
|
8068
|
+
a.BlendMode.SrcOver;break;case "destination-over":this.ee=a.BlendMode.DstOver;break;case "copy":this.ee=a.BlendMode.Src;break;case "destination":this.ee=a.BlendMode.Dst;break;case "clear":this.ee=a.BlendMode.Clear;break;case "source-in":this.ee=a.BlendMode.SrcIn;break;case "destination-in":this.ee=a.BlendMode.DstIn;break;case "source-out":this.ee=a.BlendMode.SrcOut;break;case "destination-out":this.ee=a.BlendMode.DstOut;break;case "source-atop":this.ee=a.BlendMode.SrcATop;break;case "destination-atop":this.ee=
|
|
8069
|
+
a.BlendMode.DstATop;break;case "xor":this.ee=a.BlendMode.Xor;break;case "lighter":this.ee=a.BlendMode.Plus;break;case "plus-lighter":this.ee=a.BlendMode.Plus;break;case "plus-darker":throw "plus-darker is not supported";case "multiply":this.ee=a.BlendMode.Multiply;break;case "screen":this.ee=a.BlendMode.Screen;break;case "overlay":this.ee=a.BlendMode.Overlay;break;case "darken":this.ee=a.BlendMode.Darken;break;case "lighten":this.ee=a.BlendMode.Lighten;break;case "color-dodge":this.ee=a.BlendMode.ColorDodge;
|
|
8070
|
+
break;case "color-burn":this.ee=a.BlendMode.ColorBurn;break;case "hard-light":this.ee=a.BlendMode.HardLight;break;case "soft-light":this.ee=a.BlendMode.SoftLight;break;case "difference":this.ee=a.BlendMode.Difference;break;case "exclusion":this.ee=a.BlendMode.Exclusion;break;case "hue":this.ee=a.BlendMode.Hue;break;case "saturation":this.ee=a.BlendMode.Saturation;break;case "color":this.ee=a.BlendMode.Color;break;case "luminosity":this.ee=a.BlendMode.Luminosity;break;default:return}this.fe.setBlendMode(this.ee);}});
|
|
8071
|
+
Object.defineProperty(this,"imageSmoothingEnabled",{enumerable:true,get:function(){return true},set:function(){}});Object.defineProperty(this,"imageSmoothingQuality",{enumerable:true,get:function(){return "high"},set:function(){}});Object.defineProperty(this,"lineCap",{enumerable:true,get:function(){switch(this.fe.getStrokeCap()){case a.StrokeCap.Butt:return "butt";case a.StrokeCap.Round:return "round";case a.StrokeCap.Square:return "square"}},set:function(k){switch(k){case "butt":this.fe.setStrokeCap(a.StrokeCap.Butt);
|
|
8072
|
+
break;case "round":this.fe.setStrokeCap(a.StrokeCap.Round);break;case "square":this.fe.setStrokeCap(a.StrokeCap.Square);}}});Object.defineProperty(this,"lineDashOffset",{enumerable:true,get:function(){return this.$e},set:function(k){isFinite(k)&&(this.$e=k);}});Object.defineProperty(this,"lineJoin",{enumerable:true,get:function(){switch(this.fe.getStrokeJoin()){case a.StrokeJoin.Miter:return "miter";case a.StrokeJoin.Round:return "round";case a.StrokeJoin.Bevel:return "bevel"}},set:function(k){switch(k){case "miter":this.fe.setStrokeJoin(a.StrokeJoin.Miter);
|
|
8073
|
+
break;case "round":this.fe.setStrokeJoin(a.StrokeJoin.Round);break;case "bevel":this.fe.setStrokeJoin(a.StrokeJoin.Bevel);}}});Object.defineProperty(this,"lineWidth",{enumerable:true,get:function(){return this.fe.getStrokeWidth()},set:function(k){0>=k||!k||(this.bf=k,this.fe.setStrokeWidth(k));}});Object.defineProperty(this,"miterLimit",{enumerable:true,get:function(){return this.fe.getStrokeMiter()},set:function(k){0>=k||!k||this.fe.setStrokeMiter(k);}});Object.defineProperty(this,"shadowBlur",{enumerable:true,
|
|
8074
|
+
get:function(){return this.Oe},set:function(k){0>k||!isFinite(k)||(this.Oe=k);}});Object.defineProperty(this,"shadowColor",{enumerable:true,get:function(){return d(this.af)},set:function(k){this.af=g(k);}});Object.defineProperty(this,"shadowOffsetX",{enumerable:true,get:function(){return this.Pe},set:function(k){isFinite(k)&&(this.Pe=k);}});Object.defineProperty(this,"shadowOffsetY",{enumerable:true,get:function(){return this.Qe},set:function(k){isFinite(k)&&(this.Qe=k);}});Object.defineProperty(this,"strokeStyle",
|
|
8075
|
+
{enumerable:true,get:function(){return d(this.ye)},set:function(k){"string"===typeof k?this.ye=g(k):k.Me&&(this.ye=k);}});this.arc=function(k,q,z,A,F,H){D(this.he,k,q,z,z,0,A,F,H);};this.arcTo=function(k,q,z,A,F){Y(this.he,k,q,z,A,F);};this.beginPath=function(){this.he.delete();this.he=new a.Path;};this.bezierCurveTo=function(k,q,z,A,F,H){var N=this.he;e([k,q,z,A,F,H])&&(N.isEmpty()&&N.moveTo(k,q),N.cubicTo(k,q,z,A,F,H));};this.clearRect=function(k,q,z,A){this.fe.setStyle(a.PaintStyle.Fill);this.fe.setBlendMode(a.BlendMode.Clear);
|
|
8076
|
+
this.ce.drawRect(a.XYWHRect(k,q,z,A),this.fe);this.fe.setBlendMode(this.ee);};this.clip=function(k,q){"string"===typeof k?(q=k,k=this.he):k&&k.vf&&(k=k.le);k||(k=this.he);k=k.copy();q&&"evenodd"===q.toLowerCase()?k.setFillType(a.FillType.EvenOdd):k.setFillType(a.FillType.Winding);this.ce.clipPath(k,a.ClipOp.Intersect,true);k.delete();};this.closePath=function(){ba(this.he);};this.createImageData=function(){if(1===arguments.length){var k=arguments[0];return new O(new Uint8ClampedArray(4*k.width*k.height),
|
|
8077
|
+
k.width,k.height)}if(2===arguments.length){k=arguments[0];var q=arguments[1];return new O(new Uint8ClampedArray(4*k*q),k,q)}throw "createImageData expects 1 or 2 arguments, got "+arguments.length;};this.createLinearGradient=function(k,q,z,A){if(e(arguments)){var F=new P(k,q,z,A);this.Ue.push(F);return F}};this.createPattern=function(k,q){k=new la(k,q);this.Ue.push(k);return k};this.createRadialGradient=function(k,q,z,A,F,H){if(e(arguments)){var N=new ta(k,q,z,A,F,H);this.Ue.push(N);return N}};this.drawImage=
|
|
8078
|
+
function(k){k instanceof K&&(k=k.Lf());var q=this.jf();if(3===arguments.length||5===arguments.length)var z=a.XYWHRect(arguments[1],arguments[2],arguments[3]||k.width(),arguments[4]||k.height()),A=a.XYWHRect(0,0,k.width(),k.height());else if(9===arguments.length)z=a.XYWHRect(arguments[5],arguments[6],arguments[7],arguments[8]),A=a.XYWHRect(arguments[1],arguments[2],arguments[3],arguments[4]);else throw "invalid number of args for drawImage, need 3, 5, or 9; got "+arguments.length;this.ce.drawImageRect(k,
|
|
8079
|
+
A,z,q,false);q.dispose();};this.ellipse=function(k,q,z,A,F,H,N,V){D(this.he,k,q,z,A,F,H,N,V);};this.jf=function(){var k=this.fe.copy();k.setStyle(a.PaintStyle.Fill);if(f(this.se)){var q=a.multiplyByAlpha(this.se,this.Be);k.setColor(q);}else q=this.se.Me(this.je),k.setColor(a.Color(0,0,0,this.Be)),k.setShader(q);k.dispose=function(){this.delete();};return k};this.fill=function(k,q){"string"===typeof k?(q=k,k=this.he):k&&k.vf&&(k=k.le);if("evenodd"===q)this.he.setFillType(a.FillType.EvenOdd);else {if("nonzero"!==
|
|
8080
|
+
q&&q)throw "invalid fill rule";this.he.setFillType(a.FillType.Winding);}k||(k=this.he);q=this.jf();var z=this.Re(q);z&&(this.ce.save(),this.Ke(),this.ce.drawPath(k,z),this.ce.restore(),z.dispose());this.ce.drawPath(k,q);q.dispose();};this.fillRect=function(k,q,z,A){var F=this.jf(),H=this.Re(F);H&&(this.ce.save(),this.Ke(),this.ce.drawRect(a.XYWHRect(k,q,z,A),H),this.ce.restore(),H.dispose());this.ce.drawRect(a.XYWHRect(k,q,z,A),F);F.dispose();};this.fillText=function(k,q,z){var A=this.jf();k=a.TextBlob.MakeFromText(k,
|
|
8081
|
+
this.Fe);var F=this.Re(A);F&&(this.ce.save(),this.Ke(),this.ce.drawTextBlob(k,q,z,F),this.ce.restore(),F.dispose());this.ce.drawTextBlob(k,q,z,A);k.delete();A.dispose();};this.getImageData=function(k,q,z,A){return (k=this.ce.readPixels(k,q,{width:z,height:A,colorType:a.ColorType.RGBA_8888,alphaType:a.AlphaType.Unpremul,colorSpace:a.ColorSpace.SRGB}))?new O(new Uint8ClampedArray(k.buffer),z,A):null};this.getLineDash=function(){return this.Ne.slice()};this.Gf=function(k){var q=a.Matrix.invert(this.je);
|
|
8082
|
+
a.Matrix.mapPoints(q,k);return k};this.isPointInPath=function(k,q,z){var A=arguments;if(3===A.length)var F=this.he;else if(4===A.length)F=A[0],k=A[1],q=A[2],z=A[3];else throw "invalid arg count, need 3 or 4, got "+A.length;if(!isFinite(k)||!isFinite(q))return false;z=z||"nonzero";if("nonzero"!==z&&"evenodd"!==z)return false;A=this.Gf([k,q]);k=A[0];q=A[1];F.setFillType("nonzero"===z?a.FillType.Winding:a.FillType.EvenOdd);return F.contains(k,q)};this.isPointInStroke=function(k,q){var z=arguments;if(2===z.length)var A=
|
|
8083
|
+
this.he;else if(3===z.length)A=z[0],k=z[1],q=z[2];else throw "invalid arg count, need 2 or 3, got "+z.length;if(!isFinite(k)||!isFinite(q))return false;z=this.Gf([k,q]);k=z[0];q=z[1];A=A.copy();A.setFillType(a.FillType.Winding);A.stroke({width:this.lineWidth,miter_limit:this.miterLimit,cap:this.fe.getStrokeCap(),join:this.fe.getStrokeJoin(),precision:.3});z=A.contains(k,q);A.delete();return z};this.lineTo=function(k,q){U(this.he,k,q);};this.measureText=function(k){k=this.Fe.getGlyphIDs(k);k=this.Fe.getGlyphWidths(k);
|
|
8084
|
+
let q=0;for(const z of k)q+=z;return {width:q}};this.moveTo=function(k,q){var z=this.he;e([k,q])&&z.moveTo(k,q);};this.putImageData=function(k,q,z,A,F,H,N){if(e([q,z,A,F,H,N]))if(void 0===A)this.ce.writePixels(k.data,k.width,k.height,q,z);else if(A=A||0,F=F||0,H=H||k.width,N=N||k.height,0>H&&(A+=H,H=Math.abs(H)),0>N&&(F+=N,N=Math.abs(N)),0>A&&(H+=A,A=0),0>F&&(N+=F,F=0),!(0>=H||0>=N)){k=a.MakeImage({width:k.width,height:k.height,alphaType:a.AlphaType.Unpremul,colorType:a.ColorType.RGBA_8888,colorSpace:a.ColorSpace.SRGB},
|
|
8085
|
+
k.data,4*k.width);var V=a.XYWHRect(A,F,H,N);q=a.XYWHRect(q+A,z+F,H,N);z=a.Matrix.invert(this.je);this.ce.save();this.ce.concat(z);this.ce.drawImageRect(k,V,q,null,false);this.ce.restore();k.delete();}};this.quadraticCurveTo=function(k,q,z,A){var F=this.he;e([k,q,z,A])&&(F.isEmpty()&&F.moveTo(k,q),F.quadTo(k,q,z,A));};this.rect=function(k,q,z,A){var F=this.he;k=a.XYWHRect(k,q,z,A);e(k)&&F.addRect(k);};this.resetTransform=function(){this.he.transform(this.je);var k=a.Matrix.invert(this.je);this.ce.concat(k);
|
|
8086
|
+
this.je=this.ce.getTotalMatrix();};this.restore=function(){var k=this.Ff.pop();if(k){var q=a.Matrix.multiply(this.je,a.Matrix.invert(k.ag));this.he.transform(q);this.fe.delete();this.fe=k.sg;this.Ne=k.qg;this.bf=k.Eg;this.ye=k.Dg;this.se=k.fs;this.Pe=k.Bg;this.Qe=k.Cg;this.Oe=k.sb;this.af=k.Ag;this.Be=k.ga;this.ee=k.hg;this.$e=k.rg;this.kf=k.gg;this.ce.restore();this.je=this.ce.getTotalMatrix();}};this.rotate=function(k){if(isFinite(k)){var q=a.Matrix.rotated(-k);this.he.transform(q);this.ce.rotate(k/
|
|
8087
|
+
Math.PI*180,0,0);this.je=this.ce.getTotalMatrix();}};this.save=function(){if(this.se.Le){var k=this.se.Le();this.Ue.push(k);}else k=this.se;if(this.ye.Le){var q=this.ye.Le();this.Ue.push(q);}else q=this.ye;this.Ff.push({ag:this.je.slice(),qg:this.Ne.slice(),Eg:this.bf,Dg:q,fs:k,Bg:this.Pe,Cg:this.Qe,sb:this.Oe,Ag:this.af,ga:this.Be,rg:this.$e,hg:this.ee,sg:this.fe.copy(),gg:this.kf});this.ce.save();};this.scale=function(k,q){if(e(arguments)){var z=a.Matrix.scaled(1/k,1/q);this.he.transform(z);this.ce.scale(k,
|
|
8088
|
+
q);this.je=this.ce.getTotalMatrix();}};this.setLineDash=function(k){for(var q=0;q<k.length;q++)if(!isFinite(k[q])||0>k[q])return;1===k.length%2&&Array.prototype.push.apply(k,k);this.Ne=k;};this.setTransform=function(k,q,z,A,F,H){e(arguments)&&(this.resetTransform(),this.transform(k,q,z,A,F,H));};this.Ke=function(){var k=a.Matrix.invert(this.je);this.ce.concat(k);this.ce.concat(a.Matrix.translated(this.Pe,this.Qe));this.ce.concat(this.je);};this.Re=function(k){var q=a.multiplyByAlpha(this.af,this.Be);
|
|
8089
|
+
if(!a.getColorComponents(q)[3]||!(this.Oe||this.Qe||this.Pe))return null;k=k.copy();k.setColor(q);var z=a.MaskFilter.MakeBlur(a.BlurStyle.Normal,this.Oe/2,false);k.setMaskFilter(z);k.dispose=function(){z.delete();this.delete();};return k};this.xf=function(){var k=this.fe.copy();k.setStyle(a.PaintStyle.Stroke);if(f(this.ye)){var q=a.multiplyByAlpha(this.ye,this.Be);k.setColor(q);}else q=this.ye.Me(this.je),k.setColor(a.Color(0,0,0,this.Be)),k.setShader(q);k.setStrokeWidth(this.bf);if(this.Ne.length){var z=
|
|
8090
|
+
a.PathEffect.MakeDash(this.Ne,this.$e);k.setPathEffect(z);}k.dispose=function(){z&&z.delete();this.delete();};return k};this.stroke=function(k){k=k?k.le:this.he;var q=this.xf(),z=this.Re(q);z&&(this.ce.save(),this.Ke(),this.ce.drawPath(k,z),this.ce.restore(),z.dispose());this.ce.drawPath(k,q);q.dispose();};this.strokeRect=function(k,q,z,A){var F=this.xf(),H=this.Re(F);H&&(this.ce.save(),this.Ke(),this.ce.drawRect(a.XYWHRect(k,q,z,A),H),this.ce.restore(),H.dispose());this.ce.drawRect(a.XYWHRect(k,q,z,
|
|
8091
|
+
A),F);F.dispose();};this.strokeText=function(k,q,z){var A=this.xf();k=a.TextBlob.MakeFromText(k,this.Fe);var F=this.Re(A);F&&(this.ce.save(),this.Ke(),this.ce.drawTextBlob(k,q,z,F),this.ce.restore(),F.dispose());this.ce.drawTextBlob(k,q,z,A);k.delete();A.dispose();};this.translate=function(k,q){if(e(arguments)){var z=a.Matrix.translated(-k,-q);this.he.transform(z);this.ce.translate(k,q);this.je=this.ce.getTotalMatrix();}};this.transform=function(k,q,z,A,F,H){k=[k,z,F,q,A,H,0,0,1];q=a.Matrix.invert(k);
|
|
8092
|
+
this.he.transform(q);this.ce.concat(k);this.je=this.ce.getTotalMatrix();};this.addHitRegion=function(){};this.clearHitRegions=function(){};this.drawFocusIfNeeded=function(){};this.removeHitRegion=function(){};this.scrollPathIntoView=function(){};Object.defineProperty(this,"canvas",{value:null,writable:false});}function C(I){this.yf=I;this.be=new x(I.getCanvas());this.lf=[];this.decodeImage=function(k){k=a.MakeImageFromEncoded(k);if(!k)throw "Invalid input";this.lf.push(k);return new K(k)};this.loadFont=
|
|
8093
|
+
function(k,q){k=a.Typeface.MakeTypefaceFromData(k);if(!k)return null;this.lf.push(k);var z=(q.style||"normal")+"|"+(q.variant||"normal")+"|"+(q.weight||"normal");q=q.family;t();fa[q]||(fa[q]={"*":k});fa[q][z]=k;};this.makePath2D=function(k){k=new ea(k);this.lf.push(k.le);return k};this.getContext=function(k){return "2d"===k?this.be:null};this.toDataURL=function(k,q){this.yf.flush();var z=this.yf.makeImageSnapshot();if(z){k=k||"image/png";var A=a.ImageFormat.PNG;"image/jpeg"===k&&(A=a.ImageFormat.JPEG);
|
|
8094
|
+
if(q=z.encodeToBytes(A,q||.92)){z.delete();k="data:"+k+";base64,";if("undefined"!==typeof Buffer)q=Buffer.from(q).toString("base64");else {z=0;A=q.length;for(var F="",H;z<A;)H=q.slice(z,Math.min(z+32768,A)),F+=String.fromCharCode.apply(null,H),z+=32768;q=btoa(F);}return k+q}}};this.dispose=function(){this.be.Ee();this.lf.forEach(function(k){k.delete();});this.yf.dispose();};}function K(I){this.width=I.width();this.height=I.height();this.naturalWidth=this.width;this.naturalHeight=this.height;this.Lf=function(){return I};}
|
|
8095
|
+
function O(I,k,q){if(!k||0===q)throw new TypeError("invalid dimensions, width and height must be non-zero");if(I.length%4)throw new TypeError("arr must be a multiple of 4");q=q||I.length/(4*k);Object.defineProperty(this,"data",{value:I,writable:false});Object.defineProperty(this,"height",{value:q,writable:false});Object.defineProperty(this,"width",{value:k,writable:false});}function P(I,k,q,z){this.ne=null;this.ue=[];this.qe=[];this.addColorStop=function(A,F){if(0>A||1<A||!isFinite(A))throw "offset must be between 0 and 1 inclusively";
|
|
8096
|
+
F=g(F);var H=this.qe.indexOf(A);if(-1!==H)this.ue[H]=F;else {for(H=0;H<this.qe.length&&!(this.qe[H]>A);H++);this.qe.splice(H,0,A);this.ue.splice(H,0,F);}};this.Le=function(){var A=new P(I,k,q,z);A.ue=this.ue.slice();A.qe=this.qe.slice();return A};this.Ee=function(){this.ne&&(this.ne.delete(),this.ne=null);};this.Me=function(A){var F=[I,k,q,z];a.Matrix.mapPoints(A,F);A=F[0];var H=F[1],N=F[2];F=F[3];this.Ee();return this.ne=a.Shader.MakeLinearGradient([A,H],[N,F],this.ue,this.qe,a.TileMode.Clamp)};}function Y(I,
|
|
8097
|
+
k,q,z,A,F){if(e([k,q,z,A,F])){if(0>F)throw "radii cannot be negative";I.isEmpty()&&I.moveTo(k,q);I.arcToTangent(k,q,z,A,F);}}function ba(I){if(!I.isEmpty()){var k=I.getBounds();(k[3]-k[1]||k[2]-k[0])&&I.close();}}function r(I,k,q,z,A,F,H){H=(H-F)/Math.PI*180;F=F/Math.PI*180;k=a.LTRBRect(k-z,q-A,k+z,q+A);1E-5>Math.abs(Math.abs(H)-360)?(q=H/2,I.arcToOval(k,F,q,false),I.arcToOval(k,F+q,q,false)):I.arcToOval(k,F,H,false);}function D(I,k,q,z,A,F,H,N,V){if(e([k,q,z,A,F,H,N])){if(0>z||0>A)throw "radii cannot be negative";
|
|
8098
|
+
var qa=2*Math.PI,cb=H%qa;0>cb&&(cb+=qa);var db=cb-H;H=cb;N+=db;!V&&N-H>=qa?N=H+qa:V&&H-N>=qa?N=H-qa:!V&&H>N?N=H+(qa-(H-N)%qa):V&&H<N&&(N=H-(qa-(N-H)%qa));F?(V=a.Matrix.rotated(F,k,q),F=a.Matrix.rotated(-F,k,q),I.transform(F),r(I,k,q,z,A,H,N),I.transform(V)):r(I,k,q,z,A,H,N);}}function U(I,k,q){e([k,q])&&(I.isEmpty()&&I.moveTo(k,q),I.lineTo(k,q));}function ea(I){this.le=null;this.le="string"===typeof I?a.Path.MakeFromSVGString(I):I&&I.vf?I.le.copy():new a.Path;this.vf=function(){return this.le};this.addPath=
|
|
8099
|
+
function(k,q){q||(q={a:1,c:0,e:0,b:0,d:1,f:0});this.le.addPath(k.le,[q.a,q.c,q.e,q.b,q.d,q.f]);};this.arc=function(k,q,z,A,F,H){D(this.le,k,q,z,z,0,A,F,H);};this.arcTo=function(k,q,z,A,F){Y(this.le,k,q,z,A,F);};this.bezierCurveTo=function(k,q,z,A,F,H){var N=this.le;e([k,q,z,A,F,H])&&(N.isEmpty()&&N.moveTo(k,q),N.cubicTo(k,q,z,A,F,H));};this.closePath=function(){ba(this.le);};this.ellipse=function(k,q,z,A,F,H,N,V){D(this.le,k,q,z,A,F,H,N,V);};this.lineTo=function(k,q){U(this.le,k,q);};this.moveTo=function(k,
|
|
8100
|
+
q){var z=this.le;e([k,q])&&z.moveTo(k,q);};this.quadraticCurveTo=function(k,q,z,A){var F=this.le;e([k,q,z,A])&&(F.isEmpty()&&F.moveTo(k,q),F.quadTo(k,q,z,A));};this.rect=function(k,q,z,A){var F=this.le;k=a.XYWHRect(k,q,z,A);e(k)&&F.addRect(k);};}function la(I,k){this.ne=null;I instanceof K&&(I=I.Lf());this.Uf=I;this._transform=a.Matrix.identity();""===k&&(k="repeat");switch(k){case "repeat-x":this.Se=a.TileMode.Repeat;this.Te=a.TileMode.Decal;break;case "repeat-y":this.Se=a.TileMode.Decal;this.Te=a.TileMode.Repeat;
|
|
8101
|
+
break;case "repeat":this.Te=this.Se=a.TileMode.Repeat;break;case "no-repeat":this.Te=this.Se=a.TileMode.Decal;break;default:throw "invalid repetition mode "+k;}this.setTransform=function(q){q=[q.a,q.c,q.e,q.b,q.d,q.f,0,0,1];e(q)&&(this._transform=q);};this.Le=function(){var q=new la;q.Se=this.Se;q.Te=this.Te;return q};this.Ee=function(){this.ne&&(this.ne.delete(),this.ne=null);};this.Me=function(){this.Ee();return this.ne=this.Uf.makeShaderCubic(this.Se,this.Te,1/3,1/3,this._transform)};}function ta(I,
|
|
8102
|
+
k,q,z,A,F){this.ne=null;this.ue=[];this.qe=[];this.addColorStop=function(H,N){if(0>H||1<H||!isFinite(H))throw "offset must be between 0 and 1 inclusively";N=g(N);var V=this.qe.indexOf(H);if(-1!==V)this.ue[V]=N;else {for(V=0;V<this.qe.length&&!(this.qe[V]>H);V++);this.qe.splice(V,0,H);this.ue.splice(V,0,N);}};this.Le=function(){var H=new ta(I,k,q,z,A,F);H.ue=this.ue.slice();H.qe=this.qe.slice();return H};this.Ee=function(){this.ne&&(this.ne.delete(),this.ne=null);};this.Me=function(H){var N=[I,k,z,A];
|
|
8103
|
+
a.Matrix.mapPoints(H,N);var V=N[0],qa=N[1],cb=N[2];N=N[3];var db=(Math.abs(H[0])+Math.abs(H[4]))/2;H=q*db;db*=F;this.Ee();return this.ne=a.Shader.MakeTwoPointConicalGradient([V,qa],H,[cb,N],db,this.ue,this.qe,a.TileMode.Clamp)};}a._testing={};var xa={aliceblue:Float32Array.of(.941,.973,1,1),antiquewhite:Float32Array.of(.98,.922,.843,1),aqua:Float32Array.of(0,1,1,1),aquamarine:Float32Array.of(.498,1,.831,1),azure:Float32Array.of(.941,1,1,1),beige:Float32Array.of(.961,.961,.863,1),bisque:Float32Array.of(1,
|
|
8104
|
+
.894,.769,1),black:Float32Array.of(0,0,0,1),blanchedalmond:Float32Array.of(1,.922,.804,1),blue:Float32Array.of(0,0,1,1),blueviolet:Float32Array.of(.541,.169,.886,1),brown:Float32Array.of(.647,.165,.165,1),burlywood:Float32Array.of(.871,.722,.529,1),cadetblue:Float32Array.of(.373,.62,.627,1),chartreuse:Float32Array.of(.498,1,0,1),chocolate:Float32Array.of(.824,.412,.118,1),coral:Float32Array.of(1,.498,.314,1),cornflowerblue:Float32Array.of(.392,.584,.929,1),cornsilk:Float32Array.of(1,.973,.863,1),
|
|
8105
|
+
crimson:Float32Array.of(.863,.078,.235,1),cyan:Float32Array.of(0,1,1,1),darkblue:Float32Array.of(0,0,.545,1),darkcyan:Float32Array.of(0,.545,.545,1),darkgoldenrod:Float32Array.of(.722,.525,.043,1),darkgray:Float32Array.of(.663,.663,.663,1),darkgreen:Float32Array.of(0,.392,0,1),darkgrey:Float32Array.of(.663,.663,.663,1),darkkhaki:Float32Array.of(.741,.718,.42,1),darkmagenta:Float32Array.of(.545,0,.545,1),darkolivegreen:Float32Array.of(.333,.42,.184,1),darkorange:Float32Array.of(1,.549,0,1),darkorchid:Float32Array.of(.6,
|
|
8106
|
+
.196,.8,1),darkred:Float32Array.of(.545,0,0,1),darksalmon:Float32Array.of(.914,.588,.478,1),darkseagreen:Float32Array.of(.561,.737,.561,1),darkslateblue:Float32Array.of(.282,.239,.545,1),darkslategray:Float32Array.of(.184,.31,.31,1),darkslategrey:Float32Array.of(.184,.31,.31,1),darkturquoise:Float32Array.of(0,.808,.82,1),darkviolet:Float32Array.of(.58,0,.827,1),deeppink:Float32Array.of(1,.078,.576,1),deepskyblue:Float32Array.of(0,.749,1,1),dimgray:Float32Array.of(.412,.412,.412,1),dimgrey:Float32Array.of(.412,
|
|
8107
|
+
.412,.412,1),dodgerblue:Float32Array.of(.118,.565,1,1),firebrick:Float32Array.of(.698,.133,.133,1),floralwhite:Float32Array.of(1,.98,.941,1),forestgreen:Float32Array.of(.133,.545,.133,1),fuchsia:Float32Array.of(1,0,1,1),gainsboro:Float32Array.of(.863,.863,.863,1),ghostwhite:Float32Array.of(.973,.973,1,1),gold:Float32Array.of(1,.843,0,1),goldenrod:Float32Array.of(.855,.647,.125,1),gray:Float32Array.of(.502,.502,.502,1),green:Float32Array.of(0,.502,0,1),greenyellow:Float32Array.of(.678,1,.184,1),grey:Float32Array.of(.502,
|
|
8108
|
+
.502,.502,1),honeydew:Float32Array.of(.941,1,.941,1),hotpink:Float32Array.of(1,.412,.706,1),indianred:Float32Array.of(.804,.361,.361,1),indigo:Float32Array.of(.294,0,.51,1),ivory:Float32Array.of(1,1,.941,1),khaki:Float32Array.of(.941,.902,.549,1),lavender:Float32Array.of(.902,.902,.98,1),lavenderblush:Float32Array.of(1,.941,.961,1),lawngreen:Float32Array.of(.486,.988,0,1),lemonchiffon:Float32Array.of(1,.98,.804,1),lightblue:Float32Array.of(.678,.847,.902,1),lightcoral:Float32Array.of(.941,.502,.502,
|
|
8109
|
+
1),lightcyan:Float32Array.of(.878,1,1,1),lightgoldenrodyellow:Float32Array.of(.98,.98,.824,1),lightgray:Float32Array.of(.827,.827,.827,1),lightgreen:Float32Array.of(.565,.933,.565,1),lightgrey:Float32Array.of(.827,.827,.827,1),lightpink:Float32Array.of(1,.714,.757,1),lightsalmon:Float32Array.of(1,.627,.478,1),lightseagreen:Float32Array.of(.125,.698,.667,1),lightskyblue:Float32Array.of(.529,.808,.98,1),lightslategray:Float32Array.of(.467,.533,.6,1),lightslategrey:Float32Array.of(.467,.533,.6,1),lightsteelblue:Float32Array.of(.69,
|
|
8110
|
+
.769,.871,1),lightyellow:Float32Array.of(1,1,.878,1),lime:Float32Array.of(0,1,0,1),limegreen:Float32Array.of(.196,.804,.196,1),linen:Float32Array.of(.98,.941,.902,1),magenta:Float32Array.of(1,0,1,1),maroon:Float32Array.of(.502,0,0,1),mediumaquamarine:Float32Array.of(.4,.804,.667,1),mediumblue:Float32Array.of(0,0,.804,1),mediumorchid:Float32Array.of(.729,.333,.827,1),mediumpurple:Float32Array.of(.576,.439,.859,1),mediumseagreen:Float32Array.of(.235,.702,.443,1),mediumslateblue:Float32Array.of(.482,
|
|
8111
|
+
.408,.933,1),mediumspringgreen:Float32Array.of(0,.98,.604,1),mediumturquoise:Float32Array.of(.282,.82,.8,1),mediumvioletred:Float32Array.of(.78,.082,.522,1),midnightblue:Float32Array.of(.098,.098,.439,1),mintcream:Float32Array.of(.961,1,.98,1),mistyrose:Float32Array.of(1,.894,.882,1),moccasin:Float32Array.of(1,.894,.71,1),navajowhite:Float32Array.of(1,.871,.678,1),navy:Float32Array.of(0,0,.502,1),oldlace:Float32Array.of(.992,.961,.902,1),olive:Float32Array.of(.502,.502,0,1),olivedrab:Float32Array.of(.42,
|
|
8112
|
+
.557,.137,1),orange:Float32Array.of(1,.647,0,1),orangered:Float32Array.of(1,.271,0,1),orchid:Float32Array.of(.855,.439,.839,1),palegoldenrod:Float32Array.of(.933,.91,.667,1),palegreen:Float32Array.of(.596,.984,.596,1),paleturquoise:Float32Array.of(.686,.933,.933,1),palevioletred:Float32Array.of(.859,.439,.576,1),papayawhip:Float32Array.of(1,.937,.835,1),peachpuff:Float32Array.of(1,.855,.725,1),peru:Float32Array.of(.804,.522,.247,1),pink:Float32Array.of(1,.753,.796,1),plum:Float32Array.of(.867,.627,
|
|
8113
|
+
.867,1),powderblue:Float32Array.of(.69,.878,.902,1),purple:Float32Array.of(.502,0,.502,1),rebeccapurple:Float32Array.of(.4,.2,.6,1),red:Float32Array.of(1,0,0,1),rosybrown:Float32Array.of(.737,.561,.561,1),royalblue:Float32Array.of(.255,.412,.882,1),saddlebrown:Float32Array.of(.545,.271,.075,1),salmon:Float32Array.of(.98,.502,.447,1),sandybrown:Float32Array.of(.957,.643,.376,1),seagreen:Float32Array.of(.18,.545,.341,1),seashell:Float32Array.of(1,.961,.933,1),sienna:Float32Array.of(.627,.322,.176,1),
|
|
8114
|
+
silver:Float32Array.of(.753,.753,.753,1),skyblue:Float32Array.of(.529,.808,.922,1),slateblue:Float32Array.of(.416,.353,.804,1),slategray:Float32Array.of(.439,.502,.565,1),slategrey:Float32Array.of(.439,.502,.565,1),snow:Float32Array.of(1,.98,.98,1),springgreen:Float32Array.of(0,1,.498,1),steelblue:Float32Array.of(.275,.51,.706,1),tan:Float32Array.of(.824,.706,.549,1),teal:Float32Array.of(0,.502,.502,1),thistle:Float32Array.of(.847,.749,.847,1),tomato:Float32Array.of(1,.388,.278,1),transparent:Float32Array.of(0,
|
|
8115
|
+
0,0,0),turquoise:Float32Array.of(.251,.878,.816,1),violet:Float32Array.of(.933,.51,.933,1),wheat:Float32Array.of(.961,.871,.702,1),white:Float32Array.of(1,1,1,1),whitesmoke:Float32Array.of(.961,.961,.961,1),yellow:Float32Array.of(1,1,0,1),yellowgreen:Float32Array.of(.604,.804,.196,1)};a._testing.parseColor=g;a._testing.colorToString=d;var Da=RegExp("(italic|oblique|normal|)\\s*(small-caps|normal|)\\s*(bold|bolder|lighter|[1-9]00|normal|)\\s*([\\d\\.]+)(px|pt|pc|in|cm|mm|%|em|ex|ch|rem|q)(.+)"),fa;
|
|
8116
|
+
a._testing.parseFontString=l;a.MakeCanvas=function(I,k){return (I=a.MakeSurface(I,k))?new C(I):null};a.ImageData=function(){if(2===arguments.length){var I=arguments[0],k=arguments[1];return new O(new Uint8ClampedArray(4*I*k),I,k)}if(3===arguments.length){var q=arguments[0];if(q.prototype.constructor!==Uint8ClampedArray)throw new TypeError("bytes must be given as a Uint8ClampedArray");I=arguments[1];k=arguments[2];if(q%4)throw new TypeError("bytes must be given in a multiple of 4");if(q%I)throw new TypeError("bytes must divide evenly by width");
|
|
8117
|
+
if(k&&k!==q/(4*I))throw new TypeError("invalid height given");return new O(q,I,q/(4*I))}throw new TypeError("invalid number of arguments - takes 2 or 3, saw "+arguments.length);};})();})(w);var ra=Object.assign({},w),ua="./this.program",va=(a,b)=>{throw b;},wa="object"==typeof window,ya="function"==typeof importScripts,za="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,Aa="",Ba,Ea,Fa;
|
|
8118
|
+
if(za){var fs=require$$0,Ga=require$$1;Aa=ya?Ga.dirname(Aa)+"/":__dirname+"/";Ba=(a,b)=>{a=a.startsWith("file://")?new URL(a):Ga.normalize(a);return fs.readFileSync(a,b?void 0:"utf8")};Fa=a=>{a=Ba(a,true);a.buffer||(a=new Uint8Array(a));return a};Ea=(a,b,c,f=true)=>{a=a.startsWith("file://")?new URL(a):Ga.normalize(a);fs.readFile(a,f?void 0:"utf8",(h,m)=>{h?c(h):b(f?m.buffer:m);});};!w.thisProgram&&1<process.argv.length&&(ua=process.argv[1].replace(/\\/g,"/"));process.argv.slice(2);va=(a,b)=>{process.exitCode=
|
|
8119
|
+
a;throw b;};w.inspect=()=>"[Emscripten Module object]";}else if(wa||ya)ya?Aa=self.location.href:"undefined"!=typeof document&&document.currentScript&&(Aa=document.currentScript.src),_scriptDir&&(Aa=_scriptDir),0!==Aa.indexOf("blob:")?Aa=Aa.substr(0,Aa.replace(/[?#].*/,"").lastIndexOf("/")+1):Aa="",Ba=a=>{var b=new XMLHttpRequest;b.open("GET",a,false);b.send(null);return b.responseText},ya&&(Fa=a=>{var b=new XMLHttpRequest;b.open("GET",a,false);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)}),
|
|
8120
|
+
Ea=(a,b,c)=>{var f=new XMLHttpRequest;f.open("GET",a,true);f.responseType="arraybuffer";f.onload=()=>{200==f.status||0==f.status&&f.response?b(f.response):c();};f.onerror=c;f.send(null);};var Ha=w.print||console.log.bind(console),Ia=w.printErr||console.error.bind(console);Object.assign(w,ra);ra=null;w.thisProgram&&(ua=w.thisProgram);w.quit&&(va=w.quit);var Ja;w.wasmBinary&&(Ja=w.wasmBinary);w.noExitRuntime||true;"object"!=typeof WebAssembly&&Ka("no native wasm support detected");
|
|
8121
|
+
var La,Ma,Na=false,Qa,J,Ra,Sa,Q,Ta,R,Ua;function Wa(){var a=La.buffer;w.HEAP8=Qa=new Int8Array(a);w.HEAP16=Ra=new Int16Array(a);w.HEAP32=Q=new Int32Array(a);w.HEAPU8=J=new Uint8Array(a);w.HEAPU16=Sa=new Uint16Array(a);w.HEAPU32=Ta=new Uint32Array(a);w.HEAPF32=R=new Float32Array(a);w.HEAPF64=Ua=new Float64Array(a);}var Xa,Ya=[],Za=[],$a=[];function ab(){var a=w.preRun.shift();Ya.unshift(a);}var eb=0,gb=null;
|
|
8122
|
+
function Ka(a){if(w.onAbort)w.onAbort(a);a="Aborted("+a+")";Ia(a);Na=true;a=new WebAssembly.RuntimeError(a+". Build with -sASSERTIONS for more info.");ca(a);throw a;}function hb(a){return a.startsWith("data:application/octet-stream;base64,")}var mb;mb="canvaskit.wasm";if(!hb(mb)){var nb=mb;mb=w.locateFile?w.locateFile(nb,Aa):Aa+nb;}function ob(a){if(a==mb&&Ja)return new Uint8Array(Ja);if(Fa)return Fa(a);throw "both async and sync fetching of the wasm failed";}
|
|
8123
|
+
function pb(a){if(!Ja&&(wa||ya)){if("function"==typeof fetch&&!a.startsWith("file://"))return fetch(a,{credentials:"same-origin"}).then(b=>{if(!b.ok)throw "failed to load wasm binary file at '"+a+"'";return b.arrayBuffer()}).catch(()=>ob(a));if(Ea)return new Promise((b,c)=>{Ea(a,f=>b(new Uint8Array(f)),c);})}return Promise.resolve().then(()=>ob(a))}function qb(a,b,c){return pb(a).then(f=>WebAssembly.instantiate(f,b)).then(f=>f).then(c,f=>{Ia("failed to asynchronously prepare wasm: "+f);Ka(f);})}
|
|
8124
|
+
function rb(a,b){var c=mb;return Ja||"function"!=typeof WebAssembly.instantiateStreaming||hb(c)||c.startsWith("file://")||za||"function"!=typeof fetch?qb(c,a,b):fetch(c,{credentials:"same-origin"}).then(f=>WebAssembly.instantiateStreaming(f,a).then(b,function(h){Ia("wasm streaming compile failed: "+h);Ia("falling back to ArrayBuffer instantiation");return qb(c,a,b)}))}function sb(a){this.name="ExitStatus";this.message=`Program terminated with exit(${a})`;this.status=a;}
|
|
8125
|
+
var tb=a=>{for(;0<a.length;)a.shift()(w);},ub="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,vb=(a,b,c)=>{var f=b+c;for(c=b;a[c]&&!(c>=f);)++c;if(16<c-b&&a.buffer&&ub)return ub.decode(a.subarray(b,c));for(f="";b<c;){var h=a[b++];if(h&128){var m=a[b++]&63;if(192==(h&224))f+=String.fromCharCode((h&31)<<6|m);else {var u=a[b++]&63;h=224==(h&240)?(h&15)<<12|m<<6|u:(h&7)<<18|m<<12|u<<6|a[b++]&63;65536>h?f+=String.fromCharCode(h):(h-=65536,f+=String.fromCharCode(55296|h>>10,56320|h&1023));}}else f+=
|
|
8126
|
+
String.fromCharCode(h);}return f},wb={};function xb(a){for(;a.length;){var b=a.pop();a.pop()(b);}}function yb(a){return this.fromWireType(Q[a>>2])}var zb={},Bb={},Cb={},Db=void 0;function Eb(a){throw new Db(a);}
|
|
8127
|
+
function Fb(a,b,c){function f(n){n=c(n);n.length!==a.length&&Eb("Mismatched type converter count");for(var p=0;p<a.length;++p)Gb(a[p],n[p]);}a.forEach(function(n){Cb[n]=b;});var h=Array(b.length),m=[],u=0;b.forEach((n,p)=>{Bb.hasOwnProperty(n)?h[p]=Bb[n]:(m.push(n),zb.hasOwnProperty(n)||(zb[n]=[]),zb[n].push(()=>{h[p]=Bb[n];++u;u===m.length&&f(h);}));});0===m.length&&f(h);}
|
|
8128
|
+
function Hb(a){switch(a){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError(`Unknown type size: ${a}`);}}var Ib=void 0;function Jb(a){for(var b="";J[a];)b+=Ib[J[a++]];return b}var Kb=void 0;function W(a){throw new Kb(a);}
|
|
8129
|
+
function Lb(a,b,c={}){var f=b.name;a||W(`type "${f}" must have a positive integer typeid pointer`);if(Bb.hasOwnProperty(a)){if(c.ng)return;W(`Cannot register type '${f}' twice`);}Bb[a]=b;delete Cb[a];zb.hasOwnProperty(a)&&(b=zb[a],delete zb[a],b.forEach(h=>h()));}function Gb(a,b,c={}){if(!("argPackAdvance"in b))throw new TypeError("registerType registeredInstance requires argPackAdvance");Lb(a,b,c);}function Mb(a){W(a.ae.me.ge.name+" instance already deleted");}var Nb=false;function Ob(){}
|
|
8130
|
+
function Pb(a){--a.count.value;0===a.count.value&&(a.pe?a.we.De(a.pe):a.me.ge.De(a.ie));}function Qb(a,b,c){if(b===c)return a;if(void 0===c.re)return null;a=Qb(a,b,c.re);return null===a?null:c.dg(a)}var Rb={},Sb=[];function Tb(){for(;Sb.length;){var a=Sb.pop();a.ae.Xe=false;a["delete"]();}}var Ub=void 0,Vb={};function Wb(a,b){for(void 0===b&&W("ptr should not be undefined");a.re;)b=a.gf(b),a=a.re;return Vb[b]}
|
|
8131
|
+
function cc(a,b){b.me&&b.ie||Eb("makeClassHandle requires ptr and ptrType");!!b.we!==!!b.pe&&Eb("Both smartPtrType and smartPtr must be specified");b.count={value:1};return dc(Object.create(a,{ae:{value:b}}))}function dc(a){if("undefined"===typeof FinalizationRegistry)return dc=b=>b,a;Nb=new FinalizationRegistry(b=>{Pb(b.ae);});dc=b=>{var c=b.ae;c.pe&&Nb.register(b,{ae:c},b);return b};Ob=b=>{Nb.unregister(b);};return dc(a)}function ec(){}
|
|
8132
|
+
function fc(a){if(void 0===a)return "_unknown";a=a.replace(/[^a-zA-Z0-9_]/g,"$");var b=a.charCodeAt(0);return 48<=b&&57>=b?`_${a}`:a}function gc(a,b){a=fc(a);return {[a]:function(){return b.apply(this,arguments)}}[a]}
|
|
8133
|
+
function hc(a,b,c){if(void 0===a[b].oe){var f=a[b];a[b]=function(){a[b].oe.hasOwnProperty(arguments.length)||W(`Function '${c}' called with an invalid number of arguments (${arguments.length}) - expects one of (${a[b].oe})!`);return a[b].oe[arguments.length].apply(this,arguments)};a[b].oe=[];a[b].oe[f.Ve]=f;}}
|
|
8134
|
+
function ic(a,b,c){w.hasOwnProperty(a)?((void 0===c||void 0!==w[a].oe&&void 0!==w[a].oe[c])&&W(`Cannot register public name '${a}' twice`),hc(w,a,a),w.hasOwnProperty(c)&&W(`Cannot register multiple overloads of a function with the same number of arguments (${c})!`),w[a].oe[c]=b):(w[a]=b,void 0!==c&&(w[a].Lg=c));}function jc(a,b,c,f,h,m,u,n){this.name=a;this.constructor=b;this.Ye=c;this.De=f;this.re=h;this.ig=m;this.gf=u;this.dg=n;this.ug=[];}
|
|
8135
|
+
function kc(a,b,c){for(;b!==c;)b.gf||W(`Expected null or instance of ${c.name}, got an instance of ${b.name}`),a=b.gf(a),b=b.re;return a}function lc(a,b){if(null===b)return this.Bf&&W(`null is not a valid ${this.name}`),0;b.ae||W(`Cannot pass "${mc(b)}" as a ${this.name}`);b.ae.ie||W(`Cannot pass deleted object as a pointer of type ${this.name}`);return kc(b.ae.ie,b.ae.me.ge,this.ge)}
|
|
8136
|
+
function nc(a,b){if(null===b){this.Bf&&W(`null is not a valid ${this.name}`);if(this.pf){var c=this.Cf();null!==a&&a.push(this.De,c);return c}return 0}b.ae||W(`Cannot pass "${mc(b)}" as a ${this.name}`);b.ae.ie||W(`Cannot pass deleted object as a pointer of type ${this.name}`);!this.nf&&b.ae.me.nf&&W(`Cannot convert argument of type ${b.ae.we?b.ae.we.name:b.ae.me.name} to parameter type ${this.name}`);c=kc(b.ae.ie,b.ae.me.ge,this.ge);if(this.pf)switch(void 0===b.ae.pe&&W("Passing raw pointer to smart pointer is illegal"),
|
|
8137
|
+
this.zg){case 0:b.ae.we===this?c=b.ae.pe:W(`Cannot convert argument of type ${b.ae.we?b.ae.we.name:b.ae.me.name} to parameter type ${this.name}`);break;case 1:c=b.ae.pe;break;case 2:if(b.ae.we===this)c=b.ae.pe;else {var f=b.clone();c=this.vg(c,oc(function(){f["delete"]();}));null!==a&&a.push(this.De,c);}break;default:W("Unsupporting sharing policy");}return c}
|
|
8138
|
+
function pc(a,b){if(null===b)return this.Bf&&W(`null is not a valid ${this.name}`),0;b.ae||W(`Cannot pass "${mc(b)}" as a ${this.name}`);b.ae.ie||W(`Cannot pass deleted object as a pointer of type ${this.name}`);b.ae.me.nf&&W(`Cannot convert argument of type ${b.ae.me.name} to parameter type ${this.name}`);return kc(b.ae.ie,b.ae.me.ge,this.ge)}
|
|
8139
|
+
function qc(a,b,c,f,h,m,u,n,p,v,E){this.name=a;this.ge=b;this.Bf=c;this.nf=f;this.pf=h;this.tg=m;this.zg=u;this.Nf=n;this.Cf=p;this.vg=v;this.De=E;h||void 0!==b.re?this.toWireType=nc:(this.toWireType=f?lc:pc,this.ve=null);}function rc(a,b,c){w.hasOwnProperty(a)||Eb("Replacing nonexistant public symbol");void 0!==w[a].oe&&void 0!==c?w[a].oe[c]=b:(w[a]=b,w[a].Ve=c);}
|
|
8140
|
+
var sc=(a,b)=>{var c=[];return function(){c.length=0;Object.assign(c,arguments);if(a.includes("j")){var f=w["dynCall_"+a];f=c&&c.length?f.apply(null,[b].concat(c)):f.call(null,b);}else f=Xa.get(b).apply(null,c);return f}};function tc(a,b){a=Jb(a);var c=a.includes("j")?sc(a,b):Xa.get(b);"function"!=typeof c&&W(`unknown function pointer with signature ${a}: ${b}`);return c}var uc=void 0;function vc(a){a=wc(a);var b=Jb(a);xc(a);return b}
|
|
8141
|
+
function yc(a,b){function c(m){h[m]||Bb[m]||(Cb[m]?Cb[m].forEach(c):(f.push(m),h[m]=true));}var f=[],h={};b.forEach(c);throw new uc(`${a}: `+f.map(vc).join([", "]));}
|
|
8142
|
+
function Fc(a,b,c,f,h){var m=b.length;2>m&&W("argTypes array size mismatch! Must at least get return value and 'this' types!");var u=null!==b[1]&&null!==c,n=false;for(c=1;c<b.length;++c)if(null!==b[c]&&void 0===b[c].ve){n=true;break}var p="void"!==b[0].name,v=m-2,E=Array(v),G=[],L=[];return function(){arguments.length!==v&&W(`function ${a} called with ${arguments.length} arguments, expected ${v} args!`);L.length=0;G.length=u?2:1;G[0]=h;if(u){var y=b[1].toWireType(L,this);G[1]=y;}for(var M=0;M<v;++M)E[M]=
|
|
8143
|
+
b[M+2].toWireType(L,arguments[M]),G.push(E[M]);M=f.apply(null,G);if(n)xb(L);else for(var T=u?1:2;T<b.length;T++){var S=1===T?y:E[T-2];null!==b[T].ve&&b[T].ve(S);}y=p?b[0].fromWireType(M):void 0;return y}}function Gc(a,b){for(var c=[],f=0;f<a;f++)c.push(Ta[b+4*f>>2]);return c}function Hc(){this.Ce=[void 0];this.Kf=[];}var Ic=new Hc;function Jc(a){a>=Ic.df&&0===--Ic.get(a).Of&&Ic.Zf(a);}
|
|
8144
|
+
var Kc=a=>{a||W("Cannot use deleted val. handle = "+a);return Ic.get(a).value},oc=a=>{switch(a){case void 0:return 1;case null:return 2;case true:return 3;case false:return 4;default:return Ic.Yf({Of:1,value:a})}};function Lc(a,b,c){switch(b){case 0:return function(f){return this.fromWireType((c?Qa:J)[f])};case 1:return function(f){return this.fromWireType((c?Ra:Sa)[f>>1])};case 2:return function(f){return this.fromWireType((c?Q:Ta)[f>>2])};default:throw new TypeError("Unknown integer type: "+a);}}
|
|
8145
|
+
function Mc(a,b){var c=Bb[a];void 0===c&&W(b+" has unknown type "+vc(a));return c}function mc(a){if(null===a)return "null";var b=typeof a;return "object"===b||"array"===b||"function"===b?a.toString():""+a}function Nc(a,b){switch(b){case 2:return function(c){return this.fromWireType(R[c>>2])};case 3:return function(c){return this.fromWireType(Ua[c>>3])};default:throw new TypeError("Unknown float type: "+a);}}
|
|
8146
|
+
function Oc(a,b,c){switch(b){case 0:return c?function(f){return Qa[f]}:function(f){return J[f]};case 1:return c?function(f){return Ra[f>>1]}:function(f){return Sa[f>>1]};case 2:return c?function(f){return Q[f>>2]}:function(f){return Ta[f>>2]};default:throw new TypeError("Unknown integer type: "+a);}}
|
|
8147
|
+
var oa=(a,b,c,f)=>{if(!(0<f))return 0;var h=c;f=c+f-1;for(var m=0;m<a.length;++m){var u=a.charCodeAt(m);if(55296<=u&&57343>=u){var n=a.charCodeAt(++m);u=65536+((u&1023)<<10)|n&1023;}if(127>=u){if(c>=f)break;b[c++]=u;}else {if(2047>=u){if(c+1>=f)break;b[c++]=192|u>>6;}else {if(65535>=u){if(c+2>=f)break;b[c++]=224|u>>12;}else {if(c+3>=f)break;b[c++]=240|u>>18;b[c++]=128|u>>12&63;}b[c++]=128|u>>6&63;}b[c++]=128|u&63;}}b[c]=0;return c-h},na=a=>{for(var b=0,c=0;c<a.length;++c){var f=a.charCodeAt(c);127>=f?b++:2047>=
|
|
8148
|
+
f?b+=2:55296<=f&&57343>=f?(b+=4,++c):b+=3;}return b},Pc="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,Qc=(a,b)=>{var c=a>>1;for(var f=c+b/2;!(c>=f)&&Sa[c];)++c;c<<=1;if(32<c-a&&Pc)return Pc.decode(J.subarray(a,c));c="";for(f=0;!(f>=b/2);++f){var h=Ra[a+2*f>>1];if(0==h)break;c+=String.fromCharCode(h);}return c},Rc=(a,b,c)=>{ void 0===c&&(c=2147483647);if(2>c)return 0;c-=2;var f=b;c=c<2*a.length?c/2:a.length;for(var h=0;h<c;++h)Ra[b>>1]=a.charCodeAt(h),b+=2;Ra[b>>1]=0;return b-f},
|
|
8149
|
+
Sc=a=>2*a.length,Tc=(a,b)=>{for(var c=0,f="";!(c>=b/4);){var h=Q[a+4*c>>2];if(0==h)break;++c;65536<=h?(h-=65536,f+=String.fromCharCode(55296|h>>10,56320|h&1023)):f+=String.fromCharCode(h);}return f},Uc=(a,b,c)=>{ void 0===c&&(c=2147483647);if(4>c)return 0;var f=b;c=f+c-4;for(var h=0;h<a.length;++h){var m=a.charCodeAt(h);if(55296<=m&&57343>=m){var u=a.charCodeAt(++h);m=65536+((m&1023)<<10)|u&1023;}Q[b>>2]=m;b+=4;if(b+4>c)break}Q[b>>2]=0;return b-f},Vc=a=>{for(var b=0,c=0;c<a.length;++c){var f=a.charCodeAt(c);
|
|
8150
|
+
55296<=f&&57343>=f&&++c;b+=4;}return b},Wc={};function Xc(a){var b=Wc[a];return void 0===b?Jb(a):b}var Yc=[];
|
|
8151
|
+
function Zc(){function a(b){b.$$$embind_global$$$=b;var c="object"==typeof $$$embind_global$$$&&b.$$$embind_global$$$==b;c||delete b.$$$embind_global$$$;return c}if("object"==typeof globalThis)return globalThis;if("object"==typeof $$$embind_global$$$)return $$$embind_global$$$;"object"==typeof commonjsGlobal&&a(commonjsGlobal)?$$$embind_global$$$=commonjsGlobal:"object"==typeof self&&a(self)&&($$$embind_global$$$=self);if("object"==typeof $$$embind_global$$$)return $$$embind_global$$$;throw Error("unable to get global object.");
|
|
8152
|
+
}function $c(a){var b=Yc.length;Yc.push(a);return b}function ad(a,b){for(var c=Array(a),f=0;f<a;++f)c[f]=Mc(Ta[b+4*f>>2],"parameter "+f);return c}var bd=[];function cd(a){var b=Array(a+1);return function(c,f,h){b[0]=c;for(var m=0;m<a;++m){var u=Mc(Ta[f+4*m>>2],"parameter "+m);b[m+1]=u.readValueFromPointer(h);h+=u.argPackAdvance;}c=new (c.bind.apply(c,b));return oc(c)}}var dd={};
|
|
8153
|
+
function ed(a){var b=a.getExtension("ANGLE_instanced_arrays");b&&(a.vertexAttribDivisor=function(c,f){b.vertexAttribDivisorANGLE(c,f);},a.drawArraysInstanced=function(c,f,h,m){b.drawArraysInstancedANGLE(c,f,h,m);},a.drawElementsInstanced=function(c,f,h,m,u){b.drawElementsInstancedANGLE(c,f,h,m,u);});}
|
|
8154
|
+
function fd(a){var b=a.getExtension("OES_vertex_array_object");b&&(a.createVertexArray=function(){return b.createVertexArrayOES()},a.deleteVertexArray=function(c){b.deleteVertexArrayOES(c);},a.bindVertexArray=function(c){b.bindVertexArrayOES(c);},a.isVertexArray=function(c){return b.isVertexArrayOES(c)});}function gd(a){var b=a.getExtension("WEBGL_draw_buffers");b&&(a.drawBuffers=function(c,f){b.drawBuffersWEBGL(c,f);});}
|
|
8155
|
+
var hd=1,jd=[],kd=[],ld=[],md=[],ha=[],nd=[],od=[],ma=[],pd=[],qd=[],rd=[],sd={},td={},ud=4;function vd(a){wd||(wd=a);}function da(a){for(var b=hd++,c=a.length;c<b;c++)a[c]=null;return b}function ia(a,b){a.df||(a.df=a.getContext,a.getContext=function(f,h){h=a.df(f,h);return "webgl"==f==h instanceof WebGLRenderingContext?h:null});var c=1<b.majorVersion?a.getContext("webgl2",b):a.getContext("webgl",b);return c?xd(c,b):0}
|
|
8156
|
+
function xd(a,b){var c=da(ma),f={handle:c,attributes:b,version:b.majorVersion,xe:a};a.canvas&&(a.canvas.Rf=f);ma[c]=f;("undefined"==typeof b.eg||b.eg)&&yd(f);return c}function ja(a){B=ma[a];w.Jg=Z=B&&B.xe;return !(a&&!Z)}
|
|
8157
|
+
function yd(a){a||(a=B);if(!a.og){a.og=true;var b=a.xe;ed(b);fd(b);gd(b);b.If=b.getExtension("WEBGL_draw_instanced_base_vertex_base_instance");b.Mf=b.getExtension("WEBGL_multi_draw_instanced_base_vertex_base_instance");2<=a.version&&(b.ze=b.getExtension("EXT_disjoint_timer_query_webgl2"));if(2>a.version||!b.ze)b.ze=b.getExtension("EXT_disjoint_timer_query");b.Kg=b.getExtension("WEBGL_multi_draw");(b.getSupportedExtensions()||[]).forEach(function(c){c.includes("lose_context")||c.includes("debug")||b.getExtension(c);});}}
|
|
8158
|
+
var B,wd;function zd(a,b){Z.bindFramebuffer(a,ld[b]);}function Ad(a){Z.bindVertexArray(od[a]);}function Bd(a){Z.clear(a);}function Cd(a,b,c,f){Z.clearColor(a,b,c,f);}function Dd(a){Z.clearStencil(a);}function Ed(a,b){for(var c=0;c<a;c++){var f=Q[b+4*c>>2];Z.deleteVertexArray(od[f]);od[f]=null;}}var Fd=[];function Gd(a,b,c,f){Z.drawElements(a,b,c,f);}function Jd(a,b,c,f){for(var h=0;h<a;h++){var m=Z[c](),u=m&&da(f);m?(m.name=u,f[u]=m):vd(1282);Q[b+4*h>>2]=u;}}
|
|
8159
|
+
function Kd(a,b){Jd(a,b,"createVertexArray",od);}function Ld(a,b){Ta[a>>2]=b;Ta[a+4>>2]=(b-Ta[a>>2])/4294967296;}
|
|
8160
|
+
function Md(a,b,c){if(b){var f=void 0;switch(a){case 36346:f=1;break;case 36344:0!=c&&1!=c&&vd(1280);return;case 34814:case 36345:f=0;break;case 34466:var h=Z.getParameter(34467);f=h?h.length:0;break;case 33309:if(2>B.version){vd(1282);return}f=2*(Z.getSupportedExtensions()||[]).length;break;case 33307:case 33308:if(2>B.version){vd(1280);return}f=33307==a?3:0;}if(void 0===f)switch(h=Z.getParameter(a),typeof h){case "number":f=h;break;case "boolean":f=h?1:0;break;case "string":vd(1280);return;case "object":if(null===
|
|
8161
|
+
h)switch(a){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 36662:case 36663:case 35053:case 35055:case 36010:case 35097:case 35869:case 32874:case 36389:case 35983:case 35368:case 34068:f=0;break;default:vd(1280);return}else {if(h instanceof Float32Array||h instanceof Uint32Array||h instanceof Int32Array||h instanceof Array){for(a=0;a<h.length;++a)switch(c){case 0:Q[b+4*a>>2]=h[a];break;case 2:R[b+4*a>>2]=h[a];break;case 4:Qa[b+a>>0]=h[a]?1:0;}return}try{f=h.name|
|
|
8162
|
+
0;}catch(m){vd(1280);Ia("GL_INVALID_ENUM in glGet"+c+"v: Unknown object returned from WebGL getParameter("+a+")! (error: "+m+")");return}}break;default:vd(1280);Ia("GL_INVALID_ENUM in glGet"+c+"v: Native code calling glGet"+c+"v("+a+") and it returns "+h+" of type "+typeof h+"!");return}switch(c){case 1:Ld(b,f);break;case 0:Q[b>>2]=f;break;case 2:R[b>>2]=f;break;case 4:Qa[b>>0]=f?1:0;}}else vd(1281);}function Nd(a,b){Md(a,b,0);}
|
|
8163
|
+
function Od(a,b,c){if(c){a=pd[a];b=2>B.version?Z.ze.getQueryObjectEXT(a,b):Z.getQueryParameter(a,b);var f;"boolean"==typeof b?f=b?1:0:f=b;Ld(c,f);}else vd(1281);}var Qd=a=>{var b=na(a)+1,c=Pd(b);c&&oa(a,J,c,b);return c};
|
|
8164
|
+
function Rd(a){var b=sd[a];if(!b){switch(a){case 7939:b=Z.getSupportedExtensions()||[];b=b.concat(b.map(function(f){return "GL_"+f}));b=Qd(b.join(" "));break;case 7936:case 7937:case 37445:case 37446:(b=Z.getParameter(a))||vd(1280);b=b&&Qd(b);break;case 7938:b=Z.getParameter(7938);b=2<=B.version?"OpenGL ES 3.0 ("+b+")":"OpenGL ES 2.0 ("+b+")";b=Qd(b);break;case 35724:b=Z.getParameter(35724);var c=b.match(/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/);null!==c&&(3==c[1].length&&(c[1]+="0"),b="OpenGL ES GLSL ES "+
|
|
8165
|
+
c[1]+" ("+b+")");b=Qd(b);break;default:vd(1280);}sd[a]=b;}return b}function Sd(a,b){if(2>B.version)return vd(1282),0;var c=td[a];if(c)return 0>b||b>=c.length?(vd(1281),0):c[b];switch(a){case 7939:return c=Z.getSupportedExtensions()||[],c=c.concat(c.map(function(f){return "GL_"+f})),c=c.map(function(f){return Qd(f)}),c=td[a]=c,0>b||b>=c.length?(vd(1281),0):c[b];default:return vd(1280),0}}function Td(a){return "]"==a.slice(-1)&&a.lastIndexOf("[")}
|
|
8166
|
+
function Ud(a){a-=5120;return 0==a?Qa:1==a?J:2==a?Ra:4==a?Q:6==a?R:5==a||28922==a||28520==a||30779==a||30782==a?Ta:Sa}function Vd(a,b,c,f,h){a=Ud(a);var m=31-Math.clz32(a.BYTES_PER_ELEMENT),u=ud;return a.subarray(h>>m,h+f*(c*({5:3,6:4,8:2,29502:3,29504:4,26917:2,26918:2,29846:3,29847:4}[b-6402]||1)*(1<<m)+u-1&-u)>>m)}function Wd(a){var b=Z.bg;if(b){var c=b.ff[a];"number"==typeof c&&(b.ff[a]=c=Z.getUniformLocation(b,b.Pf[a]+(0<c?"["+c+"]":"")));return c}vd(1282);}
|
|
8167
|
+
var Xd=[],Yd=[],Zd={},ae=()=>{if(!$d){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:ua||"./this.program"},b;for(b in Zd) void 0===Zd[b]?delete a[b]:a[b]=Zd[b];var c=[];for(b in a)c.push(`${b}=${a[b]}`);$d=c;}return $d},$d,be=[null,[],[]],ce=a=>0===a%4&&(0!==a%100||0===a%400),de=[31,29,31,30,31,30,31,31,30,31,30,31],ee=[31,28,31,30,31,30,31,31,30,31,30,31];
|
|
8168
|
+
function fe(a){var b=Array(na(a)+1);oa(a,b,0,b.length);return b}
|
|
8169
|
+
var ge=(a,b,c,f)=>{function h(y,M,T){for(y="number"==typeof y?y.toString():y||"";y.length<M;)y=T[0]+y;return y}function m(y,M){return h(y,M,"0")}function u(y,M){function T(sa){return 0>sa?-1:0<sa?1:0}var S;0===(S=T(y.getFullYear()-M.getFullYear()))&&0===(S=T(y.getMonth()-M.getMonth()))&&(S=T(y.getDate()-M.getDate()));return S}function n(y){switch(y.getDay()){case 0:return new Date(y.getFullYear()-1,11,29);case 1:return y;case 2:return new Date(y.getFullYear(),0,3);case 3:return new Date(y.getFullYear(),
|
|
8170
|
+
0,2);case 4:return new Date(y.getFullYear(),0,1);case 5:return new Date(y.getFullYear()-1,11,31);case 6:return new Date(y.getFullYear()-1,11,30)}}function p(y){var M=y.He;for(y=new Date((new Date(y.Ie+1900,0,1)).getTime());0<M;){var T=y.getMonth(),S=(ce(y.getFullYear())?de:ee)[T];if(M>S-y.getDate())M-=S-y.getDate()+1,y.setDate(1),11>T?y.setMonth(T+1):(y.setMonth(0),y.setFullYear(y.getFullYear()+1));else {y.setDate(y.getDate()+M);break}}T=new Date(y.getFullYear()+1,0,4);M=n(new Date(y.getFullYear(),
|
|
8171
|
+
0,4));T=n(T);return 0>=u(M,y)?0>=u(T,y)?y.getFullYear()+1:y.getFullYear():y.getFullYear()-1}var v=Q[f+40>>2];f={Hg:Q[f>>2],Gg:Q[f+4>>2],tf:Q[f+8>>2],Df:Q[f+12>>2],uf:Q[f+16>>2],Ie:Q[f+20>>2],Ae:Q[f+24>>2],He:Q[f+28>>2],Ng:Q[f+32>>2],Fg:Q[f+36>>2],Ig:v?v?vb(J,v):"":""};c=c?vb(J,c):"";v={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y",
|
|
8172
|
+
"%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var E in v)c=c.replace(new RegExp(E,"g"),v[E]);var G="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),L="January February March April May June July August September October November December".split(" ");v={"%a":y=>G[y.Ae].substring(0,3),"%A":y=>G[y.Ae],"%b":y=>L[y.uf].substring(0,3),"%B":y=>L[y.uf],"%C":y=>m((y.Ie+1900)/
|
|
8173
|
+
100|0,2),"%d":y=>m(y.Df,2),"%e":y=>h(y.Df,2," "),"%g":y=>p(y).toString().substring(2),"%G":y=>p(y),"%H":y=>m(y.tf,2),"%I":y=>{y=y.tf;0==y?y=12:12<y&&(y-=12);return m(y,2)},"%j":y=>{for(var M=0,T=0;T<=y.uf-1;M+=(ce(y.Ie+1900)?de:ee)[T++]);return m(y.Df+M,3)},"%m":y=>m(y.uf+1,2),"%M":y=>m(y.Gg,2),"%n":()=>"\n","%p":y=>0<=y.tf&&12>y.tf?"AM":"PM","%S":y=>m(y.Hg,2),"%t":()=>"\t","%u":y=>y.Ae||7,"%U":y=>m(Math.floor((y.He+7-y.Ae)/7),2),"%V":y=>{var M=Math.floor((y.He+7-(y.Ae+6)%7)/7);2>=(y.Ae+371-y.He-
|
|
8174
|
+
2)%7&&M++;if(M)53==M&&(T=(y.Ae+371-y.He)%7,4==T||3==T&&ce(y.Ie)||(M=1));else {M=52;var T=(y.Ae+7-y.He-1)%7;(4==T||5==T&&ce(y.Ie%400-1))&&M++;}return m(M,2)},"%w":y=>y.Ae,"%W":y=>m(Math.floor((y.He+7-(y.Ae+6)%7)/7),2),"%y":y=>(y.Ie+1900).toString().substring(2),"%Y":y=>y.Ie+1900,"%z":y=>{y=y.Fg;var M=0<=y;y=Math.abs(y)/60;return (M?"+":"-")+String("0000"+(y/60*100+y%60)).slice(-4)},"%Z":y=>y.Ig,"%%":()=>"%"};c=c.replace(/%%/g,"\x00\x00");for(E in v)c.includes(E)&&(c=c.replace(new RegExp(E,"g"),v[E](f)));
|
|
8175
|
+
c=c.replace(/\0\0/g,"%");E=fe(c);if(E.length>b)return 0;Qa.set(E,a);return E.length-1};Db=w.InternalError=class extends Error{constructor(a){super(a);this.name="InternalError";}};for(var he=Array(256),ie=0;256>ie;++ie)he[ie]=String.fromCharCode(ie);Ib=he;Kb=w.BindingError=class extends Error{constructor(a){super(a);this.name="BindingError";}};
|
|
8176
|
+
ec.prototype.isAliasOf=function(a){if(!(this instanceof ec&&a instanceof ec))return false;var b=this.ae.me.ge,c=this.ae.ie,f=a.ae.me.ge;for(a=a.ae.ie;b.re;)c=b.gf(c),b=b.re;for(;f.re;)a=f.gf(a),f=f.re;return b===f&&c===a};
|
|
8177
|
+
ec.prototype.clone=function(){this.ae.ie||Mb(this);if(this.ae.ef)return this.ae.count.value+=1,this;var a=dc,b=Object,c=b.create,f=Object.getPrototypeOf(this),h=this.ae;a=a(c.call(b,f,{ae:{value:{count:h.count,Xe:h.Xe,ef:h.ef,ie:h.ie,me:h.me,pe:h.pe,we:h.we}}}));a.ae.count.value+=1;a.ae.Xe=false;return a};ec.prototype["delete"]=function(){this.ae.ie||Mb(this);this.ae.Xe&&!this.ae.ef&&W("Object already scheduled for deletion");Ob(this);Pb(this.ae);this.ae.ef||(this.ae.pe=void 0,this.ae.ie=void 0);};
|
|
8178
|
+
ec.prototype.isDeleted=function(){return !this.ae.ie};ec.prototype.deleteLater=function(){this.ae.ie||Mb(this);this.ae.Xe&&!this.ae.ef&&W("Object already scheduled for deletion");Sb.push(this);1===Sb.length&&Ub&&Ub(Tb);this.ae.Xe=true;return this};w.getInheritedInstanceCount=function(){return Object.keys(Vb).length};w.getLiveInheritedInstances=function(){var a=[],b;for(b in Vb)Vb.hasOwnProperty(b)&&a.push(Vb[b]);return a};w.flushPendingDeletes=Tb;w.setDelayFunction=function(a){Ub=a;Sb.length&&Ub&&Ub(Tb);};
|
|
8179
|
+
qc.prototype.jg=function(a){this.Nf&&(a=this.Nf(a));return a};qc.prototype.Hf=function(a){this.De&&this.De(a);};qc.prototype.argPackAdvance=8;qc.prototype.readValueFromPointer=yb;qc.prototype.deleteObject=function(a){if(null!==a)a["delete"]();};
|
|
8180
|
+
qc.prototype.fromWireType=function(a){function b(){return this.pf?cc(this.ge.Ye,{me:this.tg,ie:c,we:this,pe:a}):cc(this.ge.Ye,{me:this,ie:a})}var c=this.jg(a);if(!c)return this.Hf(a),null;var f=Wb(this.ge,c);if(void 0!==f){if(0===f.ae.count.value)return f.ae.ie=c,f.ae.pe=a,f.clone();f=f.clone();this.Hf(a);return f}f=this.ge.ig(c);f=Rb[f];if(!f)return b.call(this);f=this.nf?f.$f:f.pointerType;var h=Qb(c,this.ge,f.ge);return null===h?b.call(this):this.pf?cc(f.ge.Ye,{me:f,ie:h,we:this,pe:a}):cc(f.ge.Ye,
|
|
8181
|
+
{me:f,ie:h})};uc=w.UnboundTypeError=function(a,b){var c=gc(b,function(f){this.name=b;this.message=f;f=Error(f).stack;void 0!==f&&(this.stack=this.toString()+"\n"+f.replace(/^Error(:[^\n]*)?\n/,""));});c.prototype=Object.create(a.prototype);c.prototype.constructor=c;c.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`};return c}(Error,"UnboundTypeError");
|
|
8182
|
+
Object.assign(Hc.prototype,{get(a){return this.Ce[a]},has(a){return void 0!==this.Ce[a]},Yf(a){var b=this.Kf.pop()||this.Ce.length;this.Ce[b]=a;return b},Zf(a){this.Ce[a]=void 0;this.Kf.push(a);}});Ic.Ce.push({value:void 0},{value:null},{value:true},{value:false});Ic.df=Ic.Ce.length;w.count_emval_handles=function(){for(var a=0,b=Ic.df;b<Ic.Ce.length;++b) void 0!==Ic.Ce[b]&&++a;return a};for(var Z,je=0;32>je;++je)Fd.push(Array(je));var ke=new Float32Array(288);
|
|
8183
|
+
for(je=0;288>je;++je)Xd[je]=ke.subarray(0,je+1);var le=new Int32Array(288);for(je=0;288>je;++je)Yd[je]=le.subarray(0,je+1);
|
|
8184
|
+
var De={R:function(){return 0},wb:()=>{},yb:function(){return 0},tb:()=>{},ub:()=>{},S:function(){},vb:()=>{},B:function(a){var b=wb[a];delete wb[a];var c=b.Cf,f=b.De,h=b.Jf,m=h.map(u=>u.mg).concat(h.map(u=>u.xg));Fb([a],m,u=>{var n={};h.forEach((p,v)=>{var E=u[v],G=p.kg,L=p.lg,y=u[v+h.length],M=p.wg,T=p.yg;n[p.fg]={read:S=>E.fromWireType(G(L,S)),write:(S,sa)=>{var pa=[];M(T,S,y.toWireType(pa,sa));xb(pa);}};});return [{name:b.name,fromWireType:function(p){var v={},E;for(E in n)v[E]=n[E].read(p);f(p);
|
|
8185
|
+
return v},toWireType:function(p,v){for(var E in n)if(!(E in v))throw new TypeError(`Missing field: "${E}"`);var G=c();for(E in n)n[E].write(G,v[E]);null!==p&&p.push(f,G);return G},argPackAdvance:8,readValueFromPointer:yb,ve:f}]});},nb:function(){},Cb:function(a,b,c,f,h){var m=Hb(c);b=Jb(b);Gb(a,{name:b,fromWireType:function(u){return !!u},toWireType:function(u,n){return n?f:h},argPackAdvance:8,readValueFromPointer:function(u){if(1===c)var n=Qa;else if(2===c)n=Ra;else if(4===c)n=Q;else throw new TypeError("Unknown boolean type size: "+
|
|
8186
|
+
b);return this.fromWireType(n[u>>m])},ve:null});},n:function(a,b,c,f,h,m,u,n,p,v,E,G,L){E=Jb(E);m=tc(h,m);n&&(n=tc(u,n));v&&(v=tc(p,v));L=tc(G,L);var y=fc(E);ic(y,function(){yc(`Cannot construct ${E} due to unbound types`,[f]);});Fb([a,b,c],f?[f]:[],function(M){M=M[0];if(f){var T=M.ge;var S=T.Ye;}else S=ec.prototype;M=gc(y,function(){if(Object.getPrototypeOf(this)!==sa)throw new Kb("Use 'new' to construct "+E);if(void 0===pa.Ge)throw new Kb(E+" has no accessible constructor");var jb=pa.Ge[arguments.length];
|
|
8187
|
+
if(void 0===jb)throw new Kb(`Tried to invoke ctor of ${E} with invalid number of parameters (${arguments.length}) - expected (${Object.keys(pa.Ge).toString()}) parameters instead!`);return jb.apply(this,arguments)});var sa=Object.create(S,{constructor:{value:M}});M.prototype=sa;var pa=new jc(E,M,sa,L,T,m,n,v);pa.re&&(void 0===pa.re.hf&&(pa.re.hf=[]),pa.re.hf.push(pa));T=new qc(E,pa,true,false,false);S=new qc(E+"*",pa,false,false,false);var ib=new qc(E+" const*",pa,false,true,false);Rb[a]={pointerType:S,$f:ib};rc(y,M);return [T,
|
|
8188
|
+
S,ib]});},f:function(a,b,c,f,h,m,u){var n=Gc(c,f);b=Jb(b);m=tc(h,m);Fb([],[a],function(p){function v(){yc(`Cannot call ${E} due to unbound types`,n);}p=p[0];var E=`${p.name}.${b}`;b.startsWith("@@")&&(b=Symbol[b.substring(2)]);var G=p.ge.constructor;void 0===G[b]?(v.Ve=c-1,G[b]=v):(hc(G,b,E),G[b].oe[c-1]=v);Fb([],n,function(L){L=[L[0],null].concat(L.slice(1));L=Fc(E,L,null,m,u);void 0===G[b].oe?(L.Ve=c-1,G[b]=L):G[b].oe[c-1]=L;if(p.ge.hf)for(const y of p.ge.hf)y.constructor.hasOwnProperty(b)||(y.constructor[b]=
|
|
8189
|
+
L);return []});return []});},A:function(a,b,c,f,h,m){var u=Gc(b,c);h=tc(f,h);Fb([],[a],function(n){n=n[0];var p=`constructor ${n.name}`;void 0===n.ge.Ge&&(n.ge.Ge=[]);if(void 0!==n.ge.Ge[b-1])throw new Kb(`Cannot register multiple constructors with identical number of parameters (${b-1}) for class '${n.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);n.ge.Ge[b-1]=()=>{yc(`Cannot construct ${n.name} due to unbound types`,u);};Fb([],u,function(v){v.splice(1,
|
|
8190
|
+
0,null);n.ge.Ge[b-1]=Fc(p,v,null,h,m);return []});return []});},b:function(a,b,c,f,h,m,u,n){var p=Gc(c,f);b=Jb(b);m=tc(h,m);Fb([],[a],function(v){function E(){yc(`Cannot call ${G} due to unbound types`,p);}v=v[0];var G=`${v.name}.${b}`;b.startsWith("@@")&&(b=Symbol[b.substring(2)]);n&&v.ge.ug.push(b);var L=v.ge.Ye,y=L[b];void 0===y||void 0===y.oe&&y.className!==v.name&&y.Ve===c-2?(E.Ve=c-2,E.className=v.name,L[b]=E):(hc(L,b,G),L[b].oe[c-2]=E);Fb([],p,function(M){M=Fc(G,M,v,m,u);void 0===L[b].oe?(M.Ve=
|
|
8191
|
+
c-2,L[b]=M):L[b].oe[c-2]=M;return []});return []});},t:function(a,b,c){a=Jb(a);Fb([],[b],function(f){f=f[0];w[a]=f.fromWireType(c);return []});},Bb:function(a,b){b=Jb(b);Gb(a,{name:b,fromWireType:function(c){var f=Kc(c);Jc(c);return f},toWireType:function(c,f){return oc(f)},argPackAdvance:8,readValueFromPointer:yb,ve:null});},m:function(a,b,c,f){function h(){}c=Hb(c);b=Jb(b);h.values={};Gb(a,{name:b,constructor:h,fromWireType:function(m){return this.constructor.values[m]},toWireType:function(m,u){return u.value},
|
|
8192
|
+
argPackAdvance:8,readValueFromPointer:Lc(b,c,f),ve:null});ic(b,h);},c:function(a,b,c){var f=Mc(a,"enum");b=Jb(b);a=f.constructor;f=Object.create(f.constructor.prototype,{value:{value:c},constructor:{value:gc(`${f.name}_${b}`,function(){})}});a.values[c]=f;a[b]=f;},U:function(a,b,c){c=Hb(c);b=Jb(b);Gb(a,{name:b,fromWireType:function(f){return f},toWireType:function(f,h){return h},argPackAdvance:8,readValueFromPointer:Nc(b,c),ve:null});},y:function(a,b,c,f,h,m){var u=Gc(b,c);a=Jb(a);h=tc(f,h);ic(a,function(){yc(`Cannot call ${a} due to unbound types`,
|
|
8193
|
+
u);},b-1);Fb([],u,function(n){n=[n[0],null].concat(n.slice(1));rc(a,Fc(a,n,null,h,m),b-1);return []});},E:function(a,b,c,f,h){b=Jb(b);-1===h&&(h=4294967295);h=Hb(c);var m=n=>n;if(0===f){var u=32-8*c;m=n=>n<<u>>>u;}c=b.includes("unsigned")?function(n,p){return p>>>0}:function(n,p){return p};Gb(a,{name:b,fromWireType:m,toWireType:c,argPackAdvance:8,readValueFromPointer:Oc(b,h,0!==f),ve:null});},r:function(a,b,c){function f(m){m>>=2;var u=Ta;return new h(u.buffer,u[m+1],u[m])}var h=[Int8Array,Uint8Array,
|
|
8194
|
+
Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][b];c=Jb(c);Gb(a,{name:c,fromWireType:f,argPackAdvance:8,readValueFromPointer:f},{ng:true});},q:function(a,b,c,f,h,m,u,n,p,v,E,G){c=Jb(c);m=tc(h,m);n=tc(u,n);v=tc(p,v);G=tc(E,G);Fb([a],[b],function(L){L=L[0];return [new qc(c,L.ge,false,false,true,L,f,m,n,v,G)]});},T:function(a,b){b=Jb(b);var c="std::string"===b;Gb(a,{name:b,fromWireType:function(f){var h=Ta[f>>2],m=f+4;if(c)for(var u=m,n=0;n<=h;++n){var p=m+n;if(n==h||0==J[p]){u=u?vb(J,u,
|
|
8195
|
+
p-u):"";if(void 0===v)var v=u;else v+=String.fromCharCode(0),v+=u;u=p+1;}}else {v=Array(h);for(n=0;n<h;++n)v[n]=String.fromCharCode(J[m+n]);v=v.join("");}xc(f);return v},toWireType:function(f,h){h instanceof ArrayBuffer&&(h=new Uint8Array(h));var m="string"==typeof h;m||h instanceof Uint8Array||h instanceof Uint8ClampedArray||h instanceof Int8Array||W("Cannot pass non-string to std::string");var u=c&&m?na(h):h.length;var n=Pd(4+u+1),p=n+4;Ta[n>>2]=u;if(c&&m)oa(h,J,p,u+1);else if(m)for(m=0;m<u;++m){var v=
|
|
8196
|
+
h.charCodeAt(m);255<v&&(xc(p),W("String has UTF-16 code units that do not fit in 8 bits"));J[p+m]=v;}else for(m=0;m<u;++m)J[p+m]=h[m];null!==f&&f.push(xc,n);return n},argPackAdvance:8,readValueFromPointer:yb,ve:function(f){xc(f);}});},N:function(a,b,c){c=Jb(c);if(2===b){var f=Qc;var h=Rc;var m=Sc;var u=()=>Sa;var n=1;}else 4===b&&(f=Tc,h=Uc,m=Vc,u=()=>Ta,n=2);Gb(a,{name:c,fromWireType:function(p){for(var v=Ta[p>>2],E=u(),G,L=p+4,y=0;y<=v;++y){var M=p+4+y*b;if(y==v||0==E[M>>n])L=f(L,M-L),void 0===G?G=
|
|
8197
|
+
L:(G+=String.fromCharCode(0),G+=L),L=M+b;}xc(p);return G},toWireType:function(p,v){"string"!=typeof v&&W(`Cannot pass non-string to C++ string type ${c}`);var E=m(v),G=Pd(4+E+b);Ta[G>>2]=E>>n;h(v,G+4,E+b);null!==p&&p.push(xc,G);return G},argPackAdvance:8,readValueFromPointer:yb,ve:function(p){xc(p);}});},C:function(a,b,c,f,h,m){wb[a]={name:Jb(b),Cf:tc(c,f),De:tc(h,m),Jf:[]};},e:function(a,b,c,f,h,m,u,n,p,v){wb[a].Jf.push({fg:Jb(b),mg:c,kg:tc(f,h),lg:m,xg:u,wg:tc(n,p),yg:v});},Db:function(a,b){b=Jb(b);
|
|
8198
|
+
Gb(a,{pg:true,name:b,argPackAdvance:0,fromWireType:function(){},toWireType:function(){}});},Ab:()=>true,pb:()=>{throw Infinity;},F:function(a,b,c){a=Kc(a);b=Mc(b,"emval::as");var f=[],h=oc(f);Ta[c>>2]=h;return b.toWireType(f,a)},X:function(a,b,c,f,h){a=Yc[a];b=Kc(b);c=Xc(c);var m=[];Ta[f>>2]=oc(m);return a(b,c,m,h)},x:function(a,b,c,f){a=Yc[a];b=Kc(b);c=Xc(c);a(b,c,null,f);},d:Jc,K:function(a){if(0===a)return oc(Zc());a=Xc(a);return oc(Zc()[a])},u:function(a,b){var c=ad(a,b),f=c[0];b=f.name+"_$"+c.slice(1).map(function(u){return u.name}).join("_")+
|
|
8199
|
+
"$";var h=bd[b];if(void 0!==h)return h;var m=Array(a-1);h=$c((u,n,p,v)=>{for(var E=0,G=0;G<a-1;++G)m[G]=c[G+1].readValueFromPointer(v+E),E+=c[G+1].argPackAdvance;u=u[n].apply(u,m);for(G=0;G<a-1;++G)c[G+1].cg&&c[G+1].cg(m[G]);if(!f.pg)return f.toWireType(p,u)});return bd[b]=h},z:function(a,b){a=Kc(a);b=Kc(b);return oc(a[b])},p:function(a){4<a&&(Ic.get(a).Of+=1);},J:function(a,b,c,f){a=Kc(a);var h=dd[b];h||(h=cd(b),dd[b]=h);return h(a,c,f)},H:function(){return oc([])},g:function(a){return oc(Xc(a))},
|
|
8200
|
+
G:function(){return oc({})},gb:function(a){a=Kc(a);return !a},D:function(a){var b=Kc(a);xb(b);Jc(a);},l:function(a,b,c){a=Kc(a);b=Kc(b);c=Kc(c);a[b]=c;},h:function(a,b){a=Mc(a,"_emval_take_value");a=a.readValueFromPointer(b);return oc(a)},kb:function(){return -52},lb:function(){},a:()=>{Ka("");},zb:()=>performance.now(),sd:function(a){Z.activeTexture(a);},td:function(a,b){Z.attachShader(kd[a],nd[b]);},Yb:function(a,b){Z.beginQuery(a,pd[b]);},Sb:function(a,b){Z.ze.beginQueryEXT(a,pd[b]);},ud:function(a,b,c){Z.bindAttribLocation(kd[a],
|
|
8201
|
+
b,c?vb(J,c):"");},vd:function(a,b){35051==a?Z.zf=b:35052==a&&(Z.We=b);Z.bindBuffer(a,jd[b]);},uc:zd,vc:function(a,b){Z.bindRenderbuffer(a,md[b]);},cc:function(a,b){Z.bindSampler(a,qd[b]);},wd:function(a,b){Z.bindTexture(a,ha[b]);},Pc:Ad,Tc:Ad,Y:function(a,b,c,f){Z.blendColor(a,b,c,f);},Z:function(a){Z.blendEquation(a);},_:function(a,b){Z.blendFunc(a,b);},oc:function(a,b,c,f,h,m,u,n,p,v){Z.blitFramebuffer(a,b,c,f,h,m,u,n,p,v);},$:function(a,b,c,f){2<=B.version?c&&b?Z.bufferData(a,J,f,c,b):Z.bufferData(a,b,
|
|
8202
|
+
f):Z.bufferData(a,c?J.subarray(c,c+b):b,f);},aa:function(a,b,c,f){2<=B.version?c&&Z.bufferSubData(a,b,J,f,c):Z.bufferSubData(a,b,J.subarray(f,f+c));},wc:function(a){return Z.checkFramebufferStatus(a)},ba:Bd,ca:Cd,da:Dd,lc:function(a,b,c,f){return Z.clientWaitSync(rd[a],b,(c>>>0)+4294967296*f)},ea:function(a,b,c,f){Z.colorMask(!!a,!!b,!!c,!!f);},fa:function(a){Z.compileShader(nd[a]);},ga:function(a,b,c,f,h,m,u,n){2<=B.version?Z.We||!u?Z.compressedTexImage2D(a,b,c,f,h,m,u,n):Z.compressedTexImage2D(a,b,
|
|
8203
|
+
c,f,h,m,J,n,u):Z.compressedTexImage2D(a,b,c,f,h,m,n?J.subarray(n,n+u):null);},ha:function(a,b,c,f,h,m,u,n,p){2<=B.version?Z.We||!n?Z.compressedTexSubImage2D(a,b,c,f,h,m,u,n,p):Z.compressedTexSubImage2D(a,b,c,f,h,m,u,J,p,n):Z.compressedTexSubImage2D(a,b,c,f,h,m,u,p?J.subarray(p,p+n):null);},nc:function(a,b,c,f,h){Z.copyBufferSubData(a,b,c,f,h);},ia:function(a,b,c,f,h,m,u,n){Z.copyTexSubImage2D(a,b,c,f,h,m,u,n);},ja:function(){var a=da(kd),b=Z.createProgram();b.name=a;b.sf=b.qf=b.rf=0;b.Ef=1;kd[a]=b;return a},
|
|
8204
|
+
ka:function(a){var b=da(nd);nd[b]=Z.createShader(a);return b},la:function(a){Z.cullFace(a);},ma:function(a,b){for(var c=0;c<a;c++){var f=Q[b+4*c>>2],h=jd[f];h&&(Z.deleteBuffer(h),h.name=0,jd[f]=null,f==Z.zf&&(Z.zf=0),f==Z.We&&(Z.We=0));}},xc:function(a,b){for(var c=0;c<a;++c){var f=Q[b+4*c>>2],h=ld[f];h&&(Z.deleteFramebuffer(h),h.name=0,ld[f]=null);}},na:function(a){if(a){var b=kd[a];b?(Z.deleteProgram(b),b.name=0,kd[a]=null):vd(1281);}},Zb:function(a,b){for(var c=0;c<a;c++){var f=Q[b+4*c>>2],h=pd[f];
|
|
8205
|
+
h&&(Z.deleteQuery(h),pd[f]=null);}},Tb:function(a,b){for(var c=0;c<a;c++){var f=Q[b+4*c>>2],h=pd[f];h&&(Z.ze.deleteQueryEXT(h),pd[f]=null);}},yc:function(a,b){for(var c=0;c<a;c++){var f=Q[b+4*c>>2],h=md[f];h&&(Z.deleteRenderbuffer(h),h.name=0,md[f]=null);}},dc:function(a,b){for(var c=0;c<a;c++){var f=Q[b+4*c>>2],h=qd[f];h&&(Z.deleteSampler(h),h.name=0,qd[f]=null);}},oa:function(a){if(a){var b=nd[a];b?(Z.deleteShader(b),nd[a]=null):vd(1281);}},mc:function(a){if(a){var b=rd[a];b?(Z.deleteSync(b),b.name=
|
|
8206
|
+
0,rd[a]=null):vd(1281);}},pa:function(a,b){for(var c=0;c<a;c++){var f=Q[b+4*c>>2],h=ha[f];h&&(Z.deleteTexture(h),h.name=0,ha[f]=null);}},Qc:Ed,Uc:Ed,qa:function(a){Z.depthMask(!!a);},ra:function(a){Z.disable(a);},sa:function(a){Z.disableVertexAttribArray(a);},ta:function(a,b,c){Z.drawArrays(a,b,c);},Nc:function(a,b,c,f){Z.drawArraysInstanced(a,b,c,f);},Lc:function(a,b,c,f,h){Z.If.drawArraysInstancedBaseInstanceWEBGL(a,b,c,f,h);},Jc:function(a,b){for(var c=Fd[a],f=0;f<a;f++)c[f]=Q[b+4*f>>2];Z.drawBuffers(c);},
|
|
8207
|
+
ua:Gd,Oc:function(a,b,c,f,h){Z.drawElementsInstanced(a,b,c,f,h);},Mc:function(a,b,c,f,h,m,u){Z.If.drawElementsInstancedBaseVertexBaseInstanceWEBGL(a,b,c,f,h,m,u);},Dc:function(a,b,c,f,h,m){Gd(a,f,h,m);},va:function(a){Z.enable(a);},wa:function(a){Z.enableVertexAttribArray(a);},_b:function(a){Z.endQuery(a);},Ub:function(a){Z.ze.endQueryEXT(a);},ic:function(a,b){return (a=Z.fenceSync(a,b))?(b=da(rd),a.name=b,rd[b]=a,b):0},xa:function(){Z.finish();},ya:function(){Z.flush();},zc:function(a,b,c,f){Z.framebufferRenderbuffer(a,
|
|
8208
|
+
b,c,md[f]);},Ac:function(a,b,c,f,h){Z.framebufferTexture2D(a,b,c,ha[f],h);},za:function(a){Z.frontFace(a);},Aa:function(a,b){Jd(a,b,"createBuffer",jd);},Bc:function(a,b){Jd(a,b,"createFramebuffer",ld);},$b:function(a,b){Jd(a,b,"createQuery",pd);},Vb:function(a,b){for(var c=0;c<a;c++){var f=Z.ze.createQueryEXT();if(!f){for(vd(1282);c<a;)Q[b+4*c++>>2]=0;break}var h=da(pd);f.name=h;pd[h]=f;Q[b+4*c>>2]=h;}},Cc:function(a,b){Jd(a,b,"createRenderbuffer",md);},ec:function(a,b){Jd(a,b,"createSampler",qd);},Ba:function(a,
|
|
8209
|
+
b){Jd(a,b,"createTexture",ha);},Rc:Kd,Vc:Kd,qc:function(a){Z.generateMipmap(a);},Ca:function(a,b,c){c?Q[c>>2]=Z.getBufferParameter(a,b):vd(1281);},Da:function(){var a=Z.getError()||wd;wd=0;return a},Ea:function(a,b){Md(a,b,2);},rc:function(a,b,c,f){a=Z.getFramebufferAttachmentParameter(a,b,c);if(a instanceof WebGLRenderbuffer||a instanceof WebGLTexture)a=a.name|0;Q[f>>2]=a;},Fa:Nd,Ga:function(a,b,c,f){a=Z.getProgramInfoLog(kd[a]);null===a&&(a="(unknown error)");b=0<b&&f?oa(a,J,f,b):0;c&&(Q[c>>2]=b);},Ha:function(a,
|
|
8210
|
+
b,c){if(c)if(a>=hd)vd(1281);else if(a=kd[a],35716==b)a=Z.getProgramInfoLog(a),null===a&&(a="(unknown error)"),Q[c>>2]=a.length+1;else if(35719==b){if(!a.sf)for(b=0;b<Z.getProgramParameter(a,35718);++b)a.sf=Math.max(a.sf,Z.getActiveUniform(a,b).name.length+1);Q[c>>2]=a.sf;}else if(35722==b){if(!a.qf)for(b=0;b<Z.getProgramParameter(a,35721);++b)a.qf=Math.max(a.qf,Z.getActiveAttrib(a,b).name.length+1);Q[c>>2]=a.qf;}else if(35381==b){if(!a.rf)for(b=0;b<Z.getProgramParameter(a,35382);++b)a.rf=Math.max(a.rf,
|
|
8211
|
+
Z.getActiveUniformBlockName(a,b).length+1);Q[c>>2]=a.rf;}else Q[c>>2]=Z.getProgramParameter(a,b);else vd(1281);},Pb:Od,Qb:Od,ac:function(a,b,c){if(c){a=Z.getQueryParameter(pd[a],b);var f;"boolean"==typeof a?f=a?1:0:f=a;Q[c>>2]=f;}else vd(1281);},Wb:function(a,b,c){if(c){a=Z.ze.getQueryObjectEXT(pd[a],b);var f;"boolean"==typeof a?f=a?1:0:f=a;Q[c>>2]=f;}else vd(1281);},bc:function(a,b,c){c?Q[c>>2]=Z.getQuery(a,b):vd(1281);},Xb:function(a,b,c){c?Q[c>>2]=Z.ze.getQueryEXT(a,b):vd(1281);},sc:function(a,b,c){c?
|
|
8212
|
+
Q[c>>2]=Z.getRenderbufferParameter(a,b):vd(1281);},Ia:function(a,b,c,f){a=Z.getShaderInfoLog(nd[a]);null===a&&(a="(unknown error)");b=0<b&&f?oa(a,J,f,b):0;c&&(Q[c>>2]=b);},Mb:function(a,b,c,f){a=Z.getShaderPrecisionFormat(a,b);Q[c>>2]=a.rangeMin;Q[c+4>>2]=a.rangeMax;Q[f>>2]=a.precision;},Ja:function(a,b,c){c?35716==b?(a=Z.getShaderInfoLog(nd[a]),null===a&&(a="(unknown error)"),Q[c>>2]=a?a.length+1:0):35720==b?(a=Z.getShaderSource(nd[a]),Q[c>>2]=a?a.length+1:0):Q[c>>2]=Z.getShaderParameter(nd[a],b):vd(1281);},
|
|
8213
|
+
Ka:Rd,Sc:Sd,La:function(a,b){b=b?vb(J,b):"";if(a=kd[a]){var c=a,f=c.ff,h=c.Qf,m;if(!f)for(c.ff=f={},c.Pf={},m=0;m<Z.getProgramParameter(c,35718);++m){var u=Z.getActiveUniform(c,m);var n=u.name;u=u.size;var p=Td(n);p=0<p?n.slice(0,p):n;var v=c.Ef;c.Ef+=u;h[p]=[u,v];for(n=0;n<u;++n)f[v]=n,c.Pf[v++]=p;}c=a.ff;f=0;h=b;m=Td(b);0<m&&(f=parseInt(b.slice(m+1))>>>0,h=b.slice(0,m));if((h=a.Qf[h])&&f<h[0]&&(f+=h[1],c[f]=c[f]||Z.getUniformLocation(a,b)))return f}else vd(1281);return -1},Nb:function(a,b,c){for(var f=
|
|
8214
|
+
Fd[b],h=0;h<b;h++)f[h]=Q[c+4*h>>2];Z.invalidateFramebuffer(a,f);},Ob:function(a,b,c,f,h,m,u){for(var n=Fd[b],p=0;p<b;p++)n[p]=Q[c+4*p>>2];Z.invalidateSubFramebuffer(a,n,f,h,m,u);},jc:function(a){return Z.isSync(rd[a])},Ma:function(a){return (a=ha[a])?Z.isTexture(a):0},Na:function(a){Z.lineWidth(a);},Oa:function(a){a=kd[a];Z.linkProgram(a);a.ff=0;a.Qf={};},Hc:function(a,b,c,f,h,m){Z.Mf.multiDrawArraysInstancedBaseInstanceWEBGL(a,Q,b>>2,Q,c>>2,Q,f>>2,Ta,h>>2,m);},Ic:function(a,b,c,f,h,m,u,n){Z.Mf.multiDrawElementsInstancedBaseVertexBaseInstanceWEBGL(a,
|
|
8215
|
+
Q,b>>2,c,Q,f>>2,Q,h>>2,Q,m>>2,Ta,u>>2,n);},Pa:function(a,b){3317==a&&(ud=b);Z.pixelStorei(a,b);},Rb:function(a,b){Z.ze.queryCounterEXT(pd[a],b);},Kc:function(a){Z.readBuffer(a);},Qa:function(a,b,c,f,h,m,u){if(2<=B.version)if(Z.zf)Z.readPixels(a,b,c,f,h,m,u);else {var n=Ud(m);Z.readPixels(a,b,c,f,h,m,n,u>>31-Math.clz32(n.BYTES_PER_ELEMENT));}else (u=Vd(m,h,c,f,u))?Z.readPixels(a,b,c,f,h,m,u):vd(1280);},tc:function(a,b,c,f){Z.renderbufferStorage(a,b,c,f);},pc:function(a,b,c,f,h){Z.renderbufferStorageMultisample(a,
|
|
8216
|
+
b,c,f,h);},fc:function(a,b,c){Z.samplerParameterf(qd[a],b,c);},gc:function(a,b,c){Z.samplerParameteri(qd[a],b,c);},hc:function(a,b,c){Z.samplerParameteri(qd[a],b,Q[c>>2]);},Ra:function(a,b,c,f){Z.scissor(a,b,c,f);},Sa:function(a,b,c,f){for(var h="",m=0;m<b;++m){var u=f?Q[f+4*m>>2]:-1,n=Q[c+4*m>>2];u=n?vb(J,n,0>u?void 0:u):"";h+=u;}Z.shaderSource(nd[a],h);},Ta:function(a,b,c){Z.stencilFunc(a,b,c);},Ua:function(a,b,c,f){Z.stencilFuncSeparate(a,b,c,f);},Va:function(a){Z.stencilMask(a);},Wa:function(a,b){Z.stencilMaskSeparate(a,
|
|
8217
|
+
b);},Xa:function(a,b,c){Z.stencilOp(a,b,c);},Ya:function(a,b,c,f){Z.stencilOpSeparate(a,b,c,f);},Za:function(a,b,c,f,h,m,u,n,p){if(2<=B.version)if(Z.We)Z.texImage2D(a,b,c,f,h,m,u,n,p);else if(p){var v=Ud(n);Z.texImage2D(a,b,c,f,h,m,u,n,v,p>>31-Math.clz32(v.BYTES_PER_ELEMENT));}else Z.texImage2D(a,b,c,f,h,m,u,n,null);else Z.texImage2D(a,b,c,f,h,m,u,n,p?Vd(n,u,f,h,p):null);},_a:function(a,b,c){Z.texParameterf(a,b,c);},$a:function(a,b,c){Z.texParameterf(a,b,R[c>>2]);},ab:function(a,b,c){Z.texParameteri(a,b,
|
|
8218
|
+
c);},bb:function(a,b,c){Z.texParameteri(a,b,Q[c>>2]);},Ec:function(a,b,c,f,h){Z.texStorage2D(a,b,c,f,h);},cb:function(a,b,c,f,h,m,u,n,p){if(2<=B.version)if(Z.We)Z.texSubImage2D(a,b,c,f,h,m,u,n,p);else if(p){var v=Ud(n);Z.texSubImage2D(a,b,c,f,h,m,u,n,v,p>>31-Math.clz32(v.BYTES_PER_ELEMENT));}else Z.texSubImage2D(a,b,c,f,h,m,u,n,null);else v=null,p&&(v=Vd(n,u,h,m,p)),Z.texSubImage2D(a,b,c,f,h,m,u,n,v);},db:function(a,b){Z.uniform1f(Wd(a),b);},eb:function(a,b,c){if(2<=B.version)b&&Z.uniform1fv(Wd(a),R,c>>
|
|
8219
|
+
2,b);else {if(288>=b)for(var f=Xd[b-1],h=0;h<b;++h)f[h]=R[c+4*h>>2];else f=R.subarray(c>>2,c+4*b>>2);Z.uniform1fv(Wd(a),f);}},od:function(a,b){Z.uniform1i(Wd(a),b);},pd:function(a,b,c){if(2<=B.version)b&&Z.uniform1iv(Wd(a),Q,c>>2,b);else {if(288>=b)for(var f=Yd[b-1],h=0;h<b;++h)f[h]=Q[c+4*h>>2];else f=Q.subarray(c>>2,c+4*b>>2);Z.uniform1iv(Wd(a),f);}},qd:function(a,b,c){Z.uniform2f(Wd(a),b,c);},rd:function(a,b,c){if(2<=B.version)b&&Z.uniform2fv(Wd(a),R,c>>2,2*b);else {if(144>=b)for(var f=Xd[2*b-1],h=0;h<
|
|
8220
|
+
2*b;h+=2)f[h]=R[c+4*h>>2],f[h+1]=R[c+(4*h+4)>>2];else f=R.subarray(c>>2,c+8*b>>2);Z.uniform2fv(Wd(a),f);}},nd:function(a,b,c){Z.uniform2i(Wd(a),b,c);},md:function(a,b,c){if(2<=B.version)b&&Z.uniform2iv(Wd(a),Q,c>>2,2*b);else {if(144>=b)for(var f=Yd[2*b-1],h=0;h<2*b;h+=2)f[h]=Q[c+4*h>>2],f[h+1]=Q[c+(4*h+4)>>2];else f=Q.subarray(c>>2,c+8*b>>2);Z.uniform2iv(Wd(a),f);}},ld:function(a,b,c,f){Z.uniform3f(Wd(a),b,c,f);},kd:function(a,b,c){if(2<=B.version)b&&Z.uniform3fv(Wd(a),R,c>>2,3*b);else {if(96>=b)for(var f=
|
|
8221
|
+
Xd[3*b-1],h=0;h<3*b;h+=3)f[h]=R[c+4*h>>2],f[h+1]=R[c+(4*h+4)>>2],f[h+2]=R[c+(4*h+8)>>2];else f=R.subarray(c>>2,c+12*b>>2);Z.uniform3fv(Wd(a),f);}},jd:function(a,b,c,f){Z.uniform3i(Wd(a),b,c,f);},id:function(a,b,c){if(2<=B.version)b&&Z.uniform3iv(Wd(a),Q,c>>2,3*b);else {if(96>=b)for(var f=Yd[3*b-1],h=0;h<3*b;h+=3)f[h]=Q[c+4*h>>2],f[h+1]=Q[c+(4*h+4)>>2],f[h+2]=Q[c+(4*h+8)>>2];else f=Q.subarray(c>>2,c+12*b>>2);Z.uniform3iv(Wd(a),f);}},hd:function(a,b,c,f,h){Z.uniform4f(Wd(a),b,c,f,h);},gd:function(a,b,c){if(2<=
|
|
8222
|
+
B.version)b&&Z.uniform4fv(Wd(a),R,c>>2,4*b);else {if(72>=b){var f=Xd[4*b-1],h=R;c>>=2;for(var m=0;m<4*b;m+=4){var u=c+m;f[m]=h[u];f[m+1]=h[u+1];f[m+2]=h[u+2];f[m+3]=h[u+3];}}else f=R.subarray(c>>2,c+16*b>>2);Z.uniform4fv(Wd(a),f);}},Wc:function(a,b,c,f,h){Z.uniform4i(Wd(a),b,c,f,h);},Xc:function(a,b,c){if(2<=B.version)b&&Z.uniform4iv(Wd(a),Q,c>>2,4*b);else {if(72>=b)for(var f=Yd[4*b-1],h=0;h<4*b;h+=4)f[h]=Q[c+4*h>>2],f[h+1]=Q[c+(4*h+4)>>2],f[h+2]=Q[c+(4*h+8)>>2],f[h+3]=Q[c+(4*h+12)>>2];else f=Q.subarray(c>>
|
|
8223
|
+
2,c+16*b>>2);Z.uniform4iv(Wd(a),f);}},Yc:function(a,b,c,f){if(2<=B.version)b&&Z.uniformMatrix2fv(Wd(a),!!c,R,f>>2,4*b);else {if(72>=b)for(var h=Xd[4*b-1],m=0;m<4*b;m+=4)h[m]=R[f+4*m>>2],h[m+1]=R[f+(4*m+4)>>2],h[m+2]=R[f+(4*m+8)>>2],h[m+3]=R[f+(4*m+12)>>2];else h=R.subarray(f>>2,f+16*b>>2);Z.uniformMatrix2fv(Wd(a),!!c,h);}},Zc:function(a,b,c,f){if(2<=B.version)b&&Z.uniformMatrix3fv(Wd(a),!!c,R,f>>2,9*b);else {if(32>=b)for(var h=Xd[9*b-1],m=0;m<9*b;m+=9)h[m]=R[f+4*m>>2],h[m+1]=R[f+(4*m+4)>>2],h[m+2]=R[f+
|
|
8224
|
+
(4*m+8)>>2],h[m+3]=R[f+(4*m+12)>>2],h[m+4]=R[f+(4*m+16)>>2],h[m+5]=R[f+(4*m+20)>>2],h[m+6]=R[f+(4*m+24)>>2],h[m+7]=R[f+(4*m+28)>>2],h[m+8]=R[f+(4*m+32)>>2];else h=R.subarray(f>>2,f+36*b>>2);Z.uniformMatrix3fv(Wd(a),!!c,h);}},_c:function(a,b,c,f){if(2<=B.version)b&&Z.uniformMatrix4fv(Wd(a),!!c,R,f>>2,16*b);else {if(18>=b){var h=Xd[16*b-1],m=R;f>>=2;for(var u=0;u<16*b;u+=16){var n=f+u;h[u]=m[n];h[u+1]=m[n+1];h[u+2]=m[n+2];h[u+3]=m[n+3];h[u+4]=m[n+4];h[u+5]=m[n+5];h[u+6]=m[n+6];h[u+7]=m[n+7];h[u+8]=m[n+
|
|
8225
|
+
8];h[u+9]=m[n+9];h[u+10]=m[n+10];h[u+11]=m[n+11];h[u+12]=m[n+12];h[u+13]=m[n+13];h[u+14]=m[n+14];h[u+15]=m[n+15];}}else h=R.subarray(f>>2,f+64*b>>2);Z.uniformMatrix4fv(Wd(a),!!c,h);}},$c:function(a){a=kd[a];Z.useProgram(a);Z.bg=a;},ad:function(a,b){Z.vertexAttrib1f(a,b);},bd:function(a,b){Z.vertexAttrib2f(a,R[b>>2],R[b+4>>2]);},cd:function(a,b){Z.vertexAttrib3f(a,R[b>>2],R[b+4>>2],R[b+8>>2]);},dd:function(a,b){Z.vertexAttrib4f(a,R[b>>2],R[b+4>>2],R[b+8>>2],R[b+12>>2]);},Fc:function(a,b){Z.vertexAttribDivisor(a,
|
|
8226
|
+
b);},Gc:function(a,b,c,f,h){Z.vertexAttribIPointer(a,b,c,f,h);},ed:function(a,b,c,f,h,m){Z.vertexAttribPointer(a,b,c,!!f,h,m);},fd:function(a,b,c,f){Z.viewport(a,b,c,f);},kc:function(a,b,c,f){Z.waitSync(rd[a],b,(c>>>0)+4294967296*f);},qb:a=>{var b=J.length;a>>>=0;if(2147483648<a)return false;for(var c=1;4>=c;c*=2){var f=b*(1+.2/c);f=Math.min(f,a+100663296);var h=Math;f=Math.max(a,f);a:{h=h.min.call(h,2147483648,f+(65536-f%65536)%65536)-La.buffer.byteLength+65535>>>16;try{La.grow(h);Wa();var m=1;break a}catch(u){}m=
|
|
8227
|
+
void 0;}if(m)return true}return false},hb:function(){return B?B.handle:0},rb:(a,b)=>{var c=0;ae().forEach(function(f,h){var m=b+c;h=Ta[a+4*h>>2]=m;for(m=0;m<f.length;++m)Qa[h++>>0]=f.charCodeAt(m);Qa[h>>0]=0;c+=f.length+1;});return 0},sb:(a,b)=>{var c=ae();Ta[a>>2]=c.length;var f=0;c.forEach(function(h){f+=h.length+1;});Ta[b>>2]=f;return 0},Eb:a=>{va(a,new sb(a));},M:()=>52,jb:function(){return 52},xb:()=>52,mb:function(){return 70},Q:(a,b,c,f)=>{for(var h=0,
|
|
8228
|
+
m=0;m<c;m++){var u=Ta[b>>2],n=Ta[b+4>>2];b+=8;for(var p=0;p<n;p++){var v=J[u+p],E=be[a];0===v||10===v?((1===a?Ha:Ia)(vb(E,0)),E.length=0):E.push(v);}h+=n;}Ta[f>>2]=h;return 0},yd:zd,ib:Bd,xd:Cd,Kb:Dd,L:Nd,P:Rd,fb:Sd,Ib:me,j:ne,o:oe,k:pe,I:qe,Hb:re,Fb:se,W:te,V:ue,O:ve,i:we,w:xe,v:ye,s:ze,Gb:Ae,Jb:Be,Lb:Ce,ob:(a,b,c,f)=>ge(a,b,c,f)};
|
|
8229
|
+
(function(){function a(c){Ma=c=c.exports;La=Ma.zd;Wa();Xa=Ma.Cd;Za.unshift(Ma.Ad);eb--;w.monitorRunDependencies&&w.monitorRunDependencies(eb);if(0==eb&&(gb)){var f=gb;gb=null;f();}return c}var b={a:De};eb++;w.monitorRunDependencies&&w.monitorRunDependencies(eb);if(w.instantiateWasm)try{return w.instantiateWasm(b,a)}catch(c){Ia("Module.instantiateWasm callback failed with error: "+c),ca(c);}rb(b,function(c){a(c.instance);}).catch(ca);return {}})();
|
|
8230
|
+
var Pd=w._malloc=a=>(Pd=w._malloc=Ma.Bd)(a),xc=w._free=a=>(xc=w._free=Ma.Dd)(a),wc=a=>(wc=Ma.Ed)(a);w.__embind_initialize_bindings=()=>(w.__embind_initialize_bindings=Ma.Fd)();var Ee=(a,b)=>(Ee=Ma.Gd)(a,b),Fe=()=>(Fe=Ma.Hd)(),Ge=a=>(Ge=Ma.Id)(a);w.dynCall_viji=(a,b,c,f,h)=>(w.dynCall_viji=Ma.Jd)(a,b,c,f,h);w.dynCall_vijiii=(a,b,c,f,h,m,u)=>(w.dynCall_vijiii=Ma.Kd)(a,b,c,f,h,m,u);w.dynCall_viiiiij=(a,b,c,f,h,m,u,n)=>(w.dynCall_viiiiij=Ma.Ld)(a,b,c,f,h,m,u,n);
|
|
8231
|
+
w.dynCall_jii=(a,b,c)=>(w.dynCall_jii=Ma.Md)(a,b,c);w.dynCall_vij=(a,b,c,f)=>(w.dynCall_vij=Ma.Nd)(a,b,c,f);w.dynCall_jiiiiii=(a,b,c,f,h,m,u)=>(w.dynCall_jiiiiii=Ma.Od)(a,b,c,f,h,m,u);w.dynCall_jiiiiji=(a,b,c,f,h,m,u,n)=>(w.dynCall_jiiiiji=Ma.Pd)(a,b,c,f,h,m,u,n);w.dynCall_ji=(a,b)=>(w.dynCall_ji=Ma.Qd)(a,b);w.dynCall_iijj=(a,b,c,f,h,m)=>(w.dynCall_iijj=Ma.Rd)(a,b,c,f,h,m);w.dynCall_iiiji=(a,b,c,f,h,m)=>(w.dynCall_iiiji=Ma.Sd)(a,b,c,f,h,m);
|
|
8232
|
+
w.dynCall_iiji=(a,b,c,f,h)=>(w.dynCall_iiji=Ma.Td)(a,b,c,f,h);w.dynCall_iijjiii=(a,b,c,f,h,m,u,n,p)=>(w.dynCall_iijjiii=Ma.Ud)(a,b,c,f,h,m,u,n,p);w.dynCall_iij=(a,b,c,f)=>(w.dynCall_iij=Ma.Vd)(a,b,c,f);w.dynCall_vijjjii=(a,b,c,f,h,m,u,n,p,v)=>(w.dynCall_vijjjii=Ma.Wd)(a,b,c,f,h,m,u,n,p,v);w.dynCall_jiji=(a,b,c,f,h)=>(w.dynCall_jiji=Ma.Xd)(a,b,c,f,h);w.dynCall_viijii=(a,b,c,f,h,m,u)=>(w.dynCall_viijii=Ma.Yd)(a,b,c,f,h,m,u);w.dynCall_iiiiij=(a,b,c,f,h,m,u)=>(w.dynCall_iiiiij=Ma.Zd)(a,b,c,f,h,m,u);
|
|
8233
|
+
w.dynCall_iiiiijj=(a,b,c,f,h,m,u,n,p)=>(w.dynCall_iiiiijj=Ma._d)(a,b,c,f,h,m,u,n,p);w.dynCall_iiiiiijj=(a,b,c,f,h,m,u,n,p,v)=>(w.dynCall_iiiiiijj=Ma.$d)(a,b,c,f,h,m,u,n,p,v);function pe(a,b,c,f){var h=Fe();try{return Xa.get(a)(b,c,f)}catch(m){Ge(h);if(m!==m+0)throw m;Ee(1,0);}}function Ce(a,b,c,f,h,m,u,n,p,v){var E=Fe();try{Xa.get(a)(b,c,f,h,m,u,n,p,v);}catch(G){Ge(E);if(G!==G+0)throw G;Ee(1,0);}}function ye(a,b,c,f){var h=Fe();try{Xa.get(a)(b,c,f);}catch(m){Ge(h);if(m!==m+0)throw m;Ee(1,0);}}
|
|
8234
|
+
function xe(a,b,c){var f=Fe();try{Xa.get(a)(b,c);}catch(h){Ge(f);if(h!==h+0)throw h;Ee(1,0);}}function ve(a){var b=Fe();try{Xa.get(a)();}catch(c){Ge(b);if(c!==c+0)throw c;Ee(1,0);}}function ne(a,b){var c=Fe();try{return Xa.get(a)(b)}catch(f){Ge(c);if(f!==f+0)throw f;Ee(1,0);}}function ze(a,b,c,f,h){var m=Fe();try{Xa.get(a)(b,c,f,h);}catch(u){Ge(m);if(u!==u+0)throw u;Ee(1,0);}}function we(a,b){var c=Fe();try{Xa.get(a)(b);}catch(f){Ge(c);if(f!==f+0)throw f;Ee(1,0);}}
|
|
8235
|
+
function oe(a,b,c){var f=Fe();try{return Xa.get(a)(b,c)}catch(h){Ge(f);if(h!==h+0)throw h;Ee(1,0);}}function Be(a,b,c,f,h,m,u){var n=Fe();try{Xa.get(a)(b,c,f,h,m,u);}catch(p){Ge(n);if(p!==p+0)throw p;Ee(1,0);}}function me(a){var b=Fe();try{return Xa.get(a)()}catch(c){Ge(b);if(c!==c+0)throw c;Ee(1,0);}}function re(a,b,c,f,h,m){var u=Fe();try{return Xa.get(a)(b,c,f,h,m)}catch(n){Ge(u);if(n!==n+0)throw n;Ee(1,0);}}
|
|
8236
|
+
function te(a,b,c,f,h,m,u,n){var p=Fe();try{return Xa.get(a)(b,c,f,h,m,u,n)}catch(v){Ge(p);if(v!==v+0)throw v;Ee(1,0);}}function Ae(a,b,c,f,h,m){var u=Fe();try{Xa.get(a)(b,c,f,h,m);}catch(n){Ge(u);if(n!==n+0)throw n;Ee(1,0);}}function qe(a,b,c,f,h){var m=Fe();try{return Xa.get(a)(b,c,f,h)}catch(u){Ge(m);if(u!==u+0)throw u;Ee(1,0);}}function ue(a,b,c,f,h,m,u,n,p,v){var E=Fe();try{return Xa.get(a)(b,c,f,h,m,u,n,p,v)}catch(G){Ge(E);if(G!==G+0)throw G;Ee(1,0);}}
|
|
8237
|
+
function se(a,b,c,f,h,m,u){var n=Fe();try{return Xa.get(a)(b,c,f,h,m,u)}catch(p){Ge(n);if(p!==p+0)throw p;Ee(1,0);}}var He;gb=function Ie(){He||Je();He||(gb=Ie);};
|
|
8238
|
+
function Je(){function a(){if(!He&&(He=true,w.calledRun=true,!Na)){tb(Za);aa(w);if(w.onRuntimeInitialized)w.onRuntimeInitialized();if(w.postRun)for("function"==typeof w.postRun&&(w.postRun=[w.postRun]);w.postRun.length;){var b=w.postRun.shift();$a.unshift(b);}tb($a);}}if(!(0<eb)){if(w.preRun)for("function"==typeof w.preRun&&(w.preRun=[w.preRun]);w.preRun.length;)ab();tb(Ya);0<eb||(w.setStatus?(w.setStatus("Running..."),setTimeout(function(){setTimeout(function(){w.setStatus("");},1);a();},1)):a());}}
|
|
8239
|
+
if(w.preInit)for("function"==typeof w.preInit&&(w.preInit=[w.preInit]);0<w.preInit.length;)w.preInit.pop()();Je();
|
|
8059
8240
|
|
|
8060
8241
|
|
|
8061
8242
|
return moduleArg.ready
|
|
@@ -8248,7 +8429,7 @@ class SoundManager {
|
|
|
8248
8429
|
get audioContext() {
|
|
8249
8430
|
if (!this._audioContext) {
|
|
8250
8431
|
if (!navigator.userActivation.hasBeenActive) {
|
|
8251
|
-
throw new
|
|
8432
|
+
throw new M2Error(
|
|
8252
8433
|
"AudioContext cannot be created until user has interacted with the page"
|
|
8253
8434
|
);
|
|
8254
8435
|
}
|
|
@@ -8325,7 +8506,7 @@ class SoundManager {
|
|
|
8325
8506
|
return fetch(m2Sound.url).then((response) => {
|
|
8326
8507
|
if (!response.ok) {
|
|
8327
8508
|
m2Sound.status = M2SoundStatus.Error;
|
|
8328
|
-
throw new
|
|
8509
|
+
throw new M2Error(
|
|
8329
8510
|
`cannot fetch sound ${m2Sound.soundName} at url ${m2Sound.url}: ${response.statusText}`
|
|
8330
8511
|
);
|
|
8331
8512
|
}
|
|
@@ -8390,7 +8571,7 @@ class SoundManager {
|
|
|
8390
8571
|
*/
|
|
8391
8572
|
async decodeSound(sound) {
|
|
8392
8573
|
if (!sound.data) {
|
|
8393
|
-
throw new
|
|
8574
|
+
throw new M2Error(
|
|
8394
8575
|
`data is undefined for sound ${sound.soundName} (url ${sound.url})`
|
|
8395
8576
|
);
|
|
8396
8577
|
}
|
|
@@ -8404,7 +8585,7 @@ class SoundManager {
|
|
|
8404
8585
|
);
|
|
8405
8586
|
} catch {
|
|
8406
8587
|
sound.status = M2SoundStatus.Error;
|
|
8407
|
-
throw new
|
|
8588
|
+
throw new M2Error(
|
|
8408
8589
|
`error decoding sound ${sound.soundName} (url: ${sound.url})`
|
|
8409
8590
|
);
|
|
8410
8591
|
}
|
|
@@ -8424,7 +8605,7 @@ class SoundManager {
|
|
|
8424
8605
|
getSound(soundName) {
|
|
8425
8606
|
const sound = this.sounds[soundName];
|
|
8426
8607
|
if (!sound) {
|
|
8427
|
-
throw new
|
|
8608
|
+
throw new M2Error(`getSound(): sound ${soundName} not found`);
|
|
8428
8609
|
}
|
|
8429
8610
|
return sound;
|
|
8430
8611
|
}
|
|
@@ -8550,7 +8731,7 @@ class EventMaterializer {
|
|
|
8550
8731
|
if (node.type === M2NodeType.Composite) {
|
|
8551
8732
|
node.handleCompositeEvent(event);
|
|
8552
8733
|
} else {
|
|
8553
|
-
throw new
|
|
8734
|
+
throw new M2Error(
|
|
8554
8735
|
`EventMaterializer: node was expected to be composite, but was of type ${node.type}`
|
|
8555
8736
|
);
|
|
8556
8737
|
}
|
|
@@ -8579,14 +8760,14 @@ class EventMaterializer {
|
|
|
8579
8760
|
(n) => n.uuid === nodePropertyChangeEvent.uuid
|
|
8580
8761
|
);
|
|
8581
8762
|
if (!node) {
|
|
8582
|
-
throw new
|
|
8763
|
+
throw new M2Error(
|
|
8583
8764
|
`EventMaterializer: node with uuid ${nodePropertyChangeEvent.uuid} not found`
|
|
8584
8765
|
);
|
|
8585
8766
|
}
|
|
8586
8767
|
if (nodePropertyChangeEvent.property in node) {
|
|
8587
8768
|
node[nodePropertyChangeEvent.property] = nodePropertyChangeEvent.value;
|
|
8588
8769
|
} else {
|
|
8589
|
-
throw new
|
|
8770
|
+
throw new M2Error(
|
|
8590
8771
|
`EventMaterializer: on node ${node.name}, type ${node.type}, nodePropertyChangeEvent tried to set unknown property ${nodePropertyChangeEvent.property} to value ${JSON.stringify(nodePropertyChangeEvent.value)}`
|
|
8591
8772
|
);
|
|
8592
8773
|
}
|
|
@@ -8596,7 +8777,7 @@ class EventMaterializer {
|
|
|
8596
8777
|
(n) => n.uuid === nodeAddChildEvent.uuid
|
|
8597
8778
|
);
|
|
8598
8779
|
if (!parent) {
|
|
8599
|
-
throw new
|
|
8780
|
+
throw new M2Error(
|
|
8600
8781
|
`EventMaterializer: parent node with uuid ${nodeAddChildEvent.uuid} not found`
|
|
8601
8782
|
);
|
|
8602
8783
|
}
|
|
@@ -8604,7 +8785,7 @@ class EventMaterializer {
|
|
|
8604
8785
|
(n) => n.uuid === nodeAddChildEvent.childUuid
|
|
8605
8786
|
);
|
|
8606
8787
|
if (!child) {
|
|
8607
|
-
throw new
|
|
8788
|
+
throw new M2Error(
|
|
8608
8789
|
`EventMaterializer: child node with uuid ${nodeAddChildEvent.childUuid} not found`
|
|
8609
8790
|
);
|
|
8610
8791
|
}
|
|
@@ -8615,7 +8796,7 @@ class EventMaterializer {
|
|
|
8615
8796
|
(n) => n.uuid === nodeRemoveChildEvent.uuid
|
|
8616
8797
|
);
|
|
8617
8798
|
if (!parent) {
|
|
8618
|
-
throw new
|
|
8799
|
+
throw new M2Error(
|
|
8619
8800
|
`EventMaterializer: parent node with uuid ${nodeRemoveChildEvent.uuid} not found`
|
|
8620
8801
|
);
|
|
8621
8802
|
}
|
|
@@ -8623,7 +8804,7 @@ class EventMaterializer {
|
|
|
8623
8804
|
(n) => n.uuid === nodeRemoveChildEvent.childUuid
|
|
8624
8805
|
);
|
|
8625
8806
|
if (!child) {
|
|
8626
|
-
throw new
|
|
8807
|
+
throw new M2Error(
|
|
8627
8808
|
`EventMaterializer: child node with uuid ${nodeRemoveChildEvent.childUuid} not found`
|
|
8628
8809
|
);
|
|
8629
8810
|
}
|
|
@@ -8683,17 +8864,17 @@ class EventMaterializer {
|
|
|
8683
8864
|
let transition = Transition.none();
|
|
8684
8865
|
if (scenePresentEvent.transitionType === TransitionType.Slide) {
|
|
8685
8866
|
if (scenePresentEvent.direction === void 0) {
|
|
8686
|
-
throw new
|
|
8867
|
+
throw new M2Error(
|
|
8687
8868
|
"EventMaterializer: ScenePresentEvent direction is undefined for slide transition"
|
|
8688
8869
|
);
|
|
8689
8870
|
}
|
|
8690
8871
|
if (scenePresentEvent.duration === void 0) {
|
|
8691
|
-
throw new
|
|
8872
|
+
throw new M2Error(
|
|
8692
8873
|
"EventMaterializer: ScenePresentEvent duration is undefined for slide transition"
|
|
8693
8874
|
);
|
|
8694
8875
|
}
|
|
8695
8876
|
if (scenePresentEvent.easingType === void 0) {
|
|
8696
|
-
throw new
|
|
8877
|
+
throw new M2Error(
|
|
8697
8878
|
"EventMaterializer: ScenePresentEvent easingType is undefined for slide transition"
|
|
8698
8879
|
);
|
|
8699
8880
|
}
|
|
@@ -8701,7 +8882,7 @@ class EventMaterializer {
|
|
|
8701
8882
|
(s) => s.uuid === scenePresentEvent.uuid
|
|
8702
8883
|
);
|
|
8703
8884
|
if (!incomingScene) {
|
|
8704
|
-
throw new
|
|
8885
|
+
throw new M2Error(
|
|
8705
8886
|
`EventMaterializer: Scene with uuid ${scenePresentEvent.uuid} not found`
|
|
8706
8887
|
);
|
|
8707
8888
|
}
|
|
@@ -8744,7 +8925,7 @@ class Game {
|
|
|
8744
8925
|
this.sessionUuid = "";
|
|
8745
8926
|
this.uuid = Uuid.generate();
|
|
8746
8927
|
this.publishUuid = "";
|
|
8747
|
-
this.canvasKitWasmVersion = "0.
|
|
8928
|
+
this.canvasKitWasmVersion = "0.40.0";
|
|
8748
8929
|
this.beginTimestamp = NaN;
|
|
8749
8930
|
this.beginIso8601Timestamp = "";
|
|
8750
8931
|
this.eventListeners = new Array();
|
|
@@ -8760,7 +8941,8 @@ class Game {
|
|
|
8760
8941
|
/** Nodes created during event replay */
|
|
8761
8942
|
this.materializedNodes = new Array();
|
|
8762
8943
|
this.data = {
|
|
8763
|
-
trials: new Array()
|
|
8944
|
+
trials: new Array(),
|
|
8945
|
+
scoring: {}
|
|
8764
8946
|
};
|
|
8765
8947
|
/** The 0-based index of the current trial */
|
|
8766
8948
|
this.trialIndex = 0;
|
|
@@ -8781,11 +8963,74 @@ class Game {
|
|
|
8781
8963
|
});
|
|
8782
8964
|
this.incomingSceneTransitions = new Array();
|
|
8783
8965
|
this.replayEventsButtonEnabled = true;
|
|
8966
|
+
/**
|
|
8967
|
+
* The m2c2kit engine will automatically include these schema and their
|
|
8968
|
+
* values in the scoring data.
|
|
8969
|
+
*/
|
|
8970
|
+
this.automaticScoringSchema = {
|
|
8971
|
+
data_type: {
|
|
8972
|
+
type: "string",
|
|
8973
|
+
description: "Type of data."
|
|
8974
|
+
},
|
|
8975
|
+
study_id: {
|
|
8976
|
+
type: ["string", "null"],
|
|
8977
|
+
description: "The short human-readable text ID of the study (protocol, experiment, or other aggregate) that contains the administration of this activity."
|
|
8978
|
+
},
|
|
8979
|
+
study_uuid: {
|
|
8980
|
+
type: ["string", "null"],
|
|
8981
|
+
format: "uuid",
|
|
8982
|
+
description: "Unique identifier of the study (protocol, experiment, or other aggregate) that contains the administration of this activity."
|
|
8983
|
+
},
|
|
8984
|
+
document_uuid: {
|
|
8985
|
+
type: "string",
|
|
8986
|
+
format: "uuid",
|
|
8987
|
+
description: "Unique identifier for this data document."
|
|
8988
|
+
},
|
|
8989
|
+
session_uuid: {
|
|
8990
|
+
type: "string",
|
|
8991
|
+
format: "uuid",
|
|
8992
|
+
description: "Unique identifier for all activities in this administration of the session. This identifier changes each time a new session starts."
|
|
8993
|
+
},
|
|
8994
|
+
activity_uuid: {
|
|
8995
|
+
type: "string",
|
|
8996
|
+
format: "uuid",
|
|
8997
|
+
description: "Unique identifier for all trials in this administration of the activity. This identifier changes each time the activity starts."
|
|
8998
|
+
},
|
|
8999
|
+
activity_id: {
|
|
9000
|
+
type: "string",
|
|
9001
|
+
description: "Human-readable identifier of the activity."
|
|
9002
|
+
},
|
|
9003
|
+
activity_publish_uuid: {
|
|
9004
|
+
type: "string",
|
|
9005
|
+
format: "uuid",
|
|
9006
|
+
description: "Persistent unique identifier of the activity. This identifier never changes. It can be used to identify the activity across different studies and sessions."
|
|
9007
|
+
},
|
|
9008
|
+
activity_version: {
|
|
9009
|
+
type: "string",
|
|
9010
|
+
description: "Version of the activity."
|
|
9011
|
+
},
|
|
9012
|
+
device_timezone: {
|
|
9013
|
+
type: "string",
|
|
9014
|
+
description: "Timezone of the device. Calculated from Intl.DateTimeFormat().resolvedOptions().timeZone."
|
|
9015
|
+
},
|
|
9016
|
+
device_timezone_offset_minutes: {
|
|
9017
|
+
type: "integer",
|
|
9018
|
+
description: "Difference in minutes between UTC and device timezone. Calculated from Date.getTimezoneOffset()."
|
|
9019
|
+
},
|
|
9020
|
+
locale: {
|
|
9021
|
+
type: ["string", "null"],
|
|
9022
|
+
description: "Locale of the trial. null if the activity does not support localization."
|
|
9023
|
+
}
|
|
9024
|
+
};
|
|
8784
9025
|
/**
|
|
8785
9026
|
* The m2c2kit engine will automatically include these schema and their
|
|
8786
9027
|
* values in the trial data.
|
|
8787
9028
|
*/
|
|
8788
9029
|
this.automaticTrialSchema = {
|
|
9030
|
+
data_type: {
|
|
9031
|
+
type: "string",
|
|
9032
|
+
description: "Type of data."
|
|
9033
|
+
},
|
|
8789
9034
|
study_id: {
|
|
8790
9035
|
type: ["string", "null"],
|
|
8791
9036
|
description: "The short human-readable text ID of the study (protocol, experiment, or other aggregate) that contains the administration of this activity."
|
|
@@ -8838,7 +9083,7 @@ class Game {
|
|
|
8838
9083
|
};
|
|
8839
9084
|
this.snapshots = new Array();
|
|
8840
9085
|
if (!options.id || options.id.trim() === "") {
|
|
8841
|
-
throw new
|
|
9086
|
+
throw new M2Error("id is required in GameOptions");
|
|
8842
9087
|
}
|
|
8843
9088
|
if (!Uuid.isValid(options.publishUuid)) {
|
|
8844
9089
|
const providedPublishUuid = options.publishUuid ? `Provided publishUuid was ${options.publishUuid}. ` : "";
|
|
@@ -8873,6 +9118,9 @@ class Game {
|
|
|
8873
9118
|
if (!this.options.trialSchema) {
|
|
8874
9119
|
this.options.trialSchema = {};
|
|
8875
9120
|
}
|
|
9121
|
+
if (!this.options.scoringSchema) {
|
|
9122
|
+
this.options.scoringSchema = {};
|
|
9123
|
+
}
|
|
8876
9124
|
if (options.moduleMetadata) {
|
|
8877
9125
|
this.moduleMetadata = options.moduleMetadata;
|
|
8878
9126
|
} else {
|
|
@@ -8906,15 +9154,51 @@ class Game {
|
|
|
8906
9154
|
};
|
|
8907
9155
|
this.eventStore.addEvent(freeNodesSceneNewEvent);
|
|
8908
9156
|
}
|
|
9157
|
+
/**
|
|
9158
|
+
* Returns the base URL of an imported module.
|
|
9159
|
+
*
|
|
9160
|
+
* @remarks Previously, a regex was used:
|
|
9161
|
+
* `const regex = new RegExp(`^.*${packageName}[^\\/]*`);`
|
|
9162
|
+
* but this triggered irrelevant warnings for ReDoS in some overly
|
|
9163
|
+
* sensitive package scanners, so now we use URL and pathname parsing.
|
|
9164
|
+
* Also: trailing slashes are removed from the returned base URL.
|
|
9165
|
+
*
|
|
9166
|
+
* @param packageName - the name of the imported package module, like
|
|
9167
|
+
* `@m2c2kit/assessment-symbol-search`
|
|
9168
|
+
* @param moduleUrl - the full URL of the module's entrypoint, possibly
|
|
9169
|
+
* including a version suffix, like `https://cdn.com/@m2c2kit/assessment-symbol-search@0.8.13/dist/index.js`
|
|
9170
|
+
* @returns - the base URL of the imported module, without the entrypoint,
|
|
9171
|
+
* like `https://cdn.com/@m2c2kit/assessment-symbol-search@0.8.13`
|
|
9172
|
+
*/
|
|
8909
9173
|
getImportedModuleBaseUrl(packageName, moduleUrl) {
|
|
8910
|
-
const
|
|
8911
|
-
const
|
|
8912
|
-
|
|
9174
|
+
const url = new URL(moduleUrl);
|
|
9175
|
+
const segments = url.pathname.split("/").filter(Boolean);
|
|
9176
|
+
let lastMatchIndex = -1;
|
|
9177
|
+
for (let i = 0; i < segments.length - 1; i++) {
|
|
9178
|
+
if (packageName.startsWith("@")) {
|
|
9179
|
+
const nameParts = packageName.split("/");
|
|
9180
|
+
if (nameParts.length === 2) {
|
|
9181
|
+
const scopePart = nameParts[0];
|
|
9182
|
+
const namePart = nameParts[1];
|
|
9183
|
+
for (let i2 = 0; i2 < segments.length - 1; i2++) {
|
|
9184
|
+
if (segments[i2] === scopePart && (segments[i2 + 1] === namePart || segments[i2 + 1].startsWith(`${namePart}@`))) {
|
|
9185
|
+
lastMatchIndex = i2 + 1;
|
|
9186
|
+
}
|
|
9187
|
+
}
|
|
9188
|
+
}
|
|
9189
|
+
} else {
|
|
9190
|
+
if (segments[i] === packageName || segments[i].startsWith(`${packageName}@`)) {
|
|
9191
|
+
lastMatchIndex = i;
|
|
9192
|
+
}
|
|
9193
|
+
}
|
|
9194
|
+
}
|
|
9195
|
+
if (lastMatchIndex === -1) {
|
|
8913
9196
|
throw new Error(
|
|
8914
|
-
`Could not
|
|
9197
|
+
`Could not locate base URL for package "${packageName}" in "${moduleUrl}"`
|
|
8915
9198
|
);
|
|
8916
9199
|
}
|
|
8917
|
-
|
|
9200
|
+
const basePath = segments.slice(0, lastMatchIndex + 1).join("/");
|
|
9201
|
+
return `${url.origin}/${basePath}`.replace(/\/*$/, "");
|
|
8918
9202
|
}
|
|
8919
9203
|
addLocalizationParametersToGameParameters() {
|
|
8920
9204
|
this.options.parameters = {
|
|
@@ -8970,7 +9254,7 @@ class Game {
|
|
|
8970
9254
|
canvasKitWasmBaseUrl = game.getImportedModuleBaseUrl("@m2c2kit/core", coreModuleUrl) + "/assets";
|
|
8971
9255
|
} catch {
|
|
8972
9256
|
if (isImportedModule) {
|
|
8973
|
-
throw new
|
|
9257
|
+
throw new M2Error(
|
|
8974
9258
|
`the package ${game.moduleMetadata.name} has been imported from a module URL (${moduleUrl}), but the @m2c2kit/core package module URL could not be determined.`
|
|
8975
9259
|
);
|
|
8976
9260
|
}
|
|
@@ -8983,7 +9267,7 @@ class Game {
|
|
|
8983
9267
|
async configureI18n(localizationOptions) {
|
|
8984
9268
|
this.i18n = new I18n(this, localizationOptions);
|
|
8985
9269
|
if (!this.i18n) {
|
|
8986
|
-
throw new
|
|
9270
|
+
throw new M2Error("I18n object is undefined");
|
|
8987
9271
|
}
|
|
8988
9272
|
await this.i18n.initialize();
|
|
8989
9273
|
this.eventStore.addEvent({
|
|
@@ -9032,7 +9316,7 @@ class Game {
|
|
|
9032
9316
|
try {
|
|
9033
9317
|
this.canvasKit = await this.loadCanvasKit(manifestCanvasKitWasmUrl);
|
|
9034
9318
|
} catch (err) {
|
|
9035
|
-
throw new
|
|
9319
|
+
throw new M2Error(
|
|
9036
9320
|
`game ${this.id} could not load canvaskit wasm file from ${manifestCanvasKitWasmUrl}`
|
|
9037
9321
|
);
|
|
9038
9322
|
}
|
|
@@ -9076,24 +9360,24 @@ class Game {
|
|
|
9076
9360
|
try {
|
|
9077
9361
|
manifestResponse = await fetch(manifestJsonUrl);
|
|
9078
9362
|
if (!manifestResponse.ok) {
|
|
9079
|
-
throw new
|
|
9363
|
+
throw new M2Error(
|
|
9080
9364
|
`Error ${manifestResponse.status} on GET manifest.json from ${manifestJsonUrl}.`
|
|
9081
9365
|
);
|
|
9082
9366
|
}
|
|
9083
9367
|
} catch {
|
|
9084
|
-
throw new
|
|
9368
|
+
throw new M2Error(
|
|
9085
9369
|
`Network error on GET manifest.json from ${manifestJsonUrl}.`
|
|
9086
9370
|
);
|
|
9087
9371
|
}
|
|
9088
9372
|
try {
|
|
9089
9373
|
return await manifestResponse.json();
|
|
9090
9374
|
} catch {
|
|
9091
|
-
throw new
|
|
9375
|
+
throw new M2Error(`Error parsing manifest.json from ${manifestJsonUrl}.`);
|
|
9092
9376
|
}
|
|
9093
9377
|
}
|
|
9094
9378
|
get fontManager() {
|
|
9095
9379
|
if (!this._fontManager) {
|
|
9096
|
-
throw new
|
|
9380
|
+
throw new M2Error("fontManager is undefined");
|
|
9097
9381
|
}
|
|
9098
9382
|
return this._fontManager;
|
|
9099
9383
|
}
|
|
@@ -9102,7 +9386,7 @@ class Game {
|
|
|
9102
9386
|
}
|
|
9103
9387
|
get imageManager() {
|
|
9104
9388
|
if (!this._imageManager) {
|
|
9105
|
-
throw new
|
|
9389
|
+
throw new M2Error("imageManager is undefined");
|
|
9106
9390
|
}
|
|
9107
9391
|
return this._imageManager;
|
|
9108
9392
|
}
|
|
@@ -9111,7 +9395,7 @@ class Game {
|
|
|
9111
9395
|
}
|
|
9112
9396
|
get soundManager() {
|
|
9113
9397
|
if (!this._soundManager) {
|
|
9114
|
-
throw new
|
|
9398
|
+
throw new M2Error("soundManager is undefined");
|
|
9115
9399
|
}
|
|
9116
9400
|
return this._soundManager;
|
|
9117
9401
|
}
|
|
@@ -9120,7 +9404,7 @@ class Game {
|
|
|
9120
9404
|
}
|
|
9121
9405
|
get eventMaterializer() {
|
|
9122
9406
|
if (!this._eventMaterializer) {
|
|
9123
|
-
throw new
|
|
9407
|
+
throw new M2Error("eventMaterializer is undefined");
|
|
9124
9408
|
}
|
|
9125
9409
|
return this._eventMaterializer;
|
|
9126
9410
|
}
|
|
@@ -9145,7 +9429,7 @@ class Game {
|
|
|
9145
9429
|
if (this.studyId && this.studyUuid) {
|
|
9146
9430
|
k = this.studyId.concat(":", this.studyUuid, ":");
|
|
9147
9431
|
} else if (this.studyId || this.studyUuid) {
|
|
9148
|
-
throw new
|
|
9432
|
+
throw new M2Error(
|
|
9149
9433
|
`study_id and study_uuid must both be set or unset. Values are study_id: ${this.studyId}, study_uuid: ${this.studyUuid}`
|
|
9150
9434
|
);
|
|
9151
9435
|
}
|
|
@@ -9276,7 +9560,7 @@ class Game {
|
|
|
9276
9560
|
}
|
|
9277
9561
|
get dataStores() {
|
|
9278
9562
|
if (!this._dataStores) {
|
|
9279
|
-
throw new
|
|
9563
|
+
throw new M2Error("dataStores is undefined");
|
|
9280
9564
|
}
|
|
9281
9565
|
return this._dataStores;
|
|
9282
9566
|
}
|
|
@@ -9309,7 +9593,7 @@ class Game {
|
|
|
9309
9593
|
void 0
|
|
9310
9594
|
);
|
|
9311
9595
|
if (locale === "") {
|
|
9312
|
-
throw new
|
|
9596
|
+
throw new M2Error(
|
|
9313
9597
|
"Empty string in locale. Leave locale undefined or null to prevent localization."
|
|
9314
9598
|
);
|
|
9315
9599
|
}
|
|
@@ -9325,6 +9609,9 @@ class Game {
|
|
|
9325
9609
|
setParameters(additionalParameters) {
|
|
9326
9610
|
const { parameters } = this.options;
|
|
9327
9611
|
Object.keys(additionalParameters).forEach((key) => {
|
|
9612
|
+
if (key === "diagnostics") {
|
|
9613
|
+
return;
|
|
9614
|
+
}
|
|
9328
9615
|
if (key === "eruda") {
|
|
9329
9616
|
const erudaRequested = additionalParameters[key] === true;
|
|
9330
9617
|
if (erudaRequested) {
|
|
@@ -9354,7 +9641,7 @@ class Game {
|
|
|
9354
9641
|
this.options.parameters[key].type
|
|
9355
9642
|
);
|
|
9356
9643
|
} catch (e) {
|
|
9357
|
-
throw new
|
|
9644
|
+
throw new M2Error(
|
|
9358
9645
|
"Error setting parameter " + key + ": " + e.message
|
|
9359
9646
|
);
|
|
9360
9647
|
}
|
|
@@ -9372,7 +9659,7 @@ class Game {
|
|
|
9372
9659
|
}
|
|
9373
9660
|
get canvasKit() {
|
|
9374
9661
|
if (!this._canvasKit) {
|
|
9375
|
-
throw new
|
|
9662
|
+
throw new M2Error("canvaskit is undefined");
|
|
9376
9663
|
}
|
|
9377
9664
|
return this._canvasKit;
|
|
9378
9665
|
}
|
|
@@ -9414,7 +9701,7 @@ class Game {
|
|
|
9414
9701
|
if (typeof node === "string") {
|
|
9415
9702
|
const child = this.freeNodesScene.children.filter((child2) => child2.name === node).find(Boolean);
|
|
9416
9703
|
if (!child) {
|
|
9417
|
-
throw new
|
|
9704
|
+
throw new M2Error(
|
|
9418
9705
|
`cannot remove free node named "${node}" because it is not currently part of the game's free nodes. `
|
|
9419
9706
|
);
|
|
9420
9707
|
}
|
|
@@ -9516,7 +9803,7 @@ class Game {
|
|
|
9516
9803
|
if (this.scenes.includes(scene)) {
|
|
9517
9804
|
this.scenes = this.scenes.filter((s) => s !== scene);
|
|
9518
9805
|
} else {
|
|
9519
|
-
throw new
|
|
9806
|
+
throw new M2Error(
|
|
9520
9807
|
`cannot remove scene ${scene} from game because the scene is not currently added to the game`
|
|
9521
9808
|
);
|
|
9522
9809
|
}
|
|
@@ -9524,7 +9811,7 @@ class Game {
|
|
|
9524
9811
|
if (this.scenes.map((s) => s.name).includes(scene)) {
|
|
9525
9812
|
this.scenes = this.scenes.filter((s) => s.name !== scene);
|
|
9526
9813
|
} else {
|
|
9527
|
-
throw new
|
|
9814
|
+
throw new M2Error(
|
|
9528
9815
|
`cannot remove scene named "${scene}" from game because the scene is not currently added to the game`
|
|
9529
9816
|
);
|
|
9530
9817
|
}
|
|
@@ -9544,11 +9831,11 @@ class Game {
|
|
|
9544
9831
|
incomingScene = this.scenes.filter((scene_) => scene_.uuid === scene).find(Boolean);
|
|
9545
9832
|
}
|
|
9546
9833
|
if (incomingScene === void 0) {
|
|
9547
|
-
throw new
|
|
9834
|
+
throw new M2Error(`scene ${scene} not found`);
|
|
9548
9835
|
}
|
|
9549
9836
|
} else {
|
|
9550
9837
|
if (!this.scenes.some((scene_) => scene_ === scene)) {
|
|
9551
|
-
throw new
|
|
9838
|
+
throw new M2Error(
|
|
9552
9839
|
`scene ${scene} exists, but it has not been added to the game object`
|
|
9553
9840
|
);
|
|
9554
9841
|
}
|
|
@@ -9594,7 +9881,7 @@ class Game {
|
|
|
9594
9881
|
if (this.options.parameters !== void 0 && Object.keys(this.options.parameters).includes(parameterName)) {
|
|
9595
9882
|
return this.options.parameters[parameterName].default;
|
|
9596
9883
|
} else {
|
|
9597
|
-
throw new
|
|
9884
|
+
throw new M2Error(`game parameter ${parameterName} not found`);
|
|
9598
9885
|
}
|
|
9599
9886
|
}
|
|
9600
9887
|
/**
|
|
@@ -9671,13 +9958,13 @@ class Game {
|
|
|
9671
9958
|
startingScene = this.scenes.find(Boolean);
|
|
9672
9959
|
}
|
|
9673
9960
|
if (startingScene === void 0) {
|
|
9674
|
-
throw new
|
|
9961
|
+
throw new M2Error(
|
|
9675
9962
|
"cannot start game. entry scene has not been added to the game object."
|
|
9676
9963
|
);
|
|
9677
9964
|
}
|
|
9678
9965
|
this.presentScene(startingScene);
|
|
9679
9966
|
if (this.surface === void 0) {
|
|
9680
|
-
throw new
|
|
9967
|
+
throw new M2Error("CanvasKit surface is undefined");
|
|
9681
9968
|
}
|
|
9682
9969
|
if (this.options.timeStepping) {
|
|
9683
9970
|
this.addTimeSteppingControlsToDom();
|
|
@@ -9915,7 +10202,7 @@ class Game {
|
|
|
9915
10202
|
);
|
|
9916
10203
|
}
|
|
9917
10204
|
if (!this.surface) {
|
|
9918
|
-
throw new
|
|
10205
|
+
throw new M2Error("surface is undefined");
|
|
9919
10206
|
}
|
|
9920
10207
|
const surfaceWidth = this.surface.width();
|
|
9921
10208
|
const surfaceHeight = this.surface.height();
|
|
@@ -10015,7 +10302,7 @@ class Game {
|
|
|
10015
10302
|
if (images[imageName].status === M2ImageStatus.Ready) {
|
|
10016
10303
|
const image = images[imageName].canvaskitImage;
|
|
10017
10304
|
if (!image) {
|
|
10018
|
-
throw new
|
|
10305
|
+
throw new M2Error(`image ${imageName} is undefined`);
|
|
10019
10306
|
}
|
|
10020
10307
|
canvas.drawImage(image, 0, 0);
|
|
10021
10308
|
}
|
|
@@ -10025,7 +10312,7 @@ class Game {
|
|
|
10025
10312
|
const whitePaint = new this.canvasKit.Paint();
|
|
10026
10313
|
whitePaint.setColor(this.canvasKit.Color(255, 255, 255, 1));
|
|
10027
10314
|
if (!this.surface) {
|
|
10028
|
-
throw new
|
|
10315
|
+
throw new M2Error("surface is undefined");
|
|
10029
10316
|
}
|
|
10030
10317
|
canvas.drawRect(
|
|
10031
10318
|
[0, 0, this.surface.width(), this.surface.height()],
|
|
@@ -10053,13 +10340,19 @@ class Game {
|
|
|
10053
10340
|
initData() {
|
|
10054
10341
|
this.trialIndex = 0;
|
|
10055
10342
|
this.data = {
|
|
10056
|
-
trials: new Array()
|
|
10343
|
+
trials: new Array(),
|
|
10344
|
+
scoring: {}
|
|
10057
10345
|
};
|
|
10058
10346
|
const trialSchema = this.options.trialSchema ?? {};
|
|
10059
|
-
const
|
|
10347
|
+
const scoringSchema = this.options.scoringSchema ?? {};
|
|
10348
|
+
this.validateSchema(trialSchema);
|
|
10349
|
+
this.validateSchema(scoringSchema);
|
|
10350
|
+
}
|
|
10351
|
+
validateSchema(schema) {
|
|
10352
|
+
const variables = Object.entries(schema);
|
|
10060
10353
|
for (const [variableName, propertySchema] of variables) {
|
|
10061
10354
|
if (propertySchema.type !== void 0 && !this.propertySchemaDataTypeIsValid(propertySchema.type)) {
|
|
10062
|
-
throw new
|
|
10355
|
+
throw new M2Error(
|
|
10063
10356
|
`invalid schema. variable ${variableName} is type ${propertySchema.type}. type must be number, string, boolean, object, or array`
|
|
10064
10357
|
);
|
|
10065
10358
|
}
|
|
@@ -10086,7 +10379,7 @@ class Game {
|
|
|
10086
10379
|
}
|
|
10087
10380
|
});
|
|
10088
10381
|
} else {
|
|
10089
|
-
throw new
|
|
10382
|
+
throw new M2Error(`Invalid data type: ${propertySchemaType}`);
|
|
10090
10383
|
}
|
|
10091
10384
|
return dataTypeIsValid;
|
|
10092
10385
|
}
|
|
@@ -10128,17 +10421,17 @@ class Game {
|
|
|
10128
10421
|
/**
|
|
10129
10422
|
* Adds data to the game's TrialData object.
|
|
10130
10423
|
*
|
|
10131
|
-
* @remarks
|
|
10132
|
-
* object
|
|
10133
|
-
*
|
|
10134
|
-
*
|
|
10424
|
+
* @remarks `variableName` must be previously defined in the
|
|
10425
|
+
* {@link TrialSchema} object in {@link GameOptions}. The type of the value
|
|
10426
|
+
* must match what was defined in the trial schema, otherwise an error is
|
|
10427
|
+
* thrown.
|
|
10135
10428
|
*
|
|
10136
10429
|
* @param variableName - variable to be set
|
|
10137
10430
|
* @param value - value of the variable to set
|
|
10138
10431
|
*/
|
|
10139
10432
|
addTrialData(variableName, value) {
|
|
10140
10433
|
if (!this.options.trialSchema) {
|
|
10141
|
-
throw new
|
|
10434
|
+
throw new M2Error(
|
|
10142
10435
|
"no trial schema were provided in GameOptions. cannot add trial data"
|
|
10143
10436
|
);
|
|
10144
10437
|
}
|
|
@@ -10149,6 +10442,7 @@ class Game {
|
|
|
10149
10442
|
emptyTrial[variableName2] = null;
|
|
10150
10443
|
}
|
|
10151
10444
|
this.data.trials.push({
|
|
10445
|
+
data_type: "trial",
|
|
10152
10446
|
document_uuid: Uuid.generate(),
|
|
10153
10447
|
study_id: this.studyId ?? null,
|
|
10154
10448
|
study_uuid: this.studyUuid ?? null,
|
|
@@ -10165,7 +10459,7 @@ class Game {
|
|
|
10165
10459
|
});
|
|
10166
10460
|
}
|
|
10167
10461
|
if (!(variableName in this.options.trialSchema)) {
|
|
10168
|
-
throw new
|
|
10462
|
+
throw new M2Error(`trial variable ${variableName} not defined in schema`);
|
|
10169
10463
|
}
|
|
10170
10464
|
let expectedDataTypes;
|
|
10171
10465
|
if (Array.isArray(this.options.trialSchema[variableName].type)) {
|
|
@@ -10185,12 +10479,120 @@ class Game {
|
|
|
10185
10479
|
providedDataType = "null";
|
|
10186
10480
|
}
|
|
10187
10481
|
if (!expectedDataTypes.includes(providedDataType) && !(providedDataType === "number" && Number.isInteger(value) && expectedDataTypes.includes("integer"))) {
|
|
10188
|
-
throw new
|
|
10482
|
+
throw new M2Error(
|
|
10189
10483
|
`type for variable ${variableName} (value: ${value}) is "${providedDataType}". Based on schema for this variable, expected type was "${expectedDataTypes}"`
|
|
10190
10484
|
);
|
|
10191
10485
|
}
|
|
10192
10486
|
this.data.trials[this.trialIndex][variableName] = value;
|
|
10193
10487
|
}
|
|
10488
|
+
/**
|
|
10489
|
+
* Adds data to the game's scoring data.
|
|
10490
|
+
*
|
|
10491
|
+
* @remarks The variable name (or object property names) must be previously
|
|
10492
|
+
* defined in the {@link ScoringSchema} object in {@link GameOptions}.
|
|
10493
|
+
* The type of the value must match what was defined in the scoring schema,
|
|
10494
|
+
* otherwise an error is thrown.
|
|
10495
|
+
*
|
|
10496
|
+
* @param variableNameOrObject - Either a variable name (string) or an object
|
|
10497
|
+
* containing multiple key-value pairs to add all at once.
|
|
10498
|
+
* @param value - Value of the variable to set (only used when
|
|
10499
|
+
* variableNameOrObject is a variable name string).
|
|
10500
|
+
*/
|
|
10501
|
+
addScoringData(variableNameOrObject, value) {
|
|
10502
|
+
if (!this.options.scoringSchema) {
|
|
10503
|
+
throw new M2Error(
|
|
10504
|
+
"no scoring schema were provided in GameOptions. cannot add scoring data"
|
|
10505
|
+
);
|
|
10506
|
+
}
|
|
10507
|
+
if (Object.keys(this.data.scoring).length === 0) {
|
|
10508
|
+
const emptyScoring = {
|
|
10509
|
+
data_type: "scoring",
|
|
10510
|
+
document_uuid: Uuid.generate(),
|
|
10511
|
+
study_id: this.studyId ?? null,
|
|
10512
|
+
study_uuid: this.studyUuid ?? null,
|
|
10513
|
+
session_uuid: this.sessionUuid,
|
|
10514
|
+
activity_uuid: this.uuid,
|
|
10515
|
+
activity_id: this.options.id,
|
|
10516
|
+
activity_publish_uuid: this.options.publishUuid,
|
|
10517
|
+
activity_version: this.options.version,
|
|
10518
|
+
device_timezone: Intl?.DateTimeFormat()?.resolvedOptions()?.timeZone ?? "",
|
|
10519
|
+
device_timezone_offset_minutes: (/* @__PURE__ */ new Date()).getTimezoneOffset(),
|
|
10520
|
+
locale: this.i18n?.locale ?? null,
|
|
10521
|
+
device_metadata: this.getDeviceMetadata()
|
|
10522
|
+
};
|
|
10523
|
+
const variables = Object.entries(this.options.scoringSchema);
|
|
10524
|
+
for (const [variableName2] of variables) {
|
|
10525
|
+
emptyScoring[variableName2] = null;
|
|
10526
|
+
}
|
|
10527
|
+
this.data.scoring = emptyScoring;
|
|
10528
|
+
}
|
|
10529
|
+
if (typeof variableNameOrObject === "object") {
|
|
10530
|
+
let scoringObject;
|
|
10531
|
+
if (Array.isArray(variableNameOrObject)) {
|
|
10532
|
+
if (variableNameOrObject.length !== 1) {
|
|
10533
|
+
console.warn(
|
|
10534
|
+
`Array of objects passed to addScoringData() is length ${variableNameOrObject.length}. This is likely an error in the assessment's code for calculateScores().`
|
|
10535
|
+
);
|
|
10536
|
+
}
|
|
10537
|
+
scoringObject = variableNameOrObject[0];
|
|
10538
|
+
} else {
|
|
10539
|
+
scoringObject = variableNameOrObject;
|
|
10540
|
+
}
|
|
10541
|
+
for (const [key, val] of Object.entries(scoringObject)) {
|
|
10542
|
+
this.validateAndSetScoringVariable(key, val);
|
|
10543
|
+
}
|
|
10544
|
+
return;
|
|
10545
|
+
}
|
|
10546
|
+
const variableName = variableNameOrObject;
|
|
10547
|
+
if (value === void 0) {
|
|
10548
|
+
throw new M2Error(
|
|
10549
|
+
"Value must be provided when adding a single scoring variable"
|
|
10550
|
+
);
|
|
10551
|
+
}
|
|
10552
|
+
this.validateAndSetScoringVariable(variableName, value);
|
|
10553
|
+
}
|
|
10554
|
+
/**
|
|
10555
|
+
* Helper method to validate and set a single scoring variable
|
|
10556
|
+
*
|
|
10557
|
+
* @param variableName - Name of the variable to set
|
|
10558
|
+
* @param value - Value to set
|
|
10559
|
+
* @private
|
|
10560
|
+
*/
|
|
10561
|
+
validateAndSetScoringVariable(variableName, value) {
|
|
10562
|
+
if (!this.options.scoringSchema) {
|
|
10563
|
+
throw new M2Error(
|
|
10564
|
+
"no scoring schema were provided in GameOptions. cannot add scoring data"
|
|
10565
|
+
);
|
|
10566
|
+
}
|
|
10567
|
+
if (!(variableName in this.options.scoringSchema)) {
|
|
10568
|
+
throw new M2Error(
|
|
10569
|
+
`scoring variable ${variableName} not defined in schema`
|
|
10570
|
+
);
|
|
10571
|
+
}
|
|
10572
|
+
let expectedDataTypes;
|
|
10573
|
+
if (Array.isArray(this.options.scoringSchema[variableName].type)) {
|
|
10574
|
+
expectedDataTypes = this.options.scoringSchema[variableName].type;
|
|
10575
|
+
} else {
|
|
10576
|
+
expectedDataTypes = [
|
|
10577
|
+
this.options.scoringSchema[variableName].type
|
|
10578
|
+
];
|
|
10579
|
+
}
|
|
10580
|
+
let providedDataType = typeof value;
|
|
10581
|
+
if (providedDataType === "object") {
|
|
10582
|
+
if (Object.prototype.toString.call(value) === "[object Array]") {
|
|
10583
|
+
providedDataType = "array";
|
|
10584
|
+
}
|
|
10585
|
+
}
|
|
10586
|
+
if (value === void 0 || value === null) {
|
|
10587
|
+
providedDataType = "null";
|
|
10588
|
+
}
|
|
10589
|
+
if (!expectedDataTypes.includes(providedDataType) && !(providedDataType === "number" && Number.isInteger(value) && expectedDataTypes.includes("integer"))) {
|
|
10590
|
+
throw new M2Error(
|
|
10591
|
+
`type for variable ${variableName} (value: ${value}) is "${providedDataType}". Based on schema for this variable, expected type was "${expectedDataTypes}"`
|
|
10592
|
+
);
|
|
10593
|
+
}
|
|
10594
|
+
this.data.scoring[variableName] = value;
|
|
10595
|
+
}
|
|
10194
10596
|
/**
|
|
10195
10597
|
* Adds custom trial schema to the game's trialSchema object.
|
|
10196
10598
|
*
|
|
@@ -10205,7 +10607,7 @@ class Game {
|
|
|
10205
10607
|
const keys = Object.keys(schema);
|
|
10206
10608
|
keys.forEach((key) => {
|
|
10207
10609
|
if (!this.options.trialSchema) {
|
|
10208
|
-
throw new
|
|
10610
|
+
throw new M2Error("trial schema is undefined");
|
|
10209
10611
|
}
|
|
10210
10612
|
this.options.trialSchema[key] = schema[key];
|
|
10211
10613
|
});
|
|
@@ -10237,10 +10639,10 @@ class Game {
|
|
|
10237
10639
|
*/
|
|
10238
10640
|
addStaticTrialData(variableName, value) {
|
|
10239
10641
|
if (!this.options.trialSchema) {
|
|
10240
|
-
throw new
|
|
10642
|
+
throw new M2Error("trial schema is undefined");
|
|
10241
10643
|
}
|
|
10242
10644
|
if (this.options.trialSchema[variableName] === void 0) {
|
|
10243
|
-
throw new
|
|
10645
|
+
throw new M2Error(`trial variable ${variableName} not defined in schema`);
|
|
10244
10646
|
}
|
|
10245
10647
|
this.staticTrialSchema[variableName] = value;
|
|
10246
10648
|
}
|
|
@@ -10289,6 +10691,36 @@ class Game {
|
|
|
10289
10691
|
};
|
|
10290
10692
|
this.raiseActivityEventOnListeners(resultsEvent);
|
|
10291
10693
|
}
|
|
10694
|
+
/**
|
|
10695
|
+
* Marks scoring as complete.
|
|
10696
|
+
*
|
|
10697
|
+
* @remarks This method must be called after the game has finished adding
|
|
10698
|
+
* scores using addScoringData(). Calling will trigger the onActivityResults
|
|
10699
|
+
* callback function, if one was provided in SessionOptions. This is how the
|
|
10700
|
+
* game communicates scoring data to the parent session, which can then save
|
|
10701
|
+
* or process the data. It is the responsibility of the the game programmer
|
|
10702
|
+
* to call this at the appropriate time. It is not triggered automatically.
|
|
10703
|
+
*/
|
|
10704
|
+
scoringComplete() {
|
|
10705
|
+
const resultsEvent = {
|
|
10706
|
+
type: M2EventType.ActivityData,
|
|
10707
|
+
...M2c2KitHelpers.createFrameUpdateTimestamps(),
|
|
10708
|
+
target: this,
|
|
10709
|
+
newData: this.data.scoring,
|
|
10710
|
+
newDataSchema: this.makeScoringDataSchema(),
|
|
10711
|
+
data: this.data.scoring,
|
|
10712
|
+
dataSchema: this.makeScoringDataSchema(),
|
|
10713
|
+
dataType: "Scoring",
|
|
10714
|
+
activityConfiguration: this.makeGameActivityConfiguration(
|
|
10715
|
+
this.options.parameters ?? {}
|
|
10716
|
+
),
|
|
10717
|
+
activityConfigurationSchema: this.makeGameActivityConfigurationSchema(
|
|
10718
|
+
this.options.parameters ?? {}
|
|
10719
|
+
),
|
|
10720
|
+
activityMetrics: this.gameMetrics
|
|
10721
|
+
};
|
|
10722
|
+
this.raiseActivityEventOnListeners(resultsEvent);
|
|
10723
|
+
}
|
|
10292
10724
|
makeNewGameDataSchema() {
|
|
10293
10725
|
const newDataSchema = {
|
|
10294
10726
|
description: `A single trial and metadata from the assessment ${this.name}.`,
|
|
@@ -10391,6 +10823,20 @@ class Game {
|
|
|
10391
10823
|
properties: result
|
|
10392
10824
|
};
|
|
10393
10825
|
}
|
|
10826
|
+
makeScoringDataSchema() {
|
|
10827
|
+
const scoringDataSchema = {
|
|
10828
|
+
description: `Scoring data and metadata from the assessment ${this.name}.`,
|
|
10829
|
+
$comment: `Activity identifier: ${this.options.id}, version: ${this.options.version}.`,
|
|
10830
|
+
$schema: "https://json-schema.org/draft/2019-09/schema",
|
|
10831
|
+
type: "object",
|
|
10832
|
+
properties: {
|
|
10833
|
+
...this.automaticScoringSchema,
|
|
10834
|
+
...this.options.scoringSchema,
|
|
10835
|
+
device_metadata: deviceMetadataSchema
|
|
10836
|
+
}
|
|
10837
|
+
};
|
|
10838
|
+
return scoringDataSchema;
|
|
10839
|
+
}
|
|
10394
10840
|
/**
|
|
10395
10841
|
* Should be called when current game has ended successfully.
|
|
10396
10842
|
*
|
|
@@ -10464,7 +10910,7 @@ class Game {
|
|
|
10464
10910
|
(canvas) => !canvas.id.startsWith("m2c2kit-scratch-canvas")
|
|
10465
10911
|
);
|
|
10466
10912
|
if (canvases.length === 0) {
|
|
10467
|
-
throw new
|
|
10913
|
+
throw new M2Error("no html canvas tag was found in the html");
|
|
10468
10914
|
}
|
|
10469
10915
|
const m2c2kitCanvas = canvases.filter(
|
|
10470
10916
|
(c) => c.id === "m2c2kit-canvas"
|
|
@@ -10483,7 +10929,7 @@ class Game {
|
|
|
10483
10929
|
} else {
|
|
10484
10930
|
htmlCanvas = document.getElementById(canvasId);
|
|
10485
10931
|
if (htmlCanvas === void 0) {
|
|
10486
|
-
throw new
|
|
10932
|
+
throw new M2Error(
|
|
10487
10933
|
`could not find canvas HTML element with id "${canvasId}"`
|
|
10488
10934
|
);
|
|
10489
10935
|
}
|
|
@@ -10509,7 +10955,7 @@ class Game {
|
|
|
10509
10955
|
}
|
|
10510
10956
|
setupCanvasKitSurface() {
|
|
10511
10957
|
if (this.htmlCanvas === void 0) {
|
|
10512
|
-
throw new
|
|
10958
|
+
throw new M2Error("main html canvas is undefined");
|
|
10513
10959
|
}
|
|
10514
10960
|
window.logWebGl = this.options.logWebGl;
|
|
10515
10961
|
this.interceptWebGlCalls();
|
|
@@ -10521,7 +10967,7 @@ class Game {
|
|
|
10521
10967
|
}
|
|
10522
10968
|
const surface = this.canvasKit.MakeWebGLCanvasSurface(this.htmlCanvas);
|
|
10523
10969
|
if (surface === null) {
|
|
10524
|
-
throw new
|
|
10970
|
+
throw new M2Error(
|
|
10525
10971
|
`could not make CanvasKit surface from canvas HTML element`
|
|
10526
10972
|
);
|
|
10527
10973
|
}
|
|
@@ -10579,7 +11025,7 @@ class Game {
|
|
|
10579
11025
|
}
|
|
10580
11026
|
setupCanvasDomEventHandlers() {
|
|
10581
11027
|
if (this.htmlCanvas === void 0) {
|
|
10582
|
-
throw new
|
|
11028
|
+
throw new M2Error("main html canvas is undefined");
|
|
10583
11029
|
}
|
|
10584
11030
|
this.htmlCanvas.addEventListener(
|
|
10585
11031
|
"pointerdown",
|
|
@@ -10608,7 +11054,7 @@ class Game {
|
|
|
10608
11054
|
}
|
|
10609
11055
|
loop(canvas) {
|
|
10610
11056
|
if (!this.surface) {
|
|
10611
|
-
throw new
|
|
11057
|
+
throw new M2Error("surface is undefined");
|
|
10612
11058
|
}
|
|
10613
11059
|
if (this.warmupFunctionQueue.length > 0) {
|
|
10614
11060
|
const warmup = this.warmupFunctionQueue.shift();
|
|
@@ -10637,7 +11083,9 @@ class Game {
|
|
|
10637
11083
|
this.animationFramesRequested++;
|
|
10638
11084
|
if (!this.limitFps || this.animationFramesRequested % Math.round(60 / Constants.LIMITED_FPS_RATE) === 0) {
|
|
10639
11085
|
if (this.currentScene === void 0 && this.incomingSceneTransitions.length === 0 && this.eventStore.mode !== EventStoreMode.Replay) {
|
|
10640
|
-
throw new
|
|
11086
|
+
throw new M2Error(
|
|
11087
|
+
"Can not run game without a current or incoming scene"
|
|
11088
|
+
);
|
|
10641
11089
|
}
|
|
10642
11090
|
this.updateGameTime();
|
|
10643
11091
|
if (this.eventStore.mode === EventStoreMode.Replay) {
|
|
@@ -10683,7 +11131,7 @@ class Game {
|
|
|
10683
11131
|
if (this.snapshots.length > 0 || incomingSceneTransitions[0].transition.type === TransitionType.None) {
|
|
10684
11132
|
const incomingSceneTransition = incomingSceneTransitions.shift();
|
|
10685
11133
|
if (incomingSceneTransition === void 0) {
|
|
10686
|
-
throw new
|
|
11134
|
+
throw new M2Error("no incoming scene transition");
|
|
10687
11135
|
}
|
|
10688
11136
|
const incomingScene = incomingSceneTransition.scene;
|
|
10689
11137
|
const transition = incomingSceneTransition.transition;
|
|
@@ -10699,7 +11147,7 @@ class Game {
|
|
|
10699
11147
|
}
|
|
10700
11148
|
this.currentSceneSnapshot = this.snapshots.shift();
|
|
10701
11149
|
if (!this.currentSceneSnapshot) {
|
|
10702
|
-
throw new
|
|
11150
|
+
throw new M2Error("No snapshot available for outgoing scene");
|
|
10703
11151
|
}
|
|
10704
11152
|
const outgoingScene = this.createOutgoingScene(this.currentSceneSnapshot);
|
|
10705
11153
|
outgoingScene._active = true;
|
|
@@ -10755,12 +11203,12 @@ class Game {
|
|
|
10755
11203
|
*/
|
|
10756
11204
|
async registerPlugin(plugin) {
|
|
10757
11205
|
if (plugin.type !== ActivityType.Game) {
|
|
10758
|
-
throw new
|
|
11206
|
+
throw new M2Error(
|
|
10759
11207
|
`registerPlugin(): plugin ${plugin.id} is not a game plugin. It is a ${plugin.type} plugin.`
|
|
10760
11208
|
);
|
|
10761
11209
|
}
|
|
10762
11210
|
if (this.plugins.includes(plugin) || this.plugins.map((p) => p.id).includes(plugin.id)) {
|
|
10763
|
-
throw new
|
|
11211
|
+
throw new M2Error(
|
|
10764
11212
|
`registerPlugin(): plugin ${plugin.id} already registered.`
|
|
10765
11213
|
);
|
|
10766
11214
|
}
|
|
@@ -10840,13 +11288,13 @@ class Game {
|
|
|
10840
11288
|
}
|
|
10841
11289
|
takeCurrentSceneSnapshot() {
|
|
10842
11290
|
if (this.surface === void 0) {
|
|
10843
|
-
throw new
|
|
11291
|
+
throw new M2Error("CanvasKit surface is undefined");
|
|
10844
11292
|
}
|
|
10845
11293
|
return this.surface.makeImageSnapshot();
|
|
10846
11294
|
}
|
|
10847
11295
|
handlePendingScreenshot(pendingScreenshot) {
|
|
10848
11296
|
if (!this.surface) {
|
|
10849
|
-
throw new
|
|
11297
|
+
throw new M2Error("no surface");
|
|
10850
11298
|
}
|
|
10851
11299
|
let image;
|
|
10852
11300
|
if (pendingScreenshot.rect.length == 4) {
|
|
@@ -10879,13 +11327,13 @@ class Game {
|
|
|
10879
11327
|
*/
|
|
10880
11328
|
takeScreenshot(sx, sy, sw, sh) {
|
|
10881
11329
|
if (!this.surface) {
|
|
10882
|
-
throw new
|
|
11330
|
+
throw new M2Error("no canvaskit surface. unable to take screenshot.");
|
|
10883
11331
|
}
|
|
10884
|
-
const missingParametersCount = [sx, sy, sw, sh].map((x) => x
|
|
11332
|
+
const missingParametersCount = [sx, sy, sw, sh].map((x) => x === void 0 ? 1 : 0).reduce((a, b) => a + b);
|
|
10885
11333
|
return new Promise((resolve, reject) => {
|
|
10886
11334
|
switch (missingParametersCount) {
|
|
10887
11335
|
case 0: {
|
|
10888
|
-
if (
|
|
11336
|
+
if (sx === void 0 || sy === void 0 || sw === void 0 || sh === void 0) {
|
|
10889
11337
|
reject("missing values in arguments for takeScreenshot()");
|
|
10890
11338
|
return;
|
|
10891
11339
|
}
|
|
@@ -11083,12 +11531,12 @@ class Game {
|
|
|
11083
11531
|
);
|
|
11084
11532
|
break;
|
|
11085
11533
|
default:
|
|
11086
|
-
throw new
|
|
11534
|
+
throw new M2Error("unknown transition direction");
|
|
11087
11535
|
}
|
|
11088
11536
|
break;
|
|
11089
11537
|
}
|
|
11090
11538
|
default:
|
|
11091
|
-
throw new
|
|
11539
|
+
throw new M2Error("unknown transition type");
|
|
11092
11540
|
}
|
|
11093
11541
|
}
|
|
11094
11542
|
drawFps(canvas) {
|
|
@@ -11096,7 +11544,7 @@ class Game {
|
|
|
11096
11544
|
const drawScale = m2c2Globals.canvasScale;
|
|
11097
11545
|
canvas.scale(1 / drawScale, 1 / drawScale);
|
|
11098
11546
|
if (!this.fpsTextFont || !this.fpsTextPaint) {
|
|
11099
|
-
throw new
|
|
11547
|
+
throw new M2Error("fps font or paint is undefined");
|
|
11100
11548
|
}
|
|
11101
11549
|
canvas.drawText(
|
|
11102
11550
|
"FPS: " + this.fpsRate.toFixed(2),
|
|
@@ -11126,12 +11574,12 @@ class Game {
|
|
|
11126
11574
|
}
|
|
11127
11575
|
const node = nodes.filter((node2) => node2.name === nodeName).find(Boolean);
|
|
11128
11576
|
if (node === void 0) {
|
|
11129
|
-
throw new
|
|
11577
|
+
throw new M2Error(
|
|
11130
11578
|
`could not create event listener. node with name ${nodeName} could not be found in the game node tree`
|
|
11131
11579
|
);
|
|
11132
11580
|
}
|
|
11133
11581
|
if (!Object.values(M2EventType).includes(type)) {
|
|
11134
|
-
throw new
|
|
11582
|
+
throw new M2Error(
|
|
11135
11583
|
`game ${this.id}: could not create event listener. event type ${type} is not known`
|
|
11136
11584
|
);
|
|
11137
11585
|
}
|
|
@@ -11170,7 +11618,7 @@ class Game {
|
|
|
11170
11618
|
return;
|
|
11171
11619
|
}
|
|
11172
11620
|
if (!this.htmlCanvas) {
|
|
11173
|
-
throw new
|
|
11621
|
+
throw new M2Error("main html canvas is undefined");
|
|
11174
11622
|
}
|
|
11175
11623
|
const domPointerDownEvent = {
|
|
11176
11624
|
type: "DomPointerDown",
|
|
@@ -11855,7 +12303,7 @@ const _LegacyTimer = class _LegacyTimer {
|
|
|
11855
12303
|
this._timers.push(timer);
|
|
11856
12304
|
} else {
|
|
11857
12305
|
if (timer.stopped == false) {
|
|
11858
|
-
throw new
|
|
12306
|
+
throw new M2Error(
|
|
11859
12307
|
`can't start timer. timer with name ${name} is already started`
|
|
11860
12308
|
);
|
|
11861
12309
|
}
|
|
@@ -11877,12 +12325,12 @@ const _LegacyTimer = class _LegacyTimer {
|
|
|
11877
12325
|
static stop(name) {
|
|
11878
12326
|
const timer = this._timers.filter((t) => t.name === name).find(Boolean);
|
|
11879
12327
|
if (timer === void 0) {
|
|
11880
|
-
throw new
|
|
12328
|
+
throw new M2Error(
|
|
11881
12329
|
`can't stop timer. timer with name ${name} does not exist`
|
|
11882
12330
|
);
|
|
11883
12331
|
}
|
|
11884
12332
|
if (timer.stopped === true) {
|
|
11885
|
-
throw new
|
|
12333
|
+
throw new M2Error(
|
|
11886
12334
|
`can't stop timer. timer with name ${name} is already stopped`
|
|
11887
12335
|
);
|
|
11888
12336
|
}
|
|
@@ -11905,7 +12353,7 @@ const _LegacyTimer = class _LegacyTimer {
|
|
|
11905
12353
|
static restart(name) {
|
|
11906
12354
|
const timer = this._timers.filter((t) => t.name === name).find(Boolean);
|
|
11907
12355
|
if (timer === void 0) {
|
|
11908
|
-
throw new
|
|
12356
|
+
throw new M2Error(
|
|
11909
12357
|
`can't restart timer. timer with name ${name} does not exist`
|
|
11910
12358
|
);
|
|
11911
12359
|
}
|
|
@@ -11928,7 +12376,7 @@ const _LegacyTimer = class _LegacyTimer {
|
|
|
11928
12376
|
static elapsed(name) {
|
|
11929
12377
|
const timer = this._timers.filter((t) => t.name === name).find(Boolean);
|
|
11930
12378
|
if (timer === void 0) {
|
|
11931
|
-
throw new
|
|
12379
|
+
throw new M2Error(
|
|
11932
12380
|
`can't get elapsed time. timer with name ${name} does not exist`
|
|
11933
12381
|
);
|
|
11934
12382
|
}
|
|
@@ -11952,7 +12400,7 @@ const _LegacyTimer = class _LegacyTimer {
|
|
|
11952
12400
|
static remove(name) {
|
|
11953
12401
|
const timer = this._timers.filter((t) => t.name === name).find(Boolean);
|
|
11954
12402
|
if (timer === void 0) {
|
|
11955
|
-
throw new
|
|
12403
|
+
throw new M2Error(
|
|
11956
12404
|
`can't remove timer. timer with name ${name} does not exist`
|
|
11957
12405
|
);
|
|
11958
12406
|
}
|
|
@@ -12012,7 +12460,7 @@ class RandomDraws {
|
|
|
12012
12460
|
*/
|
|
12013
12461
|
static FromRangeWithoutReplacement(n, minimumInclusive, maximumInclusive) {
|
|
12014
12462
|
if (n > maximumInclusive - minimumInclusive + 1) {
|
|
12015
|
-
throw new
|
|
12463
|
+
throw new M2Error(
|
|
12016
12464
|
`number of requested draws (n = ${n}) is greater than number of integers in range [ ${minimumInclusive}, ${maximumInclusive}]`
|
|
12017
12465
|
);
|
|
12018
12466
|
}
|
|
@@ -12147,7 +12595,7 @@ class SoundPlayer extends M2Node {
|
|
|
12147
12595
|
*/
|
|
12148
12596
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
12149
12597
|
duplicate(newName) {
|
|
12150
|
-
throw new
|
|
12598
|
+
throw new M2Error("Method not implemented.");
|
|
12151
12599
|
}
|
|
12152
12600
|
}
|
|
12153
12601
|
|
|
@@ -12205,7 +12653,7 @@ class SoundRecorder extends M2Node {
|
|
|
12205
12653
|
*/
|
|
12206
12654
|
async start() {
|
|
12207
12655
|
if (this.isRecording) {
|
|
12208
|
-
throw new
|
|
12656
|
+
throw new M2Error(
|
|
12209
12657
|
"cannot start SoundRecorder because it is already started."
|
|
12210
12658
|
);
|
|
12211
12659
|
}
|
|
@@ -12213,7 +12661,7 @@ class SoundRecorder extends M2Node {
|
|
|
12213
12661
|
this.endIso8601Timestamp = void 0;
|
|
12214
12662
|
const supportedMimeTypes = this.getMediaRecorderSupportedAudioMimeTypes();
|
|
12215
12663
|
if (supportedMimeTypes.length === 0) {
|
|
12216
|
-
throw new
|
|
12664
|
+
throw new M2Error(
|
|
12217
12665
|
"SoundRecorder found no supported MIME types for MediaRecorder."
|
|
12218
12666
|
);
|
|
12219
12667
|
}
|
|
@@ -12227,10 +12675,10 @@ class SoundRecorder extends M2Node {
|
|
|
12227
12675
|
audio: this.audioTrackConstraints ? this.audioTrackConstraints : true
|
|
12228
12676
|
});
|
|
12229
12677
|
} catch (error) {
|
|
12230
|
-
throw new
|
|
12678
|
+
throw new M2Error(`Error getting user media: ${error}.`);
|
|
12231
12679
|
}
|
|
12232
12680
|
if (!stream) {
|
|
12233
|
-
throw new
|
|
12681
|
+
throw new M2Error("no stream.");
|
|
12234
12682
|
}
|
|
12235
12683
|
const audioTracks = stream.getAudioTracks();
|
|
12236
12684
|
this.mediaTrackSettings = audioTracks?.map((track) => track.getSettings());
|
|
@@ -12239,7 +12687,7 @@ class SoundRecorder extends M2Node {
|
|
|
12239
12687
|
this.audioChunks.push(event.data);
|
|
12240
12688
|
};
|
|
12241
12689
|
this.mediaRecorder.onerror = (event) => {
|
|
12242
|
-
throw new
|
|
12690
|
+
throw new M2Error(
|
|
12243
12691
|
`MediaRecorder error: ${event?.error?.message} ${event?.message}`
|
|
12244
12692
|
);
|
|
12245
12693
|
};
|
|
@@ -12262,15 +12710,17 @@ class SoundRecorder extends M2Node {
|
|
|
12262
12710
|
*/
|
|
12263
12711
|
async stop() {
|
|
12264
12712
|
if (!this.isRecording) {
|
|
12265
|
-
throw new
|
|
12713
|
+
throw new M2Error(
|
|
12714
|
+
"cannot stop SoundRecorder because it has not started."
|
|
12715
|
+
);
|
|
12266
12716
|
}
|
|
12267
12717
|
return new Promise((resolve) => {
|
|
12268
12718
|
if (!this.mediaRecorder) {
|
|
12269
|
-
throw new
|
|
12719
|
+
throw new M2Error("no media recorder");
|
|
12270
12720
|
}
|
|
12271
12721
|
this.mediaRecorder.onstop = async () => {
|
|
12272
12722
|
if (!this.mimeType) {
|
|
12273
|
-
throw new
|
|
12723
|
+
throw new M2Error("no mimeType");
|
|
12274
12724
|
}
|
|
12275
12725
|
this._isRecording = false;
|
|
12276
12726
|
this._isPaused = false;
|
|
@@ -12297,10 +12747,12 @@ class SoundRecorder extends M2Node {
|
|
|
12297
12747
|
}
|
|
12298
12748
|
pause() {
|
|
12299
12749
|
if (!this.isRecording) {
|
|
12300
|
-
throw new
|
|
12750
|
+
throw new M2Error(
|
|
12751
|
+
"cannot pause SoundRecorder because it is not started."
|
|
12752
|
+
);
|
|
12301
12753
|
}
|
|
12302
12754
|
if (this.isPaused) {
|
|
12303
|
-
throw new
|
|
12755
|
+
throw new M2Error(
|
|
12304
12756
|
"cannot pause SoundRecorder because it is already paused."
|
|
12305
12757
|
);
|
|
12306
12758
|
}
|
|
@@ -12310,10 +12762,14 @@ class SoundRecorder extends M2Node {
|
|
|
12310
12762
|
}
|
|
12311
12763
|
resume() {
|
|
12312
12764
|
if (!this.isRecording) {
|
|
12313
|
-
throw new
|
|
12765
|
+
throw new M2Error(
|
|
12766
|
+
"cannot resume SoundRecorder because it is not started."
|
|
12767
|
+
);
|
|
12314
12768
|
}
|
|
12315
12769
|
if (!this.isPaused) {
|
|
12316
|
-
throw new
|
|
12770
|
+
throw new M2Error(
|
|
12771
|
+
"cannot resume SoundRecorder because it is not paused."
|
|
12772
|
+
);
|
|
12317
12773
|
}
|
|
12318
12774
|
this.mediaRecorder?.resume();
|
|
12319
12775
|
this._isPaused = false;
|
|
@@ -12472,7 +12928,7 @@ class SoundRecorder extends M2Node {
|
|
|
12472
12928
|
reader.onloadend = () => {
|
|
12473
12929
|
const base64WithoutPrefix = reader.result?.toString().split(",").pop();
|
|
12474
12930
|
if (base64WithoutPrefix === void 0) {
|
|
12475
|
-
throw new
|
|
12931
|
+
throw new M2Error("base64WithoutPrefix is undefined.");
|
|
12476
12932
|
}
|
|
12477
12933
|
resolve(base64WithoutPrefix);
|
|
12478
12934
|
};
|
|
@@ -12506,7 +12962,7 @@ class SoundRecorder extends M2Node {
|
|
|
12506
12962
|
* provided, name will be the new uuid
|
|
12507
12963
|
*/
|
|
12508
12964
|
duplicate(newName) {
|
|
12509
|
-
throw new
|
|
12965
|
+
throw new M2Error(`Method not implemented. ${newName}`);
|
|
12510
12966
|
}
|
|
12511
12967
|
}
|
|
12512
12968
|
|
|
@@ -12518,7 +12974,7 @@ class Story {
|
|
|
12518
12974
|
}
|
|
12519
12975
|
}
|
|
12520
12976
|
|
|
12521
|
-
console.log("\u26AA @m2c2kit/core version 0.3.
|
|
12977
|
+
console.log("\u26AA @m2c2kit/core version 0.3.31 (62ccf312)");
|
|
12522
12978
|
|
|
12523
|
-
export { Action, ActivityType, CanvasKitHelpers, ColorfulMutablePath, Composite, Constants, ConstraintType, CustomAction, Dimensions, Easings, Equal, Equals, EventStore, EventStoreMode, FadeAlphaAction, FontManager, Game, GroupAction, I18n, ImageManager, Label, LabelHorizontalAlignmentMode, LayoutConstraint, LegacyTimer, M2EventType, M2ImageStatus, M2Node, M2NodeFactory, M2NodeType, M2SoundStatus, M2c2KitHelpers, MoveAction, MutablePath, NoneTransition, PlayAction, RandomDraws, RepeatAction, RepeatForeverAction, RotateAction, ScaleAction, Scene, SceneTransition, SequenceAction, Shape, ShapeType, SlideTransition, SoundManager, SoundPlayer, SoundRecorder, Sprite, Story, TextLine, Timer, Transition, TransitionDirection, TransitionType, Uuid, WaitAction, WebColors, WebGlInfo, handleInterfaceOptions };
|
|
12979
|
+
export { Action, ActivityType, CanvasKitHelpers, ColorfulMutablePath, Composite, Constants, ConstraintType, CustomAction, Dimensions, Easings, Equal, Equals, EventStore, EventStoreMode, FadeAlphaAction, FontManager, Game, GroupAction, I18n, ImageManager, Label, LabelHorizontalAlignmentMode, LayoutConstraint, LegacyTimer, M2Error, M2EventType, M2ImageStatus, M2Node, M2NodeFactory, M2NodeType, M2SoundStatus, M2c2KitHelpers, MoveAction, MutablePath, NoneTransition, PlayAction, RandomDraws, RepeatAction, RepeatForeverAction, RotateAction, ScaleAction, Scene, SceneTransition, SequenceAction, Shape, ShapeType, SlideTransition, SoundManager, SoundPlayer, SoundRecorder, Sprite, Story, TextLine, Timer, Transition, TransitionDirection, TransitionType, Uuid, WaitAction, WebColors, WebGlInfo, handleInterfaceOptions };
|
|
12524
12980
|
//# sourceMappingURL=index.js.map
|