/*! For license information please see 8133.ae37b47a.js.LICENSE.txt */ (self.webpackChunk_coze_studio_app=self.webpackChunk_coze_studio_app||[]).push([["8133"],{198031:function(e,t,o){"use strict";var i=o(130001),r=o(455069),n=o(998600);t.Z=function(e,t){var o=(0,i.CR)((0,r.useState)(e),2),a=o[0],l=o[1],s=(0,n.Z)(function(){l(e)},t).run;return(0,r.useEffect)(function(){s()},[e]),a}},342160:function(e,t,o){"use strict";var i=o(130001),r=o(455069),n=o(408955);t.Z=function(e){var t=(0,n.Z)(),o=(0,i.CR)((0,r.useState)(e),2),a=o[0],l=o[1];return[a,(0,r.useCallback)(function(e){!t.current&&l(e)},[])]}},408955:function(e,t,o){"use strict";var i=o(455069);t.Z=function(){var e=(0,i.useRef)(!1);return(0,i.useEffect)(function(){return e.current=!1,function(){e.current=!0}},[]),e}},929184:function(e){"use strict";var t=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===o}(e)}(e)},o="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l(Array.isArray(e)?[]:{},e,t):e}function r(e,t,o){return e.concat(t).map(function(e){return i(e,o)})}function n(e){var t;return Object.keys(e).concat((t=e,Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return Object.propertyIsEnumerable.call(t,e)}):[]))}function a(e,t){try{return t in e}catch(e){return!1}}function l(e,o,s){(s=s||{}).arrayMerge=s.arrayMerge||r,s.isMergeableObject=s.isMergeableObject||t,s.cloneUnlessOtherwiseSpecified=i;var d,c,u,p,m=Array.isArray(o),g=Array.isArray(e);if(m!==g)return i(o,s);if(m)return s.arrayMerge(e,o,s);return d=e,c=o,p={},(u=s).isMergeableObject(d)&&n(d).forEach(function(e){p[e]=i(d[e],u)}),n(c).forEach(function(e){var t,o;if(!a(t=d,o=e)||!!(Object.hasOwnProperty.call(t,o)&&Object.propertyIsEnumerable.call(t,o)))a(d,e)&&u.isMergeableObject(c[e])?p[e]=(function(e,t){if(!t.customMerge)return l;var o=t.customMerge(e);return"function"==typeof o?o:l})(e,u)(d[e],c[e],u):p[e]=i(c[e],u)}),p}l.all=function(e,t){if(!Array.isArray(e))throw Error("first argument should be an array");return e.reduce(function(e,o){return l(e,o,t)},{})};e.exports=l},296944:function(e){"use strict";var t=function(e,t){return e+o(t)},o=function(e){var i;if(null===e||"boolean"==typeof e||void 0===e)return"";if("number"==typeof e)return e.toString();if("string"==typeof e)return e;if(Array.isArray(e))return e.reduce(t,"");return(i=e,Object.prototype.hasOwnProperty.call(i,"props")&&Object.prototype.hasOwnProperty.call(e.props,"children"))?o(e.props.children):""};o.default=o,e.exports=o},213433:function(e){var t=Error("Element already at target scroll position"),o=Error("Scroll cancelled"),i=Math.min,r=Date.now;function n(e){return function(n,s,d,c){"function"==typeof(d=d||{})&&(c=d,d={}),"function"!=typeof c&&(c=l);var u=r(),p=n[e],m=d.ease||a,g=isNaN(d.duration)?350:+d.duration,f=!1;return p===s?c(t,n[e]):requestAnimationFrame(function t(a){if(f)return c(o,n[e]);var l=i(1,(r()-u)/g),d=m(l);n[e]=d*(s-p)+p,l<1?requestAnimationFrame(t):requestAnimationFrame(function(){c(null,n[e])})}),function(){f=!0}}}function a(e){return .5*(1-Math.cos(Math.PI*e))}function l(){}e.exports={left:n("scrollLeft"),top:n("scrollTop")}},953681:function(e){var t,o;t=this,o=function(){return function(e){if(!!(e instanceof HTMLElement||e instanceof SVGElement)){for(var t=e.parentNode;t.parentNode;){if(function(e){var t=getComputedStyle(e,null).getPropertyValue("overflow");return t.indexOf("scroll")>-1||t.indexOf("auto")>-1}(t))return t;t=t.parentNode}return document.scrollingElement||document.documentElement}}},"function"==typeof define&&define.amd?define([],o):e.exports?e.exports=o():t.Scrollparent=o()},578419:function(e,t,o){var i=o(323086);function r(e,t){var o,r,n,a=null;if(!e||"string"!=typeof e)return a;for(var l=i(e),s="function"==typeof t,d=0,c=l.length;dP,rm:()=>i.rm,qz:()=>R.q});var i=o("910376");o("786406");var r=o("825955"),n=o("808549"),a=o("120454"),l=o("151064"),s=o("455069"),d=o("626389"),c=o.n(d),u=o("252237"),p=o.n(u),m=o("287487"),g=o("336205"),f=o("707107"),h=o("214942"),x=o("775699"),v=o("966219"),b=o("458949"),_=o("178385"),y=o("382534"),w=o("407821"),j=o.n(w),k=o("472772"),M=o.n(k),N=o("395245"),C=o.n(N),I=o("297998"),T=o.n(I),z=o("646576"),D=o.n(z),S=o("606121"),A=o.n(S),E=o("376756"),O={};O.styleTagTransform=A(),O.setAttributes=T(),O.insert=C().bind(null,"head"),O.domAPI=M(),O.insertStyleElement=D(),j()(E.Z,O);var L=E.Z&&E.Z.locals?E.Z.locals:void 0,Z=[{label:"cURL",value:b.gR.Curl},{label:"Wget",value:b.gR.Wget},{label:"Node.js",value:b.gR.NodeJS},{label:"Python",value:b.gR.Python},{label:"Golang",value:b.gR.Golang}],P=e=>{var{onCancel:t,visible:o,pluginAPIInfo:i}=e,[d,u]=(0,s.useState)(b.gR.Curl),[w,j]=(0,s.useState)(""),{id:k,space_type:M}=(0,h.rY)(e=>e.space),N=M===_.Sn.Personal,C=m.Z.useUserInfo();return(0,s.useEffect)(()=>{u(b.gR.Curl),j("")},[o]),(0,s.useEffect)(()=>{if(i){var e;(e=(0,r._)(function*(){j("");var e=yield y.Js.PluginAPI2Code({plugin_id:i.plugin_id||"",api_id:i.api_id||"",space_id:k||"",dev_id:(null==C?void 0:C.user_id_str)||"",program_lang:d});j((null==e?void 0:e.program_code)||"")}),function(){return e.apply(this,arguments)})()}},[d,i]),(0,l.jsx)(x.M5,{type:"base-composition",title:g.o.t("code_snippet"),visible:o,onCancel:t,footer:(0,l.jsx)(x.T,{children:(0,l.jsx)(x.y3,{theme:"solid",type:"primary",onClick:()=>{var e=c()(w),t={environment:"cn-boe",workspace_id:k||"",workspace_type:N?"personal_workspace":"team_workspace",tool_id:(null==i?void 0:i.api_id)||"",code_type:function(e){switch(e){case b.gR.Curl:return"curl";case b.gR.Wget:return"wget";case b.gR.NodeJS:return"javascript";case b.gR.Python:return"python";case b.gR.Golang:return"golang";default:return""}}(d)||"",status:1};e?(x.O$.success({content:g.o.t("copy_success")}),(0,f.Gg)(f.Kg.code_snippet_front,(0,a._)((0,n._)({},t),{status:0}))):(x.O$.warning({content:g.o.t("copy_failed")}),(0,f.Gg)(f.Kg.code_snippet_front,(0,a._)((0,n._)({},t),{status:1,error_message:"copy_failed"})))},children:g.o.t("copy")})}),maskClosable:!1,children:(0,l.jsxs)("div",{className:"h-[100%] flex flex-col min-h-0",children:[(0,l.jsx)("div",{children:(0,l.jsx)(x.FX,{type:"card",options:Z,defaultValue:d,className:"mb-[16px]",value:d,onChange:e=>u(e.target.value)})}),(0,l.jsx)("div",{className:p()(L["editor-container"],"flex-1 min-h-0"),children:(0,l.jsx)(v.Editor,{className:L.editor,options:{readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1},language:function(e){switch(e){case b.gR.Curl:case b.gR.Wget:case b.gR.NodeJS:return"javascript";case b.gR.Python:return"python";case b.gR.Golang:return"go";default:return"javascript"}}(d),theme:"tomorrow",width:"100%",value:w})})]})})};o("3779"),o("512421");var R=o("317612")},317612:function(e,t,o){"use strict";o.d(t,{q:()=>w});var i=o("808549"),r=o("473980"),n=o("151064"),a=o("455069"),l=o("550655"),s=o("120454"),d=o("664319"),c=o("252237"),u=o.n(c),p=o("277194"),m=o("336205"),g=o("775699"),f=o("30961"),h=o("458949");o("382534");var{Select:x,TextArea:v}=o("659596").l0;h.nw.NotFoundPlugin,m.o.t("plugin_feedback_modal_request_type_official_plugins_not_found"),h.nw.OfficialPlugin,m.o.t("plugin_feedback_modal_request_type_feedback_to_existing_plugin"),o("398778");var b=o("770131"),_=o("719894"),y=e=>{var{type:t,openMode:o,from:a,openModeCallback:l,showButton:c,showCopyPlugin:h,onCopyPluginCallback:x,pluginApiList:v,projectId:y,clickProjectPluginCallback:w,hideCreateBtn:j,initQuery:k}=e,M=(0,r._)(e,["type","openMode","from","openModeCallback","showButton","showCopyPlugin","onCopyPluginCallback","pluginApiList","projectId","clickProjectPluginCallback","hideCreateBtn","initQuery"]),{pluginApis:N,updateSkillPluginApis:C}=(0,p.Ee)((0,d.N)(e=>({pluginApis:e.pluginApis,updateSkillPluginApis:e.updateSkillPluginApis}))),{sider:I,filter:T,content:z}=(0,b.A)({pluginApiList:v?v:o===f.jG.OnlyOnceAdd?[]:N,onPluginApiListChange:C,openMode:o,from:a,openModeCallback:l,showButton:c,showCopyPlugin:h,onCopyPluginCallback:x,projectId:y,clickProjectPluginCallback:w,onCreateSuccess:null==M?void 0:M.onCreateSuccess,isShowStorePlugin:null==M?void 0:M.isShowStorePlugin,hideCreateBtn:j,initQuery:k});return(0,n.jsx)(g.FS,(0,s._)((0,i._)({"data-testid":"plugin-modal"},M),{header:m.o.t("bot_edit_plugin_select_title"),className:u()(_.Z["plugin-modal"],M.className),sider:I,extra:null,filter:T,content:z}))},w=e=>{var t=e||{},{closeCallback:o}=t,s=(0,r._)(t,["closeCallback"]),[d,c]=(0,a.useState)(!1),[u,p]=(0,a.useState)(1),[m,g]=(0,a.useState)();return{node:d?(0,n.jsx)(y,(0,i._)({type:u,visible:d,onCancel:()=>{c(!1),null==o||o()},initQuery:m,footer:null},s)):null,open:e=>{var t=(0,l.Z)(e)?e:null==e?void 0:e.openType,o=(0,l.Z)(e)?void 0:null==e?void 0:e.initQuery;c(!0),g(o),(0,l.Z)(t)&&p(t)},close:()=>{c(!1),g(void 0),null==o||o()}}}},770131:function(e,t,o){"use strict";o.d(t,{A:()=>U});var i=o("808549"),r=o("120454"),n=o("151064"),a=o("455069"),l=o("664319"),s=o("287487"),d=o("76672"),c=o("388993"),u=o("214942"),p=o("117140"),m=o("178385"),g=o("833047"),f=o("252237"),h=o.n(f),x=o("336205"),v=o("775699"),b=o("44172"),_=o("150838"),y=e=>{var{isSearching:t,type:o,onChange:i,projectId:r,from:a,isShowStorePlugin:l=!0}=e,s=(0,u.rY)(e=>e.space.space_type),d=(0,g.ir)().id,c=e=>{if(t){i(e);return}if(e!==o)i(e)};return(0,n.jsxs)("div",{className:_.Z["tool-tag-list"],children:[s===m.Sn.Personal&&(0,n.jsxs)("div",{"data-testid":"plugin.modal.filter.option.mine",className:h()(_.Z["tool-tag-list-cell"],{[_.Z.active]:o===g.eL.Mine}),onClick:()=>c(g.eL.Mine),children:[(0,n.jsx)(b.ckl,{className:_.Z["tool-tag-list-cell-icon"]}),x.o.t("add_resource_modal_sidebar_library_tools")]}),r&&a===g.tx.ProjectWorkflow?(0,n.jsxs)("div",{className:h()(_.Z["tool-tag-list-cell"],{[_.Z.active]:o===g.eL.Project}),onClick:()=>c(g.eL.Project),children:[(0,n.jsx)(b.Qi1,{className:_.Z["tool-tag-list-cell-icon"]}),x.o.t("add_resource_modal_sidebar_project_tools")]}):null,l?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(v.yh.Divider,{}),(0,n.jsx)("div",{className:_.Z["tool-content-area"],children:(0,n.jsx)("div",{className:h()(_.Z["tool-tag-list-cell"],{[_.Z.active]:o===d}),onClick:()=>c(d),children:x.o.t("explore_tools")})})]}):null]})},w=o("881305"),j=[{label:x.o.t("Create_time"),value:m.d$.CreateTime},{label:x.o.t("Update_time"),value:m.d$.UpdateTime}],k=e=>{var{query:t,setQuery:o}=e;return(0,n.jsx)("div",{className:w.Z["plugin-modal-filter"],children:t.type===g.eL.Mine||t.type===g.eL.Team||t.type===g.eL.Project?(0,n.jsxs)(v.Cj,{label:x.o.t("Sort"),value:t.orderBy,optionList:j,onChange:e=>{o({orderBy:e})},children:[(0,n.jsx)(v.Ph.Option,{value:m.d$.CreateTime,children:x.o.t("Create_time")}),(0,n.jsx)(v.Ph.Option,{value:m.d$.UpdateTime,children:x.o.t("Edit_time_2")})]}):null})},M=o("998600"),N=o("824113"),C=o("910376"),I=o("196163"),T=e=>{var{query:t,setQuery:o,from:i,onCreateSuccess:r,isShowStorePlugin:l,hideCreateBtn:s}=e,[d,c]=(0,a.useState)(!1),p=(0,u.rY)(e=>e.space.id),m=e=>{o({search:null!=e?e:""})},{run:f,cancel:h}=(0,M.Z)(e=>{m(e)},{wait:300});return(0,n.jsxs)(n.Fragment,{children:[s?null:(0,n.jsx)(C.rm,{projectId:t.projectId,isCreate:!0,visible:d,onSuccess:e=>{null==r||r({spaceId:p,pluginId:e})},onCancel:()=>{c(!1)}}),(0,n.jsxs)(v.yh,{style:{paddingTop:16},children:[(0,n.jsxs)(v.yh.Header,{children:[(0,n.jsx)(N.yO,{tabIndex:-1,value:t.search,maxLength:100,onSearch:e=>{e?f(e):(h(),m(e))},placeholder:x.o.t("Search"),"data-testid":"plugin.modal.search"}),s?null:(0,n.jsx)(v.y3,{"data-testid":"plugin.modal.create.plugin",className:I.Z.addbtn,theme:"solid",onClick:()=>{if(r&&(i===g.tx.ProjectIde||i===g.tx.ProjectWorkflow)){c(!0);return}window.open("/space/".concat(p,"/library?type=1"))},children:x.o.t("plugin_create")})]}),(0,n.jsx)(v.yh.Content,{children:(0,n.jsx)(y,{isSearching:""!==t.search,type:t.type,onChange:e=>{o({type:e})},from:i,projectId:t.projectId,isShowStorePlugin:l})})]})]})},z=o("322512"),D=o("136515"),S=o("309673"),A=o("938382"),E=o("364676"),O=o("44099"),L=o("825955"),Z=o("298203"),P=o("366714"),R=(e,t,o,i)=>(t||o)&&!i?{text:{emptyTitle:x.o.t("plugin_empty_desc"),emptyDesc:x.o.t("plugin_empty_description")},btn:{emptyClick:()=>{window.open("/space/".concat(e,"/library?type=1"))},emptyText:x.o.t("plugin_create")}}:{text:{emptyTitle:x.o.t("plugin_empty_desc"),emptyDesc:""},btn:{emptyClick:()=>{window.open("/store/plugin")},emptyText:x.o.t("mkl_plugin_to_plugin_gallery")}},F=e=>{var{query:t,pluginApiList:o,onPluginApiListChange:s,openMode:d,from:c,openModeCallback:p,showButton:m,showCopyPlugin:f,onCopyPluginCallback:x,clickProjectPluginCallback:b}=e,{type:_,mineActive:y,search:w,isOfficial:j,orderBy:k,orderByPublic:M,orderByFavorite:N,agentId:C,pluginType:I}=t,T=(0,u.rY)(e=>e.space.id),F=(0,a.useRef)(null),[B,U]=(0,a.useState)([]),V=(0,a.useRef)(null),{scroll2Top:W,loadData:G,isSearching:Y,isFavorite:H,isTemplate:Q,isProject:q,isMine:K,isTeam:J}=function(e){var t,{scrollContainer:o,query:n,triggerService:l,formatCacheKey:s,onSetScrollData:d}=e,{search:c,type:u,mineActive:p}=n,m=""!==c,f=u===g.eL.Mine,h=u===g.eL.Team,x=u===g.eL.Favorite,v=u===g.eL.Project,b=p===g.gp.Mine,_=Number(u)>=0||"recommend"===u,y=(e,t,o)=>{var n=(0,Z.lJ)(t);if(!t||!n)return!1;var{data:a}=n;if(!o)return n.data;var l=(null==e?void 0:e.nextPage)||1,{list:s,total:c}=a||{list:[],total:0},u=c>0&&l*g.L8{if(!!e)(0,Z.K7)(e,t,{time:Date.now(),data:o})};var j=(t=(0,L._)(function*(e){var t=(null==e?void 0:e.nextPage)||1,o=s({query:n,isSearching:m,isTemplate:_,page:t})||"";!f&&!h&&(o="");var i=y(e,o,!_);!i&&w(o,3e5,i=yield l(n,{nextPage:t,isMine:f,isTeam:h,isCreatorMine:b,isTemplate:_,isFavorite:x,isProject:v}));var{list:r,hasMore:a}=i||{list:[],total:0},d=t+1,c={};return((null==e?void 0:e.list)||[]).map(e=>{var t;c[null==e?void 0:null===(t=e.pluginInfo)||void 0===t?void 0:t.id]=!0}),{list:(r||[]).filter(e=>{var t,o=null==e?void 0:null===(t=e.pluginInfo)||void 0===t?void 0:t.id;return(!o||!c[o])&&!0})||[],hasMore:a,nextPage:d}}),function(e){return t.apply(this,arguments)});return(0,a.useEffect)(()=>{(0,Z.LK)()},[]),{scroll2Top:()=>{o.current&&o.current.scrollTo({top:0})},isSearching:m,loadData:j,isFavorite:x,isTemplate:_,isMine:f,isTeam:h,isProject:v}}({query:t,formatCacheKey:g.TB,scrollContainer:F,triggerService:g.Ht,onSetScrollData:e=>{var t;null===(t=V.current)||void 0===t||t.mutate(e)}}),{nodes:X}=(0,E.I)((0,l.N)(e=>({nodes:e.nodes})));return(0,D.Z)(()=>{W()},[]),(0,n.jsx)(v.vy,{children:(0,n.jsx)("div",{className:P.Z["plugin-content"],ref:F,children:(0,n.jsx)(v.vy.Content,{style:{minHeight:"100%",display:"flex"},children:(0,n.jsx)(v.UO,{className:P.Z["plugin-collapse"],activeKey:B,onChange:e=>{U(e)},expandIcon:(0,n.jsx)(S.Z,{className:P.Z["collapse-icon"],"data-testid":"plugin-collapse-panel-expand"}),collapseIcon:(0,n.jsx)(A.Z,{className:P.Z["collapse-icon"],"data-testid":"plugin-collapse-panel-collapse"}),children:(0,n.jsx)(O.$r,{ref:V,itemClassName:P.Z["item-container"],renderItem:(e,t)=>{var a,l,u,v=null==e?void 0:null===(a=e.pluginInfo)||void 0===a?void 0:a.id;return(0,n.jsx)(g.WB,{agentId:C,index:t,pluginApiList:o,onPluginApiListChange:s,onCopyPluginCallback:x,showButton:m,showCopyPlugin:f,openMode:d,from:c,workflowNodes:X,openModeCallback:p,highlightWords:[w],showCreator:!0,showMarketLink:H||Q,showCreateTime:0===k||"number"==typeof _,showPublishTime:!K&&!J&&!q,activeKey:B,scrollContainerRef:F,isFromMarket:null==e?void 0:e.isFromMarket,info:(0,r._)((0,i._)({},null==e?void 0:e.pluginInfo),{id:v,listed_at:null==e?void 0:null===(l=e.productInfo)||void 0===l?void 0:l.listed_at,plugin_apis:(0,z.Z)(null==e?void 0:null===(u=e.pluginInfo)||void 0===u?void 0:u.plugin_apis,e=>e.name)}),productInfo:null==e?void 0:e.productInfo,commercialSetting:null==e?void 0:e.commercial_setting,type:String(_||""),className:h()(P.Z["plugin-collapse"],{[P.Z.activePanel]:null==B?void 0:B.includes(null!=v?v:"")}),showProjectPluginLink:q,clickProjectPluginCallback:b},v)},emptyConf:R(T,K,J,q),scrollConf:{reloadDeps:[_,y,w,j,k,M,N,I],targetRef:F,loadData:G},isSearching:Y})})})})})},B=(e,t)=>e!==g.tx.ProjectWorkflow&&e===g.tx.ProjectIde&&t&&e?t===m.Sn.Personal?g.eL.Mine:t===m.Sn.Team&&e===g.tx.ProjectIde?g.eL.Team:"":"",U=e=>{var t,o,{pluginApiList:f,onPluginApiListChange:h,agentId:x,openMode:v,from:b,openModeCallback:_,showButton:y,showCopyPlugin:w,onCopyPluginCallback:j,projectId:M,clickProjectPluginCallback:N,onCreateSuccess:C,isShowStorePlugin:I,hideCreateBtn:z,initQuery:D}=e,S=s.Z.useUserInfo(),A=(0,u.rY)(e=>e.space.space_type),[E,O]=(0,a.useState)({agentId:x,projectId:M,devId:(null==S?void 0:S.user_id_str)||"",search:"",page:g.XJ,type:null!==(t=null==D?void 0:D.type)&&void 0!==t?t:B(b,A),orderBy:m.d$.CreateTime,orderByPublic:p.ER.Heat,orderByFavorite:p.ER.Newest,mineActive:g.gp.All,isOfficial:null!==(o=null==D?void 0:D.isOfficial)&&void 0!==o?o:void 0,pluginType:b===g.tx.ProjectWorkflow?p.zV.CLoudPlugin:void 0}),{botId:L}=(0,c.G)((0,l.N)(e=>({botId:e.botId}))),{version:Z}=(0,d.c2)((0,l.N)(e=>({version:e.baseVersion}))),P=function(e){var t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],o={current_entity_type:p._J.Bot,current_entity_id:L,current_entity_version:Z};O(n=>t?(0,r._)((0,i._)({},n,e),{page:g.XJ,botInfo:o}):(0,r._)((0,i._)({},n,e),{botInfo:o}))},R=(0,n.jsx)(T,{hideCreateBtn:z,query:E,setQuery:P,from:b,onCreateSuccess:C,isShowStorePlugin:I}),U=(0,n.jsx)(k,{from:b,query:E,setQuery:P});return{sider:R,content:(0,n.jsx)(F,{query:E,setQuery:P,pluginApiList:f,onPluginApiListChange:h,openMode:v,from:b,openModeCallback:_,showButton:y,showCopyPlugin:w,onCopyPluginCallback:j,clickProjectPluginCallback:N}),filter:U}}},910376:function(e,t,o){"use strict";o.d(t,{Tj:()=>eo,cC:()=>en,e2:()=>er,rm:()=>X,_u:()=>ei});var i,r,n=o("825955"),a=o("151064"),l=o("455069"),s=o("808549"),d=o("120454"),c=o("735114"),u=o("215451"),p=o("581259"),m=o("368696"),g=o("75117"),f=o("297158"),h=o("336205"),x=o("873183"),v=o("659596"),b=o("298203"),_=o("189284"),y=o("178385"),w=o("382534"),j=o("625196"),k=o("458949"),M={name:[{required:!0,message:h.o.t("create_plugin_modal_name1_error")},{pattern:RegExp("^[\\w\\s\\u4e00-\\u9fa5]+$","u"),message:h.o.t("create_plugin_modal_nameerror_cn")}],desc:[{required:!0,message:h.o.t("create_plugin_modal_descrip1_error")},{}],url:[{required:!0,message:h.o.t("create_plugin_modal_url1_error")}],key:[{required:!0,message:h.o.t("create_plugin_modal_Parameter_error")},{pattern:/^[\x00-\x7F]+$/,message:h.o.t("plugin_Parametename_error")}],service_token:[{required:!0,message:h.o.t("create_plugin_modal_Servicetoken_error")}]},N=e=>{var t,o;if(!!e)return[{url:(null===(t=e.icon)||void 0===t?void 0:t.url)||"",uid:(null==e?void 0:null===(o=e.icon)||void 0===o?void 0:o.uri)||""}]},C=(e,t,o)=>{if((null==t?void 0:t[0])===0)return e.find(e=>0===e.value);if((null==t?void 0:t[0])===1){var i=e.find(e=>1===e.value);return null==i?void 0:i.children.find(e=>e.value===o)}if((null==t?void 0:t[0])===3){var r=e.find(e=>3===e.value);return null==r?void 0:r.children.find(e=>e.value===o)}},I=()=>{var e,[t,o]=(0,l.useState)([]),[i,r]=(0,l.useState)([]),[a,s]=(0,l.useState)("1");var d=(e=(0,n._)(function*(){var e,t,i=yield w.Js.GetOAuthSchema();o([{label:h.o.t("create_plugin_modal_Authorization_no"),value:0,key:"None"},{label:h.o.t("create_plugin_modal_Authorization_service"),value:1,key:"Service",children:[{label:h.o.t("plugin_auth_method_service_api_key"),value:0,key:"Service Token / API Key"}]},{label:h.o.t("create_plugin_modal_Authorization_oauth"),value:3,key:"OAuth",children:(0,b.dj)(i.oauth_schema)}]);var n=null===(t=(0,b.dj)(i.ide_conf,[]))||void 0===t?void 0:null===(e=t.find)||void 0===e?void 0:e.call(t,e=>"code_runtime_enum"===e.key);n&&(r(n.options.map(e=>({value:e.value,label:e.name}))),s(n.default))}),function(){return e.apply(this,arguments)});return(0,l.useEffect)(()=>{d()},[]),{authOption:t,runtimeOptions:i,defaultRuntime:a}},T=e=>{var t,o,i,r,n,{val:a,spaceId:l,headerList:c,projectId:u,creationMethod:p,defaultRuntime:m,pluginType:g,extItemsJSON:f}=e,h=null===(t=a.auth_type)||void 0===t?void 0:t.at(0),x=null===(o=a.auth_type)||void 0===o?void 0:o.at(-1),v=(0,d._)((0,s._)({},a),{icon:{uri:null==a?void 0:null===(r=a.plugin_uri)||void 0===r?void 0:null===(i=r[0])||void 0===i?void 0:i.uid},auth_type:h,common_params:{[k.Pi.Header]:c,[k.Pi.Body]:[],[k.Pi.Path]:[],[k.Pi.Query]:[]},space_id:l,project_id:u,creation_method:p,ide_code_runtime:null!==(n=a.ide_code_runtime)&&void 0!==n?n:m,plugin_type:Number(g),private_link_id:"0"===a.private_link_id?void 0:a.private_link_id});return 1===h?(0,d._)((0,s._)({},v),{sub_auth_type:x,auth_payload:JSON.stringify(f)}):(0,d._)((0,s._)({},v),{sub_auth_type:3===h?x:void 0,oauth_info:JSON.stringify(f)})};var z=(i=(0,n._)(function*(e){var{params:t}=e;return(yield w.Js.RegisterPluginMeta((0,s._)({},t),{__disableErrorToast:!0})).plugin_id}),function(e){return i.apply(this,arguments)});var D=(r=(0,n._)(function*(e){var{params:t,editInfo:o}=e;return yield w.Js.UpdatePluginMeta((0,d._)((0,s._)({},t),{plugin_id:(null==o?void 0:o.plugin_id)||"",edit_version:null==o?void 0:o.edit_version}),{__disableErrorToast:!0}),""}),function(e){return r.apply(this,arguments)}),S=o("274038"),A=e=>e?"".concat(null==e?void 0:e.plugin_type,"-").concat(null==e?void 0:e.creation_method):"",E=(0,v.Q2)(v.vT),O=()=>[{label:h.o.t("plugin_creation_method_cloud_plugin_use_existing_services"),value:p.Qb}],L=e=>{var t,o,i,r,k,I,T,z,D,L,Z,P,R,F,B,U,V,W,G,{pluginState:Y,disabled:H,editInfo:Q,isCreate:q,visible:K}=e,{formApi:J,extItems:X,setExtItems:$,headerList:ee,setHeaderList:et,isValidCheckResult:eo,setIsValidCheckResult:ei,pluginTypeCreationMethod:er,setPluginTypeCreationMethod:en,authOption:ea}=Y,[el]=(0,_.V)(),{compareLevel:es}=(0,u.th)(),ed=(0,m.HU)(),[ec,eu]=(0,l.useState)(0),[ep,em]=(0,l.useState)(0),[eg,ef]=(0,l.useState)(!1),eh=()=>{!eo&&ei(!0)},ex=O(),ev=(0,p.C5)(),[eb,e_]=(0,l.useState)(),{data:ey}=(0,c.Z)((0,n._)(function*(){var e,{data:t}=yield w.Js.PrivateLinkList({enterprise_id:null==ed?void 0:ed.enterprise_id});e_(null==t?void 0:t.private_links);var o=null==t?void 0:null===(e=t.private_links)||void 0===e?void 0:e.map(e=>({label:e.name,value:e.id}));return[{label:h.o.t("vpc_plugin_create_plugin_2"),value:"0"},...null!=o?o:[]]}),{ready:es===u.aZ.Enterprise&&el["bot.studio.plugin_vpc"]&&!1});var ew=(t=(0,n._)(function*(){try{var e,t,o,i=yield w.nA.GetIcon({icon_type:y.Tu.Plugin}),r=null===(t=i.data)||void 0===t?void 0:null===(e=t.icon_list)||void 0===e?void 0:e[0];if(!r)return;var{url:n="",uri:a=""}=r;null===(o=J.current)||void 0===o||o.setValue("plugin_uri",[{url:n,uid:a}])}catch(e){f.kg.info("getIcon error: ".concat(e))}}),function(){return t.apply(this,arguments)});(0,l.useEffect)(()=>{if(!!K)if(!q&&Q){var e,t,o,i,r,n,a,l,s,d,c,p,m,g,f,h,x,v;if((null===(t=Q.meta_info)||void 0===t?void 0:null===(e=t.auth_type)||void 0===e?void 0:e.at(0))===1)switch(null===(m=Q.meta_info)||void 0===m?void 0:m.sub_auth_type){case 0:em(5);break;case 1:em(6);break;case 2:em(7);break;default:em(0)}else em(null!==(h=null===(f=Q.meta_info)||void 0===f?void 0:null===(g=f.auth_type)||void 0===g?void 0:g.at(-1))&&void 0!==h?h:0);eu(null!==(x=null===(i=Q.meta_info)||void 0===i?void 0:null===(o=i.auth_type)||void 0===o?void 0:o.at(0))&&void 0!==x?x:0),$((null===(r=C(ea,null===(n=Q.meta_info)||void 0===n?void 0:n.auth_type,null!==(v=null===(l=Q.meta_info)||void 0===l?void 0:null===(a=l.auth_type)||void 0===a?void 0:a[1])&&void 0!==v?v:null===(s=Q.meta_info)||void 0===s?void 0:s.sub_auth_type))||void 0===r?void 0:r.items)||[]),et([...(null===(c=Q.meta_info)||void 0===c?void 0:null===(d=c.common_params)||void 0===d?void 0:d[4])||[]]),en("".concat(Q.plugin_type,"-").concat(Q.creation_method)),(null==Q?void 0:null===(p=Q.meta_info)||void 0===p?void 0:p.private_link_id)&&es===u.aZ.Enterprise&&el["bot.studio.plugin_vpc"]&&ef(!0)}else ej()},[K]);var ej=()=>{ew(),em(0),em(0),$([]),et([{name:"User-Agent",value:"Coze/1.0"}]),ei(!0),en(void 0)},ek=()=>{et(e=>[...e,{name:"",value:""}])},eM=e=>{et(t=>t.length<=1?[{name:"",value:""}]:t.filter((t,o)=>o!==e))},eN=(e,t)=>{et(o=>o.map((o,i)=>i===e?t:o))};return(0,a.jsxs)(v.l0,{getFormApi:e=>J.current=e,autoScrollToError:!0,showValidateIcon:!1,className:S.Z["upload-form"],onValueChange:e=>{if("auth_type"in e){if(1===e.auth_type.at(0))switch(e.auth_type.at(-1)){case 0:em(5);break;case 1:em(6);break;case 2:em(7);break;default:em(0)}else em(e.auth_type.at(-1));eu(e.auth_type.at(0))}},children:[(0,a.jsx)(g.s,{noLabel:!0,disabled:H,fieldClassName:S.Z["upload-field"],field:"plugin_uri",iconType:y.Tu.Plugin,fileBizType:y.ym.BIZ_PLUGIN_ICON,initValue:N(null==Q?void 0:Q.meta_info),onChange:eh}),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(v.ld,{disabled:H,initValue:null==Q?void 0:null===(V=Q.meta_info)||void 0===V?void 0:V.name,field:"name",className:S.Z["textarea-single-line"],label:h.o.t("create_plugin_modal_name1"),placeholder:h.o.t("create_plugin_modal_name2"),trigger:["blur","change"],maxCount:30,maxLength:30,rows:1,onBlur:()=>{var e,t,o;null===(o=J.current)||void 0===o||o.setValue("name",null===(t=J.current)||void 0===t?void 0:null===(e=t.getValue("name"))||void 0===e?void 0:e.trim())},onChange:eh,rules:M.name}),(0,a.jsx)(v.ld,{disabled:H,initValue:null==Q?void 0:null===(W=Q.meta_info)||void 0===W?void 0:W.desc,field:"desc",label:h.o.t("create_plugin_modal_descrip1"),trigger:["blur","change"],placeholder:h.o.t("create_plugin_modal_descrip2"),rows:2,maxCount:600,maxLength:600,onBlur:()=>{var e,t,o;null===(o=J.current)||void 0===o||o.setValue("desc",null===(t=J.current)||void 0===t?void 0:null===(e=t.getValue("desc"))||void 0===e?void 0:e.trim())},onChange:eh,rules:M.desc}),(0,a.jsx)(v.l0.Slot,{label:{text:h.o.t("plugin_creation_method"),required:!0,extra:(0,a.jsx)(j.O,{data:ev})},children:q?(0,a.jsx)(v.l0.RadioGroup,{noLabel:!0,className:S.Z["creation-method"],direction:"vertical",rules:[{required:!0,message:h.o.t("plugin_creation_select_creation_method_warning")}],field:"creation_method",disabled:H,options:ex,initValue:Q?A(Q):void 0,onChange:e=>en(e.target.value)}):(0,a.jsx)(v.ZT.Text,{fontSize:"14px",children:null===(G=ex.find(e=>e.value===er))||void 0===G?void 0:G.label})})]}),er===p.Qb?(U=[0],!Q&&(U=[0]),(null==Q?void 0:null===(i=Q.meta_info)||void 0===i?void 0:null===(o=i.auth_type)||void 0===o?void 0:o.length)===2?U=null==Q?void 0:null===(D=Q.meta_info)||void 0===D?void 0:D.auth_type:(null==Q?void 0:null===(Z=Q.meta_info)||void 0===Z?void 0:null===(L=Z.auth_type)||void 0===L?void 0:L.at(0))===0?U=null==Q?void 0:null===(P=Q.meta_info)||void 0===P?void 0:P.auth_type:void 0!==(null==Q?void 0:null===(R=Q.meta_info)||void 0===R?void 0:R.sub_auth_type)&&(U=[...(null==Q?void 0:null===(F=Q.meta_info)||void 0===F?void 0:F.auth_type)||[],null==Q?void 0:null===(B=Q.meta_info)||void 0===B?void 0:B.sub_auth_type]),(0,a.jsxs)(a.Fragment,{children:[es===u.aZ.Enterprise&&el["bot.studio.plugin_vpc"]?(0,a.jsx)(v.ih,{label:{text:h.o.t("vpc_plugin_create_plugin_1"),required:!0,extra:(0,a.jsx)(j.O,{data:p.HW.private_link_id})},field:"private_link_id",style:{width:"100%"},initValue:(null==Q?void 0:null===(r=Q.meta_info)||void 0===r?void 0:r.private_link_id)||"0",onChange:e=>{var t,o,i;ef("0"!==e),"0"===e?null===(t=J.current)||void 0===t||t.setValue("url",""):null===(i=J.current)||void 0===i||i.setValue("url",null==eb?void 0:null===(o=eb.find(t=>t.id===e))||void 0===o?void 0:o.plugin_access_url)},optionList:ey}):null,H?null:(0,a.jsx)(v.yt,{disabled:eg,className:S.Z["textarea-single-line"],initValue:null==Q?void 0:null===(k=Q.meta_info)||void 0===k?void 0:k.url,trigger:["blur","change"],field:"url",label:h.o.t("create_plugin_modal_url1"),placeholder:h.o.t("create_plugin_modal_url2"),onBlur:()=>{var e,t,o;null===(o=J.current)||void 0===o||o.setValue("url",null===(t=J.current)||void 0===t?void 0:null===(e=t.getValue("url"))||void 0===e?void 0:e.trim())},rules:eg?[]:M.url}),(0,a.jsx)(v.l0.Slot,{className:S.Z["header-list"],label:{text:h.o.t("plugin_create_header_list_title"),align:"right",extra:(0,a.jsxs)("div",{className:S.Z["header-list-extra"],children:[(0,a.jsx)(j.O,{data:p.HW.header_list}),ee.length<20&&!H&&(0,a.jsx)(v.hU,{size:"small",color:"secondary",icon:(0,a.jsx)(x.PwN,{className:"coz-fg-hglt text-[16px]"}),onClick:ek})]})},children:(0,a.jsxs)("div",{className:S.Z["header-list-box"],children:[(0,a.jsxs)(v.X2,{className:S.Z["header-row"],children:[(0,a.jsx)(v.JX,{span:9,children:(0,a.jsx)("div",{className:S.Z["header-col-content"],children:"Key"})}),(0,a.jsx)(v.JX,{span:12,children:(0,a.jsx)("div",{className:S.Z["header-col-content"],children:"Value"})}),(0,a.jsx)(v.JX,{span:3,children:(0,a.jsx)("div",{className:S.Z["header-col-content"],children:h.o.t("plugin_create_action_btn")})})]}),(0,a.jsx)("div",{children:null==ee?void 0:ee.map((e,t)=>(0,a.jsxs)(v.X2,{type:"flex",justify:"space-between",align:"middle",children:[(0,a.jsx)(v.JX,{span:9,children:(0,a.jsx)("div",{className:S.Z["col-content"],children:(0,a.jsx)(v.II,{placeholder:"Name",value:e.name,onChange:o=>{eN(t,(0,d._)((0,s._)({},e),{name:o}))},maxLength:100,disabled:H})})}),(0,a.jsx)(v.JX,{span:12,children:(0,a.jsx)("div",{className:S.Z["col-content"],children:(0,a.jsx)(v.II,{placeholder:"Value",value:e.value,onChange:o=>{eN(t,(0,d._)((0,s._)({},e),{value:o}))},maxLength:2e3,disabled:H})})}),(0,a.jsx)(v.JX,{span:3,children:(0,a.jsx)("div",{className:S.Z["col-content"],children:(0,a.jsx)(v.hU,{size:"small",color:"secondary",icon:(0,a.jsx)(x.dVD,{className:"coz-fg-secondary text-[14px]"}),disabled:H,onClick:()=>eM(t)})})})]},t))})]})}),(0,a.jsx)(E,{disabled:H,rules:[{required:!0}],style:{width:"100%"},initValue:U,field:"auth_type",label:{text:h.o.t("create_plugin_modal_auth1"),extra:(0,a.jsx)(j.O,{data:p.HW.auth})},placeholder:h.o.t("please_select_an_authorization_method"),treeData:ea,displayRender:e=>"".concat(e.at(-1)),onChange:e=>{var t;$((null===(t=C(ea,[e.at(0)],e.at(-1)))||void 0===t?void 0:t.items)||[])}}),1===ec&&5===ep&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(v.l0.RadioGroup,{disabled:H,rules:[{required:!0}],field:"location",label:{text:h.o.t("create_plugin_modal_location"),extra:(0,a.jsx)(j.O,{data:p.HW.location})},options:p.cg,initValue:(null==Q?void 0:null===(I=Q.meta_info)||void 0===I?void 0:I.location)||1}),(0,a.jsx)(v.yt,{disabled:H,initValue:null==Q?void 0:null===(T=Q.meta_info)||void 0===T?void 0:T.key,trigger:["blur","change"],field:"key",label:{text:h.o.t("create_plugin_modal_Parameter"),extra:(0,a.jsx)(j.O,{data:p.HW.key})},placeholder:h.o.t("create_plugin_modal_Parameter_empty"),maxLength:100,rules:M.key}),(0,a.jsx)(v.yt,{disabled:H,initValue:null==Q?void 0:null===(z=Q.meta_info)||void 0===z?void 0:z.service_token,trigger:["blur","change"],field:"service_token",label:{text:h.o.t("create_plugin_modal_Servicetoken"),extra:(0,a.jsx)(j.O,{data:p.HW.service_token})},placeholder:h.o.t("create_plugin_modal_Servicetoken_empty"),maxLength:2e3,rules:M.service_token})]}),null==X?void 0:X.map((e,t)=>{var o,i,r,n,s={};return((null==Q?void 0:null===(i=Q.meta_info)||void 0===i?void 0:null===(o=i.auth_type)||void 0===o?void 0:o.at(0))===1&&(s=(0,b.dj)(Q.meta_info.auth_payload)),(null==Q?void 0:null===(n=Q.meta_info)||void 0===n?void 0:null===(r=n.auth_type)||void 0===r?void 0:r.at(0))===3&&(s=(0,b.dj)(Q.meta_info.oauth_info)),"select"===e.type)?(0,a.jsx)(v.ih,{disabled:H,label:(null==e?void 0:e.label)||e.key,field:e.key,optionList:p.Cx,initValue:(null==s?void 0:s[e.key])||e.default,style:{width:"100%"},rules:[{required:e.required,message:p.VF[e.key]}]},e.key+t):(0,a.jsx)(l.Fragment,{children:(0,a.jsx)(v.yt,{disabled:H,trigger:["blur","change"],field:e.key,label:{text:(null==e?void 0:e.label)||e.key,extra:p.HW[e.key]&&(0,a.jsx)(j.O,{data:p.HW[e.key]})},placeholder:p.VF[e.key],initValue:(null==s?void 0:s[e.key])||e.default,maxLength:e.max_len,rules:[{required:e.required,message:p.VF[e.key]},"url"===e.type?{pattern:/^(http|https):\/\/.+$/,message:h.o.t("create_plugin_modal_URLerror")}:{pattern:/^[\x00-\x7F]+$/,message:h.o.t("create_plugin_modal_descrip_error")},...(null==e?void 0:e.ruleList)||[]]},e.key)},e.key+t)})]})):null]})},Z=()=>{var e=(0,l.useRef)(),{authOption:t,runtimeOptions:o,defaultRuntime:i}=I(),[r,n]=(0,l.useState)([]),[a,s]=(0,l.useState)([{name:"User-Agent",value:"Coze/1.0"}]),[d,c]=(0,l.useState)(!0),[u,p]=(0,l.useState)();return{formApi:e,extItems:r,setExtItems:n,headerList:a,setHeaderList:s,isValidCheckResult:d,setIsValidCheckResult:c,pluginTypeCreationMethod:u,setPluginTypeCreationMethod:p,authOption:t,runtimeOptions:o,defaultRuntime:i}},P=o("947578"),R=o("214942"),F=o("900021"),B=o("927070"),U=o("3779"),V=o("786406"),W=e=>{var{onCancel:t,onSuccess:o,projectId:i}=e,[r,n]=(0,l.useState)(!1);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(V.iy,{projectId:i,visible:r,onSuccess:e=>{var t=null==e?void 0:e.plugin_id;t?null==o||o(t):null==o||o()},onCancel:()=>n(!1)}),(0,a.jsx)(v.zx,{color:"primary",onClick:()=>{n(!0),null==t||t()},children:h.o.t("import")})]})},G=o("44172"),Y=o("252237"),H=o.n(Y),Q=o("775699"),q=o("512421"),K=e=>{var t,{isCreate:o=!0,onCancel:i,editInfo:r,visible:c,onSuccess:u,disabled:p=!1,actions:m,projectId:g}=e,[f,x]=(0,l.useState)(),[v,_]=(0,l.useState)(),[y,j]=(0,l.useState)(),[k,M]=(0,l.useState)(),[N,C]=(0,l.useState)();(0,l.useEffect)(()=>{if(c){var e,t,o,i,n;x(JSON.stringify((0,b.dj)(null==r?void 0:null===(e=r.code_info)||void 0===e?void 0:e.plugin_desc),null,2)||""),C((null==r?void 0:null===(t=r.code_info)||void 0===t?void 0:t.openapi_desc)||""),_(null==r?void 0:null===(o=r.code_info)||void 0===o?void 0:o.client_id),j(null==r?void 0:null===(i=r.code_info)||void 0===i?void 0:i.client_secret),M(null==r?void 0:null===(n=r.code_info)||void 0===n?void 0:n.service_token)}},[c]);var I=(t=(0,n._)(function*(){var e,t,n={ai_plugin:f,client_id:v,client_secret:y,service_token:k,openapi:N};o?t=yield w.Js.RegisterPlugin((0,d._)((0,s._)({},n),{project_id:g,space_id:R.rY.getState().getSpaceId()})):yield w.Js.UpdatePlugin((0,d._)((0,s._)({},n),{plugin_id:null==r?void 0:r.plugin_id,edit_version:null==r?void 0:r.edit_version})),Q.FN.success({content:o?h.o.t("register_success"):h.o.t("Plugin_update_success"),showClose:!1}),null==u||u(null==t?void 0:null===(e=t.data)||void 0===e?void 0:e.plugin_id),null==i||i()}),function(){return t.apply(this,arguments)});return(0,a.jsx)(Q.M5,{fullScreen:!0,className:"full-screen-modal",title:(0,a.jsxs)("div",{className:B.Z["bot-code-edit-title-action"],children:[(0,a.jsx)("span",{children:o?h.o.t("plugin_create"):h.o.t("plugin_Update")}),(0,a.jsx)("div",{children:m})]}),visible:c,onCancel:()=>null==i?void 0:i(),footer:p?null:(0,a.jsxs)(Q.T,{children:[(0,a.jsx)(Q.y3,{type:"tertiary",onClick:()=>null==i?void 0:i(),children:h.o.t("Cancel")}),(0,a.jsx)(Q.y3,{type:"primary",onClick:I,children:h.o.t("Confirm")})]}),maskClosable:!1,children:(0,a.jsx)("div",{className:H()(B.Z.flex),children:(0,a.jsx)("div",{className:H()(B.Z["plugin-height"],B.Z.flex5),children:(0,a.jsxs)("div",{style:{display:"flex"},children:[(0,a.jsxs)("div",{style:{flex:1,borderRight:"1px solid rgb(215,218,221)"},children:[(0,a.jsx)("div",{className:B.Z.title,children:h.o.t("ai_plugin_(fill_in_json)_*")}),(0,a.jsx)(q.M,{dataTestID:"create-plugin-code-editor-json",disabled:p,theme:"tomorrow",mode:"json",height:560,value:f,useValidate:!1,onChange:e=>x(e)})]}),(0,a.jsxs)("div",{style:{flex:1},children:[(0,a.jsx)("div",{className:B.Z.title,children:h.o.t("openapi_(fill_in_yaml)_*")}),(0,a.jsx)(q.M,{dataTestID:"create-plugin-code-editor-yaml",disabled:p,theme:"tomorrow",mode:"yaml",height:560,value:N,useValidate:!1,onChange:e=>C(e)})]})]})})})})},J=e=>{var{onCancel:t,onSuccess:o,projectId:i}=e,[r,n]=(0,l.useState)(!1);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(K,{isCreate:!0,visible:r,onSuccess:e=>{null==o||o(e)},onCancel:()=>{n(!1)},projectId:i}),(0,a.jsx)(v.zx,{"data-testid":"create-plugin-code-modal-button",color:"primary",icon:(0,a.jsx)(G.WTs,{}),onClick:()=>{n(!0),null==t||t()}})]})},X=e=>{var t,{onCancel:o,editInfo:i,isCreate:r=!0,visible:s,onSuccess:d,disabled:c=!1,projectId:u}=e,{id:p}=(0,R.rY)(e=>e.space),m=(0,l.useMemo)(()=>r?(0,a.jsxs)("div",{className:"w-full flex justify-between items-center pr-[8px]",children:[(0,a.jsx)("div",{children:h.o.t("create_plugin_modal_title1")}),(0,a.jsxs)(v.T,{children:[(0,a.jsx)(J,{onCancel:o,onSuccess:d,projectId:u}),(0,a.jsx)(W,{onCancel:o,onSuccess:d,projectId:u}),(0,a.jsx)(v.iz,{layout:"vertical",className:"h-5"})]})]}):c?h.o.t("plugin_detail_view_modal_title"):h.o.t("plugin_detail_edit_modal_title"),[r,c]),[g,f]=(0,l.useState)(!1),b=Z(),{formApi:_,extItems:y,headerList:w,isValidCheckResult:j,setIsValidCheckResult:k,pluginTypeCreationMethod:M,defaultRuntime:N}=b;(0,l.useEffect)(()=>{if(!!r)if(s){var e,t=document.querySelector(".create-plugin-modal-content .semi-modal-body");t&&(t.scrollTop=0)}else null==_||null===(e=_.current)||void 0===e||e.reset()},[s]);var C=(t=(0,n._)(function*(){yield null===(e=_.current)||void 0===e?void 0:e.validate();var e,t,n=r?"create":"edit",a=null===(t=_.current)||void 0===t?void 0:t.getValues();if(!!a&&!!M){var l={};null==y||y.forEach(e=>{e.key in a&&(l[e.key]=a[e.key])});var[s,c]=M.split("-"),m=T({val:a,spaceId:String(p),headerList:w,projectId:u,creationMethod:Number(c),defaultRuntime:N,pluginType:Number(s),extItemsJSON:l});try{f(!0);var g=yield({create:()=>z({params:m}),edit:()=>D({params:m,editInfo:i})})[n]();v.FN.success({content:r?h.o.t("Plugin_new_toast_success"):h.o.t("Plugin_update_toast_success"),showClose:!1}),null==o||o(),null==d||d(g)}catch(e){var{code:x,msg:b}=e;Number(x)===F.B.SAFE_CHECK?k(!1):v.FN.error({content:(0,P.u)(b)})}finally{f(!1)}}}),function(){return t.apply(this,arguments)});return(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(v.u_,{title:m,className:"[&_.semi-modal-header]:items-center",visible:s,keepDOM:r,onCancel:()=>null==o?void 0:o(),modalContentClass:"create-plugin-modal-content",footer:!c&&(0,a.jsxs)("div",{children:[!j&&(0,a.jsx)("div",{className:B.Z["error-msg-box"],children:(0,a.jsx)("span",{className:B.Z["error-msg"],children:h.o.t("plugin_create_modal_safe_error")})}),(0,a.jsxs)(v.ZT.Paragraph,{type:"secondary",fontSize:"12px",className:"text-start mb-[16px]",children:[(0,a.jsx)(x.DIY,{className:"coz-fg-hglt text-[14px] align-sub"}),(0,a.jsx)("span",{className:"mx-[4px]",children:h.o.t("plugin_create_draft_desc")}),(0,a.jsx)(U.v,{})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(v.zx,{color:"primary",onClick:()=>{null==o||o()},children:h.o.t("create_plugin_modal_button_cancel")}),(0,a.jsx)(v.zx,{loading:g,onClick:()=>{C()},children:h.o.t("create_plugin_modal_button_confirm")})]})]}),children:(0,a.jsx)(L,{pluginState:b,visible:s,isCreate:r,disabled:c,editInfo:i})})})},$=o("664319"),ee=o("228962"),et=o("172742"),eo=e=>{var{modalProps:t}=e,{pluginInfo:o,canEdit:i,unlockPlugin:r,wrapWithCheckLock:n}=(0,ee.RQ)((0,$.N)(e=>({pluginInfo:e.pluginInfo,canEdit:e.canEdit,unlockPlugin:e.unlockPlugin,wrapWithCheckLock:e.wrapWithCheckLock}))),[c,u]=(0,l.useState)(!1),[p,m]=(0,l.useState)(!1),g=(0,l.useMemo)(()=>i?(0,a.jsx)("div",{className:et.Z.actions,children:p?(0,a.jsx)(Q.y3,{onClick:()=>{m(!1),r()},children:h.o.t("Cancel")}):(0,a.jsx)(Q.y3,{theme:"solid",onClick:n(()=>m(!0)),children:h.o.t("Edit")})}):null,[p,i]);return(0,l.useEffect)(()=>{c&&m(!1)},[c]),{modal:(0,a.jsx)(K,(0,d._)((0,s._)({},t),{isCreate:!1,visible:c,onCancel:()=>{u(!1),r()},disabled:!p||!i,editInfo:o,actions:g})),setShowCodePluginModel:u}},ei=e=>{var t,{modalProps:o}=e,[i,r]=(0,l.useState)({}),[c,u]=(0,l.useState)(!1),[p,m]=(0,l.useState)(!1),[g,f]=(0,l.useState)(!1),x=(null==i?void 0:i.plugin_id)||"",v=(0,l.useMemo)(()=>g?null:(0,a.jsx)("div",{className:et.Z.actions,children:p?(0,a.jsx)(Q.y3,{onClick:()=>{m(!1),(0,ee.zO)(x)},children:h.o.t("Cancel")}):(0,a.jsx)(Q.y3,{theme:"solid",onClick:(0,n._)(function*(){if(!(yield(0,ee.EA)(x)))m(!0)}),children:h.o.t("Edit")})}),[p,x,g]);(0,l.useEffect)(()=>{c&&m(!1)},[c]);var b=(0,a.jsx)(K,(0,d._)((0,s._)({},o),{editInfo:i,isCreate:!1,visible:c,onCancel:()=>{u(!1),!g&&(0,ee.zO)(x)},disabled:!p,actions:v}));return{modal:b,open:(0,l.useCallback)((t=(0,n._)(function*(e,t){var o,i,n,a,l,s=yield w.Js.GetPluginInfo({plugin_id:e||""});r({plugin_id:e,code_info:{plugin_desc:null===(o=s.code_info)||void 0===o?void 0:o.plugin_desc,openapi_desc:null===(i=s.code_info)||void 0===i?void 0:i.openapi_desc,client_id:null===(n=s.code_info)||void 0===n?void 0:n.client_id,client_secret:null===(a=s.code_info)||void 0===a?void 0:a.client_secret,service_token:null===(l=s.code_info)||void 0===l?void 0:l.service_token}}),f(t),u(!0)}),function(e,o){return t.apply(this,arguments)}),[])}},er=e=>{var{modalProps:t}=e,{pluginInfo:o,canEdit:i,unlockPlugin:r}=(0,ee.RQ)(e=>({pluginInfo:e.pluginInfo,canEdit:e.canEdit,unlockPlugin:e.unlockPlugin})),[n,c]=(0,l.useState)(!1);return{modal:(0,a.jsx)(X,(0,d._)((0,s._)({},t),{isCreate:!1,visible:n,editInfo:o,onCancel:()=>{r(),c(!1)},disabled:!i})),setShowFormPluginModel:c}},en=e=>{var t,o,i,{modalProps:r}=e,{pluginInfo:n,unlockPlugin:c}=(0,ee.RQ)(e=>({pluginInfo:e.pluginInfo,unlockPlugin:e.unlockPlugin})),[u,p]=(0,l.useState)(!1);return{modal:(0,a.jsx)(V.JI,(0,d._)((0,s._)({},r),{pluginInfo:{pluginID:null==n?void 0:n.plugin_id,pluginName:null==n?void 0:null===(t=n.meta_info)||void 0===t?void 0:t.name,pluginUrl:null==n?void 0:null===(o=n.meta_info)||void 0===o?void 0:o.url,pluginDesc:null==n?void 0:null===(i=n.meta_info)||void 0===i?void 0:i.desc,editVersion:null==n?void 0:n.edit_version},visible:u,onCancel:()=>{c(),p(!1)}})),setShowImportToolModal:p}}},512421:function(e,t,o){"use strict";o.d(t,{M:()=>a});var i=o("151064"),r=o("455069"),n=o("966219"),a=e=>{var{mode:t,value:o,onChange:a,height:l=500,theme:s="monokai",disabled:d=!1,dataTestID:c}=e,[u,p]=(0,r.useState)(l);return(0,r.useEffect)(()=>{p(l)},[l]),(0,i.jsx)("div",{style:{position:"relative"},"data-testid":c,children:(0,i.jsx)(n.Editor,{options:{readOnly:d},language:t,theme:s,width:"100%",onChange:a,height:u,value:o})})}},786406:function(e,t,o){"use strict";o.d(t,{JI:()=>ex,iy:()=>ef});var i=o("825955"),r=o("808549"),n=o("120454"),a=o("151064"),l=o("455069"),s=o("287487"),d=o("947578"),c=o("297158"),u=o("336205"),p=o("707107"),m=o("214942"),g=o("775699"),f=o("44172"),h=o("178385"),x=o("382534"),v=o("473980"),b=o("494308"),_=o("64605"),y=o("165882"),w=o("298203"),j=o("727914"),k=o("458949");function M(e){var t=e.lastIndexOf(".");return e.slice(t+1)}function N(){return(N=(0,i._)(function*(e,t){return new Promise((o,i)=>{var r=new FileReader;r.onload=e=>{var t,r=null===(t=e.target)||void 0===t?void 0:t.result;if(!r||"string"!=typeof r){i(new j.sH("normal_error","file read fail"));return}o(r)},r.onprogress=e=>{e.total&&t({total:e.total,loaded:e.loaded})},r.readAsText(e)})})).apply(this,arguments)}function C(){return(C=(0,i._)(function*(e){var t=y.Z.create({responseType:"text"});return(yield t.get(e)).data})).apply(this,arguments)}var I={none:h.Mv.None,service_http:h.Mv.Service,oauth:h.Mv.OAuth},T={Header:h.Ot.Header,Query:h.Ot.Query};function z(e){var{aiPlugin:t,openAPI:o}=e;return{aiPlugin:(0,w.dj)(t||"{}"),openAPI:(0,b.Qc)(o||"")}}function D(e,t){if(void 0!==t){for(var[o,i]of Object.entries(e))if(i===t)return o}}function S(e){switch(e){case k.wL.Curl:return"curl";case k.wL.OpenAPI:return"openapi";case k.wL.Postman:return"postman";case k.wL.Swagger:return"swagger";default:return""}}var A=e=>(0,_.Z)(e)&&"paths_duplicated"in e;function E(e){var{duplicateInfos:t=[],onCancel:o,onOk:i}=e;g.M5.warning({title:u.o.t("duplicate_tools_within_plugin"),content:null==t?void 0:t.map(e=>(0,a.jsx)("div",{children:"".concat(e.method," ").concat(u.o.t("path_has_duplicates",{path:e.path,num:e.count}))})),okText:u.o.t("merge_duplicate_tools"),cancelText:u.o.t("Cancel"),centered:!0,icon:(0,a.jsx)(f.O5N,{}),okButtonProps:{type:"warning"},onOk:i,onCancel:o})}var O=o("75117");function L(){return"cn-boe"}var Z={SAFE_CHECK:0x2aebbb74,DUP_PATH:0x29d916dd},P=["json","yaml"],R=P.map(e=>".".concat(e)),F={environment:L(),workspace_id:"",workspace_type:"",status:1,create_type:"import"},B={environment:L(),workspace_id:"",workspace_type:"",status:1,create_type:"import",plugin_id:""},U=o("3779"),V={name:[{required:!0,message:u.o.t("create_plugin_modal_name1_error")},{pattern:RegExp("^[\\w\\s\\u4e00-\\u9fa5]+$","u"),message:u.o.t("create_plugin_modal_nameerror_cn")}],desc:[{required:!0,message:u.o.t("create_plugin_modal_descrip1_error")},!1],url:[{required:!0,message:u.o.t("create_plugin_modal_url1_error")}],key:[{required:!0,message:u.o.t("create_plugin_modal_Parameter_error")},{pattern:/^[\x00-\x7F]+$/,message:u.o.t("plugin_Parametename_error")}],service_token:[{required:!0,message:u.o.t("create_plugin_modal_Servicetoken_error")}]},W=function(e){var t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(var i of e){if(i.value===o)return i;if((null===(t=i.children)||void 0===t?void 0:t.length)>0)return W(i.children,o)}},G=o("335740"),Y=o("824113"),H=o("581259"),Q=o("625196"),q=o("153796"),K=e=>{var{disabled:t}=e,o=(0,g.XQ)(),i=o.getValues();return t?(0,a.jsx)(g.l0.Slot,{label:{text:u.o.t("create_plugin_modal_name1"),required:!0},children:(0,a.jsx)("div",{children:null==i?void 0:i.name})}):(0,a.jsx)(g.P6,{field:"name",className:q.Z["textarea-single-line"],label:u.o.t("create_plugin_modal_name1"),placeholder:u.o.t("create_plugin_modal_name2"),trigger:["blur","change"],maxCount:30,maxLength:30,rows:1,onBlur:()=>{var e;o.setValue("name",null===(e=o.getValue("name"))||void 0===e?void 0:e.trim())},rules:V.name})},J=e=>{var{disabled:t}=e,o=(0,g.XQ)(),i=o.getValues();return t?(0,a.jsx)(g.l0.Slot,{label:{text:u.o.t("create_plugin_modal_descrip1"),required:!0},children:(0,a.jsx)("div",{children:null==i?void 0:i.desc})}):(0,a.jsx)(g.P6,{field:"desc",label:u.o.t("create_plugin_modal_descrip1"),trigger:["blur","change"],placeholder:u.o.t("create_plugin_modal_descrip2"),rows:2,maxCount:600,maxLength:600,onBlur:()=>{var e;o.setValue("desc",null==i?void 0:null===(e=i.desc)||void 0===e?void 0:e.trim())},rules:V.desc})},X=e=>{var{disabled:t}=e,o=(0,g.XQ)(),i=o.getValues();return t?(0,a.jsx)(g.l0.Slot,{label:{text:u.o.t("create_plugin_modal_url1"),required:!0},children:(0,a.jsx)("div",{children:null==i?void 0:i.url})}):(0,a.jsx)(g.K9,{className:q.Z["textarea-single-line"],trigger:["blur","change"],field:"url",label:u.o.t("create_plugin_modal_url1"),placeholder:u.o.t("create_plugin_modal_url2"),onBlur:()=>{var e;o.setValue("url",null==i?void 0:null===(e=i.url)||void 0===e?void 0:e.trim())},rules:V.url})},$=(0,g.Q2)(e=>{var{disabled:t,value:o=[],onChange:i}=e,r=e=>{var t=(0,G.Z)(o);t.splice(e,1),null==i||i(t)};return(0,a.jsx)(g.l0.Slot,{className:q.Z["header-list"],label:{text:u.o.t("plugin_create_header_list_title"),align:"right",extra:(0,a.jsxs)("div",{className:q.Z["header-list-extra"],children:[(0,a.jsx)(Q.O,{data:H.HW.header_list}),o.length<20&&!t&&(0,a.jsx)(g._3,{size:"large",icon:(0,a.jsx)(f.N_R,{}),onClick:e=>{var t=[...o];t.push(e.name?e:{name:"",value:""}),null==i||i(t)}})]})},children:(0,a.jsxs)("div",{className:q.Z["herder-list-box"],children:[(0,a.jsxs)(g.X2,{className:q.Z["header-row"],gutter:8,children:[(0,a.jsx)(g.JX,{span:9,children:(0,a.jsx)("div",{className:q.Z["header-col-content"],children:"Key"})}),(0,a.jsx)(g.JX,{span:12,children:(0,a.jsx)("div",{className:q.Z["header-col-content"],children:"Value"})}),(0,a.jsx)(g.JX,{span:3,children:(0,a.jsx)("div",{className:q.Z["header-col-content"],style:{textAlign:"right"},children:u.o.t("plugin_create_action_btn")})})]}),(0,a.jsx)("div",{className:q.Z["herder-list-cotent"],children:null==o?void 0:o.map((e,n)=>(0,a.jsxs)(g.X2,{gutter:8,type:"flex",justify:"space-between",align:"middle",children:[(0,a.jsx)(g.JX,{span:9,children:(0,a.jsx)("div",{className:q.Z["col-content"],children:(0,a.jsx)(g.u3,{placeholder:"Name",value:e.name,onChange:e=>{var t=(0,G.Z)(o);t[n].name=e,null==i||i(t)},maxLength:100,disabled:t})})}),(0,a.jsx)(g.JX,{span:12,children:(0,a.jsx)("div",{className:q.Z["col-content"],children:(0,a.jsx)(g.u3,{placeholder:"Value",value:e.value,onChange:e=>{var t=(0,G.Z)(o);t[n].value=e,null==i||i(t)},maxLength:200,disabled:t})})}),(0,a.jsx)(g.JX,{span:3,children:(0,a.jsx)("div",{className:q.Z["col-content"],children:(0,a.jsx)(g._3,{icon:(0,a.jsx)(f.WDf,{}),type:"secondary",disabled:t,onClick:()=>{r(n)}})})})]},n))})]})})},{valueKey:"value",onKeyChangeFnName:"onChange"}),ee=e=>(0,a.jsx)($,(0,n._)((0,r._)({},e),{field:"headerList",label:{text:""}})),et=e=>{var t,o,{disabled:i,authOption:r,onChange:n}=e,l=(0,g.XQ)().getValues();return i?(0,a.jsx)(g.l0.Slot,{label:{text:u.o.t("create_plugin_modal_auth1"),extra:(0,a.jsx)(Q.O,{data:H.HW.auth}),required:!0},children:(0,a.jsx)("div",{children:null===(t=W(r,null==l?void 0:null===(o=l.auth_type)||void 0===o?void 0:o.at(-1)))||void 0===t?void 0:t.label})}):(0,a.jsx)(g.oL.FormItem,{rules:[{required:!0}],style:{width:"100%"},initValue:(null==l?void 0:l.auth_type)||[0],field:"auth_type",label:{text:u.o.t("create_plugin_modal_auth1"),extra:(0,a.jsx)(Q.O,{data:H.HW.auth})},placeholder:u.o.t("please_select_an_authorization_method"),treeData:r,displayRender:e=>"".concat(null==e?void 0:e.at(-1)),onChange:e=>{n(e)}})},eo=e=>{var t,o,i,{disabled:r}=e,n=(0,g.XQ)(),l=n.getValues();return(0,a.jsxs)(a.Fragment,{children:[r?(0,a.jsx)(g.l0.Slot,{label:{text:u.o.t("create_plugin_modal_location"),extra:(0,a.jsx)(Q.O,{data:H.HW.location}),required:!0},children:(0,a.jsx)("div",{children:null===(t=W(H.cg,null===(o=n.getValues())||void 0===o?void 0:o.location))||void 0===t?void 0:t.label})}):(0,a.jsx)(g.l0.RadioGroup,{rules:[{required:!0}],field:"location",label:{text:u.o.t("create_plugin_modal_location"),extra:(0,a.jsx)(Q.O,{data:H.HW.location})},options:H.cg}),r?(0,a.jsx)(g.l0.Slot,{label:{text:u.o.t("create_plugin_modal_Parameter"),extra:(0,a.jsx)(Q.O,{data:H.HW.key}),required:!0},children:(0,a.jsx)("div",{children:null===(i=n.getValues())||void 0===i?void 0:i.key})}):(0,a.jsx)(Y.sI,{initValue:null==l?void 0:l.key,trigger:["blur","change"],field:"key",label:{text:u.o.t("create_plugin_modal_Parameter"),extra:(0,a.jsx)(Q.O,{data:H.HW.key})},placeholder:u.o.t("create_plugin_modal_Parameter_empty"),maxLength:100,rules:V.key}),r?(0,a.jsx)(g.l0.Slot,{label:{text:u.o.t("create_plugin_modal_Servicetoken"),extra:(0,a.jsx)(Q.O,{data:H.HW.service_token}),required:!0},children:(0,a.jsx)("div",{children:null==l?void 0:l.service_token})}):(0,a.jsx)(Y.sI,{initValue:null==l?void 0:l.service_token,trigger:["blur","change"],field:"service_token",label:{text:u.o.t("create_plugin_modal_Servicetoken"),extra:(0,a.jsx)(Q.O,{data:H.HW.service_token})},placeholder:u.o.t("create_plugin_modal_Servicetoken_empty"),maxLength:400,rules:V.service_token})]})},ei=e=>{var{disabled:t,extItems:o}=e,i=(0,g.XQ)().getValues();return(0,a.jsx)(a.Fragment,{children:null==o?void 0:o.map(e=>(0,a.jsx)(a.Fragment,{children:t?(0,a.jsx)(g.l0.Slot,{label:{text:e.key,extra:H.HW[e.key]&&(0,a.jsx)(Q.O,{data:H.HW[e.key]}),required:e.required},children:(0,a.jsx)("div",{children:(null==i?void 0:i.oauth_info)?(0,w.dj)(i.oauth_info)[e.key]:null})},e.key):(0,a.jsx)(Y.sI,{trigger:["blur","change"],field:e.key,label:{text:e.key,extra:H.HW[e.key]&&(0,a.jsx)(Q.O,{data:H.HW[e.key]})},placeholder:H.VF[e.key],initValue:(null==i?void 0:i.oauth_info)&&(0,w.dj)(i.oauth_info)[e.key]||e.default,maxLength:e.max_len,rules:[{required:e.required,message:H.VF[e.key]},"url"===e.type?{pattern:/^(http|https):\/\/.+$/,message:u.o.t("create_plugin_modal_URLerror")}:{pattern:/^[\x00-\x7F]+$/,message:u.o.t("create_plugin_modal_descrip_error")}]},e.key)}))})},er={headerList:[{name:"User-Agent",value:"Coze/1.0"}]},en=e=>{var t,o,s,c,_,{onCancel:y,importInfo:j,visible:M,onSuccess:N,disabled:C=!1,projectId:S}=e,[A,E]=(0,l.useState)([]),[L,P]=(0,l.useState)(!0),[R,B]=(0,l.useState)([]),[V,G]=(0,l.useState)(!1),Y=(null==j?void 0:null===(s=j.metaInfo)||void 0===s?void 0:null===(o=s.common_params)||void 0===o?void 0:o[4])||[],H=j?(0,n._)((0,r._)({},null==j?void 0:j.metaInfo),{headerList:Y||[]}):er,Q=(0,l.useRef)(),$=null===(_=Q.current)||void 0===_?void 0:null===(c=_.getFormState())||void 0===c?void 0:c.values,en=(0,m.rY)(e=>e.space.id);(0,l.useEffect)(()=>{(0,i._)(function*(){var e,t=yield x.nA.GetOAuthSchema();E((e=null==t?void 0:t.oauth_schema,[{label:u.o.t("create_plugin_modal_Authorization_no"),value:0,key:"None"},{label:u.o.t("create_plugin_modal_Authorization_service"),value:1,key:"Service"},{label:u.o.t("create_plugin_modal_Authorization_oauth"),value:3,key:"OAuth",children:(0,w.dj)(e)}]))})()},[]),(0,l.useEffect)(()=>{if(j){var e,t,o;B((null===(e=W(A,(null===(o=j.metaInfo)||void 0===o?void 0:null===(t=o.auth_type)||void 0===t?void 0:t.at(-1))||0))||void 0===e?void 0:e.items)||[])}else B([])},[A,j]);var ea=(t=(0,i._)(function*(){yield null===(i=Q.current)||void 0===i?void 0:i.validate();var e=null===(a=Q.current)||void 0===a?void 0:a.getValues();if(!!e){var{openAPI:t,aiPlugin:o}=el(e);try{G(!0);var i,a,l,{data:s}=yield x.Js.RegisterPlugin({ai_plugin:o,openapi:t,plugin_type:k.zV.PLUGIN,client_id:null==e?void 0:e.client_id,client_secret:null==e?void 0:e.client_secret,service_token:null==e?void 0:e.service_token,import_from_file:!0,space_id:en,project_id:S},{__disableErrorToast:!0});g.O$.success(u.o.t("plugin_imported_successfully")),null==y||y(),yield null==N?void 0:N({plugin_id:null==s?void 0:s.plugin_id}),(0,p.Gg)(p.Kg.create_plugin_front,(0,n._)((0,r._)({},(null==j?void 0:null===(l=j.extra)||void 0===l?void 0:l.reportParams)||F),{status:0}))}catch(e){var c,{code:m,msg:f}=e;(0,p.Gg)(p.Kg.create_plugin_front,(0,n._)((0,r._)({},(null==j?void 0:null===(c=j.extra)||void 0===c?void 0:c.reportParams)||F),{status:1,error_message:f})),Number(m)===Z.SAFE_CHECK?P(!1):g.O$.error({content:(0,d.u)(f)})}finally{G(!1)}}}),function(){return t.apply(this,arguments)}),el=e=>{var t,{headerList:o,plugin_uri:i=[]}=e,a=(0,v._)(e,["headerList","plugin_uri"]),l={};return null==R||R.forEach(t=>{t.key in e&&(l[t.key]=e[t.key])}),function(e,t){var{aiPlugin:o,openAPI:i}=z(t),{name:a,desc:l,auth_type:s,common_params:d,location:c,key:u,service_token:p,oauth_info:m,icon:g}=e,f={name_for_human:a,name_for_model:a,description_for_human:l,description_for_model:l,logo_url:null==g?void 0:g.uri,common_params:{header:null==d?void 0:d[h.Pi.Header],body:null==d?void 0:d[h.Pi.Body],path:null==d?void 0:d[h.Pi.Path],query:null==d?void 0:d[h.Pi.Query]},auth:(0,r._)({type:D(I,null==s?void 0:s.at(0)),location:D(T,c),key:u,service_token:p},JSON.parse(m||"{}"))},x=(0,r._)({},o,f),v=(0,n._)((0,r._)({},i||{}),{info:(0,n._)((0,r._)({},(null==i?void 0:i.info)||{}),{title:a,description:l}),servers:[{url:e.url}]});return{aiPlugin:JSON.stringify(x),openAPI:(0,b.Pz)(v)}}((0,n._)((0,r._)({},a),{oauth_info:JSON.stringify(l),icon:{uri:null===(t=i[0])||void 0===t?void 0:t.uid},common_params:{[k.Pi.Header]:(null==e?void 0:e.headerList)||[],[k.Pi.Body]:[],[k.Pi.Path]:[],[k.Pi.Query]:[]}}),{openAPI:null==j?void 0:j.openAPI,aiPlugin:null==j?void 0:j.aiPlugin})};return(0,l.useEffect)(()=>{!L&&P(!0)},[(null==$?void 0:$.name)||(null==$?void 0:$.desc)]),(0,a.jsx)(a.Fragment,{children:M?(0,a.jsx)(g.M5,{type:"action-small",title:u.o.t("confirm_plugin_information"),visible:M,onCancel:()=>null==y?void 0:y(),footer:!C&&(0,a.jsxs)("div",{children:[!L&&(0,a.jsx)("div",{className:q.Z["error-msg-box"],children:(0,a.jsx)("span",{className:q.Z["error-msg"],children:u.o.t("plugin_create_modal_safe_error")})}),(0,a.jsxs)("div",{children:[(0,a.jsx)(g.y3,{type:"tertiary",onClick:()=>{null==y||y()},children:u.o.t("create_plugin_modal_button_cancel")}),(0,a.jsx)(g.y3,{type:"primary",theme:"solid",loading:V,onClick:()=>{ea()},children:u.o.t("create_plugin_modal_button_confirm")})]})]}),children:(0,a.jsx)(g.l0,{getFormApi:e=>Q.current=e,showValidateIcon:!1,initValues:(0,r._)({},H||{}),className:q.Z["upload-form"],children:e=>{var{values:t}=e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(O.s,{noLabel:!0,disabled:C,fieldClassName:q.Z["upload-field"],field:"plugin_uri",iconType:h.Tu.Plugin,fileBizType:h.ym.BIZ_PLUGIN_ICON}),(0,a.jsx)(K,{disabled:C}),(0,a.jsx)(J,{disabled:C}),(0,a.jsx)(X,{disabled:!0}),(0,a.jsx)(ee,{disabled:C}),(0,a.jsx)(et,{disabled:C,authOption:A,onChange:e=>{var t;B((null===(t=W(A,null==e?void 0:e.at(-1)))||void 0===t?void 0:t.items)||[])}}),1===t.auth_type.at(-1)&&(0,a.jsx)(eo,{disabled:C}),(0,a.jsx)(ei,{disabled:C,extItems:R}),!C&&(0,a.jsxs)(g.T,{spacing:8,className:q.Z["footer-draft"],children:[(0,a.jsx)(f.Us8,{style:{fontSize:"16px",color:"#4D53E8"}}),(0,a.jsxs)("span",{children:[u.o.t("plugin_create_draft_desc"),(0,a.jsx)(U.v,{})]})]})]})}})}):null})},ea=o("252237"),el=o.n(ea),es=o("623159"),ed=o("68344"),ec=o("468163"),eu=e=>{var t,{onUpload:o,disabled:r}=e,[n,s]=(0,l.useState)([]);var d=(t=(0,i._)(function*(e){var{onSuccess:t,file:o,onError:i,onProgress:r}=e;if("string"!=typeof o)try{var{name:n,fileInstance:a}=o;if(a){var l=M(n);if(!P.includes(l))return;var s=yield function(e,t){return N.apply(this,arguments)}(a,r);t(s)}}catch(e){c.kg.error({eventName:"fail_to_read_file",error:e}),i({status:0})}}),function(e){return t.apply(this,arguments)});return(0,a.jsx)(g.gq,{accept:R.join(","),action:"",onAcceptInvalid:()=>{g.O$.warning(u.o.t("file_format_not_supported"))},onSuccess:e=>{o(e)},disabled:r,fileList:n,onChange:e=>{var{fileList:t}=e;s(t),!t.length&&o()},className:el()(ec.Z["upload-file-area"],n.length&&ec.Z["drag-area-disabled"]),dragMainText:u.o.t("click_upload_or_drag_files"),draggable:!0,dragSubText:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{children:u.o.t("supports_uploading_json_or_yaml_files")}),(0,a.jsx)("a",{href:"/open/docs/guides/import",target:"_blank",onClick:e=>e.stopPropagation(),children:u.o.t("view_detailed_information")})]}),renderFileItem:e=>{var{name:t,onRemove:o,onRetry:i,percent:n,status:l}=e;return(0,a.jsxs)("div",{className:el()(ec.Z["upload-file-item"],r&&ec.Z.disabled),children:[(0,a.jsx)(g.Ee,{preview:!1,className:ec.Z["file-icon"],src:"yaml"===M(t)?es:ed}),(0,a.jsx)(g.ZT.Text,{className:ec.Z.text,ellipsis:{showTooltip:{opts:{content:t}}},children:t}),(0,a.jsx)("div",{className:ec.Z.progress,children:(()=>{switch(l){case"success":return(0,a.jsx)(g.ZT.Text,{className:ec.Z["upload-text"],ellipsis:!0,children:u.o.t("file_upload_success")});case"uploadFail":case"validateFail":return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f.Ucq,{}),(0,a.jsx)(g.y3,{theme:"borderless",className:"ml-[8px]",onClick:i,children:u.o.t("retry")})]});default:return(0,a.jsx)("div",{className:el()("w-[90px]"),children:(0,a.jsx)(g.Ex,{percent:n})})}})()}),(0,a.jsx)(g._3,{icon:(0,a.jsx)(f.WDf,{className:ec.Z["delete-icon"],onClick:o})})]})},limit:1,customRequest:d})},ep=(0,l.forwardRef)((e,t)=>{var{onChange:o}=e,i=(0,v._)(e,["onChange"]);return(0,a.jsx)(g.Kx,(0,n._)((0,r._)({placeholder:u.o.t("enter_raw_content_or_url"),rows:17},i),{ref:t,onChange:e=>{o(e.trim())},className:ec.Z["text-area"]}))}),em=o("170992"),eg=e=>{var t,{onCancel:o,visible:r,onOk:n,title:s}=e,[d,p]=(0,l.useState)("File"),[m,f]=(0,l.useState)(),[h,x]=(0,l.useState)(),[v,b]=(0,l.useState)(!1),_=(0,l.useRef)(null),y=e=>{f(e)},w=()=>{p("File"),f(void 0)};var j=(t=(0,i._)(function*(){b(!0),x(void 0);var e=m,t="Text"===d?"raw_txt":"file";if("Text"===d&&function(e){try{return!!RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*","i").test(e||"")}catch(e){return!1}}(m))try{e=yield function(e){return C.apply(this,arguments)}(m||""),t="file_url"}catch(e){return c.kg.error({error:e,eventName:"fetch_url_resource_fail"}),x(u.o.t("unable_to_access_input_url")),b(!1),Promise.reject(e)}try{var o=yield null==n?void 0:n({type:t,content:e});!(null==o?void 0:o.success)&&x(null==o?void 0:o.errMsg)}finally{b(!1)}}),function(){return t.apply(this,arguments)});return(0,l.useEffect)(()=>{h&&x(void 0)},[m]),(0,l.useEffect)(()=>{r&&w()},[r]),(0,l.useEffect)(()=>{if("Text"===d&&_.current){var e;null==_||null===(e=_.current)||void 0===e||e.focus()}},[d]),(0,a.jsx)(a.Fragment,{children:(0,a.jsx)(g.M5,{afterClose:w,keepDOM:!1,type:"action-small",title:s,visible:r,onCancel:o,onOk:j,footer:(0,a.jsx)(g.y3,{theme:"solid",type:"primary",disabled:!m,onClick:j,loading:v,children:u.o.t("next")}),className:em.Z["import-modal"],children:(0,a.jsxs)("div",{className:"min-h-[472px]",children:[(0,a.jsx)("div",{className:"flex justify-center mb-[24px]",children:(0,a.jsxs)(g.FX,{onChange:e=>{p(e.target.value),f(void 0)},type:"button",buttonSize:"middle",defaultValue:d,disabled:v,className:em.Z["radio-group"],children:[(0,a.jsx)(g.Y8,{value:"File",children:u.o.t("local_file")}),(0,a.jsx)(g.Y8,{value:"Text",children:u.o.t("url_raw_data")})]})}),(0,a.jsx)("div",{children:"File"===d?(0,a.jsx)(eu,{onUpload:y,disabled:v}):(0,a.jsx)(ep,{onChange:y,disabled:v,ref:_})}),(0,a.jsxs)("div",{className:em.Z["error-msg"],children:[" ",h?(0,a.jsx)(g.ZT.Text,{ellipsis:{showTooltip:{opts:{content:h}}},children:h}):null]})]})})})},ef=e=>{var{visible:t}=e;return t?(0,a.jsx)(eh,(0,r._)({},e)):null},eh=e=>{var t,o,{onCancel:s,visible:f,onSuccess:b,projectId:_}=e,[y,w]=(0,l.useState)(),{id:j,space_type:k}=(0,m.rY)(e=>e.space),M=(0,l.useRef)(F),N=k===h.Sn.Personal;(0,l.useEffect)(()=>{M.current=(0,n._)((0,r._)({},M.current),{environment:L(),workspace_id:j||"",workspace_type:N?"personal_workspace":"team_workspace",status:1,create_type:"import"})},[j,N]);var C=(t=(0,i._)(function*(e){try{var t,{openapi:o,ai_plugin:a,plugin_data_format:l}=yield x.Js.Convert2OpenAPI(e,{__disableErrorToast:!0}),s=z({aiPlugin:a,openAPI:o}),m=function(e){var t,o,i,r,n,a,{aiPlugin:l,openAPI:s}=e,d=(null==l?void 0:l.auth)||{},{type:c,location:u,key:p,service_token:m}=d,g=(0,v._)(d,["type","location","key","service_token"]);return{name:null==l?void 0:l.name_for_human,desc:null==l?void 0:l.description_for_human,url:null==s?void 0:null===(o=s.servers)||void 0===o?void 0:null===(t=o[0])||void 0===t?void 0:t.url,icon:{uri:null==l?void 0:l.logo_url},auth_type:[I[c||"none"]],location:T[u||""],key:p,service_token:m,oauth_info:JSON.stringify(g),common_params:{[h.Pi.Header]:(null==l?void 0:null===(i=l.common_params)||void 0===i?void 0:i.header)||[],[h.Pi.Body]:(null==l?void 0:null===(r=l.common_params)||void 0===r?void 0:r.body)||[],[h.Pi.Path]:(null==l?void 0:null===(n=l.common_params)||void 0===n?void 0:n.path)||[],[h.Pi.Query]:(null==l?void 0:null===(a=l.common_params)||void 0===a?void 0:a.query)||[]}}}(s);return w({aiPlugin:a,openAPI:o,metaInfo:m}),M.current=(0,n._)((0,r._)({},M.current),{import_format_type:S(l),import_tools_count:Object.entries((null==s?void 0:null===(t=s.openAPI)||void 0===t?void 0:t.paths)||{}).length}),{success:!0}}catch(t){var f,b,_,{msg:y,code:j,response:k}=t;if(c.kg.error({error:t,eventName:"plugin_convert_openapi_fail"}),M.current=(0,n._)((0,r._)({},M.current),{import_format_type:S(null==k?void 0:null===(b=k.data)||void 0===b?void 0:b.plugin_data_format),import_tools_count:0}),(0,p.Gg)(p.Kg.create_plugin_front,(0,n._)((0,r._)({},M.current),{status:1,error_message:y})),!(Number(j)===Z.DUP_PATH||A(null==k?void 0:k.data)))return{success:!1,errMsg:y||u.o.t("error")};return E({onOk:(f=(0,i._)(function*(){var{errMsg:t,success:o}=yield C((0,n._)((0,r._)({},e),{merge_same_paths:!0}));if(!o)return g.O$.error({content:(0,d.u)(t||u.o.t("error"))}),Promise.reject(t)}),function(){return f.apply(this,arguments)}),duplicateInfos:null==k?void 0:null===(_=k.data)||void 0===_?void 0:_.duplicate_api_infos}),{success:!1,errMsg:""}}}),function(e){return t.apply(this,arguments)});var D=(o=(0,i._)(function*(e){var{content:t,type:o}=e;return M.current=(0,n._)((0,r._)({},M.current),{import_way_type:o}),yield C({data:t||"",space_id:j,merge_same_paths:!1})}),function(e){return o.apply(this,arguments)});return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(eg,{title:u.o.t("import_plugin"),visible:f,onCancel:s,onOk:D}),y?(0,a.jsx)(en,{visible:!!y,projectId:_,onCancel:()=>w(void 0),importInfo:{metaInfo:y.metaInfo,openAPI:y.openAPI,aiPlugin:y.aiPlugin,extra:{reportParams:M.current}},onSuccess:e=>{null==s||s(),null==b||b(e)}}):null]})},ex=e=>{var{visible:t}=e;return t?(0,a.jsx)(ev,(0,r._)({},e)):null},ev=e=>{var t,o,v,b,{onCancel:_,visible:y,onSuccess:w,pluginInfo:j}=e,k=(0,l.useRef)(B),{id:M,space_type:N}=(0,m.rY)(e=>e.space),C=N===h.Sn.Personal,I=s.Z.useUserInfo();(0,l.useEffect)(()=>{k.current=(0,n._)((0,r._)({},k.current),{environment:L(),workspace_id:M||"",workspace_type:C?"personal_workspace":"team_workspace",status:1,create_type:"import",plugin_id:(null==j?void 0:j.pluginID)||""})},[null==j?void 0:j.pluginID,M,C]);var T=(t=(0,i._)(function*(e){try{var t,o,i,a=yield x.Js.BatchCreateAPI(e,{__disableErrorToast:!0}),l=(null==e?void 0:e.replace_same_paths)?null==e?void 0:null===(t=e.paths_to_replace)||void 0===t?void 0:t.length:null==a?void 0:null===(o=a.paths_created)||void 0===o?void 0:o.length;(0,p.Gg)(p.Kg.create_plugin_tool_front,(0,n._)((0,r._)({},k.current),{status:0,import_tools_count:l||0})),a&&!(null==a?void 0:null===(i=a.paths_duplicated)||void 0===i?void 0:i.length)&&(g.O$.success((null==e?void 0:e.replace_same_paths)?u.o.t("plugin_tool_replace_success"):u.o.t("plugin_tool_import_succes")),null==_||_(),null==w||w())}catch(t){var s,d,{code:c,response:m}=t;if(Number(c)!==Z.DUP_PATH&&!A(null==m?void 0:m.data))return Promise.reject(t);(0,p.Gg)(p.Kg.create_plugin_tool_front,(0,n._)((0,r._)({},k.current),{status:0,import_tools_count:(null==m?void 0:null===(d=m.data)||void 0===d?void 0:null===(s=d.paths_created)||void 0===s?void 0:s.length)||0})),z(e,null==m?void 0:m.data)}}),function(e){return t.apply(this,arguments)}),z=(e,t)=>{var{paths_created:o=[],paths_duplicated:l=[]}=t||{},s=o.length,c=l.length,m=u.o.t("failed_to_import_tool",{num:c}),h=u.o.t("tools_imported_successfully",{num:s});g.M5.warning({title:s?"".concat(h,", ").concat(m):m,content:c?u.o.t("plugin_tool_exists_tips",{num:c}):null,okText:u.o.t("replace"),cancelText:u.o.t("Cancel"),centered:!0,icon:(0,a.jsx)(f.O5N,{}),okButtonProps:{type:"warning"},onOk:(0,i._)(function*(){var t=(0,n._)((0,r._)({},e),{replace_same_paths:!0,paths_to_replace:l});try{yield T(t)}catch(e){var{msg:o}=e;g.O$.error({content:(0,d.u)(o||u.o.t("error"))}),(0,p.Gg)(p.Kg.create_plugin_tool_front,(0,n._)((0,r._)({},k.current),{import_tools_count:0,status:1,error_message:o||""}))}}),onCancel:s?(0,i._)(function*(){null==_||_(),yield null==w?void 0:w()}):void 0})};var D=(o=(0,i._)(function*(e){return yield x.Js.Convert2OpenAPI((0,n._)((0,r._)({},e),{plugin_description:null==j?void 0:j.pluginDesc}),{__disableErrorToast:!0})}),function(e){return o.apply(this,arguments)});var O=(v=(0,i._)(function*(e){try{var t=yield D(e);k.current=(0,n._)((0,r._)({},k.current),{import_format_type:S(null==t?void 0:t.plugin_data_format)});var o={plugin_id:null==j?void 0:j.pluginID,ai_plugin:null==t?void 0:t.ai_plugin,openapi:null==t?void 0:t.openapi,replace_same_paths:!1,space_id:M,dev_id:null==I?void 0:I.user_id_str,edit_version:null==j?void 0:j.editVersion};return yield T(o),{success:!0}}catch(t){var a,l,s,{msg:m,code:f,response:h}=t;if(c.kg.error({error:t,eventName:"batch_create_fail"}),k.current=(0,n._)((0,r._)({},k.current),{import_format_type:S(null==h?void 0:null===(l=h.data)||void 0===l?void 0:l.plugin_data_format)}),(0,p.Gg)(p.Kg.create_plugin_tool_front,(0,n._)((0,r._)({},k.current),{import_tools_count:0,status:1,error_message:m||""})),!(Number(f)===Z.DUP_PATH||A(null==h?void 0:h.data)))return{success:!1,errMsg:m||u.o.t("error")};return E({onOk:(a=(0,i._)(function*(){var{success:o,errMsg:i}=yield O((0,n._)((0,r._)({},e),{merge_same_paths:!0}));if(!o)return g.O$.error({content:(0,d.u)(i||u.o.t("error"))}),Promise.reject(t)}),function(){return a.apply(this,arguments)}),duplicateInfos:null==h?void 0:null===(s=h.data)||void 0===s?void 0:s.duplicate_api_infos}),{success:!1}}}),function(e){return v.apply(this,arguments)});var P=(b=(0,i._)(function*(e){var{content:t,type:o}=e||{};return k.current=(0,n._)((0,r._)({},k.current),{import_way_type:o}),yield O({data:t||"",plugin_name:null==j?void 0:j.pluginName,plugin_url:null==j?void 0:j.pluginUrl,merge_same_paths:!1,space_id:M})}),function(e){return b.apply(this,arguments)});return(0,a.jsx)(eg,{title:u.o.t("import_plugin_tool"),visible:y,onCancel:_,onOk:P})}},3779:function(e,t,o){"use strict";o.d(t,{v:function(){return l}});var i=o(151064),r=o(455069),n=o(336205),a=o(659596),l=()=>{var e=(0,r.useMemo)(()=>({"zh-CN":"/docs/guides/plugin",en:"/docs/en_guides/en_plugin"})[n.o.language],[]);return(0,i.jsx)(a.ZT.Text,{link:{href:e,target:"_blank"},fontSize:"12px",children:n.o.t("plugin_create_guide_link")})}},746278:function(e,t,o){"use strict";o.d(t,{FQ:function(){return n},aj:function(){return r}});var i=o(336205),r={id:"0",name:i.o.t("real_data")},n="10000010"},11869:function(e,t,o){"use strict";o.d(t,{G:function(){return u},dj:function(){return s.dj},nr:function(){return d},sq:function(){return c}});var i=o(473980),r=o(615655),n=o(298203),a=o(824833),l=o(746278),s=o(450599);function d(e){return e.id===l.aj.id}function c(e,t){var{bindSubjectInfo:o,bizCtx:l}=e,{bindSubjectInfo:s,bizCtx:d}=t,c=(0,r.Z)(o,s),u=l||{},{ext:p}=u,m=(0,i._)(u,["ext"]),g=d||{},{ext:f}=g,h=function(e,t){return e.bizSpaceID===t.bizSpaceID&&e.trafficScene===t.trafficScene&&e.trafficCallerID===t.trafficCallerID}(m,(0,i._)(g,["ext"])),x=(null==l?void 0:l.trafficScene)!==a.zE.CozeWorkflowDebug||function(e,t){var o=(0,n.dj)(e||"{}"),i=(0,n.dj)(t||"{}");return(0,r.Z)(o,i)}((null==p?void 0:p.mockSubjectInfo)||"",(null==f?void 0:f.mockSubjectInfo)||"");return c&&h&&x}function u(e){switch(e){case a.zE.CozeSingleAgentDebug:return"bot";case a.zE.CozeMultiAgentDebug:return"agent";case a.zE.CozeWorkflowDebug:return"flow";case a.zE.CozeToolDebug:default:return"bot"}}},773568:function(e,t,o){"use strict";o.d(t,{M:function(){return a},U:function(){return n}});var i,r,n=((i={}).STRING="string",i.INTEGER="integer",i.NUMBER="number",i.OBJECT="object",i.ARRAY="array",i.BOOLEAN="boolean",i);var a=((r={}).DEFAULT="default",r.REMOVED="removed",r.ADDED="added",r)},450599:function(e,t,o){"use strict";o.d(t,{Lt:function(){return c},dj:function(){return d},jy:function(){return s}});var i=o(808549),r=o(120454),n=o(583193),a=o(177625),l=o(773568);function s(e){return e?"".concat(e.slice(0,1).toUpperCase()).concat(e.slice(1)):""}function d(e,t){try{return JSON.parse(e)}catch(e){return null==t?void 0:t()}}function c(e,t){var o=void 0===t;if(!e||o)return{result:e,incompatible:!1};var s="string"==typeof t&&d(t)||t,c=function e(t,o,i){var r,a,{defaultStatus:s=l.M.DEFAULT}=i||{},d=u(o);if(!!d){var[c,p]=(r=d,a=o,(0,n.Ki)(r,{getBooleanValue:()=>!!a,getNumberValue:()=>Number(a),getStringValue:()=>String(a)})),m=(null==i?void 0:i.keyPrefix)?"".concat(null==i?void 0:i.keyPrefix,"-").concat(t):t,g={label:t,realValue:c,displayValue:p,isRequired:!1,type:d,status:s,key:m};if(d===l.U.OBJECT){var f=[];for(var h of Object.keys(o))if(h){var x=e(h,o[h],{defaultStatus:s,keyPrefix:m});x&&f.push(x)}g.children=f}if(d===l.U.ARRAY){g.childrenType=u(o[0]);var v=[];for(var b in o)if(void 0!==o[b]){var _=e((0,n.pB)(b),o[b],{defaultStatus:s,keyPrefix:m});_&&v.push(_)}g.children=v}return g}}(a.dz,s,{defaultStatus:l.M.REMOVED}),{merged:p,incompatible:m}=g(e.children,null==c?void 0:c.children,e.type===l.U.ARRAY);return{result:(0,r._)((0,i._)({},e),{children:p}),incompatible:m}}function u(e){var t=typeof e;return e instanceof Array&&(t=l.U.ARRAY),t}function p(e,t){return e===l.U.NUMBER?t===l.U.NUMBER||t===l.U.INTEGER:e===t}function m(e,t){var o=!1,n=(0,r._)((0,i._)({},e),{key:t.key,label:t.label,realValue:t.realValue,displayValue:t.displayValue,status:l.M.DEFAULT});if(t.type===l.U.ARRAY||t.type===l.U.OBJECT){var{merged:a,incompatible:s}=g(e.children,t.children,e.type===l.U.ARRAY);n.children=a,o=o||s}return{result:n,incompatible:o}}function g(e,t){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return void 0===e||void 0===t?{merged:[...e||[],...t||[]],incompatible:e!==t}:0===t.length&&o?{merged:[],incompatible:!1}:function(e,t){var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=!1,r=[...t],n=[...e];for(var a in n)!function(e){if(n[e]){var t=n[e],o=r.findIndex(e=>e.label===t.label&&p(e.type,t.type)&&p(e.childrenType,t.childrenType));if(-1!==o){var{result:a,incompatible:l}=m(t,r.splice(o,1)[0]);n[e]=a,i=i||l}else t.isRequired&&(i=!0)}}(a);if(r.length&&o){var l=e[0];r.forEach(e=>{var{result:t,incompatible:o}=m(l,e);n.push(t),i=i||o}),r=[]}return r.length&&(i=!0),{merged:[...n,...r],incompatible:i}}(e,t,o)}},737368:function(e,t,o){"use strict";o.d(t,{E:()=>x});var i=o("151064"),r=o("336205"),n=o("775699"),a=o("44172"),l=o("286518"),s=o("382534"),d=o("808549"),c=o("120454"),u=o("479910"),p=o("598208"),m={pluginRiskIsRead:!0,toolHiddenModeNewbieGuideIsRead:!0},g=(0,p.Ue)()((0,u.mW)(e=>(0,c._)((0,d._)({},m),{reset:()=>{e(m)},setPluginRiskIsRead:t=>{e({pluginRiskIsRead:t})},setToolHiddenModeNewbieGuideIsRead:t=>{e({toolHiddenModeNewbieGuideIsRead:t})}}),{enabled:!1,name:"botStudio.riskWarningStore"})),f=o("551256"),h=[{icon:(0,i.jsx)(a.KBW,{}),text:r.o.t("plugin_quote_tip_1")},{icon:(0,i.jsx)(a.bu3,{}),text:r.o.t("plugin_quote_tip_2")},{icon:(0,i.jsx)(a.LGu,{}),text:r.o.t("plugin_quote_tip_3")}],x=()=>{var{pluginRiskIsRead:e,setPluginRiskIsRead:t}=g.getState(),o=()=>{s.pr.UpdateUserConfig({risk_alert_type:l.qe.Plugin})};!e&&(t(!0),n.u_.warning({icon:null,title:r.o.t("About_Plugins_tip"),content:(0,i.jsx)("div",{className:f.Z["modal-wrap"],children:h.map(e=>(0,i.jsxs)("div",{className:f.Z["modal-item"],children:[e.icon,(0,i.jsx)("span",{className:f.Z["modal-text"],children:e.text})]}))}),onOk:o,onCancel:o,hasCancel:!1,maskClosable:!1,className:f.Z["ui-modal"],okText:r.o.t("Confirm"),okButtonProps:{style:{minWidth:"96px"}}}))}},625196:function(e,t,o){"use strict";o.d(t,{O:()=>l});var i=o("151064"),r=o("455069"),n=o("873183"),a=o("659596"),l=e=>{var{data:t}=e;return(0,i.jsx)(a.u,{showArrow:!0,theme:"dark",position:"right",arrowPointAtCenter:!0,className:"!max-w-[320px]",content:null==t?void 0:t.map((e,t)=>(0,i.jsxs)(r.Fragment,{children:["title"===e.type?(0,i.jsx)(a.ZT.Text,{fontSize:"14px",className:"dark coz-fg-primary",children:e.text}):null,"text"===e.type?(0,i.jsx)(a.ZT.Paragraph,{fontSize:"12px",className:"dark coz-fg-secondary",children:e.text}):null,"br"===e.type?(0,i.jsx)("div",{className:"h-[8px]"}):null,"demo"===e.type?(0,i.jsx)("div",{className:"dark mt-[4px] p-[10px] border border-solid coz-stroke-primary",children:(0,i.jsx)(a.ZT.Paragraph,{fontSize:"12px",className:"dark coz-fg-secondary",children:e.text})}):null]},"".concat(e.type).concat(t))),children:(0,i.jsx)(n.L03,{className:"coz-fg-secondary"})})}},827666:function(e,t,o){"use strict";o.d(t,{Eo:function(){return _},Fc:function(){return p},Il:function(){return u},JN:function(){return E},Oz:function(){return A},RE:function(){return y},TS:function(){return x},UR:function(){return g},YA:function(){return C},Zo:function(){return z},dT:function(){return f},iq:function(){return S},lR:function(){return D},ls:function(){return h},pq:function(){return v},rN:function(){return b},sp:function(){return m},w5:function(){return k}});var i,r,n=o(808549),a=o(120454),l=o(335740),s=o(336205),d=o(458949),c=o(187151),u="sub_parameters",p="id",m="[Array Item]",g="[Root Item]",f=0,h=1,x=2,v=[{label:"Body",value:d.Pi.Body},{label:"Path",value:d.Pi.Path},{label:"Query",value:d.Pi.Query},{label:"Header",value:d.Pi.Header}];var b=((i={})[i.DEFAULT=10001]="DEFAULT",i[i.IMAGE=10002]="IMAGE",i[i.DOC=10003]="DOC",i[i.CODE=10004]="CODE",i[i.PPT=10005]="PPT",i[i.TXT=10006]="TXT",i[i.EXCEL=10007]="EXCEL",i[i.AUDIO=10008]="AUDIO",i[i.ZIP=10009]="ZIP",i[i.VIDEO=10010]="VIDEO",i),_=e=>e+1e4,y=e=>e-1e4,w=[{label:"String",value:d.rH.String},{label:"Integer",value:d.rH.Integer},{label:"Number",value:d.rH.Number},{label:"Object",value:d.rH.Object},{label:"Array",value:d.rH.Array},{label:"Boolean",value:d.rH.Bool}],j=[{label:"Array",value:d.rH.String},{label:"Array",value:d.rH.Integer},{label:"Array",value:d.rH.Number},{label:"Array",value:d.rH.Object},{label:"Array",value:d.rH.Bool}],k={10001:{label:"File",listLabel:"Array",fileTypes:[c.Wz.DEFAULT_UNKNOWN]},10002:{label:"Image",listLabel:"Array",fileTypes:[c.Wz.IMAGE]},10003:{label:"Doc",listLabel:"Array",fileTypes:[c.Wz.DOCX,c.Wz.PDF]},10004:{label:"Code",listLabel:"Array",fileTypes:[c.Wz.CODE]},10005:{label:"PPT",listLabel:"Array",fileTypes:[c.Wz.PPT]},10006:{label:"TXT",listLabel:"Array",fileTypes:[c.Wz.TXT]},10007:{label:"Excel",listLabel:"Array",fileTypes:[c.Wz.EXCEL,c.Wz.CSV]},10008:{label:"Audio",listLabel:"Array