/**
 * ldesign v0.2.14
 * (c) 2022/11/2 16:16 built by swimly
 * @license MIT
 */

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var VueCompositionAPI = require('@vue/composition-api');
var iconsVue = require('@ldesign/icons-vue');
var components_dialog_index = require('../../dialog/index.js');
var hooks_useConfig = require('../../../hooks/use-config.js');
var hooks_lnode = require('../../../hooks/lnode.js');
var components_imageViewer_props = require('../props.js');
var components_imageViewer_base_ImageViewerUtils = require('./ImageViewerUtils.js');
var components_imageViewer_base_ImageItem = require('./ImageItem.js');
require('../../../utils/with-install.js');
require('vue');
require('lodash');
require('../../../config.js');
require('../../dialog/dialog.js');
require('lodash/isNumber');
require('lodash/throttle');
require('../../button/index.js');
require('../../button/button.js');
require('../../loading/index.js');
require('../../loading/loading.js');
require('../../../utils/dom.js');
require('raf');
require('lodash/isString');
require('../../../chunks/log.js');
require('../../../chunks/_commonjsHelpers-2e6815bd.js');
require('../../../utils/easing.js');
require('../../../utils/render-node.js');
require('../../../utils/transfer-dom.js');
require('../../config-provider/config-receiver.js');
require('lodash/mergeWith');
require('../../config-provider/context.js');
require('../../../chunks/zh_CN.js');
require('../../../utils/mixins.js');
require('../../loading/props.js');
require('../../loading/icon/gradient.js');
require('../../../chunks/defineProperty-838e4192.js');
require('../../../chunks/set-style.js');
require('../../../chunks/helper2.js');
require('../../loading/plugin.js');
require('../../../utils/ripple.js');
require('../../button/props.js');
require('../../../utils/event.js');
require('../../../utils/helper.js');
require('lodash/camelCase');
require('../../../hooks/use-destroy-onclose.js');
require('../../dialog/props.js');
require('../../dialog/mixins/action.js');
require('../../../chunks/helper.js');
require('lodash/isObject');
require('../../dialog/stack.js');
require('../../dialog/plugin.js');
require('../../config-provider/useConfig.js');
require('lodash/isEmpty');
require('lodash/isFunction');
require('lodash/kebabCase');
require('../../../hooks/render-lnode.js');
require('../../tooltip/index.js');
require('../../../utils/map-props.js');
require('../../tooltip/tooltip.js');
require('../../popup/props.js');
require('../../popup/popup.js');
require('@popperjs/core');
require('../../popup/container.js');
require('../../tooltip/props.js');
require('../utils.js');
require('./ImageModalIcon.js');
require('../hooks/index.js');

const defaultProps = {
  zIndex: Number,
  visible: Boolean,
  index: Number,
  images: components_imageViewer_props["default"].images,
  scale: Number,
  rotate: Number,
  mirror: Number,
  currentImage: {
    type: Object,
    default() {
      return {};
    }
  },
  rotateHandler: Function,
  zoomInHandler: Function,
  zoomOutHandler: Function,
  mirrorHandler: Function,
  resetHandler: Function,
  closeHandler: components_imageViewer_props["default"].onClose,
  draggable: {
    type: Boolean,
    default: true
  },
  viewerScale: {
    type: Object,
    default() {
      return {};
    }
  },
  showOverlay: Boolean,
  closeBtn: components_imageViewer_props["default"].closeBtn
};
var TImageViewerModal = VueCompositionAPI.defineComponent({
  name: "LImageViewerModal",
  props: {
    ...defaultProps
  },
  setup(props2) {
    const classPrefix = hooks_useConfig.usePrefixClass();
    const renderJSX = hooks_lnode.useLNodeJSX();
    const style = VueCompositionAPI.computed(() => ({
      minWidth: props2.viewerScale.minWidth,
      minHeight: props2.viewerScale.minHeight
    }));
    return {
      classPrefix,
      renderJSX,
      style
    };
  },
  render() {
    const h = arguments[0];
    return h(components_dialog_index.Dialog, {
      "attrs": {
        "destroyOnClose": true,
        "visible": this.visible,
        "placement": "center",
        "mode": "modeless",
        "width": 1e3,
        "cancelBtn": null,
        "confirmBtn": null,
        "closeBtn": false,
        "draggable": this.draggable,
        "zIndex": this.zIndex,
        "showOverlay": this.showOverlay,
        "header": () => h("div", {
          "class": `${this.classPrefix}-image-viewer__mini-header`
        }, [`${this.index + 1}/${this.images.length}`, h("span", {
          "class": `${this.classPrefix}-image-viewer__mini-close`,
          "on": {
            "click": e => {
              this.closeHandler({
                e,
                trigger: "close-btn"
              });
            }
          }
        }, [this.renderJSX("closeBtn", h(iconsVue.CloseIcon, {
          "attrs": {
            "size": "1.5rem"
          }
        }))])]),
        "footer": () => h("div", {
          "class": `${this.classPrefix}-image-viewer-mini__footer`
        }, [h(components_imageViewer_base_ImageViewerUtils["default"], {
          "attrs": {
            "zoomInHandler": this.zoomInHandler,
            "zoomOutHandler": this.zoomOutHandler,
            "scale": this.scale,
            "currentImage": this.currentImage,
            "rotateHandler": this.rotateHandler,
            "mirrorHandler": this.mirrorHandler,
            "resetHandler": this.resetHandler
          }
        })])
      },
      "on": {
        "close": this.closeHandler
      },
      "class": `${this.classPrefix}-image-viewer__dialog`
    }, [h("div", {
      "class": `${this.classPrefix}-image-viewer-mini__content`,
      "style": this.style
    }, [h(components_imageViewer_base_ImageItem["default"], {
      "attrs": {
        "rotate": this.rotate,
        "scale": this.scale,
        "mirror": this.mirror,
        "src": this.currentImage.mainImage,
        "placementSrc": this.currentImage.thumbnail
      }
    })])]);
  }
});

exports["default"] = TImageViewerModal;
//# sourceMappingURL=ImageViewerModal.js.map
