@blueking/ai-blueking 0.3.7 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vue2/index.es.min.js +821 -821
- package/dist/vue2/index.iife.min.js +1 -1
- package/dist/vue2/index.umd.min.js +1 -1
- package/package.json +1 -1
|
@@ -340,4 +340,4 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
340
340
|
</button>
|
|
341
341
|
</div>
|
|
342
342
|
`}}var Fse=(t,e)=>{Pf&&(e.onSuccess&&Pf.on("success",e.onSuccess),e.onError&&Pf.on("error",e.onError)),t.renderer.rules.code_block=Yk(t.renderer.rules.code_block,e),t.renderer.rules.fence=Yk(t.renderer.rules.fence,e)};const Bse=Gi(Fse);var $T=(t=>(t.Assistant="assistant",t.Cite="cite",t.System="system",t.User="user",t))($T||{}),Td=(t=>(t.Error="error",t.Loading="loading",t.Success="success",t))(Td||{});const Gse=oo(nn({__name:"ai-avatar",props:{size:{default:36}},setup(t){const e=t,n=gn(()=>({minWidth:`${e.size}px`,maxWidth:`${e.size}px`,minHeight:`${e.size}px`,maxHeight:`${e.size}px`,padding:`${e.size*.208}px ${e.size*.222}px ${e.size*.194}px ${e.size*.18}px`})),r=gn(()=>({fontSize:`${e.size*.611}px`}));return(i,o)=>(gt(),Pt("span",{style:Li(n.value),class:"message-photo ai"},[pt("i",{style:Li(r.value),class:"ai-blueking-icon ai-blueking-ai"},null,4)],4))}}),[["__scopeId","data-v-c3781e8b"]]),jse={key:0,class:"ai-cite-container"},zse={class:"message-content-container"},Yse={class:"message-content user"},Hse={key:0,class:"time-message user"},Qse=["innerHTML"],Vse={class:"message-photo user"},$se=["src"],Wse={class:"message-content ai"},qse={key:0,class:"time-message ai"},Jse={key:2,width:"18",height:"18",class:"loading-message","aria-hidden":"true"},Kse=[pt("use",{"xlink:href":"#ai-blueking-quanquan"},null,-1)],Zse={key:3,class:"message-wrap"},Xse=["innerHTML"],ele=nn({__name:"render-message",props:{message:{},userPhoto:{default:$I}},setup(t){const e=new Lse({html:!0,highlight:function(l,s){if(s&&FP.getLanguage(s))try{return FP.highlight(l,{language:s}).value}catch{}return""}}).use(Bse,{iconClass:"ai-blueking-icon ai-blueking-copy",buttonClass:"ai-blueking-copy-button"}),n=t,r=gn(()=>{var s;const l={error:"ai-blueking-icon ai-blueking-warning-circle-fill",loading:"",success:""};return(s=n.message)!=null&&s.status?l[n.message.status]:""}),i=gn(()=>n.message.content?e.render(n.message.content):""),o=gn(()=>{const l=gf(n.message.time),s=gf();return n.message.time?s.isSame(l,"year")?l.format("MM-DD HH:mm:ss"):l.format("YYYY-MM-DD HH:mm:ss"):""});return(l,s)=>(gt(),Pt("li",{class:da([l.message.role,"message-main"])},[l.message.cite?(gt(),Pt("div",jse,[We(jD,{text:l.message.cite},null,8,["text"])])):Wn("v-if",!0),pt("div",zse,[l.message.role===dt($T).User?(gt(),Pt(sn,{key:0},[pt("p",Yse,[o.value?(gt(),Pt("span",Hse,ur(o.value),1)):Wn("v-if",!0),pt("span",{class:"markdown-message",innerHTML:i.value},null,8,Qse)]),pt("span",Vse,[pt("img",{src:l.userPhoto},null,8,$se)])],64)):(gt(),Pt(sn,{key:1},[We(Gse),pt("p",Wse,[o.value?(gt(),Pt("span",qse,ur(o.value),1)):Wn("v-if",!0),r.value?(gt(),Pt("i",{key:1,class:da(r.value)},null,2)):Wn("v-if",!0),l.message.status===dt(Td).Loading?(gt(),Pt("svg",Jse,Kse)):Wn("v-if",!0),l.message.status===dt(Td).Error?(gt(),Pt("span",Zse,ur(l.message.content),1)):(gt(),Pt("span",{key:4,innerHTML:i.value,class:da({"markdown-message":!0,loading:l.message.status===dt(Td).Loading})},null,10,Xse))])],64))])],2))}}),tle={class:"prompt-list"},nle={class:"search-group"},rle=["onClick"],ile={class:"prompt-content"},ole=oo(nn({__name:"render-send",props:{prompts:{},placeholder:{},value:{}},emits:["change-prompt","update:value","enter","choose-prompt"],setup(t,{emit:e}){const n=t,r=e,i=qw,o=ud,{selectedText:l,lockSelectedText:s}=FS(),u=mn(""),d=mn(40),p=mn(),_=mn(!1),g=gn(()=>{var V;return((V=n.prompts)==null?void 0:V.filter(ue=>ue.content.includes(u.value)))||[]}),m=gn(()=>{var V;return n.placeholder?n.placeholder:(V=n.prompts)!=null&&V.length?rn("您可以键入 “/” 查看更多Prompt"):rn("请输入")}),E=V=>{r("update:value",V),r("change-prompt",V)},S=()=>{var V;n.value==="/"&&((V=n.prompts)!=null&&V.length)?O():K()},v=()=>{ma(()=>{var ue;const V=(ue=p.value)==null?void 0:ue.$el.querySelector("textarea");(V==null?void 0:V.scrollHeight)>40&&n.value?d.value=V.scrollHeight<=300?V.scrollHeight:300:d.value=40})},h=V=>{r("update:value",V.content),r("choose-prompt",V),K(),k()},N=(V,ue)=>{ue.key==="Enter"&&!ue.shiftKey&&(ue.preventDefault(),r("enter"))},A=()=>{E("")},k=()=>{var ue;const V=(ue=p.value)==null?void 0:ue.$el.querySelector("textarea");V==null||V.focus()},C=()=>{l.value&&(s.value=!0)},O=()=>{_.value=!0},K=()=>{_.value=!1};return Rr(()=>n.value,()=>{v(),S()}),_r(k),(V,ue)=>(gt(),Pi(dt(uS),{width:"calc(100% - 118px)","ext-cls":"empty-padding",arrow:!1,"is-show":_.value,"popover-delay":0,boundary:"parent",placement:"bottom",theme:"light",trigger:"manual"},{content:ts(()=>{var Z;return[pt("div",null,[pr((gt(),Pt("section",tle,[We(dt(IS),{class:"input-search",modelValue:u.value,"onUpdate:modelValue":ue[0]||(ue[0]=ie=>u.value=ie),behavior:"simplicity",clearable:""},null,8,["modelValue"]),pt("section",nle,[(gt(!0),Pt(sn,null,Np(g.value,(ie,se)=>pr((gt(),Pt("span",{class:"group-prompt",key:se,onClick:le=>h(ie)},[pt("span",ile,ur(ie.content),1)],8,rle)),[[dt(o),{content:ie.content,placement:"right",theme:"light",width:300,boundary:"parent"}]])),128)),(Z=g.value)!=null&&Z.length?Wn("v-if",!0):(gt(),Pi(dt(_Z),{key:0,class:"exception-wrap-item exception-part",scene:"part",type:"search-empty"}))])])),[[dt(i),K]])])]}),default:ts(()=>[pt("section",{style:Li({"--text-height":d.value+"px"}),class:"send-prompt-container"},[We(dt(IS),{ref_key:"inputRef",ref:p,class:"send-prompt",autosize:!1,clearable:!0,"model-value":V.value,"native-attributes":{autofocus:"autofocus"},placeholder:m.value,row:"1",type:"textarea",onFocus:C,onInput:E,onKeydown:N},null,8,["model-value","placeholder"]),V.value?(gt(),Pi(dt(A_),{key:0,class:"show-clear-only-hover bk-input--clear-icon clear-icon",onClick:A})):Wn("v-if",!0)],4)]),_:1},8,["is-show"]))}}),[["__scopeId","data-v-f75335eb"]]),ale={class:"ai-shortcuts"},sle=oo(nn({__name:"render-shortcuts",props:{shortcuts:{}},emits:["select"],setup(t,{emit:e}){const n=e,r=i=>{n("select",i)};return(i,o)=>(gt(),Pt("ul",ale,[(gt(!0),Pt(sn,null,Np(i.shortcuts,l=>(gt(),Pi(dt(xD),{class:"ai-blueking-shortcut",key:l.label,theme:"info",onClick:s=>r(l)},{default:ts(()=>[ba(ur(l.label),1)]),_:2},1032,["onClick"]))),128))]))}}),[["__scopeId","data-v-266e17ca"]]),lle=(t=>(Sp("data-v-fd57f18d"),t=t(),bp(),t))(()=>pt("svg",{width:"10",height:"10",class:"ai-blueking-render-stop-icon","aria-hidden":"true"},[pt("use",{"xlink:href":"#ai-blueking-tingzhi"})],-1)),cle=oo(nn({__name:"render-stop",props:{isShow:{type:Boolean}},emits:["stop"],setup(t,{emit:e}){const n=e,r=()=>{n("stop")};return(i,o)=>i.isShow?(gt(),Pt("span",{key:0,class:"ai-blueking-render-stop",onClick:r},[lle,ba(" "+ur(dt(rn)("终止生成")),1)])):Wn("v-if",!0)}}),[["__scopeId","data-v-fd57f18d"]]),ule={key:0,class:"time-wrapper"},dle={class:"time-message"},ple=oo(nn({__name:"render-time",props:{message:{}},setup(t){const e=t,n=gn(()=>{var l;const r=gf(e.message.time),i=gf(),o={0:rn("日"),1:rn("一"),2:rn("二"),3:rn("三"),4:rn("四"),5:rn("五"),6:rn("六")};return!e.message.time||(l=window.showTimes)!=null&&l.some(s=>Math.abs(r.diff(s,"minute"))<10&&s!==e.message.time)?"":(window.showTimes=[...window.showTimes||[],e.message.time],i.isSame(r,"day")?r.format("HH:mm:ss"):i.subtract(1,"day").isSame(r,"week")?rn("昨天")+" "+r.format("HH:mm:ss"):i.isSame(r,"week")?rn("本周")+o[r.day()]+" "+r.format("HH:mm:ss"):i.subtract(1,"week").isSame(r,"week")?rn("上周")+o[r.day()]+" "+r.format("HH:mm:ss"):i.isSame(r,"year")?r.format("MM-DD HH:mm:ss"):r.format("YYYY-MM-DD HH:mm:ss"))});return(r,i)=>n.value?(gt(),Pt("section",ule,[pt("span",dle,ur(n.value),1)])):Wn("v-if",!0)}}),[["__scopeId","data-v-55c9a119"]]),Hk=t=>(Sp("data-v-de79ff73"),t=t(),bp(),t),_le={key:0,width:"18",height:"18",class:"scroll-loading-icon","aria-hidden":"true"},fle=[Hk(()=>pt("use",{"xlink:href":"#ai-blueking-loading-2"},null,-1))],mle={class:"ai-operation"},gle={class:"ai-operation-input-wrapper"},Ele={class:"ai-cite-tips"},Sle={class:"ai-operation-input"},ble=Hk(()=>pt("i",{class:"ai-blueking-icon ai-blueking-fasong"},null,-1)),vle=oo(nn({__name:"render-content",props:{messages:{},prompts:{},loading:{type:Boolean},background:{default:"#f5f7fa"},userPhoto:{},placeholder:{},scrollLoading:{type:Boolean},scrollLoadingEnd:{type:Boolean,default:!0},alert:{},shortcuts:{default:()=>WI}},emits:["ai-click","change-prompt","send","choose-prompt","scroll-load","stop"],setup(t,{expose:e,emit:n}){const r=t,i=n,o=ud,l=mn(""),{selectedText:s,clearSelection:u}=FS(),{isShow:d}=GD(),p=()=>{ma(()=>{const C=document.querySelector(".ai-blueking-messages");C.scrollTop=C.scrollHeight})},_=pee(C=>{if(r.scrollLoading||r.scrollLoadingEnd)return;C.target.scrollTop<200&&i("scroll-load")}),g=()=>{if(l.value){if(r.loading){BD({theme:"warning",message:rn("内容正在执行中,请执行完成后再发送")});return}i("send",{content:l.value,cite:s.value}),l.value="",s.value=""}},m=C=>{i("choose-prompt",C)},E=C=>{i("change-prompt",C)},S=()=>{i("stop")},v=C=>{const O=C.target;if(O!=null&&O.classList.contains("ai-blueking-angle-up")){const K=O==null?void 0:O.parentElement;K!=null&&K.classList.contains("closed")?K==null||K.classList.remove("closed"):K==null||K.classList.add("closed")}O!=null&&O.classList.contains("ai-clickable")&&i("ai-click",O.dataset.ai)},h=()=>{p(),document.addEventListener("click",v)},N=()=>{window.showTimes=[],document.removeEventListener("click",v)},A=C=>{l.value=C},k=C=>{const O=C.prompt.replace("{{ SELECTED_TEXT }}",s.value);if(r.loading){BD({theme:"warning",message:rn("内容正在执行中,请执行完成后再发送")});return}i("send",{content:C.label,cite:s.value,prompt:O}),s.value=""};return Rr(()=>r.messages,()=>{const C=document.querySelector(".ai-blueking-messages");(C==null?void 0:C.scrollTop)+(C==null?void 0:C.clientHeight)+100>=(C==null?void 0:C.scrollHeight)&&p()},{deep:!0}),_r(h),$r(N),e({setInputMessage:A}),(C,O)=>(gt(),Pt("section",{style:Li({background:C.background}),class:"ai-content"},[C.alert?(gt(),Pi(dt(fq),{key:0,title:C.alert,theme:"warning",closable:""},null,8,["title"])):Wn("v-if",!0),pt("ul",{class:"ai-messages ai-blueking-messages",onScrollPassive:O[0]||(O[0]=(...K)=>dt(_)&&dt(_)(...K))},[C.scrollLoading?(gt(),Pt("svg",_le,fle)):Wn("v-if",!0),(gt(!0),Pt(sn,null,Np(C.messages,K=>(gt(),Pt(sn,{key:K.content},[We(ple,{class:"render-message",message:K},null,8,["message"]),We(ele,{class:"render-message",message:K,"user-photo":C.userPhoto},null,8,["message","user-photo"])],64))),128))],32),pt("section",mle,[pt("section",{class:"ai-operation-tools",onMousedown:O[1]||(O[1]=Wr(()=>{},["prevent"]))},[We(vee),We(cle,{"is-show":C.loading,onStop:S},null,8,["is-show"])],32),pt("section",gle,[dt(s)?(gt(),Pt("div",{key:0,class:da(["ai-cite-container",{"is-back-show":!dt(d)}]),onMousedown:O[2]||(O[2]=Wr(()=>{},["prevent"]))},[We(jD,{"show-close-icon":!0,text:dt(s),onClose:dt(u)},null,8,["text","onClose"]),pt("span",Ele,ur(dt(rn)("想对选中的文本做什么")),1),We(sle,{shortcuts:C.shortcuts,onSelect:k},null,8,["shortcuts"])],34)):Wn("v-if",!0),pt("section",Sle,[We(ole,{value:l.value,"onUpdate:value":O[3]||(O[3]=K=>l.value=K),placeholder:C.placeholder,prompts:C.prompts,onChangePrompt:E,onChoosePrompt:m,onEnter:g},null,8,["value","placeholder","prompts"]),pr((gt(),Pi(dt(Fq),{class:"ai-operation-button",disabled:C.loading||!l.value,size:"large",theme:"primary",onClick:g},{default:ts(()=>[ble,ba(" "+ur(dt(rn)("发送")),1)]),_:1},8,["disabled"])),[[dt(o),{content:dt(rn)("内容正在执行中,请执行完成后再发送"),disabled:!C.loading}]])])])])],4))}}),[["__scopeId","data-v-de79ff73"]]),hle={class:"ai-modal-header-icon"},Tle=oo(nn({__name:"render-modal",props:{headBackground:{default:"linear-gradient(267deg, #2dd1f4 0%, #1482ff 95%)"},positionLimit:{default:()=>({top:0,bottom:0,left:0,right:0})},sizeLimit:{default:()=>({height:320,width:400})},logo:{default:"ai-blueking-icon ai-blueking-ai"},name:{},startPosition:{default:()=>({top:window.innerHeight-560,bottom:0,left:window.innerWidth-400,right:0})},models:{},model:{}},emits:["clear","close","choose-model"],setup(t,{emit:e}){const n=t,r=e,i=ud,o={height:window.innerHeight,width:window.innerWidth},l={isMove:!1,type:"",clientX:0,clientY:0},s=()=>{var $,j,P,D;const le=(W,ge)=>W===void 0?ge:W;return{top:le(($=n.startPosition)==null?void 0:$.top,o.height-n.sizeLimit.height),bottom:le((j=n.startPosition)==null?void 0:j.bottom,0),left:le((P=n.startPosition)==null?void 0:P.left,0),right:le((D=n.startPosition)==null?void 0:D.right,o.width-n.sizeLimit.width)}},u=mn(s()),d=gn(()=>u.value.top<=n.positionLimit.top&&u.value.bottom<=n.positionLimit.bottom),p=le=>{r("choose-model",le)},_=le=>{l.isMove=!0,l.type="move",l.clientX=le.clientX,l.clientY=le.clientY},g=le=>{l.isMove=!0,l.type="rightDrag",l.clientX=le.clientX},m=le=>{l.isMove=!0,l.type="leftDrag",l.clientX=le.clientX},E=le=>{l.isMove=!0,l.type="topDrag",l.clientY=le.clientY},S=le=>{l.isMove=!0,l.type="bottomDrag",l.clientY=le.clientY},v=le=>{l.isMove=!0,l.type="topLeftDrag",l.clientY=le.clientY,l.clientX=le.clientX},h=le=>{l.isMove=!0,l.type="topRightDrag",l.clientY=le.clientY,l.clientX=le.clientX},N=le=>{l.isMove=!0,l.type="bottomLeftDrag",l.clientY=le.clientY,l.clientX=le.clientX},A=le=>{l.isMove=!0,l.type="bottomRightDrag",l.clientY=le.clientY,l.clientX=le.clientX},k=()=>{l.isMove=!1},C=(le,$)=>{["move","leftDrag"].includes(l.type)&&(u.value.left+=le),["move","rightDrag"].includes(l.type)&&(u.value.right-=le),["move","topDrag"].includes(l.type)&&(u.value.top+=$),["move","bottomDrag"].includes(l.type)&&(u.value.bottom-=$),["topLeftDrag"].includes(l.type)&&(u.value.left+=le,u.value.top+=$),["topRightDrag"].includes(l.type)&&(u.value.right-=le,u.value.top+=$),["bottomLeftDrag"].includes(l.type)&&(u.value.left+=le,u.value.bottom-=$),["bottomRightDrag"].includes(l.type)&&(u.value.right-=le,u.value.bottom-=$)},O=(le,$)=>{const{top:j,bottom:P,left:D,right:W}=u.value;(o.width-D-W<n.sizeLimit.width||D<n.positionLimit.left||W<n.positionLimit.right)&&(["move","leftDrag","topLeftDrag","bottomLeftDrag"].includes(l.type)&&(u.value.left-=le),["move","rightDrag","topRightDrag","bottomRightDrag"].includes(l.type)&&(u.value.right+=le)),(o.height-j-P<n.sizeLimit.height||j<n.positionLimit.top||P<n.positionLimit.bottom)&&(["move","topDrag","topRightDrag","topLeftDrag"].includes(l.type)&&(u.value.top-=$),["move","bottomDrag","bottomLeftDrag","bottomRightDrag"].includes(l.type)&&(u.value.bottom+=$))},K=le=>{if(!l.isMove)return;le.preventDefault();const $=le.clientX-l.clientX,j=le.clientY-l.clientY;C($,j),O($,j),l.clientX=le.clientX,l.clientY=le.clientY},V=()=>{o.height=window.innerHeight,o.width=window.innerWidth,u.value=s()},ue=()=>{u.value.top=n.positionLimit.top,u.value.bottom=n.positionLimit.bottom},Z=()=>{u.value.top=o.height-n.sizeLimit.height,u.value.bottom=n.positionLimit.bottom},ie=()=>{r("clear")},se=()=>{r("close")};return rg(()=>{window.addEventListener("mousemove",K,!0),window.addEventListener("mouseup",k),window.addEventListener("resize",V)}),$r(()=>{window.removeEventListener("mousemove",K,!0),window.removeEventListener("mouseup",k),window.removeEventListener("resize",V)}),(le,$)=>(gt(),Pt("section",{style:Li({top:u.value.top+"px",bottom:u.value.bottom+"px",left:u.value.left+"px",right:u.value.right+"px"}),class:"ai-modal"},[pt("header",{style:Li({background:le.headBackground}),class:"ai-modal-header",onMousedown:Wr(_,["stop"])},[pt("span",hle,[pt("i",{class:da(le.logo)},null,2),ba(" "+ur(le.name||dt(rn)("小鲸"))+" ",1),le.models?(gt(),Pi(dt(kD),{key:0,class:"ai-modal-header-models","model-value":le.model,size:"small",onChange:p},{default:ts(()=>[(gt(!0),Pt(sn,null,Np(le.models,j=>(gt(),Pi(dt(kD).Option,{key:j.id,name:j.name,value:j.id},null,8,["name","value"]))),128))]),_:1},8,["model-value"])):Wn("v-if",!0)]),pt("span",null,[d.value?pr((gt(),Pt("i",{key:0,class:"ai-header-tool ai-blueking-icon ai-blueking-shangxiajuhe",onClick:Z},null,512)),[[dt(i),{content:dt(rn)("向下收缩"),distance:20}]]):pr((gt(),Pt("i",{key:1,class:"ai-header-tool ai-blueking-icon ai-blueking-shangxialashen-2",onClick:ue},null,512)),[[dt(i),{content:dt(rn)("向上扩展"),distance:20}]]),pr(pt("i",{class:"ai-header-tool ai-blueking-icon ai-blueking-saoba",onClick:ie},null,512),[[dt(i),{content:dt(rn)("清空聊天记录"),distance:20}]]),pr(pt("i",{class:"ai-header-tool ai-blueking-icon ai-blueking-shanchu-2",onClick:se},null,512),[[dt(i),{content:dt(rn)("关闭"),distance:20}]])])],36),oF(le.$slots,"default",{},void 0),pt("span",{class:"drag-line left",onMousedown:Wr(m,["stop"])},null,32),pt("span",{class:"drag-line right",onMousedown:Wr(g,["stop"])},null,32),pt("span",{class:"drag-line top",onMousedown:Wr(E,["stop"])},null,32),pt("span",{class:"drag-line bottom",onMousedown:Wr(S,["stop"])},null,32),pt("span",{class:"drag-line top-left-corner",onMousedown:Wr(v,["stop"])},null,32),pt("span",{class:"drag-line top-right-corner",onMousedown:Wr(h,["stop"])},null,32),pt("span",{class:"drag-line bottom-left-corner",onMousedown:Wr(N,["stop"])},null,32),pt("span",{class:"drag-line bottom-right-corner",onMousedown:Wr(A,["stop"])},null,32)],4))}}),[["__scopeId","data-v-01d5a54a"]]),yle=(t=>(Sp("data-v-d5e26041"),t=t(),bp(),t))(()=>pt("i",{class:"ai-blueking-icon ai-blueking-ai"},null,-1)),Cle={class:"popup-text"},Ile=oo(nn({__name:"render-popup",emits:["click"],setup(t,{emit:e}){const{isIconVisible:n,iconPosition:r}=FS(),i=e,o=()=>{i("click"),n.value=!1};return(l,s)=>dt(n)?(gt(),Pt("div",{key:0,style:Li(dt(r)),class:"ai-blueking-render-popup",onMousedown:s[0]||(s[0]=Wr(()=>{},["prevent"]))},[pt("div",{class:"popup-content",onClick:o},[yle,pt("span",Cle,ur(dt(rn)("问小鲸")),1)])],36)):Wn("v-if",!0)}}),[["__scopeId","data-v-d5e26041"]]),Nle=nn({__name:"ai-blueking",props:{messages:{},prompts:{},loading:{type:Boolean},headBackground:{},background:{},positionLimit:{},sizeLimit:{},startPosition:{},userPhoto:{},name:{},placeholder:{},logo:{},scrollLoading:{type:Boolean},scrollLoadingEnd:{type:Boolean},alert:{},models:{},model:{},isShow:{type:Boolean},shortcuts:{}},emits:["clear","close","scroll-load","stop","ai-click","change-prompt","update:model","choose-prompt","send","update:isShow"],setup(t,{expose:e,emit:n}){const r=n,i=mn(),o=v=>{var h;(h=i.value)==null||h.setInputMessage(v)},l=()=>{r("update:isShow",!0)},s=()=>{r("clear")},u=()=>{r("update:isShow",!1),r("close")},d=v=>{r("update:model",v)},p=v=>{r("send",v)},_=()=>{r("stop")},g=()=>{r("scroll-load")},m=v=>{r("ai-click",v)},E=v=>{r("choose-prompt",v)},S=v=>{r("change-prompt",v)};return e({setInputMessage:o}),(v,h)=>(gt(),Pt(sn,null,[pr(We(Tle,{"head-background":v.headBackground,logo:v.logo,model:v.model,models:v.models,name:v.name,"position-limit":v.positionLimit,"size-limit":v.sizeLimit,"start-position":v.startPosition,onChooseModel:d,onClear:s,onClose:u},{default:ts(()=>[We(vle,{ref_key:"contentRef",ref:i,alert:v.alert,background:v.background,loading:v.loading,messages:v.messages,placeholder:v.placeholder,prompts:v.prompts,"scroll-loading":v.scrollLoading,"scroll-loading-end":v.scrollLoadingEnd,shortcuts:v.shortcuts,"user-photo":v.userPhoto,onAiClick:m,onChangePrompt:S,onChoosePrompt:E,onScrollLoad:g,onSend:p,onStop:_},null,8,["alert","background","loading","messages","placeholder","prompts","scroll-loading","scroll-loading-end","shortcuts","user-photo"])]),_:1},8,["head-background","logo","model","models","name","position-limit","size-limit","start-position"]),[[kp,v.isShow]]),We(Ile,{onClick:l})],64))}});(function(){var t='<svg xmlns="http://www.w3.org/2000/svg" data-name="ai-blueking" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0;visibility:hidden"><symbol id="ai-blueking-check-circle-fill" viewBox="0 0 1024 1024"><path fill="#737987" d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-26.3 606.3l-181-181L350 444l135.8 135.8L712 353.5l45.3 45.3-271.6 271.5z"/></symbol><symbol id="ai-blueking-close-circle-fill" viewBox="0 0 1024 1024"><path fill="#737987" d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm158.4 561.1l-45.3 45.3L512 557.3 398.9 670.4l-45.3-45.3L466.7 512 353.6 398.9l45.3-45.3L512 466.7l113.1-113.1 45.3 45.3L557.3 512l113.1 113.1z"/></symbol><symbol id="ai-blueking-warning-circle-fill" viewBox="0 0 1024 1024"><path fill="#737987" d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 640h-64v-64h64v64zm0-128h-64V320h64v256z"/></symbol><symbol id="ai-blueking-help-document" viewBox="0 0 64 64"><path d="M32 4C16.5 4 4 16.5 4 32c0 3.6.7 7.1 2 10.4V56c0 1.1.9 2 2 2h13.6C36 63.7 52.3 56.8 58 42.4S56.8 11.7 42.4 6C39.1 4.7 35.6 4 32 4zm0 52c-3.3 0-6.6-.7-9.6-2H10V41.6c-5.3-12.2.3-26.3 12.4-31.6s26.3.3 31.6 12.4-.3 26.3-12.4 31.6c-3 1.3-6.3 2-9.6 2z"/><circle cx="31.3" cy="42.1" r="3"/><path d="M32.1 18.9c5 0 8.3 2.8 8.3 6.9 0 2.6-1.3 4.5-3.8 6s-3 2.2-3 3.9v.9H29v-1c-.2-2.8.7-4.4 3.2-5.8 2.3-1.4 3-2.2 3-3.8s-1.3-2.8-3.3-2.8c-1.8-.1-3.3 1.2-3.5 3v.2h-4.8c0-4.4 3.1-7.5 8.5-7.5z"/></g></symbol><symbol id="ai-blueking-angle-up" viewBox="0 0 32 32"><path fill="#63656e" d="M16 11.5l7 7-1.5 1.5-5.5-5.5-5.5 5.5L9 18.5l7-7z"/></symbol><symbol id="ai-blueking-copy" viewBox="0 0 64 64"><path d="M54 8H18c-1.1 0-2 .9-2 2v6h-6c-1.1 0-2 .9-2 2v36c0 1.1.9 2 2 2h36c1.1 0 2-.9 2-2v-6h6c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zM44 44v8H12V20h32v24zm8 0h-4V18c0-1.1-.9-2-2-2H20v-4h32v32z"/><path d="M17.2 26.2h21v4h-21zM17 34h21v4H17zM17 42h21v4H17z"/></symbol><symbol id="ai-blueking-cc-jump-link" viewBox="0 0 1024 1024"><path d="M864 128H496v64h291.2L361.6 617.6l44.8 44.8L832 236.8V528h64V160c0-17.6-14.4-32-32-32z"/><path d="M832 704v128H192V192h126.4v-64H160c-17.6 0-32 14.4-32 32v704c0 17.6 14.4 32 32 32h704c17.6 0 32-14.4 32-32V704h-64z"/></symbol><symbol id="ai-blueking-loading-2" viewBox="0 0 1024 1024"><path d="M195.2 195.2a64 64 0 000 90.56l44.8 45.28A64 64 0 00331.04 240l-45.28-44.8a64 64 0 00-90.56 0z" opacity=".1"/><path d="M128 576h64a64 64 0 000-128h-64a64 64 0 000 128z" opacity=".15"/><path d="M285.76 828.8l45.28-44.8A64 64 0 00240 692.96l-44.8 45.28a64 64 0 0090.56 90.56z" opacity=".3"/><path d="M576 896v-64a64 64 0 00-128 0v64a64 64 0 00128 0z" opacity=".45"/><path d="M828.8 828.8a64 64 0 000-90.56L784 692.96A64 64 0 00692.96 784l45.28 45.28a64 64 0 0090.56-.48z" opacity=".6"/><path d="M896 448h-64a64 64 0 000 128h64a64 64 0 000-128z" opacity=".75"/><path d="M738.24 195.2L692.96 240A64 64 0 00784 331.04l45.28-45.28a64 64 0 10-90.56-90.56z" opacity=".9"/><path d="M448 128v64a64 64 0 00128 0v-64a64 64 0 00-128 0z"/></g></symbol><symbol id="ai-blueking-ai" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M928 96v448l-1.211-.014C910.455 758.791 730.989 928 512 928 282.25 928 96 741.75 96 512S282.25 96 512 96h416zM488.911 320H379.544L256 672h84.05l23.292-71.909h137.215L523.342 672h87.088L488.911 320zM736 320h-79.494v352H736V320zm-303.797 66.88l47.594 148.343h-95.696l48.102-148.343z"/></symbol><symbol id="ai-blueking-fasong" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M924.55 113.365c0-.09-.088-.09-.088-.18a30.217 30.217 0 00-7.78-9.684 31.929 31.929 0 00-10.606-5.918c-.089 0-.177-.09-.266-.09-1.502-.537-3.093-.806-4.685-1.075-.442-.09-.884-.27-1.414-.27-1.503-.179-2.917-.179-4.42-.09-.618 0-1.149-.089-1.768 0-4.242.27-8.485 1.525-12.375 3.498L113.792 485.577c-7.514 3.677-13.26 10.312-15.911 18.382-.796 2.242-1.15 4.663-1.415 6.994-.795 4.753-.618 9.685.884 14.347 2.475 8.16 8.044 14.885 15.558 18.741l194.734 103.836c4.685 2.51 9.812 3.766 15.115 3.766 11.757.09 22.541-6.367 28.287-16.768 8.397-15.513 2.475-34.791-13.083-43.13l-142.316-75.86 572.358-288.014L418.93 634.516c-.265.27-.354.628-.619.897-8.662 5.739-14.32 15.423-14.32 26.542v234.123a32.598 32.598 0 009.547 22.686c6.01 6.008 14.143 9.236 22.54 9.146v.09c17.68 0 32-14.257 32-31.832V675.405l381.07-444.127-79.202 585.802-200.921-97.917c-15.823-7.712-34.828-1.255-42.872 14.526-3.712 7.622-4.243 16.41-1.503 24.48s8.575 14.615 16.177 18.202l238.754 116.48c4.42 2.151 9.193 3.227 14.144 3.227.176 0 .353-.09.53-.09.53 0 1.15.18 1.68.18 15.91.09 29.435-11.657 31.733-27.618l99.003-731.782c2.21-7.532 1.767-15.871-2.122-23.403z"/></symbol><symbol id="ai-blueking-shangxialashen-2" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M510.24 64L352 251.52l127.168-.672.928 223.968h.352l.832 298.656-127.168.736L513.792 960 672 772.448l-127.136.704-.928-320h-.384l-.8-202.656 127.168-.704z"/></symbol><symbol id="ai-blueking-shangxiajuhe" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M510.24 384L352 192l317.92 1.77L510.24 384zm1.44 256l158.24 192L352 830.23 511.68 640zM128 480h768v64H128z"/></symbol><symbol id="ai-blueking-shanchu-2" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M832 259.2L764.8 192 512 444.8 259.2 192 192 259.2 444.8 512 192 764.8l67.2 67.2L512 579.2 764.8 832l67.2-67.2L579.2 512z"/></symbol><symbol id="ai-blueking-saoba" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M566.857 64C607.253 64 640 92.654 640 128v96h256c35.346 0 64 28.654 64 64v96c0 35.346-28.654 64-64 64h-5.818v332.453l21.56 102.356c7.284 34.587-14.848 68.532-49.436 75.817a64 64 0 01-13.19 1.374H175.262c-35.346 0-64-28.654-64-64a64 64 0 011.436-13.484l21.12-97.989V448H128c-35.346 0-64-28.654-64-64v-96c0-35.346 28.654-64 64-64h256v-96c0-35.346 32.747-64 73.143-64h109.714zm259.325 384H197.818v343.346l-1.436 6.665L175.262 896H320V704c0-17.673 14.327-32 32-32 17.673 0 32 14.327 32 32v192h96V704c0-17.673 14.327-32 32-32 17.673 0 32 14.327 32 32v192h96V704c0-17.673 14.327-32 32-32 17.673 0 32 14.327 32 32v192h145.115l-21.559-102.356-1.374-6.524V448zM896 288H128v96h768v-96zM566.857 128H457.143v96h109.714v-96z"/></symbol><symbol id="ai-blueking-quanquan" viewBox="0 0 1024 1024"><path fill="#3A84FF" d="M512 64.129c-9.343-.661-18.345 3.338-27.005 11.998-2.666 2.667-4.831 6.165-6.495 10.495-1.664 4.33-2.496 7.498-2.496 9.503v4c0 10.004 2.997 18.003 8.991 23.997 3.328 4.01 7.327 6.847 11.999 8.511 4.671 1.664 8.34 2.496 11.006 2.496h4c68.003 0 130.993 16.83 188.97 50.49 57.978 33.66 103.807 79.49 137.489 137.488 33.681 57.999 50.511 121.16 50.49 189.483-.021 68.322-16.851 131.313-50.49 188.97-33.64 57.657-79.469 103.316-137.489 136.976-58.02 33.66-121.18 50.49-189.482 50.49-68.301 0-131.292-16.83-188.97-50.49-57.68-33.66-103.338-79.319-136.977-136.976-33.639-57.657-50.469-120.818-50.49-189.482 0-10.005-3.669-18.676-11.007-26.013-2.666-3.328-6.164-5.824-10.494-7.487-4.33-1.664-7.498-2.496-9.503-2.496h-4c-10.004 0-18.334 3.338-24.99 10.015-4.01 4.01-6.846 8.18-8.51 12.51-1.664 4.33-2.496 7.498-2.496 9.503v4c0 60.665 11.828 118.663 35.484 173.996 23.656 55.332 55.482 102.996 95.477 142.991 39.996 39.996 87.66 71.822 142.992 95.478 55.332 23.656 113.33 35.483 173.996 35.483 60.665 0 118.664-11.827 173.996-35.483 55.332-23.656 102.996-55.482 142.992-95.478 39.995-39.995 71.82-87.659 95.477-142.991 23.656-55.333 35.484-113.331 35.484-173.996 0-60.665-11.828-118.664-35.484-173.996-23.656-55.333-55.482-102.997-95.477-142.992-39.996-39.996-87.66-71.821-142.992-95.477C630.664 75.989 572.666 64.16 512 64.16v-.032z"/></symbol><symbol id="ai-blueking-xiangxia-2" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M176 617.6l92.8-89.6 182.4 179.2V112h121.6v595.2L755.2 528l92.8 89.6L512 944 176 617.6z" clip-rule="evenodd"/></symbol><symbol id="ai-blueking-tingzhi" viewBox="0 0 1024 1024"><path fill="#fdd" d="M256 256h512v512H256V256z"/><path fill="#ea3636" d="M128 128v768h768V128H128zm640 640H256V256h512v512z"/></symbol></svg>';document.body?document.body.insertAdjacentHTML("afterbegin",t):document.addEventListener("DOMContentLoaded",function(){document.body.insertAdjacentHTML("afterbegin",t)})})();class Ole{constructor(e,n,r,i,o){zs(this,"controllerMap");zs(this,"handleEnd");zs(this,"handleError");zs(this,"handleReceiveMessage");zs(this,"handleStart");zs(this,"url");this.url=e,this.handleStart=n,this.handleReceiveMessage=r,this.handleEnd=i,this.handleError=o,this.controllerMap={}}stop(e){var n,r;return(r=(n=this.controllerMap[e])==null?void 0:n.abort)==null||r.call(n),this.handleEnd(e)}async stream(e,n,r){const i=new AbortController;this.controllerMap[n]=i,fetch(this.url,{method:"post",signal:i.signal,headers:{"Content-Type":"application/json",...r},mode:"cors",credentials:"include",body:JSON.stringify(e)}).then(async o=>{const l=o.body.pipeThrough(new window.TextDecoderStream).getReader();for(;;)try{const{value:s,done:u}=await l.read();if(!o.ok){this.handleError(s||o.statusText,o.status,n);break}if(u){this.handleEnd(n);break}s.toString().split(`
|
|
343
|
-
`).forEach(p=>{const _=p.replace("data:","").trim();if(dee(_)){const{event:g,content:m,result:E,code:S,message:v}=JSON.parse(_);if(E===!1||o.status!==200){this.handleError(v,S,n);return}switch(g){case"text":this.handleReceiveMessage(m,n);break;case"done":this.handleEnd(n);break;case"error":this.handleError(v,S,n);break}}})}catch(s){(s==null?void 0:s.code)!==20&&this.handleError(s.message,s.code,n);break}}).catch(o=>{(o==null?void 0:o.code)!==20&&this.handleError(o.message,o.code,n)}),await this.handleStart(n)}}n6({prefix:"ai-blueking"});const Rle={name:"AiBlueking",render(t){return t("div",{style:{width:"100%"}})},props:{messages:{default:()=>[],type:Array},prompts:{default:()=>[],type:Array},loading:{default:!1,type:Boolean},headBackground:{default:"linear-gradient(267deg, #2dd1f4 0%, #1482ff 95%)",type:String},background:{default:"#f5f7fa",type:String},positionLimit:{default:()=>({top:0,bottom:0,left:0,right:0}),type:Object},sizeLimit:{default:()=>({height:320,width:400}),type:Object},startPosition:{default:()=>({top:window.innerHeight-560,bottom:0,left:window.innerWidth-400,right:0}),type:Object},userPhoto:{default:$I,type:String},logo:{default:"ai-blueking-icon ai-blueking-ai",type:String},name:{default:"",type:String},placeholder:{default:"",type:String},scrollLoading:{default:!1,type:Boolean},scrollLoadingEnd:{default:!0,type:Boolean},alert:{default:"",type:String},models:{default:void 0,type:Array},model:{default:"",type:String},isShow:{type:Boolean},shortcuts:{default:()=>WI,type:Array}},data(){return{app:null,unWatchStack:[]}},watch:{messages:{handler(){setTimeout(()=>{const t=document.querySelector(".ai-blueking-messages");(t==null?void 0:t.scrollTop)+(t==null?void 0:t.clientHeight)+100>=(t==null?void 0:t.scrollHeight)&&(t.scrollTop=t.scrollHeight)},10)},deep:!0}},created(){const t=this.$emit.bind(this);let e=null,n=null;const r=this;this.app=Fp({render(){return e=this,n=Kt(Nle,{messages:JSON.parse(JSON.stringify(r.messages)),prompts:r.prompts,loading:r.loading,headBackground:r.headBackground,background:r.background,positionLimit:r.positionLimit,sizeLimit:r.sizeLimit,userPhoto:r.userPhoto,logo:r.logo,name:r.name,placeholder:r.placeholder,startPosition:r.startPosition,scrollLoading:r.scrollLoading,scrollLoadingEnd:r.scrollLoadingEnd,alert:r.alert,models:r.models,model:r.model,isShow:r.isShow,shortcuts:r.shortcuts,onClear(){t("clear",...arguments)},onClose(){t("close",...arguments)},onSend(){t("send",...arguments)},onChoosePrompt(){t("choose-prompt",...arguments)},onStop(){t("stop",...arguments)},onScrollLoad(){t("scroll-load",...arguments)},onAiClick(){t("ai-click",...arguments)},onChangePrompt(){t("change-prompt",...arguments)},"onUpdate:model"(){t("update:model",...arguments)},"onUpdate:isShow"(){t("update:isShow",...arguments),t("showDialog",...arguments)},...r.$attrs}),n}}),this.unWatchStack=Object.keys(this.$props).map(i=>this.$watch(i,()=>{e.$forceUpdate()},{deep:!0})),this.setInputMessage=i=>{n.setInputMessage(i)}},mounted(){var t;(t=this.app)==null||t.mount(this.$el)},beforeDestroy(){var t;this.unWatchStack.forEach(e=>e==null?void 0:e()),(t=this.app)==null||t.unmount()}};return Yr.ChatHelper=Ole,Yr.MessageStatus=Td,Yr.RoleType=$T,Yr.default=Rle,Object.defineProperties(Yr,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),Yr}({});
|
|
343
|
+
`).forEach(p=>{const _=p.replace("data:","").trim();if(dee(_)){const{event:g,content:m,result:E,code:S,message:v}=JSON.parse(_);if(E===!1||o.status!==200){this.handleError(v,S,n);return}switch(g){case"text":this.handleReceiveMessage(m,n);break;case"done":this.handleEnd(n);break;case"error":this.handleError(v,S,n);break}}})}catch(s){(s==null?void 0:s.code)!==20&&this.handleError(s.message,s.code,n);break}}).catch(o=>{(o==null?void 0:o.code)!==20&&this.handleError(o.message,o.code,n)}),await this.handleStart(n)}}n6({prefix:"ai-blueking"});const Rle={name:"AiBlueking",render(t){return t("div",{style:{width:"100%"}})},props:{messages:{default:()=>[],type:Array},prompts:{default:()=>[],type:Array},loading:{default:!1,type:Boolean},headBackground:{default:"linear-gradient(267deg, #2dd1f4 0%, #1482ff 95%)",type:String},background:{default:"#f5f7fa",type:String},positionLimit:{default:()=>({top:0,bottom:0,left:0,right:0}),type:Object},sizeLimit:{default:()=>({height:320,width:400}),type:Object},startPosition:{default:()=>({top:window.innerHeight-560,bottom:0,left:window.innerWidth-400,right:0}),type:Object},userPhoto:{default:$I,type:String},logo:{default:"ai-blueking-icon ai-blueking-ai",type:String},name:{default:"",type:String},placeholder:{default:"",type:String},scrollLoading:{default:!1,type:Boolean},scrollLoadingEnd:{default:!0,type:Boolean},alert:{default:"",type:String},models:{default:void 0,type:Array},model:{default:"",type:String},isShow:{type:Boolean},shortcuts:{default:()=>WI,type:Array}},data(){return{app:null,unWatchStack:[]}},watch:{messages:{handler(){setTimeout(()=>{const t=document.querySelector(".ai-blueking-messages");(t==null?void 0:t.scrollTop)+(t==null?void 0:t.clientHeight)+100>=(t==null?void 0:t.scrollHeight)&&(t.scrollTop=t.scrollHeight)},10)},deep:!0}},created(){const t=this.$emit.bind(this);let e=null,n=null;const r=this;this.app=Fp({render(){return e=this,n=Kt(Nle,{messages:JSON.parse(JSON.stringify(r.messages)),prompts:r.prompts,loading:r.loading,headBackground:r.headBackground,background:r.background,positionLimit:r.positionLimit,sizeLimit:r.sizeLimit,userPhoto:r.userPhoto,logo:r.logo,name:r.name,placeholder:r.placeholder,startPosition:r.startPosition,scrollLoading:r.scrollLoading,scrollLoadingEnd:r.scrollLoadingEnd,alert:r.alert,models:r.models,model:r.model,isShow:r.isShow,shortcuts:r.shortcuts,onClear(){t("clear",...arguments)},onClose(){t("close",...arguments)},onSend(){t("send",...arguments)},onChoosePrompt(){t("choose-prompt",...arguments)},onStop(){t("stop",...arguments)},onScrollLoad(){t("scroll-load",...arguments)},onAiClick(){t("ai-click",...arguments)},onChangePrompt(){t("change-prompt",...arguments)},"onUpdate:model"(){t("update:model",...arguments)},"onUpdate:isShow"(){t("update:isShow",...arguments),t("showDialog",...arguments)},...r.$attrs}),n}}),this.unWatchStack=Object.keys(this.$props).map(i=>this.$watch(i,()=>{e.$forceUpdate()},{deep:!0})),this.setInputMessage=i=>{n.component.exposed.setInputMessage(i)}},mounted(){var t;(t=this.app)==null||t.mount(this.$el)},beforeDestroy(){var t;this.unWatchStack.forEach(e=>e==null?void 0:e()),(t=this.app)==null||t.unmount()}};return Yr.ChatHelper=Ole,Yr.MessageStatus=Td,Yr.RoleType=$T,Yr.default=Rle,Object.defineProperties(Yr,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),Yr}({});
|
|
@@ -259,4 +259,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
259
259
|
}
|
|
260
260
|
`);var s=/(^\d{1,4}[\.|\\/|-]\d{1,2}[\.|\\/|-]\d{1,4})(\s*(?:0?[1-9]:[0-5]|1(?=[012])\d:[0-5])\d\s*[ap]m)?$/,c=/\d{2}:\d{2}:\d{2} GMT-\d{4}/,u=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/,d=window.requestAnimationFrame||function(f){return f(),0},v={hoverPreviewEnabled:!1,hoverPreviewArrayCount:100,hoverPreviewFieldCount:5,animateOpen:!0,animateClose:!0,theme:null,useToJSON:!0,sortPropertiesBy:null};return function(){function f(g,p,A,h){p===void 0&&(p=1),A===void 0&&(A=v),this.json=g,this.open=p,this.config=A,this.key=h,this._isOpen=null,this.config.hoverPreviewEnabled===void 0&&(this.config.hoverPreviewEnabled=v.hoverPreviewEnabled),this.config.hoverPreviewArrayCount===void 0&&(this.config.hoverPreviewArrayCount=v.hoverPreviewArrayCount),this.config.hoverPreviewFieldCount===void 0&&(this.config.hoverPreviewFieldCount=v.hoverPreviewFieldCount),this.config.useToJSON===void 0&&(this.config.useToJSON=v.useToJSON),this.key===""&&(this.key='""')}return Object.defineProperty(f.prototype,"isOpen",{get:function(){return this._isOpen!==null?this._isOpen:this.open>0},set:function(g){this._isOpen=g},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"isDate",{get:function(){return this.json instanceof Date||this.type==="string"&&(s.test(this.json)||u.test(this.json)||c.test(this.json))},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"isUrl",{get:function(){return this.type==="string"&&this.json.indexOf("http")===0},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"isArray",{get:function(){return Array.isArray(this.json)},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"isObject",{get:function(){return n(this.json)},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"isEmptyObject",{get:function(){return!this.keys.length&&!this.isArray},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"isEmpty",{get:function(){return this.isEmptyObject||this.keys&&!this.keys.length&&this.isArray},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"useToJSON",{get:function(){return this.config.useToJSON&&this.type==="stringifiable"},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"hasKey",{get:function(){return this.key!==void 0},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"constructorName",{get:function(){return r(this.json)},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"type",{get:function(){return this.config.useToJSON&&this.json&&this.json.toJSON?"stringifiable":t(this.json)},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"keys",{get:function(){if(this.isObject){var g=Object.keys(this.json);return!this.isArray&&this.config.sortPropertiesBy?g.sort(this.config.sortPropertiesBy):g}return[]},enumerable:!0,configurable:!0}),f.prototype.toggleOpen=function(){this.isOpen=!this.isOpen,this.element&&(this.isOpen?this.appendChildren(this.config.animateOpen):this.removeChildren(this.config.animateClose),this.element.classList.toggle(l("open")))},f.prototype.openAtDepth=function(g){g===void 0&&(g=1),g<0||(this.open=g,this.isOpen=g!==0,this.element&&(this.removeChildren(!1),g===0?this.element.classList.remove(l("open")):(this.appendChildren(this.config.animateOpen),this.element.classList.add(l("open")))))},f.prototype.getInlinepreview=function(){var g=this;if(this.isArray)return this.json.length>this.config.hoverPreviewArrayCount?"Array["+this.json.length+"]":"["+this.json.map(o).join(", ")+"]";var p=this.keys,A=p.slice(0,this.config.hoverPreviewFieldCount).map(function(z){return z+":"+o(g.json[z])}),h=p.length>=this.config.hoverPreviewFieldCount?"…":"";return"{"+A.join(", ")+h+"}"},f.prototype.render=function(){this.element=a("div","row");var g=this.isObject?a("a","toggler-link"):a("span");if(this.isObject&&!this.useToJSON&&g.appendChild(a("span","toggler")),this.hasKey&&g.appendChild(a("span","key",this.key+":")),this.isObject&&!this.useToJSON){var p=a("span","value"),A=a("span"),h=a("span","constructor-name",this.constructorName);if(A.appendChild(h),this.isArray){var z=a("span");z.appendChild(a("span","bracket","[")),z.appendChild(a("span","number",this.json.length)),z.appendChild(a("span","bracket","]")),A.appendChild(z)}p.appendChild(A),g.appendChild(p)}else{(p=this.isUrl?a("a"):a("span")).classList.add(l(this.type)),this.isDate&&p.classList.add(l("date")),this.isUrl&&(p.classList.add(l("url")),p.setAttribute("href",this.json));var J=i(this.type,this.json,this.useToJSON?this.json.toJSON():this.json);p.appendChild(document.createTextNode(J)),g.appendChild(p)}if(this.isObject&&this.config.hoverPreviewEnabled){var E=a("span","preview-text");E.appendChild(document.createTextNode(this.getInlinepreview())),g.appendChild(E)}var T=a("div","children");return this.isObject&&T.classList.add(l("object")),this.isArray&&T.classList.add(l("array")),this.isEmpty&&T.classList.add(l("empty")),this.config&&this.config.theme&&this.element.classList.add(l(this.config.theme)),this.isOpen&&this.element.classList.add(l("open")),this.element.appendChild(g),this.element.appendChild(T),this.isObject&&this.isOpen&&this.appendChildren(),this.isObject&&!this.useToJSON&&g.addEventListener("click",this.toggleOpen.bind(this)),this.element},f.prototype.appendChildren=function(g){var p=this;g===void 0&&(g=!1);var A=this.element.querySelector("div."+l("children"));if(A&&!this.isEmpty)if(g){var h=0,z=function(){var J=p.keys[h],E=new f(p.json[J],p.open-1,p.config,J);A.appendChild(E.render()),(h+=1)<p.keys.length&&(h>10?z():d(z))};d(z)}else this.keys.forEach(function(J){var E=new f(p.json[J],p.open-1,p.config,J);A.appendChild(E.render())})},f.prototype.removeChildren=function(g){g===void 0&&(g=!1);var p=this.element.querySelector("div."+l("children"));if(g){var A=0,h=function(){p&&p.children.length&&(p.removeChild(p.children[0]),(A+=1)>10?h():d(h))};d(h)}else p&&(p.innerHTML="")},f}()})}},Ov={};function mt(e){var t=Ov[e];if(t!==void 0)return t.exports;var n=Ov[e]={exports:{}};return UL[e].call(n.exports,n,n.exports,mt),n.exports}mt.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return mt.d(t,{a:t}),t},mt.d=(e,t)=>{for(var n in t)mt.o(t,n)&&!mt.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},mt.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var Lv={};(()=>{mt.d(Lv,{default:()=>M});function e(x){"@babel/helpers - typeof";return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(y){return typeof y}:function(y){return y&&typeof Symbol=="function"&&y.constructor===Symbol&&y!==Symbol.prototype?"symbol":typeof y},e(x)}function t(x,y){if(e(x)!="object"||!x)return x;var O=x[Symbol.toPrimitive];if(O!==void 0){var W=O.call(x,y||"default");if(e(W)!="object")return W;throw new TypeError("@@toPrimitive must return a primitive value.")}return(y==="string"?String:Number)(x)}function n(x){var y=t(x,"string");return e(y)=="symbol"?y:String(y)}function r(x,y,O){return y=n(y),y in x?Object.defineProperty(x,y,{value:O,enumerable:!0,configurable:!0,writable:!0}):x[y]=O,x}var i=x=>{var y={};return mt.d(y,x),y};const o=i({Fragment:()=>P.Fragment,Transition:()=>P.Transition,computed:()=>P.computed,createVNode:()=>P.createVNode,defineComponent:()=>P.defineComponent,isVNode:()=>P.isVNode,onMounted:()=>P.onMounted,onUnmounted:()=>P.onUnmounted,reactive:()=>P.reactive,ref:()=>P.ref,render:()=>P.render,vShow:()=>P.vShow,watch:()=>P.watch,withDirectives:()=>P.withDirectives});var l=x=>{var y={};return mt.d(y,x),y};const a=l({PropTypes:()=>St,bkZIndexManager:()=>Ka,isElement:()=>i2});function s(x,y){var O=Object.keys(x);if(Object.getOwnPropertySymbols){var W=Object.getOwnPropertySymbols(x);y&&(W=W.filter(function(S){return Object.getOwnPropertyDescriptor(x,S).enumerable})),O.push.apply(O,W)}return O}function c(x){for(var y=1;y<arguments.length;y++){var O=arguments[y]!=null?arguments[y]:{};y%2?s(Object(O),!0).forEach(function(W){r(x,W,O[W])}):Object.getOwnPropertyDescriptors?Object.defineProperties(x,Object.getOwnPropertyDescriptors(O)):s(Object(O)).forEach(function(W){Object.defineProperty(x,W,Object.getOwnPropertyDescriptor(O,W))})}return x}var u={"top-left":[],"top-right":[],"bottom-left":[],"bottom-right":[]},d=1,v=function(y,O){var W=O,S=W.position||"top-right";typeof O=="string"&&(W={message:O});var w=O.onClose,C=W.offsetX||10,k=W.offsetY||30,Q=W,_=Q.spacing,ie=_===void 0?10:_;u[S].forEach(function(ne){k+=(ne.el.offsetHeight||0)+ie}),d+=1;var ue="message_".concat(d);W=c(c({},W),{},{offsetX:C,offsetY:k,id:ue});var D=document.createElement("div"),L=(0,o.createVNode)(y,W);L.props.onDestroy=function(ne){f(ne,S,ie,w),(0,o.render)(null,D)},L.props.onDetail=function(ne,fe){u[S].forEach(function(Ae){if(Ae.props.id!==fe){var xe;(xe=Ae.component)===null||xe===void 0||(xe=xe.exposed)===null||xe===void 0||xe.setDetailsShow(null,!1)}})},(0,o.render)(L,D),u[S].push(L);var R;L.props.getContainer&&(0,a.isElement)(L.props.getContainer)?R=L.props.getContainer:R=document.body,R.appendChild(D.firstElementChild)};function f(x,y,O,W){W==null||W();var S=y.startsWith("top")?"top":"bottom",w=-1;u[y].forEach(function(ue,D){ue.props.id===x&&(w=D)});for(var C=u[y][w],k=C.el.offsetHeight,Q=u[y].length,_=w;_<Q;_++){var ie=parseInt(u[y][_].el.style[S],10)-k-O;u[y][_].component.props.offsetY=ie}u[y].splice(w,1)}const g=v;function p(x,y){(y==null||y>x.length)&&(y=x.length);for(var O=0,W=new Array(y);O<y;O++)W[O]=x[O];return W}function A(x){if(Array.isArray(x))return p(x)}function h(x){if(typeof Symbol<"u"&&x[Symbol.iterator]!=null||x["@@iterator"]!=null)return Array.from(x)}function z(x,y){if(x){if(typeof x=="string")return p(x,y);var O=Object.prototype.toString.call(x).slice(8,-1);if(O==="Object"&&x.constructor&&(O=x.constructor.name),O==="Map"||O==="Set")return Array.from(x);if(O==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(O))return p(x,y)}}function J(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
261
261
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function E(x){return A(x)||h(x)||z(x)||J()}var T=mt(7647),B=mt.n(T),Y=mt(4346),$=mt.n(Y),re=x=>{var y={};return mt.d(y,x),y};const F=re({toType:()=>ct});var se=x=>{var y={};return mt.d(y,x),y};const ee=se({useLocale:()=>Ys,usePrefix:()=>Jt});var V=x=>{var y={};return mt.d(y,x),y};const U=V({AngleDoubleDownLine:()=>qM,AngleDoubleUpLine:()=>sj,Assistant:()=>Ej,Close:()=>bl,CopyShape:()=>p1,Error:()=>Up,FixLine:()=>sC,FixShape:()=>yC,Info:()=>EC,Success:()=>p5,Warn:()=>V5});function G(x,y){var O=Object.keys(x);if(Object.getOwnPropertySymbols){var W=Object.getOwnPropertySymbols(x);y&&(W=W.filter(function(S){return Object.getOwnPropertyDescriptor(x,S).enumerable})),O.push.apply(O,W)}return O}function Z(x){for(var y=1;y<arguments.length;y++){var O=arguments[y]!=null?arguments[y]:{};y%2?G(Object(O),!0).forEach(function(W){r(x,W,O[W])}):Object.getOwnPropertyDescriptors?Object.defineProperties(x,Object.getOwnPropertyDescriptors(O)):G(Object(O)).forEach(function(W){Object.defineProperty(x,W,Object.getOwnPropertyDescriptor(O,W))})}return x}var H;(function(x){x.PRIMARY="primary",x.WARNING="warning",x.SUCCESS="success",x.ERROR="error"})(H||(H={}));var te;(function(x){x.KEY_VALUE="key-value",x.JSON="json"})(te||(te={}));var ve;(function(x){x.ASSISTANT="assistant",x.DETAILS="details",x.FIX="fix",x.CLOSE="close"})(ve||(ve={}));var ce={id:a.PropTypes.string.def(""),message:(0,F.toType)("IMessage",{}),theme:(0,F.toType)("messageTheme",{}).def(H.PRIMARY),delay:a.PropTypes.number,dismissable:a.PropTypes.bool.def(!0),offsetY:a.PropTypes.number.def(30),spacing:a.PropTypes.number.def(10),extCls:a.PropTypes.string.def(""),onClose:a.PropTypes.func,getContainer:a.PropTypes.instanceOf(HTMLElement),width:a.PropTypes.oneOfType([a.PropTypes.number,a.PropTypes.string]),minWidth:a.PropTypes.oneOfType([a.PropTypes.number,a.PropTypes.string]).def(100),maxWidth:a.PropTypes.oneOfType([a.PropTypes.number,a.PropTypes.string]).def("100%"),actions:(0,F.toType)("IMessageAction",{})};const N=(0,o.defineComponent)({name:"Message",props:ce,emits:["destroy","detail"],setup:function(y,O){var W=this,S=O.emit,w=O.slots,C=O.expose,k=(0,ee.useLocale)("message"),Q=(0,ee.usePrefix)(),_=Q.resolveClassName,ie=(0,o.computed)(function(){return["".concat(_("message")),"".concat(_("message-".concat(y.theme))),"".concat(y.extCls)]}),ue=a.bkZIndexManager.getMessageNextIndex(),D=560,L=800,R=3e3,ne=8e3,fe=(0,o.computed)(function(){return/^\d+\.?\d*$/.test("".concat(y.delay))?y.delay:e(y.message)==="object"&&!(0,o.isVNode)(y.message)?ne:R}),Ae=function(we){return typeof y[we]=="number"?"".concat(y[we],"px"):y[we]},xe=(0,o.computed)(function(){var Qe={maxWidth:Ae("maxWidth"),minWidth:Ae("minWidth")},we=e(y.message)==="object"&&!(0,o.isVNode)(y.message);return/%$/.test("".concat(y.width))||/auto/gi.test("".concat(y.width))?Z({width:y.width},Qe):/^\d+/.test("".concat(y.width))?/^\d+\.?\d*$/.test("".concat(y.width))?Z({width:"".concat(y.width,"px")},Qe):Z({width:y.width},Qe):we?{width:"".concat(L,"px")}:{width:"".concat(D,"px")}}),Oe=(0,o.computed)(function(){return y.getContainer&&(0,a.isElement)(y.getContainer)}),Ee=(0,o.computed)(function(){return Object.assign({top:"".concat(y.offsetY,"px"),zIndex:ue,position:Oe.value?"absolute":"fixed"},xe.value)}),Ge=(0,o.ref)(null),$e=(0,o.ref)(null),Be=(0,o.ref)(null),nt=(0,o.ref)(!1),et=(0,o.reactive)({isFix:!1,isDetailShow:!1}),Ze=null,Fe=function(){Ze=setTimeout(function(){et.isFix||(nt.value=!1)},fe.value)},jt=function(we){we.preventDefault(),we.stopPropagation(),nt.value=!1},In,Ut=(0,o.ref)(null),Hn=function(we){var qe=we;if(e(we)==="object")try{qe=JSON.stringify(we)}catch(Ve){console.error("JSON.stringify Error: ".concat(Ve))}return qe},sr=function(){var we=new(B())(Be.value,{text:function(){return Hn(y.message.details)}});Vn(we)},Vn=function(we,qe){["success","error"].forEach(function(Ve){we.on(Ve,function(ht){var j=$e.value;if(Ut.value=Ve,j){var m,X,K=ht.trigger,le=K.offsetLeft,ye=K.offsetWidth,Me=K.offsetTop,pe=ht.trigger.closest(".message-tree"),ge=pe?pe.scrollTop:0;(m=j.classList).remove.apply(m,["success","error","is-hidden"]),(X=j.classList).add.apply(X,[Ve,"is-show"]);var He=le+ye/2-41,Le=Me-ge-40;j.style.setProperty("transform","translate(".concat(He,"px, ").concat(Le,"px")),In&&clearTimeout(In),In=setTimeout(function(){var Se,oe;(Se=j.classList).remove.apply(Se,["is-show"]),(oe=j.classList).add.apply(oe,["is-hidden"])},2e3)}})})},Cr=function(){var we=new(B())(Ge.value.querySelectorAll("span.copy-value"),{text:function(Ve){return Ve.innerHTML}});Vn(we)},Rn=function(we){var qe=we;if(typeof we=="string")try{qe=JSON.parse(we)}catch(Ve){console.error("Format Json Error: ".concat(Ve))}return qe},cr=function(we,qe){if(et.isDetailShow=qe??!et.isDetailShow,ur(we,et.isDetailShow),et.isDetailShow&&e(y.message)==="object"&&!(0,o.isVNode)(y.message)){if(y.message.type===te.JSON||!y.message.type){var Ve=Rn(y.message.details),ht=new($())(Ve);setTimeout(function(){Ge.value&&(Ge.value.innerHTML="",Ge.value.append(ht.render())),sr()})}y.message.type===te.KEY_VALUE&&setTimeout(function(){sr(),Cr()}),S("detail",et.isDetailShow,y.id)}},ur=function(we,qe){et.isFix=qe??!et.isFix},Li=function(){var we=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,qe=e(y.message)==="object"&&!(0,o.isVNode)(y.message);if(qe){if(we){document.removeEventListener("keydown",dr);return}document.addEventListener("keydown",dr)}},dr=function(we){we.altKey&&we.keyCode===80&&ur()};(0,o.onMounted)(function(){fe.value&&Fe(),nt.value=!0,Li()}),(0,o.onUnmounted)(function(){clearTimeout(Ze),Li(!0)}),(0,o.watch)(nt,function(){nt.value||S("destroy",y.id)});var Pi=function(we){clearTimeout(Ze)},Di=function(we){fe.value&&Fe()},Nr=function(we){y.message.assistant&&window.open(y.message.assistant,"_blank")},Yn=(0,o.computed)(function(){return r(r(r(r({},ve.ASSISTANT,{id:ve.ASSISTANT,icon:function(){return(0,o.createVNode)(U.Assistant,null,null)},text:function(){return k.value.assistant},onClick:function(we){return Nr()}}),ve.DETAILS,{id:ve.DETAILS,icon:function(){return et.isDetailShow?(0,o.createVNode)(U.AngleDoubleUpLine,null,null):(0,o.createVNode)(U.AngleDoubleDownLine,null,null)},text:function(){return k.value.details},onClick:function(we){return cr(we)}}),ve.FIX,{id:ve.FIX,icon:function(){return et.isFix?(0,o.createVNode)(U.FixShape,null,null):(0,o.createVNode)(U.FixLine,null,null)},classList:et.isFix?"fixed":"",onClick:function(we){return ur()}}),ve.CLOSE,{id:ve.CLOSE,classList:"normal-color",icon:function(){return y.dismissable&&(0,o.createVNode)(U.Error,{class:"".concat(_("message-close")),onClick:jt},null)},onClick:jt})}),Qi=[ve.ASSISTANT,ve.DETAILS,ve.FIX,ve.CLOSE],ha=(0,o.computed)(function(){var Qe;if(((Qe=y.actions)===null||Qe===void 0?void 0:Qe.length)>0){var we=y.actions.map(function(Ve){var ht=Ve.id.toLocaleLowerCase(),j=Yn.value[ht],m=j==null?void 0:j.onClick,X=Object.assign({},Yn.value[ht]||{},Ve);if(X.id=ht,Ve.classList!==void 0){var K=Array.isArray(Ve.classList)?Ve.classList:[Ve.classList],le=[];j.classList!==void 0&&(le=Array.isArray(j.classList)?j.classList:[j.classList]),X.classList=[].concat(E(le),E(K))}return typeof Ve.onClick=="function"?(X.onClick=function(){var ye=Reflect.apply(Ve.onClick,W,[]);(e(ye)===void 0||ye)&&typeof m=="function"&&Reflect.apply(m,W,[])},X):(X.onClick=m,X)}),qe=Qi.filter(function(Ve){return!we.some(function(ht){return ht.id===Ve})}).map(function(Ve){return Yn.value[Ve]});return we.push.apply(we,E(qe)),we}return Qi.map(function(Ve){return Yn.value[Ve]})}),zi=function(){var we,qe,Ve=function(K){var le=K.icon;return typeof le=="function"?Reflect.apply(le,W,[]):(0,o.createVNode)("span",{class:le},null)},ht=function(K){var le=K.text,ye=void 0;if(typeof le=="function"&&(ye=Reflect.apply(le,W,[])),ye!==void 0)return typeof ye=="string"?(0,o.createVNode)("span",{class:"message-action-text"},[ye]):ye},j=function(K,le){le.readonly||le.disabled||typeof le.onClick=="function"&&Reflect.apply(le.onClick,W,[K,le])},m=function(){return ha.value.map(function(K){if(K.disabled)return null;if(typeof K.render=="function")return Reflect.apply(K.render,W,[]);var le=Array.isArray(K.classList)?K.classList.join(" "):K.classList;return(0,o.createVNode)("span",{class:["tool",K.id,le],onClick:function(Me){return j(Me,K)}},[Ve(K),ht(K)])})};return(we=(qe=w.action)===null||qe===void 0?void 0:qe.call(w))!==null&&we!==void 0?we:m()};return C({setDetailsShow:cr}),{classNames:ie,styles:Ee,visible:nt,close:jt,setDetailsShow:cr,fixMesage:ur,copyMessage:sr,parseToJson:Rn,handleMouseenter:Pi,handleMouseleave:Di,renderMessageActions:zi,refJsonContent:Ge,refCopyStatus:$e,refCopyMsgDiv:Be,toolOperation:et,copyStatus:Ut,t:k,resolveClassName:_,copyValueItem:Cr}},render:function(){var y=this,O=function(C){var k={primary:(0,o.createVNode)(U.Info,null,null),warning:(0,o.createVNode)(U.Warn,null,null),success:(0,o.createVNode)(U.Success,null,null),error:(0,o.createVNode)(U.Close,null,null)};return k[C??y.theme]},W=function(C){if(C.type===te.KEY_VALUE){var k=y.parseToJson(C.details||{}),Q=Object.keys(k);return Q.map(function(_){return(0,o.createVNode)("div",{class:"message-row"},[(0,o.createVNode)("label",null,[_]),(0,o.createVNode)("span",{class:"copy-value"},[k[_]])])})}},S=function(){if(e(y.message)==="object"&&!(0,o.isVNode)(y.message)){var C,k,Q;return(0,o.createVNode)("div",{class:"".concat(y.resolveClassName("message-content")," multi")},[(0,o.createVNode)("div",{class:"overview"},[(0,o.createVNode)("div",{class:"left-content"},[(0,o.createVNode)("div",{class:"".concat(y.resolveClassName("message-icon"))},[O()]),(0,o.createVNode)("div",{class:"describe"},[(C=(k=(Q=y.$slots).title)===null||k===void 0?void 0:k.call(Q))!==null&&C!==void 0?C:"【".concat(y.message.code,"】").concat(y.message.overview," ").concat(y.message.suggestion)])]),(0,o.createVNode)("div",{class:"tools"},[y.renderMessageActions()])]),y.toolOperation.isDetailShow&&(0,o.createVNode)("div",{class:"message-detail"},[(0,o.createVNode)("div",{class:"message-copy",ref:"refCopyMsgDiv"},[(0,o.createVNode)(U.CopyShape,null,null)]),(0,o.createVNode)("div",{class:"copy-status",ref:"refCopyStatus"},[(0,o.createVNode)("div",{class:"inner"},[O(y.copyStatus),y.copyStatus==="success"?y.t.copySuccess:y.t.copyFailed])]),(0,o.createVNode)("div",{ref:"refJsonContent",class:"message-tree"},[W(y.message)])])])}return(0,o.createVNode)(o.Fragment,null,[(0,o.createVNode)("div",{class:"".concat(y.resolveClassName("message-content"))},[(0,o.createVNode)("div",{class:"".concat(y.resolveClassName("message-icon"))},[O()]),y.message]),y.dismissable&&(0,o.createVNode)(U.Error,{class:"".concat(y.resolveClassName("message-close")),onClick:y.close},null)])};return(0,o.createVNode)(o.Transition,{name:"bk-message-fade"},{default:function(){return[(0,o.withDirectives)((0,o.createVNode)("div",{class:y.classNames,style:y.styles,onMouseenter:y.handleMouseenter,onMouseleave:y.handleMouseleave},[S()]),[[o.vShow,y.visible]])]}})}});var I=function(y){g(N,y)};const M=I})();var Pv=Lv.default;function Dv(){const e=b.ref(!1),t=()=>{const o=document.querySelector(".ai-blueking-messages");o.scrollTop=o.scrollHeight},n=o=>{const l=o.target;e.value=l.scrollTop<l.scrollHeight-l.clientHeight-20},r=()=>{const o=document.querySelector(".ai-blueking-messages");o==null||o.addEventListener("scroll",n,{passive:!0})},i=()=>{const o=document.querySelector(".ai-blueking-messages");o==null||o.removeEventListener("scroll",n)};return b.onMounted(r),b.onBeforeUnmount(i),{isShow:e,scrollToBottom:t}}const ma=b.ref(""),xu=b.ref(!1);function Mu(){const e=b.ref(!1),t=b.ref({top:"0px",left:"0px"});let n;const r=()=>{clearTimeout(n),n=setTimeout(()=>{const a=window.getSelection();if(a&&a.toString().trim().length>0){xu.value=!1;const c=a.getRangeAt(0).getBoundingClientRect(),u=window.innerWidth;ma.value=a.toString().trim();const d=80,v=34,f=10;let g=c.left+window.scrollX+c.width/2-d/2;g=Math.max(f,Math.min(g,u-d-f));let p=c.top+window.scrollY-v-f;c.top>v+f||(p=c.bottom+window.scrollY+f),t.value={top:`${p}px`,left:`${g}px`},e.value=!0}else i()},300)},i=()=>{e.value=!1,xu.value||(ma.value="")},o=()=>{const a=window.getSelection();a&&a.removeAllRanges(),ma.value=""},l=a=>{ma.value=a};return b.onMounted(()=>{document.addEventListener("selectionchange",r)}),b.onBeforeUnmount(()=>{document.removeEventListener("selectionchange",r),clearTimeout(n)}),{isIconVisible:e,iconPosition:t,selectedText:ma,hideIcon:i,clearSelection:o,setSelection:l,lockSelectedText:xu}}const KL=e=>{const t=document.cookie.match(new RegExp(`(^| )${e}=([^;]*)(;|$)`));return t?t[2]:""},XL=e=>{try{return JSON.parse(e),!0}catch{return!1}},qL=(e,t=200)=>{let n=!0;return function(r){if(!n)return!1;n=!1,setTimeout(()=>{e(r),n=!0},t)}},_L=KL("blueking_language")||"zh-cn",eP={小鲸:"BK GPT",向下收缩:"shrink down",向上扩展:"expand upward",清空聊天记录:"Empty chat records",关闭:"close","内容正在执行中,请执行完成后再发送":"The content is being executed, please send it after the execution is completed.",发送:"Send","您可以键入 “/” 查看更多Prompt":'You can type "/" to see more Prompts',请输入:"Please input",返回最新:"Latest",终止生成:"Stop",向上滚动加载更多记录:"Scroll up to load more records",日:" sunday",一:" monday",二:" tuesday",三:" wednesday",四:" thursday",五:" friday",六:" saturday",昨天:"yesterday",本周:"this week",上周:"last week",复制成功:"Copy success",您选择的文本内容:"The text content you selected",问小鲸:"Ask BK GPT",想对选中的文本做什么:"What do you want to do with the selected text?"},tt=e=>_L!=="en"?e:eP[e]||e,tP={class:"ai-cite"},nP={class:"ai-cite-text"},rP={class:"ai-cite-tips"},iP=b.defineComponent({__name:"ai-cite",props:{text:{},showCloseIcon:{type:Boolean}},emits:["close"],setup(e){return(t,n)=>b.withDirectives((b.openBlock(),b.createElementBlock("section",tP,[b.createElementVNode("span",nP,b.toDisplayString(t.text),1),b.createElementVNode("span",rP,b.toDisplayString(b.unref(tt)("您选择的文本内容")),1),t.showCloseIcon?(b.openBlock(),b.createElementBlock("i",{key:0,class:"ai-blueking-icon ai-blueking-close-circle-fill",onClick:n[0]||(n[0]=r=>t.$emit("close"))})):b.createCommentVNode("v-if",!0)],512)),[[b.vShow,t.text]])}}),wn=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},Qv=wn(iP,[["__scopeId","data-v-3fd96961"]]),oP=(e=>(b.pushScopeId("data-v-a8d839da"),e=e(),b.popScopeId(),e))(()=>b.createElementVNode("i",{class:"ai-blueking-icon ai-blueking-xiangxia-2"},null,-1)),aP=wn(b.defineComponent({__name:"render-back",setup(e){const{isShow:t,scrollToBottom:n}=Dv();return(r,i)=>b.unref(t)?(b.openBlock(),b.createElementBlock("span",{key:0,class:"ai-blueking-render-back",onClick:i[0]||(i[0]=(...o)=>b.unref(n)&&b.unref(n)(...o))},[oP,b.createTextVNode(" "+b.toDisplayString(b.unref(tt)("返回最新")),1)])):b.createCommentVNode("v-if",!0)}}),[["__scopeId","data-v-a8d839da"]]);var ju=(e=>(e.Assistant="assistant",e.Cite="cite",e.System="system",e.User="user",e))(ju||{}),ya=(e=>(e.Error="error",e.Loading="loading",e.Success="success",e))(ya||{});const lP=wn(b.defineComponent({__name:"ai-avatar",props:{size:{default:36}},setup(e){const t=e,n=b.computed(()=>({minWidth:`${t.size}px`,maxWidth:`${t.size}px`,minHeight:`${t.size}px`,maxHeight:`${t.size}px`,padding:`${t.size*.208}px ${t.size*.222}px ${t.size*.194}px ${t.size*.18}px`})),r=b.computed(()=>({fontSize:`${t.size*.611}px`}));return(i,o)=>(b.openBlock(),b.createElementBlock("span",{style:b.normalizeStyle(n.value),class:"message-photo ai"},[b.createElementVNode("i",{style:b.normalizeStyle(r.value),class:"ai-blueking-icon ai-blueking-ai"},null,4)],4))}}),[["__scopeId","data-v-c3781e8b"]]),sP={key:0,class:"ai-cite-container"},cP={class:"message-content-container"},uP={class:"message-content user"},dP={key:0,class:"time-message user"},fP=["innerHTML"],pP={class:"message-photo user"},gP=["src"],bP={class:"message-content ai"},vP={key:0,class:"time-message ai"},mP={key:2,width:"18",height:"18",class:"loading-message","aria-hidden":"true"},yP=[b.createElementVNode("use",{"xlink:href":"#ai-blueking-quanquan"},null,-1)],hP={key:3,class:"message-wrap"},AP=["innerHTML"],wP=b.defineComponent({__name:"render-message",props:{message:{},userPhoto:{default:Bu}},setup(e){const t=new nm({html:!0,highlight:function(l,a){if(a&&Eu.getLanguage(a))try{return Eu.highlight(l,{language:a}).value}catch{}return""}}).use(rm,{iconClass:"ai-blueking-icon ai-blueking-copy",buttonClass:"ai-blueking-copy-button"}),n=e,r=b.computed(()=>{var a;const l={error:"ai-blueking-icon ai-blueking-warning-circle-fill",loading:"",success:""};return(a=n.message)!=null&&a.status?l[n.message.status]:""}),i=b.computed(()=>n.message.content?t.render(n.message.content):""),o=b.computed(()=>{const l=_t(n.message.time),a=_t();return n.message.time?a.isSame(l,"year")?l.format("MM-DD HH:mm:ss"):l.format("YYYY-MM-DD HH:mm:ss"):""});return(l,a)=>(b.openBlock(),b.createElementBlock("li",{class:b.normalizeClass([l.message.role,"message-main"])},[l.message.cite?(b.openBlock(),b.createElementBlock("div",sP,[b.createVNode(Qv,{text:l.message.cite},null,8,["text"])])):b.createCommentVNode("v-if",!0),b.createElementVNode("div",cP,[l.message.role===b.unref(ju).User?(b.openBlock(),b.createElementBlock(b.Fragment,{key:0},[b.createElementVNode("p",uP,[o.value?(b.openBlock(),b.createElementBlock("span",dP,b.toDisplayString(o.value),1)):b.createCommentVNode("v-if",!0),b.createElementVNode("span",{class:"markdown-message",innerHTML:i.value},null,8,fP)]),b.createElementVNode("span",pP,[b.createElementVNode("img",{src:l.userPhoto},null,8,gP)])],64)):(b.openBlock(),b.createElementBlock(b.Fragment,{key:1},[b.createVNode(lP),b.createElementVNode("p",bP,[o.value?(b.openBlock(),b.createElementBlock("span",vP,b.toDisplayString(o.value),1)):b.createCommentVNode("v-if",!0),r.value?(b.openBlock(),b.createElementBlock("i",{key:1,class:b.normalizeClass(r.value)},null,2)):b.createCommentVNode("v-if",!0),l.message.status===b.unref(ya).Loading?(b.openBlock(),b.createElementBlock("svg",mP,yP)):b.createCommentVNode("v-if",!0),l.message.status===b.unref(ya).Error?(b.openBlock(),b.createElementBlock("span",hP,b.toDisplayString(l.message.content),1)):(b.openBlock(),b.createElementBlock("span",{key:4,innerHTML:i.value,class:b.normalizeClass({"markdown-message":!0,loading:l.message.status===b.unref(ya).Loading})},null,10,AP))])],64))])],2))}}),IP={class:"prompt-list"},kP={class:"search-group"},xP=["onClick"],MP={class:"prompt-content"},jP=wn(b.defineComponent({__name:"render-send",props:{prompts:{},placeholder:{},value:{}},emits:["change-prompt","update:value","enter","choose-prompt"],setup(e,{emit:t}){const n=e,r=t,i=Vb,o=fa,{selectedText:l,lockSelectedText:a}=Mu(),s=b.ref(""),c=b.ref(40),u=b.ref(),d=b.ref(!1),v=b.computed(()=>{var $;return(($=n.prompts)==null?void 0:$.filter(re=>re.content.includes(s.value)))||[]}),f=b.computed(()=>{var $;return n.placeholder?n.placeholder:($=n.prompts)!=null&&$.length?tt("您可以键入 “/” 查看更多Prompt"):tt("请输入")}),g=$=>{r("update:value",$),r("change-prompt",$)},p=()=>{var $;n.value==="/"&&(($=n.prompts)!=null&&$.length)?B():Y()},A=()=>{b.nextTick(()=>{var re;const $=(re=u.value)==null?void 0:re.$el.querySelector("textarea");($==null?void 0:$.scrollHeight)>40&&n.value?c.value=$.scrollHeight<=300?$.scrollHeight:300:c.value=40})},h=$=>{r("update:value",$.content),r("choose-prompt",$),Y(),E()},z=($,re)=>{re.key==="Enter"&&!re.shiftKey&&(re.preventDefault(),r("enter"))},J=()=>{g("")},E=()=>{var re;const $=(re=u.value)==null?void 0:re.$el.querySelector("textarea");$==null||$.focus()},T=()=>{l.value&&(a.value=!0)},B=()=>{d.value=!0},Y=()=>{d.value=!1};return b.watch(()=>n.value,()=>{A(),p()}),b.onMounted(E),($,re)=>(b.openBlock(),b.createBlock(b.unref(Xc),{width:"calc(100% - 118px)","ext-cls":"empty-padding",arrow:!1,"is-show":d.value,"popover-delay":0,boundary:"parent",placement:"bottom",theme:"light",trigger:"manual"},{content:b.withCtx(()=>{var F;return[b.createElementVNode("div",null,[b.withDirectives((b.openBlock(),b.createElementBlock("section",IP,[b.createVNode(b.unref(fu),{class:"input-search",modelValue:s.value,"onUpdate:modelValue":re[0]||(re[0]=se=>s.value=se),behavior:"simplicity",clearable:""},null,8,["modelValue"]),b.createElementVNode("section",kP,[(b.openBlock(!0),b.createElementBlock(b.Fragment,null,b.renderList(v.value,(se,ee)=>b.withDirectives((b.openBlock(),b.createElementBlock("span",{class:"group-prompt",key:ee,onClick:V=>h(se)},[b.createElementVNode("span",MP,b.toDisplayString(se.content),1)],8,xP)),[[b.unref(o),{content:se.content,placement:"right",theme:"light",width:300,boundary:"parent"}]])),128)),(F=v.value)!=null&&F.length?b.createCommentVNode("v-if",!0):(b.openBlock(),b.createBlock(b.unref(_6),{key:0,class:"exception-wrap-item exception-part",scene:"part",type:"search-empty"}))])])),[[b.unref(i),Y]])])]}),default:b.withCtx(()=>[b.createElementVNode("section",{style:b.normalizeStyle({"--text-height":c.value+"px"}),class:"send-prompt-container"},[b.createVNode(b.unref(fu),{ref_key:"inputRef",ref:u,class:"send-prompt",autosize:!1,clearable:!0,"model-value":$.value,"native-attributes":{autofocus:"autofocus"},placeholder:f.value,row:"1",type:"textarea",onFocus:T,onInput:g,onKeydown:z},null,8,["model-value","placeholder"]),$.value?(b.openBlock(),b.createBlock(b.unref(bl),{key:0,class:"show-clear-only-hover bk-input--clear-icon clear-icon",onClick:J})):b.createCommentVNode("v-if",!0)],4)]),_:1},8,["is-show"]))}}),[["__scopeId","data-v-f75335eb"]]),CP={class:"ai-shortcuts"},NP=wn(b.defineComponent({__name:"render-shortcuts",props:{shortcuts:{}},emits:["select"],setup(e,{emit:t}){const n=t,r=i=>{n("select",i)};return(i,o)=>(b.openBlock(),b.createElementBlock("ul",CP,[(b.openBlock(!0),b.createElementBlock(b.Fragment,null,b.renderList(i.shortcuts,l=>(b.openBlock(),b.createBlock(b.unref(Nv),{class:"ai-blueking-shortcut",key:l.label,theme:"info",onClick:a=>r(l)},{default:b.withCtx(()=>[b.createTextVNode(b.toDisplayString(l.label),1)]),_:2},1032,["onClick"]))),128))]))}}),[["__scopeId","data-v-266e17ca"]]),SP=(e=>(b.pushScopeId("data-v-fd57f18d"),e=e(),b.popScopeId(),e))(()=>b.createElementVNode("svg",{width:"10",height:"10",class:"ai-blueking-render-stop-icon","aria-hidden":"true"},[b.createElementVNode("use",{"xlink:href":"#ai-blueking-tingzhi"})],-1)),TP=wn(b.defineComponent({__name:"render-stop",props:{isShow:{type:Boolean}},emits:["stop"],setup(e,{emit:t}){const n=t,r=()=>{n("stop")};return(i,o)=>i.isShow?(b.openBlock(),b.createElementBlock("span",{key:0,class:"ai-blueking-render-stop",onClick:r},[SP,b.createTextVNode(" "+b.toDisplayString(b.unref(tt)("终止生成")),1)])):b.createCommentVNode("v-if",!0)}}),[["__scopeId","data-v-fd57f18d"]]),OP={key:0,class:"time-wrapper"},LP={class:"time-message"},PP=wn(b.defineComponent({__name:"render-time",props:{message:{}},setup(e){const t=e,n=b.computed(()=>{var l;const r=_t(t.message.time),i=_t(),o={0:tt("日"),1:tt("一"),2:tt("二"),3:tt("三"),4:tt("四"),5:tt("五"),6:tt("六")};return!t.message.time||(l=window.showTimes)!=null&&l.some(a=>Math.abs(r.diff(a,"minute"))<10&&a!==t.message.time)?"":(window.showTimes=[...window.showTimes||[],t.message.time],i.isSame(r,"day")?r.format("HH:mm:ss"):i.subtract(1,"day").isSame(r,"week")?tt("昨天")+" "+r.format("HH:mm:ss"):i.isSame(r,"week")?tt("本周")+o[r.day()]+" "+r.format("HH:mm:ss"):i.subtract(1,"week").isSame(r,"week")?tt("上周")+o[r.day()]+" "+r.format("HH:mm:ss"):i.isSame(r,"year")?r.format("MM-DD HH:mm:ss"):r.format("YYYY-MM-DD HH:mm:ss"))});return(r,i)=>n.value?(b.openBlock(),b.createElementBlock("section",OP,[b.createElementVNode("span",LP,b.toDisplayString(n.value),1)])):b.createCommentVNode("v-if",!0)}}),[["__scopeId","data-v-55c9a119"]]),zv=e=>(b.pushScopeId("data-v-de79ff73"),e=e(),b.popScopeId(),e),DP={key:0,width:"18",height:"18",class:"scroll-loading-icon","aria-hidden":"true"},QP=[zv(()=>b.createElementVNode("use",{"xlink:href":"#ai-blueking-loading-2"},null,-1))],zP={class:"ai-operation"},JP={class:"ai-operation-input-wrapper"},EP={class:"ai-cite-tips"},GP={class:"ai-operation-input"},BP=zv(()=>b.createElementVNode("i",{class:"ai-blueking-icon ai-blueking-fasong"},null,-1)),ZP=wn(b.defineComponent({__name:"render-content",props:{messages:{},prompts:{},loading:{type:Boolean},background:{default:"#f5f7fa"},userPhoto:{},placeholder:{},scrollLoading:{type:Boolean},scrollLoadingEnd:{type:Boolean,default:!0},alert:{},shortcuts:{default:()=>Zu}},emits:["ai-click","change-prompt","send","choose-prompt","scroll-load","stop"],setup(e,{expose:t,emit:n}){const r=e,i=n,o=fa,l=b.ref(""),{selectedText:a,clearSelection:s}=Mu(),{isShow:c}=Dv(),u=()=>{b.nextTick(()=>{const T=document.querySelector(".ai-blueking-messages");T.scrollTop=T.scrollHeight})},d=qL(T=>{if(r.scrollLoading||r.scrollLoadingEnd)return;T.target.scrollTop<200&&i("scroll-load")}),v=()=>{if(l.value){if(r.loading){Pv({theme:"warning",message:tt("内容正在执行中,请执行完成后再发送")});return}i("send",{content:l.value,cite:a.value}),l.value="",a.value=""}},f=T=>{i("choose-prompt",T)},g=T=>{i("change-prompt",T)},p=()=>{i("stop")},A=T=>{const B=T.target;if(B!=null&&B.classList.contains("ai-blueking-angle-up")){const Y=B==null?void 0:B.parentElement;Y!=null&&Y.classList.contains("closed")?Y==null||Y.classList.remove("closed"):Y==null||Y.classList.add("closed")}B!=null&&B.classList.contains("ai-clickable")&&i("ai-click",B.dataset.ai)},h=()=>{u(),document.addEventListener("click",A)},z=()=>{window.showTimes=[],document.removeEventListener("click",A)},J=T=>{l.value=T},E=T=>{const B=T.prompt.replace("{{ SELECTED_TEXT }}",a.value);if(r.loading){Pv({theme:"warning",message:tt("内容正在执行中,请执行完成后再发送")});return}i("send",{content:T.label,cite:a.value,prompt:B}),a.value=""};return b.watch(()=>r.messages,()=>{const T=document.querySelector(".ai-blueking-messages");(T==null?void 0:T.scrollTop)+(T==null?void 0:T.clientHeight)+100>=(T==null?void 0:T.scrollHeight)&&u()},{deep:!0}),b.onMounted(h),b.onBeforeUnmount(z),t({setInputMessage:J}),(T,B)=>(b.openBlock(),b.createElementBlock("section",{style:b.normalizeStyle({background:T.background}),class:"ai-content"},[T.alert?(b.openBlock(),b.createBlock(b.unref(e3),{key:0,title:T.alert,theme:"warning",closable:""},null,8,["title"])):b.createCommentVNode("v-if",!0),b.createElementVNode("ul",{class:"ai-messages ai-blueking-messages",onScrollPassive:B[0]||(B[0]=(...Y)=>b.unref(d)&&b.unref(d)(...Y))},[T.scrollLoading?(b.openBlock(),b.createElementBlock("svg",DP,QP)):b.createCommentVNode("v-if",!0),(b.openBlock(!0),b.createElementBlock(b.Fragment,null,b.renderList(T.messages,Y=>(b.openBlock(),b.createElementBlock(b.Fragment,{key:Y.content},[b.createVNode(PP,{class:"render-message",message:Y},null,8,["message"]),b.createVNode(wP,{class:"render-message",message:Y,"user-photo":T.userPhoto},null,8,["message","user-photo"])],64))),128))],32),b.createElementVNode("section",zP,[b.createElementVNode("section",{class:"ai-operation-tools",onMousedown:B[1]||(B[1]=b.withModifiers(()=>{},["prevent"]))},[b.createVNode(aP),b.createVNode(TP,{"is-show":T.loading,onStop:p},null,8,["is-show"])],32),b.createElementVNode("section",JP,[b.unref(a)?(b.openBlock(),b.createElementBlock("div",{key:0,class:b.normalizeClass(["ai-cite-container",{"is-back-show":!b.unref(c)}]),onMousedown:B[2]||(B[2]=b.withModifiers(()=>{},["prevent"]))},[b.createVNode(Qv,{"show-close-icon":!0,text:b.unref(a),onClose:b.unref(s)},null,8,["text","onClose"]),b.createElementVNode("span",EP,b.toDisplayString(b.unref(tt)("想对选中的文本做什么")),1),b.createVNode(NP,{shortcuts:T.shortcuts,onSelect:E},null,8,["shortcuts"])],34)):b.createCommentVNode("v-if",!0),b.createElementVNode("section",GP,[b.createVNode(jP,{value:l.value,"onUpdate:value":B[3]||(B[3]=Y=>l.value=Y),placeholder:T.placeholder,prompts:T.prompts,onChangePrompt:g,onChoosePrompt:f,onEnter:v},null,8,["value","placeholder","prompts"]),b.withDirectives((b.openBlock(),b.createBlock(b.unref(x3),{class:"ai-operation-button",disabled:T.loading||!l.value,size:"large",theme:"primary",onClick:v},{default:b.withCtx(()=>[BP,b.createTextVNode(" "+b.toDisplayString(b.unref(tt)("发送")),1)]),_:1},8,["disabled"])),[[b.unref(o),{content:b.unref(tt)("内容正在执行中,请执行完成后再发送"),disabled:!T.loading}]])])])])],4))}}),[["__scopeId","data-v-de79ff73"]]),HP={class:"ai-modal-header-icon"},VP=wn(b.defineComponent({__name:"render-modal",props:{headBackground:{default:"linear-gradient(267deg, #2dd1f4 0%, #1482ff 95%)"},positionLimit:{default:()=>({top:0,bottom:0,left:0,right:0})},sizeLimit:{default:()=>({height:320,width:400})},logo:{default:"ai-blueking-icon ai-blueking-ai"},name:{},startPosition:{default:()=>({top:window.innerHeight-560,bottom:0,left:window.innerWidth-400,right:0})},models:{},model:{}},emits:["clear","close","choose-model"],setup(e,{emit:t}){const n=e,r=t,i=fa,o={height:window.innerHeight,width:window.innerWidth},l={isMove:!1,type:"",clientX:0,clientY:0},a=()=>{var U,G,Z,H;const V=(te,ve)=>te===void 0?ve:te;return{top:V((U=n.startPosition)==null?void 0:U.top,o.height-n.sizeLimit.height),bottom:V((G=n.startPosition)==null?void 0:G.bottom,0),left:V((Z=n.startPosition)==null?void 0:Z.left,0),right:V((H=n.startPosition)==null?void 0:H.right,o.width-n.sizeLimit.width)}},s=b.ref(a()),c=b.computed(()=>s.value.top<=n.positionLimit.top&&s.value.bottom<=n.positionLimit.bottom),u=V=>{r("choose-model",V)},d=V=>{l.isMove=!0,l.type="move",l.clientX=V.clientX,l.clientY=V.clientY},v=V=>{l.isMove=!0,l.type="rightDrag",l.clientX=V.clientX},f=V=>{l.isMove=!0,l.type="leftDrag",l.clientX=V.clientX},g=V=>{l.isMove=!0,l.type="topDrag",l.clientY=V.clientY},p=V=>{l.isMove=!0,l.type="bottomDrag",l.clientY=V.clientY},A=V=>{l.isMove=!0,l.type="topLeftDrag",l.clientY=V.clientY,l.clientX=V.clientX},h=V=>{l.isMove=!0,l.type="topRightDrag",l.clientY=V.clientY,l.clientX=V.clientX},z=V=>{l.isMove=!0,l.type="bottomLeftDrag",l.clientY=V.clientY,l.clientX=V.clientX},J=V=>{l.isMove=!0,l.type="bottomRightDrag",l.clientY=V.clientY,l.clientX=V.clientX},E=()=>{l.isMove=!1},T=(V,U)=>{["move","leftDrag"].includes(l.type)&&(s.value.left+=V),["move","rightDrag"].includes(l.type)&&(s.value.right-=V),["move","topDrag"].includes(l.type)&&(s.value.top+=U),["move","bottomDrag"].includes(l.type)&&(s.value.bottom-=U),["topLeftDrag"].includes(l.type)&&(s.value.left+=V,s.value.top+=U),["topRightDrag"].includes(l.type)&&(s.value.right-=V,s.value.top+=U),["bottomLeftDrag"].includes(l.type)&&(s.value.left+=V,s.value.bottom-=U),["bottomRightDrag"].includes(l.type)&&(s.value.right-=V,s.value.bottom-=U)},B=(V,U)=>{const{top:G,bottom:Z,left:H,right:te}=s.value;(o.width-H-te<n.sizeLimit.width||H<n.positionLimit.left||te<n.positionLimit.right)&&(["move","leftDrag","topLeftDrag","bottomLeftDrag"].includes(l.type)&&(s.value.left-=V),["move","rightDrag","topRightDrag","bottomRightDrag"].includes(l.type)&&(s.value.right+=V)),(o.height-G-Z<n.sizeLimit.height||G<n.positionLimit.top||Z<n.positionLimit.bottom)&&(["move","topDrag","topRightDrag","topLeftDrag"].includes(l.type)&&(s.value.top-=U),["move","bottomDrag","bottomLeftDrag","bottomRightDrag"].includes(l.type)&&(s.value.bottom+=U))},Y=V=>{if(!l.isMove)return;V.preventDefault();const U=V.clientX-l.clientX,G=V.clientY-l.clientY;T(U,G),B(U,G),l.clientX=V.clientX,l.clientY=V.clientY},$=()=>{o.height=window.innerHeight,o.width=window.innerWidth,s.value=a()},re=()=>{s.value.top=n.positionLimit.top,s.value.bottom=n.positionLimit.bottom},F=()=>{s.value.top=o.height-n.sizeLimit.height,s.value.bottom=n.positionLimit.bottom},se=()=>{r("clear")},ee=()=>{r("close")};return b.onBeforeMount(()=>{window.addEventListener("mousemove",Y,!0),window.addEventListener("mouseup",E),window.addEventListener("resize",$)}),b.onBeforeUnmount(()=>{window.removeEventListener("mousemove",Y,!0),window.removeEventListener("mouseup",E),window.removeEventListener("resize",$)}),(V,U)=>(b.openBlock(),b.createElementBlock("section",{style:b.normalizeStyle({top:s.value.top+"px",bottom:s.value.bottom+"px",left:s.value.left+"px",right:s.value.right+"px"}),class:"ai-modal"},[b.createElementVNode("header",{style:b.normalizeStyle({background:V.headBackground}),class:"ai-modal-header",onMousedown:b.withModifiers(d,["stop"])},[b.createElementVNode("span",HP,[b.createElementVNode("i",{class:b.normalizeClass(V.logo)},null,2),b.createTextVNode(" "+b.toDisplayString(V.name||b.unref(tt)("小鲸"))+" ",1),V.models?(b.openBlock(),b.createBlock(b.unref(Tv),{key:0,class:"ai-modal-header-models","model-value":V.model,size:"small",onChange:u},{default:b.withCtx(()=>[(b.openBlock(!0),b.createElementBlock(b.Fragment,null,b.renderList(V.models,G=>(b.openBlock(),b.createBlock(b.unref(Tv).Option,{key:G.id,name:G.name,value:G.id},null,8,["name","value"]))),128))]),_:1},8,["model-value"])):b.createCommentVNode("v-if",!0)]),b.createElementVNode("span",null,[c.value?b.withDirectives((b.openBlock(),b.createElementBlock("i",{key:0,class:"ai-header-tool ai-blueking-icon ai-blueking-shangxiajuhe",onClick:F},null,512)),[[b.unref(i),{content:b.unref(tt)("向下收缩"),distance:20}]]):b.withDirectives((b.openBlock(),b.createElementBlock("i",{key:1,class:"ai-header-tool ai-blueking-icon ai-blueking-shangxialashen-2",onClick:re},null,512)),[[b.unref(i),{content:b.unref(tt)("向上扩展"),distance:20}]]),b.withDirectives(b.createElementVNode("i",{class:"ai-header-tool ai-blueking-icon ai-blueking-saoba",onClick:se},null,512),[[b.unref(i),{content:b.unref(tt)("清空聊天记录"),distance:20}]]),b.withDirectives(b.createElementVNode("i",{class:"ai-header-tool ai-blueking-icon ai-blueking-shanchu-2",onClick:ee},null,512),[[b.unref(i),{content:b.unref(tt)("关闭"),distance:20}]])])],36),b.renderSlot(V.$slots,"default",{},void 0,!0),b.createElementVNode("span",{class:"drag-line left",onMousedown:b.withModifiers(f,["stop"])},null,32),b.createElementVNode("span",{class:"drag-line right",onMousedown:b.withModifiers(v,["stop"])},null,32),b.createElementVNode("span",{class:"drag-line top",onMousedown:b.withModifiers(g,["stop"])},null,32),b.createElementVNode("span",{class:"drag-line bottom",onMousedown:b.withModifiers(p,["stop"])},null,32),b.createElementVNode("span",{class:"drag-line top-left-corner",onMousedown:b.withModifiers(A,["stop"])},null,32),b.createElementVNode("span",{class:"drag-line top-right-corner",onMousedown:b.withModifiers(h,["stop"])},null,32),b.createElementVNode("span",{class:"drag-line bottom-left-corner",onMousedown:b.withModifiers(z,["stop"])},null,32),b.createElementVNode("span",{class:"drag-line bottom-right-corner",onMousedown:b.withModifiers(J,["stop"])},null,32)],4))}}),[["__scopeId","data-v-01d5a54a"]]),RP=(e=>(b.pushScopeId("data-v-d5e26041"),e=e(),b.popScopeId(),e))(()=>b.createElementVNode("i",{class:"ai-blueking-icon ai-blueking-ai"},null,-1)),YP={class:"popup-text"},$P=wn(b.defineComponent({__name:"render-popup",emits:["click"],setup(e,{emit:t}){const{isIconVisible:n,iconPosition:r}=Mu(),i=t,o=()=>{i("click"),n.value=!1};return(l,a)=>b.unref(n)?(b.openBlock(),b.createElementBlock("div",{key:0,style:b.normalizeStyle(b.unref(r)),class:"ai-blueking-render-popup",onMousedown:a[0]||(a[0]=b.withModifiers(()=>{},["prevent"]))},[b.createElementVNode("div",{class:"popup-content",onClick:o},[RP,b.createElementVNode("span",YP,b.toDisplayString(b.unref(tt)("问小鲸")),1)])],36)):b.createCommentVNode("v-if",!0)}}),[["__scopeId","data-v-d5e26041"]]),FP=b.defineComponent({__name:"ai-blueking",props:{messages:{},prompts:{},loading:{type:Boolean},headBackground:{},background:{},positionLimit:{},sizeLimit:{},startPosition:{},userPhoto:{},name:{},placeholder:{},logo:{},scrollLoading:{type:Boolean},scrollLoadingEnd:{type:Boolean},alert:{},models:{},model:{},isShow:{type:Boolean},shortcuts:{}},emits:["clear","close","scroll-load","stop","ai-click","change-prompt","update:model","choose-prompt","send","update:isShow"],setup(e,{expose:t,emit:n}){const r=n,i=b.ref(),o=A=>{var h;(h=i.value)==null||h.setInputMessage(A)},l=()=>{r("update:isShow",!0)},a=()=>{r("clear")},s=()=>{r("update:isShow",!1),r("close")},c=A=>{r("update:model",A)},u=A=>{r("send",A)},d=()=>{r("stop")},v=()=>{r("scroll-load")},f=A=>{r("ai-click",A)},g=A=>{r("choose-prompt",A)},p=A=>{r("change-prompt",A)};return t({setInputMessage:o}),(A,h)=>(b.openBlock(),b.createElementBlock(b.Fragment,null,[b.withDirectives(b.createVNode(VP,{"head-background":A.headBackground,logo:A.logo,model:A.model,models:A.models,name:A.name,"position-limit":A.positionLimit,"size-limit":A.sizeLimit,"start-position":A.startPosition,onChooseModel:c,onClear:a,onClose:s},{default:b.withCtx(()=>[b.createVNode(ZP,{ref_key:"contentRef",ref:i,alert:A.alert,background:A.background,loading:A.loading,messages:A.messages,placeholder:A.placeholder,prompts:A.prompts,"scroll-loading":A.scrollLoading,"scroll-loading-end":A.scrollLoadingEnd,shortcuts:A.shortcuts,"user-photo":A.userPhoto,onAiClick:f,onChangePrompt:p,onChoosePrompt:g,onScrollLoad:v,onSend:u,onStop:d},null,8,["alert","background","loading","messages","placeholder","prompts","scroll-loading","scroll-loading-end","shortcuts","user-photo"])]),_:1},8,["head-background","logo","model","models","name","position-limit","size-limit","start-position"]),[[b.vShow,A.isShow]]),b.createVNode($P,{onClick:l})],64))}});(function(){var e='<svg xmlns="http://www.w3.org/2000/svg" data-name="ai-blueking" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0;visibility:hidden"><symbol id="ai-blueking-check-circle-fill" viewBox="0 0 1024 1024"><path fill="#737987" d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-26.3 606.3l-181-181L350 444l135.8 135.8L712 353.5l45.3 45.3-271.6 271.5z"/></symbol><symbol id="ai-blueking-close-circle-fill" viewBox="0 0 1024 1024"><path fill="#737987" d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm158.4 561.1l-45.3 45.3L512 557.3 398.9 670.4l-45.3-45.3L466.7 512 353.6 398.9l45.3-45.3L512 466.7l113.1-113.1 45.3 45.3L557.3 512l113.1 113.1z"/></symbol><symbol id="ai-blueking-warning-circle-fill" viewBox="0 0 1024 1024"><path fill="#737987" d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 640h-64v-64h64v64zm0-128h-64V320h64v256z"/></symbol><symbol id="ai-blueking-help-document" viewBox="0 0 64 64"><path d="M32 4C16.5 4 4 16.5 4 32c0 3.6.7 7.1 2 10.4V56c0 1.1.9 2 2 2h13.6C36 63.7 52.3 56.8 58 42.4S56.8 11.7 42.4 6C39.1 4.7 35.6 4 32 4zm0 52c-3.3 0-6.6-.7-9.6-2H10V41.6c-5.3-12.2.3-26.3 12.4-31.6s26.3.3 31.6 12.4-.3 26.3-12.4 31.6c-3 1.3-6.3 2-9.6 2z"/><circle cx="31.3" cy="42.1" r="3"/><path d="M32.1 18.9c5 0 8.3 2.8 8.3 6.9 0 2.6-1.3 4.5-3.8 6s-3 2.2-3 3.9v.9H29v-1c-.2-2.8.7-4.4 3.2-5.8 2.3-1.4 3-2.2 3-3.8s-1.3-2.8-3.3-2.8c-1.8-.1-3.3 1.2-3.5 3v.2h-4.8c0-4.4 3.1-7.5 8.5-7.5z"/></g></symbol><symbol id="ai-blueking-angle-up" viewBox="0 0 32 32"><path fill="#63656e" d="M16 11.5l7 7-1.5 1.5-5.5-5.5-5.5 5.5L9 18.5l7-7z"/></symbol><symbol id="ai-blueking-copy" viewBox="0 0 64 64"><path d="M54 8H18c-1.1 0-2 .9-2 2v6h-6c-1.1 0-2 .9-2 2v36c0 1.1.9 2 2 2h36c1.1 0 2-.9 2-2v-6h6c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zM44 44v8H12V20h32v24zm8 0h-4V18c0-1.1-.9-2-2-2H20v-4h32v32z"/><path d="M17.2 26.2h21v4h-21zM17 34h21v4H17zM17 42h21v4H17z"/></symbol><symbol id="ai-blueking-cc-jump-link" viewBox="0 0 1024 1024"><path d="M864 128H496v64h291.2L361.6 617.6l44.8 44.8L832 236.8V528h64V160c0-17.6-14.4-32-32-32z"/><path d="M832 704v128H192V192h126.4v-64H160c-17.6 0-32 14.4-32 32v704c0 17.6 14.4 32 32 32h704c17.6 0 32-14.4 32-32V704h-64z"/></symbol><symbol id="ai-blueking-loading-2" viewBox="0 0 1024 1024"><path d="M195.2 195.2a64 64 0 000 90.56l44.8 45.28A64 64 0 00331.04 240l-45.28-44.8a64 64 0 00-90.56 0z" opacity=".1"/><path d="M128 576h64a64 64 0 000-128h-64a64 64 0 000 128z" opacity=".15"/><path d="M285.76 828.8l45.28-44.8A64 64 0 00240 692.96l-44.8 45.28a64 64 0 0090.56 90.56z" opacity=".3"/><path d="M576 896v-64a64 64 0 00-128 0v64a64 64 0 00128 0z" opacity=".45"/><path d="M828.8 828.8a64 64 0 000-90.56L784 692.96A64 64 0 00692.96 784l45.28 45.28a64 64 0 0090.56-.48z" opacity=".6"/><path d="M896 448h-64a64 64 0 000 128h64a64 64 0 000-128z" opacity=".75"/><path d="M738.24 195.2L692.96 240A64 64 0 00784 331.04l45.28-45.28a64 64 0 10-90.56-90.56z" opacity=".9"/><path d="M448 128v64a64 64 0 00128 0v-64a64 64 0 00-128 0z"/></g></symbol><symbol id="ai-blueking-ai" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M928 96v448l-1.211-.014C910.455 758.791 730.989 928 512 928 282.25 928 96 741.75 96 512S282.25 96 512 96h416zM488.911 320H379.544L256 672h84.05l23.292-71.909h137.215L523.342 672h87.088L488.911 320zM736 320h-79.494v352H736V320zm-303.797 66.88l47.594 148.343h-95.696l48.102-148.343z"/></symbol><symbol id="ai-blueking-fasong" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M924.55 113.365c0-.09-.088-.09-.088-.18a30.217 30.217 0 00-7.78-9.684 31.929 31.929 0 00-10.606-5.918c-.089 0-.177-.09-.266-.09-1.502-.537-3.093-.806-4.685-1.075-.442-.09-.884-.27-1.414-.27-1.503-.179-2.917-.179-4.42-.09-.618 0-1.149-.089-1.768 0-4.242.27-8.485 1.525-12.375 3.498L113.792 485.577c-7.514 3.677-13.26 10.312-15.911 18.382-.796 2.242-1.15 4.663-1.415 6.994-.795 4.753-.618 9.685.884 14.347 2.475 8.16 8.044 14.885 15.558 18.741l194.734 103.836c4.685 2.51 9.812 3.766 15.115 3.766 11.757.09 22.541-6.367 28.287-16.768 8.397-15.513 2.475-34.791-13.083-43.13l-142.316-75.86 572.358-288.014L418.93 634.516c-.265.27-.354.628-.619.897-8.662 5.739-14.32 15.423-14.32 26.542v234.123a32.598 32.598 0 009.547 22.686c6.01 6.008 14.143 9.236 22.54 9.146v.09c17.68 0 32-14.257 32-31.832V675.405l381.07-444.127-79.202 585.802-200.921-97.917c-15.823-7.712-34.828-1.255-42.872 14.526-3.712 7.622-4.243 16.41-1.503 24.48s8.575 14.615 16.177 18.202l238.754 116.48c4.42 2.151 9.193 3.227 14.144 3.227.176 0 .353-.09.53-.09.53 0 1.15.18 1.68.18 15.91.09 29.435-11.657 31.733-27.618l99.003-731.782c2.21-7.532 1.767-15.871-2.122-23.403z"/></symbol><symbol id="ai-blueking-shangxialashen-2" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M510.24 64L352 251.52l127.168-.672.928 223.968h.352l.832 298.656-127.168.736L513.792 960 672 772.448l-127.136.704-.928-320h-.384l-.8-202.656 127.168-.704z"/></symbol><symbol id="ai-blueking-shangxiajuhe" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M510.24 384L352 192l317.92 1.77L510.24 384zm1.44 256l158.24 192L352 830.23 511.68 640zM128 480h768v64H128z"/></symbol><symbol id="ai-blueking-shanchu-2" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M832 259.2L764.8 192 512 444.8 259.2 192 192 259.2 444.8 512 192 764.8l67.2 67.2L512 579.2 764.8 832l67.2-67.2L579.2 512z"/></symbol><symbol id="ai-blueking-saoba" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M566.857 64C607.253 64 640 92.654 640 128v96h256c35.346 0 64 28.654 64 64v96c0 35.346-28.654 64-64 64h-5.818v332.453l21.56 102.356c7.284 34.587-14.848 68.532-49.436 75.817a64 64 0 01-13.19 1.374H175.262c-35.346 0-64-28.654-64-64a64 64 0 011.436-13.484l21.12-97.989V448H128c-35.346 0-64-28.654-64-64v-96c0-35.346 28.654-64 64-64h256v-96c0-35.346 32.747-64 73.143-64h109.714zm259.325 384H197.818v343.346l-1.436 6.665L175.262 896H320V704c0-17.673 14.327-32 32-32 17.673 0 32 14.327 32 32v192h96V704c0-17.673 14.327-32 32-32 17.673 0 32 14.327 32 32v192h96V704c0-17.673 14.327-32 32-32 17.673 0 32 14.327 32 32v192h145.115l-21.559-102.356-1.374-6.524V448zM896 288H128v96h768v-96zM566.857 128H457.143v96h109.714v-96z"/></symbol><symbol id="ai-blueking-quanquan" viewBox="0 0 1024 1024"><path fill="#3A84FF" d="M512 64.129c-9.343-.661-18.345 3.338-27.005 11.998-2.666 2.667-4.831 6.165-6.495 10.495-1.664 4.33-2.496 7.498-2.496 9.503v4c0 10.004 2.997 18.003 8.991 23.997 3.328 4.01 7.327 6.847 11.999 8.511 4.671 1.664 8.34 2.496 11.006 2.496h4c68.003 0 130.993 16.83 188.97 50.49 57.978 33.66 103.807 79.49 137.489 137.488 33.681 57.999 50.511 121.16 50.49 189.483-.021 68.322-16.851 131.313-50.49 188.97-33.64 57.657-79.469 103.316-137.489 136.976-58.02 33.66-121.18 50.49-189.482 50.49-68.301 0-131.292-16.83-188.97-50.49-57.68-33.66-103.338-79.319-136.977-136.976-33.639-57.657-50.469-120.818-50.49-189.482 0-10.005-3.669-18.676-11.007-26.013-2.666-3.328-6.164-5.824-10.494-7.487-4.33-1.664-7.498-2.496-9.503-2.496h-4c-10.004 0-18.334 3.338-24.99 10.015-4.01 4.01-6.846 8.18-8.51 12.51-1.664 4.33-2.496 7.498-2.496 9.503v4c0 60.665 11.828 118.663 35.484 173.996 23.656 55.332 55.482 102.996 95.477 142.991 39.996 39.996 87.66 71.822 142.992 95.478 55.332 23.656 113.33 35.483 173.996 35.483 60.665 0 118.664-11.827 173.996-35.483 55.332-23.656 102.996-55.482 142.992-95.478 39.995-39.995 71.82-87.659 95.477-142.991 23.656-55.333 35.484-113.331 35.484-173.996 0-60.665-11.828-118.664-35.484-173.996-23.656-55.333-55.482-102.997-95.477-142.992-39.996-39.996-87.66-71.821-142.992-95.477C630.664 75.989 572.666 64.16 512 64.16v-.032z"/></symbol><symbol id="ai-blueking-xiangxia-2" viewBox="0 0 1024 1024"><path fill-rule="evenodd" d="M176 617.6l92.8-89.6 182.4 179.2V112h121.6v595.2L755.2 528l92.8 89.6L512 944 176 617.6z" clip-rule="evenodd"/></symbol><symbol id="ai-blueking-tingzhi" viewBox="0 0 1024 1024"><path fill="#fdd" d="M256 256h512v512H256V256z"/><path fill="#ea3636" d="M128 128v768h768V128H128zm640 640H256V256h512v512z"/></symbol></svg>';document.body?document.body.insertAdjacentHTML("afterbegin",e):document.addEventListener("DOMContentLoaded",function(){document.body.insertAdjacentHTML("afterbegin",e)})})();class WP{constructor(t,n,r,i,o){Pr(this,"controllerMap");Pr(this,"handleEnd");Pr(this,"handleError");Pr(this,"handleReceiveMessage");Pr(this,"handleStart");Pr(this,"url");this.url=t,this.handleStart=n,this.handleReceiveMessage=r,this.handleEnd=i,this.handleError=o,this.controllerMap={}}stop(t){var n,r;return(r=(n=this.controllerMap[t])==null?void 0:n.abort)==null||r.call(n),this.handleEnd(t)}async stream(t,n,r){const i=new AbortController;this.controllerMap[n]=i,fetch(this.url,{method:"post",signal:i.signal,headers:{"Content-Type":"application/json",...r},mode:"cors",credentials:"include",body:JSON.stringify(t)}).then(async o=>{const l=o.body.pipeThrough(new window.TextDecoderStream).getReader();for(;;)try{const{value:a,done:s}=await l.read();if(!o.ok){this.handleError(a||o.statusText,o.status,n);break}if(s){this.handleEnd(n);break}a.toString().split(`
|
|
262
|
-
`).forEach(u=>{const d=u.replace("data:","").trim();if(XL(d)){const{event:v,content:f,result:g,code:p,message:A}=JSON.parse(d);if(g===!1||o.status!==200){this.handleError(A,p,n);return}switch(v){case"text":this.handleReceiveMessage(f,n);break;case"done":this.handleEnd(n);break;case"error":this.handleError(A,p,n);break}}})}catch(a){(a==null?void 0:a.code)!==20&&this.handleError(a.message,a.code,n);break}}).catch(o=>{(o==null?void 0:o.code)!==20&&this.handleError(o.message,o.code,n)}),await this.handleStart(n)}}HM({prefix:"ai-blueking"});const UP={name:"AiBlueking",render(e){return e("div",{style:{width:"100%"}})},props:{messages:{default:()=>[],type:Array},prompts:{default:()=>[],type:Array},loading:{default:!1,type:Boolean},headBackground:{default:"linear-gradient(267deg, #2dd1f4 0%, #1482ff 95%)",type:String},background:{default:"#f5f7fa",type:String},positionLimit:{default:()=>({top:0,bottom:0,left:0,right:0}),type:Object},sizeLimit:{default:()=>({height:320,width:400}),type:Object},startPosition:{default:()=>({top:window.innerHeight-560,bottom:0,left:window.innerWidth-400,right:0}),type:Object},userPhoto:{default:Bu,type:String},logo:{default:"ai-blueking-icon ai-blueking-ai",type:String},name:{default:"",type:String},placeholder:{default:"",type:String},scrollLoading:{default:!1,type:Boolean},scrollLoadingEnd:{default:!0,type:Boolean},alert:{default:"",type:String},models:{default:void 0,type:Array},model:{default:"",type:String},isShow:{type:Boolean},shortcuts:{default:()=>Zu,type:Array}},data(){return{app:null,unWatchStack:[]}},watch:{messages:{handler(){setTimeout(()=>{const e=document.querySelector(".ai-blueking-messages");(e==null?void 0:e.scrollTop)+(e==null?void 0:e.clientHeight)+100>=(e==null?void 0:e.scrollHeight)&&(e.scrollTop=e.scrollHeight)},10)},deep:!0}},created(){const e=this.$emit.bind(this);let t=null,n=null;const r=this;this.app=b.createApp({render(){return t=this,n=b.h(FP,{messages:JSON.parse(JSON.stringify(r.messages)),prompts:r.prompts,loading:r.loading,headBackground:r.headBackground,background:r.background,positionLimit:r.positionLimit,sizeLimit:r.sizeLimit,userPhoto:r.userPhoto,logo:r.logo,name:r.name,placeholder:r.placeholder,startPosition:r.startPosition,scrollLoading:r.scrollLoading,scrollLoadingEnd:r.scrollLoadingEnd,alert:r.alert,models:r.models,model:r.model,isShow:r.isShow,shortcuts:r.shortcuts,onClear(){e("clear",...arguments)},onClose(){e("close",...arguments)},onSend(){e("send",...arguments)},onChoosePrompt(){e("choose-prompt",...arguments)},onStop(){e("stop",...arguments)},onScrollLoad(){e("scroll-load",...arguments)},onAiClick(){e("ai-click",...arguments)},onChangePrompt(){e("change-prompt",...arguments)},"onUpdate:model"(){e("update:model",...arguments)},"onUpdate:isShow"(){e("update:isShow",...arguments),e("showDialog",...arguments)},...r.$attrs}),n}}),this.unWatchStack=Object.keys(this.$props).map(i=>this.$watch(i,()=>{t.$forceUpdate()},{deep:!0})),this.setInputMessage=i=>{n.setInputMessage(i)}},mounted(){var e;(e=this.app)==null||e.mount(this.$el)},beforeDestroy(){var e;this.unWatchStack.forEach(t=>t==null?void 0:t()),(e=this.app)==null||e.unmount()}};lt.ChatHelper=WP,lt.MessageStatus=ya,lt.RoleType=ju,lt.default=UP,Object.defineProperties(lt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
262
|
+
`).forEach(u=>{const d=u.replace("data:","").trim();if(XL(d)){const{event:v,content:f,result:g,code:p,message:A}=JSON.parse(d);if(g===!1||o.status!==200){this.handleError(A,p,n);return}switch(v){case"text":this.handleReceiveMessage(f,n);break;case"done":this.handleEnd(n);break;case"error":this.handleError(A,p,n);break}}})}catch(a){(a==null?void 0:a.code)!==20&&this.handleError(a.message,a.code,n);break}}).catch(o=>{(o==null?void 0:o.code)!==20&&this.handleError(o.message,o.code,n)}),await this.handleStart(n)}}HM({prefix:"ai-blueking"});const UP={name:"AiBlueking",render(e){return e("div",{style:{width:"100%"}})},props:{messages:{default:()=>[],type:Array},prompts:{default:()=>[],type:Array},loading:{default:!1,type:Boolean},headBackground:{default:"linear-gradient(267deg, #2dd1f4 0%, #1482ff 95%)",type:String},background:{default:"#f5f7fa",type:String},positionLimit:{default:()=>({top:0,bottom:0,left:0,right:0}),type:Object},sizeLimit:{default:()=>({height:320,width:400}),type:Object},startPosition:{default:()=>({top:window.innerHeight-560,bottom:0,left:window.innerWidth-400,right:0}),type:Object},userPhoto:{default:Bu,type:String},logo:{default:"ai-blueking-icon ai-blueking-ai",type:String},name:{default:"",type:String},placeholder:{default:"",type:String},scrollLoading:{default:!1,type:Boolean},scrollLoadingEnd:{default:!0,type:Boolean},alert:{default:"",type:String},models:{default:void 0,type:Array},model:{default:"",type:String},isShow:{type:Boolean},shortcuts:{default:()=>Zu,type:Array}},data(){return{app:null,unWatchStack:[]}},watch:{messages:{handler(){setTimeout(()=>{const e=document.querySelector(".ai-blueking-messages");(e==null?void 0:e.scrollTop)+(e==null?void 0:e.clientHeight)+100>=(e==null?void 0:e.scrollHeight)&&(e.scrollTop=e.scrollHeight)},10)},deep:!0}},created(){const e=this.$emit.bind(this);let t=null,n=null;const r=this;this.app=b.createApp({render(){return t=this,n=b.h(FP,{messages:JSON.parse(JSON.stringify(r.messages)),prompts:r.prompts,loading:r.loading,headBackground:r.headBackground,background:r.background,positionLimit:r.positionLimit,sizeLimit:r.sizeLimit,userPhoto:r.userPhoto,logo:r.logo,name:r.name,placeholder:r.placeholder,startPosition:r.startPosition,scrollLoading:r.scrollLoading,scrollLoadingEnd:r.scrollLoadingEnd,alert:r.alert,models:r.models,model:r.model,isShow:r.isShow,shortcuts:r.shortcuts,onClear(){e("clear",...arguments)},onClose(){e("close",...arguments)},onSend(){e("send",...arguments)},onChoosePrompt(){e("choose-prompt",...arguments)},onStop(){e("stop",...arguments)},onScrollLoad(){e("scroll-load",...arguments)},onAiClick(){e("ai-click",...arguments)},onChangePrompt(){e("change-prompt",...arguments)},"onUpdate:model"(){e("update:model",...arguments)},"onUpdate:isShow"(){e("update:isShow",...arguments),e("showDialog",...arguments)},...r.$attrs}),n}}),this.unWatchStack=Object.keys(this.$props).map(i=>this.$watch(i,()=>{t.$forceUpdate()},{deep:!0})),this.setInputMessage=i=>{n.component.exposed.setInputMessage(i)}},mounted(){var e;(e=this.app)==null||e.mount(this.$el)},beforeDestroy(){var e;this.unWatchStack.forEach(t=>t==null?void 0:t()),(e=this.app)==null||e.unmount()}};lt.ChatHelper=WP,lt.MessageStatus=ya,lt.RoleType=ju,lt.default=UP,Object.defineProperties(lt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|