modern-idoc 0.10.21 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -224,6 +224,15 @@ interface NormalizedColorFill {
224
224
  declare const colorFillFields: (keyof NormalizedColorFill)[];
225
225
  declare function normalizeColorFill(fill: ColorFill): NormalizedColorFill;
226
226
 
227
+ type None = undefined | null | 'none';
228
+ type WithNone<T> = T | None;
229
+ type WithStyleNone<T> = T | 'none';
230
+ type LineCap = 'butt' | 'round' | 'square';
231
+ type LineJoin = 'miter' | 'round' | 'bevel';
232
+ interface Toggleable {
233
+ enabled: boolean;
234
+ }
235
+
227
236
  type GradientFillObject = {
228
237
  image?: string;
229
238
  } & Partial<NormalizedGradientFill>;
@@ -281,12 +290,6 @@ interface NormalizedImageFill extends ImageFillObject {
281
290
  declare const imageFillFiedls: (keyof NormalizedImageFill)[];
282
291
  declare function normalizeImageFill(fill: ImageFill): NormalizedImageFill;
283
292
 
284
- type None = undefined | null | 'none';
285
- type WithNone<T> = T | None;
286
- type WithStyleNone<T> = T | 'none';
287
- type LineCap = 'butt' | 'round' | 'square';
288
- type LineJoin = 'miter' | 'round' | 'bevel';
289
-
290
293
  interface PresetFillObject {
291
294
  preset: string;
292
295
  foregroundColor?: WithNone<Color>;
@@ -300,13 +303,9 @@ interface NormalizedPresetFill extends PresetFillObject {
300
303
  declare const presetFillFiedls: (keyof NormalizedPresetFill)[];
301
304
  declare function normalizePresetFill(fill: PresetFill): NormalizedPresetFill;
302
305
 
303
- type FillObject = {
304
- enabled?: boolean;
305
- } & Partial<ColorFillObject> & Partial<GradientFillObject> & Partial<ImageFillObject> & Partial<PresetFillObject>;
306
+ type FillObject = Partial<Toggleable> & Partial<ColorFillObject> & Partial<GradientFillObject> & Partial<ImageFillObject> & Partial<PresetFillObject>;
306
307
  type Fill = string | FillObject;
307
- type NormalizedFill = {
308
- enabled?: boolean;
309
- } & Partial<NormalizedColorFill> & Partial<NormalizedGradientFill> & Partial<NormalizedImageFill> & Partial<NormalizedPresetFill>;
308
+ type NormalizedFill = Toggleable & Partial<NormalizedColorFill> & Partial<NormalizedGradientFill> & Partial<NormalizedImageFill> & Partial<NormalizedPresetFill>;
310
309
  declare function isColorFillObject(fill: FillObject): fill is ColorFillObject;
311
310
  declare function isColorFill(fill: Fill): fill is ColorFill;
312
311
  declare function isGradientFillObject(fill: FillObject): fill is GradientFillObject;
@@ -323,8 +322,18 @@ interface NormalizedBaseBackground {
323
322
  type NormalizedBackground = NormalizedFill & NormalizedBaseBackground;
324
323
  type BackgroundObject = FillObject & Partial<NormalizedBaseBackground>;
325
324
  type Background = string | BackgroundObject;
325
+
326
326
  declare function normalizeBackground(background: Background): NormalizedBackground;
327
327
 
328
+ type BackgroundSize = 'contain' | 'cover' | string | 'stretch' | 'rigid';
329
+ interface NormalizedBackgroundStyle {
330
+ backgroundImage: WithStyleNone<string>;
331
+ backgroundSize: BackgroundSize;
332
+ backgroundColor: WithStyleNone<NormalizedColor>;
333
+ backgroundColormap: WithStyleNone<Record<string, string>>;
334
+ }
335
+ declare function getDefaultBackgroundStyle(): NormalizedBackgroundStyle;
336
+
328
337
  interface PropertyDeclaration {
329
338
  [key: string]: unknown;
330
339
  default?: unknown | (() => unknown);
@@ -350,82 +359,19 @@ declare function defineProperty<V, T extends PropertyAccessor>(constructor: any,
350
359
  declare function property<V, T extends PropertyAccessor>(declaration?: Partial<PropertyDeclaration>): PropertyDecorator;
351
360
  declare function property2<V, T extends PropertyAccessor>(declaration?: Partial<PropertyDeclaration>): (_: ClassAccessorDecoratorTarget<T, V>, context: ClassAccessorDecoratorContext) => ClassAccessorDecoratorResult<T, V>;
352
361
 
353
- interface NormalizedInnerShadow {
354
- color: NormalizedColor;
355
- offsetX: number;
356
- offsetY: number;
357
- blurRadius: number;
358
- }
359
- type InnerShadowObject = Partial<NormalizedInnerShadow> & {
360
- color?: WithNone<Color>;
361
- };
362
- type InnerShadow = InnerShadowObject;
363
- declare function getDefaultInnerShadow(): NormalizedInnerShadow;
364
- declare function normalizeInnerShadow(shadow: InnerShadow): NormalizedInnerShadow;
365
-
366
- interface NormalizedBaseOuterShadow {
367
- scaleX: number;
368
- scaleY: number;
369
- }
370
- type NormalizedOuterShadow = NormalizedBaseOuterShadow & NormalizedInnerShadow;
371
- type OuterShadowObject = Partial<NormalizedBaseOuterShadow> & InnerShadowObject;
372
- type OuterShadow = OuterShadowObject;
373
- declare function getDefaultOuterShadow(): NormalizedOuterShadow;
374
- declare function normalizeOuterShadow(shadow: OuterShadow): NormalizedOuterShadow;
375
-
376
- interface NormalizedSoftEdge {
377
- radius: number;
378
- }
379
- type SoftEdge = NormalizedSoftEdge;
380
- declare function normalizeSoftEdge(softEdge: SoftEdge): NormalizedSoftEdge;
381
-
382
- interface NormalizedEffect {
383
- innerShadow?: NormalizedInnerShadow;
384
- outerShadow?: NormalizedOuterShadow;
385
- softEdge?: NormalizedSoftEdge;
386
- }
387
- interface EffectObject {
388
- innerShadow?: WithNone<InnerShadow>;
389
- outerShadow?: WithNone<OuterShadow>;
390
- softEdge?: WithNone<SoftEdge>;
391
- }
392
- type Effect = EffectObject;
393
- declare function normalizeEffect(effect: Effect): NormalizedEffect;
394
-
395
- interface NormalizedBaseForeground {
396
- fillWithShape?: boolean;
397
- }
398
- type NormalizedForeground = NormalizedBaseForeground & NormalizedFill;
399
- type ForegroundObject = Partial<NormalizedBaseForeground> & FillObject;
400
- type Foreground = string | ForegroundObject;
401
- declare function normalizeForeground(foreground: Foreground): NormalizedForeground | undefined;
402
-
403
- interface Meta {
404
- [key: string]: any;
405
- }
406
-
407
- interface Node<T = Meta> {
408
- name?: string;
409
- children?: Node[];
410
- meta?: T;
411
- }
412
-
413
362
  type LineEndType = 'oval' | 'stealth' | 'triangle' | 'arrow' | 'diamond';
414
363
  type LineEndSize = 'sm' | 'md' | 'lg';
415
-
416
- interface HeadEnd {
364
+ type OutlineStyle = 'dashed' | 'solid' | string;
365
+ interface TailEnd {
417
366
  type: LineEndType;
418
367
  width?: WithNone<LineEndSize>;
419
368
  height?: WithNone<LineEndSize>;
420
369
  }
421
-
422
- interface TailEnd {
370
+ interface HeadEnd {
423
371
  type: LineEndType;
424
372
  width?: WithNone<LineEndSize>;
425
373
  height?: WithNone<LineEndSize>;
426
374
  }
427
-
428
- type OutlineStyle = 'dashed' | 'solid' | string;
429
375
  interface NormalizedBaseOutline {
430
376
  width?: number;
431
377
  style?: OutlineStyle;
@@ -434,23 +380,34 @@ interface NormalizedBaseOutline {
434
380
  headEnd?: HeadEnd;
435
381
  tailEnd?: TailEnd;
436
382
  }
437
- type NormalizedOutline = NormalizedFill & NormalizedBaseOutline;
438
383
  type OutlineObject = FillObject & Partial<NormalizedBaseOutline>;
384
+ type NormalizedOutline = NormalizedFill & NormalizedBaseOutline;
439
385
  type Outline = string | OutlineObject;
386
+
440
387
  declare function normalizeOutline(outline: Outline): NormalizedOutline;
441
388
 
389
+ interface NormalizedOutlineStyle {
390
+ outlineWidth: number;
391
+ outlineOffset: number;
392
+ outlineColor: WithStyleNone<NormalizedColor>;
393
+ outlineStyle: string;
394
+ }
395
+ declare function getDefaultOutlineStyle(): NormalizedOutlineStyle;
396
+
442
397
  type BoxShadow = string;
443
- interface NormalizedShadow {
398
+ type Shadow = BoxShadow | ShadowObject;
399
+ type ShadowObject = Partial<Toggleable> & Partial<NormalizedShadow> & {
400
+ color?: WithNone<Color>;
401
+ };
402
+ interface NormalizedShadow extends Toggleable {
444
403
  color: NormalizedColor;
445
404
  offsetX?: number;
446
405
  offsetY?: number;
447
406
  blur?: number;
448
407
  }
449
- type ShadowObject = Partial<NormalizedShadow> & {
450
- color?: WithNone<Color>;
451
- };
452
- type Shadow = BoxShadow | ShadowObject;
408
+
453
409
  declare function normalizeShadow(shadow: Shadow): NormalizedShadow;
410
+
454
411
  interface NormalizedShadowStyle {
455
412
  boxShadow: BoxShadow;
456
413
  shadowColor?: NormalizedColor;
@@ -460,6 +417,40 @@ interface NormalizedShadowStyle {
460
417
  }
461
418
  declare function getDefaultShadowStyle(): NormalizedShadowStyle;
462
419
 
420
+ interface Effect {
421
+ fill?: WithNone<Fill>;
422
+ outline?: WithNone<Outline>;
423
+ shadow?: WithNone<Shadow>;
424
+ transform?: WithStyleNone<string>;
425
+ transformOrigin?: string;
426
+ }
427
+ interface NormalizedEffect {
428
+ fill?: NormalizedFill;
429
+ outline?: NormalizedOutline;
430
+ shadow?: NormalizedShadow;
431
+ transform?: string;
432
+ transformOrigin?: string;
433
+ }
434
+
435
+ interface NormalizedBaseForeground {
436
+ fillWithShape?: boolean;
437
+ }
438
+ type NormalizedForeground = NormalizedBaseForeground & NormalizedFill;
439
+ type ForegroundObject = Partial<NormalizedBaseForeground> & FillObject;
440
+ type Foreground = string | ForegroundObject;
441
+ declare function normalizeForeground(foreground: Foreground): NormalizedForeground | undefined;
442
+
443
+ interface Meta {
444
+ [key: string]: any;
445
+ }
446
+
447
+ interface Node<T = Meta> {
448
+ name?: string;
449
+ children?: Node[];
450
+ meta?: T;
451
+ }
452
+
453
+ type Shape = SVGPathData | SVGPathData[] | ShapePath[] | NormalizedShape;
463
454
  type SVGPathData = string;
464
455
  type FillRule = 'nonzero' | 'evenodd';
465
456
  type StrokeLinecap = 'butt' | 'round' | 'square';
@@ -487,13 +478,12 @@ interface ShapePathStyle {
487
478
  interface ShapePath extends Partial<ShapePathStyle> {
488
479
  data: SVGPathData;
489
480
  }
490
- interface NormalizedShape {
481
+ interface NormalizedShape extends Toggleable {
491
482
  preset?: string;
492
483
  viewBox?: number[];
493
484
  svg?: string;
494
485
  paths?: ShapePath[];
495
486
  }
496
- type Shape = SVGPathData | SVGPathData[] | ShapePath[] | NormalizedShape;
497
487
  declare function normalizeShape(shape: Shape): NormalizedShape;
498
488
 
499
489
  type StyleUnit = `${number}%` | number;
@@ -578,31 +568,15 @@ interface NormalizedLayoutStyle {
578
568
  declare function getDefaultLayoutStyle(): Partial<NormalizedLayoutStyle>;
579
569
 
580
570
  interface NormalizedTransformStyle {
581
- rotate: number;
582
- scaleX: number;
583
- scaleY: number;
584
- skewX: number;
585
- skewY: number;
586
- translateX: number;
587
- translateY: number;
588
571
  transform: WithStyleNone<string>;
589
572
  transformOrigin: string;
590
573
  }
591
574
  declare function getDefaultTransformStyle(): NormalizedTransformStyle;
592
575
 
593
- type BackgroundSize = 'contain' | 'cover' | string | 'stretch' | 'rigid';
594
- type NormalizedElementStyle = Partial<NormalizedLayoutStyle> & NormalizedTransformStyle & NormalizedShadowStyle & {
595
- backgroundImage: WithStyleNone<string>;
596
- backgroundSize: BackgroundSize;
597
- backgroundColor: WithStyleNone<NormalizedColor>;
598
- backgroundColormap: WithStyleNone<Record<string, string>>;
576
+ type NormalizedElementStyle = Partial<NormalizedLayoutStyle> & NormalizedTransformStyle & NormalizedShadowStyle & NormalizedOutlineStyle & NormalizedBackgroundStyle & {
599
577
  borderRadius: number;
600
578
  borderColor: WithStyleNone<NormalizedColor>;
601
579
  borderStyle: BorderStyle;
602
- outlineWidth: number;
603
- outlineOffset: number;
604
- outlineColor: WithStyleNone<NormalizedColor>;
605
- outlineStyle: string;
606
580
  visibility: Visibility;
607
581
  filter: string;
608
582
  opacity: number;
@@ -692,6 +666,7 @@ type Style = StyleObject;
692
666
  declare function normalizeStyle(style: Style): NormalizedStyle;
693
667
  declare function getDefaultStyle(): FullStyle;
694
668
 
669
+ type Text = string | FlatTextContent[] | TextObject;
695
670
  interface FragmentObject extends StyleObject {
696
671
  content: string;
697
672
  fill?: Fill;
@@ -715,27 +690,20 @@ interface NormalizedParagraph extends NormalizedStyle {
715
690
  type FlatTextContent = string | FragmentObject | ParagraphObject | (string | FragmentObject)[];
716
691
  type TextContent = FlatTextContent | FlatTextContent[];
717
692
  type NormalizedTextContent = NormalizedParagraph[];
718
- interface TextObject {
693
+ interface TextObject extends Pick<Effect, 'fill' | 'outline'>, Partial<Toggleable> {
719
694
  content?: TextContent;
720
- enabled?: boolean;
721
695
  style?: Style;
722
- effects?: Style[];
723
696
  measureDom?: any;
724
697
  fonts?: any;
725
- fill?: Fill;
726
- outline?: Outline;
698
+ effects?: Effect[];
727
699
  }
728
- interface NormalizedText {
700
+ interface NormalizedText extends Pick<NormalizedEffect, 'fill' | 'outline'>, Toggleable {
729
701
  content: NormalizedTextContent;
730
- enabled?: boolean;
731
702
  style?: NormalizedStyle;
732
- effects?: NormalizedStyle[];
703
+ effects?: Effect[];
733
704
  measureDom?: any;
734
705
  fonts?: any;
735
- fill?: NormalizedFill;
736
- outline?: NormalizedOutline;
737
706
  }
738
- type Text = string | FlatTextContent[] | TextObject;
739
707
  declare function hasCRLF(content: string): boolean;
740
708
  declare function isCRLF(char: string): boolean;
741
709
  declare function normalizeCRLF(content: string): string;
@@ -751,34 +719,26 @@ interface NormalizedVideo {
751
719
  type Video = string | NormalizedVideo;
752
720
  declare function normalizeVideo(video: Video): NormalizedVideo | undefined;
753
721
 
754
- interface Element<T = Meta> extends Omit<Node<T>, 'children'> {
722
+ interface Element<T = Meta> extends Effect, Omit<Node<T>, 'children'> {
755
723
  id?: string;
756
724
  style?: WithNone<Style>;
757
725
  text?: WithNone<Text>;
758
726
  background?: WithNone<Background>;
759
727
  shape?: WithNone<Shape>;
760
- fill?: WithNone<Fill>;
761
- outline?: WithNone<Outline>;
762
728
  foreground?: WithNone<Foreground>;
763
- shadow?: WithNone<Shadow>;
764
729
  video?: WithNone<Video>;
765
730
  audio?: WithNone<Audio>;
766
- effect?: WithNone<Effect>;
767
731
  children?: Element[];
768
732
  }
769
- interface NormalizedElement<T = Meta> extends Omit<Node<T>, 'children'> {
733
+ interface NormalizedElement<T = Meta> extends NormalizedEffect, Omit<Node<T>, 'children'> {
770
734
  id: string;
771
735
  style?: NormalizedStyle;
772
736
  text?: NormalizedText;
773
737
  background?: NormalizedBackground;
774
738
  shape?: NormalizedShape;
775
- fill?: NormalizedFill;
776
- outline?: NormalizedOutline;
777
739
  foreground?: NormalizedForeground;
778
- shadow?: NormalizedShadow;
779
740
  video?: NormalizedVideo;
780
741
  audio?: NormalizedAudio;
781
- effect?: NormalizedEffect;
782
742
  children?: NormalizedElement[];
783
743
  }
784
744
  declare function normalizeElement<T = Meta>(element: Element<T>): NormalizedElement<T>;
@@ -912,5 +872,5 @@ declare class Reactivable extends Observable implements PropertyAccessor {
912
872
  destroy(): void;
913
873
  }
914
874
 
915
- export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, colorFillFields, defaultColor, defineProperty, flatDocumentToDocument, getDeclarations, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultInnerShadow, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOuterShadow, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, getNestedValue, getObjectValueByPath, getPropertyDescriptor, gradientFillFields, hasCRLF, idGenerator, imageFillFiedls, isCRLF, isColor, isColorFill, isColorFillObject, isEqualObject, isFragmentObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isParagraphObject, isPresetFill, isPresetFillObject, nanoid, normalizeAudio, normalizeBackground, normalizeCRLF, normalizeColor, normalizeColorFill, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeInnerShadow, normalizeOuterShadow, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeSoftEdge, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor, parseGradient, pick, presetFillFiedls, property, property2, propertyOffsetFallback, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyGradient, textContentToString };
916
- export type { Align, AngularNode, Audio, Background, BackgroundObject, BackgroundSize, BorderStyle, BoxShadow, BoxSizing, CmykColor, CmykaColor, Color, ColorFill, ColorFillObject, ColorStop, ColorStopNode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, Effect, EffectObject, Element, EmNode, EventListener, EventListenerOptions, EventListenerValue, ExtentKeywordNode, Fill, FillObject, FillRule, FlatDocument, FlatElement, FlatTextContent, FlexDirection, FlexWrap, FontKerning, FontStyle, FontWeight, Foreground, ForegroundObject, FragmentObject, FullStyle, GradientFill, GradientFillObject, GradientNode, HeadEnd, Hex8Color, HexNode, HighlightColormap, HighlightImage, HighlightLine, HighlightReferImage, HighlightSize, HighlightThickness, HslColor, HslaColor, HsvColor, HsvaColor, HwbColor, HwbaColor, IdGenerator, ImageFill, ImageFillCropRect, ImageFillObject, ImageFillStretchRect, ImageFillTile, InnerShadow, InnerShadowObject, Justify, LabColor, LabaColor, LchColor, LchaColor, LineCap, LineEndSize, LineEndType, LineJoin, LinearGradient, LinearGradientNode, LinearGradientWithType, ListStyleColormap, ListStyleImage, ListStylePosition, ListStyleSize, ListStyleType, LiteralNode, Meta, Node, None, NormalizedAudio, NormalizedBackground, NormalizedBaseBackground, NormalizedBaseForeground, NormalizedBaseOuterShadow, NormalizedBaseOutline, NormalizedColor, NormalizedColorFill, NormalizedDocument, NormalizedEffect, NormalizedElement, NormalizedElementStyle, NormalizedFill, NormalizedFlatDocument, NormalizedFlatElement, NormalizedForeground, NormalizedFragment, NormalizedGradientFill, NormalizedHighlight, NormalizedHighlightStyle, NormalizedImageFill, NormalizedInnerShadow, NormalizedLayoutStyle, NormalizedListStyle, NormalizedListStyleStyle, NormalizedOuterShadow, NormalizedOutline, NormalizedParagraph, NormalizedPresetFill, NormalizedShadow, NormalizedShadowStyle, NormalizedShape, NormalizedSoftEdge, NormalizedStyle, NormalizedText, NormalizedTextContent, NormalizedTextDrawStyle, NormalizedTextInlineStyle, NormalizedTextLineStyle, NormalizedTextStyle, NormalizedTransformStyle, NormalizedVideo, ObjectColor, ObservableEvents, OuterShadow, OuterShadowObject, Outline, OutlineObject, OutlineStyle, Overflow, ParagraphObject, PercentNode, PointerEvents, Position, PositionKeywordNode, PositionNode, PresetFill, PresetFillObject, PropertyAccessor, PropertyDeclaration, PxNode, RadialGradient, RadialGradientNode, RadialGradientWithType, ReactivableEvents, RepeatingLinearGradientNode, RepeatingRadialGradientNode, RgbColor, RgbNode, RgbaColor, RgbaNode, SVGPathData, Shadow, ShadowObject, Shape, ShapeNode, ShapePath, ShapePathStyle, SoftEdge, StrokeLinecap, StrokeLinejoin, Style, StyleObject, StyleUnit, TailEnd, Text, TextAlign, TextContent, TextDecoration, TextObject, TextOrientation, TextTransform, TextWrap, Uint32Color, VerticalAlign, Video, Visibility, WithNone, WithStyleNone, WritingMode, XyzColor, XyzaColor };
875
+ export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, colorFillFields, defaultColor, defineProperty, flatDocumentToDocument, getDeclarations, getDefaultBackgroundStyle, getDefaultElementStyle, getDefaultHighlightStyle, getDefaultLayoutStyle, getDefaultListStyleStyle, getDefaultOutlineStyle, getDefaultShadowStyle, getDefaultStyle, getDefaultTextInlineStyle, getDefaultTextLineStyle, getDefaultTextStyle, getDefaultTransformStyle, getNestedValue, getObjectValueByPath, getPropertyDescriptor, gradientFillFields, hasCRLF, idGenerator, imageFillFiedls, isCRLF, isColor, isColorFill, isColorFillObject, isEqualObject, isFragmentObject, isGradient, isGradientFill, isGradientFillObject, isImageFill, isImageFillObject, isNone, isParagraphObject, isPresetFill, isPresetFillObject, nanoid, normalizeAudio, normalizeBackground, normalizeCRLF, normalizeColor, normalizeColorFill, normalizeDocument, normalizeElement, normalizeFill, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeStyle, normalizeText, normalizeTextContent, normalizeVideo, parseColor, parseGradient, pick, presetFillFiedls, property, property2, propertyOffsetFallback, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyGradient, textContentToString };
876
+ export type { Align, AngularNode, Audio, Background, BackgroundObject, BackgroundSize, BorderStyle, BoxShadow, BoxSizing, CmykColor, CmykaColor, Color, ColorFill, ColorFillObject, ColorStop, ColorStopNode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, Element, EmNode, EventListener, EventListenerOptions, EventListenerValue, ExtentKeywordNode, Fill, FillObject, FillRule, FlatDocument, FlatElement, FlatTextContent, FlexDirection, FlexWrap, FontKerning, FontStyle, FontWeight, Foreground, ForegroundObject, FragmentObject, FullStyle, GradientFill, GradientFillObject, GradientNode, HeadEnd, Hex8Color, HexNode, HighlightColormap, HighlightImage, HighlightLine, HighlightReferImage, HighlightSize, HighlightThickness, HslColor, HslaColor, HsvColor, HsvaColor, HwbColor, HwbaColor, IdGenerator, ImageFill, ImageFillCropRect, ImageFillObject, ImageFillStretchRect, ImageFillTile, Justify, LabColor, LabaColor, LchColor, LchaColor, LineCap, LineEndSize, LineEndType, LineJoin, LinearGradient, LinearGradientNode, LinearGradientWithType, ListStyleColormap, ListStyleImage, ListStylePosition, ListStyleSize, ListStyleType, LiteralNode, Meta, Node, None, NormalizedAudio, NormalizedBackground, NormalizedBackgroundStyle, NormalizedBaseBackground, NormalizedBaseForeground, NormalizedBaseOutline, NormalizedColor, NormalizedColorFill, NormalizedDocument, NormalizedElement, NormalizedElementStyle, NormalizedFill, NormalizedFlatDocument, NormalizedFlatElement, NormalizedForeground, NormalizedFragment, NormalizedGradientFill, NormalizedHighlight, NormalizedHighlightStyle, NormalizedImageFill, NormalizedLayoutStyle, NormalizedListStyle, NormalizedListStyleStyle, NormalizedOutline, NormalizedOutlineStyle, NormalizedParagraph, NormalizedPresetFill, NormalizedShadow, NormalizedShadowStyle, NormalizedShape, NormalizedStyle, NormalizedText, NormalizedTextContent, NormalizedTextDrawStyle, NormalizedTextInlineStyle, NormalizedTextLineStyle, NormalizedTextStyle, NormalizedTransformStyle, NormalizedVideo, ObjectColor, ObservableEvents, Outline, OutlineObject, OutlineStyle, Overflow, ParagraphObject, PercentNode, PointerEvents, Position, PositionKeywordNode, PositionNode, PresetFill, PresetFillObject, PropertyAccessor, PropertyDeclaration, PxNode, RadialGradient, RadialGradientNode, RadialGradientWithType, ReactivableEvents, RepeatingLinearGradientNode, RepeatingRadialGradientNode, RgbColor, RgbNode, RgbaColor, RgbaNode, SVGPathData, Shadow, ShadowObject, Shape, ShapeNode, ShapePath, ShapePathStyle, StrokeLinecap, StrokeLinejoin, Style, StyleObject, StyleUnit, TailEnd, Text, TextAlign, TextContent, TextDecoration, TextObject, TextOrientation, TextTransform, TextWrap, Toggleable, Uint32Color, VerticalAlign, Video, Visibility, WithNone, WithStyleNone, WritingMode, XyzColor, XyzaColor };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- (function(a,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(a=typeof globalThis<"u"?globalThis:a||self,k(a.modernIdoc={}))})(this,(function(a){"use strict";function k(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"},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},w=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t>e?t:e},Pt=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},wt=function(t){return{r:w(t.r,0,255),g:w(t.g,0,255),b:w(t.b,0,255),a:w(t.a)}},nt=function(t){return{r:m(t.r),g:m(t.g),b:m(t.b),a:m(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,o=Math.max(e,n,r),s=o-Math.min(e,n,r),l=s?o===e?(n-r)/s:o===n?2+(r-e)/s:4+(e-n)/s:0;return{h:60*(l<0?l+6:l),s:o?s/o*100:0,v:o/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 o=Math.floor(e),s=r*(1-n),l=r*(1-(e-o)*n),f=r*(1-(1-e+o)*n),g=o%6;return{r:255*[r,l,s,s,f,r][g],g:255*[f,r,r,l,s,s][g],b:255*[s,s,f,r,r,l][g],a:i}},Lt=function(t){return{h:Pt(t.h),s:w(t.s,0,100),l:w(t.l,0,100),a:w(t.a)}},zt=function(t){return{h:m(t.h),s:m(t.s),l:m(t.l),a:m(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?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=De.exec(t)||Ae.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:wt({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,o=i===void 0?1:i;return D(e)&&D(n)&&D(r)?wt({r:Number(e),g:Number(n),b:Number(r),a:Number(o)}):null},"rgb"],[function(t){var e=t.h,n=t.s,r=t.l,i=t.a,o=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(o)});return Et(s)},"hsl"],[function(t){var e=t.h,n=t.s,r=t.v,i=t.a,o=i===void 0?1:i;if(!D(e)||!D(n)||!D(r))return null;var s=(function(l){return{h:Pt(l.h),s:w(l.s,0,100),v:w(l.v,0,100),a:w(l.a)}})({h:Number(e),s:Number(n),v:Number(r),a:Number(o)});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:w(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:w(n.l+100*e,0,100),a:n.a}},jt=(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 m(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=(o=e.a)<1?q(m(255*o)):"","#"+q(n)+q(r)+q(i)+s;var e,n,r,i,o,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,(o=e.a)<1?"rgba("+n+", "+r+", "+i+", "+o+")":"rgb("+n+", "+r+", "+i+")";var e,n,r,i,o},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,(o=e.a)<1?"hsla("+n+", "+r+"%, "+i+"%, "+o+")":"hsl("+n+", "+r+"%, "+i+"%)";var e,n,r,i,o},t.prototype.toHsv=function(){return e=Ft(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 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}):m(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}):m(n.h)},t.prototype.isEqual=function(e){return this.toHex()===E(e).toHex()},t})(),E=function(t){return t instanceof jt?t:new jt(t)};class je{eventListeners=new Map;addEventListener(e,n,r){const i={value:n,options:r},o=this.eventListeners.get(e);return o?Array.isArray(o)?o.push(i):this.eventListeners.set(e,[o,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 o=[];for(let s=0,l=i.length;s<l;s++){const f=i[s];(f.value!==n||typeof r=="object"&&r?.once&&(typeof f.options=="boolean"||!f.options?.once))&&o.push(f)}o.length?this.eventListeners.set(e,o.length===1?o[0]:o):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,o=0;o<i;o++){const s=r[o];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 x(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 Rt(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 kt(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(/^\./,""),Rt(t,e.split("."),n))}function It(t,e,n){if(!(typeof t!="object"||!e))return e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,""),Gt(t,e.split("."),n)}class Tt{_eventListeners={};on(e,n){let r=this._eventListeners[e];r===void 0&&(r=[],this._eventListeners[e]=r);const i=r.indexOf(n);return i>-1&&r.splice(i,1),r.push(n),this}once(e,n){const r=(...i)=>{this.off(e,r),n.apply(this,i)};return this.on(e,r),this}off(e,n){const r=this._eventListeners[e];if(r!==void 0){const i=r.indexOf(n);i>-1&&r.splice(i,1)}return this}emit(e,...n){const r=this._eventListeners[e];if(r!==void 0){const i=r.length;if(i>0)for(let o=0;o<i;o++)r[o].apply(this,n)}return this}removeAllListeners(){return this._eventListeners={},this}hasEventListener(e){return!!this._eventListeners[e]}destroy(){this.removeAllListeners()}}class Re{_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.for("declarations"),J=Symbol.for("inited");function M(t){let e;if(Object.hasOwn(t,ot))e=t[ot];else{const n=Object.getPrototypeOf(t);e={...n?M(n):{}},t[ot]=e}return e}function at(t,e,n,r){const{alias:i,internalKey:o}=r,s=t[e];i?It(t,i,n):t[o]=n,t.onUpdateProperty?.(e,n??$(t,e,r),s)}function st(t,e,n){const{alias:r,internalKey:i}=n;let o;return r?o=kt(t,r):o=t[i],o=o??$(t,e,n),o}function $(t,e,n){const{default:r,fallback:i}=n;let o;if(r!==void 0&&!t[J]?.[e]){t[J]||(t[J]={}),t[J][e]=!0;const s=typeof r=="function"?r():r;s!==void 0&&(t[e]=s,o=s)}return o===void 0&&i!==void 0&&(o=typeof i=="function"?i():i),o}function lt(t,e){function n(){return this.getProperty?this.getProperty(t):st(this,t,e)}function r(i){this.setProperty?this.setProperty(t,i):at(this,t,i,e)}return{get:n,set:r}}function Vt(t,e,n={}){const r={...n,internalKey:Symbol.for(e)},i=M(t);i[e]=r;const{get:o,set:s}=lt(e,r);Object.defineProperty(t.prototype,e,{get(){return o.call(this)},set(l){s.call(this,l)},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 ke(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.for(r)},o=lt(r,i);return{init(s){const l=M(this.constructor);return l[r]=i,o.set.call(this,s),s},get(){return o.get.call(this)},set(s){o.set.call(this,s)}}}}class Ie extends Tt{_propertyAccessor;_properties={};_updatedProperties={};_changedProperties=new Set;_updatingPromise=Promise.resolve();_updating=!1;constructor(e){super(),this.setProperties(e)}isDirty(e){return e?!!this._updatedProperties[e]:Object.keys(this._updatedProperties).length>0}offsetGetProperty(e){return this._properties[e]}offsetSetProperty(e,n){this._properties[e]=n}offsetGetProperties(e){const n=this._properties,r=Object.keys(n),i={};for(let o,s,l=0;l<r.length;l++)o=r[l],s=n[o],s!==void 0&&(!e||e.includes(o))&&(s&&typeof s=="object"?"toJSON"in s?i[o]=s.toJSON():Array.isArray(s)?i[o]=[...s]:i[o]={...s}:i[o]=s);return i}offsetSetProperties(e){if(e&&typeof e=="object"){const n=Object.keys(e);for(let r,i=0;i<n.length;i++)r=n[i],this.offsetSetProperty(r,e[r])}return this}getProperty(e){const n=this.getPropertyDeclaration(e);if(n){if(n.internal||n.alias)return st(this,e,n);{const r=this._propertyAccessor;let i;return r&&r.getProperty?i=r.getProperty(e):i=this.offsetGetProperty(e),i??$(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.offsetSetProperty(e,n),this.onUpdateProperty?.(e,n??$(this,e,r),i)}}getProperties(e){const n={},r=this.getPropertyDeclarations(),i=Object.keys(r);for(let o=0,s=i.length;o<s;o++){const l=i[o],f=r[l];f.internal||f.alias||(!e||e.includes(l))&&(n[l]=this.getProperty(l))}return n}setProperties(e){if(e&&typeof e=="object")for(const n in e)this.setProperty(n,e[n]);return this}resetProperties(){const e=this.getPropertyDeclarations(),n=Object.keys(e);for(let r=0,i=n.length;r<i;r++){const o=n[r],s=e[o];this.setProperty(o,typeof s.default=="function"?s.default():s.default)}return this}getPropertyDeclarations(){return M(this.constructor)}getPropertyDeclaration(e){return this.getPropertyDeclarations()[e]}setPropertyAccessor(e){const n=this.getPropertyDeclarations(),r=[];if(e&&e.getProperty&&e.setProperty){const i=Object.keys(n);for(let o=0,s=i.length;o<s;o++){const l=i[o],f=n[l];if(f.internal||f.alias)continue;const g=this.offsetGetProperty(l),p=e.getProperty(l);p!==void 0&&!Object.is(g,p)&&(this.offsetSetProperty(l,p),r.push({key:l,newValue:p,oldValue:g}))}}this._propertyAccessor=e;for(let i=0,o=r.length;i<o;i++){const{key:s,newValue:l,oldValue:f}=r[i];this.requestUpdate(s,l,f)}return 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={}}onUpdateProperty(e,n,r){Object.is(n,r)||this.requestUpdate(e,n,r)}requestUpdate(e,n,r){e!==void 0&&(this._updatedProperties[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(){return this.offsetGetProperties()}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 Te(t){return{r:N(t.r),g:N(t.g),b:N(t.b),a:N(t.a,3)}}function X(t){const e=t.toString(16);return e.length<2?`0${e}`:e}const W="#000000FF";function ct(t){return ut(t).isValid()}function b(t,e=!1){const n=ut(t);if(!n.isValid()){if(typeof t=="string")return t;const l=`Failed to normalizeColor ${t}`;if(e)throw new Error(l);return console.warn(l),W}const{r,g:i,b:o,a:s}=Te(n.rgba);return`#${X(r)}${X(i)}${X(o)}${X(N(s*255))}`}var Y=Y||{};Y.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 c=new Error(`${e}: ${u}`);throw c.source=e,c}function r(){const u=i();return e.length>0&&n("Invalid input not EOF"),u}function i(){return T(o)}function o(){return s("linear-gradient",t.linearGradient,f)||s("repeating-linear-gradient",t.repeatingLinearGradient,f)||s("radial-gradient",t.radialGradient,v)||s("repeating-radial-gradient",t.repeatingRadialGradient,v)}function s(u,c,d){return l(c,S=>{const G=d();return G&&(y(t.comma)||n("Missing comma before color stops")),{type:u,orientation:G,colorStops:T(Ct)}})}function l(u,c){const d=y(u);if(d){y(t.startCall)||n("Missing (");const S=c(d);return y(t.endCall)||n("Missing )"),S}}function f(){const u=g();if(u)return u;const c=P("position-keyword",t.positionKeywords,1);return c?{type:"directional",value:c.value}:p()}function g(){return P("directional",t.sideOrCorner,1)}function p(){return P("angular",t.angleValue,1)||P("angular",t.radianValue,1)}function v(){let u,c=C(),d;return c&&(u=[],u.push(c),d=e,y(t.comma)&&(c=C(),c?u.push(c):e=d)),u}function C(){let u=_()||j();if(u)u.at=z();else{const c=O();if(c){u=c;const d=z();d&&(u.at=d)}else{const d=z();if(d)u={type:"default-radial",at:d};else{const S=R();S&&(u={type:"default-radial",at:S})}}}return u}function _(){const u=P("shape",/^(circle)/i,0);return u&&(u.style=Fe()||O()),u}function j(){const u=P("shape",/^(ellipse)/i,0);return u&&(u.style=R()||et()||O()),u}function O(){return P("extent-keyword",t.extentKeywords,1)}function z(){if(P("position",/^at/,0)){const u=R();return u||n("Missing positioning value"),u}}function R(){const u=K();if(u.x||u.y)return{type:"position",value:u}}function K(){return{x:et(),y:et()}}function T(u){let c=u();const d=[];if(c)for(d.push(c);y(t.comma);)c=u(),c?d.push(c):n("One extra comma");return d}function Ct(){const u=Ye();return u||n("Expected color definition"),u.length=et(),u}function Ye(){return Qe()||on()||rn()||en()||tn()||nn()||Ze()}function Ze(){return P("literal",t.literalColor,0)}function Qe(){return P("hex",t.hexColor,1)}function tn(){return l(t.rgbColor,()=>({type:"rgb",value:T(U)}))}function en(){return l(t.rgbaColor,()=>({type:"rgba",value:T(U)}))}function nn(){return l(t.varColor,()=>({type:"var",value:an()}))}function rn(){return l(t.hslColor,()=>{y(t.percentageValue)&&n("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");const c=U();y(t.comma);let d=y(t.percentageValue);const S=d?d[1]:null;y(t.comma),d=y(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 l(t.hslaColor,()=>{const u=U();y(t.comma);let c=y(t.percentageValue);const d=c?c[1]:null;y(t.comma),c=y(t.percentageValue);const S=c?c[1]:null;y(t.comma);const G=U();return(!d||!S)&&n("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[u,d,S,G]}})}function an(){return y(t.variableName)[1]}function U(){return y(t.number)[1]}function et(){return P("%",t.percentageValue,1)||sn()||ln()||Fe()}function sn(){return P("position-keyword",t.positionKeywords,1)}function ln(){return l(t.calcValue,()=>{let u=1,c=0;for(;u>0&&c<e.length;){const S=e.charAt(c);S==="("?u++:S===")"&&u--,c++}u>0&&n("Missing closing parenthesis in calc() expression");const d=e.substring(0,c-1);return _t(c-1),{type:"calc",value:d}})}function Fe(){return P("px",t.pixelValue,1)||P("em",t.emValue,1)}function P(u,c,d){const S=y(c);if(S)return{type:u,value:S[d]}}function y(u){let c,d;return d=/^\s+/.exec(e),d&&_t(d[0].length),c=u.exec(e),c&&_t(c[0].length),c}function _t(u){e=e.substr(u)}return function(u){return e=u.toString().trim(),e.endsWith(";")&&(e=e.slice(0,-1)),r()}})();const Mt=Y.parse.bind(Y);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,o){n+=t.visit(i),o<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 o=N(r/e,3),s="#00000000";switch(n.type){case"rgb":s=b({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0)});break;case"rgba":s=b({r:Number(i[0]??0),g:Number(i[1]??0),b:Number(i[2]??0),a:Number(i[3]??0)});break;case"literal":s=b(n.value);break;case"hex":s=b(`#${n.value}`);break}return n.length?.type==="%"&&(o=Number(n.length.value)/100),{offset:o,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 Mt(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 Kt(t){let e;return typeof t=="string"?e={color:t}:e={...t},e.color&&(e.color=b(e.color)),A(e,ft)}const dt=["linearGradient","radialGradient","rotateWithShape"];function Ut(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 xt(t){let e;return typeof t=="string"?e={preset:t}:e={...t},h(e.foregroundColor)?delete e.foregroundColor:e.foregroundColor=b(e.foregroundColor),h(e.backgroundColor)?delete e.backgroundColor:e.backgroundColor=b(e.backgroundColor),A(e,gt)}function Jt(t){return!h(t.color)}function Xt(t){return typeof t=="string"?ct(t):Jt(t)}function Yt(t){return!h(t.image)&&H(t.image)||!!t.linearGradient||!!t.radialGradient}function Zt(t){return typeof t=="string"?H(t):Yt(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 Xt(t)&&Object.assign(n,Kt(t)),Zt(t)&&Object.assign(n,Ut(t)),te(t)&&Object.assign(n,qt(t)),ne(t)&&Object.assign(n,xt(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 vt(t){return{...pt(),...F({...t,color:h(t.color)?W:b(t.color)})}}function ie(){return{...pt(),scaleX:1,scaleY:1}}function oe(t){return{...ie(),...vt(t)}}function Me(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:vt(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:b(t)}:{...t,color:h(t.color)?W:b(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 ve(){return{highlight:{},highlightImage:"none",highlightReferImage:"none",highlightColormap:"none",highlightLine:"none",highlightSize:"cover",highlightThickness:"100%"}}function ye(){return{listStyle:{},listStyleType:"none",listStyleImage:"none",listStyleColormap:"none",listStyleSize:"cover",listStylePosition:"outside"}}function me(){return{...ve(),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{...ye(),writingMode:"horizontal-tb",textWrap:"wrap",textAlign:"start",textIndent:0,lineHeight:1.2}}function Se(){return{...be(),...me(),textStrokeWidth:0,textStrokeColor:"none"}}function I(t){return F({...t,color:h(t.color)?void 0:b(t.color),backgroundColor:h(t.backgroundColor)?void 0:b(t.backgroundColor),borderColor:h(t.borderColor)?void 0:b(t.borderColor),outlineColor:h(t.outlineColor)?void 0:b(t.outlineColor),shadowColor:h(t.shadowColor)?void 0:b(t.shadowColor),textStrokeColor:h(t.textStrokeColor)?void 0:b(t.textStrokeColor)})}function He(){return{...pe(),...Se()}}const yt=/\r\n|\n\r|\n|\r/,Be=new RegExp(`${yt.source}|<br\\/>`,"g"),Ke=new RegExp(`^(${yt.source})$`),mt=`
2
- `;function Ue(t){return yt.test(t)}function bt(t){return Ke.test(t)}function Ce(t){return t.replace(Be,mt)}function Q(t){const e=[];function n(){return e[e.length-1]}function r(l,f,g){const p=l?I(l):{},v=f?L(f):void 0,C=g?B(g):void 0,_=F({...p,fill:v,outline:C,fragments:[]});return e[e.length-1]?.fragments.length===0?e[e.length-1]=_:e.push(_),_}function i(l="",f,g,p){const v=f?I(f):{},C=g?L(g):void 0,_=p?B(p):void 0;Array.from(l).forEach(j=>{if(bt(j)){const{fragments:O,fill:z,outline:R,...K}=n()||r();O.length||O.push(F({...v,fill:C,outline:_,content:mt})),r(K,z,R)}else{const O=n()||r(),z=O.fragments[O.fragments.length-1];if(z){const{content:R,fill:K,outline:T,...Ct}=z;if(x(C,K)&&x(_,T)&&x(v,Ct)){z.content=`${R}${j}`;return}}O.fragments.push(F({...v,fill:C,outline:_,content:j}))}})}(Array.isArray(t)?t:[t]).forEach(l=>{if(typeof l=="string")r(),i(l);else if(St(l)){const{content:f,fill:g,outline:p,...v}=l;r(v,g,p),i(f)}else if(_e(l)){const{fragments:f,fill:g,outline:p,...v}=l;r(v,g,p),f.forEach(C=>{const{content:_,fill:j,outline:O,...z}=C;i(_,z,j,O)})}else Array.isArray(l)?(r(),l.forEach(f=>{if(typeof f=="string")i(f);else if(St(f)){const{content:g,fill:p,outline:v,...C}=f;i(g,C,p,v)}})):console.warn("Failed to parse text content",l)});const s=n();return s&&!s.fragments.length&&s.fragments.push({content:""}),e}function _e(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 Pe(t){return typeof t=="string"||Array.isArray(t)?{content:Q(t)}:F({...t,content:Q(t.content??""),style:t.style?I(t.style):void 0,effects:t.effects?t.effects.map(e=>I(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=Ce(e.fragments.flatMap(r=>r.content).join(""));return bt(n)?"":n}).join(mt)}function we(t){return typeof t=="string"?{src:t}:t}function tt(t){return F({...t,id:t.id??ue(),style:h(t.style)?void 0:I(t.style),text:h(t.text)?void 0:Pe(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:we(t.video),audio:h(t.audio)?void 0:k(t.audio),effect:h(t.effect)?void 0:ae(t.effect),children:t.children?.map(e=>tt(e))})}function xe(t){return tt(t)}function Je(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 Xe(t){const{children:e,...n}=t;function r(f){const{parentId:g,childrenIds:p,...v}=f;return{...v,children:[]}}const i={},o=[],s={...n,children:o};function l(f){if(!e[f]||i[f])return;const g=e[f],p=r(g);i[f]=p;const v=g.parentId;if(v){l(v);const C=e[v],_=i[v];if(!_)return;C?.childrenIds&&_?.children&&(_.children[C.childrenIds.indexOf(f)]=p)}else o.push(p)}for(const f in e)l(f);return s}a.EventEmitter=je,a.Observable=Tt,a.RawWeakMap=Re,a.Reactivable=Ie,a.clearUndef=F,a.colorFillFields=ft,a.defaultColor=W,a.defineProperty=Vt,a.flatDocumentToDocument=Xe,a.getDeclarations=M,a.getDefaultElementStyle=pe,a.getDefaultHighlightStyle=ve,a.getDefaultInnerShadow=pt,a.getDefaultLayoutStyle=he,a.getDefaultListStyleStyle=ye,a.getDefaultOuterShadow=ie,a.getDefaultShadowStyle=fe,a.getDefaultStyle=He,a.getDefaultTextInlineStyle=me,a.getDefaultTextLineStyle=be,a.getDefaultTextStyle=Se,a.getDefaultTransformStyle=ge,a.getNestedValue=Rt,a.getObjectValueByPath=kt,a.getPropertyDescriptor=lt,a.gradientFillFields=dt,a.hasCRLF=Ue,a.idGenerator=ue,a.imageFillFiedls=ht,a.isCRLF=bt,a.isColor=ct,a.isColorFill=Xt,a.isColorFillObject=Jt,a.isEqualObject=x,a.isFragmentObject=St,a.isGradient=H,a.isGradientFill=Zt,a.isGradientFillObject=Yt,a.isImageFill=te,a.isImageFillObject=Qt,a.isNone=h,a.isParagraphObject=_e,a.isPresetFill=ne,a.isPresetFillObject=ee,a.nanoid=le,a.normalizeAudio=k,a.normalizeBackground=re,a.normalizeCRLF=Ce,a.normalizeColor=b,a.normalizeColorFill=Kt,a.normalizeDocument=xe,a.normalizeEffect=ae,a.normalizeElement=tt,a.normalizeFill=L,a.normalizeFlatDocument=Je,a.normalizeForeground=se,a.normalizeGradient=Bt,a.normalizeGradientFill=Ut,a.normalizeImageFill=qt,a.normalizeInnerShadow=vt,a.normalizeOuterShadow=oe,a.normalizeOutline=B,a.normalizePresetFill=xt,a.normalizeShadow=ce,a.normalizeShape=de,a.normalizeSoftEdge=Me,a.normalizeStyle=I,a.normalizeText=Pe,a.normalizeTextContent=Q,a.normalizeVideo=we,a.parseColor=ut,a.parseGradient=Mt,a.pick=A,a.presetFillFiedls=gt,a.property=Ge,a.property2=ke,a.propertyOffsetFallback=$,a.propertyOffsetGet=st,a.propertyOffsetSet=at,a.round=N,a.setNestedValue=Gt,a.setObjectValueByPath=It,a.stringifyGradient=Ve,a.textContentToString=qe,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.modernIdoc={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){return typeof e==`string`?{src:e}:e}var n={grad:.9,turn:360,rad:360/(2*Math.PI)},r=function(e){return typeof e==`string`?e.length>0:typeof e==`number`},i=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=10**t),Math.round(n*e)/n+0},a=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},o=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},s=function(e){return{r:a(e.r,0,255),g:a(e.g,0,255),b:a(e.b,0,255),a:a(e.a)}},c=function(e){return{r:i(e.r),g:i(e.g),b:i(e.b),a:i(e.a,3)}},l=/^#([0-9a-f]{3,8})$/i,u=function(e){var t=e.toString(16);return t.length<2?`0`+t:t},d=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=Math.max(t,n,r),o=a-Math.min(t,n,r),s=o?a===t?(n-r)/o:a===n?2+(r-t)/o:4+(t-n)/o:0;return{h:60*(s<0?s+6:s),s:a?o/a*100:0,v:a/255*100,a:i}},f=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var a=Math.floor(t),o=r*(1-n),s=r*(1-(t-a)*n),c=r*(1-(1-t+a)*n),l=a%6;return{r:255*[r,s,o,o,c,r][l],g:255*[c,r,r,s,o,o][l],b:255*[o,o,c,r,r,s][l],a:i}},p=function(e){return{h:o(e.h),s:a(e.s,0,100),l:a(e.l,0,100),a:a(e.a)}},ee=function(e){return{h:i(e.h),s:i(e.s),l:i(e.l),a:i(e.a,3)}},m=function(e){return f((n=(t=e).s,{h:t.h,s:(n*=((r=t.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:t.a}));var t,n,r},h=function(e){return{h:(t=d(e)).h,s:(i=(200-(n=t.s))*(r=t.v)/100)>0&&i<200?n*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,n,r,i},g=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,te=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,_=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ne=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v={string:[[function(e){var t=l.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?i(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?i(parseInt(e.substr(6,2),16)/255,2):1}:null:null},`hex`],[function(e){var t=_.exec(e)||ne.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:s({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},`rgb`],[function(e){var t=g.exec(e)||te.exec(e);if(!t)return null;var r,i;return m(p({h:(r=t[1],i=t[2],i===void 0&&(i=`deg`),Number(r)*(n[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)}))},`hsl`]],object:[[function(e){var t=e.r,n=e.g,i=e.b,a=e.a,o=a===void 0?1:a;return r(t)&&r(n)&&r(i)?s({r:Number(t),g:Number(n),b:Number(i),a:Number(o)}):null},`rgb`],[function(e){var t=e.h,n=e.s,i=e.l,a=e.a,o=a===void 0?1:a;return!r(t)||!r(n)||!r(i)?null:m(p({h:Number(t),s:Number(n),l:Number(i),a:Number(o)}))},`hsl`],[function(e){var t=e.h,n=e.s,i=e.v,s=e.a,c=s===void 0?1:s;return!r(t)||!r(n)||!r(i)?null:f(function(e){return{h:o(e.h),s:a(e.s,0,100),v:a(e.v,0,100),a:a(e.a)}}({h:Number(t),s:Number(n),v:Number(i),a:Number(c)}))},`hsv`]]},y=function(e,t){for(var n=0;n<t.length;n++){var r=t[n][0](e);if(r)return[r,t[n][1]]}return[null,void 0]},re=function(e){return typeof e==`string`?y(e.trim(),v.string):typeof e==`object`&&e?y(e,v.object):[null,void 0]},b=function(e,t){var n=h(e);return{h:n.h,s:a(n.s+100*t,0,100),l:n.l,a:n.a}},x=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},ie=function(e,t){var n=h(e);return{h:n.h,s:n.s,l:a(n.l+100*t,0,100),a:n.a}},ae=function(){function e(e){this.parsed=re(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return i(x(this.rgba),2)},e.prototype.isDark=function(){return x(this.rgba)<.5},e.prototype.isLight=function(){return x(this.rgba)>=.5},e.prototype.toHex=function(){return e=c(this.rgba),t=e.r,n=e.g,r=e.b,o=(a=e.a)<1?u(i(255*a)):``,`#`+u(t)+u(n)+u(r)+o;var e,t,n,r,a,o},e.prototype.toRgb=function(){return c(this.rgba)},e.prototype.toRgbString=function(){return e=c(this.rgba),t=e.r,n=e.g,r=e.b,(i=e.a)<1?`rgba(`+t+`, `+n+`, `+r+`, `+i+`)`:`rgb(`+t+`, `+n+`, `+r+`)`;var e,t,n,r,i},e.prototype.toHsl=function(){return ee(h(this.rgba))},e.prototype.toHslString=function(){return e=ee(h(this.rgba)),t=e.h,n=e.s,r=e.l,(i=e.a)<1?`hsla(`+t+`, `+n+`%, `+r+`%, `+i+`)`:`hsl(`+t+`, `+n+`%, `+r+`%)`;var e,t,n,r,i},e.prototype.toHsv=function(){return e=d(this.rgba),{h:i(e.h),s:i(e.s),v:i(e.v),a:i(e.a,3)};var e},e.prototype.invert=function(){return S({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return e===void 0&&(e=.1),S(b(this.rgba,e))},e.prototype.desaturate=function(e){return e===void 0&&(e=.1),S(b(this.rgba,-e))},e.prototype.grayscale=function(){return S(b(this.rgba,-1))},e.prototype.lighten=function(e){return e===void 0&&(e=.1),S(ie(this.rgba,e))},e.prototype.darken=function(e){return e===void 0&&(e=.1),S(ie(this.rgba,-e))},e.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return typeof e==`number`?S({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):i(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=h(this.rgba);return typeof e==`number`?S({h:e,s:t.s,l:t.l,a:t.a}):i(t.h)},e.prototype.isEqual=function(e){return this.toHex()===S(e).toHex()},e}(),S=function(e){return e instanceof ae?e:new ae(e)},oe=class{eventListeners=new Map;addEventListener(e,t,n){let r={value:t,options:n},i=this.eventListeners.get(e);return i?Array.isArray(i)?i.push(r):this.eventListeners.set(e,[i,r]):this.eventListeners.set(e,r),this}removeEventListener(e,t,n){if(!t)return this.eventListeners.delete(e),this;let r=this.eventListeners.get(e);if(!r)return this;if(Array.isArray(r)){let i=[];for(let e=0,a=r.length;e<a;e++){let a=r[e];(a.value!==t||typeof n==`object`&&n?.once&&(typeof a.options==`boolean`||!a.options?.once))&&i.push(a)}i.length?this.eventListeners.set(e,i.length===1?i[0]:i):this.eventListeners.delete(e)}else r.value===t&&(typeof n==`boolean`||!n?.once||typeof r.options==`boolean`||r.options?.once)&&this.eventListeners.delete(e);return this}removeAllListeners(){return this.eventListeners.clear(),this}hasEventListener(e){return this.eventListeners.has(e)}dispatchEvent(e,...t){let n=this.eventListeners.get(e);if(n){if(Array.isArray(n))for(let r=n.length,i=0;i<r;i++){let r=n[i];typeof r.options==`object`&&r.options?.once&&this.off(e,r.value,r.options),r.value.apply(this,t)}else typeof n.options==`object`&&n.options?.once&&this.off(e,n.value,n.options),n.value.apply(this,t);return!0}else return!1}on(e,t,n){return this.addEventListener(e,t,n)}once(e,t){return this.addEventListener(e,t,{once:!0})}off(e,t,n){return this.removeEventListener(e,t,n)}emit(e,...t){this.dispatchEvent(e,...t)}};function C(e){return e==null||e===``||e===`none`}function w(e,t=0,n=10**t){return Math.round(n*e)/n+0}function T(e,t=!1){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return t?e.map(e=>T(e,t)):e;let n={};for(let r in e){let i=e[r];i!=null&&(t?n[r]=T(i,t):n[r]=i)}return n}function E(e,t){let n={};return t.forEach(t=>{t in e&&(n[t]=e[t])}),n}function D(e,t){if(e===t)return!0;if(e&&t&&typeof e==`object`&&typeof t==`object`){let n=Array.from(new Set([...Object.keys(e),...Object.keys(t)]));return!n.length||n.every(n=>e[n]===t[n])}return!1}function O(e,t,n){let r=t.length-1;if(r<0)return e===void 0?n:e;for(let i=0;i<r;i++){if(e==null)return n;e=e[t[i]]}return e==null||e[t[r]]===void 0?n:e[t[r]]}function k(e,t,n){let r=t.length-1;for(let n=0;n<r;n++)typeof e[t[n]]!=`object`&&(e[t[n]]={}),e=e[t[n]];e[t[r]]=n}function A(e,t,n){return e==null||!t||typeof t!=`string`?n:e[t]===void 0?(t=t.replace(/\[(\w+)\]/g,`.$1`),t=t.replace(/^\./,``),O(e,t.split(`.`),n)):e[t]}function se(e,t,n){if(!(typeof e!=`object`||!t))return t=t.replace(/\[(\w+)\]/g,`.$1`),t=t.replace(/^\./,``),k(e,t.split(`.`),n)}var ce=class{_eventListeners={};on(e,t){let n=this._eventListeners[e];n===void 0&&(n=[],this._eventListeners[e]=n);let r=n.indexOf(t);return r>-1&&n.splice(r,1),n.push(t),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n),this}off(e,t){let n=this._eventListeners[e];if(n!==void 0){let e=n.indexOf(t);e>-1&&n.splice(e,1)}return this}emit(e,...t){let n=this._eventListeners[e];if(n!==void 0){let e=n.length;if(e>0)for(let r=0;r<e;r++)n[r].apply(this,t)}return this}removeAllListeners(){return this._eventListeners={},this}hasEventListener(e){return!!this._eventListeners[e]}destroy(){this.removeAllListeners()}},le=class{_map=new WeakMap;_toRaw(e){if(e&&typeof e==`object`){let t=e.__v_raw;t&&(e=this._toRaw(t))}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,t){return this._map.set(this._toRaw(e),this._toRaw(t)),this}},j=Symbol.for(`declarations`),M=Symbol.for(`inited`);function N(e){let t;if(Object.hasOwn(e,j))t=e[j];else{let n=Object.getPrototypeOf(e);t={...n?N(n):{}},e[j]=t}return t}function P(e,t,n,r){let{alias:i,internalKey:a}=r,o=e[t];i?se(e,i,n):e[a]=n,e.onUpdateProperty?.(t,n??I(e,t,r),o)}function F(e,t,n){let{alias:r,internalKey:i}=n,a;return a=r?A(e,r):e[i],a??=I(e,t,n),a}function I(e,t,n){let{default:r,fallback:i}=n,a;if(r!==void 0&&!e[M]?.[t]){e[M]||(e[M]={}),e[M][t]=!0;let n=typeof r==`function`?r():r;n!==void 0&&(e[t]=n,a=n)}return a===void 0&&i!==void 0&&(a=typeof i==`function`?i():i),a}function L(e,t){function n(){return this.getProperty?this.getProperty(e):F(this,e,t)}function r(n){this.setProperty?this.setProperty(e,n):P(this,e,n,t)}return{get:n,set:r}}function ue(e,t,n={}){let r={...n,internalKey:Symbol.for(t)},i=N(e);i[t]=r;let{get:a,set:o}=L(t,r);Object.defineProperty(e.prototype,t,{get(){return a.call(this)},set(e){o.call(this,e)},configurable:!0,enumerable:!0})}function de(e){return function(t,n){if(typeof n!=`string`)throw TypeError(`Failed to @property decorator, prop name cannot be a symbol`);ue(t.constructor,n,e)}}function fe(e={}){return function(t,n){let r=n.name;if(typeof r!=`string`)throw TypeError(`Failed to @property decorator, prop name cannot be a symbol`);let i={...e,internalKey:Symbol.for(r)},a=L(r,i);return{init(e){let t=N(this.constructor);return t[r]=i,a.set.call(this,e),e},get(){return a.get.call(this)},set(e){a.set.call(this,e)}}}}var pe=class extends ce{_propertyAccessor;_properties={};_updatedProperties={};_changedProperties=new Set;_updatingPromise=Promise.resolve();_updating=!1;constructor(e){super(),this.setProperties(e)}isDirty(e){return e?!!this._updatedProperties[e]:Object.keys(this._updatedProperties).length>0}offsetGetProperty(e){return this._properties[e]}offsetSetProperty(e,t){this._properties[e]=t}offsetGetProperties(e){let t=this._properties,n=Object.keys(t),r={};for(let i,a,o=0;o<n.length;o++)i=n[o],a=t[i],a!==void 0&&(!e||e.includes(i))&&(a&&typeof a==`object`?`toJSON`in a?r[i]=a.toJSON():Array.isArray(a)?r[i]=[...a]:r[i]={...a}:r[i]=a);return r}offsetSetProperties(e){if(e&&typeof e==`object`){let t=Object.keys(e);for(let n,r=0;r<t.length;r++)n=t[r],this.offsetSetProperty(n,e[n])}return this}getProperty(e){let t=this.getPropertyDeclaration(e);if(t){if(t.internal||t.alias)return F(this,e,t);{let n=this._propertyAccessor,r;return r=n&&n.getProperty?n.getProperty(e):this.offsetGetProperty(e),r??I(this,e,t)}}}setProperty(e,t){let n=this.getPropertyDeclaration(e);if(n)if(n.internal||n.alias)P(this,e,t,n);else{let r=this.getProperty(e);this._propertyAccessor?.setProperty?.(e,t),this.offsetSetProperty(e,t),this.onUpdateProperty?.(e,t??I(this,e,n),r)}}getProperties(e){let t={},n=this.getPropertyDeclarations(),r=Object.keys(n);for(let i=0,a=r.length;i<a;i++){let a=r[i],o=n[a];o.internal||o.alias||(!e||e.includes(a))&&(t[a]=this.getProperty(a))}return t}setProperties(e){if(e&&typeof e==`object`)for(let t in e)this.setProperty(t,e[t]);return this}resetProperties(){let e=this.getPropertyDeclarations(),t=Object.keys(e);for(let n=0,r=t.length;n<r;n++){let r=t[n],i=e[r];this.setProperty(r,typeof i.default==`function`?i.default():i.default)}return this}getPropertyDeclarations(){return N(this.constructor)}getPropertyDeclaration(e){return this.getPropertyDeclarations()[e]}setPropertyAccessor(e){let t=this.getPropertyDeclarations(),n=[];if(e&&e.getProperty&&e.setProperty){let r=Object.keys(t);for(let i=0,a=r.length;i<a;i++){let a=r[i],o=t[a];if(o.internal||o.alias)continue;let s=this.offsetGetProperty(a),c=e.getProperty(a);c!==void 0&&!Object.is(s,c)&&(this.offsetSetProperty(a,c),n.push({key:a,newValue:c,oldValue:s}))}}this._propertyAccessor=e;for(let e=0,t=n.length;e<t;e++){let{key:t,newValue:r,oldValue:i}=n[e];this.requestUpdate(t,r,i)}return 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(),!1)}onUpdate(){this._update(this._updatedProperties),this._updatedProperties={}}onUpdateProperty(e,t,n){Object.is(t,n)||this.requestUpdate(e,t,n)}requestUpdate(e,t,n){e!==void 0&&(this._updatedProperties[e]=n,this._changedProperties.add(e),this._updateProperty(e,t,n),this.emit(`updateProperty`,e,t,n)),this._updating||(this._updatingPromise=this._enqueueUpdate())}_update(e){}_updateProperty(e,t,n){}toJSON(){return this.offsetGetProperties()}clone(){return new this.constructor(this.toJSON())}destroy(){this.emit(`destroy`),super.destroy()}};function R(e){let t;return t=typeof e==`number`?{r:e>>24&255,g:e>>16&255,b:e>>8&255,a:(e&255)/255}:e,S(t)}function me(e){return{r:w(e.r),g:w(e.g),b:w(e.b),a:w(e.a,3)}}function z(e){let t=e.toString(16);return t.length<2?`0${t}`:t}var B=`#000000FF`;function V(e){return R(e).isValid()}function H(e,t=!1){let n=R(e);if(!n.isValid()){if(typeof e==`string`)return e;let n=`Failed to normalizeColor ${e}`;if(t)throw Error(n);return console.warn(n),B}let{r,g:i,b:a,a:o}=me(n.rgba);return`#${z(r)}${z(i)}${z(a)}${z(w(o*255))}`}var U=U||{};U.parse=(function(){let e={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},t=``;function n(e){let n=Error(`${t}: ${e}`);throw n.source=t,n}function r(){let e=i();return t.length>0&&n(`Invalid input not EOF`),e}function i(){return _(a)}function a(){return o(`linear-gradient`,e.linearGradient,c)||o(`repeating-linear-gradient`,e.repeatingLinearGradient,c)||o(`radial-gradient`,e.radialGradient,d)||o(`repeating-radial-gradient`,e.repeatingRadialGradient,d)}function o(t,r,i){return s(r,r=>{let a=i();return a&&(k(e.comma)||n(`Missing comma before color stops`)),{type:t,orientation:a,colorStops:_(ne)}})}function s(t,r){let i=k(t);if(i){k(e.startCall)||n(`Missing (`);let t=r(i);return k(e.endCall)||n(`Missing )`),t}}function c(){let t=l();if(t)return t;let n=O(`position-keyword`,e.positionKeywords,1);return n?{type:`directional`,value:n.value}:u()}function l(){return O(`directional`,e.sideOrCorner,1)}function u(){return O(`angular`,e.angleValue,1)||O(`angular`,e.radianValue,1)}function d(){let n,r=f(),i;return r&&(n=[],n.push(r),i=t,k(e.comma)&&(r=f(),r?n.push(r):t=i)),n}function f(){let e=p()||ee();if(e)e.at=h();else{let t=m();if(t){e=t;let n=h();n&&(e.at=n)}else{let t=h();if(t)e={type:`default-radial`,at:t};else{let t=g();t&&(e={type:`default-radial`,at:t})}}}return e}function p(){let e=O(`shape`,/^(circle)/i,0);return e&&(e.style=D()||m()),e}function ee(){let e=O(`shape`,/^(ellipse)/i,0);return e&&(e.style=g()||w()||m()),e}function m(){return O(`extent-keyword`,e.extentKeywords,1)}function h(){if(O(`position`,/^at/,0)){let e=g();return e||n(`Missing positioning value`),e}}function g(){let e=te();if(e.x||e.y)return{type:`position`,value:e}}function te(){return{x:w(),y:w()}}function _(t){let r=t(),i=[];if(r)for(i.push(r);k(e.comma);)r=t(),r?i.push(r):n(`One extra comma`);return i}function ne(){let e=v();return e||n(`Expected color definition`),e.length=w(),e}function v(){return re()||S()||ae()||x()||b()||ie()||y()}function y(){return O(`literal`,e.literalColor,0)}function re(){return O(`hex`,e.hexColor,1)}function b(){return s(e.rgbColor,()=>({type:`rgb`,value:_(C)}))}function x(){return s(e.rgbaColor,()=>({type:`rgba`,value:_(C)}))}function ie(){return s(e.varColor,()=>({type:`var`,value:oe()}))}function ae(){return s(e.hslColor,()=>{k(e.percentageValue)&&n(`HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage`);let t=C();k(e.comma);let r=k(e.percentageValue),i=r?r[1]:null;k(e.comma),r=k(e.percentageValue);let a=r?r[1]:null;return(!i||!a)&&n(`Expected percentage value for saturation and lightness in HSL`),{type:`hsl`,value:[t,i,a]}})}function S(){return s(e.hslaColor,()=>{let t=C();k(e.comma);let r=k(e.percentageValue),i=r?r[1]:null;k(e.comma),r=k(e.percentageValue);let a=r?r[1]:null;k(e.comma);let o=C();return(!i||!a)&&n(`Expected percentage value for saturation and lightness in HSLA`),{type:`hsla`,value:[t,i,a,o]}})}function oe(){return k(e.variableName)[1]}function C(){return k(e.number)[1]}function w(){return O(`%`,e.percentageValue,1)||T()||E()||D()}function T(){return O(`position-keyword`,e.positionKeywords,1)}function E(){return s(e.calcValue,()=>{let e=1,r=0;for(;e>0&&r<t.length;){let n=t.charAt(r);n===`(`?e++:n===`)`&&e--,r++}e>0&&n(`Missing closing parenthesis in calc() expression`);let i=t.substring(0,r-1);return A(r-1),{type:`calc`,value:i}})}function D(){return O(`px`,e.pixelValue,1)||O(`em`,e.emValue,1)}function O(e,t,n){let r=k(t);if(r)return{type:e,value:r[n]}}function k(e){let n,r;return r=/^\s+/.exec(t),r&&A(r[0].length),n=e.exec(t),n&&A(n[0].length),n}function A(e){t=t.substr(e)}return function(e){return t=e.toString().trim(),t.endsWith(`;`)&&(t=t.slice(0,-1)),r()}})();var he=U.parse.bind(U),W=W||{};W.stringify=(function(){var e={"visit_linear-gradient":function(t){return e.visit_gradient(t)},"visit_repeating-linear-gradient":function(t){return e.visit_gradient(t)},"visit_radial-gradient":function(t){return e.visit_gradient(t)},"visit_repeating-radial-gradient":function(t){return e.visit_gradient(t)},visit_gradient:function(t){var n=e.visit(t.orientation);return n&&(n+=`, `),t.type+`(`+n+e.visit(t.colorStops)+`)`},visit_shape:function(t){var n=t.value,r=e.visit(t.at),i=e.visit(t.style);return i&&(n+=` `+i),r&&(n+=` at `+r),n},"visit_default-radial":function(t){var n=``,r=e.visit(t.at);return r&&(n+=r),n},"visit_extent-keyword":function(t){var n=t.value,r=e.visit(t.at);return r&&(n+=` at `+r),n},"visit_position-keyword":function(e){return e.value},visit_position:function(t){return e.visit(t.value.x)+` `+e.visit(t.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(t){return e.visit_color(t.value,t)},visit_hex:function(t){return e.visit_color(`#`+t.value,t)},visit_rgb:function(t){return e.visit_color(`rgb(`+t.value.join(`, `)+`)`,t)},visit_rgba:function(t){return e.visit_color(`rgba(`+t.value.join(`, `)+`)`,t)},visit_hsl:function(t){return e.visit_color(`hsl(`+t.value[0]+`, `+t.value[1]+`%, `+t.value[2]+`%)`,t)},visit_hsla:function(t){return e.visit_color(`hsla(`+t.value[0]+`, `+t.value[1]+`%, `+t.value[2]+`%, `+t.value[3]+`)`,t)},visit_var:function(t){return e.visit_color(`var(`+t.value+`)`,t)},visit_color:function(t,n){var r=t,i=e.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(t){var n=``,r=t.length;return t.forEach(function(t,i){n+=e.visit(t),i<r-1&&(n+=`, `)}),n},visit_object:function(t){return t.width&&t.height?e.visit(t.width)+` `+e.visit(t.height):``},visit:function(t){if(!t)return``;if(t instanceof Array)return e.visit_array(t);if(typeof t==`object`&&!t.type)return e.visit_object(t);if(t.type){var n=e[`visit_`+t.type];if(n)return n(t);throw Error(`Missing visitor visit_`+t.type)}else throw Error(`Invalid node.`)}};return function(t){return e.visit(t)}})();var ge=W.stringify.bind(W);function _e(e){let t=e.length-1;return e.map((e,n)=>{let r=e.value,i=w(n/t,3),a=`#00000000`;switch(e.type){case`rgb`:a=H({r:Number(r[0]??0),g:Number(r[1]??0),b:Number(r[2]??0)});break;case`rgba`:a=H({r:Number(r[0]??0),g:Number(r[1]??0),b:Number(r[2]??0),a:Number(r[3]??0)});break;case`literal`:a=H(e.value);break;case`hex`:a=H(`#${e.value}`);break}switch(e.length?.type){case`%`:i=Number(e.length.value)/100;break;case`px`:break;case`em`:break}return{offset:i,color:a}})}function ve(e){let t=0;switch(e.orientation?.type){case`angular`:t=Number(e.orientation.value);break;case`directional`:break}return{type:`linear-gradient`,angle:t,stops:_e(e.colorStops)}}function ye(e){return e.orientation?.map(e=>{switch(e?.type){default:return null}}),{type:`radial-gradient`,stops:_e(e.colorStops)}}function G(e){return e.startsWith(`linear-gradient(`)||e.startsWith(`radial-gradient(`)}function be(e){return he(e).map(e=>{switch(e?.type){case`linear-gradient`:return ve(e);case`repeating-linear-gradient`:return{...ve(e),repeat:!0};case`radial-gradient`:return ye(e);case`repeating-radial-gradient`:return{...ye(e),repeat:!0};default:return}}).filter(Boolean)}var K=[`color`];function xe(e){let t;return t=typeof e==`string`?{color:e}:{...e},t.color&&=H(t.color),E(t,K)}var q=[`linearGradient`,`radialGradient`,`rotateWithShape`];function Se(e){let t;if(t=typeof e==`string`?{image:e}:{...e},t.image){let{type:e,...n}=be(t.image)[0]??{};switch(e){case`radial-gradient`:return{radialGradient:n};case`linear-gradient`:return{linearGradient:n}}}return E(t,q)}var Ce=[`image`,`cropRect`,`stretchRect`,`tile`,`dpi`,`opacity`,`rotateWithShape`];function we(e){let t;return t=typeof e==`string`?{image:e}:{...e},E(t,Ce)}var Te=[`preset`,`foregroundColor`,`backgroundColor`];function Ee(e){let t;return t=typeof e==`string`?{preset:e}:{...e},C(t.foregroundColor)?delete t.foregroundColor:t.foregroundColor=H(t.foregroundColor),C(t.backgroundColor)?delete t.backgroundColor:t.backgroundColor=H(t.backgroundColor),E(t,Te)}function De(e){return!C(e.color)}function Oe(e){return typeof e==`string`?V(e):De(e)}function ke(e){return!C(e.image)&&G(e.image)||!!e.linearGradient||!!e.radialGradient}function Ae(e){return typeof e==`string`?G(e):ke(e)}function je(e){return!C(e.image)&&!G(e.image)}function Me(e){return typeof e==`string`?!V(e)&&!G(e):je(e)}function Ne(e){return!C(e.preset)}function Pe(e){return typeof e==`string`?!1:Ne(e)}function J(e){let t={enabled:e&&typeof e==`object`?e.enabled??!0:!0};return Oe(e)&&Object.assign(t,xe(e)),Ae(e)&&Object.assign(t,Se(e)),Me(e)&&Object.assign(t,we(e)),Pe(e)&&Object.assign(t,Ee(e)),E(T(t),Array.from(new Set([`enabled`,...K,...Ce,...q,...Te])))}function Fe(e){return typeof e==`string`?{...J(e)}:{...J(e),...E(e,[`fillWithShape`])}}function Ie(){return{backgroundImage:`none`,backgroundSize:`auto, auto`,backgroundColor:`none`,backgroundColormap:`none`}}function Y(e){return typeof e==`string`?{...J(e)}:{...J(e),...E(e,[`width`,`style`,`lineCap`,`lineJoin`,`headEnd`,`tailEnd`])}}function Le(){return{outlineWidth:0,outlineOffset:0,outlineColor:`none`,outlineStyle:`none`}}function Re(e){return typeof e==`string`?{enabled:!0,color:H(e)}:{...e,enabled:e.enabled??!0,color:C(e.color)?B:H(e.color)}}function ze(){return{boxShadow:`none`}}var Be=[`fill`,`outline`,`shadow`,`transform`,`transformOrigin`];function Ve(e){let t=E(e,Be),{rotate:n,scaleX:r,scaleY:i,skewX:a,skewY:o,translateX:s,translateY:c}=e,l=[];return(s||c)&&l.push(`translate(${s||0}, ${c||0})`),n&&l.push(`rotate(${n}deg)`),(r||i)&&l.push(`scale(${r??1}, ${i??1})`),a&&l.push(`skewX(${a}deg)`),o&&l.push(`skewY(${o}deg)`),l.length>0&&(t.transform=l.join(` `)),(e.textStrokeWidth||e.textStrokeColor)&&(t.outline={color:e.textStrokeColor,width:e.textStrokeWidth}),e.color&&(t.fill={color:e.color}),(e.shadowOffsetX||e.shadowOffsetY||e.shadowBlur||e.shadowColor)&&(t.shadow={offsetX:e.shadowOffsetX,offsetY:e.shadowOffsetY,blur:e.shadowBlur,color:e.shadowColor}),t}function He(e){let t=Ve(e);return T({fill:C(t.fill)?void 0:J(t.fill),outline:C(t.outline)?void 0:Y(t.outline),shadow:C(t.shadow)?void 0:Re(t.shadow),transform:C(t.transform)?void 0:t.transform,transformOrigin:t.transformOrigin})}function Ue(e){return typeof e==`string`?{...J(e)}:{...J(e),...E(e,[`fillWithShape`])}}var We=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,Ge=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=We[n[e]&63];return t},Ke=()=>Ge(10),qe=Ke;function Je(e){return typeof e==`string`?e.startsWith(`<svg`)?{enabled:!0,svg:e}:{enabled:!0,paths:[{data:e}]}:Array.isArray(e)?{enabled:!0,paths:e.map(e=>typeof e==`string`?{data:e}:e)}:e}function Ye(){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 Xe(){return{transform:`none`,transformOrigin:`center`}}function Ze(){return{...Ye(),...Xe(),...ze(),...Ie(),...Le(),borderRadius:0,borderColor:`none`,borderStyle:`solid`,visibility:`visible`,filter:`none`,opacity:1,pointerEvents:`auto`,maskImage:`none`}}function Qe(){return{highlight:{},highlightImage:`none`,highlightReferImage:`none`,highlightColormap:`none`,highlightLine:`none`,highlightSize:`cover`,highlightThickness:`100%`}}function $e(){return{listStyle:{},listStyleType:`none`,listStyleImage:`none`,listStyleColormap:`none`,listStyleSize:`cover`,listStylePosition:`outside`}}function et(){return{...Qe(),color:`#000000`,verticalAlign:`baseline`,letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:`normal`,fontFamily:``,fontStyle:`normal`,fontKerning:`normal`,textTransform:`none`,textOrientation:`mixed`,textDecoration:`none`}}function tt(){return{...$e(),writingMode:`horizontal-tb`,textWrap:`wrap`,textAlign:`start`,textIndent:0,lineHeight:1.2}}function nt(){return{...tt(),...et(),textStrokeWidth:0,textStrokeColor:`none`}}function X(e){return T({...e,color:C(e.color)?void 0:H(e.color),backgroundColor:C(e.backgroundColor)?void 0:H(e.backgroundColor),borderColor:C(e.borderColor)?void 0:H(e.borderColor),outlineColor:C(e.outlineColor)?void 0:H(e.outlineColor),shadowColor:C(e.shadowColor)?void 0:H(e.shadowColor),textStrokeColor:C(e.textStrokeColor)?void 0:H(e.textStrokeColor)})}function rt(){return{...Ze(),...nt()}}var Z=/\r\n|\n\r|\n|\r/,it=RegExp(`${Z.source}|<br\\/>`,`g`),at=RegExp(`^(${Z.source})$`),ot=`
2
+ `;function st(e){return Z.test(e)}function ct(e){return at.test(e)}function lt(e){return e.replace(it,ot)}function Q(e){let t=[];function n(){return t[t.length-1]}function r(e,n,r){let i=e?X(e):{},a=n?J(n):void 0,o=r?Y(r):void 0,s=T({...i,fill:a,outline:o,fragments:[]});return t[t.length-1]?.fragments.length===0?t[t.length-1]=s:t.push(s),s}function i(e=``,t,i,a){let o=t?X(t):{},s=i?J(i):void 0,c=a?Y(a):void 0;Array.from(e).forEach(e=>{if(ct(e)){let{fragments:e,fill:t,outline:i,...a}=n()||r();e.length||e.push(T({...o,fill:s,outline:c,content:ot})),r(a,t,i)}else{let t=n()||r(),i=t.fragments[t.fragments.length-1];if(i){let{content:t,fill:n,outline:r,...a}=i;if(D(s,n)&&D(c,r)&&D(o,a)){i.content=`${t}${e}`;return}}t.fragments.push(T({...o,fill:s,outline:c,content:e}))}})}(Array.isArray(e)?e:[e]).forEach(e=>{if(typeof e==`string`)r(),i(e);else if(dt(e)){let{content:t,fill:n,outline:a,...o}=e;r(o,n,a),i(t)}else if(ut(e)){let{fragments:t,fill:n,outline:a,...o}=e;r(o,n,a),t.forEach(e=>{let{content:t,fill:n,outline:r,...a}=e;i(t,a,n,r)})}else Array.isArray(e)?(r(),e.forEach(e=>{if(typeof e==`string`)i(e);else if(dt(e)){let{content:t,fill:n,outline:r,...a}=e;i(t,a,n,r)}})):console.warn(`Failed to parse text content`,e)});let a=n();return a&&!a.fragments.length&&a.fragments.push({content:``}),t}function ut(e){return e&&typeof e==`object`&&`fragments`in e&&Array.isArray(e.fragments)}function dt(e){return e&&typeof e==`object`&&`content`in e&&typeof e.content==`string`}function ft(e){return typeof e==`string`||Array.isArray(e)?{enabled:!0,content:Q(e)}:T({enabled:e.enabled??!0,content:Q(e.content??``),style:e.style?X(e.style):void 0,measureDom:e.measureDom,fonts:e.fonts,...He(e),effects:e.effects?e.effects.map(e=>He(e)):void 0})}function pt(e){return Q(e).map(e=>{let t=lt(e.fragments.flatMap(e=>e.content).join(``));return ct(t)?``:t}).join(ot)}function mt(e){return typeof e==`string`?{src:e}:e}function $(e){return T({id:e.id??qe(),style:C(e.style)?void 0:X(e.style),text:C(e.text)?void 0:ft(e.text),background:C(e.background)?void 0:Fe(e.background),shape:C(e.shape)?void 0:Je(e.shape),foreground:C(e.foreground)?void 0:Ue(e.foreground),video:C(e.video)?void 0:mt(e.video),audio:C(e.audio)?void 0:t(e.audio),...He(e),children:e.children?.map(e=>$(e))})}function ht(e){return $(e)}function gt(e){let t={};for(let n in e.children){let r=$(e.children[n]);delete r.children,t[n]=r}return{...e,children:t}}function _t(e){let{children:t,...n}=e;function r(e){let{parentId:t,childrenIds:n,...r}=e;return{...r,children:[]}}let i={},a=[],o={...n,children:a};function s(e){if(!t[e]||i[e])return;let n=t[e],o=r(n);i[e]=o;let c=n.parentId;if(c){s(c);let n=t[c],r=i[c];if(!r)return;n?.childrenIds&&r?.children&&(r.children[n.childrenIds.indexOf(e)]=o)}else a.push(o)}for(let e in t)s(e);return o}e.EventEmitter=oe,e.Observable=ce,e.RawWeakMap=le,e.Reactivable=pe,e.clearUndef=T,e.colorFillFields=K,e.defaultColor=B,e.defineProperty=ue,e.flatDocumentToDocument=_t,e.getDeclarations=N,e.getDefaultBackgroundStyle=Ie,e.getDefaultElementStyle=Ze,e.getDefaultHighlightStyle=Qe,e.getDefaultLayoutStyle=Ye,e.getDefaultListStyleStyle=$e,e.getDefaultOutlineStyle=Le,e.getDefaultShadowStyle=ze,e.getDefaultStyle=rt,e.getDefaultTextInlineStyle=et,e.getDefaultTextLineStyle=tt,e.getDefaultTextStyle=nt,e.getDefaultTransformStyle=Xe,e.getNestedValue=O,e.getObjectValueByPath=A,e.getPropertyDescriptor=L,e.gradientFillFields=q,e.hasCRLF=st,e.idGenerator=qe,e.imageFillFiedls=Ce,e.isCRLF=ct,e.isColor=V,e.isColorFill=Oe,e.isColorFillObject=De,e.isEqualObject=D,e.isFragmentObject=dt,e.isGradient=G,e.isGradientFill=Ae,e.isGradientFillObject=ke,e.isImageFill=Me,e.isImageFillObject=je,e.isNone=C,e.isParagraphObject=ut,e.isPresetFill=Pe,e.isPresetFillObject=Ne,e.nanoid=Ke,e.normalizeAudio=t,e.normalizeBackground=Fe,e.normalizeCRLF=lt,e.normalizeColor=H,e.normalizeColorFill=xe,e.normalizeDocument=ht,e.normalizeElement=$,e.normalizeFill=J,e.normalizeFlatDocument=gt,e.normalizeForeground=Ue,e.normalizeGradient=be,e.normalizeGradientFill=Se,e.normalizeImageFill=we,e.normalizeOutline=Y,e.normalizePresetFill=Ee,e.normalizeShadow=Re,e.normalizeShape=Je,e.normalizeStyle=X,e.normalizeText=ft,e.normalizeTextContent=Q,e.normalizeVideo=mt,e.parseColor=R,e.parseGradient=he,e.pick=E,e.presetFillFiedls=Te,e.property=de,e.property2=fe,e.propertyOffsetFallback=I,e.propertyOffsetGet=F,e.propertyOffsetSet=P,e.round=w,e.setNestedValue=k,e.setObjectValueByPath=se,e.stringifyGradient=ge,e.textContentToString=pt});