import "../styles/reset.css";
import "./progress.less";
import { ProgressStrokeLineCapType as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_ProgressStrokeLineCapType__, ProgressType as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_ProgressType__, PropTypes as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__, ThemeEnum as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_ThemeEnum__, classes as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_classes__, withInstall as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_withInstall__ } from "../shared";
import { createVNode as __WEBPACK_EXTERNAL_MODULE_vue_createVNode__, defineComponent as __WEBPACK_EXTERNAL_MODULE_vue_defineComponent__, isVNode as __WEBPACK_EXTERNAL_MODULE_vue_isVNode__ } from "vue";
import { usePrefix as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3_usePrefix__ } from "../config-provider";

;// external "../shared"

;// external "vue"

;// ../../node_modules/@babel/runtime/helpers/esm/typeof.js
function _typeof(o) {
  "@babel/helpers - typeof";

  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
    return typeof o;
  } : function (o) {
    return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
  }, _typeof(o);
}

;// ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js

function toPrimitive(t, r) {
  if ("object" != _typeof(t) || !t) return t;
  var e = t[Symbol.toPrimitive];
  if (void 0 !== e) {
    var i = e.call(t, r || "default");
    if ("object" != _typeof(i)) return i;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r ? String : Number)(t);
}

;// ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js


function toPropertyKey(t) {
  var i = toPrimitive(t, "string");
  return "symbol" == _typeof(i) ? i : i + "";
}

;// ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js

function _defineProperty(e, r, t) {
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
    value: t,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[r] = t, e;
}

;// external "../config-provider"

;// ../../packages/progress/src/circle.tsx

/*
 * Tencent is pleased to support the open source community by making
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
 *
 * Copyright (C) 2025 Tencent.  All rights reserved.
 *
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
 *
 * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
 *
 * ---------------------------------------------------
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
 * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
 * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
 * the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
 * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */

/** 环形进度和仪表盘 */
var Circle = function Circle(_, _ref) {
  var attrs = _ref.attrs,
    slots = _ref.slots;
  var _usePrefix = __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3_usePrefix__(),
    resolveClassName = _usePrefix.resolveClassName;
  var width = attrs.width,
    percent = attrs.percent,
    strokeWidth = attrs.strokeWidth,
    color = attrs.color,
    strokeLinecap = attrs.strokeLinecap,
    theme = attrs.theme,
    type = attrs.type,
    bgColor = attrs.bgColor,
    titleStyle = attrs.titleStyle;
  var circleStrokeWidth = strokeWidth || 6;
  var circleSize = width || 126;
  var circleStyle = {
    width: typeof circleSize === 'number' ? "".concat(circleSize, "px") : circleSize,
    height: typeof circleSize === 'number' ? "".concat(circleSize, "px") : circleSize,
    fontSize: "".concat(circleSize * 0.15 + 6, "px")
  };
  var radius = 50 - circleStrokeWidth / 2;
  var isDashboard = type === 'dashboard';
  /** 总度数 */
  var len = Math.PI * 2 * radius;
  /** 绘制长度 */
  var rate = isDashboard && 0.75 || 1;
  /** stroke偏移 */
  var strokeDashoffset = "".concat(-1 * len * (1 - rate) / 2, "px");
  var transition = 'stroke-dasharray 0.6s ease 0s, stroke 0.6s ease';
  /** 底色样式 */
  var trailStyle = {
    strokeDasharray: "".concat(len * rate, "px, ").concat(len, "px"),
    strokeDashoffset: strokeDashoffset
  };
  /** 路径样式 */
  var pathStyle = {
    strokeDasharray: "".concat(len * rate * (percent / 100), "px, ").concat(len, "px"),
    strokeDashoffset: strokeDashoffset,
    transition: transition
  };
  /** 绘制路径 */
  var path = "\n    M 50 50\n    m 0 ".concat(isDashboard ? '' : '-').concat(radius, "\n    a ").concat(radius, " ").concat(radius, " 0 1 1 0 ").concat(isDashboard ? '-' : '').concat(radius * 2, "\n    a ").concat(radius, " ").concat(radius, " 0 1 1 0 ").concat(isDashboard ? '' : '-').concat(radius * 2, "\n  ");
  /** 底色 */
  var progressCircleTrail = {
    d: path,
    stroke: bgColor || '#f5f5f5',
    'stroke-linecap': strokeLinecap,
    'stroke-width': circleStrokeWidth,
    'fill-opacity': '0',
    "class": 'process-circle-trail',
    style: trailStyle
  };
  /** 路径 */
  var progressCirclePath = {
    d: path,
    stroke: color || '#13ce66',
    'stroke-linecap': strokeLinecap,
    'stroke-width': percent > 0 && circleStrokeWidth || 0,
    'fill-opacity': '0',
    "class": "process-circle-path ".concat(resolveClassName("".concat(theme, "-circle-trail"))),
    style: pathStyle
  };
  return __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("div", {
    "style": circleStyle,
    "class": "progress-outer-circle"
  }, [__WEBPACK_EXTERNAL_MODULE_vue_createVNode__("svg", {
    "viewBox": "0 0 100 100"
  }, [__WEBPACK_EXTERNAL_MODULE_vue_createVNode__("path", progressCircleTrail, null), __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("path", progressCirclePath, null)]), __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("span", {
    "style": titleStyle,
    "class": "progress-circle-text"
  }, [slots === null || slots === void 0 ? void 0 : slots["default"]()])]);
};
/* harmony default export */ const circle = (Circle);
;// ../../packages/progress/src/line.tsx


