import { Decoration_Type } from "./../../ricos-schema/legacy/wix/rich_content/v1/index.js";
import { EmptyDecoration } from "./empty-decoration.js";
class SketchDecoration {
  constructor(data) {
    this.type = Decoration_Type.SKETCH;
    this.data = data;
  }
  static of(decoration) {
    if (decoration.type !== Decoration_Type.SKETCH) {
      throw new TypeError(`invalid decoration initializer ${decoration}`);
    }
    return new SketchDecoration(decoration.sketchData);
  }
  getDecoration() {
    return {
      type: this.type,
      ...this.data && { sketchData: this.data }
    };
  }
  fromCustomStyle(_customStyle) {
    return new SketchDecoration(this.data);
  }
  toCustomStyle() {
    return {};
  }
  overrideWith(decoration) {
    if (!(decoration instanceof SketchDecoration || decoration instanceof EmptyDecoration)) {
      throw new TypeError(`invalid merge decoration ${decoration}`);
    }
    if (decoration instanceof EmptyDecoration) {
      return this;
    }
    return new SketchDecoration(decoration.data);
  }
}
export {
  SketchDecoration
};
//# sourceMappingURL=sketch-decoration.js.map
