<commit_before>import {
  props,
  define,
  getComponentRootElement,
  hasNativeShadowDomSupport,
  watchForComponentMutations,
} from '@bolt/core/utils';
import classNames from 'classnames/bind';
import {
  withLitHtml,
  html,
  render,
} from '@bolt/core/renderers/renderer-lit-html';

import styles from './blockquote.scss';
import schema from '../blockquote.schema.yml';

let cx = classNames.bind(styles);

@define
class BoltBlockquote extends withLitHtml() {
  static is = 'bolt-blockquote';

  static props = {
    size: props.string,
    alignItems: props.string,
    border: props.string,
    indent: props.boolean,
    fullBleed: props.boolean,
    authorName: props.string,
    authorTitle: props.string,
    authorImage: props.string,
  };

  // https://github.com/WebReflection/document-register-element#upgrading-the-constructor-context
  constructor(self) {
    self = super(self);
    self.useShadow = hasNativeShadowDomSupport;
    return self;
  }

  getModifiedSchema(schema) {
    var modifiedSchema = schema;

    // Remove "content" from schema, does not apply to web component.
    for (let property in modifiedSchema.properties) {
      if (property === 'content') {
        delete modifiedSchema.properties[property];
      }
    }

    const index = modifiedSchema.required.indexOf('content');
    modifiedSchema.required.splice(index, 1);

    return modifiedSchema;
  }

  connecting() {
    // Make sure the component ONLY ever reuses any existing HTML ONCE. This, in part, helps to prevent rendering diff errors in HyperHTML after booting up!
    if (this._wasInitiallyRendered === false) {
      let rootElement = getComponentRootElement(this.childNodes, 'blockquote');

      if (rootElement) {
        this.rootElement = document.createDocumentFragment();

        // Take any child elements and move them to the root of the custom element
        while (rootElement.firstChild) {
          this.appendChild(rootElement.firstChild);
        }

        this.rootElement.appendChild(rootElement);
      }
    }
  }

  rendered() {
    super.rendered(); // ensure any events emitted by the Bolt Base class fire as expected

    // re-render if Shadow DOM is supported and enabled; temp workaround to dealing w/ components already rendered, but without slot support
    if (hasNativeShadowDomSupport && this.useShadow) {
      this.observer = watchForComponentMutations(this);

      this.observer.observe(this, {
        attributes: false,
        childList: true,
        characterData: false,
      });
    }
  }

  disconnecting() {
    // this.removeEventListener('click', this.clickHandler);

    if (hasNativeShadowDomSupport && this.useShadow) {
      if (this.observer) {
        this.observer.disconnect();
      }
    }
  }

  get alignItemsOption() {
    switch (this.props.alignItems) {
      case 'right':
        return 'end';
      case 'center':
        return 'center';
      default:<commit_msg>fix: remove unneeded rendered() method<commit_after>import {
  props,
  define,
  getComponentRootElement,
  hasNativeShadowDomSupport,
  watchForComponentMutations,
} from '@bolt/core/utils';
import classNames from 'classnames/bind';
import {
  withLitHtml,
  html,
  render,
} from '@bolt/core/renderers/renderer-lit-html';

import styles from './blockquote.scss';
import schema from '../blockquote.schema.yml';

let cx = classNames.bind(styles);

@define
class BoltBlockquote extends withLitHtml() {
  static is = 'bolt-blockquote';

  static props = {
    size: props.string,
    alignItems: props.string,
    border: props.string,
    indent: props.boolean,
    fullBleed: props.boolean,
    authorName: props.string,
    authorTitle: props.string,
    authorImage: props.string,
  };

  // https://github.com/WebReflection/document-register-element#upgrading-the-constructor-context
  constructor(self) {
    self = super(self);
    self.useShadow = hasNativeShadowDomSupport;
    return self;
  }

  getModifiedSchema(schema) {
    var modifiedSchema = schema;

    // Remove "content" from schema, does not apply to web component.
    for (let property in modifiedSchema.properties) {
      if (property === 'content') {
        delete modifiedSchema.properties[property];
      }
    }

    const index = modifiedSchema.required.indexOf('content');
    modifiedSchema.required.splice(index, 1);

    return modifiedSchema;
  }

  connecting() {
    // Make sure the component ONLY ever reuses any existing HTML ONCE. This, in part, helps to prevent rendering diff errors in HyperHTML after booting up!
    if (this._wasInitiallyRendered === false) {
      let rootElement = getComponentRootElement(this.childNodes, 'blockquote');

      if (rootElement) {
        this.rootElement = document.createDocumentFragment();

        // Take any child elements and move them to the root of the custom element
        while (rootElement.firstChild) {
          this.appendChild(rootElement.firstChild);
        }

        this.rootElement.appendChild(rootElement);
      }
    }
  }

  disconnecting() {
    // this.removeEventListener('click', this.clickHandler);

    if (hasNativeShadowDomSupport && this.useShadow) {
      if (this.observer) {
        this.observer.disconnect();
      }
    }
  }

  get alignItemsOption() {
    switch (this.props.alignItems) {
      case 'right':
        return 'end';
      case 'center':
        return 'center';
      default:
{'fraction_non_alphanumeric': 0.10657554488363502, 'fraction_numerical': 0.0003694126339120798, 'mean_word_length': 3.111617312072893, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3310085', 'n_tokens_mistral': 1561, 'n_tokens_neox': 1507, 'n_words': 391}