@tradalab/mediakit 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/NOTICE +22 -0
- package/dist/{chunk-V47SDU4L.js → chunk-WRKQ2NFI.js} +60 -5
- package/dist/chunk-WRKQ2NFI.js.map +1 -0
- package/dist/index.d.ts +64 -4
- package/dist/index.js +1239 -32
- package/dist/index.js.map +1 -1
- package/dist/mediakit.wasm +0 -0
- package/dist/recipe.d.ts +85 -1
- package/dist/recipe.js +9 -1
- package/dist/whiten_pink.png +0 -0
- package/dist/worker.js +190 -22
- package/dist/worker.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-V47SDU4L.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -5,9 +5,10 @@ import {
|
|
|
5
5
|
needsFace,
|
|
6
6
|
needsMask,
|
|
7
7
|
needsSegmentation,
|
|
8
|
+
needsSkinClasses,
|
|
8
9
|
touchUp,
|
|
9
10
|
touchUpAmount
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WRKQ2NFI.js";
|
|
11
12
|
import {
|
|
12
13
|
BLEND_MODES,
|
|
13
14
|
TRANSITIONS,
|
|
@@ -20,12 +21,15 @@ import {
|
|
|
20
21
|
// src/segmenter.ts
|
|
21
22
|
import { FilesetResolver, ImageSegmenter } from "@mediapipe/tasks-vision";
|
|
22
23
|
var WASM_DIR = "/mediakit/mp";
|
|
23
|
-
var MODEL_URL =
|
|
24
|
-
|
|
24
|
+
var MODEL_URL = {
|
|
25
|
+
person: "/mediakit/selfie_segmenter.tflite",
|
|
26
|
+
classes: "/mediakit/selfie_multiclass_256x256.tflite"
|
|
27
|
+
};
|
|
28
|
+
async function createSegmenter(canvas, model = "person") {
|
|
25
29
|
const fileset = await FilesetResolver.forVisionTasks(WASM_DIR);
|
|
26
30
|
const segmenter = await ImageSegmenter.createFromOptions(fileset, {
|
|
27
31
|
baseOptions: {
|
|
28
|
-
modelAssetPath: MODEL_URL,
|
|
32
|
+
modelAssetPath: MODEL_URL[model],
|
|
29
33
|
// MediaPipe's GPU delegate runs on WebGL2, which Chrome, Safari and Firefox all
|
|
30
34
|
// have. That is why mediakit picked MediaPipe over ONNX Runtime Web at P1: ORT's
|
|
31
35
|
// fast path is WebGPU, which Firefox only has on Windows.
|
|
@@ -205,6 +209,10 @@ var Engine = class _Engine {
|
|
|
205
209
|
backgroundPath = null;
|
|
206
210
|
/** The LUT the core holds, by path, so a slider drag does not decode it again. */
|
|
207
211
|
lutPath = "";
|
|
212
|
+
/** The makeup texture the core holds, by path - see setRecipe. */
|
|
213
|
+
makeupPath = "";
|
|
214
|
+
/** Whether the core holds the pink whitening table. */
|
|
215
|
+
skinLutState = "none";
|
|
208
216
|
closed = false;
|
|
209
217
|
/**
|
|
210
218
|
* The segmenter loads LAZILY - only once a recipe actually needs a person mask.
|
|
@@ -214,6 +222,11 @@ var Engine = class _Engine {
|
|
|
214
222
|
*/
|
|
215
223
|
segmenter = null;
|
|
216
224
|
segmenterLoading = null;
|
|
225
|
+
/** The multiclass segmenter, for recipes that tell skin from clothes (`needsSkinClasses`). */
|
|
226
|
+
classSegmenter = null;
|
|
227
|
+
classLoading = null;
|
|
228
|
+
/** The segmenter whose result this frame borrowed, to give it back after process(). */
|
|
229
|
+
used = null;
|
|
217
230
|
/**
|
|
218
231
|
* The landmark detector, also lazy and independent of the segmenter.
|
|
219
232
|
*
|
|
@@ -236,11 +249,11 @@ var Engine = class _Engine {
|
|
|
236
249
|
this.core = core;
|
|
237
250
|
}
|
|
238
251
|
/** Main thread: makes its own canvas. A worker calls `on` with an OffscreenCanvas. */
|
|
239
|
-
static async create(width, height, filter, effects = NO_EFFECTS) {
|
|
252
|
+
static async create(width, height, filter, effects = NO_EFFECTS, alpha = false) {
|
|
240
253
|
const canvas = document.createElement("canvas");
|
|
241
254
|
canvas.width = width;
|
|
242
255
|
canvas.height = height;
|
|
243
|
-
return _Engine.on(canvas, filter, effects);
|
|
256
|
+
return _Engine.on(canvas, filter, effects, void 0, alpha);
|
|
244
257
|
}
|
|
245
258
|
/**
|
|
246
259
|
* `background`: see {@link Engine.setRecipe}. `alpha` keeps the output's alpha channel, which
|
|
@@ -279,6 +292,9 @@ var Engine = class _Engine {
|
|
|
279
292
|
throw err;
|
|
280
293
|
}
|
|
281
294
|
}
|
|
295
|
+
get loading() {
|
|
296
|
+
return this.segmenterLoading !== null || this.classLoading !== null || this.faceLoading !== null;
|
|
297
|
+
}
|
|
282
298
|
get outputCanvas() {
|
|
283
299
|
return this.canvas;
|
|
284
300
|
}
|
|
@@ -324,8 +340,44 @@ var Engine = class _Engine {
|
|
|
324
340
|
}
|
|
325
341
|
this.lutPath = effects.lut;
|
|
326
342
|
}
|
|
343
|
+
if (effects.whitenStyle === "pink" && this.skinLutState === "none") {
|
|
344
|
+
this.skinLutState = "loading";
|
|
345
|
+
decodeImage("/mediakit/whiten_pink.png", { colorSpaceConversion: "none", premultiplyAlpha: "none" }).then((bmp) => {
|
|
346
|
+
if (this.closed) {
|
|
347
|
+
bmp.close();
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
this.core.setSkinLut(bmp);
|
|
351
|
+
bmp.close();
|
|
352
|
+
this.skinLutState = "ready";
|
|
353
|
+
}).catch((err) => {
|
|
354
|
+
console.error("mediakit: pink whitening table failed to load", err);
|
|
355
|
+
this.skinLutState = "failed";
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
const makeupTexture = effects.makeupTexture ?? "";
|
|
359
|
+
if (makeupTexture !== this.makeupPath) {
|
|
360
|
+
if (makeupTexture) {
|
|
361
|
+
let bmp = null;
|
|
362
|
+
try {
|
|
363
|
+
bmp = await decodeImage(makeupTexture, { premultiplyAlpha: "none" });
|
|
364
|
+
} catch (e) {
|
|
365
|
+
console.error("mediakit: makeup texture failed to load", e);
|
|
366
|
+
}
|
|
367
|
+
if (this.closed || this.filter !== filter || this.effects !== effects) {
|
|
368
|
+
bmp?.close();
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
this.core.setMakeup(bmp);
|
|
372
|
+
bmp?.close();
|
|
373
|
+
} else {
|
|
374
|
+
this.core.setMakeup(null);
|
|
375
|
+
}
|
|
376
|
+
this.makeupPath = makeupTexture;
|
|
377
|
+
}
|
|
327
378
|
this.core.setRecipe(coreRecipe(filter, effects));
|
|
328
379
|
if (needsSegmentation(filter, effects)) void this.ensureSegmenter();
|
|
380
|
+
if (needsSkinClasses(filter, effects)) void this.ensureClassSegmenter();
|
|
329
381
|
if (needsFace(effects)) void this.ensureFace();
|
|
330
382
|
}
|
|
331
383
|
ensureFace() {
|
|
@@ -347,6 +399,22 @@ var Engine = class _Engine {
|
|
|
347
399
|
});
|
|
348
400
|
return this.faceLoading;
|
|
349
401
|
}
|
|
402
|
+
ensureClassSegmenter() {
|
|
403
|
+
if (this.classSegmenter || this.closed) return Promise.resolve();
|
|
404
|
+
if (this.classLoading) return this.classLoading;
|
|
405
|
+
this.classLoading = createSegmenter(this.canvas, "classes").then((s) => {
|
|
406
|
+
if (this.closed) {
|
|
407
|
+
s.close();
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
this.classSegmenter = s;
|
|
411
|
+
}).catch((e) => {
|
|
412
|
+
console.error("mediakit: multiclass segmenter failed to load", e);
|
|
413
|
+
}).finally(() => {
|
|
414
|
+
this.classLoading = null;
|
|
415
|
+
});
|
|
416
|
+
return this.classLoading;
|
|
417
|
+
}
|
|
350
418
|
ensureSegmenter() {
|
|
351
419
|
if (this.segmenter || this.closed) return Promise.resolve();
|
|
352
420
|
if (this.segmenterLoading) return this.segmenterLoading;
|
|
@@ -382,14 +450,20 @@ var Engine = class _Engine {
|
|
|
382
450
|
const [lo, hi] = splitMicros(timestampUs);
|
|
383
451
|
const needSeg = this.core.decide(lo, hi, this.prevTotalMs, this.prevSegMs) === 1;
|
|
384
452
|
let mask = null;
|
|
453
|
+
let maskKind = 0;
|
|
385
454
|
let segMs = 0;
|
|
455
|
+
this.used = null;
|
|
386
456
|
if (needSeg) {
|
|
387
|
-
|
|
457
|
+
const classes = this.classSegmenter !== null && needsSkinClasses(this.filter, this.effects);
|
|
458
|
+
const seg = classes ? this.classSegmenter : this.segmenter;
|
|
459
|
+
if (!seg) {
|
|
388
460
|
void this.ensureSegmenter();
|
|
389
461
|
} else {
|
|
390
462
|
const s0 = performance.now();
|
|
391
|
-
mask =
|
|
463
|
+
mask = seg.segment(source, timestampUs / 1e3);
|
|
392
464
|
segMs = performance.now() - s0;
|
|
465
|
+
this.used = seg;
|
|
466
|
+
maskKind = classes ? 1 : 0;
|
|
393
467
|
}
|
|
394
468
|
}
|
|
395
469
|
if (this.core.decideFace() === 1) {
|
|
@@ -400,8 +474,9 @@ var Engine = class _Engine {
|
|
|
400
474
|
this.core.setFace(lo, hi, n);
|
|
401
475
|
}
|
|
402
476
|
}
|
|
403
|
-
const glCalls = this.core.process(source, mask, this.background);
|
|
404
|
-
if (mask) this.
|
|
477
|
+
const glCalls = this.core.process(source, mask, this.background, maskKind);
|
|
478
|
+
if (mask) this.used?.release();
|
|
479
|
+
this.used = null;
|
|
405
480
|
this.prevSegMs = segMs;
|
|
406
481
|
this.prevTotalMs = performance.now() - t0;
|
|
407
482
|
const s = this.core.stats();
|
|
@@ -433,14 +508,16 @@ var Engine = class _Engine {
|
|
|
433
508
|
* for the governor and the graph to decide with. See the ToMicros comment in
|
|
434
509
|
* `core/clock.go`.
|
|
435
510
|
*/
|
|
436
|
-
capture(timestampUs) {
|
|
437
|
-
return new VideoFrame(this.canvas, { timestamp: timestampUs, alpha: "discard" });
|
|
511
|
+
capture(timestampUs, keepAlpha = false) {
|
|
512
|
+
return new VideoFrame(this.canvas, { timestamp: timestampUs, alpha: keepAlpha ? "keep" : "discard" });
|
|
438
513
|
}
|
|
439
514
|
close() {
|
|
440
515
|
if (this.closed) return;
|
|
441
516
|
this.closed = true;
|
|
442
517
|
this.segmenter?.close();
|
|
443
518
|
this.segmenter = null;
|
|
519
|
+
this.classSegmenter?.close();
|
|
520
|
+
this.classSegmenter = null;
|
|
444
521
|
this.face?.close();
|
|
445
522
|
this.face = null;
|
|
446
523
|
this.lmBuf = null;
|
|
@@ -449,6 +526,7 @@ var Engine = class _Engine {
|
|
|
449
526
|
this.background = null;
|
|
450
527
|
this.backgroundPath = null;
|
|
451
528
|
this.lutPath = "";
|
|
529
|
+
this.makeupPath = "";
|
|
452
530
|
this.gl.getExtension("WEBGL_lose_context")?.loseContext();
|
|
453
531
|
}
|
|
454
532
|
};
|
|
@@ -504,6 +582,9 @@ async function coverCrop(src, w, h) {
|
|
|
504
582
|
|
|
505
583
|
// src/pipeline.ts
|
|
506
584
|
var WORKER_READY_MS = 8e3;
|
|
585
|
+
var STALL_MS = 2e3;
|
|
586
|
+
var LOADING_STALL_MS = 2e4;
|
|
587
|
+
var WORKER_DEAD_MS = 8e3;
|
|
507
588
|
function hasInsertableStreams() {
|
|
508
589
|
return typeof window !== "undefined" && "MediaStreamTrackProcessor" in window && "MediaStreamTrackGenerator" in window;
|
|
509
590
|
}
|
|
@@ -518,6 +599,19 @@ var VideoPipeline = class {
|
|
|
518
599
|
processedTrack;
|
|
519
600
|
filter;
|
|
520
601
|
effects;
|
|
602
|
+
opts;
|
|
603
|
+
// Health: a beat per frame out.
|
|
604
|
+
source = null;
|
|
605
|
+
size = { width: 1280, height: 720, fps: 30 };
|
|
606
|
+
lastBeat = 0;
|
|
607
|
+
frames = 0;
|
|
608
|
+
stalled = false;
|
|
609
|
+
watchdog = null;
|
|
610
|
+
movedOff = false;
|
|
611
|
+
/** What the worker last said about loading detectors. */
|
|
612
|
+
workerLoading = false;
|
|
613
|
+
// Frames handed out alongside the track - see subscribeFrames.
|
|
614
|
+
frameSubs = /* @__PURE__ */ new Set();
|
|
521
615
|
engine = null;
|
|
522
616
|
transport = "insertable";
|
|
523
617
|
// insertable path
|
|
@@ -531,9 +625,93 @@ var VideoPipeline = class {
|
|
|
531
625
|
video = null;
|
|
532
626
|
rvfcHandle = 0;
|
|
533
627
|
stopped = false;
|
|
534
|
-
constructor(filter, effects = NO_EFFECTS) {
|
|
628
|
+
constructor(filter, effects = NO_EFFECTS, opts = {}) {
|
|
535
629
|
this.filter = filter;
|
|
536
630
|
this.effects = effects;
|
|
631
|
+
this.opts = opts;
|
|
632
|
+
}
|
|
633
|
+
/** Whether frames are coming out, and how long since the last one. */
|
|
634
|
+
get health() {
|
|
635
|
+
return {
|
|
636
|
+
transport: this.transport,
|
|
637
|
+
frames: this.frames,
|
|
638
|
+
sinceMs: this.lastBeat ? performance.now() - this.lastBeat : 0,
|
|
639
|
+
stalled: this.stalled
|
|
640
|
+
};
|
|
641
|
+
}
|
|
642
|
+
/** Every processed frame. */
|
|
643
|
+
subscribeFrames(cb) {
|
|
644
|
+
this.frameSubs.add(cb);
|
|
645
|
+
if (this.frameSubs.size === 1) this.send({ t: "frames", on: true });
|
|
646
|
+
return () => {
|
|
647
|
+
this.frameSubs.delete(cb);
|
|
648
|
+
if (this.frameSubs.size === 0) this.send({ t: "frames", on: false });
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
deliver(frame) {
|
|
652
|
+
const subs = [...this.frameSubs];
|
|
653
|
+
if (subs.length === 0) {
|
|
654
|
+
frame.close();
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
subs.forEach((cb, i) => {
|
|
658
|
+
try {
|
|
659
|
+
cb(i === subs.length - 1 ? frame : frame.clone());
|
|
660
|
+
} catch (e) {
|
|
661
|
+
console.error("mediakit: frame subscriber threw", e);
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
beat() {
|
|
666
|
+
this.lastBeat = performance.now();
|
|
667
|
+
this.frames++;
|
|
668
|
+
this.stalled = false;
|
|
669
|
+
}
|
|
670
|
+
startWatchdog() {
|
|
671
|
+
this.stopWatchdog();
|
|
672
|
+
this.lastBeat = performance.now();
|
|
673
|
+
this.watchdog = setInterval(() => {
|
|
674
|
+
if (this.stopped || !this.source) return;
|
|
675
|
+
if (this.source.readyState !== "live" || this.source.muted) {
|
|
676
|
+
this.lastBeat = performance.now();
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
if (this.transport === "canvas" && typeof document !== "undefined" && document.visibilityState !== "visible") {
|
|
680
|
+
this.lastBeat = performance.now();
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
const since = performance.now() - this.lastBeat;
|
|
684
|
+
const loading = this.transport === "worker" ? this.workerLoading : this.engine?.loading ?? false;
|
|
685
|
+
const transport = this.transport;
|
|
686
|
+
if (since >= (loading ? LOADING_STALL_MS : STALL_MS) && !this.stalled) {
|
|
687
|
+
this.stalled = true;
|
|
688
|
+
console.warn(`mediakit: no frame out for ${Math.round(since)}ms on the ${transport} transport`);
|
|
689
|
+
this.opts.onStall?.({ transport, sinceMs: since });
|
|
690
|
+
}
|
|
691
|
+
if (transport === "worker" && since >= (loading ? LOADING_STALL_MS : WORKER_DEAD_MS)) {
|
|
692
|
+
void this.moveOffWorker("silent");
|
|
693
|
+
}
|
|
694
|
+
}, 1e3);
|
|
695
|
+
}
|
|
696
|
+
stopWatchdog() {
|
|
697
|
+
if (this.watchdog) clearInterval(this.watchdog);
|
|
698
|
+
this.watchdog = null;
|
|
699
|
+
}
|
|
700
|
+
/** The worker failed or stalled AFTER the host published its track. */
|
|
701
|
+
async moveOffWorker(reason) {
|
|
702
|
+
if (this.movedOff || this.stopped || !this.source) return;
|
|
703
|
+
this.movedOff = true;
|
|
704
|
+
console.warn(`mediakit: worker ${reason} after start, moving to the main thread`);
|
|
705
|
+
const previous = this.processedTrack;
|
|
706
|
+
this.teardownWorker();
|
|
707
|
+
try {
|
|
708
|
+
await this.startMain(this.source);
|
|
709
|
+
} catch (e) {
|
|
710
|
+
console.error("mediakit: main-thread fallback failed", e);
|
|
711
|
+
return;
|
|
712
|
+
}
|
|
713
|
+
previous?.stop();
|
|
714
|
+
if (this.processedTrack) this.opts.onTrackReplaced?.(this.processedTrack, previous);
|
|
537
715
|
}
|
|
538
716
|
get stats() {
|
|
539
717
|
return this.transport === "worker" ? this.workerStats : this.engine?.last ?? null;
|
|
@@ -547,6 +725,10 @@ var VideoPipeline = class {
|
|
|
547
725
|
const width = settings.width ?? 1280;
|
|
548
726
|
const height = settings.height ?? 720;
|
|
549
727
|
this.stopped = false;
|
|
728
|
+
this.source = source;
|
|
729
|
+
this.size = { width, height, fps: settings.frameRate ?? 30 };
|
|
730
|
+
this.frames = 0;
|
|
731
|
+
this.startWatchdog();
|
|
550
732
|
if (hasInsertableStreams() && typeof Worker !== "undefined" && typeof OffscreenCanvas !== "undefined") {
|
|
551
733
|
try {
|
|
552
734
|
await this.startWorker(source, width, height, await this.backgroundForWorker(this.filter));
|
|
@@ -556,13 +738,29 @@ var VideoPipeline = class {
|
|
|
556
738
|
this.teardownWorker();
|
|
557
739
|
console.warn("mediakit: worker unusable, falling back to the main thread", e);
|
|
558
740
|
}
|
|
741
|
+
} else if (typeof Worker !== "undefined" && typeof OffscreenCanvas !== "undefined") {
|
|
742
|
+
try {
|
|
743
|
+
await this.startWorkerWithTrack(source, width, height, await this.backgroundForWorker(this.filter));
|
|
744
|
+
this.transport = "worker";
|
|
745
|
+
return;
|
|
746
|
+
} catch (e) {
|
|
747
|
+
this.teardownWorker();
|
|
748
|
+
console.warn("mediakit: no worker transport in this browser, staying on the main thread", e);
|
|
749
|
+
}
|
|
559
750
|
}
|
|
560
|
-
|
|
751
|
+
await this.startMain(source);
|
|
752
|
+
}
|
|
753
|
+
async startMain(source) {
|
|
754
|
+
const { width, height, fps } = this.size;
|
|
755
|
+
this.engine = await Engine.create(width, height, this.filter, this.effects, this.opts.alpha ?? false);
|
|
561
756
|
this.transport = hasInsertableStreams() ? "insertable" : "canvas";
|
|
757
|
+
this.frames = 0;
|
|
758
|
+
this.lastBeat = performance.now();
|
|
759
|
+
this.stalled = false;
|
|
562
760
|
if (this.transport === "insertable") {
|
|
563
761
|
this.startInsertable(source);
|
|
564
762
|
} else {
|
|
565
|
-
await this.startCanvas(source,
|
|
763
|
+
await this.startCanvas(source, fps);
|
|
566
764
|
}
|
|
567
765
|
}
|
|
568
766
|
/** Swap the background in place - no pipeline rebuild, so the picture does not flash. */
|
|
@@ -586,6 +784,8 @@ var VideoPipeline = class {
|
|
|
586
784
|
}
|
|
587
785
|
async stop() {
|
|
588
786
|
this.stopped = true;
|
|
787
|
+
this.stopWatchdog();
|
|
788
|
+
this.source = null;
|
|
589
789
|
this.abort?.abort();
|
|
590
790
|
this.abort = null;
|
|
591
791
|
if (this.rvfcHandle && this.video) {
|
|
@@ -625,6 +825,7 @@ var VideoPipeline = class {
|
|
|
625
825
|
this.worker.terminate();
|
|
626
826
|
this.worker = null;
|
|
627
827
|
this.workerStats = null;
|
|
828
|
+
this.workerLoading = false;
|
|
628
829
|
this.workerBackgroundPath = null;
|
|
629
830
|
}
|
|
630
831
|
/**
|
|
@@ -660,6 +861,53 @@ var VideoPipeline = class {
|
|
|
660
861
|
kind: "video",
|
|
661
862
|
signalTarget: source
|
|
662
863
|
});
|
|
864
|
+
return this.attachWorker(
|
|
865
|
+
(ready) => {
|
|
866
|
+
this.processedTrack = ready.track ?? generator;
|
|
867
|
+
},
|
|
868
|
+
() => generator.stop(),
|
|
869
|
+
() => this.send(
|
|
870
|
+
{
|
|
871
|
+
t: "start",
|
|
872
|
+
readable: processor.readable,
|
|
873
|
+
writable: generator.writable,
|
|
874
|
+
width,
|
|
875
|
+
height,
|
|
876
|
+
filter: this.filter,
|
|
877
|
+
effects: this.effects,
|
|
878
|
+
background,
|
|
879
|
+
alpha: this.opts.alpha
|
|
880
|
+
},
|
|
881
|
+
background ? [processor.readable, generator.writable, background] : [processor.readable, generator.writable]
|
|
882
|
+
)
|
|
883
|
+
);
|
|
884
|
+
}
|
|
885
|
+
/** Safari's dialect (see `startTrack` in worker/entry.ts). */
|
|
886
|
+
startWorkerWithTrack(source, width, height, background) {
|
|
887
|
+
const clone = source.clone();
|
|
888
|
+
return this.attachWorker(
|
|
889
|
+
(ready) => {
|
|
890
|
+
if (!ready.track) throw new Error("mediakit: the worker sent no track");
|
|
891
|
+
this.processedTrack = ready.track;
|
|
892
|
+
},
|
|
893
|
+
() => clone.stop(),
|
|
894
|
+
() => this.send(
|
|
895
|
+
{
|
|
896
|
+
t: "startTrack",
|
|
897
|
+
track: clone,
|
|
898
|
+
width,
|
|
899
|
+
height,
|
|
900
|
+
filter: this.filter,
|
|
901
|
+
effects: this.effects,
|
|
902
|
+
background,
|
|
903
|
+
alpha: this.opts.alpha
|
|
904
|
+
},
|
|
905
|
+
background ? [clone, background] : [clone]
|
|
906
|
+
)
|
|
907
|
+
);
|
|
908
|
+
}
|
|
909
|
+
/** Starts the worker and waits for its "ready". */
|
|
910
|
+
attachWorker(onReady, cleanup, post) {
|
|
663
911
|
const worker = new Worker("/mediakit/worker.js");
|
|
664
912
|
this.worker = worker;
|
|
665
913
|
return new Promise((resolve, reject) => {
|
|
@@ -668,47 +916,57 @@ var VideoPipeline = class {
|
|
|
668
916
|
if (settled) return;
|
|
669
917
|
settled = true;
|
|
670
918
|
clearTimeout(timer);
|
|
671
|
-
|
|
919
|
+
cleanup();
|
|
672
920
|
reject(err);
|
|
673
921
|
};
|
|
674
922
|
const timer = setTimeout(
|
|
675
923
|
() => fail(new Error(`mediakit: worker silent for more than ${WORKER_READY_MS}ms`)),
|
|
676
924
|
WORKER_READY_MS
|
|
677
925
|
);
|
|
678
|
-
worker.onerror = (e) =>
|
|
926
|
+
worker.onerror = (e) => {
|
|
927
|
+
if (settled) {
|
|
928
|
+
void this.moveOffWorker(e.message || "crashed");
|
|
929
|
+
return;
|
|
930
|
+
}
|
|
931
|
+
fail(new Error(e.message || "mediakit: worker failed to load"));
|
|
932
|
+
};
|
|
679
933
|
worker.onmessage = (e) => {
|
|
680
934
|
const m = e.data;
|
|
681
935
|
if (m.t === "stats") {
|
|
682
936
|
this.workerStats = m.stats;
|
|
937
|
+
this.lastBeat = performance.now();
|
|
938
|
+
if (m.frames >= 0) this.frames = m.frames;
|
|
939
|
+
this.workerLoading = m.loading;
|
|
940
|
+
this.stalled = false;
|
|
941
|
+
return;
|
|
942
|
+
}
|
|
943
|
+
if (m.t === "frame") {
|
|
944
|
+
this.deliver(m.frame);
|
|
683
945
|
return;
|
|
684
946
|
}
|
|
685
947
|
if (m.t === "error") {
|
|
686
948
|
if (settled) {
|
|
687
949
|
console.error("mediakit: worker failed after start", m.message);
|
|
950
|
+
void this.moveOffWorker("failed");
|
|
688
951
|
return;
|
|
689
952
|
}
|
|
690
953
|
fail(new Error(m.message));
|
|
691
954
|
return;
|
|
692
955
|
}
|
|
956
|
+
this.workerLoading = m.loading;
|
|
957
|
+
try {
|
|
958
|
+
onReady(m);
|
|
959
|
+
} catch (err) {
|
|
960
|
+
fail(err instanceof Error ? err : new Error(String(err)));
|
|
961
|
+
return;
|
|
962
|
+
}
|
|
693
963
|
settled = true;
|
|
694
964
|
clearTimeout(timer);
|
|
695
|
-
this.
|
|
965
|
+
if (this.frameSubs.size > 0) this.send({ t: "frames", on: true });
|
|
696
966
|
resolve();
|
|
697
967
|
};
|
|
698
968
|
try {
|
|
699
|
-
|
|
700
|
-
{
|
|
701
|
-
t: "start",
|
|
702
|
-
readable: processor.readable,
|
|
703
|
-
writable: generator.writable,
|
|
704
|
-
width,
|
|
705
|
-
height,
|
|
706
|
-
filter: this.filter,
|
|
707
|
-
effects: this.effects,
|
|
708
|
-
background
|
|
709
|
-
},
|
|
710
|
-
background ? [processor.readable, generator.writable, background] : [processor.readable, generator.writable]
|
|
711
|
-
);
|
|
969
|
+
post();
|
|
712
970
|
} catch (err) {
|
|
713
971
|
fail(err instanceof Error ? err : new Error(String(err)));
|
|
714
972
|
}
|
|
@@ -726,10 +984,13 @@ var VideoPipeline = class {
|
|
|
726
984
|
});
|
|
727
985
|
const transform = new TransformStream({
|
|
728
986
|
transform: (frame, controller) => {
|
|
987
|
+
this.beat();
|
|
729
988
|
try {
|
|
730
989
|
if (engine.render(frame, frame.timestamp)) {
|
|
731
990
|
controller.enqueue(engine.capture(frame.timestamp));
|
|
991
|
+
if (this.frameSubs.size > 0) this.deliver(engine.capture(frame.timestamp, true));
|
|
732
992
|
} else {
|
|
993
|
+
if (this.frameSubs.size > 0) this.deliver(frame.clone());
|
|
733
994
|
controller.enqueue(frame);
|
|
734
995
|
return;
|
|
735
996
|
}
|
|
@@ -771,8 +1032,13 @@ var VideoPipeline = class {
|
|
|
771
1032
|
this.processedTrack = stream.getVideoTracks()[0];
|
|
772
1033
|
const pump = (_now, meta) => {
|
|
773
1034
|
if (this.stopped || !this.engine) return;
|
|
1035
|
+
this.beat();
|
|
774
1036
|
try {
|
|
775
|
-
|
|
1037
|
+
const ts = Math.round(meta.mediaTime * 1e6);
|
|
1038
|
+
const drew = this.engine.render(video, ts);
|
|
1039
|
+
if (this.frameSubs.size > 0) {
|
|
1040
|
+
this.deliver(drew ? this.engine.capture(ts, true) : new VideoFrame(video, { timestamp: ts }));
|
|
1041
|
+
}
|
|
776
1042
|
} catch (e) {
|
|
777
1043
|
console.error("mediakit: frame processing failed", e);
|
|
778
1044
|
}
|
|
@@ -1189,9 +1455,950 @@ function css(c) {
|
|
|
1189
1455
|
const [r, g, b, a] = parseColor(c);
|
|
1190
1456
|
return `rgba(${Math.round(r * 255)},${Math.round(g * 255)},${Math.round(b * 255)},${a})`;
|
|
1191
1457
|
}
|
|
1458
|
+
|
|
1459
|
+
// src/facemesh.ts
|
|
1460
|
+
var FACE_UV = new Float32Array([
|
|
1461
|
+
0.49998,
|
|
1462
|
+
0.65253,
|
|
1463
|
+
0.50003,
|
|
1464
|
+
0.54749,
|
|
1465
|
+
0.49997,
|
|
1466
|
+
0.60237,
|
|
1467
|
+
0.48211,
|
|
1468
|
+
0.47198,
|
|
1469
|
+
0.50015,
|
|
1470
|
+
0.52716,
|
|
1471
|
+
0.49991,
|
|
1472
|
+
0.49825,
|
|
1473
|
+
0.49952,
|
|
1474
|
+
0.40106,
|
|
1475
|
+
0.28971,
|
|
1476
|
+
0.38076,
|
|
1477
|
+
0.49995,
|
|
1478
|
+
0.3124,
|
|
1479
|
+
0.49999,
|
|
1480
|
+
0.26992,
|
|
1481
|
+
0.50002,
|
|
1482
|
+
0.10705,
|
|
1483
|
+
0.50002,
|
|
1484
|
+
0.66623,
|
|
1485
|
+
0.50002,
|
|
1486
|
+
0.67922,
|
|
1487
|
+
0.50002,
|
|
1488
|
+
0.69235,
|
|
1489
|
+
0.49998,
|
|
1490
|
+
0.69528,
|
|
1491
|
+
0.49998,
|
|
1492
|
+
0.70593,
|
|
1493
|
+
0.49998,
|
|
1494
|
+
0.71938,
|
|
1495
|
+
0.49998,
|
|
1496
|
+
0.73702,
|
|
1497
|
+
0.49997,
|
|
1498
|
+
0.78137,
|
|
1499
|
+
0.49982,
|
|
1500
|
+
0.56298,
|
|
1501
|
+
0.47377,
|
|
1502
|
+
0.57391,
|
|
1503
|
+
0.10491,
|
|
1504
|
+
0.25414,
|
|
1505
|
+
0.36593,
|
|
1506
|
+
0.40958,
|
|
1507
|
+
0.33876,
|
|
1508
|
+
0.41302,
|
|
1509
|
+
0.31112,
|
|
1510
|
+
0.40946,
|
|
1511
|
+
0.27466,
|
|
1512
|
+
0.38913,
|
|
1513
|
+
0.39336,
|
|
1514
|
+
0.40371,
|
|
1515
|
+
0.34523,
|
|
1516
|
+
0.34401,
|
|
1517
|
+
0.37009,
|
|
1518
|
+
0.34608,
|
|
1519
|
+
0.31932,
|
|
1520
|
+
0.34727,
|
|
1521
|
+
0.2979,
|
|
1522
|
+
0.35359,
|
|
1523
|
+
0.24779,
|
|
1524
|
+
0.41081,
|
|
1525
|
+
0.39689,
|
|
1526
|
+
0.84276,
|
|
1527
|
+
0.2801,
|
|
1528
|
+
0.3756,
|
|
1529
|
+
0.10631,
|
|
1530
|
+
0.39996,
|
|
1531
|
+
0.20993,
|
|
1532
|
+
0.39135,
|
|
1533
|
+
0.35581,
|
|
1534
|
+
0.53441,
|
|
1535
|
+
0.47175,
|
|
1536
|
+
0.6504,
|
|
1537
|
+
0.47415,
|
|
1538
|
+
0.68019,
|
|
1539
|
+
0.43978,
|
|
1540
|
+
0.65723,
|
|
1541
|
+
0.41462,
|
|
1542
|
+
0.66654,
|
|
1543
|
+
0.45037,
|
|
1544
|
+
0.68086,
|
|
1545
|
+
0.42877,
|
|
1546
|
+
0.68269,
|
|
1547
|
+
0.37497,
|
|
1548
|
+
0.72781,
|
|
1549
|
+
0.48672,
|
|
1550
|
+
0.54763,
|
|
1551
|
+
0.4853,
|
|
1552
|
+
0.5274,
|
|
1553
|
+
0.25777,
|
|
1554
|
+
0.31449,
|
|
1555
|
+
0.40122,
|
|
1556
|
+
0.45517,
|
|
1557
|
+
0.42982,
|
|
1558
|
+
0.54862,
|
|
1559
|
+
0.42135,
|
|
1560
|
+
0.53374,
|
|
1561
|
+
0.2769,
|
|
1562
|
+
0.53206,
|
|
1563
|
+
0.48337,
|
|
1564
|
+
0.49959,
|
|
1565
|
+
0.33721,
|
|
1566
|
+
0.28288,
|
|
1567
|
+
0.29639,
|
|
1568
|
+
0.29324,
|
|
1569
|
+
0.1693,
|
|
1570
|
+
0.19381,
|
|
1571
|
+
0.44758,
|
|
1572
|
+
0.30261,
|
|
1573
|
+
0.39239,
|
|
1574
|
+
0.35389,
|
|
1575
|
+
0.35449,
|
|
1576
|
+
0.69678,
|
|
1577
|
+
0.06731,
|
|
1578
|
+
0.73011,
|
|
1579
|
+
0.44274,
|
|
1580
|
+
0.57283,
|
|
1581
|
+
0.4571,
|
|
1582
|
+
0.58479,
|
|
1583
|
+
0.38197,
|
|
1584
|
+
0.69471,
|
|
1585
|
+
0.39239,
|
|
1586
|
+
0.6942,
|
|
1587
|
+
0.27708,
|
|
1588
|
+
0.27193,
|
|
1589
|
+
0.42255,
|
|
1590
|
+
0.56323,
|
|
1591
|
+
0.38592,
|
|
1592
|
+
0.28136,
|
|
1593
|
+
0.3831,
|
|
1594
|
+
0.25584,
|
|
1595
|
+
0.33143,
|
|
1596
|
+
0.11971,
|
|
1597
|
+
0.22992,
|
|
1598
|
+
0.232,
|
|
1599
|
+
0.3645,
|
|
1600
|
+
0.18911,
|
|
1601
|
+
0.22962,
|
|
1602
|
+
0.29954,
|
|
1603
|
+
0.17329,
|
|
1604
|
+
0.27875,
|
|
1605
|
+
0.47288,
|
|
1606
|
+
0.6662,
|
|
1607
|
+
0.44683,
|
|
1608
|
+
0.66853,
|
|
1609
|
+
0.42276,
|
|
1610
|
+
0.67389,
|
|
1611
|
+
0.44531,
|
|
1612
|
+
0.58007,
|
|
1613
|
+
0.3881,
|
|
1614
|
+
0.69396,
|
|
1615
|
+
0.40304,
|
|
1616
|
+
0.70654,
|
|
1617
|
+
0.40363,
|
|
1618
|
+
0.69395,
|
|
1619
|
+
0.46004,
|
|
1620
|
+
0.55714,
|
|
1621
|
+
0.43116,
|
|
1622
|
+
0.69237,
|
|
1623
|
+
0.45218,
|
|
1624
|
+
0.69237,
|
|
1625
|
+
0.47539,
|
|
1626
|
+
0.69237,
|
|
1627
|
+
0.46583,
|
|
1628
|
+
0.77919,
|
|
1629
|
+
0.47233,
|
|
1630
|
+
0.73623,
|
|
1631
|
+
0.47309,
|
|
1632
|
+
0.71786,
|
|
1633
|
+
0.47312,
|
|
1634
|
+
0.70463,
|
|
1635
|
+
0.47303,
|
|
1636
|
+
0.69528,
|
|
1637
|
+
0.42794,
|
|
1638
|
+
0.69528,
|
|
1639
|
+
0.42648,
|
|
1640
|
+
0.70354,
|
|
1641
|
+
0.42316,
|
|
1642
|
+
0.71185,
|
|
1643
|
+
0.41831,
|
|
1644
|
+
0.72006,
|
|
1645
|
+
0.3901,
|
|
1646
|
+
0.63957,
|
|
1647
|
+
0.01395,
|
|
1648
|
+
0.56003,
|
|
1649
|
+
0.49991,
|
|
1650
|
+
0.58015,
|
|
1651
|
+
0.4132,
|
|
1652
|
+
0.6954,
|
|
1653
|
+
0.40963,
|
|
1654
|
+
0.70182,
|
|
1655
|
+
0.46808,
|
|
1656
|
+
0.60153,
|
|
1657
|
+
0.42273,
|
|
1658
|
+
0.58598,
|
|
1659
|
+
0.46308,
|
|
1660
|
+
0.59378,
|
|
1661
|
+
0.37212,
|
|
1662
|
+
0.47341,
|
|
1663
|
+
0.33456,
|
|
1664
|
+
0.49607,
|
|
1665
|
+
0.41167,
|
|
1666
|
+
0.54696,
|
|
1667
|
+
0.24218,
|
|
1668
|
+
0.14768,
|
|
1669
|
+
0.29078,
|
|
1670
|
+
0.20145,
|
|
1671
|
+
0.32734,
|
|
1672
|
+
0.25653,
|
|
1673
|
+
0.39951,
|
|
1674
|
+
0.74892,
|
|
1675
|
+
0.44173,
|
|
1676
|
+
0.26168,
|
|
1677
|
+
0.42977,
|
|
1678
|
+
0.18783,
|
|
1679
|
+
0.4122,
|
|
1680
|
+
0.1089,
|
|
1681
|
+
0.28896,
|
|
1682
|
+
0.39895,
|
|
1683
|
+
0.21894,
|
|
1684
|
+
0.43541,
|
|
1685
|
+
0.41278,
|
|
1686
|
+
0.39897,
|
|
1687
|
+
0.25714,
|
|
1688
|
+
0.35544,
|
|
1689
|
+
0.42768,
|
|
1690
|
+
0.43796,
|
|
1691
|
+
0.44834,
|
|
1692
|
+
0.53694,
|
|
1693
|
+
0.17856,
|
|
1694
|
+
0.45755,
|
|
1695
|
+
0.24731,
|
|
1696
|
+
0.45719,
|
|
1697
|
+
0.28627,
|
|
1698
|
+
0.46767,
|
|
1699
|
+
0.33283,
|
|
1700
|
+
0.46071,
|
|
1701
|
+
0.36876,
|
|
1702
|
+
0.44721,
|
|
1703
|
+
0.39896,
|
|
1704
|
+
0.43266,
|
|
1705
|
+
0.47641,
|
|
1706
|
+
0.40581,
|
|
1707
|
+
0.18924,
|
|
1708
|
+
0.52392,
|
|
1709
|
+
0.22896,
|
|
1710
|
+
0.34895,
|
|
1711
|
+
0.49073,
|
|
1712
|
+
0.5624,
|
|
1713
|
+
0.40467,
|
|
1714
|
+
0.48513,
|
|
1715
|
+
0.01947,
|
|
1716
|
+
0.40156,
|
|
1717
|
+
0.42624,
|
|
1718
|
+
0.42043,
|
|
1719
|
+
0.39699,
|
|
1720
|
+
0.5488,
|
|
1721
|
+
0.26647,
|
|
1722
|
+
0.37698,
|
|
1723
|
+
0.43912,
|
|
1724
|
+
0.51896,
|
|
1725
|
+
0.03231,
|
|
1726
|
+
0.64436,
|
|
1727
|
+
0.41905,
|
|
1728
|
+
0.38716,
|
|
1729
|
+
0.46278,
|
|
1730
|
+
0.50575,
|
|
1731
|
+
0.23898,
|
|
1732
|
+
0.77975,
|
|
1733
|
+
0.19822,
|
|
1734
|
+
0.83194,
|
|
1735
|
+
0.10755,
|
|
1736
|
+
0.54075,
|
|
1737
|
+
0.18361,
|
|
1738
|
+
0.74026,
|
|
1739
|
+
0.13441,
|
|
1740
|
+
0.33368,
|
|
1741
|
+
0.38576,
|
|
1742
|
+
0.88315,
|
|
1743
|
+
0.49097,
|
|
1744
|
+
0.57938,
|
|
1745
|
+
0.38238,
|
|
1746
|
+
0.50857,
|
|
1747
|
+
0.1744,
|
|
1748
|
+
0.39767,
|
|
1749
|
+
0.31878,
|
|
1750
|
+
0.39624,
|
|
1751
|
+
0.34336,
|
|
1752
|
+
0.4006,
|
|
1753
|
+
0.3961,
|
|
1754
|
+
0.71022,
|
|
1755
|
+
0.18788,
|
|
1756
|
+
0.58854,
|
|
1757
|
+
0.43099,
|
|
1758
|
+
0.94407,
|
|
1759
|
+
0.31899,
|
|
1760
|
+
0.89829,
|
|
1761
|
+
0.26625,
|
|
1762
|
+
0.8697,
|
|
1763
|
+
0.50002,
|
|
1764
|
+
0.19058,
|
|
1765
|
+
0.49998,
|
|
1766
|
+
0.95445,
|
|
1767
|
+
0.36617,
|
|
1768
|
+
0.39882,
|
|
1769
|
+
0.39321,
|
|
1770
|
+
0.39554,
|
|
1771
|
+
0.41037,
|
|
1772
|
+
0.39108,
|
|
1773
|
+
0.19499,
|
|
1774
|
+
0.3421,
|
|
1775
|
+
0.38866,
|
|
1776
|
+
0.36228,
|
|
1777
|
+
0.36596,
|
|
1778
|
+
0.35597,
|
|
1779
|
+
0.34336,
|
|
1780
|
+
0.35536,
|
|
1781
|
+
0.31878,
|
|
1782
|
+
0.35834,
|
|
1783
|
+
0.30141,
|
|
1784
|
+
0.36316,
|
|
1785
|
+
0.05813,
|
|
1786
|
+
0.31908,
|
|
1787
|
+
0.30141,
|
|
1788
|
+
0.38745,
|
|
1789
|
+
0.49999,
|
|
1790
|
+
0.61843,
|
|
1791
|
+
0.41584,
|
|
1792
|
+
0.6242,
|
|
1793
|
+
0.44568,
|
|
1794
|
+
0.56608,
|
|
1795
|
+
0.46584,
|
|
1796
|
+
0.62064,
|
|
1797
|
+
0.49992,
|
|
1798
|
+
0.35152,
|
|
1799
|
+
0.28872,
|
|
1800
|
+
0.81995,
|
|
1801
|
+
0.33528,
|
|
1802
|
+
0.85282,
|
|
1803
|
+
0.44051,
|
|
1804
|
+
0.90242,
|
|
1805
|
+
0.12829,
|
|
1806
|
+
0.79194,
|
|
1807
|
+
0.40877,
|
|
1808
|
+
0.37389,
|
|
1809
|
+
0.45561,
|
|
1810
|
+
0.4518,
|
|
1811
|
+
0.49988,
|
|
1812
|
+
0.90899,
|
|
1813
|
+
0.37544,
|
|
1814
|
+
0.92419,
|
|
1815
|
+
0.11421,
|
|
1816
|
+
0.61502,
|
|
1817
|
+
0.44866,
|
|
1818
|
+
0.69528,
|
|
1819
|
+
0.44802,
|
|
1820
|
+
0.70463,
|
|
1821
|
+
0.44711,
|
|
1822
|
+
0.71581,
|
|
1823
|
+
0.44483,
|
|
1824
|
+
0.73079,
|
|
1825
|
+
0.43001,
|
|
1826
|
+
0.76681,
|
|
1827
|
+
0.40679,
|
|
1828
|
+
0.68567,
|
|
1829
|
+
0.40074,
|
|
1830
|
+
0.68107,
|
|
1831
|
+
0.3924,
|
|
1832
|
+
0.6777,
|
|
1833
|
+
0.36786,
|
|
1834
|
+
0.66392,
|
|
1835
|
+
0.24792,
|
|
1836
|
+
0.60133,
|
|
1837
|
+
0.45277,
|
|
1838
|
+
0.42085,
|
|
1839
|
+
0.43639,
|
|
1840
|
+
0.35989,
|
|
1841
|
+
0.41616,
|
|
1842
|
+
0.36871,
|
|
1843
|
+
0.41339,
|
|
1844
|
+
0.69237,
|
|
1845
|
+
0.22802,
|
|
1846
|
+
0.68357,
|
|
1847
|
+
0.46827,
|
|
1848
|
+
0.35267,
|
|
1849
|
+
0.41136,
|
|
1850
|
+
0.80433,
|
|
1851
|
+
0.49999,
|
|
1852
|
+
0.46983,
|
|
1853
|
+
0.47915,
|
|
1854
|
+
0.44265,
|
|
1855
|
+
0.49997,
|
|
1856
|
+
0.43964,
|
|
1857
|
+
0.43211,
|
|
1858
|
+
0.49359,
|
|
1859
|
+
0.49989,
|
|
1860
|
+
0.86692,
|
|
1861
|
+
0.49991,
|
|
1862
|
+
0.82173,
|
|
1863
|
+
0.45655,
|
|
1864
|
+
0.8192,
|
|
1865
|
+
0.34455,
|
|
1866
|
+
0.74544,
|
|
1867
|
+
0.37891,
|
|
1868
|
+
0.57401,
|
|
1869
|
+
0.37429,
|
|
1870
|
+
0.78019,
|
|
1871
|
+
0.31969,
|
|
1872
|
+
0.57074,
|
|
1873
|
+
0.35716,
|
|
1874
|
+
0.60427,
|
|
1875
|
+
0.29528,
|
|
1876
|
+
0.62158,
|
|
1877
|
+
0.44775,
|
|
1878
|
+
0.86248,
|
|
1879
|
+
0.41099,
|
|
1880
|
+
0.50872,
|
|
1881
|
+
0.31395,
|
|
1882
|
+
0.77531,
|
|
1883
|
+
0.35413,
|
|
1884
|
+
0.81255,
|
|
1885
|
+
0.32455,
|
|
1886
|
+
0.70399,
|
|
1887
|
+
0.1891,
|
|
1888
|
+
0.6463,
|
|
1889
|
+
0.27978,
|
|
1890
|
+
0.71466,
|
|
1891
|
+
0.13382,
|
|
1892
|
+
0.6827,
|
|
1893
|
+
0.33677,
|
|
1894
|
+
0.64473,
|
|
1895
|
+
0.42988,
|
|
1896
|
+
0.46652,
|
|
1897
|
+
0.45553,
|
|
1898
|
+
0.54862,
|
|
1899
|
+
0.43711,
|
|
1900
|
+
0.5589,
|
|
1901
|
+
0.46729,
|
|
1902
|
+
0.52992,
|
|
1903
|
+
0.41471,
|
|
1904
|
+
0.33522,
|
|
1905
|
+
0.37705,
|
|
1906
|
+
0.32278,
|
|
1907
|
+
0.34411,
|
|
1908
|
+
0.32015,
|
|
1909
|
+
0.31288,
|
|
1910
|
+
0.32233,
|
|
1911
|
+
0.28353,
|
|
1912
|
+
0.33319,
|
|
1913
|
+
0.24125,
|
|
1914
|
+
0.38279,
|
|
1915
|
+
0.10299,
|
|
1916
|
+
0.46876,
|
|
1917
|
+
0.26761,
|
|
1918
|
+
0.42456,
|
|
1919
|
+
0.29788,
|
|
1920
|
+
0.43318,
|
|
1921
|
+
0.33343,
|
|
1922
|
+
0.43388,
|
|
1923
|
+
0.36643,
|
|
1924
|
+
0.42612,
|
|
1925
|
+
0.39601,
|
|
1926
|
+
0.4167,
|
|
1927
|
+
0.42012,
|
|
1928
|
+
0.41023,
|
|
1929
|
+
756e-5,
|
|
1930
|
+
0.48078,
|
|
1931
|
+
0.43295,
|
|
1932
|
+
0.56952,
|
|
1933
|
+
0.45864,
|
|
1934
|
+
0.47909,
|
|
1935
|
+
0.47347,
|
|
1936
|
+
0.54574,
|
|
1937
|
+
0.47609,
|
|
1938
|
+
0.56383,
|
|
1939
|
+
0.46847,
|
|
1940
|
+
0.55506,
|
|
1941
|
+
0.43399,
|
|
1942
|
+
0.58236,
|
|
1943
|
+
0.48352,
|
|
1944
|
+
0.56298,
|
|
1945
|
+
0.48248,
|
|
1946
|
+
0.57785,
|
|
1947
|
+
0.42645,
|
|
1948
|
+
0.3898,
|
|
1949
|
+
0.439,
|
|
1950
|
+
0.3965,
|
|
1951
|
+
0.45007,
|
|
1952
|
+
0.40043,
|
|
1953
|
+
0.28971,
|
|
1954
|
+
0.36825,
|
|
1955
|
+
0.27667,
|
|
1956
|
+
0.36337,
|
|
1957
|
+
0.51786,
|
|
1958
|
+
0.47195,
|
|
1959
|
+
0.71029,
|
|
1960
|
+
0.38076,
|
|
1961
|
+
0.52623,
|
|
1962
|
+
0.57391,
|
|
1963
|
+
0.89509,
|
|
1964
|
+
0.25414,
|
|
1965
|
+
0.63407,
|
|
1966
|
+
0.40958,
|
|
1967
|
+
0.66124,
|
|
1968
|
+
0.41302,
|
|
1969
|
+
0.68888,
|
|
1970
|
+
0.40946,
|
|
1971
|
+
0.72534,
|
|
1972
|
+
0.38913,
|
|
1973
|
+
0.60663,
|
|
1974
|
+
0.4037,
|
|
1975
|
+
0.65477,
|
|
1976
|
+
0.34401,
|
|
1977
|
+
0.62991,
|
|
1978
|
+
0.34608,
|
|
1979
|
+
0.68068,
|
|
1980
|
+
0.34727,
|
|
1981
|
+
0.7021,
|
|
1982
|
+
0.35359,
|
|
1983
|
+
0.75221,
|
|
1984
|
+
0.4108,
|
|
1985
|
+
0.60292,
|
|
1986
|
+
0.84286,
|
|
1987
|
+
0.7199,
|
|
1988
|
+
0.3756,
|
|
1989
|
+
0.89369,
|
|
1990
|
+
0.39996,
|
|
1991
|
+
0.79008,
|
|
1992
|
+
0.39135,
|
|
1993
|
+
0.644,
|
|
1994
|
+
0.53449,
|
|
1995
|
+
0.52825,
|
|
1996
|
+
0.6504,
|
|
1997
|
+
0.52585,
|
|
1998
|
+
0.68019,
|
|
1999
|
+
0.56022,
|
|
2000
|
+
0.65723,
|
|
2001
|
+
0.58538,
|
|
2002
|
+
0.66654,
|
|
2003
|
+
0.54963,
|
|
2004
|
+
0.68086,
|
|
2005
|
+
0.57123,
|
|
2006
|
+
0.68269,
|
|
2007
|
+
0.62485,
|
|
2008
|
+
0.7281,
|
|
2009
|
+
0.51305,
|
|
2010
|
+
0.54728,
|
|
2011
|
+
0.5151,
|
|
2012
|
+
0.52725,
|
|
2013
|
+
0.74225,
|
|
2014
|
+
0.31451,
|
|
2015
|
+
0.59863,
|
|
2016
|
+
0.45498,
|
|
2017
|
+
0.57034,
|
|
2018
|
+
0.54858,
|
|
2019
|
+
0.57863,
|
|
2020
|
+
0.53362,
|
|
2021
|
+
0.72309,
|
|
2022
|
+
0.53205,
|
|
2023
|
+
0.51645,
|
|
2024
|
+
0.49964,
|
|
2025
|
+
0.6628,
|
|
2026
|
+
0.28292,
|
|
2027
|
+
0.70362,
|
|
2028
|
+
0.29327,
|
|
2029
|
+
0.83071,
|
|
2030
|
+
0.19381,
|
|
2031
|
+
0.55239,
|
|
2032
|
+
0.30257,
|
|
2033
|
+
0.60761,
|
|
2034
|
+
0.35389,
|
|
2035
|
+
0.64543,
|
|
2036
|
+
0.69671,
|
|
2037
|
+
0.9327,
|
|
2038
|
+
0.73011,
|
|
2039
|
+
0.55726,
|
|
2040
|
+
0.57283,
|
|
2041
|
+
0.5429,
|
|
2042
|
+
0.58479,
|
|
2043
|
+
0.61803,
|
|
2044
|
+
0.69471,
|
|
2045
|
+
0.60759,
|
|
2046
|
+
0.6942,
|
|
2047
|
+
0.72294,
|
|
2048
|
+
0.27196,
|
|
2049
|
+
0.57741,
|
|
2050
|
+
0.56317,
|
|
2051
|
+
0.61408,
|
|
2052
|
+
0.28139,
|
|
2053
|
+
0.61691,
|
|
2054
|
+
0.25589,
|
|
2055
|
+
0.66851,
|
|
2056
|
+
0.11991,
|
|
2057
|
+
0.77009,
|
|
2058
|
+
0.23202,
|
|
2059
|
+
0.63554,
|
|
2060
|
+
0.18925,
|
|
2061
|
+
0.77039,
|
|
2062
|
+
0.29956,
|
|
2063
|
+
0.82672,
|
|
2064
|
+
0.27875,
|
|
2065
|
+
0.52712,
|
|
2066
|
+
0.6662,
|
|
2067
|
+
0.55317,
|
|
2068
|
+
0.66853,
|
|
2069
|
+
0.57724,
|
|
2070
|
+
0.67389,
|
|
2071
|
+
0.55469,
|
|
2072
|
+
0.58007,
|
|
2073
|
+
0.6119,
|
|
2074
|
+
0.69396,
|
|
2075
|
+
0.59696,
|
|
2076
|
+
0.70654,
|
|
2077
|
+
0.59637,
|
|
2078
|
+
0.69395,
|
|
2079
|
+
0.53996,
|
|
2080
|
+
0.55714,
|
|
2081
|
+
0.56884,
|
|
2082
|
+
0.69237,
|
|
2083
|
+
0.54782,
|
|
2084
|
+
0.69237,
|
|
2085
|
+
0.52461,
|
|
2086
|
+
0.69237,
|
|
2087
|
+
0.53409,
|
|
2088
|
+
0.77914,
|
|
2089
|
+
0.52767,
|
|
2090
|
+
0.73623,
|
|
2091
|
+
0.52691,
|
|
2092
|
+
0.71786,
|
|
2093
|
+
0.52688,
|
|
2094
|
+
0.70463,
|
|
2095
|
+
0.52697,
|
|
2096
|
+
0.69528,
|
|
2097
|
+
0.57206,
|
|
2098
|
+
0.69528,
|
|
2099
|
+
0.57352,
|
|
2100
|
+
0.70354,
|
|
2101
|
+
0.57684,
|
|
2102
|
+
0.71185,
|
|
2103
|
+
0.58169,
|
|
2104
|
+
0.72006,
|
|
2105
|
+
0.60994,
|
|
2106
|
+
0.63991,
|
|
2107
|
+
0.98605,
|
|
2108
|
+
0.56003,
|
|
2109
|
+
0.5868,
|
|
2110
|
+
0.6954,
|
|
2111
|
+
0.59037,
|
|
2112
|
+
0.70182,
|
|
2113
|
+
0.53192,
|
|
2114
|
+
0.60154,
|
|
2115
|
+
0.57727,
|
|
2116
|
+
0.58593,
|
|
2117
|
+
0.53692,
|
|
2118
|
+
0.59379,
|
|
2119
|
+
0.62754,
|
|
2120
|
+
0.47335,
|
|
2121
|
+
0.66559,
|
|
2122
|
+
0.49595,
|
|
2123
|
+
0.58835,
|
|
2124
|
+
0.54686,
|
|
2125
|
+
0.75782,
|
|
2126
|
+
0.14768,
|
|
2127
|
+
0.70925,
|
|
2128
|
+
0.20151,
|
|
2129
|
+
0.67268,
|
|
2130
|
+
0.25658,
|
|
2131
|
+
0.60041,
|
|
2132
|
+
0.749,
|
|
2133
|
+
0.55827,
|
|
2134
|
+
0.26167,
|
|
2135
|
+
0.5703,
|
|
2136
|
+
0.18787,
|
|
2137
|
+
0.58817,
|
|
2138
|
+
0.10904,
|
|
2139
|
+
0.71105,
|
|
2140
|
+
0.39895,
|
|
2141
|
+
0.78107,
|
|
2142
|
+
0.43541,
|
|
2143
|
+
0.58725,
|
|
2144
|
+
0.39893,
|
|
2145
|
+
0.74287,
|
|
2146
|
+
0.35545,
|
|
2147
|
+
0.57216,
|
|
2148
|
+
0.43765,
|
|
2149
|
+
0.55187,
|
|
2150
|
+
0.53657,
|
|
2151
|
+
0.82144,
|
|
2152
|
+
0.45756,
|
|
2153
|
+
0.7527,
|
|
2154
|
+
0.45718,
|
|
2155
|
+
0.71376,
|
|
2156
|
+
0.46763,
|
|
2157
|
+
0.66711,
|
|
2158
|
+
0.46067,
|
|
2159
|
+
0.6311,
|
|
2160
|
+
0.44715,
|
|
2161
|
+
0.60086,
|
|
2162
|
+
0.43247,
|
|
2163
|
+
0.52348,
|
|
2164
|
+
0.40563,
|
|
2165
|
+
0.81075,
|
|
2166
|
+
0.52393,
|
|
2167
|
+
0.77105,
|
|
2168
|
+
0.34896,
|
|
2169
|
+
0.50913,
|
|
2170
|
+
0.56272,
|
|
2171
|
+
0.59529,
|
|
2172
|
+
0.48502,
|
|
2173
|
+
0.98053,
|
|
2174
|
+
0.40156,
|
|
2175
|
+
0.5735,
|
|
2176
|
+
0.42,
|
|
2177
|
+
0.60299,
|
|
2178
|
+
0.54869,
|
|
2179
|
+
0.73353,
|
|
2180
|
+
0.37698,
|
|
2181
|
+
0.56061,
|
|
2182
|
+
0.51902,
|
|
2183
|
+
0.96769,
|
|
2184
|
+
0.64436,
|
|
2185
|
+
0.58098,
|
|
2186
|
+
0.38716,
|
|
2187
|
+
0.53773,
|
|
2188
|
+
0.50538,
|
|
2189
|
+
0.76097,
|
|
2190
|
+
0.77975,
|
|
2191
|
+
0.80178,
|
|
2192
|
+
0.83194,
|
|
2193
|
+
0.89244,
|
|
2194
|
+
0.54076,
|
|
2195
|
+
0.81635,
|
|
2196
|
+
0.74026,
|
|
2197
|
+
0.8656,
|
|
2198
|
+
0.33369,
|
|
2199
|
+
0.61407,
|
|
2200
|
+
0.88325,
|
|
2201
|
+
0.50895,
|
|
2202
|
+
0.57944,
|
|
2203
|
+
0.61794,
|
|
2204
|
+
0.50832,
|
|
2205
|
+
0.82561,
|
|
2206
|
+
0.39768,
|
|
2207
|
+
0.68122,
|
|
2208
|
+
0.39624,
|
|
2209
|
+
0.65664,
|
|
2210
|
+
0.4006,
|
|
2211
|
+
0.6039,
|
|
2212
|
+
0.71022,
|
|
2213
|
+
0.81209,
|
|
2214
|
+
0.58854,
|
|
2215
|
+
0.56801,
|
|
2216
|
+
0.94456,
|
|
2217
|
+
0.68101,
|
|
2218
|
+
0.89829,
|
|
2219
|
+
0.73375,
|
|
2220
|
+
0.8697,
|
|
2221
|
+
0.63383,
|
|
2222
|
+
0.39882,
|
|
2223
|
+
0.60679,
|
|
2224
|
+
0.39554,
|
|
2225
|
+
0.58966,
|
|
2226
|
+
0.39106,
|
|
2227
|
+
0.80502,
|
|
2228
|
+
0.34211,
|
|
2229
|
+
0.61133,
|
|
2230
|
+
0.36228,
|
|
2231
|
+
0.63404,
|
|
2232
|
+
0.35597,
|
|
2233
|
+
0.65664,
|
|
2234
|
+
0.35536,
|
|
2235
|
+
0.68122,
|
|
2236
|
+
0.35834,
|
|
2237
|
+
0.69859,
|
|
2238
|
+
0.36316,
|
|
2239
|
+
0.94187,
|
|
2240
|
+
0.31908,
|
|
2241
|
+
0.69859,
|
|
2242
|
+
0.38745,
|
|
2243
|
+
0.58418,
|
|
2244
|
+
0.62411,
|
|
2245
|
+
0.55432,
|
|
2246
|
+
0.56608,
|
|
2247
|
+
0.53415,
|
|
2248
|
+
0.62064,
|
|
2249
|
+
0.71122,
|
|
2250
|
+
0.81998,
|
|
2251
|
+
0.66463,
|
|
2252
|
+
0.85287,
|
|
2253
|
+
0.5591,
|
|
2254
|
+
0.90263,
|
|
2255
|
+
0.87171,
|
|
2256
|
+
0.79194,
|
|
2257
|
+
0.59123,
|
|
2258
|
+
0.37389,
|
|
2259
|
+
0.54434,
|
|
2260
|
+
0.45158,
|
|
2261
|
+
0.62456,
|
|
2262
|
+
0.92419,
|
|
2263
|
+
0.88577,
|
|
2264
|
+
0.61503,
|
|
2265
|
+
0.55134,
|
|
2266
|
+
0.69528,
|
|
2267
|
+
0.55198,
|
|
2268
|
+
0.70463,
|
|
2269
|
+
0.55289,
|
|
2270
|
+
0.71581,
|
|
2271
|
+
0.55517,
|
|
2272
|
+
0.73079,
|
|
2273
|
+
0.56994,
|
|
2274
|
+
0.76704,
|
|
2275
|
+
0.5932,
|
|
2276
|
+
0.68568,
|
|
2277
|
+
0.59926,
|
|
2278
|
+
0.68107,
|
|
2279
|
+
0.6076,
|
|
2280
|
+
0.6777,
|
|
2281
|
+
0.63194,
|
|
2282
|
+
0.6635,
|
|
2283
|
+
0.75203,
|
|
2284
|
+
0.60132,
|
|
2285
|
+
0.54723,
|
|
2286
|
+
0.42039,
|
|
2287
|
+
0.56354,
|
|
2288
|
+
0.35983,
|
|
2289
|
+
0.58384,
|
|
2290
|
+
0.36871,
|
|
2291
|
+
0.58661,
|
|
2292
|
+
0.69237,
|
|
2293
|
+
0.77192,
|
|
2294
|
+
0.68358,
|
|
2295
|
+
0.5316,
|
|
2296
|
+
0.35248,
|
|
2297
|
+
0.58837,
|
|
2298
|
+
0.80444,
|
|
2299
|
+
0.5208,
|
|
2300
|
+
0.44256,
|
|
2301
|
+
0.56798,
|
|
2302
|
+
0.49348,
|
|
2303
|
+
0.54328,
|
|
2304
|
+
0.81926,
|
|
2305
|
+
0.65532,
|
|
2306
|
+
0.74551,
|
|
2307
|
+
0.62101,
|
|
2308
|
+
0.57402,
|
|
2309
|
+
0.62556,
|
|
2310
|
+
0.78031,
|
|
2311
|
+
0.6802,
|
|
2312
|
+
0.57072,
|
|
2313
|
+
0.64276,
|
|
2314
|
+
0.60434,
|
|
2315
|
+
0.70466,
|
|
2316
|
+
0.62153,
|
|
2317
|
+
0.55201,
|
|
2318
|
+
0.86259,
|
|
2319
|
+
0.58907,
|
|
2320
|
+
0.50864,
|
|
2321
|
+
0.68595,
|
|
2322
|
+
0.77536,
|
|
2323
|
+
0.64573,
|
|
2324
|
+
0.81264,
|
|
2325
|
+
0.67534,
|
|
2326
|
+
0.70398,
|
|
2327
|
+
0.81086,
|
|
2328
|
+
0.64631,
|
|
2329
|
+
0.72012,
|
|
2330
|
+
0.71467,
|
|
2331
|
+
0.86615,
|
|
2332
|
+
0.68271,
|
|
2333
|
+
0.66319,
|
|
2334
|
+
0.6446,
|
|
2335
|
+
0.57008,
|
|
2336
|
+
0.46633,
|
|
2337
|
+
0.54456,
|
|
2338
|
+
0.54838,
|
|
2339
|
+
0.56276,
|
|
2340
|
+
0.55878,
|
|
2341
|
+
0.53199,
|
|
2342
|
+
0.53014,
|
|
2343
|
+
0.58527,
|
|
2344
|
+
0.33518,
|
|
2345
|
+
0.62295,
|
|
2346
|
+
0.32278,
|
|
2347
|
+
0.6559,
|
|
2348
|
+
0.32016,
|
|
2349
|
+
0.68713,
|
|
2350
|
+
0.32235,
|
|
2351
|
+
0.71648,
|
|
2352
|
+
0.3332,
|
|
2353
|
+
0.75876,
|
|
2354
|
+
0.38279,
|
|
2355
|
+
0.89701,
|
|
2356
|
+
0.46877,
|
|
2357
|
+
0.73239,
|
|
2358
|
+
0.42455,
|
|
2359
|
+
0.70211,
|
|
2360
|
+
0.43316,
|
|
2361
|
+
0.66653,
|
|
2362
|
+
0.43387,
|
|
2363
|
+
0.6335,
|
|
2364
|
+
0.42609,
|
|
2365
|
+
0.60388,
|
|
2366
|
+
0.41659,
|
|
2367
|
+
0.57966,
|
|
2368
|
+
0.40995,
|
|
2369
|
+
0.99244,
|
|
2370
|
+
0.48078,
|
|
2371
|
+
0.56719,
|
|
2372
|
+
0.56942,
|
|
2373
|
+
0.54137,
|
|
2374
|
+
0.4789,
|
|
2375
|
+
0.52656,
|
|
2376
|
+
0.54612,
|
|
2377
|
+
0.52391,
|
|
2378
|
+
0.56383,
|
|
2379
|
+
0.53153,
|
|
2380
|
+
0.55506,
|
|
2381
|
+
0.56604,
|
|
2382
|
+
0.58233,
|
|
2383
|
+
0.51631,
|
|
2384
|
+
0.56305,
|
|
2385
|
+
0.51747,
|
|
2386
|
+
0.57788,
|
|
2387
|
+
0.57359,
|
|
2388
|
+
0.38981,
|
|
2389
|
+
0.5607,
|
|
2390
|
+
0.39533,
|
|
2391
|
+
0.54976,
|
|
2392
|
+
0.39975,
|
|
2393
|
+
0.71029,
|
|
2394
|
+
0.36825,
|
|
2395
|
+
0.72333,
|
|
2396
|
+
0.36337
|
|
2397
|
+
]);
|
|
1192
2398
|
export {
|
|
1193
2399
|
BLEND_MODES,
|
|
1194
2400
|
Engine,
|
|
2401
|
+
FACE_UV,
|
|
1195
2402
|
NO_EFFECTS,
|
|
1196
2403
|
Scene,
|
|
1197
2404
|
TOUCH_UP,
|