modern-idoc 0.11.3 → 0.11.5

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 CHANGED
@@ -1433,6 +1433,14 @@ function getDefaultBackgroundStyle() {
1433
1433
  };
1434
1434
  }
1435
1435
 
1436
+ function normalizeConnection(connection) {
1437
+ return clearUndef({
1438
+ start: connection.start,
1439
+ end: connection.end,
1440
+ mode: connection.mode ?? "straight"
1441
+ });
1442
+ }
1443
+
1436
1444
  function normalizeOutline(outline) {
1437
1445
  if (typeof outline === "string") {
1438
1446
  return {
@@ -1860,6 +1868,13 @@ function isParagraphObject(value) {
1860
1868
  function isFragmentObject(value) {
1861
1869
  return value && typeof value === "object" && "content" in value && typeof value.content === "string";
1862
1870
  }
1871
+ function normalizeTextDeformation(deformation) {
1872
+ return clearUndef({
1873
+ type: deformation.type,
1874
+ intensities: deformation.intensities,
1875
+ maxFontSize: deformation.maxFontSize ?? 100
1876
+ });
1877
+ }
1863
1878
  function normalizeText(value) {
1864
1879
  if (typeof value === "string" || Array.isArray(value)) {
1865
1880
  return {
@@ -1871,6 +1886,7 @@ function normalizeText(value) {
1871
1886
  enabled: value.enabled ?? true,
1872
1887
  content: normalizeTextContent(value.content ?? ""),
1873
1888
  style: value.style ? normalizeStyle(value.style) : void 0,
1889
+ deformation: value.deformation ? normalizeTextDeformation(value.deformation) : void 0,
1874
1890
  measureDom: value.measureDom,
1875
1891
  fonts: value.fonts,
1876
1892
  ...normalizeEffect(value),
@@ -1908,6 +1924,7 @@ function normalizeElement(element) {
1908
1924
  foreground: isNone(element.foreground) ? void 0 : normalizeForeground(element.foreground),
1909
1925
  video: isNone(element.video) ? void 0 : normalizeVideo(element.video),
1910
1926
  audio: isNone(element.audio) ? void 0 : normalizeAudio(element.audio),
1927
+ connection: isNone(element.connection) ? void 0 : normalizeConnection(element.connection),
1911
1928
  ...normalizeEffect(element),
1912
1929
  children: element.children?.map((child) => normalizeElement(child))
1913
1930
  });
@@ -2020,6 +2037,7 @@ exports.normalizeBackground = normalizeBackground;
2020
2037
  exports.normalizeCRLF = normalizeCRLF;
2021
2038
  exports.normalizeColor = normalizeColor;
2022
2039
  exports.normalizeColorFill = normalizeColorFill;
2040
+ exports.normalizeConnection = normalizeConnection;
2023
2041
  exports.normalizeDocument = normalizeDocument;
2024
2042
  exports.normalizeEffect = normalizeEffect;
2025
2043
  exports.normalizeElement = normalizeElement;
@@ -2036,6 +2054,7 @@ exports.normalizeShape = normalizeShape;
2036
2054
  exports.normalizeStyle = normalizeStyle;
2037
2055
  exports.normalizeText = normalizeText;
2038
2056
  exports.normalizeTextContent = normalizeTextContent;
2057
+ exports.normalizeTextDeformation = normalizeTextDeformation;
2039
2058
  exports.normalizeVideo = normalizeVideo;
2040
2059
  exports.parseColor = parseColor;
2041
2060
  exports.parseGradient = parseGradient;
package/dist/index.d.cts CHANGED
@@ -334,6 +334,23 @@ interface NormalizedBackgroundStyle {
334
334
  }
335
335
  declare function getDefaultBackgroundStyle(): NormalizedBackgroundStyle;
336
336
 
337
+ type ConnectionMode = 'straight' | 'orthogonal' | 'curved';
338
+ interface ConnectionAnchor {
339
+ id: string;
340
+ idx?: number;
341
+ }
342
+ interface Connection {
343
+ start?: ConnectionAnchor;
344
+ end?: ConnectionAnchor;
345
+ mode?: ConnectionMode;
346
+ }
347
+ interface NormalizedConnection {
348
+ start?: ConnectionAnchor;
349
+ end?: ConnectionAnchor;
350
+ mode: ConnectionMode;
351
+ }
352
+ declare function normalizeConnection(connection: Connection): NormalizedConnection;
353
+
337
354
  interface PropertyDeclaration {
338
355
  [key: string]: unknown;
339
356
  default?: unknown | (() => unknown);
@@ -497,11 +514,18 @@ interface ShapePathStyle {
497
514
  interface ShapePath extends Partial<ShapePathStyle> {
498
515
  data: SVGPathData;
499
516
  }
517
+ interface ShapeConnectionPoint {
518
+ idx: number;
519
+ x: number;
520
+ y: number;
521
+ ang?: number;
522
+ }
500
523
  interface NormalizedShape extends Toggleable {
501
524
  preset?: string;
502
525
  viewBox?: number[];
503
526
  svg?: string;
504
527
  paths?: ShapePath[];
528
+ connectionPoints?: ShapeConnectionPoint[];
505
529
  }
506
530
  declare function normalizeShape(shape: Shape): NormalizedShape;
507
531
 
@@ -716,9 +740,20 @@ interface NormalizedParagraph extends NormalizedStyle {
716
740
  type FlatTextContent = string | FragmentObject | ParagraphObject | (string | FragmentObject)[];
717
741
  type TextContent = FlatTextContent | FlatTextContent[];
718
742
  type NormalizedTextContent = NormalizedParagraph[];
743
+ interface TextDeformation {
744
+ type: string;
745
+ intensities?: number[];
746
+ maxFontSize?: number;
747
+ }
748
+ interface NormalizedTextDeformation {
749
+ type: string;
750
+ intensities?: number[];
751
+ maxFontSize: number;
752
+ }
719
753
  interface TextObject extends Pick<Effect, 'fill' | 'outline'>, Partial<Toggleable> {
720
754
  content?: TextContent;
721
755
  style?: Style;
756
+ deformation?: TextDeformation;
722
757
  measureDom?: any;
723
758
  fonts?: any;
724
759
  effects?: Effect[];
@@ -726,6 +761,7 @@ interface TextObject extends Pick<Effect, 'fill' | 'outline'>, Partial<Toggleabl
726
761
  interface NormalizedText extends Pick<NormalizedEffect, 'fill' | 'outline'>, Toggleable {
727
762
  content: NormalizedTextContent;
728
763
  style?: NormalizedStyle;
764
+ deformation?: NormalizedTextDeformation;
729
765
  effects?: NormalizedEffect[];
730
766
  measureDom?: any;
731
767
  fonts?: any;
@@ -736,6 +772,7 @@ declare function normalizeCRLF(content: string): string;
736
772
  declare function normalizeTextContent(value: TextContent): NormalizedTextContent;
737
773
  declare function isParagraphObject(value: any): value is ParagraphObject;
738
774
  declare function isFragmentObject(value: any): value is FragmentObject;
775
+ declare function normalizeTextDeformation(deformation: TextDeformation): NormalizedTextDeformation;
739
776
  declare function normalizeText(value: Text): NormalizedText;
740
777
  declare function textContentToString(value: TextContent): string;
741
778
 
@@ -754,6 +791,7 @@ interface Element<T = Meta> extends Effect, Omit<Node<T>, 'children'> {
754
791
  foreground?: WithNone<Foreground>;
755
792
  video?: WithNone<Video>;
756
793
  audio?: WithNone<Audio>;
794
+ connection?: WithNone<Connection>;
757
795
  children?: Element[];
758
796
  }
759
797
  interface NormalizedElement<T = Meta> extends NormalizedEffect, Omit<Node<T>, 'children'> {
@@ -765,6 +803,7 @@ interface NormalizedElement<T = Meta> extends NormalizedEffect, Omit<Node<T>, 'c
765
803
  foreground?: NormalizedForeground;
766
804
  video?: NormalizedVideo;
767
805
  audio?: NormalizedAudio;
806
+ connection?: NormalizedConnection;
768
807
  children?: NormalizedElement[];
769
808
  }
770
809
  declare function normalizeElement<T = Meta>(element: Element<T>): NormalizedElement<T>;
@@ -898,5 +937,5 @@ declare class Reactivable extends Observable implements PropertyAccessor {
898
937
  destroy(): void;
899
938
  }
900
939
 
901
- export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, colorFillFields, defaultColor, defineProperty, effectFields, 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, normalizeEffect, 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 };
902
- export type { Align, AngularNode, Audio, Background, BackgroundObject, BackgroundSize, BorderStyle, BoxShadow, BoxSizing, CmykColor, CmykaColor, Color, ColorFill, ColorFillObject, ColorStop, ColorStopNode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, Effect, 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, NormalizedEffect, 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, _EffectV0 };
940
+ export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, colorFillFields, defaultColor, defineProperty, effectFields, 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, normalizeConnection, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeStyle, normalizeText, normalizeTextContent, normalizeTextDeformation, normalizeVideo, parseColor, parseGradient, pick, presetFillFiedls, property, property2, propertyOffsetFallback, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyGradient, textContentToString };
941
+ export type { Align, AngularNode, Audio, Background, BackgroundObject, BackgroundSize, BorderStyle, BoxShadow, BoxSizing, CmykColor, CmykaColor, Color, ColorFill, ColorFillObject, ColorStop, ColorStopNode, Connection, ConnectionAnchor, ConnectionMode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, Effect, 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, NormalizedConnection, NormalizedDocument, NormalizedEffect, NormalizedElement, NormalizedElementStyle, NormalizedFill, NormalizedFlatDocument, NormalizedFlatElement, NormalizedForeground, NormalizedFragment, NormalizedGradientFill, NormalizedHighlight, NormalizedHighlightStyle, NormalizedImageFill, NormalizedLayoutStyle, NormalizedListStyle, NormalizedListStyleStyle, NormalizedOutline, NormalizedOutlineStyle, NormalizedParagraph, NormalizedPresetFill, NormalizedShadow, NormalizedShadowStyle, NormalizedShape, NormalizedStyle, NormalizedText, NormalizedTextContent, NormalizedTextDeformation, 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, ShapeConnectionPoint, ShapeNode, ShapePath, ShapePathStyle, StrokeLinecap, StrokeLinejoin, Style, StyleObject, StyleUnit, TailEnd, Text, TextAlign, TextContent, TextDecoration, TextDeformation, TextObject, TextOrientation, TextTransform, TextWrap, Toggleable, Uint32Color, VerticalAlign, Video, Visibility, WithNone, WithStyleNone, WritingMode, XyzColor, XyzaColor, _EffectV0 };
package/dist/index.d.mts CHANGED
@@ -334,6 +334,23 @@ interface NormalizedBackgroundStyle {
334
334
  }
335
335
  declare function getDefaultBackgroundStyle(): NormalizedBackgroundStyle;
336
336
 
337
+ type ConnectionMode = 'straight' | 'orthogonal' | 'curved';
338
+ interface ConnectionAnchor {
339
+ id: string;
340
+ idx?: number;
341
+ }
342
+ interface Connection {
343
+ start?: ConnectionAnchor;
344
+ end?: ConnectionAnchor;
345
+ mode?: ConnectionMode;
346
+ }
347
+ interface NormalizedConnection {
348
+ start?: ConnectionAnchor;
349
+ end?: ConnectionAnchor;
350
+ mode: ConnectionMode;
351
+ }
352
+ declare function normalizeConnection(connection: Connection): NormalizedConnection;
353
+
337
354
  interface PropertyDeclaration {
338
355
  [key: string]: unknown;
339
356
  default?: unknown | (() => unknown);
@@ -497,11 +514,18 @@ interface ShapePathStyle {
497
514
  interface ShapePath extends Partial<ShapePathStyle> {
498
515
  data: SVGPathData;
499
516
  }
517
+ interface ShapeConnectionPoint {
518
+ idx: number;
519
+ x: number;
520
+ y: number;
521
+ ang?: number;
522
+ }
500
523
  interface NormalizedShape extends Toggleable {
501
524
  preset?: string;
502
525
  viewBox?: number[];
503
526
  svg?: string;
504
527
  paths?: ShapePath[];
528
+ connectionPoints?: ShapeConnectionPoint[];
505
529
  }
506
530
  declare function normalizeShape(shape: Shape): NormalizedShape;
507
531
 
@@ -716,9 +740,20 @@ interface NormalizedParagraph extends NormalizedStyle {
716
740
  type FlatTextContent = string | FragmentObject | ParagraphObject | (string | FragmentObject)[];
717
741
  type TextContent = FlatTextContent | FlatTextContent[];
718
742
  type NormalizedTextContent = NormalizedParagraph[];
743
+ interface TextDeformation {
744
+ type: string;
745
+ intensities?: number[];
746
+ maxFontSize?: number;
747
+ }
748
+ interface NormalizedTextDeformation {
749
+ type: string;
750
+ intensities?: number[];
751
+ maxFontSize: number;
752
+ }
719
753
  interface TextObject extends Pick<Effect, 'fill' | 'outline'>, Partial<Toggleable> {
720
754
  content?: TextContent;
721
755
  style?: Style;
756
+ deformation?: TextDeformation;
722
757
  measureDom?: any;
723
758
  fonts?: any;
724
759
  effects?: Effect[];
@@ -726,6 +761,7 @@ interface TextObject extends Pick<Effect, 'fill' | 'outline'>, Partial<Toggleabl
726
761
  interface NormalizedText extends Pick<NormalizedEffect, 'fill' | 'outline'>, Toggleable {
727
762
  content: NormalizedTextContent;
728
763
  style?: NormalizedStyle;
764
+ deformation?: NormalizedTextDeformation;
729
765
  effects?: NormalizedEffect[];
730
766
  measureDom?: any;
731
767
  fonts?: any;
@@ -736,6 +772,7 @@ declare function normalizeCRLF(content: string): string;
736
772
  declare function normalizeTextContent(value: TextContent): NormalizedTextContent;
737
773
  declare function isParagraphObject(value: any): value is ParagraphObject;
738
774
  declare function isFragmentObject(value: any): value is FragmentObject;
775
+ declare function normalizeTextDeformation(deformation: TextDeformation): NormalizedTextDeformation;
739
776
  declare function normalizeText(value: Text): NormalizedText;
740
777
  declare function textContentToString(value: TextContent): string;
741
778
 
@@ -754,6 +791,7 @@ interface Element<T = Meta> extends Effect, Omit<Node<T>, 'children'> {
754
791
  foreground?: WithNone<Foreground>;
755
792
  video?: WithNone<Video>;
756
793
  audio?: WithNone<Audio>;
794
+ connection?: WithNone<Connection>;
757
795
  children?: Element[];
758
796
  }
759
797
  interface NormalizedElement<T = Meta> extends NormalizedEffect, Omit<Node<T>, 'children'> {
@@ -765,6 +803,7 @@ interface NormalizedElement<T = Meta> extends NormalizedEffect, Omit<Node<T>, 'c
765
803
  foreground?: NormalizedForeground;
766
804
  video?: NormalizedVideo;
767
805
  audio?: NormalizedAudio;
806
+ connection?: NormalizedConnection;
768
807
  children?: NormalizedElement[];
769
808
  }
770
809
  declare function normalizeElement<T = Meta>(element: Element<T>): NormalizedElement<T>;
@@ -898,5 +937,5 @@ declare class Reactivable extends Observable implements PropertyAccessor {
898
937
  destroy(): void;
899
938
  }
900
939
 
901
- export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, colorFillFields, defaultColor, defineProperty, effectFields, 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, normalizeEffect, 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 };
902
- export type { Align, AngularNode, Audio, Background, BackgroundObject, BackgroundSize, BorderStyle, BoxShadow, BoxSizing, CmykColor, CmykaColor, Color, ColorFill, ColorFillObject, ColorStop, ColorStopNode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, Effect, 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, NormalizedEffect, 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, _EffectV0 };
940
+ export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, colorFillFields, defaultColor, defineProperty, effectFields, 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, normalizeConnection, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeStyle, normalizeText, normalizeTextContent, normalizeTextDeformation, normalizeVideo, parseColor, parseGradient, pick, presetFillFiedls, property, property2, propertyOffsetFallback, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyGradient, textContentToString };
941
+ export type { Align, AngularNode, Audio, Background, BackgroundObject, BackgroundSize, BorderStyle, BoxShadow, BoxSizing, CmykColor, CmykaColor, Color, ColorFill, ColorFillObject, ColorStop, ColorStopNode, Connection, ConnectionAnchor, ConnectionMode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, Effect, 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, NormalizedConnection, NormalizedDocument, NormalizedEffect, NormalizedElement, NormalizedElementStyle, NormalizedFill, NormalizedFlatDocument, NormalizedFlatElement, NormalizedForeground, NormalizedFragment, NormalizedGradientFill, NormalizedHighlight, NormalizedHighlightStyle, NormalizedImageFill, NormalizedLayoutStyle, NormalizedListStyle, NormalizedListStyleStyle, NormalizedOutline, NormalizedOutlineStyle, NormalizedParagraph, NormalizedPresetFill, NormalizedShadow, NormalizedShadowStyle, NormalizedShape, NormalizedStyle, NormalizedText, NormalizedTextContent, NormalizedTextDeformation, 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, ShapeConnectionPoint, ShapeNode, ShapePath, ShapePathStyle, StrokeLinecap, StrokeLinejoin, Style, StyleObject, StyleUnit, TailEnd, Text, TextAlign, TextContent, TextDecoration, TextDeformation, TextObject, TextOrientation, TextTransform, TextWrap, Toggleable, Uint32Color, VerticalAlign, Video, Visibility, WithNone, WithStyleNone, WritingMode, XyzColor, XyzaColor, _EffectV0 };
package/dist/index.d.ts CHANGED
@@ -334,6 +334,23 @@ interface NormalizedBackgroundStyle {
334
334
  }
335
335
  declare function getDefaultBackgroundStyle(): NormalizedBackgroundStyle;
336
336
 
337
+ type ConnectionMode = 'straight' | 'orthogonal' | 'curved';
338
+ interface ConnectionAnchor {
339
+ id: string;
340
+ idx?: number;
341
+ }
342
+ interface Connection {
343
+ start?: ConnectionAnchor;
344
+ end?: ConnectionAnchor;
345
+ mode?: ConnectionMode;
346
+ }
347
+ interface NormalizedConnection {
348
+ start?: ConnectionAnchor;
349
+ end?: ConnectionAnchor;
350
+ mode: ConnectionMode;
351
+ }
352
+ declare function normalizeConnection(connection: Connection): NormalizedConnection;
353
+
337
354
  interface PropertyDeclaration {
338
355
  [key: string]: unknown;
339
356
  default?: unknown | (() => unknown);
@@ -497,11 +514,18 @@ interface ShapePathStyle {
497
514
  interface ShapePath extends Partial<ShapePathStyle> {
498
515
  data: SVGPathData;
499
516
  }
517
+ interface ShapeConnectionPoint {
518
+ idx: number;
519
+ x: number;
520
+ y: number;
521
+ ang?: number;
522
+ }
500
523
  interface NormalizedShape extends Toggleable {
501
524
  preset?: string;
502
525
  viewBox?: number[];
503
526
  svg?: string;
504
527
  paths?: ShapePath[];
528
+ connectionPoints?: ShapeConnectionPoint[];
505
529
  }
506
530
  declare function normalizeShape(shape: Shape): NormalizedShape;
507
531
 
@@ -716,9 +740,20 @@ interface NormalizedParagraph extends NormalizedStyle {
716
740
  type FlatTextContent = string | FragmentObject | ParagraphObject | (string | FragmentObject)[];
717
741
  type TextContent = FlatTextContent | FlatTextContent[];
718
742
  type NormalizedTextContent = NormalizedParagraph[];
743
+ interface TextDeformation {
744
+ type: string;
745
+ intensities?: number[];
746
+ maxFontSize?: number;
747
+ }
748
+ interface NormalizedTextDeformation {
749
+ type: string;
750
+ intensities?: number[];
751
+ maxFontSize: number;
752
+ }
719
753
  interface TextObject extends Pick<Effect, 'fill' | 'outline'>, Partial<Toggleable> {
720
754
  content?: TextContent;
721
755
  style?: Style;
756
+ deformation?: TextDeformation;
722
757
  measureDom?: any;
723
758
  fonts?: any;
724
759
  effects?: Effect[];
@@ -726,6 +761,7 @@ interface TextObject extends Pick<Effect, 'fill' | 'outline'>, Partial<Toggleabl
726
761
  interface NormalizedText extends Pick<NormalizedEffect, 'fill' | 'outline'>, Toggleable {
727
762
  content: NormalizedTextContent;
728
763
  style?: NormalizedStyle;
764
+ deformation?: NormalizedTextDeformation;
729
765
  effects?: NormalizedEffect[];
730
766
  measureDom?: any;
731
767
  fonts?: any;
@@ -736,6 +772,7 @@ declare function normalizeCRLF(content: string): string;
736
772
  declare function normalizeTextContent(value: TextContent): NormalizedTextContent;
737
773
  declare function isParagraphObject(value: any): value is ParagraphObject;
738
774
  declare function isFragmentObject(value: any): value is FragmentObject;
775
+ declare function normalizeTextDeformation(deformation: TextDeformation): NormalizedTextDeformation;
739
776
  declare function normalizeText(value: Text): NormalizedText;
740
777
  declare function textContentToString(value: TextContent): string;
741
778
 
@@ -754,6 +791,7 @@ interface Element<T = Meta> extends Effect, Omit<Node<T>, 'children'> {
754
791
  foreground?: WithNone<Foreground>;
755
792
  video?: WithNone<Video>;
756
793
  audio?: WithNone<Audio>;
794
+ connection?: WithNone<Connection>;
757
795
  children?: Element[];
758
796
  }
759
797
  interface NormalizedElement<T = Meta> extends NormalizedEffect, Omit<Node<T>, 'children'> {
@@ -765,6 +803,7 @@ interface NormalizedElement<T = Meta> extends NormalizedEffect, Omit<Node<T>, 'c
765
803
  foreground?: NormalizedForeground;
766
804
  video?: NormalizedVideo;
767
805
  audio?: NormalizedAudio;
806
+ connection?: NormalizedConnection;
768
807
  children?: NormalizedElement[];
769
808
  }
770
809
  declare function normalizeElement<T = Meta>(element: Element<T>): NormalizedElement<T>;
@@ -898,5 +937,5 @@ declare class Reactivable extends Observable implements PropertyAccessor {
898
937
  destroy(): void;
899
938
  }
900
939
 
901
- export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, colorFillFields, defaultColor, defineProperty, effectFields, 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, normalizeEffect, 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 };
902
- export type { Align, AngularNode, Audio, Background, BackgroundObject, BackgroundSize, BorderStyle, BoxShadow, BoxSizing, CmykColor, CmykaColor, Color, ColorFill, ColorFillObject, ColorStop, ColorStopNode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, Effect, 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, NormalizedEffect, 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, _EffectV0 };
940
+ export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, colorFillFields, defaultColor, defineProperty, effectFields, 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, normalizeConnection, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeStyle, normalizeText, normalizeTextContent, normalizeTextDeformation, normalizeVideo, parseColor, parseGradient, pick, presetFillFiedls, property, property2, propertyOffsetFallback, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyGradient, textContentToString };
941
+ export type { Align, AngularNode, Audio, Background, BackgroundObject, BackgroundSize, BorderStyle, BoxShadow, BoxSizing, CmykColor, CmykaColor, Color, ColorFill, ColorFillObject, ColorStop, ColorStopNode, Connection, ConnectionAnchor, ConnectionMode, DefaultRadialNode, Direction, DirectionalNode, Display, Document, Effect, 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, NormalizedConnection, NormalizedDocument, NormalizedEffect, NormalizedElement, NormalizedElementStyle, NormalizedFill, NormalizedFlatDocument, NormalizedFlatElement, NormalizedForeground, NormalizedFragment, NormalizedGradientFill, NormalizedHighlight, NormalizedHighlightStyle, NormalizedImageFill, NormalizedLayoutStyle, NormalizedListStyle, NormalizedListStyleStyle, NormalizedOutline, NormalizedOutlineStyle, NormalizedParagraph, NormalizedPresetFill, NormalizedShadow, NormalizedShadowStyle, NormalizedShape, NormalizedStyle, NormalizedText, NormalizedTextContent, NormalizedTextDeformation, 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, ShapeConnectionPoint, ShapeNode, ShapePath, ShapePathStyle, StrokeLinecap, StrokeLinejoin, Style, StyleObject, StyleUnit, TailEnd, Text, TextAlign, TextContent, TextDecoration, TextDeformation, TextObject, TextOrientation, TextTransform, TextWrap, Toggleable, Uint32Color, VerticalAlign, Video, Visibility, WithNone, WithStyleNone, WritingMode, XyzColor, XyzaColor, _EffectV0 };
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
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}},ue=Symbol.for(`declarations`),j=Symbol.for(`inited`);function M(e){let t;if(Object.hasOwn(e,ue))t=e[ue];else{let n=Object.getPrototypeOf(e);t={...n?M(n):{}},e[ue]=t}return t}function N(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??F(e,t,r),o)}function P(e,t,n){let{alias:r,internalKey:i}=n,a;return a=r?A(e,r):e[i],a??=F(e,t,n),a}function F(e,t,n){let{default:r,fallback:i}=n,a;if(r!==void 0&&!e[j]?.[t]){e[j]||(e[j]={}),e[j][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 I(e,t){function n(){return this.getProperty?this.getProperty(e):P(this,e,t)}function r(n){this.setProperty?this.setProperty(e,n):N(this,e,n,t)}return{get:n,set:r}}function de(e,t,n={}){let r={...n,internalKey:Symbol.for(t)},i=M(e);i[t]=r;let{get:a,set:o}=I(t,r);Object.defineProperty(e.prototype,t,{get(){return a.call(this)},set(e){o.call(this,e)},configurable:!0,enumerable:!0})}function fe(e){return function(t,n){if(typeof n!=`string`)throw TypeError(`Failed to @property decorator, prop name cannot be a symbol`);de(t.constructor,n,e)}}function pe(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=I(r,i);return{init(e){let t=M(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 me=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 P(this,e,t);{let n=this._propertyAccessor,r;return r=n&&n.getProperty?n.getProperty(e):this.offsetGetProperty(e),r??F(this,e,t)}}}setProperty(e,t){let n=this.getPropertyDeclaration(e);if(n)if(n.internal||n.alias)N(this,e,t,n);else{let r=this.getProperty(e);this._propertyAccessor?.setProperty?.(e,t),this.offsetSetProperty(e,t),this.onUpdateProperty?.(e,t??F(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 M(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 L(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 he(e){return{r:w(e.r),g:w(e.g),b:w(e.b),a:w(e.a,3)}}function R(e){let t=e.toString(16);return t.length<2?`0${t}`:t}var z=`#000000FF`;function B(e){return L(e).isValid()}function V(e,t=!1){let n=L(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),z}let{r,g:i,b:a,a:o}=he(n.rgba);return`#${R(r)}${R(i)}${R(a)}${R(w(o*255))}`}var H=H||{};H.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 ge=H.parse.bind(H),U=U||{};U.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 _e=U.stringify.bind(U);function ve(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=V({r:Number(r[0]??0),g:Number(r[1]??0),b:Number(r[2]??0)});break;case`rgba`:a=V({r:Number(r[0]??0),g:Number(r[1]??0),b:Number(r[2]??0),a:Number(r[3]??0)});break;case`literal`:a=V(e.value);break;case`hex`:a=V(`#${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 ye(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:ve(e.colorStops)}}function be(e){return e.orientation?.map(e=>{switch(e?.type){default:return null}}),{type:`radial-gradient`,stops:ve(e.colorStops)}}function W(e){return e.startsWith(`linear-gradient(`)||e.startsWith(`radial-gradient(`)}function xe(e){return ge(e).map(e=>{switch(e?.type){case`linear-gradient`:return ye(e);case`repeating-linear-gradient`:return{...ye(e),repeat:!0};case`radial-gradient`:return be(e);case`repeating-radial-gradient`:return{...be(e),repeat:!0};default:return}}).filter(Boolean)}var G=[`color`];function Se(e){let t;return t=typeof e==`string`?{color:e}:{...e},t.color&&=V(t.color),E(t,G)}var K=[`linearGradient`,`radialGradient`,`rotateWithShape`];function Ce(e){let t;if(t=typeof e==`string`?{image:e}:{...e},t.image){let{type:e,...n}=xe(t.image)[0]??{};switch(e){case`radial-gradient`:return{radialGradient:n};case`linear-gradient`:return{linearGradient:n}}}return E(t,K)}var we=[`image`,`cropRect`,`stretchRect`,`tile`,`dpi`,`opacity`,`rotateWithShape`];function Te(e){let t;return t=typeof e==`string`?{image:e}:{...e},E(t,we)}var Ee=[`preset`,`foregroundColor`,`backgroundColor`];function De(e){let t;return t=typeof e==`string`?{preset:e}:{...e},C(t.foregroundColor)?delete t.foregroundColor:t.foregroundColor=V(t.foregroundColor),C(t.backgroundColor)?delete t.backgroundColor:t.backgroundColor=V(t.backgroundColor),E(t,Ee)}function Oe(e){return!C(e.color)}function ke(e){return typeof e==`string`?B(e):Oe(e)}function Ae(e){return!C(e.image)&&W(e.image)||!!e.linearGradient||!!e.radialGradient}function je(e){return typeof e==`string`?W(e):Ae(e)}function Me(e){return!C(e.image)&&!W(e.image)}function Ne(e){return typeof e==`string`?!B(e)&&!W(e):Me(e)}function Pe(e){return!C(e.preset)}function Fe(e){return typeof e==`string`?!1:Pe(e)}function q(e){let t={enabled:e&&typeof e==`object`?e.enabled??!0:!0};return ke(e)&&Object.assign(t,Se(e)),je(e)&&Object.assign(t,Ce(e)),Ne(e)&&Object.assign(t,Te(e)),Fe(e)&&Object.assign(t,De(e)),E(T(t),Array.from(new Set([`enabled`,...G,...we,...K,...Ee])))}function Ie(e){return typeof e==`string`?{...q(e)}:{...q(e),...E(e,[`fillWithShape`])}}function Le(){return{backgroundImage:`none`,backgroundSize:`auto, auto`,backgroundColor:`none`,backgroundColormap:`none`}}function J(e){return typeof e==`string`?{...q(e)}:{...q(e),...E(e,[`width`,`style`,`lineCap`,`lineJoin`,`headEnd`,`tailEnd`])}}function Re(){return{outlineWidth:0,outlineOffset:0,outlineColor:`none`,outlineStyle:`none`}}function ze(e){return typeof e==`string`?{enabled:!0,color:V(e)}:{...e,enabled:e.enabled??!0,color:C(e.color)?z:V(e.color)}}function Be(){return{boxShadow:`none`}}var Ve=[`fill`,`outline`,`shadow`,`transform`,`transformOrigin`];function He(e){let t=E(e,Ve),{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 Y(e){let t=He(e);return T({fill:C(t.fill)?void 0:q(t.fill),outline:C(t.outline)?void 0:J(t.outline),shadow:C(t.shadow)?void 0:ze(t.shadow),transform:C(t.transform)?void 0:t.transform,transformOrigin:t.transformOrigin})}function Ue(e){return typeof e==`string`?{...q(e)}:{...q(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{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:`none`,transformOrigin:`center`}}function Ze(){return{...Ye(),...Xe(),...Be(),...Le(),...Re(),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:V(e.color),backgroundColor:C(e.backgroundColor)?void 0:V(e.backgroundColor),borderColor:C(e.borderColor)?void 0:V(e.borderColor),outlineColor:C(e.outlineColor)?void 0:V(e.outlineColor),shadowColor:C(e.shadowColor)?void 0:V(e.shadowColor),textStrokeColor:C(e.textStrokeColor)?void 0:V(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?q(n):void 0,o=r?J(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?q(i):void 0,c=a?J(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,...Y(e),effects:e.effects?e.effects.map(e=>Y(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:Ie(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),...Y(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=me,e.clearUndef=T,e.colorFillFields=G,e.defaultColor=z,e.defineProperty=de,e.effectFields=Ve,e.flatDocumentToDocument=_t,e.getDeclarations=M,e.getDefaultBackgroundStyle=Le,e.getDefaultElementStyle=Ze,e.getDefaultHighlightStyle=Qe,e.getDefaultLayoutStyle=Ye,e.getDefaultListStyleStyle=$e,e.getDefaultOutlineStyle=Re,e.getDefaultShadowStyle=Be,e.getDefaultStyle=rt,e.getDefaultTextInlineStyle=et,e.getDefaultTextLineStyle=tt,e.getDefaultTextStyle=nt,e.getDefaultTransformStyle=Xe,e.getNestedValue=O,e.getObjectValueByPath=A,e.getPropertyDescriptor=I,e.gradientFillFields=K,e.hasCRLF=st,e.idGenerator=qe,e.imageFillFiedls=we,e.isCRLF=ct,e.isColor=B,e.isColorFill=ke,e.isColorFillObject=Oe,e.isEqualObject=D,e.isFragmentObject=dt,e.isGradient=W,e.isGradientFill=je,e.isGradientFillObject=Ae,e.isImageFill=Ne,e.isImageFillObject=Me,e.isNone=C,e.isParagraphObject=ut,e.isPresetFill=Fe,e.isPresetFillObject=Pe,e.nanoid=Ke,e.normalizeAudio=t,e.normalizeBackground=Ie,e.normalizeCRLF=lt,e.normalizeColor=V,e.normalizeColorFill=Se,e.normalizeDocument=ht,e.normalizeEffect=Y,e.normalizeElement=$,e.normalizeFill=q,e.normalizeFlatDocument=gt,e.normalizeForeground=Ue,e.normalizeGradient=xe,e.normalizeGradientFill=Ce,e.normalizeImageFill=Te,e.normalizeOutline=J,e.normalizePresetFill=De,e.normalizeShadow=ze,e.normalizeShape=Je,e.normalizeStyle=X,e.normalizeText=ft,e.normalizeTextContent=Q,e.normalizeVideo=mt,e.parseColor=L,e.parseGradient=ge,e.pick=E,e.presetFillFiedls=Ee,e.property=fe,e.property2=pe,e.propertyOffsetFallback=F,e.propertyOffsetGet=P,e.propertyOffsetSet=N,e.round=w,e.setNestedValue=k,e.setObjectValueByPath=se,e.stringifyGradient=_e,e.textContentToString=pt});
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}},ee=function(e){return{h:o(e.h),s:a(e.s,0,100),l:a(e.l,0,100),a:a(e.a)}},p=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(ee({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(ee({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},S=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}},C=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 p(h(this.rgba))},e.prototype.toHslString=function(){return e=p(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 w({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),w(b(this.rgba,e))},e.prototype.desaturate=function(e){return e===void 0&&(e=.1),w(b(this.rgba,-e))},e.prototype.grayscale=function(){return w(b(this.rgba,-1))},e.prototype.lighten=function(e){return e===void 0&&(e=.1),w(S(this.rgba,e))},e.prototype.darken=function(e){return e===void 0&&(e=.1),w(S(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`?w({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`?w({h:e,s:t.s,l:t.l,a:t.a}):i(t.h)},e.prototype.isEqual=function(e){return this.toHex()===w(e).toHex()},e}(),w=function(e){return e instanceof C?e:new C(e)},ie=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 T(e){return e==null||e===``||e===`none`}function E(e,t=0,n=10**t){return Math.round(n*e)/n+0}function D(e,t=!1){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return t?e.map(e=>D(e,t)):e;let n={};for(let r in e){let i=e[r];i!=null&&(t?n[r]=D(i,t):n[r]=i)}return n}function O(e,t){let n={};return t.forEach(t=>{t in e&&(n[t]=e[t])}),n}function k(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 A(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 j(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 M(e,t,n){return e==null||!t||typeof t!=`string`?n:e[t]===void 0?(t=t.replace(/\[(\w+)\]/g,`.$1`),t=t.replace(/^\./,``),A(e,t.split(`.`),n)):e[t]}function ae(e,t,n){if(!(typeof e!=`object`||!t))return t=t.replace(/\[(\w+)\]/g,`.$1`),t=t.replace(/^\./,``),j(e,t.split(`.`),n)}var oe=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()}},se=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}},ce=Symbol.for(`declarations`),N=Symbol.for(`inited`);function P(e){let t;if(Object.hasOwn(e,ce))t=e[ce];else{let n=Object.getPrototypeOf(e);t={...n?P(n):{}},e[ce]=t}return t}function F(e,t,n,r){let{alias:i,internalKey:a}=r,o=e[t];i?ae(e,i,n):e[a]=n,e.onUpdateProperty?.(t,n??L(e,t,r),o)}function I(e,t,n){let{alias:r,internalKey:i}=n,a;return a=r?M(e,r):e[i],a??=L(e,t,n),a}function L(e,t,n){let{default:r,fallback:i}=n,a;if(r!==void 0&&!e[N]?.[t]){e[N]||(e[N]={}),e[N][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 le(e,t){function n(){return this.getProperty?this.getProperty(e):I(this,e,t)}function r(n){this.setProperty?this.setProperty(e,n):F(this,e,n,t)}return{get:n,set:r}}function ue(e,t,n={}){let r={...n,internalKey:Symbol.for(t)},i=P(e);i[t]=r;let{get:a,set:o}=le(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=le(r,i);return{init(e){let t=P(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 oe{_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 I(this,e,t);{let n=this._propertyAccessor,r;return r=n&&n.getProperty?n.getProperty(e):this.offsetGetProperty(e),r??L(this,e,t)}}}setProperty(e,t){let n=this.getPropertyDeclaration(e);if(n)if(n.internal||n.alias)F(this,e,t,n);else{let r=this.getProperty(e);this._propertyAccessor?.setProperty?.(e,t),this.offsetSetProperty(e,t),this.onUpdateProperty?.(e,t??L(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 P(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 me(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,w(t)}function he(e){return{r:E(e.r),g:E(e.g),b:E(e.b),a:E(e.a,3)}}function R(e){let t=e.toString(16);return t.length<2?`0${t}`:t}var ge=`#000000FF`;function _e(e){return me(e).isValid()}function z(e,t=!1){let n=me(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),ge}let{r,g:i,b:a,a:o}=he(n.rgba);return`#${R(r)}${R(i)}${R(a)}${R(E(o*255))}`}var B=B||{};B.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&&(j(e.comma)||n(`Missing comma before color stops`)),{type:t,orientation:a,colorStops:_(ne)}})}function s(t,r){let i=j(t);if(i){j(e.startCall)||n(`Missing (`);let t=r(i);return j(e.endCall)||n(`Missing )`),t}}function c(){let t=l();if(t)return t;let n=A(`position-keyword`,e.positionKeywords,1);return n?{type:`directional`,value:n.value}:u()}function l(){return A(`directional`,e.sideOrCorner,1)}function u(){return A(`angular`,e.angleValue,1)||A(`angular`,e.radianValue,1)}function d(){let n,r=f(),i;return r&&(n=[],n.push(r),i=t,j(e.comma)&&(r=f(),r?n.push(r):t=i)),n}function f(){let e=ee()||p();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 ee(){let e=A(`shape`,/^(circle)/i,0);return e&&(e.style=k()||m()),e}function p(){let e=A(`shape`,/^(ellipse)/i,0);return e&&(e.style=g()||E()||m()),e}function m(){return A(`extent-keyword`,e.extentKeywords,1)}function h(){if(A(`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:E(),y:E()}}function _(t){let r=t(),i=[];if(r)for(i.push(r);j(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=E(),e}function v(){return re()||w()||C()||x()||b()||S()||y()}function y(){return A(`literal`,e.literalColor,0)}function re(){return A(`hex`,e.hexColor,1)}function b(){return s(e.rgbColor,()=>({type:`rgb`,value:_(T)}))}function x(){return s(e.rgbaColor,()=>({type:`rgba`,value:_(T)}))}function S(){return s(e.varColor,()=>({type:`var`,value:ie()}))}function C(){return s(e.hslColor,()=>{j(e.percentageValue)&&n(`HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage`);let t=T();j(e.comma);let r=j(e.percentageValue),i=r?r[1]:null;j(e.comma),r=j(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 w(){return s(e.hslaColor,()=>{let t=T();j(e.comma);let r=j(e.percentageValue),i=r?r[1]:null;j(e.comma),r=j(e.percentageValue);let a=r?r[1]:null;j(e.comma);let o=T();return(!i||!a)&&n(`Expected percentage value for saturation and lightness in HSLA`),{type:`hsla`,value:[t,i,a,o]}})}function ie(){return j(e.variableName)[1]}function T(){return j(e.number)[1]}function E(){return A(`%`,e.percentageValue,1)||D()||O()||k()}function D(){return A(`position-keyword`,e.positionKeywords,1)}function O(){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 M(r-1),{type:`calc`,value:i}})}function k(){return A(`px`,e.pixelValue,1)||A(`em`,e.emValue,1)}function A(e,t,n){let r=j(t);if(r)return{type:e,value:r[n]}}function j(e){let n,r;return r=/^\s+/.exec(t),r&&M(r[0].length),n=e.exec(t),n&&M(n[0].length),n}function M(e){t=t.substr(e)}return function(e){return t=e.toString().trim(),t.endsWith(`;`)&&(t=t.slice(0,-1)),r()}})();var ve=B.parse.bind(B),V=V||{};V.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 ye=V.stringify.bind(V);function be(e){let t=e.length-1;return e.map((e,n)=>{let r=e.value,i=E(n/t,3),a=`#00000000`;switch(e.type){case`rgb`:a=z({r:Number(r[0]??0),g:Number(r[1]??0),b:Number(r[2]??0)});break;case`rgba`:a=z({r:Number(r[0]??0),g:Number(r[1]??0),b:Number(r[2]??0),a:Number(r[3]??0)});break;case`literal`:a=z(e.value);break;case`hex`:a=z(`#${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 xe(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:be(e.colorStops)}}function Se(e){return e.orientation?.map(e=>{switch(e?.type){default:return null}}),{type:`radial-gradient`,stops:be(e.colorStops)}}function H(e){return e.startsWith(`linear-gradient(`)||e.startsWith(`radial-gradient(`)}function Ce(e){return ve(e).map(e=>{switch(e?.type){case`linear-gradient`:return xe(e);case`repeating-linear-gradient`:return{...xe(e),repeat:!0};case`radial-gradient`:return Se(e);case`repeating-radial-gradient`:return{...Se(e),repeat:!0};default:return}}).filter(Boolean)}var U=[`color`];function we(e){let t;return t=typeof e==`string`?{color:e}:{...e},t.color&&=z(t.color),O(t,U)}var W=[`linearGradient`,`radialGradient`,`rotateWithShape`];function Te(e){let t;if(t=typeof e==`string`?{image:e}:{...e},t.image){let{type:e,...n}=Ce(t.image)[0]??{};switch(e){case`radial-gradient`:return{radialGradient:n};case`linear-gradient`:return{linearGradient:n}}}return O(t,W)}var G=[`image`,`cropRect`,`stretchRect`,`tile`,`dpi`,`opacity`,`rotateWithShape`];function Ee(e){let t;return t=typeof e==`string`?{image:e}:{...e},O(t,G)}var K=[`preset`,`foregroundColor`,`backgroundColor`];function De(e){let t;return t=typeof e==`string`?{preset:e}:{...e},T(t.foregroundColor)?delete t.foregroundColor:t.foregroundColor=z(t.foregroundColor),T(t.backgroundColor)?delete t.backgroundColor:t.backgroundColor=z(t.backgroundColor),O(t,K)}function Oe(e){return!T(e.color)}function ke(e){return typeof e==`string`?_e(e):Oe(e)}function Ae(e){return!T(e.image)&&H(e.image)||!!e.linearGradient||!!e.radialGradient}function je(e){return typeof e==`string`?H(e):Ae(e)}function Me(e){return!T(e.image)&&!H(e.image)}function Ne(e){return typeof e==`string`?!_e(e)&&!H(e):Me(e)}function Pe(e){return!T(e.preset)}function Fe(e){return typeof e==`string`?!1:Pe(e)}function q(e){let t={enabled:e&&typeof e==`object`?e.enabled??!0:!0};return ke(e)&&Object.assign(t,we(e)),je(e)&&Object.assign(t,Te(e)),Ne(e)&&Object.assign(t,Ee(e)),Fe(e)&&Object.assign(t,De(e)),O(D(t),Array.from(new Set([`enabled`,...U,...G,...W,...K])))}function Ie(e){return typeof e==`string`?{...q(e)}:{...q(e),...O(e,[`fillWithShape`])}}function Le(){return{backgroundImage:`none`,backgroundSize:`auto, auto`,backgroundColor:`none`,backgroundColormap:`none`}}function Re(e){return D({start:e.start,end:e.end,mode:e.mode??`straight`})}function J(e){return typeof e==`string`?{...q(e)}:{...q(e),...O(e,[`width`,`style`,`lineCap`,`lineJoin`,`headEnd`,`tailEnd`])}}function ze(){return{outlineWidth:0,outlineOffset:0,outlineColor:`none`,outlineStyle:`none`}}function Be(e){return typeof e==`string`?{enabled:!0,color:z(e)}:{...e,enabled:e.enabled??!0,color:T(e.color)?ge:z(e.color)}}function Ve(){return{boxShadow:`none`}}var He=[`fill`,`outline`,`shadow`,`transform`,`transformOrigin`];function Ue(e){let t=O(e,He),{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 Y(e){let t=Ue(e);return D({fill:T(t.fill)?void 0:q(t.fill),outline:T(t.outline)?void 0:J(t.outline),shadow:T(t.shadow)?void 0:Be(t.shadow),transform:T(t.transform)?void 0:t.transform,transformOrigin:t.transformOrigin})}function We(e){return typeof e==`string`?{...q(e)}:{...q(e),...O(e,[`fillWithShape`])}}var Ge=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,Ke=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Ge[n[e]&63];return t},qe=()=>Ke(10),Je=qe;function Ye(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 Xe(){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 Ze(){return{rotate:0,scaleX:1,scaleY:1,skewX:0,skewY:0,translateX:0,translateY:0,transform:`none`,transformOrigin:`center`}}function Qe(){return{...Xe(),...Ze(),...Ve(),...Le(),...ze(),borderRadius:0,borderColor:`none`,borderStyle:`solid`,visibility:`visible`,filter:`none`,opacity:1,pointerEvents:`auto`,maskImage:`none`}}function $e(){return{highlight:{},highlightImage:`none`,highlightReferImage:`none`,highlightColormap:`none`,highlightLine:`none`,highlightSize:`cover`,highlightThickness:`100%`}}function et(){return{listStyle:{},listStyleType:`none`,listStyleImage:`none`,listStyleColormap:`none`,listStyleSize:`cover`,listStylePosition:`outside`}}function tt(){return{...$e(),color:`#000000`,verticalAlign:`baseline`,letterSpacing:0,wordSpacing:0,fontSize:14,fontWeight:`normal`,fontFamily:``,fontStyle:`normal`,fontKerning:`normal`,textTransform:`none`,textOrientation:`mixed`,textDecoration:`none`}}function nt(){return{...et(),writingMode:`horizontal-tb`,textWrap:`wrap`,textAlign:`start`,textIndent:0,lineHeight:1.2}}function rt(){return{...nt(),...tt(),textStrokeWidth:0,textStrokeColor:`none`}}function X(e){return D({...e,color:T(e.color)?void 0:z(e.color),backgroundColor:T(e.backgroundColor)?void 0:z(e.backgroundColor),borderColor:T(e.borderColor)?void 0:z(e.borderColor),outlineColor:T(e.outlineColor)?void 0:z(e.outlineColor),shadowColor:T(e.shadowColor)?void 0:z(e.shadowColor),textStrokeColor:T(e.textStrokeColor)?void 0:z(e.textStrokeColor)})}function it(){return{...Qe(),...rt()}}var at=/\r\n|\n\r|\n|\r/,ot=RegExp(`${at.source}|<br\\/>`,`g`),st=RegExp(`^(${at.source})$`),Z=`
2
+ `;function ct(e){return at.test(e)}function lt(e){return st.test(e)}function ut(e){return e.replace(ot,Z)}function Q(e){let t=[];function n(){return t[t.length-1]}function r(e,n,r){let i=e?X(e):{},a=n?q(n):void 0,o=r?J(r):void 0,s=D({...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?q(i):void 0,c=a?J(a):void 0;Array.from(e).forEach(e=>{if(lt(e)){let{fragments:e,fill:t,outline:i,...a}=n()||r();e.length||e.push(D({...o,fill:s,outline:c,content:Z})),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(k(s,n)&&k(c,r)&&k(o,a)){i.content=`${t}${e}`;return}}t.fragments.push(D({...o,fill:s,outline:c,content:e}))}})}(Array.isArray(e)?e:[e]).forEach(e=>{if(typeof e==`string`)r(),i(e);else if(ft(e)){let{content:t,fill:n,outline:a,...o}=e;r(o,n,a),i(t)}else if(dt(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(ft(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 dt(e){return e&&typeof e==`object`&&`fragments`in e&&Array.isArray(e.fragments)}function ft(e){return e&&typeof e==`object`&&`content`in e&&typeof e.content==`string`}function pt(e){return D({type:e.type,intensities:e.intensities,maxFontSize:e.maxFontSize??100})}function mt(e){return typeof e==`string`||Array.isArray(e)?{enabled:!0,content:Q(e)}:D({enabled:e.enabled??!0,content:Q(e.content??``),style:e.style?X(e.style):void 0,deformation:e.deformation?pt(e.deformation):void 0,measureDom:e.measureDom,fonts:e.fonts,...Y(e),effects:e.effects?e.effects.map(e=>Y(e)):void 0})}function ht(e){return Q(e).map(e=>{let t=ut(e.fragments.flatMap(e=>e.content).join(``));return lt(t)?``:t}).join(Z)}function gt(e){return typeof e==`string`?{src:e}:e}function $(e){return D({id:e.id??Je(),style:T(e.style)?void 0:X(e.style),text:T(e.text)?void 0:mt(e.text),background:T(e.background)?void 0:Ie(e.background),shape:T(e.shape)?void 0:Ye(e.shape),foreground:T(e.foreground)?void 0:We(e.foreground),video:T(e.video)?void 0:gt(e.video),audio:T(e.audio)?void 0:t(e.audio),connection:T(e.connection)?void 0:Re(e.connection),...Y(e),children:e.children?.map(e=>$(e))})}function _t(e){return $(e)}function vt(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 yt(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=ie,e.Observable=oe,e.RawWeakMap=se,e.Reactivable=pe,e.clearUndef=D,e.colorFillFields=U,e.defaultColor=ge,e.defineProperty=ue,e.effectFields=He,e.flatDocumentToDocument=yt,e.getDeclarations=P,e.getDefaultBackgroundStyle=Le,e.getDefaultElementStyle=Qe,e.getDefaultHighlightStyle=$e,e.getDefaultLayoutStyle=Xe,e.getDefaultListStyleStyle=et,e.getDefaultOutlineStyle=ze,e.getDefaultShadowStyle=Ve,e.getDefaultStyle=it,e.getDefaultTextInlineStyle=tt,e.getDefaultTextLineStyle=nt,e.getDefaultTextStyle=rt,e.getDefaultTransformStyle=Ze,e.getNestedValue=A,e.getObjectValueByPath=M,e.getPropertyDescriptor=le,e.gradientFillFields=W,e.hasCRLF=ct,e.idGenerator=Je,e.imageFillFiedls=G,e.isCRLF=lt,e.isColor=_e,e.isColorFill=ke,e.isColorFillObject=Oe,e.isEqualObject=k,e.isFragmentObject=ft,e.isGradient=H,e.isGradientFill=je,e.isGradientFillObject=Ae,e.isImageFill=Ne,e.isImageFillObject=Me,e.isNone=T,e.isParagraphObject=dt,e.isPresetFill=Fe,e.isPresetFillObject=Pe,e.nanoid=qe,e.normalizeAudio=t,e.normalizeBackground=Ie,e.normalizeCRLF=ut,e.normalizeColor=z,e.normalizeColorFill=we,e.normalizeConnection=Re,e.normalizeDocument=_t,e.normalizeEffect=Y,e.normalizeElement=$,e.normalizeFill=q,e.normalizeFlatDocument=vt,e.normalizeForeground=We,e.normalizeGradient=Ce,e.normalizeGradientFill=Te,e.normalizeImageFill=Ee,e.normalizeOutline=J,e.normalizePresetFill=De,e.normalizeShadow=Be,e.normalizeShape=Ye,e.normalizeStyle=X,e.normalizeText=mt,e.normalizeTextContent=Q,e.normalizeTextDeformation=pt,e.normalizeVideo=gt,e.parseColor=me,e.parseGradient=ve,e.pick=O,e.presetFillFiedls=K,e.property=de,e.property2=fe,e.propertyOffsetFallback=L,e.propertyOffsetGet=I,e.propertyOffsetSet=F,e.round=E,e.setNestedValue=j,e.setObjectValueByPath=ae,e.stringifyGradient=ye,e.textContentToString=ht});
package/dist/index.mjs CHANGED
@@ -1431,6 +1431,14 @@ function getDefaultBackgroundStyle() {
1431
1431
  };
1432
1432
  }
1433
1433
 
1434
+ function normalizeConnection(connection) {
1435
+ return clearUndef({
1436
+ start: connection.start,
1437
+ end: connection.end,
1438
+ mode: connection.mode ?? "straight"
1439
+ });
1440
+ }
1441
+
1434
1442
  function normalizeOutline(outline) {
1435
1443
  if (typeof outline === "string") {
1436
1444
  return {
@@ -1858,6 +1866,13 @@ function isParagraphObject(value) {
1858
1866
  function isFragmentObject(value) {
1859
1867
  return value && typeof value === "object" && "content" in value && typeof value.content === "string";
1860
1868
  }
1869
+ function normalizeTextDeformation(deformation) {
1870
+ return clearUndef({
1871
+ type: deformation.type,
1872
+ intensities: deformation.intensities,
1873
+ maxFontSize: deformation.maxFontSize ?? 100
1874
+ });
1875
+ }
1861
1876
  function normalizeText(value) {
1862
1877
  if (typeof value === "string" || Array.isArray(value)) {
1863
1878
  return {
@@ -1869,6 +1884,7 @@ function normalizeText(value) {
1869
1884
  enabled: value.enabled ?? true,
1870
1885
  content: normalizeTextContent(value.content ?? ""),
1871
1886
  style: value.style ? normalizeStyle(value.style) : void 0,
1887
+ deformation: value.deformation ? normalizeTextDeformation(value.deformation) : void 0,
1872
1888
  measureDom: value.measureDom,
1873
1889
  fonts: value.fonts,
1874
1890
  ...normalizeEffect(value),
@@ -1906,6 +1922,7 @@ function normalizeElement(element) {
1906
1922
  foreground: isNone(element.foreground) ? void 0 : normalizeForeground(element.foreground),
1907
1923
  video: isNone(element.video) ? void 0 : normalizeVideo(element.video),
1908
1924
  audio: isNone(element.audio) ? void 0 : normalizeAudio(element.audio),
1925
+ connection: isNone(element.connection) ? void 0 : normalizeConnection(element.connection),
1909
1926
  ...normalizeEffect(element),
1910
1927
  children: element.children?.map((child) => normalizeElement(child))
1911
1928
  });
@@ -1967,4 +1984,4 @@ function flatDocumentToDocument(flatDoc) {
1967
1984
  return doc;
1968
1985
  }
1969
1986
 
1970
- export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, colorFillFields, defaultColor, defineProperty, effectFields, 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, normalizeEffect, 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 };
1987
+ export { EventEmitter, Observable, RawWeakMap, Reactivable, clearUndef, colorFillFields, defaultColor, defineProperty, effectFields, 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, normalizeConnection, normalizeDocument, normalizeEffect, normalizeElement, normalizeFill, normalizeFlatDocument, normalizeForeground, normalizeGradient, normalizeGradientFill, normalizeImageFill, normalizeOutline, normalizePresetFill, normalizeShadow, normalizeShape, normalizeStyle, normalizeText, normalizeTextContent, normalizeTextDeformation, normalizeVideo, parseColor, parseGradient, pick, presetFillFiedls, property, property2, propertyOffsetFallback, propertyOffsetGet, propertyOffsetSet, round, setNestedValue, setObjectValueByPath, stringifyGradient, textContentToString };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "modern-idoc",
3
3
  "type": "module",
4
- "version": "0.11.3",
4
+ "version": "0.11.5",
5
5
  "packageManager": "pnpm@10.18.1",
6
6
  "description": "Intermediate document for modern codec libs",
7
7
  "author": "wxm",