@decocms/mesh 1.0.15 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{AlertCircle-DaEUMwle.js → AlertCircle-CDFxkn8P.js} +1 -1
- package/dist/client/assets/{ArrowLeft-CvFDkdiU.js → ArrowLeft-Ciuxq7Q-.js} +1 -1
- package/dist/client/assets/{Calendar-DBqzL4c-.js → Calendar-Ck02Gl_h.js} +1 -1
- package/dist/client/assets/{ChevronDown-g4L12M9A.js → ChevronDown-293zKGHe.js} +1 -1
- package/dist/client/assets/{Clock-C-uwthk9.js → Clock-hKESOc1Y.js} +1 -1
- package/dist/client/assets/{Copy01-CHjgpWtl.js → Copy01-Cfsho8qu.js} +1 -1
- package/dist/client/assets/{CpuChip02-DlCI7cQJ.js → CpuChip02-DMyGj-Z2.js} +1 -1
- package/dist/client/assets/{DotsVertical-CIfapH0j.js → DotsVertical-Dn7odh4O.js} +1 -1
- package/dist/client/assets/{File06-CBkqKj5m.js → File06-Cdqoedhj.js} +1 -1
- package/dist/client/assets/{GitBranch01-Ci5lqvRi.js → GitBranch01-nLLHsj1c.js} +1 -1
- package/dist/client/assets/{Inbox01-DCkU3Xgq.js → Inbox01-Cwh_U6Yy.js} +1 -1
- package/dist/client/assets/{InfoCircle-BwNsGATl.js → InfoCircle-BXqyuDnq.js} +1 -1
- package/dist/client/assets/{Key01-5nxXQgMM.js → Key01-BhexYLb5.js} +1 -1
- package/dist/client/assets/{LinkExternal01-ISpHuMJE.js → LinkExternal01-I-KzAQEJ.js} +1 -1
- package/dist/client/assets/{Loading01-r04aEG5T.js → Loading01-lzLKWums.js} +1 -1
- package/dist/client/assets/{Plus-CS_Y2Vnc.js → Plus-Bl6yi8F8.js} +1 -1
- package/dist/client/assets/SearchMd-3Wd2TwbA.js +1 -0
- package/dist/client/assets/{Terminal-DYN6gEAz.js → Terminal-DTrkBKv1.js} +1 -1
- package/dist/client/assets/{Trash01-DVxmznxT.js → Trash01-DtytfnvM.js} +1 -1
- package/dist/client/assets/{Upload01-Da0sGkRE.js → Upload01-DTjjOdhq.js} +1 -1
- package/dist/client/assets/{X-BX0rl0N7.js → X-Cp1i89ho.js} +1 -1
- package/dist/client/assets/{XClose-BUuGHVgA.js → XClose-BjXVNdsc.js} +1 -1
- package/dist/client/assets/{alert-dialog-DdP064l-.js → alert-dialog-T6AiZUB1.js} +3 -3
- package/dist/client/assets/{auth-AUS48lXs.js → auth-BYQ5JBPH.js} +1 -1
- package/dist/client/assets/{auth-catchall-DqCIX1bA.js → auth-catchall-ChAxJq9F.js} +1 -1
- package/dist/client/assets/avatar-Cca1j58d.js +1 -0
- package/dist/client/assets/badge-8HAdXiIR.js +1 -0
- package/dist/client/assets/button--R5o0wL7.js +1 -0
- package/dist/client/assets/card-DV2_nXad.js +1 -0
- package/dist/client/assets/checkbox-BVd2RslL.js +1 -0
- package/dist/client/assets/collection-detail-TIy-lzkt.js +184 -0
- package/dist/client/assets/collection-display-button-BDu-CjA3.js +1 -0
- package/dist/client/assets/{collection-header-DcpyPzrC.js → collection-header-DUMmszqZ.js} +1 -1
- package/dist/client/assets/{collection-page-DpUZNbpd.js → collection-page-CCqyH-ni.js} +1 -1
- package/dist/client/assets/collection-search-BLREvhln.js +1 -0
- package/dist/client/assets/collection-table-wrapper-CIOycu1I.js +1 -0
- package/dist/client/assets/connection-card-CdAxVoxf.js +1 -0
- package/dist/client/assets/connection-detail-N74ve95g.js +1 -0
- package/dist/client/assets/connections-eAJCThFh.js +1 -0
- package/dist/client/assets/{core-DJoPglro.js → core-9I4ovOKa.js} +1 -1
- package/dist/client/assets/{create-organization-dialog-fbCy_hNu.js → create-organization-dialog-DqGippHf.js} +1 -1
- package/dist/client/assets/dialog-DlJAicu4.js +1 -0
- package/dist/client/assets/dropdown-menu-CvIw74N_.js +1 -0
- package/dist/client/assets/{env-vars-editor-DEYac6H7.js → env-vars-editor-L1OkJ6Xo.js} +1 -1
- package/dist/client/assets/{error-boundary-CdmYlIj7.js → error-boundary-BP-NCqAa.js} +1 -1
- package/dist/client/assets/{extract-connection-data-Ty2DjF1e.js → extract-connection-data-DgR0N8lP.js} +1 -1
- package/dist/client/assets/form-B7S8d6pb.js +1 -0
- package/dist/client/assets/formatDistanceToNow-4WRkEQoq.js +1 -0
- package/dist/client/assets/gateway-detail-DYsvJWds.js +1 -0
- package/dist/client/assets/gateways-CqMlHfC3.js +1 -0
- package/dist/client/assets/home-JebOEFno.js +1 -0
- package/dist/client/assets/{index-DDiLOLYT.js → index-BCPBzRgp.js} +1 -1
- package/dist/client/assets/{index-JV0IIYp6.js → index-DOAaveYz.js} +1 -1
- package/dist/client/assets/index-DlHvrb4b.js +25 -0
- package/dist/client/assets/index-FEm5nfEy.css +1 -0
- package/dist/client/assets/index-OjgkLDRY.js +155 -0
- package/dist/client/assets/input-DkUxKlvC.js +1 -0
- package/dist/client/assets/json-BhSdWvUi.js +1 -0
- package/dist/client/assets/{json-syntax-highlighter-i1hiMNnF.js → json-syntax-highlighter-B0pbrw7c.js} +2 -2
- package/dist/client/assets/layout-BD1H2Fd4.js +1 -0
- package/dist/client/assets/{lazy-highlighter-QDCjbXst.js → lazy-highlighter-Bm3luqqx.js} +1 -1
- package/dist/client/assets/{localstorage-keys-D7pZSS7H.js → localstorage-keys-BKdNuRRM.js} +1 -1
- package/dist/client/assets/login-D-FrmPs7.js +1 -0
- package/dist/client/assets/{mcp-oauth-D7V7V-GS.js → mcp-oauth-B-4OryyC.js} +1 -1
- package/dist/client/assets/members-B2Y9n1Dt.js +3 -0
- package/dist/client/assets/monitoring-Dp4gwq3v.js +1 -0
- package/dist/client/assets/oauth-callback-q9nbBMZr.js +1 -0
- package/dist/client/assets/{page-C8KGQPlY.js → page-DZEEXJGv.js} +2 -2
- package/dist/client/assets/popover-DtFzalb2.js +1 -0
- package/dist/client/assets/prism-light-f9F39inZ.js +1 -0
- package/dist/client/assets/{resizable-B3HA_CX4.js → resizable-DvxvrPoQ.js} +48 -48
- package/dist/client/assets/resource-tabs-zQhHBAXR.js +1 -0
- package/dist/client/assets/select-BbFQz4Zb.js +1 -0
- package/dist/client/assets/settings-BNNbDOAc.js +1 -0
- package/dist/client/assets/shell-layout-bzzPOV5-.js +17 -0
- package/dist/client/assets/spinner-D3PlZpfm.js +1 -0
- package/dist/client/assets/store-CFY_7skC.js +1 -0
- package/dist/client/assets/store-app-detail-Ctq33yyn.js +1 -0
- package/dist/client/assets/switch-C7AQYM7p.js +1 -0
- package/dist/client/assets/{tools-list-BsHebq88.js → tools-list-BBjhQzX1.js} +1 -1
- package/dist/client/assets/tooltip-BNR213_s.js +1 -0
- package/dist/client/assets/{types-D4T3qWDr.js → types-B5imdZUc.js} +5 -5
- package/dist/client/assets/{use-binding-CapMpNVF.js → use-binding-BA2o2u6B.js} +6 -6
- package/dist/client/assets/use-connection-Bva8lo0T.js +2 -0
- package/dist/client/assets/{use-connection-resources-FqHsvBSA.js → use-connection-resources-D14aG9RS.js} +1 -1
- package/dist/client/assets/{use-gateway-CseaalWF.js → use-gateway-BR-Csw6g.js} +1 -1
- package/dist/client/assets/{use-list-state-7NLbXyOC.js → use-list-state-BlFIS1BS.js} +1 -1
- package/dist/client/assets/{use-mcp-M6XXMHar.js → use-mcp-DEd-0oIU.js} +1 -1
- package/dist/client/assets/{use-members-DzZB15s9.js → use-members-2m2D77cz.js} +1 -1
- package/dist/client/assets/{use-mobile-TpeNqylz.js → use-mobile--3nyeV_n.js} +1 -1
- package/dist/client/assets/{use-organization-settings-BAhAEDx8.js → use-organization-settings-CRu5FU7t.js} +1 -1
- package/dist/client/assets/{use-tool-call-CQCb5PBf.js → use-tool-call-BaqpTLjb.js} +1 -1
- package/dist/client/assets/useQuery-CJBdsmlt.js +1 -0
- package/dist/client/assets/view-mode-toggle-RcIHDc_9.js +1 -0
- package/dist/client/assets/{well-known-mcp-BPQQU1v0.js → well-known-mcp-DgDkk-rH.js} +1 -1
- package/dist/client/empty-state-error.svg +19 -0
- package/dist/client/empty-state-logs.svg +80 -0
- package/dist/client/empty-state-success-muted.svg +19 -0
- package/dist/client/empty-state-success.svg +19 -0
- package/dist/client/index.html +2 -2
- package/dist/server/cli.js +1 -1
- package/dist/server/migrate.js +45 -45
- package/dist/server/server.js +1 -1
- package/package.json +1 -1
- package/dist/client/assets/CheckCircle-CILz6OCh.js +0 -1
- package/dist/client/assets/SearchMd-1Gq7nypQ.js +0 -1
- package/dist/client/assets/avatar-bcdjVFyi.js +0 -1
- package/dist/client/assets/badge-1WraHGEG.js +0 -1
- package/dist/client/assets/button-DodNLkpL.js +0 -1
- package/dist/client/assets/card-BHz-BqEu.js +0 -1
- package/dist/client/assets/checkbox-Bj9jBMQF.js +0 -1
- package/dist/client/assets/collection-detail-QGbMDWA7.js +0 -184
- package/dist/client/assets/collection-display-button-475jHotV.js +0 -1
- package/dist/client/assets/collection-search-DVBnlN6E.js +0 -1
- package/dist/client/assets/collection-table-wrapper-DQ4F9pbh.js +0 -1
- package/dist/client/assets/connection-card-opsQBUfD.js +0 -1
- package/dist/client/assets/connection-detail-DpiL6xjK.js +0 -1
- package/dist/client/assets/connections-CeDc3J_o.js +0 -1
- package/dist/client/assets/dialog-BqvvzTa7.js +0 -1
- package/dist/client/assets/dropdown-menu-DrQKdl4f.js +0 -1
- package/dist/client/assets/form-Bus-fIfC.js +0 -1
- package/dist/client/assets/formatDistanceToNow-D46rGC8T.js +0 -1
- package/dist/client/assets/gateway-detail-fCVh3_nF.js +0 -1
- package/dist/client/assets/gateways-DQmZoxNy.js +0 -1
- package/dist/client/assets/home-heelYyW2.js +0 -1
- package/dist/client/assets/index-A52jfksK.js +0 -156
- package/dist/client/assets/index-DKrh5SL2.css +0 -1
- package/dist/client/assets/index-td_4XAxf.js +0 -25
- package/dist/client/assets/input-BXHWk19m.js +0 -1
- package/dist/client/assets/json-gPxhilNK.js +0 -1
- package/dist/client/assets/layout-dxbGsEKV.js +0 -1
- package/dist/client/assets/login-CcnR2b1q.js +0 -1
- package/dist/client/assets/members-D5QtYSzf.js +0 -3
- package/dist/client/assets/monitoring-Cp92YRPy.js +0 -1
- package/dist/client/assets/oauth-callback-1_PgXFG_.js +0 -1
- package/dist/client/assets/popover-MhzpcVkW.js +0 -1
- package/dist/client/assets/prism-light-C-ukkBST.js +0 -1
- package/dist/client/assets/resource-tabs-ru5yaRIE.js +0 -1
- package/dist/client/assets/select-Be0LRVWn.js +0 -1
- package/dist/client/assets/settings-gZFi_2QA.js +0 -1
- package/dist/client/assets/shell-layout-adVEIdhn.js +0 -17
- package/dist/client/assets/spinner-oZ2DO2-U.js +0 -1
- package/dist/client/assets/store-DzO4PTg0.js +0 -1
- package/dist/client/assets/store-app-detail-BIXt1EdE.js +0 -1
- package/dist/client/assets/switch-DsCvClV8.js +0 -1
- package/dist/client/assets/tooltip-BjhP6ibY.js +0 -1
- package/dist/client/assets/use-connection-BX5-4xHw.js +0 -2
- package/dist/client/assets/useQuery-ojqdZMTH.js +0 -1
- package/dist/client/assets/utils-DgLfrg3u.js +0 -1
- package/dist/client/assets/view-mode-toggle-DAXMt6ZW.js +0 -1
package/dist/server/server.js
CHANGED
|
@@ -252,7 +252,7 @@ data:
|
|
|
252
252
|
|
|
253
253
|
`,Q.enqueue(X.encode(G)),!0}catch{return!1}}handleUnsupportedRequest(){return new Response(JSON.stringify({jsonrpc:"2.0",error:{code:-32000,message:"Method not allowed."},id:null}),{status:405,headers:{Allow:"GET, POST, DELETE","Content-Type":"application/json"}})}async handlePostRequest(Q,X){try{let Y=Q.headers.get("accept");if(!Y?.includes("application/json")||!Y.includes("text/event-stream"))return this.createJsonErrorResponse(406,-32000,"Not Acceptable: Client must accept both application/json and text/event-stream");let J=Q.headers.get("content-type");if(!J||!J.includes("application/json"))return this.createJsonErrorResponse(415,-32000,"Unsupported Media Type: Content-Type must be application/json");let G={headers:Object.fromEntries(Q.headers.entries())},W;if(X?.parsedBody!==void 0)W=X.parsedBody;else try{W=await Q.json()}catch{return this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON")}let Z;try{if(Array.isArray(W))Z=W.map((L)=>vY.parse(L));else Z=[vY.parse(W)]}catch{return this.createJsonErrorResponse(400,-32700,"Parse error: Invalid JSON-RPC message")}let $=Z.some(ye);if($){if(this._initialized&&this.sessionId!==void 0)return this.createJsonErrorResponse(400,-32600,"Invalid Request: Server already initialized");if(Z.length>1)return this.createJsonErrorResponse(400,-32600,"Invalid Request: Only one initialization request is allowed");if(this.sessionId=this.sessionIdGenerator?.(),this._initialized=!0,this.sessionId&&this._onsessioninitialized)await Promise.resolve(this._onsessioninitialized(this.sessionId))}if(!$){let L=this.validateSession(Q);if(L)return L;let M=this.validateProtocolVersion(Q);if(M)return M}if(!Z.some(nG)){for(let L of Z)this.onmessage?.(L,{authInfo:X?.authInfo,requestInfo:G});return new Response(null,{status:202})}let H=crypto.randomUUID(),F=Z.find((L)=>ye(L)),V=F?F.params.protocolVersion:Q.headers.get("mcp-protocol-version")??$t0;if(this._enableJsonResponse)return new Promise((L)=>{this._streamMapping.set(H,{resolveJson:L,cleanup:()=>{this._streamMapping.delete(H)}});for(let M of Z)if(nG(M))this._requestToStreamMapping.set(M.id,H);for(let M of Z)this.onmessage?.(M,{authInfo:X?.authInfo,requestInfo:G})});let q=new TextEncoder,U,B=new ReadableStream({start:(L)=>{U=L},cancel:()=>{this._streamMapping.delete(H)}}),D={"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"};if(this.sessionId!==void 0)D["mcp-session-id"]=this.sessionId;for(let L of Z)if(nG(L))this._streamMapping.set(H,{controller:U,encoder:q,cleanup:()=>{this._streamMapping.delete(H);try{U.close()}catch{}}}),this._requestToStreamMapping.set(L.id,H);await this.writePrimingEvent(U,q,H,V);for(let L of Z){let M,C;if(nG(L)&&this._eventStore&&V>="2025-11-25")M=()=>{this.closeSSEStream(L.id)},C=()=>{this.closeStandaloneSSEStream()};this.onmessage?.(L,{authInfo:X?.authInfo,requestInfo:G,closeSSEStream:M,closeStandaloneSSEStream:C})}return new Response(B,{status:200,headers:D})}catch(Y){return this.onerror?.(Y),this.createJsonErrorResponse(400,-32700,"Parse error",{data:String(Y)})}}async handleDeleteRequest(Q){let X=this.validateSession(Q);if(X)return X;let Y=this.validateProtocolVersion(Q);if(Y)return Y;return await Promise.resolve(this._onsessionclosed?.(this.sessionId)),await this.close(),new Response(null,{status:200})}validateSession(Q){if(this.sessionIdGenerator===void 0)return;if(!this._initialized)return this.createJsonErrorResponse(400,-32000,"Bad Request: Server not initialized");let X=Q.headers.get("mcp-session-id");if(!X)return this.createJsonErrorResponse(400,-32000,"Bad Request: Mcp-Session-Id header is required");if(X!==this.sessionId)return this.createJsonErrorResponse(404,-32001,"Session not found");return}validateProtocolVersion(Q){let X=Q.headers.get("mcp-protocol-version");if(X!==null&&!x3.includes(X))return this.createJsonErrorResponse(400,-32000,`Bad Request: Unsupported protocol version: ${X} (supported versions: ${x3.join(", ")})`);return}async close(){this._streamMapping.forEach(({cleanup:Q})=>{Q()}),this._streamMapping.clear(),this._requestResponseMap.clear(),this.onclose?.()}closeSSEStream(Q){let X=this._requestToStreamMapping.get(Q);if(!X)return;let Y=this._streamMapping.get(X);if(Y)Y.cleanup()}closeStandaloneSSEStream(){let Q=this._streamMapping.get(this._standaloneSseStreamId);if(Q)Q.cleanup()}async send(Q,X){let Y=X?.relatedRequestId;if(O5(Q)||pz(Q))Y=Q.id;if(Y===void 0){if(O5(Q)||pz(Q))throw Error("Cannot send a response on a standalone SSE stream unless resuming a previous client request");let W;if(this._eventStore)W=await this._eventStore.storeEvent(this._standaloneSseStreamId,Q);let Z=this._streamMapping.get(this._standaloneSseStreamId);if(Z===void 0)return;if(Z.controller&&Z.encoder)this.writeSSEEvent(Z.controller,Z.encoder,Q,W);return}let J=this._requestToStreamMapping.get(Y);if(!J)throw Error(`No connection established for request ID: ${String(Y)}`);let G=this._streamMapping.get(J);if(!this._enableJsonResponse&&G?.controller&&G?.encoder){let W;if(this._eventStore)W=await this._eventStore.storeEvent(J,Q);this.writeSSEEvent(G.controller,G.encoder,Q,W)}if(O5(Q)||pz(Q)){this._requestResponseMap.set(Y,Q);let W=Array.from(this._requestToStreamMapping.entries()).filter(([$,K])=>K===J).map(([$])=>$);if(W.every(($)=>this._requestResponseMap.has($))){if(!G)throw Error(`No connection established for request ID: ${String(Y)}`);if(this._enableJsonResponse&&G.resolveJson){let $={"Content-Type":"application/json"};if(this.sessionId!==void 0)$["mcp-session-id"]=this.sessionId;let K=W.map((H)=>this._requestResponseMap.get(H));if(K.length===1)G.resolveJson(new Response(JSON.stringify(K[0]),{status:200,headers:$}));else G.resolveJson(new Response(JSON.stringify(K),{status:200,headers:$}))}else G.cleanup();for(let $ of W)this._requestResponseMap.delete($),this._requestToStreamMapping.delete($)}}}}var s_=o(()=>{_9()});var RM=(...Q)=>{return function(Y,J){let G=(W)=>{let Z=Q[W];if(!Z)return J();return Z(Y,()=>G(W+1))};return G(0)}};class QQ1{config;tools=[];callToolMiddlewares=[];constructor(Q){this.config={...Q,capabilities:Q.capabilities??{tools:{}}}}withTool(Q){return this.tools.push(Q),this}withTools(Q){return this.tools.push(...Q),this}callToolMiddleware(...Q){return this.callToolMiddlewares.push(...Q),this}build(){let Q=this.callToolMiddlewares.length>0?RM(...this.callToolMiddlewares):null,X=()=>{let Y=new n3({name:this.config.name,version:this.config.version},{capabilities:this.config.capabilities});for(let J of this.tools){let G=async(K)=>{try{let H=await J.handler(K);return{content:[{type:"text",text:JSON.stringify(H)}],structuredContent:H}}catch(H){return{content:[{type:"text",text:`Error: ${H.message}`}],isError:!0}}},W=Q?async(K)=>{let H={method:"tools/call",params:{name:J.name,arguments:K}};return await Q(H,()=>G(K))}:G,Z="shape"in J.inputSchema?J.inputSchema.shape:N.object({}).shape,$=J.outputSchema&&"shape"in J.outputSchema?J.outputSchema.shape:N.object({}).shape;Y.registerTool(J.name,{annotations:J.annotations,description:J.description??"",inputSchema:Z,outputSchema:$},W)}return Y};return{callStreamableTool:async(Y,J)=>{let G=this.tools.find((Z)=>Z.name===Y);if(!G)throw Error(`Tool ${Y} not found`);let W=await G.handler(J);if(!(W instanceof Response))throw Error(`Tool ${Y} returned a non-response`);return W},client:{listTools:async()=>{return{tools:this.tools.map((Y)=>({name:Y.name,description:Y.description??"",inputSchema:N.toJSONSchema(Y.inputSchema),outputSchema:Y.outputSchema?N.toJSONSchema(Y.outputSchema):void 0}))}},callTool:async(Y)=>{let J=this.tools.find((G)=>G.name===Y.name);if(!J)return{content:[{type:"text",text:"Tool not found"}]};try{let G=await J?.handler(Y.arguments??{});return{content:[{type:"text",text:JSON.stringify(G)}],structuredContent:G}}catch(G){return{content:[{type:"text",text:`Error: ${G.message}`}]}}}},fetch:async(Y)=>{let J=new i3({enableJsonResponse:Y.headers.get("Accept")?.includes("application/json")??!1});return await X().connect(J),await J.handleRequest(Y)}}}}function XQ1(Q){return new QQ1(Q)}var YQ1=o(()=>{o_();s_();Z1()});function L1(Q){return{...Q,execute:async(X,Y)=>{let J=Date.now();return await Y.tracer.startActiveSpan(`tool.${Q.name}`,{attributes:{"tool.name":Q.name,"organization.id":Y.organization?.id??"system","user.id":Y.auth.user?.id??Y.auth.apiKey?.userId??"anonymous"}},async(G)=>{try{Y.toolName=Q.name,Y.access.setToolName?.(Q.name);let W=await Q.handler(X,Y),Z=Date.now()-J;return Y.meter.createHistogram("tool.execution.duration",{description:"Duration of tool executions in milliseconds",unit:"ms"}).record(Z,{"tool.name":Q.name,"organization.id":Y.organization?.id??"system",status:"success"}),Y.meter.createCounter("tool.execution.count",{description:"Number of tool executions"}).add(1,{"tool.name":Q.name,status:"success"}),G.setStatus({code:N60.SpanStatusCode.OK}),W}catch(W){throw Y.meter.createCounter("tool.execution.errors",{description:"Number of tool execution errors"}).add(1,{"tool.name":Q.name,"error.type":W.constructor.name}),G.setStatus({code:N60.SpanStatusCode.ERROR,message:W.message}),G.recordException(W),W}finally{G.end()}})}}}var N60;var C6=o(()=>{N60=m6($1(),1)});function O6(Q){if(!Q.organization)throw Error("This operation requires organization scope");return Q.organization}function XY(Q){return Q.auth.user?.id??Q.auth.apiKey?.userId}function j26(Q){return!!(Q.auth.user||Q.auth.apiKey)}function _1(Q){if(!j26(Q))throw Error("Authentication required")}var t_,JQ1,GQ1,WQ1,ZQ1,$Q1,KQ1,HQ1,FQ1,VQ1;var UU=o(()=>{Z1();t_=N.record(N.string(),N.array(N.string())),JQ1=N.object({id:N.string().describe("Unique identifier for the API key"),name:N.string().describe("Human-readable name for the API key"),userId:N.string().describe("ID of the user who owns this API key"),permissions:t_.describe('Permissions granted to this API key. Format: { resource: [actions] } where resource is "self" for management tools or "conn_<UUID>" for connection-specific tools. Example: { "self": ["API_KEY_CREATE"], "conn_abc123": ["SEND_MESSAGE"] }'),expiresAt:N.union([N.string(),N.date()]).nullable().optional().describe("Expiration date of the API key"),createdAt:N.union([N.string(),N.date()]).describe("When the API key was created")}),GQ1=N.object({name:N.string().min(1).max(64).describe("Human-readable name for the API key"),permissions:t_.optional().describe('Permissions to grant. Format: { resource: [actions] }. Resource is "self" for management tools or "conn_<UUID>" for connection-specific tools. Actions are tool names (e.g., ["API_KEY_CREATE"]) or ["*"] for all. Example: { "self": ["API_KEY_CREATE", "COLLECTION_CONNECTIONS_LIST"] }. Defaults to read-only permissions.'),expiresIn:N.number().positive().optional().describe("Expiration time in seconds. If not provided, key never expires."),metadata:N.record(N.string(),N.unknown()).optional().describe("Additional metadata to store with the API key")}),WQ1=N.object({id:N.string().describe("Unique identifier for the API key"),name:N.string().describe("Human-readable name for the API key"),key:N.string().describe("The actual API key value. STORE THIS SECURELY - it will not be shown again!"),permissions:t_.describe('Permissions granted to this API key. Format: { resource: [actions] } where resource is "self" for management tools or "conn_<UUID>" for connection-specific tools'),expiresAt:N.union([N.string(),N.date()]).nullable().optional().describe("Expiration date of the API key"),createdAt:N.union([N.string(),N.date()]).describe("When the API key was created")}),ZQ1=N.object({}),$Q1=N.object({items:N.array(JQ1).describe("List of API keys (without key values)")}),KQ1=N.object({keyId:N.string().describe("ID of the API key to update"),name:N.string().min(1).max(64).optional().describe("New name for the API key"),permissions:t_.optional().describe('New permissions. Format: { resource: [actions] } where resource is "self" for management tools or "conn_<UUID>" for connection-specific tools. Actions are tool names or "*" for all. Example: { "self": ["API_KEY_CREATE"] }. Replaces existing permissions.'),metadata:N.record(N.string(),N.unknown()).optional().describe("New metadata. Replaces existing metadata.")}),HQ1=N.object({item:JQ1.describe("The updated API key (without key value)")}),FQ1=N.object({keyId:N.string().describe("ID of the API key to delete")}),VQ1=N.object({success:N.boolean().describe("Whether the deletion was successful"),keyId:N.string().describe("ID of the deleted API key")})});var O60;var qQ1=o(()=>{C6();UU();O60=L1({name:"API_KEY_CREATE",description:"Create a new API key with specified permissions. The key value is only returned once - store it securely!",inputSchema:GQ1,outputSchema:WQ1,handler:async(Q,X)=>{_1(X),await X.access.check();let Y=await X.boundAuth.apiKey.create({name:Q.name,permissions:Q.permissions,expiresIn:Q.expiresIn,metadata:{...Q.metadata,organization:X.organization}});return{id:Y.id,name:Y.name??Q.name,key:Y.key,permissions:Y.permissions??{},expiresAt:Y.expiresAt??null,createdAt:Y.createdAt}}})});var L60;var zQ1=o(()=>{C6();UU();L60=L1({name:"API_KEY_DELETE",description:"Delete an API key. This instantly revokes the key - it can no longer be used for authentication.",inputSchema:FQ1,outputSchema:VQ1,handler:async(Q,X)=>{if(_1(X),await X.access.check(),!XY(X))throw Error("User ID required to delete API key");let G=(await X.boundAuth.apiKey.list())?.find((K)=>K.id===Q.keyId);if(!G)throw Error("API key not found");let Z=G.metadata?.organization?.id,$=X.organization?.id;if(Z!==$)throw Error("Cannot delete API key from another organization");return await X.boundAuth.apiKey.delete(Q.keyId),{success:!0,keyId:Q.keyId}}})});var w60;var UQ1=o(()=>{C6();UU();w60=L1({name:"API_KEY_LIST",description:"List all API keys for the current user in the current organization. Returns metadata only - key values are never shown after creation.",inputSchema:ZQ1,outputSchema:$Q1,handler:async(Q,X)=>{_1(X),await X.access.check();let Y=await X.boundAuth.apiKey.list(),J=X.organization?.id;return{items:(Y??[]).filter((W)=>{return W.metadata?.organization?.id===J}).map((W)=>({id:W.id,name:W.name??"Unnamed Key",userId:W.userId,permissions:W.permissions??{},expiresAt:W.expiresAt??null,createdAt:W.createdAt}))}}})});var M60;var BQ1=o(()=>{C6();UU();M60=L1({name:"API_KEY_UPDATE",description:"Update an existing API key's name, permissions, or metadata. Note: Key value cannot be changed or retrieved.",inputSchema:KQ1,outputSchema:HQ1,handler:async(Q,X)=>{if(_1(X),await X.access.check(),!XY(X))throw Error("User ID required to update API key");let G=(await X.boundAuth.apiKey.list())?.find((H)=>H.id===Q.keyId);if(!G)throw Error(`API key not found: ${Q.keyId}`);let Z=G.metadata?.organization?.id,$=X.organization?.id;if(Z!==$)throw Error("Cannot update API key from another organization");let K=await X.boundAuth.apiKey.update({keyId:Q.keyId,name:Q.name,permissions:Q.permissions,metadata:{...Q.metadata,organization:X.organization}});if(!K)throw Error(`Failed to update API key: ${Q.keyId}`);return{item:{id:K.id,name:K.name??Q.name??"Unnamed Key",userId:K.userId,permissions:K.permissions??{},expiresAt:K.expiresAt??null,createdAt:K.createdAt}}}})});var DQ1=o(()=>{qQ1();zQ1();UQ1();BQ1();UU()});var I26,R26,P60;var NQ1=o(()=>{T$();Z1();C6();r_();U7();I26=N.object({data:hs0.describe("Data for the new connection (id is auto-generated if not provided)")}),R26=N.object({item:CJ.describe("The created connection entity")}),P60=L1({name:"COLLECTION_CONNECTIONS_CREATE",description:"Create a new MCP connection in the organization",inputSchema:I26,outputSchema:R26,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=XY(X);if(!J)throw Error("User ID required to create connection");let G={...Q.data,organization_id:Y.id,created_by:J},W=await zU({id:`pending-${Date.now()}`,title:G.title,connection_type:G.connection_type,connection_url:G.connection_url,connection_token:G.connection_token,connection_headers:G.connection_headers}).catch(()=>null),Z=W?.length?W:null,$=await X.storage.connections.create({...G,tools:Z});return await X.eventBus.publish(Y.id,_z.SELF(Y.id),{type:"connection.created",data:$}),{item:$}}})});function SM(Q,X){if(Q===X)return!0;if(Q==null||X==null)return Q===X;if(typeof Q!==typeof X)return!1;if(Array.isArray(Q)&&Array.isArray(X)){if(Q.length!==X.length)return!1;return Q.every((Y,J)=>SM(Y,X[J]))}if(typeof Q==="object"&&typeof X==="object"){let Y=Object.keys(Q),J=Object.keys(X);if(Y.length!==J.length)return!1;return Y.every((G)=>J.includes(G)&&SM(Q[G],X[G]))}return!1}function t26(){return(Q)=>{if(!Array.isArray(Q))return!0;let X=[];return Q.every((Y)=>{if(X.some((G)=>SM(Y,G)))return!1;return X.push(Y),!0})}}function e_(Q,X){return Q.safeParse(X).success}function z9(Q){if(typeof Q==="boolean")return Q?N.any():N.never();let X={};for(let G of qC6)G.apply(X,Q);let Y=[];if(X.string!==!1)Y.push(X.string||N.string());if(X.number!==!1)Y.push(X.number||N.number());if(X.boolean!==!1)Y.push(X.boolean||N.boolean());if(X.null!==!1)Y.push(X.null||N.null());if(X.array!==!1)Y.push(X.array||N.array(N.any()));if(X.tuple!==!1&&X.tuple!==void 0)Y.push(X.tuple);if(X.object!==!1)if(X.object)Y.push(X.object);else{let G=N.custom((W)=>{return typeof W==="object"&&W!==null&&!Array.isArray(W)},"Must be an object, not an array");Y.push(G)}if(X.file!==!1&&X.file!==void 0)Y.push(X.file);let J;if(Y.length===0)J=N.never();else if(Y.length===1)J=Y[0];else if(!Object.keys(Q).some((W)=>W!=="$schema"&&W!=="title"&&W!=="description"))J=N.any();else J=N.union(Y);for(let G of zC6)J=G.apply(J,Q);return J}var S26=class{apply(Q,X){if(!X.type)return;let Y=Array.isArray(X.type)?X.type:[X.type],J=new Set(Y);if(!J.has("string"))Q.string=!1;if(!J.has("number")&&!J.has("integer"))Q.number=!1;if(!J.has("boolean"))Q.boolean=!1;if(!J.has("null"))Q.null=!1;if(!J.has("array"))Q.array=!1;if(!J.has("object"))Q.object=!1;if(J.has("integer")&&Q.number!==!1){let G=Q.number||N.number();if(G instanceof N.ZodNumber)Q.number=G.int()}}},k26=class{apply(Q,X){if(X.const===void 0)return;let Y=X.const;if(Q.string=!1,Q.number=!1,Q.boolean=!1,Q.null=!1,Q.array=!1,Q.object=!1,typeof Y==="string")Q.string=N.literal(Y);else if(typeof Y==="number")Q.number=N.literal(Y);else if(typeof Y==="boolean")Q.boolean=N.literal(Y);else if(Y===null)Q.null=N.null();else if(Array.isArray(Y))Q.array=void 0;else if(typeof Y==="object")Q.object=void 0}},v26=class{apply(Q,X){if(!X.enum)return;if(X.enum.length===0){if(!X.type)Q.string=!1,Q.number=!1,Q.boolean=!1,Q.null=!1,Q.array=!1,Q.object=!1;return}let Y={string:X.enum.filter((J)=>typeof J==="string"),number:X.enum.filter((J)=>typeof J==="number"),boolean:X.enum.filter((J)=>typeof J==="boolean"),null:X.enum.filter((J)=>J===null),array:X.enum.filter((J)=>Array.isArray(J)),object:X.enum.filter((J)=>typeof J==="object"&&J!==null&&!Array.isArray(J))};Q.string=this.createTypeSchema(Y.string,"string"),Q.number=this.createTypeSchema(Y.number,"number"),Q.boolean=this.createTypeSchema(Y.boolean,"boolean"),Q.null=Y.null.length>0?N.null():!1,Q.array=Y.array.length>0?void 0:!1,Q.object=Y.object.length>0?void 0:!1}createTypeSchema(Q,X){if(Q.length===0)return!1;if(Q.length===1)return N.literal(Q[0]);if(X==="string")return N.enum(Q);if(X==="number"){let[Y,J,...G]=Q;return N.union([N.literal(Y),N.literal(J),...G.map((W)=>N.literal(W))])}if(X==="boolean")return N.union([N.literal(!0),N.literal(!1)]);return!1}},_26=class{apply(Q,X){let Y=X;if(Y.type==="string"&&Y.format==="binary"&&Y.contentEncoding==="binary"){let J=N.file();if(Y.minLength!==void 0)J=J.min(Y.minLength);if(Y.maxLength!==void 0)J=J.max(Y.maxLength);if(Y.contentMediaType!==void 0)J=J.mime(Y.contentMediaType);Q.file=J,Q.string=!1}}},y26=class{apply(Q,X){let Y=X;if(X.type===void 0&&(Y.minLength!==void 0||Y.maxLength!==void 0||Y.pattern!==void 0)){if(Q.string===void 0)Q.string=N.string()}}},b26=class{apply(Q,X){let Y=X;if(Y.minLength===void 0)return;if(Q.string!==!1){let J=Q.string||N.string();if(J instanceof N.ZodString)Q.string=J.refine((G)=>{return Array.from(G).length>=Y.minLength},{message:`String must be at least ${Y.minLength} characters long`})}}},f26=class{apply(Q,X){let Y=X;if(Y.maxLength===void 0)return;if(Q.string!==!1){let J=Q.string||N.string();if(J instanceof N.ZodString)Q.string=J.refine((G)=>{return Array.from(G).length<=Y.maxLength},{message:`String must be at most ${Y.maxLength} characters long`})}}},h26=class{apply(Q,X){let Y=X;if(!Y.pattern)return;if(Q.string!==!1){let J=Q.string||N.string();if(J instanceof N.ZodString){let G=new RegExp(Y.pattern);Q.string=J.regex(G)}}}},x26=class{apply(Q,X){let Y=X;if(Y.minimum===void 0)return;if(Q.number!==!1){let J=Q.number||N.number();if(J instanceof N.ZodNumber)Q.number=J.min(Y.minimum)}}},g26=class{apply(Q,X){let Y=X;if(Y.maximum===void 0)return;if(Q.number!==!1){let J=Q.number||N.number();if(J instanceof N.ZodNumber)Q.number=J.max(Y.maximum)}}},u26=class{apply(Q,X){let Y=X;if(Y.exclusiveMinimum===void 0)return;if(Q.number!==!1){let J=Q.number||N.number();if(J instanceof N.ZodNumber)if(typeof Y.exclusiveMinimum==="number")Q.number=J.gt(Y.exclusiveMinimum);else Q.number=!1}}},m26=class{apply(Q,X){let Y=X;if(Y.exclusiveMaximum===void 0)return;if(Q.number!==!1){let J=Q.number||N.number();if(J instanceof N.ZodNumber)if(typeof Y.exclusiveMaximum==="number")Q.number=J.lt(Y.exclusiveMaximum);else Q.number=!1}}},l26=class{apply(Q,X){let Y=X;if(Y.multipleOf===void 0)return;if(Q.number!==!1){let J=Q.number||N.number();if(J instanceof N.ZodNumber)Q.number=J.refine((G)=>{if(Y.multipleOf===0)return!1;let W=G/Y.multipleOf,Z=Math.round(W),$=Math.min(Math.abs(G)*Number.EPSILON*10,Math.abs(Y.multipleOf)*Number.EPSILON*10);return Math.abs(W-Z)<=$/Math.abs(Y.multipleOf)},{message:`Must be a multiple of ${Y.multipleOf}`})}}},d26=class{apply(Q,X){let Y=X;if(X.type===void 0&&(Y.minItems!==void 0||Y.maxItems!==void 0||Y.items!==void 0||Y.prefixItems!==void 0)){if(Q.array===void 0)Q.array=N.array(N.any())}}},p26=class{apply(Q,X){let Y=X;if(Y.minItems===void 0)return;if(Q.array!==!1)Q.array=(Q.array||N.array(N.any())).min(Y.minItems)}},c26=class{apply(Q,X){let Y=X;if(Y.maxItems===void 0)return;if(Q.array!==!1)Q.array=(Q.array||N.array(N.any())).max(Y.maxItems)}},n26=class{apply(Q,X){let Y=X;if(Q.array===!1)return;if(Array.isArray(Y.items))Q.array=Q.array||N.array(N.any());else if(Y.items&&typeof Y.items!=="boolean"&&!Y.prefixItems){let J=z9(Y.items),G=N.array(J);if(Q.array&&Q.array instanceof N.ZodArray){let W=Q.array._def;if(W.checks)W.checks.forEach((Z)=>{if(Z._zod&&Z._zod.def){let $=Z._zod.def;if($.check==="min_length"&&$.minimum!==void 0)G=G.min($.minimum);else if($.check==="max_length"&&$.maximum!==void 0)G=G.max($.maximum)}})}Q.array=G}else if(typeof Y.items==="boolean"&&Y.items===!1)if(!Y.prefixItems)Q.array=N.array(N.any()).max(0);else Q.array=Q.array||N.array(N.any());else if(typeof Y.items==="boolean"&&Y.items===!0)Q.array=Q.array||N.array(N.any());else if(Y.prefixItems)Q.array=Q.array||N.array(N.any())}},i26=class{apply(Q,X){if(X.type!=="array")return;let Y=X;if(!Array.isArray(Y.items))return;if(Q.array===!1)return;let J=Y.items.map((W)=>z9(W)),G;if(J.length===0)G=N.tuple([]);else G=N.tuple(J);if(Y.minItems!==void 0&&Y.minItems>J.length)G=!1;if(Y.maxItems!==void 0&&Y.maxItems<J.length)G=!1;Q.tuple=G,Q.array=!1}},a26=class{apply(Q,X){let Y=X;if(Q.object===!1)return;if(Y.properties||Y.required||Y.additionalProperties!==void 0)Q.object=Q.object||N.object({}).passthrough()}},r26=class{apply(Q,X){let Y=X;if(X.type===void 0&&(Y.maxProperties!==void 0||Y.minProperties!==void 0)){if(Q.object===void 0)Q.object=N.object({}).passthrough()}}},o26=class{apply(Q,X){let Y=X;if(Y.maxProperties===void 0)return;if(Q.object!==!1){let J=Q.object||N.object({}).passthrough();Q.object=J.refine((G)=>Object.keys(G).length<=Y.maxProperties,{message:`Object must have at most ${Y.maxProperties} properties`})}}},s26=class{apply(Q,X){let Y=X;if(Y.minProperties===void 0)return;if(Q.object!==!1){let J=Q.object||N.object({}).passthrough();Q.object=J.refine((G)=>Object.keys(G).length>=Y.minProperties,{message:`Object must have at least ${Y.minProperties} properties`})}}},e26=class{apply(Q,X){if(!X.not)return Q;let Y=z9(X.not);return Q.refine((J)=>!e_(Y,J),{message:"Value must not match the 'not' schema"})}},QC6=class{apply(Q,X){if(X.uniqueItems!==!0)return Q;return Q.refine(t26(),{message:"Array items must be unique"})}},XC6=class{apply(Q,X){if(!X.allOf||X.allOf.length===0)return Q;return X.allOf.map((J)=>z9(J)).reduce((J,G)=>N.intersection(J,G),Q)}},YC6=class{apply(Q,X){if(!X.anyOf||X.anyOf.length===0)return Q;let Y=X.anyOf.length===1?z9(X.anyOf[0]):N.union([z9(X.anyOf[0]),z9(X.anyOf[1]),...X.anyOf.slice(2).map((J)=>z9(J))]);return N.intersection(Q,Y)}},JC6=class{apply(Q,X){if(!X.oneOf||X.oneOf.length===0)return Q;let Y=X.oneOf.map((J)=>z9(J));return Q.refine((J)=>{let G=0;for(let W of Y)if(W.safeParse(J).success){if(G++,G>1)return!1}return G===1},{message:"Value must match exactly one of the oneOf schemas"})}},GC6=class{apply(Q,X){let Y=X;if(Y.prefixItems&&Array.isArray(Y.prefixItems)){let G=Y.prefixItems.map((W)=>z9(W));return Q.refine((W)=>{if(!Array.isArray(W))return!0;for(let Z=0;Z<Math.min(W.length,G.length);Z++)if(!e_(G[Z],W[Z]))return!1;if(W.length>G.length){if(typeof Y.items==="boolean"&&Y.items===!1)return!1;else if(Y.items&&typeof Y.items==="object"&&!Array.isArray(Y.items)){let Z=z9(Y.items);for(let $=G.length;$<W.length;$++)if(!e_(Z,W[$]))return!1}}return!0},{message:"Array does not match prefixItems schema"})}return Q}},WC6=class{apply(Q,X){let Y=X;if(!Y.properties&&!Y.required&&Y.additionalProperties!==!1)return Q;if(Q instanceof N.ZodObject||Q instanceof N.ZodRecord){let J={};if(Y.properties){for(let[G,W]of Object.entries(Y.properties))if(W!==void 0)J[G]=z9(W)}if(Y.required&&Array.isArray(Y.required)){let G=new Set(Y.required);for(let W of Object.keys(J))if(!G.has(W))J[W]=J[W].optional()}else for(let G of Object.keys(J))J[G]=J[G].optional();if(Y.additionalProperties===!1)return N.object(J);else return N.object(J).passthrough()}return Q.refine((J)=>{if(typeof J!=="object"||J===null||Array.isArray(J))return!0;if(Y.properties){for(let[G,W]of Object.entries(Y.properties))if(W!==void 0){if(Object.getOwnPropertyDescriptor(J,G)!==void 0){if(!z9(W).safeParse(J[G]).success)return!1}}}if(Y.required&&Array.isArray(Y.required)){for(let G of Y.required)if(Object.getOwnPropertyDescriptor(J,G)===void 0)return!1}if(Y.additionalProperties===!1&&Y.properties){let G=new Set(Object.keys(Y.properties));for(let W in J)if(!G.has(W))return!1}return!0},{message:"Object constraints validation failed"})}},ZC6=class{apply(Q,X){if(!X.enum||X.enum.length===0)return Q;let Y=X.enum.filter((J)=>Array.isArray(J)||typeof J==="object"&&J!==null);if(Y.length===0)return Q;return Q.refine((J)=>{if(typeof J!=="object"||J===null)return!0;return Y.some((G)=>SM(J,G))},{message:"Value must match one of the enum values"})}},$C6=class{apply(Q,X){if(X.const===void 0)return Q;let Y=X.const;if(typeof Y!=="object"||Y===null)return Q;return Q.refine((J)=>SM(J,Y),{message:"Value must equal the const value"})}},KC6=class{apply(Q,X){if(X.description)Q=Q.describe(X.description);return Q}},HC6=class{apply(Q,X){var Y;let J=X;if(!((Y=J.required)==null?void 0:Y.includes("__proto__"))||X.type!==void 0)return Q;return N.any().refine((G)=>this.validateRequired(G,J.required),{message:"Missing required properties"})}validateRequired(Q,X){if(typeof Q!=="object"||Q===null||Array.isArray(Q))return!0;return X.every((Y)=>Object.prototype.hasOwnProperty.call(Q,Y))}},FC6=class{apply(Q,X){var Y;let J=X;if(J.contains===void 0)return Q;let G=z9(J.contains),W=(Y=J.minContains)!=null?Y:1,Z=J.maxContains;return Q.refine(($)=>{if(!Array.isArray($))return!0;let K=0;for(let H of $)if(e_(G,H))K++;if(K<W)return!1;if(Z!==void 0&&K>Z)return!1;return!0},{message:"Array must contain required items matching the schema"})}},VC6=class{apply(Q,X){let{default:Y}=X;if(Y===void 0)return Q;if(!Q.safeParse(Y).success)return Q;return Q.default(Y)}},qC6,zC6;var OQ1=o(()=>{r6();r6();r6();r6();r6();r6();r6();r6();r6();r6();r6();r6();r6();r6();qC6=[new k26,new v26,new S26,new _26,new y26,new d26,new r26,new b26,new f26,new h26,new x26,new g26,new u26,new m26,new l26,new i26,new p26,new c26,new n26,new o26,new s26,new a26],zC6=[new HC6,new ZC6,new $C6,new XC6,new YC6,new JC6,new GC6,new WC6,new FC6,new e26,new QC6,new VC6,new KC6]});function UC6(Q){let X=globalThis.DOMException;return typeof X=="function"?new X(Q,"SyntaxError"):SyntaxError(Q)}function A60(Q){return Q instanceof Error?"errors"in Q&&Array.isArray(Q.errors)?Q.errors.map(A60).join(", "):("cause"in Q)&&Q.cause instanceof Error?`${Q}: ${A60(Q.cause)}`:Q.message:`${Q}`}function LQ1(Q){return{type:Q.type,message:Q.message,code:Q.code,defaultPrevented:Q.defaultPrevented,cancelable:Q.cancelable,timeStamp:Q.timeStamp}}function BC6(){let Q="document"in globalThis?globalThis.document:void 0;return Q&&typeof Q=="object"&&"baseURI"in Q&&typeof Q.baseURI=="string"?Q.baseURI:void 0}var T60,MQ1=(Q)=>{throw TypeError(Q)},v60=(Q,X,Y)=>X.has(Q)||MQ1("Cannot "+Y),I6=(Q,X,Y)=>(v60(Q,X,"read from private field"),Y?Y.call(Q):X.get(Q)),BQ=(Q,X,Y)=>X.has(Q)?MQ1("Cannot add the same private member more than once"):X instanceof WeakSet?X.add(Q):X.set(Q,Y),P8=(Q,X,Y,J)=>(v60(Q,X,"write to private field"),X.set(Q,Y),Y),R7=(Q,X,Y)=>(v60(Q,X,"access private method"),Y),YY,a3,BU,Qy,Xy,_M,OU,yM,c$,DU,LU,NU,kM,C5,E60,j60,C60,wQ1,I60,R60,vM,S60,k60,wU;var PQ1=o(()=>{H60();T60=class T60 extends Event{constructor(Q,X){var Y,J;super(Q),this.code=(Y=X==null?void 0:X.code)!=null?Y:void 0,this.message=(J=X==null?void 0:X.message)!=null?J:void 0}[Symbol.for("nodejs.util.inspect.custom")](Q,X,Y){return Y(LQ1(this),X)}[Symbol.for("Deno.customInspect")](Q,X){return Q(LQ1(this),X)}};wU=class wU extends EventTarget{constructor(Q,X){var Y,J;super(),BQ(this,C5),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,BQ(this,YY),BQ(this,a3),BQ(this,BU),BQ(this,Qy),BQ(this,Xy),BQ(this,_M),BQ(this,OU),BQ(this,yM,null),BQ(this,c$),BQ(this,DU),BQ(this,LU,null),BQ(this,NU,null),BQ(this,kM,null),BQ(this,j60,async(G)=>{var W;I6(this,DU).reset();let{body:Z,redirected:$,status:K,headers:H}=G;if(K===204){R7(this,C5,vM).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if($?P8(this,BU,new URL(G.url)):P8(this,BU,void 0),K!==200){R7(this,C5,vM).call(this,`Non-200 status code (${K})`,K);return}if(!(H.get("content-type")||"").startsWith("text/event-stream")){R7(this,C5,vM).call(this,'Invalid content type, expected "text/event-stream"',K);return}if(I6(this,YY)===this.CLOSED)return;P8(this,YY,this.OPEN);let F=new Event("open");if((W=I6(this,kM))==null||W.call(this,F),this.dispatchEvent(F),typeof Z!="object"||!Z||!("getReader"in Z)){R7(this,C5,vM).call(this,"Invalid response body, expected a web ReadableStream",K),this.close();return}let V=new TextDecoder,q=Z.getReader(),U=!0;do{let{done:B,value:D}=await q.read();D&&I6(this,DU).feed(V.decode(D,{stream:!B})),B&&(U=!1,I6(this,DU).reset(),R7(this,C5,S60).call(this))}while(U)}),BQ(this,C60,(G)=>{P8(this,c$,void 0),!(G.name==="AbortError"||G.type==="aborted")&&R7(this,C5,S60).call(this,A60(G))}),BQ(this,I60,(G)=>{typeof G.id=="string"&&P8(this,yM,G.id);let W=new MessageEvent(G.event||"message",{data:G.data,origin:I6(this,BU)?I6(this,BU).origin:I6(this,a3).origin,lastEventId:G.id||""});I6(this,NU)&&(!G.event||G.event==="message")&&I6(this,NU).call(this,W),this.dispatchEvent(W)}),BQ(this,R60,(G)=>{P8(this,_M,G)}),BQ(this,k60,()=>{P8(this,OU,void 0),I6(this,YY)===this.CONNECTING&&R7(this,C5,E60).call(this)});try{if(Q instanceof URL)P8(this,a3,Q);else if(typeof Q=="string")P8(this,a3,new URL(Q,BC6()));else throw Error("Invalid URL")}catch{throw UC6("An invalid or illegal string was specified")}P8(this,DU,a_({onEvent:I6(this,I60),onRetry:I6(this,R60)})),P8(this,YY,this.CONNECTING),P8(this,_M,3000),P8(this,Xy,(Y=X==null?void 0:X.fetch)!=null?Y:globalThis.fetch),P8(this,Qy,(J=X==null?void 0:X.withCredentials)!=null?J:!1),R7(this,C5,E60).call(this)}get readyState(){return I6(this,YY)}get url(){return I6(this,a3).href}get withCredentials(){return I6(this,Qy)}get onerror(){return I6(this,LU)}set onerror(Q){P8(this,LU,Q)}get onmessage(){return I6(this,NU)}set onmessage(Q){P8(this,NU,Q)}get onopen(){return I6(this,kM)}set onopen(Q){P8(this,kM,Q)}addEventListener(Q,X,Y){let J=X;super.addEventListener(Q,J,Y)}removeEventListener(Q,X,Y){let J=X;super.removeEventListener(Q,J,Y)}close(){I6(this,OU)&&clearTimeout(I6(this,OU)),I6(this,YY)!==this.CLOSED&&(I6(this,c$)&&I6(this,c$).abort(),P8(this,YY,this.CLOSED),P8(this,c$,void 0))}};YY=new WeakMap,a3=new WeakMap,BU=new WeakMap,Qy=new WeakMap,Xy=new WeakMap,_M=new WeakMap,OU=new WeakMap,yM=new WeakMap,c$=new WeakMap,DU=new WeakMap,LU=new WeakMap,NU=new WeakMap,kM=new WeakMap,C5=new WeakSet,E60=function(){P8(this,YY,this.CONNECTING),P8(this,c$,new AbortController),I6(this,Xy)(I6(this,a3),R7(this,C5,wQ1).call(this)).then(I6(this,j60)).catch(I6(this,C60))},j60=new WeakMap,C60=new WeakMap,wQ1=function(){var Q;let X={mode:"cors",redirect:"follow",headers:{Accept:"text/event-stream",...I6(this,yM)?{"Last-Event-ID":I6(this,yM)}:void 0},cache:"no-store",signal:(Q=I6(this,c$))==null?void 0:Q.signal};return"window"in globalThis&&(X.credentials=this.withCredentials?"include":"same-origin"),X},I60=new WeakMap,R60=new WeakMap,vM=function(Q,X){var Y;I6(this,YY)!==this.CLOSED&&P8(this,YY,this.CLOSED);let J=new T60("error",{code:X,message:Q});(Y=I6(this,LU))==null||Y.call(this,J),this.dispatchEvent(J)},S60=function(Q,X){var Y;if(I6(this,YY)===this.CLOSED)return;P8(this,YY,this.CONNECTING);let J=new T60("error",{code:X,message:Q});(Y=I6(this,LU))==null||Y.call(this,J),this.dispatchEvent(J),P8(this,OU,setTimeout(I6(this,k60),I6(this,_M)))},k60=new WeakMap,wU.CONNECTING=0,wU.OPEN=1,wU.CLOSED=2});class _60{constructor(Q,X){this._url=Q,this._resourceMetadataUrl=void 0,this._scope=void 0,this._eventSourceInit=X?.eventSourceInit,this._requestInit=X?.requestInit,this._authProvider=X?.authProvider,this._fetch=X?.fetch,this._fetchWithInit=b_(X?.fetch,X?.requestInit)}async _authThenStart(){if(!this._authProvider)throw new QY("No auth provider");let Q;try{Q=await C7(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})}catch(X){throw this.onerror?.(X),X}if(Q!=="AUTHORIZED")throw new QY;return await this._startOrAuth()}async _commonHeaders(){let Q={};if(this._authProvider){let Y=await this._authProvider.tokens();if(Y)Q.Authorization=`Bearer ${Y.access_token}`}if(this._protocolVersion)Q["mcp-protocol-version"]=this._protocolVersion;let X=$U(this._requestInit?.headers);return new Headers({...Q,...X})}_startOrAuth(){let Q=this?._eventSourceInit?.fetch??this._fetch??fetch;return new Promise((X,Y)=>{this._eventSource=new wU(this._url.href,{...this._eventSourceInit,fetch:async(J,G)=>{let W=await this._commonHeaders();W.set("Accept","text/event-stream");let Z=await Q(J,{...G,headers:W});if(Z.status===401&&Z.headers.has("www-authenticate")){let{resourceMetadataUrl:$,scope:K}=qU(Z);this._resourceMetadataUrl=$,this._scope=K}return Z}}),this._abortController=new AbortController,this._eventSource.onerror=(J)=>{if(J.code===401&&this._authProvider){this._authThenStart().then(X,Y);return}let G=new TQ1(J.code,J.message,J);Y(G),this.onerror?.(G)},this._eventSource.onopen=()=>{},this._eventSource.addEventListener("endpoint",(J)=>{let G=J;try{if(this._endpoint=new URL(G.data,this._url),this._endpoint.origin!==this._url.origin)throw Error(`Endpoint origin does not match connection origin: ${this._endpoint.origin}`)}catch(W){Y(W),this.onerror?.(W),this.close();return}X()}),this._eventSource.onmessage=(J)=>{let G=J,W;try{W=vY.parse(JSON.parse(G.data))}catch(Z){this.onerror?.(Z);return}this.onmessage?.(W)}})}async start(){if(this._eventSource)throw Error("SSEClientTransport already started! If using Client class, note that connect() calls start() automatically.");return await this._startOrAuth()}async finishAuth(Q){if(!this._authProvider)throw new QY("No auth provider");if(await C7(this._authProvider,{serverUrl:this._url,authorizationCode:Q,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new QY("Failed to authorize")}async close(){this._abortController?.abort(),this._eventSource?.close(),this.onclose?.()}async send(Q){if(!this._endpoint)throw Error("Not connected");try{let X=await this._commonHeaders();X.set("content-type","application/json");let Y={...this._requestInit,method:"POST",headers:X,body:JSON.stringify(Q),signal:this._abortController?.signal},J=await(this._fetch??fetch)(this._endpoint,Y);if(!J.ok){let G=await J.text().catch(()=>null);if(J.status===401&&this._authProvider){let{resourceMetadataUrl:W,scope:Z}=qU(J);if(this._resourceMetadataUrl=W,this._scope=Z,await C7(this._authProvider,{serverUrl:this._url,resourceMetadataUrl:this._resourceMetadataUrl,scope:this._scope,fetchFn:this._fetchWithInit})!=="AUTHORIZED")throw new QY;return this.send(Q)}throw Error(`Error POSTing to endpoint (HTTP ${J.status}): ${G}`)}await J.body?.cancel()}catch(X){throw this.onerror?.(X),X}}setProtocolVersion(Q){this._protocolVersion=Q}}var TQ1;var AQ1=o(()=>{PQ1();_9();Z60();TQ1=class TQ1 extends Error{constructor(Q,X,Y){super(`SSE error: ${X}`);this.code=Q,this.event=Y}}});class y60{constructor(Q){this._url=Q}start(){if(this._socket)throw Error("WebSocketClientTransport already started! If using Client class, note that connect() calls start() automatically.");return new Promise((Q,X)=>{this._socket=new WebSocket(this._url,DC6),this._socket.onerror=(Y)=>{let J="error"in Y?Y.error:Error(`WebSocket error: ${JSON.stringify(Y)}`);X(J),this.onerror?.(J)},this._socket.onopen=()=>{Q()},this._socket.onclose=()=>{this.onclose?.()},this._socket.onmessage=(Y)=>{let J;try{J=vY.parse(JSON.parse(Y.data))}catch(G){this.onerror?.(G);return}this.onmessage?.(J)}})}async close(){this._socket?.close()}send(Q){return new Promise((X,Y)=>{if(!this._socket){Y(Error("Not connected"));return}this._socket?.send(JSON.stringify(Q)),X()})}}var DC6="mcp";var EQ1=o(()=>{_9()});function NC6(Q){let X=Q;if(!X||typeof X!=="object"||!("method"in X))return null;switch(X.method){case"initialize":{let Y=X?.params?.protocolVersion;if(!Y)return null;return{type:"emit",message:{result:{protocolVersion:Y,capabilities:{tools:{}},serverInfo:{name:"deco-chat-server",version:"1.0.0"}},jsonrpc:X.jsonrpc??"2.0",id:X.id}}}case"notifications/roots/list_changed":case"notifications/initialized":case"notifications/cancelled":case"notifications/progress":return{type:"suppress"};default:return null}}var b60;var jQ1=o(()=>{CM();b60=class b60 extends I7{constructor(Q,X){super(Q,X)}send(Q,X){let Y=NC6(Q);if(Y?.type==="emit")return this.onmessage?.(Y.message),Promise.resolve();if(Y?.type==="suppress")return Promise.resolve();return super.send(Q,X)}}});var CQ1,IQ1=async(Q,X,Y)=>{let J=OC6(Q.connection,X,Y);if(!J)throw Error("Unknown MCP connection type");let G=new CQ1({name:Q?.name??"MCP Client",version:"1.0.0"});return await G.connect(J),{client:G,callStreamableTool:(W,Z)=>{if(Q.connection.type!=="HTTP")throw Error("HTTP connection required");let $=new Headers(Y);if(!$.has("Authorization"))$.set("Authorization",`Bearer ${Q.connection.token}`);for(let[F,V]of Object.entries(Q.connection.headers??{}))$.set(F,V);let K=new URL(Q.connection.url),H=K.pathname.replace(/\/+$/,"")||"/";return K.pathname=`${H}/call-tool/${encodeURIComponent(W)}`,fetch(K.href,{method:"POST",redirect:"manual",body:JSON.stringify(Z),headers:$})}}},OC6=(Q,X,Y)=>{if(Q.type==="Websocket")return new y60(new URL(Q.url));if(Q.type!=="SSE"&&Q.type!=="HTTP")return null;let G={...Q.token?{authorization:`Bearer ${Q.token}`}:{},...Y??{},..."headers"in Q?Q.headers||{}:{}};if(Q.type==="SSE"){let W={requestInit:{headers:G,signal:X}};if(Q.token)W.eventSourceInit={fetch:(Z,$)=>{return fetch(Z,{...$,headers:{...G,Accept:"text/event-stream"},signal:X})}};return new _60(new URL(Q.url),W)}return new b60(new URL(Q.url),{requestInit:{headers:G,signal:X,credentials:"include"}})};var RQ1=o(()=>{GU();AQ1();EQ1();_9();jQ1();CQ1=class CQ1 extends _J{constructor(Q,X){super(Q,X)}async listTools(Q,X){return await this.request({method:"tools/list",params:Q},ow,X)}}});function kQ1(Q){let X=(Y)=>{if("connection"in Q)return IQ1({connection:Q.connection},void 0,Y);return Q.client};return new Proxy({},{get(Y,J){if(J==="toJSON")return null;if(typeof J!=="string")throw Error("Name must be a string");if(J==="listTools")return $;async function G(K,H=J){let F=Q?.debugId?.(),V=F?{"x-trace-debug-id":F}:void 0,{client:q,callStreamableTool:U}=await X(V);if(Q?.streamable?.[String(H)])return U(String(H),K);let{structuredContent:B,isError:D,content:L}=await q.callTool({name:String(H),arguments:K});if(D){let M=L?.[0]?.text,C=typeof M==="string"?LC6(M):null,E=C?.code&&typeof Q?.getErrorByStatusCode==="function"?Q.getErrorByStatusCode(C.code,C.message,C.traceId):null;if(E)throw E;throw Error(`Tool ${String(H)} returned an error: ${JSON.stringify(B??L)}`)}return B}async function W(){let{client:K}=await X(),{tools:H}=await K.listTools();return H}async function Z(){if(!("connection"in Q))return W();let K=Q.connection,H=JSON.stringify(K);try{if(!Yy.has(H))Yy.set(H,W());return await Yy.get(H)}catch(F){console.error("Failed to list tools",F),Yy.delete(H);return}}async function $(){return(await Z()??[]).map((H)=>SQ1(H,G))}return G.asTool=async()=>{let H=(await Z()??[]).find((F)=>F.name===J);if(!H)throw Error(`Tool ${J} not found`);return SQ1(H,G)},G}})}var LC6=(Q)=>{try{return JSON.parse(Q)}catch{return Q}},Yy,SQ1=(Q,X)=>{return{...Q,id:Q.name,inputSchema:Q.inputSchema?z9(Q.inputSchema):void 0,outputSchema:Q.outputSchema?z9(Q.outputSchema):void 0,execute:(Y)=>{return X(Y.context,Q.name)}}};var vQ1=o(()=>{OQ1();RQ1();Yy=new Map});function Jy(Q){return kQ1(Q)}var Kk4;var _Q1=o(()=>{vQ1();Kk4=new Proxy({},{get(Q,X){if(X==="toJSON")return null;if(X==="forConnection")return(Y)=>Jy({connection:Y});return global[X]}})});function Gy(Q){return{isImplementedBy:(X)=>{for(let Y of Q){let J=typeof Y.name==="string"?new RegExp(`^${Y.name}$`):Y.name,G=X.find((W)=>J.test(W.name));if(!G&&Y.opt)continue;if(!G)return!1}return!0}}}var MU=(Q)=>{return{...Gy(Q),forClient:(X)=>{return Jy({client:X,streamable:Q.reduce((Y,J)=>{return Y[J.name]=J.streamable===!0,Y},{})})},forConnection:(X)=>{return Jy({connection:X,streamable:Q.reduce((Y,J)=>{return Y[J.name]=J.streamable===!0,Y},{})})}}};var bM=o(()=>{_Q1()});function hM(Q){return N.object({items:N.array(Q).describe("Array of collection items"),totalCount:N.number().int().min(0).optional().describe("Total number of matching items (if available)"),hasMore:N.boolean().optional().describe("Whether there are more items available")})}function h60(Q){return N.object({item:Q.nullable().describe("The retrieved item, or null if not found")})}function PC6(Q){return N.object({data:Q.partial().describe("Data for the new entity (id may be auto-generated)")})}function TC6(Q){return N.object({item:Q.describe("The created entity with generated id")})}function AC6(Q){return N.object({id:N.string().describe("ID of the entity to update"),data:Q.partial().describe("Partial entity data to update")})}function EC6(Q){return N.object({item:Q.describe("The updated entity")})}function g60(Q){return N.object({item:Q.describe("The deleted entity")})}function TU(Q,X,Y){let J=Q.toUpperCase(),G=Y?.readOnly??!1,W=[{name:`COLLECTION_${J}_LIST`,inputSchema:fM,outputSchema:hM(X)},{name:`COLLECTION_${J}_GET`,inputSchema:f60,outputSchema:h60(X)}];if(!G)W.push({name:`COLLECTION_${J}_CREATE`,inputSchema:PC6(X),outputSchema:TC6(X),opt:!0},{name:`COLLECTION_${J}_UPDATE`,inputSchema:AC6(X),outputSchema:EC6(X),opt:!0},{name:`COLLECTION_${J}_DELETE`,inputSchema:x60,outputSchema:g60(X),opt:!0});return W}var PU,wC6,yQ1,MC6,fM,f60,x60;var n$=o(()=>{Z1();PU=N.object({id:N.string().describe("Unique identifier for the entity"),title:N.string().describe("Human-readable title for the entity"),description:N.string().nullish().describe("Description of the entity"),created_at:N.string().datetime(),updated_at:N.string().datetime(),created_by:N.string().optional(),updated_by:N.string().optional()}),wC6=N.object({field:N.array(N.string()),operator:N.enum(["eq","gt","gte","lt","lte","in","like","contains"]),value:N.unknown()}),yQ1=N.lazy(()=>N.union([wC6,N.object({operator:N.enum(["and","or","not"]),conditions:N.array(yQ1)})])),MC6=N.object({field:N.array(N.string()),direction:N.enum(["asc","desc"]),nulls:N.enum(["first","last"]).optional()}),fM=N.object({where:yQ1.optional().describe("Filter expression"),orderBy:N.array(MC6).optional().describe("Sort expressions"),limit:N.number().int().min(1).max(1000).optional().describe("Maximum number of items to return"),offset:N.number().int().min(0).optional().describe("Number of items to skip")});f60=N.object({id:N.string().describe("ID of the entity to retrieve")});x60=N.object({id:N.string().describe("ID of the entity to delete")})});var jC6,bQ1,Nk4;var fQ1=o(()=>{Z1();n$();jC6=N.object({id:N.string(),name:N.string(),description:N.string().optional(),inputSchema:N.record(N.string(),N.unknown()),outputSchema:N.record(N.string(),N.unknown()).optional()}),bQ1=PU.extend({_meta:N.object({"io.decocms":N.object({id:N.string(),verified:N.boolean(),scopeName:N.string(),appName:N.string(),friendlyName:N.string().nullable().optional(),metadata:N.record(N.string(),N.unknown()).nullable().optional(),publishedAt:N.string().datetime().optional(),updatedAt:N.string().datetime().optional(),tools:N.array(jC6).nullable().optional().describe("Available tools exposed by this app")}).optional()}).optional(),server:N.object({$schema:N.string().optional(),_meta:N.record(N.string(),N.unknown()).optional(),name:N.string().describe("The server name (scope/app)"),title:N.string().optional().describe("User-friendly title"),description:N.string().optional().describe("Server description"),icons:N.array(N.object({src:N.string(),mimeType:N.string().optional(),sizes:N.array(N.string()).optional(),theme:N.enum(["light","dark"]).optional()})).optional(),remotes:N.array(N.object({type:N.enum(["http","stdio","sse"]),url:N.string().optional(),headers:N.array(N.unknown()).optional()})).optional(),packages:N.array(N.unknown()).optional(),repository:N.object({url:N.string(),source:N.string().optional(),subfolder:N.string().optional()}).optional(),version:N.string().optional(),websiteUrl:N.string().optional()})}),Nk4=TU("registry_app",bQ1,{readOnly:!0})});var hQ1,xQ1,gQ1,uQ1,mQ1,u60;var lQ1=o(()=>{Z1();bM();hQ1=N.object({specversion:N.literal("1.0").describe("CloudEvents specification version"),id:N.string().describe("Unique identifier for this event (UUID recommended)"),source:N.string().describe("Connection ID of the event publisher"),type:N.string().describe("Event type (e.g., 'order.created', 'user.signup')"),time:N.string().datetime().optional().describe("Timestamp of when the event occurred (ISO 8601)"),subject:N.string().optional().describe("Subject/resource identifier (e.g., order ID, user ID)"),datacontenttype:N.string().optional().default("application/json").describe("Content type of the data attribute"),dataschema:N.string().url().optional().describe("URI to the schema for the data attribute"),data:N.unknown().optional().describe("Event payload (any JSON value)")}),xQ1=N.object({events:N.array(hQ1).min(1).describe("Batch of CloudEvents to process")}),gQ1=N.object({success:N.boolean().optional().describe("Whether this event was processed successfully"),error:N.string().optional().describe("Error message for this event"),retryAfter:N.number().int().positive().optional().describe("Re-deliver this event after this many ms")}),uQ1=N.object({success:N.boolean().optional().describe("Batch success - applies to events not in results"),error:N.string().optional().describe("Batch error message - applies to events not in results"),processedCount:N.number().int().min(0).optional().describe("Number of events successfully processed"),retryAfter:N.number().int().positive().optional().describe("Batch retryAfter - applies to events not in results"),results:N.record(N.string(),gQ1).optional().describe("Per-event results keyed by event ID")}),mQ1=[{name:"ON_EVENTS",inputSchema:xQ1,outputSchema:uQ1}],u60=MU(mQ1)});var xM,gM,uM,mM,dQ1,pQ1,lM,dM,pM,cM,nM,iM,aM,rM,cQ1,CC6;var nQ1=o(()=>{Z1();bM();xM=N.object({type:N.string().min(1).max(255).describe("Event type identifier"),subject:N.string().max(255).optional().describe("Subject/resource identifier (e.g., order ID)"),data:N.unknown().optional().describe("Event payload"),deliverAt:N.string().datetime().optional().describe("Scheduled delivery time (ISO 8601). Omit for immediate delivery."),cron:N.string().max(100).optional().describe("Cron expression for recurring delivery. Use EVENT_CANCEL to stop.")}),gM=N.object({id:N.string().describe("Unique event ID"),type:N.string().describe("Event type"),source:N.string().describe("Source connection ID"),time:N.string().describe("Event timestamp")}),uM=N.object({eventType:N.string().min(1).max(255).describe("Event type to subscribe to"),publisher:N.string().optional().describe("Filter events by publisher connection ID"),filter:N.string().max(1000).optional().describe("JSONPath filter expression on event data")}),mM=N.object({subscription:N.object({id:N.string().describe("Subscription ID"),connectionId:N.string().describe("Subscriber connection ID"),eventType:N.string().describe("Event type pattern"),publisher:N.string().nullable().describe("Publisher connection filter"),filter:N.string().nullable().describe("JSONPath filter expression"),enabled:N.boolean().describe("Whether subscription is enabled"),createdAt:N.union([N.string(),N.date()]).describe("Created timestamp"),updatedAt:N.union([N.string(),N.date()]).describe("Updated timestamp")})}),dQ1=N.object({eventType:N.string().min(1).max(255).describe("Event type to subscribe to"),publisher:N.string().optional().describe("Filter events by publisher connection ID"),filter:N.string().max(1000).optional().describe("JSONPath filter expression on event data")}),pQ1=N.object({id:N.string().describe("Subscription ID"),connectionId:N.string().describe("Subscriber connection ID"),eventType:N.string().describe("Event type pattern"),publisher:N.string().nullable().describe("Publisher connection filter"),filter:N.string().nullable().describe("JSONPath filter expression"),enabled:N.boolean().describe("Whether subscription is enabled"),createdAt:N.union([N.string(),N.date()]).describe("Created timestamp"),updatedAt:N.union([N.string(),N.date()]).describe("Updated timestamp")}),lM=N.object({subscriptions:N.array(dQ1).describe("Desired subscriptions - system will create/update/delete to match")}),dM=N.object({created:N.number().int().min(0).describe("Number of subscriptions created"),updated:N.number().int().min(0).describe("Number of subscriptions with filter updated"),deleted:N.number().int().min(0).describe("Number of subscriptions removed"),unchanged:N.number().int().min(0).describe("Number of subscriptions unchanged"),subscriptions:N.array(pQ1).describe("Current subscriptions after sync")}),pM=N.object({subscriptionId:N.string().describe("Subscription ID to remove")}),cM=N.object({success:N.boolean().describe("Whether unsubscribe was successful"),subscriptionId:N.string().describe("Subscription ID that was removed")}),nM=N.object({eventId:N.string().describe("Event ID to cancel")}),iM=N.object({success:N.boolean().describe("Whether cancellation was successful"),eventId:N.string().describe("Event ID that was cancelled")}),aM=N.object({eventId:N.string().describe("Event ID to acknowledge")}),rM=N.object({success:N.boolean().describe("Whether ACK was successful"),eventId:N.string().describe("Event ID that was acknowledged")}),cQ1=[{name:"EVENT_PUBLISH",inputSchema:xM,outputSchema:gM},{name:"EVENT_SUBSCRIBE",inputSchema:uM,outputSchema:mM},{name:"EVENT_UNSUBSCRIBE",inputSchema:pM,outputSchema:cM},{name:"EVENT_CANCEL",inputSchema:nM,outputSchema:iM},{name:"EVENT_ACK",inputSchema:aM,outputSchema:rM},{name:"EVENT_SYNC_SUBSCRIPTIONS",inputSchema:lM,outputSchema:dM}],CC6=MU(cQ1)});var Wy=o(()=>{bM();fQ1();lQ1();nQ1()});var IC6,RC6,iQ1;var aQ1=o(()=>{Z1();n$();IC6=PU.extend({avatar:N.string().describe("URL or data URI to the assistant's avatar image"),system_prompt:N.string().describe("System prompt that defines the assistant's behavior"),gateway_id:N.string().describe("Gateway ID to use for this assistant"),model:N.object({id:N.string().describe("Model ID"),connectionId:N.string().describe("Connection ID that provides the model")}).describe("Selected model reference for this assistant")}),RC6=TU("assistant",IC6),iQ1=[...RC6]});var oM,S7,oQ1,SC6,sQ1,kC6,vC6,_C6,tQ1,yC6,bC6,fC6,hC6,xC6,gC6,uC6,mC6,hk4,lC6,xk4,rQ1,dC6,pC6,m60,eQ1;var l60=o(()=>{Z1();bM();n$();oM=N.lazy(()=>N.union([N.null(),N.string(),N.number(),N.boolean(),N.record(N.string(),oM),N.array(oM)])),S7=N.record(N.string(),N.record(N.string(),oM)).optional().describe("Additional provider-specific options. Outer record keyed by provider name, inner by option key"),oQ1=N.object({type:N.literal("text"),text:N.string().describe("The text content"),providerOptions:S7}),SC6=N.union([N.string(),N.instanceof(Uint8Array)]).describe("File data as base64 encoded string, URL string, or Uint8Array"),sQ1=N.object({type:N.literal("file"),filename:N.string().optional().describe("Optional filename of the file"),data:SC6,mediaType:N.string().describe("IANA media type of the file (e.g., image/png, audio/mp3)"),providerOptions:S7}),kC6=N.object({type:N.literal("reasoning"),text:N.string().describe("The reasoning text"),providerOptions:S7}),vC6=N.object({type:N.literal("tool-call"),toolCallId:N.string().describe("ID of the tool call, used to match with tool result"),toolName:N.string().describe("Name of the tool being called"),input:N.unknown().describe("Arguments of the tool call (JSON-serializable object matching tool input schema)"),providerExecuted:N.boolean().optional().describe("Whether the tool call will be executed by the provider"),providerOptions:S7}),_C6=N.union([N.object({type:N.literal("text"),value:N.string()}),N.object({type:N.literal("json"),value:oM}),N.object({type:N.literal("error-text"),value:N.string()}),N.object({type:N.literal("error-json"),value:oM}),N.object({type:N.literal("content"),value:N.array(N.union([N.object({type:N.literal("text"),text:N.string().describe("Text content")}),N.object({type:N.literal("media"),data:N.string().describe("Base-64 encoded media data"),mediaType:N.string().describe("IANA media type")})]))})]),tQ1=N.object({type:N.literal("tool-result"),toolCallId:N.string().describe("ID of the tool call that this result is associated with"),toolName:N.string().describe("Name of the tool that generated this result"),output:_C6.describe("Result of the tool call"),providerOptions:S7}),yC6=N.object({role:N.literal("system"),content:N.string().describe("System message content"),providerOptions:S7}),bC6=N.object({role:N.literal("user"),content:N.array(N.union([oQ1,sQ1])).describe("User message content parts (text or file)"),providerOptions:S7}),fC6=N.object({role:N.literal("assistant"),content:N.array(N.union([oQ1,sQ1,kC6,vC6,tQ1])).describe("Assistant message content parts (text, file, reasoning, tool-call, or tool-result)"),providerOptions:S7}),hC6=N.object({role:N.literal("tool"),content:N.array(tQ1).describe("Tool message content (tool results)"),providerOptions:S7}),xC6=N.union([yC6,bC6,fC6,hC6]),gC6=N.array(xC6).describe("A list of messages forming the prompt"),uC6=N.object({prompt:gC6.describe("A language model prompt is a standardized prompt type (array of messages with roles: system, user, assistant, tool)"),maxOutputTokens:N.number().optional().describe("Maximum number of tokens to generate"),temperature:N.number().optional().describe("Temperature setting. The range depends on the provider and model"),topP:N.number().optional().describe("Nucleus sampling parameter"),topK:N.number().optional().describe("Only sample from the top K options for each subsequent token. Used to remove long tail low probability responses"),presencePenalty:N.number().optional().describe("Presence penalty setting. It affects the likelihood of the model to repeat information that is already in the prompt"),frequencyPenalty:N.number().optional().describe("Frequency penalty setting. It affects the likelihood of the model to repeatedly use the same words or phrases"),seed:N.number().optional().describe("The seed (integer) to use for random sampling. If set and supported by the model, calls will generate deterministic results"),stopSequences:N.array(N.string()).optional().describe("Stop sequences. If set, the model will stop generating text when one of the stop sequences is generated"),responseFormat:N.union([N.object({type:N.literal("text")}),N.object({type:N.literal("json"),schema:N.any().optional().describe("JSON schema that the generated output should conform to"),name:N.string().optional().describe("Name of output that should be generated"),description:N.string().optional().describe("Description of the output that should be generated")})]).optional().describe("Response format. The output can either be text or JSON. Default is text"),tools:N.array(N.any()).optional().describe("The tools that are available for the model"),toolChoice:N.any().optional().describe("Specifies how the tool should be selected. Defaults to 'auto'"),includeRawChunks:N.boolean().optional().describe("Include raw chunks in the stream. Only applicable for streaming calls"),abortSignal:N.any().optional().describe("Abort signal for cancelling the operation"),headers:N.record(N.string(),N.union([N.string(),N.undefined()])).optional().describe("Additional HTTP headers to be sent with the request"),providerOptions:N.any().optional().describe("Additional provider-specific options")}),mC6=N.object({content:N.array(N.any()).describe("Ordered content that the model has generated (text, tool-calls, reasoning, files, sources)"),finishReason:N.enum(["stop","length","content-filter","tool-calls","error","other","unknown"]).describe("Reason why generation stopped"),usage:N.object({inputTokens:N.number().optional(),outputTokens:N.number().optional(),totalTokens:N.number().optional(),reasoningTokens:N.number().optional()}).passthrough().transform((Q)=>({inputTokens:Q.inputTokens,outputTokens:Q.outputTokens,totalTokens:Q.totalTokens,reasoningTokens:Q.reasoningTokens,...Q})).describe("Usage information for the language model call"),providerMetadata:N.any().optional().describe("Additional provider-specific metadata"),request:N.object({body:N.any().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:N.object({id:N.string().optional().describe("ID for the generated response"),timestamp:N.date().optional().describe("Timestamp for the start of the generated response"),modelId:N.string().optional().describe("The ID of the response model that was used"),headers:N.record(N.string(),N.string()).optional().describe("Response headers"),body:N.any().optional().describe("Response HTTP body")}).optional().describe("Optional response information for telemetry and debugging"),warnings:N.array(N.any()).describe("Warnings for the call, e.g. unsupported settings")}),hk4=N.object({stream:N.any().describe("ReadableStream of LanguageModelV2StreamPart"),request:N.object({body:N.any().optional().describe("Request HTTP body sent to the provider API")}).optional().describe("Optional request information for telemetry and debugging"),response:N.object({headers:N.record(N.string(),N.string()).optional().describe("Response headers")}).optional().describe("Optional response data")}),lC6=N.object({supportedUrls:N.record(N.string(),N.array(N.string())).describe("Supported URL patterns by media type for the provider")}),xk4=N.object({modelId:N.string().describe("The ID of the model"),logo:N.string().nullable(),description:N.string().nullable(),capabilities:N.array(N.string()),limits:N.object({contextWindow:N.number(),maxOutputTokens:N.number()}).nullable(),costs:N.object({input:N.number(),output:N.number()}).nullable(),provider:N.enum(["openai","anthropic","google","x-ai","deepseek","openai-compatible","openrouter"]).nullable()}),rQ1=N.object({modelId:N.string().describe("The ID of the model"),callOptions:uC6}),dC6=PU.extend({logo:N.string().nullable(),description:N.string().nullable(),capabilities:N.array(N.string()),limits:N.object({contextWindow:N.number(),maxOutputTokens:N.number()}).nullable(),costs:N.object({input:N.number(),output:N.number()}).nullable(),provider:N.enum(["openai","anthropic","google","xai","deepseek","openai-compatible","openrouter"]).nullable()}),pC6=TU("llm",dC6,{readOnly:!0}),m60=[{name:"LLM_METADATA",inputSchema:N.object({modelId:N.string().describe("The ID of the model")}),outputSchema:lC6},{name:"LLM_DO_STREAM",inputSchema:rQ1,streamable:!0},{name:"LLM_DO_GENERATE",inputSchema:rQ1,outputSchema:mC6},...pC6],eQ1=MU(m60)});function nC6(Q){let X=[],Y=0;while(Y<Q.length){let J=Q[Y];if(J==="%")X.push(".*");else if(J==="_")X.push(".");else if(/[.*+?^${}()|[\]\\]/.test(J))X.push("\\"+J);else X.push(J);Y++}return X.join("")}function i$(Q){return typeof Q==="string"||typeof Q==="number"}function Zy(Q,X){if("conditions"in X){let{operator:$,conditions:K}=X;switch($){case"and":return K.every((H)=>Zy(Q,H));case"or":return K.some((H)=>Zy(Q,H));case"not":return!K.every((H)=>Zy(Q,H));default:return!0}}let{field:Y,operator:J,value:G}=X,W=Y.join("."),Z=d60(Q,W);switch(J){case"eq":return Z===G;case"gt":return i$(Z)&&i$(G)&&Z>G;case"gte":return i$(Z)&&i$(G)&&Z>=G;case"lt":return i$(Z)&&i$(G)&&Z<G;case"lte":return i$(Z)&&i$(G)&&Z<=G;case"in":return Array.isArray(G)&&G.includes(Z);case"like":if(typeof Z!=="string"||typeof G!=="string")return!1;if(G.length>100)return!1;let $=nC6(G);return new RegExp(`^${$}$`,"i").test(Z);case"contains":if(typeof Z!=="string"||typeof G!=="string")return!1;return Z.toLowerCase().includes(G.toLowerCase());default:return!0}}function d60(Q,X){let Y=X.split("."),J=Q;for(let G of Y){if(J==null||typeof J!=="object")return;J=J[G]}return J}function iC6(Q,X){return[...Q].sort((Y,J)=>{for(let G of X){let W=G.field.join("."),Z=d60(Y,W),$=d60(J,W),K=0;if(Z==null&&$==null)continue;if(Z==null)K=G.nulls==="first"?-1:1;else if($==null)K=G.nulls==="first"?1:-1;else if(typeof Z==="string"&&typeof $==="string")K=Z.localeCompare($);else if(typeof Z==="number"&&typeof $==="number")K=Z-$;else K=String(Z).localeCompare(String($));if(K!==0)return G.direction==="desc"?-K:K}return 0})}var cC6,aC6,rC6,p60;var Q91=o(()=>{Wy();aQ1();n$();l60();Z1();C6();U7();cC6={LLM:m60,ASSISTANTS:iQ1};aC6=fM.extend({binding:N.union([N.object({}).passthrough(),N.string()]).optional()}),rC6=hM(CJ),p60=L1({name:"COLLECTION_CONNECTIONS_LIST",description:"List all connections in the organization with filtering, sorting, and pagination",inputSchema:aC6,outputSchema:rC6,handler:async(Q,X)=>{await X.access.check();let Y=O6(X),J=Q.binding?typeof Q.binding==="string"?(()=>{let q=cC6[Q.binding.toUpperCase()];if(!q)throw Error(`Unknown binding: ${Q.binding}`);return q})():Q.binding:void 0,G=J?Gy(J):void 0,W=await X.storage.connections.list(Y.id),Z=G?await Promise.all(W.map(async(q)=>{if(!q.tools||q.tools.length===0)return null;return G.isImplementedBy(q.tools.map((B)=>({name:B.name,inputSchema:B.inputSchema,outputSchema:B.outputSchema})))?q:null})).then((q)=>q.filter((U)=>U!==null)):W;if(Q.where)Z=Z.filter((q)=>Zy(q,Q.where));if(Q.orderBy&&Q.orderBy.length>0)Z=iC6(Z,Q.orderBy);let $=Z.length,K=Q.offset??0,H=Q.limit??100,F=Z.slice(K,K+H),V=K+H<$;return{items:F,totalCount:$,hasMore:V}}})});var oC6,c60;var X91=o(()=>{n$();C6();U7();oC6=h60(CJ),c60=L1({name:"COLLECTION_CONNECTIONS_GET",description:"Get connection details by ID",inputSchema:f60,outputSchema:oC6,handler:async(Q,X)=>{let Y=O6(X);await X.access.check();let J=await X.storage.connections.findById(Q.id);if(!J||J.organization_id!==Y.id)return{item:null};return{item:J}}})});var $y=(Q,X)=>{if(X===null||X===void 0)return;let Y=Q.replace(/\[(\w+)\]/g,".$1").split(".").filter(Boolean),J=X;for(let G of Y){if(J===null||J===void 0||typeof J!=="object")return;J=J[G]}return J};function Y91(Q){let X=Q.split("::");if(X.length!==2||!X[0]||!X[1])throw Error(`Invalid scope format: ${Q}. Expected format: "KEY::SCOPE"`);return X}function sC6(Q){let X=Q.split("::");if(X.length!==2||!X[0]||!X[1])return null;return X}function tC6(Q){if(typeof Q==="object"&&Q!==null&&"value"in Q){let X=Q.value;if(typeof X==="string")return X}return null}function n60(Q,X){let Y={};if(!Q||!X)return Y;for(let J of X){if(J==="*"){Y["*"]=["*"];continue}let G=sC6(J);if(!G)continue;let[W,Z]=G,$=$y(W,Q),K=tC6($);if(K){if(!Y[K])Y[K]=[];Y[K].push(Z)}}return Y}function J91(Q,X){let Y=n60(Q,X);return new Set(Object.keys(Y).filter((J)=>J!=="*"))}var i60=()=>{};async function XI6(Q,X,Y,J){for(let W of X){if(W==="*")continue;let[Z]=Y91(W),$=$y(Z,Q);if($===void 0||$===null)throw Error(`Scope references key "${Z}" but it's not present in state`)}let G=J91(Q,X);for(let W of G){if(W===D5.SELF)continue;let Z=await J.storage.connections.findById(W);if(!Z||Z.organization_id!==Y)throw Error(`Referenced connection not found: ${W}`);try{await J.access.check(W)}catch($){throw Error(`Access denied to referenced connection: ${W}. ${$.message}`)}}}var eC6,QI6,a60;var G91=o(()=>{i60();T$();Z1();C6();r_();U7();eC6=N.object({id:N.string().describe("ID of the connection to update"),data:xs0.describe("Partial connection data to update")}),QI6=N.object({item:CJ.describe("The updated connection entity")});a60=L1({name:"COLLECTION_CONNECTIONS_UPDATE",description:"Update an existing MCP connection in the organization",inputSchema:eC6,outputSchema:QI6,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let{id:J,data:G}=Q,W=await X.storage.connections.findById(J);if(!W||W.organization_id!==Y.id)throw Error("Connection not found in organization");let Z=G.configuration_state??W.configuration_state,$=G.configuration_scopes??W.configuration_scopes??[];if(G.configuration_state!==void 0||G.configuration_scopes!==void 0){if(G.configuration_state!==void 0)Z=G.configuration_state;else if(Z===null)Z={};if(G.configuration_scopes!==void 0)$=G.configuration_scopes??[];if($.length>0&&Z)await XI6(Z,$,Y.id,X)}let K=await zU({id:W.id,title:G.title??W.title,connection_type:G.connection_type??W.connection_type,connection_url:G.connection_url??W.connection_url,connection_token:G.connection_token??W.connection_token,connection_headers:G.connection_headers??W.connection_headers}).catch(()=>null),H=K?.length?K:null,F={...G,tools:H,configuration_state:Z,configuration_scopes:$},V=await X.storage.connections.update(J,F);if((G.configuration_state!==void 0||G.configuration_scopes!==void 0)&&Z&&$.length>0)try{await(await X.createMCPProxy(J)).client.callTool({name:"ON_MCP_CONFIGURATION",arguments:{state:Z,scopes:$}})}catch(q){console.error("Failed to invoke ON_MCP_CONFIGURATION callback",q)}return{item:V}}})});var r60;var W91=o(()=>{n$();C6();U7();r60=L1({name:"COLLECTION_CONNECTIONS_DELETE",description:"Delete a connection",inputSchema:x60,outputSchema:g60(CJ),handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=await X.storage.connections.findById(Q.id);if(!J)throw Error(`Connection not found: ${Q.id}`);if(J.organization_id!==Y.id)throw Error("Connection not found in organization");return await X.storage.connections.delete(Q.id),{item:J}}})});var o60;var Z91=o(()=>{Z1();C6();o60=L1({name:"CONNECTION_TEST",description:"Test connection health and latency",inputSchema:N.object({id:N.string()}),outputSchema:N.object({id:N.string(),healthy:N.boolean(),latencyMs:N.number()}),handler:async(Q,X)=>{let Y=O6(X);await X.access.check();let J=await X.storage.connections.findById(Q.id);if(!J||J.organization_id!==Y.id)throw Error("Connection not found");let G=await X.storage.connections.testConnection(Q.id);return{id:Q.id,...G}}})});var $91=o(()=>{NQ1();Q91();X91();G91();W91();Z91()});import{sql as t6}from"kysely";function K91(Q){if(Q===null||Q===void 0)return"NULL";if(typeof Q==="number")return String(Q);if(typeof Q==="boolean")return Q?"TRUE":"FALSE";if(typeof Q==="string")return`'${Q.replace(/'/g,"''")}'`;if(Q instanceof Date)return`'${Q.toISOString()}'`;return`'${JSON.stringify(Q).replace(/'/g,"''")}'`}function GI6(Q,X){let Y=Q;for(let G=X.length;G>=1;G--){let W=`$${G}`;if(Y.includes(W))Y=Y.replaceAll(W,K91(X[G-1]))}let J=[];for(let G=0;G<Y.length;G++)if(Y[G]==="?")J.push(G);for(let G=Math.min(J.length,X.length)-1;G>=0;G--){let W=J[G],Z=K91(X[G]);Y=Y.slice(0,W)+Z+Y.slice(W+1)}return Y}function H91(Q){return Q.replace(/-/g,"_")}function ZI6(Q){return`app_${H91(Q)}`}function $I6(Q){return`app_role_${H91(Q)}`}function KI6(Q){if(Q instanceof Error){let X=Q.message.toLowerCase(),Y=Q.code;return Y==="3F000"||Y==="42704"||X.includes("schema")&&X.includes("does not exist")||X.includes("role")&&X.includes("does not exist")}return!1}async function HI6(Q,X,Y){if(await t6`CREATE SCHEMA IF NOT EXISTS ${t6.id(X)}`.execute(Q),!(await t6`
|
|
254
254
|
SELECT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = ${Y}) as exists
|
|
255
|
-
`.execute(Q)).rows[0]?.exists)await t6`CREATE ROLE ${t6.id(Y)} NOLOGIN`.execute(Q);await t6`GRANT ${t6.id(Y)} TO CURRENT_USER`.execute(Q),await t6`GRANT USAGE, CREATE ON SCHEMA ${t6.id(X)} TO ${t6.id(Y)}`.execute(Q),await t6`GRANT ALL ON ALL TABLES IN SCHEMA ${t6.id(X)} TO ${t6.id(Y)}`.execute(Q),await t6`GRANT ALL ON ALL SEQUENCES IN SCHEMA ${t6.id(X)} TO ${t6.id(Y)}`.execute(Q),await t6`ALTER DEFAULT PRIVILEGES IN SCHEMA ${t6.id(X)} GRANT ALL ON TABLES TO ${t6.id(Y)}`.execute(Q),await t6`ALTER DEFAULT PRIVILEGES IN SCHEMA ${t6.id(X)} GRANT ALL ON SEQUENCES TO ${t6.id(Y)}`.execute(Q),await t6`REVOKE ALL ON SCHEMA public FROM ${t6.id(Y)}`.execute(Q)}async function FI6(Q,X,Y,J){try{return await Q.transaction().execute(async(G)=>{return await t6`SET LOCAL ROLE ${t6.id(Y)}`.execute(G),await t6`SET LOCAL search_path TO ${t6.id(X)}`.execute(G),await t6.raw(J).execute(G)})}catch(G){if(KI6(G))return await HI6(Q,X,Y),await Q.transaction().execute(async(W)=>{return await t6`SET LOCAL ROLE ${t6.id(Y)}`.execute(W),await t6`SET LOCAL search_path TO ${t6.id(X)}`.execute(W),await t6.raw(J).execute(W)});throw G}}var JI6,WI6,F91;var V91=o(()=>{Z1();C6();JI6=N.object({results:N.array(N.unknown()).optional(),success:N.boolean().optional()});WI6=N.object({sql:N.string().describe("The SQL query to run"),params:N.array(N.any()).describe("The parameters to pass to the SQL query").optional()});F91=L1({name:"DATABASES_RUN_SQL",description:"Run a SQL query against the database",inputSchema:WI6,outputSchema:N.object({result:N.array(JI6)}),handler:async(Q,X)=>{_1(X),await X.access.check();let Y=GI6(Q.sql,Q.params||[]);if(!X.connectionId)throw Error("Connection context required for database access");let J=ZI6(X.connectionId),G=$I6(X.connectionId);return{result:[{results:(await FI6(X.db,J,G,Y)).rows,success:!0}]}}})});var q91,qI6,z91;var k7=o(()=>{Z1();Wy();q91=N.object({connectionId:N.string().optional().describe("Filter subscriptions by connection ID (optional)")}),qI6=N.object({id:N.string().describe("Subscription ID"),connectionId:N.string().describe("Subscriber connection ID"),eventType:N.string().describe("Event type pattern"),publisher:N.string().nullable().describe("Publisher connection filter (null = all publishers)"),filter:N.string().nullable().describe("JSONPath filter expression"),enabled:N.boolean().describe("Whether subscription is enabled"),createdAt:N.union([N.string(),N.date()]).describe("Created timestamp"),updatedAt:N.union([N.string(),N.date()]).describe("Updated timestamp")}),z91=N.object({subscriptions:N.array(qI6).describe("List of subscriptions")})});var s60;var U91=o(()=>{C6();k7();s60=L1({name:"EVENT_PUBLISH",description:"Publish an event to the event bus. Supports immediate, scheduled (deliverAt), and recurring (cron) delivery. The source is automatically set to the caller's connection ID.",inputSchema:xM,outputSchema:gM,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=X.connectionId;if(!J)throw Error("Connection ID required to publish events. Use a connection-scoped token.");let G=await X.eventBus.publish(Y.id,J,{type:Q.type,subject:Q.subject,data:Q.data,deliverAt:Q.deliverAt,cron:Q.cron});return{id:G.id,type:G.type,source:G.source,time:G.time}}})});var t60;var B91=o(()=>{C6();k7();t60=L1({name:"EVENT_SUBSCRIBE",description:"Subscribe to events of a specific type. The subscriber is automatically set to the caller's connection.",inputSchema:uM,outputSchema:mM,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=X.connectionId;if(!J)throw Error("Connection ID required to subscribe. Use a connection-scoped token.");let G=await X.eventBus.subscribe(Y.id,{connectionId:J,eventType:Q.eventType,publisher:Q.publisher,filter:Q.filter});return{subscription:{id:G.id,connectionId:G.connectionId,eventType:G.eventType,publisher:G.publisher,filter:G.filter,enabled:G.enabled,createdAt:G.createdAt,updatedAt:G.updatedAt}}}})});var e60;var D91=o(()=>{C6();k7();e60=L1({name:"EVENT_UNSUBSCRIBE",description:"Unsubscribe from events by removing a subscription.",inputSchema:pM,outputSchema:cM,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=X.connectionId;if(!J)throw Error("Connection ID required to unsubscribe. Use a connection-scoped token.");let G=await X.eventBus.getSubscription(Y.id,Q.subscriptionId);if(!G)throw Error(`Subscription not found: ${Q.subscriptionId}`);if(G.connectionId!==J)throw Error("Cannot unsubscribe from a subscription owned by another connection");return{success:(await X.eventBus.unsubscribe(Y.id,Q.subscriptionId)).success,subscriptionId:Q.subscriptionId}}})});var Q40;var N91=o(()=>{C6();k7();Q40=L1({name:"EVENT_CANCEL",description:"Cancel a recurring event to stop future deliveries. Only the publisher can cancel their own events.",inputSchema:nM,outputSchema:iM,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=X.connectionId;if(!J)throw Error("Connection ID required to cancel events. Use a connection-scoped token.");if(!await X.eventBus.getEvent(Y.id,Q.eventId))throw Error(`Event not found: ${Q.eventId}`);if(!(await X.eventBus.cancelEvent(Y.id,Q.eventId,J)).success)throw Error("Failed to cancel event. Either the event is already completed/failed, or you are not the publisher.");return{success:!0,eventId:Q.eventId}}})});var X40;var O91=o(()=>{C6();k7();X40=L1({name:"EVENT_ACK",description:"Acknowledge delivery of an event. Call after successfully processing an event received via ON_EVENTS with retryAfter.",inputSchema:aM,outputSchema:rM,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=X.connectionId;if(!J)throw Error("Connection ID required to acknowledge events. Use a connection-scoped token.");if(!(await X.eventBus.ackEvent(Y.id,Q.eventId,J)).success)throw Error("Failed to acknowledge event. Either the event was not found, already delivered, or you are not a subscriber.");return{success:!0,eventId:Q.eventId}}})});var Y40;var L91=o(()=>{C6();k7();Y40=L1({name:"EVENT_SUBSCRIPTION_LIST",description:"List event subscriptions, optionally filtered by connection ID.",inputSchema:q91,outputSchema:z91,handler:async(Q,X)=>{_1(X);let Y=O6(X);return await X.access.check(),{subscriptions:(await X.eventBus.listSubscriptions(Y.id,Q.connectionId)).map((G)=>({id:G.id,connectionId:G.connectionId,eventType:G.eventType,publisher:G.publisher,filter:G.filter,enabled:G.enabled,createdAt:G.createdAt,updatedAt:G.updatedAt}))}}})});var J40;var w91=o(()=>{T$();C6();k7();J40=L1({name:"EVENT_SYNC_SUBSCRIPTIONS",description:"Sync subscriptions to desired state. Creates new, deletes removed, updates changed filters. Subscriptions are identified by (eventType, publisher).",inputSchema:lM,outputSchema:dM,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=X.connectionId;if(!J)throw Error("Connection ID required to sync subscriptions. Use a connection-scoped token.");let G=await X.eventBus.syncSubscriptions(Y.id,{connectionId:J,subscriptions:Q.subscriptions}),W=G.subscriptions.filter((Z)=>Z.eventType?.startsWith("cron/")&&Z.publisher===_z.SELF(Y.id));return await Promise.all(W.map(async(Z)=>{let $=Z.eventType.split("/")[1];$&&await X.eventBus.publish(Y.id,_z.SELF(Y.id),{type:Z.eventType,cron:$,data:{}})})),{created:G.created,updated:G.updated,deleted:G.deleted,unchanged:G.unchanged,subscriptions:G.subscriptions.map((Z)=>({id:Z.id,connectionId:Z.connectionId,eventType:Z.eventType,publisher:Z.publisher,filter:Z.filter,enabled:Z.enabled,createdAt:Z.createdAt,updatedAt:Z.updatedAt}))}}})});var M91=o(()=>{U91();B91();D91();N91();O91();L91();w91();k7()});var G40,W40,UI6,tG,P91,T91;var AU=o(()=>{Z1();G40=N.enum(["inclusion","exclusion"]).describe("Tool selection mode: 'inclusion' = include selected (default), 'exclusion' = exclude selected"),W40=N.enum(["passthrough","smart_tool_selection","code_execution"]).describe("Gateway tool selection strategy: 'passthrough' (default), 'smart_tool_selection', or 'code_execution'"),UI6=N.object({connection_id:N.string().describe("Connection ID"),selected_tools:N.array(N.string()).nullable().describe("Selected tool names. With 'inclusion' mode: null = all tools included. With 'exclusion' mode: null = entire connection excluded"),selected_resources:N.array(N.string()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. With 'inclusion' mode: null = all resources included."),selected_prompts:N.array(N.string()).nullable().describe("Selected prompt names. With 'inclusion' mode: null = all prompts included. With 'exclusion' mode: null = entire connection excluded.")}),tG=N.object({id:N.string().describe("Unique identifier for the gateway"),title:N.string().describe("Human-readable name for the gateway"),description:N.string().nullable().describe("Description of the gateway"),icon:N.string().nullable().optional().describe("Icon URL for the gateway"),created_at:N.string().describe("When the gateway was created"),updated_at:N.string().describe("When the gateway was last updated"),created_by:N.string().describe("User ID who created the gateway"),updated_by:N.string().optional().describe("User ID who last updated the gateway"),organization_id:N.string().describe("Organization ID this gateway belongs to"),tool_selection_strategy:W40.describe("Gateway behavior strategy (metadata for now): 'passthrough', 'smart_tool_selection', or 'code_execution'"),tool_selection_mode:G40.describe("Tool selection mode: 'inclusion' = include selected, 'exclusion' = exclude selected"),status:N.enum(["active","inactive"]).describe("Current status"),is_default:N.boolean().describe("Whether this is the default gateway for the organization"),connections:N.array(UI6).describe("Connections with their selected tools (behavior depends on tool_selection_mode)")}),P91=N.object({title:N.string().min(1).max(255).describe("Name for the gateway"),description:N.string().nullable().optional().describe("Optional description"),tool_selection_strategy:W40.optional().default("passthrough").describe("Gateway behavior strategy (defaults to 'passthrough')"),tool_selection_mode:G40.optional().default("inclusion").describe("Tool selection mode (defaults to 'inclusion')"),icon:N.string().nullable().optional().describe("Optional icon URL"),status:N.enum(["active","inactive"]).optional().default("active").describe("Initial status"),is_default:N.boolean().optional().default(!1).describe("Whether this is the default gateway for the organization"),connections:N.array(N.object({connection_id:N.string().describe("Connection ID"),selected_tools:N.array(N.string()).nullable().optional().describe("Selected tool names (null/undefined = all tools or full exclusion)"),selected_resources:N.array(N.string()).nullable().optional().describe("Selected resource URIs or patterns with * and ** wildcards (null/undefined = all resources)"),selected_prompts:N.array(N.string()).nullable().optional().describe("Selected prompt names (null/undefined = all prompts or full exclusion)")})).describe("Connections to include/exclude (can be empty for exclusion mode)")}),T91=N.object({title:N.string().min(1).max(255).optional().describe("New name"),description:N.string().nullable().optional().describe("New description (null to clear)"),tool_selection_strategy:W40.optional().describe("New gateway behavior strategy"),tool_selection_mode:G40.optional().describe("New tool selection mode"),icon:N.string().nullable().optional().describe("New icon URL (null to clear)"),status:N.enum(["active","inactive"]).optional().describe("New status"),is_default:N.boolean().optional().describe("Set as default gateway for the organization"),connections:N.array(N.object({connection_id:N.string().describe("Connection ID"),selected_tools:N.array(N.string()).nullable().optional().describe("Selected tool names (null/undefined = all tools or full exclusion)"),selected_resources:N.array(N.string()).nullable().optional().describe("Selected resource URIs or patterns with * and ** wildcards (null/undefined = all resources)"),selected_prompts:N.array(N.string()).nullable().optional().describe("Selected prompt names (null/undefined = all prompts or full exclusion)")})).optional().describe("New connections (replaces existing)")})});var BI6,DI6,Z40;var A91=o(()=>{Z1();C6();AU();BI6=N.object({data:P91.describe("Data for the new gateway")}),DI6=N.object({item:tG.describe("The created gateway entity")}),Z40=L1({name:"COLLECTION_GATEWAY_CREATE",description:"Create a new MCP gateway in the organization",inputSchema:BI6,outputSchema:DI6,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=XY(X);if(!J)throw Error("User ID required to create gateway");let G={title:Q.data.title,description:Q.data.description??null,toolSelectionStrategy:Q.data.tool_selection_strategy??"passthrough",toolSelectionMode:Q.data.tool_selection_mode??"inclusion",icon:Q.data.icon??null,status:Q.data.status,isDefault:Q.data.is_default??!1,connections:Q.data.connections.map((Z)=>({connectionId:Z.connection_id,selectedTools:Z.selected_tools??null,selectedResources:Z.selected_resources??null,selectedPrompts:Z.selected_prompts??null}))},W=await X.storage.gateways.create(Y.id,J,G);return{item:{id:W.id,title:W.title,description:W.description,icon:W.icon,organization_id:W.organizationId,tool_selection_strategy:W.toolSelectionStrategy,tool_selection_mode:W.toolSelectionMode,status:W.status,is_default:W.isDefault,connections:W.connections.map((Z)=>({connection_id:Z.connectionId,selected_tools:Z.selectedTools,selected_resources:Z.selectedResources,selected_prompts:Z.selectedPrompts})),created_at:W.createdAt,updated_at:W.updatedAt,created_by:W.createdBy,updated_by:W.updatedBy??void 0}}}})});function NI6(Q){let X=[],Y=0;while(Y<Q.length){let J=Q[Y];if(J==="%")X.push(".*");else if(J==="_")X.push(".");else if(/[.*+?^${}()|[\]\\]/.test(J))X.push("\\"+J);else X.push(J);Y++}return X.join("")}function a$(Q){return typeof Q==="string"||typeof Q==="number"}function $40(Q,X){let Y=X.split("."),J=Q;for(let G of Y){if(J==null||typeof J!=="object")return;J=J[G]}return J}function OI6(Q,X){return Q.connections.some((Y)=>Y.connection_id===X)}function Ky(Q,X){if("conditions"in X){let{operator:$,conditions:K}=X;switch($){case"and":return K.every((H)=>Ky(Q,H));case"or":return K.some((H)=>Ky(Q,H));case"not":return!K.every((H)=>Ky(Q,H));default:return!0}}let{field:Y,operator:J,value:G}=X,W=Y.join(".");if(W==="connection_id"){if(J!=="eq"||typeof G!=="string")return!1;return OI6(Q,G)}let Z=$40(Q,W);switch(J){case"eq":return Z===G;case"gt":return a$(Z)&&a$(G)&&Z>G;case"gte":return a$(Z)&&a$(G)&&Z>=G;case"lt":return a$(Z)&&a$(G)&&Z<G;case"lte":return a$(Z)&&a$(G)&&Z<=G;case"in":return Array.isArray(G)&&G.includes(Z);case"like":if(typeof Z!=="string"||typeof G!=="string")return!1;if(G.length>100)return!1;let $=NI6(G);return new RegExp(`^${$}$`,"i").test(Z);case"contains":if(typeof Z!=="string"||typeof G!=="string")return!1;return Z.toLowerCase().includes(G.toLowerCase());default:return!0}}function LI6(Q,X){return[...Q].sort((Y,J)=>{for(let G of X){let W=G.field.join("."),Z=$40(Y,W),$=$40(J,W),K=0;if(Z==null&&$==null)continue;if(Z==null)K=G.nulls==="first"?-1:1;else if($==null)K=G.nulls==="first"?1:-1;else if(typeof Z==="string"&&typeof $==="string")K=Z.localeCompare($);else if(typeof Z==="number"&&typeof $==="number")K=Z-$;else K=String(Z).localeCompare(String($));if(K!==0)return G.direction==="desc"?-K:K}return 0})}var wI6,MI6,K40;var E91=o(()=>{n$();C6();AU();wI6=fM,MI6=hM(tG),K40=L1({name:"COLLECTION_GATEWAY_LIST",description:"List all MCP gateways in the organization",inputSchema:wI6,outputSchema:MI6,handler:async(Q,X)=>{await X.access.check();let Y=O6(X),J=Q.where&&!("conditions"in Q.where)&&Q.where.field.join(".")==="connection_id"&&Q.where.operator==="eq"&&typeof Q.where.value==="string"?Q.where.value:void 0,W=(J?await X.storage.gateways.listByConnectionId(Y.id,J):await X.storage.gateways.list(Y.id)).map((V)=>({id:V.id,title:V.title,description:V.description,icon:V.icon,is_default:V.isDefault,organization_id:V.organizationId,tool_selection_strategy:V.toolSelectionStrategy,tool_selection_mode:V.toolSelectionMode,status:V.status,connections:V.connections.map((q)=>({connection_id:q.connectionId,selected_tools:q.selectedTools,selected_resources:q.selectedResources,selected_prompts:q.selectedPrompts})),created_at:V.createdAt,updated_at:V.updatedAt,created_by:V.createdBy,updated_by:V.updatedBy??void 0}));if(Q.where)W=W.filter((V)=>Ky(V,Q.where));if(Q.orderBy&&Q.orderBy.length>0)W=LI6(W,Q.orderBy);let Z=W.length,$=Q.offset??0,K=Q.limit??100,H=W.slice($,$+K),F=$+K<Z;return{items:H,totalCount:Z,hasMore:F}}})});var PI6,TI6,H40;var j91=o(()=>{Z1();C6();AU();PI6=N.object({id:N.string().describe("ID of the gateway to retrieve")}),TI6=N.object({item:tG.nullable().describe("The retrieved gateway, or null if not found")}),H40=L1({name:"COLLECTION_GATEWAY_GET",description:"Get an MCP gateway by ID",inputSchema:PI6,outputSchema:TI6,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=await X.storage.gateways.findById(Q.id);if(J&&J.organizationId!==Y.id)return{item:null};if(!J)return{item:null};return{item:{id:J.id,title:J.title,description:J.description,icon:J.icon,organization_id:J.organizationId,tool_selection_strategy:J.toolSelectionStrategy,tool_selection_mode:J.toolSelectionMode,status:J.status,is_default:J.isDefault,connections:J.connections.map((G)=>({connection_id:G.connectionId,selected_tools:G.selectedTools,selected_resources:G.selectedResources,selected_prompts:G.selectedPrompts})),created_at:J.createdAt,updated_at:J.updatedAt,created_by:J.createdBy,updated_by:J.updatedBy??void 0}}}})});var AI6,EI6,F40;var C91=o(()=>{Z1();C6();AU();AI6=N.object({id:N.string().describe("ID of the gateway to update"),data:T91.describe("Partial gateway data to update")}),EI6=N.object({item:tG.describe("The updated gateway entity")}),F40=L1({name:"COLLECTION_GATEWAY_UPDATE",description:"Update an MCP gateway",inputSchema:AI6,outputSchema:EI6,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=XY(X);if(!J)throw Error("User ID required to update gateway");let G=await X.storage.gateways.findById(Q.id);if(!G)throw Error(`Gateway not found: ${Q.id}`);if(G.organizationId!==Y.id)throw Error(`Gateway not found: ${Q.id}`);let W={};if(Q.data.title!==void 0)W.title=Q.data.title;if(Q.data.description!==void 0)W.description=Q.data.description;if(Q.data.tool_selection_strategy!==void 0)W.toolSelectionStrategy=Q.data.tool_selection_strategy;if(Q.data.tool_selection_mode!==void 0)W.toolSelectionMode=Q.data.tool_selection_mode;if(Q.data.icon!==void 0)W.icon=Q.data.icon;if(Q.data.status!==void 0)W.status=Q.data.status;if(Q.data.is_default!==void 0)W.isDefault=Q.data.is_default;if(Q.data.connections!==void 0)W.connections=Q.data.connections.map(($)=>({connectionId:$.connection_id,selectedTools:$.selected_tools??null,selectedResources:$.selected_resources??null,selectedPrompts:$.selected_prompts??null}));let Z=await X.storage.gateways.update(Q.id,J,W);return{item:{id:Z.id,title:Z.title,description:Z.description,icon:Z.icon,organization_id:Z.organizationId,tool_selection_strategy:Z.toolSelectionStrategy,tool_selection_mode:Z.toolSelectionMode,status:Z.status,is_default:Z.isDefault,connections:Z.connections.map(($)=>({connection_id:$.connectionId,selected_tools:$.selectedTools,selected_resources:$.selectedResources,selected_prompts:$.selectedPrompts})),created_at:Z.createdAt,updated_at:Z.updatedAt,created_by:Z.createdBy,updated_by:Z.updatedBy??void 0}}}})});var jI6,CI6,V40;var I91=o(()=>{Z1();C6();AU();jI6=N.object({id:N.string().describe("ID of the gateway to delete")}),CI6=N.object({item:tG.describe("The deleted gateway entity")}),V40=L1({name:"COLLECTION_GATEWAY_DELETE",description:"Delete an MCP gateway",inputSchema:jI6,outputSchema:CI6,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=await X.storage.gateways.findById(Q.id);if(!J)throw Error(`Gateway not found: ${Q.id}`);if(J.organizationId!==Y.id)throw Error(`Gateway not found: ${Q.id}`);if(J.isDefault)throw Error("Cannot delete the default gateway. Set another gateway as default first.");return await X.storage.gateways.delete(Q.id),{item:{id:J.id,title:J.title,description:J.description,icon:J.icon,organization_id:J.organizationId,tool_selection_strategy:J.toolSelectionStrategy,tool_selection_mode:J.toolSelectionMode,status:J.status,is_default:J.isDefault,connections:J.connections.map((G)=>({connection_id:G.connectionId,selected_tools:G.selectedTools,selected_resources:G.selectedResources,selected_prompts:G.selectedPrompts})),created_at:J.createdAt instanceof Date?J.createdAt.toISOString():J.createdAt,updated_at:J.updatedAt instanceof Date?J.updatedAt.toISOString():J.updatedAt,created_by:J.createdBy,updated_by:J.updatedBy??void 0}}}})});var R91=o(()=>{A91();E91();j91();C91();I91()});var RI6,q40;var S91=o(()=>{C6();Z1();RI6=N.object({id:N.string().optional().describe("Unique log identifier"),organizationId:N.string().describe("Organization ID"),connectionId:N.string().describe("Connection ID"),connectionTitle:N.string().describe("Connection display name"),toolName:N.string().describe("Name of the tool that was called"),input:N.record(N.string(),N.unknown()).describe("Redacted tool input"),output:N.record(N.string(),N.unknown()).describe("Redacted tool output"),isError:N.boolean().describe("Whether the call resulted in an error"),errorMessage:N.string().nullish().describe("Error message if applicable"),durationMs:N.number().describe("Call duration in milliseconds"),timestamp:N.string().describe("ISO 8601 timestamp of the call"),userId:N.string().nullish().describe("User who triggered the call"),requestId:N.string().describe("Unique request identifier"),userAgent:N.string().nullish().describe("Client identifier (x-mesh-client header)"),gatewayId:N.string().nullish().describe("Gateway ID if routed through a gateway")}),q40=L1({name:"MONITORING_LOGS_LIST",description:"List monitoring logs for tool calls in the organization",inputSchema:N.object({connectionId:N.string().optional().describe("Filter by connection ID"),gatewayId:N.string().optional().describe("Filter by gateway ID"),toolName:N.string().optional().describe("Filter by tool name"),isError:N.boolean().optional().describe("Filter by error status"),startDate:N.string().datetime().optional().describe("Filter by start date (ISO 8601 datetime string)"),endDate:N.string().datetime().optional().describe("Filter by end date (ISO 8601 datetime string)"),limit:N.number().default(100).describe("Maximum number of results"),offset:N.number().default(0).describe("Offset for pagination")}),outputSchema:N.object({logs:N.array(RI6).describe("Array of monitoring logs"),total:N.number().describe("Total number of logs matching filters"),offset:N.number().describe("Current offset for pagination"),limit:N.number().describe("Current limit for pagination")}),handler:async(Q,X)=>{let J={organizationId:O6(X).id,connectionId:Q.connectionId,gatewayId:Q.gatewayId,toolName:Q.toolName,isError:Q.isError,startDate:Q.startDate?new Date(Q.startDate):void 0,endDate:Q.endDate?new Date(Q.endDate):void 0,limit:Q.limit,offset:Q.offset},G=await X.storage.monitoring.query(J);return{logs:G.logs.map((W)=>({...W,timestamp:W.timestamp instanceof Date?W.timestamp.toISOString():W.timestamp})),total:G.total,offset:Q.offset,limit:Q.limit}}})});var z40;var k91=o(()=>{C6();Z1();z40=L1({name:"MONITORING_STATS",description:"Get aggregated statistics for tool call monitoring",inputSchema:N.object({startDate:N.string().datetime().optional().describe("Filter by start date (ISO 8601 datetime string)"),endDate:N.string().datetime().optional().describe("Filter by end date (ISO 8601 datetime string)")}),outputSchema:N.object({totalCalls:N.number().describe("Total number of tool calls"),errorRate:N.number().describe("Error rate as a decimal (0 to 1)"),avgDurationMs:N.number().describe("Average call duration in milliseconds"),errorRatePercent:N.string().describe("Error rate as a percentage string")}),handler:async(Q,X)=>{let J={organizationId:O6(X).id,startDate:Q.startDate?new Date(Q.startDate):void 0,endDate:Q.endDate?new Date(Q.endDate):void 0},G=await X.storage.monitoring.getStats(J);return{...G,errorRatePercent:(G.errorRate*100).toFixed(2)}}})});var v91=o(()=>{S91();k91()});var U40;var _91=o(()=>{Z1();C6();U40=L1({name:"ORGANIZATION_CREATE",description:"Create a new organization",inputSchema:N.object({slug:N.string().min(1).max(50).regex(/^[a-z0-9-]+$/,"Slug must be lowercase alphanumeric with hyphens"),name:N.string().min(1).max(255),description:N.string().optional()}),outputSchema:N.object({id:N.string(),name:N.string(),slug:N.string(),logo:N.string().nullable().optional(),metadata:N.any().optional(),createdAt:N.union([N.date(),N.string()]),members:N.array(N.any()).optional()}),handler:async(Q,X)=>{_1(X),await X.access.check();let Y=XY(X);if(!Y)throw Error("User ID required to create organization");let J=await X.boundAuth.organization.create({name:Q.name,slug:Q.slug,metadata:Q.description?{description:Q.description}:void 0,userId:Y});if(!J)throw Error("Failed to create organization");return J}})});var B40;var y91=o(()=>{Z1();C6();B40=L1({name:"ORGANIZATION_LIST",description:"List all organizations user has access to",inputSchema:N.object({userId:N.string().optional()}),outputSchema:N.object({organizations:N.array(N.object({id:N.string(),name:N.string(),slug:N.string(),logo:N.string().nullable().optional(),metadata:N.any().optional(),createdAt:N.union([N.date(),N.string()])}))}),handler:async(Q,X)=>{_1(X),await X.access.check();let Y=XY(X),J=Q.userId||Y;if(!J)throw Error("User ID required to list organizations");return{organizations:await X.boundAuth.organization.list(J)}}})});var D40;var b91=o(()=>{Z1();C6();D40=L1({name:"ORGANIZATION_GET",description:"Get organization details by slug or ID",inputSchema:N.object({}),outputSchema:N.object({id:N.string(),name:N.string(),slug:N.string(),logo:N.string().nullable().optional(),metadata:N.any().optional(),createdAt:N.union([N.date(),N.string()]),members:N.array(N.any()).optional(),invitations:N.array(N.any()).optional()}),handler:async(Q,X)=>{_1(X),await X.access.check();let Y=await X.boundAuth.organization.get();if(!Y)throw Error("No active organization found");return Y}})});var N40;var f91=o(()=>{Z1();C6();N40=L1({name:"ORGANIZATION_UPDATE",description:"Update an existing organization",inputSchema:N.object({id:N.string(),slug:N.string().min(1).max(50).regex(/^[a-z0-9-]+$/).optional(),name:N.string().min(1).max(255).optional(),description:N.string().optional()}),outputSchema:N.object({id:N.string(),name:N.string(),slug:N.string(),logo:N.string().nullable().optional(),metadata:N.any().optional(),createdAt:N.union([N.date(),N.string()])}),handler:async(Q,X)=>{_1(X),await X.access.check();let Y={};if(Q.name)Y.name=Q.name;if(Q.slug)Y.slug=Q.slug;if(Q.description)Y.metadata={description:Q.description};let J=await X.boundAuth.organization.update({organizationId:Q.id,data:Y});if(!J)throw Error("Failed to update organization");return J}})});var O40;var h91=o(()=>{Z1();C6();O40=L1({name:"ORGANIZATION_DELETE",description:"Delete an organization",inputSchema:N.object({id:N.string()}),outputSchema:N.object({success:N.boolean(),id:N.string()}),handler:async(Q,X)=>{return _1(X),await X.access.check(),await X.boundAuth.organization.delete(Q.id),{success:!0,id:Q.id}}})});var sM;var L40=o(()=>{Z1();sM=N.object({title:N.string(),url:N.string(),connectionId:N.string(),icon:N.string()})});var w40;var x91=o(()=>{Z1();C6();L40();w40=L1({name:"ORGANIZATION_SETTINGS_GET",description:"Get organization-level settings",inputSchema:N.object({}),outputSchema:N.object({organizationId:N.string(),sidebar_items:N.array(sM).nullable().optional(),createdAt:N.union([N.date(),N.string()]).optional(),updatedAt:N.union([N.date(),N.string()]).optional()}),handler:async(Q,X)=>{_1(X),await X.access.check();let Y=X.organization?.id;if(!Y)throw Error("Organization ID required (no active organization in context)");let J=await X.storage.organizationSettings.get(Y);if(!J)return{organizationId:Y};return J}})});var M40;var g91=o(()=>{Z1();C6();L40();M40=L1({name:"ORGANIZATION_SETTINGS_UPDATE",description:"Update organization-level settings",inputSchema:N.object({organizationId:N.string(),sidebar_items:N.array(sM).optional()}),outputSchema:N.object({organizationId:N.string(),sidebar_items:N.array(sM).nullable().optional(),createdAt:N.union([N.date(),N.string()]),updatedAt:N.union([N.date(),N.string()])}),handler:async(Q,X)=>{if(_1(X),await X.access.check(),X.organization&&X.organization.id!==Q.organizationId)throw Error("Cannot update settings for a different organization");return await X.storage.organizationSettings.upsert(Q.organizationId,{sidebar_items:Q.sidebar_items})}})});var P40;var u91=o(()=>{Z1();C6();P40=L1({name:"ORGANIZATION_MEMBER_ADD",description:"Add a member to an organization",inputSchema:N.object({organizationId:N.string().optional(),userId:N.string(),role:N.array(N.string())}),outputSchema:N.object({id:N.string(),organizationId:N.string(),userId:N.string(),role:N.union([N.string(),N.array(N.string())]),createdAt:N.union([N.date(),N.string()])}),handler:async(Q,X)=>{_1(X),await X.access.check();let Y=Q.organizationId||X.organization?.id;if(!Y)throw Error("Organization ID required (no active organization in context)");let J=await X.boundAuth.organization.addMember({organizationId:Y,userId:Q.userId,role:Q.role});if(!J)throw Error("Failed to add member");return J}})});var T40;var m91=o(()=>{Z1();C6();T40=L1({name:"ORGANIZATION_MEMBER_REMOVE",description:"Remove a member from an organization",inputSchema:N.object({organizationId:N.string().optional(),memberIdOrEmail:N.string()}),outputSchema:N.object({success:N.boolean(),memberIdOrEmail:N.string()}),handler:async(Q,X)=>{_1(X),await X.access.check();let Y=Q.organizationId||X.organization?.id;if(!Y)throw Error("Organization ID required (no active organization in context)");return await X.boundAuth.organization.removeMember({organizationId:Y,memberIdOrEmail:Q.memberIdOrEmail}),{success:!0,memberIdOrEmail:Q.memberIdOrEmail}}})});var A40;var l91=o(()=>{Z1();C6();A40=L1({name:"ORGANIZATION_MEMBER_LIST",description:"List all members in an organization",inputSchema:N.object({limit:N.number().optional(),offset:N.number().optional()}),outputSchema:N.object({members:N.array(N.object({id:N.string(),organizationId:N.string(),userId:N.string(),role:N.string(),createdAt:N.union([N.date(),N.string()]),user:N.object({id:N.string(),name:N.string(),email:N.string(),image:N.string().optional()}).optional()}))}),handler:async(Q,X)=>{_1(X),await X.access.check();let Y=X.organization?.id;if(!Y)throw Error("Organization ID required (no active organization in context)");let J=await X.boundAuth.organization.listMembers({organizationId:Y,limit:Q.limit,offset:Q.offset});return{members:Array.isArray(J)?J:[]}}})});var E40;var d91=o(()=>{Z1();C6();E40=L1({name:"ORGANIZATION_MEMBER_UPDATE_ROLE",description:"Update a member's role in an organization",inputSchema:N.object({organizationId:N.string().optional(),memberId:N.string(),role:N.array(N.string())}),outputSchema:N.object({id:N.string(),organizationId:N.string(),userId:N.string(),role:N.union([N.literal("admin"),N.literal("member"),N.literal("owner")]),createdAt:N.union([N.date(),N.string()]),user:N.object({email:N.string(),name:N.string(),image:N.string().optional()})}),handler:async(Q,X)=>{_1(X),await X.access.check();let Y=Q.organizationId||X.organization?.id;if(!Y)throw Error("Organization ID required (no active organization in context)");let J=await X.boundAuth.organization.updateMemberRole({organizationId:Y,memberId:Q.memberId,role:Q.role});if(!J)throw Error("Failed to update member role");return J}})});var p91=o(()=>{_91();y91();b91();f91();h91();x91();g91();u91();m91();l91();d91()});var n91={};K8(n91,{managementMCP:()=>j40,ALL_TOOLS:()=>c91});var c91,j40=(Q)=>{let X=c91.map((J)=>({name:J.name,description:J.description,inputSchema:J.inputSchema,outputSchema:J.outputSchema,handler:async(G)=>{return Q.access.setToolName(J.name),await J.execute(G,Q)}}));return XQ1({name:"mcp-mesh-management",version:"1.0.0"}).withTools(X).build()};var C40=o(()=>{YQ1();DQ1();$91();V91();M91();R91();v91();p91();c91=[U40,B40,D40,N40,O40,w40,M40,P40,T40,A40,E40,P60,p60,c60,a60,r60,o60,Z40,K40,H40,F40,V40,F91,q40,z40,O60,w60,M60,L60,s60,t60,e60,Q40,X40,Y40,J40]});var o3,u40,Ny,s3,WP;var Oy=o(()=>{o3={JS_EVAL_TYPE_GLOBAL:0,JS_EVAL_TYPE_MODULE:1,JS_EVAL_TYPE_DIRECT:2,JS_EVAL_TYPE_INDIRECT:3,JS_EVAL_TYPE_MASK:3,JS_EVAL_FLAG_STRICT:8,JS_EVAL_FLAG_STRIP:16,JS_EVAL_FLAG_COMPILE_ONLY:32,JS_EVAL_FLAG_BACKTRACE_BARRIER:64},u40={BaseObjects:1,Date:2,Eval:4,StringNormalize:8,RegExp:16,RegExpCompiler:32,JSON:64,Proxy:128,MapSet:256,TypedArrays:512,Promise:1024,BigInt:2048,BigFloat:4096,BigDecimal:8192,OperatorOverloading:16384,BignumExt:32768},Ny={Pending:0,Fulfilled:1,Rejected:2},s3={JS_GPN_STRING_MASK:1,JS_GPN_SYMBOL_MASK:2,JS_GPN_PRIVATE_MASK:4,JS_GPN_ENUM_ONLY:16,JS_GPN_SET_ENUM:32,QTS_GPN_NUMBER_MASK:64,QTS_STANDARD_COMPLIANT_NUMBER:128},WP={IsStrictlyEqual:0,IsSameValue:1,IsSameValueZero:2}});function CU(...Q){n40&&console.log("quickjs-emscripten:",...Q)}function*eX1(Q){return yield Q}function NR6(Q){return eX1(a40(Q))}function mX1(Q,X){return(...Y)=>{let J=X.call(Q,i40,...Y);return a40(J)}}function OR6(Q,X){let Y=X.call(Q,i40);return a40(Y)}function a40(Q){function X(Y){return Y.done?Y.value:Y.value instanceof Promise?Y.value.then((J)=>X(Q.next(J)),(J)=>X(Q.throw(J))):X(Q.next(Y.value))}return X(Q.next())}function m40(Q,X){let Y;try{Q.dispose()}catch(J){Y=J}if(X&&Y)throw Object.assign(X,{message:`${X.message}
|
|
255
|
+
`.execute(Q)).rows[0]?.exists)await t6`CREATE ROLE ${t6.id(Y)} NOLOGIN`.execute(Q);await t6`GRANT ${t6.id(Y)} TO CURRENT_USER`.execute(Q),await t6`GRANT USAGE, CREATE ON SCHEMA ${t6.id(X)} TO ${t6.id(Y)}`.execute(Q),await t6`GRANT ALL ON ALL TABLES IN SCHEMA ${t6.id(X)} TO ${t6.id(Y)}`.execute(Q),await t6`GRANT ALL ON ALL SEQUENCES IN SCHEMA ${t6.id(X)} TO ${t6.id(Y)}`.execute(Q),await t6`ALTER DEFAULT PRIVILEGES IN SCHEMA ${t6.id(X)} GRANT ALL ON TABLES TO ${t6.id(Y)}`.execute(Q),await t6`ALTER DEFAULT PRIVILEGES IN SCHEMA ${t6.id(X)} GRANT ALL ON SEQUENCES TO ${t6.id(Y)}`.execute(Q),await t6`REVOKE ALL ON SCHEMA public FROM ${t6.id(Y)}`.execute(Q)}async function FI6(Q,X,Y,J){try{return await Q.transaction().execute(async(G)=>{return await t6`SET LOCAL ROLE ${t6.id(Y)}`.execute(G),await t6`SET LOCAL search_path TO ${t6.id(X)}`.execute(G),await t6.raw(J).execute(G)})}catch(G){if(KI6(G))return await HI6(Q,X,Y),await Q.transaction().execute(async(W)=>{return await t6`SET LOCAL ROLE ${t6.id(Y)}`.execute(W),await t6`SET LOCAL search_path TO ${t6.id(X)}`.execute(W),await t6.raw(J).execute(W)});throw G}}var JI6,WI6,F91;var V91=o(()=>{Z1();C6();JI6=N.object({results:N.array(N.unknown()).optional(),success:N.boolean().optional()});WI6=N.object({sql:N.string().describe("The SQL query to run"),params:N.array(N.any()).describe("The parameters to pass to the SQL query").optional()});F91=L1({name:"DATABASES_RUN_SQL",description:"Run a SQL query against the database",inputSchema:WI6,outputSchema:N.object({result:N.array(JI6)}),handler:async(Q,X)=>{_1(X),await X.access.check();let Y=GI6(Q.sql,Q.params||[]);if(!X.connectionId)throw Error("Connection context required for database access");let J=ZI6(X.connectionId),G=$I6(X.connectionId);return{result:[{results:(await FI6(X.db,J,G,Y)).rows,success:!0}]}}})});var q91,qI6,z91;var k7=o(()=>{Z1();Wy();q91=N.object({connectionId:N.string().optional().describe("Filter subscriptions by connection ID (optional)")}),qI6=N.object({id:N.string().describe("Subscription ID"),connectionId:N.string().describe("Subscriber connection ID"),eventType:N.string().describe("Event type pattern"),publisher:N.string().nullable().describe("Publisher connection filter (null = all publishers)"),filter:N.string().nullable().describe("JSONPath filter expression"),enabled:N.boolean().describe("Whether subscription is enabled"),createdAt:N.union([N.string(),N.date()]).describe("Created timestamp"),updatedAt:N.union([N.string(),N.date()]).describe("Updated timestamp")}),z91=N.object({subscriptions:N.array(qI6).describe("List of subscriptions")})});var s60;var U91=o(()=>{C6();k7();s60=L1({name:"EVENT_PUBLISH",description:"Publish an event to the event bus. Supports immediate, scheduled (deliverAt), and recurring (cron) delivery. The source is automatically set to the caller's connection ID.",inputSchema:xM,outputSchema:gM,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=X.connectionId;if(!J)throw Error("Connection ID required to publish events. Use a connection-scoped token.");let G=await X.eventBus.publish(Y.id,J,{type:Q.type,subject:Q.subject,data:Q.data,deliverAt:Q.deliverAt,cron:Q.cron});return{id:G.id,type:G.type,source:G.source,time:G.time}}})});var t60;var B91=o(()=>{C6();k7();t60=L1({name:"EVENT_SUBSCRIBE",description:"Subscribe to events of a specific type. The subscriber is automatically set to the caller's connection.",inputSchema:uM,outputSchema:mM,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=X.connectionId;if(!J)throw Error("Connection ID required to subscribe. Use a connection-scoped token.");let G=await X.eventBus.subscribe(Y.id,{connectionId:J,eventType:Q.eventType,publisher:Q.publisher,filter:Q.filter});return{subscription:{id:G.id,connectionId:G.connectionId,eventType:G.eventType,publisher:G.publisher,filter:G.filter,enabled:G.enabled,createdAt:G.createdAt,updatedAt:G.updatedAt}}}})});var e60;var D91=o(()=>{C6();k7();e60=L1({name:"EVENT_UNSUBSCRIBE",description:"Unsubscribe from events by removing a subscription.",inputSchema:pM,outputSchema:cM,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=X.connectionId;if(!J)throw Error("Connection ID required to unsubscribe. Use a connection-scoped token.");let G=await X.eventBus.getSubscription(Y.id,Q.subscriptionId);if(!G)throw Error(`Subscription not found: ${Q.subscriptionId}`);if(G.connectionId!==J)throw Error("Cannot unsubscribe from a subscription owned by another connection");return{success:(await X.eventBus.unsubscribe(Y.id,Q.subscriptionId)).success,subscriptionId:Q.subscriptionId}}})});var Q40;var N91=o(()=>{C6();k7();Q40=L1({name:"EVENT_CANCEL",description:"Cancel a recurring event to stop future deliveries. Only the publisher can cancel their own events.",inputSchema:nM,outputSchema:iM,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=X.connectionId;if(!J)throw Error("Connection ID required to cancel events. Use a connection-scoped token.");if(!await X.eventBus.getEvent(Y.id,Q.eventId))throw Error(`Event not found: ${Q.eventId}`);if(!(await X.eventBus.cancelEvent(Y.id,Q.eventId,J)).success)throw Error("Failed to cancel event. Either the event is already completed/failed, or you are not the publisher.");return{success:!0,eventId:Q.eventId}}})});var X40;var O91=o(()=>{C6();k7();X40=L1({name:"EVENT_ACK",description:"Acknowledge delivery of an event. Call after successfully processing an event received via ON_EVENTS with retryAfter.",inputSchema:aM,outputSchema:rM,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=X.connectionId;if(!J)throw Error("Connection ID required to acknowledge events. Use a connection-scoped token.");if(!(await X.eventBus.ackEvent(Y.id,Q.eventId,J)).success)throw Error("Failed to acknowledge event. Either the event was not found, already delivered, or you are not a subscriber.");return{success:!0,eventId:Q.eventId}}})});var Y40;var L91=o(()=>{C6();k7();Y40=L1({name:"EVENT_SUBSCRIPTION_LIST",description:"List event subscriptions, optionally filtered by connection ID.",inputSchema:q91,outputSchema:z91,handler:async(Q,X)=>{_1(X);let Y=O6(X);return await X.access.check(),{subscriptions:(await X.eventBus.listSubscriptions(Y.id,Q.connectionId)).map((G)=>({id:G.id,connectionId:G.connectionId,eventType:G.eventType,publisher:G.publisher,filter:G.filter,enabled:G.enabled,createdAt:G.createdAt,updatedAt:G.updatedAt}))}}})});var J40;var w91=o(()=>{T$();C6();k7();J40=L1({name:"EVENT_SYNC_SUBSCRIPTIONS",description:"Sync subscriptions to desired state. Creates new, deletes removed, updates changed filters. Subscriptions are identified by (eventType, publisher).",inputSchema:lM,outputSchema:dM,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=X.connectionId;if(!J)throw Error("Connection ID required to sync subscriptions. Use a connection-scoped token.");let G=await X.eventBus.syncSubscriptions(Y.id,{connectionId:J,subscriptions:Q.subscriptions}),W=G.subscriptions.filter((Z)=>Z.eventType?.startsWith("cron/")&&Z.publisher===_z.SELF(Y.id));return await Promise.all(W.map(async(Z)=>{let $=Z.eventType.split("/")[1];$&&await X.eventBus.publish(Y.id,_z.SELF(Y.id),{type:Z.eventType,cron:$,data:{}})})),{created:G.created,updated:G.updated,deleted:G.deleted,unchanged:G.unchanged,subscriptions:G.subscriptions.map((Z)=>({id:Z.id,connectionId:Z.connectionId,eventType:Z.eventType,publisher:Z.publisher,filter:Z.filter,enabled:Z.enabled,createdAt:Z.createdAt,updatedAt:Z.updatedAt}))}}})});var M91=o(()=>{U91();B91();D91();N91();O91();L91();w91();k7()});var G40,W40,UI6,tG,P91,T91;var AU=o(()=>{Z1();G40=N.enum(["inclusion","exclusion"]).describe("Tool selection mode: 'inclusion' = include selected (default), 'exclusion' = exclude selected"),W40=N.enum(["passthrough","smart_tool_selection","code_execution"]).describe("Gateway tool selection strategy: 'passthrough' (default), 'smart_tool_selection', or 'code_execution'"),UI6=N.object({connection_id:N.string().describe("Connection ID"),selected_tools:N.array(N.string()).nullable().describe("Selected tool names. With 'inclusion' mode: null = all tools included. With 'exclusion' mode: null = entire connection excluded"),selected_resources:N.array(N.string()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. With 'inclusion' mode: null = all resources included."),selected_prompts:N.array(N.string()).nullable().describe("Selected prompt names. With 'inclusion' mode: null = all prompts included. With 'exclusion' mode: null = entire connection excluded.")}),tG=N.object({id:N.string().describe("Unique identifier for the gateway"),title:N.string().describe("Human-readable name for the gateway"),description:N.string().nullable().describe("Description of the gateway"),icon:N.string().nullable().optional().describe("Icon URL for the gateway"),created_at:N.string().describe("When the gateway was created"),updated_at:N.string().describe("When the gateway was last updated"),created_by:N.string().describe("User ID who created the gateway"),updated_by:N.string().optional().describe("User ID who last updated the gateway"),organization_id:N.string().describe("Organization ID this gateway belongs to"),tool_selection_strategy:W40.describe("Gateway behavior strategy (metadata for now): 'passthrough', 'smart_tool_selection', or 'code_execution'"),tool_selection_mode:G40.describe("Tool selection mode: 'inclusion' = include selected, 'exclusion' = exclude selected"),status:N.enum(["active","inactive"]).describe("Current status"),is_default:N.boolean().describe("Whether this is the default gateway for the organization"),connections:N.array(UI6).describe("Connections with their selected tools (behavior depends on tool_selection_mode)")}),P91=N.object({title:N.string().min(1).max(255).describe("Name for the gateway"),description:N.string().nullable().optional().describe("Optional description"),tool_selection_strategy:W40.optional().default("passthrough").describe("Gateway behavior strategy (defaults to 'passthrough')"),tool_selection_mode:G40.optional().default("inclusion").describe("Tool selection mode (defaults to 'inclusion')"),icon:N.string().nullable().optional().describe("Optional icon URL"),status:N.enum(["active","inactive"]).optional().default("active").describe("Initial status"),is_default:N.boolean().optional().default(!1).describe("Whether this is the default gateway for the organization"),connections:N.array(N.object({connection_id:N.string().describe("Connection ID"),selected_tools:N.array(N.string()).nullable().optional().describe("Selected tool names (null/undefined = all tools or full exclusion)"),selected_resources:N.array(N.string()).nullable().optional().describe("Selected resource URIs or patterns with * and ** wildcards (null/undefined = all resources)"),selected_prompts:N.array(N.string()).nullable().optional().describe("Selected prompt names (null/undefined = all prompts or full exclusion)")})).describe("Connections to include/exclude (can be empty for exclusion mode)")}),T91=N.object({title:N.string().min(1).max(255).optional().describe("New name"),description:N.string().nullable().optional().describe("New description (null to clear)"),tool_selection_strategy:W40.optional().describe("New gateway behavior strategy"),tool_selection_mode:G40.optional().describe("New tool selection mode"),icon:N.string().nullable().optional().describe("New icon URL (null to clear)"),status:N.enum(["active","inactive"]).optional().describe("New status"),is_default:N.boolean().optional().describe("Set as default gateway for the organization"),connections:N.array(N.object({connection_id:N.string().describe("Connection ID"),selected_tools:N.array(N.string()).nullable().optional().describe("Selected tool names (null/undefined = all tools or full exclusion)"),selected_resources:N.array(N.string()).nullable().optional().describe("Selected resource URIs or patterns with * and ** wildcards (null/undefined = all resources)"),selected_prompts:N.array(N.string()).nullable().optional().describe("Selected prompt names (null/undefined = all prompts or full exclusion)")})).optional().describe("New connections (replaces existing)")})});var BI6,DI6,Z40;var A91=o(()=>{Z1();C6();AU();BI6=N.object({data:P91.describe("Data for the new gateway")}),DI6=N.object({item:tG.describe("The created gateway entity")}),Z40=L1({name:"COLLECTION_GATEWAY_CREATE",description:"Create a new MCP gateway in the organization",inputSchema:BI6,outputSchema:DI6,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=XY(X);if(!J)throw Error("User ID required to create gateway");let G={title:Q.data.title,description:Q.data.description??null,toolSelectionStrategy:Q.data.tool_selection_strategy??"passthrough",toolSelectionMode:Q.data.tool_selection_mode??"inclusion",icon:Q.data.icon??null,status:Q.data.status,isDefault:Q.data.is_default??!1,connections:Q.data.connections.map((Z)=>({connectionId:Z.connection_id,selectedTools:Z.selected_tools??null,selectedResources:Z.selected_resources??null,selectedPrompts:Z.selected_prompts??null}))},W=await X.storage.gateways.create(Y.id,J,G);return{item:{id:W.id,title:W.title,description:W.description,icon:W.icon,organization_id:W.organizationId,tool_selection_strategy:W.toolSelectionStrategy,tool_selection_mode:W.toolSelectionMode,status:W.status,is_default:W.isDefault,connections:W.connections.map((Z)=>({connection_id:Z.connectionId,selected_tools:Z.selectedTools,selected_resources:Z.selectedResources,selected_prompts:Z.selectedPrompts})),created_at:W.createdAt,updated_at:W.updatedAt,created_by:W.createdBy,updated_by:W.updatedBy??void 0}}}})});function NI6(Q){let X=[],Y=0;while(Y<Q.length){let J=Q[Y];if(J==="%")X.push(".*");else if(J==="_")X.push(".");else if(/[.*+?^${}()|[\]\\]/.test(J))X.push("\\"+J);else X.push(J);Y++}return X.join("")}function a$(Q){return typeof Q==="string"||typeof Q==="number"}function $40(Q,X){let Y=X.split("."),J=Q;for(let G of Y){if(J==null||typeof J!=="object")return;J=J[G]}return J}function OI6(Q,X){return Q.connections.some((Y)=>Y.connection_id===X)}function Ky(Q,X){if("conditions"in X){let{operator:$,conditions:K}=X;switch($){case"and":return K.every((H)=>Ky(Q,H));case"or":return K.some((H)=>Ky(Q,H));case"not":return!K.every((H)=>Ky(Q,H));default:return!0}}let{field:Y,operator:J,value:G}=X,W=Y.join(".");if(W==="connection_id"){if(J!=="eq"||typeof G!=="string")return!1;return OI6(Q,G)}let Z=$40(Q,W);switch(J){case"eq":return Z===G;case"gt":return a$(Z)&&a$(G)&&Z>G;case"gte":return a$(Z)&&a$(G)&&Z>=G;case"lt":return a$(Z)&&a$(G)&&Z<G;case"lte":return a$(Z)&&a$(G)&&Z<=G;case"in":return Array.isArray(G)&&G.includes(Z);case"like":if(typeof Z!=="string"||typeof G!=="string")return!1;if(G.length>100)return!1;let $=NI6(G);return new RegExp(`^${$}$`,"i").test(Z);case"contains":if(typeof Z!=="string"||typeof G!=="string")return!1;return Z.toLowerCase().includes(G.toLowerCase());default:return!0}}function LI6(Q,X){return[...Q].sort((Y,J)=>{for(let G of X){let W=G.field.join("."),Z=$40(Y,W),$=$40(J,W),K=0;if(Z==null&&$==null)continue;if(Z==null)K=G.nulls==="first"?-1:1;else if($==null)K=G.nulls==="first"?1:-1;else if(typeof Z==="string"&&typeof $==="string")K=Z.localeCompare($);else if(typeof Z==="number"&&typeof $==="number")K=Z-$;else K=String(Z).localeCompare(String($));if(K!==0)return G.direction==="desc"?-K:K}return 0})}var wI6,MI6,K40;var E91=o(()=>{n$();C6();AU();wI6=fM,MI6=hM(tG),K40=L1({name:"COLLECTION_GATEWAY_LIST",description:"List all MCP gateways in the organization",inputSchema:wI6,outputSchema:MI6,handler:async(Q,X)=>{await X.access.check();let Y=O6(X),J=Q.where&&!("conditions"in Q.where)&&Q.where.field.join(".")==="connection_id"&&Q.where.operator==="eq"&&typeof Q.where.value==="string"?Q.where.value:void 0,W=(J?await X.storage.gateways.listByConnectionId(Y.id,J):await X.storage.gateways.list(Y.id)).map((V)=>({id:V.id,title:V.title,description:V.description,icon:V.icon,is_default:V.isDefault,organization_id:V.organizationId,tool_selection_strategy:V.toolSelectionStrategy,tool_selection_mode:V.toolSelectionMode,status:V.status,connections:V.connections.map((q)=>({connection_id:q.connectionId,selected_tools:q.selectedTools,selected_resources:q.selectedResources,selected_prompts:q.selectedPrompts})),created_at:V.createdAt,updated_at:V.updatedAt,created_by:V.createdBy,updated_by:V.updatedBy??void 0}));if(Q.where)W=W.filter((V)=>Ky(V,Q.where));if(Q.orderBy&&Q.orderBy.length>0)W=LI6(W,Q.orderBy);let Z=W.length,$=Q.offset??0,K=Q.limit??100,H=W.slice($,$+K),F=$+K<Z;return{items:H,totalCount:Z,hasMore:F}}})});var PI6,TI6,H40;var j91=o(()=>{Z1();C6();AU();PI6=N.object({id:N.string().describe("ID of the gateway to retrieve")}),TI6=N.object({item:tG.nullable().describe("The retrieved gateway, or null if not found")}),H40=L1({name:"COLLECTION_GATEWAY_GET",description:"Get an MCP gateway by ID",inputSchema:PI6,outputSchema:TI6,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=await X.storage.gateways.findById(Q.id);if(J&&J.organizationId!==Y.id)return{item:null};if(!J)return{item:null};return{item:{id:J.id,title:J.title,description:J.description,icon:J.icon,organization_id:J.organizationId,tool_selection_strategy:J.toolSelectionStrategy,tool_selection_mode:J.toolSelectionMode,status:J.status,is_default:J.isDefault,connections:J.connections.map((G)=>({connection_id:G.connectionId,selected_tools:G.selectedTools,selected_resources:G.selectedResources,selected_prompts:G.selectedPrompts})),created_at:J.createdAt,updated_at:J.updatedAt,created_by:J.createdBy,updated_by:J.updatedBy??void 0}}}})});var AI6,EI6,F40;var C91=o(()=>{Z1();C6();AU();AI6=N.object({id:N.string().describe("ID of the gateway to update"),data:T91.describe("Partial gateway data to update")}),EI6=N.object({item:tG.describe("The updated gateway entity")}),F40=L1({name:"COLLECTION_GATEWAY_UPDATE",description:"Update an MCP gateway",inputSchema:AI6,outputSchema:EI6,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=XY(X);if(!J)throw Error("User ID required to update gateway");let G=await X.storage.gateways.findById(Q.id);if(!G)throw Error(`Gateway not found: ${Q.id}`);if(G.organizationId!==Y.id)throw Error(`Gateway not found: ${Q.id}`);let W={};if(Q.data.title!==void 0)W.title=Q.data.title;if(Q.data.description!==void 0)W.description=Q.data.description;if(Q.data.tool_selection_strategy!==void 0)W.toolSelectionStrategy=Q.data.tool_selection_strategy;if(Q.data.tool_selection_mode!==void 0)W.toolSelectionMode=Q.data.tool_selection_mode;if(Q.data.icon!==void 0)W.icon=Q.data.icon;if(Q.data.status!==void 0)W.status=Q.data.status;if(Q.data.is_default!==void 0)W.isDefault=Q.data.is_default;if(Q.data.connections!==void 0)W.connections=Q.data.connections.map(($)=>({connectionId:$.connection_id,selectedTools:$.selected_tools??null,selectedResources:$.selected_resources??null,selectedPrompts:$.selected_prompts??null}));let Z=await X.storage.gateways.update(Q.id,J,W);return{item:{id:Z.id,title:Z.title,description:Z.description,icon:Z.icon,organization_id:Z.organizationId,tool_selection_strategy:Z.toolSelectionStrategy,tool_selection_mode:Z.toolSelectionMode,status:Z.status,is_default:Z.isDefault,connections:Z.connections.map(($)=>({connection_id:$.connectionId,selected_tools:$.selectedTools,selected_resources:$.selectedResources,selected_prompts:$.selectedPrompts})),created_at:Z.createdAt,updated_at:Z.updatedAt,created_by:Z.createdBy,updated_by:Z.updatedBy??void 0}}}})});var jI6,CI6,V40;var I91=o(()=>{Z1();C6();AU();jI6=N.object({id:N.string().describe("ID of the gateway to delete")}),CI6=N.object({item:tG.describe("The deleted gateway entity")}),V40=L1({name:"COLLECTION_GATEWAY_DELETE",description:"Delete an MCP gateway",inputSchema:jI6,outputSchema:CI6,handler:async(Q,X)=>{_1(X);let Y=O6(X);await X.access.check();let J=await X.storage.gateways.findById(Q.id);if(!J)throw Error(`Gateway not found: ${Q.id}`);if(J.organizationId!==Y.id)throw Error(`Gateway not found: ${Q.id}`);if(J.isDefault)throw Error("Cannot delete the default gateway. Set another gateway as default first.");return await X.storage.gateways.delete(Q.id),{item:{id:J.id,title:J.title,description:J.description,icon:J.icon,organization_id:J.organizationId,tool_selection_strategy:J.toolSelectionStrategy,tool_selection_mode:J.toolSelectionMode,status:J.status,is_default:J.isDefault,connections:J.connections.map((G)=>({connection_id:G.connectionId,selected_tools:G.selectedTools,selected_resources:G.selectedResources,selected_prompts:G.selectedPrompts})),created_at:J.createdAt instanceof Date?J.createdAt.toISOString():J.createdAt,updated_at:J.updatedAt instanceof Date?J.updatedAt.toISOString():J.updatedAt,created_by:J.createdBy,updated_by:J.updatedBy??void 0}}}})});var R91=o(()=>{A91();E91();j91();C91();I91()});var RI6,q40;var S91=o(()=>{C6();Z1();RI6=N.object({id:N.string().optional().describe("Unique log identifier"),organizationId:N.string().describe("Organization ID"),connectionId:N.string().describe("Connection ID"),connectionTitle:N.string().describe("Connection display name"),toolName:N.string().describe("Name of the tool that was called"),input:N.record(N.string(),N.unknown()).describe("Redacted tool input"),output:N.record(N.string(),N.unknown()).describe("Redacted tool output"),isError:N.boolean().describe("Whether the call resulted in an error"),errorMessage:N.string().nullish().describe("Error message if applicable"),durationMs:N.number().describe("Call duration in milliseconds"),timestamp:N.string().describe("ISO 8601 timestamp of the call"),userId:N.string().nullish().describe("User who triggered the call"),requestId:N.string().describe("Unique request identifier"),userAgent:N.string().nullish().describe("Client identifier (x-mesh-client header)"),gatewayId:N.string().nullish().describe("Gateway ID if routed through a gateway")}),q40=L1({name:"MONITORING_LOGS_LIST",description:"List monitoring logs for tool calls in the organization",inputSchema:N.object({connectionId:N.string().optional().describe("Filter by connection ID"),gatewayId:N.string().optional().describe("Filter by gateway ID"),toolName:N.string().optional().describe("Filter by tool name"),isError:N.boolean().optional().describe("Filter by error status"),startDate:N.string().datetime().optional().describe("Filter by start date (ISO 8601 datetime string)"),endDate:N.string().datetime().optional().describe("Filter by end date (ISO 8601 datetime string)"),limit:N.number().default(100).describe("Maximum number of results"),offset:N.number().default(0).describe("Offset for pagination")}),outputSchema:N.object({logs:N.array(RI6).describe("Array of monitoring logs"),total:N.number().describe("Total number of logs matching filters"),offset:N.number().describe("Current offset for pagination"),limit:N.number().describe("Current limit for pagination")}),handler:async(Q,X)=>{let J={organizationId:O6(X).id,connectionId:Q.connectionId,gatewayId:Q.gatewayId,toolName:Q.toolName,isError:Q.isError,startDate:Q.startDate?new Date(Q.startDate):void 0,endDate:Q.endDate?new Date(Q.endDate):void 0,limit:Q.limit,offset:Q.offset},G=await X.storage.monitoring.query(J);return{logs:G.logs.map((W)=>({...W,timestamp:W.timestamp instanceof Date?W.timestamp.toISOString():W.timestamp})),total:G.total,offset:Q.offset,limit:Q.limit}}})});var z40;var k91=o(()=>{C6();Z1();z40=L1({name:"MONITORING_STATS",description:"Get aggregated statistics for tool call monitoring",inputSchema:N.object({startDate:N.string().datetime().optional().describe("Filter by start date (ISO 8601 datetime string)"),endDate:N.string().datetime().optional().describe("Filter by end date (ISO 8601 datetime string)")}),outputSchema:N.object({totalCalls:N.number().describe("Total number of tool calls"),errorRate:N.number().describe("Error rate as a decimal (0 to 1)"),avgDurationMs:N.number().describe("Average call duration in milliseconds"),errorRatePercent:N.string().describe("Error rate as a percentage string")}),handler:async(Q,X)=>{let J={organizationId:O6(X).id,startDate:Q.startDate?new Date(Q.startDate):void 0,endDate:Q.endDate?new Date(Q.endDate):void 0},G=await X.storage.monitoring.getStats(J);return{...G,errorRatePercent:(G.errorRate*100).toFixed(2)}}})});var v91=o(()=>{S91();k91()});var U40;var _91=o(()=>{Z1();C6();U40=L1({name:"ORGANIZATION_CREATE",description:"Create a new organization",inputSchema:N.object({slug:N.string().min(1).max(50).regex(/^[a-z0-9-]+$/,"Slug must be lowercase alphanumeric with hyphens"),name:N.string().min(1).max(255),description:N.string().optional()}),outputSchema:N.object({id:N.string(),name:N.string(),slug:N.string(),logo:N.string().nullable().optional(),metadata:N.any().optional(),createdAt:N.union([N.date(),N.string()]),members:N.array(N.any()).optional()}),handler:async(Q,X)=>{_1(X),await X.access.check();let Y=XY(X);if(!Y)throw Error("User ID required to create organization");let J=await X.boundAuth.organization.create({name:Q.name,slug:Q.slug,metadata:Q.description?{description:Q.description}:void 0,userId:Y});if(!J)throw Error("Failed to create organization");return J}})});var B40;var y91=o(()=>{Z1();C6();B40=L1({name:"ORGANIZATION_LIST",description:"List all organizations user has access to",inputSchema:N.object({userId:N.string().optional()}),outputSchema:N.object({organizations:N.array(N.object({id:N.string(),name:N.string(),slug:N.string(),logo:N.string().nullable().optional(),metadata:N.any().optional(),createdAt:N.union([N.date(),N.string()])}))}),handler:async(Q,X)=>{_1(X),await X.access.check();let Y=XY(X),J=Q.userId||Y;if(!J)throw Error("User ID required to list organizations");return{organizations:await X.boundAuth.organization.list(J)}}})});var D40;var b91=o(()=>{Z1();C6();D40=L1({name:"ORGANIZATION_GET",description:"Get organization details by slug or ID",inputSchema:N.object({}),outputSchema:N.object({id:N.string(),name:N.string(),slug:N.string(),logo:N.string().nullable().optional(),metadata:N.any().optional(),createdAt:N.union([N.date(),N.string()]),members:N.array(N.any()).optional(),invitations:N.array(N.any()).optional()}),handler:async(Q,X)=>{_1(X),await X.access.check();let Y=await X.boundAuth.organization.get();if(!Y)throw Error("No active organization found");return Y}})});var N40;var f91=o(()=>{Z1();C6();N40=L1({name:"ORGANIZATION_UPDATE",description:"Update an existing organization",inputSchema:N.object({id:N.string(),slug:N.string().min(1).max(50).regex(/^[a-z0-9-]+$/).optional(),name:N.string().min(1).max(255).optional(),description:N.string().optional()}),outputSchema:N.object({id:N.string(),name:N.string(),slug:N.string(),logo:N.string().nullable().optional(),metadata:N.any().optional(),createdAt:N.union([N.date(),N.string()])}),handler:async(Q,X)=>{_1(X),await X.access.check();let Y={};if(Q.name)Y.name=Q.name;if(Q.slug)Y.slug=Q.slug;if(Q.description)Y.metadata={description:Q.description};let J=await X.boundAuth.organization.update({organizationId:Q.id,data:Y});if(!J)throw Error("Failed to update organization");return J}})});var O40;var h91=o(()=>{Z1();C6();O40=L1({name:"ORGANIZATION_DELETE",description:"Delete an organization",inputSchema:N.object({id:N.string()}),outputSchema:N.object({success:N.boolean(),id:N.string()}),handler:async(Q,X)=>{return _1(X),await X.access.check(),await X.boundAuth.organization.delete(Q.id),{success:!0,id:Q.id}}})});var sM;var L40=o(()=>{Z1();sM=N.object({title:N.string(),url:N.string(),icon:N.string()})});var w40;var x91=o(()=>{Z1();C6();L40();w40=L1({name:"ORGANIZATION_SETTINGS_GET",description:"Get organization-level settings",inputSchema:N.object({}),outputSchema:N.object({organizationId:N.string(),sidebar_items:N.array(sM).nullable().optional(),createdAt:N.union([N.date(),N.string()]).optional(),updatedAt:N.union([N.date(),N.string()]).optional()}),handler:async(Q,X)=>{_1(X),await X.access.check();let Y=X.organization?.id;if(!Y)throw Error("Organization ID required (no active organization in context)");let J=await X.storage.organizationSettings.get(Y);if(!J)return{organizationId:Y};return J}})});var M40;var g91=o(()=>{Z1();C6();L40();M40=L1({name:"ORGANIZATION_SETTINGS_UPDATE",description:"Update organization-level settings",inputSchema:N.object({organizationId:N.string(),sidebar_items:N.array(sM).optional()}),outputSchema:N.object({organizationId:N.string(),sidebar_items:N.array(sM).nullable().optional(),createdAt:N.union([N.date(),N.string()]),updatedAt:N.union([N.date(),N.string()])}),handler:async(Q,X)=>{if(_1(X),await X.access.check(),X.organization&&X.organization.id!==Q.organizationId)throw Error("Cannot update settings for a different organization");return await X.storage.organizationSettings.upsert(Q.organizationId,{sidebar_items:Q.sidebar_items})}})});var P40;var u91=o(()=>{Z1();C6();P40=L1({name:"ORGANIZATION_MEMBER_ADD",description:"Add a member to an organization",inputSchema:N.object({organizationId:N.string().optional(),userId:N.string(),role:N.array(N.string())}),outputSchema:N.object({id:N.string(),organizationId:N.string(),userId:N.string(),role:N.union([N.string(),N.array(N.string())]),createdAt:N.union([N.date(),N.string()])}),handler:async(Q,X)=>{_1(X),await X.access.check();let Y=Q.organizationId||X.organization?.id;if(!Y)throw Error("Organization ID required (no active organization in context)");let J=await X.boundAuth.organization.addMember({organizationId:Y,userId:Q.userId,role:Q.role});if(!J)throw Error("Failed to add member");return J}})});var T40;var m91=o(()=>{Z1();C6();T40=L1({name:"ORGANIZATION_MEMBER_REMOVE",description:"Remove a member from an organization",inputSchema:N.object({organizationId:N.string().optional(),memberIdOrEmail:N.string()}),outputSchema:N.object({success:N.boolean(),memberIdOrEmail:N.string()}),handler:async(Q,X)=>{_1(X),await X.access.check();let Y=Q.organizationId||X.organization?.id;if(!Y)throw Error("Organization ID required (no active organization in context)");return await X.boundAuth.organization.removeMember({organizationId:Y,memberIdOrEmail:Q.memberIdOrEmail}),{success:!0,memberIdOrEmail:Q.memberIdOrEmail}}})});var A40;var l91=o(()=>{Z1();C6();A40=L1({name:"ORGANIZATION_MEMBER_LIST",description:"List all members in an organization",inputSchema:N.object({limit:N.number().optional(),offset:N.number().optional()}),outputSchema:N.object({members:N.array(N.object({id:N.string(),organizationId:N.string(),userId:N.string(),role:N.string(),createdAt:N.union([N.date(),N.string()]),user:N.object({id:N.string(),name:N.string(),email:N.string(),image:N.string().optional()}).optional()}))}),handler:async(Q,X)=>{_1(X),await X.access.check();let Y=X.organization?.id;if(!Y)throw Error("Organization ID required (no active organization in context)");let J=await X.boundAuth.organization.listMembers({organizationId:Y,limit:Q.limit,offset:Q.offset});return{members:Array.isArray(J)?J:[]}}})});var E40;var d91=o(()=>{Z1();C6();E40=L1({name:"ORGANIZATION_MEMBER_UPDATE_ROLE",description:"Update a member's role in an organization",inputSchema:N.object({organizationId:N.string().optional(),memberId:N.string(),role:N.array(N.string())}),outputSchema:N.object({id:N.string(),organizationId:N.string(),userId:N.string(),role:N.union([N.literal("admin"),N.literal("member"),N.literal("owner")]),createdAt:N.union([N.date(),N.string()]),user:N.object({email:N.string(),name:N.string(),image:N.string().optional()})}),handler:async(Q,X)=>{_1(X),await X.access.check();let Y=Q.organizationId||X.organization?.id;if(!Y)throw Error("Organization ID required (no active organization in context)");let J=await X.boundAuth.organization.updateMemberRole({organizationId:Y,memberId:Q.memberId,role:Q.role});if(!J)throw Error("Failed to update member role");return J}})});var p91=o(()=>{_91();y91();b91();f91();h91();x91();g91();u91();m91();l91();d91()});var n91={};K8(n91,{managementMCP:()=>j40,ALL_TOOLS:()=>c91});var c91,j40=(Q)=>{let X=c91.map((J)=>({name:J.name,description:J.description,inputSchema:J.inputSchema,outputSchema:J.outputSchema,handler:async(G)=>{return Q.access.setToolName(J.name),await J.execute(G,Q)}}));return XQ1({name:"mcp-mesh-management",version:"1.0.0"}).withTools(X).build()};var C40=o(()=>{YQ1();DQ1();$91();V91();M91();R91();v91();p91();c91=[U40,B40,D40,N40,O40,w40,M40,P40,T40,A40,E40,P60,p60,c60,a60,r60,o60,Z40,K40,H40,F40,V40,F91,q40,z40,O60,w60,M60,L60,s60,t60,e60,Q40,X40,Y40,J40]});var o3,u40,Ny,s3,WP;var Oy=o(()=>{o3={JS_EVAL_TYPE_GLOBAL:0,JS_EVAL_TYPE_MODULE:1,JS_EVAL_TYPE_DIRECT:2,JS_EVAL_TYPE_INDIRECT:3,JS_EVAL_TYPE_MASK:3,JS_EVAL_FLAG_STRICT:8,JS_EVAL_FLAG_STRIP:16,JS_EVAL_FLAG_COMPILE_ONLY:32,JS_EVAL_FLAG_BACKTRACE_BARRIER:64},u40={BaseObjects:1,Date:2,Eval:4,StringNormalize:8,RegExp:16,RegExpCompiler:32,JSON:64,Proxy:128,MapSet:256,TypedArrays:512,Promise:1024,BigInt:2048,BigFloat:4096,BigDecimal:8192,OperatorOverloading:16384,BignumExt:32768},Ny={Pending:0,Fulfilled:1,Rejected:2},s3={JS_GPN_STRING_MASK:1,JS_GPN_SYMBOL_MASK:2,JS_GPN_PRIVATE_MASK:4,JS_GPN_ENUM_ONLY:16,JS_GPN_SET_ENUM:32,QTS_GPN_NUMBER_MASK:64,QTS_STANDARD_COMPLIANT_NUMBER:128},WP={IsStrictlyEqual:0,IsSameValue:1,IsSameValueZero:2}});function CU(...Q){n40&&console.log("quickjs-emscripten:",...Q)}function*eX1(Q){return yield Q}function NR6(Q){return eX1(a40(Q))}function mX1(Q,X){return(...Y)=>{let J=X.call(Q,i40,...Y);return a40(J)}}function OR6(Q,X){let Y=X.call(Q,i40);return a40(Y)}function a40(Q){function X(Y){return Y.done?Y.value:Y.value instanceof Promise?Y.value.then((J)=>X(Q.next(J)),(J)=>X(Q.throw(J))):X(Q.next(Y.value))}return X(Q.next())}function m40(Q,X){let Y;try{Q.dispose()}catch(J){Y=J}if(X&&Y)throw Object.assign(X,{message:`${X.message}
|
|
256
256
|
Then, failed to dispose scope: ${Y.message}`,disposeError:Y}),X;if(X||Y)throw X||Y}function QY1(Q){let X=Q?Array.from(Q):[];function Y(){return X.forEach((G)=>G.alive?G.dispose():void 0)}function J(){return X.some((G)=>G.alive)}return Object.defineProperty(X,p40,{configurable:!0,enumerable:!1,value:Y}),Object.defineProperty(X,"dispose",{configurable:!0,enumerable:!1,value:Y}),Object.defineProperty(X,"alive",{configurable:!0,enumerable:!1,get:J}),X}function Ly(Q){return!!(Q&&(typeof Q=="object"||typeof Q=="function")&&("alive"in Q)&&typeof Q.alive=="boolean"&&("dispose"in Q)&&typeof Q.dispose=="function")}function LR6(Q){if(!Q)return 0;let X=0;for(let[Y,J]of Object.entries(Q)){if(!(Y in u40))throw new oX1(Y);J&&(X|=u40[Y])}return X}function wR6(Q){if(typeof Q=="number")return Q;if(Q===void 0)return 0;let{type:X,strict:Y,strip:J,compileOnly:G,backtraceBarrier:W}=Q,Z=0;return X==="global"&&(Z|=o3.JS_EVAL_TYPE_GLOBAL),X==="module"&&(Z|=o3.JS_EVAL_TYPE_MODULE),Y&&(Z|=o3.JS_EVAL_FLAG_STRICT),J&&(Z|=o3.JS_EVAL_FLAG_STRIP),G&&(Z|=o3.JS_EVAL_FLAG_COMPILE_ONLY),W&&(Z|=o3.JS_EVAL_FLAG_BACKTRACE_BARRIER),Z}function MR6(Q){if(typeof Q=="number")return Q;if(Q===void 0)return 0;let{strings:X,symbols:Y,quickjsPrivate:J,onlyEnumerable:G,numbers:W,numbersAsStrings:Z}=Q,$=0;return X&&($|=s3.JS_GPN_STRING_MASK),Y&&($|=s3.JS_GPN_SYMBOL_MASK),J&&($|=s3.JS_GPN_PRIVATE_MASK),G&&($|=s3.JS_GPN_ENUM_ONLY),W&&($|=s3.QTS_GPN_NUMBER_MASK),Z&&($|=s3.QTS_STANDARD_COMPLIANT_NUMBER),$}function PR6(...Q){let X=[];for(let Y of Q)Y!==void 0&&(X=X.concat(Y));return X}function t40(Q,X){X.interruptHandler&&Q.setInterruptHandler(X.interruptHandler),X.maxStackSizeBytes!==void 0&&Q.setMaxStackSize(X.maxStackSizeBytes),X.memoryLimitBytes!==void 0&&Q.setMemoryLimit(X.memoryLimitBytes)}function e40(Q,X){X.moduleLoader&&Q.setModuleLoader(X.moduleLoader),X.shouldInterrupt&&Q.setInterruptHandler(X.shouldInterrupt),X.memoryLimitBytes!==void 0&&Q.setMemoryLimit(X.memoryLimitBytes),X.maxStackSizeBytes!==void 0&&Q.setMaxStackSize(X.maxStackSizeBytes)}var BR6,DR6=(Q,X)=>{for(var Y in X)BR6(Q,Y,{get:X[Y],enumerable:!0})},n40=!1,dX1,l40,pX1,d40,cX1,nX1,iX1,aX1,rX1,oX1,sX1,tX1,i40,y7,p40,lX1,f9,o$,c40,I5,r40,XY1,YY1,t3,JY1,GY1=class{constructor(Q){this.module=Q}toPointerArray(Q){let X=new Int32Array(Q.map((G)=>G.value)),Y=X.length*X.BYTES_PER_ELEMENT,J=this.module._malloc(Y);return new Uint8Array(this.module.HEAPU8.buffer,J,Y).set(new Uint8Array(X.buffer)),new f9(J,void 0,(G)=>this.module._free(G))}newTypedArray(Q,X){let Y=new Q(Array(X).fill(0)),J=Y.length*Y.BYTES_PER_ELEMENT,G=this.module._malloc(J),W=new Q(this.module.HEAPU8.buffer,G,X);return W.set(Y),new f9({typedArray:W,ptr:G},void 0,(Z)=>this.module._free(Z.ptr))}newMutablePointerArray(Q){return this.newTypedArray(Int32Array,Q)}newHeapCharPointer(Q){let X=this.module.lengthBytesUTF8(Q),Y=X+1,J=this.module._malloc(Y);return this.module.stringToUTF8(Q,J,Y),new f9({ptr:J,strlen:X},void 0,(G)=>this.module._free(G.ptr))}newHeapBufferPointer(Q){let X=Q.byteLength,Y=this.module._malloc(X);return this.module.HEAPU8.set(Q,Y),new f9({pointer:Y,numBytes:X},void 0,(J)=>this.module._free(J.pointer))}consumeHeapCharPointer(Q){let X=this.module.UTF8ToString(Q);return this.module._free(Q),X}},wh4,o40,TR6,AR6,WY1,ZY1,ER6=class{constructor(Q){this.callFunction=Q.callFunction,this.shouldInterrupt=Q.shouldInterrupt,this.loadModuleSource=Q.loadModuleSource,this.normalizeModule=Q.normalizeModule}},s40=class{constructor(Q){this.contextCallbacks=new Map,this.runtimeCallbacks=new Map,this.suspendedCount=0,this.cToHostCallbacks=new ER6({callFunction:(X,Y,J,G,W,Z)=>this.handleAsyncify(X,()=>{try{let $=this.contextCallbacks.get(Y);if(!$)throw Error(`QuickJSContext(ctx = ${Y}) not found for C function call "${Z}"`);return $.callFunction(Y,J,G,W,Z)}catch($){return console.error("[C to host error: returning null]",$),0}}),shouldInterrupt:(X,Y)=>this.handleAsyncify(X,()=>{try{let J=this.runtimeCallbacks.get(Y);if(!J)throw Error(`QuickJSRuntime(rt = ${Y}) not found for C interrupt`);return J.shouldInterrupt(Y)}catch(J){return console.error("[C to host interrupt: returning error]",J),1}}),loadModuleSource:(X,Y,J,G)=>this.handleAsyncify(X,()=>{try{let W=this.runtimeCallbacks.get(Y);if(!W)throw Error(`QuickJSRuntime(rt = ${Y}) not found for C module loader`);let Z=W.loadModuleSource;if(!Z)throw Error(`QuickJSRuntime(rt = ${Y}) does not support module loading`);return Z(Y,J,G)}catch(W){return console.error("[C to host module loader error: returning null]",W),0}}),normalizeModule:(X,Y,J,G,W)=>this.handleAsyncify(X,()=>{try{let Z=this.runtimeCallbacks.get(Y);if(!Z)throw Error(`QuickJSRuntime(rt = ${Y}) not found for C module loader`);let $=Z.normalizeModule;if(!$)throw Error(`QuickJSRuntime(rt = ${Y}) does not support module loading`);return $(Y,J,G,W)}catch(Z){return console.error("[C to host module loader error: returning null]",Z),0}})}),this.module=Q,this.module.callbacks=this.cToHostCallbacks}setRuntimeCallbacks(Q,X){this.runtimeCallbacks.set(Q,X)}deleteRuntime(Q){this.runtimeCallbacks.delete(Q)}setContextCallbacks(Q,X){this.contextCallbacks.set(Q,X)}deleteContext(Q){this.contextCallbacks.delete(Q)}handleAsyncify(Q,X){if(Q)return Q.handleSleep((J)=>{try{let G=X();if(!(G instanceof Promise)){CU("asyncify.handleSleep: not suspending:",G),J(G);return}if(this.suspended)throw new nX1(`Already suspended at: ${this.suspended.stack}
|
|
257
257
|
Attempted to suspend at:`);this.suspended=new iX1(`(${this.suspendedCount++})`),CU("asyncify.handleSleep: suspending:",this.suspended),G.then((W)=>{this.suspended=void 0,CU("asyncify.handleSleep: resolved:",W),J(W)},(W)=>{CU("asyncify.handleSleep: rejected:",W),console.error("QuickJS: cannot handle error in suspended function",W),this.suspended=void 0})}catch(G){throw CU("asyncify.handleSleep: error:",G),this.suspended=void 0,G}});let Y=X();if(Y instanceof Promise)throw Error("Promise return value not supported in non-asyncify context.");return Y}},Q80=class{constructor(Q,X){this.module=Q,this.ffi=X,this.callbacks=new s40(Q)}newRuntime(Q={}){let X=new f9(this.ffi.QTS_NewRuntime(),void 0,(J)=>{this.callbacks.deleteRuntime(J),this.ffi.QTS_FreeRuntime(J)}),Y=new ZY1({module:this.module,callbacks:this.callbacks,ffi:this.ffi,rt:X});return t40(Y,Q),Q.moduleLoader&&Y.setModuleLoader(Q.moduleLoader),Y}newContext(Q={}){let X=this.newRuntime(),Y=X.newContext({...Q,ownedLifetimes:PR6(X,Q.ownedLifetimes)});return X.context=Y,Y}evalCode(Q,X={}){return I5.withScope((Y)=>{let J=Y.manage(this.newContext());e40(J.runtime,X);let G=J.evalCode(Q,"eval.js");if(X.memoryLimitBytes!==void 0&&J.runtime.setMemoryLimit(-1),G.error)throw J.dump(Y.manage(G.error));return J.dump(Y.manage(G.value))})}getWasmMemory(){let Q=this.module.quickjsEmscriptenInit?.(()=>{})?.getWasmMemory?.();if(!Q)throw Error("Variant does not support getting WebAssembly.Memory");return Q}getFFI(){return this.ffi}};var X80=o(()=>{Oy();Oy();BR6=Object.defineProperty;dX1={};DR6(dX1,{QuickJSAsyncifyError:()=>nX1,QuickJSAsyncifySuspended:()=>iX1,QuickJSEmptyGetOwnPropertyNames:()=>tX1,QuickJSEmscriptenModuleError:()=>rX1,QuickJSMemoryLeakDetected:()=>aX1,QuickJSNotImplemented:()=>cX1,QuickJSPromisePending:()=>sX1,QuickJSUnknownIntrinsic:()=>oX1,QuickJSUnwrapError:()=>l40,QuickJSUseAfterFree:()=>d40,QuickJSWrongOwner:()=>pX1});l40=class extends Error{constructor(Q,X){let Y=typeof Q=="object"&&Q&&"message"in Q?String(Q.message):String(Q);super(Y);this.cause=Q,this.context=X,this.name="QuickJSUnwrapError"}},pX1=class extends Error{constructor(){super(...arguments);this.name="QuickJSWrongOwner"}},d40=class extends Error{constructor(){super(...arguments);this.name="QuickJSUseAfterFree"}},cX1=class extends Error{constructor(){super(...arguments);this.name="QuickJSNotImplemented"}},nX1=class extends Error{constructor(){super(...arguments);this.name="QuickJSAsyncifyError"}},iX1=class extends Error{constructor(){super(...arguments);this.name="QuickJSAsyncifySuspended"}},aX1=class extends Error{constructor(){super(...arguments);this.name="QuickJSMemoryLeakDetected"}},rX1=class extends Error{constructor(){super(...arguments);this.name="QuickJSEmscriptenModuleError"}},oX1=class extends TypeError{constructor(){super(...arguments);this.name="QuickJSUnknownIntrinsic"}},sX1=class extends Error{constructor(){super(...arguments);this.name="QuickJSPromisePending"}},tX1=class extends Error{constructor(){super(...arguments);this.name="QuickJSEmptyGetOwnPropertyNames"}};i40=eX1;i40.of=NR6;y7=class{[Symbol.dispose](){return this.dispose()}},p40=Symbol.dispose??Symbol.for("Symbol.dispose"),lX1=y7.prototype;lX1[p40]||(lX1[p40]=function(){return this.dispose()});f9=class Q extends y7{constructor(X,Y,J,G){super();this._value=X,this.copier=Y,this.disposer=J,this._owner=G,this._alive=!0,this._constructorStack=n40?Error("Lifetime constructed").stack:void 0}get alive(){return this._alive}get value(){return this.assertAlive(),this._value}get owner(){return this._owner}get dupable(){return!!this.copier}dup(){if(this.assertAlive(),!this.copier)throw Error("Non-dupable lifetime");return new Q(this.copier(this._value),this.copier,this.disposer,this._owner)}consume(X){this.assertAlive();let Y=X(this);return this.dispose(),Y}map(X){return this.assertAlive(),X(this)}tap(X){return X(this),this}dispose(){this.assertAlive(),this.disposer&&this.disposer(this._value),this._alive=!1}assertAlive(){if(!this.alive)throw this._constructorStack?new d40(`Lifetime not alive
|
|
258
258
|
${this._constructorStack}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r}from"./index-A52jfksK.js";const i=({size:e=24,color:t="currentColor",...o})=>r.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:t,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...o},r.createElement("path",{d:"m7.5 12 3 3 6-6m5.5 3c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));i.displayName="CheckCircle";export{i};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as E,j as t,r as v}from"./index-A52jfksK.js";import{c as N}from"./utils-DgLfrg3u.js";function y(){const s=E.c(1);let e;return s[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("img",{src:"/empty-state-cards.png",alt:"",width:336,height:320,"aria-hidden":"true"}),s[0]=e):e=s[0],e}function S(s){const e=E.c(24),{image:i,title:p,description:h,actions:x,className:u,descriptionClassName:j,actionsClassName:g}=s;let l;e[0]!==u?(l=N("flex flex-1 flex-col items-center justify-center gap-8 p-4",u),e[0]=u,e[1]=l):l=e[1];let r;e[2]!==i?(r=i!==null&&t.jsx("div",{className:"flex items-center justify-center",children:i??t.jsx(y,{})}),e[2]=i,e[3]=r):r=e[3];let a;e[4]!==p?(a=t.jsx("h3",{className:"text-lg font-medium text-foreground",children:p}),e[4]=p,e[5]=a):a=e[5];let c;e[6]!==j?(c=N("text-sm text-muted-foreground text-center max-w-[300px]",j),e[6]=j,e[7]=c):c=e[7];let n;e[8]!==h||e[9]!==c?(n=t.jsx("div",{className:c,children:h}),e[8]=h,e[9]=c,e[10]=n):n=e[10];let o;e[11]!==a||e[12]!==n?(o=t.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a,n]}),e[11]=a,e[12]=n,e[13]=o):o=e[13];let m;e[14]!==x||e[15]!==g?(m=x&&t.jsx("div",{className:N("flex items-center gap-2",g),children:x}),e[14]=x,e[15]=g,e[16]=m):m=e[16];let d;e[17]!==o||e[18]!==m?(d=t.jsxs("div",{className:"flex flex-col items-center gap-4",children:[o,m]}),e[17]=o,e[18]=m,e[19]=d):d=e[19];let f;return e[20]!==l||e[21]!==r||e[22]!==d?(f=t.jsxs("div",{className:l,children:[r,d]}),e[20]=l,e[21]=r,e[22]=d,e[23]=f):f=e[23],f}const k=({size:s=24,color:e="currentColor",...i})=>v.createElement("svg",{viewBox:"0 0 24 24",width:s,height:s,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...i},v.createElement("path",{d:"m21 21-4.35-4.35M19 11a8 8 0 1 1-16 0 8 8 0 0 1 16 0Z"}));k.displayName="SearchMd";export{S as E,k as i};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as R,c as j,j as i,h as I,Z as U,_ as L,$ as M}from"./index-A52jfksK.js";import{c as f}from"./utils-DgLfrg3u.js";const V=({size:a=24,color:e="currentColor",...s})=>R.createElement("svg",{viewBox:"0 0 24 24",width:a,height:a,stroke:e,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...s},R.createElement("path",{d:"M20 21c0-1.396 0-2.093-.172-2.661a4 4 0 0 0-2.667-2.667c-.568-.172-1.265-.172-2.661-.172h-5c-1.396 0-2.093 0-2.661.172a4 4 0 0 0-2.667 2.667C4 18.907 4 19.604 4 21M16.5 7.5a4.5 4.5 0 1 1-9 0 4.5 4.5 0 0 1 9 0Z"}));V.displayName="User01";function O(a){const e=j.c(8);let s,t;e[0]!==a?({className:s,...t}=a,e[0]=a,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let o;e[3]!==s?(o=f("relative flex size-8 shrink-0 overflow-hidden rounded-full",s),e[3]=s,e[4]=o):o=e[4];let r;return e[5]!==t||e[6]!==o?(r=i.jsx(M,{"data-slot":"avatar",className:o,...t}),e[5]=t,e[6]=o,e[7]=r):r=e[7],r}function _(a){const e=j.c(8);let s,t;e[0]!==a?({className:s,...t}=a,e[0]=a,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let o;e[3]!==s?(o=f("aspect-square size-full",s),e[3]=s,e[4]=o):o=e[4];let r;return e[5]!==t||e[6]!==o?(r=i.jsx(U,{"data-slot":"avatar-image",className:o,...t}),e[5]=t,e[6]=o,e[7]=r):r=e[7],r}function T(a){const e=j.c(8);let s,t;e[0]!==a?({className:s,...t}=a,e[0]=a,e[1]=s,e[2]=t):(s=e[1],t=e[2]);let o;e[3]!==s?(o=f("bg-muted flex size-full items-center justify-center rounded-full",s),e[3]=s,e[4]=o):o=e[4];let r;return e[5]!==t||e[6]!==o?(r=i.jsx(L,{"data-slot":"avatar-fallback",className:o,...t}),e[5]=t,e[6]=o,e[7]=r):r=e[7],r}const S=["drop-shadow-lg bg-gradient-to-br from-red-100 to-red-300 text-red-800 shadow-lg shadow-red-300/40 ring-1 ring-red-300/30","drop-shadow-lg bg-gradient-to-br from-lime-100 to-lime-300 text-lime-800 shadow-lg shadow-lime-300/40 ring-1 ring-lime-300/30","drop-shadow-lg bg-gradient-to-br from-emerald-100 to-emerald-300 text-emerald-800 shadow-lg shadow-emerald-300/40 ring-1 ring-emerald-300/30","drop-shadow-lg bg-gradient-to-br from-orange-100 to-orange-300 text-orange-800 shadow-lg shadow-orange-300/40 ring-1 ring-orange-300/30","drop-shadow-lg bg-gradient-to-br from-amber-100 to-amber-300 text-amber-800 shadow-lg shadow-amber-300/40 ring-1 ring-amber-300/30","drop-shadow-lg bg-gradient-to-br from-yellow-100 to-yellow-300 text-yellow-800 shadow-lg shadow-yellow-300/40 ring-1 ring-yellow-300/30","drop-shadow-lg bg-gradient-to-br from-green-100 to-green-300 text-green-800 shadow-lg shadow-green-300/40 ring-1 ring-green-300/30","drop-shadow-lg bg-gradient-to-br from-teal-100 to-teal-300 text-teal-800 shadow-lg shadow-teal-300/40 ring-1 ring-teal-300/30","drop-shadow-lg bg-gradient-to-br from-cyan-100 to-cyan-300 text-cyan-800 shadow-lg shadow-cyan-300/40 ring-1 ring-cyan-300/30","drop-shadow-lg bg-gradient-to-br from-sky-100 to-sky-300 text-sky-800 shadow-lg shadow-sky-300/40 ring-1 ring-sky-300/30","drop-shadow-lg bg-gradient-to-br from-blue-100 to-blue-300 text-blue-800 shadow-lg shadow-blue-300/40 ring-1 ring-blue-300/30","drop-shadow-lg bg-gradient-to-br from-indigo-100 to-indigo-300 text-indigo-800 shadow-lg shadow-indigo-300/40 ring-1 ring-indigo-300/30","drop-shadow-lg bg-gradient-to-br from-violet-100 to-violet-300 text-violet-800 shadow-lg shadow-violet-300/40 ring-1 ring-violet-300/30","drop-shadow-lg bg-gradient-to-br from-purple-100 to-purple-300 text-purple-800 shadow-lg shadow-purple-300/40 ring-1 ring-purple-300/30","drop-shadow-lg bg-gradient-to-br from-fuchsia-100 to-fuchsia-300 text-fuchsia-800 shadow-lg shadow-fuchsia-300/40 ring-1 ring-fuchsia-300/30","drop-shadow-lg bg-gradient-to-br from-pink-100 to-pink-300 text-pink-800 shadow-lg shadow-pink-300/40 ring-1 ring-pink-300/30","drop-shadow-lg bg-gradient-to-br from-rose-100 to-rose-300 text-rose-800 shadow-lg shadow-rose-300/40 ring-1 ring-rose-300/30"],W="drop-shadow-lg text-muted-foreground bg-muted shadow-lg";function Z(a){let e=0;for(let t=0;t<a.length;t++)e=a.charCodeAt(t)+((e<<5)-e);const s=Math.abs(e)%S.length;return S[s]}const $=I("border border-border",{variants:{shape:{circle:"rounded-full",square:""},size:{"3xs":"w-3 h-3 text-xs font-semibold","2xs":"w-4 h-4 text-xs font-semibold",xs:"w-6 h-6 text-sm font-semibold",sm:"w-8 h-8 text-lg font-semibold",base:"w-10 h-10 text-2xl font-semibold",lg:"w-12 h-12 text-3xl font-semibold",xl:"w-16 h-16 text-4xl font-semibold","2xl":"w-20 h-20 text-5xl font-semibold","3xl":"w-32 h-32 text-7xl font-semibold"}},compoundVariants:[{shape:"square",size:"xs",class:"rounded-lg"},{shape:"square",size:"sm",class:"rounded-xl"},{shape:"square",size:"base",class:"rounded-xl"},{shape:"square",size:"lg",class:"rounded-xl"},{shape:"square",size:"xl",class:"rounded-2xl"},{shape:"square",size:"2xl",class:"rounded-3xl"},{shape:"square",size:"3xl",class:"rounded-[40px]"}],defaultVariants:{shape:"square",size:"base"}}),B=I("",{variants:{objectFit:{contain:"object-contain",cover:"object-cover"}},defaultVariants:{objectFit:"cover"}}),D=a=>{const e={"3xs":8,"2xs":8,xs:12,sm:16,base:24,lg:28,xl:36,"2xl":48,"3xl":80};return e[a]||e.base};function G(a){const e=j.c(35);let s,t,o,r,n,d,g,l;e[0]!==a?({url:l,fallback:t,shape:r,size:n,objectFit:d,className:s,muted:g,...o}=a,e[0]=a,e[1]=s,e[2]=t,e[3]=o,e[4]=r,e[5]=n,e[6]=d,e[7]=g,e[8]=l):(s=e[1],t=e[2],o=e[3],r=e[4],n=e[5],d=e[6],g=e[7],l=e[8]);const b=r===void 0?"square":r,h=n===void 0?"base":n,u=d===void 0?"cover":d,k=g===void 0?!1:g,[m,x]=R.useState(!1);let F;e:{if(typeof t=="string"){let c;e[9]!==t?(c=t.trim().slice(0,2).toUpperCase(),e[9]=t,e[10]=c):c=e[10],F=c;break e}F=t}const C=F;let z;e:{if(k){z=W;break e}if(typeof t=="string"){let c;e[11]!==t?(c=Z(t),e[11]=t,e[12]=c):c=e[12],z=c;break e}z=S[0]}const y=z;let N;e[13]!==l?(N=l?.startsWith("icon://"),e[13]=l,e[14]=N):N=e[14];const p=N;let q;e[15]!==p||e[16]!==l?(q=p?l?.replace("icon://",""):void 0,e[15]=p,e[16]=l,e[17]=q):q=e[17];const E=q;let w;e[18]!==s||e[19]!==b||e[20]!==h?(w=f($({shape:b,size:h}),s),e[18]=s,e[19]=b,e[20]=h,e[21]=w):w=e[21];let v;e[22]!==y||e[23]!==C||e[24]!==E||e[25]!==m||e[26]!==p||e[27]!==u||e[28]!==h||e[29]!==l?(v=p&&E?i.jsx("div",{className:f("flex items-center justify-center w-full h-full",y),children:i.jsx(V,{size:D(h)})}):i.jsxs(i.Fragment,{children:[l&&!m&&i.jsx(_,{src:l,loading:"lazy",alt:"Avatar",className:f(B({objectFit:u})),onError:()=>x(!0)}),(!l||m)&&i.jsx(T,{className:f(y,"rounded-none"),children:C})]}),e[22]=y,e[23]=C,e[24]=E,e[25]=m,e[26]=p,e[27]=u,e[28]=h,e[29]=l,e[30]=v):v=e[30];let A;return e[31]!==o||e[32]!==v||e[33]!==w?(A=i.jsx(O,{className:w,...o,children:v}),e[31]=o,e[32]=v,e[33]=w,e[34]=A):A=e[34],A}function H(a){const e=j.c(18);let s,t,o,r,n,d,g,l;e[0]!==a?({shape:r,size:n,url:l,fallback:t,objectFit:d,className:s,muted:g,...o}=a,e[0]=a,e[1]=s,e[2]=t,e[3]=o,e[4]=r,e[5]=n,e[6]=d,e[7]=g,e[8]=l):(s=e[1],t=e[2],o=e[3],r=e[4],n=e[5],d=e[6],g=e[7],l=e[8]);const b=r===void 0?"square":r,h=n===void 0?"base":n,u=d===void 0?"cover":d,k=g===void 0?!1:g,m=h??"base";let x;return e[9]!==s||e[10]!==t||e[11]!==k||e[12]!==u||e[13]!==o||e[14]!==b||e[15]!==m||e[16]!==l?(x=i.jsx(G,{shape:b,url:l,fallback:t,size:m,objectFit:u,className:s,muted:k,...o}),e[9]=s,e[10]=t,e[11]=k,e[12]=u,e[13]=o,e[14]=b,e[15]=m,e[16]=l,e[17]=x):x=e[17],x}H.Skeleton=function({shape:e="square",size:s="base",className:t}){return i.jsx("div",{className:f($({shape:e,size:s}),"bg-muted animate-pulse",t)})};export{H as A};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as d,h as u,j as l,i as v}from"./index-A52jfksK.js";import{c as g}from"./utils-DgLfrg3u.js";const f=u("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",success:"border-transparent bg-success text-success-foreground [a&]:hover:bg-success/90 focus-visible:ring-success/20 dark:focus-visible:ring-success/40",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function m(o){const e=d.c(12);let r,s,a,t;e[0]!==o?({className:r,variant:t,asChild:a,...s}=o,e[0]=o,e[1]=r,e[2]=s,e[3]=a,e[4]=t):(r=e[1],s=e[2],a=e[3],t=e[4]);const c=(a===void 0?!1:a)?v:"span";let i;e[5]!==r||e[6]!==t?(i=g(f({variant:t}),r),e[5]=r,e[6]=t,e[7]=i):i=e[7];let n;return e[8]!==c||e[9]!==s||e[10]!==i?(n=l.jsx(c,{"data-slot":"badge",className:i,...s}),e[8]=c,e[9]=s,e[10]=i,e[11]=n):n=e[11],n}export{m as B};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bq as v,bs as p,bI as l,bJ as g,br as b,Y as f,r as u,bz as m,bK as x,c as y,h as O,j as k,i as C}from"./index-A52jfksK.js";import{c as E}from"./utils-DgLfrg3u.js";var M=class extends v{#e;#i=void 0;#t;#s;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const t=this.options;this.options=this.#e.defaultMutationOptions(e),p(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#t,observer:this}),t?.mutationKey&&this.options.mutationKey&&l(t.mutationKey)!==l(this.options.mutationKey)?this.reset():this.#t?.state.status==="pending"&&this.#t.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#t?.removeObserver(this)}onMutationUpdate(e){this.#r(),this.#o(e)}getCurrentResult(){return this.#i}reset(){this.#t?.removeObserver(this),this.#t=void 0,this.#r(),this.#o()}mutate(e,t){return this.#s=t,this.#t?.removeObserver(this),this.#t=this.#e.getMutationCache().build(this.#e,this.options),this.#t.addObserver(this),this.#t.execute(e)}#r(){const e=this.#t?.state??g();this.#i={...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset}}#o(e){b.batch(()=>{if(this.#s&&this.hasListeners()){const t=this.#i.variables,r=this.#i.context,s={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#s.onSuccess?.(e.data,t,r,s)}catch(i){Promise.reject(i)}try{this.#s.onSettled?.(e.data,null,t,r,s)}catch(i){Promise.reject(i)}}else if(e?.type==="error"){try{this.#s.onError?.(e.error,t,r,s)}catch(i){Promise.reject(i)}try{this.#s.onSettled?.(void 0,e.error,t,r,s)}catch(i){Promise.reject(i)}}}this.listeners.forEach(t=>{t(this.#i)})})}};function R(e,t){const r=f(t),[s]=u.useState(()=>new M(r,e));u.useEffect(()=>{s.setOptions(e)},[s,e]);const i=u.useSyncExternalStore(u.useCallback(o=>s.subscribe(b.batchCalls(o)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),n=u.useCallback((o,d)=>{s.mutate(o,d).catch(m)},[s]);if(i.error&&x(s.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:n,mutateAsync:i.mutate}}const S=O("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive cursor-pointer",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/80",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border text-foreground bg-background hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-foreground/80 hover:text-foreground",brand:"bg-brand-green-light text-brand-green-dark hover:bg-brand-green-light/90"},size:{default:"h-10 px-4 py-2 has-[>svg]:px-3",sm:"h-8 gap-1.5 px-3 has-[>svg]:px-2.5",xs:"h-6 gap-1 px-2 text-xs has-[>svg]:px-1.5",lg:"h-10 px-6 has-[>svg]:px-4",icon:"size-10"}},defaultVariants:{variant:"default",size:"default"}});function w(e){const t=y.c(14);let r,s,i,n,o;t[0]!==e?({className:r,variant:o,size:i,asChild:n,...s}=e,t[0]=e,t[1]=r,t[2]=s,t[3]=i,t[4]=n,t[5]=o):(r=t[1],s=t[2],i=t[3],n=t[4],o=t[5]);const c=(n===void 0?!1:n)?C:"button";let a;t[6]!==r||t[7]!==i||t[8]!==o?(a=E(S({variant:o,size:i,className:r})),t[6]=r,t[7]=i,t[8]=o,t[9]=a):a=t[9];let h;return t[10]!==c||t[11]!==s||t[12]!==a?(h=k.jsx(c,{"data-slot":"button",className:a,...s}),t[10]=c,t[11]=s,t[12]=a,t[13]=h):h=t[13],h}export{w as B,S as b,R as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as l,j as c}from"./index-A52jfksK.js";import{c as d}from"./utils-DgLfrg3u.js";function f(r){const e=l.c(8);let t,a;e[0]!==r?({className:t,...a}=r,e[0]=r,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let s;e[3]!==t?(s=d("bg-card text-card-foreground hover:bg-accent/50 flex flex-col gap-6 rounded-xl border border-border/75",t),e[3]=t,e[4]=s):s=e[4];let o;return e[5]!==a||e[6]!==s?(o=c.jsx("div",{"data-slot":"card",className:s,...a}),e[5]=a,e[6]=s,e[7]=o):o=e[7],o}function p(r){const e=l.c(8);let t,a;e[0]!==r?({className:t,...a}=r,e[0]=r,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let s;e[3]!==t?(s=d("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto]",t),e[3]=t,e[4]=s):s=e[4];let o;return e[5]!==a||e[6]!==s?(o=c.jsx("div",{"data-slot":"card-header",className:s,...a}),e[5]=a,e[6]=s,e[7]=o):o=e[7],o}function m(r){const e=l.c(8);let t,a;e[0]!==r?({className:t,...a}=r,e[0]=r,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let s;e[3]!==t?(s=d("leading-none font-semibold",t),e[3]=t,e[4]=s):s=e[4];let o;return e[5]!==a||e[6]!==s?(o=c.jsx("div",{"data-slot":"card-title",className:s,...a}),e[5]=a,e[6]=s,e[7]=o):o=e[7],o}function u(r){const e=l.c(4);let t;e[0]!==r?({...t}=r,e[0]=r,e[1]=t):t=e[1];let a;return e[2]!==t?(a=c.jsx("div",{"data-slot":"card-content",...t}),e[2]=t,e[3]=a):a=e[3],a}export{f as C,p as a,m as b,u as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as d,j as c,aW as n,aX as l}from"./index-A52jfksK.js";import{i as m}from"./tooltip-BjhP6ibY.js";import{c as b}from"./utils-DgLfrg3u.js";function f(o){const e=d.c(9);let r,a;e[0]!==o?({className:r,...a}=o,e[0]=o,e[1]=r,e[2]=a):(r=e[1],a=e[2]);let i;e[3]!==r?(i=b("peer border-foreground dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",r),e[3]=r,e[4]=i):i=e[4];let t;e[5]===Symbol.for("react.memo_cache_sentinel")?(t=c.jsx(l,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-primary-foreground transition-none",children:c.jsx(m,{className:"size-3.5"})}),e[5]=t):t=e[5];let s;return e[6]!==a||e[7]!==i?(s=c.jsx(n,{"data-slot":"checkbox",className:i,...a,children:t}),e[6]=a,e[7]=i,e[8]=s):s=e[8],s}export{f as C};
|