bi-components-library 1.3.7-next.13 → 1.3.7-next.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -143,7 +143,7 @@ img.ProseMirror-separator {
143
143
  `);return!a||!i?!1:e.chain().command(({tr:s})=>(s.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:l,empty:a}=n;if(!a||l.parent.type!==this.type||!(l.parentOffset===l.parent.nodeSize-2))return!1;const s=l.after();return s===void 0?!1:r.nodeAt(s)?e.commands.command(({tr:u})=>(u.setSelection(Ce.near(r.resolve(s))),!0)):e.commands.exitCode()}}},addInputRules(){return[jo({find:w5,type:this.type,getAttributes:e=>({language:e[1]})}),jo({find:I5,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new ht({key:new zt("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),l=r?JSON.parse(r):void 0,a=l?.mode;if(!n||!a)return!1;const{tr:i,schema:s}=e.state,o=s.text(n.replace(/\r\n?/g,`
144
144
  `));return i.replaceSelectionWith(this.type.create({language:a},o)),i.selection.$from.parent.type!==this.type&&i.setSelection(be.near(i.doc.resolve(Math.max(0,i.selection.from-2)))),i.setMeta("paste",!0),e.dispatch(i),!0}}})]}}),O5=Ct.create({name:"doc",topNode:!0,content:"block+"});function M5(e={}){return new ht({view(t){return new L5(t,e)}})}class L5{constructor(t,n){var r;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(l=>{let a=i=>{this[l](i)};return t.dom.addEventListener(l,a),{name:l,handler:a}})}destroy(){this.handlers.forEach(({name:t,handler:n})=>this.editorView.dom.removeEventListener(t,n))}update(t,n){this.cursorPos!=null&&n.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r,l=this.editorView.dom,a=l.getBoundingClientRect(),i=a.width/l.offsetWidth,s=a.height/l.offsetHeight;if(n){let d=t.nodeBefore,h=t.nodeAfter;if(d||h){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let m=f.getBoundingClientRect(),y=d?m.bottom:m.top;d&&h&&(y=(y+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*s;r={left:m.left,right:m.right,top:y-g,bottom:y+g}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*i;r={left:d.left-h,right:d.left+h,top:d.top,bottom:d.bottom}}let o=this.editorView.dom.offsetParent;this.element||(this.element=o.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let u,c;if(!o||o==document.body&&getComputedStyle(o).position=="static")u=-pageXOffset,c=-pageYOffset;else{let d=o.getBoundingClientRect(),h=d.width/o.offsetWidth,f=d.height/o.offsetHeight;u=d.left-o.scrollLeft*h,c=d.top-o.scrollTop*f}this.element.style.left=(r.left-u)/i+"px",this.element.style.top=(r.top-c)/s+"px",this.element.style.width=(r.right-r.left)/i+"px",this.element.style.height=(r.bottom-r.top)/s+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),l=r&&r.type.spec.disableDropCursor,a=typeof l=="function"?l(this.editorView,n,t):l;if(n&&!a){let i=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let s=Vh(this.editorView.state.doc,i,this.editorView.dragging.slice);s!=null&&(i=s)}this.setCursor(i),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}const D5=dt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[M5(this.options)]}});class Re extends Ce{constructor(t){super(t,t)}map(t,n){let r=t.resolve(n.map(this.head));return Re.valid(r)?new Re(r):Ce.near(r)}content(){return ie.empty}eq(t){return t instanceof Re&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Re(t.resolve(n.pos))}getBookmark(){return new nu(this.anchor)}static valid(t){let n=t.parent;if(n.inlineContent||!P5(t)||!B5(t))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let l=n.contentMatchAt(t.index()).defaultType;return l&&l.isTextblock}static findGapCursorFrom(t,n,r=!1){e:for(;;){if(!r&&Re.valid(t))return t;let l=t.pos,a=null;for(let i=t.depth;;i--){let s=t.node(i);if(n>0?t.indexAfter(i)<s.childCount:t.index(i)>0){a=s.child(n>0?t.indexAfter(i):t.index(i)-1);break}else if(i==0)return null;l+=n;let o=t.doc.resolve(l);if(Re.valid(o))return o}for(;;){let i=n>0?a.firstChild:a.lastChild;if(!i){if(a.isAtom&&!a.isText&&!he.isSelectable(a)){t=t.doc.resolve(l+a.nodeSize*n),r=!1;continue e}break}a=i,l+=n;let s=t.doc.resolve(l);if(Re.valid(s))return s}return null}}}Re.prototype.visible=!1,Re.findFrom=Re.findGapCursorFrom,Ce.jsonID("gapcursor",Re);class nu{constructor(t){this.pos=t}map(t){return new nu(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return Re.valid(n)?new Re(n):Ce.near(n)}}function tb(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function P5(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let l=r.child(n-1);;l=l.lastChild){if(l.childCount==0&&!l.inlineContent||tb(l.type))return!0;if(l.inlineContent)return!1}}return!0}function B5(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let l=r.child(n);;l=l.firstChild){if(l.childCount==0&&!l.inlineContent||tb(l.type))return!0;if(l.inlineContent)return!1}}return!0}function F5(){return new ht({props:{decorations:z5,createSelectionBetween(e,t,n){return t.pos==n.pos&&Re.valid(n)?new Re(n):null},handleClick:H5,handleKeyDown:R5,handleDOMEvents:{beforeinput:U5}}})}const R5=b0({ArrowLeft:pi("horiz",-1),ArrowRight:pi("horiz",1),ArrowUp:pi("vert",-1),ArrowDown:pi("vert",1)});function pi(e,t){const n=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(r,l,a){let i=r.selection,s=t>0?i.$to:i.$from,o=i.empty;if(i instanceof be){if(!a.endOfTextblock(n)||s.depth==0)return!1;o=!1,s=r.doc.resolve(t>0?s.after():s.before())}let u=Re.findGapCursorFrom(s,t,o);return u?(l&&l(r.tr.setSelection(new Re(u))),!0):!1}}function H5(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Re.valid(r))return!1;let l=e.posAtCoords({left:n.clientX,top:n.clientY});return l&&l.inside>-1&&he.isSelectable(e.state.doc.nodeAt(l.inside))?!1:(e.dispatch(e.state.tr.setSelection(new Re(r))),!0)}function U5(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof Re))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let l=K.empty;for(let i=r.length-1;i>=0;i--)l=K.from(r[i].createAndFill(null,l));let a=e.state.tr.replace(n.pos,n.pos,new ie(l,0,0));return a.setSelection(be.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function z5(e){if(!(e.selection instanceof Re))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",Ye.create(e.doc,[It.widget(e.selection.head,t,{key:"gapcursor"})])}const V5=dt.create({name:"gapCursor",addProseMirrorPlugins(){return[F5()]},extendNodeSchema(e){var t;const n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=Se(oe(e,"allowGapCursor",n)))!==null&&t!==void 0?t:null}}}),$5=Ct.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",mt(this.options.HTMLAttributes,e)]},renderText(){return`
145
145
  `},addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:l,storedMarks:a}=n;if(l.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:s}=r.extensionManager,o=a||l.$to.parentOffset&&l.$from.marks();return t().insertContent({type:this.name}).command(({tr:u,dispatch:c})=>{if(c&&o&&i){const d=o.filter(h=>s.includes(h.type.name));u.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),q5=Ct.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,mt(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>jo({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}});var bi=200,Ze=function(){};Ze.prototype.append=function(t){return t.length?(t=Ze.from(t),!this.length&&t||t.length<bi&&this.leafAppend(t)||this.length<bi&&t.leafPrepend(this)||this.appendInner(t)):this},Ze.prototype.prepend=function(t){return t.length?Ze.from(t).append(this):this},Ze.prototype.appendInner=function(t){return new W5(this,t)},Ze.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?Ze.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))},Ze.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},Ze.prototype.forEach=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)},Ze.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var l=[];return this.forEach(function(a,i){return l.push(t(a,i))},n,r),l},Ze.from=function(t){return t instanceof Ze?t:t&&t.length?new nb(t):Ze.empty};var nb=function(e){function t(r){e.call(this),this.values=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(l,a){return l==0&&a==this.length?this:new t(this.values.slice(l,a))},t.prototype.getInner=function(l){return this.values[l]},t.prototype.forEachInner=function(l,a,i,s){for(var o=a;o<i;o++)if(l(this.values[o],s+o)===!1)return!1},t.prototype.forEachInvertedInner=function(l,a,i,s){for(var o=a-1;o>=i;o--)if(l(this.values[o],s+o)===!1)return!1},t.prototype.leafAppend=function(l){if(this.length+l.length<=bi)return new t(this.values.concat(l.flatten()))},t.prototype.leafPrepend=function(l){if(this.length+l.length<=bi)return new t(l.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(Ze);Ze.empty=new nb([]);var W5=function(e){function t(n,r){e.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},t.prototype.forEachInner=function(r,l,a,i){var s=this.left.length;if(l<s&&this.left.forEachInner(r,l,Math.min(a,s),i)===!1||a>s&&this.right.forEachInner(r,Math.max(l-s,0),Math.min(this.length,a)-s,i+s)===!1)return!1},t.prototype.forEachInvertedInner=function(r,l,a,i){var s=this.left.length;if(l>s&&this.right.forEachInvertedInner(r,l-s,Math.max(a,s)-s,i+s)===!1||a<s&&this.left.forEachInvertedInner(r,Math.min(l,s),a,i)===!1)return!1},t.prototype.sliceInner=function(r,l){if(r==0&&l==this.length)return this;var a=this.left.length;return l<=a?this.left.slice(r,l):r>=a?this.right.slice(r-a,l-a):this.left.slice(r,a).append(this.right.slice(0,l-a))},t.prototype.leafAppend=function(r){var l=this.right.leafAppend(r);if(l)return new t(this.left,l)},t.prototype.leafPrepend=function(r){var l=this.left.leafPrepend(r);if(l)return new t(l,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t}(Ze);const Y5=500;class Vt{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let l,a;n&&(l=this.remapping(r,this.items.length),a=l.maps.length);let i=t.tr,s,o,u=[],c=[];return this.items.forEach((d,h)=>{if(!d.step){l||(l=this.remapping(r,h+1),a=l.maps.length),a--,c.push(d);return}if(l){c.push(new Jt(d.map));let f=d.step.map(l.slice(a)),m;f&&i.maybeStep(f).doc&&(m=i.mapping.maps[i.mapping.maps.length-1],u.push(new Jt(m,void 0,void 0,u.length+c.length))),a--,m&&l.appendMap(m,a)}else i.maybeStep(d.step);if(d.selection)return s=l?d.selection.map(l.slice(a)):d.selection,o=new Vt(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:o,transform:i,selection:s}}addTransform(t,n,r,l){let a=[],i=this.eventCount,s=this.items,o=!l&&s.length?s.get(s.length-1):null;for(let c=0;c<t.steps.length;c++){let d=t.steps[c].invert(t.docs[c]),h=new Jt(t.mapping.maps[c],d,n),f;(f=o&&o.merge(h))&&(h=f,c?a.pop():s=s.slice(0,s.length-1)),a.push(h),n&&(i++,n=void 0),l||(o=h)}let u=i-r.depth;return u>G5&&(s=j5(s,u),i-=u),new Vt(s.append(a),i)}remapping(t,n){let r=new Ml;return this.items.forEach((l,a)=>{let i=l.mirrorOffset!=null&&a-l.mirrorOffset>=t?r.maps.length-l.mirrorOffset:void 0;r.appendMap(l.map,i)},t,n),r}addMaps(t){return this.eventCount==0?this:new Vt(this.items.append(t.map(n=>new Jt(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],l=Math.max(0,this.items.length-n),a=t.mapping,i=t.steps.length,s=this.eventCount;this.items.forEach(h=>{h.selection&&s--},l);let o=n;this.items.forEach(h=>{let f=a.getMirror(--o);if(f==null)return;i=Math.min(i,f);let m=a.maps[f];if(h.step){let y=t.steps[f].invert(t.docs[f]),g=h.selection&&h.selection.map(a.slice(o+1,f));g&&s++,r.push(new Jt(m,y,g))}else r.push(new Jt(m))},l);let u=[];for(let h=n;h<i;h++)u.push(new Jt(a.maps[h]));let c=this.items.slice(0,l).append(u).append(r),d=new Vt(c,s);return d.emptyItemCount()>Y5&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,l=[],a=0;return this.items.forEach((i,s)=>{if(s>=t)l.push(i),i.selection&&a++;else if(i.step){let o=i.step.map(n.slice(r)),u=o&&o.getMap();if(r--,u&&n.appendMap(u,r),o){let c=i.selection&&i.selection.map(n.slice(r));c&&a++;let d=new Jt(u.invert(),o,c),h,f=l.length-1;(h=l.length&&l[f].merge(d))?l[f]=h:l.push(d)}}else i.map&&r--},this.items.length,0),new Vt(Ze.from(l.reverse()),a)}}Vt.empty=new Vt(Ze.empty,0);function j5(e,t){let n;return e.forEach((r,l)=>{if(r.selection&&t--==0)return n=l,!1}),e.slice(n)}class Jt{constructor(t,n,r,l){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=l}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new Jt(n.getMap().invert(),n,this.selection)}}}class Ln{constructor(t,n,r,l,a){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=l,this.prevComposition=a}}const G5=20;function K5(e,t,n,r){let l=n.getMeta(ur),a;if(l)return l.historyState;n.getMeta(J5)&&(e=new Ln(e.done,e.undone,null,0,-1));let i=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(i&&i.getMeta(ur))return i.getMeta(ur).redo?new Ln(e.done.addTransform(n,void 0,r,mi(t)),e.undone,rb(n.mapping.maps),e.prevTime,e.prevComposition):new Ln(e.done,e.undone.addTransform(n,void 0,r,mi(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(i&&i.getMeta("addToHistory")===!1)){let s=n.getMeta("composition"),o=e.prevTime==0||!i&&e.prevComposition!=s&&(e.prevTime<(n.time||0)-r.newGroupDelay||!Q5(n,e.prevRanges)),u=i?ru(e.prevRanges,n.mapping):rb(n.mapping.maps);return new Ln(e.done.addTransform(n,o?t.selection.getBookmark():void 0,r,mi(t)),Vt.empty,u,n.time,s??e.prevComposition)}else return(a=n.getMeta("rebased"))?new Ln(e.done.rebased(n,a),e.undone.rebased(n,a),ru(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new Ln(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),ru(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function Q5(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,l)=>{for(let a=0;a<t.length;a+=2)r<=t[a+1]&&l>=t[a]&&(n=!0)}),n}function rb(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((r,l,a,i)=>t.push(a,i));return t}function ru(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let l=t.map(e[r],1),a=t.map(e[r+1],-1);l<=a&&n.push(l,a)}return n}function X5(e,t,n){let r=mi(t),l=ur.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let i=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),l,r),o=new Ln(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(i).setMeta(ur,{redo:n,historyState:o})}let lu=!1,lb=null;function mi(e){let t=e.plugins;if(lb!=t){lu=!1,lb=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){lu=!0;break}}return lu}const ur=new zt("history"),J5=new zt("closeHistory");function Z5(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new ht({key:ur,state:{init(){return new Ln(Vt.empty,Vt.empty,null,0,-1)},apply(t,n,r){return K5(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,l=r=="historyUndo"?ib:r=="historyRedo"?sb:null;return!l||!t.editable?!1:(n.preventDefault(),l(t.state,t.dispatch))}}}})}function ab(e,t){return(n,r)=>{let l=ur.getState(n);if(!l||(e?l.undone:l.done).eventCount==0)return!1;if(r){let a=X5(l,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}const ib=ab(!1,!0),sb=ab(!0,!0),e8=dt.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>ib(e,t),redo:()=>({state:e,dispatch:t})=>sb(e,t)}},addProseMirrorPlugins(){return[Z5(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),t8=Ct.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",mt(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!Gk(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$from:r,$to:l}=n,a=e();return r.parentOffset===0?a.insertContentAt({from:Math.max(r.pos-1,0),to:l.pos},{type:this.name}):kk(n)?a.insertContentAt(l.pos,{type:this.name}):a.insertContent({type:this.name}),a.command(({tr:i,dispatch:s})=>{var o;if(s){const{$to:u}=i.selection,c=u.end();if(u.nodeAfter)u.nodeAfter.isTextblock?i.setSelection(be.create(i.doc,u.pos+1)):u.nodeAfter.isBlock?i.setSelection(he.create(i.doc,u.pos)):i.setSelection(be.create(i.doc,u.pos));else{const d=(o=u.parent.type.contentMatch.defaultType)===null||o===void 0?void 0:o.create();d&&(i.insert(c,d),i.setSelection(be.create(i.doc,c+1)))}i.scrollIntoView()}return!0}).run()}}},addInputRules(){return[jk({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),n8=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,r8=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,l8=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,a8=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,i8=On.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>e.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",mt(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Yr({find:n8,type:this.type}),Yr({find:l8,type:this.type})]},addPasteRules(){return[jr({find:r8,type:this.type}),jr({find:a8,type:this.type})]}}),s8=Ct.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",mt(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),o8="listItem",ob="textStyle",ub=/^(\d+)\.\s$/,u8=Ct.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return t===1?["ol",mt(this.options.HTMLAttributes,n),0]:["ol",mt(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(o8,this.editor.getAttributes(ob)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=Gl({find:ub,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Gl({find:ub,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(ob)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[e]}}),c8=Ct.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",mt(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),d8=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,f8=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,h8=On.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["s",mt(this.options.HTMLAttributes,e),0]},addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Yr({find:d8,type:this.type})]},addPasteRules(){return[jr({find:f8,type:this.type})]}}),p8=Ct.create({name:"text",group:"inline"}),b8=dt.create({name:"starterKit",addExtensions(){const e=[];return this.options.bold!==!1&&e.push(C5.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(g5.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(x5.configure(this.options.bulletList)),this.options.code!==!1&&e.push(N5.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(_5.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(O5.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(D5.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(V5.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push($5.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(q5.configure(this.options.heading)),this.options.history!==!1&&e.push(e8.configure(this.options.history)),this.options.horizontalRule!==!1&&e.push(t8.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(i8.configure(this.options.italic)),this.options.listItem!==!1&&e.push(s8.configure(this.options.listItem)),this.options.orderedList!==!1&&e.push(u8.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(c8.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(h8.configure(this.options.strike)),this.options.text!==!1&&e.push(p8.configure(this.options.text)),e}}),m8=dt.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ht({key:new zt("placeholder"),props:{decorations:({doc:e,selection:t})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=t,l=[];if(!n)return null;const a=this.editor.isEmpty;return e.descendants((i,s)=>{const o=r>=s&&r<=s+i.nodeSize,u=!i.isLeaf&&fi(i);if((o||!this.options.showOnlyCurrent)&&u){const c=[this.options.emptyNodeClass];a&&c.push(this.options.emptyEditorClass);const d=It.node(s,s+i.nodeSize,{class:c.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:i,pos:s,hasAnchor:o}):this.options.placeholder});l.push(d)}return this.options.includeChildren}),Ye.create(e,l)}}})]}});function g8(e){return[b8.configure({heading:{levels:[1,2,3]},history:{depth:50}}),m8.configure({placeholder:e.placeholder??"",showOnlyWhenEditable:!0,emptyEditorClass:"rte-richtext-empty"})]}const v8=({expanded:e,onToggle:t})=>b.jsxs("button",{type:"button",className:"rte-richtext-toggle","data-expanded":e?"true":"false",onClick:t,children:[b.jsx("i",{className:`iconfont ${e?"icon-shouqi1":"icon-zhankai2"}`}),b.jsx("span",{className:"rte-richtext-toggle-label",children:e?"收起":"展开"})]}),cb=v.memo(({node:e,value:t,onChange:n,disabled:r,error:l,nodeDefaults:a,onExpandChange:i})=>{const s=typeof e.minHeight=="number"?e.minHeight:a?.richtext?.minHeight??40,o=typeof e.maxHeight=="number"?e.maxHeight:a?.richtext?.maxHeight??160,u=Math.max(o,s),c=e.expandable!==!1,[d,h]=v.useState(!1),f=v.useRef(n),m=v.useRef(e.key);v.useEffect(()=>{f.current=n},[n]),v.useEffect(()=>{m.current=e.key},[e.key]);const y=h5({extensions:g8({placeholder:e.placeholder}),content:t||"",editable:!r,onUpdate:({editor:A})=>{const P=m.current;P&&f.current(P,A.getHTML())},editorProps:{attributes:{class:"rte-richtext","data-type":"richtext","data-key":e.key??""}}});v.useEffect(()=>{if(!y)return;const A=y.getHTML(),P=t??"";A!==P&&(y.isFocused||y.commands.setContent(P,!1))},[t,y]),v.useEffect(()=>{y&&y.setEditable(!r)},[r,y]);const g=v.useCallback(()=>{h(A=>{const P=!A;return e.key&&i?.(e.key,P),P})},[e.key,i]);if(!y)return null;const E={"--rte-richtext-min-height":`${s}px`,"--rte-richtext-max-height":`${u}px`},N=["rte-richtext-wrapper",c?"rte-richtext-toggleable":"",d?"rte-richtext-expanded":""].filter(Boolean).join(" ");return b.jsx("div",{className:`rte-richtext-container ${d?"rte-richtext-host-expanded":""} ${l?"rte-richtext-error":""}`,"data-key":e.key,children:b.jsxs("div",{className:N,style:E,children:[b.jsx(r5,{editor:y}),c&&b.jsx(v8,{expanded:d,onToggle:g})]})})});cb.displayName="RichtextNode";const y8=e=>{const{node:t}=e;switch(t.type){case"text":return b.jsx(Ru,{node:t});case"tag":{const r=!e.hideAgentClose&&!!e.onAgentExit&&!t.tooltip?{...t,tooltip:"点击退出智能体"}:t;return b.jsx(Hu,{node:r,hideClose:e.hideAgentClose,onClose:()=>e.onAgentExit?.("tag-close"),tooltipZIndex:1e4})}case"variable":return b.jsx(Af,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,r)=>e.onChange(n,r),disabled:e.disabled,error:e.error});case"number-input":return b.jsx(Nf,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,r)=>e.onChange(n,r),disabled:e.disabled,error:e.error});case"select":return b.jsx(wf,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,r)=>e.onChange(n,r),disabled:e.disabled,error:e.error});case"searchable-select":return b.jsx(If,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,r)=>e.onChange(n,r),disabled:e.disabled,error:e.error});case"datepicker":return b.jsx(Bf,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,r)=>e.onChange(n,r),disabled:e.disabled,error:e.error});case"cascader":return b.jsx(Ff,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,r)=>e.onChange(n,r),disabled:e.disabled,error:e.error});case"textarea":return b.jsx(Rf,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,r)=>e.onChange(n,r),disabled:e.disabled,error:e.error,nodeDefaults:e.nodeDefaults});case"multi-variable":return b.jsx(Uf,{node:t,value:Array.isArray(e.value)?e.value:void 0,onChange:(n,r)=>e.onChange(n,r),disabled:e.disabled,error:e.error,reportListFetch:e.reportListFetch,onReportGoGenerate:e.onReportGoGenerate,onViewReport:e.onViewReport,hideCurrentSessionReport:e.hideCurrentSessionReport,reportNames:e.reportNames,onResolveName:e.onResolveMultiName,onClearReport:e.onClearReport,onShiftReportNames:e.onShiftReportNames});case"multi-variable-select":return b.jsx(Vf,{node:t,value:Array.isArray(e.value)?e.value:void 0,onChange:(n,r)=>e.onChange(n,r),disabled:e.disabled,error:e.error,reportListFetch:e.reportListFetch,onReportGoGenerate:e.onReportGoGenerate,onViewReport:e.onViewReport,hideCurrentSessionReport:e.hideCurrentSessionReport,reportNames:e.reportNames,onResolveName:e.onResolveMultiName,onClearReport:e.onClearReport,onAnalyzeReport:e.onAnalyzeMultiReport,onShiftReportNames:e.onShiftReportNames});case"upload":return b.jsx(Wf,{node:t,files:e.files??{},onFileChange:e.onFileChange??(()=>{}),disabled:e.disabled,error:e.error});case"video-url":return b.jsx(Jf,{node:t,value:typeof e.value=="string"?e.value:void 0,thumbnail:t.key?e.thumbnails?.[t.key]:void 0,onChange:(n,r)=>e.onChange(n,r),onThumbnailChange:e.onThumbnailChange,videoUrlParse:e.videoUrlParse,onParsingChange:e.onVideoParsingChange,disabled:e.disabled,error:e.error});case"video-upload":return b.jsx(Zf,{node:t,value:typeof e.value=="string"?e.value:void 0,thumbnail:t.key?e.thumbnails?.[t.key]:void 0,onChange:(n,r)=>e.onChange(n,r),onThumbnailChange:e.onThumbnailChange,onFileChange:e.onFileChange,videoUpload:e.videoUpload,onParsingChange:e.onVideoParsingChange,disabled:e.disabled,error:e.error});case"report-url":return b.jsx(th,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,r)=>e.onChange(n,r),onParse:t.key&&e.onReportUrlParse?n=>e.onReportUrlParse(t.key,n):void 0,reportListFetch:e.reportListFetch,onReportGoGenerate:e.onReportGoGenerate,reportName:t.key&&e.reportNames?e.reportNames[t.key]:void 0,onClearReport:e.onClearReport&&t.key?()=>e.onClearReport(t.key):void 0,onViewReport:e.onViewReport,hideCurrentSessionReport:e.hideCurrentSessionReport,disabled:e.disabled,error:e.error});case"markdown":return b.jsx(l6,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,r)=>e.onChange(n,r),onParse:t.key&&e.onMarkdownParse?n=>e.onMarkdownParse(t.key,n):void 0,disabled:e.disabled,error:e.error});case"markdown-name":return b.jsx(a6,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,r)=>e.onChange(n,r),onParse:t.key&&e.onMarkdownNameParse?n=>e.onMarkdownNameParse(t.key,n):void 0,disabled:e.disabled,error:e.error});case"report-module":return b.jsx(r6,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,r)=>e.onChange(n,r),disabled:e.disabled,error:e.error});case"markdown-module":return b.jsx(i6,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,r)=>e.onChange(n,r),disabled:e.disabled,error:e.error});case"richtext":return b.jsx(cb,{node:t,value:typeof e.value=="string"?e.value:void 0,onChange:(n,r)=>e.onChange(n,r),disabled:e.disabled,error:e.error,nodeDefaults:e.nodeDefaults,onExpandChange:e.onRichtextExpandChange});default:return b.jsx(_m,{node:e.node,value:e.value,onChange:e.onChange,index:e.index})}},db=v.memo(y8);db.displayName="NodeRenderer";const fb=e=>typeof e=="string"||Array.isArray(e)&&e.every(t=>typeof t=="string"),hb=(e,t)=>e===t?!0:Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):!1,E8=e=>{const t=new Map;for(const n of e)if(n.type==="upload"&&n.key){const r=typeof n.maxCount=="number"&&typeof n.minCount=="number"&&n.maxCount>1;t.set(n.key,{batch:r,maxCount:r?n.maxCount:1})}return t};function T8(e,t,n,r,l,a){const i=v.useRef({});v.useEffect(()=>{if(!e)return;const s=E8(r);n(u=>{const c={...u};let d=!1;for(const[h,f]of Object.entries(e)){if(s.has(h)||!fb(f))continue;const m=c[h],y=m===void 0||m===""||Array.isArray(m)&&m.length===0,g=!hb(i.current[h],f);(y||g)&&(hb(m,f)||(c[h]=f,d=!0))}return d?c:u}),a(u=>{const c={...u};let d=!1;for(const[h,f]of s){const m=e[h];if(m==null)continue;const y=(Array.isArray(m)?m:[m]).filter(g=>g!=null&&g!=="");if(y.length!==0)if(f.batch)for(let g=0;g<y.length&&g<f.maxCount;g+=1){const E=`${h}-${g}`;c[E]==null&&(c[E]=y[g],d=!0)}else c[h]==null&&(c[h]=y[0],d=!0)}return d?c:u});const o={};for(const[u,c]of Object.entries(e))fb(c)&&(o[u]=c);i.current=o},[e,r,n,a])}const pb=new Set(["upload"]);function bb(e){return pb.has(e.type)?typeof e.maxCount=="number"&&typeof e.minCount=="number"&&e.maxCount>1?`至少上传 ${e.minCount} 个文件`:"请上传":"请填写"}function mb(e){return e.type==="report-module"||e.type==="markdown-module"?`${e.key}__module_${e.moduleIndex??0}`:e.key}function C8(e,t,n,r=new Set){const l={},a=new Map;for(const i of e){if(!i.required||!i.key||r.has(i.key))continue;const s=i.exclusionGroup;if(s&&s!=="separator"){const o=a.get(s)??[];o.push(i),a.set(s,o);continue}gi(i,t,n)||(l[mb(i)]=bb(i))}for(const[,i]of a)if(!i.some(s=>gi(s,t,n)))for(const s of i)l[mb(s)]=bb(s);return l}function gi(e,t,n){if(!e.key)return!0;if(pb.has(e.type)){if(typeof e.maxCount=="number"&&typeof e.minCount=="number"&&e.maxCount>1){let s=0;for(let o=0;o<(e.maxCount??0);o+=1)n[`${e.key}-${o}`]&&(s+=1);return s>=(e.minCount??1)}return!!n[e.key]}const r=e.type==="report-module"||e.type==="markdown-module"?`${e.key}__module_${e.moduleIndex??0}`:e.key,l=t[r];return l!==void 0&&l!==""&&!(Array.isArray(l)&&(l.length===0||l.every(i=>!i||!i.trim())))?!0:e.defaultValue!==void 0&&e.defaultValue!==null&&String(e.defaultValue)!==""}function S8(e,t,n,r=new Set){const l=e.filter(s=>s.required&&s.key&&!r.has(s.key));if(l.length===0)return!0;const a=new Map,i=[];for(const s of l){const o=s.exclusionGroup;if(o&&o!=="separator"){const u=a.get(o)??[];u.push(s),a.set(o,u)}else i.push(s)}for(const s of i)if(!gi(s,t,n))return!1;for(const[,s]of a)if(!s.some(o=>gi(o,t,n)))return!1;return!0}function x8(e){const[t,n]=v.useState({}),r=v.useCallback((a,i,s=new Set)=>{const o=C8(e,a,i,s);return n(o),Object.keys(o).length===0},[e]),l=v.useCallback(a=>{n(i=>{if(!(a in i))return i;const s={...i};return delete s[a],s})},[]);return{errors:t,validate:r,clearError:l}}function k8(e,t){if(!e.conditional)return!0;const{dependsOn:n,condition:r,values:l}=e.conditional,a=t[n],i=Array.isArray(a)?a[0]:a;if(i==null||i==="")return!1;switch(r){case"in":return l.includes(i);case"notIn":return!l.includes(i);case"equals":return l.length>0&&i===l[0];case"notEquals":return l.length>0&&i!==l[0];default:return!0}}function A8(e,t){const n=new Set;return e.forEach((r,l)=>{k8(r,t)||n.add(l)}),n}const N8=new Set(["upload"]);function gb(e,t,n){if(!e.key)return!1;if(N8.has(e.type)){if(n[e.key]!=null)return!0;if(typeof e.maxCount=="number"&&e.maxCount>1){for(let l=0;l<e.maxCount;l+=1)if(n[`${e.key}-${l}`]!=null)return!0}return!1}const r=t[e.key];return Array.isArray(r)?r.some(l=>l&&l.trim().length>0):r!=null&&String(r).trim()!==""}function w8(e,t){const n=[];let r=[];return e.forEach((l,a)=>{t.has(a)||(l.exclusionGroup?r.push({node:l,originalIndex:a}):(r.length&&n.push(r),r=[]))}),r.length&&n.push(r),n}function I8(e,t,n,r,l){const a=[];let i=[];const s=[];for(const d of e){if(d.node.exclusionGroup==="separator"){i.length&&a.push(i),i=[],s.push(d);continue}d.node.key&&i.push(d)}i.length&&a.push(i);const o=a.map(d=>d.some(({node:h})=>gb(h,t,n)));if(!o.some(Boolean))return;const c=o.findIndex(Boolean);a.forEach((d,h)=>{if(h!==c)for(const{node:f}of d)f.key&&r.add(f.key)});for(const d of s)l.add(d.originalIndex)}function _8(e,t,n,r){const l=new Map;for(const{node:i}of e)!i.exclusionGroup||!i.key||(gb(i,t,n)?l.set(i.exclusionGroup,!0):l.has(i.exclusionGroup)||l.set(i.exclusionGroup,!1));let a=null;for(const{node:i}of e)if(i.exclusionGroup&&i.exclusionGroup!=="separator"&&l.get(i.exclusionGroup)){a=i.exclusionGroup;break}if(a)for(const{node:i}of e)!i.key||!i.exclusionGroup||i.exclusionGroup!==a&&r.add(i.key)}function O8(e,t,n){const r=A8(e,t),l=new Set;r.forEach(o=>{const u=e[o]?.key;u&&l.add(u)});const a=w8(e,r),i=new Set(l),s=new Set;for(const o of a)o.some(({node:c})=>c.exclusionGroup==="separator")?I8(o,t,n,i,s):_8(o,t,n,i);return{excludedKeys:i,hiddenSeparatorIndexes:s,conditionalHiddenIndexes:r}}function M8(e,t,n){return v.useMemo(()=>O8(e,t,n),[e,t,n])}function L8(e){const t=v.useRef({}),n=v.useRef({}),r=v.useCallback(async(s,o)=>{if(!e.reportAnalyze)return{status:"unconfigured"};const u=(t.current[s]??0)+1;t.current[s]=u;try{const c=await e.reportAnalyze($s(o));return t.current[s]!==u?{status:"stale"}:{status:"success",modules:c.modules}}catch{return t.current[s]!==u?{status:"stale"}:{status:"failed"}}},[e.reportAnalyze]),l=v.useCallback(async(s,o)=>{if(!e.markdownAnalyze)return null;const u=(t.current[s]??0)+1;t.current[s]=u;try{const c=await e.markdownAnalyze({text:o});return t.current[s]!==u?null:c}catch{return null}},[e.markdownAnalyze]),a=v.useCallback(async(s,o)=>{if(!e.markdownNameAnalyze)return null;const u=(t.current[s]??0)+1;t.current[s]=u;try{const c=await e.markdownNameAnalyze({text:o});return t.current[s]!==u?null:c}catch{return null}},[e.markdownNameAnalyze]),i=v.useCallback(async(s,o,u)=>{if(!e.reportNameResolve)return{status:"skip"};const c=(o||"").trim();if(!/^https?:\/\//i.test(c))return{status:"skip"};const d=(n.current[s]??0)+1;n.current[s]=d;try{const h=await e.reportNameResolve({url:c,nodeKey:s,nodeType:u});return n.current[s]!==d?{status:"stale"}:{status:"success",name:h.name,url:h.url||c}}catch{return n.current[s]!==d?{status:"stale"}:{status:"failed"}}},[e.reportNameResolve]);return{analyzeReport:r,analyzeMarkdown:l,analyzeMarkdownName:a,resolveReportName:i}}const vb=/​/g,vi=e=>String(e??"").replace(vb,"").trim(),D8=e=>!e||!/<[a-z][\s\S]*>/i.test(e)?e:(new DOMParser().parseFromString(e,"text/html").body.textContent||"").replace(vb,"").trim(),P8=e=>e==="multi-variable"||e==="multi-variable-select",yi=(e,t)=>{if(!t)return"";const n=e[t];return Array.isArray(n)?vi(n[0]):vi(n)},B8=(e,t)=>{if(!t)return[];const n=e[t];if(Array.isArray(n))return n.map(vi).filter(Boolean);const r=vi(n);return r?[r]:[]},au=e=>typeof e=="string"?decodeURIComponent(e.split("/").pop()?.split("?")[0]||"file"):e.name;async function F8(e){const t=e.split("/").pop()?.split("?")[0]||"file",n=decodeURIComponent(t);try{const r=await fetch(`/api/image-proxy?url=${encodeURIComponent(e)}`);if(!r.ok)return e;const l=await r.blob();return new File([l],n,{type:l.type||"application/octet-stream"})}catch{return e}}const iu=async(e,t,n,r,l)=>{if(!(n==null||n==="")){if(n instanceof File){e.append(t,n);return}if(l&&typeof n=="string"&&/^https?:\/\//i.test(n)){const a=await F8(n);e.append(t,a);return}if(Array.isArray(n)){if(r.has(t)){for(const a of n)await iu(e,t,a,r,l);return}for(let a=0;a<n.length;a+=1)await iu(e,`${t}[${a}]`,n[a],r,l);return}e.append(t,String(n))}},R8=["variable","report-url","markdown","markdown-name","select","searchable-select","cascader","textarea","richtext","datepicker","number-input","video-url"];async function H8(e){const{config:t,values:n,files:r,footerFiles:l,markdownModules:a,excludedKeys:i,hiddenSeparatorIndexes:s}=e,o={},u=[],c=new Set(["url"]);for(let m=0;m<t.length;m+=1){const y=t[m],g=y.key;if(!(g&&i?.has(g))){if(y.type==="text"||y.type==="tag"){if(y.exclusionGroup==="separator"&&s?.has(m))continue;y.text&&u.push(y.text);continue}if(g&&P8(y.type)){const E=B8(n,g);E.length>0&&(o[g]=E,c.add(g),u.push(E.join(" ")));continue}if(g&&R8.includes(y.type)){let E=yi(n,g);if(!E&&y.type==="number-input"&&typeof y.defaultNumber=="number"&&(E=String(y.defaultNumber)),!E&&typeof y.defaultValue=="string"&&y.defaultValue!==""&&(E=y.defaultValue),!E)continue;if(o[g]=E,u.push(E),y.type==="report-url"){const N=o.url;o.url=N===void 0?E:Array.isArray(N)?[...N,E]:[String(N),E]}if(y.type==="markdown"||y.type==="markdown-name"){const N=y.sourceTextKey||`${g}__sourceText`;o[N]=E}continue}if(g&&(y.type==="report-module"||y.type==="markdown-module")){const E=`${g}__module_${y.moduleIndex??0}`,N=yi(n,E)||yi(n,g),A=D8(N);A&&(Array.isArray(o[g])||(o[g]=[]),o[g].push(A),c.add(g),u.push(A));continue}if(g&&y.type==="upload"){if(typeof y.maxCount=="number"&&typeof y.minCount=="number"&&y.maxCount>1){const N=[];for(let A=0;A<(y.maxCount??0);A+=1){const P=r[`${g}-${A}`];P&&N.push(P)}N.length>0&&(o[g]=N,u.push(` [附带${N.length}个文件: ${N.map(au).join(", ")}] `))}else{const N=r[g];N&&(o[g]=N,u.push(` [附带文件: ${au(N)}] `))}continue}if(g&&y.type==="video-upload"){const E=r[g];if(E)o[g]=E,u.push(` [附带视频: ${au(E)}] `);else{const N=yi(n,g);N&&(o[g]=N,u.push(N))}continue}}}const d=u.join("").trim(),h=new FormData;h.append("fullPrompt",d);const f=new Set;for(const m of t)m.type==="upload"&&m.key&&f.add(m.key);if(a)for(const m of t){if(!m.key||m.type!=="markdown"&&m.type!=="markdown-name")continue;const y=a[m.key];if(!y||y.length===0)continue;const g=y.map(N=>(N?.markdown||"").trim()).filter(N=>N.length>0);if(g.length===0)continue;const E=`${m.key}__markdown`;o[E]=g,c.add(E)}for(const[m,y]of Object.entries(o))await iu(h,m,y,c,f.has(m));return l.forEach(m=>{h.append("fileUrls",m)}),{formData:h,fullPrompt:d,hasContent:d.length>0||l.length>0}}function U8(e,t,n=new Set){const r=[];let l=!1;for(const a of e){if((a.type==="markdown"||a.type==="markdown-name")&&a.key){const s=t.markdownModules[a.key],o=n.has(a.key),u=!!s&&s.length>0;if(a.type==="markdown-name"){r.push(a),o&&!u&&r.push({type:"text",className:"rte-markdown-parsing",text:"解析中...",exclusionGroup:a.exclusionGroup}),u&&(s.forEach((c,d)=>{r.push({type:"markdown-module",key:a.key,moduleIndex:d,text:c.title,placeholder:"可编辑,内容不能为空",exclusionGroup:a.exclusionGroup,required:a.required})}),l=!0);continue}if(o&&!u){r.push({type:"text",key:a.key,className:"rte-markdown-parsing",text:"解析中...",exclusionGroup:a.exclusionGroup});continue}if(u){s.forEach((c,d)=>{r.push({type:"markdown-module",key:a.key,moduleIndex:d,text:c.title,placeholder:"可编辑,内容不能为空",exclusionGroup:a.exclusionGroup,required:a.required})}),l=!0;continue}r.push(a);continue}if(l){if(a.type==="text"&&a.text?.startsWith(`
146
- `)){r.push({...a,text:a.text.slice(1)}),l=!1;continue}if(a.exclusionGroup==="separator"){r.push(a);continue}}r.push(a),a.type==="report-url"&&a.key&&t.reportModules[a.key]&&t.reportModules[a.key].forEach((s,o)=>{r.push({type:"report-module",key:a.key,moduleIndex:o,text:s.title,exclusionGroup:a.exclusionGroup,required:a.required})})}return r}const z8={reportModules:{},markdownModules:{}},V8={adjustX:1,adjustY:1,shiftX:!1,shiftY:!1},yb=v.memo(({options:e,onSelect:t,disabled:n,currentAgent:r,onOpenChange:l,align:a,onExit:i})=>{const[s,o]=v.useState(!1),u=f=>{o(f),l?.(f)},c=e.filter(f=>f.isShowNew!==1).map(f=>({key:f.key,label:b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[f.icon&&b.jsx("i",{className:f.icon}),b.jsx("span",{children:f.label})]}),onClick:()=>t?.(f)})),d=!!r,h=`rte-agent-badge${d?" rte-agent-badge-selected":s?" rte-agent-badge-active":""}`;return b.jsx(se.Dropdown,{menu:{items:c,selectedKeys:r?[String(r.key)]:[]},disabled:n,placement:"bottomLeft",align:a,autoAdjustOverflow:V8,getPopupContainer:Mr,trigger:["click"],overlayClassName:"rte-agent-dropdown",onOpenChange:u,children:b.jsxs("div",{className:h,style:{cursor:e.length>0?"pointer":"default"},children:[b.jsx("i",{className:"iconfont icon-zhinengti",style:{fontSize:"16px"}}),b.jsx("span",{className:"rte-agent-text",children:"智能体"}),d&&i&&b.jsx("i",{className:"iconfont icon-guanbi rte-tool-close",role:"button","aria-label":"退出智能体",onMouseDown:f=>{f.preventDefault(),f.stopPropagation()},onClick:f=>{f.preventDefault(),f.stopPropagation(),!n&&i()}})]})})});yb.displayName="AgentDropdown";function Eb(e="width"){const t=v.useRef(null),[n,r]=v.useState(!1),l=v.useCallback(()=>{const a=t.current;a&&r(e==="height"?a.scrollHeight>a.clientHeight:a.scrollWidth>a.clientWidth)},[e]);return[t,n,l]}const $8=["全部技能","我的技能","订阅技能","系统技能"],q8=["all","mine","subscribe","system"],W8=20,Y8={system:"系统技能",mine:"我的技能",subscribe:"订阅技能"},Dn="基于用户上传的抖音推广数据,智能分析高潜力商品与爆品抖音推广数据,智能分析高潜力商品与爆品商品机会",Pn=["淘宝天猫","抖音电商","市场选品","京东商城","拼多多","小红书","快手电商","视频号"],Bn="当用户需要尖锐吐槽、阴阳怪气评论、犀利差评、回怼话术或讽刺性改写时使用本技能;用户只需提供对象、场景、原话或想表达的不满,即可触发生成。",j8=[{id:"c1",title:"抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让",desc:Dn,tags:Pn,badge:"system",heat:"3.5",usageInstruction:Bn},{id:"c2",title:"【商品评价明细导出助手】问候提示生成助手",desc:Dn,tags:Pn,badge:"system",heat:"6.6",usageInstruction:Bn},{id:"c3",title:"抖音推广找潜力爆品",desc:Dn,tags:Pn,badge:"mine",usageInstruction:Bn},{id:"c4",title:"抖音推广找潜力爆品",desc:Dn,tags:Pn,badge:"subscribe",heat:"6.6",usageInstruction:Bn},{id:"c4",title:"抖音推广找潜力爆品",desc:Dn,tags:Pn,badge:"subscribe",heat:"6.6",usageInstruction:Bn},{id:"c4",title:"抖音推广找潜力爆品",desc:Dn,tags:Pn,badge:"mine",heat:"6.6",usageInstruction:Bn},{id:"c4",title:"抖音推广找潜力爆品",desc:Dn,tags:Pn,badge:"mine",heat:"6.6",usageInstruction:Bn},{id:"c4",title:"抖音推广找潜力爆品",desc:Dn,tags:Pn,badge:"mine",heat:"6.6",usageInstruction:Bn}],G8=e=>({id:e.id,title:e.title,desc:e.desc??"",usageInstruction:e.usageInstruction,tags:e.tags??[],badge:e.badge??"system",heat:e.heat}),K8=()=>b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M6.2 1a5.2 5.2 0 0 1 4.06 8.45l2.6 2.6a.6.6 0 0 1-.85.85l-2.6-2.6A5.2 5.2 0 1 1 6.2 1Zm0 1.2a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z",fill:"#4E5969"})}),Q8=[()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{d:"M5.99358 8.85714C6.27231 8.85714 6.53962 8.97003 6.73671 9.17096C6.9338 9.37189 7.04453 9.64441 7.04453 9.92857V12.9286C7.04453 13.2127 6.9338 13.4853 6.73671 13.6862C6.53962 13.8871 6.27231 14 5.99358 14H3.05094L2.94375 13.9946C2.6849 13.9676 2.4451 13.8436 2.27076 13.6467C2.09642 13.4497 1.99994 13.1939 2 12.9286V9.92857C1.99994 9.66329 2.09642 9.40742 2.27076 9.21049C2.4451 9.01355 2.6849 8.88956 2.94375 8.8625L3.05094 8.85714H5.99358ZM11.0087 8.74571C11.0323 8.68643 11.0727 8.63567 11.1247 8.59993C11.1768 8.5642 11.2381 8.54511 11.3008 8.54511C11.3636 8.54511 11.4249 8.5642 11.477 8.59993C11.529 8.63567 11.5694 8.68643 11.593 8.74571L12.1521 10.1675C12.168 10.2079 12.1917 10.2446 12.2219 10.2753C12.252 10.3061 12.288 10.3303 12.3276 10.3464L13.8021 10.9486C13.8585 10.9716 13.9072 11.0109 13.9423 11.0615C13.9773 11.1121 13.9973 11.172 13.9997 11.234C14.0022 11.2959 13.987 11.3572 13.956 11.4106C13.9251 11.4639 13.8796 11.507 13.8252 11.5346L12.3024 12.3104C12.2369 12.3438 12.1849 12.3995 12.1553 12.4679L11.5888 13.7675C11.564 13.8242 11.5236 13.8724 11.4725 13.9062C11.4214 13.94 11.3618 13.958 11.3008 13.958C11.2399 13.958 11.1803 13.94 11.1292 13.9062C11.0781 13.8724 11.0377 13.8242 11.0129 13.7675L10.4454 12.4679C10.4158 12.3995 10.3638 12.3438 10.2982 12.3104L8.77753 11.5357C8.7231 11.5081 8.67767 11.465 8.6467 11.4117C8.61574 11.3583 8.60056 11.297 8.603 11.235C8.60545 11.1731 8.62541 11.1132 8.66047 11.0626C8.69554 11.0119 8.74422 10.9727 8.80065 10.9496L10.2751 10.3475C10.3147 10.3313 10.3507 10.3071 10.3809 10.2764C10.411 10.2456 10.4348 10.209 10.4506 10.1686L11.0097 8.74679L11.0087 8.74571ZM3.05094 12.9286H5.99358V9.92857H3.05094V12.9286ZM5.99358 2C6.57371 2 7.04453 2.48 7.04453 3.07143V6.07143C7.04453 6.35559 6.9338 6.62811 6.73671 6.82904C6.53962 7.02997 6.27231 7.14286 5.99358 7.14286H3.05094L2.94375 7.1375C2.6849 7.11044 2.4451 6.98644 2.27076 6.78951C2.09642 6.59258 1.99994 6.33671 2 6.07143V3.07143C1.99994 2.80615 2.09642 2.55028 2.27076 2.35335C2.4451 2.15641 2.6849 2.03242 2.94375 2.00536L3.05094 2H5.99358ZM12.7196 2C12.9984 2 13.2657 2.11288 13.4628 2.31381C13.6598 2.51475 13.7706 2.78727 13.7706 3.07143V6.07143C13.7706 6.35559 13.6598 6.62811 13.4628 6.82904C13.2657 7.02997 12.9984 7.14286 12.7196 7.14286H9.77698L9.66873 7.1375C9.41016 7.10996 9.17075 6.98579 8.99668 6.78893C8.8226 6.59207 8.72619 6.33647 8.72604 6.07143V3.07143C8.72596 2.80632 8.82228 2.55059 8.99641 2.35368C9.17053 2.15677 9.41007 2.03266 9.66873 2.00536L9.77698 2H12.7196ZM9.77698 6.07143H12.7196V3.07143H9.77698V6.07143ZM3.05094 6.07143H5.99358V3.07143H3.05094V6.07143Z",fill:"currentColor"})}),()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[b.jsx("path",{d:"M12.6358 2.44435C12.8831 2.19815 13.2831 2.199 13.5293 2.44624C13.7755 2.69349 13.7746 3.0935 13.5274 3.33968L3.31858 13.5054C3.07133 13.7516 2.67132 13.7508 2.42513 13.5035C2.17893 13.2563 2.17977 12.8563 2.42701 12.6101L12.6358 2.44435Z",fill:"currentColor"}),b.jsx("path",{d:"M5.27212 5.97815L4.9117 7.22356C4.85382 7.42362 4.64471 7.53887 4.44466 7.48097C4.38352 7.46327 4.32785 7.43039 4.28284 7.38538C4.23783 7.34037 4.20495 7.2847 4.18726 7.22356L3.82686 5.97814C3.76198 5.75394 3.64142 5.54982 3.47639 5.38478C3.31136 5.21975 3.10723 5.09917 2.88304 5.03429L1.6376 4.67391C1.43755 4.61602 1.3223 4.40692 1.3802 4.20687C1.39789 4.14573 1.43077 4.09006 1.47578 4.04505C1.52079 4.00004 1.57646 3.96716 1.6376 3.94946L2.88303 3.58908C3.10722 3.5242 3.31135 3.40363 3.47638 3.23859C3.64141 3.07356 3.76198 2.86943 3.82686 2.64523L4.18726 1.39981C4.24514 1.19975 4.45425 1.08451 4.65429 1.1424C4.71544 1.1601 4.77111 1.19298 4.81612 1.23799C4.86112 1.283 4.89401 1.33867 4.9117 1.39981L5.27209 2.64523C5.33696 2.86943 5.45753 3.07356 5.62257 3.2386C5.7876 3.40363 5.99173 3.5242 6.21593 3.58908L7.46135 3.94946C7.66141 4.00735 7.77666 4.21646 7.71876 4.4165C7.70107 4.47764 7.66818 4.53331 7.62318 4.57832C7.57817 4.62333 7.5225 4.65621 7.46135 4.67391L6.21593 5.03429C5.99173 5.09917 5.7876 5.21974 5.62257 5.38478C5.45753 5.54981 5.33696 5.75394 5.27209 5.97814L5.27212 5.97815ZM12.4587 10.7095L12.3937 10.934C12.3494 11.0869 12.1896 11.175 12.0368 11.1308C11.99 11.1172 11.9475 11.0921 11.9131 11.0577C11.8787 11.0233 11.8536 10.9808 11.8401 10.934L11.7751 10.7095C11.7102 10.4853 11.5896 10.2811 11.4246 10.1161C11.2596 9.95108 11.0554 9.83051 10.8312 9.76564L10.6067 9.70065C10.4538 9.65642 10.3657 9.49662 10.41 9.34376C10.4235 9.29703 10.4486 9.25448 10.483 9.22009C10.5174 9.18569 10.5599 9.16056 10.6067 9.14704L10.8312 9.08206C11.0554 9.01718 11.2596 8.89661 11.4246 8.73158C11.5896 8.56655 11.7102 8.36242 11.7751 8.13823L11.8401 7.91366C11.8843 7.76078 12.0441 7.67272 12.197 7.71694C12.2437 7.73046 12.2862 7.75559 12.3206 7.78999C12.355 7.82439 12.3801 7.86693 12.3937 7.91366L12.4587 8.13823C12.5235 8.36242 12.6441 8.56655 12.8091 8.73158C12.9742 8.89661 13.1783 9.01718 13.4025 9.08206L13.6271 9.14704C13.7799 9.19129 13.868 9.35108 13.8238 9.50394C13.8102 9.55067 13.7851 9.59321 13.7507 9.62761C13.7163 9.662 13.6738 9.68713 13.6271 9.70065L13.4025 9.76564C13.1783 9.83051 12.9742 9.95108 12.8091 10.1161C12.6441 10.2811 12.5235 10.4853 12.4587 10.7095ZM8.73493 13.6947L8.66994 13.9193C8.6257 14.0722 8.46591 14.1602 8.31305 14.116C8.26632 14.1025 8.22378 14.0774 8.18938 14.043C8.15498 14.0086 8.12986 13.966 8.11634 13.9193L8.05135 13.6947C7.98647 13.4705 7.8659 13.2664 7.70087 13.1014C7.53584 12.9363 7.33171 12.8158 7.10752 12.7509L6.88295 12.6859C6.73007 12.6417 6.64201 12.4819 6.68624 12.329C6.69976 12.2823 6.72489 12.2397 6.75928 12.2054C6.79368 12.171 6.83622 12.1458 6.88295 12.1323L7.10752 12.0673C7.33171 12.0024 7.53584 11.8819 7.70087 11.7168C7.8659 11.5518 7.98647 11.3477 8.05135 11.1235L8.11634 10.8989C8.16058 10.746 8.32037 10.658 8.47323 10.7022C8.51996 10.7157 8.5625 10.7409 8.5969 10.7753C8.6313 10.8097 8.65642 10.8522 8.66994 10.8989L8.73493 11.1235C8.7998 11.3477 8.92037 11.5518 9.08541 11.7168C9.25044 11.8819 9.45456 12.0024 9.67876 12.0673L9.90333 12.1323C10.0562 12.1766 10.1443 12.3363 10.1 12.4892C10.0865 12.5359 10.0614 12.5785 10.027 12.6129C9.9926 12.6473 9.95006 12.6724 9.90333 12.6859L9.67876 12.7509C9.45456 12.8158 9.25044 12.9363 9.08541 13.1014C8.92037 13.2664 8.7998 13.4705 8.73493 13.6947Z",fill:"currentColor"})]}),()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[b.jsx("path",{d:"M12.2 1.69995H3.8C3.2201 1.69995 2.75 2.17467 2.75 2.76025V13.3632C2.75 13.3754 2.75021 13.3875 2.75061 13.3996C2.76856 13.9361 3.21367 14.2996 3.68722 14.2996C3.86807 14.2996 4.05311 14.2465 4.22003 14.1298L7.39764 11.9084C7.5726 11.7858 7.78102 11.72 7.99466 11.7198C8.2083 11.7197 8.4168 11.7853 8.59191 11.9077L11.7803 14.1308C11.9471 14.2471 12.1318 14.3 12.3124 14.3C12.7861 14.3 13.2314 13.9362 13.2494 13.3996C13.2498 13.3875 13.25 13.3754 13.25 13.3632V2.76025C13.25 2.17467 12.7799 1.69995 12.2 1.69995ZM12.2 13.1434L9.19248 11.0464C8.83927 10.8001 8.42531 10.6699 7.99537 10.6699C7.56449 10.6698 7.14976 10.8005 6.79602 11.0478L3.8 13.1423V2.76025C3.8 2.75802 3.8 2.75322 3.80289 2.74995H12.1971C12.2 2.75322 12.2 2.75801 12.2 2.76025V13.1434Z",fill:"currentColor"}),b.jsx("path",{d:"M10.4117 6.27223H8.52499V4.36187C8.52499 4.07192 8.28994 3.83687 7.99999 3.83687C7.71004 3.83687 7.47499 4.07192 7.47499 4.36187V6.27223H5.58828C5.29833 6.27223 5.06328 6.50728 5.06328 6.79723V6.80751C5.06328 7.09746 5.29833 7.33251 5.58828 7.33251H7.47499V9.24287C7.47499 9.53282 7.71004 9.76787 7.99999 9.76787C8.28994 9.76787 8.52499 9.53282 8.52499 9.24287V7.33251H10.4117C10.7017 7.33251 10.9367 7.09746 10.9367 6.80751V6.79723C10.9367 6.50728 10.7017 6.27223 10.4117 6.27223Z",fill:"currentColor"})]}),()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[b.jsx("path",{d:"M11.8231 2.3562H4.19204C3.60373 2.36812 3.04399 2.61212 2.63483 3.03501C2.22567 3.4579 2.00026 4.02539 2.00775 4.61377V9.14983C2.00026 9.73821 2.22567 10.3057 2.63483 10.7286C3.04399 11.1515 3.60373 11.3955 4.19204 11.4074H11.8231C12.4114 11.3955 12.9711 11.1515 13.3803 10.7286C13.7895 10.3057 14.0149 9.73821 14.0074 9.14983V4.61377C14.0149 4.02539 13.7895 3.4579 13.3803 3.03501C12.9711 2.61212 12.4114 2.36812 11.8231 2.3562ZM12.9152 9.12192C12.9176 9.26764 12.8911 9.41238 12.8375 9.54789C12.7839 9.6834 12.704 9.80701 12.6026 9.91167C12.5012 10.0163 12.3802 10.1 12.2464 10.1579C12.1127 10.2157 11.9688 10.2467 11.8231 10.249H4.19204C3.89804 10.2434 3.61817 10.1218 3.41354 9.91067C3.20891 9.6995 3.09616 9.41594 3.09989 9.12192V4.61377C3.09759 4.46822 3.12403 4.32364 3.17771 4.18833C3.23139 4.05303 3.31126 3.92964 3.41272 3.82526C3.51418 3.72088 3.63525 3.63756 3.76898 3.58006C3.90272 3.52257 4.04648 3.49204 4.19204 3.49022H11.8231C12.1165 3.49572 12.3958 3.61686 12.6004 3.82727C12.8049 4.03768 12.9181 4.32034 12.9152 4.61377V9.12192Z",fill:"currentColor"}),b.jsx("path",{d:"M11.0091 13.6431H5.01099C4.862 13.6431 4.71911 13.5839 4.61376 13.4785C4.50841 13.3732 4.44922 13.2303 4.44922 13.0813C4.44922 12.9323 4.50841 12.7894 4.61376 12.6841C4.71911 12.5787 4.862 12.5195 5.01099 12.5195H11.0091C11.1581 12.5195 11.3009 12.5787 11.4063 12.6841C11.5117 12.7894 11.5708 12.9323 11.5708 13.0813C11.5708 13.2303 11.5117 13.3732 11.4063 13.4785C11.3009 13.5839 11.1581 13.6431 11.0091 13.6431Z",fill:"currentColor"})]})],X8=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[b.jsx("path",{d:"M14.365 4.88313C13.9832 4.88313 13.7286 5.13768 13.7286 5.51949V12.9649C13.7286 13.4104 13.4104 13.7286 12.965 13.7286H3.03771C2.59225 13.7286 2.27407 13.4104 2.27407 12.9649V3.03768C2.27407 2.59222 2.59225 2.27404 3.03771 2.27404H6.66498C7.0468 2.27404 7.30134 2.01949 7.30134 1.63768C7.30134 1.25586 7.0468 1.00131 6.66498 1.00131H3.03771C1.89225 1.00131 1.00134 1.89222 1.00134 3.03768V12.9649C1.00134 14.1104 1.89225 15.0013 3.03771 15.0013H12.965C14.1104 15.0013 15.0013 14.1104 15.0013 12.9649V5.51949C15.0013 5.20131 14.7468 4.88313 14.365 4.88313Z",fill:"#666666"}),b.jsx("path",{d:"M5.2637 7.55586C5.00916 7.30131 4.62734 7.30131 4.37279 7.55586C4.11825 7.8104 4.11825 8.19222 4.37279 8.44677L7.55461 11.6286C7.61825 11.6922 7.68188 11.7559 7.74552 11.7559C7.80916 11.8195 7.93643 11.8195 8.00007 11.8195C8.0637 11.8195 8.19098 11.8195 8.25461 11.7559C8.31825 11.6922 8.38188 11.6922 8.44552 11.6286L11.6273 8.44677C11.8819 8.19222 11.8819 7.8104 11.6273 7.55586C11.3728 7.30131 10.991 7.30131 10.7364 7.55586L8.63643 9.65586V8.00131C8.63643 4.81949 11.1819 2.27404 14.3637 2.27404C14.7455 2.27404 15.0001 2.01949 15.0001 1.63768C15.0001 1.25586 14.7455 1.00131 14.3637 1.00131C10.4819 1.00131 7.3637 4.11949 7.3637 8.00131V9.65586L5.2637 7.55586Z",fill:"#666666"})]}),J8=()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:b.jsx("path",{d:"M9.60187 14.5546C9.23569 14.5546 8.94275 14.4081 8.6498 14.1884C8.35686 13.8955 8.13716 13.5293 8.13716 13.0899V11.6251C6.52597 11.6251 3.88948 12.0646 2.49801 13.9687C2.2783 14.3349 1.76565 14.5546 1.32623 14.6278H1.10653C0.374166 14.4813 -0.0652517 13.8222 0.00799105 13.0899C0.374166 9.94073 1.47272 7.67041 3.37683 6.13247C4.76831 5.03394 6.3795 4.44805 8.13716 4.30157V2.9101C8.13716 2.25098 8.4301 1.66509 9.01599 1.44538C9.52864 1.29892 10.1145 1.37215 10.5539 1.81157L15.241 6.57189C15.6072 6.86484 15.8269 7.30424 15.9001 7.81689C15.9734 8.32955 15.8269 8.8422 15.4607 9.20837C15.3875 9.28161 15.3143 9.42807 15.1678 9.50132L10.6272 14.1152C10.3342 14.4081 9.96804 14.5546 9.60187 14.5546ZM8.43009 10.1604H9.60187V13.0899L14.2157 8.32955L14.289 8.25631C14.3622 8.18308 14.3622 8.0366 14.3622 7.96336C14.3622 7.81689 14.289 7.74366 14.2157 7.67041L14.1425 7.59718L9.52864 2.9101V5.69306L8.50333 5.7663C6.96539 5.7663 5.50066 6.27894 4.25567 7.23101C2.79094 8.40278 1.83889 10.3069 1.54595 12.7969C3.37683 10.5266 6.5992 10.1604 8.43009 10.1604Z",fill:"currentColor"})}),Z8=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("path",{d:"M13.85 7.35C13.4903 7.35 13.2 7.64033 13.2 8V12.3333C13.2 12.8114 12.8114 13.2 12.3333 13.2H3.66667C3.18856 13.2 2.8 12.8114 2.8 12.3333V3.66667C2.8 3.18856 3.18856 2.8 3.66667 2.8H8C8.35967 2.8 8.65 2.50967 8.65 2.15C8.65 1.79033 8.35967 1.5 8 1.5H3.23333C2.27567 1.5 1.5 2.27567 1.5 3.23333V12.7667C1.5 13.7243 2.27567 14.5 3.23333 14.5H12.7667C13.7243 14.5 14.5 13.7243 14.5 12.7667V8C14.5 7.64033 14.2097 7.35 13.85 7.35Z",fill:"currentColor"}),b.jsx("path",{d:"M5.7483 10.4682C6.00108 10.721 6.41419 10.721 6.66697 10.4682L13.7144 3.42075C13.9672 3.16797 13.9672 2.75486 13.7144 2.50208C13.4616 2.24931 13.0485 2.24931 12.7957 2.50208L5.7483 9.54808C5.49552 9.80086 5.49552 10.2154 5.7483 10.4682Z",fill:"currentColor"})]}),eA=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("path",{d:"M4.12488 5.02012H11.8779L11.1331 12.6138C11.1164 12.7828 11.0373 12.9396 10.9114 13.0536C10.7855 13.1676 10.6217 13.2307 10.4518 13.2306H5.55096C5.38127 13.2304 5.21769 13.1672 5.09198 13.0533C4.96627 12.9393 4.88739 12.7827 4.87067 12.6138L4.12488 5.02012ZM3.80233 3.74945C3.66582 3.74934 3.53081 3.77782 3.40598 3.83306C3.28116 3.8883 3.16929 3.96908 3.07757 4.07018C2.98586 4.17128 2.91634 4.29048 2.8735 4.42008C2.83065 4.54969 2.81542 4.68683 2.8288 4.82268L3.60586 12.738C3.65342 13.2208 3.87886 13.6688 4.23837 13.9947C4.59787 14.3206 5.06573 14.5012 5.55096 14.5012H10.4518C10.9371 14.5012 11.4049 14.3206 11.7644 13.9947C12.1239 13.6688 12.3494 13.2208 12.3969 12.738L13.175 4.82268C13.1883 4.68683 13.1731 4.54969 13.1303 4.42008C13.0874 4.29048 13.0179 4.17128 12.9262 4.07018C12.8345 3.96908 12.7226 3.8883 12.5978 3.83306C12.4729 3.77782 12.3379 3.74934 12.2014 3.74945H3.80135H3.80233Z",fill:"currentColor"}),b.jsx("path",{d:"M1.5 4.28322C1.5 4.11472 1.56694 3.95312 1.68608 3.83397C1.80523 3.71482 1.96683 3.64789 2.13533 3.64789H13.8646C13.948 3.64787 14.0306 3.6643 14.1077 3.69622C14.1848 3.72814 14.2549 3.77494 14.3139 3.83394C14.3729 3.89293 14.4197 3.96298 14.4516 4.04007C14.4836 4.11715 14.5 4.19978 14.5 4.28322C14.5 4.36666 14.4836 4.44929 14.4516 4.52638C14.4197 4.60347 14.3729 4.67351 14.3139 4.73251C14.2549 4.7915 14.1848 4.8383 14.1077 4.87022C14.0306 4.90214 13.948 4.91857 13.8646 4.91855H2.13533C1.96683 4.91855 1.80523 4.85162 1.68608 4.73247C1.56694 4.61332 1.5 4.45172 1.5 4.28322Z",fill:"currentColor"}),b.jsx("path",{d:"M5.02081 3.11277C5.02081 2.22135 5.74314 1.5 6.63358 1.5H9.3704C10.2618 1.5 10.9832 2.22135 10.9832 3.11277V4.92102H5.02081V3.11277ZM6.63358 2.77067C6.58866 2.77067 6.54417 2.77952 6.50266 2.79671C6.46116 2.8139 6.42345 2.8391 6.39168 2.87087C6.35991 2.90263 6.33471 2.94035 6.31752 2.98185C6.30033 3.02336 6.29148 3.06784 6.29148 3.11277V3.65036H9.7125V3.11277C9.7125 3.06784 9.70366 3.02336 9.68646 2.98185C9.66927 2.94035 9.64407 2.90263 9.61231 2.87087C9.58054 2.8391 9.54282 2.8139 9.50132 2.79671C9.45981 2.77952 9.41533 2.77067 9.3704 2.77067H6.63358Z",fill:"currentColor"})]}),tA=()=>b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{d:"M8.87301 3.52364C9.08579 3.52364 9.28984 3.60817 9.4403 3.75862C9.59075 3.90907 9.67527 4.11313 9.67527 4.3259V11.8137C9.67527 12.0265 9.59075 12.2305 9.4403 12.381C9.28984 12.5314 9.08579 12.6159 8.87301 12.6159H2.98976C2.88441 12.6159 2.78008 12.5952 2.68275 12.5549C2.58541 12.5146 2.49697 12.4555 2.42248 12.381C2.34798 12.3065 2.28889 12.218 2.24857 12.1207C2.20825 12.0234 2.1875 11.919 2.1875 11.8137V4.3259C2.1875 4.11313 2.27202 3.90907 2.42248 3.75862C2.57293 3.60817 2.77699 3.52364 2.98976 3.52364H8.87301ZM8.60559 4.59332H3.25718V11.5463H8.60559V4.59332ZM11.0102 1.38428C11.2098 1.38415 11.4022 1.45838 11.5499 1.59248C11.6977 1.72658 11.7901 1.91092 11.8093 2.10952L11.8125 2.18654V9.40315C11.8123 9.53947 11.7601 9.67059 11.6666 9.76971C11.573 9.86884 11.4451 9.92849 11.309 9.93648C11.1729 9.94447 11.0389 9.90019 10.9344 9.8127C10.8298 9.7252 10.7627 9.60109 10.7466 9.46573L10.7428 9.40315V2.45396H5.39655C5.26555 2.45394 5.13911 2.40585 5.04121 2.3188C4.94332 2.23175 4.88078 2.1118 4.86545 1.9817L4.86171 1.91912C4.86172 1.78812 4.90982 1.66168 4.99687 1.56379C5.08392 1.46589 5.20387 1.40335 5.33397 1.38802L5.39655 1.38428H11.0102Z",fill:"currentColor"})}),nA=()=>b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{d:"M1.5548 5.88011C1.4304 5.76419 1.26586 5.70108 1.09584 5.70408C0.925831 5.70708 0.76362 5.77595 0.643383 5.89619C0.523147 6.01643 0.454274 6.17864 0.451274 6.34865C0.448274 6.51867 0.511382 6.68321 0.627302 6.80761L5.0023 11.1826C5.12535 11.3055 5.29215 11.3745 5.46605 11.3745C5.63996 11.3745 5.80676 11.3055 5.9298 11.1826L13.3673 3.74511C13.4832 3.62071 13.5463 3.45617 13.5433 3.28615C13.5403 3.11614 13.4715 2.95393 13.3512 2.83369C13.231 2.71345 13.0688 2.64458 12.8988 2.64158C12.7287 2.63858 12.5642 2.70169 12.4398 2.81761L5.46605 9.79049L1.5548 5.87923V5.88011Z",fill:"currentColor"})}),rA=()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{d:"M9.60188 14.5546C9.23571 14.5546 8.94276 14.4081 8.64982 14.1884C8.35687 13.8955 8.13717 13.5293 8.13717 13.0899V11.6251C6.52599 11.6251 3.88949 12.0646 2.49803 13.9687C2.27831 14.3349 1.76566 14.5546 1.32625 14.6278H1.10654C0.374181 14.4813 -0.0652364 13.8222 0.00800631 13.0899C0.374181 9.94073 1.47273 7.67041 3.37685 6.13247C4.76833 5.03394 6.37951 4.44805 8.13717 4.30157V2.9101C8.13717 2.25098 8.43012 1.66509 9.01601 1.44538C9.52865 1.29892 10.1145 1.37215 10.5539 1.81157L15.241 6.57189C15.6072 6.86484 15.8269 7.30424 15.9002 7.81689C15.9734 8.32955 15.8269 8.8422 15.4607 9.20837C15.3875 9.28161 15.3143 9.42807 15.1678 9.50132L10.6272 14.1152C10.3342 14.4081 9.96806 14.5546 9.60188 14.5546ZM8.4301 10.1604H9.60188V13.0899L14.2157 8.32955L14.289 8.25631C14.3622 8.18308 14.3622 8.0366 14.3622 7.96336C14.3622 7.81689 14.289 7.74366 14.2157 7.67041L14.1425 7.59718L9.52865 2.9101V5.69306L8.50335 5.7663C6.9654 5.7663 5.50068 6.27894 4.25568 7.23101C2.79096 8.40278 1.83891 10.3069 1.54596 12.7969C3.37685 10.5266 6.59922 10.1604 8.4301 10.1604Z",fill:"#7C3AED"})}),lA=({code:e})=>{const{message:t}=se.App.useApp(),[n,r]=v.useState(!1),l=async a=>{a.stopPropagation();try{await navigator.clipboard.writeText(e),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{t.error("复制失败")}};return b.jsxs("div",{className:"rte-skill-share",onClick:a=>a.stopPropagation(),children:[b.jsxs("div",{className:"rte-skill-share-head",children:[b.jsxs("div",{className:"rte-skill-share-title",children:[b.jsx(rA,{}),b.jsx("span",{children:"分享码"})]}),b.jsx("span",{className:"rte-skill-share-hint",children:"复制后粘贴在「导入技能」即可使用"})]}),b.jsxs("div",{className:"rte-skill-share-box",children:[b.jsx("span",{className:"rte-skill-share-code",children:e}),b.jsxs("button",{type:"button",className:`rte-skill-share-copy${n?" rte-skill-share-copy-done":""}`,onClick:l,children:[n?b.jsx(nA,{}):b.jsx(tA,{}),b.jsx("span",{children:n?"已复制":"复制"})]})]})]})},aA=({card:e,selected:t,onClick:n,onShare:r,onEdit:l,onDelete:a,onUse:i,getPopupContainer:s})=>{const o=I=>I.stopPropagation(),[u,c,d]=Eb(),[h,f,m]=Eb("height"),[y,g]=v.useState(!1),[E,N]=v.useState(""),[A,P]=v.useState(!1),L=y||A,S=async I=>{if(g(I),!I){N("");return}try{const w=await r();N(typeof w=="string"&&w?w:`SK-${e.id}`)}catch{N(`SK-${e.id}`)}};return b.jsxs("div",{className:`rte-skill-card${t?" rte-skill-card-selected":""}${L?" rte-skill-card-pinned":""}`,onClick:n,"data-rte-skill-card":"true","aria-pressed":t,children:[b.jsxs("div",{className:"rte-skill-card-header",children:[b.jsx(zn,{title:c?e.title:"",placement:"top",mouseEnterDelay:.3,getPopupContainer:s,zIndex:1e4,children:b.jsx("div",{className:"rte-skill-card-title",ref:u,onMouseEnter:d,children:e.title})}),b.jsxs("div",{className:`rte-skill-card-aside${L?" rte-skill-card-aside-pinned":""}`,children:[b.jsx("span",{className:`rte-skill-card-badge rte-skill-card-badge-${e.badge}`,children:Y8[e.badge]}),b.jsxs("div",{className:`rte-skill-card-actions${L?" rte-skill-card-actions-pinned":""}`,children:[e.badge==="mine"&&b.jsx(se.Popover,{open:y,onOpenChange:S,trigger:"click",placement:"bottomRight",arrow:!1,overlayClassName:"rte-skill-share-popover",zIndex:1e4,getPopupContainer:s,content:b.jsx(lA,{code:E}),children:b.jsx("button",{type:"button",className:`rte-skill-card-action${y?" rte-skill-card-action-active":""}`,title:"分享","aria-label":"分享",onClick:o,children:b.jsx(J8,{})})}),e.badge==="mine"&&b.jsx("button",{type:"button",className:"rte-skill-card-action",title:"编辑","aria-label":"编辑",onClick:I=>{o(I),l()},children:b.jsx(Z8,{})}),e.badge!=="mine"&&b.jsx("button",{type:"button",className:"rte-skill-card-action",title:"查看详情","aria-label":"查看详情",onClick:I=>{o(I),l()},children:b.jsx("i",{className:"iconfont icon-chakanjinengxiangqing"})}),e.badge!=="system"&&b.jsx(se.Popconfirm,{title:"删除技能后不可恢复,确认删除吗?",open:A,onOpenChange:P,okText:"确认",cancelText:"取消",placement:"bottomRight",arrow:!1,overlayClassName:"rte-skill-delete-confirm",zIndex:1e4,icon:b.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.5 9C1.5 4.85786 4.85786 1.5 9 1.5C13.1421 1.5 16.5 4.85786 16.5 9C16.5 13.1421 13.1421 16.5 9 16.5C4.85786 16.5 1.5 13.1421 1.5 9ZM8.25 11.25V12.75H9.75V11.25H8.25ZM9.75 10.5L9.75 5.25H8.25L8.25 10.5H9.75Z",fill:"#F53F3F"})}),okButtonProps:{danger:!0},getPopupContainer:s,onConfirm:I=>{I?.stopPropagation(),P(!1),a()},onCancel:I=>{I?.stopPropagation(),P(!1)},children:b.jsx("button",{type:"button",className:`rte-skill-card-action rte-skill-card-action-delete${A?" rte-skill-card-action-active":""}`,title:"删除","aria-label":"删除",onClick:o,children:b.jsx(eA,{})})})]})]})]}),b.jsx(zn,{title:f?e.desc:"",placement:"top",mouseEnterDelay:.3,getPopupContainer:s,zIndex:1e4,children:b.jsx("div",{className:"rte-skill-card-desc",ref:h,onMouseEnter:m,children:e.desc})})]})},Tb=v.memo(({selectedId:e,onSelect:t,onCardClick:n,onAction:r,skillListFetch:l,onHeaderAction:a,showCreateSkill:i=!0,createDisabled:s})=>{const{message:o}=se.App.useApp(),[u,c]=v.useState(0),[d,h]=v.useState(l?[]:j8),[f,m]=v.useState(!1),[y,g]=v.useState(!!l),E=v.useRef(0),N=v.useCallback(()=>{g(!0),E.current=window.setTimeout(()=>{g(!1),m(!0)},300)},[]),A=v.useCallback(()=>{window.clearTimeout(E.current),g(!1),m(!1)},[]),[P,L]=v.useState(""),[S,I]=v.useState(""),w=_r(),k=w?()=>w:void 0,M=v.useRef(0),_=v.useRef(null),H=v.useRef(0),$=v.useRef(0),F=v.useCallback(()=>{const C=_.current;C&&(C.classList.add("is-scrolling"),window.clearTimeout($.current),$.current=window.setTimeout(()=>{C.classList.remove("is-scrolling")},300))},[]);v.useEffect(()=>{const C=window.setTimeout(()=>I(P.trim()),300);return()=>window.clearTimeout(C)},[P]);const T=v.useCallback(async()=>{if(!l)return;const C=++M.current;N();try{const Z=await l({skillType:q8[u],pageIndex:1,pageSize:W8,keyword:S||void 0});if(C!==M.current)return;h(Z.map(G8))}catch{C===M.current&&o.error("技能列表加载失败")}finally{C===M.current&&A()}},[l,u,S,N,A]);v.useEffect(()=>{T()},[T]),v.useEffect(()=>{_.current?.scrollTo({top:0})},[u,S]);const[R,z]=v.useState(!1);v.useLayoutEffect(()=>{if(u===0&&!f&&d.length>0){const C=_.current;C&&(H.current=C.clientHeight),z(!1)}else!f&&d.length>0&&H.current>0?requestAnimationFrame(()=>{const C=_.current;C&&z(C.scrollHeight<H.current)}):z(!1)},[u,f,d]);const q=C=>{n?.({id:C.id,title:C.title}),t?.({id:C.id,title:C.title,desc:C.desc||void 0,usageInstruction:C.usageInstruction})},G=async C=>{try{await r?.("delete",{id:C.id,title:C.title})}catch{o.error("删除失败");return}e===C.id&&t?.(null),l?await T():h(Z=>Z.filter(re=>re.id!==C.id)),o.success("已删除技能")};return b.jsxs("div",{className:"rte-skill-panel",children:[b.jsxs("div",{className:"rte-skill-panel-header",children:[b.jsxs("div",{className:"rte-skill-search",children:[b.jsx("input",{className:"rte-skill-search-input",placeholder:"请输入想搜索的技能名称或描述",value:P,onChange:C=>L(C.target.value)}),b.jsx("span",{className:"rte-skill-search-icon",children:b.jsx(K8,{})})]}),b.jsxs("div",{className:"rte-skill-actions",children:[b.jsxs("button",{type:"button",className:"rte-skill-import-btn",onClick:()=>a?.("import"),children:[b.jsx(X8,{}),b.jsx("span",{children:"导入技能"})]}),i&&b.jsxs("button",{type:"button",className:`rte-skill-create-btn${s?" rte-skill-create-btn-disabled":""}`,disabled:s,onClick:()=>!s&&a?.("create"),children:[b.jsx("i",{className:"iconfont icon-jiyudangqianduihuachuangjianjineng"}),b.jsx("span",{children:"基于当前会话创建技能"})]})]})]}),b.jsxs("div",{className:"rte-skill-panel-body",children:[b.jsx("div",{className:"rte-skill-sidebar",children:$8.map((C,Z)=>{const re=Q8[Z];return b.jsxs("div",{className:`rte-skill-sidebar-item${Z===u?" rte-skill-sidebar-item-active":""}`,onClick:()=>c(Z),children:[b.jsx(re,{}),b.jsx("span",{children:C})]},C)})}),f?b.jsx("div",{className:"rte-skill-cards-status",style:H.current?{minHeight:H.current}:void 0,children:b.jsx(se.Spin,{})}):d.length===0?b.jsx("div",{className:"rte-skill-cards-status",style:H.current?{minHeight:H.current}:void 0,children:!y&&b.jsxs(b.Fragment,{children:[b.jsx("img",{className:"rte-skill-empty-img",src:"https://sealseek-public-read.oss-cn-hangzhou.aliyuncs.com/file/website/kongzhuangtai.svg",alt:"暂无数据"}),b.jsx("span",{className:"rte-skill-empty-text",children:"暂无技能"})]})}):b.jsxs("div",{className:"rte-skill-cards",ref:_,onScroll:F,style:u!==0&&H.current?{minHeight:H.current}:void 0,children:[d.map(C=>b.jsx(aA,{card:C,selected:e===C.id,onClick:()=>q(C),onShare:()=>r?.("share",{id:C.id,title:C.title}),onEdit:()=>r?.("edit",{id:C.id,title:C.title}),onDelete:()=>G(C),onUse:()=>t?.({id:C.id,title:C.title,desc:C.desc||void 0,usageInstruction:C.usageInstruction}),getPopupContainer:k},C.id)),R&&b.jsx("div",{className:"rte-skill-cards-end",children:"暂无更多技能~"})]})]})]})});Tb.displayName="SkillPanel";const Ei=4,Cb=()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{d:"M10.4103 0.600098C11.2711 0.600098 11.9863 1.2657 11.9863 2.1081C11.9863 2.2985 11.9479 2.4873 11.8751 2.6641L10.9119 4.9921H12.6255C13.4455 4.9921 14.1327 5.5961 14.1959 6.3817L14.2007 6.5009C14.2007 6.8905 14.0431 7.2641 13.7639 7.5433L6.28226 15.0321C6.05292 15.2576 5.74735 15.3888 5.42594 15.3999C5.10452 15.411 4.79062 15.3012 4.54626 15.0921C4.19986 14.7929 4.05346 14.3297 4.16706 13.9113L5.20146 9.4593H3.28146C2.63906 9.4593 2.09506 8.9873 2.03666 8.3649L2.03186 8.2537C2.03186 8.0993 2.06306 7.9457 2.12066 7.8073L4.67986 1.5513C4.92146 0.970498 5.50306 0.600098 6.14306 0.600098H10.4103ZM10.4103 1.8001H6.14386C5.97906 1.8001 5.83986 1.8889 5.78866 2.0105L3.23586 8.2521C3.24066 8.2521 3.24626 8.2537 3.25346 8.2553L3.28306 8.2585H5.55506C5.62866 8.2585 5.70146 8.2665 5.77186 8.2833C6.26786 8.4001 6.58466 8.8937 6.45506 9.3713L5.33506 14.1857L5.35586 14.1969C5.37426 14.2017 5.39586 14.2009 5.41266 14.1953L5.43426 14.1833L12.9151 6.6953C12.9414 6.67028 12.9625 6.64029 12.9772 6.60706C12.9919 6.57383 12.9999 6.53802 13.0007 6.5017C13.0007 6.3417 12.8415 6.1937 12.6247 6.1937H10.4887C10.3799 6.1937 10.2719 6.1745 10.1687 6.1377C10.0535 6.09806 9.94761 6.03536 9.85749 5.95342C9.76737 5.87149 9.6949 5.77204 9.64451 5.66115C9.59412 5.55026 9.56687 5.43027 9.56442 5.30849C9.56197 5.18672 9.58437 5.06572 9.63026 4.9529L10.7671 2.2049C10.7797 2.17445 10.7862 2.14184 10.7863 2.1089C10.7863 1.9481 10.6279 1.8001 10.4111 1.8001H10.4103ZM7.10386 2.6433C7.25151 2.70252 7.3696 2.81796 7.43215 2.96423C7.49471 3.1105 7.49662 3.27562 7.43746 3.4233L6.79746 5.0233C6.73604 5.16775 6.62045 5.28238 6.4755 5.34261C6.33054 5.40283 6.16775 5.40385 6.02205 5.34544C5.87635 5.28704 5.75934 5.17386 5.69612 5.03018C5.6329 4.88651 5.6285 4.72378 5.68386 4.5769L6.32386 2.9769C6.38308 2.82925 6.49852 2.71116 6.64479 2.6486C6.79106 2.58605 6.95618 2.58414 7.10386 2.6433Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"0.2"})}),Sb=v.memo(({disabled:e,selectedSkill:t,onSkillSelect:n,onSkillCardClick:r,onSkillAction:l,skillListFetch:a,onSkillHeaderAction:i,showCreateSkill:s,skillPanelOpen:o,onSkillPanelOpenChange:u,createDisabled:c,skillPanelOpenDelay:d})=>{const[h,f]=v.useState(!1),m=o!==void 0,[y,g]=v.useState(o??!1),E=v.useRef(0);v.useEffect(()=>{if(m)return o?d&&d>0?E.current=window.setTimeout(()=>g(!0),d):g(!0):(window.clearTimeout(E.current),g(!1)),()=>window.clearTimeout(E.current)},[m,o,d]);const N=m?y:h,A=v.useCallback(T=>{const R=typeof T=="function"?T(N):T;m||f(R),u?.(R)},[m,N,u]),[P,L]=v.useState(null),S=v.useRef(null),I=v.useRef(null),w=_r(),k=v.useCallback(()=>(S.current?.closest(".rich-text-editor")??S.current)?.getBoundingClientRect()??null,[]),M=v.useCallback(()=>{const T=k();if(!T)return;const R=Math.max(0,window.innerHeight-T.bottom-Ei*2),z=Math.max(0,T.top-Ei*2),G=(I.current?.scrollHeight??0)>R&&z>R,C=G?z:R,re=(I.current?.offsetParent??w)?.getBoundingClientRect(),D=re?.left??0,de=re?.top??0,me=T.left-D;if(G){const ce=(re?.height??window.innerHeight)-(T.top-Ei-de);L({left:me,bottom:ce,width:T.width,maxHeight:C})}else L({left:me,top:T.bottom+Ei-de,width:T.width,maxHeight:C})},[k,w]);v.useLayoutEffect(()=>{if(!N)return;M();const T=requestAnimationFrame(M);window.addEventListener("scroll",M,!0),window.addEventListener("resize",M);const R=I.current?new ResizeObserver(M):null;R&&I.current&&R.observe(I.current);const z=S.current?.closest(".rich-text-editor"),q=z?new ResizeObserver(M):null;return q&&z&&q.observe(z),()=>{cancelAnimationFrame(T),window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",M),R?.disconnect(),q?.disconnect()}},[N,M]),v.useEffect(()=>{if(!N||m)return;const T=R=>{const z=R.target;S.current?.contains(z)||I.current?.contains(z)||z instanceof Element&&z.closest(".rte-skill-delete-confirm, .rte-skill-share-popover")||A(!1)};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[N,m]);const _=v.useCallback(()=>{e||A(T=>!T)},[e]),H=v.useCallback(T=>{n?.(T),T&&A(!1)},[n]),$=!!t,F=`rte-skill-badge${$?" rte-skill-badge-selected":N?" rte-skill-badge-active":""}`;return b.jsxs(b.Fragment,{children:[b.jsxs("div",{ref:S,className:F,onClick:_,"data-rte-skill-button":"true","aria-pressed":N||$,style:{cursor:e?"not-allowed":"pointer"},children:[b.jsx(Cb,{}),b.jsx("span",{className:"rte-skill-text",children:"技能"}),(N||$)&&b.jsx("i",{className:"iconfont icon-guanbi rte-tool-close",role:"button","aria-label":"退出技能",onMouseDown:T=>{T.preventDefault(),T.stopPropagation()},onClick:T=>{T.preventDefault(),T.stopPropagation(),!e&&(A(!1),n?.(null))}})]}),N&&Li.createPortal(b.jsx("div",{ref:I,className:"rte-skill-panel-popup","data-placement":P?.bottom!==void 0?"top":"bottom",style:{position:"fixed",left:P?.left??0,top:P?.top,bottom:P?.bottom,width:P?.width,zIndex:9999,maxHeight:P?.maxHeight,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:16,visibility:P?"visible":"hidden"},children:b.jsx(Tb,{selectedId:t?.id??null,onSelect:H,onCardClick:r,onAction:l,skillListFetch:a,onHeaderAction:i,showCreateSkill:s,createDisabled:c})}),w??document.body)]})});Sb.displayName="SkillButton";const iA=10*1024*1024,sA=50*1024*1024,oA="图片大小不能超过 10MB",uA="文件总大小不能超过 50MB",cA=e=>e.type?.startsWith("image/")||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e.name||""),dA=(e,t)=>{let n=!1;const r=t.filter(o=>cA(o)&&o.size>iA?(n=!0,!1):!0),l=e.reduce((o,u)=>o+u.size,0),a=[];let i=l,s=!1;for(const o of r){if(i+o.size>sA){s=!0;break}a.push(o),i+=o.size}return{accepted:a,imageOversize:n,totalExceeded:s}},xb=v.memo(({files:e,onChange:t,disabled:n,onAssetLibraryClick:r})=>{const{message:l}=se.App.useApp(),a=v.useRef(null),[i,s]=v.useState(!1),o=v.useCallback(d=>{const h=Array.from(d.target.files??[]);if(d.target.value="",h.length===0)return;const{accepted:f,imageOversize:m,totalExceeded:y}=dA(e,h);m&&l.error(oA),y&&l.error(uA),f.length>0&&t([...e,...f])},[e,t,l]),u=v.useCallback(({key:d})=>{n||(s(!1),d==="upload"?a.current?.click():d==="asset-library"&&r?.())},[n,r]),c=[{key:"upload",label:"上传文件或图片",icon:b.jsx("i",{className:"iconfont icon-shangchuan1",style:{fontSize:"14px"}})},{key:"asset-library",label:"选择资产库文件",icon:b.jsx("i",{className:"iconfont icon-wenjianjia",style:{fontSize:"14px"}})}];return b.jsxs("div",{className:"rte-footer-upload",children:[b.jsx(se.Dropdown,{menu:{items:c,onClick:u},trigger:["click"],placement:"topLeft",disabled:n,open:i,onOpenChange:s,rootClassName:"rte-upload-dropdown-menu",children:b.jsx("div",{className:"rte-footer-upload-btn",title:"上传",style:{cursor:n?"not-allowed":"pointer",opacity:n?.6:1,pointerEvents:n?"none":"auto"},children:b.jsx("i",{className:"iconfont icon-jia",style:{fontSize:"16px"}})})}),b.jsx("input",{ref:a,type:"file",multiple:!0,style:{display:"none"},onChange:o})]})});xb.displayName="UploadButton";const fA=()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{d:"M12.0699 1.36475C13.3354 1.36475 14.3603 2.39083 14.3603 3.65507V7.92055C14.3603 8.10909 14.2854 8.28992 14.152 8.42324C14.0187 8.55656 13.8379 8.63146 13.6494 8.63146C13.4608 8.63146 13.28 8.55656 13.1467 8.42324C13.0133 8.28992 12.9384 8.10909 12.9384 7.92055V3.65507C12.9384 3.42473 12.8469 3.20382 12.6841 3.04095C12.5212 2.87807 12.3003 2.78657 12.0699 2.78657H2.59111C2.36077 2.78657 2.13986 2.87807 1.97698 3.04095C1.81411 3.20382 1.72261 3.42473 1.72261 3.65507V7.68121C2.56978 6.63735 3.37666 6.10417 4.20014 6.10417C5.39447 6.10417 7.15517 7.56983 9.80806 10.5711C9.93297 10.7125 9.99659 10.8977 9.98492 11.086C9.97326 11.2743 9.88726 11.4503 9.74585 11.5752C9.67583 11.6371 9.59432 11.6845 9.50596 11.7149C9.4176 11.7452 9.32413 11.7579 9.23089 11.7521C9.04257 11.7404 8.8666 11.6544 8.74169 11.513C6.41226 8.87791 4.7902 7.52599 4.20014 7.52599C3.71198 7.52599 2.91931 8.276 1.95602 9.8329L1.72379 10.2192V12.3448C1.72379 12.8247 2.11242 13.2133 2.59229 13.2133H10.2465C10.435 13.2133 10.6158 13.2882 10.7491 13.4215C10.8825 13.5548 10.9574 13.7357 10.9574 13.9242C10.9574 14.1128 10.8825 14.2936 10.7491 14.4269C10.6158 14.5602 10.435 14.6351 10.2465 14.6351H2.59111C1.98367 14.6351 1.40112 14.3938 0.971602 13.9643C0.542083 13.5348 0.300781 12.9522 0.300781 12.3448V3.65507C0.300781 2.39083 1.32568 1.36475 2.59111 1.36475H12.0699ZM13.2074 9.58053C13.6162 9.55328 13.4242 10.5083 14.0581 11.1007C14.6908 11.6931 15.6755 11.4881 15.7003 11.9147C15.7252 12.3412 14.6956 12.269 14.16 12.827C13.6221 13.3839 13.7406 14.2145 13.301 14.2346C12.8626 14.256 13.1067 13.391 12.41 12.8081C11.7133 12.2263 10.8851 12.3886 10.8851 11.9739C10.8851 11.5592 11.7927 11.8021 12.4029 11.173C13.0131 10.5426 12.7986 9.6066 13.2086 9.58053H13.2074ZM10.0948 3.81384C10.3333 3.81384 10.5695 3.86082 10.7899 3.9521C11.0103 4.04339 11.2105 4.17718 11.3792 4.34585C11.5478 4.51451 11.6816 4.71475 11.7729 4.93512C11.8642 5.1555 11.9112 5.39169 11.9112 5.63022C11.9112 5.86875 11.8642 6.10495 11.7729 6.32532C11.6816 6.5457 11.5478 6.74593 11.3792 6.9146C11.2105 7.08327 11.0103 7.21706 10.7899 7.30834C10.5695 7.39962 10.3333 7.44661 10.0948 7.44661C9.61306 7.44661 9.15105 7.25524 8.81041 6.9146C8.46978 6.57396 8.27841 6.11196 8.27841 5.63022C8.27841 5.14849 8.46978 4.68648 8.81041 4.34585C9.15105 4.00521 9.61306 3.81384 10.0948 3.81384ZM10.0948 5.0769C10.0221 5.0769 9.95017 5.09121 9.88304 5.11902C9.81591 5.14682 9.75491 5.18758 9.70353 5.23896C9.65215 5.29034 9.61139 5.35134 9.58358 5.41847C9.55578 5.48561 9.54146 5.55756 9.54146 5.63022C9.54146 5.70289 9.55578 5.77484 9.58358 5.84197C9.61139 5.90911 9.65215 5.9701 9.70353 6.02148C9.75491 6.07287 9.81591 6.11362 9.88304 6.14143C9.95017 6.16924 10.0221 6.18355 10.0948 6.18355C10.2415 6.18355 10.3823 6.12525 10.4861 6.02148C10.5898 5.91772 10.6481 5.77697 10.6481 5.63022C10.6481 5.48347 10.5898 5.34273 10.4861 5.23896C10.3823 5.13519 10.2415 5.0769 10.0948 5.0769Z",fill:"currentColor"})}),kb=v.memo(({selected:e,onClick:t,onExit:n,disabled:r})=>{const l=v.useCallback(()=>{r||t?.()},[r,t]),a=`rte-ai-image-badge${e?" rte-ai-image-badge-selected":""}`;return b.jsxs("div",{className:a,onClick:l,"data-rte-ai-image-button":"true","aria-pressed":!!e,style:{cursor:r?"not-allowed":"pointer"},children:[b.jsx(fA,{}),b.jsx("span",{className:"rte-ai-image-text",children:"AI生图"}),e&&n&&b.jsx("i",{className:"iconfont icon-guanbi rte-tool-close",role:"button","aria-label":"退出 AI 生图",onMouseDown:i=>{i.preventDefault(),i.stopPropagation()},onClick:i=>{i.preventDefault(),i.stopPropagation(),!r&&n()}})]})});kb.displayName="AIImageButton";const Ab=v.memo(({onClick:e,loading:t,disabled:n})=>b.jsx("button",{type:"button",className:"rich-text-editor-send-button","data-testid":"rte-send-button",onClick:e,disabled:n||t,children:t?b.jsx("span",{className:"rte-send-spinner"}):b.jsx("i",{className:"iconfont icon-fasong"})}));Ab.displayName="SendButton";const Nb=v.memo(({currentAgent:e})=>{const t=e?.points;return t==null?null:b.jsxs("div",{className:"rte-points-badge",style:{position:"relative"},children:[b.jsx("i",{className:"iconfont icon-jifen",style:{marginRight:"4px",fontSize:"16px"}}),b.jsxs("span",{style:{fontSize:"16px",lineHeight:"22px"},children:["-",String(t)]}),e?.labelValue===2&&b.jsx("div",{className:"rte-limited-free-badge",children:b.jsx("span",{className:"rte-limited-free-text",children:"限时免费"})})]})});Nb.displayName="PointsBadge";const su=8,wb=72,hA=100,pA=".rte-more-menu,[data-rte-more-button],.rte-skill-panel-popup,.rte-skill-delete-confirm,.rte-skill-share-popover,.rte-agent-dropdown,.ant-dropdown",bA=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.58984 9.14355C5.95404 9.14355 6.304 9.28838 6.56152 9.5459C6.81867 9.80323 6.96372 10.1527 6.96387 10.5166V14.1943C6.96373 14.5583 6.81895 14.9086 6.56152 15.166C6.30405 15.4233 5.9539 15.5684 5.58984 15.5684H1.91309C1.54903 15.5684 1.19888 15.4233 0.941406 15.166C0.683978 14.9086 0.539199 14.5583 0.539062 14.1943V10.5176C0.539067 10.1535 0.684113 9.80337 0.941406 9.5459C1.19894 9.28837 1.54889 9.14355 1.91309 9.14355H5.58984ZM2.28027 10.4199C2.15705 10.42 2.03931 10.4687 1.95215 10.5557C1.86493 10.643 1.81545 10.7616 1.81543 10.8848V13.8271L1.82422 13.918C1.84226 14.0073 1.88675 14.0899 1.95215 14.1553C2.03954 14.2425 2.15733 14.2919 2.28027 14.292H5.22266L5.31348 14.2832C5.34338 14.2772 5.37314 14.2685 5.40137 14.2568C5.45705 14.2337 5.50752 14.1985 5.55078 14.1553C5.59381 14.1122 5.62895 14.0611 5.65234 14.0049C5.66405 13.9766 5.67271 13.9469 5.67871 13.917L5.6875 13.8271V10.8848C5.68748 10.7616 5.638 10.643 5.55078 10.5557C5.48537 10.4904 5.40283 10.4465 5.31348 10.4287L5.22266 10.4199H2.28027Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.9453 9.03711C13.3093 9.03724 13.6586 9.18214 13.916 9.43945C14.1734 9.69694 14.3184 10.047 14.3184 10.4111V14.0879C14.3183 14.268 14.2817 14.447 14.2129 14.6133C14.1439 14.7796 14.0435 14.9321 13.916 15.0596C13.7885 15.187 13.6361 15.2875 13.4697 15.3564C13.345 15.4081 13.2133 15.4417 13.0791 15.4551L12.9443 15.4619H9.26758C8.90349 15.4619 8.55339 15.3169 8.2959 15.0596C8.03855 14.8022 7.89369 14.4518 7.89355 14.0879V10.4111C7.89355 10.0471 8.03861 9.69693 8.2959 9.43945C8.55342 9.18193 8.90337 9.03711 9.26758 9.03711H12.9453ZM9.63477 10.3135C9.5741 10.3135 9.51355 10.3253 9.45703 10.3486C9.40075 10.372 9.34976 10.4071 9.30664 10.4502C9.26346 10.4935 9.22825 10.5439 9.20508 10.5996C9.18175 10.6561 9.16996 10.7176 9.16992 10.7783V13.7207L9.17871 13.8115C9.18467 13.8413 9.19353 13.8704 9.20508 13.8984C9.22833 13.9543 9.26342 14.0056 9.30664 14.0488C9.3498 14.0919 9.40085 14.1271 9.45703 14.1504C9.51353 14.1737 9.57417 14.1855 9.63477 14.1855H12.5771L12.668 14.1768C12.7576 14.1588 12.8407 14.1143 12.9062 14.0488C12.9714 13.9835 13.0154 13.9009 13.0332 13.8115L13.042 13.7207V10.7783C13.042 10.7169 13.0309 10.6555 13.0078 10.5996C12.9847 10.544 12.9494 10.4935 12.9062 10.4502C12.8632 10.4072 12.8121 10.372 12.7559 10.3486C12.7276 10.3369 12.6978 10.3283 12.668 10.3223L12.5771 10.3135H9.63477Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.1064 0.919922C11.2869 0.919986 11.4649 0.957675 11.6309 1.02637C11.7973 1.09534 11.9497 1.19581 12.0771 1.32324L14.6777 3.92285C14.8051 4.05027 14.9057 4.20287 14.9746 4.36914C15.0434 4.53542 15.0801 4.71436 15.0801 4.89453L15.0732 5.0293C15.0599 5.16344 15.0263 5.29518 14.9746 5.41992C14.9056 5.58618 14.8052 5.73878 14.6777 5.86621L12.0781 8.46582C11.9508 8.59306 11.7984 8.69464 11.6318 8.76367C11.4652 8.83262 11.2864 8.86815 11.1064 8.86816C10.9264 8.86816 10.7477 8.83263 10.5811 8.76367C10.4144 8.69463 10.2621 8.59311 10.1348 8.46582L7.53516 5.86621C7.40782 5.73889 7.30637 5.58648 7.2373 5.41992C7.18567 5.29512 7.15273 5.1633 7.13965 5.0293L7.13281 4.89453C7.13288 4.71481 7.16857 4.5364 7.2373 4.37012C7.30634 4.20346 7.40786 4.05118 7.53516 3.92383L10.1348 1.32324C10.2623 1.19577 10.4146 1.09533 10.5811 1.02637C10.7472 0.95759 10.9259 0.919922 11.1064 0.919922ZM11.1064 2.34863C10.9829 2.34863 10.8645 2.39735 10.7773 2.48438L8.69727 4.56543C8.6541 4.60867 8.61889 4.65915 8.5957 4.71484C8.57239 4.77125 8.5606 4.83282 8.56055 4.89355L8.56934 4.98438C8.57533 5.0143 8.58403 5.04407 8.5957 5.07227C8.61912 5.12852 8.65424 5.17964 8.69727 5.22266L10.7764 7.30176L10.8486 7.36035L10.9082 7.39453C10.9699 7.42383 11.0376 7.43945 11.1064 7.43945L11.1973 7.43066C11.2864 7.41262 11.369 7.36809 11.4346 7.30273L13.5156 5.22266C13.5586 5.17966 13.5938 5.12836 13.6172 5.07227C13.6402 5.01649 13.6513 4.95494 13.6514 4.89355L13.6426 4.80273C13.6368 4.77268 13.6288 4.74287 13.6172 4.71484C13.5941 4.65927 13.5588 4.60872 13.5156 4.56543L11.4346 2.48438C11.3692 2.41913 11.2866 2.37521 11.1973 2.35742L11.1064 2.34863Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.58984 1.68262C5.95404 1.68262 6.304 1.82744 6.56152 2.08496C6.81867 2.34229 6.96372 2.69177 6.96387 3.05566V6.7334C6.96373 7.09738 6.81895 7.44765 6.56152 7.70508C6.30405 7.96237 5.9539 8.10742 5.58984 8.10742H1.91309C1.54903 8.10742 1.19888 7.96236 0.941406 7.70508C0.683978 7.44765 0.539199 7.09738 0.539062 6.7334V3.05664C0.539067 2.69259 0.684113 2.34244 0.941406 2.08496C1.19894 1.82744 1.54889 1.68262 1.91309 1.68262H5.58984ZM2.28027 2.95898C2.15705 2.95905 2.03931 3.00778 1.95215 3.09473C1.86493 3.18207 1.81545 3.30065 1.81543 3.42383V6.36621L1.82422 6.45703C1.84226 6.54634 1.88675 6.62894 1.95215 6.69434C2.03954 6.78154 2.15733 6.83099 2.28027 6.83105H5.22266L5.31348 6.82227C5.34338 6.81627 5.37314 6.80758 5.40137 6.7959C5.45705 6.77272 5.50752 6.73752 5.55078 6.69434C5.59381 6.65131 5.62895 6.60017 5.65234 6.54395C5.66405 6.51566 5.67271 6.48593 5.67871 6.45605L5.6875 6.36621V3.42383C5.68748 3.30065 5.638 3.18207 5.55078 3.09473C5.48537 3.02947 5.40283 2.98556 5.31348 2.96777L5.22266 2.95898H2.28027Z",fill:"currentColor"})]});function Ib(e){const t=e.getBoundingClientRect(),n=getComputedStyle(e);return t.width+(parseFloat(n.marginLeft)||0)+(parseFloat(n.marginRight)||0)}const _b=({items:e,measureKey:t,disabled:n})=>{const r=v.useRef(null),l=v.useRef(null),a=v.useRef(new Map),i=v.useRef(new Map),[s,o]=v.useState(e.length),[u,c]=v.useState(!1),[d,h]=v.useState(0),[f,m]=v.useState(()=>new Set),y=v.useRef(new Set),g=v.useRef(new Map),E=v.useMemo(()=>[...e.filter(M=>M.pinned),...e.filter(M=>!M.pinned)],[e]),N=v.useMemo(()=>E.filter(M=>M.pinned).length,[E]),A=()=>c(!1),P=(M,_)=>typeof M.node=="function"?M.node({close:A,inMenu:_}):M.node,L=M=>{i.current.get(M)?.firstElementChild?.click()};v.useLayoutEffect(()=>{a.current.clear(),o(e.length)},[t,e.length]),v.useEffect(()=>{const M=r.current;if(!M||typeof ResizeObserver>"u")return;const _=new ResizeObserver(()=>h(H=>H+1));return _.observe(M),()=>_.disconnect()},[]),v.useEffect(()=>{if(!u)return;const M=_=>{const H=_.target;H&&H.closest(pA)||c(!1)};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[u]),v.useLayoutEffect(()=>{const M=r.current;if(!M)return;for(let R=0;R<s&&R<E.length;R++){const z=i.current.get(E[R].key);z&&a.current.set(E[R].key,Ib(z))}const _=M.clientWidth,H=l.current?Ib(l.current):wb,$=E.map(R=>a.current.get(R.key)??wb),F=$.reduce((R,z)=>R+z,0)+su*Math.max(0,E.length-1);let T;if(F<=_)T=E.length;else{let R=0,z=0;for(;z<E.length;z++){const q=$[z],G=z>0?su:0;if(R+G+q+su+H>_)break;R+=G+q}T=z}T=Math.max(T,N),T!==s&&o(T)},[E,N,s,d]);const S=N>0,I=S?[]:E.slice(s),w=v.useMemo(()=>{const M=new Set;return S?E.forEach(_=>_.pinned&&M.add(_.key)):E.slice(0,s).forEach(_=>M.add(_.key)),M},[S,E,s]),k=[...w].join("|");return v.useEffect(()=>{const M=window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches,_=g.current;M||y.current.forEach(H=>{if(!w.has(H)&&!_.has(H)){m(F=>new Set(F).add(H));const $=window.setTimeout(()=>{_.delete(H),m(F=>{const T=new Set(F);return T.delete(H),T})},hA);_.set(H,$)}}),w.forEach(H=>{const $=_.get(H);$!==void 0&&(window.clearTimeout($),_.delete(H),m(F=>{if(!F.has(H))return F;const T=new Set(F);return T.delete(H),T}))}),y.current=w},[k]),v.useEffect(()=>()=>g.current.forEach(M=>window.clearTimeout(M)),[]),b.jsxs("div",{className:"rte-toolbar-overflow",ref:r,children:[E.map(M=>{const _=w.has(M.key),H=!_&&(f.has(M.key)||y.current.has(M.key));return!_&&!H?M.renderMenuItem?b.jsx("div",{className:"rte-toolbar-item",style:{display:"none"},ref:$=>{$?i.current.set(M.key,$):i.current.delete(M.key)},children:P(M,!1)},M.key):null:b.jsx("div",{className:`rte-toolbar-item${H?" rte-toolbar-item--leaving":""}`,ref:$=>{$?i.current.set(M.key,$):i.current.delete(M.key)},children:P(M,!1)},M.key)}),I.length>0&&b.jsx(se.Dropdown,{open:u,onOpenChange:(M,_)=>{M?c(!0):_?.source==="trigger"&&c(!1)},disabled:n,trigger:["click"],placement:"topLeft",getPopupContainer:Mr,popupRender:()=>b.jsx("div",{className:"rte-more-menu",children:I.map(M=>b.jsx("div",{className:"rte-more-menu-item",children:M.renderMenuItem?M.renderMenuItem({close:A,activate:()=>L(M.key)}):P(M,!0)},M.key))}),children:b.jsxs("div",{ref:l,className:`rte-more-badge${u?" rte-more-badge-active":""}`,"data-rte-more-button":"true",style:{cursor:n?"not-allowed":"pointer"},children:[b.jsx(bA,{}),b.jsx("span",{children:"更多"})]})})]})};_b.displayName="ToolbarOverflow";const mA={points:["tl","tr"],offset:[4,0]},Ob=v.memo(({isProcessing:e,loading:t,disabled:n,sendDisabled:r,showFooterUpload:l=!0,footerFiles:a,onFooterFilesChange:i,onAssetLibraryClick:s,agentOptions:o,onAgentSelect:u,onAgentDropdownOpenChange:c,hideAgentButton:d,currentAgent:h,selectedSkill:f,onSkillSelect:m,onSkillCardClick:y,onSkillAction:g,skillListFetch:E,onSkillHeaderAction:N,showCreateSkill:A,createDisabled:P,skillPanelOpen:L,onSkillPanelOpenChange:S,skillPanelOpenDelay:I,onAIImageClick:w,aiImageSelected:k,onAgentExit:M,onAIImageExit:_,onSend:H,padding:$="12px 16px"})=>{const F=v.useCallback(re=>{if(re.reduce((me,ve)=>me+ve.size,0)>52428800){const me=[];let ve=0;for(const ce of re){if(ve+ce.size>52428800)break;me.push(ce),ve+=ce.size}i(me)}else i(re)},[i]),[T,R]=v.useState(!1),z=L??T,q=v.useCallback(re=>{R(re),S?.(re)},[S]),G=!d&&!!o&&o.length>0,C=v.useMemo(()=>{const re=[];return G&&re.push({key:"agent",pinned:!!h,node:({close:D,inMenu:de})=>b.jsx(yb,{options:o,onSelect:me=>{u?.(me),D()},disabled:n||e,currentAgent:h,onOpenChange:c,onExit:M,align:de?mA:void 0})}),re.push({key:"skill",pinned:!!f||z,node:b.jsx(Sb,{disabled:n||e,selectedSkill:f,onSkillSelect:m,onSkillCardClick:y,onSkillAction:g,skillListFetch:E,onSkillHeaderAction:N,showCreateSkill:A,createDisabled:P,skillPanelOpen:L,onSkillPanelOpenChange:q,skillPanelOpenDelay:I}),renderMenuItem:({close:D,activate:de})=>b.jsxs("div",{className:`rte-skill-badge${f?" rte-skill-badge-selected":""}`,onClick:()=>{n||e||(de(),D())},style:{cursor:n||e?"not-allowed":"pointer"},children:[b.jsx(Cb,{}),b.jsx("span",{className:"rte-skill-text",children:f?.title||"技能"})]})}),re.push({key:"ai-image",pinned:!!k,node:({close:D})=>b.jsx(kb,{selected:k,onClick:()=>{w?.(),D()},onExit:_,disabled:n||e})}),re},[G,o,u,n,e,h,c,f,m,y,g,E,N,A,P,L,z,q,I,k,w,M,_]),Z=`${G?"1":"0"}|${f?.title??""}|${h?.key??""}|${k?"1":"0"}`;return b.jsxs("div",{className:"rich-text-editor-footer",style:{padding:$},children:[b.jsxs("div",{className:"rich-text-editor-footer-left",children:[l&&b.jsx(xb,{files:a,onChange:F,disabled:n||e,onAssetLibraryClick:s}),l&&b.jsx("div",{className:"rte-footer-divider"}),b.jsx(_b,{items:C,measureKey:Z,disabled:n||e})]}),b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[b.jsx(Nb,{currentAgent:h}),b.jsx(Ab,{onClick:H,loading:t||e,disabled:n||r})]})]})});Ob.displayName="Footer";const gA=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[b.jsx("g",{clipPath:"url(#footer_report_icon_clip)",children:b.jsx("path",{d:"M8.45215 6.33203C8.7473 6.08954 9.15813 6.08988 9.45312 6.33203L9.51465 6.3877L9.63379 6.5127C10.2143 7.15045 10.5526 7.97505 10.5527 8.85059C10.5526 9.78431 10.1675 10.6595 9.51465 11.3125L6.66504 14.1621C6.01021 14.8169 5.08455 15.2001 4.20312 15.2002C3.3328 15.2002 2.39768 14.8749 1.73242 14.1543L1.68555 14.1035C1.0669 13.4571 0.703125 12.6069 0.703125 11.7002C0.703218 10.7663 1.08824 9.89126 1.74121 9.23828L3.04102 7.93848C3.35812 7.62154 3.84793 7.62154 4.16504 7.93848C4.48176 8.25548 4.48205 8.74532 4.16504 9.0625L2.86523 10.3623C2.5177 10.7098 2.30283 11.1852 2.30273 11.7002C2.30273 12.2152 2.51773 12.6905 2.86523 13.0381C3.5981 13.7709 4.80822 13.7709 5.54102 13.0381L8.39062 10.1885C8.73802 9.841 8.95303 9.36555 8.95312 8.85059C8.95303 8.33565 8.73812 7.86023 8.39062 7.5127C8.07364 7.19553 8.07352 6.7048 8.39062 6.3877L8.45215 6.33203ZM11.8027 0.599609C12.7367 0.599609 13.6116 0.984643 14.2646 1.6377C15.6318 3.00485 15.6318 5.19437 14.2646 6.56152L12.9648 7.86133C12.6675 8.15865 12.2186 8.17713 11.9023 7.91699L11.8408 7.86133C11.5239 7.54422 11.5237 7.05447 11.8408 6.7373L13.1406 5.4375C13.8735 4.70466 13.8735 3.49456 13.1406 2.76172C12.793 2.41411 12.3179 2.19922 11.8027 2.19922C11.2877 2.19927 10.8124 2.41418 10.4648 2.76172L7.61523 5.61133C7.26769 5.95887 7.05279 6.43414 7.05273 6.94922C7.05273 7.46435 7.26763 7.9395 7.61523 8.28711C7.91261 8.58448 7.93068 9.03343 7.6709 9.34961L7.61523 9.41113C7.5472 9.47917 7.46705 9.54199 7.36816 9.58594C7.26832 9.63024 7.16328 9.64941 7.05273 9.64941C6.96999 9.64939 6.89035 9.63836 6.81348 9.61426L6.7373 9.58594C6.63742 9.54152 6.55812 9.47804 6.49121 9.41113C5.83816 8.75808 5.45312 7.88321 5.45312 6.94922C5.45318 6.01532 5.8382 5.14032 6.49121 4.4873L9.34082 1.6377C9.99384 0.98468 10.8688 0.599667 11.8027 0.599609Z",fill:"#00A5F4"})}),b.jsx("defs",{children:b.jsx("clipPath",{id:"footer_report_icon_clip",children:b.jsx("rect",{width:"16",height:"16",fill:"white"})})})]}),vA=({report:e,onRemove:t})=>{const n=e.status==="parsing"?"解析中…":e.status==="error"?e.name||"解析失败":e.name;return b.jsxs("div",{className:`rte-footer-report-chip${e.status==="error"?" rte-footer-report-chip-error":""}`,children:[b.jsx("div",{className:"rte-footer-report-icon",children:e.status==="parsing"?b.jsx(se.Spin,{size:"small"}):b.jsx(gA,{})}),b.jsxs("div",{className:"rte-footer-report-info",children:[b.jsx("span",{className:"rte-footer-report-name",title:e.status==="done"?e.name:e.url,children:n}),e.status==="done"&&e.date?b.jsx("span",{className:"rte-footer-report-date",children:e.date}):null]}),b.jsx("span",{className:"rte-footer-file-remove",onClick:r=>{r.stopPropagation(),t()},children:b.jsx("i",{className:"iconfont icon-guanbi",style:{width:"8px",height:"8px",fontSize:"8px",display:"flex",alignItems:"center"}})})]})},yA=e=>e<1024?`${e}B`:e<1024*1024?`${Math.round(e/1024)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`,Mb=e=>/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e||""),EA=e=>(e.type?.startsWith("image/")??!1)||Mb(e.name||""),Lb=e=>{const t=(e||"").split(".").pop()?.toLowerCase()||"";return["xls","xla","xlb","xlc","xlm","xlsx","xlt","xlw","csv","tsv","iif"].includes(t)?"icon-a-xlsxcsv":["doc","docx","dot","odt","rtf","wiz"].includes(t)?"icon-docx":["ppt","pptx","pot","ppa","pps","pwz"].includes(t)?"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(t)?"icon-txt":t==="pdf"?"icon-pdf":["html","htm","json","ics","ifb"].includes(t)?"icon-a-htmljson":t==="md"?"icon-md":["mp4","mov","webm","mkv","avi","m4v"].includes(t)?"icon-shipin":"icon-lianjie"},TA=({file:e,onRemove:t})=>{const n=EA(e),r=$f(n?e:null);return b.jsxs("div",{className:"rte-footer-file-chip",children:[n?b.jsx(se.Image,{className:"rte-footer-file-thumb",width:32,height:32,src:r,alt:e.name,preview:{mask:null,getContainer:()=>document.body}}):b.jsx("div",{className:"rte-footer-file-icon",children:b.jsx("svg",{style:{width:"18px",height:"18px"},"aria-hidden":"true",children:b.jsx("use",{xlinkHref:`#${Lb(e.name)}`})})}),b.jsxs("div",{className:"rte-footer-file-info",children:[b.jsx("span",{className:"rte-footer-file-name",title:e.name,children:e.name}),b.jsx("span",{className:"rte-footer-file-size",children:yA(e.size)})]}),b.jsx("span",{className:"rte-footer-file-remove",onClick:l=>{l.stopPropagation(),t()},children:b.jsx("i",{className:"iconfont icon-guanbi",style:{width:"8px",height:"8px",fontSize:"8px",display:"flex",alignItems:"center"}})})]})},CA=({file:e,onRemove:t})=>{const n=Mb(e.name);return b.jsxs("div",{className:"rte-footer-file-chip",children:[n?b.jsx(se.Image,{className:"rte-footer-file-thumb",width:32,height:32,src:e.url,alt:e.name,preview:{mask:null,getContainer:()=>document.body}}):b.jsx("div",{className:"rte-footer-file-icon",children:b.jsx("svg",{style:{width:"18px",height:"18px"},"aria-hidden":"true",children:b.jsx("use",{xlinkHref:`#${Lb(e.name)}`})})}),b.jsxs("div",{className:"rte-footer-file-info",children:[b.jsx("span",{className:"rte-footer-file-name",title:e.name,children:e.name}),e.size?b.jsx("span",{className:"rte-footer-file-size",children:e.size}):null]}),b.jsx("span",{className:"rte-footer-file-remove",onClick:r=>{r.stopPropagation(),t()},children:b.jsx("i",{className:"iconfont icon-guanbi",style:{width:"8px",height:"8px",fontSize:"8px",display:"flex",alignItems:"center"}})})]})},Db=v.memo(({files:e,onChange:t,reports:n,onReportRemove:r,fileUrls:l,onFileUrlRemove:a})=>{const i=v.useRef(null),[s,o]=v.useState({showLeft:!1,showRight:!1}),u=v.useCallback(()=>{const h=i.current;h&&o({showLeft:h.scrollLeft>0,showRight:h.scrollLeft+h.clientWidth<h.scrollWidth-1})},[]);v.useLayoutEffect(()=>{u()},[e,n,l,u]);const c=v.useCallback(h=>{const f=i.current;f&&(f.scrollBy({left:h*200,behavior:"smooth"}),window.setTimeout(u,300))},[u]),d=v.useCallback(h=>()=>t(e.filter((f,m)=>m!==h)),[e,t]);return e.length===0&&!n?.length&&!l?.length?null:b.jsxs("div",{className:"rte-footer-files-wrapper",children:[s.showLeft&&b.jsx("div",{className:"rte-footer-files-mask rte-footer-files-mask-left",children:b.jsx("span",{className:"rte-footer-files-arrow rte-footer-files-arrow-left",onClick:()=>c(-1),children:b.jsx("svg",{style:{width:"16px",height:"16px",transform:"rotate(180deg)"},"aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-fanhuijiantou"})})})}),b.jsxs("div",{className:"rte-footer-files-list",ref:i,onScroll:u,children:[n?.map(h=>b.jsx(vA,{report:h,onRemove:()=>r?.(h.id)},h.id)),l?.map(h=>b.jsx(CA,{file:h,onRemove:()=>a?.(h.id)},h.id)),e.map((h,f)=>b.jsx(TA,{file:h,onRemove:d(f)},`${h.name}-${h.size}-${f}`))]}),s.showRight&&b.jsx("div",{className:"rte-footer-files-mask rte-footer-files-mask-right",children:b.jsx("span",{className:"rte-footer-files-arrow rte-footer-files-arrow-right",onClick:()=>c(1),children:b.jsx("svg",{style:{width:"16px",height:"16px"},"aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-fanhuijiantou"})})})})]})});Db.displayName="FooterFilesList";const Pb=9999,SA=({messageRef:e})=>{const{message:t}=se.App.useApp();return e.current=t,null},ou=v.memo(({title:e,onClose:t,exitTip:n="点击退出技能"})=>b.jsx(zn,{title:n,placement:"top",zIndex:1e4,children:b.jsx("span",{className:"tag-node group",contentEditable:!1,children:b.jsx("span",{className:"tag-label","data-tag-clickable":"true",onMouseDown:r=>{r.preventDefault(),r.stopPropagation()},onClick:r=>{r.preventDefault(),r.stopPropagation(),t()},children:e})})}));ou.displayName="SkillTag";const Bb=e=>{const{config:t,onSend:n,isProcessing:r=!1,disabled:l=!1,placeholder:a,nodeValues:i,onFilesChange:s,onFooterFilesChange:o,footerFiles:u,footerReports:c=[],onFooterReportsChange:d,onReportUrlPaste:h,footerFileUrls:f=[],onFooterFileUrlsChange:m,width:y,background:g="transparent",border:E,maxHeight:N,minHeight:A,editorMinHeight:P,editorPadding:L,className:S,videoUrlParse:I,videoUpload:w,reportAnalyze:k,reportListFetch:M,onReportGoGenerate:_,reportNameResolve:H,onViewReport:$,hideCurrentSessionReport:F,markdownAnalyze:T,markdownNameAnalyze:R,agentOptions:z,onAgentSelect:q,onAgentExit:G,onSkillAction:C,onSkillCardClick:Z,onSkillHeaderAction:re,skillListFetch:D,showCreateSkill:de,createDisabled:me,skillPanelOpen:ve,onSkillPanelOpenChange:ce,skillPanelOpenDelay:ke,selectedSkill:Me,onSkillSelect:ye,onAIImageClick:et,aiImageSelected:_t,onAIImageExit:Ft,loading:Kr,hideButtons:Fn,footerPadding:Ae,showFooterUpload:He,onAssetLibraryClick:Rn,lockStructure:Hn=!0,collapsed:Ue=!1,onCollapsedChange:Un,collapseTransitionMs:on=260,nodeDefaults:cu,onExpandedHeightChange:Ti,collapsedTotalHeight:Ci,toggleOnBlankClick:Y=!0,getPopupContainer:te,scrollContainerRef:ge,autoCollapseOnScroll:Ne}=e,[we,tt]=v.useState({}),[Ge,Rt]=v.useState({}),[je,St]=v.useState(u??[]),ft=v.useRef(c);ft.current=c;const un=v.useRef(d);un.current=d;const Ht=v.useRef(f);Ht.current=f;const Wb=v.useRef(m);Wb.current=m;const[FA,RA]=v.useState({}),[Si,Qr]=v.useState(z8),[Yb,jb]=v.useState(()=>new Set),[xi,Gb]=v.useState(()=>new Set),[ki,HA]=v.useState(()=>new Set),[Kb,Xl]=v.useState({}),[cr,UA]=v.useState(null),[zA,Qb]=v.useState(null),du=v.useRef(null);v.useLayoutEffect(()=>{const U=du.current?.ownerDocument??document,J=U.createElement("div");return J.className="rte-message-host",J.style.cssText="position:fixed;inset:0;z-index:2000000000;pointer-events:none;",U.body.appendChild(J),Qb(J),()=>{J.remove(),Qb(null)}},[]);const VA=v.useCallback(()=>te?.()??cr??document.body,[te,cr]),fu=v.useRef(null),[Ai,$A]=v.useState(null),qA=v.useCallback((U,J)=>{$A(J?U:null)},[]),dr=v.useRef(null),[WA,YA]=v.useState(58),[fr,Xb]=v.useState(58),[hu,Jb]=v.useState(!1),Zb=v.useRef(0),em=v.useRef(Ue),[Ni,tm]=v.useState(!1);em.current!==Ue&&(em.current=Ue,Zb.current=(typeof performance<"u"?performance.now():Date.now())+on,tm(!0)),v.useEffect(()=>{if(!Ni)return;const U=setTimeout(()=>tm(!1),on);return()=>clearTimeout(U)},[Ni,Ue,on]);const[hr,nm]=v.useState(""),Jl=v.useRef(null),pu=v.useRef(null),[Zl,rm]=v.useState(0),[bu,lm]=v.useState(0),mu=v.useRef(!1);v.useEffect(()=>{if(!u||u.length===je.length&&u.every((ne,le)=>{const ee=je[le];return ee&&ne.name===ee.name&&ne.size===ee.size&&ne.lastModified===ee.lastModified}))return;const J=50*1024*1024;if(u.reduce((ne,le)=>ne+le.size,0)>J){const ne=[];let le=0;for(const ee of u){if(le+ee.size>J)break;ne.push(ee),le+=ee.size}St(ne)}else mu.current=!0,St(u)},[u]);const xt=v.useMemo(()=>U8(t,Si,Yb),[t,Si,Yb]),gu=v.useRef(null),am=v.useRef(!1);v.useEffect(()=>{const U=t.find(J=>J.type==="tag")?.text??null;if(!am.current){am.current=!0,gu.current=U;return}gu.current!==U&&(gu.current=U,St(J=>J.length===0?J:[]),ft.current.length&&un.current?.([]),Ht.current.length&&Wb.current?.([]))},[t]);const pr=v.useMemo(()=>{const U=t.find(J=>J.type==="tag")?.text;if(!(!U||!z))return z.find(J=>J.label===U)},[t,z]),vu=v.useMemo(()=>t.some(U=>U.type==="tag"),[t]),jA=de??!vu;T8(i,we,tt,xt,Ge,Rt);const ea=v.useRef(new Map),im=v.useRef(""),sm=(t.find(U=>U.type==="tag")?.text||"")+"||"+t.filter(U=>U.key&&U.type!=="report-module"&&U.type!=="markdown-module").map(U=>`${U.type}:${U.key}`).join("|");im.current!==sm&&(im.current=sm,ea.current=new Map);const[gt,ta]=v.useState(null),[Zt,br]=v.useState(!1);v.useEffect(()=>{Me!==void 0&&ta(Me)},[Me]),v.useEffect(()=>{_t!==void 0&&br(_t)},[_t]);const om=v.useCallback(U=>{ta(U),U&&br(!1),ye?.(U),U&&pr&&G?.("skill-switch")},[pr,G,ye]),GA=v.useCallback(U=>{ta(null),br(!1),ye?.(null),q?.(U)},[q,ye]),KA=v.useCallback(()=>{br(!0),ta(null),ye?.(null),pr&&G?.("ai-image-switch"),et?.()},[pr,G,et,ye]),QA=v.useCallback(()=>G?.("tag-close"),[G]),XA=v.useCallback(()=>{br(!1),Ft?.()},[Ft]);v.useEffect(()=>{pr&&(ta(null),br(!1))},[pr]);const{errors:JA,validate:um,clearError:cm}=x8(xt),{excludedKeys:Xr,hiddenSeparatorIndexes:yu,conditionalHiddenIndexes:ZA}=M8(xt,we,Ge),{analyzeReport:wi,analyzeMarkdown:dm,analyzeMarkdownName:fm,resolveReportName:Ii}=L8({reportAnalyze:k,markdownAnalyze:T,markdownNameAnalyze:R,reportNameResolve:H}),hm=U=>typeof U!="string"?!U:U.replace(/<[^>]*>/g,"").replace(/&nbsp;/gi,"").replace(/\s/g,"").replace(/[​‌‍]/g,"").trim()==="",Eu=v.useCallback((U,J)=>{tt(ne=>({...ne,[U]:J})),cm(U);const ae=/^(.+)__module_\d+$/.exec(U);if(ae&&hm(J)){const ne=ae[1];xt.find(ee=>ee.key===ne&&ee.type==="markdown-module")&&tt(ee=>{const fe={...ee,[U]:J};return Object.keys(fe).filter(pe=>pe.startsWith(`${ne}__module_`)).every(pe=>hm(fe[pe]))&&(Qr(pe=>{if(!pe.markdownModules[ne])return pe;const Pe={...pe.markdownModules};return delete Pe[ne],{...pe,markdownModules:Pe}}),Object.keys(fe).filter(pe=>pe.startsWith(`${ne}__module_`)).forEach(pe=>delete fe[pe]),fe[ne]=""),fe});return}if(typeof J=="string"&&J.trim()===""){const ne=xt.find(le=>le.key===U);ne?.type==="report-url"?(Qr(le=>{if(!le.reportModules[U])return le;const ee={...le.reportModules};return delete ee[U],{...le,reportModules:ee}}),Xl(le=>{if(!(U in le))return le;const ee={...le};return delete ee[U],ee})):(ne?.type==="markdown"||ne?.type==="markdown-name")&&Qr(le=>{if(!le.markdownModules[U])return le;const ee={...le.markdownModules};return delete ee[U],{...le,markdownModules:ee}})}},[cm,xt]),eN=v.useCallback((U,J)=>{Rt(ae=>({...ae,[U]:J}))},[]),tN=v.useCallback((U,J)=>RA(ae=>({...ae,[U]:J})),[]),nN=v.useCallback(U=>{Xl(J=>{if(!(U in J))return J;const ae=U.match(/^(.+)_(\d+)$/);if(!ae){const Ee={...J};return delete Ee[U],Ee}const[,ne,le]=ae,ee=parseInt(le,10),fe={};for(const[Ee,pe]of Object.entries(J)){if(Ee===U)continue;const Pe=Ee.match(/^(.+)_(\d+)$/);if(Pe&&Pe[1]===ne){const Be=parseInt(Pe[2],10);Be>ee?fe[`${ne}_${Be-1}`]=pe:fe[Ee]=pe}else fe[Ee]=pe}return fe})},[]),rN=v.useCallback((U,J)=>{Xl(ae=>{const ne=`${U}_`,le=[];for(const fe of Object.keys(ae)){if(!fe.startsWith(ne))continue;const Ee=fe.slice(ne.length);/^\d+$/.test(Ee)&&le.push([Number(Ee),ae[fe]])}if(le.length===0)return ae;const ee={...ae};for(const[fe]of le)delete ee[`${U}_${fe}`];for(const[fe,Ee]of le){if(fe===J)continue;const pe=fe>J?fe-1:fe;ee[`${U}_${pe}`]=Ee}return ee})},[]),Tu=v.useCallback(async(U,J,ae)=>{const ne=await Ii(U,J,ae);return ne.status==="success"&&Xl(le=>({...le,[U]:ne.name})),ne},[Ii]),lN=v.useCallback((U,J)=>{wi(U,J).then(ae=>{ae.status==="success"&&Qr(ne=>({...ne,reportModules:{...ne.reportModules,[U]:ae.modules}}))})},[wi]),Cu=v.useCallback(async(U,J)=>{Gb(ae=>{const ne=new Set(ae);return ne.add(U),ne});try{const ae=Ii(U,J,"report-url").then(le=>{le.status==="success"&&Xl(ee=>({...ee,[U]:le.name}))}),ne=wi(U,J).then(le=>{le.status==="success"?(Qr(ee=>({...ee,reportModules:{...ee.reportModules,[U]:le.modules}})),tt(ee=>{const fe={...ee};return le.modules.forEach((Ee,pe)=>{fe[`${U}__module_${pe}`]=Ee.content}),fe})):le.status==="failed"&&(Eu(U,""),tt(ee=>{let fe=!1;const Ee={...ee};for(const pe of Object.keys(Ee))pe.startsWith(`${U}__module_`)&&(delete Ee[pe],fe=!0);return fe?Ee:ee}))});await Promise.all([ae,ne])}finally{Gb(ae=>{if(!ae.has(U))return ae;const ne=new Set(ae);return ne.delete(U),ne})}},[wi,Ii,Eu]),aN=v.useCallback((U,J)=>{HA(ae=>{const ne=new Set(ae);return J?ne.add(U):ne.delete(U),ne.size===ae.size&&[...ne].every(le=>ae.has(le))?ae:ne})},[]);v.useEffect(()=>{if(!i||t.length===0)return;const U=t.filter(ae=>ae.type==="report-url"&&ae.key),J=t.filter(ae=>ae.type==="multi-variable-select"&&ae.key);if(!(U.length===0&&J.length===0)){for(const ae of U){const ne=ae.key,le=i[ne]??i[`${ne}__url`];if(!le||typeof le=="string"&&!le.trim())continue;const ee=Array.isArray(le)?String(le[0]??""):String(le);ee&&ea.current.get(ne)!==ee&&(ea.current.set(ne,ee),setTimeout(()=>{Cu(ne,ee)},100))}for(const ae of J){const ne=ae.key,le=i[ne];!Array.isArray(le)||le.length===0||le.forEach((ee,fe)=>{const Ee=typeof ee=="string"?ee.trim():"";if(!Ee)return;const pe=`${ne}_${fe}`;ea.current.get(pe)!==Ee&&(ea.current.set(pe,Ee),setTimeout(()=>{Tu(pe,Ee,"multi-variable-select")},100))})}}},[i,t,Cu,Tu]);const _i=v.useCallback(async(U,J,ae)=>{const le=Date.now();jb(ee=>{const fe=new Set(ee);return fe.add(U),fe});try{const ee=await ae(U,J),fe=Date.now()-le;fe<500&&await new Promise(Ee=>setTimeout(Ee,500-fe)),ee&&(Qr(Ee=>({...Ee,markdownModules:{...Ee.markdownModules,[U]:ee.modules}})),tt(Ee=>{const pe={...Ee};return ee.modules.forEach((Pe,Be)=>{pe[`${U}__module_${Be}`]=Pe.content}),pe}))}finally{jb(ee=>{if(!ee.has(U))return ee;const fe=new Set(ee);return fe.delete(U),fe})}},[]),iN=v.useCallback((U,J)=>_i(U,J,dm),[_i,dm]),sN=v.useCallback((U,J)=>_i(U,J,fm),[_i,fm]);v.useEffect(()=>{s?.(Ge)},[Ge,s]),v.useEffect(()=>{if(mu.current){mu.current=!1;return}o?.(je)},[je,o]);const Su=v.useCallback(async()=>{if(r||l||xi.size>0||ki.size>0||c.some(ee=>ee.status==="parsing"))return;const U=vu?1:gt?2:Zt?3:void 0,J=U===void 0?void 0:{...gt?{skillCode:gt.id,skillName:gt.title}:{},generateImage:U};if(t.length===0){const ee=hr.trim(),fe=c.filter(pe=>pe.status==="done");if(!ee&&!je.length&&!fe.length&&!f.length)return;const Ee=ee;if(je.length||fe.length||f.length){const pe=new FormData;Ee&&pe.append("prompt",Ee),je.forEach(Pe=>pe.append("files",Pe)),fe.forEach(Pe=>pe.append("reportUrls",Pe.url)),f.forEach(Pe=>pe.append("fileUrls",Pe.url)),n(pe,Ee,J)}else n(ee,Ee,J);nm(""),St([]),c.length&&d?.([]),f.length&&m?.([]);return}if(!um(we,Ge,Xr))return;const{formData:ae,fullPrompt:ne,hasContent:le}=await H8({config:xt,values:we,files:Ge,footerFiles:je,markdownModules:Si.markdownModules,excludedKeys:Xr,hiddenSeparatorIndexes:yu});le&&(n(ae,ne,J),St([]))},[t.length,hr,gt,vu,Zt,xt,we,Ge,je,c,d,f,m,Si.markdownModules,r,l,xi,ki,um,n,Xr,yu]),oN=v.useCallback(U=>{U.key==="Enter"&&(U.nativeEvent.isComposing||U.keyCode===229||U.shiftKey||(U.preventDefault(),Su()))},[Su]),uN=v.useMemo(()=>xi.size>0||ki.size>0?!1:t.length===0?hr.trim().length>0:S8(xt,we,Ge,Xr),[xi,ki,t.length,hr,xt,we,Ge,Xr]),xu=v.useCallback(()=>{const U=pu.current,J=U?.querySelector(".tag-node");if(!U||!J)return!1;const ae=J.getClientRects();if(ae.length===0)return!1;const ne=U.getBoundingClientRect().left,le=ae[0],ee=ae[ae.length-1],fe=Math.max(0,ee.right-ne-2);return rm(fe),lm(Math.max(0,Math.round(ee.top-le.top))),fe>0},[]);v.useLayoutEffect(()=>{if(!gt&&!Zt){rm(0),lm(0);return}let U=!1,J=0,ae=0;const ne=()=>{U||xu()||++ae>=30||(J=requestAnimationFrame(ne))};ne();const le=pu.current;if(!le||typeof ResizeObserver>"u")return()=>{U=!0,J&&cancelAnimationFrame(J)};const ee=new ResizeObserver(()=>xu());return ee.observe(le),()=>{U=!0,J&&cancelAnimationFrame(J),ee.disconnect()}},[gt,Zt,t.length,xu]),v.useEffect(()=>{!gt&&!Zt||t.length>0||Jl.current?.focus()},[gt,Zt,t.length]);const[cN,pm]=v.useState(!1);v.useEffect(()=>{const U=J=>{const ae=du.current;if(!ae)return;const ne=J.target;ae.contains(ne)||cr&&cr.contains(ne)?pm(!0):pm(!1)};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[cr]);const bm=v.useCallback(()=>{requestAnimationFrame(()=>{if(t.length===0){Jl.current?.focus();return}dr.current?.querySelector('textarea:not([disabled]), input:not([disabled]):not([type="hidden"]), [contenteditable="true"]')?.focus()})},[t.length]),dN=v.useCallback(U=>{ce?.(U),U&&bm()},[ce,bm]);v.useLayoutEffect(()=>{const U=Jl.current;U&&(U.style.height="auto",U.style.height=`${U.scrollHeight}px`,Zl>0&&(U.style.textIndent="0px",U.offsetWidth,U.style.textIndent=`${Zl}px`))},[hr,Zl,bu]);const fN={width:y,background:g,border:E,maxHeight:N,...A&&!Ue?{minHeight:A}:{},...P?{"--rte-editor-min-height":typeof P=="number"?`${P}px`:P}:{},...L?{"--rte-editor-padding":L}:{}},mm=typeof Ci=="number"?Ci:WA,gm=Ue?mm:Math.max(fr,mm),vm={maxHeight:gm,minHeight:Ue?0:Ni?gm:void 0,overflow:Ue||Ni?"hidden":"auto",transition:hu?"none":`max-height ${on}ms cubic-bezier(0.4, 0, 0.2, 1), min-height ${on}ms cubic-bezier(0.4, 0, 0.2, 1)`,willChange:"max-height, min-height"},ym=v.useCallback(()=>{Ue&&Y&&Un?.(!1),Jl.current?.focus()},[Ue,Y,Un]),Em=v.useRef(0),hN=v.useCallback(()=>{const U=dr.current,J=document.activeElement;!U||!J||!U.contains(J)||(Em.current=typeof performance<"u"?performance.now():Date.now())},[]),Oi=v.useCallback(()=>{const U=dr.current;if(!(!U||(typeof performance<"u"?performance.now():Date.now())<Zb.current)){if(!Ue){const ae=U.style.maxHeight;U.style.maxHeight="none";const ne=U.offsetHeight,le=U.scrollHeight,ee=U.parentElement;let fe=1/0;if(ee){let Pe=0;for(const Mi of Array.from(ee.children))Mi!==U&&(Pe+=Mi.offsetHeight);const Be=getComputedStyle(ee),mr=parseFloat(Be.paddingTop)+parseFloat(Be.paddingBottom);fe=Math.max(0,ee.clientHeight-Pe-mr)}U.style.maxHeight=ae;const Ee=Math.max(Math.ceil(le||0),Math.ceil(ne||0)),pe=Math.min(Ee,Math.ceil(fe));pe>0&&Xb(Pe=>Pe===pe?Pe:pe)}try{const ae=U.getBoundingClientRect(),ne=U.querySelector(".rte-config-fade")??U,le=document.createRange();le.selectNodeContents(ne);const ee=Array.from(le.getClientRects()).filter(fe=>fe.height>0);if(ee.length>0){const fe=Math.min(...ee.map(gr=>gr.top)),Ee=parseFloat(getComputedStyle(U).lineHeight)||34,pe=Math.max(Ee,1),Pe=fe+pe*.5;let Be=0;for(const gr of ee)gr.top<Pe&&(Be=Math.max(Be,gr.bottom));const mr=Be>0?Math.ceil(Be-ae.top):0,Mi=getComputedStyle(U),bN=parseFloat(Mi.paddingTop)||0,mN=Math.ceil(bN+pe),ku=Math.max(mr,mN);ku>0&&YA(gr=>gr===ku?gr:ku)}}catch{}}},[Ue]),Jr=v.useMemo(()=>xt.filter(U=>U.key&&U.type!=="report-module"&&U.type!=="markdown-module").map(U=>`${U.type}:${U.key}`).join("|"),[xt]),Tm=v.useRef(Jr);Tm.current!==Jr&&(Tm.current=Jr,Ue||(Xb(Pb),Jb(!0))),v.useEffect(()=>{if(!hu)return;const U=setTimeout(()=>Jb(!1),on);return()=>clearTimeout(U)},[hu,Jr,on]),v.useLayoutEffect(()=>{const U=dr.current;if(!U||(Oi(),typeof ResizeObserver>"u"))return;const J=()=>{const ee=dr.current;if(!ee)return;(typeof performance<"u"?performance.now():Date.now())-Em.current<600&&ee.contains(document.activeElement)&&ee.scrollHeight>ee.clientHeight&&(ee.scrollTop=ee.scrollHeight)},ae=new ResizeObserver(()=>Oi());ae.observe(U);const ne=U.querySelector(".rte-default-textarea, .rte-config-fade"),le=ne?new ResizeObserver(()=>{Oi(),J()}):null;return ne&&le&&le.observe(ne),()=>{ae.disconnect(),le?.disconnect()}},[Oi,xt,Ge,je.length,c.length,f.length,Kb,Ue,Jr,hr]);const Cm=v.useRef(-1);v.useEffect(()=>{Ue||fr<=0||fr>=Pb||Cm.current!==fr&&(Cm.current=fr,Ti?.(fr))},[fr,Ue,Ti]);const Sm=v.useMemo(()=>new Set(["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","mp4","mov","webm","mkv","avi","m4v"]),[]),pN=v.useCallback(U=>{const J=t.some(Be=>Be.type==="tag"),ae=U.clipboardData?.getData?.("text/plain")??"";if(h&&!J&&Im(ae)){U.preventDefault(),h(ae.trim());return}const ne=U.clipboardData?.files;if(!ne||ne.length===0||(U.preventDefault(),J))return;const le=[];let ee=!1;for(const Be of Array.from(ne)){const mr=(Be.name||"").split(".").pop()?.toLowerCase()||"";Sm.has(mr)?le.push(Be):ee=!0}if(ee&&fu.current?.error("粘贴文件中含不支持的类型,已自动过滤"),le.length===0)return;const fe=50*1024*1024,Ee=je.reduce((Be,mr)=>Be+mr.size,0),pe=[];let Pe=Ee;for(const Be of le){if(Pe+Be.size>fe){fu.current?.error("文件总大小不能超过 50MB");break}pe.push(Be),Pe+=Be.size}pe.length>0&&St(Be=>[...pe,...Be])},[Sm,t,je,h]);return b.jsx(se.ConfigProvider,{getPopupContainer:VA,children:b.jsxs(se.App,{component:!1,message:{getContainer:()=>zA??cr??document.body},children:[b.jsx(SA,{messageRef:fu}),b.jsxs(xf.Provider,{value:cr,children:[b.jsxs("div",{ref:du,className:`rich-text-editor ${Ai?"rte-richtext-container-expanded":""} ${cN?"rte-editor-selected":""} ${S??""}`,"data-component":"structured-editor",style:fN,onPaste:pN,children:[b.jsx(Db,{files:je,onChange:St,reports:c,onReportRemove:U=>d?.(c.filter(J=>J.id!==U)),fileUrls:f,onFileUrlRemove:U=>m?.(f.filter(J=>J.id!==U))}),t.length===0?b.jsxs("div",{ref:dr,className:`rte-editor rte-editor-default${gt||Zt?" rte-editor-default-with-skill":""}`,style:vm,onClick:ym,children:[(gt||Zt)&&b.jsx("span",{ref:pu,className:"rte-skill-inline-tag-wrap",contentEditable:!1,children:gt?b.jsx(ou,{title:gt.title,onClose:()=>om(null)}):b.jsx(ou,{title:"AI生图",exitTip:"点击退出 AI 生图",onClose:()=>{br(!1),Ft?.()}})}),b.jsx("textarea",{ref:Jl,className:"rte-default-textarea",value:hr,onChange:U=>nm(U.target.value),onKeyDown:oN,placeholder:Zt?"请描述你想要的图片":gt?.usageInstruction||a||"",disabled:l,rows:1,style:{textIndent:Zl?`${Zl}px`:void 0,paddingTop:bu?`${bu}px`:void 0}})]}):b.jsx("div",{ref:dr,className:`rte-editor${Ai?" rte-richtext-fullscreen-active":""}`,style:vm,onClick:ym,onInput:hN,children:b.jsx("div",{className:"rte-config-fade",children:xt.map((U,J)=>{if(ZA.has(J)||U.key&&Xr.has(U.key)||U.exclusionGroup==="separator"&&yu.has(J)||Ai&&U.key!==Ai)return null;const ae=(U.type==="report-module"||U.type==="markdown-module")&&U.key?`${U.key}__module_${U.moduleIndex??0}`:U.key;return b.jsx(db,{node:U,value:ae?we[ae]:void 0,files:Ge,onChange:Eu,onFileChange:eN,thumbnails:FA,onThumbnailChange:tN,videoUrlParse:I,videoUpload:w,onVideoParsingChange:aN,reportListFetch:M,onReportGoGenerate:_,onViewReport:$,hideCurrentSessionReport:F,reportNames:Kb,onClearReport:nN,onResolveMultiName:Tu,onAnalyzeMultiReport:lN,onShiftReportNames:rN,onAgentExit:G,hideAgentClose:Fn==="hideTagClose",onReportUrlParse:Cu,onMarkdownParse:iN,onMarkdownNameParse:sN,onRichtextExpandChange:qA,disabled:l,error:ae?JA[ae]:void 0,index:J,nodeDefaults:cu},ae??`text-${J}`)})},Jr)}),b.jsx(Ob,{isProcessing:r,loading:Kr,disabled:l,sendDisabled:!uN,showFooterUpload:He,footerFiles:je,onFooterFilesChange:St,onAssetLibraryClick:Rn,agentOptions:z,onAgentSelect:GA,hideAgentButton:Fn==="hideAgent",currentAgent:pr,selectedSkill:gt,onSkillSelect:om,onSkillCardClick:Z,onSkillAction:C,skillListFetch:D,onSkillHeaderAction:re,showCreateSkill:jA,createDisabled:me,skillPanelOpen:ve,onSkillPanelOpenChange:dN,skillPanelOpenDelay:ke,onAIImageClick:KA,aiImageSelected:Zt,onAgentExit:QA,onAIImageExit:XA,onSend:Su,padding:Ae})]}),b.jsx("div",{className:"rte-popup-host",ref:UA})]})]})})},Fb="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFSSURBVHgB3ZTtccIwDIaVXv83I2SDZgSP0BHMBG0naEZhA2boBGQDswHdQJUOGRxjO0Z8HPDe6eJzJD2W4gjgEYSIn2xwK6EIFHqBGysJpMP3ZB0oRbEtmal1NtIxl4OWWsoxEsvqofJ0rgTNASOYq+7SXKDsuYvAcgkq/PWwBLQWqIfdjeRStaBUc4qzgLi9/BzJNmS/sh6bpvmrTfSFacU3scWy1mQryWdSnXiFE8QVUJINLTuyhWzzz/1OZmTN9hEckqtfUOwIGlGCpVRjE+94JFqpMtTeVzO8/UmPxpZU8Qa7aln8Tb9pfwla4WHWrjPvvbbnTBsX7PmLs83EDAH0BxSw1G31+/1FoDg/vPcXR+wocQS1apj4+P92FfhOoLyuBfYlmPgYnGoCjWADzAkzUyJ430awLmphPaxWQVU22BuuApPkHaanjcXSN3t6/QNjTMSJWDcs1QAAAABJRU5ErkJggg==",xA=[{label:"5页",value:5},{label:"10页",value:10},{label:"15页",value:15},{label:"30页",value:30}],kA=({autoLoading:e,batchSize:t,loadingProgress:n,loadIcon:r,onBatchSizeChange:l,onLoadNextPage:a,onStartAutoLoad:i,onStopLoad:s})=>e&&n?b.jsxs("div",{className:"auto_load_progress",children:[r||b.jsx("img",{src:Fb,alt:"自动加载",width:14,height:14}),b.jsxs("span",{children:["正在加载第",n.currentPage,"/",n.totalPages,"页"]}),b.jsx(se.Progress,{percent:n.percentage,type:"line",size:[160,8]}),b.jsx("span",{onClick:s,className:"auto_load_stop_btn",children:"停止加载"})]}):b.jsxs("div",{className:"auto_load_container",children:[b.jsx("div",{onClick:a,className:"auto_load_next_btn",style:{backgroundColor:e?"#f5f5f5":"#2563eb"},children:"加载下一页"}),b.jsxs("div",{className:"right_control_wrap",style:{backgroundColor:e?"#f5f5f5":"#2563eb"},children:[b.jsxs("div",{className:"auto_load_btn",onClick:e?void 0:i,children:[r||b.jsx("img",{src:Fb,alt:"自动加载",width:14,height:14}),b.jsx("span",{children:"自动加载"})]}),b.jsx(se.Select,{value:t,onChange:l,options:xA,disabled:e,size:"small",className:"auto_load_select",popupMatchSelectWidth:84})]})]}),AA=({current:e,loadIcon:t,pageSize:n,total:r,cachedPages:l,loadedCount:a,autoLoading:i=!1,loadingProgress:s,onChange:o,onLoadNextPage:u,onStartAutoLoad:c,onStopLoading:d})=>{const[h,f]=v.useState(5),m=Math.ceil(r/n),y=v.useMemo(()=>l.length>=m,[l,m]),g=()=>Array.from({length:m},(A,P)=>P+1).filter(A=>!l.includes(A)).slice(0,h),E=(N,A,P)=>{const L=l.includes(N);return A==="prev"||A==="next"||A==="jump-prev"||A==="jump-next"?b.jsx("div",{className:"pageBox",children:P}):b.jsxs("div",{className:"pageBox",style:{backgroundColor:e===N?"#2563EB":"#f5f5f5",color:e===N?"#fff":L?"#171717":"#a3a3a3"},children:[N,!L&&b.jsx("span",{className:"unload_spot"})]})};return b.jsxs("div",{className:"pagination_footer",children:[b.jsxs("div",{className:"pagination_leftWrap",children:[b.jsxs("span",{className:"pagination_total",children:[b.jsx($t.InfoCircleOutlined,{style:{color:"#2563EB",marginRight:"4px"}}),"已加载: ",a,"/",r,"条数据"]}),!y&&b.jsx(kA,{loadIcon:t||void 0,autoLoading:i,batchSize:h,loadingProgress:s,disabled:!u||!c,onBatchSizeChange:f,onLoadNextPage:()=>u?.(),onStartAutoLoad:()=>{const N=g();c?.(N)},onStopLoad:()=>d?.()})]}),b.jsx(se.Pagination,{current:e,pageSize:n,total:r,onChange:N=>o(N),showSizeChanger:!1,showQuickJumper:!1,showTotal:()=>"",itemRender:E})]})},Rb=e=>{const{loading:t,autoLoading:n,loadingProgress:r,columns:l=[],dataSource:a=[],total:i,current:s,pageSize:o,cachedPages:u,onChangePage:c,onLoadNextPage:d,onStartAutoLoad:h,onStopLoading:f,...m}=e,y=v.useRef(null),g=v.useCallback(E=>{c(E),u.includes(E)&&y.current?.scrollTo({key:`${(E-1)*o+1}`})},[u,c,o]);return b.jsxs("div",{className:"flex flex-col",children:[b.jsx(se.Table,{ref:y,...m,columns:l,dataSource:a,pagination:!1,virtual:!0}),b.jsx(AA,{loading:t,autoLoading:n,loadingProgress:r,current:s,pageSize:o,total:i,loadedCount:a.length,cachedPages:u,onChange:g,onLoadNextPage:d,onStartAutoLoad:h,onStopLoading:f})]})};Rb.__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 Hb=({texts:e=[],placeholder:t="请输入内容",animationSpeed:n=100,autoPlay:r=!0,value:l,onChange:a,...i})=>{const[s,o]=v.useState(""),[u,c]=v.useState(0),[d,h]=v.useState(!1),[f,m]=v.useState(!1),[y,g]=v.useState(!1),E=v.useRef(void 0),N=v.useRef(void 0),A=v.useRef(e),P=v.useRef(u),L=v.useRef(f),S=v.useRef(s);v.useEffect(()=>{A.current=e,P.current=u,L.current=f,S.current=s});const I=v.useCallback((F,T)=>{let R=0;g(!0);const z=()=>{R<F.length?(o(F.slice(0,R+1)),R++,N.current=window.setTimeout(z,n)):(g(!1),T?.())};z()},[n]),w=v.useCallback(F=>{let T=S.current.length;const R=()=>{T>0?(o(S.current.slice(0,T-1)),T--,N.current=window.setTimeout(R,n/2)):F?.()};R()},[n]),k=v.useCallback(()=>{if(A.current.length===0||L.current)return;h(!0);const F=A.current[P.current];S.current?w(()=>{I(F,()=>{E.current=window.setTimeout(()=>{c(T=>(T+1)%A.current.length),h(!1)},2e3)})}):I(F,()=>{E.current=window.setTimeout(()=>{c(T=>(T+1)%A.current.length),h(!1)},2e3)})},[w,I]);v.useEffect(()=>(r&&e.length>0&&!f&&k(),()=>{E.current&&window.clearTimeout(E.current),N.current&&window.clearTimeout(N.current)}),[u,f,r,e.length,k]),v.useEffect(()=>{!d&&r&&e.length>0&&!f&&k()},[u,d,r,e.length,f,k]);const M=F=>{m(!0),E.current&&window.clearTimeout(E.current),N.current&&window.clearTimeout(N.current),h(!1),g(!1),i.onFocus?.(F)},_=F=>{m(!1),!l&&e.length>0&&(o(""),c(0)),i.onBlur?.(F)},H=F=>{a?.(F.target.value),i.onChange?.(F)},$=()=>f||l?t:s||t;return b.jsxs("div",{style:{position:"relative"},children:[b.jsx(se.Input,{...i,value:l,onChange:H,onFocus:M,onBlur:_,placeholder:$(),style:{...i.style,position:"relative",zIndex:1}}),!f&&!l&&s&&b.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:[b.jsx("span",{children:s}),y&&b.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),b.jsx("style",{children:`
146
+ `)){r.push({...a,text:a.text.slice(1)}),l=!1;continue}if(a.exclusionGroup==="separator"){r.push(a);continue}}r.push(a),a.type==="report-url"&&a.key&&t.reportModules[a.key]&&t.reportModules[a.key].forEach((s,o)=>{r.push({type:"report-module",key:a.key,moduleIndex:o,text:s.title,exclusionGroup:a.exclusionGroup,required:a.required})})}return r}const z8={reportModules:{},markdownModules:{}},V8={adjustX:1,adjustY:1,shiftX:!1,shiftY:!1},yb=v.memo(({options:e,onSelect:t,disabled:n,currentAgent:r,onOpenChange:l,align:a,onExit:i})=>{const[s,o]=v.useState(!1),u=f=>{o(f),l?.(f)},c=e.filter(f=>f.isShowNew!==1).map(f=>({key:f.key,label:b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[f.icon&&b.jsx("i",{className:f.icon}),b.jsx("span",{children:f.label})]}),onClick:()=>t?.(f)})),d=!!r,h=`rte-agent-badge${d?" rte-agent-badge-selected":s?" rte-agent-badge-active":""}`;return b.jsx(se.Dropdown,{menu:{items:c,selectedKeys:r?[String(r.key)]:[]},disabled:n,placement:"bottomLeft",align:a,autoAdjustOverflow:V8,getPopupContainer:Mr,trigger:["click"],overlayClassName:"rte-agent-dropdown",onOpenChange:u,children:b.jsxs("div",{className:h,style:{cursor:e.length>0?"pointer":"default"},children:[b.jsx("i",{className:"iconfont icon-zhinengti",style:{fontSize:"16px"}}),b.jsx("span",{className:"rte-agent-text",children:"智能体"}),d&&i&&b.jsx("i",{className:"iconfont icon-guanbi rte-tool-close",role:"button","aria-label":"退出智能体",onMouseDown:f=>{f.preventDefault(),f.stopPropagation()},onClick:f=>{f.preventDefault(),f.stopPropagation(),!n&&i()}})]})})});yb.displayName="AgentDropdown";function Eb(e="width"){const t=v.useRef(null),[n,r]=v.useState(!1),l=v.useCallback(()=>{const a=t.current;a&&r(e==="height"?a.scrollHeight>a.clientHeight:a.scrollWidth>a.clientWidth)},[e]);return[t,n,l]}const $8=["全部技能","我的技能","订阅技能","系统技能"],q8=["all","mine","subscribe","system"],W8=20,Y8={system:"系统技能",mine:"我的技能",subscribe:"订阅技能"},Dn="基于用户上传的抖音推广数据,智能分析高潜力商品与爆品抖音推广数据,智能分析高潜力商品与爆品商品机会",Pn=["淘宝天猫","抖音电商","市场选品","京东商城","拼多多","小红书","快手电商","视频号"],Bn="当用户需要尖锐吐槽、阴阳怪气评论、犀利差评、回怼话术或讽刺性改写时使用本技能;用户只需提供对象、场景、原话或想表达的不满,即可触发生成。",j8=[{id:"c1",title:"抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让抖音推广找潜力爆品热让",desc:Dn,tags:Pn,badge:"system",heat:"3.5",usageInstruction:Bn},{id:"c2",title:"【商品评价明细导出助手】问候提示生成助手",desc:Dn,tags:Pn,badge:"system",heat:"6.6",usageInstruction:Bn},{id:"c3",title:"抖音推广找潜力爆品",desc:Dn,tags:Pn,badge:"mine",usageInstruction:Bn},{id:"c4",title:"抖音推广找潜力爆品",desc:Dn,tags:Pn,badge:"subscribe",heat:"6.6",usageInstruction:Bn},{id:"c4",title:"抖音推广找潜力爆品",desc:Dn,tags:Pn,badge:"subscribe",heat:"6.6",usageInstruction:Bn},{id:"c4",title:"抖音推广找潜力爆品",desc:Dn,tags:Pn,badge:"mine",heat:"6.6",usageInstruction:Bn},{id:"c4",title:"抖音推广找潜力爆品",desc:Dn,tags:Pn,badge:"mine",heat:"6.6",usageInstruction:Bn},{id:"c4",title:"抖音推广找潜力爆品",desc:Dn,tags:Pn,badge:"mine",heat:"6.6",usageInstruction:Bn}],G8=e=>({id:e.id,title:e.title,desc:e.desc??"",usageInstruction:e.usageInstruction,tags:e.tags??[],badge:e.badge??"system",heat:e.heat}),K8=()=>b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:b.jsx("path",{d:"M6.2 1a5.2 5.2 0 0 1 4.06 8.45l2.6 2.6a.6.6 0 0 1-.85.85l-2.6-2.6A5.2 5.2 0 1 1 6.2 1Zm0 1.2a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z",fill:"#4E5969"})}),Q8=[()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{d:"M5.99358 8.85714C6.27231 8.85714 6.53962 8.97003 6.73671 9.17096C6.9338 9.37189 7.04453 9.64441 7.04453 9.92857V12.9286C7.04453 13.2127 6.9338 13.4853 6.73671 13.6862C6.53962 13.8871 6.27231 14 5.99358 14H3.05094L2.94375 13.9946C2.6849 13.9676 2.4451 13.8436 2.27076 13.6467C2.09642 13.4497 1.99994 13.1939 2 12.9286V9.92857C1.99994 9.66329 2.09642 9.40742 2.27076 9.21049C2.4451 9.01355 2.6849 8.88956 2.94375 8.8625L3.05094 8.85714H5.99358ZM11.0087 8.74571C11.0323 8.68643 11.0727 8.63567 11.1247 8.59993C11.1768 8.5642 11.2381 8.54511 11.3008 8.54511C11.3636 8.54511 11.4249 8.5642 11.477 8.59993C11.529 8.63567 11.5694 8.68643 11.593 8.74571L12.1521 10.1675C12.168 10.2079 12.1917 10.2446 12.2219 10.2753C12.252 10.3061 12.288 10.3303 12.3276 10.3464L13.8021 10.9486C13.8585 10.9716 13.9072 11.0109 13.9423 11.0615C13.9773 11.1121 13.9973 11.172 13.9997 11.234C14.0022 11.2959 13.987 11.3572 13.956 11.4106C13.9251 11.4639 13.8796 11.507 13.8252 11.5346L12.3024 12.3104C12.2369 12.3438 12.1849 12.3995 12.1553 12.4679L11.5888 13.7675C11.564 13.8242 11.5236 13.8724 11.4725 13.9062C11.4214 13.94 11.3618 13.958 11.3008 13.958C11.2399 13.958 11.1803 13.94 11.1292 13.9062C11.0781 13.8724 11.0377 13.8242 11.0129 13.7675L10.4454 12.4679C10.4158 12.3995 10.3638 12.3438 10.2982 12.3104L8.77753 11.5357C8.7231 11.5081 8.67767 11.465 8.6467 11.4117C8.61574 11.3583 8.60056 11.297 8.603 11.235C8.60545 11.1731 8.62541 11.1132 8.66047 11.0626C8.69554 11.0119 8.74422 10.9727 8.80065 10.9496L10.2751 10.3475C10.3147 10.3313 10.3507 10.3071 10.3809 10.2764C10.411 10.2456 10.4348 10.209 10.4506 10.1686L11.0097 8.74679L11.0087 8.74571ZM3.05094 12.9286H5.99358V9.92857H3.05094V12.9286ZM5.99358 2C6.57371 2 7.04453 2.48 7.04453 3.07143V6.07143C7.04453 6.35559 6.9338 6.62811 6.73671 6.82904C6.53962 7.02997 6.27231 7.14286 5.99358 7.14286H3.05094L2.94375 7.1375C2.6849 7.11044 2.4451 6.98644 2.27076 6.78951C2.09642 6.59258 1.99994 6.33671 2 6.07143V3.07143C1.99994 2.80615 2.09642 2.55028 2.27076 2.35335C2.4451 2.15641 2.6849 2.03242 2.94375 2.00536L3.05094 2H5.99358ZM12.7196 2C12.9984 2 13.2657 2.11288 13.4628 2.31381C13.6598 2.51475 13.7706 2.78727 13.7706 3.07143V6.07143C13.7706 6.35559 13.6598 6.62811 13.4628 6.82904C13.2657 7.02997 12.9984 7.14286 12.7196 7.14286H9.77698L9.66873 7.1375C9.41016 7.10996 9.17075 6.98579 8.99668 6.78893C8.8226 6.59207 8.72619 6.33647 8.72604 6.07143V3.07143C8.72596 2.80632 8.82228 2.55059 8.99641 2.35368C9.17053 2.15677 9.41007 2.03266 9.66873 2.00536L9.77698 2H12.7196ZM9.77698 6.07143H12.7196V3.07143H9.77698V6.07143ZM3.05094 6.07143H5.99358V3.07143H3.05094V6.07143Z",fill:"currentColor"})}),()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[b.jsx("path",{d:"M12.6358 2.44435C12.8831 2.19815 13.2831 2.199 13.5293 2.44624C13.7755 2.69349 13.7746 3.0935 13.5274 3.33968L3.31858 13.5054C3.07133 13.7516 2.67132 13.7508 2.42513 13.5035C2.17893 13.2563 2.17977 12.8563 2.42701 12.6101L12.6358 2.44435Z",fill:"currentColor"}),b.jsx("path",{d:"M5.27212 5.97815L4.9117 7.22356C4.85382 7.42362 4.64471 7.53887 4.44466 7.48097C4.38352 7.46327 4.32785 7.43039 4.28284 7.38538C4.23783 7.34037 4.20495 7.2847 4.18726 7.22356L3.82686 5.97814C3.76198 5.75394 3.64142 5.54982 3.47639 5.38478C3.31136 5.21975 3.10723 5.09917 2.88304 5.03429L1.6376 4.67391C1.43755 4.61602 1.3223 4.40692 1.3802 4.20687C1.39789 4.14573 1.43077 4.09006 1.47578 4.04505C1.52079 4.00004 1.57646 3.96716 1.6376 3.94946L2.88303 3.58908C3.10722 3.5242 3.31135 3.40363 3.47638 3.23859C3.64141 3.07356 3.76198 2.86943 3.82686 2.64523L4.18726 1.39981C4.24514 1.19975 4.45425 1.08451 4.65429 1.1424C4.71544 1.1601 4.77111 1.19298 4.81612 1.23799C4.86112 1.283 4.89401 1.33867 4.9117 1.39981L5.27209 2.64523C5.33696 2.86943 5.45753 3.07356 5.62257 3.2386C5.7876 3.40363 5.99173 3.5242 6.21593 3.58908L7.46135 3.94946C7.66141 4.00735 7.77666 4.21646 7.71876 4.4165C7.70107 4.47764 7.66818 4.53331 7.62318 4.57832C7.57817 4.62333 7.5225 4.65621 7.46135 4.67391L6.21593 5.03429C5.99173 5.09917 5.7876 5.21974 5.62257 5.38478C5.45753 5.54981 5.33696 5.75394 5.27209 5.97814L5.27212 5.97815ZM12.4587 10.7095L12.3937 10.934C12.3494 11.0869 12.1896 11.175 12.0368 11.1308C11.99 11.1172 11.9475 11.0921 11.9131 11.0577C11.8787 11.0233 11.8536 10.9808 11.8401 10.934L11.7751 10.7095C11.7102 10.4853 11.5896 10.2811 11.4246 10.1161C11.2596 9.95108 11.0554 9.83051 10.8312 9.76564L10.6067 9.70065C10.4538 9.65642 10.3657 9.49662 10.41 9.34376C10.4235 9.29703 10.4486 9.25448 10.483 9.22009C10.5174 9.18569 10.5599 9.16056 10.6067 9.14704L10.8312 9.08206C11.0554 9.01718 11.2596 8.89661 11.4246 8.73158C11.5896 8.56655 11.7102 8.36242 11.7751 8.13823L11.8401 7.91366C11.8843 7.76078 12.0441 7.67272 12.197 7.71694C12.2437 7.73046 12.2862 7.75559 12.3206 7.78999C12.355 7.82439 12.3801 7.86693 12.3937 7.91366L12.4587 8.13823C12.5235 8.36242 12.6441 8.56655 12.8091 8.73158C12.9742 8.89661 13.1783 9.01718 13.4025 9.08206L13.6271 9.14704C13.7799 9.19129 13.868 9.35108 13.8238 9.50394C13.8102 9.55067 13.7851 9.59321 13.7507 9.62761C13.7163 9.662 13.6738 9.68713 13.6271 9.70065L13.4025 9.76564C13.1783 9.83051 12.9742 9.95108 12.8091 10.1161C12.6441 10.2811 12.5235 10.4853 12.4587 10.7095ZM8.73493 13.6947L8.66994 13.9193C8.6257 14.0722 8.46591 14.1602 8.31305 14.116C8.26632 14.1025 8.22378 14.0774 8.18938 14.043C8.15498 14.0086 8.12986 13.966 8.11634 13.9193L8.05135 13.6947C7.98647 13.4705 7.8659 13.2664 7.70087 13.1014C7.53584 12.9363 7.33171 12.8158 7.10752 12.7509L6.88295 12.6859C6.73007 12.6417 6.64201 12.4819 6.68624 12.329C6.69976 12.2823 6.72489 12.2397 6.75928 12.2054C6.79368 12.171 6.83622 12.1458 6.88295 12.1323L7.10752 12.0673C7.33171 12.0024 7.53584 11.8819 7.70087 11.7168C7.8659 11.5518 7.98647 11.3477 8.05135 11.1235L8.11634 10.8989C8.16058 10.746 8.32037 10.658 8.47323 10.7022C8.51996 10.7157 8.5625 10.7409 8.5969 10.7753C8.6313 10.8097 8.65642 10.8522 8.66994 10.8989L8.73493 11.1235C8.7998 11.3477 8.92037 11.5518 9.08541 11.7168C9.25044 11.8819 9.45456 12.0024 9.67876 12.0673L9.90333 12.1323C10.0562 12.1766 10.1443 12.3363 10.1 12.4892C10.0865 12.5359 10.0614 12.5785 10.027 12.6129C9.9926 12.6473 9.95006 12.6724 9.90333 12.6859L9.67876 12.7509C9.45456 12.8158 9.25044 12.9363 9.08541 13.1014C8.92037 13.2664 8.7998 13.4705 8.73493 13.6947Z",fill:"currentColor"})]}),()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[b.jsx("path",{d:"M12.2 1.69995H3.8C3.2201 1.69995 2.75 2.17467 2.75 2.76025V13.3632C2.75 13.3754 2.75021 13.3875 2.75061 13.3996C2.76856 13.9361 3.21367 14.2996 3.68722 14.2996C3.86807 14.2996 4.05311 14.2465 4.22003 14.1298L7.39764 11.9084C7.5726 11.7858 7.78102 11.72 7.99466 11.7198C8.2083 11.7197 8.4168 11.7853 8.59191 11.9077L11.7803 14.1308C11.9471 14.2471 12.1318 14.3 12.3124 14.3C12.7861 14.3 13.2314 13.9362 13.2494 13.3996C13.2498 13.3875 13.25 13.3754 13.25 13.3632V2.76025C13.25 2.17467 12.7799 1.69995 12.2 1.69995ZM12.2 13.1434L9.19248 11.0464C8.83927 10.8001 8.42531 10.6699 7.99537 10.6699C7.56449 10.6698 7.14976 10.8005 6.79602 11.0478L3.8 13.1423V2.76025C3.8 2.75802 3.8 2.75322 3.80289 2.74995H12.1971C12.2 2.75322 12.2 2.75801 12.2 2.76025V13.1434Z",fill:"currentColor"}),b.jsx("path",{d:"M10.4117 6.27223H8.52499V4.36187C8.52499 4.07192 8.28994 3.83687 7.99999 3.83687C7.71004 3.83687 7.47499 4.07192 7.47499 4.36187V6.27223H5.58828C5.29833 6.27223 5.06328 6.50728 5.06328 6.79723V6.80751C5.06328 7.09746 5.29833 7.33251 5.58828 7.33251H7.47499V9.24287C7.47499 9.53282 7.71004 9.76787 7.99999 9.76787C8.28994 9.76787 8.52499 9.53282 8.52499 9.24287V7.33251H10.4117C10.7017 7.33251 10.9367 7.09746 10.9367 6.80751V6.79723C10.9367 6.50728 10.7017 6.27223 10.4117 6.27223Z",fill:"currentColor"})]}),()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[b.jsx("path",{d:"M11.8231 2.3562H4.19204C3.60373 2.36812 3.04399 2.61212 2.63483 3.03501C2.22567 3.4579 2.00026 4.02539 2.00775 4.61377V9.14983C2.00026 9.73821 2.22567 10.3057 2.63483 10.7286C3.04399 11.1515 3.60373 11.3955 4.19204 11.4074H11.8231C12.4114 11.3955 12.9711 11.1515 13.3803 10.7286C13.7895 10.3057 14.0149 9.73821 14.0074 9.14983V4.61377C14.0149 4.02539 13.7895 3.4579 13.3803 3.03501C12.9711 2.61212 12.4114 2.36812 11.8231 2.3562ZM12.9152 9.12192C12.9176 9.26764 12.8911 9.41238 12.8375 9.54789C12.7839 9.6834 12.704 9.80701 12.6026 9.91167C12.5012 10.0163 12.3802 10.1 12.2464 10.1579C12.1127 10.2157 11.9688 10.2467 11.8231 10.249H4.19204C3.89804 10.2434 3.61817 10.1218 3.41354 9.91067C3.20891 9.6995 3.09616 9.41594 3.09989 9.12192V4.61377C3.09759 4.46822 3.12403 4.32364 3.17771 4.18833C3.23139 4.05303 3.31126 3.92964 3.41272 3.82526C3.51418 3.72088 3.63525 3.63756 3.76898 3.58006C3.90272 3.52257 4.04648 3.49204 4.19204 3.49022H11.8231C12.1165 3.49572 12.3958 3.61686 12.6004 3.82727C12.8049 4.03768 12.9181 4.32034 12.9152 4.61377V9.12192Z",fill:"currentColor"}),b.jsx("path",{d:"M11.0091 13.6431H5.01099C4.862 13.6431 4.71911 13.5839 4.61376 13.4785C4.50841 13.3732 4.44922 13.2303 4.44922 13.0813C4.44922 12.9323 4.50841 12.7894 4.61376 12.6841C4.71911 12.5787 4.862 12.5195 5.01099 12.5195H11.0091C11.1581 12.5195 11.3009 12.5787 11.4063 12.6841C11.5117 12.7894 11.5708 12.9323 11.5708 13.0813C11.5708 13.2303 11.5117 13.3732 11.4063 13.4785C11.3009 13.5839 11.1581 13.6431 11.0091 13.6431Z",fill:"currentColor"})]})],X8=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[b.jsx("path",{d:"M14.365 4.88313C13.9832 4.88313 13.7286 5.13768 13.7286 5.51949V12.9649C13.7286 13.4104 13.4104 13.7286 12.965 13.7286H3.03771C2.59225 13.7286 2.27407 13.4104 2.27407 12.9649V3.03768C2.27407 2.59222 2.59225 2.27404 3.03771 2.27404H6.66498C7.0468 2.27404 7.30134 2.01949 7.30134 1.63768C7.30134 1.25586 7.0468 1.00131 6.66498 1.00131H3.03771C1.89225 1.00131 1.00134 1.89222 1.00134 3.03768V12.9649C1.00134 14.1104 1.89225 15.0013 3.03771 15.0013H12.965C14.1104 15.0013 15.0013 14.1104 15.0013 12.9649V5.51949C15.0013 5.20131 14.7468 4.88313 14.365 4.88313Z",fill:"#666666"}),b.jsx("path",{d:"M5.2637 7.55586C5.00916 7.30131 4.62734 7.30131 4.37279 7.55586C4.11825 7.8104 4.11825 8.19222 4.37279 8.44677L7.55461 11.6286C7.61825 11.6922 7.68188 11.7559 7.74552 11.7559C7.80916 11.8195 7.93643 11.8195 8.00007 11.8195C8.0637 11.8195 8.19098 11.8195 8.25461 11.7559C8.31825 11.6922 8.38188 11.6922 8.44552 11.6286L11.6273 8.44677C11.8819 8.19222 11.8819 7.8104 11.6273 7.55586C11.3728 7.30131 10.991 7.30131 10.7364 7.55586L8.63643 9.65586V8.00131C8.63643 4.81949 11.1819 2.27404 14.3637 2.27404C14.7455 2.27404 15.0001 2.01949 15.0001 1.63768C15.0001 1.25586 14.7455 1.00131 14.3637 1.00131C10.4819 1.00131 7.3637 4.11949 7.3637 8.00131V9.65586L5.2637 7.55586Z",fill:"#666666"})]}),J8=()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:b.jsx("path",{d:"M9.60187 14.5546C9.23569 14.5546 8.94275 14.4081 8.6498 14.1884C8.35686 13.8955 8.13716 13.5293 8.13716 13.0899V11.6251C6.52597 11.6251 3.88948 12.0646 2.49801 13.9687C2.2783 14.3349 1.76565 14.5546 1.32623 14.6278H1.10653C0.374166 14.4813 -0.0652517 13.8222 0.00799105 13.0899C0.374166 9.94073 1.47272 7.67041 3.37683 6.13247C4.76831 5.03394 6.3795 4.44805 8.13716 4.30157V2.9101C8.13716 2.25098 8.4301 1.66509 9.01599 1.44538C9.52864 1.29892 10.1145 1.37215 10.5539 1.81157L15.241 6.57189C15.6072 6.86484 15.8269 7.30424 15.9001 7.81689C15.9734 8.32955 15.8269 8.8422 15.4607 9.20837C15.3875 9.28161 15.3143 9.42807 15.1678 9.50132L10.6272 14.1152C10.3342 14.4081 9.96804 14.5546 9.60187 14.5546ZM8.43009 10.1604H9.60187V13.0899L14.2157 8.32955L14.289 8.25631C14.3622 8.18308 14.3622 8.0366 14.3622 7.96336C14.3622 7.81689 14.289 7.74366 14.2157 7.67041L14.1425 7.59718L9.52864 2.9101V5.69306L8.50333 5.7663C6.96539 5.7663 5.50066 6.27894 4.25567 7.23101C2.79094 8.40278 1.83889 10.3069 1.54595 12.7969C3.37683 10.5266 6.5992 10.1604 8.43009 10.1604Z",fill:"currentColor"})}),Z8=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("path",{d:"M13.85 7.35C13.4903 7.35 13.2 7.64033 13.2 8V12.3333C13.2 12.8114 12.8114 13.2 12.3333 13.2H3.66667C3.18856 13.2 2.8 12.8114 2.8 12.3333V3.66667C2.8 3.18856 3.18856 2.8 3.66667 2.8H8C8.35967 2.8 8.65 2.50967 8.65 2.15C8.65 1.79033 8.35967 1.5 8 1.5H3.23333C2.27567 1.5 1.5 2.27567 1.5 3.23333V12.7667C1.5 13.7243 2.27567 14.5 3.23333 14.5H12.7667C13.7243 14.5 14.5 13.7243 14.5 12.7667V8C14.5 7.64033 14.2097 7.35 13.85 7.35Z",fill:"currentColor"}),b.jsx("path",{d:"M5.7483 10.4682C6.00108 10.721 6.41419 10.721 6.66697 10.4682L13.7144 3.42075C13.9672 3.16797 13.9672 2.75486 13.7144 2.50208C13.4616 2.24931 13.0485 2.24931 12.7957 2.50208L5.7483 9.54808C5.49552 9.80086 5.49552 10.2154 5.7483 10.4682Z",fill:"currentColor"})]}),eA=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("path",{d:"M4.12488 5.02012H11.8779L11.1331 12.6138C11.1164 12.7828 11.0373 12.9396 10.9114 13.0536C10.7855 13.1676 10.6217 13.2307 10.4518 13.2306H5.55096C5.38127 13.2304 5.21769 13.1672 5.09198 13.0533C4.96627 12.9393 4.88739 12.7827 4.87067 12.6138L4.12488 5.02012ZM3.80233 3.74945C3.66582 3.74934 3.53081 3.77782 3.40598 3.83306C3.28116 3.8883 3.16929 3.96908 3.07757 4.07018C2.98586 4.17128 2.91634 4.29048 2.8735 4.42008C2.83065 4.54969 2.81542 4.68683 2.8288 4.82268L3.60586 12.738C3.65342 13.2208 3.87886 13.6688 4.23837 13.9947C4.59787 14.3206 5.06573 14.5012 5.55096 14.5012H10.4518C10.9371 14.5012 11.4049 14.3206 11.7644 13.9947C12.1239 13.6688 12.3494 13.2208 12.3969 12.738L13.175 4.82268C13.1883 4.68683 13.1731 4.54969 13.1303 4.42008C13.0874 4.29048 13.0179 4.17128 12.9262 4.07018C12.8345 3.96908 12.7226 3.8883 12.5978 3.83306C12.4729 3.77782 12.3379 3.74934 12.2014 3.74945H3.80135H3.80233Z",fill:"currentColor"}),b.jsx("path",{d:"M1.5 4.28322C1.5 4.11472 1.56694 3.95312 1.68608 3.83397C1.80523 3.71482 1.96683 3.64789 2.13533 3.64789H13.8646C13.948 3.64787 14.0306 3.6643 14.1077 3.69622C14.1848 3.72814 14.2549 3.77494 14.3139 3.83394C14.3729 3.89293 14.4197 3.96298 14.4516 4.04007C14.4836 4.11715 14.5 4.19978 14.5 4.28322C14.5 4.36666 14.4836 4.44929 14.4516 4.52638C14.4197 4.60347 14.3729 4.67351 14.3139 4.73251C14.2549 4.7915 14.1848 4.8383 14.1077 4.87022C14.0306 4.90214 13.948 4.91857 13.8646 4.91855H2.13533C1.96683 4.91855 1.80523 4.85162 1.68608 4.73247C1.56694 4.61332 1.5 4.45172 1.5 4.28322Z",fill:"currentColor"}),b.jsx("path",{d:"M5.02081 3.11277C5.02081 2.22135 5.74314 1.5 6.63358 1.5H9.3704C10.2618 1.5 10.9832 2.22135 10.9832 3.11277V4.92102H5.02081V3.11277ZM6.63358 2.77067C6.58866 2.77067 6.54417 2.77952 6.50266 2.79671C6.46116 2.8139 6.42345 2.8391 6.39168 2.87087C6.35991 2.90263 6.33471 2.94035 6.31752 2.98185C6.30033 3.02336 6.29148 3.06784 6.29148 3.11277V3.65036H9.7125V3.11277C9.7125 3.06784 9.70366 3.02336 9.68646 2.98185C9.66927 2.94035 9.64407 2.90263 9.61231 2.87087C9.58054 2.8391 9.54282 2.8139 9.50132 2.79671C9.45981 2.77952 9.41533 2.77067 9.3704 2.77067H6.63358Z",fill:"currentColor"})]}),tA=()=>b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{d:"M8.87301 3.52364C9.08579 3.52364 9.28984 3.60817 9.4403 3.75862C9.59075 3.90907 9.67527 4.11313 9.67527 4.3259V11.8137C9.67527 12.0265 9.59075 12.2305 9.4403 12.381C9.28984 12.5314 9.08579 12.6159 8.87301 12.6159H2.98976C2.88441 12.6159 2.78008 12.5952 2.68275 12.5549C2.58541 12.5146 2.49697 12.4555 2.42248 12.381C2.34798 12.3065 2.28889 12.218 2.24857 12.1207C2.20825 12.0234 2.1875 11.919 2.1875 11.8137V4.3259C2.1875 4.11313 2.27202 3.90907 2.42248 3.75862C2.57293 3.60817 2.77699 3.52364 2.98976 3.52364H8.87301ZM8.60559 4.59332H3.25718V11.5463H8.60559V4.59332ZM11.0102 1.38428C11.2098 1.38415 11.4022 1.45838 11.5499 1.59248C11.6977 1.72658 11.7901 1.91092 11.8093 2.10952L11.8125 2.18654V9.40315C11.8123 9.53947 11.7601 9.67059 11.6666 9.76971C11.573 9.86884 11.4451 9.92849 11.309 9.93648C11.1729 9.94447 11.0389 9.90019 10.9344 9.8127C10.8298 9.7252 10.7627 9.60109 10.7466 9.46573L10.7428 9.40315V2.45396H5.39655C5.26555 2.45394 5.13911 2.40585 5.04121 2.3188C4.94332 2.23175 4.88078 2.1118 4.86545 1.9817L4.86171 1.91912C4.86172 1.78812 4.90982 1.66168 4.99687 1.56379C5.08392 1.46589 5.20387 1.40335 5.33397 1.38802L5.39655 1.38428H11.0102Z",fill:"currentColor"})}),nA=()=>b.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{d:"M1.5548 5.88011C1.4304 5.76419 1.26586 5.70108 1.09584 5.70408C0.925831 5.70708 0.76362 5.77595 0.643383 5.89619C0.523147 6.01643 0.454274 6.17864 0.451274 6.34865C0.448274 6.51867 0.511382 6.68321 0.627302 6.80761L5.0023 11.1826C5.12535 11.3055 5.29215 11.3745 5.46605 11.3745C5.63996 11.3745 5.80676 11.3055 5.9298 11.1826L13.3673 3.74511C13.4832 3.62071 13.5463 3.45617 13.5433 3.28615C13.5403 3.11614 13.4715 2.95393 13.3512 2.83369C13.231 2.71345 13.0688 2.64458 12.8988 2.64158C12.7287 2.63858 12.5642 2.70169 12.4398 2.81761L5.46605 9.79049L1.5548 5.87923V5.88011Z",fill:"currentColor"})}),rA=()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{d:"M9.60188 14.5546C9.23571 14.5546 8.94276 14.4081 8.64982 14.1884C8.35687 13.8955 8.13717 13.5293 8.13717 13.0899V11.6251C6.52599 11.6251 3.88949 12.0646 2.49803 13.9687C2.27831 14.3349 1.76566 14.5546 1.32625 14.6278H1.10654C0.374181 14.4813 -0.0652364 13.8222 0.00800631 13.0899C0.374181 9.94073 1.47273 7.67041 3.37685 6.13247C4.76833 5.03394 6.37951 4.44805 8.13717 4.30157V2.9101C8.13717 2.25098 8.43012 1.66509 9.01601 1.44538C9.52865 1.29892 10.1145 1.37215 10.5539 1.81157L15.241 6.57189C15.6072 6.86484 15.8269 7.30424 15.9002 7.81689C15.9734 8.32955 15.8269 8.8422 15.4607 9.20837C15.3875 9.28161 15.3143 9.42807 15.1678 9.50132L10.6272 14.1152C10.3342 14.4081 9.96806 14.5546 9.60188 14.5546ZM8.4301 10.1604H9.60188V13.0899L14.2157 8.32955L14.289 8.25631C14.3622 8.18308 14.3622 8.0366 14.3622 7.96336C14.3622 7.81689 14.289 7.74366 14.2157 7.67041L14.1425 7.59718L9.52865 2.9101V5.69306L8.50335 5.7663C6.9654 5.7663 5.50068 6.27894 4.25568 7.23101C2.79096 8.40278 1.83891 10.3069 1.54596 12.7969C3.37685 10.5266 6.59922 10.1604 8.4301 10.1604Z",fill:"#7C3AED"})}),lA=({code:e})=>{const{message:t}=se.App.useApp(),[n,r]=v.useState(!1),l=async a=>{a.stopPropagation();try{await navigator.clipboard.writeText(e),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{t.error("复制失败")}};return b.jsxs("div",{className:"rte-skill-share",onClick:a=>a.stopPropagation(),children:[b.jsxs("div",{className:"rte-skill-share-head",children:[b.jsxs("div",{className:"rte-skill-share-title",children:[b.jsx(rA,{}),b.jsx("span",{children:"分享码"})]}),b.jsx("span",{className:"rte-skill-share-hint",children:"复制后粘贴在「导入技能」即可使用"})]}),b.jsxs("div",{className:"rte-skill-share-box",children:[b.jsx("span",{className:"rte-skill-share-code",children:e}),b.jsxs("button",{type:"button",className:`rte-skill-share-copy${n?" rte-skill-share-copy-done":""}`,onClick:l,children:[n?b.jsx(nA,{}):b.jsx(tA,{}),b.jsx("span",{children:n?"已复制":"复制"})]})]})]})},aA=({card:e,selected:t,onClick:n,onShare:r,onEdit:l,onDelete:a,onUse:i,getPopupContainer:s})=>{const o=I=>I.stopPropagation(),[u,c,d]=Eb(),[h,f,m]=Eb("height"),[y,g]=v.useState(!1),[E,N]=v.useState(""),[A,P]=v.useState(!1),L=y||A,S=async I=>{if(g(I),!I){N("");return}try{const w=await r();N(typeof w=="string"&&w?w:`SK-${e.id}`)}catch{N(`SK-${e.id}`)}};return b.jsxs("div",{className:`rte-skill-card${t?" rte-skill-card-selected":""}${L?" rte-skill-card-pinned":""}`,onClick:n,"data-rte-skill-card":"true","aria-pressed":t,children:[b.jsxs("div",{className:"rte-skill-card-header",children:[b.jsx(zn,{title:c?e.title:"",placement:"top",mouseEnterDelay:.3,getPopupContainer:s,zIndex:1e4,children:b.jsx("div",{className:"rte-skill-card-title",ref:u,onMouseEnter:d,children:e.title})}),b.jsxs("div",{className:`rte-skill-card-aside${L?" rte-skill-card-aside-pinned":""}`,children:[b.jsx("span",{className:`rte-skill-card-badge rte-skill-card-badge-${e.badge}`,children:Y8[e.badge]}),b.jsxs("div",{className:`rte-skill-card-actions${L?" rte-skill-card-actions-pinned":""}`,children:[e.badge==="mine"&&b.jsx(se.Popover,{open:y,onOpenChange:S,trigger:"click",placement:"bottomRight",arrow:!1,overlayClassName:"rte-skill-share-popover",zIndex:1e4,getPopupContainer:s,content:b.jsx(lA,{code:E}),children:b.jsx("button",{type:"button",className:`rte-skill-card-action${y?" rte-skill-card-action-active":""}`,title:"分享","aria-label":"分享",onClick:o,children:b.jsx(J8,{})})}),e.badge==="mine"&&b.jsx("button",{type:"button",className:"rte-skill-card-action",title:"编辑","aria-label":"编辑",onClick:I=>{o(I),l()},children:b.jsx(Z8,{})}),e.badge!=="mine"&&b.jsx("button",{type:"button",className:"rte-skill-card-action",title:"查看详情","aria-label":"查看详情",onClick:I=>{o(I),l()},children:b.jsx("i",{className:"iconfont icon-chakanjinengxiangqing"})}),e.badge!=="system"&&b.jsx(se.Popconfirm,{title:"删除技能后不可恢复,确认删除吗?",open:A,onOpenChange:P,okText:"确认",cancelText:"取消",placement:"bottomRight",arrow:!1,overlayClassName:"rte-skill-delete-confirm",zIndex:1e4,icon:b.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.5 9C1.5 4.85786 4.85786 1.5 9 1.5C13.1421 1.5 16.5 4.85786 16.5 9C16.5 13.1421 13.1421 16.5 9 16.5C4.85786 16.5 1.5 13.1421 1.5 9ZM8.25 11.25V12.75H9.75V11.25H8.25ZM9.75 10.5L9.75 5.25H8.25L8.25 10.5H9.75Z",fill:"#F53F3F"})}),okButtonProps:{danger:!0},getPopupContainer:s,onConfirm:I=>{I?.stopPropagation(),P(!1),a()},onCancel:I=>{I?.stopPropagation(),P(!1)},children:b.jsx("button",{type:"button",className:`rte-skill-card-action rte-skill-card-action-delete${A?" rte-skill-card-action-active":""}`,title:"删除","aria-label":"删除",onClick:o,children:b.jsx(eA,{})})})]})]})]}),b.jsx(zn,{title:f?e.desc:"",placement:"top",mouseEnterDelay:.3,getPopupContainer:s,zIndex:1e4,children:b.jsx("div",{className:"rte-skill-card-desc",ref:h,onMouseEnter:m,children:e.desc})})]})},Tb=v.memo(({selectedId:e,onSelect:t,onCardClick:n,onAction:r,skillListFetch:l,onHeaderAction:a,showCreateSkill:i=!0,createDisabled:s})=>{const{message:o}=se.App.useApp(),[u,c]=v.useState(0),[d,h]=v.useState(l?[]:j8),[f,m]=v.useState(!1),[y,g]=v.useState(!!l),E=v.useRef(0),N=v.useCallback(()=>{g(!0),E.current=window.setTimeout(()=>{g(!1),m(!0)},300)},[]),A=v.useCallback(()=>{window.clearTimeout(E.current),g(!1),m(!1)},[]),[P,L]=v.useState(""),[S,I]=v.useState(""),w=_r(),k=w?()=>w:void 0,M=v.useRef(0),_=v.useRef(null),H=v.useRef(0),$=v.useRef(0),F=v.useCallback(()=>{const C=_.current;C&&(C.classList.add("is-scrolling"),window.clearTimeout($.current),$.current=window.setTimeout(()=>{C.classList.remove("is-scrolling")},300))},[]);v.useEffect(()=>{const C=window.setTimeout(()=>I(P.trim()),300);return()=>window.clearTimeout(C)},[P]);const T=v.useCallback(async()=>{if(!l)return;const C=++M.current;N();try{const Z=await l({skillType:q8[u],pageIndex:1,pageSize:W8,keyword:S||void 0});if(C!==M.current)return;h(Z.map(G8))}catch{C===M.current&&o.error("技能列表加载失败")}finally{C===M.current&&A()}},[l,u,S,N,A]);v.useEffect(()=>{T()},[T]),v.useEffect(()=>{_.current?.scrollTo({top:0})},[u,S]);const[R,z]=v.useState(!1);v.useLayoutEffect(()=>{if(u===0&&!f&&d.length>0){const C=_.current;C&&(H.current=C.clientHeight),z(!1)}else!f&&d.length>0&&H.current>0?requestAnimationFrame(()=>{const C=_.current;C&&z(C.scrollHeight<H.current)}):z(!1)},[u,f,d]);const q=C=>{n?.({id:C.id,title:C.title}),t?.({id:C.id,title:C.title,desc:C.desc||void 0,usageInstruction:C.usageInstruction})},G=async C=>{try{await r?.("delete",{id:C.id,title:C.title})}catch{o.error("删除失败");return}e===C.id&&t?.(null),l?await T():h(Z=>Z.filter(re=>re.id!==C.id)),o.success("已删除技能")};return b.jsxs("div",{className:"rte-skill-panel",children:[b.jsxs("div",{className:"rte-skill-panel-header",children:[b.jsxs("div",{className:"rte-skill-search",children:[b.jsx("input",{className:"rte-skill-search-input",placeholder:"请输入想搜索的技能名称或描述",value:P,onChange:C=>L(C.target.value)}),b.jsx("span",{className:"rte-skill-search-icon",children:b.jsx(K8,{})})]}),b.jsxs("div",{className:"rte-skill-actions",children:[b.jsxs("button",{type:"button",className:"rte-skill-import-btn",onClick:()=>a?.("import"),children:[b.jsx(X8,{}),b.jsx("span",{children:"导入技能"})]}),i&&b.jsxs("button",{type:"button",className:`rte-skill-create-btn${s?" rte-skill-create-btn-disabled":""}`,disabled:s,onClick:()=>!s&&a?.("create"),children:[b.jsx("i",{className:"iconfont icon-jiyudangqianduihuachuangjianjineng"}),b.jsx("span",{children:"基于当前会话创建技能"})]})]})]}),b.jsxs("div",{className:"rte-skill-panel-body",children:[b.jsx("div",{className:"rte-skill-sidebar",children:$8.map((C,Z)=>{const re=Q8[Z];return b.jsxs("div",{className:`rte-skill-sidebar-item${Z===u?" rte-skill-sidebar-item-active":""}`,onClick:()=>c(Z),children:[b.jsx(re,{}),b.jsx("span",{children:C})]},C)})}),f?b.jsx("div",{className:"rte-skill-cards-status",style:H.current?{minHeight:H.current}:void 0,children:b.jsx(se.Spin,{})}):d.length===0?b.jsx("div",{className:"rte-skill-cards-status",style:H.current?{minHeight:H.current}:void 0,children:!y&&b.jsxs(b.Fragment,{children:[b.jsx("img",{className:"rte-skill-empty-img",src:"https://sealseek-public-read.oss-cn-hangzhou.aliyuncs.com/file/website/kongzhuangtai.svg",alt:"暂无数据"}),b.jsx("span",{className:"rte-skill-empty-text",children:"暂无技能"})]})}):b.jsxs("div",{className:"rte-skill-cards",ref:_,onScroll:F,style:u!==0&&H.current?{minHeight:H.current}:void 0,children:[d.map(C=>b.jsx(aA,{card:C,selected:e===C.id,onClick:()=>q(C),onShare:()=>r?.("share",{id:C.id,title:C.title}),onEdit:()=>r?.("edit",{id:C.id,title:C.title}),onDelete:()=>G(C),onUse:()=>t?.({id:C.id,title:C.title,desc:C.desc||void 0,usageInstruction:C.usageInstruction}),getPopupContainer:k},C.id)),R&&b.jsx("div",{className:"rte-skill-cards-end",children:"暂无更多技能~"})]})]})]})});Tb.displayName="SkillPanel";const Ei=4,Cb=()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{d:"M10.4103 0.600098C11.2711 0.600098 11.9863 1.2657 11.9863 2.1081C11.9863 2.2985 11.9479 2.4873 11.8751 2.6641L10.9119 4.9921H12.6255C13.4455 4.9921 14.1327 5.5961 14.1959 6.3817L14.2007 6.5009C14.2007 6.8905 14.0431 7.2641 13.7639 7.5433L6.28226 15.0321C6.05292 15.2576 5.74735 15.3888 5.42594 15.3999C5.10452 15.411 4.79062 15.3012 4.54626 15.0921C4.19986 14.7929 4.05346 14.3297 4.16706 13.9113L5.20146 9.4593H3.28146C2.63906 9.4593 2.09506 8.9873 2.03666 8.3649L2.03186 8.2537C2.03186 8.0993 2.06306 7.9457 2.12066 7.8073L4.67986 1.5513C4.92146 0.970498 5.50306 0.600098 6.14306 0.600098H10.4103ZM10.4103 1.8001H6.14386C5.97906 1.8001 5.83986 1.8889 5.78866 2.0105L3.23586 8.2521C3.24066 8.2521 3.24626 8.2537 3.25346 8.2553L3.28306 8.2585H5.55506C5.62866 8.2585 5.70146 8.2665 5.77186 8.2833C6.26786 8.4001 6.58466 8.8937 6.45506 9.3713L5.33506 14.1857L5.35586 14.1969C5.37426 14.2017 5.39586 14.2009 5.41266 14.1953L5.43426 14.1833L12.9151 6.6953C12.9414 6.67028 12.9625 6.64029 12.9772 6.60706C12.9919 6.57383 12.9999 6.53802 13.0007 6.5017C13.0007 6.3417 12.8415 6.1937 12.6247 6.1937H10.4887C10.3799 6.1937 10.2719 6.1745 10.1687 6.1377C10.0535 6.09806 9.94761 6.03536 9.85749 5.95342C9.76737 5.87149 9.6949 5.77204 9.64451 5.66115C9.59412 5.55026 9.56687 5.43027 9.56442 5.30849C9.56197 5.18672 9.58437 5.06572 9.63026 4.9529L10.7671 2.2049C10.7797 2.17445 10.7862 2.14184 10.7863 2.1089C10.7863 1.9481 10.6279 1.8001 10.4111 1.8001H10.4103ZM7.10386 2.6433C7.25151 2.70252 7.3696 2.81796 7.43215 2.96423C7.49471 3.1105 7.49662 3.27562 7.43746 3.4233L6.79746 5.0233C6.73604 5.16775 6.62045 5.28238 6.4755 5.34261C6.33054 5.40283 6.16775 5.40385 6.02205 5.34544C5.87635 5.28704 5.75934 5.17386 5.69612 5.03018C5.6329 4.88651 5.6285 4.72378 5.68386 4.5769L6.32386 2.9769C6.38308 2.82925 6.49852 2.71116 6.64479 2.6486C6.79106 2.58605 6.95618 2.58414 7.10386 2.6433Z",fill:"currentColor",stroke:"currentColor",strokeWidth:"0.2"})}),Sb=v.memo(({disabled:e,selectedSkill:t,onSkillSelect:n,onSkillCardClick:r,onSkillAction:l,skillListFetch:a,onSkillHeaderAction:i,showCreateSkill:s,skillPanelOpen:o,onSkillPanelOpenChange:u,createDisabled:c,skillPanelOpenDelay:d})=>{const[h,f]=v.useState(!1),m=o!==void 0,[y,g]=v.useState(o??!1),E=v.useRef(0);v.useEffect(()=>{if(m)return o?d&&d>0?E.current=window.setTimeout(()=>g(!0),d):g(!0):(window.clearTimeout(E.current),g(!1)),()=>window.clearTimeout(E.current)},[m,o,d]);const N=m?y:h,A=v.useCallback(T=>{const R=typeof T=="function"?T(N):T;m||f(R),u?.(R)},[m,N,u]),[P,L]=v.useState(null),S=v.useRef(null),I=v.useRef(null),w=_r(),k=v.useCallback(()=>(S.current?.closest(".rich-text-editor")??S.current)?.getBoundingClientRect()??null,[]),M=v.useCallback(()=>{const T=k();if(!T)return;const R=Math.max(0,window.innerHeight-T.bottom-Ei*2),z=Math.max(0,T.top-Ei*2),G=(I.current?.scrollHeight??0)>R&&z>R,C=G?z:R,re=(I.current?.offsetParent??w)?.getBoundingClientRect(),D=re?.left??0,de=re?.top??0,me=T.left-D;if(G){const ce=(re?.height??window.innerHeight)-(T.top-Ei-de);L({left:me,bottom:ce,width:T.width,maxHeight:C})}else L({left:me,top:T.bottom+Ei-de,width:T.width,maxHeight:C})},[k,w]);v.useLayoutEffect(()=>{if(!N)return;M();const T=requestAnimationFrame(M);window.addEventListener("scroll",M,!0),window.addEventListener("resize",M);const R=I.current?new ResizeObserver(M):null;R&&I.current&&R.observe(I.current);const z=S.current?.closest(".rich-text-editor"),q=z?new ResizeObserver(M):null;return q&&z&&q.observe(z),()=>{cancelAnimationFrame(T),window.removeEventListener("scroll",M,!0),window.removeEventListener("resize",M),R?.disconnect(),q?.disconnect()}},[N,M]),v.useEffect(()=>{if(!N||m)return;const T=R=>{const z=R.target;S.current?.contains(z)||I.current?.contains(z)||z instanceof Element&&z.closest(".rte-skill-delete-confirm, .rte-skill-share-popover")||A(!1)};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[N,m]);const _=v.useCallback(()=>{e||A(T=>!T)},[e]),H=v.useCallback(T=>{n?.(T),T&&A(!1)},[n]),$=!!t,F=`rte-skill-badge${$?" rte-skill-badge-selected":N?" rte-skill-badge-active":""}`;return b.jsxs(b.Fragment,{children:[b.jsxs("div",{ref:S,className:F,onClick:_,"data-rte-skill-button":"true","aria-pressed":N||$,style:{cursor:e?"not-allowed":"pointer"},children:[b.jsx(Cb,{}),b.jsx("span",{className:"rte-skill-text",children:"技能"}),(N||$)&&b.jsx("i",{className:"iconfont icon-guanbi rte-tool-close",role:"button","aria-label":"退出技能",onMouseDown:T=>{T.preventDefault(),T.stopPropagation()},onClick:T=>{T.preventDefault(),T.stopPropagation(),!e&&(A(!1),n?.(null))}})]}),N&&Li.createPortal(b.jsx("div",{ref:I,className:"rte-skill-panel-popup","data-placement":P?.bottom!==void 0?"top":"bottom",style:{position:"fixed",left:P?.left??0,top:P?.top,bottom:P?.bottom,width:P?.width,zIndex:9999,maxHeight:P?.maxHeight,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:16,visibility:P?"visible":"hidden"},children:b.jsx(Tb,{selectedId:t?.id??null,onSelect:H,onCardClick:r,onAction:l,skillListFetch:a,onHeaderAction:i,showCreateSkill:s,createDisabled:c})}),w??document.body)]})});Sb.displayName="SkillButton";const iA=10*1024*1024,sA=50*1024*1024,oA="图片大小不能超过 10MB",uA="文件总大小不能超过 50MB",cA=e=>e.type?.startsWith("image/")||/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e.name||""),dA=(e,t)=>{let n=!1;const r=t.filter(o=>cA(o)&&o.size>iA?(n=!0,!1):!0),l=e.reduce((o,u)=>o+u.size,0),a=[];let i=l,s=!1;for(const o of r){if(i+o.size>sA){s=!0;break}a.push(o),i+=o.size}return{accepted:a,imageOversize:n,totalExceeded:s}},xb=v.memo(({files:e,onChange:t,disabled:n,onAssetLibraryClick:r})=>{const{message:l}=se.App.useApp(),a=v.useRef(null),[i,s]=v.useState(!1),o=v.useCallback(d=>{const h=Array.from(d.target.files??[]);if(d.target.value="",h.length===0)return;const{accepted:f,imageOversize:m,totalExceeded:y}=dA(e,h);m&&l.error(oA),y&&l.error(uA),f.length>0&&t([...e,...f])},[e,t,l]),u=v.useCallback(({key:d})=>{n||(s(!1),d==="upload"?a.current?.click():d==="asset-library"&&r?.())},[n,r]),c=[{key:"upload",label:"上传文件或图片",icon:b.jsx("i",{className:"iconfont icon-shangchuan1",style:{fontSize:"14px"}})},{key:"asset-library",label:"选择资产库文件",icon:b.jsx("i",{className:"iconfont icon-wenjianjia",style:{fontSize:"14px"}})}];return b.jsxs("div",{className:"rte-footer-upload",children:[b.jsx(se.Dropdown,{menu:{items:c,onClick:u},trigger:["click"],placement:"topLeft",disabled:n,open:i,onOpenChange:s,rootClassName:"rte-upload-dropdown-menu",children:b.jsx("div",{className:"rte-footer-upload-btn",title:"上传",style:{cursor:n?"not-allowed":"pointer",opacity:n?.6:1,pointerEvents:n?"none":"auto"},children:b.jsx("i",{className:"iconfont icon-jia",style:{fontSize:"16px"}})})}),b.jsx("input",{ref:a,type:"file",multiple:!0,style:{display:"none"},onChange:o})]})});xb.displayName="UploadButton";const fA=()=>b.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:b.jsx("path",{d:"M12.0699 1.36475C13.3354 1.36475 14.3603 2.39083 14.3603 3.65507V7.92055C14.3603 8.10909 14.2854 8.28992 14.152 8.42324C14.0187 8.55656 13.8379 8.63146 13.6494 8.63146C13.4608 8.63146 13.28 8.55656 13.1467 8.42324C13.0133 8.28992 12.9384 8.10909 12.9384 7.92055V3.65507C12.9384 3.42473 12.8469 3.20382 12.6841 3.04095C12.5212 2.87807 12.3003 2.78657 12.0699 2.78657H2.59111C2.36077 2.78657 2.13986 2.87807 1.97698 3.04095C1.81411 3.20382 1.72261 3.42473 1.72261 3.65507V7.68121C2.56978 6.63735 3.37666 6.10417 4.20014 6.10417C5.39447 6.10417 7.15517 7.56983 9.80806 10.5711C9.93297 10.7125 9.99659 10.8977 9.98492 11.086C9.97326 11.2743 9.88726 11.4503 9.74585 11.5752C9.67583 11.6371 9.59432 11.6845 9.50596 11.7149C9.4176 11.7452 9.32413 11.7579 9.23089 11.7521C9.04257 11.7404 8.8666 11.6544 8.74169 11.513C6.41226 8.87791 4.7902 7.52599 4.20014 7.52599C3.71198 7.52599 2.91931 8.276 1.95602 9.8329L1.72379 10.2192V12.3448C1.72379 12.8247 2.11242 13.2133 2.59229 13.2133H10.2465C10.435 13.2133 10.6158 13.2882 10.7491 13.4215C10.8825 13.5548 10.9574 13.7357 10.9574 13.9242C10.9574 14.1128 10.8825 14.2936 10.7491 14.4269C10.6158 14.5602 10.435 14.6351 10.2465 14.6351H2.59111C1.98367 14.6351 1.40112 14.3938 0.971602 13.9643C0.542083 13.5348 0.300781 12.9522 0.300781 12.3448V3.65507C0.300781 2.39083 1.32568 1.36475 2.59111 1.36475H12.0699ZM13.2074 9.58053C13.6162 9.55328 13.4242 10.5083 14.0581 11.1007C14.6908 11.6931 15.6755 11.4881 15.7003 11.9147C15.7252 12.3412 14.6956 12.269 14.16 12.827C13.6221 13.3839 13.7406 14.2145 13.301 14.2346C12.8626 14.256 13.1067 13.391 12.41 12.8081C11.7133 12.2263 10.8851 12.3886 10.8851 11.9739C10.8851 11.5592 11.7927 11.8021 12.4029 11.173C13.0131 10.5426 12.7986 9.6066 13.2086 9.58053H13.2074ZM10.0948 3.81384C10.3333 3.81384 10.5695 3.86082 10.7899 3.9521C11.0103 4.04339 11.2105 4.17718 11.3792 4.34585C11.5478 4.51451 11.6816 4.71475 11.7729 4.93512C11.8642 5.1555 11.9112 5.39169 11.9112 5.63022C11.9112 5.86875 11.8642 6.10495 11.7729 6.32532C11.6816 6.5457 11.5478 6.74593 11.3792 6.9146C11.2105 7.08327 11.0103 7.21706 10.7899 7.30834C10.5695 7.39962 10.3333 7.44661 10.0948 7.44661C9.61306 7.44661 9.15105 7.25524 8.81041 6.9146C8.46978 6.57396 8.27841 6.11196 8.27841 5.63022C8.27841 5.14849 8.46978 4.68648 8.81041 4.34585C9.15105 4.00521 9.61306 3.81384 10.0948 3.81384ZM10.0948 5.0769C10.0221 5.0769 9.95017 5.09121 9.88304 5.11902C9.81591 5.14682 9.75491 5.18758 9.70353 5.23896C9.65215 5.29034 9.61139 5.35134 9.58358 5.41847C9.55578 5.48561 9.54146 5.55756 9.54146 5.63022C9.54146 5.70289 9.55578 5.77484 9.58358 5.84197C9.61139 5.90911 9.65215 5.9701 9.70353 6.02148C9.75491 6.07287 9.81591 6.11362 9.88304 6.14143C9.95017 6.16924 10.0221 6.18355 10.0948 6.18355C10.2415 6.18355 10.3823 6.12525 10.4861 6.02148C10.5898 5.91772 10.6481 5.77697 10.6481 5.63022C10.6481 5.48347 10.5898 5.34273 10.4861 5.23896C10.3823 5.13519 10.2415 5.0769 10.0948 5.0769Z",fill:"currentColor"})}),kb=v.memo(({selected:e,onClick:t,onExit:n,disabled:r})=>{const l=v.useCallback(()=>{r||t?.()},[r,t]),a=`rte-ai-image-badge${e?" rte-ai-image-badge-selected":""}`;return b.jsxs("div",{className:a,onClick:l,"data-rte-ai-image-button":"true","aria-pressed":!!e,style:{cursor:r?"not-allowed":"pointer"},children:[b.jsx(fA,{}),b.jsx("span",{className:"rte-ai-image-text",children:"AI生图"}),e&&n&&b.jsx("i",{className:"iconfont icon-guanbi rte-tool-close",role:"button","aria-label":"退出 AI 生图",onMouseDown:i=>{i.preventDefault(),i.stopPropagation()},onClick:i=>{i.preventDefault(),i.stopPropagation(),!r&&n()}})]})});kb.displayName="AIImageButton";const Ab=v.memo(({onClick:e,loading:t,disabled:n})=>b.jsx("button",{type:"button",className:"rich-text-editor-send-button","data-testid":"rte-send-button",onClick:e,disabled:n||t,children:t?b.jsx("span",{className:"rte-send-spinner"}):b.jsx("i",{className:"iconfont icon-fasong"})}));Ab.displayName="SendButton";const Nb=v.memo(({currentAgent:e})=>{const t=e?.points;return t==null?null:b.jsxs("div",{className:"rte-points-badge",style:{position:"relative"},children:[b.jsx("i",{className:"iconfont icon-jifen",style:{marginRight:"4px",fontSize:"16px"}}),b.jsxs("span",{style:{fontSize:"16px",lineHeight:"22px"},children:["-",String(t)]}),e?.labelValue===2&&b.jsx("div",{className:"rte-limited-free-badge",children:b.jsx("span",{className:"rte-limited-free-text",children:"限时免费"})})]})});Nb.displayName="PointsBadge";const su=8,wb=72,hA=100,pA=".rte-more-menu,[data-rte-more-button],.rte-skill-panel-popup,.rte-skill-delete-confirm,.rte-skill-share-popover,.rte-agent-dropdown,.ant-dropdown",bA=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",children:[b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.58984 9.14355C5.95404 9.14355 6.304 9.28838 6.56152 9.5459C6.81867 9.80323 6.96372 10.1527 6.96387 10.5166V14.1943C6.96373 14.5583 6.81895 14.9086 6.56152 15.166C6.30405 15.4233 5.9539 15.5684 5.58984 15.5684H1.91309C1.54903 15.5684 1.19888 15.4233 0.941406 15.166C0.683978 14.9086 0.539199 14.5583 0.539062 14.1943V10.5176C0.539067 10.1535 0.684113 9.80337 0.941406 9.5459C1.19894 9.28837 1.54889 9.14355 1.91309 9.14355H5.58984ZM2.28027 10.4199C2.15705 10.42 2.03931 10.4687 1.95215 10.5557C1.86493 10.643 1.81545 10.7616 1.81543 10.8848V13.8271L1.82422 13.918C1.84226 14.0073 1.88675 14.0899 1.95215 14.1553C2.03954 14.2425 2.15733 14.2919 2.28027 14.292H5.22266L5.31348 14.2832C5.34338 14.2772 5.37314 14.2685 5.40137 14.2568C5.45705 14.2337 5.50752 14.1985 5.55078 14.1553C5.59381 14.1122 5.62895 14.0611 5.65234 14.0049C5.66405 13.9766 5.67271 13.9469 5.67871 13.917L5.6875 13.8271V10.8848C5.68748 10.7616 5.638 10.643 5.55078 10.5557C5.48537 10.4904 5.40283 10.4465 5.31348 10.4287L5.22266 10.4199H2.28027Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.9453 9.03711C13.3093 9.03724 13.6586 9.18214 13.916 9.43945C14.1734 9.69694 14.3184 10.047 14.3184 10.4111V14.0879C14.3183 14.268 14.2817 14.447 14.2129 14.6133C14.1439 14.7796 14.0435 14.9321 13.916 15.0596C13.7885 15.187 13.6361 15.2875 13.4697 15.3564C13.345 15.4081 13.2133 15.4417 13.0791 15.4551L12.9443 15.4619H9.26758C8.90349 15.4619 8.55339 15.3169 8.2959 15.0596C8.03855 14.8022 7.89369 14.4518 7.89355 14.0879V10.4111C7.89355 10.0471 8.03861 9.69693 8.2959 9.43945C8.55342 9.18193 8.90337 9.03711 9.26758 9.03711H12.9453ZM9.63477 10.3135C9.5741 10.3135 9.51355 10.3253 9.45703 10.3486C9.40075 10.372 9.34976 10.4071 9.30664 10.4502C9.26346 10.4935 9.22825 10.5439 9.20508 10.5996C9.18175 10.6561 9.16996 10.7176 9.16992 10.7783V13.7207L9.17871 13.8115C9.18467 13.8413 9.19353 13.8704 9.20508 13.8984C9.22833 13.9543 9.26342 14.0056 9.30664 14.0488C9.3498 14.0919 9.40085 14.1271 9.45703 14.1504C9.51353 14.1737 9.57417 14.1855 9.63477 14.1855H12.5771L12.668 14.1768C12.7576 14.1588 12.8407 14.1143 12.9062 14.0488C12.9714 13.9835 13.0154 13.9009 13.0332 13.8115L13.042 13.7207V10.7783C13.042 10.7169 13.0309 10.6555 13.0078 10.5996C12.9847 10.544 12.9494 10.4935 12.9062 10.4502C12.8632 10.4072 12.8121 10.372 12.7559 10.3486C12.7276 10.3369 12.6978 10.3283 12.668 10.3223L12.5771 10.3135H9.63477Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.1064 0.919922C11.2869 0.919986 11.4649 0.957675 11.6309 1.02637C11.7973 1.09534 11.9497 1.19581 12.0771 1.32324L14.6777 3.92285C14.8051 4.05027 14.9057 4.20287 14.9746 4.36914C15.0434 4.53542 15.0801 4.71436 15.0801 4.89453L15.0732 5.0293C15.0599 5.16344 15.0263 5.29518 14.9746 5.41992C14.9056 5.58618 14.8052 5.73878 14.6777 5.86621L12.0781 8.46582C11.9508 8.59306 11.7984 8.69464 11.6318 8.76367C11.4652 8.83262 11.2864 8.86815 11.1064 8.86816C10.9264 8.86816 10.7477 8.83263 10.5811 8.76367C10.4144 8.69463 10.2621 8.59311 10.1348 8.46582L7.53516 5.86621C7.40782 5.73889 7.30637 5.58648 7.2373 5.41992C7.18567 5.29512 7.15273 5.1633 7.13965 5.0293L7.13281 4.89453C7.13288 4.71481 7.16857 4.5364 7.2373 4.37012C7.30634 4.20346 7.40786 4.05118 7.53516 3.92383L10.1348 1.32324C10.2623 1.19577 10.4146 1.09533 10.5811 1.02637C10.7472 0.95759 10.9259 0.919922 11.1064 0.919922ZM11.1064 2.34863C10.9829 2.34863 10.8645 2.39735 10.7773 2.48438L8.69727 4.56543C8.6541 4.60867 8.61889 4.65915 8.5957 4.71484C8.57239 4.77125 8.5606 4.83282 8.56055 4.89355L8.56934 4.98438C8.57533 5.0143 8.58403 5.04407 8.5957 5.07227C8.61912 5.12852 8.65424 5.17964 8.69727 5.22266L10.7764 7.30176L10.8486 7.36035L10.9082 7.39453C10.9699 7.42383 11.0376 7.43945 11.1064 7.43945L11.1973 7.43066C11.2864 7.41262 11.369 7.36809 11.4346 7.30273L13.5156 5.22266C13.5586 5.17966 13.5938 5.12836 13.6172 5.07227C13.6402 5.01649 13.6513 4.95494 13.6514 4.89355L13.6426 4.80273C13.6368 4.77268 13.6288 4.74287 13.6172 4.71484C13.5941 4.65927 13.5588 4.60872 13.5156 4.56543L11.4346 2.48438C11.3692 2.41913 11.2866 2.37521 11.1973 2.35742L11.1064 2.34863Z",fill:"currentColor"}),b.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.58984 1.68262C5.95404 1.68262 6.304 1.82744 6.56152 2.08496C6.81867 2.34229 6.96372 2.69177 6.96387 3.05566V6.7334C6.96373 7.09738 6.81895 7.44765 6.56152 7.70508C6.30405 7.96237 5.9539 8.10742 5.58984 8.10742H1.91309C1.54903 8.10742 1.19888 7.96236 0.941406 7.70508C0.683978 7.44765 0.539199 7.09738 0.539062 6.7334V3.05664C0.539067 2.69259 0.684113 2.34244 0.941406 2.08496C1.19894 1.82744 1.54889 1.68262 1.91309 1.68262H5.58984ZM2.28027 2.95898C2.15705 2.95905 2.03931 3.00778 1.95215 3.09473C1.86493 3.18207 1.81545 3.30065 1.81543 3.42383V6.36621L1.82422 6.45703C1.84226 6.54634 1.88675 6.62894 1.95215 6.69434C2.03954 6.78154 2.15733 6.83099 2.28027 6.83105H5.22266L5.31348 6.82227C5.34338 6.81627 5.37314 6.80758 5.40137 6.7959C5.45705 6.77272 5.50752 6.73752 5.55078 6.69434C5.59381 6.65131 5.62895 6.60017 5.65234 6.54395C5.66405 6.51566 5.67271 6.48593 5.67871 6.45605L5.6875 6.36621V3.42383C5.68748 3.30065 5.638 3.18207 5.55078 3.09473C5.48537 3.02947 5.40283 2.98556 5.31348 2.96777L5.22266 2.95898H2.28027Z",fill:"currentColor"})]});function Ib(e){const t=getComputedStyle(e);return e.offsetWidth+(parseFloat(t.marginLeft)||0)+(parseFloat(t.marginRight)||0)}const _b=({items:e,measureKey:t,disabled:n})=>{const r=v.useRef(null),l=v.useRef(null),a=v.useRef(new Map),i=v.useRef(new Map),[s,o]=v.useState(e.length),[u,c]=v.useState(!1),[d,h]=v.useState(0),[f,m]=v.useState(()=>new Set),y=v.useRef(new Set),g=v.useRef(new Map),E=v.useMemo(()=>[...e.filter(M=>M.pinned),...e.filter(M=>!M.pinned)],[e]),N=v.useMemo(()=>E.filter(M=>M.pinned).length,[E]),A=()=>c(!1),P=(M,_)=>typeof M.node=="function"?M.node({close:A,inMenu:_}):M.node,L=M=>{i.current.get(M)?.firstElementChild?.click()};v.useLayoutEffect(()=>{a.current.clear(),o(e.length)},[t,e.length]),v.useEffect(()=>{const M=r.current;if(!M||typeof ResizeObserver>"u")return;const _=new ResizeObserver(()=>h(H=>H+1));return _.observe(M),()=>_.disconnect()},[]),v.useEffect(()=>{if(!u)return;const M=_=>{const H=_.target;H&&H.closest(pA)||c(!1)};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[u]),v.useLayoutEffect(()=>{const M=r.current;if(!M)return;for(let R=0;R<s&&R<E.length;R++){const z=i.current.get(E[R].key);z&&a.current.set(E[R].key,Ib(z))}const _=M.clientWidth,H=l.current?Ib(l.current):wb,$=E.map(R=>a.current.get(R.key)??wb),F=$.reduce((R,z)=>R+z,0)+su*Math.max(0,E.length-1);let T;if(F<=_)T=E.length;else{let R=0,z=0;for(;z<E.length;z++){const q=$[z],G=z>0?su:0;if(R+G+q+su+H>_)break;R+=G+q}T=z}T=Math.max(T,N),T!==s&&o(T)},[E,N,s,d]);const S=N>0,I=S?[]:E.slice(s),w=v.useMemo(()=>{const M=new Set;return S?E.forEach(_=>_.pinned&&M.add(_.key)):E.slice(0,s).forEach(_=>M.add(_.key)),M},[S,E,s]),k=[...w].join("|");return v.useEffect(()=>{const M=window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches,_=g.current;M||y.current.forEach(H=>{if(!w.has(H)&&!_.has(H)){m(F=>new Set(F).add(H));const $=window.setTimeout(()=>{_.delete(H),m(F=>{const T=new Set(F);return T.delete(H),T})},hA);_.set(H,$)}}),w.forEach(H=>{const $=_.get(H);$!==void 0&&(window.clearTimeout($),_.delete(H),m(F=>{if(!F.has(H))return F;const T=new Set(F);return T.delete(H),T}))}),y.current=w},[k]),v.useEffect(()=>()=>g.current.forEach(M=>window.clearTimeout(M)),[]),b.jsxs("div",{className:"rte-toolbar-overflow",ref:r,children:[E.map(M=>{const _=w.has(M.key),H=!_&&(f.has(M.key)||y.current.has(M.key));return!_&&!H?M.renderMenuItem?b.jsx("div",{className:"rte-toolbar-item",style:{display:"none"},ref:$=>{$?i.current.set(M.key,$):i.current.delete(M.key)},children:P(M,!1)},M.key):null:b.jsx("div",{className:`rte-toolbar-item${H?" rte-toolbar-item--leaving":""}`,ref:$=>{$?i.current.set(M.key,$):i.current.delete(M.key)},children:P(M,!1)},M.key)}),I.length>0&&b.jsx(se.Dropdown,{open:u,onOpenChange:(M,_)=>{M?c(!0):_?.source==="trigger"&&c(!1)},disabled:n,trigger:["click"],placement:"topLeft",getPopupContainer:Mr,popupRender:()=>b.jsx("div",{className:"rte-more-menu",children:I.map(M=>b.jsx("div",{className:"rte-more-menu-item",children:M.renderMenuItem?M.renderMenuItem({close:A,activate:()=>L(M.key)}):P(M,!0)},M.key))}),children:b.jsxs("div",{ref:l,className:`rte-more-badge${u?" rte-more-badge-active":""}`,"data-rte-more-button":"true",style:{cursor:n?"not-allowed":"pointer"},children:[b.jsx(bA,{}),b.jsx("span",{children:"更多"})]})})]})};_b.displayName="ToolbarOverflow";const mA={points:["tl","tr"],offset:[4,0]},Ob=v.memo(({isProcessing:e,loading:t,disabled:n,sendDisabled:r,showFooterUpload:l=!0,footerFiles:a,onFooterFilesChange:i,onAssetLibraryClick:s,agentOptions:o,onAgentSelect:u,onAgentDropdownOpenChange:c,hideAgentButton:d,currentAgent:h,selectedSkill:f,onSkillSelect:m,onSkillCardClick:y,onSkillAction:g,skillListFetch:E,onSkillHeaderAction:N,showCreateSkill:A,createDisabled:P,skillPanelOpen:L,onSkillPanelOpenChange:S,skillPanelOpenDelay:I,onAIImageClick:w,aiImageSelected:k,onAgentExit:M,onAIImageExit:_,onSend:H,padding:$="12px 16px"})=>{const F=v.useCallback(re=>{if(re.reduce((me,ve)=>me+ve.size,0)>52428800){const me=[];let ve=0;for(const ce of re){if(ve+ce.size>52428800)break;me.push(ce),ve+=ce.size}i(me)}else i(re)},[i]),[T,R]=v.useState(!1),z=L??T,q=v.useCallback(re=>{R(re),S?.(re)},[S]),G=!d&&!!o&&o.length>0,C=v.useMemo(()=>{const re=[];return G&&re.push({key:"agent",pinned:!!h,node:({close:D,inMenu:de})=>b.jsx(yb,{options:o,onSelect:me=>{u?.(me),D()},disabled:n||e,currentAgent:h,onOpenChange:c,onExit:M,align:de?mA:void 0})}),re.push({key:"skill",pinned:!!f||z,node:b.jsx(Sb,{disabled:n||e,selectedSkill:f,onSkillSelect:m,onSkillCardClick:y,onSkillAction:g,skillListFetch:E,onSkillHeaderAction:N,showCreateSkill:A,createDisabled:P,skillPanelOpen:L,onSkillPanelOpenChange:q,skillPanelOpenDelay:I}),renderMenuItem:({close:D,activate:de})=>b.jsxs("div",{className:`rte-skill-badge${f?" rte-skill-badge-selected":""}`,onClick:()=>{n||e||(de(),D())},style:{cursor:n||e?"not-allowed":"pointer"},children:[b.jsx(Cb,{}),b.jsx("span",{className:"rte-skill-text",children:f?.title||"技能"})]})}),re.push({key:"ai-image",pinned:!!k,node:({close:D})=>b.jsx(kb,{selected:k,onClick:()=>{w?.(),D()},onExit:_,disabled:n||e})}),re},[G,o,u,n,e,h,c,f,m,y,g,E,N,A,P,L,z,q,I,k,w,M,_]),Z=`${G?"1":"0"}|${f?.title??""}|${h?.key??""}|${k?"1":"0"}`;return b.jsxs("div",{className:"rich-text-editor-footer",style:{padding:$},children:[b.jsxs("div",{className:"rich-text-editor-footer-left",children:[l&&b.jsx(xb,{files:a,onChange:F,disabled:n||e,onAssetLibraryClick:s}),l&&b.jsx("div",{className:"rte-footer-divider"}),b.jsx(_b,{items:C,measureKey:Z,disabled:n||e})]}),b.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexShrink:0},children:[b.jsx(Nb,{currentAgent:h}),b.jsx(Ab,{onClick:H,loading:t||e,disabled:n||r})]})]})});Ob.displayName="Footer";const gA=()=>b.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[b.jsx("g",{clipPath:"url(#footer_report_icon_clip)",children:b.jsx("path",{d:"M8.45215 6.33203C8.7473 6.08954 9.15813 6.08988 9.45312 6.33203L9.51465 6.3877L9.63379 6.5127C10.2143 7.15045 10.5526 7.97505 10.5527 8.85059C10.5526 9.78431 10.1675 10.6595 9.51465 11.3125L6.66504 14.1621C6.01021 14.8169 5.08455 15.2001 4.20312 15.2002C3.3328 15.2002 2.39768 14.8749 1.73242 14.1543L1.68555 14.1035C1.0669 13.4571 0.703125 12.6069 0.703125 11.7002C0.703218 10.7663 1.08824 9.89126 1.74121 9.23828L3.04102 7.93848C3.35812 7.62154 3.84793 7.62154 4.16504 7.93848C4.48176 8.25548 4.48205 8.74532 4.16504 9.0625L2.86523 10.3623C2.5177 10.7098 2.30283 11.1852 2.30273 11.7002C2.30273 12.2152 2.51773 12.6905 2.86523 13.0381C3.5981 13.7709 4.80822 13.7709 5.54102 13.0381L8.39062 10.1885C8.73802 9.841 8.95303 9.36555 8.95312 8.85059C8.95303 8.33565 8.73812 7.86023 8.39062 7.5127C8.07364 7.19553 8.07352 6.7048 8.39062 6.3877L8.45215 6.33203ZM11.8027 0.599609C12.7367 0.599609 13.6116 0.984643 14.2646 1.6377C15.6318 3.00485 15.6318 5.19437 14.2646 6.56152L12.9648 7.86133C12.6675 8.15865 12.2186 8.17713 11.9023 7.91699L11.8408 7.86133C11.5239 7.54422 11.5237 7.05447 11.8408 6.7373L13.1406 5.4375C13.8735 4.70466 13.8735 3.49456 13.1406 2.76172C12.793 2.41411 12.3179 2.19922 11.8027 2.19922C11.2877 2.19927 10.8124 2.41418 10.4648 2.76172L7.61523 5.61133C7.26769 5.95887 7.05279 6.43414 7.05273 6.94922C7.05273 7.46435 7.26763 7.9395 7.61523 8.28711C7.91261 8.58448 7.93068 9.03343 7.6709 9.34961L7.61523 9.41113C7.5472 9.47917 7.46705 9.54199 7.36816 9.58594C7.26832 9.63024 7.16328 9.64941 7.05273 9.64941C6.96999 9.64939 6.89035 9.63836 6.81348 9.61426L6.7373 9.58594C6.63742 9.54152 6.55812 9.47804 6.49121 9.41113C5.83816 8.75808 5.45312 7.88321 5.45312 6.94922C5.45318 6.01532 5.8382 5.14032 6.49121 4.4873L9.34082 1.6377C9.99384 0.98468 10.8688 0.599667 11.8027 0.599609Z",fill:"#00A5F4"})}),b.jsx("defs",{children:b.jsx("clipPath",{id:"footer_report_icon_clip",children:b.jsx("rect",{width:"16",height:"16",fill:"white"})})})]}),vA=({report:e,onRemove:t})=>{const n=e.status==="parsing"?"解析中…":e.status==="error"?e.name||"解析失败":e.name;return b.jsxs("div",{className:`rte-footer-report-chip${e.status==="error"?" rte-footer-report-chip-error":""}`,children:[b.jsx("div",{className:"rte-footer-report-icon",children:e.status==="parsing"?b.jsx(se.Spin,{size:"small"}):b.jsx(gA,{})}),b.jsxs("div",{className:"rte-footer-report-info",children:[b.jsx("span",{className:"rte-footer-report-name",title:e.status==="done"?e.name:e.url,children:n}),e.status==="done"&&e.date?b.jsx("span",{className:"rte-footer-report-date",children:e.date}):null]}),b.jsx("span",{className:"rte-footer-file-remove",onClick:r=>{r.stopPropagation(),t()},children:b.jsx("i",{className:"iconfont icon-guanbi",style:{width:"8px",height:"8px",fontSize:"8px",display:"flex",alignItems:"center"}})})]})},yA=e=>e<1024?`${e}B`:e<1024*1024?`${Math.round(e/1024)}KB`:`${(e/(1024*1024)).toFixed(1)}MB`,Mb=e=>/\.(png|jpe?g|gif|webp|bmp|svg)$/i.test(e||""),EA=e=>(e.type?.startsWith("image/")??!1)||Mb(e.name||""),Lb=e=>{const t=(e||"").split(".").pop()?.toLowerCase()||"";return["xls","xla","xlb","xlc","xlm","xlsx","xlt","xlw","csv","tsv","iif"].includes(t)?"icon-a-xlsxcsv":["doc","docx","dot","odt","rtf","wiz"].includes(t)?"icon-docx":["ppt","pptx","pot","ppa","pps","pwz"].includes(t)?"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(t)?"icon-txt":t==="pdf"?"icon-pdf":["html","htm","json","ics","ifb"].includes(t)?"icon-a-htmljson":t==="md"?"icon-md":["mp4","mov","webm","mkv","avi","m4v"].includes(t)?"icon-shipin":"icon-lianjie"},TA=({file:e,onRemove:t})=>{const n=EA(e),r=$f(n?e:null);return b.jsxs("div",{className:"rte-footer-file-chip",children:[n?b.jsx(se.Image,{className:"rte-footer-file-thumb",width:32,height:32,src:r,alt:e.name,preview:{mask:null,getContainer:()=>document.body}}):b.jsx("div",{className:"rte-footer-file-icon",children:b.jsx("svg",{style:{width:"18px",height:"18px"},"aria-hidden":"true",children:b.jsx("use",{xlinkHref:`#${Lb(e.name)}`})})}),b.jsxs("div",{className:"rte-footer-file-info",children:[b.jsx("span",{className:"rte-footer-file-name",title:e.name,children:e.name}),b.jsx("span",{className:"rte-footer-file-size",children:yA(e.size)})]}),b.jsx("span",{className:"rte-footer-file-remove",onClick:l=>{l.stopPropagation(),t()},children:b.jsx("i",{className:"iconfont icon-guanbi",style:{width:"8px",height:"8px",fontSize:"8px",display:"flex",alignItems:"center"}})})]})},CA=({file:e,onRemove:t})=>{const n=Mb(e.name);return b.jsxs("div",{className:"rte-footer-file-chip",children:[n?b.jsx(se.Image,{className:"rte-footer-file-thumb",width:32,height:32,src:e.url,alt:e.name,preview:{mask:null,getContainer:()=>document.body}}):b.jsx("div",{className:"rte-footer-file-icon",children:b.jsx("svg",{style:{width:"18px",height:"18px"},"aria-hidden":"true",children:b.jsx("use",{xlinkHref:`#${Lb(e.name)}`})})}),b.jsxs("div",{className:"rte-footer-file-info",children:[b.jsx("span",{className:"rte-footer-file-name",title:e.name,children:e.name}),e.size?b.jsx("span",{className:"rte-footer-file-size",children:e.size}):null]}),b.jsx("span",{className:"rte-footer-file-remove",onClick:r=>{r.stopPropagation(),t()},children:b.jsx("i",{className:"iconfont icon-guanbi",style:{width:"8px",height:"8px",fontSize:"8px",display:"flex",alignItems:"center"}})})]})},Db=v.memo(({files:e,onChange:t,reports:n,onReportRemove:r,fileUrls:l,onFileUrlRemove:a})=>{const i=v.useRef(null),[s,o]=v.useState({showLeft:!1,showRight:!1}),u=v.useCallback(()=>{const h=i.current;h&&o({showLeft:h.scrollLeft>0,showRight:h.scrollLeft+h.clientWidth<h.scrollWidth-1})},[]);v.useLayoutEffect(()=>{u()},[e,n,l,u]);const c=v.useCallback(h=>{const f=i.current;f&&(f.scrollBy({left:h*200,behavior:"smooth"}),window.setTimeout(u,300))},[u]),d=v.useCallback(h=>()=>t(e.filter((f,m)=>m!==h)),[e,t]);return e.length===0&&!n?.length&&!l?.length?null:b.jsxs("div",{className:"rte-footer-files-wrapper",children:[s.showLeft&&b.jsx("div",{className:"rte-footer-files-mask rte-footer-files-mask-left",children:b.jsx("span",{className:"rte-footer-files-arrow rte-footer-files-arrow-left",onClick:()=>c(-1),children:b.jsx("svg",{style:{width:"16px",height:"16px",transform:"rotate(180deg)"},"aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-fanhuijiantou"})})})}),b.jsxs("div",{className:"rte-footer-files-list",ref:i,onScroll:u,children:[n?.map(h=>b.jsx(vA,{report:h,onRemove:()=>r?.(h.id)},h.id)),l?.map(h=>b.jsx(CA,{file:h,onRemove:()=>a?.(h.id)},h.id)),e.map((h,f)=>b.jsx(TA,{file:h,onRemove:d(f)},`${h.name}-${h.size}-${f}`))]}),s.showRight&&b.jsx("div",{className:"rte-footer-files-mask rte-footer-files-mask-right",children:b.jsx("span",{className:"rte-footer-files-arrow rte-footer-files-arrow-right",onClick:()=>c(1),children:b.jsx("svg",{style:{width:"16px",height:"16px"},"aria-hidden":"true",children:b.jsx("use",{xlinkHref:"#icon-fanhuijiantou"})})})})]})});Db.displayName="FooterFilesList";const Pb=9999,SA=({messageRef:e})=>{const{message:t}=se.App.useApp();return e.current=t,null},ou=v.memo(({title:e,onClose:t,exitTip:n="点击退出技能"})=>b.jsx(zn,{title:n,placement:"top",zIndex:1e4,children:b.jsx("span",{className:"tag-node group",contentEditable:!1,children:b.jsx("span",{className:"tag-label","data-tag-clickable":"true",onMouseDown:r=>{r.preventDefault(),r.stopPropagation()},onClick:r=>{r.preventDefault(),r.stopPropagation(),t()},children:e})})}));ou.displayName="SkillTag";const Bb=e=>{const{config:t,onSend:n,isProcessing:r=!1,disabled:l=!1,placeholder:a,nodeValues:i,onFilesChange:s,onFooterFilesChange:o,footerFiles:u,footerReports:c=[],onFooterReportsChange:d,onReportUrlPaste:h,footerFileUrls:f=[],onFooterFileUrlsChange:m,width:y,background:g="transparent",border:E,maxHeight:N,minHeight:A,editorMinHeight:P,editorPadding:L,className:S,videoUrlParse:I,videoUpload:w,reportAnalyze:k,reportListFetch:M,onReportGoGenerate:_,reportNameResolve:H,onViewReport:$,hideCurrentSessionReport:F,markdownAnalyze:T,markdownNameAnalyze:R,agentOptions:z,onAgentSelect:q,onAgentExit:G,onSkillAction:C,onSkillCardClick:Z,onSkillHeaderAction:re,skillListFetch:D,showCreateSkill:de,createDisabled:me,skillPanelOpen:ve,onSkillPanelOpenChange:ce,skillPanelOpenDelay:ke,selectedSkill:Me,onSkillSelect:ye,onAIImageClick:et,aiImageSelected:_t,onAIImageExit:Ft,loading:Kr,hideButtons:Fn,footerPadding:Ae,showFooterUpload:He,onAssetLibraryClick:Rn,lockStructure:Hn=!0,collapsed:Ue=!1,onCollapsedChange:Un,collapseTransitionMs:on=260,nodeDefaults:cu,onExpandedHeightChange:Ti,collapsedTotalHeight:Ci,toggleOnBlankClick:Y=!0,getPopupContainer:te,scrollContainerRef:ge,autoCollapseOnScroll:Ne}=e,[we,tt]=v.useState({}),[Ge,Rt]=v.useState({}),[je,St]=v.useState(u??[]),ft=v.useRef(c);ft.current=c;const un=v.useRef(d);un.current=d;const Ht=v.useRef(f);Ht.current=f;const Wb=v.useRef(m);Wb.current=m;const[FA,RA]=v.useState({}),[Si,Qr]=v.useState(z8),[Yb,jb]=v.useState(()=>new Set),[xi,Gb]=v.useState(()=>new Set),[ki,HA]=v.useState(()=>new Set),[Kb,Xl]=v.useState({}),[cr,UA]=v.useState(null),[zA,Qb]=v.useState(null),du=v.useRef(null);v.useLayoutEffect(()=>{const U=du.current?.ownerDocument??document,J=U.createElement("div");return J.className="rte-message-host",J.style.cssText="position:fixed;inset:0;z-index:2000000000;pointer-events:none;",U.body.appendChild(J),Qb(J),()=>{J.remove(),Qb(null)}},[]);const VA=v.useCallback(()=>te?.()??cr??document.body,[te,cr]),fu=v.useRef(null),[Ai,$A]=v.useState(null),qA=v.useCallback((U,J)=>{$A(J?U:null)},[]),dr=v.useRef(null),[WA,YA]=v.useState(58),[fr,Xb]=v.useState(58),[hu,Jb]=v.useState(!1),Zb=v.useRef(0),em=v.useRef(Ue),[Ni,tm]=v.useState(!1);em.current!==Ue&&(em.current=Ue,Zb.current=(typeof performance<"u"?performance.now():Date.now())+on,tm(!0)),v.useEffect(()=>{if(!Ni)return;const U=setTimeout(()=>tm(!1),on);return()=>clearTimeout(U)},[Ni,Ue,on]);const[hr,nm]=v.useState(""),Jl=v.useRef(null),pu=v.useRef(null),[Zl,rm]=v.useState(0),[bu,lm]=v.useState(0),mu=v.useRef(!1);v.useEffect(()=>{if(!u||u.length===je.length&&u.every((ne,le)=>{const ee=je[le];return ee&&ne.name===ee.name&&ne.size===ee.size&&ne.lastModified===ee.lastModified}))return;const J=50*1024*1024;if(u.reduce((ne,le)=>ne+le.size,0)>J){const ne=[];let le=0;for(const ee of u){if(le+ee.size>J)break;ne.push(ee),le+=ee.size}St(ne)}else mu.current=!0,St(u)},[u]);const xt=v.useMemo(()=>U8(t,Si,Yb),[t,Si,Yb]),gu=v.useRef(null),am=v.useRef(!1);v.useEffect(()=>{const U=t.find(J=>J.type==="tag")?.text??null;if(!am.current){am.current=!0,gu.current=U;return}gu.current!==U&&(gu.current=U,St(J=>J.length===0?J:[]),ft.current.length&&un.current?.([]),Ht.current.length&&Wb.current?.([]))},[t]);const pr=v.useMemo(()=>{const U=t.find(J=>J.type==="tag")?.text;if(!(!U||!z))return z.find(J=>J.label===U)},[t,z]),vu=v.useMemo(()=>t.some(U=>U.type==="tag"),[t]),jA=de??!vu;T8(i,we,tt,xt,Ge,Rt);const ea=v.useRef(new Map),im=v.useRef(""),sm=(t.find(U=>U.type==="tag")?.text||"")+"||"+t.filter(U=>U.key&&U.type!=="report-module"&&U.type!=="markdown-module").map(U=>`${U.type}:${U.key}`).join("|");im.current!==sm&&(im.current=sm,ea.current=new Map);const[gt,ta]=v.useState(null),[Zt,br]=v.useState(!1);v.useEffect(()=>{Me!==void 0&&ta(Me)},[Me]),v.useEffect(()=>{_t!==void 0&&br(_t)},[_t]);const om=v.useCallback(U=>{ta(U),U&&br(!1),ye?.(U),U&&pr&&G?.("skill-switch")},[pr,G,ye]),GA=v.useCallback(U=>{ta(null),br(!1),ye?.(null),q?.(U)},[q,ye]),KA=v.useCallback(()=>{br(!0),ta(null),ye?.(null),pr&&G?.("ai-image-switch"),et?.()},[pr,G,et,ye]),QA=v.useCallback(()=>G?.("tag-close"),[G]),XA=v.useCallback(()=>{br(!1),Ft?.()},[Ft]);v.useEffect(()=>{pr&&(ta(null),br(!1))},[pr]);const{errors:JA,validate:um,clearError:cm}=x8(xt),{excludedKeys:Xr,hiddenSeparatorIndexes:yu,conditionalHiddenIndexes:ZA}=M8(xt,we,Ge),{analyzeReport:wi,analyzeMarkdown:dm,analyzeMarkdownName:fm,resolveReportName:Ii}=L8({reportAnalyze:k,markdownAnalyze:T,markdownNameAnalyze:R,reportNameResolve:H}),hm=U=>typeof U!="string"?!U:U.replace(/<[^>]*>/g,"").replace(/&nbsp;/gi,"").replace(/\s/g,"").replace(/[​‌‍]/g,"").trim()==="",Eu=v.useCallback((U,J)=>{tt(ne=>({...ne,[U]:J})),cm(U);const ae=/^(.+)__module_\d+$/.exec(U);if(ae&&hm(J)){const ne=ae[1];xt.find(ee=>ee.key===ne&&ee.type==="markdown-module")&&tt(ee=>{const fe={...ee,[U]:J};return Object.keys(fe).filter(pe=>pe.startsWith(`${ne}__module_`)).every(pe=>hm(fe[pe]))&&(Qr(pe=>{if(!pe.markdownModules[ne])return pe;const Pe={...pe.markdownModules};return delete Pe[ne],{...pe,markdownModules:Pe}}),Object.keys(fe).filter(pe=>pe.startsWith(`${ne}__module_`)).forEach(pe=>delete fe[pe]),fe[ne]=""),fe});return}if(typeof J=="string"&&J.trim()===""){const ne=xt.find(le=>le.key===U);ne?.type==="report-url"?(Qr(le=>{if(!le.reportModules[U])return le;const ee={...le.reportModules};return delete ee[U],{...le,reportModules:ee}}),Xl(le=>{if(!(U in le))return le;const ee={...le};return delete ee[U],ee})):(ne?.type==="markdown"||ne?.type==="markdown-name")&&Qr(le=>{if(!le.markdownModules[U])return le;const ee={...le.markdownModules};return delete ee[U],{...le,markdownModules:ee}})}},[cm,xt]),eN=v.useCallback((U,J)=>{Rt(ae=>({...ae,[U]:J}))},[]),tN=v.useCallback((U,J)=>RA(ae=>({...ae,[U]:J})),[]),nN=v.useCallback(U=>{Xl(J=>{if(!(U in J))return J;const ae=U.match(/^(.+)_(\d+)$/);if(!ae){const Ee={...J};return delete Ee[U],Ee}const[,ne,le]=ae,ee=parseInt(le,10),fe={};for(const[Ee,pe]of Object.entries(J)){if(Ee===U)continue;const Pe=Ee.match(/^(.+)_(\d+)$/);if(Pe&&Pe[1]===ne){const Be=parseInt(Pe[2],10);Be>ee?fe[`${ne}_${Be-1}`]=pe:fe[Ee]=pe}else fe[Ee]=pe}return fe})},[]),rN=v.useCallback((U,J)=>{Xl(ae=>{const ne=`${U}_`,le=[];for(const fe of Object.keys(ae)){if(!fe.startsWith(ne))continue;const Ee=fe.slice(ne.length);/^\d+$/.test(Ee)&&le.push([Number(Ee),ae[fe]])}if(le.length===0)return ae;const ee={...ae};for(const[fe]of le)delete ee[`${U}_${fe}`];for(const[fe,Ee]of le){if(fe===J)continue;const pe=fe>J?fe-1:fe;ee[`${U}_${pe}`]=Ee}return ee})},[]),Tu=v.useCallback(async(U,J,ae)=>{const ne=await Ii(U,J,ae);return ne.status==="success"&&Xl(le=>({...le,[U]:ne.name})),ne},[Ii]),lN=v.useCallback((U,J)=>{wi(U,J).then(ae=>{ae.status==="success"&&Qr(ne=>({...ne,reportModules:{...ne.reportModules,[U]:ae.modules}}))})},[wi]),Cu=v.useCallback(async(U,J)=>{Gb(ae=>{const ne=new Set(ae);return ne.add(U),ne});try{const ae=Ii(U,J,"report-url").then(le=>{le.status==="success"&&Xl(ee=>({...ee,[U]:le.name}))}),ne=wi(U,J).then(le=>{le.status==="success"?(Qr(ee=>({...ee,reportModules:{...ee.reportModules,[U]:le.modules}})),tt(ee=>{const fe={...ee};return le.modules.forEach((Ee,pe)=>{fe[`${U}__module_${pe}`]=Ee.content}),fe})):le.status==="failed"&&(Eu(U,""),tt(ee=>{let fe=!1;const Ee={...ee};for(const pe of Object.keys(Ee))pe.startsWith(`${U}__module_`)&&(delete Ee[pe],fe=!0);return fe?Ee:ee}))});await Promise.all([ae,ne])}finally{Gb(ae=>{if(!ae.has(U))return ae;const ne=new Set(ae);return ne.delete(U),ne})}},[wi,Ii,Eu]),aN=v.useCallback((U,J)=>{HA(ae=>{const ne=new Set(ae);return J?ne.add(U):ne.delete(U),ne.size===ae.size&&[...ne].every(le=>ae.has(le))?ae:ne})},[]);v.useEffect(()=>{if(!i||t.length===0)return;const U=t.filter(ae=>ae.type==="report-url"&&ae.key),J=t.filter(ae=>ae.type==="multi-variable-select"&&ae.key);if(!(U.length===0&&J.length===0)){for(const ae of U){const ne=ae.key,le=i[ne]??i[`${ne}__url`];if(!le||typeof le=="string"&&!le.trim())continue;const ee=Array.isArray(le)?String(le[0]??""):String(le);ee&&ea.current.get(ne)!==ee&&(ea.current.set(ne,ee),setTimeout(()=>{Cu(ne,ee)},100))}for(const ae of J){const ne=ae.key,le=i[ne];!Array.isArray(le)||le.length===0||le.forEach((ee,fe)=>{const Ee=typeof ee=="string"?ee.trim():"";if(!Ee)return;const pe=`${ne}_${fe}`;ea.current.get(pe)!==Ee&&(ea.current.set(pe,Ee),setTimeout(()=>{Tu(pe,Ee,"multi-variable-select")},100))})}}},[i,t,Cu,Tu]);const _i=v.useCallback(async(U,J,ae)=>{const le=Date.now();jb(ee=>{const fe=new Set(ee);return fe.add(U),fe});try{const ee=await ae(U,J),fe=Date.now()-le;fe<500&&await new Promise(Ee=>setTimeout(Ee,500-fe)),ee&&(Qr(Ee=>({...Ee,markdownModules:{...Ee.markdownModules,[U]:ee.modules}})),tt(Ee=>{const pe={...Ee};return ee.modules.forEach((Pe,Be)=>{pe[`${U}__module_${Be}`]=Pe.content}),pe}))}finally{jb(ee=>{if(!ee.has(U))return ee;const fe=new Set(ee);return fe.delete(U),fe})}},[]),iN=v.useCallback((U,J)=>_i(U,J,dm),[_i,dm]),sN=v.useCallback((U,J)=>_i(U,J,fm),[_i,fm]);v.useEffect(()=>{s?.(Ge)},[Ge,s]),v.useEffect(()=>{if(mu.current){mu.current=!1;return}o?.(je)},[je,o]);const Su=v.useCallback(async()=>{if(r||l||xi.size>0||ki.size>0||c.some(ee=>ee.status==="parsing"))return;const U=vu?1:gt?2:Zt?3:void 0,J=U===void 0?void 0:{...gt?{skillCode:gt.id,skillName:gt.title}:{},generateImage:U};if(t.length===0){const ee=hr.trim(),fe=c.filter(pe=>pe.status==="done");if(!ee&&!je.length&&!fe.length&&!f.length)return;const Ee=ee;if(je.length||fe.length||f.length){const pe=new FormData;Ee&&pe.append("prompt",Ee),je.forEach(Pe=>pe.append("files",Pe)),fe.forEach(Pe=>pe.append("reportUrls",Pe.url)),f.forEach(Pe=>pe.append("fileUrls",Pe.url)),n(pe,Ee,J)}else n(ee,Ee,J);nm(""),St([]),c.length&&d?.([]),f.length&&m?.([]);return}if(!um(we,Ge,Xr))return;const{formData:ae,fullPrompt:ne,hasContent:le}=await H8({config:xt,values:we,files:Ge,footerFiles:je,markdownModules:Si.markdownModules,excludedKeys:Xr,hiddenSeparatorIndexes:yu});le&&(n(ae,ne,J),St([]))},[t.length,hr,gt,vu,Zt,xt,we,Ge,je,c,d,f,m,Si.markdownModules,r,l,xi,ki,um,n,Xr,yu]),oN=v.useCallback(U=>{U.key==="Enter"&&(U.nativeEvent.isComposing||U.keyCode===229||U.shiftKey||(U.preventDefault(),Su()))},[Su]),uN=v.useMemo(()=>xi.size>0||ki.size>0?!1:t.length===0?hr.trim().length>0:S8(xt,we,Ge,Xr),[xi,ki,t.length,hr,xt,we,Ge,Xr]),xu=v.useCallback(()=>{const U=pu.current,J=U?.querySelector(".tag-node");if(!U||!J)return!1;const ae=J.getClientRects();if(ae.length===0)return!1;const ne=U.getBoundingClientRect().left,le=ae[0],ee=ae[ae.length-1],fe=Math.max(0,ee.right-ne-2);return rm(fe),lm(Math.max(0,Math.round(ee.top-le.top))),fe>0},[]);v.useLayoutEffect(()=>{if(!gt&&!Zt){rm(0),lm(0);return}let U=!1,J=0,ae=0;const ne=()=>{U||xu()||++ae>=30||(J=requestAnimationFrame(ne))};ne();const le=pu.current;if(!le||typeof ResizeObserver>"u")return()=>{U=!0,J&&cancelAnimationFrame(J)};const ee=new ResizeObserver(()=>xu());return ee.observe(le),()=>{U=!0,J&&cancelAnimationFrame(J),ee.disconnect()}},[gt,Zt,t.length,xu]),v.useEffect(()=>{!gt&&!Zt||t.length>0||Jl.current?.focus()},[gt,Zt,t.length]);const[cN,pm]=v.useState(!1);v.useEffect(()=>{const U=J=>{const ae=du.current;if(!ae)return;const ne=J.target;ae.contains(ne)||cr&&cr.contains(ne)?pm(!0):pm(!1)};return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[cr]);const bm=v.useCallback(()=>{requestAnimationFrame(()=>{if(t.length===0){Jl.current?.focus();return}dr.current?.querySelector('textarea:not([disabled]), input:not([disabled]):not([type="hidden"]), [contenteditable="true"]')?.focus()})},[t.length]),dN=v.useCallback(U=>{ce?.(U),U&&bm()},[ce,bm]);v.useLayoutEffect(()=>{const U=Jl.current;U&&(U.style.height="auto",U.style.height=`${U.scrollHeight}px`,Zl>0&&(U.style.textIndent="0px",U.offsetWidth,U.style.textIndent=`${Zl}px`))},[hr,Zl,bu]);const fN={width:y,background:g,border:E,maxHeight:N,...A&&!Ue?{minHeight:A}:{},...P?{"--rte-editor-min-height":typeof P=="number"?`${P}px`:P}:{},...L?{"--rte-editor-padding":L}:{}},mm=typeof Ci=="number"?Ci:WA,gm=Ue?mm:Math.max(fr,mm),vm={maxHeight:gm,minHeight:Ue?0:Ni?gm:void 0,overflow:Ue||Ni?"hidden":"auto",transition:hu?"none":`max-height ${on}ms cubic-bezier(0.4, 0, 0.2, 1), min-height ${on}ms cubic-bezier(0.4, 0, 0.2, 1)`,willChange:"max-height, min-height"},ym=v.useCallback(()=>{Ue&&Y&&Un?.(!1),Jl.current?.focus()},[Ue,Y,Un]),Em=v.useRef(0),hN=v.useCallback(()=>{const U=dr.current,J=document.activeElement;!U||!J||!U.contains(J)||(Em.current=typeof performance<"u"?performance.now():Date.now())},[]),Oi=v.useCallback(()=>{const U=dr.current;if(!(!U||(typeof performance<"u"?performance.now():Date.now())<Zb.current)){if(!Ue){const ae=U.style.maxHeight;U.style.maxHeight="none";const ne=U.offsetHeight,le=U.scrollHeight,ee=U.parentElement;let fe=1/0;if(ee){let Pe=0;for(const Mi of Array.from(ee.children))Mi!==U&&(Pe+=Mi.offsetHeight);const Be=getComputedStyle(ee),mr=parseFloat(Be.paddingTop)+parseFloat(Be.paddingBottom);fe=Math.max(0,ee.clientHeight-Pe-mr)}U.style.maxHeight=ae;const Ee=Math.max(Math.ceil(le||0),Math.ceil(ne||0)),pe=Math.min(Ee,Math.ceil(fe));pe>0&&Xb(Pe=>Pe===pe?Pe:pe)}try{const ae=U.getBoundingClientRect(),ne=U.querySelector(".rte-config-fade")??U,le=document.createRange();le.selectNodeContents(ne);const ee=Array.from(le.getClientRects()).filter(fe=>fe.height>0);if(ee.length>0){const fe=Math.min(...ee.map(gr=>gr.top)),Ee=parseFloat(getComputedStyle(U).lineHeight)||34,pe=Math.max(Ee,1),Pe=fe+pe*.5;let Be=0;for(const gr of ee)gr.top<Pe&&(Be=Math.max(Be,gr.bottom));const mr=Be>0?Math.ceil(Be-ae.top):0,Mi=getComputedStyle(U),bN=parseFloat(Mi.paddingTop)||0,mN=Math.ceil(bN+pe),ku=Math.max(mr,mN);ku>0&&YA(gr=>gr===ku?gr:ku)}}catch{}}},[Ue]),Jr=v.useMemo(()=>xt.filter(U=>U.key&&U.type!=="report-module"&&U.type!=="markdown-module").map(U=>`${U.type}:${U.key}`).join("|"),[xt]),Tm=v.useRef(Jr);Tm.current!==Jr&&(Tm.current=Jr,Ue||(Xb(Pb),Jb(!0))),v.useEffect(()=>{if(!hu)return;const U=setTimeout(()=>Jb(!1),on);return()=>clearTimeout(U)},[hu,Jr,on]),v.useLayoutEffect(()=>{const U=dr.current;if(!U||(Oi(),typeof ResizeObserver>"u"))return;const J=()=>{const ee=dr.current;if(!ee)return;(typeof performance<"u"?performance.now():Date.now())-Em.current<600&&ee.contains(document.activeElement)&&ee.scrollHeight>ee.clientHeight&&(ee.scrollTop=ee.scrollHeight)},ae=new ResizeObserver(()=>Oi());ae.observe(U);const ne=U.querySelector(".rte-default-textarea, .rte-config-fade"),le=ne?new ResizeObserver(()=>{Oi(),J()}):null;return ne&&le&&le.observe(ne),()=>{ae.disconnect(),le?.disconnect()}},[Oi,xt,Ge,je.length,c.length,f.length,Kb,Ue,Jr,hr]);const Cm=v.useRef(-1);v.useEffect(()=>{Ue||fr<=0||fr>=Pb||Cm.current!==fr&&(Cm.current=fr,Ti?.(fr))},[fr,Ue,Ti]);const Sm=v.useMemo(()=>new Set(["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","mp4","mov","webm","mkv","avi","m4v"]),[]),pN=v.useCallback(U=>{const J=t.some(Be=>Be.type==="tag"),ae=U.clipboardData?.getData?.("text/plain")??"";if(h&&!J&&Im(ae)){U.preventDefault(),h(ae.trim());return}const ne=U.clipboardData?.files;if(!ne||ne.length===0||(U.preventDefault(),J))return;const le=[];let ee=!1;for(const Be of Array.from(ne)){const mr=(Be.name||"").split(".").pop()?.toLowerCase()||"";Sm.has(mr)?le.push(Be):ee=!0}if(ee&&fu.current?.error("粘贴文件中含不支持的类型,已自动过滤"),le.length===0)return;const fe=50*1024*1024,Ee=je.reduce((Be,mr)=>Be+mr.size,0),pe=[];let Pe=Ee;for(const Be of le){if(Pe+Be.size>fe){fu.current?.error("文件总大小不能超过 50MB");break}pe.push(Be),Pe+=Be.size}pe.length>0&&St(Be=>[...pe,...Be])},[Sm,t,je,h]);return b.jsx(se.ConfigProvider,{getPopupContainer:VA,children:b.jsxs(se.App,{component:!1,message:{getContainer:()=>zA??cr??document.body},children:[b.jsx(SA,{messageRef:fu}),b.jsxs(xf.Provider,{value:cr,children:[b.jsxs("div",{ref:du,className:`rich-text-editor ${Ai?"rte-richtext-container-expanded":""} ${cN?"rte-editor-selected":""} ${S??""}`,"data-component":"structured-editor",style:fN,onPaste:pN,children:[b.jsx(Db,{files:je,onChange:St,reports:c,onReportRemove:U=>d?.(c.filter(J=>J.id!==U)),fileUrls:f,onFileUrlRemove:U=>m?.(f.filter(J=>J.id!==U))}),t.length===0?b.jsxs("div",{ref:dr,className:`rte-editor rte-editor-default${gt||Zt?" rte-editor-default-with-skill":""}`,style:vm,onClick:ym,children:[(gt||Zt)&&b.jsx("span",{ref:pu,className:"rte-skill-inline-tag-wrap",contentEditable:!1,children:gt?b.jsx(ou,{title:gt.title,onClose:()=>om(null)}):b.jsx(ou,{title:"AI生图",exitTip:"点击退出 AI 生图",onClose:()=>{br(!1),Ft?.()}})}),b.jsx("textarea",{ref:Jl,className:"rte-default-textarea",value:hr,onChange:U=>nm(U.target.value),onKeyDown:oN,placeholder:Zt?"请描述你想要的图片":gt?.usageInstruction||a||"",disabled:l,rows:1,style:{textIndent:Zl?`${Zl}px`:void 0,paddingTop:bu?`${bu}px`:void 0}})]}):b.jsx("div",{ref:dr,className:`rte-editor${Ai?" rte-richtext-fullscreen-active":""}`,style:vm,onClick:ym,onInput:hN,children:b.jsx("div",{className:"rte-config-fade",children:xt.map((U,J)=>{if(ZA.has(J)||U.key&&Xr.has(U.key)||U.exclusionGroup==="separator"&&yu.has(J)||Ai&&U.key!==Ai)return null;const ae=(U.type==="report-module"||U.type==="markdown-module")&&U.key?`${U.key}__module_${U.moduleIndex??0}`:U.key;return b.jsx(db,{node:U,value:ae?we[ae]:void 0,files:Ge,onChange:Eu,onFileChange:eN,thumbnails:FA,onThumbnailChange:tN,videoUrlParse:I,videoUpload:w,onVideoParsingChange:aN,reportListFetch:M,onReportGoGenerate:_,onViewReport:$,hideCurrentSessionReport:F,reportNames:Kb,onClearReport:nN,onResolveMultiName:Tu,onAnalyzeMultiReport:lN,onShiftReportNames:rN,onAgentExit:G,hideAgentClose:Fn==="hideTagClose",onReportUrlParse:Cu,onMarkdownParse:iN,onMarkdownNameParse:sN,onRichtextExpandChange:qA,disabled:l,error:ae?JA[ae]:void 0,index:J,nodeDefaults:cu},ae??`text-${J}`)})},Jr)}),b.jsx(Ob,{isProcessing:r,loading:Kr,disabled:l,sendDisabled:!uN,showFooterUpload:He,footerFiles:je,onFooterFilesChange:St,onAssetLibraryClick:Rn,agentOptions:z,onAgentSelect:GA,hideAgentButton:Fn==="hideAgent",currentAgent:pr,selectedSkill:gt,onSkillSelect:om,onSkillCardClick:Z,onSkillAction:C,skillListFetch:D,onSkillHeaderAction:re,showCreateSkill:jA,createDisabled:me,skillPanelOpen:ve,onSkillPanelOpenChange:dN,skillPanelOpenDelay:ke,onAIImageClick:KA,aiImageSelected:Zt,onAgentExit:QA,onAIImageExit:XA,onSend:Su,padding:Ae})]}),b.jsx("div",{className:"rte-popup-host",ref:UA})]})]})})},Fb="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAFSSURBVHgB3ZTtccIwDIaVXv83I2SDZgSP0BHMBG0naEZhA2boBGQDswHdQJUOGRxjO0Z8HPDe6eJzJD2W4gjgEYSIn2xwK6EIFHqBGysJpMP3ZB0oRbEtmal1NtIxl4OWWsoxEsvqofJ0rgTNASOYq+7SXKDsuYvAcgkq/PWwBLQWqIfdjeRStaBUc4qzgLi9/BzJNmS/sh6bpvmrTfSFacU3scWy1mQryWdSnXiFE8QVUJINLTuyhWzzz/1OZmTN9hEckqtfUOwIGlGCpVRjE+94JFqpMtTeVzO8/UmPxpZU8Qa7aln8Tb9pfwla4WHWrjPvvbbnTBsX7PmLs83EDAH0BxSw1G31+/1FoDg/vPcXR+wocQS1apj4+P92FfhOoLyuBfYlmPgYnGoCjWADzAkzUyJ430awLmphPaxWQVU22BuuApPkHaanjcXSN3t6/QNjTMSJWDcs1QAAAABJRU5ErkJggg==",xA=[{label:"5页",value:5},{label:"10页",value:10},{label:"15页",value:15},{label:"30页",value:30}],kA=({autoLoading:e,batchSize:t,loadingProgress:n,loadIcon:r,onBatchSizeChange:l,onLoadNextPage:a,onStartAutoLoad:i,onStopLoad:s})=>e&&n?b.jsxs("div",{className:"auto_load_progress",children:[r||b.jsx("img",{src:Fb,alt:"自动加载",width:14,height:14}),b.jsxs("span",{children:["正在加载第",n.currentPage,"/",n.totalPages,"页"]}),b.jsx(se.Progress,{percent:n.percentage,type:"line",size:[160,8]}),b.jsx("span",{onClick:s,className:"auto_load_stop_btn",children:"停止加载"})]}):b.jsxs("div",{className:"auto_load_container",children:[b.jsx("div",{onClick:a,className:"auto_load_next_btn",style:{backgroundColor:e?"#f5f5f5":"#2563eb"},children:"加载下一页"}),b.jsxs("div",{className:"right_control_wrap",style:{backgroundColor:e?"#f5f5f5":"#2563eb"},children:[b.jsxs("div",{className:"auto_load_btn",onClick:e?void 0:i,children:[r||b.jsx("img",{src:Fb,alt:"自动加载",width:14,height:14}),b.jsx("span",{children:"自动加载"})]}),b.jsx(se.Select,{value:t,onChange:l,options:xA,disabled:e,size:"small",className:"auto_load_select",popupMatchSelectWidth:84})]})]}),AA=({current:e,loadIcon:t,pageSize:n,total:r,cachedPages:l,loadedCount:a,autoLoading:i=!1,loadingProgress:s,onChange:o,onLoadNextPage:u,onStartAutoLoad:c,onStopLoading:d})=>{const[h,f]=v.useState(5),m=Math.ceil(r/n),y=v.useMemo(()=>l.length>=m,[l,m]),g=()=>Array.from({length:m},(A,P)=>P+1).filter(A=>!l.includes(A)).slice(0,h),E=(N,A,P)=>{const L=l.includes(N);return A==="prev"||A==="next"||A==="jump-prev"||A==="jump-next"?b.jsx("div",{className:"pageBox",children:P}):b.jsxs("div",{className:"pageBox",style:{backgroundColor:e===N?"#2563EB":"#f5f5f5",color:e===N?"#fff":L?"#171717":"#a3a3a3"},children:[N,!L&&b.jsx("span",{className:"unload_spot"})]})};return b.jsxs("div",{className:"pagination_footer",children:[b.jsxs("div",{className:"pagination_leftWrap",children:[b.jsxs("span",{className:"pagination_total",children:[b.jsx($t.InfoCircleOutlined,{style:{color:"#2563EB",marginRight:"4px"}}),"已加载: ",a,"/",r,"条数据"]}),!y&&b.jsx(kA,{loadIcon:t||void 0,autoLoading:i,batchSize:h,loadingProgress:s,disabled:!u||!c,onBatchSizeChange:f,onLoadNextPage:()=>u?.(),onStartAutoLoad:()=>{const N=g();c?.(N)},onStopLoad:()=>d?.()})]}),b.jsx(se.Pagination,{current:e,pageSize:n,total:r,onChange:N=>o(N),showSizeChanger:!1,showQuickJumper:!1,showTotal:()=>"",itemRender:E})]})},Rb=e=>{const{loading:t,autoLoading:n,loadingProgress:r,columns:l=[],dataSource:a=[],total:i,current:s,pageSize:o,cachedPages:u,onChangePage:c,onLoadNextPage:d,onStartAutoLoad:h,onStopLoading:f,...m}=e,y=v.useRef(null),g=v.useCallback(E=>{c(E),u.includes(E)&&y.current?.scrollTo({key:`${(E-1)*o+1}`})},[u,c,o]);return b.jsxs("div",{className:"flex flex-col",children:[b.jsx(se.Table,{ref:y,...m,columns:l,dataSource:a,pagination:!1,virtual:!0}),b.jsx(AA,{loading:t,autoLoading:n,loadingProgress:r,current:s,pageSize:o,total:i,loadedCount:a.length,cachedPages:u,onChange:g,onLoadNextPage:d,onStartAutoLoad:h,onStopLoading:f})]})};Rb.__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 Hb=({texts:e=[],placeholder:t="请输入内容",animationSpeed:n=100,autoPlay:r=!0,value:l,onChange:a,...i})=>{const[s,o]=v.useState(""),[u,c]=v.useState(0),[d,h]=v.useState(!1),[f,m]=v.useState(!1),[y,g]=v.useState(!1),E=v.useRef(void 0),N=v.useRef(void 0),A=v.useRef(e),P=v.useRef(u),L=v.useRef(f),S=v.useRef(s);v.useEffect(()=>{A.current=e,P.current=u,L.current=f,S.current=s});const I=v.useCallback((F,T)=>{let R=0;g(!0);const z=()=>{R<F.length?(o(F.slice(0,R+1)),R++,N.current=window.setTimeout(z,n)):(g(!1),T?.())};z()},[n]),w=v.useCallback(F=>{let T=S.current.length;const R=()=>{T>0?(o(S.current.slice(0,T-1)),T--,N.current=window.setTimeout(R,n/2)):F?.()};R()},[n]),k=v.useCallback(()=>{if(A.current.length===0||L.current)return;h(!0);const F=A.current[P.current];S.current?w(()=>{I(F,()=>{E.current=window.setTimeout(()=>{c(T=>(T+1)%A.current.length),h(!1)},2e3)})}):I(F,()=>{E.current=window.setTimeout(()=>{c(T=>(T+1)%A.current.length),h(!1)},2e3)})},[w,I]);v.useEffect(()=>(r&&e.length>0&&!f&&k(),()=>{E.current&&window.clearTimeout(E.current),N.current&&window.clearTimeout(N.current)}),[u,f,r,e.length,k]),v.useEffect(()=>{!d&&r&&e.length>0&&!f&&k()},[u,d,r,e.length,f,k]);const M=F=>{m(!0),E.current&&window.clearTimeout(E.current),N.current&&window.clearTimeout(N.current),h(!1),g(!1),i.onFocus?.(F)},_=F=>{m(!1),!l&&e.length>0&&(o(""),c(0)),i.onBlur?.(F)},H=F=>{a?.(F.target.value),i.onChange?.(F)},$=()=>f||l?t:s||t;return b.jsxs("div",{style:{position:"relative"},children:[b.jsx(se.Input,{...i,value:l,onChange:H,onFocus:M,onBlur:_,placeholder:$(),style:{...i.style,position:"relative",zIndex:1}}),!f&&!l&&s&&b.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:[b.jsx("span",{children:s}),y&&b.jsx("span",{style:{display:"inline-block",width:1,height:"1.2em",backgroundColor:"#1890ff",marginLeft:2,animation:"blink 1s infinite"}})]}),b.jsx("style",{children:`
147
147
  @keyframes blink {
148
148
  0%, 50% { opacity: 1; }
149
149
  51%, 100% { opacity: 0; }