@farris/x-ui 0.0.9 → 0.1.0
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/farris.x-ui.esm.js +6 -2
- package/farris.x-ui.umd.cjs +1 -1
- package/index.css +1 -1
- package/package.json +1 -1
package/farris.x-ui.esm.js
CHANGED
|
@@ -6044,8 +6044,12 @@ const Qn = /* @__PURE__ */ ue({
|
|
|
6044
6044
|
},
|
|
6045
6045
|
setup(e) {
|
|
6046
6046
|
const t = N("loading"), n = N(""), u = L(() => `fluens-dynamic-component-${e.config.instanceId}`), r = L(() => e.config.position === "inline"), i = L(() => !e.config.jsUrl && !!e.config.url), o = L(() => ({
|
|
6047
|
-
|
|
6048
|
-
|
|
6047
|
+
...r.value ? {
|
|
6048
|
+
width: "fit-content",
|
|
6049
|
+
maxWidth: "100%"
|
|
6050
|
+
} : {
|
|
6051
|
+
width: "100%"
|
|
6052
|
+
},
|
|
6049
6053
|
height: "auto",
|
|
6050
6054
|
...t.value === "ready" && r.value ? {
|
|
6051
6055
|
padding: "16px 0"
|
package/farris.x-ui.umd.cjs
CHANGED
|
@@ -29,7 +29,7 @@ $3`),t}function hf(e){const t=e.split(`
|
|
|
29
29
|
overflow: hidden;
|
|
30
30
|
`,c=vi("caf-assistant-widget-container__inner",f),m=o.computed(()=>{const y=wi`
|
|
31
31
|
display: ${l.value?"block":"none"};
|
|
32
|
-
`;return vi("caf-assistant-widget-container__error",y)}),g=()=>{const y=a.value;y&&(s.value=new uh(y))},p=()=>{const y=s.value;y&&(y.dispose(),s.value=null)},v=()=>{const y=r.value,h=i.value;y&&(y.unmount(),y.dispose()),h&&h.cleanup(),r.value=null,i.value=null},x=async()=>{const y=await n(e.widgetAPIURL);if(!y)throw new Error("Failed to load widget API");await y.initialize();const h=y.createWidget();i.value=y,r.value=h},k=y=>{console.error(y),l.value=y};return o.watch(()=>e.widgetAPIURL,async()=>{if(a.value)try{v(),await x();const y=a.value,h=r.value;h==null||h.updateOptions(e.widgetOptions),h==null||h.updateData(e.widgetData),y&&h&&await h.mount(y)}catch(y){k(y)}}),o.watch(()=>e.widgetOptions,(y,h)=>{try{const b=r.value;b&&(!h||!u(h,y))&&b.updateOptions(y)}catch(b){k(b)}}),o.watch(()=>e.widgetData,(y,h)=>{try{const b=r.value;b&&(!h||!u(h,y))&&b.updateData(y)}catch(b){k(b)}}),o.onMounted(async()=>{try{const y=a.value;if(y){g();const h=s.value;if(h){await x();const b=r.value;b&&(b.updateOptions(e.widgetOptions),b.updateData(e.widgetData),b.mount(h.getElement()),o.nextTick(()=>{y.parentElement&&(y.style.width="100%")}))}}}catch(y){k(y)}}),o.onBeforeUnmount(async()=>{try{v(),p()}catch(y){console.error(y)}}),()=>o.createVNode("div",{class:d.value},[o.createVNode("div",{ref:a,class:c},null),o.createVNode("div",{class:m.value},null)])}}),Va=(e,t)=>{var n;if(e.type===Oe.AssistantWidgetComplete){const u=e;return u.widgetUrl?o.createVNode(yn,{key:`widget-${t}`,widgetAPIURL:u.widgetUrl,widgetOptions:{mode:"embedded",implOptions:u.widgetImplOptions},widgetData:((n=u.widgetData)==null?void 0:n.data)||{}},null):null}return e.type===Oe.AssistantWidgetPending?o.createVNode("div",{class:"f-chat-bubble-widget-pending",key:`widget-loading-${t}`},[o.createVNode("span",{class:"f-chat-todo-status-icon f-chat-todo-status-working"},null),o.createVNode("span",{class:"f-chat-bubble-widget-pending-text"},[o.createTextVNode("数据生成中......")])]):null},sh=3e4,Ma=8e3,Le=new Map,Qe=new Map,Jn=new Map,_t=[];function Re(e){return String(e??"").replace(/^\ufeff/,"").replace(/[\u200b\u200c\u200d]/g,"").replace(/\u00a0/g," ").trim()}function eu(e){const t=Re(e);if(t)for(let n=_t.length-1;n>=0;n--)_t[n]===t&&_t.splice(n,1)}function lh(e){typeof window>"u"||(window.__fluens_dynamic_component_bootstrap_instance_id=e)}function tu(e){if(typeof window>"u")return;const t=window;t.__fluens_dynamic_component_bootstrap_instance_id===e&&delete t.__fluens_dynamic_component_bootstrap_instance_id}function ch(){return _t[_t.length-1]||void 0}function nu(e,t){const n=Re(t);return n?Re(e.instanceId)===n||e.componentId!=null&&Re(String(e.componentId))===n||e.name!=null&&Re(String(e.name))===n:!1}function ki(e){const t=Re(e);if(!t)return null;const n=Le.get(t);if(n)return{canonicalKey:t,entry:n};for(const[i,r]of Le.entries())if(Re(i)===t)return{canonicalKey:i,entry:r};const u=[];for(const[i,r]of Le.entries())nu(r.config,t)&&u.push({key:i,entry:r});if(u.length===1){const{key:i,entry:r}=u[0];return i!==t&&console.warn(`[DynamicComponent] register id "${t}" resolved to pending instanceId "${i}" (alias match)`),{canonicalKey:i,entry:r}}if(u.length>1)return console.warn(`[DynamicComponent] register id "${t}" is ambiguous (${u.length} pending matches); refusing`),null;if(Le.size===1){const[i,r]=[...Le.entries()][0];return console.warn(`[DynamicComponent] register id "${t}" unmatched; using sole pending instance "${i}"`),{canonicalKey:i,entry:r}}return null}function Ba(e,t){for(const[n,u]of Qe){const i=Re(n),r=e!==""&&i===e,a=String(t??"").trim(),s=e&&nu(u.config,e)||a&&nu(u.config,a);if(r||s)return console.warn(`[DynamicComponent] register skipped: id "${e||a}" already active (canonical "${n}"); unload first — second register yields "no pending", not duplicate mount`),!0}return!1}function Ci(){return{pendingKeys:[...Le.keys()],bootstrapQueue:[..._t],activeKeys:[...Qe.keys()],...typeof window<"u"?{windowBootstrapPeek:window.__fluens_dynamic_component_bootstrap_instance_id}:{}}}function dh(e){console.warn("[DynamicComponent] register diagnostics",{claimedNormalized:e,...Ci()})}function fh(e){const t=Re(e);if(t){if(Ba(t,e))return{ok:!1,reason:"already_active_duplicate"};const u=ki(t);if(u)return{ok:!0,...u}}else if(Ba("",e))return{ok:!1,reason:"already_active_duplicate"};for(let n=0;n<_t.length;n++){const u=_t[n],i=ki(u);if(i)return _t.splice(n,1),t&&Re(u)!==t&&console.warn(`[DynamicComponent] register id "${t}" did not match pending; using bootstrap instanceId "${u}" (sync bundle entry or use window.__fluens_dynamic_component_bootstrap_instance_id)`),{ok:!0,...i}}return{ok:!1,reason:"no_pending"}}function za(e){const t=Re(e);if(!t)return null;const n=Qe.get(t);if(n)return n;for(const[r,a]of Qe.entries())if(Re(r)===t)return a;const u=[];for(const r of Qe.values())nu(r.config,t)&&u.push(r);const i=[...new Map(u.map(r=>[r.config.instanceId,r])).values()];if(i.length===1)return i[0].config.instanceId!==t&&console.warn(`[DynamicComponent] assistant post id "${t}" resolved to instanceId "${i[0].config.instanceId}" (alias match)`),i[0];if(i.length>1)return console.warn(`[DynamicComponent] assistant post id "${t}" is ambiguous (${i.length} active matches)`),null;if(Qe.size===1){const r=[...Qe.values()][0];return console.warn(`[DynamicComponent] assistant post id "${t}" unmatched; delivering to sole active instance "${r.config.instanceId}"`),r}return null}function hh(e){const t=Re(e);if(!t)return t;const n=za(t);if(n)return n.config.instanceId;const u=ki(t);return u?u.canonicalKey:Le.size===1?[...Le.keys()][0]:Qe.size===1?[...Qe.values()][0].config.instanceId:t}function Ei(e){try{return JSON.parse(JSON.stringify(e))}catch{return{...e}}}function ja(e,t){if(typeof e.onAssistantMessage!="function")return!0;try{return e.onAssistantMessage(Ei(t)),!0}catch(n){return console.warn("[DynamicComponent] onAssistantMessage failed",n),!1}}function mh(e){const t=`fluens-dynamic-component-${e.instanceId}`;let n=document.getElementById(t);return n||(n=document.createElement("div"),n.id=t,n.style.width="100%",n.style.height="100%"),n}function Ha(e){const t=Qe.get(e.instanceId);if(t)return Promise.resolve(t.api);const n=Le.get(e.instanceId);if(n)return new Promise((i,r)=>{const a=n.resolve,s=n.reject;n.resolve=l=>{a(l),i(l)},n.reject=l=>{s(l),r(l)}});if((e.name||e.componentId)&&!e.jsUrl)return Promise.reject(new Error(`Dynamic component resource is empty: ${e.name||e.componentId}`));const u=mh(e);return new Promise((i,r)=>{const a={config:e,container:u,resolve:i,reject:r,timeoutId:0},s=setTimeout(()=>{a.postLoadRegisterCheckTimerId!=null&&(clearTimeout(a.postLoadRegisterCheckTimerId),a.postLoadRegisterCheckTimerId=void 0),Le.delete(e.instanceId),eu(e.instanceId),tu(e.instanceId),r(new Error(`Dynamic component script load timeout: ${e.name||e.componentId}`))},sh);a.timeoutId=s,Le.set(e.instanceId,a),_t.push(e.instanceId),lh(e.instanceId);const l=document.createElement("script");l.src=(e==null?void 0:e.jsUrl)??"",l.dataset.dynamicComponentId=e.instanceId,l.async=!1,l.onload=()=>{a.postLoadRegisterCheckTimerId=window.setTimeout(()=>{a.postLoadRegisterCheckTimerId=void 0,Le.has(e.instanceId)&&(clearTimeout(s),Le.delete(e.instanceId),eu(e.instanceId),tu(e.instanceId),r(new Error(`Dynamic component did not call __fluens_dynamic_component_register within ${Ma}ms after load: ${e.name||e.componentId}`)))},Ma)},l.onerror=()=>{clearTimeout(s),a.postLoadRegisterCheckTimerId!=null&&(clearTimeout(a.postLoadRegisterCheckTimerId),a.postLoadRegisterCheckTimerId=void 0),Le.delete(e.instanceId),eu(e.instanceId),tu(e.instanceId),r(new Error(`Failed to load dynamic component: ${e.name||e.componentId}`))},document.head.appendChild(l)})}function $a(e){var i;const t=Qe.get(e);if(t){try{t.api.unmount()}catch{}(i=t.scriptElement)==null||i.remove(),Qe.delete(e)}const n=Le.get(e);n&&(n.postLoadRegisterCheckTimerId!=null&&(clearTimeout(n.postLoadRegisterCheckTimerId),n.postLoadRegisterCheckTimerId=void 0),clearTimeout(n.timeoutId),Le.delete(e)),Jn.delete(e);const u=document.getElementById(`fluens-dynamic-component-${e}`);u&&u.remove()}function ph(e,t){const n=Re(e);if(!n)return!1;const u=za(n);if(u)return ja(u.api,t);const i=hh(n),r=Jn.get(i)??[],a=r.findIndex(s=>s.messageId===t.messageId);return a>=0?r[a]=Ei(t):r.push(Ei(t)),Jn.set(i,r),!1}typeof window<"u"&&(window.__fluens_get_dynamic_component_registry_debug_snapshot=Ci,window.__fluens_dynamic_component_register=function(e,t){const n=Re(e),u=fh(e);if(!u.ok){if(u.reason==="already_active_duplicate")return;dh(n),console.warn(`[DynamicComponent] no pending for register id "${n}" (raw ${JSON.stringify(e)}); see diagnostics above. Try: unload tab / avoid double register / ensure FXDynamicComponent loaded this jsUrl first / empty id if sole pending`);return}const{canonicalKey:i,entry:r}=u;eu(i),tu(i),r.postLoadRegisterCheckTimerId!=null&&(clearTimeout(r.postLoadRegisterCheckTimerId),r.postLoadRegisterCheckTimerId=void 0),clearTimeout(r.timeoutId),Le.delete(i);const a={config:r.config,container:r.container,api:t,scriptElement:document.currentScript};Qe.set(i,a),a.container.parentElement;try{t.mount(r.container,r.config)}catch(l){console.error(`Failed to mount dynamic component: ${i}`,l)}const s=[i];n&&n!==i&&s.push(n);for(const l of s){const d=Jn.get(l);d&&d.length>0&&(Jn.delete(l),d.forEach(f=>ja(t,f)))}r.resolve(t)});const xn=o.defineComponent({name:"FXDynamicComponent",props:{config:{type:Object,required:!0}},setup(e){const t=o.ref("loading"),n=o.ref(""),u=o.computed(()=>`fluens-dynamic-component-${e.config.instanceId}`),i=o.computed(()=>e.config.position==="inline"),r=o.computed(()=>!e.config.jsUrl&&!!e.config.url),a=o.computed(()=>({width:"fit-content",maxWidth:"100%",height:"auto",...t.value==="ready"&&i.value?{padding:"16px 0"}:{},...t.value==="ready"&&!i.value?{height:"100%",overflow:"hidden"}:{}}));return o.onMounted(()=>{r.value||(t.value="loading",n.value="",Ha(e.config).then(()=>{t.value="ready"}).catch(s=>{t.value="error",n.value=s.message||"Unknown error"}))}),o.onUnmounted(()=>{r.value||$a(e.config.instanceId)}),()=>r.value?null:o.createVNode("div",{class:"f-chat-dynamic-component-body",style:a.value},[o.createVNode("div",{id:u.value,style:{width:"100%",height:"100%",display:t.value==="ready"?"":"none"}},null),t.value==="loading"&&o.createVNode("div",{class:"f-chat-dynamic-component-loading"},[o.createVNode("span",{class:"f-chat-dynamic-component-loading-spinner"},null),o.createVNode("span",null,[o.createTextVNode("加载中......")])]),t.value==="error"&&o.createVNode("div",{class:"f-chat-dynamic-component-error"},[o.createVNode("span",{class:"f-chat-dynamic-component-error-icon"},[o.createTextVNode("!")]),o.createVNode("span",null,[n.value])])])}}),Ua=(e,t,n)=>{if(e.type===Oe.DynamicComponentComplete){const u=e;if(!u.config)return null;if(u.config.position==="inline")return o.createVNode(xn,{key:`dc-${t}`,config:u.config},null);const i={type:"file",fileContent:{type:"md",name:u.config.title}},r={onPreviewFile:a=>{n.emit("showDynamicComponent",u.config)}};return o.nextTick(()=>n.emit("dynamicComponentsDetected",[u.config])),o.createVNode("div",{style:{padding:"16px 0"}},[n.renderFileEmbeddedContent(i,r)])}return e.type===Oe.DynamicComponentPending?o.createVNode("div",{class:"f-chat-bubble-widget-pending",key:`dc-loading-${t}`},[o.createVNode("span",{class:"f-chat-todo-status-icon f-chat-todo-status-working"},null),o.createVNode("span",{class:"f-chat-bubble-widget-pending-text"},[o.createTextVNode("组件加载中......")])]):null};function gh(){return{[Oe.Text]:mf,[Oe.AssistantWidgetComplete]:Va,[Oe.AssistantWidgetPending]:Va,[Oe.DynamicComponentComplete]:Ua,[Oe.DynamicComponentPending]:Ua}}const bh=o.defineComponent({name:"FXBubbleTextContent",props:ec,emits:["dynamicComponentsDetected","showDynamicComponent"],setup(e,t){const{renderFileEmbeddedContent:n}=mo(),{propertyStates:u,registerProperty:i,updatePropertyValue:r,startStreaming:a}=Nr();i("title",e.title??""),i("subtitle",e.subtitle??""),i("text",e.text??""),o.watch([()=>e.title,()=>e.subtitle,()=>e.text],([p,v,x])=>{r("title",p??""),r("subtitle",v??""),r("text",x??"")});const s=o.computed(()=>e.textFormat==="markdown"),l=o.ref(!1),d=o.computed(()=>{var p,v,x;return l.value?{title:((p=u.title)==null?void 0:p.displayedValue)??"",subtitle:((v=u.subtitle)==null?void 0:v.displayedValue)??"",text:((x=u.text)==null?void 0:x.displayedValue)??""}:{title:e.title,subtitle:e.subtitle,text:e.text}}),f=o.computed(()=>fc(d.value.text)),c={shouldShowMarkdown:s,emit:t.emit,renderFileEmbeddedContent:n},m=gh(),g=()=>f.value.length===0?null:o.createVNode("div",{class:"f-chat-bubble-text-collection"},[f.value.map((p,v)=>{var x;return(x=m[p.type])==null?void 0:x.call(m,p,v,c)})]);return o.onMounted(()=>{l.value&&a()}),()=>o.createVNode(o.Fragment,null,[d.value.title&&o.createVNode("div",{class:"f-chat-bubble-content-title"},[d.value.title]),d.value.subtitle&&o.createVNode("div",{class:"f-chat-bubble-content-subtitle"},[d.value.subtitle]),g()])}}),yh={content:{type:Object},outputMode:{type:String,default:"full"}};function ru({status:e}){const t=`f-chat-todo-status-icon f-chat-todo-status-${e.toLowerCase()}`;return o.createVNode("span",{class:t,"aria-hidden":!0},null)}const Wa=100,xh=o.defineComponent({name:"FXBubbleThink",props:yh,setup(e,t){var z;const{propertyStates:n,registerProperty:u,updatePropertyValue:i,isAllDone:r}=Nr(),{elapsedSeconds:a,hasEverStarted:s,start:l,stop:d,reset:f}=zu(),c=o.ref(((z=e.content)==null?void 0:z.completed)!==!0),m=o.ref(null),g=o.ref(null),p=o.ref(!1),v=o.ref(!1),x=o.computed(()=>e.outputMode==="streaming"),k=o.computed(()=>{var M;return(M=e.content)==null?void 0:M.completed}),y=o.computed(()=>{var $,F,R;const M=($=h.value)==null?void 0:$.trim(),I=M?M.slice(0,8):"",B=M&&M.length>8?"…":"",D=I?`<span class="f-chat-bubble-thinking-preview">${I}${B}</span>`:"";if(k.value){const O=s.value?`(用时${a.value}秒)`:"";return(((F=e.content)==null?void 0:F.title)??"思考完成"+O)+D}return(((R=e.content)==null?void 0:R.title)??"正在思考......")+D}),h=o.computed(()=>{var M,I;return x.value?((M=n.content)==null?void 0:M.displayedValue)??"":((I=e.content)==null?void 0:I.content)??""}),b=o.computed(()=>({"f-chat-bubble-thinking":!0,"is-pending":!k.value,"is-completed":k.value})),w=()=>{const M=m.value;if(!M||!p.value){v.value=!1;return}v.value=M.scrollTop>0};o.watch(()=>k.value,M=>{M?d():l()},{immediate:!0}),o.watch(()=>k.value,M=>{M&&(c.value=!1)}),o.watch(()=>e.content,M=>{M&&(n.content?i("content",M.content??""):u("content",M.content??""))},{immediate:!0}),o.watch(h,async()=>{if(c.value){await o.nextTick();const M=g.value;if(!M)return;await o.nextTick(),p.value=M.scrollHeight>Wa;const I=m.value;I&&p.value&&(I.scrollTop=I.scrollHeight,v.value=!0)}},{immediate:!0}),o.watch(c,async M=>{if(M){await o.nextTick();const I=g.value;if(!I)return;await o.nextTick(),p.value=I.scrollHeight>Wa;const B=m.value;B&&p.value&&(B.scrollTop=B.scrollHeight,v.value=!0)}}),o.onUnmounted(()=>{f()}),t.expose({instance:{get loadDone(){return e.content?(x.value?r.value:!0)&&k.value:!0}}});const C=()=>{c.value=!c.value},E=()=>k.value?null:o.createVNode(ru,{status:"Working"},null),_=()=>!h.value||!c.value?null:o.createVNode("div",{class:"f-chat-bubble-thinking-content"},[o.createVNode("div",{class:"f-chat-bubble-thinking-scroll-container",ref:m,onScroll:w},[p.value&&v.value&&o.createVNode("div",{class:"f-chat-bubble-thinking-fade-mask"},null),o.createVNode("div",{class:"f-chat-bubble-thinking-text-wrapper"},[o.createVNode("div",{ref:g,class:"f-chat-bubble-thinking-content-text",innerHTML:h.value},null)])])]);return()=>o.createVNode("div",{class:b.value},[o.createVNode("div",{class:"f-chat-bubble-thinking-header",onClick:C},[E(),o.createVNode("span",{class:"f-chat-bubble-thinking-title",innerHTML:y.value},null),h.value&&o.createVNode("i",{class:"fx-icon fx-icon-arrow-right",style:{transform:c.value?"rotate(90deg)":"rotate(0deg)",transition:"all 0.3s ease-in-out"}},null)]),_()])}}),wh={content:{type:Object}},Ga={id:{type:String},arrowOffsetX:{type:Number,default:0},class:{type:String,default:""},customStyles:{type:Object,default:null},isSimpleTips:{type:Boolean,default:!1},fitContent:{type:Boolean,default:!1},host:{type:Object},leftBoundary:{type:Object},keepWidthWithReference:{type:Boolean,default:!1},minWidth:{type:Number,default:-1},offsetX:{type:Object,default:o.ref(0)},offsetY:{type:Object,default:o.ref(0)},placement:{type:String,default:"bottom"},reference:{type:Object},rightBoundary:{type:Object},showArrow:{type:Boolean,default:!1},title:{type:String},visible:{type:Boolean,default:!1},zIndex:{type:Number,default:-1},limitContentBySpace:{type:Boolean,default:!1},beforeClose:{type:Function}};function vh(e){const t=e.host?e.host:"body",n=o.computed(()=>t==="body"?0:t?t.getBoundingClientRect().top:0),u=o.computed(()=>t==="body"?window.innerHeight:t?t.getBoundingClientRect().bottom:window.innerHeight),i=o.computed(()=>t==="body"?0:t?t.getBoundingClientRect().left:0),r=o.computed(()=>t==="body"?document.body.getBoundingClientRect().width:t?t.getBoundingClientRect().width-(e.rightBoundary?e.rightBoundary.getBoundingClientRect().width:0):document.body.getBoundingClientRect().width),a=o.computed(()=>t==="body"?window.innerHeight:t?t.getBoundingClientRect().height:window.innerHeight);return{host:t,hostLeft:i,hostTop:n,hostWidth:r,hostHeight:a,hostBottom:u}}function Ah(e,t,n,u){const i=o.ref(e.offsetX||0),r=o.ref(e.offsetY||0),a=o.ref(-1),s=o.ref(-1),l=o.ref(-1),d=o.ref(-1),f=o.ref(e.placement),c=o.ref(0),m=o.ref(0),g=o.ref(0),p=o.computed(()=>document.documentElement.scrollLeft),v=o.computed(()=>document.documentElement.scrollTop),{hostLeft:x,hostTop:k,hostWidth:y,hostHeight:h,hostBottom:b}=u;o.watch(()=>e.offsetX,T=>{i.value=T});const w=o.computed(()=>{const T={left:`${m.value}px`,top:`${g.value}px`,transform:`translate(${i.value}px, ${r.value}px)`};return e.zIndex!==-1&&(T["z-index"]=e.zIndex),e.fitContent?e.keepWidthWithReference&&n.value&&a.value>=n.value.getBoundingClientRect().width&&(T.width=`${a.value}px`):a.value!==-1&&(T.width=`${a.value}px`),e.minWidth!==-1&&(T.minWidth=`${e.minWidth}px`),e.customStyles&&Object.assign(T,e.customStyles),s.value>0&&(T.maxHeight=s.value+"px"),T}),C=o.computed(()=>({left:`${c.value}px`,transform:`translateX(${e.arrowOffsetX}px)`}));function E(T){if(T&&e.keepWidthWithReference){const L=T.getBoundingClientRect();a.value=Math.max(e.minWidth,L.width)}}function _(T,L){const W=y.value-T.width-4;return W>0?W:L}function z(T,L){const W=h.value-T.height-12;return W>0?W:L}function M(T,L,W){const K=c.value,Z=L.left-x.value+L.width/2+p.value,Y=L.top-k.value-(T.height+W.height)+v.value;return{popoverLeft:Z,popoverTop:Y,arrowLeft:K}}function I(T,L,W){const K=L.top-k.value+(L.height+W.height)+v.value,Z=z(T,K);return Math.min(K,Z)}function B(T,L){const W=_(L,T),K=T<=W?c.value:T-W;return{popoverLeft:Math.min(T,W),arrowLeft:K,maxHeight:0}}function D(T,L){const W=_(L,T),K=T<=W?c.value:T-W;return{popoverLeft:T,arrowLeft:K,maxHeight:0}}function H(T,L,W){const K=L.left-x.value+p.value,{arrowLeft:Z,popoverLeft:Y}=D(K,T),{popoverTop:ue}=M(T,L,W);return{popoverLeft:Y,popoverTop:ue,arrowLeft:Z,maxHeight:0}}function $(T,L,W){const K=L.left-x.value+L.width/2-(W.width/2-(T.left-x.value))+p.value,{arrowLeft:Z,popoverLeft:Y}=B(K,T),ue=I(T,L,W);return{popoverLeft:Y,popoverTop:ue,arrowLeft:Z,maxHeight:0}}function F(T,L,W){const K=L.left-x.value+p.value,{arrowLeft:Z,popoverLeft:Y}=B(K,T),ue=I(T,L,W);return{popoverLeft:Y,popoverTop:ue,arrowLeft:Z,maxHeight:0}}function R(T,L,W){const K=L.left-x.value;let Z=0,Y=0,ue=0,le=0,De="bottom-left";window.innerWidth-K>T.width?Z=K+p.value:(Z=L.right-T.width+p.value,ue=T.width-W.width-20);let Te=0;if(e.limitContentBySpace){const Xt={topHeight:L.top-k.value-W.height-8,bottomHeight:b.value-L.bottom-W.height-8};Te=Math.max(Xt.topHeight,Xt.bottomHeight),T.height>Te&&(le=Te,n.value.classList.add("popover-limitmax"))}const yt=le?Math.floor(le):T.height,Me=L.top-k.value+(L.height+W.height);return b.value-Me>yt?Y=Me+v.value:(Y=L.top-yt-W.height+v.value,b.value-Me>L.top?(Y=Me+v.value,yt>L.top&&(Y=b.value-yt)):(Y=Y<0?0:Y,De="top")),n.value.classList.add("popover-"+De,"bs-popover-"+De),{popoverLeft:Z<0?5:Z,popoverTop:Y,arrowLeft:ue,maxHeight:le}}function O(T,L,W){const K=L.left+L.width,Z=Math.max(L.top-(T.height/2-L.height/2),k.value);let Y=k.value+h.value-T.height;Y<0&&(Y=Z);const ue=Math.min(Z,Y);return{popoverLeft:K,popoverTop:ue,arrowLeft:0,maxHeight:0}}function U(T,L,W){const K=L.left+L.width,Z=Math.max(L.top-L.height,k.value);let Y=k.value+h.value-T.height;Y<0&&(Y=Z);const ue=Math.min(Z,Y);return{popoverLeft:K,popoverTop:ue,arrowLeft:0,maxHeight:0}}const re=new Map([["top",M],["top-left",H],["bottom",$],["bottom-left",F],["right",O],["right-top",U],["auto",R]]);function te(T){var Y;e.keepWidthWithReference&&E(T);const L=T.getBoundingClientRect();l.value=L.top,d.value=L.left;const W=t.value?t.value.getBoundingClientRect():{height:4,width:4},K=(Y=n.value)==null?void 0:Y.getBoundingClientRect();a.value=K.width;const Z=re.get(f.value);if(Z){const{arrowLeft:ue,popoverLeft:le,popoverTop:De,maxHeight:Te}=Z(K,L,W);c.value=ue,m.value=le,g.value=De,s.value=Te||-1}}function P(T){if(T){const L=T.getBoundingClientRect();(L.left!==d.value||L.top!==l.value)&&te(T)}}function V(){f.value=e.placement,c.value=0,m.value=0,g.value=0,a.value=-1}return{arrowStyle:C,popoverStyle:w,position:f,popoverWidth:a,fitToReference:E,followToReferencePosition:P,locateToReference:te,resetPosition:V}}function kh(e,t,n,u,i,r,a){const s=o.ref(e.visible),l=o.computed(()=>s.value),{fitToReference:d,locateToReference:f,resetPosition:c}=a;let m;async function g(){s.value&&(e.beforeClose&&typeof e.beforeClose=="function"&&!await e.beforeClose()||(s.value=!1,document.body.removeEventListener("click",m),document.body.removeEventListener("mousedown",m),document.body.removeEventListener("wheel",m,!0),document.removeEventListener("scroll",m),c(),t.emit("hidden")))}m=v=>{var y;if(!i.value)return;const x=i.value.contains(v.target);if(v.type==="scroll"||v.type==="wheel"&&x){g();return}if(v.target.closest(".time-picker-panel"))return;const k=(y=v.target)==null?void 0:y.closest(".popover");if(k&&u.value&&k===u.value){v.type!=="scroll"&&v.type!=="wheel"&&v.stopPropagation();return}if(!x&&s.value){const h=i.value.closest(".popover");h&&h.removeEventListener("click",m),g()}};async function p(v){if(u.value&&(e.showArrow===!1||e.showArrow&&n.value)&&v){c(),s.value=!0,i.value=v,r.value&&d(v),await o.nextTick(),f(v),document.body.addEventListener("click",m),document.body.addEventListener("mousedown",m),document.body.addEventListener("wheel",m,!0),document.addEventListener("scroll",m),(top==null?void 0:top.document)!==document&&(top==null||top.document.addEventListener("mousedown",m));const x=v.closest(".popover");x&&x.addEventListener("click",m),t.emit("shown")}}return t.expose({hide:g,popoverRef:u,show:p,shown:l,isShow:s}),{showPopover:s,hidePopverOnClickBodyHandler:m}}function Ch(e,t,n,u,i,r){const{popoverWidth:a,fitToReference:s,followToReferencePosition:l}=i;function d(){var f;if(r.value&&((f=r.value.style)==null?void 0:f.display)!=="none"&&n.value){l(n.value);const c=n.value.getBoundingClientRect();u.value&&c.width!==a.value&&s(n.value)}}return{onResize:d}}function Eh(e,t=500){const n=o.ref(e.value);let u;const i=o.watch(e,a=>{clearTimeout(u),u=setTimeout(()=>{n.value=a},t)}),r=()=>{clearTimeout(u),i()};return o.onUnmounted(r),{delayedValue:n,cleanup:r}}const Kt=o.defineComponent({name:"FXPopover",props:Ga,emits:["shown","hidden"],setup(e,t){const n=o.ref(),u=o.ref(),i=o.ref(e.reference),r=o.ref(e.keepWidthWithReference),a=o.computed(()=>!!e.title),s=vh(e),{host:l}=s,d=Ah(e,n,u,s),{position:f,arrowStyle:c,popoverStyle:m,fitToReference:g,locateToReference:p}=d,{showPopover:v,hidePopverOnClickBodyHandler:x}=kh(e,t,n,u,i,r,d),{onResize:k}=Ch(e,t,i,r,d,u),y=o.computed(()=>{let E=f.value;E==="top-left"&&(E="top");const _=`popover in popover-${E}`,z=`bs-popover-${E}`,M={"popover-fitcontent":e.fitContent,fade:!0};M[_]=!0,M[z]=!0;const I=(e.class||"").split(" ");return e.isSimpleTips&&I.unshift("popover-tips"),I.reduce((B,D)=>(B[D]=!0,B),M),M}),h=o.computed(()=>({"popover-content":!0,"popover-body":!0})),b=o.computed(()=>{const E={};return E.opacity=v.value?1:0,E.visibility=v.value?"visible":"hidden",E.zIndex=1060,E}),w=o.computed(()=>e.isSimpleTips?!0:e.showArrow),{delayedValue:C}=Eh(b,50);return o.onMounted(()=>{var E;r.value&&g(i.value),e.reference&&p(i.value),window.addEventListener("resize",k),(E=u.value)==null||E.focus()}),o.onUnmounted(()=>{document.body.removeEventListener("click",x),window.removeEventListener("resize",k),v.value=!1}),()=>o.createVNode(o.Teleport,{to:l},{default:()=>{var E;return[o.withDirectives(o.createVNode("div",{tabindex:"-1",ref:u,class:y.value,style:{...m.value,...C.value},onMousedown:_=>{_.stopPropagation()},onClick:_=>{_.stopPropagation()}},[w.value&&o.createVNode("div",{ref:n,class:"popover-arrow arrow",style:c.value},null),a.value&&o.createVNode("h3",{class:"popover-title popover-header"},[e.title]),o.createVNode("div",{class:h.value},[t.slots.default&&((E=t.slots)==null?void 0:E.default())])]),[[o.vShow,v.value]])]}})}}),uu="FarrisX_PopoverInstancesKey";window[uu]=window[uu]||new WeakMap;function _i(e,t,n){e.stopPropagation();const u=t.value;u&&u.value&&!u.value.isShow&&(u.value.show(n),window[uu].set(n,u.value))}function Xa(e,t,n){e.stopPropagation(),t.value.value.hide(),window[uu].delete(n)}function _h(e,t,n){e.stopPropagation();const u=t.value;u&&u.value&&(u.value.isShow?Xa(e,t,n):_i(e,t,n))}function qa(e,t,n){t.arg&&t.arg==="toggle"?_h(e,t,n):_i(e,t,n)}const Za={mounted:(e,t,n)=>{t.modifiers.hover?(e.addEventListener("mouseenter",u=>_i(u,t,e)),e.addEventListener("mouseleave",u=>Xa(u,t,e))):t.modifiers.click?e.addEventListener("click",u=>qa(u,t,e)):e.addEventListener("click",u=>qa(u,t,e)),e.classList.add("v-popover")},unMounted:(e,t,n)=>{}};Kt.install=e=>{e.component(Kt.name,Kt),e.directive("fxpopover",Za)};const Ya={type:{type:String,default:"StartedToDo"},status:{type:String,default:"NotStart"},message:{type:String,default:""},taskDetail:{type:String,default:""},todoList:{type:Array,default:[]},detailViewMode:{type:String,default:"hover"},initExpanded:{type:Boolean,default:!1},showLoading:{type:Boolean,default:!0},showLabel:{type:Boolean,default:!0},loading:Object,shimmer:{type:Boolean,default:!0},outputMode:{type:String,default:"streaming"}},Ka={items:{type:Array,default:()=>[]}},Qa={id:{type:Number||String,default:0},status:{type:String},task:{type:String,default:""},todoList:{type:Array,default:[]},detailViewMode:{type:String,default:"expand"},initExpanded:{type:Boolean,default:!0},showLoading:{type:Boolean,default:!0},showLabel:{type:Boolean,default:!1},shimmer:{type:Boolean,default:!0},title:{type:String,default:""},message:{type:String,default:""},outputMode:{type:String,default:"full"}},iu=o.defineComponent({name:"FXTodoListItemView",props:Qa,emits:["click"],setup(e,{emit:t}){const{propertyStates:n,registerProperty:u,updatePropertyValue:i,startStreaming:r}=Nr();u("title",e.title??""),u("task",e.task??""),o.watch([()=>e.title,()=>e.task],([m,g])=>{i("title",m??""),i("task",g??"")});const a=o.computed(()=>["f-chat-todo-item",{"is-done":e.status==="Done","is-working":e.status==="Working","is-not-start":e.status==="NotStart","no-shimmer":!e.shimmer}]),s=o.computed(()=>["f-chat-todo-task",{"is-done":e.status==="Done"}]);function l(){t("click",e,e.id)}const d=o.computed(()=>e.outputMode==="streaming"),f=o.computed(()=>{var m;return d.value?((m=n.title)==null?void 0:m.displayedValue)??"":e.title??""}),c=o.computed(()=>{var m;return d.value?((m=n.task)==null?void 0:m.displayedValue)??"":e.task??""});return o.computed(()=>{var m;return d.value?((m=n.detail)==null?void 0:m.displayedValue)??"":e.message??""}),o.onMounted(()=>{d.value&&r()}),()=>o.createVNode("li",{key:e.id,class:a.value,onClick:l},[e.todoList&&e.todoList.length>0&&o.createVNode(Qt,{todoList:e.todoList,status:e.status,message:e.task,taskDetail:e.message,detailViewMode:e.detailViewMode,initExpanded:e.initExpanded,showLoading:e.showLoading,showLabel:e.showLabel,outputMode:e.outputMode},null),!e.todoList||e.todoList.length===0&&o.createVNode(o.Fragment,null,[e.showLoading&&o.createVNode(ru,{status:e.status??"Done"},null),f.value?o.createVNode("div",{class:"f-chat-todo-task-wrapper"},[o.createVNode("span",{class:s.value},[f.value]),o.createVNode("div",{class:"f-chat-todo-task-description"},[c.value])]):o.createVNode("div",{class:s.value},[c.value])])])}}),er=o.defineComponent({name:"FXTodoListView",props:Ka,setup(e){return()=>{var t;return(t=e.items)!=null&&t.length?o.createVNode("ul",{class:"f-chat-todo-items"},[e.items.map((n,u)=>o.createVNode(iu,o.mergeProps({key:u},n),null))]):null}}}),Sh="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='18px'%20height='18px'%20viewBox='0%200%2018%2018'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3e编组%207%3c/title%3e%3cdefs%3e%3clinearGradient%20x1='50%25'%20y1='0%25'%20x2='50%25'%20y2='100%25'%20id='linearGradient-1'%3e%3cstop%20stop-color='%230D7FE6'%20offset='0%25'%3e%3c/stop%3e%3cstop%20stop-color='%231EBBC6'%20offset='58.0673923%25'%3e%3c/stop%3e%3cstop%20stop-color='%232AE7AF'%20offset='100%25'%3e%3c/stop%3e%3c/linearGradient%3e%3cpath%20d='M7.55915932,0%20L13.7556941,3.41136535%20L13.7556941,11.284674%20L13.3483936,11.690778%20L7.386,8.406%20L7.38699821,14.9818613%20L6.43606745,14.9818613%20L0.817648054,11.8789694%20L0,10.332184%20L0,3.84230019%20L1.11160458,3.1505903%20L6.167,6.164%20L6.16702601,0.0484363034%20L7.55915932,0%20Z%20M6.22734637,8.44496623%20L1.7439756,11.0288454%20L6.22734637,13.5008368%20L6.22734637,8.44496623%20Z%20M12.540835,4.77769015%20L8.0314841,7.40118228%20L12.540835,9.89639007%20L12.540835,4.77769015%20Z%20M1.21847977,4.6422718%20L1.21847977,9.89639007%20L5.74466316,7.33704011%20L1.21847977,4.6422718%20Z%20M7.38699821,1.29872452%20L7.38699821,6.38587585%20L11.9618229,3.74647178%20L7.38699821,1.29872452%20Z'%20id='path-2'%3e%3c/path%3e%3clinearGradient%20x1='81.0966666%25'%20y1='38.5584607%25'%20x2='28.8545509%25'%20y2='61.9626707%25'%20id='linearGradient-4'%3e%3cstop%20stop-color='%23FFFFFF'%20offset='0%25'%3e%3c/stop%3e%3cstop%20stop-color='%23FFFFFF'%20stop-opacity='0'%20offset='100%25'%3e%3c/stop%3e%3c/linearGradient%3e%3cfilter%20x='0.0%25'%20y='0.0%25'%20width='100.0%25'%20height='100.0%25'%20filterUnits='objectBoundingBox'%20id='filter-5'%3e%3cfeGaussianBlur%20stdDeviation='0'%20in='SourceGraphic'%3e%3c/feGaussianBlur%3e%3c/filter%3e%3clinearGradient%20x1='44.8152906%25'%20y1='77.6521765%25'%20x2='44.8152906%25'%20y2='3.26462903%25'%20id='linearGradient-6'%3e%3cstop%20stop-color='%23FFFFFF'%20offset='0%25'%3e%3c/stop%3e%3cstop%20stop-color='%23FFFFFF'%20stop-opacity='0'%20offset='100%25'%3e%3c/stop%3e%3c/linearGradient%3e%3cfilter%20x='0.0%25'%20y='0.0%25'%20width='100.0%25'%20height='100.0%25'%20filterUnits='objectBoundingBox'%20id='filter-7'%3e%3cfeGaussianBlur%20stdDeviation='0'%20in='SourceGraphic'%3e%3c/feGaussianBlur%3e%3c/filter%3e%3clinearGradient%20x1='3.93796935%25'%20y1='32.607826%25'%20x2='78.9687461%25'%20y2='60.0462823%25'%20id='linearGradient-8'%3e%3cstop%20stop-color='%23FFFFFF'%20offset='0%25'%3e%3c/stop%3e%3cstop%20stop-color='%23FFFFFF'%20stop-opacity='0'%20offset='100%25'%3e%3c/stop%3e%3c/linearGradient%3e%3cfilter%20x='0.0%25'%20y='0.0%25'%20width='100.0%25'%20height='100.0%25'%20filterUnits='objectBoundingBox'%20id='filter-9'%3e%3cfeGaussianBlur%20stdDeviation='0'%20in='SourceGraphic'%3e%3c/feGaussianBlur%3e%3c/filter%3e%3clinearGradient%20x1='56.0769337%25'%20y1='45.0797149%25'%20x2='24.9463054%25'%20y2='71.1433818%25'%20id='linearGradient-10'%3e%3cstop%20stop-color='%23159BD7'%20offset='0%25'%3e%3c/stop%3e%3cstop%20stop-color='%23FFFFFF'%20stop-opacity='0'%20offset='100%25'%3e%3c/stop%3e%3c/linearGradient%3e%3clinearGradient%20x1='10.434388%25'%20y1='68.063656%25'%20x2='86.6988821%25'%20y2='30.8651063%25'%20id='linearGradient-11'%3e%3cstop%20stop-color='%2321C6C1'%20offset='0%25'%3e%3c/stop%3e%3cstop%20stop-color='%23FFFFFF'%20stop-opacity='0'%20offset='100%25'%3e%3c/stop%3e%3c/linearGradient%3e%3clinearGradient%20x1='50%25'%20y1='0%25'%20x2='50%25'%20y2='100%25'%20id='linearGradient-12'%3e%3cstop%20stop-color='%230D7FE6'%20offset='0%25'%3e%3c/stop%3e%3cstop%20stop-color='%232AE7AF'%20offset='100%25'%3e%3c/stop%3e%3c/linearGradient%3e%3c/defs%3e%3cg%20id='页面-1'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='输入框'%20transform='translate(-383,%20-2915)'%3e%3cg%20id='编组-3'%20transform='translate(353,%202900)'%3e%3cg%20id='编组-12'%20transform='translate(16,%200)'%3e%3cg%20id='编组-7'%20transform='translate(14,%2015)'%3e%3crect%20id='矩形'%20x='0'%20y='0'%20width='18'%20height='18'%3e%3c/rect%3e%3cg%20id='编组-35'%20transform='translate(0.2571,%200.2571)'%3e%3crect%20id='矩形'%20x='0'%20y='0'%20width='17.4857143'%20height='17.4857143'%3e%3c/rect%3e%3cg%20id='编组-19备份-17'%20transform='translate(1.0286,%200.5143)'%3e%3cpath%20d='M8.37444647,0.834547606%20L14.5709813,4.24591296%20L14.5709813,12.1192216%20L14.1636807,12.5253256%20L8.20128715,9.24054761%20L8.20228536,15.8164089%20L7.25135461,15.8164089%20L1.63293521,12.713517%20L0.815287151,11.1667316%20L0.815287151,4.67684779%20L1.92689173,3.98513791%20L6.98228715,6.99854761%20L6.98231316,0.882983909%20L8.37444647,0.834547606%20Z%20M7.04263352,9.27951383%20L2.55926275,11.8633931%20L7.04263352,14.3353844%20L7.04263352,9.27951383%20Z%20M13.3561221,5.61223775%20L8.84677126,8.23572989%20L13.3561221,10.7309377%20L13.3561221,5.61223775%20Z%20M2.03376692,5.47681941%20L2.03376692,10.7309377%20L6.55995031,8.17158771%20L2.03376692,5.47681941%20Z%20M8.20228536,2.13327213%20L8.20228536,7.22042346%20L12.77711,4.58101939%20L8.20228536,2.13327213%20Z'%20id='形状结合'%20fill='url(%23linearGradient-1)'%3e%3c/path%3e%3cg%20id='路径-2-+-路径-3-+-路径-4蒙版'%20transform='translate(0.8153,%200.8345)'%3e%3cmask%20id='mask-3'%20fill='white'%3e%3cuse%20xlink:href='%23path-2'%3e%3c/use%3e%3c/mask%3e%3cuse%20id='蒙版'%20fill='url(%23linearGradient-1)'%20xlink:href='%23path-2'%3e%3c/use%3e%3cpolygon%20id='路径-2'%20fill='url(%23linearGradient-4)'%20filter='url(%23filter-5)'%20mask='url(%23mask-3)'%20points='4.25315881%206.97898081%206.77390576%206.97898081%207.02656062%208.27871177%202.85827337%2011.0934106%201.11764364%208.72438079'%3e%3c/polygon%3e%3cpolygon%20id='路径-3'%20fill='url(%23linearGradient-6)'%20filter='url(%23filter-7)'%20mask='url(%23mask-3)'%20points='7.02656062%206.72375166%208.13485635%204.53274022%208.34127598%201.90699543%205.4451985%201.76583085%205.65253089%205.06118714%206.77390576%206.72375166'%3e%3c/polygon%3e%3cpolygon%20id='路径-4'%20fill='url(%23linearGradient-8)'%20filter='url(%23filter-9)'%20mask='url(%23mask-3)'%20points='10.0650382%207.40118228%207.32091739%207.49951705%207.32091739%208.25868082%208.54200343%2010.0061721%2010.9306691%2010.9000701%2012.5091187%208.51626021'%3e%3c/polygon%3e%3c/g%3e%3cpath%20d='M8.37444647,0.834547606%20L14.5709813,4.24591296%20L14.5709813,12.1192216%20L14.1636807,12.5253256%20L6.98231316,8.56885311%20L6.98231316,0.882983909%20L8.37444647,0.834547606%20Z%20M8.20228536,2.13327213%20L8.20228536,7.22042346%20L8.49131316,7.05254761%20L8.49185956,7.71336245%20L9.03131316,8.12754761%20L8.84677126,8.23572989%20L13.3561221,10.7309377%20L13.3553132,5.61654761%20L13.6305018,5.15381301%20L12.77711,4.58101939%20L8.20228536,2.13327213%20Z'%20id='形状结合'%20fill='url(%23linearGradient-10)'%20fill-rule='nonzero'%3e%3c/path%3e%3cpolygon%20id='路径'%20fill='url(%23linearGradient-11)'%20fill-rule='nonzero'%20points='6.7778308%208.05322127%207.08945008%209.24101764%202.55926275%2011.8633931%202.19155022%2010.6380421'%3e%3c/polygon%3e%3cg%20id='编组-21'%20fill='url(%23linearGradient-12)'%3e%3cpath%20d='M7.62936495,9.94195975%20C8.65711289,9.94195975%209.49026721,9.10880543%209.49026721,8.08105749%20C9.49026721,7.05330955%208.65711289,6.22015523%207.62936495,6.22015523%20C6.60161701,6.22015523%205.7684627,7.05330955%205.7684627,8.08105749%20C5.7684627,9.10880543%206.60161701,9.94195975%207.62936495,9.94195975%20Z%20M13.9785177,6.03107309%20C14.7793603,6.03107309%2015.4285714,5.38186193%2015.4285714,4.58101939%20C15.4285714,3.78017684%2014.7793603,3.13096568%2013.9785177,3.13096568%20C13.1776752,3.13096568%2012.528464,3.78017684%2012.528464,4.58101939%20C12.528464,5.38186193%2013.1776752,6.03107309%2013.9785177,6.03107309%20Z%20M7.62936495,16.4714598%20C8.4302075,16.4714598%209.07941866,15.8222486%209.07941866,15.0214061%20C9.07941866,14.2205635%208.4302075,13.5713524%207.62936495,13.5713524%20C6.8285224,13.5713524%206.17931125,14.2205635%206.17931125,15.0214061%20C6.17931125,15.8222486%206.8285224,16.4714598%207.62936495,16.4714598%20Z%20M1.45005371,13.0387617%20C2.25089625,13.0387617%202.90010741,12.3895505%202.90010741,11.588708%20C2.90010741,10.7878654%202.25089625,10.1386543%201.45005371,10.1386543%20C0.649211158,10.1386543%200,10.7878654%200,11.588708%20C0,12.3895505%200.649211158,13.0387617%201.45005371,13.0387617%20Z%20M7.62936495,2.51342642%20C8.32342849,2.51342642%208.88607816,1.95077675%208.88607816,1.25671321%20C8.88607816,0.56264967%208.32342849,0%207.62936495,0%20C6.93530141,0%206.37265174,0.56264967%206.37265174,1.25671321%20C6.37265174,1.95077675%206.93530141,2.51342642%207.62936495,2.51342642%20Z%20M13.9785177,12.9913309%20C14.6725813,12.9913309%2015.2352309,12.4286812%2015.2352309,11.7346177%20C15.2352309,11.0405541%2014.6725813,10.4779045%2013.9785177,10.4779045%20C13.2844542,10.4779045%2012.7218045,11.0405541%2012.7218045,11.7346177%20C12.7218045,12.4286812%2013.2844542,12.9913309%2013.9785177,12.9913309%20Z%20M1.45005371,5.50262617%20C2.14411725,5.50262617%202.70676692,4.9399765%202.70676692,4.24591296%20C2.70676692,3.55184942%202.14411725,2.98919975%201.45005371,2.98919975%20C0.755990164,2.98919975%200.193340494,3.55184942%200.193340494,4.24591296%20C0.193340494,4.9399765%200.755990164,5.50262617%201.45005371,5.50262617%20Z'%20id='形状结合'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Fh=300,Dh={Working:"正在执行任务",Done:"已完成任务",NotStart:"待执行任务"},Qt=o.defineComponent({name:"FXStartedTodo",props:Ya,setup(e){const t=o.ref(null),n=o.ref(null),u=o.ref(null),i=o.ref(null),r=o.computed(()=>e.outputMode==="streaming"),{displayContent:a}=fo(()=>({detail:e.taskDetail??""}),()=>!0,r,{charInterval:30}),s=o.ref(e.initExpanded),l=o.computed(()=>({"f-chat-message-started-todo--content":!0,"d-none":!s.value}));function d(){e.detailViewMode!=="expand"&&(i.value!=null&&(window.clearTimeout(i.value),i.value=null),u.value=window.setTimeout(()=>{t.value&&n.value&&n.value.show(t.value),u.value=null},Fh))}function f(){e.detailViewMode!=="expand"&&(u.value!=null&&(window.clearTimeout(u.value),u.value=null),i.value=window.setTimeout(()=>{var x,k;(k=(x=n.value)==null?void 0:x.hide)==null||k.call(x),i.value=null},150))}function c(){if(e.detailViewMode==="none")return null;const x=a.value.detail??"";return o.createVNode(o.Fragment,null,[x?o.createVNode("div",{class:"f-chat-started-todo-task-detail"},[x]):null,o.createVNode(er,{items:e.todoList},null)])}function m(){e.detailViewMode==="expand"&&(s.value=!s.value)}function g(){return e.detailViewMode==="expand"?o.createVNode("i",{class:"fx-icon fx-icon-arrow-right",style:{transform:s.value?"rotate(90deg)":"rotate(0deg)",transition:"all 0.3s ease-in-out"}},null):null}function p(){return e.detailViewMode==="hover"&&o.createVNode(Kt,{ref:n,class:"f-chat-started-todo-popover"},{default:()=>[o.createVNode("div",{class:"f-chat-started-todo-popover-content",onMouseenter:()=>{i.value!=null&&(window.clearTimeout(i.value),i.value=null)},onMouseleave:f},[c()])]})}function v(){return e.showLoading?e.loading?e.loading:e.status==="Done"?o.createVNode("img",{src:Sh},null):o.createVNode(ru,{status:e.status},null):null}return()=>o.createVNode("div",{ref:t,class:["f-chat-message-started-todo",{"is-working":e.status==="Working"}],onMouseenter:d,onMouseleave:f},[o.createVNode("div",{class:"f-chat-message-started-todo--header",onClick:m},[e.showLabel&&o.createVNode("span",{class:"f-chat-started-todo-label"},[Dh[e.status]]),v(),o.createVNode("span",{class:"f-chat-started-todo-message",innerHTML:e.message},null),g()]),e.detailViewMode==="expand"&&o.createVNode("div",{class:l.value},[c()]),p()])}});Qt.install=e=>{e.component(Qt.name,Qt)};const Th=o.defineComponent({name:"FXBubbleThoughtChain",props:wh,setup(e,t){const{elapsedSeconds:n,hasEverStarted:u,start:i,stop:r,reset:a}=zu(),s=o.computed(()=>{var c;return((c=e.content)==null?void 0:c.status)==="Done"}),l=o.computed(()=>{var c;return((c=e.content)==null?void 0:c.message)??"正在思考......"}),d=o.computed(()=>{var g,p;const c=((g=e.content)==null?void 0:g.doneMessage)??((p=e.content)==null?void 0:p.message)??"思考完成",m=u.value?`(用时${n.value}秒)`:"";return""+c+m}),f=o.computed(()=>s.value?d.value:l.value);return o.watch(()=>{var c;return(c=e.content)==null?void 0:c.status},c=>{c==="Working"?i():c==="Done"?r():a()},{immediate:!0}),o.onUnmounted(()=>{a()}),t.expose({instance:{get loadDone(){return e.content?s.value:!0}}}),()=>{var c,m,g;return e.content?o.createVNode(Qt,{status:((c=e.content)==null?void 0:c.status)??"Working",message:f.value,todoList:(m=e.content)==null?void 0:m.todoList,detailViewMode:((g=e.content)==null?void 0:g.detailViewMode)??"expand",showLabel:!1,showLoading:!0,initExpanded:!0},null):null}}}),tr=o.defineComponent({name:"UserAuthMessage",props:{content:{type:Object,required:!0},onConfirm:{type:Function,default:void 0}},setup(e){return()=>o.createVNode("div",{class:"f-ec-auth"},[o.createVNode("div",{class:"f-ec-auth-desc"},[e.content.description]),o.createVNode("div",{class:"f-ec-auth-actions"},[e.content.options.map(t=>o.createVNode("button",{key:t.optionId,type:"button",class:"f-ec-auth-btn",onClick:()=>{var n;(n=e.onConfirm)==null||n.call(e,t.optionId,t.name,t.message??t.name),console.info("[UserAuth]",t.optionId,t.name)}},[t.name]))])])}}),Nh=300,wn=o.defineComponent({name:"FXToolUseMessage",props:{content:{type:Object,required:!0}},setup(e){const t=o.computed(()=>e.content.toolResultApplied===!0||String(e.content.result??"").trim().length>0),n=o.computed(()=>e.content.success===!1),u=o.ref(!1);let i=setTimeout(()=>{u.value=!0},Nh);o.onBeforeUnmount(()=>{i&&clearTimeout(i)});const r=o.computed(()=>t.value),a=o.computed(()=>u.value&&!t.value),s=o.computed(()=>n.value?"执行失败":r.value?"执行完成":"调用中"),l=o.ref(!1),d=o.computed(()=>({"f-chat-tool-use":!0,"is-done":r.value,"is-error":n.value})),f=o.computed(()=>({"f-chat-tool-use-status":!0,"is-done":r.value&&!n.value,"is-run":a.value&&!n.value,"is-error":n.value}));o.watch(()=>[e.content.result,e.content.toolResultApplied,e.content.success],()=>{t.value&&(l.value=!1)},{flush:"post"});const c=()=>t.value?o.createVNode("div",{class:"f-chat-tool-use-result"},[e.content.result??""]):null;return()=>o.createVNode("div",{class:d.value},[o.createVNode("div",{class:"f-chat-tool-use-header",onClick:()=>{l.value=!l.value}},[o.createVNode("i",{class:"fx-icon fx-icon-thinking_tool tool-icon"},null),o.createVNode("span",{class:"f-chat-tool-use-name"},[e.content.toolDescription??"tool"]),o.createVNode("div",{class:f.value},[n.value?o.createVNode("i",{class:"fx-icon fx-icon-fail_line f-chat-tool-use-status-icon","aria-hidden":"true"},null):o.createVNode(ru,{status:r.value?"Done":a.value?"Working":"NotStart"},null),o.createVNode("span",{class:"f-chat-tool-use-status-text"},[s.value])]),o.createVNode("i",{class:"fx-icon fx-icon-arrow-right",style:{transform:l.value?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.2s ease"}},null)]),l.value&&o.createVNode("div",{class:"f-chat-tool-use-content"},[c()])])}});wn.install=e=>{e.component(wn.name,wn)};const nr=o.defineComponent({name:"FXBubble",components:{"fx-user-auth-inline":tr,"fx-app-preview-inline":at,FXToolUse:wn},props:Fr,setup(e,t){const n=o.shallowRef(),u=o.ref(),i=o.ref(),r=o.computed(()=>!!e.showAvatar),a=o.computed(()=>r.value===!0||e.header==="ContentHeader"),s=o.computed(()=>t.slots.leftFooter||t.slots.rightFooter),l=o.computed(()=>{var D;return Ae({},(D=e.styles)==null?void 0:D.footer)}),d=D=>{if(e.attachmentRowClickOpensPreview!==!1&&e.onPreview){if(D.type==="md"&&D.content){e.onPreview({content:D.content,contentType:"markdown"});return}if(D!=null&&D.url){const H=D!=null&&D.fullScreenPreview?"fullScreen":"splitScreen";e.onPreview({url:D.url,previewMode:H,title:D.name})}}},f=D=>{if(e.attachmentRowClickOpensPreview===!1||!e.onPreview)return;const H=D==null?void 0:D.filter(F=>F.type==="md"&&F.content);if(H.length===0)return;const $=Object.fromEntries(H.map(F=>[F.name,F.content??""]));e.onPreview({contentMap:$,contentType:"markdown"})},{renderFileEmbeddedContent:c,renderPageEmbeddedContent:m}=mo(),g=o.ref(""),p=o.computed(()=>{var H,$;if((H=e.content)!=null&&H.footerContent)return e.content.footerContent;const D=($=e.content)==null?void 0:$.structuredContent;return D&&(D.footerTemplate||D.footerUrl||D.footerFile)?{type:D.footerUrl?"page":D.footerFile?"file":"template",pageUrl:D.footerUrl,fileContent:D.footerFile,template:D.footerTemplate,width:D.footerWidth,height:D.footerHeight}:null});o.watch(()=>{var D;return(D=p.value)==null?void 0:D.width},D=>{if(!D){g.value="";return}if(D.endsWith("%")){const H=parseFloat(D);isNaN(H)||o.nextTick(()=>{var F,R;const $=(R=(F=n.value)==null?void 0:F.parentElement)==null?void 0:R.clientWidth;$&&(g.value=`${$*H/100}px`)})}else g.value=D},{immediate:!0});const v=D=>{if(!D||D.length===0)return"我";const H=D.charAt(0);return/[\u4e00-\u9fa5]/.test(H)?H:H.toUpperCase()};function x(){return e.header==="ContentHeader"?Gl:Xl}const k=x(),{renderHeader:y}=k(e,t),h=()=>{var $,F,R;const D=(($=e.content)==null?void 0:$.sender)??"发送人",H=v(((F=e.content)==null?void 0:F.sender)??"");return o.createVNode("div",{class:"f-chat-bubble-avatar"},[(R=e.content)!=null&&R.avatar?o.createVNode("img",{src:e.content.avatar,alt:D},null):o.createVNode("div",{class:"f-chat-bubble-avatar-initial"},[H])])},b=()=>{var H;const D=(H=e.content)==null?void 0:H.toolUseAboveText;return D!=null&&D.length?o.createVNode("div",{class:"f-chat-bubble-tool-use-group"},[D.map(($,F)=>o.createVNode(wn,{key:$.toolUseId??`tu-${F}`,content:$},null))]):null},w=()=>{var D;return(D=e.content)!=null&&D.thinkingContent?o.createVNode(xh,{ref:u,content:e.content.thinkingContent,outputMode:e.outputMode},null):null},C=()=>{var D;return(D=e.content)!=null&&D.startedTodo?o.createVNode(Th,{ref:i,content:e.content.startedTodo},null):null},E=D=>{if(!(D!=null&&D.type))return null;const{type:H}=D;return H==="page"&&D.pageUrl?m(D,{onNavigate:$=>{var F;(F=e.onPreview)==null||F.call(e,{url:$})}}):H==="file"&&D.fileContent?c(D,{onPreviewFile:d,onBatchPreviewFile:f}):H==="template"&&D.template?D.template():null},_=()=>{var F,R,O;if(!((O=(R=(F=e.content)==null?void 0:F.structuredContent)==null?void 0:R.sections)!=null&&O.length))return null;const{sections:D,showDivider:H}=e.content.structuredContent,$=U=>{const{content:re,label:te}=U;return te||re&&typeof re=="string"?o.createVNode(o.Fragment,null,[o.createVNode("span",{class:"f-chat-bubble-structured-section-item-dot"},null),U.label&&o.createVNode("span",{class:"f-chat-bubble-structured-section-item-label"},[U.label]),o.createVNode("span",{class:"f-chat-bubble-structured-section-item-content"},[U.content])]):E(U.content)};return o.createVNode("div",{class:["f-chat-bubble-structured",{"structure-content-divider":H}]},[D.map((U,re)=>o.createVNode("div",{key:re,class:["f-chat-bubble-structured-section",{"section-divider":U.showDivider}]},[o.createVNode("div",{class:"f-chat-bubble-structured-section-header"},[U.icon&&(U.icon.startsWith("http")||U.icon.startsWith("//")||U.icon.startsWith("../")||/\.(png|jpg|jpeg|gif|svg|webp|bmp)$/i.test(U.icon)?o.createVNode("img",{alt:U.title,src:U.icon,class:"f-chat-bubble-structured-section-icon"},null):o.createVNode("i",{class:`fx-icon ${U.icon}`,style:U.iconStyle},null)),o.createVNode("span",{class:"f-chat-bubble-structured-section-title"},[U.title])]),U.items&&U.items.length>0&&o.createVNode("div",{class:"f-chat-bubble-structured-section-items"},[U.items.map((te,P)=>o.createVNode("div",{key:P,class:"f-chat-bubble-structured-section-item"},[$(te)]))])]))])},z=()=>{const D=p.value;if(!D)return null;const H={};return g.value&&(H.width=g.value),D.height&&(H.height=`${D.height}px`),o.createVNode("div",{class:"f-chat-bubble-content-footer",style:H},[E(D)])},M=()=>{const D=e.attachmentRowClickOpensPreview!==!1?d:void 0;return o.createVNode(ho,{attachments:e.attachments??[],enableFixedWidth:e.placement==="end",showDownloadButton:e.attachmentShowDownload!==!1,onPreview:D,onBatchPreview:e.attachmentRowClickOpensPreview!==!1?f:void 0},null)},I=()=>{var H;const D=(H=e.content)==null?void 0:H.compositeInlineBlocks;return D!=null&&D.length?D.map(($,F)=>$.kind==="userAuth"?o.createVNode(o.resolveComponent("fx-user-auth-inline"),{key:`inline-auth-${F}`,content:$.content,onConfirm:e.onUserAuthConfirm},null):o.createVNode(o.resolveComponent("fx-app-preview-inline"),{key:`inline-preview-${F}`,content:$.content,onOpen:e.onPreview},null)):null},B=()=>{var D,H,$,F,R,O;return o.createVNode("div",{class:`f-chat-bubble-content ${e.placement}`},[a.value&&y(),M(),o.createVNode("div",{class:`f-chat-bubble-content-text-wrapper ${e.placement}`},[(D=e.content)!=null&&D.compositeOrderedBeforeMarkdownRender?e.content.compositeOrderedBeforeMarkdownRender():o.createVNode(o.Fragment,null,[w(),b()]),C(),_(),o.createVNode(bh,{title:((H=e.content)==null?void 0:H.title)??"",subtitle:(($=e.content)==null?void 0:$.subtitle)??"",text:typeof((F=e.content)==null?void 0:F.text)=="string"?e.content.text:"",textFormat:((R=e.content)==null?void 0:R.textFormat)??"plain",placement:e.placement,onDynamicComponentsDetected:e==null?void 0:e.onDynamicComponentsDetected,onShowDynamicComponent:e==null?void 0:e.onShowDynamicComponent},null),z(),(O=e.compositeTailRender)==null?void 0:O.call(e),I()]),s.value&&o.createVNode("div",{class:"f-chat-bubble-footer",style:l.value},[t.slots.leftFooter&&o.createVNode("div",{class:"f-chat-bubble-footer-left"},[t.slots.leftFooter()]),t.slots.rightFooter&&o.createVNode("div",{class:"f-chat-bubble-footer-right"},[t.slots.rightFooter()])])])};return()=>o.createVNode("div",{class:"f-chat-bubble-container",ref:n},[o.createVNode("div",{class:`f-chat-bubble-wrapper ${e.placement}`},[e.placement==="start"?o.createVNode(o.Fragment,null,[r.value&&h(),B()]):o.createVNode(o.Fragment,null,[B(),r.value&&h()])])])}}),Ja={customClass:{type:[Object,String,Array],default:""},customStyle:{type:[Object,String],default:""}},Si=o.defineComponent({name:"FXBubbleAction",props:Ja,setup(e,t){const n=o.computed(()=>Ae({},e.customStyle));return()=>t.slots.default&&o.createVNode("span",{class:"f-chat-bubble-footer-action",style:n.value},[t.slots.default()])}});nr.install=e=>{e.component(nr.name,nr),e.component(Si.name,Si)};const es={items:{type:Array,default:()=>[]},modelValue:{type:Number,default:0},direction:{type:String,default:"horizontal"},autoplay:{type:Boolean,default:!1},interval:{type:Number,default:3e3},loop:{type:Boolean,default:!0},trigger:{type:String,default:"click"},indicatorPosition:{type:String,default:"inside"},arrowVisibility:{type:String,default:"hover"},showIndicator:{type:Boolean,default:!0},showArrow:{type:Boolean,default:!0},showInfo:{type:Boolean,default:!0},height:{type:[String,Number],default:"400px"},styles:{type:Object,default:()=>({})},classNames:{type:Object,default:()=>({})},customClass:{type:[String,Array,Object],default:""},customStyle:{type:[Object,String],default:""},buttonPosition:{type:String,default:"inner"}},ts={item:{type:Object,default:()=>({})},index:{type:Number,default:0},active:{type:Boolean,default:!1},showInfo:{type:Boolean,default:!0},styles:{type:Object,default:()=>({})},classNames:{type:Object,default:()=>({})}},ou=o.defineComponent({name:"FXCarouselItem",props:ts,emits:["click"],setup(e,{slots:t,emit:n}){const u=o.computed(()=>{var c;const f={"fx-carousel--item":!0,"fx-carousel--item-active":e.active};return ye(f,(c=e.classNames)==null?void 0:c.item)}),i=o.computed(()=>{var c,m;const f=Ae({},(c=e.styles)==null?void 0:c.item);return Ae(f,(m=e.styles)==null?void 0:m.item)}),r=()=>{var f,c,m;return e.item.image?o.createVNode("img",{class:["fx-carousel--item-image",(f=e.classNames)==null?void 0:f.image],style:(c=e.styles)==null?void 0:c.image,src:e.item.image,alt:(m=e.item.title)==null?void 0:m.toString()},null):null},a=()=>{var f,c,m,g;return e.item.content?o.createVNode("div",{class:["fx-carousel--item-content",(f=e.classNames)==null?void 0:f.content],style:(c=e.styles)==null?void 0:c.content},[e.item.content]):t.default?o.createVNode("div",{class:["fx-carousel--item-content",(m=e.classNames)==null?void 0:m.content],style:(g=e.styles)==null?void 0:g.content},[t.default()]):null},s=()=>{var f,c;return e.item.title?o.createVNode("h3",{class:["fx-carousel--item-title",(f=e.classNames)==null?void 0:f.title],style:(c=e.styles)==null?void 0:c.title},[e.item.title]):null},l=()=>{var f,c;return e.item.description?o.createVNode("p",{class:["fx-carousel--item-description",(f=e.classNames)==null?void 0:f.description],style:(c=e.styles)==null?void 0:c.description},[e.item.description]):null},d=f=>{e.item.disabled||n("click",f,e.item,e.index)};return()=>o.createVNode("div",{class:u.value,style:i.value,onClick:d},[r(),a(),e.showInfo&&o.createVNode("div",{class:"fx-carousel--item-info"},[s(),l()])])}});function Lh(e){const{items:t,autoplay:n=!1,interval:u=3e3,loop:i=!0,direction:r="horizontal"}=e,a=o.ref(0),s=o.ref(!1),l=o.ref(null),d=o.computed(()=>t.length),f=o.computed(()=>d.value<=1);o.computed(()=>a.value===0?i?d.value-1:0:a.value-1),o.computed(()=>a.value===d.value-1?i?0:a.value:a.value+1);const c=o.computed(()=>{const h=-a.value*100;return{transform:r==="horizontal"?`translateX(${h}%)`:`translateY(${h}%)`,transition:"transform 0.5s ease"}}),m=h=>{h<0||h>=d.value||(a.value,a.value=h)},g=()=>{f.value||(a.value===d.value-1?m(i?0:a.value):m(a.value+1))},p=()=>{f.value||(a.value===0?m(i?d.value-1:0):m(a.value-1))},v=()=>{!n||f.value||(x(),l.value=window.setInterval(()=>{s.value||g()},u))},x=()=>{l.value&&(clearInterval(l.value),l.value=null)},k=()=>{s.value=!0,n&&x()},y=()=>{s.value=!1,n&&v()};return o.onMounted(()=>{v()}),o.onUnmounted(()=>{x()}),{currentIndex:a,totalItems:d,isSingleItem:f,trackStyle:c,goTo:m,next:g,prev:p,handleMouseEnter:k,handleMouseLeave:y}}const rr=o.defineComponent({name:"FXCarousel",props:es,emits:["update:modelValue","change","item-click"],setup(e,{slots:t,emit:n}){const{currentIndex:u,isSingleItem:i,trackStyle:r,goTo:a,next:s,prev:l,handleMouseEnter:d,handleMouseLeave:f}=Lh({items:e.items,autoplay:e.autoplay,interval:e.interval,loop:e.loop,direction:e.direction}),c=w=>{n("update:modelValue",w),n("change",w,u.value)},m=o.computed(()=>{var C;const w={"fx-carousel":!0,"fx-carousel--vertical":e.direction==="vertical","fx-carousel--single":i.value,"fx-carousel--button-outer":e.buttonPosition==="outer","fx-carousel--button-inner":e.buttonPosition==="inner"};return ye(w,(C=e.classNames)==null?void 0:C.root)}),g=o.computed(()=>{var E;const w={height:typeof e.height=="number"?`${e.height}px`:e.height},C=Ae(w,e.customStyle);return Ae(C,(E=e.styles)==null?void 0:E.root)}),p=o.computed(()=>{var C;const w={"fx-carousel--container":!0,"fx-carousel--container-hover":e.arrowVisibility==="hover"};return ye(w,(C=e.classNames)==null?void 0:C.container)}),v=o.computed(()=>{var C;return ye({"fx-carousel--track":!0},(C=e.classNames)==null?void 0:C.track)}),x=o.computed(()=>{var C;const w={"fx-carousel--indicator":!0,"fx-carousel--indicator-outside":e.indicatorPosition==="outside","fx-carousel--indicator-none":e.indicatorPosition==="none"||!e.showIndicator};return ye(w,(C=e.classNames)==null?void 0:C.indicator)}),k=w=>{var E,_;const C={"fx-carousel--arrow":!0,"fx-carousel--arrow-left":w==="left","fx-carousel--arrow-right":w==="right","fx-carousel--arrow-never":e.arrowVisibility==="never"||!e.showArrow};return C[`fx-carousel--arrow-${e.buttonPosition}`]=!0,ye(C,w==="left"?(E=e.classNames)==null?void 0:E.arrowLeft:(_=e.classNames)==null?void 0:_.arrowRight)},y=w=>{var _,z;if(i.value)return null;const C=w==="left"?l:s,E=t[w==="left"?"prevArrow":"nextArrow"];return o.createVNode("button",{class:k(w),style:w==="left"?(_=e.styles)==null?void 0:_.arrowLeft:(z=e.styles)==null?void 0:z.arrowRight,onClick:C,"aria-label":`${w} arrow`},[E?E():o.createVNode("i",{style:"font-size: 60px;",class:`fx-icon fx-icon-arrow-${w==="left"?"left":"right"}`},null)])},h=()=>{var w;return i.value||!e.showIndicator?null:o.createVNode("div",{class:x.value,style:(w=e.styles)==null?void 0:w.indicator},[e.items.map((C,E)=>{var _,z;return o.createVNode("button",{"aria-label":`indicator ${E}`,key:E,class:["fx-carousel--indicator-item",{"fx-carousel--indicator-item-active":E===u.value}],style:E===u.value?(_=e.styles)==null?void 0:_.indicatorItemActive:(z=e.styles)==null?void 0:z.indicatorItem,onClick:()=>{a(E),c(E)}},null)})])},b=()=>o.createVNode("div",{class:v.value,style:r.value},[e.items.map((w,C)=>o.createVNode(ou,{key:w.id||`item_${C}`,item:w,showInfo:e.showInfo,index:C,active:C===u.value,styles:e.styles,classNames:e.classNames,onClick:(E,_,z)=>{n("item-click",E,_,z)}},{default:()=>{var E,_;return[(E=t.item)==null?void 0:E.call(t,{item:w,index:C,active:C===u.value}),(_=t[`item${C}`])==null?void 0:_.call(t,{item:w,index:C,active:C===u.value})]}}))]);return()=>{var w;return o.createVNode("div",{class:m.value,style:g.value,onMouseenter:d,onMouseleave:f},[e.buttonPosition==="outer"&&y("left"),o.createVNode("div",{class:p.value,style:(w=e.styles)==null?void 0:w.container},[e.buttonPosition==="inner"&&y("left"),b(),e.buttonPosition==="inner"&&y("right")]),e.buttonPosition==="outer"&&y("right"),h()])}}});rr.install=e=>{e.component(rr.name,rr),e.component(ou.name,ou)};const ns={customStyle:{type:String,default:""},customClass:{type:String,default:""},direction:{Type:String,default:"row"}};function Ih(e){const t=o.ref(-1),n=o.ref(-1),u=o.ref(0),i=o.ref(0),r=o.ref(!1),a=o.ref(!1),s=o.computed(()=>({display:r.value?"block":"none",left:`${u.value}px`,cursor:"e-resize"})),l=o.computed(()=>({display:a.value?"block":"none",top:`${i.value}px`,cursor:"n-resize"})),d=o.computed(()=>{const x={display:a.value||r.value?"block":"none"};return i.value>0&&(x.cursor="n-resize"),x});function f(x,k,y,h){const b=e.value;if(b){const{left:w,right:C,width:E}=b.getBoundingClientRect();let _=x.clientX-w;h==="right"&&(_=C-x.clientX),_>k&&(_=k),_<y&&(_=y),h==="right"&&(_=E-_),u.value=_}}function c(x,k,y,h){const b=e.value;if(b){const{top:w,bottom:C,height:E}=b.getBoundingClientRect();let _=x.clientY-w;h==="bottom"&&(_=C-x.clientY),_>k&&(_=k),_<y&&(_=y),h==="bottom"&&(_=E-_),i.value=_}}function m(){const x=e.value;if(x){const{width:k,height:y}=x.getBoundingClientRect();return{width:k,height:y}}return null}function g(){const x=e.value;return x?Array.from(x.querySelectorAll("[data-position]")).reduce((k,y)=>{const h=y.getAttribute("data-position");return k=Object.assign(k,{[h]:y}),k},{}):null}function p(x,k){const y=m(),h=g();if(y&&h){const b=h==null?void 0:h.right,w=h==null?void 0:h.left;if(x==="left"&&w)return b?y.width-b.clientWidth-k:y.width-k;if(x==="right"&&b)return w?y.width-w.clientWidth-k:y.width-k}}function v(x,k){const y=m(),h=g();if(y&&h){const b=h==null?void 0:h.bottom,w=h==null?void 0:h.top;if(x==="top"&&w)return b?y.height-b.clientHeight-k:y.height-k;if(x==="bottom"&&b)return w?y.height-w.clientHeight-k:y.height-k}}return{horizontalResizeHandleStyle:s,verticalResizeHandleStyle:l,resizeOverlayStyle:d,showHorizontalResizeHandle:r,showVerticalResizeHandle:a,horizontalResizeBarPosition:t,verticalResizeBarPosition:n,verticalResizeHandleOffset:i,horizontalResizeHandleOffset:u,draggingHorizontalResizeHandle:f,draggingVerticalResizeHandle:c,getPanelMaxWidth:p,getPanelMaxHeight:v}}const vn=o.defineComponent({name:"FXSplitter",props:ns,emits:[],setup(e,t){const n=o.ref(),u=Ih(n),{horizontalResizeHandleStyle:i,verticalResizeHandleStyle:r,resizeOverlayStyle:a}=u;o.provide("splitter",{useResizeHandleComposition:u});const s=o.computed(()=>ye({"f-splitter":!0},e==null?void 0:e.customClass)),l=o.computed(()=>{const d={"flex-direction":e.direction==="row"?"row":"column"};return Ae(d,e==null?void 0:e.customStyle)});return()=>o.createVNode("div",{class:s.value,ref:n,style:l.value},[t.slots.default&&t.slots.default(),o.createVNode("div",{class:"f-splitter-resize-overlay",style:a.value},null),o.createVNode("div",{class:"f-splitter-horizontal-resize-proxy",style:i.value},null),o.createVNode("div",{class:"f-splitter-vertical-resize-proxy",style:r.value},null)])}}),Oh={customClass:{type:String,defaut:""},customStyle:{type:String,default:""},width:{type:Number},height:{type:Number},position:{type:String,default:"left"},visible:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},resizeHandle:{type:String,default:""},collapsable:{type:Boolean,default:!1},minWidth:{type:Number,default:100},minHeight:{type:Number,default:100},maxWidth:{type:Number,default:0},maxHeight:{type:Number,default:0}};function Ph(e,t){const n=o.ref(e.width),u=o.ref(e.height),{horizontalResizeBarPosition:i,horizontalResizeHandleOffset:r,showHorizontalResizeHandle:a,showVerticalResizeHandle:s,verticalResizeBarPosition:l,verticalResizeHandleOffset:d,draggingHorizontalResizeHandle:f,draggingVerticalResizeHandle:c,getPanelMaxWidth:m,getPanelMaxHeight:g}=t;let p="",v,x,k;const y=()=>e.maxWidth?e.maxWidth:m(p,e.minWidth)||0,h=()=>e.maxHeight?e.maxHeight:g(p,e.minHeight)||0;function b(E){if((p==="left"||p==="right")&&x){const{left:_}=x.getBoundingClientRect(),{width:z}=v.getBoundingClientRect(),M=E.clientX-_;let I=p==="left"?(z||0)+(M-i.value):(z||0)-(M-i.value);I=e.minWidth>0?Math.max(e.minWidth,I):I;const B=y();B!=null&&B>0&&(I=B>I?I:B),n.value=I}if((p==="top"||p==="bottom")&&x){const{top:_}=x.getBoundingClientRect(),{height:z}=v.getBoundingClientRect(),M=E.clientY-_;let I=p==="top"?(z||0)+(M-l.value):(z||0)-(M-l.value);I=e.minHeight>0?Math.max(e.minHeight,I):I;const B=h();B!=null&&B>0&&(I=B>I?I:B),u.value=I}r.value=0,d.value=0,i.value=-1,l.value=-1,a.value=!1,s.value=!1,document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",b),document.body.style.userSelect="",p="",v=null,x=null}function w(E,_,z){if(p=_,v=z,a.value=!0,x=E.composedPath().find(I=>I.className.split(" ")[0]==="f-splitter"),x){const{left:I}=x.getBoundingClientRect();r.value=E.clientX-I,i.value=E.clientX-I;const B=y();k=D=>f(D,B,e.minWidth,p),document.addEventListener("mousemove",k),document.addEventListener("mouseup",b),document.body.style.userSelect="none"}}function C(E,_,z){if(p=_,v=z,s.value=!0,x=E.composedPath().find(I=>I.className.split(" ")[0]==="f-splitter"),x){const{top:I}=x.getBoundingClientRect();d.value=E.clientY-I,l.value=E.clientY-I;const B=h();k=D=>c(D,B,e.minHeight,p),document.addEventListener("mousemove",k),document.addEventListener("mouseup",b),document.body.style.userSelect="none"}}return{actualWidth:n,actualHeight:u,onClickSplitterHorizontalResizeBar:w,onClickSplitterVerticalResizeBar:C}}const ur=o.defineComponent({name:"FSplitterPane",props:Oh,emits:[],setup(e,t){const n=o.ref(),u=o.inject("splitter"),{useResizeHandleComposition:i}=u,r=Ph(e,i),{actualHeight:a,actualWidth:s,onClickSplitterHorizontalResizeBar:l,onClickSplitterVerticalResizeBar:d}=r,f=o.ref(e.position),c=o.computed(()=>{const h={"f-splitter-pane":!0,"f-splitter-pane-main":f.value==="center","has-resize-bar":e.resizable};return h["f-splitter-pane-"+f.value]=!0,ye(h,e==null?void 0:e.customClass)}),m=o.computed(()=>e.resizeHandle?e.resizeHandle.split(",").filter(h=>["e","n","s","w"].find(b=>b===h)):[]),g=o.computed(()=>{const h={};return(s.value||s.value===0)&&(f.value==="left"||f.value==="right"||m.value.find(b=>b==="e")||m.value.find(b=>b==="w"))&&(h.width=`${s.value}px`),(a.value||a.value===0)&&(f.value==="bottom"||f.value==="top"||m.value.find(b=>b==="s")||m.value.find(b=>b==="n"))&&(h.height=`${a.value}px`),e.visible||(h.display="none"),Ae(h,e==null?void 0:e.customStyle)}),p=o.computed(()=>({"f-splitter-resize-bar":!0,"f-splitter-resize-bar-e":f.value==="left","f-splitter-resize-bar-n":f.value==="bottom","f-splitter-resize-bar-s":f.value==="top","f-splitter-resize-bar-w":f.value==="right"}));function v(h){return{e:"left",w:"right",s:"top",n:"bottom"}[h]||h}function x(h,b){b=v(b),["left","right"].find(w=>w===b)&&l(h,b,n.value),["top","bottom"].find(w=>w===b)&&d(h,b,n.value)}function k(){return m.value.length>0?m.value.map(h=>o.createVNode("span",{class:"f-splitter-resize-bar f-splitter-resize-bar-"+h,onMousedown:b=>x(b,h)},null)):o.createVNode("span",{class:p.value,onMousedown:h=>x(h,f.value)},null)}function y(){s.value=e.width,a.value=e.height,g.value}return t.expose({reset:y}),()=>o.createVNode("div",{ref:n,class:c.value,style:g.value,"data-position":f.value},[t.slots.default&&t.slots.default(),e.resizable&&k()])}});vn.install=e=>{e.component(vn.name,vn),e.component(ur.name,ur)};const rs={previewConfig:{type:Object,default:()=>({})},onClose:{type:Function,default:()=>{}},onIframeLoad:{type:Function,default:()=>{}}},us={content:{type:String,default:null}},Rh=e=>{const t=typeof e;return t!=="function"&&t!=="object"||e===null},Vh=e=>{const t=e.flags===""?void 0:e.flags;return new RegExp(e.source,t)},ir=(e,t=new WeakMap)=>{if(e===null||Rh(e))return e;if(t.has(e))return t.get(e);if(e instanceof RegExp)return Vh(e);if(e instanceof Date)return new Date(e.getTime());if(e instanceof Function)return e;if(e instanceof Map){const u=new Map;return t.set(e,u),e.forEach((i,r)=>{u.set(r,ir(i,t))}),u}if(e instanceof Set){const u=new Set;t.set(e,u);for(const i of e)u.add(ir(i,t));return u}if(Array.isArray(e)){const u=[];return t.set(e,u),e.forEach(i=>{u.push(ir(i,t))}),u}const n={};t.set(e,n);for(const u in e)Object.prototype.hasOwnProperty.call(e,u)&&(n[u]=ir(e[u],t));return n},Mh=(e,t=200)=>{let n=0;return(...u)=>new Promise(i=>{n&&(clearTimeout(n),i("cancel")),n=window.setTimeout(()=>{e.apply(void 0,u),n=0,i("done")},t)})},Fi=()=>`${Date.now().toString(36)}${Math.random().toString(36).substring(2)}`,au=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Bh=new Set(["__proto__","constructor","prototype"]),zh=e=>!Bh.has(e),Di=(e,t,n={})=>{if(Array.isArray(e)&&Array.isArray(t))return Ti(e,t,n);const{excludeKeys:u}=n,i=e,r=t;for(const a of Object.keys(r)){if(!zh(a))continue;const s=r[a],l=i[a];u&&u(a)?i[a]=s:Array.isArray(s)&&Array.isArray(l)?i[a]=Ti(l,s,n):au(s)&&au(l)?i[a]=Di(l,s,n):i[a]=s}return e},Ti=(e,t,n)=>{const u=e.slice();return t.forEach((i,r)=>{const a=u[r];Array.isArray(i)&&Array.isArray(a)?u[r]=Ti(a,i,n):au(i)&&au(a)?u[r]=Di(a,i,n):u[r]=i}),u},X="md-editor",de="https://unpkg.com",jh=`${de}/@highlightjs/cdn-assets@11.11.1/highlight.min.js`,is={main:`${de}/prettier@3.8.1/standalone.js`,markdown:`${de}/prettier@3.8.1/plugins/markdown.js`},Hh={css:`${de}/cropperjs@1.6.2/dist/cropper.min.css`,js:`${de}/cropperjs@1.6.2/dist/cropper.min.js`},$h=`${de}/screenfull@5.2.0/dist/screenfull.js`,Uh=`${de}/mermaid@11.12.3/dist/mermaid.min.js`,Wh={js:`${de}/katex@0.16.33/dist/katex.min.js`,css:`${de}/katex@0.16.33/dist/katex.min.css`},Ni={a11y:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/a11y-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/a11y-dark.min.css`},atom:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/atom-one-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/atom-one-dark.min.css`},github:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/github.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/github-dark.min.css`},gradient:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/gradient-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/gradient-dark.min.css`},kimbie:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/kimbie-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/kimbie-dark.min.css`},paraiso:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/paraiso-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/paraiso-dark.min.css`},qtcreator:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/qtcreator-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/qtcreator-dark.min.css`},stackoverflow:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/stackoverflow-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/stackoverflow-dark.min.css`}},Gh=`${de}/echarts@6.0.0/dist/echarts.min.js`,os={"zh-CN":{toolbarTips:{bold:"加粗",underline:"下划线",italic:"斜体",strikeThrough:"删除线",title:"标题",sub:"下标",sup:"上标",quote:"引用",unorderedList:"无序列表",orderedList:"有序列表",task:"任务列表",codeRow:"行内代码",code:"块级代码",link:"链接",image:"图片",table:"表格",mermaid:"mermaid图",katex:"katex公式",revoke:"后退",next:"前进",save:"保存",prettier:"美化",pageFullscreen:"浏览器全屏",fullscreen:"屏幕全屏",preview:"预览",previewOnly:"仅预览",htmlPreview:"html代码预览",catalog:"目录",github:"源码地址"},titleItem:{h1:"一级标题",h2:"二级标题",h3:"三级标题",h4:"四级标题",h5:"五级标题",h6:"六级标题"},imgTitleItem:{link:"添加链接",upload:"上传图片",clip2upload:"裁剪上传"},linkModalTips:{linkTitle:"添加链接",imageTitle:"添加图片",descLabel:"链接描述:",descLabelPlaceHolder:"请输入描述...",urlLabel:"链接地址:",urlLabelPlaceHolder:"请输入链接...",buttonOK:"确定"},clipModalTips:{title:"裁剪图片上传",buttonUpload:"上传"},copyCode:{text:"复制代码",successTips:"已复制!",failTips:"复制失败!"},mermaid:{flow:"流程图",sequence:"时序图",gantt:"甘特图",class:"类图",state:"状态图",pie:"饼图",relationship:"关系图",journey:"旅程图"},katex:{inline:"行内公式",block:"块级公式"},footer:{markdownTotal:"字数",scrollAuto:"同步滚动"}},"en-US":{toolbarTips:{bold:"bold",underline:"underline",italic:"italic",strikeThrough:"strikeThrough",title:"title",sub:"subscript",sup:"superscript",quote:"quote",unorderedList:"unordered list",orderedList:"ordered list",task:"task list",codeRow:"inline code",code:"block-level code",link:"link",image:"image",table:"table",mermaid:"mermaid",katex:"formula",revoke:"revoke",next:"undo revoke",save:"save",prettier:"prettier",pageFullscreen:"fullscreen in page",fullscreen:"fullscreen",preview:"preview",previewOnly:"preview only",htmlPreview:"html preview",catalog:"catalog",github:"source code"},titleItem:{h1:"Lv1 Heading",h2:"Lv2 Heading",h3:"Lv3 Heading",h4:"Lv4 Heading",h5:"Lv5 Heading",h6:"Lv6 Heading"},imgTitleItem:{link:"Add Image Link",upload:"Upload Images",clip2upload:"Crop And Upload"},linkModalTips:{linkTitle:"Add Link",imageTitle:"Add Image",descLabel:"Desc:",descLabelPlaceHolder:"Enter a description...",urlLabel:"Link:",urlLabelPlaceHolder:"Enter a link...",buttonOK:"OK"},clipModalTips:{title:"Crop Image",buttonUpload:"Upload"},copyCode:{text:"Copy",successTips:"Copied!",failTips:"Copy failed!"},mermaid:{flow:"flow",sequence:"sequence",gantt:"gantt",class:"class",state:"state",pie:"pie",relationship:"relationship",journey:"journey"},katex:{inline:"inline",block:"block"},footer:{markdownTotal:"Character Count",scrollAuto:"Scroll Auto"}}},lt={editorExtensions:{highlight:{js:jh,css:Ni},prettier:{standaloneJs:is.main,parserMarkdownJs:is.markdown},cropper:{...Hh},screenfull:{js:$h},mermaid:{js:Uh,enableZoom:!0},katex:{...Wh},echarts:{js:Gh}},editorExtensionsAttrs:{},editorConfig:{languageUserDefined:{},mermaidTemplate:{},renderDelay:500,zIndex:2e4},codeMirrorExtensions:e=>e,markdownItConfig:()=>{},markdownItPlugins:e=>e,mermaidConfig:e=>e,katexConfig:e=>e,echartsConfig:e=>e},Xh=({instance:e,ctx:t,props:n={}},u="default")=>{const i=(e==null?void 0:e.$slots[u])||(t==null?void 0:t.slots[u]);return(i?i(e):"")||n[u]},qh="buildFinished",Li="errorCatcher",Ii="catalogChanged",Zh="pushCatalog",as="rerender",Yh="taskStateChanged";class Kh{constructor(){fe(this,"pools",{})}remove(t,n,u){const i=this.pools[t]&&this.pools[t][n];i&&(this.pools[t][n]=i.filter(r=>r!==u))}clear(t){this.pools[t]={}}on(t,n){return this.pools[t]||(this.pools[t]={}),this.pools[t][n.name]||(this.pools[t][n.name]=[]),this.pools[t][n.name].push(n.callback),this.pools[t][n.name].includes(n.callback)}emit(t,n,...u){this.pools[t]||(this.pools[t]={});const i=this.pools[t][n];i&&i.forEach(r=>{try{r(...u)}catch(a){console.error(`${n} monitor event exception!`,a)}})}}const it=new Kh,Qh=(e,t)=>{if(!e)return e;const n=t.split(`
|
|
32
|
+
`;return vi("caf-assistant-widget-container__error",y)}),g=()=>{const y=a.value;y&&(s.value=new uh(y))},p=()=>{const y=s.value;y&&(y.dispose(),s.value=null)},v=()=>{const y=r.value,h=i.value;y&&(y.unmount(),y.dispose()),h&&h.cleanup(),r.value=null,i.value=null},x=async()=>{const y=await n(e.widgetAPIURL);if(!y)throw new Error("Failed to load widget API");await y.initialize();const h=y.createWidget();i.value=y,r.value=h},k=y=>{console.error(y),l.value=y};return o.watch(()=>e.widgetAPIURL,async()=>{if(a.value)try{v(),await x();const y=a.value,h=r.value;h==null||h.updateOptions(e.widgetOptions),h==null||h.updateData(e.widgetData),y&&h&&await h.mount(y)}catch(y){k(y)}}),o.watch(()=>e.widgetOptions,(y,h)=>{try{const b=r.value;b&&(!h||!u(h,y))&&b.updateOptions(y)}catch(b){k(b)}}),o.watch(()=>e.widgetData,(y,h)=>{try{const b=r.value;b&&(!h||!u(h,y))&&b.updateData(y)}catch(b){k(b)}}),o.onMounted(async()=>{try{const y=a.value;if(y){g();const h=s.value;if(h){await x();const b=r.value;b&&(b.updateOptions(e.widgetOptions),b.updateData(e.widgetData),b.mount(h.getElement()),o.nextTick(()=>{y.parentElement&&(y.style.width="100%")}))}}}catch(y){k(y)}}),o.onBeforeUnmount(async()=>{try{v(),p()}catch(y){console.error(y)}}),()=>o.createVNode("div",{class:d.value},[o.createVNode("div",{ref:a,class:c},null),o.createVNode("div",{class:m.value},null)])}}),Va=(e,t)=>{var n;if(e.type===Oe.AssistantWidgetComplete){const u=e;return u.widgetUrl?o.createVNode(yn,{key:`widget-${t}`,widgetAPIURL:u.widgetUrl,widgetOptions:{mode:"embedded",implOptions:u.widgetImplOptions},widgetData:((n=u.widgetData)==null?void 0:n.data)||{}},null):null}return e.type===Oe.AssistantWidgetPending?o.createVNode("div",{class:"f-chat-bubble-widget-pending",key:`widget-loading-${t}`},[o.createVNode("span",{class:"f-chat-todo-status-icon f-chat-todo-status-working"},null),o.createVNode("span",{class:"f-chat-bubble-widget-pending-text"},[o.createTextVNode("数据生成中......")])]):null},sh=3e4,Ma=8e3,Le=new Map,Qe=new Map,Jn=new Map,_t=[];function Re(e){return String(e??"").replace(/^\ufeff/,"").replace(/[\u200b\u200c\u200d]/g,"").replace(/\u00a0/g," ").trim()}function eu(e){const t=Re(e);if(t)for(let n=_t.length-1;n>=0;n--)_t[n]===t&&_t.splice(n,1)}function lh(e){typeof window>"u"||(window.__fluens_dynamic_component_bootstrap_instance_id=e)}function tu(e){if(typeof window>"u")return;const t=window;t.__fluens_dynamic_component_bootstrap_instance_id===e&&delete t.__fluens_dynamic_component_bootstrap_instance_id}function ch(){return _t[_t.length-1]||void 0}function nu(e,t){const n=Re(t);return n?Re(e.instanceId)===n||e.componentId!=null&&Re(String(e.componentId))===n||e.name!=null&&Re(String(e.name))===n:!1}function ki(e){const t=Re(e);if(!t)return null;const n=Le.get(t);if(n)return{canonicalKey:t,entry:n};for(const[i,r]of Le.entries())if(Re(i)===t)return{canonicalKey:i,entry:r};const u=[];for(const[i,r]of Le.entries())nu(r.config,t)&&u.push({key:i,entry:r});if(u.length===1){const{key:i,entry:r}=u[0];return i!==t&&console.warn(`[DynamicComponent] register id "${t}" resolved to pending instanceId "${i}" (alias match)`),{canonicalKey:i,entry:r}}if(u.length>1)return console.warn(`[DynamicComponent] register id "${t}" is ambiguous (${u.length} pending matches); refusing`),null;if(Le.size===1){const[i,r]=[...Le.entries()][0];return console.warn(`[DynamicComponent] register id "${t}" unmatched; using sole pending instance "${i}"`),{canonicalKey:i,entry:r}}return null}function Ba(e,t){for(const[n,u]of Qe){const i=Re(n),r=e!==""&&i===e,a=String(t??"").trim(),s=e&&nu(u.config,e)||a&&nu(u.config,a);if(r||s)return console.warn(`[DynamicComponent] register skipped: id "${e||a}" already active (canonical "${n}"); unload first — second register yields "no pending", not duplicate mount`),!0}return!1}function Ci(){return{pendingKeys:[...Le.keys()],bootstrapQueue:[..._t],activeKeys:[...Qe.keys()],...typeof window<"u"?{windowBootstrapPeek:window.__fluens_dynamic_component_bootstrap_instance_id}:{}}}function dh(e){console.warn("[DynamicComponent] register diagnostics",{claimedNormalized:e,...Ci()})}function fh(e){const t=Re(e);if(t){if(Ba(t,e))return{ok:!1,reason:"already_active_duplicate"};const u=ki(t);if(u)return{ok:!0,...u}}else if(Ba("",e))return{ok:!1,reason:"already_active_duplicate"};for(let n=0;n<_t.length;n++){const u=_t[n],i=ki(u);if(i)return _t.splice(n,1),t&&Re(u)!==t&&console.warn(`[DynamicComponent] register id "${t}" did not match pending; using bootstrap instanceId "${u}" (sync bundle entry or use window.__fluens_dynamic_component_bootstrap_instance_id)`),{ok:!0,...i}}return{ok:!1,reason:"no_pending"}}function za(e){const t=Re(e);if(!t)return null;const n=Qe.get(t);if(n)return n;for(const[r,a]of Qe.entries())if(Re(r)===t)return a;const u=[];for(const r of Qe.values())nu(r.config,t)&&u.push(r);const i=[...new Map(u.map(r=>[r.config.instanceId,r])).values()];if(i.length===1)return i[0].config.instanceId!==t&&console.warn(`[DynamicComponent] assistant post id "${t}" resolved to instanceId "${i[0].config.instanceId}" (alias match)`),i[0];if(i.length>1)return console.warn(`[DynamicComponent] assistant post id "${t}" is ambiguous (${i.length} active matches)`),null;if(Qe.size===1){const r=[...Qe.values()][0];return console.warn(`[DynamicComponent] assistant post id "${t}" unmatched; delivering to sole active instance "${r.config.instanceId}"`),r}return null}function hh(e){const t=Re(e);if(!t)return t;const n=za(t);if(n)return n.config.instanceId;const u=ki(t);return u?u.canonicalKey:Le.size===1?[...Le.keys()][0]:Qe.size===1?[...Qe.values()][0].config.instanceId:t}function Ei(e){try{return JSON.parse(JSON.stringify(e))}catch{return{...e}}}function ja(e,t){if(typeof e.onAssistantMessage!="function")return!0;try{return e.onAssistantMessage(Ei(t)),!0}catch(n){return console.warn("[DynamicComponent] onAssistantMessage failed",n),!1}}function mh(e){const t=`fluens-dynamic-component-${e.instanceId}`;let n=document.getElementById(t);return n||(n=document.createElement("div"),n.id=t,n.style.width="100%",n.style.height="100%"),n}function Ha(e){const t=Qe.get(e.instanceId);if(t)return Promise.resolve(t.api);const n=Le.get(e.instanceId);if(n)return new Promise((i,r)=>{const a=n.resolve,s=n.reject;n.resolve=l=>{a(l),i(l)},n.reject=l=>{s(l),r(l)}});if((e.name||e.componentId)&&!e.jsUrl)return Promise.reject(new Error(`Dynamic component resource is empty: ${e.name||e.componentId}`));const u=mh(e);return new Promise((i,r)=>{const a={config:e,container:u,resolve:i,reject:r,timeoutId:0},s=setTimeout(()=>{a.postLoadRegisterCheckTimerId!=null&&(clearTimeout(a.postLoadRegisterCheckTimerId),a.postLoadRegisterCheckTimerId=void 0),Le.delete(e.instanceId),eu(e.instanceId),tu(e.instanceId),r(new Error(`Dynamic component script load timeout: ${e.name||e.componentId}`))},sh);a.timeoutId=s,Le.set(e.instanceId,a),_t.push(e.instanceId),lh(e.instanceId);const l=document.createElement("script");l.src=(e==null?void 0:e.jsUrl)??"",l.dataset.dynamicComponentId=e.instanceId,l.async=!1,l.onload=()=>{a.postLoadRegisterCheckTimerId=window.setTimeout(()=>{a.postLoadRegisterCheckTimerId=void 0,Le.has(e.instanceId)&&(clearTimeout(s),Le.delete(e.instanceId),eu(e.instanceId),tu(e.instanceId),r(new Error(`Dynamic component did not call __fluens_dynamic_component_register within ${Ma}ms after load: ${e.name||e.componentId}`)))},Ma)},l.onerror=()=>{clearTimeout(s),a.postLoadRegisterCheckTimerId!=null&&(clearTimeout(a.postLoadRegisterCheckTimerId),a.postLoadRegisterCheckTimerId=void 0),Le.delete(e.instanceId),eu(e.instanceId),tu(e.instanceId),r(new Error(`Failed to load dynamic component: ${e.name||e.componentId}`))},document.head.appendChild(l)})}function $a(e){var i;const t=Qe.get(e);if(t){try{t.api.unmount()}catch{}(i=t.scriptElement)==null||i.remove(),Qe.delete(e)}const n=Le.get(e);n&&(n.postLoadRegisterCheckTimerId!=null&&(clearTimeout(n.postLoadRegisterCheckTimerId),n.postLoadRegisterCheckTimerId=void 0),clearTimeout(n.timeoutId),Le.delete(e)),Jn.delete(e);const u=document.getElementById(`fluens-dynamic-component-${e}`);u&&u.remove()}function ph(e,t){const n=Re(e);if(!n)return!1;const u=za(n);if(u)return ja(u.api,t);const i=hh(n),r=Jn.get(i)??[],a=r.findIndex(s=>s.messageId===t.messageId);return a>=0?r[a]=Ei(t):r.push(Ei(t)),Jn.set(i,r),!1}typeof window<"u"&&(window.__fluens_get_dynamic_component_registry_debug_snapshot=Ci,window.__fluens_dynamic_component_register=function(e,t){const n=Re(e),u=fh(e);if(!u.ok){if(u.reason==="already_active_duplicate")return;dh(n),console.warn(`[DynamicComponent] no pending for register id "${n}" (raw ${JSON.stringify(e)}); see diagnostics above. Try: unload tab / avoid double register / ensure FXDynamicComponent loaded this jsUrl first / empty id if sole pending`);return}const{canonicalKey:i,entry:r}=u;eu(i),tu(i),r.postLoadRegisterCheckTimerId!=null&&(clearTimeout(r.postLoadRegisterCheckTimerId),r.postLoadRegisterCheckTimerId=void 0),clearTimeout(r.timeoutId),Le.delete(i);const a={config:r.config,container:r.container,api:t,scriptElement:document.currentScript};Qe.set(i,a),a.container.parentElement;try{t.mount(r.container,r.config)}catch(l){console.error(`Failed to mount dynamic component: ${i}`,l)}const s=[i];n&&n!==i&&s.push(n);for(const l of s){const d=Jn.get(l);d&&d.length>0&&(Jn.delete(l),d.forEach(f=>ja(t,f)))}r.resolve(t)});const xn=o.defineComponent({name:"FXDynamicComponent",props:{config:{type:Object,required:!0}},setup(e){const t=o.ref("loading"),n=o.ref(""),u=o.computed(()=>`fluens-dynamic-component-${e.config.instanceId}`),i=o.computed(()=>e.config.position==="inline"),r=o.computed(()=>!e.config.jsUrl&&!!e.config.url),a=o.computed(()=>({...i.value?{width:"fit-content",maxWidth:"100%"}:{width:"100%"},height:"auto",...t.value==="ready"&&i.value?{padding:"16px 0"}:{},...t.value==="ready"&&!i.value?{height:"100%",overflow:"hidden"}:{}}));return o.onMounted(()=>{r.value||(t.value="loading",n.value="",Ha(e.config).then(()=>{t.value="ready"}).catch(s=>{t.value="error",n.value=s.message||"Unknown error"}))}),o.onUnmounted(()=>{r.value||$a(e.config.instanceId)}),()=>r.value?null:o.createVNode("div",{class:"f-chat-dynamic-component-body",style:a.value},[o.createVNode("div",{id:u.value,style:{width:"100%",height:"100%",display:t.value==="ready"?"":"none"}},null),t.value==="loading"&&o.createVNode("div",{class:"f-chat-dynamic-component-loading"},[o.createVNode("span",{class:"f-chat-dynamic-component-loading-spinner"},null),o.createVNode("span",null,[o.createTextVNode("加载中......")])]),t.value==="error"&&o.createVNode("div",{class:"f-chat-dynamic-component-error"},[o.createVNode("span",{class:"f-chat-dynamic-component-error-icon"},[o.createTextVNode("!")]),o.createVNode("span",null,[n.value])])])}}),Ua=(e,t,n)=>{if(e.type===Oe.DynamicComponentComplete){const u=e;if(!u.config)return null;if(u.config.position==="inline")return o.createVNode(xn,{key:`dc-${t}`,config:u.config},null);const i={type:"file",fileContent:{type:"md",name:u.config.title}},r={onPreviewFile:a=>{n.emit("showDynamicComponent",u.config)}};return o.nextTick(()=>n.emit("dynamicComponentsDetected",[u.config])),o.createVNode("div",{style:{padding:"16px 0"}},[n.renderFileEmbeddedContent(i,r)])}return e.type===Oe.DynamicComponentPending?o.createVNode("div",{class:"f-chat-bubble-widget-pending",key:`dc-loading-${t}`},[o.createVNode("span",{class:"f-chat-todo-status-icon f-chat-todo-status-working"},null),o.createVNode("span",{class:"f-chat-bubble-widget-pending-text"},[o.createTextVNode("组件加载中......")])]):null};function gh(){return{[Oe.Text]:mf,[Oe.AssistantWidgetComplete]:Va,[Oe.AssistantWidgetPending]:Va,[Oe.DynamicComponentComplete]:Ua,[Oe.DynamicComponentPending]:Ua}}const bh=o.defineComponent({name:"FXBubbleTextContent",props:ec,emits:["dynamicComponentsDetected","showDynamicComponent"],setup(e,t){const{renderFileEmbeddedContent:n}=mo(),{propertyStates:u,registerProperty:i,updatePropertyValue:r,startStreaming:a}=Nr();i("title",e.title??""),i("subtitle",e.subtitle??""),i("text",e.text??""),o.watch([()=>e.title,()=>e.subtitle,()=>e.text],([p,v,x])=>{r("title",p??""),r("subtitle",v??""),r("text",x??"")});const s=o.computed(()=>e.textFormat==="markdown"),l=o.ref(!1),d=o.computed(()=>{var p,v,x;return l.value?{title:((p=u.title)==null?void 0:p.displayedValue)??"",subtitle:((v=u.subtitle)==null?void 0:v.displayedValue)??"",text:((x=u.text)==null?void 0:x.displayedValue)??""}:{title:e.title,subtitle:e.subtitle,text:e.text}}),f=o.computed(()=>fc(d.value.text)),c={shouldShowMarkdown:s,emit:t.emit,renderFileEmbeddedContent:n},m=gh(),g=()=>f.value.length===0?null:o.createVNode("div",{class:"f-chat-bubble-text-collection"},[f.value.map((p,v)=>{var x;return(x=m[p.type])==null?void 0:x.call(m,p,v,c)})]);return o.onMounted(()=>{l.value&&a()}),()=>o.createVNode(o.Fragment,null,[d.value.title&&o.createVNode("div",{class:"f-chat-bubble-content-title"},[d.value.title]),d.value.subtitle&&o.createVNode("div",{class:"f-chat-bubble-content-subtitle"},[d.value.subtitle]),g()])}}),yh={content:{type:Object},outputMode:{type:String,default:"full"}};function ru({status:e}){const t=`f-chat-todo-status-icon f-chat-todo-status-${e.toLowerCase()}`;return o.createVNode("span",{class:t,"aria-hidden":!0},null)}const Wa=100,xh=o.defineComponent({name:"FXBubbleThink",props:yh,setup(e,t){var z;const{propertyStates:n,registerProperty:u,updatePropertyValue:i,isAllDone:r}=Nr(),{elapsedSeconds:a,hasEverStarted:s,start:l,stop:d,reset:f}=zu(),c=o.ref(((z=e.content)==null?void 0:z.completed)!==!0),m=o.ref(null),g=o.ref(null),p=o.ref(!1),v=o.ref(!1),x=o.computed(()=>e.outputMode==="streaming"),k=o.computed(()=>{var M;return(M=e.content)==null?void 0:M.completed}),y=o.computed(()=>{var $,F,R;const M=($=h.value)==null?void 0:$.trim(),I=M?M.slice(0,8):"",B=M&&M.length>8?"…":"",D=I?`<span class="f-chat-bubble-thinking-preview">${I}${B}</span>`:"";if(k.value){const O=s.value?`(用时${a.value}秒)`:"";return(((F=e.content)==null?void 0:F.title)??"思考完成"+O)+D}return(((R=e.content)==null?void 0:R.title)??"正在思考......")+D}),h=o.computed(()=>{var M,I;return x.value?((M=n.content)==null?void 0:M.displayedValue)??"":((I=e.content)==null?void 0:I.content)??""}),b=o.computed(()=>({"f-chat-bubble-thinking":!0,"is-pending":!k.value,"is-completed":k.value})),w=()=>{const M=m.value;if(!M||!p.value){v.value=!1;return}v.value=M.scrollTop>0};o.watch(()=>k.value,M=>{M?d():l()},{immediate:!0}),o.watch(()=>k.value,M=>{M&&(c.value=!1)}),o.watch(()=>e.content,M=>{M&&(n.content?i("content",M.content??""):u("content",M.content??""))},{immediate:!0}),o.watch(h,async()=>{if(c.value){await o.nextTick();const M=g.value;if(!M)return;await o.nextTick(),p.value=M.scrollHeight>Wa;const I=m.value;I&&p.value&&(I.scrollTop=I.scrollHeight,v.value=!0)}},{immediate:!0}),o.watch(c,async M=>{if(M){await o.nextTick();const I=g.value;if(!I)return;await o.nextTick(),p.value=I.scrollHeight>Wa;const B=m.value;B&&p.value&&(B.scrollTop=B.scrollHeight,v.value=!0)}}),o.onUnmounted(()=>{f()}),t.expose({instance:{get loadDone(){return e.content?(x.value?r.value:!0)&&k.value:!0}}});const C=()=>{c.value=!c.value},E=()=>k.value?null:o.createVNode(ru,{status:"Working"},null),_=()=>!h.value||!c.value?null:o.createVNode("div",{class:"f-chat-bubble-thinking-content"},[o.createVNode("div",{class:"f-chat-bubble-thinking-scroll-container",ref:m,onScroll:w},[p.value&&v.value&&o.createVNode("div",{class:"f-chat-bubble-thinking-fade-mask"},null),o.createVNode("div",{class:"f-chat-bubble-thinking-text-wrapper"},[o.createVNode("div",{ref:g,class:"f-chat-bubble-thinking-content-text",innerHTML:h.value},null)])])]);return()=>o.createVNode("div",{class:b.value},[o.createVNode("div",{class:"f-chat-bubble-thinking-header",onClick:C},[E(),o.createVNode("span",{class:"f-chat-bubble-thinking-title",innerHTML:y.value},null),h.value&&o.createVNode("i",{class:"fx-icon fx-icon-arrow-right",style:{transform:c.value?"rotate(90deg)":"rotate(0deg)",transition:"all 0.3s ease-in-out"}},null)]),_()])}}),wh={content:{type:Object}},Ga={id:{type:String},arrowOffsetX:{type:Number,default:0},class:{type:String,default:""},customStyles:{type:Object,default:null},isSimpleTips:{type:Boolean,default:!1},fitContent:{type:Boolean,default:!1},host:{type:Object},leftBoundary:{type:Object},keepWidthWithReference:{type:Boolean,default:!1},minWidth:{type:Number,default:-1},offsetX:{type:Object,default:o.ref(0)},offsetY:{type:Object,default:o.ref(0)},placement:{type:String,default:"bottom"},reference:{type:Object},rightBoundary:{type:Object},showArrow:{type:Boolean,default:!1},title:{type:String},visible:{type:Boolean,default:!1},zIndex:{type:Number,default:-1},limitContentBySpace:{type:Boolean,default:!1},beforeClose:{type:Function}};function vh(e){const t=e.host?e.host:"body",n=o.computed(()=>t==="body"?0:t?t.getBoundingClientRect().top:0),u=o.computed(()=>t==="body"?window.innerHeight:t?t.getBoundingClientRect().bottom:window.innerHeight),i=o.computed(()=>t==="body"?0:t?t.getBoundingClientRect().left:0),r=o.computed(()=>t==="body"?document.body.getBoundingClientRect().width:t?t.getBoundingClientRect().width-(e.rightBoundary?e.rightBoundary.getBoundingClientRect().width:0):document.body.getBoundingClientRect().width),a=o.computed(()=>t==="body"?window.innerHeight:t?t.getBoundingClientRect().height:window.innerHeight);return{host:t,hostLeft:i,hostTop:n,hostWidth:r,hostHeight:a,hostBottom:u}}function Ah(e,t,n,u){const i=o.ref(e.offsetX||0),r=o.ref(e.offsetY||0),a=o.ref(-1),s=o.ref(-1),l=o.ref(-1),d=o.ref(-1),f=o.ref(e.placement),c=o.ref(0),m=o.ref(0),g=o.ref(0),p=o.computed(()=>document.documentElement.scrollLeft),v=o.computed(()=>document.documentElement.scrollTop),{hostLeft:x,hostTop:k,hostWidth:y,hostHeight:h,hostBottom:b}=u;o.watch(()=>e.offsetX,T=>{i.value=T});const w=o.computed(()=>{const T={left:`${m.value}px`,top:`${g.value}px`,transform:`translate(${i.value}px, ${r.value}px)`};return e.zIndex!==-1&&(T["z-index"]=e.zIndex),e.fitContent?e.keepWidthWithReference&&n.value&&a.value>=n.value.getBoundingClientRect().width&&(T.width=`${a.value}px`):a.value!==-1&&(T.width=`${a.value}px`),e.minWidth!==-1&&(T.minWidth=`${e.minWidth}px`),e.customStyles&&Object.assign(T,e.customStyles),s.value>0&&(T.maxHeight=s.value+"px"),T}),C=o.computed(()=>({left:`${c.value}px`,transform:`translateX(${e.arrowOffsetX}px)`}));function E(T){if(T&&e.keepWidthWithReference){const L=T.getBoundingClientRect();a.value=Math.max(e.minWidth,L.width)}}function _(T,L){const W=y.value-T.width-4;return W>0?W:L}function z(T,L){const W=h.value-T.height-12;return W>0?W:L}function M(T,L,W){const K=c.value,Z=L.left-x.value+L.width/2+p.value,Y=L.top-k.value-(T.height+W.height)+v.value;return{popoverLeft:Z,popoverTop:Y,arrowLeft:K}}function I(T,L,W){const K=L.top-k.value+(L.height+W.height)+v.value,Z=z(T,K);return Math.min(K,Z)}function B(T,L){const W=_(L,T),K=T<=W?c.value:T-W;return{popoverLeft:Math.min(T,W),arrowLeft:K,maxHeight:0}}function D(T,L){const W=_(L,T),K=T<=W?c.value:T-W;return{popoverLeft:T,arrowLeft:K,maxHeight:0}}function H(T,L,W){const K=L.left-x.value+p.value,{arrowLeft:Z,popoverLeft:Y}=D(K,T),{popoverTop:ue}=M(T,L,W);return{popoverLeft:Y,popoverTop:ue,arrowLeft:Z,maxHeight:0}}function $(T,L,W){const K=L.left-x.value+L.width/2-(W.width/2-(T.left-x.value))+p.value,{arrowLeft:Z,popoverLeft:Y}=B(K,T),ue=I(T,L,W);return{popoverLeft:Y,popoverTop:ue,arrowLeft:Z,maxHeight:0}}function F(T,L,W){const K=L.left-x.value+p.value,{arrowLeft:Z,popoverLeft:Y}=B(K,T),ue=I(T,L,W);return{popoverLeft:Y,popoverTop:ue,arrowLeft:Z,maxHeight:0}}function R(T,L,W){const K=L.left-x.value;let Z=0,Y=0,ue=0,le=0,De="bottom-left";window.innerWidth-K>T.width?Z=K+p.value:(Z=L.right-T.width+p.value,ue=T.width-W.width-20);let Te=0;if(e.limitContentBySpace){const Xt={topHeight:L.top-k.value-W.height-8,bottomHeight:b.value-L.bottom-W.height-8};Te=Math.max(Xt.topHeight,Xt.bottomHeight),T.height>Te&&(le=Te,n.value.classList.add("popover-limitmax"))}const yt=le?Math.floor(le):T.height,Me=L.top-k.value+(L.height+W.height);return b.value-Me>yt?Y=Me+v.value:(Y=L.top-yt-W.height+v.value,b.value-Me>L.top?(Y=Me+v.value,yt>L.top&&(Y=b.value-yt)):(Y=Y<0?0:Y,De="top")),n.value.classList.add("popover-"+De,"bs-popover-"+De),{popoverLeft:Z<0?5:Z,popoverTop:Y,arrowLeft:ue,maxHeight:le}}function O(T,L,W){const K=L.left+L.width,Z=Math.max(L.top-(T.height/2-L.height/2),k.value);let Y=k.value+h.value-T.height;Y<0&&(Y=Z);const ue=Math.min(Z,Y);return{popoverLeft:K,popoverTop:ue,arrowLeft:0,maxHeight:0}}function U(T,L,W){const K=L.left+L.width,Z=Math.max(L.top-L.height,k.value);let Y=k.value+h.value-T.height;Y<0&&(Y=Z);const ue=Math.min(Z,Y);return{popoverLeft:K,popoverTop:ue,arrowLeft:0,maxHeight:0}}const re=new Map([["top",M],["top-left",H],["bottom",$],["bottom-left",F],["right",O],["right-top",U],["auto",R]]);function te(T){var Y;e.keepWidthWithReference&&E(T);const L=T.getBoundingClientRect();l.value=L.top,d.value=L.left;const W=t.value?t.value.getBoundingClientRect():{height:4,width:4},K=(Y=n.value)==null?void 0:Y.getBoundingClientRect();a.value=K.width;const Z=re.get(f.value);if(Z){const{arrowLeft:ue,popoverLeft:le,popoverTop:De,maxHeight:Te}=Z(K,L,W);c.value=ue,m.value=le,g.value=De,s.value=Te||-1}}function P(T){if(T){const L=T.getBoundingClientRect();(L.left!==d.value||L.top!==l.value)&&te(T)}}function V(){f.value=e.placement,c.value=0,m.value=0,g.value=0,a.value=-1}return{arrowStyle:C,popoverStyle:w,position:f,popoverWidth:a,fitToReference:E,followToReferencePosition:P,locateToReference:te,resetPosition:V}}function kh(e,t,n,u,i,r,a){const s=o.ref(e.visible),l=o.computed(()=>s.value),{fitToReference:d,locateToReference:f,resetPosition:c}=a;let m;async function g(){s.value&&(e.beforeClose&&typeof e.beforeClose=="function"&&!await e.beforeClose()||(s.value=!1,document.body.removeEventListener("click",m),document.body.removeEventListener("mousedown",m),document.body.removeEventListener("wheel",m,!0),document.removeEventListener("scroll",m),c(),t.emit("hidden")))}m=v=>{var y;if(!i.value)return;const x=i.value.contains(v.target);if(v.type==="scroll"||v.type==="wheel"&&x){g();return}if(v.target.closest(".time-picker-panel"))return;const k=(y=v.target)==null?void 0:y.closest(".popover");if(k&&u.value&&k===u.value){v.type!=="scroll"&&v.type!=="wheel"&&v.stopPropagation();return}if(!x&&s.value){const h=i.value.closest(".popover");h&&h.removeEventListener("click",m),g()}};async function p(v){if(u.value&&(e.showArrow===!1||e.showArrow&&n.value)&&v){c(),s.value=!0,i.value=v,r.value&&d(v),await o.nextTick(),f(v),document.body.addEventListener("click",m),document.body.addEventListener("mousedown",m),document.body.addEventListener("wheel",m,!0),document.addEventListener("scroll",m),(top==null?void 0:top.document)!==document&&(top==null||top.document.addEventListener("mousedown",m));const x=v.closest(".popover");x&&x.addEventListener("click",m),t.emit("shown")}}return t.expose({hide:g,popoverRef:u,show:p,shown:l,isShow:s}),{showPopover:s,hidePopverOnClickBodyHandler:m}}function Ch(e,t,n,u,i,r){const{popoverWidth:a,fitToReference:s,followToReferencePosition:l}=i;function d(){var f;if(r.value&&((f=r.value.style)==null?void 0:f.display)!=="none"&&n.value){l(n.value);const c=n.value.getBoundingClientRect();u.value&&c.width!==a.value&&s(n.value)}}return{onResize:d}}function Eh(e,t=500){const n=o.ref(e.value);let u;const i=o.watch(e,a=>{clearTimeout(u),u=setTimeout(()=>{n.value=a},t)}),r=()=>{clearTimeout(u),i()};return o.onUnmounted(r),{delayedValue:n,cleanup:r}}const Kt=o.defineComponent({name:"FXPopover",props:Ga,emits:["shown","hidden"],setup(e,t){const n=o.ref(),u=o.ref(),i=o.ref(e.reference),r=o.ref(e.keepWidthWithReference),a=o.computed(()=>!!e.title),s=vh(e),{host:l}=s,d=Ah(e,n,u,s),{position:f,arrowStyle:c,popoverStyle:m,fitToReference:g,locateToReference:p}=d,{showPopover:v,hidePopverOnClickBodyHandler:x}=kh(e,t,n,u,i,r,d),{onResize:k}=Ch(e,t,i,r,d,u),y=o.computed(()=>{let E=f.value;E==="top-left"&&(E="top");const _=`popover in popover-${E}`,z=`bs-popover-${E}`,M={"popover-fitcontent":e.fitContent,fade:!0};M[_]=!0,M[z]=!0;const I=(e.class||"").split(" ");return e.isSimpleTips&&I.unshift("popover-tips"),I.reduce((B,D)=>(B[D]=!0,B),M),M}),h=o.computed(()=>({"popover-content":!0,"popover-body":!0})),b=o.computed(()=>{const E={};return E.opacity=v.value?1:0,E.visibility=v.value?"visible":"hidden",E.zIndex=1060,E}),w=o.computed(()=>e.isSimpleTips?!0:e.showArrow),{delayedValue:C}=Eh(b,50);return o.onMounted(()=>{var E;r.value&&g(i.value),e.reference&&p(i.value),window.addEventListener("resize",k),(E=u.value)==null||E.focus()}),o.onUnmounted(()=>{document.body.removeEventListener("click",x),window.removeEventListener("resize",k),v.value=!1}),()=>o.createVNode(o.Teleport,{to:l},{default:()=>{var E;return[o.withDirectives(o.createVNode("div",{tabindex:"-1",ref:u,class:y.value,style:{...m.value,...C.value},onMousedown:_=>{_.stopPropagation()},onClick:_=>{_.stopPropagation()}},[w.value&&o.createVNode("div",{ref:n,class:"popover-arrow arrow",style:c.value},null),a.value&&o.createVNode("h3",{class:"popover-title popover-header"},[e.title]),o.createVNode("div",{class:h.value},[t.slots.default&&((E=t.slots)==null?void 0:E.default())])]),[[o.vShow,v.value]])]}})}}),uu="FarrisX_PopoverInstancesKey";window[uu]=window[uu]||new WeakMap;function _i(e,t,n){e.stopPropagation();const u=t.value;u&&u.value&&!u.value.isShow&&(u.value.show(n),window[uu].set(n,u.value))}function Xa(e,t,n){e.stopPropagation(),t.value.value.hide(),window[uu].delete(n)}function _h(e,t,n){e.stopPropagation();const u=t.value;u&&u.value&&(u.value.isShow?Xa(e,t,n):_i(e,t,n))}function qa(e,t,n){t.arg&&t.arg==="toggle"?_h(e,t,n):_i(e,t,n)}const Za={mounted:(e,t,n)=>{t.modifiers.hover?(e.addEventListener("mouseenter",u=>_i(u,t,e)),e.addEventListener("mouseleave",u=>Xa(u,t,e))):t.modifiers.click?e.addEventListener("click",u=>qa(u,t,e)):e.addEventListener("click",u=>qa(u,t,e)),e.classList.add("v-popover")},unMounted:(e,t,n)=>{}};Kt.install=e=>{e.component(Kt.name,Kt),e.directive("fxpopover",Za)};const Ya={type:{type:String,default:"StartedToDo"},status:{type:String,default:"NotStart"},message:{type:String,default:""},taskDetail:{type:String,default:""},todoList:{type:Array,default:[]},detailViewMode:{type:String,default:"hover"},initExpanded:{type:Boolean,default:!1},showLoading:{type:Boolean,default:!0},showLabel:{type:Boolean,default:!0},loading:Object,shimmer:{type:Boolean,default:!0},outputMode:{type:String,default:"streaming"}},Ka={items:{type:Array,default:()=>[]}},Qa={id:{type:Number||String,default:0},status:{type:String},task:{type:String,default:""},todoList:{type:Array,default:[]},detailViewMode:{type:String,default:"expand"},initExpanded:{type:Boolean,default:!0},showLoading:{type:Boolean,default:!0},showLabel:{type:Boolean,default:!1},shimmer:{type:Boolean,default:!0},title:{type:String,default:""},message:{type:String,default:""},outputMode:{type:String,default:"full"}},iu=o.defineComponent({name:"FXTodoListItemView",props:Qa,emits:["click"],setup(e,{emit:t}){const{propertyStates:n,registerProperty:u,updatePropertyValue:i,startStreaming:r}=Nr();u("title",e.title??""),u("task",e.task??""),o.watch([()=>e.title,()=>e.task],([m,g])=>{i("title",m??""),i("task",g??"")});const a=o.computed(()=>["f-chat-todo-item",{"is-done":e.status==="Done","is-working":e.status==="Working","is-not-start":e.status==="NotStart","no-shimmer":!e.shimmer}]),s=o.computed(()=>["f-chat-todo-task",{"is-done":e.status==="Done"}]);function l(){t("click",e,e.id)}const d=o.computed(()=>e.outputMode==="streaming"),f=o.computed(()=>{var m;return d.value?((m=n.title)==null?void 0:m.displayedValue)??"":e.title??""}),c=o.computed(()=>{var m;return d.value?((m=n.task)==null?void 0:m.displayedValue)??"":e.task??""});return o.computed(()=>{var m;return d.value?((m=n.detail)==null?void 0:m.displayedValue)??"":e.message??""}),o.onMounted(()=>{d.value&&r()}),()=>o.createVNode("li",{key:e.id,class:a.value,onClick:l},[e.todoList&&e.todoList.length>0&&o.createVNode(Qt,{todoList:e.todoList,status:e.status,message:e.task,taskDetail:e.message,detailViewMode:e.detailViewMode,initExpanded:e.initExpanded,showLoading:e.showLoading,showLabel:e.showLabel,outputMode:e.outputMode},null),!e.todoList||e.todoList.length===0&&o.createVNode(o.Fragment,null,[e.showLoading&&o.createVNode(ru,{status:e.status??"Done"},null),f.value?o.createVNode("div",{class:"f-chat-todo-task-wrapper"},[o.createVNode("span",{class:s.value},[f.value]),o.createVNode("div",{class:"f-chat-todo-task-description"},[c.value])]):o.createVNode("div",{class:s.value},[c.value])])])}}),er=o.defineComponent({name:"FXTodoListView",props:Ka,setup(e){return()=>{var t;return(t=e.items)!=null&&t.length?o.createVNode("ul",{class:"f-chat-todo-items"},[e.items.map((n,u)=>o.createVNode(iu,o.mergeProps({key:u},n),null))]):null}}}),Sh="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='18px'%20height='18px'%20viewBox='0%200%2018%2018'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3e编组%207%3c/title%3e%3cdefs%3e%3clinearGradient%20x1='50%25'%20y1='0%25'%20x2='50%25'%20y2='100%25'%20id='linearGradient-1'%3e%3cstop%20stop-color='%230D7FE6'%20offset='0%25'%3e%3c/stop%3e%3cstop%20stop-color='%231EBBC6'%20offset='58.0673923%25'%3e%3c/stop%3e%3cstop%20stop-color='%232AE7AF'%20offset='100%25'%3e%3c/stop%3e%3c/linearGradient%3e%3cpath%20d='M7.55915932,0%20L13.7556941,3.41136535%20L13.7556941,11.284674%20L13.3483936,11.690778%20L7.386,8.406%20L7.38699821,14.9818613%20L6.43606745,14.9818613%20L0.817648054,11.8789694%20L0,10.332184%20L0,3.84230019%20L1.11160458,3.1505903%20L6.167,6.164%20L6.16702601,0.0484363034%20L7.55915932,0%20Z%20M6.22734637,8.44496623%20L1.7439756,11.0288454%20L6.22734637,13.5008368%20L6.22734637,8.44496623%20Z%20M12.540835,4.77769015%20L8.0314841,7.40118228%20L12.540835,9.89639007%20L12.540835,4.77769015%20Z%20M1.21847977,4.6422718%20L1.21847977,9.89639007%20L5.74466316,7.33704011%20L1.21847977,4.6422718%20Z%20M7.38699821,1.29872452%20L7.38699821,6.38587585%20L11.9618229,3.74647178%20L7.38699821,1.29872452%20Z'%20id='path-2'%3e%3c/path%3e%3clinearGradient%20x1='81.0966666%25'%20y1='38.5584607%25'%20x2='28.8545509%25'%20y2='61.9626707%25'%20id='linearGradient-4'%3e%3cstop%20stop-color='%23FFFFFF'%20offset='0%25'%3e%3c/stop%3e%3cstop%20stop-color='%23FFFFFF'%20stop-opacity='0'%20offset='100%25'%3e%3c/stop%3e%3c/linearGradient%3e%3cfilter%20x='0.0%25'%20y='0.0%25'%20width='100.0%25'%20height='100.0%25'%20filterUnits='objectBoundingBox'%20id='filter-5'%3e%3cfeGaussianBlur%20stdDeviation='0'%20in='SourceGraphic'%3e%3c/feGaussianBlur%3e%3c/filter%3e%3clinearGradient%20x1='44.8152906%25'%20y1='77.6521765%25'%20x2='44.8152906%25'%20y2='3.26462903%25'%20id='linearGradient-6'%3e%3cstop%20stop-color='%23FFFFFF'%20offset='0%25'%3e%3c/stop%3e%3cstop%20stop-color='%23FFFFFF'%20stop-opacity='0'%20offset='100%25'%3e%3c/stop%3e%3c/linearGradient%3e%3cfilter%20x='0.0%25'%20y='0.0%25'%20width='100.0%25'%20height='100.0%25'%20filterUnits='objectBoundingBox'%20id='filter-7'%3e%3cfeGaussianBlur%20stdDeviation='0'%20in='SourceGraphic'%3e%3c/feGaussianBlur%3e%3c/filter%3e%3clinearGradient%20x1='3.93796935%25'%20y1='32.607826%25'%20x2='78.9687461%25'%20y2='60.0462823%25'%20id='linearGradient-8'%3e%3cstop%20stop-color='%23FFFFFF'%20offset='0%25'%3e%3c/stop%3e%3cstop%20stop-color='%23FFFFFF'%20stop-opacity='0'%20offset='100%25'%3e%3c/stop%3e%3c/linearGradient%3e%3cfilter%20x='0.0%25'%20y='0.0%25'%20width='100.0%25'%20height='100.0%25'%20filterUnits='objectBoundingBox'%20id='filter-9'%3e%3cfeGaussianBlur%20stdDeviation='0'%20in='SourceGraphic'%3e%3c/feGaussianBlur%3e%3c/filter%3e%3clinearGradient%20x1='56.0769337%25'%20y1='45.0797149%25'%20x2='24.9463054%25'%20y2='71.1433818%25'%20id='linearGradient-10'%3e%3cstop%20stop-color='%23159BD7'%20offset='0%25'%3e%3c/stop%3e%3cstop%20stop-color='%23FFFFFF'%20stop-opacity='0'%20offset='100%25'%3e%3c/stop%3e%3c/linearGradient%3e%3clinearGradient%20x1='10.434388%25'%20y1='68.063656%25'%20x2='86.6988821%25'%20y2='30.8651063%25'%20id='linearGradient-11'%3e%3cstop%20stop-color='%2321C6C1'%20offset='0%25'%3e%3c/stop%3e%3cstop%20stop-color='%23FFFFFF'%20stop-opacity='0'%20offset='100%25'%3e%3c/stop%3e%3c/linearGradient%3e%3clinearGradient%20x1='50%25'%20y1='0%25'%20x2='50%25'%20y2='100%25'%20id='linearGradient-12'%3e%3cstop%20stop-color='%230D7FE6'%20offset='0%25'%3e%3c/stop%3e%3cstop%20stop-color='%232AE7AF'%20offset='100%25'%3e%3c/stop%3e%3c/linearGradient%3e%3c/defs%3e%3cg%20id='页面-1'%20stroke='none'%20stroke-width='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='输入框'%20transform='translate(-383,%20-2915)'%3e%3cg%20id='编组-3'%20transform='translate(353,%202900)'%3e%3cg%20id='编组-12'%20transform='translate(16,%200)'%3e%3cg%20id='编组-7'%20transform='translate(14,%2015)'%3e%3crect%20id='矩形'%20x='0'%20y='0'%20width='18'%20height='18'%3e%3c/rect%3e%3cg%20id='编组-35'%20transform='translate(0.2571,%200.2571)'%3e%3crect%20id='矩形'%20x='0'%20y='0'%20width='17.4857143'%20height='17.4857143'%3e%3c/rect%3e%3cg%20id='编组-19备份-17'%20transform='translate(1.0286,%200.5143)'%3e%3cpath%20d='M8.37444647,0.834547606%20L14.5709813,4.24591296%20L14.5709813,12.1192216%20L14.1636807,12.5253256%20L8.20128715,9.24054761%20L8.20228536,15.8164089%20L7.25135461,15.8164089%20L1.63293521,12.713517%20L0.815287151,11.1667316%20L0.815287151,4.67684779%20L1.92689173,3.98513791%20L6.98228715,6.99854761%20L6.98231316,0.882983909%20L8.37444647,0.834547606%20Z%20M7.04263352,9.27951383%20L2.55926275,11.8633931%20L7.04263352,14.3353844%20L7.04263352,9.27951383%20Z%20M13.3561221,5.61223775%20L8.84677126,8.23572989%20L13.3561221,10.7309377%20L13.3561221,5.61223775%20Z%20M2.03376692,5.47681941%20L2.03376692,10.7309377%20L6.55995031,8.17158771%20L2.03376692,5.47681941%20Z%20M8.20228536,2.13327213%20L8.20228536,7.22042346%20L12.77711,4.58101939%20L8.20228536,2.13327213%20Z'%20id='形状结合'%20fill='url(%23linearGradient-1)'%3e%3c/path%3e%3cg%20id='路径-2-+-路径-3-+-路径-4蒙版'%20transform='translate(0.8153,%200.8345)'%3e%3cmask%20id='mask-3'%20fill='white'%3e%3cuse%20xlink:href='%23path-2'%3e%3c/use%3e%3c/mask%3e%3cuse%20id='蒙版'%20fill='url(%23linearGradient-1)'%20xlink:href='%23path-2'%3e%3c/use%3e%3cpolygon%20id='路径-2'%20fill='url(%23linearGradient-4)'%20filter='url(%23filter-5)'%20mask='url(%23mask-3)'%20points='4.25315881%206.97898081%206.77390576%206.97898081%207.02656062%208.27871177%202.85827337%2011.0934106%201.11764364%208.72438079'%3e%3c/polygon%3e%3cpolygon%20id='路径-3'%20fill='url(%23linearGradient-6)'%20filter='url(%23filter-7)'%20mask='url(%23mask-3)'%20points='7.02656062%206.72375166%208.13485635%204.53274022%208.34127598%201.90699543%205.4451985%201.76583085%205.65253089%205.06118714%206.77390576%206.72375166'%3e%3c/polygon%3e%3cpolygon%20id='路径-4'%20fill='url(%23linearGradient-8)'%20filter='url(%23filter-9)'%20mask='url(%23mask-3)'%20points='10.0650382%207.40118228%207.32091739%207.49951705%207.32091739%208.25868082%208.54200343%2010.0061721%2010.9306691%2010.9000701%2012.5091187%208.51626021'%3e%3c/polygon%3e%3c/g%3e%3cpath%20d='M8.37444647,0.834547606%20L14.5709813,4.24591296%20L14.5709813,12.1192216%20L14.1636807,12.5253256%20L6.98231316,8.56885311%20L6.98231316,0.882983909%20L8.37444647,0.834547606%20Z%20M8.20228536,2.13327213%20L8.20228536,7.22042346%20L8.49131316,7.05254761%20L8.49185956,7.71336245%20L9.03131316,8.12754761%20L8.84677126,8.23572989%20L13.3561221,10.7309377%20L13.3553132,5.61654761%20L13.6305018,5.15381301%20L12.77711,4.58101939%20L8.20228536,2.13327213%20Z'%20id='形状结合'%20fill='url(%23linearGradient-10)'%20fill-rule='nonzero'%3e%3c/path%3e%3cpolygon%20id='路径'%20fill='url(%23linearGradient-11)'%20fill-rule='nonzero'%20points='6.7778308%208.05322127%207.08945008%209.24101764%202.55926275%2011.8633931%202.19155022%2010.6380421'%3e%3c/polygon%3e%3cg%20id='编组-21'%20fill='url(%23linearGradient-12)'%3e%3cpath%20d='M7.62936495,9.94195975%20C8.65711289,9.94195975%209.49026721,9.10880543%209.49026721,8.08105749%20C9.49026721,7.05330955%208.65711289,6.22015523%207.62936495,6.22015523%20C6.60161701,6.22015523%205.7684627,7.05330955%205.7684627,8.08105749%20C5.7684627,9.10880543%206.60161701,9.94195975%207.62936495,9.94195975%20Z%20M13.9785177,6.03107309%20C14.7793603,6.03107309%2015.4285714,5.38186193%2015.4285714,4.58101939%20C15.4285714,3.78017684%2014.7793603,3.13096568%2013.9785177,3.13096568%20C13.1776752,3.13096568%2012.528464,3.78017684%2012.528464,4.58101939%20C12.528464,5.38186193%2013.1776752,6.03107309%2013.9785177,6.03107309%20Z%20M7.62936495,16.4714598%20C8.4302075,16.4714598%209.07941866,15.8222486%209.07941866,15.0214061%20C9.07941866,14.2205635%208.4302075,13.5713524%207.62936495,13.5713524%20C6.8285224,13.5713524%206.17931125,14.2205635%206.17931125,15.0214061%20C6.17931125,15.8222486%206.8285224,16.4714598%207.62936495,16.4714598%20Z%20M1.45005371,13.0387617%20C2.25089625,13.0387617%202.90010741,12.3895505%202.90010741,11.588708%20C2.90010741,10.7878654%202.25089625,10.1386543%201.45005371,10.1386543%20C0.649211158,10.1386543%200,10.7878654%200,11.588708%20C0,12.3895505%200.649211158,13.0387617%201.45005371,13.0387617%20Z%20M7.62936495,2.51342642%20C8.32342849,2.51342642%208.88607816,1.95077675%208.88607816,1.25671321%20C8.88607816,0.56264967%208.32342849,0%207.62936495,0%20C6.93530141,0%206.37265174,0.56264967%206.37265174,1.25671321%20C6.37265174,1.95077675%206.93530141,2.51342642%207.62936495,2.51342642%20Z%20M13.9785177,12.9913309%20C14.6725813,12.9913309%2015.2352309,12.4286812%2015.2352309,11.7346177%20C15.2352309,11.0405541%2014.6725813,10.4779045%2013.9785177,10.4779045%20C13.2844542,10.4779045%2012.7218045,11.0405541%2012.7218045,11.7346177%20C12.7218045,12.4286812%2013.2844542,12.9913309%2013.9785177,12.9913309%20Z%20M1.45005371,5.50262617%20C2.14411725,5.50262617%202.70676692,4.9399765%202.70676692,4.24591296%20C2.70676692,3.55184942%202.14411725,2.98919975%201.45005371,2.98919975%20C0.755990164,2.98919975%200.193340494,3.55184942%200.193340494,4.24591296%20C0.193340494,4.9399765%200.755990164,5.50262617%201.45005371,5.50262617%20Z'%20id='形状结合'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/g%3e%3c/svg%3e",Fh=300,Dh={Working:"正在执行任务",Done:"已完成任务",NotStart:"待执行任务"},Qt=o.defineComponent({name:"FXStartedTodo",props:Ya,setup(e){const t=o.ref(null),n=o.ref(null),u=o.ref(null),i=o.ref(null),r=o.computed(()=>e.outputMode==="streaming"),{displayContent:a}=fo(()=>({detail:e.taskDetail??""}),()=>!0,r,{charInterval:30}),s=o.ref(e.initExpanded),l=o.computed(()=>({"f-chat-message-started-todo--content":!0,"d-none":!s.value}));function d(){e.detailViewMode!=="expand"&&(i.value!=null&&(window.clearTimeout(i.value),i.value=null),u.value=window.setTimeout(()=>{t.value&&n.value&&n.value.show(t.value),u.value=null},Fh))}function f(){e.detailViewMode!=="expand"&&(u.value!=null&&(window.clearTimeout(u.value),u.value=null),i.value=window.setTimeout(()=>{var x,k;(k=(x=n.value)==null?void 0:x.hide)==null||k.call(x),i.value=null},150))}function c(){if(e.detailViewMode==="none")return null;const x=a.value.detail??"";return o.createVNode(o.Fragment,null,[x?o.createVNode("div",{class:"f-chat-started-todo-task-detail"},[x]):null,o.createVNode(er,{items:e.todoList},null)])}function m(){e.detailViewMode==="expand"&&(s.value=!s.value)}function g(){return e.detailViewMode==="expand"?o.createVNode("i",{class:"fx-icon fx-icon-arrow-right",style:{transform:s.value?"rotate(90deg)":"rotate(0deg)",transition:"all 0.3s ease-in-out"}},null):null}function p(){return e.detailViewMode==="hover"&&o.createVNode(Kt,{ref:n,class:"f-chat-started-todo-popover"},{default:()=>[o.createVNode("div",{class:"f-chat-started-todo-popover-content",onMouseenter:()=>{i.value!=null&&(window.clearTimeout(i.value),i.value=null)},onMouseleave:f},[c()])]})}function v(){return e.showLoading?e.loading?e.loading:e.status==="Done"?o.createVNode("img",{src:Sh},null):o.createVNode(ru,{status:e.status},null):null}return()=>o.createVNode("div",{ref:t,class:["f-chat-message-started-todo",{"is-working":e.status==="Working"}],onMouseenter:d,onMouseleave:f},[o.createVNode("div",{class:"f-chat-message-started-todo--header",onClick:m},[e.showLabel&&o.createVNode("span",{class:"f-chat-started-todo-label"},[Dh[e.status]]),v(),o.createVNode("span",{class:"f-chat-started-todo-message",innerHTML:e.message},null),g()]),e.detailViewMode==="expand"&&o.createVNode("div",{class:l.value},[c()]),p()])}});Qt.install=e=>{e.component(Qt.name,Qt)};const Th=o.defineComponent({name:"FXBubbleThoughtChain",props:wh,setup(e,t){const{elapsedSeconds:n,hasEverStarted:u,start:i,stop:r,reset:a}=zu(),s=o.computed(()=>{var c;return((c=e.content)==null?void 0:c.status)==="Done"}),l=o.computed(()=>{var c;return((c=e.content)==null?void 0:c.message)??"正在思考......"}),d=o.computed(()=>{var g,p;const c=((g=e.content)==null?void 0:g.doneMessage)??((p=e.content)==null?void 0:p.message)??"思考完成",m=u.value?`(用时${n.value}秒)`:"";return""+c+m}),f=o.computed(()=>s.value?d.value:l.value);return o.watch(()=>{var c;return(c=e.content)==null?void 0:c.status},c=>{c==="Working"?i():c==="Done"?r():a()},{immediate:!0}),o.onUnmounted(()=>{a()}),t.expose({instance:{get loadDone(){return e.content?s.value:!0}}}),()=>{var c,m,g;return e.content?o.createVNode(Qt,{status:((c=e.content)==null?void 0:c.status)??"Working",message:f.value,todoList:(m=e.content)==null?void 0:m.todoList,detailViewMode:((g=e.content)==null?void 0:g.detailViewMode)??"expand",showLabel:!1,showLoading:!0,initExpanded:!0},null):null}}}),tr=o.defineComponent({name:"UserAuthMessage",props:{content:{type:Object,required:!0},onConfirm:{type:Function,default:void 0}},setup(e){return()=>o.createVNode("div",{class:"f-ec-auth"},[o.createVNode("div",{class:"f-ec-auth-desc"},[e.content.description]),o.createVNode("div",{class:"f-ec-auth-actions"},[e.content.options.map(t=>o.createVNode("button",{key:t.optionId,type:"button",class:"f-ec-auth-btn",onClick:()=>{var n;(n=e.onConfirm)==null||n.call(e,t.optionId,t.name,t.message??t.name),console.info("[UserAuth]",t.optionId,t.name)}},[t.name]))])])}}),Nh=300,wn=o.defineComponent({name:"FXToolUseMessage",props:{content:{type:Object,required:!0}},setup(e){const t=o.computed(()=>e.content.toolResultApplied===!0||String(e.content.result??"").trim().length>0),n=o.computed(()=>e.content.success===!1),u=o.ref(!1);let i=setTimeout(()=>{u.value=!0},Nh);o.onBeforeUnmount(()=>{i&&clearTimeout(i)});const r=o.computed(()=>t.value),a=o.computed(()=>u.value&&!t.value),s=o.computed(()=>n.value?"执行失败":r.value?"执行完成":"调用中"),l=o.ref(!1),d=o.computed(()=>({"f-chat-tool-use":!0,"is-done":r.value,"is-error":n.value})),f=o.computed(()=>({"f-chat-tool-use-status":!0,"is-done":r.value&&!n.value,"is-run":a.value&&!n.value,"is-error":n.value}));o.watch(()=>[e.content.result,e.content.toolResultApplied,e.content.success],()=>{t.value&&(l.value=!1)},{flush:"post"});const c=()=>t.value?o.createVNode("div",{class:"f-chat-tool-use-result"},[e.content.result??""]):null;return()=>o.createVNode("div",{class:d.value},[o.createVNode("div",{class:"f-chat-tool-use-header",onClick:()=>{l.value=!l.value}},[o.createVNode("i",{class:"fx-icon fx-icon-thinking_tool tool-icon"},null),o.createVNode("span",{class:"f-chat-tool-use-name"},[e.content.toolDescription??"tool"]),o.createVNode("div",{class:f.value},[n.value?o.createVNode("i",{class:"fx-icon fx-icon-fail_line f-chat-tool-use-status-icon","aria-hidden":"true"},null):o.createVNode(ru,{status:r.value?"Done":a.value?"Working":"NotStart"},null),o.createVNode("span",{class:"f-chat-tool-use-status-text"},[s.value])]),o.createVNode("i",{class:"fx-icon fx-icon-arrow-right",style:{transform:l.value?"rotate(90deg)":"rotate(0deg)",transition:"transform 0.2s ease"}},null)]),l.value&&o.createVNode("div",{class:"f-chat-tool-use-content"},[c()])])}});wn.install=e=>{e.component(wn.name,wn)};const nr=o.defineComponent({name:"FXBubble",components:{"fx-user-auth-inline":tr,"fx-app-preview-inline":at,FXToolUse:wn},props:Fr,setup(e,t){const n=o.shallowRef(),u=o.ref(),i=o.ref(),r=o.computed(()=>!!e.showAvatar),a=o.computed(()=>r.value===!0||e.header==="ContentHeader"),s=o.computed(()=>t.slots.leftFooter||t.slots.rightFooter),l=o.computed(()=>{var D;return Ae({},(D=e.styles)==null?void 0:D.footer)}),d=D=>{if(e.attachmentRowClickOpensPreview!==!1&&e.onPreview){if(D.type==="md"&&D.content){e.onPreview({content:D.content,contentType:"markdown"});return}if(D!=null&&D.url){const H=D!=null&&D.fullScreenPreview?"fullScreen":"splitScreen";e.onPreview({url:D.url,previewMode:H,title:D.name})}}},f=D=>{if(e.attachmentRowClickOpensPreview===!1||!e.onPreview)return;const H=D==null?void 0:D.filter(F=>F.type==="md"&&F.content);if(H.length===0)return;const $=Object.fromEntries(H.map(F=>[F.name,F.content??""]));e.onPreview({contentMap:$,contentType:"markdown"})},{renderFileEmbeddedContent:c,renderPageEmbeddedContent:m}=mo(),g=o.ref(""),p=o.computed(()=>{var H,$;if((H=e.content)!=null&&H.footerContent)return e.content.footerContent;const D=($=e.content)==null?void 0:$.structuredContent;return D&&(D.footerTemplate||D.footerUrl||D.footerFile)?{type:D.footerUrl?"page":D.footerFile?"file":"template",pageUrl:D.footerUrl,fileContent:D.footerFile,template:D.footerTemplate,width:D.footerWidth,height:D.footerHeight}:null});o.watch(()=>{var D;return(D=p.value)==null?void 0:D.width},D=>{if(!D){g.value="";return}if(D.endsWith("%")){const H=parseFloat(D);isNaN(H)||o.nextTick(()=>{var F,R;const $=(R=(F=n.value)==null?void 0:F.parentElement)==null?void 0:R.clientWidth;$&&(g.value=`${$*H/100}px`)})}else g.value=D},{immediate:!0});const v=D=>{if(!D||D.length===0)return"我";const H=D.charAt(0);return/[\u4e00-\u9fa5]/.test(H)?H:H.toUpperCase()};function x(){return e.header==="ContentHeader"?Gl:Xl}const k=x(),{renderHeader:y}=k(e,t),h=()=>{var $,F,R;const D=(($=e.content)==null?void 0:$.sender)??"发送人",H=v(((F=e.content)==null?void 0:F.sender)??"");return o.createVNode("div",{class:"f-chat-bubble-avatar"},[(R=e.content)!=null&&R.avatar?o.createVNode("img",{src:e.content.avatar,alt:D},null):o.createVNode("div",{class:"f-chat-bubble-avatar-initial"},[H])])},b=()=>{var H;const D=(H=e.content)==null?void 0:H.toolUseAboveText;return D!=null&&D.length?o.createVNode("div",{class:"f-chat-bubble-tool-use-group"},[D.map(($,F)=>o.createVNode(wn,{key:$.toolUseId??`tu-${F}`,content:$},null))]):null},w=()=>{var D;return(D=e.content)!=null&&D.thinkingContent?o.createVNode(xh,{ref:u,content:e.content.thinkingContent,outputMode:e.outputMode},null):null},C=()=>{var D;return(D=e.content)!=null&&D.startedTodo?o.createVNode(Th,{ref:i,content:e.content.startedTodo},null):null},E=D=>{if(!(D!=null&&D.type))return null;const{type:H}=D;return H==="page"&&D.pageUrl?m(D,{onNavigate:$=>{var F;(F=e.onPreview)==null||F.call(e,{url:$})}}):H==="file"&&D.fileContent?c(D,{onPreviewFile:d,onBatchPreviewFile:f}):H==="template"&&D.template?D.template():null},_=()=>{var F,R,O;if(!((O=(R=(F=e.content)==null?void 0:F.structuredContent)==null?void 0:R.sections)!=null&&O.length))return null;const{sections:D,showDivider:H}=e.content.structuredContent,$=U=>{const{content:re,label:te}=U;return te||re&&typeof re=="string"?o.createVNode(o.Fragment,null,[o.createVNode("span",{class:"f-chat-bubble-structured-section-item-dot"},null),U.label&&o.createVNode("span",{class:"f-chat-bubble-structured-section-item-label"},[U.label]),o.createVNode("span",{class:"f-chat-bubble-structured-section-item-content"},[U.content])]):E(U.content)};return o.createVNode("div",{class:["f-chat-bubble-structured",{"structure-content-divider":H}]},[D.map((U,re)=>o.createVNode("div",{key:re,class:["f-chat-bubble-structured-section",{"section-divider":U.showDivider}]},[o.createVNode("div",{class:"f-chat-bubble-structured-section-header"},[U.icon&&(U.icon.startsWith("http")||U.icon.startsWith("//")||U.icon.startsWith("../")||/\.(png|jpg|jpeg|gif|svg|webp|bmp)$/i.test(U.icon)?o.createVNode("img",{alt:U.title,src:U.icon,class:"f-chat-bubble-structured-section-icon"},null):o.createVNode("i",{class:`fx-icon ${U.icon}`,style:U.iconStyle},null)),o.createVNode("span",{class:"f-chat-bubble-structured-section-title"},[U.title])]),U.items&&U.items.length>0&&o.createVNode("div",{class:"f-chat-bubble-structured-section-items"},[U.items.map((te,P)=>o.createVNode("div",{key:P,class:"f-chat-bubble-structured-section-item"},[$(te)]))])]))])},z=()=>{const D=p.value;if(!D)return null;const H={};return g.value&&(H.width=g.value),D.height&&(H.height=`${D.height}px`),o.createVNode("div",{class:"f-chat-bubble-content-footer",style:H},[E(D)])},M=()=>{const D=e.attachmentRowClickOpensPreview!==!1?d:void 0;return o.createVNode(ho,{attachments:e.attachments??[],enableFixedWidth:e.placement==="end",showDownloadButton:e.attachmentShowDownload!==!1,onPreview:D,onBatchPreview:e.attachmentRowClickOpensPreview!==!1?f:void 0},null)},I=()=>{var H;const D=(H=e.content)==null?void 0:H.compositeInlineBlocks;return D!=null&&D.length?D.map(($,F)=>$.kind==="userAuth"?o.createVNode(o.resolveComponent("fx-user-auth-inline"),{key:`inline-auth-${F}`,content:$.content,onConfirm:e.onUserAuthConfirm},null):o.createVNode(o.resolveComponent("fx-app-preview-inline"),{key:`inline-preview-${F}`,content:$.content,onOpen:e.onPreview},null)):null},B=()=>{var D,H,$,F,R,O;return o.createVNode("div",{class:`f-chat-bubble-content ${e.placement}`},[a.value&&y(),M(),o.createVNode("div",{class:`f-chat-bubble-content-text-wrapper ${e.placement}`},[(D=e.content)!=null&&D.compositeOrderedBeforeMarkdownRender?e.content.compositeOrderedBeforeMarkdownRender():o.createVNode(o.Fragment,null,[w(),b()]),C(),_(),o.createVNode(bh,{title:((H=e.content)==null?void 0:H.title)??"",subtitle:(($=e.content)==null?void 0:$.subtitle)??"",text:typeof((F=e.content)==null?void 0:F.text)=="string"?e.content.text:"",textFormat:((R=e.content)==null?void 0:R.textFormat)??"plain",placement:e.placement,onDynamicComponentsDetected:e==null?void 0:e.onDynamicComponentsDetected,onShowDynamicComponent:e==null?void 0:e.onShowDynamicComponent},null),z(),(O=e.compositeTailRender)==null?void 0:O.call(e),I()]),s.value&&o.createVNode("div",{class:"f-chat-bubble-footer",style:l.value},[t.slots.leftFooter&&o.createVNode("div",{class:"f-chat-bubble-footer-left"},[t.slots.leftFooter()]),t.slots.rightFooter&&o.createVNode("div",{class:"f-chat-bubble-footer-right"},[t.slots.rightFooter()])])])};return()=>o.createVNode("div",{class:"f-chat-bubble-container",ref:n},[o.createVNode("div",{class:`f-chat-bubble-wrapper ${e.placement}`},[e.placement==="start"?o.createVNode(o.Fragment,null,[r.value&&h(),B()]):o.createVNode(o.Fragment,null,[B(),r.value&&h()])])])}}),Ja={customClass:{type:[Object,String,Array],default:""},customStyle:{type:[Object,String],default:""}},Si=o.defineComponent({name:"FXBubbleAction",props:Ja,setup(e,t){const n=o.computed(()=>Ae({},e.customStyle));return()=>t.slots.default&&o.createVNode("span",{class:"f-chat-bubble-footer-action",style:n.value},[t.slots.default()])}});nr.install=e=>{e.component(nr.name,nr),e.component(Si.name,Si)};const es={items:{type:Array,default:()=>[]},modelValue:{type:Number,default:0},direction:{type:String,default:"horizontal"},autoplay:{type:Boolean,default:!1},interval:{type:Number,default:3e3},loop:{type:Boolean,default:!0},trigger:{type:String,default:"click"},indicatorPosition:{type:String,default:"inside"},arrowVisibility:{type:String,default:"hover"},showIndicator:{type:Boolean,default:!0},showArrow:{type:Boolean,default:!0},showInfo:{type:Boolean,default:!0},height:{type:[String,Number],default:"400px"},styles:{type:Object,default:()=>({})},classNames:{type:Object,default:()=>({})},customClass:{type:[String,Array,Object],default:""},customStyle:{type:[Object,String],default:""},buttonPosition:{type:String,default:"inner"}},ts={item:{type:Object,default:()=>({})},index:{type:Number,default:0},active:{type:Boolean,default:!1},showInfo:{type:Boolean,default:!0},styles:{type:Object,default:()=>({})},classNames:{type:Object,default:()=>({})}},ou=o.defineComponent({name:"FXCarouselItem",props:ts,emits:["click"],setup(e,{slots:t,emit:n}){const u=o.computed(()=>{var c;const f={"fx-carousel--item":!0,"fx-carousel--item-active":e.active};return ye(f,(c=e.classNames)==null?void 0:c.item)}),i=o.computed(()=>{var c,m;const f=Ae({},(c=e.styles)==null?void 0:c.item);return Ae(f,(m=e.styles)==null?void 0:m.item)}),r=()=>{var f,c,m;return e.item.image?o.createVNode("img",{class:["fx-carousel--item-image",(f=e.classNames)==null?void 0:f.image],style:(c=e.styles)==null?void 0:c.image,src:e.item.image,alt:(m=e.item.title)==null?void 0:m.toString()},null):null},a=()=>{var f,c,m,g;return e.item.content?o.createVNode("div",{class:["fx-carousel--item-content",(f=e.classNames)==null?void 0:f.content],style:(c=e.styles)==null?void 0:c.content},[e.item.content]):t.default?o.createVNode("div",{class:["fx-carousel--item-content",(m=e.classNames)==null?void 0:m.content],style:(g=e.styles)==null?void 0:g.content},[t.default()]):null},s=()=>{var f,c;return e.item.title?o.createVNode("h3",{class:["fx-carousel--item-title",(f=e.classNames)==null?void 0:f.title],style:(c=e.styles)==null?void 0:c.title},[e.item.title]):null},l=()=>{var f,c;return e.item.description?o.createVNode("p",{class:["fx-carousel--item-description",(f=e.classNames)==null?void 0:f.description],style:(c=e.styles)==null?void 0:c.description},[e.item.description]):null},d=f=>{e.item.disabled||n("click",f,e.item,e.index)};return()=>o.createVNode("div",{class:u.value,style:i.value,onClick:d},[r(),a(),e.showInfo&&o.createVNode("div",{class:"fx-carousel--item-info"},[s(),l()])])}});function Lh(e){const{items:t,autoplay:n=!1,interval:u=3e3,loop:i=!0,direction:r="horizontal"}=e,a=o.ref(0),s=o.ref(!1),l=o.ref(null),d=o.computed(()=>t.length),f=o.computed(()=>d.value<=1);o.computed(()=>a.value===0?i?d.value-1:0:a.value-1),o.computed(()=>a.value===d.value-1?i?0:a.value:a.value+1);const c=o.computed(()=>{const h=-a.value*100;return{transform:r==="horizontal"?`translateX(${h}%)`:`translateY(${h}%)`,transition:"transform 0.5s ease"}}),m=h=>{h<0||h>=d.value||(a.value,a.value=h)},g=()=>{f.value||(a.value===d.value-1?m(i?0:a.value):m(a.value+1))},p=()=>{f.value||(a.value===0?m(i?d.value-1:0):m(a.value-1))},v=()=>{!n||f.value||(x(),l.value=window.setInterval(()=>{s.value||g()},u))},x=()=>{l.value&&(clearInterval(l.value),l.value=null)},k=()=>{s.value=!0,n&&x()},y=()=>{s.value=!1,n&&v()};return o.onMounted(()=>{v()}),o.onUnmounted(()=>{x()}),{currentIndex:a,totalItems:d,isSingleItem:f,trackStyle:c,goTo:m,next:g,prev:p,handleMouseEnter:k,handleMouseLeave:y}}const rr=o.defineComponent({name:"FXCarousel",props:es,emits:["update:modelValue","change","item-click"],setup(e,{slots:t,emit:n}){const{currentIndex:u,isSingleItem:i,trackStyle:r,goTo:a,next:s,prev:l,handleMouseEnter:d,handleMouseLeave:f}=Lh({items:e.items,autoplay:e.autoplay,interval:e.interval,loop:e.loop,direction:e.direction}),c=w=>{n("update:modelValue",w),n("change",w,u.value)},m=o.computed(()=>{var C;const w={"fx-carousel":!0,"fx-carousel--vertical":e.direction==="vertical","fx-carousel--single":i.value,"fx-carousel--button-outer":e.buttonPosition==="outer","fx-carousel--button-inner":e.buttonPosition==="inner"};return ye(w,(C=e.classNames)==null?void 0:C.root)}),g=o.computed(()=>{var E;const w={height:typeof e.height=="number"?`${e.height}px`:e.height},C=Ae(w,e.customStyle);return Ae(C,(E=e.styles)==null?void 0:E.root)}),p=o.computed(()=>{var C;const w={"fx-carousel--container":!0,"fx-carousel--container-hover":e.arrowVisibility==="hover"};return ye(w,(C=e.classNames)==null?void 0:C.container)}),v=o.computed(()=>{var C;return ye({"fx-carousel--track":!0},(C=e.classNames)==null?void 0:C.track)}),x=o.computed(()=>{var C;const w={"fx-carousel--indicator":!0,"fx-carousel--indicator-outside":e.indicatorPosition==="outside","fx-carousel--indicator-none":e.indicatorPosition==="none"||!e.showIndicator};return ye(w,(C=e.classNames)==null?void 0:C.indicator)}),k=w=>{var E,_;const C={"fx-carousel--arrow":!0,"fx-carousel--arrow-left":w==="left","fx-carousel--arrow-right":w==="right","fx-carousel--arrow-never":e.arrowVisibility==="never"||!e.showArrow};return C[`fx-carousel--arrow-${e.buttonPosition}`]=!0,ye(C,w==="left"?(E=e.classNames)==null?void 0:E.arrowLeft:(_=e.classNames)==null?void 0:_.arrowRight)},y=w=>{var _,z;if(i.value)return null;const C=w==="left"?l:s,E=t[w==="left"?"prevArrow":"nextArrow"];return o.createVNode("button",{class:k(w),style:w==="left"?(_=e.styles)==null?void 0:_.arrowLeft:(z=e.styles)==null?void 0:z.arrowRight,onClick:C,"aria-label":`${w} arrow`},[E?E():o.createVNode("i",{style:"font-size: 60px;",class:`fx-icon fx-icon-arrow-${w==="left"?"left":"right"}`},null)])},h=()=>{var w;return i.value||!e.showIndicator?null:o.createVNode("div",{class:x.value,style:(w=e.styles)==null?void 0:w.indicator},[e.items.map((C,E)=>{var _,z;return o.createVNode("button",{"aria-label":`indicator ${E}`,key:E,class:["fx-carousel--indicator-item",{"fx-carousel--indicator-item-active":E===u.value}],style:E===u.value?(_=e.styles)==null?void 0:_.indicatorItemActive:(z=e.styles)==null?void 0:z.indicatorItem,onClick:()=>{a(E),c(E)}},null)})])},b=()=>o.createVNode("div",{class:v.value,style:r.value},[e.items.map((w,C)=>o.createVNode(ou,{key:w.id||`item_${C}`,item:w,showInfo:e.showInfo,index:C,active:C===u.value,styles:e.styles,classNames:e.classNames,onClick:(E,_,z)=>{n("item-click",E,_,z)}},{default:()=>{var E,_;return[(E=t.item)==null?void 0:E.call(t,{item:w,index:C,active:C===u.value}),(_=t[`item${C}`])==null?void 0:_.call(t,{item:w,index:C,active:C===u.value})]}}))]);return()=>{var w;return o.createVNode("div",{class:m.value,style:g.value,onMouseenter:d,onMouseleave:f},[e.buttonPosition==="outer"&&y("left"),o.createVNode("div",{class:p.value,style:(w=e.styles)==null?void 0:w.container},[e.buttonPosition==="inner"&&y("left"),b(),e.buttonPosition==="inner"&&y("right")]),e.buttonPosition==="outer"&&y("right"),h()])}}});rr.install=e=>{e.component(rr.name,rr),e.component(ou.name,ou)};const ns={customStyle:{type:String,default:""},customClass:{type:String,default:""},direction:{Type:String,default:"row"}};function Ih(e){const t=o.ref(-1),n=o.ref(-1),u=o.ref(0),i=o.ref(0),r=o.ref(!1),a=o.ref(!1),s=o.computed(()=>({display:r.value?"block":"none",left:`${u.value}px`,cursor:"e-resize"})),l=o.computed(()=>({display:a.value?"block":"none",top:`${i.value}px`,cursor:"n-resize"})),d=o.computed(()=>{const x={display:a.value||r.value?"block":"none"};return i.value>0&&(x.cursor="n-resize"),x});function f(x,k,y,h){const b=e.value;if(b){const{left:w,right:C,width:E}=b.getBoundingClientRect();let _=x.clientX-w;h==="right"&&(_=C-x.clientX),_>k&&(_=k),_<y&&(_=y),h==="right"&&(_=E-_),u.value=_}}function c(x,k,y,h){const b=e.value;if(b){const{top:w,bottom:C,height:E}=b.getBoundingClientRect();let _=x.clientY-w;h==="bottom"&&(_=C-x.clientY),_>k&&(_=k),_<y&&(_=y),h==="bottom"&&(_=E-_),i.value=_}}function m(){const x=e.value;if(x){const{width:k,height:y}=x.getBoundingClientRect();return{width:k,height:y}}return null}function g(){const x=e.value;return x?Array.from(x.querySelectorAll("[data-position]")).reduce((k,y)=>{const h=y.getAttribute("data-position");return k=Object.assign(k,{[h]:y}),k},{}):null}function p(x,k){const y=m(),h=g();if(y&&h){const b=h==null?void 0:h.right,w=h==null?void 0:h.left;if(x==="left"&&w)return b?y.width-b.clientWidth-k:y.width-k;if(x==="right"&&b)return w?y.width-w.clientWidth-k:y.width-k}}function v(x,k){const y=m(),h=g();if(y&&h){const b=h==null?void 0:h.bottom,w=h==null?void 0:h.top;if(x==="top"&&w)return b?y.height-b.clientHeight-k:y.height-k;if(x==="bottom"&&b)return w?y.height-w.clientHeight-k:y.height-k}}return{horizontalResizeHandleStyle:s,verticalResizeHandleStyle:l,resizeOverlayStyle:d,showHorizontalResizeHandle:r,showVerticalResizeHandle:a,horizontalResizeBarPosition:t,verticalResizeBarPosition:n,verticalResizeHandleOffset:i,horizontalResizeHandleOffset:u,draggingHorizontalResizeHandle:f,draggingVerticalResizeHandle:c,getPanelMaxWidth:p,getPanelMaxHeight:v}}const vn=o.defineComponent({name:"FXSplitter",props:ns,emits:[],setup(e,t){const n=o.ref(),u=Ih(n),{horizontalResizeHandleStyle:i,verticalResizeHandleStyle:r,resizeOverlayStyle:a}=u;o.provide("splitter",{useResizeHandleComposition:u});const s=o.computed(()=>ye({"f-splitter":!0},e==null?void 0:e.customClass)),l=o.computed(()=>{const d={"flex-direction":e.direction==="row"?"row":"column"};return Ae(d,e==null?void 0:e.customStyle)});return()=>o.createVNode("div",{class:s.value,ref:n,style:l.value},[t.slots.default&&t.slots.default(),o.createVNode("div",{class:"f-splitter-resize-overlay",style:a.value},null),o.createVNode("div",{class:"f-splitter-horizontal-resize-proxy",style:i.value},null),o.createVNode("div",{class:"f-splitter-vertical-resize-proxy",style:r.value},null)])}}),Oh={customClass:{type:String,defaut:""},customStyle:{type:String,default:""},width:{type:Number},height:{type:Number},position:{type:String,default:"left"},visible:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},resizeHandle:{type:String,default:""},collapsable:{type:Boolean,default:!1},minWidth:{type:Number,default:100},minHeight:{type:Number,default:100},maxWidth:{type:Number,default:0},maxHeight:{type:Number,default:0}};function Ph(e,t){const n=o.ref(e.width),u=o.ref(e.height),{horizontalResizeBarPosition:i,horizontalResizeHandleOffset:r,showHorizontalResizeHandle:a,showVerticalResizeHandle:s,verticalResizeBarPosition:l,verticalResizeHandleOffset:d,draggingHorizontalResizeHandle:f,draggingVerticalResizeHandle:c,getPanelMaxWidth:m,getPanelMaxHeight:g}=t;let p="",v,x,k;const y=()=>e.maxWidth?e.maxWidth:m(p,e.minWidth)||0,h=()=>e.maxHeight?e.maxHeight:g(p,e.minHeight)||0;function b(E){if((p==="left"||p==="right")&&x){const{left:_}=x.getBoundingClientRect(),{width:z}=v.getBoundingClientRect(),M=E.clientX-_;let I=p==="left"?(z||0)+(M-i.value):(z||0)-(M-i.value);I=e.minWidth>0?Math.max(e.minWidth,I):I;const B=y();B!=null&&B>0&&(I=B>I?I:B),n.value=I}if((p==="top"||p==="bottom")&&x){const{top:_}=x.getBoundingClientRect(),{height:z}=v.getBoundingClientRect(),M=E.clientY-_;let I=p==="top"?(z||0)+(M-l.value):(z||0)-(M-l.value);I=e.minHeight>0?Math.max(e.minHeight,I):I;const B=h();B!=null&&B>0&&(I=B>I?I:B),u.value=I}r.value=0,d.value=0,i.value=-1,l.value=-1,a.value=!1,s.value=!1,document.removeEventListener("mousemove",k),document.removeEventListener("mouseup",b),document.body.style.userSelect="",p="",v=null,x=null}function w(E,_,z){if(p=_,v=z,a.value=!0,x=E.composedPath().find(I=>I.className.split(" ")[0]==="f-splitter"),x){const{left:I}=x.getBoundingClientRect();r.value=E.clientX-I,i.value=E.clientX-I;const B=y();k=D=>f(D,B,e.minWidth,p),document.addEventListener("mousemove",k),document.addEventListener("mouseup",b),document.body.style.userSelect="none"}}function C(E,_,z){if(p=_,v=z,s.value=!0,x=E.composedPath().find(I=>I.className.split(" ")[0]==="f-splitter"),x){const{top:I}=x.getBoundingClientRect();d.value=E.clientY-I,l.value=E.clientY-I;const B=h();k=D=>c(D,B,e.minHeight,p),document.addEventListener("mousemove",k),document.addEventListener("mouseup",b),document.body.style.userSelect="none"}}return{actualWidth:n,actualHeight:u,onClickSplitterHorizontalResizeBar:w,onClickSplitterVerticalResizeBar:C}}const ur=o.defineComponent({name:"FSplitterPane",props:Oh,emits:[],setup(e,t){const n=o.ref(),u=o.inject("splitter"),{useResizeHandleComposition:i}=u,r=Ph(e,i),{actualHeight:a,actualWidth:s,onClickSplitterHorizontalResizeBar:l,onClickSplitterVerticalResizeBar:d}=r,f=o.ref(e.position),c=o.computed(()=>{const h={"f-splitter-pane":!0,"f-splitter-pane-main":f.value==="center","has-resize-bar":e.resizable};return h["f-splitter-pane-"+f.value]=!0,ye(h,e==null?void 0:e.customClass)}),m=o.computed(()=>e.resizeHandle?e.resizeHandle.split(",").filter(h=>["e","n","s","w"].find(b=>b===h)):[]),g=o.computed(()=>{const h={};return(s.value||s.value===0)&&(f.value==="left"||f.value==="right"||m.value.find(b=>b==="e")||m.value.find(b=>b==="w"))&&(h.width=`${s.value}px`),(a.value||a.value===0)&&(f.value==="bottom"||f.value==="top"||m.value.find(b=>b==="s")||m.value.find(b=>b==="n"))&&(h.height=`${a.value}px`),e.visible||(h.display="none"),Ae(h,e==null?void 0:e.customStyle)}),p=o.computed(()=>({"f-splitter-resize-bar":!0,"f-splitter-resize-bar-e":f.value==="left","f-splitter-resize-bar-n":f.value==="bottom","f-splitter-resize-bar-s":f.value==="top","f-splitter-resize-bar-w":f.value==="right"}));function v(h){return{e:"left",w:"right",s:"top",n:"bottom"}[h]||h}function x(h,b){b=v(b),["left","right"].find(w=>w===b)&&l(h,b,n.value),["top","bottom"].find(w=>w===b)&&d(h,b,n.value)}function k(){return m.value.length>0?m.value.map(h=>o.createVNode("span",{class:"f-splitter-resize-bar f-splitter-resize-bar-"+h,onMousedown:b=>x(b,h)},null)):o.createVNode("span",{class:p.value,onMousedown:h=>x(h,f.value)},null)}function y(){s.value=e.width,a.value=e.height,g.value}return t.expose({reset:y}),()=>o.createVNode("div",{ref:n,class:c.value,style:g.value,"data-position":f.value},[t.slots.default&&t.slots.default(),e.resizable&&k()])}});vn.install=e=>{e.component(vn.name,vn),e.component(ur.name,ur)};const rs={previewConfig:{type:Object,default:()=>({})},onClose:{type:Function,default:()=>{}},onIframeLoad:{type:Function,default:()=>{}}},us={content:{type:String,default:null}},Rh=e=>{const t=typeof e;return t!=="function"&&t!=="object"||e===null},Vh=e=>{const t=e.flags===""?void 0:e.flags;return new RegExp(e.source,t)},ir=(e,t=new WeakMap)=>{if(e===null||Rh(e))return e;if(t.has(e))return t.get(e);if(e instanceof RegExp)return Vh(e);if(e instanceof Date)return new Date(e.getTime());if(e instanceof Function)return e;if(e instanceof Map){const u=new Map;return t.set(e,u),e.forEach((i,r)=>{u.set(r,ir(i,t))}),u}if(e instanceof Set){const u=new Set;t.set(e,u);for(const i of e)u.add(ir(i,t));return u}if(Array.isArray(e)){const u=[];return t.set(e,u),e.forEach(i=>{u.push(ir(i,t))}),u}const n={};t.set(e,n);for(const u in e)Object.prototype.hasOwnProperty.call(e,u)&&(n[u]=ir(e[u],t));return n},Mh=(e,t=200)=>{let n=0;return(...u)=>new Promise(i=>{n&&(clearTimeout(n),i("cancel")),n=window.setTimeout(()=>{e.apply(void 0,u),n=0,i("done")},t)})},Fi=()=>`${Date.now().toString(36)}${Math.random().toString(36).substring(2)}`,au=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Bh=new Set(["__proto__","constructor","prototype"]),zh=e=>!Bh.has(e),Di=(e,t,n={})=>{if(Array.isArray(e)&&Array.isArray(t))return Ti(e,t,n);const{excludeKeys:u}=n,i=e,r=t;for(const a of Object.keys(r)){if(!zh(a))continue;const s=r[a],l=i[a];u&&u(a)?i[a]=s:Array.isArray(s)&&Array.isArray(l)?i[a]=Ti(l,s,n):au(s)&&au(l)?i[a]=Di(l,s,n):i[a]=s}return e},Ti=(e,t,n)=>{const u=e.slice();return t.forEach((i,r)=>{const a=u[r];Array.isArray(i)&&Array.isArray(a)?u[r]=Ti(a,i,n):au(i)&&au(a)?u[r]=Di(a,i,n):u[r]=i}),u},X="md-editor",de="https://unpkg.com",jh=`${de}/@highlightjs/cdn-assets@11.11.1/highlight.min.js`,is={main:`${de}/prettier@3.8.1/standalone.js`,markdown:`${de}/prettier@3.8.1/plugins/markdown.js`},Hh={css:`${de}/cropperjs@1.6.2/dist/cropper.min.css`,js:`${de}/cropperjs@1.6.2/dist/cropper.min.js`},$h=`${de}/screenfull@5.2.0/dist/screenfull.js`,Uh=`${de}/mermaid@11.12.3/dist/mermaid.min.js`,Wh={js:`${de}/katex@0.16.33/dist/katex.min.js`,css:`${de}/katex@0.16.33/dist/katex.min.css`},Ni={a11y:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/a11y-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/a11y-dark.min.css`},atom:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/atom-one-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/atom-one-dark.min.css`},github:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/github.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/github-dark.min.css`},gradient:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/gradient-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/gradient-dark.min.css`},kimbie:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/kimbie-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/kimbie-dark.min.css`},paraiso:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/paraiso-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/paraiso-dark.min.css`},qtcreator:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/qtcreator-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/qtcreator-dark.min.css`},stackoverflow:{light:`${de}/@highlightjs/cdn-assets@11.11.1/styles/stackoverflow-light.min.css`,dark:`${de}/@highlightjs/cdn-assets@11.11.1/styles/stackoverflow-dark.min.css`}},Gh=`${de}/echarts@6.0.0/dist/echarts.min.js`,os={"zh-CN":{toolbarTips:{bold:"加粗",underline:"下划线",italic:"斜体",strikeThrough:"删除线",title:"标题",sub:"下标",sup:"上标",quote:"引用",unorderedList:"无序列表",orderedList:"有序列表",task:"任务列表",codeRow:"行内代码",code:"块级代码",link:"链接",image:"图片",table:"表格",mermaid:"mermaid图",katex:"katex公式",revoke:"后退",next:"前进",save:"保存",prettier:"美化",pageFullscreen:"浏览器全屏",fullscreen:"屏幕全屏",preview:"预览",previewOnly:"仅预览",htmlPreview:"html代码预览",catalog:"目录",github:"源码地址"},titleItem:{h1:"一级标题",h2:"二级标题",h3:"三级标题",h4:"四级标题",h5:"五级标题",h6:"六级标题"},imgTitleItem:{link:"添加链接",upload:"上传图片",clip2upload:"裁剪上传"},linkModalTips:{linkTitle:"添加链接",imageTitle:"添加图片",descLabel:"链接描述:",descLabelPlaceHolder:"请输入描述...",urlLabel:"链接地址:",urlLabelPlaceHolder:"请输入链接...",buttonOK:"确定"},clipModalTips:{title:"裁剪图片上传",buttonUpload:"上传"},copyCode:{text:"复制代码",successTips:"已复制!",failTips:"复制失败!"},mermaid:{flow:"流程图",sequence:"时序图",gantt:"甘特图",class:"类图",state:"状态图",pie:"饼图",relationship:"关系图",journey:"旅程图"},katex:{inline:"行内公式",block:"块级公式"},footer:{markdownTotal:"字数",scrollAuto:"同步滚动"}},"en-US":{toolbarTips:{bold:"bold",underline:"underline",italic:"italic",strikeThrough:"strikeThrough",title:"title",sub:"subscript",sup:"superscript",quote:"quote",unorderedList:"unordered list",orderedList:"ordered list",task:"task list",codeRow:"inline code",code:"block-level code",link:"link",image:"image",table:"table",mermaid:"mermaid",katex:"formula",revoke:"revoke",next:"undo revoke",save:"save",prettier:"prettier",pageFullscreen:"fullscreen in page",fullscreen:"fullscreen",preview:"preview",previewOnly:"preview only",htmlPreview:"html preview",catalog:"catalog",github:"source code"},titleItem:{h1:"Lv1 Heading",h2:"Lv2 Heading",h3:"Lv3 Heading",h4:"Lv4 Heading",h5:"Lv5 Heading",h6:"Lv6 Heading"},imgTitleItem:{link:"Add Image Link",upload:"Upload Images",clip2upload:"Crop And Upload"},linkModalTips:{linkTitle:"Add Link",imageTitle:"Add Image",descLabel:"Desc:",descLabelPlaceHolder:"Enter a description...",urlLabel:"Link:",urlLabelPlaceHolder:"Enter a link...",buttonOK:"OK"},clipModalTips:{title:"Crop Image",buttonUpload:"Upload"},copyCode:{text:"Copy",successTips:"Copied!",failTips:"Copy failed!"},mermaid:{flow:"flow",sequence:"sequence",gantt:"gantt",class:"class",state:"state",pie:"pie",relationship:"relationship",journey:"journey"},katex:{inline:"inline",block:"block"},footer:{markdownTotal:"Character Count",scrollAuto:"Scroll Auto"}}},lt={editorExtensions:{highlight:{js:jh,css:Ni},prettier:{standaloneJs:is.main,parserMarkdownJs:is.markdown},cropper:{...Hh},screenfull:{js:$h},mermaid:{js:Uh,enableZoom:!0},katex:{...Wh},echarts:{js:Gh}},editorExtensionsAttrs:{},editorConfig:{languageUserDefined:{},mermaidTemplate:{},renderDelay:500,zIndex:2e4},codeMirrorExtensions:e=>e,markdownItConfig:()=>{},markdownItPlugins:e=>e,mermaidConfig:e=>e,katexConfig:e=>e,echartsConfig:e=>e},Xh=({instance:e,ctx:t,props:n={}},u="default")=>{const i=(e==null?void 0:e.$slots[u])||(t==null?void 0:t.slots[u]);return(i?i(e):"")||n[u]},qh="buildFinished",Li="errorCatcher",Ii="catalogChanged",Zh="pushCatalog",as="rerender",Yh="taskStateChanged";class Kh{constructor(){fe(this,"pools",{})}remove(t,n,u){const i=this.pools[t]&&this.pools[t][n];i&&(this.pools[t][n]=i.filter(r=>r!==u))}clear(t){this.pools[t]={}}on(t,n){return this.pools[t]||(this.pools[t]={}),this.pools[t][n.name]||(this.pools[t][n.name]=[]),this.pools[t][n.name].push(n.callback),this.pools[t][n.name].includes(n.callback)}emit(t,n,...u){this.pools[t]||(this.pools[t]={});const i=this.pools[t][n];i&&i.forEach(r=>{try{r(...u)}catch(a){console.error(`${n} monitor event exception!`,a)}})}}const it=new Kh,Qh=(e,t)=>{if(!e)return e;const n=t.split(`
|
|
33
33
|
`),u=['<span rn-wrapper aria-hidden="true">'];return n.forEach(()=>{u.push("<span></span>")}),u.push("</span>"),`<span class="${X}-code-block">${e}</span>${u.join("")}`};async function ss(e){if(typeof e=="string"){if(window.isSecureContext&&navigator.clipboard)return await navigator.clipboard.writeText(e);{const t=document.createElement("textarea");let n=!1;if(t.value=e,t.style.position="fixed",t.style.opacity=0,t.style.zIndex="-10000",t.style.top="-10000",document.body.appendChild(t),t.select(),n=document.execCommand("copy"),document.body.removeChild(t),n)return;throw new Error('Failed to copy content via "execCommand"!')}}}const Jh={copy:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-copy ${X}-icon"><rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`,"collapse-tips":`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-circle-chevron-left ${X}-icon"><circle cx="12" cy="12" r="10"/><path d="m14 16-4-4 4-4"/></svg>`,pin:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pin ${X}-icon"><path d="M12 17v5"/><path d="M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z"/></svg>`,"pin-off":`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-pin-off ${X}-icon"><path d="M12 17v5"/><path d="M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89"/><path d="m2 2 20 20"/><path d="M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11"/></svg>`,check:`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-check ${X}-icon"><path d="M20 6 9 17l-5-5"/></svg>`},St=(e,t)=>typeof t[e]=="string"?t[e]:Jh[e],jt=(e,t,n="")=>{var i;const u=document.getElementById(t.id);if(u)n!==""&&(Reflect.get(window,n)?(i=t.onload)==null||i.call(u,new Event("load")):t.onload&&u.addEventListener("load",t.onload));else{const r={...t};r.onload=null;const a=t1(e,r);t.onload&&a.addEventListener("load",t.onload),document.head.appendChild(a)}},e1=(e,t)=>{var n;(n=document.getElementById(t.id))==null||n.remove(),jt(e,t)},t1=(e,t)=>{const n=document.createElement(e);return Object.keys(t).forEach(u=>{t[u]!==void 0&&(n[u]=t[u])}),n},n1=(e,t)=>{const n=new Map;return e==null||e.forEach(u=>{let i=u.querySelector(`.${X}-mermaid-action`);i?i.querySelector(`.${X}-mermaid-copy`)||i.insertAdjacentHTML("beforeend",`<span class="${X}-mermaid-copy">${St("copy",t.customIcon)}</span>`):(u.insertAdjacentHTML("beforeend",`<div class="${X}-mermaid-action"><span class="${X}-mermaid-copy">${St("copy",t.customIcon)}</span></div>`),i=u.querySelector(`.${X}-mermaid-action`));const r=i.querySelector(`.${X}-mermaid-copy`);let a=-1;const s=()=>{clearTimeout(a),ss(u.dataset.content||"").then(()=>{r.innerHTML=St("check",t.customIcon)}).catch(()=>{r.innerHTML=St("copy",t.customIcon)}).finally(()=>{a=window.setTimeout(()=>{r.innerHTML=St("copy",t.customIcon)},1500)})};r.addEventListener("click",s),n.set(u,{removeClick:()=>{r.removeEventListener("click",s)}})}),()=>{n.forEach(({removeClick:u})=>{u==null||u()}),n.clear()}},r1=(()=>{const e=t=>{if(!t)return()=>{};const n=t.firstChild;let u=1,i=0,r=0,a=!1,s,l,d,f=1;const c=()=>{n.style.transform=`translate(${i}px, ${r}px) scale(${u})`},m=b=>{b.touches.length===1?(a=!0,s=b.touches[0].clientX-i,l=b.touches[0].clientY-r):b.touches.length===2&&(d=Math.hypot(b.touches[0].clientX-b.touches[1].clientX,b.touches[0].clientY-b.touches[1].clientY),f=u)},g=b=>{if(b.preventDefault(),a&&b.touches.length===1)i=b.touches[0].clientX-s,r=b.touches[0].clientY-l,c();else if(b.touches.length===2){const w=Math.hypot(b.touches[0].clientX-b.touches[1].clientX,b.touches[0].clientY-b.touches[1].clientY)/d,C=u;u=f*(1+(w-1));const E=(b.touches[0].clientX+b.touches[1].clientX)/2,_=(b.touches[0].clientY+b.touches[1].clientY)/2,z=n.getBoundingClientRect(),M=(E-z.left)/C,I=(_-z.top)/C;i-=M*(u-C),r-=I*(u-C),c()}},p=()=>{a=!1},v=b=>{b.preventDefault();const w=.02,C=u;b.deltaY<0?u+=w:u=Math.max(.1,u-w);const E=n.getBoundingClientRect(),_=b.clientX-E.left,z=b.clientY-E.top;i-=_/C*(u-C),r-=z/C*(u-C),c()},x=b=>{a=!0,s=b.clientX-i,l=b.clientY-r},k=b=>{a&&(i=b.clientX-s,r=b.clientY-l,c())},y=()=>{a=!1},h=()=>{a=!1};return t.addEventListener("touchstart",m,{passive:!1}),t.addEventListener("touchmove",g,{passive:!1}),t.addEventListener("touchend",p),t.addEventListener("wheel",v,{passive:!1}),t.addEventListener("mousedown",x),t.addEventListener("mousemove",k),t.addEventListener("mouseup",y),t.addEventListener("mouseleave",h),()=>{t.removeEventListener("touchstart",m),t.removeEventListener("touchmove",g),t.removeEventListener("touchend",p),t.removeEventListener("wheel",v),t.removeEventListener("mousedown",x),t.removeEventListener("mousemove",k),t.removeEventListener("mouseup",y),t.removeEventListener("mouseleave",h)}};return(t,n)=>{const u=new Map;return t==null||t.forEach(i=>{let r=i.querySelector(`.${X}-mermaid-action`);r?r.querySelector(`.${X}-mermaid-zoom`)||r.insertAdjacentHTML("beforeend",`<span class="${X}-mermaid-zoom">${St("pin-off",n.customIcon)}</span>`):(i.insertAdjacentHTML("beforeend",`<div class="${X}-mermaid-action"><span class="${X}-mermaid-zoom">${St("pin-off",n.customIcon)}</span></div>`),r=i.querySelector(`.${X}-mermaid-action`));const a=r.querySelector(`.${X}-mermaid-zoom`),s=()=>{const l=u.get(i);if(l!=null&&l.removeEvent)l.removeEvent(),i.removeAttribute("data-grab"),u.set(i,{removeClick:l.removeClick}),a.innerHTML=St("pin-off",n.customIcon);else{const d=e(i);i.setAttribute("data-grab",""),u.set(i,{removeEvent:d,removeClick:l==null?void 0:l.removeClick}),a.innerHTML=St("pin",n.customIcon)}};a.addEventListener("click",s),u.set(i,{removeClick:()=>a.removeEventListener("click",s)})}),()=>{u.forEach(({removeEvent:i,removeClick:r})=>{i==null||i(),r==null||r()}),u.clear()}}})(),ls=new Set([!0,!1,"alt","title"]);function cs(e,t){return(Array.isArray(e)?e:[]).filter(([n])=>n!==t)}function ds(e,t){e&&e.attrs&&(e.attrs=cs(e.attrs,t))}function u1(e,t){if(!ls.has(e))throw new TypeError(`figcaption must be one of: ${[...ls]}.`);if(e==="alt")return t.content;const n=t.attrs.find(([u])=>u==="title");return Array.isArray(n)&&n[1]?(ds(t,"title"),n[1]):void 0}function i1(e,t){t=t||{},e.core.ruler.before("linkify","image_figures",function(n){let u=1;for(let i=1,r=n.tokens.length;i<r-1;++i){const a=n.tokens[i];if(a.type!=="inline"||!a.children||a.children.length!==1&&a.children.length!==3||a.children.length===1&&a.children[0].type!=="image")continue;if(a.children.length===3){const[d,f,c]=a.children;if(d.type!=="link_open"||f.type!=="image"||c.type!=="link_close")continue}if(i!==0&&n.tokens[i-1].type!=="paragraph_open"||i!==r-1&&n.tokens[i+1].type!=="paragraph_close")continue;const s=n.tokens[i-1];let l;if(s.type="figure_open",s.tag="figure",n.tokens[i+1].type="figure_close",n.tokens[i+1].tag="figure",t.dataType&&n.tokens[i-1].attrPush(["data-type","image"]),t.link&&a.children.length===1){[l]=a.children;const d=new n.Token("link_open","a",1);d.attrPush(["href",l.attrGet("src")]),a.children.unshift(d),a.children.push(new n.Token("link_close","a",-1))}if(l=a.children.length===1?a.children[0]:a.children[1],t.figcaption){const d=u1(t.figcaption,l);if(d){const[f]=e.parseInline(d,n.env);a.children.push(new n.Token("figcaption_open","figcaption",1)),a.children.push(...f.children),a.children.push(new n.Token("figcaption_close","figcaption",-1)),l.attrs&&(l.attrs=cs(l.attrs,"title"))}}if(t.copyAttrs&&l.attrs){const d=t.copyAttrs===!0?"":t.copyAttrs;s.attrs=l.attrs.filter(([f])=>f.match(d)).map(f=>Array.from(f))}if(t.tabindex&&(n.tokens[i-1].attrPush(["tabindex",u]),u++),t.lazy&&(l.attrs.some(([d])=>d==="loading")||l.attrs.push(["loading","lazy"])),t.async&&(l.attrs.some(([d])=>d==="decoding")||l.attrs.push(["decoding","async"])),t.classes&&typeof t.classes=="string"){let d=!1;for(let f=0,c=l.attrs.length;f<c&&!d;f++){const m=l.attrs[f];m[0]==="class"&&(m[1]=`${m[1]} ${t.classes}`,d=!0)}d||l.attrs.push(["class",t.classes])}if(t.removeSrc){const d=l.attrs.find(([f])=>f==="src");l.attrs.push(["data-src",d[1]]),ds(l,"src")}}})}const o1=/\\([ \\!"#$%&'()*+,./:;<=>?@[\]^_`{|}~-])/g;function a1(e,t){const n=e.posMax,u=e.pos;if(e.src.charCodeAt(u)!==126||t||u+2>=n)return!1;e.pos=u+1;let i=!1;for(;e.pos<n;){if(e.src.charCodeAt(e.pos)===126){i=!0;break}e.md.inline.skipToken(e)}if(!i||u+1===e.pos)return e.pos=u,!1;const r=e.src.slice(u+1,e.pos);if(r.match(/(^|[^\\])(\\\\)*\s/))return e.pos=u,!1;e.posMax=e.pos,e.pos=u+1;const a=e.push("sub_open","sub",1);a.markup="~";const s=e.push("text","",0);s.content=r.replace(o1,"$1");const l=e.push("sub_close","sub",-1);return l.markup="~",e.pos=e.posMax+1,e.posMax=n,!0}function s1(e){e.inline.ruler.after("emphasis","sub",a1)}const l1=/\\([ \\!"#$%&'()*+,./:;<=>?@[\]^_`{|}~-])/g;function c1(e,t){const n=e.posMax,u=e.pos;if(e.src.charCodeAt(u)!==94||t||u+2>=n)return!1;e.pos=u+1;let i=!1;for(;e.pos<n;){if(e.src.charCodeAt(e.pos)===94){i=!0;break}e.md.inline.skipToken(e)}if(!i||u+1===e.pos)return e.pos=u,!1;const r=e.src.slice(u+1,e.pos);if(r.match(/(^|[^\\])(\\\\)*\s/))return e.pos=u,!1;e.posMax=e.pos,e.pos=u+1;const a=e.push("sup_open","sup",1);a.markup="^";const s=e.push("text","",0);s.content=r.replace(l1,"$1");const l=e.push("sup_close","sup",-1);return l.markup="^",e.pos=e.posMax+1,e.posMax=n,!0}function d1(e){e.inline.ruler.after("emphasis","sup",c1)}var f1=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,fs=new Set,Oi=typeof process=="object"&&process?process:{},hs=(e,t,n,u)=>{typeof Oi.emitWarning=="function"?Oi.emitWarning(e,t,n,u):console.error(`[${n}] ${t}: ${e}`)},su=globalThis.AbortController,ms=globalThis.AbortSignal;if(typeof su>"u"){ms=class{constructor(){fe(this,"onabort");fe(this,"_onabort",[]);fe(this,"reason");fe(this,"aborted",!1)}addEventListener(n,u){this._onabort.push(u)}},su=class{constructor(){fe(this,"signal",new ms);t()}abort(n){var u,i;if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let r of this.signal._onabort)r(n);(i=(u=this.signal).onabort)==null||i.call(u,n)}}};let e=((wl=Oi.env)==null?void 0:wl.LRU_CACHE_IGNORE_AC_WARNING)!=="1",t=()=>{e&&(e=!1,hs("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}var h1=e=>!fs.has(e),Ht=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),ps=e=>Ht(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?lu:null:null,lu=class extends Array{constructor(t){super(t),this.fill(0)}},m1=(Ft=class{constructor(t,n){fe(this,"heap");fe(this,"length");if(!A(Ft,En))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new n(t),this.length=0}static create(t){let n=ps(t);if(!n)return[];ee(Ft,En,!0);let u=new Ft(t,n);return ee(Ft,En,!1),u}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},En=new WeakMap,oe(Ft,En,!1),Ft),p1=(Tn=class{constructor(t){oe(this,G);oe(this,ot);oe(this,Je);oe(this,ct);oe(this,rn);oe(this,dt);oe(this,_n);oe(this,Sn);oe(this,ft);fe(this,"ttl");fe(this,"ttlResolution");fe(this,"ttlAutopurge");fe(this,"updateAgeOnGet");fe(this,"updateAgeOnHas");fe(this,"allowStale");fe(this,"noDisposeOnSet");fe(this,"noUpdateTTL");fe(this,"maxEntrySize");fe(this,"sizeCalculation");fe(this,"noDeleteOnFetchRejection");fe(this,"noDeleteOnStaleGet");fe(this,"allowStaleOnFetchAbort");fe(this,"allowStaleOnFetchRejection");fe(this,"ignoreFetchAbort");oe(this,ke);oe(this,ht);oe(this,we);oe(this,he);oe(this,ne);oe(this,$e);oe(this,et);oe(this,Ve);oe(this,Se);oe(this,mt);oe(this,Fe);oe(this,pt);oe(this,gt);oe(this,tt);oe(this,nt);oe(this,bt);oe(this,Gt);oe(this,Ue);oe(this,Fn);oe(this,un,()=>{});oe(this,Nt,()=>{});oe(this,kr,()=>{});oe(this,rt,()=>!1);oe(this,on,t=>{});oe(this,Dn,(t,n,u)=>{});oe(this,Cr,(t,n,u,i)=>{if(u||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});fe(this,vl,"LRUCache");let{max:n=0,ttl:u,ttlResolution:i=1,ttlAutopurge:r,updateAgeOnGet:a,updateAgeOnHas:s,allowStale:l,dispose:d,onInsert:f,disposeAfter:c,noDisposeOnSet:m,noUpdateTTL:g,maxSize:p=0,maxEntrySize:v=0,sizeCalculation:x,fetchMethod:k,memoMethod:y,noDeleteOnFetchRejection:h,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:w,allowStaleOnFetchAbort:C,ignoreFetchAbort:E,perf:_}=t;if(_!==void 0&&typeof(_==null?void 0:_.now)!="function")throw new TypeError("perf option must have a now() method if specified");if(ee(this,ft,_??f1),n!==0&&!Ht(n))throw new TypeError("max option must be a nonnegative integer");let z=n?ps(n):Array;if(!z)throw new Error("invalid max value: "+n);if(ee(this,ot,n),ee(this,Je,p),this.maxEntrySize=v||A(this,Je),this.sizeCalculation=x,this.sizeCalculation){if(!A(this,Je)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(y!==void 0&&typeof y!="function")throw new TypeError("memoMethod must be a function if defined");if(ee(this,Sn,y),k!==void 0&&typeof k!="function")throw new TypeError("fetchMethod must be a function if specified");if(ee(this,_n,k),ee(this,Gt,!!k),ee(this,we,new Map),ee(this,he,new Array(n).fill(void 0)),ee(this,ne,new Array(n).fill(void 0)),ee(this,$e,new z(n)),ee(this,et,new z(n)),ee(this,Ve,0),ee(this,Se,0),ee(this,mt,m1.create(n)),ee(this,ke,0),ee(this,ht,0),typeof d=="function"&&ee(this,ct,d),typeof f=="function"&&ee(this,rn,f),typeof c=="function"?(ee(this,dt,c),ee(this,Fe,[])):(ee(this,dt,void 0),ee(this,Fe,void 0)),ee(this,bt,!!A(this,ct)),ee(this,Fn,!!A(this,rn)),ee(this,Ue,!!A(this,dt)),this.noDisposeOnSet=!!m,this.noUpdateTTL=!!g,this.noDeleteOnFetchRejection=!!h,this.allowStaleOnFetchRejection=!!w,this.allowStaleOnFetchAbort=!!C,this.ignoreFetchAbort=!!E,this.maxEntrySize!==0){if(A(this,Je)!==0&&!Ht(A(this,Je)))throw new TypeError("maxSize must be a positive integer if specified");if(!Ht(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");q(this,G,jl).call(this)}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!s,this.ttlResolution=Ht(i)||i===0?i:1,this.ttlAutopurge=!!r,this.ttl=u||0,this.ttl){if(!Ht(this.ttl))throw new TypeError("ttl must be a positive integer if specified");q(this,G,io).call(this)}if(A(this,ot)===0&&this.ttl===0&&A(this,Je)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!A(this,ot)&&!A(this,Je)){let M="LRU_CACHE_UNBOUNDED";h1(M)&&(fs.add(M),hs("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",M,Tn))}}get perf(){return A(this,ft)}static unsafeExposeInternals(t){return{starts:A(t,gt),ttls:A(t,tt),autopurgeTimers:A(t,nt),sizes:A(t,pt),keyMap:A(t,we),keyList:A(t,he),valList:A(t,ne),next:A(t,$e),prev:A(t,et),get head(){return A(t,Ve)},get tail(){return A(t,Se)},free:A(t,mt),isBackgroundFetch:n=>{var u;return q(u=t,G,me).call(u,n)},backgroundFetch:(n,u,i,r)=>{var a;return q(a=t,G,Vu).call(a,n,u,i,r)},moveToTail:n=>{var u;return q(u=t,G,Sr).call(u,n)},indexes:n=>{var u;return q(u=t,G,qt).call(u,n)},rindexes:n=>{var u;return q(u=t,G,Zt).call(u,n)},isStale:n=>{var u;return A(u=t,rt).call(u,n)}}}get max(){return A(this,ot)}get maxSize(){return A(this,Je)}get calculatedSize(){return A(this,ht)}get size(){return A(this,ke)}get fetchMethod(){return A(this,_n)}get memoMethod(){return A(this,Sn)}get dispose(){return A(this,ct)}get onInsert(){return A(this,rn)}get disposeAfter(){return A(this,dt)}getRemainingTTL(t){return A(this,we).has(t)?1/0:0}*entries(){for(let t of q(this,G,qt).call(this))A(this,ne)[t]!==void 0&&A(this,he)[t]!==void 0&&!q(this,G,me).call(this,A(this,ne)[t])&&(yield[A(this,he)[t],A(this,ne)[t]])}*rentries(){for(let t of q(this,G,Zt).call(this))A(this,ne)[t]!==void 0&&A(this,he)[t]!==void 0&&!q(this,G,me).call(this,A(this,ne)[t])&&(yield[A(this,he)[t],A(this,ne)[t]])}*keys(){for(let t of q(this,G,qt).call(this)){let n=A(this,he)[t];n!==void 0&&!q(this,G,me).call(this,A(this,ne)[t])&&(yield n)}}*rkeys(){for(let t of q(this,G,Zt).call(this)){let n=A(this,he)[t];n!==void 0&&!q(this,G,me).call(this,A(this,ne)[t])&&(yield n)}}*values(){for(let t of q(this,G,qt).call(this))A(this,ne)[t]!==void 0&&!q(this,G,me).call(this,A(this,ne)[t])&&(yield A(this,ne)[t])}*rvalues(){for(let t of q(this,G,Zt).call(this))A(this,ne)[t]!==void 0&&!q(this,G,me).call(this,A(this,ne)[t])&&(yield A(this,ne)[t])}[(Al=Symbol.iterator,vl=Symbol.toStringTag,Al)](){return this.entries()}find(t,n={}){for(let u of q(this,G,qt).call(this)){let i=A(this,ne)[u],r=q(this,G,me).call(this,i)?i.__staleWhileFetching:i;if(r!==void 0&&t(r,A(this,he)[u],this))return this.get(A(this,he)[u],n)}}forEach(t,n=this){for(let u of q(this,G,qt).call(this)){let i=A(this,ne)[u],r=q(this,G,me).call(this,i)?i.__staleWhileFetching:i;r!==void 0&&t.call(n,r,A(this,he)[u],this)}}rforEach(t,n=this){for(let u of q(this,G,Zt).call(this)){let i=A(this,ne)[u],r=q(this,G,me).call(this,i)?i.__staleWhileFetching:i;r!==void 0&&t.call(n,r,A(this,he)[u],this)}}purgeStale(){let t=!1;for(let n of q(this,G,Zt).call(this,{allowStale:!0}))A(this,rt).call(this,n)&&(q(this,G,Yt).call(this,A(this,he)[n],"expire"),t=!0);return t}info(t){let n=A(this,we).get(t);if(n===void 0)return;let u=A(this,ne)[n],i=q(this,G,me).call(this,u)?u.__staleWhileFetching:u;if(i===void 0)return;let r={value:i};if(A(this,tt)&&A(this,gt)){let a=A(this,tt)[n],s=A(this,gt)[n];if(a&&s){let l=a-(A(this,ft).now()-s);r.ttl=l,r.start=Date.now()}}return A(this,pt)&&(r.size=A(this,pt)[n]),r}dump(){let t=[];for(let n of q(this,G,qt).call(this,{allowStale:!0})){let u=A(this,he)[n],i=A(this,ne)[n],r=q(this,G,me).call(this,i)?i.__staleWhileFetching:i;if(r===void 0||u===void 0)continue;let a={value:r};if(A(this,tt)&&A(this,gt)){a.ttl=A(this,tt)[n];let s=A(this,ft).now()-A(this,gt)[n];a.start=Math.floor(Date.now()-s)}A(this,pt)&&(a.size=A(this,pt)[n]),t.unshift([u,a])}return t}load(t){this.clear();for(let[n,u]of t){if(u.start){let i=Date.now()-u.start;u.start=A(this,ft).now()-i}this.set(n,u.value,u)}}set(t,n,u={}){var m,g,p,v,x,k,y;if(n===void 0)return this.delete(t),this;let{ttl:i=this.ttl,start:r,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:l}=u,{noUpdateTTL:d=this.noUpdateTTL}=u,f=A(this,Cr).call(this,t,n,u.size||0,s);if(this.maxEntrySize&&f>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),q(this,G,Yt).call(this,t,"set"),this;let c=A(this,ke)===0?void 0:A(this,we).get(t);if(c===void 0)c=A(this,ke)===0?A(this,Se):A(this,mt).length!==0?A(this,mt).pop():A(this,ke)===A(this,ot)?q(this,G,Ru).call(this,!1):A(this,ke),A(this,he)[c]=t,A(this,ne)[c]=n,A(this,we).set(t,c),A(this,$e)[A(this,Se)]=c,A(this,et)[c]=A(this,Se),ee(this,Se,c),Pu(this,ke)._++,A(this,Dn).call(this,c,f,l),l&&(l.set="add"),d=!1,A(this,Fn)&&((m=A(this,rn))==null||m.call(this,n,t,"add"));else{q(this,G,Sr).call(this,c);let h=A(this,ne)[c];if(n!==h){if(A(this,Gt)&&q(this,G,me).call(this,h)){h.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:b}=h;b!==void 0&&!a&&(A(this,bt)&&((g=A(this,ct))==null||g.call(this,b,t,"set")),A(this,Ue)&&((p=A(this,Fe))==null||p.push([b,t,"set"])))}else a||(A(this,bt)&&((v=A(this,ct))==null||v.call(this,h,t,"set")),A(this,Ue)&&((x=A(this,Fe))==null||x.push([h,t,"set"])));if(A(this,on).call(this,c),A(this,Dn).call(this,c,f,l),A(this,ne)[c]=n,l){l.set="replace";let b=h&&q(this,G,me).call(this,h)?h.__staleWhileFetching:h;b!==void 0&&(l.oldValue=b)}}else l&&(l.set="update");A(this,Fn)&&((k=this.onInsert)==null||k.call(this,n,t,n===h?"update":"replace"))}if(i!==0&&!A(this,tt)&&q(this,G,io).call(this),A(this,tt)&&(d||A(this,kr).call(this,c,i,r),l&&A(this,Nt).call(this,l,c)),!a&&A(this,Ue)&&A(this,Fe)){let h=A(this,Fe),b;for(;b=h==null?void 0:h.shift();)(y=A(this,dt))==null||y.call(this,...b)}return this}pop(){var t;try{for(;A(this,ke);){let n=A(this,ne)[A(this,Ve)];if(q(this,G,Ru).call(this,!0),q(this,G,me).call(this,n)){if(n.__staleWhileFetching)return n.__staleWhileFetching}else if(n!==void 0)return n}}finally{if(A(this,Ue)&&A(this,Fe)){let n=A(this,Fe),u;for(;u=n==null?void 0:n.shift();)(t=A(this,dt))==null||t.call(this,...u)}}}has(t,n={}){let{updateAgeOnHas:u=this.updateAgeOnHas,status:i}=n,r=A(this,we).get(t);if(r!==void 0){let a=A(this,ne)[r];if(q(this,G,me).call(this,a)&&a.__staleWhileFetching===void 0)return!1;if(A(this,rt).call(this,r))i&&(i.has="stale",A(this,Nt).call(this,i,r));else return u&&A(this,un).call(this,r),i&&(i.has="hit",A(this,Nt).call(this,i,r)),!0}else i&&(i.has="miss");return!1}peek(t,n={}){let{allowStale:u=this.allowStale}=n,i=A(this,we).get(t);if(i===void 0||!u&&A(this,rt).call(this,i))return;let r=A(this,ne)[i];return q(this,G,me).call(this,r)?r.__staleWhileFetching:r}async fetch(t,n={}){let{allowStale:u=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:l=0,sizeCalculation:d=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:g=this.ignoreFetchAbort,allowStaleOnFetchAbort:p=this.allowStaleOnFetchAbort,context:v,forceRefresh:x=!1,status:k,signal:y}=n;if(!A(this,Gt))return k&&(k.fetch="get"),this.get(t,{allowStale:u,updateAgeOnGet:i,noDeleteOnStaleGet:r,status:k});let h={allowStale:u,updateAgeOnGet:i,noDeleteOnStaleGet:r,ttl:a,noDisposeOnSet:s,size:l,sizeCalculation:d,noUpdateTTL:f,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:p,ignoreFetchAbort:g,status:k,signal:y},b=A(this,we).get(t);if(b===void 0){k&&(k.fetch="miss");let w=q(this,G,Vu).call(this,t,b,h,v);return w.__returned=w}else{let w=A(this,ne)[b];if(q(this,G,me).call(this,w)){let z=u&&w.__staleWhileFetching!==void 0;return k&&(k.fetch="inflight",z&&(k.returnedStale=!0)),z?w.__staleWhileFetching:w.__returned=w}let C=A(this,rt).call(this,b);if(!x&&!C)return k&&(k.fetch="hit"),q(this,G,Sr).call(this,b),i&&A(this,un).call(this,b),k&&A(this,Nt).call(this,k,b),w;let E=q(this,G,Vu).call(this,t,b,h,v),_=E.__staleWhileFetching!==void 0&&u;return k&&(k.fetch=C?"stale":"refresh",_&&C&&(k.returnedStale=!0)),_?E.__staleWhileFetching:E.__returned=E}}async forceFetch(t,n={}){let u=await this.fetch(t,n);if(u===void 0)throw new Error("fetch() returned undefined");return u}memo(t,n={}){let u=A(this,Sn);if(!u)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:r,...a}=n,s=this.get(t,a);if(!r&&s!==void 0)return s;let l=u(t,s,{options:a,context:i});return this.set(t,l,a),l}get(t,n={}){let{allowStale:u=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:r=this.noDeleteOnStaleGet,status:a}=n,s=A(this,we).get(t);if(s!==void 0){let l=A(this,ne)[s],d=q(this,G,me).call(this,l);return a&&A(this,Nt).call(this,a,s),A(this,rt).call(this,s)?(a&&(a.get="stale"),d?(a&&u&&l.__staleWhileFetching!==void 0&&(a.returnedStale=!0),u?l.__staleWhileFetching:void 0):(r||q(this,G,Yt).call(this,t,"expire"),a&&u&&(a.returnedStale=!0),u?l:void 0)):(a&&(a.get="hit"),d?l.__staleWhileFetching:(q(this,G,Sr).call(this,s),i&&A(this,un).call(this,s),l))}else a&&(a.get="miss")}delete(t){return q(this,G,Yt).call(this,t,"delete")}clear(){return q(this,G,so).call(this,"delete")}},ot=new WeakMap,Je=new WeakMap,ct=new WeakMap,rn=new WeakMap,dt=new WeakMap,_n=new WeakMap,Sn=new WeakMap,ft=new WeakMap,ke=new WeakMap,ht=new WeakMap,we=new WeakMap,he=new WeakMap,ne=new WeakMap,$e=new WeakMap,et=new WeakMap,Ve=new WeakMap,Se=new WeakMap,mt=new WeakMap,Fe=new WeakMap,pt=new WeakMap,gt=new WeakMap,tt=new WeakMap,nt=new WeakMap,bt=new WeakMap,Gt=new WeakMap,Ue=new WeakMap,Fn=new WeakMap,G=new WeakSet,io=function(){let t=new lu(A(this,ot)),n=new lu(A(this,ot));ee(this,tt,t),ee(this,gt,n);let u=this.ttlAutopurge?new Array(A(this,ot)):void 0;ee(this,nt,u),ee(this,kr,(s,l,d=A(this,ft).now())=>{n[s]=l!==0?d:0,t[s]=l,i(s,l)}),ee(this,un,s=>{n[s]=t[s]!==0?A(this,ft).now():0,i(s,t[s])});let i=this.ttlAutopurge?(s,l)=>{if(u!=null&&u[s]&&(clearTimeout(u[s]),u[s]=void 0),l&&l!==0&&u){let d=setTimeout(()=>{A(this,rt).call(this,s)&&q(this,G,Yt).call(this,A(this,he)[s],"expire")},l+1);d.unref&&d.unref(),u[s]=d}}:()=>{};ee(this,Nt,(s,l)=>{if(t[l]){let d=t[l],f=n[l];if(!d||!f)return;s.ttl=d,s.start=f,s.now=r||a();let c=s.now-f;s.remainingTTL=d-c}});let r=0,a=()=>{let s=A(this,ft).now();if(this.ttlResolution>0){r=s;let l=setTimeout(()=>r=0,this.ttlResolution);l.unref&&l.unref()}return s};this.getRemainingTTL=s=>{let l=A(this,we).get(s);if(l===void 0)return 0;let d=t[l],f=n[l];if(!d||!f)return 1/0;let c=(r||a())-f;return d-c},ee(this,rt,s=>{let l=n[s],d=t[s];return!!d&&!!l&&(r||a())-l>d})},un=new WeakMap,Nt=new WeakMap,kr=new WeakMap,rt=new WeakMap,jl=function(){let t=new lu(A(this,ot));ee(this,ht,0),ee(this,pt,t),ee(this,on,n=>{ee(this,ht,A(this,ht)-t[n]),t[n]=0}),ee(this,Cr,(n,u,i,r)=>{if(q(this,G,me).call(this,u))return 0;if(!Ht(i))if(r){if(typeof r!="function")throw new TypeError("sizeCalculation must be a function");if(i=r(u,n),!Ht(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i}),ee(this,Dn,(n,u,i)=>{if(t[n]=u,A(this,Je)){let r=A(this,Je)-t[n];for(;A(this,ht)>r;)q(this,G,Ru).call(this,!0)}ee(this,ht,A(this,ht)+t[n]),i&&(i.entrySize=u,i.totalCalculatedSize=A(this,ht))})},on=new WeakMap,Dn=new WeakMap,Cr=new WeakMap,qt=function*({allowStale:t=this.allowStale}={}){if(A(this,ke))for(let n=A(this,Se);!(!q(this,G,oo).call(this,n)||((t||!A(this,rt).call(this,n))&&(yield n),n===A(this,Ve)));)n=A(this,et)[n]},Zt=function*({allowStale:t=this.allowStale}={}){if(A(this,ke))for(let n=A(this,Ve);!(!q(this,G,oo).call(this,n)||((t||!A(this,rt).call(this,n))&&(yield n),n===A(this,Se)));)n=A(this,$e)[n]},oo=function(t){return t!==void 0&&A(this,we).get(A(this,he)[t])===t},Ru=function(t){var r,a,s;let n=A(this,Ve),u=A(this,he)[n],i=A(this,ne)[n];return A(this,Gt)&&q(this,G,me).call(this,i)?i.__abortController.abort(new Error("evicted")):(A(this,bt)||A(this,Ue))&&(A(this,bt)&&((r=A(this,ct))==null||r.call(this,i,u,"evict")),A(this,Ue)&&((a=A(this,Fe))==null||a.push([i,u,"evict"]))),A(this,on).call(this,n),(s=A(this,nt))!=null&&s[n]&&(clearTimeout(A(this,nt)[n]),A(this,nt)[n]=void 0),t&&(A(this,he)[n]=void 0,A(this,ne)[n]=void 0,A(this,mt).push(n)),A(this,ke)===1?(ee(this,Ve,ee(this,Se,0)),A(this,mt).length=0):ee(this,Ve,A(this,$e)[n]),A(this,we).delete(u),Pu(this,ke)._--,n},Vu=function(t,n,u,i){let r=n===void 0?void 0:A(this,ne)[n];if(q(this,G,me).call(this,r))return r;let a=new su,{signal:s}=u;s==null||s.addEventListener("abort",()=>a.abort(s.reason),{signal:a.signal});let l={signal:a.signal,options:u,context:i},d=(v,x=!1)=>{let{aborted:k}=a.signal,y=u.ignoreFetchAbort&&v!==void 0,h=u.ignoreFetchAbort||!!(u.allowStaleOnFetchAbort&&v!==void 0);if(u.status&&(k&&!x?(u.status.fetchAborted=!0,u.status.fetchError=a.signal.reason,y&&(u.status.fetchAbortIgnored=!0)):u.status.fetchResolved=!0),k&&!y&&!x)return c(a.signal.reason,h);let b=g,w=A(this,ne)[n];return(w===g||y&&x&&w===void 0)&&(v===void 0?b.__staleWhileFetching!==void 0?A(this,ne)[n]=b.__staleWhileFetching:q(this,G,Yt).call(this,t,"fetch"):(u.status&&(u.status.fetchUpdated=!0),this.set(t,v,l.options))),v},f=v=>(u.status&&(u.status.fetchRejected=!0,u.status.fetchError=v),c(v,!1)),c=(v,x)=>{let{aborted:k}=a.signal,y=k&&u.allowStaleOnFetchAbort,h=y||u.allowStaleOnFetchRejection,b=h||u.noDeleteOnFetchRejection,w=g;if(A(this,ne)[n]===g&&(!b||!x&&w.__staleWhileFetching===void 0?q(this,G,Yt).call(this,t,"fetch"):y||(A(this,ne)[n]=w.__staleWhileFetching)),h)return u.status&&w.__staleWhileFetching!==void 0&&(u.status.returnedStale=!0),w.__staleWhileFetching;if(w.__returned===w)throw v},m=(v,x)=>{var y;let k=(y=A(this,_n))==null?void 0:y.call(this,t,r,l);k&&k instanceof Promise&&k.then(h=>v(h===void 0?void 0:h),x),a.signal.addEventListener("abort",()=>{(!u.ignoreFetchAbort||u.allowStaleOnFetchAbort)&&(v(void 0),u.allowStaleOnFetchAbort&&(v=h=>d(h,!0)))})};u.status&&(u.status.fetchDispatched=!0);let g=new Promise(m).then(d,f),p=Object.assign(g,{__abortController:a,__staleWhileFetching:r,__returned:void 0});return n===void 0?(this.set(t,p,{...l.options,status:void 0}),n=A(this,we).get(t)):A(this,ne)[n]=p,p},me=function(t){if(!A(this,Gt))return!1;let n=t;return!!n&&n instanceof Promise&&n.hasOwnProperty("__staleWhileFetching")&&n.__abortController instanceof su},ao=function(t,n){A(this,et)[n]=t,A(this,$e)[t]=n},Sr=function(t){t!==A(this,Se)&&(t===A(this,Ve)?ee(this,Ve,A(this,$e)[t]):q(this,G,ao).call(this,A(this,et)[t],A(this,$e)[t]),q(this,G,ao).call(this,A(this,Se),t),ee(this,Se,t))},Yt=function(t,n){var i,r,a,s,l,d;let u=!1;if(A(this,ke)!==0){let f=A(this,we).get(t);if(f!==void 0)if((i=A(this,nt))!=null&&i[f]&&(clearTimeout((r=A(this,nt))==null?void 0:r[f]),A(this,nt)[f]=void 0),u=!0,A(this,ke)===1)q(this,G,so).call(this,n);else{A(this,on).call(this,f);let c=A(this,ne)[f];if(q(this,G,me).call(this,c)?c.__abortController.abort(new Error("deleted")):(A(this,bt)||A(this,Ue))&&(A(this,bt)&&((a=A(this,ct))==null||a.call(this,c,t,n)),A(this,Ue)&&((s=A(this,Fe))==null||s.push([c,t,n]))),A(this,we).delete(t),A(this,he)[f]=void 0,A(this,ne)[f]=void 0,f===A(this,Se))ee(this,Se,A(this,et)[f]);else if(f===A(this,Ve))ee(this,Ve,A(this,$e)[f]);else{let m=A(this,et)[f];A(this,$e)[m]=A(this,$e)[f];let g=A(this,$e)[f];A(this,et)[g]=A(this,et)[f]}Pu(this,ke)._--,A(this,mt).push(f)}}if(A(this,Ue)&&((l=A(this,Fe))!=null&&l.length)){let f=A(this,Fe),c;for(;c=f==null?void 0:f.shift();)(d=A(this,dt))==null||d.call(this,...c)}return u},so=function(t){var n,u,i,r;for(let a of q(this,G,Zt).call(this,{allowStale:!0})){let s=A(this,ne)[a];if(q(this,G,me).call(this,s))s.__abortController.abort(new Error("deleted"));else{let l=A(this,he)[a];A(this,bt)&&((n=A(this,ct))==null||n.call(this,s,l,t)),A(this,Ue)&&((u=A(this,Fe))==null||u.push([s,l,t]))}}if(A(this,we).clear(),A(this,ne).fill(void 0),A(this,he).fill(void 0),A(this,tt)&&A(this,gt)){A(this,tt).fill(0),A(this,gt).fill(0);for(let a of A(this,nt)??[])a!==void 0&&clearTimeout(a);(i=A(this,nt))==null||i.fill(void 0)}if(A(this,pt)&&A(this,pt).fill(0),ee(this,Ve,0),ee(this,Se,0),A(this,mt).length=0,ee(this,ht,0),ee(this,ke,0),A(this,Ue)&&A(this,Fe)){let a=A(this,Fe),s;for(;s=a==null?void 0:a.shift();)(r=A(this,dt))==null||r.call(this,...s)}},Tn);/*! medium-zoom 1.1.0 | MIT License | https://github.com/francoischalifour/medium-zoom */var Jt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var u in n)Object.prototype.hasOwnProperty.call(n,u)&&(e[u]=n[u])}return e},cu=function(t){return t.tagName==="IMG"},g1=function(t){return NodeList.prototype.isPrototypeOf(t)},du=function(t){return t&&t.nodeType===1},gs=function(t){var n=t.currentSrc||t.src;return n.substr(-4).toLowerCase()===".svg"},bs=function(t){try{return Array.isArray(t)?t.filter(cu):g1(t)?[].slice.call(t).filter(cu):du(t)?[t].filter(cu):typeof t=="string"?[].slice.call(document.querySelectorAll(t)).filter(cu):[]}catch{throw new TypeError(`The provided selector is invalid.
|
|
34
34
|
Expects a CSS selector, a Node element, a NodeList or an array.
|
|
35
35
|
See: https://github.com/francoischalifour/medium-zoom`)}},b1=function(t){var n=document.createElement("div");return n.classList.add("medium-zoom-overlay"),n.style.background=t,n},y1=function(t){var n=t.getBoundingClientRect(),u=n.top,i=n.left,r=n.width,a=n.height,s=t.cloneNode(),l=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,d=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;return s.removeAttribute("id"),s.style.position="absolute",s.style.top=u+l+"px",s.style.left=i+d+"px",s.style.width=r+"px",s.style.height=a+"px",s.style.transform="",s},An=function(t,n){var u=Jt({bubbles:!1,cancelable:!1,detail:void 0},n);if(typeof window.CustomEvent=="function")return new CustomEvent(t,u);var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,u.bubbles,u.cancelable,u.detail),i},x1=function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=window.Promise||function(B){function D(){}B(D,D)},i=function(B){var D=B.target;if(D===z){p();return}h.indexOf(D)!==-1&&v({target:D})},r=function(){if(!(w||!_.original)){var B=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;Math.abs(C-B)>E.scrollOffset&&setTimeout(p,150)}},a=function(B){var D=B.key||B.keyCode;(D==="Escape"||D==="Esc"||D===27)&&p()},s=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},D=B;if(B.background&&(z.style.background=B.background),B.container&&B.container instanceof Object&&(D.container=Jt({},E.container,B.container)),B.template){var H=du(B.template)?B.template:document.querySelector(B.template);D.template=H}return E=Jt({},E,D),h.forEach(function($){$.dispatchEvent(An("medium-zoom:update",{detail:{zoom:M}}))}),M},l=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return e(Jt({},E,B))},d=function(){for(var B=arguments.length,D=Array(B),H=0;H<B;H++)D[H]=arguments[H];var $=D.reduce(function(F,R){return[].concat(F,bs(R))},[]);return $.filter(function(F){return h.indexOf(F)===-1}).forEach(function(F){h.push(F),F.classList.add("medium-zoom-image")}),b.forEach(function(F){var R=F.type,O=F.listener,U=F.options;$.forEach(function(re){re.addEventListener(R,O,U)})}),M},f=function(){for(var B=arguments.length,D=Array(B),H=0;H<B;H++)D[H]=arguments[H];_.zoomed&&p();var $=D.length>0?D.reduce(function(F,R){return[].concat(F,bs(R))},[]):h;return $.forEach(function(F){F.classList.remove("medium-zoom-image"),F.dispatchEvent(An("medium-zoom:detach",{detail:{zoom:M}}))}),h=h.filter(function(F){return $.indexOf(F)===-1}),M},c=function(B,D){var H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return h.forEach(function($){$.addEventListener("medium-zoom:"+B,D,H)}),b.push({type:"medium-zoom:"+B,listener:D,options:H}),M},m=function(B,D){var H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return h.forEach(function($){$.removeEventListener("medium-zoom:"+B,D,H)}),b=b.filter(function($){return!($.type==="medium-zoom:"+B&&$.listener.toString()===D.toString())}),M},g=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},D=B.target,H=function(){var F={width:document.documentElement.clientWidth,height:document.documentElement.clientHeight,left:0,top:0,right:0,bottom:0},R=void 0,O=void 0;if(E.container)if(E.container instanceof Object)F=Jt({},F,E.container),R=F.width-F.left-F.right-E.margin*2,O=F.height-F.top-F.bottom-E.margin*2;else{var U=du(E.container)?E.container:document.querySelector(E.container),re=U.getBoundingClientRect(),te=re.width,P=re.height,V=re.left,T=re.top;F=Jt({},F,{width:te,height:P,left:V,top:T})}R=R||F.width-E.margin*2,O=O||F.height-E.margin*2;var L=_.zoomedHd||_.original,W=gs(L)?R:L.naturalWidth||R,K=gs(L)?O:L.naturalHeight||O,Z=L.getBoundingClientRect(),Y=Z.top,ue=Z.left,le=Z.width,De=Z.height,Te=Math.min(Math.max(le,W),R)/le,yt=Math.min(Math.max(De,K),O)/De,Me=Math.min(Te,yt),Nn=(-ue+(R-le)/2+E.margin+F.left)/Me,Xt=(-Y+(O-De)/2+E.margin+F.top)/Me,Lt="scale("+Me+") translate3d("+Nn+"px, "+Xt+"px, 0)";_.zoomed.style.transform=Lt,_.zoomedHd&&(_.zoomedHd.style.transform=Lt)};return new u(function($){if(D&&h.indexOf(D)===-1){$(M);return}var F=function te(){w=!1,_.zoomed.removeEventListener("transitionend",te),_.original.dispatchEvent(An("medium-zoom:opened",{detail:{zoom:M}})),$(M)};if(_.zoomed){$(M);return}if(D)_.original=D;else if(h.length>0){var R=h;_.original=R[0]}else{$(M);return}if(_.original.dispatchEvent(An("medium-zoom:open",{detail:{zoom:M}})),C=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,w=!0,_.zoomed=y1(_.original),document.body.appendChild(z),E.template){var O=du(E.template)?E.template:document.querySelector(E.template);_.template=document.createElement("div"),_.template.appendChild(O.content.cloneNode(!0)),document.body.appendChild(_.template)}if(_.original.parentElement&&_.original.parentElement.tagName==="PICTURE"&&_.original.currentSrc&&(_.zoomed.src=_.original.currentSrc),document.body.appendChild(_.zoomed),window.requestAnimationFrame(function(){document.body.classList.add("medium-zoom--opened")}),_.original.classList.add("medium-zoom-image--hidden"),_.zoomed.classList.add("medium-zoom-image--opened"),_.zoomed.addEventListener("click",p),_.zoomed.addEventListener("transitionend",F),_.original.getAttribute("data-zoom-src")){_.zoomedHd=_.zoomed.cloneNode(),_.zoomedHd.removeAttribute("srcset"),_.zoomedHd.removeAttribute("sizes"),_.zoomedHd.removeAttribute("loading"),_.zoomedHd.src=_.zoomed.getAttribute("data-zoom-src"),_.zoomedHd.onerror=function(){clearInterval(U),console.warn("Unable to reach the zoom image target "+_.zoomedHd.src),_.zoomedHd=null,H()};var U=setInterval(function(){_.zoomedHd.complete&&(clearInterval(U),_.zoomedHd.classList.add("medium-zoom-image--opened"),_.zoomedHd.addEventListener("click",p),document.body.appendChild(_.zoomedHd),H())},10)}else if(_.original.hasAttribute("srcset")){_.zoomedHd=_.zoomed.cloneNode(),_.zoomedHd.removeAttribute("sizes"),_.zoomedHd.removeAttribute("loading");var re=_.zoomedHd.addEventListener("load",function(){_.zoomedHd.removeEventListener("load",re),_.zoomedHd.classList.add("medium-zoom-image--opened"),_.zoomedHd.addEventListener("click",p),document.body.appendChild(_.zoomedHd),H()})}else H()})},p=function(){return new u(function(B){if(w||!_.original){B(M);return}var D=function H(){_.original.classList.remove("medium-zoom-image--hidden"),document.body.removeChild(_.zoomed),_.zoomedHd&&document.body.removeChild(_.zoomedHd),document.body.removeChild(z),_.zoomed.classList.remove("medium-zoom-image--opened"),_.template&&document.body.removeChild(_.template),w=!1,_.zoomed.removeEventListener("transitionend",H),_.original.dispatchEvent(An("medium-zoom:closed",{detail:{zoom:M}})),_.original=null,_.zoomed=null,_.zoomedHd=null,_.template=null,B(M)};w=!0,document.body.classList.remove("medium-zoom--opened"),_.zoomed.style.transform="",_.zoomedHd&&(_.zoomedHd.style.transform=""),_.template&&(_.template.style.transition="opacity 150ms",_.template.style.opacity=0),_.original.dispatchEvent(An("medium-zoom:close",{detail:{zoom:M}})),_.zoomed.addEventListener("transitionend",D)})},v=function(){var B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},D=B.target;return _.original?p():g({target:D})},x=function(){return E},k=function(){return h},y=function(){return _.original},h=[],b=[],w=!1,C=0,E=n,_={original:null,zoomed:null,zoomedHd:null,template:null};Object.prototype.toString.call(t)==="[object Object]"?E=t:(t||typeof t=="string")&&d(t),E=Jt({margin:0,background:"#fff",scrollOffset:40,container:null,template:null},E);var z=b1(E.background);document.addEventListener("click",i),document.addEventListener("keyup",a),document.addEventListener("scroll",r),window.addEventListener("resize",p);var M={open:g,close:p,toggle:v,update:s,clone:l,attach:d,detach:f,on:c,off:m,getOptions:x,getImages:k,getZoomedImage:y};return M};function w1(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var u=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",n==="top"&&u.firstChild?u.insertBefore(i,u.firstChild):u.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var v1=".medium-zoom-overlay{position:fixed;top:0;right:0;bottom:0;left:0;opacity:0;transition:opacity .3s;will-change:opacity}.medium-zoom--opened .medium-zoom-overlay{cursor:pointer;cursor:zoom-out;opacity:1}.medium-zoom-image{cursor:pointer;cursor:zoom-in;transition:transform .3s cubic-bezier(.2,0,.2,1)!important}.medium-zoom-image--hidden{visibility:hidden}.medium-zoom-image--opened{position:relative;cursor:pointer;cursor:zoom-out;will-change:transform}";w1(v1);const $t={hljs:`${X}-hljs`,hlcss:`${X}-hlCss`,mermaidM:`${X}-mermaid-m`,mermaid:`${X}-mermaid`,katexjs:`${X}-katex`,katexcss:`${X}-katexCss`,echarts:`${X}-echarts`},A1=(e,{editorId:t,rootRef:n,setting:u})=>{const i=lt.editorExtensions.highlight,r=lt.editorExtensionsAttrs.highlight;o.provide("editorId",t),o.provide("rootRef",n),o.provide("theme",o.computed(()=>e.theme)),o.provide("language",o.computed(()=>e.language)),o.provide("highlight",o.computed(()=>{const{js:s}=i,l={...Ni,...i.css},{js:d,css:f={}}=r||{},c=e.codeStyleReverse&&e.codeStyleReverseList.includes(e.previewTheme)?"dark":e.theme,m=l[e.codeTheme]?l[e.codeTheme][c]:Ni.atom[c],g=l[e.codeTheme]&&f[e.codeTheme]?f[e.codeTheme][c]:f.atom?f.atom[c]:{};return{js:{src:s,...d},css:{href:m,...g}}})),o.provide("showCodeRowNumber",e.showCodeRowNumber);const a=o.computed(()=>{const s={...os,...lt.editorConfig.languageUserDefined};return Di(ir(os["en-US"]),s[e.language]||{})});return o.provide("usedLanguageText",a),o.provide("previewTheme",o.computed(()=>e.previewTheme)),o.provide("customIcon",o.computed(()=>e.customIcon)),o.provide("setting",o.computed(()=>u?{...u}:{preview:!0,htmlPreview:!1,previewOnly:!1,pageFullscreen:!1,fullscreen:!1})),{editorId:t}},k1=e=>{const t=o.useId();return e.id||e.editorId||`${X}-${t}`},C1=(e,t,n)=>{const u=o.inject("editorId"),i=o.inject("rootRef"),r=o.inject("usedLanguageText"),a=o.inject("setting"),s=()=>{i.value.querySelectorAll(`#${u} .${X}-preview .${X}-code`).forEach(f=>{let c=-1;const m=f.querySelector(`.${X}-copy-button:not([data-processed])`);m&&(m.onclick=g=>{g.preventDefault(),clearTimeout(c);const p=(f.querySelector("input:checked + pre code")||f.querySelector("pre code")).textContent,{text:v,successTips:x,failTips:k}=r.value.copyCode;let y=x;ss(e.formatCopiedText(p||"")).catch(()=>{y=k}).finally(()=>{m.dataset.isIcon?m.dataset.tips=y:m.innerHTML=y,c=window.setTimeout(()=>{m.dataset.isIcon?m.dataset.tips=v:m.innerHTML=v},1500)})},m.setAttribute("data-processed","true"))})},l=()=>{o.nextTick(s)},d=f=>{f&&o.nextTick(s)};o.watch([t,n],l),o.watch(()=>a.value.preview,d),o.watch(()=>a.value.htmlPreview,d),o.onMounted(s)},E1=e=>{const t=o.inject("editorId"),n=o.inject("theme"),u=o.inject("rootRef"),{editorExtensions:i,editorExtensionsAttrs:r}=lt;let a=i.echarts.instance;const s=o.shallowRef(-1),l=()=>{!e.noEcharts&&a&&(s.value=s.value+1)};o.watch(()=>n.value,()=>{l()}),o.onMounted(()=>{var v;if(e.noEcharts||a)return;const p=i.echarts.js;jt("script",{...(v=r.echarts)==null?void 0:v.js,src:p,id:$t.echarts,onload(){a=window.echarts,l()}},"echarts")});let d=[],f=[],c=[];const m=(p=!1)=>{if(!d.length){p&&(f.forEach(y=>{var h;(h=y.dispose)==null||h.call(y)}),c.forEach(y=>{var h;(h=y.disconnect)==null||h.call(y)}),f=[],c=[]);return}const v=[],x=[],k=[];d.forEach((y,h)=>{var C,E;const b=f[h],w=c[h];if(p||!y||!y.isConnected||u!=null&&u.value&&!u.value.contains(y)){(C=b==null?void 0:b.dispose)==null||C.call(b),(E=w==null?void 0:w.disconnect)==null||E.call(w);return}v.push(y),b&&x.push(b),w&&k.push(w)}),d=v,f=x,c=k},g=()=>{m(),!e.noEcharts&&a&&Array.from(u.value.querySelectorAll(`#${t} div.${X}-echarts:not([data-processed])`)).forEach(p=>{if(p.dataset.closed==="false")return!1;try{const v=new Function(`return ${p.innerText}`)(),x=a.init(p,n.value);x.setOption(v),p.setAttribute("data-processed",""),d.push(p),f.push(x);const k=new ResizeObserver(()=>{x.resize()});k.observe(p),c.push(k)}catch(v){it.emit(t,Li,{name:"echarts",message:v==null?void 0:v.message,error:v})}})};return o.onBeforeUnmount(()=>{m(!0)}),{reRenderEcharts:s,replaceEcharts:g}},_1=e=>{const t=o.inject("highlight"),n=o.shallowRef(lt.editorExtensions.highlight.instance);return o.onMounted(()=>{e.noHighlight||n.value||(jt("link",{...t.value.css,rel:"stylesheet",id:$t.hlcss}),jt("script",{...t.value.js,id:$t.hljs,onload(){n.value=window.hljs}},"hljs"))}),o.watch(()=>t.value.css,()=>{e.noHighlight||lt.editorExtensions.highlight.instance||e1("link",{...t.value.css,rel:"stylesheet",id:$t.hlcss})}),n},S1=e=>{const t=o.shallowRef(lt.editorExtensions.katex.instance);return o.onMounted(()=>{var i,r;if(e.noKatex||t.value)return;const{editorExtensions:n,editorExtensionsAttrs:u}=lt;jt("script",{...(i=u.katex)==null?void 0:i.js,src:n.katex.js,id:$t.katexjs,onload(){t.value=window.katex}},"katex"),jt("link",{...(r=u.katex)==null?void 0:r.css,rel:"stylesheet",href:n.katex.css,id:$t.katexcss})}),t},fu=new p1({max:1e3,ttl:6e5}),F1=e=>{const t=o.inject("editorId"),n=o.inject("theme"),u=o.inject("rootRef"),{editorExtensions:i,editorExtensionsAttrs:r,mermaidConfig:a}=lt;let s=i.mermaid.instance;const l=o.shallowRef(-1),d=()=>{if(!e.noMermaid&&s){const f=n.value==="dark"?{startOnLoad:!1,theme:"dark"}:{startOnLoad:!1,theme:"base",themeVariables:{background:"#ffffff",primaryColor:"#ffffff",primaryTextColor:"#1f2329",primaryBorderColor:"#b7c0cc",secondaryColor:"#f7f8fa",tertiaryColor:"#f7f8fa",lineColor:"#596273",edgeLabelBackground:"#ffffff",clusterBkg:"#ffffff",clusterBorder:"#b7c0cc"}};s.initialize(a(f)),l.value=l.value+1}};return o.watch(()=>n.value,()=>{fu.clear(),d()}),o.onMounted(()=>{var c,m;if(e.noMermaid||s)return;const f=i.mermaid.js;/\.mjs/.test(f)?(jt("link",{...(c=r.mermaid)==null?void 0:c.js,rel:"modulepreload",href:f,id:$t.mermaidM}),import(f).then(g=>{s=g.default,d()}).catch(g=>{it.emit(t,Li,{name:"mermaid",message:`Failed to load mermaid module: ${g.message}`,error:g})})):jt("script",{...(m=r.mermaid)==null?void 0:m.js,src:f,id:$t.mermaid,onload(){s=window.mermaid,d()}},"mermaid")}),{reRenderRef:l,replaceMermaid:async()=>{if(!e.noMermaid&&s){const f=u.value.querySelectorAll(`div.${X}-mermaid`),c=document.createElement("div"),m=document.body.offsetWidth>1366?document.body.offsetWidth:1366,g=document.body.offsetHeight>768?document.body.offsetHeight:768;c.style.width=m+"px",c.style.height=g+"px",c.style.position="fixed",c.style.zIndex="-10000",c.style.top="-10000";let p=f.length;p>0&&document.body.appendChild(c),await Promise.allSettled(Array.from(f).map(v=>(async x=>{var h;if(x.dataset.closed==="false")return!1;const k=x.innerText;let y=fu.get(k);if(!y){const b=Fi();let w={svg:""};try{w=await s.render(b,k,c),y=await e.sanitizeMermaid(w.svg);const C=document.createElement("p");C.className=`${X}-mermaid`,C.setAttribute("data-processed",""),C.setAttribute("data-content",k),C.innerHTML=y,(h=C.children[0])==null||h.removeAttribute("height"),fu.set(k,C.innerHTML),x.dataset.line!==void 0&&(C.dataset.line=x.dataset.line),x.replaceWith(C)}catch(C){it.emit(t,Li,{name:"mermaid",message:C.message,error:C})}--p===0&&c.remove()}})(v)))}}}},D1=(e,t)=>{t=t||{};const n=3,u=t.marker||"!",i=u.charCodeAt(0),r=u.length;let a="",s="";const l=(f,c,m,g,p)=>{const v=f[c];return v.type==="admonition_open"?f[c].attrPush(["class",`${X}-admonition ${X}-admonition-${v.info}`]):v.type==="admonition_title_open"&&f[c].attrPush(["class",`${X}-admonition-title`]),p.renderToken(f,c,m)},d=f=>{const c=f.trim().split(" ",2);s="",a=c[0],c.length>1&&(s=f.substring(a.length+2))};e.block.ruler.before("code","admonition",(f,c,m,g)=>{let p,v,x,k=!1,y=f.bMarks[c]+f.tShift[c],h=f.eMarks[c];if(i!==f.src.charCodeAt(y))return!1;for(p=y+1;p<=h&&u[(p-y)%r]===f.src[p];p++);const b=Math.floor((p-y)/r);if(b!==n)return!1;p-=(p-y)%r;const w=f.src.slice(y,p),C=f.src.slice(p,h);if(d(C),g)return!0;for(v=c;v++,!(v>=m||(y=f.bMarks[v]+f.tShift[v],h=f.eMarks[v],y<h&&f.sCount[v]<f.blkIndent));)if(i===f.src.charCodeAt(y)&&!(f.sCount[v]-f.blkIndent>=4)){for(p=y+1;p<=h&&u[(p-y)%r]===f.src[p];p++);if(!(Math.floor((p-y)/r)<b)&&(p-=(p-y)%r,p=f.skipSpaces(p),!(p<h))){k=!0;break}}const E=f.parentType,_=f.lineMax;return f.parentType="root",f.lineMax=v,x=f.push("admonition_open","div",1),x.markup=w,x.block=!0,x.info=a,x.map=[c,v],s&&(x=f.push("admonition_title_open","p",1),x.markup=w+" "+a,x.map=[c,v],x=f.push("inline","",0),x.content=s,x.map=[c,f.line-1],x.children=[],x=f.push("admonition_title_close","p",-1),x.markup=w+" "+a),f.md.block.tokenize(f,c+1,v),x=f.push("admonition_close","div",-1),x.markup=f.src.slice(y,p),x.block=!0,f.parentType=E,f.lineMax=_,f.line=v+(k?1:0),!0},{alt:["paragraph","reference","blockquote","list"]}),e.renderer.rules.admonition_open=l,e.renderer.rules.admonition_title_open=l,e.renderer.rules.admonition_title_close=l,e.renderer.rules.admonition_close=l},Pi=(e,t)=>{const n=e.attrs?e.attrs.slice():[];return t.forEach(u=>{const i=e.attrIndex(u[0]);i<0?n.push(u):(n[i]=n[i].slice(),n[i][1]+=` ${u[1]}`)}),n},T1=(e,t)=>{const n=e.renderer.rules.fence,u=e.utils.unescapeAll,i=/\[(\w*)(?::([\w ]*))?\]/,r=/::(open|close)/,a=c=>c.info?u(c.info).trim():"",s=c=>{const m=a(c),[g=null,p=""]=(i.exec(m)||[]).slice(1);return[g,p]},l=c=>{const m=a(c);return m?m.split(/(\s+)/g)[0]:""},d=c=>{const m=c.info.match(r)||[],g=m[1]==="open"||m[1]!=="close"&&t.codeFoldable&&c.content.trim().split(`
|