/*
 * Tencent is pleased to support the open source community by making
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
 *
 * Copyright (C) 2025 Tencent.  All rights reserved.
 *
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
 *
 * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
 *
 * ---------------------------------------------------
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
 * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
 * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
 * the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
 * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */

/** 进度条直线*/
var Line = function Line(_, _ref) {
  var attrs = _ref.attrs,
    slots = _ref.slots;
  var _usePrefix = __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3_usePrefix__(),
    resolveClassName = _usePrefix.resolveClassName;
  var percent = attrs.percent,
    strokeWidth = attrs.strokeWidth,
    size = attrs.size,
    color = attrs.color,
    titleStyle = attrs.titleStyle,
    showText = attrs.showText,
    textInside = attrs.textInside,
    theme = attrs.theme;
  var percentStyle = {
    height: "".concat(strokeWidth, "px"),
    lineHeight: "".concat(strokeWidth, "px")
  };
  var barStyle = {
    width: "".concat(percent, "%"),
    background: color,
    animationDuration: '3s'
  };
  /** 根据 textInside 来区分何时展示 默认slot*/
  var showDefault = function showDefault() {
    var isTextInside = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
    if (!(showText || slots["default"])) {
      return null;
    }
    if (isTextInside && textInside || !isTextInside && !textInside) {
      return slots === null || slots === void 0 ? void 0 : slots["default"]();
    }
    return null;
  };
  return __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("div", {
    "class": "progress-outer"
  }, [__WEBPACK_EXTERNAL_MODULE_vue_createVNode__("div", {
    "style": percentStyle,
    "class": "".concat(resolveClassName("progress-".concat(size || 'normal')), " progress-bar")
  }, [__WEBPACK_EXTERNAL_MODULE_vue_createVNode__("div", {
    "style": barStyle,
    "class": _defineProperty({
      'progress-inner': true
    }, "".concat(resolveClassName("".concat(theme))), true)
  }, [__WEBPACK_EXTERNAL_MODULE_vue_createVNode__("div", {
    "style": titleStyle,
    "class": "inner-text"
  }, [showDefault()])])]), showDefault(false)]);
};
/* harmony default export */ const line = (Line);
;// ../../packages/progress/src/progress.tsx


function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
/*
 * Tencent is pleased to support the open source community by making
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
 *
 * Copyright (C) 2025 Tencent.  All rights reserved.
 *
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
 *
 * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
 *
 * ---------------------------------------------------
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
 * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
 * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
 * the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
 * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */





