import "../styles/reset.css";
import "./rate.less";
import { PropTypes as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__, classes as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_classes__, useFormItem as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_useFormItem__, withInstall as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_withInstall__ } from "../shared";
import { computed as __WEBPACK_EXTERNAL_MODULE_vue_computed__, createVNode as __WEBPACK_EXTERNAL_MODULE_vue_createVNode__, defineComponent as __WEBPACK_EXTERNAL_MODULE_vue_defineComponent__, mergeProps as __WEBPACK_EXTERNAL_MODULE_vue_mergeProps__, nextTick as __WEBPACK_EXTERNAL_MODULE_vue_nextTick__, ref as __WEBPACK_EXTERNAL_MODULE_vue_ref__, watch as __WEBPACK_EXTERNAL_MODULE_vue_watch__ } 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/rate/src/star.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.
 */



/* harmony default export */ const star = (__WEBPACK_EXTERNAL_MODULE_vue_defineComponent__({
  name: 'Star',
  props: {
    rate: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number.def(0),
    width: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number.def(16),
    height: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number.def(16),
    editable: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.bool.def(true),
    hoverRate: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number.def(0),
    max: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number.def(5)
  },
  emits: ['chooseRate', 'changeHover'],
  setup: function setup(props, _ref) {
    var emit = _ref.emit;
    var chooseRate = function chooseRate(index) {
      if (!props.editable) return;
      var rate = index + 1;
      emit('chooseRate', rate);
    };
    var changeHover = function changeHover(index, e) {
      if (!props.editable) return;
      var rate = index + 1;
      emit('changeHover', rate);
      __WEBPACK_EXTERNAL_MODULE_vue_nextTick__(function () {
        e.target.classList.add(resolveClassName('is-hover'));
      });
    };
    var handleMouseLeave = function handleMouseLeave(e) {
      if (!props.editable) return;
      __WEBPACK_EXTERNAL_MODULE_vue_nextTick__(function () {
        e.target.classList.remove(resolveClassName('is-hover'));
      });
    };
    var _usePrefix = __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3_usePrefix__(),
      resolveClassName = _usePrefix.resolveClassName;
    var starClass = function starClass(index) {
      return __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_classes__(_defineProperty(_defineProperty(_defineProperty({}, "".concat(resolveClassName('is-select')), index < Math.floor(displayRate.value)), "".concat(resolveClassName('is-edit')), props.editable), "".concat(resolveClassName('rate-star')), true));
    };
    var displayRate = __WEBPACK_EXTERNAL_MODULE_vue_computed__(function () {
      return props.hoverRate || props.rate;
    });
    var starStyle = {
      width: "".concat(props.width, "px"),
      height: "".concat(props.height, "px"),
      minWidth: "".concat(props.width, "px")
    };
    return function () {
      return __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("p", {
        "class": "".concat(resolveClassName('rate-stars'))
      }, [Array(props.max).fill(1).map(function (_, index) {
        return __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("svg", {
          "style": starStyle,
          "class": starClass(index),
          "viewBox": "0 0 64 64",
          "x": "0px",
          "y": "0px",
          "onClick": function onClick() {
            return chooseRate(index);
          },
          "onMouseenter": function onMouseenter(e) {
            return changeHover(index, e);
          },
          "onMouseleave": function onMouseleave(e) {
            return handleMouseLeave(e);
          }
        }, [__WEBPACK_EXTERNAL_MODULE_vue_createVNode__("g", {
          "transform": "translate(-143.000000, -635.000000)"
        }, [__WEBPACK_EXTERNAL_MODULE_vue_createVNode__("g", {
          "transform": "translate(83.000000, 114.000000)"
        }, [__WEBPACK_EXTERNAL_MODULE_vue_createVNode__("g", {
          "transform": "translate(15.000000, 384.000000)"
        }, [__WEBPACK_EXTERNAL_MODULE_vue_createVNode__("g", {
          "transform": "translate(29.000000, 137.000000)"
        }, [__WEBPACK_EXTERNAL_MODULE_vue_createVNode__("polygon", {
          "class": "st1",
          "points": "48,53 28.2,63.9 32,40.8 16,24.4 38.1,21 48,-0.1 57.8,21 79.9,24.4 63.9,40.8 67.7,63.9"
        }, null)])])])])]);
      })]);
    };
  }
}));
;// ../../packages/rate/src/rate.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.
 */




