define(["exports", "../../../lit-element/lit-element.js", "../../rich-text-editor/rich-text-editor.js", "./hax-text-editor-toolbar.js"], function (_exports, _litElement, _richTextEditor, _haxTextEditorToolbar) {
  "use strict";

  Object.defineProperty(_exports, "__esModule", {
    value: true
  });
  _exports.HaxTextEditor = void 0;

  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { babelHelpers.defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = babelHelpers.getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = babelHelpers.getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return babelHelpers.possibleConstructorReturn(this, result); }; }

  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }

  /**
   * `hax-text-editor`
   * HAX-specific implementation of rich-text-editor
   *
   * @extends RichTextEditorBehaviors
   * @extends LitElement
   * @customElement
   * @demo demo/index.html
   */
  var HaxTextEditor = /*#__PURE__*/function (_RichTextEditorBehavi) {
    babelHelpers.inherits(HaxTextEditor, _RichTextEditorBehavi);

    var _super = _createSuper(HaxTextEditor);

    babelHelpers.createClass(HaxTextEditor, [{
      key: "tag",

      /**
       * Store the tag name to make it easier to obtain directly.
       * @notice function name must be here for tooling to operate correctly
       */
      value: function tag() {
        return "hax-text-editor";
      } // life cycle

    }], [{
      key: "styles",
      //styles function
      get: function get() {
        return babelHelpers.toConsumableArray(babelHelpers.get(babelHelpers.getPrototypeOf(HaxTextEditor), "styles", this) || []);
      } // properties available to the custom element for data binding

    }, {
      key: "properties",
      get: function get() {
        return _objectSpread({}, babelHelpers.get(babelHelpers.getPrototypeOf(HaxTextEditor), "properties", this));
      }
    }]);

    function HaxTextEditor() {
      var _this;

      babelHelpers.classCallCheck(this, HaxTextEditor);
      _this = _super.call(this);
      _this.haxUIElement = true;
      _this.tag = HaxTextEditor.tag;
      _this.type = "hax-text-editor-toolbar";
      return _this;
    }
    /**
     * Implements haxHooks to tie into life-cycle if hax exists.
     */


    babelHelpers.createClass(HaxTextEditor, [{
      key: "haxHooks",
      value: function haxHooks() {
        return {
          activeElementChanged: "haxactiveElementChanged"
        };
      }
      /**
       * allow HAX to toggle edit state when activated
       */

    }, {
      key: "haxactiveElementChanged",
      value: function haxactiveElementChanged(el, val) {
        // overwrite the HAX dom w/ what our editor is supplying
        if (!val && el) {
          el.innerHTML = this.getValue();
        }

        return el;
      } // attributeChangedCallback(attr, oldValue, newValue) {}

    }]);
    return HaxTextEditor;
  }((0, _richTextEditor.RichTextEditorBehaviors)(_litElement.LitElement));

  _exports.HaxTextEditor = HaxTextEditor;
  customElements.define("hax-text-editor", HaxTextEditor);
});