@glodon-aiot/chat-app-sdk 0.0.16 → 0.0.17

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/libs/cn/index.js CHANGED
@@ -10053,4 +10053,4 @@ ${s.substring(t)}`),setTimeout(()=>{e.selectionStart=t+1,e.selectionEnd=t+1},0)}
10053
10053
  new CozeAPI({
10054
10054
  // ...
10055
10055
  baseURL: COZE_CN_BASE_URL
10056
- })`)},i=await a({url:e,responseType:r.isStreaming?"stream":"json",adapter:r.isStreaming?eUQ()||eUA()||eUw()||eVA(process.version.slice(1),"18.0.0")>=0?"fetch":eVx:void 0,...r}).catch(e=>{throw(null==e?void 0:e.status)===401&&o(),eVQ(e)});return{async *stream(){try{let e=i.data,t=e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e.getReader(),r=new TextDecoder,a={},n="";for(;;){let{done:e,value:i}=await (t.next?t.next():t.read());if(e){if(n){a.event="error",a.data=n;try{let e=JSON.parse(n);(null==e?void 0:e.code)===4101&&o()}catch(e){}yield a}break}let s=(n+=r.decode(i,{stream:!0})).split("\n");for(let e=0;e<s.length-1;e++){let t=s[e],r=t.indexOf(":");if(-1!==r){let e=t.substring(0,r).trim(),o=t.substring(r+1).trim();a[e]=o,"data"===e&&(yield a)}}n=s[s.length-1]}}catch(e){eVQ(e)}},json:()=>i.data,response:i}}function eVA(e,t){let r=e.split(".").map(Number),a=t.split(".").map(Number);for(let e=0;e<3;e++){let t=r[e]||0,o=a[e]||0;if(t>o)return 1;if(t<o)return -1}return 0}class eVE{async getToken(){return"function"==typeof this.token?await this.token():this.token}async buildOptions(e,t,r){let a=await this.getToken(),o={authorization:`Bearer ${a}`};eUw()?o["X-Coze-Client-User-Agent"]=eVk():eUQ()||eUA()?o["X-Coze-Client-User-Agent"]=eVT():(o["User-Agent"]=eVv(),o["X-Coze-Client-User-Agent"]=eVy());let i=eUx(this.axiosOptions,r,{headers:o},{headers:this.headers||{}});return i.method=e,i.data=t,i}async buildWebsocketOptions(e){var t;let r=await this.getToken(),a={authorization:`Bearer ${r}`};return eUw()?a["X-Coze-Client-User-Agent"]=eVk():eUQ()?a["X-Coze-Client-User-Agent"]=eVT():(a["User-Agent"]=eVv(),a["X-Coze-Client-User-Agent"]=eVy()),eUx({debug:null!=(t=this._config.debug)&&t},this._config.websocketOptions,e,{headers:a},{headers:this.headers||{}})}async makeRequest(e,t,r,a,o){var i,n;let s=`${this.baseURL}${e}`;try{let e=await this.buildOptions(t,r,o);e.isStreaming=a,e.axiosInstance=this.axiosInstance,this.debugLog(null==o?void 0:o.debug,`--- request url: ${s}`),this.debugLog(null==o?void 0:o.debug,"--- request options:",e);let{response:n,stream:l,json:c}=await eVz(s,e);this.debugLog(null==o?void 0:o.debug,`--- response status: ${n.status}`),this.debugLog(null==o?void 0:o.debug,"--- response headers: ",n.headers);let d=(null!=(i=n.headers)?i:n.header)["content-type"];if(a){if(d&&d.includes("application/json")){let e=await c(),{code:t,msg:r}=e;if(0!==t&&void 0!==t)throw eUD.generate(n.status,e,r,n.headers)}return l()}if(!(d&&d.includes("application/json")))return await n.data;{let e=await c(),{code:t,msg:r}=e;if(0!==t&&void 0!==t)throw eUD.generate(n.status,e,r,n.headers);return e}}catch(t){let e=(null==o?void 0:o.onApiError)||(null==(n=this._config)?void 0:n.onApiError);throw e&&e(t),t}}async post(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3?arguments[3]:void 0;return this.makeRequest(e,"POST",t,r,a)}async get(e,t,r,a){let o=Object.entries(t||{}).filter(e=>{let[t,r]=e;return null!=r}).map(e=>{let[t,r]=e;return`${t}=${r}`}).join("&");return this.makeRequest(o?`${e}${e.includes("?")?"&":"?"}${o}`:e,"GET",void 0,r,a)}async put(e,t,r,a){return this.makeRequest(e,"PUT",t,r,a)}async delete(e,t,r){return this.makeRequest(e,"DELETE",void 0,t,r)}async makeWebsocket(e,t){let r=`${this.baseWsURL}${e}`,a=await this.buildWebsocketOptions(t);return this.debugLog(null==t?void 0:t.debug,`--- websocket url: ${r}`),this.debugLog(null==t?void 0:t.debug,"--- websocket options:",a),new eVg(r,a)}getConfig(){return this._config}debugLog(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];for(var t=arguments.length,r=Array(t>1?t-1:0),a=1;a<t;a++)r[a-1]=arguments[a];(this.debug||e)&&console.debug(...r)}constructor(e){if(this._config=e,this.baseURL=e.baseURL||eVw,this.baseWsURL=e.baseWsURL||"wss://ws.coze.cn",this.token=e.token,this.axiosOptions=e.axiosOptions||{},this.axiosInstance=e.axiosInstance,this.debug=e.debug||!1,this.allowPersonalAccessTokenInBrowser=e.allowPersonalAccessTokenInBrowser||!1,this.headers=e.headers,eUQ()&&"function"!=typeof this.token&&function(e){return!!(null==e?void 0:e.startsWith("pat_"))}(this.token)&&!this.allowPersonalAccessTokenInBrowser)throw new eUE("Browser environments do not support authentication using Personal Access Token (PAT) by default.\nas it may expose secret API keys. \n\nPlease use OAuth2.0 authentication mechanism. see:\nhttps://www.coze.com/docs/developer_guides/oauth_apps?_lang=en \n\nIf you need to force use, please set the `allowPersonalAccessTokenInBrowser` option to `true`. \n\ne.g new CozeAPI({ token, allowPersonalAccessTokenInBrowser: true });\n\n")}}eVE.APIError=eUD,eVE.BadRequestError=eUL,eVE.AuthenticationError=eUO,eVE.PermissionDeniedError=eUM,eVE.NotFoundError=eUI,eVE.RateLimitError=eUB,eVE.InternalServerError=eUR,eVE.GatewayError=eUH,eVE.TimeoutError=eUP,eVE.UserAbortError=eUC;class eVD extends eVE{constructor(...e){super(...e),this.bots=new eUk(this),this.chat=new eUq(this),this.conversations=new eUW(this),this.files=new eUZ(this),this.knowledge=new eU3(this),this.datasets=new eU7(this),this.workflows=new eUJ(this),this.workspaces=new eU1(this),this.audio=new eVi(this),this.templates=new eVn(this),this.websockets=new eVh(this),this.variables=new eVm(this),this.users=new eVf(this)}}function eVS(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class eVC extends eVD{setRefreshToken(e){this.onRefreshToken=e}useAuthError(){let e=async e=>{let{code:t}=(null==e?void 0:e.data)||{};if(bG(t||e.status)){let t=this.getTokenFromHeaderAuth(String(e.config.headers.getAuthorization()||"")),r=await this.refreshToken(t);if(r)return({...e.config}).headers={...e.config.headers},e.config.headers.Authorization=`Bearer ${r}`,await eo1.request(e.config)}return e};this.useResponseInterceptors(e,e)}getTokenFromHeaderAuth(e){return e.replace(/^\s*Bearer\s*/,"").replace(/\s+$/,"")}async refreshToken(e){var t;if(this.refreshTokenPromise)return this.refreshTokenPromise;if(e!==this.token)return this.token;this.refreshTokenPromise=null==(t=this.onRefreshToken)?void 0:t.call(this,this.token);let r=await this.refreshTokenPromise;return this.refreshTokenPromise=void 0,this.token=r||"",this.token}useResponseInterceptors(e,t){this.getAxiosInstance().interceptors.response.use(e,t)}getAxiosInstance(){return this.axiosInstance}constructor({onRefreshToken:e,axiosOptions:t,...r}){super({...r,axiosOptions:{...t||{},timeout:6e5,validateStatus:()=>!0}}),eVS(this,"onRefreshToken",void 0),eVS(this,"refreshTokenPromise",void 0),this.onRefreshToken=e,this.axiosInstance=eo1.create(),this.useAuthError()}}let eVL=(0,gt.createContext)({}),eVO=e=>{let{children:t}=e,r=(0,gt.useRef)({}),{tokenManagerClient:a,cozeApiClient:o,refreshToken:i}=(()=>{let{debug:e}=ej7(),{token:t="",refreshToken:r,setToken:a,setCozeApi:o,apiUrl:i}=ej8(b7(e=>({token:e.token,setToken:e.setToken,refreshToken:e.refreshToken,setCozeApi:e.setCozeApi,apiUrl:e.apiUrl}))),n=(0,gt.useMemo)(()=>new esU({apiKey:t}),[]),s=(0,gt.useMemo)(()=>new eVC({token:t,allowPersonalAccessTokenInBrowser:!0,baseURL:i||f1,axiosOptions:{headers:{...(null==e?void 0:e.cozeApiRequestHeader)||{}}}}),[i]),l=WG(e=>{null==n||n.updateApiKey(e),s.token=e}),c=WG(async()=>{let e=await (null==r?void 0:r());return e&&(l(e),a(e)),e});return s.setRefreshToken(c),(0,gt.useEffect)(()=>{l(t)},[t]),(0,gt.useEffect)(()=>{o(s)},[s]),{tokenManagerClient:n,cozeApiClient:s,refreshToken:c}})();return(0,fU.jsx)(eVL.Provider,{value:{cozeApiSdk:o,tokenManager:a,refMessageListLeft:r,refreshToken:i},children:t})},eVM=()=>{let{cozeApiSdk:e,tokenManager:t,refMessageListLeft:r,refreshToken:a}=(0,gt.useContext)(eVL);return{cozeApiSdk:e,tokenManager:t,refMessageListLeft:r,refreshToken:a}},eVI={text:eTu.TextInput,select:eTu.Select,file:eTu.MixUpload,image:eTu.UploadImage,audio:eTu.UploadAudio,doc:eTu.UploadDoc,table:eTu.UploadTable,code:eTu.CODE,zip:eTu.ARCHIVE,ppt:eTu.PPT,video:eTu.VIDEO,txt:eTu.TXT},eVP=new class{mergeJsonObjects(e,t){let r={...e};for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a)){let o=e[a],i=t[a];if("object"!=typeof o||null===o||Array.isArray(o)||"object"!=typeof i||null===i||Array.isArray(i))if("string"==typeof o&&"string"==typeof i)r[a]=o+i;else if(Array.isArray(o)&&Array.isArray(i)){let e=[...o];for(let t=0;t<i.length;t++){let r=i[t];if(t<e.length){let a=e[t];"object"!=typeof a||null===a||Array.isArray(a)||"object"!=typeof r||null===r||Array.isArray(r)?e[t]=r:e[t]=this.mergeJsonObjects(a,r)}else e.push(r)}r[a]=e}else r[a]=i;else r[a]=this.mergeJsonObjects(o,i)}return r}convertMessageListResponse(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",{data:r=[],has_more:a,first_id:o,last_id:i}=e,n=r.map(e=>this.convertMessage(e,t)).filter(e=>!!e.message_id)||[];return console.log("messageListForCoze",n),{code:0,message_list:n,hasmore:a,cursor:i,next_cursor:o}}convertMessage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",{content_type:r,content:a}=this.convertContent(e.content_type,e.content)||{},o="question"===e.type,i=e.chat_id||`--custom-replyId--${fK()}`,n=("object_string"===e.content_type&&e.type,o?i:e.id||`--custom-messageId-${fK()}`),s=o?"":e.bot_id||t;if(!r||!n||!i)return{};let l="";if("function_call"===e.type){let t=ej0(e.content);l=(null==t?void 0:t.plugin)||""}return console.log("convertMessage message",{reasoning_content:e.reasoning_content,content:a,content_time:1e3*(e.created_at||0),content_type:r,message_id:n,reply_id:i,role:e.role,section_id:e.section_id,sender_id:s,source:0,status:"",extra_info:{local_message_id:"",plugin:l,coze_api_message_id:e.id,coze_api_chat_id:e.chat_id},type:e.type}),{reasoning_content:e.reasoning_content,content:a,content_time:1e3*(e.created_at||0),content_type:r,message_id:n,reply_id:i,role:e.role,section_id:e.section_id,sender_id:s,source:0,status:"",extra_info:{local_message_id:"",plugin:l,coze_api_message_id:e.id,coze_api_chat_id:e.chat_id},type:e.type}}convertContent(e,t){switch(e){case"object_string":{console.log("convertContent object_string");let e=this.convertMixContent(t);if(void 0===e)return;return{content_type:eny.Mix,content:e}}case"card":return{content_type:eny.Card,content:t};case"text":return{content_type:eny.Text,content:t};default:return}}convertMixContent(e){let t,r;try{let r=e.trim(),a=JSON.parse(r);t=Array.isArray(a)?a:[a]}catch(r){t=ej0(e)}if(!t)return;console.log("convertMixContent parsedContent",t);let a=null==t?void 0:t.map(e=>{switch(e.type){case"text":return{type:eny.Text,text:e.text||"",is_refer:e.is_refer||void 0};case"image":return{type:eny.Image,image:{key:(null==e?void 0:e.file_id)||"",image_ori:{height:void 0,width:void 0,url:null==e?void 0:e.file_url},image_thumb:{height:void 0,width:void 0,url:null==e?void 0:e.file_url}},is_refer:e.is_refer||void 0};case"file":{let t=(null==e?void 0:e.name)||(e=>{if(!e)return"";try{let{pathname:t}=new URL(e),r=t.split("/").pop()||"";r=r.split("?")[0].split("#")[0]||"";try{return decodeURIComponent(r)}catch{return r}}catch{let t=e.split("/"),r=t[t.length-1]||"";r=r.split("?")[0].split("#")[0]||"";try{return decodeURIComponent(r)}catch{return r}}})(null==e?void 0:e.file_url),{fileType:r=Gq.DEFAULT_UNKNOWN}=GK(new File([],t))||{};console.log("convertMixContent file",e);let a=e.file_id||e.file_url||"",o={type:eny.File,file:{file_key:a,file_name:t||"未知文件",file_size:(null==e?void 0:e.size)??0,file_type:r,file_url:(null==e?void 0:e.file_url)||""},is_refer:e.is_refer||void 0};return console.log("convertMixContent file result",o),o}case"json":return console.log("convertMixContent json",e),{type:eny.Json,json:e.json,schema_version:e.schema_version};default:return}}).filter(e=>!!e),o=a.filter(e=>e.type===eny.Json),i=a.filter(e=>e.type!==eny.Json);if(o.length>0)if(1===o.length)r=o[0];else{let e,t=o.map(e=>e.json);e=t.every(e=>"object"==typeof e&&null!==e&&!Array.isArray(e))?t.reduce((e,t)=>"object"!=typeof e||null===e||Array.isArray(e)||"object"!=typeof t||null===t||Array.isArray(t)?t:this.mergeJsonObjects(e,t),t[0]):1===t.length?t[0]:t;let a=o[0].schema_version;r={type:eny.Json,json:e,schema_version:a}}let n=[...i];return r&&n.push(r),JSON.stringify({item_list:n.filter(e=>!e.is_refer),refer_items:n.filter(e=>e.is_refer)})}},eVB=()=>{let{refMessageListLeft:e}=eVM();return(0,gt.useCallback)(function(t){var r,a,o;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=[],s=[];for(let e=0;e<i.length;e++)"question"!==i[e].type?n.push(i[e]):(s.push(...n),n.splice(0,n.length),s.push(i[e]));let l=(null==e||null==(r=e.current)?void 0:r[t])||[];return l.length&&(null==(a=l[0])?void 0:a.reply_id)===(null==(o=s[0])?void 0:o.reply_id)&&s.unshift(...l),(null==e?void 0:e.current)&&(e.current[t]=n),s},[])},eVR=async e=>{var t,r,a,o,i;let n,s,{botId:l,cozeApiSdk:c}=e,d=await c.get(`/v1/bots/${l}`,void 0,!1,{headers:{"Accept-Language":"zh-CN"===bj.language?"zh":"en"}}),u=null==d?void 0:d.data,p=u.background_image_info||{};return(null==p||null==(t=p.web_background_image)?void 0:t.image_url)&&(p.web_background_image.origin_image_url=p.web_background_image.origin_image_url||p.web_background_image.image_url),(null==p||null==(r=p.mobile_background_image)?void 0:r.image_url)&&(p.mobile_background_image.origin_image_url=p.mobile_background_image.origin_image_url||p.mobile_background_image.image_url),{prologue:u.onboarding_info.prologue,onboardingSuggestions:(null==(o=u.onboarding_info)||null==(a=o.suggested_questions)?void 0:a.map((e,t)=>({id:`${t}`,content:e})))||[],botVersion:u.version,botInfoMap:{[u.bot_id]:{url:u.icon_url,nickname:u.name,id:u.bot_id,allowMention:!1}},backgroundInfo:p,defaultInputMode:"voice"===u.default_user_input_type?ej3.Voice:"call"===u.default_user_input_type?ej3.VoiceCall:ej3.Text,shortcuts:(n=u.shortcut_commands,s={id:l,name:u.name,iconUrl:u.icon_url},(null==n?void 0:n.map(e=>{var t,r,a,o,i,n,l,c;let d,u,p=e.send_type&&("panel"===e.send_type?eTp.SendTypePanel:eTp.SendTypeQuery);return p!==eTp.SendTypeQuery&&(d=(null==(l=e.components)?void 0:l.map(e=>{var t;return{name:e.name,description:e.description,parameter:e.tool_parameter,hide:e.is_hide,options:"select"===e.type&&e.options||[],input_type:eVI[e.type],upload_options:"file"===e.type&&(null==(t=e.options)?void 0:t.map(e=>eVI[e]))||[],default_value:{value:e.default_value||"",type:0}}}))||[],(null==e||null==(c=e.tool)?void 0:c.type)&&["plugin","workflow"].includes(e.tool.type)&&(u="plugin"===e.tool.type?eTh.ToolTypePlugin:eTh.ToolTypeWorkFlow)),{object_id:(null==s?void 0:s.id)||"",command_name:e.name,shortcut_command:e.command,description:e.description,send_type:p,tool_type:u,work_flow_id:(null==e||null==(t=e.tool)?void 0:t.workflow_id)||"",plugin_id:(null==e||null==(r=e.tool)?void 0:r.plugin_id)||"",plugin_api_name:(null==e||null==(a=e.tool)?void 0:a.name)||"",template_query:e.query_template,components_list:d,card_schema:e.card_schema,command_id:e.id,tool_info:{tool_name:null==(o=e.tool)?void 0:o.name,tool_params_list:(null==(n=e.tool)||null==(i=n.params)?void 0:i.map(e=>({name:e.name,required:e.is_required,desc:e.description,type:e.type,default_value:e.default_value,refer_component:e.is_refer_component})))||[]},shortcut_icon:{url:e.icon_url},bot_info:{icon_url:(null==s?void 0:s.iconUrl)||"",name:(null==s?void 0:s.name)||""}}}))||[]),voiceCallClose:(null==(i=u.media_config)?void 0:i.is_voice_call_closed)??!0}},eVH=async e=>{let{botId:t,cozeApiSdk:r,conversationId:a,sectionId:o,connectorId:i,defaultHistoryMessage:n,onDefaultHistoryClear:s,chatType:l,appInfo:c}=e,d=a||"",u=o||"";if(!d)return{lastSectionId:"",conversationId:"",messageList:[],hasMore:!1,cursor:"",next_cursor:""};let p=await r.conversations.messages.list(d,{limit:10}),{message_list:h,hasmore:m,cursor:f,next_cursor:g}=eVP.convertMessageListResponse(p,t);if(!u&&h&&h.length>0){let e=h[0];(null==e?void 0:e.section_id)&&(u=e.section_id)}return{lastSectionId:u,conversationId:d,messageList:h,hasMore:m,cursor:f,next_cursor:g}},eVF=async e=>{let t,{cozeApiSdk:r,openRequestInit:a}=e;return a?(t="function"==typeof a?await a(r):a).isBuilderChat?{botOnlineInfo:{prologue:t.prologue,onboardingSuggestions:t.onboardingSuggestions,botInfoMap:{[t.botInfo.id]:t.botInfo},backgroundInfo:t.backgroundInfo,defaultInputMode:t.defaultInputMode,shortcuts:[],isCustomBackground:t.isCustomBackground},conversationId:t.conversationId,sectionId:t.sectionId,conversationName:t.conversationName}:{conversationId:t.conversationId,sectionId:t.sectionId,conversationName:t.conversationName}:null},eVj=e=>{let{project:t}=e,{mode:r,connectorId:a}=t||{};if(!a){if("websdk"===r)return"999";else if("draft"===r)return"10000010"}return a},eVN=async(e,t)=>{let r,a="",o="";try{if("bot"===t.projectType){let i=await (null==e?void 0:e.conversations.create({connector_id:t.connectorId},{headers:{"Accept-Language":"zh-CN"===bj.language?"zh":"en"}}));i&&(a=i.id||"",o=i.last_section_id||""),r=void 0}else{let i={app_id:t.projectId,draft_mode:"draft"===t.mode,workflow_id:t.workflowId||"",connector_id:t.connectorId};if(t.conversationName&&""!==t.conversationName.trim()&&(i.get_or_create=!0,i.conversation_name=t.conversationName),void 0!==globalThis.IS_OPEN_SOURCE&&globalThis.IS_OPEN_SOURCE){let n=await (null==e?void 0:e.post("/v1/workflow/conversation/create",i,!1,{headers:{"Accept-Language":"zh-CN"===bj.language?"zh":"en"}}));if((null==n?void 0:n.code)===0&&(null==n?void 0:n.data)){if(a=n.data.id||"",o=n.data.last_section_id||"",!a||""===a.trim())throw Error("Failed to create conversation: empty conversationId returned")}else{let e=(null==n?void 0:n.msg)||`code=${(null==n?void 0:n.code)??"unknown"}`;throw Error(`Failed to create conversation: ${e}`)}if(a&&""!==a.trim())try{let o=await (null==e?void 0:e.get(`/v1/workflow/conversations/${a}`,{app_id:t.projectId,workflow_id:t.workflowId||"",connector_id:t.connectorId}));(null==o?void 0:o.code)===0&&(null==o?void 0:o.data)&&(r=o.data.conversation_name||o.data.name||o.data.title||void 0)}catch(e){console.warn("Failed to fetch conversation detail:",e),r=void 0}}else{let n=await (null==e?void 0:e.post("/v1/workflow/conversation/create",i,!1,{headers:{"Accept-Language":"zh-CN"===bj.language?"zh":"en"}}));if((null==n?void 0:n.code)===0&&(null==n?void 0:n.data)){if(a=n.data.id||"",o=n.data.last_section_id||"",!a||""===a.trim())throw Error("Failed to create conversation: empty conversationId returned")}else if((null==n?void 0:n.code)!==0){let e=(null==n?void 0:n.msg)||`code=${(null==n?void 0:n.code)??"unknown"}`;throw Error(`Failed to create conversation: ${e}`)}if(a)try{let o=await (null==e?void 0:e.get(`/v1/workflow/conversations/${a}`,{app_id:t.projectId,workflow_id:t.workflowId||"",connector_id:t.connectorId}));(null==o?void 0:o.code)===0&&(null==o?void 0:o.data)&&(r=o.data.conversation_name||o.data.name||o.data.title||void 0)}catch(e){console.warn("Failed to fetch conversation detail:",e),r=void 0}}}return{conversationId:a,sectionId:o,conversationName:r}}catch(e){if(console.error("createConversationForMessage error:",e),e instanceof Error)throw e;throw Error(`Failed to create conversation: ${JSON.stringify(e)}`)}},eVU=async(e,t)=>{if(!t.project.conversationName||""===t.project.conversationName.trim())return{conversationId:"",sectionId:"",conversationName:void 0};if("app"===t.project.type)try{let r=eVj(t),a={app_id:t.project.id,draft_mode:"draft"===t.project.mode,workflow_id:t.workflow.id||"",connector_id:r,get_or_create:!0,conversation_name:t.project.conversationName},o=await (null==e?void 0:e.post("/v1/workflow/conversation/create",a,!1,{headers:{"Accept-Language":"zh-CN"===bj.language?"zh":"en"}}));if((null==o?void 0:o.code)===0&&(null==o?void 0:o.data)){let a,i=o.data.id||"",n=o.data.last_section_id||"";if(!i||""===i.trim())throw Error("Failed to create conversation: empty conversationId returned");if(i)try{let o=await (null==e?void 0:e.get(`/v1/workflow/conversations/${i}`,{app_id:t.project.id,workflow_id:t.workflow.id||"",connector_id:r}));(null==o?void 0:o.code)===0&&(null==o?void 0:o.data)&&(a=o.data.conversation_name||o.data.name||o.data.title||void 0)}catch(e){console.warn("Failed to fetch conversation detail:",e),a=t.project.conversationName}return{conversationId:i,sectionId:n,conversationName:a||t.project.conversationName}}{let e=(null==o?void 0:o.msg)||`code=${(null==o?void 0:o.code)??"unknown"}`;throw Error(`Failed to create conversation: ${e}`)}}catch(e){console.error("createOrGetConversation error:",e),e instanceof Error&&console.warn("Failed to create conversation during init, will create on first message:",e.message)}return{conversationId:"",sectionId:"",conversationName:void 0}},eVV=new class{convertRequestBody(e){let t,{body:r,userInfo:a,connectorId:o,parameters:i,shortcuts:n}=e,s=ej0(r)||{},l=s.content_type,c=s.query,d=s.shortcut_command;if(i)if("string"==typeof i)try{let e=JSON.parse(i);t=JSON.stringify(e)}catch{t=i}else t="object"==typeof i?JSON.stringify(i):String(i);return JSON.stringify({bot_id:s.bot_id,user_id:null==a?void 0:a.id,stream:!0,connector_id:o,additional_messages:[this.convertRequestMessage(l,c)],parameters:t,shortcut_command:this.convertShortcuts(n||[],d),enable_card:!0})}convertRequestMessage(e,t){return{role:"user",...this.convertContent(e,t)}}convertContent(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];switch(e){case eny.Text:return{content_type:"text",content:t};case eny.Card:return{content_type:"card",content:t};case eny.Image:case eny.File:case eny.Mix:return this.convertMixContent(t,r);default:throw Error("Error: unknown content Type")}}convertMixContent(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=ej0(e);if(!r)return;let a=[...(null==r?void 0:r.item_list)||[]],o=[...(null==r?void 0:r.refer_items)||[]];return{content_type:"object_string",content:JSON.stringify((a=(a=(a=a.concat(((null==r?void 0:r.image_list)||[]).map(e=>({type:eny.Image,image:e})))).concat(((null==r?void 0:r.file_list)||[]).map(e=>({type:eny.File,file:e})))).concat((o||[]).map(e=>({...e,is_refer:!0})))).map(e=>{var r,a;switch(e.type){case eny.Text:return{type:"text",text:e.text,is_refer:e.is_refer||void 0};case eny.Image:{let a=e.image.id||e.image.key;return{type:"image",file_id:a,file_url:t||!a?null==(r=e.image.image_ori)?void 0:r.url:void 0,is_refer:e.is_refer||void 0}}case eny.File:return{type:"file",file_id:e.file.file_id||e.file.file_key,file_url:t?null==(a=e.file)?void 0:a.file_url:void 0,is_refer:e.is_refer||void 0};default:return null}}).filter(e=>!!e))}}convertMessageListResponse(e){return null==e?void 0:e.reverse().map(e=>{let t=this.convertMessage(e);if((null==t?void 0:t.content_type)==="object_string"){var r;let e=ej0(t.content),a=null==e?void 0:e.map(e=>"image"===e.type||"file"===e.type?{type:"text",text:e.file_url}:e);if((null==a?void 0:a.length)===1&&(null==(r=a[0])?void 0:r.type)==="text")t.content_type="text",t.content=a[0].text;else{if(!((null==a?void 0:a.length)>0))return null;t.content=JSON.stringify(a)}}return t}).filter(e=>!!e)}convertMessage(e){return e.type&&["ack","answer","question"].includes(e.type)&&e.role&&["user","assistant"].includes(e.role)&&e.content_type&&["card","image","text","object_string","file"].includes(e.content_type)&&e.content?{role:e.role,...this.convertContent(e.content_type,e.content||"",!0)}:null}convertShortcuts(e,t){let r;if("string"==typeof t)r=ej0(t);else{if("object"!=typeof t)return t;r=t}let a=e.find(e=>e.command_id===r.command_id);if(null==a?void 0:a.components_list){let e=new Map(a.components_list.filter(e=>e.parameter&&e.name).map(e=>[e.parameter,e.name]));Object.keys(r.parameters).forEach(t=>{let a=e.get(t),o=r.parameters[t];a&&(delete r.parameters[t],r.parameters[a]=o)})}return r}},eVq=(e,t)=>{try{return JSON.parse(e)}catch(e){return eiR.persist.error({error:e,eventName:eRe.parseJSON,message:"parse json fail"}),t??void 0}};function eVG(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class eVK extends Error{constructor(e,t,r){super(t),eVG(this,"eventName",void 0),eVG(this,"msg",void 0),eVG(this,"ext",void 0),this.eventName=e,this.msg=t,this.ext=r,this.name="CustomError",this.ext=r}}function eVW(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}eiR.createLoggerWith({ctx:{namespace:"bot-error",scope:"certain-error"}}),eiR.createLoggerWith({ctx:{namespace:"bot-error",scope:"use-error-catch"}}),eiR.createLoggerWith({ctx:{namespace:"bot-global-error"}}),new class{getLogID(){return{log_id:eo3.LAST_EXECUTE_ID}}getMetaCtx(){return{bot_id:this.botID,...this.getLogID()}}_clearTimeout(){this._timer&&(clearTimeout(this._timer),this._timer=void 0)}interrupt(){this._clearTimeout(),(this._receivingMessages||this._receivingSuggests)&&(this._receiveTotalMessagesEvent.success(),this._receivingMessages&&this.receiveMessageEvent.success(),this._receivingSuggests&&this.messageReceiveSuggestsEvent.success())}start(e){this.botID=e}constructor(){var e=this;eVW(this,"botID",""),eVW(this,"_timer",void 0),eVW(this,"_receivingMessages",!1),eVW(this,"_receivingSuggests",!1),eVW(this,"_hasReceiveFirstChunk",!1),eVW(this,"_hasReceiveFirstSuggestChunk",!1),eVW(this,"_messageTotalContent",0),eVW(this,"_executeDraftBotEvent",void 0),eVW(this,"_receiveMessagesEvent",void 0),eVW(this,"_messageReceiveSuggestsEvent",void 0),eVW(this,"_receiveTotalMessagesReportEvent",void 0),eVW(this,"_createExecuteDraftBotEvent",()=>eRt({eventName:eRe.botDebugMessageSubmit,meta:this.getMetaCtx()})),eVW(this,"_createReceiveMessagesEvent",()=>eRt({eventName:eRe.receiveMessage,meta:this.getMetaCtx()})),eVW(this,"_createMessageReceiveSuggestsEvent",()=>eRt({eventName:eRe.messageReceiveSuggests,meta:this.getMetaCtx()})),eVW(this,"_createReceiveTotalMessagesEvent",()=>eRt({eventName:eRe.receiveTotalMessages,meta:this.getMetaCtx()})),eVW(this,"_receiveMessagesEventGate",()=>this._receivingMessages),eVW(this,"_messageReceiveSuggestsEventGate",()=>this._receivingSuggests),eVW(this,"_receiveTotalMessagesEvent",{start:()=>{this._receiveTotalMessagesReportEvent=this._createReceiveTotalMessagesEvent()},error:e=>{var t,r;null==(t=this._receiveTotalMessagesReportEvent)||t.addDurationPoint("failed"),null==(r=this._receiveTotalMessagesReportEvent)||r.error({reason:e})},success:function(){var t,r;let a=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null==(t=e._receiveTotalMessagesReportEvent)||t.addDurationPoint("success"),null==(r=e._receiveTotalMessagesReportEvent)||r.success({meta:{reply_has_finished:a}})},finish:()=>{var e;null==(e=this._receiveTotalMessagesEvent)||e.success(!0)}}),eVW(this,"messageReceiveSuggestsEvent",{start:()=>{this._messageReceiveSuggestsEvent=this._createMessageReceiveSuggestsEvent(),this._receivingSuggests=!0,this._hasReceiveFirstSuggestChunk=!1},receiveSuggest:()=>{if(this._messageReceiveSuggestsEventGate()&&!this._hasReceiveFirstSuggestChunk){var e;null==(e=this._messageReceiveSuggestsEvent)||e.addDurationPoint("first"),this._hasReceiveFirstSuggestChunk=!0}},success:()=>{var e,t;this._messageReceiveSuggestsEventGate()&&(null==(e=this._messageReceiveSuggestsEvent)||e.addDurationPoint("success"),null==(t=this._messageReceiveSuggestsEvent)||t.success({meta:{reply_has_finished:!this._receivingSuggests}}),this._receivingSuggests=!1)},finish:()=>{this._messageReceiveSuggestsEventGate()&&(this.messageReceiveSuggestsEvent.success(),this._receiveTotalMessagesEvent.finish())},error:e=>{var t,r;let{error:a,reason:o}=e;this._messageReceiveSuggestsEventGate()&&(null==(t=this._messageReceiveSuggestsEvent)||t.addDurationPoint("failed"),null==(r=this._messageReceiveSuggestsEvent)||r.error({error:a,reason:o}),this._receivingSuggests=!1)}}),eVW(this,"receiveMessageEvent",{error:()=>{var e;this._receiveMessagesEventGate()&&(null==(e=this._receiveMessagesEvent)||e.addDurationPoint("failed"),this._receivingMessages=!1)},success:function(){var t,r;let a=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e._receiveMessagesEventGate()&&(null==(t=e._receiveMessagesEvent)||t.addDurationPoint("success"),null==(r=e._receiveMessagesEvent)||r.success({meta:{content_length:e._messageTotalContent,reply_has_finished:a}}),e._receivingMessages=!1)},start:()=>{this._receiveMessagesEvent=this._createReceiveMessagesEvent(),this._receivingMessages=!0,this._hasReceiveFirstChunk=!1,this._messageTotalContent=0,this._timer=setTimeout(this.receiveMessageEvent.error,12e4)},receiveMessage:e=>{var t,r;!this._receiveMessagesEventGate()||(e.content||eiN.errorEvent({eventName:eRe.emptyReceiveMessage,error:new eVK(eRe.emptyReceiveMessage,e.content||"empty content")}),this._messageTotalContent+=(null==(t=e.content)?void 0:t.length)??0,this._hasReceiveFirstChunk||(this._clearTimeout(),null==(r=this._receiveMessagesEvent)||r.addDurationPoint("first"),this._hasReceiveFirstChunk=!0))},finish:e=>{if(this._receiveMessagesEventGate()){let t;this.receiveMessageEvent.success(!0),"ext"in e&&vT(t=e.ext)&&"has_suggest"in t&&"1"===t.has_suggest?this.messageReceiveSuggestsEvent.start():this._receiveTotalMessagesEvent.finish()}}}),eVW(this,"executeDraftBotEvent",{start:()=>{this._executeDraftBotEvent=this._createExecuteDraftBotEvent(),this.interrupt()},success:()=>{var e,t;null==(e=this._executeDraftBotEvent)||e.addDurationPoint("finish"),null==(t=this._executeDraftBotEvent)||t.success({meta:{...this.getLogID()}}),this._receiveTotalMessagesEvent.start(),this.receiveMessageEvent.start()},error:e=>{var t;let{error:r,reason:a}=e;null==(t=this._executeDraftBotEvent)||t.error({error:r,reason:a,meta:{...this.getLogID()}})}})}},eyP().getParser(window.navigator.userAgent);var eVZ=i(88022),eVX=i.n(eVZ),eVY=i(41877),eV$=i.n(eVY),eVJ=i(76262),eV1=i.n(eVJ);function eV0(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}evj().extend(eVX()),evj().extend(eV$()),evj().extend(eV1()),new ve;class eV2{parse(e,t){let{terminate:r}=t,{data:a,event:o}=e;switch(o){case"conversation.chat.created":return this.createAckMessage(a);case"conversation.message.delta":{let e=this.createMessage(a,!1,!1);if(!e)return;return e}case"conversation.message.completed":{let e=this.createMessage(a,!0,!1);if(e&&"object"==typeof e&&"data"in e){let t=e.data;if(t&&"object"==typeof t&&"message"in t&&t.message&&"object"==typeof t.message){let e=t.message,r=e.message_id||e.reply_id||"";r&&(this.streamingJsonContent.delete(r),this.lastValidJsonContent.delete(r),this.lastReturnedParsedContent.delete(r),this.lastReturnedAccumulatedContent.delete(r))}}return e}case"conversation.chat.completed":case"done":return void r();case"conversation.chat.failed":{var i;let e=(null==(i=eVq(a).last_error)?void 0:i.msg)||bj.t("sendFailed");throw Ym.error(e),Error("Chat stream error")}case"error":{let e=eVq(a),t=(null==e?void 0:e.msg)||bj.t("sendFailed");throw Ym.error(t),Error("Chat stream error")}case"conversation.update":{let e=eVq(a);(null==e?void 0:e.conversation_id)&&(null==e?void 0:e.updates)&&this.onConversationUpdate&&this.onConversationUpdate({conversation_id:e.conversation_id,updates:e.updates,updated_at:e.updated_at||Date.now()});return}default:return}}createMessage(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=ej0(e);if(!a)return;let o=(null==a?void 0:a.type)||"";a.chat_id=a.chat_id&&"0"!==a.chat_id?a.chat_id:"",a.id=a.id&&"0"!==a.id?a.id:"";let i="object_string"===a.content_type&&"answer"===a.type;if(i&&a.content){let e=a.id||"";if(e){let o;r?(o=(this.streamingJsonContent.get(e)||"")+a.content,this.streamingJsonContent.set(e,o)):o=a.content;let i=o.trim();if(i.startsWith("[")&&i.endsWith("]"))try{let n=JSON.parse(i);if(Array.isArray(n)){let o=n;if(!t&&r){let t=this.lastValidJsonContent.get(e);if(t)try{let e=JSON.parse(t);if(Array.isArray(e)&&e.length>0&&n.length>0){let t=e[0],r=n[0];if("object"==typeof t&&null!==t&&"object"==typeof r&&null!==r&&"json"in t&&"json"in r&&"object"==typeof t.json&&null!==t.json&&"object"==typeof r.json&&null!==r.json){let e=this.mergeJsonObjects(t.json,r.json);o=[{...r,json:e},...n.slice(1)]}}}catch(e){}}let i=JSON.stringify(o);a.content=i,this.lastValidJsonContent.set(e,i)}else a.content=o}catch(s){let n=this.mergeStreamingArrays(i);if(null!==n){let o=n;if(!t&&r){let t=this.lastValidJsonContent.get(e);if(t)try{let e=JSON.parse(t);if(Array.isArray(e)&&e.length>0&&n.length>0){let t=e[0],r=n[0];if("object"==typeof t&&null!==t&&"object"==typeof r&&null!==r&&"json"in t&&"json"in r&&"object"==typeof t.json&&null!==t.json&&"object"==typeof r.json&&null!==r.json){let e=this.mergeJsonObjects(t.json,r.json);o=[{...r,json:e},...n.slice(1)]}}}catch(e){}}let i=JSON.stringify(o);a.content=i,this.lastValidJsonContent.set(e,i)}else a.content=o}else a.content=o}}let n=eVP.convertMessage(a,this.botId);if(n){if(i&&!t&&n.content_type===eny.Mix&&(!n.content||"undefined"===n.content)){let e=a.id||"",t=e?this.lastValidJsonContent.get(e):void 0;if(!t)return;n.content=t}if(i&&!t&&n.message_id){let e=a.id||"";if(e){let t=n.content||"",r=this.lastReturnedParsedContent.get(e)||"";if(t&&r&&t===r)return;t&&this.lastReturnedParsedContent.set(e,t)}}return t&&n.content_type===eny.Text&&"answer"===n.type&&(n.content=""),n.section_id=n.section_id||this.sectionId,{event:"message",data:{conversation_id:this.conversationId,index:this.getIndexNo(o),is_finish:t,seq_id:this.getSeqNo(),message:{...n,sender:this.botId}}}}}mergeJsonObjects(e,t){let r={...e};for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a)){let o=e[a],i=t[a];if("object"!=typeof o||null===o||Array.isArray(o)||"object"!=typeof i||null===i||Array.isArray(i))if("string"==typeof o&&"string"==typeof i)r[a]=o+i;else if(Array.isArray(o)&&Array.isArray(i)){let e=[...o];for(let t=0;t<i.length;t++){let r=i[t];if(t<e.length){let a=e[t];"object"!=typeof a||null===a||Array.isArray(a)||"object"!=typeof r||null===r||Array.isArray(r)?e[t]=r:e[t]=this.mergeJsonObjects(a,r)}else e.push(r)}r[a]=e}else r[a]=i;else r[a]=this.mergeJsonObjects(o,i)}return r}mergeStreamingArrays(e){if(!e||!e.trim().startsWith("["))return null;let t=e.trim(),r=[],a=0;for(;a<t.length;){for(;a<t.length&&/\s/.test(t[a]);)a++;if(a>=t.length||"["!==t[a])break;let e=0,o=!1,i=!1,n=-1;for(let r=a;r<t.length;r++){let a=t[r];if(i){i=!1;continue}if("\\"===a){i=!0;continue}if('"'===a){o=!o;continue}if(!o){if("["===a)e++;else if("]"===a&&0==--e){n=r;break}}}if(n>a)try{let e=t.substring(a,n+1),o=JSON.parse(e);Array.isArray(o)?r.push(...o):r.push(o),a=n+1}catch(e){break}else break}return r.length>0?r:null}tryParseStreamingJson(e){if(!e||""===e.trim())return null;let t=e.trim();try{let e=JSON.parse(t);return JSON.stringify(e)}catch(e){if(t.startsWith("[")){let e=0,r=0,a=!1,o=!1,i=-1;for(let n=0;n<t.length;n++){let s=t[n];if(o){o=!1;continue}if("\\"===s){o=!0;continue}if('"'===s){a=!a;continue}if(!a&&("["===s&&e++,"]"===s&&e--,"{"===s&&r++,"}"===s&&r--,0===e&&0===r&&n>0)){i=n;break}}if(i>0)try{let e=t.substring(0,i+1);return JSON.parse(e),e}catch(e){}}else if(t.startsWith("{")){let e=0,r=!1,a=!1,o=-1;for(let i=0;i<t.length;i++){let n=t[i];if(a){a=!1;continue}if("\\"===n){a=!0;continue}if('"'===n){r=!r;continue}if(!r&&("{"===n&&e++,"}"===n&&e--,0===e&&i>0)){o=i;break}}if(o>0)try{let e=t.substring(0,o+1);return JSON.parse(e),e}catch(e){}}return null}}createAckMessage(e){var t,r,a;let o=ej0(e);if(!o)return;let i=(null==o?void 0:o.id)!=="0"&&(null==o?void 0:o.id)?null==o?void 0:o.id:"",n=i||`--custom-replyId--${fK()}`,s=null==(r=o.inserted_additional_messages)||null==(t=r.lastItem)?void 0:t.id;return{event:"message",data:{conversation_id:this.conversationId,index:this.getIndexNo("ack"),is_finish:!0,message:{content:this.sendMessageContent,content_time:1e3*((null==o?void 0:o.created_at)||0),content_type:this.sendMessageContentType,extra_info:{local_message_id:this.localMessageId,chatflow_execute_id:null==o?void 0:o.execute_id,coze_api_message_id:s,coze_api_chat_id:i},message_id:n,reply_id:n,role:"user",section_id:(null==o?void 0:o.section_id)||this.sectionId,sender_id:null==(a=this.userInfo)?void 0:a.id,source:0,status:"",type:"ack"},seq_id:this.getSeqNo()}}}getSeqNo(){return this.seqNo++}getIndexNo(e){return this.indexNoMap[e]||(this.indexNoMap[e]=this.indexNo++),this.indexNoMap[e]}static getMessageParser(e){let{requestMessageRawBody:t,userInfo:r,sectionId:a,onConversationUpdate:o}=e,i=new eV2({requestMessageRawBody:t,userInfo:r,sectionId:a,onConversationUpdate:o});return(e,t)=>{let{terminate:r}=t,{type:a,event:o}=e;if("event"===a){let t=null==i?void 0:i.parse(e,{terminate:r});return["done","error","conversation.chat.failed"].includes(o)&&(i=void 0),t}}}constructor({requestMessageRawBody:e,userInfo:t,sectionId:r,onConversationUpdate:a}){eV0(this,"seqNo",0),eV0(this,"indexNo",0),eV0(this,"indexNoMap",{}),eV0(this,"conversationId",""),eV0(this,"localMessageId",""),eV0(this,"sendMessageContent",""),eV0(this,"sendMessageContentType",""),eV0(this,"botId",""),eV0(this,"sectionId",""),eV0(this,"botVersion",""),eV0(this,"userInfo",void 0),eV0(this,"onConversationUpdate",void 0),eV0(this,"streamingJsonContent",new Map),eV0(this,"lastValidJsonContent",new Map),eV0(this,"lastReturnedParsedContent",new Map),eV0(this,"lastReturnedAccumulatedContent",new Map),this.conversationId=e.conversation_id,this.localMessageId=e.local_message_id,this.sendMessageContent=e.query,this.sendMessageContentType=e.content_type,this.botId=e.bot_id,this.botVersion=e.bot_version,this.userInfo=t,this.sectionId=r||"",this.onConversationUpdate=a}}let eV3=async(e,t)=>{var r;let{code:a}=(null==e||null==(r=e.response)?void 0:r.data)||{},o=e;if(bG(a)){let r=await (null==t?void 0:t());if(r){let t={...e.config};t.headers={...t.headers},t.headers.Authorization=`Bearer ${r}`,o=await eo1.request(t)}}return o},eV4=e=>{let t;return{appLifeCycleService:{},messageLifeCycleService:(t="",{onSendMessageError:async r=>{var a,o,i,n,s,l,c;let d=r.error;if(bG((null==d||null==(a=d.ext)?void 0:a.code)||0)||(null==d||null==(o=d.stack)?void 0:o.includes("401"))){await (null==(n=e.pluginBizContext)||null==(i=n.refreshToken)?void 0:i.call(n));let a=r.message.message_id||(null==(l=r.message)||null==(s=l.extra_info)?void 0:s.local_message_id);a!==t&&(t=a,null==(c=e.pluginBizContext)||c.regenerateMessageByUserMessageId(a))}}}),commandLifeCycleService:{},renderLifeCycleService:{}}},eV6=e=>{let{messageGroup:t}=e,{isLatest:r}=t,{isShowFeedbackInLastGroup:a,cozeApiMessageId:o}=(e=>{var t;let r=ej8(e=>e.feedbackInfo),{useMessagesStore:a}=ey3(),{findMessage:o}=a.getState(),i=ej8(e=>e.lastGroupFeedbackInfo),{messageId:n}=i,s=o(n||""),l=null==s||null==(t=s.extra_info)?void 0:t.coze_api_message_id;return{isShowFeedbackInLastGroup:(0,gt.useMemo)(()=>!!i.isShowCustomPanel&&!!n&&"thumbDown"===r[l]&&e.memberSet.llmAnswerMessageIdList.includes(n),[r,i,e]),cozeApiMessageId:l}})(t);return r&&a&&o?(0,fU.jsx)("div",{className:"ml-[24px] mr-[24px]"}):null};var eV5=i(57759),eV7={};eV7.styleTagTransform=yj(),eV7.setAttributes=yB(),eV7.insert=yI().bind(null,"head"),eV7.domAPI=yO(),eV7.insertStyleElement=yH(),yC()(eV5.A,eV7);let eV8=eV5.A&&eV5.A.locals?eV5.A.locals:void 0,eV9=e=>{let{leftContent:t,rightContent:r,children:a}=e;return(0,fU.jsxs)("div",{className:eV8.container,children:[(0,fU.jsxs)("div",{className:eV8["icon-container"],children:[(0,fU.jsx)("div",{"data-testid":"chat-area.answer-action.left-content",className:eV8["left-content"],children:t}),(0,fU.jsx)("div",{"data-testid":"chat-area.answer-action.right-content",className:eV8["right-content"],children:r})]}),a]})};eV9.displayName="ActionBarContainer";var eqe=i(41054),eqt={};eqt.styleTagTransform=yj(),eqt.setAttributes=yB(),eqt.insert=yI().bind(null,"head"),eqt.domAPI=yO(),eqt.insertStyleElement=yH(),yC()(eqe.A,eqt);let eqr=eqe.A&&eqe.A.locals?eqe.A.locals:void 0,eqa=(0,gt.forwardRef)((e,t)=>{let{children:r,style:a}=e;return(0,fU.jsx)("div",{"data-testid":"chat-area.answer-action.hover-action-bar",className:yY()(eqr.container,["coz-stroke-primary","coz-bg-max"]),style:a,ref:t,children:r})}),eqo=e=>eTi().layout===GP.MOBILE?"custom":e;var eqi=i(58678),eqn={};eqn.styleTagTransform=yj(),eqn.setAttributes=yB(),eqn.insert=yI().bind(null,"head"),eqn.domAPI=yO(),eqn.insertStyleElement=yH(),yC()(eqi.A,eqn),eqi.A&&eqi.A.locals&&eqi.A.locals;var eqs=((eN={}).TtsVoiceWs="chat_answer_action_start_TTS",eN.ReportMessage="chat_answer_action_message_feedback",eN.CopyTextMessage="chat_answer_action_copy_text_message",eN);let eql=e=>{let{className:t,isMustGroupLastAnswerMessage:r=!0,isUseExternalContent:a=!1,externalContent:o,...i}=e,{reporter:n}=eF0(),{message:s,meta:l}=eIW(),c=a?o||"":s.content,[d,u]=(0,gt.useState)(!1),p=eqo("hover");if(!ewD(s)||!l.isGroupLastAnswerMessage&&r)return null;let h=yY()(t,"w-[14px] h-[14px]");return(0,fU.jsx)($l,{content:d?bj.t("copied"):bj.t("copy"),trigger:p,children:(0,fU.jsx)(Yx,{"data-testid":"chat-area.answer-action.copy-button",size:"small",icon:d?(0,fU.jsx)(Zf,{className:h}):(0,fU.jsx)(W6,{className:h}),color:"secondary",onClick:()=>{ed_()(c)?(u(!0),setTimeout(()=>u(!1),3e3),Ym.success({content:bj.t("copy_success"),showClose:!1,duration:3}),n.successEvent({eventName:eqs.CopyTextMessage})):(Ym.warning({content:bj.t("copy_failed"),showClose:!1,duration:3}),n.errorEvent({eventName:eqs.CopyTextMessage,...esb("copy_text_message_error","copy_text_message_error")}))},...i})})},eqc=()=>{try{return eF6(eji.MessageGrab)}catch(e){return null}},eqd=e=>{let t=eqc(),{message:r}=eIW();return t&&r.source!==env.Notice?(0,fU.jsx)(equ,{...e}):null},equ=e=>{let{className:t,...r}=e,a=eqc(),{chatAreaPluginContext:o,pluginBizContext:i}=a,{useDeleteFile:n}=a.chatAreaPluginContext.writeableHook.file,{getFileStoreInstantValues:s}=o.readonlyAPI.batchFile,{useQuoteStore:l}=i.storeSet,{onQuote:c}=i.eventCallbacks,{updateQuoteContent:d,updateQuoteVisible:u}=l.getState(),{message:p,meta:h}=eIW(),{content:m,content_type:f}=p,g=eqo("hover"),_=n(),b=ewD(p),v=ewC(p);return(b||v)&&h.isGroupLastAnswerMessage&&a?(0,fU.jsx)($l,{content:bj.t("quote_ask_in_chat"),trigger:g,children:(0,fU.jsx)(Yx,{"data-testid":"chat-area.answer-action.quote-message",size:"small",icon:(0,fU.jsx)(Zd,{className:yY()(t,"w-[14px] h-[14px]")}),onClick:()=>{if((()=>{let{fileIdList:e}=s();e.forEach(e=>_(e))})(),f===eny.Image){let e=es_({str:m,verifyStruct:e=>e instanceof Object&&"image_list"in e,onParseError:e=>{esy(e.message)},onVerifyError:e=>{esy(e.message)}});d((null==e?void 0:e.image_list.map(e=>({type:eNk.IMAGE,src:e.image_ori.url,children:[]})))??[])}else d(eNH(efF(m)));null==c||c({botId:p.sender_id??"",source:p.source}),u(!0)},color:"secondary",...r})}):null};eqd.displayName="QuoteMessage";var eqp=i(29211),eqh={};eqh.styleTagTransform=yj(),eqh.setAttributes=yB(),eqh.insert=yI().bind(null,"head"),eqh.domAPI=yO(),eqh.insertStyleElement=yH(),yC()(eqp.A,eqh),eqp.A&&eqp.A.locals&&eqp.A.locals;let eqm=()=>{var e,t;let{message:r}=eIW(),{chatConfig:a}=ej7(),o=r.extra_info.coze_api_message_id,i=r.extra_info.coze_api_chatId_id;return{messageId:r.message_id,cozeApiMessageId:o,cozeApiChatId:i,isShowDelete:!1,isNeedQuote:(null==(t=a.ui)||null==(e=t.chatBot)?void 0:e.isNeedQuote)??!1}},eqf=e=>{var t,r;let{className:a,...o}=e,{useGlobalInitStore:i}=ey3(),{groupId:n}=eIW(),s=(e=>{let{useChatActionStore:t}=ey3();return t(t=>eMp.deleteMessageGroup(e,t.answerActionLockMap,t.globalActionLock))})(n),{chatConfig:l}=ej7(),c=(()=>{let e=ey3(),t=eM_(),{cozeApiSdk:r}=eVM();return async(a,o)=>{var i;if(!o||!a)return;let{useMessagesStore:n,useSuggestionsStore:s}=e,{findMessage:l,isLastMessageGroup:c}=n.getState(),{clearSuggestions:d}=s.getState(),u=l(o),p=null==u?void 0:u.reply_id,h=null==u||null==(i=u.extra_info)?void 0:i.coze_api_message_id;if(!u||!p)throw Error(`message not found, id: ${o}`);if(t.answerAction.getIsLock(p,"deleteMessageGroup"))return;t.answerAction.lock(p,"deleteMessageGroup");let m=c(p),{deleteMessageById:f}=n.getState();try{await (null==r?void 0:r.conversations.messages.delete(a,h)),f(o),m&&d()}catch(e){console.error(e),Ym.error(bj.t("Delete_failed"))}finally{t.answerAction.unlock(p,"deleteMessageGroup")}}})(),d=i(e=>e.conversationId),{messageId:u,cozeApiMessageId:p,isShowDelete:h}=eqm(),m=(null==(r=l.ui)||null==(t=r.base)?void 0:t.layout)===fW.MOBILE?"custom":"hover";return p&&h&&u?(0,fU.jsx)($l,{trigger:m,content:bj.t("Delete"),children:(0,fU.jsx)(Yx,{"data-testid":"chat-area.answer-action.delete-message-button",disabled:s,size:"small",icon:(0,fU.jsx)(Zr,{className:yY()("coz-fg-hglt-red",a,"w-[14px] h-[14px]")}),onClick:()=>{c(d||"",u)},color:"secondary",...o})}):null},eqg=()=>{let{meta:e}=eIW(),{message:t}=eIW(),{readonly:r}=ej7();return e.isGroupLastMessage&&e.isFromLatestGroup&&(null==t?void 0:t.type)==="answer"||r?null:(0,fU.jsx)(eq_,{})},eq_=()=>{let e=(0,gt.useRef)(null),t=(0,gt.useRef)(null),{message:r}=eIW(),{showHoverText:a,isMultiMessage:o}=(()=>{let e,{meta:t,message:r}=eIW(),a="answer"===r.type&&(!t.isFromLatestGroup||!t.isGroupLastAnswerMessage),o=!1;if("question"===r.type||"ack"===r.type){if(ewD(r))e=r.content;else if((null==r?void 0:r.content_type)===eny.Mix){var i;let t=ej0(r.content);e=null==t?void 0:t.item_list.map(e=>"text"===e.type&&e.text||"").filter(e=>!!e).join("\n"),o=((null==t||null==(i=t.item_list)?void 0:i.length)||0)>1}}else a&&ewD(r)&&(e=r.content);return{showHoverText:e,isMultiMessage:o}})(),{isShowDelete:i,isNeedQuote:n}=eqm(),s=i||!!a,l="answer"===r.type&&!!a&&n,{width:c}=een(t)||{},d=(0,gt.useMemo)(()=>{var e,r;let a=null==(r=t.current)||null==(e=r.closest(".coze-chat-hover-message-wrapper"))?void 0:e.clientWidth;return a&&o?(a+=44,c&&a&&c>a?c-a:0):0},[c]);return s?(console.log("actionBarSize:",{actionBarSize:c,actionBarLeft:d}),(0,fU.jsxs)(fU.Fragment,{children:[(0,fU.jsx)("div",{className:yY()("w-full flex",o?"justify-start":"justify-end"),style:{},children:(0,fU.jsxs)(eqa,{style:{width:"fit-content",zIndex:2,position:"relative",left:d},ref:t,children:[a?(0,fU.jsx)(eql,{wrapperClass:"flex justify-center items-center",isUseExternalContent:!0,externalContent:a,isMustGroupLastAnswerMessage:!1}):null,i?(0,fU.jsx)(eqf,{}):null,l?(0,fU.jsx)(eqd,{}):null]})}),(0,fU.jsx)("div",{ref:e,style:{width:0,height:0,position:"relative"}})]})):null},eqb=()=>{let{lastMessageText:e}=(()=>{let{groupId:e}=eIW(),{useMessagesStore:t}=ey3(),r=t(e=>e.messageGroupList,enB),a=t(e=>e.messages,enB),o=t(e=>e.findMessage,enB);return{lastMessageText:(0,gt.useMemo)(()=>{let t=r.find(t=>t.groupId===e);return null==t?void 0:t.memberSet.llmAnswerMessageIdList.map(e=>{let t=o(e);return ewD(t)?t.content:""}).filter(e=>!!e).reverse().join("\n")},[r,a,o,e])}})(),t=ej9(),{isShowDelete:r,isNeedQuote:a}=eqm(),o=t?"!coz-fg-images-white":"";return e||r?(0,fU.jsx)(eV9,{leftContent:[!!e&&(0,fU.jsx)(eql,{className:o,isUseExternalContent:!0,externalContent:e},"copy"),r&&(0,fU.jsx)(eqf,{className:yY()(o)},"delete"),!!e&&a&&(0,fU.jsx)(eqd,{className:yY()(o)})],rightContent:[]}):null},eqv=e=>{let{refreshContainerWidth:t}=e,{meta:r}=eIW(),{message:a}=eIW(),{useWaitingStore:o}=ey3(),{readonly:i}=ej7(),n=o(e=>!!e.waiting),s="answer"===a.type,l=r.isGroupLastMessage&&r.isFromLatestGroup;return((0,gt.useEffect)(()=>{t()},[]),!l||!s||n||i)?null:(0,fU.jsx)(eqb,{})};var eqy=i(46146),eqT={};eqT.styleTagTransform=yj(),eqT.setAttributes=yB(),eqT.insert=yI().bind(null,"head"),eqT.domAPI=yO(),eqT.insertStyleElement=yH(),yC()(eqy.A,eqT);let eqk=eqy.A&&eqy.A.locals?eqy.A.locals:void 0,eqw=e=>{let{messageType:t,classname:r,showUserInfo:a,...o}=e;return(0,fU.jsx)(ev$,{...o,classname:yY()(r,"w-full"),showUserInfo:a??!1,isHoverShowUserInfo:!1,messageBoxWrapperClassname:yY()("coze-chat-message-wrapper",eqk["message-box-wrapper"]),messageHoverWrapperClassName:"w-full flex justify-end right-[0px] coze-chat-hover-message-wrapper"})};function eqQ(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class eqx extends ejo{static createCustomComponents(e){let t;return{UIKitMessageBoxPlugin:(console.log("[createUIKitMessageBoxPlugin] bizContext:",{showUserInfo:t=e.showUserInfo,bizContext:e}),e=>{let{messageType:r,classname:a,showUserInfo:o,...i}=e,n=void 0!==t?t:o??!1;return console.log("[UIKitMessageBoxPlugin] render:",{configuredShowUserInfo:t,propsShowUserInfo:o,finalShowUserInfo:n}),(0,fU.jsx)(ev$,{...i,classname:yY()(a,"w-full"),showUserInfo:n,isHoverShowUserInfo:!1,messageBoxWrapperClassname:yY()("coze-chat-message-wrapper",eqk["message-box-wrapper"]),messageHoverWrapperClassName:"w-full flex justify-end right-[0px] coze-chat-hover-message-wrapper"})}),MessageGroupFooter:eV6,MessageBoxFooter:eqv,MessageBoxHoverSlot:eqg}}constructor(...e){super(...e),eqQ(this,"pluginMode",eFp.Writeable),eqQ(this,"pluginName",eji.WebsdkChatCozeSdkPlugin),eqQ(this,"lifeCycleServices",ejn(this,eV4)),eqQ(this,"customComponents",{UIKitMessageBoxPlugin:eqw,MessageGroupFooter:eV6,MessageBoxFooter:eqv,MessageBoxHoverSlot:eqg})}}var eqz=((eU={}).OnBackgroundChange="onBackgroundChange",eU),eqA=i(17684),eqE={};eqE.styleTagTransform=yj(),eqE.setAttributes=yB(),eqE.insert=yI().bind(null,"head"),eqE.domAPI=yO(),eqE.insertStyleElement=yH(),yC()(eqA.A,eqE);let eqD=eqA.A&&eqA.A.locals?eqA.A.locals:void 0,eqS=e=>{var t;let{headerNode:r}=e,{useChatBackgroundContext:a}=(e=>{let{usePluginStore:t}=ey3(),{pluginName:r}=ey5(),a=t(b7(t=>t.pluginInstanceList.find(t=>t.pluginName===(e??r))));if(!a)throw Error("cannot find target plugin");if(a.pluginMode===eFp.Readonly)return a;throw Error(`cannot find target readonly plugin, please confirm ${e} is readonly mode plugin`)})(eji.ChatBackground).pluginBizContext.storeSet,o=a(b7(e=>e.backgroundImageInfo));return(null==o||null==(t=o.mobile_background_image)?void 0:t.origin_image_url)?(0,fU.jsxs)(fU.Fragment,{children:[r?(0,fU.jsx)("div",{className:eqD.mask}):null,(0,fU.jsx)(eyM,{backgroundInfo:o})]}):null};function eqC(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let eqL=e=>({appLifeCycleService:{onBeforeInitial:()=>{let{chatBackgroundEvent:t,storeSet:r}=e.pluginBizContext,{setBackgroundInfo:a}=r.useChatBackgroundContext.getState();t.on(eqz.OnBackgroundChange,e=>{a(e)})},onAfterInitial:t=>{let{setBackgroundInfo:r,clearBackgroundStore:a}=e.pluginBizContext.storeSet.useChatBackgroundContext.getState(),o=t.messageListFromService.backgroundInfo;o?r(o):a()},onBeforeDestroy:()=>{let{chatBackgroundEvent:t}=e.pluginBizContext;t.all.clear()}}});class eqO extends eja{constructor(...e){super(...e),eqC(this,"pluginMode",eFp.Readonly),eqC(this,"pluginName",eji.ChatBackground),eqC(this,"lifeCycleServices",ejs(this,eqL)),eqC(this,"customComponents",{MessageListFloatSlot:eqS})}}let eqM=GR(),eqI=(0,gt.forwardRef)((e,t)=>{var r,a;let{children:o}=e,{chatConfig:i}=ej7(),{updateCurrentConversationInfo:n,currentConversationInfo:s,updateConversations:l,conversations:c}=ej8(b7(e=>({updateCurrentConversationInfo:e.updateCurrentConversationInfo,currentConversationInfo:e.currentConversationInfo,updateConversations:e.updateConversations,conversations:e.conversations}))),{useGlobalInitStore:d,useSectionIdStore:u}=ey3(),p=d(e=>e.setConversationId),h=d(e=>e.conversationId),m=u(e=>e.latestSectionId),f=d(e=>e.chatCore),g=WG((e,t)=>{var r,a;if((null==(a=i.ui)||null==(r=a.conversations)?void 0:r.isNeed)&&s){let r=Math.floor(Date.now()/1e3),a={id:e,last_section_id:t,updated_at:r,created_at:r,meta_data:{}};if(n({...s,...a}),c.find(t=>t.id===e)||l([a],"add"),p(e),null==f||f.updateConversationId(e),t){let{setLatestSectionId:e}=u.getState();e(t)}}else if(p(e),null==f||f.updateConversationId(e),t){let{setLatestSectionId:e}=u.getState();e(t)}}),_=WG(()=>h||""),b=WG(()=>m||""),v=(0,gt.useRef)(void 0),y=(0,gt.useRef)(void 0),T=(0,gt.useMemo)(()=>null==s?void 0:s.id,[null==s?void 0:s.id]),k=(0,gt.useMemo)(()=>null==s?void 0:s.last_section_id,[null==s?void 0:s.last_section_id]),w=WG((e,t)=>{if(e&&e!==t){let{setLatestSectionId:t}=u.getState();t(e)}}),Q=WG((e,t,r)=>{let a=void 0===r.prevIdRef.current&&void 0===r.prevSectionIdRef.current,o=!a&&e!==r.prevIdRef.current,i=!a&&t!==r.prevSectionIdRef.current;return a||o||i?(r.prevIdRef.current=e,r.prevSectionIdRef.current=t,!1):(r.prevIdRef.current=e,r.prevSectionIdRef.current=t,!0)}),x=WG((e,t,r)=>{r||p(e),null==f||f.updateConversationId(e),w(t,m)});(0,gt.useEffect)(()=>{var e,t;if(!T||!(null==(t=i.ui)||null==(e=t.conversations)?void 0:e.isNeed))return;let r=k||s.sectionId||"";w(r,m),Q(T,r,{prevIdRef:v,prevSectionIdRef:y})||T!==h&&x(T,r,""===h||null===h)},[T,k,h,m,p,f,null==(a=i.ui)||null==(r=a.conversations)?void 0:r.isNeed,w,Q,x,s]),(()=>{let e=(0,gt.useRef)(),{updateCurrentConversationNameByMessage:t,currentConversationInfo:r}=ej8(b7(e=>({updateCurrentConversationNameByMessage:e.updateCurrentConversationNameByMessage,currentConversationInfo:e.currentConversationInfo}))),{chatConfig:{type:a}}=ej7(),o=a===fZ.APP,{useMessagesStore:i}=ey3(),n=i(e=>e.messages,enB);(0,gt.useEffect)(()=>{o?e.current=null==r?void 0:r.title:e.current=null==r?void 0:r.name},[r,o]),(0,gt.useEffect)(()=>{let a=n[n.length-1],o=null==a?void 0:a.content.slice(0,100);a&&!e.current&&(null==r?void 0:r.id)&&""!==r.id.trim()&&(t(o),e.current=o)},[n,r,t])})();let z=(()=>{let e=eM5(),{useMessagesStore:t}=ey3();return async r=>{let{messageGroupList:a}=t.getState(),o=a.find(e=>{let{memberSet:t}=e;return t.userMessageId===r});if(!o)throw Error("regenerate message error: failed to get message");await e(o)}})();(0,gt.useImperativeHandle)(t,()=>({regenerateMessageByUserMessageId:z,setConversationId:g,getConversationId:_,getSectionId:b}),[z,g,_,b]);let A=(e=>{let{usePluginStore:t}=ey3(),r=t(b7(t=>t.pluginInstanceList.find(t=>t.pluginName===e)));return r?r.publicMethods:null})(eji.MessageGrab);return(0,gt.useEffect)(()=>{A&&A.updateEnableGrab(!0)},[]),(0,fU.jsx)(fU.Fragment,{children:o})}),eqP=e=>{var t,r,a,o,i;let{children:n,plugins:s}=e,l=(0,gt.useRef)(!1),{refreshToken:c}=eVM(),{initError:d,setInitError:u}=ej8(b7(e=>({initError:e.initError,setInitError:e.setInitError}))),p=(0,gt.useRef)(),{chatConfig:h,onImageClick:m,initErrorFallbackFC:f}=ej7(),g=eUc(),_=g&&g.id?g:{id:fK(),nickname:"",url:"",userUniqueName:"",userLabel:null};console.log("ChatProviderImpl: userInfo",{userInfo:_,hasId:!!(null==_?void 0:_.id)});let b=(()=>{var e;let{chatConfig:t,openRequestInit:r,defaultHistoryMessage:a=[],onDefaultHistoryClear:o}=ej7(),{cozeApiSdk:i}=eVM(),n=ej8(e=>e.setInitError),s=ej8(e=>e.setDefaultInputMode),l=ej8(e=>e.updateShortcuts),c=ej8(e=>e.setIsStartBotVoiceCall),d=ej8(e=>e.updateBackgroundInfo),{updateCurrentConversationInfo:u}=ej8(b7(e=>({updateCurrentConversationInfo:e.updateCurrentConversationInfo}))),p=(0,gt.useRef)(),h=(0,gt.useRef)([]);ej8(b7(e=>(p.current=e.currentConversationInfo,h.current=e.conversations,null)));let m=eVB(),f=(null==t||null==(e=t.auth)?void 0:e.connectorId)||"",{bot_id:g="",type:_,appInfo:b}=t,v=eUc();return(0,gt.useCallback)(async()=>{if(!i)return{};try{let{conversationId:e,sectionId:t,conversationName:n,botOnlineInfo:y}=await eVF({cozeApiSdk:i,openRequestInit:r})||{},[T,k]=await Promise.all([y||eVR({botId:g,cozeApiSdk:i,connectorId:f}),eVH({botId:g,cozeApiSdk:i,conversationId:e,sectionId:t,connectorId:f,onDefaultHistoryClear:o,defaultHistoryMessage:a,chatType:_,appInfo:b})]),w=(T.prologue||"").replaceAll("{{user_name}}",(null==v?void 0:v.nickname)||"");c(T.defaultInputMode===ej3.VoiceCall),s(T.defaultInputMode||ej3.Text),l(T.shortcuts||[]),console.log("requestDataBotInfo.shortcuts:",T.shortcuts),d(T.backgroundInfo),T.isCustomBackground&&(T.backgroundInfo=void 0),console.log("[result]2:",T);let Q=k.conversationId,x=k.lastSectionId||"",z=n||"",A=p.current,E=h.current;if(Q)if(A&&""===A.id)console.log("useRequestInit: Skipping currentConversationInfo update because id is empty (new conversation being created)",{actualConversationId:Q,currentConversationInfoId:A.id});else if(A&&A.id===Q){let e={};A.last_section_id!==x&&x&&(e.last_section_id=x),Object.keys(e).length>0&&u({...A,...e})}else{let e=E.find(e=>e.id===Q);e?u({...e,last_section_id:x||e.last_section_id||"",name:z||e.name||"",conversationListVisible:(null==A?void 0:A.conversationListVisible)??!1,isLargeWidth:(null==A?void 0:A.isLargeWidth)??!1}):A?u({...A,id:Q,last_section_id:x||A.last_section_id||"",name:z||A.name||""}):u({id:Q,last_section_id:x,name:z||"",created_at:Math.floor(Date.now()/1e3),updated_at:Math.floor(Date.now()/1e3),meta_data:{},conversationListVisible:!1,isLargeWidth:!1})}v&&v.id||console.error("useRequestInit: userInfo is invalid",{userInfo:v});let D=(null==v?void 0:v.id)?{[v.id]:v}:void 0;return console.log("useRequestInit: returning userInfoMap",{userInfo:v,userInfoMap:D,hasUserId:!!(null==v?void 0:v.id)}),{...T,...k,prologue:w,messageList:m(k.conversationId||"",k.messageList),userInfoMap:D}}catch(t){console.error("useRequestInit error",t);let{code:e}=t||{};e?n({code:e,msg:""}):n({code:-1,msg:""})}},[g,i,a,o,_,b,u,v,r])})(),v=(e=>{let{refChatFunc:t}=e,{chatConfig:r}=ej7(),{tokenManager:a}=eVM(),o=(e=>{let{refChatFunc:t}=e,r=eUc(),{refreshToken:a}=eVM(),{apiUrl:o}=ej8(b7(e=>({apiUrl:e.apiUrl}))),i=(()=>{let{chatConfig:{type:e}}=ej7();return(0,gt.useMemo)(()=>{let t=e===fZ.APP,r=[e=>{let{data:t}=e,{code:r,data:a}=t;return{...e,data:{code:r,new_section_id:a.id}}}];return{url:t?"/v1/workflow/conversations/:conversation_id/clear":"/v1/conversations/:conversation_id/clear",hooks:{onBeforeRequest:[e=>{let r=e.data.conversation_id,a=t?`/v1/workflow/conversations/${r}/clear`:`/v1/conversations/${r}/clear`;return{...e,url:a,data:{conversation_id:r}}}],onErrorResponse:r,onAfterResponse:r}}},[e])})(),n=((e,t)=>{var r;let{debug:a,chatConfig:o}=ej7(),{shortcuts:i,apiUrl:n,updateConversations:s,updateCurrentConversationInfo:l,currentConversationInfo:c,conversations:d,cozeApi:u}=ej8(b7(e=>({shortcuts:e.shortcuts,apiUrl:e.apiUrl,updateConversations:e.updateConversations,updateCurrentConversationInfo:e.updateCurrentConversationInfo,currentConversationInfo:e.currentConversationInfo,conversations:e.conversations,cozeApi:e.cozeApi}))),{cozeApiSdk:p}=eVM(),h=(0,gt.useRef)(o),m=(0,gt.useRef)(""),f=(0,gt.useRef)(i),g=(0,gt.useRef)(s),_=(0,gt.useRef)(l),b=(0,gt.useRef)(c),v=(0,gt.useRef)(d),y=(0,gt.useRef)(null);f.current=i,m.current=(null==o||null==(r=o.auth)?void 0:r.connectorId)||"",h.current=o,g.current=s,_.current=l,b.current=c,v.current=d;let T=(0,gt.useRef)(null);T.current=e=>{let{conversation_id:t,updates:r,updated_at:a}=e;if(!t||!r)return;let o=b.current,i=g.current,n=_.current,{title:s}=r;if(void 0!==s){var l;i&&i([{id:t,name:s,title:s,updated_at:Math.floor(a/1e3)}],"update");let e=v.current.find(e=>e.id===t),r=(null==o?void 0:o.id)===t,c=(null==(l=y.current)?void 0:l.conversationId)===t;if(r||c){if(o)(o.title!==s||o.name!==s)&&n({...o,name:s,title:s,updated_at:Math.floor(a/1e3)});else if(e)n({...e,name:s,title:s,updated_at:Math.floor(a/1e3),conversationListVisible:!1,isLargeWidth:!1});else if(c&&y.current){let e=y.current,t=b.current;n({id:e.conversationId,last_section_id:e.sectionId,name:s,title:s,created_at:Math.floor(Date.now()/1e3),updated_at:Math.floor(a/1e3),meta_data:{},conversationListVisible:(null==t?void 0:t.conversationListVisible)??!1,isLargeWidth:(null==t?void 0:t.isLargeWidth)??!1})}}}};let k=n||f1;return{url:"/v3/chat",hooks:{onBeforeSendMessage:[async t=>{var r,o,i,n,s,l;console.log("onBeforeSendMessage: Hook called",{originalUrl:t.url,originalBody:null==(r=t.body)?void 0:r.substring(0,200),headers:t.headers});let c=ej0(t.body)||{},d=c.conversation_id||"";if(console.log("onBeforeSendMessage: Initial conversationId",d,{hasCozeApi:!!u,hasChatConfig:!!h.current}),!d){let e=u||p;if(!e)throw console.error("onBeforeSendMessage: cozeApi is not available, cannot create conversation",{cozeApiFromStore:!!u,cozeApiSdkFromContext:!!p}),Error("cozeApi is required for creating conversation before sending message");if(!h.current)throw console.error("onBeforeSendMessage: refChatConfig.current is not available, cannot create conversation"),Error("chatConfig is required for creating conversation before sending message");try{let t=h.current.type===fZ.APP,{appInfo:r}=h.current,a=h.current.bot_id;if(t&&!(null==r?void 0:r.appId)||!t&&!a)throw Error(`Missing required ID: ${t?"appId":"botId"}`);console.log("onBeforeSendMessage: Creating conversation...");let o=await eVN(e,{projectType:t?"app":"bot",projectId:t?(null==r?void 0:r.appId)||"":a||"",workflowId:null==r?void 0:r.workflowId,mode:(null==r?void 0:r.draft_mode)?"draft":"release",connectorId:m.current});if(console.log("onBeforeSendMessage: Conversation created",{conversationId:o.conversationId,sectionId:o.sectionId,conversationName:o.conversationName}),!o.conversationId)throw Error("Failed to create conversation: empty conversationId");if(d=o.conversationId,y.current={conversationId:o.conversationId,sectionId:o.sectionId||"",conversationName:o.conversationName},!v.current.find(e=>e.id===o.conversationId)&&g.current){let e={id:o.conversationId,last_section_id:o.sectionId||"",name:o.conversationName||"",created_at:Math.floor(Date.now()/1e3),updated_at:Math.floor(Date.now()/1e3),meta_data:{},...t&&{title:""}};g.current([e],"add"),console.log("onBeforeSendMessage: Conversation added to list immediately",{conversationId:o.conversationId,conversationName:o.conversationName})}console.log("onBeforeSendMessage: Conversation created, will update currentConversationInfo after stream completes",{conversationId:o.conversationId}),y&&(y.current={conversationId:o.conversationId,sectionId:o.sectionId||""}),c.conversation_id=d,console.log("onBeforeSendMessage: Conversation created and selected, ready to send message",{conversationId:d,pendingInfo:y.current})}catch(e){throw console.error("Failed to create conversation:",e),Error(`Failed to create conversation before sending message: ${e instanceof Error?e.message:String(e)}`)}}if(!d||""===d.trim())throw console.error("onBeforeSendMessage: conversationId is empty after creation"),Error("conversationId is required for sending message");let _=`${k}/v1/workflows/chat?conversation_id=${d}`,b=(null==(o=h.current)?void 0:o.type)===fZ.APP?null==(i=h.current.appInfo)?void 0:i.parameters:null==(n=h.current.botInfo)?void 0:n.parameters,T=JSON.stringify({...ej0(t.body),conversation_id:d}),w=eVV.convertRequestBody({body:T,userInfo:e,connectorId:m.current,parameters:b,shortcuts:f.current});console.log("onBeforeSendMessage: Final config",{url:_,conversationId:d,hasBody:!!w,bodyLength:null==w?void 0:w.length}),Object.keys((null==a?void 0:a.cozeApiRequestHeader)||{}).forEach(e=>{var r;t.headers.push([e,(null==a||null==(r=a.cozeApiRequestHeader)?void 0:r[e])||""])}),t.headers.push(["Accept-Language","zh-CN"===bj.language?"zh":"en"]);let Q={...t,body:w,url:_,method:t.method||"POST",headers:t.headers||[]};return console.log("onBeforeSendMessage: Returning config",{url:Q.url,conversationId:d,hasBody:!!Q.body,bodyLength:null==(s=Q.body)?void 0:s.length,method:Q.method,headersCount:(null==(l=Q.headers)?void 0:l.length)||0,headers:Q.headers}),Q}],onGetMessageStreamParser:r=>{var a;let o=eV2.getMessageParser({requestMessageRawBody:r,userInfo:e,sectionId:null==t||null==(a=t.current)?void 0:a.getSectionId(),onConversationUpdate:T.current||void 0});if(y.current&&o){let e=!1,r=!1,a=y.current;return(i,n)=>{if(!o)return;let s=o(i,n),{type:l,event:c}=i;if("event"===l&&"conversation.chat.created"===c&&!e&&a.conversationId&&(e=!0,console.log("onGetMessageStreamParser: Updating conversation list and currentConversationInfo after CHAT_CREATED",{conversationId:a.conversationId}),!v.current.find(e=>e.id===a.conversationId))){let e=h.current.type===fZ.APP,t={id:a.conversationId,last_section_id:a.sectionId,name:a.conversationName||"",created_at:Math.floor(Date.now()/1e3),updated_at:Math.floor(Date.now()/1e3),meta_data:{},...e&&a.conversationName&&{title:a.conversationName}};g.current&&g.current([t],"add")}if("event"===l&&"done"===c&&!r&&a.conversationId){var d;if(r=!0,console.log("onGetMessageStreamParser: Updating currentConversationInfo and chatCore after stream done",{conversationId:a.conversationId}),(null==(d=b.current)?void 0:d.id)===a.conversationId)return console.log("onGetMessageStreamParser: Conversation ID already matches, only updating chatCore",{conversationId:a.conversationId}),(null==t?void 0:t.current)&&t.current.setConversationId(a.conversationId,a.sectionId),y.current=null,s;setTimeout(()=>{if(_.current){let e=b.current;_.current({id:a.conversationId,last_section_id:a.sectionId,name:"",created_at:Math.floor(Date.now()/1e3),updated_at:Math.floor(Date.now()/1e3),meta_data:{},conversationListVisible:(null==e?void 0:e.conversationListVisible)??!1,isLargeWidth:(null==e?void 0:e.isLargeWidth)??!1})}(null==t?void 0:t.current)&&t.current.setConversationId(a.conversationId,a.sectionId),y.current=null},0)}return s}}return o}}}})(r||void 0,t),s=(e=>{var t;let{refChatFunc:r}=e,{chatConfig:a}=ej7(),o=(0,gt.useRef)("");return o.current=(null==a||null==(t=a.auth)?void 0:t.connectorId)||"",(0,gt.useMemo)(()=>{let e=[e=>{var t;let{data:a}=e,{code:o,data:i}=a,{id:n,last_section_id:s}=i||{};return null==r||null==(t=r.current)||t.setConversationId(n,s),{...e,data:{code:o,new_section_id:s}}}];return{url:"/v1/workflow/conversation/create",method:"POST",hooks:{onBeforeRequest:[e=>{let t=e.data.bot_id;return{...e,data:{bot_id:t,connector_id:o.current}}}],onErrorResponse:e,onAfterResponse:e}}},[])})({refChatFunc:t}),l=(()=>{let{debug:e}=ej7();return[t=>(t.headers.delete("x-requested-with"),Object.keys((null==e?void 0:e.cozeApiRequestHeader)||{}).forEach(r=>{var a;t.headers.set(r,(null==e||null==(a=e.cozeApiRequestHeader)?void 0:a[r])||"")}),t)]})(),c=(0,gt.useMemo)(()=>[async e=>eV3(e,a),e=>e.config.url&&/^\/v1\/conversations\/[^\\]+\/clear$/.test(e.config.url)?{...e,config:{...e.config,url:"/v1/conversations/:conversation_id/clear"}}:e],[a]),d=(0,gt.useMemo)(()=>[async e=>eV3(e,a)],[a]),u=(()=>{let e=eVB(),{chatConfig:t}=ej7(),{bot_id:r}=t||{},{refMessageListLeft:a}=eVM();return(0,gt.useMemo)(()=>{let t=[t=>{var o,i,n,s,l,c;let{data:d}=t,u=null==(i=t.config)||null==(o=i.params)?void 0:o.conversation_id,p=(null==a||null==(n=a.current)?void 0:n[u])||[],h=null==(s=p[p.length-1])?void 0:s.reply_id;h&&((null==(l=d.data)?void 0:l[0].type)!=="question"||(null==(c=d.message_list)?void 0:c[0].chatId)||(d.data[0].chat_id=h));let m=eVP.convertMessageListResponse(d,r);return{...t,data:{...m,message_list:e(u,m.message_list)}}}];return{url:"/v1/conversation/message/list",hooks:{onBeforeRequest:[e=>{let t=e.data.conversation_id,r={after_id:e.data.cursor,limit:e.data.count};return{...e,data:r,params:{conversation_id:t}}}],onErrorResponse:t,onAfterResponse:t}}},[r])})(),{requestManagerOptions:p}=ej7(),h=(0,gt.useMemo)(()=>({url:"/v3/chat/cancel",method:"POST",hooks:{onBeforeRequest:[e=>{let t=e.data.conversation_id,r=e.data.query_message_id;return{...e,data:{conversation_id:t,chat_id:r}}}]}}),[]),m=o||f1;return(0,gt.useMemo)(()=>enr({baseURL:m,scenes:{[eni.SendMessage]:n,[eni.ClearMessageContext]:i,[eni.ClearHistory]:s,[eni.GetMessage]:u,[eni.BreakMessage]:h},hooks:{onBeforeRequest:l,onAfterResponse:c,onErrorResponse:d}},p,(e,t)=>{if(va(e))return e.concat(t)}),[m,n,i,s,l,c])})({refChatFunc:t});return(0,gt.useMemo)(()=>({env:"thirdPart",biz:"third_part",deployVersion:"inhouse",requestManagerOptions:o,tokenManager:a}),[r])})({refChatFunc:p}),{GrabPlugin:y}=(e=>{let{onQuote:t,scene:r="other"}=e??{},[a,o]=(0,gt.useState)(!0),{grabPlugin:i,grabPluginId:n}=(0,gt.useMemo)(()=>(e=>{let{preference:t,onQuote:r,onQuoteChange:a,scene:o}=e,i=fK();return{grabPlugin:{createPluginBizContext:()=>{let e={onQuote:r,onQuoteChange:a},n={useSelectionStore:gs()(f5((e,t)=>({humanizedContentText:"",originContentText:"",normalizeSelectionNodeList:[],selectionData:null,isFloatMenuVisible:!1,floatMenuPosition:null,updateHumanizedContentText:t=>{e({humanizedContentText:t})},updateOriginContentText:t=>{e({originContentText:t})},updateNormalizeSelectionNodeList:t=>{e({normalizeSelectionNodeList:t})},updateIsFloatMenuVisible:t=>{e({isFloatMenuVisible:t})},updateSelectionData:t=>{e({selectionData:t})},updateFloatMenuPosition:t=>{e({floatMenuPosition:t})},clearStore:()=>{e({humanizedContentText:"",originContentText:"",normalizeSelectionNodeList:[],selectionData:null})}}),{name:"botStudio.ChatAreaGrabPlugin.SelectionStore.plugin",enabled:!1})),useQuoteStore:gs()(f5(f8(e=>({quoteContent:null,quoteVisible:!1,quoteContentMap:{},updateQuoteContent:t=>{e({quoteContent:t})},updateQuoteContentMapByImmer:t=>{e(gG(e=>t(e.quoteContentMap)))},updateQuoteVisible:t=>{e({quoteVisible:t})},clearStore:()=>{e({quoteContent:null,quoteVisible:!1})}})),{name:"botStudio.ChatAreaGrabPlugin.Quote.plugin",enabled:!1})),usePreferenceStore:gs()(f5(f8(e=>({enableGrab:!1,updateEnableGrab:t=>{e({enableGrab:t})}})),{name:"botStudio.ChatAreaGrabPlugin.Preference.plugin",enabled:!1}))},s=GR();n.usePreferenceStore.getState().updateEnableGrab(t.enableGrab);let l=((e,t)=>{let{useQuoteStore:r}=e;return r.subscribe(e=>e.quoteContent,e=>{let{onQuoteChange:r}=t;null==r||r({isEmpty:!e})})})({useQuoteStore:n.useQuoteStore},e);return{grabPluginId:i,storeSet:n,eventCallbacks:e,unsubscribe:()=>{l()},eventCenter:s,publicEventCenter:eUi,scene:o}},Plugin:eUo},grabPluginId:i}})({preference:{enableGrab:!0},onQuote:t,onQuoteChange:e=>{let{isEmpty:t}=e;o(t)},scene:r}),[]);return{grabEnableUpload:a,GrabPlugin:i,grabPluginId:n}})({scene:"store"}),T=(()=>{let{cozeApiSdk:e}=eVM();return(0,gt.useCallback)(async t=>{let{file:r}=t,a=await (null==e?void 0:e.files.upload({file:r})),o=(null==a?void 0:a.data)||a,i=(null==o?void 0:o.uri)||"",n=(null==o?void 0:o.id)||(null==a?void 0:a.id)||"";return{uri:i||n,url:(null==o?void 0:o.url)||(null==a?void 0:a.url)||"",id:n||void 0}},[e])})(),k=ej9(),{ChatBackgroundPlugin:w}=(()=>{let{ChatBackgroundPlugin:e,chatBackgroundEvent:t}=(0,gt.useMemo)(()=>{let e;return e=gs()(f5(e=>({backgroundImageInfo:{mobile_background_image:{},web_background_image:{}},clearBackgroundStore:()=>e({backgroundImageInfo:{mobile_background_image:{},web_background_image:{}}},!1,"clearBackgroundStore"),setBackgroundInfo:t=>{e({backgroundImageInfo:t},!1,"setBackgroundInfo")}}),{name:"botStudio.ChatBackground.chatBackground",enabled:!1})),{ChatBackgroundPlugin:{createPluginBizContext:()=>({storeSet:{useChatBackgroundContext:e},chatBackgroundEvent:eqM}),Plugin:eqO},chatBackgroundEvent:eqM}},[]),{isCustomBackground:r}=ej7(),a=ej8(e=>e.backgroundInfo),o=r?void 0:a;return(0,gt.useEffect)(()=>{t.emit(eqz.OnBackgroundChange,o||{mobile_background_image:{},web_background_image:{}})},[o]),{ChatBackgroundPlugin:e}})(),Q=null==h||null==(t=h.ui)?void 0:t.showUserInfo;console.log("[ChatProviderImpl] showUserInfo config:",{showUserInfoConfig:Q,chatConfigUi:null==h?void 0:h.ui,finalValue:Q??!1});let x=(i={refreshToken:c,regenerateMessageByUserMessageId:e=>{var t,r;null==(r=p.current)||null==(t=r.regenerateMessageByUserMessageId)||t.call(r,e)},showUserInfo:Q??!1},{createPluginBizContext:()=>({...i}),Plugin:class extends eqx{constructor(...e){super(...e),function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"customComponents",eqx.createCustomComponents(i))}}}),z=(0,gt.useMemo)(()=>{var e;return(e=>{let{botId:t,source:r,token:a,uploadFile:o}=e;return class{start(){}on(e,t){this.eventBus.on(e,t)}pause(){}cancel(){}async upload(){return this.eventBus.emit("ready",{percent:0,status:ekT.Uploading}),await o({source:r,botId:t,file:this.file,token:a,onProgress:e=>{this.eventBus.emit("progress",{percent:e,status:ekT.Uploading})}})}constructor(e){eUn(this,"file",void 0),eUn(this,"fileType",void 0),eUn(this,"eventBus",new(b9())),eUn(this,"userId",void 0),eUn(this,"abortController",void 0),this.file=e.file,this.fileType=e.type,this.upload().then(e=>{let t={Uri:e.uri,Url:e.url};e.id&&(t.Id=e.id),this.eventBus.emit("complete",{percent:100,status:ekT.Success,uploadResult:t,type:"success"})}).catch(e=>{this.eventBus.emit("error")})}}})({botId:h.type===fZ.APP&&(null==(e=h.appInfo)?void 0:e.appId)?h.appInfo.appId:h.bot_id||"",source:h.source,uploadFile:T})},[h,T]);if((0,gt.useEffect)(()=>{!d||l.current||(async()=>{try{bG(d.code)&&(await (null==c?void 0:c()),u(!1))}catch(e){console.error(e)}l.current=!0})()},[d]),d)return f?(0,fU.jsx)(f,{error:!0===d?null:d,refresh:async()=>{bG(d.code)?(await (null==c?void 0:c()),u(!1)):location.reload()}}):null;let A=h.type===fZ.APP&&(null==(r=h.appInfo)?void 0:r.appId)?h.appInfo.appId:h.bot_id;return(0,fU.jsx)(eF1,{botId:A,userInfo:_,scene:esl.OpenAipSdk,reporter:eUl,requestToInit:b,enableChatActionLock:!0,createChatCoreOverrideConfig:v,eventCallback:{onImageClick:m,onInitSuccess:()=>{l.current=!1},onCopyUpload:e=>{let t,{message:r,extra:{fileIndex:a}}=e;if((t=r.content_obj)&&"file_list"in t){var o;ed_()((null==(o=r.content_obj.file_list[a??0])?void 0:o.file_key)??""),eOZ.success({content:bj.t("copy_success")??"Copy Successfully"})}}},configs:{showFunctionCallDetail:!1,uploadPlugin:z,ignoreMessageConfigList:ew_,isShowFunctionCallBox:(null==h||null==(o=h.ui)||null==(a=o.chatBot)?void 0:a.isNeedFunctionCallMessage)??!0},pluginRegistryList:[x,eNs,w,y,...s||[]],showBackground:k,enableDragUpload:!1,children:(0,fU.jsx)(eqI,{ref:p,children:n})})},eqB=e=>{let{children:t,plugins:r}=e;return(0,fU.jsx)(eVO,{children:(0,fU.jsx)(eqP,{plugins:r,children:t})})},eqR=e=>{var t,r;let{children:a,plugins:o}=e,{chatConfig:i,onImageClick:n,onThemeChange:s}=ej7(),l=ej8(e=>e.setInitError),c=(r={onImageClick:n,onInitialError:()=>{l(!0)},extraBody:null==(t=i.extra)?void 0:t.webChat},{createPluginBizContext:()=>({...r}),Plugin:eNa}),d=eNe();return(0,gt.useEffect)(()=>{null==s||s(d)},[d]),(0,fU.jsx)(eqB,{plugins:[c,...o||[]],children:a})},eqH=e=>{let{children:t,plugins:r,...a}=e;return(0,fU.jsx)(ej5,{appProps:a,children:(0,fU.jsx)(eqR,{plugins:r,children:t})})},eqF=e=>{let{children:t}=e;return(0,fU.jsx)("div",{className:"overflow-hidden w-full min-w-[282px] max-w-[546px] p-[16px] coz-bg-primary",children:t})},eqj=e=>{var t,r,a;let{data:o,onCardSendMsg:i,readonly:n,isDisable:s,message:l}=e,c=n||s;return(0,fU.jsx)(eqF,{children:(0,fU.jsxs)(AA,{className:"w-full",vertical:!0,spacing:12,align:"start",children:[(0,fU.jsx)(erN.Text,{ellipsis:!0,className:"text-18px",children:null==(t=o.question_card_data)?void 0:t.Title}),(0,fU.jsx)(AA,{className:"w-full",vertical:!0,spacing:16,children:null==(a=o.question_card_data)||null==(r=a.Options)?void 0:r.map((e,t)=>(0,fU.jsx)(Xg,{className:"w-full",color:"primary",disabled:c,onClick:()=>null==i?void 0:i({message:l,extra:{msg:e.name,mentionList:[]}}),children:e.name},e.name+t))})]})})},eqN=e=>{var t;let{data:r,onCardSendMsg:a,readonly:o,isDisable:i,message:n}=e,[s,l]=(0,gt.useState)({}),[c,d]=(0,gt.useState)(!1),u=o||i||c;return(0,fU.jsx)(eqF,{children:(0,fU.jsxs)(AA,{spacing:12,vertical:!0,className:"w-full",children:[null==(t=r.input_card_data)?void 0:t.map((e,t)=>(0,fU.jsxs)(AA,{align:"start",className:"w-full",spacing:6,vertical:!0,children:[(0,fU.jsx)(erN.Text,{ellipsis:!0,className:"text-lg !font-medium",children:null==e?void 0:e.name}),(0,fU.jsx)(Jz,{disabled:u||c,value:s[e.name],onChange:t=>{l(gG(r=>{r[e.name]=t}))}})]},(null==e?void 0:e.name)+t)),(0,fU.jsx)(Xg,{className:"w-full",disabled:u,onClick:()=>{var e;u||(d(!0),null==a||a({message:n,extra:{msg:(null==(e=r.input_card_data)?void 0:e.map(e=>`${e.name}:${s[e.name]||""}`).join("\n"))||"",mentionList:n.sender_id?[{id:n.sender_id}]:[]}}))},children:bj.t("workflow_detail_title_testrun_submit")})]})})},eqU=(0,gt.memo)(e=>{let{message:t,...r}=e,a=(0,gt.useMemo)(()=>(e=>{if("card"===e.content_type){var t;let r=ebw(e.content),a=null==r||null==(t=r.x_properties)?void 0:t.workflow_card_info;if(a){let e=ebw(a);if((null==e?void 0:e.card_type)==="QUESTION"&&(null==e?void 0:e.question_card_data)||(null==e?void 0:e.card_type)==="INPUT"&&(null==e?void 0:e.input_card_data))return e}}})(t),[t]);return a?"INPUT"===a.card_type?(0,fU.jsx)(eqN,{data:a,message:t,...r}):"QUESTION"===a.card_type?(0,fU.jsx)(eqj,{data:a,message:t,...r}):"content type is not supported":null},(e,t)=>enB(Yc(e,vk),Yc(t,vk))),eqV=e=>{let t=ey4("TextMessageInnerTopSlot"),r=[{rule:e=>{var t,r;let{contentType:a,contentConfigs:o}=e,i=void 0===(r=null==o||null==(t=o[GB.CARD])?void 0:t.enable)||r;return a===eny.Card&&i},render:e=>{let{message:t,eventCallbacks:r,options:a}=e,{isCardDisabled:o,readonly:i}=a,{onCardSendMsg:n}=r??{};return(0,fU.jsx)(eqU,{message:t,onCardSendMsg:n,readonly:i,isDisable:o})}}];return(0,fU.jsx)(evC,{enhancedContentConfigList:r,multimodalTextContentAddonTop:(0,fU.jsx)(fU.Fragment,{children:t.map((t,r)=>{let{pluginName:a,Component:o}=t;return(0,fU.jsx)(ey7,{pluginName:a,children:(0,fU.jsx)(o,{message:e.message},r)},a)})}),...e})},eqq=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,{alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",length:a=10}=t||{},o=((e,t=21)=>{var r;let a,o;return r=t,o=-~(1.6*(a=(2<<Math.log(e.length-1)/Math.LN2)-1)*r/e.length),(t=r)=>{let i="";for(;;){let r=fG(o),n=o;for(;n--;)if((i+=e[r[n]&a]||"").length===t)return i}}})(r,a);return`${e}${o()}`},eqG=[{type:eTu.UploadImage,label:bj.t("shortcut_modal_upload_component_file_format_img"),icon:eyZ},{type:eTu.UploadTable,label:bj.t("shortcut_modal_upload_component_file_format_table"),icon:eb4},{type:eTu.UploadDoc,label:bj.t("shortcut_modal_upload_component_file_format_doc"),icon:evo},{type:eTu.UploadAudio,label:bj.t("shortcut_modal_upload_component_file_format_audio"),icon:evp},{type:eTu.CODE,label:bj.t("shortcut_modal_upload_component_file_format_code"),icon:evd},{type:eTu.ARCHIVE,label:bj.t("shortcut_modal_upload_component_file_format_zip"),icon:eyW},{type:eTu.PPT,label:bj.t("shortcut_modal_upload_component_file_format_ppt"),icon:eve},{type:eTu.VIDEO,label:bj.t("shortcut_modal_upload_component_file_format_video"),icon:eb5},{type:eTu.TXT,label:bj.t("shortcut_modal_upload_component_file_format_txt"),icon:eb8}],eqK={[Gq.IMAGE]:eTu.UploadImage,[Gq.AUDIO]:eTu.UploadAudio,[Gq.PDF]:eTu.UploadDoc,[Gq.DOCX]:eTu.UploadDoc,[Gq.EXCEL]:eTu.UploadTable,[Gq.CSV]:eTu.UploadTable,[Gq.VIDEO]:eTu.VIDEO,[Gq.PPT]:eTu.PPT,[Gq.TXT]:eTu.TXT,[Gq.ARCHIVE]:eTu.ARCHIVE,[Gq.CODE]:eTu.CODE,[Gq.DEFAULT_UNKNOWN]:eTu.UploadDoc},eqW=GG.reduce((e,t)=>{let r=eqK[t.fileType];if(r){let a=e[r];a?e[r]=`${a},${t.accept.join(",")}`:e[r]=t.accept.join(",")}return e},{});var eqZ=((eV={}).SLOT="slot",eV.WORKSPACE_SLOT="workspaceSlot",eV.EXPRESSION="expression",eV.ACTION="action",eV),eqX=((eq={}).EXPRESSION="expression",eq);let eqY=e=>({id:e.name??eqq(),name:"FlowpdCiciComponentsUpload",type:"@flowpd/cici-components/Upload",props:{name:e.name,description:e.description,maxSize:(e.input_type===eTu.UploadImage,512e3),inputType:e.input_type,accept:(e=>{let{input_type:t,upload_options:r}=e;var a=t===eTu.MixUpload?r??[]:t?[t]:[];let o=[];for(let e of a){if(!e)continue;let t=eqW[e];t&&o.push(...t.split(","))}return o.join(",")})(e),rules:[{required:!0}],noErrorMessage:!0}}),eq$=e=>({id:eqq(),name:"FlowpdCiciComponentsColumnLayout",type:"@flowpd/cici-components/ColumnLayout",props:{Columns:e.map(e=>({children:[e.id],config:{vertical:"top",weight:1,width:"weighted"},type:"slot"})),action:"enableUrl",backgroundColor:"transparent",enableClickEvent:!1}}),eqJ={[eTu.TextInput]:e=>({id:e.name??eqq(),name:"FlowpdCiciComponentsInput",type:"@flowpd/cici-components/Input",props:{name:e.name,description:e.description,defaultValue:e.default_value,rules:[],noErrorMessage:!0}}),[eTu.Select]:e=>{var t;return{id:e.name??eqq(),name:"FlowpdCiciComponentsSelect",type:"@flowpd/cici-components/Select",props:{name:e.name,description:e.description,defaultValue:e.default_value,optionList:null==(t=e.options)?void 0:t.map(e=>({label:e,value:e})),rules:[{required:!0}],noErrorMessage:!0}}},[eTu.UploadImage]:eqY,[eTu.UploadDoc]:eqY,[eTu.UploadTable]:eqY,[eTu.UploadAudio]:eqY,[eTu.MixUpload]:eqY,[eTu.PPT]:eqY,[eTu.ARCHIVE]:eqY,[eTu.CODE]:eqY,[eTu.TXT]:eqY,[eTu.VIDEO]:eqY},eq1=e=>void 0!==e.input_type?eqJ[e.input_type](e):{id:eqq(),name:"FlowpdCiciComponentsFormItemPlaceholder",type:"@flowpd/cici-components/Placeholder"},eq0=e=>{var t;if((null==e?void 0:e.send_type)!==eTp.SendTypePanel)return!1;let{tool_params_list:r,tool_name:a}=(null==e?void 0:e.tool_info)??{};return a?!!(null==r?void 0:r.length)&&r.every(e=>!e.refer_component):!!(null==e||null==(t=e.components_list)?void 0:t.length)&&e.components_list.every(e=>e.hide)};var eq2=i(95838),eq3={};eq3.styleTagTransform=yj(),eq3.setAttributes=yB(),eq3.insert=yI().bind(null,"head"),eq3.domAPI=yO(),eq3.insertStyleElement=yH(),yC()(eq2.A,eq3);let eq4=eq2.A&&eq2.A.locals?eq2.A.locals:void 0,eq6=(0,gt.forwardRef)((e,t)=>{let{className:r,wrapperClass:a,iconSize:o="default",...i}=e;return(0,fU.jsx)("div",{className:yY()(eq4["icon-button"],eq4[`icon-button-${o}`],a),children:(0,fU.jsx)(xD,{ref:t,className:yY()(r),...i,size:"small",theme:"borderless"})})}),eq5=(0,gt.createContext)({isSendMessageLock:!1});var eq7=i(76138),eq8={};eq8.styleTagTransform=yj(),eq8.setAttributes=yB(),eq8.insert=yI().bind(null,"head"),eq8.domAPI=yO(),eq8.insertStyleElement=yH(),yC()(eq7.A,eq8);let eq9=eq7.A&&eq7.A.locals?eq7.A.locals:void 0,eGe=(0,gt.forwardRef)((e,t)=>{let{className:r,...a}=e;return(0,fU.jsx)(Qr,{className:yY()(r,eq9["ui-input"]),...a,ref:t})});var eGt=i(75347),eGr={};eGr.styleTagTransform=yj(),eGr.setAttributes=yB(),eGr.insert=yI().bind(null,"head"),eGr.domAPI=yO(),eGr.insertStyleElement=yH(),yC()(eGt.A,eGr);let eGa=eGt.A&&eGt.A.locals?eGt.A.locals:void 0,eGo=e=>{let{name:t,description:r,required:a=!0}=e;return(0,fU.jsxs)("div",{className:"w-full flex items-center px-2 mb-[2px]",children:[(0,fU.jsx)(eeF.Label,{text:(0,fU.jsx)(TQ.Text,{ellipsis:{showTooltip:!0},className:eGa.text,children:t}),required:a,className:eGa.label}),!!r&&(0,fU.jsx)(kC,{content:r,children:(0,fU.jsx)(eOS,{className:eGa.icon})})]})};var eGi=i(22907),eGn={};eGn.styleTagTransform=yj(),eGn.setAttributes=yB(),eGn.insert=yI().bind(null,"head"),eGn.domAPI=yO(),eGn.insertStyleElement=yH(),yC()(eGi.A,eGn);let eGs=eGi.A&&eGi.A.locals?eGi.A.locals:void 0,eGl=e=>{var t,r;let a,{file:o,disabled:i,inputType:n,onRemove:s,onRetry:l}=e,c="uploadFail"===o.status,d="uploading"===o.status,u=o.fileInstance&&(null==(t=GK(o.fileInstance))?void 0:t.fileType),p=u&&(null==(r=(a=eqK[u])?eqG.find(e=>e.type===a):null)?void 0:r.icon);return(0,fU.jsxs)("div",{className:yY()(eGs.file,"flex border border-solid rounded-lg items-center w-full coz-stroke-primary",{[eGs["file-uploading"]||""]:d}),style:{"--var-percent":`${o.percent}%`},children:[(0,fU.jsx)("img",{src:p??o.url,className:yY()("w-6 h-6","image"===u&&"rounded border border-solid coz-stroke-primary")}),(0,fU.jsx)(TQ.Text,{ellipsis:!0,className:"mx-2 flex-1 text-sm",children:o.name}),c?(0,fU.jsxs)("div",{onClick:e=>{e.stopPropagation(),i||l()},className:eGs.retry,children:[(0,fU.jsx)(eOC,{className:"coz-fg-hglt-red"}),(0,fU.jsx)("div",{children:bj.t("Retry")})]}):null,(0,fU.jsx)(Q5,{className:yY()("close-btn w-5 h-5",eGs["delete-btn"]),disabled:i,onClick:e=>{e.stopPropagation(),s()},theme:"borderless",size:"small",icon:(0,fU.jsx)(eOH,{className:eGs["delete-icon"]})})]})},eGc=e=>{let{value:t,name:r,uploadFile:a,onChange:o,inputType:i,disabled:n,toggle:s,...l}=e,[c,d]=(0,gt.useState)(),u=eej(r),p=(0,gt.useRef)(null==c?void 0:c.uid),h=e=>{e.fileInstance&&(d({...e,percent:0,status:"uploading"}),u.setError(!0),p.current=null==e?void 0:e.uid,null==a||a({file:e.fileInstance,onProgress:t=>{p.current===e.uid&&d({...e,percent:t,status:"uploading"})},onSuccess:function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;p.current===e.uid&&(null==o||o({fileInstance:e.fileInstance,url:t,width:r,height:a}),d({...e,response:t,percent:100,status:"success"}))},onError:()=>{p.current===e.uid&&(u.setError(!1),d({...e,status:"uploadFail"}))}}))};return(0,fU.jsxs)(fU.Fragment,{children:[(0,fU.jsx)(VR,{action:"",className:"w-full",draggable:!0,limit:1,...l,disabled:n,onAcceptInvalid:()=>{UH.error(bj.t("shortcut_Illegal_file_format"))},onSizeError:()=>{l.maxSize&&UH.error(bj.t("file_too_large",{max_size:`${l.maxSize/1024}MB`}))},customRequest:e=>{let{onSuccess:t}=e;t("")},showUploadList:!1,onChange:e=>{var t;let{currentFile:r}=e;p.current!==r.uid&&(!l.maxSize||(null==(t=r.fileInstance)?void 0:t.size)&&r.fileInstance.size<=1024*l.maxSize)&&h(r)},children:c?(0,fU.jsx)(eGl,{file:c,inputType:i,onRemove:()=>{p.current=void 0,d(void 0),null==o||o(""),setTimeout(()=>{u.setError(!0)})},onRetry:()=>{c&&h(c)}}):(0,fU.jsx)(eHs,{icon:(0,fU.jsx)(eOD,{}),disabled:n,className:yY()(eGs["upload-button"],"w-full"),children:(0,fU.jsx)("span",{className:eGs["upload-button-text-short"],children:bj.t("shortcut_component_upload_component_placeholder")})})}),!c&&(0,fU.jsx)(Q5,{disabled:n,icon:(0,fU.jsx)(eOj,{}),onClick:s})]})},eGd=e=>{let{disabled:t,onChange:r,toggle:a}=e;return(0,fU.jsxs)(fU.Fragment,{children:[(0,fU.jsx)(eGe,{disabled:t,onChange:r,className:eGs.input}),(0,fU.jsx)(Q5,{disabled:t,icon:(0,fU.jsx)(eOH,{}),onClick:a})]})},eGu=qC(e=>{let[t,r]=(0,gt.useState)(!1),a="error"===e.validateStatus,o=eej(e.name);return(0,gt.useEffect)(()=>{setTimeout(()=>{var t;null==(t=e.onChange)||t.call(e,""),setTimeout(()=>{o.setError(!0)})})},[t]),(0,fU.jsx)("div",{className:yY()("flex items-center justify-start gap-2",eGs.container,a&&eGs["container-error"]),children:t?(0,fU.jsx)(eGd,{toggle:()=>{r(!1)},...e}):(0,fU.jsx)(eGc,{toggle:()=>{r(!0)},...e})})});var eGp=i(96061),eGh={};eGh.styleTagTransform=yj(),eGh.setAttributes=yB(),eGh.insert=yI().bind(null,"head"),eGh.domAPI=yO(),eGh.insertStyleElement=yH(),yC()(eGp.A,eGh);let eGm=eGp.A&&eGp.A.locals?eGp.A.locals:void 0,eGf=ew8(function(e){return gt.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},e),gt.createElement("path",{d:"M6.95 7.72h10.13c.4 0 .64.45.42.78l-5.07 7.6a.5.5 0 0 1-.83 0L6.54 8.5a.5.5 0 0 1 .41-.78Z",fill:"currentColor"}))},"small_triangle_down");var eGg=i(11126),eG_={};eG_.styleTagTransform=yj(),eG_.setAttributes=yB(),eG_.insert=yI().bind(null,"head"),eG_.domAPI=yO(),eG_.insertStyleElement=yH(),yC()(eGg.A,eG_);let eGb=eGg.A&&eGg.A.locals?eGg.A.locals:void 0,eGv=e=>{let{disabled:t,label:r,onClick:a,selected:o,value:i,key:n,optionClassName:s}=e;return(0,fU.jsxs)("div",{className:yY()(eGb["ui-select-option"],t&&eGb["ui-select-option-disabled"],o&&eGb["ui-select-option-selected"],s),onClick:e=>{t||null==a||a(e)},"data-testid":"ui.select.option",children:[(0,fU.jsx)("div",{className:eGb["ui-select-option-icon"],children:(0,fU.jsx)(eOM,{className:eGb.icon})}),X_(r)?(0,fU.jsx)("div",{className:eGb["ui-select-option-text"],children:r}):r]},n||i)},eGy=(0,gt.forwardRef)((e,t)=>{let{theme:r,className:a,label:o,size:i="default",clickToHide:n=!0,...s}=e,{selectedClassname:l}=s;return"borderless"===r?(0,fU.jsx)(HC,{...s,ref:t,clickToHide:n,className:yY()(a,eGb["borderless-ui-select"],eGb["ui-select"],eGb[`ui-select-${i}`]),triggerRender:e=>{var t;return(0,fU.jsxs)("div",{className:eGb["filter-content"],"data-testid":"ui.select.trigger",children:[o&&(0,fU.jsx)("div",{className:eGb["filter-label"],children:`${o}:`}),(0,fU.jsxs)("div",{className:yY()(eGb["borderless-filter-render"],eGb[`size-${i}`]),children:[(0,fU.jsx)(TQ.Text,{ellipsis:!0,className:yY()(eGb["borderless-filter-text"],l),children:null==e||null==(t=e.value)?void 0:t.map(e=>e.label)}),(0,fU.jsx)(eGf,{className:eGb["filter-icon"]})]})]})}}):(0,fU.jsx)(HC,{...s,ref:t,clickToHide:n,className:yY()(a,eGb["ui-select"],eGb["light-ui-select"],eGb[`ui-select-${i}`])})}),eGT=(0,gt.forwardRef)((e,t)=>{let{theme:r="borderless",dropdownClassName:a,maxHeight:o=216,...i}=e;return(0,fU.jsx)(eGy,{clickToHide:!0,ref:t,renderOptionItem:e=>(0,fU.jsx)(eGv,{...e}),theme:r,dropdownClassName:yY()(a,eGb["ui-select-dropdown"]),maxHeight:o,...i})});eGT.OptGroup=HC.OptGroup,eGT.Option=HC.Option;let eGk=qC(e=>(0,fU.jsx)(eGT,{...e})),eGw=e=>{let{...t}=e;return(0,fU.jsx)(eGk,{...t,theme:"light"})};eGw.Option=eGT.Option,eGw.OptGroup=eGT.OptGroup;let eGQ={"@flowpd/cici-components/Input":e=>{let{context:{readonly:t},props:{name:r,description:a,rules:o,defaultValue:i,...n}}=e,s=!(null==i?void 0:i.value);return(0,fU.jsxs)("div",{children:[(0,fU.jsx)(eGo,{required:s,name:r,description:a}),(0,fU.jsx)(eeF.Input,{disabled:t,fieldStyle:{padding:0},placeholder:null==i?void 0:i.value,className:"w-full",field:r,noLabel:!0,rules:o.map(e=>e.required?{...e,validator:(e,t)=>!!(null==t?void 0:t.trim())}:e),...n})]})},"@flowpd/cici-components/Select":e=>{let{context:{readonly:t},props:{name:r,description:a,defaultValue:o,...i}}=e,n=!(null==o?void 0:o.value);return(0,fU.jsxs)("div",{children:[(0,fU.jsx)(eGo,{name:r,description:a,required:n}),(0,fU.jsx)(eGw,{disabled:t,fieldStyle:{padding:0},className:"w-full",field:r,initValue:null==o?void 0:o.value,noLabel:!0,...i})]})},"@flowpd/cici-components/Upload":e=>{let{context:{uploadFile:t,readonly:r},props:{name:a,description:o,rules:i,...n}}=e;return(0,fU.jsxs)("div",{children:[(0,fU.jsx)(eGo,{name:a,description:o}),(0,fU.jsx)(eGu,{field:a,noLabel:!0,name:a,fieldStyle:{padding:0},uploadFile:t,disabled:r,rules:r?void 0:i,...n})]})},"@flowpd/cici-components/Placeholder":()=>(0,fU.jsx)("div",{className:"flex items-center justify-center rounded-lg coz-bg-plus text-center text-xs font-medium coz-fg-secondary ",style:{height:58},children:bj.t("shortcut_modal_components")}),"@flowpd/cici-components/ColumnLayout":e=>{let{children:t}=e;return(0,fU.jsx)("div",{className:"flex items-center justify-between w-full mb-3 gap-2",children:t})},"@flowpd/cici-components/Form":e=>{let{context:{onChange:t,onSubmit:r,dsl:a},children:o}=e,i=(0,gt.useRef)();return(0,fU.jsx)(eeF,{className:"w-full",autoComplete:"off",getFormApi:e=>i.current=e,onChange:e=>null==t?void 0:t(e.values),onSubmit:e=>{if(!r)return;let t=(null==a?void 0:a.elements)?Object.values(a.elements).map(e=>{var t;let r=null==e||null==(t=e.props)?void 0:t.defaultValue;return{defaultValue:null==r?void 0:r.value,type:e.type,id:e.id}}).filter(e=>"@flowpd/cici-components/Input"===e.type&&!!e.defaultValue):[],o=Object.entries(e).reduce((e,r)=>{let[a,o]=r,i=t.find(e=>e.id===a);return i&&!o?e[a]=i.defaultValue:e[a]=o,e},{});t.forEach(e=>{let{id:t,defaultValue:r}=e;!t||t in o||(o[t]=r)}),r(o)},children:o})},"@flowpd/cici-components/PageContainer":e=>{let{children:t}=e;return(0,fU.jsx)(fU.Fragment,{children:t})},"@flowpd/cici-components/Button":e=>{let{context:t,props:r}=e,a=(e=>{let{context:{readonly:t,dsl:r},props:{formFields:a=[]}}=e,o=qx(),i=a.some(e=>{var t,a,i;let n=!o.values[e],s=!!(null==(t=o.errors)?void 0:t[e]),l=null===(i=(null==r?void 0:r.elements)?Object.values(r.elements).filter(e=>"@flowpd/cici-components/Input"===e.type).find(t=>t.id===e)??null:null)||void 0===i||null==(a=i.props)?void 0:a.defaultValue;return(null==l?void 0:l.value)?s:s||n}),{isSendMessageLock:n}=(0,gt.useContext)(eq5);return t||i||n})({context:t,props:r});return(0,fU.jsx)("div",{className:"flex justify-end",children:(0,fU.jsx)(Q5,{theme:"borderless",className:eGm.button,htmlType:"submit",size:"small",disabled:a,icon:(0,fU.jsx)(eOE,{})})})}},eGx=e=>{var t,r;let{elementId:a,...o}=e,{dsl:i}=o,n=null==i?void 0:i.elements[a],s=(null==n?void 0:n.type)||"",l=s in eGQ?eGQ[s]:null,c=n&&(n.children??(null==(t=(null==(r=n.props)?void 0:r.Columns)??[])?void 0:t.reduce((e,t)=>(t.children&&e.push(...t.children),e),[])));return l?(0,fU.jsx)(l,{context:o,props:null==n?void 0:n.props,children:null==c?void 0:c.map(e=>(0,fU.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,fU.jsx)(eGx,{elementId:e,...o},e)}))}):null},eGz=e=>{let{dsl:t,...r}=e,a=eMQ();return(0,fU.jsx)(eq5.Provider,{value:{isSendMessageLock:a},children:(0,fU.jsx)(eGx,{elementId:t.rootID,dsl:t,...r})})};var eGA=i(11951),eGE={};eGE.styleTagTransform=yj(),eGE.setAttributes=yB(),eGE.insert=yI().bind(null,"head"),eGE.domAPI=yO(),eGE.insertStyleElement=yH(),yC()(eGA.A,eGE);let eGD=eGA.A&&eGA.A.locals?eGA.A.locals:void 0,eGS=e=>{var t;let r,a,{shortcut:o,onClose:i,visible:n,readonly:s,onSubmit:l}=e,c=(0,gt.useRef)(null),d=(r=eM1(),a=e=>r.getRegisteredPlugin(e),e=>{var t;let r,{file:o,onProgress:i,onError:n,onSuccess:s}=e,l=a("upload-plugin");if(!l)return;let c=new l({file:o,type:(null==(t=GK(o))?void 0:t.fileType)==="image"?"image":"object"}),d=!1,u=50,p=()=>{u<85&&(u+=5,null==i||i(u))},h=setTimeout(()=>{d=!0,r=window.setInterval(p,100)},1500);function m(){clearTimeout(h),clearInterval(r),r=void 0,r=void 0,d=!1}c.on("progress",e=>{let{percent:t}=e;d||(h&&m(),null==i||i(t))}),c.on("error",e=>{null==n||n({status:e.extra.errorCode}),m()}),c.on("complete",e=>{let{uploadResult:{Url:t,Uri:r,ImageHeight:a=0,ImageWidth:o=0}}=e;null==s||s(t||r||"",o,a),m()})}),u=eTi().messageWidth,p=(0,gt.useMemo)(()=>{var e,t,r;let a,i,n;return i=(e=>{let t=[],r=[...e];for(;r.length;)t.push(eq$(r.splice(0,2)));return t})(a=((null==(e=o.components_list)?void 0:e.filter(e=>!e.hide))??[]).map(eq1)),null==(r=(n={elements:{root:{id:"root",name:"Root",type:"@flowpd/cici-components/PageContainer",children:["form"],directives:{}},form:{id:"form",name:"FlowpdCiciComponentsForm",type:"@flowpd/cici-components/Form",props:{value:{type:eqZ.EXPRESSION,value:"{{formValue}}"},onChange:{type:eqZ.ACTION,value:"{{onChange}}"},ruls:{}},children:["submitButton"]},submitButton:{id:"submitButton",name:"FlowpdCiciComponentsButton",type:"@flowpd/cici-components/Button",props:{onClick:{type:eqZ.ACTION,value:"{{onSubmit}}"}}}},rootID:"root",variables:{formValue:{id:"formValue",defaultValue:{}}},actions:{onSubmit:{id:"onSubmit",type:"submit",data:{type:eqX.EXPRESSION,value:"{{formValue}}"}},onChange:{id:"onChange",type:"updateVar",target:"formValue"}}}).elements.form)||null==(t=r.children)||t.unshift(...i.map(e=>e.id)),[...a,...i].forEach(e=>n.elements[e.id]=e),n.elements.submitButton.props.formFields=a.map(e=>e.id),n},[o.components_list]);return n?(0,fU.jsx)(fU.Fragment,{children:(0,fU.jsxs)("div",{ref:c,className:eGD["shortcut-template"],style:{width:`calc(${u} - 48px)`},children:[(0,fU.jsxs)("div",{className:"flex items-center text-sm coz-fg-primary px-4 py-[6px] coz-bg-primary rounded-t-3xl h-8",children:[(null==(t=o.shortcut_icon)?void 0:t.url)?(0,fU.jsx)("img",{src:o.shortcut_icon.url,alt:"icon",className:"mr-1 h-[14px]"}):null,(0,fU.jsx)("div",{children:o.command_name}),(0,fU.jsx)(eq6,{icon:(0,fU.jsx)(eOV,{}),onClick:i,wrapperClass:"ml-auto"})]}),(0,fU.jsx)("div",{className:"p-3",children:(0,fU.jsx)(eGz,{uploadFile:e=>{let{file:t,onError:r,onProgress:a,onSuccess:o}=e;null==d||d({file:t,onProgress:a,onError:r,onSuccess:o})},readonly:s,onSubmit:e=>{null==l||l(e)},dsl:p})})]})}):null};var eGC=i(77183),eGL={};eGL.styleTagTransform=yj(),eGL.setAttributes=yB(),eGL.insert=yI().bind(null,"head"),eGL.domAPI=yO(),eGL.insertStyleElement=yH(),yC()(eGC.A,eGL);let eGO=eGC.A&&eGC.A.locals?eGC.A.locals:void 0,eGM=()=>{},eGI=new Proxy(function(){},{get:(e,t,r)=>eGM[t]||eGM,apply:(e,t,r)=>eGM(...r)});var eGP=((eG={}).sign_up_front="sign_up_front",eG.page_from="page_from",eG.page_view="page_view",eG.view_bot="view_bot",eG.view_database="view_database",eG.click_create_bot_confirm="click_create_bot_confirm",eG.click_prompt_edit="click_prompt_edit",eG.click_tool_select="click_tool_select",eG.click_database_select="click_database_select",eG.click_welcome_message_edit="click_welcome_message_edit",eG.click_send_message="click_send_message",eG.delete_rec_plugin="delete_rec_plugin",eG.submit_rec_plugin="submit_rec_plugin",eG.bot_show="bot_show",eG.bot_click="bot_click",eG.click_bot_duplicate="click_bot_duplicate",eG.bot_duplicate_click_front="bot_duplicate_click_front",eG.coze_space_sidenavi_ck="coze_space_sidenavi_ck",eG.coze_enterprise_sidenavi_ck="coze_enterprise_sidenavi_ck",eG.binding_card_list="binding_card_list",eG.binding_card_add="binding_card_add",eG.binding_card_update="binding_card_update",eG.binding_card_preview="binding_card_preview",eG.edited_suggestion="edited_suggestion",eG.builder_editor_view="builder_editor_view",eG.builder_plugin_info="builder_plugin_info",eG.builder_plugin_channel="builder_plugin_channel",eG.builder_plugin_var="builder_plugin_var",eG.builder_plugin_structure="builder_plugin_structure",eG.builder_plugin_component="builder_plugin_component",eG.builder_plugin_canvas="builder_plugin_canvas",eG.builder_plugin_set="builder_plugin_set",eG.builder_plugin_preview="builder_plugin_preview",eG.builder_plugin_publish="builder_plugin_publish",eG.ui_builder_exposure="ui_builder_exposure",eG.ui_builder_initialization="ui_builder_initialization",eG.ui_builder_component_usage="ui_builder_component_usage",eG.ui_builder_setter_usage="ui_builder_setter_usage",eG.builder_plugin_template="builder_plugin_template",eG.builder_plugin_copilot_enter_click="builder_plugin_copilot_enter_click",eG.builder_plugin_copilot_gen_click="builder_plugin_copilot_gen_click",eG.builder_editor_show="builder_editor_show",eG.card_webruntime_view="card_webruntime_view",eG.card_webruntime_render="card_webruntime_render",eG.card_webruntime_error="card_webruntime_error",eG.BuilderPluginStructure="BuilderPluginStructure",eG.BuilderPluginCanvas="BuilderPluginCanvas",eG.card_builder_show="card_builder_show",eG.select_scheduled_tasks_timezone="select_scheduled_tasks_timezone",eG.log_not_supported_timezone="log_not_supported_timezone",eG.cookie_click="cookie_click",eG.cookie_show="cookie_show",eG.agent_app_home_view="agent_app_home_view",eG.agent_app_instance_click="agent_app_instance_click",eG.agent_app_instance_create="agent_app_instance_create",eG.agent_app_detail_view="agent_app_detail_view",eG.agent_app_shortcut_command="agent_app_shortcut_command",eG.agent_app_send_message="agent_app_send_message",eG.tutorial_enter_ck="tutorial_enter_ck",eG.tutorial_list_pv="tutorial_list_pv",eG.tutorial_item_ck="tutorial_item_ck",eG.tutorial_tips_pv="tutorial_tips_pv",eG.home_page_view="home_page_view",eG.tab_click="tab_click",eG.workspace_tab_expose="workspace_tab_expose",eG.create_workspace_click="create_workspace_click",eG.create_workspace_result="create_workspace_result",eG.enterprise_switch_child_create_space_click="enterprise_switch_child_create_space_click",eG.enterprise_switch_add_outside_user_click="enterprise_switch_add_outside_user_click",eG.enterprise_switch_join_outside_space_click="enterprise_switch_join_outside_space_click",eG.space_switch_show="space_switch_show",eG.space_switch_click="space_switch_click",eG.space_admins_button_click="space_admins_button_click",eG.space_members_page_show="space_members_page_show",eG.space_members_page_click="space_members_page_click",eG.space_member_remove_pop_show="space_member_remove_pop_show",eG.space_member_remove_pop_click="space_member_remove_pop_click",eG.space_invitation_page_show="space_invitation_page_show",eG.space_invitation_page_click="space_invitation_page_click",eG.space_invitation_revoke_pop_show="space_invitation_revoke_pop_show",eG.space_invitation_revoke_pop_click="space_invitation_revoke_pop_click",eG.space_settings_page_show="space_settings_page_show",eG.space_settings_page_click="space_settings_page_click",eG.space_settings_button_click="space_settings_button_click",eG.space_share_link_popup_show="space_share_link_popup_show",eG.space_share_link_popup_click="space_share_link_popup_click",eG.space_add_members_popup_show="space_add_members_popup_show",eG.space_add_members_popup_click="space_add_members_popup_click",eG.space_settings_secondary_pop_show="space_settings_secondary_pop_show",eG.space_settings_secondary_pop_click="space_settings_secondary_pop_click",eG.create_bot_click="create_bot_click",eG.create_bot_result="create_bot_result",eG.bot_duplicate_click="bot_duplicate_click",eG.bot_duplicate_result="bot_duplicate_result",eG.bot_submit="bot_submit",eG.bot_submit_difference="bot_submit_difference",eG.bot_submit_confirm_click="bot_submit_confirm_click",eG.bot_publish_difference="bot_publish_difference",eG.bot_merge_page="bot_merge_page",eG.bot_merge="bot_merge",eG.bot_diff_viewdetail="bot_diff_viewdetail",eG.bot_merge_manual="bot_merge_manual",eG.workspace_action_front="workspace_action_front",eG.search_front="search_front",eG.product_show="product_show",eG.product_click="product_click",eG.product_show_front="product_show_front",eG.product_click_front="product_click_front",eG.click_open_in_front="click_open_in_front",eG.favorite_click_front="favorite_click_front",eG.product_run_front="product_run_front",eG.entity_publish_click_front="entity_publish_click_front",eG.share_front="share_front",eG.bot_detail_page_front="bot_detail_page_front",eG.share_recall_page_front="share_recall_page_front",eG.dev_bot_share_screenshot_front="dev_bot_share_screenshot_front",eG.bot_tts_configure="bot_tts_configure",eG.bot_tts_select_click="bot_tts_select_click",eG.bot_tts_select_confirm="bot_tts_select_confirm",eG.voice_chat_call="voice_chat_call",eG.voice_chat_opening_dialog="voice_chat_opening_dialog",eG.voice_chat_connect="voice_chat_connect",eG.voice_chat_record="voice_chat_record",eG.voice_chat_think="voice_chat_think",eG.voice_chat_speak="voice_chat_speak",eG.voice_chat_hang_up="voice_chat_hang_up",eG.voice_chat_error="voice_chat_error",eG.task_click="task_click",eG.task_show="task_show",eG.buy_token_click="coze_token_buy_click",eG.choose_amount_click="coze_token_buy_amount_click",eG.confirm_checkout_click="coze_token_buy_confirm_click",eG.token_insufficiency_pop_up="token_insufficiency_pop_up",eG.click_auto_gen_changelog_button="click_auto_gen_changelog_button",eG.click_stop_auto_gen_changelog_button="click_stop_auto_gen_changelog_button",eG.auto_gen_changelog_finish="auto_gen_changelog_finish",eG.bot_publish="bot_publish",eG.bot_publish_button_click="bot_publish_button_click",eG.bot_publish_audit_pop_up="bot_publish_audit_pop_up",eG.banner_expose_front="banner_expose_front",eG.banner_click_front="banner_click_front",eG.banner_close_front="banner_close_front",eG.recommended_table_click="recommended_table_click",eG.nl2table_create_table_click="nl2table_create_table_click",eG.generate_with_ai_click="generate_with_ai_click",eG.database_learn_click="database_learn_click",eG.create_table_click="create_table_click",eG.edit_table_click="edit_table_click",eG.create_mockset_front="create_mockset_front",eG.del_mockset_front="del_mockset_front",eG.create_mock_front="create_mock_front",eG.del_mock_front="del_mock_front",eG.use_mockset_front="use_mockset_front",eG.use_mockgen_front="use_mockgen_front",eG.privacy_plugin_popup_front="privacy_plugin_popup_front",eG.privacy_plugin_form_front="privacy_plugin_form_front",eG.privacy_plugin_form_server="privacy_plugin_form_server",eG.privacy_store_privacy_front="privacy_store_privacy_front",eG.bot_desc_dialog_front="bot_desc_dialog_front",eG.create_plugin_front="create_plugin_front",eG.create_plugin_tool_front="create_plugin_tool_front",eG.code_snippet_front="code_snippet_front",eG.workflow_test_node="workflow_test_node",eG.workflow_create_testset="workflow_create_testset",eG.workflow_aigc_params="workflow_aigc_params",eG.workflow_testrun_source="workflow_testrun_source",eG.workflow_testrun_result_front="workflow_testrun_result_front",eG.workflow_testrun_detailed_front="workflow_testrun_detailed_front",eG.workflow_pre_release_ppe="workflow_pre_release_ppe",eG.workflow_ppe_version_select="workflow_ppe_version_select",eG.workflow_ppe_release_event="workflow_ppe_release_event",eG.workflow_history_show="workflow_history_show",eG.workflow_ppe_offline="workflow_ppe_offline",eG.workflow_submit="workflow_submit",eG.workflow_submit_difference="workflow_submit_difference",eG.workflow_publish_difference="workflow_publish_difference",eG.workflow_merge_page="workflow_merge_page",eG.workflow_merge="workflow_merge",eG.workflow_submit_version_history="workflow_submit_version_history",eG.workflow_submit_version_revert="workflow_submit_version_revert",eG.workflow_submit_version_view="workflow_submit_version_view",eG.workflow_cooperation_switch_click="workflow_cooperation_switch_click",eG.workflow_test_run_click="workflow_test_run_click",eG.widget_create_click="widget_create_click",eG.widget_duplicate_click="widget_duplicate_click",eG.widget_delete_click="widget_delete_click",eG.analytics_tab_view="analytics_tab_view",eG.analytics_tab_view_duration="analytics_tab_view_duration",eG.query_trace_list_view="query_trace_list_view",eG.query_trace_columns_update="query_trace_columns_update",eG.query_trace_filters_update="query_trace_filters_update",eG.query_trace_quick_filter_status_update="query_trace_quick_filter_status_update",eG.query_trace_quick_filter_latency_update="query_trace_quick_filter_latency_update",eG.query_trace_quick_filter_tokens_update="query_trace_quick_filter_tokens_update",eG.query_trace_quick_filter_full_text_search="query_trace_quick_filter_full_text_search",eG.query_trace_detail_view="query_trace_detail_view",eG.query_trace_row_click="query_trace_row_click",eG.query_new_trace_csv_export="query_new_trace_csv_export",eG.query_new_trace_columns_update="query_new_trace_columns_update",eG.query_new_trace_list_view="query_new_trace_list_view",eG.query_new_trace_row_click="query_new_trace_row_click",eG.query_new_trace_detail_view="query_new_trace_detail_view",eG.query_new_trace_quick_filter_status_update="query_new_trace_quick_filter_status_update",eG.query_new_trace_quick_filter_message_ids_update="query_new_trace_quick_filter_message_ids_update",eG.query_new_trace_quick_filter_user_ids_update="query_new_trace_quick_filter_user_ids_update",eG.query_new_trace_quick_filter_session_ids_update="query_new_trace_quick_filter_session_ids_update",eG.query_new_trace_quick_filter_input_update="query_new_trace_quick_filter_input_update",eG.query_new_trace_quick_filter_output_update="query_new_trace_quick_filter_output_update",eG.query_new_trace_quick_filter_intent_update="query_new_trace_quick_filter_intent_update",eG.query_new_trace_quick_filter_input_tokens_update="query_new_trace_quick_filter_input_tokens_update",eG.query_new_trace_quick_filter_output_tokens_update="query_new_trace_quick_filter_output_tokens_update",eG.query_new_trace_quick_filter_latency_update="query_new_trace_quick_filter_latency_update",eG.query_new_trace_quick_filter_latency_first_resp_update="query_new_trace_quick_filter_latency_first_resp_update",eG.query_new_trace_quick_filter_time_update="query_new_trace_quick_filter_time_update",eG.query_trace_graph_tab_click="query_trace_graph_tab_click",eG.query_trace_tree_node_click="query_trace_tree_node_click",eG.query_trace_flamethread_node_click="query_trace_flamethread_node_click",eG.query_trace_input_copy="query_trace_input_copy",eG.query_trace_output_copy="query_trace_output_copy",eG.age_gate_show="age_gate_show",eG.age_gate_click="age_gate_click",eG.open_debug_panel="open_debug_panel",eG.debug_page_show="debug_page_show",eG.ai_analysis_assistant_entry_click="ai_analysis_assistant_entry_click",eG.ai_analysis_assistant_send_click="ai_analysis_assistant_send_click",eG.performance_view="performance_view",eG.query_analytics_select_channel="query_analytics_select_channel",eG.query_analytics_intent_jump_queries="query_analytics_intent_jump_queries",eG.analysis_indicator_interval="analysis_indicator_interval",eG.analysis_indicator_auto_refresh_interval="analysis_indicator_auto_refresh_interval",eG.create_dataset="create_dataset",eG.create_rule="create_rule",eG.add_rule_type="add_rule_type",eG.create_case="create_case",eG.case_result="case_result",eG.get_start="get_start",eG.bot_deployment_details="bot_deployment_details",eG.bot_pre_release_ppe="bot_pre_release_ppe",eG.bot_ppe_version_select="bot_ppe_version_select",eG.bot_ppe_release_event="bot_ppe_release_event",eG.bot_history_show="bot_history_show",eG.bot_ppe_offline="bot_ppe_offline",eG.bot_gray_publish="bot_gray_publish",eG.store_search_page_front="store_search_page_front",eG.store_search_front="store_search_front",eG.content_show_front="content_show_front",eG.content_click_front="content_click_front",eG.profile_entrance="profile_entrance",eG.profile_share="profile_share",eG.profile_follow="profile_follow",eG.share_topic="share_topic",eG.landing_topic="landing_topic",eG.collect_topic="collect_topic",eG.view_all="view_all",eG.click_topic="click_topic",eG.language_switch_show="language_switch_show",eG.language_switch_click="language_switch_click",eG.arena_bot_show_front="arena_bot_show_front",eG.arena_bot_click_front="arena_bot_click_front",eG.arena_bot_front="arena_bot_front",eG.arena_click_front="arena_click_front",eG.question_bank_click_front="question_bank_click_front",eG.memory_click_front="memory_click_front",eG.click_debug_panel_feedback_button="click_debug_panel_feedback_button",eG.flow_store_list_click="flow_store_list_click",eG.flow_store_detail_click="flow_store_detail_click",eG.flow_creation_click="flow_creation_click",eG.flow_duplicate_click="flow_duplicate_click",eG.eval_panel_show="coze_panel_show",eG.eval_task_operation="eval_task_operation",eG.eval_panel_tab_show="eval_panel_tab_show",eG.eval_result_show="eval_result_show",eG.eval_result_tab_show="eval_result_tab_show",eG.eval_result_detail_sort="eval_result_detail_sort",eG.shortcut_use="shortcut_use",eG.preview_link_click="preview_link_click",eG.prompt_optimize_front="prompt_optimize_front",eG.home_action_front="home_action_front",eG.template_action_front="template_action_front",eG.coze_agent_front="coze_agent_front",eG.notification_front="notification_front",eG.notification_center_show_front="notification_center_show_front",eG.notification_center_click_front="notification_center_click_front",eG.coze_pro_popup_front="coze_pro_popup_front",eG.coze_landing_front="coze_landing_front",eG.add_member_pop_up_show="add_member_pop_up_show_front",eG.oauth_page_stay_time_front="oauth_page_stay_time_front",eG.oauth_page_show_front="oauth_page_show_front",eG.oauth_page_click_front="oauth_page_click_front",eG.account_upgrade_page_show_front="account_upgrade_page_show_front",eG.account_upgrade_page_click_front="account_upgrade_page_click_front",eG.coze_pro_popup_plan_buy_token="coze_pro_popup_plan_buy_token",eG.playground_click_front="playground_click_front",eG.playground_set_front="playground_set_front",eG.playground_authorize_front="playground_authorize_front",eG.doc_click_front="doc_click_front",eG.docs_page_view_front="docs_page_view_front",eG.publish_oauth_button_click="publish_oauth_button_click",eG.settings_oauth_page_show="settings_oauth_page_show",eG.settings_oauth_button_click="settings_oauth_button_click",eG.prompt_library_front="prompt_library_front",eG.compare_mode_front="compare_mode_front",eG.site_change_click="site_change_click",eG);let eGB=(e,t)=>{eiR.info({message:"send-tea-event",meta:{event:e,params:t}}),eGI.sendEvent(e,t)},eGR=(e,t)=>{let r=e;return Object.keys(t).forEach(e=>{r=r.replace(RegExp(`\\{\\{${e}\\}\\}`,"g"),t[e])}),r},eGH=()=>{let e=eMJ(eMb());return t=>{var r;let{queryTemplate:a,onBeforeSend:o,options:i,shortcut:n}=t,{tool_type:s}=n,l=void 0!==s&&[eTh.ToolTypeWorkFlow,eTh.ToolTypePlugin].includes(s),c={payload:{text:a,mention_list:[]}},d=WU({extendFiled:{...l?eGF(n):{},device_id:String(eMU.deviceId)}},i),{message:u,options:p}=(null==o?void 0:o({message:c,options:d}))||{message:c,options:d};e({text:u.payload.text,mentionList:u.payload.mention_list},"shortcut",p),eGB(eGP.shortcut_use,{tool_type:s,use_components:!!(null==(r=n.components_list)?void 0:r.length),show_panel:eq0(n)})}},eGF=e=>{let{plugin_id:t,plugin_api_name:r,tool_info:{tool_params_list:a}={}}=e,o=(a??[]).reduce((e,t)=>{let{default_value:r,name:a}=t;return a&&(e[a]={value:r??"",resource_type:""}),e},{});return{shortcut_cmd_id:e.command_id,toolList:[{plugin_id:t,api_name:r??"",parameters:o}]}},eGj=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],{template_query:a,components_list:o}=e;if(!a)throw Error("template_query is not defined");let i=eGq(o,t);return r?eGR(a,t??{}):eGR(a,i)},eGN=(e,t,r)=>Object.keys(e).reduce((a,o)=>{let i=e[o];return"object"==typeof i&&i.fileInstance?a[o]=t(i):a[o]=r(i),a},{}),eGU=e=>{var t;return!!("object"==typeof e&&e.fileInstance&&(null==(t=GK(e.fileInstance))?void 0:t.fileType)!=="image")},eGV=e=>{var t;return!!("object"==typeof e&&e.fileInstance&&(null==(t=GK(e.fileInstance))?void 0:t.fileType)==="image")},eGq=(e,t)=>{let r=eGN(t,e=>{var t;return null==e||null==(t=e.fileInstance)?void 0:t.name},e=>e);return(e??[]).reduce((e,t)=>{let{default_value:a,name:o,hide:i}=t;if(!o)return e;if(i)return e[o]=(null==a?void 0:a.value)??"",e;let n=r[o];return n&&(e[o]=n),e},{})},eGG=function(e,t){void 0===t&&(t={});var r=t.target,a=t.isNoMore,o=t.threshold,i=void 0===o?100:o,n=t.reloadDeps,s=t.manual,l=t.onBefore,c=t.onSuccess,d=t.onError,u=t.onFinally,p=g4((0,gt.useState)(),2),h=p[0],m=p[1],f=g4((0,gt.useState)(!1),2),g=f[0],_=f[1],b=(0,gt.useMemo)(function(){return!!a&&a(h)},[h]),v=ejO(function(t){return g0(void 0,void 0,void 0,function(){var r,a,o;return g2(this,function(i){switch(i.label){case 0:return[4,e(t)];case 1:return r=i.sent(),t?m(gJ(gJ({},r),{list:g6(g6([],g4(null!=(o=t.list)?o:[]),!1),g4(r.list),!1)})):m(gJ(gJ({},r),{list:g6([],g4(null!=(a=r.list)?a:[]),!1)})),[2,r]}})})},{manual:s,onFinally:function(e,t,r){_(!1),null==u||u(t,r)},onBefore:function(){return null==l?void 0:l()},onSuccess:function(e){setTimeout(function(){z()},10),null==c||c(e)},onError:function(e){return null==d?void 0:d(e)}}),y=v.loading,T=v.run,k=v.runAsync,w=v.cancel,Q=WG(function(){b||(_(!0),T(h))}),x=WG(function(){return b?Promise.reject():(_(!0),k(h))}),z=function(){var e=eet(r);if(e){var t,a=(t=e=e===document?document.documentElement:e)===document||t===document.body?Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop):t.scrollTop;(e.scrollHeight||Math.max(document.documentElement.scrollHeight,document.body.scrollHeight))-a<=(e.clientHeight||Math.max(document.documentElement.clientHeight,document.body.clientHeight))+i&&Q()}};return evO("scroll",function(){y||g||z()},{target:r}),WZ(function(){T()},g6([],g4(void 0===n?[]:n),!1)),{data:h,loading:!g&&y,loadingMore:g,noMore:b,loadMore:Q,loadMoreAsync:x,reload:WG(function(){return _(!1),T()}),reloadAsync:WG(function(){return _(!1),k()}),mutate:m,cancel:w}},eGK=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],[r,a]=(0,gt.useState)(0),o=(0,gt.useRef)(),i=(0,gt.useRef)(()=>void 0);return i.current=e,(0,gt.useLayoutEffect)(()=>{if(!r)return;let e=o.current||[];return i.current(...e)},[r,...t]),function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];o.current=t,a(e=>e+1)}},eGW=e=>{let{getId:t,list:r,target:a}=e,o=-1;return{targetItem:r.find((e,r)=>t(e)===t(a)&&(o=r,!0)),targetIndex:o}},eGZ=e=>{let{className:t,onSelect:r,getId:a,itemRender:o,onActiveId:i,getMoreListService:n,defaultId:s,listTopSlot:l,defaultList:c,...d}=e,u=(0,gt.useRef)(),p=(0,gt.useRef)(!1),h=(0,gt.useRef)(null),m=(0,gt.useRef)(null),{data:f,scrollIntoView:g,activeId:_,focusTo:b,goNext:v,goPrev:y,loadingMore:T,loading:k}=(e=>{let{getId:t,listRef:r,getMoreListService:a,defaultList:o}=e,[i,n]=(0,gt.useState)(""),{data:s,loadingMore:l,loading:c,loadMore:d}=eGG(e=>a(e),{target:r,isNoMore:e=>!(null==e?void 0:e.hasMore)}),u=(0,gt.useMemo)(()=>o?{list:o.concat((null==s?void 0:s.list)??[]),hasMore:!!(null==s?void 0:s.hasMore)}:{list:(null==s?void 0:s.list)??[],hasMore:!!(null==s?void 0:s.hasMore)},[s]),{list:p}=u,h=e=>{if(!e)return void n("");if(!r.current)return;let a=p.find(r=>t(e)===t(r));a&&n(t(a))},m=eGK(e=>{var a;let o=t(e),i=null==(a=r.current)?void 0:a.querySelector(`[data-id="${o}"]`);i&&i.scrollIntoView({behavior:"instant",block:"nearest"})});return{activeId:i,focusFirst:()=>{let e=p[0];e&&h(e)},focusTo:h,scrollToFirst:()=>{r.current&&(r.current.scrollTop=0)},scrollIntoView:m,goNext:()=>{let e=p.find(e=>t(e)===i);if(!e)return;let{item:r,reachLimit:a}=(e=>{let{curItem:t,list:r,getId:a}=e,{targetIndex:o}=eGW({getId:a,list:r,target:t});if(o<0)return{reachLimit:!1,item:t};let i=o>=r.length-3,n=(o+1)%r.length;return{reachLimit:i,item:r.at(n)||t}})({getId:t,list:p,curItem:e});a&&d(),l||(h(r),m(r))},goPrev:()=>{let e=p.find(e=>t(e)===i);if(!e)return;let{item:r,reachLimit:a}=(e=>{let{curItem:t,list:r,getId:a}=e,{targetIndex:o}=eGW({getId:a,list:r,target:t});if(o<0)return{reachLimit:!1,item:t};let i=(o-1)%r.length;return{reachLimit:0===o,item:r.at(i)||t}})({getId:t,list:p,curItem:e});a&&d(),h(r),m(r)},loadingMore:l,data:u,loading:c}})({getMoreListService:n,getId:e=>a(e),listRef:h,defaultList:c}),w=(null==f?void 0:f.list)??[];return(0,gt.useEffect)(()=>{null==i||i(_)},[_]),WZ(()=>{if(k)return;let e=w.find(e=>a(e)===s);e&&(b(e),g(e),null==i||i(s||a(e)))},[k]),(0,fU.jsxs)("div",{ref:h,tabIndex:1,className:t,onMouseLeave:()=>{b(null)},onMouseMove:()=>{clearTimeout(u.current),p.current=!0,u.current=setTimeout(()=>{p.current=!1},50)},onKeyDown:e=>{if("ArrowDown"===e.key){e.preventDefault(),v();return}if("ArrowUp"===e.key){e.preventDefault(),y();return}if("Enter"===e.key){let e=w.find(e=>a(e)===_);e&&(null==r||r(e))}},...d,children:[l,w.map(e=>(0,fU.jsx)("div",{"data-id":a(e),ref:a(e)===_?m:null,onClick:()=>{null==r||r(e)},onMouseEnter:()=>{if(p.current){var t;b(e),null==(t=h.current)||t.focus()}},children:o(e)},a(e))),T||k?(0,fU.jsx)("div",{className:"flex justify-center items-center",children:(0,fU.jsx)(eID,{style:{color:"#4D53E8"},spin:!0})}):null]})},eGX=i.p+"e2df4cf3a868fb7bc5598aefca4d4657.svg",eGY=i.p+"5aa1c2d1c333386a30d5748d2654b56c.svg",{Text:eG$}=TQ,eGJ=e=>{let{shortcuts:t,onSelect:r,onBeforeSendTextMessage:a,defaultId:o}=e,i=eGH(),[n,s]=(0,gt.useState)("");return(0,fU.jsxs)("div",{className:"p-2",children:[(0,fU.jsx)("div",{className:"text-xs coz-fg-secondary mb-2 pl-2 pt-1",children:bj.t("bot_ide_shortcut")}),(0,fU.jsx)(eGZ,{className:yY()("w-full max-h-[312px] overflow-y-auto cursor-pointer",eGO["load-more-list"]),defaultId:o,getId:e=>e.command_id,onActiveId:e=>s(e),getMoreListService:()=>Promise.resolve({list:t,hasMore:!1}),onSelect:e=>{if(null==r||r(e),e.send_type===eTp.SendTypeQuery){(null==e?void 0:e.template_query)&&i({queryTemplate:e.template_query,onBeforeSend:a,shortcut:e});return}},itemRender:e=>{var t,r,a,o;let{splitLineVisible:i,iconVisible:s,nameVisible:l}=(e=>{let{bot_info:t}=e,r=!!(null==t?void 0:t.icon_url),a=!!(null==t?void 0:t.name);return{iconVisible:r,nameVisible:a,splitLineVisible:r||a}})(e);return(0,fU.jsxs)("div",{className:yY()("flex justify-start items-center max-w-full overflow-hidden h-[52px] px-2 py-[6px]",{"coz-mg-primary-hovered":n===e.command_id,"rounded-md":n===e.command_id}),children:[(0,fU.jsx)("img",{src:(null==(t=e.shortcut_icon)?void 0:t.url)||eGY,alt:"icon",className:"w-9 h-9 p-[10px] rounded bg-white border-[0.5px] border-solid coz-stroke-primary mr-2"}),(0,fU.jsx)("div",{className:"grow-0 shrink max-w-[37%] overflow-hidden box-border mr-3 flex items-center",children:(0,fU.jsx)(eG$,{className:"text-sm coz-fg-plus font-medium",ellipsis:{showTooltip:{opts:{content:e.command_name,position:"top",style:{wordBreak:"break-word"}}}},children:e.command_name})}),e.description?(0,fU.jsx)("div",{className:"flex-0 max-w-[60%] overflow-hidden box-border mr-3 flex items-center",children:(0,fU.jsx)(eG$,{className:"coz-fg-secondary text-xs",ellipsis:{showTooltip:{opts:{content:e.description,position:"top",style:{wordBreak:"break-word"}}}},children:e.description})}):null,(0,fU.jsxs)("div",{className:"flex items-center max-w-full flex-0 overflow-hidden box-border min-w-[100px]",children:[i?(0,fU.jsx)("img",{src:eGX,alt:""}):null,s?(0,fU.jsx)("img",{alt:"bot icon",className:"w-[14px] h-[14px] rounded-full mr-1 ml-3",src:null==(r=e.bot_info)?void 0:r.icon_url}):null,l?(0,fU.jsx)(eG$,{className:"coz-fg-secondary text-xs",ellipsis:{showTooltip:{opts:{content:null==(a=e.bot_info)?void 0:a.name,position:"top",style:{wordBreak:"break-word"}}}},children:null==(o=e.bot_info)?void 0:o.name}):null]})]})}})]})},eG1=Xe(["mr-8px","rounded-[99px]","border-[1px]","border-solid","overflow-hidden"],{variants:{color:{grey:["coz-stroke-primary","coz-mg-secondary","backdrop-blur-[3.45px]"],white:["coz-stroke-primary","coz-bg-max","backdrop-blur-[3.45px]"],blur:["coz-stroke-image-bots","coz-bg-image-bots","backdrop-blur-[20px]"]}}}),eG0=Xe(["text-lg","font-medium"],{variants:{color:{grey:["coz-fg-primary"],white:["coz-fg-primary"],blur:["coz-fg-images-bots"]}}}),{Paragraph:eG2,Text:eG3}=TQ,eG4=e=>{let{children:t,shortcut:r,toolTipFooterSlot:a,showBotInfo:o=!1}=e,i=eTi().layout!==GP.MOBILE,[n,s]=(0,gt.useState)(!1),{description:l,command_name:c}=r,{icon_url:d,name:u}=r.bot_info||{},p=o&&!!(u||d);return(0,fU.jsx)($l,{trigger:"custom",visible:n,style:{maxWidth:"283px",padding:"16px"},content:()=>(0,fU.jsxs)("div",{className:"flex flex-col items-start justify-center min-w-9",children:[c?(0,fU.jsx)("div",{className:"max-w-[250px] mb-1",children:(0,fU.jsx)(eG2,{ellipsis:!0,className:"coz-fg-plus font-bold text-sm",children:c})}):null,l?(0,fU.jsx)("div",{className:"max-w-[250px]",children:(0,fU.jsx)("div",{className:"coz-fg-secondary text-xs",children:l})}):null,p?(0,fU.jsxs)("div",{className:"flex mt-3 gap-1 items-center",children:[d?(0,fU.jsx)("img",{className:"rounded-full w-[14px] h-[14px]",src:d,alt:"bot_icon"}):null,u?(0,fU.jsx)(eG3,{className:"coz-fg-secondary text-xs",children:u}):null]}):null,a]}),children:(0,fU.jsx)("div",{onMouseEnter:()=>s(i),onMouseLeave:()=>s(!1),children:t})})},eG6=e=>{var t;let{shortcut:r,onClick:a,onBeforeSend:o,toolTipFooterSlot:i,popoverTipShowBotInfo:n=!1}=e,s=eGH(),l=(0,gt.useRef)(null),c=eMQ();return r.send_type!==eTp.SendTypeQuery?null:(0,fU.jsx)("div",{className:eG1({color:e.uiMode}),children:(0,fU.jsx)(eG4,{shortcut:r,toolTipFooterSlot:i,showBotInfo:n,children:(0,fU.jsx)(Xg,{disabled:c,"data-testid":`chat-area.chat-input-shortcut.shortcut-button-${r.command_name}`,contentClassName:eG0({color:e.uiMode}),onClick:()=>(()=>{let{template_query:e,agent_id:t,object_id:i}=r;e&&(null==a||a(),s({queryTemplate:e,options:{extendFiled:{extra:{bot_state:JSON.stringify({agent_id:t,bot_id:i})}}},onBeforeSend:o,shortcut:r}))})(),color:"secondary",icon:(null==(t=r.shortcut_icon)?void 0:t.url)?(0,fU.jsx)("img",{alt:"icon",src:r.shortcut_icon.url,className:"h-[14px]"}):null,children:(0,fU.jsx)("div",{ref:l,className:"max-w-[198px] overflow-hidden text-ellipsis",children:r.command_name})})})})},eG5=e=>{var t;let{shortcut:r,onClick:a,uiMode:o,toolTipFooterSlot:i,popoverTipShowBotInfo:n=!1}=e,s=(0,gt.useRef)(null);if(r.send_type!==eTp.SendTypePanel)return null;let l=eq0(r);return(0,fU.jsx)("div",{className:eG1({color:o}),children:(0,fU.jsx)(eG4,{shortcut:r,toolTipFooterSlot:i,showBotInfo:n,children:(0,fU.jsx)(Xg,{"data-testid":`chat-area.chat-input-shortcut.shortcut-button-${r.command_name}`,contentClassName:eG0({color:o}),color:"secondary",icon:(null==(t=r.shortcut_icon)?void 0:t.url)?(0,fU.jsx)("img",{alt:"icon",src:r.shortcut_icon.url,className:"h-[14px]"}):null,iconPosition:"left",onClick:()=>void(null==a||a()),children:(0,fU.jsxs)("div",{className:"inline-flex items-center",children:[(0,fU.jsx)("div",{ref:s,className:"max-w-[176px] overflow-hidden text-ellipsis",children:r.command_name}),!l&&(0,fU.jsx)(eOq,{className:"ml-[10px]"})]})})})})},eG7=i.p+"ba11c4f0391a6ae014e026de7efcc49f.svg",eG8=i.p+"c1f18e5afaa58a61117f9c998e357cfa.svg",eG9=e=>{let{onOpen:t,uiMode:r,onClose:a,isLoadMoreActive:o}=e;return(0,fU.jsx)("div",{className:yY()(eGO["load-more-shortcut-wrapper"],{[eGO["shortcut-white"]||""]:"white"===r,[eGO["shortcut-blur"]||""]:"blur"===r}),children:(0,fU.jsxs)(eHs,{"data-testid":"chat-area.shortcut.load-more-button",className:yY()(eGO["load-more-button"],eGO["shortcut-button"],{"!coz-mg-primary-pressed":o&&"white"===r}),onClick:()=>{o?null==a||a():null==t||t()},children:[(0,fU.jsx)("span",{className:"mr-1",children:bj.t("More")}),o?(0,fU.jsx)("img",{className:"arraw-icon",src:eG7,alt:"up"}):(0,fU.jsx)("img",{className:"arraw-icon",src:eG8,alt:"down"})]})})};var eKe=i(79060),eKt={};eKt.styleTagTransform=yj(),eKt.setAttributes=yB(),eKt.insert=yI().bind(null,"head"),eKt.domAPI=yO(),eKt.insertStyleElement=yH(),yC()(eKe.A,eKt);let eKr=eKe.A&&eKe.A.locals?eKe.A.locals:void 0,eKa=e=>{let t,{shortcuts:r,onActiveShortcutChange:a,className:o,wrapperClassName:i,defaultId:n,uiMode:s="white",wrapperStyle:l,toolTipFooterSlot:c,onBeforeSendTemplateShortcut:d,onBeforeSendTextMessage:u,popoverTipShowBotInfo:p=!1}=e,h=(0,gt.useRef)(null),[m,f]=(0,gt.useState)(!1),[g,_]=(0,gt.useState)(void 0),[b,v]=(0,gt.useState)(!1),y=(t=eM3(),e=>{var r;let a,{shortcut:o,options:i,componentsFormValues:n,onBeforeSendTemplateShortcut:s,withoutComponentsList:l=!1}=e,{tool_type:c}=o,d=eGj(o,n,l),u=void 0!==c&&[eTh.ToolTypeWorkFlow,eTh.ToolTypePlugin].includes(c)?((e,t)=>{let{plugin_id:r,plugin_api_name:a,components_list:o,tool_info:{tool_params_list:i}={}}=e,n=eGN(t,e=>{let{fileInstance:t,url:r}=e;return{value:r,resource_type:t?"uri":""}},e=>({value:e,resource_type:""})),s=(i??[]).reduce((e,t)=>{var r;let{default_value:a,name:i,refer_component:s}=t;if(!i)return e;if(!s)return e[i]={value:a??"",resource_type:""},e;let l=null==o||null==(r=o.find(e=>e.parameter===i))?void 0:r.name,c=l&&n[l];return c&&(e[i]=c),e},{});return Object.keys(s).length?{shortcut_cmd_id:e.command_id,toolList:[{plugin_id:r,api_name:a??"",parameters:s}]}:{shortcut_cmd_id:e.command_id,toolList:[]}})(o,n):{},p=Object.keys(a=n).reduce((e,t)=>{let r=a[t];return eGU(r)?e.push({type:eny.File,file:r.fileInstance,uri:r.url}):eGV(r)&&e.push({type:eny.Image,file:r.fileInstance,uri:r.url,width:r.width||0,height:r.height||0}),e},[]),h={payload:{mixList:[{type:eny.Text,text:d||" "},...p],mention_list:[]}},m=WU({extendFiled:{...u,device_id:String(eMU.deviceId)}},i),f=(null==s?void 0:s({message:enS(h),options:enS(m),shortcut:o}))||{message:h,options:m};t(f.message??h,"shortcut",f.options),eGB(eGP.shortcut_use,{tool_type:c,use_components:!!(null==(r=o.components_list)?void 0:r.length),show_panel:!eq0(o)})}),T=eTi().messageWidth,k=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];_(e);let r=(null==e?void 0:e.send_type)===eTp.SendTypePanel&&!t;null==a||a(e,r),v(r)},w=e=>{let t=eq0(e);t&&x((e=>{var t;let{tool_params_list:r,tool_name:a}=(null==e?void 0:e.tool_info)??{};return a?(null==r?void 0:r.length)?r.reduce((e,t)=>{let r=t.name,a=null==t?void 0:t.default_value;return r&&a&&(e[r]=a),e},{}):{}:(null==e||null==(t=e.components_list)?void 0:t.length)?e.components_list.reduce((e,t)=>{let r=t.name,{value:a}=(null==t?void 0:t.default_value)??{};return r&&a&&(e[r]=a),e},{}):{}})(e),e),k(e,t),f(!1)},Q=()=>{v(!1),k(void 0)},x=(e,t)=>{if(!t)return;let{agent_id:r,object_id:a,components_list:o,tool_info:i}=t,n=!!(null==i?void 0:i.tool_name)&&!(null==o?void 0:o.length);y({shortcut:t,options:{extendFiled:{extra:{bot_state:JSON.stringify({agent_id:r,bot_id:a})}}},componentsFormValues:e,onBeforeSendTemplateShortcut:d,withoutComponentsList:n}),Q()};return(null==r?void 0:r.length)?b&&g?(0,fU.jsx)(eGS,{shortcut:g,onSubmit:e=>{if(!g)return;let{agent_id:t,object_id:r}=g;y({shortcut:g,options:{extendFiled:{extra:{bot_state:JSON.stringify({agent_id:t,bot_id:r})}}},componentsFormValues:e,onBeforeSendTemplateShortcut:d}),Q()},visible:b,onClose:()=>{k(void 0)}}):(0,fU.jsx)("div",{className:yY()(eKr["shortcut-bar"],o,"flex justify-center items-center w-full"),children:(0,fU.jsx)(wp,{content:(0,fU.jsx)(eGJ,{defaultId:n,shortcuts:r,onBeforeSendTextMessage:u,onSelect:w}),onVisibleChange:f,position:"topLeft",trigger:"custom",visible:m,spacing:{x:0,y:9},getPopupContainer:()=>h.current||document.body,onClickOutSide:()=>f(!1),onEscKeyDown:()=>f(!1),children:(0,fU.jsx)("div",{ref:h,className:yY()(i,"relative flex justify-start pb-4"),style:{maxWidth:T,...l},children:(0,fU.jsx)(Hi,{style:{width:"100%"},minVisibleItems:1,items:r,visibleItemRenderer:e=>(0,fU.jsxs)(fU.Fragment,{children:[e.send_type===eTp.SendTypeQuery&&(0,fU.jsx)(eG6,{uiMode:s,shortcut:e,onBeforeSend:u,toolTipFooterSlot:c,popoverTipShowBotInfo:p,onClick:()=>w(e)},e.command_id),e.send_type===eTp.SendTypePanel&&(0,fU.jsx)(eG5,{uiMode:s,shortcut:e,toolTipFooterSlot:c,popoverTipShowBotInfo:p,onClick:()=>w(e)},e.command_id)]}),overflowRenderer:e=>e.length?(0,fU.jsx)(eG9,{uiMode:s,isLoadMoreActive:m,shortcuts:r,onOpen:()=>f(!0),onClose:()=>f(!1),getPopupContainer:()=>h.current}):null})})})}):null};function eKo(e){let t=null;return()=>(null==t&&(t=e()),t)}class eKi{enter(e){var t,r;let a,o,i,n=this.entered.length,s=t=>this.isNodeInDocument(t)&&(!t.contains||t.contains(e));return this.entered=(t=this.entered.filter(s),r=[e],a=new Set,o=e=>a.add(e),t.forEach(o),r.forEach(o),i=[],a.forEach(e=>i.push(e)),i),0===n&&this.entered.length>0}leave(e){var t;let r=this.entered.length;return this.entered=(t=this.entered.filter(this.isNodeInDocument),t.filter(t=>t!==e)),r>0&&0===this.entered.length}reset(){this.entered=[]}constructor(e){this.entered=[],this.isNodeInDocument=e}}class eKn{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(e=>{Object.defineProperty(this.item,e,{configurable:!0,enumerable:!0,get:()=>(console.warn(`Browser doesn't allow reading "${e}" until the drop event.`),null)})})}loadDataTransfer(e){if(e){let t={};Object.keys(this.config.exposeProperties).forEach(r=>{let a=this.config.exposeProperties[r];null!=a&&(t[r]={value:a(e,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,t)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(e,t){return t===e.getSourceId()}endDrag(){}constructor(e){this.config=e,this.item={},this.initializeExposedProperties()}}let eKs="__NATIVE_FILE__",eKl="__NATIVE_URL__",eKc="__NATIVE_TEXT__",eKd="__NATIVE_HTML__";function eKu(e,t,r){let a=t.reduce((t,r)=>t||e.getData(r),"");return null!=a?a:r}let eKp={[eKs]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[eKd]:{exposeProperties:{html:(e,t)=>eKu(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[eKl]:{exposeProperties:{urls:(e,t)=>eKu(e,t,"").split("\n"),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[eKc]:{exposeProperties:{text:(e,t)=>eKu(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function eKh(e){if(!e)return null;let t=Array.prototype.slice.call(e.types||[]);return Object.keys(eKp).filter(e=>{let r=eKp[e];return!!(null==r?void 0:r.matchesTypes)&&r.matchesTypes.some(e=>t.indexOf(e)>-1)})[0]||null}let eKm=eKo(()=>/firefox/i.test(navigator.userAgent)),eKf=eKo(()=>!!window.safari);class eKg{interpolate(e){let t,{xs:r,ys:a,c1s:o,c2s:i,c3s:n}=this,s=r.length-1;if(e===r[s])return a[s];let l=0,c=n.length-1;for(;l<=c;){let o=r[t=Math.floor(.5*(l+c))];if(o<e)l=t+1;else{if(!(o>e))return a[t];c=t-1}}let d=e-r[s=Math.max(0,c)],u=d*d;return a[s]+o[s]*d+i[s]*u+n[s]*d*u}constructor(e,t){let r,a,o;const{length:i}=e,n=[];for(let e=0;e<i;e++)n.push(e);n.sort((t,r)=>e[t]<e[r]?-1:1);const s=[],l=[],c=[];for(let o=0;o<i-1;o++)r=e[o+1]-e[o],a=t[o+1]-t[o],l.push(r),s.push(a),c.push(a/r);const d=[c[0]];for(let e=0;e<l.length-1;e++){const t=c[e],a=c[e+1];if(t*a<=0)d.push(0);else{r=l[e];const o=l[e+1],i=r+o;d.push(3*i/((i+o)/t+(i+r)/a))}}d.push(c[c.length-1]);const u=[],p=[];for(let e=0;e<d.length-1;e++){o=c[e];const t=d[e],r=1/l[e],a=t+d[e+1]-o-o;u.push((o-t-a)*r),p.push(a*r*r)}this.xs=e,this.ys=t,this.c1s=d,this.c2s=u,this.c3s=p}}function eK_(e){let t=1===e.nodeType?e:e.parentElement;if(!t)return null;let{top:r,left:a}=t.getBoundingClientRect();return{x:a,y:r}}function eKb(e){return{x:e.clientX,y:e.clientY}}class eKv{get window(){return this.globalContext?this.globalContext:"undefined"!=typeof window?window:void 0}get document(){var e;return(null==(e=this.globalContext)?void 0:e.document)?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var e;return(null==(e=this.optionsArgs)?void 0:e.rootElement)||this.window}constructor(e,t){this.ownerDocument=null,this.globalContext=e,this.optionsArgs=t}}function eKy(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},a=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),a.forEach(function(t){var a;a=r[t],t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a})}return e}class eKT{profile(){var e,t;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:(null==(e=this.dragStartSourceIds)?void 0:e.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:(null==(t=this.dragOverTargetIds)?void 0:t.length)||0}}get window(){return this.options.window}get document(){return this.options.document}get rootElement(){return this.options.rootElement}setup(){let e=this.rootElement;if(void 0!==e){if(e.__isReactDndBackendSetUp)throw Error("Cannot have two HTML5 backends at the same time.");e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}teardown(){let e=this.rootElement;if(void 0!==e&&(e.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var t;null==(t=this.window)||t.cancelAnimationFrame(this.asyncEndDragFrameId)}}connectDragPreview(e,t,r){return this.sourcePreviewNodeOptions.set(e,r),this.sourcePreviewNodes.set(e,t),()=>{this.sourcePreviewNodes.delete(e),this.sourcePreviewNodeOptions.delete(e)}}connectDragSource(e,t,r){this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,r);let a=t=>this.handleDragStart(t,e),o=e=>this.handleSelectStart(e);return t.setAttribute("draggable","true"),t.addEventListener("dragstart",a),t.addEventListener("selectstart",o),()=>{this.sourceNodes.delete(e),this.sourceNodeOptions.delete(e),t.removeEventListener("dragstart",a),t.removeEventListener("selectstart",o),t.setAttribute("draggable","false")}}connectDropTarget(e,t){let r=t=>this.handleDragEnter(t,e),a=t=>this.handleDragOver(t,e),o=t=>this.handleDrop(t,e);return t.addEventListener("dragenter",r),t.addEventListener("dragover",a),t.addEventListener("drop",o),()=>{t.removeEventListener("dragenter",r),t.removeEventListener("dragover",a),t.removeEventListener("drop",o)}}addEventListeners(e){e.addEventListener&&(e.addEventListener("dragstart",this.handleTopDragStart),e.addEventListener("dragstart",this.handleTopDragStartCapture,!0),e.addEventListener("dragend",this.handleTopDragEndCapture,!0),e.addEventListener("dragenter",this.handleTopDragEnter),e.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.addEventListener("dragover",this.handleTopDragOver),e.addEventListener("dragover",this.handleTopDragOverCapture,!0),e.addEventListener("drop",this.handleTopDrop),e.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(e){e.removeEventListener&&(e.removeEventListener("dragstart",this.handleTopDragStart),e.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),e.removeEventListener("dragend",this.handleTopDragEndCapture,!0),e.removeEventListener("dragenter",this.handleTopDragEnter),e.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.removeEventListener("dragover",this.handleTopDragOver),e.removeEventListener("dragover",this.handleTopDragOverCapture,!0),e.removeEventListener("drop",this.handleTopDrop),e.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){let e=this.monitor.getSourceId(),t=this.sourceNodeOptions.get(e);return eKy({dropEffect:this.altKeyPressed?"copy":"move"},t||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){let e=this.monitor.getSourceId();return eKy({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}isDraggingNativeItem(){let e=this.monitor.getItemType();return Object.keys(fN).some(t=>fN[t]===e)}beginDragNativeItem(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(e,t){let r=eKp[e];if(!r)throw Error(`native type ${e} has no configuration`);let a=new eKn(r);return a.loadDataTransfer(t),a}(e,t),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(e){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout(()=>{var e;return null==(e=this.rootElement)?void 0:e.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)},1e3)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var e;null==(e=this.window)||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(e,t){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(t))}handleDragEnter(e,t){this.dragEnterTargetIds.unshift(t)}handleDragOver(e,t){null===this.dragOverTargetIds&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}handleDrop(e,t){this.dropTargetIds.unshift(t)}constructor(e,t,r){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=e=>{let t=this.sourceNodes.get(e);return t&&eK_(t)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=e=>!!(e&&this.document&&this.document.body&&this.document.body.contains(e)),this.endDragIfSourceWasRemovedFromDOM=()=>{let e=this.currentDragSourceNode;null==e||this.isNodeInDocument(e)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=e=>{null===this.hoverRafId&&"undefined"!=typeof requestAnimationFrame&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(e||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{null!==this.hoverRafId&&"undefined"!=typeof cancelAnimationFrame&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=e=>{if(e.defaultPrevented)return;let{dragStartSourceIds:t}=this;this.dragStartSourceIds=null;let r=eKb(e);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:r});let{dataTransfer:a}=e,o=eKh(a);if(this.monitor.isDragging()){if(a&&"function"==typeof a.setDragImage){let e=this.monitor.getSourceId(),t=this.sourceNodes.get(e),o=this.sourcePreviewNodes.get(e)||t;if(o){let{anchorX:e,anchorY:i,offsetX:n,offsetY:s}=this.getCurrentSourcePreviewNodeOptions(),l=function(e,t,r,a,o){var i;let n,s,l,c="IMG"===t.nodeName&&(eKm()||!(null==(i=document.documentElement)?void 0:i.contains(t))),d=eK_(c?e:t),u={x:r.x-d.x,y:r.y-d.y},{offsetWidth:p,offsetHeight:h}=e,{anchorX:m,anchorY:f}=a,{dragPreviewWidth:g,dragPreviewHeight:_}=(n=c?t.width:p,s=c?t.height:h,eKf()&&c&&(s/=window.devicePixelRatio,n/=window.devicePixelRatio),{dragPreviewWidth:n,dragPreviewHeight:s}),{offsetX:b,offsetY:v}=o;return{x:0===b||b?b:new eKg([0,.5,1],[u.x,u.x/p*g,u.x+g-p]).interpolate(m),y:0===v||v?v:(l=new eKg([0,.5,1],[u.y,u.y/h*_,u.y+_-h]).interpolate(f),eKf()&&c&&(l+=(window.devicePixelRatio-1)*_),l)}}(t,o,r,{anchorX:e,anchorY:i},{offsetX:n,offsetY:s});a.setDragImage(o,l.x,l.y)}}try{null==a||a.setData("application/json",{})}catch(e){}this.setCurrentDragSourceNode(e.target);let{captureDraggingState:t}=this.getCurrentSourcePreviewNodeOptions();t?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(o)this.beginDragNativeItem(o);else{if(a&&!a.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute("draggable")))return;e.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=e=>{if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()){var t;null==(t=this.currentNativeSource)||t.loadDataTransfer(e.dataTransfer)}if(!this.enterLeaveCounter.enter(e.target)||this.monitor.isDragging())return;let{dataTransfer:r}=e,a=eKh(r);a&&this.beginDragNativeItem(a,r)},this.handleTopDragEnter=e=>{let{dragEnterTargetIds:t}=this;this.dragEnterTargetIds=[],!this.monitor.isDragging()||(this.altKeyPressed=e.altKey,t.length>0&&this.actions.hover(t,{clientOffset:eKb(e)}),t.some(e=>this.monitor.canDropOnTarget(e))&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())))},this.handleTopDragOverCapture=e=>{if(this.dragOverTargetIds=[],this.isDraggingNativeItem()){var t;null==(t=this.currentNativeSource)||t.loadDataTransfer(e.dataTransfer)}},this.handleTopDragOver=e=>{let{dragOverTargetIds:t}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging()){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none");return}this.altKeyPressed=e.altKey,this.lastClientOffset=eKb(e),this.scheduleHover(t),(t||[]).some(e=>this.monitor.canDropOnTarget(e))?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=e=>{this.isDraggingNativeItem()&&e.preventDefault(),this.enterLeaveCounter.leave(e.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=e=>{if(this.dropTargetIds=[],this.isDraggingNativeItem()){var t;e.preventDefault(),null==(t=this.currentNativeSource)||t.loadDataTransfer(e.dataTransfer)}else eKh(e.dataTransfer)&&e.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=e=>{let{dropTargetIds:t}=this;this.dropTargetIds=[],this.actions.hover(t,{clientOffset:eKb(e)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=e=>{let t=e.target;"function"!=typeof t.dragDrop||"INPUT"===t.tagName||"SELECT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||(e.preventDefault(),t.dragDrop())},this.options=new eKv(t,r),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new eKi(this.isNodeInDocument)}}let eKk=function(e,t,r){return new eKT(e,t,r)};function eKw(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var eKQ="function"==typeof Symbol&&Symbol.observable||"@@observable",eKx=function(){return Math.random().toString(36).substring(7).split("").join(".")},eKz={INIT:"@@redux/INIT"+eKx(),REPLACE:"@@redux/REPLACE"+eKx(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+eKx()}};function eKA(e,t,...r){if("undefined"!=typeof process&&void 0===t)throw Error("invariant requires an error message argument");if(!e){let e;if(void 0===t)e=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let a=0;(e=Error(t.replace(/%s/g,function(){return r[a++]}))).name="Invariant Violation"}throw e.framesToPop=1,e}}function eKE(e){return"object"==typeof e}let eKD="dnd-core/INIT_COORDS",eKS="dnd-core/BEGIN_DRAG",eKC="dnd-core/PUBLISH_DRAG_SOURCE",eKL="dnd-core/HOVER",eKO="dnd-core/DROP",eKM="dnd-core/END_DRAG";function eKI(e,t){return{type:eKD,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}let eKP={type:eKD,payload:{clientOffset:null,sourceClientOffset:null}};function eKB(e,t){return null===t?null===e:Array.isArray(e)?e.some(e=>e===t):e===t}class eKR{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){var e,t,r,a,o;let i=this,{dispatch:n}=this.store,s={beginDrag:(e=this,function(t=[],r={publishSource:!0}){var a,o,i;let{publishSource:n=!0,clientOffset:s,getSourceClientOffset:l}=r,c=e.getMonitor(),d=e.getRegistry();e.dispatch(eKI(s)),a=t,o=c,i=d,eKA(!o.isDragging(),"Cannot call beginDrag while dragging."),a.forEach(function(e){eKA(i.getSource(e),"Expected sourceIds to be registered.")});let u=function(e,t){let r=null;for(let a=e.length-1;a>=0;a--)if(t.canDragSource(e[a])){r=e[a];break}return r}(t,c);if(null==u)return void e.dispatch(eKP);let p=null;if(s){if(!l)throw Error("getSourceClientOffset must be defined");eKA("function"==typeof l,"When clientOffset is provided, getSourceClientOffset must be a function."),p=l(u)}e.dispatch(eKI(s,p));let h=d.getSource(u).beginDrag(c,u);if(null!=h)return eKA(eKE(h),"Item must be an object."),d.pinSource(u),{type:eKS,payload:{itemType:d.getSourceType(u),item:h,sourceId:u,clientOffset:s||null,sourceClientOffset:p||null,isSourcePublic:!!n}}}),publishDragSource:(t=this,function(){if(t.getMonitor().isDragging())return{type:eKC}}),hover:(r=this,function(e,{clientOffset:t}={}){var a,o,i;eKA(Array.isArray(e),"Expected targetIds to be an array.");let n=e.slice(0),s=r.getMonitor(),l=r.getRegistry();return function(e,t,r){for(let a=e.length-1;a>=0;a--){let o=e[a];eKB(t.getTargetType(o),r)||e.splice(a,1)}}(n,l,s.getItemType()),function(e,t,r){eKA(t.isDragging(),"Cannot call hover while not dragging."),eKA(!t.didDrop(),"Cannot call hover after drop.");for(let t=0;t<e.length;t++){let a=e[t];eKA(e.lastIndexOf(a)===t,"Expected targetIds to be unique in the passed array."),eKA(r.getTarget(a),"Expected targetIds to be registered.")}}(n,s,l),a=n,o=s,i=l,a.forEach(function(e){i.getTarget(e).hover(o,e)}),{type:eKL,payload:{targetIds:n,clientOffset:t||null}}}),drop:(a=this,function(e={}){var t,r;let o,i=a.getMonitor(),n=a.getRegistry();eKA((t=i).isDragging(),"Cannot call drop while not dragging."),eKA(!t.didDrop(),"Cannot call drop twice during one drag operation."),((o=(r=i).getTargetIds().filter(r.canDropOnTarget,r)).reverse(),o).forEach((t,r)=>{var o,s,l,c,d;let u,p,h={type:eKO,payload:{dropResult:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},a=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),a.forEach(function(t){var a;a=r[t],t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a})}return e}({},e,(o=t,s=r,l=n,c=i,eKA(void 0===(d=p=(u=l.getTarget(o))?u.drop(c,o):void 0)||eKE(d),"Drop result must either be an object or undefined."),void 0===p&&(p=0===s?{}:c.getDropResult()),p))}};a.dispatch(h)})}),endDrag:(o=this,function(){let e=o.getMonitor(),t=o.getRegistry();eKA(e.isDragging(),"Cannot call endDrag while not dragging.");let r=e.getSourceId();return null!=r&&(t.getSource(r,!0).endDrag(e,r),t.unpinSource()),{type:eKM}})};return Object.keys(s).reduce((e,t)=>{let r=s[t];return e[t]=(...e)=>{let t=r.apply(i,e);void 0!==t&&n(t)},e},{})}dispatch(e){this.store.dispatch(e)}constructor(e,t){this.isSetUp=!1,this.handleRefCountChange=()=>{let e=this.store.getState().refCount>0;this.backend&&(e&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!e&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=t,e.subscribe(this.handleRefCountChange)}}function eKH(e,t){return{x:e.x-t.x,y:e.y-t.y}}let eKF=[],eKj=[];eKF.__IS_NONE__=!0,eKj.__IS_ALL__=!0;class eKN{subscribeToStateChange(e,t={}){let{handlerIds:r}=t;eKA("function"==typeof e,"listener must be a function."),eKA(void 0===r||Array.isArray(r),"handlerIds, when specified, must be an array of strings.");let a=this.store.getState().stateId,o=()=>{let t=this.store.getState(),o=t.stateId;try{o===a||o===a+1&&!function(e,t){return e!==eKF&&(e===eKj||void 0===t||t.filter(t=>e.indexOf(t)>-1).length>0)}(t.dirtyHandlerIds,r)||e()}finally{a=o}};return this.store.subscribe(o)}subscribeToOffsetChange(e){eKA("function"==typeof e,"listener must be a function.");let t=this.store.getState().dragOffset,r=()=>{let r=this.store.getState().dragOffset;r!==t&&(t=r,e())};return this.store.subscribe(r)}canDragSource(e){if(!e)return!1;let t=this.registry.getSource(e);return eKA(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()&&t.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;let t=this.registry.getTarget(e);return eKA(t,`Expected to find a valid target. targetId=${e}`),!(!this.isDragging()||this.didDrop())&&eKB(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e)}isDragging(){return!!this.getItemType()}isDraggingSource(e){if(!e)return!1;let t=this.registry.getSource(e,!0);return eKA(t,`Expected to find a valid source. sourceId=${e}`),!!this.isDragging()&&!!this.isSourcePublic()&&this.registry.getSourceType(e)===this.getItemType()&&t.isDragging(this,e)}isOverTarget(e,t={shallow:!1}){if(!e)return!1;let{shallow:r}=t;if(!this.isDragging())return!1;let a=this.registry.getTargetType(e),o=this.getItemType();if(o&&!eKB(a,o))return!1;let i=this.getTargetIds();if(!i.length)return!1;let n=i.indexOf(e);return r?n===i.length-1:n>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return function(e){let{clientOffset:t,initialClientOffset:r,initialSourceClientOffset:a}=e;return t&&r&&a?eKH({x:t.x+a.x,y:t.y+a.y},r):null}(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return function(e){let{clientOffset:t,initialClientOffset:r}=e;return t&&r?eKH(t,r):null}(this.store.getState().dragOffset)}constructor(e,t){this.store=e,this.registry=t}}let eKU="undefined"!=typeof global?global:self,eKV=eKU.MutationObserver||eKU.WebKitMutationObserver;function eKq(e){return function(){let t=setTimeout(a,0),r=setInterval(a,50);function a(){clearTimeout(t),clearInterval(r),e()}}}let eKG="function"==typeof eKV?function(e){let t=1,r=new eKV(e),a=document.createTextNode("");return r.observe(a,{characterData:!0}),function(){a.data=t=-t}}:eKq;class eKK{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}}let eKW=new class{enqueueTask(e){let{queue:t,requestFlush:r}=this;t.length||(r(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{let{queue:e}=this;for(;this.index<e.length;){let t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,r=e.length-this.index;t<r;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=eKG(this.flush),this.requestErrorThrow=eKq(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},eKZ=new class{create(e){let t=this.freeTasks,r=t.length?t.pop():new eKK(this.onError,e=>t[t.length]=e);return r.task=e,r}constructor(e){this.onError=e,this.freeTasks=[]}}(eKW.registerPendingError),eKX="dnd-core/ADD_SOURCE",eKY="dnd-core/ADD_TARGET",eK$="dnd-core/REMOVE_SOURCE",eKJ="dnd-core/REMOVE_TARGET";function eK1(e,t){t&&Array.isArray(e)?e.forEach(e=>eK1(e,!1)):eKA("string"==typeof e||"symbol"==typeof e,t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}(eK=fR||(fR={})).SOURCE="SOURCE",eK.TARGET="TARGET";let eK0=0;function eK2(e){switch(e[0]){case"S":return fR.SOURCE;case"T":return fR.TARGET;default:throw Error(`Cannot parse handler ID: ${e}`)}}function eK3(e,t){let r=e.entries(),a=!1;do{let{done:e,value:[,o]}=r.next();if(o===t)return!0;a=!!e}while(!a);return!1}class eK4{addSource(e,t){eK1(e),eKA("function"==typeof t.canDrag,"Expected canDrag to be a function."),eKA("function"==typeof t.beginDrag,"Expected beginDrag to be a function."),eKA("function"==typeof t.endDrag,"Expected endDrag to be a function.");let r=this.addHandler(fR.SOURCE,e,t);return this.store.dispatch({type:eKX,payload:{sourceId:r}}),r}addTarget(e,t){eK1(e,!0),eKA("function"==typeof t.canDrop,"Expected canDrop to be a function."),eKA("function"==typeof t.hover,"Expected hover to be a function."),eKA("function"==typeof t.drop,"Expected beginDrag to be a function.");let r=this.addHandler(fR.TARGET,e,t);return this.store.dispatch({type:eKY,payload:{targetId:r}}),r}containsHandler(e){return eK3(this.dragSources,e)||eK3(this.dropTargets,e)}getSource(e,t=!1){return eKA(this.isSourceId(e),"Expected a valid source ID."),t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return eKA(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return eKA(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return eKA(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return eK2(e)===fR.SOURCE}isTargetId(e){return eK2(e)===fR.TARGET}removeSource(e){var t;eKA(this.getSource(e),"Expected an existing source."),this.store.dispatch({type:eK$,payload:{sourceId:e}}),t=()=>{this.dragSources.delete(e),this.types.delete(e)},eKW.enqueueTask(eKZ.create(t))}removeTarget(e){eKA(this.getTarget(e),"Expected an existing target."),this.store.dispatch({type:eKJ,payload:{targetId:e}}),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){let t=this.getSource(e);eKA(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}unpinSource(){eKA(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,t,r){let a=function(e){let t=(eK0++).toString();switch(e){case fR.SOURCE:return`S${t}`;case fR.TARGET:return`T${t}`;default:throw Error(`Unknown Handler Role: ${e}`)}}(e);return this.types.set(a,t),e===fR.SOURCE?this.dragSources.set(a,r):e===fR.TARGET&&this.dropTargets.set(a,r),a}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}}let eK6={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function eK5(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},a=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),a.forEach(function(t){var a;a=r[t],t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a})}return e}let eK7={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function eK8(e={},t){var r;return{dirtyHandlerIds:function(e=eKF,t){let r,a,o;switch(t.type){case eKL:break;case eKX:case eKY:case eKJ:case eK$:return eKF;default:return eKj}let{targetIds:i=[],prevTargetIds:n=[]}=t.payload,s=(r=new Map,a=e=>{r.set(e,r.has(e)?r.get(e)+1:1)},i.forEach(a),n.forEach(a),o=[],r.forEach((e,t)=>{1===e&&o.push(t)}),o);if(!(s.length>0||!function(e,t,r=(e,t)=>e===t){if(e.length!==t.length)return!1;for(let a=0;a<e.length;++a)if(!r(e[a],t[a]))return!1;return!0}(i,n)))return eKF;let l=n[n.length-1],c=i[i.length-1];return l!==c&&(l&&s.push(l),c&&s.push(c)),s}(e.dirtyHandlerIds,{type:t.type,payload:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},a=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),a.forEach(function(t){var a;a=r[t],t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a})}return e}({},t.payload,{prevTargetIds:(r=[],"dragOperation.targetIds".split(".").reduce((e,t)=>e&&e[t]?e[t]:r||null,e))})}),dragOffset:function(e=eK6,t){let{payload:r}=t;switch(t.type){case eKD:case eKS:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case eKL:var a,o;if(a=e.clientOffset,o=r.clientOffset,!a&&!o||a&&o&&a.x===o.x&&a.y===o.y)return e;return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},a=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),a.forEach(function(t){var a;a=r[t],t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a})}return e}({},e,{clientOffset:r.clientOffset});case eKM:case eKO:return eK6;default:return e}}(e.dragOffset,t),refCount:function(e=0,t){switch(t.type){case eKX:case eKY:return e+1;case eK$:case eKJ:return e-1;default:return e}}(e.refCount,t),dragOperation:function(e=eK7,t){let{payload:r}=t;switch(t.type){case eKS:return eK5({},e,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case eKC:return eK5({},e,{isSourcePublic:!0});case eKL:return eK5({},e,{targetIds:r.targetIds});case eKJ:var a,o;if(-1===e.targetIds.indexOf(r.targetId))return e;return eK5({},e,{targetIds:(a=e.targetIds,o=r.targetId,a.filter(e=>e!==o))});case eKO:return eK5({},e,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case eKM:return eK5({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}(e.dragOperation,t),stateId:function(e=0){return e+1}(e.stateId)}}let eK9=(0,gt.createContext)({dragDropManager:void 0}),eWe=0,eWt=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var eWr=(0,gt.memo)(function(e){var t,{children:r}=e;let[a,o]="manager"in(t=function(e,t){if(null==e)return{};var r,a,o=function(e,t){if(null==e)return{};var r,a,o={},i=Object.keys(e);for(a=0;a<i.length;a++)r=i[a],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,["children"]))?[{dragDropManager:t.manager},!1]:[function(e,t=eWa(),r,a){return t[eWt]||(t[eWt]={dragDropManager:function(e,t,r={},a=!1){var o;let i,n=(o=a,i="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__,function e(t,r,a){if("function"==typeof r&&"function"==typeof a||"function"==typeof a&&"function"==typeof arguments[3])throw Error(eKw(0));if("function"==typeof r&&void 0===a&&(a=r,r=void 0),void 0!==a){if("function"!=typeof a)throw Error(eKw(1));return a(e)(t,r)}if("function"!=typeof t)throw Error(eKw(2));var o,i=t,n=r,s=[],l=s,c=!1;function d(){l===s&&(l=s.slice())}function u(){if(c)throw Error(eKw(3));return n}function p(e){if("function"!=typeof e)throw Error(eKw(4));if(c)throw Error(eKw(5));var t=!0;return d(),l.push(e),function(){if(t){if(c)throw Error(eKw(6));t=!1,d();var r=l.indexOf(e);l.splice(r,1),s=null}}}function h(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw Error(eKw(7));if(void 0===e.type)throw Error(eKw(8));if(c)throw Error(eKw(9));try{c=!0,n=i(n,e)}finally{c=!1}for(var t=s=l,r=0;r<t.length;r++)(0,t[r])();return e}return h({type:eKz.INIT}),(o={dispatch:h,subscribe:p,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw Error(eKw(10));i=e,h({type:eKz.REPLACE})}})[eKQ]=function(){var e;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw Error(eKw(11));function t(){e.next&&e.next(u())}return t(),{unsubscribe:p(t)}}})[eKQ]=function(){return this},e},o}(eK8,o&&i&&i({name:"dnd-core",instanceId:"dnd-core"}))),s=new eKN(n,new eK4(n)),l=new eKR(n,s),c=e(l,t,r);return l.receiveBackend(c),l}(e,t,r,a)}),t[eWt]}(t.backend,t.context,t.options,t.debugMode),!t.context];return(0,gt.useEffect)(()=>{if(o){let e=eWa();return++eWe,()=>{0==--eWe&&(e[eWt]=null)}}},[]),(0,fU.jsx)(eK9.Provider,{value:a,children:r})});function eWa(){return"undefined"!=typeof global?global:window}let eWo=(0,gt.createContext)({isInProvider:!1}),eWi=e=>{let{children:t}=e,r=(0,gt.useContext)(eWo);return(0,fU.jsx)(eWo.Provider,{value:{isInProvider:!0},children:r.isInProvider?t:(0,fU.jsx)(eWr,{backend:eKk,context:window,children:t})})},eWn={color:"var(--semi-color-primary-hover)"},eWs=e=>(0,fU.jsxs)("span",{style:eWn,children:["{{",e,"}}"]});eWs(bj.t("shortcut_modal_query_message_hover_tip_component_mode_var1")),eWs(bj.t("shortcut_modal_query_message_hover_tip_component_mode_var2"));var eWl=i(92594),eWc={};eWc.styleTagTransform=yj(),eWc.setAttributes=yB(),eWc.insert=yI().bind(null,"head"),eWc.domAPI=yO(),eWc.insertStyleElement=yH(),yC()(eWl.A,eWc),eWl.A&&eWl.A.locals&&eWl.A.locals;var eWd=i(2321);let eWu="undefined"!=typeof window?gt.useLayoutEffect:gt.useEffect;function eWp(e,t,r){return function(e,t,r){let[a,o]=function(e,t,r){let[a,o]=(0,gt.useState)(()=>t(e)),i=(0,gt.useCallback)(()=>{let i=t(e);!eWd(a,i)&&(o(i),r&&r())},[a,e,r]);return eWu(i),[a,i]}(e,t,r);return eWu(function(){let t=e.getHandlerId();if(null!=t)return e.subscribeToStateChange(o,{handlerIds:[t]})},[e,o]),a}(t,e||(()=>({})),()=>r.reconnect())}function eWh(e,t){let r=[...t||[]];return null==t&&"function"!=typeof e&&r.push(e),(0,gt.useMemo)(()=>"function"==typeof e?e():e,r)}function eWm(e,t,r,a){let o=r?r.call(a,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;let i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return!1;let s=Object.prototype.hasOwnProperty.bind(t);for(let n=0;n<i.length;n++){let l=i[n];if(!s(l))return!1;let c=e[l],d=t[l];if(!1===(o=r?r.call(a,c,d,l):void 0)||void 0===o&&c!==d)return!1}return!0}function eWf(e){return null!==e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function eWg(e){let t={};return Object.keys(e).forEach(r=>{let a=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{let e=(e=null,t=null)=>{var r,o;let i;return(0,gt.isValidElement)(e)?(!function(e){if("string"==typeof e.type)return;let t=e.type.displayName||e.type.name||"the component";throw Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}(e),r=e,o=t?e=>a(e,t):a,(eKA("string"!=typeof(i=r.ref),"Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),i)?(0,gt.cloneElement)(r,{ref:e=>{eW_(i,e),eW_(o,e)}}):(0,gt.cloneElement)(r,{ref:o})):(a(e,t),e)};t[r]=()=>e}}),t}function eW_(e,t){"function"==typeof e?e(t):e.current=t}class eWb{get connectTarget(){return this.dropTarget}reconnect(){let e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();let t=this.dropTarget;if(this.handlerId){if(!t){this.lastConnectedDropTarget=t;return}e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions))}}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!eWm(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=eWg({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,eWf(e)?this.dropTargetRef=e:this.dropTargetNode=e,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}}function eWv(){let{dragDropManager:e}=(0,gt.useContext)(eK9);return eKA(null!=e,"Expected drag drop context"),e}let eWy=!1;class eWT{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;eKA(!eWy,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return eWy=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{eWy=!1}}isOver(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.targetId=null,this.internalMonitor=e.getMonitor()}}class eWk{canDrop(){let e=this.spec,t=this.monitor;return!e.canDrop||e.canDrop(t.getItem(),t)}hover(){let e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}drop(){let e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}constructor(e,t){this.spec=e,this.monitor=t}}class eWw{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){let e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){let e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return t&&this.disconnectDragSource(),this.handlerId&&(e?t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)):this.lastConnectedDragSource=e),t}reconnectDragPreview(e=!1){let t=this.dragPreview,r=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(r&&this.disconnectDragPreview(),this.handlerId){if(!t){this.lastConnectedDragPreview=t;return}r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=t,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,t,this.dragPreviewOptions))}}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!eWm(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!eWm(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(e){this.hooks=eWg({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,eWf(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,eWf(e)?this.dragPreviewRef=e:this.dragPreviewNode=e,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=e}}let eWQ=!1,eWx=!1;class eWz{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){eKA(!eWQ,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return eWQ=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{eWQ=!1}}isDragging(){if(!this.sourceId)return!1;eKA(!eWx,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return eWx=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{eWx=!1}}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,t){return this.internalMonitor.isOverTarget(e,t)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}}class eWA{beginDrag(){let e=this.spec,t=this.monitor,r=null;return null!=(r="object"==typeof e.item?e.item:"function"==typeof e.item?e.item(t):{})?r:null}canDrag(){let e=this.spec,t=this.monitor;return"boolean"==typeof e.canDrag?e.canDrag:"function"!=typeof e.canDrag||e.canDrag(t)}isDragging(e,t){let r=this.spec,a=this.monitor,{isDragging:o}=r;return o?o(a):t===e.getSourceId()}endDrag(){let e=this.spec,t=this.monitor,r=this.connector,{end:a}=e;a&&a(t.getItem(),t),r.reconnect()}constructor(e,t,r){this.spec=e,this.monitor=t,this.connector=r}}eTu.TextInput,eTu.Select;var eWE=i(32745),eWD={};eWD.styleTagTransform=yj(),eWD.setAttributes=yB(),eWD.insert=yI().bind(null,"head"),eWD.domAPI=yO(),eWD.insertStyleElement=yH(),yC()(eWE.A,eWD),eWE.A&&eWE.A.locals&&eWE.A.locals;let{Checkbox:eWS,CheckboxGroup:eWC}=eeF;eTu.UploadImage,eTu.UploadAudio,eTu.UploadDoc,eTu.UploadTable,eTu.CODE,eTu.ARCHIVE,eTu.PPT,eTu.VIDEO,eTu.TXT;let eWL=e=>{let{id:t,type:r,data:a,itemRender:o,enabled:i,onMove:n,direction:s}=e,l=(e=>{var t,r,a;let o,i,n,s,l,c,d,u,p,h,m,f,g,_,b,v,y,T,k,w,{id:Q,type:x,direction:z="verticle",enabled:A=!0,onMove:E}=e,D=(0,gt.useRef)(),S=(0,gt.useRef)(A);S.current=A;let[{isHovered:C},L]=(o=eWh({accept:x,collect:e=>({isHovered:e.isOver()}),canDrop:()=>S.current,hover:(e,t)=>{var r;if(!D.current||e.id===Q)return;let a=t.getClientOffset(),o=null==(r=D.current)?void 0:r.getBoundingClientRect(),i=!1;if("verticle"===z){if((null==a?void 0:a.y)===void 0)return;let t=(o.top+o.bottom)/2;i=(null==a?void 0:a.y)<t,E(e.id,Q,i)}if("horizontal"===z){if((null==a?void 0:a.x)===void 0)return;let t=(o.left+o.right)/2;i=(null==a?void 0:a.x)<t,E(e.id,Q,i)}}},void 0),i=eWv(),n=(0,gt.useMemo)(()=>new eWT(i),[i]),t=o.options,s=eWv(),l=(0,gt.useMemo)(()=>new eWb(s.getBackend()),[s]),eWu(()=>(l.dropTargetOptions=t||null,l.reconnect(),()=>l.disconnectDropTarget()),[t]),c=l,d=eWv(),u=(0,gt.useMemo)(()=>new eWk(o,n),[n]),(0,gt.useEffect)(()=>{u.spec=o},[o]),eWu(function(){let e,t,[r,a]=[t=(e=d.getRegistry()).addTarget(h,p),()=>e.removeTarget(t)];return n.receiveHandlerId(r),c.receiveHandlerId(r),a},[d,n,p=u,c,(h=function(e){let{accept:t}=e;return(0,gt.useMemo)(()=>(eKA(null!=e.accept,"accept must be defined"),Array.isArray(t)?t:[t]),[t])}(o)).map(e=>e.toString()).join("|")]),[eWp(o.collect,n,c),(0,gt.useMemo)(()=>c.hooks.dropTarget(),[c])]),[{isDragging:O},M,I]=(eKA(!(m=eWh({type:x,item:()=>({id:Q}),canDrag:()=>S.current,collect:e=>({isDragging:e.isDragging()})},void 0)).begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)"),f=eWv(),g=(0,gt.useMemo)(()=>new eWz(f),[f]),r=m.options,a=m.previewOptions,_=eWv(),eWu(()=>(b.dragSourceOptions=r||null,b.reconnect(),()=>b.disconnectDragSource()),[b=(0,gt.useMemo)(()=>new eWw(_.getBackend()),[_]),r]),eWu(()=>(b.dragPreviewOptions=a||null,b.reconnect(),()=>b.disconnectDragPreview()),[b,a]),v=b,y=eWv(),T=(0,gt.useMemo)(()=>new eWA(m,g,v),[g,v]),(0,gt.useEffect)(()=>{T.spec=m},[m]),eWu(function(){if(null!=w){let e,t,[r,a]=[t=(e=y.getRegistry()).addSource(w,k),()=>e.removeSource(t)];return g.receiveHandlerId(r),v.receiveHandlerId(r),a}},[y,g,v,k=T,w=(0,gt.useMemo)(()=>{let e=m.type;return eKA(null!=e,"spec.type must be defined"),e},[m])]),[eWp(m.collect,g,v),(0,gt.useMemo)(()=>v.hooks.dragSource(),[v]),(0,gt.useMemo)(()=>v.hooks.dragPreview(),[v])]);return{isHovered:C,isDragging:O,connect:(0,gt.useMemo)(()=>(e,t)=>{L(e),M(t??e),I(e),D.current=e.current},[L,M])}})({id:t,type:r,onMove:n,enabled:i,direction:s});return(0,fU.jsx)(o,{...l,data:a})},eWO=e=>e.id,eWM=e=>{let{list:t,type:r,getId:a=eWO,onChange:o,enabled:i,itemRender:n,direction:s}=e;return(0,fU.jsx)(eWi,{children:t.map(e=>{let l=a(e);return(0,fU.jsx)(eWL,{type:r,id:l,data:e,itemRender:n,enabled:i,direction:s,onMove:(e,r,i)=>{let n=[...t],s=n.findIndex(t=>a(t)===e),l=n.splice(s,1)[0],c=n.findIndex(e=>a(e)===r)+ +!i;s!==c&&(l&&n.splice(c,0,l),o(n))}},l)})})},eWI=Symbol.for("chat-area-plugins-chat-shortcuts-component-options-dnd-list"),eWP=e=>{let{options:t,onChange:r}=e,a=t.length>1,o=(0,gt.useMemo)(()=>e=>{let{data:o,connect:i}=e,n=(0,gt.useRef)(null),s=(0,gt.useRef)(null);return i(n,s),(0,fU.jsxs)("div",{ref:n,className:"flex items-center mb-6 last:mb-0",children:[(0,fU.jsx)(eGe,{className:"flex-1",value:o.value,maxLength:20,onChange:e=>{r(t=>{let r=t.findIndex(e=>e.id===o.id);return t.splice(r,1,{value:e,id:o.id}),[...t]})}}),(0,fU.jsx)("div",{className:"ml-2",ref:s,children:(0,fU.jsx)(Q5,{size:"small",className:a?"cursor-grab":"",icon:(0,fU.jsx)(eOU,{}),disabled:!a,theme:"borderless",type:"tertiary"})}),(0,fU.jsx)("div",{className:"ml-2",children:(0,fU.jsx)(kC,{content:bj.t("Remove"),children:(0,fU.jsx)(Q5,{size:"small",icon:(0,fU.jsx)(eON,{}),type:"tertiary",theme:"borderless",disabled:t.length<=1,onClick:()=>{r(e=>e.filter(e=>e.id!==o.id))}})})})]})},[a]);return(0,fU.jsx)(eWM,{type:eWI,list:t,itemRender:o,onChange:r,enabled:a})};qC(e=>{let{value:t,onChange:r,hasError:a}=e,[o,i]=(0,gt.useState)([]);return(0,gt.useEffect)(()=>{i(((null==t?void 0:t.length)?t:[""]).map(e=>({value:e,id:eqq()})))},[]),(0,gt.useEffect)(()=>{let e=o.map(e=>{var t;return null==(t=e.value)?void 0:t.trim()}).filter(e=>!!e);null==r||r(e)},[o]),(0,fU.jsxs)("div",{className:"flex flex-col items-start",children:[(0,fU.jsx)("div",{className:"coz-fg-plus mb-[14px] font-medium",children:bj.t("shortcut_modal_selector_component_options")}),(0,fU.jsx)("div",{className:"flex justify-between",children:(0,fU.jsx)(eHs,{size:"small",type:"tertiary",theme:"borderless",disabled:o.length>=20,icon:(0,fU.jsx)(eOD,{}),className:"!coz-fg-hglt text-sm font-medium",onClick:()=>{i([...o,{value:"",id:eqq()}])},children:bj.t("shortcut_modal_selector_component_options")})}),(0,fU.jsx)("div",{className:"max-h-40 my-6 overflow-y-auto",children:(0,fU.jsx)(eWP,{options:o,onChange:i})})]})});let{RadioGroup:eWB,Radio:eWR}=eeF;bj.t("shortcut_component_type_text"),bj.t("shortcut_component_type_selector"),bj.t("shortcut_modal_components_modal_upload_component");let{Text:eWH}=TQ;qC(e=>{let{value:t,onSelect:r,...a}=e;return(0,fU.jsx)(HC,{...a,showClear:!!(null==t?void 0:t.value),onClear:()=>{null==r||r({type:eTu.TextInput,value:""})},value:null==t?void 0:t.value,onSelect:e=>{let a={type:(null==t?void 0:t.type)||eTu.TextInput,value:e};return null==r||r(a),a}})},{valueKey:"value",onKeyChangeFnName:"onSelect"}),qC(e=>{let{value:t,onChange:r,...a}=e;return(0,fU.jsx)(eGe,{value:null==t?void 0:t.value,...a,maxLength:100,onChange:e=>{let a={type:(null==t?void 0:t.type)||eTu.TextInput,value:e};return null==r||r(a),a}})},{valueKey:"value",onKeyChangeFnName:"onChange"}),Symbol.for("chat-area-plugins-chat-shortcuts-components-table-item");var eWF=i(85511),eWj={};eWj.styleTagTransform=yj(),eWj.setAttributes=yB(),eWj.insert=yI().bind(null,"head"),eWj.domAPI=yO(),eWj.insertStyleElement=yH(),yC()(eWF.A,eWj),eWF.A&&eWF.A.locals&&eWF.A.locals;var eWN=((eW={}).PLUGIN="plugin",eW.WORKFLOW="workflow",eW.IMAGEFLOW="imageflow",eW.KNOWLEDGE="knowledge",eW.VARIABLE="variable",eW.DATABASE="database",eW.LONG_TERM_MEMORY="longTermMemory",eW.FILE_BOX="fileBox",eW.TRIGGER="trigger",eW.ONBOARDING="onboarding",eW.SUGGEST="suggest",eW.VOICE="voice",eW.BACKGROUND="background",eW.DOCUMENT="document",eW.TABLE="table",eW.PHOTO="photo",eW.SHORTCUT="shortcut",eW.DEV_HOOKS="devHooks",eW.USER_INPUT="userInput",eW),eWU=((eZ={}).PLUGIN="plugin",eZ.WORKFLOW="workflow",eZ.KNOWLEDGE="knowledge",eZ),eWV=((eX={}).SKILL="skill",eX.KNOWLEDGE="knowledge",eX.MEMORY="memory",eX.DIALOG="dialog",eX.HOOKS="hooks",eX.CHARACTER="character",eX);eWN.PLUGIN,eWN.SHORTCUT,eWN.DEV_HOOKS,eWU.PLUGIN,eWN.PLUGIN,eWN.WORKFLOW,eWN.IMAGEFLOW,eWN.DATABASE,eWN.FILE_BOX,eWN.KNOWLEDGE,eWN.ONBOARDING,eWN.SUGGEST,eWN.TRIGGER,eWN.VARIABLE,eWN.VOICE,eWN.LONG_TERM_MEMORY,eWN.BACKGROUND,eWN.TABLE,eWN.DOCUMENT,eWN.PHOTO,eWN.SHORTCUT,eWN.DEV_HOOKS,eWN.USER_INPUT,eWV.SKILL,eWV.KNOWLEDGE,eWV.MEMORY,eWV.DIALOG,eWV.CHARACTER,eWV.HOOKS;let eWq=e=>{var t;let{controller:r,onShortcutActive:a}=e,o=(0,gt.useRef)(void 0),i=ej9(),n=ej8(e=>e.shortcuts),s=null==(t=n.at(0))?void 0:t.command_id;return(null==n?void 0:n.length)?(0,fU.jsx)(eKa,{shortcuts:n,wrapperClassName:yY()("w-full pl-[68px] pr-[24px] pb-[10px]"),uiMode:(e=>{let{bizScene:t,showBackground:r}=e;return"agentApp"===t?"grey":"home"===t?r?"blur":"white":"store"===t||"debug"===t||"websdk"===t?r?"blur":"grey":"white"})({bizScene:"websdk",showBackground:i}),defaultId:s,onActiveShortcutChange:(e,t)=>{o.current=e,r.setChatInputSlotVisible(!t),null==a||a(e)},onBeforeSendTemplateShortcut:e=>{var t,r,a;let{message:o,options:i,shortcut:n}=e,s={};Object.entries((null==i||null==(a=i.extendFiled)||null==(r=a.toolList)||null==(t=r[0])?void 0:t.parameters)||{}).map(e=>{let[t,r]=e;s[t]=r.value});let l=i||{};return l.extendFiled||(l.extendFiled={}),(n.tool_type===eTh.ToolTypePlugin||n.tool_type===eTh.ToolTypeWorkFlow)&&(l.extendFiled.shortcut_command={command_id:n.command_id,parameters:s}),{message:o,options:i}}}):null},eWG=e=>{let{width:t,height:r,className:a}=e;return(0,fU.jsx)(ew7,{svg:(0,fU.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"currentColor",children:(0,fU.jsx)("path",{d:"M13.4997 16.5H4.49881C2.84338 16.5 1.5 15.1574 1.5 13.5013V4.50088C1.5 2.84333 2.84338 1.5 4.49881 1.5H13.4997C15.158 1.5 16.5 2.84331 16.5 4.50088V13.5013C16.5 15.1574 15.158 16.5 13.4997 16.5ZM15.0013 5.25092C15.0013 4.00792 13.9919 3.00008 12.7496 3.00008H5.24889C4.00657 3.00008 2.99864 4.00792 2.99864 5.25092V12.7498C2.99864 13.9943 4.00657 15.0007 5.24889 15.0007H12.7496C13.9919 15.0007 15.0013 13.9943 15.0013 12.7498V5.25092ZM9.74933 11.9997C9.74933 12.414 9.41351 12.7498 8.99925 12.7498C8.585 12.7498 8.24918 12.414 8.24918 11.9997V9.75115H5.99967C5.58503 9.75115 5.24889 9.41502 5.24889 9.00037C5.24889 8.58572 5.58503 8.24958 5.99967 8.24958H8.24918V6.00099C8.24918 5.58674 8.585 5.25092 8.99925 5.25092C9.41351 5.25092 9.74933 5.58674 9.74933 6.001V8.24958H11.9988C12.4135 8.24958 12.7496 8.58572 12.7496 9.00037C12.7496 9.41502 12.4135 9.75115 11.9988 9.75115H9.74933V11.9997Z",fill:"currentColor"})}),className:a,style:{width:t,height:r}})},eWK=()=>{var e,t,r,a,o,i,n,s,l,c,d,u,p,h,m,f,g,_;let{chatConfig:b}=ej7(),v=[],y=[];return console.log("useChatOpInfo:",b),(null==b||null==(t=b.ui)||null==(e=t.header)?void 0:e.isShow)?(null==b||null==(a=b.ui)||null==(r=a.chatBot)?void 0:r.isNeedClearContext)?(v.push("clearContext"),(null==b||null==(i=b.ui)||null==(o=i.chatBot)?void 0:o.isNeedClearMessage)?y.push("clearMessage"):(null==b||null==(s=b.ui)||null==(n=s.chatBot)?void 0:n.isNeedAddNewConversation)&&y.push("addNewConversation")):(null==b||null==(c=b.ui)||null==(l=c.chatBot)?void 0:l.isNeedClearMessage)?v.push("clearMessage"):(null==b||null==(u=b.ui)||null==(d=u.chatBot)?void 0:d.isNeedAddNewConversation)&&v.push("addNewConversation"):((null==b||null==(h=b.ui)||null==(p=h.chatBot)?void 0:p.isNeedClearContext)&&v.push("clearContext"),(null==b||null==(f=b.ui)||null==(m=f.chatBot)?void 0:m.isNeedClearMessage)?v.push("clearMessage"):(null==b||null==(_=b.ui)||null==(g=_.chatBot)?void 0:g.isNeedAddNewConversation)&&v.push("addNewConversation")),{chatInputLeftOps:v,headerTopLeftOps:y}},eWW=e=>{let{isClearHistoryButtonDisabled:t,isClearContextButtonDisabled:r}=eHT({}),{readonly:a}=ej7(),{clearHistory:o}=(()=>{let{useMessagesStore:e,useSelectionStore:t,useOnboardingStore:r}=ey3(),{updateReplyIdList:a,onboardingIdList:o}=t(e=>({updateReplyIdList:e.updateReplyIdList,onboardingIdList:e.onboardingIdList})),{enableSelectOnboarding:i}=eTi(),n=eHk(eMb()),s=eMv(eMb()),l=r(e=>e.prologue),c=eHw(eMb());return{clearHistory:async()=>{n(),await c()},selectAll:t=>{let{maxLength:r,direction:n}=t??{},c=e.getState().messageGroupList.filter(e=>e.selectable).map(e=>e.groupId).filter(e=>!!e);if(Yd(r)||!n)return void a(c);a(("backward"===n?c:c.reverse()).slice(0,r));let d=o.at(0);i&&s({selectedId:d??null,onboarding:{prologue:l}})},unselectAll:n,getMessageList:()=>eMV(e.getState().messages)}})(),i=eHQ();return(0,gt.useMemo)(()=>e.map(e=>"addNewConversation"===e?{icon:(0,fU.jsx)(eWG,{width:"18px",height:"18px"}),text:bj.t("web_sdk_add_new_conversation"),disabled:t||a,onClick:()=>{null==o||o()}}:"clearContext"===e?{icon:(0,fU.jsx)(Zx,{width:"18px",height:"18px"}),text:bj.t("store_start_new_chat"),disabled:r||a,onClick:()=>{i()}}:{icon:(0,fU.jsx)(Ze,{width:"18px",height:"18px"}),text:bj.t("coze_home_delete_btn"),disabled:t||a,onClick:()=>{null==o||o()}}),[e,r,t,a,o,i])};var eWZ=i(67731),eWX={};eWX.styleTagTransform=yj(),eWX.setAttributes=yB(),eWX.insert=yI().bind(null,"head"),eWX.domAPI=yO(),eWX.insertStyleElement=yH(),yC()(eWZ.A,eWX);let eWY=eWZ.A&&eWZ.A.locals?eWZ.A.locals:void 0,eW$=e=>{let{buttonList:t}=e,r=ej9(),[a,o]=(0,gt.useState)(!1),{readonly:i}=ej7();return(0,gt.useEffect)(()=>(document.addEventListener("click",()=>{o(!1)}),()=>{o(!1)}),[]),(0,fU.jsx)($b,{content:(0,fU.jsx)(AA,{className:eWY.container,vertical:!0,spacing:0,children:null==t?void 0:t.map((e,t)=>(0,fU.jsx)(Xg,{color:"secondary",className:eWY.button,icon:null==e?void 0:e.icon,iconPosition:"left",onClick:null==e?void 0:e.onClick,disabled:null==e?void 0:e.disabled,children:null==e?void 0:e.text},t))}),trigger:"custom",visible:a,position:"topLeft",style:{borderRadius:"4px"},children:(0,fU.jsx)(ev4,{"data-testid":"bot-edit-debug-chat-clear-button",showBackground:r,disabled:i,icon:(0,fU.jsx)(W$,{className:"text-18px"}),size:"default",onClick:e=>{e.stopPropagation(),o(e=>!e)},className:yY()("mr-12px","!rounded-full")})})},eWJ=()=>{var e,t;let{chatInputLeftOps:r}=eWK(),a=ej9(),{chatConfig:o}=ej7(),i=(null==(t=o.ui)||null==(e=t.base)?void 0:e.layout)===fW.MOBILE,n=eWW(r);return 0===r.length?null:(0,fU.jsxs)("div",{className:eWY["chat-input-left-slot"],children:[n.length>1?(0,fU.jsx)(eW$,{buttonList:n}):null,1===n.length?(0,fU.jsx)(ebY,{content:n[0].text,hideToolTip:i,children:(0,fU.jsx)(ev4,{"data-testid":"bot-edit-debug-chat-clear-button",showBackground:a,disabled:n[0].disabled,icon:n[0].icon,onClick:e=>{var t,r;null==(t=(r=n[0]).onClick)||t.call(r)},className:yY()("mr-12px","!rounded-full",a?"!coz-fg-images-white":"",{[eWY.disabled]:n[0].disabled})})}):null]})};var eW1=i(26355),eW0={};eW0.styleTagTransform=yj(),eW0.setAttributes=yB(),eW0.insert=yI().bind(null,"head"),eW0.domAPI=yO(),eW0.insertStyleElement=yH(),yC()(eW1.A,eW0);let eW2=eW1.A&&eW1.A.locals?eW1.A.locals:void 0,eW3=e=>{var t,r,a,o,i,n;let{coreAreaClassName:s,className:l,showInputArea:c=!0,inputPlaceholder:d,inputNativeCallbacks:u,messageGroupListClassName:p,renderChatInputTopSlot:h,renderChatInputRightActions:m,isShowClearContextDivider:f,headerNode:g,messageMaxWidth:_,isMiniScreen:b,enableMultimodalUpload:v=!1,uiKitCustomComponents:y,contentBox:T,getMessageRenderIndex:k,inputMode:w,onboardingPrologue:Q,showOnboardingBotInfo:x,showOnboardingSuggestions:z}=e,A=eF4(),{layout:E,onInitStateChange:D,chatConfig:S}=ej7(),C=(0,gt.useRef)(null),{readonly:L}=ej7(),O=ej8(e=>e.currentConversationInfo),M=!O||""===O.id,I=(0,gt.useMemo)(()=>m?()=>m()||null:void 0,[m]),P=(0,gt.useMemo)(()=>({chatInputIntegration:{renderChatInputTopSlot:e=>(0,fU.jsxs)(fU.Fragment,{children:[null==h?void 0:h(),(0,fU.jsx)(eWq,{controller:e})]})},inputRightActions:I,contentBox:T||eqV}),[h,I,T]);if((0,gt.useEffect)(()=>{switch(A){case"initSuccess":case"initFail":null==D||D(A)}},[A,D]),"initSuccess"!==A)return null;let B=(null==S||null==(r=S.ui)||null==(t=r.chatBot)?void 0:t.uploadable)??!0,R=!v&&B,H=v&&B;return(0,fU.jsx)("div",{className:yY()(eW2.area,l,{[eW2.disabled]:L}),tabIndex:1e3,ref:C,children:(0,fU.jsx)(eH1,{classname:s,layout:E===fW.PC?void 0:E,showInputArea:c,newMessageInterruptScenario:"never",messageGroupListClassName:p,showClearContextDivider:f||(null==S||null==(o=S.ui)||null==(a=o.chatBot)?void 0:a.isNeedClearContext),messageMaxWidth:_,showStopRespond:!0,enableLegacyUpload:R,enableMultimodalUpload:H,fileLimit:H?6:void 0,textareaPlaceholder:d||bj.t("chatInputPlaceholder"),enableMessageBoxActionBar:!0,chatInputProps:{wrapperClassName:eW2.chatInput,inputNativeCallbacks:u,safeAreaClassName:(null==S||null==(n=S.ui)||null==(i=n.footer)?void 0:i.isShow)!==!1?eW2["safe-area"]:"",leftActions:(0,fU.jsx)(eWJ,{}),inputMode:w},componentTypes:P,readonly:L,uiKitChatInputButtonConfig:{isClearContextButtonVisible:!1,isClearHistoryButtonVisible:!1},isMiniScreen:b,headerNode:M?null:g,uiKitCustomComponents:y,getMessageRenderIndex:k,onboardingPrologue:Q,showOnboardingBotInfo:x,showOnboardingSuggestions:z})})};var eW4=i(71821),eW6={};eW6.styleTagTransform=yj(),eW6.setAttributes=yB(),eW6.insert=yI().bind(null,"head"),eW6.domAPI=yO(),eW6.insertStyleElement=yH(),yC()(eW4.A,eW6);let eW5=eW4.A&&eW4.A.locals?eW4.A.locals:void 0,eW7=()=>(0,fU.jsx)("div",{className:eW5.loading,children:(0,fU.jsx)(wX,{size:"large"})}),eW8="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFYAAABXCAYAAACeCrJSAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABG6SURBVHgB7V17jFxVGf/OuXdmZ/bZ2W3pg1JakBYKpSiGoNjaSkVFC0WMj0QN/KVGFAWEGP5AEhMTE3mERFGjAhEkQKCIUZACBQF5FNqEp0Dbhb6Xdrvb7mNe9x6/7zvn3Ht3dmZndntnd0jm15zee2funHvO737ne51z7wI00cRHCWKiLzd8c99iryg2SCVWQhMMJfz3JcDmjQ/M3zzReWWJ3fC1fWs8JW7A3TXQRCX0CiXu+PuDc28s9+UYYjds2DnLc1pvxvtyGTRRK3qdhFq78d75vdEPA2KJ1KKTfgo/OAuamCwGPCnX/vP+47bZD6Td8Zz0Q01Sp4xZju8/RTbJfsDEXnRp35XQ1KfHilleQfzFHjCxCvyfQBNxYA0ZftqR67+67zLcLoYmYoHxplBiHXExNBEn1pAjINEXWwxNxItE22KplGp6AjHDA+8sCU3UBQ1NrBC6kN9iixAKPgpwoaGgmEhluKNtaytAOi1gdo/Dn42MKDh0yIeRUR9KUx0Cf6wahPcZJ1Y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pgy0AL04nTUJfY4yEA4XsslqBI+IoassUCqVEp5SfRvegXEkkqQXnItCvSd0ETNIEnF7NvajZG/5WU+Hw/6wz5Cyiubf9WjMkhKfeHf6hazt5AXUPr9/wEj5uuJCce4RQAAAABJRU5ErkJggg==";var eW9=i(32928),eZe={};eZe.styleTagTransform=yj(),eZe.setAttributes=yB(),eZe.insert=yI().bind(null,"head"),eZe.domAPI=yO(),eZe.insertStyleElement=yH(),yC()(eW9.A,eZe);let eZt=eW9.A&&eW9.A.locals?eW9.A.locals:void 0,eZr=e=>{let{iconUrl:t=eW8,title:r="Coze Bot",extra:a,theme:o,isShowConversations:i,isNeedLogo:n=!0}=e,{headerTopLeftOps:s}=eWK(),l=eWW(s),{updateCurrentConversationInfo:c,currentConversationInfo:d,updateConversations:u,cozeApi:p}=ej8(b7(e=>({updateCurrentConversationInfo:e.updateCurrentConversationInfo,currentConversationInfo:e.currentConversationInfo,updateConversations:e.updateConversations,cozeApi:e.cozeApi}))),{chatConfig:{type:h}}=ej7(),[m,f]=(0,gt.useState)(!1),[g,_]=(0,gt.useState)(""),[b,v]=(0,gt.useState)(!1),y=null==d?void 0:d.id,T=(0,gt.useMemo)(()=>""!==y&&d&&ejP(d)||r,[y,d,r]),k=async()=>{if((null==d?void 0:d.id)&&""!==d.id&&g.trim()){v(!0);try{let e,t=h===fZ.APP,r=t?`/v1/workflow/conversations/${d.id}`:`/v1/conversations/${d.id}`,a=t?{title:g.trim()}:{name:g.trim()},o=await (null==p?void 0:p.put(r,a));if(0!==o.code||!o.data)return;if(t&&"conversation_id"in o.data){let t=o.data;e={id:t.conversation_id||t.id||d.id,name:t.conversation_name||t.name||g.trim(),title:t.title||g.trim(),created_at:t.created_at?Math.floor(t.created_at/1e3):d.created_at||Math.floor(Date.now()/1e3),updated_at:t.updated_at?Math.floor(t.updated_at/1e3):Math.floor(Date.now()/1e3),last_section_id:t.last_section_id||d.last_section_id||"",meta_data:t.meta_data||d.meta_data||{},sort:ejc.Today}}else e={...o.data,sort:ejc.Today};await u([e],"update");let i=e;c({...d,name:e.name,...t&&i.title&&{title:i.title}}),f(!1)}catch(e){console.error("Failed to rename conversation:",e)}finally{v(!1)}}};return(0,fU.jsxs)("header",{className:yY()(eZt.header,{[eZt["bg-theme"]]:"bg-theme"===o}),children:[(null==d?void 0:d.conversationListVisible)||!i?null:(0,fU.jsx)(Yx,{color:"secondary",icon:(0,fU.jsx)(Zz,{width:"18px",height:"18px"}),className:eZt["conversation-list-btn"],onClick:()=>{d&&c({...d,conversationListVisible:!0})}}),n?(0,fU.jsx)("img",{className:eZt.avatar,src:t,alt:"avatar"}):null,(0,fU.jsx)(TQ.Text,{className:yY()(eZt.title,{[eZt["title-clickable"]]:(null==d?void 0:d.id)&&""!==d.id}),ellipsis:{showTooltip:{opts:{style:{wordBreak:"break-word"},position:"bottom"},type:"tooltip"},rows:1},onClick:()=>{(null==d?void 0:d.id)&&""!==d.id&&(_(h===fZ.APP?d.title||d.name||"":d.name||d.title||""),f(!0))},children:T}),null==l?void 0:l.map(e=>(0,fU.jsx)(Xg,{color:"secondary",icon:e.icon,className:eZt["icon-btn"],disabled:e.disabled,onClick:()=>{var t;null==(t=e.onClick)||t.call(e)}})),!!a&&a,(0,fU.jsx)(Je,{getPopupContainer:()=>document.querySelector(".coze-chat-sdk"),okButtonProps:{loading:b},visible:m,onCancel:()=>f(!1),title:bj.t("web_sdk_rename_conversation",{},"重命名会话"),onOk:k,okText:bj.t("web_sdk_confirm",{},"确定"),cancelText:bj.t("web_sdk_cancel",{},"取消"),okButtonColor:"brand",closable:!1,maskClosable:!1,style:{maxWidth:"80%"},children:(0,fU.jsx)(Jz,{placeholder:bj.t("web_sdk_conversation_placeholder",{},"请输入会话名称"),value:g,maxLength:100,onChange:e=>_(e),onKeyPress:e=>{"Enter"===e.key&&k()}})})]})};var eZa=i(1241),eZo={};eZo.styleTagTransform=yj(),eZo.setAttributes=yB(),eZo.insert=yI().bind(null,"head"),eZo.domAPI=yO(),eZo.insertStyleElement=yH(),yC()(eZa.A,eZo);let eZi=eZa.A&&eZa.A.locals?eZa.A.locals:void 0,eZn=e=>{let{iconUrl:t=eW8,title:r="Coze Bot",extra:a,theme:o,isShowConversations:i,isNeedLogo:n=!0}=e,{headerTopLeftOps:s}=eWK(),l=eWW(s),{updateCurrentConversationInfo:c,currentConversationInfo:d,updateConversations:u,cozeApi:p}=ej8(b7(e=>({updateCurrentConversationInfo:e.updateCurrentConversationInfo,currentConversationInfo:e.currentConversationInfo,updateConversations:e.updateConversations,cozeApi:e.cozeApi}))),{chatConfig:{type:h}}=ej7(),[m,f]=(0,gt.useState)(!1),[g,_]=(0,gt.useState)(""),[b,v]=(0,gt.useState)(!1),y=null==d?void 0:d.id,T=(0,gt.useMemo)(()=>""!==y&&d&&ejP(d)||r,[y,d,r]),k=async()=>{if((null==d?void 0:d.id)&&""!==d.id&&g.trim()){v(!0);try{let e,t=h===fZ.APP,r=t?`/v1/workflow/conversations/${d.id}`:`/v1/conversations/${d.id}`,a=t?{title:g.trim()}:{name:g.trim()},o=await (null==p?void 0:p.put(r,a));if(0!==o.code||!o.data)return;if(t&&"conversation_id"in o.data){let t=o.data;e={id:t.conversation_id||t.id||d.id,name:t.conversation_name||t.name||g.trim(),title:t.title||g.trim(),created_at:t.created_at?Math.floor(t.created_at/1e3):d.created_at||Math.floor(Date.now()/1e3),updated_at:t.updated_at?Math.floor(t.updated_at/1e3):Math.floor(Date.now()/1e3),last_section_id:t.last_section_id||d.last_section_id||"",meta_data:t.meta_data||d.meta_data||{},sort:ejc.Today}}else e={...o.data,sort:ejc.Today};await u([e],"update");let i=e;c({...d,name:e.name,...t&&i.title&&{title:i.title}}),f(!1)}catch(e){console.error("Failed to rename conversation:",e)}finally{v(!1)}}};return(0,fU.jsxs)("header",{className:yY()(eZi.header,{[eZi["bg-theme"]]:"bg-theme"===o}),children:[(null==d?void 0:d.conversationListVisible)||!i?null:(0,fU.jsx)(Yx,{color:"secondary",icon:(0,fU.jsx)(Zz,{width:"18px",height:"18px"}),className:eZi["conversation-list-btn"],onClick:()=>{d&&c({...d,conversationListVisible:!0})}}),n?(0,fU.jsx)("img",{className:eZi.avatar,src:t,alt:"avatar"}):null,(0,fU.jsx)(TQ.Text,{className:yY()(eZi.title,{[eZi["title-clickable"]]:(null==d?void 0:d.id)&&""!==d.id}),ellipsis:{rows:1},onClick:()=>{(null==d?void 0:d.id)&&""!==d.id&&(_(h===fZ.APP?d.title||d.name||"":d.name||d.title||""),f(!0))},children:T}),null==l?void 0:l.map(e=>(0,fU.jsx)(Xg,{color:"secondary",icon:e.icon,className:eZi["icon-btn"],disabled:e.disabled,onClick:()=>{var t;null==(t=e.onClick)||t.call(e)}})),!!a&&a,(0,fU.jsx)(Je,{getPopupContainer:()=>document.querySelector(".coze-chat-sdk"),okButtonProps:{loading:b},visible:m,onCancel:()=>f(!1),title:bj.t("web_sdk_rename_conversation",{},"重命名会话"),onOk:k,okText:bj.t("web_sdk_confirm",{},"确定"),cancelText:bj.t("web_sdk_cancel",{},"取消"),okButtonColor:"brand",closable:!1,maskClosable:!1,style:{maxWidth:"80%"},children:(0,fU.jsx)(Jz,{placeholder:bj.t("web_sdk_conversation_placeholder",{},"请输入会话名称"),value:g,maxLength:100,onChange:e=>_(e),onKeyPress:e=>{"Enter"===e.key&&k()}})})]})};var eZs=i(64112),eZl={};eZl.styleTagTransform=yj(),eZl.setAttributes=yB(),eZl.insert=yI().bind(null,"head"),eZl.domAPI=yO(),eZl.insertStyleElement=yH(),yC()(eZs.A,eZl);let eZc=eZs.A&&eZs.A.locals?eZs.A.locals:void 0,eZd=()=>{let{updateCurrentConversationInfo:e,currentConversationInfo:t}=ej8(b7(e=>({updateCurrentConversationInfo:e.updateCurrentConversationInfo,currentConversationInfo:e.currentConversationInfo})));return(null==t?void 0:t.conversationListVisible)?null:(0,fU.jsx)($l,{content:bj.t("web_sdk_open_conversations"),children:(0,fU.jsx)(Yx,{className:eZc["float-open-conversations-btn"],size:"small",style:{height:"32px",borderTopLeftRadius:"unset",borderBottomLeftRadius:"unset"},icon:(0,fU.jsx)(Z_,{}),onClick:()=>{t&&e({...t,conversationListVisible:!0})}})})},eZu=e=>{let{isMobile:t,...r}=e,{isShowConversations:a,isShowHeader:o}=r;return o?t?(0,fU.jsx)(eZn,{...r}):(0,fU.jsx)(eZr,{...r}):a?(0,fU.jsx)(eZd,{}):null};var eZp=i(84054),eZh={};eZh.styleTagTransform=yj(),eZh.setAttributes=yB(),eZh.insert=yI().bind(null,"head"),eZh.domAPI=yO(),eZh.insertStyleElement=yH(),yC()(eZp.A,eZh);let eZm=eZp.A&&eZp.A.locals?eZp.A.locals:void 0,eZf=e=>{let t,r,{isShow:a=!0,expressionText:o,linkvars:i,footerClassName:n,textClassName:s,theme:l}=e;return a?(0,fU.jsx)("footer",{className:yY()(eZm.footer,n,{[eZm["bg-theme"]]:"bg-theme"===l}),children:(0,fU.jsx)("span",{className:yY()(eZm.text,s),children:o?(t=[],r="{{{link}}}",o.replace(/\{\{\s*(\w+)\s*\}\}/g,(e,a)=>{let{link:o,text:n}=(null==i?void 0:i[a])||{};return o&&n?t.push((0,fU.jsx)("a",{className:eZm.link,href:o,target:"_blank",children:n})):t.push(n||""),r}).split(r).map((e,r)=>(0,fU.jsxs)(gt.Fragment,{children:[e,t[r]]},`text_link_${r}`))):bj.t("web_sdk_official_banner",{docs_link:(0,fU.jsx)("a",{className:eZm.link,href:"",target:"_blank",children:bj.t("web_sdk_official_banner_link")},"web_sdk_official_banner")})})}):null};var eZg=i(98046),eZ_={};eZ_.styleTagTransform=yj(),eZ_.setAttributes=yB(),eZ_.insert=yI().bind(null,"head"),eZ_.domAPI=yO(),eZ_.insertStyleElement=yH(),yC()(eZg.A,eZ_);let eZb=eZg.A&&eZg.A.locals?eZg.A.locals:void 0,eZv=e=>{let{error:t,onBeforeRetry:r,refresh:a}=e,o=bj.t("overview_bi_assistant_system_error");if(t){o=t.msg;let e=(e=>{let t=null==e?void 0:e.code;if(0x29db5cd3===t)return{code:t,msg:bj.t("unbind_notification")}})(t);e&&(o=e.msg)}let i=bj.t("web_sdk_retry_notification"),n=!!(null==t?void 0:t.code)&&bq.includes(t.code);return(0,fU.jsxs)("div",{className:eZb.wrapper,children:[(0,fU.jsx)("img",{className:eZb.icon,src:eZy(t)}),(0,fU.jsx)("div",{className:eZb.message,children:o}),!n&&(0,fU.jsx)("div",{className:eZb.extra,children:bj.t(`web_sdk_api_error_${null==t?void 0:t.code}`,{},i)}),(0,fU.jsx)(Xg,{className:eZb.btn,onClick:()=>{null==r||r(),a?null==a||a():location.reload()},children:bj.t("retry")})]})},eZy=e=>(null==e?void 0:e.code)===bV.BotUnbind?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACQCAYAAADnRuK4AAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABHnSURBVHgB7Z1bc9vGFYAXWIA32dHIF9VJqiZxM3Im9qRuLg/2dNyHPPfX9rV5SB7SmaZJPGM7cTytPbVdxZ6GlnUhCRLAoueIVExKIrlnb1jI+B58kSCKxB6cPXuujNXU1NTU1NTU1NTU1NTU1NTU1NTULIGzGud88skncRAErc3NTfbzzz8LVmECVmONs2fPXkjT9I0wDFeFEGfhS3FRhJ3jVwZpEOR9uG6Q53w3isTOBx980P32229T5jm1ABkGhSbP8408D37DWBEzDcKw6MJfT9bW1rpbW1t95iGVECBU+Xfv3r0MT+h5IYLz+LUgEDuwDTwaDAZPWMkcvj/Govd0hWYeURQ8gc//dG9v7xfmEd4L0FtvvdV58WLnRlEUnZO+D0LUP3du9e9lPKEuBOcoqJVAI932RSN5L0Ct1srn84TnEBSiJOl9Bf90ZjO0Wq3LRcE3XQnOUVAjra6uPihbkLw+hbXb7Y2iYBsSl8ZR1BJ5Puoyy6BGzLLsMzCG32El3j8h2GqSDC+126290WhUmhB5LUAgFH+EJ7wpc20YCgYLa9UeQgO510s+BaFeZX4Q53mxEUVhAIa79YfnJELmMUUh3p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yPsvCVc6DN4QQONgEb/qxLQDd//BnFobRrhDJThzHOzqluzWnn3jyBL920wJrampqampqampqampqampqampqairB/wHJDRbt+mLgRAAAAABJRU5ErkJggg==":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACQCAYAAADnRuK4AAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABBdSURBVHgB7Z39b9vGGcfvhZRkObZgO3GdFOm2oLPRptiCBQPWYn/6fhlQrD906Yomzhajy7A6c7wmsuMXiZRIHvc8IpXZrSXxOZIiT7oPYNitpdgmv3ze744xi8VisVgsFovFYrHMD86WkHv37rXPzs7WoyhqO46zopRqx3HswscKfj+ORfum93Gu+sln7sFHIIToh2HoSSn7jUbDOz09PWNLxsILCMVycnKyAze7A0JZA3F0WImAyM5AUOfws7qtVut80UW1cAJ6/Pix+/z58x2wELejiH8A9sRlFQK/R1+I+Bys2/HGxkb36OiozxaIhRAQimZ/f/8+3KwdpfgWqzEgpi58OlwUMRktoLW1tdsQg+zWXTSTkJIdg+gPe73eMTMU4wSE1ubZs2cPGHN+VbV7Kgp0cxA7HZholYwR0CIK5+fwwHHYcafTOTBFSLUX0HII5+c4Dj80QUi1FlCz2dxbNuFcBV1bHIevBoPBC1ZTaikgDI6DQP0WUt82s7yPkTzPO2Q1Q7Iage4KKsSPwzD+BP5zKa3OBKBKzndarUb7zp075xcXFwGrCbWxQKurqzthyB4tq7vKSt2sUeUCQqvz9OnTPc4x1pkfSYXYPYF+GHwO4UME2M9aWVkJIHDFJ/ynT7kLbREXbpwLtScHPtpKOW0p+XrSS1PrbI64rnh5eXl5cMPvOVcqFVDSpzr7fA6xTiiEPIvj4Nh13TNwAeeshAsPsdtWEAQdIRpbURTehv/lsBLBh2Bzs/NVlZlaZQKCJ/2+UuJhiS4rhMbpD80mPwbBdFkFoKB8X92HivPtcae/eHAqQO1X5dIqERCk57sQv++x4qlcNJMYiwl6YfdZKUQHVaT7cxc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h9DMNZpNOTXntfDKcJaVeDrZoGugek+xCofLbFbC3EBJ6TnuYffy6LWAkpZRrc2Fg4uIa91YdQEAY0ZCwn3vCmldlQDjBHOGJMENAa3zdtasIzNOOGMMVFA71ldXd2JY3k/ikIjzynDxqfjsBfp/pNGYrSArjCySuDZoD0S1XoL3mSzquDY931sPRg/HLcoArrKSEycu9BOiDo1cHOhlI3jOB68hSo2Fv8WaqJyEQV0DVyIB0/7ehiKLSl5h3piMRUc5hLCOVfKP9vc3Dw+Ojoy+pDeWSy8gG4CRYX9rCjCPpaz4jiiDZbKBXGNrNWkAS/s8CefhQdfB2Go+tBH86SU/U6nc77oYrFYLBaLxWKxWCwWS9X8D4fdLEcUgXVMAAAAAElFTkSuQmCC",{Title:eZT,Text:eZk}=TQ,eZw=()=>(0,fU.jsxs)("div",{children:[(0,fU.jsx)(eZT,{children:bj.t("404_title")}),(0,fU.jsx)(eZk,{children:bj.t("404_content")})]}),eZQ=e=>{let{children:t}=e;return(0,fU.jsx)(eiG,{errorBoundaryName:"ErrorBoundary",logger:eUl.getLogger(),FallbackComponent:eZw,children:t})};var eZx=i(44130),eZz={};eZz.styleTagTransform=yj(),eZz.setAttributes=yB(),eZz.insert=yI().bind(null,"head"),eZz.domAPI=yO(),eZz.insertStyleElement=yH(),yC()(eZx.A,eZz);let eZA=eZx.A&&eZx.A.locals?eZx.A.locals:void 0,eZE=e=>{let{useInIframe:t=!0,...r}=e,{chatConfig:a}=r??{};return(null==a?void 0:a.bot_id)?(a.auth&&(a.auth.connectorId=a.auth.connectorId||"999"),(0,fU.jsx)(eZD,{...r,useInIframe:t})):null},eZD=e=>{var t;let{layout:r,className:a,useInIframe:o=!1,chatConfig:i,userInfo:n,style:s,onImageClick:l,onThemeChange:c}=e;i.ui||(i.ui={}),i.ui.chatBot||(i.ui.chatBot={}),(null==(t=i.auth)?void 0:t.type)==="token"?(i.ui.chatBot.isNeedClearMessage=!1,i.ui.chatBot.isNeedAddNewConversation=i.ui.chatBot.isNeedAddNewConversation??!0,i.ui.chatBot.isNeedClearContext=i.ui.chatBot.isNeedClearContext??!0):(i.ui.chatBot.isNeedClearMessage=!0,i.ui.chatBot.isNeedAddNewConversation=!1,i.ui.chatBot.isNeedClearContext=!1);let d={chatConfig:{...i,source:yz.WebSdk},layout:r,userInfo:n,initErrorFallbackFC:eZv,onImageClick:l};return(0,fU.jsx)(eZQ,{children:(0,fU.jsx)("div",{className:yY()(eZA.cozeChatApp,!o&&eZA.bordered,a),style:s,children:(0,fU.jsx)(eqH,{...d,onThemeChange:c,children:(0,fU.jsx)(eZS,{chatProps:d,webSdkProps:e})})})})},eZS=e=>{var t;let{chatProps:r,webSdkProps:a}=e,{layout:o,title:i,headerExtra:n,icon:s,chatConfig:l}=a,c=eF4(),d=o===fW.MOBILE,{header:u,conversations:p}=(null==l?void 0:l.ui)||{},h=eNe(),m=null==p?void 0:p.isNeed;return"initSuccess"!==c?(0,fU.jsx)(eW7,{}):(0,fU.jsxs)("div",{className:eZA.content,children:[(0,fU.jsx)(eW3,{...r,enableMultimodalUpload:!0,headerNode:(0,fU.jsx)(eZu,{title:i,extra:n,iconUrl:(null==u?void 0:u.icon)||s,theme:h,isMobile:d,isShowConversations:m,isShowHeader:(null==u?void 0:u.isShow)!==!1,isNeedLogo:(null==u?void 0:u.isNeedLogo)!==!1})}),(0,fU.jsx)(eZf,{...(null==l||null==(t=l.ui)?void 0:t.footer)||{},theme:h})]})};var eZC=i(63020),eZL={};eZL.styleTagTransform=yj(),eZL.setAttributes=yB(),eZL.insert=yI().bind(null,"head"),eZL.domAPI=yO(),eZL.insertStyleElement=yH(),yC()(eZC.A,eZL);let eZO=eZC.A&&eZC.A.locals?eZC.A.locals:void 0,eZM=e=>{var t,r,a,o,i,n,s,l,c;let d=null==(r=e.client.options.ui)||null==(t=r.chatBot)?void 0:t.title,u=null==(o=e.client.options.ui)||null==(a=o.base)?void 0:a.icon,p=(null==(n=e.client.options.ui)||null==(i=n.header)?void 0:i.isNeedClose)?(0,fU.jsx)("div",{className:eZO["extra-close"]}):null,h=null==(l=e.client.options.ui)||null==(s=l.base)?void 0:s.layout,{onImageClick:m}=e,{userInfo:f}=e.client.options,g=b6(e=>e.setThemeType),_=yA(e.client.chatClientId,e.client.options);return _.chatConfig.auth&&(_.chatConfig.auth.onRefreshToken=null==(c=e.client.options.auth)?void 0:c.onRefreshToken),(0,fU.jsx)("div",{className:eZO.chatAppWrapper,children:(0,fU.jsx)(eZE,{title:d||"",icon:u,chatConfig:_.chatConfig,headerExtra:p,layout:h,style:{height:"100%"},onImageClick:m,onThemeChange:g,userInfo:f})})},eZI=e=>{let t,r,a;return{appLifeCycleService:{},messageLifeCycleService:(t=!1,r="",a="",{onBeforeMessageGroupListUpdate:a=>{var o,i,n,s,l;let{messages:c}=e.chatAreaPluginContext.readonlyAPI.message.getMessagesStoreInstantValues(),d=null==c?void 0:c[0];return t&&r!==(null==d?void 0:d.message_id)?(null==(i=e.pluginBizContext.eventCallbacks)||null==(o=i.onMessageChanged)||o.call(i),r=null==d?void 0:d.message_id,((null==d?void 0:d.type)!=="answer"||(null==d?void 0:d.is_finish)!==!0)&&r||null==(l=e.pluginBizContext)||null==(s=l.eventCallbacks)||null==(n=s.onMessageReceivedFinish)||n.call(s)):t=!0,a},onAfterSendMessage:t=>{var r,a,o,i,n,s,l,c;let d=(null==t||null==(a=t.message)||null==(r=a.extra_info)?void 0:r.chatflow_execute_id)||"";d&&(null==(c=e.pluginBizContext)||null==(l=c.eventCallbacks)||null==(s=l.onGetChatFlowExecuteId)||s.call(l,d)),null==(n=e.pluginBizContext)||null==(i=n.eventCallbacks)||null==(o=i.onMessageSended)||o.call(i)},onBeforeReceiveMessage:t=>{var r,o,i;a!==t.message.reply_id&&(a=t.message.reply_id,null==(i=e.pluginBizContext)||null==(o=i.eventCallbacks)||null==(r=o.onMessageReceivedStart)||r.call(o))}}),commandLifeCycleService:{},renderLifeCycleService:{}}};function eZP(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class eZB extends ejo{constructor(...e){super(...e),eZP(this,"pluginMode",eFp.Writeable),eZP(this,"pluginName",eji.UIBuilderEventcallbackPlugin),eZP(this,"lifeCycleServices",ejn(this,eZI))}}let eZR=(e,t)=>{var r,a,o,i,n,s,l,c,d,u,p,h,m,f,g,_,b,v,y,T,k,w,Q,x,z,A,E,D;let S=enS(e);return(null==t||null==(r=t.project)?void 0:r.id)&&(S.botInfo.id=null==t||null==(g=t.project)?void 0:g.id),(null==t||null==(a=t.project)?void 0:a.name)&&(S.botInfo.nickname=null==t||null==(_=t.project)?void 0:_.name),(null==t||null==(o=t.project)?void 0:o.iconUrl)&&(S.botInfo.url=null==t||null==(b=t.project)?void 0:b.iconUrl),(null==t||null==(n=t.project)||null==(i=n.onBoarding)?void 0:i.prologue)&&(S.prologue=null==t||null==(y=t.project)||null==(v=y.onBoarding)?void 0:v.prologue),(null==t||null==(c=t.project)||null==(l=c.onBoarding)||null==(s=l.suggestions)?void 0:s.length)&&(S.onboardingSuggestions=(null==t||null==(k=t.project)||null==(T=k.onBoarding)?void 0:T.suggestions.map((e,t)=>({id:t.toString(),content:e})))||[]),(null==t||null==(u=t.project)||null==(d=u.onBoarding)?void 0:d.displayAllSuggest)&&(S.displayAllSuggest=null==t||null==(Q=t.project)||null==(w=Q.onBoarding)?void 0:w.displayAllSuggest),S.displayAllSuggest||(S.onboardingSuggestions=S.onboardingSuggestions.slice(0,3)),(null==t||null==(h=t.project)||null==(p=h.suggestPromoteInfo)?void 0:p.suggestReplyMode)&&(S.suggestPromoteInfo={suggestReplyMode:null==t||null==(z=t.project)||null==(x=z.suggestPromoteInfo)?void 0:x.suggestReplyMode,customizedSuggestPrompt:null==t||null==(E=t.project)||null==(A=E.suggestPromoteInfo)?void 0:A.customizedSuggestPrompt}),(null==t||null==(f=t.areaUi)||null==(m=f.bgInfo)?void 0:m.imgUrl)?S.customBgInfo=null==t||null==(D=t.areaUi)?void 0:D.bgInfo:S.customBgInfo=void 0,S},eZH=async(e,t)=>{var r,a,o,i,n,s,l,c,d,u,p,h,m,f,g,_,b,v,y,T,k,w;let Q,x=eVj(t),z=(null==t||null==(r=t.project)?void 0:r.mode)==="websdk",A=null==t||null==(a=t.workflow)?void 0:a.id,E=(null==t||null==(o=t.project)?void 0:o.mode)==="draft"?"true":"",D=(null==t||null==(i=t.project)?void 0:i.caller)||"",[S,C]=await Promise.allSettled([z?null==e?void 0:e.get(`/v1/apps/${null==t||null==(n=t.project)?void 0:n.id}?version=${(null==t||null==(s=t.project)?void 0:s.version)||""}&connector_id=${x}`,{},!1,{headers:{"Accept-Language":"zh-CN"===bj.language?"zh":"en"}}):null,A?null==e?void 0:e.get(`/v1/workflows/${A}?connector_id=${x}&is_debug=${E}&caller=${D}`,{},!1,{headers:{"Accept-Language":"zh-CN"===bj.language?"zh":"en"}}):null]),L=(null==S?void 0:S.status)==="fulfilled"?null==S||null==(l=S.value)?void 0:l.data:void 0,O=(null==C?void 0:C.status)==="fulfilled"?null==C||null==(d=C.value)||null==(c=d.data)?void 0:c.role:void 0;if(z&&!L)throw{code:null==S||null==(p=S.reason)?void 0:p.code,message:""};let M=((null==(k=(Q={prologue:(null==O||null==(h=O.onboarding_info)?void 0:h.prologue)||"",onboardingSuggestions:(null==O||null==(f=O.onboarding_info)||null==(m=f.suggested_questions)?void 0:m.map((e,t)=>({id:t.toString(),content:e})))||[],displayAllSuggest:null==O||null==(g=O.onboarding_info)?void 0:g.display_all_suggestions,botInfo:{url:(null==O||null==(_=O.avatar)?void 0:_.image_url)||(null==L?void 0:L.icon_url)||"",nickname:(null==O?void 0:O.name)||(null==L?void 0:L.name)||(null==t?void 0:t.project.defaultName)||"",id:(null==t||null==(b=t.project)?void 0:b.id)||""},suggestPromoteInfo:{suggestReplyMode:null==O||null==(v=O.suggest_reply_info)?void 0:v.suggest_reply_mode,customizedSuggestPrompt:null==O||null==(y=O.suggest_reply_info)?void 0:y.customized_suggest_prompt},backgroundInfo:null==O?void 0:O.background_image_info,defaultInputMode:(null==O||null==(T=O.user_input_config)?void 0:T.default_input_mode)===2?ej3.Voice:ej3.Text}).backgroundInfo)?void 0:k.web_background_image)&&(Q.backgroundInfo.web_background_image.origin_image_url=Q.backgroundInfo.web_background_image.image_url),(null==(w=Q.backgroundInfo)?void 0:w.mobile_background_image)&&(Q.backgroundInfo.mobile_background_image.origin_image_url=Q.backgroundInfo.mobile_background_image.image_url),Q);return(null==t||null==(u=t.workflow)?void 0:u.id)&&!M.botInfo.url&&(M.botInfo.url="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAwkSURBVHgB7d2xblRXGsDxwyrQGGkxhaHACmsatgEiUQSKYCRoSBHnCYAngDxBnCcIPAEgP0BIkTRBwk4RUiCF0EADSwQFuABWwg0p2PkGhiUBxL0zd+z57v39pNGwu83OzJ2/zzn33DubytLSiwKQwD8KQBKCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWk8VGBEe2emirbtmz5yyPce/as//z0+fNyb22t/wyjECwqixAdmJ7uP/b3HvM7d5Ztmze/DlQVN5486Yds5dGj/r+Xe89Q1aaytPSiwHtEjE7NzZUvZmf7oaoTp6oiWpfu3CnLq6uvR2XwLoLFW96M1PyOHWU9DeJ18e7dAn8nWLwWoTqzd28523uMYyRVR4y0YsT1zc2bRl28JlhMVKjeJUZb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oIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGv8DJbWhlGwbFtYAAAAASUVORK5CYII="),M},eZF=(0,gt.createContext)({appDataFromOnLine:null,appDataCombineWithProps:null}),eZj=e=>{let{children:t,...r}=e;return(0,fU.jsx)(eZF.Provider,{value:r,children:t})},eZN=()=>{let{appDataCombineWithProps:e}=(0,gt.useContext)(eZF);return e},eZU=async()=>{try{var e;return(null==(e=(await eT7.ImpersonateCozeUser({})).data)?void 0:e.access_token)??""}catch(e){return""}};var eZV=i(41107),eZq={};eZq.styleTagTransform=yj(),eZq.setAttributes=yB(),eZq.insert=yI().bind(null,"head"),eZq.domAPI=yO(),eZq.insertStyleElement=yH(),yC()(eZV.A,eZq);let eZG=eZV.A&&eZV.A.locals?eZV.A.locals:void 0,eZK=e=>{let t=(0,gt.useRef)(null),{bgInfo:r}=e;if(!r||!(null==r?void 0:r.imgUrl))return null;let{themeColor:a="transparent",imgUrl:o}=r;return(0,fU.jsxs)("div",{ref:t,className:eZG["bg-image"],style:{backgroundColor:a},children:[(0,fU.jsx)("div",{className:eZG.mask}),(0,fU.jsx)("div",{className:eZG["img-container"],children:o?(0,fU.jsx)("img",{src:o,className:eZG.img}):null})]})};var eZW=i(47153),eZZ={};eZZ.styleTagTransform=yj(),eZZ.setAttributes=yB(),eZZ.insert=yI().bind(null,"head"),eZZ.domAPI=yO(),eZZ.insertStyleElement=yH(),yC()(eZW.A,eZZ);let eZX=eZW.A&&eZW.A.locals?eZW.A.locals:void 0,eZY=e=>{let{label:t,children:r}=e;return(0,fU.jsxs)("div",{className:eZX["label-value"],children:[(0,fU.jsxs)("div",{className:eZX.label,children:[t,":"]}),(0,fU.jsx)("div",{className:eZX.value,children:r})]})},eZ$=e=>{var t,r,a,o,i,n,s,l,c,d,u,p;return(0,fU.jsxs)("div",{className:eZX.container,children:[(0,fU.jsx)(eZY,{label:"Bot名称",children:null==e||null==(t=e.project)?void 0:t.name}),(0,fU.jsx)(eZY,{label:"BotIcon",children:(0,fU.jsx)("img",{src:null==e||null==(r=e.project)?void 0:r.iconUrl,className:eZX.img})}),(0,fU.jsx)(eZY,{label:"开场白",children:null==e||null==(o=e.project)||null==(a=o.onBoarding)?void 0:a.prologue}),(0,fU.jsx)(eZY,{label:"推荐词",children:((null==e||null==(n=e.project)||null==(i=n.onBoarding)?void 0:i.suggestions)||[]).map((e,t)=>(0,fU.jsx)("div",{children:e},`${t}`))}),(0,fU.jsx)(eZY,{label:"用户名称",children:null==e||null==(s=e.userInfo)?void 0:s.nickname}),(0,fU.jsx)(eZY,{label:"用户头像",children:(0,fU.jsx)("img",{src:null==e||null==(l=e.userInfo)?void 0:l.url,className:eZX.img})}),(0,fU.jsxs)(eZY,{label:"输入框placholder",children:[null==e||null==(d=e.areaUi)||null==(c=d.input)?void 0:c.placeholder," "]}),(0,fU.jsxs)(eZY,{label:"输入框默认值",children:[null==e||null==(p=e.areaUi)||null==(u=p.input)?void 0:u.defaultText," "]})]})};var eZJ=i(18573),eZ1={};eZ1.styleTagTransform=yj(),eZ1.setAttributes=yB(),eZ1.insert=yI().bind(null,"head"),eZ1.domAPI=yO(),eZ1.insertStyleElement=yH(),yC()(eZJ.A,eZ1);let eZ0=eZJ.A&&eZJ.A.locals?eZJ.A.locals:void 0,eZ2=(0,gt.forwardRef)((e,t)=>{var r,a,o,i,n,s,l,c,d,u,p,h;let{uiBuilderProps:m,chatProps:f}=e,g=(0,gt.useRef)(!1),_=(0,gt.useRef)(),{areaUi:b,uiKitCustomComponents:v,contentBox:y}=m,T=eHQ(),k=eM4(),w=eMJ(eMb());(()=>{let{partialUpdateOnboardingData:e}=eF0(),t=eZN();WZ(()=>{e(null==t?void 0:t.prologue,null==t?void 0:t.onboardingSuggestions)},[null==t?void 0:t.prologue,null==t?void 0:t.onboardingSuggestions])})(),(()=>{var e,t,r;let{updateBotInfo:a}=(()=>{let{useSenderInfoStore:e}=ey3();return e(b7(e=>({getBotInfo:e.getBotInfo,updateBotInfo:e.updateBotInfo,setSenderInfoBatch:e.setSenderInfoBatch})))})(),{recordBotInfo:o}=eF0(),i=eZN();WZ(()=>{var e,t,r;let n=(null==i||null==(e=i.botInfo)?void 0:e.id)||"";o({name:(null==i||null==(t=i.botInfo)?void 0:t.nickname)||"",avatar:(null==i||null==(r=i.botInfo)?void 0:r.url)||""}),a(()=>{var e,t,r;return{[n]:{url:(null==i||null==(e=i.botInfo)?void 0:e.url)||"",nickname:(null==i||null==(t=i.botInfo)?void 0:t.nickname)||"",id:(null==i||null==(r=i.botInfo)?void 0:r.id)||"",allowMention:!1}}})},[null==i||null==(e=i.botInfo)?void 0:e.nickname,null==i||null==(t=i.botInfo)?void 0:t.url,null==i||null==(r=i.botInfo)?void 0:r.id])})(),(0,gt.useImperativeHandle)(t,()=>({sendMessage:e=>{e.type===eny.Text?w({text:e.text,mentionList:[]},"other"):e.type===eny.Image?k({payload:{contentType:eny.Image,contentObj:{image_list:[e.value]},mention_list:[]}},"other"):"file"===e.type&&k({payload:{contentType:eny.File,contentObj:{file_list:[e.value]},mention_list:[]}},"other")},clearContext:()=>{null==T||T()}}),[T,w,k]),(0,gt.useEffect)(()=>{var e,t,r;null==(r=_.current)||null==(t=r.setInputText)||t.call(r,(null==b||null==(e=b.input)?void 0:e.defaultText)||"")},[null==b||null==(r=b.input)?void 0:r.defaultText]);let Q=(null==b||null==(a=b.input)?void 0:a.renderChatInputTopSlot)?()=>{var e,t;return null==b||null==(t=b.input)||null==(e=t.renderChatInputTopSlot)?void 0:e.call(t,!1)}:void 0,x=(null==b||null==(o=b.input)?void 0:o.renderChatInputRightActions)?()=>{var e,t;return null==b||null==(t=b.input)||null==(e=t.renderChatInputRightActions)?void 0:e.call(t)}:void 0,z=(null==(i=m.project)?void 0:i.layout)===fW.MOBILE,A=eNe(),{header:E}=m.areaUi||{},D=(null==b||null==(n=b.conversations)?void 0:n.isNeed)??!1;return console.log("contentBox",y),(0,fU.jsx)(eW3,{...f,...b||{},coreAreaClassName:eZ0["core-area"],inputPlaceholder:(null==b||null==(s=b.input)?void 0:s.placeholder)||bj.t("chatInputPlaceholder"),messageMaxWidth:(null==m||null==(l=m.project)?void 0:l.mode)!=="websdk"?"600px":void 0,enableMultimodalUpload:!0,showInputArea:null==b||null==(c=b.input)?void 0:c.isShow,messageGroupListClassName:eZ0["scroll-view"],renderChatInputTopSlot:Q,renderChatInputRightActions:x,isShowClearContextDivider:!0,headerNode:(0,fU.jsx)(eZu,{title:(null==E?void 0:E.title)||"",iconUrl:null==E?void 0:E.icon,extra:null==E?void 0:E.extra,theme:A,isMobile:z,isShowConversations:D,isShowHeader:null==E?void 0:E.isShow,isNeedLogo:null==E?void 0:E.isNeedLogo}),isMiniScreen:(null==b?void 0:b.uiTheme)==="chatFlow",inputNativeCallbacks:{getController:e=>{if(_.current=e,!g.current){var t,r,a;null==(a=_.current)||null==(r=a.setInputText)||r.call(a,(null==b||null==(t=b.input)?void 0:t.defaultText)||""),g.current=!0}}},inputMode:null==b||null==(d=b.input)?void 0:d.inputMode,uiKitCustomComponents:v,contentBox:y,onboardingPrologue:null==b||null==(u=b.onboarding)?void 0:u.prologue,showOnboardingBotInfo:null==b||null==(p=b.onboarding)?void 0:p.showBotInfo,showOnboardingSuggestions:null==b||null==(h=b.onboarding)?void 0:h.showSuggestions})}),eZ3=e=>{var t,r,a,o,i,n;let{children:s,...l}=e,c=eF4(),d=eNe(),{footer:u}=l.areaUi||{},p=(null==(t=l.project)?void 0:t.layout)===fW.MOBILE,h=eZN(),m={...u||{expressionText:""}};return((null==(r=l.project)?void 0:r.mode)==="websdk"||m.expressionText||(m.expressionText=bj.t("chat_GenAI_tips")),"initSuccess"!==c)?(null==l||null==(n=l.areaUi)||null==(i=n.renderLoading)?void 0:i.call(n))||(0,fU.jsx)(eW7,{}):(0,fU.jsxs)("div",{className:yY()(eZ0.content,{[eZ0.mobile]:p,[eZ0["bg-theme"]]:"bg-theme"===d}),style:l.style,children:[(0,fU.jsxs)("div",{className:yY()(eZ0.area,{[eZ0["chat-flow-area"]]:(null==(a=l.areaUi)?void 0:a.uiTheme)==="chatFlow",[eZ0["chat-ui-builder"]]:(null==(o=l.areaUi)?void 0:o.uiTheme)==="uiBuilder"}),children:[(0,fU.jsx)(eZK,{bgInfo:null==h?void 0:h.customBgInfo}),s]}),(0,fU.jsx)(eZf,{...m,theme:d})]})},eZ4=(0,gt.memo)((0,gt.forwardRef)((e,t)=>{var r,a,o,i,n,s,l,c;let d,u,p,h,m,f,g,{chatProps:_,hasReady:b,error:v,refresh:y}=(e=>{var t,r,a,o;let[i,n]=(0,gt.useState)(!1),[s,l]=(0,gt.useState)(null),[c,d]=(0,gt.useState)(),{project:u,userInfo:p}=e;return(0,gt.useEffect)(()=>{var t,r,a,o;let c;if(s||i)return;let h=((null==e||null==(t=e.project)?void 0:t.type)==="bot"?(null==e||null==(r=e.project)?void 0:r.mode)!=="draft"&&(c=Error("mode must be draft when project type is bot")):(null==e||null==(a=e.auth)?void 0:a.type)!=="internal"&&((null==e||null==(o=e.auth)?void 0:o.token)||(c=Error("token is required when auth type is not internal"))),c);h?l(h):(async()=>{var t,r,a,o;let i=null==(t=e.auth)?void 0:t.token,s=null==(r=e.auth)?void 0:r.refreshToken;if((null==(a=e.auth)?void 0:a.type)==="internal"&&(i=await eZU(),s=eZU),i){let t="app"===u.type;d({chatConfig:{type:t?fZ.APP:fZ.BOT,bot_id:t?void 0:u.id,appInfo:t?{appId:u.id,workflowId:e.workflow.id||"",conversationName:u.conversationName,version:u.version,draft_mode:"draft"===u.mode}:void 0,auth:{type:fX.TOKEN,token:i,onRefreshToken:s,connectorId:eVj(e)},ui:{base:{layout:u.layout},chatBot:{uploadable:e.areaUi.uploadable,isNeedClearContext:e.areaUi.isNeedClearContext,isNeedClearMessage:e.areaUi.isNeedClearMessage,isNeedAddNewConversation:e.areaUi.isNeedAddNewConversation??!1,isNeedAudio:(null==(o=e.areaUi.input)?void 0:o.isNeedAudio)??!0,isNeedQuote:e.areaUi.isNeedQuote??!1,isNeedFunctionCallMessage:e.areaUi.isNeedFunctionCallMessage,feedback:e.areaUi.feedback},conversations:e.areaUi.conversations},conversation_id:"",source:yz.ChatFlow},layout:u.layout,userInfo:{id:fK(),url:"",nickname:"",...p||{}}}),n(!0)}else l(Error("token is empty"))})()},[s,i]),WZ(()=>{n(!1),l(null)},[null==u?void 0:u.id,null==u?void 0:u.type,null==u?void 0:u.conversationName,null==u?void 0:u.conversationId,null==u?void 0:u.mode,null==u?void 0:u.conversationId,null==e||null==(t=e.workflow)?void 0:t.id]),c&&(c.chatConfig.ui=c.chatConfig.ui||{},c.chatConfig.ui.chatBot=c.chatConfig.ui.chatBot||{},c.chatConfig.ui.chatBot.isNeedClearMessage=null==e||null==(r=e.areaUi)?void 0:r.isNeedClearMessage,c.chatConfig.ui.chatBot.uploadable=null==(a=e.areaUi)?void 0:a.uploadable,c.chatConfig.ui.chatBot.feedback=null==(o=e.areaUi)?void 0:o.feedback),{hasReady:i,chatProps:c,error:s,refresh:()=>{l(null),n(!1)}}})(e),T=((d=(0,gt.useRef)(e)).current=e,u=(()=>{let{setAppDataFromOnLine:e}=(0,gt.useContext)(eZF);return e})(),(0,gt.useCallback)(async e=>{var t;let r=eZH(e||void 0,d.current),a=eVU(e||void 0,d.current),o=await r,i=await a;null==u||u(o||null);let n=eZR(o,d.current);return{...n,...i,isCustomBackground:!!(null==(t=n.customBgInfo)?void 0:t.imgUrl),isBuilderChat:!0}},[])),k=(c={eventCallbacks:e.eventCallbacks},{createPluginBizContext:()=>({...c}),Plugin:eZB}),w=eZN();(e=>{let{appDataFromOnLine:t,setAppDataCombineWithProps:r}=(0,gt.useContext)(eZF);WZ(()=>{if(t){let a=eZR(t,e);null==r||r(a)}},[t,e])})(e);let Q=(p=(0,gt.useRef)(e),h=eZN(),m=(0,gt.useRef)(h),p.current=e,m.current=h,f=(0,gt.useMemo)(()=>e.apiUrl?e.apiUrl:f3(),[e.apiUrl]),(0,gt.useMemo)(()=>({baseURL:f,scenes:{[eni.SendMessage]:{hooks:{onBeforeSendMessage:[e=>{var t,r,a,o,i,n,s,l,c,d,u,h,g,_,b,v,y,T,k,w,Q,x,z,A,E;let{body:D}=e,S=JSON.parse(D),C={};C.additional_messages=S.additional_messages||[],C.connector_id=S.connector_id,C.workflow_id=null==p||null==(r=p.current)||null==(t=r.workflow)?void 0:t.id;let L=null==p||null==(o=p.current)||null==(a=o.workflow)?void 0:a.parameters;if(L&&"object"==typeof L){let e={...L};e.SETTING&&"object"==typeof e.SETTING&&(e.SETTING=JSON.stringify(e.SETTING)),C.parameters=e}else C.parameters=L;return C.version=(null==p||null==(n=p.current)||null==(i=n.project)?void 0:i.version)||void 0,C.execute_mode=(null==p||null==(l=p.current)||null==(s=l.project)?void 0:s.mode)==="draft"?"DEBUG":void 0,C.app_id=(null==p||null==(d=p.current)||null==(c=d.project)?void 0:c.type)==="app"?null==p||null==(h=p.current)||null==(u=h.project)?void 0:u.id:void 0,C.bot_id=(null==p||null==(_=p.current)||null==(g=_.project)?void 0:g.type)==="bot"?null==p||null==(v=p.current)||null==(b=v.project)?void 0:b.id:void 0,C.conversation_id=new URL(e.url).searchParams.get("conversation_id"),C.connector_id=eVj(null==p?void 0:p.current),C.ext={_caller:null==p||null==(T=p.current)||null==(y=T.project)?void 0:y.caller,user_id:S.user_id},C.suggest_reply_info=(null==(k=m.current)?void 0:k.suggestPromoteInfo)?{suggest_reply_mode:null==(Q=m.current)||null==(w=Q.suggestPromoteInfo)?void 0:w.suggestReplyMode,customized_suggest_prompt:null==(z=m.current)||null==(x=z.suggestPromoteInfo)?void 0:x.customizedSuggestPrompt}:void 0,e.body=JSON.stringify(C),new URL(e.url,"http://dummy.com").searchParams.has("conversation_id")||(e.url=`${f}/v1/workflows/chat`),e.headers.push(...Object.entries((null==(E=p.current)||null==(A=E.workflow)?void 0:A.header)||{})),{...e}}]}},[eni.ClearHistory]:{hooks:{onBeforeRequest:[t=>{var r,a,o,i,n,s,l,c;if((null==e||null==(r=e.project)?void 0:r.type)==="bot")t.data={connector_id:eVj(e)};else{let r={app_id:null==p||null==(a=p.current.project)?void 0:a.id,get_or_create:!1,workflow_id:null==p||null==(i=p.current)||null==(o=i.workflow)?void 0:o.id,draft_mode:(null==p||null==(s=p.current)||null==(n=s.project)?void 0:n.mode)==="draft",connector_id:eVj(e)};(null==p||null==(c=p.current)||null==(l=c.project)?void 0:l.conversationName)&&""!==p.current.project.conversationName.trim()&&(r.conversation_name=p.current.project.conversationName),t.data=r}return{...t}}]}}}}),[f])),x=(0,gt.useMemo)(()=>{var t,r;return{url:"",nickname:"",...e.userInfo||{},id:(null==e||null==(t=e.userInfo)?void 0:t.id)||(null==_||null==(r=_.userInfo)?void 0:r.id)||""}},[null==e?void 0:e.userInfo,_]),z=(g={...e,refresh:y},e=>{var t,r,a;let{error:o,onBeforeRetry:i}=e;return(0,fU.jsxs)(fU.Fragment,{children:[(0,fU.jsx)(eZv,{error:o,onBeforeRetry:i,refresh:g.refresh}),null==(a=g.areaUi)||null==(r=a.input)||null==(t=r.renderChatInputTopSlot)?void 0:t.call(r,!0)]})});if((null==e||null==(r=e.project)?void 0:r.mode)==="audit")return(0,fU.jsx)(eZ$,{...e});if(v)return(0,fU.jsx)(z,{error:null,refresh:y});if(!_||!b)return(null==e||null==(l=e.areaUi)||null==(s=l.renderLoading)?void 0:s.call(l))||(0,fU.jsx)(eW7,{});let A=!!(null==w||null==(a=w.customBgInfo)?void 0:a.imgUrl);return console.log("[result] isCustomBackground:",A,null==w?void 0:w.customBgInfo),(0,fU.jsx)(eqH,{..._,userInfo:x,openRequestInit:T,plugins:[k],requestManagerOptions:Q,initErrorFallbackFC:z,onImageClick:null==(o=e.eventCallbacks)?void 0:o.onImageClick,debug:e.debug,isCustomBackground:A,onThemeChange:null==e||null==(i=e.eventCallbacks)?void 0:i.onThemeChange,readonly:null==e||null==(n=e.areaUi)?void 0:n.isDisabled,spaceId:null==e?void 0:e.spaceId,apiUrl:e.apiUrl,children:(0,fU.jsx)(eZ3,{...e,children:(0,fU.jsx)(eZ2,{ref:t,uiBuilderProps:e,chatProps:_})})})})),eZ6=(0,gt.forwardRef)((e,t)=>{let[r,a]=(0,gt.useState)(null),[o,i]=(0,gt.useState)(null);return(0,fU.jsx)(eZQ,{children:(0,fU.jsx)(eZj,{appDataFromOnLine:r,setAppDataFromOnLine:a,appDataCombineWithProps:o,setAppDataCombineWithProps:i,children:(0,fU.jsx)(eZ4,{ref:t,...e})})})});var eZ5=i(81562),eZ7={};eZ7.styleTagTransform=yj(),eZ7.setAttributes=yB(),eZ7.insert=yI().bind(null,"head"),eZ7.domAPI=yO(),eZ7.insertStyleElement=yH(),yC()(eZ5.A,eZ7);let eZ8=eZ5.A&&eZ5.A.locals?eZ5.A.locals:void 0,eZ9=e=>{var t,r,a,o,i,n,s,l,c,d,u,p,h,m,f,g,_,b,v,y,T,k,w,Q,x,z,A,E,D,S,C,L,O,M,I,P,B,R,H,F,j,N,U,V,q,G,K,W,Z,X,Y,$,J,ee,et,er,ea;let{client:eo,onImageClick:ei,uiKitCustomComponents:en,contentBox:es}=e,el=null==eo?void 0:eo.options,ec=b6(e=>e.setThemeType),ed=(null==el||null==(r=el.ui)||null==(t=r.header)?void 0:t.isNeedClose)??!0,eu=null==eo?void 0:eo.apiUrl,ep={showInputArea:!0,isDisabled:!1,uploadable:null==el||null==(o=el.ui)||null==(a=o.chatBot)?void 0:a.uploadable,isNeedClearContext:(null==el||null==(n=el.ui)||null==(i=n.chatBot)?void 0:i.isNeedClearContext)??!0,isNeedClearMessage:!1,isNeedAddNewConversation:(null==el||null==(l=el.ui)||null==(s=l.chatBot)?void 0:s.isNeedAddNewConversation)??!0,isNeedFunctionCallMessage:(null==el||null==(d=el.ui)||null==(c=d.chatBot)?void 0:c.isNeedFunctionCallMessage)??!0,isNeedQuote:null==el||null==(p=el.ui)||null==(u=p.chatBot)?void 0:u.isNeedQuote,feedback:null==el||null==(m=el.ui)||null==(h=m.chatBot)?void 0:h.feedback,header:{isShow:!0,title:null==el||null==(g=el.ui)||null==(f=g.chatBot)?void 0:f.title,icon:(null==el||null==(b=el.ui)||null==(_=b.header)?void 0:_.icon)||(null==el||null==(y=el.ui)||null==(v=y.base)?void 0:v.icon),...null==el||null==(T=el.ui)?void 0:T.header,extra:ed?(0,fU.jsx)("div",{className:eZ8["extra-close"]}):null},conversations:null==el||null==(k=el.ui)?void 0:k.conversations,input:{isNeedAudio:null==el||null==(Q=el.ui)||null==(w=Q.chatBot)?void 0:w.isNeedAudio,renderChatInputTopSlot:null==el||null==(z=el.ui)||null==(x=z.input)?void 0:x.renderChatInputTopSlot,renderChatInputRightActions:null==el||null==(E=el.ui)||null==(A=E.input)?void 0:A.renderChatInputRightActions,placeholder:null==el||null==(S=el.ui)||null==(D=S.input)?void 0:D.placeholder,isShow:null==el||null==(L=el.ui)||null==(C=L.input)?void 0:C.isShow,defaultText:null==el||null==(M=el.ui)||null==(O=M.input)?void 0:O.defaultText,inputMode:null==el||null==(P=el.ui)||null==(I=P.input)?void 0:I.inputMode},footer:null==el||null==(B=el.ui)?void 0:B.footer,onboarding:null==el||null==(R=el.ui)?void 0:R.onboarding,getMessageRenderIndex:null==el||null==(H=el.ui)?void 0:H.getMessageRenderIndex};return(0,fU.jsx)(eZ6,{apiUrl:eu,workflow:{id:null==el||null==(j=el.config)||null==(F=j.appInfo)?void 0:F.workflowId,parameters:(null==el||null==(U=el.config)||null==(N=U.appInfo)?void 0:N.parameters)||{}},project:{type:"app",mode:(null==el||null==(q=el.config)||null==(V=q.appInfo)?void 0:V.draft_mode)!==void 0&&el.config.appInfo.draft_mode?"draft":"websdk",id:(null==el||null==(K=el.config)||null==(G=K.appInfo)?void 0:G.appId)||"",conversationName:null==el||null==(Z=el.config)||null==(W=Z.appInfo)?void 0:W.conversationName,layout:null==el||null==(Y=el.ui)||null==(X=Y.base)?void 0:X.layout,version:null==el||null==($=el.config.appInfo)?void 0:$.version},userInfo:{url:(null==el||null==(J=el.userInfo)?void 0:J.url)||"",nickname:(null==el||null==(ee=el.userInfo)?void 0:ee.nickname)||"",id:(null==el||null==(et=el.userInfo)?void 0:et.id)||""},areaUi:ep,auth:{type:"external",token:null==el||null==(er=el.auth)?void 0:er.token,refreshToken:null==el||null==(ea=el.auth)?void 0:ea.onRefreshToken},eventCallbacks:{onImageClick:ei,onThemeChange:ec},uiKitCustomComponents:en,contentBox:es})};var eXe=i(77167),eXt={};eXt.styleTagTransform=yj(),eXt.setAttributes=yB(),eXt.insert=yI().bind(null,"head"),eXt.domAPI=yO(),eXt.insertStyleElement=yH(),yC()(eXe.A,eXt);let eXr=eXe.A&&eXe.A.locals?eXe.A.locals:void 0,eXa=e=>{var t,r,a;let{client:o,uiKitCustomComponents:i,contentBox:n}=e,s=null==o?void 0:o.options,l=b6(e=>e.setImagePreview),c=b6(e=>e.setIframeLoaded),d=(null==s||null==(r=s.ui)||null==(t=r.base)?void 0:t.lang)||fJ.EN,[u,p]=(0,gt.useState)(!1),h=d===fJ.ZH_CN?kY:GI,m=(0,gt.useCallback)(e=>{l(t=>{t.url=e.url,t.visible=!0})},[]);return((0,gt.useEffect)(()=>{c(!0)},[]),(0,gt.useEffect)(()=>{(function(e){let{lng:t="en",ns:r,...a}=e||{};return new Promise(e=>{bj.use(GE),bj.init({detection:{order:["querystring","cookie","localStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18next",fallback:"zh-CN",caches:["cookie"],mute:!1},react:{useSuspense:!1},keySeparator:!1,fallbackLng:t,lng:t,ns:r||"i18n",defaultNS:r||"i18n",resources:GD,...a??{}},e)})})({lng:d}).then(()=>p(!0))},[d]),u)?(0,fU.jsx)(GM,{i18n:bj,children:(0,fU.jsx)(Le,{children:(0,fU.jsx)(V1,{locale:h,children:(0,fU.jsx)("div",{className:eXr.cozeIframe,children:(null==s||null==(a=s.config)?void 0:a.type)==="app"?(0,fU.jsx)(eZ9,{client:o,onImageClick:m,uiKitCustomComponents:i,contentBox:n}):(0,fU.jsx)(eZM,{client:o,onImageClick:m,uiKitCustomComponents:i,contentBox:n})})})})}):null},eXo=e=>{var t,r,a;let{client:o,isNewCreated:i,uiKitCustomComponents:n,contentBox:s}=e,{chatVisible:l,setChatVisible:c,layout:d,themeType:u}=b6(b7(e=>({layout:e.layout,setIframe:e.setIframe,senderName:e.senderName,chatVisible:e.chatVisible,setChatVisible:e.setChatVisible,themeType:e.themeType}))),{base:p,chatBot:h,header:m}=(null==o||null==(t=o.options)?void 0:t.ui)||{},f=(null==o||null==(r=o.options)?void 0:r.mode)||"float",g=null==o||null==(a=o.options)?void 0:a.size,_=bZ({zIndex:null==p?void 0:p.zIndex}),b=d===fW.MOBILE||"inlay"===f?void 0:(null==h?void 0:h.width)??(null==g?void 0:g.width)??460;if(!l)return null;let v=d!==fW.MOBILE&&"float"===f?{height:null==g?void 0:g.height,maxWidth:null==g?void 0:g.maxWidth,maxHeight:null==g?void 0:g.maxHeight,minWidth:null==g?void 0:g.minWidth,minHeight:null==g?void 0:g.minHeight}:{};return(0,fU.jsxs)("div",{className:yY()(eXr.iframeWrapper,"coze-chat-sdk",{[eXr.mobile]:d===fW.MOBILE,[eXr.autoFixContainer]:"inlay"===f}),style:{display:l?"block":"none",...v,width:b,..._},children:[(null==m?void 0:m.isNeedClose)!==!1?(0,fU.jsx)(Gl,{onClick:()=>{c(!1)},classNames:eXr.closeBtn,themeType:"bg-theme"===u?"light":"dark"}):null,(0,fU.jsx)(eXa,{client:o,uiKitCustomComponents:n,contentBox:s})]})},eXi=e=>{var t,r,a;let{client:o,uiKitCustomComponents:i,contentBox:n}=e,{el:s}=(null==o||null==(r=o.options)||null==(t=r.ui)?void 0:t.chatBot)||{},l=(null==o||null==(a=o.options)?void 0:a.mode)||"float",[c]=(0,gt.useState)(()=>{if(s)return s;let e=document.createElement("div");return"inlay"===l&&(e.style.position="fixed",e.style.inset="0",e.style.width="100%",e.style.height="100%",e.style.zIndex="999"),document.body.appendChild(e),e}),d=c!==s;return(0,gt.useEffect)(()=>()=>{d&&document.body.removeChild(c)},[s,c]),(0,TU.createPortal)((0,fU.jsx)(eXo,{client:o,isNewCreated:d,uiKitCustomComponents:i,contentBox:n}),c)},eXn=i.p+"054000aa4e72c964.png",eXs=e=>{var t;let{position:r="fixed",client:a}=e,{chatVisible:o,setChatVisible:i,layout:n}=b6(e=>({chatVisible:e.chatVisible,setChatVisible:e.setChatVisible,layout:e.layout})),{base:s,asstBtn:l}=(null==a||null==(t=a.options)?void 0:t.ui)||{},c=(null==l?void 0:l.icon)||(null==s?void 0:s.icon),d=bZ({zIndex:null==s?void 0:s.zIndex});return!o&&(null==l?void 0:l.isNeed)?(0,fU.jsx)("div",{style:{position:r,...d},className:yY()(eXr["coze-ast-btn"],{[eXr.mobile]:n===fW.MOBILE}),onClick:e=>{e.stopPropagation(),i(!0)},children:(0,fU.jsx)("img",{alt:"logo",src:c||eXn})}):null},eXl=e=>{var t;let{client:r,position:a,uiKitCustomComponents:o,contentBox:i}=e;(e=>{let{setImagePreview:t}=b6(e=>({setImagePreview:e.setImagePreview})),r=(0,gt.useCallback)(r=>{let a=null==r?void 0:r.data;a.chatStoreId===e.chatClientId&&a.event===yE.ImageClick&&yD.isImageClick(a)&&t(e=>{e.url=a.payload.url,e.visible=!0})},[t,e]);(0,gt.useEffect)(()=>(window.addEventListener("message",r),()=>{window.removeEventListener("message",r)}),[r])})(r),((e,t)=>{let r=(0,gt.useRef)(),{iframe:a,senderName:o,setThemeType:i}=b6(b7(e=>({iframe:e.iframe,senderName:e.senderName,setThemeType:e.setThemeType}))),n=(0,gt.useRef)({chatClientId:e,cozeChatOption:t});n.current={chatClientId:e,cozeChatOption:t},(0,gt.useEffect)(()=>{if(null==a?void 0:a.contentWindow)return r.current=new vr({channelPort:a.contentWindow,senderName:o}),r.current.onRequest(fY.GET_IFRAME_PARAMS,()=>({code:0,data:yA(n.current.chatClientId,n.current.cozeChatOption)})),r.current.onRequest(fY.GET_NEW_TOKEN,async e=>{let t;try{var r,a;t=await (null==(a=n.current.cozeChatOption.auth)||null==(r=a.onRefreshToken)?void 0:r.call(a,e||""))}catch(e){console.error("[WebSdk Error] Get Token Error")}return t?{code:0,data:t}:{code:f$.AUTH_TOKEN_GET_FAILED,message:"Get Token Error"}}),r.current.onRequest(fY.THEME_CHANGE,e=>(i(e),{code:0})),()=>{var e;null==(e=r.current)||e.destory(),r.current=void 0}},[a,o])})(r.chatClientId,r.options);let{base:n}=(null==r||null==(t=r.options)?void 0:t.ui)||{},s=bZ({zIndex:null==n?void 0:n.zIndex});return(0,fU.jsxs)(fU.Fragment,{children:[(0,fU.jsx)(eXi,{client:r,uiKitCustomComponents:o,contentBox:i}),(0,fU.jsx)(Ga,{zIndex:s["--coze-z-index-iframe"]+2}),(0,fU.jsx)(eXs,{client:r,position:a})]})},eXc=e=>(0,fU.jsx)(b4,{globalStore:e.globalStore,children:(0,fU.jsx)(eXl,{...e,uiKitCustomComponents:e.uiKitCustomComponents,contentBox:e.contentBox})}),eXd=new Map;function eXu(e){let t=eXd.get(e);if(t)return t;let r=gt.memo(t=>{let r=(0,gt.useRef)(null),a=(0,gt.useRef)(t),o=(0,gt.useRef)(null),i=(0,gt.useRef)(!0),n=(0,gt.useMemo)(()=>{try{return JSON.stringify(a.current)!==JSON.stringify(t)}catch(e){return console.warn("[WebComponent] Failed to compare props:",e),a.current!==t}},[t]);return(0,gt.useEffect)(()=>{if((i.current||n&&r.current)&&r.current){var s;i.current&&(i.current=!1),a.current=t,s=r.current,Object.entries(t).forEach(e=>{let[t,r]=e;try{if(void 0===r)return;if(null===r)return void s.setAttribute(t,"");"object"==typeof r||Array.isArray(r)||"function"==typeof r?s[t]=r:s.setAttribute(t,String(r))}catch(e){console.warn(`[WebComponent] Failed to set property "${t}" on ${s.tagName}:`,e)}});let n=r.current;if("function"==typeof n.updateProps)try{n.updateProps(t)}catch(t){console.error(`[WebComponent] Error calling updateProps on ${e}:`,t)}"function"==typeof n.cleanup&&(o.current=()=>{try{var t;null==(t=n.cleanup)||t.call(n)}catch(t){console.error(`[WebComponent] Error during cleanup of ${e}:`,t)}})}return()=>{o.current&&(o.current(),o.current=null)}},[n,t]),gt.createElement(e,{ref:r})},(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(r){return console.warn("[WebComponent] Failed to compare props in memo:",r),e===t}});return eXd.set(e,r),r}let eXp=["JsonItem","MentionOperateTool","SendButton","AvatarWrap"];var eXh=i(2092),eXm={};eXm.styleTagTransform=yj(),eXm.setAttributes=yB(),eXm.insert=yI().bind(null,"head"),eXm.domAPI=yO(),eXm.insertStyleElement=yH(),yC()(eXh.A,eXm),eXh.A&&eXh.A.locals&&eXh.A.locals;var eXf=i(24386),eXg={};eXg.styleTagTransform=yj(),eXg.setAttributes=yB(),eXg.insert=yI().bind(null,"head"),eXg.domAPI=yO(),eXg.insertStyleElement=yH(),yC()(eXf.A,eXg),eXf.A&&eXf.A.locals&&eXf.A.locals;class eX_{async initToken(){try{var e,t,r,a;if((null==(e=this.options.auth)?void 0:e.type)===fX.TOKEN&&!(null==(t=this.options.auth)?void 0:t.token)){let e=await (null==(a=this.options.auth)||null==(r=a.onRefreshToken)?void 0:r.call(a,""));return this.options.auth.token=e,e||alert("The access token is missing. Please check the configuration information."),!!e}}catch(e){return console.error("[WebSdk Error] initToken error"),alert("The access token is missing. Please check the configuration information."),!1}return!0}checkOptions(){var e,t;if((null==(e=this.options.auth)?void 0:e.type)!==fX.TOKEN)return console.error("Non-Token is unsupported; auth's type must be token"),alert("The auth type (unauth) is unsupported yet; auth's type must be token"),!1;if((null==(t=this.options.auth)?void 0:t.type)===fX.TOKEN){if(!this.options.auth.onRefreshToken)return console.error("[WebSdk Error] onRefreshToken must be provided"),alert("onRefreshToken must be provided"),!1;if("function"!=typeof this.options.auth.onRefreshToken)return console.error("[WebSdk Error] onRefreshToken must be a function"),alert("onRefreshToken must be a function"),!1}return!0}constructor(e){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"options",void 0),this.options=e}}function eXb(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class eXv{showChatBot(){this.globalStore.getState().setChatVisible(!0)}hideChatBot(){this.globalStore.getState().setChatVisible(!1)}async getToken(){var e,t,r;if((null==(e=this.options.auth)?void 0:e.type)===fX.TOKEN)return await (null==(r=this.options.auth)||null==(t=r.onRefreshToken)?void 0:t.call(r,""))}destroy(){var e;null==(e=this.root)||e.unmount(),this.defaultRoot&&this.defaultRoot.remove(),eXv.clients=eXv.clients.filter(e=>e!==this)}constructor(e){var t,r,a,o,i,n,s,l,c,d,u,p;let h,m;eXb(this,"root",void 0),eXb(this,"defaultRoot",void 0),eXb(this,"containerEl",void 0),eXb(this,"globalStore",void 0),eXb(this,"authClient",void 0),eXb(this,"chatClientId",fK()),eXb(this,"options",void 0),eXb(this,"senderName",void 0),eXb(this,"apiUrl",void 0),console.info("WebChatClient constructorxxx",e),this.senderName=`chat-app-sdk-${Date.now()}`,this.options=(e=>{var t,r,a,o,i,n,s,l,c,d,u,p;let h=fV.isMobileOnly?fW.MOBILE:fW.PC;return e.config=e.config||{},e.config.botId=(null==(t=e.config.botInfo)?void 0:t.botId)||e.config.botId||e.config.bot_id||"",e.ui=e.ui||{},"inlay"===(e.mode||"float")&&(e.ui.asstBtn=Object.assign({isNeed:!1},(null==(u=e.ui)?void 0:u.asstBtn)||{}),e.ui.header=Object.assign({isShow:!0,isNeedClose:!1},(null==(p=e.ui)?void 0:p.header)||{})),e.ui.base=Object.assign({layout:(null==(r=e.componentProps)?void 0:r.layout)||h,lang:(null==(a=e.componentProps)?void 0:a.lang)||fJ.EN,zIndex:null==(o=e.componentProps)?void 0:o.zIndex,icon:null==(i=e.componentProps)?void 0:i.icon},(null==(n=e.ui)?void 0:n.base)||{}),e.ui.chatBot=Object.assign({title:null==(s=e.componentProps)?void 0:s.title,width:null==(l=e.componentProps)?void 0:l.width,uploadable:(null==(c=e.componentProps)?void 0:c.uploadable)??!0},(null==(d=e.ui)?void 0:d.chatBot)||{}),e.ui.asstBtn=Object.assign({isNeed:!0},e.ui.asstBtn||{}),e.ui.header=Object.assign({isShow:!0,isNeedClose:!0},e.ui.header||{}),e})(e),this.authClient=new eX_(e);const f=null==(t=this.options)?void 0:t.env;if(this.apiUrl=f3(null==(r=this.options)?void 0:r.apiUrl,f),console.info("WebChatClient using API URL:",this.apiUrl,f),(null==(a=e.ui)?void 0:a.uiKitCustomWebComponents)||(null==(o=e.ui)?void 0:o.contentBoxWebComponent)){const e=function(){let e=[];return window.customElements||e.push("Custom Elements"),"attachShadow"in Element.prototype||e.push("Shadow DOM"),"content"in document.createElement("template")||e.push("HTML Templates"),{supported:0===e.length,missing:e}}();e.supported||console.error("[WebChatClient] Web Components are not fully supported in this browser. Missing:",e.missing.join(", "),"\nConsider using a polyfill: https://github.com/webcomponents/polyfills")}const{getContainer:g,mode:_="float"}=this.options;if(g)try{const e=g();e&&e instanceof HTMLElement?this.containerEl=e:null===e?console.warn("[WebChatClient] getContainer() returned null, using document.body"):console.warn("[WebChatClient] getContainer() did not return a valid HTMLElement")}catch(e){console.error("[WebChatClient] Error calling getContainer():",e)}if(this.containerEl&&((null==(l=this.options.ui)||null==(s=l.chatBot)?void 0:s.el)||(this.options.ui=this.options.ui||{},this.options.ui.chatBot=this.options.ui.chatBot||{},this.options.ui.chatBot.el=this.containerEl)),this.globalStore=(e=>{var t;let{options:r,senderName:a}=e,{layout:o=fW.PC}=(null==r||null==(t=r.ui)?void 0:t.base)??{},i=e.authClient,n={chatVisible:!1,iframeLoaded:!1,themeType:"light",imagePreview:{url:"",visible:!1},layout:o,senderName:a};return gs()(f5(f8(e=>({...n,setThemeType:t=>{e({themeType:t})},setIframe:t=>{e({iframe:t})},setChatVisible:async t=>{var a,o,n,s,l,c;let d=null==r||null==(a=r.ui)?void 0:a.chatBot;if(i&&!await i.initToken())return void(c={type:bK.OPEN_API_ERROR,code:401,message:"invalid token"},window.parent.postMessage({type:"chat-sdk-error",data:c},"*"));if(t){if(await (null==d||null==(o=d.onBeforeShow)?void 0:o.call(d))===!1)return}else if(await (null==d||null==(n=d.onBeforeHide)?void 0:n.call(d))===!1)return;e({chatVisible:t}),t?null==d||null==(s=d.onShow)||s.call(d):null==d||null==(l=d.onHide)||l.call(d)},setIframeLoaded:t=>{e({iframeLoaded:t})},setImagePreview:t=>e(gG(e=>{t(e.imagePreview)}))})),{enabled:!1,name:"sdkChatApp.global"}))})(this),!this.authClient.checkOptions())return;this.containerEl?h=this.containerEl:(this.defaultRoot=document.createElement("div"),document.body.appendChild(this.defaultRoot),h=this.defaultRoot),m=this.containerEl?"inlay"===_?"static":"absolute":void 0;let b=null==(i=e.ui)?void 0:i.uiKitCustomComponents,v=null==(n=e.ui)?void 0:n.contentBox;try{if(null==(c=e.ui)?void 0:c.uiKitCustomWebComponents){const t=function(e){if(e)try{let t={};return eXp.forEach(r=>{let a=e[r];a&&(customElements.get(a)||console.warn(`[WebChatClient] Web Component "${a}" for ${r} is not registered. Please register it using customElements.define() before initializing the chat client.`),t[r]=eXu(a))}),Object.keys(t).length>0?t:void 0}catch(e){console.error("[WebChatClient] Failed to adapt Web Components:",e);return}}(e.ui.uiKitCustomWebComponents);t&&(b={...b,...t})}if(null==(d=e.ui)?void 0:d.contentBoxWebComponent){const t=function(e){if(e)try{return customElements.get(e)||console.warn(`[WebChatClient] Web Component "${e}" is not registered. Please register it using customElements.define() before initializing the chat client.`),eXu(e)}catch(t){console.error(`[WebChatClient] Failed to adapt contentBox Web Component "${e}":`,t);return}}(e.ui.contentBoxWebComponent);t&&(v=t)}}catch(t){console.error("[WebChatClient] Failed to adapt Web Components, falling back to React components:",t),b=null==(u=e.ui)?void 0:u.uiKitCustomComponents,v=null==(p=e.ui)?void 0:p.contentBox}this.root=(0,fq.createRoot)(h),this.root.render((0,fU.jsx)(eXc,{client:this,globalStore:this.globalStore,position:m,uiKitCustomComponents:b,contentBox:v})),eXv.clients.push(this),"inlay"===_&&setTimeout(()=>{this.showChatBot()},0)}}eXb(eXv,"clients",[]),window.GlodonAIoT=window.GlodonAIoT||{},window.GlodonAIoT.WebChatClient=eXv})(),h})());
10056
+ })`)},i=await a({url:e,responseType:r.isStreaming?"stream":"json",adapter:r.isStreaming?eUQ()||eUA()||eUw()||eVA(process.version.slice(1),"18.0.0")>=0?"fetch":eVx:void 0,...r}).catch(e=>{throw(null==e?void 0:e.status)===401&&o(),eVQ(e)});return{async *stream(){try{let e=i.data,t=e[Symbol.asyncIterator]?e[Symbol.asyncIterator]():e.getReader(),r=new TextDecoder,a={},n="";for(;;){let{done:e,value:i}=await (t.next?t.next():t.read());if(e){if(n){a.event="error",a.data=n;try{let e=JSON.parse(n);(null==e?void 0:e.code)===4101&&o()}catch(e){}yield a}break}let s=(n+=r.decode(i,{stream:!0})).split("\n");for(let e=0;e<s.length-1;e++){let t=s[e],r=t.indexOf(":");if(-1!==r){let e=t.substring(0,r).trim(),o=t.substring(r+1).trim();a[e]=o,"data"===e&&(yield a)}}n=s[s.length-1]}}catch(e){eVQ(e)}},json:()=>i.data,response:i}}function eVA(e,t){let r=e.split(".").map(Number),a=t.split(".").map(Number);for(let e=0;e<3;e++){let t=r[e]||0,o=a[e]||0;if(t>o)return 1;if(t<o)return -1}return 0}class eVE{async getToken(){return"function"==typeof this.token?await this.token():this.token}async buildOptions(e,t,r){let a=await this.getToken(),o={authorization:`Bearer ${a}`};eUw()?o["X-Coze-Client-User-Agent"]=eVk():eUQ()||eUA()?o["X-Coze-Client-User-Agent"]=eVT():(o["User-Agent"]=eVv(),o["X-Coze-Client-User-Agent"]=eVy());let i=eUx(this.axiosOptions,r,{headers:o},{headers:this.headers||{}});return i.method=e,i.data=t,i}async buildWebsocketOptions(e){var t;let r=await this.getToken(),a={authorization:`Bearer ${r}`};return eUw()?a["X-Coze-Client-User-Agent"]=eVk():eUQ()?a["X-Coze-Client-User-Agent"]=eVT():(a["User-Agent"]=eVv(),a["X-Coze-Client-User-Agent"]=eVy()),eUx({debug:null!=(t=this._config.debug)&&t},this._config.websocketOptions,e,{headers:a},{headers:this.headers||{}})}async makeRequest(e,t,r,a,o){var i,n;let s=`${this.baseURL}${e}`;try{let e=await this.buildOptions(t,r,o);e.isStreaming=a,e.axiosInstance=this.axiosInstance,this.debugLog(null==o?void 0:o.debug,`--- request url: ${s}`),this.debugLog(null==o?void 0:o.debug,"--- request options:",e);let{response:n,stream:l,json:c}=await eVz(s,e);this.debugLog(null==o?void 0:o.debug,`--- response status: ${n.status}`),this.debugLog(null==o?void 0:o.debug,"--- response headers: ",n.headers);let d=(null!=(i=n.headers)?i:n.header)["content-type"];if(a){if(d&&d.includes("application/json")){let e=await c(),{code:t,msg:r}=e;if(0!==t&&void 0!==t)throw eUD.generate(n.status,e,r,n.headers)}return l()}if(!(d&&d.includes("application/json")))return await n.data;{let e=await c(),{code:t,msg:r}=e;if(0!==t&&void 0!==t)throw eUD.generate(n.status,e,r,n.headers);return e}}catch(t){let e=(null==o?void 0:o.onApiError)||(null==(n=this._config)?void 0:n.onApiError);throw e&&e(t),t}}async post(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3?arguments[3]:void 0;return this.makeRequest(e,"POST",t,r,a)}async get(e,t,r,a){let o=Object.entries(t||{}).filter(e=>{let[t,r]=e;return null!=r}).map(e=>{let[t,r]=e;return`${t}=${r}`}).join("&");return this.makeRequest(o?`${e}${e.includes("?")?"&":"?"}${o}`:e,"GET",void 0,r,a)}async put(e,t,r,a){return this.makeRequest(e,"PUT",t,r,a)}async delete(e,t,r){return this.makeRequest(e,"DELETE",void 0,t,r)}async makeWebsocket(e,t){let r=`${this.baseWsURL}${e}`,a=await this.buildWebsocketOptions(t);return this.debugLog(null==t?void 0:t.debug,`--- websocket url: ${r}`),this.debugLog(null==t?void 0:t.debug,"--- websocket options:",a),new eVg(r,a)}getConfig(){return this._config}debugLog(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];for(var t=arguments.length,r=Array(t>1?t-1:0),a=1;a<t;a++)r[a-1]=arguments[a];(this.debug||e)&&console.debug(...r)}constructor(e){if(this._config=e,this.baseURL=e.baseURL||eVw,this.baseWsURL=e.baseWsURL||"wss://ws.coze.cn",this.token=e.token,this.axiosOptions=e.axiosOptions||{},this.axiosInstance=e.axiosInstance,this.debug=e.debug||!1,this.allowPersonalAccessTokenInBrowser=e.allowPersonalAccessTokenInBrowser||!1,this.headers=e.headers,eUQ()&&"function"!=typeof this.token&&function(e){return!!(null==e?void 0:e.startsWith("pat_"))}(this.token)&&!this.allowPersonalAccessTokenInBrowser)throw new eUE("Browser environments do not support authentication using Personal Access Token (PAT) by default.\nas it may expose secret API keys. \n\nPlease use OAuth2.0 authentication mechanism. see:\nhttps://www.coze.com/docs/developer_guides/oauth_apps?_lang=en \n\nIf you need to force use, please set the `allowPersonalAccessTokenInBrowser` option to `true`. \n\ne.g new CozeAPI({ token, allowPersonalAccessTokenInBrowser: true });\n\n")}}eVE.APIError=eUD,eVE.BadRequestError=eUL,eVE.AuthenticationError=eUO,eVE.PermissionDeniedError=eUM,eVE.NotFoundError=eUI,eVE.RateLimitError=eUB,eVE.InternalServerError=eUR,eVE.GatewayError=eUH,eVE.TimeoutError=eUP,eVE.UserAbortError=eUC;class eVD extends eVE{constructor(...e){super(...e),this.bots=new eUk(this),this.chat=new eUq(this),this.conversations=new eUW(this),this.files=new eUZ(this),this.knowledge=new eU3(this),this.datasets=new eU7(this),this.workflows=new eUJ(this),this.workspaces=new eU1(this),this.audio=new eVi(this),this.templates=new eVn(this),this.websockets=new eVh(this),this.variables=new eVm(this),this.users=new eVf(this)}}function eVS(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class eVC extends eVD{setRefreshToken(e){this.onRefreshToken=e}useAuthError(){let e=async e=>{let{code:t}=(null==e?void 0:e.data)||{};if(bG(t||e.status)){let t=this.getTokenFromHeaderAuth(String(e.config.headers.getAuthorization()||"")),r=await this.refreshToken(t);if(r)return({...e.config}).headers={...e.config.headers},e.config.headers.Authorization=`Bearer ${r}`,await eo1.request(e.config)}return e};this.useResponseInterceptors(e,e)}getTokenFromHeaderAuth(e){return e.replace(/^\s*Bearer\s*/,"").replace(/\s+$/,"")}async refreshToken(e){var t;if(this.refreshTokenPromise)return this.refreshTokenPromise;if(e!==this.token)return this.token;this.refreshTokenPromise=null==(t=this.onRefreshToken)?void 0:t.call(this,this.token);let r=await this.refreshTokenPromise;return this.refreshTokenPromise=void 0,this.token=r||"",this.token}useResponseInterceptors(e,t){this.getAxiosInstance().interceptors.response.use(e,t)}getAxiosInstance(){return this.axiosInstance}constructor({onRefreshToken:e,axiosOptions:t,...r}){super({...r,axiosOptions:{...t||{},timeout:6e5,validateStatus:()=>!0}}),eVS(this,"onRefreshToken",void 0),eVS(this,"refreshTokenPromise",void 0),this.onRefreshToken=e,this.axiosInstance=eo1.create(),this.useAuthError()}}let eVL=(0,gt.createContext)({}),eVO=e=>{let{children:t}=e,r=(0,gt.useRef)({}),{tokenManagerClient:a,cozeApiClient:o,refreshToken:i}=(()=>{let{debug:e}=ej7(),{token:t="",refreshToken:r,setToken:a,setCozeApi:o,apiUrl:i}=ej8(b7(e=>({token:e.token,setToken:e.setToken,refreshToken:e.refreshToken,setCozeApi:e.setCozeApi,apiUrl:e.apiUrl}))),n=(0,gt.useMemo)(()=>new esU({apiKey:t}),[]),s=(0,gt.useMemo)(()=>new eVC({token:t,allowPersonalAccessTokenInBrowser:!0,baseURL:i||f1,axiosOptions:{headers:{...(null==e?void 0:e.cozeApiRequestHeader)||{}}}}),[i]),l=WG(e=>{null==n||n.updateApiKey(e),s.token=e}),c=WG(async()=>{let e=await (null==r?void 0:r());return e&&(l(e),a(e)),e});return s.setRefreshToken(c),(0,gt.useEffect)(()=>{l(t)},[t]),(0,gt.useEffect)(()=>{o(s)},[s]),{tokenManagerClient:n,cozeApiClient:s,refreshToken:c}})();return(0,fU.jsx)(eVL.Provider,{value:{cozeApiSdk:o,tokenManager:a,refMessageListLeft:r,refreshToken:i},children:t})},eVM=()=>{let{cozeApiSdk:e,tokenManager:t,refMessageListLeft:r,refreshToken:a}=(0,gt.useContext)(eVL);return{cozeApiSdk:e,tokenManager:t,refMessageListLeft:r,refreshToken:a}},eVI={text:eTu.TextInput,select:eTu.Select,file:eTu.MixUpload,image:eTu.UploadImage,audio:eTu.UploadAudio,doc:eTu.UploadDoc,table:eTu.UploadTable,code:eTu.CODE,zip:eTu.ARCHIVE,ppt:eTu.PPT,video:eTu.VIDEO,txt:eTu.TXT},eVP=new class{mergeJsonObjects(e,t){let r={...e};for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a)){let o=e[a],i=t[a];if("object"!=typeof o||null===o||Array.isArray(o)||"object"!=typeof i||null===i||Array.isArray(i))if("string"==typeof o&&"string"==typeof i)r[a]=o+i;else if(Array.isArray(o)&&Array.isArray(i)){let e=[...o];for(let t=0;t<i.length;t++){let r=i[t];if(t<e.length){let a=e[t];"object"!=typeof a||null===a||Array.isArray(a)||"object"!=typeof r||null===r||Array.isArray(r)?e[t]=r:e[t]=this.mergeJsonObjects(a,r)}else e.push(r)}r[a]=e}else r[a]=i;else r[a]=this.mergeJsonObjects(o,i)}return r}convertMessageListResponse(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",{data:r=[],has_more:a,first_id:o,last_id:i}=e,n=r.map(e=>this.convertMessage(e,t)).filter(e=>!!e.message_id)||[];return console.log("messageListForCoze",n),{code:0,message_list:n,hasmore:a,cursor:i,next_cursor:o}}convertMessage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",{content_type:r,content:a}=this.convertContent(e.content_type,e.content)||{},o="question"===e.type,i=e.chat_id||`--custom-replyId--${fK()}`,n=("object_string"===e.content_type&&e.type,o?i:e.id||`--custom-messageId-${fK()}`),s=o?"":e.bot_id||t;if(!r||!n||!i)return{};let l="";if("function_call"===e.type){let t=ej0(e.content);l=(null==t?void 0:t.plugin)||""}return console.log("convertMessage message",{reasoning_content:e.reasoning_content,content:a,content_time:1e3*(e.created_at||0),content_type:r,message_id:n,reply_id:i,role:e.role,section_id:e.section_id,sender_id:s,source:0,status:"",extra_info:{local_message_id:"",plugin:l,coze_api_message_id:e.id,coze_api_chat_id:e.chat_id},type:e.type}),{reasoning_content:e.reasoning_content,content:a,content_time:1e3*(e.created_at||0),content_type:r,message_id:n,reply_id:i,role:e.role,section_id:e.section_id,sender_id:s,source:0,status:"",extra_info:{local_message_id:"",plugin:l,coze_api_message_id:e.id,coze_api_chat_id:e.chat_id},type:e.type}}convertContent(e,t){switch(e){case"object_string":{console.log("convertContent object_string");let e=this.convertMixContent(t);if(void 0===e)return;return{content_type:eny.Mix,content:e}}case"card":return{content_type:eny.Card,content:t};case"text":return{content_type:eny.Text,content:t};default:return}}convertMixContent(e){let t,r;try{let r=e.trim(),a=JSON.parse(r);t=Array.isArray(a)?a:[a]}catch(r){t=ej0(e)}if(!t)return;console.log("convertMixContent parsedContent",t);let a=null==t?void 0:t.map(e=>{switch(e.type){case"text":return{type:eny.Text,text:e.text||"",is_refer:e.is_refer||void 0};case"image":return{type:eny.Image,image:{key:(null==e?void 0:e.file_id)||"",image_ori:{height:void 0,width:void 0,url:null==e?void 0:e.file_url},image_thumb:{height:void 0,width:void 0,url:null==e?void 0:e.file_url}},is_refer:e.is_refer||void 0};case"file":{let t=(null==e?void 0:e.name)||(e=>{if(!e)return"";try{let{pathname:t}=new URL(e),r=t.split("/").pop()||"";r=r.split("?")[0].split("#")[0]||"";try{return decodeURIComponent(r)}catch{return r}}catch{let t=e.split("/"),r=t[t.length-1]||"";r=r.split("?")[0].split("#")[0]||"";try{return decodeURIComponent(r)}catch{return r}}})(null==e?void 0:e.file_url),{fileType:r=Gq.DEFAULT_UNKNOWN}=GK(new File([],t))||{};console.log("convertMixContent file",e);let a=e.file_id||e.file_url||"",o={type:eny.File,file:{file_key:a,file_name:t||"未知文件",file_size:(null==e?void 0:e.size)??0,file_type:r,file_url:(null==e?void 0:e.file_url)||""},is_refer:e.is_refer||void 0};return console.log("convertMixContent file result",o),o}case"json":return console.log("convertMixContent json",e),{type:eny.Json,json:e.json,schema_version:e.schema_version};default:return}}).filter(e=>!!e),o=a.filter(e=>e.type===eny.Json),i=a.filter(e=>e.type!==eny.Json);if(o.length>0)if(1===o.length)r=o[0];else{let e,t=o.map(e=>e.json);e=t.every(e=>"object"==typeof e&&null!==e&&!Array.isArray(e))?t.reduce((e,t)=>"object"!=typeof e||null===e||Array.isArray(e)||"object"!=typeof t||null===t||Array.isArray(t)?t:this.mergeJsonObjects(e,t),t[0]):1===t.length?t[0]:t;let a=o[0].schema_version;r={type:eny.Json,json:e,schema_version:a}}let n=[...i];return r&&n.push(r),JSON.stringify({item_list:n.filter(e=>!e.is_refer),refer_items:n.filter(e=>e.is_refer)})}},eVB=()=>{let{refMessageListLeft:e}=eVM();return(0,gt.useCallback)(function(t){var r,a,o;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=[],s=[];for(let e=0;e<i.length;e++)"question"!==i[e].type?n.push(i[e]):(s.push(...n),n.splice(0,n.length),s.push(i[e]));let l=(null==e||null==(r=e.current)?void 0:r[t])||[];return l.length&&(null==(a=l[0])?void 0:a.reply_id)===(null==(o=s[0])?void 0:o.reply_id)&&s.unshift(...l),(null==e?void 0:e.current)&&(e.current[t]=n),s},[])},eVR=async e=>{var t,r,a,o,i;let n,s,{botId:l,cozeApiSdk:c}=e,d=await c.get(`/v1/bots/${l}`,void 0,!1,{headers:{"Accept-Language":"zh-CN"===bj.language?"zh":"en"}}),u=null==d?void 0:d.data,p=u.background_image_info||{};return(null==p||null==(t=p.web_background_image)?void 0:t.image_url)&&(p.web_background_image.origin_image_url=p.web_background_image.origin_image_url||p.web_background_image.image_url),(null==p||null==(r=p.mobile_background_image)?void 0:r.image_url)&&(p.mobile_background_image.origin_image_url=p.mobile_background_image.origin_image_url||p.mobile_background_image.image_url),{prologue:u.onboarding_info.prologue,onboardingSuggestions:(null==(o=u.onboarding_info)||null==(a=o.suggested_questions)?void 0:a.map((e,t)=>({id:`${t}`,content:e})))||[],botVersion:u.version,botInfoMap:{[u.bot_id]:{url:u.icon_url,nickname:u.name,id:u.bot_id,allowMention:!1}},backgroundInfo:p,defaultInputMode:"voice"===u.default_user_input_type?ej3.Voice:"call"===u.default_user_input_type?ej3.VoiceCall:ej3.Text,shortcuts:(n=u.shortcut_commands,s={id:l,name:u.name,iconUrl:u.icon_url},(null==n?void 0:n.map(e=>{var t,r,a,o,i,n,l,c;let d,u,p=e.send_type&&("panel"===e.send_type?eTp.SendTypePanel:eTp.SendTypeQuery);return p!==eTp.SendTypeQuery&&(d=(null==(l=e.components)?void 0:l.map(e=>{var t;return{name:e.name,description:e.description,parameter:e.tool_parameter,hide:e.is_hide,options:"select"===e.type&&e.options||[],input_type:eVI[e.type],upload_options:"file"===e.type&&(null==(t=e.options)?void 0:t.map(e=>eVI[e]))||[],default_value:{value:e.default_value||"",type:0}}}))||[],(null==e||null==(c=e.tool)?void 0:c.type)&&["plugin","workflow"].includes(e.tool.type)&&(u="plugin"===e.tool.type?eTh.ToolTypePlugin:eTh.ToolTypeWorkFlow)),{object_id:(null==s?void 0:s.id)||"",command_name:e.name,shortcut_command:e.command,description:e.description,send_type:p,tool_type:u,work_flow_id:(null==e||null==(t=e.tool)?void 0:t.workflow_id)||"",plugin_id:(null==e||null==(r=e.tool)?void 0:r.plugin_id)||"",plugin_api_name:(null==e||null==(a=e.tool)?void 0:a.name)||"",template_query:e.query_template,components_list:d,card_schema:e.card_schema,command_id:e.id,tool_info:{tool_name:null==(o=e.tool)?void 0:o.name,tool_params_list:(null==(n=e.tool)||null==(i=n.params)?void 0:i.map(e=>({name:e.name,required:e.is_required,desc:e.description,type:e.type,default_value:e.default_value,refer_component:e.is_refer_component})))||[]},shortcut_icon:{url:e.icon_url},bot_info:{icon_url:(null==s?void 0:s.iconUrl)||"",name:(null==s?void 0:s.name)||""}}}))||[]),voiceCallClose:(null==(i=u.media_config)?void 0:i.is_voice_call_closed)??!0}},eVH=async e=>{let{botId:t,cozeApiSdk:r,conversationId:a,sectionId:o,connectorId:i,defaultHistoryMessage:n,onDefaultHistoryClear:s,chatType:l,appInfo:c}=e,d=a||"",u=o||"";if(!d)return{lastSectionId:"",conversationId:"",messageList:[],hasMore:!1,cursor:"",next_cursor:""};let p=await r.conversations.messages.list(d,{limit:10}),{message_list:h,hasmore:m,cursor:f,next_cursor:g}=eVP.convertMessageListResponse(p,t);if(!u&&h&&h.length>0){let e=h[0];(null==e?void 0:e.section_id)&&(u=e.section_id)}return{lastSectionId:u,conversationId:d,messageList:h,hasMore:m,cursor:f,next_cursor:g}},eVF=async e=>{let t,{cozeApiSdk:r,openRequestInit:a}=e;return a?(t="function"==typeof a?await a(r):a).isBuilderChat?{botOnlineInfo:{prologue:t.prologue,onboardingSuggestions:t.onboardingSuggestions,botInfoMap:{[t.botInfo.id]:t.botInfo},backgroundInfo:t.backgroundInfo,defaultInputMode:t.defaultInputMode,shortcuts:[],isCustomBackground:t.isCustomBackground},conversationId:t.conversationId,sectionId:t.sectionId,conversationName:t.conversationName}:{conversationId:t.conversationId,sectionId:t.sectionId,conversationName:t.conversationName}:null},eVj=e=>{let{project:t}=e,{mode:r,connectorId:a}=t||{};if(!a){if("websdk"===r)return"999";else if("draft"===r)return"10000010"}return a},eVN=async(e,t)=>{let r,a="",o="";try{if("bot"===t.projectType){let i=await (null==e?void 0:e.conversations.create({connector_id:t.connectorId},{headers:{"Accept-Language":"zh-CN"===bj.language?"zh":"en"}}));i&&(a=i.id||"",o=i.last_section_id||""),r=void 0}else{let i={app_id:t.projectId,draft_mode:"draft"===t.mode,workflow_id:t.workflowId||"",connector_id:t.connectorId};if(t.conversationName&&""!==t.conversationName.trim()&&(i.get_or_create=!0,i.conversation_name=t.conversationName),void 0!==globalThis.IS_OPEN_SOURCE&&globalThis.IS_OPEN_SOURCE){let n=await (null==e?void 0:e.post("/v1/workflow/conversation/create",i,!1,{headers:{"Accept-Language":"zh-CN"===bj.language?"zh":"en"}}));if((null==n?void 0:n.code)===0&&(null==n?void 0:n.data)){if(a=n.data.id||"",o=n.data.last_section_id||"",!a||""===a.trim())throw Error("Failed to create conversation: empty conversationId returned")}else{let e=(null==n?void 0:n.msg)||`code=${(null==n?void 0:n.code)??"unknown"}`;throw Error(`Failed to create conversation: ${e}`)}if(a&&""!==a.trim())try{let o=await (null==e?void 0:e.get(`/v1/workflow/conversations/${a}`,{app_id:t.projectId,workflow_id:t.workflowId||"",connector_id:t.connectorId}));(null==o?void 0:o.code)===0&&(null==o?void 0:o.data)&&(r=o.data.conversation_name||o.data.name||o.data.title||void 0)}catch(e){console.warn("Failed to fetch conversation detail:",e),r=void 0}}else{let n=await (null==e?void 0:e.post("/v1/workflow/conversation/create",i,!1,{headers:{"Accept-Language":"zh-CN"===bj.language?"zh":"en"}}));if((null==n?void 0:n.code)===0&&(null==n?void 0:n.data)){if(a=n.data.id||"",o=n.data.last_section_id||"",!a||""===a.trim())throw Error("Failed to create conversation: empty conversationId returned")}else if((null==n?void 0:n.code)!==0){let e=(null==n?void 0:n.msg)||`code=${(null==n?void 0:n.code)??"unknown"}`;throw Error(`Failed to create conversation: ${e}`)}if(a)try{let o=await (null==e?void 0:e.get(`/v1/workflow/conversations/${a}`,{app_id:t.projectId,workflow_id:t.workflowId||"",connector_id:t.connectorId}));(null==o?void 0:o.code)===0&&(null==o?void 0:o.data)&&(r=o.data.conversation_name||o.data.name||o.data.title||void 0)}catch(e){console.warn("Failed to fetch conversation detail:",e),r=void 0}}}return{conversationId:a,sectionId:o,conversationName:r}}catch(e){if(console.error("createConversationForMessage error:",e),e instanceof Error)throw e;throw Error(`Failed to create conversation: ${JSON.stringify(e)}`)}},eVU=async(e,t)=>{if(!t.project.conversationName||""===t.project.conversationName.trim())return{conversationId:"",sectionId:"",conversationName:void 0};if("app"===t.project.type)try{let r=eVj(t),a={app_id:t.project.id,draft_mode:"draft"===t.project.mode,workflow_id:t.workflow.id||"",connector_id:r,get_or_create:!0,conversation_name:t.project.conversationName},o=await (null==e?void 0:e.post("/v1/workflow/conversation/create",a,!1,{headers:{"Accept-Language":"zh-CN"===bj.language?"zh":"en"}}));if((null==o?void 0:o.code)===0&&(null==o?void 0:o.data)){let a,i=o.data.id||"",n=o.data.last_section_id||"";if(!i||""===i.trim())throw Error("Failed to create conversation: empty conversationId returned");if(i)try{let o=await (null==e?void 0:e.get(`/v1/workflow/conversations/${i}`,{app_id:t.project.id,workflow_id:t.workflow.id||"",connector_id:r}));(null==o?void 0:o.code)===0&&(null==o?void 0:o.data)&&(a=o.data.conversation_name||o.data.name||o.data.title||void 0)}catch(e){console.warn("Failed to fetch conversation detail:",e),a=t.project.conversationName}return{conversationId:i,sectionId:n,conversationName:a||t.project.conversationName}}{let e=(null==o?void 0:o.msg)||`code=${(null==o?void 0:o.code)??"unknown"}`;throw Error(`Failed to create conversation: ${e}`)}}catch(e){console.error("createOrGetConversation error:",e),e instanceof Error&&console.warn("Failed to create conversation during init, will create on first message:",e.message)}return{conversationId:"",sectionId:"",conversationName:void 0}},eVV=new class{convertRequestBody(e){let t,{body:r,userInfo:a,connectorId:o,parameters:i,shortcuts:n}=e,s=ej0(r)||{},l=s.content_type,c=s.query,d=s.shortcut_command;if(i)if("string"==typeof i)try{let e=JSON.parse(i);t=JSON.stringify(e)}catch{t=i}else t="object"==typeof i?JSON.stringify(i):String(i);return JSON.stringify({bot_id:s.bot_id,user_id:null==a?void 0:a.id,stream:!0,connector_id:o,additional_messages:[this.convertRequestMessage(l,c)],parameters:t,shortcut_command:this.convertShortcuts(n||[],d),enable_card:!0})}convertRequestMessage(e,t){return{role:"user",...this.convertContent(e,t)}}convertContent(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];switch(e){case eny.Text:return{content_type:"text",content:t};case eny.Card:return{content_type:"card",content:t};case eny.Image:case eny.File:case eny.Mix:return this.convertMixContent(t,r);default:throw Error("Error: unknown content Type")}}convertMixContent(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=ej0(e);if(!r)return;let a=[...(null==r?void 0:r.item_list)||[]],o=[...(null==r?void 0:r.refer_items)||[]];return{content_type:"object_string",content:JSON.stringify((a=(a=(a=a.concat(((null==r?void 0:r.image_list)||[]).map(e=>({type:eny.Image,image:e})))).concat(((null==r?void 0:r.file_list)||[]).map(e=>({type:eny.File,file:e})))).concat((o||[]).map(e=>({...e,is_refer:!0})))).map(e=>{var r,a;switch(e.type){case eny.Text:return{type:"text",text:e.text,is_refer:e.is_refer||void 0};case eny.Image:{let a=e.image.id||e.image.key;return{type:"image",file_id:a,file_url:t||!a?null==(r=e.image.image_ori)?void 0:r.url:void 0,is_refer:e.is_refer||void 0}}case eny.File:return{type:"file",file_id:e.file.file_id||e.file.file_key,file_url:t?null==(a=e.file)?void 0:a.file_url:void 0,is_refer:e.is_refer||void 0};default:return null}}).filter(e=>!!e))}}convertMessageListResponse(e){return null==e?void 0:e.reverse().map(e=>{let t=this.convertMessage(e);if((null==t?void 0:t.content_type)==="object_string"){var r;let e=ej0(t.content),a=null==e?void 0:e.map(e=>"image"===e.type||"file"===e.type?{type:"text",text:e.file_url}:e);if((null==a?void 0:a.length)===1&&(null==(r=a[0])?void 0:r.type)==="text")t.content_type="text",t.content=a[0].text;else{if(!((null==a?void 0:a.length)>0))return null;t.content=JSON.stringify(a)}}return t}).filter(e=>!!e)}convertMessage(e){return e.type&&["ack","answer","question"].includes(e.type)&&e.role&&["user","assistant"].includes(e.role)&&e.content_type&&["card","image","text","object_string","file"].includes(e.content_type)&&e.content?{role:e.role,...this.convertContent(e.content_type,e.content||"",!0)}:null}convertShortcuts(e,t){let r;if("string"==typeof t)r=ej0(t);else{if("object"!=typeof t)return t;r=t}let a=e.find(e=>e.command_id===r.command_id);if(null==a?void 0:a.components_list){let e=new Map(a.components_list.filter(e=>e.parameter&&e.name).map(e=>[e.parameter,e.name]));Object.keys(r.parameters).forEach(t=>{let a=e.get(t),o=r.parameters[t];a&&(delete r.parameters[t],r.parameters[a]=o)})}return r}},eVq=(e,t)=>{try{return JSON.parse(e)}catch(e){return eiR.persist.error({error:e,eventName:eRe.parseJSON,message:"parse json fail"}),t??void 0}};function eVG(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class eVK extends Error{constructor(e,t,r){super(t),eVG(this,"eventName",void 0),eVG(this,"msg",void 0),eVG(this,"ext",void 0),this.eventName=e,this.msg=t,this.ext=r,this.name="CustomError",this.ext=r}}function eVW(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}eiR.createLoggerWith({ctx:{namespace:"bot-error",scope:"certain-error"}}),eiR.createLoggerWith({ctx:{namespace:"bot-error",scope:"use-error-catch"}}),eiR.createLoggerWith({ctx:{namespace:"bot-global-error"}}),new class{getLogID(){return{log_id:eo3.LAST_EXECUTE_ID}}getMetaCtx(){return{bot_id:this.botID,...this.getLogID()}}_clearTimeout(){this._timer&&(clearTimeout(this._timer),this._timer=void 0)}interrupt(){this._clearTimeout(),(this._receivingMessages||this._receivingSuggests)&&(this._receiveTotalMessagesEvent.success(),this._receivingMessages&&this.receiveMessageEvent.success(),this._receivingSuggests&&this.messageReceiveSuggestsEvent.success())}start(e){this.botID=e}constructor(){var e=this;eVW(this,"botID",""),eVW(this,"_timer",void 0),eVW(this,"_receivingMessages",!1),eVW(this,"_receivingSuggests",!1),eVW(this,"_hasReceiveFirstChunk",!1),eVW(this,"_hasReceiveFirstSuggestChunk",!1),eVW(this,"_messageTotalContent",0),eVW(this,"_executeDraftBotEvent",void 0),eVW(this,"_receiveMessagesEvent",void 0),eVW(this,"_messageReceiveSuggestsEvent",void 0),eVW(this,"_receiveTotalMessagesReportEvent",void 0),eVW(this,"_createExecuteDraftBotEvent",()=>eRt({eventName:eRe.botDebugMessageSubmit,meta:this.getMetaCtx()})),eVW(this,"_createReceiveMessagesEvent",()=>eRt({eventName:eRe.receiveMessage,meta:this.getMetaCtx()})),eVW(this,"_createMessageReceiveSuggestsEvent",()=>eRt({eventName:eRe.messageReceiveSuggests,meta:this.getMetaCtx()})),eVW(this,"_createReceiveTotalMessagesEvent",()=>eRt({eventName:eRe.receiveTotalMessages,meta:this.getMetaCtx()})),eVW(this,"_receiveMessagesEventGate",()=>this._receivingMessages),eVW(this,"_messageReceiveSuggestsEventGate",()=>this._receivingSuggests),eVW(this,"_receiveTotalMessagesEvent",{start:()=>{this._receiveTotalMessagesReportEvent=this._createReceiveTotalMessagesEvent()},error:e=>{var t,r;null==(t=this._receiveTotalMessagesReportEvent)||t.addDurationPoint("failed"),null==(r=this._receiveTotalMessagesReportEvent)||r.error({reason:e})},success:function(){var t,r;let a=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null==(t=e._receiveTotalMessagesReportEvent)||t.addDurationPoint("success"),null==(r=e._receiveTotalMessagesReportEvent)||r.success({meta:{reply_has_finished:a}})},finish:()=>{var e;null==(e=this._receiveTotalMessagesEvent)||e.success(!0)}}),eVW(this,"messageReceiveSuggestsEvent",{start:()=>{this._messageReceiveSuggestsEvent=this._createMessageReceiveSuggestsEvent(),this._receivingSuggests=!0,this._hasReceiveFirstSuggestChunk=!1},receiveSuggest:()=>{if(this._messageReceiveSuggestsEventGate()&&!this._hasReceiveFirstSuggestChunk){var e;null==(e=this._messageReceiveSuggestsEvent)||e.addDurationPoint("first"),this._hasReceiveFirstSuggestChunk=!0}},success:()=>{var e,t;this._messageReceiveSuggestsEventGate()&&(null==(e=this._messageReceiveSuggestsEvent)||e.addDurationPoint("success"),null==(t=this._messageReceiveSuggestsEvent)||t.success({meta:{reply_has_finished:!this._receivingSuggests}}),this._receivingSuggests=!1)},finish:()=>{this._messageReceiveSuggestsEventGate()&&(this.messageReceiveSuggestsEvent.success(),this._receiveTotalMessagesEvent.finish())},error:e=>{var t,r;let{error:a,reason:o}=e;this._messageReceiveSuggestsEventGate()&&(null==(t=this._messageReceiveSuggestsEvent)||t.addDurationPoint("failed"),null==(r=this._messageReceiveSuggestsEvent)||r.error({error:a,reason:o}),this._receivingSuggests=!1)}}),eVW(this,"receiveMessageEvent",{error:()=>{var e;this._receiveMessagesEventGate()&&(null==(e=this._receiveMessagesEvent)||e.addDurationPoint("failed"),this._receivingMessages=!1)},success:function(){var t,r;let a=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e._receiveMessagesEventGate()&&(null==(t=e._receiveMessagesEvent)||t.addDurationPoint("success"),null==(r=e._receiveMessagesEvent)||r.success({meta:{content_length:e._messageTotalContent,reply_has_finished:a}}),e._receivingMessages=!1)},start:()=>{this._receiveMessagesEvent=this._createReceiveMessagesEvent(),this._receivingMessages=!0,this._hasReceiveFirstChunk=!1,this._messageTotalContent=0,this._timer=setTimeout(this.receiveMessageEvent.error,12e4)},receiveMessage:e=>{var t,r;!this._receiveMessagesEventGate()||(e.content||eiN.errorEvent({eventName:eRe.emptyReceiveMessage,error:new eVK(eRe.emptyReceiveMessage,e.content||"empty content")}),this._messageTotalContent+=(null==(t=e.content)?void 0:t.length)??0,this._hasReceiveFirstChunk||(this._clearTimeout(),null==(r=this._receiveMessagesEvent)||r.addDurationPoint("first"),this._hasReceiveFirstChunk=!0))},finish:e=>{if(this._receiveMessagesEventGate()){let t;this.receiveMessageEvent.success(!0),"ext"in e&&vT(t=e.ext)&&"has_suggest"in t&&"1"===t.has_suggest?this.messageReceiveSuggestsEvent.start():this._receiveTotalMessagesEvent.finish()}}}),eVW(this,"executeDraftBotEvent",{start:()=>{this._executeDraftBotEvent=this._createExecuteDraftBotEvent(),this.interrupt()},success:()=>{var e,t;null==(e=this._executeDraftBotEvent)||e.addDurationPoint("finish"),null==(t=this._executeDraftBotEvent)||t.success({meta:{...this.getLogID()}}),this._receiveTotalMessagesEvent.start(),this.receiveMessageEvent.start()},error:e=>{var t;let{error:r,reason:a}=e;null==(t=this._executeDraftBotEvent)||t.error({error:r,reason:a,meta:{...this.getLogID()}})}})}},eyP().getParser(window.navigator.userAgent);var eVZ=i(88022),eVX=i.n(eVZ),eVY=i(41877),eV$=i.n(eVY),eVJ=i(76262),eV1=i.n(eVJ);function eV0(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}evj().extend(eVX()),evj().extend(eV$()),evj().extend(eV1()),new ve;class eV2{parse(e,t){let{terminate:r}=t,{data:a,event:o}=e;switch(o){case"conversation.chat.created":return this.createAckMessage(a);case"conversation.message.delta":{let e=this.createMessage(a,!1,!1);if(!e)return;return e}case"conversation.message.completed":{let e=this.createMessage(a,!0,!1);if(e&&"object"==typeof e&&"data"in e){let t=e.data;if(t&&"object"==typeof t&&"message"in t&&t.message&&"object"==typeof t.message){let e=t.message,r=e.message_id||e.reply_id||"";r&&(this.streamingJsonContent.delete(r),this.lastValidJsonContent.delete(r),this.lastReturnedParsedContent.delete(r),this.lastReturnedAccumulatedContent.delete(r))}}return e}case"conversation.chat.completed":case"done":return void r();case"conversation.chat.failed":{var i;let e=(null==(i=eVq(a).last_error)?void 0:i.msg)||bj.t("sendFailed");throw Ym.error(e),Error("Chat stream error")}case"error":{let e=eVq(a),t=(null==e?void 0:e.msg)||bj.t("sendFailed");throw Ym.error(t),Error("Chat stream error")}case"conversation.update":{let e=eVq(a);(null==e?void 0:e.conversation_id)&&(null==e?void 0:e.updates)&&this.onConversationUpdate&&this.onConversationUpdate({conversation_id:e.conversation_id,updates:e.updates,updated_at:e.updated_at||Date.now()});return}default:return}}createMessage(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=ej0(e);if(!a)return;let o=(null==a?void 0:a.type)||"";a.chat_id=a.chat_id&&"0"!==a.chat_id?a.chat_id:"",a.id=a.id&&"0"!==a.id?a.id:"";let i="object_string"===a.content_type&&"answer"===a.type;if(i&&a.content){let e=a.id||"";if(e){let o;r?(o=(this.streamingJsonContent.get(e)||"")+a.content,this.streamingJsonContent.set(e,o)):o=a.content;let i=o.trim();if(i.startsWith("[")&&i.endsWith("]"))try{let n=JSON.parse(i);if(Array.isArray(n)){let o=n;if(!t&&r){let t=this.lastValidJsonContent.get(e);if(t)try{let e=JSON.parse(t);if(Array.isArray(e)&&e.length>0&&n.length>0){let t=e[0],r=n[0];if("object"==typeof t&&null!==t&&"object"==typeof r&&null!==r&&"json"in t&&"json"in r&&"object"==typeof t.json&&null!==t.json&&"object"==typeof r.json&&null!==r.json){let e=this.mergeJsonObjects(t.json,r.json);o=[{...r,json:e},...n.slice(1)]}}}catch(e){}}let i=JSON.stringify(o);a.content=i,this.lastValidJsonContent.set(e,i)}else a.content=o}catch(s){let n=this.mergeStreamingArrays(i);if(null!==n){let o=n;if(!t&&r){let t=this.lastValidJsonContent.get(e);if(t)try{let e=JSON.parse(t);if(Array.isArray(e)&&e.length>0&&n.length>0){let t=e[0],r=n[0];if("object"==typeof t&&null!==t&&"object"==typeof r&&null!==r&&"json"in t&&"json"in r&&"object"==typeof t.json&&null!==t.json&&"object"==typeof r.json&&null!==r.json){let e=this.mergeJsonObjects(t.json,r.json);o=[{...r,json:e},...n.slice(1)]}}}catch(e){}}let i=JSON.stringify(o);a.content=i,this.lastValidJsonContent.set(e,i)}else a.content=o}else a.content=o}}let n=eVP.convertMessage(a,this.botId);if(n){if(i&&!t&&n.content_type===eny.Mix&&(!n.content||"undefined"===n.content)){let e=a.id||"",t=e?this.lastValidJsonContent.get(e):void 0;if(!t)return;n.content=t}if(i&&!t&&n.message_id){let e=a.id||"";if(e){let t=n.content||"",r=this.lastReturnedParsedContent.get(e)||"";if(t&&r&&t===r)return;t&&this.lastReturnedParsedContent.set(e,t)}}return n.section_id=n.section_id||this.sectionId,{event:"message",data:{conversation_id:this.conversationId,index:this.getIndexNo(o),is_finish:t,seq_id:this.getSeqNo(),message:{...n,sender:this.botId}}}}}mergeJsonObjects(e,t){let r={...e};for(let a in t)if(Object.prototype.hasOwnProperty.call(t,a)){let o=e[a],i=t[a];if("object"!=typeof o||null===o||Array.isArray(o)||"object"!=typeof i||null===i||Array.isArray(i))if("string"==typeof o&&"string"==typeof i)r[a]=o+i;else if(Array.isArray(o)&&Array.isArray(i)){let e=[...o];for(let t=0;t<i.length;t++){let r=i[t];if(t<e.length){let a=e[t];"object"!=typeof a||null===a||Array.isArray(a)||"object"!=typeof r||null===r||Array.isArray(r)?e[t]=r:e[t]=this.mergeJsonObjects(a,r)}else e.push(r)}r[a]=e}else r[a]=i;else r[a]=this.mergeJsonObjects(o,i)}return r}mergeStreamingArrays(e){if(!e||!e.trim().startsWith("["))return null;let t=e.trim(),r=[],a=0;for(;a<t.length;){for(;a<t.length&&/\s/.test(t[a]);)a++;if(a>=t.length||"["!==t[a])break;let e=0,o=!1,i=!1,n=-1;for(let r=a;r<t.length;r++){let a=t[r];if(i){i=!1;continue}if("\\"===a){i=!0;continue}if('"'===a){o=!o;continue}if(!o){if("["===a)e++;else if("]"===a&&0==--e){n=r;break}}}if(n>a)try{let e=t.substring(a,n+1),o=JSON.parse(e);Array.isArray(o)?r.push(...o):r.push(o),a=n+1}catch(e){break}else break}return r.length>0?r:null}tryParseStreamingJson(e){if(!e||""===e.trim())return null;let t=e.trim();try{let e=JSON.parse(t);return JSON.stringify(e)}catch(e){if(t.startsWith("[")){let e=0,r=0,a=!1,o=!1,i=-1;for(let n=0;n<t.length;n++){let s=t[n];if(o){o=!1;continue}if("\\"===s){o=!0;continue}if('"'===s){a=!a;continue}if(!a&&("["===s&&e++,"]"===s&&e--,"{"===s&&r++,"}"===s&&r--,0===e&&0===r&&n>0)){i=n;break}}if(i>0)try{let e=t.substring(0,i+1);return JSON.parse(e),e}catch(e){}}else if(t.startsWith("{")){let e=0,r=!1,a=!1,o=-1;for(let i=0;i<t.length;i++){let n=t[i];if(a){a=!1;continue}if("\\"===n){a=!0;continue}if('"'===n){r=!r;continue}if(!r&&("{"===n&&e++,"}"===n&&e--,0===e&&i>0)){o=i;break}}if(o>0)try{let e=t.substring(0,o+1);return JSON.parse(e),e}catch(e){}}return null}}createAckMessage(e){var t,r,a;let o=ej0(e);if(!o)return;let i=(null==o?void 0:o.id)!=="0"&&(null==o?void 0:o.id)?null==o?void 0:o.id:"",n=i||`--custom-replyId--${fK()}`,s=null==(r=o.inserted_additional_messages)||null==(t=r.lastItem)?void 0:t.id;return{event:"message",data:{conversation_id:this.conversationId,index:this.getIndexNo("ack"),is_finish:!0,message:{content:this.sendMessageContent,content_time:1e3*((null==o?void 0:o.created_at)||0),content_type:this.sendMessageContentType,extra_info:{local_message_id:this.localMessageId,chatflow_execute_id:null==o?void 0:o.execute_id,coze_api_message_id:s,coze_api_chat_id:i},message_id:n,reply_id:n,role:"user",section_id:(null==o?void 0:o.section_id)||this.sectionId,sender_id:null==(a=this.userInfo)?void 0:a.id,source:0,status:"",type:"ack"},seq_id:this.getSeqNo()}}}getSeqNo(){return this.seqNo++}getIndexNo(e){return this.indexNoMap[e]||(this.indexNoMap[e]=this.indexNo++),this.indexNoMap[e]}static getMessageParser(e){let{requestMessageRawBody:t,userInfo:r,sectionId:a,onConversationUpdate:o}=e,i=new eV2({requestMessageRawBody:t,userInfo:r,sectionId:a,onConversationUpdate:o});return(e,t)=>{let{terminate:r}=t,{type:a,event:o}=e;if("event"===a){let t=null==i?void 0:i.parse(e,{terminate:r});return["done","error","conversation.chat.failed"].includes(o)&&(i=void 0),t}}}constructor({requestMessageRawBody:e,userInfo:t,sectionId:r,onConversationUpdate:a}){eV0(this,"seqNo",0),eV0(this,"indexNo",0),eV0(this,"indexNoMap",{}),eV0(this,"conversationId",""),eV0(this,"localMessageId",""),eV0(this,"sendMessageContent",""),eV0(this,"sendMessageContentType",""),eV0(this,"botId",""),eV0(this,"sectionId",""),eV0(this,"botVersion",""),eV0(this,"userInfo",void 0),eV0(this,"onConversationUpdate",void 0),eV0(this,"streamingJsonContent",new Map),eV0(this,"lastValidJsonContent",new Map),eV0(this,"lastReturnedParsedContent",new Map),eV0(this,"lastReturnedAccumulatedContent",new Map),this.conversationId=e.conversation_id,this.localMessageId=e.local_message_id,this.sendMessageContent=e.query,this.sendMessageContentType=e.content_type,this.botId=e.bot_id,this.botVersion=e.bot_version,this.userInfo=t,this.sectionId=r||"",this.onConversationUpdate=a}}let eV3=async(e,t)=>{var r;let{code:a}=(null==e||null==(r=e.response)?void 0:r.data)||{},o=e;if(bG(a)){let r=await (null==t?void 0:t());if(r){let t={...e.config};t.headers={...t.headers},t.headers.Authorization=`Bearer ${r}`,o=await eo1.request(t)}}return o},eV4=e=>{let t;return{appLifeCycleService:{},messageLifeCycleService:(t="",{onSendMessageError:async r=>{var a,o,i,n,s,l,c;let d=r.error;if(bG((null==d||null==(a=d.ext)?void 0:a.code)||0)||(null==d||null==(o=d.stack)?void 0:o.includes("401"))){await (null==(n=e.pluginBizContext)||null==(i=n.refreshToken)?void 0:i.call(n));let a=r.message.message_id||(null==(l=r.message)||null==(s=l.extra_info)?void 0:s.local_message_id);a!==t&&(t=a,null==(c=e.pluginBizContext)||c.regenerateMessageByUserMessageId(a))}}}),commandLifeCycleService:{},renderLifeCycleService:{}}},eV6=e=>{let{messageGroup:t}=e,{isLatest:r}=t,{isShowFeedbackInLastGroup:a,cozeApiMessageId:o}=(e=>{var t;let r=ej8(e=>e.feedbackInfo),{useMessagesStore:a}=ey3(),{findMessage:o}=a.getState(),i=ej8(e=>e.lastGroupFeedbackInfo),{messageId:n}=i,s=o(n||""),l=null==s||null==(t=s.extra_info)?void 0:t.coze_api_message_id;return{isShowFeedbackInLastGroup:(0,gt.useMemo)(()=>!!i.isShowCustomPanel&&!!n&&"thumbDown"===r[l]&&e.memberSet.llmAnswerMessageIdList.includes(n),[r,i,e]),cozeApiMessageId:l}})(t);return r&&a&&o?(0,fU.jsx)("div",{className:"ml-[24px] mr-[24px]"}):null};var eV5=i(57759),eV7={};eV7.styleTagTransform=yj(),eV7.setAttributes=yB(),eV7.insert=yI().bind(null,"head"),eV7.domAPI=yO(),eV7.insertStyleElement=yH(),yC()(eV5.A,eV7);let eV8=eV5.A&&eV5.A.locals?eV5.A.locals:void 0,eV9=e=>{let{leftContent:t,rightContent:r,children:a}=e;return(0,fU.jsxs)("div",{className:eV8.container,children:[(0,fU.jsxs)("div",{className:eV8["icon-container"],children:[(0,fU.jsx)("div",{"data-testid":"chat-area.answer-action.left-content",className:eV8["left-content"],children:t}),(0,fU.jsx)("div",{"data-testid":"chat-area.answer-action.right-content",className:eV8["right-content"],children:r})]}),a]})};eV9.displayName="ActionBarContainer";var eqe=i(41054),eqt={};eqt.styleTagTransform=yj(),eqt.setAttributes=yB(),eqt.insert=yI().bind(null,"head"),eqt.domAPI=yO(),eqt.insertStyleElement=yH(),yC()(eqe.A,eqt);let eqr=eqe.A&&eqe.A.locals?eqe.A.locals:void 0,eqa=(0,gt.forwardRef)((e,t)=>{let{children:r,style:a}=e;return(0,fU.jsx)("div",{"data-testid":"chat-area.answer-action.hover-action-bar",className:yY()(eqr.container,["coz-stroke-primary","coz-bg-max"]),style:a,ref:t,children:r})}),eqo=e=>eTi().layout===GP.MOBILE?"custom":e;var eqi=i(58678),eqn={};eqn.styleTagTransform=yj(),eqn.setAttributes=yB(),eqn.insert=yI().bind(null,"head"),eqn.domAPI=yO(),eqn.insertStyleElement=yH(),yC()(eqi.A,eqn),eqi.A&&eqi.A.locals&&eqi.A.locals;var eqs=((eN={}).TtsVoiceWs="chat_answer_action_start_TTS",eN.ReportMessage="chat_answer_action_message_feedback",eN.CopyTextMessage="chat_answer_action_copy_text_message",eN);let eql=e=>{let{className:t,isMustGroupLastAnswerMessage:r=!0,isUseExternalContent:a=!1,externalContent:o,...i}=e,{reporter:n}=eF0(),{message:s,meta:l}=eIW(),c=a?o||"":s.content,[d,u]=(0,gt.useState)(!1),p=eqo("hover");if(!ewD(s)||!l.isGroupLastAnswerMessage&&r)return null;let h=yY()(t,"w-[14px] h-[14px]");return(0,fU.jsx)($l,{content:d?bj.t("copied"):bj.t("copy"),trigger:p,children:(0,fU.jsx)(Yx,{"data-testid":"chat-area.answer-action.copy-button",size:"small",icon:d?(0,fU.jsx)(Zf,{className:h}):(0,fU.jsx)(W6,{className:h}),color:"secondary",onClick:()=>{ed_()(c)?(u(!0),setTimeout(()=>u(!1),3e3),Ym.success({content:bj.t("copy_success"),showClose:!1,duration:3}),n.successEvent({eventName:eqs.CopyTextMessage})):(Ym.warning({content:bj.t("copy_failed"),showClose:!1,duration:3}),n.errorEvent({eventName:eqs.CopyTextMessage,...esb("copy_text_message_error","copy_text_message_error")}))},...i})})},eqc=()=>{try{return eF6(eji.MessageGrab)}catch(e){return null}},eqd=e=>{let t=eqc(),{message:r}=eIW();return t&&r.source!==env.Notice?(0,fU.jsx)(equ,{...e}):null},equ=e=>{let{className:t,...r}=e,a=eqc(),{chatAreaPluginContext:o,pluginBizContext:i}=a,{useDeleteFile:n}=a.chatAreaPluginContext.writeableHook.file,{getFileStoreInstantValues:s}=o.readonlyAPI.batchFile,{useQuoteStore:l}=i.storeSet,{onQuote:c}=i.eventCallbacks,{updateQuoteContent:d,updateQuoteVisible:u}=l.getState(),{message:p,meta:h}=eIW(),{content:m,content_type:f}=p,g=eqo("hover"),_=n(),b=ewD(p),v=ewC(p);return(b||v)&&h.isGroupLastAnswerMessage&&a?(0,fU.jsx)($l,{content:bj.t("quote_ask_in_chat"),trigger:g,children:(0,fU.jsx)(Yx,{"data-testid":"chat-area.answer-action.quote-message",size:"small",icon:(0,fU.jsx)(Zd,{className:yY()(t,"w-[14px] h-[14px]")}),onClick:()=>{if((()=>{let{fileIdList:e}=s();e.forEach(e=>_(e))})(),f===eny.Image){let e=es_({str:m,verifyStruct:e=>e instanceof Object&&"image_list"in e,onParseError:e=>{esy(e.message)},onVerifyError:e=>{esy(e.message)}});d((null==e?void 0:e.image_list.map(e=>({type:eNk.IMAGE,src:e.image_ori.url,children:[]})))??[])}else d(eNH(efF(m)));null==c||c({botId:p.sender_id??"",source:p.source}),u(!0)},color:"secondary",...r})}):null};eqd.displayName="QuoteMessage";var eqp=i(29211),eqh={};eqh.styleTagTransform=yj(),eqh.setAttributes=yB(),eqh.insert=yI().bind(null,"head"),eqh.domAPI=yO(),eqh.insertStyleElement=yH(),yC()(eqp.A,eqh),eqp.A&&eqp.A.locals&&eqp.A.locals;let eqm=()=>{var e,t;let{message:r}=eIW(),{chatConfig:a}=ej7(),o=r.extra_info.coze_api_message_id,i=r.extra_info.coze_api_chatId_id;return{messageId:r.message_id,cozeApiMessageId:o,cozeApiChatId:i,isShowDelete:!1,isNeedQuote:(null==(t=a.ui)||null==(e=t.chatBot)?void 0:e.isNeedQuote)??!1}},eqf=e=>{var t,r;let{className:a,...o}=e,{useGlobalInitStore:i}=ey3(),{groupId:n}=eIW(),s=(e=>{let{useChatActionStore:t}=ey3();return t(t=>eMp.deleteMessageGroup(e,t.answerActionLockMap,t.globalActionLock))})(n),{chatConfig:l}=ej7(),c=(()=>{let e=ey3(),t=eM_(),{cozeApiSdk:r}=eVM();return async(a,o)=>{var i;if(!o||!a)return;let{useMessagesStore:n,useSuggestionsStore:s}=e,{findMessage:l,isLastMessageGroup:c}=n.getState(),{clearSuggestions:d}=s.getState(),u=l(o),p=null==u?void 0:u.reply_id,h=null==u||null==(i=u.extra_info)?void 0:i.coze_api_message_id;if(!u||!p)throw Error(`message not found, id: ${o}`);if(t.answerAction.getIsLock(p,"deleteMessageGroup"))return;t.answerAction.lock(p,"deleteMessageGroup");let m=c(p),{deleteMessageById:f}=n.getState();try{await (null==r?void 0:r.conversations.messages.delete(a,h)),f(o),m&&d()}catch(e){console.error(e),Ym.error(bj.t("Delete_failed"))}finally{t.answerAction.unlock(p,"deleteMessageGroup")}}})(),d=i(e=>e.conversationId),{messageId:u,cozeApiMessageId:p,isShowDelete:h}=eqm(),m=(null==(r=l.ui)||null==(t=r.base)?void 0:t.layout)===fW.MOBILE?"custom":"hover";return p&&h&&u?(0,fU.jsx)($l,{trigger:m,content:bj.t("Delete"),children:(0,fU.jsx)(Yx,{"data-testid":"chat-area.answer-action.delete-message-button",disabled:s,size:"small",icon:(0,fU.jsx)(Zr,{className:yY()("coz-fg-hglt-red",a,"w-[14px] h-[14px]")}),onClick:()=>{c(d||"",u)},color:"secondary",...o})}):null},eqg=()=>{let{meta:e}=eIW(),{message:t}=eIW(),{readonly:r}=ej7();return e.isGroupLastMessage&&e.isFromLatestGroup&&(null==t?void 0:t.type)==="answer"||r?null:(0,fU.jsx)(eq_,{})},eq_=()=>{let e=(0,gt.useRef)(null),t=(0,gt.useRef)(null),{message:r}=eIW(),{showHoverText:a,isMultiMessage:o}=(()=>{let e,{meta:t,message:r}=eIW(),a="answer"===r.type&&(!t.isFromLatestGroup||!t.isGroupLastAnswerMessage),o=!1;if("question"===r.type||"ack"===r.type){if(ewD(r))e=r.content;else if((null==r?void 0:r.content_type)===eny.Mix){var i;let t=ej0(r.content);e=null==t?void 0:t.item_list.map(e=>"text"===e.type&&e.text||"").filter(e=>!!e).join("\n"),o=((null==t||null==(i=t.item_list)?void 0:i.length)||0)>1}}else a&&ewD(r)&&(e=r.content);return{showHoverText:e,isMultiMessage:o}})(),{isShowDelete:i,isNeedQuote:n}=eqm(),s=i||!!a,l="answer"===r.type&&!!a&&n,{width:c}=een(t)||{},d=(0,gt.useMemo)(()=>{var e,r;let a=null==(r=t.current)||null==(e=r.closest(".coze-chat-hover-message-wrapper"))?void 0:e.clientWidth;return a&&o?(a+=44,c&&a&&c>a?c-a:0):0},[c]);return s?(console.log("actionBarSize:",{actionBarSize:c,actionBarLeft:d}),(0,fU.jsxs)(fU.Fragment,{children:[(0,fU.jsx)("div",{className:yY()("w-full flex",o?"justify-start":"justify-end"),style:{},children:(0,fU.jsxs)(eqa,{style:{width:"fit-content",zIndex:2,position:"relative",left:d},ref:t,children:[a?(0,fU.jsx)(eql,{wrapperClass:"flex justify-center items-center",isUseExternalContent:!0,externalContent:a,isMustGroupLastAnswerMessage:!1}):null,i?(0,fU.jsx)(eqf,{}):null,l?(0,fU.jsx)(eqd,{}):null]})}),(0,fU.jsx)("div",{ref:e,style:{width:0,height:0,position:"relative"}})]})):null},eqb=()=>{let{lastMessageText:e}=(()=>{let{groupId:e}=eIW(),{useMessagesStore:t}=ey3(),r=t(e=>e.messageGroupList,enB),a=t(e=>e.messages,enB),o=t(e=>e.findMessage,enB);return{lastMessageText:(0,gt.useMemo)(()=>{let t=r.find(t=>t.groupId===e);return null==t?void 0:t.memberSet.llmAnswerMessageIdList.map(e=>{let t=o(e);return ewD(t)?t.content:""}).filter(e=>!!e).reverse().join("\n")},[r,a,o,e])}})(),t=ej9(),{isShowDelete:r,isNeedQuote:a}=eqm(),o=t?"!coz-fg-images-white":"";return e||r?(0,fU.jsx)(eV9,{leftContent:[!!e&&(0,fU.jsx)(eql,{className:o,isUseExternalContent:!0,externalContent:e},"copy"),r&&(0,fU.jsx)(eqf,{className:yY()(o)},"delete"),!!e&&a&&(0,fU.jsx)(eqd,{className:yY()(o)})],rightContent:[]}):null},eqv=e=>{let{refreshContainerWidth:t}=e,{meta:r}=eIW(),{message:a}=eIW(),{useWaitingStore:o}=ey3(),{readonly:i}=ej7(),n=o(e=>!!e.waiting),s="answer"===a.type,l=r.isGroupLastMessage&&r.isFromLatestGroup;return((0,gt.useEffect)(()=>{t()},[]),!l||!s||n||i)?null:(0,fU.jsx)(eqb,{})};var eqy=i(46146),eqT={};eqT.styleTagTransform=yj(),eqT.setAttributes=yB(),eqT.insert=yI().bind(null,"head"),eqT.domAPI=yO(),eqT.insertStyleElement=yH(),yC()(eqy.A,eqT);let eqk=eqy.A&&eqy.A.locals?eqy.A.locals:void 0,eqw=e=>{let{messageType:t,classname:r,showUserInfo:a,...o}=e;return(0,fU.jsx)(ev$,{...o,classname:yY()(r,"w-full"),showUserInfo:a??!1,isHoverShowUserInfo:!1,messageBoxWrapperClassname:yY()("coze-chat-message-wrapper",eqk["message-box-wrapper"]),messageHoverWrapperClassName:"w-full flex justify-end right-[0px] coze-chat-hover-message-wrapper"})};function eqQ(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class eqx extends ejo{static createCustomComponents(e){let t;return{UIKitMessageBoxPlugin:(console.log("[createUIKitMessageBoxPlugin] bizContext:",{showUserInfo:t=e.showUserInfo,bizContext:e}),e=>{let{messageType:r,classname:a,showUserInfo:o,...i}=e,n=void 0!==t?t:o??!1;return console.log("[UIKitMessageBoxPlugin] render:",{configuredShowUserInfo:t,propsShowUserInfo:o,finalShowUserInfo:n}),(0,fU.jsx)(ev$,{...i,classname:yY()(a,"w-full"),showUserInfo:n,isHoverShowUserInfo:!1,messageBoxWrapperClassname:yY()("coze-chat-message-wrapper",eqk["message-box-wrapper"]),messageHoverWrapperClassName:"w-full flex justify-end right-[0px] coze-chat-hover-message-wrapper"})}),MessageGroupFooter:eV6,MessageBoxFooter:eqv,MessageBoxHoverSlot:eqg}}constructor(...e){super(...e),eqQ(this,"pluginMode",eFp.Writeable),eqQ(this,"pluginName",eji.WebsdkChatCozeSdkPlugin),eqQ(this,"lifeCycleServices",ejn(this,eV4)),eqQ(this,"customComponents",{UIKitMessageBoxPlugin:eqw,MessageGroupFooter:eV6,MessageBoxFooter:eqv,MessageBoxHoverSlot:eqg})}}var eqz=((eU={}).OnBackgroundChange="onBackgroundChange",eU),eqA=i(17684),eqE={};eqE.styleTagTransform=yj(),eqE.setAttributes=yB(),eqE.insert=yI().bind(null,"head"),eqE.domAPI=yO(),eqE.insertStyleElement=yH(),yC()(eqA.A,eqE);let eqD=eqA.A&&eqA.A.locals?eqA.A.locals:void 0,eqS=e=>{var t;let{headerNode:r}=e,{useChatBackgroundContext:a}=(e=>{let{usePluginStore:t}=ey3(),{pluginName:r}=ey5(),a=t(b7(t=>t.pluginInstanceList.find(t=>t.pluginName===(e??r))));if(!a)throw Error("cannot find target plugin");if(a.pluginMode===eFp.Readonly)return a;throw Error(`cannot find target readonly plugin, please confirm ${e} is readonly mode plugin`)})(eji.ChatBackground).pluginBizContext.storeSet,o=a(b7(e=>e.backgroundImageInfo));return(null==o||null==(t=o.mobile_background_image)?void 0:t.origin_image_url)?(0,fU.jsxs)(fU.Fragment,{children:[r?(0,fU.jsx)("div",{className:eqD.mask}):null,(0,fU.jsx)(eyM,{backgroundInfo:o})]}):null};function eqC(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let eqL=e=>({appLifeCycleService:{onBeforeInitial:()=>{let{chatBackgroundEvent:t,storeSet:r}=e.pluginBizContext,{setBackgroundInfo:a}=r.useChatBackgroundContext.getState();t.on(eqz.OnBackgroundChange,e=>{a(e)})},onAfterInitial:t=>{let{setBackgroundInfo:r,clearBackgroundStore:a}=e.pluginBizContext.storeSet.useChatBackgroundContext.getState(),o=t.messageListFromService.backgroundInfo;o?r(o):a()},onBeforeDestroy:()=>{let{chatBackgroundEvent:t}=e.pluginBizContext;t.all.clear()}}});class eqO extends eja{constructor(...e){super(...e),eqC(this,"pluginMode",eFp.Readonly),eqC(this,"pluginName",eji.ChatBackground),eqC(this,"lifeCycleServices",ejs(this,eqL)),eqC(this,"customComponents",{MessageListFloatSlot:eqS})}}let eqM=GR(),eqI=(0,gt.forwardRef)((e,t)=>{var r,a;let{children:o}=e,{chatConfig:i}=ej7(),{updateCurrentConversationInfo:n,currentConversationInfo:s,updateConversations:l,conversations:c}=ej8(b7(e=>({updateCurrentConversationInfo:e.updateCurrentConversationInfo,currentConversationInfo:e.currentConversationInfo,updateConversations:e.updateConversations,conversations:e.conversations}))),{useGlobalInitStore:d,useSectionIdStore:u}=ey3(),p=d(e=>e.setConversationId),h=d(e=>e.conversationId),m=u(e=>e.latestSectionId),f=d(e=>e.chatCore),g=WG((e,t)=>{var r,a;if((null==(a=i.ui)||null==(r=a.conversations)?void 0:r.isNeed)&&s){let r=Math.floor(Date.now()/1e3),a={id:e,last_section_id:t,updated_at:r,created_at:r,meta_data:{}};if(n({...s,...a}),c.find(t=>t.id===e)||l([a],"add"),p(e),null==f||f.updateConversationId(e),t){let{setLatestSectionId:e}=u.getState();e(t)}}else if(p(e),null==f||f.updateConversationId(e),t){let{setLatestSectionId:e}=u.getState();e(t)}}),_=WG(()=>h||""),b=WG(()=>m||""),v=(0,gt.useRef)(void 0),y=(0,gt.useRef)(void 0),T=(0,gt.useMemo)(()=>null==s?void 0:s.id,[null==s?void 0:s.id]),k=(0,gt.useMemo)(()=>null==s?void 0:s.last_section_id,[null==s?void 0:s.last_section_id]),w=WG((e,t)=>{if(e&&e!==t){let{setLatestSectionId:t}=u.getState();t(e)}}),Q=WG((e,t,r)=>{let a=void 0===r.prevIdRef.current&&void 0===r.prevSectionIdRef.current,o=!a&&e!==r.prevIdRef.current,i=!a&&t!==r.prevSectionIdRef.current;return a||o||i?(r.prevIdRef.current=e,r.prevSectionIdRef.current=t,!1):(r.prevIdRef.current=e,r.prevSectionIdRef.current=t,!0)}),x=WG((e,t,r)=>{r||p(e),null==f||f.updateConversationId(e),w(t,m)});(0,gt.useEffect)(()=>{var e,t;if(!T||!(null==(t=i.ui)||null==(e=t.conversations)?void 0:e.isNeed))return;let r=k||s.sectionId||"";w(r,m),Q(T,r,{prevIdRef:v,prevSectionIdRef:y})||T!==h&&x(T,r,""===h||null===h)},[T,k,h,m,p,f,null==(a=i.ui)||null==(r=a.conversations)?void 0:r.isNeed,w,Q,x,s]),(()=>{let e=(0,gt.useRef)(),{updateCurrentConversationNameByMessage:t,currentConversationInfo:r}=ej8(b7(e=>({updateCurrentConversationNameByMessage:e.updateCurrentConversationNameByMessage,currentConversationInfo:e.currentConversationInfo}))),{chatConfig:{type:a}}=ej7(),o=a===fZ.APP,{useMessagesStore:i}=ey3(),n=i(e=>e.messages,enB);(0,gt.useEffect)(()=>{o?e.current=null==r?void 0:r.title:e.current=null==r?void 0:r.name},[r,o]),(0,gt.useEffect)(()=>{let a=n[n.length-1],o=null==a?void 0:a.content.slice(0,100);a&&!e.current&&(null==r?void 0:r.id)&&""!==r.id.trim()&&(t(o),e.current=o)},[n,r,t])})();let z=(()=>{let e=eM5(),{useMessagesStore:t}=ey3();return async r=>{let{messageGroupList:a}=t.getState(),o=a.find(e=>{let{memberSet:t}=e;return t.userMessageId===r});if(!o)throw Error("regenerate message error: failed to get message");await e(o)}})();(0,gt.useImperativeHandle)(t,()=>({regenerateMessageByUserMessageId:z,setConversationId:g,getConversationId:_,getSectionId:b}),[z,g,_,b]);let A=(e=>{let{usePluginStore:t}=ey3(),r=t(b7(t=>t.pluginInstanceList.find(t=>t.pluginName===e)));return r?r.publicMethods:null})(eji.MessageGrab);return(0,gt.useEffect)(()=>{A&&A.updateEnableGrab(!0)},[]),(0,fU.jsx)(fU.Fragment,{children:o})}),eqP=e=>{var t,r,a,o,i;let{children:n,plugins:s}=e,l=(0,gt.useRef)(!1),{refreshToken:c}=eVM(),{initError:d,setInitError:u}=ej8(b7(e=>({initError:e.initError,setInitError:e.setInitError}))),p=(0,gt.useRef)(),{chatConfig:h,onImageClick:m,initErrorFallbackFC:f}=ej7(),g=eUc(),_=g&&g.id?g:{id:fK(),nickname:"",url:"",userUniqueName:"",userLabel:null};console.log("ChatProviderImpl: userInfo",{userInfo:_,hasId:!!(null==_?void 0:_.id)});let b=(()=>{var e;let{chatConfig:t,openRequestInit:r,defaultHistoryMessage:a=[],onDefaultHistoryClear:o}=ej7(),{cozeApiSdk:i}=eVM(),n=ej8(e=>e.setInitError),s=ej8(e=>e.setDefaultInputMode),l=ej8(e=>e.updateShortcuts),c=ej8(e=>e.setIsStartBotVoiceCall),d=ej8(e=>e.updateBackgroundInfo),{updateCurrentConversationInfo:u}=ej8(b7(e=>({updateCurrentConversationInfo:e.updateCurrentConversationInfo}))),p=(0,gt.useRef)(),h=(0,gt.useRef)([]);ej8(b7(e=>(p.current=e.currentConversationInfo,h.current=e.conversations,null)));let m=eVB(),f=(null==t||null==(e=t.auth)?void 0:e.connectorId)||"",{bot_id:g="",type:_,appInfo:b}=t,v=eUc();return(0,gt.useCallback)(async()=>{if(!i)return{};try{let{conversationId:e,sectionId:t,conversationName:n,botOnlineInfo:y}=await eVF({cozeApiSdk:i,openRequestInit:r})||{},[T,k]=await Promise.all([y||eVR({botId:g,cozeApiSdk:i,connectorId:f}),eVH({botId:g,cozeApiSdk:i,conversationId:e,sectionId:t,connectorId:f,onDefaultHistoryClear:o,defaultHistoryMessage:a,chatType:_,appInfo:b})]),w=(T.prologue||"").replaceAll("{{user_name}}",(null==v?void 0:v.nickname)||"");c(T.defaultInputMode===ej3.VoiceCall),s(T.defaultInputMode||ej3.Text),l(T.shortcuts||[]),console.log("requestDataBotInfo.shortcuts:",T.shortcuts),d(T.backgroundInfo),T.isCustomBackground&&(T.backgroundInfo=void 0),console.log("[result]2:",T);let Q=k.conversationId,x=k.lastSectionId||"",z=n||"",A=p.current,E=h.current;if(Q)if(A&&""===A.id)console.log("useRequestInit: Skipping currentConversationInfo update because id is empty (new conversation being created)",{actualConversationId:Q,currentConversationInfoId:A.id});else if(A&&A.id===Q){let e={};A.last_section_id!==x&&x&&(e.last_section_id=x),Object.keys(e).length>0&&u({...A,...e})}else{let e=E.find(e=>e.id===Q);e?u({...e,last_section_id:x||e.last_section_id||"",name:z||e.name||"",conversationListVisible:(null==A?void 0:A.conversationListVisible)??!1,isLargeWidth:(null==A?void 0:A.isLargeWidth)??!1}):A?u({...A,id:Q,last_section_id:x||A.last_section_id||"",name:z||A.name||""}):u({id:Q,last_section_id:x,name:z||"",created_at:Math.floor(Date.now()/1e3),updated_at:Math.floor(Date.now()/1e3),meta_data:{},conversationListVisible:!1,isLargeWidth:!1})}v&&v.id||console.error("useRequestInit: userInfo is invalid",{userInfo:v});let D=(null==v?void 0:v.id)?{[v.id]:v}:void 0;return console.log("useRequestInit: returning userInfoMap",{userInfo:v,userInfoMap:D,hasUserId:!!(null==v?void 0:v.id)}),{...T,...k,prologue:w,messageList:m(k.conversationId||"",k.messageList),userInfoMap:D}}catch(t){console.error("useRequestInit error",t);let{code:e}=t||{};e?n({code:e,msg:""}):n({code:-1,msg:""})}},[g,i,a,o,_,b,u,v,r])})(),v=(e=>{let{refChatFunc:t}=e,{chatConfig:r}=ej7(),{tokenManager:a}=eVM(),o=(e=>{let{refChatFunc:t}=e,r=eUc(),{refreshToken:a}=eVM(),{apiUrl:o}=ej8(b7(e=>({apiUrl:e.apiUrl}))),i=(()=>{let{chatConfig:{type:e}}=ej7();return(0,gt.useMemo)(()=>{let t=e===fZ.APP,r=[e=>{let{data:t}=e,{code:r,data:a}=t;return{...e,data:{code:r,new_section_id:a.id}}}];return{url:t?"/v1/workflow/conversations/:conversation_id/clear":"/v1/conversations/:conversation_id/clear",hooks:{onBeforeRequest:[e=>{let r=e.data.conversation_id,a=t?`/v1/workflow/conversations/${r}/clear`:`/v1/conversations/${r}/clear`;return{...e,url:a,data:{conversation_id:r}}}],onErrorResponse:r,onAfterResponse:r}}},[e])})(),n=((e,t)=>{var r;let{debug:a,chatConfig:o}=ej7(),{shortcuts:i,apiUrl:n,updateConversations:s,updateCurrentConversationInfo:l,currentConversationInfo:c,conversations:d,cozeApi:u}=ej8(b7(e=>({shortcuts:e.shortcuts,apiUrl:e.apiUrl,updateConversations:e.updateConversations,updateCurrentConversationInfo:e.updateCurrentConversationInfo,currentConversationInfo:e.currentConversationInfo,conversations:e.conversations,cozeApi:e.cozeApi}))),{cozeApiSdk:p}=eVM(),h=(0,gt.useRef)(o),m=(0,gt.useRef)(""),f=(0,gt.useRef)(i),g=(0,gt.useRef)(s),_=(0,gt.useRef)(l),b=(0,gt.useRef)(c),v=(0,gt.useRef)(d),y=(0,gt.useRef)(null);f.current=i,m.current=(null==o||null==(r=o.auth)?void 0:r.connectorId)||"",h.current=o,g.current=s,_.current=l,b.current=c,v.current=d;let T=(0,gt.useRef)(null);T.current=e=>{let{conversation_id:t,updates:r,updated_at:a}=e;if(!t||!r)return;let o=b.current,i=g.current,n=_.current,{title:s}=r;if(void 0!==s){var l;i&&i([{id:t,name:s,title:s,updated_at:Math.floor(a/1e3)}],"update");let e=v.current.find(e=>e.id===t),r=(null==o?void 0:o.id)===t,c=(null==(l=y.current)?void 0:l.conversationId)===t;if(r||c){if(o)(o.title!==s||o.name!==s)&&n({...o,name:s,title:s,updated_at:Math.floor(a/1e3)});else if(e)n({...e,name:s,title:s,updated_at:Math.floor(a/1e3),conversationListVisible:!1,isLargeWidth:!1});else if(c&&y.current){let e=y.current,t=b.current;n({id:e.conversationId,last_section_id:e.sectionId,name:s,title:s,created_at:Math.floor(Date.now()/1e3),updated_at:Math.floor(a/1e3),meta_data:{},conversationListVisible:(null==t?void 0:t.conversationListVisible)??!1,isLargeWidth:(null==t?void 0:t.isLargeWidth)??!1})}}}};let k=n||f1;return{url:"/v3/chat",hooks:{onBeforeSendMessage:[async t=>{var r,o,i,n,s,l;console.log("onBeforeSendMessage: Hook called",{originalUrl:t.url,originalBody:null==(r=t.body)?void 0:r.substring(0,200),headers:t.headers});let c=ej0(t.body)||{},d=c.conversation_id||"";if(console.log("onBeforeSendMessage: Initial conversationId",d,{hasCozeApi:!!u,hasChatConfig:!!h.current}),!d){let e=u||p;if(!e)throw console.error("onBeforeSendMessage: cozeApi is not available, cannot create conversation",{cozeApiFromStore:!!u,cozeApiSdkFromContext:!!p}),Error("cozeApi is required for creating conversation before sending message");if(!h.current)throw console.error("onBeforeSendMessage: refChatConfig.current is not available, cannot create conversation"),Error("chatConfig is required for creating conversation before sending message");try{let t=h.current.type===fZ.APP,{appInfo:r}=h.current,a=h.current.bot_id;if(t&&!(null==r?void 0:r.appId)||!t&&!a)throw Error(`Missing required ID: ${t?"appId":"botId"}`);console.log("onBeforeSendMessage: Creating conversation...");let o=await eVN(e,{projectType:t?"app":"bot",projectId:t?(null==r?void 0:r.appId)||"":a||"",workflowId:null==r?void 0:r.workflowId,mode:(null==r?void 0:r.draft_mode)?"draft":"release",connectorId:m.current});if(console.log("onBeforeSendMessage: Conversation created",{conversationId:o.conversationId,sectionId:o.sectionId,conversationName:o.conversationName}),!o.conversationId)throw Error("Failed to create conversation: empty conversationId");if(d=o.conversationId,y.current={conversationId:o.conversationId,sectionId:o.sectionId||"",conversationName:o.conversationName},!v.current.find(e=>e.id===o.conversationId)&&g.current){let e={id:o.conversationId,last_section_id:o.sectionId||"",name:o.conversationName||"",created_at:Math.floor(Date.now()/1e3),updated_at:Math.floor(Date.now()/1e3),meta_data:{},...t&&{title:""}};g.current([e],"add"),console.log("onBeforeSendMessage: Conversation added to list immediately",{conversationId:o.conversationId,conversationName:o.conversationName})}console.log("onBeforeSendMessage: Conversation created, will update currentConversationInfo after stream completes",{conversationId:o.conversationId}),y&&(y.current={conversationId:o.conversationId,sectionId:o.sectionId||""}),c.conversation_id=d,console.log("onBeforeSendMessage: Conversation created and selected, ready to send message",{conversationId:d,pendingInfo:y.current})}catch(e){throw console.error("Failed to create conversation:",e),Error(`Failed to create conversation before sending message: ${e instanceof Error?e.message:String(e)}`)}}if(!d||""===d.trim())throw console.error("onBeforeSendMessage: conversationId is empty after creation"),Error("conversationId is required for sending message");let _=`${k}/v1/workflows/chat?conversation_id=${d}`,b=(null==(o=h.current)?void 0:o.type)===fZ.APP?null==(i=h.current.appInfo)?void 0:i.parameters:null==(n=h.current.botInfo)?void 0:n.parameters,T=JSON.stringify({...ej0(t.body),conversation_id:d}),w=eVV.convertRequestBody({body:T,userInfo:e,connectorId:m.current,parameters:b,shortcuts:f.current});console.log("onBeforeSendMessage: Final config",{url:_,conversationId:d,hasBody:!!w,bodyLength:null==w?void 0:w.length}),Object.keys((null==a?void 0:a.cozeApiRequestHeader)||{}).forEach(e=>{var r;t.headers.push([e,(null==a||null==(r=a.cozeApiRequestHeader)?void 0:r[e])||""])}),t.headers.push(["Accept-Language","zh-CN"===bj.language?"zh":"en"]);let Q={...t,body:w,url:_,method:t.method||"POST",headers:t.headers||[]};return console.log("onBeforeSendMessage: Returning config",{url:Q.url,conversationId:d,hasBody:!!Q.body,bodyLength:null==(s=Q.body)?void 0:s.length,method:Q.method,headersCount:(null==(l=Q.headers)?void 0:l.length)||0,headers:Q.headers}),Q}],onGetMessageStreamParser:r=>{var a;let o=eV2.getMessageParser({requestMessageRawBody:r,userInfo:e,sectionId:null==t||null==(a=t.current)?void 0:a.getSectionId(),onConversationUpdate:T.current||void 0});if(y.current&&o){let e=!1,r=!1,a=y.current;return(i,n)=>{if(!o)return;let s=o(i,n),{type:l,event:c}=i;if("event"===l&&"conversation.chat.created"===c&&!e&&a.conversationId&&(e=!0,console.log("onGetMessageStreamParser: Updating conversation list and currentConversationInfo after CHAT_CREATED",{conversationId:a.conversationId}),!v.current.find(e=>e.id===a.conversationId))){let e=h.current.type===fZ.APP,t={id:a.conversationId,last_section_id:a.sectionId,name:a.conversationName||"",created_at:Math.floor(Date.now()/1e3),updated_at:Math.floor(Date.now()/1e3),meta_data:{},...e&&a.conversationName&&{title:a.conversationName}};g.current&&g.current([t],"add")}if("event"===l&&"done"===c&&!r&&a.conversationId){var d;if(r=!0,console.log("onGetMessageStreamParser: Updating currentConversationInfo and chatCore after stream done",{conversationId:a.conversationId}),(null==(d=b.current)?void 0:d.id)===a.conversationId)return console.log("onGetMessageStreamParser: Conversation ID already matches, only updating chatCore",{conversationId:a.conversationId}),(null==t?void 0:t.current)&&t.current.setConversationId(a.conversationId,a.sectionId),y.current=null,s;setTimeout(()=>{if(_.current){let e=b.current;_.current({id:a.conversationId,last_section_id:a.sectionId,name:"",created_at:Math.floor(Date.now()/1e3),updated_at:Math.floor(Date.now()/1e3),meta_data:{},conversationListVisible:(null==e?void 0:e.conversationListVisible)??!1,isLargeWidth:(null==e?void 0:e.isLargeWidth)??!1})}(null==t?void 0:t.current)&&t.current.setConversationId(a.conversationId,a.sectionId),y.current=null},0)}return s}}return o}}}})(r||void 0,t),s=(e=>{var t;let{refChatFunc:r}=e,{chatConfig:a}=ej7(),o=(0,gt.useRef)("");return o.current=(null==a||null==(t=a.auth)?void 0:t.connectorId)||"",(0,gt.useMemo)(()=>{let e=[e=>{var t;let{data:a}=e,{code:o,data:i}=a,{id:n,last_section_id:s}=i||{};return null==r||null==(t=r.current)||t.setConversationId(n,s),{...e,data:{code:o,new_section_id:s}}}];return{url:"/v1/workflow/conversation/create",method:"POST",hooks:{onBeforeRequest:[e=>{let t=e.data.bot_id;return{...e,data:{bot_id:t,connector_id:o.current}}}],onErrorResponse:e,onAfterResponse:e}}},[])})({refChatFunc:t}),l=(()=>{let{debug:e}=ej7();return[t=>(t.headers.delete("x-requested-with"),Object.keys((null==e?void 0:e.cozeApiRequestHeader)||{}).forEach(r=>{var a;t.headers.set(r,(null==e||null==(a=e.cozeApiRequestHeader)?void 0:a[r])||"")}),t)]})(),c=(0,gt.useMemo)(()=>[async e=>eV3(e,a),e=>e.config.url&&/^\/v1\/conversations\/[^\\]+\/clear$/.test(e.config.url)?{...e,config:{...e.config,url:"/v1/conversations/:conversation_id/clear"}}:e],[a]),d=(0,gt.useMemo)(()=>[async e=>eV3(e,a)],[a]),u=(()=>{let e=eVB(),{chatConfig:t}=ej7(),{bot_id:r}=t||{},{refMessageListLeft:a}=eVM();return(0,gt.useMemo)(()=>{let t=[t=>{var o,i,n,s,l,c;let{data:d}=t,u=null==(i=t.config)||null==(o=i.params)?void 0:o.conversation_id,p=(null==a||null==(n=a.current)?void 0:n[u])||[],h=null==(s=p[p.length-1])?void 0:s.reply_id;h&&((null==(l=d.data)?void 0:l[0].type)!=="question"||(null==(c=d.message_list)?void 0:c[0].chatId)||(d.data[0].chat_id=h));let m=eVP.convertMessageListResponse(d,r);return{...t,data:{...m,message_list:e(u,m.message_list)}}}];return{url:"/v1/conversation/message/list",hooks:{onBeforeRequest:[e=>{let t=e.data.conversation_id,r={after_id:e.data.cursor,limit:e.data.count};return{...e,data:r,params:{conversation_id:t}}}],onErrorResponse:t,onAfterResponse:t}}},[r])})(),{requestManagerOptions:p}=ej7(),h=(0,gt.useMemo)(()=>({url:"/v3/chat/cancel",method:"POST",hooks:{onBeforeRequest:[e=>{let t=e.data.conversation_id,r=e.data.query_message_id;return{...e,data:{conversation_id:t,chat_id:r}}}]}}),[]),m=o||f1;return(0,gt.useMemo)(()=>enr({baseURL:m,scenes:{[eni.SendMessage]:n,[eni.ClearMessageContext]:i,[eni.ClearHistory]:s,[eni.GetMessage]:u,[eni.BreakMessage]:h},hooks:{onBeforeRequest:l,onAfterResponse:c,onErrorResponse:d}},p,(e,t)=>{if(va(e))return e.concat(t)}),[m,n,i,s,l,c])})({refChatFunc:t});return(0,gt.useMemo)(()=>({env:"thirdPart",biz:"third_part",deployVersion:"inhouse",requestManagerOptions:o,tokenManager:a}),[r])})({refChatFunc:p}),{GrabPlugin:y}=(e=>{let{onQuote:t,scene:r="other"}=e??{},[a,o]=(0,gt.useState)(!0),{grabPlugin:i,grabPluginId:n}=(0,gt.useMemo)(()=>(e=>{let{preference:t,onQuote:r,onQuoteChange:a,scene:o}=e,i=fK();return{grabPlugin:{createPluginBizContext:()=>{let e={onQuote:r,onQuoteChange:a},n={useSelectionStore:gs()(f5((e,t)=>({humanizedContentText:"",originContentText:"",normalizeSelectionNodeList:[],selectionData:null,isFloatMenuVisible:!1,floatMenuPosition:null,updateHumanizedContentText:t=>{e({humanizedContentText:t})},updateOriginContentText:t=>{e({originContentText:t})},updateNormalizeSelectionNodeList:t=>{e({normalizeSelectionNodeList:t})},updateIsFloatMenuVisible:t=>{e({isFloatMenuVisible:t})},updateSelectionData:t=>{e({selectionData:t})},updateFloatMenuPosition:t=>{e({floatMenuPosition:t})},clearStore:()=>{e({humanizedContentText:"",originContentText:"",normalizeSelectionNodeList:[],selectionData:null})}}),{name:"botStudio.ChatAreaGrabPlugin.SelectionStore.plugin",enabled:!1})),useQuoteStore:gs()(f5(f8(e=>({quoteContent:null,quoteVisible:!1,quoteContentMap:{},updateQuoteContent:t=>{e({quoteContent:t})},updateQuoteContentMapByImmer:t=>{e(gG(e=>t(e.quoteContentMap)))},updateQuoteVisible:t=>{e({quoteVisible:t})},clearStore:()=>{e({quoteContent:null,quoteVisible:!1})}})),{name:"botStudio.ChatAreaGrabPlugin.Quote.plugin",enabled:!1})),usePreferenceStore:gs()(f5(f8(e=>({enableGrab:!1,updateEnableGrab:t=>{e({enableGrab:t})}})),{name:"botStudio.ChatAreaGrabPlugin.Preference.plugin",enabled:!1}))},s=GR();n.usePreferenceStore.getState().updateEnableGrab(t.enableGrab);let l=((e,t)=>{let{useQuoteStore:r}=e;return r.subscribe(e=>e.quoteContent,e=>{let{onQuoteChange:r}=t;null==r||r({isEmpty:!e})})})({useQuoteStore:n.useQuoteStore},e);return{grabPluginId:i,storeSet:n,eventCallbacks:e,unsubscribe:()=>{l()},eventCenter:s,publicEventCenter:eUi,scene:o}},Plugin:eUo},grabPluginId:i}})({preference:{enableGrab:!0},onQuote:t,onQuoteChange:e=>{let{isEmpty:t}=e;o(t)},scene:r}),[]);return{grabEnableUpload:a,GrabPlugin:i,grabPluginId:n}})({scene:"store"}),T=(()=>{let{cozeApiSdk:e}=eVM();return(0,gt.useCallback)(async t=>{let{file:r}=t,a=await (null==e?void 0:e.files.upload({file:r})),o=(null==a?void 0:a.data)||a,i=(null==o?void 0:o.uri)||"",n=(null==o?void 0:o.id)||(null==a?void 0:a.id)||"";return{uri:i||n,url:(null==o?void 0:o.url)||(null==a?void 0:a.url)||"",id:n||void 0}},[e])})(),k=ej9(),{ChatBackgroundPlugin:w}=(()=>{let{ChatBackgroundPlugin:e,chatBackgroundEvent:t}=(0,gt.useMemo)(()=>{let e;return e=gs()(f5(e=>({backgroundImageInfo:{mobile_background_image:{},web_background_image:{}},clearBackgroundStore:()=>e({backgroundImageInfo:{mobile_background_image:{},web_background_image:{}}},!1,"clearBackgroundStore"),setBackgroundInfo:t=>{e({backgroundImageInfo:t},!1,"setBackgroundInfo")}}),{name:"botStudio.ChatBackground.chatBackground",enabled:!1})),{ChatBackgroundPlugin:{createPluginBizContext:()=>({storeSet:{useChatBackgroundContext:e},chatBackgroundEvent:eqM}),Plugin:eqO},chatBackgroundEvent:eqM}},[]),{isCustomBackground:r}=ej7(),a=ej8(e=>e.backgroundInfo),o=r?void 0:a;return(0,gt.useEffect)(()=>{t.emit(eqz.OnBackgroundChange,o||{mobile_background_image:{},web_background_image:{}})},[o]),{ChatBackgroundPlugin:e}})(),Q=null==h||null==(t=h.ui)?void 0:t.showUserInfo;console.log("[ChatProviderImpl] showUserInfo config:",{showUserInfoConfig:Q,chatConfigUi:null==h?void 0:h.ui,finalValue:Q??!1});let x=(i={refreshToken:c,regenerateMessageByUserMessageId:e=>{var t,r;null==(r=p.current)||null==(t=r.regenerateMessageByUserMessageId)||t.call(r,e)},showUserInfo:Q??!1},{createPluginBizContext:()=>({...i}),Plugin:class extends eqx{constructor(...e){super(...e),function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"customComponents",eqx.createCustomComponents(i))}}}),z=(0,gt.useMemo)(()=>{var e;return(e=>{let{botId:t,source:r,token:a,uploadFile:o}=e;return class{start(){}on(e,t){this.eventBus.on(e,t)}pause(){}cancel(){}async upload(){return this.eventBus.emit("ready",{percent:0,status:ekT.Uploading}),await o({source:r,botId:t,file:this.file,token:a,onProgress:e=>{this.eventBus.emit("progress",{percent:e,status:ekT.Uploading})}})}constructor(e){eUn(this,"file",void 0),eUn(this,"fileType",void 0),eUn(this,"eventBus",new(b9())),eUn(this,"userId",void 0),eUn(this,"abortController",void 0),this.file=e.file,this.fileType=e.type,this.upload().then(e=>{let t={Uri:e.uri,Url:e.url};e.id&&(t.Id=e.id),this.eventBus.emit("complete",{percent:100,status:ekT.Success,uploadResult:t,type:"success"})}).catch(e=>{this.eventBus.emit("error")})}}})({botId:h.type===fZ.APP&&(null==(e=h.appInfo)?void 0:e.appId)?h.appInfo.appId:h.bot_id||"",source:h.source,uploadFile:T})},[h,T]);if((0,gt.useEffect)(()=>{!d||l.current||(async()=>{try{bG(d.code)&&(await (null==c?void 0:c()),u(!1))}catch(e){console.error(e)}l.current=!0})()},[d]),d)return f?(0,fU.jsx)(f,{error:!0===d?null:d,refresh:async()=>{bG(d.code)?(await (null==c?void 0:c()),u(!1)):location.reload()}}):null;let A=h.type===fZ.APP&&(null==(r=h.appInfo)?void 0:r.appId)?h.appInfo.appId:h.bot_id;return(0,fU.jsx)(eF1,{botId:A,userInfo:_,scene:esl.OpenAipSdk,reporter:eUl,requestToInit:b,enableChatActionLock:!0,createChatCoreOverrideConfig:v,eventCallback:{onImageClick:m,onInitSuccess:()=>{l.current=!1},onCopyUpload:e=>{let t,{message:r,extra:{fileIndex:a}}=e;if((t=r.content_obj)&&"file_list"in t){var o;ed_()((null==(o=r.content_obj.file_list[a??0])?void 0:o.file_key)??""),eOZ.success({content:bj.t("copy_success")??"Copy Successfully"})}}},configs:{showFunctionCallDetail:!1,uploadPlugin:z,ignoreMessageConfigList:ew_,isShowFunctionCallBox:(null==h||null==(o=h.ui)||null==(a=o.chatBot)?void 0:a.isNeedFunctionCallMessage)??!0},pluginRegistryList:[x,eNs,w,y,...s||[]],showBackground:k,enableDragUpload:!1,children:(0,fU.jsx)(eqI,{ref:p,children:n})})},eqB=e=>{let{children:t,plugins:r}=e;return(0,fU.jsx)(eVO,{children:(0,fU.jsx)(eqP,{plugins:r,children:t})})},eqR=e=>{var t,r;let{children:a,plugins:o}=e,{chatConfig:i,onImageClick:n,onThemeChange:s}=ej7(),l=ej8(e=>e.setInitError),c=(r={onImageClick:n,onInitialError:()=>{l(!0)},extraBody:null==(t=i.extra)?void 0:t.webChat},{createPluginBizContext:()=>({...r}),Plugin:eNa}),d=eNe();return(0,gt.useEffect)(()=>{null==s||s(d)},[d]),(0,fU.jsx)(eqB,{plugins:[c,...o||[]],children:a})},eqH=e=>{let{children:t,plugins:r,...a}=e;return(0,fU.jsx)(ej5,{appProps:a,children:(0,fU.jsx)(eqR,{plugins:r,children:t})})},eqF=e=>{let{children:t}=e;return(0,fU.jsx)("div",{className:"overflow-hidden w-full min-w-[282px] max-w-[546px] p-[16px] coz-bg-primary",children:t})},eqj=e=>{var t,r,a;let{data:o,onCardSendMsg:i,readonly:n,isDisable:s,message:l}=e,c=n||s;return(0,fU.jsx)(eqF,{children:(0,fU.jsxs)(AA,{className:"w-full",vertical:!0,spacing:12,align:"start",children:[(0,fU.jsx)(erN.Text,{ellipsis:!0,className:"text-18px",children:null==(t=o.question_card_data)?void 0:t.Title}),(0,fU.jsx)(AA,{className:"w-full",vertical:!0,spacing:16,children:null==(a=o.question_card_data)||null==(r=a.Options)?void 0:r.map((e,t)=>(0,fU.jsx)(Xg,{className:"w-full",color:"primary",disabled:c,onClick:()=>null==i?void 0:i({message:l,extra:{msg:e.name,mentionList:[]}}),children:e.name},e.name+t))})]})})},eqN=e=>{var t;let{data:r,onCardSendMsg:a,readonly:o,isDisable:i,message:n}=e,[s,l]=(0,gt.useState)({}),[c,d]=(0,gt.useState)(!1),u=o||i||c;return(0,fU.jsx)(eqF,{children:(0,fU.jsxs)(AA,{spacing:12,vertical:!0,className:"w-full",children:[null==(t=r.input_card_data)?void 0:t.map((e,t)=>(0,fU.jsxs)(AA,{align:"start",className:"w-full",spacing:6,vertical:!0,children:[(0,fU.jsx)(erN.Text,{ellipsis:!0,className:"text-lg !font-medium",children:null==e?void 0:e.name}),(0,fU.jsx)(Jz,{disabled:u||c,value:s[e.name],onChange:t=>{l(gG(r=>{r[e.name]=t}))}})]},(null==e?void 0:e.name)+t)),(0,fU.jsx)(Xg,{className:"w-full",disabled:u,onClick:()=>{var e;u||(d(!0),null==a||a({message:n,extra:{msg:(null==(e=r.input_card_data)?void 0:e.map(e=>`${e.name}:${s[e.name]||""}`).join("\n"))||"",mentionList:n.sender_id?[{id:n.sender_id}]:[]}}))},children:bj.t("workflow_detail_title_testrun_submit")})]})})},eqU=(0,gt.memo)(e=>{let{message:t,...r}=e,a=(0,gt.useMemo)(()=>(e=>{if("card"===e.content_type){var t;let r=ebw(e.content),a=null==r||null==(t=r.x_properties)?void 0:t.workflow_card_info;if(a){let e=ebw(a);if((null==e?void 0:e.card_type)==="QUESTION"&&(null==e?void 0:e.question_card_data)||(null==e?void 0:e.card_type)==="INPUT"&&(null==e?void 0:e.input_card_data))return e}}})(t),[t]);return a?"INPUT"===a.card_type?(0,fU.jsx)(eqN,{data:a,message:t,...r}):"QUESTION"===a.card_type?(0,fU.jsx)(eqj,{data:a,message:t,...r}):"content type is not supported":null},(e,t)=>enB(Yc(e,vk),Yc(t,vk))),eqV=e=>{let t=ey4("TextMessageInnerTopSlot"),r=[{rule:e=>{var t,r;let{contentType:a,contentConfigs:o}=e,i=void 0===(r=null==o||null==(t=o[GB.CARD])?void 0:t.enable)||r;return a===eny.Card&&i},render:e=>{let{message:t,eventCallbacks:r,options:a}=e,{isCardDisabled:o,readonly:i}=a,{onCardSendMsg:n}=r??{};return(0,fU.jsx)(eqU,{message:t,onCardSendMsg:n,readonly:i,isDisable:o})}}];return(0,fU.jsx)(evC,{enhancedContentConfigList:r,multimodalTextContentAddonTop:(0,fU.jsx)(fU.Fragment,{children:t.map((t,r)=>{let{pluginName:a,Component:o}=t;return(0,fU.jsx)(ey7,{pluginName:a,children:(0,fU.jsx)(o,{message:e.message},r)},a)})}),...e})},eqq=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,{alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",length:a=10}=t||{},o=((e,t=21)=>{var r;let a,o;return r=t,o=-~(1.6*(a=(2<<Math.log(e.length-1)/Math.LN2)-1)*r/e.length),(t=r)=>{let i="";for(;;){let r=fG(o),n=o;for(;n--;)if((i+=e[r[n]&a]||"").length===t)return i}}})(r,a);return`${e}${o()}`},eqG=[{type:eTu.UploadImage,label:bj.t("shortcut_modal_upload_component_file_format_img"),icon:eyZ},{type:eTu.UploadTable,label:bj.t("shortcut_modal_upload_component_file_format_table"),icon:eb4},{type:eTu.UploadDoc,label:bj.t("shortcut_modal_upload_component_file_format_doc"),icon:evo},{type:eTu.UploadAudio,label:bj.t("shortcut_modal_upload_component_file_format_audio"),icon:evp},{type:eTu.CODE,label:bj.t("shortcut_modal_upload_component_file_format_code"),icon:evd},{type:eTu.ARCHIVE,label:bj.t("shortcut_modal_upload_component_file_format_zip"),icon:eyW},{type:eTu.PPT,label:bj.t("shortcut_modal_upload_component_file_format_ppt"),icon:eve},{type:eTu.VIDEO,label:bj.t("shortcut_modal_upload_component_file_format_video"),icon:eb5},{type:eTu.TXT,label:bj.t("shortcut_modal_upload_component_file_format_txt"),icon:eb8}],eqK={[Gq.IMAGE]:eTu.UploadImage,[Gq.AUDIO]:eTu.UploadAudio,[Gq.PDF]:eTu.UploadDoc,[Gq.DOCX]:eTu.UploadDoc,[Gq.EXCEL]:eTu.UploadTable,[Gq.CSV]:eTu.UploadTable,[Gq.VIDEO]:eTu.VIDEO,[Gq.PPT]:eTu.PPT,[Gq.TXT]:eTu.TXT,[Gq.ARCHIVE]:eTu.ARCHIVE,[Gq.CODE]:eTu.CODE,[Gq.DEFAULT_UNKNOWN]:eTu.UploadDoc},eqW=GG.reduce((e,t)=>{let r=eqK[t.fileType];if(r){let a=e[r];a?e[r]=`${a},${t.accept.join(",")}`:e[r]=t.accept.join(",")}return e},{});var eqZ=((eV={}).SLOT="slot",eV.WORKSPACE_SLOT="workspaceSlot",eV.EXPRESSION="expression",eV.ACTION="action",eV),eqX=((eq={}).EXPRESSION="expression",eq);let eqY=e=>({id:e.name??eqq(),name:"FlowpdCiciComponentsUpload",type:"@flowpd/cici-components/Upload",props:{name:e.name,description:e.description,maxSize:(e.input_type===eTu.UploadImage,512e3),inputType:e.input_type,accept:(e=>{let{input_type:t,upload_options:r}=e;var a=t===eTu.MixUpload?r??[]:t?[t]:[];let o=[];for(let e of a){if(!e)continue;let t=eqW[e];t&&o.push(...t.split(","))}return o.join(",")})(e),rules:[{required:!0}],noErrorMessage:!0}}),eq$=e=>({id:eqq(),name:"FlowpdCiciComponentsColumnLayout",type:"@flowpd/cici-components/ColumnLayout",props:{Columns:e.map(e=>({children:[e.id],config:{vertical:"top",weight:1,width:"weighted"},type:"slot"})),action:"enableUrl",backgroundColor:"transparent",enableClickEvent:!1}}),eqJ={[eTu.TextInput]:e=>({id:e.name??eqq(),name:"FlowpdCiciComponentsInput",type:"@flowpd/cici-components/Input",props:{name:e.name,description:e.description,defaultValue:e.default_value,rules:[],noErrorMessage:!0}}),[eTu.Select]:e=>{var t;return{id:e.name??eqq(),name:"FlowpdCiciComponentsSelect",type:"@flowpd/cici-components/Select",props:{name:e.name,description:e.description,defaultValue:e.default_value,optionList:null==(t=e.options)?void 0:t.map(e=>({label:e,value:e})),rules:[{required:!0}],noErrorMessage:!0}}},[eTu.UploadImage]:eqY,[eTu.UploadDoc]:eqY,[eTu.UploadTable]:eqY,[eTu.UploadAudio]:eqY,[eTu.MixUpload]:eqY,[eTu.PPT]:eqY,[eTu.ARCHIVE]:eqY,[eTu.CODE]:eqY,[eTu.TXT]:eqY,[eTu.VIDEO]:eqY},eq1=e=>void 0!==e.input_type?eqJ[e.input_type](e):{id:eqq(),name:"FlowpdCiciComponentsFormItemPlaceholder",type:"@flowpd/cici-components/Placeholder"},eq0=e=>{var t;if((null==e?void 0:e.send_type)!==eTp.SendTypePanel)return!1;let{tool_params_list:r,tool_name:a}=(null==e?void 0:e.tool_info)??{};return a?!!(null==r?void 0:r.length)&&r.every(e=>!e.refer_component):!!(null==e||null==(t=e.components_list)?void 0:t.length)&&e.components_list.every(e=>e.hide)};var eq2=i(95838),eq3={};eq3.styleTagTransform=yj(),eq3.setAttributes=yB(),eq3.insert=yI().bind(null,"head"),eq3.domAPI=yO(),eq3.insertStyleElement=yH(),yC()(eq2.A,eq3);let eq4=eq2.A&&eq2.A.locals?eq2.A.locals:void 0,eq6=(0,gt.forwardRef)((e,t)=>{let{className:r,wrapperClass:a,iconSize:o="default",...i}=e;return(0,fU.jsx)("div",{className:yY()(eq4["icon-button"],eq4[`icon-button-${o}`],a),children:(0,fU.jsx)(xD,{ref:t,className:yY()(r),...i,size:"small",theme:"borderless"})})}),eq5=(0,gt.createContext)({isSendMessageLock:!1});var eq7=i(76138),eq8={};eq8.styleTagTransform=yj(),eq8.setAttributes=yB(),eq8.insert=yI().bind(null,"head"),eq8.domAPI=yO(),eq8.insertStyleElement=yH(),yC()(eq7.A,eq8);let eq9=eq7.A&&eq7.A.locals?eq7.A.locals:void 0,eGe=(0,gt.forwardRef)((e,t)=>{let{className:r,...a}=e;return(0,fU.jsx)(Qr,{className:yY()(r,eq9["ui-input"]),...a,ref:t})});var eGt=i(75347),eGr={};eGr.styleTagTransform=yj(),eGr.setAttributes=yB(),eGr.insert=yI().bind(null,"head"),eGr.domAPI=yO(),eGr.insertStyleElement=yH(),yC()(eGt.A,eGr);let eGa=eGt.A&&eGt.A.locals?eGt.A.locals:void 0,eGo=e=>{let{name:t,description:r,required:a=!0}=e;return(0,fU.jsxs)("div",{className:"w-full flex items-center px-2 mb-[2px]",children:[(0,fU.jsx)(eeF.Label,{text:(0,fU.jsx)(TQ.Text,{ellipsis:{showTooltip:!0},className:eGa.text,children:t}),required:a,className:eGa.label}),!!r&&(0,fU.jsx)(kC,{content:r,children:(0,fU.jsx)(eOS,{className:eGa.icon})})]})};var eGi=i(22907),eGn={};eGn.styleTagTransform=yj(),eGn.setAttributes=yB(),eGn.insert=yI().bind(null,"head"),eGn.domAPI=yO(),eGn.insertStyleElement=yH(),yC()(eGi.A,eGn);let eGs=eGi.A&&eGi.A.locals?eGi.A.locals:void 0,eGl=e=>{var t,r;let a,{file:o,disabled:i,inputType:n,onRemove:s,onRetry:l}=e,c="uploadFail"===o.status,d="uploading"===o.status,u=o.fileInstance&&(null==(t=GK(o.fileInstance))?void 0:t.fileType),p=u&&(null==(r=(a=eqK[u])?eqG.find(e=>e.type===a):null)?void 0:r.icon);return(0,fU.jsxs)("div",{className:yY()(eGs.file,"flex border border-solid rounded-lg items-center w-full coz-stroke-primary",{[eGs["file-uploading"]||""]:d}),style:{"--var-percent":`${o.percent}%`},children:[(0,fU.jsx)("img",{src:p??o.url,className:yY()("w-6 h-6","image"===u&&"rounded border border-solid coz-stroke-primary")}),(0,fU.jsx)(TQ.Text,{ellipsis:!0,className:"mx-2 flex-1 text-sm",children:o.name}),c?(0,fU.jsxs)("div",{onClick:e=>{e.stopPropagation(),i||l()},className:eGs.retry,children:[(0,fU.jsx)(eOC,{className:"coz-fg-hglt-red"}),(0,fU.jsx)("div",{children:bj.t("Retry")})]}):null,(0,fU.jsx)(Q5,{className:yY()("close-btn w-5 h-5",eGs["delete-btn"]),disabled:i,onClick:e=>{e.stopPropagation(),s()},theme:"borderless",size:"small",icon:(0,fU.jsx)(eOH,{className:eGs["delete-icon"]})})]})},eGc=e=>{let{value:t,name:r,uploadFile:a,onChange:o,inputType:i,disabled:n,toggle:s,...l}=e,[c,d]=(0,gt.useState)(),u=eej(r),p=(0,gt.useRef)(null==c?void 0:c.uid),h=e=>{e.fileInstance&&(d({...e,percent:0,status:"uploading"}),u.setError(!0),p.current=null==e?void 0:e.uid,null==a||a({file:e.fileInstance,onProgress:t=>{p.current===e.uid&&d({...e,percent:t,status:"uploading"})},onSuccess:function(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;p.current===e.uid&&(null==o||o({fileInstance:e.fileInstance,url:t,width:r,height:a}),d({...e,response:t,percent:100,status:"success"}))},onError:()=>{p.current===e.uid&&(u.setError(!1),d({...e,status:"uploadFail"}))}}))};return(0,fU.jsxs)(fU.Fragment,{children:[(0,fU.jsx)(VR,{action:"",className:"w-full",draggable:!0,limit:1,...l,disabled:n,onAcceptInvalid:()=>{UH.error(bj.t("shortcut_Illegal_file_format"))},onSizeError:()=>{l.maxSize&&UH.error(bj.t("file_too_large",{max_size:`${l.maxSize/1024}MB`}))},customRequest:e=>{let{onSuccess:t}=e;t("")},showUploadList:!1,onChange:e=>{var t;let{currentFile:r}=e;p.current!==r.uid&&(!l.maxSize||(null==(t=r.fileInstance)?void 0:t.size)&&r.fileInstance.size<=1024*l.maxSize)&&h(r)},children:c?(0,fU.jsx)(eGl,{file:c,inputType:i,onRemove:()=>{p.current=void 0,d(void 0),null==o||o(""),setTimeout(()=>{u.setError(!0)})},onRetry:()=>{c&&h(c)}}):(0,fU.jsx)(eHs,{icon:(0,fU.jsx)(eOD,{}),disabled:n,className:yY()(eGs["upload-button"],"w-full"),children:(0,fU.jsx)("span",{className:eGs["upload-button-text-short"],children:bj.t("shortcut_component_upload_component_placeholder")})})}),!c&&(0,fU.jsx)(Q5,{disabled:n,icon:(0,fU.jsx)(eOj,{}),onClick:s})]})},eGd=e=>{let{disabled:t,onChange:r,toggle:a}=e;return(0,fU.jsxs)(fU.Fragment,{children:[(0,fU.jsx)(eGe,{disabled:t,onChange:r,className:eGs.input}),(0,fU.jsx)(Q5,{disabled:t,icon:(0,fU.jsx)(eOH,{}),onClick:a})]})},eGu=qC(e=>{let[t,r]=(0,gt.useState)(!1),a="error"===e.validateStatus,o=eej(e.name);return(0,gt.useEffect)(()=>{setTimeout(()=>{var t;null==(t=e.onChange)||t.call(e,""),setTimeout(()=>{o.setError(!0)})})},[t]),(0,fU.jsx)("div",{className:yY()("flex items-center justify-start gap-2",eGs.container,a&&eGs["container-error"]),children:t?(0,fU.jsx)(eGd,{toggle:()=>{r(!1)},...e}):(0,fU.jsx)(eGc,{toggle:()=>{r(!0)},...e})})});var eGp=i(96061),eGh={};eGh.styleTagTransform=yj(),eGh.setAttributes=yB(),eGh.insert=yI().bind(null,"head"),eGh.domAPI=yO(),eGh.insertStyleElement=yH(),yC()(eGp.A,eGh);let eGm=eGp.A&&eGp.A.locals?eGp.A.locals:void 0,eGf=ew8(function(e){return gt.createElement("svg",Object.assign({viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",focusable:!1,"aria-hidden":!0},e),gt.createElement("path",{d:"M6.95 7.72h10.13c.4 0 .64.45.42.78l-5.07 7.6a.5.5 0 0 1-.83 0L6.54 8.5a.5.5 0 0 1 .41-.78Z",fill:"currentColor"}))},"small_triangle_down");var eGg=i(11126),eG_={};eG_.styleTagTransform=yj(),eG_.setAttributes=yB(),eG_.insert=yI().bind(null,"head"),eG_.domAPI=yO(),eG_.insertStyleElement=yH(),yC()(eGg.A,eG_);let eGb=eGg.A&&eGg.A.locals?eGg.A.locals:void 0,eGv=e=>{let{disabled:t,label:r,onClick:a,selected:o,value:i,key:n,optionClassName:s}=e;return(0,fU.jsxs)("div",{className:yY()(eGb["ui-select-option"],t&&eGb["ui-select-option-disabled"],o&&eGb["ui-select-option-selected"],s),onClick:e=>{t||null==a||a(e)},"data-testid":"ui.select.option",children:[(0,fU.jsx)("div",{className:eGb["ui-select-option-icon"],children:(0,fU.jsx)(eOM,{className:eGb.icon})}),X_(r)?(0,fU.jsx)("div",{className:eGb["ui-select-option-text"],children:r}):r]},n||i)},eGy=(0,gt.forwardRef)((e,t)=>{let{theme:r,className:a,label:o,size:i="default",clickToHide:n=!0,...s}=e,{selectedClassname:l}=s;return"borderless"===r?(0,fU.jsx)(HC,{...s,ref:t,clickToHide:n,className:yY()(a,eGb["borderless-ui-select"],eGb["ui-select"],eGb[`ui-select-${i}`]),triggerRender:e=>{var t;return(0,fU.jsxs)("div",{className:eGb["filter-content"],"data-testid":"ui.select.trigger",children:[o&&(0,fU.jsx)("div",{className:eGb["filter-label"],children:`${o}:`}),(0,fU.jsxs)("div",{className:yY()(eGb["borderless-filter-render"],eGb[`size-${i}`]),children:[(0,fU.jsx)(TQ.Text,{ellipsis:!0,className:yY()(eGb["borderless-filter-text"],l),children:null==e||null==(t=e.value)?void 0:t.map(e=>e.label)}),(0,fU.jsx)(eGf,{className:eGb["filter-icon"]})]})]})}}):(0,fU.jsx)(HC,{...s,ref:t,clickToHide:n,className:yY()(a,eGb["ui-select"],eGb["light-ui-select"],eGb[`ui-select-${i}`])})}),eGT=(0,gt.forwardRef)((e,t)=>{let{theme:r="borderless",dropdownClassName:a,maxHeight:o=216,...i}=e;return(0,fU.jsx)(eGy,{clickToHide:!0,ref:t,renderOptionItem:e=>(0,fU.jsx)(eGv,{...e}),theme:r,dropdownClassName:yY()(a,eGb["ui-select-dropdown"]),maxHeight:o,...i})});eGT.OptGroup=HC.OptGroup,eGT.Option=HC.Option;let eGk=qC(e=>(0,fU.jsx)(eGT,{...e})),eGw=e=>{let{...t}=e;return(0,fU.jsx)(eGk,{...t,theme:"light"})};eGw.Option=eGT.Option,eGw.OptGroup=eGT.OptGroup;let eGQ={"@flowpd/cici-components/Input":e=>{let{context:{readonly:t},props:{name:r,description:a,rules:o,defaultValue:i,...n}}=e,s=!(null==i?void 0:i.value);return(0,fU.jsxs)("div",{children:[(0,fU.jsx)(eGo,{required:s,name:r,description:a}),(0,fU.jsx)(eeF.Input,{disabled:t,fieldStyle:{padding:0},placeholder:null==i?void 0:i.value,className:"w-full",field:r,noLabel:!0,rules:o.map(e=>e.required?{...e,validator:(e,t)=>!!(null==t?void 0:t.trim())}:e),...n})]})},"@flowpd/cici-components/Select":e=>{let{context:{readonly:t},props:{name:r,description:a,defaultValue:o,...i}}=e,n=!(null==o?void 0:o.value);return(0,fU.jsxs)("div",{children:[(0,fU.jsx)(eGo,{name:r,description:a,required:n}),(0,fU.jsx)(eGw,{disabled:t,fieldStyle:{padding:0},className:"w-full",field:r,initValue:null==o?void 0:o.value,noLabel:!0,...i})]})},"@flowpd/cici-components/Upload":e=>{let{context:{uploadFile:t,readonly:r},props:{name:a,description:o,rules:i,...n}}=e;return(0,fU.jsxs)("div",{children:[(0,fU.jsx)(eGo,{name:a,description:o}),(0,fU.jsx)(eGu,{field:a,noLabel:!0,name:a,fieldStyle:{padding:0},uploadFile:t,disabled:r,rules:r?void 0:i,...n})]})},"@flowpd/cici-components/Placeholder":()=>(0,fU.jsx)("div",{className:"flex items-center justify-center rounded-lg coz-bg-plus text-center text-xs font-medium coz-fg-secondary ",style:{height:58},children:bj.t("shortcut_modal_components")}),"@flowpd/cici-components/ColumnLayout":e=>{let{children:t}=e;return(0,fU.jsx)("div",{className:"flex items-center justify-between w-full mb-3 gap-2",children:t})},"@flowpd/cici-components/Form":e=>{let{context:{onChange:t,onSubmit:r,dsl:a},children:o}=e,i=(0,gt.useRef)();return(0,fU.jsx)(eeF,{className:"w-full",autoComplete:"off",getFormApi:e=>i.current=e,onChange:e=>null==t?void 0:t(e.values),onSubmit:e=>{if(!r)return;let t=(null==a?void 0:a.elements)?Object.values(a.elements).map(e=>{var t;let r=null==e||null==(t=e.props)?void 0:t.defaultValue;return{defaultValue:null==r?void 0:r.value,type:e.type,id:e.id}}).filter(e=>"@flowpd/cici-components/Input"===e.type&&!!e.defaultValue):[],o=Object.entries(e).reduce((e,r)=>{let[a,o]=r,i=t.find(e=>e.id===a);return i&&!o?e[a]=i.defaultValue:e[a]=o,e},{});t.forEach(e=>{let{id:t,defaultValue:r}=e;!t||t in o||(o[t]=r)}),r(o)},children:o})},"@flowpd/cici-components/PageContainer":e=>{let{children:t}=e;return(0,fU.jsx)(fU.Fragment,{children:t})},"@flowpd/cici-components/Button":e=>{let{context:t,props:r}=e,a=(e=>{let{context:{readonly:t,dsl:r},props:{formFields:a=[]}}=e,o=qx(),i=a.some(e=>{var t,a,i;let n=!o.values[e],s=!!(null==(t=o.errors)?void 0:t[e]),l=null===(i=(null==r?void 0:r.elements)?Object.values(r.elements).filter(e=>"@flowpd/cici-components/Input"===e.type).find(t=>t.id===e)??null:null)||void 0===i||null==(a=i.props)?void 0:a.defaultValue;return(null==l?void 0:l.value)?s:s||n}),{isSendMessageLock:n}=(0,gt.useContext)(eq5);return t||i||n})({context:t,props:r});return(0,fU.jsx)("div",{className:"flex justify-end",children:(0,fU.jsx)(Q5,{theme:"borderless",className:eGm.button,htmlType:"submit",size:"small",disabled:a,icon:(0,fU.jsx)(eOE,{})})})}},eGx=e=>{var t,r;let{elementId:a,...o}=e,{dsl:i}=o,n=null==i?void 0:i.elements[a],s=(null==n?void 0:n.type)||"",l=s in eGQ?eGQ[s]:null,c=n&&(n.children??(null==(t=(null==(r=n.props)?void 0:r.Columns)??[])?void 0:t.reduce((e,t)=>(t.children&&e.push(...t.children),e),[])));return l?(0,fU.jsx)(l,{context:o,props:null==n?void 0:n.props,children:null==c?void 0:c.map(e=>(0,fU.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,fU.jsx)(eGx,{elementId:e,...o},e)}))}):null},eGz=e=>{let{dsl:t,...r}=e,a=eMQ();return(0,fU.jsx)(eq5.Provider,{value:{isSendMessageLock:a},children:(0,fU.jsx)(eGx,{elementId:t.rootID,dsl:t,...r})})};var eGA=i(11951),eGE={};eGE.styleTagTransform=yj(),eGE.setAttributes=yB(),eGE.insert=yI().bind(null,"head"),eGE.domAPI=yO(),eGE.insertStyleElement=yH(),yC()(eGA.A,eGE);let eGD=eGA.A&&eGA.A.locals?eGA.A.locals:void 0,eGS=e=>{var t;let r,a,{shortcut:o,onClose:i,visible:n,readonly:s,onSubmit:l}=e,c=(0,gt.useRef)(null),d=(r=eM1(),a=e=>r.getRegisteredPlugin(e),e=>{var t;let r,{file:o,onProgress:i,onError:n,onSuccess:s}=e,l=a("upload-plugin");if(!l)return;let c=new l({file:o,type:(null==(t=GK(o))?void 0:t.fileType)==="image"?"image":"object"}),d=!1,u=50,p=()=>{u<85&&(u+=5,null==i||i(u))},h=setTimeout(()=>{d=!0,r=window.setInterval(p,100)},1500);function m(){clearTimeout(h),clearInterval(r),r=void 0,r=void 0,d=!1}c.on("progress",e=>{let{percent:t}=e;d||(h&&m(),null==i||i(t))}),c.on("error",e=>{null==n||n({status:e.extra.errorCode}),m()}),c.on("complete",e=>{let{uploadResult:{Url:t,Uri:r,ImageHeight:a=0,ImageWidth:o=0}}=e;null==s||s(t||r||"",o,a),m()})}),u=eTi().messageWidth,p=(0,gt.useMemo)(()=>{var e,t,r;let a,i,n;return i=(e=>{let t=[],r=[...e];for(;r.length;)t.push(eq$(r.splice(0,2)));return t})(a=((null==(e=o.components_list)?void 0:e.filter(e=>!e.hide))??[]).map(eq1)),null==(r=(n={elements:{root:{id:"root",name:"Root",type:"@flowpd/cici-components/PageContainer",children:["form"],directives:{}},form:{id:"form",name:"FlowpdCiciComponentsForm",type:"@flowpd/cici-components/Form",props:{value:{type:eqZ.EXPRESSION,value:"{{formValue}}"},onChange:{type:eqZ.ACTION,value:"{{onChange}}"},ruls:{}},children:["submitButton"]},submitButton:{id:"submitButton",name:"FlowpdCiciComponentsButton",type:"@flowpd/cici-components/Button",props:{onClick:{type:eqZ.ACTION,value:"{{onSubmit}}"}}}},rootID:"root",variables:{formValue:{id:"formValue",defaultValue:{}}},actions:{onSubmit:{id:"onSubmit",type:"submit",data:{type:eqX.EXPRESSION,value:"{{formValue}}"}},onChange:{id:"onChange",type:"updateVar",target:"formValue"}}}).elements.form)||null==(t=r.children)||t.unshift(...i.map(e=>e.id)),[...a,...i].forEach(e=>n.elements[e.id]=e),n.elements.submitButton.props.formFields=a.map(e=>e.id),n},[o.components_list]);return n?(0,fU.jsx)(fU.Fragment,{children:(0,fU.jsxs)("div",{ref:c,className:eGD["shortcut-template"],style:{width:`calc(${u} - 48px)`},children:[(0,fU.jsxs)("div",{className:"flex items-center text-sm coz-fg-primary px-4 py-[6px] coz-bg-primary rounded-t-3xl h-8",children:[(null==(t=o.shortcut_icon)?void 0:t.url)?(0,fU.jsx)("img",{src:o.shortcut_icon.url,alt:"icon",className:"mr-1 h-[14px]"}):null,(0,fU.jsx)("div",{children:o.command_name}),(0,fU.jsx)(eq6,{icon:(0,fU.jsx)(eOV,{}),onClick:i,wrapperClass:"ml-auto"})]}),(0,fU.jsx)("div",{className:"p-3",children:(0,fU.jsx)(eGz,{uploadFile:e=>{let{file:t,onError:r,onProgress:a,onSuccess:o}=e;null==d||d({file:t,onProgress:a,onError:r,onSuccess:o})},readonly:s,onSubmit:e=>{null==l||l(e)},dsl:p})})]})}):null};var eGC=i(77183),eGL={};eGL.styleTagTransform=yj(),eGL.setAttributes=yB(),eGL.insert=yI().bind(null,"head"),eGL.domAPI=yO(),eGL.insertStyleElement=yH(),yC()(eGC.A,eGL);let eGO=eGC.A&&eGC.A.locals?eGC.A.locals:void 0,eGM=()=>{},eGI=new Proxy(function(){},{get:(e,t,r)=>eGM[t]||eGM,apply:(e,t,r)=>eGM(...r)});var eGP=((eG={}).sign_up_front="sign_up_front",eG.page_from="page_from",eG.page_view="page_view",eG.view_bot="view_bot",eG.view_database="view_database",eG.click_create_bot_confirm="click_create_bot_confirm",eG.click_prompt_edit="click_prompt_edit",eG.click_tool_select="click_tool_select",eG.click_database_select="click_database_select",eG.click_welcome_message_edit="click_welcome_message_edit",eG.click_send_message="click_send_message",eG.delete_rec_plugin="delete_rec_plugin",eG.submit_rec_plugin="submit_rec_plugin",eG.bot_show="bot_show",eG.bot_click="bot_click",eG.click_bot_duplicate="click_bot_duplicate",eG.bot_duplicate_click_front="bot_duplicate_click_front",eG.coze_space_sidenavi_ck="coze_space_sidenavi_ck",eG.coze_enterprise_sidenavi_ck="coze_enterprise_sidenavi_ck",eG.binding_card_list="binding_card_list",eG.binding_card_add="binding_card_add",eG.binding_card_update="binding_card_update",eG.binding_card_preview="binding_card_preview",eG.edited_suggestion="edited_suggestion",eG.builder_editor_view="builder_editor_view",eG.builder_plugin_info="builder_plugin_info",eG.builder_plugin_channel="builder_plugin_channel",eG.builder_plugin_var="builder_plugin_var",eG.builder_plugin_structure="builder_plugin_structure",eG.builder_plugin_component="builder_plugin_component",eG.builder_plugin_canvas="builder_plugin_canvas",eG.builder_plugin_set="builder_plugin_set",eG.builder_plugin_preview="builder_plugin_preview",eG.builder_plugin_publish="builder_plugin_publish",eG.ui_builder_exposure="ui_builder_exposure",eG.ui_builder_initialization="ui_builder_initialization",eG.ui_builder_component_usage="ui_builder_component_usage",eG.ui_builder_setter_usage="ui_builder_setter_usage",eG.builder_plugin_template="builder_plugin_template",eG.builder_plugin_copilot_enter_click="builder_plugin_copilot_enter_click",eG.builder_plugin_copilot_gen_click="builder_plugin_copilot_gen_click",eG.builder_editor_show="builder_editor_show",eG.card_webruntime_view="card_webruntime_view",eG.card_webruntime_render="card_webruntime_render",eG.card_webruntime_error="card_webruntime_error",eG.BuilderPluginStructure="BuilderPluginStructure",eG.BuilderPluginCanvas="BuilderPluginCanvas",eG.card_builder_show="card_builder_show",eG.select_scheduled_tasks_timezone="select_scheduled_tasks_timezone",eG.log_not_supported_timezone="log_not_supported_timezone",eG.cookie_click="cookie_click",eG.cookie_show="cookie_show",eG.agent_app_home_view="agent_app_home_view",eG.agent_app_instance_click="agent_app_instance_click",eG.agent_app_instance_create="agent_app_instance_create",eG.agent_app_detail_view="agent_app_detail_view",eG.agent_app_shortcut_command="agent_app_shortcut_command",eG.agent_app_send_message="agent_app_send_message",eG.tutorial_enter_ck="tutorial_enter_ck",eG.tutorial_list_pv="tutorial_list_pv",eG.tutorial_item_ck="tutorial_item_ck",eG.tutorial_tips_pv="tutorial_tips_pv",eG.home_page_view="home_page_view",eG.tab_click="tab_click",eG.workspace_tab_expose="workspace_tab_expose",eG.create_workspace_click="create_workspace_click",eG.create_workspace_result="create_workspace_result",eG.enterprise_switch_child_create_space_click="enterprise_switch_child_create_space_click",eG.enterprise_switch_add_outside_user_click="enterprise_switch_add_outside_user_click",eG.enterprise_switch_join_outside_space_click="enterprise_switch_join_outside_space_click",eG.space_switch_show="space_switch_show",eG.space_switch_click="space_switch_click",eG.space_admins_button_click="space_admins_button_click",eG.space_members_page_show="space_members_page_show",eG.space_members_page_click="space_members_page_click",eG.space_member_remove_pop_show="space_member_remove_pop_show",eG.space_member_remove_pop_click="space_member_remove_pop_click",eG.space_invitation_page_show="space_invitation_page_show",eG.space_invitation_page_click="space_invitation_page_click",eG.space_invitation_revoke_pop_show="space_invitation_revoke_pop_show",eG.space_invitation_revoke_pop_click="space_invitation_revoke_pop_click",eG.space_settings_page_show="space_settings_page_show",eG.space_settings_page_click="space_settings_page_click",eG.space_settings_button_click="space_settings_button_click",eG.space_share_link_popup_show="space_share_link_popup_show",eG.space_share_link_popup_click="space_share_link_popup_click",eG.space_add_members_popup_show="space_add_members_popup_show",eG.space_add_members_popup_click="space_add_members_popup_click",eG.space_settings_secondary_pop_show="space_settings_secondary_pop_show",eG.space_settings_secondary_pop_click="space_settings_secondary_pop_click",eG.create_bot_click="create_bot_click",eG.create_bot_result="create_bot_result",eG.bot_duplicate_click="bot_duplicate_click",eG.bot_duplicate_result="bot_duplicate_result",eG.bot_submit="bot_submit",eG.bot_submit_difference="bot_submit_difference",eG.bot_submit_confirm_click="bot_submit_confirm_click",eG.bot_publish_difference="bot_publish_difference",eG.bot_merge_page="bot_merge_page",eG.bot_merge="bot_merge",eG.bot_diff_viewdetail="bot_diff_viewdetail",eG.bot_merge_manual="bot_merge_manual",eG.workspace_action_front="workspace_action_front",eG.search_front="search_front",eG.product_show="product_show",eG.product_click="product_click",eG.product_show_front="product_show_front",eG.product_click_front="product_click_front",eG.click_open_in_front="click_open_in_front",eG.favorite_click_front="favorite_click_front",eG.product_run_front="product_run_front",eG.entity_publish_click_front="entity_publish_click_front",eG.share_front="share_front",eG.bot_detail_page_front="bot_detail_page_front",eG.share_recall_page_front="share_recall_page_front",eG.dev_bot_share_screenshot_front="dev_bot_share_screenshot_front",eG.bot_tts_configure="bot_tts_configure",eG.bot_tts_select_click="bot_tts_select_click",eG.bot_tts_select_confirm="bot_tts_select_confirm",eG.voice_chat_call="voice_chat_call",eG.voice_chat_opening_dialog="voice_chat_opening_dialog",eG.voice_chat_connect="voice_chat_connect",eG.voice_chat_record="voice_chat_record",eG.voice_chat_think="voice_chat_think",eG.voice_chat_speak="voice_chat_speak",eG.voice_chat_hang_up="voice_chat_hang_up",eG.voice_chat_error="voice_chat_error",eG.task_click="task_click",eG.task_show="task_show",eG.buy_token_click="coze_token_buy_click",eG.choose_amount_click="coze_token_buy_amount_click",eG.confirm_checkout_click="coze_token_buy_confirm_click",eG.token_insufficiency_pop_up="token_insufficiency_pop_up",eG.click_auto_gen_changelog_button="click_auto_gen_changelog_button",eG.click_stop_auto_gen_changelog_button="click_stop_auto_gen_changelog_button",eG.auto_gen_changelog_finish="auto_gen_changelog_finish",eG.bot_publish="bot_publish",eG.bot_publish_button_click="bot_publish_button_click",eG.bot_publish_audit_pop_up="bot_publish_audit_pop_up",eG.banner_expose_front="banner_expose_front",eG.banner_click_front="banner_click_front",eG.banner_close_front="banner_close_front",eG.recommended_table_click="recommended_table_click",eG.nl2table_create_table_click="nl2table_create_table_click",eG.generate_with_ai_click="generate_with_ai_click",eG.database_learn_click="database_learn_click",eG.create_table_click="create_table_click",eG.edit_table_click="edit_table_click",eG.create_mockset_front="create_mockset_front",eG.del_mockset_front="del_mockset_front",eG.create_mock_front="create_mock_front",eG.del_mock_front="del_mock_front",eG.use_mockset_front="use_mockset_front",eG.use_mockgen_front="use_mockgen_front",eG.privacy_plugin_popup_front="privacy_plugin_popup_front",eG.privacy_plugin_form_front="privacy_plugin_form_front",eG.privacy_plugin_form_server="privacy_plugin_form_server",eG.privacy_store_privacy_front="privacy_store_privacy_front",eG.bot_desc_dialog_front="bot_desc_dialog_front",eG.create_plugin_front="create_plugin_front",eG.create_plugin_tool_front="create_plugin_tool_front",eG.code_snippet_front="code_snippet_front",eG.workflow_test_node="workflow_test_node",eG.workflow_create_testset="workflow_create_testset",eG.workflow_aigc_params="workflow_aigc_params",eG.workflow_testrun_source="workflow_testrun_source",eG.workflow_testrun_result_front="workflow_testrun_result_front",eG.workflow_testrun_detailed_front="workflow_testrun_detailed_front",eG.workflow_pre_release_ppe="workflow_pre_release_ppe",eG.workflow_ppe_version_select="workflow_ppe_version_select",eG.workflow_ppe_release_event="workflow_ppe_release_event",eG.workflow_history_show="workflow_history_show",eG.workflow_ppe_offline="workflow_ppe_offline",eG.workflow_submit="workflow_submit",eG.workflow_submit_difference="workflow_submit_difference",eG.workflow_publish_difference="workflow_publish_difference",eG.workflow_merge_page="workflow_merge_page",eG.workflow_merge="workflow_merge",eG.workflow_submit_version_history="workflow_submit_version_history",eG.workflow_submit_version_revert="workflow_submit_version_revert",eG.workflow_submit_version_view="workflow_submit_version_view",eG.workflow_cooperation_switch_click="workflow_cooperation_switch_click",eG.workflow_test_run_click="workflow_test_run_click",eG.widget_create_click="widget_create_click",eG.widget_duplicate_click="widget_duplicate_click",eG.widget_delete_click="widget_delete_click",eG.analytics_tab_view="analytics_tab_view",eG.analytics_tab_view_duration="analytics_tab_view_duration",eG.query_trace_list_view="query_trace_list_view",eG.query_trace_columns_update="query_trace_columns_update",eG.query_trace_filters_update="query_trace_filters_update",eG.query_trace_quick_filter_status_update="query_trace_quick_filter_status_update",eG.query_trace_quick_filter_latency_update="query_trace_quick_filter_latency_update",eG.query_trace_quick_filter_tokens_update="query_trace_quick_filter_tokens_update",eG.query_trace_quick_filter_full_text_search="query_trace_quick_filter_full_text_search",eG.query_trace_detail_view="query_trace_detail_view",eG.query_trace_row_click="query_trace_row_click",eG.query_new_trace_csv_export="query_new_trace_csv_export",eG.query_new_trace_columns_update="query_new_trace_columns_update",eG.query_new_trace_list_view="query_new_trace_list_view",eG.query_new_trace_row_click="query_new_trace_row_click",eG.query_new_trace_detail_view="query_new_trace_detail_view",eG.query_new_trace_quick_filter_status_update="query_new_trace_quick_filter_status_update",eG.query_new_trace_quick_filter_message_ids_update="query_new_trace_quick_filter_message_ids_update",eG.query_new_trace_quick_filter_user_ids_update="query_new_trace_quick_filter_user_ids_update",eG.query_new_trace_quick_filter_session_ids_update="query_new_trace_quick_filter_session_ids_update",eG.query_new_trace_quick_filter_input_update="query_new_trace_quick_filter_input_update",eG.query_new_trace_quick_filter_output_update="query_new_trace_quick_filter_output_update",eG.query_new_trace_quick_filter_intent_update="query_new_trace_quick_filter_intent_update",eG.query_new_trace_quick_filter_input_tokens_update="query_new_trace_quick_filter_input_tokens_update",eG.query_new_trace_quick_filter_output_tokens_update="query_new_trace_quick_filter_output_tokens_update",eG.query_new_trace_quick_filter_latency_update="query_new_trace_quick_filter_latency_update",eG.query_new_trace_quick_filter_latency_first_resp_update="query_new_trace_quick_filter_latency_first_resp_update",eG.query_new_trace_quick_filter_time_update="query_new_trace_quick_filter_time_update",eG.query_trace_graph_tab_click="query_trace_graph_tab_click",eG.query_trace_tree_node_click="query_trace_tree_node_click",eG.query_trace_flamethread_node_click="query_trace_flamethread_node_click",eG.query_trace_input_copy="query_trace_input_copy",eG.query_trace_output_copy="query_trace_output_copy",eG.age_gate_show="age_gate_show",eG.age_gate_click="age_gate_click",eG.open_debug_panel="open_debug_panel",eG.debug_page_show="debug_page_show",eG.ai_analysis_assistant_entry_click="ai_analysis_assistant_entry_click",eG.ai_analysis_assistant_send_click="ai_analysis_assistant_send_click",eG.performance_view="performance_view",eG.query_analytics_select_channel="query_analytics_select_channel",eG.query_analytics_intent_jump_queries="query_analytics_intent_jump_queries",eG.analysis_indicator_interval="analysis_indicator_interval",eG.analysis_indicator_auto_refresh_interval="analysis_indicator_auto_refresh_interval",eG.create_dataset="create_dataset",eG.create_rule="create_rule",eG.add_rule_type="add_rule_type",eG.create_case="create_case",eG.case_result="case_result",eG.get_start="get_start",eG.bot_deployment_details="bot_deployment_details",eG.bot_pre_release_ppe="bot_pre_release_ppe",eG.bot_ppe_version_select="bot_ppe_version_select",eG.bot_ppe_release_event="bot_ppe_release_event",eG.bot_history_show="bot_history_show",eG.bot_ppe_offline="bot_ppe_offline",eG.bot_gray_publish="bot_gray_publish",eG.store_search_page_front="store_search_page_front",eG.store_search_front="store_search_front",eG.content_show_front="content_show_front",eG.content_click_front="content_click_front",eG.profile_entrance="profile_entrance",eG.profile_share="profile_share",eG.profile_follow="profile_follow",eG.share_topic="share_topic",eG.landing_topic="landing_topic",eG.collect_topic="collect_topic",eG.view_all="view_all",eG.click_topic="click_topic",eG.language_switch_show="language_switch_show",eG.language_switch_click="language_switch_click",eG.arena_bot_show_front="arena_bot_show_front",eG.arena_bot_click_front="arena_bot_click_front",eG.arena_bot_front="arena_bot_front",eG.arena_click_front="arena_click_front",eG.question_bank_click_front="question_bank_click_front",eG.memory_click_front="memory_click_front",eG.click_debug_panel_feedback_button="click_debug_panel_feedback_button",eG.flow_store_list_click="flow_store_list_click",eG.flow_store_detail_click="flow_store_detail_click",eG.flow_creation_click="flow_creation_click",eG.flow_duplicate_click="flow_duplicate_click",eG.eval_panel_show="coze_panel_show",eG.eval_task_operation="eval_task_operation",eG.eval_panel_tab_show="eval_panel_tab_show",eG.eval_result_show="eval_result_show",eG.eval_result_tab_show="eval_result_tab_show",eG.eval_result_detail_sort="eval_result_detail_sort",eG.shortcut_use="shortcut_use",eG.preview_link_click="preview_link_click",eG.prompt_optimize_front="prompt_optimize_front",eG.home_action_front="home_action_front",eG.template_action_front="template_action_front",eG.coze_agent_front="coze_agent_front",eG.notification_front="notification_front",eG.notification_center_show_front="notification_center_show_front",eG.notification_center_click_front="notification_center_click_front",eG.coze_pro_popup_front="coze_pro_popup_front",eG.coze_landing_front="coze_landing_front",eG.add_member_pop_up_show="add_member_pop_up_show_front",eG.oauth_page_stay_time_front="oauth_page_stay_time_front",eG.oauth_page_show_front="oauth_page_show_front",eG.oauth_page_click_front="oauth_page_click_front",eG.account_upgrade_page_show_front="account_upgrade_page_show_front",eG.account_upgrade_page_click_front="account_upgrade_page_click_front",eG.coze_pro_popup_plan_buy_token="coze_pro_popup_plan_buy_token",eG.playground_click_front="playground_click_front",eG.playground_set_front="playground_set_front",eG.playground_authorize_front="playground_authorize_front",eG.doc_click_front="doc_click_front",eG.docs_page_view_front="docs_page_view_front",eG.publish_oauth_button_click="publish_oauth_button_click",eG.settings_oauth_page_show="settings_oauth_page_show",eG.settings_oauth_button_click="settings_oauth_button_click",eG.prompt_library_front="prompt_library_front",eG.compare_mode_front="compare_mode_front",eG.site_change_click="site_change_click",eG);let eGB=(e,t)=>{eiR.info({message:"send-tea-event",meta:{event:e,params:t}}),eGI.sendEvent(e,t)},eGR=(e,t)=>{let r=e;return Object.keys(t).forEach(e=>{r=r.replace(RegExp(`\\{\\{${e}\\}\\}`,"g"),t[e])}),r},eGH=()=>{let e=eMJ(eMb());return t=>{var r;let{queryTemplate:a,onBeforeSend:o,options:i,shortcut:n}=t,{tool_type:s}=n,l=void 0!==s&&[eTh.ToolTypeWorkFlow,eTh.ToolTypePlugin].includes(s),c={payload:{text:a,mention_list:[]}},d=WU({extendFiled:{...l?eGF(n):{},device_id:String(eMU.deviceId)}},i),{message:u,options:p}=(null==o?void 0:o({message:c,options:d}))||{message:c,options:d};e({text:u.payload.text,mentionList:u.payload.mention_list},"shortcut",p),eGB(eGP.shortcut_use,{tool_type:s,use_components:!!(null==(r=n.components_list)?void 0:r.length),show_panel:eq0(n)})}},eGF=e=>{let{plugin_id:t,plugin_api_name:r,tool_info:{tool_params_list:a}={}}=e,o=(a??[]).reduce((e,t)=>{let{default_value:r,name:a}=t;return a&&(e[a]={value:r??"",resource_type:""}),e},{});return{shortcut_cmd_id:e.command_id,toolList:[{plugin_id:t,api_name:r??"",parameters:o}]}},eGj=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],{template_query:a,components_list:o}=e;if(!a)throw Error("template_query is not defined");let i=eGq(o,t);return r?eGR(a,t??{}):eGR(a,i)},eGN=(e,t,r)=>Object.keys(e).reduce((a,o)=>{let i=e[o];return"object"==typeof i&&i.fileInstance?a[o]=t(i):a[o]=r(i),a},{}),eGU=e=>{var t;return!!("object"==typeof e&&e.fileInstance&&(null==(t=GK(e.fileInstance))?void 0:t.fileType)!=="image")},eGV=e=>{var t;return!!("object"==typeof e&&e.fileInstance&&(null==(t=GK(e.fileInstance))?void 0:t.fileType)==="image")},eGq=(e,t)=>{let r=eGN(t,e=>{var t;return null==e||null==(t=e.fileInstance)?void 0:t.name},e=>e);return(e??[]).reduce((e,t)=>{let{default_value:a,name:o,hide:i}=t;if(!o)return e;if(i)return e[o]=(null==a?void 0:a.value)??"",e;let n=r[o];return n&&(e[o]=n),e},{})},eGG=function(e,t){void 0===t&&(t={});var r=t.target,a=t.isNoMore,o=t.threshold,i=void 0===o?100:o,n=t.reloadDeps,s=t.manual,l=t.onBefore,c=t.onSuccess,d=t.onError,u=t.onFinally,p=g4((0,gt.useState)(),2),h=p[0],m=p[1],f=g4((0,gt.useState)(!1),2),g=f[0],_=f[1],b=(0,gt.useMemo)(function(){return!!a&&a(h)},[h]),v=ejO(function(t){return g0(void 0,void 0,void 0,function(){var r,a,o;return g2(this,function(i){switch(i.label){case 0:return[4,e(t)];case 1:return r=i.sent(),t?m(gJ(gJ({},r),{list:g6(g6([],g4(null!=(o=t.list)?o:[]),!1),g4(r.list),!1)})):m(gJ(gJ({},r),{list:g6([],g4(null!=(a=r.list)?a:[]),!1)})),[2,r]}})})},{manual:s,onFinally:function(e,t,r){_(!1),null==u||u(t,r)},onBefore:function(){return null==l?void 0:l()},onSuccess:function(e){setTimeout(function(){z()},10),null==c||c(e)},onError:function(e){return null==d?void 0:d(e)}}),y=v.loading,T=v.run,k=v.runAsync,w=v.cancel,Q=WG(function(){b||(_(!0),T(h))}),x=WG(function(){return b?Promise.reject():(_(!0),k(h))}),z=function(){var e=eet(r);if(e){var t,a=(t=e=e===document?document.documentElement:e)===document||t===document.body?Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop):t.scrollTop;(e.scrollHeight||Math.max(document.documentElement.scrollHeight,document.body.scrollHeight))-a<=(e.clientHeight||Math.max(document.documentElement.clientHeight,document.body.clientHeight))+i&&Q()}};return evO("scroll",function(){y||g||z()},{target:r}),WZ(function(){T()},g6([],g4(void 0===n?[]:n),!1)),{data:h,loading:!g&&y,loadingMore:g,noMore:b,loadMore:Q,loadMoreAsync:x,reload:WG(function(){return _(!1),T()}),reloadAsync:WG(function(){return _(!1),k()}),mutate:m,cancel:w}},eGK=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],[r,a]=(0,gt.useState)(0),o=(0,gt.useRef)(),i=(0,gt.useRef)(()=>void 0);return i.current=e,(0,gt.useLayoutEffect)(()=>{if(!r)return;let e=o.current||[];return i.current(...e)},[r,...t]),function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];o.current=t,a(e=>e+1)}},eGW=e=>{let{getId:t,list:r,target:a}=e,o=-1;return{targetItem:r.find((e,r)=>t(e)===t(a)&&(o=r,!0)),targetIndex:o}},eGZ=e=>{let{className:t,onSelect:r,getId:a,itemRender:o,onActiveId:i,getMoreListService:n,defaultId:s,listTopSlot:l,defaultList:c,...d}=e,u=(0,gt.useRef)(),p=(0,gt.useRef)(!1),h=(0,gt.useRef)(null),m=(0,gt.useRef)(null),{data:f,scrollIntoView:g,activeId:_,focusTo:b,goNext:v,goPrev:y,loadingMore:T,loading:k}=(e=>{let{getId:t,listRef:r,getMoreListService:a,defaultList:o}=e,[i,n]=(0,gt.useState)(""),{data:s,loadingMore:l,loading:c,loadMore:d}=eGG(e=>a(e),{target:r,isNoMore:e=>!(null==e?void 0:e.hasMore)}),u=(0,gt.useMemo)(()=>o?{list:o.concat((null==s?void 0:s.list)??[]),hasMore:!!(null==s?void 0:s.hasMore)}:{list:(null==s?void 0:s.list)??[],hasMore:!!(null==s?void 0:s.hasMore)},[s]),{list:p}=u,h=e=>{if(!e)return void n("");if(!r.current)return;let a=p.find(r=>t(e)===t(r));a&&n(t(a))},m=eGK(e=>{var a;let o=t(e),i=null==(a=r.current)?void 0:a.querySelector(`[data-id="${o}"]`);i&&i.scrollIntoView({behavior:"instant",block:"nearest"})});return{activeId:i,focusFirst:()=>{let e=p[0];e&&h(e)},focusTo:h,scrollToFirst:()=>{r.current&&(r.current.scrollTop=0)},scrollIntoView:m,goNext:()=>{let e=p.find(e=>t(e)===i);if(!e)return;let{item:r,reachLimit:a}=(e=>{let{curItem:t,list:r,getId:a}=e,{targetIndex:o}=eGW({getId:a,list:r,target:t});if(o<0)return{reachLimit:!1,item:t};let i=o>=r.length-3,n=(o+1)%r.length;return{reachLimit:i,item:r.at(n)||t}})({getId:t,list:p,curItem:e});a&&d(),l||(h(r),m(r))},goPrev:()=>{let e=p.find(e=>t(e)===i);if(!e)return;let{item:r,reachLimit:a}=(e=>{let{curItem:t,list:r,getId:a}=e,{targetIndex:o}=eGW({getId:a,list:r,target:t});if(o<0)return{reachLimit:!1,item:t};let i=(o-1)%r.length;return{reachLimit:0===o,item:r.at(i)||t}})({getId:t,list:p,curItem:e});a&&d(),h(r),m(r)},loadingMore:l,data:u,loading:c}})({getMoreListService:n,getId:e=>a(e),listRef:h,defaultList:c}),w=(null==f?void 0:f.list)??[];return(0,gt.useEffect)(()=>{null==i||i(_)},[_]),WZ(()=>{if(k)return;let e=w.find(e=>a(e)===s);e&&(b(e),g(e),null==i||i(s||a(e)))},[k]),(0,fU.jsxs)("div",{ref:h,tabIndex:1,className:t,onMouseLeave:()=>{b(null)},onMouseMove:()=>{clearTimeout(u.current),p.current=!0,u.current=setTimeout(()=>{p.current=!1},50)},onKeyDown:e=>{if("ArrowDown"===e.key){e.preventDefault(),v();return}if("ArrowUp"===e.key){e.preventDefault(),y();return}if("Enter"===e.key){let e=w.find(e=>a(e)===_);e&&(null==r||r(e))}},...d,children:[l,w.map(e=>(0,fU.jsx)("div",{"data-id":a(e),ref:a(e)===_?m:null,onClick:()=>{null==r||r(e)},onMouseEnter:()=>{if(p.current){var t;b(e),null==(t=h.current)||t.focus()}},children:o(e)},a(e))),T||k?(0,fU.jsx)("div",{className:"flex justify-center items-center",children:(0,fU.jsx)(eID,{style:{color:"#4D53E8"},spin:!0})}):null]})},eGX=i.p+"e2df4cf3a868fb7bc5598aefca4d4657.svg",eGY=i.p+"5aa1c2d1c333386a30d5748d2654b56c.svg",{Text:eG$}=TQ,eGJ=e=>{let{shortcuts:t,onSelect:r,onBeforeSendTextMessage:a,defaultId:o}=e,i=eGH(),[n,s]=(0,gt.useState)("");return(0,fU.jsxs)("div",{className:"p-2",children:[(0,fU.jsx)("div",{className:"text-xs coz-fg-secondary mb-2 pl-2 pt-1",children:bj.t("bot_ide_shortcut")}),(0,fU.jsx)(eGZ,{className:yY()("w-full max-h-[312px] overflow-y-auto cursor-pointer",eGO["load-more-list"]),defaultId:o,getId:e=>e.command_id,onActiveId:e=>s(e),getMoreListService:()=>Promise.resolve({list:t,hasMore:!1}),onSelect:e=>{if(null==r||r(e),e.send_type===eTp.SendTypeQuery){(null==e?void 0:e.template_query)&&i({queryTemplate:e.template_query,onBeforeSend:a,shortcut:e});return}},itemRender:e=>{var t,r,a,o;let{splitLineVisible:i,iconVisible:s,nameVisible:l}=(e=>{let{bot_info:t}=e,r=!!(null==t?void 0:t.icon_url),a=!!(null==t?void 0:t.name);return{iconVisible:r,nameVisible:a,splitLineVisible:r||a}})(e);return(0,fU.jsxs)("div",{className:yY()("flex justify-start items-center max-w-full overflow-hidden h-[52px] px-2 py-[6px]",{"coz-mg-primary-hovered":n===e.command_id,"rounded-md":n===e.command_id}),children:[(0,fU.jsx)("img",{src:(null==(t=e.shortcut_icon)?void 0:t.url)||eGY,alt:"icon",className:"w-9 h-9 p-[10px] rounded bg-white border-[0.5px] border-solid coz-stroke-primary mr-2"}),(0,fU.jsx)("div",{className:"grow-0 shrink max-w-[37%] overflow-hidden box-border mr-3 flex items-center",children:(0,fU.jsx)(eG$,{className:"text-sm coz-fg-plus font-medium",ellipsis:{showTooltip:{opts:{content:e.command_name,position:"top",style:{wordBreak:"break-word"}}}},children:e.command_name})}),e.description?(0,fU.jsx)("div",{className:"flex-0 max-w-[60%] overflow-hidden box-border mr-3 flex items-center",children:(0,fU.jsx)(eG$,{className:"coz-fg-secondary text-xs",ellipsis:{showTooltip:{opts:{content:e.description,position:"top",style:{wordBreak:"break-word"}}}},children:e.description})}):null,(0,fU.jsxs)("div",{className:"flex items-center max-w-full flex-0 overflow-hidden box-border min-w-[100px]",children:[i?(0,fU.jsx)("img",{src:eGX,alt:""}):null,s?(0,fU.jsx)("img",{alt:"bot icon",className:"w-[14px] h-[14px] rounded-full mr-1 ml-3",src:null==(r=e.bot_info)?void 0:r.icon_url}):null,l?(0,fU.jsx)(eG$,{className:"coz-fg-secondary text-xs",ellipsis:{showTooltip:{opts:{content:null==(a=e.bot_info)?void 0:a.name,position:"top",style:{wordBreak:"break-word"}}}},children:null==(o=e.bot_info)?void 0:o.name}):null]})]})}})]})},eG1=Xe(["mr-8px","rounded-[99px]","border-[1px]","border-solid","overflow-hidden"],{variants:{color:{grey:["coz-stroke-primary","coz-mg-secondary","backdrop-blur-[3.45px]"],white:["coz-stroke-primary","coz-bg-max","backdrop-blur-[3.45px]"],blur:["coz-stroke-image-bots","coz-bg-image-bots","backdrop-blur-[20px]"]}}}),eG0=Xe(["text-lg","font-medium"],{variants:{color:{grey:["coz-fg-primary"],white:["coz-fg-primary"],blur:["coz-fg-images-bots"]}}}),{Paragraph:eG2,Text:eG3}=TQ,eG4=e=>{let{children:t,shortcut:r,toolTipFooterSlot:a,showBotInfo:o=!1}=e,i=eTi().layout!==GP.MOBILE,[n,s]=(0,gt.useState)(!1),{description:l,command_name:c}=r,{icon_url:d,name:u}=r.bot_info||{},p=o&&!!(u||d);return(0,fU.jsx)($l,{trigger:"custom",visible:n,style:{maxWidth:"283px",padding:"16px"},content:()=>(0,fU.jsxs)("div",{className:"flex flex-col items-start justify-center min-w-9",children:[c?(0,fU.jsx)("div",{className:"max-w-[250px] mb-1",children:(0,fU.jsx)(eG2,{ellipsis:!0,className:"coz-fg-plus font-bold text-sm",children:c})}):null,l?(0,fU.jsx)("div",{className:"max-w-[250px]",children:(0,fU.jsx)("div",{className:"coz-fg-secondary text-xs",children:l})}):null,p?(0,fU.jsxs)("div",{className:"flex mt-3 gap-1 items-center",children:[d?(0,fU.jsx)("img",{className:"rounded-full w-[14px] h-[14px]",src:d,alt:"bot_icon"}):null,u?(0,fU.jsx)(eG3,{className:"coz-fg-secondary text-xs",children:u}):null]}):null,a]}),children:(0,fU.jsx)("div",{onMouseEnter:()=>s(i),onMouseLeave:()=>s(!1),children:t})})},eG6=e=>{var t;let{shortcut:r,onClick:a,onBeforeSend:o,toolTipFooterSlot:i,popoverTipShowBotInfo:n=!1}=e,s=eGH(),l=(0,gt.useRef)(null),c=eMQ();return r.send_type!==eTp.SendTypeQuery?null:(0,fU.jsx)("div",{className:eG1({color:e.uiMode}),children:(0,fU.jsx)(eG4,{shortcut:r,toolTipFooterSlot:i,showBotInfo:n,children:(0,fU.jsx)(Xg,{disabled:c,"data-testid":`chat-area.chat-input-shortcut.shortcut-button-${r.command_name}`,contentClassName:eG0({color:e.uiMode}),onClick:()=>(()=>{let{template_query:e,agent_id:t,object_id:i}=r;e&&(null==a||a(),s({queryTemplate:e,options:{extendFiled:{extra:{bot_state:JSON.stringify({agent_id:t,bot_id:i})}}},onBeforeSend:o,shortcut:r}))})(),color:"secondary",icon:(null==(t=r.shortcut_icon)?void 0:t.url)?(0,fU.jsx)("img",{alt:"icon",src:r.shortcut_icon.url,className:"h-[14px]"}):null,children:(0,fU.jsx)("div",{ref:l,className:"max-w-[198px] overflow-hidden text-ellipsis",children:r.command_name})})})})},eG5=e=>{var t;let{shortcut:r,onClick:a,uiMode:o,toolTipFooterSlot:i,popoverTipShowBotInfo:n=!1}=e,s=(0,gt.useRef)(null);if(r.send_type!==eTp.SendTypePanel)return null;let l=eq0(r);return(0,fU.jsx)("div",{className:eG1({color:o}),children:(0,fU.jsx)(eG4,{shortcut:r,toolTipFooterSlot:i,showBotInfo:n,children:(0,fU.jsx)(Xg,{"data-testid":`chat-area.chat-input-shortcut.shortcut-button-${r.command_name}`,contentClassName:eG0({color:o}),color:"secondary",icon:(null==(t=r.shortcut_icon)?void 0:t.url)?(0,fU.jsx)("img",{alt:"icon",src:r.shortcut_icon.url,className:"h-[14px]"}):null,iconPosition:"left",onClick:()=>void(null==a||a()),children:(0,fU.jsxs)("div",{className:"inline-flex items-center",children:[(0,fU.jsx)("div",{ref:s,className:"max-w-[176px] overflow-hidden text-ellipsis",children:r.command_name}),!l&&(0,fU.jsx)(eOq,{className:"ml-[10px]"})]})})})})},eG7=i.p+"ba11c4f0391a6ae014e026de7efcc49f.svg",eG8=i.p+"c1f18e5afaa58a61117f9c998e357cfa.svg",eG9=e=>{let{onOpen:t,uiMode:r,onClose:a,isLoadMoreActive:o}=e;return(0,fU.jsx)("div",{className:yY()(eGO["load-more-shortcut-wrapper"],{[eGO["shortcut-white"]||""]:"white"===r,[eGO["shortcut-blur"]||""]:"blur"===r}),children:(0,fU.jsxs)(eHs,{"data-testid":"chat-area.shortcut.load-more-button",className:yY()(eGO["load-more-button"],eGO["shortcut-button"],{"!coz-mg-primary-pressed":o&&"white"===r}),onClick:()=>{o?null==a||a():null==t||t()},children:[(0,fU.jsx)("span",{className:"mr-1",children:bj.t("More")}),o?(0,fU.jsx)("img",{className:"arraw-icon",src:eG7,alt:"up"}):(0,fU.jsx)("img",{className:"arraw-icon",src:eG8,alt:"down"})]})})};var eKe=i(79060),eKt={};eKt.styleTagTransform=yj(),eKt.setAttributes=yB(),eKt.insert=yI().bind(null,"head"),eKt.domAPI=yO(),eKt.insertStyleElement=yH(),yC()(eKe.A,eKt);let eKr=eKe.A&&eKe.A.locals?eKe.A.locals:void 0,eKa=e=>{let t,{shortcuts:r,onActiveShortcutChange:a,className:o,wrapperClassName:i,defaultId:n,uiMode:s="white",wrapperStyle:l,toolTipFooterSlot:c,onBeforeSendTemplateShortcut:d,onBeforeSendTextMessage:u,popoverTipShowBotInfo:p=!1}=e,h=(0,gt.useRef)(null),[m,f]=(0,gt.useState)(!1),[g,_]=(0,gt.useState)(void 0),[b,v]=(0,gt.useState)(!1),y=(t=eM3(),e=>{var r;let a,{shortcut:o,options:i,componentsFormValues:n,onBeforeSendTemplateShortcut:s,withoutComponentsList:l=!1}=e,{tool_type:c}=o,d=eGj(o,n,l),u=void 0!==c&&[eTh.ToolTypeWorkFlow,eTh.ToolTypePlugin].includes(c)?((e,t)=>{let{plugin_id:r,plugin_api_name:a,components_list:o,tool_info:{tool_params_list:i}={}}=e,n=eGN(t,e=>{let{fileInstance:t,url:r}=e;return{value:r,resource_type:t?"uri":""}},e=>({value:e,resource_type:""})),s=(i??[]).reduce((e,t)=>{var r;let{default_value:a,name:i,refer_component:s}=t;if(!i)return e;if(!s)return e[i]={value:a??"",resource_type:""},e;let l=null==o||null==(r=o.find(e=>e.parameter===i))?void 0:r.name,c=l&&n[l];return c&&(e[i]=c),e},{});return Object.keys(s).length?{shortcut_cmd_id:e.command_id,toolList:[{plugin_id:r,api_name:a??"",parameters:s}]}:{shortcut_cmd_id:e.command_id,toolList:[]}})(o,n):{},p=Object.keys(a=n).reduce((e,t)=>{let r=a[t];return eGU(r)?e.push({type:eny.File,file:r.fileInstance,uri:r.url}):eGV(r)&&e.push({type:eny.Image,file:r.fileInstance,uri:r.url,width:r.width||0,height:r.height||0}),e},[]),h={payload:{mixList:[{type:eny.Text,text:d||" "},...p],mention_list:[]}},m=WU({extendFiled:{...u,device_id:String(eMU.deviceId)}},i),f=(null==s?void 0:s({message:enS(h),options:enS(m),shortcut:o}))||{message:h,options:m};t(f.message??h,"shortcut",f.options),eGB(eGP.shortcut_use,{tool_type:c,use_components:!!(null==(r=o.components_list)?void 0:r.length),show_panel:!eq0(o)})}),T=eTi().messageWidth,k=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];_(e);let r=(null==e?void 0:e.send_type)===eTp.SendTypePanel&&!t;null==a||a(e,r),v(r)},w=e=>{let t=eq0(e);t&&x((e=>{var t;let{tool_params_list:r,tool_name:a}=(null==e?void 0:e.tool_info)??{};return a?(null==r?void 0:r.length)?r.reduce((e,t)=>{let r=t.name,a=null==t?void 0:t.default_value;return r&&a&&(e[r]=a),e},{}):{}:(null==e||null==(t=e.components_list)?void 0:t.length)?e.components_list.reduce((e,t)=>{let r=t.name,{value:a}=(null==t?void 0:t.default_value)??{};return r&&a&&(e[r]=a),e},{}):{}})(e),e),k(e,t),f(!1)},Q=()=>{v(!1),k(void 0)},x=(e,t)=>{if(!t)return;let{agent_id:r,object_id:a,components_list:o,tool_info:i}=t,n=!!(null==i?void 0:i.tool_name)&&!(null==o?void 0:o.length);y({shortcut:t,options:{extendFiled:{extra:{bot_state:JSON.stringify({agent_id:r,bot_id:a})}}},componentsFormValues:e,onBeforeSendTemplateShortcut:d,withoutComponentsList:n}),Q()};return(null==r?void 0:r.length)?b&&g?(0,fU.jsx)(eGS,{shortcut:g,onSubmit:e=>{if(!g)return;let{agent_id:t,object_id:r}=g;y({shortcut:g,options:{extendFiled:{extra:{bot_state:JSON.stringify({agent_id:t,bot_id:r})}}},componentsFormValues:e,onBeforeSendTemplateShortcut:d}),Q()},visible:b,onClose:()=>{k(void 0)}}):(0,fU.jsx)("div",{className:yY()(eKr["shortcut-bar"],o,"flex justify-center items-center w-full"),children:(0,fU.jsx)(wp,{content:(0,fU.jsx)(eGJ,{defaultId:n,shortcuts:r,onBeforeSendTextMessage:u,onSelect:w}),onVisibleChange:f,position:"topLeft",trigger:"custom",visible:m,spacing:{x:0,y:9},getPopupContainer:()=>h.current||document.body,onClickOutSide:()=>f(!1),onEscKeyDown:()=>f(!1),children:(0,fU.jsx)("div",{ref:h,className:yY()(i,"relative flex justify-start pb-4"),style:{maxWidth:T,...l},children:(0,fU.jsx)(Hi,{style:{width:"100%"},minVisibleItems:1,items:r,visibleItemRenderer:e=>(0,fU.jsxs)(fU.Fragment,{children:[e.send_type===eTp.SendTypeQuery&&(0,fU.jsx)(eG6,{uiMode:s,shortcut:e,onBeforeSend:u,toolTipFooterSlot:c,popoverTipShowBotInfo:p,onClick:()=>w(e)},e.command_id),e.send_type===eTp.SendTypePanel&&(0,fU.jsx)(eG5,{uiMode:s,shortcut:e,toolTipFooterSlot:c,popoverTipShowBotInfo:p,onClick:()=>w(e)},e.command_id)]}),overflowRenderer:e=>e.length?(0,fU.jsx)(eG9,{uiMode:s,isLoadMoreActive:m,shortcuts:r,onOpen:()=>f(!0),onClose:()=>f(!1),getPopupContainer:()=>h.current}):null})})})}):null};function eKo(e){let t=null;return()=>(null==t&&(t=e()),t)}class eKi{enter(e){var t,r;let a,o,i,n=this.entered.length,s=t=>this.isNodeInDocument(t)&&(!t.contains||t.contains(e));return this.entered=(t=this.entered.filter(s),r=[e],a=new Set,o=e=>a.add(e),t.forEach(o),r.forEach(o),i=[],a.forEach(e=>i.push(e)),i),0===n&&this.entered.length>0}leave(e){var t;let r=this.entered.length;return this.entered=(t=this.entered.filter(this.isNodeInDocument),t.filter(t=>t!==e)),r>0&&0===this.entered.length}reset(){this.entered=[]}constructor(e){this.entered=[],this.isNodeInDocument=e}}class eKn{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(e=>{Object.defineProperty(this.item,e,{configurable:!0,enumerable:!0,get:()=>(console.warn(`Browser doesn't allow reading "${e}" until the drop event.`),null)})})}loadDataTransfer(e){if(e){let t={};Object.keys(this.config.exposeProperties).forEach(r=>{let a=this.config.exposeProperties[r];null!=a&&(t[r]={value:a(e,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,t)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(e,t){return t===e.getSourceId()}endDrag(){}constructor(e){this.config=e,this.item={},this.initializeExposedProperties()}}let eKs="__NATIVE_FILE__",eKl="__NATIVE_URL__",eKc="__NATIVE_TEXT__",eKd="__NATIVE_HTML__";function eKu(e,t,r){let a=t.reduce((t,r)=>t||e.getData(r),"");return null!=a?a:r}let eKp={[eKs]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[eKd]:{exposeProperties:{html:(e,t)=>eKu(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[eKl]:{exposeProperties:{urls:(e,t)=>eKu(e,t,"").split("\n"),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[eKc]:{exposeProperties:{text:(e,t)=>eKu(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function eKh(e){if(!e)return null;let t=Array.prototype.slice.call(e.types||[]);return Object.keys(eKp).filter(e=>{let r=eKp[e];return!!(null==r?void 0:r.matchesTypes)&&r.matchesTypes.some(e=>t.indexOf(e)>-1)})[0]||null}let eKm=eKo(()=>/firefox/i.test(navigator.userAgent)),eKf=eKo(()=>!!window.safari);class eKg{interpolate(e){let t,{xs:r,ys:a,c1s:o,c2s:i,c3s:n}=this,s=r.length-1;if(e===r[s])return a[s];let l=0,c=n.length-1;for(;l<=c;){let o=r[t=Math.floor(.5*(l+c))];if(o<e)l=t+1;else{if(!(o>e))return a[t];c=t-1}}let d=e-r[s=Math.max(0,c)],u=d*d;return a[s]+o[s]*d+i[s]*u+n[s]*d*u}constructor(e,t){let r,a,o;const{length:i}=e,n=[];for(let e=0;e<i;e++)n.push(e);n.sort((t,r)=>e[t]<e[r]?-1:1);const s=[],l=[],c=[];for(let o=0;o<i-1;o++)r=e[o+1]-e[o],a=t[o+1]-t[o],l.push(r),s.push(a),c.push(a/r);const d=[c[0]];for(let e=0;e<l.length-1;e++){const t=c[e],a=c[e+1];if(t*a<=0)d.push(0);else{r=l[e];const o=l[e+1],i=r+o;d.push(3*i/((i+o)/t+(i+r)/a))}}d.push(c[c.length-1]);const u=[],p=[];for(let e=0;e<d.length-1;e++){o=c[e];const t=d[e],r=1/l[e],a=t+d[e+1]-o-o;u.push((o-t-a)*r),p.push(a*r*r)}this.xs=e,this.ys=t,this.c1s=d,this.c2s=u,this.c3s=p}}function eK_(e){let t=1===e.nodeType?e:e.parentElement;if(!t)return null;let{top:r,left:a}=t.getBoundingClientRect();return{x:a,y:r}}function eKb(e){return{x:e.clientX,y:e.clientY}}class eKv{get window(){return this.globalContext?this.globalContext:"undefined"!=typeof window?window:void 0}get document(){var e;return(null==(e=this.globalContext)?void 0:e.document)?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var e;return(null==(e=this.optionsArgs)?void 0:e.rootElement)||this.window}constructor(e,t){this.ownerDocument=null,this.globalContext=e,this.optionsArgs=t}}function eKy(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},a=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),a.forEach(function(t){var a;a=r[t],t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a})}return e}class eKT{profile(){var e,t;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:(null==(e=this.dragStartSourceIds)?void 0:e.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:(null==(t=this.dragOverTargetIds)?void 0:t.length)||0}}get window(){return this.options.window}get document(){return this.options.document}get rootElement(){return this.options.rootElement}setup(){let e=this.rootElement;if(void 0!==e){if(e.__isReactDndBackendSetUp)throw Error("Cannot have two HTML5 backends at the same time.");e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}teardown(){let e=this.rootElement;if(void 0!==e&&(e.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var t;null==(t=this.window)||t.cancelAnimationFrame(this.asyncEndDragFrameId)}}connectDragPreview(e,t,r){return this.sourcePreviewNodeOptions.set(e,r),this.sourcePreviewNodes.set(e,t),()=>{this.sourcePreviewNodes.delete(e),this.sourcePreviewNodeOptions.delete(e)}}connectDragSource(e,t,r){this.sourceNodes.set(e,t),this.sourceNodeOptions.set(e,r);let a=t=>this.handleDragStart(t,e),o=e=>this.handleSelectStart(e);return t.setAttribute("draggable","true"),t.addEventListener("dragstart",a),t.addEventListener("selectstart",o),()=>{this.sourceNodes.delete(e),this.sourceNodeOptions.delete(e),t.removeEventListener("dragstart",a),t.removeEventListener("selectstart",o),t.setAttribute("draggable","false")}}connectDropTarget(e,t){let r=t=>this.handleDragEnter(t,e),a=t=>this.handleDragOver(t,e),o=t=>this.handleDrop(t,e);return t.addEventListener("dragenter",r),t.addEventListener("dragover",a),t.addEventListener("drop",o),()=>{t.removeEventListener("dragenter",r),t.removeEventListener("dragover",a),t.removeEventListener("drop",o)}}addEventListeners(e){e.addEventListener&&(e.addEventListener("dragstart",this.handleTopDragStart),e.addEventListener("dragstart",this.handleTopDragStartCapture,!0),e.addEventListener("dragend",this.handleTopDragEndCapture,!0),e.addEventListener("dragenter",this.handleTopDragEnter),e.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.addEventListener("dragover",this.handleTopDragOver),e.addEventListener("dragover",this.handleTopDragOverCapture,!0),e.addEventListener("drop",this.handleTopDrop),e.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(e){e.removeEventListener&&(e.removeEventListener("dragstart",this.handleTopDragStart),e.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),e.removeEventListener("dragend",this.handleTopDragEndCapture,!0),e.removeEventListener("dragenter",this.handleTopDragEnter),e.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.removeEventListener("dragover",this.handleTopDragOver),e.removeEventListener("dragover",this.handleTopDragOverCapture,!0),e.removeEventListener("drop",this.handleTopDrop),e.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){let e=this.monitor.getSourceId(),t=this.sourceNodeOptions.get(e);return eKy({dropEffect:this.altKeyPressed?"copy":"move"},t||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){let e=this.monitor.getSourceId();return eKy({anchorX:.5,anchorY:.5,captureDraggingState:!1},this.sourcePreviewNodeOptions.get(e)||{})}isDraggingNativeItem(){let e=this.monitor.getItemType();return Object.keys(fN).some(t=>fN[t]===e)}beginDragNativeItem(e,t){this.clearCurrentDragSourceNode(),this.currentNativeSource=function(e,t){let r=eKp[e];if(!r)throw Error(`native type ${e} has no configuration`);let a=new eKn(r);return a.loadDataTransfer(t),a}(e,t),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(e){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e,this.mouseMoveTimeoutTimer=setTimeout(()=>{var e;return null==(e=this.rootElement)?void 0:e.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)},1e3)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var e;null==(e=this.window)||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(e,t){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(t))}handleDragEnter(e,t){this.dragEnterTargetIds.unshift(t)}handleDragOver(e,t){null===this.dragOverTargetIds&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(t)}handleDrop(e,t){this.dropTargetIds.unshift(t)}constructor(e,t,r){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=e=>{let t=this.sourceNodes.get(e);return t&&eK_(t)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=e=>!!(e&&this.document&&this.document.body&&this.document.body.contains(e)),this.endDragIfSourceWasRemovedFromDOM=()=>{let e=this.currentDragSourceNode;null==e||this.isNodeInDocument(e)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=e=>{null===this.hoverRafId&&"undefined"!=typeof requestAnimationFrame&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(e||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{null!==this.hoverRafId&&"undefined"!=typeof cancelAnimationFrame&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=e=>{if(e.defaultPrevented)return;let{dragStartSourceIds:t}=this;this.dragStartSourceIds=null;let r=eKb(e);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(t||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:r});let{dataTransfer:a}=e,o=eKh(a);if(this.monitor.isDragging()){if(a&&"function"==typeof a.setDragImage){let e=this.monitor.getSourceId(),t=this.sourceNodes.get(e),o=this.sourcePreviewNodes.get(e)||t;if(o){let{anchorX:e,anchorY:i,offsetX:n,offsetY:s}=this.getCurrentSourcePreviewNodeOptions(),l=function(e,t,r,a,o){var i;let n,s,l,c="IMG"===t.nodeName&&(eKm()||!(null==(i=document.documentElement)?void 0:i.contains(t))),d=eK_(c?e:t),u={x:r.x-d.x,y:r.y-d.y},{offsetWidth:p,offsetHeight:h}=e,{anchorX:m,anchorY:f}=a,{dragPreviewWidth:g,dragPreviewHeight:_}=(n=c?t.width:p,s=c?t.height:h,eKf()&&c&&(s/=window.devicePixelRatio,n/=window.devicePixelRatio),{dragPreviewWidth:n,dragPreviewHeight:s}),{offsetX:b,offsetY:v}=o;return{x:0===b||b?b:new eKg([0,.5,1],[u.x,u.x/p*g,u.x+g-p]).interpolate(m),y:0===v||v?v:(l=new eKg([0,.5,1],[u.y,u.y/h*_,u.y+_-h]).interpolate(f),eKf()&&c&&(l+=(window.devicePixelRatio-1)*_),l)}}(t,o,r,{anchorX:e,anchorY:i},{offsetX:n,offsetY:s});a.setDragImage(o,l.x,l.y)}}try{null==a||a.setData("application/json",{})}catch(e){}this.setCurrentDragSourceNode(e.target);let{captureDraggingState:t}=this.getCurrentSourcePreviewNodeOptions();t?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(o)this.beginDragNativeItem(o);else{if(a&&!a.types&&(e.target&&!e.target.hasAttribute||!e.target.hasAttribute("draggable")))return;e.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=e=>{if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()){var t;null==(t=this.currentNativeSource)||t.loadDataTransfer(e.dataTransfer)}if(!this.enterLeaveCounter.enter(e.target)||this.monitor.isDragging())return;let{dataTransfer:r}=e,a=eKh(r);a&&this.beginDragNativeItem(a,r)},this.handleTopDragEnter=e=>{let{dragEnterTargetIds:t}=this;this.dragEnterTargetIds=[],!this.monitor.isDragging()||(this.altKeyPressed=e.altKey,t.length>0&&this.actions.hover(t,{clientOffset:eKb(e)}),t.some(e=>this.monitor.canDropOnTarget(e))&&(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())))},this.handleTopDragOverCapture=e=>{if(this.dragOverTargetIds=[],this.isDraggingNativeItem()){var t;null==(t=this.currentNativeSource)||t.loadDataTransfer(e.dataTransfer)}},this.handleTopDragOver=e=>{let{dragOverTargetIds:t}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging()){e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none");return}this.altKeyPressed=e.altKey,this.lastClientOffset=eKb(e),this.scheduleHover(t),(t||[]).some(e=>this.monitor.canDropOnTarget(e))?(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?e.preventDefault():(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=e=>{this.isDraggingNativeItem()&&e.preventDefault(),this.enterLeaveCounter.leave(e.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=e=>{if(this.dropTargetIds=[],this.isDraggingNativeItem()){var t;e.preventDefault(),null==(t=this.currentNativeSource)||t.loadDataTransfer(e.dataTransfer)}else eKh(e.dataTransfer)&&e.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=e=>{let{dropTargetIds:t}=this;this.dropTargetIds=[],this.actions.hover(t,{clientOffset:eKb(e)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=e=>{let t=e.target;"function"!=typeof t.dragDrop||"INPUT"===t.tagName||"SELECT"===t.tagName||"TEXTAREA"===t.tagName||t.isContentEditable||(e.preventDefault(),t.dragDrop())},this.options=new eKv(t,r),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new eKi(this.isNodeInDocument)}}let eKk=function(e,t,r){return new eKT(e,t,r)};function eKw(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var eKQ="function"==typeof Symbol&&Symbol.observable||"@@observable",eKx=function(){return Math.random().toString(36).substring(7).split("").join(".")},eKz={INIT:"@@redux/INIT"+eKx(),REPLACE:"@@redux/REPLACE"+eKx(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+eKx()}};function eKA(e,t,...r){if("undefined"!=typeof process&&void 0===t)throw Error("invariant requires an error message argument");if(!e){let e;if(void 0===t)e=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let a=0;(e=Error(t.replace(/%s/g,function(){return r[a++]}))).name="Invariant Violation"}throw e.framesToPop=1,e}}function eKE(e){return"object"==typeof e}let eKD="dnd-core/INIT_COORDS",eKS="dnd-core/BEGIN_DRAG",eKC="dnd-core/PUBLISH_DRAG_SOURCE",eKL="dnd-core/HOVER",eKO="dnd-core/DROP",eKM="dnd-core/END_DRAG";function eKI(e,t){return{type:eKD,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}let eKP={type:eKD,payload:{clientOffset:null,sourceClientOffset:null}};function eKB(e,t){return null===t?null===e:Array.isArray(e)?e.some(e=>e===t):e===t}class eKR{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){var e,t,r,a,o;let i=this,{dispatch:n}=this.store,s={beginDrag:(e=this,function(t=[],r={publishSource:!0}){var a,o,i;let{publishSource:n=!0,clientOffset:s,getSourceClientOffset:l}=r,c=e.getMonitor(),d=e.getRegistry();e.dispatch(eKI(s)),a=t,o=c,i=d,eKA(!o.isDragging(),"Cannot call beginDrag while dragging."),a.forEach(function(e){eKA(i.getSource(e),"Expected sourceIds to be registered.")});let u=function(e,t){let r=null;for(let a=e.length-1;a>=0;a--)if(t.canDragSource(e[a])){r=e[a];break}return r}(t,c);if(null==u)return void e.dispatch(eKP);let p=null;if(s){if(!l)throw Error("getSourceClientOffset must be defined");eKA("function"==typeof l,"When clientOffset is provided, getSourceClientOffset must be a function."),p=l(u)}e.dispatch(eKI(s,p));let h=d.getSource(u).beginDrag(c,u);if(null!=h)return eKA(eKE(h),"Item must be an object."),d.pinSource(u),{type:eKS,payload:{itemType:d.getSourceType(u),item:h,sourceId:u,clientOffset:s||null,sourceClientOffset:p||null,isSourcePublic:!!n}}}),publishDragSource:(t=this,function(){if(t.getMonitor().isDragging())return{type:eKC}}),hover:(r=this,function(e,{clientOffset:t}={}){var a,o,i;eKA(Array.isArray(e),"Expected targetIds to be an array.");let n=e.slice(0),s=r.getMonitor(),l=r.getRegistry();return function(e,t,r){for(let a=e.length-1;a>=0;a--){let o=e[a];eKB(t.getTargetType(o),r)||e.splice(a,1)}}(n,l,s.getItemType()),function(e,t,r){eKA(t.isDragging(),"Cannot call hover while not dragging."),eKA(!t.didDrop(),"Cannot call hover after drop.");for(let t=0;t<e.length;t++){let a=e[t];eKA(e.lastIndexOf(a)===t,"Expected targetIds to be unique in the passed array."),eKA(r.getTarget(a),"Expected targetIds to be registered.")}}(n,s,l),a=n,o=s,i=l,a.forEach(function(e){i.getTarget(e).hover(o,e)}),{type:eKL,payload:{targetIds:n,clientOffset:t||null}}}),drop:(a=this,function(e={}){var t,r;let o,i=a.getMonitor(),n=a.getRegistry();eKA((t=i).isDragging(),"Cannot call drop while not dragging."),eKA(!t.didDrop(),"Cannot call drop twice during one drag operation."),((o=(r=i).getTargetIds().filter(r.canDropOnTarget,r)).reverse(),o).forEach((t,r)=>{var o,s,l,c,d;let u,p,h={type:eKO,payload:{dropResult:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},a=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),a.forEach(function(t){var a;a=r[t],t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a})}return e}({},e,(o=t,s=r,l=n,c=i,eKA(void 0===(d=p=(u=l.getTarget(o))?u.drop(c,o):void 0)||eKE(d),"Drop result must either be an object or undefined."),void 0===p&&(p=0===s?{}:c.getDropResult()),p))}};a.dispatch(h)})}),endDrag:(o=this,function(){let e=o.getMonitor(),t=o.getRegistry();eKA(e.isDragging(),"Cannot call endDrag while not dragging.");let r=e.getSourceId();return null!=r&&(t.getSource(r,!0).endDrag(e,r),t.unpinSource()),{type:eKM}})};return Object.keys(s).reduce((e,t)=>{let r=s[t];return e[t]=(...e)=>{let t=r.apply(i,e);void 0!==t&&n(t)},e},{})}dispatch(e){this.store.dispatch(e)}constructor(e,t){this.isSetUp=!1,this.handleRefCountChange=()=>{let e=this.store.getState().refCount>0;this.backend&&(e&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!e&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=t,e.subscribe(this.handleRefCountChange)}}function eKH(e,t){return{x:e.x-t.x,y:e.y-t.y}}let eKF=[],eKj=[];eKF.__IS_NONE__=!0,eKj.__IS_ALL__=!0;class eKN{subscribeToStateChange(e,t={}){let{handlerIds:r}=t;eKA("function"==typeof e,"listener must be a function."),eKA(void 0===r||Array.isArray(r),"handlerIds, when specified, must be an array of strings.");let a=this.store.getState().stateId,o=()=>{let t=this.store.getState(),o=t.stateId;try{o===a||o===a+1&&!function(e,t){return e!==eKF&&(e===eKj||void 0===t||t.filter(t=>e.indexOf(t)>-1).length>0)}(t.dirtyHandlerIds,r)||e()}finally{a=o}};return this.store.subscribe(o)}subscribeToOffsetChange(e){eKA("function"==typeof e,"listener must be a function.");let t=this.store.getState().dragOffset,r=()=>{let r=this.store.getState().dragOffset;r!==t&&(t=r,e())};return this.store.subscribe(r)}canDragSource(e){if(!e)return!1;let t=this.registry.getSource(e);return eKA(t,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()&&t.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;let t=this.registry.getTarget(e);return eKA(t,`Expected to find a valid target. targetId=${e}`),!(!this.isDragging()||this.didDrop())&&eKB(this.registry.getTargetType(e),this.getItemType())&&t.canDrop(this,e)}isDragging(){return!!this.getItemType()}isDraggingSource(e){if(!e)return!1;let t=this.registry.getSource(e,!0);return eKA(t,`Expected to find a valid source. sourceId=${e}`),!!this.isDragging()&&!!this.isSourcePublic()&&this.registry.getSourceType(e)===this.getItemType()&&t.isDragging(this,e)}isOverTarget(e,t={shallow:!1}){if(!e)return!1;let{shallow:r}=t;if(!this.isDragging())return!1;let a=this.registry.getTargetType(e),o=this.getItemType();if(o&&!eKB(a,o))return!1;let i=this.getTargetIds();if(!i.length)return!1;let n=i.indexOf(e);return r?n===i.length-1:n>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return function(e){let{clientOffset:t,initialClientOffset:r,initialSourceClientOffset:a}=e;return t&&r&&a?eKH({x:t.x+a.x,y:t.y+a.y},r):null}(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return function(e){let{clientOffset:t,initialClientOffset:r}=e;return t&&r?eKH(t,r):null}(this.store.getState().dragOffset)}constructor(e,t){this.store=e,this.registry=t}}let eKU="undefined"!=typeof global?global:self,eKV=eKU.MutationObserver||eKU.WebKitMutationObserver;function eKq(e){return function(){let t=setTimeout(a,0),r=setInterval(a,50);function a(){clearTimeout(t),clearInterval(r),e()}}}let eKG="function"==typeof eKV?function(e){let t=1,r=new eKV(e),a=document.createTextNode("");return r.observe(a,{characterData:!0}),function(){a.data=t=-t}}:eKq;class eKK{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,t){this.onError=e,this.release=t,this.task=null}}let eKW=new class{enqueueTask(e){let{queue:t,requestFlush:r}=this;t.length||(r(),this.flushing=!0),t[t.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{let{queue:e}=this;for(;this.index<e.length;){let t=this.index;if(this.index++,e[t].call(),this.index>this.capacity){for(let t=0,r=e.length-this.index;t<r;t++)e[t]=e[t+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=eKG(this.flush),this.requestErrorThrow=eKq(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}},eKZ=new class{create(e){let t=this.freeTasks,r=t.length?t.pop():new eKK(this.onError,e=>t[t.length]=e);return r.task=e,r}constructor(e){this.onError=e,this.freeTasks=[]}}(eKW.registerPendingError),eKX="dnd-core/ADD_SOURCE",eKY="dnd-core/ADD_TARGET",eK$="dnd-core/REMOVE_SOURCE",eKJ="dnd-core/REMOVE_TARGET";function eK1(e,t){t&&Array.isArray(e)?e.forEach(e=>eK1(e,!1)):eKA("string"==typeof e||"symbol"==typeof e,t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}(eK=fR||(fR={})).SOURCE="SOURCE",eK.TARGET="TARGET";let eK0=0;function eK2(e){switch(e[0]){case"S":return fR.SOURCE;case"T":return fR.TARGET;default:throw Error(`Cannot parse handler ID: ${e}`)}}function eK3(e,t){let r=e.entries(),a=!1;do{let{done:e,value:[,o]}=r.next();if(o===t)return!0;a=!!e}while(!a);return!1}class eK4{addSource(e,t){eK1(e),eKA("function"==typeof t.canDrag,"Expected canDrag to be a function."),eKA("function"==typeof t.beginDrag,"Expected beginDrag to be a function."),eKA("function"==typeof t.endDrag,"Expected endDrag to be a function.");let r=this.addHandler(fR.SOURCE,e,t);return this.store.dispatch({type:eKX,payload:{sourceId:r}}),r}addTarget(e,t){eK1(e,!0),eKA("function"==typeof t.canDrop,"Expected canDrop to be a function."),eKA("function"==typeof t.hover,"Expected hover to be a function."),eKA("function"==typeof t.drop,"Expected beginDrag to be a function.");let r=this.addHandler(fR.TARGET,e,t);return this.store.dispatch({type:eKY,payload:{targetId:r}}),r}containsHandler(e){return eK3(this.dragSources,e)||eK3(this.dropTargets,e)}getSource(e,t=!1){return eKA(this.isSourceId(e),"Expected a valid source ID."),t&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return eKA(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return eKA(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return eKA(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return eK2(e)===fR.SOURCE}isTargetId(e){return eK2(e)===fR.TARGET}removeSource(e){var t;eKA(this.getSource(e),"Expected an existing source."),this.store.dispatch({type:eK$,payload:{sourceId:e}}),t=()=>{this.dragSources.delete(e),this.types.delete(e)},eKW.enqueueTask(eKZ.create(t))}removeTarget(e){eKA(this.getTarget(e),"Expected an existing target."),this.store.dispatch({type:eKJ,payload:{targetId:e}}),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){let t=this.getSource(e);eKA(t,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=t}unpinSource(){eKA(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,t,r){let a=function(e){let t=(eK0++).toString();switch(e){case fR.SOURCE:return`S${t}`;case fR.TARGET:return`T${t}`;default:throw Error(`Unknown Handler Role: ${e}`)}}(e);return this.types.set(a,t),e===fR.SOURCE?this.dragSources.set(a,r):e===fR.TARGET&&this.dropTargets.set(a,r),a}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}}let eK6={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function eK5(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},a=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),a.forEach(function(t){var a;a=r[t],t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a})}return e}let eK7={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function eK8(e={},t){var r;return{dirtyHandlerIds:function(e=eKF,t){let r,a,o;switch(t.type){case eKL:break;case eKX:case eKY:case eKJ:case eK$:return eKF;default:return eKj}let{targetIds:i=[],prevTargetIds:n=[]}=t.payload,s=(r=new Map,a=e=>{r.set(e,r.has(e)?r.get(e)+1:1)},i.forEach(a),n.forEach(a),o=[],r.forEach((e,t)=>{1===e&&o.push(t)}),o);if(!(s.length>0||!function(e,t,r=(e,t)=>e===t){if(e.length!==t.length)return!1;for(let a=0;a<e.length;++a)if(!r(e[a],t[a]))return!1;return!0}(i,n)))return eKF;let l=n[n.length-1],c=i[i.length-1];return l!==c&&(l&&s.push(l),c&&s.push(c)),s}(e.dirtyHandlerIds,{type:t.type,payload:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},a=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),a.forEach(function(t){var a;a=r[t],t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a})}return e}({},t.payload,{prevTargetIds:(r=[],"dragOperation.targetIds".split(".").reduce((e,t)=>e&&e[t]?e[t]:r||null,e))})}),dragOffset:function(e=eK6,t){let{payload:r}=t;switch(t.type){case eKD:case eKS:return{initialSourceClientOffset:r.sourceClientOffset,initialClientOffset:r.clientOffset,clientOffset:r.clientOffset};case eKL:var a,o;if(a=e.clientOffset,o=r.clientOffset,!a&&!o||a&&o&&a.x===o.x&&a.y===o.y)return e;return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},a=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),a.forEach(function(t){var a;a=r[t],t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a})}return e}({},e,{clientOffset:r.clientOffset});case eKM:case eKO:return eK6;default:return e}}(e.dragOffset,t),refCount:function(e=0,t){switch(t.type){case eKX:case eKY:return e+1;case eK$:case eKJ:return e-1;default:return e}}(e.refCount,t),dragOperation:function(e=eK7,t){let{payload:r}=t;switch(t.type){case eKS:return eK5({},e,{itemType:r.itemType,item:r.item,sourceId:r.sourceId,isSourcePublic:r.isSourcePublic,dropResult:null,didDrop:!1});case eKC:return eK5({},e,{isSourcePublic:!0});case eKL:return eK5({},e,{targetIds:r.targetIds});case eKJ:var a,o;if(-1===e.targetIds.indexOf(r.targetId))return e;return eK5({},e,{targetIds:(a=e.targetIds,o=r.targetId,a.filter(e=>e!==o))});case eKO:return eK5({},e,{dropResult:r.dropResult,didDrop:!0,targetIds:[]});case eKM:return eK5({},e,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return e}}(e.dragOperation,t),stateId:function(e=0){return e+1}(e.stateId)}}let eK9=(0,gt.createContext)({dragDropManager:void 0}),eWe=0,eWt=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var eWr=(0,gt.memo)(function(e){var t,{children:r}=e;let[a,o]="manager"in(t=function(e,t){if(null==e)return{};var r,a,o=function(e,t){if(null==e)return{};var r,a,o={},i=Object.keys(e);for(a=0;a<i.length;a++)r=i[a],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,["children"]))?[{dragDropManager:t.manager},!1]:[function(e,t=eWa(),r,a){return t[eWt]||(t[eWt]={dragDropManager:function(e,t,r={},a=!1){var o;let i,n=(o=a,i="undefined"!=typeof window&&window.__REDUX_DEVTOOLS_EXTENSION__,function e(t,r,a){if("function"==typeof r&&"function"==typeof a||"function"==typeof a&&"function"==typeof arguments[3])throw Error(eKw(0));if("function"==typeof r&&void 0===a&&(a=r,r=void 0),void 0!==a){if("function"!=typeof a)throw Error(eKw(1));return a(e)(t,r)}if("function"!=typeof t)throw Error(eKw(2));var o,i=t,n=r,s=[],l=s,c=!1;function d(){l===s&&(l=s.slice())}function u(){if(c)throw Error(eKw(3));return n}function p(e){if("function"!=typeof e)throw Error(eKw(4));if(c)throw Error(eKw(5));var t=!0;return d(),l.push(e),function(){if(t){if(c)throw Error(eKw(6));t=!1,d();var r=l.indexOf(e);l.splice(r,1),s=null}}}function h(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw Error(eKw(7));if(void 0===e.type)throw Error(eKw(8));if(c)throw Error(eKw(9));try{c=!0,n=i(n,e)}finally{c=!1}for(var t=s=l,r=0;r<t.length;r++)(0,t[r])();return e}return h({type:eKz.INIT}),(o={dispatch:h,subscribe:p,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw Error(eKw(10));i=e,h({type:eKz.REPLACE})}})[eKQ]=function(){var e;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw Error(eKw(11));function t(){e.next&&e.next(u())}return t(),{unsubscribe:p(t)}}})[eKQ]=function(){return this},e},o}(eK8,o&&i&&i({name:"dnd-core",instanceId:"dnd-core"}))),s=new eKN(n,new eK4(n)),l=new eKR(n,s),c=e(l,t,r);return l.receiveBackend(c),l}(e,t,r,a)}),t[eWt]}(t.backend,t.context,t.options,t.debugMode),!t.context];return(0,gt.useEffect)(()=>{if(o){let e=eWa();return++eWe,()=>{0==--eWe&&(e[eWt]=null)}}},[]),(0,fU.jsx)(eK9.Provider,{value:a,children:r})});function eWa(){return"undefined"!=typeof global?global:window}let eWo=(0,gt.createContext)({isInProvider:!1}),eWi=e=>{let{children:t}=e,r=(0,gt.useContext)(eWo);return(0,fU.jsx)(eWo.Provider,{value:{isInProvider:!0},children:r.isInProvider?t:(0,fU.jsx)(eWr,{backend:eKk,context:window,children:t})})},eWn={color:"var(--semi-color-primary-hover)"},eWs=e=>(0,fU.jsxs)("span",{style:eWn,children:["{{",e,"}}"]});eWs(bj.t("shortcut_modal_query_message_hover_tip_component_mode_var1")),eWs(bj.t("shortcut_modal_query_message_hover_tip_component_mode_var2"));var eWl=i(92594),eWc={};eWc.styleTagTransform=yj(),eWc.setAttributes=yB(),eWc.insert=yI().bind(null,"head"),eWc.domAPI=yO(),eWc.insertStyleElement=yH(),yC()(eWl.A,eWc),eWl.A&&eWl.A.locals&&eWl.A.locals;var eWd=i(2321);let eWu="undefined"!=typeof window?gt.useLayoutEffect:gt.useEffect;function eWp(e,t,r){return function(e,t,r){let[a,o]=function(e,t,r){let[a,o]=(0,gt.useState)(()=>t(e)),i=(0,gt.useCallback)(()=>{let i=t(e);!eWd(a,i)&&(o(i),r&&r())},[a,e,r]);return eWu(i),[a,i]}(e,t,r);return eWu(function(){let t=e.getHandlerId();if(null!=t)return e.subscribeToStateChange(o,{handlerIds:[t]})},[e,o]),a}(t,e||(()=>({})),()=>r.reconnect())}function eWh(e,t){let r=[...t||[]];return null==t&&"function"!=typeof e&&r.push(e),(0,gt.useMemo)(()=>"function"==typeof e?e():e,r)}function eWm(e,t,r,a){let o=r?r.call(a,e,t):void 0;if(void 0!==o)return!!o;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;let i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return!1;let s=Object.prototype.hasOwnProperty.bind(t);for(let n=0;n<i.length;n++){let l=i[n];if(!s(l))return!1;let c=e[l],d=t[l];if(!1===(o=r?r.call(a,c,d,l):void 0)||void 0===o&&c!==d)return!1}return!0}function eWf(e){return null!==e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function eWg(e){let t={};return Object.keys(e).forEach(r=>{let a=e[r];if(r.endsWith("Ref"))t[r]=e[r];else{let e=(e=null,t=null)=>{var r,o;let i;return(0,gt.isValidElement)(e)?(!function(e){if("string"==typeof e.type)return;let t=e.type.displayName||e.type.name||"the component";throw Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${t} into a <div>, or turn it into a drag source or a drop target itself.`)}(e),r=e,o=t?e=>a(e,t):a,(eKA("string"!=typeof(i=r.ref),"Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),i)?(0,gt.cloneElement)(r,{ref:e=>{eW_(i,e),eW_(o,e)}}):(0,gt.cloneElement)(r,{ref:o})):(a(e,t),e)};t[r]=()=>e}}),t}function eW_(e,t){"function"==typeof e?e(t):e.current=t}class eWb{get connectTarget(){return this.dropTarget}reconnect(){let e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();let t=this.dropTarget;if(this.handlerId){if(!t){this.lastConnectedDropTarget=t;return}e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=t,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,t,this.dropTargetOptions))}}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!eWm(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=eWg({dropTarget:(e,t)=>{this.clearDropTarget(),this.dropTargetOptions=t,eWf(e)?this.dropTargetRef=e:this.dropTargetNode=e,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}}function eWv(){let{dragDropManager:e}=(0,gt.useContext)(eK9);return eKA(null!=e,"Expected drag drop context"),e}let eWy=!1;class eWT{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}canDrop(){if(!this.targetId)return!1;eKA(!eWy,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return eWy=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{eWy=!1}}isOver(e){return!!this.targetId&&this.internalMonitor.isOverTarget(this.targetId,e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.targetId=null,this.internalMonitor=e.getMonitor()}}class eWk{canDrop(){let e=this.spec,t=this.monitor;return!e.canDrop||e.canDrop(t.getItem(),t)}hover(){let e=this.spec,t=this.monitor;e.hover&&e.hover(t.getItem(),t)}drop(){let e=this.spec,t=this.monitor;if(e.drop)return e.drop(t.getItem(),t)}constructor(e,t){this.spec=e,this.monitor=t}}class eWw{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){let e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){let e=this.dragSource,t=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return t&&this.disconnectDragSource(),this.handlerId&&(e?t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)):this.lastConnectedDragSource=e),t}reconnectDragPreview(e=!1){let t=this.dragPreview,r=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(r&&this.disconnectDragPreview(),this.handlerId){if(!t){this.lastConnectedDragPreview=t;return}r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=t,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,t,this.dragPreviewOptions))}}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!eWm(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!eWm(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(e){this.hooks=eWg({dragSource:(e,t)=>{this.clearDragSource(),this.dragSourceOptions=t||null,eWf(e)?this.dragSourceRef=e:this.dragSourceNode=e,this.reconnectDragSource()},dragPreview:(e,t)=>{this.clearDragPreview(),this.dragPreviewOptions=t||null,eWf(e)?this.dragPreviewRef=e:this.dragPreviewNode=e,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=e}}let eWQ=!1,eWx=!1;class eWz{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){eKA(!eWQ,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return eWQ=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{eWQ=!1}}isDragging(){if(!this.sourceId)return!1;eKA(!eWx,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return eWx=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{eWx=!1}}subscribeToStateChange(e,t){return this.internalMonitor.subscribeToStateChange(e,t)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,t){return this.internalMonitor.isOverTarget(e,t)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}}class eWA{beginDrag(){let e=this.spec,t=this.monitor,r=null;return null!=(r="object"==typeof e.item?e.item:"function"==typeof e.item?e.item(t):{})?r:null}canDrag(){let e=this.spec,t=this.monitor;return"boolean"==typeof e.canDrag?e.canDrag:"function"!=typeof e.canDrag||e.canDrag(t)}isDragging(e,t){let r=this.spec,a=this.monitor,{isDragging:o}=r;return o?o(a):t===e.getSourceId()}endDrag(){let e=this.spec,t=this.monitor,r=this.connector,{end:a}=e;a&&a(t.getItem(),t),r.reconnect()}constructor(e,t,r){this.spec=e,this.monitor=t,this.connector=r}}eTu.TextInput,eTu.Select;var eWE=i(32745),eWD={};eWD.styleTagTransform=yj(),eWD.setAttributes=yB(),eWD.insert=yI().bind(null,"head"),eWD.domAPI=yO(),eWD.insertStyleElement=yH(),yC()(eWE.A,eWD),eWE.A&&eWE.A.locals&&eWE.A.locals;let{Checkbox:eWS,CheckboxGroup:eWC}=eeF;eTu.UploadImage,eTu.UploadAudio,eTu.UploadDoc,eTu.UploadTable,eTu.CODE,eTu.ARCHIVE,eTu.PPT,eTu.VIDEO,eTu.TXT;let eWL=e=>{let{id:t,type:r,data:a,itemRender:o,enabled:i,onMove:n,direction:s}=e,l=(e=>{var t,r,a;let o,i,n,s,l,c,d,u,p,h,m,f,g,_,b,v,y,T,k,w,{id:Q,type:x,direction:z="verticle",enabled:A=!0,onMove:E}=e,D=(0,gt.useRef)(),S=(0,gt.useRef)(A);S.current=A;let[{isHovered:C},L]=(o=eWh({accept:x,collect:e=>({isHovered:e.isOver()}),canDrop:()=>S.current,hover:(e,t)=>{var r;if(!D.current||e.id===Q)return;let a=t.getClientOffset(),o=null==(r=D.current)?void 0:r.getBoundingClientRect(),i=!1;if("verticle"===z){if((null==a?void 0:a.y)===void 0)return;let t=(o.top+o.bottom)/2;i=(null==a?void 0:a.y)<t,E(e.id,Q,i)}if("horizontal"===z){if((null==a?void 0:a.x)===void 0)return;let t=(o.left+o.right)/2;i=(null==a?void 0:a.x)<t,E(e.id,Q,i)}}},void 0),i=eWv(),n=(0,gt.useMemo)(()=>new eWT(i),[i]),t=o.options,s=eWv(),l=(0,gt.useMemo)(()=>new eWb(s.getBackend()),[s]),eWu(()=>(l.dropTargetOptions=t||null,l.reconnect(),()=>l.disconnectDropTarget()),[t]),c=l,d=eWv(),u=(0,gt.useMemo)(()=>new eWk(o,n),[n]),(0,gt.useEffect)(()=>{u.spec=o},[o]),eWu(function(){let e,t,[r,a]=[t=(e=d.getRegistry()).addTarget(h,p),()=>e.removeTarget(t)];return n.receiveHandlerId(r),c.receiveHandlerId(r),a},[d,n,p=u,c,(h=function(e){let{accept:t}=e;return(0,gt.useMemo)(()=>(eKA(null!=e.accept,"accept must be defined"),Array.isArray(t)?t:[t]),[t])}(o)).map(e=>e.toString()).join("|")]),[eWp(o.collect,n,c),(0,gt.useMemo)(()=>c.hooks.dropTarget(),[c])]),[{isDragging:O},M,I]=(eKA(!(m=eWh({type:x,item:()=>({id:Q}),canDrag:()=>S.current,collect:e=>({isDragging:e.isDragging()})},void 0)).begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)"),f=eWv(),g=(0,gt.useMemo)(()=>new eWz(f),[f]),r=m.options,a=m.previewOptions,_=eWv(),eWu(()=>(b.dragSourceOptions=r||null,b.reconnect(),()=>b.disconnectDragSource()),[b=(0,gt.useMemo)(()=>new eWw(_.getBackend()),[_]),r]),eWu(()=>(b.dragPreviewOptions=a||null,b.reconnect(),()=>b.disconnectDragPreview()),[b,a]),v=b,y=eWv(),T=(0,gt.useMemo)(()=>new eWA(m,g,v),[g,v]),(0,gt.useEffect)(()=>{T.spec=m},[m]),eWu(function(){if(null!=w){let e,t,[r,a]=[t=(e=y.getRegistry()).addSource(w,k),()=>e.removeSource(t)];return g.receiveHandlerId(r),v.receiveHandlerId(r),a}},[y,g,v,k=T,w=(0,gt.useMemo)(()=>{let e=m.type;return eKA(null!=e,"spec.type must be defined"),e},[m])]),[eWp(m.collect,g,v),(0,gt.useMemo)(()=>v.hooks.dragSource(),[v]),(0,gt.useMemo)(()=>v.hooks.dragPreview(),[v])]);return{isHovered:C,isDragging:O,connect:(0,gt.useMemo)(()=>(e,t)=>{L(e),M(t??e),I(e),D.current=e.current},[L,M])}})({id:t,type:r,onMove:n,enabled:i,direction:s});return(0,fU.jsx)(o,{...l,data:a})},eWO=e=>e.id,eWM=e=>{let{list:t,type:r,getId:a=eWO,onChange:o,enabled:i,itemRender:n,direction:s}=e;return(0,fU.jsx)(eWi,{children:t.map(e=>{let l=a(e);return(0,fU.jsx)(eWL,{type:r,id:l,data:e,itemRender:n,enabled:i,direction:s,onMove:(e,r,i)=>{let n=[...t],s=n.findIndex(t=>a(t)===e),l=n.splice(s,1)[0],c=n.findIndex(e=>a(e)===r)+ +!i;s!==c&&(l&&n.splice(c,0,l),o(n))}},l)})})},eWI=Symbol.for("chat-area-plugins-chat-shortcuts-component-options-dnd-list"),eWP=e=>{let{options:t,onChange:r}=e,a=t.length>1,o=(0,gt.useMemo)(()=>e=>{let{data:o,connect:i}=e,n=(0,gt.useRef)(null),s=(0,gt.useRef)(null);return i(n,s),(0,fU.jsxs)("div",{ref:n,className:"flex items-center mb-6 last:mb-0",children:[(0,fU.jsx)(eGe,{className:"flex-1",value:o.value,maxLength:20,onChange:e=>{r(t=>{let r=t.findIndex(e=>e.id===o.id);return t.splice(r,1,{value:e,id:o.id}),[...t]})}}),(0,fU.jsx)("div",{className:"ml-2",ref:s,children:(0,fU.jsx)(Q5,{size:"small",className:a?"cursor-grab":"",icon:(0,fU.jsx)(eOU,{}),disabled:!a,theme:"borderless",type:"tertiary"})}),(0,fU.jsx)("div",{className:"ml-2",children:(0,fU.jsx)(kC,{content:bj.t("Remove"),children:(0,fU.jsx)(Q5,{size:"small",icon:(0,fU.jsx)(eON,{}),type:"tertiary",theme:"borderless",disabled:t.length<=1,onClick:()=>{r(e=>e.filter(e=>e.id!==o.id))}})})})]})},[a]);return(0,fU.jsx)(eWM,{type:eWI,list:t,itemRender:o,onChange:r,enabled:a})};qC(e=>{let{value:t,onChange:r,hasError:a}=e,[o,i]=(0,gt.useState)([]);return(0,gt.useEffect)(()=>{i(((null==t?void 0:t.length)?t:[""]).map(e=>({value:e,id:eqq()})))},[]),(0,gt.useEffect)(()=>{let e=o.map(e=>{var t;return null==(t=e.value)?void 0:t.trim()}).filter(e=>!!e);null==r||r(e)},[o]),(0,fU.jsxs)("div",{className:"flex flex-col items-start",children:[(0,fU.jsx)("div",{className:"coz-fg-plus mb-[14px] font-medium",children:bj.t("shortcut_modal_selector_component_options")}),(0,fU.jsx)("div",{className:"flex justify-between",children:(0,fU.jsx)(eHs,{size:"small",type:"tertiary",theme:"borderless",disabled:o.length>=20,icon:(0,fU.jsx)(eOD,{}),className:"!coz-fg-hglt text-sm font-medium",onClick:()=>{i([...o,{value:"",id:eqq()}])},children:bj.t("shortcut_modal_selector_component_options")})}),(0,fU.jsx)("div",{className:"max-h-40 my-6 overflow-y-auto",children:(0,fU.jsx)(eWP,{options:o,onChange:i})})]})});let{RadioGroup:eWB,Radio:eWR}=eeF;bj.t("shortcut_component_type_text"),bj.t("shortcut_component_type_selector"),bj.t("shortcut_modal_components_modal_upload_component");let{Text:eWH}=TQ;qC(e=>{let{value:t,onSelect:r,...a}=e;return(0,fU.jsx)(HC,{...a,showClear:!!(null==t?void 0:t.value),onClear:()=>{null==r||r({type:eTu.TextInput,value:""})},value:null==t?void 0:t.value,onSelect:e=>{let a={type:(null==t?void 0:t.type)||eTu.TextInput,value:e};return null==r||r(a),a}})},{valueKey:"value",onKeyChangeFnName:"onSelect"}),qC(e=>{let{value:t,onChange:r,...a}=e;return(0,fU.jsx)(eGe,{value:null==t?void 0:t.value,...a,maxLength:100,onChange:e=>{let a={type:(null==t?void 0:t.type)||eTu.TextInput,value:e};return null==r||r(a),a}})},{valueKey:"value",onKeyChangeFnName:"onChange"}),Symbol.for("chat-area-plugins-chat-shortcuts-components-table-item");var eWF=i(85511),eWj={};eWj.styleTagTransform=yj(),eWj.setAttributes=yB(),eWj.insert=yI().bind(null,"head"),eWj.domAPI=yO(),eWj.insertStyleElement=yH(),yC()(eWF.A,eWj),eWF.A&&eWF.A.locals&&eWF.A.locals;var eWN=((eW={}).PLUGIN="plugin",eW.WORKFLOW="workflow",eW.IMAGEFLOW="imageflow",eW.KNOWLEDGE="knowledge",eW.VARIABLE="variable",eW.DATABASE="database",eW.LONG_TERM_MEMORY="longTermMemory",eW.FILE_BOX="fileBox",eW.TRIGGER="trigger",eW.ONBOARDING="onboarding",eW.SUGGEST="suggest",eW.VOICE="voice",eW.BACKGROUND="background",eW.DOCUMENT="document",eW.TABLE="table",eW.PHOTO="photo",eW.SHORTCUT="shortcut",eW.DEV_HOOKS="devHooks",eW.USER_INPUT="userInput",eW),eWU=((eZ={}).PLUGIN="plugin",eZ.WORKFLOW="workflow",eZ.KNOWLEDGE="knowledge",eZ),eWV=((eX={}).SKILL="skill",eX.KNOWLEDGE="knowledge",eX.MEMORY="memory",eX.DIALOG="dialog",eX.HOOKS="hooks",eX.CHARACTER="character",eX);eWN.PLUGIN,eWN.SHORTCUT,eWN.DEV_HOOKS,eWU.PLUGIN,eWN.PLUGIN,eWN.WORKFLOW,eWN.IMAGEFLOW,eWN.DATABASE,eWN.FILE_BOX,eWN.KNOWLEDGE,eWN.ONBOARDING,eWN.SUGGEST,eWN.TRIGGER,eWN.VARIABLE,eWN.VOICE,eWN.LONG_TERM_MEMORY,eWN.BACKGROUND,eWN.TABLE,eWN.DOCUMENT,eWN.PHOTO,eWN.SHORTCUT,eWN.DEV_HOOKS,eWN.USER_INPUT,eWV.SKILL,eWV.KNOWLEDGE,eWV.MEMORY,eWV.DIALOG,eWV.CHARACTER,eWV.HOOKS;let eWq=e=>{var t;let{controller:r,onShortcutActive:a}=e,o=(0,gt.useRef)(void 0),i=ej9(),n=ej8(e=>e.shortcuts),s=null==(t=n.at(0))?void 0:t.command_id;return(null==n?void 0:n.length)?(0,fU.jsx)(eKa,{shortcuts:n,wrapperClassName:yY()("w-full pl-[68px] pr-[24px] pb-[10px]"),uiMode:(e=>{let{bizScene:t,showBackground:r}=e;return"agentApp"===t?"grey":"home"===t?r?"blur":"white":"store"===t||"debug"===t||"websdk"===t?r?"blur":"grey":"white"})({bizScene:"websdk",showBackground:i}),defaultId:s,onActiveShortcutChange:(e,t)=>{o.current=e,r.setChatInputSlotVisible(!t),null==a||a(e)},onBeforeSendTemplateShortcut:e=>{var t,r,a;let{message:o,options:i,shortcut:n}=e,s={};Object.entries((null==i||null==(a=i.extendFiled)||null==(r=a.toolList)||null==(t=r[0])?void 0:t.parameters)||{}).map(e=>{let[t,r]=e;s[t]=r.value});let l=i||{};return l.extendFiled||(l.extendFiled={}),(n.tool_type===eTh.ToolTypePlugin||n.tool_type===eTh.ToolTypeWorkFlow)&&(l.extendFiled.shortcut_command={command_id:n.command_id,parameters:s}),{message:o,options:i}}}):null},eWG=e=>{let{width:t,height:r,className:a}=e;return(0,fU.jsx)(ew7,{svg:(0,fU.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"currentColor",children:(0,fU.jsx)("path",{d:"M13.4997 16.5H4.49881C2.84338 16.5 1.5 15.1574 1.5 13.5013V4.50088C1.5 2.84333 2.84338 1.5 4.49881 1.5H13.4997C15.158 1.5 16.5 2.84331 16.5 4.50088V13.5013C16.5 15.1574 15.158 16.5 13.4997 16.5ZM15.0013 5.25092C15.0013 4.00792 13.9919 3.00008 12.7496 3.00008H5.24889C4.00657 3.00008 2.99864 4.00792 2.99864 5.25092V12.7498C2.99864 13.9943 4.00657 15.0007 5.24889 15.0007H12.7496C13.9919 15.0007 15.0013 13.9943 15.0013 12.7498V5.25092ZM9.74933 11.9997C9.74933 12.414 9.41351 12.7498 8.99925 12.7498C8.585 12.7498 8.24918 12.414 8.24918 11.9997V9.75115H5.99967C5.58503 9.75115 5.24889 9.41502 5.24889 9.00037C5.24889 8.58572 5.58503 8.24958 5.99967 8.24958H8.24918V6.00099C8.24918 5.58674 8.585 5.25092 8.99925 5.25092C9.41351 5.25092 9.74933 5.58674 9.74933 6.001V8.24958H11.9988C12.4135 8.24958 12.7496 8.58572 12.7496 9.00037C12.7496 9.41502 12.4135 9.75115 11.9988 9.75115H9.74933V11.9997Z",fill:"currentColor"})}),className:a,style:{width:t,height:r}})},eWK=()=>{var e,t,r,a,o,i,n,s,l,c,d,u,p,h,m,f,g,_;let{chatConfig:b}=ej7(),v=[],y=[];return console.log("useChatOpInfo:",b),(null==b||null==(t=b.ui)||null==(e=t.header)?void 0:e.isShow)?(null==b||null==(a=b.ui)||null==(r=a.chatBot)?void 0:r.isNeedClearContext)?(v.push("clearContext"),(null==b||null==(i=b.ui)||null==(o=i.chatBot)?void 0:o.isNeedClearMessage)?y.push("clearMessage"):(null==b||null==(s=b.ui)||null==(n=s.chatBot)?void 0:n.isNeedAddNewConversation)&&y.push("addNewConversation")):(null==b||null==(c=b.ui)||null==(l=c.chatBot)?void 0:l.isNeedClearMessage)?v.push("clearMessage"):(null==b||null==(u=b.ui)||null==(d=u.chatBot)?void 0:d.isNeedAddNewConversation)&&v.push("addNewConversation"):((null==b||null==(h=b.ui)||null==(p=h.chatBot)?void 0:p.isNeedClearContext)&&v.push("clearContext"),(null==b||null==(f=b.ui)||null==(m=f.chatBot)?void 0:m.isNeedClearMessage)?v.push("clearMessage"):(null==b||null==(_=b.ui)||null==(g=_.chatBot)?void 0:g.isNeedAddNewConversation)&&v.push("addNewConversation")),{chatInputLeftOps:v,headerTopLeftOps:y}},eWW=e=>{let{isClearHistoryButtonDisabled:t,isClearContextButtonDisabled:r}=eHT({}),{readonly:a}=ej7(),{clearHistory:o}=(()=>{let{useMessagesStore:e,useSelectionStore:t,useOnboardingStore:r}=ey3(),{updateReplyIdList:a,onboardingIdList:o}=t(e=>({updateReplyIdList:e.updateReplyIdList,onboardingIdList:e.onboardingIdList})),{enableSelectOnboarding:i}=eTi(),n=eHk(eMb()),s=eMv(eMb()),l=r(e=>e.prologue),c=eHw(eMb());return{clearHistory:async()=>{n(),await c()},selectAll:t=>{let{maxLength:r,direction:n}=t??{},c=e.getState().messageGroupList.filter(e=>e.selectable).map(e=>e.groupId).filter(e=>!!e);if(Yd(r)||!n)return void a(c);a(("backward"===n?c:c.reverse()).slice(0,r));let d=o.at(0);i&&s({selectedId:d??null,onboarding:{prologue:l}})},unselectAll:n,getMessageList:()=>eMV(e.getState().messages)}})(),i=eHQ();return(0,gt.useMemo)(()=>e.map(e=>"addNewConversation"===e?{icon:(0,fU.jsx)(eWG,{width:"18px",height:"18px"}),text:bj.t("web_sdk_add_new_conversation"),disabled:t||a,onClick:()=>{null==o||o()}}:"clearContext"===e?{icon:(0,fU.jsx)(Zx,{width:"18px",height:"18px"}),text:bj.t("store_start_new_chat"),disabled:r||a,onClick:()=>{i()}}:{icon:(0,fU.jsx)(Ze,{width:"18px",height:"18px"}),text:bj.t("coze_home_delete_btn"),disabled:t||a,onClick:()=>{null==o||o()}}),[e,r,t,a,o,i])};var eWZ=i(67731),eWX={};eWX.styleTagTransform=yj(),eWX.setAttributes=yB(),eWX.insert=yI().bind(null,"head"),eWX.domAPI=yO(),eWX.insertStyleElement=yH(),yC()(eWZ.A,eWX);let eWY=eWZ.A&&eWZ.A.locals?eWZ.A.locals:void 0,eW$=e=>{let{buttonList:t}=e,r=ej9(),[a,o]=(0,gt.useState)(!1),{readonly:i}=ej7();return(0,gt.useEffect)(()=>(document.addEventListener("click",()=>{o(!1)}),()=>{o(!1)}),[]),(0,fU.jsx)($b,{content:(0,fU.jsx)(AA,{className:eWY.container,vertical:!0,spacing:0,children:null==t?void 0:t.map((e,t)=>(0,fU.jsx)(Xg,{color:"secondary",className:eWY.button,icon:null==e?void 0:e.icon,iconPosition:"left",onClick:null==e?void 0:e.onClick,disabled:null==e?void 0:e.disabled,children:null==e?void 0:e.text},t))}),trigger:"custom",visible:a,position:"topLeft",style:{borderRadius:"4px"},children:(0,fU.jsx)(ev4,{"data-testid":"bot-edit-debug-chat-clear-button",showBackground:r,disabled:i,icon:(0,fU.jsx)(W$,{className:"text-18px"}),size:"default",onClick:e=>{e.stopPropagation(),o(e=>!e)},className:yY()("mr-12px","!rounded-full")})})},eWJ=()=>{var e,t;let{chatInputLeftOps:r}=eWK(),a=ej9(),{chatConfig:o}=ej7(),i=(null==(t=o.ui)||null==(e=t.base)?void 0:e.layout)===fW.MOBILE,n=eWW(r);return 0===r.length?null:(0,fU.jsxs)("div",{className:eWY["chat-input-left-slot"],children:[n.length>1?(0,fU.jsx)(eW$,{buttonList:n}):null,1===n.length?(0,fU.jsx)(ebY,{content:n[0].text,hideToolTip:i,children:(0,fU.jsx)(ev4,{"data-testid":"bot-edit-debug-chat-clear-button",showBackground:a,disabled:n[0].disabled,icon:n[0].icon,onClick:e=>{var t,r;null==(t=(r=n[0]).onClick)||t.call(r)},className:yY()("mr-12px","!rounded-full",a?"!coz-fg-images-white":"",{[eWY.disabled]:n[0].disabled})})}):null]})};var eW1=i(26355),eW0={};eW0.styleTagTransform=yj(),eW0.setAttributes=yB(),eW0.insert=yI().bind(null,"head"),eW0.domAPI=yO(),eW0.insertStyleElement=yH(),yC()(eW1.A,eW0);let eW2=eW1.A&&eW1.A.locals?eW1.A.locals:void 0,eW3=e=>{var t,r,a,o,i,n;let{coreAreaClassName:s,className:l,showInputArea:c=!0,inputPlaceholder:d,inputNativeCallbacks:u,messageGroupListClassName:p,renderChatInputTopSlot:h,renderChatInputRightActions:m,isShowClearContextDivider:f,headerNode:g,messageMaxWidth:_,isMiniScreen:b,enableMultimodalUpload:v=!1,uiKitCustomComponents:y,contentBox:T,getMessageRenderIndex:k,inputMode:w,onboardingPrologue:Q,showOnboardingBotInfo:x,showOnboardingSuggestions:z}=e,A=eF4(),{layout:E,onInitStateChange:D,chatConfig:S}=ej7(),C=(0,gt.useRef)(null),{readonly:L}=ej7(),O=ej8(e=>e.currentConversationInfo),M=!O||""===O.id,I=(0,gt.useMemo)(()=>m?()=>m()||null:void 0,[m]),P=(0,gt.useMemo)(()=>({chatInputIntegration:{renderChatInputTopSlot:e=>(0,fU.jsxs)(fU.Fragment,{children:[null==h?void 0:h(),(0,fU.jsx)(eWq,{controller:e})]})},inputRightActions:I,contentBox:T||eqV}),[h,I,T]);if((0,gt.useEffect)(()=>{switch(A){case"initSuccess":case"initFail":null==D||D(A)}},[A,D]),"initSuccess"!==A)return null;let B=(null==S||null==(r=S.ui)||null==(t=r.chatBot)?void 0:t.uploadable)??!0,R=!v&&B,H=v&&B;return(0,fU.jsx)("div",{className:yY()(eW2.area,l,{[eW2.disabled]:L}),tabIndex:1e3,ref:C,children:(0,fU.jsx)(eH1,{classname:s,layout:E===fW.PC?void 0:E,showInputArea:c,newMessageInterruptScenario:"never",messageGroupListClassName:p,showClearContextDivider:f||(null==S||null==(o=S.ui)||null==(a=o.chatBot)?void 0:a.isNeedClearContext),messageMaxWidth:_,showStopRespond:!0,enableLegacyUpload:R,enableMultimodalUpload:H,fileLimit:H?6:void 0,textareaPlaceholder:d||bj.t("chatInputPlaceholder"),enableMessageBoxActionBar:!0,chatInputProps:{wrapperClassName:eW2.chatInput,inputNativeCallbacks:u,safeAreaClassName:(null==S||null==(n=S.ui)||null==(i=n.footer)?void 0:i.isShow)!==!1?eW2["safe-area"]:"",leftActions:(0,fU.jsx)(eWJ,{}),inputMode:w},componentTypes:P,readonly:L,uiKitChatInputButtonConfig:{isClearContextButtonVisible:!1,isClearHistoryButtonVisible:!1},isMiniScreen:b,headerNode:M?null:g,uiKitCustomComponents:y,getMessageRenderIndex:k,onboardingPrologue:Q,showOnboardingBotInfo:x,showOnboardingSuggestions:z})})};var eW4=i(71821),eW6={};eW6.styleTagTransform=yj(),eW6.setAttributes=yB(),eW6.insert=yI().bind(null,"head"),eW6.domAPI=yO(),eW6.insertStyleElement=yH(),yC()(eW4.A,eW6);let eW5=eW4.A&&eW4.A.locals?eW4.A.locals:void 0,eW7=()=>(0,fU.jsx)("div",{className:eW5.loading,children:(0,fU.jsx)(wX,{size:"large"})}),eW8="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFYAAABXCAYAAACeCrJSAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABG6SURBVHgB7V17jFxVGf/OuXdmZ/bZ2W3pg1JakBYKpSiGoNjaSkVFC0WMj0QN/KVGFAWEGP5AEhMTE3mERFGjAhEkQKCIUZACBQF5FNqEp0Dbhb6Xdrvb7mNe9x6/7zvn3Ht3dmZndntnd0jm15zee2funHvO737ne51z7wI00cRHCWKiLzd8c99iryg2SCVWQhMMJfz3JcDmjQ/M3zzReWWJ3fC1fWs8JW7A3TXQRCX0CiXu+PuDc28s9+UYYjds2DnLc1pvxvtyGTRRK3qdhFq78d75vdEPA2KJ1KKTfgo/OAuamCwGPCnX/vP+47bZD6Td8Zz0Q01Sp4xZju8/RTbJfsDEXnRp35XQ1KfHilleQfzFHjCxCvyfQBNxYA0ZftqR67+67zLcLoYmYoHxplBiHXExNBEn1pAjINEXWwxNxItE22KplGp6AjHDA+8sCU3UBQ1NrBC6kN9iixAKPgpwoaGgmEhluKNtaytAOi1gdo/Dn42MKDh0yIeRUR9KUx0Cf6wahPcZJ1YTadlQsPSUJHzirC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4yEA4XsslqBI+IoassUCqVEp5SfRvegXEkkqQXnItCvSd0ETNIEnF7NvajZG/5WU+Hw/6wz5Cyiubf9WjMkhKfeHf6hazt5AXUPr9/wEj5uuJCce4RQAAAABJRU5ErkJggg==";var eW9=i(32928),eZe={};eZe.styleTagTransform=yj(),eZe.setAttributes=yB(),eZe.insert=yI().bind(null,"head"),eZe.domAPI=yO(),eZe.insertStyleElement=yH(),yC()(eW9.A,eZe);let eZt=eW9.A&&eW9.A.locals?eW9.A.locals:void 0,eZr=e=>{let{iconUrl:t=eW8,title:r="Coze Bot",extra:a,theme:o,isShowConversations:i,isNeedLogo:n=!0}=e,{headerTopLeftOps:s}=eWK(),l=eWW(s),{updateCurrentConversationInfo:c,currentConversationInfo:d,updateConversations:u,cozeApi:p}=ej8(b7(e=>({updateCurrentConversationInfo:e.updateCurrentConversationInfo,currentConversationInfo:e.currentConversationInfo,updateConversations:e.updateConversations,cozeApi:e.cozeApi}))),{chatConfig:{type:h}}=ej7(),[m,f]=(0,gt.useState)(!1),[g,_]=(0,gt.useState)(""),[b,v]=(0,gt.useState)(!1),y=null==d?void 0:d.id,T=(0,gt.useMemo)(()=>""!==y&&d&&ejP(d)||r,[y,d,r]),k=async()=>{if((null==d?void 0:d.id)&&""!==d.id&&g.trim()){v(!0);try{let e,t=h===fZ.APP,r=t?`/v1/workflow/conversations/${d.id}`:`/v1/conversations/${d.id}`,a=t?{title:g.trim()}:{name:g.trim()},o=await (null==p?void 0:p.put(r,a));if(0!==o.code||!o.data)return;if(t&&"conversation_id"in o.data){let t=o.data;e={id:t.conversation_id||t.id||d.id,name:t.conversation_name||t.name||g.trim(),title:t.title||g.trim(),created_at:t.created_at?Math.floor(t.created_at/1e3):d.created_at||Math.floor(Date.now()/1e3),updated_at:t.updated_at?Math.floor(t.updated_at/1e3):Math.floor(Date.now()/1e3),last_section_id:t.last_section_id||d.last_section_id||"",meta_data:t.meta_data||d.meta_data||{},sort:ejc.Today}}else e={...o.data,sort:ejc.Today};await u([e],"update");let i=e;c({...d,name:e.name,...t&&i.title&&{title:i.title}}),f(!1)}catch(e){console.error("Failed to rename conversation:",e)}finally{v(!1)}}};return(0,fU.jsxs)("header",{className:yY()(eZt.header,{[eZt["bg-theme"]]:"bg-theme"===o}),children:[(null==d?void 0:d.conversationListVisible)||!i?null:(0,fU.jsx)(Yx,{color:"secondary",icon:(0,fU.jsx)(Zz,{width:"18px",height:"18px"}),className:eZt["conversation-list-btn"],onClick:()=>{d&&c({...d,conversationListVisible:!0})}}),n?(0,fU.jsx)("img",{className:eZt.avatar,src:t,alt:"avatar"}):null,(0,fU.jsx)(TQ.Text,{className:yY()(eZt.title,{[eZt["title-clickable"]]:(null==d?void 0:d.id)&&""!==d.id}),ellipsis:{showTooltip:{opts:{style:{wordBreak:"break-word"},position:"bottom"},type:"tooltip"},rows:1},onClick:()=>{(null==d?void 0:d.id)&&""!==d.id&&(_(h===fZ.APP?d.title||d.name||"":d.name||d.title||""),f(!0))},children:T}),null==l?void 0:l.map(e=>(0,fU.jsx)(Xg,{color:"secondary",icon:e.icon,className:eZt["icon-btn"],disabled:e.disabled,onClick:()=>{var t;null==(t=e.onClick)||t.call(e)}})),!!a&&a,(0,fU.jsx)(Je,{getPopupContainer:()=>document.querySelector(".coze-chat-sdk"),okButtonProps:{loading:b},visible:m,onCancel:()=>f(!1),title:bj.t("web_sdk_rename_conversation",{},"重命名会话"),onOk:k,okText:bj.t("web_sdk_confirm",{},"确定"),cancelText:bj.t("web_sdk_cancel",{},"取消"),okButtonColor:"brand",closable:!1,maskClosable:!1,style:{maxWidth:"80%"},children:(0,fU.jsx)(Jz,{placeholder:bj.t("web_sdk_conversation_placeholder",{},"请输入会话名称"),value:g,maxLength:100,onChange:e=>_(e),onKeyPress:e=>{"Enter"===e.key&&k()}})})]})};var eZa=i(1241),eZo={};eZo.styleTagTransform=yj(),eZo.setAttributes=yB(),eZo.insert=yI().bind(null,"head"),eZo.domAPI=yO(),eZo.insertStyleElement=yH(),yC()(eZa.A,eZo);let eZi=eZa.A&&eZa.A.locals?eZa.A.locals:void 0,eZn=e=>{let{iconUrl:t=eW8,title:r="Coze Bot",extra:a,theme:o,isShowConversations:i,isNeedLogo:n=!0}=e,{headerTopLeftOps:s}=eWK(),l=eWW(s),{updateCurrentConversationInfo:c,currentConversationInfo:d,updateConversations:u,cozeApi:p}=ej8(b7(e=>({updateCurrentConversationInfo:e.updateCurrentConversationInfo,currentConversationInfo:e.currentConversationInfo,updateConversations:e.updateConversations,cozeApi:e.cozeApi}))),{chatConfig:{type:h}}=ej7(),[m,f]=(0,gt.useState)(!1),[g,_]=(0,gt.useState)(""),[b,v]=(0,gt.useState)(!1),y=null==d?void 0:d.id,T=(0,gt.useMemo)(()=>""!==y&&d&&ejP(d)||r,[y,d,r]),k=async()=>{if((null==d?void 0:d.id)&&""!==d.id&&g.trim()){v(!0);try{let e,t=h===fZ.APP,r=t?`/v1/workflow/conversations/${d.id}`:`/v1/conversations/${d.id}`,a=t?{title:g.trim()}:{name:g.trim()},o=await (null==p?void 0:p.put(r,a));if(0!==o.code||!o.data)return;if(t&&"conversation_id"in o.data){let t=o.data;e={id:t.conversation_id||t.id||d.id,name:t.conversation_name||t.name||g.trim(),title:t.title||g.trim(),created_at:t.created_at?Math.floor(t.created_at/1e3):d.created_at||Math.floor(Date.now()/1e3),updated_at:t.updated_at?Math.floor(t.updated_at/1e3):Math.floor(Date.now()/1e3),last_section_id:t.last_section_id||d.last_section_id||"",meta_data:t.meta_data||d.meta_data||{},sort:ejc.Today}}else e={...o.data,sort:ejc.Today};await u([e],"update");let i=e;c({...d,name:e.name,...t&&i.title&&{title:i.title}}),f(!1)}catch(e){console.error("Failed to rename conversation:",e)}finally{v(!1)}}};return(0,fU.jsxs)("header",{className:yY()(eZi.header,{[eZi["bg-theme"]]:"bg-theme"===o}),children:[(null==d?void 0:d.conversationListVisible)||!i?null:(0,fU.jsx)(Yx,{color:"secondary",icon:(0,fU.jsx)(Zz,{width:"18px",height:"18px"}),className:eZi["conversation-list-btn"],onClick:()=>{d&&c({...d,conversationListVisible:!0})}}),n?(0,fU.jsx)("img",{className:eZi.avatar,src:t,alt:"avatar"}):null,(0,fU.jsx)(TQ.Text,{className:yY()(eZi.title,{[eZi["title-clickable"]]:(null==d?void 0:d.id)&&""!==d.id}),ellipsis:{rows:1},onClick:()=>{(null==d?void 0:d.id)&&""!==d.id&&(_(h===fZ.APP?d.title||d.name||"":d.name||d.title||""),f(!0))},children:T}),null==l?void 0:l.map(e=>(0,fU.jsx)(Xg,{color:"secondary",icon:e.icon,className:eZi["icon-btn"],disabled:e.disabled,onClick:()=>{var t;null==(t=e.onClick)||t.call(e)}})),!!a&&a,(0,fU.jsx)(Je,{getPopupContainer:()=>document.querySelector(".coze-chat-sdk"),okButtonProps:{loading:b},visible:m,onCancel:()=>f(!1),title:bj.t("web_sdk_rename_conversation",{},"重命名会话"),onOk:k,okText:bj.t("web_sdk_confirm",{},"确定"),cancelText:bj.t("web_sdk_cancel",{},"取消"),okButtonColor:"brand",closable:!1,maskClosable:!1,style:{maxWidth:"80%"},children:(0,fU.jsx)(Jz,{placeholder:bj.t("web_sdk_conversation_placeholder",{},"请输入会话名称"),value:g,maxLength:100,onChange:e=>_(e),onKeyPress:e=>{"Enter"===e.key&&k()}})})]})};var eZs=i(64112),eZl={};eZl.styleTagTransform=yj(),eZl.setAttributes=yB(),eZl.insert=yI().bind(null,"head"),eZl.domAPI=yO(),eZl.insertStyleElement=yH(),yC()(eZs.A,eZl);let eZc=eZs.A&&eZs.A.locals?eZs.A.locals:void 0,eZd=()=>{let{updateCurrentConversationInfo:e,currentConversationInfo:t}=ej8(b7(e=>({updateCurrentConversationInfo:e.updateCurrentConversationInfo,currentConversationInfo:e.currentConversationInfo})));return(null==t?void 0:t.conversationListVisible)?null:(0,fU.jsx)($l,{content:bj.t("web_sdk_open_conversations"),children:(0,fU.jsx)(Yx,{className:eZc["float-open-conversations-btn"],size:"small",style:{height:"32px",borderTopLeftRadius:"unset",borderBottomLeftRadius:"unset"},icon:(0,fU.jsx)(Z_,{}),onClick:()=>{t&&e({...t,conversationListVisible:!0})}})})},eZu=e=>{let{isMobile:t,...r}=e,{isShowConversations:a,isShowHeader:o}=r;return o?t?(0,fU.jsx)(eZn,{...r}):(0,fU.jsx)(eZr,{...r}):a?(0,fU.jsx)(eZd,{}):null};var eZp=i(84054),eZh={};eZh.styleTagTransform=yj(),eZh.setAttributes=yB(),eZh.insert=yI().bind(null,"head"),eZh.domAPI=yO(),eZh.insertStyleElement=yH(),yC()(eZp.A,eZh);let eZm=eZp.A&&eZp.A.locals?eZp.A.locals:void 0,eZf=e=>{let t,r,{isShow:a=!0,expressionText:o,linkvars:i,footerClassName:n,textClassName:s,theme:l}=e;return a?(0,fU.jsx)("footer",{className:yY()(eZm.footer,n,{[eZm["bg-theme"]]:"bg-theme"===l}),children:(0,fU.jsx)("span",{className:yY()(eZm.text,s),children:o?(t=[],r="{{{link}}}",o.replace(/\{\{\s*(\w+)\s*\}\}/g,(e,a)=>{let{link:o,text:n}=(null==i?void 0:i[a])||{};return o&&n?t.push((0,fU.jsx)("a",{className:eZm.link,href:o,target:"_blank",children:n})):t.push(n||""),r}).split(r).map((e,r)=>(0,fU.jsxs)(gt.Fragment,{children:[e,t[r]]},`text_link_${r}`))):bj.t("web_sdk_official_banner",{docs_link:(0,fU.jsx)("a",{className:eZm.link,href:"",target:"_blank",children:bj.t("web_sdk_official_banner_link")},"web_sdk_official_banner")})})}):null};var eZg=i(98046),eZ_={};eZ_.styleTagTransform=yj(),eZ_.setAttributes=yB(),eZ_.insert=yI().bind(null,"head"),eZ_.domAPI=yO(),eZ_.insertStyleElement=yH(),yC()(eZg.A,eZ_);let eZb=eZg.A&&eZg.A.locals?eZg.A.locals:void 0,eZv=e=>{let{error:t,onBeforeRetry:r,refresh:a}=e,o=bj.t("overview_bi_assistant_system_error");if(t){o=t.msg;let e=(e=>{let t=null==e?void 0:e.code;if(0x29db5cd3===t)return{code:t,msg:bj.t("unbind_notification")}})(t);e&&(o=e.msg)}let i=bj.t("web_sdk_retry_notification"),n=!!(null==t?void 0:t.code)&&bq.includes(t.code);return(0,fU.jsxs)("div",{className:eZb.wrapper,children:[(0,fU.jsx)("img",{className:eZb.icon,src:eZy(t)}),(0,fU.jsx)("div",{className:eZb.message,children:o}),!n&&(0,fU.jsx)("div",{className:eZb.extra,children:bj.t(`web_sdk_api_error_${null==t?void 0:t.code}`,{},i)}),(0,fU.jsx)(Xg,{className:eZb.btn,onClick:()=>{null==r||r(),a?null==a||a():location.reload()},children:bj.t("retry")})]})},eZy=e=>(null==e?void 0:e.code)===bV.BotUnbind?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACQCAYAAADnRuK4AAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABHnSURBVHgB7Z1bc9vGFYAXWIA32dHIF9VJqiZxM3Im9qRuLg/2dNyHPPfX9rV5SB7SmaZJPGM7cTytPbVdxZ6GlnUhCRLAoueIVExKIrlnb1jI+B58kSCKxB6cPXuujNXU1NTU1NTU1NTU1NTU1NTU1NTULIGzGud88skncRAErc3NTfbzzz8LVmECVmONs2fPXkjT9I0wDFeFEGfhS3FRhJ3jVwZpEOR9uG6Q53w3isTOBx980P32229T5jm1ABkGhSbP8408D37DWBEzDcKw6MJfT9bW1rpbW1t95iGVECBU+Xfv3r0MT+h5IYLz+LUgEDuwDTwaDAZPWMkcvj/Govd0hWYeURQ8gc//dG9v7xfmEd4L0FtvvdV58WLnRlEUnZO+D0LUP3du9e9lPKEuBOcoqJVAI932RSN5L0Ct1srn84TnEBSiJOl9Bf90ZjO0Wq3LRcE3XQnOUVAjra6uPihbkLw+hbXb7Y2iYBsSl8ZR1BJ5Puoyy6BGzLLsMzCG32El3j8h2GqSDC+126290WhUmhB5LUAgFH+EJ7wpc20YCgYLa9UeQgO510s+BaFeZX4Q53mxEUVhAIa79YfnJELmMUUh3pC99tC4tgVuWaNR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ONgEb/qxLQDd//BnFobRrhDJThzHOzqluzWnn3jyBL920wJrampqampqampqampqampqampqairB/wHJDRbt+mLgRAAAAABJRU5ErkJggg==":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACQCAYAAADnRuK4AAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABBdSURBVHgB7Z39b9vGGcfvhZRkObZgO3GdFOm2oLPRptiCBQPWYn/6fhlQrD906Yomzhajy7A6c7wmsuMXiZRIHvc8IpXZrSXxOZIiT7oPYNitpdgmv3ze744xi8VisVgsFovFYrHMD86WkHv37rXPzs7WoyhqO46zopRqx3HswscKfj+ORfum93Gu+sln7sFHIIToh2HoSSn7jUbDOz09PWNLxsILCMVycnKyAze7A0JZA3F0WImAyM5AUOfws7qtVut80UW1cAJ6/Pix+/z58x2wELejiH8A9sRlFQK/R1+I+Bys2/HGxkb36OiozxaIhRAQimZ/f/8+3KwdpfgWqzEgpi58OlwUMRktoLW1tdsQg+zWXTSTkJIdg+gPe73eMTMU4wSE1ubZs2cPGHN+VbV7Kgp0cxA7HZholYwR0CIK5+fwwHHYcafTOTBFSLUX0HII5+c4Dj80QUi1FlCz2dxbNuFcBV1bHIevBoPBC1ZTaikgDI6DQP0WUt82s7yPkTzPO2Q1Q7Iage4KKsSPwzD+BP5zKa3OBKBKzndarUb7zp075xcXFwGrCbWxQKurqzthyB4tq7vKSt2sUeUCQqvz9OnTPc4x1pkfSYXYPYF+GHwO4UME2M9aWVkJIHDFJ/ynT7kLbREXbpwLtScHPtpKOW0p+XrSS1PrbI64rnh5eXl5cMPvOVcqFVDSpzr7fA6xTiiEPIvj4Nh13TNwAeeshAsPsdtWEAQdIRpbURTehv/lsBLBh2Bzs/NVlZlaZQKCJ/2+UuJhiS4rhMbpD80mPwbBdFkFoKB8X92HivPtcae/eHAqQO1X5dIqERCk57sQv++x4qlcNJMYiwl6YfdZKUQHVaT7cxcQuJBHEHsUfRFD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DKcJaVeDrZoGugek+xCofLbFbC3EBJ6TnuYffy6LWAkpZRrc2Fg4uIa91YdQEAY0ZCwn3vCmldlQDjBHOGJMENAa3zdtasIzNOOGMMVFA71ldXd2JY3k/ikIjzynDxqfjsBfp/pNGYrSArjCySuDZoD0S1XoL3mSzquDY931sPRg/HLcoArrKSEycu9BOiDo1cHOhlI3jOB68hSo2Fv8WaqJyEQV0DVyIB0/7ehiKLSl5h3piMRUc5hLCOVfKP9vc3Dw+Ojoy+pDeWSy8gG4CRYX9rCjCPpaz4jiiDZbKBXGNrNWkAS/s8CefhQdfB2Go+tBH86SU/U6nc77oYrFYLBaLxWKxWCwWS9X8D4fdLEcUgXVMAAAAAElFTkSuQmCC",{Title:eZT,Text:eZk}=TQ,eZw=()=>(0,fU.jsxs)("div",{children:[(0,fU.jsx)(eZT,{children:bj.t("404_title")}),(0,fU.jsx)(eZk,{children:bj.t("404_content")})]}),eZQ=e=>{let{children:t}=e;return(0,fU.jsx)(eiG,{errorBoundaryName:"ErrorBoundary",logger:eUl.getLogger(),FallbackComponent:eZw,children:t})};var eZx=i(44130),eZz={};eZz.styleTagTransform=yj(),eZz.setAttributes=yB(),eZz.insert=yI().bind(null,"head"),eZz.domAPI=yO(),eZz.insertStyleElement=yH(),yC()(eZx.A,eZz);let eZA=eZx.A&&eZx.A.locals?eZx.A.locals:void 0,eZE=e=>{let{useInIframe:t=!0,...r}=e,{chatConfig:a}=r??{};return(null==a?void 0:a.bot_id)?(a.auth&&(a.auth.connectorId=a.auth.connectorId||"999"),(0,fU.jsx)(eZD,{...r,useInIframe:t})):null},eZD=e=>{var t;let{layout:r,className:a,useInIframe:o=!1,chatConfig:i,userInfo:n,style:s,onImageClick:l,onThemeChange:c}=e;i.ui||(i.ui={}),i.ui.chatBot||(i.ui.chatBot={}),(null==(t=i.auth)?void 0:t.type)==="token"?(i.ui.chatBot.isNeedClearMessage=!1,i.ui.chatBot.isNeedAddNewConversation=i.ui.chatBot.isNeedAddNewConversation??!0,i.ui.chatBot.isNeedClearContext=i.ui.chatBot.isNeedClearContext??!0):(i.ui.chatBot.isNeedClearMessage=!0,i.ui.chatBot.isNeedAddNewConversation=!1,i.ui.chatBot.isNeedClearContext=!1);let d={chatConfig:{...i,source:yz.WebSdk},layout:r,userInfo:n,initErrorFallbackFC:eZv,onImageClick:l};return(0,fU.jsx)(eZQ,{children:(0,fU.jsx)("div",{className:yY()(eZA.cozeChatApp,!o&&eZA.bordered,a),style:s,children:(0,fU.jsx)(eqH,{...d,onThemeChange:c,children:(0,fU.jsx)(eZS,{chatProps:d,webSdkProps:e})})})})},eZS=e=>{var t;let{chatProps:r,webSdkProps:a}=e,{layout:o,title:i,headerExtra:n,icon:s,chatConfig:l}=a,c=eF4(),d=o===fW.MOBILE,{header:u,conversations:p}=(null==l?void 0:l.ui)||{},h=eNe(),m=null==p?void 0:p.isNeed;return"initSuccess"!==c?(0,fU.jsx)(eW7,{}):(0,fU.jsxs)("div",{className:eZA.content,children:[(0,fU.jsx)(eW3,{...r,enableMultimodalUpload:!0,headerNode:(0,fU.jsx)(eZu,{title:i,extra:n,iconUrl:(null==u?void 0:u.icon)||s,theme:h,isMobile:d,isShowConversations:m,isShowHeader:(null==u?void 0:u.isShow)!==!1,isNeedLogo:(null==u?void 0:u.isNeedLogo)!==!1})}),(0,fU.jsx)(eZf,{...(null==l||null==(t=l.ui)?void 0:t.footer)||{},theme:h})]})};var eZC=i(63020),eZL={};eZL.styleTagTransform=yj(),eZL.setAttributes=yB(),eZL.insert=yI().bind(null,"head"),eZL.domAPI=yO(),eZL.insertStyleElement=yH(),yC()(eZC.A,eZL);let eZO=eZC.A&&eZC.A.locals?eZC.A.locals:void 0,eZM=e=>{var t,r,a,o,i,n,s,l,c;let d=null==(r=e.client.options.ui)||null==(t=r.chatBot)?void 0:t.title,u=null==(o=e.client.options.ui)||null==(a=o.base)?void 0:a.icon,p=(null==(n=e.client.options.ui)||null==(i=n.header)?void 0:i.isNeedClose)?(0,fU.jsx)("div",{className:eZO["extra-close"]}):null,h=null==(l=e.client.options.ui)||null==(s=l.base)?void 0:s.layout,{onImageClick:m}=e,{userInfo:f}=e.client.options,g=b6(e=>e.setThemeType),_=yA(e.client.chatClientId,e.client.options);return _.chatConfig.auth&&(_.chatConfig.auth.onRefreshToken=null==(c=e.client.options.auth)?void 0:c.onRefreshToken),(0,fU.jsx)("div",{className:eZO.chatAppWrapper,children:(0,fU.jsx)(eZE,{title:d||"",icon:u,chatConfig:_.chatConfig,headerExtra:p,layout:h,style:{height:"100%"},onImageClick:m,onThemeChange:g,userInfo:f})})},eZI=e=>{let t,r,a;return{appLifeCycleService:{},messageLifeCycleService:(t=!1,r="",a="",{onBeforeMessageGroupListUpdate:a=>{var o,i,n,s,l;let{messages:c}=e.chatAreaPluginContext.readonlyAPI.message.getMessagesStoreInstantValues(),d=null==c?void 0:c[0];return t&&r!==(null==d?void 0:d.message_id)?(null==(i=e.pluginBizContext.eventCallbacks)||null==(o=i.onMessageChanged)||o.call(i),r=null==d?void 0:d.message_id,((null==d?void 0:d.type)!=="answer"||(null==d?void 0:d.is_finish)!==!0)&&r||null==(l=e.pluginBizContext)||null==(s=l.eventCallbacks)||null==(n=s.onMessageReceivedFinish)||n.call(s)):t=!0,a},onAfterSendMessage:t=>{var r,a,o,i,n,s,l,c;let d=(null==t||null==(a=t.message)||null==(r=a.extra_info)?void 0:r.chatflow_execute_id)||"";d&&(null==(c=e.pluginBizContext)||null==(l=c.eventCallbacks)||null==(s=l.onGetChatFlowExecuteId)||s.call(l,d)),null==(n=e.pluginBizContext)||null==(i=n.eventCallbacks)||null==(o=i.onMessageSended)||o.call(i)},onBeforeReceiveMessage:t=>{var r,o,i;a!==t.message.reply_id&&(a=t.message.reply_id,null==(i=e.pluginBizContext)||null==(o=i.eventCallbacks)||null==(r=o.onMessageReceivedStart)||r.call(o))}}),commandLifeCycleService:{},renderLifeCycleService:{}}};function eZP(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class eZB extends ejo{constructor(...e){super(...e),eZP(this,"pluginMode",eFp.Writeable),eZP(this,"pluginName",eji.UIBuilderEventcallbackPlugin),eZP(this,"lifeCycleServices",ejn(this,eZI))}}let eZR=(e,t)=>{var r,a,o,i,n,s,l,c,d,u,p,h,m,f,g,_,b,v,y,T,k,w,Q,x,z,A,E,D;let S=enS(e);return(null==t||null==(r=t.project)?void 0:r.id)&&(S.botInfo.id=null==t||null==(g=t.project)?void 0:g.id),(null==t||null==(a=t.project)?void 0:a.name)&&(S.botInfo.nickname=null==t||null==(_=t.project)?void 0:_.name),(null==t||null==(o=t.project)?void 0:o.iconUrl)&&(S.botInfo.url=null==t||null==(b=t.project)?void 0:b.iconUrl),(null==t||null==(n=t.project)||null==(i=n.onBoarding)?void 0:i.prologue)&&(S.prologue=null==t||null==(y=t.project)||null==(v=y.onBoarding)?void 0:v.prologue),(null==t||null==(c=t.project)||null==(l=c.onBoarding)||null==(s=l.suggestions)?void 0:s.length)&&(S.onboardingSuggestions=(null==t||null==(k=t.project)||null==(T=k.onBoarding)?void 0:T.suggestions.map((e,t)=>({id:t.toString(),content:e})))||[]),(null==t||null==(u=t.project)||null==(d=u.onBoarding)?void 0:d.displayAllSuggest)&&(S.displayAllSuggest=null==t||null==(Q=t.project)||null==(w=Q.onBoarding)?void 0:w.displayAllSuggest),S.displayAllSuggest||(S.onboardingSuggestions=S.onboardingSuggestions.slice(0,3)),(null==t||null==(h=t.project)||null==(p=h.suggestPromoteInfo)?void 0:p.suggestReplyMode)&&(S.suggestPromoteInfo={suggestReplyMode:null==t||null==(z=t.project)||null==(x=z.suggestPromoteInfo)?void 0:x.suggestReplyMode,customizedSuggestPrompt:null==t||null==(E=t.project)||null==(A=E.suggestPromoteInfo)?void 0:A.customizedSuggestPrompt}),(null==t||null==(f=t.areaUi)||null==(m=f.bgInfo)?void 0:m.imgUrl)?S.customBgInfo=null==t||null==(D=t.areaUi)?void 0:D.bgInfo:S.customBgInfo=void 0,S},eZH=async(e,t)=>{var r,a,o,i,n,s,l,c,d,u,p,h,m,f,g,_,b,v,y,T,k,w;let Q,x=eVj(t),z=(null==t||null==(r=t.project)?void 0:r.mode)==="websdk",A=null==t||null==(a=t.workflow)?void 0:a.id,E=(null==t||null==(o=t.project)?void 0:o.mode)==="draft"?"true":"",D=(null==t||null==(i=t.project)?void 0:i.caller)||"",[S,C]=await Promise.allSettled([z?null==e?void 0:e.get(`/v1/apps/${null==t||null==(n=t.project)?void 0:n.id}?version=${(null==t||null==(s=t.project)?void 0:s.version)||""}&connector_id=${x}`,{},!1,{headers:{"Accept-Language":"zh-CN"===bj.language?"zh":"en"}}):null,A?null==e?void 0:e.get(`/v1/workflows/${A}?connector_id=${x}&is_debug=${E}&caller=${D}`,{},!1,{headers:{"Accept-Language":"zh-CN"===bj.language?"zh":"en"}}):null]),L=(null==S?void 0:S.status)==="fulfilled"?null==S||null==(l=S.value)?void 0:l.data:void 0,O=(null==C?void 0:C.status)==="fulfilled"?null==C||null==(d=C.value)||null==(c=d.data)?void 0:c.role:void 0;if(z&&!L)throw{code:null==S||null==(p=S.reason)?void 0:p.code,message:""};let M=((null==(k=(Q={prologue:(null==O||null==(h=O.onboarding_info)?void 0:h.prologue)||"",onboardingSuggestions:(null==O||null==(f=O.onboarding_info)||null==(m=f.suggested_questions)?void 0:m.map((e,t)=>({id:t.toString(),content:e})))||[],displayAllSuggest:null==O||null==(g=O.onboarding_info)?void 0:g.display_all_suggestions,botInfo:{url:(null==O||null==(_=O.avatar)?void 0:_.image_url)||(null==L?void 0:L.icon_url)||"",nickname:(null==O?void 0:O.name)||(null==L?void 0:L.name)||(null==t?void 0:t.project.defaultName)||"",id:(null==t||null==(b=t.project)?void 0:b.id)||""},suggestPromoteInfo:{suggestReplyMode:null==O||null==(v=O.suggest_reply_info)?void 0:v.suggest_reply_mode,customizedSuggestPrompt:null==O||null==(y=O.suggest_reply_info)?void 0:y.customized_suggest_prompt},backgroundInfo:null==O?void 0:O.background_image_info,defaultInputMode:(null==O||null==(T=O.user_input_config)?void 0:T.default_input_mode)===2?ej3.Voice:ej3.Text}).backgroundInfo)?void 0:k.web_background_image)&&(Q.backgroundInfo.web_background_image.origin_image_url=Q.backgroundInfo.web_background_image.image_url),(null==(w=Q.backgroundInfo)?void 0:w.mobile_background_image)&&(Q.backgroundInfo.mobile_background_image.origin_image_url=Q.backgroundInfo.mobile_background_image.image_url),Q);return(null==t||null==(u=t.workflow)?void 0:u.id)&&!M.botInfo.url&&(M.botInfo.url="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAwkSURBVHgB7d2xblRXGsDxwyrQGGkxhaHACmsatgEiUQSKYCRoSBHnCYAngDxBnCcIPAEgP0BIkTRBwk4RUiCF0EADSwQFuABWwg0p2PkGhiUBxL0zd+z57v39pNGwu83OzJ2/zzn33DubytLSiwKQwD8KQBKCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWk8VGBEe2emirbtmz5yyPce/as//z0+fNyb22t/wyjECwqixAdmJ7uP/b3HvM7d5Ztmze/DlQVN5486Yds5dGj/r+Xe89Q1aaytPSiwHtEjE7NzZUvZmf7oaoTp6oiWpfu3CnLq6uvR2XwLoLFW96M1PyOHWU9DeJ18e7dAn8nWLwWoTqzd28523uMYyRVR4y0YsT1zc2bRl28JlhMVKjeJUZbwkUQrI6LUC3u2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QhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGoIFpCFYQBqCBaQhWEAaggWkIVhAGv8DJbWhlGwbFtYAAAAASUVORK5CYII="),M},eZF=(0,gt.createContext)({appDataFromOnLine:null,appDataCombineWithProps:null}),eZj=e=>{let{children:t,...r}=e;return(0,fU.jsx)(eZF.Provider,{value:r,children:t})},eZN=()=>{let{appDataCombineWithProps:e}=(0,gt.useContext)(eZF);return e},eZU=async()=>{try{var e;return(null==(e=(await eT7.ImpersonateCozeUser({})).data)?void 0:e.access_token)??""}catch(e){return""}};var eZV=i(41107),eZq={};eZq.styleTagTransform=yj(),eZq.setAttributes=yB(),eZq.insert=yI().bind(null,"head"),eZq.domAPI=yO(),eZq.insertStyleElement=yH(),yC()(eZV.A,eZq);let eZG=eZV.A&&eZV.A.locals?eZV.A.locals:void 0,eZK=e=>{let t=(0,gt.useRef)(null),{bgInfo:r}=e;if(!r||!(null==r?void 0:r.imgUrl))return null;let{themeColor:a="transparent",imgUrl:o}=r;return(0,fU.jsxs)("div",{ref:t,className:eZG["bg-image"],style:{backgroundColor:a},children:[(0,fU.jsx)("div",{className:eZG.mask}),(0,fU.jsx)("div",{className:eZG["img-container"],children:o?(0,fU.jsx)("img",{src:o,className:eZG.img}):null})]})};var eZW=i(47153),eZZ={};eZZ.styleTagTransform=yj(),eZZ.setAttributes=yB(),eZZ.insert=yI().bind(null,"head"),eZZ.domAPI=yO(),eZZ.insertStyleElement=yH(),yC()(eZW.A,eZZ);let eZX=eZW.A&&eZW.A.locals?eZW.A.locals:void 0,eZY=e=>{let{label:t,children:r}=e;return(0,fU.jsxs)("div",{className:eZX["label-value"],children:[(0,fU.jsxs)("div",{className:eZX.label,children:[t,":"]}),(0,fU.jsx)("div",{className:eZX.value,children:r})]})},eZ$=e=>{var t,r,a,o,i,n,s,l,c,d,u,p;return(0,fU.jsxs)("div",{className:eZX.container,children:[(0,fU.jsx)(eZY,{label:"Bot名称",children:null==e||null==(t=e.project)?void 0:t.name}),(0,fU.jsx)(eZY,{label:"BotIcon",children:(0,fU.jsx)("img",{src:null==e||null==(r=e.project)?void 0:r.iconUrl,className:eZX.img})}),(0,fU.jsx)(eZY,{label:"开场白",children:null==e||null==(o=e.project)||null==(a=o.onBoarding)?void 0:a.prologue}),(0,fU.jsx)(eZY,{label:"推荐词",children:((null==e||null==(n=e.project)||null==(i=n.onBoarding)?void 0:i.suggestions)||[]).map((e,t)=>(0,fU.jsx)("div",{children:e},`${t}`))}),(0,fU.jsx)(eZY,{label:"用户名称",children:null==e||null==(s=e.userInfo)?void 0:s.nickname}),(0,fU.jsx)(eZY,{label:"用户头像",children:(0,fU.jsx)("img",{src:null==e||null==(l=e.userInfo)?void 0:l.url,className:eZX.img})}),(0,fU.jsxs)(eZY,{label:"输入框placholder",children:[null==e||null==(d=e.areaUi)||null==(c=d.input)?void 0:c.placeholder," "]}),(0,fU.jsxs)(eZY,{label:"输入框默认值",children:[null==e||null==(p=e.areaUi)||null==(u=p.input)?void 0:u.defaultText," "]})]})};var eZJ=i(18573),eZ1={};eZ1.styleTagTransform=yj(),eZ1.setAttributes=yB(),eZ1.insert=yI().bind(null,"head"),eZ1.domAPI=yO(),eZ1.insertStyleElement=yH(),yC()(eZJ.A,eZ1);let eZ0=eZJ.A&&eZJ.A.locals?eZJ.A.locals:void 0,eZ2=(0,gt.forwardRef)((e,t)=>{var r,a,o,i,n,s,l,c,d,u,p,h;let{uiBuilderProps:m,chatProps:f}=e,g=(0,gt.useRef)(!1),_=(0,gt.useRef)(),{areaUi:b,uiKitCustomComponents:v,contentBox:y}=m,T=eHQ(),k=eM4(),w=eMJ(eMb());(()=>{let{partialUpdateOnboardingData:e}=eF0(),t=eZN();WZ(()=>{e(null==t?void 0:t.prologue,null==t?void 0:t.onboardingSuggestions)},[null==t?void 0:t.prologue,null==t?void 0:t.onboardingSuggestions])})(),(()=>{var e,t,r;let{updateBotInfo:a}=(()=>{let{useSenderInfoStore:e}=ey3();return e(b7(e=>({getBotInfo:e.getBotInfo,updateBotInfo:e.updateBotInfo,setSenderInfoBatch:e.setSenderInfoBatch})))})(),{recordBotInfo:o}=eF0(),i=eZN();WZ(()=>{var e,t,r;let n=(null==i||null==(e=i.botInfo)?void 0:e.id)||"";o({name:(null==i||null==(t=i.botInfo)?void 0:t.nickname)||"",avatar:(null==i||null==(r=i.botInfo)?void 0:r.url)||""}),a(()=>{var e,t,r;return{[n]:{url:(null==i||null==(e=i.botInfo)?void 0:e.url)||"",nickname:(null==i||null==(t=i.botInfo)?void 0:t.nickname)||"",id:(null==i||null==(r=i.botInfo)?void 0:r.id)||"",allowMention:!1}}})},[null==i||null==(e=i.botInfo)?void 0:e.nickname,null==i||null==(t=i.botInfo)?void 0:t.url,null==i||null==(r=i.botInfo)?void 0:r.id])})(),(0,gt.useImperativeHandle)(t,()=>({sendMessage:e=>{e.type===eny.Text?w({text:e.text,mentionList:[]},"other"):e.type===eny.Image?k({payload:{contentType:eny.Image,contentObj:{image_list:[e.value]},mention_list:[]}},"other"):"file"===e.type&&k({payload:{contentType:eny.File,contentObj:{file_list:[e.value]},mention_list:[]}},"other")},clearContext:()=>{null==T||T()}}),[T,w,k]),(0,gt.useEffect)(()=>{var e,t,r;null==(r=_.current)||null==(t=r.setInputText)||t.call(r,(null==b||null==(e=b.input)?void 0:e.defaultText)||"")},[null==b||null==(r=b.input)?void 0:r.defaultText]);let Q=(null==b||null==(a=b.input)?void 0:a.renderChatInputTopSlot)?()=>{var e,t;return null==b||null==(t=b.input)||null==(e=t.renderChatInputTopSlot)?void 0:e.call(t,!1)}:void 0,x=(null==b||null==(o=b.input)?void 0:o.renderChatInputRightActions)?()=>{var e,t;return null==b||null==(t=b.input)||null==(e=t.renderChatInputRightActions)?void 0:e.call(t)}:void 0,z=(null==(i=m.project)?void 0:i.layout)===fW.MOBILE,A=eNe(),{header:E}=m.areaUi||{},D=(null==b||null==(n=b.conversations)?void 0:n.isNeed)??!1;return console.log("contentBox",y),(0,fU.jsx)(eW3,{...f,...b||{},coreAreaClassName:eZ0["core-area"],inputPlaceholder:(null==b||null==(s=b.input)?void 0:s.placeholder)||bj.t("chatInputPlaceholder"),messageMaxWidth:(null==m||null==(l=m.project)?void 0:l.mode)!=="websdk"?"600px":void 0,enableMultimodalUpload:!0,showInputArea:null==b||null==(c=b.input)?void 0:c.isShow,messageGroupListClassName:eZ0["scroll-view"],renderChatInputTopSlot:Q,renderChatInputRightActions:x,isShowClearContextDivider:!0,headerNode:(0,fU.jsx)(eZu,{title:(null==E?void 0:E.title)||"",iconUrl:null==E?void 0:E.icon,extra:null==E?void 0:E.extra,theme:A,isMobile:z,isShowConversations:D,isShowHeader:null==E?void 0:E.isShow,isNeedLogo:null==E?void 0:E.isNeedLogo}),isMiniScreen:(null==b?void 0:b.uiTheme)==="chatFlow",inputNativeCallbacks:{getController:e=>{if(_.current=e,!g.current){var t,r,a;null==(a=_.current)||null==(r=a.setInputText)||r.call(a,(null==b||null==(t=b.input)?void 0:t.defaultText)||""),g.current=!0}}},inputMode:null==b||null==(d=b.input)?void 0:d.inputMode,uiKitCustomComponents:v,contentBox:y,onboardingPrologue:null==b||null==(u=b.onboarding)?void 0:u.prologue,showOnboardingBotInfo:null==b||null==(p=b.onboarding)?void 0:p.showBotInfo,showOnboardingSuggestions:null==b||null==(h=b.onboarding)?void 0:h.showSuggestions})}),eZ3=e=>{var t,r,a,o,i,n;let{children:s,...l}=e,c=eF4(),d=eNe(),{footer:u}=l.areaUi||{},p=(null==(t=l.project)?void 0:t.layout)===fW.MOBILE,h=eZN(),m={...u||{expressionText:""}};return((null==(r=l.project)?void 0:r.mode)==="websdk"||m.expressionText||(m.expressionText=bj.t("chat_GenAI_tips")),"initSuccess"!==c)?(null==l||null==(n=l.areaUi)||null==(i=n.renderLoading)?void 0:i.call(n))||(0,fU.jsx)(eW7,{}):(0,fU.jsxs)("div",{className:yY()(eZ0.content,{[eZ0.mobile]:p,[eZ0["bg-theme"]]:"bg-theme"===d}),style:l.style,children:[(0,fU.jsxs)("div",{className:yY()(eZ0.area,{[eZ0["chat-flow-area"]]:(null==(a=l.areaUi)?void 0:a.uiTheme)==="chatFlow",[eZ0["chat-ui-builder"]]:(null==(o=l.areaUi)?void 0:o.uiTheme)==="uiBuilder"}),children:[(0,fU.jsx)(eZK,{bgInfo:null==h?void 0:h.customBgInfo}),s]}),(0,fU.jsx)(eZf,{...m,theme:d})]})},eZ4=(0,gt.memo)((0,gt.forwardRef)((e,t)=>{var r,a,o,i,n,s,l,c;let d,u,p,h,m,f,g,{chatProps:_,hasReady:b,error:v,refresh:y}=(e=>{var t,r,a,o;let[i,n]=(0,gt.useState)(!1),[s,l]=(0,gt.useState)(null),[c,d]=(0,gt.useState)(),{project:u,userInfo:p}=e;return(0,gt.useEffect)(()=>{var t,r,a,o;let c;if(s||i)return;let h=((null==e||null==(t=e.project)?void 0:t.type)==="bot"?(null==e||null==(r=e.project)?void 0:r.mode)!=="draft"&&(c=Error("mode must be draft when project type is bot")):(null==e||null==(a=e.auth)?void 0:a.type)!=="internal"&&((null==e||null==(o=e.auth)?void 0:o.token)||(c=Error("token is required when auth type is not internal"))),c);h?l(h):(async()=>{var t,r,a,o;let i=null==(t=e.auth)?void 0:t.token,s=null==(r=e.auth)?void 0:r.refreshToken;if((null==(a=e.auth)?void 0:a.type)==="internal"&&(i=await eZU(),s=eZU),i){let t="app"===u.type;d({chatConfig:{type:t?fZ.APP:fZ.BOT,bot_id:t?void 0:u.id,appInfo:t?{appId:u.id,workflowId:e.workflow.id||"",conversationName:u.conversationName,version:u.version,draft_mode:"draft"===u.mode}:void 0,auth:{type:fX.TOKEN,token:i,onRefreshToken:s,connectorId:eVj(e)},ui:{base:{layout:u.layout},chatBot:{uploadable:e.areaUi.uploadable,isNeedClearContext:e.areaUi.isNeedClearContext,isNeedClearMessage:e.areaUi.isNeedClearMessage,isNeedAddNewConversation:e.areaUi.isNeedAddNewConversation??!1,isNeedAudio:(null==(o=e.areaUi.input)?void 0:o.isNeedAudio)??!0,isNeedQuote:e.areaUi.isNeedQuote??!1,isNeedFunctionCallMessage:e.areaUi.isNeedFunctionCallMessage,feedback:e.areaUi.feedback},conversations:e.areaUi.conversations},conversation_id:"",source:yz.ChatFlow},layout:u.layout,userInfo:{id:fK(),url:"",nickname:"",...p||{}}}),n(!0)}else l(Error("token is empty"))})()},[s,i]),WZ(()=>{n(!1),l(null)},[null==u?void 0:u.id,null==u?void 0:u.type,null==u?void 0:u.conversationName,null==u?void 0:u.conversationId,null==u?void 0:u.mode,null==u?void 0:u.conversationId,null==e||null==(t=e.workflow)?void 0:t.id]),c&&(c.chatConfig.ui=c.chatConfig.ui||{},c.chatConfig.ui.chatBot=c.chatConfig.ui.chatBot||{},c.chatConfig.ui.chatBot.isNeedClearMessage=null==e||null==(r=e.areaUi)?void 0:r.isNeedClearMessage,c.chatConfig.ui.chatBot.uploadable=null==(a=e.areaUi)?void 0:a.uploadable,c.chatConfig.ui.chatBot.feedback=null==(o=e.areaUi)?void 0:o.feedback),{hasReady:i,chatProps:c,error:s,refresh:()=>{l(null),n(!1)}}})(e),T=((d=(0,gt.useRef)(e)).current=e,u=(()=>{let{setAppDataFromOnLine:e}=(0,gt.useContext)(eZF);return e})(),(0,gt.useCallback)(async e=>{var t;let r=eZH(e||void 0,d.current),a=eVU(e||void 0,d.current),o=await r,i=await a;null==u||u(o||null);let n=eZR(o,d.current);return{...n,...i,isCustomBackground:!!(null==(t=n.customBgInfo)?void 0:t.imgUrl),isBuilderChat:!0}},[])),k=(c={eventCallbacks:e.eventCallbacks},{createPluginBizContext:()=>({...c}),Plugin:eZB}),w=eZN();(e=>{let{appDataFromOnLine:t,setAppDataCombineWithProps:r}=(0,gt.useContext)(eZF);WZ(()=>{if(t){let a=eZR(t,e);null==r||r(a)}},[t,e])})(e);let Q=(p=(0,gt.useRef)(e),h=eZN(),m=(0,gt.useRef)(h),p.current=e,m.current=h,f=(0,gt.useMemo)(()=>e.apiUrl?e.apiUrl:f3(),[e.apiUrl]),(0,gt.useMemo)(()=>({baseURL:f,scenes:{[eni.SendMessage]:{hooks:{onBeforeSendMessage:[e=>{var t,r,a,o,i,n,s,l,c,d,u,h,g,_,b,v,y,T,k,w,Q,x,z,A,E;let{body:D}=e,S=JSON.parse(D),C={};C.additional_messages=S.additional_messages||[],C.connector_id=S.connector_id,C.workflow_id=null==p||null==(r=p.current)||null==(t=r.workflow)?void 0:t.id;let L=null==p||null==(o=p.current)||null==(a=o.workflow)?void 0:a.parameters;if(L&&"object"==typeof L){let e={...L};e.SETTING&&"object"==typeof e.SETTING&&(e.SETTING=JSON.stringify(e.SETTING)),C.parameters=e}else C.parameters=L;return C.version=(null==p||null==(n=p.current)||null==(i=n.project)?void 0:i.version)||void 0,C.execute_mode=(null==p||null==(l=p.current)||null==(s=l.project)?void 0:s.mode)==="draft"?"DEBUG":void 0,C.app_id=(null==p||null==(d=p.current)||null==(c=d.project)?void 0:c.type)==="app"?null==p||null==(h=p.current)||null==(u=h.project)?void 0:u.id:void 0,C.bot_id=(null==p||null==(_=p.current)||null==(g=_.project)?void 0:g.type)==="bot"?null==p||null==(v=p.current)||null==(b=v.project)?void 0:b.id:void 0,C.conversation_id=new URL(e.url).searchParams.get("conversation_id"),C.connector_id=eVj(null==p?void 0:p.current),C.ext={_caller:null==p||null==(T=p.current)||null==(y=T.project)?void 0:y.caller,user_id:S.user_id},C.suggest_reply_info=(null==(k=m.current)?void 0:k.suggestPromoteInfo)?{suggest_reply_mode:null==(Q=m.current)||null==(w=Q.suggestPromoteInfo)?void 0:w.suggestReplyMode,customized_suggest_prompt:null==(z=m.current)||null==(x=z.suggestPromoteInfo)?void 0:x.customizedSuggestPrompt}:void 0,e.body=JSON.stringify(C),new URL(e.url,"http://dummy.com").searchParams.has("conversation_id")||(e.url=`${f}/v1/workflows/chat`),e.headers.push(...Object.entries((null==(E=p.current)||null==(A=E.workflow)?void 0:A.header)||{})),{...e}}]}},[eni.ClearHistory]:{hooks:{onBeforeRequest:[t=>{var r,a,o,i,n,s,l,c;if((null==e||null==(r=e.project)?void 0:r.type)==="bot")t.data={connector_id:eVj(e)};else{let r={app_id:null==p||null==(a=p.current.project)?void 0:a.id,get_or_create:!1,workflow_id:null==p||null==(i=p.current)||null==(o=i.workflow)?void 0:o.id,draft_mode:(null==p||null==(s=p.current)||null==(n=s.project)?void 0:n.mode)==="draft",connector_id:eVj(e)};(null==p||null==(c=p.current)||null==(l=c.project)?void 0:l.conversationName)&&""!==p.current.project.conversationName.trim()&&(r.conversation_name=p.current.project.conversationName),t.data=r}return{...t}}]}}}}),[f])),x=(0,gt.useMemo)(()=>{var t,r;return{url:"",nickname:"",...e.userInfo||{},id:(null==e||null==(t=e.userInfo)?void 0:t.id)||(null==_||null==(r=_.userInfo)?void 0:r.id)||""}},[null==e?void 0:e.userInfo,_]),z=(g={...e,refresh:y},e=>{var t,r,a;let{error:o,onBeforeRetry:i}=e;return(0,fU.jsxs)(fU.Fragment,{children:[(0,fU.jsx)(eZv,{error:o,onBeforeRetry:i,refresh:g.refresh}),null==(a=g.areaUi)||null==(r=a.input)||null==(t=r.renderChatInputTopSlot)?void 0:t.call(r,!0)]})});if((null==e||null==(r=e.project)?void 0:r.mode)==="audit")return(0,fU.jsx)(eZ$,{...e});if(v)return(0,fU.jsx)(z,{error:null,refresh:y});if(!_||!b)return(null==e||null==(l=e.areaUi)||null==(s=l.renderLoading)?void 0:s.call(l))||(0,fU.jsx)(eW7,{});let A=!!(null==w||null==(a=w.customBgInfo)?void 0:a.imgUrl);return console.log("[result] isCustomBackground:",A,null==w?void 0:w.customBgInfo),(0,fU.jsx)(eqH,{..._,userInfo:x,openRequestInit:T,plugins:[k],requestManagerOptions:Q,initErrorFallbackFC:z,onImageClick:null==(o=e.eventCallbacks)?void 0:o.onImageClick,debug:e.debug,isCustomBackground:A,onThemeChange:null==e||null==(i=e.eventCallbacks)?void 0:i.onThemeChange,readonly:null==e||null==(n=e.areaUi)?void 0:n.isDisabled,spaceId:null==e?void 0:e.spaceId,apiUrl:e.apiUrl,children:(0,fU.jsx)(eZ3,{...e,children:(0,fU.jsx)(eZ2,{ref:t,uiBuilderProps:e,chatProps:_})})})})),eZ6=(0,gt.forwardRef)((e,t)=>{let[r,a]=(0,gt.useState)(null),[o,i]=(0,gt.useState)(null);return(0,fU.jsx)(eZQ,{children:(0,fU.jsx)(eZj,{appDataFromOnLine:r,setAppDataFromOnLine:a,appDataCombineWithProps:o,setAppDataCombineWithProps:i,children:(0,fU.jsx)(eZ4,{ref:t,...e})})})});var eZ5=i(81562),eZ7={};eZ7.styleTagTransform=yj(),eZ7.setAttributes=yB(),eZ7.insert=yI().bind(null,"head"),eZ7.domAPI=yO(),eZ7.insertStyleElement=yH(),yC()(eZ5.A,eZ7);let eZ8=eZ5.A&&eZ5.A.locals?eZ5.A.locals:void 0,eZ9=e=>{var t,r,a,o,i,n,s,l,c,d,u,p,h,m,f,g,_,b,v,y,T,k,w,Q,x,z,A,E,D,S,C,L,O,M,I,P,B,R,H,F,j,N,U,V,q,G,K,W,Z,X,Y,$,J,ee,et,er,ea;let{client:eo,onImageClick:ei,uiKitCustomComponents:en,contentBox:es}=e,el=null==eo?void 0:eo.options,ec=b6(e=>e.setThemeType),ed=(null==el||null==(r=el.ui)||null==(t=r.header)?void 0:t.isNeedClose)??!0,eu=null==eo?void 0:eo.apiUrl,ep={showInputArea:!0,isDisabled:!1,uploadable:null==el||null==(o=el.ui)||null==(a=o.chatBot)?void 0:a.uploadable,isNeedClearContext:(null==el||null==(n=el.ui)||null==(i=n.chatBot)?void 0:i.isNeedClearContext)??!0,isNeedClearMessage:!1,isNeedAddNewConversation:(null==el||null==(l=el.ui)||null==(s=l.chatBot)?void 0:s.isNeedAddNewConversation)??!0,isNeedFunctionCallMessage:(null==el||null==(d=el.ui)||null==(c=d.chatBot)?void 0:c.isNeedFunctionCallMessage)??!0,isNeedQuote:null==el||null==(p=el.ui)||null==(u=p.chatBot)?void 0:u.isNeedQuote,feedback:null==el||null==(m=el.ui)||null==(h=m.chatBot)?void 0:h.feedback,header:{isShow:!0,title:null==el||null==(g=el.ui)||null==(f=g.chatBot)?void 0:f.title,icon:(null==el||null==(b=el.ui)||null==(_=b.header)?void 0:_.icon)||(null==el||null==(y=el.ui)||null==(v=y.base)?void 0:v.icon),...null==el||null==(T=el.ui)?void 0:T.header,extra:ed?(0,fU.jsx)("div",{className:eZ8["extra-close"]}):null},conversations:null==el||null==(k=el.ui)?void 0:k.conversations,input:{isNeedAudio:null==el||null==(Q=el.ui)||null==(w=Q.chatBot)?void 0:w.isNeedAudio,renderChatInputTopSlot:null==el||null==(z=el.ui)||null==(x=z.input)?void 0:x.renderChatInputTopSlot,renderChatInputRightActions:null==el||null==(E=el.ui)||null==(A=E.input)?void 0:A.renderChatInputRightActions,placeholder:null==el||null==(S=el.ui)||null==(D=S.input)?void 0:D.placeholder,isShow:null==el||null==(L=el.ui)||null==(C=L.input)?void 0:C.isShow,defaultText:null==el||null==(M=el.ui)||null==(O=M.input)?void 0:O.defaultText,inputMode:null==el||null==(P=el.ui)||null==(I=P.input)?void 0:I.inputMode},footer:null==el||null==(B=el.ui)?void 0:B.footer,onboarding:null==el||null==(R=el.ui)?void 0:R.onboarding,getMessageRenderIndex:null==el||null==(H=el.ui)?void 0:H.getMessageRenderIndex};return(0,fU.jsx)(eZ6,{apiUrl:eu,workflow:{id:null==el||null==(j=el.config)||null==(F=j.appInfo)?void 0:F.workflowId,parameters:(null==el||null==(U=el.config)||null==(N=U.appInfo)?void 0:N.parameters)||{}},project:{type:"app",mode:(null==el||null==(q=el.config)||null==(V=q.appInfo)?void 0:V.draft_mode)!==void 0&&el.config.appInfo.draft_mode?"draft":"websdk",id:(null==el||null==(K=el.config)||null==(G=K.appInfo)?void 0:G.appId)||"",conversationName:null==el||null==(Z=el.config)||null==(W=Z.appInfo)?void 0:W.conversationName,layout:null==el||null==(Y=el.ui)||null==(X=Y.base)?void 0:X.layout,version:null==el||null==($=el.config.appInfo)?void 0:$.version},userInfo:{url:(null==el||null==(J=el.userInfo)?void 0:J.url)||"",nickname:(null==el||null==(ee=el.userInfo)?void 0:ee.nickname)||"",id:(null==el||null==(et=el.userInfo)?void 0:et.id)||""},areaUi:ep,auth:{type:"external",token:null==el||null==(er=el.auth)?void 0:er.token,refreshToken:null==el||null==(ea=el.auth)?void 0:ea.onRefreshToken},eventCallbacks:{onImageClick:ei,onThemeChange:ec},uiKitCustomComponents:en,contentBox:es})};var eXe=i(77167),eXt={};eXt.styleTagTransform=yj(),eXt.setAttributes=yB(),eXt.insert=yI().bind(null,"head"),eXt.domAPI=yO(),eXt.insertStyleElement=yH(),yC()(eXe.A,eXt);let eXr=eXe.A&&eXe.A.locals?eXe.A.locals:void 0,eXa=e=>{var t,r,a;let{client:o,uiKitCustomComponents:i,contentBox:n}=e,s=null==o?void 0:o.options,l=b6(e=>e.setImagePreview),c=b6(e=>e.setIframeLoaded),d=(null==s||null==(r=s.ui)||null==(t=r.base)?void 0:t.lang)||fJ.EN,[u,p]=(0,gt.useState)(!1),h=d===fJ.ZH_CN?kY:GI,m=(0,gt.useCallback)(e=>{l(t=>{t.url=e.url,t.visible=!0})},[]);return((0,gt.useEffect)(()=>{c(!0)},[]),(0,gt.useEffect)(()=>{(function(e){let{lng:t="en",ns:r,...a}=e||{};return new Promise(e=>{bj.use(GE),bj.init({detection:{order:["querystring","cookie","localStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18next",fallback:"zh-CN",caches:["cookie"],mute:!1},react:{useSuspense:!1},keySeparator:!1,fallbackLng:t,lng:t,ns:r||"i18n",defaultNS:r||"i18n",resources:GD,...a??{}},e)})})({lng:d}).then(()=>p(!0))},[d]),u)?(0,fU.jsx)(GM,{i18n:bj,children:(0,fU.jsx)(Le,{children:(0,fU.jsx)(V1,{locale:h,children:(0,fU.jsx)("div",{className:eXr.cozeIframe,children:(null==s||null==(a=s.config)?void 0:a.type)==="app"?(0,fU.jsx)(eZ9,{client:o,onImageClick:m,uiKitCustomComponents:i,contentBox:n}):(0,fU.jsx)(eZM,{client:o,onImageClick:m,uiKitCustomComponents:i,contentBox:n})})})})}):null},eXo=e=>{var t,r,a;let{client:o,isNewCreated:i,uiKitCustomComponents:n,contentBox:s}=e,{chatVisible:l,setChatVisible:c,layout:d,themeType:u}=b6(b7(e=>({layout:e.layout,setIframe:e.setIframe,senderName:e.senderName,chatVisible:e.chatVisible,setChatVisible:e.setChatVisible,themeType:e.themeType}))),{base:p,chatBot:h,header:m}=(null==o||null==(t=o.options)?void 0:t.ui)||{},f=(null==o||null==(r=o.options)?void 0:r.mode)||"float",g=null==o||null==(a=o.options)?void 0:a.size,_=bZ({zIndex:null==p?void 0:p.zIndex}),b=d===fW.MOBILE||"inlay"===f?void 0:(null==h?void 0:h.width)??(null==g?void 0:g.width)??460;if(!l)return null;let v=d!==fW.MOBILE&&"float"===f?{height:null==g?void 0:g.height,maxWidth:null==g?void 0:g.maxWidth,maxHeight:null==g?void 0:g.maxHeight,minWidth:null==g?void 0:g.minWidth,minHeight:null==g?void 0:g.minHeight}:{};return(0,fU.jsxs)("div",{className:yY()(eXr.iframeWrapper,"coze-chat-sdk",{[eXr.mobile]:d===fW.MOBILE,[eXr.autoFixContainer]:"inlay"===f}),style:{display:l?"block":"none",...v,width:b,..._},children:[(null==m?void 0:m.isNeedClose)!==!1?(0,fU.jsx)(Gl,{onClick:()=>{c(!1)},classNames:eXr.closeBtn,themeType:"bg-theme"===u?"light":"dark"}):null,(0,fU.jsx)(eXa,{client:o,uiKitCustomComponents:n,contentBox:s})]})},eXi=e=>{var t,r,a;let{client:o,uiKitCustomComponents:i,contentBox:n}=e,{el:s}=(null==o||null==(r=o.options)||null==(t=r.ui)?void 0:t.chatBot)||{},l=(null==o||null==(a=o.options)?void 0:a.mode)||"float",[c]=(0,gt.useState)(()=>{if(s)return s;let e=document.createElement("div");return"inlay"===l&&(e.style.position="fixed",e.style.inset="0",e.style.width="100%",e.style.height="100%",e.style.zIndex="999"),document.body.appendChild(e),e}),d=c!==s;return(0,gt.useEffect)(()=>()=>{d&&document.body.removeChild(c)},[s,c]),(0,TU.createPortal)((0,fU.jsx)(eXo,{client:o,isNewCreated:d,uiKitCustomComponents:i,contentBox:n}),c)},eXn=i.p+"054000aa4e72c964.png",eXs=e=>{var t;let{position:r="fixed",client:a}=e,{chatVisible:o,setChatVisible:i,layout:n}=b6(e=>({chatVisible:e.chatVisible,setChatVisible:e.setChatVisible,layout:e.layout})),{base:s,asstBtn:l}=(null==a||null==(t=a.options)?void 0:t.ui)||{},c=(null==l?void 0:l.icon)||(null==s?void 0:s.icon),d=bZ({zIndex:null==s?void 0:s.zIndex});return!o&&(null==l?void 0:l.isNeed)?(0,fU.jsx)("div",{style:{position:r,...d},className:yY()(eXr["coze-ast-btn"],{[eXr.mobile]:n===fW.MOBILE}),onClick:e=>{e.stopPropagation(),i(!0)},children:(0,fU.jsx)("img",{alt:"logo",src:c||eXn})}):null},eXl=e=>{var t;let{client:r,position:a,uiKitCustomComponents:o,contentBox:i}=e;(e=>{let{setImagePreview:t}=b6(e=>({setImagePreview:e.setImagePreview})),r=(0,gt.useCallback)(r=>{let a=null==r?void 0:r.data;a.chatStoreId===e.chatClientId&&a.event===yE.ImageClick&&yD.isImageClick(a)&&t(e=>{e.url=a.payload.url,e.visible=!0})},[t,e]);(0,gt.useEffect)(()=>(window.addEventListener("message",r),()=>{window.removeEventListener("message",r)}),[r])})(r),((e,t)=>{let r=(0,gt.useRef)(),{iframe:a,senderName:o,setThemeType:i}=b6(b7(e=>({iframe:e.iframe,senderName:e.senderName,setThemeType:e.setThemeType}))),n=(0,gt.useRef)({chatClientId:e,cozeChatOption:t});n.current={chatClientId:e,cozeChatOption:t},(0,gt.useEffect)(()=>{if(null==a?void 0:a.contentWindow)return r.current=new vr({channelPort:a.contentWindow,senderName:o}),r.current.onRequest(fY.GET_IFRAME_PARAMS,()=>({code:0,data:yA(n.current.chatClientId,n.current.cozeChatOption)})),r.current.onRequest(fY.GET_NEW_TOKEN,async e=>{let t;try{var r,a;t=await (null==(a=n.current.cozeChatOption.auth)||null==(r=a.onRefreshToken)?void 0:r.call(a,e||""))}catch(e){console.error("[WebSdk Error] Get Token Error")}return t?{code:0,data:t}:{code:f$.AUTH_TOKEN_GET_FAILED,message:"Get Token Error"}}),r.current.onRequest(fY.THEME_CHANGE,e=>(i(e),{code:0})),()=>{var e;null==(e=r.current)||e.destory(),r.current=void 0}},[a,o])})(r.chatClientId,r.options);let{base:n}=(null==r||null==(t=r.options)?void 0:t.ui)||{},s=bZ({zIndex:null==n?void 0:n.zIndex});return(0,fU.jsxs)(fU.Fragment,{children:[(0,fU.jsx)(eXi,{client:r,uiKitCustomComponents:o,contentBox:i}),(0,fU.jsx)(Ga,{zIndex:s["--coze-z-index-iframe"]+2}),(0,fU.jsx)(eXs,{client:r,position:a})]})},eXc=e=>(0,fU.jsx)(b4,{globalStore:e.globalStore,children:(0,fU.jsx)(eXl,{...e,uiKitCustomComponents:e.uiKitCustomComponents,contentBox:e.contentBox})}),eXd=new Map;function eXu(e){let t=eXd.get(e);if(t)return t;let r=gt.memo(t=>{let r=(0,gt.useRef)(null),a=(0,gt.useRef)(t),o=(0,gt.useRef)(null),i=(0,gt.useRef)(!0),n=(0,gt.useMemo)(()=>{try{return JSON.stringify(a.current)!==JSON.stringify(t)}catch(e){return console.warn("[WebComponent] Failed to compare props:",e),a.current!==t}},[t]);return(0,gt.useEffect)(()=>{if((i.current||n&&r.current)&&r.current){var s;i.current&&(i.current=!1),a.current=t,s=r.current,Object.entries(t).forEach(e=>{let[t,r]=e;try{if(void 0===r)return;if(null===r)return void s.setAttribute(t,"");"object"==typeof r||Array.isArray(r)||"function"==typeof r?s[t]=r:s.setAttribute(t,String(r))}catch(e){console.warn(`[WebComponent] Failed to set property "${t}" on ${s.tagName}:`,e)}});let n=r.current;if("function"==typeof n.updateProps)try{n.updateProps(t)}catch(t){console.error(`[WebComponent] Error calling updateProps on ${e}:`,t)}"function"==typeof n.cleanup&&(o.current=()=>{try{var t;null==(t=n.cleanup)||t.call(n)}catch(t){console.error(`[WebComponent] Error during cleanup of ${e}:`,t)}})}return()=>{o.current&&(o.current(),o.current=null)}},[n,t]),gt.createElement(e,{ref:r})},(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch(r){return console.warn("[WebComponent] Failed to compare props in memo:",r),e===t}});return eXd.set(e,r),r}let eXp=["JsonItem","MentionOperateTool","SendButton","AvatarWrap"];var eXh=i(2092),eXm={};eXm.styleTagTransform=yj(),eXm.setAttributes=yB(),eXm.insert=yI().bind(null,"head"),eXm.domAPI=yO(),eXm.insertStyleElement=yH(),yC()(eXh.A,eXm),eXh.A&&eXh.A.locals&&eXh.A.locals;var eXf=i(24386),eXg={};eXg.styleTagTransform=yj(),eXg.setAttributes=yB(),eXg.insert=yI().bind(null,"head"),eXg.domAPI=yO(),eXg.insertStyleElement=yH(),yC()(eXf.A,eXg),eXf.A&&eXf.A.locals&&eXf.A.locals;class eX_{async initToken(){try{var e,t,r,a;if((null==(e=this.options.auth)?void 0:e.type)===fX.TOKEN&&!(null==(t=this.options.auth)?void 0:t.token)){let e=await (null==(a=this.options.auth)||null==(r=a.onRefreshToken)?void 0:r.call(a,""));return this.options.auth.token=e,e||alert("The access token is missing. Please check the configuration information."),!!e}}catch(e){return console.error("[WebSdk Error] initToken error"),alert("The access token is missing. Please check the configuration information."),!1}return!0}checkOptions(){var e,t;if((null==(e=this.options.auth)?void 0:e.type)!==fX.TOKEN)return console.error("Non-Token is unsupported; auth's type must be token"),alert("The auth type (unauth) is unsupported yet; auth's type must be token"),!1;if((null==(t=this.options.auth)?void 0:t.type)===fX.TOKEN){if(!this.options.auth.onRefreshToken)return console.error("[WebSdk Error] onRefreshToken must be provided"),alert("onRefreshToken must be provided"),!1;if("function"!=typeof this.options.auth.onRefreshToken)return console.error("[WebSdk Error] onRefreshToken must be a function"),alert("onRefreshToken must be a function"),!1}return!0}constructor(e){!function(e,t,r){t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r}(this,"options",void 0),this.options=e}}function eXb(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class eXv{showChatBot(){this.globalStore.getState().setChatVisible(!0)}hideChatBot(){this.globalStore.getState().setChatVisible(!1)}async getToken(){var e,t,r;if((null==(e=this.options.auth)?void 0:e.type)===fX.TOKEN)return await (null==(r=this.options.auth)||null==(t=r.onRefreshToken)?void 0:t.call(r,""))}destroy(){var e;null==(e=this.root)||e.unmount(),this.defaultRoot&&this.defaultRoot.remove(),eXv.clients=eXv.clients.filter(e=>e!==this)}constructor(e){var t,r,a,o,i,n,s,l,c,d,u,p;let h,m;eXb(this,"root",void 0),eXb(this,"defaultRoot",void 0),eXb(this,"containerEl",void 0),eXb(this,"globalStore",void 0),eXb(this,"authClient",void 0),eXb(this,"chatClientId",fK()),eXb(this,"options",void 0),eXb(this,"senderName",void 0),eXb(this,"apiUrl",void 0),console.info("WebChatClient constructorxxx",e),this.senderName=`chat-app-sdk-${Date.now()}`,this.options=(e=>{var t,r,a,o,i,n,s,l,c,d,u,p;let h=fV.isMobileOnly?fW.MOBILE:fW.PC;return e.config=e.config||{},e.config.botId=(null==(t=e.config.botInfo)?void 0:t.botId)||e.config.botId||e.config.bot_id||"",e.ui=e.ui||{},"inlay"===(e.mode||"float")&&(e.ui.asstBtn=Object.assign({isNeed:!1},(null==(u=e.ui)?void 0:u.asstBtn)||{}),e.ui.header=Object.assign({isShow:!0,isNeedClose:!1},(null==(p=e.ui)?void 0:p.header)||{})),e.ui.base=Object.assign({layout:(null==(r=e.componentProps)?void 0:r.layout)||h,lang:(null==(a=e.componentProps)?void 0:a.lang)||fJ.EN,zIndex:null==(o=e.componentProps)?void 0:o.zIndex,icon:null==(i=e.componentProps)?void 0:i.icon},(null==(n=e.ui)?void 0:n.base)||{}),e.ui.chatBot=Object.assign({title:null==(s=e.componentProps)?void 0:s.title,width:null==(l=e.componentProps)?void 0:l.width,uploadable:(null==(c=e.componentProps)?void 0:c.uploadable)??!0},(null==(d=e.ui)?void 0:d.chatBot)||{}),e.ui.asstBtn=Object.assign({isNeed:!0},e.ui.asstBtn||{}),e.ui.header=Object.assign({isShow:!0,isNeedClose:!0},e.ui.header||{}),e})(e),this.authClient=new eX_(e);const f=null==(t=this.options)?void 0:t.env;if(this.apiUrl=f3(null==(r=this.options)?void 0:r.apiUrl,f),console.info("WebChatClient using API URL:",this.apiUrl,f),(null==(a=e.ui)?void 0:a.uiKitCustomWebComponents)||(null==(o=e.ui)?void 0:o.contentBoxWebComponent)){const e=function(){let e=[];return window.customElements||e.push("Custom Elements"),"attachShadow"in Element.prototype||e.push("Shadow DOM"),"content"in document.createElement("template")||e.push("HTML Templates"),{supported:0===e.length,missing:e}}();e.supported||console.error("[WebChatClient] Web Components are not fully supported in this browser. Missing:",e.missing.join(", "),"\nConsider using a polyfill: https://github.com/webcomponents/polyfills")}const{getContainer:g,mode:_="float"}=this.options;if(g)try{const e=g();e&&e instanceof HTMLElement?this.containerEl=e:null===e?console.warn("[WebChatClient] getContainer() returned null, using document.body"):console.warn("[WebChatClient] getContainer() did not return a valid HTMLElement")}catch(e){console.error("[WebChatClient] Error calling getContainer():",e)}if(this.containerEl&&((null==(l=this.options.ui)||null==(s=l.chatBot)?void 0:s.el)||(this.options.ui=this.options.ui||{},this.options.ui.chatBot=this.options.ui.chatBot||{},this.options.ui.chatBot.el=this.containerEl)),this.globalStore=(e=>{var t;let{options:r,senderName:a}=e,{layout:o=fW.PC}=(null==r||null==(t=r.ui)?void 0:t.base)??{},i=e.authClient,n={chatVisible:!1,iframeLoaded:!1,themeType:"light",imagePreview:{url:"",visible:!1},layout:o,senderName:a};return gs()(f5(f8(e=>({...n,setThemeType:t=>{e({themeType:t})},setIframe:t=>{e({iframe:t})},setChatVisible:async t=>{var a,o,n,s,l,c;let d=null==r||null==(a=r.ui)?void 0:a.chatBot;if(i&&!await i.initToken())return void(c={type:bK.OPEN_API_ERROR,code:401,message:"invalid token"},window.parent.postMessage({type:"chat-sdk-error",data:c},"*"));if(t){if(await (null==d||null==(o=d.onBeforeShow)?void 0:o.call(d))===!1)return}else if(await (null==d||null==(n=d.onBeforeHide)?void 0:n.call(d))===!1)return;e({chatVisible:t}),t?null==d||null==(s=d.onShow)||s.call(d):null==d||null==(l=d.onHide)||l.call(d)},setIframeLoaded:t=>{e({iframeLoaded:t})},setImagePreview:t=>e(gG(e=>{t(e.imagePreview)}))})),{enabled:!1,name:"sdkChatApp.global"}))})(this),!this.authClient.checkOptions())return;this.containerEl?h=this.containerEl:(this.defaultRoot=document.createElement("div"),document.body.appendChild(this.defaultRoot),h=this.defaultRoot),m=this.containerEl?"inlay"===_?"static":"absolute":void 0;let b=null==(i=e.ui)?void 0:i.uiKitCustomComponents,v=null==(n=e.ui)?void 0:n.contentBox;try{if(null==(c=e.ui)?void 0:c.uiKitCustomWebComponents){const t=function(e){if(e)try{let t={};return eXp.forEach(r=>{let a=e[r];a&&(customElements.get(a)||console.warn(`[WebChatClient] Web Component "${a}" for ${r} is not registered. Please register it using customElements.define() before initializing the chat client.`),t[r]=eXu(a))}),Object.keys(t).length>0?t:void 0}catch(e){console.error("[WebChatClient] Failed to adapt Web Components:",e);return}}(e.ui.uiKitCustomWebComponents);t&&(b={...b,...t})}if(null==(d=e.ui)?void 0:d.contentBoxWebComponent){const t=function(e){if(e)try{return customElements.get(e)||console.warn(`[WebChatClient] Web Component "${e}" is not registered. Please register it using customElements.define() before initializing the chat client.`),eXu(e)}catch(t){console.error(`[WebChatClient] Failed to adapt contentBox Web Component "${e}":`,t);return}}(e.ui.contentBoxWebComponent);t&&(v=t)}}catch(t){console.error("[WebChatClient] Failed to adapt Web Components, falling back to React components:",t),b=null==(u=e.ui)?void 0:u.uiKitCustomComponents,v=null==(p=e.ui)?void 0:p.contentBox}this.root=(0,fq.createRoot)(h),this.root.render((0,fU.jsx)(eXc,{client:this,globalStore:this.globalStore,position:m,uiKitCustomComponents:b,contentBox:v})),eXv.clients.push(this),"inlay"===_&&setTimeout(()=>{this.showChatBot()},0)}}eXb(eXv,"clients",[]),window.GlodonAIoT=window.GlodonAIoT||{},window.GlodonAIoT.WebChatClient=eXv})(),h})());