@decocms/mesh 2.22.2 → 2.23.0

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.
Files changed (141) hide show
  1. package/dist/client/assets/{AlertCircle-BRYxEd9U.js → AlertCircle-dEcHwNvu.js} +1 -1
  2. package/dist/client/assets/{ArrowLeft-BQ7IVK5l.js → ArrowLeft-eZvzO76t.js} +1 -1
  3. package/dist/client/assets/{ArrowUp-BHV7fQvC.js → ArrowUp-BdwrcvLj.js} +1 -1
  4. package/dist/client/assets/{Check-01TyG8gs.js → Check-DJs0YqZi.js} +1 -1
  5. package/dist/client/assets/{ChevronDown-Bk7OKoGa.js → ChevronDown-BHw4CEHT.js} +1 -1
  6. package/dist/client/assets/{Code01-dW-GUA8c.js → Code01-xWpZseL3.js} +1 -1
  7. package/dist/client/assets/{Copy01-Cci5IJlw.js → Copy01-BxNbv5WX.js} +1 -1
  8. package/dist/client/assets/{DotsHorizontal-B46rT1E7.js → DotsHorizontal-CRhKrolj.js} +1 -1
  9. package/dist/client/assets/{DotsVertical-BqUSftJK.js → DotsVertical-D7K0CcQb.js} +1 -1
  10. package/dist/client/assets/{Download01-DtRalfBM.js → Download01-BfuDLb5V.js} +1 -1
  11. package/dist/client/assets/{Edit01-gvkP_dl-.js → Edit01-C3hV44dM.js} +1 -1
  12. package/dist/client/assets/{File06-ByA_vTun.js → File06-Dr-pZoRh.js} +1 -1
  13. package/dist/client/assets/{FilterLines-GHP-QaK4.js → FilterLines-DlQeD9pp.js} +1 -1
  14. package/dist/client/assets/{FlipBackward-BS3V82bC.js → FlipBackward-C3IXOuCk.js} +1 -1
  15. package/dist/client/assets/{GitBranch01-tvqRSCfh.js → GitBranch01-BjXSs4r7.js} +1 -1
  16. package/dist/client/assets/{Grid01-DlRq7T-9.js → Grid01-DfwQCcJX.js} +1 -1
  17. package/dist/client/assets/{Home02-B_0su9RA.js → Home02-DNnnPfH8.js} +1 -1
  18. package/dist/client/assets/{Image01-CHyuHHfR.js → Image01-5jKR96Lo.js} +1 -1
  19. package/dist/client/assets/{Inbox01-BT2JYivP.js → Inbox01-Buki2Nma.js} +1 -1
  20. package/dist/client/assets/{InfoCircle-CVbq8jCi.js → InfoCircle-CEa7ZRhC.js} +1 -1
  21. package/dist/client/assets/{Key01-CR3co8Y_.js → Key01-PlcAfeux.js} +1 -1
  22. package/dist/client/assets/{LinkExternal01-DKnd8nXA.js → LinkExternal01-CuM6kIhv.js} +1 -1
  23. package/dist/client/assets/{List-BMChI4Jp.js → List-i3XXXryR.js} +1 -1
  24. package/dist/client/assets/{Loading01-Ciunqme0.js → Loading01-Cylg3-_j.js} +1 -1
  25. package/dist/client/assets/{Lock01-Z2BgitgI.js → Lock01-ClIEB2Fy.js} +1 -1
  26. package/dist/client/assets/{Play-ftmsq5JK.js → Play-CMKVnY1Z.js} +1 -1
  27. package/dist/client/assets/{Plus-Dr1frakx.js → Plus-wyZMrN65.js} +1 -1
  28. package/dist/client/assets/{SearchMd-BdgkqD1I.js → SearchMd-BOjdxcEh.js} +1 -1
  29. package/dist/client/assets/{Terminal-C6MHBgjq.js → Terminal-DvzUlVBL.js} +1 -1
  30. package/dist/client/assets/{Trash01-O7XdHeVF.js → Trash01-DAF4JR6x.js} +1 -1
  31. package/dist/client/assets/{Upload01-oZYrY2i5.js → Upload01-6Rm3aV0f.js} +1 -1
  32. package/dist/client/assets/{X-CBxJpjg0.js → X-C1UdIYIh.js} +1 -1
  33. package/dist/client/assets/{XClose-CZV8y02_.js → XClose-1JLC1PPk.js} +1 -1
  34. package/dist/client/assets/{agent-detail-CZykGi9X.js → agent-detail-hknWm8wM.js} +1 -1
  35. package/dist/client/assets/{agents-C2xykK68.js → agents-DGBA3rS-.js} +1 -1
  36. package/dist/client/assets/{alert-dialog-VCUJKSC8.js → alert-dialog-DrfswxC3.js} +1 -1
  37. package/dist/client/assets/{auth-catchall-eqWzQgEV.js → auth-catchall-BDJW0dP0.js} +1 -1
  38. package/dist/client/assets/{avatar-BTpw67uu.js → avatar-1eewp_9T.js} +1 -1
  39. package/dist/client/assets/{badge-BBWbP67q.js → badge-DRhtTp4k.js} +1 -1
  40. package/dist/client/assets/{binder-C7ZGqrKK.js → binder-DyJ0n4d5.js} +1 -1
  41. package/dist/client/assets/{button-CSCVKnjE.js → button-BdSVK2Y9.js} +1 -1
  42. package/dist/client/assets/{card-DIp7Pbbe.js → card-CS2qDNmL.js} +1 -1
  43. package/dist/client/assets/{checkbox-B4SYjdp8.js → checkbox-UBHz0rhu.js} +1 -1
  44. package/dist/client/assets/collection-detail-BrwhgZKR.js +26 -0
  45. package/dist/client/assets/{collection-display-button-DJ1AY12f.js → collection-display-button-DYQdZVaC.js} +1 -1
  46. package/dist/client/assets/{collection-header-BexgULaJ.js → collection-header-Bq_pwY0d.js} +1 -1
  47. package/dist/client/assets/{collection-page-CFeLb91S.js → collection-page-BRLilQpU.js} +1 -1
  48. package/dist/client/assets/{collection-search-BIaqbS2d.js → collection-search-fNZmcrVl.js} +1 -1
  49. package/dist/client/assets/{collection-tab-B6gVlnp1.js → collection-tab-DDZ2Ixb6.js} +1 -1
  50. package/dist/client/assets/{collection-table-wrapper-D_9AP4Xy.js → collection-table-wrapper-CyayHVF2.js} +1 -1
  51. package/dist/client/assets/{connection-BOiZ4DhB.js → connection-BQ8tHXWt.js} +1 -1
  52. package/dist/client/assets/{connection-card-B7L3EvSn.js → connection-card-Cy-WH2qu.js} +1 -1
  53. package/dist/client/assets/connection-detail-C7xMANsY.js +1 -0
  54. package/dist/client/assets/{connections-bna1FNR4.js → connections-ChxanEg9.js} +1 -1
  55. package/dist/client/assets/constants-CQ9jNG-d.js +1 -0
  56. package/dist/client/assets/{create-organization-dialog-DrPDs6B5.js → create-organization-dialog-B7y_HgAC.js} +1 -1
  57. package/dist/client/assets/{dialog-BKcENWTv.js → dialog-8xt9wG3a.js} +1 -1
  58. package/dist/client/assets/{dropdown-menu-6yOcAo_W.js → dropdown-menu-DqYEi1G5.js} +1 -1
  59. package/dist/client/assets/{dynamic-plugin-layout-DgPbTvHX.js → dynamic-plugin-layout-C3O7bg_M.js} +1 -1
  60. package/dist/client/assets/{empty-state-CaPNxgdS.js → empty-state-BU13D_5m.js} +1 -1
  61. package/dist/client/assets/{empty-state-CKHPbxeg.js → empty-state-CiuhUK_-.js} +1 -1
  62. package/dist/client/assets/{env-vars-editor-DB9sQiDh.js → env-vars-editor-BRNWnsg6.js} +1 -1
  63. package/dist/client/assets/{error-boundary-CZ-hRbTW.js → error-boundary-vxKcv_5V.js} +1 -1
  64. package/dist/client/assets/{extract-connection-data-xYehFtf9.js → extract-connection-data-CinkvG5b.js} +1 -1
  65. package/dist/client/assets/{file-browser-BU2xrvlc.js → file-browser-rsKcak0O.js} +2 -2
  66. package/dist/client/assets/{form-D-QUdO0s.js → form-ma_v39Z5.js} +1 -1
  67. package/dist/client/assets/{grid-view-D1lCA5Sx.js → grid-view-DcOXEb0G.js} +1 -1
  68. package/dist/client/assets/{home-B80k-FcM.js → home--jDS6MVF.js} +1 -1
  69. package/dist/client/assets/index-BOoYPbIt.css +1 -0
  70. package/dist/client/assets/{index-CViGbTGN.js → index-C4mGuHAC.js} +1 -1
  71. package/dist/client/assets/index-CQIgeebv.js +257 -0
  72. package/dist/client/assets/{index-BADGsnm_.js → index-CRvHJTW7.js} +3 -3
  73. package/dist/client/assets/{index-D4I3u5rj.js → index-cqIglj_S.js} +1 -1
  74. package/dist/client/assets/{index-BEzz4Zqk.js → index-uCF3-oVs.js} +1 -1
  75. package/dist/client/assets/{infiniteQueryObserver-DoGEx2i9.js → infiniteQueryObserver-VFy8EVgA.js} +1 -1
  76. package/dist/client/assets/{input-BDWPxnpd.js → input-LAgwngta.js} +1 -1
  77. package/dist/client/assets/{layout-DEupYEZG.js → layout-73cB5ydN.js} +1 -1
  78. package/dist/client/assets/{localstorage-keys-eASnOQ5z.js → localstorage-keys-DHv4MWFb.js} +1 -1
  79. package/dist/client/assets/{login-H-3KOz_a.js → login-Bm0d_hLp.js} +1 -1
  80. package/dist/client/assets/{mcp-oauth-8-FuZodO.js → mcp-oauth-CbqmzlCO.js} +1 -1
  81. package/dist/client/assets/{mcp-server-card-jC-20C4W.js → mcp-server-card-DYsz-3kg.js} +1 -1
  82. package/dist/client/assets/{mcp-server-detail-C4TwgL7p.js → mcp-server-detail-C6U67vaE.js} +1 -1
  83. package/dist/client/assets/{members-BF2WYhNd.js → members-B0LplyJl.js} +1 -1
  84. package/dist/client/assets/{monaco-editor-BDsCepgw.js → monaco-editor-DMkLPPQN.js} +1 -1
  85. package/dist/client/assets/{monitoring-1Ei05IVG.js → monitoring-D2jTU4Xy.js} +1 -1
  86. package/dist/client/assets/{oauth-callback-UV6p5nJu.js → oauth-callback-p1aa38Yf.js} +1 -1
  87. package/dist/client/assets/page-tFfKi6n5.js +21 -0
  88. package/dist/client/assets/{page-IRt77uto.js → page-ynBFOcV5.js} +1 -1
  89. package/dist/client/assets/{pin-to-sidebar-button-BfOZ995T.js → pin-to-sidebar-button-C-Z1z0zw.js} +1 -1
  90. package/dist/client/assets/{plugin-empty-state-CvCBkNU_.js → plugin-empty-state-yhV7v50y.js} +1 -1
  91. package/dist/client/assets/{plugin-header-CT5ofHVa.js → plugin-header-D4F6m1rC.js} +1 -1
  92. package/dist/client/assets/{plugins-BM-POIbA.js → plugins-rIvTXx9l.js} +1 -1
  93. package/dist/client/assets/{popover-Bol-owE5.js → popover-DxBUoQOr.js} +1 -1
  94. package/dist/client/assets/{project-context-provider-BrEPJG0C.js → project-context-provider-BOp7y-sm.js} +1 -1
  95. package/dist/client/assets/{registry-utils-qr2hWyuD.js → registry-utils-DfaYKsYd.js} +1 -1
  96. package/dist/client/assets/{resizable-5YkDxOnG.js → resizable-YIVvLAMI.js} +1 -1
  97. package/dist/client/assets/{resource-tabs-CoVc7CCV.js → resource-tabs-CXiDC84e.js} +1 -1
  98. package/dist/client/assets/select-CQxwh50L.js +1 -0
  99. package/dist/client/assets/{settings-DR5TOYQT.js → settings-DRtRZS8m.js} +1 -1
  100. package/dist/client/assets/{shell-layout-BUa4VNmw.js → shell-layout-CR8loLbO.js} +1 -1
  101. package/dist/client/assets/{spinner-CVaIYhex.js → spinner-B1_J8xfL.js} +1 -1
  102. package/dist/client/assets/{switch-DXIwD9IB.js → switch-rdGkoPqi.js} +1 -1
  103. package/dist/client/assets/{textarea-CjiaCeZv.js → textarea-CCB_cBLX.js} +1 -1
  104. package/dist/client/assets/{tool-set-selector-NKABlXdy.js → tool-set-selector-NB5yXl6l.js} +1 -1
  105. package/dist/client/assets/{tools-list-Dlo-5MDO.js → tools-list-Dt72BK-a.js} +1 -1
  106. package/dist/client/assets/{tooltip-Dh7pKOjr.js → tooltip-CE9zYFg3.js} +1 -1
  107. package/dist/client/assets/{typewriter-title-D71dWYOo.js → typewriter-title-DHXaFYv3.js} +1 -1
  108. package/dist/client/assets/{use-binding-CMrf28mD.js → use-binding-CPgE3BWS.js} +1 -1
  109. package/dist/client/assets/{use-collections-BYXeN_Z5.js → use-collections-B9erc3lD.js} +1 -1
  110. package/dist/client/assets/{use-connection-CfZ0Vu4z.js → use-connection-BdE78hZ6.js} +1 -1
  111. package/dist/client/assets/{use-connection-resources-DpopeA_b.js → use-connection-resources-BfpTQVnT.js} +1 -1
  112. package/dist/client/assets/{use-create-virtual-mcp-DLEcqdBk.js → use-create-virtual-mcp-C5Hckkr_.js} +1 -1
  113. package/dist/client/assets/{use-list-state-D02T_aKE.js → use-list-state-TVJ_6wgx.js} +1 -1
  114. package/dist/client/assets/{use-mcp-BLkJq7bN.js → use-mcp-BsV0E2Ee.js} +1 -1
  115. package/dist/client/assets/{use-members-v6U7Oi6B.js → use-members-B2abMujF.js} +1 -1
  116. package/dist/client/assets/{use-mobile-BDBdLYs3.js → use-mobile-bGvEd-ta.js} +1 -1
  117. package/dist/client/assets/{use-organization-settings-BznzPQgX.js → use-organization-settings-BamfW6UJ.js} +1 -1
  118. package/dist/client/assets/{use-tool-call-C-s97CRj.js → use-tool-call-TbtZFKnf.js} +1 -1
  119. package/dist/client/assets/{use-virtual-mcp-BLBflG-l.js → use-virtual-mcp-BnJrA4bQ.js} +1 -1
  120. package/dist/client/assets/{use-virtual-mcp-system-prompt-XZLo_ZYW.js → use-virtual-mcp-system-prompt-DpDoqfDG.js} +1 -1
  121. package/dist/client/assets/useInfiniteQuery-0K-4osaV.js +1 -0
  122. package/dist/client/assets/{useMutation-DX2iB0kT.js → useMutation-AON1uiHs.js} +1 -1
  123. package/dist/client/assets/useQuery-Bvq31XvZ.js +1 -0
  124. package/dist/client/assets/{value-Dzu-joN0.js → value-D9P4r7rT.js} +1 -1
  125. package/dist/client/assets/{view-mode-toggle-DSycgDld.js → view-mode-toggle-CKrW8N1p.js} +1 -1
  126. package/dist/client/assets/{workflow-DaenHlXi.js → workflow-FBTK819O.js} +1 -1
  127. package/dist/client/index.html +2 -2
  128. package/dist/server/cli.js +1 -1
  129. package/dist/server/migrate.js +1 -1
  130. package/dist/server/server.js +1 -1
  131. package/package.json +21 -11
  132. package/dist/client/assets/collection-detail-DjOL7Bjs.js +0 -165
  133. package/dist/client/assets/connection-detail-C63xtruJ.js +0 -1
  134. package/dist/client/assets/constants-CRHWvr6r.js +0 -1
  135. package/dist/client/assets/index-DGVUoQ0k.js +0 -107
  136. package/dist/client/assets/index-H07QDM93.css +0 -1
  137. package/dist/client/assets/lazy-highlighter-Bn9myoq9.js +0 -9
  138. package/dist/client/assets/page-BXvciBeM.js +0 -21
  139. package/dist/client/assets/select-CncHydKl.js +0 -1
  140. package/dist/client/assets/useInfiniteQuery-B1vlCJEQ.js +0 -1
  141. package/dist/client/assets/useQuery-BloC42s4.js +0 -1
@@ -228,7 +228,7 @@ To prepare for this change:
228
228
  - If you want the current behavior, explicitly use 'sslmode=verify-full'
229
229
  - If you want libpq compatibility now, use 'uselibpqcompat=true&sslmode=${X}'
230
230
 
