import {
  SerializationSchema,
  StyleV2Definition as BaseStyleV2Definition,
  StyleV2Control
} from "@makeswift/controls";
class StyleV2Definition extends BaseStyleV2Definition {
  static deserialize(data, deserializeCallback) {
    if (data.type !== StyleV2Definition.type) {
      throw new Error(`StyleV2: expected type ${StyleV2Definition.type}, got ${data.type}`);
    }
    const {
      config: { type, ...config }
    } = StyleV2Definition.schema({
      typeDef: SerializationSchema.deserializedRecord
    }).definition.parse(data);
    const typeDef = deserializeCallback(type);
    return unstable_StyleV2({ type: typeDef, ...config });
  }
}
function unstable_StyleV2(config) {
  return new StyleV2Definition(config);
}
export {
  StyleV2Control,
  StyleV2Definition,
  unstable_StyleV2
};
//# sourceMappingURL=style-v2.js.map