decocms 4.387.4 → 4.388.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 (348) hide show
  1. package/dist/client/assets/{AlertCircle-hgSWDBKD.js → AlertCircle-B3vbo2n4.js} +1 -1
  2. package/dist/client/assets/{AreaChart-DVYORiwb.js → AreaChart-Yh8fUuWv.js} +1 -1
  3. package/dist/client/assets/{ArrowLeft-CzWgQa3d.js → ArrowLeft-D3qL-XiQ.js} +1 -1
  4. package/dist/client/assets/{ArrowRight-CIScbBBH.js → ArrowRight-TVV5ykHB.js} +1 -1
  5. package/dist/client/assets/{ArrowUp-eY5LwDBJ.js → ArrowUp-Dl9293Zm.js} +1 -1
  6. package/dist/client/assets/{CartesianChart-BsELtg0l.js → CartesianChart-DfoC6a-3.js} +1 -1
  7. package/dist/client/assets/{Check-DzMCAWjr.js → Check-D_tlADVZ.js} +1 -1
  8. package/dist/client/assets/{CheckCircle-qWNKZRjX.js → CheckCircle-0fEKB6B3.js} +1 -1
  9. package/dist/client/assets/{ChevronUp-DgOooPEV.js → ChevronUp-CZododOc.js} +1 -1
  10. package/dist/client/assets/{Copy01-BCpofYsG.js → Copy01-BxWduMFI.js} +1 -1
  11. package/dist/client/assets/{CreditCard01-Bn7Nh7pY.js → CreditCard01-B_POaQ4q.js} +1 -1
  12. package/dist/client/assets/{DotsVertical-C2r7pSjy.js → DotsVertical-B0Iw1UeS.js} +1 -1
  13. package/dist/client/assets/{Download01-ByIMlvpp.js → Download01-B9Zxwy2S.js} +1 -1
  14. package/dist/client/assets/{ErrorBarContext-23zPf3av.js → ErrorBarContext-CZlY3SbC.js} +1 -1
  15. package/dist/client/assets/{Eye-ByeGuis7.js → Eye-C9j6hpaR.js} +1 -1
  16. package/dist/client/assets/{Globe04-DkE5Ga3y.js → Globe04-CS-hrWJa.js} +1 -1
  17. package/dist/client/assets/{Image01-PHuIhGsn.js → Image01-CiKG1988.js} +1 -1
  18. package/dist/client/assets/{Key01-bvziUujD.js → Key01-pzGK6JH7.js} +1 -1
  19. package/dist/client/assets/{LayoutLeft-ckCNGRyd.js → LayoutLeft-Bnqg216Y.js} +1 -1
  20. package/dist/client/assets/{Line-DkH-1kxq.js → Line-DCXUVJoa.js} +1 -1
  21. package/dist/client/assets/{Link01-CouYtnpo.js → Link01-BdGwRjsp.js} +1 -1
  22. package/dist/client/assets/{LinkExternal01-0aXUH17w.js → LinkExternal01-DKesUYi5.js} +1 -1
  23. package/dist/client/assets/{Monitor01-DuCnxHrO.js → Monitor01-UFcMi6Mo.js} +1 -1
  24. package/dist/client/assets/{Package-CMAEathT.js → Package-6pKWLwBq.js} +1 -1
  25. package/dist/client/assets/{Palette-BBg5KSeZ.js → Palette-D2q-ZicE.js} +1 -1
  26. package/dist/client/assets/{Plus-cTdqTQJ8.js → Plus-ByhE8WcD.js} +1 -1
  27. package/dist/client/assets/{SearchLg-DcTL96oE.js → SearchLg-qnEtqtLB.js} +1 -1
  28. package/dist/client/assets/{SearchMd-CZbvHP8u.js → SearchMd-DWmNu2U_.js} +1 -1
  29. package/dist/client/assets/{Sector-Caqc_Xyr.js → Sector-CneAt4Gv.js} +1 -1
  30. package/dist/client/assets/{Share07-D5qAIdw_.js → Share07-BqNOPmHA.js} +1 -1
  31. package/dist/client/assets/{Stars01-C5hpEQpu.js → Stars01-Dkj_wrJI.js} +1 -1
  32. package/dist/client/assets/{Sun-D5Qo0_mB.js → Sun-BVwRyOQy.js} +1 -1
  33. package/dist/client/assets/{Tool01-BYaM5WOz.js → Tool01-Ykv0VphE.js} +1 -1
  34. package/dist/client/assets/{Trash01--pUGUtXR.js → Trash01-BLI32Zf8.js} +1 -1
  35. package/dist/client/assets/{Upload01-CMKb6UeY.js → Upload01-DFmVph6Y.js} +1 -1
  36. package/dist/client/assets/{User01-BMbUYR62.js → User01-BhEBu8iZ.js} +1 -1
  37. package/dist/client/assets/{UserSquare-aLl4gPvx.js → UserSquare-CHWuMbCn.js} +1 -1
  38. package/dist/client/assets/{Users01-asdLCVMY.js → Users01-Cfge0Lra.js} +1 -1
  39. package/dist/client/assets/{X-Cw_7koO_.js → X-CWAHEOzU.js} +1 -1
  40. package/dist/client/assets/{XCircle-CKc7d-mF.js → XCircle-qVUpsS9M.js} +1 -1
  41. package/dist/client/assets/{XClose-CBlP8YJ4.js → XClose-qmmFqCGy.js} +1 -1
  42. package/dist/client/assets/{Zap-X-YWs08T.js → Zap-DrC6qRHo.js} +1 -1
  43. package/dist/client/assets/{ZoomOut-dbJRRJek.js → ZoomOut-XXX--5-d.js} +1 -1
  44. package/dist/client/assets/{access-gate-CbKiWCEh.js → access-gate-CLIznoIq.js} +1 -1
  45. package/dist/client/assets/{add-connection-dialog-DFQxs8aQ.js → add-connection-dialog-Dgk-Fo2O.js} +1 -1
  46. package/dist/client/assets/{agent-analytics-DLUP9cW7.js → agent-analytics-ypQJRGpO.js} +1 -1
  47. package/dist/client/assets/agent-app-DLHKX0zW.js +1 -0
  48. package/dist/client/assets/{agent-assets-CKMissdp.js → agent-assets-DqoWPCeO.js} +1 -1
  49. package/dist/client/assets/{agent-automation-CkNf87LL.js → agent-automation-B1GI-IUL.js} +1 -1
  50. package/dist/client/assets/{agent-automations-BuJ9HnU1.js → agent-automations-C4C56Ppt.js} +1 -1
  51. package/dist/client/assets/{agent-connect-sources-BS54eLud.js → agent-connect-sources-kgcoC2NH.js} +1 -1
  52. package/dist/client/assets/agent-deck-CFXZozzL.js +1 -0
  53. package/dist/client/assets/{agent-e2e-BvYT8r2A.js → agent-e2e-D-RGNzmF.js} +1 -1
  54. package/dist/client/assets/{agent-experiments-DD8Qb89Z.js → agent-experiments-DdKmJSPF.js} +1 -1
  55. package/dist/client/assets/agent-file-Cdzmox1M.js +1 -0
  56. package/dist/client/assets/{agent-git-DHj1LXR0.js → agent-git-BUhy80bl.js} +1 -1
  57. package/dist/client/assets/{agent-hosting-DY_mWLOF.js → agent-hosting-DgsS95Ie.js} +1 -1
  58. package/dist/client/assets/{agent-icon-BqOZh8n2.js → agent-icon-divnTd88.js} +1 -1
  59. package/dist/client/assets/agent-library-file-1s5_RvBJ.js +1 -0
  60. package/dist/client/assets/{agent-monitor-BYAXHL39.js → agent-monitor-BLG_l_nw.js} +1 -1
  61. package/dist/client/assets/{agent-overview-CwczZCnS.js → agent-overview-CnOztAR4.js} +1 -1
  62. package/dist/client/assets/agent-settings-DD9dMgS4.js +1 -0
  63. package/dist/client/assets/{agent-site-editor-CcjNJALL.js → agent-site-editor-DrQ7F-c2.js} +1 -1
  64. package/dist/client/assets/agent-site-editor-code-DOoSUnhO.js +2 -0
  65. package/dist/client/assets/{agent-site-editor-content-DX-Lv87x.js → agent-site-editor-content-7EGHbN2s.js} +2 -2
  66. package/dist/client/assets/{agent-site-editor-preview-CgJuMcBi.js → agent-site-editor-preview-CNQARCEM.js} +3 -3
  67. package/dist/client/assets/agent-view-CvNkWxfz.js +1 -0
  68. package/dist/client/assets/{agent-view-guard-DKXWK48x.js → agent-view-guard-DcLXrFY7.js} +1 -1
  69. package/dist/client/assets/{agents-list-BYb72bFD.js → agents-list-BnSIzGi_.js} +1 -1
  70. package/dist/client/assets/{ai-providers-Dj6Kl9IH.js → ai-providers-DOhvFs8_.js} +1 -1
  71. package/dist/client/assets/{alert-R89k4y7D.js → alert-C9f3lMWV.js} +1 -1
  72. package/dist/client/assets/{alert-dialog-09b5zi9b.js → alert-dialog-CoURP6JP.js} +1 -1
  73. package/dist/client/assets/api-keys-BTjpmk07.js +1 -0
  74. package/dist/client/assets/{api-keys-DzVLrRkO.js → api-keys-e7ZGvNnY.js} +1 -1
  75. package/dist/client/assets/app-editor-xnF9j2IL.js +1 -0
  76. package/dist/client/assets/{asset-utils-C5Hu2JCd.js → asset-utils-CGhDuCoB.js} +1 -1
  77. package/dist/client/assets/{auth-QQKUjaGO.js → auth-Cp5MWYdV.js} +1 -1
  78. package/dist/client/assets/{auth-catchall-D1MDVPDw.js → auth-catchall-DYItykNy.js} +1 -1
  79. package/dist/client/assets/{auth-entry-CGOv1OCk.js → auth-entry-Q3dYUM1O.js} +1 -1
  80. package/dist/client/assets/{auth-split-layout-CFwpJ-J8.js → auth-split-layout-BvWYkE3p.js} +1 -1
  81. package/dist/client/assets/{authenticate-and-persist-oauth-DGW42nhH.js → authenticate-and-persist-oauth-CeZbUQJ3.js} +1 -1
  82. package/dist/client/assets/{automation-list-row-f_Ch9K0J.js → automation-list-row-CSwkkwa1.js} +1 -1
  83. package/dist/client/assets/{automation-runs-DBNJL4Op.js → automation-runs-FaCqipXn.js} +1 -1
  84. package/dist/client/assets/{automations-DWpA8Qi9.js → automations-DtAw8o6m.js} +1 -1
  85. package/dist/client/assets/{autosend-DtYrTN-p.js → autosend-bcZiscel.js} +1 -1
  86. package/dist/client/assets/{avatar-D5-ZPRQI.js → avatar-DkdwXmnt.js} +1 -1
  87. package/dist/client/assets/{badge-CuUWv0wf.js → badge-C-WEeGXr.js} +1 -1
  88. package/dist/client/assets/{block-document-BGeIf5uW.js → block-document-BH7uPsFs.js} +1 -1
  89. package/dist/client/assets/{blocks-preview-workspace-context-B60XRWOG.js → blocks-preview-workspace-context-JZgpiL3E.js} +1 -1
  90. package/dist/client/assets/{breadcrumb-BojYvdWK.js → breadcrumb-BFQDnz1s.js} +1 -1
  91. package/dist/client/assets/{buckets-a3qADnPh.js → buckets-CQDlrdX7.js} +1 -1
  92. package/dist/client/assets/{build-improve-prompt-doc-sS3w96Og.js → build-improve-prompt-doc-rZuI3ein.js} +1 -1
  93. package/dist/client/assets/{bulk-category-panel-5KvtPYne.js → bulk-category-panel-Db5NOZeC.js} +1 -1
  94. package/dist/client/assets/{calendar-BOE11yNb.js → calendar-Bl5KJT_m.js} +1 -1
  95. package/dist/client/assets/{capability-load-error-DVze9JJO.js → capability-load-error-bsZZ3MDG.js} +1 -1
  96. package/dist/client/assets/{category-editor-CZTWyUYO.js → category-editor-B3WVieTJ.js} +1 -1
  97. package/dist/client/assets/{chart-CE5FeDtf.js → chart-BlDO6lmw.js} +1 -1
  98. package/dist/client/assets/{chat-context-BQ31Bfeq.js → chat-context-DlQMH2wV.js} +1 -1
  99. package/dist/client/assets/{chat-draft-CJHKbn8q.js → chat-draft-Ey6VTCc6.js} +1 -1
  100. package/dist/client/assets/{checkbox-DI7xt0LT.js → checkbox-CetAIQt3.js} +1 -1
  101. package/dist/client/assets/{choose-editor-CfhoOCVG.js → choose-editor-E0PoMRqt.js} +1 -1
  102. package/dist/client/assets/{cli-auth-success-4SdRn6kg.js → cli-auth-success-BDCK7RdA.js} +1 -1
  103. package/dist/client/assets/{client-icons-pmKOvFbb.js → client-icons-C9pOgXGn.js} +1 -1
  104. package/dist/client/assets/{collapsible-fq3ywKeY.js → collapsible-F0ucrOT2.js} +1 -1
  105. package/dist/client/assets/{collection-detail-m0mc9pdA.js → collection-detail-son9oWms.js} +1 -1
  106. package/dist/client/assets/{collection-display-button-CLbtU-hc.js → collection-display-button-BoGvFGDf.js} +1 -1
  107. package/dist/client/assets/{collection-search-BdGPVPjv.js → collection-search-MM7huzHV.js} +1 -1
  108. package/dist/client/assets/{collection-table-wrapper-BH15Zw5U.js → collection-table-wrapper-DwnvMNEo.js} +1 -1
  109. package/dist/client/assets/{collection-tabs-CL85PC6j.js → collection-tabs-K4gdTMTz.js} +1 -1
  110. package/dist/client/assets/{combobox-CTVJbVdn.js → combobox-DcDs621E.js} +1 -1
  111. package/dist/client/assets/{command-BIGzDMaF.js → command-C2V0RClc.js} +1 -1
  112. package/dist/client/assets/{companion-mcps-section-BSusJt-e.js → companion-mcps-section-MHc9gkDP.js} +1 -1
  113. package/dist/client/assets/{connect-CrOzJGoQ.js → connect-D41RRDUk.js} +1 -1
  114. package/dist/client/assets/{connect-layout-P18AaSoT.js → connect-layout-B0lwhzHq.js} +1 -1
  115. package/dist/client/assets/{connection-DWbZ_3yx.js → connection-Cun5XH5M.js} +1 -1
  116. package/dist/client/assets/{connection-card-DlGoZxEj.js → connection-card-DLOUTnaw.js} +1 -1
  117. package/dist/client/assets/{connection-detail-L2SpKinp.js → connection-detail-6ikNU4PB.js} +1 -1
  118. package/dist/client/assets/{connection-form-helpers-DXYLv7MV.js → connection-form-helpers-BXGTvVI-.js} +1 -1
  119. package/dist/client/assets/{connections-CfYAULl7.js → connections-KBXuKPoG.js} +1 -1
  120. package/dist/client/assets/{create-organization-dialog-CSYovKTP.js → create-organization-dialog-CsZA9PRp.js} +1 -1
  121. package/dist/client/assets/{decofile-api-D_MGfJu9.js → decofile-api-CWbA3cSc.js} +1 -1
  122. package/dist/client/assets/{decopilot-Djom2Zcg.js → decopilot-DQL3SRkD.js} +1 -1
  123. package/dist/client/assets/{dialog-5mMpq7OS.js → dialog-Bc0b91qz.js} +1 -1
  124. package/dist/client/assets/{discover-BFFjc8-U.js → discover-CkXO0-VH.js} +1 -1
  125. package/dist/client/assets/{domain-settings-BGKOfp5S.js → domain-settings-brlSn5FP.js} +1 -1
  126. package/dist/client/assets/{download-app-dialog-DezawA27.js → download-app-dialog-BbPnWlx7.js} +1 -1
  127. package/dist/client/assets/{drawer-Clfr_5DB.js → drawer-DhPaxB79.js} +1 -1
  128. package/dist/client/assets/{editor-CwhSrqRp.js → editor-a0WmA-YY.js} +1 -1
  129. package/dist/client/assets/{empty-state-CD95avq5.js → empty-state--qShNy1w.js} +1 -1
  130. package/dist/client/assets/{empty-state-zdpJBO-5.js → empty-state-DWDFQbGC.js} +1 -1
  131. package/dist/client/assets/{extract-connection-data-Dh_l3Re9.js → extract-connection-data-9RCfjOgD.js} +1 -1
  132. package/dist/client/assets/{feature-gate-CfWHI6g_.js → feature-gate-CgGa3ZDG.js} +1 -1
  133. package/dist/client/assets/{feature-paywall-D9JZKI5C.js → feature-paywall-DJX2siu_.js} +1 -1
  134. package/dist/client/assets/{file-explorer-51qkWmNB.js → file-explorer-BEXMjT8z.js} +1 -1
  135. package/dist/client/assets/{file-preview-C33EciU-.js → file-preview-BumkWVqe.js} +1 -1
  136. package/dist/client/assets/{file-share-button-DeYTdWpB.js → file-share-button-Duq13WCj.js} +1 -1
  137. package/dist/client/assets/{file-type-icon-DW6Dy1DN.js → file-type-icon-BcnPvY0i.js} +1 -1
  138. package/dist/client/assets/{folder-icon-CyTcj4wQ.js → folder-icon-B5Scx265.js} +1 -1
  139. package/dist/client/assets/{form-TPwFuqR4.js → form-_T61niJY.js} +1 -1
  140. package/dist/client/assets/{gateway-client-CkxdMYfV.js → gateway-client-CnDTfx_S.js} +1 -1
  141. package/dist/client/assets/{general-B3z4qWxE.js → general-CVz_RoFN.js} +1 -1
  142. package/dist/client/assets/{github-icon-DNTVbGph.js → github-icon-DsbtDmDz.js} +1 -1
  143. package/dist/client/assets/{home-DWc6L2Jp.js → home-DeQWav87.js} +1 -1
  144. package/dist/client/assets/{hooks-CVQ1xmlF.js → hooks-aU1jFzgz.js} +1 -1
  145. package/dist/client/assets/{hooks-WQDUMFdE.js → hooks-vksrlvlh.js} +1 -1
  146. package/dist/client/assets/{icon-button-Bq7aHJwI.js → icon-button-OlTmmJA2.js} +1 -1
  147. package/dist/client/assets/{index-CfbJAueL.js → index-B1FDJFo6.js} +1 -1
  148. package/dist/client/assets/{index-D32fs2Ca.js → index-BbFhejIw.js} +1 -1
  149. package/dist/client/assets/{index-DBorommm.js → index-C4MSgrlx.js} +1 -1
  150. package/dist/client/assets/{index-XLrU86r7.js → index-CZjk6esA.js} +1 -1
  151. package/dist/client/assets/{index-BLTIHwye.js → index-DICH1Iwn.js} +1 -1
  152. package/dist/client/assets/{index-DxDu0P4R.js → index-DSlHDmY9.js} +1 -1
  153. package/dist/client/assets/{index-BmHFJ8-I.js → index-DoMedB57.js} +4 -4
  154. package/dist/client/assets/{index-yUQov1Eh.js → index-DorJkHHg.js} +1 -1
  155. package/dist/client/assets/{index-ZrCMZzYe.js → index-Mlw2Lvi5.js} +1 -1
  156. package/dist/client/assets/{index-B27TMELH.js → index-bQ6kPwbH.js} +1 -1
  157. package/dist/client/assets/{index-KKwPxkKt.js → index-pviDbl5M.js} +1 -1
  158. package/dist/client/assets/{index-redirect-ieY-jS_n.js → index-redirect-C1UwKejc.js} +1 -1
  159. package/dist/client/assets/{index-DT8Q2ghR.js → index-sk2sSzBL.js} +1 -1
  160. package/dist/client/assets/{index-D6eyVee0.js → index-tlSWakM4.js} +1 -1
  161. package/dist/client/assets/{index-DtyRQs7F.js → index-xILAqSaa.js} +1 -1
  162. package/dist/client/assets/{infiniteQueryObserver-Ctf1361m.js → infiniteQueryObserver-aaHUJUze.js} +1 -1
  163. package/dist/client/assets/{infra-billing-Cr_iOgVk.js → infra-billing-CY1SQkDW.js} +1 -1
  164. package/dist/client/assets/{input-Cq71l1Ry.js → input-BcrWgMXI.js} +1 -1
  165. package/dist/client/assets/{input-Ds1I_y35.js → input-PwEo6j5x.js} +1 -1
  166. package/dist/client/assets/{input-BZxUKOnb.js → input-yrJmpPKL.js} +1 -1
  167. package/dist/client/assets/{integration-icon-BZtlnWJ7.js → integration-icon-DacXQkv5.js} +1 -1
  168. package/dist/client/assets/{label-DuGuNzBP.js → label-VIvlEdF-.js} +1 -1
  169. package/dist/client/assets/{last-preview-page-DiAGrdTY.js → last-preview-page-baujoWR_.js} +1 -1
  170. package/dist/client/assets/{layout-CqWPDO1U.js → layout-TEbZiNtr.js} +1 -1
  171. package/dist/client/assets/{legacy-agents-deep-Bd4Vm8UF.js → legacy-agents-deep-CPQUajoT.js} +1 -1
  172. package/dist/client/assets/{legacy-main-redirect-CE6xBwkY.js → legacy-main-redirect-VftM-8Kr.js} +1 -1
  173. package/dist/client/assets/{library-B5H7WGMK.js → library-zll0qePG.js} +1 -1
  174. package/dist/client/assets/{login-Bx8aRDt0.js → login-DwEyh4eJ.js} +1 -1
  175. package/dist/client/assets/{markdown-jOLIjTiL.js → markdown-D2mDmYtT.js} +1 -1
  176. package/dist/client/assets/{mcp-app-renderer-B9XYCb9t.js → mcp-app-renderer-C9KPQDuu.js} +1 -1
  177. package/dist/client/assets/{mcp-oauth-DLMMGdWc.js → mcp-oauth-LmTTT8Tz.js} +1 -1
  178. package/dist/client/assets/{members-DTxfZDwV.js → members-DEAgfwF7.js} +1 -1
  179. package/dist/client/assets/{message-templates-CxD-ZDtY.js → message-templates-C1GTjtE0.js} +1 -1
  180. package/dist/client/assets/{mini-report-page-D4Dk4lD5.js → mini-report-page-LrRmRqok.js} +1 -1
  181. package/dist/client/assets/{mock-board-BIv2kftV.js → mock-board-BwXp2PH3.js} +3 -3
  182. package/dist/client/assets/{monaco-editor-BNfRsUag.js → monaco-editor-DYUogsQZ.js} +1 -1
  183. package/dist/client/assets/{monitoring-stats-row-c2k1JtE0.js → monitoring-stats-row-Bq_MvZQS.js} +1 -1
  184. package/dist/client/assets/{multi-select-DishTQDl.js → multi-select-CW0D8RvY.js} +1 -1
  185. package/dist/client/assets/{mustache-BoKbeKU4.js → mustache-B2SzJma0.js} +1 -1
  186. package/dist/client/assets/{oauth-callback-D5GYrF4m.js → oauth-callback-Cg8wq5wx.js} +1 -1
  187. package/dist/client/assets/{oauth-callback-ai-provider-idl2MhjT.js → oauth-callback-ai-provider-5iOdHj_G.js} +1 -1
  188. package/dist/client/assets/{onboarding-D72CsRQM.js → onboarding-CT63y-v2.js} +1 -1
  189. package/dist/client/assets/{optimistic-project-sidebar-views-B1zxNGd6.js → optimistic-project-sidebar-views-X7vKCfrC.js} +1 -1
  190. package/dist/client/assets/{org-file-open-context-BjaYpx82.js → org-file-open-context-BOZM6YLL.js} +1 -1
  191. package/dist/client/assets/{organization-choice-DWLsk65r.js → organization-choice-m7Ngqp5V.js} +1 -1
  192. package/dist/client/assets/{orgs-CA-2yGha.js → orgs-BpWIw0D-.js} +1 -1
  193. package/dist/client/assets/{page-seo-form-BdfQ7jpm.js → page-seo-form-DAFmsPON.js} +1 -1
  194. package/dist/client/assets/{pair-C4m4P_bM.js → pair-Dw1oMoxu.js} +1 -1
  195. package/dist/client/assets/{plan-ladder-DIPLnYTK.js → plan-ladder-D6Ni723J.js} +1 -1
  196. package/dist/client/assets/{popover-D7lBYhvH.js → popover-BeSwGzw4.js} +1 -1
  197. package/dist/client/assets/{post-calendar-CEmu24aN.js → post-calendar-DFL9wRVM.js} +1 -1
  198. package/dist/client/assets/{post-editor-DhcHNk_x.js → post-editor-g-n7lnu4.js} +1 -1
  199. package/dist/client/assets/{preview-content-CJ5xSzgM.js → preview-content-vgszlQx5.js} +1 -1
  200. package/dist/client/assets/{preview-dialog-B43IYD5D.js → preview-dialog-DlidufSo.js} +1 -1
  201. package/dist/client/assets/{primitives-C4_QeNEE.js → primitives-Da7dIvHN.js} +1 -1
  202. package/dist/client/assets/{profile-Cbc_yFas.js → profile-BcCNtm8s.js} +1 -1
  203. package/dist/client/assets/{project-app-view-FqlJbDg-.js → project-app-view-CjPSAJ4u.js} +1 -1
  204. package/dist/client/assets/{project-feed-ChaTEA9D.js → project-feed-DQMgDZo-.js} +1 -1
  205. package/dist/client/assets/{project-icon-DaIs4OX5.js → project-icon-BRvH27Hr.js} +1 -1
  206. package/dist/client/assets/project-reports-BPob9HW7.js +1 -0
  207. package/dist/client/assets/project-tasks-CNUbGBJz.js +1 -0
  208. package/dist/client/assets/{prompts-uxgryOMT.js → prompts-Dky1VWuT.js} +1 -1
  209. package/dist/client/assets/record-editor-BqQ-Bty3.js +1 -0
  210. package/dist/client/assets/{redirect-editor-D8_etHJh.js → redirect-editor-Cugc1S4I.js} +1 -1
  211. package/dist/client/assets/reports-BNwccApQ.js +1 -0
  212. package/dist/client/assets/{reports-BJQZrvSm.js → reports-DzRrzSMb.js} +1 -1
  213. package/dist/client/assets/{reports-onboarding-Df1Nn8co.js → reports-onboarding-C6GSc5Ia.js} +1 -1
  214. package/dist/client/assets/{reports-tab-BenCKxOl.js → reports-tab-gAoWI9U7.js} +2 -2
  215. package/dist/client/assets/{repositories-DyuvVGkQ.js → repositories-BJecUAZm.js} +1 -1
  216. package/dist/client/assets/{repository-import-picker-DI9X7Sv8.js → repository-import-picker-CVYJ_0AH.js} +1 -1
  217. package/dist/client/assets/{repository-picker-BDtSGlFC.js → repository-picker-xQ4J7ikd.js} +1 -1
  218. package/dist/client/assets/{require-capability-CBL83jiY.js → require-capability-CirQ2r5Q.js} +1 -1
  219. package/dist/client/assets/{required-auth-layout-C1R25Zzy.js → required-auth-layout-CPKi594K.js} +1 -1
  220. package/dist/client/assets/{reset-password-BjRkjhqj.js → reset-password-B9PPRmxG.js} +1 -1
  221. package/dist/client/assets/{resizable-Gx90COqD.js → resizable-Bn0P8wYO.js} +1 -1
  222. package/dist/client/assets/{review-settings-BRCUtMlW.js → review-settings-Jqx7EDla.js} +1 -1
  223. package/dist/client/assets/{rich-text-link-control-B_wwOJO6.js → rich-text-link-control-x5R3OHhF.js} +1 -1
  224. package/dist/client/assets/{roles-DmwaGQ93.js → roles-bgxwGoDy.js} +1 -1
  225. package/dist/client/assets/{route-IZI1rK9k.js → route-B4isURIv.js} +1 -1
  226. package/dist/client/assets/{route-2gxnzXXf.js → route-CLG4oaJK.js} +1 -1
  227. package/dist/client/assets/{route-CnJdNRr7.js → route-aZil8y7k.js} +1 -1
  228. package/dist/client/assets/{route-page-header-DocAv1wt.js → route-page-header-Bi8l6Mod.js} +1 -1
  229. package/dist/client/assets/{runnable-block-editor-D1TaiLpP.js → runnable-block-editor-C_f1q_t9.js} +1 -1
  230. package/dist/client/assets/{sandbox-lifecycle-context-MZjjHvYn.js → sandbox-lifecycle-context-CzQUzQHx.js} +1 -1
  231. package/dist/client/assets/{schema-B-uhJjy5.js → schema-xxzWAMkW.js} +1 -1
  232. package/dist/client/assets/{scroll-area-2ymKmoTZ.js → scroll-area-DTL1f--y.js} +1 -1
  233. package/dist/client/assets/{search-input-CMBvJ10v.js → search-input-C85exKRK.js} +1 -1
  234. package/dist/client/assets/{search-toggle-DgisFciF.js → search-toggle-0SXorNX1.js} +1 -1
  235. package/dist/client/assets/{secrets-C7dmJLgp.js → secrets-DqdXjnYq.js} +1 -1
  236. package/dist/client/assets/{sections-editor-BeWO_pke.js → sections-editor-FApy7gQU.js} +1 -1
  237. package/dist/client/assets/{select-1DiMgU9T.js → select-DC0twOQ9.js} +1 -1
  238. package/dist/client/assets/{select-model-Du8rEdSR.js → select-model-DEr_zu2K.js} +1 -1
  239. package/dist/client/assets/{seo-editor-DhP3LDEt.js → seo-editor-CsbFu7jq.js} +1 -1
  240. package/dist/client/assets/{separator-CtdnogFH.js → separator-Cj8hF9_n.js} +1 -1
  241. package/dist/client/assets/{settings-tab-DJDnoIui.js → settings-tab-CwdO9ZFo.js} +3 -3
  242. package/dist/client/assets/{sheet-DPS1Kz_C.js → sheet-D0J4gDr6.js} +1 -1
  243. package/dist/client/assets/{shell-layout-CKihGZNX.js → shell-layout-BmlQrTmD.js} +1 -1
  244. package/dist/client/assets/{sidebar-DEcau47F.js → sidebar-DzuQpL53.js} +1 -1
  245. package/dist/client/assets/{skill-preview-BAiilt37.js → skill-preview-Clgxg6ec.js} +1 -1
  246. package/dist/client/assets/{skills-BaePIRSM.js → skills-8MF6Pqra.js} +1 -1
  247. package/dist/client/assets/{sso-CObwTqK6.js → sso-DJYOmf3W.js} +1 -1
  248. package/dist/client/assets/{switch-DN875-Cr.js → switch-B5FiEGIW.js} +1 -1
  249. package/dist/client/assets/{synced-repos-BRQY-CIB.js → synced-repos-Cy4EEmPa.js} +1 -1
  250. package/dist/client/assets/{table-k1Brqzpd.js → table-CXe4UMxN.js} +1 -1
  251. package/dist/client/assets/{tabs-Bp0Ch-Ga.js → tabs-D1StyWQr.js} +1 -1
  252. package/dist/client/assets/{task-board-2PgUk_FK.js → task-board-1V3gCk_i.js} +1 -1
  253. package/dist/client/assets/{task-route-BL0TXOaJ.js → task-route-DsuUdSl6.js} +1 -1
  254. package/dist/client/assets/{task-status-C8YXJLH6.js → task-status-DG0J8Zgz.js} +1 -1
  255. package/dist/client/assets/{taskboard-analytics-CVofvbkS.js → taskboard-analytics-CqBjOZ2A.js} +1 -1
  256. package/dist/client/assets/{tasks-ptve1jRC.js → tasks-BW9PQJ_O.js} +1 -1
  257. package/dist/client/assets/tasks-Cg8gIxgc.js +1 -0
  258. package/dist/client/assets/{textarea-B5ek6Hvw.js → textarea-CoEyNtpM.js} +1 -1
  259. package/dist/client/assets/{thread-button-B_foFoP7.js → thread-button-nc7q3w4V.js} +1 -1
  260. package/dist/client/assets/{thread-intent-BC6vFZtL.js → thread-intent-CcPnu4GE.js} +1 -1
  261. package/dist/client/assets/{thread-route-B4Zc4-z8.js → thread-route-CjF1fn3r.js} +1 -1
  262. package/dist/client/assets/{thread-route-CwRPK4w6.js → thread-route-DcxK4b7Y.js} +1 -1
  263. package/dist/client/assets/{thread-sheet-body-nc6bS6tW.js → thread-sheet-body-CBJpO93g.js} +1 -1
  264. package/dist/client/assets/{toggle-group-B1SPzaTJ.js → toggle-group-BE-optrK.js} +1 -1
  265. package/dist/client/assets/{toolbar-icon-button-BPHXDT9A.js → toolbar-icon-button-BuFZ6ucT.js} +1 -1
  266. package/dist/client/assets/{tooltip-DZR6NrSl.js → tooltip-BPzHnAJj.js} +1 -1
  267. package/dist/client/assets/{track-Dt4ss06A.js → track-BHMBpod4.js} +1 -1
  268. package/dist/client/assets/{types-BFjFcLd2.js → types-34Ays45L.js} +1 -1
  269. package/dist/client/assets/{usage-stats-BYLYR362.js → usage-stats-T0WTsS5L.js} +1 -1
  270. package/dist/client/assets/{use-ai-providers-UqHoQ3ST.js → use-ai-providers-4YtSwB8t.js} +1 -1
  271. package/dist/client/assets/{use-automations-C2WvZsip.js → use-automations-D9n_ZmrB.js} +1 -1
  272. package/dist/client/assets/{use-autosave-DfpUmvQC.js → use-autosave-D3Tbpdwv.js} +1 -1
  273. package/dist/client/assets/{use-connect-companion-DftPPtUI.js → use-connect-companion-BvYIFqkx.js} +1 -1
  274. package/dist/client/assets/{use-connection-oC15oclL.js → use-connection-CJl3txo3.js} +1 -1
  275. package/dist/client/assets/{use-copy-SiO3fRza.js → use-copy-BWK9VZeC.js} +1 -1
  276. package/dist/client/assets/{use-create-virtual-mcp-C1_Payfy.js → use-create-virtual-mcp-CU5jurvg.js} +1 -1
  277. package/dist/client/assets/{use-date-fns-locale-_5ce6Tkl.js → use-date-fns-locale-HpI29w9x.js} +1 -1
  278. package/dist/client/assets/{use-debounced-autosave-BCJQFgee.js → use-debounced-autosave-DU9RFTz4.js} +1 -1
  279. package/dist/client/assets/{use-debounced-value-BPDNjxF7.js → use-debounced-value-nDWnt5ZK.js} +1 -1
  280. package/dist/client/assets/{use-deco-credits-wIj4uY_6.js → use-deco-credits-CyMxZLrr.js} +1 -1
  281. package/dist/client/assets/{use-decopilot-events-rDva76IU.js → use-decopilot-events-BzMJD1uM.js} +1 -1
  282. package/dist/client/assets/{use-delete-connection-Nv78O41P.js → use-delete-connection-Bl4c1YPj.js} +1 -1
  283. package/dist/client/assets/{use-deployment-admin-WMXJxtL_.js → use-deployment-admin-DkNA52w9.js} +1 -1
  284. package/dist/client/assets/{use-entitlements-DyGy57dZ.js → use-entitlements-Cn0i9CW9.js} +1 -1
  285. package/dist/client/assets/{use-fast-preview-draft-url-B4oSTxVH.js → use-fast-preview-draft-url-DATrtbyw.js} +1 -1
  286. package/dist/client/assets/{use-file-configs-CuOK6eKs.js → use-file-configs-qOygMQSr.js} +1 -1
  287. package/dist/client/assets/{use-in-settings-DmCo8sK7.js → use-in-settings-3Ul0bgC9.js} +1 -1
  288. package/dist/client/assets/{use-infinite-scroll-C5Ijv_kf.js → use-infinite-scroll-ffudwWNp.js} +1 -1
  289. package/dist/client/assets/{use-join-requests-CSvzwOGU.js → use-join-requests-B-CBn5QP.js} +1 -1
  290. package/dist/client/assets/{use-main-panel-tabs-DK6Zt-tk.js → use-main-panel-tabs-BdSie_jh.js} +1 -1
  291. package/dist/client/assets/{use-mcp-auth-status-CT_a8aVW.js → use-mcp-auth-status-DUfqqyh_.js} +1 -1
  292. package/dist/client/assets/{use-mcp-client-DfbMfRX0.js → use-mcp-client-DHUKToCF.js} +1 -1
  293. package/dist/client/assets/{use-mcp-prompts-SPo5nqQt.js → use-mcp-prompts-XNz1QP3F.js} +1 -1
  294. package/dist/client/assets/{use-mcp-tools-SgDMtwAo.js → use-mcp-tools-BrHk6dMs.js} +1 -1
  295. package/dist/client/assets/{use-members-HY_2svm-.js → use-members-C0e8Ch84.js} +1 -1
  296. package/dist/client/assets/{use-mobile-BK6fqDjV.js → use-mobile-BtKg9sCJ.js} +1 -1
  297. package/dist/client/assets/{use-navigate-to-agent-CIi6mRK5.js → use-navigate-to-agent-BP7q45Ig.js} +1 -1
  298. package/dist/client/assets/{use-open-billing-url-C-f1VKsu.js → use-open-billing-url-SmRKYeqU.js} +1 -1
  299. package/dist/client/assets/{use-org-auth-client-DYhylMRY.js → use-org-auth-client-CUAseAjF.js} +1 -1
  300. package/dist/client/assets/{use-org-fs-gR481HRW.js → use-org-fs-C9w4twJx.js} +1 -1
  301. package/dist/client/assets/{use-org-repo-syncs-DCvqRKO6.js → use-org-repo-syncs-SLecZyxY.js} +1 -1
  302. package/dist/client/assets/{use-org-sso-DN6Td0La.js → use-org-sso-CaDHtuiG.js} +1 -1
  303. package/dist/client/assets/{use-organization-roles-DdjNqa5L.js → use-organization-roles-G0l1-hZz.js} +1 -1
  304. package/dist/client/assets/{use-organization-settings-BVJz2xHz.js → use-organization-settings-DOMdlLbS.js} +1 -1
  305. package/dist/client/assets/{use-panel-navigate-D7o7QU5a.js → use-panel-navigate-DBjhi95e.js} +1 -1
  306. package/dist/client/assets/{use-project-native-view-presence-D6cW7Bzl.js → use-project-native-view-presence-By_hz6nw.js} +1 -1
  307. package/dist/client/assets/{use-project-scope-CK3AlNLq.js → use-project-scope-DftATVXe.js} +1 -1
  308. package/dist/client/assets/{use-releases-Dh5Oc5QA.js → use-releases-WVhn_3Ue.js} +1 -1
  309. package/dist/client/assets/{use-reports-diagnostic-BM-RDSbB.js → use-reports-diagnostic-DGYxLu-y.js} +1 -1
  310. package/dist/client/assets/{use-route-default-main-D7z11tZk.js → use-route-default-main-C5wxTmxr.js} +1 -1
  311. package/dist/client/assets/{use-secrets-NnQ4avlz.js → use-secrets-DR7tojol.js} +1 -1
  312. package/dist/client/assets/{use-section-preview-base-DObF0usH.js → use-section-preview-base-CxN_FFCZ.js} +1 -1
  313. package/dist/client/assets/{use-session-runtime-xDTntTtH.js → use-session-runtime-CtbaDUFc.js} +1 -1
  314. package/dist/client/assets/{use-tags-C2GVmqtL.js → use-tags-BviJKMQn.js} +1 -1
  315. package/dist/client/assets/{use-task-board-analytics-BJL1hHKP.js → use-task-board-analytics-Dsbzj4O9.js} +1 -1
  316. package/dist/client/assets/{use-task-metadata-B1Jj7tW5.js → use-task-metadata-DgBMJLMR.js} +1 -1
  317. package/dist/client/assets/{use-thread-outputs-BvyTbKSH.js → use-thread-outputs-BDr4rCo1.js} +1 -1
  318. package/dist/client/assets/{use-virtual-mcp-C63LvP7b.js → use-virtual-mcp-BBVFqIjj.js} +1 -1
  319. package/dist/client/assets/useInfiniteQuery-ed3dnyco.js +1 -0
  320. package/dist/client/assets/{useQueries-AJpXrqKZ.js → useQueries-3H-0IIer.js} +1 -1
  321. package/dist/client/assets/useSuspenseInfiniteQuery-CneRNPU7.js +1 -0
  322. package/dist/client/assets/{users-BCsbqUbp.js → users-DwZaHbgK.js} +1 -1
  323. package/dist/client/assets/{utils-BPd6rJkT.js → utils-hYjLEIhA.js} +1 -1
  324. package/dist/client/assets/{variant-calendar-CzdJlwV6.js → variant-calendar-D7y8HdyO.js} +1 -1
  325. package/dist/client/assets/{variant-matcher-override-D_56fN6-.js → variant-matcher-override-BZyxbroG.js} +1 -1
  326. package/dist/client/assets/{view-mode-toggle-CNFzSODY.js → view-mode-toggle-BiwFBJpe.js} +1 -1
  327. package/dist/client/assets/virtual-mcp-CsNXCota.js +1 -0
  328. package/dist/client/index.html +1 -1
  329. package/dist/server/cli.js +2 -2
  330. package/dist/server/server.js +2 -2
  331. package/package.json +1 -1
  332. package/dist/client/assets/agent-app-BK5xv2pD.js +0 -1
  333. package/dist/client/assets/agent-deck-CDadtCMn.js +0 -1
  334. package/dist/client/assets/agent-file-DWSTsIIG.js +0 -1
  335. package/dist/client/assets/agent-library-file-D774aryG.js +0 -1
  336. package/dist/client/assets/agent-settings-BRN4k5Ut.js +0 -1
  337. package/dist/client/assets/agent-site-editor-code-f1kTVpaf.js +0 -2
  338. package/dist/client/assets/agent-view-C0AdAXiv.js +0 -1
  339. package/dist/client/assets/api-keys-BHlM7m1A.js +0 -1
  340. package/dist/client/assets/app-editor-CzstG09T.js +0 -1
  341. package/dist/client/assets/project-reports-9dqN5-6L.js +0 -1
  342. package/dist/client/assets/project-tasks-JsDsbgNO.js +0 -1
  343. package/dist/client/assets/record-editor-DE8927-D.js +0 -1
  344. package/dist/client/assets/reports-C63pGOIK.js +0 -1
  345. package/dist/client/assets/tasks-DwMwPVbq.js +0 -1
  346. package/dist/client/assets/useInfiniteQuery-CNlFN6xT.js +0 -1
  347. package/dist/client/assets/useSuspenseInfiniteQuery-CZaJStWg.js +0 -1
  348. package/dist/client/assets/virtual-mcp-W021Zw27.js +0 -1
@@ -76,7 +76,7 @@ Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.ht
76
76
  However, a future version may change this behavior to prefer the ENV static credentials.
77
77
  Please ensure that your environment only sets either the AWS_PROFILE or the
78
78
  AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY pair.
79
- `),ov1=!0}throw new c90.CredentialsProviderError("AWS_PROFILE is set, skipping fromEnv provider.",{logger:$.logger,tryNextLink:!0})}return $.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromEnv"),Fx0($)()},async(Z)=>{$.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromSSO");let{ssoStartUrl:Q,ssoAccountId:X,ssoRegion:Y,ssoRoleName:J,ssoSession:G}=$;if(!Q&&!X&&!Y&&!J&&!G)throw new c90.CredentialsProviderError("Skipping SSO provider in default chain (inputs do not include SSO fields).",{logger:$.logger});let{fromSSO:W}=await Promise.resolve().then(() => (Pf0(),zf0));return W($)(Z)},async(Z)=>{$.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromIni");let{fromIni:Q}=await Promise.resolve().then(() => (tv1(),nv1));return Q($)(Z)},async(Z)=>{$.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromProcess");let{fromProcess:Q}=await Promise.resolve().then(() => (Ty0(),Ay0));return Q($)(Z)},async(Z)=>{$.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile");let{fromTokenFile:Q}=await Promise.resolve().then(() => (ky0(),Vy0));return Q($)(Z)},async()=>{return $.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::remoteProvider"),(await NI1($))()},async()=>{throw new c90.CredentialsProviderError("Could not load credentials from any providers",{tryNextLink:!1,logger:$.logger})}],Uy8),Uy8=($)=>$?.expiration!==void 0&&$.expiration.getTime()-Date.now()<300000;var sv1=D(()=>{Ux0();BI1();c90=C(k5(),1),rv1=C(fX(),1)});var ev1=D(()=>{sv1()});var $b1=()=>{};var Ug,Ny8="AWS_S3_USE_ARN_REGION",By8="s3_use_arn_region",Zb1;var Qb1=D(()=>{Ug=C(Jp(),1),Zb1={environmentVariableSelector:($)=>Ug.booleanSelector($,Ny8,Ug.SelectorType.ENV),configFileSelector:($)=>Ug.booleanSelector($,By8,Ug.SelectorType.CONFIG),default:void 0}});var Xb1=()=>{};var Yb1=()=>{};var Jb1=D(()=>{$b1();Qb1();Yb1();Xb1()});class Ng{bytes;constructor($){if(this.bytes=$,$.byteLength!==8)throw Error("Int64 buffers must be exactly 8 bytes")}static fromNumber($){if($>9223372036854776000||$<-9223372036854776000)throw Error(`${$} is too large (or, if negative, too small) to represent as an Int64`);let Z=new Uint8Array(8);for(let Q=7,X=Math.abs(Math.round($));Q>-1&&X>0;Q--,X/=256)Z[Q]=X;if($<0)Gb1(Z);return new Ng(Z)}valueOf(){let $=this.bytes.slice(0),Z=$[0]&128;if(Z)Gb1($);return parseInt(Wb1.toHex($),16)*(Z?-1:1)}toString(){return String(this.valueOf())}}function Gb1($){for(let Z=0;Z<8;Z++)$[Z]^=255;for(let Z=7;Z>-1;Z--)if($[Z]++,$[Z]!==0)break}var Wb1;var Cy0=D(()=>{Wb1=C(bi(),1)});class _y0{toUtf8;fromUtf8;constructor($,Z){this.toUtf8=$,this.fromUtf8=Z}format($){let Z=[];for(let Y of Object.keys($)){let J=this.fromUtf8(Y);Z.push(Uint8Array.from([J.byteLength]),J,this.formatHeaderValue($[Y]))}let Q=new Uint8Array(Z.reduce((Y,J)=>Y+J.byteLength,0)),X=0;for(let Y of Z)Q.set(Y,X),X+=Y.byteLength;return Q}formatHeaderValue($){switch($.type){case"boolean":return Uint8Array.from([$.value?0:1]);case"byte":return Uint8Array.from([2,$.value]);case"short":let Z=new DataView(new ArrayBuffer(3));return Z.setUint8(0,3),Z.setInt16(1,$.value,!1),new Uint8Array(Z.buffer);case"integer":let Q=new DataView(new ArrayBuffer(5));return Q.setUint8(0,4),Q.setInt32(1,$.value,!1),new Uint8Array(Q.buffer);case"long":let X=new Uint8Array(9);return X[0]=5,X.set($.value.bytes,1),X;case"binary":let Y=new DataView(new ArrayBuffer(3+$.value.byteLength));Y.setUint8(0,6),Y.setUint16(1,$.value.byteLength,!1);let J=new Uint8Array(Y.buffer);return J.set($.value,3),J;case"string":let G=this.fromUtf8($.value),W=new DataView(new ArrayBuffer(3+G.byteLength));W.setUint8(0,7),W.setUint16(1,G.byteLength,!1);let K=new Uint8Array(W.buffer);return K.set(G,3),K;case"timestamp":let H=new Uint8Array(9);return H[0]=8,H.set(Ng.fromNumber($.value.valueOf()).bytes,1),H;case"uuid":if(!Ay8.test($.value))throw Error(`Invalid UUID received: ${$.value}`);let F=new Uint8Array(17);return F[0]=9,F.set($D.fromHex($.value.replace(/\-/g,"")),1),F}}parse($){let Z={},Q=0;while(Q<$.byteLength){let X=$.getUint8(Q++),Y=this.toUtf8(new Uint8Array($.buffer,$.byteOffset+Q,X));switch(Q+=X,$.getUint8(Q++)){case 0:Z[Y]={type:Hb1,value:!0};break;case 1:Z[Y]={type:Hb1,value:!1};break;case 2:Z[Y]={type:Oy8,value:$.getInt8(Q++)};break;case 3:Z[Y]={type:Dy8,value:$.getInt16(Q,!1)},Q+=2;break;case 4:Z[Y]={type:Ly8,value:$.getInt32(Q,!1)},Q+=4;break;case 5:Z[Y]={type:wy8,value:new Ng(new Uint8Array($.buffer,$.byteOffset+Q,8))},Q+=8;break;case 6:let J=$.getUint16(Q,!1);Q+=2,Z[Y]={type:jy8,value:new Uint8Array($.buffer,$.byteOffset+Q,J)},Q+=J;break;case 7:let G=$.getUint16(Q,!1);Q+=2,Z[Y]={type:Ey8,value:this.toUtf8(new Uint8Array($.buffer,$.byteOffset+Q,G))},Q+=G;break;case 8:Z[Y]={type:zy8,value:new Date(new Ng(new Uint8Array($.buffer,$.byteOffset+Q,8)).valueOf())},Q+=8;break;case 9:let W=new Uint8Array($.buffer,$.byteOffset+Q,16);Q+=16,Z[Y]={type:Py8,value:`${$D.toHex(W.subarray(0,4))}-${$D.toHex(W.subarray(4,6))}-${$D.toHex(W.subarray(6,8))}-${$D.toHex(W.subarray(8,10))}-${$D.toHex(W.subarray(10))}`};break;default:throw Error("Unrecognized header type tag")}}return Z}}var $D,Kb1,Hb1="boolean",Oy8="byte",Dy8="short",Ly8="integer",wy8="long",jy8="binary",Ey8="string",zy8="timestamp",Py8="uuid",Ay8;var vy0=D(()=>{Cy0();$D=C(bi(),1);(function($){$[$.boolTrue=0]="boolTrue",$[$.boolFalse=1]="boolFalse",$[$.byte=2]="byte",$[$.short=3]="short",$[$.integer=4]="integer",$[$.long=5]="long",$[$.byteArray=6]="byteArray",$[$.string=7]="string",$[$.timestamp=8]="timestamp",$[$.uuid=9]="uuid"})(Kb1||(Kb1={}));Ay8=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/});function Nb1({byteLength:$,byteOffset:Z,buffer:Q}){if($<Ty8)throw Error("Provided message too short to accommodate event stream message overhead");let X=new DataView(Q,Z,$),Y=X.getUint32(0,!1);if($!==Y)throw Error("Reported message length does not match received message length");let J=X.getUint32(Ub1,!1),G=X.getUint32(ZD,!1),W=X.getUint32($-sE,!1),K=new Fb1.Crc32().update(new Uint8Array(Q,Z,ZD));if(G!==K.digest())throw Error(`The prelude checksum specified in the message (${G}) does not match the calculated CRC32 checksum (${K.digest()})`);if(K.update(new Uint8Array(Q,Z+ZD,$-(ZD+sE))),W!==K.digest())throw Error(`The message checksum (${K.digest()}) did not match the expected value of ${W}`);return{headers:new DataView(Q,Z+ZD+sE,J),body:new Uint8Array(Q,Z+ZD+sE+J,Y-J-(ZD+sE+sE))}}var Fb1,Ub1=4,ZD,sE=4,Ty8;var Bb1=D(()=>{Fb1=C(jE(),1),ZD=Ub1*2,Ty8=ZD+sE*2});class by0{headerMarshaller;messageBuffer;isEndOfStream;constructor($,Z){this.headerMarshaller=new _y0($,Z),this.messageBuffer=[],this.isEndOfStream=!1}feed($){this.messageBuffer.push(this.decode($))}endOfStream(){this.isEndOfStream=!0}getMessage(){let $=this.messageBuffer.pop(),Z=this.isEndOfStream;return{getMessage(){return $},isEndOfStream(){return Z}}}getAvailableMessages(){let $=this.messageBuffer;this.messageBuffer=[];let Z=this.isEndOfStream;return{getMessages(){return $},isEndOfStream(){return Z}}}encode({headers:$,body:Z}){let Q=this.headerMarshaller.format($),X=Q.byteLength+Z.byteLength+16,Y=new Uint8Array(X),J=new DataView(Y.buffer,Y.byteOffset,Y.byteLength),G=new Ob1.Crc32;return J.setUint32(0,X,!1),J.setUint32(4,Q.byteLength,!1),J.setUint32(8,G.update(Y.subarray(0,8)).digest(),!1),Y.set(Q,12),Y.set(Z,Q.byteLength+12),J.setUint32(X-4,G.update(Y.subarray(8,X-4)).digest(),!1),Y}decode($){let{headers:Z,body:Q}=Nb1($);return{headers:this.headerMarshaller.parse(Z),body:Q}}formatHeaders($){return this.headerMarshaller.format($)}}var Ob1;var Db1=D(()=>{vy0();Bb1();Ob1=C(jE(),1)});var Lb1=()=>{};var xy0;var wb1=D(()=>{xy0=class xy0{options;constructor($){this.options=$}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let $ of this.options.inputStream)yield this.options.decoder.decode($)}}});var fy0;var jb1=D(()=>{fy0=class fy0{options;constructor($){this.options=$}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let $ of this.options.messageStream)yield this.options.encoder.encode($);if(this.options.includeEndFrame)yield new Uint8Array(0)}}});var yy0;var Eb1=D(()=>{yy0=class yy0{options;constructor($){this.options=$}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let $ of this.options.messageStream){let Z=await this.options.deserializer($);if(Z===void 0)continue;yield Z}}}});var gy0;var zb1=D(()=>{gy0=class gy0{options;constructor($){this.options=$}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let $ of this.options.inputStream)yield this.options.serializer($)}}});var Pb1=D(()=>{Db1();vy0();Cy0();Lb1();wb1();jb1();Eb1();zb1()});function Ab1($){let Z=0,Q=0,X=null,Y=null,J=(W)=>{if(typeof W!=="number")throw Error("Attempted to allocate an event message where size was not a number: "+W);Z=W,Q=4,X=new Uint8Array(W),new DataView(X.buffer).setUint32(0,W,!1)},G=async function*(){let W=$[Symbol.asyncIterator]();while(!0){let{value:K,done:H}=await W.next();if(H){if(!Z)return;else if(Z===Q)yield X;else throw Error("Truncated event message received.");return}let F=K.length,U=0;while(U<F){if(!X){let B=F-U;if(!Y)Y=new Uint8Array(4);let O=Math.min(4-Q,B);if(Y.set(K.slice(U,U+O),Q),Q+=O,U+=O,Q<4)break;J(new DataView(Y.buffer).getUint32(0,!1)),Y=null}let N=Math.min(Z-Q,F-U);if(X.set(K.slice(U,U+N),Q),Q+=N,U+=N,Z&&Z===Q)yield X,X=null,Z=0,Q=0}}};return{[Symbol.asyncIterator]:G}}function Tb1($,Z){return async function(Q){let{value:X}=Q.headers[":message-type"];if(X==="error"){let Y=Error(Q.headers[":error-message"].value||"UnknownError");throw Y.name=Q.headers[":error-code"].value,Y}else if(X==="exception"){let Y=Q.headers[":exception-type"].value,J={[Y]:Q},G=await $(J);if(G.$unknown){let W=Error(Z(Q.body));throw W.name=Y,W}throw G[Y]}else if(X==="event"){let Y={[Q.headers[":event-type"].value]:Q},J=await $(Y);if(J.$unknown)return;return J}else throw Error(`Unrecognizable event type: ${Q.headers[":event-type"].value}`)}}class hy0{eventStreamCodec;utfEncoder;constructor({utf8Encoder:$,utf8Decoder:Z}){this.eventStreamCodec=new by0($,Z),this.utfEncoder=$}deserialize($,Z){let Q=Ab1($);return new yy0({messageStream:new xy0({inputStream:Q,decoder:this.eventStreamCodec}),deserializer:Tb1(Z,this.utfEncoder)})}serialize($,Z){return new fy0({messageStream:new gy0({inputStream:$,serializer:Z}),encoder:this.eventStreamCodec,includeEndFrame:!0})}}var Rb1=D(()=>{Pb1()});var qb1=()=>{};var Mb1=D(()=>{Rb1();qb1()});async function*Ib1($){let Z=!1,Q=!1,X=[];$.on("error",(Y)=>{if(!Z)Z=!0;if(Y)throw Y}),$.on("data",(Y)=>{X.push(Y)}),$.on("end",()=>{Z=!0});while(!Q){let Y=await new Promise((J)=>setTimeout(()=>J(X.shift()),0));if(Y)yield Y;Q=Z&&X.length===0}}import{Readable as Ry8}from"stream";class uy0{universalMarshaller;constructor({utf8Encoder:$,utf8Decoder:Z}){this.universalMarshaller=new hy0({utf8Decoder:Z,utf8Encoder:$})}deserialize($,Z){let Q=typeof $[Symbol.asyncIterator]==="function"?$:Ib1($);return this.universalMarshaller.deserialize(Q,Z)}serialize($,Z){return Ry8.from(this.universalMarshaller.serialize($,Z))}}var ly0=D(()=>{Mb1()});var Vb1=($)=>new uy0($);var kb1=D(()=>{ly0()});var Sb1=D(()=>{ly0();kb1()});import{Writable as qy8}from"stream";var Cb1,cy0;var _b1=D(()=>{Cb1=C(ZQ(),1);cy0=class cy0 extends qy8{hash;constructor($,Z){super(Z);this.hash=$}_write($,Z,Q){try{this.hash.update(Cb1.toUint8Array($))}catch(X){return Q(X)}Q()}}});var vb1=()=>{};var bb1=($,Z)=>{if(Z.readableFlowing!==null)throw Error("Unable to calculate hash for flowing readable stream");let Q=new $,X=new cy0(Q);return Z.pipe(X),new Promise((Y,J)=>{Z.on("error",(G)=>{X.end(),J(G)}),X.on("error",J),X.on("finish",()=>{Q.digest().then(Y).catch(J)})})};var xb1=D(()=>{_b1()});var fb1=D(()=>{vb1();xb1()});var d90,yb1,gb1,hb1,ub1,m90,i90,p90,lb1=($)=>{return{apiVersion:"2006-03-01",base64Decoder:$?.base64Decoder??m90.fromBase64,base64Encoder:$?.base64Encoder??m90.toBase64,disableHostPrefix:$?.disableHostPrefix??!1,endpointProvider:$?.endpointProvider??T50,extensions:$?.extensions??[],getAwsChunkedEncodingStream:$?.getAwsChunkedEncodingStream??i90.getAwsChunkedEncodingStream,httpAuthSchemeProvider:$?.httpAuthSchemeProvider??m21,httpAuthSchemes:$?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(Z)=>Z.getIdentityProvider("aws.auth#sigv4"),signer:new d90.AwsSdkSigV4Signer},{schemeId:"aws.auth#sigv4a",identityProvider:(Z)=>Z.getIdentityProvider("aws.auth#sigv4a"),signer:new d90.AwsSdkSigV4ASigner}],logger:$?.logger??new hb1.NoOpLogger,protocol:$?.protocol??yb1.S3RestXmlProtocol,protocolSettings:$?.protocolSettings??{defaultNamespace:"com.amazonaws.s3",errorTypeRegistries:r21,xmlNamespace:"http://s3.amazonaws.com/doc/2006-03-01/",version:"2006-03-01",serviceTarget:"AmazonS3"},sdkStreamMixin:$?.sdkStreamMixin??i90.sdkStreamMixin,serviceId:$?.serviceId??"S3",signerConstructor:$?.signerConstructor??gb1.SignatureV4MultiRegion,signingEscapePath:$?.signingEscapePath??!1,urlParser:$?.urlParser??ub1.parseUrl,useArnRegion:$?.useArnRegion??void 0,utf8Decoder:$?.utf8Decoder??p90.fromUtf8,utf8Encoder:$?.utf8Encoder??p90.toUtf8}};var cb1=D(()=>{ab0();rb0();G1();d90=C(dQ(),1),yb1=C(Z$(),1),gb1=C(iy(),1),hb1=C(m0(),1),ub1=C(zH(),1),m90=C(IY(),1),i90=C(jy(),1),p90=C(ZQ(),1)});var db1,t90,mb1,o90,QD,n90,r90,oJ,a90,s90,ib1,pb1,nb1,tb1=($)=>{s90.emitWarningIfUnsupportedVersion(process.version);let Z=pb1.resolveDefaultsModeConfig($),Q=()=>Z().then(s90.loadConfigsForDefaultMode),X=lb1($);db1.emitWarningIfUnsupportedVersion(process.version);let Y={profile:$?.profile,logger:X.logger};return{...X,...$,runtime:"node",defaultsMode:Z,authSchemePreference:$?.authSchemePreference??oJ.loadConfig(t90.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS,Y),bodyLengthChecker:$?.bodyLengthChecker??ib1.calculateBodyLength,credentialDefaultProvider:$?.credentialDefaultProvider??av1,defaultUserAgentProvider:$?.defaultUserAgentProvider??o90.createDefaultUserAgentProvider({serviceId:X.serviceId,clientVersion:MM1.version}),disableS3ExpressSessionAuth:$?.disableS3ExpressSessionAuth??oJ.loadConfig(mb1.NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS,Y),eventStreamSerdeProvider:$?.eventStreamSerdeProvider??Vb1,maxAttempts:$?.maxAttempts??oJ.loadConfig(r90.NODE_MAX_ATTEMPT_CONFIG_OPTIONS,$),md5:$?.md5??n90.Hash.bind(null,"md5"),region:$?.region??oJ.loadConfig(QD.NODE_REGION_CONFIG_OPTIONS,{...QD.NODE_REGION_CONFIG_FILE_OPTIONS,...Y}),requestChecksumCalculation:$?.requestChecksumCalculation??oJ.loadConfig(xD1,Y),requestHandler:a90.NodeHttpHandler.create($?.requestHandler??Q),responseChecksumValidation:$?.responseChecksumValidation??oJ.loadConfig(yD1,Y),retryMode:$?.retryMode??oJ.loadConfig({...r90.NODE_RETRY_MODE_CONFIG_OPTIONS,default:async()=>(await Q()).retryMode||nb1.DEFAULT_RETRY_MODE},$),sha1:$?.sha1??n90.Hash.bind(null,"sha1"),sha256:$?.sha256??n90.Hash.bind(null,"sha256"),sigv4aSigningRegionSet:$?.sigv4aSigningRegionSet??oJ.loadConfig(t90.NODE_SIGV4A_CONFIG_OPTIONS,Y),streamCollector:$?.streamCollector??a90.streamCollector,streamHasher:$?.streamHasher??bb1,useArnRegion:$?.useArnRegion??oJ.loadConfig(Zb1,Y),useDualstackEndpoint:$?.useDualstackEndpoint??oJ.loadConfig(QD.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,Y),useFipsEndpoint:$?.useFipsEndpoint??oJ.loadConfig(QD.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,Y),userAgentAppId:$?.userAgentAppId??oJ.loadConfig(o90.NODE_APP_ID_CONFIG_OPTIONS,Y)}};var ob1=D(()=>{qM1();ev1();Jb1();L6();Sb1();fb1();cb1();db1=C(s5(),1),t90=C(dQ(),1),mb1=C(Z$(),1),o90=C(sy(),1),QD=C(SY(),1),n90=C(ey(),1),r90=C(yW(),1),oJ=C(fW(),1),a90=C(vO(),1),s90=C(m0(),1),ib1=C($g(),1),pb1=C(Zg(),1),nb1=C(mU(),1)});var rb1=($)=>{let{httpAuthSchemes:Z,httpAuthSchemeProvider:Q,credentials:X}=$;return{setHttpAuthScheme(Y){let J=Z.findIndex((G)=>G.schemeId===Y.schemeId);if(J===-1)Z.push(Y);else Z.splice(J,1,Y)},httpAuthSchemes(){return Z},setHttpAuthSchemeProvider(Y){Q=Y},httpAuthSchemeProvider(){return Q},setCredentials(Y){X=Y},credentials(){return X}}},ab1=($)=>{return{httpAuthSchemes:$.httpAuthSchemes(),httpAuthSchemeProvider:$.httpAuthSchemeProvider(),credentials:$.credentials()}};var e90,$Z0,ZZ0,sb1=($,Z)=>{let Q=Object.assign(e90.getAwsRegionExtensionConfiguration($),ZZ0.getDefaultExtensionConfiguration($),$Z0.getHttpHandlerExtensionConfiguration($),rb1($));return Z.forEach((X)=>X.configure(Q)),Object.assign($,e90.resolveAwsRegionExtensionConfiguration(Q),ZZ0.resolveDefaultRuntimeConfig(Q),$Z0.resolveHttpHandlerRuntimeConfig(Q),ab1(Q))};var eb1=D(()=>{e90=C(xE(),1),$Z0=C(V5(),1),ZZ0=C(m0(),1)});var QZ0,$x1,Zx1,qH,XZ0,Qx1,Bg,Xx1,Yx1,Jx1,YZ0,Gx1,hX;var eE=D(()=>{vD1();L6();gA1();ab0();c50();K1();ob1();eb1();QZ0=C(Ry(),1),$x1=C(qy(),1),Zx1=C(My(),1),qH=C(Z$(),1),XZ0=C(kE(),1),Qx1=C(SY(),1),Bg=C(sZ(),1),Xx1=C(uQ(),1),Yx1=C(ly(),1),Jx1=C(Y1(),1),YZ0=C(yW(),1),Gx1=C(m0(),1);hX=class hX extends Gx1.Client{config;constructor(...[$]){let Z=tb1($||{});super(Z);this.initConfig=Z;let Q=p21(Z),X=XZ0.resolveUserAgentConfig(Q),Y=FE1(X),J=YZ0.resolveRetryConfig(Y),G=Qx1.resolveRegionConfig(J),W=QZ0.resolveHostHeaderConfig(G),K=Jx1.resolveEndpointConfig(W),H=yA1(K),F=i21(H),U=qH.resolveS3Config(F,{session:[()=>this,wp]}),N=sb1(U,$?.extensions||[]);this.config=N,this.middlewareStack.use(Xx1.getSchemaSerdePlugin(this.config)),this.middlewareStack.use(XZ0.getUserAgentPlugin(this.config)),this.middlewareStack.use(YZ0.getRetryPlugin(this.config)),this.middlewareStack.use(Yx1.getContentLengthPlugin(this.config)),this.middlewareStack.use(QZ0.getHostHeaderPlugin(this.config)),this.middlewareStack.use($x1.getLoggerPlugin(this.config)),this.middlewareStack.use(Zx1.getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(Bg.getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:l21,identityProviderConfigProvider:async(B)=>new Bg.DefaultIdentityProviderConfig({"aws.auth#sigv4":B.credentials,"aws.auth#sigv4a":B.credentials})})),this.middlewareStack.use(Bg.getHttpSigningPlugin(this.config)),this.middlewareStack.use(qH.getValidateBucketNamePlugin(this.config)),this.middlewareStack.use(_D1(this.config)),this.middlewareStack.use(qH.getRegionRedirectMiddlewarePlugin(this.config)),this.middlewareStack.use(qH.getS3ExpressPlugin(this.config)),this.middlewareStack.use(qH.getS3ExpressHttpSigningPlugin(this.config))}destroy(){super.destroy()}}});var Wx1,Kx1,Hx1,gp;var dy0=D(()=>{K1();G1();Wx1=C(Z$(),1),Kx1=C(Y1(),1),Hx1=C(m0(),1);gp=class gp extends Hx1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[Kx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Wx1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","AbortMultipartUpload",{}).n("S3Client","AbortMultipartUploadCommand").sc(TR1).build(){}});function My8($){return(Z)=>async(Q)=>{let X={...Q.input},Y=[{target:"SSECustomerKey",hash:"SSECustomerKeyMD5"},{target:"CopySourceSSECustomerKey",hash:"CopySourceSSECustomerKeyMD5"}];for(let J of Y){let G=X[J.target];if(G){let W;if(typeof G==="string")if(Vy8(G,$))W=$.base64Decoder(G);else W=$.utf8Decoder(G),X[J.target]=$.base64Encoder(W);else W=ArrayBuffer.isView(G)?new Uint8Array(G.buffer,G.byteOffset,G.byteLength):new Uint8Array(G),X[J.target]=$.base64Encoder(W);let K=new $.md5;K.update(W),X[J.hash]=$.base64Encoder(await K.digest())}}return Z({...Q,input:X})}}function Vy8($,Z){if(!/^(?:[A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test($))return!1;try{return Z.base64Decoder($).length===32}catch{return!1}}var Iy8,i9=($)=>({applyToStack:(Z)=>{Z.add(My8($),Iy8)}});var F3=D(()=>{Iy8={name:"ssecMiddleware",step:"initialize",tags:["SSE"],override:!0}});var Fx1,Ux1,Nx1,hp;var my0=D(()=>{F3();K1();G1();Fx1=C(Z$(),1),Ux1=C(Y1(),1),Nx1=C(m0(),1);hp=class hp extends Nx1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[Ux1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Fx1.getThrow200ExceptionsPlugin(Q),i9(Q)]}).s("AmazonS3","CompleteMultipartUpload",{}).n("S3Client","CompleteMultipartUploadCommand").sc(RR1).build(){}});var Bx1,Ox1,Dx1,iy0;var py0=D(()=>{F3();K1();G1();Bx1=C(Z$(),1),Ox1=C(Y1(),1),Dx1=C(m0(),1);iy0=class iy0 extends Dx1.Command.classBuilder().ep({...B0,DisableS3ExpressSessionAuth:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"},CopySource:{type:"contextParams",name:"CopySource"}}).m(function($,Z,Q,X){return[Ox1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Bx1.getThrow200ExceptionsPlugin(Q),i9(Q)]}).s("AmazonS3","CopyObject",{}).n("S3Client","CopyObjectCommand").sc(qR1).build(){}});function ky8($){return(Z)=>async(Q)=>{let{CreateBucketConfiguration:X}=Q.input,Y=await $.region();if(!X?.LocationConstraint&&!X?.Location){if(Y!=="us-east-1")Q.input.CreateBucketConfiguration=Q.input.CreateBucketConfiguration??{},Q.input.CreateBucketConfiguration.LocationConstraint=Y}return Z(Q)}}var Sy8,Lx1=($)=>({applyToStack:(Z)=>{Z.add(ky8($),Sy8)}});var wx1=D(()=>{Sy8={step:"initialize",tags:["LOCATION_CONSTRAINT","CREATE_BUCKET_CONFIGURATION"],name:"locationConstraintMiddleware",override:!0}});var jx1,Ex1,zx1,ny0;var ty0=D(()=>{wx1();K1();G1();jx1=C(Z$(),1),Ex1=C(Y1(),1),zx1=C(m0(),1);ny0=class ny0 extends zx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},DisableAccessPoints:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Ex1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),jx1.getThrow200ExceptionsPlugin(Q),Lx1(Q)]}).s("AmazonS3","CreateBucket",{}).n("S3Client","CreateBucketCommand").sc(MR1).build(){}});var Px1,Ax1,oy0;var ry0=D(()=>{L6();K1();G1();Px1=C(Y1(),1),Ax1=C(m0(),1);oy0=class oy0 extends Ax1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Px1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","CreateBucketMetadataConfiguration",{}).n("S3Client","CreateBucketMetadataConfigurationCommand").sc(IR1).build(){}});var Tx1,Rx1,ay0;var sy0=D(()=>{L6();K1();G1();Tx1=C(Y1(),1),Rx1=C(m0(),1);ay0=class ay0 extends Rx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Tx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","CreateBucketMetadataTableConfiguration",{}).n("S3Client","CreateBucketMetadataTableConfigurationCommand").sc(VR1).build(){}});var qx1,Mx1,Ix1,up;var ey0=D(()=>{F3();K1();G1();qx1=C(Z$(),1),Mx1=C(Y1(),1),Ix1=C(m0(),1);up=class up extends Ix1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[Mx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),qx1.getThrow200ExceptionsPlugin(Q),i9(Q)]}).s("AmazonS3","CreateMultipartUpload",{}).n("S3Client","CreateMultipartUploadCommand").sc(kR1).build(){}});var Vx1,kx1,$g0;var Zg0=D(()=>{K1();G1();Vx1=C(Y1(),1),kx1=C(m0(),1);$g0=class $g0 extends kx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Vx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketAnalyticsConfiguration",{}).n("S3Client","DeleteBucketAnalyticsConfigurationCommand").sc(_R1).build(){}});var Sx1,Cx1,Qg0;var Xg0=D(()=>{K1();G1();Sx1=C(Y1(),1),Cx1=C(m0(),1);Qg0=class Qg0 extends Cx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Sx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucket",{}).n("S3Client","DeleteBucketCommand").sc(CR1).build(){}});var _x1,vx1,Yg0;var Jg0=D(()=>{K1();G1();_x1=C(Y1(),1),vx1=C(m0(),1);Yg0=class Yg0 extends vx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[_x1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketCors",{}).n("S3Client","DeleteBucketCorsCommand").sc(vR1).build(){}});var bx1,xx1,Gg0;var Wg0=D(()=>{K1();G1();bx1=C(Y1(),1),xx1=C(m0(),1);Gg0=class Gg0 extends xx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[bx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketEncryption",{}).n("S3Client","DeleteBucketEncryptionCommand").sc(bR1).build(){}});var fx1,yx1,Kg0;var Hg0=D(()=>{K1();G1();fx1=C(Y1(),1),yx1=C(m0(),1);Kg0=class Kg0 extends yx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[fx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketIntelligentTieringConfiguration",{}).n("S3Client","DeleteBucketIntelligentTieringConfigurationCommand").sc(xR1).build(){}});var gx1,hx1,Fg0;var Ug0=D(()=>{K1();G1();gx1=C(Y1(),1),hx1=C(m0(),1);Fg0=class Fg0 extends hx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[gx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketInventoryConfiguration",{}).n("S3Client","DeleteBucketInventoryConfigurationCommand").sc(fR1).build(){}});var ux1,lx1,Ng0;var Bg0=D(()=>{K1();G1();ux1=C(Y1(),1),lx1=C(m0(),1);Ng0=class Ng0 extends lx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[ux1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketLifecycle",{}).n("S3Client","DeleteBucketLifecycleCommand").sc(yR1).build(){}});var cx1,dx1,Og0;var Dg0=D(()=>{K1();G1();cx1=C(Y1(),1),dx1=C(m0(),1);Og0=class Og0 extends dx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[cx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketMetadataConfiguration",{}).n("S3Client","DeleteBucketMetadataConfigurationCommand").sc(gR1).build(){}});var mx1,ix1,Lg0;var wg0=D(()=>{K1();G1();mx1=C(Y1(),1),ix1=C(m0(),1);Lg0=class Lg0 extends ix1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[mx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketMetadataTableConfiguration",{}).n("S3Client","DeleteBucketMetadataTableConfigurationCommand").sc(hR1).build(){}});var px1,nx1,jg0;var Eg0=D(()=>{K1();G1();px1=C(Y1(),1),nx1=C(m0(),1);jg0=class jg0 extends nx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[px1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketMetricsConfiguration",{}).n("S3Client","DeleteBucketMetricsConfigurationCommand").sc(uR1).build(){}});var tx1,ox1,zg0;var Pg0=D(()=>{K1();G1();tx1=C(Y1(),1),ox1=C(m0(),1);zg0=class zg0 extends ox1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[tx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketOwnershipControls",{}).n("S3Client","DeleteBucketOwnershipControlsCommand").sc(lR1).build(){}});var rx1,ax1,Ag0;var Tg0=D(()=>{K1();G1();rx1=C(Y1(),1),ax1=C(m0(),1);Ag0=class Ag0 extends ax1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[rx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketPolicy",{}).n("S3Client","DeleteBucketPolicyCommand").sc(cR1).build(){}});var sx1,ex1,Rg0;var qg0=D(()=>{K1();G1();sx1=C(Y1(),1),ex1=C(m0(),1);Rg0=class Rg0 extends ex1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[sx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketReplication",{}).n("S3Client","DeleteBucketReplicationCommand").sc(dR1).build(){}});var $f1,Zf1,Mg0;var Ig0=D(()=>{K1();G1();$f1=C(Y1(),1),Zf1=C(m0(),1);Mg0=class Mg0 extends Zf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[$f1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketTagging",{}).n("S3Client","DeleteBucketTaggingCommand").sc(mR1).build(){}});var Qf1,Xf1,Vg0;var kg0=D(()=>{K1();G1();Qf1=C(Y1(),1),Xf1=C(m0(),1);Vg0=class Vg0 extends Xf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Qf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketWebsite",{}).n("S3Client","DeleteBucketWebsiteCommand").sc(iR1).build(){}});var Yf1,Jf1,Gf1,$z;var Sg0=D(()=>{K1();G1();Yf1=C(Z$(),1),Jf1=C(Y1(),1),Gf1=C(m0(),1);$z=class $z extends Gf1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[Jf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Yf1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","DeleteObject",{}).n("S3Client","DeleteObjectCommand").sc(pR1).build(){}});var Wf1,Kf1,Hf1,Cg0;var _g0=D(()=>{L6();K1();G1();Wf1=C(Z$(),1),Kf1=C(Y1(),1),Hf1=C(m0(),1);Cg0=class Cg0 extends Hf1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Kf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0}),Wf1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","DeleteObjects",{}).n("S3Client","DeleteObjectsCommand").sc(nR1).build(){}});var Ff1,Uf1,Nf1,vg0;var bg0=D(()=>{K1();G1();Ff1=C(Z$(),1),Uf1=C(Y1(),1),Nf1=C(m0(),1);vg0=class vg0 extends Nf1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Uf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Ff1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","DeleteObjectTagging",{}).n("S3Client","DeleteObjectTaggingCommand").sc(tR1).build(){}});var Bf1,Of1,xg0;var fg0=D(()=>{K1();G1();Bf1=C(Y1(),1),Of1=C(m0(),1);xg0=class xg0 extends Of1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Bf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeletePublicAccessBlock",{}).n("S3Client","DeletePublicAccessBlockCommand").sc(oR1).build(){}});var Df1,Lf1,wf1,yg0;var gg0=D(()=>{K1();G1();Df1=C(Z$(),1),Lf1=C(Y1(),1),wf1=C(m0(),1);yg0=class yg0 extends wf1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Lf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Df1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketAbac",{}).n("S3Client","GetBucketAbacCommand").sc(rR1).build(){}});var jf1,Ef1,zf1,hg0;var ug0=D(()=>{K1();G1();jf1=C(Z$(),1),Ef1=C(Y1(),1),zf1=C(m0(),1);hg0=class hg0 extends zf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Ef1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),jf1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketAccelerateConfiguration",{}).n("S3Client","GetBucketAccelerateConfigurationCommand").sc(aR1).build(){}});var Pf1,Af1,Tf1,lg0;var cg0=D(()=>{K1();G1();Pf1=C(Z$(),1),Af1=C(Y1(),1),Tf1=C(m0(),1);lg0=class lg0 extends Tf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Af1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Pf1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketAcl",{}).n("S3Client","GetBucketAclCommand").sc(sR1).build(){}});var Rf1,qf1,Mf1,dg0;var mg0=D(()=>{K1();G1();Rf1=C(Z$(),1),qf1=C(Y1(),1),Mf1=C(m0(),1);dg0=class dg0 extends Mf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[qf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Rf1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketAnalyticsConfiguration",{}).n("S3Client","GetBucketAnalyticsConfigurationCommand").sc(eR1).build(){}});var If1,Vf1,kf1,ig0;var pg0=D(()=>{K1();G1();If1=C(Z$(),1),Vf1=C(Y1(),1),kf1=C(m0(),1);ig0=class ig0 extends kf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Vf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),If1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketCors",{}).n("S3Client","GetBucketCorsCommand").sc($q1).build(){}});var Sf1,Cf1,_f1,ng0;var tg0=D(()=>{K1();G1();Sf1=C(Z$(),1),Cf1=C(Y1(),1),_f1=C(m0(),1);ng0=class ng0 extends _f1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Cf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Sf1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketEncryption",{}).n("S3Client","GetBucketEncryptionCommand").sc(Zq1).build(){}});var vf1,bf1,xf1,og0;var rg0=D(()=>{K1();G1();vf1=C(Z$(),1),bf1=C(Y1(),1),xf1=C(m0(),1);og0=class og0 extends xf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[bf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),vf1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketIntelligentTieringConfiguration",{}).n("S3Client","GetBucketIntelligentTieringConfigurationCommand").sc(Qq1).build(){}});var ff1,yf1,gf1,ag0;var sg0=D(()=>{K1();G1();ff1=C(Z$(),1),yf1=C(Y1(),1),gf1=C(m0(),1);ag0=class ag0 extends gf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[yf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),ff1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketInventoryConfiguration",{}).n("S3Client","GetBucketInventoryConfigurationCommand").sc(Xq1).build(){}});var hf1,uf1,lf1,eg0;var $h0=D(()=>{K1();G1();hf1=C(Z$(),1),uf1=C(Y1(),1),lf1=C(m0(),1);eg0=class eg0 extends lf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[uf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),hf1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketLifecycleConfiguration",{}).n("S3Client","GetBucketLifecycleConfigurationCommand").sc(Yq1).build(){}});var cf1,df1,mf1,Zh0;var Qh0=D(()=>{K1();G1();cf1=C(Z$(),1),df1=C(Y1(),1),mf1=C(m0(),1);Zh0=class Zh0 extends mf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[df1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),cf1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketLocation",{}).n("S3Client","GetBucketLocationCommand").sc(Jq1).build(){}});var if1,pf1,nf1,Xh0;var Yh0=D(()=>{K1();G1();if1=C(Z$(),1),pf1=C(Y1(),1),nf1=C(m0(),1);Xh0=class Xh0 extends nf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[pf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),if1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketLogging",{}).n("S3Client","GetBucketLoggingCommand").sc(Gq1).build(){}});var tf1,of1,rf1,Jh0;var Gh0=D(()=>{K1();G1();tf1=C(Z$(),1),of1=C(Y1(),1),rf1=C(m0(),1);Jh0=class Jh0 extends rf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[of1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),tf1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketMetadataConfiguration",{}).n("S3Client","GetBucketMetadataConfigurationCommand").sc(Wq1).build(){}});var af1,sf1,ef1,Wh0;var Kh0=D(()=>{K1();G1();af1=C(Z$(),1),sf1=C(Y1(),1),ef1=C(m0(),1);Wh0=class Wh0 extends ef1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[sf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),af1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketMetadataTableConfiguration",{}).n("S3Client","GetBucketMetadataTableConfigurationCommand").sc(Kq1).build(){}});var $y1,Zy1,Qy1,Hh0;var Fh0=D(()=>{K1();G1();$y1=C(Z$(),1),Zy1=C(Y1(),1),Qy1=C(m0(),1);Hh0=class Hh0 extends Qy1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Zy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),$y1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketMetricsConfiguration",{}).n("S3Client","GetBucketMetricsConfigurationCommand").sc(Hq1).build(){}});var Xy1,Yy1,Jy1,Uh0;var Nh0=D(()=>{K1();G1();Xy1=C(Z$(),1),Yy1=C(Y1(),1),Jy1=C(m0(),1);Uh0=class Uh0 extends Jy1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Yy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Xy1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketNotificationConfiguration",{}).n("S3Client","GetBucketNotificationConfigurationCommand").sc(Fq1).build(){}});var Gy1,Wy1,Ky1,Bh0;var Oh0=D(()=>{K1();G1();Gy1=C(Z$(),1),Wy1=C(Y1(),1),Ky1=C(m0(),1);Bh0=class Bh0 extends Ky1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Wy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Gy1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketOwnershipControls",{}).n("S3Client","GetBucketOwnershipControlsCommand").sc(Uq1).build(){}});var Hy1,Fy1,Dh0;var Lh0=D(()=>{K1();G1();Hy1=C(Y1(),1),Fy1=C(m0(),1);Dh0=class Dh0 extends Fy1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Hy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","GetBucketPolicy",{}).n("S3Client","GetBucketPolicyCommand").sc(Nq1).build(){}});var Uy1,Ny1,By1,wh0;var jh0=D(()=>{K1();G1();Uy1=C(Z$(),1),Ny1=C(Y1(),1),By1=C(m0(),1);wh0=class wh0 extends By1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Ny1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Uy1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketPolicyStatus",{}).n("S3Client","GetBucketPolicyStatusCommand").sc(Bq1).build(){}});var Oy1,Dy1,Ly1,Eh0;var zh0=D(()=>{K1();G1();Oy1=C(Z$(),1),Dy1=C(Y1(),1),Ly1=C(m0(),1);Eh0=class Eh0 extends Ly1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Dy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Oy1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketReplication",{}).n("S3Client","GetBucketReplicationCommand").sc(Oq1).build(){}});var wy1,jy1,Ey1,Ph0;var Ah0=D(()=>{K1();G1();wy1=C(Z$(),1),jy1=C(Y1(),1),Ey1=C(m0(),1);Ph0=class Ph0 extends Ey1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[jy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),wy1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketRequestPayment",{}).n("S3Client","GetBucketRequestPaymentCommand").sc(Dq1).build(){}});var zy1,Py1,Ay1,Th0;var Rh0=D(()=>{K1();G1();zy1=C(Z$(),1),Py1=C(Y1(),1),Ay1=C(m0(),1);Th0=class Th0 extends Ay1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Py1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),zy1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketTagging",{}).n("S3Client","GetBucketTaggingCommand").sc(Lq1).build(){}});var Ty1,Ry1,qy1,qh0;var Mh0=D(()=>{K1();G1();Ty1=C(Z$(),1),Ry1=C(Y1(),1),qy1=C(m0(),1);qh0=class qh0 extends qy1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Ry1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Ty1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketVersioning",{}).n("S3Client","GetBucketVersioningCommand").sc(wq1).build(){}});var My1,Iy1,Vy1,Ih0;var Vh0=D(()=>{K1();G1();My1=C(Z$(),1),Iy1=C(Y1(),1),Vy1=C(m0(),1);Ih0=class Ih0 extends Vy1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Iy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),My1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketWebsite",{}).n("S3Client","GetBucketWebsiteCommand").sc(jq1).build(){}});var ky1,Sy1,Cy1,kh0;var Sh0=D(()=>{K1();G1();ky1=C(Z$(),1),Sy1=C(Y1(),1),Cy1=C(m0(),1);kh0=class kh0 extends Cy1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[Sy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),ky1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetObjectAcl",{}).n("S3Client","GetObjectAclCommand").sc(zq1).build(){}});var _y1,vy1,by1,Ch0;var _h0=D(()=>{F3();K1();G1();_y1=C(Z$(),1),vy1=C(Y1(),1),by1=C(m0(),1);Ch0=class Ch0 extends by1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[vy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),_y1.getThrow200ExceptionsPlugin(Q),i9(Q)]}).s("AmazonS3","GetObjectAttributes",{}).n("S3Client","GetObjectAttributesCommand").sc(Pq1).build(){}});var xy1,fy1,yy1,XD;var vh0=D(()=>{L6();F3();K1();G1();xy1=C(Z$(),1),fy1=C(Y1(),1),yy1=C(m0(),1);XD=class XD extends yy1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[fy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestChecksumRequired:!1,requestValidationModeMember:"ChecksumMode",responseAlgorithms:["CRC64NVME","CRC32","CRC32C","SHA256","SHA1","SHA512","MD5","XXHASH64","XXHASH3","XXHASH128"]}),i9(Q),xy1.getS3ExpiresMiddlewarePlugin(Q)]}).s("AmazonS3","GetObject",{}).n("S3Client","GetObjectCommand").sc(Eq1).build(){}});var gy1,hy1,uy1,bh0;var xh0=D(()=>{K1();G1();gy1=C(Z$(),1),hy1=C(Y1(),1),uy1=C(m0(),1);bh0=class bh0 extends uy1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[hy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),gy1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetObjectLegalHold",{}).n("S3Client","GetObjectLegalHoldCommand").sc(Aq1).build(){}});var ly1,cy1,dy1,fh0;var yh0=D(()=>{K1();G1();ly1=C(Z$(),1),cy1=C(Y1(),1),dy1=C(m0(),1);fh0=class fh0 extends dy1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[cy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),ly1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetObjectLockConfiguration",{}).n("S3Client","GetObjectLockConfigurationCommand").sc(Tq1).build(){}});var my1,iy1,py1,gh0;var hh0=D(()=>{K1();G1();my1=C(Z$(),1),iy1=C(Y1(),1),py1=C(m0(),1);gh0=class gh0 extends py1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[iy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),my1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetObjectRetention",{}).n("S3Client","GetObjectRetentionCommand").sc(Rq1).build(){}});var ny1,ty1,oy1,uh0;var lh0=D(()=>{K1();G1();ny1=C(Z$(),1),ty1=C(Y1(),1),oy1=C(m0(),1);uh0=class uh0 extends oy1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[ty1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),ny1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetObjectTagging",{}).n("S3Client","GetObjectTaggingCommand").sc(qq1).build(){}});var ry1,ay1,ch0;var dh0=D(()=>{K1();G1();ry1=C(Y1(),1),ay1=C(m0(),1);ch0=class ch0 extends ay1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[ry1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","GetObjectTorrent",{}).n("S3Client","GetObjectTorrentCommand").sc(Mq1).build(){}});var sy1,ey1,$g1,mh0;var ih0=D(()=>{K1();G1();sy1=C(Z$(),1),ey1=C(Y1(),1),$g1=C(m0(),1);mh0=class mh0 extends $g1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[ey1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),sy1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetPublicAccessBlock",{}).n("S3Client","GetPublicAccessBlockCommand").sc(Iq1).build(){}});var Zg1,Qg1,Xg1,Zz;var lp=D(()=>{K1();G1();Zg1=C(Z$(),1),Qg1=C(Y1(),1),Xg1=C(m0(),1);Zz=class Zz extends Xg1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Qg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Zg1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","HeadBucket",{}).n("S3Client","HeadBucketCommand").sc(Vq1).build(){}});var JZ0,Yg1,Jg1,MH;var cp=D(()=>{F3();K1();G1();JZ0=C(Z$(),1),Yg1=C(Y1(),1),Jg1=C(m0(),1);MH=class MH extends Jg1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[Yg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),JZ0.getThrow200ExceptionsPlugin(Q),i9(Q),JZ0.getS3ExpiresMiddlewarePlugin(Q)]}).s("AmazonS3","HeadObject",{}).n("S3Client","HeadObjectCommand").sc(kq1).build(){}});var Gg1,Wg1,Kg1,ph0;var nh0=D(()=>{K1();G1();Gg1=C(Z$(),1),Wg1=C(Y1(),1),Kg1=C(m0(),1);ph0=class ph0 extends Kg1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Wg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Gg1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","ListBucketAnalyticsConfigurations",{}).n("S3Client","ListBucketAnalyticsConfigurationsCommand").sc(Sq1).build(){}});var Hg1,Fg1,Ug1,th0;var oh0=D(()=>{K1();G1();Hg1=C(Z$(),1),Fg1=C(Y1(),1),Ug1=C(m0(),1);th0=class th0 extends Ug1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Fg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Hg1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","ListBucketIntelligentTieringConfigurations",{}).n("S3Client","ListBucketIntelligentTieringConfigurationsCommand").sc(Cq1).build(){}});var Ng1,Bg1,Og1,rh0;var ah0=D(()=>{K1();G1();Ng1=C(Z$(),1),Bg1=C(Y1(),1),Og1=C(m0(),1);rh0=class rh0 extends Og1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Bg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Ng1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","ListBucketInventoryConfigurations",{}).n("S3Client","ListBucketInventoryConfigurationsCommand").sc(_q1).build(){}});var Dg1,Lg1,wg1,sh0;var eh0=D(()=>{K1();G1();Dg1=C(Z$(),1),Lg1=C(Y1(),1),wg1=C(m0(),1);sh0=class sh0 extends wg1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Lg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Dg1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","ListBucketMetricsConfigurations",{}).n("S3Client","ListBucketMetricsConfigurationsCommand").sc(vq1).build(){}});var jg1,Eg1,zg1,dp;var GZ0=D(()=>{K1();G1();jg1=C(Z$(),1),Eg1=C(Y1(),1),zg1=C(m0(),1);dp=class dp extends zg1.Command.classBuilder().ep(B0).m(function($,Z,Q,X){return[Eg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),jg1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","ListBuckets",{}).n("S3Client","ListBucketsCommand").sc(bq1).build(){}});var Pg1,Ag1,Tg1,mp;var WZ0=D(()=>{K1();G1();Pg1=C(Z$(),1),Ag1=C(Y1(),1),Tg1=C(m0(),1);mp=class mp extends Tg1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0}}).m(function($,Z,Q,X){return[Ag1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Pg1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","ListDirectoryBuckets",{}).n("S3Client","ListDirectoryBucketsCommand").sc(xq1).build(){}});var Rg1,qg1,Mg1,$u0;var Zu0=D(()=>{K1();G1();Rg1=C(Z$(),1),qg1=C(Y1(),1),Mg1=C(m0(),1);$u0=class $u0 extends Mg1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Prefix:{type:"contextParams",name:"Prefix"}}).m(function($,Z,Q,X){return[qg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Rg1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","ListMultipartUploads",{}).n("S3Client","ListMultipartUploadsCommand").sc(fq1).build(){}});var Ig1,Vg1,kg1,Qu0;var Xu0=D(()=>{K1();G1();Ig1=C(Z$(),1),Vg1=C(Y1(),1),kg1=C(m0(),1);Qu0=class Qu0 extends kg1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Prefix:{type:"contextParams",name:"Prefix"}}).m(function($,Z,Q,X){return[Vg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Ig1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","ListObjects",{}).n("S3Client","ListObjectsCommand").sc(yq1).build(){}});var Sg1,Cg1,_g1,IH;var KZ0=D(()=>{K1();G1();Sg1=C(Z$(),1),Cg1=C(Y1(),1),_g1=C(m0(),1);IH=class IH extends _g1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Prefix:{type:"contextParams",name:"Prefix"}}).m(function($,Z,Q,X){return[Cg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Sg1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","ListObjectsV2",{}).n("S3Client","ListObjectsV2Command").sc(gq1).build(){}});var vg1,bg1,xg1,Yu0;var Ju0=D(()=>{K1();G1();vg1=C(Z$(),1),bg1=C(Y1(),1),xg1=C(m0(),1);Yu0=class Yu0 extends xg1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Prefix:{type:"contextParams",name:"Prefix"}}).m(function($,Z,Q,X){return[bg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),vg1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","ListObjectVersions",{}).n("S3Client","ListObjectVersionsCommand").sc(hq1).build(){}});var fg1,yg1,gg1,ip;var HZ0=D(()=>{F3();K1();G1();fg1=C(Z$(),1),yg1=C(Y1(),1),gg1=C(m0(),1);ip=class ip extends gg1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[yg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),fg1.getThrow200ExceptionsPlugin(Q),i9(Q)]}).s("AmazonS3","ListParts",{}).n("S3Client","ListPartsCommand").sc(uq1).build(){}});var hg1,ug1,Gu0;var Wu0=D(()=>{L6();K1();G1();hg1=C(Y1(),1),ug1=C(m0(),1);Gu0=class Gu0 extends ug1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[hg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!1})]}).s("AmazonS3","PutBucketAbac",{}).n("S3Client","PutBucketAbacCommand").sc(lq1).build(){}});var lg1,cg1,Ku0;var Hu0=D(()=>{L6();K1();G1();lg1=C(Y1(),1),cg1=C(m0(),1);Ku0=class Ku0 extends cg1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[lg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!1})]}).s("AmazonS3","PutBucketAccelerateConfiguration",{}).n("S3Client","PutBucketAccelerateConfigurationCommand").sc(cq1).build(){}});var dg1,mg1,Fu0;var Uu0=D(()=>{L6();K1();G1();dg1=C(Y1(),1),mg1=C(m0(),1);Fu0=class Fu0 extends mg1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[dg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketAcl",{}).n("S3Client","PutBucketAclCommand").sc(dq1).build(){}});var ig1,pg1,Nu0;var Bu0=D(()=>{K1();G1();ig1=C(Y1(),1),pg1=C(m0(),1);Nu0=class Nu0 extends pg1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[ig1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","PutBucketAnalyticsConfiguration",{}).n("S3Client","PutBucketAnalyticsConfigurationCommand").sc(mq1).build(){}});var ng1,tg1,Ou0;var Du0=D(()=>{L6();K1();G1();ng1=C(Y1(),1),tg1=C(m0(),1);Ou0=class Ou0 extends tg1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[ng1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketCors",{}).n("S3Client","PutBucketCorsCommand").sc(iq1).build(){}});var og1,rg1,Lu0;var wu0=D(()=>{L6();K1();G1();og1=C(Y1(),1),rg1=C(m0(),1);Lu0=class Lu0 extends rg1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[og1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketEncryption",{}).n("S3Client","PutBucketEncryptionCommand").sc(pq1).build(){}});var ag1,sg1,ju0;var Eu0=D(()=>{K1();G1();ag1=C(Y1(),1),sg1=C(m0(),1);ju0=class ju0 extends sg1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[ag1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","PutBucketIntelligentTieringConfiguration",{}).n("S3Client","PutBucketIntelligentTieringConfigurationCommand").sc(nq1).build(){}});var eg1,$h1,zu0;var Pu0=D(()=>{K1();G1();eg1=C(Y1(),1),$h1=C(m0(),1);zu0=class zu0 extends $h1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[eg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","PutBucketInventoryConfiguration",{}).n("S3Client","PutBucketInventoryConfigurationCommand").sc(tq1).build(){}});var Zh1,Qh1,Xh1,Au0;var Tu0=D(()=>{L6();K1();G1();Zh1=C(Z$(),1),Qh1=C(Y1(),1),Xh1=C(m0(),1);Au0=class Au0 extends Xh1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Qh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0}),Zh1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","PutBucketLifecycleConfiguration",{}).n("S3Client","PutBucketLifecycleConfigurationCommand").sc(oq1).build(){}});var Yh1,Jh1,Ru0;var qu0=D(()=>{L6();K1();G1();Yh1=C(Y1(),1),Jh1=C(m0(),1);Ru0=class Ru0 extends Jh1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Yh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketLogging",{}).n("S3Client","PutBucketLoggingCommand").sc(rq1).build(){}});var Gh1,Wh1,Mu0;var Iu0=D(()=>{K1();G1();Gh1=C(Y1(),1),Wh1=C(m0(),1);Mu0=class Mu0 extends Wh1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Gh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","PutBucketMetricsConfiguration",{}).n("S3Client","PutBucketMetricsConfigurationCommand").sc(aq1).build(){}});var Kh1,Hh1,Vu0;var ku0=D(()=>{K1();G1();Kh1=C(Y1(),1),Hh1=C(m0(),1);Vu0=class Vu0 extends Hh1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Kh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","PutBucketNotificationConfiguration",{}).n("S3Client","PutBucketNotificationConfigurationCommand").sc(sq1).build(){}});var Fh1,Uh1,Su0;var Cu0=D(()=>{L6();K1();G1();Fh1=C(Y1(),1),Uh1=C(m0(),1);Su0=class Su0 extends Uh1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Fh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketOwnershipControls",{}).n("S3Client","PutBucketOwnershipControlsCommand").sc(eq1).build(){}});var Nh1,Bh1,_u0;var vu0=D(()=>{L6();K1();G1();Nh1=C(Y1(),1),Bh1=C(m0(),1);_u0=class _u0 extends Bh1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Nh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketPolicy",{}).n("S3Client","PutBucketPolicyCommand").sc($M1).build(){}});var Oh1,Dh1,bu0;var xu0=D(()=>{L6();K1();G1();Oh1=C(Y1(),1),Dh1=C(m0(),1);bu0=class bu0 extends Dh1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Oh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketReplication",{}).n("S3Client","PutBucketReplicationCommand").sc(ZM1).build(){}});var Lh1,wh1,fu0;var yu0=D(()=>{L6();K1();G1();Lh1=C(Y1(),1),wh1=C(m0(),1);fu0=class fu0 extends wh1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Lh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketRequestPayment",{}).n("S3Client","PutBucketRequestPaymentCommand").sc(QM1).build(){}});var jh1,Eh1,gu0;var hu0=D(()=>{L6();K1();G1();jh1=C(Y1(),1),Eh1=C(m0(),1);gu0=class gu0 extends Eh1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[jh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketTagging",{}).n("S3Client","PutBucketTaggingCommand").sc(XM1).build(){}});var zh1,Ph1,uu0;var lu0=D(()=>{L6();K1();G1();zh1=C(Y1(),1),Ph1=C(m0(),1);uu0=class uu0 extends Ph1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[zh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketVersioning",{}).n("S3Client","PutBucketVersioningCommand").sc(YM1).build(){}});var Ah1,Th1,cu0;var du0=D(()=>{L6();K1();G1();Ah1=C(Y1(),1),Th1=C(m0(),1);cu0=class cu0 extends Th1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Ah1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketWebsite",{}).n("S3Client","PutBucketWebsiteCommand").sc(JM1).build(){}});var Rh1,qh1,Mh1,mu0;var iu0=D(()=>{L6();K1();G1();Rh1=C(Z$(),1),qh1=C(Y1(),1),Mh1=C(m0(),1);mu0=class mu0 extends Mh1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[qh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0}),Rh1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","PutObjectAcl",{}).n("S3Client","PutObjectAclCommand").sc(WM1).build(){}});var FZ0,Ih1,Vh1,ON;var pu0=D(()=>{L6();F3();K1();G1();FZ0=C(Z$(),1),Ih1=C(Y1(),1),Vh1=C(m0(),1);ON=class ON extends Vh1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[Ih1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!1}),FZ0.getCheckContentLengthHeaderPlugin(Q),FZ0.getThrow200ExceptionsPlugin(Q),i9(Q)]}).s("AmazonS3","PutObject",{}).n("S3Client","PutObjectCommand").sc(GM1).build(){}});var kh1,Sh1,Ch1,nu0;var tu0=D(()=>{L6();K1();G1();kh1=C(Z$(),1),Sh1=C(Y1(),1),Ch1=C(m0(),1);nu0=class nu0 extends Ch1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Sh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0}),kh1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","PutObjectLegalHold",{}).n("S3Client","PutObjectLegalHoldCommand").sc(KM1).build(){}});var _h1,vh1,bh1,ou0;var ru0=D(()=>{L6();K1();G1();_h1=C(Z$(),1),vh1=C(Y1(),1),bh1=C(m0(),1);ou0=class ou0 extends bh1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[vh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0}),_h1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","PutObjectLockConfiguration",{}).n("S3Client","PutObjectLockConfigurationCommand").sc(HM1).build(){}});var xh1,fh1,yh1,au0;var su0=D(()=>{L6();K1();G1();xh1=C(Z$(),1),fh1=C(Y1(),1),yh1=C(m0(),1);au0=class au0 extends yh1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[fh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0}),xh1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","PutObjectRetention",{}).n("S3Client","PutObjectRetentionCommand").sc(FM1).build(){}});var gh1,hh1,uh1,pp;var eu0=D(()=>{L6();K1();G1();gh1=C(Z$(),1),hh1=C(Y1(),1),uh1=C(m0(),1);pp=class pp extends uh1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[hh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0}),gh1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","PutObjectTagging",{}).n("S3Client","PutObjectTaggingCommand").sc(UM1).build(){}});var lh1,ch1,$l0;var Zl0=D(()=>{L6();K1();G1();lh1=C(Y1(),1),ch1=C(m0(),1);$l0=class $l0 extends ch1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[lh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutPublicAccessBlock",{}).n("S3Client","PutPublicAccessBlockCommand").sc(NM1).build(){}});var dh1,mh1,ih1,Ql0;var Xl0=D(()=>{K1();G1();dh1=C(Z$(),1),mh1=C(Y1(),1),ih1=C(m0(),1);Ql0=class Ql0 extends ih1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[mh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),dh1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","RenameObject",{}).n("S3Client","RenameObjectCommand").sc(BM1).build(){}});var ph1,nh1,th1,Yl0;var Jl0=D(()=>{L6();K1();G1();ph1=C(Z$(),1),nh1=C(Y1(),1),th1=C(m0(),1);Yl0=class Yl0 extends th1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[nh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!1}),ph1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","RestoreObject",{}).n("S3Client","RestoreObjectCommand").sc(OM1).build(){}});var oh1,rh1,Gl0;var Wl0=D(()=>{F3();K1();G1();oh1=C(Y1(),1),rh1=C(m0(),1);Gl0=class Gl0 extends rh1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[oh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),i9(Q)]}).s("AmazonS3","SelectObjectContent",{eventStream:{output:!0}}).n("S3Client","SelectObjectContentCommand").sc(DM1).build(){}});var ah1,sh1,Kl0;var Hl0=D(()=>{L6();K1();G1();ah1=C(Y1(),1),sh1=C(m0(),1);Kl0=class Kl0 extends sh1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[ah1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","UpdateBucketMetadataInventoryTableConfiguration",{}).n("S3Client","UpdateBucketMetadataInventoryTableConfigurationCommand").sc(LM1).build(){}});var eh1,$u1,Fl0;var Ul0=D(()=>{L6();K1();G1();eh1=C(Y1(),1),$u1=C(m0(),1);Fl0=class Fl0 extends $u1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[eh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","UpdateBucketMetadataJournalTableConfiguration",{}).n("S3Client","UpdateBucketMetadataJournalTableConfigurationCommand").sc(wM1).build(){}});var Zu1,Qu1,Xu1,Nl0;var Bl0=D(()=>{L6();K1();G1();Zu1=C(Z$(),1),Qu1=C(Y1(),1),Xu1=C(m0(),1);Nl0=class Nl0 extends Xu1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Qu1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0}),Zu1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","UpdateObjectEncryption",{}).n("S3Client","UpdateObjectEncryptionCommand").sc(jM1).build(){}});var Yu1,Ju1,Gu1,np;var Ol0=D(()=>{L6();F3();K1();G1();Yu1=C(Z$(),1),Ju1=C(Y1(),1),Gu1=C(m0(),1);np=class np extends Gu1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[Ju1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!1}),Yu1.getThrow200ExceptionsPlugin(Q),i9(Q)]}).s("AmazonS3","UploadPart",{}).n("S3Client","UploadPartCommand").sc(EM1).build(){}});var Wu1,Ku1,Hu1,Dl0;var Ll0=D(()=>{F3();K1();G1();Wu1=C(Z$(),1),Ku1=C(Y1(),1),Hu1=C(m0(),1);Dl0=class Dl0 extends Hu1.Command.classBuilder().ep({...B0,DisableS3ExpressSessionAuth:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Ku1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Wu1.getThrow200ExceptionsPlugin(Q),i9(Q)]}).s("AmazonS3","UploadPartCopy",{}).n("S3Client","UploadPartCopyCommand").sc(zM1).build(){}});var Fu1,Uu1,wl0;var jl0=D(()=>{K1();G1();Fu1=C(Y1(),1),Uu1=C(m0(),1);wl0=class wl0 extends Uu1.Command.classBuilder().ep({...B0,UseObjectLambdaEndpoint:{type:"staticContextParams",value:!0}}).m(function($,Z,Q,X){return[Fu1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","WriteGetObjectResponse",{}).n("S3Client","WriteGetObjectResponseCommand").sc(PM1).build(){}});var Nu1,Bu1;var El0=D(()=>{GZ0();eE();Nu1=C(sZ(),1),Bu1=Nu1.createPaginator(hX,dp,"ContinuationToken","ContinuationToken","MaxBuckets")});var Ou1,Du1;var zl0=D(()=>{WZ0();eE();Ou1=C(sZ(),1),Du1=Ou1.createPaginator(hX,mp,"ContinuationToken","ContinuationToken","MaxDirectoryBuckets")});var Lu1,wu1;var Pl0=D(()=>{KZ0();eE();Lu1=C(sZ(),1),wu1=Lu1.createPaginator(hX,IH,"ContinuationToken","NextContinuationToken","MaxKeys")});var ju1,Eu1;var Al0=D(()=>{HZ0();eE();ju1=C(sZ(),1),Eu1=ju1.createPaginator(hX,ip,"PartNumberMarker","NextPartNumberMarker","MaxParts")});var Og=()=>{let $=new WeakSet;return(Z,Q)=>{if(typeof Q==="object"&&Q!==null){if($.has(Q))return"[Circular]";$.add(Q)}return Q}};var zu1=($)=>{return new Promise((Z)=>setTimeout(Z,$*1000))};var Pu1,e5,YD=($)=>{if($.state===e5.ABORTED){let Z=Error(`${JSON.stringify({...$,reason:"Request was aborted"},Og())}`);throw Z.name="AbortError",Z}else if($.state===e5.TIMEOUT){let Z=Error(`${JSON.stringify({...$,reason:"Waiter has timed out"},Og())}`);throw Z.name="TimeoutError",Z}else if($.state!==e5.SUCCESS)throw Error(`${JSON.stringify($,Og())}`);return $};var UZ0=D(()=>{Pu1={minDelay:2,maxDelay:120};(function($){$.ABORTED="ABORTED",$.FAILURE="FAILURE",$.SUCCESS="SUCCESS",$.RETRY="RETRY",$.TIMEOUT="TIMEOUT"})(e5||(e5={}))});var Au1=async({minDelay:$,maxDelay:Z,maxWaitTime:Q,abortController:X,client:Y,abortSignal:J},G,W)=>{let K={},[H,F]=[$*1000,Z*1000],U=0,N=Date.now()+Q*1000,B=Date.now()+60000,O=!1;while(!0){if(U>0){let j=vy8(H,F,U,N);if(X?.signal?.aborted||J?.aborted)return K["AbortController signal aborted."]|=0,K["AbortController signal aborted."]+=1,{state:e5.ABORTED,observedResponses:K};if(Date.now()+j>N)return{state:e5.TIMEOUT,observedResponses:K};await zu1(j/1000)}let{state:L,reason:w}=await W(Y,G);if(w){let j=_y8(w);K[j]|=0,K[j]+=1}if(L!==e5.RETRY)return{state:L,reason:w,final:w,observedResponses:K};if(U+=1,!O&&Date.now()>=B)Cy8(K,Y),O=!0}},Cy8=($={},Z)=>{let Q=Object.keys($),X=0,Y=0;for(let W of Q){let K=$[W]|0;if(X=Math.max(K,X),W.startsWith("403:"))Y+=K}let J=Z?.config?.logger,G=typeof J?.warn==="function"&&!J.constructor?.name?.includes?.("NoOpLogger")?J:console;if(Y>=3||Q[Q.length-1].startsWith("403:"))G.warn("@smithy/util-waiter WARN - 403 status code encountered during waiter polling.")},_y8=($)=>{let Z=$?.$response?.statusCode??$?.$metadata?.httpStatusCode;if($?.$responseBodyText)return`${Z?Z+": ":""}Deserialization error for body: ${$.$responseBodyText}`;if(Z){if($?.$response||$?.message)return`${Z??"Unknown"}: ${$?.message}`;return`${Z}: OK`}return String($?.message??JSON.stringify($,Og())??"Unknown")},vy8=($,Z,Q,X)=>{let Y=Math.log(Z/$)/Math.log(2)+1;if(Q>Y)return Z;let J=$*2**(Q-1),G=Math.min(J,Z),W=by8($,G);if(Date.now()+W>X){let K=X-Date.now();return Math.max(0,K-500)}return W},by8=($,Z)=>$+Math.random()*(Z-$);var Tu1=D(()=>{UZ0()});var Ru1=($)=>{if($.maxWaitTime<=0)throw Error("WaiterConfiguration.maxWaitTime must be greater than 0");else if($.minDelay<=0)throw Error("WaiterConfiguration.minDelay must be greater than 0");else if($.maxDelay<=0)throw Error("WaiterConfiguration.maxDelay must be greater than 0");else if($.maxWaitTime<=$.minDelay)throw Error(`WaiterConfiguration.maxWaitTime [${$.maxWaitTime}] must be greater than WaiterConfiguration.minDelay [${$.minDelay}] for this waiter`);else if($.maxDelay<$.minDelay)throw Error(`WaiterConfiguration.maxDelay [${$.maxDelay}] must be greater than WaiterConfiguration.minDelay [${$.minDelay}] for this waiter`)};var qu1=()=>{};var Mu1=($)=>{let Z,Q=new Promise((X)=>{if(Z=()=>X({state:e5.ABORTED}),typeof $.addEventListener==="function")$.addEventListener("abort",Z);else $.onabort=Z});return{clearListener(){if(typeof $.removeEventListener==="function")$.removeEventListener("abort",Z)},aborted:Q}},JD=async($,Z,Q)=>{let X={...Pu1,...$};Ru1(X);let Y=[Au1(X,Z,Q)],J=[];if($.abortSignal){let{aborted:G,clearListener:W}=Mu1($.abortSignal);J.push(W),Y.push(G)}if($.abortController?.signal){let{aborted:G,clearListener:W}=Mu1($.abortController.signal);J.push(W),Y.push(G)}return Promise.race(Y).then((G)=>{for(let W of J)W();return G})};var Iu1=D(()=>{Tu1();qu1();UZ0()});var tp=D(()=>{Iu1();UZ0()});var xy8=async($,Z)=>{let Q;try{return Q=await $.send(new Zz(Z)),{state:e5.SUCCESS,reason:Q}}catch(X){if(Q=X,X.name==="NotFound")return{state:e5.RETRY,reason:Q}}return{state:e5.RETRY,reason:Q}},Vu1=async($,Z)=>{let X=await JD({...{minDelay:5,maxDelay:120},...$},Z,xy8);return YD(X)};var Tl0=D(()=>{tp();lp()});var fy8=async($,Z)=>{let Q;try{Q=await $.send(new Zz(Z))}catch(X){if(Q=X,X.name==="NotFound")return{state:e5.SUCCESS,reason:Q}}return{state:e5.RETRY,reason:Q}},ku1=async($,Z)=>{let X=await JD({...{minDelay:5,maxDelay:120},...$},Z,fy8);return YD(X)};var Rl0=D(()=>{tp();lp()});var yy8=async($,Z)=>{let Q;try{return Q=await $.send(new MH(Z)),{state:e5.SUCCESS,reason:Q}}catch(X){if(Q=X,X.name==="NotFound")return{state:e5.RETRY,reason:Q}}return{state:e5.RETRY,reason:Q}},Su1=async($,Z)=>{let X=await JD({...{minDelay:5,maxDelay:120},...$},Z,yy8);return YD(X)};var ql0=D(()=>{tp();cp()});var gy8=async($,Z)=>{let Q;try{Q=await $.send(new MH(Z))}catch(X){if(Q=X,X.name==="NotFound")return{state:e5.SUCCESS,reason:Q}}return{state:e5.RETRY,reason:Q}},Cu1=async($,Z)=>{let X=await JD({...{minDelay:5,maxDelay:120},...$},Z,gy8);return YD(X)};var Ml0=D(()=>{tp();cp()});var _u1,hy8,uy8,ly8,vu1;var bu1=D(()=>{dy0();my0();py0();ty0();ry0();sy0();ey0();c50();Zg0();Xg0();Jg0();Wg0();Hg0();Ug0();Bg0();Dg0();wg0();Eg0();Pg0();Tg0();qg0();Ig0();kg0();Sg0();_g0();bg0();fg0();gg0();ug0();cg0();mg0();pg0();tg0();rg0();sg0();$h0();Qh0();Yh0();Gh0();Kh0();Fh0();Nh0();Oh0();Lh0();jh0();zh0();Ah0();Rh0();Mh0();Vh0();Sh0();_h0();vh0();xh0();yh0();hh0();lh0();dh0();ih0();lp();cp();nh0();oh0();ah0();eh0();GZ0();WZ0();Zu0();Xu0();KZ0();Ju0();HZ0();Wu0();Hu0();Uu0();Bu0();Du0();wu0();Eu0();Pu0();Tu0();qu0();Iu0();ku0();Cu0();vu0();xu0();yu0();hu0();lu0();du0();iu0();pu0();tu0();ru0();su0();eu0();Zl0();Xl0();Jl0();Wl0();Hl0();Ul0();Bl0();Ol0();Ll0();jl0();El0();zl0();Pl0();Al0();eE();Tl0();Rl0();ql0();Ml0();_u1=C(m0(),1),hy8={AbortMultipartUploadCommand:gp,CompleteMultipartUploadCommand:hp,CopyObjectCommand:iy0,CreateBucketCommand:ny0,CreateBucketMetadataConfigurationCommand:oy0,CreateBucketMetadataTableConfigurationCommand:ay0,CreateMultipartUploadCommand:up,CreateSessionCommand:wp,DeleteBucketCommand:Qg0,DeleteBucketAnalyticsConfigurationCommand:$g0,DeleteBucketCorsCommand:Yg0,DeleteBucketEncryptionCommand:Gg0,DeleteBucketIntelligentTieringConfigurationCommand:Kg0,DeleteBucketInventoryConfigurationCommand:Fg0,DeleteBucketLifecycleCommand:Ng0,DeleteBucketMetadataConfigurationCommand:Og0,DeleteBucketMetadataTableConfigurationCommand:Lg0,DeleteBucketMetricsConfigurationCommand:jg0,DeleteBucketOwnershipControlsCommand:zg0,DeleteBucketPolicyCommand:Ag0,DeleteBucketReplicationCommand:Rg0,DeleteBucketTaggingCommand:Mg0,DeleteBucketWebsiteCommand:Vg0,DeleteObjectCommand:$z,DeleteObjectsCommand:Cg0,DeleteObjectTaggingCommand:vg0,DeletePublicAccessBlockCommand:xg0,GetBucketAbacCommand:yg0,GetBucketAccelerateConfigurationCommand:hg0,GetBucketAclCommand:lg0,GetBucketAnalyticsConfigurationCommand:dg0,GetBucketCorsCommand:ig0,GetBucketEncryptionCommand:ng0,GetBucketIntelligentTieringConfigurationCommand:og0,GetBucketInventoryConfigurationCommand:ag0,GetBucketLifecycleConfigurationCommand:eg0,GetBucketLocationCommand:Zh0,GetBucketLoggingCommand:Xh0,GetBucketMetadataConfigurationCommand:Jh0,GetBucketMetadataTableConfigurationCommand:Wh0,GetBucketMetricsConfigurationCommand:Hh0,GetBucketNotificationConfigurationCommand:Uh0,GetBucketOwnershipControlsCommand:Bh0,GetBucketPolicyCommand:Dh0,GetBucketPolicyStatusCommand:wh0,GetBucketReplicationCommand:Eh0,GetBucketRequestPaymentCommand:Ph0,GetBucketTaggingCommand:Th0,GetBucketVersioningCommand:qh0,GetBucketWebsiteCommand:Ih0,GetObjectCommand:XD,GetObjectAclCommand:kh0,GetObjectAttributesCommand:Ch0,GetObjectLegalHoldCommand:bh0,GetObjectLockConfigurationCommand:fh0,GetObjectRetentionCommand:gh0,GetObjectTaggingCommand:uh0,GetObjectTorrentCommand:ch0,GetPublicAccessBlockCommand:mh0,HeadBucketCommand:Zz,HeadObjectCommand:MH,ListBucketAnalyticsConfigurationsCommand:ph0,ListBucketIntelligentTieringConfigurationsCommand:th0,ListBucketInventoryConfigurationsCommand:rh0,ListBucketMetricsConfigurationsCommand:sh0,ListBucketsCommand:dp,ListDirectoryBucketsCommand:mp,ListMultipartUploadsCommand:$u0,ListObjectsCommand:Qu0,ListObjectsV2Command:IH,ListObjectVersionsCommand:Yu0,ListPartsCommand:ip,PutBucketAbacCommand:Gu0,PutBucketAccelerateConfigurationCommand:Ku0,PutBucketAclCommand:Fu0,PutBucketAnalyticsConfigurationCommand:Nu0,PutBucketCorsCommand:Ou0,PutBucketEncryptionCommand:Lu0,PutBucketIntelligentTieringConfigurationCommand:ju0,PutBucketInventoryConfigurationCommand:zu0,PutBucketLifecycleConfigurationCommand:Au0,PutBucketLoggingCommand:Ru0,PutBucketMetricsConfigurationCommand:Mu0,PutBucketNotificationConfigurationCommand:Vu0,PutBucketOwnershipControlsCommand:Su0,PutBucketPolicyCommand:_u0,PutBucketReplicationCommand:bu0,PutBucketRequestPaymentCommand:fu0,PutBucketTaggingCommand:gu0,PutBucketVersioningCommand:uu0,PutBucketWebsiteCommand:cu0,PutObjectCommand:ON,PutObjectAclCommand:mu0,PutObjectLegalHoldCommand:nu0,PutObjectLockConfigurationCommand:ou0,PutObjectRetentionCommand:au0,PutObjectTaggingCommand:pp,PutPublicAccessBlockCommand:$l0,RenameObjectCommand:Ql0,RestoreObjectCommand:Yl0,SelectObjectContentCommand:Gl0,UpdateBucketMetadataInventoryTableConfigurationCommand:Kl0,UpdateBucketMetadataJournalTableConfigurationCommand:Fl0,UpdateObjectEncryptionCommand:Nl0,UploadPartCommand:np,UploadPartCopyCommand:Dl0,WriteGetObjectResponseCommand:wl0},uy8={paginateListBuckets:Bu1,paginateListDirectoryBuckets:Du1,paginateListObjectsV2:wu1,paginateListParts:Eu1},ly8={waitUntilBucketExists:Vu1,waitUntilBucketNotExists:ku1,waitUntilObjectExists:Su1,waitUntilObjectNotExists:Cu1};vu1=class vu1 extends hX{};_u1.createAggregatedClient(hy8,vu1,{paginators:uy8,waiters:ly8})});var xu1=D(()=>{dy0();my0();py0();ty0();ry0();sy0();ey0();c50();Zg0();Xg0();Jg0();Wg0();Hg0();Ug0();Bg0();Dg0();wg0();Eg0();Pg0();Tg0();qg0();Ig0();kg0();Sg0();bg0();_g0();fg0();gg0();ug0();cg0();mg0();pg0();tg0();rg0();sg0();$h0();Qh0();Yh0();Gh0();Kh0();Fh0();Nh0();Oh0();Lh0();jh0();zh0();Ah0();Rh0();Mh0();Vh0();Sh0();_h0();vh0();xh0();yh0();hh0();lh0();dh0();ih0();lp();cp();nh0();oh0();ah0();eh0();GZ0();WZ0();Zu0();Ju0();Xu0();KZ0();HZ0();Wu0();Hu0();Uu0();Bu0();Du0();wu0();Eu0();Pu0();Tu0();qu0();Iu0();ku0();Cu0();vu0();xu0();yu0();hu0();lu0();du0();iu0();pu0();tu0();ru0();su0();eu0();Zl0();Xl0();Jl0();Wl0();Hl0();Ul0();Bl0();Ol0();Ll0();jl0()});var fu1=()=>{};var yu1=D(()=>{fu1();El0();zl0();Pl0();Al0()});var gu1=D(()=>{Tl0();Rl0();ql0();Ml0()});var hu1;var uu1=D(()=>{hu1={CRC32:"CRC32",CRC32C:"CRC32C",CRC64NVME:"CRC64NVME",MD5:"MD5",SHA1:"SHA1",SHA256:"SHA256",SHA512:"SHA512",XXHASH128:"XXHASH128",XXHASH3:"XXHASH3",XXHASH64:"XXHASH64"}});var lu1=()=>{};var cu1=()=>{};var NZ0=D(()=>{eE();bu1();xu1();G1();yu1();gu1();uu1();eb0();lu1();cu1()});function mu1($){let{port:Z,query:Q}=$,{protocol:X,path:Y,hostname:J}=$;if(X&&X.slice(-1)!==":")X+=":";if(Z)J+=`:${Z}`;if(Y&&Y.charAt(0)!=="/")Y=`/${Y}`;let G=Q?du1.buildQueryString(Q):"";if(G&&G[0]!=="?")G=`?${G}`;let W="";if($.username!=null||$.password!=null){let H=$.username??"",F=$.password??"";W=`${H}:${F}@`}let K="";if($.fragment)K=`#${$.fragment}`;return`${X}//${W}${J}${Y}${G}${K}`}var du1;var iu1=D(()=>{du1=C(n40(),1)});var pu1="UNSIGNED-PAYLOAD",nu1="X-Amz-Content-Sha256";class BZ0{signer;constructor($){let Z={service:$.signingName||$.service||"s3",uriEscapePath:$.uriEscapePath||!1,applyChecksum:$.applyChecksum||!1,...$};this.signer=new tu1.SignatureV4MultiRegion(Z)}presign($,{unsignableHeaders:Z=new Set,hoistableHeaders:Q=new Set,unhoistableHeaders:X=new Set,...Y}={}){return this.prepareRequest($,{unsignableHeaders:Z,unhoistableHeaders:X,hoistableHeaders:Q}),this.signer.presign($,{expiresIn:900,unsignableHeaders:Z,unhoistableHeaders:X,...Y})}presignWithCredentials($,Z,{unsignableHeaders:Q=new Set,hoistableHeaders:X=new Set,unhoistableHeaders:Y=new Set,...J}={}){return this.prepareRequest($,{unsignableHeaders:Q,unhoistableHeaders:Y,hoistableHeaders:X}),this.signer.presignWithCredentials($,Z,{expiresIn:900,unsignableHeaders:Q,unhoistableHeaders:Y,...J})}prepareRequest($,{unsignableHeaders:Z=new Set,unhoistableHeaders:Q=new Set,hoistableHeaders:X=new Set}={}){Z.add("content-type"),Object.keys($.headers).map((W)=>W.toLowerCase()).filter((W)=>W.startsWith("x-amz-server-side-encryption")).forEach((W)=>{if(!X.has(W))Q.add(W)}),$.headers[nu1]=pu1;let Y=$.headers.host,J=$.port,G=`${$.hostname}${$.port!=null?":"+J:""}`;if(!Y||Y===$.hostname&&$.port!=null)$.headers.host=G}}var tu1;var Il0=D(()=>{tu1=C(iy(),1)});var ou1,ru1,OZ0=async($,Z,Q={})=>{let X,Y;if(typeof $.config.endpointProvider==="function"){let N=(await ou1.getEndpointFromInstructions(Z.input,Z.constructor,$.config)).properties?.authSchemes?.[0];if(N?.name==="sigv4a")Y=N?.signingRegionSet?.join(",");else Y=N?.signingRegion;X=new BZ0({...$.config,signingName:N?.signingName,region:async()=>Y})}else X=new BZ0($.config);let J=(U,N)=>async(B)=>{let{request:O}=B;if(!ru1.HttpRequest.isInstance(O))throw Error("Request to be presigned is not an valid HTTP request.");delete O.headers["amz-sdk-invocation-id"],delete O.headers["amz-sdk-request"],delete O.headers["x-amz-user-agent"];let L,w={...Q,signingRegion:Q.signingRegion??N.signing_region??Y,signingService:Q.signingService??N.signing_service};if(N.s3ExpressIdentity)L=await X.presignWithCredentials(O,N.s3ExpressIdentity,w);else L=await X.presign(O,w);return{response:{},output:{$metadata:{httpStatusCode:200},presigned:L}}},G="presignInterceptMiddleware",W=$.middlewareStack.clone();W.addRelativeTo(J,{name:G,relation:"before",toMiddleware:"awsAuthMiddleware",override:!0});let K=Z.resolveMiddleware(W,$.config,{}),{output:H}=await K({input:Z.input}),{presigned:F}=H;return mu1(F)};var au1=D(()=>{iu1();Il0();ou1=C(Y1(),1),ru1=C(V5(),1)});var su1=D(()=>{au1();Il0()});import{extname as cy8}from"path";function U3($){let Z;try{Z=decodeURIComponent($)}catch{Z=$}let X=Z.replace(/\0/g,"").replace(/[\x00-\x1f\x7f]/g,"").replace(/\\/g,"/").split("/"),Y=[];for(let J of X)if(J==="..")Y.pop();else if(J!=="."&&J!=="")Y.push(J);return Y.join("/")}function GD($,Z){let Q=U3(Z);if(!Q)throw Error("Key is empty after sanitization");return`${$}/${Q}`}function eu1($,Z){if(!Z)return`${$}/`;let Q=U3(Z);return`${$}/${Q}${Q.endsWith("/")?"":"/"}`}function Dg($,Z,Q){let X=Q.split("/").map(encodeURIComponent).join("/");return`${$}/api/${encodeURIComponent(Z)}/files/${X}`}function Vl0($,Z){let Q=`${$}/`;if(Z.startsWith(Q))return Z.slice(Q.length);return Z}function V7($){let Z=cy8($).toLowerCase();return dy8[Z]??"application/octet-stream"}function DZ0($){let Z=$.split(";")[0].trim();if(my8.has(Z))return!0;if(Z.startsWith("text/"))return!0;return!1}var dy8,my8;var iW=D(()=>{dy8={".json":"application/json",".html":"text/html",".htm":"text/html",".css":"text/css",".js":"application/javascript",".mjs":"application/javascript",".ts":"text/typescript",".txt":"text/plain",".md":"text/markdown",".csv":"text/csv",".xml":"application/xml",".svg":"image/svg+xml",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".pdf":"application/pdf",".zip":"application/zip",".gz":"application/gzip",".tar":"application/x-tar",".wasm":"application/wasm",".yaml":"application/yaml",".yml":"application/yaml",".toml":"application/toml"};my8=new Set(["application/json","text/html","text/css","application/javascript","text/typescript","text/plain","text/markdown","text/csv","application/xml","image/svg+xml","application/yaml","application/toml"])});class kl0{client;bucket;constructor($){this.bucket=$.bucket,this.client=new hX({endpoint:$.endpoint,region:$.region,credentials:{accessKeyId:$.accessKeyId,secretAccessKey:$.secretAccessKey},forcePathStyle:$.forcePathStyle})}async getBytesOrPresign($,Z,Q){let X=GD($,Z),Y=await this.client.send(new MH({Bucket:this.bucket,Key:X})),J=Y.ContentLength??0,G=Y.ContentType??V7(Z);if(J>Q.presignWhenLargerThan){let F=await OZ0(this.client,new XD({Bucket:this.bucket,Key:X}),{expiresIn:Q.presignExpiresIn??3600});return{error:"FILE_TOO_LARGE",size:J,maxInlineSize:Q.presignWhenLargerThan,presignedUrl:F,contentType:G}}let K=await(await this.client.send(new XD({Bucket:this.bucket,Key:X}))).Body.transformToByteArray(),H=DZ0(G);return{content:H?new TextDecoder().decode(K):Buffer.from(K).toString("base64"),contentType:G,encoding:H?"utf-8":"base64",size:J,lastModified:Y.LastModified,etag:Y.ETag}}async getBytes($,Z){let Q=GD($,Z);return(await this.client.send(new XD({Bucket:this.bucket,Key:Q}))).Body.transformToByteArray()}async put($,Z,Q,X){let Y=GD($,Z),J=X?.contentType??V7(Z);return{etag:(await this.client.send(new ON({Bucket:this.bucket,Key:Y,Body:typeof Q==="string"?Buffer.from(Q,"utf-8"):Q,ContentType:J}))).ETag,key:Z}}async list($,Z){let Q=eu1($,Z?.prefix),X=await this.client.send(new IH({Bucket:this.bucket,Prefix:Q,MaxKeys:Z?.maxKeys??1000,ContinuationToken:Z?.continuationToken,Delimiter:Z?.delimiter})),Y=X.CommonPrefixes?.map((J)=>Vl0($,J.Prefix??"")).filter(Boolean);return{objects:(X.Contents??[]).map((J)=>({key:Vl0($,J.Key??""),size:J.Size??0,lastModified:J.LastModified,etag:J.ETag})),isTruncated:X.IsTruncated??!1,nextContinuationToken:X.NextContinuationToken,commonPrefixes:Y&&Y.length>0?Y:void 0}}async delete($,Z){let Q=GD($,Z);await this.client.send(new $z({Bucket:this.bucket,Key:Q}))}async head($,Z){let Q=GD($,Z),X=await this.client.send(new MH({Bucket:this.bucket,Key:Q}));return{contentType:X.ContentType??V7(Z),size:X.ContentLength??0,lastModified:X.LastModified,etag:X.ETag}}async presignedGetUrl($,Z,Q=3600,X){let Y=GD($,Z);return OZ0(this.client,new XD({Bucket:this.bucket,Key:Y}),{expiresIn:Q})}async presignedPutUrl($,Z,Q=3600,X){let Y=GD($,Z);return OZ0(this.client,new ON({Bucket:this.bucket,Key:Y,ContentType:X}),{expiresIn:Q})}}var $l1=D(()=>{NZ0();su1();iW()});function iy8(){let $=E0();return!!($.s3Endpoint&&$.s3Bucket&&$.s3AccessKeyId&&$.s3SecretAccessKey)}function uX(){if(op!==void 0)return op;if(!iy8())return op=null,null;let $=E0();return op=new kl0({endpoint:$.s3Endpoint,bucket:$.s3Bucket,region:$.s3Region,accessKeyId:$.s3AccessKeyId,secretAccessKey:$.s3SecretAccessKey,forcePathStyle:$.s3ForcePathStyle}),op}var op;var WD=D(()=>{U$();$l1()});function rJ($,Z){return{getBytesOrPresign:(Q,X)=>$.getBytesOrPresign(Z,Q,X),getBytes:(Q)=>$.getBytes(Z,Q),put:(Q,X,Y)=>$.put(Z,Q,X,Y),list:(Q)=>$.list(Z,Q),delete:(Q)=>$.delete(Z,Q),head:(Q)=>$.head(Z,Q),presignedGetUrl:(Q,X,Y)=>$.presignedGetUrl(Z,Q,X,Y),presignedPutUrl:(Q,X,Y)=>$.presignedPutUrl(Z,Q,X,Y)}}import{mkdir as py8,readdir as ny8,readFile as Sl0,stat as LZ0,unlink as ty8,writeFile as oy8}from"fs/promises";import{createHmac as ry8}from"crypto";import{dirname as ay8,join as rp}from"path";function Cl0($){let Z=$.replace(/[^a-zA-Z0-9_-]/g,"_");return rp(sy8,Z)}function Lg($,Z){return rp(Cl0($),U3(Z))}class N3{orgId;baseUrl;constructor($,Z){this.orgId=$;this.baseUrl=Z}async getBytesOrPresign($,Z){let Q=Lg(this.orgId,$),X=await LZ0(Q),Y=V7($);if(X.size>Z.presignWhenLargerThan)return{error:"FILE_TOO_LARGE",size:X.size,maxInlineSize:Z.presignWhenLargerThan,presignedUrl:await this.presignedGetUrl($),contentType:Y};let J=await Sl0(Q),G=DZ0(Y);return{content:G?new TextDecoder().decode(J):Buffer.from(J).toString("base64"),contentType:Y,encoding:G?"utf-8":"base64",size:X.size,lastModified:X.mtime}}async getBytes($){let Z=await Sl0(Lg(this.orgId,$));return new Uint8Array(Z)}async put($,Z,Q){let X=Lg(this.orgId,$);return await py8(ay8(X),{recursive:!0}),await oy8(X,typeof Z==="string"?Buffer.from(Z,"utf-8"):Z),{key:$}}async list($){let Z=$?.prefix?rp(Cl0(this.orgId),U3($.prefix)):Cl0(this.orgId),Q;try{Q=await ny8(Z,{withFileTypes:!0})}catch{return{objects:[],isTruncated:!1}}let X=$?.maxKeys??1000,Y=$?.prefix,J=Q.filter((W)=>W.isFile());if($?.delimiter){let W=[],K=Q.filter((O)=>O.isDirectory());for(let O of K){let L=Y?`${Y}/${O.name}/`:`${O.name}/`;W.push(L)}W.sort();let H=X,F=W.slice(0,H);H-=F.length;let U=J.slice(0,H),N=W.length+J.length;return{objects:await Promise.all(U.map(async(O)=>{let L=await LZ0(rp(Z,O.name));return{key:Y?`${Y}/${O.name}`:O.name,size:L.size,lastModified:L.mtime}})),isTruncated:N>X,commonPrefixes:F.length>0?F:void 0}}return{objects:await Promise.all(J.slice(0,X).map(async(W)=>{let K=await LZ0(rp(Z,W.name));return{key:Y?`${Y}/${W.name}`:W.name,size:K.size,lastModified:K.mtime}})),isTruncated:J.length>X}}async delete($){await ty8(Lg(this.orgId,$))}async head($){let Z=await LZ0(Lg(this.orgId,$));return{contentType:V7($),size:Z.size,lastModified:Z.mtime}}async presignedGetUrl($,Z,Q){if(Q?.requireFetchable)throw Error("object storage returned a not fetchable (data:) URL; configure real S3/R2/MinIO for large-payload offload");let X=Lg(this.orgId,$),Y=await Sl0(X),J=V7($),G=Buffer.from(Y).toString("base64");return`data:${J};base64,${G}`}async presignedPutUrl($,Z=3600){if(!this.baseUrl)throw Error("baseUrl required for presigned PUT URLs in dev mode");let Q=U3($),X=Math.floor(Date.now()/1000)+Z,Y=E0().encryptionKey||"dev-secret",J=`${this.orgId}:${Q}:${X}:PUT`,G=ry8("sha256",Y).update(J).digest("hex"),W=new URL(`/api/dev-assets/${this.orgId}/${Q}`,this.baseUrl);return W.searchParams.set("expires",X.toString()),W.searchParams.set("signature",G),W.searchParams.set("method","PUT"),W.toString()}}var sy8="./data/assets";var wg=D(()=>{iW();U$()});function VH($){return ey8.test($)&&$!=="."&&$!==".."}function $7($){if(!VH($))throw Error(`Invalid org-fs volume name: ${JSON.stringify($)}`)}function k7($){return U3($)}function jg($){let Z=$.lastIndexOf("/");return Z===-1?"":$.slice(0,Z)}function KD($){let Z=jg($);if(Z==="")return[];let Q=Z.split("/"),X=[],Y="";for(let J of Q)Y=Y===""?J:`${Y}/${J}`,X.push(Y);return X}function kH($,Z){return`${Zl1}/${$}/${Z}`}function wZ0($){return`${Zl1}/${$}/`}var ey8,Zl1="_fs";var Qz=D(()=>{iW();ey8=/^[A-Za-z0-9_.-]{1,128}$/});import{createHmac as _l0,randomBytes as vl0,scrypt as $g8,timingSafeEqual as Ql1}from"crypto";import{promisify as Zg8}from"util";async function Yl1($){let Z=vl0(16),Q=await Xl1($,Z,Qg8);return`scrypt$${Z.toString("hex")}$${Q.toString("hex")}`}async function Jl1($,Z){let Q=Z.split("$");if(Q.length!==3||Q[0]!=="scrypt")return!1;let X=Buffer.from(Q[1],"hex"),Y=Buffer.from(Q[2],"hex");if(X.length===0||Y.length===0)return!1;let J;try{J=await Xl1($,X,Y.length)}catch{return!1}return Y.length===J.length&&Ql1(Y,J)}function Gl1(){return vl0(16).toString("hex")}function Wl1(){if(jZ0)return jZ0;let $;try{let Z=E0();$=Z.studioJwtSecret??Z.betterAuthSecret}catch{$=void 0}return jZ0=$?Buffer.from($):vl0(32),jZ0}function Kl1($){let Z=Buffer.from(JSON.stringify($)).toString("base64url"),Q=_l0("sha256",Wl1()).update(Z).digest("base64url");return`${Z}.${Q}`}function Hl1($,Z){let Q=$.indexOf(".");if(Q<0)return null;let X=$.slice(0,Q),Y=Buffer.from($.slice(Q+1)),J=Buffer.from(_l0("sha256",Wl1()).update(X).digest("base64url"));if(Y.length!==J.length||!Ql1(Y,J))return null;let G;try{G=JSON.parse(Buffer.from(X,"base64url").toString())}catch{return null}if(G.o!==Z.org||G.v!==Z.volume||G.s!==Z.secret||typeof G.e!=="number"||G.e<Z.nowSec)return null;return{govPath:G.p}}function bl0($,Z,Q){return`fsu_${_l0("sha256","fsunlock-name").update(`${$}:${Z}:${Q}`).digest("hex").slice(0,16)}`}var Qg8=64,Xl1,jZ0=null;var xl0=D(()=>{U$();Xl1=Zg8($g8)});import{createHash as Xg8}from"crypto";function Kg8($){if(typeof $!=="object"||$===null)return!1;let Z=$;return Z.name==="NoSuchKey"||Z.Code==="NoSuchKey"||Z.code==="ENOENT"||Z.$metadata?.httpStatusCode===404}function Fl1($){return Xg8("sha256").update($).digest("hex")}class B3{storage;manifest;organizationId;maxFileBytes;volumeQuotaBytes;constructor($,Z,Q,X={}){this.storage=$;this.manifest=Z;this.organizationId=Q;this.maxFileBytes=X.maxFileBytes??Gg8,this.volumeQuotaBytes=X.volumeQuotaBytes??Wg8}async usage($){return $7($),this.manifest.usage(this.organizationId,$)}async stat($,Z){return $7($),this.manifest.get(this.organizationId,$,k7(Z))}async listVolumeFiles($){return $7($),this.manifest.listVolumeFiles(this.organizationId,$)}async listDir($,Z){return $7($),this.manifest.listDir(this.organizationId,$,k7(Z))}async read($,Z){let Q=await this.requireFile($,Z);try{return await this.storage.getBytes(kH($,Q.path))}catch(X){if(Kg8(X))throw new lX(`No such file: ${Q.path}`);throw X}}async setShareMode($,Z,Q,X){$7($);let Y=k7(Z),J=await this.manifest.get(this.organizationId,$,Y);if(!J)throw new lX(`No such path: ${Y}`);let G=null,W=null;if(Q==="password"){if(!X.password)throw new aJ("A password is required to set password mode");G=await Yl1(X.password),W=Gl1()}let K=await this.manifest.setShareMode({organizationId:this.organizationId,volume:$,path:J.path,readPublic:Q!=="private",passwordHash:G,shareSecret:W,actor:X.actor});if(!K)throw new lX(`No such path: ${J.path}`);return K}async setReadPublic($,Z,Q,X){return this.setShareMode($,Z,Q?"public":"private",{actor:X.actor})}async resolveReadAccess($,Z){$7($);let Q=k7(Z),X=await this.manifest.get(this.organizationId,$,Q);if(!X||X.kind!=="file")return{access:"private"};let Y=await this.manifest.resolveGoverningShare({organizationId:this.organizationId,volume:$,candidatePaths:[Q,...KD(Q)]});if(!Y)return{access:"private"};if(!Y.passwordHash)return{access:"public"};return{access:"password",govPath:Y.path,secret:Y.secret??"",passwordHash:Y.passwordHash}}async isPubliclyReadable($,Z){$7($);let Q=k7(Z),X=await this.manifest.get(this.organizationId,$,Q);if(!X||X.kind!=="file")return!1;if(X.readPublic)return!0;return this.manifest.hasPublicAncestorDir(this.organizationId,$,KD(Q))}async inheritsPublic($,Z){return $7($),this.manifest.hasPublicAncestorDir(this.organizationId,$,KD(k7(Z)))}async childrenInheritPublic($,Z){$7($);let Q=k7(Z);if(Q==="")return!1;return this.manifest.hasPublicAncestorDir(this.organizationId,$,[...KD(Q),Q])}async recentWithEffectivePublic($){return this.withEffectivePublic(await this.recent($))}async searchWithEffectivePublic($,Z,Q,X){return this.withEffectivePublic(await this.manifest.searchFiles({organizationId:this.organizationId,query:$,limit:Z,volumes:Q,pathPrefix:X?k7(X):void 0}))}async withEffectivePublic($){let Z=new Map;for(let X of $){let Y=Z.get(X.volume);if(!Y)Y=new Set,Z.set(X.volume,Y);for(let J of KD(X.path))Y.add(J)}let Q=new Map;return await Promise.all([...Z].map(async([X,Y])=>{let J=await this.manifest.publicDirPaths({organizationId:this.organizationId,volume:X,paths:[...Y]});Q.set(X,new Set(J))})),$.map((X)=>{let Y=Q.get(X.volume),J=!!Y&&KD(X.path).some((G)=>Y.has(G));return{...X,effectivePublic:X.readPublic||J}})}async presignRead($,Z,Q){let X=await this.requireFile($,Z);return this.storage.presignedGetUrl(kH($,X.path),Q)}async write($,Z,Q,X){$7($);let Y=k7(Z);if(Y==="")throw new aJ("Cannot write to the volume root");let J=typeof Q==="string"?new TextEncoder().encode(Q):Q;if(J.byteLength>this.maxFileBytes)throw new Xz(`File exceeds the ${this.maxFileBytes}-byte per-file limit`);let[G,W]=await Promise.all([X.skipVolumeQuota?Promise.resolve(null):this.manifest.usage(this.organizationId,$),this.manifest.get(this.organizationId,$,Y)]);if(W?.kind==="dir")throw new aJ(`Cannot write a file at ${Y}: a directory exists there`);if(G){let K=W?.kind==="file"?W.size:0;if(G.bytes-K+J.byteLength>this.volumeQuotaBytes)throw new Xz(`Write would exceed the volume quota of ${this.volumeQuotaBytes} bytes`)}await this.ensureDirs($,Y,X.actor),await this.storage.put(kH($,Y),J,{contentType:X.contentType??V7(Y)});try{return await c8(()=>this.manifest.putFile({organizationId:this.organizationId,volume:$,path:Y,parent:jg(Y),contentHash:Fl1(J),size:J.byteLength,actor:X.actor,threadId:X.threadId??null}))}catch(K){throw console.error("org-fs manifest write lost after object put",{organizationId:this.organizationId,volume:$,path:Y,size:J.byteLength,error:K instanceof Error?K.message:String(K)}),K}}async mkdir($,Z,Q){$7($);let X=k7(Z);if(X==="")return;if((await this.manifest.get(this.organizationId,$,X))?.kind==="file")throw new aJ(`Cannot create a directory at ${X}: a file exists there`);await this.ensureDirs($,X,Q.actor),await this.manifest.putDir({organizationId:this.organizationId,volume:$,path:X,parent:jg(X),actor:Q.actor})}async delete($,Z,Q){$7($);let X=k7(Z);if(X==="")throw new aJ("Cannot delete the volume root");let Y=await this.manifest.get(this.organizationId,$,X);if(!Y)return;if(Y.kind==="dir"){let J=await this.manifest.listSubtreeFiles(this.organizationId,$,X);await Promise.all(J.map((G)=>this.storage.delete(kH($,G.path)))),await this.manifest.tombstoneSubtree(this.organizationId,$,X,Q.actor);return}await this.storage.delete(kH($,X)),await this.manifest.tombstone(this.organizationId,$,X,Q.actor)}async move($,Z,Q,X){$7($);let Y=k7(Z),J=k7(Q);if(Y===""||J==="")throw new aJ("Cannot move the volume root");if(J===Y||J.startsWith(`${Y}/`))throw new aJ(`Cannot move ${Y} onto itself or into its own subtree`);let G=await this.manifest.get(this.organizationId,$,Y);if(!G)throw new lX(`No such path: ${Y}`);if(G.kind==="file"){let H=await this.storage.getBytes(kH($,Y));await this.write($,J,H,{...X,skipVolumeQuota:!0}),await this.delete($,Y,X);return}let[W,K]=await Promise.all([this.manifest.listSubtreeFiles(this.organizationId,$,Y),this.manifest.listSubtreeDirs(this.organizationId,$,Y)]);await this.mkdir($,J,X);for(let H of W){let F=H.path.slice(Y.length+1),U=await this.storage.getBytes(kH($,H.path));await this.write($,`${J}/${F}`,U,{...X,skipVolumeQuota:!0})}for(let H of K){let F=H.path.slice(Y.length+1);await this.mkdir($,`${J}/${F}`,X)}await this.delete($,Y,X)}async filesExist($,Z){$7($);let Q=await this.manifest.liveFilePaths({organizationId:this.organizationId,volume:$,paths:Z.map((X)=>k7(X))});return new Set(Q)}async recent($){return this.manifest.recentFiles({organizationId:this.organizationId,limit:$})}async changes($,Z,Q=Yg8){$7($);let X=Z||"0";if(!/^\d+$/.test(X))throw new aJ(`Invalid cursor: ${Z}`);let Y=await this.manifest.changesSince({organizationId:this.organizationId,volume:$,sinceSeq:X,limit:Q}),J=Y.at(-1);return{entries:Y,cursor:J?J.seq:Z||"0",hasMore:Y.length>=Q}}async latestSeq($){return $7($),this.manifest.latestSeq({organizationId:this.organizationId,volume:$})}async backfillFromStorage($,Z){$7($);let Q=wZ0($),X,Y=0;do{let J=await this.storage.list({prefix:Q,maxKeys:Jg8,continuationToken:X});for(let G of J.objects){let W=G.key.slice(Q.length);if(W==="")continue;await this.ensureDirs($,W,Z.actor);let K=await this.storage.getBytes(G.key);await this.manifest.putFile({organizationId:this.organizationId,volume:$,path:W,parent:jg(W),contentHash:Fl1(K),size:K.byteLength,actor:Z.actor}),Y++}X=J.isTruncated?J.nextContinuationToken:void 0}while(X);return Y}async requireFile($,Z){$7($);let Q=k7(Z),X=await this.manifest.get(this.organizationId,$,Q);if(!X||X.kind!=="file")throw new lX(`No such file: ${Q}`);return X}async ensureDirs($,Z,Q){for(let X of KD(Z))await this.manifest.putDir({organizationId:this.organizationId,volume:$,path:X,parent:jg(X),actor:Q})}}var Yg8=500,Jg8=1000,Gg8=524288000,Wg8=10737418240,Xz,aJ,lX;var DN=D(()=>{D8();iW();Qz();xl0();Xz=class Xz extends Error{constructor($){super($);this.name="OrgFsQuotaError"}};aJ=class aJ extends Error{constructor($){super($);this.name="OrgFsValidationError"}};lX=class lX extends Error{constructor($){super($);this.name="OrgFsNotFoundError"}}});import{z as LN}from"zod";function SH($){return $.startsWith(Ul1)}function HD($){return`${Ul1}${$}`}function Bg8($){let Z=new Map(Ug8.map((Q)=>[Q.set,Q]));if($)try{for(let Q of Ng8.parse(JSON.parse($)))Z.set(Q.set,Q)}catch(Q){console.warn("[org-fs] invalid ORGFS_PUBLIC_SETS \u2014 using built-in defaults only",Q)}return[...Z.values()]}function O3(){return Bg8(E0().orgFsPublicSetsJson)}function sp($){let Z=uX(),Q=Z?rJ(Z,ap):new N3(ap,$.baseUrl);return new B3(Q,$.storage.orgFsEntries,ap)}var ap="org_orgfs_public_skills",Ul1="public-",Hg8,Fg8,Ug8,Ng8;var Yz=D(()=>{U$();WD();wg();DN();Hg8=LN.object({from:LN.string(),to:LN.string().optional()}),Fg8=LN.object({set:LN.string().regex(/^[a-z0-9][a-z0-9-]{0,40}$/),repo:LN.string().regex(/^[\w.-]+\/[\w.-]+$/),ref:LN.string().min(1),paths:LN.array(Hg8).min(1)}),Ug8=[{set:"core",repo:"decocms/studio",ref:"main",paths:[{from:"packages/sandbox/image/skills"}]},{set:"storefront",repo:"decocms/storefront-skills",ref:"main",paths:[{from:".claude-seo/skills"},{from:".claude-performance/skills"},{from:".claude-deco/skills"}]}],Ng8=LN.array(Fg8).refine(($)=>new Set($.map((Z)=>Z.set)).size===$.length,{message:"duplicate set names"})});function wN($){if(typeof $==="string")return $.length>0?[$]:[];if(Array.isArray($))return $.flatMap(wN);if($!==null&&typeof $==="object")return Object.values($).flatMap(wN);return[]}var y0;var U5=D(()=>{y0=class y0 extends Error{provider;status;retryAfterMs;constructor($){super($.message,{cause:$.cause});this.name="GitProviderError",this.provider=$.provider,this.status=$.status,this.retryAfterMs=$.retryAfterMs??null}get isRateLimited(){return this.status===429||this.retryAfterMs!==null}get isAuthFailure(){return this.status===401||this.status===403}}});import{sql as Jz}from"kysely";function fl0($){if($===null)return null;return $ instanceof Date?$.toISOString():String($)}function pW($){return{organizationId:$.organization_id,volume:$.volume,path:$.path,parent:$.parent,kind:$.kind,contentHash:$.content_hash,size:Number($.size),seq:String($.seq),deletedAt:fl0($.deleted_at),createdBy:$.created_by,createdAt:fl0($.created_at)??"",updatedBy:$.updated_by,updatedAt:fl0($.updated_at)??"",threadId:$.thread_id,readPublic:$.read_public,shareMode:!$.read_public?"private":$.share_password_hash?"password":"public"}}class $n{db;constructor($){this.db=$}async putFile($){let Z=new Date,Q=$.threadId??null,X=await this.db.insertInto("org_fs_entry").values({organization_id:$.organizationId,volume:$.volume,path:$.path,parent:$.parent,kind:"file",content_hash:$.contentHash,size:$.size,deleted_at:null,created_by:$.actor,created_at:Z,updated_by:$.actor,updated_at:Z,thread_id:Q}).onConflict((Y)=>Y.columns(["organization_id","volume","path"]).doUpdateSet({kind:"file",content_hash:$.contentHash,size:$.size,deleted_at:null,updated_by:$.actor,updated_at:Z,seq:EZ0,read_public:Jz`case when org_fs_entry.deleted_at is not null then false else org_fs_entry.read_public end`,thread_id:Jz`coalesce(cast(${Q} as text), org_fs_entry.thread_id)`})).returning(nW).executeTakeFirstOrThrow();return pW(X)}async putDir($){let Z=new Date;await this.db.insertInto("org_fs_entry").values({organization_id:$.organizationId,volume:$.volume,path:$.path,parent:$.parent,kind:"dir",content_hash:null,size:0,deleted_at:null,created_by:$.actor,created_at:Z,updated_by:$.actor,updated_at:Z}).onConflict((Q)=>Q.columns(["organization_id","volume","path"]).where("org_fs_entry.deleted_at","is not",null).doUpdateSet({kind:"dir",content_hash:null,size:0,deleted_at:null,updated_by:$.actor,updated_at:Z,seq:EZ0,read_public:Jz`case when org_fs_entry.deleted_at is not null then false else org_fs_entry.read_public end`})).execute()}async get($,Z,Q){let X=await this.db.selectFrom("org_fs_entry").where("organization_id","=",$).where("volume","=",Z).where("path","=",Q).where("deleted_at","is",null).select(nW).executeTakeFirst();return X?pW(X):null}async listDir($,Z,Q){return(await this.db.selectFrom("org_fs_entry").where("organization_id","=",$).where("volume","=",Z).where("parent","=",Q).where("deleted_at","is",null).select(nW).orderBy("path","asc").execute()).map((Y)=>pW(Y))}async listVolumeDirs($,Z){return(await this.db.selectFrom("org_fs_entry").where("organization_id","=",$).where("volume","=",Z).where("kind","=","dir").where("deleted_at","is",null).select(nW).execute()).map((X)=>pW(X))}async listVolumeFiles($,Z){return(await this.db.selectFrom("org_fs_entry").where("organization_id","=",$).where("volume","=",Z).where("kind","=","file").where("deleted_at","is",null).select(nW).execute()).map((X)=>pW(X))}async listSubtreeFiles($,Z,Q){return(await this.db.selectFrom("org_fs_entry").where("organization_id","=",$).where("volume","=",Z).where("kind","=","file").where("deleted_at","is",null).where("path","like",`${ep(Q)}/%`).select(nW).execute()).map((Y)=>pW(Y))}async listSubtreeDirs($,Z,Q){return(await this.db.selectFrom("org_fs_entry").where("organization_id","=",$).where("volume","=",Z).where("kind","=","dir").where("deleted_at","is",null).where("path","like",`${ep(Q)}/%`).select(nW).execute()).map((Y)=>pW(Y))}async tombstone($,Z,Q,X){await this.db.updateTable("org_fs_entry").set({deleted_at:new Date,updated_by:X,updated_at:new Date,seq:EZ0}).where("organization_id","=",$).where("volume","=",Z).where("path","=",Q).where("deleted_at","is",null).execute()}async tombstoneSubtree($,Z,Q,X){await this.db.updateTable("org_fs_entry").set({deleted_at:new Date,updated_by:X,updated_at:new Date,seq:EZ0}).where("organization_id","=",$).where("volume","=",Z).where("deleted_at","is",null).where((Y)=>Y.or([Y("path","=",Q),Y("path","like",`${ep(Q)}/%`)])).execute()}async setShareMode($){let Z=new Date,Q=await this.db.updateTable("org_fs_entry").set({read_public:$.readPublic,share_password_hash:$.passwordHash,share_secret:$.shareSecret,updated_by:$.actor,updated_at:Z}).where("organization_id","=",$.organizationId).where("volume","=",$.volume).where("path","=",$.path).where("deleted_at","is",null).returning(nW).executeTakeFirst();return Q?pW(Q):null}async resolveGoverningShare($){if($.candidatePaths.length===0)return null;let Z=await this.db.selectFrom("org_fs_entry").where("organization_id","=",$.organizationId).where("volume","=",$.volume).where("read_public","=",!0).where("deleted_at","is",null).where("path","in",$.candidatePaths).select(["path","share_password_hash","share_secret"]).execute();if(Z.length===0)return null;Z.sort((X,Y)=>Y.path.length-X.path.length);let Q=Z[0];return{path:Q.path,passwordHash:Q.share_password_hash,secret:Q.share_secret}}async hasPublicAncestorDir($,Z,Q){if(Q.length===0)return!1;return!!await this.db.selectFrom("org_fs_entry").where("organization_id","=",$).where("volume","=",Z).where("kind","=","dir").where("read_public","=",!0).where("deleted_at","is",null).where("path","in",Q).select("path").limit(1).executeTakeFirst()}async publicDirPaths($){if($.paths.length===0)return[];return(await this.db.selectFrom("org_fs_entry").where("organization_id","=",$.organizationId).where("volume","=",$.volume).where("kind","=","dir").where("read_public","=",!0).where("deleted_at","is",null).where("path","in",$.paths).select("path").execute()).map((Q)=>Q.path)}async usage($,Z){let Q=await this.db.selectFrom("org_fs_entry").where("organization_id","=",$).where("volume","=",Z).where("kind","=","file").where("deleted_at","is",null).select((X)=>[X.fn.countAll().as("files"),X.fn.coalesce(X.fn.sum("size"),Jz`0`).as("bytes")]).executeTakeFirst();return{files:Number(Q?.files??0),bytes:Number(Q?.bytes??0)}}async liveFilePaths($){if($.paths.length===0)return[];return(await this.db.selectFrom("org_fs_entry").where("organization_id","=",$.organizationId).where("volume","=",$.volume).where("kind","=","file").where("deleted_at","is",null).where("path","in",$.paths).select(["path"]).execute()).map((Q)=>Q.path)}async recentFiles($){return(await this.db.selectFrom("org_fs_entry").where("organization_id","=",$.organizationId).where("kind","=","file").where("deleted_at","is",null).select(nW).orderBy("seq","desc").limit($.limit).execute()).map((Q)=>pW(Q))}async searchFiles($){if($.volumes&&$.volumes.length===0)return[];let Z=ep($.query),Q=this.db.selectFrom("org_fs_entry").where("organization_id","=",$.organizationId).where("kind","=","file").where("deleted_at","is",null).where("path","ilike",`%${Z}%`);if($.volumes)Q=Q.where("volume","in",$.volumes);if($.pathPrefix)Q=Q.where("path","like",`${ep($.pathPrefix)}/%`);return(await Q.select(nW).orderBy("seq","desc").limit($.limit).execute()).map((Y)=>pW(Y))}async changesSince($){return(await this.db.selectFrom("org_fs_entry").where("organization_id","=",$.organizationId).where("volume","=",$.volume).where("seq",">",Jz`cast(${$.sinceSeq} as bigint)`).select(nW).orderBy("seq","asc").limit($.limit).execute()).map((Q)=>pW(Q))}async latestSeq($){return(await this.db.selectFrom("org_fs_entry").where("organization_id","=",$.organizationId).where("volume","=",$.volume).select(Jz`max(seq)`.as("seq")).executeTakeFirst())?.seq??"0"}}function ep($){return $.replace(/[\\%_]/g,"\\$&")}var nW,EZ0;var yl0=D(()=>{nW=["organization_id","volume","path","parent","kind","content_hash","size","seq","deleted_at","created_by","created_at","updated_by","updated_at","thread_id","read_public","share_password_hash"],EZ0=Jz`nextval('org_fs_entry_seq')`});import{createHash as Og8}from"crypto";import{gunzipSync as Dg8}from"zlib";function hl0($,Z,Q){let X=Z,Y=Z+Q;while(X<Y&&$[X]!==0)X++;return new TextDecoder().decode($.subarray(Z,X))}function wg8($,Z,Q){let X=hl0($,Z,Q).trim();return X===""?0:Number.parseInt(X,8)}function jg8($){let Z=new Map,Q=0,X=null,Y=null;while(Q+512<=$.length){let J=$.subarray(Q,Q+512);if(Q+=512,J.every((N)=>N===0))break;let G=hl0(J,0,100),W=hl0(J,345,155);if(W)G=`${W}/${G}`;let K=wg8(J,124,12),H=String.fromCharCode(J[156]??0),F=$.subarray(Q,Q+K);if(Q+=Math.ceil(K/512)*512,H==="L"){let N=new TextDecoder().decode(F),B=N.indexOf("\x00");X=B===-1?N:N.slice(0,B);continue}if(H==="x"){let N=new TextDecoder().decode(F);Y=/(?:^|\n)\d+ path=([^\n]*)\n/.exec(N)?.[1]??null;continue}if(H==="g")continue;let U=Y??X??G;if(X=null,Y=null,H==="0"||H==="\x00"||H==="")Z.set(U,new Uint8Array(F))}return Z}function Eg8($,Z,Q){let X=encodeURIComponent(Z);if(!Q)return{url:`https://codeload.github.com/${$}/tar.gz/${X}`,headers:{}};return{url:`https://api.github.com/repos/${$}/tarball/${X}`,headers:{Authorization:`Bearer ${Q}`,Accept:"application/vnd.github+json"}}}function Nl1($,Z){if($.length>Eg)throw Error(`tarball for ${Z} exceeds ${Eg} bytes`);let Q=jg8(new Uint8Array(Dg8($,{maxOutputLength:Lg8}))),X=new Map;for(let[Y,J]of Q){let G=Y.indexOf("/");if(G===-1)continue;let W=Y.slice(G+1);if(W)X.set(W,J)}return X}function Bl1($,Z,Q){if($>Z)throw Error(`tarball for ${Q} exceeds ${Z} bytes`)}async function zg8($,Z){let Q=[],X=0,Y=$.getReader();try{while(!0){let{done:W,value:K}=await Y.read();if(W)break;X+=K.length,Bl1(X,Eg,Z),Q.push(K)}}finally{await Y.cancel().catch(()=>{}),Y.releaseLock()}let J=new Uint8Array(X),G=0;for(let W of Q)J.set(W,G),G+=W.length;return J}function Ol1($){if($ instanceof ul0)return $.status>=500||$.status===429;if($ instanceof y0)return $.status===0||$.status>=500||$.status===429;if($ instanceof Error&&/declares .* bytes|exceeds .* bytes/.test($.message))return!1;return!0}async function Pg8($,Z,Q){let{url:X,headers:Y}=Eg8($,Z,Q),J=`${$}@${Z}`,G=async()=>{let W=await fetch(X,{headers:Y,signal:AbortSignal.timeout(60000)});if(!W.ok)throw await W.body?.cancel().catch(()=>{}),new ul0(W.status,`tarball fetch failed for ${J}: HTTP ${W.status}`);let K=Number(W.headers.get("content-length")??0);if(K>Eg)throw Error(`tarball for ${J} declares ${K} bytes (cap ${Eg})`);let H=new Uint8Array(await W.arrayBuffer());return Bl1(H.length,Eg,J),H};try{let W=await c8(G,{maxAttempts:3,minTimeout:500,maxTimeout:4000,jitter:0.5,isRetriable:Ol1});return Nl1(W,J)}catch(W){if(W instanceof u5)throw W.cause instanceof Error?W.cause:W;throw W}}async function Ag8($,Z){if(!Z.tarball)return Pg8($.repo,$.ref,Z.authToken);let Q=Z.tarball,X=`${$.repo}@${$.ref}`,Y;try{Y=await c8(()=>Q(),{maxAttempts:3,minTimeout:500,maxTimeout:4000,jitter:0.5,isRetriable:Ol1})}catch(J){throw J instanceof u5&&J.cause instanceof Error?J.cause:J}if(!Y)throw Error(`tarball not found for ${X}`);return Nl1(await zg8(Y,X),X)}function Tg8($,Z){let Q=new Map;for(let{from:X,to:Y}of Z){let J=X===""?"":`${X.replace(/\/+$/,"")}/`;for(let[G,W]of $){if(!G.startsWith(J))continue;let K=G.slice(J.length);if(!K)continue;let H=k7(Y?`${Y}/${K}`:K);if(H)Q.set(H,W)}}return Q}function Rg8($,Z){let Q=new Set;for(let J of $){let G=J.split("/");for(let W=1;W<G.length;W++)Q.add(G.slice(0,W).join("/"))}let X=[...Z].filter((J)=>!Q.has(J)).sort((J,G)=>J.length-G.length),Y=[];for(let J of X)if(!Y.some((G)=>J.startsWith(`${G}/`)))Y.push(J);return Y}function qg8($){return Og8("sha256").update($).digest("hex")}function Mg8($){return $.manifestHash===$.hash&&$.storedPaths.has($.path)}async function Ig8($,Z){let Q=wZ0(Z),X=new Set,Y;do{let J=await $.list({prefix:Q,continuationToken:Y});for(let G of J.objects)X.add(G.key.slice(Q.length));Y=J.nextContinuationToken}while(Y);return X}async function ll0($,Z){let{orgId:Q,volume:X,source:Y}=Z,J=uX(),G=J?rJ(J,Q):new N3(Q,Z.baseUrl),W=new $n($),K=new B3(G,W,Q),H=Tg8(await Ag8(Y,Z),Y.paths),F=new Map((await W.listVolumeFiles(Q,X)).map((w)=>[w.path,w.contentHash]));if(H.size===0&&F.size>0)throw Error(`volume "${X}" resolved 0 files from ${Y.repo}@${Y.ref} `+`(check paths config) \u2014 refusing to delete the ${F.size} existing files`);let U=0;for(let w of F.keys()){if(H.has(w))continue;await K.delete(X,w,{actor:gl0}),U++}let N=await W.listVolumeDirs(Q,X);for(let w of Rg8(H.keys(),N.map((j)=>j.path)))await K.delete(X,w,{actor:gl0});let B=0,O=0,L=await Ig8(G,X);for(let[w,j]of H){if(Mg8({hash:qg8(j),manifestHash:F.get(w),storedPaths:L,path:w})){O++;continue}await K.write(X,w,j,{actor:gl0,contentType:V7(w),skipVolumeQuota:Z.skipVolumeQuota}),B++}return{written:B,deleted:U,unchanged:O}}async function Vg8($,Z,Q){let X=await ll0($,{orgId:ap,baseUrl:Q.baseUrl,volume:HD(Z.set),source:Z,skipVolumeQuota:!0});return{set:Z.set,...X}}async function cl0($,Z,Q){try{return await Vg8($,Z,Q)}catch(X){return{set:Z.set,error:X instanceof Error?X.message:String(X)}}}async function Dl1($,Z){let Q=[];for(let X of O3())Q.push(await cl0($,X,Z));return Q}var gl0="system:skill-set-sync",Eg=209715200,Lg8=1073741824,ul0;var zZ0=D(()=>{D8();U5();yl0();wg();WD();iW();DN();Qz();Yz();ul0=class ul0 extends Error{status;constructor($,Z){super(Z);this.status=$;this.name="TarballHttpError"}}});import{DBOS as PZ0,SchedulerMode as kg8}from"@dbos-inc/dbos-sdk";function Ll1($){dl0=$}function Cg8(){if(!dl0)throw Error("[org-fs] public-sets sync runtime not initialized \u2014 setPublicSetsSyncRuntime() must run before the workflow fires");return dl0}async function _g8($,Z){for(let Q of O3()){let X=await PZ0.runStep(()=>{let Y=Cg8();return cl0(Y.db,Q,{baseUrl:Y.baseUrl})},{name:`syncPublicSet:${Q.set}`});if("error"in X)console.warn(`[org-fs] public set "${X.set}" sync failed: ${X.error}`);else if(X.written||X.deleted)console.log(`[org-fs] public set "${X.set}" synced: +${X.written} -${X.deleted} (=${X.unchanged})`)}}function wl1(){if(Zn)return;Zn=PZ0.registerWorkflow(_g8,{name:"publicSetsSyncWorkflow"}),PZ0.registerScheduled(Zn,{name:"publicSetsSyncWorkflow",crontab:Sg8,mode:kg8.ExactlyOncePerIntervalWhenActive})}async function jl1(){if(O3().length===0||!Zn)return;let $=new Date,Z=`public-sets-sync-boot:${$.toISOString().slice(0,13)}`;await PZ0.startWorkflow(Zn,{workflowID:Z})($,$)}var Sg8="4-59/10 * * * *",dl0=null,Zn=null;var El1=D(()=>{Yz();zZ0()});import{jwtVerify as vg8,SignJWT as zl1}from"jose";import{randomBytes as bg8}from"crypto";function Pl1(){if(Qn)return Qn;let $=E0(),Z=$.studioJwtSecret??$.betterAuthSecret;if(Z)Qn=new TextEncoder().encode(Z);else console.warn("STUDIO_JWT_SECRET not set - generating random secret (not persistent)"),Qn=new Uint8Array(bg8(32));return Qn}async function Al1($,Z="5m"){let Q=Pl1();return await new zl1($).setProtectedHeader({alg:"HS256",typ:"JWT"}).setIssuedAt().setExpirationTime(Z).sign(Q)}async function ml0($){try{let Z=Pl1(),{payload:Q}=await vg8($,Z);return Q}catch{return}}async function WQ($,Z,Q=3600){let X=E0(),Y=X.plansEnabled?X.studioJwtSecret:X.studioJwtSecret??X.betterAuthSecret;if(!Y)throw Error(X.plansEnabled?"STUDIO_JWT_SECRET (or MESH_JWT_SECRET) is required to mint gateway JWTs when STUDIO_PLANS_ENABLED is set \u2014 BETTER_AUTH_SECRET is deliberately not a fallback, see resolve-config":"A deterministic JWT secret is required to mint gateway JWTs \u2014 set STUDIO_JWT_SECRET or BETTER_AUTH_SECRET");let J=new TextEncoder().encode(Y);return await new zl1({iss:"mesh",sub:$,...Z&&{email:Z}}).setProtectedHeader({alg:"HS256",typ:"JWT"}).setIssuedAt().setExpirationTime(Math.floor(Date.now()/1000)+Q).sign(J)}var Qn=null;var tW=D(()=>{U$()});import{createCipheriv as xg8,createDecipheriv as fg8,createHash as yg8,randomBytes as Tl1}from"crypto";class sJ{key;constructor($){if(Buffer.from($,"base64").length===Ml1)this.key=Buffer.from($,"base64");else this.key=yg8("sha256").update($).digest()}async encrypt($){let Z=Tl1(Xn),Q=xg8(Rl1,this.key,Z),X=Q.update($,"utf8");X=Buffer.concat([X,Q.final()]);let Y=Q.getAuthTag();return Buffer.concat([Z,Y,X]).toString("base64")}async decrypt($){let Z=Buffer.from($,"base64"),Q=Z.subarray(0,Xn),X=Z.subarray(Xn,Xn+ql1),Y=Z.subarray(Xn+ql1),J=fg8(Rl1,this.key,Q);J.setAuthTag(X);let G=J.update(Y);return G=Buffer.concat([G,J.final()]),G.toString("utf8")}static generateKey(){return Tl1(Ml1).toString("base64")}}var Rl1="aes-256-gcm",Xn=16,ql1=16,Ml1=32;var Gz=()=>{};function p9(){let $=E0();if($.baseUrl)return $.baseUrl;return`http://localhost:${$.port??3000}`}function Il1(){return`http://localhost:${E0().port??3000}`}function S5(){return E0().publicUrl??p9()}var D9=D(()=>{U$()});import*as f from"zod/v4";function dl1($){if($.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${$.params.ref.type}`)}function ml1($){if($.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${$.params.ref.type}`)}var FD="2025-11-25",Vl1="2025-03-26",UD,ND="io.modelcontextprotocol/related-task",TZ0="2.0",Z7,kl1,Sl1,$G5,gg8,hg8,il0,eJ,Yn,Cl1=($)=>Yn.safeParse($).success,KQ,D3,L3,HQ,RZ0,_l1,CH=($)=>_l1.safeParse($).success,vl1,bl1=($)=>vl1.safeParse($).success,pl0,oW=($)=>pl0.safeParse($).success,v1,nl0,Pg=($)=>nl0.safeParse($).success,$G,ZG5,jN,ug8,qZ0,lg8,Jn,zg,xl1,cg8,dg8,mg8,ig8,pg8,ng8,MZ0,tl0=($)=>MZ0.safeParse($).success,tg8,ol0,IZ0,fl1=($)=>IZ0.safeParse($).success,VZ0,og8,rg8,kZ0,ag8,Gn,Wn,sg8,Kn,EN,eg8,Hn,SZ0,CZ0,_Z0,QG5,vZ0,bZ0,xZ0,yl1,gl1,hl1,rl0,ul1,Fn,Ag,ll1,$h8,BD,al0,OD,sl0,el0,Zh8,Tg,$c0,Zc0,Qh8,Xh8,Yh8,Jh8,Gh8,Wh8,Kh8,Hh8,DD,Qc0,Fh8,Rg,Xc0,Yc0,Jc0,Uh8,Nh8,Bh8,Gc0,Oh8,Wc0,Kc0,Dh8,Lh8,fZ0,qg,Un,_H,XG5,wh8,LD,Hc0,cl1,Nn,jh8,Fc0,Eh8,zh8,Ph8,Ah8,Th8,Rh8,qh8,AZ0,Mh8,Ih8,Uc0,Wz,Bn,Vh8,kh8,Sh8,Ch8,_h8,vh8,bh8,xh8,fh8,yh8,gh8,hh8,uh8,lh8,ch8,Nc0,dh8,mh8,wD,ih8,ph8,nh8,yZ0,Bc0,th8,oh8,Oc0,rh8,YG5,JG5,GG5,WG5,KG5,HG5,I1,il1;var n9=D(()=>{UD=[FD,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Z7=f.custom(($)=>$!==null&&(typeof $==="object"||typeof $==="function")),kl1=f.union([f.string(),f.number().int()]),Sl1=f.string(),$G5=f.looseObject({ttl:f.number().optional(),pollInterval:f.number().optional()}),gg8=f.object({ttl:f.number().optional()}),hg8=f.object({taskId:f.string()}),il0=f.looseObject({progressToken:kl1.optional(),[ND]:hg8.optional()}),eJ=f.object({_meta:il0.optional()}),Yn=eJ.extend({task:gg8.optional()}),KQ=f.object({method:f.string(),params:eJ.loose().optional()}),D3=f.object({_meta:il0.optional()}),L3=f.object({method:f.string(),params:D3.loose().optional()}),HQ=f.looseObject({_meta:il0.optional()}),RZ0=f.union([f.string(),f.number().int()]),_l1=f.object({jsonrpc:f.literal(TZ0),id:RZ0,...KQ.shape}).strict(),vl1=f.object({jsonrpc:f.literal(TZ0),...L3.shape}).strict(),pl0=f.object({jsonrpc:f.literal(TZ0),id:RZ0,result:HQ}).strict();(function($){$[$.ConnectionClosed=-32000]="ConnectionClosed",$[$.RequestTimeout=-32001]="RequestTimeout",$[$.ParseError=-32700]="ParseError",$[$.InvalidRequest=-32600]="InvalidRequest",$[$.MethodNotFound=-32601]="MethodNotFound",$[$.InvalidParams=-32602]="InvalidParams",$[$.InternalError=-32603]="InternalError",$[$.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(v1||(v1={}));nl0=f.object({jsonrpc:f.literal(TZ0),id:RZ0.optional(),error:f.object({code:f.number().int(),message:f.string(),data:f.unknown().optional()})}).strict(),$G=f.union([_l1,vl1,pl0,nl0]),ZG5=f.union([pl0,nl0]),jN=HQ.strict(),ug8=D3.extend({requestId:RZ0.optional(),reason:f.string().optional()}),qZ0=L3.extend({method:f.literal("notifications/cancelled"),params:ug8}),lg8=f.object({src:f.string(),mimeType:f.string().optional(),sizes:f.array(f.string()).optional(),theme:f.enum(["light","dark"]).optional()}),Jn=f.object({icons:f.array(lg8).optional()}),zg=f.object({name:f.string(),title:f.string().optional()}),xl1=zg.extend({...zg.shape,...Jn.shape,version:f.string(),websiteUrl:f.string().optional(),description:f.string().optional()}),cg8=f.intersection(f.object({applyDefaults:f.boolean().optional()}),f.record(f.string(),f.unknown())),dg8=f.preprocess(($)=>{if($&&typeof $==="object"&&!Array.isArray($)){if(Object.keys($).length===0)return{form:{}}}return $},f.intersection(f.object({form:cg8.optional(),url:Z7.optional()}),f.record(f.string(),f.unknown()).optional())),mg8=f.looseObject({list:Z7.optional(),cancel:Z7.optional(),requests:f.looseObject({sampling:f.looseObject({createMessage:Z7.optional()}).optional(),elicitation:f.looseObject({create:Z7.optional()}).optional()}).optional()}),ig8=f.looseObject({list:Z7.optional(),cancel:Z7.optional(),requests:f.looseObject({tools:f.looseObject({call:Z7.optional()}).optional()}).optional()}),pg8=f.object({experimental:f.record(f.string(),Z7).optional(),sampling:f.object({context:Z7.optional(),tools:Z7.optional()}).optional(),elicitation:dg8.optional(),roots:f.object({listChanged:f.boolean().optional()}).optional(),tasks:mg8.optional(),extensions:f.record(f.string(),Z7).optional()}),ng8=eJ.extend({protocolVersion:f.string(),capabilities:pg8,clientInfo:xl1}),MZ0=KQ.extend({method:f.literal("initialize"),params:ng8}),tg8=f.object({experimental:f.record(f.string(),Z7).optional(),logging:Z7.optional(),completions:Z7.optional(),prompts:f.object({listChanged:f.boolean().optional()}).optional(),resources:f.object({subscribe:f.boolean().optional(),listChanged:f.boolean().optional()}).optional(),tools:f.object({listChanged:f.boolean().optional()}).optional(),tasks:ig8.optional(),extensions:f.record(f.string(),Z7).optional()}),ol0=HQ.extend({protocolVersion:f.string(),capabilities:tg8,serverInfo:xl1,instructions:f.string().optional()}),IZ0=L3.extend({method:f.literal("notifications/initialized"),params:D3.optional()}),VZ0=KQ.extend({method:f.literal("ping"),params:eJ.optional()}),og8=f.object({progress:f.number(),total:f.optional(f.number()),message:f.optional(f.string())}),rg8=f.object({...D3.shape,...og8.shape,progressToken:kl1}),kZ0=L3.extend({method:f.literal("notifications/progress"),params:rg8}),ag8=eJ.extend({cursor:Sl1.optional()}),Gn=KQ.extend({params:ag8.optional()}),Wn=HQ.extend({nextCursor:Sl1.optional()}),sg8=f.enum(["working","input_required","completed","failed","cancelled"]),Kn=f.object({taskId:f.string(),status:sg8,ttl:f.union([f.number(),f.null()]),createdAt:f.string(),lastUpdatedAt:f.string(),pollInterval:f.optional(f.number()),statusMessage:f.optional(f.string())}),EN=HQ.extend({task:Kn}),eg8=D3.merge(Kn),Hn=L3.extend({method:f.literal("notifications/tasks/status"),params:eg8}),SZ0=KQ.extend({method:f.literal("tasks/get"),params:eJ.extend({taskId:f.string()})}),CZ0=HQ.merge(Kn),_Z0=KQ.extend({method:f.literal("tasks/result"),params:eJ.extend({taskId:f.string()})}),QG5=HQ.loose(),vZ0=Gn.extend({method:f.literal("tasks/list")}),bZ0=Wn.extend({tasks:f.array(Kn)}),xZ0=KQ.extend({method:f.literal("tasks/cancel"),params:eJ.extend({taskId:f.string()})}),yl1=HQ.merge(Kn),gl1=f.object({uri:f.string(),mimeType:f.optional(f.string()),_meta:f.record(f.string(),f.unknown()).optional()}),hl1=gl1.extend({text:f.string()}),rl0=f.string().refine(($)=>{try{return atob($),!0}catch{return!1}},{message:"Invalid Base64 string"}),ul1=gl1.extend({blob:rl0}),Fn=f.enum(["user","assistant"]),Ag=f.object({audience:f.array(Fn).optional(),priority:f.number().min(0).max(1).optional(),lastModified:f.iso.datetime({offset:!0}).optional()}),ll1=f.object({...zg.shape,...Jn.shape,uri:f.string(),description:f.optional(f.string()),mimeType:f.optional(f.string()),size:f.optional(f.number()),annotations:Ag.optional(),_meta:f.optional(f.looseObject({}))}),$h8=f.object({...zg.shape,...Jn.shape,uriTemplate:f.string(),description:f.optional(f.string()),mimeType:f.optional(f.string()),annotations:Ag.optional(),_meta:f.optional(f.looseObject({}))}),BD=Gn.extend({method:f.literal("resources/list")}),al0=Wn.extend({resources:f.array(ll1)}),OD=Gn.extend({method:f.literal("resources/templates/list")}),sl0=Wn.extend({resourceTemplates:f.array($h8)}),el0=eJ.extend({uri:f.string()}),Zh8=el0,Tg=KQ.extend({method:f.literal("resources/read"),params:Zh8}),$c0=HQ.extend({contents:f.array(f.union([hl1,ul1]))}),Zc0=L3.extend({method:f.literal("notifications/resources/list_changed"),params:D3.optional()}),Qh8=el0,Xh8=KQ.extend({method:f.literal("resources/subscribe"),params:Qh8}),Yh8=el0,Jh8=KQ.extend({method:f.literal("resources/unsubscribe"),params:Yh8}),Gh8=D3.extend({uri:f.string()}),Wh8=L3.extend({method:f.literal("notifications/resources/updated"),params:Gh8}),Kh8=f.object({name:f.string(),description:f.optional(f.string()),required:f.optional(f.boolean())}),Hh8=f.object({...zg.shape,...Jn.shape,description:f.optional(f.string()),arguments:f.optional(f.array(Kh8)),_meta:f.optional(f.looseObject({}))}),DD=Gn.extend({method:f.literal("prompts/list")}),Qc0=Wn.extend({prompts:f.array(Hh8)}),Fh8=eJ.extend({name:f.string(),arguments:f.record(f.string(),f.string()).optional()}),Rg=KQ.extend({method:f.literal("prompts/get"),params:Fh8}),Xc0=f.object({type:f.literal("text"),text:f.string(),annotations:Ag.optional(),_meta:f.record(f.string(),f.unknown()).optional()}),Yc0=f.object({type:f.literal("image"),data:rl0,mimeType:f.string(),annotations:Ag.optional(),_meta:f.record(f.string(),f.unknown()).optional()}),Jc0=f.object({type:f.literal("audio"),data:rl0,mimeType:f.string(),annotations:Ag.optional(),_meta:f.record(f.string(),f.unknown()).optional()}),Uh8=f.object({type:f.literal("tool_use"),name:f.string(),id:f.string(),input:f.record(f.string(),f.unknown()),_meta:f.record(f.string(),f.unknown()).optional()}),Nh8=f.object({type:f.literal("resource"),resource:f.union([hl1,ul1]),annotations:Ag.optional(),_meta:f.record(f.string(),f.unknown()).optional()}),Bh8=ll1.extend({type:f.literal("resource_link")}),Gc0=f.union([Xc0,Yc0,Jc0,Bh8,Nh8]),Oh8=f.object({role:Fn,content:Gc0}),Wc0=HQ.extend({description:f.string().optional(),messages:f.array(Oh8)}),Kc0=L3.extend({method:f.literal("notifications/prompts/list_changed"),params:D3.optional()}),Dh8=f.object({title:f.string().optional(),readOnlyHint:f.boolean().optional(),destructiveHint:f.boolean().optional(),idempotentHint:f.boolean().optional(),openWorldHint:f.boolean().optional()}),Lh8=f.object({taskSupport:f.enum(["required","optional","forbidden"]).optional()}),fZ0=f.object({...zg.shape,...Jn.shape,description:f.string().optional(),inputSchema:f.object({type:f.literal("object"),properties:f.record(f.string(),Z7).optional(),required:f.array(f.string()).optional()}).catchall(f.unknown()),outputSchema:f.object({type:f.literal("object"),properties:f.record(f.string(),Z7).optional(),required:f.array(f.string()).optional()}).catchall(f.unknown()).optional(),annotations:Dh8.optional(),execution:Lh8.optional(),_meta:f.record(f.string(),f.unknown()).optional()}),qg=Gn.extend({method:f.literal("tools/list")}),Un=Wn.extend({tools:f.array(fZ0)}),_H=HQ.extend({content:f.array(Gc0).default([]),structuredContent:f.record(f.string(),f.unknown()).optional(),isError:f.boolean().optional()}),XG5=_H.or(HQ.extend({toolResult:f.unknown()})),wh8=Yn.extend({name:f.string(),arguments:f.record(f.string(),f.unknown()).optional()}),LD=KQ.extend({method:f.literal("tools/call"),params:wh8}),Hc0=L3.extend({method:f.literal("notifications/tools/list_changed"),params:D3.optional()}),cl1=f.object({autoRefresh:f.boolean().default(!0),debounceMs:f.number().int().nonnegative().default(300)}),Nn=f.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),jh8=eJ.extend({level:Nn}),Fc0=KQ.extend({method:f.literal("logging/setLevel"),params:jh8}),Eh8=D3.extend({level:Nn,logger:f.string().optional(),data:f.unknown()}),zh8=L3.extend({method:f.literal("notifications/message"),params:Eh8}),Ph8=f.object({name:f.string().optional()}),Ah8=f.object({hints:f.array(Ph8).optional(),costPriority:f.number().min(0).max(1).optional(),speedPriority:f.number().min(0).max(1).optional(),intelligencePriority:f.number().min(0).max(1).optional()}),Th8=f.object({mode:f.enum(["auto","required","none"]).optional()}),Rh8=f.object({type:f.literal("tool_result"),toolUseId:f.string().describe("The unique identifier for the corresponding tool call."),content:f.array(Gc0).default([]),structuredContent:f.object({}).loose().optional(),isError:f.boolean().optional(),_meta:f.record(f.string(),f.unknown()).optional()}),qh8=f.discriminatedUnion("type",[Xc0,Yc0,Jc0]),AZ0=f.discriminatedUnion("type",[Xc0,Yc0,Jc0,Uh8,Rh8]),Mh8=f.object({role:Fn,content:f.union([AZ0,f.array(AZ0)]),_meta:f.record(f.string(),f.unknown()).optional()}),Ih8=Yn.extend({messages:f.array(Mh8),modelPreferences:Ah8.optional(),systemPrompt:f.string().optional(),includeContext:f.enum(["none","thisServer","allServers"]).optional(),temperature:f.number().optional(),maxTokens:f.number().int(),stopSequences:f.array(f.string()).optional(),metadata:Z7.optional(),tools:f.array(fZ0).optional(),toolChoice:Th8.optional()}),Uc0=KQ.extend({method:f.literal("sampling/createMessage"),params:Ih8}),Wz=HQ.extend({model:f.string(),stopReason:f.optional(f.enum(["endTurn","stopSequence","maxTokens"]).or(f.string())),role:Fn,content:qh8}),Bn=HQ.extend({model:f.string(),stopReason:f.optional(f.enum(["endTurn","stopSequence","maxTokens","toolUse"]).or(f.string())),role:Fn,content:f.union([AZ0,f.array(AZ0)])}),Vh8=f.object({type:f.literal("boolean"),title:f.string().optional(),description:f.string().optional(),default:f.boolean().optional()}),kh8=f.object({type:f.literal("string"),title:f.string().optional(),description:f.string().optional(),minLength:f.number().optional(),maxLength:f.number().optional(),format:f.enum(["email","uri","date","date-time"]).optional(),default:f.string().optional()}),Sh8=f.object({type:f.enum(["number","integer"]),title:f.string().optional(),description:f.string().optional(),minimum:f.number().optional(),maximum:f.number().optional(),default:f.number().optional()}),Ch8=f.object({type:f.literal("string"),title:f.string().optional(),description:f.string().optional(),enum:f.array(f.string()),default:f.string().optional()}),_h8=f.object({type:f.literal("string"),title:f.string().optional(),description:f.string().optional(),oneOf:f.array(f.object({const:f.string(),title:f.string()})),default:f.string().optional()}),vh8=f.object({type:f.literal("string"),title:f.string().optional(),description:f.string().optional(),enum:f.array(f.string()),enumNames:f.array(f.string()).optional(),default:f.string().optional()}),bh8=f.union([Ch8,_h8]),xh8=f.object({type:f.literal("array"),title:f.string().optional(),description:f.string().optional(),minItems:f.number().optional(),maxItems:f.number().optional(),items:f.object({type:f.literal("string"),enum:f.array(f.string())}),default:f.array(f.string()).optional()}),fh8=f.object({type:f.literal("array"),title:f.string().optional(),description:f.string().optional(),minItems:f.number().optional(),maxItems:f.number().optional(),items:f.object({anyOf:f.array(f.object({const:f.string(),title:f.string()}))}),default:f.array(f.string()).optional()}),yh8=f.union([xh8,fh8]),gh8=f.union([vh8,bh8,yh8]),hh8=f.union([gh8,Vh8,kh8,Sh8]),uh8=Yn.extend({mode:f.literal("form").optional(),message:f.string(),requestedSchema:f.object({type:f.literal("object"),properties:f.record(f.string(),hh8),required:f.array(f.string()).optional()})}),lh8=Yn.extend({mode:f.literal("url"),message:f.string(),elicitationId:f.string(),url:f.string().url()}),ch8=f.union([uh8,lh8]),Nc0=KQ.extend({method:f.literal("elicitation/create"),params:ch8}),dh8=D3.extend({elicitationId:f.string()}),mh8=L3.extend({method:f.literal("notifications/elicitation/complete"),params:dh8}),wD=HQ.extend({action:f.enum(["accept","decline","cancel"]),content:f.preprocess(($)=>$===null?void 0:$,f.record(f.string(),f.union([f.string(),f.number(),f.boolean(),f.array(f.string())])).optional())}),ih8=f.object({type:f.literal("ref/resource"),uri:f.string()}),ph8=f.object({type:f.literal("ref/prompt"),name:f.string()}),nh8=eJ.extend({ref:f.union([ph8,ih8]),argument:f.object({name:f.string(),value:f.string()}),context:f.object({arguments:f.record(f.string(),f.string()).optional()}).optional()}),yZ0=KQ.extend({method:f.literal("completion/complete"),params:nh8});Bc0=HQ.extend({completion:f.looseObject({values:f.array(f.string()).max(100),total:f.optional(f.number().int()),hasMore:f.optional(f.boolean())})}),th8=f.object({uri:f.string().startsWith("file://"),name:f.string().optional(),_meta:f.record(f.string(),f.unknown()).optional()}),oh8=KQ.extend({method:f.literal("roots/list"),params:eJ.optional()}),Oc0=HQ.extend({roots:f.array(th8)}),rh8=L3.extend({method:f.literal("notifications/roots/list_changed"),params:D3.optional()}),YG5=f.union([VZ0,MZ0,yZ0,Fc0,Rg,DD,BD,OD,Tg,Xh8,Jh8,LD,qg,SZ0,_Z0,vZ0,xZ0]),JG5=f.union([qZ0,kZ0,IZ0,rh8,Hn]),GG5=f.union([jN,Wz,Bn,wD,Oc0,CZ0,bZ0,EN]),WG5=f.union([VZ0,Uc0,Nc0,oh8,SZ0,_Z0,vZ0,xZ0]),KG5=f.union([qZ0,kZ0,zh8,Wh8,Zc0,Hc0,Kc0,Hn,mh8]),HG5=f.union([jN,ol0,Bc0,Wc0,Qc0,al0,sl0,$c0,_H,Un,CZ0,bZ0,EN]);I1=class I1 extends Error{constructor($,Z,Q){super(`MCP error ${$}: ${Z}`);this.code=$,this.data=Q,this.name="McpError"}static fromError($,Z,Q){if($===v1.UrlElicitationRequired&&Q){let X=Q;if(X.elicitations)return new il1(X.elicitations,Z)}return new I1($,Z,Q)}};il1=class il1 extends I1{constructor($,Z=`URL elicitation${$.length>1?"s":""} required`){super(v1.UrlElicitationRequired,Z,{elicitations:$})}get elicitations(){return this.data?.elicitations??[]}}});import{z as p$}from"zod";function tl1($){return p$.record(p$.string(),p$.unknown()).nullable().refine((Z)=>Z===null||JSON.stringify(Z).length<=nl1,{message:`${$} must serialize to at most ${nl1} bytes`})}function vH($){return $!==null&&$!==void 0&&"command"in $}function Mg($){if(!$||!$.startsWith("virtual://"))return null;return $.replace("virtual://","")}function Ig($){return`virtual://${$}`}var ol1,pl1,ah8,sh8,eh8,nl1=262144,nQ,gZ0,hZ0;var rl1=D(()=>{n9();ol1=p$.object({authorizationEndpoint:p$.string().url(),tokenEndpoint:p$.string().url(),introspectionEndpoint:p$.string().url().optional(),clientId:p$.string(),clientSecret:p$.string().optional(),scopes:p$.array(p$.string()),grantType:p$.enum(["authorization_code","client_credentials"])}),pl1=p$.object({type:p$.literal("object"),properties:p$.record(p$.string(),p$.unknown()).optional(),required:p$.array(p$.string()).optional()}).catchall(p$.unknown()),ah8=fZ0.extend({inputSchema:pl1,outputSchema:pl1.optional()}),sh8=p$.object({headers:p$.record(p$.string(),p$.string()).optional()}),eh8=p$.object({command:p$.string().describe("Command to run (e.g., 'npx', 'node')"),args:p$.array(p$.string()).optional().describe("Command arguments"),cwd:p$.string().optional().describe("Working directory"),envVars:p$.record(p$.string(),p$.string()).optional().describe("Environment variables (encrypted in storage)")});nQ=p$.object({id:p$.string().describe("Unique identifier for the connection"),title:p$.string().describe("Human-readable name for the connection"),created_at:p$.string().describe("When the connection was created"),updated_at:p$.string().describe("When the connection was last updated"),created_by:p$.string().describe("User ID who created the connection"),updated_by:p$.string().optional().describe("User ID who last updated the connection"),organization_id:p$.string().describe("Organization ID this connection belongs to"),description:p$.string().nullable().describe("Description of the connection"),icon:p$.string().nullable().describe("Icon URL for the connection"),app_name:p$.string().nullable().describe("Associated app name"),app_id:p$.string().nullable().describe("Associated app ID"),slug:p$.string().nullable().optional().describe("URL-safe slug derived from app_name, connection_url, or title"),connection_type:p$.enum(["HTTP","SSE","Websocket","STDIO","VIRTUAL"]).describe("Type of connection"),connection_url:p$.string().nullable().describe("URL for HTTP/SSE/WebSocket connections. virtual://$id for VIRTUAL. Null for STDIO."),connection_token:p$.string().nullable().describe("Authentication token (for HTTP connections)"),connection_headers:p$.union([eh8,sh8]).nullable().describe("Connection parameters. HTTP: { headers }. STDIO: { command, args, cwd, envVars }"),oauth_config:ol1.nullable().describe("OAuth configuration"),configuration_state:tl1("configuration_state").describe("Configuration state (decrypted)"),configuration_scopes:p$.array(p$.string()).nullable().optional().describe("Configuration scopes"),metadata:tl1("metadata").describe("Additional metadata (includes repository info)"),tools:p$.array(ah8).nullable().describe("Discovered tools from MCP"),bindings:p$.array(p$.string()).nullable().describe("Detected bindings"),status:p$.enum(["active","inactive","error"]).describe("Current status")}),gZ0=nQ.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}).extend({icon:p$.string().nullish()}),hZ0=nQ.partial()});import{z as V0}from"zod";function wc0($){let Z=$?.homeTiles;if(Array.isArray(Z)&&Z.length>0)return Z;let Q=$?.homeTile;return Q?[Q]:[]}function zN($){if(!$||typeof $!=="object"||Array.isArray($))return{};let Z=$,Q={};for(let[X,Y]of Object.entries(Z)){if(!Y||typeof Y!=="object")continue;if(X!=="agent-sandbox"&&X!=="local-api")continue;try{Q[X]=jc0.parse(Y)}catch{}}return Q}function Ec0($){if(!$||typeof $!=="object"||Array.isArray($))return{};let Z={};for(let[Q,X]of Object.entries($)){if(!X||typeof X!=="object"||Array.isArray(X))continue;let Y={};for(let[J,G]of Object.entries(X)){let W=zN(G);if(Object.keys(W).length>0)Y[J]=W}if(Object.keys(Y).length>0)Z[Q]=Y}return Z}var el1,Dc0=500,$c1=200,$u8=200,Zu8=20,Qu8=50,Xu8=100,Yu8=20,Ju8=100,Zc1=50,Gu8=100,Wu8=50,Ku8=8192,Qc1,Hu8,Xc1,Lc0,Fu8,Uu8,Yc1,al1,Nu8,uZ0,sl1,Bu8,Jc1,Ou8,Du8,Lu8,wu8,ju8,jc0,Gc1,Eu8,zu8,Pu8,Au8,Tu8,Ru8,qu8,Wc1,Mu8,zc0,tQ,Pc0,lZ0,cZ0;var Kc1=D(()=>{el1=V0.object({connection_id:V0.string().describe("Connection ID"),selected_tools:V0.array(V0.string()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:V0.array(V0.string()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:V0.array(V0.string()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),Qc1=el1.extend({selected_tools:V0.array(V0.string()).max(Dc0).nullable().optional().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:V0.array(V0.string()).max(Dc0).nullable().optional().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:V0.array(V0.string()).max(Dc0).nullable().optional().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),Hu8=V0.object({connectionId:V0.string(),toolName:V0.string(),label:V0.string(),icon:V0.string().nullable().optional()}),Xc1=V0.object({id:V0.string().describe("Stable id; used as React key and ?tab= value"),title:V0.string().describe("Tab label"),icon:V0.string().optional().describe("Optional lucide icon name"),view:V0.object({type:V0.literal("ext-app"),appId:V0.string(),args:V0.record(V0.string(),V0.unknown()).optional()})}),Lc0=V0.enum(["overview","reports","board","site-editor","assets","hosting","e2e","analytics","cdn","automations","experiments"]),Fu8=V0.enum(["on","off"]),Uu8=V0.enum(["on","off","manual","auto"]),Yc1=V0.object({defaultMainView:V0.object({type:V0.string(),id:V0.string().optional(),toolName:V0.string().optional()}).nullable().optional(),chatDefaultOpen:V0.boolean().nullable().optional(),cmsDefaultOpen:V0.boolean().nullable().optional(),cms:Uu8.nullable().optional().describe("How this agent offers content editing. Absent means on; the retired `manual` / `auto` read as on too."),sidebarViews:V0.array(Lc0).max(10).nullable().optional().describe("Deprecated layout-scoped sidebar selections. Read only as a fallback when metadata.sidebarViews is absent."),tabs:V0.array(Xc1).max(Yu8).optional()}),al1=V0.object({tileId:V0.string().optional(),connectionId:V0.string().optional().describe("Connection that owns the resource \u2014 the host opens a direct MCP client to this connection so the iframe can call tools by their bare names."),resourceUri:V0.string().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),toolName:V0.string().optional().describe("Tool name \u2014 identifies which tool's inputSchema to display when editing tile props."),toolInput:V0.record(V0.string(),V0.unknown()).optional().describe("User-configured input props passed to MCPAppRenderer when rendering the tile."),minHeight:V0.number().int().positive().optional(),maxHeight:V0.number().int().positive().optional()}),Nu8=V0.object({banner:V0.string().nullable().optional(),bannerColor:V0.string().nullable().optional(),icon:V0.string().nullable().optional(),themeColor:V0.string().nullable().optional(),pinnedViews:V0.array(Hu8).max(Xu8).nullable().optional(),layout:Yc1.nullable().optional(),homeTile:al1.nullable().optional(),homeTiles:V0.array(al1).max(Zu8).nullable().optional(),homePrompts:V0.array(V0.string()).max(Qu8).nullable().optional()});uZ0=/^[A-Za-z_][A-Za-z0-9_]*$/,sl1=V0.string().min(1).regex(uZ0,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),Bu8=V0.discriminatedUnion("kind",[V0.object({key:sl1,kind:V0.literal("literal"),value:V0.string().max(Ku8)}),V0.object({key:sl1,kind:V0.literal("secret"),secretId:V0.string().min(1)})]),Jc1=/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/,Ou8=V0.object({host:V0.string().min(1).regex(Jc1).describe("Submodule host, e.g. 'github.com' (bare hostname, no scheme)."),secretId:V0.string().min(1).describe("Vault secret id holding the PAT used to fetch this host.")}),Du8=V0.object({selected:V0.string().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:V0.string().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:V0.string().nullable().optional().describe("Optional path (relative to repo root) to the directory containing package.json. Null/absent means repo root. Forwarded as `application.packageManager.path` to the daemon config."),env:V0.array(Bu8).max(Gu8).nullable().optional().describe("Env vars injected on every SANDBOX_START. Literal entries inline their value; secret entries store a secretId that Studio resolves via the credential vault before posting /_sandbox/config."),submoduleCredentials:V0.array(Ou8).max(Wu8).nullable().optional().describe("Git submodule credentials injected on every SANDBOX_START. Each entry maps a host to a vault secret (PAT) that Studio resolves before posting /_sandbox/config; the daemon uses it to authenticate `git submodule update` for submodules on that host.")}),Lu8=V0.object({url:V0.string().describe("GitHub repository URL"),owner:V0.string().describe("Repository owner"),name:V0.string().describe("Repository name"),installationId:V0.number().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:V0.string().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials."),repositoryId:V0.string().optional().describe("First-class repository (REPOSITORY_LINK) backing this binding. When set, credentials come from the repository's git provider account rather than connectionId.")}),wu8=V0.enum(["agent-sandbox","local-api"]),ju8={sandboxHandle:V0.string().describe("Provider-specific handle"),previewUrl:V0.string().nullable().describe("URL where the sandbox's iframe-proxied UI is served, or null when the sandbox has no dev server (blank / tool sandboxes)."),sandboxApiUrl:V0.string().nullable().optional().describe("Direct sandbox API URL for runtimes that expose one. Equal to previewUrl for local-api; null/absent for AgentSandbox, which routes control traffic through hosted Studio."),createdAt:V0.number().optional().describe("Epoch ms the entry was first written by SANDBOX_START. Used by the booting overlay to show a stable elapsed timer that survives browser reloads. Optional for backward compatibility with entries written before this field existed."),startedWith:V0.object({packageManager:V0.string().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:V0.string().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:V0.string().nullable().optional().describe("metadata.runtime.path at the time of SANDBOX_START")}).optional().describe("Snapshot of metadata.runtime fields (selected/port/path) used at SANDBOX_START. The Preview tab compares the live metadata.runtime against this to decide if a restart is required to apply changes.")},jc0=V0.object(ju8);Gc1=V0.record(V0.string().describe("userId"),V0.record(V0.string().describe("branch"),V0.partialRecord(wu8,jc0)));Eu8=V0.object({id:V0.string().describe("Stable identifier for this knowledge file"),name:V0.string().describe("File name shown in the UI"),kind:V0.enum(["file","skill"]).optional().describe("'file' (a single document) or 'skill' (a Claude Code skill folder containing SKILL.md). Defaults to 'file'."),volume:V0.string().describe("Org filesystem (Library) volume the file lives in"),path:V0.string().describe("Path within the volume"),url:V0.string().describe("Same-origin URL to read the file (display/download)"),contentType:V0.string().nullable().optional().describe("MIME type, used to decide whether to inline the content"),size:V0.number().nullable().optional().describe("File size in bytes"),addedAt:V0.string().describe("ISO timestamp when the file was attached")}),zu8=V0.array(Eu8).max(Ju8).nullable().optional().describe("Files attached to the agent as reference knowledge. Surfaced in the system prompt: small text documents are inlined, others are listed as retrievable references."),Pu8=V0.enum(["smart","code-review","open"]),Au8=Pu8.nullable().optional().describe("Controls when this code agent's changes may be published directly vs. requiring PR review. 'smart' (default) uses AI to judge per change; 'code-review' requires review for any code; 'open' allows direct publish always."),Tu8=V0.boolean().nullable().optional().describe("Enable Fast Preview (sandbox-less): render the draft instantly on the preview server's own page via a ?__draft pointer, with reads/writes served by the decofile API against GitHub. Requires previewServerUrl (or legacy productionUrl) to be set to take effect."),Ru8=V0.boolean().nullable().optional().describe("EXPERIMENTAL: with Fast Preview on, refresh content edits via an in-place /live/previews render (no commit, no reload) instead of a commit + re-navigation. Deco-runtime preview targets only. Requires fastPreview."),qu8=V0.string().nullable().optional().describe("Preview server URL \u2014 the deployment the CMS preview renders against (often the live site, e.g. https://acme.com). Painted in the preview iframe, and the render target for Fast Preview drafts. Supersedes the legacy productionUrl key."),Wc1=V0.object({branch:V0.string().describe("Git branch backing this release"),name:V0.string().describe('User-facing name, e.g. "Black Friday 2026"'),color:V0.string().describe("Dot color token shown in the version switcher"),createdBy:V0.string().optional().describe("User ID who created the release"),createdAt:V0.string().optional().describe("ISO 8601 creation timestamp")}),Mu8=V0.array(Wc1).max(Zc1).nullable().optional().describe("Curated list of named, branch-backed releases shown in the version switcher. The base branch ('No ar') is derived, not stored here."),zc0={instructions:V0.string().nullable().optional().describe("Instructions also used as system prompt"),subAgents:V0.array(V0.string()).max($u8).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:V0.string().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:Nu8.nullable().optional().describe("UI customization settings"),sidebarViews:V0.array(Lc0).max(10).nullable().optional().describe("Project views selected for the sidebar. Interpret as an exact list when sidebarViewsVersion is 1; unversioned values use legacy native-only semantics. Runtime presence gates still apply."),sidebarViewsVersion:V0.literal(1).optional().describe("Version 1 marks metadata.sidebarViews as an exact list that can disable legacy default rows."),githubRepo:Lu8.nullable().optional().describe("Linked GitHub repository"),runtime:Du8.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:zu8,siteSlug:V0.string().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:Au8,previewServerUrl:qu8,productionUrl:V0.string().nullable().optional().describe("Legacy key for previewServerUrl \u2014 still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:V0.boolean().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:Tu8,releases:Mu8,fastPreviewInPlace:Ru8},tQ=V0.object({id:V0.string().describe("Unique identifier"),title:V0.string().describe("Human-readable name"),description:V0.string().nullable().describe("Description"),icon:V0.string().nullable().describe("Icon URL"),created_at:V0.string().describe("Creation timestamp"),updated_at:V0.string().describe("Last update timestamp"),created_by:V0.string().describe("User ID who created this item"),updated_by:V0.string().optional().describe("User ID who last updated this item"),organization_id:V0.string().describe("Organization ID this item belongs to"),status:V0.enum(["active","inactive"]).describe("Current status"),pinned:V0.boolean().describe("Whether this space is pinned to the sidebar"),metadata:V0.object(zc0).extend({instructions:V0.string().nullable().describe("Instructions also used as system prompt"),sandboxMap:Gc1.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }")}).loose().describe("Metadata"),connections:V0.array(el1).describe("Connections with their selected tools, resources, and prompts")}),Pc0=V0.object({title:V0.string().min(1).max(120).describe("Short label shown on the chip"),description:V0.string().max(280).optional().describe("One-line subtitle shown under the title"),text:V0.string().min(1).max(4000).describe("The message sent to the agent when the prompt is clicked")}),lZ0=V0.object({title:V0.string().min(1).max(255).describe("Name for the virtual MCP"),description:V0.string().max(500).nullable().optional().describe("Optional description"),icon:V0.string().nullish().describe("Optional icon URL"),status:V0.enum(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:V0.boolean().optional().default(!1).describe("Pin to sidebar"),metadata:V0.object(zc0).loose().superRefine(($,Z)=>{if("sandboxMap"in $)Z.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:V0.array(Qc1).max($c1).describe("Connections to include/exclude (can be empty for exclusion mode)"),prompts:V0.array(Pc0).max(20).optional().describe("Optional kickstart prompts to seed on the agent. Each becomes a clickable conversation starter (icebreaker) on the agent. Author them from the agent's role and the tools it will have so they're coherent and immediately useful.")}),cZ0=V0.object({title:V0.string().min(1).max(255).optional().describe("New name"),description:V0.string().max(500).nullable().optional().describe("New description (null to clear)"),icon:V0.string().nullish().describe("New icon URL"),status:V0.enum(["active","inactive"]).optional().describe("New status"),pinned:V0.boolean().optional().describe("Pin/unpin from sidebar"),metadata:V0.object(zc0).loose().superRefine(($,Z)=>{if("sandboxMap"in $)Z.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:V0.array(Qc1).max($c1).optional().describe("New connections (replaces existing)"),prompts:V0.array(Pc0).max(20).optional().describe("Replace the agent's kickstart prompts with this full set. Omit to leave them unchanged; pass an empty array to remove all. Each becomes a clickable conversation starter (icebreaker).")})});function Kz($){return Iu8.has($)}var UZ,Iu8,dZ0;var Hc1=D(()=>{UZ=["deco","anthropic","openrouter","llmapi","google","openai-compatible"],Iu8=new Set(UZ);dZ0=[...UZ,"claude-code","codex"]});function Ac0($,Z){return{id:crypto.randomUUID(),type:On.STEP,source:"decopilot",subject:$,data:{stepCount:Z},time:new Date().toISOString()}}function mZ0($,Z){return{id:crypto.randomUUID(),type:On.FINISH,source:"decopilot",subject:$,data:{status:Z},time:new Date().toISOString()}}function bH($,Z,Q){return{id:crypto.randomUUID(),type:On.THREAD_STATUS,source:"decopilot",subject:$,data:{status:Z,...Q?.messageId!==void 0&&{message_id:Q.messageId},...Q?.virtualMcpId!==void 0&&{virtual_mcp_id:Q.virtualMcpId},...Q?.createdBy!==void 0&&{created_by:Q.createdBy},...Q?.triggerId!==void 0&&{trigger_id:Q.triggerId},...Q?.title!==void 0&&{title:Q.title},...Q?.branch!==void 0&&{branch:Q.branch},...Q?.harnessId!==void 0&&{harness_id:Q.harnessId},...Q?.createdAt!==void 0&&{created_at:Q.createdAt},...Q?.updatedAt!==void 0&&{updated_at:Q.updatedAt},...Q?.metadata!==void 0&&{metadata:Q.metadata}},time:new Date().toISOString()}}var Fc1,Vu8,On,ku8;var Uc1=D(()=>{Fc1=["in_progress","requires_action","failed","completed"],Vu8=[...Fc1,"expired"],On={STEP:"decopilot.step",FINISH:"decopilot.finish",THREAD_STATUS:"decopilot.thread.status"},ku8=Object.values(On)});var iZ0=D(()=>{rl1();Kc1();Hc1();Uc1()});var xH=D(()=>{iZ0()});import{lookup as Su8}from"dns/promises";function Dn($,Z){if($===10)return!0;if($===172&&Z!==void 0&&Z>=16&&Z<=31)return!0;if($===192&&Z===168)return!0;if($===127)return!0;if($===169&&Z===254)return!0;if($===0)return!0;if($===100&&Z!==void 0&&Z>=64&&Z<=127)return!0;return!1}function Tc0($){let Z=Number.parseInt($.padStart(4,"0"),16);return[Z>>8,Z&255]}function Nc1($){let Z=$.split(":").filter((Q)=>Q.length>0);if($.startsWith("2002:")&&Z.length>=2){let[Q,X]=Tc0(Z[1]);if(Dn(Q,X))return!0}if($.startsWith("64:ff9b::")&&Z.length>=4){let[Q,X]=Tc0(Z[Z.length-2]);if(Dn(Q,X))return!0}if($.startsWith("::")&&Z.length===2){let[Q,X]=Tc0(Z[0]);if(Dn(Q,X))return!0}return!1}function Vg($){try{let Q=new URL($).hostname.toLowerCase();if(Q==="localhost"||Q==="0.0.0.0"||Q.endsWith(".local")||Q.endsWith(".internal")||Q.endsWith(".localhost"))return!0;let X=Q.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/);if(X){let[,Y,J]=X.map(Number);if(Dn(Y,J))return!0}if(Q.startsWith("[")&&Q.endsWith("]")){let Y=Q.slice(1,-1).toLowerCase();if(Y==="::1"||Y==="::")return!0;if(Y.startsWith("::ffff:"))return!0;if(Y.startsWith("fc")||Y.startsWith("fd"))return!0;if(Y.startsWith("fe80"))return!0;if(Y.startsWith("100:"))return!0;if(Y.startsWith("::1"))return!0;if(Nc1(Y))return!0}return!1}catch{return!0}}function Cu8($){let Z=$.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/);if(Z){let[,X,Y]=Z.map(Number);return Dn(X,Y)}let Q=$.toLowerCase();if(Q==="::1"||Q==="::")return!0;if(Q.startsWith("::ffff:"))return!0;if(Q.startsWith("fc")||Q.startsWith("fd"))return!0;if(Q.startsWith("fe80"))return!0;if(Q.startsWith("100:"))return!0;return Nc1(Q)}async function _u8($,Z=async(Q)=>(await Su8(Q,{all:!0})).map((X)=>X.address)){try{let Q=await Z($);return Q.length===0||Q.some(Cu8)}catch{return!0}}async function Ln($){if(Vg($))return"URLs targeting private networks are not allowed";let Q=new URL($).hostname;if(/^\d+\.\d+\.\d+\.\d+$/.test(Q)||Q.startsWith("[")&&Q.endsWith("]"))return null;try{return await vu8(_u8(Q),5000,"DNS resolution timeout")?"URLs targeting private networks are not allowed":null}catch{return"URLs targeting private networks are not allowed"}}function vu8($,Z,Q){let X,Y=new Promise((J,G)=>{X=setTimeout(()=>G(Error(Q)),Z)});return Promise.race([$,Y]).finally(()=>clearTimeout(X))}function Hz($=fetch){return async(Z,Q)=>{let X=await $(Z,{...Q,redirect:"manual"});if(X.status>=300&&X.status<400)throw Error("Refusing to follow a redirect from the remote server");return X}}var wn=()=>{};var Bc1="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";import{webcrypto as Oc1}from"crypto";function xu8($){if(!Fz||Fz.length<$)Fz=Buffer.allocUnsafe($*bu8),Oc1.getRandomValues(Fz),kg=0;else if(kg+$>Fz.length)Oc1.getRandomValues(Fz),kg=0;kg+=$}function pZ0($=21){xu8($|=0);let Z="";for(let Q=kg-$;Q<kg;Q++)Z+=Bc1[Fz[Q]&63];return Z}var bu8=128,Fz,kg;var Rc0=()=>{};function o8($){return`${$}_${pZ0()}`}var oQ=D(()=>{Rc0()});function Lc1($,Z){return{id:_4.SELF(Z),title:"Deco CMS",description:"The MCP for the CMS API",connection_type:"HTTP",connection_url:`${$}/mcp/self`,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:"self"}}}function wc1($,Z){return{id:_4.DEV_ASSETS(Z),title:"Local Files",description:"Local file storage for development. Files are stored in /data/assets/.",connection_type:"HTTP",connection_url:`${$}/mcp/dev-assets`,icon:"https://api.iconify.design/lucide:folder.svg?color=%23888",app_name:"@deco/dev-assets-mcp",app_id:null,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isFixed:!0,devOnly:!0,type:"dev-assets"}}}function w3($){return{is(Z){if(!Z)return null;if(!Z.startsWith($))return null;return Z.slice($.length)||null},get(Z){return`${$}${Z}`}}}function jc1($){return{id:$.id,organization_id:$.organizationId,title:$.title,description:$.description,icon:$.icon,status:"active",created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:"system",updated_by:void 0,metadata:{instructions:$.instructions??null,...$.ui?{ui:$.ui}:{}},pinned:!1,connections:[]}}function Mc0($){return jc1({id:Nz($),organizationId:$,title:"Super Agent",description:"Default agent that aggregates all organization connections",icon:fu8,ui:{layout:{defaultMainView:{type:"overview"},chatDefaultOpen:!0}}})}function Tc1($){return jc1({id:gu8($),organizationId:$,title:"Brand context setup",description:"Guided onboarding agent that extracts brand context from a website URL.",icon:"https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png",instructions:hu8})}function Mc1($,Z,Q="https://reports.decocms.com/api/v2/mcp"){return{id:_4.REPORTS($),title:"Store Report",description:"Your store's report and diagnostics",connection_type:"HTTP",connection_url:Q,icon:"https://github.com/decocms.png",app_name:"commerce-discovery",app_id:null,connection_token:Z,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!1,type:"commerce-discovery"}}}function Ic1($,Z=_4.REPORTS($)){return{title:"Report Agent",description:"Ask anything about your store's report",icon:"https://github.com/decocms.png",status:"active",pinned:!0,metadata:{type:"commerce-discovery",isDefault:!1,ui:{pinnedViews:[{connectionId:Z,toolName:"get_my_diagnostic",label:"Report",icon:"https://github.com/decocms.png"}],layout:{defaultMainView:{type:"ext-apps",id:Z,toolName:"get_my_diagnostic"},chatDefaultOpen:!0}}},connections:[{connection_id:Z,selected_tools:null,selected_resources:null,selected_prompts:null}]}}function Vc1($){if(!$)return!1;return Object.values(Uz).some((Z)=>Z.is($)!==null)}function kc1($){let Z=Mc0($);return{...Z,id:Z.id,connection_type:"VIRTUAL",connection_url:`virtual://${Z.id}`,app_name:"decopilot",app_id:"decopilot",connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!0,type:"decopilot"},tools:[],bindings:[]}}var _4,Dc1="https://reports.decocms.com/api/v2/mcp",nZ0="get_my_diagnostic",Ec1,FQ,Nz,zc1,Pc1,qc0,fu8="https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png",yu8="#6366f1",fG5,Ac1,tZ0,gu8,hu8,Rc1,yG5,gG5,qc1,hG5,Sg,Uz,j3,Ic0,uG5;var Sc1=D(()=>{_4={SELF:($)=>`${$}_self`,REGISTRY:($)=>`${$}_registry`,COMMUNITY_REGISTRY:($)=>`${$}_community-registry`,DEV_ASSETS:($)=>`${$}_dev-assets`,SITE_DIAGNOSTICS:($)=>`site-diagnostics_${$}`,REPORTS:($)=>`${$}_commerce-discovery`};Ec1=w3("decopilot_"),FQ=Ec1.is,Nz=Ec1.get,zc1=w3("dev_"),Pc1=zc1.get,qc0=zc1.is,fG5=`https://api.iconify.design/lucide:file-search.svg?color=${encodeURIComponent(yu8)}`;Ac1=w3("brand-context-setup_"),tZ0=Ac1.is,gu8=Ac1.get,hu8=`
79
+ `),ov1=!0}throw new c90.CredentialsProviderError("AWS_PROFILE is set, skipping fromEnv provider.",{logger:$.logger,tryNextLink:!0})}return $.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromEnv"),Fx0($)()},async(Z)=>{$.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromSSO");let{ssoStartUrl:Q,ssoAccountId:X,ssoRegion:Y,ssoRoleName:J,ssoSession:G}=$;if(!Q&&!X&&!Y&&!J&&!G)throw new c90.CredentialsProviderError("Skipping SSO provider in default chain (inputs do not include SSO fields).",{logger:$.logger});let{fromSSO:W}=await Promise.resolve().then(() => (Pf0(),zf0));return W($)(Z)},async(Z)=>{$.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromIni");let{fromIni:Q}=await Promise.resolve().then(() => (tv1(),nv1));return Q($)(Z)},async(Z)=>{$.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromProcess");let{fromProcess:Q}=await Promise.resolve().then(() => (Ty0(),Ay0));return Q($)(Z)},async(Z)=>{$.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::fromTokenFile");let{fromTokenFile:Q}=await Promise.resolve().then(() => (ky0(),Vy0));return Q($)(Z)},async()=>{return $.logger?.debug("@aws-sdk/credential-provider-node - defaultProvider::remoteProvider"),(await NI1($))()},async()=>{throw new c90.CredentialsProviderError("Could not load credentials from any providers",{tryNextLink:!1,logger:$.logger})}],Uy8),Uy8=($)=>$?.expiration!==void 0&&$.expiration.getTime()-Date.now()<300000;var sv1=D(()=>{Ux0();BI1();c90=C(k5(),1),rv1=C(fX(),1)});var ev1=D(()=>{sv1()});var $b1=()=>{};var Ug,Ny8="AWS_S3_USE_ARN_REGION",By8="s3_use_arn_region",Zb1;var Qb1=D(()=>{Ug=C(Jp(),1),Zb1={environmentVariableSelector:($)=>Ug.booleanSelector($,Ny8,Ug.SelectorType.ENV),configFileSelector:($)=>Ug.booleanSelector($,By8,Ug.SelectorType.CONFIG),default:void 0}});var Xb1=()=>{};var Yb1=()=>{};var Jb1=D(()=>{$b1();Qb1();Yb1();Xb1()});class Ng{bytes;constructor($){if(this.bytes=$,$.byteLength!==8)throw Error("Int64 buffers must be exactly 8 bytes")}static fromNumber($){if($>9223372036854776000||$<-9223372036854776000)throw Error(`${$} is too large (or, if negative, too small) to represent as an Int64`);let Z=new Uint8Array(8);for(let Q=7,X=Math.abs(Math.round($));Q>-1&&X>0;Q--,X/=256)Z[Q]=X;if($<0)Gb1(Z);return new Ng(Z)}valueOf(){let $=this.bytes.slice(0),Z=$[0]&128;if(Z)Gb1($);return parseInt(Wb1.toHex($),16)*(Z?-1:1)}toString(){return String(this.valueOf())}}function Gb1($){for(let Z=0;Z<8;Z++)$[Z]^=255;for(let Z=7;Z>-1;Z--)if($[Z]++,$[Z]!==0)break}var Wb1;var Cy0=D(()=>{Wb1=C(bi(),1)});class _y0{toUtf8;fromUtf8;constructor($,Z){this.toUtf8=$,this.fromUtf8=Z}format($){let Z=[];for(let Y of Object.keys($)){let J=this.fromUtf8(Y);Z.push(Uint8Array.from([J.byteLength]),J,this.formatHeaderValue($[Y]))}let Q=new Uint8Array(Z.reduce((Y,J)=>Y+J.byteLength,0)),X=0;for(let Y of Z)Q.set(Y,X),X+=Y.byteLength;return Q}formatHeaderValue($){switch($.type){case"boolean":return Uint8Array.from([$.value?0:1]);case"byte":return Uint8Array.from([2,$.value]);case"short":let Z=new DataView(new ArrayBuffer(3));return Z.setUint8(0,3),Z.setInt16(1,$.value,!1),new Uint8Array(Z.buffer);case"integer":let Q=new DataView(new ArrayBuffer(5));return Q.setUint8(0,4),Q.setInt32(1,$.value,!1),new Uint8Array(Q.buffer);case"long":let X=new Uint8Array(9);return X[0]=5,X.set($.value.bytes,1),X;case"binary":let Y=new DataView(new ArrayBuffer(3+$.value.byteLength));Y.setUint8(0,6),Y.setUint16(1,$.value.byteLength,!1);let J=new Uint8Array(Y.buffer);return J.set($.value,3),J;case"string":let G=this.fromUtf8($.value),W=new DataView(new ArrayBuffer(3+G.byteLength));W.setUint8(0,7),W.setUint16(1,G.byteLength,!1);let K=new Uint8Array(W.buffer);return K.set(G,3),K;case"timestamp":let H=new Uint8Array(9);return H[0]=8,H.set(Ng.fromNumber($.value.valueOf()).bytes,1),H;case"uuid":if(!Ay8.test($.value))throw Error(`Invalid UUID received: ${$.value}`);let F=new Uint8Array(17);return F[0]=9,F.set($D.fromHex($.value.replace(/\-/g,"")),1),F}}parse($){let Z={},Q=0;while(Q<$.byteLength){let X=$.getUint8(Q++),Y=this.toUtf8(new Uint8Array($.buffer,$.byteOffset+Q,X));switch(Q+=X,$.getUint8(Q++)){case 0:Z[Y]={type:Hb1,value:!0};break;case 1:Z[Y]={type:Hb1,value:!1};break;case 2:Z[Y]={type:Oy8,value:$.getInt8(Q++)};break;case 3:Z[Y]={type:Dy8,value:$.getInt16(Q,!1)},Q+=2;break;case 4:Z[Y]={type:Ly8,value:$.getInt32(Q,!1)},Q+=4;break;case 5:Z[Y]={type:wy8,value:new Ng(new Uint8Array($.buffer,$.byteOffset+Q,8))},Q+=8;break;case 6:let J=$.getUint16(Q,!1);Q+=2,Z[Y]={type:jy8,value:new Uint8Array($.buffer,$.byteOffset+Q,J)},Q+=J;break;case 7:let G=$.getUint16(Q,!1);Q+=2,Z[Y]={type:Ey8,value:this.toUtf8(new Uint8Array($.buffer,$.byteOffset+Q,G))},Q+=G;break;case 8:Z[Y]={type:zy8,value:new Date(new Ng(new Uint8Array($.buffer,$.byteOffset+Q,8)).valueOf())},Q+=8;break;case 9:let W=new Uint8Array($.buffer,$.byteOffset+Q,16);Q+=16,Z[Y]={type:Py8,value:`${$D.toHex(W.subarray(0,4))}-${$D.toHex(W.subarray(4,6))}-${$D.toHex(W.subarray(6,8))}-${$D.toHex(W.subarray(8,10))}-${$D.toHex(W.subarray(10))}`};break;default:throw Error("Unrecognized header type tag")}}return Z}}var $D,Kb1,Hb1="boolean",Oy8="byte",Dy8="short",Ly8="integer",wy8="long",jy8="binary",Ey8="string",zy8="timestamp",Py8="uuid",Ay8;var vy0=D(()=>{Cy0();$D=C(bi(),1);(function($){$[$.boolTrue=0]="boolTrue",$[$.boolFalse=1]="boolFalse",$[$.byte=2]="byte",$[$.short=3]="short",$[$.integer=4]="integer",$[$.long=5]="long",$[$.byteArray=6]="byteArray",$[$.string=7]="string",$[$.timestamp=8]="timestamp",$[$.uuid=9]="uuid"})(Kb1||(Kb1={}));Ay8=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/});function Nb1({byteLength:$,byteOffset:Z,buffer:Q}){if($<Ty8)throw Error("Provided message too short to accommodate event stream message overhead");let X=new DataView(Q,Z,$),Y=X.getUint32(0,!1);if($!==Y)throw Error("Reported message length does not match received message length");let J=X.getUint32(Ub1,!1),G=X.getUint32(ZD,!1),W=X.getUint32($-sE,!1),K=new Fb1.Crc32().update(new Uint8Array(Q,Z,ZD));if(G!==K.digest())throw Error(`The prelude checksum specified in the message (${G}) does not match the calculated CRC32 checksum (${K.digest()})`);if(K.update(new Uint8Array(Q,Z+ZD,$-(ZD+sE))),W!==K.digest())throw Error(`The message checksum (${K.digest()}) did not match the expected value of ${W}`);return{headers:new DataView(Q,Z+ZD+sE,J),body:new Uint8Array(Q,Z+ZD+sE+J,Y-J-(ZD+sE+sE))}}var Fb1,Ub1=4,ZD,sE=4,Ty8;var Bb1=D(()=>{Fb1=C(jE(),1),ZD=Ub1*2,Ty8=ZD+sE*2});class by0{headerMarshaller;messageBuffer;isEndOfStream;constructor($,Z){this.headerMarshaller=new _y0($,Z),this.messageBuffer=[],this.isEndOfStream=!1}feed($){this.messageBuffer.push(this.decode($))}endOfStream(){this.isEndOfStream=!0}getMessage(){let $=this.messageBuffer.pop(),Z=this.isEndOfStream;return{getMessage(){return $},isEndOfStream(){return Z}}}getAvailableMessages(){let $=this.messageBuffer;this.messageBuffer=[];let Z=this.isEndOfStream;return{getMessages(){return $},isEndOfStream(){return Z}}}encode({headers:$,body:Z}){let Q=this.headerMarshaller.format($),X=Q.byteLength+Z.byteLength+16,Y=new Uint8Array(X),J=new DataView(Y.buffer,Y.byteOffset,Y.byteLength),G=new Ob1.Crc32;return J.setUint32(0,X,!1),J.setUint32(4,Q.byteLength,!1),J.setUint32(8,G.update(Y.subarray(0,8)).digest(),!1),Y.set(Q,12),Y.set(Z,Q.byteLength+12),J.setUint32(X-4,G.update(Y.subarray(8,X-4)).digest(),!1),Y}decode($){let{headers:Z,body:Q}=Nb1($);return{headers:this.headerMarshaller.parse(Z),body:Q}}formatHeaders($){return this.headerMarshaller.format($)}}var Ob1;var Db1=D(()=>{vy0();Bb1();Ob1=C(jE(),1)});var Lb1=()=>{};var xy0;var wb1=D(()=>{xy0=class xy0{options;constructor($){this.options=$}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let $ of this.options.inputStream)yield this.options.decoder.decode($)}}});var fy0;var jb1=D(()=>{fy0=class fy0{options;constructor($){this.options=$}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let $ of this.options.messageStream)yield this.options.encoder.encode($);if(this.options.includeEndFrame)yield new Uint8Array(0)}}});var yy0;var Eb1=D(()=>{yy0=class yy0{options;constructor($){this.options=$}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let $ of this.options.messageStream){let Z=await this.options.deserializer($);if(Z===void 0)continue;yield Z}}}});var gy0;var zb1=D(()=>{gy0=class gy0{options;constructor($){this.options=$}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let $ of this.options.inputStream)yield this.options.serializer($)}}});var Pb1=D(()=>{Db1();vy0();Cy0();Lb1();wb1();jb1();Eb1();zb1()});function Ab1($){let Z=0,Q=0,X=null,Y=null,J=(W)=>{if(typeof W!=="number")throw Error("Attempted to allocate an event message where size was not a number: "+W);Z=W,Q=4,X=new Uint8Array(W),new DataView(X.buffer).setUint32(0,W,!1)},G=async function*(){let W=$[Symbol.asyncIterator]();while(!0){let{value:K,done:H}=await W.next();if(H){if(!Z)return;else if(Z===Q)yield X;else throw Error("Truncated event message received.");return}let F=K.length,U=0;while(U<F){if(!X){let B=F-U;if(!Y)Y=new Uint8Array(4);let O=Math.min(4-Q,B);if(Y.set(K.slice(U,U+O),Q),Q+=O,U+=O,Q<4)break;J(new DataView(Y.buffer).getUint32(0,!1)),Y=null}let N=Math.min(Z-Q,F-U);if(X.set(K.slice(U,U+N),Q),Q+=N,U+=N,Z&&Z===Q)yield X,X=null,Z=0,Q=0}}};return{[Symbol.asyncIterator]:G}}function Tb1($,Z){return async function(Q){let{value:X}=Q.headers[":message-type"];if(X==="error"){let Y=Error(Q.headers[":error-message"].value||"UnknownError");throw Y.name=Q.headers[":error-code"].value,Y}else if(X==="exception"){let Y=Q.headers[":exception-type"].value,J={[Y]:Q},G=await $(J);if(G.$unknown){let W=Error(Z(Q.body));throw W.name=Y,W}throw G[Y]}else if(X==="event"){let Y={[Q.headers[":event-type"].value]:Q},J=await $(Y);if(J.$unknown)return;return J}else throw Error(`Unrecognizable event type: ${Q.headers[":event-type"].value}`)}}class hy0{eventStreamCodec;utfEncoder;constructor({utf8Encoder:$,utf8Decoder:Z}){this.eventStreamCodec=new by0($,Z),this.utfEncoder=$}deserialize($,Z){let Q=Ab1($);return new yy0({messageStream:new xy0({inputStream:Q,decoder:this.eventStreamCodec}),deserializer:Tb1(Z,this.utfEncoder)})}serialize($,Z){return new fy0({messageStream:new gy0({inputStream:$,serializer:Z}),encoder:this.eventStreamCodec,includeEndFrame:!0})}}var Rb1=D(()=>{Pb1()});var qb1=()=>{};var Mb1=D(()=>{Rb1();qb1()});async function*Ib1($){let Z=!1,Q=!1,X=[];$.on("error",(Y)=>{if(!Z)Z=!0;if(Y)throw Y}),$.on("data",(Y)=>{X.push(Y)}),$.on("end",()=>{Z=!0});while(!Q){let Y=await new Promise((J)=>setTimeout(()=>J(X.shift()),0));if(Y)yield Y;Q=Z&&X.length===0}}import{Readable as Ry8}from"stream";class uy0{universalMarshaller;constructor({utf8Encoder:$,utf8Decoder:Z}){this.universalMarshaller=new hy0({utf8Decoder:Z,utf8Encoder:$})}deserialize($,Z){let Q=typeof $[Symbol.asyncIterator]==="function"?$:Ib1($);return this.universalMarshaller.deserialize(Q,Z)}serialize($,Z){return Ry8.from(this.universalMarshaller.serialize($,Z))}}var ly0=D(()=>{Mb1()});var Vb1=($)=>new uy0($);var kb1=D(()=>{ly0()});var Sb1=D(()=>{ly0();kb1()});import{Writable as qy8}from"stream";var Cb1,cy0;var _b1=D(()=>{Cb1=C(ZQ(),1);cy0=class cy0 extends qy8{hash;constructor($,Z){super(Z);this.hash=$}_write($,Z,Q){try{this.hash.update(Cb1.toUint8Array($))}catch(X){return Q(X)}Q()}}});var vb1=()=>{};var bb1=($,Z)=>{if(Z.readableFlowing!==null)throw Error("Unable to calculate hash for flowing readable stream");let Q=new $,X=new cy0(Q);return Z.pipe(X),new Promise((Y,J)=>{Z.on("error",(G)=>{X.end(),J(G)}),X.on("error",J),X.on("finish",()=>{Q.digest().then(Y).catch(J)})})};var xb1=D(()=>{_b1()});var fb1=D(()=>{vb1();xb1()});var d90,yb1,gb1,hb1,ub1,m90,i90,p90,lb1=($)=>{return{apiVersion:"2006-03-01",base64Decoder:$?.base64Decoder??m90.fromBase64,base64Encoder:$?.base64Encoder??m90.toBase64,disableHostPrefix:$?.disableHostPrefix??!1,endpointProvider:$?.endpointProvider??T50,extensions:$?.extensions??[],getAwsChunkedEncodingStream:$?.getAwsChunkedEncodingStream??i90.getAwsChunkedEncodingStream,httpAuthSchemeProvider:$?.httpAuthSchemeProvider??m21,httpAuthSchemes:$?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(Z)=>Z.getIdentityProvider("aws.auth#sigv4"),signer:new d90.AwsSdkSigV4Signer},{schemeId:"aws.auth#sigv4a",identityProvider:(Z)=>Z.getIdentityProvider("aws.auth#sigv4a"),signer:new d90.AwsSdkSigV4ASigner}],logger:$?.logger??new hb1.NoOpLogger,protocol:$?.protocol??yb1.S3RestXmlProtocol,protocolSettings:$?.protocolSettings??{defaultNamespace:"com.amazonaws.s3",errorTypeRegistries:r21,xmlNamespace:"http://s3.amazonaws.com/doc/2006-03-01/",version:"2006-03-01",serviceTarget:"AmazonS3"},sdkStreamMixin:$?.sdkStreamMixin??i90.sdkStreamMixin,serviceId:$?.serviceId??"S3",signerConstructor:$?.signerConstructor??gb1.SignatureV4MultiRegion,signingEscapePath:$?.signingEscapePath??!1,urlParser:$?.urlParser??ub1.parseUrl,useArnRegion:$?.useArnRegion??void 0,utf8Decoder:$?.utf8Decoder??p90.fromUtf8,utf8Encoder:$?.utf8Encoder??p90.toUtf8}};var cb1=D(()=>{ab0();rb0();G1();d90=C(dQ(),1),yb1=C(Z$(),1),gb1=C(iy(),1),hb1=C(m0(),1),ub1=C(zH(),1),m90=C(IY(),1),i90=C(jy(),1),p90=C(ZQ(),1)});var db1,t90,mb1,o90,QD,n90,r90,oJ,a90,s90,ib1,pb1,nb1,tb1=($)=>{s90.emitWarningIfUnsupportedVersion(process.version);let Z=pb1.resolveDefaultsModeConfig($),Q=()=>Z().then(s90.loadConfigsForDefaultMode),X=lb1($);db1.emitWarningIfUnsupportedVersion(process.version);let Y={profile:$?.profile,logger:X.logger};return{...X,...$,runtime:"node",defaultsMode:Z,authSchemePreference:$?.authSchemePreference??oJ.loadConfig(t90.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS,Y),bodyLengthChecker:$?.bodyLengthChecker??ib1.calculateBodyLength,credentialDefaultProvider:$?.credentialDefaultProvider??av1,defaultUserAgentProvider:$?.defaultUserAgentProvider??o90.createDefaultUserAgentProvider({serviceId:X.serviceId,clientVersion:MM1.version}),disableS3ExpressSessionAuth:$?.disableS3ExpressSessionAuth??oJ.loadConfig(mb1.NODE_DISABLE_S3_EXPRESS_SESSION_AUTH_OPTIONS,Y),eventStreamSerdeProvider:$?.eventStreamSerdeProvider??Vb1,maxAttempts:$?.maxAttempts??oJ.loadConfig(r90.NODE_MAX_ATTEMPT_CONFIG_OPTIONS,$),md5:$?.md5??n90.Hash.bind(null,"md5"),region:$?.region??oJ.loadConfig(QD.NODE_REGION_CONFIG_OPTIONS,{...QD.NODE_REGION_CONFIG_FILE_OPTIONS,...Y}),requestChecksumCalculation:$?.requestChecksumCalculation??oJ.loadConfig(xD1,Y),requestHandler:a90.NodeHttpHandler.create($?.requestHandler??Q),responseChecksumValidation:$?.responseChecksumValidation??oJ.loadConfig(yD1,Y),retryMode:$?.retryMode??oJ.loadConfig({...r90.NODE_RETRY_MODE_CONFIG_OPTIONS,default:async()=>(await Q()).retryMode||nb1.DEFAULT_RETRY_MODE},$),sha1:$?.sha1??n90.Hash.bind(null,"sha1"),sha256:$?.sha256??n90.Hash.bind(null,"sha256"),sigv4aSigningRegionSet:$?.sigv4aSigningRegionSet??oJ.loadConfig(t90.NODE_SIGV4A_CONFIG_OPTIONS,Y),streamCollector:$?.streamCollector??a90.streamCollector,streamHasher:$?.streamHasher??bb1,useArnRegion:$?.useArnRegion??oJ.loadConfig(Zb1,Y),useDualstackEndpoint:$?.useDualstackEndpoint??oJ.loadConfig(QD.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS,Y),useFipsEndpoint:$?.useFipsEndpoint??oJ.loadConfig(QD.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS,Y),userAgentAppId:$?.userAgentAppId??oJ.loadConfig(o90.NODE_APP_ID_CONFIG_OPTIONS,Y)}};var ob1=D(()=>{qM1();ev1();Jb1();L6();Sb1();fb1();cb1();db1=C(s5(),1),t90=C(dQ(),1),mb1=C(Z$(),1),o90=C(sy(),1),QD=C(SY(),1),n90=C(ey(),1),r90=C(yW(),1),oJ=C(fW(),1),a90=C(vO(),1),s90=C(m0(),1),ib1=C($g(),1),pb1=C(Zg(),1),nb1=C(mU(),1)});var rb1=($)=>{let{httpAuthSchemes:Z,httpAuthSchemeProvider:Q,credentials:X}=$;return{setHttpAuthScheme(Y){let J=Z.findIndex((G)=>G.schemeId===Y.schemeId);if(J===-1)Z.push(Y);else Z.splice(J,1,Y)},httpAuthSchemes(){return Z},setHttpAuthSchemeProvider(Y){Q=Y},httpAuthSchemeProvider(){return Q},setCredentials(Y){X=Y},credentials(){return X}}},ab1=($)=>{return{httpAuthSchemes:$.httpAuthSchemes(),httpAuthSchemeProvider:$.httpAuthSchemeProvider(),credentials:$.credentials()}};var e90,$Z0,ZZ0,sb1=($,Z)=>{let Q=Object.assign(e90.getAwsRegionExtensionConfiguration($),ZZ0.getDefaultExtensionConfiguration($),$Z0.getHttpHandlerExtensionConfiguration($),rb1($));return Z.forEach((X)=>X.configure(Q)),Object.assign($,e90.resolveAwsRegionExtensionConfiguration(Q),ZZ0.resolveDefaultRuntimeConfig(Q),$Z0.resolveHttpHandlerRuntimeConfig(Q),ab1(Q))};var eb1=D(()=>{e90=C(xE(),1),$Z0=C(V5(),1),ZZ0=C(m0(),1)});var QZ0,$x1,Zx1,qH,XZ0,Qx1,Bg,Xx1,Yx1,Jx1,YZ0,Gx1,hX;var eE=D(()=>{vD1();L6();gA1();ab0();c50();K1();ob1();eb1();QZ0=C(Ry(),1),$x1=C(qy(),1),Zx1=C(My(),1),qH=C(Z$(),1),XZ0=C(kE(),1),Qx1=C(SY(),1),Bg=C(sZ(),1),Xx1=C(uQ(),1),Yx1=C(ly(),1),Jx1=C(Y1(),1),YZ0=C(yW(),1),Gx1=C(m0(),1);hX=class hX extends Gx1.Client{config;constructor(...[$]){let Z=tb1($||{});super(Z);this.initConfig=Z;let Q=p21(Z),X=XZ0.resolveUserAgentConfig(Q),Y=FE1(X),J=YZ0.resolveRetryConfig(Y),G=Qx1.resolveRegionConfig(J),W=QZ0.resolveHostHeaderConfig(G),K=Jx1.resolveEndpointConfig(W),H=yA1(K),F=i21(H),U=qH.resolveS3Config(F,{session:[()=>this,wp]}),N=sb1(U,$?.extensions||[]);this.config=N,this.middlewareStack.use(Xx1.getSchemaSerdePlugin(this.config)),this.middlewareStack.use(XZ0.getUserAgentPlugin(this.config)),this.middlewareStack.use(YZ0.getRetryPlugin(this.config)),this.middlewareStack.use(Yx1.getContentLengthPlugin(this.config)),this.middlewareStack.use(QZ0.getHostHeaderPlugin(this.config)),this.middlewareStack.use($x1.getLoggerPlugin(this.config)),this.middlewareStack.use(Zx1.getRecursionDetectionPlugin(this.config)),this.middlewareStack.use(Bg.getHttpAuthSchemeEndpointRuleSetPlugin(this.config,{httpAuthSchemeParametersProvider:l21,identityProviderConfigProvider:async(B)=>new Bg.DefaultIdentityProviderConfig({"aws.auth#sigv4":B.credentials,"aws.auth#sigv4a":B.credentials})})),this.middlewareStack.use(Bg.getHttpSigningPlugin(this.config)),this.middlewareStack.use(qH.getValidateBucketNamePlugin(this.config)),this.middlewareStack.use(_D1(this.config)),this.middlewareStack.use(qH.getRegionRedirectMiddlewarePlugin(this.config)),this.middlewareStack.use(qH.getS3ExpressPlugin(this.config)),this.middlewareStack.use(qH.getS3ExpressHttpSigningPlugin(this.config))}destroy(){super.destroy()}}});var Wx1,Kx1,Hx1,gp;var dy0=D(()=>{K1();G1();Wx1=C(Z$(),1),Kx1=C(Y1(),1),Hx1=C(m0(),1);gp=class gp extends Hx1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[Kx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Wx1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","AbortMultipartUpload",{}).n("S3Client","AbortMultipartUploadCommand").sc(TR1).build(){}});function My8($){return(Z)=>async(Q)=>{let X={...Q.input},Y=[{target:"SSECustomerKey",hash:"SSECustomerKeyMD5"},{target:"CopySourceSSECustomerKey",hash:"CopySourceSSECustomerKeyMD5"}];for(let J of Y){let G=X[J.target];if(G){let W;if(typeof G==="string")if(Vy8(G,$))W=$.base64Decoder(G);else W=$.utf8Decoder(G),X[J.target]=$.base64Encoder(W);else W=ArrayBuffer.isView(G)?new Uint8Array(G.buffer,G.byteOffset,G.byteLength):new Uint8Array(G),X[J.target]=$.base64Encoder(W);let K=new $.md5;K.update(W),X[J.hash]=$.base64Encoder(await K.digest())}}return Z({...Q,input:X})}}function Vy8($,Z){if(!/^(?:[A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test($))return!1;try{return Z.base64Decoder($).length===32}catch{return!1}}var Iy8,i9=($)=>({applyToStack:(Z)=>{Z.add(My8($),Iy8)}});var F3=D(()=>{Iy8={name:"ssecMiddleware",step:"initialize",tags:["SSE"],override:!0}});var Fx1,Ux1,Nx1,hp;var my0=D(()=>{F3();K1();G1();Fx1=C(Z$(),1),Ux1=C(Y1(),1),Nx1=C(m0(),1);hp=class hp extends Nx1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[Ux1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Fx1.getThrow200ExceptionsPlugin(Q),i9(Q)]}).s("AmazonS3","CompleteMultipartUpload",{}).n("S3Client","CompleteMultipartUploadCommand").sc(RR1).build(){}});var Bx1,Ox1,Dx1,iy0;var py0=D(()=>{F3();K1();G1();Bx1=C(Z$(),1),Ox1=C(Y1(),1),Dx1=C(m0(),1);iy0=class iy0 extends Dx1.Command.classBuilder().ep({...B0,DisableS3ExpressSessionAuth:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"},CopySource:{type:"contextParams",name:"CopySource"}}).m(function($,Z,Q,X){return[Ox1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Bx1.getThrow200ExceptionsPlugin(Q),i9(Q)]}).s("AmazonS3","CopyObject",{}).n("S3Client","CopyObjectCommand").sc(qR1).build(){}});function ky8($){return(Z)=>async(Q)=>{let{CreateBucketConfiguration:X}=Q.input,Y=await $.region();if(!X?.LocationConstraint&&!X?.Location){if(Y!=="us-east-1")Q.input.CreateBucketConfiguration=Q.input.CreateBucketConfiguration??{},Q.input.CreateBucketConfiguration.LocationConstraint=Y}return Z(Q)}}var Sy8,Lx1=($)=>({applyToStack:(Z)=>{Z.add(ky8($),Sy8)}});var wx1=D(()=>{Sy8={step:"initialize",tags:["LOCATION_CONSTRAINT","CREATE_BUCKET_CONFIGURATION"],name:"locationConstraintMiddleware",override:!0}});var jx1,Ex1,zx1,ny0;var ty0=D(()=>{wx1();K1();G1();jx1=C(Z$(),1),Ex1=C(Y1(),1),zx1=C(m0(),1);ny0=class ny0 extends zx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},DisableAccessPoints:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Ex1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),jx1.getThrow200ExceptionsPlugin(Q),Lx1(Q)]}).s("AmazonS3","CreateBucket",{}).n("S3Client","CreateBucketCommand").sc(MR1).build(){}});var Px1,Ax1,oy0;var ry0=D(()=>{L6();K1();G1();Px1=C(Y1(),1),Ax1=C(m0(),1);oy0=class oy0 extends Ax1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Px1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","CreateBucketMetadataConfiguration",{}).n("S3Client","CreateBucketMetadataConfigurationCommand").sc(IR1).build(){}});var Tx1,Rx1,ay0;var sy0=D(()=>{L6();K1();G1();Tx1=C(Y1(),1),Rx1=C(m0(),1);ay0=class ay0 extends Rx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Tx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","CreateBucketMetadataTableConfiguration",{}).n("S3Client","CreateBucketMetadataTableConfigurationCommand").sc(VR1).build(){}});var qx1,Mx1,Ix1,up;var ey0=D(()=>{F3();K1();G1();qx1=C(Z$(),1),Mx1=C(Y1(),1),Ix1=C(m0(),1);up=class up extends Ix1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[Mx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),qx1.getThrow200ExceptionsPlugin(Q),i9(Q)]}).s("AmazonS3","CreateMultipartUpload",{}).n("S3Client","CreateMultipartUploadCommand").sc(kR1).build(){}});var Vx1,kx1,$g0;var Zg0=D(()=>{K1();G1();Vx1=C(Y1(),1),kx1=C(m0(),1);$g0=class $g0 extends kx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Vx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketAnalyticsConfiguration",{}).n("S3Client","DeleteBucketAnalyticsConfigurationCommand").sc(_R1).build(){}});var Sx1,Cx1,Qg0;var Xg0=D(()=>{K1();G1();Sx1=C(Y1(),1),Cx1=C(m0(),1);Qg0=class Qg0 extends Cx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Sx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucket",{}).n("S3Client","DeleteBucketCommand").sc(CR1).build(){}});var _x1,vx1,Yg0;var Jg0=D(()=>{K1();G1();_x1=C(Y1(),1),vx1=C(m0(),1);Yg0=class Yg0 extends vx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[_x1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketCors",{}).n("S3Client","DeleteBucketCorsCommand").sc(vR1).build(){}});var bx1,xx1,Gg0;var Wg0=D(()=>{K1();G1();bx1=C(Y1(),1),xx1=C(m0(),1);Gg0=class Gg0 extends xx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[bx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketEncryption",{}).n("S3Client","DeleteBucketEncryptionCommand").sc(bR1).build(){}});var fx1,yx1,Kg0;var Hg0=D(()=>{K1();G1();fx1=C(Y1(),1),yx1=C(m0(),1);Kg0=class Kg0 extends yx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[fx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketIntelligentTieringConfiguration",{}).n("S3Client","DeleteBucketIntelligentTieringConfigurationCommand").sc(xR1).build(){}});var gx1,hx1,Fg0;var Ug0=D(()=>{K1();G1();gx1=C(Y1(),1),hx1=C(m0(),1);Fg0=class Fg0 extends hx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[gx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketInventoryConfiguration",{}).n("S3Client","DeleteBucketInventoryConfigurationCommand").sc(fR1).build(){}});var ux1,lx1,Ng0;var Bg0=D(()=>{K1();G1();ux1=C(Y1(),1),lx1=C(m0(),1);Ng0=class Ng0 extends lx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[ux1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketLifecycle",{}).n("S3Client","DeleteBucketLifecycleCommand").sc(yR1).build(){}});var cx1,dx1,Og0;var Dg0=D(()=>{K1();G1();cx1=C(Y1(),1),dx1=C(m0(),1);Og0=class Og0 extends dx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[cx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketMetadataConfiguration",{}).n("S3Client","DeleteBucketMetadataConfigurationCommand").sc(gR1).build(){}});var mx1,ix1,Lg0;var wg0=D(()=>{K1();G1();mx1=C(Y1(),1),ix1=C(m0(),1);Lg0=class Lg0 extends ix1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[mx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketMetadataTableConfiguration",{}).n("S3Client","DeleteBucketMetadataTableConfigurationCommand").sc(hR1).build(){}});var px1,nx1,jg0;var Eg0=D(()=>{K1();G1();px1=C(Y1(),1),nx1=C(m0(),1);jg0=class jg0 extends nx1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[px1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketMetricsConfiguration",{}).n("S3Client","DeleteBucketMetricsConfigurationCommand").sc(uR1).build(){}});var tx1,ox1,zg0;var Pg0=D(()=>{K1();G1();tx1=C(Y1(),1),ox1=C(m0(),1);zg0=class zg0 extends ox1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[tx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketOwnershipControls",{}).n("S3Client","DeleteBucketOwnershipControlsCommand").sc(lR1).build(){}});var rx1,ax1,Ag0;var Tg0=D(()=>{K1();G1();rx1=C(Y1(),1),ax1=C(m0(),1);Ag0=class Ag0 extends ax1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[rx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketPolicy",{}).n("S3Client","DeleteBucketPolicyCommand").sc(cR1).build(){}});var sx1,ex1,Rg0;var qg0=D(()=>{K1();G1();sx1=C(Y1(),1),ex1=C(m0(),1);Rg0=class Rg0 extends ex1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[sx1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketReplication",{}).n("S3Client","DeleteBucketReplicationCommand").sc(dR1).build(){}});var $f1,Zf1,Mg0;var Ig0=D(()=>{K1();G1();$f1=C(Y1(),1),Zf1=C(m0(),1);Mg0=class Mg0 extends Zf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[$f1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketTagging",{}).n("S3Client","DeleteBucketTaggingCommand").sc(mR1).build(){}});var Qf1,Xf1,Vg0;var kg0=D(()=>{K1();G1();Qf1=C(Y1(),1),Xf1=C(m0(),1);Vg0=class Vg0 extends Xf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Qf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeleteBucketWebsite",{}).n("S3Client","DeleteBucketWebsiteCommand").sc(iR1).build(){}});var Yf1,Jf1,Gf1,$z;var Sg0=D(()=>{K1();G1();Yf1=C(Z$(),1),Jf1=C(Y1(),1),Gf1=C(m0(),1);$z=class $z extends Gf1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[Jf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Yf1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","DeleteObject",{}).n("S3Client","DeleteObjectCommand").sc(pR1).build(){}});var Wf1,Kf1,Hf1,Cg0;var _g0=D(()=>{L6();K1();G1();Wf1=C(Z$(),1),Kf1=C(Y1(),1),Hf1=C(m0(),1);Cg0=class Cg0 extends Hf1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Kf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0}),Wf1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","DeleteObjects",{}).n("S3Client","DeleteObjectsCommand").sc(nR1).build(){}});var Ff1,Uf1,Nf1,vg0;var bg0=D(()=>{K1();G1();Ff1=C(Z$(),1),Uf1=C(Y1(),1),Nf1=C(m0(),1);vg0=class vg0 extends Nf1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Uf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Ff1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","DeleteObjectTagging",{}).n("S3Client","DeleteObjectTaggingCommand").sc(tR1).build(){}});var Bf1,Of1,xg0;var fg0=D(()=>{K1();G1();Bf1=C(Y1(),1),Of1=C(m0(),1);xg0=class xg0 extends Of1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Bf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","DeletePublicAccessBlock",{}).n("S3Client","DeletePublicAccessBlockCommand").sc(oR1).build(){}});var Df1,Lf1,wf1,yg0;var gg0=D(()=>{K1();G1();Df1=C(Z$(),1),Lf1=C(Y1(),1),wf1=C(m0(),1);yg0=class yg0 extends wf1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Lf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Df1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketAbac",{}).n("S3Client","GetBucketAbacCommand").sc(rR1).build(){}});var jf1,Ef1,zf1,hg0;var ug0=D(()=>{K1();G1();jf1=C(Z$(),1),Ef1=C(Y1(),1),zf1=C(m0(),1);hg0=class hg0 extends zf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Ef1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),jf1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketAccelerateConfiguration",{}).n("S3Client","GetBucketAccelerateConfigurationCommand").sc(aR1).build(){}});var Pf1,Af1,Tf1,lg0;var cg0=D(()=>{K1();G1();Pf1=C(Z$(),1),Af1=C(Y1(),1),Tf1=C(m0(),1);lg0=class lg0 extends Tf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Af1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Pf1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketAcl",{}).n("S3Client","GetBucketAclCommand").sc(sR1).build(){}});var Rf1,qf1,Mf1,dg0;var mg0=D(()=>{K1();G1();Rf1=C(Z$(),1),qf1=C(Y1(),1),Mf1=C(m0(),1);dg0=class dg0 extends Mf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[qf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Rf1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketAnalyticsConfiguration",{}).n("S3Client","GetBucketAnalyticsConfigurationCommand").sc(eR1).build(){}});var If1,Vf1,kf1,ig0;var pg0=D(()=>{K1();G1();If1=C(Z$(),1),Vf1=C(Y1(),1),kf1=C(m0(),1);ig0=class ig0 extends kf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Vf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),If1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketCors",{}).n("S3Client","GetBucketCorsCommand").sc($q1).build(){}});var Sf1,Cf1,_f1,ng0;var tg0=D(()=>{K1();G1();Sf1=C(Z$(),1),Cf1=C(Y1(),1),_f1=C(m0(),1);ng0=class ng0 extends _f1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Cf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Sf1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketEncryption",{}).n("S3Client","GetBucketEncryptionCommand").sc(Zq1).build(){}});var vf1,bf1,xf1,og0;var rg0=D(()=>{K1();G1();vf1=C(Z$(),1),bf1=C(Y1(),1),xf1=C(m0(),1);og0=class og0 extends xf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[bf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),vf1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketIntelligentTieringConfiguration",{}).n("S3Client","GetBucketIntelligentTieringConfigurationCommand").sc(Qq1).build(){}});var ff1,yf1,gf1,ag0;var sg0=D(()=>{K1();G1();ff1=C(Z$(),1),yf1=C(Y1(),1),gf1=C(m0(),1);ag0=class ag0 extends gf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[yf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),ff1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketInventoryConfiguration",{}).n("S3Client","GetBucketInventoryConfigurationCommand").sc(Xq1).build(){}});var hf1,uf1,lf1,eg0;var $h0=D(()=>{K1();G1();hf1=C(Z$(),1),uf1=C(Y1(),1),lf1=C(m0(),1);eg0=class eg0 extends lf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[uf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),hf1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketLifecycleConfiguration",{}).n("S3Client","GetBucketLifecycleConfigurationCommand").sc(Yq1).build(){}});var cf1,df1,mf1,Zh0;var Qh0=D(()=>{K1();G1();cf1=C(Z$(),1),df1=C(Y1(),1),mf1=C(m0(),1);Zh0=class Zh0 extends mf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[df1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),cf1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketLocation",{}).n("S3Client","GetBucketLocationCommand").sc(Jq1).build(){}});var if1,pf1,nf1,Xh0;var Yh0=D(()=>{K1();G1();if1=C(Z$(),1),pf1=C(Y1(),1),nf1=C(m0(),1);Xh0=class Xh0 extends nf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[pf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),if1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketLogging",{}).n("S3Client","GetBucketLoggingCommand").sc(Gq1).build(){}});var tf1,of1,rf1,Jh0;var Gh0=D(()=>{K1();G1();tf1=C(Z$(),1),of1=C(Y1(),1),rf1=C(m0(),1);Jh0=class Jh0 extends rf1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[of1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),tf1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketMetadataConfiguration",{}).n("S3Client","GetBucketMetadataConfigurationCommand").sc(Wq1).build(){}});var af1,sf1,ef1,Wh0;var Kh0=D(()=>{K1();G1();af1=C(Z$(),1),sf1=C(Y1(),1),ef1=C(m0(),1);Wh0=class Wh0 extends ef1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[sf1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),af1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketMetadataTableConfiguration",{}).n("S3Client","GetBucketMetadataTableConfigurationCommand").sc(Kq1).build(){}});var $y1,Zy1,Qy1,Hh0;var Fh0=D(()=>{K1();G1();$y1=C(Z$(),1),Zy1=C(Y1(),1),Qy1=C(m0(),1);Hh0=class Hh0 extends Qy1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Zy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),$y1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketMetricsConfiguration",{}).n("S3Client","GetBucketMetricsConfigurationCommand").sc(Hq1).build(){}});var Xy1,Yy1,Jy1,Uh0;var Nh0=D(()=>{K1();G1();Xy1=C(Z$(),1),Yy1=C(Y1(),1),Jy1=C(m0(),1);Uh0=class Uh0 extends Jy1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Yy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Xy1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketNotificationConfiguration",{}).n("S3Client","GetBucketNotificationConfigurationCommand").sc(Fq1).build(){}});var Gy1,Wy1,Ky1,Bh0;var Oh0=D(()=>{K1();G1();Gy1=C(Z$(),1),Wy1=C(Y1(),1),Ky1=C(m0(),1);Bh0=class Bh0 extends Ky1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Wy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Gy1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketOwnershipControls",{}).n("S3Client","GetBucketOwnershipControlsCommand").sc(Uq1).build(){}});var Hy1,Fy1,Dh0;var Lh0=D(()=>{K1();G1();Hy1=C(Y1(),1),Fy1=C(m0(),1);Dh0=class Dh0 extends Fy1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Hy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","GetBucketPolicy",{}).n("S3Client","GetBucketPolicyCommand").sc(Nq1).build(){}});var Uy1,Ny1,By1,wh0;var jh0=D(()=>{K1();G1();Uy1=C(Z$(),1),Ny1=C(Y1(),1),By1=C(m0(),1);wh0=class wh0 extends By1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Ny1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Uy1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketPolicyStatus",{}).n("S3Client","GetBucketPolicyStatusCommand").sc(Bq1).build(){}});var Oy1,Dy1,Ly1,Eh0;var zh0=D(()=>{K1();G1();Oy1=C(Z$(),1),Dy1=C(Y1(),1),Ly1=C(m0(),1);Eh0=class Eh0 extends Ly1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Dy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Oy1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketReplication",{}).n("S3Client","GetBucketReplicationCommand").sc(Oq1).build(){}});var wy1,jy1,Ey1,Ph0;var Ah0=D(()=>{K1();G1();wy1=C(Z$(),1),jy1=C(Y1(),1),Ey1=C(m0(),1);Ph0=class Ph0 extends Ey1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[jy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),wy1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketRequestPayment",{}).n("S3Client","GetBucketRequestPaymentCommand").sc(Dq1).build(){}});var zy1,Py1,Ay1,Th0;var Rh0=D(()=>{K1();G1();zy1=C(Z$(),1),Py1=C(Y1(),1),Ay1=C(m0(),1);Th0=class Th0 extends Ay1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Py1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),zy1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketTagging",{}).n("S3Client","GetBucketTaggingCommand").sc(Lq1).build(){}});var Ty1,Ry1,qy1,qh0;var Mh0=D(()=>{K1();G1();Ty1=C(Z$(),1),Ry1=C(Y1(),1),qy1=C(m0(),1);qh0=class qh0 extends qy1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Ry1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Ty1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketVersioning",{}).n("S3Client","GetBucketVersioningCommand").sc(wq1).build(){}});var My1,Iy1,Vy1,Ih0;var Vh0=D(()=>{K1();G1();My1=C(Z$(),1),Iy1=C(Y1(),1),Vy1=C(m0(),1);Ih0=class Ih0 extends Vy1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Iy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),My1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetBucketWebsite",{}).n("S3Client","GetBucketWebsiteCommand").sc(jq1).build(){}});var ky1,Sy1,Cy1,kh0;var Sh0=D(()=>{K1();G1();ky1=C(Z$(),1),Sy1=C(Y1(),1),Cy1=C(m0(),1);kh0=class kh0 extends Cy1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[Sy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),ky1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetObjectAcl",{}).n("S3Client","GetObjectAclCommand").sc(zq1).build(){}});var _y1,vy1,by1,Ch0;var _h0=D(()=>{F3();K1();G1();_y1=C(Z$(),1),vy1=C(Y1(),1),by1=C(m0(),1);Ch0=class Ch0 extends by1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[vy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),_y1.getThrow200ExceptionsPlugin(Q),i9(Q)]}).s("AmazonS3","GetObjectAttributes",{}).n("S3Client","GetObjectAttributesCommand").sc(Pq1).build(){}});var xy1,fy1,yy1,XD;var vh0=D(()=>{L6();F3();K1();G1();xy1=C(Z$(),1),fy1=C(Y1(),1),yy1=C(m0(),1);XD=class XD extends yy1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[fy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestChecksumRequired:!1,requestValidationModeMember:"ChecksumMode",responseAlgorithms:["CRC64NVME","CRC32","CRC32C","SHA256","SHA1","SHA512","MD5","XXHASH64","XXHASH3","XXHASH128"]}),i9(Q),xy1.getS3ExpiresMiddlewarePlugin(Q)]}).s("AmazonS3","GetObject",{}).n("S3Client","GetObjectCommand").sc(Eq1).build(){}});var gy1,hy1,uy1,bh0;var xh0=D(()=>{K1();G1();gy1=C(Z$(),1),hy1=C(Y1(),1),uy1=C(m0(),1);bh0=class bh0 extends uy1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[hy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),gy1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetObjectLegalHold",{}).n("S3Client","GetObjectLegalHoldCommand").sc(Aq1).build(){}});var ly1,cy1,dy1,fh0;var yh0=D(()=>{K1();G1();ly1=C(Z$(),1),cy1=C(Y1(),1),dy1=C(m0(),1);fh0=class fh0 extends dy1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[cy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),ly1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetObjectLockConfiguration",{}).n("S3Client","GetObjectLockConfigurationCommand").sc(Tq1).build(){}});var my1,iy1,py1,gh0;var hh0=D(()=>{K1();G1();my1=C(Z$(),1),iy1=C(Y1(),1),py1=C(m0(),1);gh0=class gh0 extends py1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[iy1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),my1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetObjectRetention",{}).n("S3Client","GetObjectRetentionCommand").sc(Rq1).build(){}});var ny1,ty1,oy1,uh0;var lh0=D(()=>{K1();G1();ny1=C(Z$(),1),ty1=C(Y1(),1),oy1=C(m0(),1);uh0=class uh0 extends oy1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[ty1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),ny1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetObjectTagging",{}).n("S3Client","GetObjectTaggingCommand").sc(qq1).build(){}});var ry1,ay1,ch0;var dh0=D(()=>{K1();G1();ry1=C(Y1(),1),ay1=C(m0(),1);ch0=class ch0 extends ay1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[ry1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","GetObjectTorrent",{}).n("S3Client","GetObjectTorrentCommand").sc(Mq1).build(){}});var sy1,ey1,$g1,mh0;var ih0=D(()=>{K1();G1();sy1=C(Z$(),1),ey1=C(Y1(),1),$g1=C(m0(),1);mh0=class mh0 extends $g1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[ey1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),sy1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","GetPublicAccessBlock",{}).n("S3Client","GetPublicAccessBlockCommand").sc(Iq1).build(){}});var Zg1,Qg1,Xg1,Zz;var lp=D(()=>{K1();G1();Zg1=C(Z$(),1),Qg1=C(Y1(),1),Xg1=C(m0(),1);Zz=class Zz extends Xg1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Qg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Zg1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","HeadBucket",{}).n("S3Client","HeadBucketCommand").sc(Vq1).build(){}});var JZ0,Yg1,Jg1,MH;var cp=D(()=>{F3();K1();G1();JZ0=C(Z$(),1),Yg1=C(Y1(),1),Jg1=C(m0(),1);MH=class MH extends Jg1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[Yg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),JZ0.getThrow200ExceptionsPlugin(Q),i9(Q),JZ0.getS3ExpiresMiddlewarePlugin(Q)]}).s("AmazonS3","HeadObject",{}).n("S3Client","HeadObjectCommand").sc(kq1).build(){}});var Gg1,Wg1,Kg1,ph0;var nh0=D(()=>{K1();G1();Gg1=C(Z$(),1),Wg1=C(Y1(),1),Kg1=C(m0(),1);ph0=class ph0 extends Kg1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Wg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Gg1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","ListBucketAnalyticsConfigurations",{}).n("S3Client","ListBucketAnalyticsConfigurationsCommand").sc(Sq1).build(){}});var Hg1,Fg1,Ug1,th0;var oh0=D(()=>{K1();G1();Hg1=C(Z$(),1),Fg1=C(Y1(),1),Ug1=C(m0(),1);th0=class th0 extends Ug1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Fg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Hg1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","ListBucketIntelligentTieringConfigurations",{}).n("S3Client","ListBucketIntelligentTieringConfigurationsCommand").sc(Cq1).build(){}});var Ng1,Bg1,Og1,rh0;var ah0=D(()=>{K1();G1();Ng1=C(Z$(),1),Bg1=C(Y1(),1),Og1=C(m0(),1);rh0=class rh0 extends Og1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Bg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Ng1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","ListBucketInventoryConfigurations",{}).n("S3Client","ListBucketInventoryConfigurationsCommand").sc(_q1).build(){}});var Dg1,Lg1,wg1,sh0;var eh0=D(()=>{K1();G1();Dg1=C(Z$(),1),Lg1=C(Y1(),1),wg1=C(m0(),1);sh0=class sh0 extends wg1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Lg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Dg1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","ListBucketMetricsConfigurations",{}).n("S3Client","ListBucketMetricsConfigurationsCommand").sc(vq1).build(){}});var jg1,Eg1,zg1,dp;var GZ0=D(()=>{K1();G1();jg1=C(Z$(),1),Eg1=C(Y1(),1),zg1=C(m0(),1);dp=class dp extends zg1.Command.classBuilder().ep(B0).m(function($,Z,Q,X){return[Eg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),jg1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","ListBuckets",{}).n("S3Client","ListBucketsCommand").sc(bq1).build(){}});var Pg1,Ag1,Tg1,mp;var WZ0=D(()=>{K1();G1();Pg1=C(Z$(),1),Ag1=C(Y1(),1),Tg1=C(m0(),1);mp=class mp extends Tg1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0}}).m(function($,Z,Q,X){return[Ag1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Pg1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","ListDirectoryBuckets",{}).n("S3Client","ListDirectoryBucketsCommand").sc(xq1).build(){}});var Rg1,qg1,Mg1,$u0;var Zu0=D(()=>{K1();G1();Rg1=C(Z$(),1),qg1=C(Y1(),1),Mg1=C(m0(),1);$u0=class $u0 extends Mg1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Prefix:{type:"contextParams",name:"Prefix"}}).m(function($,Z,Q,X){return[qg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Rg1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","ListMultipartUploads",{}).n("S3Client","ListMultipartUploadsCommand").sc(fq1).build(){}});var Ig1,Vg1,kg1,Qu0;var Xu0=D(()=>{K1();G1();Ig1=C(Z$(),1),Vg1=C(Y1(),1),kg1=C(m0(),1);Qu0=class Qu0 extends kg1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Prefix:{type:"contextParams",name:"Prefix"}}).m(function($,Z,Q,X){return[Vg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Ig1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","ListObjects",{}).n("S3Client","ListObjectsCommand").sc(yq1).build(){}});var Sg1,Cg1,_g1,IH;var KZ0=D(()=>{K1();G1();Sg1=C(Z$(),1),Cg1=C(Y1(),1),_g1=C(m0(),1);IH=class IH extends _g1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Prefix:{type:"contextParams",name:"Prefix"}}).m(function($,Z,Q,X){return[Cg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Sg1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","ListObjectsV2",{}).n("S3Client","ListObjectsV2Command").sc(gq1).build(){}});var vg1,bg1,xg1,Yu0;var Ju0=D(()=>{K1();G1();vg1=C(Z$(),1),bg1=C(Y1(),1),xg1=C(m0(),1);Yu0=class Yu0 extends xg1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Prefix:{type:"contextParams",name:"Prefix"}}).m(function($,Z,Q,X){return[bg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),vg1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","ListObjectVersions",{}).n("S3Client","ListObjectVersionsCommand").sc(hq1).build(){}});var fg1,yg1,gg1,ip;var HZ0=D(()=>{F3();K1();G1();fg1=C(Z$(),1),yg1=C(Y1(),1),gg1=C(m0(),1);ip=class ip extends gg1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[yg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),fg1.getThrow200ExceptionsPlugin(Q),i9(Q)]}).s("AmazonS3","ListParts",{}).n("S3Client","ListPartsCommand").sc(uq1).build(){}});var hg1,ug1,Gu0;var Wu0=D(()=>{L6();K1();G1();hg1=C(Y1(),1),ug1=C(m0(),1);Gu0=class Gu0 extends ug1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[hg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!1})]}).s("AmazonS3","PutBucketAbac",{}).n("S3Client","PutBucketAbacCommand").sc(lq1).build(){}});var lg1,cg1,Ku0;var Hu0=D(()=>{L6();K1();G1();lg1=C(Y1(),1),cg1=C(m0(),1);Ku0=class Ku0 extends cg1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[lg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!1})]}).s("AmazonS3","PutBucketAccelerateConfiguration",{}).n("S3Client","PutBucketAccelerateConfigurationCommand").sc(cq1).build(){}});var dg1,mg1,Fu0;var Uu0=D(()=>{L6();K1();G1();dg1=C(Y1(),1),mg1=C(m0(),1);Fu0=class Fu0 extends mg1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[dg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketAcl",{}).n("S3Client","PutBucketAclCommand").sc(dq1).build(){}});var ig1,pg1,Nu0;var Bu0=D(()=>{K1();G1();ig1=C(Y1(),1),pg1=C(m0(),1);Nu0=class Nu0 extends pg1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[ig1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","PutBucketAnalyticsConfiguration",{}).n("S3Client","PutBucketAnalyticsConfigurationCommand").sc(mq1).build(){}});var ng1,tg1,Ou0;var Du0=D(()=>{L6();K1();G1();ng1=C(Y1(),1),tg1=C(m0(),1);Ou0=class Ou0 extends tg1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[ng1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketCors",{}).n("S3Client","PutBucketCorsCommand").sc(iq1).build(){}});var og1,rg1,Lu0;var wu0=D(()=>{L6();K1();G1();og1=C(Y1(),1),rg1=C(m0(),1);Lu0=class Lu0 extends rg1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[og1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketEncryption",{}).n("S3Client","PutBucketEncryptionCommand").sc(pq1).build(){}});var ag1,sg1,ju0;var Eu0=D(()=>{K1();G1();ag1=C(Y1(),1),sg1=C(m0(),1);ju0=class ju0 extends sg1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[ag1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","PutBucketIntelligentTieringConfiguration",{}).n("S3Client","PutBucketIntelligentTieringConfigurationCommand").sc(nq1).build(){}});var eg1,$h1,zu0;var Pu0=D(()=>{K1();G1();eg1=C(Y1(),1),$h1=C(m0(),1);zu0=class zu0 extends $h1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[eg1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","PutBucketInventoryConfiguration",{}).n("S3Client","PutBucketInventoryConfigurationCommand").sc(tq1).build(){}});var Zh1,Qh1,Xh1,Au0;var Tu0=D(()=>{L6();K1();G1();Zh1=C(Z$(),1),Qh1=C(Y1(),1),Xh1=C(m0(),1);Au0=class Au0 extends Xh1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Qh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0}),Zh1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","PutBucketLifecycleConfiguration",{}).n("S3Client","PutBucketLifecycleConfigurationCommand").sc(oq1).build(){}});var Yh1,Jh1,Ru0;var qu0=D(()=>{L6();K1();G1();Yh1=C(Y1(),1),Jh1=C(m0(),1);Ru0=class Ru0 extends Jh1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Yh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketLogging",{}).n("S3Client","PutBucketLoggingCommand").sc(rq1).build(){}});var Gh1,Wh1,Mu0;var Iu0=D(()=>{K1();G1();Gh1=C(Y1(),1),Wh1=C(m0(),1);Mu0=class Mu0 extends Wh1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Gh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","PutBucketMetricsConfiguration",{}).n("S3Client","PutBucketMetricsConfigurationCommand").sc(aq1).build(){}});var Kh1,Hh1,Vu0;var ku0=D(()=>{K1();G1();Kh1=C(Y1(),1),Hh1=C(m0(),1);Vu0=class Vu0 extends Hh1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Kh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","PutBucketNotificationConfiguration",{}).n("S3Client","PutBucketNotificationConfigurationCommand").sc(sq1).build(){}});var Fh1,Uh1,Su0;var Cu0=D(()=>{L6();K1();G1();Fh1=C(Y1(),1),Uh1=C(m0(),1);Su0=class Su0 extends Uh1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Fh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketOwnershipControls",{}).n("S3Client","PutBucketOwnershipControlsCommand").sc(eq1).build(){}});var Nh1,Bh1,_u0;var vu0=D(()=>{L6();K1();G1();Nh1=C(Y1(),1),Bh1=C(m0(),1);_u0=class _u0 extends Bh1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Nh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketPolicy",{}).n("S3Client","PutBucketPolicyCommand").sc($M1).build(){}});var Oh1,Dh1,bu0;var xu0=D(()=>{L6();K1();G1();Oh1=C(Y1(),1),Dh1=C(m0(),1);bu0=class bu0 extends Dh1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Oh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketReplication",{}).n("S3Client","PutBucketReplicationCommand").sc(ZM1).build(){}});var Lh1,wh1,fu0;var yu0=D(()=>{L6();K1();G1();Lh1=C(Y1(),1),wh1=C(m0(),1);fu0=class fu0 extends wh1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Lh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketRequestPayment",{}).n("S3Client","PutBucketRequestPaymentCommand").sc(QM1).build(){}});var jh1,Eh1,gu0;var hu0=D(()=>{L6();K1();G1();jh1=C(Y1(),1),Eh1=C(m0(),1);gu0=class gu0 extends Eh1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[jh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketTagging",{}).n("S3Client","PutBucketTaggingCommand").sc(XM1).build(){}});var zh1,Ph1,uu0;var lu0=D(()=>{L6();K1();G1();zh1=C(Y1(),1),Ph1=C(m0(),1);uu0=class uu0 extends Ph1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[zh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketVersioning",{}).n("S3Client","PutBucketVersioningCommand").sc(YM1).build(){}});var Ah1,Th1,cu0;var du0=D(()=>{L6();K1();G1();Ah1=C(Y1(),1),Th1=C(m0(),1);cu0=class cu0 extends Th1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Ah1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutBucketWebsite",{}).n("S3Client","PutBucketWebsiteCommand").sc(JM1).build(){}});var Rh1,qh1,Mh1,mu0;var iu0=D(()=>{L6();K1();G1();Rh1=C(Z$(),1),qh1=C(Y1(),1),Mh1=C(m0(),1);mu0=class mu0 extends Mh1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[qh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0}),Rh1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","PutObjectAcl",{}).n("S3Client","PutObjectAclCommand").sc(WM1).build(){}});var FZ0,Ih1,Vh1,ON;var pu0=D(()=>{L6();F3();K1();G1();FZ0=C(Z$(),1),Ih1=C(Y1(),1),Vh1=C(m0(),1);ON=class ON extends Vh1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[Ih1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!1}),FZ0.getCheckContentLengthHeaderPlugin(Q),FZ0.getThrow200ExceptionsPlugin(Q),i9(Q)]}).s("AmazonS3","PutObject",{}).n("S3Client","PutObjectCommand").sc(GM1).build(){}});var kh1,Sh1,Ch1,nu0;var tu0=D(()=>{L6();K1();G1();kh1=C(Z$(),1),Sh1=C(Y1(),1),Ch1=C(m0(),1);nu0=class nu0 extends Ch1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Sh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0}),kh1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","PutObjectLegalHold",{}).n("S3Client","PutObjectLegalHoldCommand").sc(KM1).build(){}});var _h1,vh1,bh1,ou0;var ru0=D(()=>{L6();K1();G1();_h1=C(Z$(),1),vh1=C(Y1(),1),bh1=C(m0(),1);ou0=class ou0 extends bh1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[vh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0}),_h1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","PutObjectLockConfiguration",{}).n("S3Client","PutObjectLockConfigurationCommand").sc(HM1).build(){}});var xh1,fh1,yh1,au0;var su0=D(()=>{L6();K1();G1();xh1=C(Z$(),1),fh1=C(Y1(),1),yh1=C(m0(),1);au0=class au0 extends yh1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[fh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0}),xh1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","PutObjectRetention",{}).n("S3Client","PutObjectRetentionCommand").sc(FM1).build(){}});var gh1,hh1,uh1,pp;var eu0=D(()=>{L6();K1();G1();gh1=C(Z$(),1),hh1=C(Y1(),1),uh1=C(m0(),1);pp=class pp extends uh1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[hh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0}),gh1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","PutObjectTagging",{}).n("S3Client","PutObjectTaggingCommand").sc(UM1).build(){}});var lh1,ch1,$l0;var Zl0=D(()=>{L6();K1();G1();lh1=C(Y1(),1),ch1=C(m0(),1);$l0=class $l0 extends ch1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[lh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","PutPublicAccessBlock",{}).n("S3Client","PutPublicAccessBlockCommand").sc(NM1).build(){}});var dh1,mh1,ih1,Ql0;var Xl0=D(()=>{K1();G1();dh1=C(Z$(),1),mh1=C(Y1(),1),ih1=C(m0(),1);Ql0=class Ql0 extends ih1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[mh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),dh1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","RenameObject",{}).n("S3Client","RenameObjectCommand").sc(BM1).build(){}});var ph1,nh1,th1,Yl0;var Jl0=D(()=>{L6();K1();G1();ph1=C(Z$(),1),nh1=C(Y1(),1),th1=C(m0(),1);Yl0=class Yl0 extends th1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[nh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!1}),ph1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","RestoreObject",{}).n("S3Client","RestoreObjectCommand").sc(OM1).build(){}});var oh1,rh1,Gl0;var Wl0=D(()=>{F3();K1();G1();oh1=C(Y1(),1),rh1=C(m0(),1);Gl0=class Gl0 extends rh1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[oh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),i9(Q)]}).s("AmazonS3","SelectObjectContent",{eventStream:{output:!0}}).n("S3Client","SelectObjectContentCommand").sc(DM1).build(){}});var ah1,sh1,Kl0;var Hl0=D(()=>{L6();K1();G1();ah1=C(Y1(),1),sh1=C(m0(),1);Kl0=class Kl0 extends sh1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[ah1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","UpdateBucketMetadataInventoryTableConfiguration",{}).n("S3Client","UpdateBucketMetadataInventoryTableConfigurationCommand").sc(LM1).build(){}});var eh1,$u1,Fl0;var Ul0=D(()=>{L6();K1();G1();eh1=C(Y1(),1),$u1=C(m0(),1);Fl0=class Fl0 extends $u1.Command.classBuilder().ep({...B0,UseS3ExpressControlEndpoint:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[eh1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0})]}).s("AmazonS3","UpdateBucketMetadataJournalTableConfiguration",{}).n("S3Client","UpdateBucketMetadataJournalTableConfigurationCommand").sc(wM1).build(){}});var Zu1,Qu1,Xu1,Nl0;var Bl0=D(()=>{L6();K1();G1();Zu1=C(Z$(),1),Qu1=C(Y1(),1),Xu1=C(m0(),1);Nl0=class Nl0 extends Xu1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Qu1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!0}),Zu1.getThrow200ExceptionsPlugin(Q)]}).s("AmazonS3","UpdateObjectEncryption",{}).n("S3Client","UpdateObjectEncryptionCommand").sc(jM1).build(){}});var Yu1,Ju1,Gu1,np;var Ol0=D(()=>{L6();F3();K1();G1();Yu1=C(Z$(),1),Ju1=C(Y1(),1),Gu1=C(m0(),1);np=class np extends Gu1.Command.classBuilder().ep({...B0,Bucket:{type:"contextParams",name:"Bucket"},Key:{type:"contextParams",name:"Key"}}).m(function($,Z,Q,X){return[Ju1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),v$(Q,{requestAlgorithmMember:{httpHeader:"x-amz-sdk-checksum-algorithm",name:"ChecksumAlgorithm"},requestChecksumRequired:!1}),Yu1.getThrow200ExceptionsPlugin(Q),i9(Q)]}).s("AmazonS3","UploadPart",{}).n("S3Client","UploadPartCommand").sc(EM1).build(){}});var Wu1,Ku1,Hu1,Dl0;var Ll0=D(()=>{F3();K1();G1();Wu1=C(Z$(),1),Ku1=C(Y1(),1),Hu1=C(m0(),1);Dl0=class Dl0 extends Hu1.Command.classBuilder().ep({...B0,DisableS3ExpressSessionAuth:{type:"staticContextParams",value:!0},Bucket:{type:"contextParams",name:"Bucket"}}).m(function($,Z,Q,X){return[Ku1.getEndpointPlugin(Q,$.getEndpointParameterInstructions()),Wu1.getThrow200ExceptionsPlugin(Q),i9(Q)]}).s("AmazonS3","UploadPartCopy",{}).n("S3Client","UploadPartCopyCommand").sc(zM1).build(){}});var Fu1,Uu1,wl0;var jl0=D(()=>{K1();G1();Fu1=C(Y1(),1),Uu1=C(m0(),1);wl0=class wl0 extends Uu1.Command.classBuilder().ep({...B0,UseObjectLambdaEndpoint:{type:"staticContextParams",value:!0}}).m(function($,Z,Q,X){return[Fu1.getEndpointPlugin(Q,$.getEndpointParameterInstructions())]}).s("AmazonS3","WriteGetObjectResponse",{}).n("S3Client","WriteGetObjectResponseCommand").sc(PM1).build(){}});var Nu1,Bu1;var El0=D(()=>{GZ0();eE();Nu1=C(sZ(),1),Bu1=Nu1.createPaginator(hX,dp,"ContinuationToken","ContinuationToken","MaxBuckets")});var Ou1,Du1;var zl0=D(()=>{WZ0();eE();Ou1=C(sZ(),1),Du1=Ou1.createPaginator(hX,mp,"ContinuationToken","ContinuationToken","MaxDirectoryBuckets")});var Lu1,wu1;var Pl0=D(()=>{KZ0();eE();Lu1=C(sZ(),1),wu1=Lu1.createPaginator(hX,IH,"ContinuationToken","NextContinuationToken","MaxKeys")});var ju1,Eu1;var Al0=D(()=>{HZ0();eE();ju1=C(sZ(),1),Eu1=ju1.createPaginator(hX,ip,"PartNumberMarker","NextPartNumberMarker","MaxParts")});var Og=()=>{let $=new WeakSet;return(Z,Q)=>{if(typeof Q==="object"&&Q!==null){if($.has(Q))return"[Circular]";$.add(Q)}return Q}};var zu1=($)=>{return new Promise((Z)=>setTimeout(Z,$*1000))};var Pu1,e5,YD=($)=>{if($.state===e5.ABORTED){let Z=Error(`${JSON.stringify({...$,reason:"Request was aborted"},Og())}`);throw Z.name="AbortError",Z}else if($.state===e5.TIMEOUT){let Z=Error(`${JSON.stringify({...$,reason:"Waiter has timed out"},Og())}`);throw Z.name="TimeoutError",Z}else if($.state!==e5.SUCCESS)throw Error(`${JSON.stringify($,Og())}`);return $};var UZ0=D(()=>{Pu1={minDelay:2,maxDelay:120};(function($){$.ABORTED="ABORTED",$.FAILURE="FAILURE",$.SUCCESS="SUCCESS",$.RETRY="RETRY",$.TIMEOUT="TIMEOUT"})(e5||(e5={}))});var Au1=async({minDelay:$,maxDelay:Z,maxWaitTime:Q,abortController:X,client:Y,abortSignal:J},G,W)=>{let K={},[H,F]=[$*1000,Z*1000],U=0,N=Date.now()+Q*1000,B=Date.now()+60000,O=!1;while(!0){if(U>0){let j=vy8(H,F,U,N);if(X?.signal?.aborted||J?.aborted)return K["AbortController signal aborted."]|=0,K["AbortController signal aborted."]+=1,{state:e5.ABORTED,observedResponses:K};if(Date.now()+j>N)return{state:e5.TIMEOUT,observedResponses:K};await zu1(j/1000)}let{state:L,reason:w}=await W(Y,G);if(w){let j=_y8(w);K[j]|=0,K[j]+=1}if(L!==e5.RETRY)return{state:L,reason:w,final:w,observedResponses:K};if(U+=1,!O&&Date.now()>=B)Cy8(K,Y),O=!0}},Cy8=($={},Z)=>{let Q=Object.keys($),X=0,Y=0;for(let W of Q){let K=$[W]|0;if(X=Math.max(K,X),W.startsWith("403:"))Y+=K}let J=Z?.config?.logger,G=typeof J?.warn==="function"&&!J.constructor?.name?.includes?.("NoOpLogger")?J:console;if(Y>=3||Q[Q.length-1].startsWith("403:"))G.warn("@smithy/util-waiter WARN - 403 status code encountered during waiter polling.")},_y8=($)=>{let Z=$?.$response?.statusCode??$?.$metadata?.httpStatusCode;if($?.$responseBodyText)return`${Z?Z+": ":""}Deserialization error for body: ${$.$responseBodyText}`;if(Z){if($?.$response||$?.message)return`${Z??"Unknown"}: ${$?.message}`;return`${Z}: OK`}return String($?.message??JSON.stringify($,Og())??"Unknown")},vy8=($,Z,Q,X)=>{let Y=Math.log(Z/$)/Math.log(2)+1;if(Q>Y)return Z;let J=$*2**(Q-1),G=Math.min(J,Z),W=by8($,G);if(Date.now()+W>X){let K=X-Date.now();return Math.max(0,K-500)}return W},by8=($,Z)=>$+Math.random()*(Z-$);var Tu1=D(()=>{UZ0()});var Ru1=($)=>{if($.maxWaitTime<=0)throw Error("WaiterConfiguration.maxWaitTime must be greater than 0");else if($.minDelay<=0)throw Error("WaiterConfiguration.minDelay must be greater than 0");else if($.maxDelay<=0)throw Error("WaiterConfiguration.maxDelay must be greater than 0");else if($.maxWaitTime<=$.minDelay)throw Error(`WaiterConfiguration.maxWaitTime [${$.maxWaitTime}] must be greater than WaiterConfiguration.minDelay [${$.minDelay}] for this waiter`);else if($.maxDelay<$.minDelay)throw Error(`WaiterConfiguration.maxDelay [${$.maxDelay}] must be greater than WaiterConfiguration.minDelay [${$.minDelay}] for this waiter`)};var qu1=()=>{};var Mu1=($)=>{let Z,Q=new Promise((X)=>{if(Z=()=>X({state:e5.ABORTED}),typeof $.addEventListener==="function")$.addEventListener("abort",Z);else $.onabort=Z});return{clearListener(){if(typeof $.removeEventListener==="function")$.removeEventListener("abort",Z)},aborted:Q}},JD=async($,Z,Q)=>{let X={...Pu1,...$};Ru1(X);let Y=[Au1(X,Z,Q)],J=[];if($.abortSignal){let{aborted:G,clearListener:W}=Mu1($.abortSignal);J.push(W),Y.push(G)}if($.abortController?.signal){let{aborted:G,clearListener:W}=Mu1($.abortController.signal);J.push(W),Y.push(G)}return Promise.race(Y).then((G)=>{for(let W of J)W();return G})};var Iu1=D(()=>{Tu1();qu1();UZ0()});var tp=D(()=>{Iu1();UZ0()});var xy8=async($,Z)=>{let Q;try{return Q=await $.send(new Zz(Z)),{state:e5.SUCCESS,reason:Q}}catch(X){if(Q=X,X.name==="NotFound")return{state:e5.RETRY,reason:Q}}return{state:e5.RETRY,reason:Q}},Vu1=async($,Z)=>{let X=await JD({...{minDelay:5,maxDelay:120},...$},Z,xy8);return YD(X)};var Tl0=D(()=>{tp();lp()});var fy8=async($,Z)=>{let Q;try{Q=await $.send(new Zz(Z))}catch(X){if(Q=X,X.name==="NotFound")return{state:e5.SUCCESS,reason:Q}}return{state:e5.RETRY,reason:Q}},ku1=async($,Z)=>{let X=await JD({...{minDelay:5,maxDelay:120},...$},Z,fy8);return YD(X)};var Rl0=D(()=>{tp();lp()});var yy8=async($,Z)=>{let Q;try{return Q=await $.send(new MH(Z)),{state:e5.SUCCESS,reason:Q}}catch(X){if(Q=X,X.name==="NotFound")return{state:e5.RETRY,reason:Q}}return{state:e5.RETRY,reason:Q}},Su1=async($,Z)=>{let X=await JD({...{minDelay:5,maxDelay:120},...$},Z,yy8);return YD(X)};var ql0=D(()=>{tp();cp()});var gy8=async($,Z)=>{let Q;try{Q=await $.send(new MH(Z))}catch(X){if(Q=X,X.name==="NotFound")return{state:e5.SUCCESS,reason:Q}}return{state:e5.RETRY,reason:Q}},Cu1=async($,Z)=>{let X=await JD({...{minDelay:5,maxDelay:120},...$},Z,gy8);return YD(X)};var Ml0=D(()=>{tp();cp()});var _u1,hy8,uy8,ly8,vu1;var bu1=D(()=>{dy0();my0();py0();ty0();ry0();sy0();ey0();c50();Zg0();Xg0();Jg0();Wg0();Hg0();Ug0();Bg0();Dg0();wg0();Eg0();Pg0();Tg0();qg0();Ig0();kg0();Sg0();_g0();bg0();fg0();gg0();ug0();cg0();mg0();pg0();tg0();rg0();sg0();$h0();Qh0();Yh0();Gh0();Kh0();Fh0();Nh0();Oh0();Lh0();jh0();zh0();Ah0();Rh0();Mh0();Vh0();Sh0();_h0();vh0();xh0();yh0();hh0();lh0();dh0();ih0();lp();cp();nh0();oh0();ah0();eh0();GZ0();WZ0();Zu0();Xu0();KZ0();Ju0();HZ0();Wu0();Hu0();Uu0();Bu0();Du0();wu0();Eu0();Pu0();Tu0();qu0();Iu0();ku0();Cu0();vu0();xu0();yu0();hu0();lu0();du0();iu0();pu0();tu0();ru0();su0();eu0();Zl0();Xl0();Jl0();Wl0();Hl0();Ul0();Bl0();Ol0();Ll0();jl0();El0();zl0();Pl0();Al0();eE();Tl0();Rl0();ql0();Ml0();_u1=C(m0(),1),hy8={AbortMultipartUploadCommand:gp,CompleteMultipartUploadCommand:hp,CopyObjectCommand:iy0,CreateBucketCommand:ny0,CreateBucketMetadataConfigurationCommand:oy0,CreateBucketMetadataTableConfigurationCommand:ay0,CreateMultipartUploadCommand:up,CreateSessionCommand:wp,DeleteBucketCommand:Qg0,DeleteBucketAnalyticsConfigurationCommand:$g0,DeleteBucketCorsCommand:Yg0,DeleteBucketEncryptionCommand:Gg0,DeleteBucketIntelligentTieringConfigurationCommand:Kg0,DeleteBucketInventoryConfigurationCommand:Fg0,DeleteBucketLifecycleCommand:Ng0,DeleteBucketMetadataConfigurationCommand:Og0,DeleteBucketMetadataTableConfigurationCommand:Lg0,DeleteBucketMetricsConfigurationCommand:jg0,DeleteBucketOwnershipControlsCommand:zg0,DeleteBucketPolicyCommand:Ag0,DeleteBucketReplicationCommand:Rg0,DeleteBucketTaggingCommand:Mg0,DeleteBucketWebsiteCommand:Vg0,DeleteObjectCommand:$z,DeleteObjectsCommand:Cg0,DeleteObjectTaggingCommand:vg0,DeletePublicAccessBlockCommand:xg0,GetBucketAbacCommand:yg0,GetBucketAccelerateConfigurationCommand:hg0,GetBucketAclCommand:lg0,GetBucketAnalyticsConfigurationCommand:dg0,GetBucketCorsCommand:ig0,GetBucketEncryptionCommand:ng0,GetBucketIntelligentTieringConfigurationCommand:og0,GetBucketInventoryConfigurationCommand:ag0,GetBucketLifecycleConfigurationCommand:eg0,GetBucketLocationCommand:Zh0,GetBucketLoggingCommand:Xh0,GetBucketMetadataConfigurationCommand:Jh0,GetBucketMetadataTableConfigurationCommand:Wh0,GetBucketMetricsConfigurationCommand:Hh0,GetBucketNotificationConfigurationCommand:Uh0,GetBucketOwnershipControlsCommand:Bh0,GetBucketPolicyCommand:Dh0,GetBucketPolicyStatusCommand:wh0,GetBucketReplicationCommand:Eh0,GetBucketRequestPaymentCommand:Ph0,GetBucketTaggingCommand:Th0,GetBucketVersioningCommand:qh0,GetBucketWebsiteCommand:Ih0,GetObjectCommand:XD,GetObjectAclCommand:kh0,GetObjectAttributesCommand:Ch0,GetObjectLegalHoldCommand:bh0,GetObjectLockConfigurationCommand:fh0,GetObjectRetentionCommand:gh0,GetObjectTaggingCommand:uh0,GetObjectTorrentCommand:ch0,GetPublicAccessBlockCommand:mh0,HeadBucketCommand:Zz,HeadObjectCommand:MH,ListBucketAnalyticsConfigurationsCommand:ph0,ListBucketIntelligentTieringConfigurationsCommand:th0,ListBucketInventoryConfigurationsCommand:rh0,ListBucketMetricsConfigurationsCommand:sh0,ListBucketsCommand:dp,ListDirectoryBucketsCommand:mp,ListMultipartUploadsCommand:$u0,ListObjectsCommand:Qu0,ListObjectsV2Command:IH,ListObjectVersionsCommand:Yu0,ListPartsCommand:ip,PutBucketAbacCommand:Gu0,PutBucketAccelerateConfigurationCommand:Ku0,PutBucketAclCommand:Fu0,PutBucketAnalyticsConfigurationCommand:Nu0,PutBucketCorsCommand:Ou0,PutBucketEncryptionCommand:Lu0,PutBucketIntelligentTieringConfigurationCommand:ju0,PutBucketInventoryConfigurationCommand:zu0,PutBucketLifecycleConfigurationCommand:Au0,PutBucketLoggingCommand:Ru0,PutBucketMetricsConfigurationCommand:Mu0,PutBucketNotificationConfigurationCommand:Vu0,PutBucketOwnershipControlsCommand:Su0,PutBucketPolicyCommand:_u0,PutBucketReplicationCommand:bu0,PutBucketRequestPaymentCommand:fu0,PutBucketTaggingCommand:gu0,PutBucketVersioningCommand:uu0,PutBucketWebsiteCommand:cu0,PutObjectCommand:ON,PutObjectAclCommand:mu0,PutObjectLegalHoldCommand:nu0,PutObjectLockConfigurationCommand:ou0,PutObjectRetentionCommand:au0,PutObjectTaggingCommand:pp,PutPublicAccessBlockCommand:$l0,RenameObjectCommand:Ql0,RestoreObjectCommand:Yl0,SelectObjectContentCommand:Gl0,UpdateBucketMetadataInventoryTableConfigurationCommand:Kl0,UpdateBucketMetadataJournalTableConfigurationCommand:Fl0,UpdateObjectEncryptionCommand:Nl0,UploadPartCommand:np,UploadPartCopyCommand:Dl0,WriteGetObjectResponseCommand:wl0},uy8={paginateListBuckets:Bu1,paginateListDirectoryBuckets:Du1,paginateListObjectsV2:wu1,paginateListParts:Eu1},ly8={waitUntilBucketExists:Vu1,waitUntilBucketNotExists:ku1,waitUntilObjectExists:Su1,waitUntilObjectNotExists:Cu1};vu1=class vu1 extends hX{};_u1.createAggregatedClient(hy8,vu1,{paginators:uy8,waiters:ly8})});var xu1=D(()=>{dy0();my0();py0();ty0();ry0();sy0();ey0();c50();Zg0();Xg0();Jg0();Wg0();Hg0();Ug0();Bg0();Dg0();wg0();Eg0();Pg0();Tg0();qg0();Ig0();kg0();Sg0();bg0();_g0();fg0();gg0();ug0();cg0();mg0();pg0();tg0();rg0();sg0();$h0();Qh0();Yh0();Gh0();Kh0();Fh0();Nh0();Oh0();Lh0();jh0();zh0();Ah0();Rh0();Mh0();Vh0();Sh0();_h0();vh0();xh0();yh0();hh0();lh0();dh0();ih0();lp();cp();nh0();oh0();ah0();eh0();GZ0();WZ0();Zu0();Ju0();Xu0();KZ0();HZ0();Wu0();Hu0();Uu0();Bu0();Du0();wu0();Eu0();Pu0();Tu0();qu0();Iu0();ku0();Cu0();vu0();xu0();yu0();hu0();lu0();du0();iu0();pu0();tu0();ru0();su0();eu0();Zl0();Xl0();Jl0();Wl0();Hl0();Ul0();Bl0();Ol0();Ll0();jl0()});var fu1=()=>{};var yu1=D(()=>{fu1();El0();zl0();Pl0();Al0()});var gu1=D(()=>{Tl0();Rl0();ql0();Ml0()});var hu1;var uu1=D(()=>{hu1={CRC32:"CRC32",CRC32C:"CRC32C",CRC64NVME:"CRC64NVME",MD5:"MD5",SHA1:"SHA1",SHA256:"SHA256",SHA512:"SHA512",XXHASH128:"XXHASH128",XXHASH3:"XXHASH3",XXHASH64:"XXHASH64"}});var lu1=()=>{};var cu1=()=>{};var NZ0=D(()=>{eE();bu1();xu1();G1();yu1();gu1();uu1();eb0();lu1();cu1()});function mu1($){let{port:Z,query:Q}=$,{protocol:X,path:Y,hostname:J}=$;if(X&&X.slice(-1)!==":")X+=":";if(Z)J+=`:${Z}`;if(Y&&Y.charAt(0)!=="/")Y=`/${Y}`;let G=Q?du1.buildQueryString(Q):"";if(G&&G[0]!=="?")G=`?${G}`;let W="";if($.username!=null||$.password!=null){let H=$.username??"",F=$.password??"";W=`${H}:${F}@`}let K="";if($.fragment)K=`#${$.fragment}`;return`${X}//${W}${J}${Y}${G}${K}`}var du1;var iu1=D(()=>{du1=C(n40(),1)});var pu1="UNSIGNED-PAYLOAD",nu1="X-Amz-Content-Sha256";class BZ0{signer;constructor($){let Z={service:$.signingName||$.service||"s3",uriEscapePath:$.uriEscapePath||!1,applyChecksum:$.applyChecksum||!1,...$};this.signer=new tu1.SignatureV4MultiRegion(Z)}presign($,{unsignableHeaders:Z=new Set,hoistableHeaders:Q=new Set,unhoistableHeaders:X=new Set,...Y}={}){return this.prepareRequest($,{unsignableHeaders:Z,unhoistableHeaders:X,hoistableHeaders:Q}),this.signer.presign($,{expiresIn:900,unsignableHeaders:Z,unhoistableHeaders:X,...Y})}presignWithCredentials($,Z,{unsignableHeaders:Q=new Set,hoistableHeaders:X=new Set,unhoistableHeaders:Y=new Set,...J}={}){return this.prepareRequest($,{unsignableHeaders:Q,unhoistableHeaders:Y,hoistableHeaders:X}),this.signer.presignWithCredentials($,Z,{expiresIn:900,unsignableHeaders:Q,unhoistableHeaders:Y,...J})}prepareRequest($,{unsignableHeaders:Z=new Set,unhoistableHeaders:Q=new Set,hoistableHeaders:X=new Set}={}){Z.add("content-type"),Object.keys($.headers).map((W)=>W.toLowerCase()).filter((W)=>W.startsWith("x-amz-server-side-encryption")).forEach((W)=>{if(!X.has(W))Q.add(W)}),$.headers[nu1]=pu1;let Y=$.headers.host,J=$.port,G=`${$.hostname}${$.port!=null?":"+J:""}`;if(!Y||Y===$.hostname&&$.port!=null)$.headers.host=G}}var tu1;var Il0=D(()=>{tu1=C(iy(),1)});var ou1,ru1,OZ0=async($,Z,Q={})=>{let X,Y;if(typeof $.config.endpointProvider==="function"){let N=(await ou1.getEndpointFromInstructions(Z.input,Z.constructor,$.config)).properties?.authSchemes?.[0];if(N?.name==="sigv4a")Y=N?.signingRegionSet?.join(",");else Y=N?.signingRegion;X=new BZ0({...$.config,signingName:N?.signingName,region:async()=>Y})}else X=new BZ0($.config);let J=(U,N)=>async(B)=>{let{request:O}=B;if(!ru1.HttpRequest.isInstance(O))throw Error("Request to be presigned is not an valid HTTP request.");delete O.headers["amz-sdk-invocation-id"],delete O.headers["amz-sdk-request"],delete O.headers["x-amz-user-agent"];let L,w={...Q,signingRegion:Q.signingRegion??N.signing_region??Y,signingService:Q.signingService??N.signing_service};if(N.s3ExpressIdentity)L=await X.presignWithCredentials(O,N.s3ExpressIdentity,w);else L=await X.presign(O,w);return{response:{},output:{$metadata:{httpStatusCode:200},presigned:L}}},G="presignInterceptMiddleware",W=$.middlewareStack.clone();W.addRelativeTo(J,{name:G,relation:"before",toMiddleware:"awsAuthMiddleware",override:!0});let K=Z.resolveMiddleware(W,$.config,{}),{output:H}=await K({input:Z.input}),{presigned:F}=H;return mu1(F)};var au1=D(()=>{iu1();Il0();ou1=C(Y1(),1),ru1=C(V5(),1)});var su1=D(()=>{au1();Il0()});import{extname as cy8}from"path";function U3($){let Z;try{Z=decodeURIComponent($)}catch{Z=$}let X=Z.replace(/\0/g,"").replace(/[\x00-\x1f\x7f]/g,"").replace(/\\/g,"/").split("/"),Y=[];for(let J of X)if(J==="..")Y.pop();else if(J!=="."&&J!=="")Y.push(J);return Y.join("/")}function GD($,Z){let Q=U3(Z);if(!Q)throw Error("Key is empty after sanitization");return`${$}/${Q}`}function eu1($,Z){if(!Z)return`${$}/`;let Q=U3(Z);return`${$}/${Q}${Q.endsWith("/")?"":"/"}`}function Dg($,Z,Q){let X=Q.split("/").map(encodeURIComponent).join("/");return`${$}/api/${encodeURIComponent(Z)}/files/${X}`}function Vl0($,Z){let Q=`${$}/`;if(Z.startsWith(Q))return Z.slice(Q.length);return Z}function V7($){let Z=cy8($).toLowerCase();return dy8[Z]??"application/octet-stream"}function DZ0($){let Z=$.split(";")[0].trim();if(my8.has(Z))return!0;if(Z.startsWith("text/"))return!0;return!1}var dy8,my8;var iW=D(()=>{dy8={".json":"application/json",".html":"text/html",".htm":"text/html",".css":"text/css",".js":"application/javascript",".mjs":"application/javascript",".ts":"text/typescript",".txt":"text/plain",".md":"text/markdown",".csv":"text/csv",".xml":"application/xml",".svg":"image/svg+xml",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".pdf":"application/pdf",".zip":"application/zip",".gz":"application/gzip",".tar":"application/x-tar",".wasm":"application/wasm",".yaml":"application/yaml",".yml":"application/yaml",".toml":"application/toml"};my8=new Set(["application/json","text/html","text/css","application/javascript","text/typescript","text/plain","text/markdown","text/csv","application/xml","image/svg+xml","application/yaml","application/toml"])});class kl0{client;bucket;constructor($){this.bucket=$.bucket,this.client=new hX({endpoint:$.endpoint,region:$.region,credentials:{accessKeyId:$.accessKeyId,secretAccessKey:$.secretAccessKey},forcePathStyle:$.forcePathStyle})}async getBytesOrPresign($,Z,Q){let X=GD($,Z),Y=await this.client.send(new MH({Bucket:this.bucket,Key:X})),J=Y.ContentLength??0,G=Y.ContentType??V7(Z);if(J>Q.presignWhenLargerThan){let F=await OZ0(this.client,new XD({Bucket:this.bucket,Key:X}),{expiresIn:Q.presignExpiresIn??3600});return{error:"FILE_TOO_LARGE",size:J,maxInlineSize:Q.presignWhenLargerThan,presignedUrl:F,contentType:G}}let K=await(await this.client.send(new XD({Bucket:this.bucket,Key:X}))).Body.transformToByteArray(),H=DZ0(G);return{content:H?new TextDecoder().decode(K):Buffer.from(K).toString("base64"),contentType:G,encoding:H?"utf-8":"base64",size:J,lastModified:Y.LastModified,etag:Y.ETag}}async getBytes($,Z){let Q=GD($,Z);return(await this.client.send(new XD({Bucket:this.bucket,Key:Q}))).Body.transformToByteArray()}async put($,Z,Q,X){let Y=GD($,Z),J=X?.contentType??V7(Z);return{etag:(await this.client.send(new ON({Bucket:this.bucket,Key:Y,Body:typeof Q==="string"?Buffer.from(Q,"utf-8"):Q,ContentType:J}))).ETag,key:Z}}async list($,Z){let Q=eu1($,Z?.prefix),X=await this.client.send(new IH({Bucket:this.bucket,Prefix:Q,MaxKeys:Z?.maxKeys??1000,ContinuationToken:Z?.continuationToken,Delimiter:Z?.delimiter})),Y=X.CommonPrefixes?.map((J)=>Vl0($,J.Prefix??"")).filter(Boolean);return{objects:(X.Contents??[]).map((J)=>({key:Vl0($,J.Key??""),size:J.Size??0,lastModified:J.LastModified,etag:J.ETag})),isTruncated:X.IsTruncated??!1,nextContinuationToken:X.NextContinuationToken,commonPrefixes:Y&&Y.length>0?Y:void 0}}async delete($,Z){let Q=GD($,Z);await this.client.send(new $z({Bucket:this.bucket,Key:Q}))}async head($,Z){let Q=GD($,Z),X=await this.client.send(new MH({Bucket:this.bucket,Key:Q}));return{contentType:X.ContentType??V7(Z),size:X.ContentLength??0,lastModified:X.LastModified,etag:X.ETag}}async presignedGetUrl($,Z,Q=3600,X){let Y=GD($,Z);return OZ0(this.client,new XD({Bucket:this.bucket,Key:Y}),{expiresIn:Q})}async presignedPutUrl($,Z,Q=3600,X){let Y=GD($,Z);return OZ0(this.client,new ON({Bucket:this.bucket,Key:Y,ContentType:X}),{expiresIn:Q})}}var $l1=D(()=>{NZ0();su1();iW()});function iy8(){let $=E0();return!!($.s3Endpoint&&$.s3Bucket&&$.s3AccessKeyId&&$.s3SecretAccessKey)}function uX(){if(op!==void 0)return op;if(!iy8())return op=null,null;let $=E0();return op=new kl0({endpoint:$.s3Endpoint,bucket:$.s3Bucket,region:$.s3Region,accessKeyId:$.s3AccessKeyId,secretAccessKey:$.s3SecretAccessKey,forcePathStyle:$.s3ForcePathStyle}),op}var op;var WD=D(()=>{U$();$l1()});function rJ($,Z){return{getBytesOrPresign:(Q,X)=>$.getBytesOrPresign(Z,Q,X),getBytes:(Q)=>$.getBytes(Z,Q),put:(Q,X,Y)=>$.put(Z,Q,X,Y),list:(Q)=>$.list(Z,Q),delete:(Q)=>$.delete(Z,Q),head:(Q)=>$.head(Z,Q),presignedGetUrl:(Q,X,Y)=>$.presignedGetUrl(Z,Q,X,Y),presignedPutUrl:(Q,X,Y)=>$.presignedPutUrl(Z,Q,X,Y)}}import{mkdir as py8,readdir as ny8,readFile as Sl0,stat as LZ0,unlink as ty8,writeFile as oy8}from"fs/promises";import{createHmac as ry8}from"crypto";import{dirname as ay8,join as rp}from"path";function Cl0($){let Z=$.replace(/[^a-zA-Z0-9_-]/g,"_");return rp(sy8,Z)}function Lg($,Z){return rp(Cl0($),U3(Z))}class N3{orgId;baseUrl;constructor($,Z){this.orgId=$;this.baseUrl=Z}async getBytesOrPresign($,Z){let Q=Lg(this.orgId,$),X=await LZ0(Q),Y=V7($);if(X.size>Z.presignWhenLargerThan)return{error:"FILE_TOO_LARGE",size:X.size,maxInlineSize:Z.presignWhenLargerThan,presignedUrl:await this.presignedGetUrl($),contentType:Y};let J=await Sl0(Q),G=DZ0(Y);return{content:G?new TextDecoder().decode(J):Buffer.from(J).toString("base64"),contentType:Y,encoding:G?"utf-8":"base64",size:X.size,lastModified:X.mtime}}async getBytes($){let Z=await Sl0(Lg(this.orgId,$));return new Uint8Array(Z)}async put($,Z,Q){let X=Lg(this.orgId,$);return await py8(ay8(X),{recursive:!0}),await oy8(X,typeof Z==="string"?Buffer.from(Z,"utf-8"):Z),{key:$}}async list($){let Z=$?.prefix?rp(Cl0(this.orgId),U3($.prefix)):Cl0(this.orgId),Q;try{Q=await ny8(Z,{withFileTypes:!0})}catch{return{objects:[],isTruncated:!1}}let X=$?.maxKeys??1000,Y=$?.prefix,J=Q.filter((W)=>W.isFile());if($?.delimiter){let W=[],K=Q.filter((O)=>O.isDirectory());for(let O of K){let L=Y?`${Y}/${O.name}/`:`${O.name}/`;W.push(L)}W.sort();let H=X,F=W.slice(0,H);H-=F.length;let U=J.slice(0,H),N=W.length+J.length;return{objects:await Promise.all(U.map(async(O)=>{let L=await LZ0(rp(Z,O.name));return{key:Y?`${Y}/${O.name}`:O.name,size:L.size,lastModified:L.mtime}})),isTruncated:N>X,commonPrefixes:F.length>0?F:void 0}}return{objects:await Promise.all(J.slice(0,X).map(async(W)=>{let K=await LZ0(rp(Z,W.name));return{key:Y?`${Y}/${W.name}`:W.name,size:K.size,lastModified:K.mtime}})),isTruncated:J.length>X}}async delete($){await ty8(Lg(this.orgId,$))}async head($){let Z=await LZ0(Lg(this.orgId,$));return{contentType:V7($),size:Z.size,lastModified:Z.mtime}}async presignedGetUrl($,Z,Q){if(Q?.requireFetchable)throw Error("object storage returned a not fetchable (data:) URL; configure real S3/R2/MinIO for large-payload offload");let X=Lg(this.orgId,$),Y=await Sl0(X),J=V7($),G=Buffer.from(Y).toString("base64");return`data:${J};base64,${G}`}async presignedPutUrl($,Z=3600){if(!this.baseUrl)throw Error("baseUrl required for presigned PUT URLs in dev mode");let Q=U3($),X=Math.floor(Date.now()/1000)+Z,Y=E0().encryptionKey||"dev-secret",J=`${this.orgId}:${Q}:${X}:PUT`,G=ry8("sha256",Y).update(J).digest("hex"),W=new URL(`/api/dev-assets/${this.orgId}/${Q}`,this.baseUrl);return W.searchParams.set("expires",X.toString()),W.searchParams.set("signature",G),W.searchParams.set("method","PUT"),W.toString()}}var sy8="./data/assets";var wg=D(()=>{iW();U$()});function VH($){return ey8.test($)&&$!=="."&&$!==".."}function $7($){if(!VH($))throw Error(`Invalid org-fs volume name: ${JSON.stringify($)}`)}function k7($){return U3($)}function jg($){let Z=$.lastIndexOf("/");return Z===-1?"":$.slice(0,Z)}function KD($){let Z=jg($);if(Z==="")return[];let Q=Z.split("/"),X=[],Y="";for(let J of Q)Y=Y===""?J:`${Y}/${J}`,X.push(Y);return X}function kH($,Z){return`${Zl1}/${$}/${Z}`}function wZ0($){return`${Zl1}/${$}/`}var ey8,Zl1="_fs";var Qz=D(()=>{iW();ey8=/^[A-Za-z0-9_.-]{1,128}$/});import{createHmac as _l0,randomBytes as vl0,scrypt as $g8,timingSafeEqual as Ql1}from"crypto";import{promisify as Zg8}from"util";async function Yl1($){let Z=vl0(16),Q=await Xl1($,Z,Qg8);return`scrypt$${Z.toString("hex")}$${Q.toString("hex")}`}async function Jl1($,Z){let Q=Z.split("$");if(Q.length!==3||Q[0]!=="scrypt")return!1;let X=Buffer.from(Q[1],"hex"),Y=Buffer.from(Q[2],"hex");if(X.length===0||Y.length===0)return!1;let J;try{J=await Xl1($,X,Y.length)}catch{return!1}return Y.length===J.length&&Ql1(Y,J)}function Gl1(){return vl0(16).toString("hex")}function Wl1(){if(jZ0)return jZ0;let $;try{let Z=E0();$=Z.studioJwtSecret??Z.betterAuthSecret}catch{$=void 0}return jZ0=$?Buffer.from($):vl0(32),jZ0}function Kl1($){let Z=Buffer.from(JSON.stringify($)).toString("base64url"),Q=_l0("sha256",Wl1()).update(Z).digest("base64url");return`${Z}.${Q}`}function Hl1($,Z){let Q=$.indexOf(".");if(Q<0)return null;let X=$.slice(0,Q),Y=Buffer.from($.slice(Q+1)),J=Buffer.from(_l0("sha256",Wl1()).update(X).digest("base64url"));if(Y.length!==J.length||!Ql1(Y,J))return null;let G;try{G=JSON.parse(Buffer.from(X,"base64url").toString())}catch{return null}if(G.o!==Z.org||G.v!==Z.volume||G.s!==Z.secret||typeof G.e!=="number"||G.e<Z.nowSec)return null;return{govPath:G.p}}function bl0($,Z,Q){return`fsu_${_l0("sha256","fsunlock-name").update(`${$}:${Z}:${Q}`).digest("hex").slice(0,16)}`}var Qg8=64,Xl1,jZ0=null;var xl0=D(()=>{U$();Xl1=Zg8($g8)});import{createHash as Xg8}from"crypto";function Kg8($){if(typeof $!=="object"||$===null)return!1;let Z=$;return Z.name==="NoSuchKey"||Z.Code==="NoSuchKey"||Z.code==="ENOENT"||Z.$metadata?.httpStatusCode===404}function Fl1($){return Xg8("sha256").update($).digest("hex")}class B3{storage;manifest;organizationId;maxFileBytes;volumeQuotaBytes;constructor($,Z,Q,X={}){this.storage=$;this.manifest=Z;this.organizationId=Q;this.maxFileBytes=X.maxFileBytes??Gg8,this.volumeQuotaBytes=X.volumeQuotaBytes??Wg8}async usage($){return $7($),this.manifest.usage(this.organizationId,$)}async stat($,Z){return $7($),this.manifest.get(this.organizationId,$,k7(Z))}async listVolumeFiles($){return $7($),this.manifest.listVolumeFiles(this.organizationId,$)}async listDir($,Z){return $7($),this.manifest.listDir(this.organizationId,$,k7(Z))}async read($,Z){let Q=await this.requireFile($,Z);try{return await this.storage.getBytes(kH($,Q.path))}catch(X){if(Kg8(X))throw new lX(`No such file: ${Q.path}`);throw X}}async setShareMode($,Z,Q,X){$7($);let Y=k7(Z),J=await this.manifest.get(this.organizationId,$,Y);if(!J)throw new lX(`No such path: ${Y}`);let G=null,W=null;if(Q==="password"){if(!X.password)throw new aJ("A password is required to set password mode");G=await Yl1(X.password),W=Gl1()}let K=await this.manifest.setShareMode({organizationId:this.organizationId,volume:$,path:J.path,readPublic:Q!=="private",passwordHash:G,shareSecret:W,actor:X.actor});if(!K)throw new lX(`No such path: ${J.path}`);return K}async setReadPublic($,Z,Q,X){return this.setShareMode($,Z,Q?"public":"private",{actor:X.actor})}async resolveReadAccess($,Z){$7($);let Q=k7(Z),X=await this.manifest.get(this.organizationId,$,Q);if(!X||X.kind!=="file")return{access:"private"};let Y=await this.manifest.resolveGoverningShare({organizationId:this.organizationId,volume:$,candidatePaths:[Q,...KD(Q)]});if(!Y)return{access:"private"};if(!Y.passwordHash)return{access:"public"};return{access:"password",govPath:Y.path,secret:Y.secret??"",passwordHash:Y.passwordHash}}async isPubliclyReadable($,Z){$7($);let Q=k7(Z),X=await this.manifest.get(this.organizationId,$,Q);if(!X||X.kind!=="file")return!1;if(X.readPublic)return!0;return this.manifest.hasPublicAncestorDir(this.organizationId,$,KD(Q))}async inheritsPublic($,Z){return $7($),this.manifest.hasPublicAncestorDir(this.organizationId,$,KD(k7(Z)))}async childrenInheritPublic($,Z){$7($);let Q=k7(Z);if(Q==="")return!1;return this.manifest.hasPublicAncestorDir(this.organizationId,$,[...KD(Q),Q])}async recentWithEffectivePublic($){return this.withEffectivePublic(await this.recent($))}async searchWithEffectivePublic($,Z,Q,X){return this.withEffectivePublic(await this.manifest.searchFiles({organizationId:this.organizationId,query:$,limit:Z,volumes:Q,pathPrefix:X?k7(X):void 0}))}async withEffectivePublic($){let Z=new Map;for(let X of $){let Y=Z.get(X.volume);if(!Y)Y=new Set,Z.set(X.volume,Y);for(let J of KD(X.path))Y.add(J)}let Q=new Map;return await Promise.all([...Z].map(async([X,Y])=>{let J=await this.manifest.publicDirPaths({organizationId:this.organizationId,volume:X,paths:[...Y]});Q.set(X,new Set(J))})),$.map((X)=>{let Y=Q.get(X.volume),J=!!Y&&KD(X.path).some((G)=>Y.has(G));return{...X,effectivePublic:X.readPublic||J}})}async presignRead($,Z,Q){let X=await this.requireFile($,Z);return this.storage.presignedGetUrl(kH($,X.path),Q)}async write($,Z,Q,X){$7($);let Y=k7(Z);if(Y==="")throw new aJ("Cannot write to the volume root");let J=typeof Q==="string"?new TextEncoder().encode(Q):Q;if(J.byteLength>this.maxFileBytes)throw new Xz(`File exceeds the ${this.maxFileBytes}-byte per-file limit`);let[G,W]=await Promise.all([X.skipVolumeQuota?Promise.resolve(null):this.manifest.usage(this.organizationId,$),this.manifest.get(this.organizationId,$,Y)]);if(W?.kind==="dir")throw new aJ(`Cannot write a file at ${Y}: a directory exists there`);if(G){let K=W?.kind==="file"?W.size:0;if(G.bytes-K+J.byteLength>this.volumeQuotaBytes)throw new Xz(`Write would exceed the volume quota of ${this.volumeQuotaBytes} bytes`)}await this.ensureDirs($,Y,X.actor),await this.storage.put(kH($,Y),J,{contentType:X.contentType??V7(Y)});try{return await c8(()=>this.manifest.putFile({organizationId:this.organizationId,volume:$,path:Y,parent:jg(Y),contentHash:Fl1(J),size:J.byteLength,actor:X.actor,threadId:X.threadId??null}))}catch(K){throw console.error("org-fs manifest write lost after object put",{organizationId:this.organizationId,volume:$,path:Y,size:J.byteLength,error:K instanceof Error?K.message:String(K)}),K}}async mkdir($,Z,Q){$7($);let X=k7(Z);if(X==="")return;if((await this.manifest.get(this.organizationId,$,X))?.kind==="file")throw new aJ(`Cannot create a directory at ${X}: a file exists there`);await this.ensureDirs($,X,Q.actor),await this.manifest.putDir({organizationId:this.organizationId,volume:$,path:X,parent:jg(X),actor:Q.actor})}async delete($,Z,Q){$7($);let X=k7(Z);if(X==="")throw new aJ("Cannot delete the volume root");let Y=await this.manifest.get(this.organizationId,$,X);if(!Y)return;if(Y.kind==="dir"){let J=await this.manifest.listSubtreeFiles(this.organizationId,$,X);await Promise.all(J.map((G)=>this.storage.delete(kH($,G.path)))),await this.manifest.tombstoneSubtree(this.organizationId,$,X,Q.actor);return}await this.storage.delete(kH($,X)),await this.manifest.tombstone(this.organizationId,$,X,Q.actor)}async move($,Z,Q,X){$7($);let Y=k7(Z),J=k7(Q);if(Y===""||J==="")throw new aJ("Cannot move the volume root");if(J===Y||J.startsWith(`${Y}/`))throw new aJ(`Cannot move ${Y} onto itself or into its own subtree`);let G=await this.manifest.get(this.organizationId,$,Y);if(!G)throw new lX(`No such path: ${Y}`);if(G.kind==="file"){let H=await this.storage.getBytes(kH($,Y));await this.write($,J,H,{...X,skipVolumeQuota:!0}),await this.delete($,Y,X);return}let[W,K]=await Promise.all([this.manifest.listSubtreeFiles(this.organizationId,$,Y),this.manifest.listSubtreeDirs(this.organizationId,$,Y)]);await this.mkdir($,J,X);for(let H of W){let F=H.path.slice(Y.length+1),U=await this.storage.getBytes(kH($,H.path));await this.write($,`${J}/${F}`,U,{...X,skipVolumeQuota:!0})}for(let H of K){let F=H.path.slice(Y.length+1);await this.mkdir($,`${J}/${F}`,X)}await this.delete($,Y,X)}async filesExist($,Z){$7($);let Q=await this.manifest.liveFilePaths({organizationId:this.organizationId,volume:$,paths:Z.map((X)=>k7(X))});return new Set(Q)}async recent($){return this.manifest.recentFiles({organizationId:this.organizationId,limit:$})}async changes($,Z,Q=Yg8){$7($);let X=Z||"0";if(!/^\d+$/.test(X))throw new aJ(`Invalid cursor: ${Z}`);let Y=await this.manifest.changesSince({organizationId:this.organizationId,volume:$,sinceSeq:X,limit:Q}),J=Y.at(-1);return{entries:Y,cursor:J?J.seq:Z||"0",hasMore:Y.length>=Q}}async latestSeq($){return $7($),this.manifest.latestSeq({organizationId:this.organizationId,volume:$})}async backfillFromStorage($,Z){$7($);let Q=wZ0($),X,Y=0;do{let J=await this.storage.list({prefix:Q,maxKeys:Jg8,continuationToken:X});for(let G of J.objects){let W=G.key.slice(Q.length);if(W==="")continue;await this.ensureDirs($,W,Z.actor);let K=await this.storage.getBytes(G.key);await this.manifest.putFile({organizationId:this.organizationId,volume:$,path:W,parent:jg(W),contentHash:Fl1(K),size:K.byteLength,actor:Z.actor}),Y++}X=J.isTruncated?J.nextContinuationToken:void 0}while(X);return Y}async requireFile($,Z){$7($);let Q=k7(Z),X=await this.manifest.get(this.organizationId,$,Q);if(!X||X.kind!=="file")throw new lX(`No such file: ${Q}`);return X}async ensureDirs($,Z,Q){for(let X of KD(Z))await this.manifest.putDir({organizationId:this.organizationId,volume:$,path:X,parent:jg(X),actor:Q})}}var Yg8=500,Jg8=1000,Gg8=524288000,Wg8=10737418240,Xz,aJ,lX;var DN=D(()=>{D8();iW();Qz();xl0();Xz=class Xz extends Error{constructor($){super($);this.name="OrgFsQuotaError"}};aJ=class aJ extends Error{constructor($){super($);this.name="OrgFsValidationError"}};lX=class lX extends Error{constructor($){super($);this.name="OrgFsNotFoundError"}}});import{z as LN}from"zod";function SH($){return $.startsWith(Ul1)}function HD($){return`${Ul1}${$}`}function Bg8($){let Z=new Map(Ug8.map((Q)=>[Q.set,Q]));if($)try{for(let Q of Ng8.parse(JSON.parse($)))Z.set(Q.set,Q)}catch(Q){console.warn("[org-fs] invalid ORGFS_PUBLIC_SETS \u2014 using built-in defaults only",Q)}return[...Z.values()]}function O3(){return Bg8(E0().orgFsPublicSetsJson)}function sp($){let Z=uX(),Q=Z?rJ(Z,ap):new N3(ap,$.baseUrl);return new B3(Q,$.storage.orgFsEntries,ap)}var ap="org_orgfs_public_skills",Ul1="public-",Hg8,Fg8,Ug8,Ng8;var Yz=D(()=>{U$();WD();wg();DN();Hg8=LN.object({from:LN.string(),to:LN.string().optional()}),Fg8=LN.object({set:LN.string().regex(/^[a-z0-9][a-z0-9-]{0,40}$/),repo:LN.string().regex(/^[\w.-]+\/[\w.-]+$/),ref:LN.string().min(1),paths:LN.array(Hg8).min(1)}),Ug8=[{set:"core",repo:"decocms/studio",ref:"main",paths:[{from:"packages/sandbox/image/skills"}]},{set:"storefront",repo:"decocms/storefront-skills",ref:"main",paths:[{from:".claude-seo/skills"},{from:".claude-performance/skills"},{from:".claude-deco/skills"}]}],Ng8=LN.array(Fg8).refine(($)=>new Set($.map((Z)=>Z.set)).size===$.length,{message:"duplicate set names"})});function wN($){if(typeof $==="string")return $.length>0?[$]:[];if(Array.isArray($))return $.flatMap(wN);if($!==null&&typeof $==="object")return Object.values($).flatMap(wN);return[]}var y0;var U5=D(()=>{y0=class y0 extends Error{provider;status;retryAfterMs;constructor($){super($.message,{cause:$.cause});this.name="GitProviderError",this.provider=$.provider,this.status=$.status,this.retryAfterMs=$.retryAfterMs??null}get isRateLimited(){return this.status===429||this.retryAfterMs!==null}get isAuthFailure(){return this.status===401||this.status===403}}});import{sql as Jz}from"kysely";function fl0($){if($===null)return null;return $ instanceof Date?$.toISOString():String($)}function pW($){return{organizationId:$.organization_id,volume:$.volume,path:$.path,parent:$.parent,kind:$.kind,contentHash:$.content_hash,size:Number($.size),seq:String($.seq),deletedAt:fl0($.deleted_at),createdBy:$.created_by,createdAt:fl0($.created_at)??"",updatedBy:$.updated_by,updatedAt:fl0($.updated_at)??"",threadId:$.thread_id,readPublic:$.read_public,shareMode:!$.read_public?"private":$.share_password_hash?"password":"public"}}class $n{db;constructor($){this.db=$}async putFile($){let Z=new Date,Q=$.threadId??null,X=await this.db.insertInto("org_fs_entry").values({organization_id:$.organizationId,volume:$.volume,path:$.path,parent:$.parent,kind:"file",content_hash:$.contentHash,size:$.size,deleted_at:null,created_by:$.actor,created_at:Z,updated_by:$.actor,updated_at:Z,thread_id:Q}).onConflict((Y)=>Y.columns(["organization_id","volume","path"]).doUpdateSet({kind:"file",content_hash:$.contentHash,size:$.size,deleted_at:null,updated_by:$.actor,updated_at:Z,seq:EZ0,read_public:Jz`case when org_fs_entry.deleted_at is not null then false else org_fs_entry.read_public end`,thread_id:Jz`coalesce(cast(${Q} as text), org_fs_entry.thread_id)`})).returning(nW).executeTakeFirstOrThrow();return pW(X)}async putDir($){let Z=new Date;await this.db.insertInto("org_fs_entry").values({organization_id:$.organizationId,volume:$.volume,path:$.path,parent:$.parent,kind:"dir",content_hash:null,size:0,deleted_at:null,created_by:$.actor,created_at:Z,updated_by:$.actor,updated_at:Z}).onConflict((Q)=>Q.columns(["organization_id","volume","path"]).where("org_fs_entry.deleted_at","is not",null).doUpdateSet({kind:"dir",content_hash:null,size:0,deleted_at:null,updated_by:$.actor,updated_at:Z,seq:EZ0,read_public:Jz`case when org_fs_entry.deleted_at is not null then false else org_fs_entry.read_public end`})).execute()}async get($,Z,Q){let X=await this.db.selectFrom("org_fs_entry").where("organization_id","=",$).where("volume","=",Z).where("path","=",Q).where("deleted_at","is",null).select(nW).executeTakeFirst();return X?pW(X):null}async listDir($,Z,Q){return(await this.db.selectFrom("org_fs_entry").where("organization_id","=",$).where("volume","=",Z).where("parent","=",Q).where("deleted_at","is",null).select(nW).orderBy("path","asc").execute()).map((Y)=>pW(Y))}async listVolumeDirs($,Z){return(await this.db.selectFrom("org_fs_entry").where("organization_id","=",$).where("volume","=",Z).where("kind","=","dir").where("deleted_at","is",null).select(nW).execute()).map((X)=>pW(X))}async listVolumeFiles($,Z){return(await this.db.selectFrom("org_fs_entry").where("organization_id","=",$).where("volume","=",Z).where("kind","=","file").where("deleted_at","is",null).select(nW).execute()).map((X)=>pW(X))}async listSubtreeFiles($,Z,Q){return(await this.db.selectFrom("org_fs_entry").where("organization_id","=",$).where("volume","=",Z).where("kind","=","file").where("deleted_at","is",null).where("path","like",`${ep(Q)}/%`).select(nW).execute()).map((Y)=>pW(Y))}async listSubtreeDirs($,Z,Q){return(await this.db.selectFrom("org_fs_entry").where("organization_id","=",$).where("volume","=",Z).where("kind","=","dir").where("deleted_at","is",null).where("path","like",`${ep(Q)}/%`).select(nW).execute()).map((Y)=>pW(Y))}async tombstone($,Z,Q,X){await this.db.updateTable("org_fs_entry").set({deleted_at:new Date,updated_by:X,updated_at:new Date,seq:EZ0}).where("organization_id","=",$).where("volume","=",Z).where("path","=",Q).where("deleted_at","is",null).execute()}async tombstoneSubtree($,Z,Q,X){await this.db.updateTable("org_fs_entry").set({deleted_at:new Date,updated_by:X,updated_at:new Date,seq:EZ0}).where("organization_id","=",$).where("volume","=",Z).where("deleted_at","is",null).where((Y)=>Y.or([Y("path","=",Q),Y("path","like",`${ep(Q)}/%`)])).execute()}async setShareMode($){let Z=new Date,Q=await this.db.updateTable("org_fs_entry").set({read_public:$.readPublic,share_password_hash:$.passwordHash,share_secret:$.shareSecret,updated_by:$.actor,updated_at:Z}).where("organization_id","=",$.organizationId).where("volume","=",$.volume).where("path","=",$.path).where("deleted_at","is",null).returning(nW).executeTakeFirst();return Q?pW(Q):null}async resolveGoverningShare($){if($.candidatePaths.length===0)return null;let Z=await this.db.selectFrom("org_fs_entry").where("organization_id","=",$.organizationId).where("volume","=",$.volume).where("read_public","=",!0).where("deleted_at","is",null).where("path","in",$.candidatePaths).select(["path","share_password_hash","share_secret"]).execute();if(Z.length===0)return null;Z.sort((X,Y)=>Y.path.length-X.path.length);let Q=Z[0];return{path:Q.path,passwordHash:Q.share_password_hash,secret:Q.share_secret}}async hasPublicAncestorDir($,Z,Q){if(Q.length===0)return!1;return!!await this.db.selectFrom("org_fs_entry").where("organization_id","=",$).where("volume","=",Z).where("kind","=","dir").where("read_public","=",!0).where("deleted_at","is",null).where("path","in",Q).select("path").limit(1).executeTakeFirst()}async publicDirPaths($){if($.paths.length===0)return[];return(await this.db.selectFrom("org_fs_entry").where("organization_id","=",$.organizationId).where("volume","=",$.volume).where("kind","=","dir").where("read_public","=",!0).where("deleted_at","is",null).where("path","in",$.paths).select("path").execute()).map((Q)=>Q.path)}async usage($,Z){let Q=await this.db.selectFrom("org_fs_entry").where("organization_id","=",$).where("volume","=",Z).where("kind","=","file").where("deleted_at","is",null).select((X)=>[X.fn.countAll().as("files"),X.fn.coalesce(X.fn.sum("size"),Jz`0`).as("bytes")]).executeTakeFirst();return{files:Number(Q?.files??0),bytes:Number(Q?.bytes??0)}}async liveFilePaths($){if($.paths.length===0)return[];return(await this.db.selectFrom("org_fs_entry").where("organization_id","=",$.organizationId).where("volume","=",$.volume).where("kind","=","file").where("deleted_at","is",null).where("path","in",$.paths).select(["path"]).execute()).map((Q)=>Q.path)}async recentFiles($){return(await this.db.selectFrom("org_fs_entry").where("organization_id","=",$.organizationId).where("kind","=","file").where("deleted_at","is",null).select(nW).orderBy("seq","desc").limit($.limit).execute()).map((Q)=>pW(Q))}async searchFiles($){if($.volumes&&$.volumes.length===0)return[];let Z=ep($.query),Q=this.db.selectFrom("org_fs_entry").where("organization_id","=",$.organizationId).where("kind","=","file").where("deleted_at","is",null).where("path","ilike",`%${Z}%`);if($.volumes)Q=Q.where("volume","in",$.volumes);if($.pathPrefix)Q=Q.where("path","like",`${ep($.pathPrefix)}/%`);return(await Q.select(nW).orderBy("seq","desc").limit($.limit).execute()).map((Y)=>pW(Y))}async changesSince($){return(await this.db.selectFrom("org_fs_entry").where("organization_id","=",$.organizationId).where("volume","=",$.volume).where("seq",">",Jz`cast(${$.sinceSeq} as bigint)`).select(nW).orderBy("seq","asc").limit($.limit).execute()).map((Q)=>pW(Q))}async latestSeq($){return(await this.db.selectFrom("org_fs_entry").where("organization_id","=",$.organizationId).where("volume","=",$.volume).select(Jz`max(seq)`.as("seq")).executeTakeFirst())?.seq??"0"}}function ep($){return $.replace(/[\\%_]/g,"\\$&")}var nW,EZ0;var yl0=D(()=>{nW=["organization_id","volume","path","parent","kind","content_hash","size","seq","deleted_at","created_by","created_at","updated_by","updated_at","thread_id","read_public","share_password_hash"],EZ0=Jz`nextval('org_fs_entry_seq')`});import{createHash as Og8}from"crypto";import{gunzipSync as Dg8}from"zlib";function hl0($,Z,Q){let X=Z,Y=Z+Q;while(X<Y&&$[X]!==0)X++;return new TextDecoder().decode($.subarray(Z,X))}function wg8($,Z,Q){let X=hl0($,Z,Q).trim();return X===""?0:Number.parseInt(X,8)}function jg8($){let Z=new Map,Q=0,X=null,Y=null;while(Q+512<=$.length){let J=$.subarray(Q,Q+512);if(Q+=512,J.every((N)=>N===0))break;let G=hl0(J,0,100),W=hl0(J,345,155);if(W)G=`${W}/${G}`;let K=wg8(J,124,12),H=String.fromCharCode(J[156]??0),F=$.subarray(Q,Q+K);if(Q+=Math.ceil(K/512)*512,H==="L"){let N=new TextDecoder().decode(F),B=N.indexOf("\x00");X=B===-1?N:N.slice(0,B);continue}if(H==="x"){let N=new TextDecoder().decode(F);Y=/(?:^|\n)\d+ path=([^\n]*)\n/.exec(N)?.[1]??null;continue}if(H==="g")continue;let U=Y??X??G;if(X=null,Y=null,H==="0"||H==="\x00"||H==="")Z.set(U,new Uint8Array(F))}return Z}function Eg8($,Z,Q){let X=encodeURIComponent(Z);if(!Q)return{url:`https://codeload.github.com/${$}/tar.gz/${X}`,headers:{}};return{url:`https://api.github.com/repos/${$}/tarball/${X}`,headers:{Authorization:`Bearer ${Q}`,Accept:"application/vnd.github+json"}}}function Nl1($,Z){if($.length>Eg)throw Error(`tarball for ${Z} exceeds ${Eg} bytes`);let Q=jg8(new Uint8Array(Dg8($,{maxOutputLength:Lg8}))),X=new Map;for(let[Y,J]of Q){let G=Y.indexOf("/");if(G===-1)continue;let W=Y.slice(G+1);if(W)X.set(W,J)}return X}function Bl1($,Z,Q){if($>Z)throw Error(`tarball for ${Q} exceeds ${Z} bytes`)}async function zg8($,Z){let Q=[],X=0,Y=$.getReader();try{while(!0){let{done:W,value:K}=await Y.read();if(W)break;X+=K.length,Bl1(X,Eg,Z),Q.push(K)}}finally{await Y.cancel().catch(()=>{}),Y.releaseLock()}let J=new Uint8Array(X),G=0;for(let W of Q)J.set(W,G),G+=W.length;return J}function Ol1($){if($ instanceof ul0)return $.status>=500||$.status===429;if($ instanceof y0)return $.status===0||$.status>=500||$.status===429;if($ instanceof Error&&/declares .* bytes|exceeds .* bytes/.test($.message))return!1;return!0}async function Pg8($,Z,Q){let{url:X,headers:Y}=Eg8($,Z,Q),J=`${$}@${Z}`,G=async()=>{let W=await fetch(X,{headers:Y,signal:AbortSignal.timeout(60000)});if(!W.ok)throw await W.body?.cancel().catch(()=>{}),new ul0(W.status,`tarball fetch failed for ${J}: HTTP ${W.status}`);let K=Number(W.headers.get("content-length")??0);if(K>Eg)throw Error(`tarball for ${J} declares ${K} bytes (cap ${Eg})`);let H=new Uint8Array(await W.arrayBuffer());return Bl1(H.length,Eg,J),H};try{let W=await c8(G,{maxAttempts:3,minTimeout:500,maxTimeout:4000,jitter:0.5,isRetriable:Ol1});return Nl1(W,J)}catch(W){if(W instanceof u5)throw W.cause instanceof Error?W.cause:W;throw W}}async function Ag8($,Z){if(!Z.tarball)return Pg8($.repo,$.ref,Z.authToken);let Q=Z.tarball,X=`${$.repo}@${$.ref}`,Y;try{Y=await c8(()=>Q(),{maxAttempts:3,minTimeout:500,maxTimeout:4000,jitter:0.5,isRetriable:Ol1})}catch(J){throw J instanceof u5&&J.cause instanceof Error?J.cause:J}if(!Y)throw Error(`tarball not found for ${X}`);return Nl1(await zg8(Y,X),X)}function Tg8($,Z){let Q=new Map;for(let{from:X,to:Y}of Z){let J=X===""?"":`${X.replace(/\/+$/,"")}/`;for(let[G,W]of $){if(!G.startsWith(J))continue;let K=G.slice(J.length);if(!K)continue;let H=k7(Y?`${Y}/${K}`:K);if(H)Q.set(H,W)}}return Q}function Rg8($,Z){let Q=new Set;for(let J of $){let G=J.split("/");for(let W=1;W<G.length;W++)Q.add(G.slice(0,W).join("/"))}let X=[...Z].filter((J)=>!Q.has(J)).sort((J,G)=>J.length-G.length),Y=[];for(let J of X)if(!Y.some((G)=>J.startsWith(`${G}/`)))Y.push(J);return Y}function qg8($){return Og8("sha256").update($).digest("hex")}function Mg8($){return $.manifestHash===$.hash&&$.storedPaths.has($.path)}async function Ig8($,Z){let Q=wZ0(Z),X=new Set,Y;do{let J=await $.list({prefix:Q,continuationToken:Y});for(let G of J.objects)X.add(G.key.slice(Q.length));Y=J.nextContinuationToken}while(Y);return X}async function ll0($,Z){let{orgId:Q,volume:X,source:Y}=Z,J=uX(),G=J?rJ(J,Q):new N3(Q,Z.baseUrl),W=new $n($),K=new B3(G,W,Q),H=Tg8(await Ag8(Y,Z),Y.paths),F=new Map((await W.listVolumeFiles(Q,X)).map((w)=>[w.path,w.contentHash]));if(H.size===0&&F.size>0)throw Error(`volume "${X}" resolved 0 files from ${Y.repo}@${Y.ref} `+`(check paths config) \u2014 refusing to delete the ${F.size} existing files`);let U=0;for(let w of F.keys()){if(H.has(w))continue;await K.delete(X,w,{actor:gl0}),U++}let N=await W.listVolumeDirs(Q,X);for(let w of Rg8(H.keys(),N.map((j)=>j.path)))await K.delete(X,w,{actor:gl0});let B=0,O=0,L=await Ig8(G,X);for(let[w,j]of H){if(Mg8({hash:qg8(j),manifestHash:F.get(w),storedPaths:L,path:w})){O++;continue}await K.write(X,w,j,{actor:gl0,contentType:V7(w),skipVolumeQuota:Z.skipVolumeQuota}),B++}return{written:B,deleted:U,unchanged:O}}async function Vg8($,Z,Q){let X=await ll0($,{orgId:ap,baseUrl:Q.baseUrl,volume:HD(Z.set),source:Z,skipVolumeQuota:!0});return{set:Z.set,...X}}async function cl0($,Z,Q){try{return await Vg8($,Z,Q)}catch(X){return{set:Z.set,error:X instanceof Error?X.message:String(X)}}}async function Dl1($,Z){let Q=[];for(let X of O3())Q.push(await cl0($,X,Z));return Q}var gl0="system:skill-set-sync",Eg=209715200,Lg8=1073741824,ul0;var zZ0=D(()=>{D8();U5();yl0();wg();WD();iW();DN();Qz();Yz();ul0=class ul0 extends Error{status;constructor($,Z){super(Z);this.status=$;this.name="TarballHttpError"}}});import{DBOS as PZ0,SchedulerMode as kg8}from"@dbos-inc/dbos-sdk";function Ll1($){dl0=$}function Cg8(){if(!dl0)throw Error("[org-fs] public-sets sync runtime not initialized \u2014 setPublicSetsSyncRuntime() must run before the workflow fires");return dl0}async function _g8($,Z){for(let Q of O3()){let X=await PZ0.runStep(()=>{let Y=Cg8();return cl0(Y.db,Q,{baseUrl:Y.baseUrl})},{name:`syncPublicSet:${Q.set}`});if("error"in X)console.warn(`[org-fs] public set "${X.set}" sync failed: ${X.error}`);else if(X.written||X.deleted)console.log(`[org-fs] public set "${X.set}" synced: +${X.written} -${X.deleted} (=${X.unchanged})`)}}function wl1(){if(Zn)return;Zn=PZ0.registerWorkflow(_g8,{name:"publicSetsSyncWorkflow"}),PZ0.registerScheduled(Zn,{name:"publicSetsSyncWorkflow",crontab:Sg8,mode:kg8.ExactlyOncePerIntervalWhenActive})}async function jl1(){if(O3().length===0||!Zn)return;let $=new Date,Z=`public-sets-sync-boot:${$.toISOString().slice(0,13)}`;await PZ0.startWorkflow(Zn,{workflowID:Z})($,$)}var Sg8="4-59/10 * * * *",dl0=null,Zn=null;var El1=D(()=>{Yz();zZ0()});import{jwtVerify as vg8,SignJWT as zl1}from"jose";import{randomBytes as bg8}from"crypto";function Pl1(){if(Qn)return Qn;let $=E0(),Z=$.studioJwtSecret??$.betterAuthSecret;if(Z)Qn=new TextEncoder().encode(Z);else console.warn("STUDIO_JWT_SECRET not set - generating random secret (not persistent)"),Qn=new Uint8Array(bg8(32));return Qn}async function Al1($,Z="5m"){let Q=Pl1();return await new zl1($).setProtectedHeader({alg:"HS256",typ:"JWT"}).setIssuedAt().setExpirationTime(Z).sign(Q)}async function ml0($){try{let Z=Pl1(),{payload:Q}=await vg8($,Z);return Q}catch{return}}async function WQ($,Z,Q=3600){let X=E0(),Y=X.plansEnabled?X.studioJwtSecret:X.studioJwtSecret??X.betterAuthSecret;if(!Y)throw Error(X.plansEnabled?"STUDIO_JWT_SECRET (or MESH_JWT_SECRET) is required to mint gateway JWTs when STUDIO_PLANS_ENABLED is set \u2014 BETTER_AUTH_SECRET is deliberately not a fallback, see resolve-config":"A deterministic JWT secret is required to mint gateway JWTs \u2014 set STUDIO_JWT_SECRET or BETTER_AUTH_SECRET");let J=new TextEncoder().encode(Y);return await new zl1({iss:"mesh",sub:$,...Z&&{email:Z}}).setProtectedHeader({alg:"HS256",typ:"JWT"}).setIssuedAt().setExpirationTime(Math.floor(Date.now()/1000)+Q).sign(J)}var Qn=null;var tW=D(()=>{U$()});import{createCipheriv as xg8,createDecipheriv as fg8,createHash as yg8,randomBytes as Tl1}from"crypto";class sJ{key;constructor($){if(Buffer.from($,"base64").length===Ml1)this.key=Buffer.from($,"base64");else this.key=yg8("sha256").update($).digest()}async encrypt($){let Z=Tl1(Xn),Q=xg8(Rl1,this.key,Z),X=Q.update($,"utf8");X=Buffer.concat([X,Q.final()]);let Y=Q.getAuthTag();return Buffer.concat([Z,Y,X]).toString("base64")}async decrypt($){let Z=Buffer.from($,"base64"),Q=Z.subarray(0,Xn),X=Z.subarray(Xn,Xn+ql1),Y=Z.subarray(Xn+ql1),J=fg8(Rl1,this.key,Q);J.setAuthTag(X);let G=J.update(Y);return G=Buffer.concat([G,J.final()]),G.toString("utf8")}static generateKey(){return Tl1(Ml1).toString("base64")}}var Rl1="aes-256-gcm",Xn=16,ql1=16,Ml1=32;var Gz=()=>{};function p9(){let $=E0();if($.baseUrl)return $.baseUrl;return`http://localhost:${$.port??3000}`}function Il1(){return`http://localhost:${E0().port??3000}`}function S5(){return E0().publicUrl??p9()}var D9=D(()=>{U$()});import*as f from"zod/v4";function dl1($){if($.params.ref.type!=="ref/prompt")throw TypeError(`Expected CompleteRequestPrompt, but got ${$.params.ref.type}`)}function ml1($){if($.params.ref.type!=="ref/resource")throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${$.params.ref.type}`)}var FD="2025-11-25",Vl1="2025-03-26",UD,ND="io.modelcontextprotocol/related-task",TZ0="2.0",Z7,kl1,Sl1,$G5,gg8,hg8,il0,eJ,Yn,Cl1=($)=>Yn.safeParse($).success,KQ,D3,L3,HQ,RZ0,_l1,CH=($)=>_l1.safeParse($).success,vl1,bl1=($)=>vl1.safeParse($).success,pl0,oW=($)=>pl0.safeParse($).success,v1,nl0,Pg=($)=>nl0.safeParse($).success,$G,ZG5,jN,ug8,qZ0,lg8,Jn,zg,xl1,cg8,dg8,mg8,ig8,pg8,ng8,MZ0,tl0=($)=>MZ0.safeParse($).success,tg8,ol0,IZ0,fl1=($)=>IZ0.safeParse($).success,VZ0,og8,rg8,kZ0,ag8,Gn,Wn,sg8,Kn,EN,eg8,Hn,SZ0,CZ0,_Z0,QG5,vZ0,bZ0,xZ0,yl1,gl1,hl1,rl0,ul1,Fn,Ag,ll1,$h8,BD,al0,OD,sl0,el0,Zh8,Tg,$c0,Zc0,Qh8,Xh8,Yh8,Jh8,Gh8,Wh8,Kh8,Hh8,DD,Qc0,Fh8,Rg,Xc0,Yc0,Jc0,Uh8,Nh8,Bh8,Gc0,Oh8,Wc0,Kc0,Dh8,Lh8,fZ0,qg,Un,_H,XG5,wh8,LD,Hc0,cl1,Nn,jh8,Fc0,Eh8,zh8,Ph8,Ah8,Th8,Rh8,qh8,AZ0,Mh8,Ih8,Uc0,Wz,Bn,Vh8,kh8,Sh8,Ch8,_h8,vh8,bh8,xh8,fh8,yh8,gh8,hh8,uh8,lh8,ch8,Nc0,dh8,mh8,wD,ih8,ph8,nh8,yZ0,Bc0,th8,oh8,Oc0,rh8,YG5,JG5,GG5,WG5,KG5,HG5,I1,il1;var n9=D(()=>{UD=[FD,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Z7=f.custom(($)=>$!==null&&(typeof $==="object"||typeof $==="function")),kl1=f.union([f.string(),f.number().int()]),Sl1=f.string(),$G5=f.looseObject({ttl:f.number().optional(),pollInterval:f.number().optional()}),gg8=f.object({ttl:f.number().optional()}),hg8=f.object({taskId:f.string()}),il0=f.looseObject({progressToken:kl1.optional(),[ND]:hg8.optional()}),eJ=f.object({_meta:il0.optional()}),Yn=eJ.extend({task:gg8.optional()}),KQ=f.object({method:f.string(),params:eJ.loose().optional()}),D3=f.object({_meta:il0.optional()}),L3=f.object({method:f.string(),params:D3.loose().optional()}),HQ=f.looseObject({_meta:il0.optional()}),RZ0=f.union([f.string(),f.number().int()]),_l1=f.object({jsonrpc:f.literal(TZ0),id:RZ0,...KQ.shape}).strict(),vl1=f.object({jsonrpc:f.literal(TZ0),...L3.shape}).strict(),pl0=f.object({jsonrpc:f.literal(TZ0),id:RZ0,result:HQ}).strict();(function($){$[$.ConnectionClosed=-32000]="ConnectionClosed",$[$.RequestTimeout=-32001]="RequestTimeout",$[$.ParseError=-32700]="ParseError",$[$.InvalidRequest=-32600]="InvalidRequest",$[$.MethodNotFound=-32601]="MethodNotFound",$[$.InvalidParams=-32602]="InvalidParams",$[$.InternalError=-32603]="InternalError",$[$.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(v1||(v1={}));nl0=f.object({jsonrpc:f.literal(TZ0),id:RZ0.optional(),error:f.object({code:f.number().int(),message:f.string(),data:f.unknown().optional()})}).strict(),$G=f.union([_l1,vl1,pl0,nl0]),ZG5=f.union([pl0,nl0]),jN=HQ.strict(),ug8=D3.extend({requestId:RZ0.optional(),reason:f.string().optional()}),qZ0=L3.extend({method:f.literal("notifications/cancelled"),params:ug8}),lg8=f.object({src:f.string(),mimeType:f.string().optional(),sizes:f.array(f.string()).optional(),theme:f.enum(["light","dark"]).optional()}),Jn=f.object({icons:f.array(lg8).optional()}),zg=f.object({name:f.string(),title:f.string().optional()}),xl1=zg.extend({...zg.shape,...Jn.shape,version:f.string(),websiteUrl:f.string().optional(),description:f.string().optional()}),cg8=f.intersection(f.object({applyDefaults:f.boolean().optional()}),f.record(f.string(),f.unknown())),dg8=f.preprocess(($)=>{if($&&typeof $==="object"&&!Array.isArray($)){if(Object.keys($).length===0)return{form:{}}}return $},f.intersection(f.object({form:cg8.optional(),url:Z7.optional()}),f.record(f.string(),f.unknown()).optional())),mg8=f.looseObject({list:Z7.optional(),cancel:Z7.optional(),requests:f.looseObject({sampling:f.looseObject({createMessage:Z7.optional()}).optional(),elicitation:f.looseObject({create:Z7.optional()}).optional()}).optional()}),ig8=f.looseObject({list:Z7.optional(),cancel:Z7.optional(),requests:f.looseObject({tools:f.looseObject({call:Z7.optional()}).optional()}).optional()}),pg8=f.object({experimental:f.record(f.string(),Z7).optional(),sampling:f.object({context:Z7.optional(),tools:Z7.optional()}).optional(),elicitation:dg8.optional(),roots:f.object({listChanged:f.boolean().optional()}).optional(),tasks:mg8.optional(),extensions:f.record(f.string(),Z7).optional()}),ng8=eJ.extend({protocolVersion:f.string(),capabilities:pg8,clientInfo:xl1}),MZ0=KQ.extend({method:f.literal("initialize"),params:ng8}),tg8=f.object({experimental:f.record(f.string(),Z7).optional(),logging:Z7.optional(),completions:Z7.optional(),prompts:f.object({listChanged:f.boolean().optional()}).optional(),resources:f.object({subscribe:f.boolean().optional(),listChanged:f.boolean().optional()}).optional(),tools:f.object({listChanged:f.boolean().optional()}).optional(),tasks:ig8.optional(),extensions:f.record(f.string(),Z7).optional()}),ol0=HQ.extend({protocolVersion:f.string(),capabilities:tg8,serverInfo:xl1,instructions:f.string().optional()}),IZ0=L3.extend({method:f.literal("notifications/initialized"),params:D3.optional()}),VZ0=KQ.extend({method:f.literal("ping"),params:eJ.optional()}),og8=f.object({progress:f.number(),total:f.optional(f.number()),message:f.optional(f.string())}),rg8=f.object({...D3.shape,...og8.shape,progressToken:kl1}),kZ0=L3.extend({method:f.literal("notifications/progress"),params:rg8}),ag8=eJ.extend({cursor:Sl1.optional()}),Gn=KQ.extend({params:ag8.optional()}),Wn=HQ.extend({nextCursor:Sl1.optional()}),sg8=f.enum(["working","input_required","completed","failed","cancelled"]),Kn=f.object({taskId:f.string(),status:sg8,ttl:f.union([f.number(),f.null()]),createdAt:f.string(),lastUpdatedAt:f.string(),pollInterval:f.optional(f.number()),statusMessage:f.optional(f.string())}),EN=HQ.extend({task:Kn}),eg8=D3.merge(Kn),Hn=L3.extend({method:f.literal("notifications/tasks/status"),params:eg8}),SZ0=KQ.extend({method:f.literal("tasks/get"),params:eJ.extend({taskId:f.string()})}),CZ0=HQ.merge(Kn),_Z0=KQ.extend({method:f.literal("tasks/result"),params:eJ.extend({taskId:f.string()})}),QG5=HQ.loose(),vZ0=Gn.extend({method:f.literal("tasks/list")}),bZ0=Wn.extend({tasks:f.array(Kn)}),xZ0=KQ.extend({method:f.literal("tasks/cancel"),params:eJ.extend({taskId:f.string()})}),yl1=HQ.merge(Kn),gl1=f.object({uri:f.string(),mimeType:f.optional(f.string()),_meta:f.record(f.string(),f.unknown()).optional()}),hl1=gl1.extend({text:f.string()}),rl0=f.string().refine(($)=>{try{return atob($),!0}catch{return!1}},{message:"Invalid Base64 string"}),ul1=gl1.extend({blob:rl0}),Fn=f.enum(["user","assistant"]),Ag=f.object({audience:f.array(Fn).optional(),priority:f.number().min(0).max(1).optional(),lastModified:f.iso.datetime({offset:!0}).optional()}),ll1=f.object({...zg.shape,...Jn.shape,uri:f.string(),description:f.optional(f.string()),mimeType:f.optional(f.string()),size:f.optional(f.number()),annotations:Ag.optional(),_meta:f.optional(f.looseObject({}))}),$h8=f.object({...zg.shape,...Jn.shape,uriTemplate:f.string(),description:f.optional(f.string()),mimeType:f.optional(f.string()),annotations:Ag.optional(),_meta:f.optional(f.looseObject({}))}),BD=Gn.extend({method:f.literal("resources/list")}),al0=Wn.extend({resources:f.array(ll1)}),OD=Gn.extend({method:f.literal("resources/templates/list")}),sl0=Wn.extend({resourceTemplates:f.array($h8)}),el0=eJ.extend({uri:f.string()}),Zh8=el0,Tg=KQ.extend({method:f.literal("resources/read"),params:Zh8}),$c0=HQ.extend({contents:f.array(f.union([hl1,ul1]))}),Zc0=L3.extend({method:f.literal("notifications/resources/list_changed"),params:D3.optional()}),Qh8=el0,Xh8=KQ.extend({method:f.literal("resources/subscribe"),params:Qh8}),Yh8=el0,Jh8=KQ.extend({method:f.literal("resources/unsubscribe"),params:Yh8}),Gh8=D3.extend({uri:f.string()}),Wh8=L3.extend({method:f.literal("notifications/resources/updated"),params:Gh8}),Kh8=f.object({name:f.string(),description:f.optional(f.string()),required:f.optional(f.boolean())}),Hh8=f.object({...zg.shape,...Jn.shape,description:f.optional(f.string()),arguments:f.optional(f.array(Kh8)),_meta:f.optional(f.looseObject({}))}),DD=Gn.extend({method:f.literal("prompts/list")}),Qc0=Wn.extend({prompts:f.array(Hh8)}),Fh8=eJ.extend({name:f.string(),arguments:f.record(f.string(),f.string()).optional()}),Rg=KQ.extend({method:f.literal("prompts/get"),params:Fh8}),Xc0=f.object({type:f.literal("text"),text:f.string(),annotations:Ag.optional(),_meta:f.record(f.string(),f.unknown()).optional()}),Yc0=f.object({type:f.literal("image"),data:rl0,mimeType:f.string(),annotations:Ag.optional(),_meta:f.record(f.string(),f.unknown()).optional()}),Jc0=f.object({type:f.literal("audio"),data:rl0,mimeType:f.string(),annotations:Ag.optional(),_meta:f.record(f.string(),f.unknown()).optional()}),Uh8=f.object({type:f.literal("tool_use"),name:f.string(),id:f.string(),input:f.record(f.string(),f.unknown()),_meta:f.record(f.string(),f.unknown()).optional()}),Nh8=f.object({type:f.literal("resource"),resource:f.union([hl1,ul1]),annotations:Ag.optional(),_meta:f.record(f.string(),f.unknown()).optional()}),Bh8=ll1.extend({type:f.literal("resource_link")}),Gc0=f.union([Xc0,Yc0,Jc0,Bh8,Nh8]),Oh8=f.object({role:Fn,content:Gc0}),Wc0=HQ.extend({description:f.string().optional(),messages:f.array(Oh8)}),Kc0=L3.extend({method:f.literal("notifications/prompts/list_changed"),params:D3.optional()}),Dh8=f.object({title:f.string().optional(),readOnlyHint:f.boolean().optional(),destructiveHint:f.boolean().optional(),idempotentHint:f.boolean().optional(),openWorldHint:f.boolean().optional()}),Lh8=f.object({taskSupport:f.enum(["required","optional","forbidden"]).optional()}),fZ0=f.object({...zg.shape,...Jn.shape,description:f.string().optional(),inputSchema:f.object({type:f.literal("object"),properties:f.record(f.string(),Z7).optional(),required:f.array(f.string()).optional()}).catchall(f.unknown()),outputSchema:f.object({type:f.literal("object"),properties:f.record(f.string(),Z7).optional(),required:f.array(f.string()).optional()}).catchall(f.unknown()).optional(),annotations:Dh8.optional(),execution:Lh8.optional(),_meta:f.record(f.string(),f.unknown()).optional()}),qg=Gn.extend({method:f.literal("tools/list")}),Un=Wn.extend({tools:f.array(fZ0)}),_H=HQ.extend({content:f.array(Gc0).default([]),structuredContent:f.record(f.string(),f.unknown()).optional(),isError:f.boolean().optional()}),XG5=_H.or(HQ.extend({toolResult:f.unknown()})),wh8=Yn.extend({name:f.string(),arguments:f.record(f.string(),f.unknown()).optional()}),LD=KQ.extend({method:f.literal("tools/call"),params:wh8}),Hc0=L3.extend({method:f.literal("notifications/tools/list_changed"),params:D3.optional()}),cl1=f.object({autoRefresh:f.boolean().default(!0),debounceMs:f.number().int().nonnegative().default(300)}),Nn=f.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),jh8=eJ.extend({level:Nn}),Fc0=KQ.extend({method:f.literal("logging/setLevel"),params:jh8}),Eh8=D3.extend({level:Nn,logger:f.string().optional(),data:f.unknown()}),zh8=L3.extend({method:f.literal("notifications/message"),params:Eh8}),Ph8=f.object({name:f.string().optional()}),Ah8=f.object({hints:f.array(Ph8).optional(),costPriority:f.number().min(0).max(1).optional(),speedPriority:f.number().min(0).max(1).optional(),intelligencePriority:f.number().min(0).max(1).optional()}),Th8=f.object({mode:f.enum(["auto","required","none"]).optional()}),Rh8=f.object({type:f.literal("tool_result"),toolUseId:f.string().describe("The unique identifier for the corresponding tool call."),content:f.array(Gc0).default([]),structuredContent:f.object({}).loose().optional(),isError:f.boolean().optional(),_meta:f.record(f.string(),f.unknown()).optional()}),qh8=f.discriminatedUnion("type",[Xc0,Yc0,Jc0]),AZ0=f.discriminatedUnion("type",[Xc0,Yc0,Jc0,Uh8,Rh8]),Mh8=f.object({role:Fn,content:f.union([AZ0,f.array(AZ0)]),_meta:f.record(f.string(),f.unknown()).optional()}),Ih8=Yn.extend({messages:f.array(Mh8),modelPreferences:Ah8.optional(),systemPrompt:f.string().optional(),includeContext:f.enum(["none","thisServer","allServers"]).optional(),temperature:f.number().optional(),maxTokens:f.number().int(),stopSequences:f.array(f.string()).optional(),metadata:Z7.optional(),tools:f.array(fZ0).optional(),toolChoice:Th8.optional()}),Uc0=KQ.extend({method:f.literal("sampling/createMessage"),params:Ih8}),Wz=HQ.extend({model:f.string(),stopReason:f.optional(f.enum(["endTurn","stopSequence","maxTokens"]).or(f.string())),role:Fn,content:qh8}),Bn=HQ.extend({model:f.string(),stopReason:f.optional(f.enum(["endTurn","stopSequence","maxTokens","toolUse"]).or(f.string())),role:Fn,content:f.union([AZ0,f.array(AZ0)])}),Vh8=f.object({type:f.literal("boolean"),title:f.string().optional(),description:f.string().optional(),default:f.boolean().optional()}),kh8=f.object({type:f.literal("string"),title:f.string().optional(),description:f.string().optional(),minLength:f.number().optional(),maxLength:f.number().optional(),format:f.enum(["email","uri","date","date-time"]).optional(),default:f.string().optional()}),Sh8=f.object({type:f.enum(["number","integer"]),title:f.string().optional(),description:f.string().optional(),minimum:f.number().optional(),maximum:f.number().optional(),default:f.number().optional()}),Ch8=f.object({type:f.literal("string"),title:f.string().optional(),description:f.string().optional(),enum:f.array(f.string()),default:f.string().optional()}),_h8=f.object({type:f.literal("string"),title:f.string().optional(),description:f.string().optional(),oneOf:f.array(f.object({const:f.string(),title:f.string()})),default:f.string().optional()}),vh8=f.object({type:f.literal("string"),title:f.string().optional(),description:f.string().optional(),enum:f.array(f.string()),enumNames:f.array(f.string()).optional(),default:f.string().optional()}),bh8=f.union([Ch8,_h8]),xh8=f.object({type:f.literal("array"),title:f.string().optional(),description:f.string().optional(),minItems:f.number().optional(),maxItems:f.number().optional(),items:f.object({type:f.literal("string"),enum:f.array(f.string())}),default:f.array(f.string()).optional()}),fh8=f.object({type:f.literal("array"),title:f.string().optional(),description:f.string().optional(),minItems:f.number().optional(),maxItems:f.number().optional(),items:f.object({anyOf:f.array(f.object({const:f.string(),title:f.string()}))}),default:f.array(f.string()).optional()}),yh8=f.union([xh8,fh8]),gh8=f.union([vh8,bh8,yh8]),hh8=f.union([gh8,Vh8,kh8,Sh8]),uh8=Yn.extend({mode:f.literal("form").optional(),message:f.string(),requestedSchema:f.object({type:f.literal("object"),properties:f.record(f.string(),hh8),required:f.array(f.string()).optional()})}),lh8=Yn.extend({mode:f.literal("url"),message:f.string(),elicitationId:f.string(),url:f.string().url()}),ch8=f.union([uh8,lh8]),Nc0=KQ.extend({method:f.literal("elicitation/create"),params:ch8}),dh8=D3.extend({elicitationId:f.string()}),mh8=L3.extend({method:f.literal("notifications/elicitation/complete"),params:dh8}),wD=HQ.extend({action:f.enum(["accept","decline","cancel"]),content:f.preprocess(($)=>$===null?void 0:$,f.record(f.string(),f.union([f.string(),f.number(),f.boolean(),f.array(f.string())])).optional())}),ih8=f.object({type:f.literal("ref/resource"),uri:f.string()}),ph8=f.object({type:f.literal("ref/prompt"),name:f.string()}),nh8=eJ.extend({ref:f.union([ph8,ih8]),argument:f.object({name:f.string(),value:f.string()}),context:f.object({arguments:f.record(f.string(),f.string()).optional()}).optional()}),yZ0=KQ.extend({method:f.literal("completion/complete"),params:nh8});Bc0=HQ.extend({completion:f.looseObject({values:f.array(f.string()).max(100),total:f.optional(f.number().int()),hasMore:f.optional(f.boolean())})}),th8=f.object({uri:f.string().startsWith("file://"),name:f.string().optional(),_meta:f.record(f.string(),f.unknown()).optional()}),oh8=KQ.extend({method:f.literal("roots/list"),params:eJ.optional()}),Oc0=HQ.extend({roots:f.array(th8)}),rh8=L3.extend({method:f.literal("notifications/roots/list_changed"),params:D3.optional()}),YG5=f.union([VZ0,MZ0,yZ0,Fc0,Rg,DD,BD,OD,Tg,Xh8,Jh8,LD,qg,SZ0,_Z0,vZ0,xZ0]),JG5=f.union([qZ0,kZ0,IZ0,rh8,Hn]),GG5=f.union([jN,Wz,Bn,wD,Oc0,CZ0,bZ0,EN]),WG5=f.union([VZ0,Uc0,Nc0,oh8,SZ0,_Z0,vZ0,xZ0]),KG5=f.union([qZ0,kZ0,zh8,Wh8,Zc0,Hc0,Kc0,Hn,mh8]),HG5=f.union([jN,ol0,Bc0,Wc0,Qc0,al0,sl0,$c0,_H,Un,CZ0,bZ0,EN]);I1=class I1 extends Error{constructor($,Z,Q){super(`MCP error ${$}: ${Z}`);this.code=$,this.data=Q,this.name="McpError"}static fromError($,Z,Q){if($===v1.UrlElicitationRequired&&Q){let X=Q;if(X.elicitations)return new il1(X.elicitations,Z)}return new I1($,Z,Q)}};il1=class il1 extends I1{constructor($,Z=`URL elicitation${$.length>1?"s":""} required`){super(v1.UrlElicitationRequired,Z,{elicitations:$})}get elicitations(){return this.data?.elicitations??[]}}});import{z as p$}from"zod";function tl1($){return p$.record(p$.string(),p$.unknown()).nullable().refine((Z)=>Z===null||JSON.stringify(Z).length<=nl1,{message:`${$} must serialize to at most ${nl1} bytes`})}function vH($){return $!==null&&$!==void 0&&"command"in $}function Mg($){if(!$||!$.startsWith("virtual://"))return null;return $.replace("virtual://","")}function Ig($){return`virtual://${$}`}var ol1,pl1,ah8,sh8,eh8,nl1=262144,nQ,gZ0,hZ0;var rl1=D(()=>{n9();ol1=p$.object({authorizationEndpoint:p$.string().url(),tokenEndpoint:p$.string().url(),introspectionEndpoint:p$.string().url().optional(),clientId:p$.string(),clientSecret:p$.string().optional(),scopes:p$.array(p$.string()),grantType:p$.enum(["authorization_code","client_credentials"])}),pl1=p$.object({type:p$.literal("object"),properties:p$.record(p$.string(),p$.unknown()).optional(),required:p$.array(p$.string()).optional()}).catchall(p$.unknown()),ah8=fZ0.extend({inputSchema:pl1,outputSchema:pl1.optional()}),sh8=p$.object({headers:p$.record(p$.string(),p$.string()).optional()}),eh8=p$.object({command:p$.string().describe("Command to run (e.g., 'npx', 'node')"),args:p$.array(p$.string()).optional().describe("Command arguments"),cwd:p$.string().optional().describe("Working directory"),envVars:p$.record(p$.string(),p$.string()).optional().describe("Environment variables (encrypted in storage)")});nQ=p$.object({id:p$.string().describe("Unique identifier for the connection"),title:p$.string().describe("Human-readable name for the connection"),created_at:p$.string().describe("When the connection was created"),updated_at:p$.string().describe("When the connection was last updated"),created_by:p$.string().describe("User ID who created the connection"),updated_by:p$.string().optional().describe("User ID who last updated the connection"),organization_id:p$.string().describe("Organization ID this connection belongs to"),description:p$.string().nullable().describe("Description of the connection"),icon:p$.string().nullable().describe("Icon URL for the connection"),app_name:p$.string().nullable().describe("Associated app name"),app_id:p$.string().nullable().describe("Associated app ID"),slug:p$.string().nullable().optional().describe("URL-safe slug derived from app_name, connection_url, or title"),connection_type:p$.enum(["HTTP","SSE","Websocket","STDIO","VIRTUAL"]).describe("Type of connection"),connection_url:p$.string().nullable().describe("URL for HTTP/SSE/WebSocket connections. virtual://$id for VIRTUAL. Null for STDIO."),connection_token:p$.string().nullable().describe("Authentication token (for HTTP connections)"),connection_headers:p$.union([eh8,sh8]).nullable().describe("Connection parameters. HTTP: { headers }. STDIO: { command, args, cwd, envVars }"),oauth_config:ol1.nullable().describe("OAuth configuration"),configuration_state:tl1("configuration_state").describe("Configuration state (decrypted)"),configuration_scopes:p$.array(p$.string()).nullable().optional().describe("Configuration scopes"),metadata:tl1("metadata").describe("Additional metadata (includes repository info)"),tools:p$.array(ah8).nullable().describe("Discovered tools from MCP"),bindings:p$.array(p$.string()).nullable().describe("Detected bindings"),status:p$.enum(["active","inactive","error"]).describe("Current status")}),gZ0=nQ.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}).extend({icon:p$.string().nullish()}),hZ0=nQ.partial()});import{z as V0}from"zod";function wc0($){let Z=$?.homeTiles;if(Array.isArray(Z)&&Z.length>0)return Z;let Q=$?.homeTile;return Q?[Q]:[]}function zN($){if(!$||typeof $!=="object"||Array.isArray($))return{};let Z=$,Q={};for(let[X,Y]of Object.entries(Z)){if(!Y||typeof Y!=="object")continue;if(X!=="agent-sandbox"&&X!=="local-api")continue;try{Q[X]=jc0.parse(Y)}catch{}}return Q}function Ec0($){if(!$||typeof $!=="object"||Array.isArray($))return{};let Z={};for(let[Q,X]of Object.entries($)){if(!X||typeof X!=="object"||Array.isArray(X))continue;let Y={};for(let[J,G]of Object.entries(X)){let W=zN(G);if(Object.keys(W).length>0)Y[J]=W}if(Object.keys(Y).length>0)Z[Q]=Y}return Z}var el1,Dc0=500,$c1=200,$u8=200,Zu8=20,Qu8=50,Xu8=100,Yu8=20,Ju8=100,Zc1=50,Gu8=100,Wu8=50,Ku8=8192,Qc1,Hu8,Xc1,Lc0,Fu8,Uu8,Yc1,al1,Nu8,uZ0,sl1,Bu8,Jc1,Ou8,Du8,Lu8,wu8,ju8,jc0,Gc1,Eu8,zu8,Pu8,Au8,Tu8,Ru8,qu8,Wc1,Mu8,zc0,tQ,Pc0,lZ0,cZ0;var Kc1=D(()=>{el1=V0.object({connection_id:V0.string().describe("Connection ID"),selected_tools:V0.array(V0.string()).nullable().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:V0.array(V0.string()).nullable().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:V0.array(V0.string()).nullable().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),Qc1=el1.extend({selected_tools:V0.array(V0.string()).max(Dc0).nullable().optional().describe("Selected tool names. null = all tools included, array = only these tools included"),selected_resources:V0.array(V0.string()).max(Dc0).nullable().optional().describe("Selected resource URIs or patterns. Supports * and ** wildcards for pattern matching. null = all resources included, array = only these resources included"),selected_prompts:V0.array(V0.string()).max(Dc0).nullable().optional().describe("Selected prompt names. null = all prompts included, array = only these prompts included")}),Hu8=V0.object({connectionId:V0.string(),toolName:V0.string(),label:V0.string(),icon:V0.string().nullable().optional()}),Xc1=V0.object({id:V0.string().describe("Stable id; used as React key and ?tab= value"),title:V0.string().describe("Tab label"),icon:V0.string().optional().describe("Optional lucide icon name"),view:V0.object({type:V0.literal("ext-app"),appId:V0.string(),args:V0.record(V0.string(),V0.unknown()).optional()})}),Lc0=V0.enum(["overview","reports","board","site-editor","assets","hosting","e2e","analytics","cdn","automations","experiments"]),Fu8=V0.enum(["on","off"]),Uu8=V0.enum(["on","off","manual","auto"]),Yc1=V0.object({defaultMainView:V0.object({type:V0.string(),id:V0.string().optional(),toolName:V0.string().optional()}).nullable().optional(),chatDefaultOpen:V0.boolean().nullable().optional(),cmsDefaultOpen:V0.boolean().nullable().optional(),cms:Uu8.nullable().optional().describe("How this agent offers content editing. Absent means on; the retired `manual` / `auto` read as on too."),sidebarViews:V0.array(Lc0).max(10).nullable().optional().describe("Deprecated layout-scoped sidebar selections. Read only as a fallback when metadata.sidebarViews is absent."),tabs:V0.array(Xc1).max(Yu8).optional()}),al1=V0.object({tileId:V0.string().optional(),connectionId:V0.string().optional().describe("Connection that owns the resource \u2014 the host opens a direct MCP client to this connection so the iframe can call tools by their bare names."),resourceUri:V0.string().describe("ui:// resource URI exposed by `connectionId`. Read on the home page and rendered via MCPAppRenderer."),toolName:V0.string().optional().describe("Tool name \u2014 identifies which tool's inputSchema to display when editing tile props."),toolInput:V0.record(V0.string(),V0.unknown()).optional().describe("User-configured input props passed to MCPAppRenderer when rendering the tile."),minHeight:V0.number().int().positive().optional(),maxHeight:V0.number().int().positive().optional()}),Nu8=V0.object({banner:V0.string().nullable().optional(),bannerColor:V0.string().nullable().optional(),icon:V0.string().nullable().optional(),themeColor:V0.string().nullable().optional(),pinnedViews:V0.array(Hu8).max(Xu8).nullable().optional(),layout:Yc1.nullable().optional(),homeTile:al1.nullable().optional(),homeTiles:V0.array(al1).max(Zu8).nullable().optional(),homePrompts:V0.array(V0.string()).max(Qu8).nullable().optional()});uZ0=/^[A-Za-z_][A-Za-z0-9_]*$/,sl1=V0.string().min(1).regex(uZ0,{message:"Env var key must start with a letter or underscore and contain only letters, digits, and underscores."}),Bu8=V0.discriminatedUnion("kind",[V0.object({key:sl1,kind:V0.literal("literal"),value:V0.string().max(Ku8)}),V0.object({key:sl1,kind:V0.literal("secret"),secretId:V0.string().min(1)})]),Jc1=/^[a-zA-Z0-9.-]+(?::[0-9]+)?$/,Ou8=V0.object({host:V0.string().min(1).regex(Jc1).describe("Submodule host, e.g. 'github.com' (bare hostname, no scheme)."),secretId:V0.string().min(1).describe("Vault secret id holding the PAT used to fetch this host.")}),Du8=V0.object({selected:V0.string().nullable().optional().describe("User-selected package manager (npm | pnpm | yarn | bun | deno). Null/absent means autodetect on next SANDBOX_START."),port:V0.string().nullable().optional().describe("User-selected dev server port as a string (allows '' / null for unset). Null/absent means autodetect."),path:V0.string().nullable().optional().describe("Optional path (relative to repo root) to the directory containing package.json. Null/absent means repo root. Forwarded as `application.packageManager.path` to the daemon config."),env:V0.array(Bu8).max(Gu8).nullable().optional().describe("Env vars injected on every SANDBOX_START. Literal entries inline their value; secret entries store a secretId that Studio resolves via the credential vault before posting /_sandbox/config."),submoduleCredentials:V0.array(Ou8).max(Wu8).nullable().optional().describe("Git credentials injected on every SANDBOX_START. Each entry maps a host to a vault secret (PAT) that Studio resolves before posting /_sandbox/config; the daemon installs it in the sandbox's git config, authenticating submodules and private package dependencies on that host.")}),Lu8=V0.object({url:V0.string().describe("GitHub repository URL"),owner:V0.string().describe("Repository owner"),name:V0.string().describe("Repository name"),installationId:V0.number().optional().describe("GitHub App installation ID. Absent when the repo was linked without a GitHub connection (public-clone mode)."),connectionId:V0.string().optional().describe("ID of the mcp-github connection used for authentication. Absent for public repos cloned without credentials."),repositoryId:V0.string().optional().describe("First-class repository (REPOSITORY_LINK) backing this binding. When set, credentials come from the repository's git provider account rather than connectionId.")}),wu8=V0.enum(["agent-sandbox","local-api"]),ju8={sandboxHandle:V0.string().describe("Provider-specific handle"),previewUrl:V0.string().nullable().describe("URL where the sandbox's iframe-proxied UI is served, or null when the sandbox has no dev server (blank / tool sandboxes)."),sandboxApiUrl:V0.string().nullable().optional().describe("Direct sandbox API URL for runtimes that expose one. Equal to previewUrl for local-api; null/absent for AgentSandbox, which routes control traffic through hosted Studio."),createdAt:V0.number().optional().describe("Epoch ms the entry was first written by SANDBOX_START. Used by the booting overlay to show a stable elapsed timer that survives browser reloads. Optional for backward compatibility with entries written before this field existed."),startedWith:V0.object({packageManager:V0.string().nullable().optional().describe("metadata.runtime.selected at the time of SANDBOX_START"),port:V0.string().nullable().optional().describe("metadata.runtime.port at the time of SANDBOX_START"),path:V0.string().nullable().optional().describe("metadata.runtime.path at the time of SANDBOX_START")}).optional().describe("Snapshot of metadata.runtime fields (selected/port/path) used at SANDBOX_START. The Preview tab compares the live metadata.runtime against this to decide if a restart is required to apply changes.")},jc0=V0.object(ju8);Gc1=V0.record(V0.string().describe("userId"),V0.record(V0.string().describe("branch"),V0.partialRecord(wu8,jc0)));Eu8=V0.object({id:V0.string().describe("Stable identifier for this knowledge file"),name:V0.string().describe("File name shown in the UI"),kind:V0.enum(["file","skill"]).optional().describe("'file' (a single document) or 'skill' (a Claude Code skill folder containing SKILL.md). Defaults to 'file'."),volume:V0.string().describe("Org filesystem (Library) volume the file lives in"),path:V0.string().describe("Path within the volume"),url:V0.string().describe("Same-origin URL to read the file (display/download)"),contentType:V0.string().nullable().optional().describe("MIME type, used to decide whether to inline the content"),size:V0.number().nullable().optional().describe("File size in bytes"),addedAt:V0.string().describe("ISO timestamp when the file was attached")}),zu8=V0.array(Eu8).max(Ju8).nullable().optional().describe("Files attached to the agent as reference knowledge. Surfaced in the system prompt: small text documents are inlined, others are listed as retrievable references."),Pu8=V0.enum(["smart","code-review","open"]),Au8=Pu8.nullable().optional().describe("Controls when this code agent's changes may be published directly vs. requiring PR review. 'smart' (default) uses AI to judge per change; 'code-review' requires review for any code; 'open' allows direct publish always."),Tu8=V0.boolean().nullable().optional().describe("Enable Fast Preview (sandbox-less): render the draft instantly on the preview server's own page via a ?__draft pointer, with reads/writes served by the decofile API against GitHub. Requires previewServerUrl (or legacy productionUrl) to be set to take effect."),Ru8=V0.boolean().nullable().optional().describe("EXPERIMENTAL: with Fast Preview on, refresh content edits via an in-place /live/previews render (no commit, no reload) instead of a commit + re-navigation. Deco-runtime preview targets only. Requires fastPreview."),qu8=V0.string().nullable().optional().describe("Preview server URL \u2014 the deployment the CMS preview renders against (often the live site, e.g. https://acme.com). Painted in the preview iframe, and the render target for Fast Preview drafts. Supersedes the legacy productionUrl key."),Wc1=V0.object({branch:V0.string().describe("Git branch backing this release"),name:V0.string().describe('User-facing name, e.g. "Black Friday 2026"'),color:V0.string().describe("Dot color token shown in the version switcher"),createdBy:V0.string().optional().describe("User ID who created the release"),createdAt:V0.string().optional().describe("ISO 8601 creation timestamp")}),Mu8=V0.array(Wc1).max(Zc1).nullable().optional().describe("Curated list of named, branch-backed releases shown in the version switcher. The base branch ('No ar') is derived, not stored here."),zc0={instructions:V0.string().nullable().optional().describe("Instructions also used as system prompt"),subAgents:V0.array(V0.string()).max($u8).nullable().optional().describe("Allowlist of Virtual MCP (agent) or concrete MCP connection IDs this agent may delegate to via subtask. Concrete connections create ephemeral subagents. null/absent = all active org targets; empty array = itself only."),liveAgentId:V0.string().nullable().optional().describe("ID of the live agent this (dev) agent develops. Set only on dev agents; powers the Develop/Live toggle. A dev agent is hidden from the sidebar (reached via the toggle on its live counterpart)."),ui:Nu8.nullable().optional().describe("UI customization settings"),sidebarViews:V0.array(Lc0).max(10).nullable().optional().describe("Project views selected for the sidebar. Interpret as an exact list when sidebarViewsVersion is 1; unversioned values use legacy native-only semantics. Runtime presence gates still apply."),sidebarViewsVersion:V0.literal(1).optional().describe("Version 1 marks metadata.sidebarViews as an exact list that can disable legacy default rows."),githubRepo:Lu8.nullable().optional().describe("Linked GitHub repository"),runtime:Du8.nullable().optional().describe("User-pinned runtime config (package manager, dev port). Empty fields = autodetect."),knowledge:zu8,siteSlug:V0.string().nullable().optional().describe("Linked asset site slug (managed storage tenancy)"),publishPolicy:Au8,previewServerUrl:qu8,productionUrl:V0.string().nullable().optional().describe("Legacy key for previewServerUrl \u2014 still read as a fallback. New writes use previewServerUrl."),fieldDescriptionTooltips:V0.boolean().nullable().optional().describe("Blocks form: opt in to showing a field's schema description as a hover tooltip on its title, instead of the default inline text below the title."),fastPreview:Tu8,releases:Mu8,fastPreviewInPlace:Ru8},tQ=V0.object({id:V0.string().describe("Unique identifier"),title:V0.string().describe("Human-readable name"),description:V0.string().nullable().describe("Description"),icon:V0.string().nullable().describe("Icon URL"),created_at:V0.string().describe("Creation timestamp"),updated_at:V0.string().describe("Last update timestamp"),created_by:V0.string().describe("User ID who created this item"),updated_by:V0.string().optional().describe("User ID who last updated this item"),organization_id:V0.string().describe("Organization ID this item belongs to"),status:V0.enum(["active","inactive"]).describe("Current status"),pinned:V0.boolean().describe("Whether this space is pinned to the sidebar"),metadata:V0.object(zc0).extend({instructions:V0.string().nullable().describe("Instructions also used as system prompt"),sandboxMap:Gc1.optional().describe("Per-user, per-branch sandbox mapping: sandboxMap[userId][branch] -> { sandboxHandle, previewUrl }")}).loose().describe("Metadata"),connections:V0.array(el1).describe("Connections with their selected tools, resources, and prompts")}),Pc0=V0.object({title:V0.string().min(1).max(120).describe("Short label shown on the chip"),description:V0.string().max(280).optional().describe("One-line subtitle shown under the title"),text:V0.string().min(1).max(4000).describe("The message sent to the agent when the prompt is clicked")}),lZ0=V0.object({title:V0.string().min(1).max(255).describe("Name for the virtual MCP"),description:V0.string().max(500).nullable().optional().describe("Optional description"),icon:V0.string().nullish().describe("Optional icon URL"),status:V0.enum(["active","inactive"]).optional().default("active").describe("Initial status"),pinned:V0.boolean().optional().default(!1).describe("Pin to sidebar"),metadata:V0.object(zc0).loose().superRefine(($,Z)=>{if("sandboxMap"in $)Z.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:V0.array(Qc1).max($c1).describe("Connections to include/exclude (can be empty for exclusion mode)"),prompts:V0.array(Pc0).max(20).optional().describe("Optional kickstart prompts to seed on the agent. Each becomes a clickable conversation starter (icebreaker) on the agent. Author them from the agent's role and the tools it will have so they're coherent and immediately useful.")}),cZ0=V0.object({title:V0.string().min(1).max(255).optional().describe("New name"),description:V0.string().max(500).nullable().optional().describe("New description (null to clear)"),icon:V0.string().nullish().describe("New icon URL"),status:V0.enum(["active","inactive"]).optional().describe("New status"),pinned:V0.boolean().optional().describe("Pin/unpin from sidebar"),metadata:V0.object(zc0).loose().superRefine(($,Z)=>{if("sandboxMap"in $)Z.addIssue({code:"custom",path:["sandboxMap"],message:"sandboxMap is managed by the sandbox lifecycle"})}).nullable().optional().describe("Additional metadata including MCP server instructions"),connections:V0.array(Qc1).max($c1).optional().describe("New connections (replaces existing)"),prompts:V0.array(Pc0).max(20).optional().describe("Replace the agent's kickstart prompts with this full set. Omit to leave them unchanged; pass an empty array to remove all. Each becomes a clickable conversation starter (icebreaker).")})});function Kz($){return Iu8.has($)}var UZ,Iu8,dZ0;var Hc1=D(()=>{UZ=["deco","anthropic","openrouter","llmapi","google","openai-compatible"],Iu8=new Set(UZ);dZ0=[...UZ,"claude-code","codex"]});function Ac0($,Z){return{id:crypto.randomUUID(),type:On.STEP,source:"decopilot",subject:$,data:{stepCount:Z},time:new Date().toISOString()}}function mZ0($,Z){return{id:crypto.randomUUID(),type:On.FINISH,source:"decopilot",subject:$,data:{status:Z},time:new Date().toISOString()}}function bH($,Z,Q){return{id:crypto.randomUUID(),type:On.THREAD_STATUS,source:"decopilot",subject:$,data:{status:Z,...Q?.messageId!==void 0&&{message_id:Q.messageId},...Q?.virtualMcpId!==void 0&&{virtual_mcp_id:Q.virtualMcpId},...Q?.createdBy!==void 0&&{created_by:Q.createdBy},...Q?.triggerId!==void 0&&{trigger_id:Q.triggerId},...Q?.title!==void 0&&{title:Q.title},...Q?.branch!==void 0&&{branch:Q.branch},...Q?.harnessId!==void 0&&{harness_id:Q.harnessId},...Q?.createdAt!==void 0&&{created_at:Q.createdAt},...Q?.updatedAt!==void 0&&{updated_at:Q.updatedAt},...Q?.metadata!==void 0&&{metadata:Q.metadata}},time:new Date().toISOString()}}var Fc1,Vu8,On,ku8;var Uc1=D(()=>{Fc1=["in_progress","requires_action","failed","completed"],Vu8=[...Fc1,"expired"],On={STEP:"decopilot.step",FINISH:"decopilot.finish",THREAD_STATUS:"decopilot.thread.status"},ku8=Object.values(On)});var iZ0=D(()=>{rl1();Kc1();Hc1();Uc1()});var xH=D(()=>{iZ0()});import{lookup as Su8}from"dns/promises";function Dn($,Z){if($===10)return!0;if($===172&&Z!==void 0&&Z>=16&&Z<=31)return!0;if($===192&&Z===168)return!0;if($===127)return!0;if($===169&&Z===254)return!0;if($===0)return!0;if($===100&&Z!==void 0&&Z>=64&&Z<=127)return!0;return!1}function Tc0($){let Z=Number.parseInt($.padStart(4,"0"),16);return[Z>>8,Z&255]}function Nc1($){let Z=$.split(":").filter((Q)=>Q.length>0);if($.startsWith("2002:")&&Z.length>=2){let[Q,X]=Tc0(Z[1]);if(Dn(Q,X))return!0}if($.startsWith("64:ff9b::")&&Z.length>=4){let[Q,X]=Tc0(Z[Z.length-2]);if(Dn(Q,X))return!0}if($.startsWith("::")&&Z.length===2){let[Q,X]=Tc0(Z[0]);if(Dn(Q,X))return!0}return!1}function Vg($){try{let Q=new URL($).hostname.toLowerCase();if(Q==="localhost"||Q==="0.0.0.0"||Q.endsWith(".local")||Q.endsWith(".internal")||Q.endsWith(".localhost"))return!0;let X=Q.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/);if(X){let[,Y,J]=X.map(Number);if(Dn(Y,J))return!0}if(Q.startsWith("[")&&Q.endsWith("]")){let Y=Q.slice(1,-1).toLowerCase();if(Y==="::1"||Y==="::")return!0;if(Y.startsWith("::ffff:"))return!0;if(Y.startsWith("fc")||Y.startsWith("fd"))return!0;if(Y.startsWith("fe80"))return!0;if(Y.startsWith("100:"))return!0;if(Y.startsWith("::1"))return!0;if(Nc1(Y))return!0}return!1}catch{return!0}}function Cu8($){let Z=$.match(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/);if(Z){let[,X,Y]=Z.map(Number);return Dn(X,Y)}let Q=$.toLowerCase();if(Q==="::1"||Q==="::")return!0;if(Q.startsWith("::ffff:"))return!0;if(Q.startsWith("fc")||Q.startsWith("fd"))return!0;if(Q.startsWith("fe80"))return!0;if(Q.startsWith("100:"))return!0;return Nc1(Q)}async function _u8($,Z=async(Q)=>(await Su8(Q,{all:!0})).map((X)=>X.address)){try{let Q=await Z($);return Q.length===0||Q.some(Cu8)}catch{return!0}}async function Ln($){if(Vg($))return"URLs targeting private networks are not allowed";let Q=new URL($).hostname;if(/^\d+\.\d+\.\d+\.\d+$/.test(Q)||Q.startsWith("[")&&Q.endsWith("]"))return null;try{return await vu8(_u8(Q),5000,"DNS resolution timeout")?"URLs targeting private networks are not allowed":null}catch{return"URLs targeting private networks are not allowed"}}function vu8($,Z,Q){let X,Y=new Promise((J,G)=>{X=setTimeout(()=>G(Error(Q)),Z)});return Promise.race([$,Y]).finally(()=>clearTimeout(X))}function Hz($=fetch){return async(Z,Q)=>{let X=await $(Z,{...Q,redirect:"manual"});if(X.status>=300&&X.status<400)throw Error("Refusing to follow a redirect from the remote server");return X}}var wn=()=>{};var Bc1="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";import{webcrypto as Oc1}from"crypto";function xu8($){if(!Fz||Fz.length<$)Fz=Buffer.allocUnsafe($*bu8),Oc1.getRandomValues(Fz),kg=0;else if(kg+$>Fz.length)Oc1.getRandomValues(Fz),kg=0;kg+=$}function pZ0($=21){xu8($|=0);let Z="";for(let Q=kg-$;Q<kg;Q++)Z+=Bc1[Fz[Q]&63];return Z}var bu8=128,Fz,kg;var Rc0=()=>{};function o8($){return`${$}_${pZ0()}`}var oQ=D(()=>{Rc0()});function Lc1($,Z){return{id:_4.SELF(Z),title:"Deco CMS",description:"The MCP for the CMS API",connection_type:"HTTP",connection_url:`${$}/mcp/self`,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:"self"}}}function wc1($,Z){return{id:_4.DEV_ASSETS(Z),title:"Local Files",description:"Local file storage for development. Files are stored in /data/assets/.",connection_type:"HTTP",connection_url:`${$}/mcp/dev-assets`,icon:"https://api.iconify.design/lucide:folder.svg?color=%23888",app_name:"@deco/dev-assets-mcp",app_id:null,connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isFixed:!0,devOnly:!0,type:"dev-assets"}}}function w3($){return{is(Z){if(!Z)return null;if(!Z.startsWith($))return null;return Z.slice($.length)||null},get(Z){return`${$}${Z}`}}}function jc1($){return{id:$.id,organization_id:$.organizationId,title:$.title,description:$.description,icon:$.icon,status:"active",created_at:new Date().toISOString(),updated_at:new Date().toISOString(),created_by:"system",updated_by:void 0,metadata:{instructions:$.instructions??null,...$.ui?{ui:$.ui}:{}},pinned:!1,connections:[]}}function Mc0($){return jc1({id:Nz($),organizationId:$,title:"Super Agent",description:"Default agent that aggregates all organization connections",icon:fu8,ui:{layout:{defaultMainView:{type:"overview"},chatDefaultOpen:!0}}})}function Tc1($){return jc1({id:gu8($),organizationId:$,title:"Brand context setup",description:"Guided onboarding agent that extracts brand context from a website URL.",icon:"https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png",instructions:hu8})}function Mc1($,Z,Q="https://reports.decocms.com/api/v2/mcp"){return{id:_4.REPORTS($),title:"Store Report",description:"Your store's report and diagnostics",connection_type:"HTTP",connection_url:Q,icon:"https://github.com/decocms.png",app_name:"commerce-discovery",app_id:null,connection_token:Z,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!1,type:"commerce-discovery"}}}function Ic1($,Z=_4.REPORTS($)){return{title:"Report Agent",description:"Ask anything about your store's report",icon:"https://github.com/decocms.png",status:"active",pinned:!0,metadata:{type:"commerce-discovery",isDefault:!1,ui:{pinnedViews:[{connectionId:Z,toolName:"get_my_diagnostic",label:"Report",icon:"https://github.com/decocms.png"}],layout:{defaultMainView:{type:"ext-apps",id:Z,toolName:"get_my_diagnostic"},chatDefaultOpen:!0}}},connections:[{connection_id:Z,selected_tools:null,selected_resources:null,selected_prompts:null}]}}function Vc1($){if(!$)return!1;return Object.values(Uz).some((Z)=>Z.is($)!==null)}function kc1($){let Z=Mc0($);return{...Z,id:Z.id,connection_type:"VIRTUAL",connection_url:`virtual://${Z.id}`,app_name:"decopilot",app_id:"decopilot",connection_token:null,connection_headers:null,oauth_config:null,configuration_state:null,configuration_scopes:null,metadata:{isDefault:!0,type:"decopilot"},tools:[],bindings:[]}}var _4,Dc1="https://reports.decocms.com/api/v2/mcp",nZ0="get_my_diagnostic",Ec1,FQ,Nz,zc1,Pc1,qc0,fu8="https://assets.decocache.com/decocms/fd07a578-6b1c-40f1-bc05-88a3b981695d/f7fc4ffa81aec04e37ae670c3cd4936643a7b269.png",yu8="#6366f1",fG5,Ac1,tZ0,gu8,hu8,Rc1,yG5,gG5,qc1,hG5,Sg,Uz,j3,Ic0,uG5;var Sc1=D(()=>{_4={SELF:($)=>`${$}_self`,REGISTRY:($)=>`${$}_registry`,COMMUNITY_REGISTRY:($)=>`${$}_community-registry`,DEV_ASSETS:($)=>`${$}_dev-assets`,SITE_DIAGNOSTICS:($)=>`site-diagnostics_${$}`,REPORTS:($)=>`${$}_commerce-discovery`};Ec1=w3("decopilot_"),FQ=Ec1.is,Nz=Ec1.get,zc1=w3("dev_"),Pc1=zc1.get,qc0=zc1.is,fG5=`https://api.iconify.design/lucide:file-search.svg?color=${encodeURIComponent(yu8)}`;Ac1=w3("brand-context-setup_"),tZ0=Ac1.is,gu8=Ac1.get,hu8=`
80
80
  You are running the brand-context onboarding for the user's organization. Your only job in this thread is to set up the organization's brand context:
81
81
 
82
82
  1. If the user hasn't already given you a website URL, ask for it in one short message. Accept whatever URL they give \u2014 don't quibble about format.
@@ -3361,7 +3361,7 @@ Respond with ONLY a JSON object of this shape, and nothing else:
3361
3361
  ${J.join(`
3362
3362
  `)}`:Y}function mf6($){let Z=new Set;for(let Q of $)for(let X of Q.split(`
3363
3363
  `)){let Y=X.trim();if(/^Co-authored-by:\s/i.test(Y))Z.add(Y)}return[...Z]}var _$8=200,bf6=12,ff6,gf6=300,Qk0=3;var pH1=D(()=>{hZ();D8();Zk0();ff6={aheadBy:0,behindBy:0,files:[]}});function pf6($){if(!$||$.includes(".."))return!1;return if6.test($)}function b$8($){let Z=typeof $.__resolveType==="string"?$.__resolveType:null;if(!Z||!pf6(Z))return null;let{__resolveType:Q,...X}=$;return{resolveType:Z,payload:X}}function x$8($,Z){return`${$.replace(/\/+$/,"")}/deco/invoke/${Z}`}var if6;var f$8=D(()=>{if6=/^[\w./@-]+$/});function T80($,Z){let Q=$?.githubRepo;if(!Q?.owner||!Q?.name)return null;if(!Q.connectionId)return Q;if(!Z.includes(Q.connectionId))return null;return Q}async function g$8($,Z,Q,X){let Y=$.organization?.id;if(!Y)throw new nj(B7);let J=await bw($.storage,Y,X);if(J&&await EB($.storage,J)){let F=await gF($,J,{forceRefresh:!0}).catch((U)=>{throw new nj(U instanceof Error?U.message:B7)});await y$8($,Z,Q,F);return}let G=X.connectionId??J?.legacyConnectionId;if(!G)throw new nj("Push requires a connected git account. Connect the repository's provider for this project and restart the sandbox.");await tl({ctx:$,connectionId:G,organizationId:Y,forceRefresh:!0,onLegacyMintError:(F)=>{let U=F instanceof Error?F.message:B7;throw new nj(U)}});let{cloneUrl:W,gitUserName:K,gitUserEmail:H}=await hF(G,X.owner,X.name,$.db,$.vault).catch((F)=>{let{code:U,message:N}=bF$(F instanceof Error?F.message:String(F));throw U?new nj(N):F});await y$8($,Z,Q,{cloneUrl:W,gitUserName:K,gitUserEmail:H})}async function y$8($,Z,Q,X){let{cloneUrl:Y,gitUserName:J,gitUserEmail:G}=X,W=um($),K=await Z.proxyDaemonRequest(Q,"/_sandbox/config",{method:"PUT",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify({git:{repository:{cloneUrl:Y},identity:{userName:J,userEmail:G}},...W?{operator:W}:{}})});if(!K.ok){let H=await Qj(K,nf6).catch(()=>K.statusText);throw Error(`Failed to refresh sandbox git credentials (${K.status}): ${H}`)}}var nf6=10485760,nj;var nH1=D(()=>{t3();pV0();ee();XW0();ns();hZ();nj=class nj extends Error{constructor($){super($);this.name="GitPushAuthError"}}});function of6($){let Z=$.startsWith("thread:")?$.slice(7):$;if(!Z||Z.length>255||Z.includes("..")||Z.startsWith("/")||Z.endsWith("/")||Z.endsWith(".lock")||!tf6.test(Z))throw Error(`Invalid branch name: ${$}`)}function xf($){return AbortSignal.any([$.req.raw.signal,AbortSignal.timeout(af6)])}async function ef6($,Z){let Q=$.var.studioContext,X=nF(Z.branch),Y=$.req.query("thread")??X,J=Y&&Y===X?Z.branchThread:Y?await Q.storage.threads.get(Y).catch(()=>null):null,G=J?.virtual_mcp_id===Z.virtualMcpId?J:null,W=Gx(G?.metadata?.runtime);if(W)return W;let K=iA0(Z.virtualMcpMetadata),H=K==="cms"?await MH1(Q,{claimName:Z.claimName}):"alive",F=K==="cms"&&H!=="alive"?"cms":"sandbox",U=!!G&&(H==="gone"||H==="alive"&&K==="cms");if(U&&G)$00(Q,G.id,F);if(K==="cms")console.log("sandbox proxy: no runtime stamp",{route:$.req.path,method:$.req.method,reason:G?"unstamped":"threadless",liveness:H,resolved:F,stamped:U});return F}async function $y6($){let Z=$.get("vmClaim");if(Z.runner)return Z.runner;try{return await DY($.var.studioContext)}catch{return null}}function ff($){let{runner:Z}=$.get("vmClaim");if(!Z)return $.json({error:"No sandbox runner configured"},503);return Z}async function im($){let{virtualMcpMetadata:Z,connectionIds:Q}=$.get("vmClaim"),X=$.var.studioContext,Y=T80(Z,Q);if(!Y)throw new y0({provider:"github",status:404,message:"Project has no GitHub repository"});let J=K0(X);return il(X,J.id,Y)}function tH1($,Z){let Q=Z instanceof Error?Z.message:String(Z),X=QH$(Z);if(X!==void 0)return $.json({error:Q},429,{...t5,...X===null?{}:{"Retry-After":String(Math.ceil(X/1000))}});if(Z instanceof l6)return $.json({error:Q},409,t5);let Y=e3(Z);if(Y!==null){let J=Y===404?404:Y===409||Y===422?409:502;return $.json({error:Q},J,t5)}return $.json({error:Q},502,t5)}async function l$8($,Z,Q){let X;try{X=await fetch(Z,Q)}catch{return $.json({error:"Preview unreachable"},502)}let Y;try{Y=await X.text()}catch{return $.json({error:"Preview unreachable"},502)}return new Response(Y,{status:X.status,headers:{"content-type":X.headers.get("content-type")??"application/json"}})}async function c$8($){try{let Z=await im($),Q=await Xk0(Z,$.get("vmClaim").branch);return $.json(Q,200,t5)}catch(Z){return tH1($,Z)}}function R80($,Z){let X=(Gk0.get($)??Promise.resolve()).catch(()=>{}).then(Z),Y=X.catch(()=>{});return Gk0.set($,Y),Y.finally(()=>{if(Gk0.get($)===Y)Gk0.delete($)}),X}async function o7($,Z,Q){if(!Q?.runner&&$.get("vmClaim").runtime==="cms")return $.json({error:"sandbox not found: this session is sandbox-less"},404,t5);let X=Q?.runner??ff($);if(X instanceof Response)return X;let{claimName:Y,userId:J,projectRef:G}=$.get("vmClaim"),W=Q?.method??"POST",K=null,H=new Headers;if(Q?.jsonBody!==void 0)K=Q.jsonBody,H.set("content-type","application/json");else if(Q?.forwardJsonBody)K=await $.req.text(),H.set("content-type","application/json");let F=Q?.signal,U={method:W,headers:H,body:K,...F?{signal:F}:{}},N=async()=>{let B=await X.proxyDaemonRequest(Y,Z,U);if(Q?.map404to410&&B.status===404){try{await B.body?.cancel()}catch{}if(await X.adoptLiveClaim({userId:J,projectRef:G},Y))B=await X.proxyDaemonRequest(Y,Z,U);if(B.status===404){try{await B.body?.cancel()}catch{}return new Response(JSON.stringify({error:"Sandbox handle is gone. The sandbox needs to be re-provisioned."}),{status:410,headers:{"content-type":"application/json",...t5}})}}let O=await B.text(),L=Q?.redactRepoDir?Zy6(O):O,w=B.headers.get("content-type")??"application/json";return new Response(L,{status:B.status,headers:{"content-type":w,...t5}})};try{if(F){let B=N();return B.catch(()=>{}),await Promise.race([B,new Promise((L,w)=>{if(F.aborted)return w(F.reason);F.addEventListener("abort",()=>w(F.reason),{once:!0})})])}return await N()}catch(B){let O=B instanceof Error?B.message:String(B);return $.json({error:`Daemon unreachable: ${O}`},502)}}function Zy6($){try{let Z=JSON.parse($);if(Z&&typeof Z==="object"&&!Array.isArray(Z)&&"repoDir"in Z)return JSON.stringify({...Z,repoDir:null})}catch{}return $}async function Wk0($,Z,Q,X="GET",Y){let J=await $.proxyDaemonRequest(Z,Q,{method:X,headers:new Headers,body:null});if(J.status===404&&Y){try{await J.body?.cancel()}catch{}if(await $.adoptLiveClaim(Y,Z))J=await $.proxyDaemonRequest(Z,Q,{method:X,headers:new Headers,body:null})}if(J.status===404){try{await J.body?.cancel()}catch{}throw Error("SANDBOX_GONE")}let G=await J.text();if(!J.ok){let W=`Daemon error (${J.status})`;try{W=JSON.parse(G).error??W}catch{}throw Error(W)}return JSON.parse(G)}function Qy6($){return d$8.includes($)}var tf6,h$8=524288,rf6=65536,af6=1e4,u$8=2000,sf6,Gk0,t5,d$8,m$8=()=>{let $=new X1;$.use("/:virtualMcpId/:branch/*",sf6),$.post("/:virtualMcpId/:branch/write",(Q)=>o7(Q,"/_sandbox/write",{forwardJsonBody:!0,signal:xf(Q)})),$.post("/:virtualMcpId/:branch/unlink",(Q)=>o7(Q,"/_sandbox/unlink",{forwardJsonBody:!0,signal:xf(Q)})),$.post("/:virtualMcpId/:branch/mkdir",(Q)=>o7(Q,"/_sandbox/mkdir",{forwardJsonBody:!0,signal:xf(Q)})),$.post("/:virtualMcpId/:branch/rename",(Q)=>o7(Q,"/_sandbox/rename",{forwardJsonBody:!0,signal:xf(Q)})),$.post("/:virtualMcpId/:branch/read",(Q)=>o7(Q,"/_sandbox/read",{forwardJsonBody:!0,signal:xf(Q)})),$.post("/:virtualMcpId/:branch/glob",(Q)=>o7(Q,"/_sandbox/glob",{forwardJsonBody:!0,signal:xf(Q)})),$.post("/:virtualMcpId/:branch/grep",(Q)=>o7(Q,"/_sandbox/grep",{forwardJsonBody:!0,signal:xf(Q)})),$.post("/:virtualMcpId/:branch/exec/:script",async(Q)=>{let X=Q.req.param("script");if(!X)return Q.json({error:"missing script name"},400);return o7(Q,`/_sandbox/exec/${encodeURIComponent(X)}`)}),$.post("/:virtualMcpId/:branch/exec/:script/kill",async(Q)=>{let X=Q.req.param("script");if(!X)return Q.json({error:"missing script name"},400);return o7(Q,`/_sandbox/exec/${encodeURIComponent(X)}/kill`)}),$.get("/:virtualMcpId/:branch/config",(Q)=>o7(Q,"/_sandbox/config",{method:"GET",map404to410:!0,redactRepoDir:!0})),$.put("/:virtualMcpId/:branch/config",(Q)=>o7(Q,"/_sandbox/config",{method:"PUT",forwardJsonBody:!0,map404to410:!0})),$.post("/:virtualMcpId/:branch/setup/:step",async(Q)=>{let X=Q.req.param("step");if(!X||!Qy6(X))return Q.json({error:`step must be one of: ${d$8.join(", ")}`},400);let Y=Q.get("vmClaim"),J=await MH1(Q.var.studioContext,{claimName:Y.claimName})==="gone"?null:await $y6(Q);if(!J)return Q.json({error:"sandbox not found: nothing is running at this ref"},404,t5);if(X==="start"){let G=K0(Q.var.studioContext),W=Sc(Y.virtualMcpMetadata);try{await lA0({ctx:Q.var.studioContext,runner:J,handle:Y.claimName,orgId:G.id,userId:Y.callerUserId,entries:W})}catch(K){let H=K instanceof Error?K.message:String(K);return Q.json({error:`Failed to push env to daemon: ${H}`},502)}}return o7(Q,`/_sandbox/setup/${X}`,{signal:Q.req.raw.signal,map404to410:!0,runner:J})}),$.get("/:virtualMcpId/:branch/events",(Q)=>{let X=Q.get("vmClaim");if(!X.runner)return UO(Q,async(Y)=>{await Y.writeSSE({event:"phase",data:JSON.stringify({kind:"failed",reason:"unknown",message:"No sandbox runner configured on this studio instance."})})});return d18(Q,{ctx:Q.var.studioContext,claimName:X.claimName,runner:X.runner,virtualMcpId:X.virtualMcpId,branch:X.branch,userId:X.userId,projectRef:X.projectRef,virtualMcpMetadata:X.virtualMcpMetadata})}),$.get("/:virtualMcpId/:branch/git/status",(Q)=>{if(Q.get("vmClaim").runtime==="cms")return c$8(Q);return Z(Q)});let Z=(Q)=>o7(Q,"/_sandbox/git/status",{method:"GET",map404to410:!0,signal:AbortSignal.any([Q.req.raw.signal,AbortSignal.timeout(u$8)])});return $.post("/:virtualMcpId/:branch/git/status",(Q)=>{if(Q.get("vmClaim").runtime==="cms")return c$8(Q);return o7(Q,"/_sandbox/git/status",{map404to410:!0,signal:AbortSignal.any([Q.req.raw.signal,AbortSignal.timeout(u$8)])})}),$.post("/:virtualMcpId/:branch/git/diff",async(Q)=>{let X=Q.get("vmClaim");if(X.runtime==="cms")try{let Y=await Q.req.json().catch(()=>({})),J=await im(Q),G=await Yk0(J,X.branch,Y.base);return Q.json(G,200,t5)}catch(Y){return tH1(Q,Y)}return o7(Q,"/_sandbox/git/diff",{forwardJsonBody:!0,map404to410:!0})}),$.post("/:virtualMcpId/:branch/git/publish",async(Q)=>{if(Q.get("vmClaim").runtime==="cms")return Q.json({ok:!0},200,t5);let X=ff(Q);if(X instanceof Response)return X;let{claimName:Y,virtualMcpMetadata:J,connectionIds:G}=Q.get("vmClaim"),W=Q.var.studioContext;return R80(Y,async()=>{try{await IH1(W,X,Y);let K=T80(J,G);if(K)await g$8(W,X,Y,K)}catch(K){if(K instanceof nj)return Q.json({error:K.message},403,t5);let H=K instanceof Error?K.message:String(K);return Q.json({error:H},502,t5)}return o7(Q,"/_sandbox/git/publish",{forwardJsonBody:!0,map404to410:!0})})}),$.post("/:virtualMcpId/:branch/git/discard",async(Q)=>{let X=Q.get("vmClaim");if(X.runtime==="cms")return R80(X.claimName,async()=>{let Y=await Q.req.json().catch(()=>({})),J=Array.isArray(Y.filepaths)?Y.filepaths.filter((G)=>typeof G==="string"):[];if(J.length===0)return Q.json({error:"filepaths is required"},400,t5);try{let G=await im(Q);return await v$8(G,X.branch,J),Q.json({ok:!0},200,t5)}catch(G){let W=e3(G)===409||G instanceof l6?409:502,K=G instanceof Error?G.message:String(G);return Q.json({error:K},W,t5)}});return R80(X.claimName,()=>o7(Q,"/_sandbox/git/discard",{forwardJsonBody:!0,map404to410:!0}))}),$.post("/:virtualMcpId/:branch/git/rebase",async(Q)=>{let X=Q.get("vmClaim");if(X.runtime==="cms")return R80(X.claimName,async()=>{try{let W=await Q.req.json().catch(()=>({})),K=await im(Q),H=W.base??await K.getDefaultBranch();return await Jk0(K,X.branch,H),Q.json({ok:!0},200,t5)}catch(W){return tH1(Q,W)}});let Y=ff(Q);if(Y instanceof Response)return Y;let{claimName:J}=Q.get("vmClaim"),G=Q.var.studioContext;return R80(J,async()=>{try{await IH1(G,Y,J)}catch(W){let K=W instanceof Error?W.message:String(W);return Q.json({error:K},502,t5)}return o7(Q,"/_sandbox/git/rebase",{forwardJsonBody:!0,map404to410:!0})})}),$.post("/:virtualMcpId/:branch/git/suggest-commit",H9({maxSize:h$8,onError:(Q)=>Q.json({error:"Payload too large"},413,t5)}),async(Q)=>{let X=Q.get("vmClaim"),Y=null;if(X.runtime!=="cms"){let H=ff(Q);if(H instanceof Response)return H;Y=H}let{claimName:J,userId:G,projectRef:W}=X,K=Q.var.studioContext;try{let H=await Q.req.json().catch(()=>({})),F=H.status,U=H.diff,N=U!=null&&typeof U.diffs==="object"&&U.diffs!==null,[B,O]=SH1(F)&&N?[F,U]:Y?await Promise.all([Wk0(Y,J,"/_sandbox/git/status","GET",{userId:G,projectRef:W}),Wk0(Y,J,"/_sandbox/git/diff","GET",{userId:G,projectRef:W})]):await(async()=>{let w=await im(Q);return Promise.all([Xk0(w,X.branch),Yk0(w,X.branch)])})();await IK(K,K0(K).id,"suggesting a commit message");let L=await t18(K,B,O);return Q.json(L,200,t5)}catch(H){let F=H instanceof Error?H.message:String(H);if(F==="SANDBOX_GONE")return Q.json({error:"Sandbox handle is gone. The sandbox needs to be re-provisioned."},410,t5);return Q.json({error:F},502,t5)}}),$.post("/:virtualMcpId/:branch/git/judge-review",H9({maxSize:h$8,onError:(Q)=>Q.json({error:"Payload too large"},413,t5)}),async(Q)=>{let X=Q.get("vmClaim"),Y=null;if(X.runtime!=="cms"){let H=ff(Q);if(H instanceof Response)return H;Y=H}let{claimName:J,userId:G,projectRef:W}=X,K=Q.var.studioContext;try{let H=await Q.req.json().catch(()=>({})),F=H.status,U=H.diff,N=U!=null&&typeof U.diffs==="object"&&U.diffs!==null,[B,O]=SH1(F)&&N?[F,U]:Y?await Promise.all([Wk0(Y,J,"/_sandbox/git/status","GET",{userId:G,projectRef:W}),Wk0(Y,J,"/_sandbox/git/diff","GET",{userId:G,projectRef:W})]):await(async()=>{let w=await im(Q);return Promise.all([Xk0(w,X.branch),Yk0(w,X.branch)])})();await IK(K,K0(K).id,"judging whether a change needs review");let L=await r18(K,B,O,typeof H.language==="string"?H.language:void 0);return Q.json(L,200,t5)}catch(H){let F=H instanceof Error?H.message:String(H);if(F==="SANDBOX_GONE")return Q.json({error:"Sandbox handle is gone. The sandbox needs to be re-provisioned."},410,t5);return Q.json({error:F},502,t5)}}),$.get("/:virtualMcpId/:branch/preview-fetch",async(Q)=>{let X=ff(Q);if(X instanceof Response)return X;let{claimName:Y}=Q.get("vmClaim"),J=Q.req.query("path");if(!J||!J.startsWith("/")||J.startsWith("//")||J.includes("..")||J.includes("\\"))return Q.json({error:"Path not allowed"},403);let G;try{G=await X.getPreviewUrl(Y)}catch{return Q.json({error:"Preview not available"},502)}if(!G)return Q.json({error:"Preview not available"},502);let W=G.replace(/\/+$/,"");return l$8(Q,`${W}${J}`)}),$.post("/:virtualMcpId/:branch/preview-invoke",H9({maxSize:rf6,onError:(Q)=>Q.json({error:"Payload too large"},413)}),async(Q)=>{let X=ff(Q);if(X instanceof Response)return X;let{claimName:Y}=Q.get("vmClaim"),J;try{J=await X.getPreviewUrl(Y)}catch{return Q.json({error:"Preview not available"},502)}if(!J)return Q.json({error:"Preview not available"},502);let G;try{G=await Q.req.json()}catch{return Q.json({error:"Invalid JSON body"},400)}if(!G||typeof G!=="object"||Array.isArray(G))return Q.json({error:"Invalid JSON body"},400);let W=b$8(G);if(!W)return Q.json({error:"Invalid or missing __resolveType"},400);let K=x$8(J,W.resolveType);return l$8(Q,K,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(W.payload),signal:AbortSignal.timeout(30000)})}),$};var i$8=D(()=>{X8();FH();hm();qH1();oe();u18();YW();Cc();l18();dK();TF();c18();m18();O61();ae();vH1();a18();hZ();U5();pH1();f$8();nH1();tf6=/^[a-zA-Z0-9][a-zA-Z0-9/._-]*$/;sf6=iV0(async($,Z)=>{let Q=$.var.studioContext;try{Z0(Q)}catch{return $.json({error:"Unauthorized"},401)}let X=i0(Q);if(!X)return $.json({error:"Unauthorized"},401);let Y;try{Y=K0(Q)}catch{return $.json({error:"Organization scope required"},403)}let J=$.req.param("virtualMcpId"),G=$.req.param("branch");if(!J||!G)return $.json({error:"virtualMcpId and branch are required"},400);try{of6(G)}catch(L){let w=L instanceof Error?L.message:String(L);return $.json({error:w},400)}let W=await Q.storage.virtualMcps.findById(J);if(!W||W.organization_id!==Y.id)return $.json({error:"Virtual MCP not found"},404);let K=je({orgId:Y.id,virtualMcpId:J,branch:G}),H=await h81(Q,G),F=u81(H,X),U=h18({userId:F,projectRef:K}),N=W.metadata??null,B=await ef6($,{claimName:U,branch:G,virtualMcpId:J,sandboxUserId:F,virtualMcpMetadata:N,branchThread:H});if(B==="cms")return $.set("vmClaim",{claimName:U,callerUserId:X,runner:null,virtualMcpId:J,branch:G,userId:F,projectRef:K,virtualMcpMetadata:N,connectionIds:W.connections?.map((L)=>L.connection_id)??[],runtime:B}),Z();let O;try{O=await DY(Q)}catch{O=null}if(!O)return $.json({error:"No sandbox runner found"},404);return $.set("vmClaim",{claimName:U,callerUserId:X,runner:O,virtualMcpId:J,branch:G,userId:F,projectRef:K,virtualMcpMetadata:N,connectionIds:W.connections?.map((L)=>L.connection_id)??[],runtime:B}),Z()});Gk0=new Map;t5={"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache"};d$8=["clone","install","start"]});function p$8($,Z,Q){let X=oH1.get($);if(!X)X={pending:null,running:!1},oH1.set($,X);if(!X.pending)X.pending={set:new Map,del:new Set,deps:Z,resolvers:[],rejecters:[]};let Y=X.pending;Y.deps=Z;for(let[G,W]of Object.entries(Q.set??{}))Y.set.set(G,W),Y.del.delete(G);for(let G of Q.delete??[])Y.del.add(G),Y.set.delete(G);let J=new Promise((G,W)=>{Y.resolvers.push(G),Y.rejecters.push(W)});if(!X.running)Yy6($,X);return J}async function Yy6($,Z){Z.running=!0;try{while(Z.pending){let Q=Z.pending;Z.pending=null;try{let X=await Jy6(Q);for(let Y of Q.resolvers)Y(X)}catch(X){for(let Y of Q.rejecters)Y(X)}}}finally{if(Z.running=!1,!Z.pending)oH1.delete($)}}async function Jy6($){let{client:Z,branch:Q,packagePath:X}=$.deps,Y=new Map;for(let J=0;;J++){let G=await mm(Z,Q),W=await Z.listDecofileEntries(G,X),K=dH1(W,X),H=[],F=new Map(K.map((N)=>[N.path,{stem:N.stem,sha:N.sha}]));for(let[N,B]of $.set){let O=mH1(K,N),L=`${JSON.stringify(B,null,2)}
3364
- `;await V$8(Z.repo,L);let w=O[0]??`${$k0(X)}/${fH1(N)}.json`;H.push({path:w,content:L});let j=w.slice(w.lastIndexOf("/")+1,-5);F.set(w,{stem:j,content:L});for(let E of O.slice(1))H.push({path:E,deleted:!0}),F.delete(E)}for(let N of $.del)for(let B of mH1(K,N))H.push({path:B,deleted:!0}),F.delete(B);if(H.length===0)return G;let U=X?`${X}/.deco/blocks.gen.json`:".deco/blocks.gen.json";if(W.some((N)=>N.type==="blob"&&N.path===U)){let N=await k$8(Z,F.values(),Y),{decofile:B,skipped:O}=j80(N);if(O.length>0)console.warn("decofile gen: dropped blocks that were not valid JSON",{repo:kK(Z.repo),branch:Q,packagePath:X,blocks:O.map((L)=>L.key)});H.push({path:U,content:B})}try{let{sha:N}=await Z.commitFiles({branch:Q,message:Gy6($),expectedHead:G,changes:H});return N}catch(N){if(!(N instanceof l6)||J>=Xy6-1)throw N;await c$(a7(2000,200,J,2,0.5))}}}function Gy6($){let Z=(Y)=>{let J=Y.slice(0,3).join(", ");return Y.length>3?`${J} (+${Y.length-3} more)`:J},Q=[];if($.set.size>0)Q.push(`update ${Z([...$.set.keys()])}`);if($.del.size>0)Q.push(`delete ${Z([...$.del])}`);let X=`chore(decofile): ${Q.join("; ")}`;return N81(X,$.deps.coAuthor)}var Xy6=3,oH1;var n$8=D(()=>{SP0();tV0();w6();D8();hZ();Zk0();oH1=new Map});import{createHmac as t$8,randomBytes as Wy6,timingSafeEqual as Ky6}from"crypto";function o$8(){if(Kk0)return Kk0;let $;try{let Z=E0();$=Z.studioJwtSecret??Z.betterAuthSecret}catch{$=void 0}return Kk0=$?Buffer.from($):Wy6(32),Kk0}function rH1($){let Z=$.nowMs??Date.now(),Q={o:$.organizationId,m:$.virtualMcpId,b:$.branch,e:Math.floor((Z+Hy6)/1000)},X=Buffer.from(JSON.stringify(Q)).toString("base64url"),Y=t$8("sha256",o$8()).update(X).digest("base64url");return`${X}.${Y}`}function r$8($,Z){let Q=$.indexOf(".");if(Q<0)return!1;let X=$.slice(0,Q),Y=Buffer.from($.slice(Q+1)),J=Buffer.from(t$8("sha256",o$8()).update(X).digest("base64url"));if(Y.length!==J.length||!Ky6(Y,J))return!1;let G;try{G=JSON.parse(Buffer.from(X,"base64url").toString())}catch{return!1}let W=Math.floor((Z.nowMs??Date.now())/1000);return G.o===Z.organizationId&&G.m===Z.virtualMcpId&&G.b===Z.branch&&typeof G.e==="number"&&G.e>=W}var Hy6=21600000,Kk0=null;var a$8=D(()=>{U$()});import{z as pm}from"zod";function Uy6($){return $.length>0&&$.length<=255&&!$.includes("..")&&!$.endsWith("/")&&!$.endsWith(".lock")&&Fy6.test($)}function Q88($){return $.req.header("x-forwarded-host")??new URL($.req.url).host}async function q80($){let Z=$.get("decofileScope");return il($.var.studioContext,Z.organizationId,Z.githubRepo)}function M80($,Z){let Q=Z instanceof Error?Z.message:String(Z);if(Z instanceof l6)return $.json({error:Q},409);let X=e3(Z);if(X!==null){let Y=X===404?404:X===409||X===422?409:502;return $.json({error:Q},Y)}return $.json({error:Q},500)}function X88(){let $=new X1;return $.use("/:virtualMcpId/:branch",Z88),$.use("/:virtualMcpId/:branch/*",Z88),$.get("/:virtualMcpId/:branch",async(Z)=>{let Q=Z.get("decofileScope");try{let X=await q80(Z),Y=await S$8(X,Q.branch,Q.packagePath,{createBranchIfMissing:!!Q.userId}),J={ETag:`"${Y.sha}"`,"Cache-Control":"no-store","Access-Control-Allow-Origin":"*"};if(Z.req.header("if-none-match")===`"${Y.sha}"`)return Z.body(null,304,J);if(!Q.userId)return Z.body(Y.decofile,200,{...J,"content-type":"application/json"});let G=rH1({organizationId:Q.organizationId,virtualMcpId:Q.virtualMcpId,branch:Q.branch});return Z.body(`{"version":${JSON.stringify(Y.sha)},"token":${JSON.stringify(G)},"apiHost":${JSON.stringify(Q88(Z))},"decofile":${Y.decofile}}`,200,{...J,"content-type":"application/json"})}catch(X){return M80(Z,X)}}),$.get("/:virtualMcpId/:branch/meta",async(Z)=>{let Q=Z.get("decofileScope"),X=Q.packagePath?`${Q.packagePath}/.deco/meta.gen.json`:".deco/meta.gen.json";try{let Y=await q80(Z),J=await Y.readFileAtRef(Q.branch,X);if(J===null){let G=await Y.getDefaultBranch();if(G!==Q.branch)J=await Y.readFileAtRef(G,X)}if(J===null)return Z.json({error:"meta.gen.json not committed"},404);return Z.body(J,200,{"content-type":"application/json","Cache-Control":"no-store","Access-Control-Allow-Origin":"*"})}catch(Y){return M80(Z,Y)}}),$.patch("/:virtualMcpId/:branch",By6,async(Z)=>{let Q=Z.get("decofileScope"),X=Z.var.studioContext,Y=Oy6.safeParse(await Z.req.json().catch(()=>null));if(!Y.success)return Z.json({error:"Invalid body",details:Y.error.issues},400);let J=Y.data;for(let G of[...Object.keys(J.set??{}),...J.delete??[]])try{nV0(G)}catch(W){let K=W instanceof Error?W.message:String(W);return Z.json({error:K},400)}for(let[G,W]of Object.entries(J.set??{})){if(typeof W!=="object"||W===null||Array.isArray(W))return Z.json({error:`Block "${G}" must be a JSON object`},400);if(xH1(G))return Z.json({error:`Block key "${G}" collides with a framework resolver module and cannot be written`},400)}try{let G=await q80(Z),W=await p$8(`${Q.organizationId}/${Q.virtualMcpId}/${Q.branch}`,{client:G,branch:Q.branch,packagePath:Q.packagePath,coAuthor:um(X)},J),K=rH1({organizationId:Q.organizationId,virtualMcpId:Q.virtualMcpId,branch:Q.branch});return Z.json({version:W,token:K,apiHost:Q88(Z)})}catch(G){return M80(Z,G)}}),$.post("/:virtualMcpId/:branch/publish",async(Z)=>{let Q=Z.get("decofileScope");try{let X=await q80(Z),Y=await X.getDefaultBranch();if(Y===Q.branch)return Z.json({error:"Branch is already the default branch"},400);let J=`chore(decofile): publish ${Q.branch}`;try{let G;try{G=await X.mergeBranches(Y,Q.branch,J)}catch(W){if(e3(W)!==409)throw W;await Jk0(X,Q.branch,Y),G=await X.mergeBranches(Y,Q.branch,J)}return G?Z.json({result:"merged",sha:G}):Z.json({result:"up-to-date"})}catch(G){if(e3(G)===409)return Z.json({error:"merge-conflict"},409);if(e3(G)===405){let K=await X.findOpenChangeRequest(Y,Q.branch)??await X.createChangeRequest({base:Y,head:Q.branch,title:`Publish ${Q.branch}`});return Z.json({result:"pull-request",number:K.number,url:K.url})}throw G}}catch(X){return M80(Z,X)}}),$.get("/:virtualMcpId/:branch/status",async(Z)=>{let Q=Z.get("decofileScope");try{let X=await q80(Z),Y=await X.getDefaultBranch();if(Y===Q.branch)return Z.json({baseBranch:Y,aheadBy:0,behindBy:0,lastCommitAt:null});try{let[{aheadBy:J,behindBy:G},W]=await Promise.all([X.compare(Y,Q.branch),X.getBranch(Q.branch)]);return Z.json({baseBranch:Y,aheadBy:J,behindBy:G,lastCommitAt:W?.committedAt??null})}catch(J){if(e3(J)===404)return Z.json({baseBranch:Y,aheadBy:0,behindBy:0,lastCommitAt:null});throw J}}catch(X){return M80(Z,X)}}),$}var Fy6,s$8=500,e$8=1048576,$88=1024,Ny6=8388608,By6,Oy6,Z88;var Y88=D(()=>{D61();tV0();X8();FH();qH1();pV0();nH1();hZ();n$8();a$8();pH1();Zk0();TF();Fy6=/^[a-zA-Z0-9][a-zA-Z0-9/._-]*$/;By6=H9({maxSize:Ny6,onError:($)=>$.json({error:"Payload too large"},413)}),Oy6=pm.object({set:pm.record(pm.string(),pm.unknown()).optional(),delete:pm.array(pm.string()).optional()}).refine(($)=>Object.keys($.set??{}).length>0||($.delete?.length??0)>0,{message:"Patch must set or delete at least one block"}).refine(($)=>Object.keys($.set??{}).length+($.delete?.length??0)<=s$8,{message:`Patch cannot touch more than ${s$8} blocks`}).refine(($)=>Object.values($.set??{}).every((Z)=>JSON.stringify(Z).length<=e$8),{message:`Each block must be at most ${e$8} bytes`}).refine(($)=>[...Object.keys($.set??{}),...$.delete??[]].every((Z)=>Z.length<=$88),{message:`Each block key must be at most ${$88} characters`}),Z88=iV0(async($,Z)=>{let Q=$.var.studioContext,X=Q.organization;if(!X)return $.json({error:"Organization scope required"},500);let Y=$.req.param("virtualMcpId"),J=$.req.param("branch");if(!Y||!J)return $.json({error:"virtualMcpId and branch are required"},400);if(!Uy6(J))return $.json({error:`Invalid branch name: ${J}`},400);let G=Q.auth?.user?.id??null;if(!G){let B=$.req.query("token");if(!($.req.method==="GET"&&!$.req.path.match(/\/(publish|status)$/)))return $.json({error:"Unauthorized"},401);if(!B||!r$8(B,{organizationId:X.id,virtualMcpId:Y,branch:J}))return $.json({error:"Unauthorized"},401)}if(!await d3(Q,X.id,"cms"))return $.json({error:"This organization's plan does not include the CMS",code:"feature_not_in_plan"},403);let W=await Q.storage.virtualMcps.findById(Y);if(!W||W.organization_id!==X.id)return $.json({error:"Virtual MCP not found"},404);let K=W.metadata??null;if(!mA0(K))return $.json({error:"Project has no preview server configured"},404);let F=W.connections?.map((B)=>B.connection_id)??[],U=T80(K,F);if(!U)return $.json({error:"Project has no GitHub repository"},404);let N=K?.runtime;return $.set("decofileScope",{organizationId:X.id,virtualMcpId:Y,branch:J,packagePath:N?.path?.replace(/^\/+|\/+$/g,"")||null,githubRepo:U,userId:G}),Z()})});var J88=($)=>{let Z=new X1;if(Z.use("*",wm),Z.use("*",xa$),Z.route("/",$V0()),Z.route("/",ws$()),Z.route("/",Xs$()),Z.route("/",M18()),Z.route("/",j18()),Z.route("/",R18()),Z.route("/",z18()),Z.route("/",cV0()),Z.route("/tools",v18()),Z.route("/",S18()),Z.route("/",r08({kvStorage:$.kvStorage})),Z.route("/",t08()),Z.route("/fs",H18({getConnection:$.getNatsConnection})),Z.route("/sandbox",m$8()),Z.route("/decofile",X88()),Z.route("/",D18()),Z.route("/",U18()),Z.route("/deco-sites",QV0()),Z.route("/hosting",pa$()),Z.route("/monitor",ea$()),Z.route("/sso",oI0()),Z.route("/",dV0({tokenStorage:$.tokenStorage,automationEventDispatcher:$.automationEventDispatcher})),Z.route("/webhooks",la$()),$.mountDevAssets)Z.route("/dev-assets",GV0({orgFromPath:!0}));return Z.use("/mcp/:connectionId?",$.mcpAuth),Z.use("/mcp/:connectionId/ui-resource",$.mcpAuth),Z.use("/mcp/gateway/:virtualMcpId?",$.mcpAuth),Z.use("/mcp/virtual-mcp/:virtualMcpId?",$.mcpAuth),Z.use("/mcp/self",$.mcpAuth),Z.use("/mcp/task-run/:threadId",$.mcpAuth),Z.route("/",it$()),Z.get("/mcp/:gateway?/:connectionId/.well-known/oauth-protected-resource/*",$.betterAuthProtectedResourceHandler),Z.get("/mcp/.well-known/oauth-protected-resource",$.betterAuthProtectedResourceHandler),Z.route("/mcp/task-run",B18()),Z.route("/mcp",a20()),Z.route("/mcp/self",gV0()),Z.route("/mcp",$R0()),Z.all("/oauth-proxy/:connectionId/*",$.oauthProxyHandler),Z.get("/watch",$.watchHandler),Z};var G88=D(()=>{X8();fa$();gI0();ca$();pW1();na$();$s$();WV0();Tf();lW1();aW1();o08();a08();F18();N18();H10();xW1();ZR0();LH1();O18();L18();E18();P18();EH1();I18();C18();zH1();b18();PH1();s20();i$8();Y88()});function Dy6($){return $.filter((Z)=>Z.vendors?.alias).map((Z)=>({name:Z.name,title:Z.title,description:Z.description,logo:Z.logo,category:Z.category,vendor:{alias:Z.vendors.alias,url:Z.vendors.url}}))}var Ly6=async($,Z)=>{if(!$.get("studioContext").auth.user?.id)return $.json({error:"Unauthorized"},401);return Z()},W88=()=>{let $=new X1;return $.use("*",Ly6),$.get("/",async(Z)=>{let Q=E0(),X=Q.decoSupabaseUrl,Y=Q.decoSupabaseServiceKey;if(!X||!Y)return Z.json({apps:[]});try{let J=await _J(X,Y,"apps?select=name,title,description,logo,category,vendors(alias,url)");return Z.json({apps:Dy6(J)})}catch(J){return console.error("[deco-apps] GET error:",J),Z.json({error:"Failed to fetch apps"},502)}}),$};var K88=D(()=>{X8();U$();nM0()});import{z as b1}from"zod";function VU($,Z="invalid_request_error",Q=null,X=null){return{error:{message:$,type:Z,param:Q,code:X}}}function My6($){if(!$)return null;let Z=$.indexOf(":");if(Z===-1)return{credentialId:null,modelId:$};let Q=$.substring(0,Z),X=$.substring(Z+1);if(!Q||!X)return null;return{credentialId:Q,modelId:X}}function Iy6($,Z,Q){try{return JSON.parse($)}catch{throw new U88(`Invalid JSON in tool call arguments for function '${Q}' (tool_call_id: ${Z}): ${$}`)}}function Vy6($){let Z={};for(let Q of $)if(Q.role==="assistant"&&Q.tool_calls)for(let X of Q.tool_calls)Z[X.id]=X.function.name;return $.map((Q)=>{switch(Q.role){case"system":return{role:"system",content:Q.content};case"user":if(typeof Q.content==="string")return{role:"user",content:Q.content};return{role:"user",content:Q.content.map((Y)=>{if(Y.type==="text")return{type:"text",text:Y.text};return{type:"image",image:Y.image_url.url}})};case"assistant":if(Q.tool_calls&&Q.tool_calls.length>0)return{role:"assistant",content:Q.tool_calls.map((Y)=>({type:"tool-call",toolCallId:Y.id,toolName:Y.function.name,input:Iy6(Y.function.arguments,Y.id,Y.function.name)}))};return{role:"assistant",content:Q.content??""};case"tool":let X=Z[Q.tool_call_id]??"unknown";return{role:"tool",content:[{type:"tool-result",toolCallId:Q.tool_call_id,toolName:X,output:{type:"text",value:Q.content}}]}}})}function ky6($){let Z=$.map((Q)=>{let X=Q.function.parameters?WF(Q.function.parameters):WF({type:"object",properties:{}});return[Q.function.name,u$({description:Q.function.description,inputSchema:X})]});return Object.fromEntries(Z)}function Sy6($){if(!$)return;return{openai:{response_format:$}}}function Cy6(){return`chatcmpl-${crypto.randomUUID().replace(/-/g,"").substring(0,29)}`}function H88($,Z,Q,X,Y,J){let G={model:$,instructions:Z.filter((W)=>W.role==="system"),messages:Z.filter((W)=>W.role!=="system"),tools:Q,temperature:X.temperature,maxOutputTokens:X.max_tokens,topP:X.top_p,frequencyPenalty:X.frequency_penalty,presencePenalty:X.presence_penalty,stopSequences:X.stop?Array.isArray(X.stop)?X.stop:[X.stop]:void 0,abortSignal:J};return Y?{...G,providerOptions:Y}:G}function F88($){if($==="tool-calls")return"tool_calls";if($==="length")return"length";return"stop"}var wy6=256,jy6,Ey6,zy6,Py6,Ay6,Ty6,Ry6,qy6,U88,N88,B88;var O88=D(()=>{$6();X8();hm();sK();jy6=b1.object({type:b1.literal("function"),function:b1.object({name:b1.string(),description:b1.string().optional(),parameters:b1.record(b1.string(),b1.unknown()).optional()})}),Ey6=b1.object({id:b1.string(),type:b1.literal("function"),function:b1.object({name:b1.string(),arguments:b1.string()})}),zy6=b1.discriminatedUnion("role",[b1.object({role:b1.literal("system"),content:b1.string(),name:b1.string().optional()}),b1.object({role:b1.literal("user"),content:b1.union([b1.string(),b1.array(b1.union([b1.object({type:b1.literal("text"),text:b1.string()}),b1.object({type:b1.literal("image_url"),image_url:b1.object({url:b1.string(),detail:b1.string().optional()})})]))]),name:b1.string().optional()}),b1.object({role:b1.literal("assistant"),content:b1.string().nullable().optional(),name:b1.string().optional(),tool_calls:b1.array(Ey6).optional()}),b1.object({role:b1.literal("tool"),content:b1.string(),tool_call_id:b1.string()})]),Py6=b1.object({type:b1.literal("text")}),Ay6=b1.object({type:b1.literal("json_object")}),Ty6=b1.object({type:b1.literal("json_schema"),json_schema:b1.object({name:b1.string(),description:b1.string().optional(),schema:b1.record(b1.string(),b1.unknown()),strict:b1.boolean().optional()})}),Ry6=b1.union([Py6,Ay6,Ty6]),qy6=b1.object({model:b1.string().describe("Format: 'model_id' or 'credential_id:model_id'"),messages:b1.array(zy6),stream:b1.boolean().optional().default(!1),temperature:b1.number().min(0).max(2).optional(),max_tokens:b1.number().positive().optional(),top_p:b1.number().min(0).max(1).optional(),frequency_penalty:b1.number().min(-2).max(2).optional(),presence_penalty:b1.number().min(-2).max(2).optional(),stop:b1.union([b1.string(),b1.array(b1.string())]).optional(),tools:b1.array(jy6).optional(),tool_choice:b1.union([b1.literal("auto"),b1.literal("none"),b1.literal("required"),b1.object({type:b1.literal("function"),function:b1.object({name:b1.string()})})]).optional(),response_format:Ry6.optional(),user:b1.string().optional()});U88=class U88 extends Error{constructor($){super($);this.name="MessageConversionError"}};N88=new X1;N88.post("/:org/v1/chat/completions",async($)=>{let Z=$.get("studioContext"),Q=$.req.param("org");try{if(!Z.auth.apiKey?.id)return $.json(VU("API key authentication required. Provide a valid API key via Authorization header.","authentication_error"),401);if(!Z.organization)return $.json(VU("Organization context is required. Ensure your API key has organization metadata.","invalid_request_error","organization"),400);if((Z.organization.slug??Z.organization.id)!==Q)return $.json(VU("Organization mismatch. The API key's organization does not match the requested organization.","invalid_request_error","organization"),403);let X=await $.req.json(),Y=qy6.safeParse(X);if(!Y.success){let w=Y.error.issues[0]??{message:"Invalid request",path:[]};return $.json(VU(`Invalid request: ${w.message}`,"invalid_request_error",w.path.length>0?w.path.join("."):null),400)}let J=Y.data,G=My6(J.model);if(!G)return $.json(VU("Invalid model format. Expected 'model_id' or 'credential_id:model_id' (e.g., 'claude-sonnet-4-6' or 'key_abc123:claude-sonnet-4-6')","invalid_request_error","model"),400);let{credentialId:W}=G,{modelId:K}=G;if(!W){let j=(await Z.storage.aiProviderKeys.list({organizationId:Z.organization.id})).find((E)=>Kz(E.providerId));if(!j)return $.json(VU("No AI provider credentials configured for this organization. Add a credential in settings or specify one explicitly via 'credential_id:model_id'.","invalid_request_error","model"),400);W=j.id}let H;try{H=await Z.aiProviders.activate(W,Z.organization.id)}catch{return $.json(VU(`AI provider credential not found or inaccessible: ${W}`,"invalid_request_error","model"),404)}let F=H.aiSdk.languageModel(K),U=Vy6(J.messages),N=J.tools?ky6(J.tools):void 0,B=Sy6(J.response_format),O=Cy6(),L=Math.floor(Date.now()/1000);if(J.stream)return UO($,async(w)=>{let j=H88(F,U,N,J,B,$.req.raw.signal);try{let E=Vc(j),z=!1,T=0,P="",A=async()=>{if(P.length===0)return;let q=P;P="",await w.writeSSE({data:JSON.stringify({id:O,object:"chat.completion.chunk",created:L,model:J.model,choices:[{index:0,delta:{content:q},finish_reason:null}]})})};for await(let q of E.stream){if(!z&&(q.type==="text-delta"||q.type==="tool-call"))await w.writeSSE({data:JSON.stringify({id:O,object:"chat.completion.chunk",created:L,model:J.model,choices:[{index:0,delta:{role:"assistant",content:""},finish_reason:null}]})}),z=!0;if(q.type==="text-delta"){if(P+=q.text,P.length>=wy6)await A()}else if(q.type==="tool-call"){await A();let x=T++;await w.writeSSE({data:JSON.stringify({id:O,object:"chat.completion.chunk",created:L,model:J.model,choices:[{index:0,delta:{tool_calls:[{index:x,id:q.toolCallId,type:"function",function:{name:q.toolName,arguments:JSON.stringify(q.input)}}]},finish_reason:null}]})})}else if(q.type==="finish")await A(),await w.writeSSE({data:JSON.stringify({id:O,object:"chat.completion.chunk",created:L,model:J.model,choices:[{index:0,delta:{},finish_reason:F88(q.finishReason)}],usage:q.totalUsage?{prompt_tokens:q.totalUsage.inputTokens??0,completion_tokens:q.totalUsage.outputTokens??0,total_tokens:q.totalUsage.totalTokens??0}:void 0})})}await A(),await w.writeSSE({data:"[DONE]"})}catch(E){let z=E;console.error("[openai-compat:stream] Error:",z.message),await w.writeSSE({data:JSON.stringify({error:{message:z.message,type:"server_error"}})})}});else{let w=H88(F,U,N,J,B,$.req.raw.signal),j=await Ic(w),E={role:"assistant",content:j.text||null};if(j.toolCalls&&j.toolCalls.length>0)E.tool_calls=j.toolCalls.map((z)=>({id:z.toolCallId,type:"function",function:{name:z.toolName,arguments:JSON.stringify("input"in z?z.input:{})}})),E.content=null;return $.json({id:O,object:"chat.completion",created:L,model:J.model,choices:[{index:0,message:E,finish_reason:F88(j.finishReason)}],usage:{prompt_tokens:j.usage?.inputTokens??0,completion_tokens:j.usage?.outputTokens??0,total_tokens:j.usage?.totalTokens??0}})}}catch(X){let Y=X;if(Y.name==="AbortError")return $.json(VU("Request aborted","invalid_request_error"),400);if(Y.name==="MessageConversionError")return $.json(VU(Y.message,"invalid_request_error","messages"),400);return console.error("[openai-compat] Error:",Y.message,Y.stack),$.json(VU(Y.message,"server_error"),500)}});B88=N88});function _y6($){if(typeof $!=="object"||$===null)return!1;let Q=$.githubRepo?.url;return typeof Q==="string"&&Q.length>0}function D88(){let $=new X1;return $.use("*",async(Z,Q)=>{await Q(),Z.header("Cache-Control","private, no-store"),Z.header("Vary","Cookie")}),$.get("/",async(Z)=>{let Q=Z.get("studioContext"),X=i0(Q);if(!X)return Z.json({error:"Authentication required"},401);let J=(Z.req.query("site")??"").trim().toLowerCase();if(!N7(J))return Z.json({error:"Invalid site slug"},400);let G=await Q.db.selectFrom("member").innerJoin("organization","organization.id","member.organizationId").select(["organization.id as id","organization.slug as slug","organization.name as name","organization.metadata as metadata"]).where("member.userId","=",X).execute(),W=[];for(let H of G){if(!H.slug||w9(H))continue;let F=await Q.storage.virtualMcps.list(H.id);for(let U of F){if(D30(U)!==J)continue;if(!_y6(U.metadata))continue;W.push({orgSlug:H.slug,orgName:H.name??H.slug,project:{id:U.id,title:U.title,icon:U.icon??null}})}}let K={matches:W};return Z.json(K)}),$}var L88=D(()=>{X8();o3()});var j88;var w88=D(()=>{j88={name:"decocms",version:"4.387.4",description:"Deco CMS \u2014 Self-hostable MCP Gateway for managing AI connections and tools",author:"Deco team",repository:{type:"git",url:"git+https://github.com/decocms/studio.git",directory:"apps/api"},bugs:{url:"https://github.com/decocms/studio/issues"},type:"module",bin:{deco:"./dist/server/cli.js"},files:["dist/**/*"],scripts:{dev:"bun run migrate && bun run dev:server","dev:server":"bun run --cwd=../../packages/sandbox build && NODE_ENV=development bun --env-file=.env --hot run src/index.ts",build:"bun run build:server","build:server":"bun run scripts/bundle-server-script.ts --dist ./dist/server","generate:tool-contracts":"bun run scripts/generate-tool-contracts.ts","db:migrate":"bun run ./dist/server/migrate.js","db:migrate:dbos":"bun run ./dist/server/migrate-dbos.js",check:"tsc --noEmit",start:"bun run ./dist/server/server.js",migrate:"bun run src/database/migrate.ts","migrate:dbos":"bun run src/database/migrate-dbos.ts",test:"bun test src","better-auth:migrate":"bunx --bun @better-auth/cli migrate -y --config src/auth/index.ts",prepublishOnly:"bun run --cwd=../.. build:studio"},optionalDependencies:{"@duckdb/node-api":"^1.5.0-r.1"},dependencies:{"@ai-sdk/anthropic":"^4.0.58","@ai-sdk/google":"^4.0.76","@ai-sdk/openai":"^4.0.71","@anthropic-ai/sdk":"^0.105.0","@aws-sdk/client-s3":"^3.1013.0","@aws-sdk/client-sts":"^3.1013.0","@aws-sdk/lib-storage":"^3.1013.0","@aws-sdk/s3-request-presigner":"^3.1013.0","@clickhouse/client":"^1.8.1","@dbos-inc/dbos-sdk":"^4.21.6","@inkjs/ui":"^2.0.0","@nats-io/jetstream":"3.4.0","@nats-io/kv":"3.4.0","@nats-io/nats-core":"3.4.0","@nats-io/transport-node":"3.4.0","@openrouter/ai-sdk-provider":"^3.1.0","@opentelemetry/core":"^2.6.0","embedded-postgres":"^18.3.0-beta.16",ink:"^6.8.0",kysely:"^0.28.12","posthog-node":"^5.0.0",react:"^19.2.6","react-dom":"^19.2.6"},devDependencies:{"@ai-sdk/provider":"^4.0.17","@better-auth/sso":"1.4.1","@decocms/better-auth":"1.5.17","@decocms/bindings":"workspace:*","@decocms/mcp-utils":"workspace:*","@decocms/runtime":"workspace:*","@decocms/sandbox":"workspace:*","@decocms/shared":"workspace:*","@jitl/quickjs-wasmfile-release-sync":"0.31.0","@modelcontextprotocol/sdk":"1.29.0","@opentelemetry/api":"^1.9.0","@opentelemetry/api-logs":"^0.211.0","@opentelemetry/exporter-logs-otlp-proto":"^0.211.0","@opentelemetry/exporter-prometheus":"^0.208.0","@opentelemetry/exporter-trace-otlp-proto":"^0.207.0","@opentelemetry/instrumentation-runtime-node":"^0.24.0","@opentelemetry/resources":"^2.6.0","@opentelemetry/sdk-logs":"^0.211.0","@opentelemetry/sdk-metrics":"^2.2.0","@opentelemetry/sdk-node":"^0.207.0","@opentelemetry/sdk-trace-base":"^2.5.0","@types/bun":"^1.3.1","@types/google.maps":"^3.65.2","@types/pg":"^8.15.6","@types/react-syntax-highlighter":"^15.5.13","@vercel/nft":"^1.1.1",ai:"^7.0.107","better-auth":"1.4.22",croner:"^9.1.0",degit:"^2.8.4",hono:"^4.10.7",jose:"^6.0.11",nanoid:"^5.1.6",pg:"^8.16.3",typescript:"^7.0.2",typescript5:"npm:typescript@^5.9.3",zod:"4.3.6"},homepage:"https://github.com/decocms/studio",keywords:["mcp","model-context-protocol","ai","gateway","self-hosted","tools"],license:"MIT",publishConfig:{access:"public"}}});function xy6(){let $=process.env.POSTHOG_KEY;if(!$)return null;return{key:$,host:process.env.POSTHOG_HOST??by6}}var E88,by6="https://ph.studio.decocms.com",z88;var P88=D(()=>{X8();xo();Mx();D9();U$();PW1();w88();E88=new X1;E88.get("/",($)=>{let Z={version:j88.version,theme:r0$(),...NK().logo&&{logo:NK().logo},...uB()&&{internalUrl:Il1()},...E0().enableDecoImport&&{enableDecoImport:!0},brandExtractEnabled:!!E0().firecrawlApiKey,hostingEnabled:!!E0().controlplaneRestUrl&&!!E0().controlplaneServiceToken,hostingControlPlaneGa:E0().hostingControlPlaneGa,monitorEnabled:!!E0().clickhouseAnalyticsUrl&&!!E0().clickhouseAnalyticsPassword,monitorGa:E0().monitorGa,plansEnabled:E0().plansEnabled,auth:fr$(),posthog:xy6(),googleMapsApiKey:process.env.GOOGLE_MAPS_API_KEY?.trim()||null,runtime:{agentSandbox:TO()}};return $.header("Cache-Control","no-store"),$.json({success:!0,config:Z})});z88=E88});function nm($){let Z=($??"").trim().toLowerCase();return Z=Z.replace(/^https?:\/\//,""),Z=Z.replace(/^www\./,""),Z=Z.split(/[/?#]/)[0]??"",Z.replace(/\/+$/,"")}function aH1($){return(nm($).split(".")[0]||$).replace(/[-_]/g," ").split(" ").filter(Boolean).map((Q)=>Q.charAt(0).toUpperCase()+Q.slice(1)).join(" ")}function T88($,Z=64){return`https://www.google.com/s2/favicons?domain=${encodeURIComponent(nm($))}&sz=${Z}`}function A88($,Z){let Q=$.trim();if(Q.length<=Z)return Q;let X=Q.slice(0,Z-1),Y=X.lastIndexOf(" ");return`${(Y>Z*0.6?X.slice(0,Y):X).trimEnd()}\u2026`}function R88($){let{brand:Z,domain:Q,score:X,verdict:Y}=$,J=typeof X==="number"?`${Z} commerce report \u2014 ${Math.round(X)}/100 \xB7 decocms`:`${Z} commerce report \xB7 decocms`,G=`See the full ${Z} scorecard \u2014 SEO, performance, conversion & AEO signals scored by decocms.`,W=Y?.trim()?A88(`${Y.trim().replace(/\s+/g," ")} \u2014 ${G}`,200):A88(`How does ${Q} really perform? ${G}`,200);return{title:J,description:W}}import{z as p0}from"zod";var yf,fy6,yy6,gy6,hy6,q88;var M88=D(()=>{yf=p0.enum(["good","bad","neutral"]),fy6=p0.preprocess(($)=>{if(Array.isArray($))return{kind:"text",value:$.find((Q)=>Q!==null&&typeof Q!=="object")??""};return $!==null&&typeof $==="object"?$:{kind:"text",value:$}},p0.object({kind:p0.enum(["text","number","sparkline","badge","score"]).catch("text"),value:p0.coerce.string().optional(),tone:yf.optional(),muted:p0.boolean().optional(),delta:p0.coerce.string().optional(),deltaDir:p0.enum(["up","down","neutral"]).optional(),points:p0.array(p0.coerce.number()).optional(),label:p0.coerce.string().optional()}).transform(($)=>{if($.kind==="badge"&&$.label==null)$.label=$.value??"";if($.kind==="score"){let Z=Number($.value);if(Number.isNaN(Z))return{...$,kind:"text"}}return $})),yy6=p0.preprocess(($)=>{let Z=$;if(Z&&typeof Z==="object"&&!Array.isArray(Z)&&Array.isArray(Z.cells))Z=Z.cells;if(Array.isArray(Z)&&Z.length===1&&Array.isArray(Z[0]))Z=Z[0];if(Array.isArray(Z))return Z;if(Z&&typeof Z==="object")return Object.values(Z);return Z},p0.array(fy6)),gy6={key:p0.coerce.string(),title:p0.coerce.string(),eyebrow:p0.coerce.string().optional(),headline:p0.coerce.string(),annotation:p0.coerce.string().optional(),methodology:p0.coerce.string().optional(),sources:p0.array(p0.object({name:p0.coerce.string(),logoUrl:p0.coerce.string()})).optional()},hy6=p0.discriminatedUnion("template",[p0.object({template:p0.literal("cover"),score:p0.object({value:p0.coerce.number(),max:p0.coerce.number().optional(),grade:p0.coerce.string().optional(),label:p0.coerce.string().optional()}).optional(),brandImage:p0.coerce.string().optional(),screenshot:p0.coerce.string().optional(),mobileScreenshot:p0.coerce.string().optional()}),p0.object({template:p0.literal("cta"),ctaUrl:p0.coerce.string().optional(),ctaLabel:p0.coerce.string().optional(),bullets:p0.array(p0.coerce.string()).optional()}),p0.object({template:p0.literal("series"),points:p0.array(p0.coerce.number()).min(2),xLabels:p0.array(p0.coerce.string()).min(1),unit:p0.coerce.string().optional(),callout:p0.object({index:p0.coerce.number(),value:p0.coerce.string(),tone:yf.optional()})}),p0.object({template:p0.literal("threshold"),value:p0.coerce.string().default(""),metricLabel:p0.coerce.string().optional(),ratio:p0.coerce.number(),thresholdRatio:p0.coerce.number().optional(),thresholdLabel:p0.coerce.string().default(""),tone:yf.optional()}),p0.object({template:p0.literal("stats"),stats:p0.array(p0.object({value:p0.coerce.string(),label:p0.coerce.string(),tone:yf.optional()})).min(1)}),p0.object({template:p0.literal("bars"),items:p0.array(p0.object({value:p0.coerce.string(),label:p0.coerce.string(),ratio:p0.coerce.number(),tone:yf.optional()})).min(1)}),p0.object({template:p0.literal("gauges"),gauges:p0.array(p0.object({label:p0.coerce.string(),value:p0.coerce.string(),status:p0.enum(["good","warn","bad"]).catch("warn"),caption:p0.coerce.string().optional(),ratio:p0.coerce.number().optional()})).min(1)}),p0.object({template:p0.literal("checklist"),checks:p0.array(p0.object({label:p0.coerce.string(),status:p0.enum(["pass","fail","warn"]).catch("fail"),value:p0.coerce.string().optional()})).min(1)}),p0.object({template:p0.literal("table"),columns:p0.array(p0.object({label:p0.coerce.string(),align:p0.enum(["left","right"]).optional()})).min(1),rows:p0.array(yy6).min(1),highlightRow:p0.coerce.number().optional()}),p0.object({template:p0.literal("products"),products:p0.array(p0.object({name:p0.coerce.string(),price:p0.coerce.string().optional(),image:p0.coerce.string().optional(),url:p0.coerce.string().optional()})).min(1)}),p0.object({template:p0.literal("list"),entries:p0.array(p0.object({label:p0.coerce.string(),severity:p0.enum(["error","warning","notice"]).catch("notice")})).min(1),moreCount:p0.coerce.number().optional()}),p0.object({template:p0.literal("keywords"),volumeLabel:p0.coerce.string().optional(),keywords:p0.array(p0.object({term:p0.coerce.string(),volume:p0.coerce.string(),position:p0.coerce.number().catch(0)})).min(1)}),p0.object({template:p0.literal("competitor"),metricLabel:p0.coerce.string().optional(),competitors:p0.array(p0.object({name:p0.coerce.string(),value:p0.coerce.string(),tone:yf.optional(),isYou:p0.boolean().optional()})).min(1)}),p0.object({template:p0.literal("scorecard"),rivalLabel:p0.coerce.string().optional(),dimensions:p0.array(p0.object({label:p0.coerce.string(),you:p0.coerce.string(),rival:p0.coerce.string().optional(),rivalName:p0.coerce.string().optional(),tone:yf.optional()})).min(1)})]),q88=p0.object({...gy6,template:hy6})});function Hk0($){let Z=[],Q=[...$.sections].sort((Y,J)=>Y.position-J.position).map((Y)=>{let J=q88.safeParse(Y.props);if(J.success)return J.data;let G=J.error.issues[0];return Z.push({section_type:Y.section_type,position:Y.position,reason:G?`${G.path.join(".")||"(root)"}: ${G.message}`:"contract violation"}),null}).filter((Y)=>Y!==null),X=Q.filter((Y)=>Y.template.template!=="cover"&&Y.template.template!=="cta").map((Y)=>({key:Y.key,title:Y.title}));return{deck:{meta:{...$.meta,scores:$.summary?.scores,scannedAt:$.scanned_at,toc:X},slides:Q},drops:Z}}var sH1=D(()=>{M88()});import{join as I88}from"path";async function ly6($){try{let Z=await fetch(`${RF({})}/api/v2/public/diagnostics/${encodeURIComponent($)}`,{headers:{Accept:"application/json"},signal:AbortSignal.timeout(uy6)});if(!Z.ok)return null;let Q=await Z.json(),{deck:X}=Hk0(Q);if(!X.slides.length)return null;let Y=X.slides.find((W)=>W.template.template==="cover"),J=Y?.template,G=J&&J.template==="cover"?J:void 0;return{brand:X.meta.brand?.trim()||aH1($),score:X.meta.scores?.cover??G?.score?.value,verdict:Y?.annotation?.trim()||Y?.headline?.trim()||void 0}}catch{return null}}function aG($){return $.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}function cy6($,Z){let Q=nm($),X=Z?.brand?.trim()||aH1(Q),Y=T88(Q,128),G=`${(E0().baseUrl??"https://studio.decocms.com").replace(/\/+$/,"")}/report/${encodeURIComponent(Q)}`,{title:W,description:K}=R88({brand:X,domain:Q,score:Z?.score,verdict:Z?.verdict}),H=`${G}/og.png`,F=`${X} commerce report by decocms`;return[`<title>${aG(W)}</title>`,`<meta name="description" content="${aG(K)}" />`,'<meta name="robots" content="noindex, follow" />','<meta property="og:type" content="website" />','<meta property="og:site_name" content="decocms" />',`<meta property="og:title" content="${aG(W)}" />`,`<meta property="og:description" content="${aG(K)}" />`,`<meta property="og:url" content="${aG(G)}" />`,`<meta property="og:image" content="${aG(H)}" />`,'<meta property="og:image:width" content="1200" />','<meta property="og:image:height" content="630" />',`<meta property="og:image:alt" content="${aG(F)}" />`,'<meta name="twitter:card" content="summary_large_image" />',`<meta name="twitter:title" content="${aG(W)}" />`,`<meta name="twitter:description" content="${aG(K)}" />`,`<meta name="twitter:image" content="${aG(H)}" />`,`<meta name="twitter:image:alt" content="${aG(F)}" />`,`<link rel="canonical" href="${aG(G)}" />`,`<link rel="icon" href="${aG(Y)}" sizes="any" />`].join(`
3364
+ `;await V$8(Z.repo,L);let w=O[0]??`${$k0(X)}/${fH1(N)}.json`;H.push({path:w,content:L});let j=w.slice(w.lastIndexOf("/")+1,-5);F.set(w,{stem:j,content:L});for(let E of O.slice(1))H.push({path:E,deleted:!0}),F.delete(E)}for(let N of $.del)for(let B of mH1(K,N))H.push({path:B,deleted:!0}),F.delete(B);if(H.length===0)return G;let U=X?`${X}/.deco/blocks.gen.json`:".deco/blocks.gen.json";if(W.some((N)=>N.type==="blob"&&N.path===U)){let N=await k$8(Z,F.values(),Y),{decofile:B,skipped:O}=j80(N);if(O.length>0)console.warn("decofile gen: dropped blocks that were not valid JSON",{repo:kK(Z.repo),branch:Q,packagePath:X,blocks:O.map((L)=>L.key)});H.push({path:U,content:B})}try{let{sha:N}=await Z.commitFiles({branch:Q,message:Gy6($),expectedHead:G,changes:H});return N}catch(N){if(!(N instanceof l6)||J>=Xy6-1)throw N;await c$(a7(2000,200,J,2,0.5))}}}function Gy6($){let Z=(Y)=>{let J=Y.slice(0,3).join(", ");return Y.length>3?`${J} (+${Y.length-3} more)`:J},Q=[];if($.set.size>0)Q.push(`update ${Z([...$.set.keys()])}`);if($.del.size>0)Q.push(`delete ${Z([...$.del])}`);let X=`chore(decofile): ${Q.join("; ")}`;return N81(X,$.deps.coAuthor)}var Xy6=3,oH1;var n$8=D(()=>{SP0();tV0();w6();D8();hZ();Zk0();oH1=new Map});import{createHmac as t$8,randomBytes as Wy6,timingSafeEqual as Ky6}from"crypto";function o$8(){if(Kk0)return Kk0;let $;try{let Z=E0();$=Z.studioJwtSecret??Z.betterAuthSecret}catch{$=void 0}return Kk0=$?Buffer.from($):Wy6(32),Kk0}function rH1($){let Z=$.nowMs??Date.now(),Q={o:$.organizationId,m:$.virtualMcpId,b:$.branch,e:Math.floor((Z+Hy6)/1000)},X=Buffer.from(JSON.stringify(Q)).toString("base64url"),Y=t$8("sha256",o$8()).update(X).digest("base64url");return`${X}.${Y}`}function r$8($,Z){let Q=$.indexOf(".");if(Q<0)return!1;let X=$.slice(0,Q),Y=Buffer.from($.slice(Q+1)),J=Buffer.from(t$8("sha256",o$8()).update(X).digest("base64url"));if(Y.length!==J.length||!Ky6(Y,J))return!1;let G;try{G=JSON.parse(Buffer.from(X,"base64url").toString())}catch{return!1}let W=Math.floor((Z.nowMs??Date.now())/1000);return G.o===Z.organizationId&&G.m===Z.virtualMcpId&&G.b===Z.branch&&typeof G.e==="number"&&G.e>=W}var Hy6=21600000,Kk0=null;var a$8=D(()=>{U$()});import{z as pm}from"zod";function Uy6($){return $.length>0&&$.length<=255&&!$.includes("..")&&!$.endsWith("/")&&!$.endsWith(".lock")&&Fy6.test($)}function Q88($){return $.req.header("x-forwarded-host")??new URL($.req.url).host}async function q80($){let Z=$.get("decofileScope");return il($.var.studioContext,Z.organizationId,Z.githubRepo)}function M80($,Z){let Q=Z instanceof Error?Z.message:String(Z);if(Z instanceof l6)return $.json({error:Q},409);let X=e3(Z);if(X!==null){let Y=X===404?404:X===409||X===422?409:502;return $.json({error:Q},Y)}return $.json({error:Q},500)}function X88(){let $=new X1;return $.use("/:virtualMcpId/:branch",Z88),$.use("/:virtualMcpId/:branch/*",Z88),$.get("/:virtualMcpId/:branch",async(Z)=>{let Q=Z.get("decofileScope");try{let X=await q80(Z),Y=await S$8(X,Q.branch,Q.packagePath,{createBranchIfMissing:!!Q.userId}),J={ETag:`"${Y.sha}"`,"Cache-Control":"no-store","Access-Control-Allow-Origin":"*"};if(Z.req.header("if-none-match")===`"${Y.sha}"`)return Z.body(null,304,J);if(!Q.userId)return Z.body(Y.decofile,200,{...J,"content-type":"application/json"});let G=rH1({organizationId:Q.organizationId,virtualMcpId:Q.virtualMcpId,branch:Q.branch});return Z.body(`{"version":${JSON.stringify(Y.sha)},"token":${JSON.stringify(G)},"apiHost":${JSON.stringify(Q88(Z))},"decofile":${Y.decofile}}`,200,{...J,"content-type":"application/json"})}catch(X){return M80(Z,X)}}),$.get("/:virtualMcpId/:branch/meta",async(Z)=>{let Q=Z.get("decofileScope"),X=Q.packagePath?`${Q.packagePath}/.deco/meta.gen.json`:".deco/meta.gen.json";try{let Y=await q80(Z),J=await Y.readFileAtRef(Q.branch,X);if(J===null){let G=await Y.getDefaultBranch();if(G!==Q.branch)J=await Y.readFileAtRef(G,X)}if(J===null)return Z.json({error:"meta.gen.json not committed"},404);return Z.body(J,200,{"content-type":"application/json","Cache-Control":"no-store","Access-Control-Allow-Origin":"*"})}catch(Y){return M80(Z,Y)}}),$.patch("/:virtualMcpId/:branch",By6,async(Z)=>{let Q=Z.get("decofileScope"),X=Z.var.studioContext,Y=Oy6.safeParse(await Z.req.json().catch(()=>null));if(!Y.success)return Z.json({error:"Invalid body",details:Y.error.issues},400);let J=Y.data;for(let G of[...Object.keys(J.set??{}),...J.delete??[]])try{nV0(G)}catch(W){let K=W instanceof Error?W.message:String(W);return Z.json({error:K},400)}for(let[G,W]of Object.entries(J.set??{})){if(typeof W!=="object"||W===null||Array.isArray(W))return Z.json({error:`Block "${G}" must be a JSON object`},400);if(xH1(G))return Z.json({error:`Block key "${G}" collides with a framework resolver module and cannot be written`},400)}try{let G=await q80(Z),W=await p$8(`${Q.organizationId}/${Q.virtualMcpId}/${Q.branch}`,{client:G,branch:Q.branch,packagePath:Q.packagePath,coAuthor:um(X)},J),K=rH1({organizationId:Q.organizationId,virtualMcpId:Q.virtualMcpId,branch:Q.branch});return Z.json({version:W,token:K,apiHost:Q88(Z)})}catch(G){return M80(Z,G)}}),$.post("/:virtualMcpId/:branch/publish",async(Z)=>{let Q=Z.get("decofileScope");try{let X=await q80(Z),Y=await X.getDefaultBranch();if(Y===Q.branch)return Z.json({error:"Branch is already the default branch"},400);let J=`chore(decofile): publish ${Q.branch}`;try{let G;try{G=await X.mergeBranches(Y,Q.branch,J)}catch(W){if(e3(W)!==409)throw W;await Jk0(X,Q.branch,Y),G=await X.mergeBranches(Y,Q.branch,J)}return G?Z.json({result:"merged",sha:G}):Z.json({result:"up-to-date"})}catch(G){if(e3(G)===409)return Z.json({error:"merge-conflict"},409);if(e3(G)===405){let K=await X.findOpenChangeRequest(Y,Q.branch)??await X.createChangeRequest({base:Y,head:Q.branch,title:`Publish ${Q.branch}`});return Z.json({result:"pull-request",number:K.number,url:K.url})}throw G}}catch(X){return M80(Z,X)}}),$.get("/:virtualMcpId/:branch/status",async(Z)=>{let Q=Z.get("decofileScope");try{let X=await q80(Z),Y=await X.getDefaultBranch();if(Y===Q.branch)return Z.json({baseBranch:Y,aheadBy:0,behindBy:0,lastCommitAt:null});try{let[{aheadBy:J,behindBy:G},W]=await Promise.all([X.compare(Y,Q.branch),X.getBranch(Q.branch)]);return Z.json({baseBranch:Y,aheadBy:J,behindBy:G,lastCommitAt:W?.committedAt??null})}catch(J){if(e3(J)===404)return Z.json({baseBranch:Y,aheadBy:0,behindBy:0,lastCommitAt:null});throw J}}catch(X){return M80(Z,X)}}),$}var Fy6,s$8=500,e$8=1048576,$88=1024,Ny6=8388608,By6,Oy6,Z88;var Y88=D(()=>{D61();tV0();X8();FH();qH1();pV0();nH1();hZ();n$8();a$8();pH1();Zk0();TF();Fy6=/^[a-zA-Z0-9][a-zA-Z0-9/._-]*$/;By6=H9({maxSize:Ny6,onError:($)=>$.json({error:"Payload too large"},413)}),Oy6=pm.object({set:pm.record(pm.string(),pm.unknown()).optional(),delete:pm.array(pm.string()).optional()}).refine(($)=>Object.keys($.set??{}).length>0||($.delete?.length??0)>0,{message:"Patch must set or delete at least one block"}).refine(($)=>Object.keys($.set??{}).length+($.delete?.length??0)<=s$8,{message:`Patch cannot touch more than ${s$8} blocks`}).refine(($)=>Object.values($.set??{}).every((Z)=>JSON.stringify(Z).length<=e$8),{message:`Each block must be at most ${e$8} bytes`}).refine(($)=>[...Object.keys($.set??{}),...$.delete??[]].every((Z)=>Z.length<=$88),{message:`Each block key must be at most ${$88} characters`}),Z88=iV0(async($,Z)=>{let Q=$.var.studioContext,X=Q.organization;if(!X)return $.json({error:"Organization scope required"},500);let Y=$.req.param("virtualMcpId"),J=$.req.param("branch");if(!Y||!J)return $.json({error:"virtualMcpId and branch are required"},400);if(!Uy6(J))return $.json({error:`Invalid branch name: ${J}`},400);let G=Q.auth?.user?.id??null;if(!G){let B=$.req.query("token");if(!($.req.method==="GET"&&!$.req.path.match(/\/(publish|status)$/)))return $.json({error:"Unauthorized"},401);if(!B||!r$8(B,{organizationId:X.id,virtualMcpId:Y,branch:J}))return $.json({error:"Unauthorized"},401)}if(!await d3(Q,X.id,"cms"))return $.json({error:"This organization's plan does not include the CMS",code:"feature_not_in_plan"},403);let W=await Q.storage.virtualMcps.findById(Y);if(!W||W.organization_id!==X.id)return $.json({error:"Virtual MCP not found"},404);let K=W.metadata??null;if(!mA0(K))return $.json({error:"Project has no preview server configured"},404);let F=W.connections?.map((B)=>B.connection_id)??[],U=T80(K,F);if(!U)return $.json({error:"Project has no GitHub repository"},404);let N=K?.runtime;return $.set("decofileScope",{organizationId:X.id,virtualMcpId:Y,branch:J,packagePath:N?.path?.replace(/^\/+|\/+$/g,"")||null,githubRepo:U,userId:G}),Z()})});var J88=($)=>{let Z=new X1;if(Z.use("*",wm),Z.use("*",xa$),Z.route("/",$V0()),Z.route("/",ws$()),Z.route("/",Xs$()),Z.route("/",M18()),Z.route("/",j18()),Z.route("/",R18()),Z.route("/",z18()),Z.route("/",cV0()),Z.route("/tools",v18()),Z.route("/",S18()),Z.route("/",r08({kvStorage:$.kvStorage})),Z.route("/",t08()),Z.route("/fs",H18({getConnection:$.getNatsConnection})),Z.route("/sandbox",m$8()),Z.route("/decofile",X88()),Z.route("/",D18()),Z.route("/",U18()),Z.route("/deco-sites",QV0()),Z.route("/hosting",pa$()),Z.route("/monitor",ea$()),Z.route("/sso",oI0()),Z.route("/",dV0({tokenStorage:$.tokenStorage,automationEventDispatcher:$.automationEventDispatcher})),Z.route("/webhooks",la$()),$.mountDevAssets)Z.route("/dev-assets",GV0({orgFromPath:!0}));return Z.use("/mcp/:connectionId?",$.mcpAuth),Z.use("/mcp/:connectionId/ui-resource",$.mcpAuth),Z.use("/mcp/gateway/:virtualMcpId?",$.mcpAuth),Z.use("/mcp/virtual-mcp/:virtualMcpId?",$.mcpAuth),Z.use("/mcp/self",$.mcpAuth),Z.use("/mcp/task-run/:threadId",$.mcpAuth),Z.route("/",it$()),Z.get("/mcp/:gateway?/:connectionId/.well-known/oauth-protected-resource/*",$.betterAuthProtectedResourceHandler),Z.get("/mcp/.well-known/oauth-protected-resource",$.betterAuthProtectedResourceHandler),Z.route("/mcp/task-run",B18()),Z.route("/mcp",a20()),Z.route("/mcp/self",gV0()),Z.route("/mcp",$R0()),Z.all("/oauth-proxy/:connectionId/*",$.oauthProxyHandler),Z.get("/watch",$.watchHandler),Z};var G88=D(()=>{X8();fa$();gI0();ca$();pW1();na$();$s$();WV0();Tf();lW1();aW1();o08();a08();F18();N18();H10();xW1();ZR0();LH1();O18();L18();E18();P18();EH1();I18();C18();zH1();b18();PH1();s20();i$8();Y88()});function Dy6($){return $.filter((Z)=>Z.vendors?.alias).map((Z)=>({name:Z.name,title:Z.title,description:Z.description,logo:Z.logo,category:Z.category,vendor:{alias:Z.vendors.alias,url:Z.vendors.url}}))}var Ly6=async($,Z)=>{if(!$.get("studioContext").auth.user?.id)return $.json({error:"Unauthorized"},401);return Z()},W88=()=>{let $=new X1;return $.use("*",Ly6),$.get("/",async(Z)=>{let Q=E0(),X=Q.decoSupabaseUrl,Y=Q.decoSupabaseServiceKey;if(!X||!Y)return Z.json({apps:[]});try{let J=await _J(X,Y,"apps?select=name,title,description,logo,category,vendors(alias,url)");return Z.json({apps:Dy6(J)})}catch(J){return console.error("[deco-apps] GET error:",J),Z.json({error:"Failed to fetch apps"},502)}}),$};var K88=D(()=>{X8();U$();nM0()});import{z as b1}from"zod";function VU($,Z="invalid_request_error",Q=null,X=null){return{error:{message:$,type:Z,param:Q,code:X}}}function My6($){if(!$)return null;let Z=$.indexOf(":");if(Z===-1)return{credentialId:null,modelId:$};let Q=$.substring(0,Z),X=$.substring(Z+1);if(!Q||!X)return null;return{credentialId:Q,modelId:X}}function Iy6($,Z,Q){try{return JSON.parse($)}catch{throw new U88(`Invalid JSON in tool call arguments for function '${Q}' (tool_call_id: ${Z}): ${$}`)}}function Vy6($){let Z={};for(let Q of $)if(Q.role==="assistant"&&Q.tool_calls)for(let X of Q.tool_calls)Z[X.id]=X.function.name;return $.map((Q)=>{switch(Q.role){case"system":return{role:"system",content:Q.content};case"user":if(typeof Q.content==="string")return{role:"user",content:Q.content};return{role:"user",content:Q.content.map((Y)=>{if(Y.type==="text")return{type:"text",text:Y.text};return{type:"image",image:Y.image_url.url}})};case"assistant":if(Q.tool_calls&&Q.tool_calls.length>0)return{role:"assistant",content:Q.tool_calls.map((Y)=>({type:"tool-call",toolCallId:Y.id,toolName:Y.function.name,input:Iy6(Y.function.arguments,Y.id,Y.function.name)}))};return{role:"assistant",content:Q.content??""};case"tool":let X=Z[Q.tool_call_id]??"unknown";return{role:"tool",content:[{type:"tool-result",toolCallId:Q.tool_call_id,toolName:X,output:{type:"text",value:Q.content}}]}}})}function ky6($){let Z=$.map((Q)=>{let X=Q.function.parameters?WF(Q.function.parameters):WF({type:"object",properties:{}});return[Q.function.name,u$({description:Q.function.description,inputSchema:X})]});return Object.fromEntries(Z)}function Sy6($){if(!$)return;return{openai:{response_format:$}}}function Cy6(){return`chatcmpl-${crypto.randomUUID().replace(/-/g,"").substring(0,29)}`}function H88($,Z,Q,X,Y,J){let G={model:$,instructions:Z.filter((W)=>W.role==="system"),messages:Z.filter((W)=>W.role!=="system"),tools:Q,temperature:X.temperature,maxOutputTokens:X.max_tokens,topP:X.top_p,frequencyPenalty:X.frequency_penalty,presencePenalty:X.presence_penalty,stopSequences:X.stop?Array.isArray(X.stop)?X.stop:[X.stop]:void 0,abortSignal:J};return Y?{...G,providerOptions:Y}:G}function F88($){if($==="tool-calls")return"tool_calls";if($==="length")return"length";return"stop"}var wy6=256,jy6,Ey6,zy6,Py6,Ay6,Ty6,Ry6,qy6,U88,N88,B88;var O88=D(()=>{$6();X8();hm();sK();jy6=b1.object({type:b1.literal("function"),function:b1.object({name:b1.string(),description:b1.string().optional(),parameters:b1.record(b1.string(),b1.unknown()).optional()})}),Ey6=b1.object({id:b1.string(),type:b1.literal("function"),function:b1.object({name:b1.string(),arguments:b1.string()})}),zy6=b1.discriminatedUnion("role",[b1.object({role:b1.literal("system"),content:b1.string(),name:b1.string().optional()}),b1.object({role:b1.literal("user"),content:b1.union([b1.string(),b1.array(b1.union([b1.object({type:b1.literal("text"),text:b1.string()}),b1.object({type:b1.literal("image_url"),image_url:b1.object({url:b1.string(),detail:b1.string().optional()})})]))]),name:b1.string().optional()}),b1.object({role:b1.literal("assistant"),content:b1.string().nullable().optional(),name:b1.string().optional(),tool_calls:b1.array(Ey6).optional()}),b1.object({role:b1.literal("tool"),content:b1.string(),tool_call_id:b1.string()})]),Py6=b1.object({type:b1.literal("text")}),Ay6=b1.object({type:b1.literal("json_object")}),Ty6=b1.object({type:b1.literal("json_schema"),json_schema:b1.object({name:b1.string(),description:b1.string().optional(),schema:b1.record(b1.string(),b1.unknown()),strict:b1.boolean().optional()})}),Ry6=b1.union([Py6,Ay6,Ty6]),qy6=b1.object({model:b1.string().describe("Format: 'model_id' or 'credential_id:model_id'"),messages:b1.array(zy6),stream:b1.boolean().optional().default(!1),temperature:b1.number().min(0).max(2).optional(),max_tokens:b1.number().positive().optional(),top_p:b1.number().min(0).max(1).optional(),frequency_penalty:b1.number().min(-2).max(2).optional(),presence_penalty:b1.number().min(-2).max(2).optional(),stop:b1.union([b1.string(),b1.array(b1.string())]).optional(),tools:b1.array(jy6).optional(),tool_choice:b1.union([b1.literal("auto"),b1.literal("none"),b1.literal("required"),b1.object({type:b1.literal("function"),function:b1.object({name:b1.string()})})]).optional(),response_format:Ry6.optional(),user:b1.string().optional()});U88=class U88 extends Error{constructor($){super($);this.name="MessageConversionError"}};N88=new X1;N88.post("/:org/v1/chat/completions",async($)=>{let Z=$.get("studioContext"),Q=$.req.param("org");try{if(!Z.auth.apiKey?.id)return $.json(VU("API key authentication required. Provide a valid API key via Authorization header.","authentication_error"),401);if(!Z.organization)return $.json(VU("Organization context is required. Ensure your API key has organization metadata.","invalid_request_error","organization"),400);if((Z.organization.slug??Z.organization.id)!==Q)return $.json(VU("Organization mismatch. The API key's organization does not match the requested organization.","invalid_request_error","organization"),403);let X=await $.req.json(),Y=qy6.safeParse(X);if(!Y.success){let w=Y.error.issues[0]??{message:"Invalid request",path:[]};return $.json(VU(`Invalid request: ${w.message}`,"invalid_request_error",w.path.length>0?w.path.join("."):null),400)}let J=Y.data,G=My6(J.model);if(!G)return $.json(VU("Invalid model format. Expected 'model_id' or 'credential_id:model_id' (e.g., 'claude-sonnet-4-6' or 'key_abc123:claude-sonnet-4-6')","invalid_request_error","model"),400);let{credentialId:W}=G,{modelId:K}=G;if(!W){let j=(await Z.storage.aiProviderKeys.list({organizationId:Z.organization.id})).find((E)=>Kz(E.providerId));if(!j)return $.json(VU("No AI provider credentials configured for this organization. Add a credential in settings or specify one explicitly via 'credential_id:model_id'.","invalid_request_error","model"),400);W=j.id}let H;try{H=await Z.aiProviders.activate(W,Z.organization.id)}catch{return $.json(VU(`AI provider credential not found or inaccessible: ${W}`,"invalid_request_error","model"),404)}let F=H.aiSdk.languageModel(K),U=Vy6(J.messages),N=J.tools?ky6(J.tools):void 0,B=Sy6(J.response_format),O=Cy6(),L=Math.floor(Date.now()/1000);if(J.stream)return UO($,async(w)=>{let j=H88(F,U,N,J,B,$.req.raw.signal);try{let E=Vc(j),z=!1,T=0,P="",A=async()=>{if(P.length===0)return;let q=P;P="",await w.writeSSE({data:JSON.stringify({id:O,object:"chat.completion.chunk",created:L,model:J.model,choices:[{index:0,delta:{content:q},finish_reason:null}]})})};for await(let q of E.stream){if(!z&&(q.type==="text-delta"||q.type==="tool-call"))await w.writeSSE({data:JSON.stringify({id:O,object:"chat.completion.chunk",created:L,model:J.model,choices:[{index:0,delta:{role:"assistant",content:""},finish_reason:null}]})}),z=!0;if(q.type==="text-delta"){if(P+=q.text,P.length>=wy6)await A()}else if(q.type==="tool-call"){await A();let x=T++;await w.writeSSE({data:JSON.stringify({id:O,object:"chat.completion.chunk",created:L,model:J.model,choices:[{index:0,delta:{tool_calls:[{index:x,id:q.toolCallId,type:"function",function:{name:q.toolName,arguments:JSON.stringify(q.input)}}]},finish_reason:null}]})})}else if(q.type==="finish")await A(),await w.writeSSE({data:JSON.stringify({id:O,object:"chat.completion.chunk",created:L,model:J.model,choices:[{index:0,delta:{},finish_reason:F88(q.finishReason)}],usage:q.totalUsage?{prompt_tokens:q.totalUsage.inputTokens??0,completion_tokens:q.totalUsage.outputTokens??0,total_tokens:q.totalUsage.totalTokens??0}:void 0})})}await A(),await w.writeSSE({data:"[DONE]"})}catch(E){let z=E;console.error("[openai-compat:stream] Error:",z.message),await w.writeSSE({data:JSON.stringify({error:{message:z.message,type:"server_error"}})})}});else{let w=H88(F,U,N,J,B,$.req.raw.signal),j=await Ic(w),E={role:"assistant",content:j.text||null};if(j.toolCalls&&j.toolCalls.length>0)E.tool_calls=j.toolCalls.map((z)=>({id:z.toolCallId,type:"function",function:{name:z.toolName,arguments:JSON.stringify("input"in z?z.input:{})}})),E.content=null;return $.json({id:O,object:"chat.completion",created:L,model:J.model,choices:[{index:0,message:E,finish_reason:F88(j.finishReason)}],usage:{prompt_tokens:j.usage?.inputTokens??0,completion_tokens:j.usage?.outputTokens??0,total_tokens:j.usage?.totalTokens??0}})}}catch(X){let Y=X;if(Y.name==="AbortError")return $.json(VU("Request aborted","invalid_request_error"),400);if(Y.name==="MessageConversionError")return $.json(VU(Y.message,"invalid_request_error","messages"),400);return console.error("[openai-compat] Error:",Y.message,Y.stack),$.json(VU(Y.message,"server_error"),500)}});B88=N88});function _y6($){if(typeof $!=="object"||$===null)return!1;let Q=$.githubRepo?.url;return typeof Q==="string"&&Q.length>0}function D88(){let $=new X1;return $.use("*",async(Z,Q)=>{await Q(),Z.header("Cache-Control","private, no-store"),Z.header("Vary","Cookie")}),$.get("/",async(Z)=>{let Q=Z.get("studioContext"),X=i0(Q);if(!X)return Z.json({error:"Authentication required"},401);let J=(Z.req.query("site")??"").trim().toLowerCase();if(!N7(J))return Z.json({error:"Invalid site slug"},400);let G=await Q.db.selectFrom("member").innerJoin("organization","organization.id","member.organizationId").select(["organization.id as id","organization.slug as slug","organization.name as name","organization.metadata as metadata"]).where("member.userId","=",X).execute(),W=[];for(let H of G){if(!H.slug||w9(H))continue;let F=await Q.storage.virtualMcps.list(H.id);for(let U of F){if(D30(U)!==J)continue;if(!_y6(U.metadata))continue;W.push({orgSlug:H.slug,orgName:H.name??H.slug,project:{id:U.id,title:U.title,icon:U.icon??null}})}}let K={matches:W};return Z.json(K)}),$}var L88=D(()=>{X8();o3()});var j88;var w88=D(()=>{j88={name:"decocms",version:"4.388.0",description:"Deco CMS \u2014 Self-hostable MCP Gateway for managing AI connections and tools",author:"Deco team",repository:{type:"git",url:"git+https://github.com/decocms/studio.git",directory:"apps/api"},bugs:{url:"https://github.com/decocms/studio/issues"},type:"module",bin:{deco:"./dist/server/cli.js"},files:["dist/**/*"],scripts:{dev:"bun run migrate && bun run dev:server","dev:server":"bun run --cwd=../../packages/sandbox build && NODE_ENV=development bun --env-file=.env --hot run src/index.ts",build:"bun run build:server","build:server":"bun run scripts/bundle-server-script.ts --dist ./dist/server","generate:tool-contracts":"bun run scripts/generate-tool-contracts.ts","db:migrate":"bun run ./dist/server/migrate.js","db:migrate:dbos":"bun run ./dist/server/migrate-dbos.js",check:"tsc --noEmit",start:"bun run ./dist/server/server.js",migrate:"bun run src/database/migrate.ts","migrate:dbos":"bun run src/database/migrate-dbos.ts",test:"bun test src","better-auth:migrate":"bunx --bun @better-auth/cli migrate -y --config src/auth/index.ts",prepublishOnly:"bun run --cwd=../.. build:studio"},optionalDependencies:{"@duckdb/node-api":"^1.5.0-r.1"},dependencies:{"@ai-sdk/anthropic":"^4.0.58","@ai-sdk/google":"^4.0.76","@ai-sdk/openai":"^4.0.71","@anthropic-ai/sdk":"^0.105.0","@aws-sdk/client-s3":"^3.1013.0","@aws-sdk/client-sts":"^3.1013.0","@aws-sdk/lib-storage":"^3.1013.0","@aws-sdk/s3-request-presigner":"^3.1013.0","@clickhouse/client":"^1.8.1","@dbos-inc/dbos-sdk":"^4.21.6","@inkjs/ui":"^2.0.0","@nats-io/jetstream":"3.4.0","@nats-io/kv":"3.4.0","@nats-io/nats-core":"3.4.0","@nats-io/transport-node":"3.4.0","@openrouter/ai-sdk-provider":"^3.1.0","@opentelemetry/core":"^2.6.0","embedded-postgres":"^18.3.0-beta.16",ink:"^6.8.0",kysely:"^0.28.12","posthog-node":"^5.0.0",react:"^19.2.6","react-dom":"^19.2.6"},devDependencies:{"@ai-sdk/provider":"^4.0.17","@better-auth/sso":"1.4.1","@decocms/better-auth":"1.5.17","@decocms/bindings":"workspace:*","@decocms/mcp-utils":"workspace:*","@decocms/runtime":"workspace:*","@decocms/sandbox":"workspace:*","@decocms/shared":"workspace:*","@jitl/quickjs-wasmfile-release-sync":"0.31.0","@modelcontextprotocol/sdk":"1.29.0","@opentelemetry/api":"^1.9.0","@opentelemetry/api-logs":"^0.211.0","@opentelemetry/exporter-logs-otlp-proto":"^0.211.0","@opentelemetry/exporter-prometheus":"^0.208.0","@opentelemetry/exporter-trace-otlp-proto":"^0.207.0","@opentelemetry/instrumentation-runtime-node":"^0.24.0","@opentelemetry/resources":"^2.6.0","@opentelemetry/sdk-logs":"^0.211.0","@opentelemetry/sdk-metrics":"^2.2.0","@opentelemetry/sdk-node":"^0.207.0","@opentelemetry/sdk-trace-base":"^2.5.0","@types/bun":"^1.3.1","@types/google.maps":"^3.65.2","@types/pg":"^8.15.6","@types/react-syntax-highlighter":"^15.5.13","@vercel/nft":"^1.1.1",ai:"^7.0.107","better-auth":"1.4.22",croner:"^9.1.0",degit:"^2.8.4",hono:"^4.10.7",jose:"^6.0.11",nanoid:"^5.1.6",pg:"^8.16.3",typescript:"^7.0.2",typescript5:"npm:typescript@^5.9.3",zod:"4.3.6"},homepage:"https://github.com/decocms/studio",keywords:["mcp","model-context-protocol","ai","gateway","self-hosted","tools"],license:"MIT",publishConfig:{access:"public"}}});function xy6(){let $=process.env.POSTHOG_KEY;if(!$)return null;return{key:$,host:process.env.POSTHOG_HOST??by6}}var E88,by6="https://ph.studio.decocms.com",z88;var P88=D(()=>{X8();xo();Mx();D9();U$();PW1();w88();E88=new X1;E88.get("/",($)=>{let Z={version:j88.version,theme:r0$(),...NK().logo&&{logo:NK().logo},...uB()&&{internalUrl:Il1()},...E0().enableDecoImport&&{enableDecoImport:!0},brandExtractEnabled:!!E0().firecrawlApiKey,hostingEnabled:!!E0().controlplaneRestUrl&&!!E0().controlplaneServiceToken,hostingControlPlaneGa:E0().hostingControlPlaneGa,monitorEnabled:!!E0().clickhouseAnalyticsUrl&&!!E0().clickhouseAnalyticsPassword,monitorGa:E0().monitorGa,plansEnabled:E0().plansEnabled,auth:fr$(),posthog:xy6(),googleMapsApiKey:process.env.GOOGLE_MAPS_API_KEY?.trim()||null,runtime:{agentSandbox:TO()}};return $.header("Cache-Control","no-store"),$.json({success:!0,config:Z})});z88=E88});function nm($){let Z=($??"").trim().toLowerCase();return Z=Z.replace(/^https?:\/\//,""),Z=Z.replace(/^www\./,""),Z=Z.split(/[/?#]/)[0]??"",Z.replace(/\/+$/,"")}function aH1($){return(nm($).split(".")[0]||$).replace(/[-_]/g," ").split(" ").filter(Boolean).map((Q)=>Q.charAt(0).toUpperCase()+Q.slice(1)).join(" ")}function T88($,Z=64){return`https://www.google.com/s2/favicons?domain=${encodeURIComponent(nm($))}&sz=${Z}`}function A88($,Z){let Q=$.trim();if(Q.length<=Z)return Q;let X=Q.slice(0,Z-1),Y=X.lastIndexOf(" ");return`${(Y>Z*0.6?X.slice(0,Y):X).trimEnd()}\u2026`}function R88($){let{brand:Z,domain:Q,score:X,verdict:Y}=$,J=typeof X==="number"?`${Z} commerce report \u2014 ${Math.round(X)}/100 \xB7 decocms`:`${Z} commerce report \xB7 decocms`,G=`See the full ${Z} scorecard \u2014 SEO, performance, conversion & AEO signals scored by decocms.`,W=Y?.trim()?A88(`${Y.trim().replace(/\s+/g," ")} \u2014 ${G}`,200):A88(`How does ${Q} really perform? ${G}`,200);return{title:J,description:W}}import{z as p0}from"zod";var yf,fy6,yy6,gy6,hy6,q88;var M88=D(()=>{yf=p0.enum(["good","bad","neutral"]),fy6=p0.preprocess(($)=>{if(Array.isArray($))return{kind:"text",value:$.find((Q)=>Q!==null&&typeof Q!=="object")??""};return $!==null&&typeof $==="object"?$:{kind:"text",value:$}},p0.object({kind:p0.enum(["text","number","sparkline","badge","score"]).catch("text"),value:p0.coerce.string().optional(),tone:yf.optional(),muted:p0.boolean().optional(),delta:p0.coerce.string().optional(),deltaDir:p0.enum(["up","down","neutral"]).optional(),points:p0.array(p0.coerce.number()).optional(),label:p0.coerce.string().optional()}).transform(($)=>{if($.kind==="badge"&&$.label==null)$.label=$.value??"";if($.kind==="score"){let Z=Number($.value);if(Number.isNaN(Z))return{...$,kind:"text"}}return $})),yy6=p0.preprocess(($)=>{let Z=$;if(Z&&typeof Z==="object"&&!Array.isArray(Z)&&Array.isArray(Z.cells))Z=Z.cells;if(Array.isArray(Z)&&Z.length===1&&Array.isArray(Z[0]))Z=Z[0];if(Array.isArray(Z))return Z;if(Z&&typeof Z==="object")return Object.values(Z);return Z},p0.array(fy6)),gy6={key:p0.coerce.string(),title:p0.coerce.string(),eyebrow:p0.coerce.string().optional(),headline:p0.coerce.string(),annotation:p0.coerce.string().optional(),methodology:p0.coerce.string().optional(),sources:p0.array(p0.object({name:p0.coerce.string(),logoUrl:p0.coerce.string()})).optional()},hy6=p0.discriminatedUnion("template",[p0.object({template:p0.literal("cover"),score:p0.object({value:p0.coerce.number(),max:p0.coerce.number().optional(),grade:p0.coerce.string().optional(),label:p0.coerce.string().optional()}).optional(),brandImage:p0.coerce.string().optional(),screenshot:p0.coerce.string().optional(),mobileScreenshot:p0.coerce.string().optional()}),p0.object({template:p0.literal("cta"),ctaUrl:p0.coerce.string().optional(),ctaLabel:p0.coerce.string().optional(),bullets:p0.array(p0.coerce.string()).optional()}),p0.object({template:p0.literal("series"),points:p0.array(p0.coerce.number()).min(2),xLabels:p0.array(p0.coerce.string()).min(1),unit:p0.coerce.string().optional(),callout:p0.object({index:p0.coerce.number(),value:p0.coerce.string(),tone:yf.optional()})}),p0.object({template:p0.literal("threshold"),value:p0.coerce.string().default(""),metricLabel:p0.coerce.string().optional(),ratio:p0.coerce.number(),thresholdRatio:p0.coerce.number().optional(),thresholdLabel:p0.coerce.string().default(""),tone:yf.optional()}),p0.object({template:p0.literal("stats"),stats:p0.array(p0.object({value:p0.coerce.string(),label:p0.coerce.string(),tone:yf.optional()})).min(1)}),p0.object({template:p0.literal("bars"),items:p0.array(p0.object({value:p0.coerce.string(),label:p0.coerce.string(),ratio:p0.coerce.number(),tone:yf.optional()})).min(1)}),p0.object({template:p0.literal("gauges"),gauges:p0.array(p0.object({label:p0.coerce.string(),value:p0.coerce.string(),status:p0.enum(["good","warn","bad"]).catch("warn"),caption:p0.coerce.string().optional(),ratio:p0.coerce.number().optional()})).min(1)}),p0.object({template:p0.literal("checklist"),checks:p0.array(p0.object({label:p0.coerce.string(),status:p0.enum(["pass","fail","warn"]).catch("fail"),value:p0.coerce.string().optional()})).min(1)}),p0.object({template:p0.literal("table"),columns:p0.array(p0.object({label:p0.coerce.string(),align:p0.enum(["left","right"]).optional()})).min(1),rows:p0.array(yy6).min(1),highlightRow:p0.coerce.number().optional()}),p0.object({template:p0.literal("products"),products:p0.array(p0.object({name:p0.coerce.string(),price:p0.coerce.string().optional(),image:p0.coerce.string().optional(),url:p0.coerce.string().optional()})).min(1)}),p0.object({template:p0.literal("list"),entries:p0.array(p0.object({label:p0.coerce.string(),severity:p0.enum(["error","warning","notice"]).catch("notice")})).min(1),moreCount:p0.coerce.number().optional()}),p0.object({template:p0.literal("keywords"),volumeLabel:p0.coerce.string().optional(),keywords:p0.array(p0.object({term:p0.coerce.string(),volume:p0.coerce.string(),position:p0.coerce.number().catch(0)})).min(1)}),p0.object({template:p0.literal("competitor"),metricLabel:p0.coerce.string().optional(),competitors:p0.array(p0.object({name:p0.coerce.string(),value:p0.coerce.string(),tone:yf.optional(),isYou:p0.boolean().optional()})).min(1)}),p0.object({template:p0.literal("scorecard"),rivalLabel:p0.coerce.string().optional(),dimensions:p0.array(p0.object({label:p0.coerce.string(),you:p0.coerce.string(),rival:p0.coerce.string().optional(),rivalName:p0.coerce.string().optional(),tone:yf.optional()})).min(1)})]),q88=p0.object({...gy6,template:hy6})});function Hk0($){let Z=[],Q=[...$.sections].sort((Y,J)=>Y.position-J.position).map((Y)=>{let J=q88.safeParse(Y.props);if(J.success)return J.data;let G=J.error.issues[0];return Z.push({section_type:Y.section_type,position:Y.position,reason:G?`${G.path.join(".")||"(root)"}: ${G.message}`:"contract violation"}),null}).filter((Y)=>Y!==null),X=Q.filter((Y)=>Y.template.template!=="cover"&&Y.template.template!=="cta").map((Y)=>({key:Y.key,title:Y.title}));return{deck:{meta:{...$.meta,scores:$.summary?.scores,scannedAt:$.scanned_at,toc:X},slides:Q},drops:Z}}var sH1=D(()=>{M88()});import{join as I88}from"path";async function ly6($){try{let Z=await fetch(`${RF({})}/api/v2/public/diagnostics/${encodeURIComponent($)}`,{headers:{Accept:"application/json"},signal:AbortSignal.timeout(uy6)});if(!Z.ok)return null;let Q=await Z.json(),{deck:X}=Hk0(Q);if(!X.slides.length)return null;let Y=X.slides.find((W)=>W.template.template==="cover"),J=Y?.template,G=J&&J.template==="cover"?J:void 0;return{brand:X.meta.brand?.trim()||aH1($),score:X.meta.scores?.cover??G?.score?.value,verdict:Y?.annotation?.trim()||Y?.headline?.trim()||void 0}}catch{return null}}function aG($){return $.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;")}function cy6($,Z){let Q=nm($),X=Z?.brand?.trim()||aH1(Q),Y=T88(Q,128),G=`${(E0().baseUrl??"https://studio.decocms.com").replace(/\/+$/,"")}/report/${encodeURIComponent(Q)}`,{title:W,description:K}=R88({brand:X,domain:Q,score:Z?.score,verdict:Z?.verdict}),H=`${G}/og.png`,F=`${X} commerce report by decocms`;return[`<title>${aG(W)}</title>`,`<meta name="description" content="${aG(K)}" />`,'<meta name="robots" content="noindex, follow" />','<meta property="og:type" content="website" />','<meta property="og:site_name" content="decocms" />',`<meta property="og:title" content="${aG(W)}" />`,`<meta property="og:description" content="${aG(K)}" />`,`<meta property="og:url" content="${aG(G)}" />`,`<meta property="og:image" content="${aG(H)}" />`,'<meta property="og:image:width" content="1200" />','<meta property="og:image:height" content="630" />',`<meta property="og:image:alt" content="${aG(F)}" />`,'<meta name="twitter:card" content="summary_large_image" />',`<meta name="twitter:title" content="${aG(W)}" />`,`<meta name="twitter:description" content="${aG(K)}" />`,`<meta name="twitter:image" content="${aG(H)}" />`,`<meta name="twitter:image:alt" content="${aG(F)}" />`,`<link rel="canonical" href="${aG(G)}" />`,`<link rel="icon" href="${aG(Y)}" sizes="any" />`].join(`
3365
3365
  `)}function dy6($,Z){return $.replace(/<title>[\s\S]*?<\/title>\s*/i,"").replace(/<meta\s+name="(?:description|twitter:[^"]*)"[^>]*>\s*/gi,"").replace(/<meta\s+property="og:[^"]*"[^>]*>\s*/gi,"").replace(/<link\s+rel="icon"[^>]*>\s*/gi,"").replace("</head>",` ${Z}
3366
3366
  </head>`)}function V88($){let Z=new X1;return Z.get("/:domain/og.png",async(Q)=>{let X=nm(Q.req.param("domain")),Y=async()=>{let J=$?Bun.file(I88($,"report-og-fallback.png")):null;if(!J||!await J.exists())return Q.notFound();return Q.body(new Uint8Array(await J.arrayBuffer()),200,{"Content-Type":"image/png","Cache-Control":"public, max-age=0, s-maxage=3600"})};try{let J=await fetch(`${RF({})}/api/v2/public/diagnostics/${encodeURIComponent(X)}/og.png`,{signal:AbortSignal.timeout(my6)}),G=J.headers.get("content-type")??"";if(!J.ok||!G.startsWith("image/")||!J.body)return Y();return Q.body(J.body,200,{"Content-Type":G,"Cache-Control":"public, max-age=0, s-maxage=604800"})}catch{return Y()}}),Z.get("/:domain",async(Q)=>{let X=Q.req.param("domain"),Y=$?I88($,"index.html"):null,J=Y?Bun.file(Y):null;if(!J||!await J.exists())return Q.notFound();let G=await J.text();try{let W=await ly6(nm(X)),K=cy6(X,W);return Q.html(dy6(G,K),200,{"Cache-Control":"public, max-age=0, s-maxage=300"})}catch{return Q.html(G)}}),Z}var uy6=2500,my6=1e4;var k88=D(()=>{X8();sH1();iP();U$()});function I80($,Z){return fetch(`${RF({})}${$}`,Z)}async function iy6($,Z,Q){let X=new URLSearchParams;if(Z)X.set("pw",Z);if(Q)X.set("lang",Q);let Y=X.toString()?`?${X.toString()}`:"",J=await I80(`/api/v2/public/diagnostics/${encodeURIComponent($)}${Y}`,{headers:{Accept:"application/json"}});if(J.status===404)return{status:"not_found",deck:null,scanned_at:null,drops:[]};if(!J.ok)throw Error(`report read HTTP ${J.status}`);let G=await J.json(),{deck:W,drops:K}=Hk0(G);return{status:W.slides.length?"ready":"empty",deck:W,scanned_at:G.scanned_at,drops:K}}var py6,BO,S88=async($,Z)=>{if(!$.get("reportUser"))return $.json({error:"Authentication required"},401);await Z();return},C88;var _88=D(()=>{X8();qG();iP();sH1();py6=new Set(["complete","errored","terminated","unknown"]),BO=new X1;BO.use("*",async($,Z)=>{let Q=await V8.api.getSession({headers:$.req.raw.headers});$.set("reportUser",Q?.user?.id?{email:Q.user.email}:void 0),await Z(),$.header("Cache-Control","private, no-store"),$.header("Vary","Cookie");return});BO.use("/link-token/*",S88);BO.use("/suggest",S88);BO.get("/site/:domain",async($)=>{let Z=$.req.param("domain").trim();if(!Z)return $.json({error:"domain is required"},400);let Q=$.get("reportUser"),X=$.req.query("key")?.trim()||void 0,Y=$.req.query("lang")?.trim()||void 0;try{let J=await iy6(Z,X,Y);if($.header("Cache-Control","private, no-store"),Q||!J.deck)return $.json(J);return $.json({...J,deck:{...J.deck,slides:J.deck.slides.slice(0,1)},truncated:J.status==="ready"})}catch{return $.json({error:"report read failed"},502)}});BO.post("/run",async($)=>{let Z=$.get("reportUser"),Q;try{Q=await $.req.json()}catch{return $.json({error:"invalid JSON"},400)}let X=typeof Q.domain==="string"?Q.domain.trim():"";if(!X)return $.json({error:"domain is required"},400);let Y=Z?.email,J=typeof Q.distinctId==="string"&&Q.distinctId.trim()&&Q.distinctId.length<=200?Q.distinctId.trim():void 0;try{let G=await I80("/api/v2/diagnostics/run",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${mP({})}`},body:JSON.stringify({url:X,...Y?{email:Y}:{},distinct_id:J})});if(!G.ok)return $.json({error:`run HTTP ${G.status}`},502);let W=await G.json(),K=W.blocked?{state:"blocked"}:W.status==="fresh"?{state:"fresh"}:W.mode==="sync"?{state:"sync"}:{state:"running",id:W.id??null};return $.json(K)}catch{return $.json({error:"run failed"},502)}});BO.get("/status",async($)=>{let Z=$.req.query("id");if(!Z)return $.json({error:"id is required"},400);try{let Q=await I80(`/api/v2/diagnostics/status?id=${encodeURIComponent(Z)}`,{headers:{Authorization:`Bearer ${mP({})}`}});if(!Q.ok)return $.json({error:`status HTTP ${Q.status}`},502);let Y=(await Q.json()).status??"unknown",J={done:py6.has(Y),status:Y};return $.json(J)}catch{return $.json({error:"status failed"},502)}});BO.get("/link-token/:id",async($)=>{let Z=$.req.param("id");try{let Q=await I80(`/api/v2/public/link-tokens/${encodeURIComponent(Z)}`,{headers:{Accept:"application/json"}});if(Q.status===404)return $.json(null);if(!Q.ok)return $.json({error:`link token HTTP ${Q.status}`},502);return $.json(await Q.json())}catch{return $.json({error:"link token resolve failed"},502)}});BO.get("/suggest",async($)=>{let Z=($.req.query("q")??"").trim().slice(0,64);if(Z.length<2)return $.json({suggestions:[]});try{let Q=await I80(`/api/v2/public/suggest?q=${encodeURIComponent(Z)}`,{headers:{Accept:"application/json"}});if(!Q.ok)return $.json({suggestions:[]});let X=await Q.json();return $.json({suggestions:Array.isArray(X.suggestions)?X.suggestions:[]})}catch{return $.json({suggestions:[]})}});C88=BO});var ny6=1048576,eH1;var v88=D(()=>{X8();FH();U$();GW1();eH1=new X1;eH1.post("/webhook",H9({maxSize:ny6,onError:($)=>$.json({error:"payload too large"},413)}),async($)=>{let Z=E0().stripeWebhookSecret;if(!Z)return $.json({error:"stripe billing not configured"},503);let Q=await $.req.text();if(!oo$(Q,$.req.header("stripe-signature"),Z))return $.json({error:"invalid signature"},400);let Y=ro$(Q);if(!Y)return $.json({error:"invalid payload"},400);let J=await ao$(Y);return console.log("stripe webhook",{eventId:Y.id,type:Y.type,livemode:Y.livemode,...J}),$.json({received:!0})})});import{timingSafeEqual as ty6}from"crypto";function ay6($,Z,Q){if(!Z?.startsWith("sha256="))return!1;let X=new Bun.CryptoHasher("sha256",Q).update($).digest("hex"),Y=Z.slice(7);if(Y.length!==X.length)return!1;return ty6(Buffer.from(Y),Buffer.from(X))}function sy6($,Z){let Q=Z,X=Q?.repository?.name,Y=Q?.repository?.owner?.login;if(typeof X!=="string"||typeof Y!=="string")return[];let J=[];if($==="check_suite"){if(Q.action!=="completed")return[];let G=Q.check_suite?.pull_requests;for(let W of Array.isArray(G)?G:[]){let K=W?.number;if(typeof K==="number")J.push(K)}}else if($==="issue_comment"&&Q.issue?.pull_request){let G=Q.issue.number;if(typeof G==="number")J.push(G)}return[...new Set(J)].map((G)=>({repoOwner:Y,repoName:X,number:G}))}function b88($){let Z=new X1;return Z.post("/webhook",H9({maxSize:oy6,onError:(Q)=>Q.json({error:"payload too large"},413)}),async(Q)=>{let X=process.env.GITHUB_WEBHOOK_SECRET;if(!X)return Q.json({error:"github webhook not configured"},503);let Y=await Q.req.text();if(!ay6(Y,Q.req.header("x-hub-signature-256"),X))return Q.json({error:"invalid signature"},400);let J=Q.req.header("x-github-event");if(J!=="push"&&!ry6.has(J??""))return Q.json({ok:!0,ignored:"event"});let G;try{G=JSON.parse(Y)}catch{return Q.json({error:"invalid payload"},400)}if(J==="push"){let H=G.ref,F=G.repository?.full_name;if(!H||!F)return Q.json({ok:!0,ignored:"shape"});let N=(await f81())?.markTenantPoolsDirty(F,H)??[];return Q.json({ok:!0,pools:N})}let W=sy6(J??"",G);if(W.length===0)return Q.json({ok:!0,ignored:"no-pr"});let K=await ey6($,W);return Q.json({ok:!0,refreshed:K})}),Z}async function ey6($,Z){let Q=0;for(let X of Z){let Y=$.taskBoard(),J;try{J=await Y.findPrLinks(X)}catch(G){console.error("[github-webhook] pr link lookup failed:",G);continue}for(let G of J)try{let W=await Y.getById(G.taskBoardItemId,G.organizationId),K=W?await $.contextFactory()(G.organizationId,W.assignedBy??W.createdBy):null;if(!K)continue;if(await BI$(K,G.organizationId,G.taskBoardItemId)!==null)Q++}catch(W){console.error(`[github-webhook] pr card refresh failed for ${G.taskBoardItemId}:`,W)}}return Q}var oy6=5242880,ry6;var x88=D(()=>{X8();FH();dK();L7();ry6=new Set(["check_suite","issue_comment"])});function f88($){let Z=new ZO($.db,new sJ($.encryptionKey)),Q=new X1;return Q.get("/attachments/:token",async(X)=>{let Y=Cq$(X.req.param("token"));if(!Y)return X.json({error:"Invalid or expired link"},404);let J=await Z.getByOrg(Y.organizationId);if(!J)return X.json({error:"Jira is not connected"},404);let W=await new LY(J.siteUrl,J.email,J.apiToken).downloadAttachment(Y.attachmentId);if(!W.ok||!W.body)return X.json({error:"Jira refused the download"},502);let K=new Headers;for(let H of["content-type","content-length","content-disposition"]){let F=W.headers.get(H);if(F)K.set(H,F)}return K.set("cache-control","no-store"),new Response(W.body,{status:200,headers:K})}),Q}var y88=D(()=>{X8();Gz();l61();Gj()});function g88($){let Z=new ZO($.db,new sJ($.encryptionKey));async function Q(Y,J){let G=di$(J);if(!G)return;let W=await Z.getByWebhookSecret(Y);if(!W?.enabled)return;let K=await HW($.db,W.organizationId);if(!K)return;if(await rM0(K,W,G)==="started")console.log(`[jira-webhook] started a run for ${G.issueKey} entering "${G.toStatus}"`)}let X=new X1;return X.post("/webhook/:secret",H9({maxSize:$g6}),async(Y)=>{let J=Y.req.param("secret");if(!await Z.getByWebhookSecret(J))return Y.json({error:"Unknown webhook"},404);let W;try{W=await Y.req.json()}catch{return Y.json({error:"Body must be JSON"},400)}return Q(J,W).catch((K)=>{console.error("[jira-webhook] trigger failed",K)}),Y.body(null,202)}),X}var $g6=1048576;var h88=D(()=>{X8();FH();Gz();aM0();zx()});import{DBOS as Fk0,SchedulerMode as Zg6}from"@dbos-inc/dbos-sdk";function l88($){ZF1=$}function c88(){if(!ZF1)throw Error("[jira-trigger] runtime not initialized \u2014 setJiraTriggerSweepRuntime() must run before the workflow fires");return ZF1}function d88(){let $=c88();return new ZO($.db,new sJ($.encryptionKey))}async function Yg6($,Z){try{let Q=await d88().getById($);if(!Q?.enabled||!Q.boardId)return{integrationId:$,started:0};let X=await HW(c88().db,Q.organizationId);if(!X)return{integrationId:$,started:0};if((await X.storage.jiraIntegrations.listAutomations(Q.organizationId)).length===0)return{integrationId:$,started:0};let J=new LY(Q.siteUrl,Q.email,Q.apiToken),W=`(${await J.getBoardScopeJql(Q.boardId)}) AND status CHANGED AFTER "-${u88}m"`,K=0,H;for(let F=0;F<Xg6;F++){let U=await J.searchIssues({jql:W,nextPageToken:H,expandChangelog:!0});for(let N of U.issues){let B=mi$(N,N.changelog?.histories??[],Z);for(let O of B)if(await rM0(X,Q,O)==="started")K++}if(H=U.nextPageToken??void 0,!H)break}return{integrationId:$,started:K}}catch(Q){return{integrationId:$,started:0,error:Q instanceof Error?Q.message:String(Q)}}}async function Jg6($,Z){let Q=new Date($.getTime()-u88*60000),X=await Fk0.runStep(()=>d88().listEnabledIds(),{name:"loadJiraIntegrations"});if(X.length===0)return;let Y=await Promise.all(X.map((J)=>Fk0.runStep(()=>Yg6(J,Q),{name:`sweepJira:${J}`})));for(let J of Y)if(J.error)console.warn(`[jira-trigger] integration ${J.integrationId} failed: ${J.error}`);else if(J.started>0)console.log(`[jira-trigger] integration ${J.integrationId} started ${J.started} run(s) the webhook missed`)}function m88(){if($F1)return;$F1=Fk0.registerWorkflow(Jg6,{name:"jiraTriggerSweepWorkflow"}),Fk0.registerScheduled($F1,{name:"jiraTriggerSweepWorkflow",crontab:Qg6,mode:Zg6.ExactlyOncePerIntervalWhenActive})}var Qg6="7-59/10 * * * *",u88=15,Xg6=5,ZF1=null,$F1=null;var i88=D(()=>{Gz();zx();Gj();aM0()});function p88($,Z){if(Z.startsWith("text/html")||Z.startsWith("image/svg"))$.set("Content-Security-Policy","sandbox allow-scripts allow-modals allow-same-origin")}var n88,Gg6,Wg6,t88;var o88=D(()=>{X8();UK();rc();Rl();n88=new X1,Gg6=["range","if-none-match","if-modified-since"],Wg6=["content-type","content-length","content-range","accept-ranges","etag","last-modified"];n88.get("/:org/files/*",async($)=>{let Z=$.get("studioContext"),Q=Z.organization?.id;if(!Z.auth?.user?.id){if(Lm($))return $.redirect(`/login?next=${encodeURIComponent($.req.path)}`,302);throw new P$(401,{message:"Authentication required"})}if(!Q)throw new P$(401,{message:"Organization context required"});let X=$.req.path.replace(/^.*\/files\//,"");if(!X)throw new P$(400,{message:"Missing file key"});let Y=await c00(X,Z);if(!Y)throw new P$(503,{message:"Object storage not configured"});if(Y.startsWith("data:")&&p3()){let K=Y.match(/^data:([^;]+);base64,(.+)$/s);if(!K)throw new P$(500,{message:"Invalid data URL from storage"});let[,H,F]=K,U=Buffer.from(F,"base64"),N=new Headers({"Content-Type":H,"Cache-Control":"private, max-age=86400"});return p88(N,H),new Response(U,{status:200,headers:N})}let J=new Headers;for(let K of Gg6){let H=$.req.header(K);if(H)J.set(K,H)}let G=await fetch(Y,{headers:J});if(G.status===403||G.status===404)throw new P$(404,{message:"File not found"});if(!G.ok&&G.status!==304&&G.status!==416)throw console.error(`[files] upstream storage error ${G.status} for key:`,X),new P$(502,{message:"Upstream storage error"});let W=new Headers;for(let K of Wg6){let H=G.headers.get(K);if(H)W.set(K,H)}return W.set("Cache-Control","private, max-age=86400"),p88(W,W.get("content-type")??""),new Response(G.body,{status:G.status,headers:W})});t88=n88});var V80=b((gf)=>{var Kg6=gf&&gf.__createBinding||(Object.create?function($,Z,Q,X){if(X===void 0)X=Q;var Y=Object.getOwnPropertyDescriptor(Z,Q);if(!Y||("get"in Y?!Z.__esModule:Y.writable||Y.configurable))Y={enumerable:!0,get:function(){return Z[Q]}};Object.defineProperty($,X,Y)}:function($,Z,Q,X){if(X===void 0)X=Q;$[X]=Z[Q]}),Hg6=gf&&gf.__exportStar||function($,Z){for(var Q in $)if(Q!=="default"&&!Object.prototype.hasOwnProperty.call(Z,Q))Kg6(Z,$,Q)};Object.defineProperty(gf,"__esModule",{value:!0});Hg6(cJ(),gf)});var s88=b((r88)=>{Object.defineProperty(r88,"__esModule",{value:!0});r88.version=void 0;r88.version="3.4.0"});var Z48=b((kU)=>{var Fg6=kU&&kU.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(kU,"__esModule",{value:!0});kU.NodeTransport=kU.VERSION=void 0;kU.nodeResolveHost=Lg6;var g5=V80(),Ug6=q0("net"),QF1=q0("tls"),Ng6=q0("path"),e88=q0("fs"),Bg6=Fg6(q0("dns")),Og6=s88();kU.VERSION=Og6.version;var Dg6="nats.js";class $48{socket;version;lang;yields=[];signal=(0,g5.deferred)();closedNotification=(0,g5.deferred)();options;connected=!1;tlsName="";done=!1;closeError;constructor(){this.lang=Dg6,this.version=kU.VERSION}async connect($,Z){this.tlsName=$.tlsName,this.options=Z;let{tls:Q}=this.options,{handshakeFirst:X}=Q||{};try{if(X===!0)this.socket=await this.tlsFirst($);else this.socket=await this.dial($);if(this.done)this.socket?.destroy();let Y=await this.peekInfo();(0,g5.checkOptions)(Y,Z);let{tls_required:J,tls_available:G}=Y,W=G===!0&&Z.tls!==null;if(!X&&(J||W))this.socket=await this.startTLS();if(this.done)this.socket?.destroy();if(J&&this.socket.encrypted!==!0)throw g5.errors.InvalidArgumentError.format("tls","is not available on this server");return this.connected=!0,this.setupHandlers(),this.signal.resolve(),Promise.resolve()}catch(Y){let J=Y;if(!J)J=new g5.errors.ConnectionError("error connecting - node provided an undefined error");let{code:G}=J,W=G==="ECONNREFUSED"?new g5.errors.ConnectionError("connection refused",{cause:J}):J;throw this.socket?.destroy(),W}}dial($){let Z=(0,g5.deferred)(),Q,X=(0,Ug6.createConnection)($.port,$.hostname,()=>{Z.resolve(X),X.removeAllListeners()});return X.on("error",(Y)=>{Q=Y}),X.on("close",()=>{X.removeAllListeners(),Z.reject(Q)}),X.setNoDelay(!0),Z}get isClosed(){return this.done}close($){return this._closed($,!1)}peekInfo(){let $=(0,g5.deferred)(),Z;return this.socket.on("data",(Q)=>{this.yields.push(Q);let X=g5.DataBuffer.concat(...this.yields),Y=(0,g5.extractProtocolMessage)(X);if(Y!=="")try{let J=g5.INFO.exec(Y);if(!J)throw Error("unexpected response from server");let G=JSON.parse(J[1]);$.resolve(G)}catch(J){$.reject(J)}finally{this.socket.removeAllListeners()}}),this.socket.on("error",(Q)=>{Z=Q}),this.socket.on("close",()=>{this.socket.removeAllListeners(),$.reject(Z)}),$}loadFile($){if(!$)return Promise.resolve();let Z=(0,g5.deferred)();try{if($=(0,Ng6.resolve)($),!(0,e88.existsSync)($))Z.reject(Error(`${$} doesn't exist`));(0,e88.readFile)($,(Q,X)=>{if(Q)return Z.reject(Q);Z.resolve(X)})}catch(Q){Z.reject(Q)}return Z}async loadClientCerts(){let $={},{certFile:Z,cert:Q,caFile:X,ca:Y,keyFile:J,key:G}=this.options.tls;try{if(Z){let W=await this.loadFile(Z);if(W)$.cert=W}else if(Q)$.cert=Q;if(J){let W=await this.loadFile(J);if(W)$.key=W}else if(G)$.key=G;if(X){let W=await this.loadFile(X);if(W)$.ca=[W]}else if(Y)$.ca=Y;return Promise.resolve($)}catch(W){return Promise.reject(W)}}async tlsFirst($){let Z,Q={servername:this.tlsName,rejectUnauthorized:!0};if(this.socket)Q.socket=this.socket;if(typeof this.options.tls==="object")try{let Y=await this.loadClientCerts()||{};Q=(0,g5.extend)(Q,this.options.tls,Y)}catch(Y){return Promise.reject(new g5.errors.ConnectionError(Y.message,{cause:Y}))}let X=(0,g5.deferred)();try{let Y=(0,QF1.connect)($.port,$.hostname,Q,()=>{Y.removeAllListeners(),X.resolve(Y)});Y.on("error",(J)=>{Z=J}),Y.on("secureConnect",()=>{if(Q.rejectUnauthorized===!1)return;if(!Y.authorized)throw Y.authorizationError}),Y.on("close",()=>{X.reject(Z),Y.removeAllListeners()}),Y.setNoDelay(!0)}catch(Y){X.reject(new g5.errors.ConnectionError(Y.message,{cause:Y}))}return X}async startTLS(){let $,Z={socket:this.socket,servername:this.tlsName,rejectUnauthorized:!0};if(typeof this.options.tls==="object")try{let X=await this.loadClientCerts()||{};Z=(0,g5.extend)(Z,this.options.tls,X)}catch(X){return Promise.reject(new g5.errors.ConnectionError(X.message,{cause:X}))}let Q=(0,g5.deferred)();try{let X=(0,QF1.connect)(Z,()=>{X.removeAllListeners(),Q.resolve(X)});X.on("error",(Y)=>{$=Y}),X.on("secureConnect",()=>{if(Z.rejectUnauthorized===!1)return;if(!X.authorized)throw X.authorizationError}),X.on("close",()=>{Q.reject($),X.removeAllListeners()})}catch(X){Q.reject(new g5.errors.ConnectionError(X.message,{cause:X}))}return Q}setupHandlers(){let $;this.socket.on("data",(Z)=>{return this.yields.push(Z),this.signal.resolve()}),this.socket.on("error",(Z)=>{$=Z}),this.socket.on("end",()=>{if(this.socket?.destroyed)return;this.socket?.write(new Uint8Array(0),()=>{this.socket?.end()})}),this.socket.on("close",()=>{this._closed($,!1)})}[Symbol.asyncIterator](){return this.iterate()}async*iterate(){while(!0){if(this.yields.length===0)await this.signal;let $=this.yields;this.yields=[];for(let Z=0;Z<$.length;Z++){if(this.options.debug)console.info(`> ${(0,g5.render)($[Z])}`);yield $[Z]}if(this.done)break;else if(this.yields.length===0)$.length=0,this.yields=$,this.signal=(0,g5.deferred)()}}discard(){if(this.done=!0,this.socket)try{this.socket.removeAllListeners(),this.socket.destroy()}catch{}}disconnect(){this._closed(void 0,!0).then().catch()}isEncrypted(){return this.socket instanceof QF1.TLSSocket}_send($){if(this.isClosed||this.socket===void 0)return Promise.resolve();if(this.options.debug)console.info(`< ${(0,g5.render)($)}`);let Z=(0,g5.deferred)();try{this.socket.write($,(Q)=>{if(Q){if(this.options.debug)console.error(`!!! ${(0,g5.render)($)}: ${Q}`);return Z.reject(Q)}return Z.resolve()})}catch(Q){if(this.options.debug)console.error(`!!! ${(0,g5.render)($)}: ${Q}`);Z.reject(Q)}return Z}send($){this._send($).catch((Q)=>{})}async _closed($,Z=!0){if(!this.connected)return;if(this.done){this.socket?.destroy();return}if(this.closeError=$,!$&&this.socket&&Z)try{await this._send(new TextEncoder().encode(""))}catch(Q){if(this.options.debug)console.log("transport close terminated with an error",Q)}try{if(this.socket)this.socket.removeAllListeners(),this.socket?.destroy(),this.socket=void 0}catch(Q){console.log(Q)}this.done=!0,this.closedNotification.resolve(this.closeError)}closed(){return this.closedNotification}}kU.NodeTransport=$48;function Lg6($){let Z=(0,g5.deferred)();return Bg6.default.lookup($,{all:!0},(Q,X)=>{if(Q){Z.reject(Q);return}let Y=[];for(let J of X)Y.push(J.address);if(Y.length===0)Y.push($);Z.resolve(Y)}),Z}});var G48=b((J48)=>{Object.defineProperty(J48,"__esModule",{value:!0});J48.connect=wg6;var Q48=Z48(),X48=V80(),Y48=V80();function wg6($={}){if((0,Y48.hasWsProtocol)($))return Promise.reject(Y48.errors.InvalidArgumentError.format("servers","node client doesn't support websockets, use the 'wsconnect' function instead"));return(0,X48.setTransportFactory)({factory:()=>{return new Q48.NodeTransport},dnsResolveFn:Q48.nodeResolveHost}),X48.NatsConnectionImpl.connect($)}});var W48=b((OO)=>{var Eg6=OO&&OO.__createBinding||(Object.create?function($,Z,Q,X){if(X===void 0)X=Q;var Y=Object.getOwnPropertyDescriptor(Z,Q);if(!Y||("get"in Y?!Z.__esModule:Y.writable||Y.configurable))Y={enumerable:!0,get:function(){return Z[Q]}};Object.defineProperty($,X,Y)}:function($,Z,Q,X){if(X===void 0)X=Q;$[X]=Z[Q]}),zg6=OO&&OO.__exportStar||function($,Z){for(var Q in $)if(Q!=="default"&&!Object.prototype.hasOwnProperty.call(Z,Q))Eg6(Z,$,Q)};Object.defineProperty(OO,"__esModule",{value:!0});OO.connect=void 0;var Pg6=G48();Object.defineProperty(OO,"connect",{enumerable:!0,get:function(){return Pg6.connect}});zg6(V80(),OO)});function U48($){let Z=$?.connectFn??qg6,Q=null,X=null,Y=!1,J=!1,G=!1,W=[];function K(){return Q!==null&&!Q.isClosed()&&!Q.isDraining()&&!G}function H(){console.log(`[NatsProvider] fireReady: ${W.length} callbacks`);for(let N of W)try{N()}catch{}}function F(N){(async()=>{for await(let B of N.status())if(B.type==="disconnect")console.log("[NatsProvider] Disconnected"),G=!0;else if(B.type==="reconnect")console.log("[NatsProvider] Reconnected, re-firing ready callbacks"),G=!1,X=null,H()})().catch(()=>{})}async function U(N,B){let O=0;while(!J)try{Q=await Z({servers:N,timeout:Rg6,reconnect:!0,maxReconnectAttempts:-1,...B?{authenticator:B}:{}}),console.log(`[NatsProvider] Connected to ${Q.getServer()} after ${O} attempt(s)`),X=null,G=!1,F(Q),H();return}catch{O++;let L=a7(Tg6,Ag6,O-1,2,0.5);await c$(L)}}return{init(N,B){if(Y)return;Y=!0,J=!1;let O=B?.creds?K48.credsAuthenticator(new TextEncoder().encode(B.creds)):void 0;U(N,O).catch(()=>{})},isConnected(){return K()},getConnection(){return K()?Q:null},getJetStream(){if(!K())return null;if(!X)X=F48.jetstream(Q);return X},onReady(N){if(W.push(N),K())try{N()}catch{}},async drain(){if(J=!0,Y=!1,X=null,G=!1,Q){let N=Q;Q=null,await N.drain().catch(()=>{})}}}}function qg6($){return H48.connect($)}var K48,H48,F48,Ag6=100,Tg6=3000,Rg6=3000;var N48=D(()=>{D8();K48=C(Ti(),1),H48=C(W48(),1),F48=C(dU(),1)});function Uk0($){let Z=$?.ttlMs??60000,Q=$?.maxSize??1e4,X=$?.updateRecencyOnGet??!1,Y=new Map;function J(){if(Y.size<=Q)return;let G=Date.now();for(let[W,K]of Y)if(K.expiresAt<=G)Y.delete(W);while(Y.size>Q){let W=Y.keys().next().value;if(W===void 0)break;Y.delete(W)}}return{get(G){let W=Y.get(G);if(!W)return;if(W.expiresAt<=Date.now()){Y.delete(G);return}if(X)Y.delete(G),Y.set(G,W);return W.value},set(G,W){Y.delete(G),Y.set(G,{value:W,expiresAt:Date.now()+Z}),J()},delete(G){Y.delete(G)},clear(){Y.clear()},size(){return Y.size}}}function Nk0($,Z){return`${$}.${Z}`}class XF1{cache;constructor($){this.cache=Uk0({ttlMs:$?.ttlMs??Mg6,maxSize:$?.maxSize??Ig6})}async get($,Z){return this.cache.get(Nk0($,Z))??null}async set($,Z,Q){this.cache.set(Nk0($,Z),Q)}async invalidate($,Z){this.cache.delete(Nk0($,Z)),this.cache.delete(Nk0($,`${Z}:decisions`))}teardown(){this.cache.clear()}}var Mg6=600000,Ig6=5000;var B48=()=>{};function Bk0($,Z){return`${$}:${Z}`}function YF1($){let Z=Uk0({ttlMs:$?.ttlMs??Vg6,maxSize:$?.maxSize??kg6}),Q=$?.getConnection,X=crypto.randomUUID(),Y=new TextEncoder,J=new TextDecoder,G=null;function W(K,H){let F=Q?.();if(!F)return;try{F.publish(O48,Y.encode(JSON.stringify({organizationId:K,keyId:H,originId:X})))}catch(U){console.warn("[ProviderKeyCache] Publish failed (non-critical):",U)}}return{get(K,H){return Z.get(Bk0(K,H))},set(K,H,F){Z.set(Bk0(K,H),F)},invalidate(K,H){Z.delete(Bk0(K,H)),W(K,H)},start(){if(G)return;let K=Q?.();if(!K)return;G=K.subscribe(O48),(async()=>{for await(let H of G)try{let F=JSON.parse(J.decode(H.data));if(F.originId===X)continue;Z.delete(Bk0(F.organizationId,F.keyId))}catch{}})().catch(console.error)},teardown(){G?.unsubscribe(),G=null,Z.clear()}}}var O48="studio.ai-provider-keys.invalidate",Vg6=30000,kg6=5000;var D48=()=>{};class JF1{options;subscription=null;onCancel=null;encoder=new TextEncoder;originId=crypto.randomUUID();constructor($){this.options=$}async start($){if($)this.onCancel=$;if(this.subscription)return;if(!this.onCancel)return;let Z=this.options.getConnection();if(!Z)return;let Q=new TextDecoder,X=Z.subscribe("studio.decopilot.cancel");this.subscription=X,(async()=>{for await(let Y of X)try{let J=JSON.parse(Q.decode(Y.data));if(J.originId===this.originId)continue;this.onCancel?.(J.taskId)}catch{}})().catch(console.error)}broadcast($){if(/[.*>\s]/.test($)){console.warn("[NatsCancelBroadcast] Invalid threadId, skipping broadcast");return}this.onCancel?.($);try{let Z=this.options.getConnection();if(!Z)return;let Q=this.encoder.encode(JSON.stringify({taskId:$,originId:this.originId}));Z.publish("studio.decopilot.cancel",Q)}catch(Z){console.warn("[NatsCancelBroadcast] Publish failed (non-critical):",Z)}}async stop(){this.subscription?.unsubscribe(),this.subscription=null,this.onCancel=null}}var L48=($)=>{let Z;return()=>Z??=$()},GF1,WF1;var w48=D(()=>{R6();GF1=L48(()=>E$.createHistogram("decopilot.stream.encode_ms",{description:"Per-chunk JSON.stringify+encode time for decopilot stream",unit:"ms"})),WF1=L48(()=>E$.createCounter("decopilot.stream.published_chunks",{description:"Logical decopilot stream chunks published to JetStream",unit:"{chunks}"}))});function fg6($=z48){return{name:YU,subjects:[`${h91}.>`],storage:BH.StorageType.File,max_age:_g6,max_bytes:bg6,max_msgs_per_subject:xg6,discard:BH.DiscardPolicy.Old,retention:BH.RetentionPolicy.Limits,duplicate_window:vg6,num_replicas:$}}class P48{chunks=0;encodeMs=0;maxMs=0;bytes=0;windowStart=performance.now();constructor(){setInterval(()=>this.flush(),1e4).unref?.()}record($,Z){if(this.chunks++,this.encodeMs+=$,$>this.maxMs)this.maxMs=$;this.bytes+=Z}flush(){let $=performance.now(),Z=$-this.windowStart;if(this.chunks>0&&Z>0)console.warn(JSON.stringify({msg:"stream-encode-trace",windowMs:Math.round(Z),chunks:this.chunks,encodeMs:Math.round(this.encodeMs),pctOfLoop:+(this.encodeMs/Z*100).toFixed(1),maxChunkMs:+this.maxMs.toFixed(2),mbEncoded:+(this.bytes/1048576).toFixed(2)}));this.chunks=0,this.encodeMs=0,this.maxMs=0,this.bytes=0,this.windowStart=$}}function j48($){let Z=E48.headers();for(let[Q,X]of Object.entries($))Z.set(Q,X);return Z}function ug6($,Z){let Q=0;return{publish(X,Y,J,G){X.publish(Y,J,G?{headers:G}:void 0).catch((W)=>{if(Q++,Cg6().add(1,{"org.id":Z??"unknown"}),Q===1||Q%100===0)console.warn(`[Decopilot] JetStream publish failed for thread ${$} (${Q} total):`,W)})},get errorCount(){return Q}}}function lg6($,Z){return $.info?.cluster?Z:1}function cg6($){if(!($ instanceof Error))return!1;if(/non-clustered/i.test($.message))return!0;return/replicas?\b/i.test($.message)&&/not supported|can ?not|exceed|insufficient|greater than/i.test($.message)}class KF1{options;js=null;jsm=null;constructor($){this.options=$}async init(){let $=this.options.getConnection();if(!$){console.log("[Decopilot] StreamBuffer.init skipped: NATS not connected yet");return}let Z=async(X,Y)=>{let J=fg6(Y);try{await X.streams.info(YU),await X.streams.update(YU,J)}catch(G){if(G instanceof Error&&G.message.includes("stream not found"))await X.streams.add(J),await X.streams.update(YU,J);else if(G instanceof Error&&/can ?not change.*storage|storage type/i.test(G.message))await X.streams.delete(YU),await X.streams.add(J);else throw G}},Q=await c8(async()=>{let X=this.options.getJetStreamManager?await this.options.getJetStreamManager():await BH.jetstreamManager($),Y=lg6($,z48);try{await Z(X,Y)}catch(J){if(Y<=1||!cg6(J))throw J;console.warn(`[Decopilot] StreamBuffer: NATS rejected num_replicas=${Y} (${J.message}); falling back to an unreplicated stream`),await Z(X,1)}return X},{maxAttempts:5,minTimeout:250,maxTimeout:4000,jitter:0.5,isRetriable:Jd});this.js=this.options.getJetStream(),this.jsm=Q,console.log(`[Decopilot] StreamBuffer.init ${this.js?"ready":"degraded (js=null)"}`)}pump($,Z,Q,X){let Y=this.js;if(!Y)return console.warn(`[Decopilot] pump: JetStream client unavailable for thread ${Z}; chunks NOT published to NATS`),Promise.resolve();let J=ug6(Z,X),G=!1,W=()=>{if(G)return;G=!0;let H=ak$(Z);Y.publish(H.subject,H.data).catch(()=>{})};Q.addEventListener("abort",W,{once:!0});let K=(H)=>{let F=performance.now(),U=l91(H,{runId:Z}),N=performance.now()-F;GF1().record(N),WF1().add(1,{"org.id":X??"unknown"}),hg6?.record(N,U.reduce((B,O)=>B+O.data.length,0));for(let B of U)J.publish(Y,B.subject,B.data,B.headers?j48(B.headers):void 0)};return(async()=>{let H=$.getReader(),F=0,U=0,N;try{while(!0){let{done:B,value:O}=await H.read();if(B)break;if(K(O),U++,++F>=64)F=0,await new Promise((L)=>setImmediate(L))}}catch(B){N=B,console.warn(`[Decopilot] stream pump error for thread ${Z}:`,B?.message??B)}finally{if(H.releaseLock(),W(),gg6)console.warn(JSON.stringify({msg:"decopilot-stream-diag",event:"pump-done",taskId:Z,publishedChunks:U,publishErrors:J.errorCount}))}if(N!==void 0)throw N})()}async publishSerialized($,Z){try{return await c8(()=>$.publish(Z.subject,Z.data,{...Z.headers?{headers:j48(Z.headers)}:{},...Z.msgId?{msgID:Z.msgId}:{}}),{maxAttempts:6,minTimeout:250,maxTimeout:5000,jitter:0.5,isRetriable:Jd}),!0}catch(Q){return console.error(`[Decopilot] publish failed after retries subject=${Z.subject}`,Q),!1}}async publishRawChunk($,Z,Q){let X=this.js;if(!X)return!1;let Y=performance.now(),J=l91(Z,{runId:$,dedup:Q});GF1().record(performance.now()-Y),WF1().add(1);for(let G of J)if(!await this.publishSerialized(X,G))return!1;return!0}async publishDone($,Z,Q){let X=this.js;if(!X)return!1;let Y=rk$({runId:$,fenceToken:Z,finalSeq:Q});return await this.publishSerialized(X,Y)}async createTailStream($,Z,Q){let X=this.js;if(!X)return console.warn(`[Decopilot] createTailStream: JetStream client unavailable for thread ${$}; no live tail`),null;let Y=Q?.deliverPolicy==="new"?BH.DeliverPolicy.New:BH.DeliverPolicy.All,J=Q?.closeOnDone??!1,G=Oj($),W;try{W=await c8(async()=>{return(await X.consumers.get(YU,{filter_subjects:G,deliver_policy:Y})).consume()},{maxAttempts:6,minTimeout:250,maxTimeout:5000,jitter:0.5,isRetriable:Jd})}catch(L){return console.warn("[Decopilot] JetStream tail unavailable (non-critical):",L?.message??L),null}let F=P20({messages:async function*(){try{for await(let L of W)yield{subject:L.subject,data:L.data,headers:L.headers}}finally{W.stop()}}(),onCancel:()=>W.stop()}).pipeThrough(w20()).pipeThrough(j20()).getReader(),U=!1,N=()=>{if(U)return;U=!0;try{F.releaseLock()}catch{}},B=!1,O=()=>{if(B)return;B=!0,W.stop(),F.cancel().catch(()=>{}),N()};return Z?.addEventListener("abort",O,{once:!0}),new ReadableStream({async pull(L){for(;;){let{done:w,value:j}=await F.read();if(w){O(),L.close();return}let E=j;if(E.kind==="done"){if(J){O(),L.close();return}continue}L.enqueue(E.chunk);return}},cancel(){O()}})}purge($){if(!this.jsm)return;this.jsm.streams.purge(YU,{filter:Oj($)}).catch(()=>{})}teardown(){this.js=null,this.jsm=null}}var BH,E48,Sg6=($)=>{let Z;return()=>Z??=$()},Cg6,_g6=86400000000000,vg6=120000000000,bg6=4294967296,z48,xg6=500000,yg6,gg6,hg6;var A48=D(()=>{D8();c91();A20();E20();R6();w48();BH=C(dU(),1),E48=C(Ti(),1),Cg6=Sg6(()=>E$.createCounter("decopilot.stream.publish_errors",{description:"Number of JetStream publish failures for decopilot stream chunks",unit:"{errors}"})),z48=Math.max(1,Number(process.env.DECOPILOT_STREAM_REPLICAS??3)||3);yg6=process.env.STREAM_ENCODE_TRACE==="1",gg6=process.env.DECOPILOT_STREAM_TRACE==="1";hg6=yg6?new P48:null});function Ok0($,Z,Q,X){if(!X)return!1;return $.emit(Z,bH(Q,X.status,{title:X.title??void 0,virtualMcpId:X.virtual_mcp_id??void 0,createdBy:X.created_by??void 0,triggerId:X.trigger_id??null,branch:X.branch??null,harnessId:X.harness_id??void 0,createdAt:X.created_at,updatedAt:X.updated_at})),!0}var T48=D(()=>{r8()});class HF1{storage;options;timer=null;constructor($,Z={}){this.storage=$;this.options=Z}start(){if(this.timer)return;let $=this.options.intervalMs??300000;this.timer=setInterval(()=>{this.runOnce()},$)}async runOnce(){let $=this.options.staleAfterMs??3600000;try{let Z=await this.storage.sweepAbandoned($);if(Z>0)console.log(`[async-research-sweeper] marked ${Z} stale jobs as abandoned`);return Z}catch(Z){return console.error("[async-research-sweeper] sweep failed",Z),0}}dispose(){if(this.timer)clearInterval(this.timer),this.timer=null}}function dg6($,Z){let Q=$.startsWith("thread:")?mK($):$;return[...new Set([Z,Q].filter((X)=>!!X))]}async function R48($,Z){let Q=Z.organizationId;try{let X=await $.storage.taskBoard.linkedThreadIds(Z.id,Q);for(let Y of X){let J=await tF($,Y);if(!J?.owner||!J?.name)continue;let G=await $.storage.threads.get(Y),W=await Uc($,{threadId:Y,runBranch:G?.branch}),K=dg6(W,await hP0($,Y)),H=await ds($,Q,F11(J)).catch(()=>null);if(!H){console.warn(`[task-board] no credential for ${J.owner}/${J.name} \u2014 `+`cannot look up ${Z.id}'s change request by branch`);continue}for(let F of K){let U=await H.readForBranch(F).catch(()=>null);if(!U)continue;return await $.storage.taskBoard.linkPr({taskBoardItemId:Z.id,organizationId:Q,url:U.url,prNumber:U.number,repo:H.repo}),await $.storage.taskBoard.openReviewCycleIfInProgress(Z.id,Q),await gG(Q).catch(()=>{}),console.log(`[task-board] ${Z.id}: linked ${U.url} found on branch ${F}`),!0}}}catch(X){console.error("[task-board] PR lookup by branch failed",X)}return!1}var q48=D(()=>{hZ();YW();L7()});async function M48($,Z,Q){let X=Z.organizationId;if(!PJ(Z))return!1;if(!Px(Q))return!1;if(await $.storage.taskBoard.hasHumanRejectedDone(Z.id,X))return!1;let Y=await $.storage.organizationSettings.get(X),J=xF(Y?.flags),G=await $.storage.taskBoard.update(Z.id,X,{status:J},Z.updatedBy);return await c6($,{taskBoardItemId:Z.id,action:"status_changed",actorId:null,data:{from:Z.status,to:J,reason:"pr_merged"}}),L8(X,G),console.log(`[task-board-review-sweeper] ${Z.id}: linked PR already merged \u2014 moved to ${J}`),!0}var I48=D(()=>{V4();jX();dc();oK();R9()});function rg6($){return $ instanceof WY}function ag6($,Z){return Z-$>=tg6}class FF1{taskBoard;contextFactory;billing;options;timer=null;running=!1;cursor=null;constructor($,Z,Q,X={}){this.taskBoard=$;this.contextFactory=Z;this.billing=Q;this.options=X}start(){if(this.timer)return;let $=this.options.intervalMs??mg6;this.timer=setInterval(()=>{this.runOnce()},$),this.timer.unref()}async runOnce(){if(this.running)return 0;this.running=!0;let $=0;try{let Z=this.options.batchSize??pg6,Q=this.options.itemIntervalMs??ig6,X=new Date(Date.now()-Q),Y=await this.taskBoard.listItemsPendingReview(Z,this.cursor,X),J=Y.at(-1);this.cursor=Y.length===Z&&J?{updatedAt:J.updatedAt,id:J.id}:null;for(let{id:G,organizationId:W}of Y)try{if(await this.reconcileItem(G,W,X))$++}catch(K){console.error(`[task-board-review-sweeper] ${G} failed`,K)}await this.reapNeverStartedThreads(Z),$+=await this.dispatchDueRetries(Z),await this.reactToUnhandledFailures(Z)}catch(Z){console.error("[task-board-review-sweeper] sweep failed",Z)}finally{this.running=!1}return $}async reapNeverStartedThreads($){try{let Z=await this.taskBoard.failNeverStartedLinkedThreads($,new Date(Date.now()-x61),t51);for(let Q of Z)console.warn(`[task-board-review-sweeper] failed never-started thread ${Q.threadId} on ${Q.itemId}`)}catch(Z){console.error("[task-board-review-sweeper] reaping failed",Z)}}async reactToUnhandledFailures($){let Z=await this.taskBoard.listItemsStuckAfterFailure($,new Date(Date.now()-og6));for(let{id:Q,organizationId:X,threadId:Y}of Z)try{console.warn(`[task-board-review-sweeper] reacting to an unhandled failure on ${Q}`),await i51(this.taskBoard,Y,X),await p51(this.taskBoard,this.billing,Y,X)}catch(J){console.error(`[task-board-review-sweeper] unhandled-failure reaction for ${Q} failed`,J)}}async dispatchDueRetries($){let Z=0,Q=await this.taskBoard.listItemsDueForRetry($,new Date);for(let{id:X,organizationId:Y,attempts:J}of Q)try{if(!await this.taskBoard.claimDueRetry(X,Y,new Date))continue;let G=await this.taskBoard.getById(X,Y);if(!G||G.status!==x$.progress||G.assigneeId!==P8)continue;let W=await this.contextFactory(Y,G.assignedBy??G.createdBy);if(!W)continue;await rK(W,G,{runClass:"retry"}),Z++,console.warn(`[task-board-review-sweeper] re-dispatched ${X} after a failure (attempt ${J})`)}catch(G){if(console.error(`[task-board-review-sweeper] retry dispatch for ${X} failed`,G),rg6(G)){await this.returnToTodo(X,Y,G instanceof Error?G.message:String(G));continue}await this.taskBoard.scheduleRunRetry(X,Y,J,new Date(Date.now()+ng6)).catch((W)=>console.error(`[task-board-review-sweeper] re-arming ${X} failed`,W))}return Z}async returnToTodo($,Z,Q){try{let X=await this.taskBoard.getById($,Z);if(!X||X.status!==x$.progress)return;let Y=await this.taskBoard.returnToTodoAfterFailure($,Z,X.updatedBy);if(!Y)return;await this.taskBoard.recordActivity({taskBoardItemId:$,action:"status_changed",actorId:null,data:{from:"in_progress",to:"todo",reason:Q}}).catch(()=>{}),L8(Z,Y)}catch(X){console.error(`[task-board-review-sweeper] returning ${$} to todo failed`,X)}}async handOffReviewWithoutPr($,Z){let Q=await this.taskBoard.listActivity(Z.id,Z.organizationId);if(!ag6(UB(Q,Z.reviewCycleStartedAt),Date.now()))return;await ZU($,Z,"no pull request is linked to this task \u2014 there is nothing for a "+"reviewer to review")}async reconcileItem($,Z,Q){if(!await this.taskBoard.claimSweep($,Z,Q))return!1;let X=await this.taskBoard.getById($,Z);if(!X)return!1;if(!PJ(X))return!1;let Y=X.assigneeId===P8,J=await this.taskBoard.listPrs($,Z),G=await this.contextFactory(Z,X.assignedBy??X.createdBy);if(!G)return!1;if(J.length===0){if(await R48(G,X))J=await this.taskBoard.listPrs($,Z);if(J.length===0){if(Y)await this.handOffReviewWithoutPr(G,X);return!1}}let W=await Promise.all(J.map(async(K)=>({...K,...await pc(Z,K)})));if(W.every((K)=>K.state===null))console.warn(`[task-board-review-sweeper] ${$}: no live PR state from GitHub (${W.length} PR(s)) \u2014 proceeding on unknown`);if(await M48(G,X,W))return!0;if(await $C$(G,X))return!0;if(await this.resolveConflictFromSweep(G,X,W))return!0;if(!Y)return!1;if(!l51(W))return!1;return await mc(G,X,{previewMatchesHead:c51(W)}),!0}async resolveConflictFromSweep($,Z,Q){let X=Q.find((Y)=>Y.state!=="closed"&&Y.conflict===!0);if(!X)return!1;return await Fj($,Z.organizationId,Z,{pr:{number:X.number,url:X.url},conflict:!0}).catch((Y)=>{return console.error("[task-board-review-sweeper] conflict resolve failed",Y),!1})}dispose(){if(this.timer)clearInterval(this.timer),this.timer=null}}var mg6=60000,ig6=300000,pg6=50,ng6=60000,tg6=900000,og6=120000;var V48=D(()=>{V4();bT0();q48();QU();e00();oK();I48();R9();s3();o51();L7();q00();ic()});import{readdir as sg6,rm as Dk0}from"fs/promises";import{join as Lk0}from"path";async function wk0($){let Z=new Date;Z.setUTCDate(Z.getUTCDate()-eg6),Z.setUTCHours(0,0,0,0);let Q=0;try{let X=await hf($);for(let Y of X)if(/^\d{4}$/.test(Y))Q+=await k48($,Y,Z);else if(!Y.startsWith(".")){let J=Lk0($,Y),G=await hf(J);for(let K of G){if(!/^\d{4}$/.test(K))continue;Q+=await k48(J,K,Z)}if((await hf(J)).length===0)await Dk0(J,{recursive:!0,force:!0})}}catch(X){console.warn("monitoring retention cleanup failed:",X)}return Q}async function k48($,Z,Q){let X=0,Y=Lk0($,Z),J=await hf(Y);for(let W of J){if(!/^\d{2}$/.test(W))continue;let K=Lk0(Y,W),H=await hf(K);for(let U of H){if(!/^\d{2}$/.test(U))continue;let N=new Date(`${Z}-${W}-${U}T00:00:00Z`);if(isNaN(N.getTime()))continue;if(N<Q){let B=Lk0(K,U);await Dk0(B,{recursive:!0,force:!0}),X++}}if((await hf(K)).length===0)await Dk0(K,{recursive:!0,force:!0})}if((await hf(Y)).length===0)await Dk0(Y,{recursive:!0,force:!0});return X}async function hf($){try{return(await sg6($)).filter((Q)=>!Q.startsWith("."))}catch{return[]}}var eg6=30;var UF1=()=>{};import{DBOS as NF1,SchedulerMode as $h6}from"@dbos-inc/dbos-sdk";async function Qh6(){let $=[VW(),of(),fU()],Z=0;for(let Q of $)try{Z+=await wk0(Q)}catch(X){console.error("[monitoring-retention] cleanup failed:",X)}return console.log(`[monitoring-retention] deleted ${Z} day-dir(s) across ${$.length} signal dir(s)`),{deleted:Z,dirs:$.length}}async function Xh6($,Z){await NF1.runStep(()=>Qh6(),{name:"monitoringRetention"})}function C48(){if(S48)return;S48=!0;let $=NF1.registerWorkflow(Xh6,{name:"monitoringRetentionWorkflow"});NF1.registerScheduled($,{name:"monitoringRetentionWorkflow",crontab:Zh6,mode:$h6.ExactlyOncePerIntervalWhenActive})}var Zh6="23 4 * * *",S48=!1;var _48=D(()=>{Z3();UF1()});function v48($){return async(Z,Q)=>{let X=await $.db.selectFrom("member").innerJoin("organization","organization.id","member.organizationId").select(["member.role","organization.id as orgId","organization.slug as orgSlug","organization.name as orgName"]).where("member.userId","=",Q).where("member.organizationId","=",Z).executeTakeFirst();if(!X)return console.warn(`[automationContextFactory] User ${Q} not found in org ${Z} \u2014 returning null`),null;let Y=await IQ.create();Y.auth.user={id:Q,role:X.role},Y.organization={id:X.orgId,slug:X.orgSlug,name:X.orgName};let J=await ZA($.db,Z,X.role);return Y.boundAuth=s31({auth:Y.authInstance,headers:new Headers,role:X.role,permissions:J,userId:Q}),Y.access=new uz(Q,void 0,Y.boundAuth,X.role,"self"),Hj(Y,{id:X.orgId,slug:X.orgSlug}),Y}}var b48=D(()=>{ZK();_F()});function Yh6(){return[{name:"Postgres",status:"pending",port:0},{name:"NATS",status:"pending",port:0}]}function Jh6(){return{services:Yh6(),migrationsStatus:"pending",serverUrl:null,logs:[]}}function Wh6(){for(let $ of Gh6)$()}function x48($){let Z=[...BF1.logs,$];BF1={...BF1,logs:Z.length>500?Z.slice(-500):Z},Wh6()}function OF1(){return Kh6}var BF1,Gh6,Kh6=!1;var DF1=D(()=>{BF1=Jh6(),Gh6=new Set});import{EventEmitter as Hh6}from"events";var LF1;var f48=D(()=>{DF1();LF1=new Hh6;LF1.on("request",($)=>{x48($)})});function y48(){return async($,Z)=>{let Q=Date.now(),X=$.req.method,Y=$.req.path;if(Y==="/api/auth/get-session"||Y.includes("favicon")){await Z();return}let J="",G=!1;if(Y.startsWith("/mcp")&&X==="POST"){G=!0;try{if($.req.header("Content-Type")?.includes("application/json")){let N=await $.req.raw.clone().json();if(N.method==="tools/call"&&N.params?.name){let B=tm(N.params.name),O=N.params.arguments||{},L=Object.keys(O).map((j)=>tm(j)),w=L.length>0?L.slice(0,3).join(",")+(L.length>3?"\u2026":""):"";J=`${o5.tool}${B}${o5.dim}(${w})${o5.reset}`}else if(N.method)J=`${o5.dim}${tm(N.method)}${o5.reset}`}}catch{}}let W=tm(Y);if(Y.startsWith("/mcp/conn_")){let F=Y.split("/")[2]??"";W=`/mcp/${o5.mcp}${tm(F.slice(0,12))}\u2026${o5.reset}`}else if(Y==="/mcp")W=`${o5.mcp}/mcp${o5.reset}`;else if(Y==="/mcp/registry")W=`${o5.mcp}/mcp/registry${o5.reset}`;let K=Uh6(X),H=G?"\u25C0":"\u2190";if(!OF1())console.log(`${o5.dim}${H}${o5.reset} ${K}${X}${o5.reset} ${W}${J?` ${J}`:""}`);try{await Z()}finally{let F=Date.now()-Q,U=$.res.status,N=Fh6(U),B=F<1000?`${F}ms`:`${(F/1000).toFixed(1)}s`,O=G?"\u25B6":"\u2192";if(!OF1())console.log(`${o5.dim}${O}${o5.reset} ${K}${X}${o5.reset} ${W}${J?` ${J}`:""} ${N}${U}${o5.reset} ${o5.duration}${B}${o5.reset}`);LF1.emit("request",{method:X,path:tm(Y),status:U,duration:F,timestamp:new Date})}}}var o5,Fh6=($)=>{if($>=500)return o5.serverError;if($>=400)return o5.clientError;if($>=300)return o5.redirect;return o5.ok},Uh6=($)=>{return o5[$]||o5.reset},tm=($)=>{return $.replace(/\r/g,"").replace(/\n/g,"").replace(/\x1b\[[0-9;]*m/g,"").replace(/[\x00-\x1f\x7f-\x9f]/g,"")};var g48=D(()=>{DF1();f48();o5={reset:"\x1B[0m",dim:"\x1B[2m",bold:"\x1B[1m",GET:"\x1B[36m",POST:"\x1B[33m",PUT:"\x1B[35m",DELETE:"\x1B[31m",ok:"\x1B[32m",redirect:"\x1B[36m",clientError:"\x1B[33m",serverError:"\x1B[31m",mcp:"\x1B[35m",tool:"\x1B[96m",duration:"\x1B[90m"}});import{createHmac as c48}from"crypto";import{mkdir as Nh6,readdir as Bh6,rm as h48,stat as d48}from"fs/promises";import{join as jF1,relative as Oh6}from"path";import{z as t$}from"zod";function i48($){let Z=$.replace(/[^a-zA-Z0-9_-]/g,"_");return jF1(Dh6,Z)}function p48($){return $.replace(/^\/+/,"").replace(/\.\./g,"")}function wF1($,Z){let Q=i48($),X=p48(Z);return jF1(Q,X)}function Lh6($,Z,Q,X){let Y=E0().encryptionKey||"dev-secret",J=`${$}:${Z}:${Q}:${X}`;return c48("sha256",Y).update(J).digest("hex")}function l48($,Z,Q,X,Y){let J=Math.floor(Date.now()/1000)+X,G=Lh6(Z,Q,J,Y),W=new URL(`/api/dev-assets/${Z}/${p48(Q)}`,$);return W.searchParams.set("expires",J.toString()),W.searchParams.set("signature",G),W.searchParams.set("method",Y),W.toString()}function n48($,Z,Q){let X=`${$}:${Z.getTime()}:${Q}`;return`"${c48("md5","etag").update(X).digest("hex")}"`}async function t48($,Z,Q,X,Y){try{let J=await Bh6($,{withFileTypes:!0});for(let G of J){let W=jF1($,G.name),H=Oh6(Z,W).replace(/\\/g,"/");if(Q&&!H.startsWith(Q))continue;if(G.isDirectory())if(X){let F=H+"/";if(!Q||F.startsWith(Q)){if(!(Q?H.slice(Q.length):H).includes("/"))Y.commonPrefixes.add(F)}}else await t48(W,Z,Q,X,Y);else if(G.isFile()){if(X&&Q){let F=H.slice(Q.length);if(F.includes(X)){let U=F.indexOf(X),N=Q+F.slice(0,U+1);Y.commonPrefixes.add(N);continue}}try{let F=await d48(W);Y.objects.push({key:H,size:F.size,lastModified:F.mtime.toISOString(),etag:n48(W,F.mtime,F.size)})}catch{}}}}catch{}}function o48($,Z){let X=K0($).id;return[{name:"LIST_OBJECTS",description:"List objects in the local assets directory with pagination support",inputSchema:t$.object({prefix:t$.string().optional(),maxKeys:t$.number().optional().default(1000),continuationToken:t$.string().optional(),delimiter:t$.string().optional()}),outputSchema:t$.object({objects:t$.array(t$.object({key:t$.string(),size:t$.number(),lastModified:t$.string(),etag:t$.string()})),nextContinuationToken:t$.string().optional(),isTruncated:t$.boolean(),commonPrefixes:t$.array(t$.string()).optional()}),handler:async(Y)=>{let J=Y,G=J.prefix||"",W=J.maxKeys??1000,K=J.delimiter,H=J.continuationToken,F=i48(X);await Nh6(F,{recursive:!0});let U={objects:[],commonPrefixes:new Set};await t48(F,F,G,K,U),U.objects.sort((w,j)=>w.key.localeCompare(j.key));let N=0;if(H){if(N=U.objects.findIndex((w)=>w.key>H),N===-1)N=U.objects.length}let B=U.objects.slice(N,N+W),O=N+W<U.objects.length,L=O?B[B.length-1]?.key:void 0;return{objects:B,isTruncated:O,nextContinuationToken:L,commonPrefixes:Array.from(U.commonPrefixes).sort()}}},{name:"GET_OBJECT_METADATA",description:"Get metadata for a file in the local assets directory",inputSchema:t$.object({key:t$.string()}),outputSchema:t$.object({contentType:t$.string().optional(),contentLength:t$.number(),lastModified:t$.string(),etag:t$.string(),metadata:t$.record(t$.string(),t$.string()).optional()}),handler:async(Y)=>{let J=Y,G=wF1(X,J.key),W=await d48(G);return{contentType:oW1(J.key),contentLength:W.size,lastModified:W.mtime.toISOString(),etag:n48(G,W.mtime,W.size)}}},{name:"GET_PRESIGNED_URL",description:"Generate a presigned URL for downloading a file from local storage",inputSchema:t$.object({key:t$.string(),expiresIn:t$.number().optional()}),outputSchema:t$.object({url:t$.string(),expiresIn:t$.number()}),handler:async(Y)=>{let J=Y,G=J.expiresIn??u48;return{url:l48(Z,X,J.key,G,"GET"),expiresIn:G}}},{name:"PUT_PRESIGNED_URL",description:"Generate a presigned URL for uploading a file to local storage",inputSchema:t$.object({key:t$.string(),expiresIn:t$.number().optional(),contentType:t$.string().optional()}),outputSchema:t$.object({url:t$.string(),expiresIn:t$.number()}),handler:async(Y)=>{let J=Y,G=J.expiresIn??u48;return{url:l48(Z,X,J.key,G,"PUT"),expiresIn:G}}},{name:"DELETE_OBJECT",description:"Delete a single file from local storage",inputSchema:t$.object({key:t$.string()}),outputSchema:t$.object({success:t$.boolean(),key:t$.string()}),handler:async(Y)=>{let J=Y,G=wF1(X,J.key);try{return await h48(G),{success:!0,key:J.key}}catch{return{success:!1,key:J.key}}}},{name:"DELETE_OBJECTS",description:"Delete multiple files from local storage",inputSchema:t$.object({keys:t$.array(t$.string()).max(1000)}),outputSchema:t$.object({deleted:t$.array(t$.string()),errors:t$.array(t$.object({key:t$.string(),message:t$.string()}))}),handler:async(Y)=>{let J=Y,G=[],W=[];return await Promise.all(J.keys.map(async(K)=>{let H=wF1(X,K);try{await h48(H),G.push(K)}catch(F){W.push({key:K,message:F instanceof Error?F.message:"Unknown error"})}})),{deleted:G,errors:W}}}]}async function EF1($,Z,Q){let X=o48(Z,Q),Y=new XL({name:"dev-assets-mcp",version:"1.0.0"},{capabilities:{tools:{}},jsonSchemaValidator:DZ});for(let G of X){let W="shape"in G.inputSchema?G.inputSchema.shape:t$.object({}).shape,K=G.outputSchema&&"shape"in G.outputSchema?G.outputSchema.shape:t$.object({}).shape;Y.registerTool(G.name,{description:G.description??"",inputSchema:W,outputSchema:K,annotations:G.annotations,_meta:G._meta},async(H)=>{try{let F=await G.handler(H);return{content:[{type:"text",text:JSON.stringify(F)}],structuredContent:F}}catch(F){return{content:[{type:"text",text:`Error: ${F.message}`}],isError:!0}}})}let J=new dG({enableJsonResponse:$.headers.get("Accept")?.includes("application/json")??!1});return await Y.connect(J),DW(Y,J,$,"mcp:dev-assets")}async function r48($,Z,Q,X){let J=o48(Q,X).find((G)=>G.name===$);if(!J)return{content:[{type:"text",text:`Tool not found: ${$}`}],isError:!0};try{let G=await J.handler(Z);return{content:[{type:"text",text:JSON.stringify(G)}]}}catch(G){return{content:[{type:"text",text:G instanceof Error?G.message:String(G)}],isError:!0}}}var Dh6="./data/assets",u48=3600,m48,a48;var s48=D(()=>{U$();Nd();X8();UX0();Ud();hY();WV0();m48=new X1;m48.all("/",async($)=>{let Z=$.get("studioContext"),Q=new URL($.req.url),X=`${Q.protocol}//${Q.host}`;return EF1($.req.raw,Z,X)});a48=m48});var e48={};E6(e48,{mountDevRoutes:()=>wh6});function wh6($,Z){$.all("/mcp/:connectionId{.*_dev-assets$}",Z,async(X)=>{let Y=X.get("studioContext"),J=new URL(X.req.url),G=`${J.protocol}//${J.host}`;return EF1(X.req.raw,Y,G)}),$.all("/mcp/:connectionId{.*_dev-assets$}/call-tool/:toolName",Z,async(X)=>{let Y=X.get("studioContext"),J=new URL(X.req.url),G=`${J.protocol}//${J.host}`,W=X.req.param("toolName");if(!W)return X.json({error:"Missing tool name"},400);let K=await X.req.json(),H=await r48(W,K,Y,G);if(H.isError)return X.json(H.content,500);return X.json(H.content)}),$.use("/mcp/dev-assets",Z),$.route("/mcp/dev-assets",a48);let Q=new X1;Q.use("*",UH({mountPath:"/api/dev-assets"})),Q.route("/",GV0({orgFromPath:!1})),$.route("/api/dev-assets",Q)}var $68=D(()=>{X8();cW1();WV0();s48()});var F68={};E6(F68,{watchHandler:()=>H68,resolveCorsOrigin:()=>W68,isSsoExemptPath:()=>J68,isAllowedOAuthRedirectUri:()=>K68,createApp:()=>Ih6});import{readFileSync as jh6}from"fs";import{PrometheusSerializer as Eh6}from"@opentelemetry/exporter-prometheus";import{DBOS as DO}from"@dbos-inc/dbos-sdk";import{oAuthDiscoveryMetadata as Ah6,oAuthProtectedResourceMetadata as Th6}from"better-auth/plugins";async function zh6($){let Z=$.connect(),Q;try{Q=await Promise.race([Z,Q68(Z68)])}catch{return Z.then((X)=>X.release(!0)).catch(()=>{}),!1}try{return await Promise.race([Q.query("SELECT 1"),Q68(Z68)]),Q.release(),!0}catch{return Q.release(!0),!1}}function Q68($){return new Promise((Z,Q)=>setTimeout(()=>Q(Error("pg health-check timeout")),$))}function J68($){return $.startsWith("/api/org-sso/")||/^\/api\/[^/]+\/sso\//.test($)||$.startsWith("/api/auth/")||$.startsWith("/api/tools/management")||$.startsWith("/oauth-proxy/")||/^\/api\/[^/]+\/oauth-proxy\//.test($)||$.startsWith(`${pI0}/`)||$.startsWith(`${lI0}/`)}function G68($){return $==="local.studio.decocms.com"}function W68($,{baseUrl:Z,requestOrigin:Q}){let X;try{X=new URL($).hostname}catch{return null}if(X==="localhost"||X==="127.0.0.1")return $;if(G68(X))return $;let Y=Z??Q;try{if(new URL(Y).origin===$)return $}catch{}return null}function K68($,Z){return $.origin===new URL(Z).origin||$.hostname==="localhost"||G68($.hostname)}async function Ih6($={}){let Z=$.database??I8(),Q=!1;K9.stop().catch(($0)=>{console.error("[SSEHub] Error stopping previous broadcast (HMR cleanup):",$0)});let X,Y,J,G,W=new XF1,K,H,F,U=null;if($.disableNats)K=YF1(),X={get:async()=>null,set:async()=>{},invalidate:async()=>{},teardown:()=>{}},Y=null,J=null,G=new K10,H={start:async()=>{},broadcast:()=>{},stop:async()=>{}},F={init:async()=>{},pump:($0)=>{return(async()=>{let L0=$0.getReader();try{while(!0){let{done:a}=await L0.read();if(a)break}}catch{}finally{L0.releaseLock()}})()},publishRawChunk:async()=>!1,publishDone:async()=>!1,createTailStream:async()=>null,purge:()=>{},teardown:()=>{}};else{U=U48();let $0=E0().natsCredsPath,L0;if($0)try{L0=jh6($0,"utf8")}catch(f0){console.error(`[app] failed to read NATS_CREDS at ${$0}; connecting anonymously`,f0)}U.init(E0().natsUrls,L0?{creds:L0}:void 0);let a=Qe0()?new hs0({getJetStream:()=>U.getJetStream()}):null;a?.init().catch(()=>{}),X=a;let p=new o81({getJetStream:()=>U.getJetStream()});p.init().catch(()=>{}),Y=p;let d0=new Tx(x51,{getJetStream:()=>U.getJetStream()}),I0=new Tx(M00,{getJetStream:()=>U.getJetStream()});d0.init().catch(()=>{}),I0.init().catch(()=>{}),J={reads:d0,cards:I0};let o0=new U71({getJetStream:()=>U.getJetStream()});o0.init().catch(()=>{}),G=o0,K=YF1({getConnection:()=>U.getConnection()}),H=new JF1({getConnection:()=>U.getConnection()}),F=new KF1({getConnection:()=>U.getConnection(),getJetStream:()=>U.getJetStream()}),wr$(U),U.onReady(()=>{a?.init().catch((f0)=>{console.error("[McpListCache] Deferred init failed:",f0)}),p.init().catch((f0)=>{console.error("[SkillCatalogCache] Deferred init failed:",f0)}),d0.init().catch((f0)=>{console.error("[PrReadCache] Deferred init failed:",f0)}),I0.init().catch((f0)=>{console.error("[PrCardCache] Deferred init failed:",f0)}),o0.init().catch((f0)=>{console.error("[ConnectionCircuitStore] Deferred init failed:",f0)}),K.start(),TW$(()=>U.getConnection()),F.init().catch((f0)=>{console.warn("[Decopilot] StreamBuffer init failed (late-join disabled):",f0)})})}if(tj)await tj();us0(X),a81(Y),f51(J),N71(G);let B={storage:new xg(Z.db),sseHub:K9,onThreadFinished:async($0,L0)=>tc(new yG(Z.db),$0,L0,new XG(Z.db))},O=new t91(B),L=new V$0(Z.db),w=new HF1(L);w.start(),sS$(H),H.start(($0)=>{G20($0),O.execute({type:"CANCEL",taskId:$0}).catch((L0)=>{console.error("[Decopilot] CancelBroadcast execute failed:",L0)})}).catch(($0)=>{console.error("[Decopilot] CancelBroadcast start failed:",$0)}),U?.onReady(()=>{H.start().catch(($0)=>{console.error("[CancelBroadcast] Deferred start failed:",$0)})});let j=()=>U?.getConnection()??null;gW1(j),U?.onReady(()=>gW1(j)),m71(j),U?.onReady(()=>m71(j)),F.init().catch(($0)=>{console.warn("[Decopilot] StreamBuffer init failed, attach/late-join disabled:",$0)}),tj=async()=>{await O.stopAll(),O.dispose(),w.dispose(),H.stop().catch(()=>{}),Va$(),F.teardown(),X?.teardown(),Y?.teardown(),J?.reads.teardown(),J?.cards.teardown(),W.teardown(),K.teardown(),RW$(),G.teardown(),us0(null),a81(null),f51(null),N71(null)};let E=new X1;if(E.use("*",K71({enabled:($0)=>Dm($0,"debug")==="1"})),E.use("*",hk0),E.use("/*",Nr$({origin:($0,L0)=>W68($0,{baseUrl:E0().baseUrl,requestOrigin:new URL(L0.req.url).origin}),credentials:!0,allowMethods:["GET","POST","PUT","DELETE","OPTIONS"],allowHeaders:["Content-Type","Authorization","mcp-protocol-version"],exposeHeaders:["WWW-Authenticate"]})),E.use("*",async($0,L0)=>{if(await L0(),$0.req.path.includes("/files/"))return;if($0.req.path.includes("/fs/")&&$0.req.path.endsWith("/read"))return;$0.header("X-Frame-Options","DENY"),$0.header("Content-Security-Policy","frame-ancestors 'none'")}),!E0().noTui)E.use("*",y48());E.use("*",async($0,L0)=>{if(await L0(),Yi($0.req.path))return;if($0.res.status>=500){let p=await $0.res.clone().text();console.error(`[5xx Response] ${$0.req.method} ${$0.req.path} - ${$0.res.status}:`,p)}}),E.get(kX.HEALTH,($0)=>{if(Q)return $0.json({status:"shutting_down"},503);return $0.json({status:"ok"})}),E.get(kX.HEALTH_LIVE,($0)=>{return $0.json({status:"ok"})}),E.get(kX.HEALTH_READY,async($0)=>{if(Q)return $0.json({status:"shutting_down"},503);let L0={};if(L0.postgres={status:await zh6(Z.pool)?"up":"down"},U)L0.nats=U.isConnected()?{status:"up"}:{status:"down"};else L0.nats={status:"down"};let a=L0.postgres.status==="up",p=a?200:503;return $0.json({status:a?"ready":"not_ready",services:L0},p)}),E.get(kX.METRICS,async($0)=>{try{let L0=await dk0.collect(),a=Ph6.serialize(L0.resourceMetrics);return $0.text(a,200,{"Content-Type":"text/plain; version=0.0.4; charset=utf-8"})}catch(L0){return console.error("Failed to collect metrics:",L0),$0.text("# Error collecting metrics",500)}});let z=1800000;E.get(`${kX.DBOS_QUEUE_DEPTH_PREFIX}:queueName`,async($0)=>{let L0=$0.req.param("queueName");if(!Rh6.has(L0))return $0.json({error:`Unknown queue: ${L0}`},404);let[a,p]=await Promise.all([DO.listQueuedWorkflows({queueName:L0,status:"ENQUEUED",loadInput:!1,loadOutput:!1}),DO.listQueuedWorkflows({queueName:L0,status:"PENDING",loadInput:!1,loadOutput:!1,dequeuedAfter:new Date(Date.now()-z).toISOString()})]);return $0.json({queue_length:a.length,in_flight:p.length})}),E.route("/api/config",z88),E.route("/api/_reports",C88),E.route("/api/_stripe",eH1),E.route("/api/_github",b88({taskBoard:()=>n,contextFactory:()=>g})),E.route("/api/_git",Tm);let T={db:Z.db,encryptionKey:E0().encryptionKey};E.route("/api/_jira",g88(T)),E.route("/api/_jira",f88(T)),E.route("/report",V88($.clientDir)),E.route("/api/auth/custom",yr$),E.route("/api/auth/desktop",lr$),E.all("/api/auth/admin/*",Oa$),E.all("/api/auth/*",async($0)=>{return await V8.handler($0.req.raw)});let P=mt$();P.use("/.well-known/oauth-protected-resource/mcp/:connectionId",c$0),P.use("/mcp/:connectionId/.well-known/oauth-protected-resource",c$0),E.route("/",P),E.get("/.well-known/oauth-protected-resource/api/:org/mcp/:connectionId",R$0),E.route("/",ot$()),E.use("/oauth-proxy/:connectionId/*",c$0),E.all("/oauth-proxy/:connectionId/*",X68);let A=async($0)=>{let a=await qh6()($0.req.raw),p=await a.json();return Response.json(p,a)};E.use("/mcp/:gateway?/:connectionId/.well-known/oauth-protected-resource/*",c$0),E.get("/mcp/:gateway?/:connectionId/.well-known/oauth-protected-resource/*",A);let q=async($0)=>{let a=await Mh6()($0.req.raw),p=await a.json();return Response.json(p,a)};E.get("/.well-known/oauth-authorization-server/*/:gateway?/:connectionId?",q);let x=Or$({ttlMs:120000}),_=await ho$({db:Z.db,auth:V8,encryption:{key:E0().encryptionKey},observability:{tracer:RO,meter:E$},modelListCache:W,providerKeyCache:K,memberRoleCache:x});IQ.set(_),Ll1({db:Z.db,baseUrl:S5()}),uo$({db:Z.db}),mo$({db:Z.db}),so$({db:Z.db}),l88({db:Z.db,encryptionKey:E0().encryptionKey}),SM$({db:Z.db}),Yr$({db:Z.db}),eM$({db:Z.db});let V=$Q0(Z.db),y=new gt(Z.db),g=v48({db:Z.db});Y71({storage:V,studioContextFactory:g}),YZ1({systemDatabaseUrl:Jt0(E0().databaseUrl,E0().databasePgSsl),studioContextFactory:g,deps:{runRegistry:O,cancelBroadcast:H,streamBuffer:F,sseHub:K9}}),a91({dispatchRunFn:dk$,studioContextFactory:g,deps:{runRegistry:O,cancelBroadcast:H,streamBuffer:F,sseHub:K9}});let u=new xg(Z.db),n=new yG(Z.db),i=new XG(Z.db),U0=new FF1(n,g,i);if(E0().taskBoardReviewSweeperEnabled){U0.start();let $0=tj;tj=async()=>{await $0?.(),U0.dispose()}}FS$({getJetStream:()=>U?.getJetStream()??null,getJetStreamManager:async()=>{let $0=U?.getConnection();return $0?await Y68.jetstreamManager($0):null},messageParts:u.messageParts(),resolveRun:async($0)=>{let L0=await Z.db.selectFrom("threads").select(["organization_id","created_by","message_storage_version","status","run_fence_token","title"]).where("id","=",$0).executeTakeFirst();return L0?{orgId:L0.organization_id,createdBy:L0.created_by,version:L0.message_storage_version??1,status:L0.status,runFenceToken:L0.run_fence_token,title:L0.title??null}:null},completeRunIfNotCompleted:async($0,L0)=>{let a=await u.completeRunIfNotCompleted($0,L0);if(Ok0(K9,L0,$0,a),a)await tc(n,$0,L0,i);return a},markRunRequiresAction:async($0,L0)=>{let a=await u.requiresActionIfInProgress($0,L0);return Ok0(K9,L0,$0,a),a},markRunFailed:async($0,L0,a,p)=>{let d0=await u.markRunFailed($0,L0,a,p);if(Ok0(K9,L0,$0,d0),d0)await tc(n,$0,L0,i);return d0},clearSynthesizedError:async($0,L0)=>{await u.messageParts().replaceMessageParts($0,Bj($0,L0),[])},persistTitle:($0,L0,a)=>u.update($0,L0,{title:a}),onTitleUpdated:async({runId:$0,orgId:L0,title:a})=>{let p=await u.get($0,L0).catch(()=>null);K9.emit(L0,bH($0,p?.status??"in_progress",{title:a,virtualMcpId:p?.virtual_mcp_id??void 0,createdBy:p?.created_by,triggerId:p?.trigger_id,branch:p?.branch??null,harnessId:p?.harness_id??void 0,createdAt:p?.created_at,updatedAt:p?.updated_at}))},bumpProgress:async({runId:$0,orgId:L0})=>{await u.bumpProgress($0,L0)},recordCompleted:async({runId:$0,orgId:L0,distinctId:a,usage:p})=>{y1.capture({distinctId:a,event:"chat_message_completed",groups:{organization:L0},properties:{organization_id:L0,thread_id:$0,transport:"projector",input_tokens:p.inputTokens,output_tokens:p.outputTokens,total_tokens:p.totalTokens}})},recordFailed:async({runId:$0,orgId:L0,distinctId:a,reason:p,kind:d0})=>{y1.capture({distinctId:a,event:"chat_message_failed",groups:{organization:L0},properties:{organization_id:L0,thread_id:$0,transport:"projector",error_category:d0,error_message:p}})},purgeRun:async($0)=>{F.purge($0)}}),Dk$({studioContextFactory:g,systemDatabaseUrl:Jt0(E0().databaseUrl,E0().databasePgSsl),streamBuffer:F}),C48(),wl1(),co$(),po$(),$r$(),m88(),xM$(),Gr$(),$I$();let v0=async($0,L0,a)=>{let p=await V.findById($0,L0);if(!p)throw Error("Automation not found");return W71({automationId:p.id,organizationId:p.organization_id,triggerId:null})},G0=new Pm(V,({automation:$0,trigger:L0,contextMessages:a,idempotencyKey:p})=>W10({automationId:$0.id,organizationId:$0.organization_id,triggerId:L0.id,contextMessages:a},{idempotencyKey:p})),H0=[VW(),of(),fU()];for(let $0 of H0)wk0($0).then(()=>{}).catch((L0)=>console.error("[monitoring] Retention cleanup failed:",L0));let Y0=()=>V8.api.deleteAllExpiredApiKeys().catch(($0)=>console.error("[auth] Expired API key cleanup failed:",$0));Y0(),setInterval(Y0,86400000).unref(),E.use("*",async($0,L0)=>{if(yk0($0.req.path))return L0();let a={measure:async(d0,I0)=>{OW($0,d0);try{return await I0()}finally{mG($0,d0)}}},p=await IQ.create($0.req.raw,{timings:a});p.automationRunner=v0,$0.set("studioContext",p);try{await L0()}finally{let d0=p.pendingRevalidations;if(d0.length>0)Promise.race([Promise.allSettled(d0),c$(30000)]).catch((o0)=>console.error("[studio] revalidation cleanup error:",o0))}}),E.use("/api/:org/decopilot/*",wm),E.use("/api/:org/v1/*",wm),E.use("/api/:org/files/*",wm),E.use("*",async($0,L0)=>{if(J68($0.req.path))return L0();let a=$0.get("studioContext");if(!a?.organization?.id||!a?.auth?.user?.id)return L0();if(!(await a.storage.orgSsoConfig.getByOrgId(a.organization.id))?.enforced)return L0();if(!await a.storage.orgSsoSessions.isValid(a.auth.user.id,a.organization.id))return $0.json({error:"SSO authentication required for this organization"},403);return L0()});let Q0=new X1;Q0.use("*",UH({mountPath:"/api/org-sso"})),Q0.route("/",oI0()),E.route("/api/org-sso",Q0),E.get("/api/tools/management",($0)=>{return $0.json({tools:um0,grouped:hz()})}),E.use("/mcp/*",async($0,L0)=>{OW($0,"mcp");try{return await L0()}finally{mG($0,"mcp")}});let X0=async($0,L0)=>{let a=$0.var.studioContext;if(!a.auth.user?.id&&!a.auth.apiKey?.id){let p=new URL($0.req.url),d0=$0.req.header("x-forwarded-proto")?.split(",")[0]?.trim(),I0=d0?`${d0}://${p.host}`:p.origin;return $0.res=new Response(null,{status:401,headers:{"WWW-Authenticate":`Bearer realm="mcp",resource_metadata="${I0}${p.pathname}/.well-known/oauth-protected-resource"`}})}return await L0()};if(E.use("/mcp/:connectionId?",X0),E.use("/mcp/gateway/:virtualMcpId?",X0),E.use("/mcp/virtual-mcp/:virtualMcpId?",X0),E.use("/mcp/self",X0),p3()){let{mountDevRoutes:$0}=($68(),qk0(e48));$0(E,X0)}let e=new X1;e.use("*",UH({mountPath:"/mcp"})),e.route("/",a20()),E.route("/mcp",e);let J0=new X1;J0.use("*",UH({mountPath:"/mcp/self"})),J0.route("/",gV0()),E.route("/mcp/self",J0);let c0=new X1;c0.use("*",UH({mountPath:"/mcp"})),c0.route("/",$R0()),E.route("/mcp",c0),E.use("/api/:org/models/*",async($0,L0)=>{OW($0,"llm_models");try{return await L0()}finally{mG($0,"llm_models")}});let k0=Sa$({cancelBroadcast:H,streamBuffer:F,runRegistry:O});E.route("/api",k0),E.route("/api",t88);let B1=new X1;B1.use("*",UH({mountPath:"/api"})),B1.route("/",cV0()),E.route("/api",B1),E.route("/api",B88);let n0=new X1;n0.use("*",UH({mountPath:"/api"})),n0.route("/",dV0({tokenStorage:y,automationEventDispatcher:G0})),E.route("/api",n0);let w0=new ut(Z.db),j0=new X1;j0.use("*",UH({mountPath:"/api"})),j0.route("/",$V0()),E.route("/api",j0),E.route("/api/deco-sites",ma$()),E.route("/api/deco-apps",W88());let e0=new X1;e0.use("*",UH({mountPath:"/api/deco-sites"})),e0.route("/",QV0()),E.route("/api/deco-sites",e0),E.route(pI0,Da$()),E.route(A18,q18()),E.route("/api/_editor-resolve",D88()),E.route(dr$,mr$()),E.route(lI0,$a$());let A1=J88({kvStorage:w0,runRegistry:O,streamBuffer:F,sseHub:K9,cancelBroadcast:H,tokenStorage:y,automationEventDispatcher:G0,mountDevAssets:p3(),mcpAuth:X0,oauthProxyHandler:X68,watchHandler:H68,betterAuthProtectedResourceHandler:A,getNatsConnection:()=>U?.getConnection()??null});return E.route("/api/:org",A1),E.notFound(($0)=>{return $0.json({error:"Not Found",path:$0.req.path},404)}),E.onError(va$),Object.assign(E,{markShuttingDown:()=>{Q=!0},shutdown:async()=>{if(console.log("[shutdown] Stopping workers..."),await Promise.allSettled([K9.stop(),tj?Promise.resolve(tj()).finally(()=>{tj=null}):Promise.resolve()]),U)await U.drain().catch(($0)=>console.error("[shutdown] NATS drain error:",$0));console.log("[shutdown] Flushing telemetry..."),await TY().catch(($0)=>console.error("[shutdown] Telemetry flush error:",$0)),console.log("[shutdown] Closing database..."),await N8$(Z).catch(($0)=>console.error("[shutdown] Database close error:",$0)),console.log("[shutdown] Cleanup complete.")},initDbos:async()=>{await DO.registerQueue($3,{partitionQueue:!0,concurrency:Z71,minPollingIntervalMs:Q71}),await DO.registerQueue(eG,{partitionQueue:!0,concurrency:QZ1,priorityEnabled:!0}),await DO.registerQueue(bU,{workerConcurrency:E0().decopilotMaxConcurrentHostedRuns,priorityEnabled:!0}),await DO.registerQueue(xU,{workerConcurrency:E0().sandboxMaxConcurrentHostedRuns,priorityEnabled:!0}),await DO.registerQueue(AO,{partitionQueue:!0,concurrency:Ok$}),await DO.registerQueue(ej,sM$),await dW1(V),await Promise.allSettled(["automations-gate","automations-global","jira-push"].map(($0)=>DO.deleteQueue($0))),await X71(Z.pool),_5$().catch(($0)=>{console.error("[studio-pack-backfill] failed:",$0)}),jl1().catch(($0)=>{console.error("[org-fs] public-sets boot sync kick failed:",$0)})}})}var Y68,Z68=5000,tj=null,X68=async($)=>{let Z=$.req.param("connectionId");if(!Z)return $.json({error:"Missing connectionId"},400);let Q=$.req.path.split("/").filter(Boolean),X=Q[Q.length-1],Y=$.get("studioContext");if(!Y)Y=await IQ.create($.req.raw),$.set("studioContext",Y);let J=$.req.param("org")?Y.organization?.id:void 0,G=await Y.storage.connections.findById(Z,J);if(!G?.connection_url)return $.json({error:"Connection not found"},404);if(X==="register"&&G.oauth_config?.clientId){let y=await $.req.json().catch(()=>({}));return $.json({...typeof y==="object"&&y!==null?y:{},client_id:G.oauth_config.clientId,...G.oauth_config.clientSecret?{client_secret:G.oauth_config.clientSecret}:{},client_secret_expires_at:0})}let W=await Um(G.connection_url),K,H=new URL(G.connection_url),U=(typeof G.metadata?.oauthResource==="string"&&G.metadata.oauthResource.length>0?G.metadata.oauthResource:void 0)??G.connection_url;if(W.ok)K=(await W.json()).authorization_servers?.[0];if(!K)K=H.origin;let N=await q$0(K);if(!N.ok)return $.json({error:"Failed to get auth server metadata"},502);let B=await N.json(),O;if(X==="authorize")O=B.authorization_endpoint;else if(X==="token")O=B.token_endpoint;else if(X==="register")O=B.registration_endpoint;if(!O)return $.json({error:`Unknown OAuth endpoint: ${X}`},404);let L=tt$(O);if(L)return L;let w=new URL(O),j=new URL($.req.url);if(w.search=j.search,X==="authorize"){let y=w.searchParams.get("redirect_uri");if(y){let g=E0().baseUrl??j.origin;try{if(!K68(new URL(y),g))return $.json({error:"invalid_request",error_description:"redirect_uri is not allowed"},400)}catch{return $.json({error:"invalid_request",error_description:"redirect_uri is malformed"},400)}w.searchParams.set("redirect_uri",y)}if(w.searchParams.has("resource"))w.searchParams.set("resource",U);if(Kr$(G.connection_url))w.searchParams.set("auto_personal","true"),w.searchParams.set("force_new","true");return $.redirect(w.toString(),302)}let E={Accept:$.req.header("Accept")||"application/json"},z=$.req.header("Content-Type");if(z)E["Content-Type"]=z;let T=$.req.header("Authorization");if(T)E.Authorization=T;let P,A=null,q=null;if($.req.method!=="GET"&&$.req.method!=="HEAD")if(X==="token"&&z?.includes("application/x-www-form-urlencoded")){if(T?.toLowerCase().startsWith("basic "))try{let i=atob(T.slice(6).trim()),U0=i.indexOf(":");if(U0!==-1){let v0=decodeURIComponent(i.slice(0,U0)),G0=decodeURIComponent(i.slice(U0+1));A=v0||null,q=G0||null}}catch{}let y=await $.req.formData();if(y.has("resource"))y.set("resource",U);let g=y.get("client_id"),u=y.get("client_secret");if(typeof g==="string"&&g)A=g;if(typeof u==="string"&&u)q=u;let n=new URLSearchParams;for(let[i,U0]of y.entries())n.append(i,U0.toString());P=n.toString()}else if(X==="register"&&z?.toLowerCase().includes("application/json")){let y=await Y.db.selectFrom("organization").select(["id","slug","name"]).where("id","=",G.organization_id).executeTakeFirst(),g=await $.req.text(),u={};try{u=g?JSON.parse(g):{}}catch{P=g}let n=typeof u==="object"&&u!==null&&!Array.isArray(u);if(P===void 0&&!n)P=g;if(P===void 0){let i=u,U0=i.metadata&&typeof i.metadata==="object"?i.metadata:{};i.metadata={...U0,organization_id:G.organization_id,...y?.slug?{organization_slug:y.slug}:{},...y?.name?{organization_name:y.name}:{}},P=JSON.stringify(i),E["Content-Type"]="application/json"}}else P=$.req.raw.body??void 0;let x=await fetch(w.toString(),{method:$.req.method,headers:E,body:P,duplex:"half",redirect:"manual"}),_=new Headers,V=["connection","keep-alive","transfer-encoding","content-encoding","content-length"];for(let[y,g]of x.headers.entries())if(!V.includes(y.toLowerCase()))_.set(y,g);if(X==="token"&&x.ok){let y=await x.text();try{let g=JSON.parse(y);if(typeof g.access_token==="string"&&g.access_token){let u=typeof g.expires_in==="number"?new Date(Date.now()+g.expires_in*1000):null,n=null;try{n=await Nm(G.connection_url)??O}catch{n=O}let i={connectionId:Z,accessToken:g.access_token,refreshToken:typeof g.refresh_token==="string"?g.refresh_token:null,scope:typeof g.scope==="string"?g.scope:null,expiresAt:u,clientId:A,clientSecret:q,tokenEndpoint:n};await new Y9(Y.db,Y.vault).upsert(i)}}catch(g){console.error("[oauth-proxy] failed to persist downstream token:",g)}return new Response(y,{status:x.status,statusText:x.statusText,headers:_})}return new Response(x.body,{status:x.status,statusText:x.statusText,headers:_})},H68=async($)=>{let Z=$.var.studioContext;if(!(Z.auth.user?.id??Z.auth.apiKey?.userId))return $.json({error:"Unauthorized"},401);let X=Z.organization?.id;if(!X)return $.json({error:"organization id missing"},400);let Y=$.req.query("types"),J=Y?Y.split(",").map((W)=>W.trim()).filter(Boolean):null,G=crypto.randomUUID();return UO($,async(W)=>{if(await W.writeSSE({event:"connected",data:JSON.stringify({listenerId:G,organizationId:X,typePatterns:J,connectedAt:new Date().toISOString()})}),!K9.add({id:G,organizationId:X,typePatterns:J?.length?J:null,push:(F)=>{W.writeSSE({id:F.id,event:F.type,data:JSON.stringify(F)}).catch(()=>{K9.remove(X,G)})}})){await W.writeSSE({event:"error",data:JSON.stringify({error:"Too many connections",message:"SSE connection limit reached. Try again later."})});return}let H=setInterval(()=>{W.writeSSE({event:"keepalive",data:""}).catch(()=>{clearInterval(H)})},30000);await new Promise((F)=>{W.onAbort(()=>{clearInterval(H),K9.remove(X,G),F()})})})},Ph6,Rh6,qh6=()=>Th6(V8),Mh6=()=>Ah6(V8);var U68=D(()=>{D8();U$();El1();do$();no$();Zr$();B10();j51();Wr$();q00();D9();Rl();r8();X8();fI0();Br$();H71();qG();_F();OW1();S3();R6();W6();PW1();cr$();ir$();Za$();IW1();La$();xW1();Ca$();lW1();_K();EI0();cW1();ba$();gI0();G88();pW1();K88();s20();H10();O88();ZR0();PH1();L88();EH1();P88();k88();_88();v88();x88();y88();h88();i88();aW1();o88();zH1();LH1();m80();N48();XJ();eP0();g51();Ws();Hs();O71();B48();D48();hW1();A48();o91();T48();En();ct();gB();R9();b31();V48();_48();yY0();UF1();Z3();mW1();yB();p91();yY0();L20();Vm0();km0();b48();bh();g48();hm();OW1();Xd();W20();Y68=C(dU(),1);Ph6=new Eh6,Rh6=new Set([$3,eG,bU,xU,AO,ej])});var D68={};E6(D68,{resolveClientDir:()=>bh6,resolveAssetPathWithTraversalCheck:()=>O68,isPathWithinDirectory:()=>B68,createAssetHandler:()=>xh6});import{resolve as k80,dirname as Vh6,join as kh6,extname as Sh6,basename as Ch6,sep as N68}from"path";function _h6($,Z){if($===Z||Ch6($)==="index.html")return{"Cache-Control":"no-cache"};if($.includes(`${N68}assets${N68}`))return{"Cache-Control":"public, max-age=31536000, immutable"};return{}}function B68($,Z){let Q=k80(Z),X=k80($);return X===Q||X.startsWith(Q+"/")}function O68({requestPath:$,clientDir:Z}){let Q=$.startsWith("/")?$.slice(1):$,X=k80(Z,Q);if(!B68(X,Z))return null;return X}function bh6($,Z="../client"){let Q=new URL($),X=Vh6(Q.pathname);return k80(X,Z)}function xh6($={}){let{env:Z="production",clientDir:Q=vh6,isServerPath:X=()=>!1}=$;if(Z==="development")return async function(J){return null};return async function(J){if(J.method!=="GET")return null;let G=new URL(J.url),W;try{W=decodeURIComponent(G.pathname)}catch{return null}if(X(W))return null;let K=O68({requestPath:W,clientDir:Q});if(!K)return null;let H=kh6(K,"index.html"),F=k80(Q,"index.html"),U=J.headers.get("accept"),B=U?.includes("text/html")||U?.includes("*/*")&&["",".html"].includes(Sh6(K))?[H,F]:[];for(let O of[K,...B])try{let L=Bun.file(O);if(await L.exists())return new Response(L,{headers:_h6(O,F)})}catch{}if(W.includes("/assets/"))return new Response("Not Found",{status:404,headers:{"Cache-Control":"no-store"}});return null}}var vh6="./dist/client";var L68=()=>{};var w68={};E6(w68,{tryUpgradePreviewWs:()=>ch6,tryHandlePreviewHttp:()=>lh6,previewWebSocketHandler:()=>dh6,parsePreviewBaseDomain:()=>uh6,isPreviewWsData:()=>jk0,extractHandleFromHost:()=>zF1});function gh6($){if($.method!=="GET")return!1;return($.headers.get("accept")??"").includes("text/html")}function hh6(){return new Response(yh6,{status:503,headers:{"content-type":"text/html; charset=utf-8","cache-control":"no-store","retry-after":"1","access-control-allow-origin":"*"}})}function uh6($){if(!$||$.trim()==="")return null;let Z=$.includes("{handle}")?$.replace("{handle}","__handle__"):$,Q;try{Q=new URL(Z)}catch{return null}let X=Q.hostname;if($.includes("{handle}")){let Y=X.indexOf(".");if(Y<=0||Y===X.length-1)return null;return X.slice(Y+1)}return X}function zF1($,Z){if(!$||!Z)return null;let Q=$.indexOf(":"),X=(Q>=0?$.slice(0,Q):$).toLowerCase(),J=`.${Z.toLowerCase().replace(/^\.+|\.+$/g,"")}`;if(!X.endsWith(J))return null;let G=X.slice(0,X.length-J.length);if(!G||G.includes("."))return null;return G}async function lh6($,Z){let Q=zF1($.headers.get("host"),Z.baseDomain);if(!Q)return null;let X=await Z.getRunner();if(!X)return C80(503,"preview proxy not configured");let Y=await X.proxyPreviewRequest(Q,$);if(Y.headers.get(ab)&&gh6($))return hh6();return Y.headers.delete(ab),Y}function C80($,Z){return new Response(JSON.stringify({error:Z}),{status:$,headers:{"content-type":"application/json","access-control-allow-origin":"*"}})}function jk0($){return typeof $==="object"&&$!==null&&$.kind==="preview"}async function ch6($,Z,Q){if(($.headers.get("upgrade")??"").toLowerCase()!=="websocket")return null;let X=zF1($.headers.get("host"),Q.baseDomain);if(!X)return null;let Y=await Q.getRunner();if(!Y)return C80(503,"preview proxy not configured");let J=await Y.resolvePreviewUpstreamUrl(X);if(!J)return C80(404,"sandbox not found");let G=new URL($.url);if(G.pathname.startsWith("/_sandbox"))return C80(404,"not found");let W=`${J.replace(/^http/,"ws")}${G.pathname}${G.search}`,K=$.headers.get("sec-websocket-protocol"),H=K?K.split(",").map((N)=>N.trim()).filter(Boolean):[],F={kind:"preview",upstreamUrl:W,upstreamProtocols:H,pending:[],upstream:null,closed:!1};if(!Z.upgrade($,{data:F}))return C80(426,"upgrade failed");return}function S80($,Z,Q,X){if(Z.closed)return;Z.closed=!0;try{$.close(Q,X)}catch{}try{Z.upstream?.close()}catch{}}var fh6=256,yh6='<!DOCTYPE html><html><head><meta charset="utf-8"><title>Connecting\u2026</title><style>body{font-family:system-ui,sans-serif;display:flex;align-items:center;justify-content:center;min-height:100vh;margin:0;background:#fafafa;color:#555}div{text-align:center;max-width:420px;padding:24px}h3{margin:0 0 8px}p{margin:0;font-size:14px;color:#999;line-height:1.5}</style></head><body><div><h3>Connecting to sandbox\u2026</h3><p>Waiting for the sandbox to come online. This page refreshes automatically.</p></div><script>setTimeout(function(){window.location.reload()},1500)</script></body></html>',dh6;var j68=D(()=>{C81();dh6={open($){let Z=$.data;if(!jk0(Z))return;let Q;try{Q=Z.upstreamProtocols.length>0?new WebSocket(Z.upstreamUrl,Z.upstreamProtocols):new WebSocket(Z.upstreamUrl)}catch(X){console.warn(`[preview-ws] failed to dial upstream ${Z.upstreamUrl}: ${X instanceof Error?X.message:String(X)}`),S80($,Z,1011,"upstream connect failed");return}Q.binaryType="arraybuffer",Z.upstream=Q,Q.addEventListener("open",()=>{while(Z.pending.length>0){let X=Z.pending.shift();if(X!==void 0)Q.send(X)}}),Q.addEventListener("message",(X)=>{if(Z.closed)return;$.send(X.data)}),Q.addEventListener("close",(X)=>{S80($,Z,X.code||1000,X.reason||"")}),Q.addEventListener("error",()=>{S80($,Z,1011,"upstream error")})},message($,Z){let Q=$.data;if(!jk0(Q))return;let X=Q.upstream;if(X&&X.readyState===WebSocket.OPEN){X.send(Z);return}if(Q.pending.length>=fh6){S80($,Q,1011,"preview ws backlog overflow");return}Q.pending.push(Z)},close($){let Z=$.data;if(!jk0(Z))return;S80($,Z,1000,"")}}});var A68={};E6(A68,{printBanner:()=>ih6,bannerLines:()=>P68,BANNER_LINES:()=>E68,BANNER_GRADIENT:()=>z68});function mh6($){let Z=Number.parseInt($.slice(1),16);return[Z>>16&255,Z>>8&255,Z&255]}function P68($){let Z=E68.map((Q,X)=>{let[Y,J,G]=mh6(z68[X]);return`\x1B[38;2;${Y};${J};${G}m${Q}\x1B[39m`});if($!==void 0)Z.push(`\x1B[2m v${$}\x1B[22m`);return Z}function ih6($){console.log("");for(let Z of P68($))console.log(Z);console.log("")}var E68,z68;var T68=D(()=>{E68=[" \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588 ","\u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2588 \u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2591\u2591\u2591\u2591\u2591\u2588\u2588\u2588 "," \u2591\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2588 \u2591 \u2588\u2588\u2588 \u2591\u2591\u2591 \u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588"," \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588"," \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588\u2591\u2591\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591\u2588\u2588\u2588"," \u2591\u2588\u2588\u2588 \u2588\u2588\u2588 \u2591\u2588\u2588\u2588 \u2591 \u2588\u2591\u2591\u2588\u2588\u2588 \u2588\u2588\u2588\u2591\u2591\u2588\u2588\u2588 \u2588\u2588\u2588 "," \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 \u2591\u2591\u2591\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2591 ","\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591 \u2591\u2591\u2591\u2591\u2591\u2591\u2591 "],z68=["#00ff64","#00ee5e","#00dc56","#00c84e","#00b444","#00a03c","#008832","#006e28"]});D8();var vF1="13";function bF1($){return{name:"decocms",systemDatabaseUrl:$.systemDatabaseUrl,systemDatabaseSchemaName:"dbos",systemDatabasePoolSize:$.poolSize,runAdminServer:!1,executorID:$.executorID,applicationVersion:vF1,...$.listenQueues!==void 0?{listenQueues:$.listenQueues}:{}}}D8();import l68 from"pg";var xF1=8314027461559302n,c68=600000,d68=500;async function fF1($,Z){let{databaseUrl:Q,lockTimeoutMs:X=c68}=$,Y=$.log??((K)=>console.log(K)),J=new l68.Client({connectionString:Q});await J.connect();let G=Date.now(),W=!1;try{while(!W){if(W=(await J.query("SELECT pg_try_advisory_lock($1) AS locked",[xF1.toString()])).rows[0]?.locked===!0,W)break;if(Date.now()-G>=X)throw Error(`Timed out after ${X}ms waiting for the DBOS migration lock. Another process is still migrating the dbos schema; this pod will restart and retry.`);await c$(d68)}let K=Date.now()-G;if(K>1000)Y(`[dbos] waited ${K}ms for the migration lock; another process migrated first`);return await Z()}finally{if(W)try{await J.query("SELECT pg_advisory_unlock($1)",[xF1.toString()])}catch{}await J.end().catch(()=>{})}}U$();kk0();R6();function l58(){let $=(process.env.BUN_OPTIONS??"").split(/\s+/).filter(Boolean);return[...process.argv.slice(1),...$]}function pk0($,Z){for(let Q=0;Q<$.length;Q++){let X=$[Q];if(X===void 0)continue;if(X===Z)return $[Q+1];if(X.startsWith(`${Z}=`))return X.slice(Z.length+1)}return}function EU1(){let $=l58();if($.includes("--cpu-prof")){console.log(JSON.stringify({msg:"cpu-profiling-active",dir:pk0($,"--cpu-prof-dir")??process.cwd(),name:pk0($,"--cpu-prof-name"),markdown:$.includes("--cpu-prof-md"),intervalUs:Number(pk0($,"--cpu-prof-interval")??1000),note:"profile is written on process exit"}));return}if(process.env.CPU_PROFILE)console.warn(JSON.stringify({msg:"cpu-profiling-requested-but-inactive",hint:'CPU profiling is a Bun launch flag. Set BUN_OPTIONS="--cpu-prof --cpu-prof-md --cpu-prof-dir=/tmp" before starting the process.'}))}ok0();var n80;function VU1(){if(process.env.HEAP_WATCH!=="1")return()=>{};let $=Number(process.env.HEAP_WATCH_INTERVAL_MS??60000),Z=async()=>{let Q=QE();if(!Q)return;let X={};try{let{heapStats:Y}=await import("bun:jsc"),J=Y(),G=Object.entries(J.objectTypeCounts).sort((W,K)=>K[1]-W[1]).slice(0,20);X={objectCount:J.objectCount,heapSize:J.heapSize,top:Object.fromEntries(G)}}catch{}console.log(JSON.stringify({msg:"heap-watch",ts:new Date().toISOString(),uptimeS:Math.round(process.uptime()),rss:Q.rss,heapUsed:Q.heapUsed,heapTotal:Q.heapTotal,external:Q.external,arrayBuffers:Q.arrayBuffers,...X}))};return Z().catch(()=>{}),n80=setInterval(()=>void Z().catch(()=>{}),$),n80.unref?.(),process.on("SIGUSR2",()=>{try{let Q=Bun.generateHeapSnapshot("v8"),X=typeof Q==="string"?Q:JSON.stringify(Q),Y=`/tmp/heap-${process.pid}-${Date.now()}.heapsnapshot`;Bun.write(Y,X),console.log(JSON.stringify({msg:"heap-snapshot-written",path:Y}))}catch(Q){console.error("[heap-watch] snapshot failed:",Q)}}),()=>{if(n80)clearInterval(n80)}}import*as m58 from"bun:jsc";var{startSamplingProfiler:i58,samplingProfilerStackTraces:p58}=m58;function kU1(){if(process.env.STALL_WATCHDOG!=="1")return()=>{};let $=Number(process.env.STALL_WATCHDOG_MS??100),Z=Number(process.env.STALL_WATCHDOG_TICK_MS??50);try{i58()}catch(J){return console.error("[stall-watchdog] failed to start sampling profiler:",J),()=>{}}let Q,X=performance.now()+Z,Y=()=>{let J=performance.now(),G=J-X;X=J+Z;let W=[];try{W=p58()?.traces??[]}catch{}if(G>$&&W.length>0){let K=new Map;for(let F of W){let U=F.frames.find((O)=>O.sourceURL&&!/Unknown Executable/.test(O.category??""))??F.frames[0];if(!U)continue;let N=(U.sourceURL??"?").replace(/^.*\/node_modules\//,"node_modules/"),B=`${U.name??"?"} @ ${N}:${U.line??"?"}`;K.set(B,(K.get(B)??0)+1)}let H=[...K.entries()].sort((F,U)=>U[1]-F[1]).slice(0,8).map(([F,U])=>({frame:F,count:U}));console.warn(JSON.stringify({msg:"stall-stack",ts:new Date().toISOString(),lagMs:Math.round(G),samplesInWindow:W.length,top:H}))}Q=setTimeout(Y,Z),Q.unref?.()};return Q=setTimeout(Y,Z),Q.unref?.(),()=>{if(Q)clearTimeout(Q)}}function SU1(){EU1();let $=[VU1(),IU1(),kU1()];return()=>{for(let Z of $)Z()}}import{existsSync as eh6}from"fs";var bJ=E0();LU1();var{DBOS:_80,DBOSClient:ph6}=await import("@dbos-inc/dbos-sdk");function MF1($,Z){if(!Z)return $;let Q=new URL($);if(!Q.searchParams.has("sslmode"))Q.searchParams.set("sslmode","verify-full");return Q.toString()}var nh6=[$3,eG,bU,xU,AO,ej],th6=bJ.dispatchRole==="worker"?nh6:bJ.dispatchRole==="api"?[]:void 0;_80.setConfig(bF1({systemDatabaseUrl:MF1(bJ.databaseUrl,bJ.databasePgSsl),poolSize:bJ.dbosPoolSize,executorID:bJ.podName,listenQueues:th6}));var{createApp:oh6}=await Promise.resolve().then(() => (U68(),F68)),{isServerPath:rh6}=await Promise.resolve().then(() => (m80(),eF1)),{createAssetHandler:ah6,resolveClientDir:V68}=await Promise.resolve().then(() => (L68(),D68)),sh6=bJ.port,R68=V68(import.meta.url,"../client"),k68=eh6(R68)?R68:V68(import.meta.url,"../dist/client"),$u6=ah6({clientDir:k68,isServerPath:rh6}),Zu6={"X-Frame-Options":"DENY","Content-Security-Policy":"frame-ancestors 'none'"};function Qu6($){let Z=new Headers($.headers);for(let[Q,X]of Object.entries(Zu6))Z.set(Q,X);return new Response($.body,{status:$.status,statusText:$.statusText,headers:Z})}var{parsePreviewBaseDomain:Xu6,tryHandlePreviewHttp:Yu6,tryUpgradePreviewWs:Ju6,previewWebSocketHandler:PF1,isPreviewWsData:AF1}=await Promise.resolve().then(() => (j68(),w68)),{getOrInitSharedRunner:S68}=await Promise.resolve().then(() => (dK(),Hj$)),C68=Xu6(process.env.STUDIO_SANDBOX_PREVIEW_URL_PATTERN),q68={baseDomain:C68??"",getRunner:S68};if(process.env.STUDIO_SANDBOX_TENANT_POOLS?.trim())S68().catch(($)=>{console.warn("[lifecycle] eager sandbox provider init for tenant pools failed:",$ instanceof Error?$.message:String($))});var Ek0=await oh6({clientDir:k68}),TF1=process.env.DBOS_CONDUCTOR_KEY?.trim(),M68=process.env.DBOS_CONDUCTOR_URL?.trim();await fF1({databaseUrl:MF1(bJ.databaseUrl,bJ.databasePgSsl)},()=>_80.launch({...TF1?{conductorKey:TF1}:{},...TF1&&M68?{conductorURL:M68}:{}}));console.log(`[dbos] application version: ${_80.applicationVersion}`);var RF1=5,qF1=0;await c8(async()=>{qF1++;try{return await Ek0.initDbos()}catch($){let Z=qF1>=RF1?"giving up":"retrying";throw console.warn(`[dbos] initDbos attempt ${qF1}/${RF1} failed, ${Z}`,$),$}},{maxAttempts:RF1,minTimeout:1000,maxTimeout:1e4,jitter:0.5});if(!bJ.isCli){let{bannerLines:$}=await Promise.resolve().then(() => (T68(),A68));console.log("");for(let Z of $())console.log(Z)}var Gu6=Bun.serve({idleTimeout:0,port:sh6,hostname:"0.0.0.0",fetch:async($,Z)=>{if(C68){let X=await Ju6($,Z,q68);if(X===void 0)return;if(X)return X;let Y=await Yu6($,q68);if(Y)return Y}let Q=await $u6($);if(Q)return Qu6(Q);return Ek0.fetch($,{server:Z})},websocket:{open($){if(AF1($.data))PF1.open($)},message($,Z){if(AF1($.data))PF1.message($,Z)},close($){if(AF1($.data))PF1.close($)}},development:!1}),Wu6=SU1();if(bJ.localMode)Promise.resolve().then(() => (Mx(),tT0)).then(async({seedLocalMode:$,markSeedComplete:Z,healLocalJwks:Q})=>{try{let X=await Q();if(X>0)console.log(`[local-mode] cleared ${X} undecryptable JWKS key(s); Better Auth will generate a fresh one`);let Y=await $()}catch(X){console.error("Failed to seed local mode:",X)}finally{Z()}}).catch(async($)=>{console.error("Failed to load local-mode module:",$);try{let{markSeedComplete:Z}=await Promise.resolve().then(() => (Mx(),tT0));Z()}catch{}});var I68=!1;async function Ku6($){let Z;try{Z=await ph6.create({systemDatabaseUrl:MF1(bJ.databaseUrl,bJ.databasePgSsl),systemDatabaseSchemaName:"dbos"});let Q=await Z.listWorkflows({status:"PENDING",queueName:eG,executorId:$,loadInput:!1,loadOutput:!1});if(Q.length===0){console.log(`[shutdown] no in-flight thread-gate gates to hand off (executor ${$})`);return}let X=Q.map((Y)=>Y.workflowID);await Z.resumeWorkflows(X,{queueName:eG}),console.log(`[shutdown] re-enqueued ${X.length} in-flight thread-gate gate(s) for re-adoption by a live executor (from ${$}):`,X)}catch(Q){console.error("[shutdown] thread-gate handoff failed:",Q)}finally{await Z?.destroy().catch(()=>{})}}async function zk0($){if(I68)return;I68=!0,console.log(`
3367
3367
  [shutdown] Received ${$}, shutting down gracefully...`);let Z=Number(process.env.SHUTDOWN_GRACE_SECONDS??60)*1000,Q=Math.max(Z-5000,1e4),X=setTimeout(()=>{console.error(`[shutdown] Timed out after ${Q}ms, forcing exit.`),process.exit(1)},Q);X.unref?.();let Y=0;try{Wu6(),Ek0.markShuttingDown();let J=gF1(bJ.dispatchRole,Q,process.env.SHUTDOWN_DRAIN_MS);await c$(J),await Gu6.stop(!0);let G=_80.executorID;await _80.shutdown(),await Ku6(G),await Ek0.shutdown()}catch(J){console.error("[shutdown] Error during shutdown:",J),Y=1}clearTimeout(X),process.exit(Y)}process.on("SIGTERM",()=>zk0("SIGTERM"));process.on("SIGINT",()=>zk0("SIGINT"));process.on("SIGHUP",()=>zk0("SIGHUP"));process.on("unhandledRejection",($)=>{console.error("[process] Unhandled rejection:",$)});process.on("uncaughtException",($)=>{console.error("[process] Uncaught exception:",$),zk0("uncaughtException")});