modern-idoc 0.10.10 → 0.10.11
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 +24 -12
- package/dist/index.d.cts +3 -1
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +24 -12
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -188,13 +188,13 @@ function setObjectValueByPath(obj, path, value) {
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
class Observable {
|
|
191
|
-
|
|
191
|
+
_eventListeners = /* @__PURE__ */ new Map();
|
|
192
192
|
on(event, listener) {
|
|
193
|
-
let
|
|
194
|
-
if (
|
|
195
|
-
this.
|
|
193
|
+
let listeners = this._eventListeners.get(event);
|
|
194
|
+
if (listeners === void 0) {
|
|
195
|
+
this._eventListeners.set(event, listeners = /* @__PURE__ */ new Set());
|
|
196
196
|
}
|
|
197
|
-
|
|
197
|
+
listeners.add(listener);
|
|
198
198
|
return this;
|
|
199
199
|
}
|
|
200
200
|
once(event, listener) {
|
|
@@ -206,21 +206,33 @@ class Observable {
|
|
|
206
206
|
return this;
|
|
207
207
|
}
|
|
208
208
|
off(event, listener) {
|
|
209
|
-
const
|
|
210
|
-
if (
|
|
211
|
-
|
|
212
|
-
if (
|
|
213
|
-
this.
|
|
209
|
+
const listeners = this._eventListeners.get(event);
|
|
210
|
+
if (listeners !== void 0) {
|
|
211
|
+
listeners.delete(listener);
|
|
212
|
+
if (listeners.size === 0) {
|
|
213
|
+
this._eventListeners.delete(event);
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
return this;
|
|
217
217
|
}
|
|
218
218
|
emit(event, ...args) {
|
|
219
|
-
|
|
219
|
+
const listeners = this._eventListeners.get(event);
|
|
220
|
+
if (listeners) {
|
|
221
|
+
for (const listener of listeners) {
|
|
222
|
+
listener(...args);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return this;
|
|
226
|
+
}
|
|
227
|
+
removeAllListeners() {
|
|
228
|
+
this._eventListeners.clear();
|
|
220
229
|
return this;
|
|
221
230
|
}
|
|
231
|
+
hasEventListener(event) {
|
|
232
|
+
return this._eventListeners.has(event);
|
|
233
|
+
}
|
|
222
234
|
destroy() {
|
|
223
|
-
this.
|
|
235
|
+
this.removeAllListeners();
|
|
224
236
|
}
|
|
225
237
|
}
|
|
226
238
|
|
package/dist/index.d.cts
CHANGED
|
@@ -850,11 +850,13 @@ interface ObservableEvents {
|
|
|
850
850
|
[event: string]: any[];
|
|
851
851
|
}
|
|
852
852
|
declare class Observable<T extends ObservableEvents = ObservableEvents> {
|
|
853
|
-
|
|
853
|
+
protected _eventListeners: Map<string, Set<any>>;
|
|
854
854
|
on<K extends keyof T & string>(event: K, listener: (...args: T[K]) => void): this;
|
|
855
855
|
once<K extends keyof T & string>(event: K, listener: (...args: T[K]) => void): this;
|
|
856
856
|
off<K extends keyof T & string>(event: K, listener: (...args: T[K]) => void): this;
|
|
857
857
|
emit<K extends keyof T & string>(event: K, ...args: T[K]): this;
|
|
858
|
+
removeAllListeners(): this;
|
|
859
|
+
hasEventListener(event: string): boolean;
|
|
858
860
|
destroy(): void;
|
|
859
861
|
}
|
|
860
862
|
|
package/dist/index.d.mts
CHANGED
|
@@ -850,11 +850,13 @@ interface ObservableEvents {
|
|
|
850
850
|
[event: string]: any[];
|
|
851
851
|
}
|
|
852
852
|
declare class Observable<T extends ObservableEvents = ObservableEvents> {
|
|
853
|
-
|
|
853
|
+
protected _eventListeners: Map<string, Set<any>>;
|
|
854
854
|
on<K extends keyof T & string>(event: K, listener: (...args: T[K]) => void): this;
|
|
855
855
|
once<K extends keyof T & string>(event: K, listener: (...args: T[K]) => void): this;
|
|
856
856
|
off<K extends keyof T & string>(event: K, listener: (...args: T[K]) => void): this;
|
|
857
857
|
emit<K extends keyof T & string>(event: K, ...args: T[K]): this;
|
|
858
|
+
removeAllListeners(): this;
|
|
859
|
+
hasEventListener(event: string): boolean;
|
|
858
860
|
destroy(): void;
|
|
859
861
|
}
|
|
860
862
|
|
package/dist/index.d.ts
CHANGED
|
@@ -850,11 +850,13 @@ interface ObservableEvents {
|
|
|
850
850
|
[event: string]: any[];
|
|
851
851
|
}
|
|
852
852
|
declare class Observable<T extends ObservableEvents = ObservableEvents> {
|
|
853
|
-
|
|
853
|
+
protected _eventListeners: Map<string, Set<any>>;
|
|
854
854
|
on<K extends keyof T & string>(event: K, listener: (...args: T[K]) => void): this;
|
|
855
855
|
once<K extends keyof T & string>(event: K, listener: (...args: T[K]) => void): this;
|
|
856
856
|
off<K extends keyof T & string>(event: K, listener: (...args: T[K]) => void): this;
|
|
857
857
|
emit<K extends keyof T & string>(event: K, ...args: T[K]): this;
|
|
858
|
+
removeAllListeners(): this;
|
|
859
|
+
hasEventListener(event: string): boolean;
|
|
858
860
|
destroy(): void;
|
|
859
861
|
}
|
|
860
862
|
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(o,I){typeof exports=="object"&&typeof module<"u"?I(exports):typeof define=="function"&&define.amd?define(["exports"],I):(o=typeof globalThis<"u"?globalThis:o||self,I(o.modernIdoc={}))})(this,(function(o){"use strict";function I(t){return typeof t=="string"?{src:t}:t}var Oe={grad:.9,turn:360,rad:360/(2*Math.PI)},D=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},v=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=Math.pow(10,e)),Math.round(r*t)/r+0},P=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=1),t>r?r:t>e?t:e},wt=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},Pt=function(t){return{r:P(t.r,0,255),g:P(t.g,0,255),b:P(t.b,0,255),a:P(t.a)}},rt=function(t){return{r:v(t.r),g:v(t.g),b:v(t.b),a:v(t.a,3)}},ze=/^#([0-9a-f]{3,8})$/i,q=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},Ft=function(t){var e=t.r,r=t.g,n=t.b,i=t.a,a=Math.max(e,r,n),s=a-Math.min(e,r,n),u=s?a===e?(r-n)/s:a===r?2+(n-e)/s:4+(e-r)/s:0;return{h:60*(u<0?u+6:u),s:a?s/a*100:0,v:a/255*100,a:i}},Ot=function(t){var e=t.h,r=t.s,n=t.v,i=t.a;e=e/360*6,r/=100,n/=100;var a=Math.floor(e),s=n*(1-r),u=n*(1-(e-a)*r),f=n*(1-(1-e+a)*r),g=a%6;return{r:255*[n,u,s,s,f,n][g],g:255*[f,n,n,u,s,s][g],b:255*[s,s,f,n,n,u][g],a:i}},zt=function(t){return{h:wt(t.h),s:P(t.s,0,100),l:P(t.l,0,100),a:P(t.a)}},Et=function(t){return{h:v(t.h),s:v(t.s),l:v(t.l),a:v(t.a,3)}},Lt=function(t){return Ot((r=(e=t).s,{h:e.h,s:(r*=((n=e.l)<50?n:100-n)/100)>0?2*r/(n+r)*100:0,v:n+r,a:e.a}));var e,r,n},V=function(t){return{h:(e=Ft(t)).h,s:(i=(200-(r=e.s))*(n=e.v)/100)>0&&i<200?r*n/100/(i<=100?i:200-i)*100:0,l:i/2,a:e.a};var e,r,n,i},Ee=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Le=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,De=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ae=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Dt={string:[[function(t){var e=ze.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?v(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?v(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=De.exec(t)||Ae.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:Pt({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=Ee.exec(t)||Le.exec(t);if(!e)return null;var r,n,i=zt({h:(r=e[1],n=e[2],n===void 0&&(n="deg"),Number(r)*(Oe[n]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return Lt(i)},"hsl"]],object:[[function(t){var e=t.r,r=t.g,n=t.b,i=t.a,a=i===void 0?1:i;return D(e)&&D(r)&&D(n)?Pt({r:Number(e),g:Number(r),b:Number(n),a:Number(a)}):null},"rgb"],[function(t){var e=t.h,r=t.s,n=t.l,i=t.a,a=i===void 0?1:i;if(!D(e)||!D(r)||!D(n))return null;var s=zt({h:Number(e),s:Number(r),l:Number(n),a:Number(a)});return Lt(s)},"hsl"],[function(t){var e=t.h,r=t.s,n=t.v,i=t.a,a=i===void 0?1:i;if(!D(e)||!D(r)||!D(n))return null;var s=(function(u){return{h:wt(u.h),s:P(u.s,0,100),v:P(u.v,0,100),a:P(u.a)}})({h:Number(e),s:Number(r),v:Number(n),a:Number(a)});return Ot(s)},"hsv"]]},At=function(t,e){for(var r=0;r<e.length;r++){var n=e[r][0](t);if(n)return[n,e[r][1]]}return[null,void 0]},Ne=function(t){return typeof t=="string"?At(t.trim(),Dt.string):typeof t=="object"&&t!==null?At(t,Dt.object):[null,void 0]},nt=function(t,e){var r=V(t);return{h:r.h,s:P(r.s+100*e,0,100),l:r.l,a:r.a}},it=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},Nt=function(t,e){var r=V(t);return{h:r.h,s:r.s,l:P(r.l+100*e,0,100),a:r.a}},Rt=(function(){function t(e){this.parsed=Ne(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 v(it(this.rgba),2)},t.prototype.isDark=function(){return it(this.rgba)<.5},t.prototype.isLight=function(){return it(this.rgba)>=.5},t.prototype.toHex=function(){return e=rt(this.rgba),r=e.r,n=e.g,i=e.b,s=(a=e.a)<1?q(v(255*a)):"","#"+q(r)+q(n)+q(i)+s;var e,r,n,i,a,s},t.prototype.toRgb=function(){return rt(this.rgba)},t.prototype.toRgbString=function(){return e=rt(this.rgba),r=e.r,n=e.g,i=e.b,(a=e.a)<1?"rgba("+r+", "+n+", "+i+", "+a+")":"rgb("+r+", "+n+", "+i+")";var e,r,n,i,a},t.prototype.toHsl=function(){return Et(V(this.rgba))},t.prototype.toHslString=function(){return e=Et(V(this.rgba)),r=e.h,n=e.s,i=e.l,(a=e.a)<1?"hsla("+r+", "+n+"%, "+i+"%, "+a+")":"hsl("+r+", "+n+"%, "+i+"%)";var e,r,n,i,a},t.prototype.toHsv=function(){return e=Ft(this.rgba),{h:v(e.h),s:v(e.s),v:v(e.v),a:v(e.a,3)};var e},t.prototype.invert=function(){return L({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),L(nt(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),L(nt(this.rgba,-e))},t.prototype.grayscale=function(){return L(nt(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),L(Nt(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),L(Nt(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"?L({r:(r=this.rgba).r,g:r.g,b:r.b,a:e}):v(this.rgba.a,3);var r},t.prototype.hue=function(e){var r=V(this.rgba);return typeof e=="number"?L({h:e,s:r.s,l:r.l,a:r.a}):v(r.h)},t.prototype.isEqual=function(e){return this.toHex()===L(e).toHex()},t})(),L=function(t){return t instanceof Rt?t:new Rt(t)};class Re{eventListeners=new Map;addEventListener(e,r,n){const i={value:r,options:n},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,r,n){if(!r)return this.eventListeners.delete(e),this;const i=this.eventListeners.get(e);if(!i)return this;if(Array.isArray(i)){const a=[];for(let s=0,u=i.length;s<u;s++){const f=i[s];(f.value!==r||typeof n=="object"&&n?.once&&(typeof f.options=="boolean"||!f.options?.once))&&a.push(f)}a.length?this.eventListeners.set(e,a.length===1?a[0]:a):this.eventListeners.delete(e)}else i.value===r&&(typeof n=="boolean"||!n?.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,...r){const n=this.eventListeners.get(e);if(n){if(Array.isArray(n))for(let i=n.length,a=0;a<i;a++){const s=n[a];typeof s.options=="object"&&s.options?.once&&this.off(e,s.value,s.options),s.value.apply(this,r)}else typeof n.options=="object"&&n.options?.once&&this.off(e,n.value,n.options),n.value.apply(this,r);return!0}else return!1}on(e,r,n){return this.addEventListener(e,r,n)}once(e,r){return this.addEventListener(e,r,{once:!0})}off(e,r,n){return this.removeEventListener(e,r,n)}emit(e,...r){this.dispatchEvent(e,...r)}}function h(t){return t==null||t===""||t==="none"}function N(t,e=0,r=10**e){return Math.round(r*t)/r+0}function F(t,e=!1){if(typeof t!="object"||!t)return t;if(Array.isArray(t))return e?t.map(n=>F(n,e)):t;const r={};for(const n in t){const i=t[n];i!=null&&(e?r[n]=F(i,e):r[n]=i)}return r}function A(t,e){const r={};return e.forEach(n=>{n in t&&(r[n]=t[n])}),r}function J(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){const r=Array.from(new Set([...Object.keys(t),...Object.keys(e)]));return!r.length||r.every(n=>t[n]===e[n])}return!1}function jt(t,e,r){const n=e.length-1;if(n<0)return t===void 0?r:t;for(let i=0;i<n;i++){if(t==null)return r;t=t[e[i]]}return t==null||t[e[n]]===void 0?r:t[e[n]]}function Gt(t,e,r){const n=e.length-1;for(let i=0;i<n;i++)typeof t[e[i]]!="object"&&(t[e[i]]={}),t=t[e[i]];t[e[n]]=r}function It(t,e,r){return t==null||!e||typeof e!="string"?r:t[e]!==void 0?t[e]:(e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),jt(t,e.split("."),r))}function Tt(t,e,r){if(!(typeof t!="object"||!e))return e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),Gt(t,e.split("."),r)}class Mt{_observers=new Map;on(e,r){let n=this._observers.get(e);return n===void 0&&this._observers.set(e,n=new Set),n.add(r),this}once(e,r){const n=(...i)=>{this.off(e,n),r(...i)};return this.on(e,n),this}off(e,r){const n=this._observers.get(e);return n!==void 0&&(n.delete(r),n.size===0&&this._observers.delete(e)),this}emit(e,...r){return Array.from((this._observers.get(e)||new Map).values()).forEach(n=>n(...r)),this}destroy(){this._observers=new Map}}class je{_map=new WeakMap;_toRaw(e){if(e&&typeof e=="object"){const r=e.__v_raw;r&&(e=this._toRaw(r))}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,r){return this._map.set(this._toRaw(e),this._toRaw(r)),this}}const ot=Symbol("properties"),X=Symbol("inited");function k(t){let e;if(Object.hasOwn(t,ot))e=t[ot];else{const r=Object.getPrototypeOf(t);e=new Map(r?k(r):void 0),t[ot]=e}return e}function at(t,e,r,n){const{alias:i,internalKey:a}=n,s=t[e];i?Tt(t,i,r):t[a]=r,t.onUpdateProperty?.(e,r??$(t,e,n),s)}function st(t,e,r){const{alias:n,internalKey:i}=r;let a;return n?a=It(t,n):a=t[i],a=a??$(t,e,r),a}function $(t,e,r){const{default:n,fallback:i}=r;let a;if(n!==void 0&&!t[X]?.[e]){t[X]||(t[X]={}),t[X][e]=!0;const s=typeof n=="function"?n():n;s!==void 0&&(t[e]=s,a=s)}return a===void 0&&i!==void 0&&(a=typeof i=="function"?i():i),a}function lt(t,e){function r(){return typeof this.getProperty<"u"?this.getProperty(t):st(this,t,e)}function n(i){typeof this.setProperty<"u"?this.setProperty(t,i):at(this,t,i,e)}return{get:r,set:n}}function Vt(t,e,r={}){const n={...r,internalKey:Symbol(e)};k(t).set(e,n);const i=lt(e,n);Object.defineProperty(t.prototype,e,{get(){return i.get.call(this)},set(a){i.set.call(this,a)},configurable:!0,enumerable:!0})}function Ge(t){return function(e,r){if(typeof r!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");Vt(e.constructor,r,t)}}function Ie(t={}){return function(e,r){const n=r.name;if(typeof n!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");const i={...t,internalKey:Symbol(n)},a=lt(n,i);return{init(s){return k(this.constructor).set(n,i),a.set.call(this,s),s},get(){return a.get.call(this)},set(s){a.set.call(this,s)}}}}class Te extends Mt{_propertyAccessor;_properties=new Map;_updatedProperties=new Map;_changedProperties=new Set;_updatingPromise=Promise.resolve();_updating=!1;constructor(e){super(),this.setProperties(e)}isDirty(e){return e?this._updatedProperties.has(e):this._updatedProperties.size>0}getProperty(e){const r=this.getPropertyDeclaration(e);if(r){if(r.internal||r.alias)return st(this,e,r);{let n;return this._propertyAccessor?.getProperty?n=this._propertyAccessor.getProperty(e):n=this._properties.get(e),n??$(this,e,r)}}}setProperty(e,r){const n=this.getPropertyDeclaration(e);if(n)if(n.internal||n.alias)at(this,e,r,n);else{const i=this.getProperty(e);this._propertyAccessor?.setProperty?.(e,r),this._properties.set(e,r),this.onUpdateProperty?.(e,r??$(this,e,n),i)}}getProperties(e){const r={};for(const[n,i]of this.getPropertyDeclarations())!i.internal&&!i.alias&&(!e||e.includes(n))&&(r[n]=this.getProperty(n));return r}setProperties(e){if(e&&typeof e=="object")for(const r in e)this.setProperty(r,e[r]);return this}resetProperties(){for(const[e,r]of this.getPropertyDeclarations())this.setProperty(e,typeof r.default=="function"?r.default():r.default);return this}getPropertyDeclarations(){return k(this.constructor)}getPropertyDeclaration(e){return this.getPropertyDeclarations().get(e)}setPropertyAccessor(e){const r=this.getPropertyDeclarations();this._propertyAccessor=void 0;const n={};return r.forEach((i,a)=>{n[a]=this.getProperty(a)}),this._propertyAccessor=e,r.forEach((i,a)=>{const s=this.getProperty(a),u=n[a];s!==void 0&&!Object.is(s,u)&&(this.setProperty(a,s),!i.internal&&!i.alias&&this.requestUpdate(a,s,u))}),this}async _nextTick(){return"requestAnimationFrame"in globalThis?new Promise(e=>globalThis.requestAnimationFrame(e)):Promise.resolve()}async _enqueueUpdate(){this._updating=!0;try{await this._updatingPromise}catch(e){Promise.reject(e)}await this._nextTick(),this._updating&&(this.onUpdate(),this._updating=!1)}onUpdate(){this._update(this._updatedProperties),this._updatedProperties=new Map}onUpdateProperty(e,r,n){Object.is(r,n)||this.requestUpdate(e,r,n)}requestUpdate(e,r,n){e!==void 0&&(this._updatedProperties.set(e,n),this._changedProperties.add(e),this._updateProperty(e,r,n),this.emit("updateProperty",e,r,n)),this._updating||(this._updatingPromise=this._enqueueUpdate())}_update(e){}_updateProperty(e,r,n){}toJSON(){const e={};return this._properties.forEach((r,n)=>{r!==void 0&&(r&&typeof r=="object"?"toJSON"in r&&typeof r.toJSON=="function"?e[n]=r.toJSON():Array.isArray(r)?e[n]=[...r]:e[n]={...r}:e[n]=r)}),e}clone(){return new this.constructor(this.toJSON())}destroy(){this.emit("destroy"),super.destroy()}}function ut(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,L(e)}function Me(t){return{r:N(t.r),g:N(t.g),b:N(t.b),a:N(t.a,3)}}function Y(t){const e=t.toString(16);return e.length<2?`0${e}`:e}const W="#000000FF";function ct(t){return ut(t).isValid()}function y(t,e=!1){const r=ut(t);if(!r.isValid()){if(typeof t=="string")return t;const u=`Failed to normalizeColor ${t}`;if(e)throw new Error(u);return console.warn(u),W}const{r:n,g:i,b:a,a:s}=Me(r.rgba);return`#${Y(n)}${Y(i)}${Y(a)}${Y(N(s*255))}`}var x=x||{};x.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 r(l){const c=new Error(`${e}: ${l}`);throw c.source=e,c}function n(){const l=i();return e.length>0&&r("Invalid input not EOF"),l}function i(){return M(a)}function a(){return s("linear-gradient",t.linearGradient,f)||s("repeating-linear-gradient",t.repeatingLinearGradient,f)||s("radial-gradient",t.radialGradient,p)||s("repeating-radial-gradient",t.repeatingRadialGradient,p)}function s(l,c,d){return u(c,S=>{const G=d();return G&&(m(t.comma)||r("Missing comma before color stops")),{type:l,orientation:G,colorStops:M(_t)}})}function u(l,c){const d=m(l);if(d){m(t.startCall)||r("Missing (");const S=c(d);return m(t.endCall)||r("Missing )"),S}}function f(){const l=g();if(l)return l;const c=w("position-keyword",t.positionKeywords,1);return c?{type:"directional",value:c.value}:b()}function g(){return w("directional",t.sideOrCorner,1)}function b(){return w("angular",t.angleValue,1)||w("angular",t.radianValue,1)}function p(){let l,c=_(),d;return c&&(l=[],l.push(c),d=e,m(t.comma)&&(c=_(),c?l.push(c):e=d)),l}function _(){let l=C()||R();if(l)l.at=E();else{const c=O();if(c){l=c;const d=E();d&&(l.at=d)}else{const d=E();if(d)l={type:"default-radial",at:d};else{const S=j();S&&(l={type:"default-radial",at:S})}}}return l}function C(){const l=w("shape",/^(circle)/i,0);return l&&(l.style=Fe()||O()),l}function R(){const l=w("shape",/^(ellipse)/i,0);return l&&(l.style=j()||et()||O()),l}function O(){return w("extent-keyword",t.extentKeywords,1)}function E(){if(w("position",/^at/,0)){const l=j();return l||r("Missing positioning value"),l}}function j(){const l=U();if(l.x||l.y)return{type:"position",value:l}}function U(){return{x:et(),y:et()}}function M(l){let c=l();const d=[];if(c)for(d.push(c);m(t.comma);)c=l(),c?d.push(c):r("One extra comma");return d}function _t(){const l=xe();return l||r("Expected color definition"),l.length=et(),l}function xe(){return Qe()||ir()||nr()||er()||tr()||rr()||Ze()}function Ze(){return w("literal",t.literalColor,0)}function Qe(){return w("hex",t.hexColor,1)}function tr(){return u(t.rgbColor,()=>({type:"rgb",value:M(K)}))}function er(){return u(t.rgbaColor,()=>({type:"rgba",value:M(K)}))}function rr(){return u(t.varColor,()=>({type:"var",value:or()}))}function nr(){return u(t.hslColor,()=>{m(t.percentageValue)&&r("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const c=K();m(t.comma);let d=m(t.percentageValue);const S=d?d[1]:null;m(t.comma),d=m(t.percentageValue);const G=d?d[1]:null;return(!S||!G)&&r("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[c,S,G]}})}function ir(){return u(t.hslaColor,()=>{const l=K();m(t.comma);let c=m(t.percentageValue);const d=c?c[1]:null;m(t.comma),c=m(t.percentageValue);const S=c?c[1]:null;m(t.comma);const G=K();return(!d||!S)&&r("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[l,d,S,G]}})}function or(){return m(t.variableName)[1]}function K(){return m(t.number)[1]}function et(){return w("%",t.percentageValue,1)||ar()||sr()||Fe()}function ar(){return w("position-keyword",t.positionKeywords,1)}function sr(){return u(t.calcValue,()=>{let l=1,c=0;for(;l>0&&c<e.length;){const S=e.charAt(c);S==="("?l++:S===")"&&l--,c++}l>0&&r("Missing closing parenthesis in calc() expression");const d=e.substring(0,c-1);return Ct(c-1),{type:"calc",value:d}})}function Fe(){return w("px",t.pixelValue,1)||w("em",t.emValue,1)}function w(l,c,d){const S=m(c);if(S)return{type:l,value:S[d]}}function m(l){let c,d;return d=/^\s+/.exec(e),d&&Ct(d[0].length),c=l.exec(e),c&&Ct(c[0].length),c}function Ct(l){e=e.substr(l)}return function(l){return e=l.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),n()}})();const kt=x.parse.bind(x);var Z=Z||{};Z.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 r=t.visit(e.orientation);return r&&(r+=", "),e.type+"("+r+t.visit(e.colorStops)+")"},visit_shape:function(e){var r=e.value,n=t.visit(e.at),i=t.visit(e.style);return i&&(r+=" "+i),n&&(r+=" at "+n),r},"visit_default-radial":function(e){var r="",n=t.visit(e.at);return n&&(r+=n),r},"visit_extent-keyword":function(e){var r=e.value,n=t.visit(e.at);return n&&(r+=" at "+n),r},"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,r){var n=e,i=t.visit(r.length);return i&&(n+=" "+i),n},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var r="",n=e.length;return e.forEach(function(i,a){r+=t.visit(i),a<n-1&&(r+=", ")}),r},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 r=t["visit_"+e.type];if(r)return r(e);throw Error("Missing visitor visit_"+e.type)}else throw Error("Invalid node.")}};return function(e){return t.visit(e)}})();const Ve=Z.stringify.bind(Z);function $t(t){const e=t.length-1;return t.map((r,n)=>{const i=r.value;let a=N(n/e,3),s="#00000000";switch(r.type){case"rgb":s=y({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0)});break;case"rgba":s=y({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0),a:Number(i[3]??0)});break;case"literal":s=y(r.value);break;case"hex":s=y(`#${r.value}`);break}return r.length?.type==="%"&&(a=Number(r.length.value)/100),{offset:a,color:s}})}function Wt(t){let e=0;return t.orientation?.type==="angular"&&(e=Number(t.orientation.value)),{type:"linear-gradient",angle:e,stops:$t(t.colorStops)}}function Ht(t){return t.orientation?.map(e=>{switch(e?.type){default:return null}}),{type:"radial-gradient",stops:$t(t.colorStops)}}function H(t){return t.startsWith("linear-gradient(")||t.startsWith("radial-gradient(")}function Bt(t){return kt(t).map(e=>{switch(e?.type){case"linear-gradient":return Wt(e);case"repeating-linear-gradient":return{...Wt(e),repeat:!0};case"radial-gradient":return Ht(e);case"repeating-radial-gradient":return{...Ht(e),repeat:!0};default:return}}).filter(Boolean)}const ft=["color"];function Ut(t){let e;return typeof t=="string"?e={color:t}:e={...t},e.color&&(e.color=y(e.color)),A(e,ft)}const dt=["linearGradient","radialGradient","rotateWithShape"];function Kt(t){let e;if(typeof t=="string"?e={image:t}:e={...t},e.image){const{type:r,...n}=Bt(e.image)[0]??{};switch(r){case"radial-gradient":return{radialGradient:n};case"linear-gradient":return{linearGradient:n}}}return A(e,dt)}const ht=["image","cropRect","stretchRect","tile","dpi","opacity","rotateWithShape"];function qt(t){let e;return typeof t=="string"?e={image:t}:e={...t},A(e,ht)}const gt=["preset","foregroundColor","backgroundColor"];function Jt(t){let e;return typeof t=="string"?e={preset:t}:e={...t},h(e.foregroundColor)?delete e.foregroundColor:e.foregroundColor=y(e.foregroundColor),h(e.backgroundColor)?delete e.backgroundColor:e.backgroundColor=y(e.backgroundColor),A(e,gt)}function Xt(t){return!h(t.color)}function Yt(t){return typeof t=="string"?ct(t):Xt(t)}function xt(t){return!h(t.image)&&H(t.image)||!!t.linearGradient||!!t.radialGradient}function Zt(t){return typeof t=="string"?H(t):xt(t)}function Qt(t){return!h(t.image)&&!H(t.image)}function te(t){return typeof t=="string"?!ct(t)&&!H(t):Qt(t)}function ee(t){return!h(t.preset)}function re(t){return typeof t=="string"?!1:ee(t)}function z(t){const r={enabled:t&&typeof t=="object"?t.enabled:void 0};return Yt(t)&&Object.assign(r,Ut(t)),Zt(t)&&Object.assign(r,Kt(t)),te(t)&&Object.assign(r,qt(t)),re(t)&&Object.assign(r,Jt(t)),A(F(r),Array.from(new Set([...ft,...ht,...dt,...gt])))}function ne(t){return typeof t=="string"?{...z(t)}:{...z(t),...A(t,["fillWithShape"])}}function pt(){return{color:W,offsetX:0,offsetY:0,blurRadius:1}}function mt(t){return{...pt(),...F({...t,color:h(t.color)?W:y(t.color)})}}function ie(){return{...pt(),scaleX:1,scaleY:1}}function oe(t){return{...ie(),...mt(t)}}function ke(t){return t}function ae(t){return F({...t,softEdge:h(t.softEdge)?void 0:t.softEdge,outerShadow:h(t.outerShadow)?void 0:oe(t.outerShadow),innerShadow:h(t.innerShadow)?void 0:mt(t.innerShadow)})}function se(t){return typeof t=="string"?{...z(t)}:{...z(t),...A(t,["fillWithShape"])}}const $e="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let We=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=$e[r[t]&63];return e};const le=()=>We(10),ue=le;function B(t){return typeof t=="string"?{...z(t)}:{...z(t),...A(t,["width","style","lineCap","lineJoin","headEnd","tailEnd"])}}function ce(t){return typeof t=="string"?{color:y(t)}:{...t,color:h(t.color)?W:y(t.color)}}function fe(){return{boxShadow:"none"}}function de(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 he(){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 ge(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function pe(){return{...he(),...ge(),...fe(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"none",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function me(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function ve(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function ye(){return{...me(),color:"#000000",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function be(){return{...ve(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function Se(){return{...be(),...ye(),textStrokeWidth:0,textStrokeColor:"none"}}function T(t){return F({...t,color:h(t.color)?void 0:y(t.color),backgroundColor:h(t.backgroundColor)?void 0:y(t.backgroundColor),borderColor:h(t.borderColor)?void 0:y(t.borderColor),outlineColor:h(t.outlineColor)?void 0:y(t.outlineColor),shadowColor:h(t.shadowColor)?void 0:y(t.shadowColor),textStrokeColor:h(t.textStrokeColor)?void 0:y(t.textStrokeColor)})}function He(){return{...pe(),...Se()}}const vt=/\r\n|\n\r|\n|\r/,Be=new RegExp(`${vt.source}|<br\\/>`,"g"),Ue=new RegExp(`^(${vt.source})$`),yt=`
|
|
2
|
-
`;function Ke(t){return vt.test(t)}function bt(t){return Ue.test(t)}function _e(t){return t.replace(Be,yt)}function Q(t){const e=[];function
|
|
1
|
+
(function(o,I){typeof exports=="object"&&typeof module<"u"?I(exports):typeof define=="function"&&define.amd?define(["exports"],I):(o=typeof globalThis<"u"?globalThis:o||self,I(o.modernIdoc={}))})(this,(function(o){"use strict";function I(t){return typeof t=="string"?{src:t}:t}var Oe={grad:.9,turn:360,rad:360/(2*Math.PI)},D=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},v=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n+0},P=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t>e?t:e},wt=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},Pt=function(t){return{r:P(t.r,0,255),g:P(t.g,0,255),b:P(t.b,0,255),a:P(t.a)}},nt=function(t){return{r:v(t.r),g:v(t.g),b:v(t.b),a:v(t.a,3)}},Le=/^#([0-9a-f]{3,8})$/i,q=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},Ft=function(t){var e=t.r,n=t.g,r=t.b,i=t.a,a=Math.max(e,n,r),s=a-Math.min(e,n,r),u=s?a===e?(n-r)/s:a===n?2+(r-e)/s:4+(e-n)/s:0;return{h:60*(u<0?u+6:u),s:a?s/a*100:0,v:a/255*100,a:i}},Ot=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),s=r*(1-n),u=r*(1-(e-a)*n),f=r*(1-(1-e+a)*n),g=a%6;return{r:255*[r,u,s,s,f,r][g],g:255*[f,r,r,u,s,s][g],b:255*[s,s,f,r,r,u][g],a:i}},Lt=function(t){return{h:wt(t.h),s:P(t.s,0,100),l:P(t.l,0,100),a:P(t.a)}},zt=function(t){return{h:v(t.h),s:v(t.s),l:v(t.l),a:v(t.a,3)}},Et=function(t){return Ot((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},V=function(t){return{h:(e=Ft(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},ze=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ee=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,De=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ae=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Dt={string:[[function(t){var e=Le.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?v(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?v(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=De.exec(t)||Ae.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:Pt({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=ze.exec(t)||Ee.exec(t);if(!e)return null;var n,r,i=Lt({h:(n=e[1],r=e[2],r===void 0&&(r="deg"),Number(n)*(Oe[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return Et(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 D(e)&&D(n)&&D(r)?Pt({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(!D(e)||!D(n)||!D(r))return null;var s=Lt({h:Number(e),s:Number(n),l:Number(r),a:Number(a)});return Et(s)},"hsl"],[function(t){var e=t.h,n=t.s,r=t.v,i=t.a,a=i===void 0?1:i;if(!D(e)||!D(n)||!D(r))return null;var s=(function(u){return{h:wt(u.h),s:P(u.s,0,100),v:P(u.v,0,100),a:P(u.a)}})({h:Number(e),s:Number(n),v:Number(r),a:Number(a)});return Ot(s)},"hsv"]]},At=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]},Ne=function(t){return typeof t=="string"?At(t.trim(),Dt.string):typeof t=="object"&&t!==null?At(t,Dt.object):[null,void 0]},rt=function(t,e){var n=V(t);return{h:n.h,s:P(n.s+100*e,0,100),l:n.l,a:n.a}},it=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},Nt=function(t,e){var n=V(t);return{h:n.h,s:n.s,l:P(n.l+100*e,0,100),a:n.a}},Rt=(function(){function t(e){this.parsed=Ne(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 v(it(this.rgba),2)},t.prototype.isDark=function(){return it(this.rgba)<.5},t.prototype.isLight=function(){return it(this.rgba)>=.5},t.prototype.toHex=function(){return e=nt(this.rgba),n=e.r,r=e.g,i=e.b,s=(a=e.a)<1?q(v(255*a)):"","#"+q(n)+q(r)+q(i)+s;var e,n,r,i,a,s},t.prototype.toRgb=function(){return nt(this.rgba)},t.prototype.toRgbString=function(){return e=nt(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 zt(V(this.rgba))},t.prototype.toHslString=function(){return e=zt(V(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=Ft(this.rgba),{h:v(e.h),s:v(e.s),v:v(e.v),a:v(e.a,3)};var e},t.prototype.invert=function(){return E({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),E(rt(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),E(rt(this.rgba,-e))},t.prototype.grayscale=function(){return E(rt(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),E(Nt(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),E(Nt(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"?E({r:(n=this.rgba).r,g:n.g,b:n.b,a:e}):v(this.rgba.a,3);var n},t.prototype.hue=function(e){var n=V(this.rgba);return typeof e=="number"?E({h:e,s:n.s,l:n.l,a:n.a}):v(n.h)},t.prototype.isEqual=function(e){return this.toHex()===E(e).toHex()},t})(),E=function(t){return t instanceof Rt?t:new Rt(t)};class Re{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 s=0,u=i.length;s<u;s++){const f=i[s];(f.value!==n||typeof r=="object"&&r?.once&&(typeof f.options=="boolean"||!f.options?.once))&&a.push(f)}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 s=r[a];typeof s.options=="object"&&s.options?.once&&this.off(e,s.value,s.options),s.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 h(t){return t==null||t===""||t==="none"}function N(t,e=0,n=10**e){return Math.round(n*t)/n+0}function F(t,e=!1){if(typeof t!="object"||!t)return t;if(Array.isArray(t))return e?t.map(r=>F(r,e)):t;const n={};for(const r in t){const i=t[r];i!=null&&(e?n[r]=F(i,e):n[r]=i)}return n}function A(t,e){const n={};return e.forEach(r=>{r in t&&(n[r]=t[r])}),n}function J(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){const n=Array.from(new Set([...Object.keys(t),...Object.keys(e)]));return!n.length||n.every(r=>t[r]===e[r])}return!1}function jt(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 Gt(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 It(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(/^\./,""),jt(t,e.split("."),n))}function Tt(t,e,n){if(!(typeof t!="object"||!e))return e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),Gt(t,e.split("."),n)}class Mt{_eventListeners=new Map;on(e,n){let r=this._eventListeners.get(e);return r===void 0&&this._eventListeners.set(e,r=new Set),r.add(n),this}once(e,n){const r=(...i)=>{this.off(e,r),n(...i)};return this.on(e,r),this}off(e,n){const r=this._eventListeners.get(e);return r!==void 0&&(r.delete(n),r.size===0&&this._eventListeners.delete(e)),this}emit(e,...n){const r=this._eventListeners.get(e);if(r)for(const i of r)i(...n);return this}removeAllListeners(){return this._eventListeners.clear(),this}hasEventListener(e){return this._eventListeners.has(e)}destroy(){this.removeAllListeners()}}class je{_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}}const ot=Symbol("properties"),X=Symbol("inited");function k(t){let e;if(Object.hasOwn(t,ot))e=t[ot];else{const n=Object.getPrototypeOf(t);e=new Map(n?k(n):void 0),t[ot]=e}return e}function at(t,e,n,r){const{alias:i,internalKey:a}=r,s=t[e];i?Tt(t,i,n):t[a]=n,t.onUpdateProperty?.(e,n??$(t,e,r),s)}function st(t,e,n){const{alias:r,internalKey:i}=n;let a;return r?a=It(t,r):a=t[i],a=a??$(t,e,n),a}function $(t,e,n){const{default:r,fallback:i}=n;let a;if(r!==void 0&&!t[X]?.[e]){t[X]||(t[X]={}),t[X][e]=!0;const s=typeof r=="function"?r():r;s!==void 0&&(t[e]=s,a=s)}return a===void 0&&i!==void 0&&(a=typeof i=="function"?i():i),a}function lt(t,e){function n(){return typeof this.getProperty<"u"?this.getProperty(t):st(this,t,e)}function r(i){typeof this.setProperty<"u"?this.setProperty(t,i):at(this,t,i,e)}return{get:n,set:r}}function Vt(t,e,n={}){const r={...n,internalKey:Symbol(e)};k(t).set(e,r);const i=lt(e,r);Object.defineProperty(t.prototype,e,{get(){return i.get.call(this)},set(a){i.set.call(this,a)},configurable:!0,enumerable:!0})}function Ge(t){return function(e,n){if(typeof n!="string")throw new TypeError("Failed to @property decorator, prop name cannot be a symbol");Vt(e.constructor,n,t)}}function Ie(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={...t,internalKey:Symbol(r)},a=lt(r,i);return{init(s){return k(this.constructor).set(r,i),a.set.call(this,s),s},get(){return a.get.call(this)},set(s){a.set.call(this,s)}}}}class Te extends Mt{_propertyAccessor;_properties=new Map;_updatedProperties=new Map;_changedProperties=new Set;_updatingPromise=Promise.resolve();_updating=!1;constructor(e){super(),this.setProperties(e)}isDirty(e){return e?this._updatedProperties.has(e):this._updatedProperties.size>0}getProperty(e){const n=this.getPropertyDeclaration(e);if(n){if(n.internal||n.alias)return st(this,e,n);{let r;return this._propertyAccessor?.getProperty?r=this._propertyAccessor.getProperty(e):r=this._properties.get(e),r??$(this,e,n)}}}setProperty(e,n){const r=this.getPropertyDeclaration(e);if(r)if(r.internal||r.alias)at(this,e,n,r);else{const i=this.getProperty(e);this._propertyAccessor?.setProperty?.(e,n),this._properties.set(e,n),this.onUpdateProperty?.(e,n??$(this,e,r),i)}}getProperties(e){const n={};for(const[r,i]of this.getPropertyDeclarations())!i.internal&&!i.alias&&(!e||e.includes(r))&&(n[r]=this.getProperty(r));return n}setProperties(e){if(e&&typeof e=="object")for(const n in e)this.setProperty(n,e[n]);return this}resetProperties(){for(const[e,n]of this.getPropertyDeclarations())this.setProperty(e,typeof n.default=="function"?n.default():n.default);return this}getPropertyDeclarations(){return k(this.constructor)}getPropertyDeclaration(e){return this.getPropertyDeclarations().get(e)}setPropertyAccessor(e){const n=this.getPropertyDeclarations();this._propertyAccessor=void 0;const r={};return n.forEach((i,a)=>{r[a]=this.getProperty(a)}),this._propertyAccessor=e,n.forEach((i,a)=>{const s=this.getProperty(a),u=r[a];s!==void 0&&!Object.is(s,u)&&(this.setProperty(a,s),!i.internal&&!i.alias&&this.requestUpdate(a,s,u))}),this}async _nextTick(){return"requestAnimationFrame"in globalThis?new Promise(e=>globalThis.requestAnimationFrame(e)):Promise.resolve()}async _enqueueUpdate(){this._updating=!0;try{await this._updatingPromise}catch(e){Promise.reject(e)}await this._nextTick(),this._updating&&(this.onUpdate(),this._updating=!1)}onUpdate(){this._update(this._updatedProperties),this._updatedProperties=new Map}onUpdateProperty(e,n,r){Object.is(n,r)||this.requestUpdate(e,n,r)}requestUpdate(e,n,r){e!==void 0&&(this._updatedProperties.set(e,r),this._changedProperties.add(e),this._updateProperty(e,n,r),this.emit("updateProperty",e,n,r)),this._updating||(this._updatingPromise=this._enqueueUpdate())}_update(e){}_updateProperty(e,n,r){}toJSON(){const e={};return this._properties.forEach((n,r)=>{n!==void 0&&(n&&typeof n=="object"?"toJSON"in n&&typeof n.toJSON=="function"?e[r]=n.toJSON():Array.isArray(n)?e[r]=[...n]:e[r]={...n}:e[r]=n)}),e}clone(){return new this.constructor(this.toJSON())}destroy(){this.emit("destroy"),super.destroy()}}function ut(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,E(e)}function Me(t){return{r:N(t.r),g:N(t.g),b:N(t.b),a:N(t.a,3)}}function Y(t){const e=t.toString(16);return e.length<2?`0${e}`:e}const W="#000000FF";function ct(t){return ut(t).isValid()}function y(t,e=!1){const n=ut(t);if(!n.isValid()){if(typeof t=="string")return t;const u=`Failed to normalizeColor ${t}`;if(e)throw new Error(u);return console.warn(u),W}const{r,g:i,b:a,a:s}=Me(n.rgba);return`#${Y(r)}${Y(i)}${Y(a)}${Y(N(s*255))}`}var x=x||{};x.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(l){const c=new Error(`${e}: ${l}`);throw c.source=e,c}function r(){const l=i();return e.length>0&&n("Invalid input not EOF"),l}function i(){return M(a)}function a(){return s("linear-gradient",t.linearGradient,f)||s("repeating-linear-gradient",t.repeatingLinearGradient,f)||s("radial-gradient",t.radialGradient,p)||s("repeating-radial-gradient",t.repeatingRadialGradient,p)}function s(l,c,d){return u(c,S=>{const G=d();return G&&(m(t.comma)||n("Missing comma before color stops")),{type:l,orientation:G,colorStops:M(_t)}})}function u(l,c){const d=m(l);if(d){m(t.startCall)||n("Missing (");const S=c(d);return m(t.endCall)||n("Missing )"),S}}function f(){const l=g();if(l)return l;const c=w("position-keyword",t.positionKeywords,1);return c?{type:"directional",value:c.value}:b()}function g(){return w("directional",t.sideOrCorner,1)}function b(){return w("angular",t.angleValue,1)||w("angular",t.radianValue,1)}function p(){let l,c=_(),d;return c&&(l=[],l.push(c),d=e,m(t.comma)&&(c=_(),c?l.push(c):e=d)),l}function _(){let l=C()||R();if(l)l.at=z();else{const c=O();if(c){l=c;const d=z();d&&(l.at=d)}else{const d=z();if(d)l={type:"default-radial",at:d};else{const S=j();S&&(l={type:"default-radial",at:S})}}}return l}function C(){const l=w("shape",/^(circle)/i,0);return l&&(l.style=Fe()||O()),l}function R(){const l=w("shape",/^(ellipse)/i,0);return l&&(l.style=j()||et()||O()),l}function O(){return w("extent-keyword",t.extentKeywords,1)}function z(){if(w("position",/^at/,0)){const l=j();return l||n("Missing positioning value"),l}}function j(){const l=U();if(l.x||l.y)return{type:"position",value:l}}function U(){return{x:et(),y:et()}}function M(l){let c=l();const d=[];if(c)for(d.push(c);m(t.comma);)c=l(),c?d.push(c):n("One extra comma");return d}function _t(){const l=xe();return l||n("Expected color definition"),l.length=et(),l}function xe(){return Qe()||on()||rn()||en()||tn()||nn()||Ze()}function Ze(){return w("literal",t.literalColor,0)}function Qe(){return w("hex",t.hexColor,1)}function tn(){return u(t.rgbColor,()=>({type:"rgb",value:M(K)}))}function en(){return u(t.rgbaColor,()=>({type:"rgba",value:M(K)}))}function nn(){return u(t.varColor,()=>({type:"var",value:an()}))}function rn(){return u(t.hslColor,()=>{m(t.percentageValue)&&n("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const c=K();m(t.comma);let d=m(t.percentageValue);const S=d?d[1]:null;m(t.comma),d=m(t.percentageValue);const G=d?d[1]:null;return(!S||!G)&&n("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[c,S,G]}})}function on(){return u(t.hslaColor,()=>{const l=K();m(t.comma);let c=m(t.percentageValue);const d=c?c[1]:null;m(t.comma),c=m(t.percentageValue);const S=c?c[1]:null;m(t.comma);const G=K();return(!d||!S)&&n("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[l,d,S,G]}})}function an(){return m(t.variableName)[1]}function K(){return m(t.number)[1]}function et(){return w("%",t.percentageValue,1)||sn()||ln()||Fe()}function sn(){return w("position-keyword",t.positionKeywords,1)}function ln(){return u(t.calcValue,()=>{let l=1,c=0;for(;l>0&&c<e.length;){const S=e.charAt(c);S==="("?l++:S===")"&&l--,c++}l>0&&n("Missing closing parenthesis in calc() expression");const d=e.substring(0,c-1);return Ct(c-1),{type:"calc",value:d}})}function Fe(){return w("px",t.pixelValue,1)||w("em",t.emValue,1)}function w(l,c,d){const S=m(c);if(S)return{type:l,value:S[d]}}function m(l){let c,d;return d=/^\s+/.exec(e),d&&Ct(d[0].length),c=l.exec(e),c&&Ct(c[0].length),c}function Ct(l){e=e.substr(l)}return function(l){return e=l.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),r()}})();const kt=x.parse.bind(x);var Z=Z||{};Z.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 Ve=Z.stringify.bind(Z);function $t(t){const e=t.length-1;return t.map((n,r)=>{const i=n.value;let a=N(r/e,3),s="#00000000";switch(n.type){case"rgb":s=y({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0)});break;case"rgba":s=y({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0),a:Number(i[3]??0)});break;case"literal":s=y(n.value);break;case"hex":s=y(`#${n.value}`);break}return n.length?.type==="%"&&(a=Number(n.length.value)/100),{offset:a,color:s}})}function Wt(t){let e=0;return t.orientation?.type==="angular"&&(e=Number(t.orientation.value)),{type:"linear-gradient",angle:e,stops:$t(t.colorStops)}}function Ht(t){return t.orientation?.map(e=>{switch(e?.type){default:return null}}),{type:"radial-gradient",stops:$t(t.colorStops)}}function H(t){return t.startsWith("linear-gradient(")||t.startsWith("radial-gradient(")}function Bt(t){return kt(t).map(e=>{switch(e?.type){case"linear-gradient":return Wt(e);case"repeating-linear-gradient":return{...Wt(e),repeat:!0};case"radial-gradient":return Ht(e);case"repeating-radial-gradient":return{...Ht(e),repeat:!0};default:return}}).filter(Boolean)}const ft=["color"];function Ut(t){let e;return typeof t=="string"?e={color:t}:e={...t},e.color&&(e.color=y(e.color)),A(e,ft)}const dt=["linearGradient","radialGradient","rotateWithShape"];function Kt(t){let e;if(typeof t=="string"?e={image:t}:e={...t},e.image){const{type:n,...r}=Bt(e.image)[0]??{};switch(n){case"radial-gradient":return{radialGradient:r};case"linear-gradient":return{linearGradient:r}}}return A(e,dt)}const ht=["image","cropRect","stretchRect","tile","dpi","opacity","rotateWithShape"];function qt(t){let e;return typeof t=="string"?e={image:t}:e={...t},A(e,ht)}const gt=["preset","foregroundColor","backgroundColor"];function Jt(t){let e;return typeof t=="string"?e={preset:t}:e={...t},h(e.foregroundColor)?delete e.foregroundColor:e.foregroundColor=y(e.foregroundColor),h(e.backgroundColor)?delete e.backgroundColor:e.backgroundColor=y(e.backgroundColor),A(e,gt)}function Xt(t){return!h(t.color)}function Yt(t){return typeof t=="string"?ct(t):Xt(t)}function xt(t){return!h(t.image)&&H(t.image)||!!t.linearGradient||!!t.radialGradient}function Zt(t){return typeof t=="string"?H(t):xt(t)}function Qt(t){return!h(t.image)&&!H(t.image)}function te(t){return typeof t=="string"?!ct(t)&&!H(t):Qt(t)}function ee(t){return!h(t.preset)}function ne(t){return typeof t=="string"?!1:ee(t)}function L(t){const n={enabled:t&&typeof t=="object"?t.enabled:void 0};return Yt(t)&&Object.assign(n,Ut(t)),Zt(t)&&Object.assign(n,Kt(t)),te(t)&&Object.assign(n,qt(t)),ne(t)&&Object.assign(n,Jt(t)),A(F(n),Array.from(new Set([...ft,...ht,...dt,...gt])))}function re(t){return typeof t=="string"?{...L(t)}:{...L(t),...A(t,["fillWithShape"])}}function pt(){return{color:W,offsetX:0,offsetY:0,blurRadius:1}}function mt(t){return{...pt(),...F({...t,color:h(t.color)?W:y(t.color)})}}function ie(){return{...pt(),scaleX:1,scaleY:1}}function oe(t){return{...ie(),...mt(t)}}function ke(t){return t}function ae(t){return F({...t,softEdge:h(t.softEdge)?void 0:t.softEdge,outerShadow:h(t.outerShadow)?void 0:oe(t.outerShadow),innerShadow:h(t.innerShadow)?void 0:mt(t.innerShadow)})}function se(t){return typeof t=="string"?{...L(t)}:{...L(t),...A(t,["fillWithShape"])}}const $e="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let We=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=$e[n[t]&63];return e};const le=()=>We(10),ue=le;function B(t){return typeof t=="string"?{...L(t)}:{...L(t),...A(t,["width","style","lineCap","lineJoin","headEnd","tailEnd"])}}function ce(t){return typeof t=="string"?{color:y(t)}:{...t,color:h(t.color)?W:y(t.color)}}function fe(){return{boxShadow:"none"}}function de(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 he(){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 ge(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:"none",transformOrigin:"center"}}function pe(){return{...he(),...ge(),...fe(),backgroundImage:"none",backgroundSize:"auto, auto",backgroundColor:"none",backgroundColormap:"none",borderRadius:0,borderColor:"none",borderStyle:"solid",outlineWidth:0,outlineOffset:0,outlineColor:"none",outlineStyle:"none",visibility:"visible",filter:"none",opacity:1,pointerEvents:"auto",maskImage:"none"}}function me(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function ve(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function ye(){return{...me(),color:"#000000",verticalAlign:"baseline",letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:"normal",fontFamily:"",fontStyle:"normal",fontKerning:"normal",textTransform:"none",textOrientation:"mixed",textDecoration:"none"}}function be(){return{...ve(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function Se(){return{...be(),...ye(),textStrokeWidth:0,textStrokeColor:"none"}}function T(t){return F({...t,color:h(t.color)?void 0:y(t.color),backgroundColor:h(t.backgroundColor)?void 0:y(t.backgroundColor),borderColor:h(t.borderColor)?void 0:y(t.borderColor),outlineColor:h(t.outlineColor)?void 0:y(t.outlineColor),shadowColor:h(t.shadowColor)?void 0:y(t.shadowColor),textStrokeColor:h(t.textStrokeColor)?void 0:y(t.textStrokeColor)})}function He(){return{...pe(),...Se()}}const vt=/\r\n|\n\r|\n|\r/,Be=new RegExp(`${vt.source}|<br\\/>`,"g"),Ue=new RegExp(`^(${vt.source})$`),yt=`
|
|
2
|
+
`;function Ke(t){return vt.test(t)}function bt(t){return Ue.test(t)}function _e(t){return t.replace(Be,yt)}function Q(t){const e=[];function n(){return e[e.length-1]}function r(u,f,g){const b=u?T(u):{},p=f?L(f):void 0,_=g?B(g):void 0,C=F({...b,fill:p,outline:_,fragments:[]});return e[e.length-1]?.fragments.length===0?e[e.length-1]=C:e.push(C),C}function i(u="",f,g,b){const p=f?T(f):{},_=g?L(g):void 0,C=b?B(b):void 0;Array.from(u).forEach(R=>{if(bt(R)){const{fragments:O,fill:z,outline:j,...U}=n()||r();O.length||O.push(F({...p,fill:_,outline:C,content:yt})),r(U,z,j)}else{const O=n()||r(),z=O.fragments[O.fragments.length-1];if(z){const{content:j,fill:U,outline:M,..._t}=z;if(J(_,U)&&J(C,M)&&J(p,_t)){z.content=`${j}${R}`;return}}O.fragments.push(F({...p,fill:_,outline:C,content:R}))}})}(Array.isArray(t)?t:[t]).forEach(u=>{if(typeof u=="string")r(),i(u);else if(St(u)){const{content:f,fill:g,outline:b,...p}=u;r(p,g,b),i(f)}else if(Ce(u)){const{fragments:f,fill:g,outline:b,...p}=u;r(p,g,b),f.forEach(_=>{const{content:C,fill:R,outline:O,...z}=_;i(C,z,R,O)})}else Array.isArray(u)?(r(),u.forEach(f=>{if(typeof f=="string")i(f);else if(St(f)){const{content:g,fill:b,outline:p,..._}=f;i(g,_,b,p)}})):console.warn("Failed to parse text content",u)});const s=n();return s&&!s.fragments.length&&s.fragments.push({content:""}),e}function Ce(t){return t&&typeof t=="object"&&"fragments"in t&&Array.isArray(t.fragments)}function St(t){return t&&typeof t=="object"&&"content"in t&&typeof t.content=="string"}function we(t){return typeof t=="string"||Array.isArray(t)?{content:Q(t)}:F({...t,content:Q(t.content??""),style:t.style?T(t.style):void 0,effects:t.effects?t.effects.map(e=>T(e)):void 0,measureDom:t.measureDom,fonts:t.fonts,fill:t.fill?L(t.fill):void 0,outline:t.outline?B(t.outline):void 0})}function qe(t){return Q(t).map(e=>{const n=_e(e.fragments.flatMap(r=>r.content).join(""));return bt(n)?"":n}).join(yt)}function Pe(t){return typeof t=="string"?{src:t}:t}function tt(t){return F({...t,id:t.id??ue(),style:h(t.style)?void 0:T(t.style),text:h(t.text)?void 0:we(t.text),background:h(t.background)?void 0:re(t.background),shape:h(t.shape)?void 0:de(t.shape),fill:h(t.fill)?void 0:L(t.fill),outline:h(t.outline)?void 0:B(t.outline),foreground:h(t.foreground)?void 0:se(t.foreground),shadow:h(t.shadow)?void 0:ce(t.shadow),video:h(t.video)?void 0:Pe(t.video),audio:h(t.audio)?void 0:I(t.audio),effect:h(t.effect)?void 0:ae(t.effect),children:t.children?.map(e=>tt(e))})}function Je(t){return tt(t)}function Xe(t){const e={};for(const n in t.children){const r=tt(t.children[n]);delete r.children,e[n]=r}return{...t,children:e}}function Ye(t){const{children:e,...n}=t;function r(f){const{parentId:g,childrenIds:b,...p}=f;return{...p,children:[]}}const i={},a=[],s={...n,children:a};function u(f){if(!e[f]||i[f])return;const g=e[f],b=r(g);i[f]=b;const p=g.parentId;if(p){u(p);const _=e[p],C=i[p];if(!C)return;_?.childrenIds&&C?.children&&(C.children[_.childrenIds.indexOf(f)]=b)}else a.push(b)}for(const f in e)u(f);return s}o.EventEmitter=Re,o.Observable=Mt,o.RawWeakMap=je,o.Reactivable=Te,o.clearUndef=F,o.colorFillFields=ft,o.defaultColor=W,o.defineProperty=Vt,o.flatDocumentToDocument=Ye,o.getDeclarations=k,o.getDefaultElementStyle=pe,o.getDefaultHighlightStyle=me,o.getDefaultInnerShadow=pt,o.getDefaultLayoutStyle=he,o.getDefaultListStyleStyle=ve,o.getDefaultOuterShadow=ie,o.getDefaultShadowStyle=fe,o.getDefaultStyle=He,o.getDefaultTextInlineStyle=ye,o.getDefaultTextLineStyle=be,o.getDefaultTextStyle=Se,o.getDefaultTransformStyle=ge,o.getNestedValue=jt,o.getObjectValueByPath=It,o.getPropertyDescriptor=lt,o.gradientFillFields=dt,o.hasCRLF=Ke,o.idGenerator=ue,o.imageFillFiedls=ht,o.isCRLF=bt,o.isColor=ct,o.isColorFill=Yt,o.isColorFillObject=Xt,o.isEqualObject=J,o.isFragmentObject=St,o.isGradient=H,o.isGradientFill=Zt,o.isGradientFillObject=xt,o.isImageFill=te,o.isImageFillObject=Qt,o.isNone=h,o.isParagraphObject=Ce,o.isPresetFill=ne,o.isPresetFillObject=ee,o.nanoid=le,o.normalizeAudio=I,o.normalizeBackground=re,o.normalizeCRLF=_e,o.normalizeColor=y,o.normalizeColorFill=Ut,o.normalizeDocument=Je,o.normalizeEffect=ae,o.normalizeElement=tt,o.normalizeFill=L,o.normalizeFlatDocument=Xe,o.normalizeForeground=se,o.normalizeGradient=Bt,o.normalizeGradientFill=Kt,o.normalizeImageFill=qt,o.normalizeInnerShadow=mt,o.normalizeOuterShadow=oe,o.normalizeOutline=B,o.normalizePresetFill=Jt,o.normalizeShadow=ce,o.normalizeShape=de,o.normalizeSoftEdge=ke,o.normalizeStyle=T,o.normalizeText=we,o.normalizeTextContent=Q,o.normalizeVideo=Pe,o.parseColor=ut,o.parseGradient=kt,o.pick=A,o.presetFillFiedls=gt,o.property=Ge,o.property2=Ie,o.propertyOffsetFallback=$,o.propertyOffsetGet=st,o.propertyOffsetSet=at,o.round=N,o.setNestedValue=Gt,o.setObjectValueByPath=Tt,o.stringifyGradient=Ve,o.textContentToString=qe,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.mjs
CHANGED
|
@@ -186,13 +186,13 @@ function setObjectValueByPath(obj, path, value) {
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
class Observable {
|
|
189
|
-
|
|
189
|
+
_eventListeners = /* @__PURE__ */ new Map();
|
|
190
190
|
on(event, listener) {
|
|
191
|
-
let
|
|
192
|
-
if (
|
|
193
|
-
this.
|
|
191
|
+
let listeners = this._eventListeners.get(event);
|
|
192
|
+
if (listeners === void 0) {
|
|
193
|
+
this._eventListeners.set(event, listeners = /* @__PURE__ */ new Set());
|
|
194
194
|
}
|
|
195
|
-
|
|
195
|
+
listeners.add(listener);
|
|
196
196
|
return this;
|
|
197
197
|
}
|
|
198
198
|
once(event, listener) {
|
|
@@ -204,21 +204,33 @@ class Observable {
|
|
|
204
204
|
return this;
|
|
205
205
|
}
|
|
206
206
|
off(event, listener) {
|
|
207
|
-
const
|
|
208
|
-
if (
|
|
209
|
-
|
|
210
|
-
if (
|
|
211
|
-
this.
|
|
207
|
+
const listeners = this._eventListeners.get(event);
|
|
208
|
+
if (listeners !== void 0) {
|
|
209
|
+
listeners.delete(listener);
|
|
210
|
+
if (listeners.size === 0) {
|
|
211
|
+
this._eventListeners.delete(event);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
return this;
|
|
215
215
|
}
|
|
216
216
|
emit(event, ...args) {
|
|
217
|
-
|
|
217
|
+
const listeners = this._eventListeners.get(event);
|
|
218
|
+
if (listeners) {
|
|
219
|
+
for (const listener of listeners) {
|
|
220
|
+
listener(...args);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return this;
|
|
224
|
+
}
|
|
225
|
+
removeAllListeners() {
|
|
226
|
+
this._eventListeners.clear();
|
|
218
227
|
return this;
|
|
219
228
|
}
|
|
229
|
+
hasEventListener(event) {
|
|
230
|
+
return this._eventListeners.has(event);
|
|
231
|
+
}
|
|
220
232
|
destroy() {
|
|
221
|
-
this.
|
|
233
|
+
this.removeAllListeners();
|
|
222
234
|
}
|
|
223
235
|
}
|
|
224
236
|
|