var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/ai-assistant/index.tsx
var ai_assistant_exports = {};
__export(ai_assistant_exports, {
  default: () => ai_assistant_default
});
module.exports = __toCommonJS(ai_assistant_exports);
var import_react = __toESM(require("react"));
var import_icons = require("@ant-design/icons");
var import_classnames = __toESM(require("classnames"));
var import_dragger = __toESM(require("../dragger"));
var import_iconfont = __toESM(require("../iconfont"));
var import_index = require("./index.less");
var AIAssistant = ({
  modalTitle = "智能助手",
  open: visible = false,
  hideFullIcon,
  full: defaultFull,
  children,
  trigger,
  limit = { top: 0 },
  className,
  style = {},
  onOpenChange
}) => {
  const [open, setOpen] = (0, import_react.useState)(visible);
  const [full, setFull] = (0, import_react.useState)(defaultFull);
  const [disabled, setDisabled] = (0, import_react.useState)(true);
  const isLoaded = (0, import_react.useRef)(visible);
  (0, import_react.useEffect)(() => {
    visible && (isLoaded.current = true);
    setOpen(visible);
  }, [visible]);
  (0, import_react.useEffect)(() => {
    setFull(defaultFull);
  }, [defaultFull]);
  const onOpen = (open2) => {
    open2 && (isLoaded.current = true);
    setOpen(open2);
    onOpenChange == null ? void 0 : onOpenChange(open2);
  };
  const triggerDom = typeof trigger === "function" ? trigger(open) : trigger;
  const childrenDom = typeof children === "function" ? children(open) : children;
  return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement("div", { className: "u-ehr-assistant", style: { display: open ? "block" : "none" } }, full && /* @__PURE__ */ import_react.default.createElement("div", { className: "assistant-masker" }), /* @__PURE__ */ import_react.default.createElement(import_dragger.default, { disabled: disabled || full, limit }, /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)("assistant-dialog", className, { full }), style }, /* @__PURE__ */ import_react.default.createElement("div", { className: "header" }, /* @__PURE__ */ import_react.default.createElement(
    "div",
    {
      className: "title",
      onMouseOver: () => {
        setDisabled(false);
      },
      onMouseOut: () => {
        setDisabled(true);
      }
    },
    modalTitle
  ), /* @__PURE__ */ import_react.default.createElement("div", { className: "icon-wraps" }, !hideFullIcon && (full ? /* @__PURE__ */ import_react.default.createElement(import_iconfont.default, { type: "icon-ehr-ui-chuangkousuoxiao", onClick: () => setFull(false) }) : /* @__PURE__ */ import_react.default.createElement(import_iconfont.default, { type: "icon-ehr-ui-chuangkoufangda", onClick: () => setFull(true) })), /* @__PURE__ */ import_react.default.createElement(import_icons.CloseOutlined, { onClick: () => onOpen(false) }))), isLoaded.current && /* @__PURE__ */ import_react.default.createElement("div", { className: "content" }, childrenDom)))), triggerDom && (0, import_react.cloneElement)(triggerDom, {
    style: { ...triggerDom.props.style, cursor: "pointer" },
    onClick: (e) => {
      var _a, _b;
      onOpen(true);
      (_b = (_a = triggerDom.props).onClick) == null ? void 0 : _b.call(_a, e);
    }
  }));
};
var ai_assistant_default = AIAssistant;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {});
