/**
 * ldesign v0.4.6
 * (c) 2023 ldesign
 * @license MIT
 */

import { defineComponent } from '@vue/composition-api';
import { MirrorIcon, RotationIcon, ZoomOutIcon, ZoomInIcon, ImageIcon, DownloadIcon } from '@ldesign/icons-vue';
import { Tooltip } from '../../tooltip/index.js';
import { downloadFile } from '../utils.js';
import '../../hooks/useConfig.js';
import TImageViewerIcon from './ImageModalIcon.js';
import { useConfig } from '../../config-provider/useConfig.js';
import '../../utils/map-props.js';
import '@babel/runtime/helpers/defineProperty';
import '@babel/runtime/helpers/objectWithoutProperties';
import 'vue';
import '../../utils/withInstall.js';
import 'lodash/capitalize';
import '../../tooltip/tooltip.js';
import '../../_chunks/dep-c89aafbb.js';
import 'lodash/isFunction';
import '../../popup/props.js';
import '../../popup/popup.js';
import '@babel/runtime/helpers/typeof';
import '@popperjs/core';
import '../../utils/dom.js';
import 'raf';
import 'lodash/isString';
import '../../utils/easing.js';
import '../../utils/render-tnode.js';
import 'lodash/camelCase';
import 'lodash/kebabCase';
import '../../utils/helper.js';
import '@babel/runtime/helpers/slicedToArray';
import '../../_common/js/utils/set-style.js';
import '../../config-provider/config-receiver.js';
import 'lodash/mergeWith';
import '../../config-provider/context.js';
import 'lodash/merge';
import '../../_common/js/global-config/default-config.js';
import '../../_common/js/global-config/locale/zh_CN.js';
import '../../_chunks/dep-be599ec8.js';
import 'dayjs';
import '../../_chunks/dep-67ff4010.js';
import '../../config-provider/type.js';
import '../../utils/mixins.js';
import '../../utils/event.js';
import '../../popup/container.js';
import '../../popup/utils.js';
import '../../popup/trigger.js';
import '../../tooltip/props.js';
import '../../tooltip/style/css.js';
import '../../tooltip/type.js';
import '../../hooks/tnode.js';
import 'lodash/isEmpty';
import '../../hooks/render-tnode.js';
import 'lodash/isObject';

var currentImage = {
  type: Object,
  "default": function _default() {
    return {};
  }
};
var TImageViewerUtils = defineComponent({
  name: "TImageViewerUtils",
  props: {
    scale: Number,
    rotateHandler: Function,
    zoomInHandler: Function,
    zoomOutHandler: Function,
    mirrorHandler: Function,
    resetHandler: Function,
    currentImage: currentImage
  },
  setup: function setup() {
    var _useConfig = useConfig("imageViewer"),
      classPrefix = _useConfig.classPrefix,
      globalConfig = _useConfig.global;
    return {
      classPrefix: classPrefix,
      globalConfig: globalConfig
    };
  },
  render: function render() {
    var _this = this;
    var h = arguments[0];
    return h("div", {
      "class": "".concat(this.classPrefix, "-image-viewer__utils")
    }, [h("div", {
      "class": "".concat(this.classPrefix, "-image-viewer__utils-content")
    }, [h(Tooltip, {
      "attrs": {
        "overlayClassName": "".concat(this.classPrefix, "-image-viewer__utils--tip"),
        "content": this.globalConfig.mirrorTipText,
        "destroyOnClose": true,
        "placement": "top",
        "showArrow": true,
        "theme": "default"
      }
    }, [h(TImageViewerIcon, {
      "attrs": {
        "clickHandler": this.mirrorHandler,
        "icon": function icon() {
          return h(MirrorIcon, {
            "attrs": {
              "size": "medium"
            }
          });
        }
      }
    })]), h(Tooltip, {
      "attrs": {
        "overlayClassName": "".concat(this.classPrefix, "-image-viewer__utils--tip"),
        "content": this.globalConfig.rotateTipText,
        "destroyOnClose": true,
        "placement": "top",
        "showArrow": true,
        "theme": "default"
      }
    }, [h(TImageViewerIcon, {
      "attrs": {
        "clickHandler": this.rotateHandler,
        "icon": function icon() {
          return h(RotationIcon, {
            "attrs": {
              "size": "medium"
            }
          });
        }
      }
    })]), h(TImageViewerIcon, {
      "attrs": {
        "icon": function icon() {
          return h(ZoomOutIcon, {
            "attrs": {
              "size": "medium"
            }
          });
        },
        "clickHandler": this.zoomOutHandler
      }
    }), h(TImageViewerIcon, {
      "class": "".concat(this.classPrefix, "-image-viewer__utils-scale"),
      "attrs": {
        "size": "medium",
        "label": "".concat(this.scale * 100, "%")
      }
    }), h(TImageViewerIcon, {
      "attrs": {
        "icon": function icon() {
          return h(ZoomInIcon, {
            "attrs": {
              "size": "medium"
            }
          });
        },
        "clickHandler": this.zoomInHandler
      }
    }), h(Tooltip, {
      "attrs": {
        "overlayClassName": "".concat(this.classPrefix, "-image-viewer__utils--tip"),
        "content": this.globalConfig.originalSizeTipText,
        "destroyOnClose": true,
        "placement": "top",
        "showArrow": true,
        "theme": "default"
      }
    }, [h("div", {
      "class": "".concat(this.classPrefix, "-image-viewer__modal-icon")
    }, [h(TImageViewerIcon, {
      "attrs": {
        "icon": function icon() {
          return h(ImageIcon, {
            "attrs": {
              "size": "medium"
            }
          });
        },
        "clickHandler": this.resetHandler
      }
    })])]), this.currentImage.download && h(TImageViewerIcon, {
      "attrs": {
        "icon": function icon() {
          return h(DownloadIcon, {
            "attrs": {
              "size": "medium"
            }
          });
        },
        "clickHandler": function clickHandler() {
          downloadFile(_this.currentImage.mainImage);
        }
      }
    })])]);
  }
});

export { TImageViewerUtils as default };
//# sourceMappingURL=ImageViewerUtils.js.map
