-
Notifications
You must be signed in to change notification settings - Fork 366
Expand file tree
/
Copy pathmcp.mjs
More file actions
70 lines (69 loc) · 1.58 KB
/
Copy pathmcp.mjs
File metadata and controls
70 lines (69 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Polyfill DOMMatrix/ImageData/Path2D before pdfjs-dist loads.
// Uses dynamic import() so polyfills execute before pdfjs-dist initializes.
if (typeof globalThis.DOMMatrix === "undefined") {
globalThis.DOMMatrix = class DOMMatrix {
constructor(init) {
this.a = 1;
this.b = 0;
this.c = 0;
this.d = 1;
this.e = 0;
this.f = 0;
if (Array.isArray(init))
[this.a, this.b, this.c, this.d, this.e, this.f] = init;
}
get isIdentity() {
return (
this.a === 1 &&
this.b === 0 &&
this.c === 0 &&
this.d === 1 &&
this.e === 0 &&
this.f === 0
);
}
translate() {
return new DOMMatrix();
}
scale() {
return new DOMMatrix();
}
inverse() {
return new DOMMatrix();
}
multiply() {
return new DOMMatrix();
}
transformPoint(p) {
return p ?? { x: 0, y: 0 };
}
static fromMatrix() {
return new DOMMatrix();
}
};
}
if (typeof globalThis.ImageData === "undefined") {
globalThis.ImageData = class ImageData {
constructor(w, h) {
this.width = w;
this.height = h;
this.data = new Uint8ClampedArray(w * h * 4);
}
};
}
if (typeof globalThis.Path2D === "undefined") {
globalThis.Path2D = class Path2D {
moveTo() {}
lineTo() {}
bezierCurveTo() {}
quadraticCurveTo() {}
arc() {}
arcTo() {}
ellipse() {}
rect() {}
closePath() {}
};
}
// Dynamic import so polyfills above execute first.
const { default: handler } = await import("../dist/http.js");
export default handler;