bi-components-library 1.2.96 → 1.2.97
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.es.js +5 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -61,7 +61,7 @@ ${(e||"").replace(/\r\n/g,`
|
|
|
61
61
|
`).trim():""}catch{q=H.trim()}}else{const H=(T.innerText||"").replace(/\u200B/g,"").replace(/\r\n/g,`
|
|
62
62
|
`);q=H.replace(/\n/g,"").trim().length>0?H:""}if(q)f.current.add(O);else if(f.current.has(O)){D.add(O);const H=T.getAttribute("data-node-type");H==="report-url"?D.add(`${O}__url`):H==="markdown-name"&&D.add(`${O}__name`)}})}const B=e.current.__tempVariableValues;if(B?(N=B,setTimeout(()=>{if(e.current){const L=e.current;L.__tempVariableValues===B&&delete L.__tempVariableValues}},100)):k||(e.current.querySelectorAll('[data-type="variable"]').forEach(W=>{const G=W.dataset.key;if(G){const _=W.getAttribute("data-report-url");if(_){const X=W.dataset.multiKey,K=X?`${X}::${G}`:G;S[K]={url:_,name:W.getAttribute("data-report-name")||W.innerText.replace(/\u200B/g,"").trim(),multiKey:X}}const V=()=>{if(W.dataset.variableRender==="antd-textarea"){const te=(W.getAttribute("data-value")||"").trim();if(!te)return"";try{return decodeURIComponent(te).replace(/\r\n/g,`
|
|
63
63
|
`).trim()}catch{return te.trim()}}const X=(W.innerText||"").replace(/\u200B/g,"").replace(/\r\n/g,`
|
|
64
|
-
`);return X.replace(/\n/g,"").trim().length>0?X:""},Y=W.getAttribute("data-node-type");if(Y==="report-url")if(_)N[`${G}__url`]=_;else{const X=V().replace(/\n/g,"").trim();X&&(N[`${G}__url`]=X)}else{const X=V();X&&(Y==="markdown-name"?N[`${G}__name`]=X:N[G]=X)}}}),e.current.querySelectorAll('[data-type="select"]').forEach(W=>{const G=W.dataset.key;if(G){const _=(W.getAttribute("data-value")||"").trim();_&&(N[G]=_)}}),e.current.querySelectorAll('[data-type="searchable-select"]').forEach(W=>{const G=W.dataset.key;if(G){const _=(W.getAttribute("data-value")||"").trim();_&&(N[G]=_)}}),e.current.querySelectorAll('[data-type="textarea"]').forEach(W=>{const G=W.dataset.key;if(G){const _=W.value.replace(/[\u200B]/g,"").trim();_&&(N[G]=_)}}),e.current.querySelectorAll('[data-type="richtext"]').forEach(W=>{const G=W.dataset.key;if(G){const _=W.getAttribute("data-node-type")||"",V=_==="report-module"||_==="markdown-module",Y=V?(W.innerHTML||"").replace(/[\u200B]/g,"").trim():(W.textContent||"").replace(/[\u200B]/g,"").trim();if(V){const X=Number.parseInt(W.getAttribute("data-module-index")||"0",10);N[`${G}__module_${Number.isFinite(X)?X:0}`]=Y}else Y&&(N[G]=Y)}}),e.current.querySelectorAll('[data-type="datepicker"]').forEach(W=>{const G=W.dataset.key;if(G){const _=(W.getAttribute("data-value")||"").trim();_&&(N[G]=_)}}),e.current.querySelectorAll('[data-type="number-input"]').forEach(W=>{const G=W.dataset.key;if(G){const _=(W.value||"").trim();_&&(N[G]=_)}})),o&&Object.keys(o).length>0){const L={};k||Object.entries(o).forEach(([T,O])=>{if(!Array.isArray(O))return;let q=0;for(let U=0;U<O.length;U++)`${T}_${U}`in N&&q++;let H=-1;for(let U=0;U<O.length;U++)f.current.has(`${T}_${U}`)&&(H=U);if(H>=q&&q<O.length)for(let U=q;U<O.length;U++)D.add(`${T}_${U}`)}),Object.entries(o).forEach(([T,O])=>{po(t,T)||(Array.isArray(O)?O.forEach((q,H)=>{q!=null&&String(q).trim()!==""&&(L[`${T}_${H}`]=String(q))}):O!=null&&String(O).trim()!==""&&(t.find(H=>H.key===T&&H.type==="report-url")?L[`${T}__url`]=String(O):L[T]=String(O)))}),Object.entries(L).forEach(([T,O])=>{const q=T in N,H=D.has(T),U=y.current[T]!==O;!H&&(!q||U)&&(N[T]=O)});for(const T of Object.keys(y.current))!(T in L)&&T in N&&delete N[T];y.current=L}if($1(e,t,a,l,N,n,s,u,c,d),m.current=b,h&&e.current)for(const[L,{name:T,url:O}]of Object.entries(h.current)){const q=e.current.querySelector(`[data-type="variable"][data-key="${L}"]`);if(!q)continue;const H=q.querySelector(".rte-report-dropdown-host");H&&(H.style.display="",H.style.visibility="",H.classList.remove("hidden"),H.classList.add("rte-report-dropdown-host-quiet"));const U=[document.createTextNode(T)];H&&U.push(H),q.setAttribute("data-report-url",O),q.setAttribute("data-report-name",T),q.removeAttribute("data-tooltip"),q.contentEditable="false",q.classList.add("rte-report-name-chip"),q.classList.remove("show-placeholder","rte-variable-with-icon"),q.replaceChildren(...U),jl(q)}if(k&&(v.current=!1),setTimeout(()=>{if(ta(e),h?.current)for(const[L,T]of Object.entries(h.current))S[L]||(S[L]=T);if(Object.keys(S).length>0&&e.current)for(const[L,T]of Object.entries(S)){let O=null;if(T.multiKey){const U=L.split("::")[1];O=e.current.querySelector(`[data-type="variable"][data-multi-key="${T.multiKey}"][data-key="${U}"]`)}else O=e.current.querySelector(`[data-type="variable"][data-key="${L}"]`);if(!O)continue;const q=O.querySelector(".rte-report-dropdown-host");q&&(q.style.display="",q.style.visibility="",q.classList.remove("hidden"),q.classList.add("rte-report-dropdown-host-quiet"));const H=[document.createTextNode(T.name)];q&&H.push(q),O.classList.remove("show-placeholder","rte-variable-with-icon"),O.classList.add("rte-report-name-chip"),O.setAttribute("data-report-url",T.url),O.setAttribute("data-report-name",T.name),O.contentEditable="false",O.replaceChildren(...H),jl(O)}ya(e,t,a,c)},0),r?.current){const{key:L,offset:T}=r.current;setTimeout(()=>{if(!e.current)return;const O=e.current.querySelector(`[data-type="variable"][data-key="${L}"]`);if(O){if(O.dataset.variableRender==="antd-textarea"){const q=O.querySelector("textarea");if(q){q.focus();try{const H=q.value?.length??0;q.setSelectionRange(Math.min(T,H),Math.min(T,H))}catch{}r.current=null;return}}try{const q=document.createRange(),H=document.createTreeWalker(O,NodeFilter.SHOW_TEXT,null);let U=0,I=null,W=0;for(;H.nextNode();){const G=H.currentNode,_=G.textContent?.length||0;if(U+_>=T){I=G,W=T-U;break}U+=_}if(I){q.setStart(I,Math.min(W,I.textContent?.length||0)),q.collapse(!0);const G=window.getSelection();G&&(G.removeAllRanges(),G.addRange(q),O.focus())}else{q.selectNodeContents(O),q.collapse(!1);const G=window.getSelection();G&&(G.removeAllRanges(),G.addRange(q),O.focus())}}catch{const q=document.createRange();q.selectNodeContents(O),q.collapse(!1);const H=window.getSelection();H&&(H.removeAllRanges(),H.addRange(q),O.focus())}r.current=null}},0)}},[t,a,l,e,n,r,i,s,u,o,c,d]);w.useEffect(()=>{g()},[g])}function V1(e,t,a,l,n){w.useEffect(()=>{const r=e.current;if(!r)return;const i=y=>typeof y=="string"?/\.(png|jpe?g|gif|webp|bmp|svg)(\?.*)?$/i.test(y):y.type?.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(y.name||""),s=y=>{if(y.target?.closest(".rte-tutorial-btn"))return;const b=y.target?.closest(".upload-info-icon");if(b&&b.classList.contains("upload-info-icon")){const x=b.dataset.uploadKey;if(x){const A=b.closest('[data-type="upload"], [data-type="video-upload"]');l({key:x,anchorEl:A||b,type:"upload"})}return}const C=y.target?.closest('[data-type="upload"]');if(C){const x=C.dataset.key;if(x){const A=a[x];A&&i(A)&&l({key:x,anchorEl:C,type:"upload-preview"})}}},u=y=>{if(n)return;const g=y.relatedTarget;if(g?.closest?.(".rte-tooltip-overlay")||y.target?.closest(".rte-tutorial-btn"))return;const C=y.target?.closest(".upload-info-icon");if(C&&C.classList.contains("upload-info-icon")){const A=C.closest('[data-type="upload"], [data-type="video-upload"]');if(g&&A&&A.contains(g))return;if(!g||!r.contains(g))l(null);else{const k=g.closest('[data-type="upload"], [data-type="video-upload"]');(!k||k!==A)&&l(null)}return}const x=y.target?.closest('[data-type="upload"], [data-type="video-upload"]');if(x){const A=g;if(A?.closest?.(".rte-tooltip-overlay")||A&&x.contains(A))return;l(null)}};r.addEventListener("mouseover",s,!0),r.addEventListener("mouseout",u,!0);const o=y=>{const g=y.currentTarget,b=g.dataset.uploadKey;if(b){const C=g.closest('[data-type="upload"], [data-node-type="video-url"]');l({key:b,anchorEl:C||g,type:"upload"})}},c=y=>{if(n)return;const g=y.relatedTarget;if(g?.closest?.(".rte-tooltip-overlay"))return;const C=y.currentTarget.closest('[data-type="upload"], [data-node-type="video-url"]');g&&C?.contains(g)||l(null)},d=new WeakSet,h=()=>{r.querySelectorAll(".rte-tutorial-btn").forEach(y=>{d.has(y)||(d.add(y),y.addEventListener("mouseenter",o),y.addEventListener("mouseleave",c))})};let f=requestAnimationFrame(()=>{f=requestAnimationFrame(h)}),E=0;const v=()=>{E||(E=requestAnimationFrame(()=>{E=0,h()}))},m=new MutationObserver(y=>{for(const g of y)if(!(g.type!=="childList"||g.addedNodes.length===0))for(const b of g.addedNodes){if(b.nodeType!==Node.ELEMENT_NODE)continue;const C=b;if(C.matches?.(".rte-tutorial-btn")||C.querySelector?.(".rte-tutorial-btn")){v();return}}});return m.observe(r,{childList:!0,subtree:!0}),()=>{r.removeEventListener("mouseover",s,!0),r.removeEventListener("mouseout",u,!0),cancelAnimationFrame(f),E&&cancelAnimationFrame(E),m.disconnect(),r.querySelectorAll(".rte-tutorial-btn").forEach(y=>{y.removeEventListener("mouseenter",o),y.removeEventListener("mouseleave",c)})}},[t,a,e,l,n])}function G1(e,t,a,l,n){w.useEffect(()=>{const r=e.current;if(!r)return;const i=c=>{if(l==="hideTagClose")return;const d=c.currentTarget,h=d.dataset.tooltip,f=d.dataset.tagKey||"";h&&a({key:f,anchorEl:d,type:"tag"})},s=c=>{n||c.relatedTarget?.closest?.(".rte-tooltip-overlay")||a(null)};let u;const o=()=>{r.querySelectorAll(".tag-node[data-tooltip]").forEach(d=>{d.addEventListener("mouseenter",i),d.addEventListener("mouseleave",s)})};return u=requestAnimationFrame(()=>{u=requestAnimationFrame(o)}),()=>{cancelAnimationFrame(u),r.querySelectorAll(".tag-node[data-tooltip]").forEach(d=>{d.removeEventListener("mouseenter",i),d.removeEventListener("mouseleave",s)})}},[t,e,a,l,n])}function Y1(e,t,a,l){w.useEffect(()=>{const n=e.current;if(!n)return;const r=s=>{if(s.target?.closest(".rte-report-dropdown-host"))return;const o=s.target?.closest(".variable-info-icon");if(o&&o.classList.contains("variable-info-icon")){const c=o.dataset.variableKey;c&&a({key:c,anchorEl:o,type:"variable"});return}},i=s=>{if(l)return;const u=s.target,o=s.relatedTarget;if(o?.closest?.(".rte-tooltip-overlay"))return;if(u?.closest?.(".variable-info-icon")){if(!o||!n.contains(o)){a(null);return}!!o.closest?.(".variable-info-icon")||a(null)}};return n.addEventListener("mouseover",r,!0),n.addEventListener("mouseout",i,!0),()=>{n.removeEventListener("mouseover",r,!0),n.removeEventListener("mouseout",i,!0)}},[t,e,a,l])}function W1(e,t,a,l,n){w.useEffect(()=>{const r=e.current;if(!r)return;const i=d=>typeof d=="string"?/\.(png|jpe?g|gif|webp|bmp|svg)(\?.*)?$/i.test(d):d.type?.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(d.name||""),s=d=>{const h=d.currentTarget,f=h.dataset.fileName,E=h.closest('[data-type="upload"]'),v=E?.dataset.key||"",m=v?a[v]:null;if(m&&i(m)){l({key:v,anchorEl:E||h,type:"upload-preview"});return}f&&l({key:v,anchorEl:E||h,type:"upload-label"})},u=d=>{n||d.relatedTarget?.closest?.(".rte-tooltip-overlay")||l(null)};let o;const c=()=>{r.querySelectorAll(".upload-label[data-file-name]").forEach(h=>{h.addEventListener("mouseenter",s),h.addEventListener("mouseleave",u)})};return o=requestAnimationFrame(()=>{o=requestAnimationFrame(c)}),()=>{cancelAnimationFrame(o),r.querySelectorAll(".upload-label[data-file-name]").forEach(h=>{h.removeEventListener("mouseenter",s),h.removeEventListener("mouseleave",u)})}},[t,a,e,l,n])}function j1(e,t,a,l,n,r,i,s){w.useEffect(()=>{const u=setTimeout(()=>{ya(e,t,a,n),Ql(e,t,a,l,n,{reportAnalyzeState:i,requireReportUrlAnalyze:s})},0);return()=>clearTimeout(u)},[a,t,e,l,n,r,i,s])}function K1(e,t){const a=w.useRef(0),l=w.useRef(0);w.useEffect(()=>{if(!e.current)return;let n=!1,r=0;const i=g=>g instanceof HTMLElement?!!(g.closest(".rte-datepicker-wrapper")||g.closest(".rte-datepicker-host")||g.closest(".ant-picker")||g.closest(".ant-picker-dropdown")):!1,s=g=>g instanceof HTMLElement?!!(g.closest(".rte-select-wrapper")||g.closest(".rte-select-host")||g.closest(".ant-select")||g.closest(".ant-select-dropdown")):!1,u=g=>{n=!0,i(g.target)&&(a.current=Date.now()),s(g.target)&&(l.current=Date.now())},o=()=>{n=!1,r=Date.now()};let c=!1,d=0;const h=()=>{c=!0},f=()=>{c=!1,d=Date.now()},E=()=>{d=Date.now()},v=g=>{i(g.target)&&(a.current=Date.now()),s(g.target)&&(l.current=Date.now())},m=()=>{if(Date.now()-a.current<800||Date.now()-l.current<800)return;const g=document.activeElement;if(g&&(g.closest(".rte-datepicker-wrapper")||g.closest(".rte-datepicker-host")||g.closest(".ant-picker-dropdown")||g.tagName==="INPUT"&&g.closest(".ant-picker")||g.closest(".rte-select-wrapper")||g.closest(".rte-select-host")||g.closest(".ant-select")||g.closest(".ant-select-dropdown"))||!e.current)return;const b=window.getSelection();if(!b||b.rangeCount===0||t.current||n||c||Date.now()-d<500)return;const C=b.getRangeAt(0);if(!C.collapsed)return e.current.contains(C.commonAncestorContainer),void 0;const x=b.anchorNode;if(!x||!e.current.contains(x))return;let A=!1,k=!1;if(x.nodeType===Node.ELEMENT_NODE){const S=x;(S.closest('[data-type="datepicker"]')||S.closest(".rte-datepicker-wrapper")||S.closest(".rte-datepicker-host"))&&(A=!0),(S.closest('[data-type="select"]')||S.closest(".rte-select-wrapper")||S.closest(".rte-select-host"))&&(k=!0)}else if(x.parentElement){const S=x.parentElement;(S.closest('[data-type="datepicker"]')||S.closest(".rte-datepicker-wrapper")||S.closest(".rte-datepicker-host"))&&(A=!0),(S.closest('[data-type="select"]')||S.closest(".rte-select-wrapper")||S.closest(".rte-select-host"))&&(k=!0)}if(A||k)return;let N=null;if(x.nodeType===Node.ELEMENT_NODE?N=x.closest('[data-type="variable"]'):x.nodeType===Node.TEXT_NODE&&x.parentElement&&(N=x.parentElement.closest('[data-type="variable"]')),!N){if(Date.now()-r>500)return;const S=e.current.querySelectorAll('[data-type="variable"]');if(S.length>0){let D=null;for(const P of Array.from(S))if(P.style.display!=="none"){D=P;break}if(!D&&S.length>0&&(D=S[0]),D){const P=document.createRange();P.selectNodeContents(D),P.collapse(!1),b.removeAllRanges(),b.addRange(P),D.focus()}else b.removeAllRanges()}else b.removeAllRanges()}},y=e.current;return y&&(y.addEventListener("compositionstart",h),y.addEventListener("compositionend",f),y.addEventListener("input",E)),document.addEventListener("mousedown",u),document.addEventListener("mouseup",o),document.addEventListener("focusin",v),document.addEventListener("selectionchange",m),()=>{y&&(y.removeEventListener("compositionstart",h),y.removeEventListener("compositionend",f),y.removeEventListener("input",E)),document.removeEventListener("mousedown",u),document.removeEventListener("mouseup",o),document.removeEventListener("focusin",v),document.removeEventListener("selectionchange",m)}},[e,t])}var Fl={exports:{}},X1=Fl.exports,bo;function mo(){return bo||(bo=1,function(e,t){(function(a,l){e.exports=l()})(X1,function(){var a=1e3,l=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",o="day",c="week",d="month",h="quarter",f="year",E="date",v="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(L){var T=["th","st","nd","rd"],O=L%100;return"["+L+(T[(O-20)%10]||T[O]||T[0])+"]"}},b=function(L,T,O){var q=String(L);return!q||q.length>=T?L:""+Array(T+1-q.length).join(O)+L},C={s:b,z:function(L){var T=-L.utcOffset(),O=Math.abs(T),q=Math.floor(O/60),H=O%60;return(T<=0?"+":"-")+b(q,2,"0")+":"+b(H,2,"0")},m:function L(T,O){if(T.date()<O.date())return-L(O,T);var q=12*(O.year()-T.year())+(O.month()-T.month()),H=T.clone().add(q,d),U=O-H<0,I=T.clone().add(q+(U?-1:1),d);return+(-(q+(O-H)/(U?H-I:I-H))||0)},a:function(L){return L<0?Math.ceil(L)||0:Math.floor(L)},p:function(L){return{M:d,y:f,w:c,d:o,D:E,h:u,m:s,s:i,ms:r,Q:h}[L]||String(L||"").toLowerCase().replace(/s$/,"")},u:function(L){return L===void 0}},x="en",A={};A[x]=g;var k="$isDayjsObject",N=function(L){return L instanceof $||!(!L||!L[k])},S=function L(T,O,q){var H;if(!T)return x;if(typeof T=="string"){var U=T.toLowerCase();A[U]&&(H=U),O&&(A[U]=O,H=U);var I=T.split("-");if(!H&&I.length>1)return L(I[0])}else{var W=T.name;A[W]=T,H=W}return!q&&H&&(x=H),H||!q&&x},D=function(L,T){if(N(L))return L.clone();var O=typeof T=="object"?T:{};return O.date=L,O.args=arguments,new $(O)},P=C;P.l=S,P.i=N,P.w=function(L,T){return D(L,{locale:T.$L,utc:T.$u,x:T.$x,$offset:T.$offset})};var $=function(){function L(O){this.$L=S(O.locale,null,!0),this.parse(O),this.$x=this.$x||O.x||{},this[k]=!0}var T=L.prototype;return T.parse=function(O){this.$d=function(q){var H=q.date,U=q.utc;if(H===null)return new Date(NaN);if(P.u(H))return new Date;if(H instanceof Date)return new Date(H);if(typeof H=="string"&&!/Z$/i.test(H)){var I=H.match(m);if(I){var W=I[2]-1||0,G=(I[7]||"0").substring(0,3);return U?new Date(Date.UTC(I[1],W,I[3]||1,I[4]||0,I[5]||0,I[6]||0,G)):new Date(I[1],W,I[3]||1,I[4]||0,I[5]||0,I[6]||0,G)}}return new Date(H)}(O),this.init()},T.init=function(){var O=this.$d;this.$y=O.getFullYear(),this.$M=O.getMonth(),this.$D=O.getDate(),this.$W=O.getDay(),this.$H=O.getHours(),this.$m=O.getMinutes(),this.$s=O.getSeconds(),this.$ms=O.getMilliseconds()},T.$utils=function(){return P},T.isValid=function(){return this.$d.toString()!==v},T.isSame=function(O,q){var H=D(O);return this.startOf(q)<=H&&H<=this.endOf(q)},T.isAfter=function(O,q){return D(O)<this.startOf(q)},T.isBefore=function(O,q){return this.endOf(q)<D(O)},T.$g=function(O,q,H){return P.u(O)?this[q]:this.set(H,O)},T.unix=function(){return Math.floor(this.valueOf()/1e3)},T.valueOf=function(){return this.$d.getTime()},T.startOf=function(O,q){var H=this,U=!!P.u(q)||q,I=P.p(O),W=function(se,ce){var ve=P.w(H.$u?Date.UTC(H.$y,ce,se):new Date(H.$y,ce,se),H);return U?ve:ve.endOf(o)},G=function(se,ce){return P.w(H.toDate()[se].apply(H.toDate("s"),(U?[0,0,0,0]:[23,59,59,999]).slice(ce)),H)},_=this.$W,V=this.$M,Y=this.$D,X="set"+(this.$u?"UTC":"");switch(I){case f:return U?W(1,0):W(31,11);case d:return U?W(1,V):W(0,V+1);case c:var K=this.$locale().weekStart||0,te=(_<K?_+7:_)-K;return W(U?Y-te:Y+(6-te),V);case o:case E:return G(X+"Hours",0);case u:return G(X+"Minutes",1);case s:return G(X+"Seconds",2);case i:return G(X+"Milliseconds",3);default:return this.clone()}},T.endOf=function(O){return this.startOf(O,!1)},T.$set=function(O,q){var H,U=P.p(O),I="set"+(this.$u?"UTC":""),W=(H={},H[o]=I+"Date",H[E]=I+"Date",H[d]=I+"Month",H[f]=I+"FullYear",H[u]=I+"Hours",H[s]=I+"Minutes",H[i]=I+"Seconds",H[r]=I+"Milliseconds",H)[U],G=U===o?this.$D+(q-this.$W):q;if(U===d||U===f){var _=this.clone().set(E,1);_.$d[W](G),_.init(),this.$d=_.set(E,Math.min(this.$D,_.daysInMonth())).$d}else W&&this.$d[W](G);return this.init(),this},T.set=function(O,q){return this.clone().$set(O,q)},T.get=function(O){return this[P.p(O)]()},T.add=function(O,q){var H,U=this;O=Number(O);var I=P.p(q),W=function(V){var Y=D(U);return P.w(Y.date(Y.date()+Math.round(V*O)),U)};if(I===d)return this.set(d,this.$M+O);if(I===f)return this.set(f,this.$y+O);if(I===o)return W(1);if(I===c)return W(7);var G=(H={},H[s]=l,H[u]=n,H[i]=a,H)[I]||1,_=this.$d.getTime()+O*G;return P.w(_,this)},T.subtract=function(O,q){return this.add(-1*O,q)},T.format=function(O){var q=this,H=this.$locale();if(!this.isValid())return H.invalidDate||v;var U=O||"YYYY-MM-DDTHH:mm:ssZ",I=P.z(this),W=this.$H,G=this.$m,_=this.$M,V=H.weekdays,Y=H.months,X=H.meridiem,K=function(ce,ve,Be,_e){return ce&&(ce[ve]||ce(q,U))||Be[ve].slice(0,_e)},te=function(ce){return P.s(W%12||12,ce,"0")},se=X||function(ce,ve,Be){var _e=ce<12?"AM":"PM";return Be?_e.toLowerCase():_e};return U.replace(y,function(ce,ve){return ve||function(Be){switch(Be){case"YY":return String(q.$y).slice(-2);case"YYYY":return P.s(q.$y,4,"0");case"M":return _+1;case"MM":return P.s(_+1,2,"0");case"MMM":return K(H.monthsShort,_,Y,3);case"MMMM":return K(Y,_);case"D":return q.$D;case"DD":return P.s(q.$D,2,"0");case"d":return String(q.$W);case"dd":return K(H.weekdaysMin,q.$W,V,2);case"ddd":return K(H.weekdaysShort,q.$W,V,3);case"dddd":return V[q.$W];case"H":return String(W);case"HH":return P.s(W,2,"0");case"h":return te(1);case"hh":return te(2);case"a":return se(W,G,!0);case"A":return se(W,G,!1);case"m":return String(G);case"mm":return P.s(G,2,"0");case"s":return String(q.$s);case"ss":return P.s(q.$s,2,"0");case"SSS":return P.s(q.$ms,3,"0");case"Z":return I}return null}(ce)||I.replace(":","")})},T.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},T.diff=function(O,q,H){var U,I=this,W=P.p(q),G=D(O),_=(G.utcOffset()-this.utcOffset())*l,V=this-G,Y=function(){return P.m(I,G)};switch(W){case f:U=Y()/12;break;case d:U=Y();break;case h:U=Y()/3;break;case c:U=(V-_)/6048e5;break;case o:U=(V-_)/864e5;break;case u:U=V/n;break;case s:U=V/l;break;case i:U=V/a;break;default:U=V}return H?U:P.a(U)},T.daysInMonth=function(){return this.endOf(d).$D},T.$locale=function(){return A[this.$L]},T.locale=function(O,q){if(!O)return this.$L;var H=this.clone(),U=S(O,q,!0);return U&&(H.$L=U),H},T.clone=function(){return P.w(this.$d,this)},T.toDate=function(){return new Date(this.valueOf())},T.toJSON=function(){return this.isValid()?this.toISOString():null},T.toISOString=function(){return this.$d.toISOString()},T.toString=function(){return this.$d.toUTCString()},L}(),B=$.prototype;return D.prototype=B,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",o],["$M",d],["$y",f],["$D",E]].forEach(function(L){B[L[1]]=function(T){return this.$g(T,L[0],L[1])}}),D.extend=function(L,T){return L.$i||(L(T,$,D),L.$i=!0),D},D.locale=S,D.isDayjs=N,D.unix=function(L){return D(1e3*L)},D.en=A[x],D.Ls=A,D.p={},D})}(Fl)),Fl.exports}var Q1=mo();const Hl=bn(Q1);var $l={exports:{}},J1=$l.exports,vo;function Z1(){return vo||(vo=1,function(e,t){(function(a,l){e.exports=l(mo())})(J1,function(a){function l(i){return i&&typeof i=="object"&&"default"in i?i:{default:i}}var n=l(a),r={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(i,s){return s==="W"?i+"周":i+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(i,s){var u=100*i+s;return u<600?"凌晨":u<900?"早上":u<1100?"上午":u<1300?"中午":u<1800?"下午":"晚上"}};return n.default.locale(r,null,!0),r})}($l)),$l.exports}Z1();function ja(e){"@babel/helpers - typeof";return ja=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ja(e)}function ey(e,t){if(ja(e)!="object"||!e)return e;var a=e[Symbol.toPrimitive];if(a!==void 0){var l=a.call(e,t);if(ja(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ty(e){var t=ey(e,"string");return ja(t)=="symbol"?t:t+""}function ay(e,t,a){return(t=ty(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function go(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),a.push.apply(a,l)}return a}function Eo(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?go(Object(a),!0).forEach(function(l){ay(e,l,a[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):go(Object(a)).forEach(function(l){Object.defineProperty(e,l,Object.getOwnPropertyDescriptor(a,l))})}return e}var ly={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0},ny=Eo(Eo({},ly),{},{locale:"zh_CN",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",week:"周",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪",yearFormat:"YYYY年",cellDateFormat:"D",monthBeforeYear:!1});const ry={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},yo={lang:Object.assign({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},ny),timePickerLocale:Object.assign({},ry)};yo.lang.ok="确定",Hl.locale("zh-cn");const{RangePicker:iy}=ge.DatePicker,sy=({host:e,onChange:t})=>{const a=e.dataset.key,l=e.dataset.value,n=e.dataset.placeholder,r=e.dataset.limitRange?parseInt(e.dataset.limitRange,10):void 0,i=e.dataset.disableFuture==="true",[s,u]=w.useState(()=>{if(!l)return null;const v=l.split(",");return v.length===2&&v[0]&&v[1]?[Hl(v[0]),Hl(v[1])]:null}),[o,c]=w.useState(null),d=v=>v?i&&v.isAfter(Hl(),"day")?!0:!r||!o||!o[0]?!1:Math.abs(v.diff(o[0],"days"))>r:!1,h=v=>{c(v)},f=v=>{if(u(v),c(null),v&&v[0]&&v[1]){const m=`${v[0].format("YYYY-MM-DD")},${v[1].format("YYYY-MM-DD")}`;e.setAttribute("data-value",m),t(a,m)}else e.setAttribute("data-value",""),t(a,"")},E=v=>{c(v?s:null)};return ft.createPortal(R.jsx("div",{className:"rte-datepicker-wrapper",contentEditable:!1,style:{display:"inline-block",verticalAlign:"middle",width:"260px",marginLeft:"4px",marginRight:"4px",fontSize:"16px",height:"30px",lineHeight:"30px"},children:R.jsx(iy,{value:s,disabledDate:d,onCalendarChange:h,onChange:f,onOpenChange:E,placeholder:[n||"开始日期",n||"结束日期"],style:{width:"100%"},size:"small",allowClear:!0,locale:yo,getPopupContainer:()=>document.body,popupClassName:"rte-datepicker-dropdown"})}),e)},uy=e=>{const[t,a]=w.useState([]);return w.useEffect(()=>{const l=e.current;if(!l)return;const n=()=>{const i=l.querySelectorAll(".rte-datepicker-host"),s=[];i.forEach(u=>{const o=u.getAttribute("data-key");o&&s.push(R.jsx(sy,{host:u,onChange:()=>{if(e.current){const c=new Event("input",{bubbles:!0});e.current.dispatchEvent(c)}}},`datepicker-${o}`))}),a(s)};n();const r=new MutationObserver(i=>{let s=!1;for(const u of i)if(u.type==="childList"){let o=!1;if(u.addedNodes.forEach(c=>{if(c.nodeType===Node.ELEMENT_NODE){const d=c;(d.classList?.contains("rte-datepicker-host")||d.querySelector?.(".rte-datepicker-host"))&&(o=!0)}}),u.removedNodes.forEach(c=>{if(c.nodeType===Node.ELEMENT_NODE){const d=c;(d.classList?.contains("rte-datepicker-host")||d.querySelector?.(".rte-datepicker-host"))&&(o=!0)}}),o){s=!0;break}}s&&n()});return r.observe(l,{childList:!0,subtree:!0}),()=>r.disconnect()},[e]),t},To=e=>e==null?String(e):e instanceof File?`[File:${e.name}/${e.size}]`:Array.isArray(e)?`[Array(${e.length}) ${e.map(To).join(", ")}]`:typeof e=="string"?`[url:${e}]`:String(e),Wt=(e,t)=>{if(!e)return{};const a={};return Object.keys(e).filter(l=>!t||t.length===0?!0:t.some(n=>l===n||l.startsWith(`${n}-`))).sort().forEach(l=>{a[l]=To(e[l])}),a},xo=({config:e,onSend:t,isProcessing:a=!1,disabled:l=!1,width:n,lockStructure:r=!1,agentOptions:i=[],onAgentSelect:s,onAgentExit:u,loading:o=!1,placeholder:c,border:d,background:h="transparent",hideButtons:f,maxHeight:E,minHeight:v,editorMinHeight:m,editorPadding:y,footerPadding:g,collapsed:b=!1,reportAnalyze:C,markdownAnalyze:x,markdownNameAnalyze:A,onCollapsedChange:k,collapseTransitionMs:N=260,debugTooltipSticky:S=!1,nodeValues:D,onFilesChange:P,onFooterFilesChange:$,showFooterUpload:B=!0,footerFiles:L,videoUrlParse:T,videoUpload:O,reportListFetch:q,onReportGoGenerate:H,onViewReport:U,hideCurrentSessionReport:I,reportNameResolve:W})=>{const[G,_]=ge.message.useMessage(),V=w.useRef(null),Y=w.useRef(null),X=w.useRef(null),K=w.useRef(null),te=w.useRef(null),se=w.useRef(null),[ce,ve]=w.useState(!1),Be=w.useRef("");if(!Be.current){const J=Math.random().toString(36).slice(2,8);Be.current=`rte_${J}`}const[_e,At]=w.useState({});w.useEffect(()=>{console.log("[RTE-upload-debug][files-effect:onFilesChange]",{snapshot:Wt(_e)}),P?.(_e)},[_e,P]);const[We,ut]=w.useState([]),Ft=w.useRef(!1);w.useEffect(()=>{if(!L)return;if(!(L.length===We.length&&L.every((ue,ne)=>{const pe=We[ne];return pe&&ue.name===pe.name&&ue.size===pe.size&&ue.lastModified===pe.lastModified})))if(L.reduce((pe,be)=>pe+be.size,0)>52428800){const pe=[];let be=0;for(const ie of L){if(be+ie.size>52428800)break;pe.push(ie),be+=ie.size}G.error("文件总大小不能超过 50MB"),ut(pe)}else Ft.current=!0,ut(L)},[L]),w.useEffect(()=>{if(Ft.current){Ft.current=!1;return}$?.(We)},[We,$]);const[Rl,Ne]=w.useState(null),[et,Ul]=w.useState(null),[Sr,ql]=w.useState(null),[ot,Qa]=w.useState({}),[Z,re]=w.useState(""),[me,ye]=w.useState(!1),ke=w.useRef(null),Xe=w.useRef(null),{tooltipPortal:wt,setPopoverVisible:je}=n1({config:e,files:_e,debugTooltipSticky:S,videoState:ot}),{handleFileChange:jt,handleRemoveFile:Kt}=Lc({config:e,messageApi:G,activeBatchKey:et,activeFileKey:Rl,activeBatchStartIndex:Sr,setActiveFileKey:Ne,setActiveBatchKey:Ul,setActiveBatchStartIndex:ql,setFiles:At}),ze=w.useRef(null),[_t,ct]=w.useState({showLeft:!1,showRight:!1}),Ja=w.useCallback(()=>{const J=ze.current;J&&ct({showLeft:J.scrollLeft>0,showRight:J.scrollLeft+J.clientWidth<J.scrollWidth-1})},[]),xy=w.useCallback(J=>{if(!J.target.files||J.target.files.length===0)return;const ue=10*1024*1024,ne=50*1024*1024,pe=ie=>ie.type?.startsWith("image/")||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(ie.name||""),be=Array.from(J.target.files).filter(ie=>pe(ie)&&ie.size>ue?(G.error("图片大小不能超过 10MB"),!1):!0);ut(ie=>{const Oe=ie.reduce((de,xe)=>de+xe.size,0),De=[];let he=Oe;for(const de of be){if(he+de.size>ne){G.error("文件总大小不能超过 50MB");break}De.push(de),he+=de.size}return De.length>0?[...ie,...De]:ie}),J.target.value="",setTimeout(Ja,0)},[G,Ja]),Cy=w.useCallback(J=>{ut(ue=>ue.filter((ne,pe)=>pe!==J)),setTimeout(Ja,0)},[Ja]),Sy=w.useCallback(()=>{const J=ze.current;J&&J.scrollBy({left:200,behavior:"smooth"})},[]),Ay=w.useCallback(()=>{const J=ze.current;J&&J.scrollBy({left:-200,behavior:"smooth"})},[]),Lo=w.useCallback(()=>{l||ve(!0)},[l]);w.useEffect(()=>{l&&ve(!1)},[l]),w.useEffect(()=>{const J=pe=>pe instanceof Element?!!pe.closest([".rte-agent-dropdown",".rte-report-dropdown-overlay",".rte-tooltip-overlay",".ant-picker-dropdown",".ant-select-dropdown",".ant-image-preview-root"].join(",")):!1,ue=pe=>{const be=V.current,ie=pe.target;be&&(ie instanceof Node&&be.contains(ie)||J(ie)||ve(!1))},ne=pe=>{const be=V.current,ie=pe.target;if(be){if(ie instanceof Node&&be.contains(ie)){l||ve(!0);return}J(ie)||ve(!1)}};return document.addEventListener("mousedown",ue,!0),document.addEventListener("focusin",ne,!0),()=>{document.removeEventListener("mousedown",ue,!0),document.removeEventListener("focusin",ne,!0)}},[l]);const Ar=w.useRef(!1),wy=w.useRef(null),{handleMouseDown:_y,handleMouseMove:ky,handleMouseUp:Ny,handleDoubleClick:Iy}=jc({lockStructure:r,onAgentExit:u,editorRef:K,setPopoverVisible:je,isDraggingRef:Ar,mouseDownPosRef:wy}),[Oo,zl]=w.useState(!1),wr=w.useRef(null),[Do,Po]=w.useState(!0),Ly=w.useRef(0),[Mo,Oy]=w.useState(58),[Dy,Py]=w.useState(58),[_r,My]=w.useState(!1),[By,Fy]=w.useState(!1),[Za,kr]=w.useState(null),el=w.useRef(!1),tl=w.useRef(!1),Et=w.useRef(null),[va,al]=w.useState({}),Ht=w.useRef(()=>{}),Xt=w.useRef({}),Nr=w.useRef(!1),Vl=w.useRef(null),ll=w.useCallback(()=>{Nr.current=!0,Vl.current!==null&&window.clearTimeout(Vl.current),Vl.current=window.setTimeout(()=>{Nr.current=!1,Vl.current=null},50)},[]),[Qt,Gl]=w.useState({}),Bo=w.useRef(()=>{}),Hy=w.useRef({}),Ir=w.useRef(Qt);w.useEffect(()=>{Ir.current=Qt},[Qt]);const[Jt,Lr]=w.useState({}),Fo=w.useRef(()=>{}),Ho=w.useRef(Jt);w.useEffect(()=>{Ho.current=Jt},[Jt]);const[yt,nl]=w.useState(()=>{const J={};return e.forEach(ue=>{Ve(ue.type)&&ue.key&&(J[ue.key]=1)}),J});Hc({config:e,editorRef:K,files:_e,setFiles:At,multiVariableCounts:yt,setMultiVariableCounts:nl,reportAnalyzeState:va,setReportAnalyzeState:al,markdownAnalyzeState:Qt,setMarkdownAnalyzeState:Gl,markdownNameAnalyzeState:Jt,setMarkdownNameAnalyzeState:Lr,nodeValues:D,resolvedReportNamesRef:Xt});const $o=w.useRef(D);if(D!==$o.current&&($o.current=D,D)){const J={};let ue=!1;e.forEach(ne=>{if(Ve(ne.type)&&ne.key){const pe=D[ne.key],be=Array.isArray(pe)?pe.filter(ie=>String(ie??"").trim().length>0):pe;if(Array.isArray(be)&&be.length>0){const ie=ne.maxCount??9,Oe=Math.min(be.length+1,ie);yt[ne.key]!==Oe&&(J[ne.key]=Oe,ue=!0)}}}),ue&&(ll(),nl(ne=>({...ne,...J})))}const Le=zc({config:e,reportAnalyzeState:va,markdownAnalyzeState:Qt,markdownNameAnalyzeState:Jt}),Yl=w.useRef(()=>{}),{handleReportUrlBlur:$y,handleMarkdownBlur:Ry,handleMarkdownNameBlur:Uy,handleMultiVariableNameResolve:Ro}=Rc({reportAnalyze:C,markdownAnalyze:x,markdownNameAnalyze:A,reportAnalyzeState:va,setReportAnalyzeState:al,markdownAnalyzeState:Qt,setMarkdownAnalyzeState:Gl,markdownNameAnalyzeState:Jt,setMarkdownNameAnalyzeState:Lr,editorRef:K,reportAnalyzeRef:Ht,markdownAnalyzeRef:Bo,markdownNameAnalyzeRef:Fo,markdownAnalyzeStateRef:Ir,markdownNameAnalyzeStateRef:Ho,reportNameResolve:W,applyReportNameChipRef:Yl});mc(K,$y,[Le]),Sc(K,Uy,[Le]),Ac(K,Ry,[Le]),w.useEffect(()=>{const J=K.current;if(!J||!W)return;const ue=ne=>{const pe=ne.target;if(!pe)return;const be=pe.closest?.('[data-type="variable"][data-multi-key]');if(!be)return;const ie=be.dataset.key;if(!ie)return;const Oe=wr.current?.key===ie;if(Nr.current&&(Oe||!J.contains(be)))return;const De=J.contains(be)?be:J.querySelector(`[data-type="variable"][data-key="${ie}"]`);if(!De||De.getAttribute("data-report-url"))return;const he=(De.innerText||"").replace(/[\u200B\n]/g,"").trim(),de=De.dataset.multiKey,Me=(de?Le.find(Ae=>Ve(Ae.type)&&Ae.key===de):void 0)?.type==="multi-variable-select"?"multi-variable-select":"multi-variable";Ro(ie,he,Me)};return J.addEventListener("focusout",ue),()=>J.removeEventListener("focusout",ue)},[K,Ro,Le,W]),bc(K,[Le]),Yl.current=(J,ue,ne,pe)=>{const be=K.current;if(!be)return;let ie=be.querySelector(`[data-type="variable"][data-key="${J}"]`);if(ie&&!document.body.contains(ie)){const he=document.querySelectorAll(`.rte-editor [data-type="variable"][data-key="${J}"]`);let de=null;he.forEach(xe=>{!de&&document.body.contains(xe)&&(de=xe)}),ie=de}if(!ie){Xt.current[J]={name:ue,url:ne};return}if(ie.getAttribute("data-report-url")===ne){Xt.current[J]={name:ue,url:ne};return}if(!pe?.forceApply){const he=ie.getAttribute("data-report-url"),de=(ie.innerText||"").replace(/[\u200B\n]/g,"").trim();if(!(!he&&de==="")&&!(he===ne||de===ne))return}Xt.current[J]={name:ue,url:ne};const Oe=ie.querySelector(".rte-report-dropdown-host");Oe&&(Oe.style.display="",Oe.style.visibility="",Oe.classList.remove("hidden"),Oe.classList.add("rte-report-dropdown-host-quiet"));const De=[document.createTextNode(ue)];Oe&&De.push(Oe),ie.classList.remove("show-placeholder","rte-variable-with-icon"),ie.classList.add("rte-report-name-chip"),ie.setAttribute("data-report-url",ne),ie.setAttribute("data-report-name",ue),ie.contentEditable="false",ie.replaceChildren(...De),jl(ie),document.dispatchEvent(new CustomEvent("rte-report-dropdown-force-close",{detail:{key:J}})),setTimeout(()=>{Pr.current()},0)};const qy=w.useCallback((J,ue,ne)=>{K.current&&(ue==="report-url"?(Yl.current(J,ne.name,ne.url,{forceApply:!0}),setTimeout(()=>{Ht.current(J,ne.url)},0)):(ue==="multi-variable"||ue==="multi-variable-select")&&(Yl.current(J,ne.name,ne.url,{forceApply:!0}),ue==="multi-variable-select"&&setTimeout(()=>{Ht.current(J,ne.url)},0)))},[K,Ht]),zy=Le.map(J=>`${J.type}:${J.key??""}:${J.placeholder??""}`).join("|"),Vy=yc(K,q,qy,H,U,`${zy}::${JSON.stringify(yt)}`,I);z1(K,Le,_e,r,yt,wr,void 0,f,void 0,D,ot,!!q,Xt);const Or=w.useRef(new Set),Uo=w.useRef(Le),qo=w.useRef(D);(Uo.current!==Le||qo.current!==D)&&(Uo.current=Le,qo.current=D,Or.current=new Set),w.useEffect(()=>{if(!D||!Le||Le.length===0)return;const J=Le.filter(he=>he.type==="upload"&&he.key);if(J.length===0)return;const ue=J.map(he=>he.key);console.log("[RTE-upload-debug][nodeValues:start]",{uploadKeys:ue,nodeValues:Wt(D,ue)});const ne={},pe=new Set,be=(he,de)=>{if(de)if(de instanceof File){if(Ea(de)){pe.add(he);return}ne[he]=de}else typeof de=="string"&&de.trim()&&(ne[he]=de.trim())};for(const he of J){const de=he.key;if(Or.current.has(de))continue;const xe=D[de],Me=typeof he.maxCount=="number"&&he.maxCount>1;if(Array.isArray(xe)&&xe.length>0){Me?xe.forEach((Ae,Re)=>be(`${de}-${Re}`,Ae)):be(de,xe[0]);continue}if(xe&&!Array.isArray(xe)){be(de,xe);continue}if(Me)for(let Ae=0;Ae<he.maxCount;Ae++){const Re=`${de}-${Ae}`,dt=D[Re];dt&&be(Re,dt)}}console.log("[RTE-upload-debug][nodeValues:collected-before-compact]",{valuesToSet:Wt(ne),rejectedOversizedKeys:Array.from(pe).sort()});for(const he of J){const de=he.key;if(!(typeof he.maxCount=="number"&&he.maxCount>1))continue;const Me=[];for(let Ae=0;Ae<he.maxCount;Ae++){const Re=`${de}-${Ae}`,dt=ne[Re];dt!=null&&Me.push(dt),delete ne[Re]}Me.forEach((Ae,Re)=>{ne[`${de}-${Re}`]=Ae})}if(console.log("[RTE-upload-debug][nodeValues:after-compact]",{valuesToSet:Wt(ne),rejectedOversizedKeys:Array.from(pe).sort()}),Object.keys(ne).length===0&&pe.size===0)return;for(const he of J){const de=he.key,xe=Object.prototype.hasOwnProperty.call(ne,de)||Object.keys(ne).some(Ae=>Ae.startsWith(`${de}-`)),Me=pe.has(de)||Array.from(pe).some(Ae=>Ae.startsWith(`${de}-`));(D[de]!==void 0||xe||Me)&&Or.current.add(de)}At(he=>{const de={...he};let xe=!1;for(const Me of J){const Ae=Me.key;if(D[Ae]===void 0)continue;if(typeof Me.maxCount=="number"&&Me.maxCount>1)for(let dt=0;dt<Me.maxCount;dt++){const ea=`${Ae}-${dt}`;Object.prototype.hasOwnProperty.call(ne,ea)||(pe.has(ea)?he[ea]!==null&&(de[ea]=null,xe=!0):!ne[ea]&&he[ea]&&(de[ea]=null,xe=!0))}else pe.has(Ae)&&he[Ae]!==null&&(de[Ae]=null,xe=!0)}for(const[Me,Ae]of Object.entries(ne))he[Me]!==Ae&&(de[Me]=Ae,xe=!0);return console.log("[RTE-upload-debug][nodeValues:setFiles]",{changed:xe,before:Wt(he,ue),valuesToSet:Wt(ne),rejectedOversizedKeys:Array.from(pe).sort(),after:Wt(de,ue)}),xe?de:he});const ie=Object.entries(ne).filter(([,he])=>typeof he=="string");if(ie.length===0)return;const Oe=async he=>{const de=he.split("/").pop()?.split("?")[0]||"file",xe=decodeURIComponent(de),Me=async Ae=>{const Re=await Ae.blob();return new File([Re],xe,{type:Re.type||"application/octet-stream"})};try{const Ae=`/api/image-proxy?url=${encodeURIComponent(he)}`,Re=await fetch(Ae);if(Re.ok)return Me(Re)}catch{}return null};let De=!1;return Promise.all(ie.map(async([he,de])=>{const xe=await Oe(de);return xe&&Ea(xe)?null:xe?{key:he,file:xe}:null})).then(he=>{if(De)return;const de={};for(const xe of he)xe&&(de[xe.key]=xe.file);Object.keys(de).length>0&&At(xe=>{const Me={...xe};let Ae=!1;for(const[Re,dt]of Object.entries(de))typeof Me[Re]=="string"&&(Me[Re]=dt,Ae=!0);return Ae?Me:xe})}),()=>{De=!0}},[D,Le]);const rl=w.useRef(new Map),zo=w.useRef(""),Vo=((e||[]).find(J=>J.type==="tag")?.text||"")+"||"+(e||[]).filter(J=>J.key&&J.type!=="report-module"&&J.type!=="markdown-module").map(J=>`${J.type}:${J.key}`).join("|");zo.current!==Vo&&(zo.current=Vo,rl.current=new Map),w.useEffect(()=>{if(!D||!e||e.length===0)return;const J=e.filter(ne=>ne.type==="report-url"&&ne.key),ue=e.filter(ne=>ne.type==="multi-variable-select"&&ne.key);if(!(J.length===0&&ue.length===0)){for(const ne of J){const pe=ne.key,be=D[pe]??D[`${pe}__url`];if(!be||typeof be=="string"&&!be.trim())continue;const ie=Array.isArray(be)?String(be[0]??""):String(be);ie&&rl.current.get(pe)!==ie&&(rl.current.set(pe,ie),setTimeout(()=>{Ht.current(pe,ie)},100))}for(const ne of ue){const pe=ne.key,be=D[pe];!Array.isArray(be)||be.length===0||be.forEach((ie,Oe)=>{const De=typeof ie=="string"?ie.trim():"";if(!De)return;const he=`${pe}_${Oe}`;rl.current.get(he)!==De&&(rl.current.set(he,De),setTimeout(()=>{Ht.current(he,De)},100))})}}},[D,e,Ht]),hc(K),V1(K,Le,_e,je,S),G1(K,Le,je,f,S),W1(K,Le,_e,je,S),Y1(K,Le,je,S);const Dr=!!C;j1(K,Le,_e,zl,ot,D,va,Dr),Mc(K,T,ot,Qa,[Le]);const Gy=Bc(O,Qa,K);Fc(K,ot,je,S),K1(K,Ar);const Go=ac(K),Yy=nc(K),Wy=ic(K),Yo=dc(K);w.useEffect(()=>{if(!K.current)return;K.current.querySelectorAll(".rte-richtext-toggle").forEach(ue=>{const ne=ue.getAttribute("data-expanded")==="true";ue.innerHTML=ne?'<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>'})},[Le,K]);const Wo=uy(K),{measureExpandedContentHeight:il}=Uc({collapsed:b,collapseTransitionMs:N,contentRef:Y,contentBodyRef:X,editorRef:K,debugIdRef:Be,setCollapsedContentMaxHeightPx:Oy,setExpandedContentMaxHeightPx:Py,setIsCollapseAnimating:My,effectiveConfig:Le,files:_e,multiVariableCounts:yt,selectPortalsLength:Go.length,datePickerPortalsLength:Wo.length,variablePortalsLength:Yo.length}),jy=()=>{if(b)return;const J=X.current;if(!J)return;const ue=Math.ceil(J.getBoundingClientRect().height||0);ue>0&&kr(ue),el.current=!0,tl.current=!1,Et.current&&(window.clearTimeout(Et.current),Et.current=null)};w.useEffect(()=>{const J=()=>{el.current&&(tl.current=!0,Et.current&&window.clearTimeout(Et.current),Et.current=window.setTimeout(()=>{Et.current=null,el.current=!1,tl.current=!1,kr(null),window.requestAnimationFrame(()=>il())},450))};return window.addEventListener("focus",J),()=>window.removeEventListener("focus",J)},[il]),w.useEffect(()=>{!el.current||!tl.current||(Et.current&&(window.clearTimeout(Et.current),Et.current=null),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{kr(null),il(),el.current=!1,tl.current=!1})}))},[_e,il]),qc({config:e,editorRef:K,setIsEmpty:Po,setIsFormValid:zl});const Ky=Gc({disabled:l,collapsed:b,onCollapsedChange:k,config:e,lockStructure:r,editorRef:K,containerRef:V,fileInputRef:te,onBeforeFilePickerOpen:jy,files:_e,setFiles:At,handleRemoveFile:Kt,setActiveBatchKey:Ul,setActiveBatchStartIndex:ql,setActiveFileKey:Ne,isDraggingRef:Ar,richtextPrevScrollTopRef:Ly,videoState:ot,setVideoState:Qa,videoFileInputRef:ke,activeVideoKeyRef:Xe,onImagePreview:J=>{re(J),ye(!0)}}),sl=Yc({config:e,editorRef:K,setIsEmpty:Po,setIsFormValid:zl,setReportAnalyzeState:al,setMarkdownAnalyzeState:Gl,setMarkdownNameAnalyzeState:Lr,collapsed:b,measureExpandedContentHeight:il,effectiveConfig:Le,files:_e,multiVariableCounts:yt,setMultiVariableCounts:nl,savedCursorRef:wr,videoState:ot,resolvedReportNamesRef:Xt,reportAnalyzeState:va,requireReportUrlAnalyze:Dr}),Pr=w.useRef(sl);Pr.current=sl;const Xy=Kc({disabled:l,config:e,multiVariableCounts:yt,setMultiVariableCounts:nl,editorRef:K,handleInput:sl,markdownAnalyzeRef:Bo,reportAnalyzeRef:Ht,markdownNameAnalyzeRef:Fo,markdownAnalyzeStateRef:Ir,markdownRawTextRef:Hy,setMarkdownAnalyzeState:Gl,setFooterFiles:ut,footerFiles:We,messageApi:G,onPasteUnsupported:()=>G.warning("暂不支持上传该文件类型")});Vc({config:e,effectiveConfig:Le,files:_e,editorRef:K,setIsFormValid:zl,multiVariableCounts:yt,setMultiVariableCounts:nl,videoState:ot,reportAnalyzeState:va,requireReportUrlAnalyze:Dr});const Mr=w.useCallback((J,ue)=>{delete Xt.current[J],ga({keys:[J]}),ue==="report-url"&&al(ne=>({...ne,[J]:{status:"idle",modules:[],lastParsedUrl:void 0,error:void 0}}))},[al]),Qy=w.useCallback(J=>{ll();const{nodeKey:ue,nodeType:ne}=Cc(J);Mr(ue,ne),J.focus(),Pr.current()},[Mr,ll]),Jy=xc(K,Qy,yt),jo=Xc({config:e,files:_e,footerFiles:We,onFooterFilesClear:()=>ut([]),onSend:t,isProcessing:a,disabled:l,loading:o,isFormValid:Oo,editorRef:K,markdownAnalyzeState:Qt,markdownNameAnalyzeState:Jt,videoState:ot}),Zy=Wc({disabled:l,lockStructure:r,config:e,editorRef:K,handleInput:sl,onEnterSend:jo,onReportChipDeleted:Mr}),eT={...n?{width:typeof n=="number"?`${n}px`:n}:{},...d?{border:d}:{},...h?{background:h}:{},...E?{maxHeight:typeof E=="number"?`${E}px`:E}:{},...v&&!b?{minHeight:typeof v=="number"?`${v}px`:v}:{},...We.length>0?{minHeight:"220px"}:{},...E?{"--rte-richtext-fullscreen-height":typeof E=="number"?`${E}px`:E}:{},...m?{"--rte-editor-min-height":typeof m=="number"?`${m}px`:m}:{},...y?{"--rte-editor-padding":y}:{},...g?{"--rte-footer-padding":g}:{}},tT=typeof N=="number"&&Number.isFinite(N)&&N>=0?N:260,aT={overflow:"hidden"},Ko=Za!=null?`${Za}px`:b?`${Mo}px`:`${Math.max(Dy,Mo)}px`,lT=e.length===0&&Do&&!b,nT=Za!=null||b||_r||lT?"hidden":By?"auto":"hidden",Xo=w.useRef(b),Qo=Xo.current!==b;Qo&&(Xo.current=b);const rT=Za!=null?"none":Qo||_r?`max-height ${tT}ms cubic-bezier(0.4, 0, 0.2, 1)`:"none";w.useLayoutEffect(()=>{const J=X.current;if(!J)return;const ue=J.scrollHeight>J.clientHeight+1;Fy(ne=>ne===ue?ne:ue)},[Ko,b,_r,Za,Le,_e,yt,We.length]);const iT={maxHeight:Ko,minHeight:b?0:void 0,overflow:nT,overscrollBehavior:ce?"contain":"auto",transition:rT,willChange:"max-height"},Jo=e.find(J=>J.type==="tag"),Zt=Jo?.text?i.find(J=>J.label===Jo.text):void 0;return R.jsxs("div",{className:`rich-text-editor ${ce?"rte-editor-selected":""}`,style:eT,"data-disabled":l,ref:V,onMouseDownCapture:Lo,onFocusCapture:Lo,children:[_,R.jsxs("div",{className:"rich-text-editor-content",ref:Y,style:aT,onMouseDown:J=>{if(e.length!==0)return;const ue=J.target,ne=K.current;if(!ne||ne.contains(ue)||ue.closest('button, input, a, svg, [role="button"], .rte-footer-files-wrapper'))return;if(J.preventDefault(),ne.childNodes.length===0){ne.appendChild(document.createElement("br")),ne.focus();const Oe=document.createRange();Oe.setStart(ne,0),Oe.collapse(!0);const De=window.getSelection();De?.removeAllRanges(),De?.addRange(Oe);return}const be=window.getSelection(),ie=!!be&&be.rangeCount>0&&ne.contains(be.anchorNode);if(ne.focus(),!ie){const Oe=document.createRange();Oe.selectNodeContents(ne),Oe.collapse(!1);const De=window.getSelection();De?.removeAllRanges(),De?.addRange(Oe)}},children:[We.length>0&&R.jsxs("div",{className:"rte-footer-files-wrapper",children:[_t.showLeft&&R.jsx("div",{className:"rte-footer-files-mask rte-footer-files-mask-left",children:R.jsx("span",{className:"rte-footer-files-arrow rte-footer-files-arrow-left",onClick:Ay,children:R.jsx("svg",{style:{width:"16px",height:"16px",transform:"rotate(180deg)"},"aria-hidden":"true",children:R.jsx("use",{xlinkHref:"#icon-fanhuijiantou"})})})}),R.jsx("div",{className:"rte-footer-files-list",ref:ze,onScroll:Ja,children:We.map((J,ue)=>{const ne=J.type?.startsWith("image/")||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(J.name||""),pe=J.size<1024?`${J.size}B`:J.size<1024*1024?`${Math.round(J.size/1024)}KB`:`${(J.size/(1024*1024)).toFixed(1)}MB`,be=ne?URL.createObjectURL(J):"";return R.jsxs("div",{className:"rte-footer-file-chip",style:ne?{cursor:"pointer"}:void 0,onClick:ne?()=>{re(be),ye(!0)}:void 0,children:[ne?R.jsx("img",{style:{width:"32px",height:"32px",objectFit:"contain",background:"#ffffff",border:"0.5px solid #EDF0F2",boxShadow:"0 2px 6px 1px rgba(174, 176, 180, 0.08)",boxSizing:"border-box"},className:"rte-footer-file-thumb",src:be,alt:J.name}):R.jsx("div",{className:"rte-footer-file-icon",children:R.jsx("svg",{style:{width:"18px",height:"18px"},"aria-hidden":"true",children:R.jsx("use",{xlinkHref:`#${(()=>{const ie=(J.name||"").split(".").pop()?.toLowerCase()||"";return["xls","xla","xlb","xlc","xlm","xlsx","xlt","xlw","csv","tsv","iif"].includes(ie)?"icon-a-xlsxcsv":["doc","docx","dot","odt","rtf","wiz"].includes(ie)?"icon-docx":["ppt","pptx","pot","ppa","pps","pwz"].includes(ie)?"icon-ppt":["txt","asm","bat","c","cc","conf","cpp","css","cxx","def","dic","eml","h","hh","in","js","ksh","php","pkl","rb","tar","tex","ts","xml"].includes(ie)?"icon-txt":ie==="pdf"?"icon-pdf":["html","htm","json","ics","ifb"].includes(ie)?"icon-a-htmljson":ie==="md"?"icon-md":"icon-lianjie"})()}`})})}),R.jsxs("div",{className:"rte-footer-file-info",children:[R.jsx("span",{className:"rte-footer-file-name",title:J.name,children:J.name}),R.jsx("span",{className:"rte-footer-file-size",children:pe})]}),R.jsx("span",{className:"rte-footer-file-remove",onClick:ie=>{ie.stopPropagation(),Cy(ue)},children:R.jsx("i",{className:"iconfont icon-guanbi ",style:{width:"8px",height:"8px",fontSize:"8px",display:"flex",alignItems:"center"}})})]},`${J.name}-${J.size}-${ue}`)})}),_t.showRight&&R.jsx("div",{className:"rte-footer-files-mask rte-footer-files-mask-right",children:R.jsx("span",{className:"rte-footer-files-arrow rte-footer-files-arrow-right",onClick:Sy,children:R.jsx("svg",{style:{width:"16px",height:"16px"},"aria-hidden":"true",children:R.jsx("use",{xlinkHref:"#icon-fanhuijiantou"})})})})]}),R.jsxs("div",{ref:X,className:`rich-text-editor-content-body ${e.length===0?"rich-text-editor-content-body-default":""}`,style:iT,children:[R.jsx("div",{ref:K,className:`rte-editor ${e.length===0?"rte-editor-default":""} ${Do&&c?"rte-editor-empty":""} ${e.some(J=>J.type==="tag")?"rte-editor-with-agent":""}`,contentEditable:e.length===0,suppressContentEditableWarning:!0,"data-placeholder":c,onMouseDown:_y,onMouseMove:ky,onMouseUp:Ny,onClick:Ky,onDoubleClick:Iy,onInput:()=>{ll(),sl()},onKeyDown:Zy,onPaste:J=>{ll(),Xy(J)}}),R.jsx("input",{type:"file",ref:te,className:"rte-file-input",accept:".csv,.xlsx,.xls,.txt,.pdf,image/*",onChange:jt}),R.jsx("input",{type:"file",ref:ke,className:"rte-file-input",accept:"video/*",onChange:J=>{const ue=J.target.files?.[0],ne=Xe.current;ue&&ue.size>1024*1024*1024?G.warning("视频文件不能超过1GB"):ue&&ne&&Gy(ne,ue),Xe.current=null,ke.current&&(ke.current.value="")}})]})]}),R.jsxs("div",{className:"rich-text-editor-footer",children:[R.jsxs("div",{className:"rich-text-editor-footer-left",children:[R.jsx("div",{className:"rich-text-editor-brand",children:f!=="hideAgent"&&R.jsx(ge.Dropdown,{placement:"topLeft",menu:{selectedKeys:Zt?[String(Zt.key)]:[],items:i.filter(J=>J.isShowNew!==1).map(J=>({key:J.key,label:R.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[J.icon&&R.jsx("i",{className:J.icon}),R.jsx("span",{children:J.label})]}),onClick:()=>{s?.(J)}}))},trigger:["click"],disabled:l||a,overlayClassName:"rte-agent-dropdown",children:R.jsxs("div",{className:"rte-agent-badge",style:{cursor:i.length>0?"pointer":"default"},children:[R.jsx("i",{className:"iconfont icon-zhinengti",style:{fontSize:"16px"}}),R.jsx("span",{className:"rte-agent-text",children:"智能体"})]})})}),!e.find(J=>J.type==="tag")&&R.jsxs(R.Fragment,{children:[R.jsx("div",{className:"rte-footer-upload-btn",onClick:()=>se.current?.click(),title:"上传文件",children:R.jsx("i",{className:"iconfont icon-lianjie",style:{fontSize:"16px"}})}),R.jsx("input",{type:"file",ref:se,className:"rte-file-input",accept:".pdf,.xla,.xlb,.xlc,.xlm,.xls,.xlsx,.xlt,.xlw,.csv,.tsv,.iif,.doc,.docx,.dot,.odt,.rtf,.pot,.ppa,.pps,.ppt,.pptx,.pwz,.wiz,.asm,.bat,.c,.cc,.conf,.cpp,.css,.cxx,.def,.dic,.eml,.h,.hh,.htm,.html,.ics,.ifb,.in,.js,.json,.ksh,.png,.jpeg,.jpg,.gif,.webp,.md,.php,.pkl,.rb,.tar,.tex,.ts,.txt,.xml,",multiple:!0,onChange:xy})]})]}),R.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[R.jsxs("div",{className:"rte-brand-badge",children:[R.jsx("div",{className:"rte-brand-badge",children:R.jsx("img",{src:"https://oospublic.sealseek.cn/file/website/ball.png",alt:""})}),R.jsx("span",{className:"rte-brand-text",style:{marginLeft:"4px"},children:"SealSeek 2.0"})]}),!Zt||Zt.points===void 0||Zt.points===null?null:R.jsxs("div",{className:"rte-points-badge",style:{position:"relative"},children:[R.jsx("i",{className:"iconfont icon-jifen",style:{marginRight:"4px",fontSize:"16px"}}),R.jsxs("span",{style:{fontSize:"16px",lineHeight:"22px"},children:["-",String(Zt.points)]}),Zt.labelValue===2&&R.jsx("div",{className:"rte-limited-free-badge",children:R.jsx("span",{className:"rte-limited-free-text",children:"限时免费"})})]}),R.jsx("button",{type:"button",onClick:jo,disabled:a||l||o||!Oo,className:"rich-text-editor-send-button",children:a||o?R.jsx("span",{className:"rte-send-spinner"}):R.jsx("i",{className:"iconfont icon-fasong"})})]})]}),wt,R.jsx(ge.Image,{style:{display:"none"},src:Z,preview:{visible:me,onVisibleChange:J=>ye(J)}}),Wo,Go,Yy,Wy,Yo,Vy,Jy]})};xo.__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 Co="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFSSURBVHgB3ZTtccIwDIaVXv83I2SDZgSP0BHMBG0naEZhA2boBGQDswHdQJUOGRxjO0Z8HPDe6eJzJD2W4gjgEYSIn2xwK6EIFHqBGysJpMP3ZB0oRbEtmal1NtIxl4OWWsoxEsvqofJ0rgTNASOYq+7SXKDsuYvAcgkq/PWwBLQWqIfdjeRStaBUc4qzgLi9/BzJNmS/sh6bpvmrTfSFacU3scWy1mQryWdSnXiFE8QVUJINLTuyhWzzz/1OZmTN9hEckqtfUOwIGlGCpVRjE+94JFqpMtTeVzO8/UmPxpZU8Qa7aln8Tb9pfwla4WHWrjPvvbbnTBsX7PmLs83EDAH0BxSw1G31+/1FoDg/vPcXR+wocQS1apj4+P92FfhOoLyuBfYlmPgYnGoCjWADzAkzUyJ430awLmphPaxWQVU22BuuApPkHaanjcXSN3t6/QNjTMSJWDcs1QAAAABJRU5ErkJggg==",oy=[{label:"5页",value:5},{label:"10页",value:10},{label:"15页",value:15},{label:"30页",value:30}],cy=({autoLoading:e,batchSize:t,loadingProgress:a,loadIcon:l,onBatchSizeChange:n,onLoadNextPage:r,onStartAutoLoad:i,onStopLoad:s})=>e&&a?R.jsxs("div",{className:"auto_load_progress",children:[l||R.jsx("img",{src:Co,alt:"自动加载",width:14,height:14}),R.jsxs("span",{children:["正在加载第",a.currentPage,"/",a.totalPages,"页"]}),R.jsx(ge.Progress,{percent:a.percentage,type:"line",size:[160,8]}),R.jsx("span",{onClick:s,className:"auto_load_stop_btn",children:"停止加载"})]}):R.jsxs("div",{className:"auto_load_container",children:[R.jsx("div",{onClick:r,className:"auto_load_next_btn",style:{backgroundColor:e?"#f5f5f5":"#2563eb"},children:"加载下一页"}),R.jsxs("div",{className:"right_control_wrap",style:{backgroundColor:e?"#f5f5f5":"#2563eb"},children:[R.jsxs("div",{className:"auto_load_btn",onClick:e?void 0:i,children:[l||R.jsx("img",{src:Co,alt:"自动加载",width:14,height:14}),R.jsx("span",{children:"自动加载"})]}),R.jsx(ge.Select,{value:t,onChange:n,options:oy,disabled:e,size:"small",className:"auto_load_select",popupMatchSelectWidth:84})]})]}),dy=({current:e,loadIcon:t,pageSize:a,total:l,cachedPages:n,loadedCount:r,autoLoading:i=!1,loadingProgress:s,onChange:u,onLoadNextPage:o,onStartAutoLoad:c,onStopLoading:d})=>{const[h,f]=w.useState(5),E=Math.ceil(l/a),v=w.useMemo(()=>n.length>=E,[n,E]),m=()=>Array.from({length:E},(b,C)=>C+1).filter(b=>!n.includes(b)).slice(0,h),y=(g,b,C)=>{const x=n.includes(g);return b==="prev"||b==="next"||b==="jump-prev"||b==="jump-next"?R.jsx("div",{className:"pageBox",children:C}):R.jsxs("div",{className:"pageBox",style:{backgroundColor:e===g?"#2563EB":"#f5f5f5",color:e===g?"#fff":x?"#171717":"#a3a3a3"},children:[g,!x&&R.jsx("span",{className:"unload_spot"})]})};return R.jsxs("div",{className:"pagination_footer",children:[R.jsxs("div",{className:"pagination_leftWrap",children:[R.jsxs("span",{className:"pagination_total",children:[R.jsx(Tt.InfoCircleOutlined,{style:{color:"#2563EB",marginRight:"4px"}}),"已加载: ",r,"/",l,"条数据"]}),!v&&R.jsx(cy,{loadIcon:t||void 0,autoLoading:i,batchSize:h,loadingProgress:s,disabled:!o||!c,onBatchSizeChange:f,onLoadNextPage:()=>o?.(),onStartAutoLoad:()=>{const g=m();c?.(g)},onStopLoad:()=>d?.()})]}),R.jsx(ge.Pagination,{current:e,pageSize:a,total:l,onChange:g=>u(g),showSizeChanger:!1,showQuickJumper:!1,showTotal:()=>"",itemRender:y})]})},So=e=>{const{loading:t,autoLoading:a,loadingProgress:l,columns:n=[],dataSource:r=[],total:i,current:s,pageSize:u,cachedPages:o,onChangePage:c,onLoadNextPage:d,onStartAutoLoad:h,onStopLoading:f,...E}=e,v=w.useRef(null),m=w.useCallback(y=>{c(y),o.includes(y)&&v.current?.scrollTo({key:`${(y-1)*u+1}`})},[o,c,u]);return R.jsxs("div",{className:"flex flex-col",children:[R.jsx(ge.Table,{ref:v,...E,columns:n,dataSource:r,pagination:!1,virtual:!0}),R.jsx(dy,{loading:t,autoLoading:a,loadingProgress:l,current:s,pageSize:u,total:i,loadedCount:r.length,cachedPages:o,onChange:m,onLoadNextPage:d,onStartAutoLoad:h,onStopLoading:f})]})};So.__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 Ao=({texts:e=[],placeholder:t="请输入内容",animationSpeed:a=100,autoPlay:l=!0,value:n,onChange:r,...i})=>{const[s,u]=w.useState(""),[o,c]=w.useState(0),[d,h]=w.useState(!1),[f,E]=w.useState(!1),[v,m]=w.useState(!1),y=w.useRef(void 0),g=w.useRef(void 0),b=w.useRef(e),C=w.useRef(o),x=w.useRef(f),A=w.useRef(s);w.useEffect(()=>{b.current=e,C.current=o,x.current=f,A.current=s});const k=w.useCallback((L,T)=>{let O=0;m(!0);const q=()=>{O<L.length?(u(L.slice(0,O+1)),O++,g.current=window.setTimeout(q,a)):(m(!1),T?.())};q()},[a]),N=w.useCallback(L=>{let T=A.current.length;const O=()=>{T>0?(u(A.current.slice(0,T-1)),T--,g.current=window.setTimeout(O,a/2)):L?.()};O()},[a]),S=w.useCallback(()=>{if(b.current.length===0||x.current)return;h(!0);const L=b.current[C.current];A.current?N(()=>{k(L,()=>{y.current=window.setTimeout(()=>{c(T=>(T+1)%b.current.length),h(!1)},2e3)})}):k(L,()=>{y.current=window.setTimeout(()=>{c(T=>(T+1)%b.current.length),h(!1)},2e3)})},[N,k]);w.useEffect(()=>(l&&e.length>0&&!f&&S(),()=>{y.current&&window.clearTimeout(y.current),g.current&&window.clearTimeout(g.current)}),[o,f,l,e.length,S]),w.useEffect(()=>{!d&&l&&e.length>0&&!f&&S()},[o,d,l,e.length,f,S]);const D=L=>{E(!0),y.current&&window.clearTimeout(y.current),g.current&&window.clearTimeout(g.current),h(!1),m(!1),i.onFocus?.(L)},P=L=>{E(!1),!n&&e.length>0&&(u(""),c(0)),i.onBlur?.(L)},$=L=>{r?.(L.target.value),i.onChange?.(L)},B=()=>f||n?t:s||t;return R.jsxs("div",{style:{position:"relative"},children:[R.jsx(ge.Input,{...i,value:n,onChange:$,onFocus:D,onBlur:P,placeholder:B(),style:{...i.style,position:"relative",zIndex:1}}),!f&&!n&&s&&R.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:[R.jsx("span",{children:s}),v&&R.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),R.jsx("style",{children:`
|
|
64
|
+
`);return X.replace(/\n/g,"").trim().length>0?X:""},Y=W.getAttribute("data-node-type");if(Y==="report-url")if(_)N[`${G}__url`]=_;else{const X=V().replace(/\n/g,"").trim();X&&(N[`${G}__url`]=X)}else{const X=V();X&&(Y==="markdown-name"?N[`${G}__name`]=X:N[G]=X)}}}),e.current.querySelectorAll('[data-type="select"]').forEach(W=>{const G=W.dataset.key;if(G){const _=(W.getAttribute("data-value")||"").trim();_&&(N[G]=_)}}),e.current.querySelectorAll('[data-type="searchable-select"]').forEach(W=>{const G=W.dataset.key;if(G){const _=(W.getAttribute("data-value")||"").trim();_&&(N[G]=_)}}),e.current.querySelectorAll('[data-type="textarea"]').forEach(W=>{const G=W.dataset.key;if(G){const _=W.value.replace(/[\u200B]/g,"").trim();_&&(N[G]=_)}}),e.current.querySelectorAll('[data-type="richtext"]').forEach(W=>{const G=W.dataset.key;if(G){const _=W.getAttribute("data-node-type")||"",V=_==="report-module"||_==="markdown-module",Y=V?(W.innerHTML||"").replace(/[\u200B]/g,"").trim():(W.textContent||"").replace(/[\u200B]/g,"").trim();if(V){const X=Number.parseInt(W.getAttribute("data-module-index")||"0",10);N[`${G}__module_${Number.isFinite(X)?X:0}`]=Y}else Y&&(N[G]=Y)}}),e.current.querySelectorAll('[data-type="datepicker"]').forEach(W=>{const G=W.dataset.key;if(G){const _=(W.getAttribute("data-value")||"").trim();_&&(N[G]=_)}}),e.current.querySelectorAll('[data-type="number-input"]').forEach(W=>{const G=W.dataset.key;if(G){const _=(W.value||"").trim();_&&(N[G]=_)}})),o&&Object.keys(o).length>0){const L={};k||Object.entries(o).forEach(([T,O])=>{if(!Array.isArray(O))return;let q=0;for(let U=0;U<O.length;U++)`${T}_${U}`in N&&q++;let H=-1;for(let U=0;U<O.length;U++)f.current.has(`${T}_${U}`)&&(H=U);if(H>=q&&q<O.length)for(let U=q;U<O.length;U++)D.add(`${T}_${U}`)}),Object.entries(o).forEach(([T,O])=>{po(t,T)||(Array.isArray(O)?O.forEach((q,H)=>{q!=null&&String(q).trim()!==""&&(L[`${T}_${H}`]=String(q))}):O!=null&&String(O).trim()!==""&&(t.find(H=>H.key===T&&H.type==="report-url")?L[`${T}__url`]=String(O):L[T]=String(O)))}),Object.entries(L).forEach(([T,O])=>{const q=T in N,H=D.has(T),U=y.current[T]!==O;!H&&(!q||U)&&(N[T]=O)});for(const T of Object.keys(y.current))!(T in L)&&T in N&&delete N[T];y.current=L}if($1(e,t,a,l,N,n,s,u,c,d),m.current=b,h&&e.current)for(const[L,{name:T,url:O}]of Object.entries(h.current)){const q=e.current.querySelector(`[data-type="variable"][data-key="${L}"]`);if(!q)continue;const H=q.querySelector(".rte-report-dropdown-host");H&&(H.style.display="",H.style.visibility="",H.classList.remove("hidden"),H.classList.add("rte-report-dropdown-host-quiet"));const U=[document.createTextNode(T)];H&&U.push(H),q.setAttribute("data-report-url",O),q.setAttribute("data-report-name",T),q.removeAttribute("data-tooltip"),q.contentEditable="false",q.classList.add("rte-report-name-chip"),q.classList.remove("show-placeholder","rte-variable-with-icon"),q.replaceChildren(...U),jl(q)}if(k&&(v.current=!1),setTimeout(()=>{if(ta(e),h?.current)for(const[L,T]of Object.entries(h.current))S[L]||(S[L]=T);if(Object.keys(S).length>0&&e.current)for(const[L,T]of Object.entries(S)){let O=null;if(T.multiKey){const U=L.split("::")[1];O=e.current.querySelector(`[data-type="variable"][data-multi-key="${T.multiKey}"][data-key="${U}"]`)}else O=e.current.querySelector(`[data-type="variable"][data-key="${L}"]`);if(!O)continue;const q=O.querySelector(".rte-report-dropdown-host");q&&(q.style.display="",q.style.visibility="",q.classList.remove("hidden"),q.classList.add("rte-report-dropdown-host-quiet"));const H=[document.createTextNode(T.name)];q&&H.push(q),O.classList.remove("show-placeholder","rte-variable-with-icon"),O.classList.add("rte-report-name-chip"),O.setAttribute("data-report-url",T.url),O.setAttribute("data-report-name",T.name),O.contentEditable="false",O.replaceChildren(...H),jl(O)}ya(e,t,a,c)},0),r?.current){const{key:L,offset:T}=r.current;setTimeout(()=>{if(!e.current)return;const O=e.current.querySelector(`[data-type="variable"][data-key="${L}"]`);if(O){if(O.dataset.variableRender==="antd-textarea"){const q=O.querySelector("textarea");if(q){q.focus();try{const H=q.value?.length??0;q.setSelectionRange(Math.min(T,H),Math.min(T,H))}catch{}r.current=null;return}}try{const q=document.createRange(),H=document.createTreeWalker(O,NodeFilter.SHOW_TEXT,null);let U=0,I=null,W=0;for(;H.nextNode();){const G=H.currentNode,_=G.textContent?.length||0;if(U+_>=T){I=G,W=T-U;break}U+=_}if(I){q.setStart(I,Math.min(W,I.textContent?.length||0)),q.collapse(!0);const G=window.getSelection();G&&(G.removeAllRanges(),G.addRange(q),O.focus())}else{q.selectNodeContents(O),q.collapse(!1);const G=window.getSelection();G&&(G.removeAllRanges(),G.addRange(q),O.focus())}}catch{const q=document.createRange();q.selectNodeContents(O),q.collapse(!1);const H=window.getSelection();H&&(H.removeAllRanges(),H.addRange(q),O.focus())}r.current=null}},0)}},[t,a,l,e,n,r,i,s,u,o,c,d]);w.useEffect(()=>{g()},[g])}function V1(e,t,a,l,n){w.useEffect(()=>{const r=e.current;if(!r)return;const i=y=>typeof y=="string"?/\.(png|jpe?g|gif|webp|bmp|svg)(\?.*)?$/i.test(y):y.type?.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(y.name||""),s=y=>{if(y.target?.closest(".rte-tutorial-btn"))return;const b=y.target?.closest(".upload-info-icon");if(b&&b.classList.contains("upload-info-icon")){const x=b.dataset.uploadKey;if(x){const A=b.closest('[data-type="upload"], [data-type="video-upload"]');l({key:x,anchorEl:A||b,type:"upload"})}return}const C=y.target?.closest('[data-type="upload"]');if(C){const x=C.dataset.key;if(x){const A=a[x];A&&i(A)&&l({key:x,anchorEl:C,type:"upload-preview"})}}},u=y=>{if(n)return;const g=y.relatedTarget;if(g?.closest?.(".rte-tooltip-overlay")||y.target?.closest(".rte-tutorial-btn"))return;const C=y.target?.closest(".upload-info-icon");if(C&&C.classList.contains("upload-info-icon")){const A=C.closest('[data-type="upload"], [data-type="video-upload"]');if(g&&A&&A.contains(g))return;if(!g||!r.contains(g))l(null);else{const k=g.closest('[data-type="upload"], [data-type="video-upload"]');(!k||k!==A)&&l(null)}return}const x=y.target?.closest('[data-type="upload"], [data-type="video-upload"]');if(x){const A=g;if(A?.closest?.(".rte-tooltip-overlay")||A&&x.contains(A))return;l(null)}};r.addEventListener("mouseover",s,!0),r.addEventListener("mouseout",u,!0);const o=y=>{const g=y.currentTarget,b=g.dataset.uploadKey;if(b){const C=g.closest('[data-type="upload"], [data-node-type="video-url"]');l({key:b,anchorEl:C||g,type:"upload"})}},c=y=>{if(n)return;const g=y.relatedTarget;if(g?.closest?.(".rte-tooltip-overlay"))return;const C=y.currentTarget.closest('[data-type="upload"], [data-node-type="video-url"]');g&&C?.contains(g)||l(null)},d=new WeakSet,h=()=>{r.querySelectorAll(".rte-tutorial-btn").forEach(y=>{d.has(y)||(d.add(y),y.addEventListener("mouseenter",o),y.addEventListener("mouseleave",c))})};let f=requestAnimationFrame(()=>{f=requestAnimationFrame(h)}),E=0;const v=()=>{E||(E=requestAnimationFrame(()=>{E=0,h()}))},m=new MutationObserver(y=>{for(const g of y)if(!(g.type!=="childList"||g.addedNodes.length===0))for(const b of g.addedNodes){if(b.nodeType!==Node.ELEMENT_NODE)continue;const C=b;if(C.matches?.(".rte-tutorial-btn")||C.querySelector?.(".rte-tutorial-btn")){v();return}}});return m.observe(r,{childList:!0,subtree:!0}),()=>{r.removeEventListener("mouseover",s,!0),r.removeEventListener("mouseout",u,!0),cancelAnimationFrame(f),E&&cancelAnimationFrame(E),m.disconnect(),r.querySelectorAll(".rte-tutorial-btn").forEach(y=>{y.removeEventListener("mouseenter",o),y.removeEventListener("mouseleave",c)})}},[t,a,e,l,n])}function G1(e,t,a,l,n){w.useEffect(()=>{const r=e.current;if(!r)return;const i=c=>{if(l==="hideTagClose")return;const d=c.currentTarget,h=d.dataset.tooltip,f=d.dataset.tagKey||"";h&&a({key:f,anchorEl:d,type:"tag"})},s=c=>{n||c.relatedTarget?.closest?.(".rte-tooltip-overlay")||a(null)};let u;const o=()=>{r.querySelectorAll(".tag-node[data-tooltip]").forEach(d=>{d.addEventListener("mouseenter",i),d.addEventListener("mouseleave",s)})};return u=requestAnimationFrame(()=>{u=requestAnimationFrame(o)}),()=>{cancelAnimationFrame(u),r.querySelectorAll(".tag-node[data-tooltip]").forEach(d=>{d.removeEventListener("mouseenter",i),d.removeEventListener("mouseleave",s)})}},[t,e,a,l,n])}function Y1(e,t,a,l){w.useEffect(()=>{const n=e.current;if(!n)return;const r=s=>{if(s.target?.closest(".rte-report-dropdown-host"))return;const o=s.target?.closest(".variable-info-icon");if(o&&o.classList.contains("variable-info-icon")){const c=o.dataset.variableKey;c&&a({key:c,anchorEl:o,type:"variable"});return}},i=s=>{if(l)return;const u=s.target,o=s.relatedTarget;if(o?.closest?.(".rte-tooltip-overlay"))return;if(u?.closest?.(".variable-info-icon")){if(!o||!n.contains(o)){a(null);return}!!o.closest?.(".variable-info-icon")||a(null)}};return n.addEventListener("mouseover",r,!0),n.addEventListener("mouseout",i,!0),()=>{n.removeEventListener("mouseover",r,!0),n.removeEventListener("mouseout",i,!0)}},[t,e,a,l])}function W1(e,t,a,l,n){w.useEffect(()=>{const r=e.current;if(!r)return;const i=d=>typeof d=="string"?/\.(png|jpe?g|gif|webp|bmp|svg)(\?.*)?$/i.test(d):d.type?.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(d.name||""),s=d=>{const h=d.currentTarget,f=h.dataset.fileName,E=h.closest('[data-type="upload"]'),v=E?.dataset.key||"",m=v?a[v]:null;if(m&&i(m)){l({key:v,anchorEl:E||h,type:"upload-preview"});return}f&&l({key:v,anchorEl:E||h,type:"upload-label"})},u=d=>{n||d.relatedTarget?.closest?.(".rte-tooltip-overlay")||l(null)};let o;const c=()=>{r.querySelectorAll(".upload-label[data-file-name]").forEach(h=>{h.addEventListener("mouseenter",s),h.addEventListener("mouseleave",u)})};return o=requestAnimationFrame(()=>{o=requestAnimationFrame(c)}),()=>{cancelAnimationFrame(o),r.querySelectorAll(".upload-label[data-file-name]").forEach(h=>{h.removeEventListener("mouseenter",s),h.removeEventListener("mouseleave",u)})}},[t,a,e,l,n])}function j1(e,t,a,l,n,r,i,s){w.useEffect(()=>{const u=setTimeout(()=>{ya(e,t,a,n),Ql(e,t,a,l,n,{reportAnalyzeState:i,requireReportUrlAnalyze:s})},0);return()=>clearTimeout(u)},[a,t,e,l,n,r,i,s])}function K1(e,t){const a=w.useRef(0),l=w.useRef(0);w.useEffect(()=>{if(!e.current)return;let n=!1,r=0;const i=g=>g instanceof HTMLElement?!!(g.closest(".rte-datepicker-wrapper")||g.closest(".rte-datepicker-host")||g.closest(".ant-picker")||g.closest(".ant-picker-dropdown")):!1,s=g=>g instanceof HTMLElement?!!(g.closest(".rte-select-wrapper")||g.closest(".rte-select-host")||g.closest(".ant-select")||g.closest(".ant-select-dropdown")):!1,u=g=>{n=!0,i(g.target)&&(a.current=Date.now()),s(g.target)&&(l.current=Date.now())},o=()=>{n=!1,r=Date.now()};let c=!1,d=0;const h=()=>{c=!0},f=()=>{c=!1,d=Date.now()},E=()=>{d=Date.now()},v=g=>{i(g.target)&&(a.current=Date.now()),s(g.target)&&(l.current=Date.now())},m=()=>{if(Date.now()-a.current<800||Date.now()-l.current<800)return;const g=document.activeElement;if(g&&(g.closest(".rte-datepicker-wrapper")||g.closest(".rte-datepicker-host")||g.closest(".ant-picker-dropdown")||g.tagName==="INPUT"&&g.closest(".ant-picker")||g.closest(".rte-select-wrapper")||g.closest(".rte-select-host")||g.closest(".ant-select")||g.closest(".ant-select-dropdown"))||!e.current)return;const b=window.getSelection();if(!b||b.rangeCount===0||t.current||n||c||Date.now()-d<500)return;const C=b.getRangeAt(0);if(!C.collapsed)return e.current.contains(C.commonAncestorContainer),void 0;const x=b.anchorNode;if(!x||!e.current.contains(x))return;let A=!1,k=!1;if(x.nodeType===Node.ELEMENT_NODE){const S=x;(S.closest('[data-type="datepicker"]')||S.closest(".rte-datepicker-wrapper")||S.closest(".rte-datepicker-host"))&&(A=!0),(S.closest('[data-type="select"]')||S.closest(".rte-select-wrapper")||S.closest(".rte-select-host"))&&(k=!0)}else if(x.parentElement){const S=x.parentElement;(S.closest('[data-type="datepicker"]')||S.closest(".rte-datepicker-wrapper")||S.closest(".rte-datepicker-host"))&&(A=!0),(S.closest('[data-type="select"]')||S.closest(".rte-select-wrapper")||S.closest(".rte-select-host"))&&(k=!0)}if(A||k)return;let N=null;if(x.nodeType===Node.ELEMENT_NODE?N=x.closest('[data-type="variable"]'):x.nodeType===Node.TEXT_NODE&&x.parentElement&&(N=x.parentElement.closest('[data-type="variable"]')),!N){if(Date.now()-r>500)return;const S=e.current.querySelectorAll('[data-type="variable"]');if(S.length>0){let D=null;for(const P of Array.from(S))if(P.style.display!=="none"){D=P;break}if(!D&&S.length>0&&(D=S[0]),D){const P=document.createRange();P.selectNodeContents(D),P.collapse(!1),b.removeAllRanges(),b.addRange(P),D.focus()}else b.removeAllRanges()}else b.removeAllRanges()}},y=e.current;return y&&(y.addEventListener("compositionstart",h),y.addEventListener("compositionend",f),y.addEventListener("input",E)),document.addEventListener("mousedown",u),document.addEventListener("mouseup",o),document.addEventListener("focusin",v),document.addEventListener("selectionchange",m),()=>{y&&(y.removeEventListener("compositionstart",h),y.removeEventListener("compositionend",f),y.removeEventListener("input",E)),document.removeEventListener("mousedown",u),document.removeEventListener("mouseup",o),document.removeEventListener("focusin",v),document.removeEventListener("selectionchange",m)}},[e,t])}var Fl={exports:{}},X1=Fl.exports,bo;function mo(){return bo||(bo=1,function(e,t){(function(a,l){e.exports=l()})(X1,function(){var a=1e3,l=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",o="day",c="week",d="month",h="quarter",f="year",E="date",v="Invalid Date",m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(L){var T=["th","st","nd","rd"],O=L%100;return"["+L+(T[(O-20)%10]||T[O]||T[0])+"]"}},b=function(L,T,O){var q=String(L);return!q||q.length>=T?L:""+Array(T+1-q.length).join(O)+L},C={s:b,z:function(L){var T=-L.utcOffset(),O=Math.abs(T),q=Math.floor(O/60),H=O%60;return(T<=0?"+":"-")+b(q,2,"0")+":"+b(H,2,"0")},m:function L(T,O){if(T.date()<O.date())return-L(O,T);var q=12*(O.year()-T.year())+(O.month()-T.month()),H=T.clone().add(q,d),U=O-H<0,I=T.clone().add(q+(U?-1:1),d);return+(-(q+(O-H)/(U?H-I:I-H))||0)},a:function(L){return L<0?Math.ceil(L)||0:Math.floor(L)},p:function(L){return{M:d,y:f,w:c,d:o,D:E,h:u,m:s,s:i,ms:r,Q:h}[L]||String(L||"").toLowerCase().replace(/s$/,"")},u:function(L){return L===void 0}},x="en",A={};A[x]=g;var k="$isDayjsObject",N=function(L){return L instanceof $||!(!L||!L[k])},S=function L(T,O,q){var H;if(!T)return x;if(typeof T=="string"){var U=T.toLowerCase();A[U]&&(H=U),O&&(A[U]=O,H=U);var I=T.split("-");if(!H&&I.length>1)return L(I[0])}else{var W=T.name;A[W]=T,H=W}return!q&&H&&(x=H),H||!q&&x},D=function(L,T){if(N(L))return L.clone();var O=typeof T=="object"?T:{};return O.date=L,O.args=arguments,new $(O)},P=C;P.l=S,P.i=N,P.w=function(L,T){return D(L,{locale:T.$L,utc:T.$u,x:T.$x,$offset:T.$offset})};var $=function(){function L(O){this.$L=S(O.locale,null,!0),this.parse(O),this.$x=this.$x||O.x||{},this[k]=!0}var T=L.prototype;return T.parse=function(O){this.$d=function(q){var H=q.date,U=q.utc;if(H===null)return new Date(NaN);if(P.u(H))return new Date;if(H instanceof Date)return new Date(H);if(typeof H=="string"&&!/Z$/i.test(H)){var I=H.match(m);if(I){var W=I[2]-1||0,G=(I[7]||"0").substring(0,3);return U?new Date(Date.UTC(I[1],W,I[3]||1,I[4]||0,I[5]||0,I[6]||0,G)):new Date(I[1],W,I[3]||1,I[4]||0,I[5]||0,I[6]||0,G)}}return new Date(H)}(O),this.init()},T.init=function(){var O=this.$d;this.$y=O.getFullYear(),this.$M=O.getMonth(),this.$D=O.getDate(),this.$W=O.getDay(),this.$H=O.getHours(),this.$m=O.getMinutes(),this.$s=O.getSeconds(),this.$ms=O.getMilliseconds()},T.$utils=function(){return P},T.isValid=function(){return this.$d.toString()!==v},T.isSame=function(O,q){var H=D(O);return this.startOf(q)<=H&&H<=this.endOf(q)},T.isAfter=function(O,q){return D(O)<this.startOf(q)},T.isBefore=function(O,q){return this.endOf(q)<D(O)},T.$g=function(O,q,H){return P.u(O)?this[q]:this.set(H,O)},T.unix=function(){return Math.floor(this.valueOf()/1e3)},T.valueOf=function(){return this.$d.getTime()},T.startOf=function(O,q){var H=this,U=!!P.u(q)||q,I=P.p(O),W=function(se,ce){var ve=P.w(H.$u?Date.UTC(H.$y,ce,se):new Date(H.$y,ce,se),H);return U?ve:ve.endOf(o)},G=function(se,ce){return P.w(H.toDate()[se].apply(H.toDate("s"),(U?[0,0,0,0]:[23,59,59,999]).slice(ce)),H)},_=this.$W,V=this.$M,Y=this.$D,X="set"+(this.$u?"UTC":"");switch(I){case f:return U?W(1,0):W(31,11);case d:return U?W(1,V):W(0,V+1);case c:var K=this.$locale().weekStart||0,te=(_<K?_+7:_)-K;return W(U?Y-te:Y+(6-te),V);case o:case E:return G(X+"Hours",0);case u:return G(X+"Minutes",1);case s:return G(X+"Seconds",2);case i:return G(X+"Milliseconds",3);default:return this.clone()}},T.endOf=function(O){return this.startOf(O,!1)},T.$set=function(O,q){var H,U=P.p(O),I="set"+(this.$u?"UTC":""),W=(H={},H[o]=I+"Date",H[E]=I+"Date",H[d]=I+"Month",H[f]=I+"FullYear",H[u]=I+"Hours",H[s]=I+"Minutes",H[i]=I+"Seconds",H[r]=I+"Milliseconds",H)[U],G=U===o?this.$D+(q-this.$W):q;if(U===d||U===f){var _=this.clone().set(E,1);_.$d[W](G),_.init(),this.$d=_.set(E,Math.min(this.$D,_.daysInMonth())).$d}else W&&this.$d[W](G);return this.init(),this},T.set=function(O,q){return this.clone().$set(O,q)},T.get=function(O){return this[P.p(O)]()},T.add=function(O,q){var H,U=this;O=Number(O);var I=P.p(q),W=function(V){var Y=D(U);return P.w(Y.date(Y.date()+Math.round(V*O)),U)};if(I===d)return this.set(d,this.$M+O);if(I===f)return this.set(f,this.$y+O);if(I===o)return W(1);if(I===c)return W(7);var G=(H={},H[s]=l,H[u]=n,H[i]=a,H)[I]||1,_=this.$d.getTime()+O*G;return P.w(_,this)},T.subtract=function(O,q){return this.add(-1*O,q)},T.format=function(O){var q=this,H=this.$locale();if(!this.isValid())return H.invalidDate||v;var U=O||"YYYY-MM-DDTHH:mm:ssZ",I=P.z(this),W=this.$H,G=this.$m,_=this.$M,V=H.weekdays,Y=H.months,X=H.meridiem,K=function(ce,ve,Be,_e){return ce&&(ce[ve]||ce(q,U))||Be[ve].slice(0,_e)},te=function(ce){return P.s(W%12||12,ce,"0")},se=X||function(ce,ve,Be){var _e=ce<12?"AM":"PM";return Be?_e.toLowerCase():_e};return U.replace(y,function(ce,ve){return ve||function(Be){switch(Be){case"YY":return String(q.$y).slice(-2);case"YYYY":return P.s(q.$y,4,"0");case"M":return _+1;case"MM":return P.s(_+1,2,"0");case"MMM":return K(H.monthsShort,_,Y,3);case"MMMM":return K(Y,_);case"D":return q.$D;case"DD":return P.s(q.$D,2,"0");case"d":return String(q.$W);case"dd":return K(H.weekdaysMin,q.$W,V,2);case"ddd":return K(H.weekdaysShort,q.$W,V,3);case"dddd":return V[q.$W];case"H":return String(W);case"HH":return P.s(W,2,"0");case"h":return te(1);case"hh":return te(2);case"a":return se(W,G,!0);case"A":return se(W,G,!1);case"m":return String(G);case"mm":return P.s(G,2,"0");case"s":return String(q.$s);case"ss":return P.s(q.$s,2,"0");case"SSS":return P.s(q.$ms,3,"0");case"Z":return I}return null}(ce)||I.replace(":","")})},T.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},T.diff=function(O,q,H){var U,I=this,W=P.p(q),G=D(O),_=(G.utcOffset()-this.utcOffset())*l,V=this-G,Y=function(){return P.m(I,G)};switch(W){case f:U=Y()/12;break;case d:U=Y();break;case h:U=Y()/3;break;case c:U=(V-_)/6048e5;break;case o:U=(V-_)/864e5;break;case u:U=V/n;break;case s:U=V/l;break;case i:U=V/a;break;default:U=V}return H?U:P.a(U)},T.daysInMonth=function(){return this.endOf(d).$D},T.$locale=function(){return A[this.$L]},T.locale=function(O,q){if(!O)return this.$L;var H=this.clone(),U=S(O,q,!0);return U&&(H.$L=U),H},T.clone=function(){return P.w(this.$d,this)},T.toDate=function(){return new Date(this.valueOf())},T.toJSON=function(){return this.isValid()?this.toISOString():null},T.toISOString=function(){return this.$d.toISOString()},T.toString=function(){return this.$d.toUTCString()},L}(),B=$.prototype;return D.prototype=B,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",o],["$M",d],["$y",f],["$D",E]].forEach(function(L){B[L[1]]=function(T){return this.$g(T,L[0],L[1])}}),D.extend=function(L,T){return L.$i||(L(T,$,D),L.$i=!0),D},D.locale=S,D.isDayjs=N,D.unix=function(L){return D(1e3*L)},D.en=A[x],D.Ls=A,D.p={},D})}(Fl)),Fl.exports}var Q1=mo();const Hl=bn(Q1);var $l={exports:{}},J1=$l.exports,vo;function Z1(){return vo||(vo=1,function(e,t){(function(a,l){e.exports=l(mo())})(J1,function(a){function l(i){return i&&typeof i=="object"&&"default"in i?i:{default:i}}var n=l(a),r={name:"zh-cn",weekdays:"星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),weekdaysShort:"周日_周一_周二_周三_周四_周五_周六".split("_"),weekdaysMin:"日_一_二_三_四_五_六".split("_"),months:"一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),monthsShort:"1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),ordinal:function(i,s){return s==="W"?i+"周":i+"日"},weekStart:1,yearStart:4,formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY/MM/DD",LL:"YYYY年M月D日",LLL:"YYYY年M月D日Ah点mm分",LLLL:"YYYY年M月D日ddddAh点mm分",l:"YYYY/M/D",ll:"YYYY年M月D日",lll:"YYYY年M月D日 HH:mm",llll:"YYYY年M月D日dddd HH:mm"},relativeTime:{future:"%s内",past:"%s前",s:"几秒",m:"1 分钟",mm:"%d 分钟",h:"1 小时",hh:"%d 小时",d:"1 天",dd:"%d 天",M:"1 个月",MM:"%d 个月",y:"1 年",yy:"%d 年"},meridiem:function(i,s){var u=100*i+s;return u<600?"凌晨":u<900?"早上":u<1100?"上午":u<1300?"中午":u<1800?"下午":"晚上"}};return n.default.locale(r,null,!0),r})}($l)),$l.exports}Z1();function ja(e){"@babel/helpers - typeof";return ja=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ja(e)}function ey(e,t){if(ja(e)!="object"||!e)return e;var a=e[Symbol.toPrimitive];if(a!==void 0){var l=a.call(e,t);if(ja(l)!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ty(e){var t=ey(e,"string");return ja(t)=="symbol"?t:t+""}function ay(e,t,a){return(t=ty(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function go(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);t&&(l=l.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),a.push.apply(a,l)}return a}function Eo(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?go(Object(a),!0).forEach(function(l){ay(e,l,a[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):go(Object(a)).forEach(function(l){Object.defineProperty(e,l,Object.getOwnPropertyDescriptor(a,l))})}return e}var ly={yearFormat:"YYYY",dayFormat:"D",cellMeridiemFormat:"A",monthBeforeYear:!0},ny=Eo(Eo({},ly),{},{locale:"zh_CN",today:"今天",now:"此刻",backToToday:"返回今天",ok:"确定",timeSelect:"选择时间",dateSelect:"选择日期",weekSelect:"选择周",clear:"清除",week:"周",month:"月",year:"年",previousMonth:"上个月 (翻页上键)",nextMonth:"下个月 (翻页下键)",monthSelect:"选择月份",yearSelect:"选择年份",decadeSelect:"选择年代",previousYear:"上一年 (Control键加左方向键)",nextYear:"下一年 (Control键加右方向键)",previousDecade:"上一年代",nextDecade:"下一年代",previousCentury:"上一世纪",nextCentury:"下一世纪",yearFormat:"YYYY年",cellDateFormat:"D",monthBeforeYear:!1});const ry={placeholder:"请选择时间",rangePlaceholder:["开始时间","结束时间"]},yo={lang:Object.assign({placeholder:"请选择日期",yearPlaceholder:"请选择年份",quarterPlaceholder:"请选择季度",monthPlaceholder:"请选择月份",weekPlaceholder:"请选择周",rangePlaceholder:["开始日期","结束日期"],rangeYearPlaceholder:["开始年份","结束年份"],rangeMonthPlaceholder:["开始月份","结束月份"],rangeQuarterPlaceholder:["开始季度","结束季度"],rangeWeekPlaceholder:["开始周","结束周"]},ny),timePickerLocale:Object.assign({},ry)};yo.lang.ok="确定",Hl.locale("zh-cn");const{RangePicker:iy}=ge.DatePicker,sy=({host:e,onChange:t})=>{const a=e.dataset.key,l=e.dataset.value,n=e.dataset.placeholder,r=e.dataset.limitRange?parseInt(e.dataset.limitRange,10):void 0,i=e.dataset.disableFuture==="true",[s,u]=w.useState(()=>{if(!l)return null;const v=l.split(",");return v.length===2&&v[0]&&v[1]?[Hl(v[0]),Hl(v[1])]:null}),[o,c]=w.useState(null),d=v=>v?i&&v.isAfter(Hl(),"day")?!0:!r||!o||!o[0]?!1:Math.abs(v.diff(o[0],"days"))>r:!1,h=v=>{c(v)},f=v=>{if(u(v),c(null),v&&v[0]&&v[1]){const m=`${v[0].format("YYYY-MM-DD")},${v[1].format("YYYY-MM-DD")}`;e.setAttribute("data-value",m),t(a,m)}else e.setAttribute("data-value",""),t(a,"")},E=v=>{c(v?s:null)};return ft.createPortal(R.jsx("div",{className:"rte-datepicker-wrapper",contentEditable:!1,style:{display:"inline-block",verticalAlign:"middle",width:"260px",marginLeft:"4px",marginRight:"4px",fontSize:"16px",height:"30px",lineHeight:"30px"},children:R.jsx(iy,{value:s,disabledDate:d,onCalendarChange:h,onChange:f,onOpenChange:E,placeholder:[n||"开始日期",n||"结束日期"],style:{width:"100%"},size:"small",allowClear:!0,locale:yo,getPopupContainer:()=>document.body,popupClassName:"rte-datepicker-dropdown"})}),e)},uy=e=>{const[t,a]=w.useState([]);return w.useEffect(()=>{const l=e.current;if(!l)return;const n=()=>{const i=l.querySelectorAll(".rte-datepicker-host"),s=[];i.forEach(u=>{const o=u.getAttribute("data-key");o&&s.push(R.jsx(sy,{host:u,onChange:()=>{if(e.current){const c=new Event("input",{bubbles:!0});e.current.dispatchEvent(c)}}},`datepicker-${o}`))}),a(s)};n();const r=new MutationObserver(i=>{let s=!1;for(const u of i)if(u.type==="childList"){let o=!1;if(u.addedNodes.forEach(c=>{if(c.nodeType===Node.ELEMENT_NODE){const d=c;(d.classList?.contains("rte-datepicker-host")||d.querySelector?.(".rte-datepicker-host"))&&(o=!0)}}),u.removedNodes.forEach(c=>{if(c.nodeType===Node.ELEMENT_NODE){const d=c;(d.classList?.contains("rte-datepicker-host")||d.querySelector?.(".rte-datepicker-host"))&&(o=!0)}}),o){s=!0;break}}s&&n()});return r.observe(l,{childList:!0,subtree:!0}),()=>r.disconnect()},[e]),t},To=e=>e==null?String(e):e instanceof File?`[File:${e.name}/${e.size}]`:Array.isArray(e)?`[Array(${e.length}) ${e.map(To).join(", ")}]`:typeof e=="string"?`[url:${e}]`:String(e),Wt=(e,t)=>{if(!e)return{};const a={};return Object.keys(e).filter(l=>!t||t.length===0?!0:t.some(n=>l===n||l.startsWith(`${n}-`))).sort().forEach(l=>{a[l]=To(e[l])}),a},xo=({config:e,onSend:t,isProcessing:a=!1,disabled:l=!1,width:n,lockStructure:r=!1,agentOptions:i=[],onAgentSelect:s,onAgentExit:u,loading:o=!1,placeholder:c,border:d,background:h="transparent",hideButtons:f,maxHeight:E,minHeight:v,editorMinHeight:m,editorPadding:y,footerPadding:g,collapsed:b=!1,reportAnalyze:C,markdownAnalyze:x,markdownNameAnalyze:A,onCollapsedChange:k,collapseTransitionMs:N=260,debugTooltipSticky:S=!1,nodeValues:D,onFilesChange:P,onFooterFilesChange:$,showFooterUpload:B=!0,footerFiles:L,videoUrlParse:T,videoUpload:O,reportListFetch:q,onReportGoGenerate:H,onViewReport:U,hideCurrentSessionReport:I,reportNameResolve:W})=>{const[G,_]=ge.message.useMessage(),V=w.useRef(null),Y=w.useRef(null),X=w.useRef(null),K=w.useRef(null),te=w.useRef(null),se=w.useRef(null),[ce,ve]=w.useState(!1),Be=w.useRef("");if(!Be.current){const J=Math.random().toString(36).slice(2,8);Be.current=`rte_${J}`}const[_e,At]=w.useState({});w.useEffect(()=>{console.log("[RTE-upload-debug][files-effect:onFilesChange]",{snapshot:Wt(_e)}),P?.(_e)},[_e,P]);const[We,ut]=w.useState([]),Ft=w.useRef(!1);w.useEffect(()=>{if(!L)return;if(!(L.length===We.length&&L.every((ue,ne)=>{const pe=We[ne];return pe&&ue.name===pe.name&&ue.size===pe.size&&ue.lastModified===pe.lastModified})))if(L.reduce((pe,be)=>pe+be.size,0)>52428800){const pe=[];let be=0;for(const ie of L){if(be+ie.size>52428800)break;pe.push(ie),be+=ie.size}G.error("文件总大小不能超过 50MB"),ut(pe)}else Ft.current=!0,ut(L)},[L]),w.useEffect(()=>{if(Ft.current){Ft.current=!1;return}$?.(We)},[We,$]);const[Rl,Ne]=w.useState(null),[et,Ul]=w.useState(null),[Sr,ql]=w.useState(null),[ot,Qa]=w.useState({}),[Z,re]=w.useState(""),[me,ye]=w.useState(!1),ke=w.useRef(null),Xe=w.useRef(null),{tooltipPortal:wt,setPopoverVisible:je}=n1({config:e,files:_e,debugTooltipSticky:S,videoState:ot}),{handleFileChange:jt,handleRemoveFile:Kt}=Lc({config:e,messageApi:G,activeBatchKey:et,activeFileKey:Rl,activeBatchStartIndex:Sr,setActiveFileKey:Ne,setActiveBatchKey:Ul,setActiveBatchStartIndex:ql,setFiles:At}),ze=w.useRef(null),[_t,ct]=w.useState({showLeft:!1,showRight:!1}),Ja=w.useCallback(()=>{const J=ze.current;J&&ct({showLeft:J.scrollLeft>0,showRight:J.scrollLeft+J.clientWidth<J.scrollWidth-1})},[]),xy=w.useCallback(J=>{if(!J.target.files||J.target.files.length===0)return;const ue=10*1024*1024,ne=50*1024*1024,pe=ie=>ie.type?.startsWith("image/")||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(ie.name||""),be=Array.from(J.target.files).filter(ie=>pe(ie)&&ie.size>ue?(G.error("图片大小不能超过 10MB"),!1):!0);ut(ie=>{const Oe=ie.reduce((de,xe)=>de+xe.size,0),De=[];let he=Oe;for(const de of be){if(he+de.size>ne){G.error("文件总大小不能超过 50MB");break}De.push(de),he+=de.size}return De.length>0?[...ie,...De]:ie}),J.target.value="",setTimeout(Ja,0)},[G,Ja]),Cy=w.useCallback(J=>{ut(ue=>ue.filter((ne,pe)=>pe!==J)),setTimeout(Ja,0)},[Ja]),Sy=w.useCallback(()=>{const J=ze.current;J&&J.scrollBy({left:200,behavior:"smooth"})},[]),Ay=w.useCallback(()=>{const J=ze.current;J&&J.scrollBy({left:-200,behavior:"smooth"})},[]),Lo=w.useCallback(()=>{l||ve(!0)},[l]);w.useEffect(()=>{l&&ve(!1)},[l]),w.useEffect(()=>{const J=pe=>pe instanceof Element?!!pe.closest([".rte-agent-dropdown",".rte-report-dropdown-overlay",".rte-tooltip-overlay",".ant-picker-dropdown",".ant-select-dropdown",".ant-image-preview-root"].join(",")):!1,ue=pe=>{const be=V.current,ie=pe.target;be&&(ie instanceof Node&&be.contains(ie)||J(ie)||ve(!1))},ne=pe=>{const be=V.current,ie=pe.target;if(be){if(ie instanceof Node&&be.contains(ie)){l||ve(!0);return}J(ie)||ve(!1)}};return document.addEventListener("mousedown",ue,!0),document.addEventListener("focusin",ne,!0),()=>{document.removeEventListener("mousedown",ue,!0),document.removeEventListener("focusin",ne,!0)}},[l]);const Ar=w.useRef(!1),wy=w.useRef(null),{handleMouseDown:_y,handleMouseMove:ky,handleMouseUp:Ny,handleDoubleClick:Iy}=jc({lockStructure:r,onAgentExit:u,editorRef:K,setPopoverVisible:je,isDraggingRef:Ar,mouseDownPosRef:wy}),[Oo,zl]=w.useState(!1),wr=w.useRef(null),[Do,Po]=w.useState(!0),Ly=w.useRef(0),[Mo,Oy]=w.useState(58),[Dy,Py]=w.useState(58),[_r,My]=w.useState(!1),[By,Fy]=w.useState(!1),[Za,kr]=w.useState(null),el=w.useRef(!1),tl=w.useRef(!1),Et=w.useRef(null),[va,al]=w.useState({}),Ht=w.useRef(()=>{}),Xt=w.useRef({}),Nr=w.useRef(!1),Vl=w.useRef(null),ll=w.useCallback(()=>{Nr.current=!0,Vl.current!==null&&window.clearTimeout(Vl.current),Vl.current=window.setTimeout(()=>{Nr.current=!1,Vl.current=null},50)},[]),[Qt,Gl]=w.useState({}),Bo=w.useRef(()=>{}),Hy=w.useRef({}),Ir=w.useRef(Qt);w.useEffect(()=>{Ir.current=Qt},[Qt]);const[Jt,Lr]=w.useState({}),Fo=w.useRef(()=>{}),Ho=w.useRef(Jt);w.useEffect(()=>{Ho.current=Jt},[Jt]);const[yt,nl]=w.useState(()=>{const J={};return e.forEach(ue=>{Ve(ue.type)&&ue.key&&(J[ue.key]=1)}),J});Hc({config:e,editorRef:K,files:_e,setFiles:At,multiVariableCounts:yt,setMultiVariableCounts:nl,reportAnalyzeState:va,setReportAnalyzeState:al,markdownAnalyzeState:Qt,setMarkdownAnalyzeState:Gl,markdownNameAnalyzeState:Jt,setMarkdownNameAnalyzeState:Lr,nodeValues:D,resolvedReportNamesRef:Xt});const $o=w.useRef(D);if(D!==$o.current&&($o.current=D,D)){const J={};let ue=!1;e.forEach(ne=>{if(Ve(ne.type)&&ne.key){const pe=D[ne.key],be=Array.isArray(pe)?pe.filter(ie=>String(ie??"").trim().length>0):pe;if(Array.isArray(be)&&be.length>0){const ie=ne.maxCount??9,Oe=Math.min(be.length+1,ie);yt[ne.key]!==Oe&&(J[ne.key]=Oe,ue=!0)}}}),ue&&(ll(),nl(ne=>({...ne,...J})))}const Le=zc({config:e,reportAnalyzeState:va,markdownAnalyzeState:Qt,markdownNameAnalyzeState:Jt}),Yl=w.useRef(()=>{}),{handleReportUrlBlur:$y,handleMarkdownBlur:Ry,handleMarkdownNameBlur:Uy,handleMultiVariableNameResolve:Ro}=Rc({reportAnalyze:C,markdownAnalyze:x,markdownNameAnalyze:A,reportAnalyzeState:va,setReportAnalyzeState:al,markdownAnalyzeState:Qt,setMarkdownAnalyzeState:Gl,markdownNameAnalyzeState:Jt,setMarkdownNameAnalyzeState:Lr,editorRef:K,reportAnalyzeRef:Ht,markdownAnalyzeRef:Bo,markdownNameAnalyzeRef:Fo,markdownAnalyzeStateRef:Ir,markdownNameAnalyzeStateRef:Ho,reportNameResolve:W,applyReportNameChipRef:Yl});mc(K,$y,[Le]),Sc(K,Uy,[Le]),Ac(K,Ry,[Le]),w.useEffect(()=>{const J=K.current;if(!J||!W)return;const ue=ne=>{const pe=ne.target;if(!pe)return;const be=pe.closest?.('[data-type="variable"][data-multi-key]');if(!be)return;const ie=be.dataset.key;if(!ie)return;const Oe=wr.current?.key===ie;if(Nr.current&&(Oe||!J.contains(be)))return;const De=J.contains(be)?be:J.querySelector(`[data-type="variable"][data-key="${ie}"]`);if(!De||De.getAttribute("data-report-url"))return;const he=(De.innerText||"").replace(/[\u200B\n]/g,"").trim(),de=De.dataset.multiKey,Me=(de?Le.find(Ae=>Ve(Ae.type)&&Ae.key===de):void 0)?.type==="multi-variable-select"?"multi-variable-select":"multi-variable";Ro(ie,he,Me)};return J.addEventListener("focusout",ue),()=>J.removeEventListener("focusout",ue)},[K,Ro,Le,W]),bc(K,[Le]),Yl.current=(J,ue,ne,pe)=>{const be=K.current;if(!be)return;let ie=be.querySelector(`[data-type="variable"][data-key="${J}"]`);if(ie&&!document.body.contains(ie)){const he=document.querySelectorAll(`.rte-editor [data-type="variable"][data-key="${J}"]`);let de=null;he.forEach(xe=>{!de&&document.body.contains(xe)&&(de=xe)}),ie=de}if(!ie){Xt.current[J]={name:ue,url:ne};return}if(ie.getAttribute("data-report-url")===ne){Xt.current[J]={name:ue,url:ne};return}if(!pe?.forceApply){const he=ie.getAttribute("data-report-url"),de=(ie.innerText||"").replace(/[\u200B\n]/g,"").trim();if(!(!he&&de==="")&&!(he===ne||de===ne))return}Xt.current[J]={name:ue,url:ne};const Oe=ie.querySelector(".rte-report-dropdown-host");Oe&&(Oe.style.display="",Oe.style.visibility="",Oe.classList.remove("hidden"),Oe.classList.add("rte-report-dropdown-host-quiet"));const De=[document.createTextNode(ue)];Oe&&De.push(Oe),ie.classList.remove("show-placeholder","rte-variable-with-icon"),ie.classList.add("rte-report-name-chip"),ie.setAttribute("data-report-url",ne),ie.setAttribute("data-report-name",ue),ie.contentEditable="false",ie.replaceChildren(...De),jl(ie),document.dispatchEvent(new CustomEvent("rte-report-dropdown-force-close",{detail:{key:J}})),setTimeout(()=>{Pr.current()},0)};const qy=w.useCallback((J,ue,ne)=>{K.current&&(ue==="report-url"?(Yl.current(J,ne.name,ne.url,{forceApply:!0}),setTimeout(()=>{Ht.current(J,ne.url)},0)):(ue==="multi-variable"||ue==="multi-variable-select")&&(Yl.current(J,ne.name,ne.url,{forceApply:!0}),ue==="multi-variable-select"&&setTimeout(()=>{Ht.current(J,ne.url)},0)))},[K,Ht]),zy=Le.map(J=>`${J.type}:${J.key??""}:${J.placeholder??""}`).join("|"),Vy=yc(K,q,qy,H,U,`${zy}::${JSON.stringify(yt)}`,I);z1(K,Le,_e,r,yt,wr,void 0,f,void 0,D,ot,!!q,Xt);const Or=w.useRef(new Set),Uo=w.useRef(Le),qo=w.useRef(D);(Uo.current!==Le||qo.current!==D)&&(Uo.current=Le,qo.current=D,Or.current=new Set),w.useEffect(()=>{if(!D||!Le||Le.length===0)return;const J=Le.filter(he=>he.type==="upload"&&he.key);if(J.length===0)return;const ue=J.map(he=>he.key);console.log("[RTE-upload-debug][nodeValues:start]",{uploadKeys:ue,nodeValues:Wt(D,ue)});const ne={},pe=new Set,be=(he,de)=>{if(de)if(de instanceof File){if(Ea(de)){pe.add(he);return}ne[he]=de}else typeof de=="string"&&de.trim()&&(ne[he]=de.trim())};for(const he of J){const de=he.key;if(Or.current.has(de))continue;const xe=D[de],Me=typeof he.maxCount=="number"&&he.maxCount>1;if(Array.isArray(xe)&&xe.length>0){Me?xe.forEach((Ae,Re)=>be(`${de}-${Re}`,Ae)):be(de,xe[0]);continue}if(xe&&!Array.isArray(xe)){be(de,xe);continue}if(Me)for(let Ae=0;Ae<he.maxCount;Ae++){const Re=`${de}-${Ae}`,dt=D[Re];dt&&be(Re,dt)}}console.log("[RTE-upload-debug][nodeValues:collected-before-compact]",{valuesToSet:Wt(ne),rejectedOversizedKeys:Array.from(pe).sort()});for(const he of J){const de=he.key;if(!(typeof he.maxCount=="number"&&he.maxCount>1))continue;const Me=[];for(let Ae=0;Ae<he.maxCount;Ae++){const Re=`${de}-${Ae}`,dt=ne[Re];dt!=null&&Me.push(dt),delete ne[Re]}Me.forEach((Ae,Re)=>{ne[`${de}-${Re}`]=Ae})}if(console.log("[RTE-upload-debug][nodeValues:after-compact]",{valuesToSet:Wt(ne),rejectedOversizedKeys:Array.from(pe).sort()}),Object.keys(ne).length===0&&pe.size===0)return;for(const he of J){const de=he.key,xe=Object.prototype.hasOwnProperty.call(ne,de)||Object.keys(ne).some(Ae=>Ae.startsWith(`${de}-`)),Me=pe.has(de)||Array.from(pe).some(Ae=>Ae.startsWith(`${de}-`));(D[de]!==void 0||xe||Me)&&Or.current.add(de)}At(he=>{const de={...he};let xe=!1;for(const Me of J){const Ae=Me.key;if(D[Ae]===void 0)continue;if(typeof Me.maxCount=="number"&&Me.maxCount>1)for(let dt=0;dt<Me.maxCount;dt++){const ea=`${Ae}-${dt}`;if(!Object.prototype.hasOwnProperty.call(ne,ea))if(pe.has(ea)){he[ea]===void 0&&(de[ea]=null,xe=!0);continue}else!ne[ea]&&he[ea]&&(de[ea]=null,xe=!0)}else pe.has(Ae)&&he[Ae]!==null&&(de[Ae]=null,xe=!0)}for(const[Me,Ae]of Object.entries(ne))he[Me]!==Ae&&(de[Me]=Ae,xe=!0);return console.log("[RTE-upload-debug][nodeValues:setFiles]",{changed:xe,before:Wt(he,ue),valuesToSet:Wt(ne),rejectedOversizedKeys:Array.from(pe).sort(),after:Wt(de,ue)}),xe?de:he});const ie=Object.entries(ne).filter(([,he])=>typeof he=="string");if(ie.length===0)return;const Oe=async he=>{const de=he.split("/").pop()?.split("?")[0]||"file",xe=decodeURIComponent(de),Me=async Ae=>{const Re=await Ae.blob();return new File([Re],xe,{type:Re.type||"application/octet-stream"})};try{const Ae=`/api/image-proxy?url=${encodeURIComponent(he)}`,Re=await fetch(Ae);if(Re.ok)return Me(Re)}catch{}return null};let De=!1;return Promise.all(ie.map(async([he,de])=>{const xe=await Oe(de);return xe&&Ea(xe)?null:xe?{key:he,file:xe}:null})).then(he=>{if(De)return;const de={};for(const xe of he)xe&&(de[xe.key]=xe.file);Object.keys(de).length>0&&At(xe=>{const Me={...xe};let Ae=!1;for(const[Re,dt]of Object.entries(de))typeof Me[Re]=="string"&&(Me[Re]=dt,Ae=!0);return Ae?Me:xe})}),()=>{De=!0}},[D,Le]);const rl=w.useRef(new Map),zo=w.useRef(""),Vo=((e||[]).find(J=>J.type==="tag")?.text||"")+"||"+(e||[]).filter(J=>J.key&&J.type!=="report-module"&&J.type!=="markdown-module").map(J=>`${J.type}:${J.key}`).join("|");zo.current!==Vo&&(zo.current=Vo,rl.current=new Map),w.useEffect(()=>{if(!D||!e||e.length===0)return;const J=e.filter(ne=>ne.type==="report-url"&&ne.key),ue=e.filter(ne=>ne.type==="multi-variable-select"&&ne.key);if(!(J.length===0&&ue.length===0)){for(const ne of J){const pe=ne.key,be=D[pe]??D[`${pe}__url`];if(!be||typeof be=="string"&&!be.trim())continue;const ie=Array.isArray(be)?String(be[0]??""):String(be);ie&&rl.current.get(pe)!==ie&&(rl.current.set(pe,ie),setTimeout(()=>{Ht.current(pe,ie)},100))}for(const ne of ue){const pe=ne.key,be=D[pe];!Array.isArray(be)||be.length===0||be.forEach((ie,Oe)=>{const De=typeof ie=="string"?ie.trim():"";if(!De)return;const he=`${pe}_${Oe}`;rl.current.get(he)!==De&&(rl.current.set(he,De),setTimeout(()=>{Ht.current(he,De)},100))})}}},[D,e,Ht]),hc(K),V1(K,Le,_e,je,S),G1(K,Le,je,f,S),W1(K,Le,_e,je,S),Y1(K,Le,je,S);const Dr=!!C;j1(K,Le,_e,zl,ot,D,va,Dr),Mc(K,T,ot,Qa,[Le]);const Gy=Bc(O,Qa,K);Fc(K,ot,je,S),K1(K,Ar);const Go=ac(K),Yy=nc(K),Wy=ic(K),Yo=dc(K);w.useEffect(()=>{if(!K.current)return;K.current.querySelectorAll(".rte-richtext-toggle").forEach(ue=>{const ne=ue.getAttribute("data-expanded")==="true";ue.innerHTML=ne?'<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>'})},[Le,K]);const Wo=uy(K),{measureExpandedContentHeight:il}=Uc({collapsed:b,collapseTransitionMs:N,contentRef:Y,contentBodyRef:X,editorRef:K,debugIdRef:Be,setCollapsedContentMaxHeightPx:Oy,setExpandedContentMaxHeightPx:Py,setIsCollapseAnimating:My,effectiveConfig:Le,files:_e,multiVariableCounts:yt,selectPortalsLength:Go.length,datePickerPortalsLength:Wo.length,variablePortalsLength:Yo.length}),jy=()=>{if(b)return;const J=X.current;if(!J)return;const ue=Math.ceil(J.getBoundingClientRect().height||0);ue>0&&kr(ue),el.current=!0,tl.current=!1,Et.current&&(window.clearTimeout(Et.current),Et.current=null)};w.useEffect(()=>{const J=()=>{el.current&&(tl.current=!0,Et.current&&window.clearTimeout(Et.current),Et.current=window.setTimeout(()=>{Et.current=null,el.current=!1,tl.current=!1,kr(null),window.requestAnimationFrame(()=>il())},450))};return window.addEventListener("focus",J),()=>window.removeEventListener("focus",J)},[il]),w.useEffect(()=>{!el.current||!tl.current||(Et.current&&(window.clearTimeout(Et.current),Et.current=null),window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{kr(null),il(),el.current=!1,tl.current=!1})}))},[_e,il]),qc({config:e,editorRef:K,setIsEmpty:Po,setIsFormValid:zl});const Ky=Gc({disabled:l,collapsed:b,onCollapsedChange:k,config:e,lockStructure:r,editorRef:K,containerRef:V,fileInputRef:te,onBeforeFilePickerOpen:jy,files:_e,setFiles:At,handleRemoveFile:Kt,setActiveBatchKey:Ul,setActiveBatchStartIndex:ql,setActiveFileKey:Ne,isDraggingRef:Ar,richtextPrevScrollTopRef:Ly,videoState:ot,setVideoState:Qa,videoFileInputRef:ke,activeVideoKeyRef:Xe,onImagePreview:J=>{re(J),ye(!0)}}),sl=Yc({config:e,editorRef:K,setIsEmpty:Po,setIsFormValid:zl,setReportAnalyzeState:al,setMarkdownAnalyzeState:Gl,setMarkdownNameAnalyzeState:Lr,collapsed:b,measureExpandedContentHeight:il,effectiveConfig:Le,files:_e,multiVariableCounts:yt,setMultiVariableCounts:nl,savedCursorRef:wr,videoState:ot,resolvedReportNamesRef:Xt,reportAnalyzeState:va,requireReportUrlAnalyze:Dr}),Pr=w.useRef(sl);Pr.current=sl;const Xy=Kc({disabled:l,config:e,multiVariableCounts:yt,setMultiVariableCounts:nl,editorRef:K,handleInput:sl,markdownAnalyzeRef:Bo,reportAnalyzeRef:Ht,markdownNameAnalyzeRef:Fo,markdownAnalyzeStateRef:Ir,markdownRawTextRef:Hy,setMarkdownAnalyzeState:Gl,setFooterFiles:ut,footerFiles:We,messageApi:G,onPasteUnsupported:()=>G.warning("暂不支持上传该文件类型")});Vc({config:e,effectiveConfig:Le,files:_e,editorRef:K,setIsFormValid:zl,multiVariableCounts:yt,setMultiVariableCounts:nl,videoState:ot,reportAnalyzeState:va,requireReportUrlAnalyze:Dr});const Mr=w.useCallback((J,ue)=>{delete Xt.current[J],ga({keys:[J]}),ue==="report-url"&&al(ne=>({...ne,[J]:{status:"idle",modules:[],lastParsedUrl:void 0,error:void 0}}))},[al]),Qy=w.useCallback(J=>{ll();const{nodeKey:ue,nodeType:ne}=Cc(J);Mr(ue,ne),J.focus(),Pr.current()},[Mr,ll]),Jy=xc(K,Qy,yt),jo=Xc({config:e,files:_e,footerFiles:We,onFooterFilesClear:()=>ut([]),onSend:t,isProcessing:a,disabled:l,loading:o,isFormValid:Oo,editorRef:K,markdownAnalyzeState:Qt,markdownNameAnalyzeState:Jt,videoState:ot}),Zy=Wc({disabled:l,lockStructure:r,config:e,editorRef:K,handleInput:sl,onEnterSend:jo,onReportChipDeleted:Mr}),eT={...n?{width:typeof n=="number"?`${n}px`:n}:{},...d?{border:d}:{},...h?{background:h}:{},...E?{maxHeight:typeof E=="number"?`${E}px`:E}:{},...v&&!b?{minHeight:typeof v=="number"?`${v}px`:v}:{},...We.length>0?{minHeight:"220px"}:{},...E?{"--rte-richtext-fullscreen-height":typeof E=="number"?`${E}px`:E}:{},...m?{"--rte-editor-min-height":typeof m=="number"?`${m}px`:m}:{},...y?{"--rte-editor-padding":y}:{},...g?{"--rte-footer-padding":g}:{}},tT=typeof N=="number"&&Number.isFinite(N)&&N>=0?N:260,aT={overflow:"hidden"},Ko=Za!=null?`${Za}px`:b?`${Mo}px`:`${Math.max(Dy,Mo)}px`,lT=e.length===0&&Do&&!b,nT=Za!=null||b||_r||lT?"hidden":By?"auto":"hidden",Xo=w.useRef(b),Qo=Xo.current!==b;Qo&&(Xo.current=b);const rT=Za!=null?"none":Qo||_r?`max-height ${tT}ms cubic-bezier(0.4, 0, 0.2, 1)`:"none";w.useLayoutEffect(()=>{const J=X.current;if(!J)return;const ue=J.scrollHeight>J.clientHeight+1;Fy(ne=>ne===ue?ne:ue)},[Ko,b,_r,Za,Le,_e,yt,We.length]);const iT={maxHeight:Ko,minHeight:b?0:void 0,overflow:nT,overscrollBehavior:ce?"contain":"auto",transition:rT,willChange:"max-height"},Jo=e.find(J=>J.type==="tag"),Zt=Jo?.text?i.find(J=>J.label===Jo.text):void 0;return R.jsxs("div",{className:`rich-text-editor ${ce?"rte-editor-selected":""}`,style:eT,"data-disabled":l,ref:V,onMouseDownCapture:Lo,onFocusCapture:Lo,children:[_,R.jsxs("div",{className:"rich-text-editor-content",ref:Y,style:aT,onMouseDown:J=>{if(e.length!==0)return;const ue=J.target,ne=K.current;if(!ne||ne.contains(ue)||ue.closest('button, input, a, svg, [role="button"], .rte-footer-files-wrapper'))return;if(J.preventDefault(),ne.childNodes.length===0){ne.appendChild(document.createElement("br")),ne.focus();const Oe=document.createRange();Oe.setStart(ne,0),Oe.collapse(!0);const De=window.getSelection();De?.removeAllRanges(),De?.addRange(Oe);return}const be=window.getSelection(),ie=!!be&&be.rangeCount>0&&ne.contains(be.anchorNode);if(ne.focus(),!ie){const Oe=document.createRange();Oe.selectNodeContents(ne),Oe.collapse(!1);const De=window.getSelection();De?.removeAllRanges(),De?.addRange(Oe)}},children:[We.length>0&&R.jsxs("div",{className:"rte-footer-files-wrapper",children:[_t.showLeft&&R.jsx("div",{className:"rte-footer-files-mask rte-footer-files-mask-left",children:R.jsx("span",{className:"rte-footer-files-arrow rte-footer-files-arrow-left",onClick:Ay,children:R.jsx("svg",{style:{width:"16px",height:"16px",transform:"rotate(180deg)"},"aria-hidden":"true",children:R.jsx("use",{xlinkHref:"#icon-fanhuijiantou"})})})}),R.jsx("div",{className:"rte-footer-files-list",ref:ze,onScroll:Ja,children:We.map((J,ue)=>{const ne=J.type?.startsWith("image/")||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(J.name||""),pe=J.size<1024?`${J.size}B`:J.size<1024*1024?`${Math.round(J.size/1024)}KB`:`${(J.size/(1024*1024)).toFixed(1)}MB`,be=ne?URL.createObjectURL(J):"";return R.jsxs("div",{className:"rte-footer-file-chip",style:ne?{cursor:"pointer"}:void 0,onClick:ne?()=>{re(be),ye(!0)}:void 0,children:[ne?R.jsx("img",{style:{width:"32px",height:"32px",objectFit:"contain",background:"#ffffff",border:"0.5px solid #EDF0F2",boxShadow:"0 2px 6px 1px rgba(174, 176, 180, 0.08)",boxSizing:"border-box"},className:"rte-footer-file-thumb",src:be,alt:J.name}):R.jsx("div",{className:"rte-footer-file-icon",children:R.jsx("svg",{style:{width:"18px",height:"18px"},"aria-hidden":"true",children:R.jsx("use",{xlinkHref:`#${(()=>{const ie=(J.name||"").split(".").pop()?.toLowerCase()||"";return["xls","xla","xlb","xlc","xlm","xlsx","xlt","xlw","csv","tsv","iif"].includes(ie)?"icon-a-xlsxcsv":["doc","docx","dot","odt","rtf","wiz"].includes(ie)?"icon-docx":["ppt","pptx","pot","ppa","pps","pwz"].includes(ie)?"icon-ppt":["txt","asm","bat","c","cc","conf","cpp","css","cxx","def","dic","eml","h","hh","in","js","ksh","php","pkl","rb","tar","tex","ts","xml"].includes(ie)?"icon-txt":ie==="pdf"?"icon-pdf":["html","htm","json","ics","ifb"].includes(ie)?"icon-a-htmljson":ie==="md"?"icon-md":"icon-lianjie"})()}`})})}),R.jsxs("div",{className:"rte-footer-file-info",children:[R.jsx("span",{className:"rte-footer-file-name",title:J.name,children:J.name}),R.jsx("span",{className:"rte-footer-file-size",children:pe})]}),R.jsx("span",{className:"rte-footer-file-remove",onClick:ie=>{ie.stopPropagation(),Cy(ue)},children:R.jsx("i",{className:"iconfont icon-guanbi ",style:{width:"8px",height:"8px",fontSize:"8px",display:"flex",alignItems:"center"}})})]},`${J.name}-${J.size}-${ue}`)})}),_t.showRight&&R.jsx("div",{className:"rte-footer-files-mask rte-footer-files-mask-right",children:R.jsx("span",{className:"rte-footer-files-arrow rte-footer-files-arrow-right",onClick:Sy,children:R.jsx("svg",{style:{width:"16px",height:"16px"},"aria-hidden":"true",children:R.jsx("use",{xlinkHref:"#icon-fanhuijiantou"})})})})]}),R.jsxs("div",{ref:X,className:`rich-text-editor-content-body ${e.length===0?"rich-text-editor-content-body-default":""}`,style:iT,children:[R.jsx("div",{ref:K,className:`rte-editor ${e.length===0?"rte-editor-default":""} ${Do&&c?"rte-editor-empty":""} ${e.some(J=>J.type==="tag")?"rte-editor-with-agent":""}`,contentEditable:e.length===0,suppressContentEditableWarning:!0,"data-placeholder":c,onMouseDown:_y,onMouseMove:ky,onMouseUp:Ny,onClick:Ky,onDoubleClick:Iy,onInput:()=>{ll(),sl()},onKeyDown:Zy,onPaste:J=>{ll(),Xy(J)}}),R.jsx("input",{type:"file",ref:te,className:"rte-file-input",accept:".csv,.xlsx,.xls,.txt,.pdf,image/*",onChange:jt}),R.jsx("input",{type:"file",ref:ke,className:"rte-file-input",accept:"video/*",onChange:J=>{const ue=J.target.files?.[0],ne=Xe.current;ue&&ue.size>1024*1024*1024?G.warning("视频文件不能超过1GB"):ue&&ne&&Gy(ne,ue),Xe.current=null,ke.current&&(ke.current.value="")}})]})]}),R.jsxs("div",{className:"rich-text-editor-footer",children:[R.jsxs("div",{className:"rich-text-editor-footer-left",children:[R.jsx("div",{className:"rich-text-editor-brand",children:f!=="hideAgent"&&R.jsx(ge.Dropdown,{placement:"topLeft",menu:{selectedKeys:Zt?[String(Zt.key)]:[],items:i.filter(J=>J.isShowNew!==1).map(J=>({key:J.key,label:R.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[J.icon&&R.jsx("i",{className:J.icon}),R.jsx("span",{children:J.label})]}),onClick:()=>{s?.(J)}}))},trigger:["click"],disabled:l||a,overlayClassName:"rte-agent-dropdown",children:R.jsxs("div",{className:"rte-agent-badge",style:{cursor:i.length>0?"pointer":"default"},children:[R.jsx("i",{className:"iconfont icon-zhinengti",style:{fontSize:"16px"}}),R.jsx("span",{className:"rte-agent-text",children:"智能体"})]})})}),!e.find(J=>J.type==="tag")&&R.jsxs(R.Fragment,{children:[R.jsx("div",{className:"rte-footer-upload-btn",onClick:()=>se.current?.click(),title:"上传文件",children:R.jsx("i",{className:"iconfont icon-lianjie",style:{fontSize:"16px"}})}),R.jsx("input",{type:"file",ref:se,className:"rte-file-input",accept:".pdf,.xla,.xlb,.xlc,.xlm,.xls,.xlsx,.xlt,.xlw,.csv,.tsv,.iif,.doc,.docx,.dot,.odt,.rtf,.pot,.ppa,.pps,.ppt,.pptx,.pwz,.wiz,.asm,.bat,.c,.cc,.conf,.cpp,.css,.cxx,.def,.dic,.eml,.h,.hh,.htm,.html,.ics,.ifb,.in,.js,.json,.ksh,.png,.jpeg,.jpg,.gif,.webp,.md,.php,.pkl,.rb,.tar,.tex,.ts,.txt,.xml,",multiple:!0,onChange:xy})]})]}),R.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[R.jsxs("div",{className:"rte-brand-badge",children:[R.jsx("div",{className:"rte-brand-badge",children:R.jsx("img",{src:"https://oospublic.sealseek.cn/file/website/ball.png",alt:""})}),R.jsx("span",{className:"rte-brand-text",style:{marginLeft:"4px"},children:"SealSeek 2.0"})]}),!Zt||Zt.points===void 0||Zt.points===null?null:R.jsxs("div",{className:"rte-points-badge",style:{position:"relative"},children:[R.jsx("i",{className:"iconfont icon-jifen",style:{marginRight:"4px",fontSize:"16px"}}),R.jsxs("span",{style:{fontSize:"16px",lineHeight:"22px"},children:["-",String(Zt.points)]}),Zt.labelValue===2&&R.jsx("div",{className:"rte-limited-free-badge",children:R.jsx("span",{className:"rte-limited-free-text",children:"限时免费"})})]}),R.jsx("button",{type:"button",onClick:jo,disabled:a||l||o||!Oo,className:"rich-text-editor-send-button",children:a||o?R.jsx("span",{className:"rte-send-spinner"}):R.jsx("i",{className:"iconfont icon-fasong"})})]})]}),wt,R.jsx(ge.Image,{style:{display:"none"},src:Z,preview:{visible:me,onVisibleChange:J=>ye(J)}}),Wo,Go,Yy,Wy,Yo,Vy,Jy]})};xo.__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 Co="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFSSURBVHgB3ZTtccIwDIaVXv83I2SDZgSP0BHMBG0naEZhA2boBGQDswHdQJUOGRxjO0Z8HPDe6eJzJD2W4gjgEYSIn2xwK6EIFHqBGysJpMP3ZB0oRbEtmal1NtIxl4OWWsoxEsvqofJ0rgTNASOYq+7SXKDsuYvAcgkq/PWwBLQWqIfdjeRStaBUc4qzgLi9/BzJNmS/sh6bpvmrTfSFacU3scWy1mQryWdSnXiFE8QVUJINLTuyhWzzz/1OZmTN9hEckqtfUOwIGlGCpVRjE+94JFqpMtTeVzO8/UmPxpZU8Qa7aln8Tb9pfwla4WHWrjPvvbbnTBsX7PmLs83EDAH0BxSw1G31+/1FoDg/vPcXR+wocQS1apj4+P92FfhOoLyuBfYlmPgYnGoCjWADzAkzUyJ430awLmphPaxWQVU22BuuApPkHaanjcXSN3t6/QNjTMSJWDcs1QAAAABJRU5ErkJggg==",oy=[{label:"5页",value:5},{label:"10页",value:10},{label:"15页",value:15},{label:"30页",value:30}],cy=({autoLoading:e,batchSize:t,loadingProgress:a,loadIcon:l,onBatchSizeChange:n,onLoadNextPage:r,onStartAutoLoad:i,onStopLoad:s})=>e&&a?R.jsxs("div",{className:"auto_load_progress",children:[l||R.jsx("img",{src:Co,alt:"自动加载",width:14,height:14}),R.jsxs("span",{children:["正在加载第",a.currentPage,"/",a.totalPages,"页"]}),R.jsx(ge.Progress,{percent:a.percentage,type:"line",size:[160,8]}),R.jsx("span",{onClick:s,className:"auto_load_stop_btn",children:"停止加载"})]}):R.jsxs("div",{className:"auto_load_container",children:[R.jsx("div",{onClick:r,className:"auto_load_next_btn",style:{backgroundColor:e?"#f5f5f5":"#2563eb"},children:"加载下一页"}),R.jsxs("div",{className:"right_control_wrap",style:{backgroundColor:e?"#f5f5f5":"#2563eb"},children:[R.jsxs("div",{className:"auto_load_btn",onClick:e?void 0:i,children:[l||R.jsx("img",{src:Co,alt:"自动加载",width:14,height:14}),R.jsx("span",{children:"自动加载"})]}),R.jsx(ge.Select,{value:t,onChange:n,options:oy,disabled:e,size:"small",className:"auto_load_select",popupMatchSelectWidth:84})]})]}),dy=({current:e,loadIcon:t,pageSize:a,total:l,cachedPages:n,loadedCount:r,autoLoading:i=!1,loadingProgress:s,onChange:u,onLoadNextPage:o,onStartAutoLoad:c,onStopLoading:d})=>{const[h,f]=w.useState(5),E=Math.ceil(l/a),v=w.useMemo(()=>n.length>=E,[n,E]),m=()=>Array.from({length:E},(b,C)=>C+1).filter(b=>!n.includes(b)).slice(0,h),y=(g,b,C)=>{const x=n.includes(g);return b==="prev"||b==="next"||b==="jump-prev"||b==="jump-next"?R.jsx("div",{className:"pageBox",children:C}):R.jsxs("div",{className:"pageBox",style:{backgroundColor:e===g?"#2563EB":"#f5f5f5",color:e===g?"#fff":x?"#171717":"#a3a3a3"},children:[g,!x&&R.jsx("span",{className:"unload_spot"})]})};return R.jsxs("div",{className:"pagination_footer",children:[R.jsxs("div",{className:"pagination_leftWrap",children:[R.jsxs("span",{className:"pagination_total",children:[R.jsx(Tt.InfoCircleOutlined,{style:{color:"#2563EB",marginRight:"4px"}}),"已加载: ",r,"/",l,"条数据"]}),!v&&R.jsx(cy,{loadIcon:t||void 0,autoLoading:i,batchSize:h,loadingProgress:s,disabled:!o||!c,onBatchSizeChange:f,onLoadNextPage:()=>o?.(),onStartAutoLoad:()=>{const g=m();c?.(g)},onStopLoad:()=>d?.()})]}),R.jsx(ge.Pagination,{current:e,pageSize:a,total:l,onChange:g=>u(g),showSizeChanger:!1,showQuickJumper:!1,showTotal:()=>"",itemRender:y})]})},So=e=>{const{loading:t,autoLoading:a,loadingProgress:l,columns:n=[],dataSource:r=[],total:i,current:s,pageSize:u,cachedPages:o,onChangePage:c,onLoadNextPage:d,onStartAutoLoad:h,onStopLoading:f,...E}=e,v=w.useRef(null),m=w.useCallback(y=>{c(y),o.includes(y)&&v.current?.scrollTo({key:`${(y-1)*u+1}`})},[o,c,u]);return R.jsxs("div",{className:"flex flex-col",children:[R.jsx(ge.Table,{ref:v,...E,columns:n,dataSource:r,pagination:!1,virtual:!0}),R.jsx(dy,{loading:t,autoLoading:a,loadingProgress:l,current:s,pageSize:u,total:i,loadedCount:r.length,cachedPages:o,onChange:m,onLoadNextPage:d,onStartAutoLoad:h,onStopLoading:f})]})};So.__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 Ao=({texts:e=[],placeholder:t="请输入内容",animationSpeed:a=100,autoPlay:l=!0,value:n,onChange:r,...i})=>{const[s,u]=w.useState(""),[o,c]=w.useState(0),[d,h]=w.useState(!1),[f,E]=w.useState(!1),[v,m]=w.useState(!1),y=w.useRef(void 0),g=w.useRef(void 0),b=w.useRef(e),C=w.useRef(o),x=w.useRef(f),A=w.useRef(s);w.useEffect(()=>{b.current=e,C.current=o,x.current=f,A.current=s});const k=w.useCallback((L,T)=>{let O=0;m(!0);const q=()=>{O<L.length?(u(L.slice(0,O+1)),O++,g.current=window.setTimeout(q,a)):(m(!1),T?.())};q()},[a]),N=w.useCallback(L=>{let T=A.current.length;const O=()=>{T>0?(u(A.current.slice(0,T-1)),T--,g.current=window.setTimeout(O,a/2)):L?.()};O()},[a]),S=w.useCallback(()=>{if(b.current.length===0||x.current)return;h(!0);const L=b.current[C.current];A.current?N(()=>{k(L,()=>{y.current=window.setTimeout(()=>{c(T=>(T+1)%b.current.length),h(!1)},2e3)})}):k(L,()=>{y.current=window.setTimeout(()=>{c(T=>(T+1)%b.current.length),h(!1)},2e3)})},[N,k]);w.useEffect(()=>(l&&e.length>0&&!f&&S(),()=>{y.current&&window.clearTimeout(y.current),g.current&&window.clearTimeout(g.current)}),[o,f,l,e.length,S]),w.useEffect(()=>{!d&&l&&e.length>0&&!f&&S()},[o,d,l,e.length,f,S]);const D=L=>{E(!0),y.current&&window.clearTimeout(y.current),g.current&&window.clearTimeout(g.current),h(!1),m(!1),i.onFocus?.(L)},P=L=>{E(!1),!n&&e.length>0&&(u(""),c(0)),i.onBlur?.(L)},$=L=>{r?.(L.target.value),i.onChange?.(L)},B=()=>f||n?t:s||t;return R.jsxs("div",{style:{position:"relative"},children:[R.jsx(ge.Input,{...i,value:n,onChange:$,onFocus:D,onBlur:P,placeholder:B(),style:{...i.style,position:"relative",zIndex:1}}),!f&&!n&&s&&R.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:[R.jsx("span",{children:s}),v&&R.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),R.jsx("style",{children:`
|
|
65
65
|
@keyframes blink {
|
|
66
66
|
0%, 50% { opacity: 1; }
|
|
67
67
|
51%, 100% { opacity: 0; }
|