text: define(["exports", "../../lit/index.js", "../schema-behaviors/schema-behaviors.js", "../es-global-bridge/es-global-bridge.js"], function (_exports, _index, _schemaBehaviors, _esGlobalBridge) {
    "use strict";
  
    Object.defineProperty(_exports, "__esModule", {
      value: true
    });
    _exports.AframePlayer = void 0;
  
    var _templateObject_87408710feb911eb8439e3eec9305af7, _templateObject2_87408710feb911eb8439e3eec9305af7;
  
    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 { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
  
    /**
     * `aframe-player`
     * `A wrapper to do data binding into aframe`
     *
     * @demo demo/index.html
     * @element aframe-player
     */
    var AframePlayer = /*#__PURE__*/function (_SchemaBehaviors) {
      babelHelpers.inherits(AframePlayer, _SchemaBehaviors);
  
      var _super = _createSuper(AframePlayer);
  
      function AframePlayer() {
        var _this;
  
        babelHelpers.classCallCheck(this, AframePlayer);
        _this = _super.call(this);
        _this.course = "";
        _this.height = "480px";
        _this.width = "640px";
        _this.skyColor = "#DCDCDC";
        _this.ar = false;
        _this.x = "0";
        _this.y = "0";
        _this.z = "0";
        _this.position = {};
        return _this;
      }
  
      babelHelpers.createClass(AframePlayer, [{
        key: "render",
        value: function render() {
          return (0, _index.html)(_templateObject_87408710feb911eb8439e3eec9305af7 || (_templateObject_87408710feb911eb8439e3eec9305af7 = babelHelpers.taggedTemplateLiteral(["\n      <a-scene\n        id=\"scene\"\n        class=\"embedded\"\n        embedded\n        ?arjs=\"", "\"\n        style=\"height:", ";width:", ";\"\n      >\n        <a-sky color=\"", "\"></a-sky>\n        <a-marker-camera preset=\"hiro\"></a-marker-camera>\n      </a-scene>\n    "])), this.ar, this.height, this.width, this.skyColor);
        }
      }, {
        key: "updated",
        value: function updated(changedProperties) {
          var _this2 = this;
  
          changedProperties.forEach(function (oldValue, propName) {
            if (["x", "y", "z", "width", "height"].includes(propName)) {
              _this2.position = _this2._computePosition(_this2.x, _this2.y, _this2.z, _this2.width, _this2.height);
            }
  
            if (propName == "position") {
              _this2._positionChanged(_this2[propName]);
            }
          });
        }
      }, {
        key: "createRenderRoot",
        value: function createRenderRoot() {
          return this;
        }
      }, {
        key: "disconnectedCallback",
        value: function disconnectedCallback() {
          window.removeEventListener("es-bridge-aframePlayer-loaded", this._aframeLoaded.bind(this));
          babelHelpers.get(babelHelpers.getPrototypeOf(AframePlayer.prototype), "disconnectedCallback", this).call(this);
        }
      }, {
        key: "connectedCallback",
        value:
        /**
         * Attached.
         */
        function connectedCallback() {
          babelHelpers.get(babelHelpers.getPrototypeOf(AframePlayer.prototype), "connectedCallback", this).call(this);
          var location = "https://aframe.io/releases/0.9.2/aframe.min.js";
          if ((typeof TWEEN === "undefined" ? "undefined" : babelHelpers.typeof(TWEEN)) === "object") this._aframeLoaded.bind(this);
          window.addEventListener("es-bridge-aframePlayer-loaded", this._aframeLoaded.bind(this));
          window.ESGlobalBridge.requestAvailability().load("aframePlayer", location);
        }
      }, {
        key: "_aframeLoaded",
        value: function _aframeLoaded(el) {
          // ensure that this doesn't put full screen styles on the page!
          this.querySelector("#scene").removeFullScreenStyles();
          this.__entity = document.createElement("a-entity");
  
          this.__entity.setAttribute("gltf-model", "url(" + this.source + ")");
  
          this._positionChanged(this.position);
  
          this.querySelector("#scene").appendChild(this.__entity);
        }
        /**
         * Generate position object based on format a-frame expects.
         */
  
      }, {
        key: "_computePosition",
        value: function _computePosition(x, y, z, width, height) {
          return {
            x: x,
            y: y,
            z: z
          };
        }
        /**
         * When position is updated, inject this into a-frame tag.
         */
  
      }, {
        key: "_positionChanged",
        value: function _positionChanged(position) {
          if (this.__entity !== undefined) this.__entity.setAttribute("position", position);
        }
      }], [{
        key: "styles",
        get:
        /**
         * LitElement constructable styles enhancement
         */
        function get() {
          return [(0, _index.css)(_templateObject2_87408710feb911eb8439e3eec9305af7 || (_templateObject2_87408710feb911eb8439e3eec9305af7 = babelHelpers.taggedTemplateLiteral(["\n        :host {\n          display: block;\n          position: relative;\n        }\n        .a-hidden {\n          display: hidden;\n        }\n      "])))];
        }
      }, {
        key: "tag",
        get: function get() {
          return "aframe-player";
        }
      }, {
        key: "properties",
        get: function get() {
          return _objectSpread(_objectSpread({}, babelHelpers.get(babelHelpers.getPrototypeOf(AframePlayer), "properties", this)), {}, {
            /**
             * Source to reference for the 3D object
             */
            source: {
              type: String
            },
  
            /**
             * height of the element
             */
            height: {
              type: String
            },
  
            /**
             * width of the element
             */
            width: {
              type: String
            },
  
            /**
             * Color of the sky / background.
             */
            skyColor: {
              type: String,
              attribute: "sky-color"
            },
  
            /**
             * If this is for augmented reality or not.
             */
            ar: {
              type: Boolean
            },
  
            /**
             * x position for the AR element.
             */
            x: {
              type: String
            },
  
            /**
             * y position for the AR element.
             */
            y: {
              type: String
            },
  
            /**
             * z position for the AR element.
             */
            z: {
              type: String
            },
  
            /**
             * Generate a position object when coordinates change.
             */
            position: {
              type: Object
            }
          });
        }
      }, {
        key: "haxProperties",
        get: function get() {
          return {
            canScale: false,
            canPosition: false,
            canEditSource: true,
            gizmo: {
              title: "3D player",
              description: "A 3D file / augmented reality player.",
              icon: "av:play-circle-filled",
              color: "amber",
              groups: ["3D", "Augmented reality"],
              handles: [{
                type: "3d",
                source: "source"
              }],
              meta: {
                author: "ELMS:LN"
              }
            },
            settings: {
              configure: [{
                property: "source",
                title: "Source",
                description: "The URL for this AR file.",
                inputMethod: "textfield",
                type: "bar",
                icon: "link",
                required: true
              }, {
                property: "x",
                title: "X",
                description: "X position of the element in AR.",
                inputMethod: "textfield",
                type: "bar",
                icon: "communication:location-on",
                required: true
              }, {
                property: "y",
                title: "Y",
                description: "Y position of the element in AR.",
                inputMethod: "textfield",
                type: "bar",
                icon: "communication:location-on",
                required: true
              }, {
                property: "z",
                title: "Z",
                description: "Z position of the element in AR.",
                inputMethod: "textfield",
                type: "bar",
                icon: "communication:location-on",
                required: true
              }, {
                property: "skyColor",
                title: "Sky color",
                description: "Select the color of the sky in the scene.",
                inputMethod: "colorpicker",
                type: "bar",
                icon: "editor:format-color-fill"
              }],
              advanced: []
            }
          };
        }
      }]);
      return AframePlayer;
    }((0, _schemaBehaviors.SchemaBehaviors)(_index.LitElement));
  
    _exports.AframePlayer = AframePlayer;
    window.customElements.define(AframePlayer.tag, AframePlayer);
  });