bi-components-library 1.0.26 → 1.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,12 +1,12 @@
1
- (function(X,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("react/jsx-runtime"),require("react"),require("antd"),require("@ant-design/icons"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","antd","@ant-design/icons","react-dom"],n):(X=typeof globalThis<"u"?globalThis:X||self,n(X.SealSeekBIComponents={},X.React,X.React,X.antd,X.AntdIcons,X.ReactDOM))})(this,function(X,n,l,W,de,Qe){"use strict";const Le=({variant:t="primary",loading:v=!1,children:u,...i})=>{const d=E=>{switch(E){case"primary":return"primary";case"ghost":return"default";case"dashed":return"dashed";case"link":return"link";case"text":return"text";default:return"primary"}};return n.jsx(W.Button,{...i,type:d(t),loading:v,ghost:t==="ghost",children:u})};Le.__docgenInfo={displayName:"Button",description:"基础按钮,用于触发操作",props:{variant:{name:"variant",required:!1,description:"视觉风格",type:{name:"ButtonVariant",raw:'"primary" | "ghost" | "dashed" | "link" | "text"'},defaultValue:{value:'"primary"'}},loading:{name:"loading",required:!1,description:"是否加载中",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},children:{name:"children",required:!1,description:"按钮内容",type:{name:"ReactNode",raw:"React.ReactNode"}},size:{name:"size",required:!1,description:"按钮大小",type:{name:"ButtonSize",raw:'"small" | "middle" | "large"'}},disabled:{name:"disabled",required:!1,description:"是否禁用",type:{name:"boolean",raw:"boolean"}},onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"(event: MouseEvent) => void"}}}};const Be=({title:t,children:v,bordered:u=!0,hoverable:i=!1,size:d="default",...E})=>n.jsx(W.Card,{...E,title:t,bordered:u,hoverable:i,size:d,children:v});Be.__docgenInfo={displayName:"Card",description:"卡片容器,用于分组内容",props:{title:{name:"title",required:!1,description:"标题",type:{name:"ReactNode",raw:"React.ReactNode"}},children:{name:"children",required:!1,description:"内容区域",type:{name:"ReactNode",raw:"React.ReactNode"}},bordered:{name:"bordered",required:!1,description:"是否显示边框",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},hoverable:{name:"hoverable",required:!1,description:"是否可悬停",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},size:{name:"size",required:!1,description:"卡片大小",type:{name:"CardSize",raw:'"default" | "small"'},defaultValue:{value:'"default"'}},loading:{name:"loading",required:!1,description:"是否加载中",type:{name:"boolean",raw:"boolean"}},actions:{name:"actions",required:!1,description:"卡片操作组",type:{name:"ReactNode[]",raw:"React.ReactNode[]"}}}};const Ve=({showDefaultFooter:t=!0,...v})=>{const u=v.footer!==void 0?v.footer:t?(i,{OkBtn:d,CancelBtn:E})=>n.jsxs(n.Fragment,{children:[n.jsx(d,{}),n.jsx(E,{})]}):null;return n.jsx(W.Modal,{...v,footer:u})};Ve.__docgenInfo={displayName:"AppModal",description:"应用级模态框组件,基于 Ant Design Modal 封装",props:{showDefaultFooter:{name:"showDefaultFooter",required:!1,description:"是否显示默认的确定和取消按钮",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},title:{name:"title",required:!1,description:"模态框标题",type:{name:"ReactNode",raw:"React.ReactNode"}},open:{name:"open",required:!1,description:"是否显示模态框",type:{name:"boolean",raw:"boolean"}},onCancel:{name:"onCancel",required:!1,description:"取消按钮点击事件",type:{name:"function",raw:"(e: React.MouseEvent<HTMLElement>) => void"}},onOk:{name:"onOk",required:!1,description:"确定按钮点击事件",type:{name:"function",raw:"(e: React.MouseEvent<HTMLElement>) => void"}},children:{name:"children",required:!1,description:"模态框内容",type:{name:"ReactNode",raw:"React.ReactNode"}},width:{name:"width",required:!1,description:"模态框宽度",type:{name:"string | number",raw:"string | number"}},centered:{name:"centered",required:!1,description:"是否居中显示",type:{name:"boolean",raw:"boolean"}},maskClosable:{name:"maskClosable",required:!1,description:"点击蒙层是否允许关闭",type:{name:"boolean",raw:"boolean"}}}};const _e=({scrollX:t,showPagination:v=!0,defaultPageSize:u=10,...i})=>n.jsx(W.Table,{...i,scroll:{x:t||"max-content",y:"50vh"},pagination:v?{hideOnSinglePage:!0,showSizeChanger:!0,showQuickJumper:!0,defaultPageSize:u,...i.pagination}:!1});_e.__docgenInfo={displayName:"PageTable",description:"页面级表格组件,高度铺满容器,自动滚动",props:{scrollX:{name:"scrollX",required:!1,description:"水平滚动宽度",type:{name:"number",raw:"number"}},showPagination:{name:"showPagination",required:!1,description:"是否显示分页器",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},defaultPageSize:{name:"defaultPageSize",required:!1,description:"默认页面大小",type:{name:"number",raw:"number"},defaultValue:{value:"10"}},columns:{name:"columns",required:!1,description:"表格列配置",type:{name:"ColumnType[]",raw:"ColumnType<any>[]"}},dataSource:{name:"dataSource",required:!1,description:"数据源",type:{name:"any[]",raw:"any[]"}},loading:{name:"loading",required:!1,description:"是否加载中",type:{name:"boolean",raw:"boolean"}},rowKey:{name:"rowKey",required:!1,description:"行数据的 Key",type:{name:"string | function",raw:"string | ((record: any) => string)"}}}};const Re=de.createFromIconfontCN({scriptUrl:["https://at.alicdn.com/t/c/font_4968458_eh91gfr4j9e.js"]}),De=({name:t,size:v,color:u,style:i,...d})=>{const E={fontSize:v,color:u,...i};return n.jsx(Re,{...d,type:t,style:E})};De.__docgenInfo={displayName:"XcIcon",description:"自定义图标组件,基于 iconfont",props:{name:{name:"name",required:!0,description:"图标名称",type:{name:"string",raw:"string"}},size:{name:"size",required:!1,description:"图标大小",type:{name:"number | string",raw:"number | string"}},color:{name:"color",required:!1,description:"图标颜色",type:{name:"string",raw:"string"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},style:{name:"style",required:!1,description:"自定义样式",type:{name:"CSSProperties",raw:"React.CSSProperties"}}}};const Pe=({loading:t,description:v="暂无数据",className:u,emptyChildren:i,loadingText:d,emptyImage:E})=>t?n.jsxs(W.Flex,{className:`pt-10 w-full ${u||""}`,align:"center",justify:"center",vertical:!0,children:[n.jsx(W.Spin,{size:"large"}),d&&n.jsx("div",{className:"mt-4 text-gray-500",children:d})]}):n.jsx(W.Flex,{className:`pt-10 w-full ${u||""}`,align:"center",justify:"center",children:n.jsx(W.Empty,{image:E,description:v,imageStyle:{height:180},children:i})});Pe.__docgenInfo={displayName:"EmptyAndSpin",description:"空状态和加载状态组合组件",props:{loading:{name:"loading",required:!0,description:"是否加载中",type:{name:"boolean",raw:"boolean"}},description:{name:"description",required:!1,description:"空状态描述",type:{name:"ReactNode",raw:"React.ReactNode"},defaultValue:{value:'"暂无数据"'}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},emptyChildren:{name:"emptyChildren",required:!1,description:"空状态额外内容",type:{name:"ReactNode",raw:"React.ReactNode"}},loadingText:{name:"loadingText",required:!1,description:"加载中提示文字",type:{name:"string",raw:"string"}},emptyImage:{name:"emptyImage",required:!1,description:"空状态图片",type:{name:"string",raw:"string"}}}};const Ge=({onClick:t,showText:v=!1,className:u,size:i="small",type:d="default"})=>n.jsx(W.Button,{size:i,type:d,icon:n.jsx(de.LeftOutlined,{}),className:`cursor-pointer ${u||""}`,onClick:t,children:v&&"返回"});Ge.__docgenInfo={displayName:"BackButton",description:"返回按钮组件",props:{onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"() => void"}},showText:{name:"showText",required:!1,description:"是否显示文字",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},size:{name:"size",required:!1,description:"按钮大小",type:{name:"ButtonSize",raw:'"small" | "middle" | "large"'},defaultValue:{value:'"small"'}},type:{name:"type",required:!1,description:"按钮类型",type:{name:"ButtonType",raw:'"primary" | "default" | "dashed" | "link" | "text"'},defaultValue:{value:'"default"'}}}};const Me=({removePadding:t=!0,className:v,...u})=>{const i=t?`px-0 h-auto ${v||""}`:v;return n.jsx(W.Button,{type:"link",...u,className:i,children:u.children})};Me.__docgenInfo={displayName:"LinkButton",description:"链接样式按钮组件,适用于表格操作列",props:{removePadding:{name:"removePadding",required:!1,description:"是否去除默认内边距",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},children:{name:"children",required:!1,description:"按钮内容",type:{name:"ReactNode",raw:"React.ReactNode"}},onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"(event: React.MouseEvent<HTMLButtonElement>) => void"}},disabled:{name:"disabled",required:!1,description:"是否禁用",type:{name:"boolean",raw:"boolean"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}}}};const{Option:Ye}=W.Select,He=({columns:t,request:v,searchFields:u=[],showSearch:i=!0,showRefresh:d=!0,defaultPageSize:E=10,pageSizeOptions:V=["10","20","50","100"],autoLoad:C=!0,externalParams:a={},...e})=>{const[r,s]=l.useState([]),[B,m]=l.useState(!1),[o,A]=l.useState({current:1,pageSize:E,total:0}),[c,g]=l.useState({}),[y,x]=l.useState({}),[h]=W.Form.useForm(),D=l.useRef(o);D.current=o;const $=l.useRef(a);$.current=a;const P=l.useRef(!1),F=l.useMemo(()=>t.map(S=>{const{sortable:H,render:ee,...ne}=S;return{...ne,sorter:H?!0:void 0,render:ee||(se=>se)}}),[t]),M=l.useCallback(async(S={})=>{if(v){m(!0);try{const H={page:D.current.current,pageSize:D.current.pageSize,sortField:y.field,sortOrder:y.order,searchParams:{...c,...$.current},...S},ee=await v(H);ee.success&&(s(ee.data),A(ne=>({...ne,total:ee.total,current:H.page||ne.current})))}catch(H){console.error("加载数据失败:",H)}finally{m(!1)}}},[v,y,c]),K=l.useCallback(S=>{g(S),A(H=>({...H,current:1}))},[]),J=l.useCallback(()=>{h.resetFields(),g({}),A(S=>({...S,current:1}))},[h]),Q=l.useCallback(()=>{M()},[M]),Z=l.useCallback((S,H,ee)=>{const ne={current:S.current||1,pageSize:S.pageSize||E,total:S.total||0},se={field:ee?.field,order:ee?.order};A(ne),x(se)},[E]);return l.useEffect(()=>{const S=Object.keys(a).length>0;(C&&!P.current||S)&&(M(),P.current=!0)},[C,a,M]),n.jsxs("div",{children:[i&&u.length>0&&n.jsx(W.Card,{size:"small",style:{marginBottom:16},children:n.jsxs(W.Form,{form:h,layout:"inline",onFinish:K,initialValues:u.reduce((S,H)=>(H.defaultValue!==void 0&&(S[H.key]=H.defaultValue),S),{}),children:[u.map(S=>n.jsx(W.Form.Item,{name:S.key,label:S.label,children:S.type==="input"?n.jsx(W.Input,{placeholder:S.placeholder||`请输入${S.label}`,style:{width:200}}):n.jsx(W.Select,{placeholder:S.placeholder||`请选择${S.label}`,style:{width:200},allowClear:!0,children:S.options?.map(H=>n.jsx(Ye,{value:H.value,children:H.label},H.value))})},S.key)),n.jsx(W.Form.Item,{children:n.jsxs(W.Space,{children:[n.jsx(W.Button,{type:"primary",htmlType:"submit",icon:n.jsx(de.SearchOutlined,{}),children:"查询"}),n.jsx(W.Button,{onClick:J,children:"重置"}),d&&n.jsx(W.Button,{icon:n.jsx(de.ReloadOutlined,{}),onClick:Q,children:"刷新"})]})})]})}),n.jsx(W.Table,{...e,columns:F,dataSource:r,loading:B,pagination:{...o,showSizeChanger:!0,showQuickJumper:!0,showTotal:(S,H)=>`第 ${H[0]}-${H[1]} 条/共 ${S} 条`,pageSizeOptions:V},onChange:Z,scroll:{x:"max-content",y:"50vh"}})]})};He.__docgenInfo={displayName:"AdvancedTable",description:"高阶表格组件,支持异步请求、搜索、排序等功能",props:{columns:{name:"columns",required:!0,description:"列配置",type:{name:"AdvancedColumnType[]",raw:"AdvancedColumnType<any>[]"}},request:{name:"request",required:!1,description:"异步请求函数",type:{name:"function",raw:"(params: RequestParams) => Promise<RequestResponse>"}},searchFields:{name:"searchFields",required:!1,description:"搜索字段配置",type:{name:"SearchFieldConfig[]",raw:"SearchFieldConfig[]"},defaultValue:{value:"[]"}},showSearch:{name:"showSearch",required:!1,description:"是否显示搜索区域",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},showRefresh:{name:"showRefresh",required:!1,description:"是否显示刷新按钮",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},defaultPageSize:{name:"defaultPageSize",required:!1,description:"默认页面大小",type:{name:"number",raw:"number"},defaultValue:{value:"10"}},pageSizeOptions:{name:"pageSizeOptions",required:!1,description:"页面大小选项",type:{name:"string[]",raw:"string[]"},defaultValue:{value:'["10", "20", "50", "100"]'}},autoLoad:{name:"autoLoad",required:!1,description:"是否自动加载",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},externalParams:{name:"externalParams",required:!1,description:"外部请求参数",type:{name:"Record<string, any>",raw:"Record<string, any>"},defaultValue:{value:"{}"}}}};function Ee(t,v,u){if(!t.current)return;const i=new Set,d={};for(const s of v)s.exclusionGroup&&s.exclusionGroup!=="separator"&&(i.add(s.exclusionGroup),d[s.exclusionGroup]||(d[s.exclusionGroup]=[]),d[s.exclusionGroup].push({type:s.type,key:s.key,exclusionGroup:s.exclusionGroup}));const E={};for(const s of i){E[s]=!1;for(const B of d[s])if(B.type==="upload"&&B.key){if(u[B.key]!==null&&u[B.key]!==void 0){E[s]=!0;break}}else if(B.type==="variable"&&B.key){const m=t.current.querySelector(`[data-type="variable"][data-key="${B.key}"]`);if(m&&m.innerText.replace(/[\u200B\n]/g,"").trim().length>0){E[s]=!0;break}}}const V=v.some(s=>s.exclusionGroup==="separator"),a=Object.keys(E).filter(s=>E[s]).length>0;let e=null;if(a&&V){for(const s of v)if(s.exclusionGroup&&s.exclusionGroup!=="separator"&&E[s.exclusionGroup]){e=s.exclusionGroup;break}}for(const s of i){const B=t.current.querySelectorAll(`[data-group="${s}"]`);V&&a&&e?s===e?B.forEach(m=>{m.classList.contains("required-upload-group")?m.style.setProperty("display","inline-flex","important"):(m.classList.contains("exclusion-wrapper"),m.style.setProperty("display","inline-block","important"))}):B.forEach(m=>{m.style.display="none",m.style.setProperty("display","none","important")}):B.forEach(m=>{m.classList.contains("required-upload-group")?m.style.setProperty("display","inline-flex","important"):(m.classList.contains("exclusion-wrapper"),m.style.setProperty("display","inline-block","important"))})}t.current.querySelectorAll('[data-group="separator"]').forEach(s=>{s.style.display=a?"none":"inline"})}function Ce(t,v,u,i){if(!t.current){i(!1);return}const d=[];for(let a=0;a<v.length;a++){const e=v[a];if((e.type==="variable"||e.type==="upload"||e.type==="multi-variable"||e.type==="select"||e.type==="textarea"||e.type==="richtext"||e.type==="datepicker")&&e.required&&e.key){d.push({exclusionGroup:e.exclusionGroup||"",key:e.key,type:e.type==="multi-variable"?"variable":e.type,isMultiVariable:e.type==="multi-variable",minCount:e.type==="multi-variable"?e.minCount:void 0});continue}if(e.type==="text"&&e.className?.includes("rte-text-required")&&e.exclusionGroup)for(let r=a+1;r<v.length;r++){const s=v[r];if(s.exclusionGroup===e.exclusionGroup&&(s.type==="variable"||s.type==="upload"||s.type==="select"||s.type==="textarea"||s.type==="richtext"||s.type==="datepicker")&&s.key){d.push({exclusionGroup:e.exclusionGroup,key:s.key,type:s.type});break}}}const E=v.some(a=>a.exclusionGroup==="separator");let V=!1;if(E&&d.length>1){const a=v.findIndex(s=>s.exclusionGroup==="separator"),e=d.filter(s=>v.findIndex(m=>(m.type==="variable"||m.type==="upload"||m.type==="select"||m.type==="textarea"||m.type==="richtext"||m.type==="datepicker")&&m.key===s.key&&m.exclusionGroup===s.exclusionGroup)<a),r=d.filter(s=>v.findIndex(m=>(m.type==="variable"||m.type==="upload"||m.type==="select"||m.type==="textarea"||m.type==="richtext")&&m.key===s.key&&m.exclusionGroup===s.exclusionGroup)>a);V=e.length>0&&r.length>0}if(d.length===0){if(v.length===0){if(!t.current){i(!1);return}const a=t.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";i(a.length>0);return}i(!0);return}const C=d.filter(a=>{if(!t.current)return!1;if(a.exclusionGroup){const e=t.current.querySelectorAll(`[data-group="${a.exclusionGroup}"]`);if(e.length>0)return e[0].style.display!=="none"}if(a.type==="upload"&&a.key){const e=t.current.querySelector(`[data-type="upload"][data-key="${a.key}"]`);if(e){const r=e.closest("[data-group]")||e.parentElement;return r?r.style.display!=="none":!0}}else if(a.type==="variable"&&a.key)if(a.isMultiVariable){const e=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${a.key}"]`);if(e.length>0){const r=e[0],s=r.closest("[data-group]")||r.parentElement;return s?s.style.display!=="none":!0}}else{const e=t.current.querySelector(`[data-type="variable"][data-key="${a.key}"]`);if(e){const r=e.closest("[data-group]")||e.parentElement;return r?r.style.display!=="none":!0}}else if(a.type==="select"&&a.key){const e=t.current.querySelector(`[data-type="select"][data-key="${a.key}"]`);if(e){const r=e.closest("[data-group]")||e.parentElement;return r?r.style.display!=="none":!0}}else if(a.type==="textarea"&&a.key){const e=t.current.querySelector(`[data-type="textarea"][data-key="${a.key}"]`);if(e){const r=e.closest("[data-group]")||e.parentElement;return r?r.style.display!=="none":!0}}else if(a.type==="richtext"&&a.key){const e=t.current.querySelector(`[data-type="richtext"][data-key="${a.key}"]`);if(e){const r=e.closest("[data-group]")||e.parentElement;return r?r.style.display!=="none":!0}}else if(a.type==="datepicker"&&a.key){const e=t.current.querySelector(`[data-type="datepicker"][data-key="${a.key}"]`);if(e){const r=e.closest("[data-group]")||e.parentElement;return r?r.style.display!=="none":!0}}return!1});if(C.length===0){i(!0);return}if(V){let a=!1;for(const e of C)if(e.type==="upload"&&e.key){if(u[e.key]!==null&&u[e.key]!==void 0){a=!0;break}}else if(e.type==="variable"&&e.key)if(e.isMultiVariable){const r=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${e.key}"]`);let s=0;for(const m of Array.from(r))m.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&(s+=1);const B=e.minCount&&e.minCount>0?e.minCount:1;if(s>=B){a=!0;break}}else{const r=t.current.querySelector(`[data-type="variable"][data-key="${e.key}"]`);if(r&&r.innerText.replace(/[\u200B\n]/g,"").trim().length>0){a=!0;break}}else if(e.type==="select"&&e.key){const r=t.current.querySelector(`[data-type="select"][data-key="${e.key}"]`);if(r&&(r.value||"").trim().length>0){a=!0;break}}else if(e.type==="textarea"&&e.key){const r=t.current.querySelector(`[data-type="textarea"][data-key="${e.key}"]`);if(r&&(r.value||"").trim().length>0){a=!0;break}}else if(e.type==="richtext"&&e.key){const r=t.current.querySelector(`[data-type="richtext"][data-key="${e.key}"]`);if(r&&(r.textContent||"").replace(/[\u200B]/g,"").trim().length>0){a=!0;break}}else if(e.type==="datepicker"&&e.key){const r=t.current.querySelector(`[data-type="datepicker"][data-key="${e.key}"]`);if(r&&(r.getAttribute("data-value")||"").trim().length>0){a=!0;break}}i(a)}else{let a=!0;for(const e of C)if(e.type==="upload"&&e.key){if(u[e.key]===null||u[e.key]===void 0){a=!1;break}}else if(e.type==="variable"&&e.key)if(e.isMultiVariable){const r=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${e.key}"]`);let s=0;for(const m of Array.from(r))m.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&(s+=1);const B=e.minCount&&e.minCount>0?e.minCount:1;if(s<B){a=!1;break}}else{const r=t.current.querySelector(`[data-type="variable"][data-key="${e.key}"]`);if(!r){a=!1;break}if(r.innerText.replace(/[\u200B\n]/g,"").trim().length===0){a=!1;break}}else if(e.type==="select"&&e.key){const r=t.current.querySelector(`[data-type="select"][data-key="${e.key}"]`);if(!r||(r.value||"").trim().length===0){a=!1;break}}else if(e.type==="textarea"&&e.key){const r=t.current.querySelector(`[data-type="textarea"][data-key="${e.key}"]`);if(!r||(r.value||"").trim().length===0){a=!1;break}}else if(e.type==="richtext"&&e.key){const r=t.current.querySelector(`[data-type="richtext"][data-key="${e.key}"]`);if(!r||(r.textContent||"").replace(/[\u200B]/g,"").trim().length===0){a=!1;break}}else if(e.type==="datepicker"&&e.key){const r=t.current.querySelector(`[data-type="datepicker"][data-key="${e.key}"]`);if(!r||(r.getAttribute("data-value")||"").trim().length===0){a=!1;break}}i(a)}}function qe(t,v){if(!t.current)return;t.current.querySelectorAll('[data-type="variable"]').forEach(i=>{const d=i.innerText.replace(/\n/g,"");d.replace(/\u200B/g,"")?i.classList.remove("show-placeholder"):(d!=="​"&&(i.innerText="​"),i.classList.add("show-placeholder"))})}function Ze(t,v,u,i,d,E={},V){if(!t.current)return;let C="",a=0;for(;a<v.length;){const e=v[a],r=a+1<v.length?v[a+1]:null;if(e.type==="text"&&(e.text?.includes("icon-bitian")||e.className==="rte-text-required")&&r){const c=r.type==="upload"&&r.exclusionGroup==="fileInput"&&e.exclusionGroup==="fileInput"&&e.exclusionGroup===r.exclusionGroup,g=r.type==="variable"&&r.exclusionGroup==="textInput"&&e.exclusionGroup==="textInput"&&e.exclusionGroup===r.exclusionGroup;if(c){const x=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group">`,h="</span>";let D="";e.className?D=`<span class="${e.className}">${e.text??""}</span>`:D=e.text??"";const $=r,P=u[$.key]!==null&&u[$.key]!==void 0,F=P?u[$.key]:null,M=P?u[$.key]?.name:$.text,K=P?"":"hidden",J=$.tooltip&&!P?"":"hidden",Q=P?"has-file":"",Z=P&&M?` data-file-name="${M.replace(/"/g,"&quot;")}"`:"";let S="";P&&F&&(F.type?.startsWith("image/")?S=`<img class="upload-icon-img upload-icon-preview" src="${URL.createObjectURL(F)}" alt="preview" />`:S="<i class='iconfont icon-exlwenjian'></i>");const H=`<span contenteditable="false" data-type="upload" data-key="${$.key}" class="upload-chip"><span class="upload-inner-wrapper ${Q}"><span class="upload-icon">${S}</span><span class="upload-label"${Z}>${M||$.text}</span>${$.tooltip?`<i contenteditable="false" class="iconfont icon-tishi upload-info-icon ${J}" data-upload-key="${$.key}" data-tooltip="${$.tooltip}" title="提示"></i>`:""}<span class="file-remove-btn ${K}" title="移除文件">×</span></span></span>`;C+=x+D+H+h,a+=2;continue}if(g){const x=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group">`,h="</span>";let D="";e.className?D=`<span class="${e.className}">${e.text??""}</span>`:D=e.text??"";const $=r,F=($.key?d[$.key]:void 0)||$.text||"",M=!F,K=M?"​":F,J=M?"show-placeholder":"",Q=$.exclusionGroup?` data-group="${$.exclusionGroup}"`:"",Z=$.tooltip?` data-tooltip="${$.tooltip.replace(/"/g,"&quot;")}" data-variable-key="${$.key||""}"`:"",S=$.tooltip&&M?"":"hidden",H=`<span contenteditable="true" data-type="variable" data-key="${$.key}" data-placeholder="${$.placeholder||""}"${Q}${Z} class="variable-chip ${J}">${K}${$.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${S}" data-variable-key="${$.key}" data-tooltip="${$.tooltip.replace(/"/g,"&quot;")}" title="提示"></i>`:""}</span>`;C+=x+D+H+h,a+=2;continue}}const B=e.exclusionGroup?`data-group="${e.exclusionGroup}"`:"",m=e.exclusionGroup?`<span ${B} class="exclusion-wrapper">`:"",o=e.exclusionGroup?"</span>":"";let A="";if(e.type==="tag"){const g=i||V==="hideTagClose"?"":'<span class="tag-close-btn" title="Clear (ESC)"><svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6L6 18M6 6l12 12"/></svg></span>',y=i?' data-locked="true"':"",x=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,"&quot;")}" data-tag-key="${e.key||""}"`:"";A=`<span contenteditable="false" class="tag-node group"${y}${x}><span class="tag-label">${e.text}</span>${g}</span>`}else if(e.type==="text"){const c=i?' data-locked="true" contenteditable="false"':' contenteditable="false"',y=(e.text??"").replace(/\n/g,"<br/>");e.className?A=`<span class="${e.className}"${c}>${y}</span>`:A=i?`<span${c}>${y}</span>`:`<span contenteditable="false">${y}</span>`}else if(e.type==="variable"&&e.key){const g=d[e.key]||e.text||"",y=!g,x=y?"​":g,h=y?"show-placeholder":"",D=e.exclusionGroup?` data-group="${e.exclusionGroup}"`:"",$=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,"&quot;")}" data-variable-key="${e.key||""}"`:"",P=e.tooltip&&y?"":"hidden",F=`<span contenteditable="true" data-type="variable" data-key="${e.key}" data-placeholder="${e.placeholder||""}"${D}${$} class="variable-chip ${h}">${x}${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${P}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,"&quot;")}" title="提示"></i>`:""}</span>`;e.required?A=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${F}</span>`:A=F}else if(e.type==="upload"&&e.key){const c=u[e.key]!==null&&u[e.key]!==void 0,g=c?u[e.key]:null,y=c?u[e.key]?.name:e.text,x=c?"":"hidden",h=e.tooltip&&!c?"":"hidden",D=c?"has-file":"",$=c&&y?` data-file-name="${y.replace(/"/g,"&quot;")}"`:"";let P="";c&&g&&(g.type?.startsWith("image/")?P=`<img class="upload-icon-img upload-icon-preview" src="${URL.createObjectURL(g)}" alt="preview" />`:P="<i class='iconfont icon-exlwenjian'></i>");const F=`<span contenteditable="false" data-type="upload" data-key="${e.key}" class="upload-chip"><span class="upload-inner-wrapper ${D}"><span class="upload-icon">${P}</span><span class="upload-label"${$}>${y||e.text}</span>${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi upload-info-icon ${h}" data-upload-key="${e.key}" data-tooltip="${e.tooltip}" title="提示"></i>`:""}<span class="file-remove-btn ${x}" title="移除文件">×</span></span></span>`;e.required?A=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${F}</span>`:A=F}else if(e.type==="select"&&e.key){const c=d[e.key]||"",g=(e.options||[]).map(h=>{const D=c===h.value?"selected":"";return`<option value="${h.value}" ${D}>${h.label}</option>`}).join(""),y=e.placeholder?`<option value="" ${c?"":"selected"} disabled hidden>${e.placeholder}</option>`:"",x=`<select data-type="select" data-key="${e.key}" class="rte-select">${y}${g}</select>`;e.required?A=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${x}</span>`:A=x}else if(e.type==="textarea"&&e.key){const c=d[e.key]||"",g=e.maxHeight||252,y=e.expandable!==!1,x=e.placeholder?` placeholder="${e.placeholder}"`:"",h=`<textarea data-type="textarea" data-key="${e.key}" class="rte-textarea" data-max-height="${g}" style="max-height:${g}px;"${x}>${c}</textarea>`,D=y?`<button type="button" class="rte-textarea-toggle" data-key="${e.key}" data-expanded="false">展开</button>`:"",$=`<div class="rte-textarea-wrapper" data-key="${e.key}">${h}${D}</div>`;e.required?A=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${$}</span>`:A=$}else if(e.type==="richtext"&&e.key){const c=d[e.key]||e.text||"",g=e.minHeight||140,y=e.placeholder?` data-placeholder="${e.placeholder}"`:"",x=e.expandable!==!1,h=c.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),D=`<div contenteditable="true" data-type="richtext" data-key="${e.key}" class="rte-richtext"${y} style="min-height:${g}px;">${h}</div>`,$=x?`<button type="button" class="rte-richtext-toggle" data-key="${e.key}" data-expanded="false">展开</button>`:"",P=`<div class="rte-richtext-wrapper" data-key="${e.key}">${D}${$}</div>`,F=`<div class="rte-richtext-container" data-key="${e.key}">${P}</div>`;e.required?A=`<div ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group rte-richtext-required"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${F}</div>`:A=F}else if(e.type==="datepicker"&&e.key){const c=d[e.key]||"",g=e.placeholder?` data-placeholder="${e.placeholder}"`:"",y=`<div data-type="datepicker" data-key="${e.key}" data-value="${c}" class="rte-datepicker-host"${g}></div>`;e.required?A=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${y}</span>`:A=y}else if(e.type==="multi-variable"&&e.key){const c=e.maxCount||9,g=E[e.key]||1,y=Math.min(g,c);if(e.required){const x=`<span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>`,h=e.exclusionGroup?`data-group="${e.exclusionGroup}"`:"";let D="";for(let $=0;$<y;$++){const P=`${e.key}_${$}`,F=d[P]||"",M=!F,K=M?"​":F,J=M?"show-placeholder":"",Q=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,"&quot;")}" data-variable-key="${e.key||""}"`:"",Z=e.tooltip&&M?"":"hidden",S=`<span contenteditable="true" data-type="variable" data-key="${P}" data-multi-key="${e.key}" data-index="${$}" data-placeholder="${e.placeholder||""}"${Q} class="variable-chip ${J}">${K}${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${Z}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,"&quot;")}" title="提示"></i>`:""}</span>`;$===0?D+=`<span ${h} class="exclusion-wrapper required-upload-group required-multi-first">${x}${S}</span>`:D+=S}A=D}else{let x="";for(let h=0;h<y;h++){const D=`${e.key}_${h}`,$=d[D]||"",P=!$,F=P?"​":$,M=P?"show-placeholder":"",K=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,"&quot;")}" data-variable-key="${e.key||""}"`:"",J=e.tooltip&&P?"":"hidden",Q=`<span contenteditable="true" data-type="variable" data-key="${D}" data-multi-key="${e.key}" data-index="${h}" data-placeholder="${e.placeholder||""}"${K} class="variable-chip ${M}">${F}${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${J}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,"&quot;")}" title="提示"></i>`:""}</span>`;x+=Q}A=x}}C+=m+A+o,a++}t.current&&(t.current.innerHTML=C,setTimeout(()=>{if(!t.current)return;t.current.querySelectorAll('[data-type="variable"]').forEach(r=>{const s=r.innerText.replace(/\n/g,"");s.replace(/\u200B/g,"")?r.classList.remove("show-placeholder"):(s!=="​"&&(r.innerText="​"),r.classList.add("show-placeholder"))})},0))}function et(t,v,u,i,d={},E,V,C){const a=l.useCallback(()=>{if(!t.current)return;if(v.length===0){t.current.innerHTML="";return}let e={};const s=t.current.__tempVariableValues;if(s?(e=s,setTimeout(()=>{if(t.current){const B=t.current;B.__tempVariableValues===s&&delete B.__tempVariableValues}},100)):(t.current.querySelectorAll('[data-type="variable"]').forEach(g=>{const y=g.dataset.key;if(y){const x=g.innerText.replace(/[\u200B\n]/g,"").trim();x&&(e[y]=x)}}),t.current.querySelectorAll('[data-type="select"]').forEach(g=>{const y=g.dataset.key;if(y){const x=g.value.trim();x&&(e[y]=x)}}),t.current.querySelectorAll('[data-type="textarea"]').forEach(g=>{const y=g.dataset.key;if(y){const x=g.value.replace(/[\u200B]/g,"").trim();x&&(e[y]=x)}}),t.current.querySelectorAll('[data-type="richtext"]').forEach(g=>{const y=g.dataset.key;if(y){const x=(g.textContent||"").replace(/[\u200B]/g,"").trim();x&&(e[y]=x)}}),t.current.querySelectorAll('[data-type="datepicker"]').forEach(g=>{const y=g.dataset.key;if(y){const x=(g.getAttribute("data-value")||"").trim();x&&(e[y]=x)}})),Ze(t,v,u,i,e,d,C),E?.current){const{key:B,offset:m}=E.current;setTimeout(()=>{if(!t.current)return;const o=t.current.querySelector(`[data-type="variable"][data-key="${B}"]`);if(o){try{const A=document.createRange(),c=document.createTreeWalker(o,NodeFilter.SHOW_TEXT,null);let g=0,y=null,x=0;for(;c.nextNode();){const h=c.currentNode,D=h.textContent?.length||0;if(g+D>=m){y=h,x=m-g;break}g+=D}if(y){A.setStart(y,Math.min(x,y.textContent?.length||0)),A.collapse(!0);const h=window.getSelection();h&&(h.removeAllRanges(),h.addRange(A),o.focus())}else{A.selectNodeContents(o),A.collapse(!1);const h=window.getSelection();h&&(h.removeAllRanges(),h.addRange(A),o.focus())}}catch{const A=document.createRange();A.selectNodeContents(o),A.collapse(!1);const c=window.getSelection();c&&(c.removeAllRanges(),c.addRange(A),o.focus())}E.current=null}},0)}},[v,u,i,t,d,E,V,C]);l.useEffect(()=>{a()},[a])}function tt(t,v,u,i){l.useEffect(()=>{const d=t.current;if(!d)return;const E=C=>{const a=C.target?.closest(".upload-info-icon");if(a&&a.classList.contains("upload-info-icon")){const r=a.dataset.uploadKey;r&&i({key:r,anchorEl:a,type:"upload"});return}const e=C.target?.closest('[data-type="upload"]');if(e){const r=e.dataset.key;if(r){const s=u[r];s&&s.type&&s.type.startsWith("image/")&&i({key:r,anchorEl:e,type:"upload-preview"})}}},V=C=>{const a=C.target?.closest(".upload-info-icon"),e=C.relatedTarget;if(a&&a.classList.contains("upload-info-icon")){!e||!d.contains(e)?i(null):e.closest(".upload-info-icon")||i(null);return}const r=C.target?.closest('[data-type="upload"]');if(r){const s=e;if(s&&r.contains(s))return;i(null)}};return d.addEventListener("mouseover",E,!0),d.addEventListener("mouseout",V,!0),()=>{d.removeEventListener("mouseover",E,!0),d.removeEventListener("mouseout",V,!0)}},[v,u,t,i])}function at(t,v,u,i){l.useEffect(()=>{if(!t.current)return;const d=a=>{if(i==="hideTagClose")return;const e=a.currentTarget,r=e.dataset.tooltip,s=e.dataset.tagKey||"";r&&u({key:s,anchorEl:e,type:"tag"})},E=()=>{u(null)};let V;const C=()=>{if(!t.current)return;t.current.querySelectorAll(".tag-node[data-tooltip]").forEach(e=>{e.addEventListener("mouseenter",d),e.addEventListener("mouseleave",E)})};return V=requestAnimationFrame(()=>{V=requestAnimationFrame(C)}),()=>{cancelAnimationFrame(V),t.current&&t.current.querySelectorAll(".tag-node[data-tooltip]").forEach(e=>{e.removeEventListener("mouseenter",d),e.removeEventListener("mouseleave",E)})}},[v,t,u,i])}function nt(t,v,u){l.useEffect(()=>{const i=t.current;if(!i)return;const d=V=>{const C=V.target?.closest(".variable-info-icon");if(C&&C.classList.contains("variable-info-icon")){const a=C.dataset.variableKey;a&&u({key:a,anchorEl:C,type:"variable"})}},E=V=>{const C=V.target?.closest(".variable-info-icon"),a=V.relatedTarget;C&&C.classList.contains("variable-info-icon")&&(!a||!i.contains(a)?u(null):a.closest(".variable-info-icon")||u(null))};return i.addEventListener("mouseover",d,!0),i.addEventListener("mouseout",E,!0),()=>{i.removeEventListener("mouseover",d,!0),i.removeEventListener("mouseout",E,!0)}},[v,t,u])}function rt(t,v,u,i){l.useEffect(()=>{if(!t.current)return;const d=a=>{const e=a.currentTarget;e.dataset.fileName&&i({key:"",anchorEl:e,type:"upload-label"})},E=()=>{i(null)};let V;const C=()=>{if(!t.current)return;t.current.querySelectorAll(".upload-label[data-file-name]").forEach(e=>{e.addEventListener("mouseenter",d),e.addEventListener("mouseleave",E)})};return V=requestAnimationFrame(()=>{V=requestAnimationFrame(C)}),()=>{cancelAnimationFrame(V),t.current&&t.current.querySelectorAll(".upload-label[data-file-name]").forEach(e=>{e.removeEventListener("mouseenter",d),e.removeEventListener("mouseleave",E)})}},[v,u,t,i])}function ot(t,v,u,i){l.useEffect(()=>{Ee(t,v,u),Ce(t,v,u,i)},[u,v,t,i])}function lt(t,v){l.useEffect(()=>{if(!t.current)return;let u=!1,i=0;const d=()=>{u=!0},E=()=>{u=!1,i=Date.now()};let V=!1,C=0;const a=()=>{V=!0},e=()=>{V=!1,C=Date.now()},r=()=>{C=Date.now()},s=()=>{if(!t.current)return;const m=window.getSelection();if(!m||m.rangeCount===0||v.current||u||V||Date.now()-C<500)return;const o=m.getRangeAt(0);if(!o.collapsed)return t.current.contains(o.commonAncestorContainer),void 0;const A=m.anchorNode;if(!A||!t.current.contains(A))return;let c=null;if(A.nodeType===Node.ELEMENT_NODE?c=A.closest('[data-type="variable"]'):A.nodeType===Node.TEXT_NODE&&A.parentElement&&(c=A.parentElement.closest('[data-type="variable"]')),!c){if(Date.now()-i>500)return;const g=t.current.querySelectorAll('[data-type="variable"]');if(g.length>0){let y=null;for(const x of Array.from(g))if(x.style.display!=="none"){y=x;break}if(!y&&g.length>0&&(y=g[0]),y){const x=document.createRange();x.selectNodeContents(y),x.collapse(!1),m.removeAllRanges(),m.addRange(x),y.focus()}else m.removeAllRanges()}else m.removeAllRanges()}},B=t.current;return B&&(B.addEventListener("compositionstart",a),B.addEventListener("compositionend",e),B.addEventListener("input",r)),document.addEventListener("mousedown",d),document.addEventListener("mouseup",E),document.addEventListener("selectionchange",s),()=>{const m=t.current;m&&(m.removeEventListener("compositionstart",a),m.removeEventListener("compositionend",e),m.removeEventListener("input",r)),document.removeEventListener("mousedown",d),document.removeEventListener("mouseup",E),document.removeEventListener("selectionchange",s)}},[t,v])}const Oe=({config:t,onSend:v,isProcessing:u=!1,disabled:i=!1,width:d,lockStructure:E=!1,agentOptions:V=[],onAgentSelect:C,onAgentExit:a,loading:e=!1,placeholder:r,border:s,background:B="transparent",hideButtons:m})=>{const o=l.useRef(null),A=l.useRef(null),[c,g]=l.useState({}),[y,x]=l.useState(null),[h,D]=l.useState(null),$=l.useRef(!1),P=l.useRef(null),[F,M]=l.useState(!1),K=l.useRef(null),[J,Q]=l.useState(!0),[Z,S]=l.useState(()=>{const p={};return t.forEach(f=>{f.type==="multi-variable"&&f.key&&(p[f.key]=1)}),p}),H=l.useRef({}),ee=l.useRef({}),ne=l.useRef({});l.useEffect(()=>{ee.current=c},[c]),l.useEffect(()=>{ne.current=Z},[Z]);const se=l.useCallback(p=>p.find(b=>b.type==="tag")?.text||null,[]),fe=l.useRef(t),ie=l.useRef(null);l.useEffect(()=>{const p=se(fe.current),f=se(t);if(p&&p!==f&&o.current){const b={};o.current.querySelectorAll('[data-type="variable"]').forEach(w=>{const _=w.dataset.key;if(_){const T=w.innerText.replace(/[\u200B\n]/g,"").trim();T&&(b[_]=T)}}),o.current.querySelectorAll('[data-type="select"]').forEach(w=>{const _=w.dataset.key;if(_){const T=w.value.trim();T&&(b[_]=T)}}),o.current.querySelectorAll('[data-type="textarea"]').forEach(w=>{const _=w.dataset.key;if(_){const T=w.value.replace(/[\u200B]/g,"").trim();T&&(b[_]=T)}}),H.current[p]={variableValues:b,files:{...ee.current},multiVariableCounts:{...ne.current}}}if(f&&H.current[f]){const b=H.current[f];ie.current=b,g(b.files),S(b.multiVariableCounts)}else if(f){ie.current=null;const b={};t.forEach(N=>{N.type==="multi-variable"&&N.key&&(b[N.key]=1)}),S(b),g({})}else ie.current=null,S({}),g({});fe.current=t},[t,se]),l.useLayoutEffect(()=>{ie.current&&o.current&&(o.current.__tempVariableValues=ie.current.variableValues,setTimeout(()=>{ie.current&&(ie.current=null)},0))}),et(o,t,c,E,Z,K,void 0,m),tt(o,t,c,D),at(o,t,D,m),rt(o,t,c,D),nt(o,t,D),ot(o,t,c,M),lt(o,$),l.useEffect(()=>{if(t.length>0){Q(!1);return}const p=()=>{if(!o.current){Q(!0);return}const b=o.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"",N=o.current.querySelectorAll('[data-type="variable"]'),k=o.current.querySelectorAll('[data-type="upload"]');let q=!1;N.forEach(_=>{(_.textContent?.replace(/[\u200B\n]/g,"").trim()||"")&&(q=!0)}),k.forEach(_=>{_.querySelector(".upload-inner-wrapper.has-file")&&(q=!0)});const w=!b&&!q;Q(w),t.length===0&&M(!w)};p();const f=new MutationObserver(p);return o.current&&f.observe(o.current,{childList:!0,subtree:!0,characterData:!0}),()=>{f.disconnect()}},[t]);const Se=p=>{if(i){p.preventDefault();return}p.preventDefault();const f=p.clipboardData.getData("text/plain"),b=window.getSelection();if(b&&b.rangeCount>0){const N=b.anchorNode;if(N){let k=null;if(N.nodeType===Node.ELEMENT_NODE?k=N.closest('[data-type="variable"]'):N.nodeType===Node.TEXT_NODE&&N.parentElement&&(k=N.parentElement.closest('[data-type="variable"]')),k){const q=k.dataset.multiKey;if(q){const w=/[、,,\s\n\r\t]+/,_=f.split(w).map(T=>T.trim()).filter(T=>T.length>0);if(console.log("[Paste Event] 粘贴的内容:",f),console.log("[Paste Event] 拆分后的值:",_),_.length>1){const T=parseInt(k.dataset.index||"0",10),G=t.find(ae=>ae.type==="multi-variable"&&ae.key===q)?.maxCount||9,z=Z[q]||1,I=Math.min(T+_.length,G);I>z&&S(U=>({...U,[q]:I}));const O=[];for(let U=0;U<z;U++){const ae=`${q}_${U}`,oe=o.current.querySelector(`[data-type="variable"][data-key="${ae}"][data-multi-key="${q}"]`);if(oe){const ue=oe.innerText.replace(/[\u200B\n]/g,"").trim();O.push(ue)}}O.splice(T,1,..._.slice(0,G-T));const R=O.slice(0,G);R.length>0&&R[R.length-1]!==""&&R.length<G&&R.push("");const L=Math.max(R.length,1),Y={};R.forEach((U,ae)=>{U&&(Y[`${q}_${ae}`]=U)}),o.current.querySelectorAll('[data-type="variable"]').forEach(U=>{const ae=U.dataset.key,oe=U.dataset.multiKey;if(ae&&oe!==q){const ue=U.innerText.replace(/[\u200B\n]/g,"").trim();ue&&(Y[ae]=ue)}}),o.current.__tempVariableValues=Y,S(U=>({...U,[q]:L})),console.log("[Paste Event] 粘贴完成,已填充到多个输入框,值:",R);return}else _.length===1&&console.log("[Paste Event] 粘贴单个值,将在失去焦点时检查是否需要拆分")}}}}document.execCommand("insertText",!1,f),ce(),setTimeout(()=>{const N=window.getSelection();if(N&&N.rangeCount>0){const k=N.anchorNode;if(k){let q=null;if(k.nodeType===Node.ELEMENT_NODE?q=k.closest('[data-type="variable"][data-multi-key]'):k.nodeType===Node.TEXT_NODE&&k.parentElement&&(q=k.parentElement.closest('[data-type="variable"][data-multi-key]')),q){const w=q.innerText.replace(/[\u200B\n]/g,"").trim();/[、,,\s]+/.test(w)&&(console.log("[Paste Event] 粘贴后检测到分隔符,内容:",w),console.log("[Paste Event] 提示:失去焦点后将自动拆分"))}}}},0)},$e=p=>{if(p.target.files&&p.target.files[0]&&y){const f=p.target.files[0],b=y;g(N=>({...N,[b]:f}))}p.target&&(p.target.value=""),x(null)},he=p=>{g(f=>{const b={...f};return delete b[p],b})},Ne=p=>{const f=p.target;if(f.closest(".tag-close-btn")){if(p.preventDefault(),p.stopPropagation(),E)return;D(null),a?a():o.current&&(o.current.innerHTML="",o.current.focus());return}if(E){const k=f.closest(".tag-node"),q=f.closest('[data-type="text"]');if(k||q){p.preventDefault(),p.stopPropagation();const w=window.getSelection();w&&w.removeAllRanges();return}}f.closest('[data-type="variable"]')||(P.current={x:p.clientX,y:p.clientY},$.current=!1,f.closest(".file-remove-btn")&&(p.preventDefault(),p.stopPropagation()))},ye=p=>{if(!p.target.closest('[data-type="variable"]')&&P.current){const N=Math.abs(p.clientX-P.current.x),k=Math.abs(p.clientY-P.current.y);(N>3||k>3)&&($.current=!0)}},Ae=p=>{if(p.target.closest('[data-type="variable"]')){P.current=null,$.current=!1;return}P.current=null,$.current=!1},j=p=>{if(i)return;const f=p.target;if(f.closest('[data-type="datepicker"]'))return;if(f.closest(".tag-close-btn")){p.preventDefault(),p.stopPropagation();return}if(t.length===0)return;const k=(I,O)=>{if(!o.current)return;Array.from(o.current.children).forEach(L=>{if(L!==I)if(O)L.dataset.prevDisplay===void 0&&(L.dataset.prevDisplay=L.style.display||""),L.style.setProperty("display","none","important");else if(L.dataset.prevDisplay!==void 0){const Y=L.dataset.prevDisplay;Y?L.style.display=Y:L.style.removeProperty("display"),delete L.dataset.prevDisplay}else L.style.removeProperty("display")})},q=f.closest(".rte-textarea-toggle");if(q){p.preventDefault(),p.stopPropagation();const I=q.closest(".rte-textarea-wrapper"),O=I?.querySelector('[data-type="textarea"]'),L=!(q.getAttribute("data-expanded")==="true");q.setAttribute("data-expanded",String(L)),q.textContent=L?"收起":"展开",I&&I.classList.toggle("rte-textarea-expanded",L);const Y=I?.closest(".rte-textarea-required");if(Y?Y.classList.toggle("rte-textarea-overlay",L):I&&I.classList.toggle("rte-textarea-overlay",L),O)if(L)O.classList.add("rte-textarea-expanded"),O.style.maxHeight="none",O.style.height="100%";else{O.classList.remove("rte-textarea-expanded");const te=O.dataset.maxHeight||"252";O.style.maxHeight=`${te}px`,O.style.height="auto"}o.current&&(L?o.current.classList.add("rte-overlay-active"):o.current.classList.remove("rte-overlay-active"));return}const w=f.closest(".rte-richtext-toggle");if(w){p.preventDefault(),p.stopPropagation();const I=w.closest(".rte-richtext-wrapper"),O=I?.querySelector('[data-type="richtext"]'),L=!(w.getAttribute("data-expanded")==="true");w.setAttribute("data-expanded",String(L)),w.textContent=L?"收起":"展开";const Y=I?.closest(".rte-richtext-required");Y?Y.classList.toggle("rte-richtext-expanded",L):I&&I.classList.toggle("rte-richtext-expanded",L);const te=I?.closest(".exclusion-wrapper")||I?.parentElement;O&&(L?(O.style.height="100%",O.style.overflow="auto"):(O.style.height="",O.style.overflow="")),te&&(te.classList.toggle("rte-richtext-host-expanded",L),k(te,L)),o.current&&o.current.classList.toggle("rte-richtext-fullscreen-active",L);return}if(f.closest('[data-type="text"]')){p.preventDefault(),p.stopPropagation();const I=window.getSelection();I&&I.removeAllRanges();return}if(E&&f.closest(".tag-node")){p.preventDefault(),p.stopPropagation();const O=window.getSelection();O&&O.removeAllRanges();return}if(f.closest('[data-type="variable"]')){if($.current)return;setTimeout(()=>{const I=window.getSelection();I&&!I.isCollapsed||qe(o)},10);return}const G=f.closest(".file-remove-btn");if(G){p.preventDefault(),p.stopPropagation();const O=G.closest('[data-type="upload"]')?.dataset.key;O&&he(O);return}const z=f.closest('[data-type="upload"]');if(z){const I=z.dataset.key;I&&(x(I),A.current?.click());return}},re=p=>{const b=p.target.closest('[data-type="variable"]');if(b){const N=window.getSelection();if(N){const k=document.createRange(),q=b.textContent||"";if(q.replace(/\u200B/g,"")){let _=0,T=q.length;q.startsWith("​")&&(_=1),q.endsWith("​")&&q.length>1&&(T=q.length-1);const G=b.firstChild;G&&G.nodeType===Node.TEXT_NODE?(k.setStart(G,_),k.setEnd(G,T)):k.selectNodeContents(b)}else k.selectNodeContents(b),k.collapse(!0);N.removeAllRanges(),N.addRange(k)}}},ce=()=>{if(t.length===0){if(o.current){const b=!(o.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"");Q(b),M(!b)}return}if(qe(o),o.current&&o.current.querySelectorAll('[data-type="variable"]').forEach(b=>{const N=b.querySelector(".variable-info-icon");if(N){let k=!1;const q=document.createTreeWalker(b,NodeFilter.SHOW_TEXT,{acceptNode:w=>N.contains(w)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});for(;q.nextNode();)if(q.currentNode.textContent?.replace(/[\u200B\n]/g,"").trim()){k=!0;break}k?N.classList.add("hidden"):N.classList.remove("hidden")}}),Ee(o,t,c),Ce(o,t,c,M),!o.current)return;t.filter(f=>f.type==="multi-variable"&&f.key).forEach(f=>{if(!f.key)return;const b=f.maxCount||9,N=Z[f.key]||1,k=[];for(let G=0;G<N;G++){const z=`${f.key}_${G}`,I=o.current.querySelector(`[data-type="variable"][data-key="${z}"][data-multi-key="${f.key}"]`);if(I){const O=I.innerText.replace(/[\u200B\n]/g,"").trim();k.push(O)}}const w=(k[k.length-1]||"")==="";let _=!1,T=-1;for(let G=0;G<k.length-1;G++)if(k[G]===""){_=!0,T=G;break}if(_&&T>=0){const G=window.getSelection();if(G&&G.rangeCount>0){const L=G.getRangeAt(0),Y=L.startContainer,te=Y.nodeType===Node.ELEMENT_NODE?Y.closest('[data-type="variable"][data-multi-key]'):Y.parentElement?.closest('[data-type="variable"][data-multi-key]');if(te){const U=te.dataset.key;if(U){const ae=document.createRange();ae.setStartBefore(te),ae.setEnd(L.startContainer,L.startOffset);const oe=ae.toString().length;K.current={key:U,offset:oe}}}}const z=[...k];for(let L=T;L<z.length-1;L++)z[L]=z[L+1];z.pop();const I={};z.forEach((L,Y)=>{L&&(I[`${f.key}_${Y}`]=L)});const O=Math.max(w?z.length:z.length+1,1);o.current.querySelectorAll('[data-type="variable"]').forEach(L=>{const Y=L.dataset.key,te=L.dataset.multiKey;if(Y&&te!==f.key){const U=L.innerText.replace(/[\u200B\n]/g,"").trim();U&&(I[Y]=U)}}),o.current.__tempVariableValues=I,S(L=>({...L,[f.key]:O}));return}if(!w){const G=N-1,z=`${f.key}_${G}`,I=o.current.querySelector(`[data-type="variable"][data-key="${z}"][data-multi-key="${f.key}"]`);if(I&&I.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&N<b){const R=window.getSelection();if(R&&R.rangeCount>0){const L=R.getRangeAt(0),Y=L.startContainer,te=Y.nodeType===Node.ELEMENT_NODE?Y.closest('[data-type="variable"][data-multi-key]'):Y.parentElement?.closest('[data-type="variable"][data-multi-key]');if(te){const U=te.dataset.key;if(U){const ae=document.createRange();ae.setStartBefore(te),ae.setEnd(L.startContainer,L.startOffset);const oe=ae.toString().length;K.current={key:U,offset:oe}}}}S(L=>({...L,[f.key]:N+1}))}}})};l.useLayoutEffect(()=>{const p=o.current;if(!p)return;const f=new Map,b=q=>{const w=q.target,_=q.relatedTarget;!w||!o.current||!o.current.contains(w)||_&&o.current.contains(_)||setTimeout(()=>{if(o.current){if(t.length===0){const T=o.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";M(T.length>0);return}qe(o),Ee(o,t,c),Ce(o,t,c,M)}},0)};p.addEventListener("blur",b,!0);const N=()=>{if(!o.current)return;f.forEach((_,T)=>{T.removeEventListener("blur",_,!1)}),f.clear();const q=o.current.querySelectorAll('[data-type="variable"][data-multi-key]'),w=_=>{_.stopPropagation(),_.stopImmediatePropagation();const T=_.target;if(!T||!o.current||!o.current.contains(T))return;const G=T.closest('[data-type="variable"][data-multi-key]');if(!G||!o.current.contains(G))return;let z=!1;if(f.forEach((ae,oe)=>{(oe===G||oe.contains(T))&&(z=!0)}),!z)return;const I=G.dataset.multiKey,O=G.dataset.key,R=G.dataset.index;if(!I||!O||R===void 0)return;const L=_.relatedTarget;if(!(!L||!o.current.contains(L)))return;const te=G.innerText.replace(/[\u200B\n]/g,"").trim();console.log("[Blur Event] 失去焦点的 multi-variable 输入框:",{multiKey:I,currentKey:O,index:R,content:te});const U=/[、,,\s]+/;if(U.test(te)){const ae=te.split(U).map(me=>me.trim()).filter(me=>me.length>0);console.log("[Blur Event] 拆分前的内容:",te),console.log("[Blur Event] 拆分后的部分:",ae);const ue=ae.slice(0,9);if(console.log("[Blur Event] 有效的部分(最多9个):",ue),ue.length>1){const me=t.find(be=>be.type==="multi-variable"&&be.key===I);if(me){const be=Z[I]||1,Xe=parseInt(R,10),Je=me.maxCount||9,xe=[];for(let le=0;le<be;le++){const ge=`${I}_${le}`,ke=o.current.querySelector(`[data-type="variable"][data-key="${ge}"][data-multi-key="${I}"]`);if(ke){const we=ke.innerText.replace(/[\u200B\n]/g,"").trim();xe.push(we)}}console.log("[Blur Event] 拆分前的所有值:",xe),console.log("[Blur Event] 当前索引:",Xe),console.log("[Blur Event] 要插入的值:",ue),xe.splice(Xe,1,...ue);const pe=xe.slice(0,Je);console.log("[Blur Event] 拆分后的所有值:",pe),pe.length>0&&pe[pe.length-1]!==""&&pe.length<Je&&pe.push("");const yt=Math.max(pe.length,1),Ie={};pe.forEach((le,ge)=>{le&&(Ie[`${I}_${ge}`]=le)}),o.current.querySelectorAll('[data-type="variable"]').forEach(le=>{const ge=le.dataset.key,ke=le.dataset.multiKey;if(ge&&ke!==I){const we=le.innerText.replace(/[\u200B\n]/g,"").trim();we&&(Ie[ge]=we)}}),o.current.__tempVariableValues=Ie,S(le=>({...le,[I]:yt}))}}}};q.forEach(_=>{_.addEventListener("blur",w,!1),f.set(_,w)})},k=setTimeout(()=>{N()},0);return()=>{clearTimeout(k),p.removeEventListener("blur",b,!0),f.forEach((q,w)=>{w.removeEventListener("blur",q,!1)}),f.clear()}},[t,Z,c]);const ve=p=>{if(i){p.preventDefault();return}const f=window.getSelection();if(f&&f.rangeCount>0){const b=f.anchorNode;let N=null;if(b&&(b.nodeType===Node.ELEMENT_NODE?N=b.closest('[data-type="text"]'):b.nodeType===Node.TEXT_NODE&&b.parentElement&&(N=b.parentElement.closest('[data-type="text"]'))),N){if(p.preventDefault(),p.stopPropagation(),o.current){const k=o.current.querySelector('[data-type="variable"], [data-type="upload"]');k&&k.focus()}return}}if(E&&f&&f.rangeCount>0){const b=f.anchorNode;let N=null;if(b&&(b.nodeType===Node.ELEMENT_NODE?N=b.closest(".tag-node"):b.nodeType===Node.TEXT_NODE&&b.parentElement&&(N=b.parentElement.closest(".tag-node"))),N){if(p.preventDefault(),p.stopPropagation(),o.current){const k=o.current.querySelector('[data-type="variable"], [data-type="upload"]');k&&k.focus()}return}}if(p.key==="Enter"&&!p.shiftKey&&(p.preventDefault(),Ue()),p.key==="Escape"&&o.current){if(E){p.preventDefault();return}o.current.innerHTML="",o.current.focus()}if(p.key==="Backspace"){const b=window.getSelection();if(b&&b.rangeCount>0){const N=b.getRangeAt(0),k=b.anchorNode;if(E){let w=null,_=null;if(k&&(k.nodeType===Node.ELEMENT_NODE?(w=k.closest(".tag-node"),_=k.closest('[data-type="text"]')):k.nodeType===Node.TEXT_NODE&&k.parentElement&&(w=k.parentElement.closest(".tag-node"),_=k.parentElement.closest('[data-type="text"]'))),(w||_)&&N.collapsed&&N.startOffset===0){p.preventDefault();return}}let q=null;if(k&&(k.nodeType===Node.ELEMENT_NODE?q=k.closest('[data-type="variable"]'):k.nodeType===Node.TEXT_NODE&&k.parentElement&&(q=k.parentElement.closest('[data-type="variable"]'))),q){if(!N.collapsed)return;const w=q.innerText;if(w==="​"||w===""){p.preventDefault();return}if(N.startOffset===0){p.preventDefault();return}if(w.startsWith("​")&&N.startOffset===1){p.preventDefault();return}}}}},Ue=()=>{if(u||i||e||!F||!o.current)return;if(t.length===0){const q=o.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";if(!q)return;v(q,q);return}const p=o.current;let f="";const b={},N=q=>{if(!(q.nodeType===Node.ELEMENT_NODE&&q.style.display==="none")){if(q.nodeType===Node.TEXT_NODE)f+=(q.textContent||"").replace(/\u200B/g,"");else if(q.nodeType===Node.ELEMENT_NODE){const w=q,_=w.dataset.type,T=w.dataset.key;if(_==="variable"&&T){let G="";const z=document.createTreeWalker(w,NodeFilter.SHOW_TEXT,{acceptNode:O=>{const R=w.querySelector(".variable-info-icon");return R&&R.contains(O)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});for(;z.nextNode();)G+=z.currentNode.textContent||"";const I=G.replace(/[\u200B\n]/g,"").trim();if(I){const O=w.dataset.multiKey;if(O){(!b[O]||!Array.isArray(b[O]))&&(b[O]=[]);const R=b[O];R.push(I),R.length>1&&(f+=" "),f+=I}else b[T]=I,f+=I}}else if(_==="select"&&T){const G=w,z=(G.value||"").trim();if(z){b[T]=z;const I=G.selectedOptions?.[0];f+=I?.textContent||z}}else if(_==="textarea"&&T){const z=(w.value||"").replace(/\u200B/g,"").trim();z&&(b[T]=z,f+=z)}else if(_==="richtext"&&T){const z=(w.textContent||"").replace(/\u200B/g,"").trim();z&&(b[T]=z,f+=z)}else if(_==="datepicker"&&T){const z=(w.getAttribute("data-value")||"").trim();z&&(b[T]=z,f+=z)}else if(_==="upload"&&T)b[T]=c[T]??null,c[T]&&(f+=` [附带文件: ${c[T]?.name}] `);else{if(w.classList.contains("tag-close-btn")||w.classList.contains("file-remove-btn"))return;w.getAttribute("contenteditable")==="false"&&!_&&w.classList.contains("tag-node")?f+=w.innerText:w.childNodes.forEach(N)}}}};if(p.childNodes.forEach(N),f=f.trim(),!f)return;const k=new FormData;k.append("fullPrompt",f),Object.keys(b).forEach(q=>{const w=b[q];w!=null&&(w instanceof File?k.append(q,w):Array.isArray(w)?t.some(T=>T.type==="multi-variable"&&T.key===q)?w.forEach(T=>{T!=null&&T!==""&&k.append(q,String(T))}):w.forEach((T,G)=>{T!=null&&(T instanceof File?k.append(`${q}[${G}]`,T):typeof T=="string"?k.append(`${q}[${G}]`,T):k.append(`${q}[${G}]`,String(T)))}):typeof w=="string"?k.append(q,w):k.append(q,String(w)))}),v(k,f)},ft={...d?{width:typeof d=="number"?`${d}px`:d}:{},...s?{border:s}:{},...B?{background:B}:{}};return n.jsxs("div",{className:"rich-text-editor",style:ft,"data-disabled":i,children:[n.jsx("div",{ref:o,className:`rte-editor ${t.length===0?"rte-editor-default":""} ${J&&r?"rte-editor-empty":""}`,contentEditable:t.length===0,suppressContentEditableWarning:!0,"data-placeholder":r,onMouseDown:Ne,onMouseMove:ye,onMouseUp:Ae,onClick:j,onDoubleClick:re,onInput:ce,onKeyDown:ve,onPaste:Se}),n.jsx("input",{type:"file",ref:A,className:"rte-file-input",accept:".csv,.xlsx,.xls,.txt,.pdf,image/*",onChange:$e}),n.jsxs("div",{className:"rich-text-editor-footer",children:[n.jsx("div",{className:"rich-text-editor-footer-left",children:n.jsxs("div",{className:"rich-text-editor-brand",children:[n.jsxs("div",{className:"rte-brand-badge",children:[n.jsx("img",{src:"https://oospublic.sealseek.cn/file/website/ball.png",alt:""}),n.jsx("span",{className:"rte-brand-text",children:"SealSeek 1.0"})]}),m!=="hideAgent"&&n.jsx(W.Dropdown,{placement:"top",menu:{items:V.map(p=>({key:p.key,label:n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[p.icon&&n.jsx("i",{className:p.icon}),n.jsx("span",{children:p.label})]}),onClick:()=>{C?.(p)}}))},trigger:["click"],disabled:i||u,children:n.jsxs("div",{className:"rte-agent-badge",style:{cursor:V.length>0?"pointer":"default"},children:[n.jsx("i",{className:"iconfont icon-zhinengti"}),n.jsx("span",{className:"rte-agent-text",children:"智能体"})]})})]})}),n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(()=>{const p=t.find(b=>b.type==="tag");if(!p||!p.text)return null;const f=V.find(b=>b.label===p.text);return!f||f.points===void 0||f.points===null?null:n.jsxs("div",{className:"rte-points-badge",children:[n.jsx("i",{className:"iconfont icon-jifen",style:{marginRight:"4px"}}),n.jsxs("span",{style:{fontSize:"16px"},children:["-",String(f.points)]})]})})(),n.jsx("button",{type:"button",onClick:Ue,disabled:u||i||e||!F,className:"rich-text-editor-send-button",children:u||e?n.jsx("span",{className:"rte-send-spinner"}):n.jsx("i",{className:"iconfont icon-fasong"})})]})]}),h?.anchorEl&&(()=>{if(!document.body.contains(h.anchorEl))return null;let p="",f={background:"var(--neutral-800, #262626)"};if(h.type==="upload")p=t.find(k=>k.type==="upload"&&k.key===h.key)?.tooltip||"";else if(h.type==="tag")p=h.anchorEl.dataset.tooltip||"";else if(h.type==="upload-label")p=h.anchorEl.dataset.fileName||"";else if(h.type==="variable")p=h.anchorEl.dataset.tooltip||"";else if(h.type==="upload-preview"){const N=c[h.key];if(N&&N.type&&N.type.startsWith("image/")){const k=URL.createObjectURL(N);p=n.jsx("div",{style:{width:120,height:120,display:"flex",alignItems:"center",justifyContent:"center"},children:n.jsx("img",{src:k,style:{maxWidth:120,maxHeight:120,objectFit:"contain"}})}),f={background:"#fff",padding:4},setTimeout(()=>URL.revokeObjectURL(k),1e3)}else p=""}if(!p)return null;const b=h.type==="upload-preview"?"#0A0A0A":"#fff";return Qe.createPortal(n.jsx(W.Tooltip,{arrow:!1,title:n.jsx("div",{style:{maxWidth:"200px",fontSize:"12px",color:b},children:p}),open:!0,placement:"top",getPopupContainer:()=>document.body,overlayInnerStyle:f,children:n.jsx("div",{style:{position:"fixed",left:`${h.anchorEl.getBoundingClientRect().left}px`,top:`${h.anchorEl.getBoundingClientRect().top}px`,width:`${h.anchorEl.offsetWidth}px`,height:`${h.anchorEl.offsetHeight}px`,pointerEvents:"none"}})}),document.body)})()]})};Oe.__docgenInfo={displayName:"RichTextEditor",description:"结构化富文本输入组件,支持标签、变量输入块、文件上传以及互斥显示逻辑。",props:{config:{name:"config",required:!0,description:"结构化输入配置节点数组",type:{name:"InputNode[]",raw:"InputNode[]"}},onSend:{name:"onSend",required:!0,description:"点击发送按钮时的回调,返回数据与拼接后的 Prompt",type:{name:"function",raw:"(data: Record<string, any>, fullPrompt: string) => void"}},isProcessing:{name:"isProcessing",required:!1,description:"是否处于处理状态(禁用输入与发送)",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}}}};const Fe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFSSURBVHgB3ZTtccIwDIaVXv83I2SDZgSP0BHMBG0naEZhA2boBGQDswHdQJUOGRxjO0Z8HPDe6eJzJD2W4gjgEYSIn2xwK6EIFHqBGysJpMP3ZB0oRbEtmal1NtIxl4OWWsoxEsvqofJ0rgTNASOYq+7SXKDsuYvAcgkq/PWwBLQWqIfdjeRStaBUc4qzgLi9/BzJNmS/sh6bpvmrTfSFacU3scWy1mQryWdSnXiFE8QVUJINLTuyhWzzz/1OZmTN9hEckqtfUOwIGlGCpVRjE+94JFqpMtTeVzO8/UmPxpZU8Qa7aln8Tb9pfwla4WHWrjPvvbbnTBsX7PmLs83EDAH0BxSw1G31+/1FoDg/vPcXR+wocQS1apj4+P92FfhOoLyuBfYlmPgYnGoCjWADzAkzUyJ430awLmphPaxWQVU22BuuApPkHaanjcXSN3t6/QNjTMSJWDcs1QAAAABJRU5ErkJggg==",st=[{label:"5页",value:5},{label:"10页",value:10},{label:"15页",value:15},{label:"30页",value:30}],it=({autoLoading:t,batchSize:v,loadingProgress:u,loadIcon:i,onBatchSizeChange:d,onLoadNextPage:E,onStartAutoLoad:V,onStopLoad:C})=>t&&u?n.jsxs("div",{className:"auto_load_progress",children:[i||n.jsx("img",{src:Fe,alt:"自动加载",width:14,height:14}),n.jsxs("span",{children:["正在加载第",u.currentPage,"/",u.totalPages,"页"]}),n.jsx(W.Progress,{percent:u.percentage,type:"line",size:[160,8]}),n.jsx("span",{onClick:C,className:"auto_load_stop_btn",children:"停止加载"})]}):n.jsxs("div",{className:"auto_load_container",children:[n.jsx("div",{onClick:E,className:"auto_load_next_btn",style:{backgroundColor:t?"#f5f5f5":"#2563eb"},children:"加载下一页"}),n.jsxs("div",{className:"right_control_wrap",style:{backgroundColor:t?"#f5f5f5":"#2563eb"},children:[n.jsxs("div",{className:"auto_load_btn",onClick:t?void 0:V,children:[i||n.jsx("img",{src:Fe,alt:"自动加载",width:14,height:14}),n.jsx("span",{children:"自动加载"})]}),n.jsx(W.Select,{value:v,onChange:d,options:st,disabled:t,size:"small",className:"auto_load_select",popupMatchSelectWidth:84})]})]}),ct=({current:t,loadIcon:v,pageSize:u,total:i,cachedPages:d,loadedCount:E,autoLoading:V=!1,loadingProgress:C,onChange:a,onLoadNextPage:e,onStartAutoLoad:r,onStopLoading:s})=>{const[B,m]=l.useState(5),o=Math.ceil(i/u),A=l.useMemo(()=>d.length>=o,[d,o]),c=()=>Array.from({length:o},(x,h)=>h+1).filter(x=>!d.includes(x)).slice(0,B),g=(y,x,h)=>{const D=d.includes(y);return x==="prev"||x==="next"||x==="jump-prev"||x==="jump-next"?n.jsx("div",{className:"pageBox",children:h}):n.jsxs("div",{className:"pageBox",style:{backgroundColor:t===y?"#2563EB":"#f5f5f5",color:t===y?"#fff":D?"#171717":"#a3a3a3"},children:[y,!D&&n.jsx("span",{className:"unload_spot"})]})};return n.jsxs("div",{className:"pagination_footer",children:[n.jsxs("div",{className:"pagination_leftWrap",children:[n.jsxs("span",{className:"pagination_total",children:[n.jsx(de.InfoCircleOutlined,{style:{color:"#2563EB",marginRight:"4px"}}),"已加载: ",E,"/",i,"条数据"]}),!A&&n.jsx(it,{loadIcon:v||void 0,autoLoading:V,batchSize:B,loadingProgress:C,disabled:!e||!r,onBatchSizeChange:m,onLoadNextPage:()=>e?.(),onStartAutoLoad:()=>{const y=c();r?.(y)},onStopLoad:()=>s?.()})]}),n.jsx(W.Pagination,{current:t,pageSize:u,total:i,onChange:y=>a(y),showSizeChanger:!1,showQuickJumper:!1,showTotal:(y,x)=>"",itemRender:g})]})},ze=t=>{const{loading:v,autoLoading:u,loadingProgress:i,columns:d=[],dataSource:E=[],total:V,current:C,pageSize:a,cachedPages:e,onChangePage:r,onLoadNextPage:s,onStartAutoLoad:B,onStopLoading:m,...o}=t,A=l.useRef(null),c=l.useCallback(g=>{r(g),e.includes(g)&&A.current?.scrollTo({key:`${(g-1)*a+1}`})},[C]);return n.jsxs("div",{className:"flex flex-col",children:[n.jsx(W.Table,{ref:A,...o,columns:d,dataSource:E,pagination:!1,virtual:!0}),n.jsx(ct,{loading:v,autoLoading:u,loadingProgress:i,current:C,pageSize:a,total:V,loadedCount:E.length,cachedPages:e,onChange:c,onLoadNextPage:s,onStartAutoLoad:B,onStopLoading:m})]})};ze.__docgenInfo={displayName:"VirtualTable",description:"虚拟滚动表格组件,支持分页、数据缓存和自动加载功能。",props:{loading:{description:"加载状态",name:"loading",required:!0,type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},total:{description:"总数据条数",name:"total",required:!0,type:{name:"number",raw:"number"},defaultValue:{value:"0"}},current:{description:"当前页码",name:"current",required:!0,type:{name:"number",raw:"number"},defaultValue:{value:"1"}},pageSize:{description:"每页数据条数",name:"pageSize",required:!0,type:{name:"number",raw:"number"},defaultValue:{value:"10"}},cachedPages:{description:"已缓存的页码数组",name:"cachedPages",required:!0,type:{name:"number[]",raw:"number[]"},defaultValue:{value:"[]"}},dataSource:{description:"数据源",name:"dataSource",required:!0,type:{name:"Array<T>",raw:"Array<T>"},defaultValue:{value:"[]"}},onChangePage:{description:"页码变更回调函数",name:"onChangePage",required:!0,type:{name:"function",raw:"function(page: number): void"},defaultValue:{value:"-"}},autoLoading:{description:"是否正在自动加载",name:"autoLoading",required:!0,type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},loadingProgress:{description:"加载进度信息",name:"loadingProgress",required:!0,type:{name:"object",raw:"{percentage: 0, currentPage: 1, totalPages: 5}"},defaultValue:{value:"-"}},onLoadNextPage:{description:"加载下一页回调函数",name:"onLoadNextPage",required:!1,type:{name:"function",raw:"function(page: number): void"},defaultValue:{value:"-"}},onStartAutoLoad:{description:"开始自动加载回调函数",name:"onStartAutoLoad",required:!1,type:{name:"function",raw:"function(loadNextPages: number[]): void"},defaultValue:{value:"-"}},onStopLoading:{description:"停止加载回调函数",name:"onStopLoading",required:!1,type:{name:"function",raw:"function(): void"},defaultValue:{value:"-"}},columns:{description:"表格列配置",name:"columns",required:!0,type:{name:"Array<object>",raw:"Array<object>"},defaultValue:{value:"[]"}}}};const We=({texts:t=[],placeholder:v="请输入内容",animationSpeed:u=100,autoPlay:i=!0,value:d,onChange:E,...V})=>{const[C,a]=l.useState(""),[e,r]=l.useState(0),[s,B]=l.useState(!1),[m,o]=l.useState(!1),[A,c]=l.useState(!1),g=l.useRef(void 0),y=l.useRef(void 0),x=l.useRef(t),h=l.useRef(e),D=l.useRef(m),$=l.useRef(C);l.useEffect(()=>{x.current=t,h.current=e,D.current=m,$.current=C});const P=l.useCallback((S,H)=>{let ee=0;c(!0);const ne=()=>{ee<S.length?(a(S.slice(0,ee+1)),ee++,y.current=window.setTimeout(ne,u)):(c(!1),H?.())};ne()},[u]),F=l.useCallback(S=>{let H=$.current.length;const ee=()=>{H>0?(a($.current.slice(0,H-1)),H--,y.current=window.setTimeout(ee,u/2)):S?.()};ee()},[u]),M=l.useCallback(()=>{if(x.current.length===0||D.current)return;B(!0);const S=x.current[h.current];$.current?F(()=>{P(S,()=>{g.current=window.setTimeout(()=>{r(H=>(H+1)%x.current.length),B(!1)},2e3)})}):P(S,()=>{g.current=window.setTimeout(()=>{r(H=>(H+1)%x.current.length),B(!1)},2e3)})},[F,P]);l.useEffect(()=>(i&&t.length>0&&!m&&M(),()=>{g.current&&window.clearTimeout(g.current),y.current&&window.clearTimeout(y.current)}),[e,m,i,t.length,M]),l.useEffect(()=>{!s&&i&&t.length>0&&!m&&M()},[e,s,i,t.length,m,M]);const K=S=>{o(!0),g.current&&window.clearTimeout(g.current),y.current&&window.clearTimeout(y.current),B(!1),c(!1),V.onFocus?.(S)},J=S=>{o(!1),!d&&t.length>0&&(a(""),r(0)),V.onBlur?.(S)},Q=S=>{E?.(S.target.value),V.onChange?.(S)},Z=()=>m||d?v:C||v;return n.jsxs("div",{style:{position:"relative"},children:[n.jsx(W.Input,{...V,value:d,onChange:Q,onFocus:K,onBlur:J,placeholder:Z(),style:{...V.style,position:"relative",zIndex:1}}),!m&&!d&&C&&n.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",paddingLeft:11,paddingRight:11,color:"#bfbfbf",pointerEvents:"none",zIndex:2,fontSize:14,fontFamily:"inherit"},children:[n.jsx("span",{children:C}),A&&n.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),n.jsx("style",{children:`
1
+ (function(X,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react/jsx-runtime"),require("react"),require("antd"),require("@ant-design/icons"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","antd","@ant-design/icons","react-dom"],l):(X=typeof globalThis<"u"?globalThis:X||self,l(X.SealSeekBIComponents={},X.React,X.React,X.antd,X.AntdIcons,X.ReactDOM))})(this,function(X,l,c,W,de,Qe){"use strict";const Ie=({variant:t="primary",loading:g=!1,children:p,...u})=>{const d=w=>{switch(w){case"primary":return"primary";case"ghost":return"default";case"dashed":return"dashed";case"link":return"link";case"text":return"text";default:return"primary"}};return l.jsx(W.Button,{...u,type:d(t),loading:g,ghost:t==="ghost",children:p})};Ie.__docgenInfo={displayName:"Button",description:"基础按钮,用于触发操作",props:{variant:{name:"variant",required:!1,description:"视觉风格",type:{name:"ButtonVariant",raw:'"primary" | "ghost" | "dashed" | "link" | "text"'},defaultValue:{value:'"primary"'}},loading:{name:"loading",required:!1,description:"是否加载中",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},children:{name:"children",required:!1,description:"按钮内容",type:{name:"ReactNode",raw:"React.ReactNode"}},size:{name:"size",required:!1,description:"按钮大小",type:{name:"ButtonSize",raw:'"small" | "middle" | "large"'}},disabled:{name:"disabled",required:!1,description:"是否禁用",type:{name:"boolean",raw:"boolean"}},onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"(event: MouseEvent) => void"}}}};const Be=({title:t,children:g,bordered:p=!0,hoverable:u=!1,size:d="default",...w})=>l.jsx(W.Card,{...w,title:t,bordered:p,hoverable:u,size:d,children:g});Be.__docgenInfo={displayName:"Card",description:"卡片容器,用于分组内容",props:{title:{name:"title",required:!1,description:"标题",type:{name:"ReactNode",raw:"React.ReactNode"}},children:{name:"children",required:!1,description:"内容区域",type:{name:"ReactNode",raw:"React.ReactNode"}},bordered:{name:"bordered",required:!1,description:"是否显示边框",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},hoverable:{name:"hoverable",required:!1,description:"是否可悬停",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},size:{name:"size",required:!1,description:"卡片大小",type:{name:"CardSize",raw:'"default" | "small"'},defaultValue:{value:'"default"'}},loading:{name:"loading",required:!1,description:"是否加载中",type:{name:"boolean",raw:"boolean"}},actions:{name:"actions",required:!1,description:"卡片操作组",type:{name:"ReactNode[]",raw:"React.ReactNode[]"}}}};const Ve=({showDefaultFooter:t=!0,...g})=>{const p=g.footer!==void 0?g.footer:t?(u,{OkBtn:d,CancelBtn:w})=>l.jsxs(l.Fragment,{children:[l.jsx(d,{}),l.jsx(w,{})]}):null;return l.jsx(W.Modal,{...g,footer:p})};Ve.__docgenInfo={displayName:"AppModal",description:"应用级模态框组件,基于 Ant Design Modal 封装",props:{showDefaultFooter:{name:"showDefaultFooter",required:!1,description:"是否显示默认的确定和取消按钮",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},title:{name:"title",required:!1,description:"模态框标题",type:{name:"ReactNode",raw:"React.ReactNode"}},open:{name:"open",required:!1,description:"是否显示模态框",type:{name:"boolean",raw:"boolean"}},onCancel:{name:"onCancel",required:!1,description:"取消按钮点击事件",type:{name:"function",raw:"(e: React.MouseEvent<HTMLElement>) => void"}},onOk:{name:"onOk",required:!1,description:"确定按钮点击事件",type:{name:"function",raw:"(e: React.MouseEvent<HTMLElement>) => void"}},children:{name:"children",required:!1,description:"模态框内容",type:{name:"ReactNode",raw:"React.ReactNode"}},width:{name:"width",required:!1,description:"模态框宽度",type:{name:"string | number",raw:"string | number"}},centered:{name:"centered",required:!1,description:"是否居中显示",type:{name:"boolean",raw:"boolean"}},maskClosable:{name:"maskClosable",required:!1,description:"点击蒙层是否允许关闭",type:{name:"boolean",raw:"boolean"}}}};const _e=({scrollX:t,showPagination:g=!0,defaultPageSize:p=10,...u})=>l.jsx(W.Table,{...u,scroll:{x:t||"max-content",y:"50vh"},pagination:g?{hideOnSinglePage:!0,showSizeChanger:!0,showQuickJumper:!0,defaultPageSize:p,...u.pagination}:!1});_e.__docgenInfo={displayName:"PageTable",description:"页面级表格组件,高度铺满容器,自动滚动",props:{scrollX:{name:"scrollX",required:!1,description:"水平滚动宽度",type:{name:"number",raw:"number"}},showPagination:{name:"showPagination",required:!1,description:"是否显示分页器",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},defaultPageSize:{name:"defaultPageSize",required:!1,description:"默认页面大小",type:{name:"number",raw:"number"},defaultValue:{value:"10"}},columns:{name:"columns",required:!1,description:"表格列配置",type:{name:"ColumnType[]",raw:"ColumnType<any>[]"}},dataSource:{name:"dataSource",required:!1,description:"数据源",type:{name:"any[]",raw:"any[]"}},loading:{name:"loading",required:!1,description:"是否加载中",type:{name:"boolean",raw:"boolean"}},rowKey:{name:"rowKey",required:!1,description:"行数据的 Key",type:{name:"string | function",raw:"string | ((record: any) => string)"}}}};const Ye=de.createFromIconfontCN({scriptUrl:["https://at.alicdn.com/t/c/font_4968458_eh91gfr4j9e.js"]}),Ge=({name:t,size:g,color:p,style:u,...d})=>{const w={fontSize:g,color:p,...u};return l.jsx(Ye,{...d,type:t,style:w})};Ge.__docgenInfo={displayName:"XcIcon",description:"自定义图标组件,基于 iconfont",props:{name:{name:"name",required:!0,description:"图标名称",type:{name:"string",raw:"string"}},size:{name:"size",required:!1,description:"图标大小",type:{name:"number | string",raw:"number | string"}},color:{name:"color",required:!1,description:"图标颜色",type:{name:"string",raw:"string"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},style:{name:"style",required:!1,description:"自定义样式",type:{name:"CSSProperties",raw:"React.CSSProperties"}}}};const De=({loading:t,description:g="暂无数据",className:p,emptyChildren:u,loadingText:d,emptyImage:w})=>t?l.jsxs(W.Flex,{className:`pt-10 w-full ${p||""}`,align:"center",justify:"center",vertical:!0,children:[l.jsx(W.Spin,{size:"large"}),d&&l.jsx("div",{className:"mt-4 text-gray-500",children:d})]}):l.jsx(W.Flex,{className:`pt-10 w-full ${p||""}`,align:"center",justify:"center",children:l.jsx(W.Empty,{image:w,description:g,imageStyle:{height:180},children:u})});De.__docgenInfo={displayName:"EmptyAndSpin",description:"空状态和加载状态组合组件",props:{loading:{name:"loading",required:!0,description:"是否加载中",type:{name:"boolean",raw:"boolean"}},description:{name:"description",required:!1,description:"空状态描述",type:{name:"ReactNode",raw:"React.ReactNode"},defaultValue:{value:'"暂无数据"'}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},emptyChildren:{name:"emptyChildren",required:!1,description:"空状态额外内容",type:{name:"ReactNode",raw:"React.ReactNode"}},loadingText:{name:"loadingText",required:!1,description:"加载中提示文字",type:{name:"string",raw:"string"}},emptyImage:{name:"emptyImage",required:!1,description:"空状态图片",type:{name:"string",raw:"string"}}}};const Pe=({onClick:t,showText:g=!1,className:p,size:u="small",type:d="default"})=>l.jsx(W.Button,{size:u,type:d,icon:l.jsx(de.LeftOutlined,{}),className:`cursor-pointer ${p||""}`,onClick:t,children:g&&"返回"});Pe.__docgenInfo={displayName:"BackButton",description:"返回按钮组件",props:{onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"() => void"}},showText:{name:"showText",required:!1,description:"是否显示文字",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},size:{name:"size",required:!1,description:"按钮大小",type:{name:"ButtonSize",raw:'"small" | "middle" | "large"'},defaultValue:{value:'"small"'}},type:{name:"type",required:!1,description:"按钮类型",type:{name:"ButtonType",raw:'"primary" | "default" | "dashed" | "link" | "text"'},defaultValue:{value:'"default"'}}}};const Me=({removePadding:t=!0,className:g,...p})=>{const u=t?`px-0 h-auto ${g||""}`:g;return l.jsx(W.Button,{type:"link",...p,className:u,children:p.children})};Me.__docgenInfo={displayName:"LinkButton",description:"链接样式按钮组件,适用于表格操作列",props:{removePadding:{name:"removePadding",required:!1,description:"是否去除默认内边距",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},children:{name:"children",required:!1,description:"按钮内容",type:{name:"ReactNode",raw:"React.ReactNode"}},onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"(event: React.MouseEvent<HTMLButtonElement>) => void"}},disabled:{name:"disabled",required:!1,description:"是否禁用",type:{name:"boolean",raw:"boolean"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}}}};const{Option:Ze}=W.Select,He=({columns:t,request:g,searchFields:p=[],showSearch:u=!0,showRefresh:d=!0,defaultPageSize:w=10,pageSizeOptions:I=["10","20","50","100"],autoLoad:C=!0,externalParams:T={},...e})=>{const[L,h]=c.useState([]),[i,n]=c.useState(!1),[a,o]=c.useState({current:1,pageSize:w,total:0}),[r,s]=c.useState({}),[f,v]=c.useState({}),[x]=W.Form.useForm(),D=c.useRef(a);D.current=a;const S=c.useRef(T);S.current=T;const G=c.useRef(!1),F=c.useMemo(()=>t.map(N=>{const{sortable:H,render:te,...ae}=N;return{...ae,sorter:H?!0:void 0,render:te||(se=>se)}}),[t]),M=c.useCallback(async(N={})=>{if(g){n(!0);try{const H={page:D.current.current,pageSize:D.current.pageSize,sortField:f.field,sortOrder:f.order,searchParams:{...r,...S.current},...N},te=await g(H);te.success&&(h(te.data),o(ae=>({...ae,total:te.total,current:H.page||ae.current})))}catch(H){console.error("加载数据失败:",H)}finally{n(!1)}}},[g,f,r]),U=c.useCallback(N=>{s(N),o(H=>({...H,current:1}))},[]),J=c.useCallback(()=>{x.resetFields(),s({}),o(N=>({...N,current:1}))},[x]),Q=c.useCallback(()=>{M()},[M]),Z=c.useCallback((N,H,te)=>{const ae={current:N.current||1,pageSize:N.pageSize||w,total:N.total||0},se={field:te?.field,order:te?.order};o(ae),v(se)},[w]);return c.useEffect(()=>{const N=Object.keys(T).length>0;(C&&!G.current||N)&&(M(),G.current=!0)},[C,T,M]),l.jsxs("div",{children:[u&&p.length>0&&l.jsx(W.Card,{size:"small",style:{marginBottom:16},children:l.jsxs(W.Form,{form:x,layout:"inline",onFinish:U,initialValues:p.reduce((N,H)=>(H.defaultValue!==void 0&&(N[H.key]=H.defaultValue),N),{}),children:[p.map(N=>l.jsx(W.Form.Item,{name:N.key,label:N.label,children:N.type==="input"?l.jsx(W.Input,{placeholder:N.placeholder||`请输入${N.label}`,style:{width:200}}):l.jsx(W.Select,{placeholder:N.placeholder||`请选择${N.label}`,style:{width:200},allowClear:!0,children:N.options?.map(H=>l.jsx(Ze,{value:H.value,children:H.label},H.value))})},N.key)),l.jsx(W.Form.Item,{children:l.jsxs(W.Space,{children:[l.jsx(W.Button,{type:"primary",htmlType:"submit",icon:l.jsx(de.SearchOutlined,{}),children:"查询"}),l.jsx(W.Button,{onClick:J,children:"重置"}),d&&l.jsx(W.Button,{icon:l.jsx(de.ReloadOutlined,{}),onClick:Q,children:"刷新"})]})})]})}),l.jsx(W.Table,{...e,columns:F,dataSource:L,loading:i,pagination:{...a,showSizeChanger:!0,showQuickJumper:!0,showTotal:(N,H)=>`第 ${H[0]}-${H[1]} 条/共 ${N} 条`,pageSizeOptions:I},onChange:Z,scroll:{x:"max-content",y:"50vh"}})]})};He.__docgenInfo={displayName:"AdvancedTable",description:"高阶表格组件,支持异步请求、搜索、排序等功能",props:{columns:{name:"columns",required:!0,description:"列配置",type:{name:"AdvancedColumnType[]",raw:"AdvancedColumnType<any>[]"}},request:{name:"request",required:!1,description:"异步请求函数",type:{name:"function",raw:"(params: RequestParams) => Promise<RequestResponse>"}},searchFields:{name:"searchFields",required:!1,description:"搜索字段配置",type:{name:"SearchFieldConfig[]",raw:"SearchFieldConfig[]"},defaultValue:{value:"[]"}},showSearch:{name:"showSearch",required:!1,description:"是否显示搜索区域",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},showRefresh:{name:"showRefresh",required:!1,description:"是否显示刷新按钮",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},defaultPageSize:{name:"defaultPageSize",required:!1,description:"默认页面大小",type:{name:"number",raw:"number"},defaultValue:{value:"10"}},pageSizeOptions:{name:"pageSizeOptions",required:!1,description:"页面大小选项",type:{name:"string[]",raw:"string[]"},defaultValue:{value:'["10", "20", "50", "100"]'}},autoLoad:{name:"autoLoad",required:!1,description:"是否自动加载",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},externalParams:{name:"externalParams",required:!1,description:"外部请求参数",type:{name:"Record<string, any>",raw:"Record<string, any>"},defaultValue:{value:"{}"}}}};function he(t,g,p){if(!t.current)return;const u=new Set,d={};for(const h of g)h.exclusionGroup&&h.exclusionGroup!=="separator"&&(u.add(h.exclusionGroup),d[h.exclusionGroup]||(d[h.exclusionGroup]=[]),d[h.exclusionGroup].push({type:h.type,key:h.key,exclusionGroup:h.exclusionGroup}));const w={};for(const h of u){w[h]=!1;for(const i of d[h])if(i.type==="upload"&&i.key){if(p[i.key]!==null&&p[i.key]!==void 0){w[h]=!0;break}}else if(i.type==="variable"&&i.key){const n=t.current.querySelector(`[data-type="variable"][data-key="${i.key}"]`);if(n&&n.innerText.replace(/[\u200B\n]/g,"").trim().length>0){w[h]=!0;break}}}const I=g.some(h=>h.exclusionGroup==="separator"),T=Object.keys(w).filter(h=>w[h]).length>0;let e=null;if(T&&I){for(const h of g)if(h.exclusionGroup&&h.exclusionGroup!=="separator"&&w[h.exclusionGroup]){e=h.exclusionGroup;break}}for(const h of u){const i=t.current.querySelectorAll(`[data-group="${h}"]`);I&&T&&e?h===e?i.forEach(n=>{n.classList.contains("required-upload-group")?n.style.setProperty("display","inline-flex","important"):(n.classList.contains("exclusion-wrapper"),n.style.setProperty("display","inline-block","important"))}):i.forEach(n=>{n.style.display="none",n.style.setProperty("display","none","important")}):i.forEach(n=>{n.classList.contains("required-upload-group")?n.style.setProperty("display","inline-flex","important"):(n.classList.contains("exclusion-wrapper"),n.style.setProperty("display","inline-block","important"))})}t.current.querySelectorAll('[data-group="separator"]').forEach(h=>{h.style.display=T?"none":"inline"})}function ve(t,g,p,u){if(!t.current){u(!1);return}const d=[];for(let i=0;i<g.length;i++){const n=g[i];if((n.type==="variable"||n.type==="upload"||n.type==="multi-variable"||n.type==="select"||n.type==="textarea"||n.type==="richtext"||n.type==="datepicker")&&n.required&&n.key){d.push({exclusionGroup:n.exclusionGroup||"",key:n.key,type:n.type==="multi-variable"?"variable":n.type,isMultiVariable:n.type==="multi-variable",minCount:n.type==="multi-variable"?n.minCount:void 0});continue}if(n.type==="text"&&n.className?.includes("rte-text-required"))if(n.exclusionGroup)for(let a=i+1;a<g.length;a++){const o=g[a];if(o.exclusionGroup===n.exclusionGroup&&(o.type==="variable"||o.type==="upload"||o.type==="select"||o.type==="textarea"||o.type==="richtext"||o.type==="datepicker")&&o.key){d.push({exclusionGroup:n.exclusionGroup,key:o.key,type:o.type});break}}else for(let a=i+1;a<g.length;a++){const o=g[a];if((o.type==="variable"||o.type==="upload"||o.type==="select"||o.type==="textarea"||o.type==="richtext"||o.type==="datepicker")&&o.key){d.push({exclusionGroup:o.exclusionGroup||"",key:o.key,type:o.type});break}}}const w=g.some(i=>i.exclusionGroup==="separator"),I=[];if(w&&d.length>1){const i=[];g.forEach((n,a)=>{n.exclusionGroup==="separator"&&i.push(a)});for(const n of i){let a=null;for(let r=n-1;r>=0;r--){const s=g[r];if((s.type==="variable"||s.type==="upload"||s.type==="select"||s.type==="textarea"||s.type==="richtext"||s.type==="datepicker")&&s.key){const f=d.find(v=>v.key===s.key);if(f){a=f;break}}}let o=null;for(let r=n+1;r<g.length;r++){const s=g[r];if((s.type==="variable"||s.type==="upload"||s.type==="select"||s.type==="textarea"||s.type==="richtext"||s.type==="datepicker")&&s.key){const f=d.find(v=>v.key===s.key);if(f){o=f;break}}}a&&o&&I.push([a,o])}}if(d.length===0){if(g.length===0){if(!t.current){u(!1);return}const i=t.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";u(i.length>0);return}u(!0);return}const C=d.filter(i=>{if(!t.current)return!1;if(i.exclusionGroup){const n=t.current.querySelectorAll(`[data-group="${i.exclusionGroup}"]`);if(n.length>0)return n[0].style.display!=="none"}if(i.type==="upload"&&i.key){const n=t.current.querySelector(`[data-type="upload"][data-key="${i.key}"]`);if(n){const a=n.closest("[data-group]")||n.parentElement;return a?a.style.display!=="none":!0}}else if(i.type==="variable"&&i.key)if(i.isMultiVariable){const n=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${i.key}"]`);if(n.length>0){const a=n[0],o=a.closest("[data-group]")||a.parentElement;return o?o.style.display!=="none":!0}}else{const n=t.current.querySelector(`[data-type="variable"][data-key="${i.key}"]`);if(n){const a=n.closest("[data-group]")||n.parentElement;return a?a.style.display!=="none":!0}}else if(i.type==="select"&&i.key){const n=t.current.querySelector(`[data-type="select"][data-key="${i.key}"]`);if(n){const a=n.closest("[data-group]")||n.parentElement;return a?a.style.display!=="none":!0}}else if(i.type==="textarea"&&i.key){const n=t.current.querySelector(`[data-type="textarea"][data-key="${i.key}"]`);if(n){const a=n.closest("[data-group]")||n.parentElement;return a?a.style.display!=="none":!0}}else if(i.type==="richtext"&&i.key){const n=t.current.querySelector(`[data-type="richtext"][data-key="${i.key}"]`);if(n){const a=n.closest("[data-group]")||n.parentElement;return a?a.style.display!=="none":!0}}else if(i.type==="datepicker"&&i.key){const n=t.current.querySelector(`[data-type="datepicker"][data-key="${i.key}"]`);if(n){const a=n.closest("[data-group]")||n.parentElement;return a?a.style.display!=="none":!0}}return!1});if(C.length===0){u(!0);return}const T=new Set;I.forEach(i=>{i.forEach(n=>{n.key&&T.add(n.key)})});const e=C.filter(i=>!i.key||!T.has(i.key));let L=(I.length===0,!0);for(const i of I){const n=i.filter(o=>{if(!t.current)return!1;if(o.exclusionGroup){const r=t.current.querySelectorAll(`[data-group="${o.exclusionGroup}"]`);if(r.length>0)return r[0].style.display!=="none"}return!0});if(n.length===0)continue;let a=!1;for(const o of n)if(o.type==="upload"&&o.key){if(p[o.key]!==null&&p[o.key]!==void 0){a=!0;break}}else if(o.type==="variable"&&o.key)if(o.isMultiVariable){const r=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${o.key}"]`);let s=0;for(const v of Array.from(r))v.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&(s+=1);const f=o.minCount&&o.minCount>0?o.minCount:1;if(s>=f){a=!0;break}}else{const r=t.current.querySelector(`[data-type="variable"][data-key="${o.key}"]`);if(r&&r.innerText.replace(/[\u200B\n]/g,"").trim().length>0){a=!0;break}}else if(o.type==="select"&&o.key){const r=t.current.querySelector(`[data-type="select"][data-key="${o.key}"]`);if(r&&(r.value||"").trim().length>0){a=!0;break}}else if(o.type==="textarea"&&o.key){const r=t.current.querySelector(`[data-type="textarea"][data-key="${o.key}"]`);if(r&&(r.value||"").trim().length>0){a=!0;break}}else if(o.type==="richtext"&&o.key){const r=t.current.querySelector(`[data-type="richtext"][data-key="${o.key}"]`);if(r&&(r.textContent||"").replace(/[\u200B]/g,"").trim().length>0){a=!0;break}}else if(o.type==="datepicker"&&o.key){const r=t.current.querySelector(`[data-type="datepicker"][data-key="${o.key}"]`);if(r&&(r.getAttribute("data-value")||"").trim().length>0){a=!0;break}}if(!a){L=!1;break}}let h=!0;for(const i of e)if(i.type==="upload"&&i.key){if(p[i.key]===null||p[i.key]===void 0){h=!1;break}}else if(i.type==="variable"&&i.key)if(i.isMultiVariable){const n=t.current.querySelectorAll(`[data-type="variable"][data-multi-key="${i.key}"]`);let a=0;for(const r of Array.from(n))r.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&(a+=1);const o=i.minCount&&i.minCount>0?i.minCount:1;if(a<o){h=!1;break}}else{const n=t.current.querySelector(`[data-type="variable"][data-key="${i.key}"]`);if(!n){h=!1;break}if(n.innerText.replace(/[\u200B\n]/g,"").trim().length===0){h=!1;break}}else if(i.type==="select"&&i.key){const n=t.current.querySelector(`[data-type="select"][data-key="${i.key}"]`);if(!n||(n.value||"").trim().length===0){h=!1;break}}else if(i.type==="textarea"&&i.key){const n=t.current.querySelector(`[data-type="textarea"][data-key="${i.key}"]`);if(!n||(n.value||"").trim().length===0){h=!1;break}}else if(i.type==="richtext"&&i.key){const n=t.current.querySelector(`[data-type="richtext"][data-key="${i.key}"]`);if(!n||(n.textContent||"").replace(/[\u200B]/g,"").trim().length===0){h=!1;break}}else if(i.type==="datepicker"&&i.key){const n=t.current.querySelector(`[data-type="datepicker"][data-key="${i.key}"]`);if(!n||(n.getAttribute("data-value")||"").trim().length===0){h=!1;break}}u(L&&h)}function qe(t,g){if(!t.current)return;t.current.querySelectorAll('[data-type="variable"]').forEach(u=>{const d=u.innerText.replace(/\n/g,"");d.replace(/\u200B/g,"")?u.classList.remove("show-placeholder"):(d!=="​"&&(u.innerText="​"),u.classList.add("show-placeholder"))})}function Re(t,g,p,u,d,w={},I){if(!t.current)return;let C="",T=0;for(;T<g.length;){const e=g[T],L=T+1<g.length?g[T+1]:null;if(e.type==="text"&&(e.text?.includes("icon-bitian")||e.className==="rte-text-required")&&L){const r=L.type==="upload"&&L.exclusionGroup==="fileInput"&&e.exclusionGroup==="fileInput"&&e.exclusionGroup===L.exclusionGroup,s=L.type==="variable"&&L.exclusionGroup==="textInput"&&e.exclusionGroup==="textInput"&&e.exclusionGroup===L.exclusionGroup;if(r){const v=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group">`,x="</span>";let D="";e.className?D=`<span class="${e.className}">${e.text??""}</span>`:D=e.text??"";const S=L,G=p[S.key]!==null&&p[S.key]!==void 0,F=G?p[S.key]:null,M=G?p[S.key]?.name:S.text,U=G?"":"hidden",J=S.tooltip&&!G?"":"hidden",Q=G?"has-file":"",Z=G&&M?` data-file-name="${M.replace(/"/g,"&quot;")}"`:"";let N="";G&&F&&(F.type?.startsWith("image/")?N=`<img class="upload-icon-img upload-icon-preview" src="${URL.createObjectURL(F)}" alt="preview" />`:N="<i class='iconfont icon-exlwenjian'></i>");const H=`<span contenteditable="false" data-type="upload" data-key="${S.key}" class="upload-chip"><span class="upload-inner-wrapper ${Q}"><span class="upload-icon">${N}</span><span class="upload-label"${Z}>${M||S.text}</span>${S.tooltip?`<i contenteditable="false" class="iconfont icon-tishi upload-info-icon ${J}" data-upload-key="${S.key}" data-tooltip="${S.tooltip}" title="提示"></i>`:""}<span class="file-remove-btn ${U}" title="移除文件">×</span></span></span>`;C+=v+D+H+x,T+=2;continue}if(s){const v=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group">`,x="</span>";let D="";e.className?D=`<span class="${e.className}">${e.text??""}</span>`:D=e.text??"";const S=L,F=(S.key?d[S.key]:void 0)||S.text||"",M=!F,U=M?"​":F,J=M?"show-placeholder":"",Q=S.exclusionGroup?` data-group="${S.exclusionGroup}"`:"",Z=S.tooltip?` data-tooltip="${S.tooltip.replace(/"/g,"&quot;")}" data-variable-key="${S.key||""}"`:"",N=S.tooltip&&M?"":"hidden",H=`<span contenteditable="true" data-type="variable" data-key="${S.key}" data-placeholder="${S.placeholder||""}"${Q}${Z} class="variable-chip ${J}">${U}${S.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${N}" data-variable-key="${S.key}" data-tooltip="${S.tooltip.replace(/"/g,"&quot;")}" title="提示"></i>`:""}</span>`;C+=v+D+H+x,T+=2;continue}}const i=e.exclusionGroup?`data-group="${e.exclusionGroup}"`:"",n=e.exclusionGroup?`<span ${i} class="exclusion-wrapper">`:"",a=e.exclusionGroup?"</span>":"";let o="";if(e.type==="tag"){const s=u||I==="hideTagClose"?"":'<span class="tag-close-btn" title="Clear (ESC)"><svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6L6 18M6 6l12 12"/></svg></span>',f=u?' data-locked="true"':"",v=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,"&quot;")}" data-tag-key="${e.key||""}"`:"";o=`<span contenteditable="false" class="tag-node group"${f}${v}><span class="tag-label">${e.text}</span>${s}</span>`}else if(e.type==="text"){const r=u?' data-locked="true" contenteditable="false"':' contenteditable="false"',f=(e.text??"").replace(/\n/g,"<br/>");e.className?o=`<span class="${e.className}"${r}>${f}</span>`:o=u?`<span${r}>${f}</span>`:`<span contenteditable="false">${f}</span>`}else if(e.type==="variable"&&e.key){const s=d[e.key]||e.text||"",f=!s,v=f?"​":s,x=f?"show-placeholder":"",D=e.exclusionGroup?` data-group="${e.exclusionGroup}"`:"",S=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,"&quot;")}" data-variable-key="${e.key||""}"`:"",G=e.tooltip&&f?"":"hidden",F=`<span contenteditable="true" data-type="variable" data-key="${e.key}" data-placeholder="${e.placeholder||""}"${D}${S} class="variable-chip ${x}">${v}${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${G}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,"&quot;")}" title="提示"></i>`:""}</span>`;e.required?o=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${F}</span>`:o=F}else if(e.type==="upload"&&e.key){const r=p[e.key]!==null&&p[e.key]!==void 0,s=r?p[e.key]:null,f=r?p[e.key]?.name:e.text,v=r?"":"hidden",x=e.tooltip&&!r?"":"hidden",D=r?"has-file":"",S=r&&f?` data-file-name="${f.replace(/"/g,"&quot;")}"`:"";let G="";r&&s&&(s.type?.startsWith("image/")?G=`<img class="upload-icon-img upload-icon-preview" src="${URL.createObjectURL(s)}" alt="preview" />`:G="<i class='iconfont icon-exlwenjian'></i>");const F=`<span contenteditable="false" data-type="upload" data-key="${e.key}" class="upload-chip"><span class="upload-inner-wrapper ${D}"><span class="upload-icon">${G}</span><span class="upload-label"${S}>${f||e.text}</span>${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi upload-info-icon ${x}" data-upload-key="${e.key}" data-tooltip="${e.tooltip}" title="提示"></i>`:""}<span class="file-remove-btn ${v}" title="移除文件">×</span></span></span>`;e.required?o=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${F}</span>`:o=F}else if(e.type==="select"&&e.key){const r=d[e.key]??e.text??"",s=(e.options||[]).map(S=>{const G=r===S.value?"selected":"";return`<option value="${S.value}" ${G}>${S.label}</option>`}).join(""),f=e.placeholder?`<option value="" ${r?"":"selected"} disabled hidden>${e.placeholder}</option>`:"",D=`<span class="rte-select-wrapper">${`<select data-type="select" data-key="${e.key}" class="rte-select rte-select-has-icon">${f}${s}</select>`}<i class="iconfont icon-qiehuan-xiayizhang rte-select-icon"></i></span>`;e.required?o=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${D}</span>`:o=D}else if(e.type==="textarea"&&e.key){const r=d[e.key]||"",s=e.maxHeight||252,f=e.expandable!==!1,v=e.placeholder?` placeholder="${e.placeholder}"`:"",x=`<textarea data-type="textarea" data-key="${e.key}" class="rte-textarea" data-max-height="${s}" style="max-height:${s}px;"${v}>${r}</textarea>`,D=f?`<button type="button" class="rte-textarea-toggle" data-key="${e.key}" data-expanded="false">展开</button>`:"",S=`<div class="rte-textarea-wrapper" data-key="${e.key}">${x}${D}</div>`;e.required?o=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${S}</span>`:o=S}else if(e.type==="richtext"&&e.key){const r=d[e.key]||e.text||"",s=e.minHeight||140,f=e.placeholder?` data-placeholder="${e.placeholder}"`:"",v=e.expandable!==!1,x=r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),D=`<div contenteditable="true" data-type="richtext" data-key="${e.key}" class="rte-richtext"${f} style="min-height:${s}px;">${x}</div>`,S=v?`<button type="button" class="rte-richtext-toggle" data-key="${e.key}" data-expanded="false"><i class="iconfont icon-zhankai2"></i><span class="rte-richtext-toggle-label">展开</span></button>`:"",G=`<div class="rte-richtext-wrapper" data-key="${e.key}">${D}${S}</div>`,F=`<div class="rte-richtext-container" data-key="${e.key}">${G}</div>`;e.required?o=`<div ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group rte-richtext-required"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${F}</div>`:o=F}else if(e.type==="datepicker"&&e.key){const r=d[e.key]||"",s=e.placeholder?` data-placeholder="${e.placeholder}"`:"",f=`<div data-type="datepicker" data-key="${e.key}" data-value="${r}" class="rte-datepicker-host"${s}></div>`;e.required?o=`<span ${e.exclusionGroup?`data-group="${e.exclusionGroup}"`:""} class="exclusion-wrapper required-upload-group"><span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>${f}</span>`:o=f}else if(e.type==="multi-variable"&&e.key){const r=e.maxCount||9,s=w[e.key]||1,f=Math.min(s,r);if(e.required){const v=`<span class="rte-text-required"><i class='iconfont icon-bitian' style='font-size: 10px;'></i></span>`,x=e.exclusionGroup?`data-group="${e.exclusionGroup}"`:"";let D="";for(let S=0;S<f;S++){const G=`${e.key}_${S}`,F=d[G]||"",M=!F,U=M?"​":F,J=M?"show-placeholder":"",Q=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,"&quot;")}" data-variable-key="${e.key||""}"`:"",Z=e.tooltip&&M?"":"hidden",N=`<span contenteditable="true" data-type="variable" data-key="${G}" data-multi-key="${e.key}" data-index="${S}" data-placeholder="${e.placeholder||""}"${Q} class="variable-chip ${J}">${U}${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${Z}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,"&quot;")}" title="提示"></i>`:""}</span>`;S===0?D+=`<span ${x} class="exclusion-wrapper required-upload-group required-multi-first">${v}${N}</span>`:D+=N}o=D}else{let v="";for(let x=0;x<f;x++){const D=`${e.key}_${x}`,S=d[D]||"",G=!S,F=G?"​":S,M=G?"show-placeholder":"",U=e.tooltip?` data-tooltip="${e.tooltip.replace(/"/g,"&quot;")}" data-variable-key="${e.key||""}"`:"",J=e.tooltip&&G?"":"hidden",Q=`<span contenteditable="true" data-type="variable" data-key="${D}" data-multi-key="${e.key}" data-index="${x}" data-placeholder="${e.placeholder||""}"${U} class="variable-chip ${M}">${F}${e.tooltip?`<i contenteditable="false" class="iconfont icon-tishi variable-info-icon ${J}" data-variable-key="${e.key}" data-tooltip="${e.tooltip.replace(/"/g,"&quot;")}" title="提示"></i>`:""}</span>`;v+=Q}o=v}}C+=n+o+a,T++}t.current&&(t.current.innerHTML=C,setTimeout(()=>{if(!t.current)return;t.current.querySelectorAll('[data-type="variable"]').forEach(L=>{const h=L.innerText.replace(/\n/g,"");h.replace(/\u200B/g,"")?L.classList.remove("show-placeholder"):(h!=="​"&&(L.innerText="​"),L.classList.add("show-placeholder"))})},0))}function et(t,g,p,u,d={},w,I,C){const T=c.useCallback(()=>{if(!t.current)return;if(g.length===0){t.current.innerHTML="";return}let e={};const h=t.current.__tempVariableValues;if(h?(e=h,setTimeout(()=>{if(t.current){const i=t.current;i.__tempVariableValues===h&&delete i.__tempVariableValues}},100)):(t.current.querySelectorAll('[data-type="variable"]').forEach(s=>{const f=s.dataset.key;if(f){const v=s.innerText.replace(/[\u200B\n]/g,"").trim();v&&(e[f]=v)}}),t.current.querySelectorAll('[data-type="select"]').forEach(s=>{const f=s.dataset.key;if(f){const v=s.value.trim();v&&(e[f]=v)}}),t.current.querySelectorAll('[data-type="textarea"]').forEach(s=>{const f=s.dataset.key;if(f){const v=s.value.replace(/[\u200B]/g,"").trim();v&&(e[f]=v)}}),t.current.querySelectorAll('[data-type="richtext"]').forEach(s=>{const f=s.dataset.key;if(f){const v=(s.textContent||"").replace(/[\u200B]/g,"").trim();v&&(e[f]=v)}}),t.current.querySelectorAll('[data-type="datepicker"]').forEach(s=>{const f=s.dataset.key;if(f){const v=(s.getAttribute("data-value")||"").trim();v&&(e[f]=v)}})),Re(t,g,p,u,e,d,C),w?.current){const{key:i,offset:n}=w.current;setTimeout(()=>{if(!t.current)return;const a=t.current.querySelector(`[data-type="variable"][data-key="${i}"]`);if(a){try{const o=document.createRange(),r=document.createTreeWalker(a,NodeFilter.SHOW_TEXT,null);let s=0,f=null,v=0;for(;r.nextNode();){const x=r.currentNode,D=x.textContent?.length||0;if(s+D>=n){f=x,v=n-s;break}s+=D}if(f){o.setStart(f,Math.min(v,f.textContent?.length||0)),o.collapse(!0);const x=window.getSelection();x&&(x.removeAllRanges(),x.addRange(o),a.focus())}else{o.selectNodeContents(a),o.collapse(!1);const x=window.getSelection();x&&(x.removeAllRanges(),x.addRange(o),a.focus())}}catch{const o=document.createRange();o.selectNodeContents(a),o.collapse(!1);const r=window.getSelection();r&&(r.removeAllRanges(),r.addRange(o),a.focus())}w.current=null}},0)}},[g,p,u,t,d,w,I,C]);c.useEffect(()=>{T()},[T])}function tt(t,g,p,u){c.useEffect(()=>{const d=t.current;if(!d)return;const w=C=>{const T=C.target?.closest(".upload-info-icon");if(T&&T.classList.contains("upload-info-icon")){const L=T.dataset.uploadKey;L&&u({key:L,anchorEl:T,type:"upload"});return}const e=C.target?.closest('[data-type="upload"]');if(e){const L=e.dataset.key;if(L){const h=p[L];h&&h.type&&h.type.startsWith("image/")&&u({key:L,anchorEl:e,type:"upload-preview"})}}},I=C=>{const T=C.target?.closest(".upload-info-icon"),e=C.relatedTarget;if(T&&T.classList.contains("upload-info-icon")){!e||!d.contains(e)?u(null):e.closest(".upload-info-icon")||u(null);return}const L=C.target?.closest('[data-type="upload"]');if(L){const h=e;if(h&&L.contains(h))return;u(null)}};return d.addEventListener("mouseover",w,!0),d.addEventListener("mouseout",I,!0),()=>{d.removeEventListener("mouseover",w,!0),d.removeEventListener("mouseout",I,!0)}},[g,p,t,u])}function at(t,g,p,u){c.useEffect(()=>{if(!t.current)return;const d=T=>{if(u==="hideTagClose")return;const e=T.currentTarget,L=e.dataset.tooltip,h=e.dataset.tagKey||"";L&&p({key:h,anchorEl:e,type:"tag"})},w=()=>{p(null)};let I;const C=()=>{if(!t.current)return;t.current.querySelectorAll(".tag-node[data-tooltip]").forEach(e=>{e.addEventListener("mouseenter",d),e.addEventListener("mouseleave",w)})};return I=requestAnimationFrame(()=>{I=requestAnimationFrame(C)}),()=>{cancelAnimationFrame(I),t.current&&t.current.querySelectorAll(".tag-node[data-tooltip]").forEach(e=>{e.removeEventListener("mouseenter",d),e.removeEventListener("mouseleave",w)})}},[g,t,p,u])}function nt(t,g,p){c.useEffect(()=>{const u=t.current;if(!u)return;const d=I=>{const C=I.target?.closest(".variable-info-icon");if(C&&C.classList.contains("variable-info-icon")){const T=C.dataset.variableKey;T&&p({key:T,anchorEl:C,type:"variable"})}},w=I=>{const C=I.target?.closest(".variable-info-icon"),T=I.relatedTarget;C&&C.classList.contains("variable-info-icon")&&(!T||!u.contains(T)?p(null):T.closest(".variable-info-icon")||p(null))};return u.addEventListener("mouseover",d,!0),u.addEventListener("mouseout",w,!0),()=>{u.removeEventListener("mouseover",d,!0),u.removeEventListener("mouseout",w,!0)}},[g,t,p])}function rt(t,g,p,u){c.useEffect(()=>{if(!t.current)return;const d=T=>{const e=T.currentTarget;e.dataset.fileName&&u({key:"",anchorEl:e,type:"upload-label"})},w=()=>{u(null)};let I;const C=()=>{if(!t.current)return;t.current.querySelectorAll(".upload-label[data-file-name]").forEach(e=>{e.addEventListener("mouseenter",d),e.addEventListener("mouseleave",w)})};return I=requestAnimationFrame(()=>{I=requestAnimationFrame(C)}),()=>{cancelAnimationFrame(I),t.current&&t.current.querySelectorAll(".upload-label[data-file-name]").forEach(e=>{e.removeEventListener("mouseenter",d),e.removeEventListener("mouseleave",w)})}},[g,p,t,u])}function ot(t,g,p,u){c.useEffect(()=>{const d=setTimeout(()=>{he(t,g,p),ve(t,g,p,u)},0);return()=>clearTimeout(d)},[p,g,t,u]),c.useEffect(()=>{const d=t.current;if(!d)return;const w=I=>{const C=I.target;C&&C.matches('[data-type="select"]')&&(he(t,g,p),ve(t,g,p,u))};return d.addEventListener("change",w,!0),()=>{d.removeEventListener("change",w,!0)}},[g,p,t,u])}function lt(t,g){c.useEffect(()=>{if(!t.current)return;let p=!1,u=0;const d=()=>{p=!0},w=()=>{p=!1,u=Date.now()};let I=!1,C=0;const T=()=>{I=!0},e=()=>{I=!1,C=Date.now()},L=()=>{C=Date.now()},h=()=>{if(!t.current)return;const n=window.getSelection();if(!n||n.rangeCount===0||g.current||p||I||Date.now()-C<500)return;const a=n.getRangeAt(0);if(!a.collapsed)return t.current.contains(a.commonAncestorContainer),void 0;const o=n.anchorNode;if(!o||!t.current.contains(o))return;let r=null;if(o.nodeType===Node.ELEMENT_NODE?r=o.closest('[data-type="variable"]'):o.nodeType===Node.TEXT_NODE&&o.parentElement&&(r=o.parentElement.closest('[data-type="variable"]')),!r){if(Date.now()-u>500)return;const s=t.current.querySelectorAll('[data-type="variable"]');if(s.length>0){let f=null;for(const v of Array.from(s))if(v.style.display!=="none"){f=v;break}if(!f&&s.length>0&&(f=s[0]),f){const v=document.createRange();v.selectNodeContents(f),v.collapse(!1),n.removeAllRanges(),n.addRange(v),f.focus()}else n.removeAllRanges()}else n.removeAllRanges()}},i=t.current;return i&&(i.addEventListener("compositionstart",T),i.addEventListener("compositionend",e),i.addEventListener("input",L)),document.addEventListener("mousedown",d),document.addEventListener("mouseup",w),document.addEventListener("selectionchange",h),()=>{const n=t.current;n&&(n.removeEventListener("compositionstart",T),n.removeEventListener("compositionend",e),n.removeEventListener("input",L)),document.removeEventListener("mousedown",d),document.removeEventListener("mouseup",w),document.removeEventListener("selectionchange",h)}},[t,g])}const Oe=({config:t,onSend:g,isProcessing:p=!1,disabled:u=!1,width:d,lockStructure:w=!1,agentOptions:I=[],onAgentSelect:C,onAgentExit:T,loading:e=!1,placeholder:L,border:h,background:i="transparent",hideButtons:n})=>{const a=c.useRef(null),o=c.useRef(null),[r,s]=c.useState({}),[f,v]=c.useState(null),[x,D]=c.useState(null),S=c.useRef(!1),G=c.useRef(null),[F,M]=c.useState(!1),U=c.useRef(null),[J,Q]=c.useState(!0),[Z,N]=c.useState(()=>{const y={};return t.forEach(m=>{m.type==="multi-variable"&&m.key&&(y[m.key]=1)}),y}),H=c.useRef({}),te=c.useRef({}),ae=c.useRef({});c.useEffect(()=>{te.current=r},[r]),c.useEffect(()=>{ae.current=Z},[Z]);const se=c.useCallback(y=>y.find(b=>b.type==="tag")?.text||null,[]),fe=c.useRef(t),ie=c.useRef(null);c.useEffect(()=>{const y=se(fe.current),m=se(t);if(y&&y!==m&&a.current){const b={};a.current.querySelectorAll('[data-type="variable"]').forEach(E=>{const _=E.dataset.key;if(_){const $=E.innerText.replace(/[\u200B\n]/g,"").trim();$&&(b[_]=$)}}),a.current.querySelectorAll('[data-type="select"]').forEach(E=>{const _=E.dataset.key;if(_){const $=E.value.trim();$&&(b[_]=$)}}),a.current.querySelectorAll('[data-type="textarea"]').forEach(E=>{const _=E.dataset.key;if(_){const $=E.value.replace(/[\u200B]/g,"").trim();$&&(b[_]=$)}}),H.current[y]={variableValues:b,files:{...te.current},multiVariableCounts:{...ae.current}}}if(m&&H.current[m]){const b=H.current[m];ie.current=b,s(b.files),N(b.multiVariableCounts)}else if(m){ie.current=null;const b={};t.forEach(A=>{A.type==="multi-variable"&&A.key&&(b[A.key]=1)}),N(b),s({})}else ie.current=null,N({}),s({});fe.current=t},[t,se]),c.useLayoutEffect(()=>{ie.current&&a.current&&(a.current.__tempVariableValues=ie.current.variableValues,setTimeout(()=>{ie.current&&(ie.current=null)},0))}),et(a,t,r,w,Z,U,void 0,n),tt(a,t,r,D),at(a,t,D,n),rt(a,t,r,D),nt(a,t,D),ot(a,t,r,M),lt(a,S),c.useEffect(()=>{if(t.length>0){Q(!1);return}const y=()=>{if(!a.current){Q(!0);return}const b=a.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"",A=a.current.querySelectorAll('[data-type="variable"]'),k=a.current.querySelectorAll('[data-type="upload"]');let q=!1;A.forEach(_=>{(_.textContent?.replace(/[\u200B\n]/g,"").trim()||"")&&(q=!0)}),k.forEach(_=>{_.querySelector(".upload-inner-wrapper.has-file")&&(q=!0)});const E=!b&&!q;Q(E),t.length===0&&M(!E)};y();const m=new MutationObserver(y);return a.current&&m.observe(a.current,{childList:!0,subtree:!0,characterData:!0}),()=>{m.disconnect()}},[t]);const Se=y=>{if(u){y.preventDefault();return}y.preventDefault();const m=y.clipboardData.getData("text/plain"),b=window.getSelection();if(b&&b.rangeCount>0){const A=b.anchorNode;if(A){let k=null;if(A.nodeType===Node.ELEMENT_NODE?k=A.closest('[data-type="variable"]'):A.nodeType===Node.TEXT_NODE&&A.parentElement&&(k=A.parentElement.closest('[data-type="variable"]')),k){const q=k.dataset.multiKey;if(q){const E=/[、,,\s\n\r\t]+/,_=m.split(E).map($=>$.trim()).filter($=>$.length>0);if(console.log("[Paste Event] 粘贴的内容:",m),console.log("[Paste Event] 拆分后的值:",_),_.length>1){const $=parseInt(k.dataset.index||"0",10),P=t.find(ee=>ee.type==="multi-variable"&&ee.key===q)?.maxCount||9,z=Z[q]||1,B=Math.min($+_.length,P);B>z&&N(K=>({...K,[q]:B}));const O=[];for(let K=0;K<z;K++){const ee=`${q}_${K}`,oe=a.current.querySelector(`[data-type="variable"][data-key="${ee}"][data-multi-key="${q}"]`);if(oe){const ue=oe.innerText.replace(/[\u200B\n]/g,"").trim();O.push(ue)}}O.splice($,1,..._.slice(0,P-$));const Y=O.slice(0,P);Y.length>0&&Y[Y.length-1]!==""&&Y.length<P&&Y.push("");const V=Math.max(Y.length,1),R={};Y.forEach((K,ee)=>{K&&(R[`${q}_${ee}`]=K)}),a.current.querySelectorAll('[data-type="variable"]').forEach(K=>{const ee=K.dataset.key,oe=K.dataset.multiKey;if(ee&&oe!==q){const ue=K.innerText.replace(/[\u200B\n]/g,"").trim();ue&&(R[ee]=ue)}}),a.current.__tempVariableValues=R,N(K=>({...K,[q]:V})),console.log("[Paste Event] 粘贴完成,已填充到多个输入框,值:",Y);return}else _.length===1&&console.log("[Paste Event] 粘贴单个值,将在失去焦点时检查是否需要拆分")}}}}document.execCommand("insertText",!1,m),ce(),setTimeout(()=>{const A=window.getSelection();if(A&&A.rangeCount>0){const k=A.anchorNode;if(k){let q=null;if(k.nodeType===Node.ELEMENT_NODE?q=k.closest('[data-type="variable"][data-multi-key]'):k.nodeType===Node.TEXT_NODE&&k.parentElement&&(q=k.parentElement.closest('[data-type="variable"][data-multi-key]')),q){const E=q.innerText.replace(/[\u200B\n]/g,"").trim();/[、,,\s]+/.test(E)&&(console.log("[Paste Event] 粘贴后检测到分隔符,内容:",E),console.log("[Paste Event] 提示:失去焦点后将自动拆分"))}}}},0)},$e=y=>{if(y.target.files&&y.target.files[0]&&f){const m=y.target.files[0],b=f;s(A=>({...A,[b]:m}))}y.target&&(y.target.value=""),v(null)},be=y=>{s(m=>{const b={...m};return delete b[y],b})},Ne=y=>{const m=y.target;if(m.closest(".tag-close-btn")){if(y.preventDefault(),y.stopPropagation(),w)return;D(null),T?T():a.current&&(a.current.innerHTML="",a.current.focus());return}if(w){const k=m.closest(".tag-node"),q=m.closest('[data-type="text"]');if(k||q){y.preventDefault(),y.stopPropagation();const E=window.getSelection();E&&E.removeAllRanges();return}}m.closest('[data-type="variable"]')||(G.current={x:y.clientX,y:y.clientY},S.current=!1,m.closest(".file-remove-btn")&&(y.preventDefault(),y.stopPropagation()))},ye=y=>{if(!y.target.closest('[data-type="variable"]')&&G.current){const A=Math.abs(y.clientX-G.current.x),k=Math.abs(y.clientY-G.current.y);(A>3||k>3)&&(S.current=!0)}},Ae=y=>{if(y.target.closest('[data-type="variable"]')){G.current=null,S.current=!1;return}G.current=null,S.current=!1},j=y=>{if(u)return;const m=y.target;if(m.closest('[data-type="datepicker"]'))return;if(m.closest(".tag-close-btn")){y.preventDefault(),y.stopPropagation();return}if(t.length===0)return;const k=(B,O)=>{if(!a.current)return;Array.from(a.current.children).forEach(V=>{if(V!==B)if(O)V.dataset.prevDisplay===void 0&&(V.dataset.prevDisplay=V.style.display||""),V.style.setProperty("display","none","important");else if(V.dataset.prevDisplay!==void 0){const R=V.dataset.prevDisplay;R?V.style.display=R:V.style.removeProperty("display"),delete V.dataset.prevDisplay}else V.style.removeProperty("display")})},q=m.closest(".rte-textarea-toggle");if(q){y.preventDefault(),y.stopPropagation();const B=q.closest(".rte-textarea-wrapper"),O=B?.querySelector('[data-type="textarea"]'),V=!(q.getAttribute("data-expanded")==="true");q.setAttribute("data-expanded",String(V)),q.textContent=V?"收起":"展开",B&&B.classList.toggle("rte-textarea-expanded",V);const R=B?.closest(".rte-textarea-required");if(R?R.classList.toggle("rte-textarea-overlay",V):B&&B.classList.toggle("rte-textarea-overlay",V),O)if(V)O.classList.add("rte-textarea-expanded"),O.style.maxHeight="none",O.style.height="100%";else{O.classList.remove("rte-textarea-expanded");const ne=O.dataset.maxHeight||"252";O.style.maxHeight=`${ne}px`,O.style.height="auto"}a.current&&(V?a.current.classList.add("rte-overlay-active"):a.current.classList.remove("rte-overlay-active"));return}const E=m.closest(".rte-richtext-toggle");if(E){y.preventDefault(),y.stopPropagation();const B=E.closest(".rte-richtext-wrapper"),O=B?.querySelector('[data-type="richtext"]'),V=!(E.getAttribute("data-expanded")==="true");((ee,oe)=>{ee.setAttribute("data-expanded",String(oe)),ee.innerHTML=oe?'<i class="iconfont icon-shouqi1"></i><span class="rte-richtext-toggle-label">收起</span>':'<i class="iconfont icon-zhankai2"></i><span class="rte-richtext-toggle-label">展开</span>'})(E,V);const ne=B?.closest(".rte-richtext-required");ne?ne.classList.toggle("rte-richtext-expanded",V):B&&B.classList.toggle("rte-richtext-expanded",V);const K=B?.closest(".exclusion-wrapper")||B?.parentElement;O&&(V?(O.style.height="100%",O.style.overflow="auto"):(O.style.height="",O.style.overflow="")),K&&(K.classList.toggle("rte-richtext-host-expanded",V),k(K,V)),a.current&&a.current.classList.toggle("rte-richtext-fullscreen-active",V);return}if(m.closest('[data-type="text"]')){y.preventDefault(),y.stopPropagation();const B=window.getSelection();B&&B.removeAllRanges();return}if(w&&m.closest(".tag-node")){y.preventDefault(),y.stopPropagation();const O=window.getSelection();O&&O.removeAllRanges();return}if(m.closest('[data-type="variable"]')){if(S.current)return;setTimeout(()=>{const B=window.getSelection();B&&!B.isCollapsed||qe(a)},10);return}const P=m.closest(".file-remove-btn");if(P){y.preventDefault(),y.stopPropagation();const O=P.closest('[data-type="upload"]')?.dataset.key;O&&be(O);return}const z=m.closest('[data-type="upload"]');if(z){const B=z.dataset.key;B&&(v(B),o.current?.click());return}},re=y=>{const b=y.target.closest('[data-type="variable"]');if(b){const A=window.getSelection();if(A){const k=document.createRange(),q=b.textContent||"";if(q.replace(/\u200B/g,"")){let _=0,$=q.length;q.startsWith("​")&&(_=1),q.endsWith("​")&&q.length>1&&($=q.length-1);const P=b.firstChild;P&&P.nodeType===Node.TEXT_NODE?(k.setStart(P,_),k.setEnd(P,$)):k.selectNodeContents(b)}else k.selectNodeContents(b),k.collapse(!0);A.removeAllRanges(),A.addRange(k)}}},ce=()=>{if(t.length===0){if(a.current){const b=!(a.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"");Q(b),M(!b)}return}if(qe(a),a.current&&a.current.querySelectorAll('[data-type="variable"]').forEach(b=>{const A=b.querySelector(".variable-info-icon");if(A){let k=!1;const q=document.createTreeWalker(b,NodeFilter.SHOW_TEXT,{acceptNode:E=>A.contains(E)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT});for(;q.nextNode();)if(q.currentNode.textContent?.replace(/[\u200B\n]/g,"").trim()){k=!0;break}k?A.classList.add("hidden"):A.classList.remove("hidden")}}),he(a,t,r),ve(a,t,r,M),!a.current)return;t.filter(m=>m.type==="multi-variable"&&m.key).forEach(m=>{if(!m.key)return;const b=m.maxCount||9,A=Z[m.key]||1,k=[];for(let P=0;P<A;P++){const z=`${m.key}_${P}`,B=a.current.querySelector(`[data-type="variable"][data-key="${z}"][data-multi-key="${m.key}"]`);if(B){const O=B.innerText.replace(/[\u200B\n]/g,"").trim();k.push(O)}}const E=(k[k.length-1]||"")==="";let _=!1,$=-1;for(let P=0;P<k.length-1;P++)if(k[P]===""){_=!0,$=P;break}if(_&&$>=0){const P=window.getSelection();if(P&&P.rangeCount>0){const V=P.getRangeAt(0),R=V.startContainer,ne=R.nodeType===Node.ELEMENT_NODE?R.closest('[data-type="variable"][data-multi-key]'):R.parentElement?.closest('[data-type="variable"][data-multi-key]');if(ne){const K=ne.dataset.key;if(K){const ee=document.createRange();ee.setStartBefore(ne),ee.setEnd(V.startContainer,V.startOffset);const oe=ee.toString().length;U.current={key:K,offset:oe}}}}const z=[...k];for(let V=$;V<z.length-1;V++)z[V]=z[V+1];z.pop();const B={};z.forEach((V,R)=>{V&&(B[`${m.key}_${R}`]=V)});const O=Math.max(E?z.length:z.length+1,1);a.current.querySelectorAll('[data-type="variable"]').forEach(V=>{const R=V.dataset.key,ne=V.dataset.multiKey;if(R&&ne!==m.key){const K=V.innerText.replace(/[\u200B\n]/g,"").trim();K&&(B[R]=K)}}),a.current.__tempVariableValues=B,N(V=>({...V,[m.key]:O}));return}if(!E){const P=A-1,z=`${m.key}_${P}`,B=a.current.querySelector(`[data-type="variable"][data-key="${z}"][data-multi-key="${m.key}"]`);if(B&&B.innerText.replace(/[\u200B\n]/g,"").trim().length>0&&A<b){const Y=window.getSelection();if(Y&&Y.rangeCount>0){const V=Y.getRangeAt(0),R=V.startContainer,ne=R.nodeType===Node.ELEMENT_NODE?R.closest('[data-type="variable"][data-multi-key]'):R.parentElement?.closest('[data-type="variable"][data-multi-key]');if(ne){const K=ne.dataset.key;if(K){const ee=document.createRange();ee.setStartBefore(ne),ee.setEnd(V.startContainer,V.startOffset);const oe=ee.toString().length;U.current={key:K,offset:oe}}}}N(V=>({...V,[m.key]:A+1}))}}})};c.useLayoutEffect(()=>{const y=a.current;if(!y)return;const m=new Map,b=q=>{const E=q.target,_=q.relatedTarget;!E||!a.current||!a.current.contains(E)||_&&a.current.contains(_)||setTimeout(()=>{if(a.current){if(t.length===0){const $=a.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";M($.length>0);return}qe(a),he(a,t,r),ve(a,t,r,M)}},0)};y.addEventListener("blur",b,!0);const A=()=>{if(!a.current)return;m.forEach((_,$)=>{$.removeEventListener("blur",_,!1)}),m.clear();const q=a.current.querySelectorAll('[data-type="variable"][data-multi-key]'),E=_=>{_.stopPropagation(),_.stopImmediatePropagation();const $=_.target;if(!$||!a.current||!a.current.contains($))return;const P=$.closest('[data-type="variable"][data-multi-key]');if(!P||!a.current.contains(P))return;let z=!1;if(m.forEach((ee,oe)=>{(oe===P||oe.contains($))&&(z=!0)}),!z)return;const B=P.dataset.multiKey,O=P.dataset.key,Y=P.dataset.index;if(!B||!O||Y===void 0)return;const V=_.relatedTarget;if(!(!V||!a.current.contains(V)))return;const ne=P.innerText.replace(/[\u200B\n]/g,"").trim();console.log("[Blur Event] 失去焦点的 multi-variable 输入框:",{multiKey:B,currentKey:O,index:Y,content:ne});const K=/[、,,\s]+/;if(K.test(ne)){const ee=ne.split(K).map(me=>me.trim()).filter(me=>me.length>0);console.log("[Blur Event] 拆分前的内容:",ne),console.log("[Blur Event] 拆分后的部分:",ee);const ue=ee.slice(0,9);if(console.log("[Blur Event] 有效的部分(最多9个):",ue),ue.length>1){const me=t.find(ke=>ke.type==="multi-variable"&&ke.key===B);if(me){const ke=Z[B]||1,Xe=parseInt(Y,10),Je=me.maxCount||9,we=[];for(let le=0;le<ke;le++){const ge=`${B}_${le}`,Ee=a.current.querySelector(`[data-type="variable"][data-key="${ge}"][data-multi-key="${B}"]`);if(Ee){const Ce=Ee.innerText.replace(/[\u200B\n]/g,"").trim();we.push(Ce)}}console.log("[Blur Event] 拆分前的所有值:",we),console.log("[Blur Event] 当前索引:",Xe),console.log("[Blur Event] 要插入的值:",ue),we.splice(Xe,1,...ue);const pe=we.slice(0,Je);console.log("[Blur Event] 拆分后的所有值:",pe),pe.length>0&&pe[pe.length-1]!==""&&pe.length<Je&&pe.push("");const yt=Math.max(pe.length,1),Le={};pe.forEach((le,ge)=>{le&&(Le[`${B}_${ge}`]=le)}),a.current.querySelectorAll('[data-type="variable"]').forEach(le=>{const ge=le.dataset.key,Ee=le.dataset.multiKey;if(ge&&Ee!==B){const Ce=le.innerText.replace(/[\u200B\n]/g,"").trim();Ce&&(Le[ge]=Ce)}}),a.current.__tempVariableValues=Le,N(le=>({...le,[B]:yt}))}}}};q.forEach(_=>{_.addEventListener("blur",E,!1),m.set(_,E)})},k=setTimeout(()=>{A()},0);return()=>{clearTimeout(k),y.removeEventListener("blur",b,!0),m.forEach((q,E)=>{E.removeEventListener("blur",q,!1)}),m.clear()}},[t,Z,r]);const xe=y=>{if(u){y.preventDefault();return}const m=window.getSelection();if(m&&m.rangeCount>0){const b=m.anchorNode;let A=null;if(b&&(b.nodeType===Node.ELEMENT_NODE?A=b.closest('[data-type="text"]'):b.nodeType===Node.TEXT_NODE&&b.parentElement&&(A=b.parentElement.closest('[data-type="text"]'))),A){if(y.preventDefault(),y.stopPropagation(),a.current){const k=a.current.querySelector('[data-type="variable"], [data-type="upload"]');k&&k.focus()}return}}if(w&&m&&m.rangeCount>0){const b=m.anchorNode;let A=null;if(b&&(b.nodeType===Node.ELEMENT_NODE?A=b.closest(".tag-node"):b.nodeType===Node.TEXT_NODE&&b.parentElement&&(A=b.parentElement.closest(".tag-node"))),A){if(y.preventDefault(),y.stopPropagation(),a.current){const k=a.current.querySelector('[data-type="variable"], [data-type="upload"]');k&&k.focus()}return}}if(y.key==="Enter"&&!y.shiftKey&&(y.preventDefault(),Ue()),y.key==="Escape"&&a.current){if(w){y.preventDefault();return}a.current.innerHTML="",a.current.focus()}if(y.key==="Backspace"){const b=window.getSelection();if(b&&b.rangeCount>0){const A=b.getRangeAt(0),k=b.anchorNode;if(w){let E=null,_=null;if(k&&(k.nodeType===Node.ELEMENT_NODE?(E=k.closest(".tag-node"),_=k.closest('[data-type="text"]')):k.nodeType===Node.TEXT_NODE&&k.parentElement&&(E=k.parentElement.closest(".tag-node"),_=k.parentElement.closest('[data-type="text"]'))),(E||_)&&A.collapsed&&A.startOffset===0){y.preventDefault();return}}let q=null;if(k&&(k.nodeType===Node.ELEMENT_NODE?q=k.closest('[data-type="variable"]'):k.nodeType===Node.TEXT_NODE&&k.parentElement&&(q=k.parentElement.closest('[data-type="variable"]'))),q){if(!A.collapsed)return;const E=q.innerText;if(E==="​"||E===""){y.preventDefault();return}if(A.startOffset===0){y.preventDefault();return}if(E.startsWith("​")&&A.startOffset===1){y.preventDefault();return}}}}},Ue=()=>{if(p||u||e||!F||!a.current)return;if(t.length===0){const q=a.current.textContent?.replace(/[\u200B\n]/g,"").trim()||"";if(!q)return;g(q,q);return}const y=a.current;let m="";const b={},A=q=>{if(!(q.nodeType===Node.ELEMENT_NODE&&q.style.display==="none")){if(q.nodeType===Node.TEXT_NODE)m+=(q.textContent||"").replace(/\u200B/g,"");else if(q.nodeType===Node.ELEMENT_NODE){const E=q,_=E.dataset.type,$=E.dataset.key;if(_==="variable"&&$){let P="";const z=document.createTreeWalker(E,NodeFilter.SHOW_TEXT,{acceptNode:O=>{const Y=E.querySelector(".variable-info-icon");return Y&&Y.contains(O)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});for(;z.nextNode();)P+=z.currentNode.textContent||"";const B=P.replace(/[\u200B\n]/g,"").trim();if(B){const O=E.dataset.multiKey;if(O){(!b[O]||!Array.isArray(b[O]))&&(b[O]=[]);const Y=b[O];Y.push(B),Y.length>1&&(m+=" "),m+=B}else b[$]=B,m+=B}}else if(_==="select"&&$){const P=E,z=(P.value||"").trim();if(z){b[$]=z;const B=P.selectedOptions?.[0];m+=B?.textContent||z}}else if(_==="textarea"&&$){const z=(E.value||"").replace(/\u200B/g,"").trim();z&&(b[$]=z,m+=z)}else if(_==="richtext"&&$){const z=(E.textContent||"").replace(/\u200B/g,"").trim();z&&(b[$]=z,m+=z)}else if(_==="datepicker"&&$){const z=(E.getAttribute("data-value")||"").trim();z&&(b[$]=z,m+=z)}else if(_==="upload"&&$)b[$]=r[$]??null,r[$]&&(m+=` [附带文件: ${r[$]?.name}] `);else{if(E.classList.contains("tag-close-btn")||E.classList.contains("file-remove-btn"))return;E.getAttribute("contenteditable")==="false"&&!_&&E.classList.contains("tag-node")?m+=E.innerText:E.childNodes.forEach(A)}}}};if(y.childNodes.forEach(A),m=m.trim(),!m)return;const k=new FormData;k.append("fullPrompt",m),Object.keys(b).forEach(q=>{const E=b[q];E!=null&&(E instanceof File?k.append(q,E):Array.isArray(E)?t.some($=>$.type==="multi-variable"&&$.key===q)?E.forEach($=>{$!=null&&$!==""&&k.append(q,String($))}):E.forEach(($,P)=>{$!=null&&($ instanceof File?k.append(`${q}[${P}]`,$):typeof $=="string"?k.append(`${q}[${P}]`,$):k.append(`${q}[${P}]`,String($)))}):typeof E=="string"?k.append(q,E):k.append(q,String(E)))}),g(k,m)},ft={...d?{width:typeof d=="number"?`${d}px`:d}:{},...h?{border:h}:{},...i?{background:i}:{}};return l.jsxs("div",{className:"rich-text-editor",style:ft,"data-disabled":u,children:[l.jsx("div",{ref:a,className:`rte-editor ${t.length===0?"rte-editor-default":""} ${J&&L?"rte-editor-empty":""}`,contentEditable:t.length===0,suppressContentEditableWarning:!0,"data-placeholder":L,onMouseDown:Ne,onMouseMove:ye,onMouseUp:Ae,onClick:j,onDoubleClick:re,onInput:ce,onKeyDown:xe,onPaste:Se}),l.jsx("input",{type:"file",ref:o,className:"rte-file-input",accept:".csv,.xlsx,.xls,.txt,.pdf,image/*",onChange:$e}),l.jsxs("div",{className:"rich-text-editor-footer",children:[l.jsx("div",{className:"rich-text-editor-footer-left",children:l.jsxs("div",{className:"rich-text-editor-brand",children:[l.jsxs("div",{className:"rte-brand-badge",children:[l.jsx("img",{src:"https://oospublic.sealseek.cn/file/website/ball.png",alt:""}),l.jsx("span",{className:"rte-brand-text",children:"SealSeek 1.0"})]}),n!=="hideAgent"&&l.jsx(W.Dropdown,{placement:"top",menu:{items:I.map(y=>({key:y.key,label:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[y.icon&&l.jsx("i",{className:y.icon}),l.jsx("span",{children:y.label})]}),onClick:()=>{C?.(y)}}))},trigger:["click"],disabled:u||p,children:l.jsxs("div",{className:"rte-agent-badge",style:{cursor:I.length>0?"pointer":"default"},children:[l.jsx("i",{className:"iconfont icon-zhinengti"}),l.jsx("span",{className:"rte-agent-text",children:"智能体"})]})})]})}),l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(()=>{const y=t.find(b=>b.type==="tag");if(!y||!y.text)return null;const m=I.find(b=>b.label===y.text);return!m||m.points===void 0||m.points===null?null:l.jsxs("div",{className:"rte-points-badge",children:[l.jsx("i",{className:"iconfont icon-jifen",style:{marginRight:"4px"}}),l.jsxs("span",{style:{fontSize:"16px"},children:["-",String(m.points)]})]})})(),l.jsx("button",{type:"button",onClick:Ue,disabled:p||u||e||!F,className:"rich-text-editor-send-button",children:p||e?l.jsx("span",{className:"rte-send-spinner"}):l.jsx("i",{className:"iconfont icon-fasong"})})]})]}),x?.anchorEl&&(()=>{if(!document.body.contains(x.anchorEl))return null;let y="",m={background:"var(--neutral-800, #262626)"};if(x.type==="upload")y=t.find(k=>k.type==="upload"&&k.key===x.key)?.tooltip||"";else if(x.type==="tag")y=x.anchorEl.dataset.tooltip||"";else if(x.type==="upload-label")y=x.anchorEl.dataset.fileName||"";else if(x.type==="variable")y=x.anchorEl.dataset.tooltip||"";else if(x.type==="upload-preview"){const A=r[x.key];if(A&&A.type&&A.type.startsWith("image/")){const k=URL.createObjectURL(A);y=l.jsx("div",{style:{width:120,height:120,display:"flex",alignItems:"center",justifyContent:"center"},children:l.jsx("img",{src:k,style:{maxWidth:120,maxHeight:120,objectFit:"contain"}})}),m={background:"#fff",padding:4},setTimeout(()=>URL.revokeObjectURL(k),1e3)}else y=""}if(!y)return null;const b=x.type==="upload-preview"?"#0A0A0A":"#fff";return Qe.createPortal(l.jsx(W.Tooltip,{arrow:!1,title:l.jsx("div",{style:{maxWidth:"200px",fontSize:"12px",color:b},children:y}),open:!0,placement:"top",getPopupContainer:()=>document.body,overlayInnerStyle:m,children:l.jsx("div",{style:{position:"fixed",left:`${x.anchorEl.getBoundingClientRect().left}px`,top:`${x.anchorEl.getBoundingClientRect().top}px`,width:`${x.anchorEl.offsetWidth}px`,height:`${x.anchorEl.offsetHeight}px`,pointerEvents:"none"}})}),document.body)})()]})};Oe.__docgenInfo={displayName:"RichTextEditor",description:"结构化富文本输入组件,支持标签、变量输入块、文件上传以及互斥显示逻辑。",props:{config:{name:"config",required:!0,description:"结构化输入配置节点数组",type:{name:"InputNode[]",raw:"InputNode[]"}},onSend:{name:"onSend",required:!0,description:"点击发送按钮时的回调,返回数据与拼接后的 Prompt",type:{name:"function",raw:"(data: Record<string, any>, fullPrompt: string) => void"}},isProcessing:{name:"isProcessing",required:!1,description:"是否处于处理状态(禁用输入与发送)",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}}}};const Fe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFSSURBVHgB3ZTtccIwDIaVXv83I2SDZgSP0BHMBG0naEZhA2boBGQDswHdQJUOGRxjO0Z8HPDe6eJzJD2W4gjgEYSIn2xwK6EIFHqBGysJpMP3ZB0oRbEtmal1NtIxl4OWWsoxEsvqofJ0rgTNASOYq+7SXKDsuYvAcgkq/PWwBLQWqIfdjeRStaBUc4qzgLi9/BzJNmS/sh6bpvmrTfSFacU3scWy1mQryWdSnXiFE8QVUJINLTuyhWzzz/1OZmTN9hEckqtfUOwIGlGCpVRjE+94JFqpMtTeVzO8/UmPxpZU8Qa7aln8Tb9pfwla4WHWrjPvvbbnTBsX7PmLs83EDAH0BxSw1G31+/1FoDg/vPcXR+wocQS1apj4+P92FfhOoLyuBfYlmPgYnGoCjWADzAkzUyJ430awLmphPaxWQVU22BuuApPkHaanjcXSN3t6/QNjTMSJWDcs1QAAAABJRU5ErkJggg==",st=[{label:"5页",value:5},{label:"10页",value:10},{label:"15页",value:15},{label:"30页",value:30}],it=({autoLoading:t,batchSize:g,loadingProgress:p,loadIcon:u,onBatchSizeChange:d,onLoadNextPage:w,onStartAutoLoad:I,onStopLoad:C})=>t&&p?l.jsxs("div",{className:"auto_load_progress",children:[u||l.jsx("img",{src:Fe,alt:"自动加载",width:14,height:14}),l.jsxs("span",{children:["正在加载第",p.currentPage,"/",p.totalPages,"页"]}),l.jsx(W.Progress,{percent:p.percentage,type:"line",size:[160,8]}),l.jsx("span",{onClick:C,className:"auto_load_stop_btn",children:"停止加载"})]}):l.jsxs("div",{className:"auto_load_container",children:[l.jsx("div",{onClick:w,className:"auto_load_next_btn",style:{backgroundColor:t?"#f5f5f5":"#2563eb"},children:"加载下一页"}),l.jsxs("div",{className:"right_control_wrap",style:{backgroundColor:t?"#f5f5f5":"#2563eb"},children:[l.jsxs("div",{className:"auto_load_btn",onClick:t?void 0:I,children:[u||l.jsx("img",{src:Fe,alt:"自动加载",width:14,height:14}),l.jsx("span",{children:"自动加载"})]}),l.jsx(W.Select,{value:g,onChange:d,options:st,disabled:t,size:"small",className:"auto_load_select",popupMatchSelectWidth:84})]})]}),ct=({current:t,loadIcon:g,pageSize:p,total:u,cachedPages:d,loadedCount:w,autoLoading:I=!1,loadingProgress:C,onChange:T,onLoadNextPage:e,onStartAutoLoad:L,onStopLoading:h})=>{const[i,n]=c.useState(5),a=Math.ceil(u/p),o=c.useMemo(()=>d.length>=a,[d,a]),r=()=>Array.from({length:a},(v,x)=>x+1).filter(v=>!d.includes(v)).slice(0,i),s=(f,v,x)=>{const D=d.includes(f);return v==="prev"||v==="next"||v==="jump-prev"||v==="jump-next"?l.jsx("div",{className:"pageBox",children:x}):l.jsxs("div",{className:"pageBox",style:{backgroundColor:t===f?"#2563EB":"#f5f5f5",color:t===f?"#fff":D?"#171717":"#a3a3a3"},children:[f,!D&&l.jsx("span",{className:"unload_spot"})]})};return l.jsxs("div",{className:"pagination_footer",children:[l.jsxs("div",{className:"pagination_leftWrap",children:[l.jsxs("span",{className:"pagination_total",children:[l.jsx(de.InfoCircleOutlined,{style:{color:"#2563EB",marginRight:"4px"}}),"已加载: ",w,"/",u,"条数据"]}),!o&&l.jsx(it,{loadIcon:g||void 0,autoLoading:I,batchSize:i,loadingProgress:C,disabled:!e||!L,onBatchSizeChange:n,onLoadNextPage:()=>e?.(),onStartAutoLoad:()=>{const f=r();L?.(f)},onStopLoad:()=>h?.()})]}),l.jsx(W.Pagination,{current:t,pageSize:p,total:u,onChange:f=>T(f),showSizeChanger:!1,showQuickJumper:!1,showTotal:(f,v)=>"",itemRender:s})]})},ze=t=>{const{loading:g,autoLoading:p,loadingProgress:u,columns:d=[],dataSource:w=[],total:I,current:C,pageSize:T,cachedPages:e,onChangePage:L,onLoadNextPage:h,onStartAutoLoad:i,onStopLoading:n,...a}=t,o=c.useRef(null),r=c.useCallback(s=>{L(s),e.includes(s)&&o.current?.scrollTo({key:`${(s-1)*T+1}`})},[C]);return l.jsxs("div",{className:"flex flex-col",children:[l.jsx(W.Table,{ref:o,...a,columns:d,dataSource:w,pagination:!1,virtual:!0}),l.jsx(ct,{loading:g,autoLoading:p,loadingProgress:u,current:C,pageSize:T,total:I,loadedCount:w.length,cachedPages:e,onChange:r,onLoadNextPage:h,onStartAutoLoad:i,onStopLoading:n})]})};ze.__docgenInfo={displayName:"VirtualTable",description:"虚拟滚动表格组件,支持分页、数据缓存和自动加载功能。",props:{loading:{description:"加载状态",name:"loading",required:!0,type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},total:{description:"总数据条数",name:"total",required:!0,type:{name:"number",raw:"number"},defaultValue:{value:"0"}},current:{description:"当前页码",name:"current",required:!0,type:{name:"number",raw:"number"},defaultValue:{value:"1"}},pageSize:{description:"每页数据条数",name:"pageSize",required:!0,type:{name:"number",raw:"number"},defaultValue:{value:"10"}},cachedPages:{description:"已缓存的页码数组",name:"cachedPages",required:!0,type:{name:"number[]",raw:"number[]"},defaultValue:{value:"[]"}},dataSource:{description:"数据源",name:"dataSource",required:!0,type:{name:"Array<T>",raw:"Array<T>"},defaultValue:{value:"[]"}},onChangePage:{description:"页码变更回调函数",name:"onChangePage",required:!0,type:{name:"function",raw:"function(page: number): void"},defaultValue:{value:"-"}},autoLoading:{description:"是否正在自动加载",name:"autoLoading",required:!0,type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},loadingProgress:{description:"加载进度信息",name:"loadingProgress",required:!0,type:{name:"object",raw:"{percentage: 0, currentPage: 1, totalPages: 5}"},defaultValue:{value:"-"}},onLoadNextPage:{description:"加载下一页回调函数",name:"onLoadNextPage",required:!1,type:{name:"function",raw:"function(page: number): void"},defaultValue:{value:"-"}},onStartAutoLoad:{description:"开始自动加载回调函数",name:"onStartAutoLoad",required:!1,type:{name:"function",raw:"function(loadNextPages: number[]): void"},defaultValue:{value:"-"}},onStopLoading:{description:"停止加载回调函数",name:"onStopLoading",required:!1,type:{name:"function",raw:"function(): void"},defaultValue:{value:"-"}},columns:{description:"表格列配置",name:"columns",required:!0,type:{name:"Array<object>",raw:"Array<object>"},defaultValue:{value:"[]"}}}};const We=({texts:t=[],placeholder:g="请输入内容",animationSpeed:p=100,autoPlay:u=!0,value:d,onChange:w,...I})=>{const[C,T]=c.useState(""),[e,L]=c.useState(0),[h,i]=c.useState(!1),[n,a]=c.useState(!1),[o,r]=c.useState(!1),s=c.useRef(void 0),f=c.useRef(void 0),v=c.useRef(t),x=c.useRef(e),D=c.useRef(n),S=c.useRef(C);c.useEffect(()=>{v.current=t,x.current=e,D.current=n,S.current=C});const G=c.useCallback((N,H)=>{let te=0;r(!0);const ae=()=>{te<N.length?(T(N.slice(0,te+1)),te++,f.current=window.setTimeout(ae,p)):(r(!1),H?.())};ae()},[p]),F=c.useCallback(N=>{let H=S.current.length;const te=()=>{H>0?(T(S.current.slice(0,H-1)),H--,f.current=window.setTimeout(te,p/2)):N?.()};te()},[p]),M=c.useCallback(()=>{if(v.current.length===0||D.current)return;i(!0);const N=v.current[x.current];S.current?F(()=>{G(N,()=>{s.current=window.setTimeout(()=>{L(H=>(H+1)%v.current.length),i(!1)},2e3)})}):G(N,()=>{s.current=window.setTimeout(()=>{L(H=>(H+1)%v.current.length),i(!1)},2e3)})},[F,G]);c.useEffect(()=>(u&&t.length>0&&!n&&M(),()=>{s.current&&window.clearTimeout(s.current),f.current&&window.clearTimeout(f.current)}),[e,n,u,t.length,M]),c.useEffect(()=>{!h&&u&&t.length>0&&!n&&M()},[e,h,u,t.length,n,M]);const U=N=>{a(!0),s.current&&window.clearTimeout(s.current),f.current&&window.clearTimeout(f.current),i(!1),r(!1),I.onFocus?.(N)},J=N=>{a(!1),!d&&t.length>0&&(T(""),L(0)),I.onBlur?.(N)},Q=N=>{w?.(N.target.value),I.onChange?.(N)},Z=()=>n||d?g:C||g;return l.jsxs("div",{style:{position:"relative"},children:[l.jsx(W.Input,{...I,value:d,onChange:Q,onFocus:U,onBlur:J,placeholder:Z(),style:{...I.style,position:"relative",zIndex:1}}),!n&&!d&&C&&l.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"center",paddingLeft:11,paddingRight:11,color:"#bfbfbf",pointerEvents:"none",zIndex:2,fontSize:14,fontFamily:"inherit"},children:[l.jsx("span",{children:C}),o&&l.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),l.jsx("style",{children:`
2
2
  @keyframes blink {
3
3
  0%, 50% { opacity: 1; }
4
4
  51%, 100% { opacity: 0; }
5
5
  }
6
- `})]})};We.__docgenInfo={displayName:"DynamicInput",description:"动态文案输入框组件,支持流式文字动画效果",props:{texts:{name:"texts",required:!0,description:"动态展示的文案数组",type:{name:"string[]",raw:"string[]"}},placeholder:{name:"placeholder",required:!1,description:"输入框占位符",type:{name:"string",raw:"string"},defaultValue:{value:'"请输入内容"'}},animationSpeed:{name:"animationSpeed",required:!1,description:"动画速度(毫秒)",type:{name:"number",raw:"number"},defaultValue:{value:"100"}},autoPlay:{name:"autoPlay",required:!1,description:"是否自动播放动画",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},value:{name:"value",required:!1,description:"输入框值",type:{name:"string",raw:"string"}},onChange:{name:"onChange",required:!1,description:"输入框变化回调",type:{name:"function",raw:"(value: string) => void"}}}};const je=({texts:t=[],placeholder:v="请输入内容",animationSpeed:u=100,autoPlay:i=!0,value:d="",onChange:E,onSubmit:V,maxLength:C=500,showCount:a=!0,submitText:e="发送",disabled:r=!1,rows:s=4,style:B,...m})=>{const[o,A]=l.useState(""),[c,g]=l.useState(0),[y,x]=l.useState(!1),[h,D]=l.useState(!1),[$,P]=l.useState(!1),[F,M]=l.useState(d||""),K=l.useRef(void 0),J=l.useRef(void 0),Q=l.useRef(t),Z=l.useRef(c),S=l.useRef(h),H=l.useRef(o),ee=l.useRef(null);l.useEffect(()=>{Q.current=t,Z.current=c,S.current=h,H.current=o});const ne=l.useCallback((j,re)=>{let ce=0;P(!0);const ve=()=>{ce<j.length?(A(j.slice(0,ce+1)),ce++,J.current=window.setTimeout(ve,u)):(P(!1),re?.())};ve()},[u]),se=l.useCallback(j=>{let re=H.current.length;const ce=()=>{re>0?(A(H.current.slice(0,re-1)),re--,J.current=window.setTimeout(ce,u/2)):j?.()};ce()},[u]),fe=l.useCallback(()=>{if(Q.current.length===0||S.current)return;x(!0);const j=Q.current[Z.current];H.current?se(()=>{ne(j,()=>{K.current=window.setTimeout(()=>{g(re=>(re+1)%Q.current.length),x(!1)},2e3)})}):ne(j,()=>{K.current=window.setTimeout(()=>{g(re=>(re+1)%Q.current.length),x(!1)},2e3)})},[se,ne]);l.useEffect(()=>(i&&t.length>0&&!h&&fe(),()=>{K.current&&window.clearTimeout(K.current),J.current&&window.clearTimeout(J.current)}),[c,h,i,t.length,fe]),l.useEffect(()=>{!y&&i&&t.length>0&&!h&&fe()},[c,y,i,t.length,h,fe]);const ie=j=>{D(!0),K.current&&window.clearTimeout(K.current),J.current&&window.clearTimeout(J.current),x(!1),P(!1),m.onFocus?.(j)},Se=j=>{D(!1),!d&&t.length>0&&(A(""),g(0)),m.onBlur?.(j)},$e=j=>{const re=j.target.value;C&&re.length>C||(E?E(re):M(re),m.onChange?.(j))},he=()=>{const j=E?d:F;j.trim()&&!r&&(V?.(j),E||M(""))},Ne=j=>{(j.ctrlKey||j.metaKey)&&j.key==="Enter"&&(j.preventDefault(),he()),m.onKeyDown?.(j)},ye=E?d:F,Ae=r||!ye.trim()||(C?ye.length>C:!1);return n.jsxs("div",{style:{position:"relative",...B},children:[n.jsxs("div",{style:{position:"relative"},children:[n.jsx("textarea",{ref:ee,value:E?d:F,onChange:$e,onFocus:j=>{j.target.style.borderColor="#1890ff",j.target.style.boxShadow="0 0 0 2px rgba(24, 144, 255, 0.2)",ie(j)},onBlur:j=>{j.target.style.borderColor="#d9d9d9",j.target.style.boxShadow="none",Se(j)},onKeyDown:Ne,placeholder:h||ye?v:"",maxLength:C,rows:s,disabled:r,style:{width:"100%",minHeight:`${s*24+16}px`,padding:"8px 60px 8px 12px",border:"1px solid #d9d9d9",borderRadius:"6px",fontSize:"14px",lineHeight:"1.5",fontFamily:"inherit",resize:"vertical",outline:"none",transition:"border-color 0.3s, box-shadow 0.3s",backgroundColor:"#fff",...m.style},...m}),!h&&!ye&&o&&n.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"flex-start",paddingTop:8,paddingLeft:12,paddingRight:12,color:"#bfbfbf",pointerEvents:"none",zIndex:2,fontSize:14,fontFamily:"inherit",lineHeight:"1.5"},children:[n.jsx("span",{children:o}),$&&n.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),n.jsx("div",{style:{position:"absolute",bottom:8,right:8,zIndex:3},children:n.jsx(W.Button,{type:"primary",size:"small",icon:n.jsx(de.SendOutlined,{}),onClick:he,disabled:Ae,style:{borderRadius:6,minWidth:32,height:32,display:"flex",alignItems:"center",justifyContent:"center"},children:e})})]}),a&&n.jsxs("div",{style:{marginTop:4,textAlign:"right",fontSize:"12px",color:"#999"},children:[ye.length,"/",C]}),n.jsx("style",{children:`
6
+ `})]})};We.__docgenInfo={displayName:"DynamicInput",description:"动态文案输入框组件,支持流式文字动画效果",props:{texts:{name:"texts",required:!0,description:"动态展示的文案数组",type:{name:"string[]",raw:"string[]"}},placeholder:{name:"placeholder",required:!1,description:"输入框占位符",type:{name:"string",raw:"string"},defaultValue:{value:'"请输入内容"'}},animationSpeed:{name:"animationSpeed",required:!1,description:"动画速度(毫秒)",type:{name:"number",raw:"number"},defaultValue:{value:"100"}},autoPlay:{name:"autoPlay",required:!1,description:"是否自动播放动画",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},value:{name:"value",required:!1,description:"输入框值",type:{name:"string",raw:"string"}},onChange:{name:"onChange",required:!1,description:"输入框变化回调",type:{name:"function",raw:"(value: string) => void"}}}};const je=({texts:t=[],placeholder:g="请输入内容",animationSpeed:p=100,autoPlay:u=!0,value:d="",onChange:w,onSubmit:I,maxLength:C=500,showCount:T=!0,submitText:e="发送",disabled:L=!1,rows:h=4,style:i,...n})=>{const[a,o]=c.useState(""),[r,s]=c.useState(0),[f,v]=c.useState(!1),[x,D]=c.useState(!1),[S,G]=c.useState(!1),[F,M]=c.useState(d||""),U=c.useRef(void 0),J=c.useRef(void 0),Q=c.useRef(t),Z=c.useRef(r),N=c.useRef(x),H=c.useRef(a),te=c.useRef(null);c.useEffect(()=>{Q.current=t,Z.current=r,N.current=x,H.current=a});const ae=c.useCallback((j,re)=>{let ce=0;G(!0);const xe=()=>{ce<j.length?(o(j.slice(0,ce+1)),ce++,J.current=window.setTimeout(xe,p)):(G(!1),re?.())};xe()},[p]),se=c.useCallback(j=>{let re=H.current.length;const ce=()=>{re>0?(o(H.current.slice(0,re-1)),re--,J.current=window.setTimeout(ce,p/2)):j?.()};ce()},[p]),fe=c.useCallback(()=>{if(Q.current.length===0||N.current)return;v(!0);const j=Q.current[Z.current];H.current?se(()=>{ae(j,()=>{U.current=window.setTimeout(()=>{s(re=>(re+1)%Q.current.length),v(!1)},2e3)})}):ae(j,()=>{U.current=window.setTimeout(()=>{s(re=>(re+1)%Q.current.length),v(!1)},2e3)})},[se,ae]);c.useEffect(()=>(u&&t.length>0&&!x&&fe(),()=>{U.current&&window.clearTimeout(U.current),J.current&&window.clearTimeout(J.current)}),[r,x,u,t.length,fe]),c.useEffect(()=>{!f&&u&&t.length>0&&!x&&fe()},[r,f,u,t.length,x,fe]);const ie=j=>{D(!0),U.current&&window.clearTimeout(U.current),J.current&&window.clearTimeout(J.current),v(!1),G(!1),n.onFocus?.(j)},Se=j=>{D(!1),!d&&t.length>0&&(o(""),s(0)),n.onBlur?.(j)},$e=j=>{const re=j.target.value;C&&re.length>C||(w?w(re):M(re),n.onChange?.(j))},be=()=>{const j=w?d:F;j.trim()&&!L&&(I?.(j),w||M(""))},Ne=j=>{(j.ctrlKey||j.metaKey)&&j.key==="Enter"&&(j.preventDefault(),be()),n.onKeyDown?.(j)},ye=w?d:F,Ae=L||!ye.trim()||(C?ye.length>C:!1);return l.jsxs("div",{style:{position:"relative",...i},children:[l.jsxs("div",{style:{position:"relative"},children:[l.jsx("textarea",{ref:te,value:w?d:F,onChange:$e,onFocus:j=>{j.target.style.borderColor="#1890ff",j.target.style.boxShadow="0 0 0 2px rgba(24, 144, 255, 0.2)",ie(j)},onBlur:j=>{j.target.style.borderColor="#d9d9d9",j.target.style.boxShadow="none",Se(j)},onKeyDown:Ne,placeholder:x||ye?g:"",maxLength:C,rows:h,disabled:L,style:{width:"100%",minHeight:`${h*24+16}px`,padding:"8px 60px 8px 12px",border:"1px solid #d9d9d9",borderRadius:"6px",fontSize:"14px",lineHeight:"1.5",fontFamily:"inherit",resize:"vertical",outline:"none",transition:"border-color 0.3s, box-shadow 0.3s",backgroundColor:"#fff",...n.style},...n}),!x&&!ye&&a&&l.jsxs("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",alignItems:"flex-start",paddingTop:8,paddingLeft:12,paddingRight:12,color:"#bfbfbf",pointerEvents:"none",zIndex:2,fontSize:14,fontFamily:"inherit",lineHeight:"1.5"},children:[l.jsx("span",{children:a}),S&&l.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),l.jsx("div",{style:{position:"absolute",bottom:8,right:8,zIndex:3},children:l.jsx(W.Button,{type:"primary",size:"small",icon:l.jsx(de.SendOutlined,{}),onClick:be,disabled:Ae,style:{borderRadius:6,minWidth:32,height:32,display:"flex",alignItems:"center",justifyContent:"center"},children:e})})]}),T&&l.jsxs("div",{style:{marginTop:4,textAlign:"right",fontSize:"12px",color:"#999"},children:[ye.length,"/",C]}),l.jsx("style",{children:`
7
7
  @keyframes blink {
8
8
  0%, 50% { opacity: 1; }
9
9
  51%, 100% { opacity: 0; }
10
10
  }
11
- `})]})};je.__docgenInfo={displayName:"DynamicTextArea",description:"动态文案文本域组件,支持流式文字动画效果",props:{texts:{name:"texts",required:!0,description:"动态展示的文案数组",type:{name:"string[]",raw:"string[]"}},placeholder:{name:"placeholder",required:!1,description:"输入框占位符",type:{name:"string",raw:"string"},defaultValue:{value:'"请输入内容"'}},animationSpeed:{name:"animationSpeed",required:!1,description:"动画速度(毫秒)",type:{name:"number",raw:"number"},defaultValue:{value:"100"}},autoPlay:{name:"autoPlay",required:!1,description:"是否自动播放动画",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},value:{name:"value",required:!1,description:"输入框值",type:{name:"string",raw:"string"}},onChange:{name:"onChange",required:!1,description:"输入框变化回调",type:{name:"function",raw:"(value: string) => void"}},onSubmit:{name:"onSubmit",required:!1,description:"提交回调",type:{name:"function",raw:"(value: string) => void"}},maxLength:{name:"maxLength",required:!1,description:"最大输入字数",type:{name:"number",raw:"number"},defaultValue:{value:"500"}},showCount:{name:"showCount",required:!1,description:"是否显示字数统计",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},submitText:{name:"submitText",required:!1,description:"提交按钮文本",type:{name:"string",raw:"string"},defaultValue:{value:'"发送"'}},disabled:{name:"disabled",required:!1,description:"是否禁用提交按钮",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},rows:{name:"rows",required:!1,description:"文本域行数",type:{name:"number",raw:"number"},defaultValue:{value:"4"}}}};const Te=({src:t,poster:v,width:u=300,height:i,videoWidth:d,videoHeight:E,showPlayButton:V=!0,autoPlayOnHover:C=!0,onClick:a,onVideoLoaded:e,onVideoPlay:r,onVideoPause:s,onVideoEnded:B,className:m,style:o,...A})=>{const c=l.useRef(null),[g,y]=l.useState(!1),[x,h]=l.useState(!1),[D,$]=l.useState(!1),P=l.useCallback(()=>{c.current&&(c.current.play(),y(!0),r?.())},[r]),F=l.useCallback(()=>{c.current&&(c.current.pause(),y(!1),s?.())},[s]),M=l.useCallback(ne=>{ne.stopPropagation(),g?F():P()},[g,P,F]),K=l.useCallback(()=>{h(!0),C&&!g&&P()},[C,g,P]),J=l.useCallback(()=>{h(!1),C&&g&&F()},[C,g,F]),Q=l.useCallback(()=>{$(!0),e?.()},[e]),Z=l.useCallback(()=>{y(!0),r?.()},[r]),S=l.useCallback(()=>{y(!1),s?.()},[s]),H=l.useCallback(()=>{y(!1),B?.()},[B]),ee=l.useCallback(ne=>{a?.(ne)},[a]);return n.jsx(W.Card,{...A,className:`video-card ${m||""}`,style:{width:u,height:i,padding:0,overflow:"hidden",cursor:a?"pointer":"default",border:"none",borderRadius:0,...o},bordered:!1,onMouseEnter:K,onMouseLeave:J,onClick:ee,children:n.jsxs("div",{className:"video-card-container",children:[n.jsx("video",{ref:c,src:t,poster:v,preload:"metadata",onLoadedData:Q,onPlay:Z,onPause:S,onEnded:H,muted:!0,loop:!0}),V&&n.jsx("div",{className:`video-play-button ${x?"hovered":""}`,onClick:M,children:g?n.jsx(de.PauseCircleOutlined,{className:"play-icon"}):n.jsx(de.PlayCircleOutlined,{className:"play-icon"})}),!D&&n.jsx("div",{className:"video-loading-mask",children:n.jsx("div",{className:"loading-spinner"})})]})})};Te.__docgenInfo={displayName:"VideoCard",description:"视频卡片组件,支持鼠标悬浮播放控制",props:{src:{name:"src",required:!0,description:"视频源地址",type:{name:"string",raw:"string"}},poster:{name:"poster",required:!1,description:"视频海报图片",type:{name:"string",raw:"string"}},width:{name:"width",required:!1,description:"卡片宽度",type:{name:"number | string",raw:"number | string"},defaultValue:{value:"300"}},height:{name:"height",required:!1,description:"卡片高度",type:{name:"number | string",raw:"number | string"}},videoWidth:{name:"videoWidth",required:!1,description:"视频宽度",type:{name:"number | string",raw:"number | string"},defaultValue:{value:'"100%"'}},videoHeight:{name:"videoHeight",required:!1,description:"视频高度",type:{name:"number | string",raw:"number | string"},defaultValue:{value:'"100%"'}},showPlayButton:{name:"showPlayButton",required:!1,description:"是否显示播放按钮",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},autoPlayOnHover:{name:"autoPlayOnHover",required:!1,description:"是否自动播放(鼠标悬浮时)",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"(event: React.MouseEvent<HTMLDivElement>) => void"}},onVideoLoaded:{name:"onVideoLoaded",required:!1,description:"视频加载完成事件",type:{name:"function",raw:"() => void"}},onVideoPlay:{name:"onVideoPlay",required:!1,description:"视频播放事件",type:{name:"function",raw:"() => void"}},onVideoPause:{name:"onVideoPause",required:!1,description:"视频暂停事件",type:{name:"function",raw:"() => void"}},onVideoEnded:{name:"onVideoEnded",required:!1,description:"视频结束事件",type:{name:"function",raw:"() => void"}},className:{name:"className",required:!1,description:"自定义样式类名",type:{name:"string",raw:"string"}},style:{name:"style",required:!1,description:"自定义样式",type:{name:"CSSProperties",raw:"React.CSSProperties"}}}};const ut=t=>[".mp4",".webm",".ogg",".mov",".avi",".wmv",".flv",".mkv"].some(u=>t.toLowerCase().includes(u)),dt=t=>t.type?t.type:ut(t.url)?"video":"image",Ke=({items:t,columns:v,gap:u=0,responsive:i=!0,breakpoints:d={xs:1,sm:2,md:3,lg:4,xl:5,xxl:6},className:E,style:V,onClick:C})=>{const a=l.useRef(null),[e,r]=l.useState(v||d.md||3),s=l.useRef(new Map),B=l.useCallback(()=>{if(!i||v)return v||d.md||3;const c=window.innerWidth;return c<576?d.xs||1:c<768?d.sm||2:c<992?d.md||3:c<1200?d.lg||4:c<1600?d.xl||5:d.xxl||6},[i,v,d]),m=l.useCallback(()=>{if(!a.current)return;const c=e,g=a.current,x=(g.offsetWidth-u*(c-1))/c,h=new Array(c).fill(0);t.forEach(($,P)=>{const F=$.id||P,M=s.current.get(F);if(!M)return;const K=Math.min(...h),J=h.indexOf(K),Q=J*(x+u),Z=h[J];M.style.position="absolute",M.style.left=`${Q}px`,M.style.top=`${Z}px`,M.style.width=`${x}px`,h[J]+=M.offsetHeight+u});const D=Math.max(...h);g.style.height=`${D}px`},[t,e,u]);l.useEffect(()=>{const c=()=>{const g=B();g!==e&&r(g)};if(i)return window.addEventListener("resize",c),c(),()=>window.removeEventListener("resize",c)},[i,B,e]),l.useEffect(()=>{const c=setTimeout(()=>{m()},100);return()=>clearTimeout(c)},[t,e,m]);const o=l.useCallback(()=>{m()},[m]),A=l.useCallback(c=>{C&&C(c),c.onClick?.(c)},[C]);return n.jsx("div",{ref:a,className:`waterfall-container ${E||""}`,style:{position:"relative",width:"100%",...V},children:t.map((c,g)=>{const y=c.id||g,x=dt(c);return n.jsx("div",{ref:h=>{h?s.current.set(y,h):s.current.delete(y)},className:"waterfall-item",children:x==="video"?n.jsx("div",{style:{width:"100%",position:"relative",paddingBottom:"56.25%",cursor:C||c.onClick?"pointer":"default"},children:n.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"},children:n.jsx(Te,{src:c.url,poster:c.poster,width:"100%",height:"100%",onClick:()=>A(c),onVideoLoaded:o,autoPlayOnHover:!0,showPlayButton:!1})})}):n.jsx("div",{className:"waterfall-image-wrapper",onClick:()=>A(c),style:{cursor:C||c.onClick?"pointer":"default"},children:n.jsx("img",{src:c.url,alt:`瀑布流图片 ${g+1}`,className:"waterfall-image",onLoad:o,onError:o,style:{display:"block",width:"100%",height:"auto"}})})},y)})})};Ke.__docgenInfo={displayName:"Waterfall",description:"瀑布流布局组件,支持图片和视频混合展示",props:{items:{name:"items",required:!0,description:"媒体资源数组",type:{name:"WaterfallItem[]",raw:"WaterfallItem[]"}},columns:{name:"columns",required:!1,description:"列数(默认会根据屏幕宽度自动响应)",type:{name:"number",raw:"number"}},gap:{name:"gap",required:!1,description:"间隔大小",type:{name:"number",raw:"number"},defaultValue:{value:"0"}},responsive:{name:"responsive",required:!1,description:"是否启用响应式布局",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},breakpoints:{name:"breakpoints",required:!1,description:"响应式断点配置",type:{name:"object",raw:"{ xs?: number; sm?: number; md?: number; lg?: number; xl?: number; xxl?: number; }"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},style:{name:"style",required:!1,description:"自定义样式",type:{name:"CSSProperties",raw:"React.CSSProperties"}},onClick:{name:"onClick",required:!1,description:"点击回调",type:{name:"function",raw:"(item: any) => void"}}}};const pt={algorithm:W.theme.defaultAlgorithm,token:{colorPrimary:"#3b82f6",colorSuccess:"#10b981",colorWarning:"#f59e0b",colorError:"#ef4444",colorInfo:"#3b82f6",colorBgBase:"#ffffff",colorBgContainer:"#ffffff",colorBgElevated:"#ffffff",colorBgLayout:"#f8fafc",colorTextBase:"#1e293b",colorText:"#1e293b",colorTextSecondary:"#64748b",colorTextTertiary:"#94a3b8",colorTextQuaternary:"#cbd5e1",colorBorder:"#e2e8f0",colorBorderSecondary:"#f1f5f9",boxShadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",boxShadowSecondary:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",borderRadius:8,borderRadiusLG:12,borderRadiusSM:6,fontFamily:"Inter, system-ui, Arial, sans-serif",fontSize:14,fontSizeLG:16,fontSizeSM:12,padding:16,paddingLG:24,paddingSM:12,paddingXS:8,controlHeight:32,controlHeightLG:40,controlHeightSM:24},components:{Button:{borderRadius:8,controlHeight:32,fontWeight:500},Card:{borderRadiusLG:12,boxShadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)"},Input:{borderRadius:8,controlHeight:32},Table:{borderRadiusLG:8,headerBg:"#f8fafc",headerColor:"#374151"}}};X.AdvancedTable=He,X.AppModal=Ve,X.BackButton=Ge,X.Button=Le,X.Card=Be,X.DynamicInput=We,X.DynamicTextArea=je,X.EmptyAndSpin=Pe,X.LinkButton=Me,X.PageTable=_e,X.RichTextEditor=Oe,X.VideoCard=Te,X.VirtualTable=ze,X.Waterfall=Ke,X.XcIcon=De,X.lightTheme=pt,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})});
11
+ `})]})};je.__docgenInfo={displayName:"DynamicTextArea",description:"动态文案文本域组件,支持流式文字动画效果",props:{texts:{name:"texts",required:!0,description:"动态展示的文案数组",type:{name:"string[]",raw:"string[]"}},placeholder:{name:"placeholder",required:!1,description:"输入框占位符",type:{name:"string",raw:"string"},defaultValue:{value:'"请输入内容"'}},animationSpeed:{name:"animationSpeed",required:!1,description:"动画速度(毫秒)",type:{name:"number",raw:"number"},defaultValue:{value:"100"}},autoPlay:{name:"autoPlay",required:!1,description:"是否自动播放动画",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},value:{name:"value",required:!1,description:"输入框值",type:{name:"string",raw:"string"}},onChange:{name:"onChange",required:!1,description:"输入框变化回调",type:{name:"function",raw:"(value: string) => void"}},onSubmit:{name:"onSubmit",required:!1,description:"提交回调",type:{name:"function",raw:"(value: string) => void"}},maxLength:{name:"maxLength",required:!1,description:"最大输入字数",type:{name:"number",raw:"number"},defaultValue:{value:"500"}},showCount:{name:"showCount",required:!1,description:"是否显示字数统计",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},submitText:{name:"submitText",required:!1,description:"提交按钮文本",type:{name:"string",raw:"string"},defaultValue:{value:'"发送"'}},disabled:{name:"disabled",required:!1,description:"是否禁用提交按钮",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"false"}},rows:{name:"rows",required:!1,description:"文本域行数",type:{name:"number",raw:"number"},defaultValue:{value:"4"}}}};const Te=({src:t,poster:g,width:p=300,height:u,videoWidth:d,videoHeight:w,showPlayButton:I=!0,autoPlayOnHover:C=!0,onClick:T,onVideoLoaded:e,onVideoPlay:L,onVideoPause:h,onVideoEnded:i,className:n,style:a,...o})=>{const r=c.useRef(null),[s,f]=c.useState(!1),[v,x]=c.useState(!1),[D,S]=c.useState(!1),G=c.useCallback(()=>{r.current&&(r.current.play(),f(!0),L?.())},[L]),F=c.useCallback(()=>{r.current&&(r.current.pause(),f(!1),h?.())},[h]),M=c.useCallback(ae=>{ae.stopPropagation(),s?F():G()},[s,G,F]),U=c.useCallback(()=>{x(!0),C&&!s&&G()},[C,s,G]),J=c.useCallback(()=>{x(!1),C&&s&&F()},[C,s,F]),Q=c.useCallback(()=>{S(!0),e?.()},[e]),Z=c.useCallback(()=>{f(!0),L?.()},[L]),N=c.useCallback(()=>{f(!1),h?.()},[h]),H=c.useCallback(()=>{f(!1),i?.()},[i]),te=c.useCallback(ae=>{T?.(ae)},[T]);return l.jsx(W.Card,{...o,className:`video-card ${n||""}`,style:{width:p,height:u,padding:0,overflow:"hidden",cursor:T?"pointer":"default",border:"none",borderRadius:0,...a},bordered:!1,onMouseEnter:U,onMouseLeave:J,onClick:te,children:l.jsxs("div",{className:"video-card-container",children:[l.jsx("video",{ref:r,src:t,poster:g,preload:"metadata",onLoadedData:Q,onPlay:Z,onPause:N,onEnded:H,muted:!0,loop:!0}),I&&l.jsx("div",{className:`video-play-button ${v?"hovered":""}`,onClick:M,children:s?l.jsx(de.PauseCircleOutlined,{className:"play-icon"}):l.jsx(de.PlayCircleOutlined,{className:"play-icon"})}),!D&&l.jsx("div",{className:"video-loading-mask",children:l.jsx("div",{className:"loading-spinner"})})]})})};Te.__docgenInfo={displayName:"VideoCard",description:"视频卡片组件,支持鼠标悬浮播放控制",props:{src:{name:"src",required:!0,description:"视频源地址",type:{name:"string",raw:"string"}},poster:{name:"poster",required:!1,description:"视频海报图片",type:{name:"string",raw:"string"}},width:{name:"width",required:!1,description:"卡片宽度",type:{name:"number | string",raw:"number | string"},defaultValue:{value:"300"}},height:{name:"height",required:!1,description:"卡片高度",type:{name:"number | string",raw:"number | string"}},videoWidth:{name:"videoWidth",required:!1,description:"视频宽度",type:{name:"number | string",raw:"number | string"},defaultValue:{value:'"100%"'}},videoHeight:{name:"videoHeight",required:!1,description:"视频高度",type:{name:"number | string",raw:"number | string"},defaultValue:{value:'"100%"'}},showPlayButton:{name:"showPlayButton",required:!1,description:"是否显示播放按钮",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},autoPlayOnHover:{name:"autoPlayOnHover",required:!1,description:"是否自动播放(鼠标悬浮时)",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},onClick:{name:"onClick",required:!1,description:"点击事件",type:{name:"function",raw:"(event: React.MouseEvent<HTMLDivElement>) => void"}},onVideoLoaded:{name:"onVideoLoaded",required:!1,description:"视频加载完成事件",type:{name:"function",raw:"() => void"}},onVideoPlay:{name:"onVideoPlay",required:!1,description:"视频播放事件",type:{name:"function",raw:"() => void"}},onVideoPause:{name:"onVideoPause",required:!1,description:"视频暂停事件",type:{name:"function",raw:"() => void"}},onVideoEnded:{name:"onVideoEnded",required:!1,description:"视频结束事件",type:{name:"function",raw:"() => void"}},className:{name:"className",required:!1,description:"自定义样式类名",type:{name:"string",raw:"string"}},style:{name:"style",required:!1,description:"自定义样式",type:{name:"CSSProperties",raw:"React.CSSProperties"}}}};const ut=t=>[".mp4",".webm",".ogg",".mov",".avi",".wmv",".flv",".mkv"].some(p=>t.toLowerCase().includes(p)),dt=t=>t.type?t.type:ut(t.url)?"video":"image",Ke=({items:t,columns:g,gap:p=0,responsive:u=!0,breakpoints:d={xs:1,sm:2,md:3,lg:4,xl:5,xxl:6},className:w,style:I,onClick:C})=>{const T=c.useRef(null),[e,L]=c.useState(g||d.md||3),h=c.useRef(new Map),i=c.useCallback(()=>{if(!u||g)return g||d.md||3;const r=window.innerWidth;return r<576?d.xs||1:r<768?d.sm||2:r<992?d.md||3:r<1200?d.lg||4:r<1600?d.xl||5:d.xxl||6},[u,g,d]),n=c.useCallback(()=>{if(!T.current)return;const r=e,s=T.current,v=(s.offsetWidth-p*(r-1))/r,x=new Array(r).fill(0);t.forEach((S,G)=>{const F=S.id||G,M=h.current.get(F);if(!M)return;const U=Math.min(...x),J=x.indexOf(U),Q=J*(v+p),Z=x[J];M.style.position="absolute",M.style.left=`${Q}px`,M.style.top=`${Z}px`,M.style.width=`${v}px`,x[J]+=M.offsetHeight+p});const D=Math.max(...x);s.style.height=`${D}px`},[t,e,p]);c.useEffect(()=>{const r=()=>{const s=i();s!==e&&L(s)};if(u)return window.addEventListener("resize",r),r(),()=>window.removeEventListener("resize",r)},[u,i,e]),c.useEffect(()=>{const r=setTimeout(()=>{n()},100);return()=>clearTimeout(r)},[t,e,n]);const a=c.useCallback(()=>{n()},[n]),o=c.useCallback(r=>{C&&C(r),r.onClick?.(r)},[C]);return l.jsx("div",{ref:T,className:`waterfall-container ${w||""}`,style:{position:"relative",width:"100%",...I},children:t.map((r,s)=>{const f=r.id||s,v=dt(r);return l.jsx("div",{ref:x=>{x?h.current.set(f,x):h.current.delete(f)},className:"waterfall-item",children:v==="video"?l.jsx("div",{style:{width:"100%",position:"relative",paddingBottom:"56.25%",cursor:C||r.onClick?"pointer":"default"},children:l.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"},children:l.jsx(Te,{src:r.url,poster:r.poster,width:"100%",height:"100%",onClick:()=>o(r),onVideoLoaded:a,autoPlayOnHover:!0,showPlayButton:!1})})}):l.jsx("div",{className:"waterfall-image-wrapper",onClick:()=>o(r),style:{cursor:C||r.onClick?"pointer":"default"},children:l.jsx("img",{src:r.url,alt:`瀑布流图片 ${s+1}`,className:"waterfall-image",onLoad:a,onError:a,style:{display:"block",width:"100%",height:"auto"}})})},f)})})};Ke.__docgenInfo={displayName:"Waterfall",description:"瀑布流布局组件,支持图片和视频混合展示",props:{items:{name:"items",required:!0,description:"媒体资源数组",type:{name:"WaterfallItem[]",raw:"WaterfallItem[]"}},columns:{name:"columns",required:!1,description:"列数(默认会根据屏幕宽度自动响应)",type:{name:"number",raw:"number"}},gap:{name:"gap",required:!1,description:"间隔大小",type:{name:"number",raw:"number"},defaultValue:{value:"0"}},responsive:{name:"responsive",required:!1,description:"是否启用响应式布局",type:{name:"boolean",raw:"boolean"},defaultValue:{value:"true"}},breakpoints:{name:"breakpoints",required:!1,description:"响应式断点配置",type:{name:"object",raw:"{ xs?: number; sm?: number; md?: number; lg?: number; xl?: number; xxl?: number; }"}},className:{name:"className",required:!1,description:"自定义类名",type:{name:"string",raw:"string"}},style:{name:"style",required:!1,description:"自定义样式",type:{name:"CSSProperties",raw:"React.CSSProperties"}},onClick:{name:"onClick",required:!1,description:"点击回调",type:{name:"function",raw:"(item: any) => void"}}}};const pt={algorithm:W.theme.defaultAlgorithm,token:{colorPrimary:"#3b82f6",colorSuccess:"#10b981",colorWarning:"#f59e0b",colorError:"#ef4444",colorInfo:"#3b82f6",colorBgBase:"#ffffff",colorBgContainer:"#ffffff",colorBgElevated:"#ffffff",colorBgLayout:"#f8fafc",colorTextBase:"#1e293b",colorText:"#1e293b",colorTextSecondary:"#64748b",colorTextTertiary:"#94a3b8",colorTextQuaternary:"#cbd5e1",colorBorder:"#e2e8f0",colorBorderSecondary:"#f1f5f9",boxShadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",boxShadowSecondary:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",borderRadius:8,borderRadiusLG:12,borderRadiusSM:6,fontFamily:"Inter, system-ui, Arial, sans-serif",fontSize:14,fontSizeLG:16,fontSizeSM:12,padding:16,paddingLG:24,paddingSM:12,paddingXS:8,controlHeight:32,controlHeightLG:40,controlHeightSM:24},components:{Button:{borderRadius:8,controlHeight:32,fontWeight:500},Card:{borderRadiusLG:12,boxShadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)"},Input:{borderRadius:8,controlHeight:32},Table:{borderRadiusLG:8,headerBg:"#f8fafc",headerColor:"#374151"}}};X.AdvancedTable=He,X.AppModal=Ve,X.BackButton=Pe,X.Button=Ie,X.Card=Be,X.DynamicInput=We,X.DynamicTextArea=je,X.EmptyAndSpin=De,X.LinkButton=Me,X.PageTable=_e,X.RichTextEditor=Oe,X.VideoCard=Te,X.VirtualTable=ze,X.Waterfall=Ke,X.XcIcon=Ge,X.lightTheme=pt,Object.defineProperty(X,Symbol.toStringTag,{value:"Module"})});
12
12
  //# sourceMappingURL=index.umd.js.map