/* harmony default export */ const rate = (__WEBPACK_EXTERNAL_MODULE_vue_defineComponent__({
  name: 'Rate',
  components: {
    star: star
  },
  props: {
    modelValue: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.number.def(0),
    size: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.size(),
    editable: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.bool.def(true),
    withValidate: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.bool.def(true)
  },
  emits: ['change', 'hover-change', 'update:modelValue'],
  setup: function setup(props, _ref) {
    var emit = _ref.emit;
    var _usePrefix = __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3_usePrefix__(),
      resolveClassName = _usePrefix.resolveClassName;
    var formItem = __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_useFormItem__();
    var hoverRate = __WEBPACK_EXTERNAL_MODULE_vue_ref__(0);
    var chooseRate = function chooseRate(val) {
      if (!props.editable) return;
      emit('update:modelValue', val);
      emit('change', val);
    };
    var changeHover = function changeHover(val) {
      hoverRate.value = val;
      emit('hover-change', val);
    };
    var rateClass = __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_classes__(_defineProperty({}, "".concat(resolveClassName('rate')), true));
    var sizeMap = {
      small: {
        width: 12,
        height: 12
      },
      large: {
        width: 18,
        height: 18
      },
      huge: {
        width: 24,
        height: 24
      }
    };
    var rateSize = sizeMap[props.size] || {
      width: 16,
      height: 16
    };
    var starStyle = __WEBPACK_EXTERNAL_MODULE_vue_computed__(function () {
      var integer = Math.floor(props.modelValue);
      var fixWidth = (rateSize.width + 3) * integer;
      var rateWidth = rateSize.width * (props.modelValue - integer);
      return {
        width: "".concat(fixWidth + rateWidth, "px")
      };
    });
    var commonAttrs = {
      width: rateSize.width,
      height: rateSize.height
    };
    __WEBPACK_EXTERNAL_MODULE_vue_watch__(function () {
      return props.modelValue;
    }, function () {
      if (props.withValidate) {
        var _formItem$validate;
        formItem === null || formItem === void 0 || (_formItem$validate = formItem.validate) === null || _formItem$validate === void 0 || _formItem$validate.call(formItem, 'change');
      }
    });
    return function () {
      return __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("p", {
        "class": rateClass
      }, [props.editable ? __WEBPACK_EXTERNAL_MODULE_vue_createVNode__(star, __WEBPACK_EXTERNAL_MODULE_vue_mergeProps__({
        "hover-rate": hoverRate.value,
        "rate": props.modelValue,
        "onChangeHover": changeHover,
        "onChooseRate": chooseRate,
        "onMouseleave": function onMouseleave() {
          return changeHover(0);
        }
      }, commonAttrs), null) : [__WEBPACK_EXTERNAL_MODULE_vue_createVNode__(star, __WEBPACK_EXTERNAL_MODULE_vue_mergeProps__({
        "style": starStyle.value,
        "class": "".concat(resolveClassName('score-real')),
        "editable": false,
        "rate": 5
      }, commonAttrs), null), __WEBPACK_EXTERNAL_MODULE_vue_createVNode__(star, __WEBPACK_EXTERNAL_MODULE_vue_mergeProps__({
        "editable": false,
        "rate": 0
      }, commonAttrs), null)]]);
    };
  }
}));
;// ../../packages/rate/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 BkRate = __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_withInstall__(rate);
/* harmony default export */ const src = (BkRate);
export { src as default };
