"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");

exports.__esModule = true;
exports.default = void 0;

var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));

require("regenerator-runtime/runtime");

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));

require("./Item.css");

var _component = require("../_utils/component.js");

var _vueNormalizeComponent = _interopRequireDefault(require("../_utils/vue-normalize-component.js"));

/* script */
//
//
//
//
//
//
//
//
//
//
//
//
var __vue_script__ = {
  inject: ['waterfail'],
  name: (0, _component.createComponentName)('waterfall-item'),
  mixins: [_component.componentMixin],
  props: {
    transition: {
      type: String,
      default: 'waterfall-fade'
    }
  },

  data() {
    return {
      show: true,
      loaded: false
    };
  },

  mounted() {
    this.update();
  },

  beforeDestroy() {
    this.show = false;
  },

  destroyed() {
    this.waterfail.update();
  },

  methods: {
    update() {
      var _this = this;

      return (0, _asyncToGenerator2.default)(
      /*#__PURE__*/
      _regenerator.default.mark(function _callee() {
        return _regenerator.default.wrap(function _callee$(_context) {
          while (1) {
            switch (_context.prev = _context.next) {
              case 0:
                _context.next = 2;
                return _this.waterfail.update();

              case 2:
                _this.show = false;
                setTimeout(function () {
                  _this.show = true;
                  _this.loaded = true;
                }, Math.random() * 100);

              case 4:
              case "end":
                return _context.stop();
            }
          }
        }, _callee, this);
      }))();
    }

  }
};
/* template */

var __vue_render__ = function __vue_render__() {
  var _vm = this;

  var _h = _vm.$createElement;

  var _c = _vm._self._c || _h;

  return _c("transition", {
    attrs: {
      name: _vm.transition
    }
  }, [_c("div", {
    directives: [{
      name: "show",
      rawName: "v-show",
      value: _vm.show,
      expression: "show"
    }],
    class: _vm.bem({
      active: _vm.loaded
    }),
    style: _vm.loaded ? null : {
      visibility: "hidden"
    }
  }, [_vm._t("default")], 2)]);
};

var __vue_staticRenderFns__ = [];
__vue_render__._withStripped = true;
/* style */

var __vue_inject_styles__ = undefined;
/* scoped */

var __vue_scope_id__ = undefined;
/* module identifier */

var __vue_module_identifier__ = undefined;
/* functional template */

var __vue_is_functional_template__ = false;
/* component normalizer */

/* style inject */

/* style inject SSR */
var _default = (0, _vueNormalizeComponent.default)({
  render: __vue_render__,
  staticRenderFns: __vue_staticRenderFns__
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, undefined, undefined);

exports.default = _default;