import { defineComponent, openBlock, createElementBlock, withDirectives, createElementVNode, normalizeStyle, vShow, createCommentVNode, normalizeClass, toDisplayString, ref, watch, createVNode, unref, withModifiers, createBlock, render, computed, renderSlot, useCssVars, watchEffect, useSlots, Fragment, mergeProps, createSlots, withCtx, Teleport } from "vue";
import { showLoadingToast, showConfirmDialog, closeDialog, Circle, Uploader } from "vant";
import WlSvg from "@wltech/svg";
const X = {};
X.getData = (t) => new Promise((e, i) => {
  let s = {};
  S(t).then((r) => {
    s.arrayBuffer = r;
    try {
      s.orientation = T(r);
    } catch {
      s.orientation = -1;
    }
    e(s);
  }).catch((r) => {
    i(r);
  });
});
function S(t) {
  let e = null;
  return new Promise((i, s) => {
    if (t.src)
      if (/^data\:/i.test(t.src))
        e = L(t.src), i(e);
      else if (/^blob\:/i.test(t.src)) {
        var r = new FileReader();
        r.onload = function(h) {
          e = h.target.result, i(e);
        }, E(t.src, function(h) {
          r.readAsArrayBuffer(h);
        });
      } else {
        var o = new XMLHttpRequest();
        o.onload = function() {
          if (this.status == 200 || this.status === 0)
            e = o.response, i(e);
          else
            throw "Could not load image";
          o = null;
        }, o.open("GET", t.src, true), o.responseType = "arraybuffer", o.send(null);
      }
    else
      s("img error");
  });
}
function E(t, e) {
  var i = new XMLHttpRequest();
  i.open("GET", t, true), i.responseType = "blob", i.onload = function(s) {
    (this.status == 200 || this.status === 0) && e(this.response);
  }, i.send();
}
function L(t, e) {
  e = e || t.match(/^data\:([^\;]+)\;base64,/mi)[1] || "", t = t.replace(/^data\:([^\;]+)\;base64,/gmi, "");
  for (var i = atob(t), s = i.length % 2 == 0 ? i.length : i.length + 1, r = new ArrayBuffer(s), o = new Uint16Array(r), h = 0; h < s; h++)
    o[h] = i.charCodeAt(h);
  return r;
}
function k(t, e, i) {
  var s = "", r;
  for (r = e, i += e; r < i; r++)
    s += String.fromCharCode(t.getUint8(r));
  return s;
}
function T(t) {
  var e = new DataView(t), i = e.byteLength, s, r, o, h, n, l, c, a, p, f;
  if (e.getUint8(0) === 255 && e.getUint8(1) === 216)
    for (p = 2; p < i; ) {
      if (e.getUint8(p) === 255 && e.getUint8(p + 1) === 225) {
        c = p;
        break;
      }
      p++;
    }
  if (c && (r = c + 4, o = c + 10, k(e, r, 4) === "Exif" && (l = e.getUint16(o), n = l === 18761, (n || l === 19789) && e.getUint16(o + 2, n) === 42 && (h = e.getUint32(o + 4, n), h >= 8 && (a = o + h)))), a) {
    for (i = e.getUint16(a, n), f = 0; f < i; f++)
      if (p = a + f * 12 + 2, e.getUint16(p, n) === 274) {
        p += 8, s = e.getUint16(p, n);
        break;
      }
  }
  return s;
}
const N = (t, e) => {
  const i = t.__vccOpts || t;
  for (const [s, r] of e)
    i[s] = r;
  return i;
}, $ = defineComponent({
  data: function() {
    return {
      w: 0,
      h: 0,
      scale: 1,
      x: 0,
      y: 0,
      loading: true,
      trueWidth: 0,
      trueHeight: 0,
      move: true,
      moveX: 0,
      moveY: 0,
      crop: false,
      cropping: false,
      cropW: 0,
      cropH: 0,
      cropOldW: 0,
      cropOldH: 0,
      canChangeX: false,
      canChangeY: false,
      changeCropTypeX: 1,
      changeCropTypeY: 1,
      cropX: 0,
      cropY: 0,
      cropChangeX: 0,
      cropChangeY: 0,
      cropOffsertX: 0,
      cropOffsertY: 0,
      support: "",
      touches: [],
      touchNow: false,
      rotate: 0,
      isIos: false,
      orientation: 0,
      imgs: "",
      coe: 0.2,
      scaling: false,
      scalingSet: "",
      coeStatus: "",
      isCanShow: true,
      imgIsQqualCrop: false
    };
  },
  props: {
    img: {
      type: [String, Blob, null, File],
      default: ""
    },
    outputSize: {
      type: Number,
      default: 1
    },
    outputType: {
      type: String,
      default: "jpeg"
    },
    info: {
      type: Boolean,
      default: true
    },
    canScale: {
      type: Boolean,
      default: true
    },
    autoCrop: {
      type: Boolean,
      default: false
    },
    autoCropWidth: {
      type: [Number, String],
      default: 0
    },
    autoCropHeight: {
      type: [Number, String],
      default: 0
    },
    fixed: {
      type: Boolean,
      default: false
    },
    fixedNumber: {
      type: Array,
      default: () => [1, 1]
    },
    fixedBox: {
      type: Boolean,
      default: false
    },
    full: {
      type: Boolean,
      default: false
    },
    canMove: {
      type: Boolean,
      default: true
    },
    canMoveBox: {
      type: Boolean,
      default: true
    },
    original: {
      type: Boolean,
      default: false
    },
    centerBox: {
      type: Boolean,
      default: false
    },
    high: {
      type: Boolean,
      default: true
    },
    infoTrue: {
      type: Boolean,
      default: false
    },
    maxImgSize: {
      type: [Number, String],
      default: 2e3
    },
    enlarge: {
      type: [Number, String],
      default: 1
    },
    preW: {
      type: [Number, String],
      default: 0
    },
    mode: {
      type: String,
      default: "contain"
    },
    limitMinSize: {
      type: [Number, Array, String],
      default: () => 10,
      validator: function(t) {
        return Array.isArray(t) ? Number(t[0]) >= 0 && Number(t[1]) >= 0 : Number(t) >= 0;
      }
    },
    fillColor: {
      type: String,
      default: ""
    }
  },
  computed: {
    cropInfo() {
      let t = {};
      if (t.top = this.cropOffsertY > 21 ? "-21px" : "0px", t.width = this.cropW > 0 ? this.cropW : 0, t.height = this.cropH > 0 ? this.cropH : 0, this.infoTrue) {
        let e = 1;
        this.high && !this.full && (e = window.devicePixelRatio), this.enlarge !== 1 & !this.full && (e = Math.abs(Number(this.enlarge))), t.width = t.width * e, t.height = t.height * e, this.full && (t.width = t.width / this.scale, t.height = t.height / this.scale);
      }
      return t.width = t.width.toFixed(0), t.height = t.height.toFixed(0), t;
    },
    isIE() {
      return !!window.ActiveXObject || "ActiveXObject" in window;
    },
    passive() {
      return this.isIE ? null : {
        passive: false
      };
    }
  },
  watch: {
    img() {
      this.checkedImg();
    },
    imgs(t) {
      t !== "" && this.reload();
    },
    cropW() {
      this.showPreview();
    },
    cropH() {
      this.showPreview();
    },
    cropOffsertX() {
      this.showPreview();
    },
    cropOffsertY() {
      this.showPreview();
    },
    scale(t, e) {
      this.showPreview();
    },
    x() {
      this.showPreview();
    },
    y() {
      this.showPreview();
    },
    autoCrop(t) {
      t && this.goAutoCrop();
    },
    autoCropWidth() {
      this.autoCrop && this.goAutoCrop();
    },
    autoCropHeight() {
      this.autoCrop && this.goAutoCrop();
    },
    mode() {
      this.checkedImg();
    },
    rotate() {
      this.showPreview(), this.autoCrop ? this.goAutoCrop(this.cropW, this.cropH) : (this.cropW > 0 || this.cropH > 0) && this.goAutoCrop(this.cropW, this.cropH);
    }
  },
  methods: {
    getVersion(t) {
      var e = navigator.userAgent.split(" "), i = "";
      let s = 0;
      const r = new RegExp(t, "i");
      for (var o = 0; o < e.length; o++)
        r.test(e[o]) && (i = e[o]);
      return i ? s = i.split("/")[1].split(".") : s = ["0", "0", "0"], s;
    },
    checkOrientationImage(t, e, i, s) {
      if (this.getVersion("chrome")[0] >= 81)
        e = -1;
      else if (this.getVersion("safari")[0] >= 605) {
        const h = this.getVersion("version");
        h[0] > 13 && h[1] > 1 && (e = -1);
      } else {
        const h = navigator.userAgent.toLowerCase().match(/cpu iphone os (.*?) like mac os/);
        if (h) {
          let n = h[1];
          n = n.split("_"), (n[0] > 13 || n[0] >= 13 && n[1] >= 4) && (e = -1);
        }
      }
      let r = document.createElement("canvas"), o = r.getContext("2d");
      switch (o.save(), e) {
        case 2:
          r.width = i, r.height = s, o.translate(i, 0), o.scale(-1, 1);
          break;
        case 3:
          r.width = i, r.height = s, o.translate(i / 2, s / 2), o.rotate(180 * Math.PI / 180), o.translate(-i / 2, -s / 2);
          break;
        case 4:
          r.width = i, r.height = s, o.translate(0, s), o.scale(1, -1);
          break;
        case 5:
          r.height = i, r.width = s, o.rotate(0.5 * Math.PI), o.scale(1, -1);
          break;
        case 6:
          r.width = s, r.height = i, o.translate(s / 2, i / 2), o.rotate(90 * Math.PI / 180), o.translate(-i / 2, -s / 2);
          break;
        case 7:
          r.height = i, r.width = s, o.rotate(0.5 * Math.PI), o.translate(i, -s), o.scale(-1, 1);
          break;
        case 8:
          r.height = i, r.width = s, o.translate(s / 2, i / 2), o.rotate(-90 * Math.PI / 180), o.translate(-i / 2, -s / 2);
          break;
        default:
          r.width = i, r.height = s;
      }
      o.drawImage(t, 0, 0, i, s), o.restore(), r.toBlob(
        (h) => {
          let n = URL.createObjectURL(h);
          URL.revokeObjectURL(this.imgs), this.imgs = n;
        },
        "image/" + this.outputType,
        1
      );
    },
    checkedImg() {
      if (this.img === null || this.img === "") {
        this.imgs = "", this.clearCrop();
        return;
      }
      this.loading = true, this.scale = 1, this.rotate = 0, this.imgIsQqualCrop = false, this.clearCrop();
      let t = new Image();
      if (t.onload = () => {
        if (this.img === "")
          return this.$emit("img-load", new Error("\u56FE\u7247\u4E0D\u80FD\u4E3A\u7A7A")), false;
        let i = t.width, s = t.height;
        X.getData(t).then((r) => {
          this.orientation = r.orientation || 1;
          let o = Number(this.maxImgSize);
          if (!this.orientation && i < o & s < o) {
            this.imgs = this.img;
            return;
          }
          i > o && (s = s / i * o, i = o), s > o && (i = i / s * o, s = o), this.checkOrientationImage(t, this.orientation, i, s);
        }).catch((r) => {
          this.$emit("img-load", "error"), this.$emit("img-load-error", r);
        });
      }, t.onerror = (i) => {
        this.$emit("img-load", "error"), this.$emit("img-load-error", i);
      }, this.img.substr(0, 4) !== "data" && (t.crossOrigin = ""), this.isIE) {
        var e = new XMLHttpRequest();
        e.onload = function() {
          var i = URL.createObjectURL(this.response);
          t.src = i;
        }, e.open("GET", this.img, true), e.responseType = "blob", e.send();
      } else
        t.src = this.img;
    },
    startMove(t) {
      if (t.preventDefault(), this.move && !this.crop) {
        if (!this.canMove)
          return false;
        this.moveX = ("clientX" in t ? t.clientX : t.touches[0].clientX) - this.x, this.moveY = ("clientY" in t ? t.clientY : t.touches[0].clientY) - this.y, t.touches ? (window.addEventListener("touchmove", this.moveImg), window.addEventListener("touchend", this.leaveImg), t.touches.length == 2 && (this.touches = t.touches, window.addEventListener("touchmove", this.touchScale), window.addEventListener("touchend", this.cancelTouchScale))) : (window.addEventListener("mousemove", this.moveImg), window.addEventListener("mouseup", this.leaveImg)), this.$emit("img-moving", {
          moving: true,
          axis: this.getImgAxis()
        });
      } else
        this.cropping = true, window.addEventListener("mousemove", this.createCrop), window.addEventListener("mouseup", this.endCrop), window.addEventListener("touchmove", this.createCrop), window.addEventListener("touchend", this.endCrop), this.cropOffsertX = t.offsetX ? t.offsetX : t.touches[0].pageX - this.$refs.cropper.offsetLeft, this.cropOffsertY = t.offsetY ? t.offsetY : t.touches[0].pageY - this.$refs.cropper.offsetTop, this.cropX = "clientX" in t ? t.clientX : t.touches[0].clientX, this.cropY = "clientY" in t ? t.clientY : t.touches[0].clientY, this.cropChangeX = this.cropOffsertX, this.cropChangeY = this.cropOffsertY, this.cropW = 0, this.cropH = 0;
    },
    touchScale(t) {
      t.preventDefault();
      let e = this.scale;
      var i = {
        x: this.touches[0].clientX,
        y: this.touches[0].clientY
      }, s = {
        x: t.touches[0].clientX,
        y: t.touches[0].clientY
      }, r = {
        x: this.touches[1].clientX,
        y: this.touches[1].clientY
      }, o = {
        x: t.touches[1].clientX,
        y: t.touches[1].clientY
      }, h = Math.sqrt(
        Math.pow(i.x - r.x, 2) + Math.pow(i.y - r.y, 2)
      ), n = Math.sqrt(
        Math.pow(s.x - o.x, 2) + Math.pow(s.y - o.y, 2)
      ), l = n - h, c = 1;
      c = c / this.trueWidth > c / this.trueHeight ? c / this.trueHeight : c / this.trueWidth, c = c > 0.1 ? 0.1 : c;
      var a = c * l;
      if (!this.touchNow) {
        if (this.touchNow = true, l > 0 ? e += Math.abs(a) : l < 0 && e > Math.abs(a) && (e -= Math.abs(a)), this.touches = t.touches, setTimeout(() => {
          this.touchNow = false;
        }, 8), !this.checkoutImgAxis(this.x, this.y, e))
          return false;
        this.scale = e;
      }
    },
    cancelTouchScale(t) {
      window.removeEventListener("touchmove", this.touchScale);
    },
    moveImg(t) {
      if (t.preventDefault(), t.touches && t.touches.length === 2)
        return this.touches = t.touches, window.addEventListener("touchmove", this.touchScale), window.addEventListener("touchend", this.cancelTouchScale), window.removeEventListener("touchmove", this.moveImg), false;
      let e = "clientX" in t ? t.clientX : t.touches[0].clientX, i = "clientY" in t ? t.clientY : t.touches[0].clientY, s, r;
      s = e - this.moveX, r = i - this.moveY, this.$nextTick(() => {
        if (this.centerBox) {
          let o = this.getImgAxis(s, r, this.scale), h = this.getCropAxis(), n = this.trueHeight * this.scale, l = this.trueWidth * this.scale, c, a, p, f;
          switch (this.rotate) {
            case 1:
            case -1:
            case 3:
            case -3:
              c = this.cropOffsertX - this.trueWidth * (1 - this.scale) / 2 + (n - l) / 2, a = this.cropOffsertY - this.trueHeight * (1 - this.scale) / 2 + (l - n) / 2, p = c - n + this.cropW, f = a - l + this.cropH;
              break;
            default:
              c = this.cropOffsertX - this.trueWidth * (1 - this.scale) / 2, a = this.cropOffsertY - this.trueHeight * (1 - this.scale) / 2, p = c - l + this.cropW, f = a - n + this.cropH;
              break;
          }
          o.x1 >= h.x1 && (s = c), o.y1 >= h.y1 && (r = a), o.x2 <= h.x2 && (s = p), o.y2 <= h.y2 && (r = f);
        }
        this.x = s, this.y = r, this.$emit("img-moving", {
          moving: true,
          axis: this.getImgAxis()
        });
      });
    },
    leaveImg(t) {
      window.removeEventListener("mousemove", this.moveImg), window.removeEventListener("touchmove", this.moveImg), window.removeEventListener("mouseup", this.leaveImg), window.removeEventListener("touchend", this.leaveImg), this.$emit("img-moving", {
        moving: false,
        axis: this.getImgAxis()
      });
    },
    scaleImg() {
      this.canScale && window.addEventListener(this.support, this.changeSize, this.passive);
    },
    cancelScale() {
      this.canScale && window.removeEventListener(this.support, this.changeSize);
    },
    changeSize(t) {
      t.preventDefault();
      let e = this.scale;
      var i = t.deltaY || t.wheelDelta, s = navigator.userAgent.indexOf("Firefox");
      i = s > 0 ? i * 30 : i, this.isIE && (i = -i);
      var r = this.coe;
      r = r / this.trueWidth > r / this.trueHeight ? r / this.trueHeight : r / this.trueWidth;
      var o = r * i;
      o < 0 ? e += Math.abs(o) : e > Math.abs(o) && (e -= Math.abs(o));
      let h = o < 0 ? "add" : "reduce";
      if (h !== this.coeStatus && (this.coeStatus = h, this.coe = 0.2), this.scaling || (this.scalingSet = setTimeout(() => {
        this.scaling = false, this.coe = this.coe += 0.01;
      }, 50)), this.scaling = true, !this.checkoutImgAxis(this.x, this.y, e))
        return false;
      this.scale = e;
    },
    changeScale(t) {
      let e = this.scale;
      t = t || 1;
      var i = 20;
      if (i = i / this.trueWidth > i / this.trueHeight ? i / this.trueHeight : i / this.trueWidth, t = t * i, t > 0 ? e += Math.abs(t) : e > Math.abs(t) && (e -= Math.abs(t)), !this.checkoutImgAxis(this.x, this.y, e))
        return false;
      this.scale = e;
    },
    createCrop(t) {
      t.preventDefault();
      var e = "clientX" in t ? t.clientX : t.touches ? t.touches[0].clientX : 0, i = "clientY" in t ? t.clientY : t.touches ? t.touches[0].clientY : 0;
      this.$nextTick(() => {
        var s = e - this.cropX, r = i - this.cropY;
        if (s > 0 ? (this.cropW = s + this.cropChangeX > this.w ? this.w - this.cropChangeX : s, this.cropOffsertX = this.cropChangeX) : (this.cropW = this.w - this.cropChangeX + Math.abs(s) > this.w ? this.cropChangeX : Math.abs(s), this.cropOffsertX = this.cropChangeX + s > 0 ? this.cropChangeX + s : 0), !this.fixed)
          r > 0 ? (this.cropH = r + this.cropChangeY > this.h ? this.h - this.cropChangeY : r, this.cropOffsertY = this.cropChangeY) : (this.cropH = this.h - this.cropChangeY + Math.abs(r) > this.h ? this.cropChangeY : Math.abs(r), this.cropOffsertY = this.cropChangeY + r > 0 ? this.cropChangeY + r : 0);
        else {
          var o = this.cropW / this.fixedNumber[0] * this.fixedNumber[1];
          o + this.cropOffsertY > this.h ? (this.cropH = this.h - this.cropOffsertY, this.cropW = this.cropH / this.fixedNumber[1] * this.fixedNumber[0], s > 0 ? this.cropOffsertX = this.cropChangeX : this.cropOffsertX = this.cropChangeX - this.cropW) : this.cropH = o, this.cropOffsertY = this.cropOffsertY;
        }
      });
    },
    changeCropSize(t, e, i, s, r) {
      t.preventDefault(), window.addEventListener("mousemove", this.changeCropNow), window.addEventListener("mouseup", this.changeCropEnd), window.addEventListener("touchmove", this.changeCropNow), window.addEventListener("touchend", this.changeCropEnd), this.canChangeX = e, this.canChangeY = i, this.changeCropTypeX = s, this.changeCropTypeY = r, this.cropX = "clientX" in t ? t.clientX : t.touches[0].clientX, this.cropY = "clientY" in t ? t.clientY : t.touches[0].clientY, this.cropOldW = this.cropW, this.cropOldH = this.cropH, this.cropChangeX = this.cropOffsertX, this.cropChangeY = this.cropOffsertY, this.fixed && this.canChangeX && this.canChangeY && (this.canChangeY = 0), this.$emit("change-crop-size", {
        width: this.cropW,
        height: this.cropH
      });
    },
    changeCropNow(t) {
      t.preventDefault();
      var e = "clientX" in t ? t.clientX : t.touches ? t.touches[0].clientX : 0, i = "clientY" in t ? t.clientY : t.touches ? t.touches[0].clientY : 0;
      let s = this.w, r = this.h, o = 0, h = 0;
      if (this.centerBox) {
        let c = this.getImgAxis(), a = c.x2, p = c.y2;
        o = c.x1 > 0 ? c.x1 : 0, h = c.y1 > 0 ? c.y1 : 0, s > a && (s = a), r > p && (r = p);
      }
      const [n, l] = this.checkCropLimitSize();
      this.$nextTick(() => {
        var c = e - this.cropX, a = i - this.cropY;
        if (this.canChangeX && (this.changeCropTypeX === 1 ? this.cropOldW - c < n ? (this.cropW = n, this.cropOffsertX = this.cropOldW + this.cropChangeX - o - n) : this.cropOldW - c > 0 ? (this.cropW = s - this.cropChangeX - c <= s - o ? this.cropOldW - c : this.cropOldW + this.cropChangeX - o, this.cropOffsertX = s - this.cropChangeX - c <= s - o ? this.cropChangeX + c : o) : (this.cropW = Math.abs(c) + this.cropChangeX <= s ? Math.abs(c) - this.cropOldW : s - this.cropOldW - this.cropChangeX, this.cropOffsertX = this.cropChangeX + this.cropOldW) : this.changeCropTypeX === 2 && (this.cropOldW + c < n ? this.cropW = n : this.cropOldW + c > 0 ? (this.cropW = this.cropOldW + c + this.cropOffsertX <= s ? this.cropOldW + c : s - this.cropOffsertX, this.cropOffsertX = this.cropChangeX) : (this.cropW = s - this.cropChangeX + Math.abs(c + this.cropOldW) <= s - o ? Math.abs(c + this.cropOldW) : this.cropChangeX - o, this.cropOffsertX = s - this.cropChangeX + Math.abs(c + this.cropOldW) <= s - o ? this.cropChangeX - Math.abs(c + this.cropOldW) : o))), this.canChangeY && (this.changeCropTypeY === 1 ? this.cropOldH - a < l ? (this.cropH = l, this.cropOffsertY = this.cropOldH + this.cropChangeY - h - l) : this.cropOldH - a > 0 ? (this.cropH = r - this.cropChangeY - a <= r - h ? this.cropOldH - a : this.cropOldH + this.cropChangeY - h, this.cropOffsertY = r - this.cropChangeY - a <= r - h ? this.cropChangeY + a : h) : (this.cropH = Math.abs(a) + this.cropChangeY <= r ? Math.abs(a) - this.cropOldH : r - this.cropOldH - this.cropChangeY, this.cropOffsertY = this.cropChangeY + this.cropOldH) : this.changeCropTypeY === 2 && (this.cropOldH + a < l ? this.cropH = l : this.cropOldH + a > 0 ? (this.cropH = this.cropOldH + a + this.cropOffsertY <= r ? this.cropOldH + a : r - this.cropOffsertY, this.cropOffsertY = this.cropChangeY) : (this.cropH = r - this.cropChangeY + Math.abs(a + this.cropOldH) <= r - h ? Math.abs(a + this.cropOldH) : this.cropChangeY - h, this.cropOffsertY = r - this.cropChangeY + Math.abs(a + this.cropOldH) <= r - h ? this.cropChangeY - Math.abs(a + this.cropOldH) : h))), this.canChangeX && this.fixed) {
          var p = this.cropW / this.fixedNumber[0] * this.fixedNumber[1];
          p < l ? (this.cropH = l, this.cropW = this.fixedNumber[0] * l / this.fixedNumber[1], this.changeCropTypeX === 1 && (this.cropOffsertX = this.cropChangeX + (this.cropOldW - this.cropW))) : p + this.cropOffsertY > r ? (this.cropH = r - this.cropOffsertY, this.cropW = this.cropH / this.fixedNumber[1] * this.fixedNumber[0], this.changeCropTypeX === 1 && (this.cropOffsertX = this.cropChangeX + (this.cropOldW - this.cropW))) : this.cropH = p;
        }
        if (this.canChangeY && this.fixed) {
          var f = this.cropH / this.fixedNumber[1] * this.fixedNumber[0];
          f < n ? (this.cropW = n, this.cropH = this.fixedNumber[1] * n / this.fixedNumber[0], this.cropOffsertY = this.cropOldH + this.cropChangeY - this.cropH) : f + this.cropOffsertX > s ? (this.cropW = s - this.cropOffsertX, this.cropH = this.cropW / this.fixedNumber[0] * this.fixedNumber[1]) : this.cropW = f;
        }
      });
    },
    checkCropLimitSize() {
      let { cropW: t, cropH: e, limitMinSize: i } = this, s = new Array();
      return Array.isArray(i) ? s = i : s = [i, i], t = parseFloat(s[0]), e = parseFloat(s[1]), [t, e];
    },
    changeCropEnd(t) {
      window.removeEventListener("mousemove", this.changeCropNow), window.removeEventListener("mouseup", this.changeCropEnd), window.removeEventListener("touchmove", this.changeCropNow), window.removeEventListener("touchend", this.changeCropEnd);
    },
    calculateSize(t, e, i, s, r, o) {
      const h = t / e;
      let n = r, l = o;
      return n < i && (n = i, l = Math.ceil(n / h)), l < s && (l = s, n = Math.ceil(l * h), n < i && (n = i, l = Math.ceil(n / h))), n < r && (n = r, l = Math.ceil(n / h)), l < o && (l = o, n = Math.ceil(l * h)), { width: n, height: l };
    },
    endCrop() {
      this.cropW === 0 && this.cropH === 0 && (this.cropping = false);
      let [t, e] = this.checkCropLimitSize();
      const { width: i, height: s } = this.fixed ? this.calculateSize(
        this.fixedNumber[0],
        this.fixedNumber[1],
        t,
        e,
        this.cropW,
        this.cropH
      ) : { width: t, height: e };
      i > this.cropW && (this.cropW = i, this.cropOffsertX + i > this.w && (this.cropOffsertX = this.w - i)), s > this.cropH && (this.cropH = s, this.cropOffsertY + s > this.h && (this.cropOffsertY = this.h - s)), window.removeEventListener("mousemove", this.createCrop), window.removeEventListener("mouseup", this.endCrop), window.removeEventListener("touchmove", this.createCrop), window.removeEventListener("touchend", this.endCrop);
    },
    startCrop() {
      this.crop = true;
    },
    stopCrop() {
      this.crop = false;
    },
    clearCrop() {
      this.cropping = false, this.cropW = 0, this.cropH = 0;
    },
    cropMove(t) {
      if (t.preventDefault(), !this.canMoveBox)
        return this.crop = false, this.startMove(t), false;
      if (t.touches && t.touches.length === 2)
        return this.crop = false, this.startMove(t), this.leaveCrop(), false;
      window.addEventListener("mousemove", this.moveCrop), window.addEventListener("mouseup", this.leaveCrop), window.addEventListener("touchmove", this.moveCrop), window.addEventListener("touchend", this.leaveCrop);
      let e = "clientX" in t ? t.clientX : t.touches[0].clientX, i = "clientY" in t ? t.clientY : t.touches[0].clientY, s, r;
      s = e - this.cropOffsertX, r = i - this.cropOffsertY, this.cropX = s, this.cropY = r, this.$emit("crop-moving", {
        moving: true,
        axis: this.getCropAxis()
      });
    },
    moveCrop(t, e) {
      let i = 0, s = 0;
      t && (t.preventDefault(), i = "clientX" in t ? t.clientX : t.touches[0].clientX, s = "clientY" in t ? t.clientY : t.touches[0].clientY), this.$nextTick(() => {
        let r, o, h = i - this.cropX, n = s - this.cropY;
        if (e && (h = this.cropOffsertX, n = this.cropOffsertY), h <= 0 ? r = 0 : h + this.cropW > this.w ? r = this.w - this.cropW : r = h, n <= 0 ? o = 0 : n + this.cropH > this.h ? o = this.h - this.cropH : o = n, this.centerBox) {
          let l = this.getImgAxis();
          r <= l.x1 && (r = l.x1), r + this.cropW > l.x2 && (r = l.x2 - this.cropW), o <= l.y1 && (o = l.y1), o + this.cropH > l.y2 && (o = l.y2 - this.cropH);
        }
        this.cropOffsertX = r, this.cropOffsertY = o, this.$emit("crop-moving", {
          moving: true,
          axis: this.getCropAxis()
        });
      });
    },
    getImgAxis(t, e, i) {
      t = t || this.x, e = e || this.y, i = i || this.scale;
      let s = {
        x1: 0,
        x2: 0,
        y1: 0,
        y2: 0
      }, r = this.trueWidth * i, o = this.trueHeight * i;
      switch (this.rotate) {
        case 0:
          s.x1 = t + this.trueWidth * (1 - i) / 2, s.x2 = s.x1 + this.trueWidth * i, s.y1 = e + this.trueHeight * (1 - i) / 2, s.y2 = s.y1 + this.trueHeight * i;
          break;
        case 1:
        case -1:
        case 3:
        case -3:
          s.x1 = t + this.trueWidth * (1 - i) / 2 + (r - o) / 2, s.x2 = s.x1 + this.trueHeight * i, s.y1 = e + this.trueHeight * (1 - i) / 2 + (o - r) / 2, s.y2 = s.y1 + this.trueWidth * i;
          break;
        default:
          s.x1 = t + this.trueWidth * (1 - i) / 2, s.x2 = s.x1 + this.trueWidth * i, s.y1 = e + this.trueHeight * (1 - i) / 2, s.y2 = s.y1 + this.trueHeight * i;
          break;
      }
      return s;
    },
    getCropAxis() {
      let t = {
        x1: 0,
        x2: 0,
        y1: 0,
        y2: 0
      };
      return t.x1 = this.cropOffsertX, t.x2 = t.x1 + this.cropW, t.y1 = this.cropOffsertY, t.y2 = t.y1 + this.cropH, t;
    },
    leaveCrop(t) {
      window.removeEventListener("mousemove", this.moveCrop), window.removeEventListener("mouseup", this.leaveCrop), window.removeEventListener("touchmove", this.moveCrop), window.removeEventListener("touchend", this.leaveCrop), this.$emit("crop-moving", {
        moving: false,
        axis: this.getCropAxis()
      });
    },
    getCropChecked(t) {
      let e = document.createElement("canvas"), i = new Image(), s = this.rotate, r = this.trueWidth, o = this.trueHeight, h = this.cropOffsertX, n = this.cropOffsertY;
      i.onload = () => {
        if (this.cropW !== 0) {
          let a = e.getContext("2d"), p = 1;
          this.high & !this.full && (p = window.devicePixelRatio), this.enlarge !== 1 & !this.full && (p = Math.abs(Number(this.enlarge)));
          let f = this.cropW * p, w = this.cropH * p, u = r * this.scale * p, g = o * this.scale * p, d = (this.x - h + this.trueWidth * (1 - this.scale) / 2) * p, m = (this.y - n + this.trueHeight * (1 - this.scale) / 2) * p;
          switch (c(f, w), a.save(), this.fillColor && (a.fillStyle = this.fillColor, a.fillRect(0, 0, e.width, e.height)), s) {
            case 0:
              this.full ? (c(f / this.scale, w / this.scale), a.drawImage(
                i,
                d / this.scale,
                m / this.scale,
                u / this.scale,
                g / this.scale
              )) : a.drawImage(i, d, m, u, g);
              break;
            case 1:
            case -3:
              this.full ? (c(f / this.scale, w / this.scale), d = d / this.scale + (u / this.scale - g / this.scale) / 2, m = m / this.scale + (g / this.scale - u / this.scale) / 2, a.rotate(s * 90 * Math.PI / 180), a.drawImage(
                i,
                m,
                -d - g / this.scale,
                u / this.scale,
                g / this.scale
              )) : (d = d + (u - g) / 2, m = m + (g - u) / 2, a.rotate(s * 90 * Math.PI / 180), a.drawImage(i, m, -d - g, u, g));
              break;
            case 2:
            case -2:
              this.full ? (c(f / this.scale, w / this.scale), a.rotate(s * 90 * Math.PI / 180), d = d / this.scale, m = m / this.scale, a.drawImage(
                i,
                -d - u / this.scale,
                -m - g / this.scale,
                u / this.scale,
                g / this.scale
              )) : (a.rotate(s * 90 * Math.PI / 180), a.drawImage(i, -d - u, -m - g, u, g));
              break;
            case 3:
            case -1:
              this.full ? (c(f / this.scale, w / this.scale), d = d / this.scale + (u / this.scale - g / this.scale) / 2, m = m / this.scale + (g / this.scale - u / this.scale) / 2, a.rotate(s * 90 * Math.PI / 180), a.drawImage(
                i,
                -m - u / this.scale,
                d,
                u / this.scale,
                g / this.scale
              )) : (d = d + (u - g) / 2, m = m + (g - u) / 2, a.rotate(s * 90 * Math.PI / 180), a.drawImage(i, -m - u, d, u, g));
              break;
            default:
              this.full ? (c(f / this.scale, w / this.scale), a.drawImage(
                i,
                d / this.scale,
                m / this.scale,
                u / this.scale,
                g / this.scale
              )) : a.drawImage(i, d, m, u, g);
          }
          a.restore();
        } else {
          let a = r * this.scale, p = o * this.scale, f = e.getContext("2d");
          switch (f.save(), this.fillColor && (f.fillStyle = this.fillColor, f.fillRect(0, 0, e.width, e.height)), s) {
            case 0:
              c(a, p), f.drawImage(i, 0, 0, a, p);
              break;
            case 1:
            case -3:
              c(p, a), f.rotate(s * 90 * Math.PI / 180), f.drawImage(i, 0, -p, a, p);
              break;
            case 2:
            case -2:
              c(a, p), f.rotate(s * 90 * Math.PI / 180), f.drawImage(i, -a, -p, a, p);
              break;
            case 3:
            case -1:
              c(p, a), f.rotate(s * 90 * Math.PI / 180), f.drawImage(i, -a, 0, a, p);
              break;
            default:
              c(a, p), f.drawImage(i, 0, 0, a, p);
          }
          f.restore();
        }
        t(e);
      };
      var l = this.img.substr(0, 4);
      l !== "data" && (i.crossOrigin = "Anonymous"), i.src = this.imgs;
      function c(a, p) {
        e.width = Math.round(a), e.height = Math.round(p);
      }
    },
    getCropData(t) {
      this.getCropChecked((e) => {
        t(e.toDataURL("image/" + this.outputType, this.outputSize));
      });
    },
    getCropBlob(t) {
      this.getCropChecked((e) => {
        e.toBlob(
          (i) => t(i),
          "image/" + this.outputType,
          this.outputSize
        );
      });
    },
    showPreview() {
      if (this.isCanShow)
        this.isCanShow = false, setTimeout(() => {
          this.isCanShow = true;
        }, 16);
      else
        return false;
      let t = this.cropW, e = this.cropH, i = this.scale;
      var s = {};
      s.div = {
        width: `${t}px`,
        height: `${e}px`
      };
      let r = (this.x - this.cropOffsertX) / i, o = (this.y - this.cropOffsertY) / i, h = 0;
      s.w = t, s.h = e, s.url = this.imgs, s.img = {
        width: `${this.trueWidth}px`,
        height: `${this.trueHeight}px`,
        transform: `scale(${i})translate3d(${r}px, ${o}px, ${h}px)rotateZ(${this.rotate * 90}deg)`
      }, s.html = `
      <div class="show-preview" style="width: ${s.w}px; height: ${s.h}px,; overflow: hidden">
        <div style="width: ${t}px; height: ${e}px">
          <img src=${s.url} style="width: ${this.trueWidth}px; height: ${this.trueHeight}px; transform:
          scale(${i})translate3d(${r}px, ${o}px, ${h}px)rotateZ(${this.rotate * 90}deg)">
        </div>
      </div>`, this.$emit("real-time", s);
    },
    reload() {
      let t = new Image();
      t.onload = () => {
        this.w = parseFloat(window.getComputedStyle(this.$refs.cropper).width), this.h = parseFloat(window.getComputedStyle(this.$refs.cropper).height), this.trueWidth = t.width, this.trueHeight = t.height, this.original ? this.scale = 1 : this.scale = this.checkedMode(), this.$nextTick(() => {
          this.x = -(this.trueWidth - this.trueWidth * this.scale) / 2 + (this.w - this.trueWidth * this.scale) / 2, this.y = -(this.trueHeight - this.trueHeight * this.scale) / 2 + (this.h - this.trueHeight * this.scale) / 2, this.loading = false, this.autoCrop && this.goAutoCrop(), this.$emit("img-load", "success"), setTimeout(() => {
            this.showPreview();
          }, 20);
        });
      }, t.onerror = () => {
        this.$emit("img-load", "error");
      }, t.src = this.imgs;
    },
    checkedMode() {
      let t = 1, e = this.trueWidth, i = this.trueHeight;
      const s = this.mode.split(" ");
      switch (s[0]) {
        case "contain":
          this.trueWidth > this.w && (t = this.w / this.trueWidth), this.trueHeight * t > this.h && (t = this.h / this.trueHeight);
          break;
        case "cover":
          e = this.w, t = e / this.trueWidth, i = i * t, i < this.h && (i = this.h, t = i / this.trueHeight);
          break;
        default:
          try {
            let r = s[0];
            if (r.search("px") !== -1) {
              r = r.replace("px", ""), e = parseFloat(r);
              const o = e / this.trueWidth;
              let h = 1, n = s[1];
              n.search("px") !== -1 && (n = n.replace("px", ""), i = parseFloat(n), h = i / this.trueHeight), t = Math.min(o, h);
            }
            if (r.search("%") !== -1 && (r = r.replace("%", ""), e = parseFloat(r) / 100 * this.w, t = e / this.trueWidth), s.length === 2 && r === "auto") {
              let o = s[1];
              o.search("px") !== -1 && (o = o.replace("px", ""), i = parseFloat(o), t = i / this.trueHeight), o.search("%") !== -1 && (o = o.replace("%", ""), i = parseFloat(o) / 100 * this.h, t = i / this.trueHeight);
            }
          } catch {
            t = 1;
          }
      }
      return t;
    },
    goAutoCrop(t, e) {
      if (this.imgs === "" || this.imgs === null)
        return;
      this.clearCrop(), this.cropping = true;
      let i = this.w, s = this.h;
      if (this.centerBox) {
        const h = Math.abs(this.rotate) % 2 > 0;
        let n = (h ? this.trueHeight : this.trueWidth) * this.scale, l = (h ? this.trueWidth : this.trueHeight) * this.scale;
        i = n < i ? n : i, s = l < s ? l : s;
      }
      var r = t || parseFloat(this.autoCropWidth), o = e || parseFloat(this.autoCropHeight);
      (r === 0 || o === 0) && (r = i * 0.8, o = s * 0.8), r = r > i ? i : r, o = o > s ? s : o, this.fixed && (o = r / this.fixedNumber[0] * this.fixedNumber[1]), o > this.h && (o = this.h, r = o / this.fixedNumber[1] * this.fixedNumber[0]), this.changeCrop(r, o);
    },
    changeCrop(t, e) {
      if (this.centerBox) {
        let i = this.getImgAxis();
        t > i.x2 - i.x1 && (t = i.x2 - i.x1, e = t / this.fixedNumber[0] * this.fixedNumber[1]), e > i.y2 - i.y1 && (e = i.y2 - i.y1, t = e / this.fixedNumber[1] * this.fixedNumber[0]);
      }
      this.cropW = t, this.cropH = e, this.checkCropLimitSize(), this.$nextTick(() => {
        this.cropOffsertX = (this.w - this.cropW) / 2, this.cropOffsertY = (this.h - this.cropH) / 2, this.centerBox && this.moveCrop(null, true);
      });
    },
    refresh() {
      this.img, this.imgs = "", this.scale = 1, this.crop = false, this.rotate = 0, this.w = 0, this.h = 0, this.trueWidth = 0, this.trueHeight = 0, this.imgIsQqualCrop = false, this.clearCrop(), this.$nextTick(() => {
        this.checkedImg();
      });
    },
    rotateLeft() {
      this.rotate = this.rotate <= -3 ? 0 : this.rotate - 1;
    },
    rotateRight() {
      this.rotate = this.rotate >= 3 ? 0 : this.rotate + 1;
    },
    rotateClear() {
      this.rotate = 0;
    },
    checkoutImgAxis(t, e, i) {
      t = t || this.x, e = e || this.y, i = i || this.scale;
      let s = true;
      if (this.centerBox) {
        let r = this.getImgAxis(t, e, i), o = this.getCropAxis();
        r.x1 >= o.x1 && (s = false), r.x2 <= o.x2 && (s = false), r.y1 >= o.y1 && (s = false), r.y2 <= o.y2 && (s = false), s || this.changeImgScale(r, o, i);
      }
      return s;
    },
    changeImgScale(t, e, i) {
      const s = this.cropW > this.cropH ? this.cropW / this.trueWidth : this.cropH / this.trueWidth;
      let r = this.trueWidth * i, o = this.trueHeight * i;
      r >= this.cropW && o >= this.cropH ? this.scale = i : (this.scale = s, r = this.trueWidth * s, o = this.trueHeight * s), this.imgIsQqualCrop || (t.x1 >= e.x1 && (this.x = e.x1 - (this.trueWidth - r) / 2), t.x2 <= e.x2 && (this.x = e.x2 - (this.trueWidth - r) / 2 - r), t.y1 >= e.y1 && (this.y = e.y1 - (this.trueHeight - o) / 2), t.y2 <= e.y2 && (this.y = e.y2 - (this.trueHeight - o) / 2 - o)), (r < this.cropW || o < this.cropH) && (this.imgIsQqualCrop = true);
    }
  },
  mounted() {
    this.support = "onwheel" in document.createElement("div") ? "wheel" : document.onmousewheel !== void 0 ? "mousewheel" : "DOMMouseScroll";
    let t = this;
    var e = navigator.userAgent;
    this.isIOS = !!e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), HTMLCanvasElement.prototype.toBlob || Object.defineProperty(HTMLCanvasElement.prototype, "toBlob", {
      value: function(i, s, r) {
        for (var o = atob(this.toDataURL(s, r).split(",")[1]), h = o.length, n = new Uint8Array(h), l = 0; l < h; l++)
          n[l] = o.charCodeAt(l);
        i(new Blob([n], { type: t.type || "image/png" }));
      }
    }), this.showPreview(), this.checkedImg();
  },
  unmounted() {
    window.removeEventListener("mousemove", this.moveCrop), window.removeEventListener("mouseup", this.leaveCrop), window.removeEventListener("touchmove", this.moveCrop), window.removeEventListener("touchend", this.leaveCrop), this.cancelScale();
  }
}), z = {
  key: 0,
  class: "cropper-box"
}, A = ["src"], B = { class: "cropper-view-box" }, P = ["src"], D = { key: 1 };
function U(t, e, i, s, r, o) {
  return openBlock(), createElementBlock("div", {
    class: "vue-cropper",
    ref: "cropper",
    onMouseover: e[28] || (e[28] = (...h) => t.scaleImg && t.scaleImg(...h)),
    onMouseout: e[29] || (e[29] = (...h) => t.cancelScale && t.cancelScale(...h))
  }, [
    t.imgs ? (openBlock(), createElementBlock("div", z, [
      withDirectives(createElementVNode("div", {
        class: "cropper-box-canvas",
        style: normalizeStyle({
          width: t.trueWidth + "px",
          height: t.trueHeight + "px",
          transform: "scale(" + t.scale + "," + t.scale + ") translate3d(" + t.x / t.scale + "px," + t.y / t.scale + "px,0)rotateZ(" + t.rotate * 90 + "deg)"
        })
      }, [
        createElementVNode("img", {
          src: t.imgs,
          alt: "cropper-img",
          ref: "cropperImg"
        }, null, 8, A)
      ], 4), [
        [vShow, !t.loading]
      ])
    ])) : createCommentVNode("", true),
    createElementVNode("div", {
      class: normalizeClass(["cropper-drag-box", { "cropper-move": t.move && !t.crop, "cropper-crop": t.crop, "cropper-modal": t.cropping }]),
      onMousedown: e[0] || (e[0] = (...h) => t.startMove && t.startMove(...h)),
      onTouchstart: e[1] || (e[1] = (...h) => t.startMove && t.startMove(...h))
    }, null, 34),
    withDirectives(createElementVNode("div", {
      class: "cropper-crop-box",
      style: normalizeStyle({
        width: t.cropW + "px",
        height: t.cropH + "px",
        transform: "translate3d(" + t.cropOffsertX + "px," + t.cropOffsertY + "px,0)"
      })
    }, [
      createElementVNode("span", B, [
        createElementVNode("img", {
          style: normalizeStyle({
            width: t.trueWidth + "px",
            height: t.trueHeight + "px",
            transform: "scale(" + t.scale + "," + t.scale + ") translate3d(" + (t.x - t.cropOffsertX) / t.scale + "px," + (t.y - t.cropOffsertY) / t.scale + "px,0)rotateZ(" + t.rotate * 90 + "deg)"
          }),
          src: t.imgs,
          alt: "cropper-img"
        }, null, 12, P)
      ]),
      createElementVNode("span", {
        class: "cropper-face cropper-move",
        onMousedown: e[2] || (e[2] = (...h) => t.cropMove && t.cropMove(...h)),
        onTouchstart: e[3] || (e[3] = (...h) => t.cropMove && t.cropMove(...h))
      }, null, 32),
      t.info ? (openBlock(), createElementBlock("span", {
        key: 0,
        class: "crop-info",
        style: normalizeStyle({ top: t.cropInfo.top })
      }, toDisplayString(t.cropInfo.width) + " \xD7 " + toDisplayString(t.cropInfo.height), 5)) : createCommentVNode("", true),
      t.fixedBox ? createCommentVNode("", true) : (openBlock(), createElementBlock("span", D, [
        createElementVNode("span", {
          class: "crop-line line-w",
          onMousedown: e[4] || (e[4] = (h) => t.changeCropSize(h, false, true, 0, 1)),
          onTouchstart: e[5] || (e[5] = (h) => t.changeCropSize(h, false, true, 0, 1))
        }, null, 32),
        createElementVNode("span", {
          class: "crop-line line-a",
          onMousedown: e[6] || (e[6] = (h) => t.changeCropSize(h, true, false, 1, 0)),
          onTouchstart: e[7] || (e[7] = (h) => t.changeCropSize(h, true, false, 1, 0))
        }, null, 32),
        createElementVNode("span", {
          class: "crop-line line-s",
          onMousedown: e[8] || (e[8] = (h) => t.changeCropSize(h, false, true, 0, 2)),
          onTouchstart: e[9] || (e[9] = (h) => t.changeCropSize(h, false, true, 0, 2))
        }, null, 32),
        createElementVNode("span", {
          class: "crop-line line-d",
          onMousedown: e[10] || (e[10] = (h) => t.changeCropSize(h, true, false, 2, 0)),
          onTouchstart: e[11] || (e[11] = (h) => t.changeCropSize(h, true, false, 2, 0))
        }, null, 32),
        createElementVNode("span", {
          class: "crop-point point1",
          onMousedown: e[12] || (e[12] = (h) => t.changeCropSize(h, true, true, 1, 1)),
          onTouchstart: e[13] || (e[13] = (h) => t.changeCropSize(h, true, true, 1, 1))
        }, null, 32),
        createElementVNode("span", {
          class: "crop-point point2",
          onMousedown: e[14] || (e[14] = (h) => t.changeCropSize(h, false, true, 0, 1)),
          onTouchstart: e[15] || (e[15] = (h) => t.changeCropSize(h, false, true, 0, 1))
        }, null, 32),
        createElementVNode("span", {
          class: "crop-point point3",
          onMousedown: e[16] || (e[16] = (h) => t.changeCropSize(h, true, true, 2, 1)),
          onTouchstart: e[17] || (e[17] = (h) => t.changeCropSize(h, true, true, 2, 1))
        }, null, 32),
        createElementVNode("span", {
          class: "crop-point point4",
          onMousedown: e[18] || (e[18] = (h) => t.changeCropSize(h, true, false, 1, 0)),
          onTouchstart: e[19] || (e[19] = (h) => t.changeCropSize(h, true, false, 1, 0))
        }, null, 32),
        createElementVNode("span", {
          class: "crop-point point5",
          onMousedown: e[20] || (e[20] = (h) => t.changeCropSize(h, true, false, 2, 0)),
          onTouchstart: e[21] || (e[21] = (h) => t.changeCropSize(h, true, false, 2, 0))
        }, null, 32),
        createElementVNode("span", {
          class: "crop-point point6",
          onMousedown: e[22] || (e[22] = (h) => t.changeCropSize(h, true, true, 1, 2)),
          onTouchstart: e[23] || (e[23] = (h) => t.changeCropSize(h, true, true, 1, 2))
        }, null, 32),
        createElementVNode("span", {
          class: "crop-point point7",
          onMousedown: e[24] || (e[24] = (h) => t.changeCropSize(h, false, true, 0, 2)),
          onTouchstart: e[25] || (e[25] = (h) => t.changeCropSize(h, false, true, 0, 2))
        }, null, 32),
        createElementVNode("span", {
          class: "crop-point point8",
          onMousedown: e[26] || (e[26] = (h) => t.changeCropSize(h, true, true, 2, 2)),
          onTouchstart: e[27] || (e[27] = (h) => t.changeCropSize(h, true, true, 2, 2))
        }, null, 32)
      ]))
    ], 4), [
      [vShow, t.cropping]
    ])
  ], 544);
}
const Y = /* @__PURE__ */ N($, [["render", U], ["__scopeId", "data-v-9be9b9b9"]]);
var index$a = "";
const version = "3.7.7";
const VERSION = version;
const _hasBuffer = typeof Buffer === "function";
const _TD = typeof TextDecoder === "function" ? new TextDecoder() : void 0;
const _TE = typeof TextEncoder === "function" ? new TextEncoder() : void 0;
const b64ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
const b64chs = Array.prototype.slice.call(b64ch);
const b64tab = ((a) => {
  let tab = {};
  a.forEach((c, i) => tab[c] = i);
  return tab;
})(b64chs);
const b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
const _fromCC = String.fromCharCode.bind(String);
const _U8Afrom = typeof Uint8Array.from === "function" ? Uint8Array.from.bind(Uint8Array) : (it) => new Uint8Array(Array.prototype.slice.call(it, 0));
const _mkUriSafe = (src) => src.replace(/=/g, "").replace(/[+\/]/g, (m0) => m0 == "+" ? "-" : "_");
const _tidyB64 = (s) => s.replace(/[^A-Za-z0-9\+\/]/g, "");
const btoaPolyfill = (bin) => {
  let u32, c0, c1, c2, asc = "";
  const pad = bin.length % 3;
  for (let i = 0; i < bin.length; ) {
    if ((c0 = bin.charCodeAt(i++)) > 255 || (c1 = bin.charCodeAt(i++)) > 255 || (c2 = bin.charCodeAt(i++)) > 255)
      throw new TypeError("invalid character found");
    u32 = c0 << 16 | c1 << 8 | c2;
    asc += b64chs[u32 >> 18 & 63] + b64chs[u32 >> 12 & 63] + b64chs[u32 >> 6 & 63] + b64chs[u32 & 63];
  }
  return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc;
};
const _btoa = typeof btoa === "function" ? (bin) => btoa(bin) : _hasBuffer ? (bin) => Buffer.from(bin, "binary").toString("base64") : btoaPolyfill;
const _fromUint8Array = _hasBuffer ? (u8a) => Buffer.from(u8a).toString("base64") : (u8a) => {
  const maxargs = 4096;
  let strs = [];
  for (let i = 0, l = u8a.length; i < l; i += maxargs) {
    strs.push(_fromCC.apply(null, u8a.subarray(i, i + maxargs)));
  }
  return _btoa(strs.join(""));
};
const fromUint8Array = (u8a, urlsafe = false) => urlsafe ? _mkUriSafe(_fromUint8Array(u8a)) : _fromUint8Array(u8a);
const cb_utob = (c) => {
  if (c.length < 2) {
    var cc = c.charCodeAt(0);
    return cc < 128 ? c : cc < 2048 ? _fromCC(192 | cc >>> 6) + _fromCC(128 | cc & 63) : _fromCC(224 | cc >>> 12 & 15) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
  } else {
    var cc = 65536 + (c.charCodeAt(0) - 55296) * 1024 + (c.charCodeAt(1) - 56320);
    return _fromCC(240 | cc >>> 18 & 7) + _fromCC(128 | cc >>> 12 & 63) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
  }
};
const re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
const utob = (u) => u.replace(re_utob, cb_utob);
const _encode = _hasBuffer ? (s) => Buffer.from(s, "utf8").toString("base64") : _TE ? (s) => _fromUint8Array(_TE.encode(s)) : (s) => _btoa(utob(s));
const encode = (src, urlsafe = false) => urlsafe ? _mkUriSafe(_encode(src)) : _encode(src);
const encodeURI = (src) => encode(src, true);
const re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
const cb_btou = (cccc) => {
  switch (cccc.length) {
    case 4:
      var cp = (7 & cccc.charCodeAt(0)) << 18 | (63 & cccc.charCodeAt(1)) << 12 | (63 & cccc.charCodeAt(2)) << 6 | 63 & cccc.charCodeAt(3), offset = cp - 65536;
      return _fromCC((offset >>> 10) + 55296) + _fromCC((offset & 1023) + 56320);
    case 3:
      return _fromCC((15 & cccc.charCodeAt(0)) << 12 | (63 & cccc.charCodeAt(1)) << 6 | 63 & cccc.charCodeAt(2));
    default:
      return _fromCC((31 & cccc.charCodeAt(0)) << 6 | 63 & cccc.charCodeAt(1));
  }
};
const btou = (b) => b.replace(re_btou, cb_btou);
const atobPolyfill = (asc) => {
  asc = asc.replace(/\s+/g, "");
  if (!b64re.test(asc))
    throw new TypeError("malformed base64.");
  asc += "==".slice(2 - (asc.length & 3));
  let u24, bin = "", r1, r2;
  for (let i = 0; i < asc.length; ) {
    u24 = b64tab[asc.charAt(i++)] << 18 | b64tab[asc.charAt(i++)] << 12 | (r1 = b64tab[asc.charAt(i++)]) << 6 | (r2 = b64tab[asc.charAt(i++)]);
    bin += r1 === 64 ? _fromCC(u24 >> 16 & 255) : r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255) : _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255);
  }
  return bin;
};
const _atob = typeof atob === "function" ? (asc) => atob(_tidyB64(asc)) : _hasBuffer ? (asc) => Buffer.from(asc, "base64").toString("binary") : atobPolyfill;
const _toUint8Array = _hasBuffer ? (a) => _U8Afrom(Buffer.from(a, "base64")) : (a) => _U8Afrom(_atob(a).split("").map((c) => c.charCodeAt(0)));
const toUint8Array = (a) => _toUint8Array(_unURI(a));
const _decode = _hasBuffer ? (a) => Buffer.from(a, "base64").toString("utf8") : _TD ? (a) => _TD.decode(_toUint8Array(a)) : (a) => btou(_atob(a));
const _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == "-" ? "+" : "/"));
const decode = (src) => _decode(_unURI(src));
const isValid = (src) => {
  if (typeof src !== "string")
    return false;
  const s = src.replace(/\s+/g, "").replace(/={0,2}$/, "");
  return !/[^\s0-9a-zA-Z\+/]/.test(s) || !/[^\s0-9a-zA-Z\-_]/.test(s);
};
const _noEnum = (v) => {
  return {
    value: v,
    enumerable: false,
    writable: true,
    configurable: true
  };
};
const extendString = function() {
  const _add = (name, body) => Object.defineProperty(String.prototype, name, _noEnum(body));
  _add("fromBase64", function() {
    return decode(this);
  });
  _add("toBase64", function(urlsafe) {
    return encode(this, urlsafe);
  });
  _add("toBase64URI", function() {
    return encode(this, true);
  });
  _add("toBase64URL", function() {
    return encode(this, true);
  });
  _add("toUint8Array", function() {
    return toUint8Array(this);
  });
};
const extendUint8Array = function() {
  const _add = (name, body) => Object.defineProperty(Uint8Array.prototype, name, _noEnum(body));
  _add("toBase64", function(urlsafe) {
    return fromUint8Array(this, urlsafe);
  });
  _add("toBase64URI", function() {
    return fromUint8Array(this, true);
  });
  _add("toBase64URL", function() {
    return fromUint8Array(this, true);
  });
};
const extendBuiltins = () => {
  extendString();
  extendUint8Array();
};
const gBase64 = {
  version,
  VERSION,
  atob: _atob,
  atobPolyfill,
  btoa: _btoa,
  btoaPolyfill,
  fromBase64: decode,
  toBase64: encode,
  encode,
  encodeURI,
  encodeURL: encodeURI,
  utob,
  btou,
  decode,
  isValid,
  fromUint8Array,
  toUint8Array,
  extendString,
  extendUint8Array,
  extendBuiltins
};
const judgeFileType = (fileUrl) => {
  const reg = /^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@//?%\s]*?)\s*$/i;
  if (reg.test(fileUrl)) {
    return "base64";
  }
  let suffix = "";
  try {
    const flieArr = fileUrl.split(".");
    suffix = flieArr[flieArr.length - 1];
  } catch (err) {
    suffix = "";
  }
  if (!suffix)
    return "";
  suffix = suffix.toLocaleLowerCase();
  const txtlist = ["txt"];
  const pdflist = ["pdf"];
  const pptlist = ["ppt", "pptx"];
  const excelist = ["xls", "xlsx"];
  const wordlist = ["doc", "docx"];
  const videolist = ["mp4", "avi", "mov"];
  const radiolist = ["mp3", "wav", "wmv"];
  const imglist = ["png", "jpg", "jpeg", "bmp", "gif"];
  if (txtlist.includes(suffix)) {
    return "txt";
  } else if (pdflist.includes(suffix)) {
    return "pdf";
  } else if (pptlist.includes(suffix)) {
    return "ppt";
  } else if (excelist.includes(suffix)) {
    return "excel";
  } else if (wordlist.includes(suffix)) {
    return "word";
  } else if (videolist.includes(suffix)) {
    return "video";
  } else if (radiolist.includes(suffix)) {
    return "radio";
  } else if (imglist.includes(suffix)) {
    return "image";
  } else {
    return "";
  }
};
const isEmpty = (value) => {
  if (value === null || value === "" || value === void 0 || value === "null" || value === "0") {
    return true;
  } else if (typeof value === "string") {
    value = value.replace(/\s/g, "");
    if (value === "") {
      return true;
    }
    return false;
  }
  return false;
};
const sizeTostr = (bytes) => {
  if (isEmpty(bytes))
    return "0 B";
  const k2 = 1024, sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], i = Math.floor(Math.log(bytes) / Math.log(k2));
  return (bytes / Math.pow(k2, i)).toPrecision(3) + " " + sizes[i];
};
const loadImage = (url) => {
  return new Promise((resolve, reject) => {
    const newImg = new Image();
    newImg.src = url;
    newImg.onerror = () => {
      reject("failure");
    };
    newImg.onload = (e) => {
      resolve(e.target);
    };
  });
};
const isTencentCosPic = (url) => {
  return url.includes("wlmvp-cos.weiling.cn");
};
const isBase64 = (str) => {
  return str.indexOf("data:") != -1 && str.indexOf("base64") != -1;
};
const base64ToFile = (base64Url, filename) => {
  function dataURLtoBlob(toDataURL) {
    const arr = toDataURL.split(","), mime = arr[0].match(/:(.*?);/)[1], bstr = gBase64.atob(arr[1]);
    let n = bstr.length;
    const u8arr = new Uint8Array(n);
    while (n--) {
      u8arr[n] = bstr.charCodeAt(n);
    }
    return new Blob([u8arr], { type: mime });
  }
  function blobToFile(Blob2) {
    Blob2.lastModifiedDate = new Date();
    Blob2.name = filename;
    return Blob2;
  }
  const bold = dataURLtoBlob(base64Url);
  return blobToFile(bold);
};
const removeEmptyField = (obj) => {
  let newObj = {};
  if (typeof obj === "string") {
    obj = JSON.parse(obj);
  }
  if (obj instanceof Array) {
    newObj = [];
  }
  if (obj instanceof Object) {
    for (let attr in obj) {
      if (obj[attr] !== "" && obj[attr] !== null && obj[attr] !== void 0) {
        if (obj[attr] instanceof Object) {
          if (JSON.stringify(obj[attr]) === "{}" || JSON.stringify(obj[attr]) === "[]") {
            continue;
          }
          newObj[attr] = removeEmptyField(obj[attr]);
        } else if (typeof obj[attr] === "string" && (obj[attr].indexOf("{") > -1 && obj[attr].indexOf("}") > -1 || obj[attr].indexOf("[") > -1 && obj[attr].indexOf("]") > -1)) {
          try {
            let attrObj = JSON.parse(obj[attr]);
            if (attrObj instanceof Object) {
              newObj[attr] = removeEmptyField(attrObj);
            }
          } catch (e) {
            newObj[attr] = obj[attr];
          }
        } else {
          newObj[attr] = obj[attr];
        }
      }
    }
  }
  return newObj;
};
var base = "";
var index$9 = "";
var index$8 = "";
var index$7 = "";
var index$6 = "";
var index$5 = "";
var index$4 = "";
var ImgCropper_vue_vue_type_style_index_0_scoped_true_lang = "";
var _export_sfc = (sfc, props) => {
  const target = sfc.__vccOpts || sfc;
  for (const [key, val] of props) {
    target[key] = val;
  }
  return target;
};
const _hoisted_1$4 = { class: "footer" };
const _hoisted_2$3 = ["onClick"];
const _hoisted_3$2 = ["onClick"];
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
  __name: "ImgCropper",
  props: {
    value: { type: [Boolean, Object], default: false },
    file: { default: () => {
    } },
    cropperOption: { default: () => {
    } }
  },
  emits: ["onCroppered", "update:value"],
  setup(__props, { emit }) {
    const props = __props;
    const contentRef = ref(null);
    const cropper = ref(null);
    const loadStatue = ref("");
    const show = ref(false);
    const option = ref({
      img: "",
      info: false,
      outputSize: 0.8,
      outputType: "png",
      canScale: true,
      autoCrop: true,
      fixedBox: false,
      fixed: true,
      fixedNumber: [1, 1],
      full: false,
      canMoveBox: true,
      original: false,
      centerBox: true,
      mode: "",
      infoTrue: true,
      ...props.cropperOption
    });
    const loadingToast = () => {
      return showLoadingToast({
        duration: 0,
        forbidClick: true,
        message: "\u52A0\u8F7D\u4E2D..."
      });
    };
    const init = (file) => {
      let img = new Image();
      img.src = file.content;
      img.onload = () => {
        const { width, height } = img;
        option.value.img = file.content;
        if (width > height) {
          option.value.mode = "auto 255px";
        } else {
          option.value.mode = "contain";
        }
      };
    };
    const submit = () => {
      cropper.value.getCropData(async (res) => {
        const file = base64ToFile(res, props.file.file.name);
        emit("onCroppered", { file, content: res });
      });
    };
    const onImgLoad = (res) => {
      loadStatue.value = res;
      loadingToast().close();
    };
    const onClose = () => {
      option.value.img = "";
      loadStatue.value = "";
      option.value.mode = "";
      show.value = false;
      emit("onCroppered", { content: "" });
    };
    watch(
      () => props.value,
      (val) => {
        show.value = val;
      }
    );
    watch(
      () => show.value,
      (val) => {
        emit("update:value", val);
      }
    );
    watch(
      () => props.file,
      (val) => {
        if (val && props.value)
          init(val);
      }
    );
    return (_ctx, _cache) => {
      return withDirectives((openBlock(), createElementBlock("div", {
        class: "cropper-content",
        "data-weiling-mobile-ui-wl-cropper": "",
        teleport: "html",
        ref_key: "contentRef",
        ref: contentRef
      }, [
        withDirectives(createVNode(unref(Y), {
          class: "vue-cropper",
          ref_key: "cropper",
          ref: cropper,
          img: option.value.img,
          outputSize: option.value.outputSize,
          outputType: option.value.outputType,
          info: option.value.info,
          full: option.value.full,
          "can-move": option.value.canMove,
          "can-move-box": option.value.canMoveBox,
          original: option.value.original,
          "auto-crop": option.value.autoCrop,
          fixed: option.value.fixed,
          fixedNumber: option.value.fixedNumber,
          "center-box": option.value.centerBox,
          infoTrue: option.value.infoTrue,
          "fixed-box": option.value.fixedBox,
          mode: option.value.mode,
          "auto-crop-width": option.value.autoCropWidth,
          "auto-crop-height": option.value.autoCropHeight,
          onImgLoad
        }, null, 8, ["img", "outputSize", "outputType", "info", "full", "can-move", "can-move-box", "original", "auto-crop", "fixed", "fixedNumber", "center-box", "infoTrue", "fixed-box", "mode", "auto-crop-width", "auto-crop-height"]), [
          [vShow, loadStatue.value == "success"]
        ]),
        createElementVNode("div", _hoisted_1$4, [
          createElementVNode("span", {
            class: "cancel-btn",
            onClick: withModifiers(onClose, ["stop"])
          }, "\u53D6\u6D88", 8, _hoisted_2$3),
          createElementVNode("span", {
            class: "sub-btn",
            onClick: withModifiers(submit, ["stop"])
          }, "\u786E\u5B9A", 8, _hoisted_3$2)
        ])
      ], 512)), [
        [vShow, show.value]
      ]);
    };
  }
});
var ImgCropper = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-54824849"]]);
var employeeSelector = {
  employeeData: null,
  topFiveEmployeeData: null,
  organization: null,
  organization_count: null,
  count: 0,
  dept_list: [],
  company_list: [],
  company_list_count: 0,
  companyEmployeeList: [],
  totalCompanyEmployeeList: [],
  totalCompanyEmployeeObjList: []
};
let Store = {
  sid: "",
  app_id: "",
  user_id: "",
  user_name: "",
  corp_id: "",
  node_env: "",
  domain: "",
  token: "",
  card_resource: "",
  employeeSelector
};
var Store$1 = new Proxy(Store, {
  get(target, name, property) {
    return Reflect.get(target, name, property);
  },
  set(target, name, value, property) {
    return Reflect.set(target, name, value, property);
  }
});
const __default__$4 = {
  name: "WlSvgIcon"
};
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
  ...__default__$4,
  props: {
    type: { default: "" },
    color: { default: "var(--wl-text-color-title-1)" },
    width: { default: "16" },
    height: { default: "16" }
  },
  setup(__props) {
    const sub = location.origin;
    return (_ctx, _cache) => {
      return openBlock(), createBlock(unref(WlSvg), {
        type: __props.type,
        width: __props.width,
        height: __props.height,
        color: __props.color,
        sub: unref(sub)
      }, null, 8, ["type", "width", "height", "color", "sub"]);
    };
  }
});
var index_vue_vue_type_style_index_0_lang$2 = "";
const _hoisted_1$3 = { class: "icon" };
const _hoisted_2$2 = { class: "text" };
const __default__$3 = {
  name: "WlNotice"
};
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
  ...__default__$3,
  props: {
    show_toast: { type: Boolean, default: true },
    message: { default: "" },
    type: { default: "success" },
    duration: { default: 1500 }
  },
  setup(__props) {
    return (_ctx, _cache) => {
      return __props.show_toast ? (openBlock(), createElementBlock("div", {
        key: 0,
        class: normalizeClass(`notice ${__props.type}`),
        "data-weiling-mobile-ui-wl-notice": ""
      }, [
        createElementVNode("div", _hoisted_1$3, [
          __props.type === "success" ? (openBlock(), createBlock(_sfc_main$4, {
            key: 0,
            type: "successFill",
            width: "24",
            height: "24",
            color: "#45ce03"
          })) : __props.type === "warning" ? (openBlock(), createBlock(_sfc_main$4, {
            key: 1,
            type: "warningFill",
            width: "24",
            height: "24",
            color: "#f3a401"
          })) : __props.type === "alert" ? (openBlock(), createBlock(_sfc_main$4, {
            key: 2,
            type: "tipsFill",
            width: "24",
            height: "24",
            color: "#1b9fff"
          })) : __props.type === "error" ? (openBlock(), createBlock(_sfc_main$4, {
            key: 3,
            type: "closeFill",
            width: "24",
            height: "24",
            color: "#ff2a2d"
          })) : createCommentVNode("", true)
        ]),
        createElementVNode("p", _hoisted_2$2, toDisplayString(__props.message), 1)
      ], 2)) : createCommentVNode("", true);
    };
  }
});
let mountNode$1 = null;
var WlNotice = (options) => {
  const duration = options.duration | 2e3;
  if (mountNode$1) {
    document.body.removeChild(mountNode$1);
    mountNode$1 = null;
  }
  const app = createVNode(_sfc_main$3, {
    ...options,
    duration,
    show_toast: true
  });
  let timer = setTimeout(() => {
    if (mountNode$1) {
      document.body.removeChild(mountNode$1);
      mountNode$1 = null;
    }
    clearTimeout(timer);
  }, duration);
  mountNode$1 = document.createElement("div");
  render(app, mountNode$1);
  document.body.appendChild(mountNode$1);
};
var index$3 = "";
var index$2 = "";
var index$1 = "";
var index = "";
const useMessage = () => {
  const duration = 3e3;
  const onNotify = (message) => {
    WlNotice({ message, type: "success", duration });
  };
  const onError = (message) => {
    WlNotice({ message, type: "error", duration });
  };
  const onWarning = (message) => {
    WlNotice({ message, type: "warning", duration });
  };
  const onConfirm = (params) => {
    return new Promise((resolve, reject) => {
      const filter_params = {
        className: "vant-confirm-z-index",
        overlayClass: "vant-overlay-z-index",
        ...params
      };
      showConfirmDialog(filter_params).then(resolve, reject);
    });
  };
  const onConfirmCancel = () => {
    closeDialog();
  };
  return {
    onNotify,
    onError,
    onConfirm,
    onWarning,
    onConfirmCancel
  };
};
const proxy_api = {
  dev_uat: "/uat_api",
  dev_stg: "/stg_api",
  dev_prd: "/prd_api",
  dev_cos_api: "/cos_api",
  dev_uat_xsf: "/xsf_api",
  dev: "/uat_api",
  uat: "",
  stg: "",
  prd: "",
  gray: "",
  production: "",
  uat_xsf: "https://test.xsfapi.weiling.cn",
  stg_xsf: "https://pre-xsfapi.weiling.cn",
  prd_xsf: "https://xsfapi.weiling.cn",
  gray_xsf: "https://xsfapi.weiling.cn"
};
const token_key = {
  dev_uat: "auth-token-mp-test",
  dev_stg: "auth-token-mp",
  dev_prd: "auth-token-mp",
  dev_uat_xsf: "auth-token-se-test",
  dev_stg_xsf: "auth-token-se",
  dev_gray_xsf: "auth-token-se",
  dev_prd_xsf: "auth-token-se",
  uat: "auth-token-mp-test",
  stg: "auth-token-mp",
  prd: "auth-token-mp",
  gray: "auth-token-mp",
  uat_xsf: "auth-token-se-test",
  stg_xsf: "auth-token-se",
  prd_xsf: "auth-token-se",
  gray_xsf: "auth-token-se"
};
function obj2String(obj, arr = [], idx = 0) {
  for (let item in obj) {
    arr[idx++] = [item, obj[item]];
  }
  return new URLSearchParams(arr).toString();
}
function getOptions(options) {
  const { sid = "", corp_id = "", card_resource = "" } = Store$1 != null ? Store$1 : {};
  const params = {
    sid,
    corp_id,
    card_resource,
    ...options
  };
  return obj2String(params);
}
const onHandleUrl = (url) => {
  const { node_env } = Store$1;
  const isPersonMiniApp = node_env.includes("xsf");
  if (isPersonMiniApp) {
    return setPersonMiniAppUrl(url);
  }
  return url;
};
const setPersonMiniAppUrl = (url) => {
  let filterUrl = url;
  if (filterUrl.includes("/api/user/share/path")) {
    filterUrl = filterUrl.replace("/api/user/share/path", "/apise/material/share/path");
  } else if (filterUrl.includes("/interact/")) {
    filterUrl = filterUrl.replace("/interact/", "/apise/");
  } else if (filterUrl.includes("/api/")) {
    filterUrl = filterUrl.replace("/api/", "/apise/");
  } else if (filterUrl.includes("/wx/track")) {
    filterUrl = filterUrl.replace("/wx/track", "/apise/track/wx/track");
  }
  return filterUrl;
};
function request(url, options, method = "GET") {
  const staticOption = {
    sid: Store$1.sid,
    corp_id: Store$1.corp_id,
    tab_change: 0
  };
  const data = {
    ...staticOption,
    ...options
  };
  const searchStr = getOptions(removeEmptyField(data));
  const staticSearchStr = getOptions(removeEmptyField(staticOption));
  let initObj = {};
  let params = "";
  if (method === "GET") {
    initObj = {
      method,
      credentials: "include",
      headers: new Headers({
        [token_key[Store$1.node_env]]: Store$1.token
      })
    };
    params = searchStr;
  } else if (method === "FormPOST") {
    initObj = {
      method: "POST",
      credentials: "include",
      headers: new Headers({
        [token_key[Store$1.node_env]]: Store$1.token
      }),
      body: options
    };
    params = staticSearchStr;
  } else {
    initObj = {
      method,
      credentials: "include",
      headers: new Headers({
        Accept: "application/json, text/plain, */*",
        "Content-Type": "application/json",
        [token_key[Store$1.node_env]]: Store$1.token
      }),
      body: JSON.stringify(data)
    };
    params = staticSearchStr;
  }
  const filterUrl = onHandleUrl(url) + "?" + params;
  return fetch(filterUrl, initObj).then((res) => {
    const isArea = url.includes("region.json");
    return res.json().then((result) => {
      var _a;
      if (result.code === 200 || isArea) {
        return result;
      } else {
        WlNotice({ message: (_a = result.msg) != null ? _a : "\u670D\u52A1\u5668\u5185\u90E8\u9519\u8BEF", type: "error", duration: 3e3 });
        throw Error(result);
      }
    });
  }).then((res) => {
    return res;
  });
}
const GET = (url, options) => {
  return request(url, options, "GET");
};
const POST = (url, options) => {
  return request(url, options, "POST");
};
const domain = "https://wlmvp-cos.weiling.cn";
const loadingPic = domain + "/frontend/weilingMobileUI/loading.png";
const loadingFailPic = domain + "/frontend/weilingMobileUI/loadingFail.png";
const _hoisted_1$2 = ["src", "alt"];
const _hoisted_2$1 = ["src"];
const _hoisted_3$1 = ["src"];
var ECosType = /* @__PURE__ */ ((ECosType2) => {
  ECosType2["normal"] = "imageView2/1/q/85";
  ECosType2["thumbnail"] = "imageView2/1/w/100/h/100/q/85";
  return ECosType2;
})(ECosType || {});
const __default__$2 = {
  name: "WlPic"
};
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
  ...__default__$2,
  props: {
    src: { default: "" },
    needCos: { type: Boolean, default: true },
    cosType: { default: "normal" },
    radius: { type: Boolean, default: false },
    round: { type: Boolean, default: false },
    needLoading: { type: Boolean, default: true },
    needMiddleCenter: { type: Boolean, default: true },
    needHeightAuto: { type: Boolean, default: false },
    fit: { default: "fill" }
  },
  setup(__props, { expose }) {
    const props = __props;
    const isLoading = ref(true);
    const isError = ref(false);
    const imgSrc = ref("");
    const imgWrapRef = ref("");
    const imgStyleComputed = computed(() => {
      return {
        "border-radius": props.round ? "50%" : "",
        "object-fit": props.fit
      };
    });
    const imgWrapClassComputed = computed(() => {
      return [
        "wl-img",
        "wh-full",
        "relative",
        "flex-col",
        props.needMiddleCenter ? "flex-middle-center" : ""
      ];
    });
    const onLoadImage = (url) => {
      return new Promise((resolve, reject) => {
        loadImage(url).then((elem) => {
          resolve(elem);
        }).catch((reason) => {
          reject(reason);
        }).finally(() => {
          isLoading.value = false;
        });
      });
    };
    const setImgSrc = (url) => {
      const needCos = isTencentCosPic(url) && props.needCos;
      const file_type = url.split(".").pop();
      let isSvg = file_type === "svg";
      let isBase64Bool = isBase64(url);
      if (isSvg || !needCos || isBase64Bool) {
        imgSrc.value = url;
        onLoadImage(imgSrc.value).catch(() => {
          isError.value = true;
        });
      } else {
        imgSrc.value = `${url}?${ECosType[props.cosType]}`;
        onLoadImage(imgSrc.value).catch(() => {
          imgSrc.value = url;
        });
      }
    };
    watch(
      () => props.src,
      (val) => {
        if (val) {
          isLoading.value = true;
          setImgSrc(props.src);
        }
      },
      { immediate: true }
    );
    expose({
      imgWrapRef
    });
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock("div", {
        class: normalizeClass(unref(imgWrapClassComputed)),
        ref_key: "imgWrapRef",
        ref: imgWrapRef
      }, [
        !isLoading.value && !isError.value ? (openBlock(), createElementBlock("img", {
          key: 0,
          src: imgSrc.value,
          style: normalizeStyle(unref(imgStyleComputed)),
          class: normalizeClass(`w-full block ${__props.needHeightAuto ? "h-auto" : "h-full"}`),
          alt: imgSrc.value
        }, null, 14, _hoisted_1$2)) : createCommentVNode("", true),
        isLoading.value && __props.needLoading ? (openBlock(), createElementBlock("img", {
          key: 1,
          src: unref(loadingPic),
          alt: "loading",
          class: "w-1/5 uno-min-w-20 uno-min-h-20 uno-max-w-60 uno-max-h-60 absolute-middle-center animate-spin"
        }, null, 8, _hoisted_2$1)) : createCommentVNode("", true),
        isError.value ? (openBlock(), createElementBlock("img", {
          key: 2,
          src: unref(loadingFailPic),
          alt: "failure",
          class: "w-1/5 uno-min-w-20 uno-min-h-20 uno-max-w-60 uno-max-h-60 absolute-middle-center"
        }, null, 8, _hoisted_3$1)) : createCommentVNode("", true),
        renderSlot(_ctx.$slots, "picFooter")
      ], 2);
    };
  }
});
var index_vue_vue_type_style_index_0_lang$1 = "";
const _hoisted_1$1 = {
  key: 0,
  class: "loading-model",
  "data-weiling-mobile-ui-wl-loading": ""
};
const _hoisted_2 = {
  key: 0,
  class: "percent"
};
const _hoisted_3 = {
  key: 1,
  class: "box"
};
const _hoisted_4 = {
  key: 0,
  class: "text"
};
const __default__$1 = {
  name: "WlLoading"
};
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
  ...__default__$1,
  props: {
    needPercent: { type: Boolean, default: false },
    showLoading: { type: Boolean, default: true },
    currentRate: { default: 0 },
    content: { default: "\u6B63\u5728\u52A0\u8F7D\u4E2D..." },
    percent: { default: 1 },
    backgroundColor: { default: "white" },
    loadingModelBackgroundColor: { default: "rgba(0, 0, 0, 0.45)" }
  },
  setup(__props) {
    const props = __props;
    useCssVars((_ctx) => ({
      "1045e3da": __props.loadingModelBackgroundColor,
      "3aaae1a0": __props.backgroundColor
    }));
    const showLoadingValue = ref(false);
    const currentRateValue = ref(0);
    const percentValue = ref(0);
    const loadingPhoto = loadingPic;
    const onCancelUpload = () => {
      showLoadingValue.value = false;
    };
    const text = computed(() => {
      return props.currentRate.toFixed(0) + "%";
    });
    watchEffect(() => {
      showLoadingValue.value = props.showLoading;
    });
    watchEffect(() => {
      currentRateValue.value = props.currentRate;
    });
    watchEffect(() => {
      percentValue.value = props.percent;
    });
    return (_ctx, _cache) => {
      return showLoadingValue.value ? (openBlock(), createElementBlock("div", _hoisted_1$1, [
        __props.needPercent ? (openBlock(), createElementBlock("div", _hoisted_2, [
          createVNode(unref(Circle), {
            "current-rate": currentRateValue.value,
            "onUpdate:current-rate": _cache[0] || (_cache[0] = ($event) => currentRateValue.value = $event),
            size: "80px",
            rate: percentValue.value,
            text: unref(text),
            color: "var(--wl-primary-color)",
            "layer-color": "#eee",
            "stroke-width": 60
          }, null, 8, ["current-rate", "rate", "text"]),
          createElementVNode("div", {
            class: "cancel-upload",
            onClick: onCancelUpload
          }, "\u53D6\u6D88\u4E0A\u4F20")
        ])) : (openBlock(), createElementBlock("div", _hoisted_3, [
          createVNode(_sfc_main$2, {
            class: "icon",
            src: unref(loadingPhoto)
          }, null, 8, ["src"]),
          __props.content ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(__props.content), 1)) : createCommentVNode("", true)
        ]))
      ])) : createCommentVNode("", true);
    };
  }
});
let mountNode = null;
var WlLoading = (options) => {
  const {
    type,
    needPercent,
    tips,
    percent,
    currentRate,
    backgroundColor = "white",
    loadingModelBackgroundColor = "rgba(0, 0, 0, 0.45)"
  } = options;
  const app = createVNode(_sfc_main$1, {
    percent,
    needPercent,
    currentRate,
    content: tips,
    backgroundColor,
    loadingModelBackgroundColor
  });
  if (type === "hide") {
    if (mountNode) {
      if (options.parentNode) {
        options.parentNode.removeChild(mountNode);
      } else {
        document.body.removeChild(mountNode);
      }
      mountNode = null;
    }
  } else if (type === "show") {
    app.props.showLoading = true;
    mountNode = document.createElement("div");
    render(app, mountNode);
    if (options.parentNode) {
      options.parentNode.appendChild(mountNode);
    } else {
      document.body.appendChild(mountNode);
    }
  } else if (type === "changePercent") {
    app.props.currentRate = percent;
    app.props.needPercent = true;
    render(app, mountNode);
  }
};
const getCosToken = (params) => {
  return GET(`${proxy_api[Store$1.node_env]}/api/cos/get_sts_token`, params);
};
const getVideoThumbnailLogo = (params) => {
  return POST(`${proxy_api[Store$1.node_env]}/api/cos/get_video_screen`, params);
};
const onCosUpload = () => {
  let cos = null;
  let uploadParams = {
    Bucket: "",
    Region: "",
    Key: "",
    StorageClass: "STANDARD",
    Body: null
  };
  const getRandomSecret = (num) => {
    let t = "ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678", a = t.length, n = "";
    for (let i = 0; i < num; i++)
      n += t.charAt(Math.floor(Math.random() * a));
    return n;
  };
  const getTimeStamp = (date) => {
    return Math.floor(new Date(date).getTime() / 1e3);
  };
  const getSDKToken = (file) => {
    return new Promise((resolve, reject) => {
      getCosToken({}).then(
        (res) => {
          var _a, _b, _c;
          const {
            access_secret_id,
            access_secret_key,
            expiration,
            security_token,
            config
          } = (_a = res.data) != null ? _a : {};
          const { bucket, region, tenant_id } = config;
          const fileType = (_c = (_b = file.name) == null ? void 0 : _b.split(".")) == null ? void 0 : _c.pop();
          const ExpiredTime = getTimeStamp(expiration);
          const StartTime = getTimeStamp(new Date());
          const random = getRandomSecret(7);
          uploadParams.Bucket = bucket;
          uploadParams.Region = region;
          uploadParams.Key = `${tenant_id}/${StartTime}${random}.${fileType}`;
          const cosInitParams = {
            TmpSecretId: access_secret_id,
            TmpSecretKey: access_secret_key,
            SecurityToken: security_token,
            StartTime,
            ExpiredTime
          };
          resolve(cosInitParams);
        },
        () => {
          reject({});
        }
      ).catch((err) => {
        reject(err);
      });
    });
  };
  const configSDK = (params) => {
    return new Promise((resolve) => {
      import("cos-js-sdk-v5").then((res) => {
        cos = new res.default({
          getAuthorization: (options, callback) => callback(params),
          FileParallelLimit: 10,
          ChunkParallelLimit: 10
        });
        resolve("success");
      });
    });
  };
  const onUpload = (file) => {
    return new Promise((resolve, reject) => {
      uploadParams.Body = file;
      cos.sliceUploadFile(
        {
          ...uploadParams,
          onTaskReady: function(taskId) {
            console.log("--------onTaskReady--------", WlLoading);
          },
          onHashProgress: function(progressData) {
            console.log("--------onHashProgress--------");
            console.log(JSON.stringify(progressData));
          },
          onProgress: function(progressData) {
            console.log("--------onProgress--------");
            WlLoading({
              type: "changePercent",
              percent: progressData.percent * 100
            });
          }
        },
        (err, data) => {
          err ? reject(err) : resolve(data);
        }
      );
    });
  };
  const getVideoScreen = (videoUrl) => {
    return `${videoUrl}?ci-process=snapshot&time=0&format=jpg`;
  };
  const getThumbnailLogo = (screen_url, screen_name) => {
    return new Promise((resolve) => {
      getVideoThumbnailLogo({
        screen_url,
        screen_name
      }).then((res) => {
        resolve(res);
      });
    });
  };
  const handleParams = (location2, file) => {
    const cos_file_name = file.name;
    const cos_file_size = file.size;
    const cos_file_type = file.type;
    const cos_url = `https://${location2 == null ? void 0 : location2.replace(
      "1304040775.cos.ap-shanghai.myqcloud.com",
      "cos.weiling.cn"
    )}`;
    return {
      cos_file_name,
      cos_file_size,
      cos_file_type,
      cos_url
    };
  };
  const onStartUpload = async (file) => {
    return new Promise((resolve, reject) => {
      getSDKToken(file).then(
        (sdkParams) => {
          configSDK(sdkParams).then(() => {
            onUpload(file).then(
              (data) => {
                const params = handleParams(data.Location, file);
                const { cos_url, cos_file_name } = params;
                if (judgeFileType(cos_url) === "video") {
                  const screen = getVideoScreen(cos_url);
                  getThumbnailLogo(screen, cos_file_name).then(
                    (res) => {
                      var _a;
                      const { screen: logo } = (_a = res.data) != null ? _a : {};
                      WlLoading({
                        type: "hide"
                      });
                      resolve({
                        ...params,
                        cos_video_file_screen: screen,
                        cos_video_thumbnail_logo: logo
                      });
                    }
                  );
                } else {
                  WlLoading({
                    type: "hide"
                  });
                  resolve(params);
                }
              },
              (error) => {
                reject(error);
              }
            );
          }, (error) => {
            reject(error);
          });
        },
        (error) => {
          reject(error);
        }
      );
    });
  };
  return {
    onStartUpload
  };
};
const useUpload = (config = {}) => {
  const { onNotify, onError } = useMessage();
  const { onStartUpload } = onCosUpload();
  ({
    image: config.imgMaxSize || 0.1,
    video: config.videoMaxSize || 200
  });
  const onFileBeforeRead = (file, accept) => {
    if (accept && !accept.includes(file.type)) {
      onError(`\u8BF7\u4E0A\u4F20${accept.replaceAll("image/", "")}\u683C\u5F0F\u56FE\u7247`);
      return false;
    }
    return true;
  };
  const onFileAfterRead = (data) => {
    return new Promise((resolve, reject) => {
      onStartUpload(data.file).then((res) => {
        resolve(res);
      }).catch((reason) => {
        reject();
      });
    });
  };
  return {
    onFileBeforeRead,
    onFileAfterRead
  };
};
var CloseSpIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAMuSURBVHgB5ZvPitNQFIdPja2MlSlSKCq40EVbdNMuBHHpbH2AeQAfYB6l++Kiq7rW9TxD2420XehCEBVFRxqFRqbe3yRXQ8y/6T33huR+cJgknZnkfNzkntMkNSJ6RuXCE/FTxC8RX4P4QXtylcpHXUQriFvBNsj4KOJtsJwbR0SXyg+k3BRxX8QB+SPid54/rIqAMBgZt4Pl71m/XEUBACOiI+JQxDdKGQ1XqNrgGvGE/NMilqoLAEg+UYINAoCU8N+sZ4sAAAmPohttEgDaIu6FN9gmAGDW+3sq2CgAU+RDuWKjAHCXglFgqwCAstlqARcXQ5sF4FpwaLMA0GYRMB6PH2+325e73e71bDZ7TppYLpcn2Mdms3mBfZI6rRoxfCOEA2o2mx25vlqtTvv9/ogYQfK9Xu9Irnue5zYajWNS44xlBISTBzhQHDAxEU0e1Ov1JqnTYBGwXq9Po9u4JMQlD+bz+StS54BFgDjAkQ4JScljX8PhcEwMsM0C3BLSkse+iAnWaZBLgqnkAXsdoCrBZPJASyG0rwTTyQNtleBlJRSRPNBaCueVUFTygKUSzEJUhifdbvcoZvuFnKKSB0YEgCQJcZhKHhjrBpNOhygmkwdG2+EsCaaTB8a/DxDt7F6f6cKogKSrvYS7i8yDMQFZyUtMSzAiIG2e19lK50G7gKwiR1crnRetAvJWeEVK0CbgsuVtURK0CNi3ti9CArsA1cbGtARWAVxdnUkJbAK4W1pTElgE4G6QjpbWhAS0w09FXCcFcLsquo2zsUlqpQeDwfFisXBJAYyAXI+UpoHbVOF17q4ubiS4rvtZNXkAAWekyGQyGeGAsKyrpcX/lHeDIHw6nbLcGMEpgCclHpClYAR8IYuBADxa7pGlOKGfbbIQWQe8I0uRI+Cc/GdpW2QZ4UrwDVl4LXBCy+dBdMginMg63rHBxVCpNC4TTsy2TyLukP8gYeWJE4DTAO/g4X2byktwErajQbJCgpPymZSA68ENqihOxueQ8IH86RESKjcasgRIMDtgNMj3ditDXgEAowEzxHvy2+hrVIERUSM18Gpqm/7VDiinSyXlD7cu3oBaRxDpAAAAAElFTkSuQmCC";
var index_vue_vue_type_style_index_0_lang = "";
const _hoisted_1 = ["src"];
const __default__ = {
  name: "WlUploader"
};
const _sfc_main = /* @__PURE__ */ defineComponent({
  ...__default__,
  props: {
    fileList: { default: () => [] },
    env_data: { default: () => {
      return {
        sid: "",
        domain: "",
        corp_id: "",
        node_env: "dev",
        app_id: "",
        token: "",
        card_resource: ""
      };
    } },
    maxSize: { default: 20 * 1024 * 1024 },
    accept: { default: "" },
    cropper: { type: Boolean, default: false },
    cropperOption: { default: () => {
    } },
    teleport: { default: "body" }
  },
  emits: ["onGetUploadImagesUrl"],
  setup(__props, { emit }) {
    const props = __props;
    const { onError } = useMessage();
    const { onFileAfterRead, onFileBeforeRead } = useUpload();
    Store$1.corp_id = props.env_data.corp_id;
    Store$1.sid = props.env_data.sid;
    Store$1.node_env = props.env_data.node_env;
    Store$1.token = props.env_data.token;
    Store$1.card_resource = props.env_data.card_resource;
    const slot = ref(useSlots());
    const files = ref([]);
    const currentFile = ref(null);
    const emitFileList = () => {
      var _a;
      const list = (_a = files.value) == null ? void 0 : _a.filter((res) => res.url);
      emit("onGetUploadImagesUrl", list);
    };
    const afterRead = (data) => {
      if (props.cropper) {
        currentFile.value = data;
        return;
      }
      data.status = "uploading";
      data.message = "\u4E0A\u4F20\u4E2D...";
      data.deletable = true;
      onFileAfterRead({
        file: data.file
      }).then((res) => {
        data.status = "done";
        data.url = res.cos_url;
        emitFileList();
      }).catch(() => {
        data.message = "\u4E0A\u4F20\u5931\u8D25";
        data.status = "failed";
      });
    };
    const onDelete = () => {
      emitFileList();
    };
    const onOversize = () => {
      if (props.maxSize)
        onError(`\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 ${sizeTostr(props.maxSize)}`);
    };
    const beforeRead = (file) => {
      return onFileBeforeRead(file, props.accept);
    };
    const onCroppered = ({ file, content }) => {
      var _a;
      const i = files.value.findIndex((res) => res == currentFile.value) || 0;
      if (!content) {
        (_a = files.value) == null ? void 0 : _a.splice(i, 1);
        return;
      }
      files.value[i].status = "uploading";
      files.value[i].message = "\u4E0A\u4F20\u4E2D...";
      files.value[i].deletable = true;
      currentFile.value = null;
      onFileAfterRead({
        file
      }).then((res) => {
        files.value[i].status = "done";
        files.value[i].url = res.cos_url;
        files.value[i].content = content;
        emitFileList();
      }).catch(() => {
        files.value[i].message = "\u4E0A\u4F20\u5931\u8D25";
        files.value[i].status = "failed";
      });
    };
    watch(
      () => props.fileList,
      (res) => files.value = res,
      { immediate: true }
    );
    return (_ctx, _cache) => {
      return openBlock(), createElementBlock(Fragment, null, [
        createVNode(unref(Uploader), mergeProps({
          modelValue: files.value,
          "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => files.value = $event),
          class: "wl-uploader",
          "data-weiling-mobile-ui-wl-uploader": "",
          "after-read": afterRead,
          "before-read": beforeRead,
          "max-size": __props.maxSize,
          onOversize,
          accept: __props.accept
        }, _ctx.$attrs, { onDelete }), createSlots({
          "preview-delete": withCtx(() => [
            createElementVNode("img", {
              class: "uploader_close",
              src: unref(CloseSpIcon),
              alt: ""
            }, null, 8, _hoisted_1)
          ]),
          _: 2
        }, [
          slot.value.default ? {
            name: "default",
            fn: withCtx(() => [
              renderSlot(_ctx.$slots, "default")
            ])
          } : void 0,
          slot.value["preview-cover"] ? {
            name: "preview-cover",
            fn: withCtx((file) => [
              renderSlot(_ctx.$slots, "preview-cover", { file })
            ])
          } : void 0
        ]), 1040, ["modelValue", "max-size", "accept"]),
        (openBlock(), createBlock(Teleport, { to: __props.teleport }, [
          createVNode(ImgCropper, {
            value: currentFile.value,
            "onUpdate:value": _cache[1] || (_cache[1] = ($event) => currentFile.value = $event),
            file: currentFile.value,
            cropperOption: __props.cropperOption,
            onOnCroppered: onCroppered
          }, null, 8, ["value", "file", "cropperOption"])
        ], 8, ["to"]))
      ], 64);
    };
  }
});
var __uno = "";
_sfc_main.install = (app) => {
  app.component(_sfc_main.name, _sfc_main);
};
export { _sfc_main as default };
