1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="06ae3b2f-6ec2-a9ab-3709-712bea645b55")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,208855,e=>{"use strict";var s=e.i(268601),t=e.i(996570),a=e.i(758606),r=e.i(971910),l=e.i(670245),n=e.i(273910),i=e.i(242830),d=e.i(269439),o=e.i(712117),c=e.i(823594),u=e.i(221513),m=e.i(101275),x=e.i(317948),h=e.i(975705),g=e.i(702278),p=e.i(357287),b=e.i(339188);let f=(0,m.createState)("useCachedPluginPreviewSettings");function j({plugin:e}){let[t,a]=f({}),[l,n]=(0,h.useState)(null),i=(0,p.hasAllRequiredUserSettings)(e,{userPluginSettings:t,idField:"uuid"}),[d,o]=(0,h.useState)(!i),[m,y]=(0,h.useState)(!1),v=(0,p.getCallVariables)(t[e.uuid]||{},e.userSettings||[]),N=Object.keys(v).length;return(0,s.jsxs)("div",{className:"h-full flex flex-col gap-4",children:[(0,s.jsxs)("div",{className:"px-4 py-2 rounded-lg shadow",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsxs)("button",{onClick:()=>o(e=>!e),className:"text-base font-semibold inline-flex items-center justify-start gap-2 hover:underline",children:[d?(0,s.jsx)(g.default,{className:"inline-block w-4 h-4 rotate-90"}):(0,s.jsx)(g.default,{className:"inline-block w-4 h-4"}),(0,s.jsx)("span",{children:(0,s.jsx)(r.Trans,{id:"xWsR91"})}),(0,s.jsxs)("span",{className:"text-xs text-gray-500",children:["(",N,")"]}),i?null:(0,s.jsx)("div",{className:"bg-red-500 w-2 h-2 rounded-full"})]}),i?null:(0,s.jsx)("span",{className:"text-red-500 text-sm font-medium",children:(0,s.jsx)(r.Trans,{id:"lbiCCY"})})]}),d?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(u.default,{userSettings:e.userSettings||[],entries:v,onSave:s=>{let t={...v,...s};a(s=>({...s,[e.uuid]:{...s[e.uuid]||{},...t}})),(0,p.hasAllRequiredUserSettings)(e,{userPluginSettings:{[e.uuid]:t},idField:"uuid"})&&o(!1)}}),(0,b.getPluginCombinedFunctions)(e).find(e=>"mcp"===e.implementationType)?(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(c.default,{credentials:{connectorURL:v?.MCP_CONNECTOR_URL||"",connectorAuthToken:v?.MCP_CONNECTOR_AUTH_TOKEN||""},setCredentials:s=>{a(t=>({...t,[e.uuid]:{...t[e.uuid]||{},MCP_CONNECTOR_URL:s.connectorURL,MCP_CONNECTOR_AUTH_TOKEN:s.connectorAuthToken}}))}})}):null]}):null]}),i?(0,s.jsxs)("div",{className:"px-4 py-2 rounded-lg shadow",children:[(0,s.jsxs)("button",{onClick:()=>y(e=>!e),className:"text-base font-semibold inline-flex items-center justify-start gap-2 hover:underline",children:[m?(0,s.jsx)(g.default,{className:"inline-block w-4 h-4 rotate-90"}):(0,s.jsx)(g.default,{className:"inline-block w-4 h-4"}),(0,s.jsx)("span",{children:(0,s.jsx)(r.Trans,{id:"a5Zg1q"})})]}),m?l?(0,s.jsxs)("div",{className:"space-y-4",children:[l.functionArguments?(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("div",{className:"font-semibold",children:(0,s.jsx)(r.Trans,{id:"lw9tGO"})}),(0,s.jsx)("pre",{className:"text-xs whitespace-pre-wrap bg-gray-200 dark:bg-gray-700 p-2 rounded-lg overflow-auto max-h-[400px]",children:(0,s.jsx)("code",{children:JSON.stringify(l.functionArguments,null,2)})})]}):null,l.toolResponse?(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("div",{className:"font-semibold",children:(0,s.jsx)(r.Trans,{id:"xmmt-l"})}),(0,s.jsx)("pre",{className:"text-xs whitespace-pre-wrap bg-gray-200 dark:bg-gray-700 p-2 rounded-lg overflow-auto max-h-[400px]",children:(0,s.jsx)("code",{children:"string"==typeof l.toolResponse?l.toolResponse:JSON.stringify(l.toolResponse,null,2)})})]}):null]}):(0,s.jsx)("div",{className:"text-gray-500 text-sm",children:(0,s.jsx)(r.Trans,{id:"PLLAHC"})}):null]}):null,(0,s.jsxs)("div",{className:"grow relative",children:[i?null:(0,s.jsx)("div",{className:"absolute inset-0 bg-white/90 dark:bg-black/90 rounded-lg shadow-sm overflow-hidden z-10 flex items-center justify-center",children:(0,s.jsx)("div",{className:"text-gray-500 font-semibold",children:(0,s.jsx)(r.Trans,{id:"Nyr9NK"})})}),(0,s.jsx)(x.default,{plugins:[e],pluginsUserSettings:{[e.uuid]:v},onToolCallDetailsClick:e=>{n(e),y(!0)}})]})]})}var y=e.i(113979),v=e.i(250017),N=e.i(624034),w=e.i(446322),T=e.i(899274),k=e.i(253056),S=e.i(29168),C=e.i(303554),E=e.i(524572),_=e.i(549452),A=e.i(372781),O=e.i(265689),P=e.i(469201),U=e.i(980425);let R=[{id:"AUTH_TYPE_NONE",label:"None"},{id:"AUTH_TYPE_API_KEY",label:"API Key"},{id:"AUTH_TYPE_OAUTH",label:"OAuth 2.0"}];
2class F extends Error{constructor(e){super(e),this.name="PluginValidationError"}}e.s(["default",0,function({plugin:e,onCanceled:c,onSaved:u,isAdmin:m,loading:x,httpActionTestFunction:g,extraHTTPActionVariables:f=[],readOnly:D,showTypingMindCustomAds:I=!1,isSystemPlugin:z=!1,onDuplicated:L,sharedOAuthConnections:H}){let[M,J]=(0,h.useState)(null),[G,V]=(0,h.useState)(null),Y=[{id:"manually",title:l.i18n._({id:"a9Ogao"})},{id:"json",title:l.i18n._({id:"legu7S"})}],[K,W]=(0,h.useState)("manually"),[q,B]=(0,h.useState)(e.pluginFunctions||[]),[$,X]=(0,h.useState)(e.permissions||[]),[Q,Z]=(0,h.useState)(e.title),[ee,es]=(0,h.useState)(e.iconURL),[et,ea]=(0,h.useState)(e.overviewMarkdown),[er,el]=(0,h.useState)(e.userSettings?JSON.stringify(e.userSettings,null,2):null),[en,ei]=(0,h.useState)(e.dynamicContextEndpoints||[]),[ed,eo]=(0,h.useState)(e.authenticationType||"AUTH_TYPE_NONE"),[ec,eu]=(0,h.useState)(e.oauthConfig||null),[em,ex]=(0,h.useState)(e.sharedOAuthConnectionID||null),[eh,eg]=(0,h.useState)(null),[ep,eb]=(0,h.useState)(e?JSON.stringify(e,null,2):""),{links:ef}=(0,y.useAppConfigState)().serverHostConfig||{},ej=async(e,s={})=>{let t;try{t=er&&JSON.parse(er)}catch(e){throw Error("User Settings must be a valid JSON.")}let a={...(0,p.getCallVariables)({},t||[]),...s};return((0,S.validateHTTPAction)(e),g)?await g(e,a):await (0,C.runHTTPAction)(e,a)},ey=(0,h.useMemo)(()=>(0,b.getPluginCombinedFunctions)({...e,pluginFunctions:q}),[q,e]),ev=(0,h.useCallback)(()=>{let s,t,a,r,n,i,d,o,c,u,m,x;if("json"===K)try{let e=JSON.parse(ep);({id:s,title:t,iconURL:a,overviewMarkdown:r,userSettings:n,authenticationType:i="AUTH_TYPE_NONE",oauthConfig:d,dynamicContextEndpoints:o,permissions:c,sharedOAuthConnectionID:u,pluginFunctions:m,...x}=e),m&&Array.isArray(m)||(m=[{id:"LEGACY_DEFAULT_FUNCTION",name:x.openaiSpec?.name||"Function",openaiSpec:x.openaiSpec,code:x.code,implementationType:x.implementationType,httpAction:x.httpAction,outputType:x.outputType,mcpDetails:x.mcpDetails}])}catch(e){throw console.error(e),new F(l.i18n._({id:"w-QKui"}))}else{t=Q,a=ee,r=et,o=en,c=$,i=ed,d=ec,u=em,m=ey,s=e.id||e.uuid,e.id||q?.length!==1||"LEGACY_DEFAULT_FUNCTION"!==q[0].id||(s=q[0].openaiSpec?.name||e.uuid);try{er?.trim()&&(n=JSON.parse(er),(0,p.validateUserSettings)(n))}catch(e){throw console.error(e),new F(l.i18n._({id:"Tri-cM"}))}}if(!t)throw new F(l.i18n._({id:"4od74D"}));if((0,S.parsedVariablesFromSpec)({},n).map(e=>`{${e}}`).some(e=>!e.match(S.PLUGIN_VARIABLES_REGEX)))throw new F(l.i18n._({id:"0PQOqS"}));if(n)try{(0,p.validateUserSettings)(n)}catch(e){throw new F(e.message)}return{...e,...x,implementationType:void 0,openaiSpec:void 0,code:void 0,httpAction:void 0,mcpDetails:void 0,outputType:void 0,uuid:e.uuid,id:s,title:t,iconURL:a,overviewMarkdown:r,userSettings:n||null,authenticationType:i,pluginFunctions:m,oauthConfig:d,sharedOAuthConnectionID:u,dynamicContextEndpoints:o,permissions:c,syncedAt:null}},[K,Q,ee,et,er,en,$,ed,ec,em,e,ep,q,ey]),eN=()=>{eg("");try{let e=ev();u(e)}catch(e){if(e instanceof F)return void eg(e.message);throw e}},ew=[...(0,S.parsedVariablesFromSpec)(null,er),...f,..."AUTH_TYPE_OAUTH"===ed?["OAUTH_PLUGIN_ACCESS_TOKEN"]:[]],eT=(0,h.useMemo)(()=>{try{return ev()}catch(e){return null}},[ev]),ek=(0,h.useMemo)(()=>M&&(0,O.default)(eT)!==(0,O.default)(M),[eT,M]),eS=()=>{let e;try{e=ev()}catch(e){if(e instanceof F)return void v.toast.error(l.i18n._({id:"rlmIaD",values:{0:e.message}}));throw e}J(e),V((0,E.v4)())};return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2 flex-wrap",children:[(0,s.jsxs)("div",{className:"space-y-1 text-gray-500 text-xs",children:[(0,s.jsx)("span",{children:(0,s.jsx)(r.Trans,{id:"KwhrYp"})})," ",(0,s.jsx)("a",{className:"text-blue-500 font-semibold hover:underline",href:ef?.pluginsDocs||"/plugins-docs",target:"_blank",children:(0,s.jsx)(r.Trans,{id:"B1seby"})})]}),m?(0,s.jsxs)("div",{className:" flex items-center justify-center gap-2",children:[eh?(0,s.jsx)("div",{className:"text-red-500 text-sm mb-6",children:eh}):null,(0,s.jsx)("div",{className:"text-center flex items-center justify-center gap-2",children:e.system?(0,s.jsx)("span",{className:"text-orange-500 text-xs",children:(0,s.jsx)(r.Trans,{id:"XmhWD2"})}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(k.default,{size:"size10",theme:"white",onClick:c,children:[(0,s.jsx)(N.AiOutlineClose,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:(0,s.jsx)(r.Trans,{id:"dEgA5A"})})]}),(0,s.jsxs)(k.default,{size:"size10",theme:"green",onClick:eN,type:"submit",disabled:x||D,children:[x?(0,s.jsx)(A.default,{}):e.id?null:(0,s.jsx)(w.FaPlus,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"create"===m?l.i18n._({id:"tZF1VG"}):l.i18n._({id:"cGD2Qu"})})]})]})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[z&&!e.internalPlugin?(0,s.jsx)(n.default,{as:"div",onConfirmed:L,confirmText:()=>(0,s.jsxs)(k.default,{size:"size10",children:[(0,s.jsx)(T.IoDuplicate,{className:"w-4 h-4"}),(0,s.jsx)("span",{className:"hover:underline",children:(0,s.jsx)(r.Trans,{id:"Aqw8Kb"})})]}),children:(0,s.jsxs)(k.default,{size:"size10",children:[(0,s.jsx)(T.IoDuplicate,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:(0,s.jsx)(r.Trans,{id:"euc6Ns"})})]})}):null,(0,s.jsxs)(k.default,{size:"size10",theme:"white",onClick:c,children:[(0,s.jsx)(N.AiOutlineClose,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:(0,s.jsx)(r.Trans,{id:"dEgA5A"})})]}),z?null:(0,s.jsxs)(k.default,{size:"size10",onClick:eN,theme:"green",children:[(0,s.jsx)(N.AiOutlineCheck,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:(0,s.jsx)(r.Trans,{id:"tfDRzk"})})]})]}),eh&&(0,s.jsx)("div",{className:"text-red-500 w-full",children:eh})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 mb-8",children:[(0,s.jsxs)("div",{children:[z?(0,s.jsx)("div",{className:"text-orange-500 text-xs",children:(0,s.jsx)(r.Trans,{id:"aLYsEA"})}):null,!e.system&&(0,s.jsx)("div",{className:"w-full mt-2",children:(0,s.jsxs)("fieldset",{children:[(0,s.jsx)("legend",{className:"sr-only",children:"Input Options"}),(0,s.jsx)("div",{className:"flex flex-col gap-4 gap-y-1 sm:flex-row",children:Y.map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("input",{id:e.id,name:"input-method",type:"radio",checked:e.id===K,className:"h-4 w-4 border-gray-300 dark:border-gray-500 dark:focus:border-blue-500 text-blue-600 focus:ring-blue-600 cursor-pointer disabled:cursor-not-allowed",onChange:()=>W(e.id),disabled:x}),(0,s.jsx)("label",{htmlFor:e.id,className:(0,p.classNames)(x?"text-gray-400":"text-gray-900 dark:text-gray-50","ml-1 block font-medium leading-6 cursor-pointer text-base"),children:e.title})]},e.id))})]})}),"manually"===K?(0,s.jsxs)("div",{className:"mt-2 w-full space-y-4",children:[(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("label",{className:"font-semibold",children:[(0,s.jsx)(r.Trans,{id:"ErRKov"}),"*"]}),(0,s.jsx)("div",{className:"text-gray-500 text-xs",children:(0,s.jsx)(r.Trans,{id:"YS2bZx"})}),(0,s.jsx)("div",{className:"w-full my-1",children:(0,s.jsx)("input",{disabled:x||D,type:"text",placeholder:l.i18n._({id:"LnnVIT"}),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-500 dark:focus:border-blue-500 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",value:Q,onChange:e=>Z(e.target.value)})})]}),(0,s.jsxs)("div",{className:"w-full flex items-center justify-start gap-2",children:[(0,s.jsx)("div",{children:ee?(0,s.jsx)("img",{src:ee,alt:"Plugin Icon",className:"w-20 h-20 rounded-md object-cover border border-gray-300 dark:border-gray-500 shrink-0"}):(0,s.jsx)("div",{className:"w-20 h-20 rounded-md object-cover border border-gray-300 dark:border-gray-500 shrink-0 flex items-center justify-center text-gray-400",children:(0,s.jsx)(U.default,{})})}),(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsx)("label",{className:"font-semibold",children:(0,s.jsx)(r.Trans,{id:"bd1Kuw"})}),(0,s.jsx)("div",{className:"text-gray-500 text-xs",children:(0,s.jsx)(r.Trans,{id:"uUXlSw"})}),(0,s.jsxs)("div",{className:"w-full my-1 flex items-center justify-center gap-2",children:[(0,s.jsx)("input",{disabled:x||D,type:"text",placeholder:l.i18n._({id:"0X8rUE"}),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-500 dark:focus:border-blue-500 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",value:ee,onChange:e=>es(e.target.value)}),(0,s.jsx)(P.default,{onUploaded:es})]})]})]}),(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsx)("label",{className:"font-semibold",children:(0,s.jsx)(r.Trans,{id:"6FSnpy"})}),(0,s.jsx)("div",{className:"text-gray-500 text-xs",children:(0,s.jsx)(r.Trans,{id:"i5udnt"})}),(0,s.jsx)("div",{className:"w-full my-1",children:(0,s.jsx)("textarea",{disabled:x||D,placeholder:l.i18n._({id:"F1uW_d"}),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-500 dark:focus:border-blue-500 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",value:et,onChange:e=>ea(e.target.value),rows:5})})]}),(0,s.jsxs)("details",{className:"w-full border border-gray-200 dark:border-gray-600 p-4 rounded-lg",children:[(0,s.jsxs)("summary",{className:"font-semibold cursor-pointer",children:[(0,s.jsx)(r.Trans,{id:"lcDO4m"})," ",(0,s.jsx)("span",{className:"text-xs bg-gray-300 dark:bg-gray-700 px-2 py-0.5 rounded-full ml-1",children:(0,p.parseOrNull)(er)?.length||0})]}),(0,s.jsx)("div",{className:"text-gray-500 text-xs mt-1",children:(0,s.jsx)(r.Trans,{id:"4EFkQG",components:{0:(0,s.jsx)("a",{className:"text-blue-500 hover:underline",href:ef?.pluginsDocs||"/plugins-docs",target:"_blank",rel:"noreferrer"})}})}),(0,s.jsx)("button",{onClick:()=>{(!er?.trim()||window.confirm(l.i18n._({id:"QhTPx2"})))&&el(JSON.stringify(p.EXAMPLE_USER_SETTINGS_ARRAY,null,2))},className:"text-blue-500 font-semibold hover:underline my-1 text-sm disabled:text-gray-500",disabled:x||D,children:(0,s.jsx)(r.Trans,{id:"GSpCHF"})}),(0,s.jsxs)("div",{className:"w-full my-1",children:[(0,s.jsx)("textarea",{disabled:x||D,placeholder:l.i18n._({id:"Yj2_Tk"}),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-500 dark:focus:border-blue-500 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",rows:5,value:er,onCh
2ange:e=>el(e.target.value)}),(0,s.jsx)(_.default,{value:er,parser:e=>(0,p.validateUserSettings)(JSON.parse(e))})]})]}),(0,s.jsxs)("details",{className:"w-full border border-gray-200 dark:border-gray-600 p-4 rounded-lg",children:[(0,s.jsxs)("summary",{className:"font-semibold cursor-pointer",children:[(0,s.jsx)(r.Trans,{id:"M73whl"})," ",(0,s.jsx)("span",{className:"text-xs bg-gray-300 dark:bg-gray-700 px-2 py-0.5 rounded-full ml-1",children:en.length})]}),(0,s.jsx)("div",{className:"text-gray-500 text-xs mt-1",children:(0,s.jsx)(r.Trans,{id:"ChOctX"})}),(0,s.jsx)("div",{className:"w-full my-1",children:(0,s.jsx)(i.default,{showTips:!1,defaultSource:"static",dynamicContextEndpoints:en,setDynamicContextEndpoints:ei,hasCharacterIDVariable:!1,disabled:x||D,additionalVariables:ew})})]}),(0,s.jsxs)("details",{className:"w-full border border-gray-200 dark:border-gray-600 p-4 rounded-lg",children:[(0,s.jsxs)("summary",{className:"font-semibold cursor-pointer",children:[(0,s.jsx)(r.Trans,{id:"9cDpsw"})," ",(0,s.jsx)("span",{className:"text-xs bg-gray-300 dark:bg-gray-700 px-2 py-0.5 rounded-full ml-1",children:$.length})]}),(0,s.jsx)("div",{className:"text-gray-500 text-xs mt-1",children:(0,s.jsx)(r.Trans,{id:"iYKV2o"})}),(0,s.jsx)("div",{className:"w-full my-1",children:(0,s.jsx)(t.default,{permissions:$,setPermissions:X,disabled:x||D})})]}),(0,s.jsxs)("details",{className:"w-full border border-gray-200 dark:border-gray-600 p-4 rounded-lg space-y-4",children:[(0,s.jsxs)("summary",{className:"font-semibold cursor-pointer",children:[(0,s.jsx)(r.Trans,{id:"P8fBlG"})," ",(0,s.jsx)("span",{className:"text-xs bg-gray-300 dark:bg-gray-700 px-2 py-0.5 rounded-full ml-1",children:R.find(e=>e.id===ed)?.label||"None"})]}),(0,s.jsx)("div",{className:"w-full my-1",children:(0,s.jsx)("select",{id:"model",className:"block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 dark:ring-gray-500 dark:focus:ring-blue-500 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6 disabled:text-gray-500",value:ed,onChange:e=>{eo(e.target.value)},disabled:x||D,children:R.map(e=>(0,s.jsx)("option",{value:e.id,children:e.label},e.id))})}),"AUTH_TYPE_OAUTH"===ed?(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsx)("label",{className:"font-semibold",children:(0,s.jsx)(r.Trans,{id:"GITnVx"})}),(0,s.jsx)("div",{className:"text-gray-500 text-xs",children:(0,s.jsx)(r.Trans,{id:"p_gs19"})}),(0,s.jsx)(o.default,{links:ef,oauthConfig:ec,onUpdated:(e,s)=>{eu(e),ex(s)},sharedOAuthConnectionID:em,sharedOAuthConnections:H,isAdmin:m})]}):"AUTH_TYPE_API_KEY"===ed?(0,s.jsxs)("div",{className:"w-full bg-yellow-50 dark:bg-yellow-900/50 px-4 py-3 rounded-md",children:[(0,s.jsx)("label",{className:"font-semibold",children:(0,s.jsx)(r.Trans,{id:"CcJuiO"})}),(0,s.jsxs)("div",{className:"text-gray-500 text-sm mt-2",children:[(0,s.jsx)(r.Trans,{id:"ELgLcF",components:{0:(0,s.jsx)("b",{}),1:(0,s.jsx)("b",{}),2:(0,s.jsx)("a",{className:"text-blue-500 font-semibold hover:underline",target:"_blank",href:"https://docs.typingmind.com/plugins/build-a-typingmind-plugin#0e3d2ca8c78f4b62b1a8504957bbb268"})}})," ",I?(0,s.jsx)("span",{children:(0,s.jsx)(r.Trans,{id:"wb6atD",components:{0:(0,s.jsx)("a",{href:"https://custom.typingmind.com/?utm_source=plugin_oauth",className:"text-blue-500 font-semibold hover:underline",target:"_blank"}),1:(0,s.jsx)("a",{className:"text-blue-500 font-semibold hover:underline",target:"_blank",href:"https://docs.typingmind.com/plugins/build-a-typingmind-plugin#0e3d2ca8c78f4b62b1a8504957bbb268"})}})}):null]})]}):null]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsx)("label",{className:"font-semibold",children:(0,s.jsx)(r.Trans,{id:"xbRJgw"})}),(0,s.jsx)("div",{className:"text-gray-500 text-xs",children:(0,s.jsx)(r.Trans,{id:"2xo_Qy"})})]}),ey.map(e=>(0,s.jsx)(a.default,{pluginFunction:e,disabled:x||D,availableVariables:ew,links:ef,runTestHttpAction:ej,onChange:s=>{"LEGACY_DEFAULT_FUNCTION"!==e.id||q.find(e=>"LEGACY_DEFAULT_FUNCTION"===e.id)?B(e=>e.map(e=>e.id===s.id?s:e)):B(e=>[...e,s])},onDelete:()=>{B(s=>s.filter(s=>s.id!==e.id))},showDeleteButton:ey.length>1&&!D},e.id)),(0,s.jsxs)("button",{onClick:()=>{B(e=>[...e,(0,p.generateNewPluginFunction)()])},className:"text-blue-500 font-semibold hover:underline my-1 text-sm disabled:text-gray-500 inline-flex items-center justify-center gap-2",disabled:x||D,children:[(0,s.jsx)(w.FaPlus,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:(0,s.jsx)(r.Trans,{id:"BNsYjM"})})]})]})]}):"json"===K?(0,s.jsx)(d.default,{value:ep,setValue:eb,error:eh,setError:eg,extraHTTPActionVariables:f,testFunction:ej}):(0,s.jsx)("div",{children:"Invalid mode"})]}),(0,s.jsx)("div",{className:"min-h-[calc(100vh-50px)] w-full pb-2 relative",children:(0,s.jsxs)("div",{className:"flex flex-col h-full",children:[(0,s.jsx)("div",{className:"text-base font-semibold mb-4 flex items-center justify-start gap-2",children:(0,s.jsx)("span",{children:(0,s.jsx)(r.Trans,{id:"w8rp_c"})})}),M?(0,s.jsxs)("div",{className:"h-fit min-h-[calc(100vh-50px)] relative",children:[ek?(0,s.jsxs)("span",{className:"text-sm absolute inset-0 flex items-center justify-center z-10 bg-white/50 dark:bg-black/50 filter backdrop-blur",children:[(0,s.jsx)("span",{className:"text-orange-500 mr-2",children:(0,s.jsx)(r.Trans,{id:"ZSVW8C"})})," ",(0,s.jsx)("button",{onClick:()=>{eS()},className:"font-semibold hover:underline text-blue-500",children:(0,s.jsx)(r.Trans,{id:"HpK_8d"})})]}):null,(0,s.jsx)(j,{plugin:M},G)]}):(0,s.jsx)("div",{className:"h-fit min-h-[calc(100vh-50px)] flex items-center justify-center bg-gray-100 dark:bg-zinc-800 rounded-xl flex-col gap-4",children:(0,s.jsx)(k.default,{onClick:eS,children:(0,s.jsx)(r.Trans,{id:"HzDW25"})})})]})})]})]})}],208855)},758606,269439,712117,e=>{"use strict";var s=e.i(268601),t=e.i(971910),a=e.i(670245),r=e.i(273910),l=e.i(737807),n=e.i(195519),i=e.i(265689),d=e.i(975705),o=e.i(250017),c=e.i(29168),u=e.i(357287),m=e.i(524572),x=e.i(549452),h=e.i(771473),g=e.i(528347);e.s(["default",0,function({pluginFunction:e,onChange:p,availableVariables:b,disabled:f,links:j,runTestHttpAction:y,onDelete:v,showDeleteButton:N}){let[w,T]=(0,d.useState)(!0),[k,S]=(0,d.useState)(e.name||""),[C,E]=(0,d.useState)(e.implementationType||"javascript"),[_,A]=(0,d.useState)(e.openaiSpec?JSON.stringify(e.openaiSpec,null,2):""),[O,P]=(0,d.useState)(e.code||""),[U,R]=(0,d.useState)(e.httpAction),[F,D]=(0,d.useState)(e.mcpDetails),[I,z]=(0,d.useState)(e.outputType||"respond_to_ai"),[L,H]=(0,d.useState)({...e}),M=(0,d.useMemo)(()=>({id:e.id,name:k,implementationType:C,openaiSpec:(0,u.parseOrNull)(_)||"",code:O,httpAction:U,mcpDetails:F,outputType:I}
2),[e.id,k,C,_,O,U,F,I]),J=(0,g.useDebounce)(M,300);(0,d.useEffect)(()=>{if((0,i.default)(J)!==(0,i.default)(e))try{(0,c.validatePluginFunction)(J),p(J)}catch(e){if(!(e instanceof c.PluginFunctionValidationError))throw e}},[J]);let G=[...b,...(0,c.parsedVariablesFromSpec)(_)],V=(0,i.default)(M)!==(0,i.default)(L);return w?(0,s.jsxs)("button",{onClick:()=>T(!1),className:"w-full border border-gray-300 dark:border-gray-600 rounded-md p-4 shadow relative hover:bg-gray-100 dark:bg-gray-700 cursor-pointer flex items-center justify-start gap-2",children:[(0,s.jsx)(h.default,{type:e.implementationType}),(0,s.jsx)("span",{className:"font-semibold flex-shrink-0",children:e.name})]}):(0,s.jsxs)("div",{className:(0,u.classNames)("border rounded-md shadow relative space-y-4 p-4",V?"border-orange-300 dark:border-orange-600":"border-gray-300 dark:border-gray-600"),children:[(0,s.jsx)("div",{className:" absolute top-3 right-4 flex items-center justify-center gap-2",children:(0,s.jsx)("div",{className:"flex items-center justify-center gap-4",children:V?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.default,{onConfirmed:()=>{p(L),S(L.name||""),E(L.implementationType||"javascript"),A(L.openaiSpec?JSON.stringify(L.openaiSpec,null,2):""),P(L.code||""),R(L.httpAction),D(L.mcpDetails),z(L.outputType||"respond_to_ai")},className:"text-orange-500 font-semibold hover:underline",children:(0,s.jsx)(t.Trans,{id:"3EbjfR"})}),(0,s.jsx)("button",{onClick:()=>{(()=>{try{(0,c.validatePluginFunction)(M)}catch(e){if(e instanceof c.PluginFunctionValidationError)return void o.toast.error(e.message);throw e}H({...M}),T(!0)})()},className:"text-green-500 font-semibold hover:underline",children:(0,s.jsx)(t.Trans,{id:"y3aU20"})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{onClick:()=>{T(!0)},className:"text-gray-500 font-semibold hover:underline",children:(0,s.jsx)(t.Trans,{id:"H86f9p"})}),f||!N?null:(0,s.jsx)(r.default,{onConfirmed:()=>{v()},className:"text-red-500 font-semibold hover:underline",children:(0,s.jsx)(t.Trans,{id:"t_YqKh"})})]})})}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("label",{className:"font-semibold",children:[(0,s.jsx)(t.Trans,{id:"AHOl4W"}),"*"]}),(0,s.jsx)("div",{className:"text-gray-500 text-xs",children:(0,s.jsx)(t.Trans,{id:"fK6jx0"})}),(0,s.jsx)("div",{className:"w-full my-1",children:(0,s.jsx)("input",{disabled:f,placeholder:a.i18n._({id:"YoxD8i"}),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-500 dark:focus:border-blue-500 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",value:k,onChange:e=>S(e.target.value)})})]}),(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("label",{className:"font-semibold",children:[(0,s.jsx)(t.Trans,{id:"N4OVNn"}),"*"]}),(0,s.jsx)("div",{className:"text-gray-500 text-xs",children:(0,s.jsx)(t.Trans,{id:"LUiMR7"})}),(0,s.jsx)("div",{className:"w-full my-1",children:(0,s.jsxs)("select",{id:"model",className:"block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 dark:ring-gray-500 dark:focus:ring-blue-500 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6 disabled:text-gray-500",value:C,onChange:e=>{E(e.target.value),U||R({id:(0,m.v4)(),name:"",url:"",method:"GET"})},disabled:f,children:[(0,s.jsx)("option",{value:"javascript",children:"JavaScript Code"}),(0,s.jsx)("option",{value:"http",children:"HTTP Action"}),(0,s.jsx)("option",{value:"mcp",children:"Model Context Protocol"})]})})]}),"mcp"===C?(0,s.jsx)("div",{className:"w-full my-1",children:(0,s.jsx)(n.default,{variables:b.filter(e=>"OAUTH_USER_ID_TOKEN"!==e&&"OAUTH_USER_ACCESS_TOKEN"!==e),details:F,setDetails:D})}):null,"javascript"===C||"http"===C?(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("label",{className:"font-semibold",children:[(0,s.jsx)(t.Trans,{id:"7HIUd6"}),"*"]}),(0,s.jsx)("div",{className:"text-gray-500 text-xs",children:(0,s.jsx)(t.Trans,{id:"i39oBj",components:{0:(0,s.jsx)("a",{className:"text-blue-500 hover:underline",href:"https://platform.openai.com/docs/guides/function-calling",target:"_blank",rel:"noreferrer"})}})}),(0,s.jsx)("button",{onClick:()=>{_.trim()===JSON.stringify(u.EXAMPLE_OPENAI_SPEC,null,2)||(!_.trim()||window.confirm(a.i18n._({id:"cKyvOf"})))&&A(JSON.stringify(u.EXAMPLE_OPENAI_SPEC,null,2))},className:"text-blue-500 font-semibold hover:underline my-1 text-sm disabled:text-gray-500",disabled:f,children:(0,s.jsx)(t.Trans,{id:"Ft7ytC"})}),(0,s.jsxs)("div",{className:"w-full my-1",children:[(0,s.jsx)("textarea",{disabled:f,placeholder:a.i18n._({id:"T3l2_7"}),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-500 dark:focus:border-blue-500 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",value:_,onCh
2ange:e=>A(e.target.value),rows:5}),(0,s.jsx)(x.default,{value:_,parser:JSON.parse,overridingErrorMessage:a.i18n._({id:"svQd1q"})})]})]}):null,"javascript"===C?(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("label",{className:"font-semibold",children:[(0,s.jsx)(t.Trans,{id:"uIjGvG"}),"*"]}),(0,s.jsx)("div",{className:"text-gray-500 text-xs",children:(0,s.jsx)(t.Trans,{id:"LKCY1R",components:{0:(0,s.jsx)("a",{className:"text-blue-500 hover:underline",href:j?.pluginsDocs||"/plugins-docs",target:"_blank",rel:"noreferrer"})}})}),(0,s.jsx)("div",{className:"w-full my-1",children:(0,s.jsx)("textarea",{disabled:f,placeholder:a.i18n._({id:"YoxD8i"}),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-500 dark:focus:border-blue-500 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",rows:5,value:O,onChange:e=>P(e.target.value)})})]}):"http"===C?(0,s.jsx)("div",{className:"w-full mb-4",children:U?(0,s.jsx)(l.default,{readOnly:f,httpAction:U,onFieldChange:(e,s)=>{R(t=>({...t,[e]:s}))},testFunction:y,variables:G}):null}):null,"mcp"===C?null:(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsx)("label",{className:"font-semibold",children:(0,s.jsx)(t.Trans,{id:"2o7xcf"})}),(0,s.jsx)("div",{className:"text-gray-500 text-xs",children:(0,s.jsx)(t.Trans,{id:"DOSz5a"})}),(0,s.jsx)("div",{className:"w-full my-1",children:(0,s.jsxs)("select",{id:"model",className:"block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 dark:ring-gray-500 dark:focus:ring-blue-500 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6 disabled:text-gray-500",value:I,onChange:e=>{z(e.target.value)},disabled:f,children:[(0,s.jsx)("option",{value:"respond_to_ai",children:(0,s.jsx)(t.Trans,{id:"as3prL"})}),(0,s.jsx)("option",{value:"render_markdown",children:(0,s.jsx)(t.Trans,{id:"1WgNFX"})}),(0,s.jsx)("option",{value:"render_html",children:(0,s.jsx)(t.Trans,{id:"lt7xdv"})}),(0,s.jsx)("option",{value:"cards",children:(0,s.jsx)(t.Trans,{id:"FLPgqR"})})]})})]})]}),V?(0,s.jsx)("div",{className:"text-orange-500 text-sm",children:(0,s.jsx)(t.Trans,{id:"L6Mhe6"})}):null]})}],758606);var p=e.i(676982);let b=({onSuccess:e})=>{let[r,l]=(0,d.useState)(""),[n,i]=(0,d.useState)(""),[o,u]=(0,d.useState)(!1),m=async s=>{s.preventDefault();try{i(""),u(!0);let s=await (0,c.fetchPluginFromGithub)(r);e(s)}catch(e){console.error(e),i(a.i18n._({id:"e6Mc3R"}))}finally{u(!1)}};return(0,s.jsxs)("form",{onSubmit:m,className:"my-2 flex flex-wrap items-center justify-center gap-x-2 gap-y-1",children:[(0,s.jsx)("input",{"data-element-id":"plugin-url-input",type:"text",name:"url",required:!0,pattern:c.GITHUB_PLUGIN_REGEX.source,placeholder:"Enter the github repo URL",className:"grow text-sm border border-gray-300 dark:border-gray-700 rounded-lg px-4 py-2 focus:outline-none focus:border-blue-500 dark:focus:border-blue-500 dark:bg-zinc-800",value:r,onChange:e=>l(e.target.value),disabled:o}),(0,s.jsx)("div",{className:"text-center",children:(0,s.jsx)("button",{disabled:o,"data-element-id":"continue-import-plugin-button",className:"inline-flex items-center px-3 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2 whitespace-nowrap",children:(0,s.jsx)(t.Trans,{id:"N69wao"})})}),(0,s.jsx)("div",{className:"w-full text-red-500 text-sm",children:n})]})};var f=e.i(113979);e.s(["default",0,function({value:e,setValue:a,error:r,setError:n,testFunction:i,extraHTTPActionVariables:o}){let{serverHostConfig:u}=(0,f.useAppConfigState)()||{},[m,x]=(0,d.useState)(!1),[h,g]=(0,d.useState)(null),j=(0,d.useMemo)(()=>/"implementationType":\s*"http"/g.test(e),[e]),[y,v]=(0,d.useState)([]);(0,d.useEffect)(()=>{if(j&&m)try{let s=JSON.parse(e);n(""),g(s.httpAction),v([...(0,c.parsedVariablesFromSpec)(s.openaiSpec,s.userSettings),...o])}catch(e){n("Invalid plugin/HTTP Action JSON")}},[e,j,m]);let[N,w]=(0,d.useState)(!1);return(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsx)("div",{children:(0,s.jsx)("div",{className:"text-xs text-gray-500",children:(0,s.jsx)(t.Trans,{id:"VYIIuD",components:{0:(0,s.jsx)("a",{target:"_blank",rel:"noreferrer",className:"text-blue-500 font-semibold hover:underline",href:u?.links?.sharePluginsViaGithub||"/guides/share-plugins-via-github"})}})})}),(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsx)("button",{type:"button",onClick:()=>{w(e=>!e)},className:"flex items-center px-2 py-1 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 disabled:cursor-default transition-colors",children:(0,s.jsx)("span",{children:(0,s.jsx)(t.Trans,{id:"dSVyu4"})})}),N&&(0,s.jsx)(b,{onSuccess:e=>{a(JSON.stringify(e,null,4)),w(!1)}})]}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)("textarea",{value:e,onCh
2ange:e=>a(e.target.value),type:"text",name:"json-file",id:"json-file",className:"min-h-[700px] bg-gray-50 text-base shadow\n dark:bg-gray-800\n hover:border-blue-400 cursor-default\n block w-full rounded-md border-0 py-1.5 text-gray-900 ring-1 ring-inset\n ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset\n focus:ring-blue-600 sm:leading-6 dark:text-white",placeholder:"Enter your JSON content here",rows:10})}),j&&(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(p.default,{label:"Test HTTP Action",enabled:m,setEnabled:e=>{e||(n(!1),g(void 0)),x(e)}})}),j&&m&&h&&!r&&(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(l.default,{hideDetails:!0,readOnly:!0,httpAction:h,onFieldChange:()=>{},testFunction:i,variables:y})})]})}],269439);var j=e.i(446322);e.s(["default",0,function({oauthConfig:e,onUpdated:a,links:r,sharedOAuthConnectionID:l=null,sharedOAuthConnections:n,isAdmin:i}){let[o,c]=(0,d.useState)(l),[m,x]=(0,d.useState)(e?.scopes||""),[h,g]=(0,d.useState)(e?.contentType||"json"),[p,b]=(0,d.useState)(e?.tokenURL||""),[f,y]=(0,d.useState)(e?.authorizationURL||""),[v,N]=(0,d.useState)(e?.accessType||"offline"),[w,T]=(0,d.useState)(e?.prompt||""),k=null===o,S=!k,C=(0,d.useMemo)(()=>{null!==o&&n?.find(e=>e.id===o)},[o,n]);(0,d.useEffect)(()=>{C?(x(C.oauthConfig?.scopes||""),g(C.oauthConfig?.contentType||"json"),b(C.oauthConfig?.tokenURL||""),y(C.oauthConfig?.authorizationURL||"")):(x(e?.scopes||""),g(e?.contentType||"json"),b(e?.tokenURL||""),y(e?.authorizationURL||""))},[C,e]);let E=()=>l!==o||!!k&&(m!==e?.scopes||h!==e?.contentType||p!==e?.tokenURL||f!==e?.authorizationURL||v!==e?.accessType||w!==e?.prompt);return(0,s.jsxs)("div",{className:(0,u.classNames)("border rounded-md p-4 shadow relative space-y-4 mt-2",E()?"border-orange-500":"border-gray-300 dark:border-gray-600 "),children:[n?.length>0?(0,s.jsx)("div",{className:"text-sm bg-yellow-50 border border-yellow-300 text-yellow-800 rounded px-3 py-2 mb-4",children:(0,s.jsx)(t.Trans,{id:"If-9as",components:{0:(0,s.jsx)("b",{})}})}):null,k?(0,s.jsx)("div",{className:"text-sm mb-4",children:(0,s.jsx)(t.Trans,{id:"s5AiGM",components:{0:(0,s.jsx)("b",{}),1:(0,s.jsx)("b",{}),2:(0,s.jsx)("a",{href:r?.pluginsOauthDocs||"https://docs.typingmind.com/plugins/oauth-2.0-authentication-for-plugins",className:"text-blue-500 hover:underline font-semibold",target:"_blank",rel:"noreferrer noopener"})}})}):null,n?.length>0&&(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsx)("label",{className:"block text-sm font-semibold mb-1",children:(0,s.jsx)(t.Trans,{id:"8rcG6m"})}),(0,s.jsxs)("select",{className:"w-full border border-gray-300 rounded p-2 text-sm",value:o||"",onChange:e=>c(e.target.value||null),children:[(0,s.jsx)("option",{value:"",children:(0,s.jsx)(t.Trans,{id:"Y3v3wr"})}),n.map(e=>(0,s.jsx)("option",{value:e.id,children:e.title},e.id))]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("label",{className:"block",children:[(0,s.jsxs)("span",{className:"text-sm font-semibold",children:[(0,s.jsx)(t.Trans,{id:"WyzrCD"}),":"]}),(0,s.jsx)("span",{className:"block text-xs text-gray-500",children:(0,s.jsx)(t.Trans,{id:"vTNv5F"})}),(0,s.jsx)("input",{className:"w-full border border-gray-300 rounded p-2 my-2 text-sm dark:bg-zinc-700 disabled:text-gray-500 disabled:bg-gray-100",type:"text",placeholder:"https://example.com/oauth/authorize",disabled:S,value:f,onChange:e=>y(e.target.value)})]}),(0,s.jsxs)("label",{className:"block",children:[(0,s.jsxs)("span",{className:"text-sm font-semibold",children:[(0,s.jsx)(t.Trans,{id:"vWNv6D"}),":"]}),(0,s.jsx)("span",{className:"block text-xs text-gray-500",children:(0,s.jsx)(t.Trans,{id:"GSIi_s"})}),i?(0,s.jsxs)("span",{className:"block text-xs text-orange-500",children:["To view debug logs for failed token requests, go to"," ",(0,s.jsx)("a",{href:"/admin/audit-logs?tab=debug",className:"text-blue-500 font-semibold hover:underline",target:"_blank",children:"Debug Logs"})]}):null,(0,s.jsx)("input",{className:"w-full border border-gray-300 rounded p-2 my-2 text-sm dark:bg-zinc-700 disabled:text-gray-500 disabled:bg-gray-100",type:"text",placeholder:"https://example.com/oauth/token",disabled:S,value:p,onChange:e=>b(e.target.value)})]}),(0,s.jsxs)("label",{className:"block",children:[(0,s.jsxs)("span",{className:"text-sm font-semibold",children:[(0,s.jsx)(t.Trans,{id:"f9cDxV"}),":"]}),(0,s.jsx)("span",{className:"block text-xs text-gray-500",children:(0,s.jsx)(t.Trans,{id:"O6y01T"})}),(0,s.jsxs)("select",{id:"model",className:"my-2 block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6 disabled:text-gray-500 disabled:bg-gray-100",disabled:S,value:h,onChange:e=>g(e.target.value),children:[(0,s.jsx)("option",{value:"json",children:"JSON"}),(0,s.jsx)("option",{value:"urlencoded",children:"URL Encoded"})]})]}),(0,s.jsxs)("label",{className:"block",children:[(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Scopes:"}),(0,s.jsx)("span",{className:"block text-xs text-gray-500",children:(0,s.jsx)(t.Trans,{id:"86dQmw"})}),(0,s.jsx)("input",{className:"w-full border border-gray-300 rounded p-2 my-2 text-sm dark:bg-zinc-700 disabled:text-gray-500 disabled:bg-gray-100",type:"text",placeholder:"openid email profile",disabled:S,value:m,onChange:e=>x(e.target.value)})]}),(0,s.jsxs)("label",{className:"block",children:[(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Access Type:"}),(0,s.jsx)("span",{className:"block text-xs text-gray-500",children:(0,s.jsx)(t.Trans,{id:"hFoJs-"})}),(0,s.jsx)("input",{className:"w-full border border-gray-300 rounded p-2 my-2 text-sm disabled:text-gray-500 disabled:bg-gray-100",type:"text",placeholder:"offline",value:v,onCh
2ange:e=>N(e.target.value),disabled:S})]}),(0,s.jsxs)("label",{className:"block",children:[(0,s.jsx)("span",{className:"text-sm font-semibold",children:"Prompt:"}),(0,s.jsx)("span",{className:"block text-xs text-gray-500",children:(0,s.jsx)(t.Trans,{id:"0xdQjs"})}),(0,s.jsx)("input",{className:"w-full border border-gray-300 rounded p-2 my-2 text-sm disabled:text-gray-500 disabled:bg-gray-100",type:"text",placeholder:"consent",value:w,onChange:e=>T(e.target.value),disabled:S})]})]}),E()?(0,s.jsxs)("div",{className:"flex items-center justify-start gap-2 my-4",children:[(0,s.jsxs)("button",{onClick:()=>{a({scopes:m,contentType:h,tokenURL:p,authorizationURL:f,accessType:v,prompt:w},o)},type:"submit",className:"inline-flex items-center px-3 py-1.5 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:bg-gray-400 gap-2",children:[(0,s.jsx)(j.FaCheck,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:(0,s.jsx)(t.Trans,{id:"01Jn66"})})]}),(0,s.jsx)("button",{onClick:()=>{c(l),x(e?.scopes||""),g(e?.contentType||"json"),b(e?.tokenURL||""),y(e?.authorizationURL||""),T(e?.prompt||""),N(e?.accessType||"offline")},type:"submit",className:"inline-flex items-center px-3 py-1.5 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 disabled:bg-gray-400 gap-2",children:(0,s.jsx)("span",{children:(0,s.jsx)(t.Trans,{id:"9C6X7Q"})})})]}):null]})}],712117)},771473,e=>{"use strict";var s=e.i(268601),t=e.i(687513),a=e.i(327276),r=e.i(918110);e.s(["default",0,function({type:e}){return(0,s.jsx)("div",{className:"w-8 h-8 rounded-full flex items-center justify-center bg-gray-300 dark:bg-gray-700",children:"mcp"===e||"mcp_http"===e?(0,s.jsx)(r.default,{className:"w-4 h-4"}):"javascript"===e?(0,s.jsx)(t.default,{className:"w-4 h-4"}):"http"===e?(0,s.jsx)(a.default,{className:"w-4 h-4"}):(0,s.jsx)("span",{className:"text-[10px] font-semibold bg-blue-100 text-blue-800 px-1.5 py-0.5 rounded-full",children:e?.substring(0,2).toUpperCase()||"?"})})}])},823594,e=>{"use strict";var s=e.i(268601),t=e.i(372781),a=e.i(904976),r=e.i(971910),l=e.i(670245),n=e.i(975705),i=e.i(357287);e.s(["default",0,function({credentials:e={},setCredentials:d,disabled:o,connectionTestFunction:c}){let[u,m]=(0,n.useState)(!1),[x,h]=(0,n.useState)(""),[g,p]=(0,n.useState)(e?.connectorURL||""),[b,f]=(0,n.useState)(e?.connectorAuthToken||""),[j,y]=(0,n.useState)(!c),v=async()=>{m(!0),h("");try{await c?.({url:g,authToken:b}),y(!0)}catch(e){console.error("Error testing connection:",e),h("Connection test failed: "+e.message),y(!1)}finally{m(!1)}},N=()=>g!==(e?.connectorURL||"")||b!==(e?.connectorAuthToken||"");return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("div",{className:"font-medium",children:(0,s.jsx)(r.Trans,{id:"FDKbTp"})}),(0,s.jsx)("div",{className:"text-gray-500 text-xs",children:(0,s.jsx)(r.Trans,{id:"syvk9G",components:{0:(0,s.jsx)("a",{className:"text-blue-500 font-semibold hover:underline",href:"https://www.typingmind.com/mcp",target:"_blank"})}})})]}),(0,s.jsxs)("div",{className:(0,i.classNames)("text-sm space-y-4 p-4 rounded-lg border border-gray-300 dark:border-gray-500 bg-white dark:bg-zinc-800 shadow-md",N()?"outline outline-2 outline-orange-500":""),children:[(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("label",{className:"font-semibold",children:[(0,s.jsx)(r.Trans,{id:"drkIWs"}),"*"]}),(0,s.jsx)("div",{className:"w-full my-1",children:(0,s.jsx)("input",{disabled:o||u,type:"text",placeholder:l.i18n._({id:"SAMK08"}),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-500 dark:focus:border-blue-500 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",value:g,onChange:e=>p(e.target.value)})})]}),(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("label",{className:"font-semibold",children:[(0,s.jsx)(r.Trans,{id:"qk_EkE"}),"*"]}),(0,s.jsx)("div",{className:"w-full my-1",children:(0,s.jsx)(a.default,{disabled:o||u,placeholder:l.i18n._({id:"WIY4Wi"}),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-500 dark:focus:border-blue-500 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",value:b,onChange:f})})]}),c&&j?(0,s.jsx)("div",{className:"text-green-500 text-sm",children:(0,s.jsx)(r.Trans,{id:"_8WJU7"})}):null,x?(0,s.jsx)("div",{className:"text-red-500 text-sm line-clamp-3",children:x}):null,N()?(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2 my-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-start gap-2",children:[c?(0,s.jsxs)("button",{onClick:v,type:"submit","data-tooltip-id":"global",className:"inline-flex items-center px-3 py-1.5 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2",disabled:o||u,children:[u?(0,s.jsx)(t.default,{}):null,(0,s.jsx)("span",{children:(0,s.jsx)(r.Trans,{id:"s7uMvM"})})]}):null,(0,s.jsx)("button",{onClick:()=>{d({connectorURL:g,connectorAuthToken:b}),y(!c)},type:"submit",className:"inline-flex items-center px-3 py-1.5 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:bg-gray-400 gap-2",disabled:o||!j||u,children:(0,s.jsx)("span",{children:(0,s.jsx)(r.Trans,{id:"xCSrnE"})})})]}),(0,s.jsx)("button",{onClick:()=>{y(!c),p(e?.connectorURL||""),f(e?.connectorAuthToken||"")},type:"submit",className:"inline-flex items-center px-3 py-1.5 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 disabled:bg-gray-400 gap-2",disabled:o||u,children:(0,s.jsx)("span",{children:(0,s.jsx)(r.Trans,{id:"9C6X7Q"})})})]}):null]})]})}])},996570,737807,549452,195519,e=>{"use strict";var s=e.i(268601),t=e.i(566406);e.s(["default",0,function({permissions:e,setPermissions:a,disabled:r}){return 0===t.PLUGIN_PERMISSION_SPECS.length?null:(0,s.jsx)("div",{className:"space-y-3 mt-4",children:(0,s.jsx)("div",{className:"space-y-2",children:t.PLUGIN_PERMISSION_SPECS.map(t=>(0,s.jsx)("div",{className:"border rounded p-3 bg-gray-50 dark:bg-gray-800 border-gray-200 dark:border-gray-700",children:(0,s.jsxs)("div",{className:"flex items-start space-x-3",children:[(0,s.jsx)("input",{type:"checkbox",id:t.
2id,checked:(e||[]).includes(t.id),onChange:()=>{var s;return s=t.id,void((e||[]).includes(s)?a((e||[]).filter(e=>e!==s)):a([...e||[],s]))},disabled:r,className:"mt-0.5 h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 dark:text-blue-500 focus:ring-blue-500 dark:focus:ring-blue-400 dark:bg-gray-700"}),(0,s.jsxs)("div",{className:"flex-1 space-y-1",children:[(0,s.jsxs)("label",{htmlFor:t.id,className:`block text-sm font-medium cursor-pointer ${r?"text-gray-500 dark:text-gray-400":"text-gray-900 dark:text-gray-100"}`,children:[t.label,(0,s.jsx)("span",{className:"text-xs bg-gray-300 dark:bg-gray-700 px-2 py-0.5 rounded-full ml-1",children:t.id})]}),(0,s.jsx)("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:t.description})]})]})},t.id))})})}],996570);var a=e.i(971910),r=e.i(670245),l=e.i(975705),n=e.i(372781);e.i(273910),e.s(["default",0,function({onDelete:e,onFieldChange:t,httpAction:i,testFunction:d,variables:o=[],readOnly:c,hideDetails:u}){let[m,x]=(0,l.useState)(!1),[h,g]=(0,l.useState)(null),[p,b]=(0,l.useState)(!1),[f,j]=(0,l.useState)(""),y=async()=>{if(x(!0),g(null),f)try{JSON.parse(f)}catch(e){x(!0),g("Failed: Test Variables must be a valid JSON object.");return}try{let e=await d(i,f?JSON.parse(f):void 0);g({error:"",text:e})}catch(e){console.log("httpAction error",e),g({error:e?.message})}x(!1)},v=e=>["POST","PUT","PATCH"].includes(e);return(0,s.jsxs)("div",{className:"border border-gray-300 dark:border-gray-600 rounded-md p-4 shadow relative space-y-4",children:[(0,s.jsx)("div",{className:"text-xs text-gray-500 mb-1",children:(0,s.jsxs)("div",{children:[(0,s.jsx)(a.Trans,{id:"TJCWpw"}),":"," ",o.length?o.map(e=>(0,s.jsx)("code",{className:"bg-gray-200 dark:bg-gray-700 rounded mx-1",children:`{${e}}`},e)):r.i18n._({id:"DzGwzA"}),". You can use these variables in Request URL, Request Body, and Request Headers."," ",(0,s.jsx)("a",{href:"/plugins-docs",target:"_blank",className:"text-blue-500 font-semibold hover:underline",children:"Learn more"})]})}),!u&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-center gap-4 flex-col sm:flex-row",children:[(0,s.jsxs)("div",{className:"flex-shrink-0 w-full sm:w-fit",children:[(0,s.jsxs)("div",{className:"font-semibold mb-1",children:[(0,s.jsx)(a.Trans,{id:"bHXYoC"}),":"]}),(0,s.jsxs)("select",{disabled:m||c,className:"w-full border border-gray-300 rounded-md shadow-sm py-2 pl-3 pr-10 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500",value:i.method,onChange:e=>{t("method",e.target.value),!v(e.target.value)&&i.hasBody&&t("hasBody",!1)},children:[(0,s.jsx)("option",{value:"GET",children:"GET"}),(0,s.jsx)("option",{value:"POST",children:"POST"}),(0,s.jsx)("option",{value:"PUT",children:"PUT"}),(0,s.jsx)("option",{value:"DELETE",children:"DELETE"}),(0,s.jsx)("option",{value:"PATCH",children:"PATCH"})]})]}),(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("div",{className:"font-semibold mb-1",children:[(0,s.jsx)(a.Trans,{id:"T3juzf"}),":"]}),(0,s.jsx)("input",{type:"text",placeholder:"https://yourapi.example.com/last-10-tweets.json",className:"w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500",value:i.url,onChange:e=>{t("url",e.target.value)},disabled:m||c})]})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"font-semibold mb-1 flex items-center justify-start gap-4 flex-wrap",children:[(0,s.jsxs)("label",{className:"flex items-center justify-start gap-2 text-sm",children:[(0,s.jsx)("input",{type:"checkbox",checked:i.hasHeaders,onChange:e=>{t("hasHeaders",e.target.checked)},disabled:m||c}),(0,s.jsx)("span",{children:(0,s.jsx)(a.Trans,{id:"Ghn0ZA"})})]}),v(i.method)?(0,s.jsxs)("label",{className:"flex items-center justify-start gap-2 text-sm",children:[(0,s.jsx)("input",{type:"checkbox",checked:i.hasBody,onChange:e=>{t("hasBody",e.target.checked)},disabled:m||c}),(0,s.jsx)("span",{children:(0,s.jsx)(a.Trans,{id:"KVJGUP"})})]}):null,(0,s.jsxs)("label",{className:"flex items-center justify-start gap-2 text-sm",children:[(0,s.jsx)("input",{type:"checkbox",checked:i.hasResultTransform,onChange:e=>{t("hasResultTransform",e.target.checked),e.target.checked&&!i.resultTransform&&t("resultTransform",{engine:"jmes",expression:""})},disabled:m||c}),(0,s.jsx)("span",{children:(0,s.jsx)(a.Trans,{id:"QGP6it"})})]})]}),i.hasHeaders&&(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("div",{className:"font-semibold mb-1",children:[(0,s.jsx)(a.Trans,{id:"ArNNAV"}),":"]}),(0,s.jsx)("textarea",{placeholder:`{ 3 "Content-Type": "application/json" 4}`,rows:3,className:"w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500 w-full",value:i.requestHeaders,onChange:e=>{t("requestHeaders",e.target.value)},disabled:m||c})]}),i.hasBody&&(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("div",{className:"font-semibold mb-1",children:[(0,s.jsx)(a.Trans,{id:"yWOswz"}),":"]}),(0,s.jsx)("textarea",{placeholder:`{ 5 "userID": "{userID}" 6}`,rows:3,className:"w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500 w-full",value:i.requestBody,onChange:e=>{t("requestBody",e.target.value)},disabled:m||c})]}),i.hasBody&&(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("div",{className:"font-semibold mb-1",children:[(0,s.jsx)(a.Trans,{id:"dZjnSE"}),":"]}),(0,s.jsx)("div",{className:"text-gray-500 text-xs mb-1",children:(0,s.jsx)(a.Trans,{id:"Ffcffi"})}),(0,s.jsxs)("select",{className:"block w-full rounded-md border-0 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white dark:bg-zinc-700 ring-1 ring-inset ring-gray-300 focus:ring-2 focus:ring-blue-600 sm:text-sm sm:leading-6 disabled:text-gray-500",value:i.requestBodyFormat||"json",onChange:e=>{t("requestBodyFormat",e.target.value)},disabled:m||c,children:[(0,s.jsx)("option",{value:"json",children:"JSON"}),(0,s.jsx)("option",{value:"form-data",children:"FormData"})]})]}),i.hasResultTransform&&(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("div",{className:"font-semibold",children:[(0,s.jsx)(a.Trans,{id:"gF9SeK"}),":"]}),(0,s.jsxs)("div",{className:" mb-1 text-xs text-gray-500",children:[(0,s.jsx)(a.Trans,{id:"EuE1GI"})," ",(0,s.jsx)("a",{className:"text-blue-500 hover:underline",href:"/plugins-docs",target:"_blank",children:(0,s.jsx)(a.Trans,{id:"zwWKhA"})})]}),(0,s.jsxs)("div",{className:"flex items-start justify-center gap-2",children:[(0,s.jsxs)("div",{className:"flex-shrink-0",children:[(0,s.jsx)("div",{className:"font-semibold text-sm",children:(0,s.jsx)(a.Trans,{id:"k-M-xc"})}),(0,s.jsxs)("select",{disabled:m||c,className:"w-fit border border-gray-300 rounded-md shadow-sm py-2 pl-3 pr-10 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500",value:i.resultTransform?.engine,onChange:e=>{t("resultTransform",{...i.resultTransform||{},engine:e.target.value})},children:[(0,s.jsx)("option",{value:"jmes",children:"JMESPath Transform"}),(0,s.jsx)("option",{value:"handlebars",children:"Handlebars.js Template"})]})]}),i.resultTransform?.engine==="jmes"?(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsx)("label",{className:"font-semibold text-sm",children:(0,s.jsx)(a.Trans,{id:"JToDwi"})}),(0,s.jsx)("input",{type:"text",placeholder:"locations[?state == 'WA'].name | sort(@) | {WashingtonCities: join(', ', @)}",className:"w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500",value:i.resultTransform?.expression,onChange:e=>{t("resultTransform",{...i.resultTransform||{},expression:e.target.value})},disabled:m||c})]}):i.resultTransform?.engine==="handlebars"?(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsx)("label",{className:"font-semibold text-sm",children:(0,s.jsx)(a.Trans,{id:"lHk6rb"})}),(0,s.jsx)("textarea",{rows:3,type:"text",placeholder:"<p>{{firstname}} {{lastname}}</p>",className:"w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500",value:i.resultTransform?.templateString,onChange:e=>{t("resultTransform",{...i.resultTransform||{},templateString:e.target.value})},disabled:m||c})]}):null]})]})]})]}),p?(0,s.jsxs)("div",{className:"w-full",children:[(0,s.jsxs)("div",{className:"font-semibold mb-1",children:[(0,s.jsx)(a.Trans,{id:"cQfI46"}),":"]}),(0,s.jsx)("textarea",{placeholder:`{ 7 "userID": "{userID}" 8}`,rows:3,className:"w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500 w-full",value:f,onChange:e=>{j(e.target.value)},disabled:m})]}):null,(0,s.jsxs)("div",{className:"flex items-center justify-start gap-4",children:[(0,s.jsxs)("button",{onClick:()=>{y()},type:"submit",className:"inline-flex items-center px-3 py-1.5 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-400 gap-2",disabled:m,children:[m?(0,s.jsx)(n.default,{}):"â",(0,s.jsx)("span",{children:(0,s.jsx)(a.Trans,{id:"Ls-eRP"})})]}),(0,s.jsxs)("label",{className:"flex items-center justify-start gap-2 text-sm",children:[(0,s.jsx)("input",{type:"checkbox",checked:p,onChange:e=>{b(e.target.checked),e.target.checked&&!f&&j(JSON.stringify(o.reduce((e,s)=>(e[s]="test value",e),{}),null,2))},disabled:m}),(0,s.jsx)("span",{children:(0,s.jsx)(a.Trans,{id:"WD6ttL"})})]})]}),h?(0,s.jsxs)("div",{children:[h.error?(0,s.jsx)("div",{className:"font-semibold text-red-500 mb-1",children:(0,s.jsx)(a.Trans,{id:"sCG3Yu"})}):(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"font-semibold mb-1 text-green-500",children:[(0,s.jsx)(a.Trans,{id:"Wagt7O"})," (",(0,s.jsx)(a.Trans,{id:"IPXOXm",values:{0:h.text?.length||0}}),")"]})}),h.error?(0,s.jsx)("textarea",{className:"w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500 w-full",rows:3,value:h?.error,readOnly:!0}):(0,s.jsx)("textarea",{className:"w-full border border-gray-300 dark:border-gray-600 rounded-md shadow-sm py-2 px-3 text-base leading-6 focus:outline-none focus:ring-blue-500 focus:border-blue-500 transition duration-150 ease-in-out dark:bg-zinc-700 disabled:text-gray-500 w-full",rows:3,value:h?.text,readOnly:!0})]}):null]})}],737807);var i=e.i(569096);let d=({value:e,parser:t,overridingErrorMessage:a})=>{let r=(0,i.useDebouncedValue)(e,300),[n,d]=(0,l.useState)("");return((0,l.useEffect)(()=>{try{d(""),r&&t(r)}catch(e){d(a||e.message)}},[r]),n)?(0,s.jsx)("div",{className:"text-red-500 text-sm mt-1",children:n}):null};e.s(["default",0,d],549452);var o=e.i(357287),c=e.i(265689);let u=`{ 9 "mcpServers": {
10 "my_mcp_server": { 11 "command": "npx", 12 "args": ["-y", "this is an example server"] 13 } 14 } 15}`;e.s(["default",0,function({details:e={},setDetails:t,variables:n,disabled:i}){let[m,x]=(0,l.useState)(e?.serverConfig?JSON.stringify(e.serverConfig,null,2):""),h=e=>{let s=JSON.parse(e);if("object"!=typeof s)throw Error("Invalid MCP server configuration: value must be an object with mcpServers key");if(!s.mcpServers)throw Error("Invalid MCP server configuration: missing mcpServers key");if(1!==Object.keys(s.mcpServers).length)throw Error("Invalid MCP server configuration: mcpServers must contains exactly one server configuration");return s},g=(0,o.parseOrNull)(m),p=(0,l.useMemo)(()=>{try{return h(m),!0}catch(e){}},[m]),b=()=>(0,c.default)(g)!==(0,c.default)(e?.serverConfig||"");return(0,s.jsxs)("div",{className:(0,o.classNames)("space-y-4 p-4 rounded-lg border bg-white dark:bg-zinc-800 shadow-md",b()?"border-orange-500":"border-gray-300 dark:border-gray-500"),children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"font-semibold",children:[(0,s.jsx)(a.Trans,{id:"o1czPW"}),"*"]}),(0,s.jsxs)("div",{className:"text-gray-500 text-xs",children:[(0,s.jsx)(a.Trans,{id:"ECF1fC"})," ",(0,s.jsx)(a.Trans,{id:"TJCWpw"}),":"," ",n.length?n.map(e=>(0,s.jsx)("code",{className:"bg-gray-200 dark:bg-gray-700 rounded mx-1",children:`{${e}}`},e)):r.i18n._({id:"DzGwzA"})]}),(0,s.jsx)("button",{onClick:()=>{m===u||(!m.length||window.confirm(r.i18n._({id:"d_sOEJ"})))&&x(u)},className:"text-blue-500 font-semibold hover:underline my-1 text-sm disabled:text-gray-500",disabled:i,children:(0,s.jsx)(a.Trans,{id:"YWycwF"})}),(0,s.jsxs)("div",{className:"w-full my-1",children:[(0,s.jsx)("textarea",{disabled:i,placeholder:u,className:"w-full h-72 px-3 py-2 border border-gray-300 dark:border-gray-500 dark:focus:border-blue-500 rounded-md shadow-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm dark:bg-zinc-700",autoComplete:"off",value:m,onChange:e=>x(e.target.value),rows:5}),(0,s.jsx)(d,{value:m,parser:h})]})]}),b()?(0,s.jsx)("div",{className:"flex items-center justify-between gap-2 my-4",children:(0,s.jsxs)("div",{className:"flex items-center justify-start gap-2",children:[(0,s.jsx)("button",{onClick:()=>{t({serverConfig:g,id:Object.keys(g.mcpServers)[0]})},type:"submit","data-tooltip-id":"global","data-tooltip-content":p?"":r.i18n._({id:"JuQIKl"}),className:"inline-flex items-center px-3 py-1.5 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 disabled:bg-gray-400 gap-2",disabled:i||!p,children:(0,s.jsx)("span",{children:(0,s.jsx)(a.Trans,{id:"xCSrnE"})})}),(0,s.jsx)("button",{onClick:()=>{x(e?.serverConfig?JSON.stringify(e?.serverConfig,null,2):"")},type:"submit",className:"inline-flex items-center px-3 py-1.5 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 disabled:bg-gray-400 gap-2",disabled:i,children:(0,s.jsx)("span",{children:(0,s.jsx)(a.Trans,{id:"9C6X7Q"})})})]})}):null]})}],195519)},221513,e=>{"use strict";var s=e.i(268601),t=e.i(971910),a=e.i(372781),r=e.i(904976),l=e.i(975705),n=e.i(253056),i=e.i(622323),d=e.i(357287);let o="disabled:cursor-default disabled:bg-gray-200 disabled:text-neutral-400 bg-slate-100 dark:bg-white/10 text-slate-900 dark:text-white placeholder:text-slate-600 text-base sm:text-sm dark:placeholder:text-slate-400 px-3 py-2.5 focus:ring-blue-600 focus:ring-2 focus:ring-inset grow w-full border-none rounded-lg";e.s(["default",0,function({userSettings:e,entries:c,onSave:u,readOnly:m,showInput:x=!0}){let[h,g]=(0,l.useState)(c),[p,b]=(0,l.useState)(!1),f=async()=>{b(!0);try{await u(h)}catch(e){console.error(e)}b(!1)};(0,l.useEffect)(()=>{g(c)},[c]);let j=Object.keys(h).some(e=>h[e]!==c[e]);return(0,s.jsxs)("div",{className:"flex flex-col gap-4",children:[0===(e||[]).length?(0,s.jsx)("p",{className:"text-center text-slate-500 dark:text-slate-400 p-4",children:(0,s.jsx)(t.Trans,{id:"saqKEO"})}):null,(0,s.jsx)("div",{className:"space-y-2",children:(e||[]).map((e,a)=>(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:(0,d.classNames)("block text-sm font-medium leading-6",e.required&&!h[e.name]?"text-red-600 dark:text-red-400":""),children:[e.label,e.required?" *":""]}),e.description?(0,s.jsx)("div",{className:"text-xs text-slate-500 dark:text-slate-400",children:e.description}):null]}),x?(0,s.jsx)(s.Fragment,{children:"enum"===e.type?(0,s.jsxs)("select",{id:"model",className:"h-10 sm:text-sm disabled:cursor-default disabled:bg-gray-200 disabled:text-neutral-400 bg-slate-100 dar
15k:bg-white/10 text-slate-900 dark:text-white placeholder:text-slate-600 text-base dark:placeholder:text-slate-400 px-3 focus:ring-blue-600 focus:ring-2 focus:ring-inset grow w-full border-none rounded-lg",value:h[e.name],onChange:s=>{g(t=>({...t,[e.name]:s.target.value}))},disabled:p||m,children:[(0,s.jsx)("option",{value:"",children:(0,s.jsx)(t.Trans,{id:"nMAlk3"})}),(e.values||[]).map((e,t)=>(0,s.jsx)("option",{value:e,children:e},t))]}):"password"===e.type||(0,i.isMaskedSecret)(c[e.name])?(0,s.jsx)(r.default,{type:e.type||"text",placeholder:e.placeholder||e.label,className:o,value:h[e.name],disabled:p||m,onChange:s=>{g(t=>({...t,[e.name]:s}))}}):(0,s.jsx)("input",{type:e.type||"text",placeholder:e.placeholder||e.label,className:o,autoComplete:"new-password","data-1p-ignore":!0,"data-lpignore":"true",value:h[e.name]||"",disabled:p||m,onChange:s=>{let t="number"===e.type?Number(s.target.value):s.target.value;g(s=>({...s,[e.name]:t}))}})}):null]},a))}),m||0===(e||[]).length?null:(0,s.jsxs)(n.default,{onClick:f,disabled:!j||p||m,type:"submit",theme:"blue",className:"w-fit",children:[p?(0,s.jsx)(a.default,{}):null,(0,s.jsx)("span",{children:(0,s.jsx)(t.Trans,{id:"tfDRzk"})})]})]})}])},317948,104671,125889,792681,e=>{"use strict";var s=e.i(268601),t=e.i(357287),a=e.i(971910),r=e.i(670245),l=e.i(372781),n=e.i(349441),i=e.i(109844),d=e.i(478787),o=e.i(975705);function c(e){(0,o.useEffect)(()=>{if(!e||!navigator.wakeLock)return;let s=!0,t=!1,a=null,r=async()=>{if(s&&!t&&!a&&"visible"===document.visibilityState){t=!0;try{let e=await navigator.wakeLock.request("screen");if(!s)return void await e.release();a=e,e.addEventListener("release",()=>{a===e&&(a=null)})}catch{}finally{t=!1}}},l=()=>{"visible"===document.visibilityState&&r()};return r(),document.addEventListener("visibilitychange",l),()=>{s=!1,document.removeEventListener("visibilitychange",l),a?.release().catch(()=>{}),a=null}},[e])}e.s(["useScreenWakeLock",0,c],104671);var u=e.i(524572),m=e.i(253056),x=e.i(935477),h=e.i(892251),g=e.i(980425),p=e.i(528073),b=e.i(995051),f=e.i(250017),j=e.i(553333),y=e.i(585314),v=e.i(530072),N=e.i(20784),w=e.i(119805);let T=(0,o.memo)((0,o.forwardRef)(function({onAttachmentsParsed:e,className:a,onTrack:n},i){let[d,c]=(0,o.useState)(!1),u=(0,o.useRef)(null);(0,o.useImperativeHandle)(i,()=>({click:()=>{u.current?.click()}}));let m=async s=>{c(!0);try{let t=Array.from(s.target.files),a=await (0,y.validateAndParseAttachments)(t,{saveBlob:N.saveBlob}),r=a.filter(e=>e instanceof Error).map(e=>e.message);r.length&&f.toast.error("Unsupported files: "+r.join(", ")),e(a.filter(e=>!!e&&!(e instanceof Error)))}catch(e){console.error("Error while reading file: ",e),f.toast.error("Error: "+e.message)}finally{c(!1),s.target.value=""}};return(0,s.jsxs)("button",{"data-element-id":"upload-document-button",type:"button","aria-label":r.i18n._({id:"xfXHtn"}),className:(0,t.classNames)(a||"rounded-md py-1 px-1 flex items-center justify-center transition-all space-x-2 shrink-0 text-gray-500 hover:text-gray-900 dark:hover:text-white",d?"cursor-default":"cursor-pointer"),onClick:()=>{n?.(),u.current?.click()},"data-tooltip-content":r.i18n._({id:"xfXHtn"}),"data-tooltip-id":"global",children:[d?(0,s.jsx)(l.default,{}):(0,s.jsx)(w.default,{className:"w-5 h-5"}),(0,s.jsx)("input",{ref:u,id:"file-upload",name:"file-upload",type:"file",tabIndex:-1,className:"hidden",disabled:d,onChange:m,multiple:!0})]})}));e.s(["default",0,T],125889);let k=(0,o.forwardRef)(function({onSend:e,disabled:l,showRegenerate:n,onRegenerate:i,defaultInputText:d,onEscapeWithoutContent:c},x){let[h,g]=(0,o.useState)([]),[w,k]=(0,o.useState)(d||""),S=(0,o.useRef)();(0,o.useImperativeHandle)(x,()=>({focus:()=>{S.current?.focus()}})),(0,o.useEffect)(()=>{if(d){k(d),S.current?.focus();let e=d.length;S.current?.setSelectionRange(e,e)}},[d]);let C=()=>{let s=[...w.trim()?[{type:"text",text:w}]:[],...h];s.length&&(k(""),g([]),e(s))},E=async e=>{if(Array.from(e.clipboardData.items).find(e=>"text/plain"===e.type)){let s=e.clipboardData.getData("text/plain");if(s.length<=16e3)return;e.preventDefault(),e.stopPropagation(),g([...h,{type:"tm_text_file",text:s,metadata:{name:"clipboard.txt",source:"clipboard",characters:s.length,estimatedTokens:(0,v.getEstimatedTokens)(s)},id:(0,u.v4)()}]);return}if(e.clipboardData.files.length){e.preventDefault(),e.stopPropagation();try{let s=await Promise.all(Array.from(e.clipboardData.files).map(e=>(0,y.parseAttachmentFromFile)(e,{saveBlob:N.saveBlob})));g(e=>
15[...e,...s].filter(Boolean))}catch(e){console.error("error while parsing files from clipboard:",e),f.toast.error("Error: "+e.message)}}};return(0,s.jsxs)("div",{children:[h.length?(0,s.jsx)("div",{className:(0,t.classNames)("flex items-center justify-start gap-2 flex-wrap mb-2"),children:h.map(e=>(0,s.jsx)(p.default,{attachmentFile:e,onRemove:()=>g(h.filter(s=>s.id!==e.id)),onPasteAsText:()=>(e=>{let s=e.text||"",t=S.current,a=t?.selectionStart,r=t?.selectionEnd;if(g(h.filter(s=>s.id!==e.id)),void 0!==a&&void 0!==r){k(w.slice(0,a)+s+w.slice(r)),setTimeout(()=>{S.current?.focus(),S.current?.setSelectionRange(a,a+s.length)},300);return}k(s),setTimeout(()=>{S.current?.focus();let e=S.current?.value.length||0;S.current?.setSelectionRange(e,e),S.current?.scrollTo?.(0,S.current.scrollHeight)},300)})(e)},e.id))}):null,(0,s.jsxs)("div",{className:"flex items-end justify-center gap-2",children:[(0,s.jsx)("div",{className:" flex items-center justify-center h-[36px]",children:(0,s.jsx)(T,{onAttachmentsParsed:e=>{g(s=>[...s,...e])}})}),(0,s.jsx)(b.default,{className:"bg-slate-100 dark:bg-white/10 text-slate-900 dark:text-white placeholder:text-slate-400 text-base dark:placeholder:text-slate-400 px-4 focus:ring-blue-600 focus:ring-2 grow border-none rounded-xl w-full resize-none max-h-[200px] sm:text-sm",ref:S,autoFocus:!0,placeholder:r.i18n._({id:"Dqo8sL"}),value:w,onChange:e=>k(e.target.value),disabled:l,onPaste:E,onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),C()),"Escape"===e.key&&0===w.length&&c?.()}}),(0,s.jsx)(m.default,{className:"h-[36px]",disabled:l,type:"submit",onClick:()=>{C()},children:(0,s.jsx)(a.Trans,{id:"JlFcis"})}),n?(0,s.jsx)(m.default,{disabled:l,type:"submit",onClick:i,"data-tooltip-id":"global","data-tooltip-content":r.i18n._({id:"6exX-8"}),children:(0,s.jsx)(j.default,{className:"w-5 h-5"})}):null]})]})});e.s(["default",0,k],792681),e.s(["default",0,function({plugins:e=[],pluginsUserSettings:p={},onToolCallDetailsClick:b,defaultModel:f="gpt-4o",onModelChange:j,withBorders:y=!0,showRegenerate:v=!0,showModelPicker:N=!0,maxHeight:w,emptyPlaceholder:T,defaultInputText:S,implicitHistoryMessages:C=[],initialAttachmentRegistry:E={},userProfilePicURL:_,onEscapeWithoutContent:A,botAvatar:O}){let[P,U]=(0,o.useState)(f),[R,F]=(0,o.useState)(!1),[D,I]=(0,o.useState)([]),[z,L]=(0,o.useState)(E),H=(0,o.useRef)(z),[M,J]=(0,o.useState)(u.v4),[G,V]=(0,o.useState)(null);c(R);let Y=(0,o.useRef)(),K=(0,o.useRef)(null),W=(0,o.useRef)(null),{availableModels:q,createGenerator:B}=(0,d.useGenerator)(),$=(0,o.useCallback)(()=>{Y.current&&setTimeout(()=>{Y.current.scrollTo({top:Y.current.scrollHeight,behavior:"smooth"})},100)},[]),X=(0,o.useCallback)(()=>{K.current&&K.current.stop();let s=B({chatID:M,pluginsUserSettings:p,plugins:e,getChatAttachmentRegistry:async()=>H.current,saveChatAttachments:async e=>{if(K.current!==s)return e;let t={...H.current};for(let s of e)t[s.id]||=s;return H.current=t,L(t),e}});K.current=s;let t=[];function a(e,a){s.on(e,a),t.push(()=>s.off(e,a))}return a("messagesAdded",e=>{I(s=>[...s,...e]),$()}),a("closed",()=>{F(!1),setTimeout(()=>{W.current?.focus()},100)}),a("error",e=>{console.error("Error in generator:",e),V(e?.message||"An error occurred")}),s},[M,e,p,$,B]);(0,o.useEffect)(()=>()=>{K.current?.stop()},[]);let Q=(0,o.useCallback)(e=>D.find(s=>"tool"===s.role&&s.tool_call_id===e?.id),[D]),Z=(0,o.useCallback)(({toolCall:e})=>{let s=Q(e);b?.({functionArguments:(0,t.parseOrNull)(e.function.arguments),toolResponse:(0,t.getToolMessageOutput)(s)})},[Q,b]),ee=(0,o.useCallback)(s=>s.pluginUUID?e.find(e=>e.uuid===s.pluginUUID):s.function?e.find(e=>Array.isArray(e.mcpDetails?.tools)?e.mcpDetails.tools.some(e=>e===s.function.name):e.id===s.function.name):void 0,[e]),es=D.slice().reverse().find(e=>"user"===e.role),et=(0,s.jsxs)("div",{className:(0,t.classNames)("bg-white p-4 flex flex-col gap-4 h-full dark:bg-gray-800 ",y?"border border-gray-200 dark:border-gray-700 rounded-lg":""),style:{maxHeight:w||"80vh"},children:[e.length||N?(0,s.jsxs)("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[e.length?(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("div",{className:"text-xs font-semibold",children:(0,s.jsx)(a.Trans,{id:"hW0PT_"})}),(0,s.jsx)("div",{className:"flex items-center justify-start gap-4 flex-wrap",children:e.map(e=>(0,s.jsxs)("div",{className:"text-sm text-gray-500 inline-flex items-center justify-start gap-2",children:[(0,s.jsx)(g.default,{plugin:e}),(0,s.jsx)("span",{children:e.title})]},e.uuid))})]}):(0,s.jsx)("div",{}),N?(0,s.jsx)("div",{className:"flex items-center justify-end",children:(0,s.jsxs)("div",{className:"flex items-center justify-end gap-2 max-w-sm",children:[(0,s.jsx)(h.default,{model:P,setModel:e=>{U(e),j?.(e)},allModels:q,size:"small"}),(0,s.jsx)(m.default,{onClick:()=>{J((0,u.v4)()),I([]),V(""),F(!1),K.current?.stop(),K.current=null,H.current=E,L(E)},theme:"slate",size:"size10","data-tooltip-id":"global","data-tooltip-content":r.i18n._({id:"B3nz9K"}),children:(0,s.jsx)(x.default,{className:"w-5 h-5"})})]})}):null]}):null,(0,s.jsxs)("div",{ref:Y,className:"max-w-2xl mx-auto w-full flex-grow overflow-y-auto custom-scrollbar",children:[0===D.length?(0,s.jsx)("div",{className:"text-center text-slate-500 dark:text-slate-400 px-4 pb-4 pt-1 italic text-sm",children:T||r.i18n._({id:"lOG7Xw"})}):null,D.map((e,t)=>
15(0,s.jsx)("div",{className:"px-4 rounded-lg mb-2",children:(0,s.jsx)(n.default,{fontSize:"small",message:e,showActions:!1,showThinkingBlock:!0,onToolCallClick:Z,lookupPluginByCallParam:ee,userProfilePicURL:_,botAvatar:O})},t)),G?(0,s.jsx)("div",{className:"px-4 py-2 bg-red-100 text-red-800 rounded-lg mb-2",children:(0,s.jsx)("p",{className:"text-sm",children:G})}):null,R?(0,s.jsx)("div",{className:"px-6 my-4",children:(0,s.jsx)(l.default,{})}):null]}),(0,s.jsx)("div",{children:(0,s.jsx)(k,{ref:W,onSend:s=>{(s=>{if(R||!s)return;let t="string"==typeof s||Array.isArray(s)?{role:"user",content:s}:null;t?(X().run({model:P,pluginUUIDs:e.map(e=>e.uuid),historyMessages:[...C,...D,t],contextVariables:{chatID:M}}),I(e=>[...e,t]),$(),F(!0),V(null)):V("Invalid message format")})(s)},showRegenerate:v&&!!es,onRegenerate:()=>{if(R)return;let s=D.slice().reverse().find(e=>"user"===e.role);if(!s)return;let t=D.lastIndexOf(s),a=D.slice(0,t+1);X().run({model:P,pluginUUIDs:e.map(e=>e.uuid),historyMessages:a,contextVariables:{chatID:M}}),I(a),V(""),F(!0)},disabled:R,defaultInputText:S,onEscapeWithoutContent:A})})]});return(0,s.jsx)(i.default,{attachmentRegistry:z,children:et})}],317948)},569096,e=>{"use strict";var s=e.i(975705);e.s(["useDebouncedValue",0,function(e,t,a){let[r,l]=(0,s.useState)(a);return(0,s.useEffect)(()=>{let s=setTimeout(()=>{l(e)},t);return()=>clearTimeout(s)},[e,t]),r}])},29168,(e,s,t)=>{let{PLUGIN_VARIABLES_REGEX:a}=e.r(509792);class r extends Error{constructor(e){super(e),this.name="PluginFunctionValidationError"}}let l="^https://github.com/([^\\s\\/\\?]+)/([^\\s\\/\\?]+)((/[^\\s\\/\\?]+)*)/?(\\?[^\\s]*)?$",n=new RegExp(l),i=RegExp(`https://[^\\s]+/plugins/([^\\s?]+)\\??.*|(${l})`),d=async(e,s)=>{let t=n.test(e)?e.replace(n,"$1/$2"):e;n.lastIndex=0;let[,,,a,,r]=n.exec(e)||[],l=a.startsWith("/tree")&&!a.startsWith("/tree/main")?a.replace("/tree",""):"/main",i=new URLSearchParams(r).get("token"),d=async e=>i?fetch(`https://api.github.com/repos/${t}/contents/${e}?ref=${encodeURIComponent(l.slice(1))}&time=${Date.now()}`,{headers:{Authorization:`Bearer ${i}`}}).then(async s=>{let t=await s.json();if(!t.download_url)throw Error(`Failed to fetch ${e}`);return t.download_url}):`https://raw.githubusercontent.com/${t}${l}/${e}?time=${Date.now()}`,[o,c,u]=await Promise.all([fetch(await d("plugin.json")).then(async e=>{try{return await e.json()}catch(e){console.error("Failed to parse plugin.json from",t,e)}}),fetch(await d("README.md")).then(async e=>e.text()),fetch(await d("implementation.js")).then(e=>{if(404===e.status)return{text:()=>""};if(!e.ok)throw Error("Failed to fetch implementation file at "+t);return e}).then(e=>e.text()).catch(()=>"")]);if(!o.uuid||!o.title)throw console.error("Missing UUID"),Error("Invalid plugin");return o.pluginFunctions&&(o.pluginFunctions=await Promise.all(o.pluginFunctions.map(async e=>{if("javascript"!==e.implementationType||!e.codeFile)return e;let{codeFile:s,...t}=e,a=await fetch(await d(s));if(!a.ok)throw Error(`Failed to fetch plugin function file: ${s}`);return{...t,code:await a.text()}}))),{...o,id:o.openaiSpec?.name||o.id||o.uuid,overviewMarkdown:c,...o.implementationType?{code:u}:{},githubURL:`https://github.com/${t}${a}`,system:!1,org:null,...s}},o=(e,s)=>{let t=[];if(e)try{let s="object"==typeof e?e:JSON.parse(e);t.push(...Object.keys(s.parameters.properties))}catch(e){}if(s)try{let e="object"==typeof s?s:JSON.parse(s);t.push(...e.map(e=>e.name))}catch(e){}return t},c=e=>{let{url:s,method:t}=e;if(!s||!s.length)throw Error("URL is required.");if(!s.startsWith("http://")&&!s.startsWith("https://")&&!a.test(s))throw Error("URL must start with http:// or https://");if(!["GET","POST","PUT","DELETE","PATCH"].includes(t))throw Error("Method must be one of GET, POST, PUT, DELETE.")};s.exports={SHARED_PLUGIN_LINK_REGEX:i,GITHUB_PLUGIN_REGEX:n,fetchPluginFromGithub:d,parsedVariablesFromSpec:o,validateHTTPAction:c,PLUGIN_VARIABLES_REGEX:a,validatePluginFunction:function(e){if("javascript"===e.implementationType||"http"===e.implementationType){if(!e.openaiSpec)throw new r("OpenAI Function Spec is required.");
15if(!e.openaiSpec.name||!e.openaiSpec.name.length)throw new r('OpenAI Function Spec must have a "name" property.');if(!e.openaiSpec.description||!e.openaiSpec.description.length)throw new r('OpenAI Function Spec must have a "description" property.')}if(o(e.openaiSpec).map(e=>`{${e}}`).some(e=>!e.match(a)))throw new r("Variable names in the OpenAI Function Spec must consist of only letters and numbers, without spaces or special characters.");if("javascript"===e.implementationType&&!e.code)throw new r("Code implementation is required.");if("javascript"===e.implementationType&&!e.code.includes(e.openaiSpec.name))throw new r(`Function name: ${e.openaiSpec.name} is not defined in your code. Please check your code.`);if("http"===e.implementationType)try{c(e.httpAction)}catch(e){throw console.error("http action validation error:",e),new r("Invalid HTTP Action: "+e.message)}if("mcp"===e.implementationType&&!e.mcpDetails)throw new r("MCP server configuration is required.")},PluginFunctionValidationError:r}}]); 16 17//# debugId=06ae3b2f-6ec2-a9ab-3709-712bea645b55 18//# sourceMappingURL=20r4qy65uymlm.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.