modern-idoc 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +43 -38
- package/dist/index.d.cts +14 -11
- package/dist/index.d.mts +14 -11
- package/dist/index.d.ts +14 -11
- package/dist/index.js +2 -2
- package/dist/index.mjs +43 -38
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -13,34 +13,24 @@ function normalizeAudio(audio) {
|
|
|
13
13
|
|
|
14
14
|
class EventEmitter {
|
|
15
15
|
eventListeners = /* @__PURE__ */ new Map();
|
|
16
|
-
|
|
17
|
-
this.eventListeners.clear();
|
|
18
|
-
return this;
|
|
19
|
-
}
|
|
20
|
-
hasEventListener(event) {
|
|
21
|
-
return this.eventListeners.has(event);
|
|
22
|
-
}
|
|
23
|
-
on(type, listener, options) {
|
|
16
|
+
addEventListener(event, listener, options) {
|
|
24
17
|
const object = { value: listener, options };
|
|
25
|
-
const listeners = this.eventListeners.get(
|
|
18
|
+
const listeners = this.eventListeners.get(event);
|
|
26
19
|
if (!listeners) {
|
|
27
|
-
this.eventListeners.set(
|
|
20
|
+
this.eventListeners.set(event, object);
|
|
28
21
|
} else if (Array.isArray(listeners)) {
|
|
29
22
|
listeners.push(object);
|
|
30
23
|
} else {
|
|
31
|
-
this.eventListeners.set(
|
|
24
|
+
this.eventListeners.set(event, [listeners, object]);
|
|
32
25
|
}
|
|
33
26
|
return this;
|
|
34
27
|
}
|
|
35
|
-
|
|
36
|
-
return this.on(type, listener, { once: true });
|
|
37
|
-
}
|
|
38
|
-
off(type, listener, options) {
|
|
28
|
+
removeEventListener(event, listener, options) {
|
|
39
29
|
if (!listener) {
|
|
40
|
-
this.eventListeners.delete(
|
|
30
|
+
this.eventListeners.delete(event);
|
|
41
31
|
return this;
|
|
42
32
|
}
|
|
43
|
-
const listeners = this.eventListeners.get(
|
|
33
|
+
const listeners = this.eventListeners.get(event);
|
|
44
34
|
if (!listeners) {
|
|
45
35
|
return this;
|
|
46
36
|
}
|
|
@@ -53,31 +43,38 @@ class EventEmitter {
|
|
|
53
43
|
}
|
|
54
44
|
}
|
|
55
45
|
if (events.length) {
|
|
56
|
-
this.eventListeners.set(
|
|
46
|
+
this.eventListeners.set(event, events.length === 1 ? events[0] : events);
|
|
57
47
|
} else {
|
|
58
|
-
this.eventListeners.delete(
|
|
48
|
+
this.eventListeners.delete(event);
|
|
59
49
|
}
|
|
60
50
|
} else {
|
|
61
51
|
if (listeners.value === listener && (typeof options === "boolean" || !options?.once || (typeof listeners.options === "boolean" || listeners.options?.once))) {
|
|
62
|
-
this.eventListeners.delete(
|
|
52
|
+
this.eventListeners.delete(event);
|
|
63
53
|
}
|
|
64
54
|
}
|
|
65
55
|
return this;
|
|
66
56
|
}
|
|
67
|
-
|
|
68
|
-
|
|
57
|
+
removeAllListeners() {
|
|
58
|
+
this.eventListeners.clear();
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
hasEventListener(event) {
|
|
62
|
+
return this.eventListeners.has(event);
|
|
63
|
+
}
|
|
64
|
+
dispatchEvent(event, ...args) {
|
|
65
|
+
const listeners = this.eventListeners.get(event);
|
|
69
66
|
if (listeners) {
|
|
70
67
|
if (Array.isArray(listeners)) {
|
|
71
68
|
for (let len = listeners.length, i = 0; i < len; i++) {
|
|
72
69
|
const object = listeners[i];
|
|
73
70
|
if (typeof object.options === "object" && object.options?.once) {
|
|
74
|
-
this.off(
|
|
71
|
+
this.off(event, object.value, object.options);
|
|
75
72
|
}
|
|
76
73
|
object.value.apply(this, args);
|
|
77
74
|
}
|
|
78
75
|
} else {
|
|
79
76
|
if (typeof listeners.options === "object" && listeners.options?.once) {
|
|
80
|
-
this.off(
|
|
77
|
+
this.off(event, listeners.value, listeners.options);
|
|
81
78
|
}
|
|
82
79
|
listeners.value.apply(this, args);
|
|
83
80
|
}
|
|
@@ -86,6 +83,18 @@ class EventEmitter {
|
|
|
86
83
|
return false;
|
|
87
84
|
}
|
|
88
85
|
}
|
|
86
|
+
on(event, listener, options) {
|
|
87
|
+
return this.addEventListener(event, listener, options);
|
|
88
|
+
}
|
|
89
|
+
once(event, listener) {
|
|
90
|
+
return this.addEventListener(event, listener, { once: true });
|
|
91
|
+
}
|
|
92
|
+
off(event, listener, options) {
|
|
93
|
+
return this.removeEventListener(event, listener, options);
|
|
94
|
+
}
|
|
95
|
+
emit(event, ...args) {
|
|
96
|
+
this.dispatchEvent(event, ...args);
|
|
97
|
+
}
|
|
89
98
|
}
|
|
90
99
|
|
|
91
100
|
function isNone(value) {
|
|
@@ -969,16 +978,14 @@ function normalizeBackground(background) {
|
|
|
969
978
|
}
|
|
970
979
|
|
|
971
980
|
const propertiesSymbol = Symbol("properties");
|
|
972
|
-
function getDeclarations(
|
|
973
|
-
const proto = Object.getPrototypeOf(target);
|
|
981
|
+
function getDeclarations(constructor) {
|
|
974
982
|
let declarations;
|
|
975
|
-
if (
|
|
976
|
-
declarations =
|
|
983
|
+
if (Object.hasOwn(constructor, propertiesSymbol)) {
|
|
984
|
+
declarations = constructor[propertiesSymbol];
|
|
977
985
|
} else {
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
}
|
|
986
|
+
const superConstructor = Object.getPrototypeOf(constructor);
|
|
987
|
+
declarations = new Map(superConstructor ? getDeclarations(superConstructor) : void 0);
|
|
988
|
+
constructor[propertiesSymbol] = declarations;
|
|
982
989
|
}
|
|
983
990
|
return declarations;
|
|
984
991
|
}
|
|
@@ -1035,12 +1042,10 @@ function getPropertyDescriptor(key, declaration = {}) {
|
|
|
1035
1042
|
set
|
|
1036
1043
|
};
|
|
1037
1044
|
}
|
|
1038
|
-
function defineProperty(
|
|
1039
|
-
getDeclarations(
|
|
1040
|
-
typeof target === "function" ? target : target.constructor
|
|
1041
|
-
).set(key, declaration);
|
|
1045
|
+
function defineProperty(constructor, key, declaration = {}) {
|
|
1046
|
+
getDeclarations(constructor).set(key, declaration);
|
|
1042
1047
|
const descriptor = getPropertyDescriptor(key, declaration);
|
|
1043
|
-
Object.defineProperty(
|
|
1048
|
+
Object.defineProperty(constructor.prototype, key, {
|
|
1044
1049
|
get() {
|
|
1045
1050
|
return descriptor.get.call(this);
|
|
1046
1051
|
},
|
|
@@ -1058,7 +1063,7 @@ function property(declaration) {
|
|
|
1058
1063
|
if (typeof key !== "string") {
|
|
1059
1064
|
throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");
|
|
1060
1065
|
}
|
|
1061
|
-
defineProperty(target, key, declaration);
|
|
1066
|
+
defineProperty(target.constructor, key, declaration);
|
|
1062
1067
|
};
|
|
1063
1068
|
}
|
|
1064
1069
|
function property2(declaration = {}) {
|
package/dist/index.d.cts
CHANGED
|
@@ -330,12 +330,12 @@ interface ReactiveObjectPropertyAccessorContext {
|
|
|
330
330
|
declaration: PropertyDeclaration;
|
|
331
331
|
internalKey: symbol;
|
|
332
332
|
}
|
|
333
|
-
declare function getDeclarations(
|
|
333
|
+
declare function getDeclarations(constructor: any): Map<string, PropertyDeclaration>;
|
|
334
334
|
declare function getPropertyDescriptor<V, T extends ReactiveObject>(key: string, declaration?: PropertyDeclaration): {
|
|
335
335
|
get: () => any;
|
|
336
336
|
set: (v: any) => void;
|
|
337
337
|
};
|
|
338
|
-
declare function defineProperty<V, T extends ReactiveObject>(
|
|
338
|
+
declare function defineProperty<V, T extends ReactiveObject>(constructor: any, key: string, declaration?: PropertyDeclaration): void;
|
|
339
339
|
declare function property<V, T extends ReactiveObject>(declaration?: PropertyDeclaration): PropertyDecorator;
|
|
340
340
|
declare function property2<V, T extends ReactiveObject>(declaration?: PropertyDeclaration): (_: ClassAccessorDecoratorTarget<T, V>, context: ClassAccessorDecoratorContext) => ClassAccessorDecoratorResult<T, V>;
|
|
341
341
|
|
|
@@ -778,22 +778,25 @@ type IdGenerator = () => string;
|
|
|
778
778
|
declare const nanoid: IdGenerator;
|
|
779
779
|
declare const idGenerator: IdGenerator;
|
|
780
780
|
|
|
781
|
-
type EventListenerValue = (...args:
|
|
781
|
+
type EventListenerValue<T extends any[] = any[]> = (...args: T) => void;
|
|
782
782
|
type EventListenerOptions = boolean | {
|
|
783
783
|
once?: boolean;
|
|
784
784
|
};
|
|
785
|
-
interface EventListener {
|
|
786
|
-
value: EventListenerValue
|
|
785
|
+
interface EventListener<T extends any[] = any[]> {
|
|
786
|
+
value: EventListenerValue<T>;
|
|
787
787
|
options?: EventListenerOptions;
|
|
788
788
|
}
|
|
789
|
-
declare class EventEmitter {
|
|
790
|
-
eventListeners: Map<
|
|
789
|
+
declare class EventEmitter<T extends Record<string, any> = Record<string, any>> {
|
|
790
|
+
eventListeners: Map<keyof T, EventListener<any[]> | EventListener<any[]>[]>;
|
|
791
|
+
addEventListener<K extends keyof T>(event: K, listener: EventListenerValue<T[K]>, options?: EventListenerOptions): this;
|
|
792
|
+
removeEventListener<K extends keyof T>(event: K, listener: EventListenerValue<T[K]>, options?: EventListenerOptions): this;
|
|
791
793
|
removeAllListeners(): this;
|
|
792
794
|
hasEventListener(event: string): boolean;
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
795
|
+
dispatchEvent<K extends keyof T>(event: K, ...args: T[K]): boolean;
|
|
796
|
+
on<K extends keyof T>(event: K, listener: EventListenerValue<T[K]>, options?: EventListenerOptions): this;
|
|
797
|
+
once<K extends keyof T>(event: K, listener: EventListenerValue<T[K]>): this;
|
|
798
|
+
off<K extends keyof T>(event: K, listener: EventListenerValue<T[K]>, options?: EventListenerOptions): this;
|
|
799
|
+
emit<K extends keyof T>(event: K, ...args: T[K]): void;
|
|
797
800
|
}
|
|
798
801
|
|
|
799
802
|
declare function isNone<T>(value: T): value is Extract<T, null | undefined | 'none'>;
|
package/dist/index.d.mts
CHANGED
|
@@ -330,12 +330,12 @@ interface ReactiveObjectPropertyAccessorContext {
|
|
|
330
330
|
declaration: PropertyDeclaration;
|
|
331
331
|
internalKey: symbol;
|
|
332
332
|
}
|
|
333
|
-
declare function getDeclarations(
|
|
333
|
+
declare function getDeclarations(constructor: any): Map<string, PropertyDeclaration>;
|
|
334
334
|
declare function getPropertyDescriptor<V, T extends ReactiveObject>(key: string, declaration?: PropertyDeclaration): {
|
|
335
335
|
get: () => any;
|
|
336
336
|
set: (v: any) => void;
|
|
337
337
|
};
|
|
338
|
-
declare function defineProperty<V, T extends ReactiveObject>(
|
|
338
|
+
declare function defineProperty<V, T extends ReactiveObject>(constructor: any, key: string, declaration?: PropertyDeclaration): void;
|
|
339
339
|
declare function property<V, T extends ReactiveObject>(declaration?: PropertyDeclaration): PropertyDecorator;
|
|
340
340
|
declare function property2<V, T extends ReactiveObject>(declaration?: PropertyDeclaration): (_: ClassAccessorDecoratorTarget<T, V>, context: ClassAccessorDecoratorContext) => ClassAccessorDecoratorResult<T, V>;
|
|
341
341
|
|
|
@@ -778,22 +778,25 @@ type IdGenerator = () => string;
|
|
|
778
778
|
declare const nanoid: IdGenerator;
|
|
779
779
|
declare const idGenerator: IdGenerator;
|
|
780
780
|
|
|
781
|
-
type EventListenerValue = (...args:
|
|
781
|
+
type EventListenerValue<T extends any[] = any[]> = (...args: T) => void;
|
|
782
782
|
type EventListenerOptions = boolean | {
|
|
783
783
|
once?: boolean;
|
|
784
784
|
};
|
|
785
|
-
interface EventListener {
|
|
786
|
-
value: EventListenerValue
|
|
785
|
+
interface EventListener<T extends any[] = any[]> {
|
|
786
|
+
value: EventListenerValue<T>;
|
|
787
787
|
options?: EventListenerOptions;
|
|
788
788
|
}
|
|
789
|
-
declare class EventEmitter {
|
|
790
|
-
eventListeners: Map<
|
|
789
|
+
declare class EventEmitter<T extends Record<string, any> = Record<string, any>> {
|
|
790
|
+
eventListeners: Map<keyof T, EventListener<any[]> | EventListener<any[]>[]>;
|
|
791
|
+
addEventListener<K extends keyof T>(event: K, listener: EventListenerValue<T[K]>, options?: EventListenerOptions): this;
|
|
792
|
+
removeEventListener<K extends keyof T>(event: K, listener: EventListenerValue<T[K]>, options?: EventListenerOptions): this;
|
|
791
793
|
removeAllListeners(): this;
|
|
792
794
|
hasEventListener(event: string): boolean;
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
795
|
+
dispatchEvent<K extends keyof T>(event: K, ...args: T[K]): boolean;
|
|
796
|
+
on<K extends keyof T>(event: K, listener: EventListenerValue<T[K]>, options?: EventListenerOptions): this;
|
|
797
|
+
once<K extends keyof T>(event: K, listener: EventListenerValue<T[K]>): this;
|
|
798
|
+
off<K extends keyof T>(event: K, listener: EventListenerValue<T[K]>, options?: EventListenerOptions): this;
|
|
799
|
+
emit<K extends keyof T>(event: K, ...args: T[K]): void;
|
|
797
800
|
}
|
|
798
801
|
|
|
799
802
|
declare function isNone<T>(value: T): value is Extract<T, null | undefined | 'none'>;
|
package/dist/index.d.ts
CHANGED
|
@@ -330,12 +330,12 @@ interface ReactiveObjectPropertyAccessorContext {
|
|
|
330
330
|
declaration: PropertyDeclaration;
|
|
331
331
|
internalKey: symbol;
|
|
332
332
|
}
|
|
333
|
-
declare function getDeclarations(
|
|
333
|
+
declare function getDeclarations(constructor: any): Map<string, PropertyDeclaration>;
|
|
334
334
|
declare function getPropertyDescriptor<V, T extends ReactiveObject>(key: string, declaration?: PropertyDeclaration): {
|
|
335
335
|
get: () => any;
|
|
336
336
|
set: (v: any) => void;
|
|
337
337
|
};
|
|
338
|
-
declare function defineProperty<V, T extends ReactiveObject>(
|
|
338
|
+
declare function defineProperty<V, T extends ReactiveObject>(constructor: any, key: string, declaration?: PropertyDeclaration): void;
|
|
339
339
|
declare function property<V, T extends ReactiveObject>(declaration?: PropertyDeclaration): PropertyDecorator;
|
|
340
340
|
declare function property2<V, T extends ReactiveObject>(declaration?: PropertyDeclaration): (_: ClassAccessorDecoratorTarget<T, V>, context: ClassAccessorDecoratorContext) => ClassAccessorDecoratorResult<T, V>;
|
|
341
341
|
|
|
@@ -778,22 +778,25 @@ type IdGenerator = () => string;
|
|
|
778
778
|
declare const nanoid: IdGenerator;
|
|
779
779
|
declare const idGenerator: IdGenerator;
|
|
780
780
|
|
|
781
|
-
type EventListenerValue = (...args:
|
|
781
|
+
type EventListenerValue<T extends any[] = any[]> = (...args: T) => void;
|
|
782
782
|
type EventListenerOptions = boolean | {
|
|
783
783
|
once?: boolean;
|
|
784
784
|
};
|
|
785
|
-
interface EventListener {
|
|
786
|
-
value: EventListenerValue
|
|
785
|
+
interface EventListener<T extends any[] = any[]> {
|
|
786
|
+
value: EventListenerValue<T>;
|
|
787
787
|
options?: EventListenerOptions;
|
|
788
788
|
}
|
|
789
|
-
declare class EventEmitter {
|
|
790
|
-
eventListeners: Map<
|
|
789
|
+
declare class EventEmitter<T extends Record<string, any> = Record<string, any>> {
|
|
790
|
+
eventListeners: Map<keyof T, EventListener<any[]> | EventListener<any[]>[]>;
|
|
791
|
+
addEventListener<K extends keyof T>(event: K, listener: EventListenerValue<T[K]>, options?: EventListenerOptions): this;
|
|
792
|
+
removeEventListener<K extends keyof T>(event: K, listener: EventListenerValue<T[K]>, options?: EventListenerOptions): this;
|
|
791
793
|
removeAllListeners(): this;
|
|
792
794
|
hasEventListener(event: string): boolean;
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
795
|
+
dispatchEvent<K extends keyof T>(event: K, ...args: T[K]): boolean;
|
|
796
|
+
on<K extends keyof T>(event: K, listener: EventListenerValue<T[K]>, options?: EventListenerOptions): this;
|
|
797
|
+
once<K extends keyof T>(event: K, listener: EventListenerValue<T[K]>): this;
|
|
798
|
+
off<K extends keyof T>(event: K, listener: EventListenerValue<T[K]>, options?: EventListenerOptions): this;
|
|
799
|
+
emit<K extends keyof T>(event: K, ...args: T[K]): void;
|
|
797
800
|
}
|
|
798
801
|
|
|
799
802
|
declare function isNone<T>(value: T): value is Extract<T, null | undefined | 'none'>;
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(o,D){typeof exports=="object"&&typeof module<"u"?D(exports):typeof define=="function"&&define.amd?define(["exports"],D):(o=typeof globalThis<"u"?globalThis:o||self,D(o.modernIdoc={}))})(this,function(o){"use strict";function D(t){return typeof t=="string"?{src:t}:t}var de={grad:.9,turn:360,rad:360/(2*Math.PI)},F=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},m=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n+0},_=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t>e?t:e},lt=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},st=function(t){return{r:_(t.r,0,255),g:_(t.g,0,255),b:_(t.b,0,255),a:_(t.a)}},X=function(t){return{r:m(t.r),g:m(t.g),b:m(t.b),a:m(t.a,3)}},ge=/^#([0-9a-f]{3,8})$/i,T=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},ct=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,a=Math.max(e,n,r),l=a-Math.min(e,n,r),c=l?a===e?(n-r)/l:a===n?2+(r-e)/l:4+(e-n)/l:0;return{h:60*(c<0?c+6:c),s:a?l/a*100:0,v:a/255*100,a:i}},ft=function(t){var e=t.h,n=t.s,r=t.v,i=t.a;e=e/360*6,n/=100,r/=100;var a=Math.floor(e),l=r*(1-n),c=r*(1-(e-a)*n),d=r*(1-(1-e+a)*n),p=a%6;return{r:255*[r,c,l,l,d,r][p],g:255*[d,r,r,c,l,l][p],b:255*[l,l,d,r,r,c][p],a:i}},dt=function(t){return{h:lt(t.h),s:_(t.s,0,100),l:_(t.l,0,100),a:_(t.a)}},gt=function(t){return{h:m(t.h),s:m(t.s),l:m(t.l),a:m(t.a,3)}},ht=function(t){return ft((n=(e=t).s,{h:e.h,s:(n*=((r=e.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:e.a}));var e,n,r},G=function(t){return{h:(e=ct(t)).h,s:(i=(200-(n=e.s))*(r=e.v)/100)>0&&i<200?n*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:e.a};var e,n,r,i},he=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ve=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,me=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,pe=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,vt={string:[[function(t){var e=ge.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?m(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?m(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=me.exec(t)||pe.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:st({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=he.exec(t)||ve.exec(t);if(!e)return null;var n,r,i=dt({h:(n=e[1],r=e[2],r===void 0&&(r="deg"),Number(n)*(de[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return ht(i)},"hsl"]],object:[[function(t){var e=t.r,n=t.g,r=t.b,i=t.a,a=i===void 0?1:i;return F(e)&&F(n)&&F(r)?st({r:Number(e),g:Number(n),b:Number(r),a:Number(a)}):null},"rgb"],[function(t){var e=t.h,n=t.s,r=t.l,i=t.a,a=i===void 0?1:i;if(!F(e)||!F(n)||!F(r))return null;var l=dt({h:Number(e),s:Number(n),l:Number(r),a:Number(a)});return ht(l)},"hsl"],[function(t){var e=t.h,n=t.s,r=t.v,i=t.a,a=i===void 0?1:i;if(!F(e)||!F(n)||!F(r))return null;var l=function(c){return{h:lt(c.h),s:_(c.s,0,100),v:_(c.v,0,100),a:_(c.a)}}({h:Number(e),s:Number(n),v:Number(r),a:Number(a)});return ft(l)},"hsv"]]},mt=function(t,e){for(var n=0;n<e.length;n++){var r=e[n][0](t);if(r)return[r,e[n][1]]}return[null,void 0]},ye=function(t){return typeof t=="string"?mt(t.trim(),vt.string):typeof t=="object"&&t!==null?mt(t,vt.object):[null,void 0]},Y=function(t,e){var n=G(t);return{h:n.h,s:_(n.s+100*e,0,100),l:n.l,a:n.a}},q=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},pt=function(t,e){var n=G(t);return{h:n.h,s:n.s,l:_(n.l+100*e,0,100),a:n.a}},yt=function(){function t(e){this.parsed=ye(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return m(q(this.rgba),2)},t.prototype.isDark=function(){return q(this.rgba)<.5},t.prototype.isLight=function(){return q(this.rgba)>=.5},t.prototype.toHex=function(){return e=X(this.rgba),n=e.r,r=e.g,i=e.b,l=(a=e.a)<1?T(m(255*a)):"","#"+T(n)+T(r)+T(i)+l;var e,n,r,i,a,l},t.prototype.toRgb=function(){return X(this.rgba)},t.prototype.toRgbString=function(){return e=X(this.rgba),n=e.r,r=e.g,i=e.b,(a=e.a)<1?"rgba("+n+", "+r+", "+i+", "+a+")":"rgb("+n+", "+r+", "+i+")";var e,n,r,i,a},t.prototype.toHsl=function(){return gt(G(this.rgba))},t.prototype.toHslString=function(){return e=gt(G(this.rgba)),n=e.h,r=e.s,i=e.l,(a=e.a)<1?"hsla("+n+", "+r+"%, "+i+"%, "+a+")":"hsl("+n+", "+r+"%, "+i+"%)";var e,n,r,i,a},t.prototype.toHsv=function(){return e=ct(this.rgba),{h:m(e.h),s:m(e.s),v:m(e.v),a:m(e.a,3)};var e},t.prototype.invert=function(){return z({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),z(Y(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),z(Y(this.rgba,-e))},t.prototype.grayscale=function(){return z(Y(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),z(pt(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),z(pt(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?z({r:(n=this.rgba).r,g:n.g,b:n.b,a:e}):m(this.rgba.a,3);var n},t.prototype.hue=function(e){var n=G(this.rgba);return typeof e=="number"?z({h:e,s:n.s,l:n.l,a:n.a}):m(n.h)},t.prototype.isEqual=function(e){return this.toHex()===z(e).toHex()},t}(),z=function(t){return t instanceof yt?t:new yt(t)};class be{eventListeners=new Map;removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(e){return this.eventListeners.has(e)}on(e,n,r){const i={value:n,options:r},a=this.eventListeners.get(e);return a?Array.isArray(a)?a.push(i):this.eventListeners.set(e,[a,i]):this.eventListeners.set(e,i),this}once(e,n){return this.on(e,n,{once:!0})}off(e,n,r){if(!n)return this.eventListeners.delete(e),this;const i=this.eventListeners.get(e);if(!i)return this;if(Array.isArray(i)){const a=[];for(let l=0,c=i.length;l<c;l++){const d=i[l];(d.value!==n||typeof r=="object"&&r?.once&&(typeof d.options=="boolean"||!d.options?.once))&&a.push(d)}a.length?this.eventListeners.set(e,a.length===1?a[0]:a):this.eventListeners.delete(e)}else i.value===n&&(typeof r=="boolean"||!r?.once||typeof i.options=="boolean"||i.options?.once)&&this.eventListeners.delete(e);return this}emit(e,...n){const r=this.eventListeners.get(e);if(r){if(Array.isArray(r))for(let i=r.length,a=0;a<i;a++){const l=r[a];typeof l.options=="object"&&l.options?.once&&this.off(e,l.value,l.options),l.value.apply(this,n)}else typeof r.options=="object"&&r.options?.once&&this.off(e,r.value,r.options),r.value.apply(this,n);return!0}else return!1}}function g(t){return t==null||t==="none"}function E(t,e=0,n=10**e){return Math.round(n*t)/n+0}function N(t,e=!1){if(typeof t!="object"||!t)return t;if(Array.isArray(t))return e?t.map(r=>N(r,e)):t;const n={};for(const r in t){const i=t[r];i!=null&&(e?n[r]=N(i,e):n[r]=i)}return n}function M(t,e){const n={};return e.forEach(r=>{r in t&&(n[r]=t[r])}),n}function bt(t,e,n){const r=e.length-1;if(r<0)return t===void 0?n:t;for(let i=0;i<r;i++){if(t==null)return n;t=t[e[i]]}return t==null||t[e[r]]===void 0?n:t[e[r]]}function St(t,e,n){const r=e.length-1;for(let i=0;i<r;i++)typeof t[e[i]]!="object"&&(t[e[i]]={}),t=t[e[i]];t[e[r]]=n}function Ct(t,e,n){return t==null||!e||typeof e!="string"?n:t[e]!==void 0?t[e]:(e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),bt(t,e.split("."),n))}function wt(t,e,n){if(!(typeof t!="object"||!e))return e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),St(t,e.split("."),n)}class Se{_map=new WeakMap;_toRaw(e){if(e&&typeof e=="object"){const n=e.__v_raw;n&&(e=this._toRaw(n))}return e}delete(e){return this._map.delete(this._toRaw(e))}get(e){return this._map.get(this._toRaw(e))}has(e){return this._map.has(this._toRaw(e))}set(e,n){return this._map.set(this._toRaw(e),this._toRaw(n)),this}}function Z(t){let e;return typeof t=="number"?e={r:t>>24&255,g:t>>16&255,b:t>>8&255,a:(t&255)/255}:e=t,z(e)}function Ce(t){return{r:E(t.r),g:E(t.g),b:E(t.b),a:E(t.a,3)}}function $(t){const e=t.toString(16);return e.length<2?`0${e}`:e}const A="#000000FF";function _t(t){return Z(t).isValid()}function b(t,e=!1){const n=Z(t);if(!n.isValid()){if(typeof t=="string")return t;const c=`Failed to normalizeColor ${t}`;if(e)throw new Error(c);return console.warn(c),A}const{r,g:i,b:a,a:l}=Ce(n.rgba);return`#${$(r)}${$(i)}${$(a)}${$(E(l*255))}`}var j=j||{};j.parse=function(){const t={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i};let e="";function n(u){const s=new Error(`${e}: ${u}`);throw s.source=e,s}function r(){const u=i();return e.length>0&&n("Invalid input not EOF"),u}function i(){return K(a)}function a(){return l("linear-gradient",t.linearGradient,d)||l("repeating-linear-gradient",t.repeatingLinearGradient,d)||l("radial-gradient",t.radialGradient,w)||l("repeating-radial-gradient",t.repeatingRadialGradient,w)}function l(u,s,f){return c(s,y=>{const R=f();return R&&(v(t.comma)||n("Missing comma before color stops")),{type:u,orientation:R,colorStops:K(Pe)}})}function c(u,s){const f=v(u);if(f){v(t.startCall)||n("Missing (");const y=s(f);return v(t.endCall)||n("Missing )"),y}}function d(){const u=p();if(u)return u;const s=C("position-keyword",t.positionKeywords,1);return s?{type:"directional",value:s.value}:S()}function p(){return C("directional",t.sideOrCorner,1)}function S(){return C("angular",t.angleValue,1)||C("angular",t.radianValue,1)}function w(){let u,s=h(),f;return s&&(u=[],u.push(s),f=e,v(t.comma)&&(s=h(),s?u.push(s):e=f)),u}function h(){let u=O()||Ie();if(u)u.at=ot();else{const s=it();if(s){u=s;const f=ot();f&&(u.at=f)}else{const f=ot();if(f)u={type:"default-radial",at:f};else{const y=at();y&&(u={type:"default-radial",at:y})}}}return u}function O(){const u=C("shape",/^(circle)/i,0);return u&&(u.style=fe()||it()),u}function Ie(){const u=C("shape",/^(ellipse)/i,0);return u&&(u.style=at()||U()||it()),u}function it(){return C("extent-keyword",t.extentKeywords,1)}function ot(){if(C("position",/^at/,0)){const u=at();return u||n("Missing positioning value"),u}}function at(){const u=Ve();if(u.x||u.y)return{type:"position",value:u}}function Ve(){return{x:U(),y:U()}}function K(u){let s=u();const f=[];if(s)for(f.push(s);v(t.comma);)s=u(),s?f.push(s):n("One extra comma");return f}function Pe(){const u=Te();return u||n("Expected color definition"),u.length=U(),u}function Te(){return $e()||xe()||Be()||He()||je()||We()||Me()}function Me(){return C("literal",t.literalColor,0)}function $e(){return C("hex",t.hexColor,1)}function je(){return c(t.rgbColor,()=>({type:"rgb",value:K(P)}))}function He(){return c(t.rgbaColor,()=>({type:"rgba",value:K(P)}))}function We(){return c(t.varColor,()=>({type:"var",value:Ke()}))}function Be(){return c(t.hslColor,()=>{v(t.percentageValue)&&n("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const s=P();v(t.comma);let f=v(t.percentageValue);const y=f?f[1]:null;v(t.comma),f=v(t.percentageValue);const R=f?f[1]:null;return(!y||!R)&&n("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[s,y,R]}})}function xe(){return c(t.hslaColor,()=>{const u=P();v(t.comma);let s=v(t.percentageValue);const f=s?s[1]:null;v(t.comma),s=v(t.percentageValue);const y=s?s[1]:null;v(t.comma);const R=P();return(!f||!y)&&n("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[u,f,y,R]}})}function Ke(){return v(t.variableName)[1]}function P(){return v(t.number)[1]}function U(){return C("%",t.percentageValue,1)||Ue()||Xe()||fe()}function Ue(){return C("position-keyword",t.positionKeywords,1)}function Xe(){return c(t.calcValue,()=>{let u=1,s=0;for(;u>0&&s<e.length;){const y=e.charAt(s);y==="("?u++:y===")"&&u--,s++}u>0&&n("Missing closing parenthesis in calc() expression");const f=e.substring(0,s-1);return ut(s-1),{type:"calc",value:f}})}function fe(){return C("px",t.pixelValue,1)||C("em",t.emValue,1)}function C(u,s,f){const y=v(s);if(y)return{type:u,value:y[f]}}function v(u){let s,f;return f=/^\s+/.exec(e),f&&ut(f[0].length),s=u.exec(e),s&&ut(s[0].length),s}function ut(u){e=e.substr(u)}return function(u){return e=u.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),r()}}();const zt=j.parse.bind(j);var H=H||{};H.stringify=function(){var t={"visit_linear-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-linear-gradient":function(e){return t.visit_gradient(e)},"visit_radial-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-radial-gradient":function(e){return t.visit_gradient(e)},visit_gradient:function(e){var n=t.visit(e.orientation);return n&&(n+=", "),e.type+"("+n+t.visit(e.colorStops)+")"},visit_shape:function(e){var n=e.value,r=t.visit(e.at),i=t.visit(e.style);return i&&(n+=" "+i),r&&(n+=" at "+r),n},"visit_default-radial":function(e){var n="",r=t.visit(e.at);return r&&(n+=r),n},"visit_extent-keyword":function(e){var n=e.value,r=t.visit(e.at);return r&&(n+=" at "+r),n},"visit_position-keyword":function(e){return e.value},visit_position:function(e){return t.visit(e.value.x)+" "+t.visit(e.value.y)},"visit_%":function(e){return e.value+"%"},visit_em:function(e){return e.value+"em"},visit_px:function(e){return e.value+"px"},visit_calc:function(e){return"calc("+e.value+")"},visit_literal:function(e){return t.visit_color(e.value,e)},visit_hex:function(e){return t.visit_color("#"+e.value,e)},visit_rgb:function(e){return t.visit_color("rgb("+e.value.join(", ")+")",e)},visit_rgba:function(e){return t.visit_color("rgba("+e.value.join(", ")+")",e)},visit_hsl:function(e){return t.visit_color("hsl("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%)",e)},visit_hsla:function(e){return t.visit_color("hsla("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%, "+e.value[3]+")",e)},visit_var:function(e){return t.visit_color("var("+e.value+")",e)},visit_color:function(e,n){var r=e,i=t.visit(n.length);return i&&(r+=" "+i),r},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var n="",r=e.length;return e.forEach(function(i,a){n+=t.visit(i),a<r-1&&(n+=", ")}),n},visit_object:function(e){return e.width&&e.height?t.visit(e.width)+" "+t.visit(e.height):""},visit:function(e){if(!e)return"";if(e instanceof Array)return t.visit_array(e);if(typeof e=="object"&&!e.type)return t.visit_object(e);if(e.type){var n=t["visit_"+e.type];if(n)return n(e);throw Error("Missing visitor visit_"+e.type)}else throw Error("Invalid node.")}};return function(e){return t.visit(e)}}();const we=H.stringify.bind(H);function Ft(t){const e=t.length-1;return t.map((n,r)=>{const i=n.value;let a=E(r/e,3),l="#00000000";switch(n.type){case"rgb":l=b({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0)});break;case"rgba":l=b({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0),a:Number(i[3]??0)});break;case"literal":l=b(n.value);break;case"hex":l=b(`#${n.value}`);break}switch(n.length?.type){case"%":a=Number(n.length.value)/100;break}return{offset:a,color:l}})}function Lt(t){let e=0;switch(t.orientation?.type){case"angular":e=Number(t.orientation.value);break}return{type:"linear-gradient",angle:e,stops:Ft(t.colorStops)}}function Et(t){return t.orientation?.map(e=>{switch(e?.type){case"shape":case"default-radial":case"extent-keyword":default:return null}}),{type:"radial-gradient",stops:Ft(t.colorStops)}}function I(t){return t.startsWith("linear-gradient(")||t.startsWith("radial-gradient(")}function Nt(t){return zt(t).map(e=>{switch(e?.type){case"linear-gradient":return Lt(e);case"repeating-linear-gradient":return{...Lt(e),repeat:!0};case"radial-gradient":return Et(e);case"repeating-radial-gradient":return{...Et(e),repeat:!0};default:return}}).filter(Boolean)}function Ot(t){let e;return typeof t=="string"?e={color:t}:e=t,{color:b(e.color)}}function Rt(t){let e;if(typeof t=="string"?e={image:t}:e=t,e.image){const{type:n,...r}=Nt(e.image)[0]??{};switch(n){case"radial-gradient":return{radialGradient:r};case"linear-gradient":return{linearGradient:r}}}return e}function Dt(t){let e;return typeof t=="string"?e={image:t}:e=t,e}function kt(t){let e;return typeof t=="string"?e={preset:t}:e=t,{preset:e.preset,foregroundColor:g(e.foregroundColor)?void 0:b(e.foregroundColor),backgroundColor:g(e.backgroundColor)?void 0:b(e.backgroundColor)}}function Gt(t){return!g(t.color)}function At(t){return typeof t=="string"?_t(t):Gt(t)}function It(t){return!g(t.image)&&I(t.image)||!!t.linearGradient||!!t.radialGradient}function Vt(t){return typeof t=="string"?I(t):It(t)}function Pt(t){return!g(t.image)&&!I(t.image)}function Tt(t){return typeof t=="string"?!I(t):Pt(t)}function Mt(t){return!g(t.preset)}function $t(t){return typeof t=="string"?!1:Mt(t)}function L(t){return At(t)?Ot(t):Vt(t)?Rt(t):Tt(t)?Dt(t):$t(t)?kt(t):{}}function jt(t){return typeof t=="string"?{...L(t)}:{...L(t),...M(t,["fillWithShape"])}}const J=Symbol("properties");function W(t){const e=Object.getPrototypeOf(t);let n;return e&&Object.hasOwn(e,J)?n=e[J]:(n=new Map(e?W(e):void 0),e&&(e[J]=n)),n}function Q(t,e={}){const n=Symbol.for(t),{default:r,fallback:i,alias:a}=e,l={declaration:e,internalKey:n},c=()=>typeof r=="function"?r():r,d=()=>typeof i=="function"?i():i;let p=!0;function S(){let h;if(a&&a!==t?h=Ct(this,a):typeof this.getter<"u"?h=this.getter(t,l):h=this[n],h=h??d(),h===void 0&&p){p=!1;const O=c();O!==void 0&&(w.call(this,O),h=O)}return h}function w(h){a&&a!==t?wt(this,a,h):typeof this.setter<"u"?this.setter(t,h,l):this[n]=h}return{get:S,set:w}}function Ht(t,e,n={}){W(typeof t=="function"?t:t.constructor).set(e,n);const r=Q(e,n);Object.defineProperty(t,e,{get(){return r.get.call(this)},set(i){const a=r.get.call(this);r.set.call(this,i),this.onUpdateProperty?.(e,i,a,n)},configurable:!0,enumerable:!0})}function _e(t){return function(e,n){if(typeof n!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");Ht(e,n,t)}}function ze(t={}){return function(e,n){const r=n.name;if(typeof r!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");const i=Q(r,t);return{init(a){return W(this.constructor).set(r,t),i.set.call(this,a),a},get(){return i.get.call(this)},set(a){const l=i.get?.call(this);i.set.call(this,a),this.onUpdateProperty?.(r,a,l,t)}}}}function tt(){return{color:A,offsetX:0,offsetY:0,blurRadius:1}}function et(t){return{...tt(),...N({...t,color:g(t.color)?A:b(t.color)})}}function Wt(){return{...tt(),scaleX:1,scaleY:1}}function Bt(t){return{...Wt(),...et(t)}}function Fe(t){return t}function xt(t){return N({...t,softEdge:g(t.softEdge)?void 0:t.softEdge,outerShadow:g(t.outerShadow)?void 0:Bt(t.outerShadow),innerShadow:g(t.innerShadow)?void 0:et(t.innerShadow)})}function Kt(t){return typeof t=="string"?{...L(t)}:{...L(t),...M(t,["fillWithShape"])}}const Le="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Ee=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=Le[n[t]&63];return e};const Ut=()=>Ee(10),Xt=Ut;function Yt(t){return typeof t=="string"?{...L(t)}:{...L(t),...M(t,["width","style","headEnd","tailEnd"])}}function qt(t){return typeof t=="string"?{color:b(t)}:{...t,color:g(t.color)?A:b(t.color)}}function Zt(){return{boxShadow:"none"}}function Jt(t){return typeof t=="string"?t.startsWith("<svg")?{svg:t}:{paths:[{data:t}]}:Array.isArray(t)?{paths:t.map(e=>typeof e=="string"?{data:e}:e)}:t}function Qt(){return{overflow:"visible",direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function te(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function ee(){return{...Qt(),...te(),...Zt(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"rgb(0, 0, 0)",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function ne(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function re(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function ie(){return{...ne(),color:"rgb(0, 0, 0)",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function oe(){return{...re(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function ae(){return{...oe(),...ie(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function k(t){return N({...t,color:g(t.color)?void 0:b(t.color),backgroundColor:g(t.backgroundColor)?void 0:b(t.backgroundColor),borderColor:g(t.borderColor)?void 0:b(t.borderColor),outlineColor:g(t.outlineColor)?void 0:b(t.outlineColor),shadowColor:g(t.shadowColor)?void 0:b(t.shadowColor)})}function Ne(){return{...ee(),...ae()}}const nt=/\r\n|\n\r|\n|\r/,Oe=new RegExp(`${nt.source}|<br\\/>`,"g"),Re=new RegExp(`^(${nt.source})$`),B=`
|
|
2
|
-
`;function De(t){return nt.test(t)}function rt(t){return Re.test(t)}function ue(t){return t.replace(Oe,B)}function le(t,e){const n=Array.from(new Set([...Object.keys(t),...Object.keys(e)]));return!n.length||n.every(r=>t[r]===e[r])}function V(t){const e=[];function n(){return e[e.length-1]}function r(c={}){let d=e[e.length-1];return d?.fragments.length===0?(d={...c,fragments:[]},e[e.length-1]=d):(d={...c,fragments:[]},e.push(d)),d}function i(c="",d={}){Array.from(c).forEach(
|
|
1
|
+
(function(o,D){typeof exports=="object"&&typeof module<"u"?D(exports):typeof define=="function"&&define.amd?define(["exports"],D):(o=typeof globalThis<"u"?globalThis:o||self,D(o.modernIdoc={}))})(this,function(o){"use strict";function D(t){return typeof t=="string"?{src:t}:t}var de={grad:.9,turn:360,rad:360/(2*Math.PI)},L=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},p=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n+0},_=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t>e?t:e},lt=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},st=function(t){return{r:_(t.r,0,255),g:_(t.g,0,255),b:_(t.b,0,255),a:_(t.a)}},X=function(t){return{r:p(t.r),g:p(t.g),b:p(t.b),a:p(t.a,3)}},ge=/^#([0-9a-f]{3,8})$/i,T=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},ct=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,a=Math.max(e,n,r),l=a-Math.min(e,n,r),c=l?a===e?(n-r)/l:a===n?2+(r-e)/l:4+(e-n)/l:0;return{h:60*(c<0?c+6:c),s:a?l/a*100:0,v:a/255*100,a:i}},ft=function(t){var e=t.h,n=t.s,r=t.v,i=t.a;e=e/360*6,n/=100,r/=100;var a=Math.floor(e),l=r*(1-n),c=r*(1-(e-a)*n),d=r*(1-(1-e+a)*n),m=a%6;return{r:255*[r,c,l,l,d,r][m],g:255*[d,r,r,c,l,l][m],b:255*[l,l,d,r,r,c][m],a:i}},dt=function(t){return{h:lt(t.h),s:_(t.s,0,100),l:_(t.l,0,100),a:_(t.a)}},gt=function(t){return{h:p(t.h),s:p(t.s),l:p(t.l),a:p(t.a,3)}},ht=function(t){return ft((n=(e=t).s,{h:e.h,s:(n*=((r=e.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:e.a}));var e,n,r},G=function(t){return{h:(e=ct(t)).h,s:(i=(200-(n=e.s))*(r=e.v)/100)>0&&i<200?n*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:e.a};var e,n,r,i},he=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ve=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,pe=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,me=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,vt={string:[[function(t){var e=ge.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?p(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?p(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=pe.exec(t)||me.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:st({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=he.exec(t)||ve.exec(t);if(!e)return null;var n,r,i=dt({h:(n=e[1],r=e[2],r===void 0&&(r="deg"),Number(n)*(de[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return ht(i)},"hsl"]],object:[[function(t){var e=t.r,n=t.g,r=t.b,i=t.a,a=i===void 0?1:i;return L(e)&&L(n)&&L(r)?st({r:Number(e),g:Number(n),b:Number(r),a:Number(a)}):null},"rgb"],[function(t){var e=t.h,n=t.s,r=t.l,i=t.a,a=i===void 0?1:i;if(!L(e)||!L(n)||!L(r))return null;var l=dt({h:Number(e),s:Number(n),l:Number(r),a:Number(a)});return ht(l)},"hsl"],[function(t){var e=t.h,n=t.s,r=t.v,i=t.a,a=i===void 0?1:i;if(!L(e)||!L(n)||!L(r))return null;var l=function(c){return{h:lt(c.h),s:_(c.s,0,100),v:_(c.v,0,100),a:_(c.a)}}({h:Number(e),s:Number(n),v:Number(r),a:Number(a)});return ft(l)},"hsv"]]},pt=function(t,e){for(var n=0;n<e.length;n++){var r=e[n][0](t);if(r)return[r,e[n][1]]}return[null,void 0]},ye=function(t){return typeof t=="string"?pt(t.trim(),vt.string):typeof t=="object"&&t!==null?pt(t,vt.object):[null,void 0]},Y=function(t,e){var n=G(t);return{h:n.h,s:_(n.s+100*e,0,100),l:n.l,a:n.a}},q=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},mt=function(t,e){var n=G(t);return{h:n.h,s:n.s,l:_(n.l+100*e,0,100),a:n.a}},yt=function(){function t(e){this.parsed=ye(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return p(q(this.rgba),2)},t.prototype.isDark=function(){return q(this.rgba)<.5},t.prototype.isLight=function(){return q(this.rgba)>=.5},t.prototype.toHex=function(){return e=X(this.rgba),n=e.r,r=e.g,i=e.b,l=(a=e.a)<1?T(p(255*a)):"","#"+T(n)+T(r)+T(i)+l;var e,n,r,i,a,l},t.prototype.toRgb=function(){return X(this.rgba)},t.prototype.toRgbString=function(){return e=X(this.rgba),n=e.r,r=e.g,i=e.b,(a=e.a)<1?"rgba("+n+", "+r+", "+i+", "+a+")":"rgb("+n+", "+r+", "+i+")";var e,n,r,i,a},t.prototype.toHsl=function(){return gt(G(this.rgba))},t.prototype.toHslString=function(){return e=gt(G(this.rgba)),n=e.h,r=e.s,i=e.l,(a=e.a)<1?"hsla("+n+", "+r+"%, "+i+"%, "+a+")":"hsl("+n+", "+r+"%, "+i+"%)";var e,n,r,i,a},t.prototype.toHsv=function(){return e=ct(this.rgba),{h:p(e.h),s:p(e.s),v:p(e.v),a:p(e.a,3)};var e},t.prototype.invert=function(){return z({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),z(Y(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),z(Y(this.rgba,-e))},t.prototype.grayscale=function(){return z(Y(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),z(mt(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),z(mt(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?z({r:(n=this.rgba).r,g:n.g,b:n.b,a:e}):p(this.rgba.a,3);var n},t.prototype.hue=function(e){var n=G(this.rgba);return typeof e=="number"?z({h:e,s:n.s,l:n.l,a:n.a}):p(n.h)},t.prototype.isEqual=function(e){return this.toHex()===z(e).toHex()},t}(),z=function(t){return t instanceof yt?t:new yt(t)};class be{eventListeners=new Map;addEventListener(e,n,r){const i={value:n,options:r},a=this.eventListeners.get(e);return a?Array.isArray(a)?a.push(i):this.eventListeners.set(e,[a,i]):this.eventListeners.set(e,i),this}removeEventListener(e,n,r){if(!n)return this.eventListeners.delete(e),this;const i=this.eventListeners.get(e);if(!i)return this;if(Array.isArray(i)){const a=[];for(let l=0,c=i.length;l<c;l++){const d=i[l];(d.value!==n||typeof r=="object"&&r?.once&&(typeof d.options=="boolean"||!d.options?.once))&&a.push(d)}a.length?this.eventListeners.set(e,a.length===1?a[0]:a):this.eventListeners.delete(e)}else i.value===n&&(typeof r=="boolean"||!r?.once||typeof i.options=="boolean"||i.options?.once)&&this.eventListeners.delete(e);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(e){return this.eventListeners.has(e)}dispatchEvent(e,...n){const r=this.eventListeners.get(e);if(r){if(Array.isArray(r))for(let i=r.length,a=0;a<i;a++){const l=r[a];typeof l.options=="object"&&l.options?.once&&this.off(e,l.value,l.options),l.value.apply(this,n)}else typeof r.options=="object"&&r.options?.once&&this.off(e,r.value,r.options),r.value.apply(this,n);return!0}else return!1}on(e,n,r){return this.addEventListener(e,n,r)}once(e,n){return this.addEventListener(e,n,{once:!0})}off(e,n,r){return this.removeEventListener(e,n,r)}emit(e,...n){this.dispatchEvent(e,...n)}}function g(t){return t==null||t==="none"}function F(t,e=0,n=10**e){return Math.round(n*t)/n+0}function N(t,e=!1){if(typeof t!="object"||!t)return t;if(Array.isArray(t))return e?t.map(r=>N(r,e)):t;const n={};for(const r in t){const i=t[r];i!=null&&(e?n[r]=N(i,e):n[r]=i)}return n}function M(t,e){const n={};return e.forEach(r=>{r in t&&(n[r]=t[r])}),n}function bt(t,e,n){const r=e.length-1;if(r<0)return t===void 0?n:t;for(let i=0;i<r;i++){if(t==null)return n;t=t[e[i]]}return t==null||t[e[r]]===void 0?n:t[e[r]]}function St(t,e,n){const r=e.length-1;for(let i=0;i<r;i++)typeof t[e[i]]!="object"&&(t[e[i]]={}),t=t[e[i]];t[e[r]]=n}function Ct(t,e,n){return t==null||!e||typeof e!="string"?n:t[e]!==void 0?t[e]:(e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),bt(t,e.split("."),n))}function wt(t,e,n){if(!(typeof t!="object"||!e))return e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),St(t,e.split("."),n)}class Se{_map=new WeakMap;_toRaw(e){if(e&&typeof e=="object"){const n=e.__v_raw;n&&(e=this._toRaw(n))}return e}delete(e){return this._map.delete(this._toRaw(e))}get(e){return this._map.get(this._toRaw(e))}has(e){return this._map.has(this._toRaw(e))}set(e,n){return this._map.set(this._toRaw(e),this._toRaw(n)),this}}function Z(t){let e;return typeof t=="number"?e={r:t>>24&255,g:t>>16&255,b:t>>8&255,a:(t&255)/255}:e=t,z(e)}function Ce(t){return{r:F(t.r),g:F(t.g),b:F(t.b),a:F(t.a,3)}}function $(t){const e=t.toString(16);return e.length<2?`0${e}`:e}const A="#000000FF";function _t(t){return Z(t).isValid()}function b(t,e=!1){const n=Z(t);if(!n.isValid()){if(typeof t=="string")return t;const c=`Failed to normalizeColor ${t}`;if(e)throw new Error(c);return console.warn(c),A}const{r,g:i,b:a,a:l}=Ce(n.rgba);return`#${$(r)}${$(i)}${$(a)}${$(F(l*255))}`}var j=j||{};j.parse=function(){const t={linearGradient:/^(-(webkit|o|ms|moz)-)?(linear-gradient)/i,repeatingLinearGradient:/^(-(webkit|o|ms|moz)-)?(repeating-linear-gradient)/i,radialGradient:/^(-(webkit|o|ms|moz)-)?(radial-gradient)/i,repeatingRadialGradient:/^(-(webkit|o|ms|moz)-)?(repeating-radial-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?((\d*\.\d+)|(\d+\.?)))px/,percentageValue:/^(-?((\d*\.\d+)|(\d+\.?)))%/,emValue:/^(-?((\d*\.\d+)|(\d+\.?)))em/,angleValue:/^(-?((\d*\.\d+)|(\d+\.?)))deg/,radianValue:/^(-?((\d*\.\d+)|(\d+\.?)))rad/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^#([0-9a-f]+)/i,literalColor:/^([a-z]+)/i,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,varColor:/^var/i,calcValue:/^calc/i,variableName:/^(--[a-z0-9-,\s#]+)/i,number:/^((\d*\.\d+)|(\d+\.?))/,hslColor:/^hsl/i,hslaColor:/^hsla/i};let e="";function n(u){const s=new Error(`${e}: ${u}`);throw s.source=e,s}function r(){const u=i();return e.length>0&&n("Invalid input not EOF"),u}function i(){return K(a)}function a(){return l("linear-gradient",t.linearGradient,d)||l("repeating-linear-gradient",t.repeatingLinearGradient,d)||l("radial-gradient",t.radialGradient,w)||l("repeating-radial-gradient",t.repeatingRadialGradient,w)}function l(u,s,f){return c(s,y=>{const R=f();return R&&(v(t.comma)||n("Missing comma before color stops")),{type:u,orientation:R,colorStops:K(Pe)}})}function c(u,s){const f=v(u);if(f){v(t.startCall)||n("Missing (");const y=s(f);return v(t.endCall)||n("Missing )"),y}}function d(){const u=m();if(u)return u;const s=C("position-keyword",t.positionKeywords,1);return s?{type:"directional",value:s.value}:S()}function m(){return C("directional",t.sideOrCorner,1)}function S(){return C("angular",t.angleValue,1)||C("angular",t.radianValue,1)}function w(){let u,s=h(),f;return s&&(u=[],u.push(s),f=e,v(t.comma)&&(s=h(),s?u.push(s):e=f)),u}function h(){let u=O()||Ie();if(u)u.at=ot();else{const s=it();if(s){u=s;const f=ot();f&&(u.at=f)}else{const f=ot();if(f)u={type:"default-radial",at:f};else{const y=at();y&&(u={type:"default-radial",at:y})}}}return u}function O(){const u=C("shape",/^(circle)/i,0);return u&&(u.style=fe()||it()),u}function Ie(){const u=C("shape",/^(ellipse)/i,0);return u&&(u.style=at()||U()||it()),u}function it(){return C("extent-keyword",t.extentKeywords,1)}function ot(){if(C("position",/^at/,0)){const u=at();return u||n("Missing positioning value"),u}}function at(){const u=Ve();if(u.x||u.y)return{type:"position",value:u}}function Ve(){return{x:U(),y:U()}}function K(u){let s=u();const f=[];if(s)for(f.push(s);v(t.comma);)s=u(),s?f.push(s):n("One extra comma");return f}function Pe(){const u=Te();return u||n("Expected color definition"),u.length=U(),u}function Te(){return $e()||xe()||Be()||He()||je()||We()||Me()}function Me(){return C("literal",t.literalColor,0)}function $e(){return C("hex",t.hexColor,1)}function je(){return c(t.rgbColor,()=>({type:"rgb",value:K(P)}))}function He(){return c(t.rgbaColor,()=>({type:"rgba",value:K(P)}))}function We(){return c(t.varColor,()=>({type:"var",value:Ke()}))}function Be(){return c(t.hslColor,()=>{v(t.percentageValue)&&n("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const s=P();v(t.comma);let f=v(t.percentageValue);const y=f?f[1]:null;v(t.comma),f=v(t.percentageValue);const R=f?f[1]:null;return(!y||!R)&&n("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[s,y,R]}})}function xe(){return c(t.hslaColor,()=>{const u=P();v(t.comma);let s=v(t.percentageValue);const f=s?s[1]:null;v(t.comma),s=v(t.percentageValue);const y=s?s[1]:null;v(t.comma);const R=P();return(!f||!y)&&n("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[u,f,y,R]}})}function Ke(){return v(t.variableName)[1]}function P(){return v(t.number)[1]}function U(){return C("%",t.percentageValue,1)||Ue()||Xe()||fe()}function Ue(){return C("position-keyword",t.positionKeywords,1)}function Xe(){return c(t.calcValue,()=>{let u=1,s=0;for(;u>0&&s<e.length;){const y=e.charAt(s);y==="("?u++:y===")"&&u--,s++}u>0&&n("Missing closing parenthesis in calc() expression");const f=e.substring(0,s-1);return ut(s-1),{type:"calc",value:f}})}function fe(){return C("px",t.pixelValue,1)||C("em",t.emValue,1)}function C(u,s,f){const y=v(s);if(y)return{type:u,value:y[f]}}function v(u){let s,f;return f=/^\s+/.exec(e),f&&ut(f[0].length),s=u.exec(e),s&&ut(s[0].length),s}function ut(u){e=e.substr(u)}return function(u){return e=u.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),r()}}();const zt=j.parse.bind(j);var H=H||{};H.stringify=function(){var t={"visit_linear-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-linear-gradient":function(e){return t.visit_gradient(e)},"visit_radial-gradient":function(e){return t.visit_gradient(e)},"visit_repeating-radial-gradient":function(e){return t.visit_gradient(e)},visit_gradient:function(e){var n=t.visit(e.orientation);return n&&(n+=", "),e.type+"("+n+t.visit(e.colorStops)+")"},visit_shape:function(e){var n=e.value,r=t.visit(e.at),i=t.visit(e.style);return i&&(n+=" "+i),r&&(n+=" at "+r),n},"visit_default-radial":function(e){var n="",r=t.visit(e.at);return r&&(n+=r),n},"visit_extent-keyword":function(e){var n=e.value,r=t.visit(e.at);return r&&(n+=" at "+r),n},"visit_position-keyword":function(e){return e.value},visit_position:function(e){return t.visit(e.value.x)+" "+t.visit(e.value.y)},"visit_%":function(e){return e.value+"%"},visit_em:function(e){return e.value+"em"},visit_px:function(e){return e.value+"px"},visit_calc:function(e){return"calc("+e.value+")"},visit_literal:function(e){return t.visit_color(e.value,e)},visit_hex:function(e){return t.visit_color("#"+e.value,e)},visit_rgb:function(e){return t.visit_color("rgb("+e.value.join(", ")+")",e)},visit_rgba:function(e){return t.visit_color("rgba("+e.value.join(", ")+")",e)},visit_hsl:function(e){return t.visit_color("hsl("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%)",e)},visit_hsla:function(e){return t.visit_color("hsla("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%, "+e.value[3]+")",e)},visit_var:function(e){return t.visit_color("var("+e.value+")",e)},visit_color:function(e,n){var r=e,i=t.visit(n.length);return i&&(r+=" "+i),r},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var n="",r=e.length;return e.forEach(function(i,a){n+=t.visit(i),a<r-1&&(n+=", ")}),n},visit_object:function(e){return e.width&&e.height?t.visit(e.width)+" "+t.visit(e.height):""},visit:function(e){if(!e)return"";if(e instanceof Array)return t.visit_array(e);if(typeof e=="object"&&!e.type)return t.visit_object(e);if(e.type){var n=t["visit_"+e.type];if(n)return n(e);throw Error("Missing visitor visit_"+e.type)}else throw Error("Invalid node.")}};return function(e){return t.visit(e)}}();const we=H.stringify.bind(H);function Lt(t){const e=t.length-1;return t.map((n,r)=>{const i=n.value;let a=F(r/e,3),l="#00000000";switch(n.type){case"rgb":l=b({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0)});break;case"rgba":l=b({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0),a:Number(i[3]??0)});break;case"literal":l=b(n.value);break;case"hex":l=b(`#${n.value}`);break}switch(n.length?.type){case"%":a=Number(n.length.value)/100;break}return{offset:a,color:l}})}function Et(t){let e=0;switch(t.orientation?.type){case"angular":e=Number(t.orientation.value);break}return{type:"linear-gradient",angle:e,stops:Lt(t.colorStops)}}function Ft(t){return t.orientation?.map(e=>{switch(e?.type){case"shape":case"default-radial":case"extent-keyword":default:return null}}),{type:"radial-gradient",stops:Lt(t.colorStops)}}function I(t){return t.startsWith("linear-gradient(")||t.startsWith("radial-gradient(")}function Nt(t){return zt(t).map(e=>{switch(e?.type){case"linear-gradient":return Et(e);case"repeating-linear-gradient":return{...Et(e),repeat:!0};case"radial-gradient":return Ft(e);case"repeating-radial-gradient":return{...Ft(e),repeat:!0};default:return}}).filter(Boolean)}function Ot(t){let e;return typeof t=="string"?e={color:t}:e=t,{color:b(e.color)}}function Rt(t){let e;if(typeof t=="string"?e={image:t}:e=t,e.image){const{type:n,...r}=Nt(e.image)[0]??{};switch(n){case"radial-gradient":return{radialGradient:r};case"linear-gradient":return{linearGradient:r}}}return e}function Dt(t){let e;return typeof t=="string"?e={image:t}:e=t,e}function kt(t){let e;return typeof t=="string"?e={preset:t}:e=t,{preset:e.preset,foregroundColor:g(e.foregroundColor)?void 0:b(e.foregroundColor),backgroundColor:g(e.backgroundColor)?void 0:b(e.backgroundColor)}}function Gt(t){return!g(t.color)}function At(t){return typeof t=="string"?_t(t):Gt(t)}function It(t){return!g(t.image)&&I(t.image)||!!t.linearGradient||!!t.radialGradient}function Vt(t){return typeof t=="string"?I(t):It(t)}function Pt(t){return!g(t.image)&&!I(t.image)}function Tt(t){return typeof t=="string"?!I(t):Pt(t)}function Mt(t){return!g(t.preset)}function $t(t){return typeof t=="string"?!1:Mt(t)}function E(t){return At(t)?Ot(t):Vt(t)?Rt(t):Tt(t)?Dt(t):$t(t)?kt(t):{}}function jt(t){return typeof t=="string"?{...E(t)}:{...E(t),...M(t,["fillWithShape"])}}const J=Symbol("properties");function W(t){let e;if(Object.hasOwn(t,J))e=t[J];else{const n=Object.getPrototypeOf(t);e=new Map(n?W(n):void 0),t[J]=e}return e}function Q(t,e={}){const n=Symbol.for(t),{default:r,fallback:i,alias:a}=e,l={declaration:e,internalKey:n},c=()=>typeof r=="function"?r():r,d=()=>typeof i=="function"?i():i;let m=!0;function S(){let h;if(a&&a!==t?h=Ct(this,a):typeof this.getter<"u"?h=this.getter(t,l):h=this[n],h=h??d(),h===void 0&&m){m=!1;const O=c();O!==void 0&&(w.call(this,O),h=O)}return h}function w(h){a&&a!==t?wt(this,a,h):typeof this.setter<"u"?this.setter(t,h,l):this[n]=h}return{get:S,set:w}}function Ht(t,e,n={}){W(t).set(e,n);const r=Q(e,n);Object.defineProperty(t.prototype,e,{get(){return r.get.call(this)},set(i){const a=r.get.call(this);r.set.call(this,i),this.onUpdateProperty?.(e,i,a,n)},configurable:!0,enumerable:!0})}function _e(t){return function(e,n){if(typeof n!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");Ht(e.constructor,n,t)}}function ze(t={}){return function(e,n){const r=n.name;if(typeof r!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");const i=Q(r,t);return{init(a){return W(this.constructor).set(r,t),i.set.call(this,a),a},get(){return i.get.call(this)},set(a){const l=i.get?.call(this);i.set.call(this,a),this.onUpdateProperty?.(r,a,l,t)}}}}function tt(){return{color:A,offsetX:0,offsetY:0,blurRadius:1}}function et(t){return{...tt(),...N({...t,color:g(t.color)?A:b(t.color)})}}function Wt(){return{...tt(),scaleX:1,scaleY:1}}function Bt(t){return{...Wt(),...et(t)}}function Le(t){return t}function xt(t){return N({...t,softEdge:g(t.softEdge)?void 0:t.softEdge,outerShadow:g(t.outerShadow)?void 0:Bt(t.outerShadow),innerShadow:g(t.innerShadow)?void 0:et(t.innerShadow)})}function Kt(t){return typeof t=="string"?{...E(t)}:{...E(t),...M(t,["fillWithShape"])}}const Ee="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Fe=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=Ee[n[t]&63];return e};const Ut=()=>Fe(10),Xt=Ut;function Yt(t){return typeof t=="string"?{...E(t)}:{...E(t),...M(t,["width","style","headEnd","tailEnd"])}}function qt(t){return typeof t=="string"?{color:b(t)}:{...t,color:g(t.color)?A:b(t.color)}}function Zt(){return{boxShadow:"none"}}function Jt(t){return typeof t=="string"?t.startsWith("<svg")?{svg:t}:{paths:[{data:t}]}:Array.isArray(t)?{paths:t.map(e=>typeof e=="string"?{data:e}:e)}:t}function Qt(){return{overflow:"visible",direction:void 0,display:void 0,boxSizing:void 0,width:void 0,height:void 0,maxHeight:void 0,maxWidth:void 0,minHeight:void 0,minWidth:void 0,position:void 0,left:0,top:0,right:void 0,bottom:void 0,borderTop:void 0,borderLeft:void 0,borderRight:void 0,borderBottom:void 0,borderWidth:0,border:void 0,flex:void 0,flexBasis:void 0,flexDirection:void 0,flexGrow:void 0,flexShrink:void 0,flexWrap:void 0,justifyContent:void 0,gap:void 0,alignContent:void 0,alignItems:void 0,alignSelf:void 0,marginTop:void 0,marginLeft:void 0,marginRight:void 0,marginBottom:void 0,margin:void 0,paddingTop:void 0,paddingLeft:void 0,paddingRight:void 0,paddingBottom:void 0,padding:void 0}}function te(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function ee(){return{...Qt(),...te(),...Zt(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"rgb(0, 0, 0)",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function ne(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function re(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function ie(){return{...ne(),color:"rgb(0, 0, 0)",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function oe(){return{...re(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function ae(){return{...oe(),...ie(),textStrokeWidth:0,textStrokeColor:"rgb(0, 0, 0)"}}function k(t){return N({...t,color:g(t.color)?void 0:b(t.color),backgroundColor:g(t.backgroundColor)?void 0:b(t.backgroundColor),borderColor:g(t.borderColor)?void 0:b(t.borderColor),outlineColor:g(t.outlineColor)?void 0:b(t.outlineColor),shadowColor:g(t.shadowColor)?void 0:b(t.shadowColor)})}function Ne(){return{...ee(),...ae()}}const nt=/\r\n|\n\r|\n|\r/,Oe=new RegExp(`${nt.source}|<br\\/>`,"g"),Re=new RegExp(`^(${nt.source})$`),B=`
|
|
2
|
+
`;function De(t){return nt.test(t)}function rt(t){return Re.test(t)}function ue(t){return t.replace(Oe,B)}function le(t,e){const n=Array.from(new Set([...Object.keys(t),...Object.keys(e)]));return!n.length||n.every(r=>t[r]===e[r])}function V(t){const e=[];function n(){return e[e.length-1]}function r(c={}){let d=e[e.length-1];return d?.fragments.length===0?(d={...c,fragments:[]},e[e.length-1]=d):(d={...c,fragments:[]},e.push(d)),d}function i(c="",d={}){Array.from(c).forEach(m=>{if(rt(m)){const{fragments:S,...w}=n()||r();S.length||S.push({...d,content:B}),r(w)}else{const S=n()||r(),w=S.fragments[S.fragments.length-1];if(w){const{content:h,...O}=w;if(le(d,O)){w.content=`${h}${m}`;return}}S.fragments.push({...d,content:m})}})}(Array.isArray(t)?t:[t]).forEach(c=>{if(typeof c=="string")r(),i(c);else if("content"in c){const{content:d,...m}=c;r(k(m)),i(d)}else if("fragments"in c){const{fragments:d,...m}=c;r(k(m)),d.forEach(S=>{const{content:w,...h}=S;i(w,k(h))})}else Array.isArray(c)?(r(),c.forEach(d=>{if(typeof d=="string")i(d);else{const{content:m,...S}=d;i(m,k(S))}})):console.warn("Failed to parse text content",c)});const l=n();return l&&!l.fragments.length&&l.fragments.push({content:B}),e}function se(t){return typeof t=="string"?{content:V(t)}:"content"in t?{...t,content:V(t.content)}:{content:V(t)}}function ke(t){return V(t).map(e=>{const n=ue(e.fragments.flatMap(r=>r.content).join(""));return rt(n)?"":n}).join(B)}function ce(t){return typeof t=="string"?{src:t}:t}function x(t){return N({...t,id:t.id??Xt(),style:g(t.style)?void 0:k(t.style),text:g(t.text)?void 0:se(t.text),background:g(t.background)?void 0:jt(t.background),shape:g(t.shape)?void 0:Jt(t.shape),fill:g(t.fill)?void 0:E(t.fill),outline:g(t.outline)?void 0:Yt(t.outline),foreground:g(t.foreground)?void 0:Kt(t.foreground),shadow:g(t.shadow)?void 0:qt(t.shadow),video:g(t.video)?void 0:ce(t.video),audio:g(t.audio)?void 0:D(t.audio),effect:g(t.effect)?void 0:xt(t.effect),children:t.children?.map(e=>x(e))})}function Ge(t){return x(t)}function Ae(t){const e={};for(const n in t.children){const r=x(t.children[n]);delete r.children,e[n]=r}return{...t,children:e}}o.EventEmitter=be,o.RawWeakMap=Se,o.clearUndef=N,o.defaultColor=A,o.defineProperty=Ht,o.getDeclarations=W,o.getDefaultElementStyle=ee,o.getDefaultHighlightStyle=ne,o.getDefaultInnerShadow=tt,o.getDefaultLayoutStyle=Qt,o.getDefaultListStyleStyle=re,o.getDefaultOuterShadow=Wt,o.getDefaultShadowStyle=Zt,o.getDefaultStyle=Ne,o.getDefaultTextInlineStyle=ie,o.getDefaultTextLineStyle=oe,o.getDefaultTextStyle=ae,o.getDefaultTransformStyle=te,o.getNestedValue=bt,o.getObjectValueByPath=Ct,o.getPropertyDescriptor=Q,o.hasCRLF=De,o.idGenerator=Xt,o.isCRLF=rt,o.isColor=_t,o.isColorFill=At,o.isColorFillObject=Gt,o.isEqualStyle=le,o.isGradient=I,o.isGradientFill=Vt,o.isGradientFillObject=It,o.isImageFill=Tt,o.isImageFillObject=Pt,o.isNone=g,o.isPresetFill=$t,o.isPresetFillObject=Mt,o.nanoid=Ut,o.normalizeAudio=D,o.normalizeBackground=jt,o.normalizeCRLF=ue,o.normalizeColor=b,o.normalizeColorFill=Ot,o.normalizeDocument=Ge,o.normalizeEffect=xt,o.normalizeElement=x,o.normalizeFill=E,o.normalizeFlatDocument=Ae,o.normalizeForeground=Kt,o.normalizeGradient=Nt,o.normalizeGradientFill=Rt,o.normalizeImageFill=Dt,o.normalizeInnerShadow=et,o.normalizeOuterShadow=Bt,o.normalizeOutline=Yt,o.normalizePresetFill=kt,o.normalizeShadow=qt,o.normalizeShape=Jt,o.normalizeSoftEdge=Le,o.normalizeStyle=k,o.normalizeText=se,o.normalizeTextContent=V,o.normalizeVideo=ce,o.parseColor=Z,o.parseGradient=zt,o.pick=M,o.property=_e,o.property2=ze,o.round=F,o.setNestedValue=St,o.setObjectValueByPath=wt,o.stringifyGradient=we,o.textContentToString=ke,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
package/dist/index.mjs
CHANGED
|
@@ -11,34 +11,24 @@ function normalizeAudio(audio) {
|
|
|
11
11
|
|
|
12
12
|
class EventEmitter {
|
|
13
13
|
eventListeners = /* @__PURE__ */ new Map();
|
|
14
|
-
|
|
15
|
-
this.eventListeners.clear();
|
|
16
|
-
return this;
|
|
17
|
-
}
|
|
18
|
-
hasEventListener(event) {
|
|
19
|
-
return this.eventListeners.has(event);
|
|
20
|
-
}
|
|
21
|
-
on(type, listener, options) {
|
|
14
|
+
addEventListener(event, listener, options) {
|
|
22
15
|
const object = { value: listener, options };
|
|
23
|
-
const listeners = this.eventListeners.get(
|
|
16
|
+
const listeners = this.eventListeners.get(event);
|
|
24
17
|
if (!listeners) {
|
|
25
|
-
this.eventListeners.set(
|
|
18
|
+
this.eventListeners.set(event, object);
|
|
26
19
|
} else if (Array.isArray(listeners)) {
|
|
27
20
|
listeners.push(object);
|
|
28
21
|
} else {
|
|
29
|
-
this.eventListeners.set(
|
|
22
|
+
this.eventListeners.set(event, [listeners, object]);
|
|
30
23
|
}
|
|
31
24
|
return this;
|
|
32
25
|
}
|
|
33
|
-
|
|
34
|
-
return this.on(type, listener, { once: true });
|
|
35
|
-
}
|
|
36
|
-
off(type, listener, options) {
|
|
26
|
+
removeEventListener(event, listener, options) {
|
|
37
27
|
if (!listener) {
|
|
38
|
-
this.eventListeners.delete(
|
|
28
|
+
this.eventListeners.delete(event);
|
|
39
29
|
return this;
|
|
40
30
|
}
|
|
41
|
-
const listeners = this.eventListeners.get(
|
|
31
|
+
const listeners = this.eventListeners.get(event);
|
|
42
32
|
if (!listeners) {
|
|
43
33
|
return this;
|
|
44
34
|
}
|
|
@@ -51,31 +41,38 @@ class EventEmitter {
|
|
|
51
41
|
}
|
|
52
42
|
}
|
|
53
43
|
if (events.length) {
|
|
54
|
-
this.eventListeners.set(
|
|
44
|
+
this.eventListeners.set(event, events.length === 1 ? events[0] : events);
|
|
55
45
|
} else {
|
|
56
|
-
this.eventListeners.delete(
|
|
46
|
+
this.eventListeners.delete(event);
|
|
57
47
|
}
|
|
58
48
|
} else {
|
|
59
49
|
if (listeners.value === listener && (typeof options === "boolean" || !options?.once || (typeof listeners.options === "boolean" || listeners.options?.once))) {
|
|
60
|
-
this.eventListeners.delete(
|
|
50
|
+
this.eventListeners.delete(event);
|
|
61
51
|
}
|
|
62
52
|
}
|
|
63
53
|
return this;
|
|
64
54
|
}
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
removeAllListeners() {
|
|
56
|
+
this.eventListeners.clear();
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
hasEventListener(event) {
|
|
60
|
+
return this.eventListeners.has(event);
|
|
61
|
+
}
|
|
62
|
+
dispatchEvent(event, ...args) {
|
|
63
|
+
const listeners = this.eventListeners.get(event);
|
|
67
64
|
if (listeners) {
|
|
68
65
|
if (Array.isArray(listeners)) {
|
|
69
66
|
for (let len = listeners.length, i = 0; i < len; i++) {
|
|
70
67
|
const object = listeners[i];
|
|
71
68
|
if (typeof object.options === "object" && object.options?.once) {
|
|
72
|
-
this.off(
|
|
69
|
+
this.off(event, object.value, object.options);
|
|
73
70
|
}
|
|
74
71
|
object.value.apply(this, args);
|
|
75
72
|
}
|
|
76
73
|
} else {
|
|
77
74
|
if (typeof listeners.options === "object" && listeners.options?.once) {
|
|
78
|
-
this.off(
|
|
75
|
+
this.off(event, listeners.value, listeners.options);
|
|
79
76
|
}
|
|
80
77
|
listeners.value.apply(this, args);
|
|
81
78
|
}
|
|
@@ -84,6 +81,18 @@ class EventEmitter {
|
|
|
84
81
|
return false;
|
|
85
82
|
}
|
|
86
83
|
}
|
|
84
|
+
on(event, listener, options) {
|
|
85
|
+
return this.addEventListener(event, listener, options);
|
|
86
|
+
}
|
|
87
|
+
once(event, listener) {
|
|
88
|
+
return this.addEventListener(event, listener, { once: true });
|
|
89
|
+
}
|
|
90
|
+
off(event, listener, options) {
|
|
91
|
+
return this.removeEventListener(event, listener, options);
|
|
92
|
+
}
|
|
93
|
+
emit(event, ...args) {
|
|
94
|
+
this.dispatchEvent(event, ...args);
|
|
95
|
+
}
|
|
87
96
|
}
|
|
88
97
|
|
|
89
98
|
function isNone(value) {
|
|
@@ -967,16 +976,14 @@ function normalizeBackground(background) {
|
|
|
967
976
|
}
|
|
968
977
|
|
|
969
978
|
const propertiesSymbol = Symbol("properties");
|
|
970
|
-
function getDeclarations(
|
|
971
|
-
const proto = Object.getPrototypeOf(target);
|
|
979
|
+
function getDeclarations(constructor) {
|
|
972
980
|
let declarations;
|
|
973
|
-
if (
|
|
974
|
-
declarations =
|
|
981
|
+
if (Object.hasOwn(constructor, propertiesSymbol)) {
|
|
982
|
+
declarations = constructor[propertiesSymbol];
|
|
975
983
|
} else {
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
}
|
|
984
|
+
const superConstructor = Object.getPrototypeOf(constructor);
|
|
985
|
+
declarations = new Map(superConstructor ? getDeclarations(superConstructor) : void 0);
|
|
986
|
+
constructor[propertiesSymbol] = declarations;
|
|
980
987
|
}
|
|
981
988
|
return declarations;
|
|
982
989
|
}
|
|
@@ -1033,12 +1040,10 @@ function getPropertyDescriptor(key, declaration = {}) {
|
|
|
1033
1040
|
set
|
|
1034
1041
|
};
|
|
1035
1042
|
}
|
|
1036
|
-
function defineProperty(
|
|
1037
|
-
getDeclarations(
|
|
1038
|
-
typeof target === "function" ? target : target.constructor
|
|
1039
|
-
).set(key, declaration);
|
|
1043
|
+
function defineProperty(constructor, key, declaration = {}) {
|
|
1044
|
+
getDeclarations(constructor).set(key, declaration);
|
|
1040
1045
|
const descriptor = getPropertyDescriptor(key, declaration);
|
|
1041
|
-
Object.defineProperty(
|
|
1046
|
+
Object.defineProperty(constructor.prototype, key, {
|
|
1042
1047
|
get() {
|
|
1043
1048
|
return descriptor.get.call(this);
|
|
1044
1049
|
},
|
|
@@ -1056,7 +1061,7 @@ function property(declaration) {
|
|
|
1056
1061
|
if (typeof key !== "string") {
|
|
1057
1062
|
throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");
|
|
1058
1063
|
}
|
|
1059
|
-
defineProperty(target, key, declaration);
|
|
1064
|
+
defineProperty(target.constructor, key, declaration);
|
|
1060
1065
|
};
|
|
1061
1066
|
}
|
|
1062
1067
|
function property2(declaration = {}) {
|