@thednp/dommatrix 2.0.7 → 2.0.9

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.
@@ -1,288 +1,285 @@
1
- /** A DOMMPoint compatible Tuple. */
2
- export interface PointTuple {
3
- x: number;
4
- y: number;
5
- z: number;
6
- w: number;
7
- }
8
- /** The result of **CSSMatrix.toJSON()** / **DOMMatrix.toJSON()** instance calls. */
9
- export interface JSONMatrix {
10
- m11: number;
11
- m12: number;
12
- m13: number;
13
- m14: number;
14
- m21: number;
15
- m22: number;
16
- m23: number;
17
- m24: number;
18
- m31: number;
19
- m32: number;
20
- m33: number;
21
- m34: number;
22
- m41: number;
23
- m42: number;
24
- m43: number;
25
- m44: number;
26
- a: number;
27
- b: number;
28
- c: number;
29
- d: number;
30
- e: number;
31
- f: number;
32
- is2D: boolean;
33
- isIdentity: boolean;
34
- }
35
- /** An array of 6 numbers representing a 2D matrix. */
36
- export type Matrix = [
37
- number,
38
- number,
39
- number,
40
- number,
41
- number,
42
- number
43
- ];
44
- /** An array of 16 numbers representing a 3D matrix. */
45
- export type Matrix3d = [
46
- number,
47
- number,
48
- number,
49
- number,
50
- number,
51
- number,
52
- number,
53
- number,
54
- number,
55
- number,
56
- number,
57
- number,
58
- number,
59
- number,
60
- number,
61
- number
62
- ];
63
- /** All CSSMatrix compatible initialization values. */
64
- export type CSSMatrixInput = string | any[] | CSSMatrix | DOMMatrix | JSONMatrix | Float32Array | Float64Array;
65
- /**
66
- * Creates and returns a new `DOMMatrix` compatible instance
67
- * with equivalent instance.
68
- *
69
- * @class CSSMatrix
70
- *
71
- * @author thednp <https://github.com/thednp/DOMMatrix/>
72
- * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrix
73
- */
74
- export default class CSSMatrix {
75
- m11: number;
76
- m12: number;
77
- m13: number;
78
- m14: number;
79
- m21: number;
80
- m22: number;
81
- m23: number;
82
- m24: number;
83
- m31: number;
84
- m32: number;
85
- m33: number;
86
- m34: number;
87
- m41: number;
88
- m42: number;
89
- m43: number;
90
- m44: number;
91
- a: number;
92
- b: number;
93
- c: number;
94
- d: number;
95
- e: number;
96
- f: number;
97
- static Translate: (x: number, y: number, z: number) => CSSMatrix;
98
- static Rotate: (rx: number, ry: number, rz: number) => CSSMatrix;
99
- static RotateAxisAngle: (x: number, y: number, z: number, alpha: number) => CSSMatrix;
100
- static Scale: (x: number, y: number, z: number) => CSSMatrix;
101
- static SkewX: (angle: number) => CSSMatrix;
102
- static SkewY: (angle: number) => CSSMatrix;
103
- static Skew: (angleX: number, angleY: number) => CSSMatrix;
104
- static Multiply: (m1: CSSMatrix | DOMMatrix | JSONMatrix, m2: CSSMatrix | DOMMatrix | JSONMatrix) => CSSMatrix;
105
- static fromArray: (array: any[] | Float32Array | Float64Array) => CSSMatrix;
106
- static fromMatrix: (m: CSSMatrix | DOMMatrix | JSONMatrix) => CSSMatrix;
107
- static fromString: (source: string) => CSSMatrix;
108
- static toArray: (m: CSSMatrix | DOMMatrix | JSONMatrix, is2D?: boolean) => Matrix | Matrix3d;
109
- static isCompatibleArray: (array?: unknown) => array is Matrix | Matrix3d | Float32Array | Float64Array;
110
- static isCompatibleObject: (object?: unknown) => object is CSSMatrix | DOMMatrix | JSONMatrix;
111
- /**
112
- * @constructor
113
- * @param init accepts all parameter configurations:
114
- * * valid CSS transform string,
115
- * * CSSMatrix/DOMMatrix instance,
116
- * * a 6/16 elements *Array*.
117
- */
118
- constructor(init?: CSSMatrixInput);
119
- /**
120
- * A `Boolean` whose value is `true` if the matrix is the identity matrix. The identity
121
- * matrix is one in which every value is 0 except those on the main diagonal from top-left
122
- * to bottom-right corner (in other words, where the offsets in each direction are equal).
123
- *
124
- * @return the current property value
125
- */
126
- get isIdentity(): boolean;
127
- /**
128
- * A `Boolean` flag whose value is `true` if the matrix was initialized as a 2D matrix
129
- * and `false` if the matrix is 3D.
130
- *
131
- * @return the current property value
132
- */
133
- get is2D(): boolean;
134
- /**
135
- * The `setMatrixValue` method replaces the existing matrix with one computed
136
- * in the browser. EG: `matrix(1,0.25,-0.25,1,0,0)`
137
- *
138
- * The method accepts any *Array* values, the result of
139
- * `DOMMatrix` instance method `toFloat64Array()` / `toFloat32Array()` calls
140
- * or `CSSMatrix` instance method `toArray()`.
141
- *
142
- * This method expects valid *matrix()* / *matrix3d()* string values, as well
143
- * as other transform functions like *translateX(10px)*.
144
- *
145
- * @param source
146
- * @return the matrix instance
147
- */
148
- setMatrixValue(source?: CSSMatrixInput): CSSMatrix;
149
- /**
150
- * Returns a *Float32Array* containing elements which comprise the matrix.
151
- * The method can return either the 16 elements or the 6 elements
152
- * depending on the value of the `is2D` parameter.
153
- *
154
- * @param is2D *Array* representation of the matrix
155
- * @return an *Array* representation of the matrix
156
- */
157
- toFloat32Array(is2D?: boolean): Float32Array;
158
- /**
159
- * Returns a *Float64Array* containing elements which comprise the matrix.
160
- * The method can return either the 16 elements or the 6 elements
161
- * depending on the value of the `is2D` parameter.
162
- *
163
- * @param is2D *Array* representation of the matrix
164
- * @return an *Array* representation of the matrix
165
- */
166
- toFloat64Array(is2D?: boolean): Float64Array;
167
- /**
168
- * Creates and returns a string representation of the matrix in `CSS` matrix syntax,
169
- * using the appropriate `CSS` matrix notation.
170
- *
171
- * matrix3d *matrix3d(m11, m12, m13, m14, m21, ...)*
172
- * matrix *matrix(a, b, c, d, e, f)*
173
- *
174
- * @return a string representation of the matrix
175
- */
176
- toString(): string;
177
- /**
178
- * Returns a JSON representation of the `CSSMatrix` instance, a standard *Object*
179
- * that includes `{a,b,c,d,e,f}` and `{m11,m12,m13,..m44}` properties as well
180
- * as the `is2D` & `isIdentity` properties.
181
- *
182
- * The result can also be used as a second parameter for the `fromMatrix` static method
183
- * to load values into another matrix instance.
184
- *
185
- * @return an *Object* with all matrix values.
186
- */
187
- toJSON(): JSONMatrix;
188
- /**
189
- * The Multiply method returns a new CSSMatrix which is the result of this
190
- * matrix multiplied by the passed matrix, with the passed matrix to the right.
191
- * This matrix is not modified.
192
- *
193
- * @param m2 CSSMatrix
194
- * @return The resulted matrix.
195
- */
196
- multiply(m2: CSSMatrix | DOMMatrix | JSONMatrix): CSSMatrix;
197
- /**
198
- * The translate method returns a new matrix which is this matrix post
199
- * multiplied by a translation matrix containing the passed values. If the z
200
- * component is undefined, a 0 value is used in its place. This matrix is not
201
- * modified.
202
- *
203
- * @param x X component of the translation value.
204
- * @param y Y component of the translation value.
205
- * @param z Z component of the translation value.
206
- * @return The resulted matrix
207
- */
208
- translate(x: number, y?: number, z?: number): CSSMatrix;
209
- /**
210
- * The scale method returns a new matrix which is this matrix post multiplied by
211
- * a scale matrix containing the passed values. If the z component is undefined,
212
- * a 1 value is used in its place. If the y component is undefined, the x
213
- * component value is used in its place. This matrix is not modified.
214
- *
215
- * @param x The X component of the scale value.
216
- * @param y The Y component of the scale value.
217
- * @param z The Z component of the scale value.
218
- * @return The resulted matrix
219
- */
220
- scale(x: number, y?: number, z?: number): CSSMatrix;
221
- /**
222
- * The rotate method returns a new matrix which is this matrix post multiplied
223
- * by each of 3 rotation matrices about the major axes, first X, then Y, then Z.
224
- * If the y and z components are undefined, the x value is used to rotate the
225
- * object about the z axis, as though the vector (0,0,x) were passed. All
226
- * rotation values are in degrees. This matrix is not modified.
227
- *
228
- * @param rx The X component of the rotation, or Z if Y and Z are null.
229
- * @param ry The (optional) Y component of the rotation value.
230
- * @param rz The (optional) Z component of the rotation value.
231
- * @return The resulted matrix
232
- */
233
- rotate(rx: number, ry?: number, rz?: number): CSSMatrix;
234
- /**
235
- * The rotateAxisAngle method returns a new matrix which is this matrix post
236
- * multiplied by a rotation matrix with the given axis and `angle`. The right-hand
237
- * rule is used to determine the direction of rotation. All rotation values are
238
- * in degrees. This matrix is not modified.
239
- *
240
- * @param x The X component of the axis vector.
241
- * @param y The Y component of the axis vector.
242
- * @param z The Z component of the axis vector.
243
- * @param angle The angle of rotation about the axis vector, in degrees.
244
- * @return The resulted matrix
245
- */
246
- rotateAxisAngle(x: number, y: number, z: number, angle: number): CSSMatrix;
247
- /**
248
- * Specifies a skew transformation along the `x-axis` by the given angle.
249
- * This matrix is not modified.
250
- *
251
- * @param angle The angle amount in degrees to skew.
252
- * @return The resulted matrix
253
- */
254
- skewX(angle: number): CSSMatrix;
255
- /**
256
- * Specifies a skew transformation along the `y-axis` by the given angle.
257
- * This matrix is not modified.
258
- *
259
- * @param angle The angle amount in degrees to skew.
260
- * @return The resulted matrix
261
- */
262
- skewY(angle: number): CSSMatrix;
263
- /**
264
- * Specifies a skew transformation along both the `x-axis` and `y-axis`.
265
- * This matrix is not modified.
266
- *
267
- * @param angleX The X-angle amount in degrees to skew.
268
- * @param angleY The angle amount in degrees to skew.
269
- * @return The resulted matrix
270
- */
271
- skew(angleX: number, angleY: number): CSSMatrix;
272
- /**
273
- * Transforms a specified vector using the matrix, returning a new
274
- * {x,y,z,w} Tuple *Object* comprising the transformed vector.
275
- * Neither the matrix nor the original vector are altered.
276
- *
277
- * The method is equivalent with `transformPoint()` method
278
- * of the `DOMMatrix` constructor.
279
- *
280
- * @param t Tuple with `{x,y,z,w}` components
281
- * @return the resulting Tuple
282
- */
283
- transformPoint(t: PointTuple | DOMPoint): PointTuple | DOMPoint;
284
- }
285
-
286
- export as namespace CSSMatrix;
287
-
288
- export {};
1
+ /**
2
+ * Creates and returns a new `DOMMatrix` compatible instance
3
+ * with equivalent instance.
4
+ *
5
+ * @class CSSMatrix
6
+ *
7
+ * @author thednp <https://github.com/thednp/DOMMatrix/>
8
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMMatrix
9
+ */
10
+ declare class CSSMatrix {
11
+ m11: number;
12
+ m12: number;
13
+ m13: number;
14
+ m14: number;
15
+ m21: number;
16
+ m22: number;
17
+ m23: number;
18
+ m24: number;
19
+ m31: number;
20
+ m32: number;
21
+ m33: number;
22
+ m34: number;
23
+ m41: number;
24
+ m42: number;
25
+ m43: number;
26
+ m44: number;
27
+ a: number;
28
+ b: number;
29
+ c: number;
30
+ d: number;
31
+ e: number;
32
+ f: number;
33
+ static Translate: (x: number, y: number, z: number) => CSSMatrix;
34
+ static Rotate: (rx: number, ry: number, rz: number) => CSSMatrix;
35
+ static RotateAxisAngle: (x: number, y: number, z: number, alpha: number) => CSSMatrix;
36
+ static Scale: (x: number, y: number, z: number) => CSSMatrix;
37
+ static SkewX: (angle: number) => CSSMatrix;
38
+ static SkewY: (angle: number) => CSSMatrix;
39
+ static Skew: (angleX: number, angleY: number) => CSSMatrix;
40
+ static Multiply: (m1: CSSMatrix | DOMMatrix | JSONMatrix, m2: CSSMatrix | DOMMatrix | JSONMatrix) => CSSMatrix;
41
+ static fromArray: (array: number[] | Float32Array | Float64Array) => CSSMatrix;
42
+ static fromMatrix: (m: CSSMatrix | DOMMatrix | JSONMatrix) => CSSMatrix;
43
+ static fromString: (source: string) => CSSMatrix;
44
+ static toArray: (m: CSSMatrix | DOMMatrix | JSONMatrix, is2D?: boolean) => Matrix | Matrix3d;
45
+ static isCompatibleArray: (array?: unknown) => array is Matrix | Matrix3d | Float32Array | Float64Array;
46
+ static isCompatibleObject: (object?: unknown) => object is CSSMatrix | DOMMatrix | JSONMatrix;
47
+ /**
48
+ * @constructor
49
+ * @param init accepts all parameter configurations:
50
+ * * valid CSS transform string,
51
+ * * CSSMatrix/DOMMatrix instance,
52
+ * * a 6/16 elements *Array*.
53
+ */
54
+ constructor(init?: CSSMatrixInput);
55
+ /**
56
+ * A `Boolean` whose value is `true` if the matrix is the identity matrix. The identity
57
+ * matrix is one in which every value is 0 except those on the main diagonal from top-left
58
+ * to bottom-right corner (in other words, where the offsets in each direction are equal).
59
+ *
60
+ * @return the current property value
61
+ */
62
+ get isIdentity(): boolean;
63
+ /**
64
+ * A `Boolean` flag whose value is `true` if the matrix was initialized as a 2D matrix
65
+ * and `false` if the matrix is 3D.
66
+ *
67
+ * @return the current property value
68
+ */
69
+ get is2D(): boolean;
70
+ /**
71
+ * The `setMatrixValue` method replaces the existing matrix with one computed
72
+ * in the browser. EG: `matrix(1,0.25,-0.25,1,0,0)`
73
+ *
74
+ * The method accepts any *Array* values, the result of
75
+ * `DOMMatrix` instance method `toFloat64Array()` / `toFloat32Array()` calls
76
+ * or `CSSMatrix` instance method `toArray()`.
77
+ *
78
+ * This method expects valid *matrix()* / *matrix3d()* string values, as well
79
+ * as other transform functions like *translateX(10px)*.
80
+ *
81
+ * @param source
82
+ * @return the matrix instance
83
+ */
84
+ setMatrixValue(source?: CSSMatrixInput): CSSMatrix;
85
+ /**
86
+ * Returns a *Float32Array* containing elements which comprise the matrix.
87
+ * The method can return either the 16 elements or the 6 elements
88
+ * depending on the value of the `is2D` parameter.
89
+ *
90
+ * @param is2D *Array* representation of the matrix
91
+ * @return an *Array* representation of the matrix
92
+ */
93
+ toFloat32Array(is2D?: boolean): Float32Array;
94
+ /**
95
+ * Returns a *Float64Array* containing elements which comprise the matrix.
96
+ * The method can return either the 16 elements or the 6 elements
97
+ * depending on the value of the `is2D` parameter.
98
+ *
99
+ * @param is2D *Array* representation of the matrix
100
+ * @return an *Array* representation of the matrix
101
+ */
102
+ toFloat64Array(is2D?: boolean): Float64Array;
103
+ /**
104
+ * Creates and returns a string representation of the matrix in `CSS` matrix syntax,
105
+ * using the appropriate `CSS` matrix notation.
106
+ *
107
+ * matrix3d *matrix3d(m11, m12, m13, m14, m21, ...)*
108
+ * matrix *matrix(a, b, c, d, e, f)*
109
+ *
110
+ * @return a string representation of the matrix
111
+ */
112
+ toString(): string;
113
+ /**
114
+ * Returns a JSON representation of the `CSSMatrix` instance, a standard *Object*
115
+ * that includes `{a,b,c,d,e,f}` and `{m11,m12,m13,..m44}` properties as well
116
+ * as the `is2D` & `isIdentity` properties.
117
+ *
118
+ * The result can also be used as a second parameter for the `fromMatrix` static method
119
+ * to load values into another matrix instance.
120
+ *
121
+ * @return an *Object* with all matrix values.
122
+ */
123
+ toJSON(): JSONMatrix;
124
+ /**
125
+ * The Multiply method returns a new CSSMatrix which is the result of this
126
+ * matrix multiplied by the passed matrix, with the passed matrix to the right.
127
+ * This matrix is not modified.
128
+ *
129
+ * @param m2 CSSMatrix
130
+ * @return The resulted matrix.
131
+ */
132
+ multiply(m2: CSSMatrix | DOMMatrix | JSONMatrix): CSSMatrix;
133
+ /**
134
+ * The translate method returns a new matrix which is this matrix post
135
+ * multiplied by a translation matrix containing the passed values. If the z
136
+ * component is undefined, a 0 value is used in its place. This matrix is not
137
+ * modified.
138
+ *
139
+ * @param x X component of the translation value.
140
+ * @param y Y component of the translation value.
141
+ * @param z Z component of the translation value.
142
+ * @return The resulted matrix
143
+ */
144
+ translate(x: number, y?: number, z?: number): CSSMatrix;
145
+ /**
146
+ * The scale method returns a new matrix which is this matrix post multiplied by
147
+ * a scale matrix containing the passed values. If the z component is undefined,
148
+ * a 1 value is used in its place. If the y component is undefined, the x
149
+ * component value is used in its place. This matrix is not modified.
150
+ *
151
+ * @param x The X component of the scale value.
152
+ * @param y The Y component of the scale value.
153
+ * @param z The Z component of the scale value.
154
+ * @return The resulted matrix
155
+ */
156
+ scale(x: number, y?: number, z?: number): CSSMatrix;
157
+ /**
158
+ * The rotate method returns a new matrix which is this matrix post multiplied
159
+ * by each of 3 rotation matrices about the major axes, first X, then Y, then Z.
160
+ * If the y and z components are undefined, the x value is used to rotate the
161
+ * object about the z axis, as though the vector (0,0,x) were passed. All
162
+ * rotation values are in degrees. This matrix is not modified.
163
+ *
164
+ * @param rx The X component of the rotation, or Z if Y and Z are null.
165
+ * @param ry The (optional) Y component of the rotation value.
166
+ * @param rz The (optional) Z component of the rotation value.
167
+ * @return The resulted matrix
168
+ */
169
+ rotate(rx: number, ry?: number, rz?: number): CSSMatrix;
170
+ /**
171
+ * The rotateAxisAngle method returns a new matrix which is this matrix post
172
+ * multiplied by a rotation matrix with the given axis and `angle`. The right-hand
173
+ * rule is used to determine the direction of rotation. All rotation values are
174
+ * in degrees. This matrix is not modified.
175
+ *
176
+ * @param x The X component of the axis vector.
177
+ * @param y The Y component of the axis vector.
178
+ * @param z The Z component of the axis vector.
179
+ * @param angle The angle of rotation about the axis vector, in degrees.
180
+ * @return The resulted matrix
181
+ */
182
+ rotateAxisAngle(x: number, y: number, z: number, angle: number): CSSMatrix;
183
+ /**
184
+ * Specifies a skew transformation along the `x-axis` by the given angle.
185
+ * This matrix is not modified.
186
+ *
187
+ * @param angle The angle amount in degrees to skew.
188
+ * @return The resulted matrix
189
+ */
190
+ skewX(angle: number): CSSMatrix;
191
+ /**
192
+ * Specifies a skew transformation along the `y-axis` by the given angle.
193
+ * This matrix is not modified.
194
+ *
195
+ * @param angle The angle amount in degrees to skew.
196
+ * @return The resulted matrix
197
+ */
198
+ skewY(angle: number): CSSMatrix;
199
+ /**
200
+ * Specifies a skew transformation along both the `x-axis` and `y-axis`.
201
+ * This matrix is not modified.
202
+ *
203
+ * @param angleX The X-angle amount in degrees to skew.
204
+ * @param angleY The angle amount in degrees to skew.
205
+ * @return The resulted matrix
206
+ */
207
+ skew(angleX: number, angleY: number): CSSMatrix;
208
+ /**
209
+ * Transforms a specified vector using the matrix, returning a new
210
+ * {x,y,z,w} Tuple *Object* comprising the transformed vector.
211
+ * Neither the matrix nor the original vector are altered.
212
+ *
213
+ * The method is equivalent with `transformPoint()` method
214
+ * of the `DOMMatrix` constructor.
215
+ *
216
+ * @param t Tuple with `{x,y,z,w}` components
217
+ * @return the resulting Tuple
218
+ */
219
+ transformPoint(t: PointTuple | DOMPoint): PointTuple | DOMPoint;
220
+ }
221
+ export default CSSMatrix;
222
+
223
+ /** All CSSMatrix compatible initialization values. */
224
+ declare type CSSMatrixInput = string | number[] | CSSMatrix | DOMMatrix | JSONMatrix | Float32Array | Float64Array;
225
+
226
+ /** The result of **CSSMatrix.toJSON()** / **DOMMatrix.toJSON()** instance calls. */
227
+ declare interface JSONMatrix {
228
+ m11: number;
229
+ m12: number;
230
+ m13: number;
231
+ m14: number;
232
+ m21: number;
233
+ m22: number;
234
+ m23: number;
235
+ m24: number;
236
+ m31: number;
237
+ m32: number;
238
+ m33: number;
239
+ m34: number;
240
+ m41: number;
241
+ m42: number;
242
+ m43: number;
243
+ m44: number;
244
+ a: number;
245
+ b: number;
246
+ c: number;
247
+ d: number;
248
+ e: number;
249
+ f: number;
250
+ is2D: boolean;
251
+ isIdentity: boolean;
252
+ }
253
+
254
+ /** An array of 6 numbers representing a 2D matrix. */
255
+ declare type Matrix = [number, number, number, number, number, number];
256
+
257
+ /** An array of 16 numbers representing a 3D matrix. */
258
+ declare type Matrix3d = [
259
+ number,
260
+ number,
261
+ number,
262
+ number,
263
+ number,
264
+ number,
265
+ number,
266
+ number,
267
+ number,
268
+ number,
269
+ number,
270
+ number,
271
+ number,
272
+ number,
273
+ number,
274
+ number
275
+ ];
276
+
277
+ /** A DOMMPoint compatible Tuple. */
278
+ declare interface PointTuple {
279
+ x: number;
280
+ y: number;
281
+ z: number;
282
+ w: number;
283
+ }
284
+
285
+ export { }
package/dist/dommatrix.js CHANGED
@@ -1,2 +1,3 @@
1
- var CSSMatrix=function(){"use strict";var z=Object.defineProperty;var S=(g,N,v)=>N in g?z(g,N,{enumerable:!0,configurable:!0,writable:!0,value:v}):g[N]=v;var p=(g,N,v)=>S(g,typeof N!="symbol"?N+"":N,v);const g={a:1,b:0,c:0,d:1,e:0,f:0,m11:1,m12:0,m13:0,m14:0,m21:0,m22:1,m23:0,m24:0,m31:0,m32:0,m33:1,m34:0,m41:0,m42:0,m43:0,m44:1,is2D:!0,isIdentity:!0},N=s=>(s instanceof Float64Array||s instanceof Float32Array||Array.isArray(s)&&s.every(t=>typeof t=="number"))&&[6,16].some(t=>s.length===t),v=s=>s instanceof DOMMatrix||s instanceof f||typeof s=="object"&&Object.keys(g).every(t=>s&&t in s),k=s=>{const t=new f,e=Array.from(s);if(!N(e))throw TypeError(`CSSMatrix: "${e.join(",")}" must be an array with 6/16 numbers.`);if(e.length===16){const[n,i,r,a,l,m,h,c,y,u,w,o,d,A,M,x]=e;t.m11=n,t.a=n,t.m21=l,t.c=l,t.m31=y,t.m41=d,t.e=d,t.m12=i,t.b=i,t.m22=m,t.d=m,t.m32=u,t.m42=A,t.f=A,t.m13=r,t.m23=h,t.m33=w,t.m43=M,t.m14=a,t.m24=c,t.m34=o,t.m44=x}else if(e.length===6){const[n,i,r,a,l,m]=e;t.m11=n,t.a=n,t.m12=i,t.b=i,t.m21=r,t.c=r,t.m22=a,t.d=a,t.m41=l,t.e=l,t.m42=m,t.f=m}return t},Y=s=>{if(v(s))return k([s.m11,s.m12,s.m13,s.m14,s.m21,s.m22,s.m23,s.m24,s.m31,s.m32,s.m33,s.m34,s.m41,s.m42,s.m43,s.m44]);throw TypeError(`CSSMatrix: "${JSON.stringify(s)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`)},F=s=>{if(typeof s!="string")throw TypeError(`CSSMatrix: "${JSON.stringify(s)}" is not a string.`);const t=String(s).replace(/\s/g,"");let e=new f;const n=`CSSMatrix: invalid transform string "${s}"`;return t.split(")").filter(i=>i).forEach(i=>{const[r,a]=i.split("(");if(!a)throw TypeError(n);const l=a.split(",").map(o=>o.includes("rad")?parseFloat(o)*(180/Math.PI):parseFloat(o)),[m,h,c,y]=l,u=[m,h,c],w=[m,h,c,y];if(r==="perspective"&&m&&[h,c].every(o=>o===void 0))e.m34=-1/m;else if(r.includes("matrix")&&[6,16].includes(l.length)&&l.every(o=>!Number.isNaN(+o))){const o=l.map(d=>Math.abs(d)<1e-6?0:d);e=e.multiply(k(o))}else if(r==="translate3d"&&u.every(o=>!Number.isNaN(+o)))e=e.translate(m,h,c);else if(r==="translate"&&m&&c===void 0)e=e.translate(m,h||0,0);else if(r==="rotate3d"&&w.every(o=>!Number.isNaN(+o))&&y)e=e.rotateAxisAngle(m,h,c,y);else if(r==="rotate"&&m&&[h,c].every(o=>o===void 0))e=e.rotate(0,0,m);else if(r==="scale3d"&&u.every(o=>!Number.isNaN(+o))&&u.some(o=>o!==1))e=e.scale(m,h,c);else if(r==="scale"&&!Number.isNaN(m)&&m!==1&&c===void 0){const d=Number.isNaN(+h)?m:h;e=e.scale(m,d,1)}else if(r==="skew"&&(m||!Number.isNaN(m)&&h)&&c===void 0)e=e.skew(m,h||0);else if(["translate","rotate","scale","skew"].some(o=>r.includes(o))&&/[XYZ]/.test(r)&&m&&[h,c].every(o=>o===void 0))if(r==="skewX"||r==="skewY")e=e[r](m);else{const o=r.replace(/[XYZ]/,""),d=r.replace(o,""),A=["X","Y","Z"].indexOf(d),M=o==="scale"?1:0,x=[A===0?m:M,A===1?m:M,A===2?m:M];e=e[o](...x)}else throw TypeError(n)}),e},O=(s,t)=>t?[s.a,s.b,s.c,s.d,s.e,s.f]:[s.m11,s.m12,s.m13,s.m14,s.m21,s.m22,s.m23,s.m24,s.m31,s.m32,s.m33,s.m34,s.m41,s.m42,s.m43,s.m44],T=(s,t,e)=>{const n=new f;return n.m41=s,n.e=s,n.m42=t,n.f=t,n.m43=e,n},I=(s,t,e)=>{const n=new f,i=Math.PI/180,r=s*i,a=t*i,l=e*i,m=Math.cos(r),h=-Math.sin(r),c=Math.cos(a),y=-Math.sin(a),u=Math.cos(l),w=-Math.sin(l),o=c*u,d=-c*w;n.m11=o,n.a=o,n.m12=d,n.b=d,n.m13=y;const A=h*y*u+m*w;n.m21=A,n.c=A;const M=m*u-h*y*w;return n.m22=M,n.d=M,n.m23=-h*c,n.m31=h*w-m*y*u,n.m32=h*u+m*y*w,n.m33=m*c,n},R=(s,t,e,n)=>{const i=new f,r=Math.sqrt(s*s+t*t+e*e);if(r===0)return i;const a=s/r,l=t/r,m=e/r,h=n*(Math.PI/360),c=Math.sin(h),y=Math.cos(h),u=c*c,w=a*a,o=l*l,d=m*m,A=1-2*(o+d)*u;i.m11=A,i.a=A;const M=2*(a*l*u+m*c*y);i.m12=M,i.b=M,i.m13=2*(a*m*u-l*c*y);const x=2*(l*a*u-m*c*y);i.m21=x,i.c=x;const Z=1-2*(d+w)*u;return i.m22=Z,i.d=Z,i.m23=2*(l*m*u+a*c*y),i.m31=2*(m*a*u+l*c*y),i.m32=2*(m*l*u-a*c*y),i.m33=1-2*(w+o)*u,i},D=(s,t,e)=>{const n=new f;return n.m11=s,n.a=s,n.m22=t,n.d=t,n.m33=e,n},X=(s,t)=>{const e=new f;if(s){const n=s*Math.PI/180,i=Math.tan(n);e.m21=i,e.c=i}if(t){const n=t*Math.PI/180,i=Math.tan(n);e.m12=i,e.b=i}return e},E=s=>X(s,0),P=s=>X(0,s),b=(s,t)=>{const e=t.m11*s.m11+t.m12*s.m21+t.m13*s.m31+t.m14*s.m41,n=t.m11*s.m12+t.m12*s.m22+t.m13*s.m32+t.m14*s.m42,i=t.m11*s.m13+t.m12*s.m23+t.m13*s.m33+t.m14*s.m43,r=t.m11*s.m14+t.m12*s.m24+t.m13*s.m34+t.m14*s.m44,a=t.m21*s.m11+t.m22*s.m21+t.m23*s.m31+t.m24*s.m41,l=t.m21*s.m12+t.m22*s.m22+t.m23*s.m32+t.m24*s.m42,m=t.m21*s.m13+t.m22*s.m23+t.m23*s.m33+t.m24*s.m43,h=t.m21*s.m14+t.m22*s.m24+t.m23*s.m34+t.m24*s.m44,c=t.m31*s.m11+t.m32*s.m21+t.m33*s.m31+t.m34*s.m41,y=t.m31*s.m12+t.m32*s.m22+t.m33*s.m32+t.m34*s.m42,u=t.m31*s.m13+t.m32*s.m23+t.m33*s.m33+t.m34*s.m43,w=t.m31*s.m14+t.m32*s.m24+t.m33*s.m34+t.m34*s.m44,o=t.m41*s.m11+t.m42*s.m21+t.m43*s.m31+t.m44*s.m41,d=t.m41*s.m12+t.m42*s.m22+t.m43*s.m32+t.m44*s.m42,A=t.m41*s.m13+t.m42*s.m23+t.m43*s.m33+t.m44*s.m43,M=t.m41*s.m14+t.m42*s.m24+t.m43*s.m34+t.m44*s.m44;return k([e,n,i,r,a,l,m,h,c,y,u,w,o,d,A,M])};class f{constructor(t){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this.m11=1,this.m12=0,this.m13=0,this.m14=0,this.m21=0,this.m22=1,this.m23=0,this.m24=0,this.m31=0,this.m32=0,this.m33=1,this.m34=0,this.m41=0,this.m42=0,this.m43=0,this.m44=1,t?this.setMatrixValue(t):this}get isIdentity(){return this.m11===1&&this.m12===0&&this.m13===0&&this.m14===0&&this.m21===0&&this.m22===1&&this.m23===0&&this.m24===0&&this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m41===0&&this.m42===0&&this.m43===0&&this.m44===1}get is2D(){return this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m43===0&&this.m44===1}setMatrixValue(t){return typeof t=="string"&&t.length&&t!=="none"?F(t):Array.isArray(t)||t instanceof Float64Array||t instanceof Float32Array?k(t):typeof t=="object"?Y(t):this}toFloat32Array(t){return Float32Array.from(O(this,t))}toFloat64Array(t){return Float64Array.from(O(this,t))}toString(){const{is2D:t}=this,e=this.toFloat64Array(t).join(", ");return`${t?"matrix":"matrix3d"}(${e})`}toJSON(){const{is2D:t,isIdentity:e}=this;return{...this,is2D:t,isIdentity:e}}multiply(t){return b(this,t)}translate(t,e,n){const i=t;let r=e,a=n;return typeof r>"u"&&(r=0),typeof a>"u"&&(a=0),b(this,T(i,r,a))}scale(t,e,n){const i=t;let r=e,a=n;return typeof r>"u"&&(r=t),typeof a>"u"&&(a=1),b(this,D(i,r,a))}rotate(t,e,n){let i=t,r=e||0,a=n||0;return typeof t=="number"&&typeof e>"u"&&typeof n>"u"&&(a=i,i=0,r=0),b(this,I(i,r,a))}rotateAxisAngle(t,e,n,i){if([t,e,n,i].some(r=>Number.isNaN(+r)))throw new TypeError("CSSMatrix: expecting 4 values");return b(this,R(t,e,n,i))}skewX(t){return b(this,E(t))}skewY(t){return b(this,P(t))}skew(t,e){return b(this,X(t,e))}transformPoint(t){const e=this.m11*t.x+this.m21*t.y+this.m31*t.z+this.m41*t.w,n=this.m12*t.x+this.m22*t.y+this.m32*t.z+this.m42*t.w,i=this.m13*t.x+this.m23*t.y+this.m33*t.z+this.m43*t.w,r=this.m14*t.x+this.m24*t.y+this.m34*t.z+this.m44*t.w;return t instanceof DOMPoint?new DOMPoint(e,n,i,r):{x:e,y:n,z:i,w:r}}}return p(f,"Translate",T),p(f,"Rotate",I),p(f,"RotateAxisAngle",R),p(f,"Scale",D),p(f,"SkewX",E),p(f,"SkewY",P),p(f,"Skew",X),p(f,"Multiply",b),p(f,"fromArray",k),p(f,"fromMatrix",Y),p(f,"fromString",F),p(f,"toArray",O),p(f,"isCompatibleArray",N),p(f,"isCompatibleObject",v),f}();
1
+ var CSSMatrix=function(){"use strict";var z=Object.defineProperty;var S=(g,N,v)=>N in g?z(g,N,{enumerable:!0,configurable:!0,writable:!0,value:v}):g[N]=v;var p=(g,N,v)=>S(g,typeof N!="symbol"?N+"":N,v);const g={a:1,b:0,c:0,d:1,e:0,f:0,m11:1,m12:0,m13:0,m14:0,m21:0,m22:1,m23:0,m24:0,m31:0,m32:0,m33:1,m34:0,m41:0,m42:0,m43:0,m44:1,is2D:!0,isIdentity:!0},N=s=>(s instanceof Float64Array||s instanceof Float32Array||Array.isArray(s)&&s.every(t=>typeof t=="number"))&&[6,16].some(t=>s.length===t),v=s=>s instanceof DOMMatrix||s instanceof f||typeof s=="object"&&Object.keys(g).every(t=>s&&t in s),k=s=>{const t=new f,e=Array.from(s);if(!N(e))throw TypeError(`CSSMatrix: "${e.join(",")}" must be an array with 6/16 numbers.`);// istanbul ignore else @preserve
2
+ if(e.length===16){const[n,i,r,a,l,m,h,c,y,u,w,o,d,A,M,x]=e;t.m11=n,t.a=n,t.m21=l,t.c=l,t.m31=y,t.m41=d,t.e=d,t.m12=i,t.b=i,t.m22=m,t.d=m,t.m32=u,t.m42=A,t.f=A,t.m13=r,t.m23=h,t.m33=w,t.m43=M,t.m14=a,t.m24=c,t.m34=o,t.m44=x}else if(e.length===6){const[n,i,r,a,l,m]=e;t.m11=n,t.a=n,t.m12=i,t.b=i,t.m21=r,t.c=r,t.m22=a,t.d=a,t.m41=l,t.e=l,t.m42=m,t.f=m}return t},Y=s=>{if(v(s))return k([s.m11,s.m12,s.m13,s.m14,s.m21,s.m22,s.m23,s.m24,s.m31,s.m32,s.m33,s.m34,s.m41,s.m42,s.m43,s.m44]);throw TypeError(`CSSMatrix: "${JSON.stringify(s)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`)},F=s=>{if(typeof s!="string")throw TypeError(`CSSMatrix: "${JSON.stringify(s)}" is not a string.`);const t=String(s).replace(/\s/g,"");let e=new f;const n=`CSSMatrix: invalid transform string "${s}"`;return t.split(")").filter(i=>i).forEach(i=>{const[r,a]=i.split("(");if(!a)throw TypeError(n);const l=a.split(",").map(o=>o.includes("rad")?parseFloat(o)*(180/Math.PI):parseFloat(o)),[m,h,c,y]=l,u=[m,h,c],w=[m,h,c,y];if(r==="perspective"&&m&&[h,c].every(o=>o===void 0))e.m34=-1/m;else if(r.includes("matrix")&&[6,16].includes(l.length)&&l.every(o=>!Number.isNaN(+o))){const o=l.map(d=>Math.abs(d)<1e-6?0:d);e=e.multiply(k(o))}else if(r==="translate3d"&&u.every(o=>!Number.isNaN(+o)))e=e.translate(m,h,c);else if(r==="translate"&&m&&c===void 0)e=e.translate(m,h||0,0);else if(r==="rotate3d"&&w.every(o=>!Number.isNaN(+o))&&y)e=e.rotateAxisAngle(m,h,c,y);else if(r==="rotate"&&m&&[h,c].every(o=>o===void 0))e=e.rotate(0,0,m);else if(r==="scale3d"&&u.every(o=>!Number.isNaN(+o))&&u.some(o=>o!==1))e=e.scale(m,h,c);else if(r==="scale"&&!Number.isNaN(m)&&m!==1&&c===void 0){const d=Number.isNaN(+h)?m:h;e=e.scale(m,d,1)}else if(r==="skew"&&(m||!Number.isNaN(m)&&h)&&c===void 0)e=e.skew(m,h||0);else if(["translate","rotate","scale","skew"].some(o=>r.includes(o))&&/[XYZ]/.test(r)&&m&&[h,c].every(o=>o===void 0))if(r==="skewX"||r==="skewY")e=e[r](m);else{const o=r.replace(/[XYZ]/,""),d=r.replace(o,""),A=["X","Y","Z"].indexOf(d),M=o==="scale"?1:0,x=[A===0?m:M,A===1?m:M,A===2?m:M];e=e[o](...x)}else throw TypeError(n)}),e},O=(s,t)=>t?[s.a,s.b,s.c,s.d,s.e,s.f]:[s.m11,s.m12,s.m13,s.m14,s.m21,s.m22,s.m23,s.m24,s.m31,s.m32,s.m33,s.m34,s.m41,s.m42,s.m43,s.m44],T=(s,t,e)=>{const n=new f;return n.m41=s,n.e=s,n.m42=t,n.f=t,n.m43=e,n},I=(s,t,e)=>{const n=new f,i=Math.PI/180,r=s*i,a=t*i,l=e*i,m=Math.cos(r),h=-Math.sin(r),c=Math.cos(a),y=-Math.sin(a),u=Math.cos(l),w=-Math.sin(l),o=c*u,d=-c*w;n.m11=o,n.a=o,n.m12=d,n.b=d,n.m13=y;const A=h*y*u+m*w;n.m21=A,n.c=A;const M=m*u-h*y*w;return n.m22=M,n.d=M,n.m23=-h*c,n.m31=h*w-m*y*u,n.m32=h*u+m*y*w,n.m33=m*c,n},R=(s,t,e,n)=>{const i=new f,r=Math.sqrt(s*s+t*t+e*e);if(r===0)return i;const a=s/r,l=t/r,m=e/r,h=n*(Math.PI/360),c=Math.sin(h),y=Math.cos(h),u=c*c,w=a*a,o=l*l,d=m*m,A=1-2*(o+d)*u;i.m11=A,i.a=A;const M=2*(a*l*u+m*c*y);i.m12=M,i.b=M,i.m13=2*(a*m*u-l*c*y);const x=2*(l*a*u-m*c*y);i.m21=x,i.c=x;const Z=1-2*(d+w)*u;return i.m22=Z,i.d=Z,i.m23=2*(l*m*u+a*c*y),i.m31=2*(m*a*u+l*c*y),i.m32=2*(m*l*u-a*c*y),i.m33=1-2*(w+o)*u,i},D=(s,t,e)=>{const n=new f;return n.m11=s,n.a=s,n.m22=t,n.d=t,n.m33=e,n},X=(s,t)=>{const e=new f;if(s){const n=s*Math.PI/180,i=Math.tan(n);e.m21=i,e.c=i}if(t){const n=t*Math.PI/180,i=Math.tan(n);e.m12=i,e.b=i}return e},E=s=>X(s,0),P=s=>X(0,s),b=(s,t)=>{const e=t.m11*s.m11+t.m12*s.m21+t.m13*s.m31+t.m14*s.m41,n=t.m11*s.m12+t.m12*s.m22+t.m13*s.m32+t.m14*s.m42,i=t.m11*s.m13+t.m12*s.m23+t.m13*s.m33+t.m14*s.m43,r=t.m11*s.m14+t.m12*s.m24+t.m13*s.m34+t.m14*s.m44,a=t.m21*s.m11+t.m22*s.m21+t.m23*s.m31+t.m24*s.m41,l=t.m21*s.m12+t.m22*s.m22+t.m23*s.m32+t.m24*s.m42,m=t.m21*s.m13+t.m22*s.m23+t.m23*s.m33+t.m24*s.m43,h=t.m21*s.m14+t.m22*s.m24+t.m23*s.m34+t.m24*s.m44,c=t.m31*s.m11+t.m32*s.m21+t.m33*s.m31+t.m34*s.m41,y=t.m31*s.m12+t.m32*s.m22+t.m33*s.m32+t.m34*s.m42,u=t.m31*s.m13+t.m32*s.m23+t.m33*s.m33+t.m34*s.m43,w=t.m31*s.m14+t.m32*s.m24+t.m33*s.m34+t.m34*s.m44,o=t.m41*s.m11+t.m42*s.m21+t.m43*s.m31+t.m44*s.m41,d=t.m41*s.m12+t.m42*s.m22+t.m43*s.m32+t.m44*s.m42,A=t.m41*s.m13+t.m42*s.m23+t.m43*s.m33+t.m44*s.m43,M=t.m41*s.m14+t.m42*s.m24+t.m43*s.m34+t.m44*s.m44;return k([e,n,i,r,a,l,m,h,c,y,u,w,o,d,A,M])};class f{constructor(t){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this.m11=1,this.m12=0,this.m13=0,this.m14=0,this.m21=0,this.m22=1,this.m23=0,this.m24=0,this.m31=0,this.m32=0,this.m33=1,this.m34=0,this.m41=0,this.m42=0,this.m43=0,this.m44=1,t?this.setMatrixValue(t):this}get isIdentity(){return this.m11===1&&this.m12===0&&this.m13===0&&this.m14===0&&this.m21===0&&this.m22===1&&this.m23===0&&this.m24===0&&this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m41===0&&this.m42===0&&this.m43===0&&this.m44===1}get is2D(){return this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m43===0&&this.m44===1}setMatrixValue(t){return typeof t=="string"&&t.length&&t!=="none"?F(t):Array.isArray(t)||t instanceof Float64Array||t instanceof Float32Array?k(t):typeof t=="object"?Y(t):this}toFloat32Array(t){return Float32Array.from(O(this,t))}toFloat64Array(t){return Float64Array.from(O(this,t))}toString(){const{is2D:t}=this,e=this.toFloat64Array(t).join(", ");return`${t?"matrix":"matrix3d"}(${e})`}toJSON(){const{is2D:t,isIdentity:e}=this;return{...this,is2D:t,isIdentity:e}}multiply(t){return b(this,t)}translate(t,e,n){const i=t;let r=e,a=n;return typeof r>"u"&&(r=0),typeof a>"u"&&(a=0),b(this,T(i,r,a))}scale(t,e,n){const i=t;let r=e,a=n;return typeof r>"u"&&(r=t),typeof a>"u"&&(a=1),b(this,D(i,r,a))}rotate(t,e,n){let i=t,r=e||0,a=n||0;return typeof t=="number"&&typeof e>"u"&&typeof n>"u"&&(a=i,i=0,r=0),b(this,I(i,r,a))}rotateAxisAngle(t,e,n,i){if([t,e,n,i].some(r=>Number.isNaN(+r)))throw new TypeError("CSSMatrix: expecting 4 values");return b(this,R(t,e,n,i))}skewX(t){return b(this,E(t))}skewY(t){return b(this,P(t))}skew(t,e){return b(this,X(t,e))}transformPoint(t){const e=this.m11*t.x+this.m21*t.y+this.m31*t.z+this.m41*t.w,n=this.m12*t.x+this.m22*t.y+this.m32*t.z+this.m42*t.w,i=this.m13*t.x+this.m23*t.y+this.m33*t.z+this.m43*t.w,r=this.m14*t.x+this.m24*t.y+this.m34*t.z+this.m44*t.w;return t instanceof DOMPoint?new DOMPoint(e,n,i,r):{x:e,y:n,z:i,w:r}}}return p(f,"Translate",T),p(f,"Rotate",I),p(f,"RotateAxisAngle",R),p(f,"Scale",D),p(f,"SkewX",E),p(f,"SkewY",P),p(f,"Skew",X),p(f,"Multiply",b),p(f,"fromArray",k),p(f,"fromMatrix",Y),p(f,"fromString",F),p(f,"toArray",O),p(f,"isCompatibleArray",N),p(f,"isCompatibleObject",v),f}();
2
3
  //# sourceMappingURL=dommatrix.js.map