var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
import { u as utils, g as getUpdateFontsSubset, l as loader, i as inherit, B as BaseElement, b as Table } from "./install-editor.js";
import { u as uniq_1 } from "./uniq.js";
import { $ as tinycolor, a9 as cloneDeep, n as normalizeComponent, aB as throttle } from "./index.js";
import "vue";
import "./base-element.js";
import "./watermark.js";
import "./v4.js";
import "./defaults.js";
import "./index15.js";
import "./asyncToGenerator.js";
import "./pixel-helper.js";
import "./index16.js";
import "./video.js";
import "./get-lines.js";
import "./gif-apng.worker.js";
import "./vue-slider-component.umd.min.js";
var methods = {
  addTable() {
  }
};
function unit(value) {
  return typeof value === "number" ? `${value}px` : value;
}
function createStyle(conf, colorsList = [], prefix = "") {
  const colors = colorsList.map((c) => tinycolor(c).toRgbString());
  const style = {};
  const matchColorKey = /([c|C]olor|background)$/;
  const excludeKey = { weight: true };
  Object.keys(conf).forEach((key) => {
    const value = conf[key];
    if (prefix === "font-" && ["family", "size"].indexOf(key) !== -1) {
      return;
    }
    if (Array.isArray(value)) {
      style[key] = value.map((p) => `${p}px`).join(" ");
      return;
    }
    if (typeof value === "object") {
      Object.assign(style, createStyle(value, colors, `${prefix}${key}-`));
      return;
    }
    if (matchColorKey.test(key) && typeof value === "number") {
      style[`${prefix}${key}`] = colors[value] || value;
    } else {
      style[`${prefix}${key}`] = excludeKey[key] ? value : unit(value);
    }
  });
  return style;
}
const PRIORITY_MAP = {
  common: 0,
  repeat: 1,
  single: 2,
  cell: 3
};
const gridCheckers = {
  common() {
    return true;
  },
  repeat(conf, options) {
    const {
      match: {
        row,
        col
      }
    } = conf;
    let matched = true;
    if (row) {
      matched = (options.row + 1) % row.coefficient === row.remainder;
    }
    if (col) {
      matched = matched && (options.col + 1) % col.coefficient === col.remainder;
    }
    return matched;
  },
  single(conf, { row, col }) {
    const { match } = conf;
    return match.row === row || match.col === col;
  },
  cell(conf, { row, col }) {
    const { match } = conf;
    return match.row === row && match.col === col;
  }
};
function createGridStyle(confs, colors = [], options) {
  const uiList = [];
  confs.forEach((conf) => {
    const { type, match = {} } = conf;
    let priority = PRIORITY_MAP[type];
    if (match.row != null) {
      priority += 1;
    }
    const checker = gridCheckers[type];
    if (checker && checker(conf, options)) {
      uiList.push(__spreadProps(__spreadValues({}, conf), { priority }));
    }
  });
  const gridStyle = {};
  uiList.sort((a, b) => a.priority - b.priority).forEach((conf) => {
    Object.assign(gridStyle, createStyle(conf.ui, colors));
  });
  return gridStyle;
}
const lineCheckers = {
  single(conf, options) {
    const { match } = conf;
    if (match.row != null) {
      return match.row === options.row;
    }
    if (match.col != null) {
      return match.col === options.col;
    }
    return false;
  },
  repeat(conf, options) {
    const {
      match: {
        row,
        col,
        single = false
      }
    } = conf;
    const matchSingle = single || !single && options.exclude.col.indexOf(options.col) === -1 && options.exclude.row.indexOf(options.row) === -1;
    if (row) {
      return matchSingle && (options.row + 1) % row.coefficient === row.remainder;
    }
    if (col) {
      return matchSingle && (options.col + 1) % col.coefficient === col.remainder;
    }
    return false;
  }
};
function createLineStyle(lineConfs, gridConfs, colors = [], options) {
  if (!lineConfs || !lineConfs.length) {
    return {};
  }
  const singleLine = [];
  const repeatLine = [];
  const repeatExclude = {
    row: [],
    col: []
  };
  gridConfs.forEach((grid) => {
    if (grid.type !== "single")
      return;
    if (grid.match.row != null) {
      repeatExclude.row.push(grid.match.row);
    } else {
      repeatExclude.col.push(grid.match.col);
    }
  });
  lineConfs.forEach((conf) => {
    const checker = lineCheckers[conf.type];
    if (!checker)
      return;
    if (conf.type === "single") {
      if (checker(conf, options)) {
        singleLine.push(conf);
        return;
      }
    }
    if (conf.type === "repeat") {
      if (checker(conf, __spreadProps(__spreadValues({}, options), { exclude: repeatExclude }))) {
        repeatLine.push(conf);
      }
    }
  });
  const lineStyle = {};
  const currConfs = singleLine.length ? singleLine : repeatLine;
  if (currConfs.length) {
    currConfs.forEach((conf) => {
      const ui = cloneDeep(conf.ui);
      if (conf.match.row != null) {
        if (conf.type === "single" && options.col === options.colLength - 1) {
          delete ui.border.right;
        }
        if (conf.type === "repeat" && options.row === options.rowLength - 1) {
          delete ui.border.bottom;
        }
      }
      if (conf.match.col != null) {
        if (conf.type === "single" && options.row === options.rowLength - 1) {
          delete ui.border.bottom;
        }
        if (conf.type === "repeat" && options.col === options.colLength - 1) {
          delete ui.border.right;
        }
      }
      Object.assign(lineStyle, createStyle(ui, colors));
    });
  }
  return lineStyle;
}
function toRGBA(color) {
  const colorObject = tinycolor(color);
  const { r, g, b, a } = colorObject.toRgb();
  return [r, g, b, a];
}
function createGradientColors(startColor, endColor, step) {
  const [sr, sg, sb, sa] = toRGBA(startColor);
  const [er, eg, eb, ea] = toRGBA(endColor);
  const dr = (er - sr) / step;
  const dg = (eg - sg) / step;
  const db = (eb - sb) / step;
  const da = (ea - sa) / step;
  const colorList = [];
  for (let i = 0; i < step; i += 1) {
    const rgba = [
      Math.floor(sr + dr * i),
      Math.floor(sg + dg * i),
      Math.floor(sb + db * i),
      Math.floor(sa + da * i)
    ];
    colorList.push(`rgba(${rgba.join(",")})`);
  }
  return colorList;
}
var render$7 = function() {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", {
    staticClass: "grid-container",
    style: _vm.containerStyle
  }, [_vm._t("default")], 2);
};
var staticRenderFns$7 = [];
var container_vue_vue_type_style_index_0_lang = /* @__PURE__ */ (() => ".grid-container{position:relative;overflow:hidden;width:100%;height:100%;font-size:22px;font-weight:400;background:none}\n")();
const __vue2_script$7 = {
  name: "GridContainer",
  props: {
    theme: {
      type: Object,
      default: () => ({})
    },
    textStyle: {
      type: Object,
      default: () => ({})
    }
  },
  computed: {
    containerStyle() {
      const {
        textStyle,
        theme: { container, colors }
      } = this;
      return Object.assign({}, createStyle(container, colors), textStyle);
    }
  }
};
const __cssModules$7 = {};
var __component__$7 = /* @__PURE__ */ normalizeComponent(__vue2_script$7, render$7, staticRenderFns$7, false, __vue2_injectStyles$7, null, null, null);
function __vue2_injectStyles$7(context) {
  for (let o in __cssModules$7) {
    this[o] = __cssModules$7[o];
  }
}
var GridContainer = /* @__PURE__ */ function() {
  return __component__$7.exports;
}();
var base = {
  props: {
    model: {
      type: Object,
      default: () => ({})
    },
    data: {
      required: true
    },
    gradientColor: {
      type: String,
      default: ""
    },
    ui: {
      type: Object,
      default: () => ({})
    }
  },
  computed: {
    cellText() {
      return this.data || "";
    },
    cellUi() {
      const { ui, gradientColor } = this;
      if (!gradientColor) {
        return ui;
      }
      return __spreadProps(__spreadValues({}, ui), {
        backgroundColor: gradientColor
      });
    }
  }
};
var render$6 = function() {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", {
    staticClass: "grid-base-cell",
    style: _vm.cellUi
  }, [_vm._v(" " + _vm._s(_vm.cellText) + " ")]);
};
var staticRenderFns$6 = [];
var base_vue_vue_type_style_index_0_lang$1 = /* @__PURE__ */ (() => ".grid-base-cell{position:relative;display:flex;justify-content:center;align-items:center;overflow:hidden;width:100%;height:100%;margin:0;background-clip:content-box;border:none}\n")();
const __vue2_script$6 = {
  name: "GridBaseCell",
  mixins: [base]
};
const __cssModules$6 = {};
var __component__$6 = /* @__PURE__ */ normalizeComponent(__vue2_script$6, render$6, staticRenderFns$6, false, __vue2_injectStyles$6, null, null, null);
function __vue2_injectStyles$6(context) {
  for (let o in __cssModules$6) {
    this[o] = __cssModules$6[o];
  }
}
var BaseCell = /* @__PURE__ */ function() {
  return __component__$6.exports;
}();
var render$5 = function() {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", {
    staticClass: "grid-checkbox",
    style: _vm.cellUi
  }, [_c("span", {
    staticClass: "grid-checkbox__content",
    style: _vm.checkboxUi
  }, [_vm._v(" " + _vm._s(_vm.cellText) + " ")])]);
};
var staticRenderFns$5 = [];
var base_vue_vue_type_style_index_0_lang = /* @__PURE__ */ (() => '.grid-checkbox{overflow:hidden;width:100%;height:100%;border:none;display:flex;justify-content:center;align-items:center}.grid-checkbox__content{position:relative;border-color:transparent}.grid-checkbox__content:after{content:" ";position:absolute;width:100%;top:130%;left:0;border-bottom:2px solid transparent;border-color:inherit}\n')();
const __vue2_script$5 = {
  name: "GridCheckbox",
  mixins: [base],
  props: {
    checkbox: {
      type: Object,
      default: () => ({})
    }
  },
  computed: {
    checkboxUi() {
      const {
        checked,
        ui: [checkedUi, uncheckedUi]
      } = this.checkbox || {};
      if (!checked) {
        return __spreadValues(__spreadValues({}, this.ui), uncheckedUi);
      }
      return __spreadValues(__spreadValues({}, this.ui), checkedUi);
    }
  }
};
const __cssModules$5 = {};
var __component__$5 = /* @__PURE__ */ normalizeComponent(__vue2_script$5, render$5, staticRenderFns$5, false, __vue2_injectStyles$5, null, null, null);
function __vue2_injectStyles$5(context) {
  for (let o in __cssModules$5) {
    this[o] = __cssModules$5[o];
  }
}
var BaseCheckbox = /* @__PURE__ */ function() {
  return __component__$5.exports;
}();
var render$4 = function() {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", {
    staticClass: "fill-checkbox",
    style: _vm.ui
  }, [_c("span", _vm._b({
    staticClass: "fill-checkbox__content"
  }, "span", _vm.checkboxAttrs, false), [_vm._v(" " + _vm._s(_vm.cellText) + " ")])]);
};
var staticRenderFns$4 = [];
var fill_vue_vue_type_style_index_0_lang = /* @__PURE__ */ (() => '.fill-checkbox{display:flex;justify-content:center;align-items:center;overflow:hidden;width:100%;height:100%;border:none}.fill-checkbox__content{position:relative;display:flex;justify-content:center;align-items:center;width:100%;height:60%;border:none}.fill-checkbox__content--start{border-radius:16px 0 0 16px}.fill-checkbox__content--end{border-radius:0 16px 16px 0}body{min-width:1200px;overflow:overlay;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0)}body::-webkit-scrollbar{width:7px}body::-webkit-scrollbar-thumb{background-color:#000000b3;border:1px solid #fff;border-radius:10rem}body::-webkit-scrollbar-track-piece:start,body::-webkit-scrollbar-track-piece:end{background:transparent}ul{padding:0;list-style:none}.tofh{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[id^=HUABAN],[class^=HUABAN],[id^=ZCOOL],[class^=ZCOOL],[id^=lvye],[class^=lvye],[id^=xmt-],[class^=xmt-]{display:none!important}body>iframe[src="chrome-extension://gpdjojdkbbmdfjfahjcgigfpmkopogic/html/grid.html"],body>iframe[src="chrome-extension://gpdjojdkbbmdfjfahjcgigfpmkopogic/html/search.html"]{visibility:hidden!important;transform:translate(-10000px)!important}.eui-popup-base{z-index:2100!important}.eui-tabs__header{border-bottom-width:1px!important}.gda-btn:not(.gda-btn-sm){min-width:88px}.gda-btn>.gdaicon{font-size:20px;vertical-align:-.1em}.gda-btn svg{vertical-align:bottom}.gda-btn.disabled,.gda-btn[disabled]{cursor:default}.gda-dropdown-menu{box-shadow:0 2px 8px #00000029}.gda-dropdown-menu-item{padding:10px 12px;line-height:20px}.gda-dropdown-menu-item>.gdaicon:first-child{font-size:20px;vertical-align:bottom}.gda-dropdown-menu-item:hover,.gda-dropdown-menu-submenu-title:hover{background:#f6f7f9}.gda-dropdown-menu-item-disabled:hover,.gda-dropdown-menu-submenu-title-disabled:hover{background-color:#fff}.gda-modal-header{padding:18px 24px;border-bottom:none}.gda-modal-title{line-height:24px}.gda-modal-close-x{width:60px;height:60px;line-height:60px}.gda-modal-footer{border-top:none}.gda-form-item-label{font-weight:700}.gda-form-horizontal .gda-form-item{margin-bottom:10px}.gda-form-horizontal .gda-form-item-label{font-weight:700;line-height:48px}.gda-pagination-item,.gda-pagination-item:focus,.gda-pagination-item:hover,.gda-pagination-prev .gda-pagination-item-link,.gda-pagination-next .gda-pagination-item-link{color:#444950;background-color:#f0f3f4;border:none}.gda-pagination-item-active,.gda-pagination-item-active:focus,.gda-pagination-item-active:hover{background:#2254f4;border:none}.gda-pagination-item-active a,.gda-pagination-item-active:focus a,.gda-pagination-item-active:hover a{color:#fff}.gda-pagination-prev.gda-pagination-disabled .gda-pagination-item-link,.gda-pagination-next.gda-pagination-disabled .gda-pagination-item-link{opacity:.3}.gda-pagination-prev:focus .gda-pagination-item-link,.gda-pagination-next:focus .gda-pagination-item-link,.gda-pagination-prev:hover .gda-pagination-item-link,.gda-pagination-next:hover .gda-pagination-item-link{color:#444950}.gda-tree li,.gda-tree li:first-child,.gda-tree li:last-child{padding:0}.gda-tree-child-tree>li:first-child{padding-top:0}:root .gda-tree li span.gda-tree-switcher.gda-tree-switcher_close .gda-tree-switcher-icon,:root .gda-tree li span.gda-tree-switcher.gda-tree-switcher_open .gda-tree-switcher-icon{font-size:16px;vertical-align:-3px}.gda-tree.gda-tree-directory>li span.gda-tree-node-content-wrapper:hover:before,.gda-tree.gda-tree-directory .gda-tree-child-tree>li span.gda-tree-node-content-wrapper:hover:before{border-radius:4px}.gda-tree .gda-tree-treenode-checkbox-checked .gda-tree-checkbox-checked:after{display:none}\n')();
const __vue2_script$4 = {
  name: "FillCheckbox",
  mixins: [base],
  props: {
    row: {
      type: Number,
      default: 0
    },
    col: {
      type: Number,
      default: 0
    },
    checkbox: {
      type: Object,
      default: () => ({})
    }
  },
  computed: {
    checkboxAttrs() {
      const {
        col,
        checkbox: {
          checked,
          ui: [checkedUi, uncheckedUi],
          range: {
            start,
            end
          }
        }
      } = this;
      const attrs = {
        class: {
          "fill-checkbox__content--start": start.col === col,
          "fill-checkbox__content--end": end.col === col
        }
      };
      if (!checked) {
        attrs.style = __spreadValues(__spreadValues({}, this.ui), uncheckedUi);
      } else {
        attrs.style = __spreadValues(__spreadValues({}, this.ui), checkedUi);
      }
      return attrs;
    }
  }
};
const __cssModules$4 = {};
var __component__$4 = /* @__PURE__ */ normalizeComponent(__vue2_script$4, render$4, staticRenderFns$4, false, __vue2_injectStyles$4, null, null, null);
function __vue2_injectStyles$4(context) {
  for (let o in __cssModules$4) {
    this[o] = __cssModules$4[o];
  }
}
var FillCheckBox = /* @__PURE__ */ function() {
  return __component__$4.exports;
}();
var render$3 = function() {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", {
    staticClass: "gradient-checkbox",
    style: _vm.ui
  }, [_c("div", {
    staticClass: "gradient-checkbox__content",
    class: _vm.checkedClass,
    style: _vm.contentStyle
  }, [_c("span", {
    staticClass: "gradient-checkbox__hide"
  }, [_vm._v(" " + _vm._s(_vm.cellText) + " ")]), _c("span", {
    staticClass: "gradient-checkbox__text",
    style: _vm.textStyle
  }, [_vm._v(" " + _vm._s(_vm.cellText) + " ")]), _vm.checkbox.checked ? _c("span", {
    staticClass: "gradient-checkbox__sliding",
    style: _vm.checkedStyle
  }) : _vm._e()])]);
};
var staticRenderFns$3 = [];
var gradient_vue_vue_type_style_index_0_lang = /* @__PURE__ */ (() => '.gradient-checkbox{display:flex;justify-content:center;align-items:center;overflow:hidden;width:100%;height:100%;border:none}.gradient-checkbox__content{position:relative;width:100%;height:8px;text-align:center}.gradient-checkbox__content--start{border-radius:4px 0 0 4px}.gradient-checkbox__content--end{border-radius:0 4px 4px 0}.gradient-checkbox__hide{opacity:0}.gradient-checkbox__text{display:block;position:absolute;top:200%;left:0;width:100%}.gradient-checkbox__sliding{position:absolute;top:50%;left:50%;width:60%;height:180%;transform:translate(-50%,-50%);border:1px solid #000;background:#fff;border-radius:50px}body{min-width:1200px;overflow:overlay;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0)}body::-webkit-scrollbar{width:7px}body::-webkit-scrollbar-thumb{background-color:#000000b3;border:1px solid #fff;border-radius:10rem}body::-webkit-scrollbar-track-piece:start,body::-webkit-scrollbar-track-piece:end{background:transparent}ul{padding:0;list-style:none}.tofh{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[id^=HUABAN],[class^=HUABAN],[id^=ZCOOL],[class^=ZCOOL],[id^=lvye],[class^=lvye],[id^=xmt-],[class^=xmt-]{display:none!important}body>iframe[src="chrome-extension://gpdjojdkbbmdfjfahjcgigfpmkopogic/html/grid.html"],body>iframe[src="chrome-extension://gpdjojdkbbmdfjfahjcgigfpmkopogic/html/search.html"]{visibility:hidden!important;transform:translate(-10000px)!important}.eui-popup-base{z-index:2100!important}.eui-tabs__header{border-bottom-width:1px!important}.gda-btn:not(.gda-btn-sm){min-width:88px}.gda-btn>.gdaicon{font-size:20px;vertical-align:-.1em}.gda-btn svg{vertical-align:bottom}.gda-btn.disabled,.gda-btn[disabled]{cursor:default}.gda-dropdown-menu{box-shadow:0 2px 8px #00000029}.gda-dropdown-menu-item{padding:10px 12px;line-height:20px}.gda-dropdown-menu-item>.gdaicon:first-child{font-size:20px;vertical-align:bottom}.gda-dropdown-menu-item:hover,.gda-dropdown-menu-submenu-title:hover{background:#f6f7f9}.gda-dropdown-menu-item-disabled:hover,.gda-dropdown-menu-submenu-title-disabled:hover{background-color:#fff}.gda-modal-header{padding:18px 24px;border-bottom:none}.gda-modal-title{line-height:24px}.gda-modal-close-x{width:60px;height:60px;line-height:60px}.gda-modal-footer{border-top:none}.gda-form-item-label{font-weight:700}.gda-form-horizontal .gda-form-item{margin-bottom:10px}.gda-form-horizontal .gda-form-item-label{font-weight:700;line-height:48px}.gda-pagination-item,.gda-pagination-item:focus,.gda-pagination-item:hover,.gda-pagination-prev .gda-pagination-item-link,.gda-pagination-next .gda-pagination-item-link{color:#444950;background-color:#f0f3f4;border:none}.gda-pagination-item-active,.gda-pagination-item-active:focus,.gda-pagination-item-active:hover{background:#2254f4;border:none}.gda-pagination-item-active a,.gda-pagination-item-active:focus a,.gda-pagination-item-active:hover a{color:#fff}.gda-pagination-prev.gda-pagination-disabled .gda-pagination-item-link,.gda-pagination-next.gda-pagination-disabled .gda-pagination-item-link{opacity:.3}.gda-pagination-prev:focus .gda-pagination-item-link,.gda-pagination-next:focus .gda-pagination-item-link,.gda-pagination-prev:hover .gda-pagination-item-link,.gda-pagination-next:hover .gda-pagination-item-link{color:#444950}.gda-tree li,.gda-tree li:first-child,.gda-tree li:last-child{padding:0}.gda-tree-child-tree>li:first-child{padding-top:0}:root .gda-tree li span.gda-tree-switcher.gda-tree-switcher_close .gda-tree-switcher-icon,:root .gda-tree li span.gda-tree-switcher.gda-tree-switcher_open .gda-tree-switcher-icon{font-size:16px;vertical-align:-3px}.gda-tree.gda-tree-directory>li span.gda-tree-node-content-wrapper:hover:before,.gda-tree.gda-tree-directory .gda-tree-child-tree>li span.gda-tree-node-content-wrapper:hover:before{border-radius:4px}.gda-tree .gda-tree-treenode-checkbox-checked .gda-tree-checkbox-checked:after{display:none}\n')();
const __vue2_script$3 = {
  name: "GradientCheckbox",
  mixins: [base],
  props: {
    row: {
      type: Number,
      default: 0
    },
    col: {
      type: Number,
      default: 0
    },
    checkbox: {
      type: Object,
      default: () => ({})
    }
  },
  computed: {
    contentStyle() {
      if (this.gradientColor) {
        return { backgroundColor: this.gradientColor };
      }
      return {};
    },
    checkedStyle() {
      const {
        ui: checckedUi = []
      } = this.checkbox;
      const [checked] = checckedUi;
      return checked;
    },
    textStyle() {
      const { fontSize = 22 } = this.model;
      return {
        fontSize: `${Math.ceil(fontSize * 0.8)}px`
      };
    },
    checkedClass() {
      const {
        col,
        checkbox: {
          range: {
            start,
            end
          }
        }
      } = this;
      return {
        "gradient-checkbox__content--start": start.col === col,
        "gradient-checkbox__content--end": end.col === col
      };
    }
  }
};
const __cssModules$3 = {};
var __component__$3 = /* @__PURE__ */ normalizeComponent(__vue2_script$3, render$3, staticRenderFns$3, false, __vue2_injectStyles$3, null, null, null);
function __vue2_injectStyles$3(context) {
  for (let o in __cssModules$3) {
    this[o] = __cssModules$3[o];
  }
}
var GradientCheckbox = /* @__PURE__ */ function() {
  return __component__$3.exports;
}();
var render$2 = function() {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c(_vm.cellComponent, _vm._b({
    tag: "component"
  }, "component", _vm.$attrs, false));
};
var staticRenderFns$2 = [];
const components = {
  base: BaseCell,
  checkbox: BaseCheckbox,
  "fill-checkbox": FillCheckBox,
  "gradient-checkbox": GradientCheckbox
};
const __vue2_script$2 = {
  inheritAttrs: false,
  props: {
    component: {
      type: String,
      default: "base"
    }
  },
  computed: {
    cellComponent() {
      return components[this.component] || components.base;
    }
  }
};
const __cssModules$2 = {};
var __component__$2 = /* @__PURE__ */ normalizeComponent(__vue2_script$2, render$2, staticRenderFns$2, false, __vue2_injectStyles$2, null, null, null);
function __vue2_injectStyles$2(context) {
  for (let o in __cssModules$2) {
    this[o] = __cssModules$2[o];
  }
}
var Cell = /* @__PURE__ */ function() {
  return __component__$2.exports;
}();
var render$1 = function() {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("table", {
    staticClass: "grid-core",
    attrs: {
      "border": "0",
      "cellpadding": "0",
      "cellspacing": "0"
    }
  }, [_c("tbody", _vm._l(_vm.gridData, function(rows, rIdx) {
    return _c("tr", {
      key: rIdx
    }, _vm._l(rows, function(cell, cIdx) {
      return _c("td", {
        key: cIdx,
        staticClass: "grid-core__cell",
        class: {
          "grid-core__cell--checkbox": _vm.isCheckbox,
          "grid-core__cell--checkbox-header": _vm.isCheckbox && !cIdx
        },
        style: _vm.getCellStyle(rIdx, cIdx, cell)
      }, [_c("Cell", _vm._b({}, "Cell", cell, false))], 1);
    }), 0);
  }), 0)]);
};
var staticRenderFns$1 = [];
var index_vue_vue_type_style_index_0_lang$1 = /* @__PURE__ */ (() => '.grid-core{position:relative;box-sizing:border-box;overflow:hidden;width:100%;height:100%;border-collapse:collapse}.grid-core__cell{padding:0;margin:0;border:none}.grid-core__cell--checkbox{width:200px}.grid-core__cell--checkbox-header{width:300px}body{min-width:1200px;overflow:overlay;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:rgba(0,0,0,0)}body::-webkit-scrollbar{width:7px}body::-webkit-scrollbar-thumb{background-color:#000000b3;border:1px solid #fff;border-radius:10rem}body::-webkit-scrollbar-track-piece:start,body::-webkit-scrollbar-track-piece:end{background:transparent}ul{padding:0;list-style:none}.tofh{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[id^=HUABAN],[class^=HUABAN],[id^=ZCOOL],[class^=ZCOOL],[id^=lvye],[class^=lvye],[id^=xmt-],[class^=xmt-]{display:none!important}body>iframe[src="chrome-extension://gpdjojdkbbmdfjfahjcgigfpmkopogic/html/grid.html"],body>iframe[src="chrome-extension://gpdjojdkbbmdfjfahjcgigfpmkopogic/html/search.html"]{visibility:hidden!important;transform:translate(-10000px)!important}.eui-popup-base{z-index:2100!important}.eui-tabs__header{border-bottom-width:1px!important}.gda-btn:not(.gda-btn-sm){min-width:88px}.gda-btn>.gdaicon{font-size:20px;vertical-align:-.1em}.gda-btn svg{vertical-align:bottom}.gda-btn.disabled,.gda-btn[disabled]{cursor:default}.gda-dropdown-menu{box-shadow:0 2px 8px #00000029}.gda-dropdown-menu-item{padding:10px 12px;line-height:20px}.gda-dropdown-menu-item>.gdaicon:first-child{font-size:20px;vertical-align:bottom}.gda-dropdown-menu-item:hover,.gda-dropdown-menu-submenu-title:hover{background:#f6f7f9}.gda-dropdown-menu-item-disabled:hover,.gda-dropdown-menu-submenu-title-disabled:hover{background-color:#fff}.gda-modal-header{padding:18px 24px;border-bottom:none}.gda-modal-title{line-height:24px}.gda-modal-close-x{width:60px;height:60px;line-height:60px}.gda-modal-footer{border-top:none}.gda-form-item-label{font-weight:700}.gda-form-horizontal .gda-form-item{margin-bottom:10px}.gda-form-horizontal .gda-form-item-label{font-weight:700;line-height:48px}.gda-pagination-item,.gda-pagination-item:focus,.gda-pagination-item:hover,.gda-pagination-prev .gda-pagination-item-link,.gda-pagination-next .gda-pagination-item-link{color:#444950;background-color:#f0f3f4;border:none}.gda-pagination-item-active,.gda-pagination-item-active:focus,.gda-pagination-item-active:hover{background:#2254f4;border:none}.gda-pagination-item-active a,.gda-pagination-item-active:focus a,.gda-pagination-item-active:hover a{color:#fff}.gda-pagination-prev.gda-pagination-disabled .gda-pagination-item-link,.gda-pagination-next.gda-pagination-disabled .gda-pagination-item-link{opacity:.3}.gda-pagination-prev:focus .gda-pagination-item-link,.gda-pagination-next:focus .gda-pagination-item-link,.gda-pagination-prev:hover .gda-pagination-item-link,.gda-pagination-next:hover .gda-pagination-item-link{color:#444950}.gda-tree li,.gda-tree li:first-child,.gda-tree li:last-child{padding:0}.gda-tree-child-tree>li:first-child{padding-top:0}:root .gda-tree li span.gda-tree-switcher.gda-tree-switcher_close .gda-tree-switcher-icon,:root .gda-tree li span.gda-tree-switcher.gda-tree-switcher_open .gda-tree-switcher-icon{font-size:16px;vertical-align:-3px}.gda-tree.gda-tree-directory>li span.gda-tree-node-content-wrapper:hover:before,.gda-tree.gda-tree-directory .gda-tree-child-tree>li span.gda-tree-node-content-wrapper:hover:before{border-radius:4px}.gda-tree .gda-tree-treenode-checkbox-checked .gda-tree-checkbox-checked:after{display:none}\n')();
const __vue2_script$1 = {
  name: "GridCore",
  components: {
    Cell
  },
  props: {
    data: {
      type: Array,
      default: () => []
    },
    theme: {
      type: Object,
      required: true
    },
    options: {
      type: Object,
      default: () => ({})
    },
    model: {
      type: Object,
      default: () => ({})
    }
  },
  computed: {
    isCheckbox() {
      return !!this.theme.checkbox;
    },
    lineConf() {
      return this.theme.lines;
    },
    gridConf() {
      return this.theme.grids;
    },
    gridRow() {
      return this.data.length;
    },
    gridCol() {
      return this.data[0].length;
    },
    contentRange() {
      const {
        options: {
          header
        },
        gridRow,
        gridCol
      } = this;
      const {
        row: headerRows = [],
        col: headerCols = []
      } = header || {};
      const start = {
        row: headerRows.length ? Math.max.apply(null, headerRows) + 1 : 0,
        col: headerCols.length ? Math.max.apply(null, headerCols) + 1 : 0
      };
      const end = {
        row: Math.max(gridRow - 1, 0),
        col: Math.max(gridCol - 1, 0)
      };
      return { start, end };
    },
    contentColorMap() {
      const {
        data,
        gridCol,
        options: {
          gradient
        },
        theme: {
          colors,
          gradientColors = []
        },
        contentRange: {
          start,
          end
        }
      } = this;
      if (!gradient || !gradient.content) {
        return {};
      }
      const contentMap = {};
      for (let row = start.row; row <= end.row; row += 1) {
        for (let col = start.col; col <= end.col; col += 1) {
          const content = data[row] ? data[row][col] : "";
          if (content) {
            const weight = col * gridCol + row;
            contentMap[content] = Math.max(contentMap[content] || 0, weight);
          }
        }
      }
      const sequence = Object.entries(contentMap).sort((a, b) => a[1] - b[1]).map(([key]) => key);
      const standardColors = gradientColors.map((color) => colors[color] || color);
      if (sequence && sequence.length) {
        const colorList = createGradientColors(standardColors[0], standardColors[1], sequence.length);
        const colorMap = {};
        sequence.forEach((value, index2) => {
          colorMap[value] = colorList[index2];
        });
        return colorMap;
      }
      return {};
    },
    directionColorMap() {
      const {
        options: {
          gradient
        },
        theme: {
          colors,
          gradientColors
        },
        contentRange: {
          start,
          end
        }
      } = this;
      if (!gradient || !gradientColors || !gradientColors.length) {
        return {};
      }
      const { direction } = gradient;
      const standardColors = gradientColors.map((color) => colors[color] || color);
      if (direction) {
        let rowColors = [];
        let colColors = [];
        if (direction === "row") {
          colColors = createGradientColors(standardColors[0], standardColors[1], end.col - start.col + 1);
        } else {
          rowColors = createGradientColors(standardColors[0], standardColors[1], end.row - start.row + 1);
        }
        const colorMap = {};
        for (let i = 0; i <= end.row - start.row; i += 1) {
          const rowColor = rowColors[i];
          for (let j = 0; j <= end.col - start.col; j += 1) {
            const colColor = colColors[j];
            const color = rowColor || colColor;
            if (color) {
              colorMap[`${i + start.row}-${j + start.col}`] = color;
            }
          }
        }
        return colorMap;
      }
      return {};
    },
    checkedCellMap() {
      const { checkbox } = this.options;
      if (!checkbox || !checkbox.checked.length) {
        return {};
      }
      const cellMap = {};
      checkbox.checked.forEach(({ row, col }) => {
        cellMap[`${row}-${col}`] = true;
      });
      return cellMap;
    },
    checkedCellAttrs() {
      const {
        options: {
          checkbox
        },
        theme,
        contentRange
      } = this;
      if (!checkbox || !theme.checkbox)
        return null;
      const {
        view,
        ui: checkboxUi = []
      } = theme.checkbox || {};
      return {
        checkbox: {
          checked: false,
          ui: [
            createStyle(checkboxUi[0] || {}, theme.colors),
            createStyle(checkboxUi[1] || {}, theme.colors)
          ],
          range: contentRange
        },
        component: view || "checkbox"
      };
    },
    gridData() {
      const {
        data,
        gridConf,
        theme,
        model,
        options: {
          header,
          gradient
        },
        contentColorMap,
        directionColorMap,
        checkedCellMap: cellMap,
        checkedCellAttrs: cellAttrs
      } = this;
      return data.map((rows, rIdx) => {
        const gridRows = rows.map((content, cIdx) => {
          const cell = {
            model,
            col: cIdx,
            row: rIdx,
            component: "base",
            data: content,
            gradientColor: "",
            ui: {}
          };
          const options = {
            row: rIdx,
            col: cIdx
          };
          Object.assign(cell.ui, createGridStyle(gridConf, theme.colors, options));
          if (gradient) {
            cell.gradientColor = directionColorMap[`${rIdx}-${cIdx}`] || contentColorMap[content] || "";
          }
          if (cellAttrs) {
            if (header.row.indexOf(rIdx) === -1 && header.col.indexOf(cIdx) === -1) {
              Object.assign(cell, cloneDeep(cellAttrs));
              cell.checkbox.checked = cellMap[`${rIdx}-${cIdx}`] || false;
            }
          }
          return cell;
        });
        return gridRows;
      });
    }
  },
  methods: {
    getCellStyle(rIdx, cIdx, cell) {
      const {
        lineConf,
        gridConf,
        gridRow,
        gridCol,
        theme,
        contentColorMap
      } = this;
      const lineStyle = createLineStyle(lineConf, gridConf, theme.colors, {
        row: rIdx,
        col: cIdx,
        rowLength: gridRow,
        colLength: gridCol
      });
      const ui = cell.ui || {};
      const gradientColor = contentColorMap[cell.data];
      return __spreadProps(__spreadValues({}, lineStyle), {
        width: ui.width,
        backgroundColor: ui.backgroundColor || ui["background-color"] || gradientColor
      });
    }
  }
};
const __cssModules$1 = {};
var __component__$1 = /* @__PURE__ */ normalizeComponent(__vue2_script$1, render$1, staticRenderFns$1, false, __vue2_injectStyles$1, null, null, null);
function __vue2_injectStyles$1(context) {
  for (let o in __cssModules$1) {
    this[o] = __cssModules$1[o];
  }
}
var GridCore = /* @__PURE__ */ function() {
  return __component__$1.exports;
}();
var render = function() {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("section", {
    staticClass: "editor-table"
  }, [_c("GridContainer", {
    attrs: {
      "theme": _vm.theme,
      "text-style": _vm.textStyle
    }
  }, [_c("GridCore", {
    attrs: {
      "data": _vm.data,
      "theme": _vm.theme,
      "options": _vm.options,
      "model": _vm.element.model
    },
    on: {
      "update:data": function($event) {
        _vm.data = $event;
      }
    }
  })], 1)], 1);
};
var staticRenderFns = [];
var index_vue_vue_type_style_index_0_lang = /* @__PURE__ */ (() => ".editor-table{width:100%;height:100%;position:relative}\n")();
const __vue2_script = {
  components: {
    GridContainer,
    GridCore
  },
  props: {
    options: {
      type: Object,
      default: () => ({})
    },
    data: {
      type: Array,
      default: () => []
    },
    theme: {
      type: Object,
      default: () => ({})
    },
    element: {
      type: Object,
      default: () => ({})
    },
    textStyle: {
      type: Object,
      default: () => ({})
    }
  }
};
const __cssModules = {};
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles, null, null, null);
function __vue2_injectStyles(context) {
  for (let o in __cssModules) {
    this[o] = __cssModules[o];
  }
}
var DesignTable = /* @__PURE__ */ function() {
  return __component__.exports;
}();
var elementDependence = {
  computed: {
    element() {
      return {
        global: this.global,
        model: this.model,
        options: this.options,
        rect: this.rect
      };
    },
    boxStyle() {
      const { rect } = this;
      const { padding } = rect;
      return {
        height: `${rect.height + padding[0] + padding[2]}px`,
        width: `${rect.width + padding[1] + padding[3]}px`,
        transform: this.transform.toString(),
        left: `${rect.left}px`,
        top: `${rect.top}px`,
        opacity: this.opacity,
        position: "absolute"
      };
    },
    innerStyle() {
      const { model, global: { zoom = 1 } } = this;
      return {
        width: `${Math.round(model.width)}px`,
        height: `${Math.round(model.height)}px`,
        transform: `scale(${zoom})`
      };
    }
  }
};
const DEFAULT_FONT_FAMILY = "-apple-system,BlinkMacSystemFont,Segoe UI,Hiragino Sans GB,Microsoft YaHei,Helvetica Neue,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol";
const isFox = utils.isFox();
const supportMiniFontSize = isFox || window.safari;
var fontBehavior = {
  data() {
    return {
      fallbackFonts: DEFAULT_FONT_FAMILY,
      minFontSize: supportMiniFontSize ? 1 : 12,
      lastFont: null
    };
  },
  computed: {
    fontFamily() {
      const fallbackFonts = this.fallbackFonts;
      let font = this.lastFont;
      if (!font || this.model.$loaded) {
        font = this.getCloseFont();
      }
      if (!font) {
        return fallbackFonts;
      }
      const subsetSuffix = this.options.subsetSuffix;
      const fontNames = uniq_1([
        `"${font.name + subsetSuffix}"`,
        `"${font.family + subsetSuffix}"`,
        `"${font.name}"`,
        `"${font.family}"`,
        fallbackFonts
      ]);
      return fontNames.join(",");
    },
    textStyle() {
      const {
        fontFamily,
        model: {
          fontStyle,
          fontWeight,
          fontSize
        }
      } = this;
      return {
        fontStyle,
        fontWeight,
        fontFamily,
        fontSize: `${fontSize}px`
      };
    }
  },
  methods: {
    getCloseFont(name = "") {
      const { fontsMap, defaultFont, fontList } = this.options;
      if (!name) {
        name = this.model.fontFamily;
      }
      return fontsMap[name] || fontsMap[defaultFont] || fontList[0];
    },
    initFontProps() {
      const {
        model,
        options: {
          defaultFont,
          fontList = []
        }
      } = this;
      const initFont = defaultFont || fontList[0];
      const initFontName = initFont ? initFont.name : "";
      const props = [
        { key: "color", value: "" },
        { key: "fontFamily", value: initFontName },
        { key: "fontStyle", value: "" },
        { key: "fontSize", value: 34 },
        { key: "fontWeight", value: 400 },
        { key: "textDecoration", value: "" },
        { key: "content", value: "" },
        { key: "contents", value: [] }
      ];
      const content = {};
      props.forEach((prop) => {
        if (model[prop.key] === void 0) {
          this.$set(model, prop.key, prop.value);
        }
        if (prop.key === "fontFamily" && !model[prop.key]) {
          model[prop.key] = initFontName;
        }
        if (prop.key !== "contents") {
          content[prop.key] = model[prop.key];
        }
      });
      if (!model.contents.length) {
        model.contents = [content];
      }
    },
    refreshFontContent: throttle(function refreshFontContent() {
      const { fontFamily, $loaded } = this.model;
      if ($loaded) {
        this.lastFont = this.getCloseFont(fontFamily);
      }
      this.checkLoad();
    }, 200),
    updateFontContents(text) {
      this.model.content = text;
      const props = [
        "color",
        "fontFamily",
        "fontSize",
        "fontStyle",
        "fontWeight",
        "textDecoration",
        "content"
      ];
      const content = props.reduce((mix, prop) => {
        mix[prop] = this.model[prop] || "";
        return mix;
      }, {});
      this.model.contents = [content];
    },
    checkLoadFullFont() {
      const { model, options } = this;
      if (["flow", "design"].indexOf(options.mode) === -1)
        return;
      const fontData = getUpdateFontsSubset([{ elements: [model] }], options);
      if (fontData) {
        Object.keys(fontData).forEach((name) => {
          const fontSubset = options.fontSubsetsMap[name];
          if (fontSubset) {
            fontSubset.loadType = "all";
          }
        });
      }
    },
    updateFontConf(content = "") {
      this.updateFontContents(content);
      this.checkLoadFullFont();
      this.refreshFontContent();
    },
    loadFonts(name) {
      const options = this.options;
      const { contents, fontFamily } = this.model;
      let names = null;
      if (name) {
        names = [name];
      } else {
        names = contents.filter((item) => item && item.fontFamily).map((item) => item.fontFamily);
        names.push(fontFamily);
        names = uniq_1(names);
      }
      const fontLoads = names.map((name2) => {
        const font = this.getCloseFont(name2);
        const fontSubset = this.options.fontSubsetsMap[font.name];
        if (!font) {
          return Promise.resolve();
        }
        return loader.loadFont(Object.assign({}, font, {
          display: "swap"
        }, fontSubset && fontSubset.loadType === "subset" ? {
          subset: {
            suffix: options.subsetSuffix,
            promise: fontSubset.subsetPromise,
            content: fontSubset.subsetContent
          }
        } : null), options.fontLoadTimeout);
      });
      return Promise.all(fontLoads);
    }
  }
};
function createDblClickEvent(type) {
  return {
    "base.click": function click(event) {
      const { editor } = this;
      if (!editor || !editor.pointFromEvent || !editor.getElementByPoint) {
        return;
      }
      if (this.elementClickQueue == null) {
        this.elementClickQueue = [];
      }
      const point = editor.pointFromEvent(event);
      const element = editor.getElementByPoint(point.x, point.y);
      if (!element || element.type !== type) {
        this.elementClickQueue = [];
        return;
      }
      if (this.elementClickTimer) {
        clearTimeout(this.elementClickTimer);
        this.elementClickQueue.push(element);
        if (this.elementClickQueue.length > 1) {
          this.editor.$emit(`editor.${type}.dblclick`, element);
          this.elementClickQueue = [];
        }
      } else {
        this.elementClickQueue.push(element);
      }
      this.elementClickTimer = setTimeout(() => {
        this.elementClickQueue = [];
      }, 300);
    }
  };
}
var template = `<div
    class="editor-element"
    :data-id="model.$id"
    :class="[
        'editor-element-' + model.type,
        model.lock ? 'editor-element-lock' : '',
        model.hidden ? 'editor-element-hidden' : '',
        model.frozen ? 'editor-element-frozen' : '',
        model.$loaded ? '' : 'editor-element-loading',
        model.$selected ? 'editor-element-selected' : '',
        model.$editing ? 'editor-element-editing' : '',
        errorMessage ? 'editor-element-error' : ''
    ]"
    :style="boxStyle"
>
    <div
        class="element-inner"
        :style="innerStyle"
    >
         <div class="element-main">
            <DesignTable
                :element="element"
                :data="model.gridData"
                :theme="model.gridTheme"
                :options="model.gridOptions"
                :text-style="textStyle"
            />
        </div>
    </div>

    <slot :hideBlink="hideBlink" :isShowBlink="isShowBlink" :bgNinePatch="bgNinePatch"></slot>
</div>
`;
var tableLayout = /* @__PURE__ */ (() => ".editor-element-table{position:relative;width:100%;height:100%}.editor-element-table .element-inner{position:relative;width:100%;height:100%;transform-origin:0 0}\n")();
var layoutComponent = inherit(BaseElement, {
  mixins: [elementDependence, fontBehavior],
  name: "table-element",
  template,
  components: {
    DesignTable
  },
  computed: {
    contentText() {
      const { gridData } = this.model;
      const text = gridData.reduce((arr, data) => {
        return arr.concat(data);
      }, []).join("").replace(/\s+/g, "");
      return uniq_1(text).join("");
    }
  },
  watch: {
    "model.fontSize"() {
      this.updateFontContents(this.contentText);
    },
    "model.fontFamily"() {
      this.updateFontConf(this.contentText);
    },
    contentText() {
      this.updateFontConf(this.contentText);
    }
  },
  events: __spreadValues({}, createDblClickEvent("table")),
  created() {
    this.initFontProps();
    this.updateFontContents(this.contentText);
    this.checkLoadFullFont();
  },
  methods: {
    load() {
      return this.loadFonts();
    }
  }
});
var index = {
  model: Table,
  methods,
  layoutComponent
};
export { index as default };
