import "../styles/reset.css";
import "./card.less";
import { PropTypes as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__, 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__, ref as __WEBPACK_EXTERNAL_MODULE_vue_ref__, vShow as __WEBPACK_EXTERNAL_MODULE_vue_vShow__, watch as __WEBPACK_EXTERNAL_MODULE_vue_watch__, withDirectives as __WEBPACK_EXTERNAL_MODULE_vue_withDirectives__ } from "vue";
import { default as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_collapse_transition_3d6ae990_default__ } from "../collapse-transition";
import { usePrefix as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3_usePrefix__ } from "../config-provider";
import { AngleDown as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3_AngleDown__, AngleRight as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3_AngleRight__, EditLine as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3_EditLine__ } from "../icon";
import { default as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_input_d525237e_default__ } from "../input";
import "../input/input.less";

;// 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 "../collapse-transition"

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

;// external "../icon"

;// external "../input"

;// external "../input/input.less"

;// ../../packages/card/src/card.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 card = (__WEBPACK_EXTERNAL_MODULE_vue_defineComponent__({
  name: 'Card',
  props: {
    title: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string,
    showHeader: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.bool.def(true),
    showFooter: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.bool.def(false),
    collapseStatus: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.bool.def(true),
    border: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.bool.def(true),
    disableHeaderStyle: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.bool.def(false),
    position: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.string.def('left'),
    isEdit: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.bool.def(false),
    isCollapse: __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_PropTypes__.bool.def(false)
  },
  emits: ['update:collapseStatus', 'edit'],
  setup: function setup(props, _ref) {
    var emit = _ref.emit;
    /** 展开&收起的状态 */
    var collapseActive = __WEBPACK_EXTERNAL_MODULE_vue_ref__(true);
    /** 是否显示编辑框 */
    var showInput = __WEBPACK_EXTERNAL_MODULE_vue_ref__(false);
    var renderTitle = __WEBPACK_EXTERNAL_MODULE_vue_ref__('');
    var handleCollapse = function handleCollapse() {
      if (!props.isCollapse) {
        return;
      }
      collapseActive.value = !collapseActive.value;
      emit('update:collapseStatus', collapseActive.value);
    };
    /** 点击编辑按钮 */
    var clickEdit = function clickEdit() {
      showInput.value = !showInput.value;
    };
    /** 保存编辑的title */
    var saveEdit = function saveEdit() {
      showInput.value = !showInput.value;
      emit('edit', renderTitle);
    };
    __WEBPACK_EXTERNAL_MODULE_vue_watch__(function () {
      return props.collapseStatus;
    }, function (val) {
      props.isCollapse && (collapseActive.value = val);
    }, {
      immediate: true
    });
    __WEBPACK_EXTERNAL_MODULE_vue_watch__(function () {
      return props.title;
    }, function (val) {
      renderTitle.value = val;
    }, {
      immediate: true
    });
    var _usePrefix = __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3_usePrefix__(),
      resolveClassName = _usePrefix.resolveClassName;
    var wrapperClsName = resolveClassName('card');
    return {
      collapseActive: collapseActive,
      showInput: showInput,
      renderTitle: renderTitle,
      handleCollapse: handleCollapse,
      saveEdit: saveEdit,
      clickEdit: clickEdit,
      wrapperClsName: wrapperClsName
    };
  },
  render: function render() {
    var _this = this,
      _this$$slots$icon,
      _this$$slots$icon2,
      _this$$slots,
      _this$$slots$header,
      _this$$slots$header2,
      _this$$slots2,
      _this$$slots$default,
      _this$$slots$default2,
      _this$$slots3,
      _this$$slots$footer,
      _this$$slots$footer2,
      _this$$slots4;
    var cardClass = __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_classes__(_defineProperty(_defineProperty({}, "".concat(this.wrapperClsName), true), "".concat(this.wrapperClsName, "-border-none"), !this.$props.border), '');
    var headClass = __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_classes__(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(this.wrapperClsName, "-head"), true), "".concat(this.wrapperClsName, "-head-").concat(this.$props.position), this.$props.isCollapse && this.$props.position), 'no-line-height', this.$props.disableHeaderStyle), 'collapse', !this.collapseActive), '');
    var defaultHeader = __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("div", {
      "class": "title",
      "title": this.renderTitle
    }, [this.showInput ? __WEBPACK_EXTERNAL_MODULE_vue_createVNode__(__WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_input_d525237e_default__, {
      "class": "".concat(this.wrapperClsName, "-input"),
      "modelValue": _this.renderTitle,
      "onUpdate:modelValue": function onUpdateModelValue($event) {
        return _this.renderTitle = $event;
      },
      "onBlur": this.saveEdit
    }, null) : this.renderTitle]);
    var defaultIcon = __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("span", {
      "class": "".concat(this.wrapperClsName, "-icon"),
      "onClick": this.handleCollapse
    }, [this.collapseActive ? __WEBPACK_EXTERNAL_MODULE_vue_createVNode__(__WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3_AngleDown__, null, null) : __WEBPACK_EXTERNAL_MODULE_vue_createVNode__(__WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3_AngleRight__, null, null)]);
    return __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("div", {
      "class": cardClass
    }, [this.$props.showHeader ? __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("div", {
      "class": headClass
    }, [this.$props.isCollapse && ((_this$$slots$icon = (_this$$slots$icon2 = (_this$$slots = this.$slots).icon) === null || _this$$slots$icon2 === void 0 ? void 0 : _this$$slots$icon2.call(_this$$slots)) !== null && _this$$slots$icon !== void 0 ? _this$$slots$icon : defaultIcon), (_this$$slots$header = (_this$$slots$header2 = (_this$$slots2 = this.$slots).header) === null || _this$$slots$header2 === void 0 ? void 0 : _this$$slots$header2.call(_this$$slots2)) !== null && _this$$slots$header !== void 0 ? _this$$slots$header : defaultHeader, this.$props.isEdit && !this.showInput && __WEBPACK_EXTERNAL_MODULE_vue_createVNode__(__WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_icon_a97c79c3_EditLine__, {
      "class": "".concat(this.wrapperClsName, "-edit"),
      "onClick": this.clickEdit
    }, null)]) : '', __WEBPACK_EXTERNAL_MODULE_vue_createVNode__(__WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_collapse_transition_3d6ae990_default__, null, {
      "default": function _default() {
        return [__WEBPACK_EXTERNAL_MODULE_vue_withDirectives__(__WEBPACK_EXTERNAL_MODULE_vue_createVNode__("div", null, [__WEBPACK_EXTERNAL_MODULE_vue_createVNode__("div", {
          "class": "".concat(_this.wrapperClsName, "-body")
        }, [(_this$$slots$default = (_this$$slots$default2 = (_this$$slots3 = _this.$slots)["default"]) === null || _this$$slots$default2 === void 0 ? void 0 : _this$$slots$default2.call(_this$$slots3)) !== null && _this$$slots$default !== void 0 ? _this$$slots$default : 'Content']), _this.$props.showFooter ? __WEBPACK_EXTERNAL_MODULE_vue_createVNode__("div", {
          "class": "".concat(_this.wrapperClsName, "-footer")
        }, [(_this$$slots$footer = (_this$$slots$footer2 = (_this$$slots4 = _this.$slots).footer) === null || _this$$slots$footer2 === void 0 ? void 0 : _this$$slots$footer2.call(_this$$slots4)) !== null && _this$$slots$footer !== void 0 ? _this$$slots$footer : 'Footer']) : '']), [[__WEBPACK_EXTERNAL_MODULE_vue_vShow__, _this.collapseActive]])];
      }
    })]);
  }
}));
;// ../../packages/card/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 BkCard = __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03_withInstall__(card);
/* harmony default export */ const src = (BkCard);
export { src as default };
