import { createVNode as _createVNode } from "vue";
import '../interface';
import Progress from '../../progress';
import ImageOperationTip from '../../tooltip/ImageOperationTip';
import Tooltip from '../../tooltip';
import DeleteTwoTone from '@pf-ui/pf-icons-vue/DeleteTwoTone';
import WordTwoTone from '@pf-ui/pf-icons-vue/WordTwoTone';
import ExcleTwoTone from '@pf-ui/pf-icons-vue/ExcleTwoTone';
import JpgTwoTone from '@pf-ui/pf-icons-vue/JpgTwoTone';
import PdfTwoTone from '@pf-ui/pf-icons-vue/PdfTwoTone';
import PngTwoTone from '@pf-ui/pf-icons-vue/PngTwoTone';
import PptTwoTone from '@pf-ui/pf-icons-vue/PptTwoTone';
import RarTwoTone from '@pf-ui/pf-icons-vue/RarTwoTone';
import TxtTwoTone from '@pf-ui/pf-icons-vue/TxtTwoTone';
import YasuoTwoTone from '@pf-ui/pf-icons-vue/YasuoTwoTone';
import ZipTwoTone from '@pf-ui/pf-icons-vue/ZipTwoTone';
import DocumentFilled from '@pf-ui/pf-icons-vue/DocumentFilled';
var FileExtension = {
  xls: _createVNode(ExcleTwoTone, null, null),
  xlsx: _createVNode(ExcleTwoTone, null, null),
  jpg: _createVNode(JpgTwoTone, null, null),
  jpeg: _createVNode(JpgTwoTone, null, null),
  pdf: _createVNode(PdfTwoTone, null, null),
  png: _createVNode(PngTwoTone, null, null),
  ppt: _createVNode(PptTwoTone, null, null),
  rar: _createVNode(RarTwoTone, null, null),
  txt: _createVNode(TxtTwoTone, null, null),
  doc: _createVNode(WordTwoTone, null, null),
  docx: _createVNode(WordTwoTone, null, null),
  '7z': _createVNode(YasuoTwoTone, null, null),
  zip: _createVNode(ZipTwoTone, null, null)
};
var PfTextItemRender = function PfTextItemRender(_ref) {
  var _ref2, _ref2$split;
  var file = _ref.file,
    actions = _ref.actions,
    prefixCls = _ref.prefixCls,
    message = _ref.message;
  console.log('file', file, actions);
  var _prefixCls = "".concat(prefixCls, "-preset-pf-text");
  var fileExtension = (_ref2 = file.url || file.name) === null || _ref2 === void 0 ? void 0 : (_ref2$split = _ref2.split('.')) === null || _ref2$split === void 0 ? void 0 : _ref2$split.pop();
  var dom = _createVNode("div", {
    "class": _prefixCls
  }, [_createVNode("a", {
    "class": "".concat(_prefixCls, "-icon"),
    "href": file.url,
    "target": "_blank",
    "rel": "noopener noreferrer",
    "onClick": actions.preview
  }, [FileExtension[fileExtension] || _createVNode(DocumentFilled, null, null)]), _createVNode("div", {
    "class": "".concat(_prefixCls, "-file")
  }, [_createVNode("div", {
    "class": "".concat(_prefixCls, "-file-info")
  }, [_createVNode("div", {
    "class": "".concat(_prefixCls, "-file-name ").concat(file.status === 'error' ? "".concat(_prefixCls, "-file-name-error") : '')
  }, [file.name]), file.status !== 'uploading' && _createVNode("div", {
    "class": "".concat(_prefixCls, "-file-actions")
  }, [_createVNode(ImageOperationTip, {
    "title": "删除"
  }, {
    default: function _default() {
      return [_createVNode(DeleteTwoTone, {
        "class": "".concat(_prefixCls, "-file-actions-delete"),
        "onClick": actions.remove
      }, null)];
    }
  })])]), file.status === 'uploading' && _createVNode(Progress, {
    "percent": file.percent,
    "showInfo": false,
    "strokeColor": "#198EEB",
    "trailColor": "#DBDBDB"
  }, null)])]);
  return file.status === 'error' ? _createVNode(Tooltip, {
    "title": message,
    "getPopupContainer": function getPopupContainer(node) {
      return node.parentNode;
    }
  }, {
    default: function _default() {
      return [dom];
    }
  }) : dom;
};
export default PfTextItemRender;