231
- See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode definitions.`)}Ks0.exports=iz;iz.parse=iz;iz.toClientConfig=$s0;iz.parseIntoClientConfig=JD6});var me=I((OE4,zs0)=>{var GD6=z0("dns"),Vs0=iw(),Fs0=Hs0().parse,zY=function(X,Y,Q){if(Y[X])return Y[X];if(Q===void 0)Q=process.env["PG"+X.toUpperCase()];else if(Q===!1);else Q=process.env[Q];return Q||Vs0[X]},WD6=function(){switch(process.env.PGSSLMODE){case"disable":return!1;case"prefer":case"require":case"verify-ca":case"verify-full":return!0;case"no-verify":return{rejectUnauthorized:!1}}return Vs0.ssl},az=function(X){return"'"+(""+X).replace(/\\/g,"\\\\").replace(/'/g,"\\'")+"'"},SJ=function(X,Y,Q){let J=Y[Q];if(J!==void 0&&J!==null)X.push(Q+"="+az(J))};class qs0{constructor(X){if(X=typeof X==="string"?Fs0(X):X||{},X.connectionString)X=Object.assign({},X,Fs0(X.connectionString));if(this.user=zY("user",X),this.database=zY("database",X),this.database===void 0)this.database=this.user;if(this.port=parseInt(zY("port",X),10),this.host=zY("host",X),Object.defineProperty(this,"password",{configurable:!0,enumerable:!1,writable:!0,value:zY("password",X)}),this.binary=zY("binary",X),this.options=zY("options",X),this.ssl=typeof X.ssl>"u"?WD6():X.ssl,typeof this.ssl==="string"){if(this.ssl==="true")this.ssl=!0}if(this.ssl==="no-verify")this.ssl={rejectUnauthorized:!1};if(this.ssl&&this.ssl.key)Object.defineProperty(this.ssl,"key",{enumerable:!1});if(this.client_encoding=zY("client_encoding",X),this.replication=zY("replication",X),this.isDomainSocket=!(this.host||"").indexOf("/"),this.application_name=zY("application_name",X,"PGAPPNAME"),this.fallback_application_name=zY("fallback_application_name",X,!1),this.statement_timeout=zY("statement_timeout",X,!1),this.lock_timeout=zY("lock_timeout",X,!1),this.idle_in_transaction_session_timeout=zY("idle_in_transaction_session_timeout",X,!1),this.query_timeout=zY("query_timeout",X,!1),X.connectionTimeoutMillis===void 0)this.connect_timeout=process.env.PGCONNECT_TIMEOUT||0;else this.connect_timeout=Math.floor(X.connectionTimeoutMillis/1000);if(X.keepAlive===!1)this.keepalives=0;else if(X.keepAlive===!0)this.keepalives=1;if(typeof X.keepAliveInitialDelayMillis==="number")this.keepalives_idle=Math.floor(X.keepAliveInitialDelayMillis/1000)}getLibpqConnectionString(X){let Y=[];SJ(Y,this,"user"),SJ(Y,this,"password"),SJ(Y,this,"port"),SJ(Y,this,"application_name"),SJ(Y,this,"fallback_application_name"),SJ(Y,this,"connect_timeout"),SJ(Y,this,"options");let Q=typeof this.ssl==="object"?this.ssl:this.ssl?{sslmode:this.ssl}:{};if(SJ(Y,Q,"sslmode"),SJ(Y,Q,"sslca"),SJ(Y,Q,"sslkey"),SJ(Y,Q,"sslcert"),SJ(Y,Q,"sslrootcert"),this.database)Y.push("dbname="+az(this.database));if(this.replication)Y.push("replication="+az(this.replication));if(this.host)Y.push("host="+az(this.host));if(this.isDomainSocket)return X(null,Y.join(" "));if(this.client_encoding)Y.push("client_encoding="+az(this.client_encoding));GD6.lookup(this.host,function(J,G){if(J)return X(J,null);return Y.push("hostaddr="+az(G)),X(null,Y.join(" "))})}}zs0.exports=qs0});var le=I((LE4,Ds0)=>{var ZD6=nw(),Us0=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/;class Bs0{constructor(X,Y){if(this.command=null,this.rowCount=null,this.oid=null,this.rows=[],this.fields=[],this._parsers=void 0,this._types=Y,this.RowCtor=null,this.rowAsArray=X==="array",this.rowAsArray)this.parseRow=this._parseRowAsArray;this._prebuiltEmptyResultObject=null}addCommandComplete(X){let Y;if(X.text)Y=Us0.exec(X.text);else Y=Us0.exec(X.command);if(Y){if(this.command=Y[1],Y[3])this.oid=parseInt(Y[2],10),this.rowCount=parseInt(Y[3],10);else if(Y[2])this.rowCount=parseInt(Y[2],10)}}_parseRowAsArray(X){let Y=Array(X.length);for(let Q=0,J=X.length;Q<J;Q++){let G=X[Q];if(G!==null)Y[Q]=this._parsers[Q](G);else Y[Q]=null}return Y}parseRow(X){let Y={...this._prebuiltEmptyResultObject};for(let Q=0,J=X.length;Q<J;Q++){let G=X[Q],W=this.fields[Q].name;if(G!==null){let Z=this.fields[Q].format==="binary"?Buffer.from(G):G;Y[W]=this._parsers[Q](Z)}else Y[W]=null}return Y}addRow(X){this.rows.push(X)}addFields(X){if(this.fields=X,this.fields.length)this._parsers=Array(X.length);let Y={};for(let Q=0;Q<X.length;Q++){let J=X[Q];if(Y[J.name]=null,this._types)this._parsers[Q]=this._types.getTypeParser(J.dataTypeID,J.format||"text");else this._parsers[Q]=ZD6.getTypeParser(J.dataTypeID,J.format||"text")}this._prebuiltEmptyResultObject={...Y}}}Ds0.exports=Bs0});var Ms0=I((wE4,ws0)=>{var{EventEmitter:$D6}=z0("events"),Ns0=le(),Os0=cz();class Ls0 extends $D6{constructor(X,Y,Q){super();if(X=Os0.normalizeQueryConfig(X,Y,Q),this.text=X.text,this.values=X.values,this.rows=X.rows,this.types=X.types,this.name=X.name,this.queryMode=X.queryMode,this.binary=X.binary,this.portal=X.portal||"",this.callback=X.callback,this._rowMode=X.rowMode,process.domain&&X.callback)this.callback=process.domain.bind(X.callback);this._result=new Ns0(this._rowMode,this.types),this._results=this._result,this._canceledDueToError=!1}requiresPreparation(){if(this.queryMode==="extended")return!0;if(this.name)return!0;if(this.rows)return!0;if(!this.text)return!1;if(!this.values)return!1;return this.values.length>0}_checkForMultirow(){if(this._result.command){if(!Array.isArray(this._results))this._results=[this._result];this._result=new Ns0(this._rowMode,this._result._types),this._results.push(this._result)}}handleRowDescription(X){this._checkForMultirow(),this._result.addFields(X.fields),this._accumulateRows=this.callback||!this.listeners("row").length}handleDataRow(X){let Y;if(this._canceledDueToError)return;try{Y=this._result.parseRow(X.fields)}catch(Q){this._canceledDueToError=Q;return}if(this.emit("row",Y,this._result),this._accumulateRows)this._result.addRow(Y)}handleCommandComplete(X,Y){if(this._checkForMultirow(),this._result.addCommandComplete(X),this.rows)Y.sync()}handleEmptyQuery(X){if(this.rows)X.sync()}handleError(X,Y){if(this._canceledDueToError)X=this._canceledDueToError,this._canceledDueToError=!1;if(this.callback)return this.callback(X);this.emit("error",X)}handleReadyForQuery(X){if(this._canceledDueToError)return this.handleError(this._canceledDueToError,X);if(this.callback)try{this.callback(null,this._results)}catch(Y){process.nextTick(()=>{throw Y})}this.emit("end",this._results)}submit(X){if(typeof this.text!=="string"&&typeof this.name!=="string")return Error("A query must have either text or a name. Supplying neither is unsupported.");let Y=X.parsedStatements[this.name];if(this.text&&Y&&this.text!==Y)return Error(`Prepared statements must be unique - '${this.name}' was used for a different statement`);if(this.values&&!Array.isArray(this.values))return Error("Query values must be an array");if(this.requiresPreparation()){X.stream.cork&&X.stream.cork();try{this.prepare(X)}finally{X.stream.uncork&&X.stream.uncork()}}else X.query(this.text);return null}hasBeenParsed(X){return this.name&&X.parsedStatements[this.name]}handlePortalSuspended(X){this._getRows(X,this.rows)}_getRows(X,Y){if(X.execute({portal:this.portal,rows:Y}),!Y)X.sync();else X.flush()}prepare(X){if(!this.hasBeenParsed(X))X.parse({text:this.text,name:this.name,types:this.types});try{X.bind({portal:this.portal,statement:this.name,values:this.values,binary:this.binary,valueMapper:Os0.prepareValue})}catch(Y){this.handleError(Y,X);return}X.describe({type:"P",name:this.portal||""}),this._getRows(X,this.rows)}handleCopyInResponse(X){X.sendCopyFail("No source stream defined")}handleCopyData(X,Y){}}ws0.exports=Ls0});var de=I((fs0)=>{Object.defineProperty(fs0,"__esModule",{value:!0});fs0.NoticeMessage=fs0.DataRowMessage=fs0.CommandCompleteMessage=fs0.ReadyForQueryMessage=fs0.NotificationResponseMessage=fs0.BackendKeyDataMessage=fs0.AuthenticationMD5Password=fs0.ParameterStatusMessage=fs0.ParameterDescriptionMessage=fs0.RowDescriptionMessage=fs0.Field=fs0.CopyResponse=fs0.CopyDataMessage=fs0.DatabaseError=fs0.copyDone=fs0.emptyQuery=fs0.replicationStart=fs0.portalSuspended=fs0.noData=fs0.closeComplete=fs0.bindComplete=fs0.parseComplete=void 0;fs0.parseComplete={name:"parseComplete",length:5};fs0.bindComplete={name:"bindComplete",length:5};fs0.closeComplete={name:"closeComplete",length:5};fs0.noData={name:"noData",length:5};fs0.portalSuspended={name:"portalSuspended",length:5};fs0.replicationStart={name:"replicationStart",length:4};fs0.emptyQuery={name:"emptyQuery",length:4};fs0.copyDone={name:"copyDone",length:4};class Ps0 extends Error{constructor(X,Y,Q){super(X);this.length=Y,this.name=Q}}fs0.DatabaseError=Ps0;class Ts0{constructor(X,Y){this.length=X,this.chunk=Y,this.name="copyData"}}fs0.CopyDataMessage=Ts0;class As0{constructor(X,Y,Q,J){this.length=X,this.name=Y,this.binary=Q,this.columnTypes=Array(J)}}fs0.CopyResponse=As0;class Es0{constructor(X,Y,Q,J,G,W,Z){this.name=X,this.tableID=Y,this.columnID=Q,this.dataTypeID=J,this.dataTypeSize=G,this.dataTypeModifier=W,this.format=Z}}fs0.Field=Es0;class js0{constructor(X,Y){this.length=X,this.fieldCount=Y,this.name="rowDescription",this.fields=Array(this.fieldCount)}}fs0.RowDescriptionMessage=js0;class Cs0{constructor(X,Y){this.length=X,this.parameterCount=Y,this.name="parameterDescription",this.dataTypeIDs=Array(this.parameterCount)}}fs0.ParameterDescriptionMessage=Cs0;class Is0{constructor(X,Y,Q){this.length=X,this.parameterName=Y,this.parameterValue=Q,this.name="parameterStatus"}}fs0.ParameterStatusMessage=Is0;class Rs0{constructor(X,Y){this.length=X,this.salt=Y,this.name="authenticationMD5Password"}}fs0.AuthenticationMD5Password=Rs0;class Ss0{constructor(X,Y,Q){this.length=X,this.processID=Y,this.secretKey=Q,this.name="backendKeyData"}}fs0.BackendKeyDataMessage=Ss0;class ks0{constructor(X,Y,Q,J){this.length=X,this.processId=Y,this.channel=Q,this.payload=J,this.name="notification"}}fs0.NotificationResponseMessage=ks0;class vs0{constructor(X,Y){this.length=X,this.status=Y,this.name="readyForQuery"}}fs0.ReadyForQueryMessage=vs0;class _s0{constructor(X,Y){this.length=X,this.text=Y,this.name="commandComplete"}}fs0.CommandCompleteMessage=_s0;class ys0{constructor(X,Y){this.length=X,this.fields=Y,this.name="dataRow",this.fieldCount=Y.length}}fs0.DataRowMessage=ys0;class bs0{constructor(X,Y){this.length=X,this.message=Y,this.name="notice"}}fs0.NoticeMessage=bs0});var ms0=I((gs0)=>{Object.defineProperty(gs0,"__esModule",{value:!0});gs0.Writer=void 0;class xs0{constructor(X=256){this.size=X,this.offset=5,this.headerPosition=0,this.buffer=Buffer.allocUnsafe(X)}ensure(X){if(this.buffer.length-this.offset<X){let Q=this.buffer,J=Q.length+(Q.length>>1)+X;this.buffer=Buffer.allocUnsafe(J),Q.copy(this.buffer)}}addInt32(X){return this.ensure(4),this.buffer[this.offset++]=X>>>24&255,this.buffer[this.offset++]=X>>>16&255,this.buffer[this.offset++]=X>>>8&255,this.buffer[this.offset++]=X>>>0&255,this}addInt16(X){return this.ensure(2),this.buffer[this.offset++]=X>>>8&255,this.buffer[this.offset++]=X>>>0&255,this}addCString(X){if(!X)this.ensure(1);else{let Y=Buffer.byteLength(X);this.ensure(Y+1),this.buffer.write(X,this.offset,"utf-8"),this.offset+=Y}return this.buffer[this.offset++]=0,this}addString(X=""){let Y=Buffer.byteLength(X);return this.ensure(Y),this.buffer.write(X,this.offset),this.offset+=Y,this}add(X){return this.ensure(X.length),X.copy(this.buffer,this.offset),this.offset+=X.length,this}join(X){if(X){this.buffer[this.headerPosition]=X;let Y=this.offset-(this.headerPosition+1);this.buffer.writeInt32BE(Y,this.headerPosition+1)}return this.buffer.slice(X?0:5,this.offset)}flush(X){let Y=this.join(X);return this.offset=5,this.headerPosition=0,this.buffer=Buffer.allocUnsafe(this.size),Y}}gs0.Writer=xs0});var cs0=I((ds0)=>{Object.defineProperty(ds0,"__esModule",{value:!0});ds0.serialize=void 0;var pe=ms0(),N8=new pe.Writer,RD6=(X)=>{N8.addInt16(3).addInt16(0);for(let J of Object.keys(X))N8.addCString(J).addCString(X[J]);N8.addCString("client_encoding").addCString("UTF8");let Y=N8.addCString("").flush(),Q=Y.length+4;return new pe.Writer().addInt32(Q).add(Y).flush()},SD6=()=>{let X=Buffer.allocUnsafe(8);return X.writeInt32BE(8,0),X.writeInt32BE(80877103,4),X},kD6=(X)=>{return N8.addCString(X).flush(112)},vD6=function(X,Y){return N8.addCString(X).addInt32(Buffer.byteLength(Y)).addString(Y),N8.flush(112)},_D6=function(X){return N8.addString(X).flush(112)},yD6=(X)=>{return N8.addCString(X).flush(81)},ls0=[],bD6=(X)=>{let Y=X.name||"";if(Y.length>63)console.error("Warning! Postgres only supports 63 characters for query names."),console.error("You supplied %s (%s)",Y,Y.length),console.error("This can cause conflicts and silent errors executing queries");let Q=X.types||ls0,J=Q.length,G=N8.addCString(Y).addCString(X.text).addInt16(J);for(let W=0;W<J;W++)G.addInt32(Q[W]);return N8.flush(80)},rz=new pe.Writer,fD6=function(X,Y){for(let Q=0;Q<X.length;Q++){let J=Y?Y(X[Q],Q):X[Q];if(J==null)N8.addInt16(0),rz.addInt32(-1);else if(J instanceof Buffer)N8.addInt16(1),rz.addInt32(J.length),rz.add(J);else N8.addInt16(0),rz.addInt32(Buffer.byteLength(J)),rz.addString(J)}},hD6=(X={})=>{let Y=X.portal||"",Q=X.statement||"",J=X.binary||!1,G=X.values||ls0,W=G.length;return N8.addCString(Y).addCString(Q),N8.addInt16(W),fD6(G,X.valueMapper),N8.addInt16(W),N8.add(rz.flush()),N8.addInt16(1),N8.addInt16(J?1:0),N8.flush(66)},xD6=Buffer.from([69,0,0,0,9,0,0,0,0,0]),gD6=(X)=>{if(!X||!X.portal&&!X.rows)return xD6;let Y=X.portal||"",Q=X.rows||0,J=Buffer.byteLength(Y),G=4+J+1+4,W=Buffer.allocUnsafe(1+G);return W[0]=69,W.writeInt32BE(G,1),W.write(Y,5,"utf-8"),W[J+5]=0,W.writeUInt32BE(Q,W.length-4),W},uD6=(X,Y)=>{let Q=Buffer.allocUnsafe(16);return Q.writeInt32BE(16,0),Q.writeInt16BE(1234,4),Q.writeInt16BE(5678,6),Q.writeInt32BE(X,8),Q.writeInt32BE(Y,12),Q},ce=(X,Y)=>{let J=4+Buffer.byteLength(Y)+1,G=Buffer.allocUnsafe(1+J);return G[0]=X,G.writeInt32BE(J,1),G.write(Y,5,"utf-8"),G[J]=0,G},mD6=N8.addCString("P").flush(68),lD6=N8.addCString("S").flush(68),dD6=(X)=>{return X.name?ce(68,`${X.type}${X.name||""}`):X.type==="P"?mD6:lD6},pD6=(X)=>{let Y=`${X.type}${X.name||""}`;return ce(67,Y)},cD6=(X)=>{return N8.add(X).flush(100)},nD6=(X)=>{return ce(102,X)},Rv=(X)=>Buffer.from([X,0,0,0,4]),iD6=Rv(72),aD6=Rv(83),rD6=Rv(88),oD6=Rv(99),sD6={startup:RD6,password:kD6,requestSsl:SD6,sendSASLInitialResponseMessage:vD6,sendSCRAMClientFinalMessage:_D6,query:yD6,parse:bD6,bind:hD6,execute:gD6,describe:dD6,close:pD6,flush:()=>iD6,sync:()=>aD6,end:()=>rD6,copyData:cD6,copyDone:()=>oD6,copyFail:nD6,cancel:uD6};ds0.serialize=sD6});var rs0=I((is0)=>{Object.defineProperty(is0,"__esModule",{value:!0});is0.BufferReader=void 0;var tD6=Buffer.allocUnsafe(0);class ns0{constructor(X=0){this.offset=X,this.buffer=tD6,this.encoding="utf-8"}setBuffer(X,Y){this.offset=X,this.buffer=Y}int16(){let X=this.buffer.readInt16BE(this.offset);return this.offset+=2,X}byte(){let X=this.buffer[this.offset];return this.offset++,X}int32(){let X=this.buffer.readInt32BE(this.offset);return this.offset+=4,X}uint32(){let X=this.buffer.readUInt32BE(this.offset);return this.offset+=4,X}string(X){let Y=this.buffer.toString(this.encoding,this.offset,this.offset+X);return this.offset+=X,Y}cstring(){let X=this.offset,Y=X;while(this.buffer[Y++]!==0);return this.offset=Y,this.buffer.toString(this.encoding,X,Y-1)}bytes(X){let Y=this.buffer.slice(this.offset,this.offset+X);return this.offset+=X,Y}}is0.BufferReader=ns0});var Qt0=I((Xt0)=>{Object.defineProperty(Xt0,"__esModule",{value:!0});Xt0.Parser=void 0;var T8=de(),eD6=rs0(),ie=1,XN6=4,os0=ie+XN6,_Q=-1,ne=Buffer.allocUnsafe(0);class ts0{constructor(X){if(this.buffer=ne,this.bufferLength=0,this.bufferOffset=0,this.reader=new eD6.BufferReader,(X===null||X===void 0?void 0:X.mode)==="binary")throw Error("Binary mode not supported yet");this.mode=(X===null||X===void 0?void 0:X.mode)||"text"}parse(X,Y){this.mergeBuffer(X);let Q=this.bufferOffset+this.bufferLength,J=this.bufferOffset;while(J+os0<=Q){let G=this.buffer[J],W=this.buffer.readUInt32BE(J+ie),Z=ie+W;if(Z+J<=Q){let $=this.handlePacket(J+os0,G,W,this.buffer);Y($),J+=Z}else break}if(J===Q)this.buffer=ne,this.bufferLength=0,this.bufferOffset=0;else this.bufferLength=Q-J,this.bufferOffset=J}mergeBuffer(X){if(this.bufferLength>0){let Y=this.bufferLength+X.byteLength;if(Y+this.bufferOffset>this.buffer.byteLength){let J;if(Y<=this.buffer.byteLength&&this.bufferOffset>=this.bufferLength)J=this.buffer;else{let G=this.buffer.byteLength*2;while(Y>=G)G*=2;J=Buffer.allocUnsafe(G)}this.buffer.copy(J,0,this.bufferOffset,this.bufferOffset+this.bufferLength),this.buffer=J,this.bufferOffset=0}X.copy(this.buffer,this.bufferOffset+this.bufferLength),this.bufferLength=Y}else this.buffer=X,this.bufferOffset=0,this.bufferLength=X.byteLength}handlePacket(X,Y,Q,J){let{reader:G}=this;G.setBuffer(X,J);let W;switch(Y){case 50:W=T8.bindComplete;break;case 49:W=T8.parseComplete;break;case 51:W=T8.closeComplete;break;case 110:W=T8.noData;break;case 115:W=T8.portalSuspended;break;case 99:W=T8.copyDone;break;case 87:W=T8.replicationStart;break;case 73:W=T8.emptyQuery;break;case 68:W=FN6(G);break;case 67:W=QN6(G);break;case 90:W=YN6(G);break;case 65:W=ZN6(G);break;case 82:W=zN6(G,Q);break;case 83:W=VN6(G);break;case 75:W=qN6(G);break;case 69:W=ss0(G,"error");break;case 78:W=ss0(G,"notice");break;case 84:W=$N6(G);break;case 116:W=HN6(G);break;case 71:W=GN6(G);break;case 72:W=WN6(G);break;case 100:W=JN6(G,Q);break;default:return new T8.DatabaseError("received invalid response: "+Y.toString(16),Q,"error")}return G.setBuffer(0,ne),W.length=Q,W}}Xt0.Parser=ts0;var YN6=(X)=>{let Y=X.string(1);return new T8.ReadyForQueryMessage(_Q,Y)},QN6=(X)=>{let Y=X.cstring();return new T8.CommandCompleteMessage(_Q,Y)},JN6=(X,Y)=>{let Q=X.bytes(Y-4);return new T8.CopyDataMessage(_Q,Q)},GN6=(X)=>es0(X,"copyInResponse"),WN6=(X)=>es0(X,"copyOutResponse"),es0=(X,Y)=>{let Q=X.byte()!==0,J=X.int16(),G=new T8.CopyResponse(_Q,Y,Q,J);for(let W=0;W<J;W++)G.columnTypes[W]=X.int16();return G},ZN6=(X)=>{let Y=X.int32(),Q=X.cstring(),J=X.cstring();return new T8.NotificationResponseMessage(_Q,Y,Q,J)},$N6=(X)=>{let Y=X.int16(),Q=new T8.RowDescriptionMessage(_Q,Y);for(let J=0;J<Y;J++)Q.fields[J]=KN6(X);return Q},KN6=(X)=>{let Y=X.cstring(),Q=X.uint32(),J=X.int16(),G=X.uint32(),W=X.int16(),Z=X.int32(),$=X.int16()===0?"text":"binary";return new T8.Field(Y,Q,J,G,W,Z,$)},HN6=(X)=>{let Y=X.int16(),Q=new T8.ParameterDescriptionMessage(_Q,Y);for(let J=0;J<Y;J++)Q.dataTypeIDs[J]=X.int32();return Q},FN6=(X)=>{let Y=X.int16(),Q=Array(Y);for(let J=0;J<Y;J++){let G=X.int32();Q[J]=G===-1?null:X.string(G)}return new T8.DataRowMessage(_Q,Q)},VN6=(X)=>{let Y=X.cstring(),Q=X.cstring();return new T8.ParameterStatusMessage(_Q,Y,Q)},qN6=(X)=>{let Y=X.int32(),Q=X.int32();return new T8.BackendKeyDataMessage(_Q,Y,Q)},zN6=(X,Y)=>{let Q=X.int32(),J={name:"authenticationOk",length:Y};switch(Q){case 0:break;case 3:if(J.length===8)J.name="authenticationCleartextPassword";break;case 5:if(J.length===12){J.name="authenticationMD5Password";let G=X.bytes(4);return new T8.AuthenticationMD5Password(_Q,G)}break;case 10:{J.name="authenticationSASL",J.mechanisms=[];let G;do if(G=X.cstring(),G)J.mechanisms.push(G);while(G)}break;case 11:J.name="authenticationSASLContinue",J.data=X.string(Y-8);break;case 12:J.name="authenticationSASLFinal",J.data=X.string(Y-8);break;default:throw Error("Unknown authenticationOk message type "+Q)}return J},ss0=(X,Y)=>{let Q={},J=X.string(1);while(J!=="\x00")Q[J]=X.cstring(),J=X.string(1);let G=Q.M,W=Y==="notice"?new T8.NoticeMessage(_Q,G):new T8.DatabaseError(G,_Q,Y);return W.severity=Q.S,W.code=Q.C,W.detail=Q.D,W.hint=Q.H,W.position=Q.P,W.internalPosition=Q.p,W.internalQuery=Q.q,W.where=Q.W,W.schema=Q.s,W.table=Q.t,W.column=Q.c,W.dataType=Q.d,W.constraint=Q.n,W.file=Q.F,W.line=Q.L,W.routine=Q.R,W}});var ae=I((Sv)=>{Object.defineProperty(Sv,"__esModule",{value:!0});Sv.DatabaseError=Sv.serialize=Sv.parse=void 0;var UN6=de();Object.defineProperty(Sv,"DatabaseError",{enumerable:!0,get:function(){return UN6.DatabaseError}});var BN6=cs0();Object.defineProperty(Sv,"serialize",{enumerable:!0,get:function(){return BN6.serialize}});var DN6=Qt0();function NN6(X,Y){let Q=new DN6.Parser;return X.on("data",(J)=>Q.parse(J,Y)),new Promise((J)=>X.on("end",()=>J()))}Sv.parse=NN6});var Gt0=I((Jt0)=>{Object.defineProperty(Jt0,"__esModule",{value:!0});Jt0.default={}});var Zt0=I((RE4,Wt0)=>{var{getStream:MN6,getSecureStream:PN6}=jN6();Wt0.exports={getStream:MN6,getSecureStream:PN6};function TN6(){function X(Q){return new(z0("net")).Socket}function Y(Q){return z0("tls").connect(Q)}return{getStream:X,getSecureStream:Y}}function AN6(){function X(Q){let{CloudflareSocket:J}=Gt0();return new J(Q)}function Y(Q){return Q.socket.startTls(Q),Q.socket}return{getStream:X,getSecureStream:Y}}function EN6(){if(typeof navigator==="object"&&navigator!==null&&typeof navigator.userAgent==="string")return navigator.userAgent==="Cloudflare-Workers";if(typeof Response==="function"){let X=new Response(null,{cf:{thing:!0}});if(typeof X.cf==="object"&&X.cf!==null&&X.cf.thing)return!0}return!1}function jN6(){if(EN6())return AN6();return TN6()}});var re=I((SE4,Kt0)=>{var CN6=z0("events").EventEmitter,{parse:IN6,serialize:l9}=ae(),{getStream:RN6,getSecureStream:SN6}=Zt0(),kN6=l9.flush(),vN6=l9.sync(),_N6=l9.end();class $t0 extends CN6{constructor(X){super();if(X=X||{},this.stream=X.stream||RN6(X.ssl),typeof this.stream==="function")this.stream=this.stream(X);this._keepAlive=X.keepAlive,this._keepAliveInitialDelayMillis=X.keepAliveInitialDelayMillis,this.lastBuffer=!1,this.parsedStatements={},this.ssl=X.ssl||!1,this._ending=!1,this._emitMessage=!1;let Y=this;this.on("newListener",function(Q){if(Q==="message")Y._emitMessage=!0})}connect(X,Y){let Q=this;this._connecting=!0,this.stream.setNoDelay(!0),this.stream.connect(X,Y),this.stream.once("connect",function(){if(Q._keepAlive)Q.stream.setKeepAlive(!0,Q._keepAliveInitialDelayMillis);Q.emit("connect")});let J=function(G){if(Q._ending&&(G.code==="ECONNRESET"||G.code==="EPIPE"))return;Q.emit("error",G)};if(this.stream.on("error",J),this.stream.on("close",function(){Q.emit("end")}),!this.ssl)return this.attachListeners(this.stream);this.stream.once("data",function(G){switch(G.toString("utf8")){case"S":break;case"N":return Q.stream.end(),Q.emit("error",Error("The server does not support SSL connections"));default:return Q.stream.end(),Q.emit("error",Error("There was an error establishing an SSL connection"))}let Z={socket:Q.stream};if(Q.ssl!==!0){if(Object.assign(Z,Q.ssl),"key"in Q.ssl)Z.key=Q.ssl.key}let $=z0("net");if($.isIP&&$.isIP(Y)===0)Z.servername=Y;try{Q.stream=SN6(Z)}catch(K){return Q.emit("error",K)}Q.attachListeners(Q.stream),Q.stream.on("error",J),Q.emit("sslconnect")})}attachListeners(X){IN6(X,(Y)=>{let Q=Y.name==="error"?"errorMessage":Y.name;if(this._emitMessage)this.emit("message",Y);this.emit(Q,Y)})}requestSsl(){this.stream.write(l9.requestSsl())}startup(X){this.stream.write(l9.startup(X))}cancel(X,Y){this._send(l9.cancel(X,Y))}password(X){this._send(l9.password(X))}sendSASLInitialResponseMessage(X,Y){this._send(l9.sendSASLInitialResponseMessage(X,Y))}sendSCRAMClientFinalMessage(X){this._send(l9.sendSCRAMClientFinalMessage(X))}_send(X){if(!this.stream.writable)return!1;return this.stream.write(X)}query(X){this._send(l9.query(X))}parse(X){this._send(l9.parse(X))}bind(X){this._send(l9.bind(X))}execute(X){this._send(l9.execute(X))}flush(){if(this.stream.writable)this.stream.write(kN6)}sync(){this._ending=!0,this._send(vN6)}ref(){this.stream.ref()}unref(){this.stream.unref()}end(){if(this._ending=!0,!this._connecting||!this.stream.writable){this.stream.end();return}return this.stream.write(_N6,()=>{this.stream.end()})}close(X){this._send(l9.close(X))}describe(X){this._send(l9.describe(X))}sendCopyFromChunk(X){this._send(l9.copyData(X))}endCopyFrom(){this._send(l9.copyDone())}sendCopyFail(X){this._send(l9.copyFail(X))}}Kt0.exports=$t0});var qt0=I((kE4,Vt0)=>{var{Transform:yN6}=z0("stream"),{StringDecoder:bN6}=z0("string_decoder"),C$=Symbol("last"),kv=Symbol("decoder");function fN6(X,Y,Q){let J;if(this.overflow){if(J=this[kv].write(X).split(this.matcher),J.length===1)return Q();J.shift(),this.overflow=!1}else this[C$]+=this[kv].write(X),J=this[C$].split(this.matcher);this[C$]=J.pop();for(let G=0;G<J.length;G++)try{Ft0(this,this.mapper(J[G]))}catch(W){return Q(W)}if(this.overflow=this[C$].length>this.maxLength,this.overflow&&!this.skipOverflow){Q(Error("maximum buffer reached"));return}Q()}function hN6(X){if(this[C$]+=this[kv].end(),this[C$])try{Ft0(this,this.mapper(this[C$]))}catch(Y){return X(Y)}X()}function Ft0(X,Y){if(Y!==void 0)X.push(Y)}function Ht0(X){return X}function xN6(X,Y,Q){switch(X=X||/\r?\n/,Y=Y||Ht0,Q=Q||{},arguments.length){case 1:if(typeof X==="function")Y=X,X=/\r?\n/;else if(typeof X==="object"&&!(X instanceof RegExp)&&!X[Symbol.split])Q=X,X=/\r?\n/;break;case 2:if(typeof X==="function")Q=Y,Y=X,X=/\r?\n/;else if(typeof Y==="object")Q=Y,Y=Ht0}Q=Object.assign({},Q),Q.autoDestroy=!0,Q.transform=fN6,Q.flush=hN6,Q.readableObjectMode=!0;let J=new yN6(Q);return J[C$]="",J[kv]=new bN6("utf8"),J.matcher=X,J.mapper=Y,J.maxLength=Q.maxLength,J.skipOverflow=Q.skipOverflow||!1,J.overflow=!1,J._destroy=function(G,W){this._writableState.errorEmitted=!1,W(G)},J}Vt0.exports=xN6});var Bt0=I((sN6,wW)=>{var zt0=z0("path"),gN6=z0("stream").Stream,uN6=qt0(),Ut0=z0("util"),mN6=5432,vv=process.platform==="win32",rw=process.stderr,lN6=56,dN6=7,pN6=61440,cN6=32768;function nN6(X){return(X&pN6)==cN6}var oz=["host","port","database","user","password"],oe=oz.length,iN6=oz[oe-1];function se(){var X=rw instanceof gN6&&rw.writable===!0;if(X){var Y=Array.prototype.slice.call(arguments).concat(`
231
+ See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode definitions.`)}Ks0.exports=iz;iz.parse=iz;iz.toClientConfig=$s0;iz.parseIntoClientConfig=JD6});var me=I((OE4,zs0)=>{var GD6=z0("dns"),Vs0=iw(),Fs0=Hs0().parse,zY=function(X,Y,Q){if(Y[X])return Y[X];if(Q===void 0)Q=process.env["PG"+X.toUpperCase()];else if(Q===!1);else Q=process.env[Q];return Q||Vs0[X]},WD6=function(){switch(process.env.PGSSLMODE){case"disable":return!1;case"prefer":case"require":case"verify-ca":case"verify-full":return!0;case"no-verify":return{rejectUnauthorized:!1}}return Vs0.ssl},az=function(X){return"'"+(""+X).replace(/\\/g,"\\\\").replace(/'/g,"\\'")+"'"},SJ=function(X,Y,Q){let J=Y[Q];if(J!==void 0&&J!==null)X.push(Q+"="+az(J))};class qs0{constructor(X){if(X=typeof X==="string"?Fs0(X):X||{},X.connectionString)X=Object.assign({},X,Fs0(X.connectionString));if(this.user=zY("user",X),this.database=zY("database",X),this.database===void 0)this.database=this.user;if(this.port=parseInt(zY("port",X),10),this.host=zY("host",X),Object.defineProperty(this,"password",{configurable:!0,enumerable:!1,writable:!0,value:zY("password",X)}),this.binary=zY("binary",X),this.options=zY("options",X),this.ssl=typeof X.ssl>"u"?WD6():X.ssl,typeof this.ssl==="string"){if(this.ssl==="true")this.ssl=!0}if(this.ssl==="no-verify")this.ssl={rejectUnauthorized:!1};if(this.ssl&&this.ssl.key)Object.defineProperty(this.ssl,"key",{enumerable:!1});if(this.client_encoding=zY("client_encoding",X),this.replication=zY("replication",X),this.isDomainSocket=!(this.host||"").indexOf("/"),this.application_name=zY("application_name",X,"PGAPPNAME"),this.fallback_application_name=zY("fallback_application_name",X,!1),this.statement_timeout=zY("statement_timeout",X,!1),this.lock_timeout=zY("lock_timeout",X,!1),this.idle_in_transaction_session_timeout=zY("idle_in_transaction_session_timeout",X,!1),this.query_timeout=zY("query_timeout",X,!1),X.connectionTimeoutMillis===void 0)this.connect_timeout=process.env.PGCONNECT_TIMEOUT||0;else this.connect_timeout=Math.floor(X.connectionTimeoutMillis/1000);if(X.keepAlive===!1)this.keepalives=0;else if(X.keepAlive===!0)this.keepalives=1;if(typeof X.keepAliveInitialDelayMillis==="number")this.keepalives_idle=Math.floor(X.keepAliveInitialDelayMillis/1000)}getLibpqConnectionString(X){let Y=[];SJ(Y,this,"user"),SJ(Y,this,"password"),SJ(Y,this,"port"),SJ(Y,this,"application_name"),SJ(Y,this,"fallback_application_name"),SJ(Y,this,"connect_timeout"),SJ(Y,this,"options");let Q=typeof this.ssl==="object"?this.ssl:this.ssl?{sslmode:this.ssl}:{};if(SJ(Y,Q,"sslmode"),SJ(Y,Q,"sslca"),SJ(Y,Q,"sslkey"),SJ(Y,Q,"sslcert"),SJ(Y,Q,"sslrootcert"),this.database)Y.push("dbname="+az(this.database));if(this.replication)Y.push("replication="+az(this.replication));if(this.host)Y.push("host="+az(this.host));if(this.isDomainSocket)return X(null,Y.join(" "));if(this.client_encoding)Y.push("client_encoding="+az(this.client_encoding));GD6.lookup(this.host,function(J,G){if(J)return X(J,null);return Y.push("hostaddr="+az(G)),X(null,Y.join(" "))})}}zs0.exports=qs0});var le=I((LE4,Ds0)=>{var ZD6=nw(),Us0=/^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/;class Bs0{constructor(X,Y){if(this.command=null,this.rowCount=null,this.oid=null,this.rows=[],this.fields=[],this._parsers=void 0,this._types=Y,this.RowCtor=null,this.rowAsArray=X==="array",this.rowAsArray)this.parseRow=this._parseRowAsArray;this._prebuiltEmptyResultObject=null}addCommandComplete(X){let Y;if(X.text)Y=Us0.exec(X.text);else Y=Us0.exec(X.command);if(Y){if(this.command=Y[1],Y[3])this.oid=parseInt(Y[2],10),this.rowCount=parseInt(Y[3],10);else if(Y[2])this.rowCount=parseInt(Y[2],10)}}_parseRowAsArray(X){let Y=Array(X.length);for(let Q=0,J=X.length;Q<J;Q++){let G=X[Q];if(G!==null)Y[Q]=this._parsers[Q](G);else Y[Q]=null}return Y}parseRow(X){let Y={...this._prebuiltEmptyResultObject};for(let Q=0,J=X.length;Q<J;Q++){let G=X[Q],W=this.fields[Q].name;if(G!==null){let Z=this.fields[Q].format==="binary"?Buffer.from(G):G;Y[W]=this._parsers[Q](Z)}else Y[W]=null}return Y}addRow(X){this.rows.push(X)}addFields(X){if(this.fields=X,this.fields.length)this._parsers=Array(X.length);let Y={};for(let Q=0;Q<X.length;Q++){let J=X[Q];if(Y[J.name]=null,this._types)this._parsers[Q]=this._types.getTypeParser(J.dataTypeID,J.format||"text");else this._parsers[Q]=ZD6.getTypeParser(J.dataTypeID,J.format||"text")}this._prebuiltEmptyResultObject={...Y}}}Ds0.exports=Bs0});var Ms0=I((wE4,ws0)=>{var{EventEmitter:$D6}=z0("events"),Ns0=le(),Os0=cz();class Ls0 extends $D6{constructor(X,Y,Q){super();if(X=Os0.normalizeQueryConfig(X,Y,Q),this.text=X.text,this.values=X.values,this.rows=X.rows,this.types=X.types,this.name=X.name,this.queryMode=X.queryMode,this.binary=X.binary,this.portal=X.portal||"",this.callback=X.callback,this._rowMode=X.rowMode,process.domain&&X.callback)this.callback=process.domain.bind(X.callback);this._result=new Ns0(this._rowMode,this.types),this._results=this._result,this._canceledDueToError=!1}requiresPreparation(){if(this.queryMode==="extended")return!0;if(this.name)return!0;if(this.rows)return!0;if(!this.text)return!1;if(!this.values)return!1;return this.values.length>0}_checkForMultirow(){if(this._result.command){if(!Array.isArray(this._results))this._results=[this._result];this._result=new Ns0(this._rowMode,this._result._types),this._results.push(this._result)}}handleRowDescription(X){this._checkForMultirow(),this._result.addFields(X.fields),this._accumulateRows=this.callback||!this.listeners("row").length}handleDataRow(X){let Y;if(this._canceledDueToError)return;try{Y=this._result.parseRow(X.fields)}catch(Q){this._canceledDueToError=Q;return}if(this.emit("row",Y,this._result),this._accumulateRows)this._result.addRow(Y)}handleCommandComplete(X,Y){if(this._checkForMultirow(),this._result.addCommandComplete(X),this.rows)Y.sync()}handleEmptyQuery(X){if(this.rows)X.sync()}handleError(X,Y){if(this._canceledDueToError)X=this._canceledDueToError,this._canceledDueToError=!1;if(this.callback)return this.callback(X);this.emit("error",X)}handleReadyForQuery(X){if(this._canceledDueToError)return this.handleError(this._canceledDueToError,X);if(this.callback)try{this.callback(null,this._results)}catch(Y){process.nextTick(()=>{throw Y})}this.emit("end",this._results)}submit(X){if(typeof this.text!=="string"&&typeof this.name!=="string")return Error("A query must have either text or a name. Supplying neither is unsupported.");let Y=X.parsedStatements[this.name];if(this.text&&Y&&this.text!==Y)return Error(`Prepared statements must be unique - '${this.name}' was used for a different statement`);if(this.values&&!Array.isArray(this.values))return Error("Query values must be an array");if(this.requiresPreparation()){X.stream.cork&&X.stream.cork();try{this.prepare(X)}finally{X.stream.uncork&&X.stream.uncork()}}else X.query(this.text);return null}hasBeenParsed(X){return this.name&&X.parsedStatements[this.name]}handlePortalSuspended(X){this._getRows(X,this.rows)}_getRows(X,Y){if(X.execute({portal:this.portal,rows:Y}),!Y)X.sync();else X.flush()}prepare(X){if(!this.hasBeenParsed(X))X.parse({text:this.text,name:this.name,types:this.types});try{X.bind({portal:this.portal,statement:this.name,values:this.values,binary:this.binary,valueMapper:Os0.prepareValue})}catch(Y){this.handleError(Y,X);return}X.describe({type:"P",name:this.portal||""}),this._getRows(X,this.rows)}handleCopyInResponse(X){X.sendCopyFail("No source stream defined")}handleCopyData(X,Y){}}ws0.exports=Ls0});var de=I((fs0)=>{Object.defineProperty(fs0,"__esModule",{value:!0});fs0.NoticeMessage=fs0.DataRowMessage=fs0.CommandCompleteMessage=fs0.ReadyForQueryMessage=fs0.NotificationResponseMessage=fs0.BackendKeyDataMessage=fs0.AuthenticationMD5Password=fs0.ParameterStatusMessage=fs0.ParameterDescriptionMessage=fs0.RowDescriptionMessage=fs0.Field=fs0.CopyResponse=fs0.CopyDataMessage=fs0.DatabaseError=fs0.copyDone=fs0.emptyQuery=fs0.replicationStart=fs0.portalSuspended=fs0.noData=fs0.closeComplete=fs0.bindComplete=fs0.parseComplete=void 0;fs0.parseComplete={name:"parseComplete",length:5};fs0.bindComplete={name:"bindComplete",length:5};fs0.closeComplete={name:"closeComplete",length:5};fs0.noData={name:"noData",length:5};fs0.portalSuspended={name:"portalSuspended",length:5};fs0.replicationStart={name:"replicationStart",length:4};fs0.emptyQuery={name:"emptyQuery",length:4};fs0.copyDone={name:"copyDone",length:4};class Ps0 extends Error{constructor(X,Y,Q){super(X);this.length=Y,this.name=Q}}fs0.DatabaseError=Ps0;class Ts0{constructor(X,Y){this.length=X,this.chunk=Y,this.name="copyData"}}fs0.CopyDataMessage=Ts0;class As0{constructor(X,Y,Q,J){this.length=X,this.name=Y,this.binary=Q,this.columnTypes=Array(J)}}fs0.CopyResponse=As0;class Es0{constructor(X,Y,Q,J,G,W,Z){this.name=X,this.tableID=Y,this.columnID=Q,this.dataTypeID=J,this.dataTypeSize=G,this.dataTypeModifier=W,this.format=Z}}fs0.Field=Es0;class js0{constructor(X,Y){this.length=X,this.fieldCount=Y,this.name="rowDescription",this.fields=Array(this.fieldCount)}}fs0.RowDescriptionMessage=js0;class Cs0{constructor(X,Y){this.length=X,this.parameterCount=Y,this.name="parameterDescription",this.dataTypeIDs=Array(this.parameterCount)}}fs0.ParameterDescriptionMessage=Cs0;class Is0{constructor(X,Y,Q){this.length=X,this.parameterName=Y,this.parameterValue=Q,this.name="parameterStatus"}}fs0.ParameterStatusMessage=Is0;class Rs0{constructor(X,Y){this.length=X,this.salt=Y,this.name="authenticationMD5Password"}}fs0.AuthenticationMD5Password=Rs0;class Ss0{constructor(X,Y,Q){this.length=X,this.processID=Y,this.secretKey=Q,this.name="backendKeyData"}}fs0.BackendKeyDataMessage=Ss0;class ks0{constructor(X,Y,Q,J){this.length=X,this.processId=Y,this.channel=Q,this.payload=J,this.name="notification"}}fs0.NotificationResponseMessage=ks0;class vs0{constructor(X,Y){this.length=X,this.status=Y,this.name="readyForQuery"}}fs0.ReadyForQueryMessage=vs0;class _s0{constructor(X,Y){this.length=X,this.text=Y,this.name="commandComplete"}}fs0.CommandCompleteMessage=_s0;class ys0{constructor(X,Y){this.length=X,this.fields=Y,this.name="dataRow",this.fieldCount=Y.length}}fs0.DataRowMessage=ys0;class bs0{constructor(X,Y){this.length=X,this.message=Y,this.name="notice"}}fs0.NoticeMessage=bs0});var ms0=I((gs0)=>{Object.defineProperty(gs0,"__esModule",{value:!0});gs0.Writer=void 0;class xs0{constructor(X=256){this.size=X,this.offset=5,this.headerPosition=0,this.buffer=Buffer.allocUnsafe(X)}ensure(X){if(this.buffer.length-this.offset<X){let Q=this.buffer,J=Q.length+(Q.length>>1)+X;this.buffer=Buffer.allocUnsafe(J),Q.copy(this.buffer)}}addInt32(X){return this.ensure(4),this.buffer[this.offset++]=X>>>24&255,this.buffer[this.offset++]=X>>>16&255,this.buffer[this.offset++]=X>>>8&255,this.buffer[this.offset++]=X>>>0&255,this}addInt16(X){return this.ensure(2),this.buffer[this.offset++]=X>>>8&255,this.buffer[this.offset++]=X>>>0&255,this}addCString(X){if(!X)this.ensure(1);else{let Y=Buffer.byteLength(X);this.ensure(Y+1),this.buffer.write(X,this.offset,"utf-8"),this.offset+=Y}return this.buffer[this.offset++]=0,this}addString(X=""){let Y=Buffer.byteLength(X);return this.ensure(Y),this.buffer.write(X,this.offset),this.offset+=Y,this}add(X){return this.ensure(X.length),X.copy(this.buffer,this.offset),this.offset+=X.length,this}join(X){if(X){this.buffer[this.headerPosition]=X;let Y=this.offset-(this.headerPosition+1);this.buffer.writeInt32BE(Y,this.headerPosition+1)}return this.buffer.slice(X?0:5,this.offset)}flush(X){let Y=this.join(X);return this.offset=5,this.headerPosition=0,this.buffer=Buffer.allocUnsafe(this.size),Y}}gs0.Writer=xs0});var cs0=I((ds0)=>{Object.defineProperty(ds0,"__esModule",{value:!0});ds0.serialize=void 0;var pe=ms0(),N8=new pe.Writer,RD6=(X)=>{N8.addInt16(3).addInt16(0);for(let J of Object.keys(X))N8.addCString(J).addCString(X[J]);N8.addCString("client_encoding").addCString("UTF8");let Y=N8.addCString("").flush(),Q=Y.length+4;return new pe.Writer().addInt32(Q).add(Y).flush()},SD6=()=>{let X=Buffer.allocUnsafe(8);return X.writeInt32BE(8,0),X.writeInt32BE(80877103,4),X},kD6=(X)=>{return N8.addCString(X).flush(112)},vD6=function(X,Y){return N8.addCString(X).addInt32(Buffer.byteLength(Y)).addString(Y),N8.flush(112)},_D6=function(X){return N8.addString(X).flush(112)},yD6=(X)=>{return N8.addCString(X).flush(81)},ls0=[],bD6=(X)=>{let Y=X.name||"";if(Y.length>63)console.error("Warning! Postgres only supports 63 characters for query names."),console.error("You supplied %s (%s)",Y,Y.length),console.error("This can cause conflicts and silent errors executing queries");let Q=X.types||ls0,J=Q.length,G=N8.addCString(Y).addCString(X.text).addInt16(J);for(let W=0;W<J;W++)G.addInt32(Q[W]);return N8.flush(80)},rz=new pe.Writer,fD6=function(X,Y){for(let Q=0;Q<X.length;Q++){let J=Y?Y(X[Q],Q):X[Q];if(J==null)N8.addInt16(0),rz.addInt32(-1);else if(J instanceof Buffer)N8.addInt16(1),rz.addInt32(J.length),rz.add(J);else N8.addInt16(0),rz.addInt32(Buffer.byteLength(J)),rz.addString(J)}},hD6=(X={})=>{let Y=X.portal||"",Q=X.statement||"",J=X.binary||!1,G=X.values||ls0,W=G.length;return N8.addCString(Y).addCString(Q),N8.addInt16(W),fD6(G,X.valueMapper),N8.addInt16(W),N8.add(rz.flush()),N8.addInt16(1),N8.addInt16(J?1:0),N8.flush(66)},xD6=Buffer.from([69,0,0,0,9,0,0,0,0,0]),gD6=(X)=>{if(!X||!X.portal&&!X.rows)return xD6;let Y=X.portal||"",Q=X.rows||0,J=Buffer.byteLength(Y),G=4+J+1+4,W=Buffer.allocUnsafe(1+G);return W[0]=69,W.writeInt32BE(G,1),W.write(Y,5,"utf-8"),W[J+5]=0,W.writeUInt32BE(Q,W.length-4),W},uD6=(X,Y)=>{let Q=Buffer.allocUnsafe(16);return Q.writeInt32BE(16,0),Q.writeInt16BE(1234,4),Q.writeInt16BE(5678,6),Q.writeInt32BE(X,8),Q.writeInt32BE(Y,12),Q},ce=(X,Y)=>{let J=4+Buffer.byteLength(Y)+1,G=Buffer.allocUnsafe(1+J);return G[0]=X,G.writeInt32BE(J,1),G.write(Y,5,"utf-8"),G[J]=0,G},mD6=N8.addCString("P").flush(68),lD6=N8.addCString("S").flush(68),dD6=(X)=>{return X.name?ce(68,`${X.type}${X.name||""}`):X.type==="P"?mD6:lD6},pD6=(X)=>{let Y=`${X.type}${X.name||""}`;return ce(67,Y)},cD6=(X)=>{return N8.add(X).flush(100)},nD6=(X)=>{return ce(102,X)},Rv=(X)=>Buffer.from([X,0,0,0,4]),iD6=Rv(72),aD6=Rv(83),rD6=Rv(88),oD6=Rv(99),sD6={startup:RD6,password:kD6,requestSsl:SD6,sendSASLInitialResponseMessage:vD6,sendSCRAMClientFinalMessage:_D6,query:yD6,parse:bD6,bind:hD6,execute:gD6,describe:dD6,close:pD6,flush:()=>iD6,sync:()=>aD6,end:()=>rD6,copyData:cD6,copyDone:()=>oD6,copyFail:nD6,cancel:uD6};ds0.serialize=sD6});var rs0=I((is0)=>{Object.defineProperty(is0,"__esModule",{value:!0});is0.BufferReader=void 0;var tD6=Buffer.allocUnsafe(0);class ns0{constructor(X=0){this.offset=X,this.buffer=tD6,this.encoding="utf-8"}setBuffer(X,Y){this.offset=X,this.buffer=Y}int16(){let X=this.buffer.readInt16BE(this.offset);return this.offset+=2,X}byte(){let X=this.buffer[this.offset];return this.offset++,X}int32(){let X=this.buffer.readInt32BE(this.offset);return this.offset+=4,X}uint32(){let X=this.buffer.readUInt32BE(this.offset);return this.offset+=4,X}string(X){let Y=this.buffer.toString(this.encoding,this.offset,this.offset+X);return this.offset+=X,Y}cstring(){let X=this.offset,Y=X;while(this.buffer[Y++]!==0);return this.offset=Y,this.buffer.toString(this.encoding,X,Y-1)}bytes(X){let Y=this.buffer.slice(this.offset,this.offset+X);return this.offset+=X,Y}}is0.BufferReader=ns0});var Qt0=I((Xt0)=>{Object.defineProperty(Xt0,"__esModule",{value:!0});Xt0.Parser=void 0;var T8=de(),eD6=rs0(),ie=1,XN6=4,os0=ie+XN6,_Q=-1,ne=Buffer.allocUnsafe(0);class ts0{constructor(X){if(this.buffer=ne,this.bufferLength=0,this.bufferOffset=0,this.reader=new eD6.BufferReader,(X===null||X===void 0?void 0:X.mode)==="binary")throw Error("Binary mode not supported yet");this.mode=(X===null||X===void 0?void 0:X.mode)||"text"}parse(X,Y){this.mergeBuffer(X);let Q=this.bufferOffset+this.bufferLength,J=this.bufferOffset;while(J+os0<=Q){let G=this.buffer[J],W=this.buffer.readUInt32BE(J+ie),Z=ie+W;if(Z+J<=Q){let $=this.handlePacket(J+os0,G,W,this.buffer);Y($),J+=Z}else break}if(J===Q)this.buffer=ne,this.bufferLength=0,this.bufferOffset=0;else this.bufferLength=Q-J,this.bufferOffset=J}mergeBuffer(X){if(this.bufferLength>0){let Y=this.bufferLength+X.byteLength;if(Y+this.bufferOffset>this.buffer.byteLength){let J;if(Y<=this.buffer.byteLength&&this.bufferOffset>=this.bufferLength)J=this.buffer;else{let G=this.buffer.byteLength*2;while(Y>=G)G*=2;J=Buffer.allocUnsafe(G)}this.buffer.copy(J,0,this.bufferOffset,this.bufferOffset+this.bufferLength),this.buffer=J,this.bufferOffset=0}X.copy(this.buffer,this.bufferOffset+this.bufferLength),this.bufferLength=Y}else this.buffer=X,this.bufferOffset=0,this.bufferLength=X.byteLength}handlePacket(X,Y,Q,J){let{reader:G}=this;G.setBuffer(X,J);let W;switch(Y){case 50:W=T8.bindComplete;break;case 49:W=T8.parseComplete;break;case 51:W=T8.closeComplete;break;case 110:W=T8.noData;break;case 115:W=T8.portalSuspended;break;case 99:W=T8.copyDone;break;case 87:W=T8.replicationStart;break;case 73:W=T8.emptyQuery;break;case 68:W=FN6(G);break;case 67:W=QN6(G);break;case 90:W=YN6(G);break;case 65:W=ZN6(G);break;case 82:W=zN6(G,Q);break;case 83:W=VN6(G);break;case 75:W=qN6(G);break;case 69:W=ss0(G,"error");break;case 78:W=ss0(G,"notice");break;case 84:W=$N6(G);break;case 116:W=HN6(G);break;case 71:W=GN6(G);break;case 72:W=WN6(G);break;case 100:W=JN6(G,Q);break;default:return new T8.DatabaseError("received invalid response: "+Y.toString(16),Q,"error")}return G.setBuffer(0,ne),W.length=Q,W}}Xt0.Parser=ts0;var YN6=(X)=>{let Y=X.string(1);return new T8.ReadyForQueryMessage(_Q,Y)},QN6=(X)=>{let Y=X.cstring();return new T8.CommandCompleteMessage(_Q,Y)},JN6=(X,Y)=>{let Q=X.bytes(Y-4);return new T8.CopyDataMessage(_Q,Q)},GN6=(X)=>es0(X,"copyInResponse"),WN6=(X)=>es0(X,"copyOutResponse"),es0=(X,Y)=>{let Q=X.byte()!==0,J=X.int16(),G=new T8.CopyResponse(_Q,Y,Q,J);for(let W=0;W<J;W++)G.columnTypes[W]=X.int16();return G},ZN6=(X)=>{let Y=X.int32(),Q=X.cstring(),J=X.cstring();return new T8.NotificationResponseMessage(_Q,Y,Q,J)},$N6=(X)=>{let Y=X.int16(),Q=new T8.RowDescriptionMessage(_Q,Y);for(let J=0;J<Y;J++)Q.fields[J]=KN6(X);return Q},KN6=(X)=>{let Y=X.cstring(),Q=X.uint32(),J=X.int16(),G=X.uint32(),W=X.int16(),Z=X.int32(),$=X.int16()===0?"text":"binary";return new T8.Field(Y,Q,J,G,W,Z,$)},HN6=(X)=>{let Y=X.int16(),Q=new T8.ParameterDescriptionMessage(_Q,Y);for(let J=0;J<Y;J++)Q.dataTypeIDs[J]=X.int32();return Q},FN6=(X)=>{let Y=X.int16(),Q=Array(Y);for(let J=0;J<Y;J++){let G=X.int32();Q[J]=G===-1?null:X.string(G)}return new T8.DataRowMessage(_Q,Q)},VN6=(X)=>{let Y=X.cstring(),Q=X.cstring();return new T8.ParameterStatusMessage(_Q,Y,Q)},qN6=(X)=>{let Y=X.int32(),Q=X.int32();return new T8.BackendKeyDataMessage(_Q,Y,Q)},zN6=(X,Y)=>{let Q=X.int32(),J={name:"authenticationOk",length:Y};switch(Q){case 0:break;case 3:if(J.length===8)J.name="authenticationCleartextPassword";break;case 5:if(J.length===12){J.name="authenticationMD5Password";let G=X.bytes(4);return new T8.AuthenticationMD5Password(_Q,G)}break;case 10:{J.name="authenticationSASL",J.mechanisms=[];let G;do if(G=X.cstring(),G)J.mechanisms.push(G);while(G)}break;case 11:J.name="authenticationSASLContinue",J.data=X.string(Y-8);break;case 12:J.name="authenticationSASLFinal",J.data=X.string(Y-8);break;default:throw Error("Unknown authenticationOk message type "+Q)}return J},ss0=(X,Y)=>{let Q={},J=X.string(1);while(J!=="\x00")Q[J]=X.cstring(),J=X.string(1);let G=Q.M,W=Y==="notice"?new T8.NoticeMessage(_Q,G):new T8.DatabaseError(G,_Q,Y);return W.severity=Q.S,W.code=Q.C,W.detail=Q.D,W.hint=Q.H,W.position=Q.P,W.internalPosition=Q.p,W.internalQuery=Q.q,W.where=Q.W,W.schema=Q.s,W.table=Q.t,W.column=Q.c,W.dataType=Q.d,W.constraint=Q.n,W.file=Q.F,W.line=Q.L,W.routine=Q.R,W}});var ae=I((Sv)=>{Object.defineProperty(Sv,"__esModule",{value:!0});Sv.DatabaseError=Sv.serialize=Sv.parse=void 0;var UN6=de();Object.defineProperty(Sv,"DatabaseError",{enumerable:!0,get:function(){return UN6.DatabaseError}});var BN6=cs0();Object.defineProperty(Sv,"serialize",{enumerable:!0,get:function(){return BN6.serialize}});var DN6=Qt0();function NN6(X,Y){let Q=new DN6.Parser;return X.on("data",(J)=>Q.parse(J,Y)),new Promise((J)=>X.on("end",()=>J()))}Sv.parse=NN6});var Gt0=I((Jt0)=>{Object.defineProperty(Jt0,"__esModule",{value:!0});Jt0.default={}});var Zt0=I((RE4,Wt0)=>{var{getStream:MN6,getSecureStream:PN6}=jN6();Wt0.exports={getStream:MN6,getSecureStream:PN6};function TN6(){function X(Q){return new(z0("net")).Socket}function Y(Q){return z0("tls").connect(Q)}return{getStream:X,getSecureStream:Y}}function AN6(){function X(Q){let{CloudflareSocket:J}=Gt0();return new J(Q)}function Y(Q){return Q.socket.startTls(Q),Q.socket}return{getStream:X,getSecureStream:Y}}function EN6(){if(typeof navigator==="object"&&navigator!==null&&typeof navigator.userAgent==="string")return navigator.userAgent==="Cloudflare-Workers";if(typeof Response==="function"){let X=new Response(null,{cf:{thing:!0}});if(typeof X.cf==="object"&&X.cf!==null&&X.cf.thing)return!0}return!1}function jN6(){if(EN6())return AN6();return TN6()}});var re=I((SE4,Kt0)=>{var CN6=z0("events").EventEmitter,{parse:IN6,serialize:l9}=ae(),{getStream:RN6,getSecureStream:SN6}=Zt0(),kN6=l9.flush(),vN6=l9.sync(),_N6=l9.end();class $t0 extends CN6{constructor(X){super();if(X=X||{},this.stream=X.stream||RN6(X.ssl),typeof this.stream==="function")this.stream=this.stream(X);this._keepAlive=X.keepAlive,this._keepAliveInitialDelayMillis=X.keepAliveInitialDelayMillis,this.parsedStatements={},this.ssl=X.ssl||!1,this._ending=!1,this._emitMessage=!1;let Y=this;this.on("newListener",function(Q){if(Q==="message")Y._emitMessage=!0})}connect(X,Y){let Q=this;this._connecting=!0,this.stream.setNoDelay(!0),this.stream.connect(X,Y),this.stream.once("connect",function(){if(Q._keepAlive)Q.stream.setKeepAlive(!0,Q._keepAliveInitialDelayMillis);Q.emit("connect")});let J=function(G){if(Q._ending&&(G.code==="ECONNRESET"||G.code==="EPIPE"))return;Q.emit("error",G)};if(this.stream.on("error",J),this.stream.on("close",function(){Q.emit("end")}),!this.ssl)return this.attachListeners(this.stream);this.stream.once("data",function(G){switch(G.toString("utf8")){case"S":break;case"N":return Q.stream.end(),Q.emit("error",Error("The server does not support SSL connections"));default:return Q.stream.end(),Q.emit("error",Error("There was an error establishing an SSL connection"))}let Z={socket:Q.stream};if(Q.ssl!==!0){if(Object.assign(Z,Q.ssl),"key"in Q.ssl)Z.key=Q.ssl.key}let $=z0("net");if($.isIP&&$.isIP(Y)===0)Z.servername=Y;try{Q.stream=SN6(Z)}catch(K){return Q.emit("error",K)}Q.attachListeners(Q.stream),Q.stream.on("error",J),Q.emit("sslconnect")})}attachListeners(X){IN6(X,(Y)=>{let Q=Y.name==="error"?"errorMessage":Y.name;if(this._emitMessage)this.emit("message",Y);this.emit(Q,Y)})}requestSsl(){this.stream.write(l9.requestSsl())}startup(X){this.stream.write(l9.startup(X))}cancel(X,Y){this._send(l9.cancel(X,Y))}password(X){this._send(l9.password(X))}sendSASLInitialResponseMessage(X,Y){this._send(l9.sendSASLInitialResponseMessage(X,Y))}sendSCRAMClientFinalMessage(X){this._send(l9.sendSCRAMClientFinalMessage(X))}_send(X){if(!this.stream.writable)return!1;return this.stream.write(X)}query(X){this._send(l9.query(X))}parse(X){this._send(l9.parse(X))}bind(X){this._send(l9.bind(X))}execute(X){this._send(l9.execute(X))}flush(){if(this.stream.writable)this.stream.write(kN6)}sync(){this._ending=!0,this._send(vN6)}ref(){this.stream.ref()}unref(){this.stream.unref()}end(){if(this._ending=!0,!this._connecting||!this.stream.writable){this.stream.end();return}return this.stream.write(_N6,()=>{this.stream.end()})}close(X){this._send(l9.close(X))}describe(X){this._send(l9.describe(X))}sendCopyFromChunk(X){this._send(l9.copyData(X))}endCopyFrom(){this._send(l9.copyDone())}sendCopyFail(X){this._send(l9.copyFail(X))}}Kt0.exports=$t0});var qt0=I((kE4,Vt0)=>{var{Transform:yN6}=z0("stream"),{StringDecoder:bN6}=z0("string_decoder"),C$=Symbol("last"),kv=Symbol("decoder");function fN6(X,Y,Q){let J;if(this.overflow){if(J=this[kv].write(X).split(this.matcher),J.length===1)return Q();J.shift(),this.overflow=!1}else this[C$]+=this[kv].write(X),J=this[C$].split(this.matcher);this[C$]=J.pop();for(let G=0;G<J.length;G++)try{Ft0(this,this.mapper(J[G]))}catch(W){return Q(W)}if(this.overflow=this[C$].length>this.maxLength,this.overflow&&!this.skipOverflow){Q(Error("maximum buffer reached"));return}Q()}function hN6(X){if(this[C$]+=this[kv].end(),this[C$])try{Ft0(this,this.mapper(this[C$]))}catch(Y){return X(Y)}X()}function Ft0(X,Y){if(Y!==void 0)X.push(Y)}function Ht0(X){return X}function xN6(X,Y,Q){switch(X=X||/\r?\n/,Y=Y||Ht0,Q=Q||{},arguments.length){case 1:if(typeof X==="function")Y=X,X=/\r?\n/;else if(typeof X==="object"&&!(X instanceof RegExp)&&!X[Symbol.split])Q=X,X=/\r?\n/;break;case 2:if(typeof X==="function")Q=Y,Y=X,X=/\r?\n/;else if(typeof Y==="object")Q=Y,Y=Ht0}Q=Object.assign({},Q),Q.autoDestroy=!0,Q.transform=fN6,Q.flush=hN6,Q.readableObjectMode=!0;let J=new yN6(Q);return J[C$]="",J[kv]=new bN6("utf8"),J.matcher=X,J.mapper=Y,J.maxLength=Q.maxLength,J.skipOverflow=Q.skipOverflow||!1,J.overflow=!1,J._destroy=function(G,W){this._writableState.errorEmitted=!1,W(G)},J}Vt0.exports=xN6});var Bt0=I((sN6,wW)=>{var zt0=z0("path"),gN6=z0("stream").Stream,uN6=qt0(),Ut0=z0("util"),mN6=5432,vv=process.platform==="win32",rw=process.stderr,lN6=56,dN6=7,pN6=61440,cN6=32768;function nN6(X){return(X&pN6)==cN6}var oz=["host","port","database","user","password"],oe=oz.length,iN6=oz[oe-1];function se(){var X=rw instanceof gN6&&rw.writable===!0;if(X){var Y=Array.prototype.slice.call(arguments).concat(`
232
232
  `);rw.write(Ut0.format.apply(Ut0,Y))}}Object.defineProperty(sN6,"isWin",{get:function(){return vv},set:function(X){vv=X}});sN6.warnTo=function(X){var Y=rw;return rw=X,Y};sN6.getFileName=function(X){var Y=X||process.env,Q=Y.PGPASSFILE||(vv?zt0.join(Y.APPDATA||"./","postgresql","pgpass.conf"):zt0.join(Y.HOME||"./",".pgpass"));return Q};sN6.usePgPass=function(X,Y){if(Object.prototype.hasOwnProperty.call(process.env,"PGPASSWORD"))return!1;if(vv)return!0;if(Y=Y||"<unkn>",!nN6(X.mode))return se('WARNING: password file "%s" is not a plain file',Y),!1;if(X.mode&(lN6|dN6))return se('WARNING: password file "%s" has group or world access; permissions should be u=rw (0600) or less',Y),!1;return!0};var aN6=sN6.match=function(X,Y){return oz.slice(0,-1).reduce(function(Q,J,G){if(G==1){if(Number(X[J]||mN6)===Number(Y[J]))return Q&&!0}return Q&&(Y[J]==="*"||Y[J]===X[J])},!0)};sN6.getPassword=function(X,Y,Q){var J,G=Y.pipe(uN6());function W(K){var H=rN6(K);if(H&&oN6(H)&&aN6(X,H))J=H[iN6],G.end()}var Z=function(){Y.destroy(),Q(J)},$=function(K){Y.destroy(),se("WARNING: error on reading file: %s",K),Q(void 0)};Y.on("error",$),G.on("data",W).on("end",Z).on("error",$)};var rN6=sN6.parseLine=function(X){if(X.length<11||X.match(/^\s+#/))return null;var Y="",Q="",J=0,G=0,W=0,Z={},$=!1,K=function(F,V,q){var z=X.substring(V,q);if(!Object.hasOwnProperty.call(process.env,"PGPASS_NO_DEESCAPE"))z=z.replace(/\\([:\\])/g,"$1");Z[oz[F]]=z};for(var H=0;H<X.length-1;H+=1){if(Y=X.charAt(H+1),Q=X.charAt(H),$=J==oe-1,$){K(J,G);break}if(H>=0&&Y==":"&&Q!=="\\")K(J,G,H+1),G=H+2,J+=1}return Z=Object.keys(Z).length===oe?Z:null,Z},oN6=sN6.isValidEntry=function(X){var Y={0:function(Z){return Z.length>0},1:function(Z){if(Z==="*")return!0;return Z=Number(Z),isFinite(Z)&&Z>0&&Z<9007199254740992&&Math.floor(Z)===Z},2:function(Z){return Z.length>0},3:function(Z){return Z.length>0},4:function(Z){return Z.length>0}};for(var Q=0;Q<oz.length;Q+=1){var J=Y[Q],G=X[oz[Q]]||"",W=J(G);if(!W)return!1}return!0}});var Nt0=I((fE4,te)=>{var bE4=z0("path"),Dt0=z0("fs"),_v=Bt0();te.exports=function(X,Y){var Q=_v.getFileName();Dt0.stat(Q,function(J,G){if(J||!_v.usePgPass(G,Q))return Y(void 0);var W=Dt0.createReadStream(Q);_v.getPassword(X,W,Y)})};te.exports.warnTo=_v.warnTo});var Pt0=I((hE4,Mt0)=>{var QO6=z0("events").EventEmitter,Ot0=cz(),yv=z0("util"),ee=Ws0(),JO6=Iv(),GO6=me(),wt0=Ms0(),WO6=iw(),ZO6=re(),$O6=xe(),Lt0=yv.deprecate(()=>{},"Client.activeQuery is deprecated and will be removed in a future version."),KO6=yv.deprecate(()=>{},"Client.queryQueue is deprecated and will be removed in a future version."),HO6=yv.deprecate(()=>{},"pgpass support is deprecated and will be removed in a future version. You can provide an async function as the password property to the Client/Pool constructor that returns a password instead. Within this funciton you can call the pgpass module in your own code."),FO6=yv.deprecate(()=>{},"Passing a custom Promise implementation to the Client/Pool constructor is deprecated and will be removed in a future version.");class X00 extends QO6{constructor(X){super();this.connectionParameters=new GO6(X),this.user=this.connectionParameters.user,this.database=this.connectionParameters.database,this.port=this.connectionParameters.port,this.host=this.connectionParameters.host,Object.defineProperty(this,"password",{configurable:!0,enumerable:!1,writable:!0,value:this.connectionParameters.password}),this.replication=this.connectionParameters.replication;let Y=X||{};if(Y.Promise)FO6();if(this._Promise=Y.Promise||global.Promise,this._types=new JO6(Y.types),this._ending=!1,this._ended=!1,this._connecting=!1,this._connected=!1,this._connectionError=!1,this._queryable=!0,this._activeQuery=null,this.enableChannelBinding=Boolean(Y.enableChannelBinding),this.connection=Y.connection||new ZO6({stream:Y.stream,ssl:this.connectionParameters.ssl,keepAlive:Y.keepAlive||!1,keepAliveInitialDelayMillis:Y.keepAliveInitialDelayMillis||0,encoding:this.connectionParameters.client_encoding||"utf8"}),this._queryQueue=[],this.binary=Y.binary||WO6.binary,this.processID=null,this.secretKey=null,this.ssl=this.connectionParameters.ssl||!1,this.ssl&&this.ssl.key)Object.defineProperty(this.ssl,"key",{enumerable:!1});this._connectionTimeoutMillis=Y.connectionTimeoutMillis||0}get activeQuery(){return Lt0(),this._activeQuery}set activeQuery(X){Lt0(),this._activeQuery=X}_getActiveQuery(){return this._activeQuery}_errorAllQueries(X){let Y=(J)=>{process.nextTick(()=>{J.handleError(X,this.connection)})},Q=this._getActiveQuery();if(Q)Y(Q),this._activeQuery=null;this._queryQueue.forEach(Y),this._queryQueue.length=0}_connect(X){let Y=this,Q=this.connection;if(this._connectionCallback=X,this._connecting||this._connected){let J=Error("Client has already been connected. You cannot reuse a client.");process.nextTick(()=>{X(J)});return}if(this._connecting=!0,this._connectionTimeoutMillis>0){if(this.connectionTimeoutHandle=setTimeout(()=>{Q._ending=!0,Q.stream.destroy(Error("timeout expired"))},this._connectionTimeoutMillis),this.connectionTimeoutHandle.unref)this.connectionTimeoutHandle.unref()}if(this.host&&this.host.indexOf("/")===0)Q.connect(this.host+"/.s.PGSQL."+this.port);else Q.connect(this.port,this.host);Q.on("connect",function(){if(Y.ssl)Q.requestSsl();else Q.startup(Y.getStartupConf())}),Q.on("sslconnect",function(){Q.startup(Y.getStartupConf())}),this._attachListeners(Q),Q.once("end",()=>{let J=this._ending?Error("Connection terminated"):Error("Connection terminated unexpectedly");if(clearTimeout(this.connectionTimeoutHandle),this._errorAllQueries(J),this._ended=!0,!this._ending){if(this._connecting&&!this._connectionError)if(this._connectionCallback)this._connectionCallback(J);else this._handleErrorEvent(J);else if(!this._connectionError)this._handleErrorEvent(J)}process.nextTick(()=>{this.emit("end")})})}connect(X){if(X){this._connect(X);return}return new this._Promise((Y,Q)=>{this._connect((J)=>{if(J)Q(J);else Y()})})}_attachListeners(X){X.on("authenticationCleartextPassword",this._handleAuthCleartextPassword.bind(this)),X.on("authenticationMD5Password",this._handleAuthMD5Password.bind(this)),X.on("authenticationSASL",this._handleAuthSASL.bind(this)),X.on("authenticationSASLContinue",this._handleAuthSASLContinue.bind(this)),X.on("authenticationSASLFinal",this._handleAuthSASLFinal.bind(this)),X.on("backendKeyData",this._handleBackendKeyData.bind(this)),X.on("error",this._handleErrorEvent.bind(this)),X.on("errorMessage",this._handleErrorMessage.bind(this)),X.on("readyForQuery",this._handleReadyForQuery.bind(this)),X.on("notice",this._handleNotice.bind(this)),X.on("rowDescription",this._handleRowDescription.bind(this)),X.on("dataRow",this._handleDataRow.bind(this)),X.on("portalSuspended",this._handlePortalSuspended.bind(this)),X.on("emptyQuery",this._handleEmptyQuery.bind(this)),X.on("commandComplete",this._handleCommandComplete.bind(this)),X.on("parseComplete",this._handleParseComplete.bind(this)),X.on("copyInResponse",this._handleCopyInResponse.bind(this)),X.on("copyData",this._handleCopyData.bind(this)),X.on("notification",this._handleNotification.bind(this))}_getPassword(X){let Y=this.connection;if(typeof this.password==="function")this._Promise.resolve().then(()=>this.password()).then((Q)=>{if(Q!==void 0){if(typeof Q!=="string"){Y.emit("error",TypeError("Password must be a string"));return}this.connectionParameters.password=this.password=Q}else this.connectionParameters.password=this.password=null;X()}).catch((Q)=>{Y.emit("error",Q)});else if(this.password!==null)X();else try{Nt0()(this.connectionParameters,(J)=>{if(J!==void 0)HO6(),this.connectionParameters.password=this.password=J;X()})}catch(Q){this.emit("error",Q)}}_handleAuthCleartextPassword(X){this._getPassword(()=>{this.connection.password(this.password)})}_handleAuthMD5Password(X){this._getPassword(async()=>{try{let Y=await $O6.postgresMd5PasswordHash(this.user,this.password,X.salt);this.connection.password(Y)}catch(Y){this.emit("error",Y)}})}_handleAuthSASL(X){this._getPassword(()=>{try{this.saslSession=ee.startSession(X.mechanisms,this.enableChannelBinding&&this.connection.stream),this.connection.sendSASLInitialResponseMessage(this.saslSession.mechanism,this.saslSession.response)}catch(Y){this.connection.emit("error",Y)}})}async _handleAuthSASLContinue(X){try{await ee.continueSession(this.saslSession,this.password,X.data,this.enableChannelBinding&&this.connection.stream),this.connection.sendSCRAMClientFinalMessage(this.saslSession.response)}catch(Y){this.connection.emit("error",Y)}}_handleAuthSASLFinal(X){try{ee.finalizeSession(this.saslSession,X.data),this.saslSession=null}catch(Y){this.connection.emit("error",Y)}}_handleBackendKeyData(X){this.processID=X.processID,this.secretKey=X.secretKey}_handleReadyForQuery(X){if(this._connecting){if(this._connecting=!1,this._connected=!0,clearTimeout(this.connectionTimeoutHandle),this._connectionCallback)this._connectionCallback(null,this),this._connectionCallback=null;this.emit("connect")}let Y=this._getActiveQuery();if(this._activeQuery=null,this.readyForQuery=!0,Y)Y.handleReadyForQuery(this.connection);this._pulseQueryQueue()}_handleErrorWhileConnecting(X){if(this._connectionError)return;if(this._connectionError=!0,clearTimeout(this.connectionTimeoutHandle),this._connectionCallback)return this._connectionCallback(X);this.emit("error",X)}_handleErrorEvent(X){if(this._connecting)return this._handleErrorWhileConnecting(X);this._queryable=!1,this._errorAllQueries(X),this.emit("error",X)}_handleErrorMessage(X){if(this._connecting)return this._handleErrorWhileConnecting(X);let Y=this._getActiveQuery();if(!Y){this._handleErrorEvent(X);return}this._activeQuery=null,Y.handleError(X,this.connection)}_handleRowDescription(X){this._getActiveQuery().handleRowDescription(X)}_handleDataRow(X){this._getActiveQuery().handleDataRow(X)}_handlePortalSuspended(X){this._getActiveQuery().handlePortalSuspended(this.connection)}_handleEmptyQuery(X){this._getActiveQuery().handleEmptyQuery(this.connection)}_handleCommandComplete(X){let Y=this._getActiveQuery();if(Y==null){let Q=Error("Received unexpected commandComplete message from backend.");this._handleErrorEvent(Q);return}Y.handleCommandComplete(X,this.connection)}_handleParseComplete(){let X=this._getActiveQuery();if(X==null){let Y=Error("Received unexpected parseComplete message from backend.");this._handleErrorEvent(Y);return}if(X.name)this.connection.parsedStatements[X.name]=X.text}_handleCopyInResponse(X){this._getActiveQuery().handleCopyInResponse(this.connection)}_handleCopyData(X){this._getActiveQuery().handleCopyData(X,this.connection)}_handleNotification(X){this.emit("notification",X)}_handleNotice(X){this.emit("notice",X)}getStartupConf(){let X=this.connectionParameters,Y={user:X.user,database:X.database},Q=X.application_name||X.fallback_application_name;if(Q)Y.application_name=Q;if(X.replication)Y.replication=""+X.replication;if(X.statement_timeout)Y.statement_timeout=String(parseInt(X.statement_timeout,10));if(X.lock_timeout)Y.lock_timeout=String(parseInt(X.lock_timeout,10));if(X.idle_in_transaction_session_timeout)Y.idle_in_transaction_session_timeout=String(parseInt(X.idle_in_transaction_session_timeout,10));if(X.options)Y.options=X.options;return Y}cancel(X,Y){if(X.activeQuery===Y){let Q=this.connection;if(this.host&&this.host.indexOf("/")===0)Q.connect(this.host+"/.s.PGSQL."+this.port);else Q.connect(this.port,this.host);Q.on("connect",function(){Q.cancel(X.processID,X.secretKey)})}else if(X._queryQueue.indexOf(Y)!==-1)X._queryQueue.splice(X._queryQueue.indexOf(Y),1)}setTypeParser(X,Y,Q){return this._types.setTypeParser(X,Y,Q)}getTypeParser(X,Y){return this._types.getTypeParser(X,Y)}escapeIdentifier(X){return Ot0.escapeIdentifier(X)}escapeLiteral(X){return Ot0.escapeLiteral(X)}_pulseQueryQueue(){if(this.readyForQuery===!0){this._activeQuery=this._queryQueue.shift();let X=this._getActiveQuery();if(X){this.readyForQuery=!1,this.hasExecuted=!0;let Y=X.submit(this.connection);if(Y)process.nextTick(()=>{X.handleError(Y,this.connection),this.readyForQuery=!0,this._pulseQueryQueue()})}else if(this.hasExecuted)this._activeQuery=null,this.emit("drain")}}query(X,Y,Q){let J,G,W,Z,$;if(X===null||X===void 0)throw TypeError("Client was passed a null or undefined query");else if(typeof X.submit==="function"){if(W=X.query_timeout||this.connectionParameters.query_timeout,G=J=X,typeof Y==="function")J.callback=J.callback||Y}else if(W=X.query_timeout||this.connectionParameters.query_timeout,J=new wt0(X,Y,Q),!J.callback)G=new this._Promise((K,H)=>{J.callback=(F,V)=>F?H(F):K(V)}).catch((K)=>{throw Error.captureStackTrace(K),K});if(W)$=J.callback,Z=setTimeout(()=>{let K=Error("Query read timeout");process.nextTick(()=>{J.handleError(K,this.connection)}),$(K),J.callback=()=>{};let H=this._queryQueue.indexOf(J);if(H>-1)this._queryQueue.splice(H,1);this._pulseQueryQueue()},W),J.callback=(K,H)=>{clearTimeout(Z),$(K,H)};if(this.binary&&!J.binary)J.binary=!0;if(J._result&&!J._result._types)J._result._types=this._types;if(!this._queryable)return process.nextTick(()=>{J.handleError(Error("Client has encountered a connection error and is not queryable"),this.connection)}),G;if(this._ending)return process.nextTick(()=>{J.handleError(Error("Client was closed and is not queryable"),this.connection)}),G;return this._queryQueue.push(J),this._pulseQueryQueue(),G}ref(){this.connection.ref()}unref(){this.connection.unref()}end(X){if(this._ending=!0,!this.connection._connecting||this._ended)if(X)X();else return this._Promise.resolve();if(this._getActiveQuery()||!this._queryable)this.connection.stream.destroy();else this.connection.end();if(X)this.connection.once("end",X);else return new this._Promise((Y)=>{this.connection.once("end",Y)})}get queryQueue(){return KO6(),this._queryQueue}}X00.Query=wt0;Mt0.exports=X00});var It0=I((xE4,Ct0)=>{var VO6=z0("events").EventEmitter,Tt0=function(){},At0=(X,Y)=>{let Q=X.findIndex(Y);return Q===-1?void 0:X.splice(Q,1)[0]};class Et0{constructor(X,Y,Q){this.client=X,this.idleListener=Y,this.timeoutId=Q}}class ow{constructor(X){this.callback=X}}function qO6(){throw Error("Release called on client which has already been released to the pool.")}function bv(X,Y){if(Y)return{callback:Y,result:void 0};let Q,J,G=function(Z,$){Z?Q(Z):J($)},W=new X(function(Z,$){J=Z,Q=$}).catch((Z)=>{throw Error.captureStackTrace(Z),Z});return{callback:G,result:W}}function zO6(X,Y){return function Q(J){J.client=Y,Y.removeListener("error",Q),Y.on("error",()=>{X.log("additional client error after disconnection due to error",J)}),X._remove(Y),X.emit("error",J,Y)}}class jt0 extends VO6{constructor(X,Y){super();if(this.options=Object.assign({},X),X!=null&&"password"in X)Object.defineProperty(this.options,"password",{configurable:!0,enumerable:!1,writable:!0,value:X.password});if(X!=null&&X.ssl&&X.ssl.key)Object.defineProperty(this.options.ssl,"key",{enumerable:!1});if(this.options.max=this.options.max||this.options.poolSize||10,this.options.min=this.options.min||0,this.options.maxUses=this.options.maxUses||1/0,this.options.allowExitOnIdle=this.options.allowExitOnIdle||!1,this.options.maxLifetimeSeconds=this.options.maxLifetimeSeconds||0,this.log=this.options.log||function(){},this.Client=this.options.Client||Y||Y00().Client,this.Promise=this.options.Promise||global.Promise,typeof this.options.idleTimeoutMillis>"u")this.options.idleTimeoutMillis=1e4;this._clients=[],this._idle=[],this._expired=new WeakSet,this._pendingQueue=[],this._endCallback=void 0,this.ending=!1,this.ended=!1}_isFull(){return this._clients.length>=this.options.max}_isAboveMin(){return this._clients.length>this.options.min}_pulseQueue(){if(this.log("pulse queue"),this.ended){this.log("pulse queue ended");return}if(this.ending){if(this.log("pulse queue on ending"),this._idle.length)this._idle.slice().map((Y)=>{this._remove(Y.client)});if(!this._clients.length)this.ended=!0,this._endCallback();return}if(!this._pendingQueue.length){this.log("no queued requests");return}if(!this._idle.length&&this._isFull())return;let X=this._pendingQueue.shift();if(this._idle.length){let Y=this._idle.pop();clearTimeout(Y.timeoutId);let Q=Y.client;Q.ref&&Q.ref();let J=Y.idleListener;return this._acquireClient(Q,X,J,!1)}if(!this._isFull())return this.newClient(X);throw Error("unexpected condition")}_remove(X,Y){let Q=At0(this._idle,(G)=>G.client===X);if(Q!==void 0)clearTimeout(Q.timeoutId);this._clients=this._clients.filter((G)=>G!==X);let J=this;X.end(()=>{if(J.emit("remove",X),typeof Y==="function")Y()})}connect(X){if(this.ending){let J=Error("Cannot use a pool after calling end on the pool");return X?X(J):this.Promise.reject(J)}let Y=bv(this.Promise,X),Q=Y.result;if(this._isFull()||this._idle.length){if(this._idle.length)process.nextTick(()=>this._pulseQueue());if(!this.options.connectionTimeoutMillis)return this._pendingQueue.push(new ow(Y.callback)),Q;let J=(Z,$,K)=>{clearTimeout(W),Y.callback(Z,$,K)},G=new ow(J),W=setTimeout(()=>{At0(this._pendingQueue,(Z)=>Z.callback===J),G.timedOut=!0,Y.callback(Error("timeout exceeded when trying to connect"))},this.options.connectionTimeoutMillis);if(W.unref)W.unref();return this._pendingQueue.push(G),Q}return this.newClient(new ow(Y.callback)),Q}newClient(X){let Y=new this.Client(this.options);this._clients.push(Y);let Q=zO6(this,Y);this.log("checking client timeout");let J,G=!1;if(this.options.connectionTimeoutMillis)J=setTimeout(()=>{this.log("ending client due to timeout"),G=!0,Y.connection?Y.connection.stream.destroy():Y.end()},this.options.connectionTimeoutMillis);this.log("connecting new client"),Y.connect((W)=>{if(J)clearTimeout(J);if(Y.on("error",Q),W){if(this.log("client failed to connect",W),this._clients=this._clients.filter((Z)=>Z!==Y),G)W=Error("Connection terminated due to connection timeout",{cause:W});if(this._pulseQueue(),!X.timedOut)X.callback(W,void 0,Tt0)}else{if(this.log("new client connected"),this.options.maxLifetimeSeconds!==0){let Z=setTimeout(()=>{if(this.log("ending client due to expired lifetime"),this._expired.add(Y),this._idle.findIndex((K)=>K.client===Y)!==-1)this._acquireClient(Y,new ow((K,H,F)=>F()),Q,!1)},this.options.maxLifetimeSeconds*1000);Z.unref(),Y.once("end",()=>clearTimeout(Z))}return this._acquireClient(Y,X,Q,!0)}})}_acquireClient(X,Y,Q,J){if(J)this.emit("connect",X);if(this.emit("acquire",X),X.release=this._releaseOnce(X,Q),X.removeListener("error",Q),!Y.timedOut)if(J&&this.options.verify)this.options.verify(X,(G)=>{if(G)return X.release(G),Y.callback(G,void 0,Tt0);Y.callback(void 0,X,X.release)});else Y.callback(void 0,X,X.release);else if(J&&this.options.verify)this.options.verify(X,X.release);else X.release()}_releaseOnce(X,Y){let Q=!1;return(J)=>{if(Q)qO6();Q=!0,this._release(X,Y,J)}}_release(X,Y,Q){if(X.on("error",Y),X._poolUseCount=(X._poolUseCount||0)+1,this.emit("release",Q,X),Q||this.ending||!X._queryable||X._ending||X._poolUseCount>=this.options.maxUses){if(X._poolUseCount>=this.options.maxUses)this.log("remove expended client");return this._remove(X,this._pulseQueue.bind(this))}if(this._expired.has(X))return this.log("remove expired client"),this._expired.delete(X),this._remove(X,this._pulseQueue.bind(this));let G;if(this.options.idleTimeoutMillis&&this._isAboveMin()){if(G=setTimeout(()=>{if(this._isAboveMin())this.log("remove idle client"),this._remove(X,this._pulseQueue.bind(this))},this.options.idleTimeoutMillis),this.options.allowExitOnIdle)G.unref()}if(this.options.allowExitOnIdle)X.unref();this._idle.push(new Et0(X,Y,G)),this._pulseQueue()}query(X,Y,Q){if(typeof X==="function"){let G=bv(this.Promise,X);return setImmediate(function(){return G.callback(Error("Passing a function as the first parameter to pool.query is not supported"))}),G.result}if(typeof Y==="function")Q=Y,Y=void 0;let J=bv(this.Promise,Q);return Q=J.callback,this.connect((G,W)=>{if(G)return Q(G);let Z=!1,$=(K)=>{if(Z)return;Z=!0,W.release(K),Q(K)};W.once("error",$),this.log("dispatching query");try{W.query(X,Y,(K,H)=>{if(this.log("query dispatched"),W.removeListener("error",$),Z)return;if(Z=!0,W.release(K),K)return Q(K);return Q(void 0,H)})}catch(K){return W.release(K),Q(K)}}),J.result}end(X){if(this.log("ending"),this.ending){let Q=Error("Called end on pool more than once");return X?X(Q):this.Promise.reject(Q)}this.ending=!0;let Y=bv(this.Promise,X);return this._endCallback=Y.callback,this._pulseQueue(),Y.result}get waitingCount(){return this._pendingQueue.length}get idleCount(){return this._idle.length}get expiredCount(){return this._clients.reduce((X,Y)=>X+(this._expired.has(Y)?1:0),0)}get totalCount(){return this._clients.length}}Ct0.exports=jt0});var kt0=I((gE4,St0)=>{var Rt0=z0("events").EventEmitter,UO6=z0("util"),Q00=cz(),sz=St0.exports=function(X,Y,Q){Rt0.call(this),X=Q00.normalizeQueryConfig(X,Y,Q),this.text=X.text,this.values=X.values,this.name=X.name,this.queryMode=X.queryMode,this.callback=X.callback,this.state="new",this._arrayMode=X.rowMode==="array",this._emitRowEvents=!1,this.on("newListener",function(J){if(J==="row")this._emitRowEvents=!0}.bind(this))};UO6.inherits(sz,Rt0);var BO6={sqlState:"code",statementPosition:"position",messagePrimary:"message",context:"where",schemaName:"schema",tableName:"table",columnName:"column",dataTypeName:"dataType",constraintName:"constraint",sourceFile:"file",sourceLine:"line",sourceFunction:"routine"};sz.prototype.handleError=function(X){let Y=this.native.pq.resultErrorFields();if(Y)for(let Q in Y){let J=BO6[Q]||Q;X[J]=Y[Q]}if(this.callback)this.callback(X);else this.emit("error",X);this.state="error"};sz.prototype.then=function(X,Y){return this._getPromise().then(X,Y)};sz.prototype.catch=function(X){return this._getPromise().catch(X)};sz.prototype._getPromise=function(){if(this._promise)return this._promise;return this._promise=new Promise(function(X,Y){this._once("end",X),this._once("error",Y)}.bind(this)),this._promise};sz.prototype.submit=function(X){this.state="running";let Y=this;this.native=X.native,X.native.arrayMode=this._arrayMode;let Q=function(J,G,W){if(X.native.arrayMode=!1,setImmediate(function(){Y.emit("_done")}),J)return Y.handleError(J);if(Y._emitRowEvents)if(W.length>1)G.forEach((Z,$)=>{Z.forEach((K)=>{Y.emit("row",K,W[$])})});else G.forEach(function(Z){Y.emit("row",Z,W)});if(Y.state="end",Y.emit("end",W),Y.callback)Y.callback(null,W)};if(process.domain)Q=process.domain.bind(Q);if(this.name){if(this.name.length>63)console.error("Warning! Postgres only supports 63 characters for query names."),console.error("You supplied %s (%s)",this.name,this.name.length),console.error("This can cause conflicts and silent errors executing queries");let J=(this.values||[]).map(Q00.prepareValue);if(X.namedQueries[this.name]){if(this.text&&X.namedQueries[this.name]!==this.text){let G=Error(`Prepared statements must be unique - '${this.name}' was used for a different statement`);return Q(G)}return X.native.execute(this.name,J,Q)}return X.native.prepare(this.name,this.text,J.length,function(G){if(G)return Q(G);return X.namedQueries[Y.name]=Y.text,Y.native.execute(Y.name,J,Q)})}else if(this.values){if(!Array.isArray(this.values)){let G=Error("Query values must be an array");return Q(G)}let J=this.values.map(Q00.prepareValue);X.native.query(this.text,J,Q)}else if(this.queryMode==="extended")X.native.query(this.text,[],Q);else X.native.query(this.text,Q)}});var J00=I((uE4,bt0)=>{var vt0;try{vt0=(()=>{throw new Error("Cannot require module "+"pg-native");})()}catch(X){throw X}var DO6=Iv(),_t0=z0("events").EventEmitter,NO6=z0("util"),OO6=me(),yt0=kt0(),aY=bt0.exports=function(X){_t0.call(this),X=X||{},this._Promise=X.Promise||global.Promise,this._types=new DO6(X.types),this.native=new vt0({types:this._types}),this._queryQueue=[],this._ending=!1,this._connecting=!1,this._connected=!1,this._queryable=!0;let Y=this.connectionParameters=new OO6(X);if(X.nativeConnectionString)Y.nativeConnectionString=X.nativeConnectionString;this.user=Y.user,Object.defineProperty(this,"password",{configurable:!0,enumerable:!1,writable:!0,value:Y.password}),this.database=Y.database,this.host=Y.host,this.port=Y.port,this.namedQueries={}};aY.Query=yt0;NO6.inherits(aY,_t0);aY.prototype._errorAllQueries=function(X){let Y=(Q)=>{process.nextTick(()=>{Q.native=this.native,Q.handleError(X)})};if(this._hasActiveQuery())Y(this._activeQuery),this._activeQuery=null;this._queryQueue.forEach(Y),this._queryQueue.length=0};aY.prototype._connect=function(X){let Y=this;if(this._connecting){process.nextTick(()=>X(Error("Client has already been connected. You cannot reuse a client.")));return}this._connecting=!0,this.connectionParameters.getLibpqConnectionString(function(Q,J){if(Y.connectionParameters.nativeConnectionString)J=Y.connectionParameters.nativeConnectionString;if(Q)return X(Q);Y.native.connect(J,function(G){if(G)return Y.native.end(),X(G);Y._connected=!0,Y.native.on("error",function(W){Y._queryable=!1,Y._errorAllQueries(W),Y.emit("error",W)}),Y.native.on("notification",function(W){Y.emit("notification",{channel:W.relname,payload:W.extra})}),Y.emit("connect"),Y._pulseQueryQueue(!0),X()})})};aY.prototype.connect=function(X){if(X){this._connect(X);return}return new this._Promise((Y,Q)=>{this._connect((J)=>{if(J)Q(J);else Y()})})};aY.prototype.query=function(X,Y,Q){let J,G,W,Z,$;if(X===null||X===void 0)throw TypeError("Client was passed a null or undefined query");else if(typeof X.submit==="function"){if(W=X.query_timeout||this.connectionParameters.query_timeout,G=J=X,typeof Y==="function")X.callback=Y}else if(W=X.query_timeout||this.connectionParameters.query_timeout,J=new yt0(X,Y,Q),!J.callback){let K,H;G=new this._Promise((F,V)=>{K=F,H=V}).catch((F)=>{throw Error.captureStackTrace(F),F}),J.callback=(F,V)=>F?H(F):K(V)}if(W)$=J.callback,Z=setTimeout(()=>{let K=Error("Query read timeout");process.nextTick(()=>{J.handleError(K,this.connection)}),$(K),J.callback=()=>{};let H=this._queryQueue.indexOf(J);if(H>-1)this._queryQueue.splice(H,1);this._pulseQueryQueue()},W),J.callback=(K,H)=>{clearTimeout(Z),$(K,H)};if(!this._queryable)return J.native=this.native,process.nextTick(()=>{J.handleError(Error("Client has encountered a connection error and is not queryable"))}),G;if(this._ending)return J.native=this.native,process.nextTick(()=>{J.handleError(Error("Client was closed and is not queryable"))}),G;return this._queryQueue.push(J),this._pulseQueryQueue(),G};aY.prototype.end=function(X){let Y=this;if(this._ending=!0,!this._connected)this.once("connect",this.end.bind(this,X));let Q;if(!X)Q=new this._Promise(function(J,G){X=(W)=>W?G(W):J()});return this.native.end(function(){Y._errorAllQueries(Error("Connection terminated")),process.nextTick(()=>{if(Y.emit("end"),X)X()})}),Q};aY.prototype._hasActiveQuery=function(){return this._activeQuery&&this._activeQuery.state!=="error"&&this._activeQuery.state!=="end"};aY.prototype._pulseQueryQueue=function(X){if(!this._connected)return;if(this._hasActiveQuery())return;let Y=this._queryQueue.shift();if(!Y){if(!X)this.emit("drain");return}this._activeQuery=Y,Y.submit(this);let Q=this;Y.once("_done",function(){Q._pulseQueryQueue()})};aY.prototype.cancel=function(X){if(this._activeQuery===X)this.native.cancel(function(){});else if(this._queryQueue.indexOf(X)!==-1)this._queryQueue.splice(this._queryQueue.indexOf(X),1)};aY.prototype.ref=function(){};aY.prototype.unref=function(){};aY.prototype.setTypeParser=function(X,Y,Q){return this._types.setTypeParser(X,Y,Q)};aY.prototype.getTypeParser=function(X,Y){return this._types.getTypeParser(X,Y)}});var Y00=I((mE4,fv)=>{var LO6=Pt0(),wO6=iw(),MO6=re(),PO6=le(),TO6=cz(),AO6=It0(),EO6=Iv(),{DatabaseError:jO6}=ae(),{escapeIdentifier:CO6,escapeLiteral:IO6}=cz(),RO6=(X)=>{return class extends AO6{constructor(Q){super(Q,X)}}},ft0=function(X){this.defaults=wO6,this.Client=X,this.Query=this.Client.Query,this.Pool=RO6(this.Client),this._pools=[],this.Connection=MO6,this.types=nw(),this.DatabaseError=jO6,this.TypeOverrides=EO6,this.escapeIdentifier=CO6,this.escapeLiteral=IO6,this.Result=PO6,this.utils=TO6},ht0=LO6,xt0=!1;try{xt0=!!process.env.NODE_PG_FORCE_NATIVE}catch{}if(xt0)ht0=J00();fv.exports=new ft0(ht0);Object.defineProperty(fv.exports,"native",{configurable:!0,enumerable:!1,get(){let X=null;try{X=new ft0(J00())}catch(Y){if(Y.code!=="MODULE_NOT_FOUND")throw Y}return Object.defineProperty(fv.exports,"native",{value:X}),X}})});function tt0(X){if(!X)return!1;try{return new URL(X).host==="api.decocms.com"&&X!=="https://api.decocms.com/mcp/registry"}catch{return!1}}function et0(X){return{id:I$.REGISTRY(X),title:"Deco Store",description:"Official deco MCP registry with curated integrations",connection_type:"HTTP",connection_url:"https://api.decocms.com/mcp/registry",icon:"https://assets.decocache.com/decocms/00ccf6c3-9e13-4517-83b0-75ab84554bb9/596364c63320075ca58483660156b6d9de9b526e.png",app_name:"deco-registry",app_id:null,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!0,type:"registry"}}}function Xe0(){return{id:w5.COMMUNITY_REGISTRY,title:"MCP Registry",description:"Community MCP registry with thousands of handy MCPs",connection_type:"HTTP",connection_url:"https://sites-registry.decocache.com/mcp",icon:"https://assets.decocache.com/decocms/cd7ca472-0f72-463a-b0de-6e44bdd0f9b4/mcp.png",app_name:"mcp-registry",app_id:null,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!0,type:"registry"}}}function Ye0(X){return{id:w5.SELF,title:"Mesh MCP",description:"The MCP for the mesh API",connection_type:"HTTP",connection_url:`${X}/mcp`,icon:"https://assets.decocache.com/mcp/09e44283-f47d-4046-955f-816d227c626f/app.png",app_name:"@deco/management-mcp",connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!0,type:I$.SELF}}}function Qe0(X){return{id:`decopilot-${X}`,organization_id:X,title:"Decopilot",description:"Default agent that aggregates all organization connections",icon:"https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png",tool_selection_mode:"exclusion",status:"active",created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:"system",updated_by:void 0,connections:[{connection_id:I$.SELF(X),selected_tools:null,selected_resources:null,selected_prompts:null},{connection_id:I$.REGISTRY(X),selected_tools:null,selected_resources:null,selected_prompts:null}]}}var st0="https://api.decocms.com/mcp/registry",w5,I$;var R$=i(()=>{w5={SELF:"self",REGISTRY:"registry",COMMUNITY_REGISTRY:"community-registry"},I$={SELF:(X)=>`${X}_${w5.SELF}`,REGISTRY:(X)=>`${X}_${w5.REGISTRY}`,COMMUNITY_REGISTRY:(X)=>`${X}_${w5.COMMUNITY_REGISTRY}`}});function g3(X){return X!==null&&X!==void 0&&"command"in X}var lO6,dO6,pO6,cO6,vJ,$e0,Ke0;var MW=i(()=>{e0();lO6=U.object({authorizationEndpoint:U.string().url(),tokenEndpoint:U.string().url(),introspectionEndpoint:U.string().url().optional(),clientId:U.string(),clientSecret:U.string().optional(),scopes:U.array(U.string()),grantType:U.enum(["authorization_code","client_credentials"])}),dO6=U.object({name:U.string(),description:U.string().optional(),inputSchema:U.record(U.string(),U.unknown()),outputSchema:U.record(U.string(),U.unknown()).optional()}),pO6=U.object({headers:U.record(U.string(),U.string()).optional()}),cO6=U.object({command:U.string().describe("Command to run (e.g., 'npx', 'node')"),args:U.array(U.string()).optional().describe("Command arguments"),cwd:U.string().optional().describe("Working directory"),envVars:U.record(U.string(),U.string()).optional().describe("Environment variables (encrypted in storage)")}),vJ=U.object({id:U.string().describe("Unique identifier for the connection"),title:U.string().describe("Human-readable name for the connection"),created_at:U.string().describe("When the connection was created"),updated_at:U.string().describe("When the connection was last updated"),created_by:U.string().describe("User ID who created the connection"),updated_by:U.string().optional().describe("User ID who last updated the connection"),organization_id:U.string().describe("Organization ID this connection belongs to"),description:U.string().nullable().describe("Description of the connection"),icon:U.string().nullable().describe("Icon URL for the connection"),app_name:U.string().nullable().describe("Associated app name"),app_id:U.string().nullable().describe("Associated app ID"),connection_type:U.enum(["HTTP","SSE","Websocket","STDIO"]).describe("Type of connection"),connection_url:U.string().nullable().describe("URL for HTTP/SSE/WebSocket connections. Null for STDIO."),connection_token:U.string().nullable().describe("Authentication token (for HTTP connections)"),connection_headers:U.union([cO6,pO6]).nullable().describe("Connection parameters. HTTP: { headers }. STDIO: { command, args, cwd, envVars }"),oauth_config:lO6.nullable().describe("OAuth configuration"),configuration_state:U.record(U.string(),U.unknown()).nullable().describe("Configuration state (decrypted)"),configuration_scopes:U.array(U.string()).nullable().optional().describe("Configuration scopes"),metadata:U.record(U.string(),U.unknown()).nullable().describe("Additional metadata (includes repository info)"),tools:U.array(dO6).nullable().describe("Discovered tools from MCP"),bindings:U.array(U.string()).nullable().describe("Detected bindings"),status:U.enum(["active","inactive","error"]).describe("Current status")}),$e0=vJ.omit({created_at:!0,updated_at:!0,created_by:!0,updated_by:!0,organization_id:!0,tools:!0,bindings:!0,status:!0}).partial({id:!0,description:!0,icon:!0,app_name:!0,app_id:!0,connection_url:!0,connection_token:!0,connection_headers:!0,oauth_config:!0,configuration_state:!0,configuration_scopes:!0,metadata:!0}),Ke0=vJ.partial()});var He0="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";import{webcrypto as Fe0}from"crypto";function iO6(X){if(!u3||u3.length<X)u3=Buffer.allocUnsafe(X*nO6),Fe0.getRandomValues(u3),tz=0;else if(tz+X>u3.length)Fe0.getRandomValues(u3),tz=0;tz+=X}function Ve0(X=21){iO6(X|=0);let Y="";for(let Q=tz-X;Q<tz;Q++)Y+=He0[u3[Q]&63];return Y}var nO6=128,u3,tz;var qe0=()=>{};function rY(X){return`${X}_${Ve0()}`}function ze0(X,Y){return X.startsWith(`${Y}_`)}var m3=i(()=>{qe0()});var _6,Ue0,G1,PW=(X)=>{switch(typeof X){case"undefined":return G1.undefined;case"string":return G1.string;case"number":return Number.isNaN(X)?G1.nan:G1.number;case"boolean":return G1.boolean;case"function":return G1.function;case"bigint":return G1.bigint;case"symbol":return G1.symbol;case"object":if(Array.isArray(X))return G1.array;if(X===null)return G1.null;if(X.then&&typeof X.then==="function"&&X.catch&&typeof X.catch==="function")return G1.promise;if(typeof Map<"u"&&X instanceof Map)return G1.map;if(typeof Set<"u"&&X instanceof Set)return G1.set;if(typeof Date<"u"&&X instanceof Date)return G1.date;return G1.object;default:return G1.unknown}};var XM=i(()=>{(function(X){X.assertEqual=(G)=>{};function Y(G){}X.assertIs=Y;function Q(G){throw Error()}X.assertNever=Q,X.arrayToEnum=(G)=>{let W={};for(let Z of G)W[Z]=Z;return W},X.getValidEnumValues=(G)=>{let W=X.objectKeys(G).filter(($)=>typeof G[G[$]]!=="number"),Z={};for(let $ of W)Z[$]=G[$];return X.objectValues(Z)},X.objectValues=(G)=>{return X.objectKeys(G).map(function(W){return G[W]})},X.objectKeys=typeof Object.keys==="function"?(G)=>Object.keys(G):(G)=>{let W=[];for(let Z in G)if(Object.prototype.hasOwnProperty.call(G,Z))W.push(Z);return W},X.find=(G,W)=>{for(let Z of G)if(W(Z))return Z;return},X.isInteger=typeof Number.isInteger==="function"?(G)=>Number.isInteger(G):(G)=>typeof G==="number"&&Number.isFinite(G)&&Math.floor(G)===G;function J(G,W=" | "){return G.map((Z)=>typeof Z==="string"?`'${Z}'`:Z).join(W)}X.joinValues=J,X.jsonStringifyReplacer=(G,W)=>{if(typeof W==="bigint")return W.toString();return W}})(_6||(_6={}));(function(X){X.mergeShapes=(Y,Q)=>{return{...Y,...Q}}})(Ue0||(Ue0={}));G1=_6.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var n0,yQ;var uv=i(()=>{XM();n0=_6.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);yQ=class yQ extends Error{get errors(){return this.issues}constructor(X){super();this.issues=[],this.addIssue=(Q)=>{this.issues=[...this.issues,Q]},this.addIssues=(Q=[])=>{this.issues=[...this.issues,...Q]};let Y=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,Y);else this.__proto__=Y;this.name="ZodError",this.issues=X}format(X){let Y=X||function(G){return G.message},Q={_errors:[]},J=(G)=>{for(let W of G.issues)if(W.code==="invalid_union")W.unionErrors.map(J);else if(W.code==="invalid_return_type")J(W.returnTypeError);else if(W.code==="invalid_arguments")J(W.argumentsError);else if(W.path.length===0)Q._errors.push(Y(W));else{let Z=Q,$=0;while($<W.path.length){let K=W.path[$];if($!==W.path.length-1)Z[K]=Z[K]||{_errors:[]};else Z[K]=Z[K]||{_errors:[]},Z[K]._errors.push(Y(W));Z=Z[K],$++}}};return J(this),Q}static assert(X){if(!(X instanceof yQ))throw Error(`Not a ZodError: ${X}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,_6.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(X=(Y)=>Y.message){let Y=Object.create(null),Q=[];for(let J of this.issues)if(J.path.length>0){let G=J.path[0];Y[G]=Y[G]||[],Y[G].push(X(J))}else Q.push(X(J));return{formErrors:Q,fieldErrors:Y}}get formErrors(){return this.flatten()}};yQ.create=(X)=>{return new yQ(X)}});var rO6=(X,Y)=>{let Q;switch(X.code){case n0.invalid_type:if(X.received===G1.undefined)Q="Required";else Q=`Expected ${X.expected}, received ${X.received}`;break;case n0.invalid_literal:Q=`Invalid literal value, expected ${JSON.stringify(X.expected,_6.jsonStringifyReplacer)}`;break;case n0.unrecognized_keys:Q=`Unrecognized key(s) in object: ${_6.joinValues(X.keys,", ")}`;break;case n0.invalid_union:Q="Invalid input";break;case n0.invalid_union_discriminator:Q=`Invalid discriminator value. Expected ${_6.joinValues(X.options)}`;break;case n0.invalid_enum_value:Q=`Invalid enum value. Expected ${_6.joinValues(X.options)}, received '${X.received}'`;break;case n0.invalid_arguments:Q="Invalid function arguments";break;case n0.invalid_return_type:Q="Invalid function return type";break;case n0.invalid_date:Q="Invalid date";break;case n0.invalid_string:if(typeof X.validation==="object")if("includes"in X.validation){if(Q=`Invalid input: must include "${X.validation.includes}"`,typeof X.validation.position==="number")Q=`${Q} at one or more positions greater than or equal to ${X.validation.position}`}else if("startsWith"in X.validation)Q=`Invalid input: must start with "${X.validation.startsWith}"`;else if("endsWith"in X.validation)Q=`Invalid input: must end with "${X.validation.endsWith}"`;else _6.assertNever(X.validation);else if(X.validation!=="regex")Q=`Invalid ${X.validation}`;else Q="Invalid";break;case n0.too_small:if(X.type==="array")Q=`Array must contain ${X.exact?"exactly":X.inclusive?"at least":"more than"} ${X.minimum} element(s)`;else if(X.type==="string")Q=`String must contain ${X.exact?"exactly":X.inclusive?"at least":"over"} ${X.minimum} character(s)`;else if(X.type==="number")Q=`Number must be ${X.exact?"exactly equal to ":X.inclusive?"greater than or equal to ":"greater than "}${X.minimum}`;else if(X.type==="bigint")Q=`Number must be ${X.exact?"exactly equal to ":X.inclusive?"greater than or equal to ":"greater than "}${X.minimum}`;else if(X.type==="date")Q=`Date must be ${X.exact?"exactly equal to ":X.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(X.minimum))}`;else Q="Invalid input";break;case n0.too_big:if(X.type==="array")Q=`Array must contain ${X.exact?"exactly":X.inclusive?"at most":"less than"} ${X.maximum} element(s)`;else if(X.type==="string")Q=`String must contain ${X.exact?"exactly":X.inclusive?"at most":"under"} ${X.maximum} character(s)`;else if(X.type==="number")Q=`Number must be ${X.exact?"exactly":X.inclusive?"less than or equal to":"less than"} ${X.maximum}`;else if(X.type==="bigint")Q=`BigInt must be ${X.exact?"exactly":X.inclusive?"less than or equal to":"less than"} ${X.maximum}`;else if(X.type==="date")Q=`Date must be ${X.exact?"exactly":X.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(X.maximum))}`;else Q="Invalid input";break;case n0.custom:Q="Invalid input";break;case n0.invalid_intersection_types:Q="Intersection results could not be merged";break;case n0.not_multiple_of:Q=`Number must be a multiple of ${X.multipleOf}`;break;case n0.not_finite:Q="Number must be finite";break;default:Q=Y.defaultError,_6.assertNever(X)}return{message:Q}},S$;var H00=i(()=>{uv();XM();S$=rO6});function YM(){return oO6}var oO6;var mv=i(()=>{H00();oO6=S$});function z1(X,Y){let Q=YM(),J=lv({issueData:Y,data:X.data,path:X.path,errorMaps:[X.common.contextualErrorMap,X.schemaErrorMap,Q,Q===S$?void 0:S$].filter((G)=>!!G)});X.common.issues.push(J)}class fX{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(X,Y){let Q=[];for(let J of Y){if(J.status==="aborted")return X6;if(J.status==="dirty")X.dirty();Q.push(J.value)}return{status:X.value,value:Q}}static async mergeObjectAsync(X,Y){let Q=[];for(let J of Y){let G=await J.key,W=await J.value;Q.push({key:G,value:W})}return fX.mergeObjectSync(X,Q)}static mergeObjectSync(X,Y){let Q={};for(let J of Y){let{key:G,value:W}=J;if(G.status==="aborted")return X6;if(W.status==="aborted")return X6;if(G.status==="dirty")X.dirty();if(W.status==="dirty")X.dirty();if(G.value!=="__proto__"&&(typeof W.value<"u"||J.alwaysSet))Q[G.value]=W.value}return{status:X.value,value:Q}}}var lv=(X)=>{let{data:Y,path:Q,errorMaps:J,issueData:G}=X,W=[...Q,...G.path||[]],Z={...G,path:W};if(G.message!==void 0)return{...G,path:W,message:G.message};let $="",K=J.filter((H)=>!!H).slice().reverse();for(let H of K)$=H(Z,{data:Y,defaultError:$}).message;return{...G,path:W,message:$}},X6,ez=(X)=>({status:"dirty",value:X}),UY=(X)=>({status:"valid",value:X}),F00=(X)=>X.status==="aborted",V00=(X)=>X.status==="dirty",l3=(X)=>X.status==="valid",QM=(X)=>typeof Promise<"u"&&X instanceof Promise;var q00=i(()=>{mv();H00();X6=Object.freeze({status:"aborted"})});var Be0=()=>{};var j1;var De0=i(()=>{(function(X){X.errToObj=(Y)=>typeof Y==="string"?{message:Y}:Y||{},X.toString=(Y)=>typeof Y==="string"?Y:Y?.message})(j1||(j1={}))});class M5{constructor(X,Y,Q,J){this._cachedPath=[],this.parent=X,this.data=Y,this._path=Q,this._key=J}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function B6(X){if(!X)return{};let{errorMap:Y,invalid_type_error:Q,required_error:J,description:G}=X;if(Y&&(Q||J))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(Y)return{errorMap:Y,description:G};return{errorMap:(Z,$)=>{let{message:K}=X;if(Z.code==="invalid_enum_value")return{message:K??$.defaultError};if(typeof $.data>"u")return{message:K??J??$.defaultError};if(Z.code!=="invalid_type")return{message:$.defaultError};return{message:K??Q??$.defaultError}},description:G}}class E6{get description(){return this._def.description}_getType(X){return PW(X.data)}_getOrReturnCtx(X,Y){return Y||{common:X.parent.common,data:X.data,parsedType:PW(X.data),schemaErrorMap:this._def.errorMap,path:X.path,parent:X.parent}}_processInputParams(X){return{status:new fX,ctx:{common:X.parent.common,data:X.data,parsedType:PW(X.data),schemaErrorMap:this._def.errorMap,path:X.path,parent:X.parent}}}_parseSync(X){let Y=this._parse(X);if(QM(Y))throw Error("Synchronous parse encountered promise.");return Y}_parseAsync(X){let Y=this._parse(X);return Promise.resolve(Y)}parse(X,Y){let Q=this.safeParse(X,Y);if(Q.success)return Q.data;throw Q.error}safeParse(X,Y){let Q={common:{issues:[],async:Y?.async??!1,contextualErrorMap:Y?.errorMap},path:Y?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:X,parsedType:PW(X)},J=this._parseSync({data:X,path:Q.path,parent:Q});return Ne0(Q,J)}"~validate"(X){let Y={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:X,parsedType:PW(X)};if(!this["~standard"].async)try{let Q=this._parseSync({data:X,path:[],parent:Y});return l3(Q)?{value:Q.value}:{issues:Y.common.issues}}catch(Q){if(Q?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;Y.common={issues:[],async:!0}}return this._parseAsync({data:X,path:[],parent:Y}).then((Q)=>l3(Q)?{value:Q.value}:{issues:Y.common.issues})}async parseAsync(X,Y){let Q=await this.safeParseAsync(X,Y);if(Q.success)return Q.data;throw Q.error}async safeParseAsync(X,Y){let Q={common:{issues:[],contextualErrorMap:Y?.errorMap,async:!0},path:Y?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:X,parsedType:PW(X)},J=this._parse({data:X,path:Q.path,parent:Q}),G=await(QM(J)?J:Promise.resolve(J));return Ne0(Q,G)}refine(X,Y){let Q=(J)=>{if(typeof Y==="string"||typeof Y>"u")return{message:Y};else if(typeof Y==="function")return Y(J);else return Y};return this._refinement((J,G)=>{let W=X(J),Z=()=>G.addIssue({code:n0.custom,...Q(J)});if(typeof Promise<"u"&&W instanceof Promise)return W.then(($)=>{if(!$)return Z(),!1;else return!0});if(!W)return Z(),!1;else return!0})}refinement(X,Y){return this._refinement((Q,J)=>{if(!X(Q))return J.addIssue(typeof Y==="function"?Y(Q,J):Y),!1;else return!0})}_refinement(X){return new sG({schema:this,typeName:A0.ZodEffects,effect:{type:"refinement",refinement:X}})}superRefine(X){return this._refinement(X)}constructor(X){this.spa=this.safeParseAsync,this._def=X,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(Y)=>this["~validate"](Y)}}optional(){return oG.create(this,this._def)}nullable(){return k$.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rG.create(this)}promise(){return GU.create(this,this._def)}or(X){return $M.create([this,X],this._def)}and(X){return KM.create(this,X,this._def)}transform(X){return new sG({...B6(this._def),schema:this,typeName:A0.ZodEffects,effect:{type:"transform",transform:X}})}default(X){let Y=typeof X==="function"?X:()=>X;return new qM({...B6(this._def),innerType:this,defaultValue:Y,typeName:A0.ZodDefault})}brand(){return new D00({typeName:A0.ZodBranded,type:this,...B6(this._def)})}catch(X){let Y=typeof X==="function"?X:()=>X;return new zM({...B6(this._def),innerType:this,catchValue:Y,typeName:A0.ZodCatch})}describe(X){return new this.constructor({...this._def,description:X})}pipe(X){return ov.create(this,X)}readonly(){return UM.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function Le0(X){let Y="[0-5]\\d";if(X.precision)Y=`${Y}\\.\\d{${X.precision}}`;else if(X.precision==null)Y=`${Y}(\\.\\d+)?`;let Q=X.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${Y})${Q}`}function zL6(X){return new RegExp(`^${Le0(X)}$`)}function UL6(X){let Y=`${Oe0}T${Le0(X)}`,Q=[];if(Q.push(X.local?"Z?":"Z"),X.offset)Q.push("([+-]\\d{2}:?\\d{2})");return Y=`${Y}(${Q.join("|")})`,new RegExp(`^${Y}$`)}function BL6(X,Y){if((Y==="v4"||!Y)&&ZL6.test(X))return!0;if((Y==="v6"||!Y)&&KL6.test(X))return!0;return!1}function DL6(X,Y){if(!QL6.test(X))return!1;try{let[Q]=X.split(".");if(!Q)return!1;let J=Q.replace(/-/g,"+").replace(/_/g,"/").padEnd(Q.length+(4-Q.length%4)%4,"="),G=JSON.parse(atob(J));if(typeof G!=="object"||G===null)return!1;if("typ"in G&&G?.typ!=="JWT")return!1;if(!G.alg)return!1;if(Y&&G.alg!==Y)return!1;return!0}catch{return!1}}function NL6(X,Y){if((Y==="v4"||!Y)&&$L6.test(X))return!0;if((Y==="v6"||!Y)&&HL6.test(X))return!0;return!1}function OL6(X,Y){let Q=(X.toString().split(".")[1]||"").length,J=(Y.toString().split(".")[1]||"").length,G=Q>J?Q:J,W=Number.parseInt(X.toFixed(G).replace(".","")),Z=Number.parseInt(Y.toFixed(G).replace(".",""));return W%Z/10**G}function XU(X){if(X instanceof k8){let Y={};for(let Q in X.shape){let J=X.shape[Q];Y[Q]=oG.create(XU(J))}return new k8({...X._def,shape:()=>Y})}else if(X instanceof rG)return new rG({...X._def,type:XU(X.element)});else if(X instanceof oG)return oG.create(XU(X.unwrap()));else if(X instanceof k$)return k$.create(XU(X.unwrap()));else if(X instanceof jW)return jW.create(X.items.map((Y)=>XU(Y)));else return X}function U00(X,Y){let Q=PW(X),J=PW(Y);if(X===Y)return{valid:!0,data:X};else if(Q===G1.object&&J===G1.object){let G=_6.objectKeys(Y),W=_6.objectKeys(X).filter(($)=>G.indexOf($)!==-1),Z={...X,...Y};for(let $ of W){let K=U00(X[$],Y[$]);if(!K.valid)return{valid:!1};Z[$]=K.data}return{valid:!0,data:Z}}else if(Q===G1.array&&J===G1.array){if(X.length!==Y.length)return{valid:!1};let G=[];for(let W=0;W<X.length;W++){let Z=X[W],$=Y[W],K=U00(Z,$);if(!K.valid)return{valid:!1};G.push(K.data)}return{valid:!0,data:G}}else if(Q===G1.date&&J===G1.date&&+X===+Y)return{valid:!0,data:X};else return{valid:!1}}function we0(X,Y){return new p3({values:X,typeName:A0.ZodEnum,...B6(Y)})}var Ne0=(X,Y)=>{if(l3(Y))return{success:!0,data:Y.value};else{if(!X.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let Q=new yQ(X.common.issues);return this._error=Q,this._error}}}},sO6,tO6,eO6,XL6,YL6,QL6,JL6,GL6,WL6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",z00,ZL6,$L6,KL6,HL6,FL6,VL6,Oe0="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",qL6,AW,YU,QU,dv,GM,pv,WM,ZM,cv,d3,EW,nv,rG,k8,$M,TW=(X)=>{if(X instanceof HM)return TW(X.schema);else if(X instanceof sG)return TW(X.innerType());else if(X instanceof FM)return[X.value];else if(X instanceof p3)return X.options;else if(X instanceof VM)return _6.objectValues(X.enum);else if(X instanceof qM)return TW(X._def.innerType);else if(X instanceof WM)return[void 0];else if(X instanceof ZM)return[null];else if(X instanceof oG)return[void 0,...TW(X.unwrap())];else if(X instanceof k$)return[null,...TW(X.unwrap())];else if(X instanceof D00)return TW(X.unwrap());else if(X instanceof UM)return TW(X.unwrap());else if(X instanceof zM)return TW(X._def.innerType);else return[]},B00,KM,jW,iv,av,JU,JM,HM,FM,p3,VM,GU,sG,oG,k$,qM,zM,rv,dj4,D00,ov,UM,pj4,A0,cj4,nj4,ij4,aj4,rj4,oj4,sj4,tj4,ej4,X24,Y24,Q24,J24,G24,Me0,W24,Z24,$24,K24,H24,F24,V24,q24,z24,U24,B24,D24,N24,O24,L24,w24,M24,P24,T24;var Pe0=i(()=>{uv();mv();De0();q00();XM();sO6=/^c[^\s-]{8,}$/i,tO6=/^[0-9a-z]+$/,eO6=/^[0-9A-HJKMNP-TV-Z]{26}$/i,XL6=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,YL6=/^[a-z0-9_-]{21}$/i,QL6=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,JL6=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,GL6=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ZL6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,$L6=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,KL6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,HL6=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,FL6=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,VL6=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,qL6=new RegExp(`^${Oe0}$`);AW=class AW extends E6{_parse(X){if(this._def.coerce)X.data=String(X.data);if(this._getType(X)!==G1.string){let G=this._getOrReturnCtx(X);return z1(G,{code:n0.invalid_type,expected:G1.string,received:G.parsedType}),X6}let Q=new fX,J=void 0;for(let G of this._def.checks)if(G.kind==="min"){if(X.data.length<G.value)J=this._getOrReturnCtx(X,J),z1(J,{code:n0.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),Q.dirty()}else if(G.kind==="max"){if(X.data.length>G.value)J=this._getOrReturnCtx(X,J),z1(J,{code:n0.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!1,message:G.message}),Q.dirty()}else if(G.kind==="length"){let W=X.data.length>G.value,Z=X.data.length<G.value;if(W||Z){if(J=this._getOrReturnCtx(X,J),W)z1(J,{code:n0.too_big,maximum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});else if(Z)z1(J,{code:n0.too_small,minimum:G.value,type:"string",inclusive:!0,exact:!0,message:G.message});Q.dirty()}}else if(G.kind==="email"){if(!GL6.test(X.data))J=this._getOrReturnCtx(X,J),z1(J,{validation:"email",code:n0.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="emoji"){if(!z00)z00=new RegExp(WL6,"u");if(!z00.test(X.data))J=this._getOrReturnCtx(X,J),z1(J,{validation:"emoji",code:n0.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="uuid"){if(!XL6.test(X.data))J=this._getOrReturnCtx(X,J),z1(J,{validation:"uuid",code:n0.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="nanoid"){if(!YL6.test(X.data))J=this._getOrReturnCtx(X,J),z1(J,{validation:"nanoid",code:n0.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="cuid"){if(!sO6.test(X.data))J=this._getOrReturnCtx(X,J),z1(J,{validation:"cuid",code:n0.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="cuid2"){if(!tO6.test(X.data))J=this._getOrReturnCtx(X,J),z1(J,{validation:"cuid2",code:n0.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="ulid"){if(!eO6.test(X.data))J=this._getOrReturnCtx(X,J),z1(J,{validation:"ulid",code:n0.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="url")try{new URL(X.data)}catch{J=this._getOrReturnCtx(X,J),z1(J,{validation:"url",code:n0.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="regex"){if(G.regex.lastIndex=0,!G.regex.test(X.data))J=this._getOrReturnCtx(X,J),z1(J,{validation:"regex",code:n0.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="trim")X.data=X.data.trim();else if(G.kind==="includes"){if(!X.data.includes(G.value,G.position))J=this._getOrReturnCtx(X,J),z1(J,{code:n0.invalid_string,validation:{includes:G.value,position:G.position},message:G.message}),Q.dirty()}else if(G.kind==="toLowerCase")X.data=X.data.toLowerCase();else if(G.kind==="toUpperCase")X.data=X.data.toUpperCase();else if(G.kind==="startsWith"){if(!X.data.startsWith(G.value))J=this._getOrReturnCtx(X,J),z1(J,{code:n0.invalid_string,validation:{startsWith:G.value},message:G.message}),Q.dirty()}else if(G.kind==="endsWith"){if(!X.data.endsWith(G.value))J=this._getOrReturnCtx(X,J),z1(J,{code:n0.invalid_string,validation:{endsWith:G.value},message:G.message}),Q.dirty()}else if(G.kind==="datetime"){if(!UL6(G).test(X.data))J=this._getOrReturnCtx(X,J),z1(J,{code:n0.invalid_string,validation:"datetime",message:G.message}),Q.dirty()}else if(G.kind==="date"){if(!qL6.test(X.data))J=this._getOrReturnCtx(X,J),z1(J,{code:n0.invalid_string,validation:"date",message:G.message}),Q.dirty()}else if(G.kind==="time"){if(!zL6(G).test(X.data))J=this._getOrReturnCtx(X,J),z1(J,{code:n0.invalid_string,validation:"time",message:G.message}),Q.dirty()}else if(G.kind==="duration"){if(!JL6.test(X.data))J=this._getOrReturnCtx(X,J),z1(J,{validation:"duration",code:n0.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="ip"){if(!BL6(X.data,G.version))J=this._getOrReturnCtx(X,J),z1(J,{validation:"ip",code:n0.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="jwt"){if(!DL6(X.data,G.alg))J=this._getOrReturnCtx(X,J),z1(J,{validation:"jwt",code:n0.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="cidr"){if(!NL6(X.data,G.version))J=this._getOrReturnCtx(X,J),z1(J,{validation:"cidr",code:n0.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="base64"){if(!FL6.test(X.data))J=this._getOrReturnCtx(X,J),z1(J,{validation:"base64",code:n0.invalid_string,message:G.message}),Q.dirty()}else if(G.kind==="base64url"){if(!VL6.test(X.data))J=this._getOrReturnCtx(X,J),z1(J,{validation:"base64url",code:n0.invalid_string,message:G.message}),Q.dirty()}else _6.assertNever(G);return{status:Q.value,value:X.data}}_regex(X,Y,Q){return this.refinement((J)=>X.test(J),{validation:Y,code:n0.invalid_string,...j1.errToObj(Q)})}_addCheck(X){return new AW({...this._def,checks:[...this._def.checks,X]})}email(X){return this._addCheck({kind:"email",...j1.errToObj(X)})}url(X){return this._addCheck({kind:"url",...j1.errToObj(X)})}emoji(X){return this._addCheck({kind:"emoji",...j1.errToObj(X)})}uuid(X){return this._addCheck({kind:"uuid",...j1.errToObj(X)})}nanoid(X){return this._addCheck({kind:"nanoid",...j1.errToObj(X)})}cuid(X){return this._addCheck({kind:"cuid",...j1.errToObj(X)})}cuid2(X){return this._addCheck({kind:"cuid2",...j1.errToObj(X)})}ulid(X){return this._addCheck({kind:"ulid",...j1.errToObj(X)})}base64(X){return this._addCheck({kind:"base64",...j1.errToObj(X)})}base64url(X){return this._addCheck({kind:"base64url",...j1.errToObj(X)})}jwt(X){return this._addCheck({kind:"jwt",...j1.errToObj(X)})}ip(X){return this._addCheck({kind:"ip",...j1.errToObj(X)})}cidr(X){return this._addCheck({kind:"cidr",...j1.errToObj(X)})}datetime(X){if(typeof X==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:X});return this._addCheck({kind:"datetime",precision:typeof X?.precision>"u"?null:X?.precision,offset:X?.offset??!1,local:X?.local??!1,...j1.errToObj(X?.message)})}date(X){return this._addCheck({kind:"date",message:X})}time(X){if(typeof X==="string")return this._addCheck({kind:"time",precision:null,message:X});return this._addCheck({kind:"time",precision:typeof X?.precision>"u"?null:X?.precision,...j1.errToObj(X?.message)})}duration(X){return this._addCheck({kind:"duration",...j1.errToObj(X)})}regex(X,Y){return this._addCheck({kind:"regex",regex:X,...j1.errToObj(Y)})}includes(X,Y){return this._addCheck({kind:"includes",value:X,position:Y?.position,...j1.errToObj(Y?.message)})}startsWith(X,Y){return this._addCheck({kind:"startsWith",value:X,...j1.errToObj(Y)})}endsWith(X,Y){return this._addCheck({kind:"endsWith",value:X,...j1.errToObj(Y)})}min(X,Y){return this._addCheck({kind:"min",value:X,...j1.errToObj(Y)})}max(X,Y){return this._addCheck({kind:"max",value:X,...j1.errToObj(Y)})}length(X,Y){return this._addCheck({kind:"length",value:X,...j1.errToObj(Y)})}nonempty(X){return this.min(1,j1.errToObj(X))}trim(){return new AW({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new AW({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new AW({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((X)=>X.kind==="datetime")}get isDate(){return!!this._def.checks.find((X)=>X.kind==="date")}get isTime(){return!!this._def.checks.find((X)=>X.kind==="time")}get isDuration(){return!!this._def.checks.find((X)=>X.kind==="duration")}get isEmail(){return!!this._def.checks.find((X)=>X.kind==="email")}get isURL(){return!!this._def.checks.find((X)=>X.kind==="url")}get isEmoji(){return!!this._def.checks.find((X)=>X.kind==="emoji")}get isUUID(){return!!this._def.checks.find((X)=>X.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((X)=>X.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((X)=>X.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((X)=>X.kind==="cuid2")}get isULID(){return!!this._def.checks.find((X)=>X.kind==="ulid")}get isIP(){return!!this._def.checks.find((X)=>X.kind==="ip")}get isCIDR(){return!!this._def.checks.find((X)=>X.kind==="cidr")}get isBase64(){return!!this._def.checks.find((X)=>X.kind==="base64")}get isBase64url(){return!!this._def.checks.find((X)=>X.kind==="base64url")}get minLength(){let X=null;for(let Y of this._def.checks)if(Y.kind==="min"){if(X===null||Y.value>X)X=Y.value}return X}get maxLength(){let X=null;for(let Y of this._def.checks)if(Y.kind==="max"){if(X===null||Y.value<X)X=Y.value}return X}};AW.create=(X)=>{return new AW({checks:[],typeName:A0.ZodString,coerce:X?.coerce??!1,...B6(X)})};YU=class YU extends E6{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(X){if(this._def.coerce)X.data=Number(X.data);if(this._getType(X)!==G1.number){let G=this._getOrReturnCtx(X);return z1(G,{code:n0.invalid_type,expected:G1.number,received:G.parsedType}),X6}let Q=void 0,J=new fX;for(let G of this._def.checks)if(G.kind==="int"){if(!_6.isInteger(X.data))Q=this._getOrReturnCtx(X,Q),z1(Q,{code:n0.invalid_type,expected:"integer",received:"float",message:G.message}),J.dirty()}else if(G.kind==="min"){if(G.inclusive?X.data<G.value:X.data<=G.value)Q=this._getOrReturnCtx(X,Q),z1(Q,{code:n0.too_small,minimum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),J.dirty()}else if(G.kind==="max"){if(G.inclusive?X.data>G.value:X.data>=G.value)Q=this._getOrReturnCtx(X,Q),z1(Q,{code:n0.too_big,maximum:G.value,type:"number",inclusive:G.inclusive,exact:!1,message:G.message}),J.dirty()}else if(G.kind==="multipleOf"){if(OL6(X.data,G.value)!==0)Q=this._getOrReturnCtx(X,Q),z1(Q,{code:n0.not_multiple_of,multipleOf:G.value,message:G.message}),J.dirty()}else if(G.kind==="finite"){if(!Number.isFinite(X.data))Q=this._getOrReturnCtx(X,Q),z1(Q,{code:n0.not_finite,message:G.message}),J.dirty()}else _6.assertNever(G);return{status:J.value,value:X.data}}gte(X,Y){return this.setLimit("min",X,!0,j1.toString(Y))}gt(X,Y){return this.setLimit("min",X,!1,j1.toString(Y))}lte(X,Y){return this.setLimit("max",X,!0,j1.toString(Y))}lt(X,Y){return this.setLimit("max",X,!1,j1.toString(Y))}setLimit(X,Y,Q,J){return new YU({...this._def,checks:[...this._def.checks,{kind:X,value:Y,inclusive:Q,message:j1.toString(J)}]})}_addCheck(X){return new YU({...this._def,checks:[...this._def.checks,X]})}int(X){return this._addCheck({kind:"int",message:j1.toString(X)})}positive(X){return this._addCheck({kind:"min",value:0,inclusive:!1,message:j1.toString(X)})}negative(X){return this._addCheck({kind:"max",value:0,inclusive:!1,message:j1.toString(X)})}nonpositive(X){return this._addCheck({kind:"max",value:0,inclusive:!0,message:j1.toString(X)})}nonnegative(X){return this._addCheck({kind:"min",value:0,inclusive:!0,message:j1.toString(X)})}multipleOf(X,Y){return this._addCheck({kind:"multipleOf",value:X,message:j1.toString(Y)})}finite(X){return this._addCheck({kind:"finite",message:j1.toString(X)})}safe(X){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:j1.toString(X)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:j1.toString(X)})}get minValue(){let X=null;for(let Y of this._def.checks)if(Y.kind==="min"){if(X===null||Y.value>X)X=Y.value}return X}get maxValue(){let X=null;for(let Y of this._def.checks)if(Y.kind==="max"){if(X===null||Y.value<X)X=Y.value}return X}get isInt(){return!!this._def.checks.find((X)=>X.kind==="int"||X.kind==="multipleOf"&&_6.isInteger(X.value))}get isFinite(){let X=null,Y=null;for(let Q of this._def.checks)if(Q.kind==="finite"||Q.kind==="int"||Q.kind==="multipleOf")return!0;else if(Q.kind==="min"){if(Y===null||Q.value>Y)Y=Q.value}else if(Q.kind==="max"){if(X===null||Q.value<X)X=Q.value}return Number.isFinite(Y)&&Number.isFinite(X)}};YU.create=(X)=>{return new YU({checks:[],typeName:A0.ZodNumber,coerce:X?.coerce||!1,...B6(X)})};QU=class QU extends E6{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(X){if(this._def.coerce)try{X.data=BigInt(X.data)}catch{return this._getInvalidInput(X)}if(this._getType(X)!==G1.bigint)return this._getInvalidInput(X);let Q=void 0,J=new fX;for(let G of this._def.checks)if(G.kind==="min"){if(G.inclusive?X.data<G.value:X.data<=G.value)Q=this._getOrReturnCtx(X,Q),z1(Q,{code:n0.too_small,type:"bigint",minimum:G.value,inclusive:G.inclusive,message:G.message}),J.dirty()}else if(G.kind==="max"){if(G.inclusive?X.data>G.value:X.data>=G.value)Q=this._getOrReturnCtx(X,Q),z1(Q,{code:n0.too_big,type:"bigint",maximum:G.value,inclusive:G.inclusive,message:G.message}),J.dirty()}else if(G.kind==="multipleOf"){if(X.data%G.value!==BigInt(0))Q=this._getOrReturnCtx(X,Q),z1(Q,{code:n0.not_multiple_of,multipleOf:G.value,message:G.message}),J.dirty()}else _6.assertNever(G);return{status:J.value,value:X.data}}_getInvalidInput(X){let Y=this._getOrReturnCtx(X);return z1(Y,{code:n0.invalid_type,expected:G1.bigint,received:Y.parsedType}),X6}gte(X,Y){return this.setLimit("min",X,!0,j1.toString(Y))}gt(X,Y){return this.setLimit("min",X,!1,j1.toString(Y))}lte(X,Y){return this.setLimit("max",X,!0,j1.toString(Y))}lt(X,Y){return this.setLimit("max",X,!1,j1.toString(Y))}setLimit(X,Y,Q,J){return new QU({...this._def,checks:[...this._def.checks,{kind:X,value:Y,inclusive:Q,message:j1.toString(J)}]})}_addCheck(X){return new QU({...this._def,checks:[...this._def.checks,X]})}positive(X){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:j1.toString(X)})}negative(X){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:j1.toString(X)})}nonpositive(X){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:j1.toString(X)})}nonnegative(X){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:j1.toString(X)})}multipleOf(X,Y){return this._addCheck({kind:"multipleOf",value:X,message:j1.toString(Y)})}get minValue(){let X=null;for(let Y of this._def.checks)if(Y.kind==="min"){if(X===null||Y.value>X)X=Y.value}return X}get maxValue(){let X=null;for(let Y of this._def.checks)if(Y.kind==="max"){if(X===null||Y.value<X)X=Y.value}return X}};QU.create=(X)=>{return new QU({checks:[],typeName:A0.ZodBigInt,coerce:X?.coerce??!1,...B6(X)})};dv=class dv extends E6{_parse(X){if(this._def.coerce)X.data=Boolean(X.data);if(this._getType(X)!==G1.boolean){let Q=this._getOrReturnCtx(X);return z1(Q,{code:n0.invalid_type,expected:G1.boolean,received:Q.parsedType}),X6}return UY(X.data)}};dv.create=(X)=>{return new dv({typeName:A0.ZodBoolean,coerce:X?.coerce||!1,...B6(X)})};GM=class GM extends E6{_parse(X){if(this._def.coerce)X.data=new Date(X.data);if(this._getType(X)!==G1.date){let G=this._getOrReturnCtx(X);return z1(G,{code:n0.invalid_type,expected:G1.date,received:G.parsedType}),X6}if(Number.isNaN(X.data.getTime())){let G=this._getOrReturnCtx(X);return z1(G,{code:n0.invalid_date}),X6}let Q=new fX,J=void 0;for(let G of this._def.checks)if(G.kind==="min"){if(X.data.getTime()<G.value)J=this._getOrReturnCtx(X,J),z1(J,{code:n0.too_small,message:G.message,inclusive:!0,exact:!1,minimum:G.value,type:"date"}),Q.dirty()}else if(G.kind==="max"){if(X.data.getTime()>G.value)J=this._getOrReturnCtx(X,J),z1(J,{code:n0.too_big,message:G.message,inclusive:!0,exact:!1,maximum:G.value,type:"date"}),Q.dirty()}else _6.assertNever(G);return{status:Q.value,value:new Date(X.data.getTime())}}_addCheck(X){return new GM({...this._def,checks:[...this._def.checks,X]})}min(X,Y){return this._addCheck({kind:"min",value:X.getTime(),message:j1.toString(Y)})}max(X,Y){return this._addCheck({kind:"max",value:X.getTime(),message:j1.toString(Y)})}get minDate(){let X=null;for(let Y of this._def.checks)if(Y.kind==="min"){if(X===null||Y.value>X)X=Y.value}return X!=null?new Date(X):null}get maxDate(){let X=null;for(let Y of this._def.checks)if(Y.kind==="max"){if(X===null||Y.value<X)X=Y.value}return X!=null?new Date(X):null}};GM.create=(X)=>{return new GM({checks:[],coerce:X?.coerce||!1,typeName:A0.ZodDate,...B6(X)})};pv=class pv extends E6{_parse(X){if(this._getType(X)!==G1.symbol){let Q=this._getOrReturnCtx(X);return z1(Q,{code:n0.invalid_type,expected:G1.symbol,received:Q.parsedType}),X6}return UY(X.data)}};pv.create=(X)=>{return new pv({typeName:A0.ZodSymbol,...B6(X)})};WM=class WM extends E6{_parse(X){if(this._getType(X)!==G1.undefined){let Q=this._getOrReturnCtx(X);return z1(Q,{code:n0.invalid_type,expected:G1.undefined,received:Q.parsedType}),X6}return UY(X.data)}};WM.create=(X)=>{return new WM({typeName:A0.ZodUndefined,...B6(X)})};ZM=class ZM extends E6{_parse(X){if(this._getType(X)!==G1.null){let Q=this._getOrReturnCtx(X);return z1(Q,{code:n0.invalid_type,expected:G1.null,received:Q.parsedType}),X6}return UY(X.data)}};ZM.create=(X)=>{return new ZM({typeName:A0.ZodNull,...B6(X)})};cv=class cv extends E6{constructor(){super(...arguments);this._any=!0}_parse(X){return UY(X.data)}};cv.create=(X)=>{return new cv({typeName:A0.ZodAny,...B6(X)})};d3=class d3 extends E6{constructor(){super(...arguments);this._unknown=!0}_parse(X){return UY(X.data)}};d3.create=(X)=>{return new d3({typeName:A0.ZodUnknown,...B6(X)})};EW=class EW extends E6{_parse(X){let Y=this._getOrReturnCtx(X);return z1(Y,{code:n0.invalid_type,expected:G1.never,received:Y.parsedType}),X6}};EW.create=(X)=>{return new EW({typeName:A0.ZodNever,...B6(X)})};nv=class nv extends E6{_parse(X){if(this._getType(X)!==G1.undefined){let Q=this._getOrReturnCtx(X);return z1(Q,{code:n0.invalid_type,expected:G1.void,received:Q.parsedType}),X6}return UY(X.data)}};nv.create=(X)=>{return new nv({typeName:A0.ZodVoid,...B6(X)})};rG=class rG extends E6{_parse(X){let{ctx:Y,status:Q}=this._processInputParams(X),J=this._def;if(Y.parsedType!==G1.array)return z1(Y,{code:n0.invalid_type,expected:G1.array,received:Y.parsedType}),X6;if(J.exactLength!==null){let W=Y.data.length>J.exactLength.value,Z=Y.data.length<J.exactLength.value;if(W||Z)z1(Y,{code:W?n0.too_big:n0.too_small,minimum:Z?J.exactLength.value:void 0,maximum:W?J.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:J.exactLength.message}),Q.dirty()}if(J.minLength!==null){if(Y.data.length<J.minLength.value)z1(Y,{code:n0.too_small,minimum:J.minLength.value,type:"array",inclusive:!0,exact:!1,message:J.minLength.message}),Q.dirty()}if(J.maxLength!==null){if(Y.data.length>J.maxLength.value)z1(Y,{code:n0.too_big,maximum:J.maxLength.value,type:"array",inclusive:!0,exact:!1,message:J.maxLength.message}),Q.dirty()}if(Y.common.async)return Promise.all([...Y.data].map((W,Z)=>{return J.type._parseAsync(new M5(Y,W,Y.path,Z))})).then((W)=>{return fX.mergeArray(Q,W)});let G=[...Y.data].map((W,Z)=>{return J.type._parseSync(new M5(Y,W,Y.path,Z))});return fX.mergeArray(Q,G)}get element(){return this._def.type}min(X,Y){return new rG({...this._def,minLength:{value:X,message:j1.toString(Y)}})}max(X,Y){return new rG({...this._def,maxLength:{value:X,message:j1.toString(Y)}})}length(X,Y){return new rG({...this._def,exactLength:{value:X,message:j1.toString(Y)}})}nonempty(X){return this.min(1,X)}};rG.create=(X,Y)=>{return new rG({type:X,minLength:null,maxLength:null,exactLength:null,typeName:A0.ZodArray,...B6(Y)})};k8=class k8 extends E6{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let X=this._def.shape(),Y=_6.objectKeys(X);return this._cached={shape:X,keys:Y},this._cached}_parse(X){if(this._getType(X)!==G1.object){let K=this._getOrReturnCtx(X);return z1(K,{code:n0.invalid_type,expected:G1.object,received:K.parsedType}),X6}let{status:Q,ctx:J}=this._processInputParams(X),{shape:G,keys:W}=this._getCached(),Z=[];if(!(this._def.catchall instanceof EW&&this._def.unknownKeys==="strip")){for(let K in J.data)if(!W.includes(K))Z.push(K)}let $=[];for(let K of W){let H=G[K],F=J.data[K];$.push({key:{status:"valid",value:K},value:H._parse(new M5(J,F,J.path,K)),alwaysSet:K in J.data})}if(this._def.catchall instanceof EW){let K=this._def.unknownKeys;if(K==="passthrough")for(let H of Z)$.push({key:{status:"valid",value:H},value:{status:"valid",value:J.data[H]}});else if(K==="strict"){if(Z.length>0)z1(J,{code:n0.unrecognized_keys,keys:Z}),Q.dirty()}else if(K==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let K=this._def.catchall;for(let H of Z){let F=J.data[H];$.push({key:{status:"valid",value:H},value:K._parse(new M5(J,F,J.path,H)),alwaysSet:H in J.data})}}if(J.common.async)return Promise.resolve().then(async()=>{let K=[];for(let H of $){let F=await H.key,V=await H.value;K.push({key:F,value:V,alwaysSet:H.alwaysSet})}return K}).then((K)=>{return fX.mergeObjectSync(Q,K)});else return fX.mergeObjectSync(Q,$)}get shape(){return this._def.shape()}strict(X){return j1.errToObj,new k8({...this._def,unknownKeys:"strict",...X!==void 0?{errorMap:(Y,Q)=>{let J=this._def.errorMap?.(Y,Q).message??Q.defaultError;if(Y.code==="unrecognized_keys")return{message:j1.errToObj(X).message??J};return{message:J}}}:{}})}strip(){return new k8({...this._def,unknownKeys:"strip"})}passthrough(){return new k8({...this._def,unknownKeys:"passthrough"})}extend(X){return new k8({...this._def,shape:()=>({...this._def.shape(),...X})})}merge(X){return new k8({unknownKeys:X._def.unknownKeys,catchall:X._def.catchall,shape:()=>({...this._def.shape(),...X._def.shape()}),typeName:A0.ZodObject})}setKey(X,Y){return this.augment({[X]:Y})}catchall(X){return new k8({...this._def,catchall:X})}pick(X){let Y={};for(let Q of _6.objectKeys(X))if(X[Q]&&this.shape[Q])Y[Q]=this.shape[Q];return new k8({...this._def,shape:()=>Y})}omit(X){let Y={};for(let Q of _6.objectKeys(this.shape))if(!X[Q])Y[Q]=this.shape[Q];return new k8({...this._def,shape:()=>Y})}deepPartial(){return XU(this)}partial(X){let Y={};for(let Q of _6.objectKeys(this.shape)){let J=this.shape[Q];if(X&&!X[Q])Y[Q]=J;else Y[Q]=J.optional()}return new k8({...this._def,shape:()=>Y})}required(X){let Y={};for(let Q of _6.objectKeys(this.shape))if(X&&!X[Q])Y[Q]=this.shape[Q];else{let G=this.shape[Q];while(G instanceof oG)G=G._def.innerType;Y[Q]=G}return new k8({...this._def,shape:()=>Y})}keyof(){return we0(_6.objectKeys(this.shape))}};k8.create=(X,Y)=>{return new k8({shape:()=>X,unknownKeys:"strip",catchall:EW.create(),typeName:A0.ZodObject,...B6(Y)})};k8.strictCreate=(X,Y)=>{return new k8({shape:()=>X,unknownKeys:"strict",catchall:EW.create(),typeName:A0.ZodObject,...B6(Y)})};k8.lazycreate=(X,Y)=>{return new k8({shape:X,unknownKeys:"strip",catchall:EW.create(),typeName:A0.ZodObject,...B6(Y)})};$M=class $M extends E6{_parse(X){let{ctx:Y}=this._processInputParams(X),Q=this._def.options;function J(G){for(let Z of G)if(Z.result.status==="valid")return Z.result;for(let Z of G)if(Z.result.status==="dirty")return Y.common.issues.push(...Z.ctx.common.issues),Z.result;let W=G.map((Z)=>new yQ(Z.ctx.common.issues));return z1(Y,{code:n0.invalid_union,unionErrors:W}),X6}if(Y.common.async)return Promise.all(Q.map(async(G)=>{let W={...Y,common:{...Y.common,issues:[]},parent:null};return{result:await G._parseAsync({data:Y.data,path:Y.path,parent:W}),ctx:W}})).then(J);else{let G=void 0,W=[];for(let $ of Q){let K={...Y,common:{...Y.common,issues:[]},parent:null},H=$._parseSync({data:Y.data,path:Y.path,parent:K});if(H.status==="valid")return H;else if(H.status==="dirty"&&!G)G={result:H,ctx:K};if(K.common.issues.length)W.push(K.common.issues)}if(G)return Y.common.issues.push(...G.ctx.common.issues),G.result;let Z=W.map(($)=>new yQ($));return z1(Y,{code:n0.invalid_union,unionErrors:Z}),X6}}get options(){return this._def.options}};$M.create=(X,Y)=>{return new $M({options:X,typeName:A0.ZodUnion,...B6(Y)})};B00=class B00 extends E6{_parse(X){let{ctx:Y}=this._processInputParams(X);if(Y.parsedType!==G1.object)return z1(Y,{code:n0.invalid_type,expected:G1.object,received:Y.parsedType}),X6;let Q=this.discriminator,J=Y.data[Q],G=this.optionsMap.get(J);if(!G)return z1(Y,{code:n0.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[Q]}),X6;if(Y.common.async)return G._parseAsync({data:Y.data,path:Y.path,parent:Y});else return G._parseSync({data:Y.data,path:Y.path,parent:Y})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(X,Y,Q){let J=new Map;for(let G of Y){let W=TW(G.shape[X]);if(!W.length)throw Error(`A discriminator value for key \`${X}\` could not be extracted from all schema options`);for(let Z of W){if(J.has(Z))throw Error(`Discriminator property ${String(X)} has duplicate value ${String(Z)}`);J.set(Z,G)}}return new B00({typeName:A0.ZodDiscriminatedUnion,discriminator:X,options:Y,optionsMap:J,...B6(Q)})}};KM=class KM extends E6{_parse(X){let{status:Y,ctx:Q}=this._processInputParams(X),J=(G,W)=>{if(F00(G)||F00(W))return X6;let Z=U00(G.value,W.value);if(!Z.valid)return z1(Q,{code:n0.invalid_intersection_types}),X6;if(V00(G)||V00(W))Y.dirty();return{status:Y.value,value:Z.data}};if(Q.common.async)return Promise.all([this._def.left._parseAsync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseAsync({data:Q.data,path:Q.path,parent:Q})]).then(([G,W])=>J(G,W));else return J(this._def.left._parseSync({data:Q.data,path:Q.path,parent:Q}),this._def.right._parseSync({data:Q.data,path:Q.path,parent:Q}))}};KM.create=(X,Y,Q)=>{return new KM({left:X,right:Y,typeName:A0.ZodIntersection,...B6(Q)})};jW=class jW extends E6{_parse(X){let{status:Y,ctx:Q}=this._processInputParams(X);if(Q.parsedType!==G1.array)return z1(Q,{code:n0.invalid_type,expected:G1.array,received:Q.parsedType}),X6;if(Q.data.length<this._def.items.length)return z1(Q,{code:n0.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),X6;if(!this._def.rest&&Q.data.length>this._def.items.length)z1(Q,{code:n0.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Y.dirty();let G=[...Q.data].map((W,Z)=>{let $=this._def.items[Z]||this._def.rest;if(!$)return null;return $._parse(new M5(Q,W,Q.path,Z))}).filter((W)=>!!W);if(Q.common.async)return Promise.all(G).then((W)=>{return fX.mergeArray(Y,W)});else return fX.mergeArray(Y,G)}get items(){return this._def.items}rest(X){return new jW({...this._def,rest:X})}};jW.create=(X,Y)=>{if(!Array.isArray(X))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new jW({items:X,typeName:A0.ZodTuple,rest:null,...B6(Y)})};iv=class iv extends E6{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(X){let{status:Y,ctx:Q}=this._processInputParams(X);if(Q.parsedType!==G1.object)return z1(Q,{code:n0.invalid_type,expected:G1.object,received:Q.parsedType}),X6;let J=[],G=this._def.keyType,W=this._def.valueType;for(let Z in Q.data)J.push({key:G._parse(new M5(Q,Z,Q.path,Z)),value:W._parse(new M5(Q,Q.data[Z],Q.path,Z)),alwaysSet:Z in Q.data});if(Q.common.async)return fX.mergeObjectAsync(Y,J);else return fX.mergeObjectSync(Y,J)}get element(){return this._def.valueType}static create(X,Y,Q){if(Y instanceof E6)return new iv({keyType:X,valueType:Y,typeName:A0.ZodRecord,...B6(Q)});return new iv({keyType:AW.create(),valueType:X,typeName:A0.ZodRecord,...B6(Y)})}};av=class av extends E6{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(X){let{status:Y,ctx:Q}=this._processInputParams(X);if(Q.parsedType!==G1.map)return z1(Q,{code:n0.invalid_type,expected:G1.map,received:Q.parsedType}),X6;let J=this._def.keyType,G=this._def.valueType,W=[...Q.data.entries()].map(([Z,$],K)=>{return{key:J._parse(new M5(Q,Z,Q.path,[K,"key"])),value:G._parse(new M5(Q,$,Q.path,[K,"value"]))}});if(Q.common.async){let Z=new Map;return Promise.resolve().then(async()=>{for(let $ of W){let K=await $.key,H=await $.value;if(K.status==="aborted"||H.status==="aborted")return X6;if(K.status==="dirty"||H.status==="dirty")Y.dirty();Z.set(K.value,H.value)}return{status:Y.value,value:Z}})}else{let Z=new Map;for(let $ of W){let{key:K,value:H}=$;if(K.status==="aborted"||H.status==="aborted")return X6;if(K.status==="dirty"||H.status==="dirty")Y.dirty();Z.set(K.value,H.value)}return{status:Y.value,value:Z}}}};av.create=(X,Y,Q)=>{return new av({valueType:Y,keyType:X,typeName:A0.ZodMap,...B6(Q)})};JU=class JU extends E6{_parse(X){let{status:Y,ctx:Q}=this._processInputParams(X);if(Q.parsedType!==G1.set)return z1(Q,{code:n0.invalid_type,expected:G1.set,received:Q.parsedType}),X6;let J=this._def;if(J.minSize!==null){if(Q.data.size<J.minSize.value)z1(Q,{code:n0.too_small,minimum:J.minSize.value,type:"set",inclusive:!0,exact:!1,message:J.minSize.message}),Y.dirty()}if(J.maxSize!==null){if(Q.data.size>J.maxSize.value)z1(Q,{code:n0.too_big,maximum:J.maxSize.value,type:"set",inclusive:!0,exact:!1,message:J.maxSize.message}),Y.dirty()}let G=this._def.valueType;function W($){let K=new Set;for(let H of $){if(H.status==="aborted")return X6;if(H.status==="dirty")Y.dirty();K.add(H.value)}return{status:Y.value,value:K}}let Z=[...Q.data.values()].map(($,K)=>G._parse(new M5(Q,$,Q.path,K)));if(Q.common.async)return Promise.all(Z).then(($)=>W($));else return W(Z)}min(X,Y){return new JU({...this._def,minSize:{value:X,message:j1.toString(Y)}})}max(X,Y){return new JU({...this._def,maxSize:{value:X,message:j1.toString(Y)}})}size(X,Y){return this.min(X,Y).max(X,Y)}nonempty(X){return this.min(1,X)}};JU.create=(X,Y)=>{return new JU({valueType:X,minSize:null,maxSize:null,typeName:A0.ZodSet,...B6(Y)})};JM=class JM extends E6{constructor(){super(...arguments);this.validate=this.implement}_parse(X){let{ctx:Y}=this._processInputParams(X);if(Y.parsedType!==G1.function)return z1(Y,{code:n0.invalid_type,expected:G1.function,received:Y.parsedType}),X6;function Q(Z,$){return lv({data:Z,path:Y.path,errorMaps:[Y.common.contextualErrorMap,Y.schemaErrorMap,YM(),S$].filter((K)=>!!K),issueData:{code:n0.invalid_arguments,argumentsError:$}})}function J(Z,$){return lv({data:Z,path:Y.path,errorMaps:[Y.common.contextualErrorMap,Y.schemaErrorMap,YM(),S$].filter((K)=>!!K),issueData:{code:n0.invalid_return_type,returnTypeError:$}})}let G={errorMap:Y.common.contextualErrorMap},W=Y.data;if(this._def.returns instanceof GU){let Z=this;return UY(async function(...$){let K=new yQ([]),H=await Z._def.args.parseAsync($,G).catch((q)=>{throw K.addIssue(Q($,q)),K}),F=await Reflect.apply(W,this,H);return await Z._def.returns._def.type.parseAsync(F,G).catch((q)=>{throw K.addIssue(J(F,q)),K})})}else{let Z=this;return UY(function(...$){let K=Z._def.args.safeParse($,G);if(!K.success)throw new yQ([Q($,K.error)]);let H=Reflect.apply(W,this,K.data),F=Z._def.returns.safeParse(H,G);if(!F.success)throw new yQ([J(H,F.error)]);return F.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...X){return new JM({...this._def,args:jW.create(X).rest(d3.create())})}returns(X){return new JM({...this._def,returns:X})}implement(X){return this.parse(X)}strictImplement(X){return this.parse(X)}static create(X,Y,Q){return new JM({args:X?X:jW.create([]).rest(d3.create()),returns:Y||d3.create(),typeName:A0.ZodFunction,...B6(Q)})}};HM=class HM extends E6{get schema(){return this._def.getter()}_parse(X){let{ctx:Y}=this._processInputParams(X);return this._def.getter()._parse({data:Y.data,path:Y.path,parent:Y})}};HM.create=(X,Y)=>{return new HM({getter:X,typeName:A0.ZodLazy,...B6(Y)})};FM=class FM extends E6{_parse(X){if(X.data!==this._def.value){let Y=this._getOrReturnCtx(X);return z1(Y,{received:Y.data,code:n0.invalid_literal,expected:this._def.value}),X6}return{status:"valid",value:X.data}}get value(){return this._def.value}};FM.create=(X,Y)=>{return new FM({value:X,typeName:A0.ZodLiteral,...B6(Y)})};p3=class p3 extends E6{_parse(X){if(typeof X.data!=="string"){let Y=this._getOrReturnCtx(X),Q=this._def.values;return z1(Y,{expected:_6.joinValues(Q),received:Y.parsedType,code:n0.invalid_type}),X6}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(X.data)){let Y=this._getOrReturnCtx(X),Q=this._def.values;return z1(Y,{received:Y.data,code:n0.invalid_enum_value,options:Q}),X6}return UY(X.data)}get options(){return this._def.values}get enum(){let X={};for(let Y of this._def.values)X[Y]=Y;return X}get Values(){let X={};for(let Y of this._def.values)X[Y]=Y;return X}get Enum(){let X={};for(let Y of this._def.values)X[Y]=Y;return X}extract(X,Y=this._def){return p3.create(X,{...this._def,...Y})}exclude(X,Y=this._def){return p3.create(this.options.filter((Q)=>!X.includes(Q)),{...this._def,...Y})}};p3.create=we0;VM=class VM extends E6{_parse(X){let Y=_6.getValidEnumValues(this._def.values),Q=this._getOrReturnCtx(X);if(Q.parsedType!==G1.string&&Q.parsedType!==G1.number){let J=_6.objectValues(Y);return z1(Q,{expected:_6.joinValues(J),received:Q.parsedType,code:n0.invalid_type}),X6}if(!this._cache)this._cache=new Set(_6.getValidEnumValues(this._def.values));if(!this._cache.has(X.data)){let J=_6.objectValues(Y);return z1(Q,{received:Q.data,code:n0.invalid_enum_value,options:J}),X6}return UY(X.data)}get enum(){return this._def.values}};VM.create=(X,Y)=>{return new VM({values:X,typeName:A0.ZodNativeEnum,...B6(Y)})};GU=class GU extends E6{unwrap(){return this._def.type}_parse(X){let{ctx:Y}=this._processInputParams(X);if(Y.parsedType!==G1.promise&&Y.common.async===!1)return z1(Y,{code:n0.invalid_type,expected:G1.promise,received:Y.parsedType}),X6;let Q=Y.parsedType===G1.promise?Y.data:Promise.resolve(Y.data);return UY(Q.then((J)=>{return this._def.type.parseAsync(J,{path:Y.path,errorMap:Y.common.contextualErrorMap})}))}};GU.create=(X,Y)=>{return new GU({type:X,typeName:A0.ZodPromise,...B6(Y)})};sG=class sG extends E6{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===A0.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(X){let{status:Y,ctx:Q}=this._processInputParams(X),J=this._def.effect||null,G={addIssue:(W)=>{if(z1(Q,W),W.fatal)Y.abort();else Y.dirty()},get path(){return Q.path}};if(G.addIssue=G.addIssue.bind(G),J.type==="preprocess"){let W=J.transform(Q.data,G);if(Q.common.async)return Promise.resolve(W).then(async(Z)=>{if(Y.value==="aborted")return X6;let $=await this._def.schema._parseAsync({data:Z,path:Q.path,parent:Q});if($.status==="aborted")return X6;if($.status==="dirty")return ez($.value);if(Y.value==="dirty")return ez($.value);return $});else{if(Y.value==="aborted")return X6;let Z=this._def.schema._parseSync({data:W,path:Q.path,parent:Q});if(Z.status==="aborted")return X6;if(Z.status==="dirty")return ez(Z.value);if(Y.value==="dirty")return ez(Z.value);return Z}}if(J.type==="refinement"){let W=(Z)=>{let $=J.refinement(Z,G);if(Q.common.async)return Promise.resolve($);if($ instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Z};if(Q.common.async===!1){let Z=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(Z.status==="aborted")return X6;if(Z.status==="dirty")Y.dirty();return W(Z.value),{status:Y.value,value:Z.value}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((Z)=>{if(Z.status==="aborted")return X6;if(Z.status==="dirty")Y.dirty();return W(Z.value).then(()=>{return{status:Y.value,value:Z.value}})})}if(J.type==="transform")if(Q.common.async===!1){let W=this._def.schema._parseSync({data:Q.data,path:Q.path,parent:Q});if(!l3(W))return X6;let Z=J.transform(W.value,G);if(Z instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:Y.value,value:Z}}else return this._def.schema._parseAsync({data:Q.data,path:Q.path,parent:Q}).then((W)=>{if(!l3(W))return X6;return Promise.resolve(J.transform(W.value,G)).then((Z)=>({status:Y.value,value:Z}))});_6.assertNever(J)}};sG.create=(X,Y,Q)=>{return new sG({schema:X,typeName:A0.ZodEffects,effect:Y,...B6(Q)})};sG.createWithPreprocess=(X,Y,Q)=>{return new sG({schema:Y,effect:{type:"preprocess",transform:X},typeName:A0.ZodEffects,...B6(Q)})};oG=class oG extends E6{_parse(X){if(this._getType(X)===G1.undefined)return UY(void 0);return this._def.innerType._parse(X)}unwrap(){return this._def.innerType}};oG.create=(X,Y)=>{return new oG({innerType:X,typeName:A0.ZodOptional,...B6(Y)})};k$=class k$ extends E6{_parse(X){if(this._getType(X)===G1.null)return UY(null);return this._def.innerType._parse(X)}unwrap(){return this._def.innerType}};k$.create=(X,Y)=>{return new k$({innerType:X,typeName:A0.ZodNullable,...B6(Y)})};qM=class qM extends E6{_parse(X){let{ctx:Y}=this._processInputParams(X),Q=Y.data;if(Y.parsedType===G1.undefined)Q=this._def.defaultValue();return this._def.innerType._parse({data:Q,path:Y.path,parent:Y})}removeDefault(){return this._def.innerType}};qM.create=(X,Y)=>{return new qM({innerType:X,typeName:A0.ZodDefault,defaultValue:typeof Y.default==="function"?Y.default:()=>Y.default,...B6(Y)})};zM=class zM extends E6{_parse(X){let{ctx:Y}=this._processInputParams(X),Q={...Y,common:{...Y.common,issues:[]}},J=this._def.innerType._parse({data:Q.data,path:Q.path,parent:{...Q}});if(QM(J))return J.then((G)=>{return{status:"valid",value:G.status==="valid"?G.value:this._def.catchValue({get error(){return new yQ(Q.common.issues)},input:Q.data})}});else return{status:"valid",value:J.status==="valid"?J.value:this._def.catchValue({get error(){return new yQ(Q.common.issues)},input:Q.data})}}removeCatch(){return this._def.innerType}};zM.create=(X,Y)=>{return new zM({innerType:X,typeName:A0.ZodCatch,catchValue:typeof Y.catch==="function"?Y.catch:()=>Y.catch,...B6(Y)})};rv=class rv extends E6{_parse(X){if(this._getType(X)!==G1.nan){let Q=this._getOrReturnCtx(X);return z1(Q,{code:n0.invalid_type,expected:G1.nan,received:Q.parsedType}),X6}return{status:"valid",value:X.data}}};rv.create=(X)=>{return new rv({typeName:A0.ZodNaN,...B6(X)})};dj4=Symbol("zod_brand");D00=class D00 extends E6{_parse(X){let{ctx:Y}=this._processInputParams(X),Q=Y.data;return this._def.type._parse({data:Q,path:Y.path,parent:Y})}unwrap(){return this._def.type}};ov=class ov extends E6{_parse(X){let{status:Y,ctx:Q}=this._processInputParams(X);if(Q.common.async)return(async()=>{let G=await this._def.in._parseAsync({data:Q.data,path:Q.path,parent:Q});if(G.status==="aborted")return X6;if(G.status==="dirty")return Y.dirty(),ez(G.value);else return this._def.out._parseAsync({data:G.value,path:Q.path,parent:Q})})();else{let J=this._def.in._parseSync({data:Q.data,path:Q.path,parent:Q});if(J.status==="aborted")return X6;if(J.status==="dirty")return Y.dirty(),{status:"dirty",value:J.value};else return this._def.out._parseSync({data:J.value,path:Q.path,parent:Q})}}static create(X,Y){return new ov({in:X,out:Y,typeName:A0.ZodPipeline})}};UM=class UM extends E6{_parse(X){let Y=this._def.innerType._parse(X),Q=(J)=>{if(l3(J))J.value=Object.freeze(J.value);return J};return QM(Y)?Y.then((J)=>Q(J)):Q(Y)}unwrap(){return this._def.innerType}};UM.create=(X,Y)=>{return new UM({innerType:X,typeName:A0.ZodReadonly,...B6(Y)})};pj4={object:k8.lazycreate};(function(X){X.ZodString="ZodString",X.ZodNumber="ZodNumber",X.ZodNaN="ZodNaN",X.ZodBigInt="ZodBigInt",X.ZodBoolean="ZodBoolean",X.ZodDate="ZodDate",X.ZodSymbol="ZodSymbol",X.ZodUndefined="ZodUndefined",X.ZodNull="ZodNull",X.ZodAny="ZodAny",X.ZodUnknown="ZodUnknown",X.ZodNever="ZodNever",X.ZodVoid="ZodVoid",X.ZodArray="ZodArray",X.ZodObject="ZodObject",X.ZodUnion="ZodUnion",X.ZodDiscriminatedUnion="ZodDiscriminatedUnion",X.ZodIntersection="ZodIntersection",X.ZodTuple="ZodTuple",X.ZodRecord="ZodRecord",X.ZodMap="ZodMap",X.ZodSet="ZodSet",X.ZodFunction="ZodFunction",X.ZodLazy="ZodLazy",X.ZodLiteral="ZodLiteral",X.ZodEnum="ZodEnum",X.ZodEffects="ZodEffects",X.ZodNativeEnum="ZodNativeEnum",X.ZodOptional="ZodOptional",X.ZodNullable="ZodNullable",X.ZodDefault="ZodDefault",X.ZodCatch="ZodCatch",X.ZodPromise="ZodPromise",X.ZodBranded="ZodBranded",X.ZodPipeline="ZodPipeline",X.ZodReadonly="ZodReadonly"})(A0||(A0={}));cj4=AW.create,nj4=YU.create,ij4=rv.create,aj4=QU.create,rj4=dv.create,oj4=GM.create,sj4=pv.create,tj4=WM.create,ej4=ZM.create,X24=cv.create,Y24=d3.create,Q24=EW.create,J24=nv.create,G24=rG.create,Me0=k8.create,W24=k8.strictCreate,Z24=$M.create,$24=B00.create,K24=KM.create,H24=jW.create,F24=iv.create,V24=av.create,q24=JU.create,z24=JM.create,U24=HM.create,B24=FM.create,D24=p3.create,N24=VM.create,O24=GU.create,L24=sG.create,w24=oG.create,M24=k$.create,P24=sG.createWithPreprocess,T24=ov.create});var Te0=i(()=>{mv();q00();Be0();XM();Pe0();uv()});var v$=i(()=>{Te0()});var N00=i(()=>{SX()});function O00(X,Y){let Q={type:"object",shape:X??{},...a0(Y)};return new PL6(Q)}var ML6,PL6;var Ae0=i(()=>{SX();R1();N00();ML6=F0("ZodMiniType",(X,Y)=>{if(!X._zod)throw Error("Uninitialized schema in ZodMiniType.");J6.init(X,Y),X.def=Y,X.type=Y.type,X.parse=(Q,J)=>aH(X,Q,J,{callee:X.parse}),X.safeParse=(Q,J)=>$$(X,Q,J),X.parseAsync=async(Q,J)=>rH(X,Q,J,{callee:X.parseAsync}),X.safeParseAsync=async(Q,J)=>K$(X,Q,J),X.check=(...Q)=>{return X.clone({...Y,checks:[...Y.checks??[],...Q.map((J)=>typeof J==="function"?{_zod:{check:J,def:{check:"custom"},onattach:[]}}:J)]},{parent:!0})},X.with=X.check,X.clone=(Q,J)=>f9(X,Q,J),X.brand=()=>X,X.register=(Q,J)=>{return Q.add(X,J),X},X.apply=(Q)=>Q(X)}),PL6=F0("ZodMiniObject",(X,Y)=>{$R.init(X,Y),ML6.init(X,Y),U6(X,"shape",()=>Y.shape)})});var Ee0=()=>{};var je0=()=>{};var Ce0=()=>{};var Ie0=i(()=>{SX();Nz();_R();je0();Ce0();N00();Ae0();Ee0()});var Re0=i(()=>{Ie0()});var L00=i(()=>{Re0()});function oY(X){return!!X._zod}function c3(X){let Y=Object.values(X);if(Y.length===0)return O00({});let Q=Y.every(oY),J=Y.every((G)=>!oY(G));if(Q)return O00(X);if(J)return Me0(X);throw Error("Mixed Zod versions detected in object shape.")}function BY(X,Y){if(oY(X))return $$(X,Y);return X.safeParse(Y)}async function sv(X,Y){if(oY(X))return await K$(X,Y);return await X.safeParseAsync(Y)}function tG(X){if(!X)return;let Y;if(oY(X))Y=X._zod?.def?.shape;else Y=X.shape;if(!Y)return;if(typeof Y==="function")try{return Y()}catch{return}return Y}function WU(X){if(!X)return;if(typeof X==="object"){let Y=X,Q=X;if(!Y._def&&!Q._zod){let J=Object.values(X);if(J.length>0&&J.every((G)=>typeof G==="object"&&G!==null&&(G._def!==void 0||G._zod!==void 0||typeof G.parse==="function")))return c3(X)}}if(oY(X)){let Q=X._zod?.def;if(Q&&(Q.type==="object"||Q.shape!==void 0))return X}else if(X.shape!==void 0)return X;return}function tv(X){if(X&&typeof X==="object"){if("message"in X&&typeof X.message==="string")return X.message;if("issues"in X&&Array.isArray(X.issues)&&X.issues.length>0){let Y=X.issues[0];if(Y&&typeof Y==="object"&&"message"in Y)return String(Y.message)}try{return JSON.stringify(X)}catch{return String(X)}}return String(X)}function ke0(X){return X.description}function ve0(X){if(oY(X))return X._zod?.def?.type==="optional";let Y=X;if(typeof X.isOptional==="function")return X.isOptional();return Y._def?.typeName==="ZodOptional"}function ev(X){if(oY(X)){let W=X._zod?.def;if(W){if(W.value!==void 0)return W.value;if(Array.isArray(W.values)&&W.values.length>0)return W.values[0]}}let Q=X._def;if(Q){if(Q.value!==void 0)return Q.value;if(Array.isArray(Q.values)&&Q.values.length>0)return Q.values[0]}let J=X.value;if(J!==void 0)return J;return}var ZU=i(()=>{v$();L00()});function re0(X){if(X.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${X.params.ref.type}`)}function oe0(X){if(X.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${X.params.ref.type}`)}var _$="2025-11-25",_e0="2025-03-26",n3,y$="io.modelcontextprotocol/related-task",Y_="2.0",VX,ye0,be0,c24,EL6,jL6,w00,bQ,BM,fe0=(X)=>BM.safeParse(X).success,qX,_J,yJ,zX,Q_,he0,eG=(X)=>he0.safeParse(X).success,xe0,ge0=(X)=>xe0.safeParse(X).success,M00,P5=(X)=>M00.safeParse(X).success,K1,P00,KU=(X)=>P00.safeParse(X).success,fQ,n24,CW,CL6,J_,IL6,DM,$U,ue0,RL6,SL6,kL6,vL6,_L6,yL6,G_,T00=(X)=>G_.safeParse(X).success,bL6,A00,W_,me0=(X)=>W_.safeParse(X).success,Z_,fL6,hL6,$_,xL6,NM,OM,gL6,LM,IW,uL6,wM,K_,H_,F_,i24,V_,q_,z_,le0,de0,pe0,E00,ce0,MM,HU,ne0,mL6,b$,j00,f$,C00,I00,lL6,h$,R00,S00,dL6,pL6,cL6,nL6,iL6,aL6,rL6,oL6,x$,k00,sL6,g$,v00,_00,y00,tL6,eL6,Xw6,b00,Yw6,f00,h00,Qw6,Jw6,ie0,u$,PM,X7,a24,Gw6,Y7,x00,ae0,TM,Ww6,g00,Zw6,$w6,Kw6,Hw6,Fw6,Vw6,qw6,X_,zw6,Uw6,u00,AM,m00,Bw6,Dw6,Nw6,Ow6,Lw6,ww6,Mw6,Pw6,Tw6,Aw6,Ew6,jw6,Cw6,Iw6,Rw6,l00,Sw6,kw6,FU,vw6,_w6,yw6,U_,d00,bw6,fw6,p00,hw6,r24,o24,s24,t24,e24,XC4,J1,se0;var D9=i(()=>{a6();n3=[_$,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],VX=q9((X)=>X!==null&&(typeof X==="object"||typeof X==="function")),ye0=r1([M(),g0().int()]),be0=M(),c24=e4({ttl:r1([g0(),L3()]).optional(),pollInterval:g0().optional()}),EL6=m({ttl:g0().optional()}),jL6=m({taskId:M()}),w00=e4({progressToken:ye0.optional(),[y$]:jL6.optional()}),bQ=m({_meta:w00.optional()}),BM=bQ.extend({task:EL6.optional()}),qX=m({method:M(),params:bQ.loose().optional()}),_J=m({_meta:w00.optional()}),yJ=m({method:M(),params:_J.loose().optional()}),zX=e4({_meta:w00.optional()}),Q_=r1([M(),g0().int()]),he0=m({jsonrpc:O1(Y_),id:Q_,...qX.shape}).strict(),xe0=m({jsonrpc:O1(Y_),...yJ.shape}).strict(),M00=m({jsonrpc:O1(Y_),id:Q_,result:zX}).strict();(function(X){X[X.ConnectionClosed=-32000]="ConnectionClosed",X[X.RequestTimeout=-32001]="RequestTimeout",X[X.ParseError=-32700]="ParseError",X[X.InvalidRequest=-32600]="InvalidRequest",X[X.MethodNotFound=-32601]="MethodNotFound",X[X.InvalidParams=-32602]="InvalidParams",X[X.InternalError=-32603]="InternalError",X[X.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(K1||(K1={}));P00=m({jsonrpc:O1(Y_),id:Q_.optional(),error:m({code:g0().int(),message:M(),data:G4().optional()})}).strict(),fQ=r1([he0,xe0,M00,P00]),n24=r1([M00,P00]),CW=zX.strict(),CL6=_J.extend({requestId:Q_.optional(),reason:M().optional()}),J_=yJ.extend({method:O1("notifications/cancelled"),params:CL6}),IL6=m({src:M(),mimeType:M().optional(),sizes:w0(M()).optional(),theme:F1(["light","dark"]).optional()}),DM=m({icons:w0(IL6).optional()}),$U=m({name:M(),title:M().optional()}),ue0=$U.extend({...$U.shape,...DM.shape,version:M(),websiteUrl:M().optional(),description:M().optional()}),RL6=w3(m({applyDefaults:u0().optional()}),p0(M(),G4())),SL6=Rz((X)=>{if(X&&typeof X==="object"&&!Array.isArray(X)){if(Object.keys(X).length===0)return{form:{}}}return X},w3(m({form:RL6.optional(),url:VX.optional()}),p0(M(),G4()).optional())),kL6=e4({list:VX.optional(),cancel:VX.optional(),requests:e4({sampling:e4({createMessage:VX.optional()}).optional(),elicitation:e4({create:VX.optional()}).optional()}).optional()}),vL6=e4({list:VX.optional(),cancel:VX.optional(),requests:e4({tools:e4({call:VX.optional()}).optional()}).optional()}),_L6=m({experimental:p0(M(),VX).optional(),sampling:m({context:VX.optional(),tools:VX.optional()}).optional(),elicitation:SL6.optional(),roots:m({listChanged:u0().optional()}).optional(),tasks:kL6.optional()}),yL6=bQ.extend({protocolVersion:M(),capabilities:_L6,clientInfo:ue0}),G_=qX.extend({method:O1("initialize"),params:yL6}),bL6=m({experimental:p0(M(),VX).optional(),logging:VX.optional(),completions:VX.optional(),prompts:m({listChanged:u0().optional()}).optional(),resources:m({subscribe:u0().optional(),listChanged:u0().optional()}).optional(),tools:m({listChanged:u0().optional()}).optional(),tasks:vL6.optional()}),A00=zX.extend({protocolVersion:M(),capabilities:bL6,serverInfo:ue0,instructions:M().optional()}),W_=yJ.extend({method:O1("notifications/initialized"),params:_J.optional()}),Z_=qX.extend({method:O1("ping"),params:bQ.optional()}),fL6=m({progress:g0(),total:$6(g0()),message:$6(M())}),hL6=m({..._J.shape,...fL6.shape,progressToken:ye0}),$_=yJ.extend({method:O1("notifications/progress"),params:hL6}),xL6=bQ.extend({cursor:be0.optional()}),NM=qX.extend({params:xL6.optional()}),OM=zX.extend({nextCursor:be0.optional()}),gL6=F1(["working","input_required","completed","failed","cancelled"]),LM=m({taskId:M(),status:gL6,ttl:r1([g0(),L3()]),createdAt:M(),lastUpdatedAt:M(),pollInterval:$6(g0()),statusMessage:$6(M())}),IW=zX.extend({task:LM}),uL6=_J.merge(LM),wM=yJ.extend({method:O1("notifications/tasks/status"),params:uL6}),K_=qX.extend({method:O1("tasks/get"),params:bQ.extend({taskId:M()})}),H_=zX.merge(LM),F_=qX.extend({method:O1("tasks/result"),params:bQ.extend({taskId:M()})}),i24=zX.loose(),V_=NM.extend({method:O1("tasks/list")}),q_=OM.extend({tasks:w0(LM)}),z_=qX.extend({method:O1("tasks/cancel"),params:bQ.extend({taskId:M()})}),le0=zX.merge(LM),de0=m({uri:M(),mimeType:$6(M()),_meta:p0(M(),G4()).optional()}),pe0=de0.extend({text:M()}),E00=M().refine((X)=>{try{return atob(X),!0}catch{return!1}},{message:"Invalid Base64 string"}),ce0=de0.extend({blob:E00}),MM=F1(["user","assistant"]),HU=m({audience:w0(MM).optional(),priority:g0().min(0).max(1).optional(),lastModified:$W.datetime({offset:!0}).optional()}),ne0=m({...$U.shape,...DM.shape,uri:M(),description:$6(M()),mimeType:$6(M()),annotations:HU.optional(),_meta:$6(e4({}))}),mL6=m({...$U.shape,...DM.shape,uriTemplate:M(),description:$6(M()),mimeType:$6(M()),annotations:HU.optional(),_meta:$6(e4({}))}),b$=NM.extend({method:O1("resources/list")}),j00=OM.extend({resources:w0(ne0)}),f$=NM.extend({method:O1("resources/templates/list")}),C00=OM.extend({resourceTemplates:w0(mL6)}),I00=bQ.extend({uri:M()}),lL6=I00,h$=qX.extend({method:O1("resources/read"),params:lL6}),R00=zX.extend({contents:w0(r1([pe0,ce0]))}),S00=yJ.extend({method:O1("notifications/resources/list_changed"),params:_J.optional()}),dL6=I00,pL6=qX.extend({method:O1("resources/subscribe"),params:dL6}),cL6=I00,nL6=qX.extend({method:O1("resources/unsubscribe"),params:cL6}),iL6=_J.extend({uri:M()}),aL6=yJ.extend({method:O1("notifications/resources/updated"),params:iL6}),rL6=m({name:M(),description:$6(M()),required:$6(u0())}),oL6=m({...$U.shape,...DM.shape,description:$6(M()),arguments:$6(w0(rL6)),_meta:$6(e4({}))}),x$=NM.extend({method:O1("prompts/list")}),k00=OM.extend({prompts:w0(oL6)}),sL6=bQ.extend({name:M(),arguments:p0(M(),M()).optional()}),g$=qX.extend({method:O1("prompts/get"),params:sL6}),v00=m({type:O1("text"),text:M(),annotations:HU.optional(),_meta:p0(M(),G4()).optional()}),_00=m({type:O1("image"),data:E00,mimeType:M(),annotations:HU.optional(),_meta:p0(M(),G4()).optional()}),y00=m({type:O1("audio"),data:E00,mimeType:M(),annotations:HU.optional(),_meta:p0(M(),G4()).optional()}),tL6=m({type:O1("tool_use"),name:M(),id:M(),input:p0(M(),G4()),_meta:p0(M(),G4()).optional()}),eL6=m({type:O1("resource"),resource:r1([pe0,ce0]),annotations:HU.optional(),_meta:p0(M(),G4()).optional()}),Xw6=ne0.extend({type:O1("resource_link")}),b00=r1([v00,_00,y00,Xw6,eL6]),Yw6=m({role:MM,content:b00}),f00=zX.extend({description:M().optional(),messages:w0(Yw6)}),h00=yJ.extend({method:O1("notifications/prompts/list_changed"),params:_J.optional()}),Qw6=m({title:M().optional(),readOnlyHint:u0().optional(),destructiveHint:u0().optional(),idempotentHint:u0().optional(),openWorldHint:u0().optional()}),Jw6=m({taskSupport:F1(["required","optional","forbidden"]).optional()}),ie0=m({...$U.shape,...DM.shape,description:M().optional(),inputSchema:m({type:O1("object"),properties:p0(M(),VX).optional(),required:w0(M()).optional()}).catchall(G4()),outputSchema:m({type:O1("object"),properties:p0(M(),VX).optional(),required:w0(M()).optional()}).catchall(G4()).optional(),annotations:Qw6.optional(),execution:Jw6.optional(),_meta:p0(M(),G4()).optional()}),u$=NM.extend({method:O1("tools/list")}),PM=OM.extend({tools:w0(ie0)}),X7=zX.extend({content:w0(b00).default([]),structuredContent:p0(M(),G4()).optional(),isError:u0().optional()}),a24=X7.or(zX.extend({toolResult:G4()})),Gw6=BM.extend({name:M(),arguments:p0(M(),G4()).optional()}),Y7=qX.extend({method:O1("tools/call"),params:Gw6}),x00=yJ.extend({method:O1("notifications/tools/list_changed"),params:_J.optional()}),ae0=m({autoRefresh:u0().default(!0),debounceMs:g0().int().nonnegative().default(300)}),TM=F1(["debug","info","notice","warning","error","critical","alert","emergency"]),Ww6=bQ.extend({level:TM}),g00=qX.extend({method:O1("logging/setLevel"),params:Ww6}),Zw6=_J.extend({level:TM,logger:M().optional(),data:G4()}),$w6=yJ.extend({method:O1("notifications/message"),params:Zw6}),Kw6=m({name:M().optional()}),Hw6=m({hints:w0(Kw6).optional(),costPriority:g0().min(0).max(1).optional(),speedPriority:g0().min(0).max(1).optional(),intelligencePriority:g0().min(0).max(1).optional()}),Fw6=m({mode:F1(["auto","required","none"]).optional()}),Vw6=m({type:O1("tool_result"),toolUseId:M().describe("The unique identifier for the corresponding tool call."),content:w0(b00).default([]),structuredContent:m({}).loose().optional(),isError:u0().optional(),_meta:p0(M(),G4()).optional()}),qw6=Ez("type",[v00,_00,y00]),X_=Ez("type",[v00,_00,y00,tL6,Vw6]),zw6=m({role:MM,content:r1([X_,w0(X_)]),_meta:p0(M(),G4()).optional()}),Uw6=BM.extend({messages:w0(zw6),modelPreferences:Hw6.optional(),systemPrompt:M().optional(),includeContext:F1(["none","thisServer","allServers"]).optional(),temperature:g0().optional(),maxTokens:g0().int(),stopSequences:w0(M()).optional(),metadata:VX.optional(),tools:w0(ie0).optional(),toolChoice:Fw6.optional()}),u00=qX.extend({method:O1("sampling/createMessage"),params:Uw6}),AM=zX.extend({model:M(),stopReason:$6(F1(["endTurn","stopSequence","maxTokens"]).or(M())),role:MM,content:qw6}),m00=zX.extend({model:M(),stopReason:$6(F1(["endTurn","stopSequence","maxTokens","toolUse"]).or(M())),role:MM,content:r1([X_,w0(X_)])}),Bw6=m({type:O1("boolean"),title:M().optional(),description:M().optional(),default:u0().optional()}),Dw6=m({type:O1("string"),title:M().optional(),description:M().optional(),minLength:g0().optional(),maxLength:g0().optional(),format:F1(["email","uri","date","date-time"]).optional(),default:M().optional()}),Nw6=m({type:F1(["number","integer"]),title:M().optional(),description:M().optional(),minimum:g0().optional(),maximum:g0().optional(),default:g0().optional()}),Ow6=m({type:O1("string"),title:M().optional(),description:M().optional(),enum:w0(M()),default:M().optional()}),Lw6=m({type:O1("string"),title:M().optional(),description:M().optional(),oneOf:w0(m({const:M(),title:M()})),default:M().optional()}),ww6=m({type:O1("string"),title:M().optional(),description:M().optional(),enum:w0(M()),enumNames:w0(M()).optional(),default:M().optional()}),Mw6=r1([Ow6,Lw6]),Pw6=m({type:O1("array"),title:M().optional(),description:M().optional(),minItems:g0().optional(),maxItems:g0().optional(),items:m({type:O1("string"),enum:w0(M())}),default:w0(M()).optional()}),Tw6=m({type:O1("array"),title:M().optional(),description:M().optional(),minItems:g0().optional(),maxItems:g0().optional(),items:m({anyOf:w0(m({const:M(),title:M()}))}),default:w0(M()).optional()}),Aw6=r1([Pw6,Tw6]),Ew6=r1([ww6,Mw6,Aw6]),jw6=r1([Ew6,Bw6,Dw6,Nw6]),Cw6=BM.extend({mode:O1("form").optional(),message:M(),requestedSchema:m({type:O1("object"),properties:p0(M(),jw6),required:w0(M()).optional()})}),Iw6=BM.extend({mode:O1("url"),message:M(),elicitationId:M(),url:M().url()}),Rw6=r1([Cw6,Iw6]),l00=qX.extend({method:O1("elicitation/create"),params:Rw6}),Sw6=_J.extend({elicitationId:M()}),kw6=yJ.extend({method:O1("notifications/elicitation/complete"),params:Sw6}),FU=zX.extend({action:F1(["accept","decline","cancel"]),content:Rz((X)=>X===null?void 0:X,p0(M(),r1([M(),g0(),u0(),w0(M())])).optional())}),vw6=m({type:O1("ref/resource"),uri:M()}),_w6=m({type:O1("ref/prompt"),name:M()}),yw6=bQ.extend({ref:r1([_w6,vw6]),argument:m({name:M(),value:M()}),context:m({arguments:p0(M(),M()).optional()}).optional()}),U_=qX.extend({method:O1("completion/complete"),params:yw6});d00=zX.extend({completion:e4({values:w0(M()).max(100),total:$6(g0().int()),hasMore:$6(u0())})}),bw6=m({uri:M().startsWith("file://"),name:M().optional(),_meta:p0(M(),G4()).optional()}),fw6=qX.extend({method:O1("roots/list"),params:bQ.optional()}),p00=zX.extend({roots:w0(bw6)}),hw6=yJ.extend({method:O1("notifications/roots/list_changed"),params:_J.optional()}),r24=r1([Z_,G_,U_,g00,g$,x$,b$,f$,h$,pL6,nL6,Y7,u$,K_,F_,V_,z_]),o24=r1([J_,$_,W_,hw6,wM]),s24=r1([CW,AM,m00,FU,p00,H_,q_,IW]),t24=r1([Z_,u00,l00,fw6,K_,F_,V_,z_]),e24=r1([J_,$_,$w6,aL6,S00,x00,h00,wM,kw6]),XC4=r1([CW,A00,d00,f00,k00,j00,C00,R00,X7,PM,H_,q_,IW]);J1=class J1 extends Error{constructor(X,Y,Q){super(`MCP error ${X}: ${Y}`);this.code=X,this.data=Q,this.name="McpError"}static fromError(X,Y,Q){if(X===K1.UrlElicitationRequired&&Q){let J=Q;if(J.elicitations)return new se0(J.elicitations,Y)}return new J1(X,Y,Q)}};se0=class se0 extends J1{constructor(X,Y=`URL elicitation${X.length>1?"s":""} required`){super(K1.UrlElicitationRequired,Y,{elicitations:X})}get elicitations(){return this.data?.elicitations??[]}}});function m$(X){return X==="completed"||X==="failed"||X==="cancelled"}var ee0,te0,X01=(X)=>typeof X==="string"?{...te0,name:X}:{...te0,...X};var B_=i(()=>{ee0=Symbol("Let zodToJsonSchema decide on which parser to use"),te0={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"}});var Y01=(X)=>{let Y=X01(X),Q=Y.name!==void 0?[...Y.basePath,Y.definitionPath,Y.name]:Y.basePath;return{...Y,flags:{hasReferencedOpenAiAnyType:!1},currentPath:Q,propertyPath:void 0,seen:new Map(Object.entries(Y.definitions).map(([J,G])=>[G._def,{def:G._def,path:[...Y.basePath,Y.definitionPath,J],jsonSchema:void 0}]))}};var c00=i(()=>{B_()});function n00(X,Y,Q,J){if(!J?.errorMessages)return;if(Q)X.errorMessage={...X.errorMessage,[Y]:Q}}function x6(X,Y,Q,J,G){X[Y]=Q,n00(X,Y,J,G)}var D_=(X,Y)=>{let Q=0;for(;Q<X.length&&Q<Y.length;Q++)if(X[Q]!==Y[Q])break;return[(X.length-Q).toString(),...Y.slice(Q)].join("/")};function O8(X){if(X.target!=="openAi")return{};let Y=[...X.basePath,X.definitionPath,X.openAiAnyTypeName];return X.flags.hasReferencedOpenAiAnyType=!0,{$ref:X.$refStrategy==="relative"?D_(Y,X.currentPath):Y.join("/")}}var bJ=()=>{};function Q01(X,Y){let Q={type:"array"};if(X.type?._def&&X.type?._def?.typeName!==A0.ZodAny)Q.items=Y6(X.type._def,{...Y,currentPath:[...Y.currentPath,"items"]});if(X.minLength)x6(Q,"minItems",X.minLength.value,X.minLength.message,Y);if(X.maxLength)x6(Q,"maxItems",X.maxLength.value,X.maxLength.message,Y);if(X.exactLength)x6(Q,"minItems",X.exactLength.value,X.exactLength.message,Y),x6(Q,"maxItems",X.exactLength.value,X.exactLength.message,Y);return Q}var i00=i(()=>{v$();X9()});function J01(X,Y){let Q={type:"integer",format:"int64"};if(!X.checks)return Q;for(let J of X.checks)switch(J.kind){case"min":if(Y.target==="jsonSchema7")if(J.inclusive)x6(Q,"minimum",J.value,J.message,Y);else x6(Q,"exclusiveMinimum",J.value,J.message,Y);else{if(!J.inclusive)Q.exclusiveMinimum=!0;x6(Q,"minimum",J.value,J.message,Y)}break;case"max":if(Y.target==="jsonSchema7")if(J.inclusive)x6(Q,"maximum",J.value,J.message,Y);else x6(Q,"exclusiveMaximum",J.value,J.message,Y);else{if(!J.inclusive)Q.exclusiveMaximum=!0;x6(Q,"maximum",J.value,J.message,Y)}break;case"multipleOf":x6(Q,"multipleOf",J.value,J.message,Y);break}return Q}var a00=()=>{};function G01(){return{type:"boolean"}}function N_(X,Y){return Y6(X.type._def,Y)}var O_=i(()=>{X9()});var W01=(X,Y)=>{return Y6(X.innerType._def,Y)};var r00=i(()=>{X9()});function o00(X,Y,Q){let J=Q??Y.dateStrategy;if(Array.isArray(J))return{anyOf:J.map((G,W)=>o00(X,Y,G))};switch(J){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return xw6(X,Y)}}var xw6=(X,Y)=>{let Q={type:"integer",format:"unix-time"};if(Y.target==="openApi3")return Q;for(let J of X.checks)switch(J.kind){case"min":x6(Q,"minimum",J.value,J.message,Y);break;case"max":x6(Q,"maximum",J.value,J.message,Y);break}return Q};var s00=()=>{};function Z01(X,Y){return{...Y6(X.innerType._def,Y),default:X.defaultValue()}}var t00=i(()=>{X9()});function $01(X,Y){return Y.effectStrategy==="input"?Y6(X.schema._def,Y):O8(Y)}var e00=i(()=>{X9();bJ()});function K01(X){return{type:"string",enum:Array.from(X.values)}}function H01(X,Y){let Q=[Y6(X.left._def,{...Y,currentPath:[...Y.currentPath,"allOf","0"]}),Y6(X.right._def,{...Y,currentPath:[...Y.currentPath,"allOf","1"]})].filter((W)=>!!W),J=Y.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,G=[];return Q.forEach((W)=>{if(gw6(W)){if(G.push(...W.allOf),W.unevaluatedProperties===void 0)J=void 0}else{let Z=W;if("additionalProperties"in W&&W.additionalProperties===!1){let{additionalProperties:$,...K}=W;Z=K}else J=void 0;G.push(Z)}}),G.length?{allOf:G,...J}:void 0}var gw6=(X)=>{if("type"in X&&X.type==="string")return!1;return"allOf"in X};var X10=i(()=>{X9()});function F01(X,Y){let Q=typeof X.value;if(Q!=="bigint"&&Q!=="number"&&Q!=="boolean"&&Q!=="string")return{type:Array.isArray(X.value)?"array":"object"};if(Y.target==="openApi3")return{type:Q==="bigint"?"integer":Q,enum:[X.value]};return{type:Q==="bigint"?"integer":Q,const:X.value}}function L_(X,Y){let Q={type:"string"};if(X.checks)for(let J of X.checks)switch(J.kind){case"min":x6(Q,"minLength",typeof Q.minLength==="number"?Math.max(Q.minLength,J.value):J.value,J.message,Y);break;case"max":x6(Q,"maxLength",typeof Q.maxLength==="number"?Math.min(Q.maxLength,J.value):J.value,J.message,Y);break;case"email":switch(Y.emailStrategy){case"format:email":A5(Q,"email",J.message,Y);break;case"format:idn-email":A5(Q,"idn-email",J.message,Y);break;case"pattern:zod":DY(Q,T5.email,J.message,Y);break}break;case"url":A5(Q,"uri",J.message,Y);break;case"uuid":A5(Q,"uuid",J.message,Y);break;case"regex":DY(Q,J.regex,J.message,Y);break;case"cuid":DY(Q,T5.cuid,J.message,Y);break;case"cuid2":DY(Q,T5.cuid2,J.message,Y);break;case"startsWith":DY(Q,RegExp(`^${Q10(J.value,Y)}`),J.message,Y);break;case"endsWith":DY(Q,RegExp(`${Q10(J.value,Y)}$`),J.message,Y);break;case"datetime":A5(Q,"date-time",J.message,Y);break;case"date":A5(Q,"date",J.message,Y);break;case"time":A5(Q,"time",J.message,Y);break;case"duration":A5(Q,"duration",J.message,Y);break;case"length":x6(Q,"minLength",typeof Q.minLength==="number"?Math.max(Q.minLength,J.value):J.value,J.message,Y),x6(Q,"maxLength",typeof Q.maxLength==="number"?Math.min(Q.maxLength,J.value):J.value,J.message,Y);break;case"includes":{DY(Q,RegExp(Q10(J.value,Y)),J.message,Y);break}case"ip":{if(J.version!=="v6")A5(Q,"ipv4",J.message,Y);if(J.version!=="v4")A5(Q,"ipv6",J.message,Y);break}case"base64url":DY(Q,T5.base64url,J.message,Y);break;case"jwt":DY(Q,T5.jwt,J.message,Y);break;case"cidr":{if(J.version!=="v6")DY(Q,T5.ipv4Cidr,J.message,Y);if(J.version!=="v4")DY(Q,T5.ipv6Cidr,J.message,Y);break}case"emoji":DY(Q,T5.emoji(),J.message,Y);break;case"ulid":{DY(Q,T5.ulid,J.message,Y);break}case"base64":{switch(Y.base64Strategy){case"format:binary":{A5(Q,"binary",J.message,Y);break}case"contentEncoding:base64":{x6(Q,"contentEncoding","base64",J.message,Y);break}case"pattern:zod":{DY(Q,T5.base64,J.message,Y);break}}break}case"nanoid":DY(Q,T5.nanoid,J.message,Y);case"toLowerCase":case"toUpperCase":case"trim":break;default:((G)=>{})(J)}return Q}function Q10(X,Y){return Y.patternStrategy==="escape"?mw6(X):X}function mw6(X){let Y="";for(let Q=0;Q<X.length;Q++){if(!uw6.has(X[Q]))Y+="\\";Y+=X[Q]}return Y}function A5(X,Y,Q,J){if(X.format||X.anyOf?.some((G)=>G.format)){if(!X.anyOf)X.anyOf=[];if(X.format){if(X.anyOf.push({format:X.format,...X.errorMessage&&J.errorMessages&&{errorMessage:{format:X.errorMessage.format}}}),delete X.format,X.errorMessage){if(delete X.errorMessage.format,Object.keys(X.errorMessage).length===0)delete X.errorMessage}}X.anyOf.push({format:Y,...Q&&J.errorMessages&&{errorMessage:{format:Q}}})}else x6(X,"format",Y,Q,J)}function DY(X,Y,Q,J){if(X.pattern||X.allOf?.some((G)=>G.pattern)){if(!X.allOf)X.allOf=[];if(X.pattern){if(X.allOf.push({pattern:X.pattern,...X.errorMessage&&J.errorMessages&&{errorMessage:{pattern:X.errorMessage.pattern}}}),delete X.pattern,X.errorMessage){if(delete X.errorMessage.pattern,Object.keys(X.errorMessage).length===0)delete X.errorMessage}}X.allOf.push({pattern:V01(Y,J),...Q&&J.errorMessages&&{errorMessage:{pattern:Q}}})}else x6(X,"pattern",V01(Y,J),Q,J)}function V01(X,Y){if(!Y.applyRegexFlags||!X.flags)return X.source;let Q={i:X.flags.includes("i"),m:X.flags.includes("m"),s:X.flags.includes("s")},J=Q.i?X.source.toLowerCase():X.source,G="",W=!1,Z=!1,$=!1;for(let K=0;K<J.length;K++){if(W){G+=J[K],W=!1;continue}if(Q.i){if(Z){if(J[K].match(/[a-z]/)){if($)G+=J[K],G+=`${J[K-2]}-${J[K]}`.toUpperCase(),$=!1;else if(J[K+1]==="-"&&J[K+2]?.match(/[a-z]/))G+=J[K],$=!0;else G+=`${J[K]}${J[K].toUpperCase()}`;continue}}else if(J[K].match(/[a-z]/)){G+=`[${J[K]}${J[K].toUpperCase()}]`;continue}}if(Q.m){if(J[K]==="^"){G+=`(^|(?<=[\r
233
233
  ]))`;continue}else if(J[K]==="$"){G+=`($|(?=[\r
234
234
  ]))`;continue}}if(Q.s&&J[K]==="."){G+=Z?`${J[K]}\r
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/mesh",
3
- "version": "2.22.2",
3
+ "version": "2.23.0",
4
4
  "description": "MCP Mesh - Self-hostable MCP Gateway for managing AI connections and tools",
5
5
  "author": "Deco team",
6
6
  "license": "MIT",
@@ -36,8 +36,6 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@jitl/quickjs-wasmfile-release-sync": "^0.31.0",
39
- "@untitledui/icons": "^0.0.19",
40
- "@xyflow/react": "^12.10.0",
41
39
  "kysely": "^0.28.8",
42
40
  "kysely-bun-worker": "^0.6.0",
43
41
  "quickjs-emscripten-core": "^0.31.0"
@@ -53,6 +51,7 @@
53
51
  "@decocms/mesh-sdk": "workspace:*",
54
52
  "@decocms/runtime": "workspace:*",
55
53
  "@decocms/vite-plugin": "workspace:*",
54
+ "@floating-ui/react": "^0.27.16",
56
55
  "@hookform/resolvers": "^5.2.2",
57
56
  "@modelcontextprotocol/sdk": "1.25.2",
58
57
  "@monaco-editor/react": "^4.7.0",
@@ -78,15 +77,20 @@
78
77
  "@tanstack/react-query": "^5.90.11",
79
78
  "@tanstack/react-router": "^1.139.7",
80
79
  "@tanstack/react-router-devtools": "^1.139.7",
80
+ "@tiptap/core": "^3.15.3",
81
81
  "@tiptap/extension-mention": "^3.13.0",
82
- "@tiptap/pm": "^3.13.0",
83
- "@tiptap/react": "^3.13.0",
84
- "@tiptap/starter-kit": "^3.13.0",
85
- "@tiptap/suggestion": "^3.13.0",
82
+ "@tiptap/extension-placeholder": "^3.15.3",
83
+ "@tiptap/pm": "^3.15.3",
84
+ "@tiptap/react": "^3.15.3",
85
+ "@tiptap/starter-kit": "^3.15.3",
86
+ "@tiptap/suggestion": "^3.15.3",
86
87
  "@types/bun": "^1.3.1",
87
88
  "@types/pg": "^8.15.6",
89
+ "@types/react-syntax-highlighter": "^15.5.13",
90
+ "@untitledui/icons": "^0.0.19",
88
91
  "@vercel/nft": "^1.1.1",
89
92
  "@vitejs/plugin-react": "^5.1.0",
93
+ "@xyflow/react": "^12.10.0",
90
94
  "ai": "^6.0.1",
91
95
  "babel-plugin-react-compiler": "^1.0.0",
92
96
  "better-auth": "1.4.5",
@@ -99,15 +103,22 @@
99
103
  "hono": "^4.10.7",
100
104
  "idb-keyval": "^6.2.2",
101
105
  "input-otp": "^1.4.2",
102
- "lucide-react": "^0.468.0",
103
- "prettier": "^3.4.2",
104
106
  "jose": "^6.0.11",
107
+ "lucide-react": "^0.468.0",
108
+ "marked": "^15.0.6",
109
+ "mesh-plugin-object-storage": "workspace:*",
105
110
  "nanoid": "^5.1.6",
106
111
  "pg": "^8.16.3",
112
+ "prettier": "^3.4.2",
107
113
  "react": "^19.2.0",
108
114
  "react-dom": "^19.2.0",
109
115
  "react-hook-form": "^7.66.0",
116
+ "react-markdown": "^9.0.0",
117
+ "react-syntax-highlighter": "^15.6.1",
110
118
  "recharts": "^3.6.0",
119
+ "rehype-raw": "^7.0.0",
120
+ "remark-gfm": "^4.0.0",
121
+ "sass-embedded": "^1.97.2",
111
122
  "sonner": "^2.0.7",
112
123
  "tailwind-merge": "^3.3.1",
113
124
  "tailwindcss": "^4.1.17",
@@ -116,8 +127,7 @@
116
127
  "vite-tsconfig-paths": "^5.1.4",
117
128
  "zod": "^4.0.0",
118
129
  "zod-from-json-schema": "^0.5.2",
119
- "zustand": "^5.0.9",
120
- "mesh-plugin-object-storage": "workspace:*"
130
+ "zustand": "^5.0.9"
121
131
  },
122
132
  "module": "src/index.ts",
123
133
  "keywords": [