text: define(["../../../polymer/polymer-legacy.js", "./google-youtube.js", "../../../polymer/lib/legacy/polymer-fn.js", "../../../polymer/lib/utils/html-tag.js"], function (_polymerLegacy, _googleYoutube, _polymerFn, _htmlTag) {
    "use strict";
  
    var _templateObject_0ce68780942811ecb1937969798b231a;
  
    (0, _polymerFn.Polymer)({
      _template: (0, _htmlTag.html)(_templateObject_0ce68780942811ecb1937969798b231a || (_templateObject_0ce68780942811ecb1937969798b231a = babelHelpers.taggedTemplateLiteral(["\n    <style>\n      :host {\n        display: block;\n        position: relative;\n        width: 100%;\n      }\n\n      google-youtube {\n        height: 100%;\n      }\n    </style>\n\n    <google-youtube\n        id=\"player\"\n        video-id=\"{{videoId}}\"\n        state=\"{{__state}}\"\n        current-time=\"{{__currentTime}}\">\n    </google-youtube>\n  "]))),
      is: 'youtube-lite',
      properties: {
        videoId: {
          type: String,
          notify: true
        },
        state: {
          type: String,
          notify: true,
          observer: '_stateChanged'
        },
        currentTime: {
          type: Number,
          notify: true,
          observer: '_currentTimeChanged'
        },
        startTime: {
          type: Number
        },
        __state: {
          type: String,
          observer: '__ytApiStateChange'
        },
        __currentTime: {
          type: Number,
          observer: '_ytCurrentTimeChanged'
        },
        __pauseOnFirstSeek: {
          type: Boolean
        }
      },
      listeners: {
        'google-youtube-ready': '_onYoutubeReady'
      },
      _seekTo: function _seekTo(newTime) {
        var player = this.$.player;
        newTime = Number(newTime);
  
        if ((player.duration == 1 || newTime < player.duration) && !this.__ytChangingTime) {
          player.seekTo(newTime);
        }
  
        this.__ytChangingTime = false;
      },
      _onYoutubeReady: function _onYoutubeReady() {
        this.__pauseOnFirstSeek = this.state == 'paused';
  
        if (!this.__pauseOnFirstSeek || this.startTime) {
          this._seekTo(this.startTime);
        }
      },
      _currentTimeChanged: function _currentTimeChanged(newTime) {
        var apiState = this.__readableStateToApiState(this.state);
  
        if (apiState != this.__apiStates.PAUSED || this.__state != this.__apiStates.PAUSED) {
          return;
        }
  
        this._seekTo(newTime);
      },
      _ytCurrentTimeChanged: function _ytCurrentTimeChanged(ytCurrentTime) {
        this.__ytChangingTime = true;
        this.currentTime = ytCurrentTime;
      },
      _stateChanged: function _stateChanged(newState) {
        var newApiState = this.__readableStateToApiState(newState);
  
        if (newApiState == this.__state || this.__state == this.__apiStates.UNSTARTED || this.__state === undefined) {
          return;
        }
  
        this.currentTime = this.__currentTime;
        var player = this.$.player;
  
        switch (newApiState) {
          case this.__apiStates.PLAYING:
            player.play();
            break;
  
          case this.__apiStates.PAUSED:
            player.pause();
            break;
  
          default:
            return;
        }
      },
      __ytApiStateChange: function __ytApiStateChange(newState) {
        var readableState;
  
        switch (newState) {
          case this.__apiStates.ENDED:
            readableState = this.__states.PAUSED;
            break;
  
          case this.__apiStates.PLAYING:
            readableState = this.__states.PLAYING;
            break;
  
          case this.__apiStates.PAUSED:
            readableState = this.__states.PAUSED;
            break;
  
          default:
            return;
        }
  
        if (this.state == readableState) {
          return;
        }
  
        if (this.__pauseOnFirstSeek && readableState == this.__states.PLAYING) {
          this.__pauseOnFirstSeek = false;
          this.$.player.pause();
          return;
        }
  
        this.state = readableState;
        this.currentTime = this.__currentTime;
      },
      __readableStateToApiState: function __readableStateToApiState(readableState) {
        var newApiState = -2;
  
        if (readableState == this.__states.PLAYING) {
          newApiState = this.__apiStates.PLAYING;
        } else if (readableState = this.__states.PAUSED) {
          newApiState = this.__apiStates.PAUSED;
        }
  
        return newApiState;
      },
      __states: {
        PLAYING: 'playing',
        PAUSED: 'paused'
      },
      __apiStates: {
        UNSTARTED: -1,
        ENDED: 0,
        PLAYING: 1,
        PAUSED: 2,
        BUFFERING: 3,
        QUEUED: 5
      }
    });
  });