function _isSlot(s) {
  return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !__WEBPACK_EXTERNAL_MODULE_vue_isVNode__(s);
}
var progressType = {
  extCls: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string,
  type: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_ProgressType__(),
  percent: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number.def(0),
  theme: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.theme().def(__WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_ThemeEnum__.PRIMARY),
  size: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.size(),
  width: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number.def(126),
  strokeWidth: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number,
  strokeLinecap: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_ProgressStrokeLineCapType__(),
  textInside: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.bool.def(false),
  showText: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.bool.def(true),
  color: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string,
  bgColor: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string,
  fixed: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number.validate(function (value) {
    return value >= 0 && value <= 20;
  }).def(0),
  format: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.func.def(function (percent) {
    return "".concat(percent, "%");
  }),
  titleStyle: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.object.def({
    fontSize: '16px',
    verticalAlign: 'middle'
  })
};
/* harmony default export */ const progress = (__WEBPACK_EXTERNAL_MODULE_vue_defineComponent__({
  name: 'Progress',
  props: progressType,
  setup: function setup() {
    var _usePrefix = __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3_usePrefix__(),
      resolveClassName = _usePrefix.resolveClassName;
    return {
      resolveClassName: resolveClassName
    };
  },
  methods: {
    /** 验证进度值 */validPercent: function validPercent(percent) {
      if (!percent || percent < 0) {
        return 0;
      }
      if (percent > 100) {
        return 100;
      }
      return percent;
    },
    /** text 区域展示内容*/renderProcessInfo: function renderProcessInfo() {
      var _this$validPercent;
      var _this$$props = this.$props,
        showText = _this$$props.showText,
        format = _this$$props.format,
        percent = _this$$props.percent,
        textInside = _this$$props.textInside,
        titleStyle = _this$$props.titleStyle,
        fixed = _this$$props.fixed;
      var formatPercent = format((_this$validPercent = this.validPercent(percent)) === null || _this$validPercent === void 0 ? void 0 : _this$validPercent.toFixed(fixed));
      if ((showText || this.$slots["default"]) && textInside) {
        return this.$slots["default"] ? this.$slots["default"]() : __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("span", null, [formatPercent]);
      }
      if (!showText || textInside) return null;
      return __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("span", {
        "style": typeof formatPercent === 'string' ? titleStyle : undefined,
        "class": "progress-text"
      }, [this.$slots["default"] ? this.$slots["default"]() : formatPercent]);
    }
  },
  render: function render() {
    var progressInfo = this.renderProcessInfo();
    var $props = _objectSpread(_objectSpread({}, this.$props), {}, {
      percent: this.validPercent(this.percent)
    });
    var progress = __WEBPACK_EXTERNAL_MODULE_vue_createVNode__(line, $props, _isSlot(progressInfo) ? progressInfo : {
      "default": function _default() {
        return [progressInfo];
      }
    });
    if (this.type === 'circle' || this.type === 'dashboard') {
      progress = __WEBPACK_EXTERNAL_MODULE_vue_createVNode__(circle, $props, _isSlot(progressInfo) ? progressInfo : {
        "default": function _default() {
          return [progressInfo];
        }
      });
    }
    var progressProps = {
      "class": __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_classes__({
        extCls: !!this.extCls
      }, "".concat(this.resolveClassName('progress'), " ").concat(this.resolveClassName("progress-".concat(this.type))))
    };
    return __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("div", progressProps, [progress]);
  }
}));
;// ../../packages/progress/src/index.ts
/*
 * Tencent is pleased to support the open source community by making
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
 *
 * Copyright (C) 2025 Tencent.  All rights reserved.
 *
 * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
 *
 * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
 *
 * ---------------------------------------------------
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
 * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
 * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
 * the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
 * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */


var BkProgress = __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_withInstall__(progress);
/* harmony default export */ const src = (BkProgress);
export { src as default };
