@sonicjs-cms/core 3.0.0-beta.24 → 3.0.0-beta.26

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 (163) hide show
  1. package/bin/db-reset.js +39 -22
  2. package/dist/admin-documents-form.template-JWV5GITD.js +6 -0
  3. package/dist/{admin-documents-form.template-55V2ZGWT.js.map → admin-documents-form.template-JWV5GITD.js.map} +1 -1
  4. package/dist/admin-documents-form.template-UWKGVAMW.cjs +19 -0
  5. package/dist/{admin-layout-catalyst.template-6UQGLCKI.js.map → admin-documents-form.template-UWKGVAMW.cjs.map} +1 -1
  6. package/dist/admin-layout-catalyst.template-MOQ3BBXA.cjs +21 -0
  7. package/dist/{admin-layout-catalyst.template-3XZXDGF7.cjs.map → admin-layout-catalyst.template-MOQ3BBXA.cjs.map} +1 -1
  8. package/dist/admin-layout-catalyst.template-WCYMQVTZ.js +7 -0
  9. package/dist/{admin-documents-form.template-YNAVMJCV.cjs.map → admin-layout-catalyst.template-WCYMQVTZ.js.map} +1 -1
  10. package/dist/{app-01M0dIwt.d.ts → app-BP5IlK94.d.ts} +7 -7
  11. package/dist/{app-aj39TGHB.d.cts → app-fdq4K3vw.d.cts} +7 -7
  12. package/dist/catalog-56DR6OXI.cjs +41 -0
  13. package/dist/catalog-56DR6OXI.cjs.map +1 -0
  14. package/dist/catalog-6MB37KY7.js +4 -0
  15. package/dist/catalog-6MB37KY7.js.map +1 -0
  16. package/dist/{chunk-QCJHCSOK.cjs → chunk-4DHPR7KR.cjs} +77 -17
  17. package/dist/chunk-4DHPR7KR.cjs.map +1 -0
  18. package/dist/{chunk-UIHIXTIS.js → chunk-5YSFQO7X.js} +40 -13
  19. package/dist/chunk-5YSFQO7X.js.map +1 -0
  20. package/dist/{chunk-GMMCCIQO.cjs → chunk-6UAI4SGN.cjs} +3 -3
  21. package/dist/{chunk-GMMCCIQO.cjs.map → chunk-6UAI4SGN.cjs.map} +1 -1
  22. package/dist/{chunk-2XAQTPAE.js → chunk-6X22VFEV.js} +8 -2
  23. package/dist/chunk-6X22VFEV.js.map +1 -0
  24. package/dist/{chunk-URIBTX27.js → chunk-73RTFFMX.js} +3 -3
  25. package/dist/{chunk-URIBTX27.js.map → chunk-73RTFFMX.js.map} +1 -1
  26. package/dist/{chunk-QJUJNTIU.cjs → chunk-A22RBHO7.cjs} +43 -12
  27. package/dist/chunk-A22RBHO7.cjs.map +1 -0
  28. package/dist/{chunk-QZGABF2M.js → chunk-AMP4BSJE.js} +18 -7
  29. package/dist/chunk-AMP4BSJE.js.map +1 -0
  30. package/dist/{chunk-37V3RET3.cjs → chunk-BRKXMRMB.cjs} +99 -98
  31. package/dist/chunk-BRKXMRMB.cjs.map +1 -0
  32. package/dist/{chunk-36Z3AKX3.cjs → chunk-C5LDQ3SH.cjs} +8 -2
  33. package/dist/chunk-C5LDQ3SH.cjs.map +1 -0
  34. package/dist/{chunk-BBEKHLTW.cjs → chunk-CN3T3TDI.cjs} +9 -9
  35. package/dist/{chunk-BBEKHLTW.cjs.map → chunk-CN3T3TDI.cjs.map} +1 -1
  36. package/dist/{chunk-BHND5PEV.js → chunk-E3TQG7AA.js} +3 -3
  37. package/dist/{chunk-BHND5PEV.js.map → chunk-E3TQG7AA.js.map} +1 -1
  38. package/dist/{chunk-FHPEM77Y.js → chunk-EEA476CJ.js} +88 -83
  39. package/dist/chunk-EEA476CJ.js.map +1 -0
  40. package/dist/chunk-F6BTBE4S.js +119 -0
  41. package/dist/chunk-F6BTBE4S.js.map +1 -0
  42. package/dist/chunk-FZGIU5AZ.cjs +128 -0
  43. package/dist/chunk-FZGIU5AZ.cjs.map +1 -0
  44. package/dist/{chunk-BJROXF4N.js → chunk-HSDJDWLV.js} +19 -4
  45. package/dist/chunk-HSDJDWLV.js.map +1 -0
  46. package/dist/{chunk-VGEZNFWH.js → chunk-JD7BZU3A.js} +5 -4
  47. package/dist/chunk-JD7BZU3A.js.map +1 -0
  48. package/dist/{chunk-SOZUG52O.js → chunk-JG5J434C.js} +3 -3
  49. package/dist/{chunk-SOZUG52O.js.map → chunk-JG5J434C.js.map} +1 -1
  50. package/dist/{chunk-BP52BFIV.cjs → chunk-KWQNB6UM.cjs} +6 -5
  51. package/dist/chunk-KWQNB6UM.cjs.map +1 -0
  52. package/dist/{chunk-UYJQDDEE.cjs → chunk-MI2YXCK4.cjs} +14 -8
  53. package/dist/chunk-MI2YXCK4.cjs.map +1 -0
  54. package/dist/{chunk-VC5XVPLM.js → chunk-OJFIQGZB.js} +512 -148
  55. package/dist/chunk-OJFIQGZB.js.map +1 -0
  56. package/dist/{chunk-LTZ5WYOK.cjs → chunk-OLEOKHDX.cjs} +25 -2
  57. package/dist/chunk-OLEOKHDX.cjs.map +1 -0
  58. package/dist/{chunk-E66UVONV.cjs → chunk-OUBUS74I.cjs} +24 -9
  59. package/dist/chunk-OUBUS74I.cjs.map +1 -0
  60. package/dist/{chunk-A2SN3RVL.cjs → chunk-PAS7GZBS.cjs} +40 -13
  61. package/dist/chunk-PAS7GZBS.cjs.map +1 -0
  62. package/dist/{chunk-RJ2O5IIE.js → chunk-RVOX2WH2.js} +74 -18
  63. package/dist/chunk-RVOX2WH2.js.map +1 -0
  64. package/dist/{chunk-3TMTYJAJ.js → chunk-RXLI3ADU.js} +25 -2
  65. package/dist/chunk-RXLI3ADU.js.map +1 -0
  66. package/dist/{chunk-I767LVN7.cjs → chunk-S2QN4LFD.cjs} +881 -515
  67. package/dist/chunk-S2QN4LFD.cjs.map +1 -0
  68. package/dist/{chunk-IXUHXTHW.cjs → chunk-SFGYZUWU.cjs} +18 -7
  69. package/dist/chunk-SFGYZUWU.cjs.map +1 -0
  70. package/dist/{chunk-THFZSDIU.js → chunk-SXC4HPK6.js} +14 -8
  71. package/dist/chunk-SXC4HPK6.js.map +1 -0
  72. package/dist/{chunk-JMJM7DMM.cjs → chunk-TT3TQSCZ.cjs} +5 -5
  73. package/dist/{chunk-JMJM7DMM.cjs.map → chunk-TT3TQSCZ.cjs.map} +1 -1
  74. package/dist/{chunk-LNI3FYSI.js → chunk-UB5QSRO7.js} +9 -14
  75. package/dist/chunk-UB5QSRO7.js.map +1 -0
  76. package/dist/{chunk-VYQVDL2M.js → chunk-UKIDWRA3.js} +36 -5
  77. package/dist/chunk-UKIDWRA3.js.map +1 -0
  78. package/dist/{chunk-KKNEYIZJ.cjs → chunk-XZUEGFXE.cjs} +9 -14
  79. package/dist/chunk-XZUEGFXE.cjs.map +1 -0
  80. package/dist/{collection-config-BTzAvKt2.d.cts → collection-config-U2dydD_O.d.cts} +14 -0
  81. package/dist/{collection-config-BTzAvKt2.d.ts → collection-config-U2dydD_O.d.ts} +14 -0
  82. package/dist/config-DOAWXZBG.js +6 -0
  83. package/dist/{config-6FB2BXMP.js.map → config-DOAWXZBG.js.map} +1 -1
  84. package/dist/{config-OCH7S4WK.cjs → config-VLU73ZW7.cjs} +5 -5
  85. package/dist/{config-OCH7S4WK.cjs.map → config-VLU73ZW7.cjs.map} +1 -1
  86. package/dist/{define-plugin-D_6D9vVZ.d.ts → define-plugin-DDe8a_bh.d.ts} +3 -0
  87. package/dist/{define-plugin-DMcvEy_C.d.cts → define-plugin-rjXmGOgu.d.cts} +3 -0
  88. package/dist/index.cjs +698 -392
  89. package/dist/index.cjs.map +1 -1
  90. package/dist/index.d.cts +27 -12
  91. package/dist/index.d.ts +27 -12
  92. package/dist/index.js +340 -35
  93. package/dist/index.js.map +1 -1
  94. package/dist/middleware.cjs +47 -47
  95. package/dist/middleware.d.cts +10 -10
  96. package/dist/middleware.d.ts +10 -10
  97. package/dist/middleware.js +6 -6
  98. package/dist/migrations-6M6772UC.cjs +13 -0
  99. package/dist/{migrations-FGXZPKDC.cjs.map → migrations-6M6772UC.cjs.map} +1 -1
  100. package/dist/migrations-GZ2HIB4I.js +4 -0
  101. package/dist/{migrations-Z6D27NAW.js.map → migrations-GZ2HIB4I.js.map} +1 -1
  102. package/dist/{plugin-bootstrap-BHWQ2df8.d.cts → plugin-bootstrap-CfVILQeP.d.ts} +1 -1
  103. package/dist/{plugin-bootstrap-Bj4fxX1q.d.ts → plugin-bootstrap-RY5pkoOT.d.cts} +1 -1
  104. package/dist/plugins.cjs +40 -40
  105. package/dist/plugins.d.cts +1 -1
  106. package/dist/plugins.d.ts +1 -1
  107. package/dist/plugins.js +3 -3
  108. package/dist/rbac-TFUOYIVN.cjs +14 -0
  109. package/dist/{rbac-7QZ4JZ2E.cjs.map → rbac-TFUOYIVN.cjs.map} +1 -1
  110. package/dist/rbac-XSNP76CV.js +5 -0
  111. package/dist/{rbac-Y43IEQOP.js.map → rbac-XSNP76CV.js.map} +1 -1
  112. package/dist/routes.cjs +33 -32
  113. package/dist/routes.d.cts +3 -5
  114. package/dist/routes.d.ts +3 -5
  115. package/dist/routes.js +13 -12
  116. package/dist/services.cjs +30 -30
  117. package/dist/services.d.cts +10 -3
  118. package/dist/services.d.ts +10 -3
  119. package/dist/services.js +3 -3
  120. package/dist/{telemetry-Cku1ax74.d.cts → telemetry-QFlTv9f8.d.cts} +1 -1
  121. package/dist/{telemetry-Cku1ax74.d.ts → telemetry-QFlTv9f8.d.ts} +1 -1
  122. package/dist/templates.cjs +17 -17
  123. package/dist/templates.js +3 -3
  124. package/dist/types.d.cts +2 -2
  125. package/dist/types.d.ts +2 -2
  126. package/dist/utils.cjs +12 -12
  127. package/dist/utils.d.cts +2 -2
  128. package/dist/utils.d.ts +2 -2
  129. package/dist/utils.js +2 -2
  130. package/package.json +7 -12
  131. package/dist/admin-documents-form.template-55V2ZGWT.js +0 -6
  132. package/dist/admin-documents-form.template-YNAVMJCV.cjs +0 -19
  133. package/dist/admin-layout-catalyst.template-3XZXDGF7.cjs +0 -21
  134. package/dist/admin-layout-catalyst.template-6UQGLCKI.js +0 -7
  135. package/dist/chunk-2XAQTPAE.js.map +0 -1
  136. package/dist/chunk-36Z3AKX3.cjs.map +0 -1
  137. package/dist/chunk-37V3RET3.cjs.map +0 -1
  138. package/dist/chunk-3TMTYJAJ.js.map +0 -1
  139. package/dist/chunk-A2SN3RVL.cjs.map +0 -1
  140. package/dist/chunk-BJROXF4N.js.map +0 -1
  141. package/dist/chunk-BP52BFIV.cjs.map +0 -1
  142. package/dist/chunk-E66UVONV.cjs.map +0 -1
  143. package/dist/chunk-FHPEM77Y.js.map +0 -1
  144. package/dist/chunk-I767LVN7.cjs.map +0 -1
  145. package/dist/chunk-IXUHXTHW.cjs.map +0 -1
  146. package/dist/chunk-KKNEYIZJ.cjs.map +0 -1
  147. package/dist/chunk-LNI3FYSI.js.map +0 -1
  148. package/dist/chunk-LTZ5WYOK.cjs.map +0 -1
  149. package/dist/chunk-QCJHCSOK.cjs.map +0 -1
  150. package/dist/chunk-QJUJNTIU.cjs.map +0 -1
  151. package/dist/chunk-QZGABF2M.js.map +0 -1
  152. package/dist/chunk-RJ2O5IIE.js.map +0 -1
  153. package/dist/chunk-THFZSDIU.js.map +0 -1
  154. package/dist/chunk-UIHIXTIS.js.map +0 -1
  155. package/dist/chunk-UYJQDDEE.cjs.map +0 -1
  156. package/dist/chunk-VC5XVPLM.js.map +0 -1
  157. package/dist/chunk-VGEZNFWH.js.map +0 -1
  158. package/dist/chunk-VYQVDL2M.js.map +0 -1
  159. package/dist/config-6FB2BXMP.js +0 -6
  160. package/dist/migrations-FGXZPKDC.cjs +0 -13
  161. package/dist/migrations-Z6D27NAW.js +0 -4
  162. package/dist/rbac-7QZ4JZ2E.cjs +0 -14
  163. package/dist/rbac-Y43IEQOP.js +0 -5
package/dist/index.cjs CHANGED
@@ -1,27 +1,28 @@
1
1
  'use strict';
2
2
 
3
- var chunkGMMCCIQO_cjs = require('./chunk-GMMCCIQO.cjs');
4
- var chunkI767LVN7_cjs = require('./chunk-I767LVN7.cjs');
3
+ var chunk6UAI4SGN_cjs = require('./chunk-6UAI4SGN.cjs');
4
+ var chunkS2QN4LFD_cjs = require('./chunk-S2QN4LFD.cjs');
5
+ require('./chunk-TT3TQSCZ.cjs');
6
+ var chunkFZGIU5AZ_cjs = require('./chunk-FZGIU5AZ.cjs');
5
7
  require('./chunk-XWVDSM2L.cjs');
6
- require('./chunk-JMJM7DMM.cjs');
7
- var chunk36Z3AKX3_cjs = require('./chunk-36Z3AKX3.cjs');
8
+ var chunkC5LDQ3SH_cjs = require('./chunk-C5LDQ3SH.cjs');
8
9
  var chunkYA3TJ65D_cjs = require('./chunk-YA3TJ65D.cjs');
9
10
  var chunkYP7GW2G5_cjs = require('./chunk-YP7GW2G5.cjs');
10
- var chunk37V3RET3_cjs = require('./chunk-37V3RET3.cjs');
11
- var chunkLTZ5WYOK_cjs = require('./chunk-LTZ5WYOK.cjs');
11
+ var chunkBRKXMRMB_cjs = require('./chunk-BRKXMRMB.cjs');
12
+ var chunkOLEOKHDX_cjs = require('./chunk-OLEOKHDX.cjs');
12
13
  var chunkKIGVVO6N_cjs = require('./chunk-KIGVVO6N.cjs');
13
- var chunkQCJHCSOK_cjs = require('./chunk-QCJHCSOK.cjs');
14
- var chunkA2SN3RVL_cjs = require('./chunk-A2SN3RVL.cjs');
15
- var chunkBBEKHLTW_cjs = require('./chunk-BBEKHLTW.cjs');
16
- var chunkE66UVONV_cjs = require('./chunk-E66UVONV.cjs');
17
- var chunkUYJQDDEE_cjs = require('./chunk-UYJQDDEE.cjs');
18
- var chunkQJUJNTIU_cjs = require('./chunk-QJUJNTIU.cjs');
19
- var chunkBP52BFIV_cjs = require('./chunk-BP52BFIV.cjs');
14
+ var chunk4DHPR7KR_cjs = require('./chunk-4DHPR7KR.cjs');
15
+ var chunkPAS7GZBS_cjs = require('./chunk-PAS7GZBS.cjs');
16
+ var chunkCN3T3TDI_cjs = require('./chunk-CN3T3TDI.cjs');
17
+ var chunkOUBUS74I_cjs = require('./chunk-OUBUS74I.cjs');
18
+ var chunkMI2YXCK4_cjs = require('./chunk-MI2YXCK4.cjs');
19
+ var chunkA22RBHO7_cjs = require('./chunk-A22RBHO7.cjs');
20
+ var chunkKWQNB6UM_cjs = require('./chunk-KWQNB6UM.cjs');
20
21
  var chunkJ6JTWD2A_cjs = require('./chunk-J6JTWD2A.cjs');
21
- var chunkIXUHXTHW_cjs = require('./chunk-IXUHXTHW.cjs');
22
+ var chunkSFGYZUWU_cjs = require('./chunk-SFGYZUWU.cjs');
22
23
  var chunkRCQ2HIQD_cjs = require('./chunk-RCQ2HIQD.cjs');
23
24
  require('./chunk-P3XDZL6Q.cjs');
24
- var chunkKKNEYIZJ_cjs = require('./chunk-KKNEYIZJ.cjs');
25
+ var chunkXZUEGFXE_cjs = require('./chunk-XZUEGFXE.cjs');
25
26
  var chunkMNWKYY5E_cjs = require('./chunk-MNWKYY5E.cjs');
26
27
  var chunkQTFKZBLC_cjs = require('./chunk-QTFKZBLC.cjs');
27
28
  require('./chunk-IGJUBJBW.cjs');
@@ -263,7 +264,7 @@ var DatabaseToolsService = class {
263
264
  };
264
265
 
265
266
  // src/templates/pages/admin-database-table.template.ts
266
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
267
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
267
268
  function renderDatabaseTablePage(data) {
268
269
  const totalPages = Math.ceil(data.totalRows / data.pageSize);
269
270
  const startRow = (data.currentPage - 1) * data.pageSize + 1;
@@ -613,7 +614,7 @@ function renderDatabaseTablePage(data) {
613
614
  user: data.user,
614
615
  content: pageContent
615
616
  };
616
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
617
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
617
618
  }
618
619
  function generatePageNumbers(currentPage, totalPages) {
619
620
  const pages = [];
@@ -701,7 +702,7 @@ function formatCellValue(value, colName) {
701
702
  // src/plugins/core-plugins/database-tools-plugin/admin-routes.ts
702
703
  function createDatabaseToolsAdminRoutes() {
703
704
  const router3 = new hono.Hono();
704
- router3.use("*", chunk37V3RET3_cjs.requireAuth());
705
+ router3.use("*", chunkBRKXMRMB_cjs.requireAuth());
705
706
  router3.get("/api/stats", async (c) => {
706
707
  try {
707
708
  const user = c.get("user");
@@ -1060,7 +1061,7 @@ var SiteConfigService = class {
1060
1061
  db;
1061
1062
  env;
1062
1063
  async load() {
1063
- const settings = new chunk36Z3AKX3_cjs.SettingsService(this.db);
1064
+ const settings = new chunkC5LDQ3SH_cjs.SettingsService(this.db);
1064
1065
  const general = await settings.getGeneralSettings();
1065
1066
  const siteUrl = this.env.PUBLIC_URL || "http://localhost:8787";
1066
1067
  return {
@@ -1110,7 +1111,7 @@ var SiteConfigService = class {
1110
1111
 
1111
1112
  // src/plugins/core-plugins/email-plugin/routes/admin.ts
1112
1113
  var adminRoutes = new hono.Hono();
1113
- adminRoutes.use("*", chunk37V3RET3_cjs.requireAuth());
1114
+ adminRoutes.use("*", chunkBRKXMRMB_cjs.requireAuth());
1114
1115
  adminRoutes.post("/settings", async (c) => {
1115
1116
  if (c.get("user")?.role !== "admin") {
1116
1117
  return c.json({ error: "admin role required" }, 403);
@@ -1148,7 +1149,7 @@ adminRoutes.post("/test", async (c) => {
1148
1149
  const { subject, html: html4, text } = renderTestEmail({ siteName });
1149
1150
  try {
1150
1151
  const settingsLoaded = await settings.load();
1151
- const result = await chunkI767LVN7_cjs.getEmailService().send({
1152
+ const result = await chunkS2QN4LFD_cjs.getEmailService().send({
1152
1153
  to,
1153
1154
  subject,
1154
1155
  html: html4,
@@ -1230,7 +1231,7 @@ function makeOnRegistrationCompleted(env) {
1230
1231
  siteName,
1231
1232
  loginUrl: siteConfig.buildLoginUrl(siteUrl)
1232
1233
  });
1233
- const result = await chunkI767LVN7_cjs.getEmailService().send({
1234
+ const result = await chunkS2QN4LFD_cjs.getEmailService().send({
1234
1235
  to: user.email,
1235
1236
  subject,
1236
1237
  html: html4,
@@ -1304,7 +1305,7 @@ function makeOnPasswordResetRequested(env) {
1304
1305
  expiresAt: Date.now() + DEFAULT_EXPIRY_MS,
1305
1306
  siteName
1306
1307
  });
1307
- const result = await chunkI767LVN7_cjs.getEmailService().send({
1308
+ const result = await chunkS2QN4LFD_cjs.getEmailService().send({
1308
1309
  to: user.email,
1309
1310
  subject,
1310
1311
  html: html4,
@@ -1372,7 +1373,7 @@ function makeOnPasswordResetCompleted(env) {
1372
1373
  supportEmail,
1373
1374
  when: Date.now()
1374
1375
  });
1375
- const result = await chunkI767LVN7_cjs.getEmailService().send({
1376
+ const result = await chunkS2QN4LFD_cjs.getEmailService().send({
1376
1377
  to: user.email,
1377
1378
  subject,
1378
1379
  html: html4,
@@ -2113,7 +2114,7 @@ var CloudflareEmailProvider = class {
2113
2114
  }
2114
2115
  }
2115
2116
  };
2116
- var emailPluginV3 = chunkBP52BFIV_cjs.definePlugin({
2117
+ var emailPluginV3 = chunkKWQNB6UM_cjs.definePlugin({
2117
2118
  id: "email",
2118
2119
  version: "1.0.0",
2119
2120
  name: "Email",
@@ -2127,7 +2128,7 @@ var emailPluginV3 = chunkBP52BFIV_cjs.definePlugin({
2127
2128
  const db = env.DB;
2128
2129
  if (db) {
2129
2130
  try {
2130
- const typeRegistry = new chunk37V3RET3_cjs.DocumentTypeRegistry(db);
2131
+ const typeRegistry = new chunkBRKXMRMB_cjs.DocumentTypeRegistry(db);
2131
2132
  await typeRegistry.register({
2132
2133
  id: "email_log",
2133
2134
  name: "email_log",
@@ -2142,7 +2143,7 @@ var emailPluginV3 = chunkBP52BFIV_cjs.definePlugin({
2142
2143
  } catch {
2143
2144
  }
2144
2145
  }
2145
- if (!chunkI767LVN7_cjs.hasEmailService()) {
2146
+ if (!chunkS2QN4LFD_cjs.hasEmailService()) {
2146
2147
  const settings = db ? await new EmailSettingsService(db).load() : {};
2147
2148
  const envResendKey = typeof env.RESEND_API_KEY === "string" && env.RESEND_API_KEY ? env.RESEND_API_KEY : void 0;
2148
2149
  const cfEmailBinding = env.EMAIL;
@@ -2160,7 +2161,7 @@ var emailPluginV3 = chunkBP52BFIV_cjs.definePlugin({
2160
2161
  } else {
2161
2162
  provider = resolveEmailProvider({ env });
2162
2163
  }
2163
- chunkI767LVN7_cjs.setEmailService(new EmailService({ ...serviceOpts, provider }));
2164
+ chunkS2QN4LFD_cjs.setEmailService(new EmailService({ ...serviceOpts, provider }));
2164
2165
  }
2165
2166
  ctx.hooks.on("auth:registration:completed", makeOnRegistrationCompleted(env));
2166
2167
  ctx.hooks.on("auth:password-reset:requested", makeOnPasswordResetRequested(env));
@@ -2171,7 +2172,7 @@ var emailPluginV3 = chunkBP52BFIV_cjs.definePlugin({
2171
2172
  var BATCH_SIZE = 100;
2172
2173
  ({
2173
2174
  schema: zod.z.record(zod.z.string(), zod.z.unknown())});
2174
- var emailReconciliationPlugin = chunkBP52BFIV_cjs.definePlugin({
2175
+ var emailReconciliationPlugin = chunkKWQNB6UM_cjs.definePlugin({
2175
2176
  id: "email-reconciliation",
2176
2177
  version: "1.0.0",
2177
2178
  description: "Hourly cron that backfills email delivery state from provider status APIs. Only active for providers that implement EmailProvider.reconcile().",
@@ -2192,11 +2193,11 @@ var emailReconciliationPlugin = chunkBP52BFIV_cjs.definePlugin({
2192
2193
  console.warn("[email-reconciliation] No DB binding in cron env \u2014 skipping.");
2193
2194
  return;
2194
2195
  }
2195
- if (!chunkI767LVN7_cjs.hasEmailService()) {
2196
+ if (!chunkS2QN4LFD_cjs.hasEmailService()) {
2196
2197
  console.warn("[email-reconciliation] EmailService not initialized \u2014 skipping.");
2197
2198
  return;
2198
2199
  }
2199
- const emailService = chunkI767LVN7_cjs.getEmailService();
2200
+ const emailService = chunkS2QN4LFD_cjs.getEmailService();
2200
2201
  let rows = [];
2201
2202
  try {
2202
2203
  const result = await db.prepare(
@@ -2629,7 +2630,7 @@ function buildOtpApi() {
2629
2630
  console.warn("Failed to parse OTP plugin settings, using defaults");
2630
2631
  }
2631
2632
  }
2632
- const settingsService = new chunk36Z3AKX3_cjs.SettingsService(db);
2633
+ const settingsService = new chunkC5LDQ3SH_cjs.SettingsService(db);
2633
2634
  const generalSettings = await settingsService.getGeneralSettings();
2634
2635
  const siteName = generalSettings.siteName;
2635
2636
  const canRequest = await otpService.checkRateLimit(normalizedEmail, settings);
@@ -2683,8 +2684,8 @@ function buildOtpApi() {
2683
2684
  loginUrl: settings.loginUrl || "",
2684
2685
  loginButtonText: settings.loginButtonText || ""
2685
2686
  });
2686
- if (chunkI767LVN7_cjs.hasEmailService()) {
2687
- const sent = await chunkI767LVN7_cjs.getEmailService().send({
2687
+ if (chunkS2QN4LFD_cjs.hasEmailService()) {
2688
+ const sent = await chunkS2QN4LFD_cjs.getEmailService().send({
2688
2689
  to: normalizedEmail,
2689
2690
  subject: `Your login code for ${siteName}`,
2690
2691
  flow: "otp",
@@ -2786,21 +2787,21 @@ function buildOtpApi() {
2786
2787
  error: "Account is deactivated"
2787
2788
  }, 403);
2788
2789
  }
2789
- const tokenTtl = await chunk37V3RET3_cjs.getJwtExpirySecondsFromDb(db, c.env);
2790
- const token = await chunk37V3RET3_cjs.AuthManager.generateToken(user.id, user.email, user.role, c.env.JWT_SECRET, tokenTtl);
2790
+ const tokenTtl = await chunkBRKXMRMB_cjs.getJwtExpirySecondsFromDb(db, c.env);
2791
+ const token = await chunkBRKXMRMB_cjs.AuthManager.generateToken(user.id, user.email, user.role, c.env.JWT_SECRET, tokenTtl);
2791
2792
  cookie.setCookie(c, "auth_token", token, {
2792
2793
  httpOnly: true,
2793
2794
  secure: true,
2794
2795
  sameSite: "Strict",
2795
2796
  maxAge: tokenTtl
2796
2797
  });
2797
- chunkI767LVN7_cjs.dispatchHookEvent(
2798
+ chunkS2QN4LFD_cjs.dispatchHookEvent(
2798
2799
  c,
2799
2800
  "auth:otp:verified",
2800
2801
  { user: { id: user.id, email: user.email, role: user.role } },
2801
2802
  "fire-and-forget"
2802
2803
  );
2803
- const customData = await chunkI767LVN7_cjs.getCustomData(db, user.id);
2804
+ const customData = await chunkS2QN4LFD_cjs.getCustomData(db, user.id);
2804
2805
  const { is_active: _isActive, ...publicUser } = user;
2805
2806
  return c.json({
2806
2807
  success: true,
@@ -2845,7 +2846,7 @@ function buildOtpApi() {
2845
2846
  });
2846
2847
  return otpAPI;
2847
2848
  }
2848
- var otpLoginPlugin = chunkBP52BFIV_cjs.definePlugin({
2849
+ var otpLoginPlugin = chunkKWQNB6UM_cjs.definePlugin({
2849
2850
  id: "otp-login",
2850
2851
  version: "1.0.0",
2851
2852
  name: "OTP Login",
@@ -3243,15 +3244,15 @@ function buildOauthApi() {
3243
3244
  if (!user || !user.is_active) {
3244
3245
  return c.redirect("/auth/login?error=Account is deactivated");
3245
3246
  }
3246
- const tokenTtl2 = await chunk37V3RET3_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3247
- const jwt2 = await chunk37V3RET3_cjs.AuthManager.generateToken(
3247
+ const tokenTtl2 = await chunkBRKXMRMB_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3248
+ const jwt2 = await chunkBRKXMRMB_cjs.AuthManager.generateToken(
3248
3249
  user.id,
3249
3250
  user.email,
3250
3251
  user.role,
3251
3252
  c.env.JWT_SECRET,
3252
3253
  tokenTtl2
3253
3254
  );
3254
- chunk37V3RET3_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax", maxAge: tokenTtl2 });
3255
+ chunkBRKXMRMB_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax", maxAge: tokenTtl2 });
3255
3256
  return c.redirect("/admin");
3256
3257
  }
3257
3258
  const existingUser = await oauthService.findUserByEmail(profile.email);
@@ -3268,15 +3269,15 @@ function buildOauthApi() {
3268
3269
  tokenExpiresAt: tokenExpiresAt ?? void 0,
3269
3270
  profileData: JSON.stringify(profile)
3270
3271
  });
3271
- const tokenTtl2 = await chunk37V3RET3_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3272
- const jwt2 = await chunk37V3RET3_cjs.AuthManager.generateToken(
3272
+ const tokenTtl2 = await chunkBRKXMRMB_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3273
+ const jwt2 = await chunkBRKXMRMB_cjs.AuthManager.generateToken(
3273
3274
  existingUser.id,
3274
3275
  existingUser.email,
3275
3276
  existingUser.role,
3276
3277
  c.env.JWT_SECRET,
3277
3278
  tokenTtl2
3278
3279
  );
3279
- chunk37V3RET3_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax", maxAge: tokenTtl2 });
3280
+ chunkBRKXMRMB_cjs.AuthManager.setAuthCookie(c, jwt2, { sameSite: "Lax", maxAge: tokenTtl2 });
3280
3281
  return c.redirect("/admin");
3281
3282
  }
3282
3283
  const newUserId = await oauthService.createUserFromOAuth(profile);
@@ -3289,15 +3290,15 @@ function buildOauthApi() {
3289
3290
  tokenExpiresAt: tokenExpiresAt ?? void 0,
3290
3291
  profileData: JSON.stringify(profile)
3291
3292
  });
3292
- const tokenTtl = await chunk37V3RET3_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3293
- const jwt = await chunk37V3RET3_cjs.AuthManager.generateToken(
3293
+ const tokenTtl = await chunkBRKXMRMB_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
3294
+ const jwt = await chunkBRKXMRMB_cjs.AuthManager.generateToken(
3294
3295
  newUserId,
3295
3296
  profile.email.toLowerCase(),
3296
3297
  "viewer",
3297
3298
  c.env.JWT_SECRET,
3298
3299
  tokenTtl
3299
3300
  );
3300
- chunk37V3RET3_cjs.AuthManager.setAuthCookie(c, jwt, { sameSite: "Lax", maxAge: tokenTtl });
3301
+ chunkBRKXMRMB_cjs.AuthManager.setAuthCookie(c, jwt, { sameSite: "Lax", maxAge: tokenTtl });
3301
3302
  return c.redirect("/admin");
3302
3303
  } catch (error) {
3303
3304
  console.error("OAuth callback error:", error);
@@ -3392,7 +3393,7 @@ function buildOauthApi() {
3392
3393
  });
3393
3394
  return oauthAPI;
3394
3395
  }
3395
- var oauthProvidersPlugin = chunkBP52BFIV_cjs.definePlugin({
3396
+ var oauthProvidersPlugin = chunkKWQNB6UM_cjs.definePlugin({
3396
3397
  id: "oauth-providers",
3397
3398
  version: "1.0.0",
3398
3399
  name: "OAuth Providers",
@@ -3976,7 +3977,7 @@ var AISearchService = class {
3976
3977
  */
3977
3978
  async detectNewCollections() {
3978
3979
  try {
3979
- const allCollections = chunkQCJHCSOK_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => ({
3980
+ const allCollections = chunk4DHPR7KR_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => ({
3980
3981
  id: r.id,
3981
3982
  name: r.name,
3982
3983
  display_name: r.displayName,
@@ -4028,7 +4029,7 @@ var AISearchService = class {
4028
4029
  */
4029
4030
  async getAllCollections() {
4030
4031
  try {
4031
- const allCollections = chunkQCJHCSOK_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).sort((a, b) => a.displayName.localeCompare(b.displayName)).map((r) => ({
4032
+ const allCollections = chunk4DHPR7KR_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).sort((a, b) => a.displayName.localeCompare(b.displayName)).map((r) => ({
4032
4033
  id: r.id,
4033
4034
  name: r.name,
4034
4035
  display_name: r.displayName,
@@ -4367,7 +4368,7 @@ var IndexManager = class {
4367
4368
  */
4368
4369
  async indexCollection(collectionId) {
4369
4370
  try {
4370
- const registry = chunkQCJHCSOK_cjs.getCollectionRegistry();
4371
+ const registry = chunk4DHPR7KR_cjs.getCollectionRegistry();
4371
4372
  const record = registry.getById(collectionId) ?? registry.getByName(collectionId);
4372
4373
  if (!record) {
4373
4374
  throw new Error(`Collection ${collectionId} not found`);
@@ -4983,7 +4984,7 @@ function renderSettingsPage(data) {
4983
4984
  }, 30000);
4984
4985
  </script>
4985
4986
  `;
4986
- return chunkE66UVONV_cjs.renderAdminLayout({
4987
+ return chunkOUBUS74I_cjs.renderAdminLayout({
4987
4988
  title: "AI Search Settings",
4988
4989
  pageTitle: "AI Search Settings",
4989
4990
  currentPath: "/admin/plugins/ai-search/settings",
@@ -4994,7 +4995,7 @@ function renderSettingsPage(data) {
4994
4995
 
4995
4996
  // src/plugins/core-plugins/ai-search-plugin/routes/admin.ts
4996
4997
  var adminRoutes2 = new hono.Hono();
4997
- adminRoutes2.use("*", chunk37V3RET3_cjs.requireAuth());
4998
+ adminRoutes2.use("*", chunkBRKXMRMB_cjs.requireAuth());
4998
4999
  adminRoutes2.get("/", async (c) => {
4999
5000
  try {
5000
5001
  const user = c.get("user");
@@ -5235,7 +5236,7 @@ var manifest_default = {
5235
5236
  author: "SonicJS"};
5236
5237
 
5237
5238
  // src/plugins/core-plugins/ai-search-plugin/index.ts
5238
- var aiSearchPlugin = chunkBP52BFIV_cjs.definePlugin({
5239
+ var aiSearchPlugin = chunkKWQNB6UM_cjs.definePlugin({
5239
5240
  id: manifest_default.id,
5240
5241
  version: manifest_default.version,
5241
5242
  name: manifest_default.name,
@@ -5288,7 +5289,7 @@ var SecurityAuditService = class {
5288
5289
  constructor(db, settings = DEFAULT_SETTINGS2) {
5289
5290
  this.db = db;
5290
5291
  this.settings = settings;
5291
- this.docsService = new chunkLTZ5WYOK_cjs.DocumentsService(db, {
5292
+ this.docsService = new chunkOLEOKHDX_cjs.DocumentsService(db, {
5292
5293
  queryableFields: QUERYABLE_FIELDS,
5293
5294
  maxVersionsPerRoot: 1,
5294
5295
  tenantId: TENANT
@@ -5536,7 +5537,7 @@ function rowToEvent(row) {
5536
5537
  }
5537
5538
 
5538
5539
  // src/plugins/core-plugins/security-audit-plugin/components/dashboard-page.ts
5539
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
5540
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
5540
5541
  function formatTimestamp(ts) {
5541
5542
  const date = new Date(ts);
5542
5543
  const now = Date.now();
@@ -5735,11 +5736,11 @@ function renderSecurityDashboard(data) {
5735
5736
  version,
5736
5737
  dynamicMenuItems
5737
5738
  };
5738
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
5739
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
5739
5740
  }
5740
5741
 
5741
5742
  // src/plugins/core-plugins/security-audit-plugin/components/event-log-page.ts
5742
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
5743
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
5743
5744
  function formatTimestamp2(ts) {
5744
5745
  const date = new Date(ts);
5745
5746
  return date.toLocaleDateString("en-US", {
@@ -5946,11 +5947,11 @@ function renderEventLogPage(data) {
5946
5947
  version,
5947
5948
  dynamicMenuItems
5948
5949
  };
5949
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
5950
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
5950
5951
  }
5951
5952
 
5952
5953
  // src/plugins/core-plugins/security-audit-plugin/components/settings-page.ts
5953
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
5954
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
5954
5955
  function renderSecuritySettingsPage(data) {
5955
5956
  const { settings, user, version, message, dynamicMenuItems } = data;
5956
5957
  const content2 = `
@@ -6103,12 +6104,12 @@ function renderSecuritySettingsPage(data) {
6103
6104
  version,
6104
6105
  dynamicMenuItems
6105
6106
  };
6106
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
6107
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
6107
6108
  }
6108
6109
 
6109
6110
  // src/plugins/core-plugins/security-audit-plugin/routes/admin.ts
6110
6111
  var adminRoutes3 = new hono.Hono();
6111
- adminRoutes3.use("*", chunk37V3RET3_cjs.requireAuth());
6112
+ adminRoutes3.use("*", chunkBRKXMRMB_cjs.requireAuth());
6112
6113
  adminRoutes3.use("*", async (c, next) => {
6113
6114
  const user = c.get("user");
6114
6115
  if (user?.role !== "admin") {
@@ -6118,7 +6119,7 @@ adminRoutes3.use("*", async (c, next) => {
6118
6119
  });
6119
6120
  async function getSettings(db) {
6120
6121
  try {
6121
- const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
6122
+ const pluginService = new chunk4DHPR7KR_cjs.PluginService(db);
6122
6123
  const plugin2 = await pluginService.getPlugin("security-audit");
6123
6124
  if (plugin2?.settings) {
6124
6125
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -6223,7 +6224,7 @@ adminRoutes3.post("/settings", async (c) => {
6223
6224
  autoPurge: body["retention.autoPurge"] === "true"
6224
6225
  }
6225
6226
  };
6226
- const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
6227
+ const pluginService = new chunk4DHPR7KR_cjs.PluginService(db);
6227
6228
  await pluginService.updatePluginSettings("security-audit", settings);
6228
6229
  if (c.req.header("HX-Request")) {
6229
6230
  return c.json({ success: true });
@@ -6385,7 +6386,7 @@ var BruteForceDetector = class {
6385
6386
 
6386
6387
  // src/plugins/core-plugins/security-audit-plugin/routes/api.ts
6387
6388
  var apiRoutes2 = new hono.Hono();
6388
- apiRoutes2.use("*", chunk37V3RET3_cjs.requireAuth());
6389
+ apiRoutes2.use("*", chunkBRKXMRMB_cjs.requireAuth());
6389
6390
  apiRoutes2.use("*", async (c, next) => {
6390
6391
  const user = c.get("user");
6391
6392
  if (user?.role !== "admin") {
@@ -6395,7 +6396,7 @@ apiRoutes2.use("*", async (c, next) => {
6395
6396
  });
6396
6397
  async function getSettings2(db) {
6397
6398
  try {
6398
- const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
6399
+ const pluginService = new chunk4DHPR7KR_cjs.PluginService(db);
6399
6400
  const plugin2 = await pluginService.getPlugin("security-audit");
6400
6401
  if (plugin2?.settings) {
6401
6402
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -6543,7 +6544,7 @@ function generateFingerprint(ip, userAgent) {
6543
6544
  }
6544
6545
  async function getPluginSettings(db) {
6545
6546
  try {
6546
- const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
6547
+ const pluginService = new chunk4DHPR7KR_cjs.PluginService(db);
6547
6548
  const plugin2 = await pluginService.getPlugin("security-audit");
6548
6549
  if (plugin2?.settings) {
6549
6550
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -6774,7 +6775,7 @@ async function logAuthEvent(c, db, settings, ip, userAgent, countryCode, fingerp
6774
6775
 
6775
6776
  // src/plugins/core-plugins/security-audit-plugin/index.ts
6776
6777
  var SECURITY_ICON = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"/></svg>`;
6777
- var securityAuditPlugin = chunkBP52BFIV_cjs.definePlugin({
6778
+ var securityAuditPlugin = chunkKWQNB6UM_cjs.definePlugin({
6778
6779
  id: "security-audit",
6779
6780
  version: "1.0.0",
6780
6781
  name: "Security Audit",
@@ -6824,7 +6825,7 @@ var ApiKeyService = class {
6824
6825
  db;
6825
6826
  tenantId;
6826
6827
  docService() {
6827
- return new chunkLTZ5WYOK_cjs.DocumentsService(this.db, {
6828
+ return new chunkOLEOKHDX_cjs.DocumentsService(this.db, {
6828
6829
  queryableFields: API_KEY_QUERYABLE,
6829
6830
  tenantId: this.tenantId,
6830
6831
  maxVersionsPerRoot: 1
@@ -6850,7 +6851,7 @@ var ApiKeyService = class {
6850
6851
  const prefix = secret.slice(0, DISPLAY_PREFIX_LEN);
6851
6852
  const expiresAt = input.expiresAt ?? null;
6852
6853
  const doc = await this.docService().create(
6853
- chunkI767LVN7_cjs.createDocumentSchema.parse({
6854
+ chunkS2QN4LFD_cjs.createDocumentSchema.parse({
6854
6855
  typeId: "api_key",
6855
6856
  tenantId: this.tenantId,
6856
6857
  title: name,
@@ -6943,7 +6944,7 @@ var ApiKeyService = class {
6943
6944
  };
6944
6945
 
6945
6946
  // src/plugins/core-plugins/api-keys-plugin/components/keys-page.ts
6946
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
6947
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
6947
6948
  function fmtDate(ms) {
6948
6949
  if (!ms) return "\u2014";
6949
6950
  try {
@@ -7144,7 +7145,7 @@ function renderApiKeysPage(data) {
7144
7145
  version,
7145
7146
  dynamicMenuItems
7146
7147
  };
7147
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
7148
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
7148
7149
  }
7149
7150
 
7150
7151
  // src/plugins/core-plugins/api-keys-plugin/types.ts
@@ -7163,7 +7164,7 @@ var createSchema = zod.z.object({
7163
7164
  });
7164
7165
  async function getSettings3(db) {
7165
7166
  try {
7166
- const plugin2 = await new chunkQCJHCSOK_cjs.PluginService(db).getPlugin("api-keys");
7167
+ const plugin2 = await new chunk4DHPR7KR_cjs.PluginService(db).getPlugin("api-keys");
7167
7168
  if (plugin2?.settings) {
7168
7169
  const s = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
7169
7170
  return { ...DEFAULT_SETTINGS3, ...s };
@@ -7172,7 +7173,7 @@ async function getSettings3(db) {
7172
7173
  }
7173
7174
  return DEFAULT_SETTINGS3;
7174
7175
  }
7175
- adminRoutes4.use("*", chunk37V3RET3_cjs.requireAuth());
7176
+ adminRoutes4.use("*", chunkBRKXMRMB_cjs.requireAuth());
7176
7177
  adminRoutes4.use("*", async (c, next) => {
7177
7178
  const user = c.get("user");
7178
7179
  if (user?.role !== "admin") {
@@ -7257,7 +7258,7 @@ function apiKeyAuthMiddleware() {
7257
7258
 
7258
7259
  // src/plugins/core-plugins/api-keys-plugin/index.ts
7259
7260
  var KEY_ICON = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"/></svg>`;
7260
- var apiKeysPlugin = chunkBP52BFIV_cjs.definePlugin({
7261
+ var apiKeysPlugin = chunkKWQNB6UM_cjs.definePlugin({
7261
7262
  id: "api-keys",
7262
7263
  version: "1.0.0-beta.1",
7263
7264
  name: "API Keys",
@@ -7643,7 +7644,7 @@ var StripeEventService = class {
7643
7644
  };
7644
7645
 
7645
7646
  // src/plugins/core-plugins/stripe-plugin/components/subscriptions-page.ts
7646
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
7647
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
7647
7648
 
7648
7649
  // src/plugins/core-plugins/stripe-plugin/components/tab-bar.ts
7649
7650
  var TABS = [
@@ -7776,7 +7777,7 @@ function renderSubscriptionsPage(data) {
7776
7777
  version,
7777
7778
  dynamicMenuItems
7778
7779
  };
7779
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
7780
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
7780
7781
  }
7781
7782
  function statsCard(label, value, colorClass) {
7782
7783
  return `
@@ -7856,7 +7857,7 @@ function renderPagination2(page, totalPages, status) {
7856
7857
  }
7857
7858
 
7858
7859
  // src/plugins/core-plugins/stripe-plugin/components/events-page.ts
7859
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
7860
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
7860
7861
  function renderEventsPage(data) {
7861
7862
  const { events, stats, types, filters, user, version, dynamicMenuItems } = data;
7862
7863
  const content2 = `
@@ -7929,7 +7930,7 @@ function renderEventsPage(data) {
7929
7930
  version,
7930
7931
  dynamicMenuItems
7931
7932
  };
7932
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
7933
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
7933
7934
  }
7934
7935
  function eventStatsCard(label, value, colorClass) {
7935
7936
  return `
@@ -8028,7 +8029,7 @@ var DEFAULT_SETTINGS4 = {
8028
8029
 
8029
8030
  // src/plugins/core-plugins/stripe-plugin/routes/admin.ts
8030
8031
  var adminRoutes5 = new hono.Hono();
8031
- adminRoutes5.use("*", chunk37V3RET3_cjs.requireAuth());
8032
+ adminRoutes5.use("*", chunkBRKXMRMB_cjs.requireAuth());
8032
8033
  adminRoutes5.use("*", async (c, next) => {
8033
8034
  const user = c.get("user");
8034
8035
  if (user?.role !== "admin") {
@@ -8038,7 +8039,7 @@ adminRoutes5.use("*", async (c, next) => {
8038
8039
  });
8039
8040
  async function getSettings4(db) {
8040
8041
  try {
8041
- const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
8042
+ const pluginService = new chunk4DHPR7KR_cjs.PluginService(db);
8042
8043
  const plugin2 = await pluginService.getPlugin("stripe");
8043
8044
  if (plugin2?.settings) {
8044
8045
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -8101,7 +8102,7 @@ adminRoutes5.get("/settings", async (c) => {
8101
8102
  const db = c.env.DB;
8102
8103
  const user = c.get("user");
8103
8104
  const settings = await getSettings4(db);
8104
- const { renderAdminLayoutCatalyst: renderAdminLayoutCatalyst2 } = await import('./admin-layout-catalyst.template-3XZXDGF7.cjs');
8105
+ const { renderAdminLayoutCatalyst: renderAdminLayoutCatalyst2 } = await import('./admin-layout-catalyst.template-MOQ3BBXA.cjs');
8105
8106
  const content2 = `
8106
8107
  <div>
8107
8108
  <div class="mb-6">
@@ -8361,7 +8362,7 @@ function timingSafeEqual(a, b) {
8361
8362
  var apiRoutes3 = new hono.Hono();
8362
8363
  async function getSettings5(db) {
8363
8364
  try {
8364
- const pluginService = new chunkQCJHCSOK_cjs.PluginService(db);
8365
+ const pluginService = new chunk4DHPR7KR_cjs.PluginService(db);
8365
8366
  const plugin2 = await pluginService.getPlugin("stripe");
8366
8367
  if (plugin2?.settings) {
8367
8368
  const settings = typeof plugin2.settings === "string" ? JSON.parse(plugin2.settings) : plugin2.settings;
@@ -8512,7 +8513,7 @@ apiRoutes3.post("/webhook", async (c) => {
8512
8513
  }
8513
8514
  return c.json({ received: true });
8514
8515
  });
8515
- apiRoutes3.post("/create-checkout-session", chunk37V3RET3_cjs.requireAuth(), async (c) => {
8516
+ apiRoutes3.post("/create-checkout-session", chunkBRKXMRMB_cjs.requireAuth(), async (c) => {
8516
8517
  const db = c.env.DB;
8517
8518
  const user = c.get("user");
8518
8519
  if (!user) return c.json({ error: "Unauthorized" }, 401);
@@ -8552,7 +8553,7 @@ apiRoutes3.post("/create-checkout-session", chunk37V3RET3_cjs.requireAuth(), asy
8552
8553
  });
8553
8554
  return c.json({ sessionId: session.id, url: session.url });
8554
8555
  });
8555
- apiRoutes3.get("/subscription", chunk37V3RET3_cjs.requireAuth(), async (c) => {
8556
+ apiRoutes3.get("/subscription", chunkBRKXMRMB_cjs.requireAuth(), async (c) => {
8556
8557
  const user = c.get("user");
8557
8558
  if (!user) return c.json({ error: "Unauthorized" }, 401);
8558
8559
  const db = c.env.DB;
@@ -8564,7 +8565,7 @@ apiRoutes3.get("/subscription", chunk37V3RET3_cjs.requireAuth(), async (c) => {
8564
8565
  }
8565
8566
  return c.json({ subscription });
8566
8567
  });
8567
- apiRoutes3.get("/subscriptions", chunk37V3RET3_cjs.requireAuth(), async (c) => {
8568
+ apiRoutes3.get("/subscriptions", chunkBRKXMRMB_cjs.requireAuth(), async (c) => {
8568
8569
  const user = c.get("user");
8569
8570
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
8570
8571
  const db = c.env.DB;
@@ -8580,7 +8581,7 @@ apiRoutes3.get("/subscriptions", chunk37V3RET3_cjs.requireAuth(), async (c) => {
8580
8581
  const result = await subscriptionService.list(filters);
8581
8582
  return c.json(result);
8582
8583
  });
8583
- apiRoutes3.get("/stats", chunk37V3RET3_cjs.requireAuth(), async (c) => {
8584
+ apiRoutes3.get("/stats", chunkBRKXMRMB_cjs.requireAuth(), async (c) => {
8584
8585
  const user = c.get("user");
8585
8586
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
8586
8587
  const db = c.env.DB;
@@ -8589,7 +8590,7 @@ apiRoutes3.get("/stats", chunk37V3RET3_cjs.requireAuth(), async (c) => {
8589
8590
  const stats = await subscriptionService.getStats();
8590
8591
  return c.json(stats);
8591
8592
  });
8592
- apiRoutes3.post("/sync-subscriptions", chunk37V3RET3_cjs.requireAuth(), async (c) => {
8593
+ apiRoutes3.post("/sync-subscriptions", chunkBRKXMRMB_cjs.requireAuth(), async (c) => {
8593
8594
  const user = c.get("user");
8594
8595
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
8595
8596
  const db = c.env.DB;
@@ -8637,7 +8638,7 @@ apiRoutes3.post("/sync-subscriptions", chunk37V3RET3_cjs.requireAuth(), async (c
8637
8638
  }, 500);
8638
8639
  }
8639
8640
  });
8640
- apiRoutes3.get("/events", chunk37V3RET3_cjs.requireAuth(), async (c) => {
8641
+ apiRoutes3.get("/events", chunkBRKXMRMB_cjs.requireAuth(), async (c) => {
8641
8642
  const user = c.get("user");
8642
8643
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
8643
8644
  const db = c.env.DB;
@@ -8660,7 +8661,7 @@ apiRoutes3.get("/events", chunk37V3RET3_cjs.requireAuth(), async (c) => {
8660
8661
 
8661
8662
  // src/plugins/core-plugins/stripe-plugin/index.ts
8662
8663
  var STRIPE_ICON = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M7 15h1m4 0h1m-7 4h12a3 3 0 003-3V8a3 3 0 00-3-3H6a3 3 0 00-3 3v8a3 3 0 003 3z"/></svg>`;
8663
- var stripePlugin = chunkBP52BFIV_cjs.definePlugin({
8664
+ var stripePlugin = chunkKWQNB6UM_cjs.definePlugin({
8664
8665
  id: "stripe",
8665
8666
  version: "1.0.0",
8666
8667
  name: "Stripe",
@@ -8681,7 +8682,7 @@ var stripePlugin = chunkBP52BFIV_cjs.definePlugin({
8681
8682
  });
8682
8683
 
8683
8684
  // src/templates/pages/admin-forms-list.template.ts
8684
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
8685
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
8685
8686
  function renderFormsListPage(data) {
8686
8687
  const tableData = {
8687
8688
  tableId: "forms-table",
@@ -8933,7 +8934,7 @@ function renderFormsListPage(data) {
8933
8934
 
8934
8935
  <!-- Forms Table -->
8935
8936
  <div class="bg-white dark:bg-zinc-900 rounded-lg border border-zinc-950/5 dark:border-white/10 overflow-hidden">
8936
- ${chunkI767LVN7_cjs.renderTable(tableData)}
8937
+ ${chunkS2QN4LFD_cjs.renderTable(tableData)}
8937
8938
  </div>
8938
8939
  </div>
8939
8940
  `;
@@ -8943,11 +8944,11 @@ function renderFormsListPage(data) {
8943
8944
  user: data.user,
8944
8945
  version: data.version
8945
8946
  };
8946
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
8947
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
8947
8948
  }
8948
8949
 
8949
8950
  // src/templates/pages/admin-forms-builder.template.ts
8950
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
8951
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
8951
8952
  function getTurnstileComponentScript() {
8952
8953
  return `
8953
8954
  (function() {
@@ -10160,11 +10161,11 @@ ${getTurnstileComponentScript()}
10160
10161
  user: data.user,
10161
10162
  version: data.version
10162
10163
  };
10163
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
10164
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
10164
10165
  }
10165
10166
 
10166
10167
  // src/templates/pages/admin-forms-create.template.ts
10167
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
10168
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
10168
10169
  function renderFormCreatePage(data) {
10169
10170
  const pageContent = `
10170
10171
  <div class="max-w-3xl mx-auto">
@@ -10357,13 +10358,13 @@ function renderFormCreatePage(data) {
10357
10358
  user: data.user,
10358
10359
  version: data.version
10359
10360
  };
10360
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
10361
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
10361
10362
  }
10362
10363
 
10363
10364
  // src/routes/admin-forms.ts
10364
10365
  var isTableMissing = (err) => String(err?.message ?? err?.cause?.message ?? "").includes("no such table: forms");
10365
10366
  var adminFormsRoutes = new hono.Hono();
10366
- adminFormsRoutes.use("*", chunk37V3RET3_cjs.requireAuth());
10367
+ adminFormsRoutes.use("*", chunkBRKXMRMB_cjs.requireAuth());
10367
10368
  adminFormsRoutes.get("/", async (c) => {
10368
10369
  try {
10369
10370
  const user = c.get("user");
@@ -10536,7 +10537,7 @@ adminFormsRoutes.get("/:id/builder", async (c) => {
10536
10537
  if (!form) {
10537
10538
  return c.html("<p>Form not found</p>", 404);
10538
10539
  }
10539
- const turnstileService = new chunkQJUJNTIU_cjs.TurnstileService(db);
10540
+ const turnstileService = new chunkA22RBHO7_cjs.TurnstileService(db);
10540
10541
  const turnstileSettings = await turnstileService.getSettings();
10541
10542
  const pageData = {
10542
10543
  id: form.id,
@@ -10705,7 +10706,7 @@ publicFormsRoutes.get("/:identifier/turnstile-config", async (c) => {
10705
10706
  if (!form) {
10706
10707
  return c.json({ error: "Form not found" }, 404);
10707
10708
  }
10708
- const turnstileService = new chunkQJUJNTIU_cjs.TurnstileService(db);
10709
+ const turnstileService = new chunkA22RBHO7_cjs.TurnstileService(db);
10709
10710
  const globalSettings = await turnstileService.getSettings();
10710
10711
  const formSettings = form.turnstile_settings ? JSON.parse(form.turnstile_settings) : { inherit: true };
10711
10712
  const enabled = form.turnstile_enabled === 1 || formSettings.inherit && globalSettings?.enabled;
@@ -11135,7 +11136,7 @@ publicFormsRoutes.post("/:identifier/submit", async (c) => {
11135
11136
  const turnstileEnabled = form.turnstile_enabled === 1;
11136
11137
  const turnstileSettings = form.turnstile_settings ? JSON.parse(form.turnstile_settings) : { inherit: true };
11137
11138
  if (turnstileEnabled || turnstileSettings.inherit) {
11138
- const turnstileService = new chunkQJUJNTIU_cjs.TurnstileService(db);
11139
+ const turnstileService = new chunkA22RBHO7_cjs.TurnstileService(db);
11139
11140
  const globalEnabled = await turnstileService.isEnabled();
11140
11141
  if (globalEnabled || turnstileEnabled) {
11141
11142
  const turnstileToken = body.data?.turnstile || body.turnstile;
@@ -11197,7 +11198,7 @@ publicFormsRoutes.post("/:identifier/submit", async (c) => {
11197
11198
  });
11198
11199
 
11199
11200
  // src/plugins/core-plugins/forms-plugin/index.ts
11200
- var formsPlugin = chunkBP52BFIV_cjs.definePlugin({
11201
+ var formsPlugin = chunkKWQNB6UM_cjs.definePlugin({
11201
11202
  id: "forms",
11202
11203
  version: "1.0.0",
11203
11204
  name: "Forms",
@@ -11215,9 +11216,9 @@ var formsPlugin = chunkBP52BFIV_cjs.definePlugin({
11215
11216
  activate: async () => console.info("\u2705 Forms plugin activated"),
11216
11217
  deactivate: async () => console.info("\u274C Forms plugin deactivated")
11217
11218
  });
11218
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
11219
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
11219
11220
  var adminRbacRoutes = new hono.Hono();
11220
- adminRbacRoutes.use("*", chunk37V3RET3_cjs.requireRbac("rbac", "manage"));
11221
+ adminRbacRoutes.use("*", chunkBRKXMRMB_cjs.requireRbac("rbac", "manage"));
11221
11222
  var esc = (s) => String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
11222
11223
  var TABS2 = `
11223
11224
  <div class="border-b border-zinc-950/10 dark:border-white/10 mb-6">
@@ -11227,7 +11228,7 @@ var TABS2 = `
11227
11228
  </nav>
11228
11229
  </div>`;
11229
11230
  adminRbacRoutes.get("/", async (c) => {
11230
- const rbac = new chunkLTZ5WYOK_cjs.RbacService(c.env.DB);
11231
+ const rbac = new chunkOLEOKHDX_cjs.RbacService(c.env.DB);
11231
11232
  const [roles, verbs, resources, grants] = await Promise.all([
11232
11233
  rbac.getRoles(),
11233
11234
  rbac.getVerbs(),
@@ -11521,11 +11522,11 @@ adminRbacRoutes.get("/", async (c) => {
11521
11522
  </script>`;
11522
11523
  const u = c.get("user");
11523
11524
  return c.html(
11524
- chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst({
11525
+ chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst({
11525
11526
  title: "Roles & Permissions",
11526
11527
  pageTitle: "Roles & Permissions",
11527
11528
  currentPath: "/admin/users",
11528
- version: chunkKKNEYIZJ_cjs.getCoreVersion(),
11529
+ version: chunkXZUEGFXE_cjs.getCoreVersion(),
11529
11530
  user: u ? { name: u.email || "Admin", email: u.email || "", role: u.role || "admin" } : void 0,
11530
11531
  content: content2
11531
11532
  })
@@ -11549,7 +11550,7 @@ adminRbacRoutes.post("/grants", async (c) => {
11549
11550
  pairsByRole.get(roleId).push({ resource, verb, scope });
11550
11551
  }
11551
11552
  }
11552
- const rbac = new chunkLTZ5WYOK_cjs.RbacService(c.env.DB);
11553
+ const rbac = new chunkOLEOKHDX_cjs.RbacService(c.env.DB);
11553
11554
  for (const id of saveRoleIds) {
11554
11555
  await rbac.setRoleGrants(id, pairsByRole.get(id) || []);
11555
11556
  }
@@ -11570,7 +11571,7 @@ adminRbacRoutes.post("/grants", async (c) => {
11570
11571
  adminRbacRoutes.post("/roles/bulk", async (c) => {
11571
11572
  const form = await c.req.formData();
11572
11573
  const roleIds = String(form.get("role_ids") || "").split(",").filter(Boolean);
11573
- const rbac = new chunkLTZ5WYOK_cjs.RbacService(c.env.DB);
11574
+ const rbac = new chunkOLEOKHDX_cjs.RbacService(c.env.DB);
11574
11575
  for (const roleId of roleIds) {
11575
11576
  const displayName = String(form.get(`display_name_${roleId}`) || "").trim();
11576
11577
  const nameVal = form.get(`name_${roleId}`) ? String(form.get(`name_${roleId}`)).trim() : void 0;
@@ -11595,7 +11596,7 @@ adminRbacRoutes.post("/roles", async (c) => {
11595
11596
  const displayName = String(form.get("display_name") || "").trim();
11596
11597
  if (name && displayName) {
11597
11598
  try {
11598
- await new chunkLTZ5WYOK_cjs.RbacService(c.env.DB).createRole(name, displayName);
11599
+ await new chunkOLEOKHDX_cjs.RbacService(c.env.DB).createRole(name, displayName);
11599
11600
  } catch {
11600
11601
  }
11601
11602
  }
@@ -11610,7 +11611,7 @@ adminRbacRoutes.post("/roles/:id", async (c) => {
11610
11611
  const portalAccess = form.get("portal_access") === "1";
11611
11612
  if (displayName) {
11612
11613
  try {
11613
- const rbac = new chunkLTZ5WYOK_cjs.RbacService(c.env.DB);
11614
+ const rbac = new chunkOLEOKHDX_cjs.RbacService(c.env.DB);
11614
11615
  if (roleId !== "role-admin") {
11615
11616
  await rbac.updateRoleAndPortalAccess(roleId, displayName, name, portalAccess, description);
11616
11617
  } else {
@@ -11622,7 +11623,7 @@ adminRbacRoutes.post("/roles/:id", async (c) => {
11622
11623
  return c.redirect(`/admin/rbac#roles-verbs`);
11623
11624
  });
11624
11625
  adminRbacRoutes.post("/roles/:id/delete", async (c) => {
11625
- await new chunkLTZ5WYOK_cjs.RbacService(c.env.DB).deleteRole(c.req.param("id"));
11626
+ await new chunkOLEOKHDX_cjs.RbacService(c.env.DB).deleteRole(c.req.param("id"));
11626
11627
  return c.redirect("/admin/rbac#roles-verbs");
11627
11628
  });
11628
11629
  adminRbacRoutes.post("/verbs", async (c) => {
@@ -11630,18 +11631,18 @@ adminRbacRoutes.post("/verbs", async (c) => {
11630
11631
  const name = String(form.get("name") || "").trim();
11631
11632
  if (name) {
11632
11633
  try {
11633
- await new chunkLTZ5WYOK_cjs.RbacService(c.env.DB).createVerb(name);
11634
+ await new chunkOLEOKHDX_cjs.RbacService(c.env.DB).createVerb(name);
11634
11635
  } catch {
11635
11636
  }
11636
11637
  }
11637
11638
  return c.redirect("/admin/rbac#roles-verbs");
11638
11639
  });
11639
11640
  adminRbacRoutes.post("/verbs/:id/delete", async (c) => {
11640
- await new chunkLTZ5WYOK_cjs.RbacService(c.env.DB).deleteVerb(c.req.param("id"));
11641
+ await new chunkOLEOKHDX_cjs.RbacService(c.env.DB).deleteVerb(c.req.param("id"));
11641
11642
  return c.redirect("/admin/rbac#roles-verbs");
11642
11643
  });
11643
11644
  adminRbacRoutes.get("/check", async (c) => {
11644
- const rbac = new chunkLTZ5WYOK_cjs.RbacService(c.env.DB);
11645
+ const rbac = new chunkOLEOKHDX_cjs.RbacService(c.env.DB);
11645
11646
  const resource = c.req.query("resource") || "";
11646
11647
  const verb = c.req.query("verb") || "";
11647
11648
  const roleId = c.req.query("role");
@@ -11662,7 +11663,7 @@ adminRbacRoutes.get("/check", async (c) => {
11662
11663
  });
11663
11664
 
11664
11665
  // src/middleware/plugin-menu.ts
11665
- var REGISTRY_MENU_PLUGINS = Object.values(chunkQCJHCSOK_cjs.PLUGIN_REGISTRY).filter((p) => p.adminMenu !== null).map((p) => ({
11666
+ var REGISTRY_MENU_PLUGINS = Object.values(chunk4DHPR7KR_cjs.PLUGIN_REGISTRY).filter((p) => p.adminMenu !== null).map((p) => ({
11666
11667
  id: p.id,
11667
11668
  label: p.adminMenu.label,
11668
11669
  path: p.adminMenu.path,
@@ -11716,9 +11717,9 @@ function pluginMenuMiddleware() {
11716
11717
  if (!path.startsWith("/admin")) {
11717
11718
  return next();
11718
11719
  }
11720
+ const db = c.env.DB;
11719
11721
  let activeMenuItems = [];
11720
11722
  try {
11721
- const db = c.env.DB;
11722
11723
  const pluginIds = REGISTRY_MENU_PLUGINS.map((p) => p.id);
11723
11724
  if (pluginIds.length > 0) {
11724
11725
  const placeholders = pluginIds.map(() => "?").join(",");
@@ -11741,10 +11742,25 @@ function pluginMenuMiddleware() {
11741
11742
  } catch {
11742
11743
  }
11743
11744
  const user = c.get("user");
11744
- const singletonItems = chunkBP52BFIV_cjs.resolvePluginMenuItems(user ? { role: user.role } : void 0);
11745
+ const singletonItems = chunkKWQNB6UM_cjs.resolvePluginMenuItems(user ? { role: user.role } : void 0);
11746
+ const singletonPluginIds = [...new Set(
11747
+ singletonItems.map((i) => i.pluginId).filter((id) => !!id)
11748
+ )];
11749
+ let activeSingletonIds = /* @__PURE__ */ new Set();
11750
+ try {
11751
+ if (singletonPluginIds.length > 0) {
11752
+ const ph = singletonPluginIds.map(() => "?").join(",");
11753
+ const result = await db.prepare(
11754
+ `SELECT slug FROM documents WHERE type_id = 'plugin' AND tenant_id = 'default' AND slug IN (${ph}) AND q_plugin_status = 'active' AND is_current_draft = 1 AND deleted_at IS NULL`
11755
+ ).bind(...singletonPluginIds).all();
11756
+ activeSingletonIds = new Set((result.results || []).map((r) => r.slug));
11757
+ }
11758
+ } catch {
11759
+ }
11745
11760
  const existingPaths = new Set(activeMenuItems.map((i) => i.path));
11746
11761
  for (const item of singletonItems) {
11747
- if (!existingPaths.has(item.path)) {
11762
+ const isActive = !item.pluginId || activeSingletonIds.has(item.pluginId);
11763
+ if (isActive && !existingPaths.has(item.path)) {
11748
11764
  activeMenuItems.push({ label: item.label, path: item.path, icon: item.icon, order: item.order });
11749
11765
  }
11750
11766
  }
@@ -12310,7 +12326,7 @@ var SYSTEM_MENU_ITEMS = [
12310
12326
  ];
12311
12327
 
12312
12328
  // src/plugins/core-plugins/menu-plugin/templates/admin-menu-list.template.ts
12313
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
12329
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
12314
12330
  function pluginStatusBadge(status) {
12315
12331
  if (status === "inactive") {
12316
12332
  return `<span class="inline-flex items-center rounded-md px-2 py-0.5 text-xs font-medium bg-red-50 dark:bg-red-500/10 text-red-700 dark:text-red-400 ring-1 ring-inset ring-red-600/20 dark:ring-red-500/20 ml-1">disabled</span>`;
@@ -12462,7 +12478,7 @@ function renderMenuListPage(data) {
12462
12478
  dynamicMenuItems: data.dynamicMenuItems,
12463
12479
  content: pageContent
12464
12480
  };
12465
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
12481
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
12466
12482
  }
12467
12483
  function renderMenuSettingsContent(items, pluginStatuses = {}, message) {
12468
12484
  const messageBanner = "";
@@ -12567,7 +12583,7 @@ function renderMenuSettingsContent(items, pluginStatuses = {}, message) {
12567
12583
  }
12568
12584
 
12569
12585
  // src/plugins/core-plugins/menu-plugin/templates/admin-menu-form.template.ts
12570
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
12586
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
12571
12587
 
12572
12588
  // src/plugins/core-plugins/menu-plugin/templates/icon-picker.template.ts
12573
12589
  var ICONS = [
@@ -12903,7 +12919,7 @@ function renderMenuFormPage(data) {
12903
12919
  dynamicMenuItems: data.dynamicMenuItems,
12904
12920
  content: pageContent
12905
12921
  };
12906
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
12922
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
12907
12923
  }
12908
12924
 
12909
12925
  // src/plugins/core-plugins/menu-plugin/routes/admin-menu.ts
@@ -12913,8 +12929,8 @@ function sanitizeUrl(url) {
12913
12929
  return trimmed;
12914
12930
  }
12915
12931
  var adminMenuRoutes = new hono.Hono();
12916
- adminMenuRoutes.use("*", chunk37V3RET3_cjs.requireAuth());
12917
- adminMenuRoutes.use("*", chunk37V3RET3_cjs.requireRole(["admin"]));
12932
+ adminMenuRoutes.use("*", chunkBRKXMRMB_cjs.requireAuth());
12933
+ adminMenuRoutes.use("*", chunkBRKXMRMB_cjs.requireRole(["admin"]));
12918
12934
  adminMenuRoutes.get("/", async (c) => {
12919
12935
  const db = c.env.DB;
12920
12936
  const user = c.get("user");
@@ -13128,7 +13144,7 @@ adminMenuRoutes.post("/:id/move-down", async (c) => {
13128
13144
  }
13129
13145
  return c.redirect("/admin/menu");
13130
13146
  });
13131
- var menuPlugin = chunkBP52BFIV_cjs.definePlugin({
13147
+ var menuPlugin = chunkKWQNB6UM_cjs.definePlugin({
13132
13148
  id: "menu",
13133
13149
  version: "1.0.0",
13134
13150
  name: "Menu Manager",
@@ -13143,7 +13159,7 @@ var menuPlugin = chunkBP52BFIV_cjs.definePlugin({
13143
13159
  const db = env.DB;
13144
13160
  if (!db) return;
13145
13161
  try {
13146
- const typeRegistry = new chunk37V3RET3_cjs.DocumentTypeRegistry(db);
13162
+ const typeRegistry = new chunkBRKXMRMB_cjs.DocumentTypeRegistry(db);
13147
13163
  await typeRegistry.register({
13148
13164
  id: "menu_item",
13149
13165
  name: "menu_item",
@@ -13178,7 +13194,7 @@ var menuPlugin = chunkBP52BFIV_cjs.definePlugin({
13178
13194
  lockedFields: [...item.lockedFields]
13179
13195
  }, item.sortOrder);
13180
13196
  }
13181
- await chunkI767LVN7_cjs.reconcileMenuFromPlugins(db);
13197
+ await chunkS2QN4LFD_cjs.reconcileMenuFromPlugins(db);
13182
13198
  } catch {
13183
13199
  }
13184
13200
  },
@@ -13196,9 +13212,9 @@ var menuPlugin = chunkBP52BFIV_cjs.definePlugin({
13196
13212
  }
13197
13213
  }
13198
13214
  });
13199
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
13215
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
13200
13216
  var adminRoutes6 = new hono.Hono();
13201
- adminRoutes6.use("*", chunk37V3RET3_cjs.requireAuth());
13217
+ adminRoutes6.use("*", chunkBRKXMRMB_cjs.requireAuth());
13202
13218
  adminRoutes6.use("*", async (c, next) => {
13203
13219
  const user = c.get("user");
13204
13220
  if (user?.role !== "admin") {
@@ -13314,7 +13330,7 @@ adminRoutes6.get("/", async (c) => {
13314
13330
  </div>
13315
13331
  </div>
13316
13332
  `;
13317
- return c.html(chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst({
13333
+ return c.html(chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst({
13318
13334
  title: "Analytics",
13319
13335
  pageTitle: "Analytics Dashboard",
13320
13336
  currentPath: "/admin/analytics",
@@ -13345,7 +13361,7 @@ var QUERYABLE_FIELDS2 = [
13345
13361
  var EventTrackingService = class {
13346
13362
  constructor(db) {
13347
13363
  this.db = db;
13348
- this.docsService = new chunkLTZ5WYOK_cjs.DocumentsService(db, {
13364
+ this.docsService = new chunkOLEOKHDX_cjs.DocumentsService(db, {
13349
13365
  queryableFields: QUERYABLE_FIELDS2,
13350
13366
  maxVersionsPerRoot: 1,
13351
13367
  tenantId: TENANT2
@@ -13554,7 +13570,7 @@ apiRoutes4.get("/stats", async (c) => {
13554
13570
  });
13555
13571
 
13556
13572
  // src/plugins/core-plugins/analytics/index.ts
13557
- var analyticsPlugin = chunkBP52BFIV_cjs.definePlugin({
13573
+ var analyticsPlugin = chunkKWQNB6UM_cjs.definePlugin({
13558
13574
  id: "core-analytics",
13559
13575
  version: "1.0.0",
13560
13576
  name: "Analytics",
@@ -13701,7 +13717,7 @@ function esc2(s) {
13701
13717
  return (s || "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
13702
13718
  }
13703
13719
  async function getVariablesMap(db) {
13704
- let variables = chunkI767LVN7_cjs.getVariablesCached();
13720
+ let variables = chunkS2QN4LFD_cjs.getVariablesCached();
13705
13721
  if (variables) return variables;
13706
13722
  try {
13707
13723
  const { results } = await db.prepare(
@@ -13711,7 +13727,7 @@ async function getVariablesMap(db) {
13711
13727
  for (const row of results || []) {
13712
13728
  variables.set(row.key, row.value);
13713
13729
  }
13714
- chunkI767LVN7_cjs.setVariablesCache(variables);
13730
+ chunkS2QN4LFD_cjs.setVariablesCache(variables);
13715
13731
  return variables;
13716
13732
  } catch {
13717
13733
  return /* @__PURE__ */ new Map();
@@ -13780,7 +13796,7 @@ apiRoutes5.post("/", async (c) => {
13780
13796
  await db.prepare(
13781
13797
  "INSERT INTO global_variables (key, value, description, category, is_active) VALUES (?, ?, ?, ?, ?)"
13782
13798
  ).bind(key, value || "", description || "", category || "general", isActive !== false ? 1 : 0).run();
13783
- chunkI767LVN7_cjs.invalidateVariablesCache();
13799
+ chunkS2QN4LFD_cjs.invalidateVariablesCache();
13784
13800
  const created = await db.prepare("SELECT * FROM global_variables WHERE key = ?").bind(key).first();
13785
13801
  return c.json({ success: true, data: formatVariable(created) }, 201);
13786
13802
  } catch {
@@ -13825,7 +13841,7 @@ apiRoutes5.put("/:id", async (c) => {
13825
13841
  updates.push("updated_at = strftime('%s', 'now')");
13826
13842
  params.push(id);
13827
13843
  await db.prepare(`UPDATE global_variables SET ${updates.join(", ")} WHERE id = ?`).bind(...params).run();
13828
- chunkI767LVN7_cjs.invalidateVariablesCache();
13844
+ chunkS2QN4LFD_cjs.invalidateVariablesCache();
13829
13845
  const updated = await db.prepare("SELECT * FROM global_variables WHERE id = ?").bind(id).first();
13830
13846
  return c.json({ success: true, data: formatVariable(updated) });
13831
13847
  } catch {
@@ -13839,7 +13855,7 @@ apiRoutes5.delete("/:id", async (c) => {
13839
13855
  const existing = await db.prepare("SELECT id FROM global_variables WHERE id = ?").bind(id).first();
13840
13856
  if (!existing) return c.json({ error: "Variable not found" }, 404);
13841
13857
  await db.prepare("DELETE FROM global_variables WHERE id = ?").bind(id).run();
13842
- chunkI767LVN7_cjs.invalidateVariablesCache();
13858
+ chunkS2QN4LFD_cjs.invalidateVariablesCache();
13843
13859
  return c.json({ success: true });
13844
13860
  } catch {
13845
13861
  return c.json({ success: false, error: "Failed to delete variable" }, 500);
@@ -13899,7 +13915,7 @@ adminRoutes7.put("/:id", async (c) => {
13899
13915
  const value = body.value;
13900
13916
  if (value !== void 0) {
13901
13917
  await db.prepare("UPDATE global_variables SET value = ?, updated_at = strftime('%s', 'now') WHERE id = ?").bind(value, id).run();
13902
- chunkI767LVN7_cjs.invalidateVariablesCache();
13918
+ chunkS2QN4LFD_cjs.invalidateVariablesCache();
13903
13919
  }
13904
13920
  return c.html('<span class="text-green-400 text-xs">Saved</span>');
13905
13921
  });
@@ -13907,7 +13923,7 @@ adminRoutes7.post("/:id/toggle", async (c) => {
13907
13923
  const db = c.env.DB;
13908
13924
  const id = c.req.param("id");
13909
13925
  await db.prepare("UPDATE global_variables SET is_active = CASE WHEN is_active = 1 THEN 0 ELSE 1 END, updated_at = strftime('%s', 'now') WHERE id = ?").bind(id).run();
13910
- chunkI767LVN7_cjs.invalidateVariablesCache();
13926
+ chunkS2QN4LFD_cjs.invalidateVariablesCache();
13911
13927
  c.header("HX-Redirect", "/admin/global-variables");
13912
13928
  return c.body(null, 204);
13913
13929
  });
@@ -13928,7 +13944,7 @@ adminRoutes7.post("/", async (c) => {
13928
13944
  await db.prepare(
13929
13945
  "INSERT INTO global_variables (key, value, description, category) VALUES (?, ?, ?, ?)"
13930
13946
  ).bind(key, value, description, category).run();
13931
- chunkI767LVN7_cjs.invalidateVariablesCache();
13947
+ chunkS2QN4LFD_cjs.invalidateVariablesCache();
13932
13948
  c.header("HX-Redirect", "/admin/global-variables");
13933
13949
  return c.body(null, 204);
13934
13950
  });
@@ -13947,7 +13963,7 @@ adminRoutes7.post("/settings/editor-integration", async (c) => {
13947
13963
  adminRoutes7.delete("/:id", async (c) => {
13948
13964
  const db = c.env.DB;
13949
13965
  await db.prepare("DELETE FROM global_variables WHERE id = ?").bind(c.req.param("id")).run();
13950
- chunkI767LVN7_cjs.invalidateVariablesCache();
13966
+ chunkS2QN4LFD_cjs.invalidateVariablesCache();
13951
13967
  return c.html("");
13952
13968
  });
13953
13969
  function renderAdminPage(variables, editorStatus = { editorActive: false, activeEditorName: "", enableEditorIntegration: true }) {
@@ -14265,7 +14281,7 @@ function renderAdminPage(variables, editorStatus = { editorActive: false, active
14265
14281
  </div>
14266
14282
  ` });
14267
14283
  }
14268
- var globalVariablesPlugin = chunkBP52BFIV_cjs.definePlugin({
14284
+ var globalVariablesPlugin = chunkKWQNB6UM_cjs.definePlugin({
14269
14285
  id: "global-variables",
14270
14286
  version: "1.1.0",
14271
14287
  name: "Global Variables",
@@ -14288,7 +14304,7 @@ var globalVariablesPlugin = chunkBP52BFIV_cjs.definePlugin({
14288
14304
  if (!db || !data) return data;
14289
14305
  const variables = await getVariablesMap(db);
14290
14306
  if (variables.size === 0) return data;
14291
- return chunkI767LVN7_cjs.resolveVariablesInObject(data, variables);
14307
+ return chunkS2QN4LFD_cjs.resolveVariablesInObject(data, variables);
14292
14308
  } catch {
14293
14309
  return data;
14294
14310
  }
@@ -14306,7 +14322,7 @@ var globalVariablesPlugin = chunkBP52BFIV_cjs.definePlugin({
14306
14322
  },
14307
14323
  activate: async () => console.info("[GlobalVariables] Plugin activated"),
14308
14324
  deactivate: async () => {
14309
- chunkI767LVN7_cjs.invalidateVariablesCache();
14325
+ chunkS2QN4LFD_cjs.invalidateVariablesCache();
14310
14326
  console.info("[GlobalVariables] Plugin deactivated, cache cleared");
14311
14327
  },
14312
14328
  uninstall: async (ctx) => {
@@ -14872,7 +14888,7 @@ function renderAdminPage2(shortcodes, editorStatus = { editorActive: false, acti
14872
14888
  </div>
14873
14889
  ` });
14874
14890
  }
14875
- var shortcodesPlugin = chunkBP52BFIV_cjs.definePlugin({
14891
+ var shortcodesPlugin = chunkKWQNB6UM_cjs.definePlugin({
14876
14892
  id: "shortcodes",
14877
14893
  version: "1.0.0",
14878
14894
  name: "Shortcodes",
@@ -14956,7 +14972,7 @@ helloWorldRoutes.get("/", async (c) => {
14956
14972
  </html>
14957
14973
  `);
14958
14974
  });
14959
- var helloWorldPlugin = chunkBP52BFIV_cjs.definePlugin({
14975
+ var helloWorldPlugin = chunkKWQNB6UM_cjs.definePlugin({
14960
14976
  id: "hello-world",
14961
14977
  version: "1.0.0",
14962
14978
  name: "Hello World",
@@ -15003,7 +15019,7 @@ var manifest_default2 = {
15003
15019
  author: "SonicJS Team"};
15004
15020
 
15005
15021
  // src/plugins/core-plugins/multi-tenant-plugin/templates/tenants-list.template.ts
15006
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
15022
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
15007
15023
  function statusBadge2(status) {
15008
15024
  return status === "active" ? '<span class="inline-flex items-center rounded-md bg-emerald-500/10 px-2 py-1 text-xs font-medium text-emerald-600 dark:text-emerald-400">Active</span>' : '<span class="inline-flex items-center rounded-md bg-zinc-500/10 px-2 py-1 text-xs font-medium text-zinc-600 dark:text-zinc-400">Inactive</span>';
15009
15025
  }
@@ -15076,7 +15092,7 @@ function renderTenantsList(data) {
15076
15092
  </table>
15077
15093
  </div>
15078
15094
  </div>`;
15079
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst({
15095
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst({
15080
15096
  title: "Tenants - SonicJS",
15081
15097
  pageTitle: "Tenants",
15082
15098
  currentPath: "/admin/tenants",
@@ -15095,7 +15111,7 @@ function renderTenantsInactive(data) {
15095
15111
  <a href="/admin/plugins" class="mt-6 inline-flex items-center rounded-lg bg-zinc-950 px-3.5 py-2 text-sm font-semibold text-white hover:bg-zinc-800 dark:bg-white dark:text-zinc-950 dark:hover:bg-zinc-200">Go to Plugins</a>
15096
15112
  </div>
15097
15113
  </div>`;
15098
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst({
15114
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst({
15099
15115
  title: "Tenants - SonicJS",
15100
15116
  pageTitle: "Tenants",
15101
15117
  currentPath: "/admin/tenants",
@@ -15106,7 +15122,7 @@ function renderTenantsInactive(data) {
15106
15122
  }
15107
15123
 
15108
15124
  // src/plugins/core-plugins/multi-tenant-plugin/templates/tenant-form.template.ts
15109
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
15125
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
15110
15126
  function fieldErrors(errors, field) {
15111
15127
  const list = errors?.[field];
15112
15128
  if (!list || list.length === 0) return "";
@@ -15174,7 +15190,7 @@ function renderTenantForm(data) {
15174
15190
  </form>
15175
15191
  </div>
15176
15192
  </div>`;
15177
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst({
15193
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst({
15178
15194
  title: `${data.isEdit ? "Edit Tenant" : "New Tenant"} - SonicJS`,
15179
15195
  pageTitle: data.isEdit ? "Edit Tenant" : "New Tenant",
15180
15196
  currentPath: "/admin/tenants",
@@ -15185,9 +15201,9 @@ function renderTenantForm(data) {
15185
15201
  }
15186
15202
 
15187
15203
  // src/plugins/core-plugins/multi-tenant-plugin/templates/tenant-members.template.ts
15188
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
15204
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
15189
15205
  function roleOptions(selected) {
15190
- return chunkI767LVN7_cjs.VALID_MEMBER_ROLES.map(
15206
+ return chunkS2QN4LFD_cjs.VALID_MEMBER_ROLES.map(
15191
15207
  (r) => `<option value="${r}" ${r === selected ? "selected" : ""}>${r}</option>`
15192
15208
  ).join("");
15193
15209
  }
@@ -15249,7 +15265,7 @@ function renderInvitations(slug, invitations) {
15249
15265
  <div>
15250
15266
  <label for="invite-role" class="mb-1 block text-xs font-medium text-zinc-500 dark:text-zinc-400">Role</label>
15251
15267
  <select id="invite-role" name="role" class="rounded-lg border border-zinc-950/10 bg-white px-2 py-2 text-sm text-zinc-950 dark:border-white/10 dark:bg-zinc-800 dark:text-white">
15252
- ${chunkI767LVN7_cjs.VALID_MEMBER_ROLES.map((r) => `<option value="${r}" ${r === "viewer" ? "selected" : ""}>${r}</option>`).join("")}
15268
+ ${chunkS2QN4LFD_cjs.VALID_MEMBER_ROLES.map((r) => `<option value="${r}" ${r === "viewer" ? "selected" : ""}>${r}</option>`).join("")}
15253
15269
  </select>
15254
15270
  </div>
15255
15271
  <button type="submit" data-send-invite class="rounded-lg bg-zinc-950 px-3.5 py-2 text-sm font-semibold text-white hover:bg-zinc-800 dark:bg-white dark:text-zinc-950 dark:hover:bg-zinc-200">Invite</button>
@@ -15332,7 +15348,7 @@ function renderTenantMembers(data) {
15332
15348
 
15333
15349
  ${renderInvitations(data.slug, data.invitations)}
15334
15350
  </div>`;
15335
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst({
15351
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst({
15336
15352
  title: `Members - ${data.tenantName} - SonicJS`,
15337
15353
  pageTitle: "Tenant Members",
15338
15354
  currentPath: "/admin/tenants",
@@ -15343,9 +15359,9 @@ function renderTenantMembers(data) {
15343
15359
  }
15344
15360
 
15345
15361
  // src/plugins/core-plugins/multi-tenant-plugin/templates/user-memberships.template.ts
15346
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
15362
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
15347
15363
  function roleOptions2(selected) {
15348
- return chunkI767LVN7_cjs.VALID_MEMBER_ROLES.map(
15364
+ return chunkS2QN4LFD_cjs.VALID_MEMBER_ROLES.map(
15349
15365
  (r) => `<option value="${r}" ${r === selected ? "selected" : ""}>${r}</option>`
15350
15366
  ).join("");
15351
15367
  }
@@ -15418,7 +15434,7 @@ function renderUserMemberships(data) {
15418
15434
  </table>
15419
15435
  </div>
15420
15436
  </div>`;
15421
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst({
15437
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst({
15422
15438
  title: `Tenant memberships - ${data.userEmail} - SonicJS`,
15423
15439
  pageTitle: "Tenant memberships",
15424
15440
  currentPath: "/admin/users",
@@ -15429,7 +15445,7 @@ function renderUserMemberships(data) {
15429
15445
  }
15430
15446
 
15431
15447
  // src/plugins/core-plugins/multi-tenant-plugin/templates/role-usage.template.ts
15432
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
15448
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
15433
15449
  function renderRoleUsage(data) {
15434
15450
  const role = chunkMNWKYY5E_cjs.escapeHtml(data.roleName);
15435
15451
  const rows = data.assignments.length ? data.assignments.map((a) => `
@@ -15464,7 +15480,7 @@ function renderRoleUsage(data) {
15464
15480
  </table>
15465
15481
  </div>
15466
15482
  </div>`;
15467
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst({
15483
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst({
15468
15484
  title: `Role usage - ${data.roleName} - SonicJS`,
15469
15485
  pageTitle: "Role usage",
15470
15486
  currentPath: "/admin/tenants",
@@ -15507,7 +15523,7 @@ function zodToFieldErrors(error) {
15507
15523
  }
15508
15524
  async function isMultiTenantActive(db) {
15509
15525
  try {
15510
- const plugin2 = await new chunkQCJHCSOK_cjs.PluginService(db).getPlugin(chunkQCJHCSOK_cjs.MULTI_TENANT_PLUGIN_ID);
15526
+ const plugin2 = await new chunk4DHPR7KR_cjs.PluginService(db).getPlugin(chunk4DHPR7KR_cjs.MULTI_TENANT_PLUGIN_ID);
15511
15527
  return plugin2?.status === "active";
15512
15528
  } catch {
15513
15529
  return false;
@@ -15515,7 +15531,7 @@ async function isMultiTenantActive(db) {
15515
15531
  }
15516
15532
  function createTenantAdminRoutes() {
15517
15533
  const routes2 = new hono.Hono();
15518
- routes2.use("*", chunk37V3RET3_cjs.requireAuth());
15534
+ routes2.use("*", chunkBRKXMRMB_cjs.requireAuth());
15519
15535
  routes2.use("*", async (c, next) => {
15520
15536
  const user = c.get("user");
15521
15537
  if (user?.role !== "admin") {
@@ -15529,7 +15545,7 @@ function createTenantAdminRoutes() {
15529
15545
  const form = await c.req.formData();
15530
15546
  const slug = String(form.get("tenant") ?? "").trim().toLowerCase();
15531
15547
  const redirect = String(form.get("redirect") ?? "");
15532
- const svc = new chunkI767LVN7_cjs.TenantService(db);
15548
+ const svc = new chunkS2QN4LFD_cjs.TenantService(db);
15533
15549
  const tenant = await svc.getTenantBySlug(slug);
15534
15550
  if (!tenant || tenant.status !== "active") {
15535
15551
  return c.json({ error: "Unknown or inactive tenant" }, 400);
@@ -15539,7 +15555,7 @@ function createTenantAdminRoutes() {
15539
15555
  if (!user.isSuperAdmin && !await svc.isMember(user.userId, slug)) {
15540
15556
  return c.json({ error: "You are not a member of this tenant" }, 403);
15541
15557
  }
15542
- cookie.setCookie(c, chunkQCJHCSOK_cjs.TENANT_COOKIE, slug, {
15558
+ cookie.setCookie(c, chunk4DHPR7KR_cjs.TENANT_COOKIE, slug, {
15543
15559
  path: "/",
15544
15560
  httpOnly: true,
15545
15561
  sameSite: "Lax",
@@ -15556,7 +15572,7 @@ function createTenantAdminRoutes() {
15556
15572
  if (!user) return c.redirect("/auth/login");
15557
15573
  const token = c.req.query("token") ?? "";
15558
15574
  try {
15559
- const { slug } = await new chunkI767LVN7_cjs.TenantService(db).acceptInvitation(token, user.userId, user.email);
15575
+ const { slug } = await new chunkS2QN4LFD_cjs.TenantService(db).acceptInvitation(token, user.userId, user.email);
15560
15576
  return c.redirect(`/admin/tenants/${slug}/members?message=Invitation accepted`);
15561
15577
  } catch (error) {
15562
15578
  const message = error instanceof Error ? error.message : "Failed to accept invitation";
@@ -15584,7 +15600,7 @@ function createTenantAdminRoutes() {
15584
15600
  const userId = c.req.param("userId");
15585
15601
  const target = await db.prepare("SELECT id, email FROM auth_user WHERE id = ?").bind(userId).first();
15586
15602
  if (!target?.id) return c.redirect("/admin/users?message=User not found&type=error");
15587
- const svc = new chunkI767LVN7_cjs.TenantService(db);
15603
+ const svc = new chunkS2QN4LFD_cjs.TenantService(db);
15588
15604
  const [memberships, allTenants] = await Promise.all([svc.listUserMemberships(userId), svc.listTenants()]);
15589
15605
  const memberSlugs = new Set(memberships.map((m) => m.slug));
15590
15606
  const availableTenants = allTenants.filter((t) => t.status === "active" && !memberSlugs.has(t.slug)).map((t) => ({ slug: t.slug, name: t.name }));
@@ -15609,10 +15625,10 @@ function createTenantAdminRoutes() {
15609
15625
  const slug = String(form.get("slug") ?? "").trim().toLowerCase();
15610
15626
  const role = String(form.get("role") ?? "viewer");
15611
15627
  const redirectTo = String(form.get("_redirect") ?? "") || `/admin/tenants/users/${userId}`;
15612
- if (!chunkI767LVN7_cjs.isValidMemberRole(role)) throw new Error(`Invalid role '${role}'`);
15628
+ if (!chunkS2QN4LFD_cjs.isValidMemberRole(role)) throw new Error(`Invalid role '${role}'`);
15613
15629
  const target = await db.prepare("SELECT email FROM auth_user WHERE id = ?").bind(userId).first();
15614
15630
  if (!target) throw new Error("User not found");
15615
- const svc = new chunkI767LVN7_cjs.TenantService(db);
15631
+ const svc = new chunkS2QN4LFD_cjs.TenantService(db);
15616
15632
  if (!await svc.getTenantBySlug(slug)) throw new Error("Tenant not found");
15617
15633
  if (await svc.isMember(userId, slug)) throw new Error(`Already a member of '${slug}'`);
15618
15634
  await svc.addMember(slug, userId, role, target.email ?? null);
@@ -15631,7 +15647,7 @@ function createTenantAdminRoutes() {
15631
15647
  const form = await c.req.formData();
15632
15648
  const role = String(form.get("role") ?? "");
15633
15649
  const redirectTo = String(form.get("_redirect") ?? "") || `/admin/tenants/users/${userId}`;
15634
- await new chunkI767LVN7_cjs.TenantService(db).setMemberRole(slug, userId, role);
15650
+ await new chunkS2QN4LFD_cjs.TenantService(db).setMemberRole(slug, userId, role);
15635
15651
  return c.redirect(`${redirectTo}?message=Role updated`);
15636
15652
  } catch (error) {
15637
15653
  const message = error instanceof Error ? error.message : "Failed to update role";
@@ -15646,7 +15662,7 @@ function createTenantAdminRoutes() {
15646
15662
  try {
15647
15663
  const form = await c.req.formData();
15648
15664
  const redirectTo = String(form.get("_redirect") ?? "") || `/admin/tenants/users/${userId}`;
15649
- await new chunkI767LVN7_cjs.TenantService(db).removeMember(slug, userId);
15665
+ await new chunkS2QN4LFD_cjs.TenantService(db).removeMember(slug, userId);
15650
15666
  return c.redirect(`${redirectTo}?message=Removed from ${encodeURIComponent(slug)}`);
15651
15667
  } catch (error) {
15652
15668
  const message = error instanceof Error ? error.message : "Failed to remove membership";
@@ -15661,7 +15677,7 @@ function createTenantAdminRoutes() {
15661
15677
  return c.html(renderTenantsInactive({ user: userShape(cur), version }));
15662
15678
  }
15663
15679
  const roleName = c.req.param("roleName");
15664
- const assignments = await new chunkI767LVN7_cjs.TenantService(db).listAssignmentsByRole(roleName);
15680
+ const assignments = await new chunkS2QN4LFD_cjs.TenantService(db).listAssignmentsByRole(roleName);
15665
15681
  return c.html(renderRoleUsage({ roleName, assignments, user: userShape(cur), version }));
15666
15682
  });
15667
15683
  routes2.get("/", async (c) => {
@@ -15671,7 +15687,7 @@ function createTenantAdminRoutes() {
15671
15687
  if (!await isMultiTenantActive(db)) {
15672
15688
  return c.html(renderTenantsInactive({ user: userShape(user), version }));
15673
15689
  }
15674
- const svc = new chunkI767LVN7_cjs.TenantService(db);
15690
+ const svc = new chunkS2QN4LFD_cjs.TenantService(db);
15675
15691
  await svc.ensureDefaultTenant();
15676
15692
  const tenants = await svc.listTenants();
15677
15693
  const [docRes, memberRes] = await db.batch([
@@ -15710,7 +15726,7 @@ function createTenantAdminRoutes() {
15710
15726
  formEntries = Object.fromEntries(form.entries());
15711
15727
  const validated = tenantFormSchema.parse(formEntries);
15712
15728
  if (!validated.slug) throw new zod.z.ZodError([{ code: "custom", message: "Slug is required", path: ["slug"] }]);
15713
- const svc = new chunkI767LVN7_cjs.TenantService(db);
15729
+ const svc = new chunkS2QN4LFD_cjs.TenantService(db);
15714
15730
  await svc.createTenant({
15715
15731
  name: validated.name,
15716
15732
  slug: validated.slug,
@@ -15735,7 +15751,7 @@ function createTenantAdminRoutes() {
15735
15751
  if (!await isMultiTenantActive(db)) {
15736
15752
  return c.html(renderTenantsInactive({ user: userShape(user), version }));
15737
15753
  }
15738
- const tenant = await new chunkI767LVN7_cjs.TenantService(db).getTenantBySlug(c.req.param("slug"));
15754
+ const tenant = await new chunkS2QN4LFD_cjs.TenantService(db).getTenantBySlug(c.req.param("slug"));
15739
15755
  if (!tenant) return c.redirect("/admin/tenants?message=Tenant not found&type=error");
15740
15756
  return c.html(renderTenantForm({ tenant, isEdit: true, user: userShape(user), version }));
15741
15757
  });
@@ -15745,7 +15761,7 @@ function createTenantAdminRoutes() {
15745
15761
  const version = c.get("appVersion");
15746
15762
  const slug = c.req.param("slug");
15747
15763
  if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
15748
- const svc = new chunkI767LVN7_cjs.TenantService(db);
15764
+ const svc = new chunkS2QN4LFD_cjs.TenantService(db);
15749
15765
  try {
15750
15766
  const form = await c.req.formData();
15751
15767
  const validated = tenantFormSchema.parse(Object.fromEntries(form.entries()));
@@ -15770,7 +15786,7 @@ function createTenantAdminRoutes() {
15770
15786
  const slug = c.req.param("slug");
15771
15787
  if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
15772
15788
  try {
15773
- await new chunkI767LVN7_cjs.TenantService(db).deleteTenant(slug);
15789
+ await new chunkS2QN4LFD_cjs.TenantService(db).deleteTenant(slug);
15774
15790
  return c.redirect("/admin/tenants?message=Tenant deleted successfully");
15775
15791
  } catch (error) {
15776
15792
  const message = error instanceof Error ? error.message : "Failed to delete tenant";
@@ -15785,7 +15801,7 @@ function createTenantAdminRoutes() {
15785
15801
  return c.html(renderTenantsInactive({ user: userShape(user), version }));
15786
15802
  }
15787
15803
  const slug = c.req.param("slug");
15788
- const svc = new chunkI767LVN7_cjs.TenantService(db);
15804
+ const svc = new chunkS2QN4LFD_cjs.TenantService(db);
15789
15805
  const tenant = await svc.getTenantBySlug(slug);
15790
15806
  if (!tenant) return c.redirect("/admin/tenants?message=Tenant not found&type=error");
15791
15807
  const [members, invitations] = await Promise.all([svc.listMembers(slug), svc.listInvitations(slug)]);
@@ -15811,7 +15827,7 @@ function createTenantAdminRoutes() {
15811
15827
  const form = await c.req.formData();
15812
15828
  const email = String(form.get("email") ?? "");
15813
15829
  const role = String(form.get("role") ?? "viewer");
15814
- await new chunkI767LVN7_cjs.TenantService(db).addMemberByEmail(slug, email, role);
15830
+ await new chunkS2QN4LFD_cjs.TenantService(db).addMemberByEmail(slug, email, role);
15815
15831
  return c.redirect(`/admin/tenants/${slug}/members?message=Member added`);
15816
15832
  } catch (error) {
15817
15833
  const message = error instanceof Error ? error.message : "Failed to add member";
@@ -15826,7 +15842,7 @@ function createTenantAdminRoutes() {
15826
15842
  try {
15827
15843
  const form = await c.req.formData();
15828
15844
  const role = String(form.get("role") ?? "");
15829
- await new chunkI767LVN7_cjs.TenantService(db).setMemberRole(slug, userId, role);
15845
+ await new chunkS2QN4LFD_cjs.TenantService(db).setMemberRole(slug, userId, role);
15830
15846
  return c.redirect(`/admin/tenants/${slug}/members?message=Role updated`);
15831
15847
  } catch (error) {
15832
15848
  const message = error instanceof Error ? error.message : "Failed to update role";
@@ -15839,7 +15855,7 @@ function createTenantAdminRoutes() {
15839
15855
  const userId = c.req.param("userId");
15840
15856
  if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
15841
15857
  try {
15842
- await new chunkI767LVN7_cjs.TenantService(db).removeMember(slug, userId);
15858
+ await new chunkS2QN4LFD_cjs.TenantService(db).removeMember(slug, userId);
15843
15859
  return c.redirect(`/admin/tenants/${slug}/members?message=Member removed`);
15844
15860
  } catch (error) {
15845
15861
  const message = error instanceof Error ? error.message : "Failed to remove member";
@@ -15855,12 +15871,12 @@ function createTenantAdminRoutes() {
15855
15871
  const form = await c.req.formData();
15856
15872
  const email = String(form.get("email") ?? "");
15857
15873
  const role = String(form.get("role") ?? "viewer");
15858
- const token = await new chunkI767LVN7_cjs.TenantService(db).createInvitation(slug, email, role, user?.userId ?? null);
15874
+ const token = await new chunkS2QN4LFD_cjs.TenantService(db).createInvitation(slug, email, role, user?.userId ?? null);
15859
15875
  const origin = c.req.header("origin") || new URL(c.req.url).origin;
15860
15876
  const acceptUrl = `${origin}/join/invite?token=${encodeURIComponent(token)}`;
15861
15877
  let note;
15862
15878
  let noteType = "";
15863
- const svc2 = chunkI767LVN7_cjs.hasEmailService() ? chunkI767LVN7_cjs.getEmailService() : null;
15879
+ const svc2 = chunkS2QN4LFD_cjs.hasEmailService() ? chunkS2QN4LFD_cjs.getEmailService() : null;
15864
15880
  const hasRealProvider = !!svc2 && svc2.getProviderName() !== "console";
15865
15881
  if (hasRealProvider) {
15866
15882
  const result = await svc2.send({
@@ -15901,7 +15917,7 @@ function createTenantAdminRoutes() {
15901
15917
  WHERE i.id = ? AND t.slug = ? AND i.status = 'pending'`
15902
15918
  ).bind(id, slug).first();
15903
15919
  if (!inv) throw new Error("Invitation not found or already used");
15904
- const svc2 = chunkI767LVN7_cjs.hasEmailService() ? chunkI767LVN7_cjs.getEmailService() : null;
15920
+ const svc2 = chunkS2QN4LFD_cjs.hasEmailService() ? chunkS2QN4LFD_cjs.getEmailService() : null;
15905
15921
  const hasRealProvider = !!svc2 && svc2.getProviderName() !== "console";
15906
15922
  if (!hasRealProvider) throw new Error("No email plugin active");
15907
15923
  const origin = c.req.header("origin") || new URL(c.req.url).origin;
@@ -15926,7 +15942,7 @@ function createTenantAdminRoutes() {
15926
15942
  const id = c.req.param("id");
15927
15943
  if (!await isMultiTenantActive(db)) return c.json({ error: "Multi-tenant plugin is not active" }, 403);
15928
15944
  try {
15929
- await new chunkI767LVN7_cjs.TenantService(db).revokeInvitation(slug, id);
15945
+ await new chunkS2QN4LFD_cjs.TenantService(db).revokeInvitation(slug, id);
15930
15946
  return c.redirect(`/admin/tenants/${slug}/members?message=Invitation revoked`);
15931
15947
  } catch (error) {
15932
15948
  const message = error instanceof Error ? error.message : "Failed to revoke invitation";
@@ -16156,7 +16172,7 @@ function createJoinRoutes() {
16156
16172
  if (existing) return rerender("An account with this email already exists. Please sign in instead.");
16157
16173
  try {
16158
16174
  const userId = crypto.randomUUID();
16159
- const passwordHash = await chunk37V3RET3_cjs.AuthManager.hashPassword(password);
16175
+ const passwordHash = await chunkBRKXMRMB_cjs.AuthManager.hashPassword(password);
16160
16176
  const now = Date.now();
16161
16177
  const nowSec = Math.floor(now / 1e3);
16162
16178
  await db.batch([
@@ -16169,8 +16185,8 @@ function createJoinRoutes() {
16169
16185
  VALUES (?, ?, ?, 'credential', ?, ?, ?)`
16170
16186
  ).bind(`cred-${userId}`, userId, userId, passwordHash, nowSec, nowSec)
16171
16187
  ]);
16172
- await new chunkI767LVN7_cjs.TenantService(db).acceptInvitation(token, userId, inv.email);
16173
- const auth = chunkGMMCCIQO_cjs.createAuth(c.env);
16188
+ await new chunkS2QN4LFD_cjs.TenantService(db).acceptInvitation(token, userId, inv.email);
16189
+ const auth = chunk6UAI4SGN_cjs.createAuth(c.env);
16174
16190
  const origin = new URL(c.req.url).origin;
16175
16191
  const baReq = new Request(`${origin}/auth/sign-in/email`, {
16176
16192
  method: "POST",
@@ -16225,7 +16241,7 @@ function createJoinRoutes() {
16225
16241
  version
16226
16242
  }), 400);
16227
16243
  try {
16228
- const auth = chunkGMMCCIQO_cjs.createAuth(c.env);
16244
+ const auth = chunk6UAI4SGN_cjs.createAuth(c.env);
16229
16245
  const origin = new URL(c.req.url).origin;
16230
16246
  const baReq = new Request(`${origin}/auth/sign-in/email`, {
16231
16247
  method: "POST",
@@ -16237,7 +16253,7 @@ function createJoinRoutes() {
16237
16253
  const baBody = await baRes.json();
16238
16254
  const userId = baBody?.user?.id;
16239
16255
  if (!userId) return rerender("Sign-in succeeded but could not read user ID.");
16240
- await new chunkI767LVN7_cjs.TenantService(db).acceptInvitation(token, userId, inv.email);
16256
+ await new chunkS2QN4LFD_cjs.TenantService(db).acceptInvitation(token, userId, inv.email);
16241
16257
  const headers = new Headers({ Location: "/admin?message=Welcome! You have joined " + encodeURIComponent(inv.tenantName) });
16242
16258
  copyBaCookies(baRes, headers);
16243
16259
  return new Response(null, { status: 302, headers });
@@ -16251,7 +16267,7 @@ function createJoinRoutes() {
16251
16267
 
16252
16268
  // src/plugins/core-plugins/multi-tenant-plugin/index.ts
16253
16269
  var TENANT_ICON = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3.75 21h16.5M4.5 3h15M5.25 3v18m13.5-18v18M9 6.75h1.5m-1.5 3h1.5m-1.5 3h1.5m3-6H15m-1.5 3H15m-1.5 3H15M9 21v-3.375c0-.621.504-1.125 1.125-1.125h3.75c.621 0 1.125.504 1.125 1.125V21"/></svg>`;
16254
- var multiTenantPlugin = chunkBP52BFIV_cjs.definePlugin({
16270
+ var multiTenantPlugin = chunkKWQNB6UM_cjs.definePlugin({
16255
16271
  id: manifest_default2.id,
16256
16272
  version: "1.0.0",
16257
16273
  name: manifest_default2.name,
@@ -16266,30 +16282,30 @@ var multiTenantPlugin = chunkBP52BFIV_cjs.definePlugin({
16266
16282
  { label: "Tenants", path: "/admin/tenants", icon: TENANT_ICON, order: 80 }
16267
16283
  ],
16268
16284
  activate: async () => {
16269
- chunkQCJHCSOK_cjs.invalidateTenantCache();
16285
+ chunk4DHPR7KR_cjs.invalidateTenantCache();
16270
16286
  console.info("\u2705 Multi-Tenant plugin activated");
16271
16287
  },
16272
16288
  deactivate: async () => {
16273
- chunkQCJHCSOK_cjs.invalidateTenantCache();
16289
+ chunk4DHPR7KR_cjs.invalidateTenantCache();
16274
16290
  console.info("\u274C Multi-Tenant plugin deactivated");
16275
16291
  }
16276
16292
  });
16277
16293
  var routes = new hono.Hono();
16278
- routes.use("*", chunk37V3RET3_cjs.requireAuth());
16279
- routes.use("*", chunk37V3RET3_cjs.requireRole(["admin", "editor"]));
16294
+ routes.use("*", chunkBRKXMRMB_cjs.requireAuth());
16295
+ routes.use("*", chunkBRKXMRMB_cjs.requireRole(["admin", "editor"]));
16280
16296
  routes.get("/:rootId", async (c) => {
16281
16297
  const { rootId } = c.req.param();
16282
16298
  const db = c.env.DB;
16283
- const scope = await chunkI767LVN7_cjs.resolveDocScope(c, db, { rootId });
16299
+ const scope = await chunkS2QN4LFD_cjs.resolveDocScope(c, db, { rootId });
16284
16300
  if (!scope) {
16285
16301
  return c.html('<p class="text-zinc-500 dark:text-zinc-400 p-4">Document not found.</p>', 404);
16286
16302
  }
16287
16303
  if (!scope.docType?.settings?.versioning) {
16288
16304
  return c.html('<p class="text-zinc-500 dark:text-zinc-400 p-4">Versioning not enabled for this type.</p>', 404);
16289
16305
  }
16290
- const denied = await chunkI767LVN7_cjs.denyIfNotAllowed(c, db, rootId, "read", scope.docType?.settings, scope.tenantId);
16306
+ const denied = await chunkS2QN4LFD_cjs.denyIfNotAllowed(c, db, rootId, "read", scope.docType?.settings, scope.tenantId);
16291
16307
  if (denied) return denied;
16292
- const repo = new chunkI767LVN7_cjs.DocumentRepository(db, scope.tenantId);
16308
+ const repo = new chunkS2QN4LFD_cjs.DocumentRepository(db, scope.tenantId);
16293
16309
  const versions = await repo.getVersionHistory(rootId);
16294
16310
  const safeRootIdAttr = chunkMNWKYY5E_cjs.escapeHtml(rootId);
16295
16311
  const rows = versions.map((v) => {
@@ -16382,14 +16398,14 @@ routes.post("/:rootId/restore/:versionNumber", async (c) => {
16382
16398
  const { rootId, versionNumber } = c.req.param();
16383
16399
  const db = c.env.DB;
16384
16400
  const user = c.get("user");
16385
- const scope = await chunkI767LVN7_cjs.resolveDocScope(c, db, { rootId });
16401
+ const scope = await chunkS2QN4LFD_cjs.resolveDocScope(c, db, { rootId });
16386
16402
  if (!scope) {
16387
16403
  return c.json({ error: "Document not found" }, 404);
16388
16404
  }
16389
16405
  if (!scope.docType?.settings?.versioning) {
16390
16406
  return c.json({ error: "Versioning not enabled for this type" }, 404);
16391
16407
  }
16392
- const denied = await chunkI767LVN7_cjs.denyIfNotAllowed(c, db, rootId, "update", scope.docType?.settings, scope.tenantId);
16408
+ const denied = await chunkS2QN4LFD_cjs.denyIfNotAllowed(c, db, rootId, "update", scope.docType?.settings, scope.tenantId);
16393
16409
  if (denied) return denied;
16394
16410
  const row = await db.prepare("SELECT * FROM documents WHERE root_id = ? AND tenant_id = ? AND version_number = ? LIMIT 1").bind(rootId, scope.tenantId, Number(versionNumber)).first();
16395
16411
  if (!row) {
@@ -16399,7 +16415,7 @@ routes.post("/:rootId/restore/:versionNumber", async (c) => {
16399
16415
  const title = row.title ?? null;
16400
16416
  const slug = row.slug ?? null;
16401
16417
  const docType = scope.docType;
16402
- const svc = new chunkLTZ5WYOK_cjs.DocumentsService(db, {
16418
+ const svc = new chunkOLEOKHDX_cjs.DocumentsService(db, {
16403
16419
  queryableFields: docType?.queryableFields ?? [],
16404
16420
  typeSchemaVersion: docType?.schemaVersion ?? 1,
16405
16421
  maxVersionsPerRoot: docType?.settings?.maxVersionsPerRoot ?? 50,
@@ -16412,7 +16428,7 @@ routes.post("/:rootId/restore/:versionNumber", async (c) => {
16412
16428
  var routes_default = routes;
16413
16429
 
16414
16430
  // src/plugins/core-plugins/versioning-plugin/index.ts
16415
- var versioningPlugin = chunkBP52BFIV_cjs.definePlugin({
16431
+ var versioningPlugin = chunkKWQNB6UM_cjs.definePlugin({
16416
16432
  id: "versioning",
16417
16433
  version: "1.0.0",
16418
16434
  name: "Versioning",
@@ -16489,8 +16505,8 @@ function createMagicLinkAuthPlugin() {
16489
16505
  const baseUrl = new URL(c.req.url).origin;
16490
16506
  const magicLink = `${baseUrl}/auth/magic-link/verify?token=${token}`;
16491
16507
  try {
16492
- if (chunkI767LVN7_cjs.hasEmailService()) {
16493
- await chunkI767LVN7_cjs.getEmailService().send({
16508
+ if (chunkS2QN4LFD_cjs.hasEmailService()) {
16509
+ await chunkS2QN4LFD_cjs.getEmailService().send({
16494
16510
  to: normalizedEmail,
16495
16511
  subject: "Your Magic Link to Sign In",
16496
16512
  flow: "magic-link",
@@ -16567,19 +16583,19 @@ function createMagicLinkAuthPlugin() {
16567
16583
  SET used = 1, used_at = ?
16568
16584
  WHERE id = ?
16569
16585
  `).bind(Date.now(), magicLink.id).run();
16570
- const tokenTtl = await chunk37V3RET3_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
16571
- const jwtToken = await chunk37V3RET3_cjs.AuthManager.generateToken(
16586
+ const tokenTtl = await chunkBRKXMRMB_cjs.getJwtExpirySecondsFromDb(c.env.DB, c.env);
16587
+ const jwtToken = await chunkBRKXMRMB_cjs.AuthManager.generateToken(
16572
16588
  user.id,
16573
16589
  user.email,
16574
16590
  user.role,
16575
16591
  c.env.JWT_SECRET,
16576
16592
  tokenTtl
16577
16593
  );
16578
- chunk37V3RET3_cjs.AuthManager.setAuthCookie(c, jwtToken, { maxAge: tokenTtl });
16594
+ chunkBRKXMRMB_cjs.AuthManager.setAuthCookie(c, jwtToken, { maxAge: tokenTtl });
16579
16595
  await db.prepare(`
16580
16596
  UPDATE auth_user SET last_login_at = ? WHERE id = ?
16581
16597
  `).bind(Date.now(), user.id).run();
16582
- chunkI767LVN7_cjs.dispatchHookEvent(
16598
+ chunkS2QN4LFD_cjs.dispatchHookEvent(
16583
16599
  c,
16584
16600
  "auth:magic-link:consumed",
16585
16601
  { user: { id: user.id, email: user.email, role: user.role } },
@@ -17064,7 +17080,7 @@ async function warmCollections(db) {
17064
17080
  const collectionCache = chunkYA3TJ65D_cjs.getCacheService(config);
17065
17081
  let count = 0;
17066
17082
  try {
17067
- const results = chunkQCJHCSOK_cjs.getCollectionRegistry().listActive().map(chunkQCJHCSOK_cjs.collectionRecordToRow);
17083
+ const results = chunk4DHPR7KR_cjs.getCollectionRegistry().listActive().map(chunk4DHPR7KR_cjs.collectionRecordToRow);
17068
17084
  for (const collection of results) {
17069
17085
  const key = collectionCache.generateKey("item", collection.id);
17070
17086
  await collectionCache.set(key, collection);
@@ -17131,7 +17147,7 @@ async function warmNamespace(namespace, entries) {
17131
17147
  }
17132
17148
 
17133
17149
  // src/templates/pages/admin-cache.template.ts
17134
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
17150
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
17135
17151
  function renderCacheDashboard(data) {
17136
17152
  const pageContent = `
17137
17153
  <div class="space-y-6">
@@ -17182,6 +17198,14 @@ function renderCacheDashboard(data) {
17182
17198
  >
17183
17199
  Collection Settings
17184
17200
  </button>
17201
+ <button
17202
+ onclick="switchTab('url-catalog')"
17203
+ id="tab-url-catalog"
17204
+ class="cache-tab border-b-2 border-transparent py-3 px-1 text-sm font-medium text-zinc-500 dark:text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-300 hover:border-zinc-300 dark:hover:border-zinc-600 whitespace-nowrap"
17205
+ >
17206
+ URL Catalog
17207
+ ${data.catalog.stats.totalEntries > 0 ? `<span class="ml-1.5 inline-flex items-center rounded-full px-1.5 py-0.5 text-xs font-medium bg-sky-100 dark:bg-sky-500/20 text-sky-700 dark:text-sky-300">${data.catalog.stats.totalEntries}</span>` : ""}
17208
+ </button>
17185
17209
  </nav>
17186
17210
  </div>
17187
17211
 
@@ -17262,10 +17286,18 @@ function renderCacheDashboard(data) {
17262
17286
  <div id="tab-panel-collection-settings" class="hidden space-y-6">
17263
17287
  ${renderCollectionSettingsTab(data.collections)}
17264
17288
  </div>
17289
+
17290
+ <!-- Tab: URL Catalog -->
17291
+ <div id="tab-panel-url-catalog" class="hidden space-y-6">
17292
+ ${renderUrlCatalogTab(data.catalog)}
17293
+ </div>
17265
17294
  </div>
17266
17295
 
17267
17296
  <script>
17268
- function switchTab(tab) {
17297
+ const VALID_TABS = ['overview', 'collection-settings', 'url-catalog']
17298
+
17299
+ function switchTab(tab, pushHash) {
17300
+ if (!VALID_TABS.includes(tab)) tab = 'overview'
17269
17301
  // Update tab button styles
17270
17302
  document.querySelectorAll('.cache-tab').forEach(btn => {
17271
17303
  btn.classList.remove('border-zinc-950', 'dark:border-white', 'text-zinc-950', 'dark:text-white')
@@ -17283,8 +17315,21 @@ function renderCacheDashboard(data) {
17283
17315
  })
17284
17316
  const activePanel = document.getElementById('tab-panel-' + tab)
17285
17317
  if (activePanel) activePanel.classList.remove('hidden')
17318
+
17319
+ // Sync URL hash (pushHash=false when called from hashchange to avoid loop)
17320
+ if (pushHash !== false) location.hash = tab
17286
17321
  }
17287
17322
 
17323
+ document.addEventListener('DOMContentLoaded', function () {
17324
+ const hash = location.hash.slice(1)
17325
+ switchTab(VALID_TABS.includes(hash) ? hash : 'overview', false)
17326
+ })
17327
+
17328
+ window.addEventListener('hashchange', function () {
17329
+ const hash = location.hash.slice(1)
17330
+ switchTab(VALID_TABS.includes(hash) ? hash : 'overview', false)
17331
+ })
17332
+
17288
17333
  async function refreshStats() {
17289
17334
  window.location.reload()
17290
17335
  }
@@ -17308,6 +17353,21 @@ function renderCacheDashboard(data) {
17308
17353
  }
17309
17354
  }
17310
17355
 
17356
+ async function clearUrlCatalog() {
17357
+ try {
17358
+ const response = await fetch('/admin/cache/catalog/clear', { method: 'POST' })
17359
+ const result = await response.json()
17360
+ if (result.success) {
17361
+ alert('URL catalog cleared')
17362
+ window.location.reload()
17363
+ } else {
17364
+ alert('Error: ' + result.error)
17365
+ }
17366
+ } catch (error) {
17367
+ alert('Error: ' + error.message)
17368
+ }
17369
+ }
17370
+
17311
17371
  let namespaceToDelete = null
17312
17372
 
17313
17373
  async function clearNamespaceCache(namespace) {
@@ -17335,7 +17395,7 @@ function renderCacheDashboard(data) {
17335
17395
  </script>
17336
17396
 
17337
17397
  <!-- Confirmation Dialogs -->
17338
- ${chunkI767LVN7_cjs.renderConfirmationDialog({
17398
+ ${chunkS2QN4LFD_cjs.renderConfirmationDialog({
17339
17399
  id: "clear-all-cache-confirm",
17340
17400
  title: "Clear All Cache",
17341
17401
  message: "Are you sure you want to clear all cache entries? This cannot be undone.",
@@ -17346,7 +17406,7 @@ function renderCacheDashboard(data) {
17346
17406
  onConfirm: "performClearAllCaches()"
17347
17407
  })}
17348
17408
 
17349
- ${chunkI767LVN7_cjs.renderConfirmationDialog({
17409
+ ${chunkS2QN4LFD_cjs.renderConfirmationDialog({
17350
17410
  id: "clear-namespace-cache-confirm",
17351
17411
  title: "Clear Namespace Cache",
17352
17412
  message: "Clear cache for this namespace?",
@@ -17357,7 +17417,7 @@ function renderCacheDashboard(data) {
17357
17417
  onConfirm: "performClearNamespaceCache()"
17358
17418
  })}
17359
17419
 
17360
- ${chunkI767LVN7_cjs.getConfirmationDialogScript()}
17420
+ ${chunkS2QN4LFD_cjs.getConfirmationDialogScript()}
17361
17421
  `;
17362
17422
  const layoutData = {
17363
17423
  title: "Cache System",
@@ -17367,7 +17427,131 @@ function renderCacheDashboard(data) {
17367
17427
  version: data.version,
17368
17428
  content: pageContent
17369
17429
  };
17370
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
17430
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
17431
+ }
17432
+ function renderUrlCatalogTab(catalog) {
17433
+ const { entries, stats, swrPending } = catalog;
17434
+ const statCards = `
17435
+ <div class="grid grid-cols-2 gap-4 sm:grid-cols-4">
17436
+ ${renderMiniStatCard("Tracked URLs", stats.totalEntries.toLocaleString(), "sky")}
17437
+ ${renderMiniStatCard("Cache Hits", stats.totalHits.toLocaleString(), "lime")}
17438
+ ${renderMiniStatCard("Cache Misses", stats.totalMisses.toLocaleString(), "amber")}
17439
+ ${renderMiniStatCard("Stale Serves", stats.totalStale.toLocaleString(), "purple")}
17440
+ </div>
17441
+ `;
17442
+ const swrBadge = swrPending > 0 ? `<span class="ml-2 inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-amber-100 dark:bg-amber-500/20 text-amber-700 dark:text-amber-300">${swrPending} stale pending</span>` : "";
17443
+ if (entries.length === 0) {
17444
+ return `
17445
+ ${statCards}
17446
+ <div class="overflow-hidden rounded-xl bg-white dark:bg-zinc-900 ring-1 ring-zinc-950/5 dark:ring-white/10">
17447
+ <div class="p-12 text-center">
17448
+ <svg class="mx-auto h-8 w-8 text-zinc-400 dark:text-zinc-500 mb-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
17449
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"/>
17450
+ </svg>
17451
+ <p class="text-sm font-medium text-zinc-900 dark:text-zinc-100">No entries yet</p>
17452
+ <p class="mt-1 text-sm text-zinc-500 dark:text-zinc-400">Cache-eligible API requests will appear here after the first page load.</p>
17453
+ </div>
17454
+ </div>
17455
+ `;
17456
+ }
17457
+ const rows = entries.map((entry) => {
17458
+ const totalReqs = entry.hits + entry.misses + entry.staleServes;
17459
+ const hitRate = totalReqs > 0 ? Math.round(entry.hits / totalReqs * 100) : 0;
17460
+ const hitRateColor = hitRate > 70 ? "text-lime-600 dark:text-lime-400" : hitRate > 40 ? "text-amber-600 dark:text-amber-400" : "text-red-600 dark:text-red-400";
17461
+ const pathDisplay = entry.queryString ? `${entry.path}?${entry.queryString}` : entry.path;
17462
+ const truncatedPath = pathDisplay.length > 80 ? pathDisplay.slice(0, 77) + "\u2026" : pathDisplay;
17463
+ const collBadge = entry.collection ? `<span class="inline-flex items-center rounded-md px-1.5 py-0.5 text-xs font-medium bg-sky-50 dark:bg-sky-500/10 text-sky-700 dark:text-sky-400 ring-1 ring-inset ring-sky-600/20">${entry.collection}</span>` : `<span class="text-xs text-zinc-400 dark:text-zinc-600">\u2014</span>`;
17464
+ const timeAgo = formatTimeAgo(entry.lastSeen);
17465
+ return `
17466
+ <tr class="hover:bg-zinc-50 dark:hover:bg-zinc-800/50">
17467
+ <td class="px-4 py-3 max-w-xs">
17468
+ <code class="text-xs text-zinc-700 dark:text-zinc-300 break-all" title="${pathDisplay}">${truncatedPath}</code>
17469
+ </td>
17470
+ <td class="px-4 py-3 whitespace-nowrap">${collBadge}</td>
17471
+ <td class="px-4 py-3 whitespace-nowrap text-sm text-zinc-900 dark:text-zinc-100 text-right">${totalReqs.toLocaleString()}</td>
17472
+ <td class="px-4 py-3 whitespace-nowrap text-right">
17473
+ <span class="text-sm font-medium ${hitRateColor}">${hitRate}%</span>
17474
+ </td>
17475
+ <td class="px-4 py-3 whitespace-nowrap text-sm text-zinc-600 dark:text-zinc-400 text-right">${entry.hits.toLocaleString()}</td>
17476
+ <td class="px-4 py-3 whitespace-nowrap text-sm text-zinc-600 dark:text-zinc-400 text-right">${entry.misses.toLocaleString()}</td>
17477
+ <td class="px-4 py-3 whitespace-nowrap text-sm text-zinc-500 dark:text-zinc-500 text-right">${entry.staleServes > 0 ? entry.staleServes.toLocaleString() : "\u2014"}</td>
17478
+ <td class="px-4 py-3 whitespace-nowrap text-xs text-zinc-400 dark:text-zinc-500 text-right">${timeAgo}</td>
17479
+ </tr>
17480
+ `;
17481
+ }).join("");
17482
+ return `
17483
+ ${statCards}
17484
+
17485
+ <div class="overflow-hidden rounded-xl bg-white dark:bg-zinc-900 ring-1 ring-zinc-950/5 dark:ring-white/10">
17486
+ <div class="px-6 py-4 border-b border-zinc-950/5 dark:border-white/10 flex items-center justify-between">
17487
+ <div>
17488
+ <h2 class="text-lg font-semibold text-zinc-950 dark:text-white">
17489
+ Cache-Eligible API URLs${swrBadge}
17490
+ </h2>
17491
+ <p class="mt-1 text-sm text-zinc-500 dark:text-zinc-400">
17492
+ Ranked by total requests. Resets on isolate eviction. Scoped to public/privileged (non-ACL) requests only.
17493
+ </p>
17494
+ </div>
17495
+ <button
17496
+ onclick="clearUrlCatalog()"
17497
+ class="inline-flex items-center gap-2 rounded-lg bg-white dark:bg-zinc-900 px-3 py-1.5 text-sm font-medium text-zinc-700 dark:text-zinc-300 ring-1 ring-inset ring-zinc-950/10 dark:ring-white/10 hover:bg-zinc-50 dark:hover:bg-zinc-800"
17498
+ >
17499
+ Clear
17500
+ </button>
17501
+ </div>
17502
+ <div class="overflow-x-auto">
17503
+ <table class="min-w-full divide-y divide-zinc-950/5 dark:divide-white/10">
17504
+ <thead class="bg-zinc-50 dark:bg-zinc-800/50">
17505
+ <tr>
17506
+ <th class="px-4 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">URL</th>
17507
+ <th class="px-4 py-3 text-left text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Collection</th>
17508
+ <th class="px-4 py-3 text-right text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Requests</th>
17509
+ <th class="px-4 py-3 text-right text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Hit Rate</th>
17510
+ <th class="px-4 py-3 text-right text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Hits</th>
17511
+ <th class="px-4 py-3 text-right text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Misses</th>
17512
+ <th class="px-4 py-3 text-right text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Stale</th>
17513
+ <th class="px-4 py-3 text-right text-xs font-medium text-zinc-500 dark:text-zinc-400 uppercase tracking-wider">Last Seen</th>
17514
+ </tr>
17515
+ </thead>
17516
+ <tbody class="divide-y divide-zinc-950/5 dark:divide-white/10">
17517
+ ${rows}
17518
+ </tbody>
17519
+ </table>
17520
+ </div>
17521
+ </div>
17522
+
17523
+ <div class="overflow-hidden rounded-xl bg-white dark:bg-zinc-900 ring-1 ring-zinc-950/5 dark:ring-white/10">
17524
+ <div class="px-6 py-5">
17525
+ <h3 class="text-sm font-semibold text-zinc-950 dark:text-white mb-2">About this catalog</h3>
17526
+ <ul class="text-sm text-zinc-600 dark:text-zinc-400 space-y-1 list-disc list-inside">
17527
+ <li><strong>Phase 1 (done):</strong> Collection-scoped cache invalidation \u2014 content changes only purge the affected collection's keys.</li>
17528
+ <li><strong>Phase 2 (this view):</strong> URL catalog tracks every cache-eligible API request. Use to identify hot URLs for targeted pre-warming.</li>
17529
+ <li><strong>Phase 3 (SWR):</strong> Stale-While-Revalidate \u2014 on invalidation, the previous response is kept for 30 s so the first post-edit request is served from cache instantly. Stale serves are counted above.</li>
17530
+ <li>Catalog is per-isolate and resets on cold start. For persistent tracking, sink data to Analytics Engine.</li>
17531
+ </ul>
17532
+ </div>
17533
+ </div>
17534
+ `;
17535
+ }
17536
+ function renderMiniStatCard(label, value, color) {
17537
+ const colorClasses = {
17538
+ sky: "bg-sky-50 dark:bg-sky-500/10 text-sky-600 dark:text-sky-400",
17539
+ lime: "bg-lime-50 dark:bg-lime-500/10 text-lime-600 dark:text-lime-400",
17540
+ amber: "bg-amber-50 dark:bg-amber-500/10 text-amber-600 dark:text-amber-400",
17541
+ purple: "bg-purple-50 dark:bg-purple-500/10 text-purple-600 dark:text-purple-400"
17542
+ };
17543
+ return `
17544
+ <div class="overflow-hidden rounded-xl bg-white dark:bg-zinc-900 ring-1 ring-zinc-950/5 dark:ring-white/10 p-4">
17545
+ <p class="text-xs text-zinc-500 dark:text-zinc-400">${label}</p>
17546
+ <p class="mt-1 text-xl font-semibold ${colorClasses[color] ?? colorClasses.sky}">${value}</p>
17547
+ </div>
17548
+ `;
17549
+ }
17550
+ function formatTimeAgo(ts) {
17551
+ const secs = Math.floor((Date.now() - ts) / 1e3);
17552
+ if (secs < 60) return `${secs}s ago`;
17553
+ if (secs < 3600) return `${Math.floor(secs / 60)}m ago`;
17554
+ return `${Math.floor(secs / 3600)}h ago`;
17371
17555
  }
17372
17556
  function renderCollectionSettingsTab(collections) {
17373
17557
  if (collections.length === 0) {
@@ -17623,7 +17807,7 @@ app.get("/", async (c) => {
17623
17807
  const totalRequests = totalHits + totalMisses;
17624
17808
  const overallHitRate = totalRequests > 0 ? totalHits / totalRequests * 100 : 0;
17625
17809
  const DEFAULT_TTL = chunkYA3TJ65D_cjs.CACHE_CONFIGS.api?.ttl ?? 300;
17626
- const collections = chunkQCJHCSOK_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => {
17810
+ const collections = chunk4DHPR7KR_cjs.getCollectionRegistry().listActive().filter((r) => !r.internal).map((r) => {
17627
17811
  const cacheOverride = r.cache;
17628
17812
  const cacheEnabled = cacheOverride?.enabled !== false;
17629
17813
  const hasCustomTtl = typeof cacheOverride?.ttl === "number";
@@ -17636,6 +17820,9 @@ app.get("/", async (c) => {
17636
17820
  ttlSource: hasCustomTtl ? "collection" : "default"
17637
17821
  };
17638
17822
  });
17823
+ await chunkFZGIU5AZ_cjs.loadKvCatalog();
17824
+ const catalogEntries = chunkFZGIU5AZ_cjs.getCatalog({ limit: 100 });
17825
+ const catalogSummary = chunkFZGIU5AZ_cjs.getCatalogStats();
17639
17826
  const dashboardData = {
17640
17827
  stats,
17641
17828
  totals: {
@@ -17648,6 +17835,11 @@ app.get("/", async (c) => {
17648
17835
  },
17649
17836
  namespaces: Object.keys(stats),
17650
17837
  collections,
17838
+ catalog: {
17839
+ entries: catalogEntries,
17840
+ stats: catalogSummary,
17841
+ swrPending: chunkS2QN4LFD_cjs.swrStats().count
17842
+ },
17651
17843
  user: user ? {
17652
17844
  name: user.email,
17653
17845
  email: user.email,
@@ -17994,6 +18186,24 @@ app.post("/warm/:namespace", async (c) => {
17994
18186
  }, 500);
17995
18187
  }
17996
18188
  });
18189
+ app.get("/catalog", async (c) => {
18190
+ const collection = c.req.query("collection") || void 0;
18191
+ const sortBy = c.req.query("sort") || "requests";
18192
+ const limit = parseInt(c.req.query("limit") || "100");
18193
+ await chunkFZGIU5AZ_cjs.loadKvCatalog();
18194
+ const entries = chunkFZGIU5AZ_cjs.getCatalog({ collection, sortBy, limit });
18195
+ const stats = chunkFZGIU5AZ_cjs.getCatalogStats();
18196
+ return c.json({
18197
+ success: true,
18198
+ data: { entries, stats, swrPending: chunkS2QN4LFD_cjs.swrStats().count },
18199
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
18200
+ });
18201
+ });
18202
+ app.post("/catalog/clear", async (_c) => {
18203
+ chunkFZGIU5AZ_cjs.clearCatalog();
18204
+ await chunkFZGIU5AZ_cjs.clearKvCatalog();
18205
+ return _c.json({ success: true, message: "URL catalog cleared", timestamp: (/* @__PURE__ */ new Date()).toISOString() });
18206
+ });
17997
18207
  var routes_default2 = app;
17998
18208
 
17999
18209
  // src/plugins/cache/index.ts
@@ -18160,9 +18370,9 @@ var faviconSvg = `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
18160
18370
  // src/app.ts
18161
18371
  function createSonicJSApp(config = {}) {
18162
18372
  const app2 = new hono.Hono();
18163
- const appVersion = config.version || chunkKKNEYIZJ_cjs.getCoreVersion();
18373
+ const appVersion = config.version || chunkXZUEGFXE_cjs.getCoreVersion();
18164
18374
  const appName = config.name || "SonicJS AI";
18165
- const hookSystem = new chunkQJUJNTIU_cjs.HookSystemImpl();
18375
+ const hookSystem = new chunkA22RBHO7_cjs.HookSystemImpl();
18166
18376
  chunkJ6JTWD2A_cjs.setHookSystem(hookSystem);
18167
18377
  const magicLinkPlugin = createMagicLinkAuthPlugin();
18168
18378
  const corePluginsBeforeCatchAll = [
@@ -18170,7 +18380,7 @@ function createSonicJSApp(config = {}) {
18170
18380
  apiKeysPlugin,
18171
18381
  aiSearchPlugin,
18172
18382
  oauthProvidersPlugin,
18173
- chunkI767LVN7_cjs.userProfilesPlugin,
18383
+ chunkS2QN4LFD_cjs.userProfilesPlugin,
18174
18384
  otpLoginPlugin,
18175
18385
  analyticsPlugin,
18176
18386
  stripePlugin,
@@ -18180,24 +18390,24 @@ function createSonicJSApp(config = {}) {
18180
18390
  shortcodesPlugin,
18181
18391
  helloWorldPlugin,
18182
18392
  multiTenantPlugin,
18183
- chunkI767LVN7_cjs.lexicalEditorPlugin,
18393
+ chunkS2QN4LFD_cjs.lexicalEditorPlugin,
18184
18394
  versioningPlugin,
18185
18395
  menuPlugin
18186
18396
  ];
18187
18397
  const corePluginsAfterCatchAll = [emailPluginV3, magicLinkPlugin, emailReconciliationPlugin];
18188
- const wirePlugins = chunkQJUJNTIU_cjs.createPluginWirer(
18398
+ const wirePlugins = chunkA22RBHO7_cjs.createPluginWirer(
18189
18399
  () => [...corePluginsBeforeCatchAll, ...corePluginsAfterCatchAll, ...config.plugins?.register ?? []],
18190
18400
  // The capability-gated `ctx.cap.email` resolves to the app EmailService, which
18191
18401
  // is initialized (below) just before wiring on the first request.
18192
18402
  () => ({
18193
18403
  hooks: hookSystem,
18194
18404
  env: firstRequestEnv,
18195
- providers: { email: () => chunkI767LVN7_cjs.getEmailService() }
18405
+ providers: { email: () => chunkS2QN4LFD_cjs.getEmailService() }
18196
18406
  })
18197
18407
  );
18198
18408
  let firstRequestEnv;
18199
18409
  const initEmailService = async (env = {}) => {
18200
- if (chunkI767LVN7_cjs.hasEmailService()) return;
18410
+ if (chunkS2QN4LFD_cjs.hasEmailService()) return;
18201
18411
  let provider;
18202
18412
  let defaultFrom = config.email?.from;
18203
18413
  let defaultReplyTo;
@@ -18232,14 +18442,14 @@ function createSonicJSApp(config = {}) {
18232
18442
  }
18233
18443
  }
18234
18444
  defaultFrom = defaultFrom || env.DEFAULT_FROM_EMAIL || "noreply@sonicjs.local";
18235
- chunkI767LVN7_cjs.setEmailService(new EmailService({ provider, defaultFrom, defaultReplyTo, db: env.DB }));
18445
+ chunkS2QN4LFD_cjs.setEmailService(new EmailService({ provider, defaultFrom, defaultReplyTo, db: env.DB }));
18236
18446
  };
18237
18447
  app2.use("*", async (c, next) => {
18238
18448
  c.set("appVersion", appVersion);
18239
18449
  await next();
18240
18450
  });
18241
- app2.use("*", chunk37V3RET3_cjs.metricsMiddleware());
18242
- app2.use("*", chunk37V3RET3_cjs.bootstrapMiddleware(config));
18451
+ app2.use("*", chunkBRKXMRMB_cjs.metricsMiddleware());
18452
+ app2.use("*", chunkBRKXMRMB_cjs.bootstrapMiddleware(config, [...corePluginsBeforeCatchAll, ...corePluginsAfterCatchAll, ...config.plugins?.register ?? []]));
18243
18453
  const boot = async (env) => {
18244
18454
  if (config.plugins?.disableAll) return;
18245
18455
  firstRequestEnv = env;
@@ -18271,19 +18481,28 @@ function createSonicJSApp(config = {}) {
18271
18481
  const allowed = c.env?.CORS_ORIGINS;
18272
18482
  if (!allowed) return null;
18273
18483
  const list = allowed.split(",").map((s) => s.trim());
18274
- return list.includes(origin) ? origin : null;
18484
+ const match = list.some((pattern) => {
18485
+ if (pattern === origin) return true;
18486
+ if (pattern.startsWith("*.")) {
18487
+ const suffix = pattern.slice(1);
18488
+ return origin.endsWith(suffix);
18489
+ }
18490
+ return false;
18491
+ });
18492
+ return match ? origin : null;
18275
18493
  },
18276
18494
  allowMethods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
18277
- allowHeaders: ["Content-Type", "Authorization", "X-API-Key"],
18495
+ allowHeaders: ["Content-Type", "Authorization", "X-API-Key", "Cache-Control"],
18496
+ exposeHeaders: ["X-Cache-Status", "X-Cache-Source", "X-Cache-TTL", "X-Response-Time"],
18278
18497
  credentials: true
18279
18498
  }));
18280
- app2.use("*", chunk37V3RET3_cjs.securityHeadersMiddleware());
18281
- app2.use("*", chunk37V3RET3_cjs.csrfProtection());
18499
+ app2.use("*", chunkBRKXMRMB_cjs.securityHeadersMiddleware());
18500
+ app2.use("*", chunkBRKXMRMB_cjs.csrfProtection());
18282
18501
  app2.use("*", async (c, next) => {
18283
18502
  try {
18284
18503
  const reqUrl = new URL(c.req.url);
18285
18504
  const requestBaseURL = `${reqUrl.protocol}//${reqUrl.host}`;
18286
- const auth = chunkGMMCCIQO_cjs.createAuth(c.env, config.auth?.extendBetterAuth, requestBaseURL);
18505
+ const auth = chunk6UAI4SGN_cjs.createAuth(c.env, config.auth?.extendBetterAuth, requestBaseURL);
18287
18506
  const session = await auth.api.getSession({ headers: c.req.raw.headers });
18288
18507
  if (session?.user) {
18289
18508
  const u = session.user;
@@ -18311,14 +18530,37 @@ function createSonicJSApp(config = {}) {
18311
18530
  await next();
18312
18531
  });
18313
18532
  app2.use("*", apiKeyAuthMiddleware());
18533
+ app2.use("*", async (c, next) => {
18534
+ if (!c.get("user")) {
18535
+ const authHeader = c.req.header("Authorization");
18536
+ if (authHeader?.startsWith("Bearer ") && !authHeader.startsWith("Bearer sk_")) {
18537
+ const token = authHeader.slice(7);
18538
+ try {
18539
+ const secret = c.env?.JWT_SECRET;
18540
+ const payload = await chunkBRKXMRMB_cjs.AuthManager.verifyToken(token, secret);
18541
+ if (payload) {
18542
+ c.set("user", {
18543
+ userId: payload.userId,
18544
+ email: payload.email,
18545
+ role: payload.role,
18546
+ exp: payload.exp,
18547
+ iat: payload.iat
18548
+ });
18549
+ }
18550
+ } catch {
18551
+ }
18552
+ }
18553
+ }
18554
+ await next();
18555
+ });
18314
18556
  if (config.middleware?.afterAuth) {
18315
18557
  for (const middleware of config.middleware.afterAuth) {
18316
18558
  app2.use("*", middleware);
18317
18559
  }
18318
18560
  }
18319
- app2.use("*", chunkQCJHCSOK_cjs.tenantMiddleware());
18320
- app2.use("/admin/*", chunk37V3RET3_cjs.requireAuth());
18321
- app2.use("/admin/*", chunk37V3RET3_cjs.requireRbac("portal", "access"));
18561
+ app2.use("*", chunk4DHPR7KR_cjs.tenantMiddleware());
18562
+ app2.use("/admin/*", chunkBRKXMRMB_cjs.requireAuth());
18563
+ app2.use("/admin/*", chunkBRKXMRMB_cjs.requireRbac("portal", "access"));
18322
18564
  app2.use("/admin/*", pluginMenuMiddleware());
18323
18565
  app2.use("/admin/*", menuMiddleware());
18324
18566
  const NAV_LANDING = [
@@ -18336,7 +18578,7 @@ function createSonicJSApp(config = {}) {
18336
18578
  if (!user?.userId) return next();
18337
18579
  let perms = [];
18338
18580
  try {
18339
- const { RbacService: RbacService2 } = await import('./rbac-7QZ4JZ2E.cjs');
18581
+ const { RbacService: RbacService2 } = await import('./rbac-TFUOYIVN.cjs');
18340
18582
  perms = await new RbacService2(c.env.DB, c.env.CACHE_KV).permissionsForUser(user.userId);
18341
18583
  } catch {
18342
18584
  return next();
@@ -18365,43 +18607,43 @@ function createSonicJSApp(config = {}) {
18365
18607
  });
18366
18608
  app2.route("/api/security-audit", apiRoutes2);
18367
18609
  app2.route("/admin/plugins/security-audit", adminRoutes3);
18368
- app2.route("/api/media", chunkI767LVN7_cjs.api_media_default);
18369
- app2.route("/api/system", chunkI767LVN7_cjs.api_system_default);
18370
- app2.route("/api/documents", chunkI767LVN7_cjs.apiDocumentsRoutes);
18371
- app2.route("/api", chunkI767LVN7_cjs.api_default);
18372
- app2.route("/admin/documents", chunkI767LVN7_cjs.adminDocumentsRoutes);
18373
- chunkQJUJNTIU_cjs.registerPluginRoutes(app2, [formsPlugin], { source: "core" });
18374
- app2.route("/admin/api", chunkI767LVN7_cjs.admin_api_default);
18375
- app2.route("/admin/collections", chunkI767LVN7_cjs.adminCollectionsRoutes);
18376
- app2.route("/admin/settings", chunkI767LVN7_cjs.adminSettingsRoutes);
18377
- app2.route("/admin/api-reference", chunkI767LVN7_cjs.router2);
18610
+ app2.route("/api/media", chunkS2QN4LFD_cjs.api_media_default);
18611
+ app2.route("/api/system", chunkS2QN4LFD_cjs.api_system_default);
18612
+ app2.route("/api/documents", chunkS2QN4LFD_cjs.apiDocumentsRoutes);
18613
+ app2.route("/api", chunkS2QN4LFD_cjs.api_default);
18614
+ app2.route("/admin/documents", chunkS2QN4LFD_cjs.adminDocumentsRoutes);
18615
+ chunkA22RBHO7_cjs.registerPluginRoutes(app2, [formsPlugin], { source: "core" });
18616
+ app2.route("/admin/api", chunkS2QN4LFD_cjs.admin_api_default);
18617
+ app2.route("/admin/collections", chunkS2QN4LFD_cjs.adminCollectionsRoutes);
18618
+ app2.route("/admin/settings", chunkS2QN4LFD_cjs.adminSettingsRoutes);
18619
+ app2.route("/admin/api-reference", chunkS2QN4LFD_cjs.router2);
18378
18620
  app2.route("/admin/database-tools", createDatabaseToolsAdminRoutes());
18379
- app2.route("/admin/content", chunkI767LVN7_cjs.admin_content_default);
18380
- app2.route("/admin/media", chunkI767LVN7_cjs.adminMediaRoutes);
18621
+ app2.route("/admin/content", chunkS2QN4LFD_cjs.admin_content_default);
18622
+ app2.route("/admin/media", chunkS2QN4LFD_cjs.adminMediaRoutes);
18381
18623
  app2.use("/auth/*", securityAuditMiddleware());
18382
18624
  if (!config.plugins?.disableAll) {
18383
- chunkQJUJNTIU_cjs.registerPluginRoutes(app2, corePluginsBeforeCatchAll, { source: "core" });
18625
+ chunkA22RBHO7_cjs.registerPluginRoutes(app2, corePluginsBeforeCatchAll, { source: "core" });
18384
18626
  app2.route("/admin/cache", cache_default.getRoutes());
18385
18627
  if (config.plugins?.register && config.plugins.register.length > 0) {
18386
- chunkQJUJNTIU_cjs.registerPluginRoutes(app2, config.plugins.register, { source: "user" });
18628
+ chunkA22RBHO7_cjs.registerPluginRoutes(app2, config.plugins.register, { source: "user" });
18387
18629
  }
18388
18630
  }
18389
18631
  app2.route("/api/events", apiRoutes4);
18390
- app2.route("/admin/dashboard", chunkI767LVN7_cjs.router);
18391
- app2.route("/admin/plugins", chunkI767LVN7_cjs.adminPluginRoutes);
18392
- app2.route("/admin/logs", chunkI767LVN7_cjs.adminLogsRoutes);
18632
+ app2.route("/admin/dashboard", chunkS2QN4LFD_cjs.router);
18633
+ app2.route("/admin/plugins", chunkS2QN4LFD_cjs.adminPluginRoutes);
18634
+ app2.route("/admin/logs", chunkS2QN4LFD_cjs.adminLogsRoutes);
18393
18635
  app2.route("/admin/rbac", adminRbacRoutes);
18394
- app2.route("/admin", chunkI767LVN7_cjs.userRoutes);
18395
- app2.route("/auth", chunkI767LVN7_cjs.auth_default);
18636
+ app2.route("/admin", chunkS2QN4LFD_cjs.userRoutes);
18637
+ app2.route("/auth", chunkS2QN4LFD_cjs.auth_default);
18396
18638
  app2.on(["GET", "POST"], "/auth/*", (c) => {
18397
18639
  const reqUrl = new URL(c.req.url);
18398
18640
  const requestBaseURL = `${reqUrl.protocol}//${reqUrl.host}`;
18399
- const auth = chunkGMMCCIQO_cjs.createAuth(c.env, config.auth?.extendBetterAuth, requestBaseURL);
18641
+ const auth = chunk6UAI4SGN_cjs.createAuth(c.env, config.auth?.extendBetterAuth, requestBaseURL);
18400
18642
  return auth.handler(c.req.raw);
18401
18643
  });
18402
- app2.route("/", chunkI767LVN7_cjs.test_cleanup_default);
18644
+ app2.route("/", chunkS2QN4LFD_cjs.test_cleanup_default);
18403
18645
  if (!config.plugins?.disableAll) {
18404
- chunkQJUJNTIU_cjs.registerPluginRoutes(app2, corePluginsAfterCatchAll, { source: "core" });
18646
+ chunkA22RBHO7_cjs.registerPluginRoutes(app2, corePluginsAfterCatchAll, { source: "core" });
18405
18647
  }
18406
18648
  if (!config.plugins?.disableAll) {
18407
18649
  const allMountedPlugins = [
@@ -18411,10 +18653,10 @@ function createSonicJSApp(config = {}) {
18411
18653
  ...config.plugins?.register ?? []
18412
18654
  ];
18413
18655
  const userPlugins = (config.plugins?.register ?? []).filter(
18414
- (p) => !chunkQCJHCSOK_cjs.PLUGIN_REGISTRY[p.id]
18656
+ (p) => !chunk4DHPR7KR_cjs.PLUGIN_REGISTRY[p.id]
18415
18657
  );
18416
- chunkBP52BFIV_cjs.setPluginMenu(userPlugins.flatMap((p) => p.menu ?? []));
18417
- chunkBP52BFIV_cjs.setPluginDefinitions(allMountedPlugins);
18658
+ chunkKWQNB6UM_cjs.setPluginMenu(userPlugins.flatMap((p) => (p.menu ?? []).map((m) => ({ ...m, pluginId: p.id }))));
18659
+ chunkKWQNB6UM_cjs.setPluginDefinitions(allMountedPlugins);
18418
18660
  }
18419
18661
  app2.get("/favicon.svg", (c) => {
18420
18662
  return new Response(faviconSvg, {
@@ -18467,7 +18709,7 @@ function createSonicJSApp(config = {}) {
18467
18709
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
18468
18710
  });
18469
18711
  });
18470
- chunk36Z3AKX3_cjs.setAppInstance(app2);
18712
+ chunkC5LDQ3SH_cjs.setAppInstance(app2);
18471
18713
  app2.notFound((c) => {
18472
18714
  return c.json({ error: "Not Found", status: 404 }, 404);
18473
18715
  });
@@ -19282,7 +19524,7 @@ var RedirectService = class {
19282
19524
  env;
19283
19525
  cloudflareService = null;
19284
19526
  getDocService() {
19285
- return new chunkLTZ5WYOK_cjs.DocumentsService(this.db, {
19527
+ return new chunkOLEOKHDX_cjs.DocumentsService(this.db, {
19286
19528
  queryableFields: REDIRECT_QUERYABLE_FIELDS,
19287
19529
  maxVersionsPerRoot: 1,
19288
19530
  tenantId: TENANT3
@@ -20585,7 +20827,7 @@ function renderLayout(title, content2) {
20585
20827
  }
20586
20828
  </style>
20587
20829
  `;
20588
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst({
20830
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst({
20589
20831
  title,
20590
20832
  currentPath: "/admin/redirects",
20591
20833
  content: customStyles + content2.toString()
@@ -20950,7 +21192,7 @@ function getFormScripts() {
20950
21192
  `;
20951
21193
  }
20952
21194
  function renderLayout2(title, content2) {
20953
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst({
21195
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst({
20954
21196
  title,
20955
21197
  currentPath: "/admin/redirects",
20956
21198
  content: content2.toString()
@@ -21908,7 +22150,7 @@ function createRedirectApiRoutes() {
21908
22150
  });
21909
22151
  return api;
21910
22152
  }
21911
- var redirectPlugin = chunkBP52BFIV_cjs.definePlugin({
22153
+ var redirectPlugin = chunkKWQNB6UM_cjs.definePlugin({
21912
22154
  id: manifest_default3.id,
21913
22155
  version: manifest_default3.version,
21914
22156
  name: manifest_default3.name,
@@ -21926,7 +22168,7 @@ var redirectPlugin = chunkBP52BFIV_cjs.definePlugin({
21926
22168
  async onBoot(ctx) {
21927
22169
  const db = ctx.env?.DB;
21928
22170
  if (!db) return;
21929
- const registry = new chunk37V3RET3_cjs.DocumentTypeRegistry(db);
22171
+ const registry = new chunkBRKXMRMB_cjs.DocumentTypeRegistry(db);
21930
22172
  await registry.register({
21931
22173
  id: "redirect",
21932
22174
  name: "redirect",
@@ -21950,6 +22192,69 @@ function createRedirectPlugin() {
21950
22192
  return redirectPlugin;
21951
22193
  }
21952
22194
 
22195
+ // src/plugins/core-plugins/demo-login/index.ts
22196
+ var demoLoginJs = `
22197
+ // Demo Login Prefill Script
22198
+ (function() {
22199
+ 'use strict';
22200
+
22201
+ function prefillLoginForm() {
22202
+ const emailInput = document.getElementById('email');
22203
+ const passwordInput = document.getElementById('password');
22204
+
22205
+ if (emailInput && passwordInput) {
22206
+ emailInput.value = 'admin@sonicjs.com';
22207
+ passwordInput.value = 'sonicjs!';
22208
+
22209
+ const form = emailInput.closest('form');
22210
+ if (form) {
22211
+ const notice = document.createElement('div');
22212
+ notice.className = 'mb-4 p-3 bg-blue-50 border border-blue-200 rounded-lg text-blue-800 text-sm';
22213
+ notice.innerHTML = '\u{1F3AF} <strong>Demo Mode:</strong> Login form prefilled with demo credentials';
22214
+ form.insertBefore(notice, form.firstChild);
22215
+ }
22216
+ }
22217
+ }
22218
+
22219
+ if (document.readyState === 'loading') {
22220
+ document.addEventListener('DOMContentLoaded', prefillLoginForm);
22221
+ } else {
22222
+ prefillLoginForm();
22223
+ }
22224
+
22225
+ document.addEventListener('htmx:afterSwap', function(event) {
22226
+ if (event.detail.target.id === 'main-content' ||
22227
+ document.getElementById('email')) {
22228
+ setTimeout(prefillLoginForm, 100);
22229
+ }
22230
+ });
22231
+ })();
22232
+ `;
22233
+ var loginPrefillHandler = async (data) => {
22234
+ if (data.pageType === "auth-login" || data.template?.includes("login")) {
22235
+ data.scripts = data.scripts ?? [];
22236
+ data.inlineScripts = data.inlineScripts ?? [];
22237
+ data.inlineScripts.push(demoLoginJs);
22238
+ }
22239
+ return data;
22240
+ };
22241
+ var demoLoginPlugin = chunkKWQNB6UM_cjs.definePlugin({
22242
+ id: "demo-login-plugin",
22243
+ version: "1.0.0",
22244
+ name: "Demo Login",
22245
+ description: "Prefills login form with demo credentials (admin@sonicjs.com/sonicjs!) for easy site demonstration.",
22246
+ sonicjsVersionRange: "^3.0.0",
22247
+ author: { name: "SonicJS" },
22248
+ async onBoot(ctx) {
22249
+ chunkS2QN4LFD_cjs.setDemoModeActive();
22250
+ const hooks = ctx.raw?.hooks;
22251
+ if (hooks?.register) {
22252
+ hooks.register("template:render", loginPrefillHandler);
22253
+ hooks.register("page:before-render", loginPrefillHandler);
22254
+ }
22255
+ }
22256
+ });
22257
+
21953
22258
  // src/collections/site-settings.collection.ts
21954
22259
  var site_settings_collection_default = {
21955
22260
  name: "site_settings",
@@ -22332,10 +22637,10 @@ function shapeDocument(doc, redactFields) {
22332
22637
  };
22333
22638
  }
22334
22639
  async function resolveType(ctx, typeId) {
22335
- const docType = await new chunk37V3RET3_cjs.DocumentTypeRegistry(ctx.db).findById(typeId);
22640
+ const docType = await new chunkBRKXMRMB_cjs.DocumentTypeRegistry(ctx.db).findById(typeId);
22336
22641
  if (!docType || !docType.isActive) throw new McpToolError(`Unknown document type: ${typeId}`);
22337
- const effTenant = chunkI767LVN7_cjs.effectiveTenantForType(ctx.tenantId, docType.settings);
22338
- const repo = new chunkI767LVN7_cjs.DocumentRepository(ctx.db, effTenant);
22642
+ const effTenant = chunkS2QN4LFD_cjs.effectiveTenantForType(ctx.tenantId, docType.settings);
22643
+ const repo = new chunkS2QN4LFD_cjs.DocumentRepository(ctx.db, effTenant);
22339
22644
  return { docType, repo };
22340
22645
  }
22341
22646
  async function execList(ctx, typeId, args) {
@@ -22373,11 +22678,11 @@ async function execGet(ctx, typeId, args) {
22373
22678
 
22374
22679
  // src/plugins/core-plugins/mcp-plugin/tools/mutations.ts
22375
22680
  async function resolveWriteScope(ctx, typeId) {
22376
- const docType = await new chunk37V3RET3_cjs.DocumentTypeRegistry(ctx.db).findById(typeId);
22681
+ const docType = await new chunkBRKXMRMB_cjs.DocumentTypeRegistry(ctx.db).findById(typeId);
22377
22682
  if (!docType || !docType.isActive) throw new McpToolError(`Unknown document type: ${typeId}`);
22378
- const effTenant = chunkI767LVN7_cjs.effectiveTenantForType(ctx.tenantId, docType.settings);
22379
- const repo = new chunkI767LVN7_cjs.DocumentRepository(ctx.db, effTenant);
22380
- const svc = new chunkLTZ5WYOK_cjs.DocumentsService(ctx.db, {
22683
+ const effTenant = chunkS2QN4LFD_cjs.effectiveTenantForType(ctx.tenantId, docType.settings);
22684
+ const repo = new chunkS2QN4LFD_cjs.DocumentRepository(ctx.db, effTenant);
22685
+ const svc = new chunkOLEOKHDX_cjs.DocumentsService(ctx.db, {
22381
22686
  queryableFields: docType.queryableFields ?? [],
22382
22687
  typeSchemaVersion: docType.schemaVersion,
22383
22688
  maxVersionsPerRoot: docType.settings?.maxVersionsPerRoot,
@@ -22391,7 +22696,7 @@ async function assertAllowed(scope, ctx, rootId, permission) {
22391
22696
  if (!ok) throw new McpToolError(`Permission denied: cannot ${permission} ${scope.docType.id}`);
22392
22697
  }
22393
22698
  function applyUserFieldDefaults(data, typeId, userId) {
22394
- const col = chunkQCJHCSOK_cjs.getCollectionRegistry().getByName(typeId);
22699
+ const col = chunk4DHPR7KR_cjs.getCollectionRegistry().getByName(typeId);
22395
22700
  if (!col?.schema?.properties) return data;
22396
22701
  const props = col.schema.properties;
22397
22702
  const patched = { ...data };
@@ -22404,7 +22709,7 @@ async function execCreate(ctx, typeId, args) {
22404
22709
  const scope = await resolveWriteScope(ctx, typeId);
22405
22710
  await assertAllowed(scope, ctx, "", "create");
22406
22711
  const data = redact(applyUserFieldDefaults(args.data ?? {}, typeId, ctx.userId), ctx.redactFields);
22407
- const input = chunkI767LVN7_cjs.createDocumentSchema.parse({
22712
+ const input = chunkS2QN4LFD_cjs.createDocumentSchema.parse({
22408
22713
  typeId,
22409
22714
  tenantId: scope.effTenant,
22410
22715
  title: args.title ?? null,
@@ -22422,7 +22727,7 @@ async function execUpdate(ctx, typeId, args) {
22422
22727
  const current = await scope.repo.getCurrentDraft(args.id);
22423
22728
  if (!current || current.typeId !== typeId) throw new McpToolError("Document not found");
22424
22729
  await assertAllowed(scope, ctx, args.id, "update");
22425
- const patch = chunkI767LVN7_cjs.updateDocumentSchema.parse({
22730
+ const patch = chunkS2QN4LFD_cjs.updateDocumentSchema.parse({
22426
22731
  ...args.title !== void 0 ? { title: args.title } : {},
22427
22732
  ...args.slug !== void 0 ? { slug: args.slug } : {},
22428
22733
  ...args.data !== void 0 ? { data: redact(args.data, ctx.redactFields) } : {}
@@ -22528,8 +22833,8 @@ function createMcpRoutes(options = {}) {
22528
22833
  rpcError(id, JSON_RPC.UNAUTHORIZED, "Unauthorized: provide a valid API key via Authorization: Bearer sk_...")
22529
22834
  );
22530
22835
  }
22531
- const { tenantId, principalSet, userId } = chunkI767LVN7_cjs.getDocumentRequestContext(c);
22532
- const registry = chunkQCJHCSOK_cjs.getCollectionRegistry();
22836
+ const { tenantId, principalSet, userId } = chunkS2QN4LFD_cjs.getDocumentRequestContext(c);
22837
+ const registry = chunk4DHPR7KR_cjs.getCollectionRegistry();
22533
22838
  const active = registry.listActive();
22534
22839
  const collections = new Map(active.map((col) => [col.name, col]));
22535
22840
  const cfg = resolveMcpConfig(options, active);
@@ -22629,7 +22934,7 @@ function createMcpRoutes(options = {}) {
22629
22934
  }
22630
22935
 
22631
22936
  // src/plugins/core-plugins/mcp-plugin/admin/templates.ts
22632
- chunkUYJQDDEE_cjs.init_admin_layout_catalyst_template();
22937
+ chunkMI2YXCK4_cjs.init_admin_layout_catalyst_template();
22633
22938
  function accessBadge(ok) {
22634
22939
  return ok ? `<span class="inline-flex items-center rounded-full bg-emerald-50 dark:bg-emerald-900/20 px-2 py-0.5 text-xs font-medium text-emerald-700 dark:text-emerald-400 ring-1 ring-emerald-600/20 dark:ring-emerald-400/20">Yes</span>` : `<span class="inline-flex items-center rounded-full bg-zinc-100 dark:bg-zinc-800 px-2 py-0.5 text-xs font-medium text-zinc-500 dark:text-zinc-400 ring-1 ring-zinc-200 dark:ring-zinc-700">No</span>`;
22635
22940
  }
@@ -22812,13 +23117,13 @@ function renderMcpDashboardPage(data) {
22812
23117
  version,
22813
23118
  dynamicMenuItems
22814
23119
  };
22815
- return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst(layoutData);
23120
+ return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst(layoutData);
22816
23121
  }
22817
23122
 
22818
23123
  // src/plugins/core-plugins/mcp-plugin/admin/routes.ts
22819
23124
  function createMcpAdminRoutes(options = {}) {
22820
23125
  const routes2 = new hono.Hono();
22821
- routes2.use("*", chunk37V3RET3_cjs.requireAuth());
23126
+ routes2.use("*", chunkBRKXMRMB_cjs.requireAuth());
22822
23127
  routes2.use("*", async (c, next) => {
22823
23128
  const user = c.get("user");
22824
23129
  if (user?.role !== "admin") return c.json({ error: "Access denied" }, 403);
@@ -22827,7 +23132,7 @@ function createMcpAdminRoutes(options = {}) {
22827
23132
  routes2.get("/", async (c) => {
22828
23133
  const url = new URL(c.req.url);
22829
23134
  const endpointUrl = `${url.protocol}//${url.host}/mcp`;
22830
- const registry = chunkQCJHCSOK_cjs.getCollectionRegistry();
23135
+ const registry = chunk4DHPR7KR_cjs.getCollectionRegistry();
22831
23136
  const active = registry.listActive();
22832
23137
  const collections = new Map(active.map((col) => [col.name, col]));
22833
23138
  const cfg = resolveMcpConfig(options, active);
@@ -22850,7 +23155,7 @@ function createMcpAdminRoutes(options = {}) {
22850
23155
  // src/plugins/core-plugins/mcp-plugin/index.ts
22851
23156
  var MCP_ICON = `<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"/></svg>`;
22852
23157
  function mcpPlugin(options = {}) {
22853
- return chunkBP52BFIV_cjs.definePlugin({
23158
+ return chunkKWQNB6UM_cjs.definePlugin({
22854
23159
  id: "mcp",
22855
23160
  version: "1.0.0",
22856
23161
  name: "MCP Server",
@@ -22869,103 +23174,103 @@ function createMcpPlugin(options) {
22869
23174
  }
22870
23175
 
22871
23176
  // src/index.ts
22872
- var VERSION = chunkKKNEYIZJ_cjs.package_default.version;
23177
+ var VERSION = chunkXZUEGFXE_cjs.package_default.version;
22873
23178
 
22874
23179
  Object.defineProperty(exports, "DocumentRepository", {
22875
23180
  enumerable: true,
22876
- get: function () { return chunkI767LVN7_cjs.DocumentRepository; }
23181
+ get: function () { return chunkS2QN4LFD_cjs.DocumentRepository; }
22877
23182
  });
22878
23183
  Object.defineProperty(exports, "ROUTES_INFO", {
22879
23184
  enumerable: true,
22880
- get: function () { return chunkI767LVN7_cjs.ROUTES_INFO; }
23185
+ get: function () { return chunkS2QN4LFD_cjs.ROUTES_INFO; }
22881
23186
  });
22882
23187
  Object.defineProperty(exports, "adminApiRoutes", {
22883
23188
  enumerable: true,
22884
- get: function () { return chunkI767LVN7_cjs.admin_api_default; }
23189
+ get: function () { return chunkS2QN4LFD_cjs.admin_api_default; }
22885
23190
  });
22886
23191
  Object.defineProperty(exports, "adminCheckboxRoutes", {
22887
23192
  enumerable: true,
22888
- get: function () { return chunkI767LVN7_cjs.adminCheckboxRoutes; }
23193
+ get: function () { return chunkS2QN4LFD_cjs.adminCheckboxRoutes; }
22889
23194
  });
22890
23195
  Object.defineProperty(exports, "adminCollectionsRoutes", {
22891
23196
  enumerable: true,
22892
- get: function () { return chunkI767LVN7_cjs.adminCollectionsRoutes; }
23197
+ get: function () { return chunkS2QN4LFD_cjs.adminCollectionsRoutes; }
22893
23198
  });
22894
23199
  Object.defineProperty(exports, "adminContentRoutes", {
22895
23200
  enumerable: true,
22896
- get: function () { return chunkI767LVN7_cjs.admin_content_default; }
23201
+ get: function () { return chunkS2QN4LFD_cjs.admin_content_default; }
22897
23202
  });
22898
23203
  Object.defineProperty(exports, "adminDashboardRoutes", {
22899
23204
  enumerable: true,
22900
- get: function () { return chunkI767LVN7_cjs.router; }
23205
+ get: function () { return chunkS2QN4LFD_cjs.router; }
22901
23206
  });
22902
23207
  Object.defineProperty(exports, "adminLogsRoutes", {
22903
23208
  enumerable: true,
22904
- get: function () { return chunkI767LVN7_cjs.adminLogsRoutes; }
23209
+ get: function () { return chunkS2QN4LFD_cjs.adminLogsRoutes; }
22905
23210
  });
22906
23211
  Object.defineProperty(exports, "adminMediaRoutes", {
22907
23212
  enumerable: true,
22908
- get: function () { return chunkI767LVN7_cjs.adminMediaRoutes; }
23213
+ get: function () { return chunkS2QN4LFD_cjs.adminMediaRoutes; }
22909
23214
  });
22910
23215
  Object.defineProperty(exports, "adminPluginRoutes", {
22911
23216
  enumerable: true,
22912
- get: function () { return chunkI767LVN7_cjs.adminPluginRoutes; }
23217
+ get: function () { return chunkS2QN4LFD_cjs.adminPluginRoutes; }
22913
23218
  });
22914
23219
  Object.defineProperty(exports, "adminSettingsRoutes", {
22915
23220
  enumerable: true,
22916
- get: function () { return chunkI767LVN7_cjs.adminSettingsRoutes; }
23221
+ get: function () { return chunkS2QN4LFD_cjs.adminSettingsRoutes; }
22917
23222
  });
22918
23223
  Object.defineProperty(exports, "adminUsersRoutes", {
22919
23224
  enumerable: true,
22920
- get: function () { return chunkI767LVN7_cjs.userRoutes; }
23225
+ get: function () { return chunkS2QN4LFD_cjs.userRoutes; }
22921
23226
  });
22922
23227
  Object.defineProperty(exports, "apiContentCrudRoutes", {
22923
23228
  enumerable: true,
22924
- get: function () { return chunkI767LVN7_cjs.api_content_crud_default; }
23229
+ get: function () { return chunkS2QN4LFD_cjs.api_content_crud_default; }
22925
23230
  });
22926
23231
  Object.defineProperty(exports, "apiMediaRoutes", {
22927
23232
  enumerable: true,
22928
- get: function () { return chunkI767LVN7_cjs.api_media_default; }
23233
+ get: function () { return chunkS2QN4LFD_cjs.api_media_default; }
22929
23234
  });
22930
23235
  Object.defineProperty(exports, "apiRoutes", {
22931
23236
  enumerable: true,
22932
- get: function () { return chunkI767LVN7_cjs.api_default; }
23237
+ get: function () { return chunkS2QN4LFD_cjs.api_default; }
22933
23238
  });
22934
23239
  Object.defineProperty(exports, "apiSystemRoutes", {
22935
23240
  enumerable: true,
22936
- get: function () { return chunkI767LVN7_cjs.api_system_default; }
23241
+ get: function () { return chunkS2QN4LFD_cjs.api_system_default; }
22937
23242
  });
22938
23243
  Object.defineProperty(exports, "authRoutes", {
22939
23244
  enumerable: true,
22940
- get: function () { return chunkI767LVN7_cjs.auth_default; }
23245
+ get: function () { return chunkS2QN4LFD_cjs.auth_default; }
22941
23246
  });
22942
23247
  Object.defineProperty(exports, "createUserProfilesPlugin", {
22943
23248
  enumerable: true,
22944
- get: function () { return chunkI767LVN7_cjs.createUserProfilesPlugin; }
23249
+ get: function () { return chunkS2QN4LFD_cjs.createUserProfilesPlugin; }
22945
23250
  });
22946
23251
  Object.defineProperty(exports, "defineUserProfile", {
22947
23252
  enumerable: true,
22948
- get: function () { return chunkI767LVN7_cjs.defineUserProfile; }
23253
+ get: function () { return chunkS2QN4LFD_cjs.defineUserProfile; }
22949
23254
  });
22950
23255
  Object.defineProperty(exports, "getUserProfileConfig", {
22951
23256
  enumerable: true,
22952
- get: function () { return chunkI767LVN7_cjs.getUserProfileConfig; }
23257
+ get: function () { return chunkS2QN4LFD_cjs.getUserProfileConfig; }
22953
23258
  });
22954
23259
  Object.defineProperty(exports, "userProfilesPlugin", {
22955
23260
  enumerable: true,
22956
- get: function () { return chunkI767LVN7_cjs.userProfilesPlugin; }
23261
+ get: function () { return chunkS2QN4LFD_cjs.userProfilesPlugin; }
22957
23262
  });
22958
23263
  Object.defineProperty(exports, "Logger", {
22959
23264
  enumerable: true,
22960
- get: function () { return chunk36Z3AKX3_cjs.Logger; }
23265
+ get: function () { return chunkC5LDQ3SH_cjs.Logger; }
22961
23266
  });
22962
23267
  Object.defineProperty(exports, "getLogger", {
22963
23268
  enumerable: true,
22964
- get: function () { return chunk36Z3AKX3_cjs.getLogger; }
23269
+ get: function () { return chunkC5LDQ3SH_cjs.getLogger; }
22965
23270
  });
22966
23271
  Object.defineProperty(exports, "initLogger", {
22967
23272
  enumerable: true,
22968
- get: function () { return chunk36Z3AKX3_cjs.initLogger; }
23273
+ get: function () { return chunkC5LDQ3SH_cjs.initLogger; }
22969
23274
  });
22970
23275
  Object.defineProperty(exports, "apiTokens", {
22971
23276
  enumerable: true,
@@ -23109,259 +23414,259 @@ Object.defineProperty(exports, "workflowHistory", {
23109
23414
  });
23110
23415
  Object.defineProperty(exports, "AuthManager", {
23111
23416
  enumerable: true,
23112
- get: function () { return chunk37V3RET3_cjs.AuthManager; }
23417
+ get: function () { return chunkBRKXMRMB_cjs.AuthManager; }
23113
23418
  });
23114
23419
  Object.defineProperty(exports, "PermissionManager", {
23115
23420
  enumerable: true,
23116
- get: function () { return chunk37V3RET3_cjs.PermissionManager; }
23421
+ get: function () { return chunkBRKXMRMB_cjs.PermissionManager; }
23117
23422
  });
23118
23423
  Object.defineProperty(exports, "bootstrapDocumentTypes", {
23119
23424
  enumerable: true,
23120
- get: function () { return chunk37V3RET3_cjs.bootstrapDocumentTypes; }
23425
+ get: function () { return chunkBRKXMRMB_cjs.bootstrapDocumentTypes; }
23121
23426
  });
23122
23427
  Object.defineProperty(exports, "bootstrapMiddleware", {
23123
23428
  enumerable: true,
23124
- get: function () { return chunk37V3RET3_cjs.bootstrapMiddleware; }
23429
+ get: function () { return chunkBRKXMRMB_cjs.bootstrapMiddleware; }
23125
23430
  });
23126
23431
  Object.defineProperty(exports, "cacheHeaders", {
23127
23432
  enumerable: true,
23128
- get: function () { return chunk37V3RET3_cjs.cacheHeaders; }
23433
+ get: function () { return chunkBRKXMRMB_cjs.cacheHeaders; }
23129
23434
  });
23130
23435
  Object.defineProperty(exports, "compressionMiddleware", {
23131
23436
  enumerable: true,
23132
- get: function () { return chunk37V3RET3_cjs.compressionMiddleware; }
23437
+ get: function () { return chunkBRKXMRMB_cjs.compressionMiddleware; }
23133
23438
  });
23134
23439
  Object.defineProperty(exports, "detailedLoggingMiddleware", {
23135
23440
  enumerable: true,
23136
- get: function () { return chunk37V3RET3_cjs.detailedLoggingMiddleware; }
23137
- });
23138
- Object.defineProperty(exports, "getActivePlugins", {
23139
- enumerable: true,
23140
- get: function () { return chunk37V3RET3_cjs.getActivePlugins; }
23141
- });
23142
- Object.defineProperty(exports, "isPluginActive", {
23143
- enumerable: true,
23144
- get: function () { return chunk37V3RET3_cjs.isPluginActive; }
23441
+ get: function () { return chunkBRKXMRMB_cjs.detailedLoggingMiddleware; }
23145
23442
  });
23146
23443
  Object.defineProperty(exports, "logActivity", {
23147
23444
  enumerable: true,
23148
- get: function () { return chunk37V3RET3_cjs.logActivity; }
23445
+ get: function () { return chunkBRKXMRMB_cjs.logActivity; }
23149
23446
  });
23150
23447
  Object.defineProperty(exports, "loggingMiddleware", {
23151
23448
  enumerable: true,
23152
- get: function () { return chunk37V3RET3_cjs.loggingMiddleware; }
23449
+ get: function () { return chunkBRKXMRMB_cjs.loggingMiddleware; }
23153
23450
  });
23154
23451
  Object.defineProperty(exports, "optionalAuth", {
23155
23452
  enumerable: true,
23156
- get: function () { return chunk37V3RET3_cjs.optionalAuth; }
23453
+ get: function () { return chunkBRKXMRMB_cjs.optionalAuth; }
23157
23454
  });
23158
23455
  Object.defineProperty(exports, "performanceLoggingMiddleware", {
23159
23456
  enumerable: true,
23160
- get: function () { return chunk37V3RET3_cjs.performanceLoggingMiddleware; }
23161
- });
23162
- Object.defineProperty(exports, "requireActivePlugin", {
23163
- enumerable: true,
23164
- get: function () { return chunk37V3RET3_cjs.requireActivePlugin; }
23165
- });
23166
- Object.defineProperty(exports, "requireActivePlugins", {
23167
- enumerable: true,
23168
- get: function () { return chunk37V3RET3_cjs.requireActivePlugins; }
23457
+ get: function () { return chunkBRKXMRMB_cjs.performanceLoggingMiddleware; }
23169
23458
  });
23170
23459
  Object.defineProperty(exports, "requireAnyPermission", {
23171
23460
  enumerable: true,
23172
- get: function () { return chunk37V3RET3_cjs.requireAnyPermission; }
23461
+ get: function () { return chunkBRKXMRMB_cjs.requireAnyPermission; }
23173
23462
  });
23174
23463
  Object.defineProperty(exports, "requireAuth", {
23175
23464
  enumerable: true,
23176
- get: function () { return chunk37V3RET3_cjs.requireAuth; }
23465
+ get: function () { return chunkBRKXMRMB_cjs.requireAuth; }
23177
23466
  });
23178
23467
  Object.defineProperty(exports, "requirePermission", {
23179
23468
  enumerable: true,
23180
- get: function () { return chunk37V3RET3_cjs.requirePermission; }
23469
+ get: function () { return chunkBRKXMRMB_cjs.requirePermission; }
23181
23470
  });
23182
23471
  Object.defineProperty(exports, "requireRole", {
23183
23472
  enumerable: true,
23184
- get: function () { return chunk37V3RET3_cjs.requireRole; }
23473
+ get: function () { return chunkBRKXMRMB_cjs.requireRole; }
23185
23474
  });
23186
23475
  Object.defineProperty(exports, "securityHeaders", {
23187
23476
  enumerable: true,
23188
- get: function () { return chunk37V3RET3_cjs.securityHeadersMiddleware; }
23477
+ get: function () { return chunkBRKXMRMB_cjs.securityHeadersMiddleware; }
23189
23478
  });
23190
23479
  Object.defineProperty(exports, "securityLoggingMiddleware", {
23191
23480
  enumerable: true,
23192
- get: function () { return chunk37V3RET3_cjs.securityLoggingMiddleware; }
23481
+ get: function () { return chunkBRKXMRMB_cjs.securityLoggingMiddleware; }
23193
23482
  });
23194
23483
  Object.defineProperty(exports, "DocumentsService", {
23195
23484
  enumerable: true,
23196
- get: function () { return chunkLTZ5WYOK_cjs.DocumentsService; }
23485
+ get: function () { return chunkOLEOKHDX_cjs.DocumentsService; }
23197
23486
  });
23198
23487
  Object.defineProperty(exports, "RbacService", {
23199
23488
  enumerable: true,
23200
- get: function () { return chunkLTZ5WYOK_cjs.RbacService; }
23489
+ get: function () { return chunkOLEOKHDX_cjs.RbacService; }
23201
23490
  });
23202
23491
  Object.defineProperty(exports, "PluginBootstrapService", {
23203
23492
  enumerable: true,
23204
- get: function () { return chunkQCJHCSOK_cjs.PluginBootstrapService; }
23493
+ get: function () { return chunk4DHPR7KR_cjs.PluginBootstrapService; }
23205
23494
  });
23206
23495
  Object.defineProperty(exports, "PluginServiceClass", {
23207
23496
  enumerable: true,
23208
- get: function () { return chunkQCJHCSOK_cjs.PluginService; }
23497
+ get: function () { return chunk4DHPR7KR_cjs.PluginService; }
23498
+ });
23499
+ Object.defineProperty(exports, "getActivePlugins", {
23500
+ enumerable: true,
23501
+ get: function () { return chunk4DHPR7KR_cjs.getActivePlugins; }
23209
23502
  });
23210
23503
  Object.defineProperty(exports, "getAvailableCollectionNames", {
23211
23504
  enumerable: true,
23212
- get: function () { return chunkQCJHCSOK_cjs.getAvailableCollectionNames; }
23505
+ get: function () { return chunk4DHPR7KR_cjs.getAvailableCollectionNames; }
23506
+ });
23507
+ Object.defineProperty(exports, "isPluginActive", {
23508
+ enumerable: true,
23509
+ get: function () { return chunk4DHPR7KR_cjs.isPluginActive; }
23213
23510
  });
23214
23511
  Object.defineProperty(exports, "loadCollectionConfig", {
23215
23512
  enumerable: true,
23216
- get: function () { return chunkQCJHCSOK_cjs.loadCollectionConfig; }
23513
+ get: function () { return chunk4DHPR7KR_cjs.loadCollectionConfig; }
23217
23514
  });
23218
23515
  Object.defineProperty(exports, "loadCollectionConfigs", {
23219
23516
  enumerable: true,
23220
- get: function () { return chunkQCJHCSOK_cjs.loadCollectionConfigs; }
23517
+ get: function () { return chunk4DHPR7KR_cjs.loadCollectionConfigs; }
23221
23518
  });
23222
23519
  Object.defineProperty(exports, "registerCollections", {
23223
23520
  enumerable: true,
23224
- get: function () { return chunkQCJHCSOK_cjs.registerCollections; }
23521
+ get: function () { return chunk4DHPR7KR_cjs.registerCollections; }
23522
+ });
23523
+ Object.defineProperty(exports, "requireActivePlugin", {
23524
+ enumerable: true,
23525
+ get: function () { return chunk4DHPR7KR_cjs.requireActivePlugin; }
23526
+ });
23527
+ Object.defineProperty(exports, "requireActivePlugins", {
23528
+ enumerable: true,
23529
+ get: function () { return chunk4DHPR7KR_cjs.requireActivePlugins; }
23225
23530
  });
23226
23531
  Object.defineProperty(exports, "validateCollectionConfig", {
23227
23532
  enumerable: true,
23228
- get: function () { return chunkQCJHCSOK_cjs.validateCollectionConfig; }
23533
+ get: function () { return chunk4DHPR7KR_cjs.validateCollectionConfig; }
23229
23534
  });
23230
23535
  Object.defineProperty(exports, "MigrationService", {
23231
23536
  enumerable: true,
23232
- get: function () { return chunkA2SN3RVL_cjs.MigrationService; }
23537
+ get: function () { return chunkPAS7GZBS_cjs.MigrationService; }
23233
23538
  });
23234
23539
  Object.defineProperty(exports, "renderFilterBar", {
23235
23540
  enumerable: true,
23236
- get: function () { return chunkBBEKHLTW_cjs.renderFilterBar; }
23541
+ get: function () { return chunkCN3T3TDI_cjs.renderFilterBar; }
23237
23542
  });
23238
23543
  Object.defineProperty(exports, "getConfirmationDialogScript", {
23239
23544
  enumerable: true,
23240
- get: function () { return chunkE66UVONV_cjs.getConfirmationDialogScript; }
23545
+ get: function () { return chunkOUBUS74I_cjs.getConfirmationDialogScript; }
23241
23546
  });
23242
23547
  Object.defineProperty(exports, "renderAlert", {
23243
23548
  enumerable: true,
23244
- get: function () { return chunkE66UVONV_cjs.renderAlert; }
23549
+ get: function () { return chunkOUBUS74I_cjs.renderAlert; }
23245
23550
  });
23246
23551
  Object.defineProperty(exports, "renderConfirmationDialog", {
23247
23552
  enumerable: true,
23248
- get: function () { return chunkE66UVONV_cjs.renderConfirmationDialog; }
23553
+ get: function () { return chunkOUBUS74I_cjs.renderConfirmationDialog; }
23249
23554
  });
23250
23555
  Object.defineProperty(exports, "renderForm", {
23251
23556
  enumerable: true,
23252
- get: function () { return chunkE66UVONV_cjs.renderForm; }
23557
+ get: function () { return chunkOUBUS74I_cjs.renderForm; }
23253
23558
  });
23254
23559
  Object.defineProperty(exports, "renderFormField", {
23255
23560
  enumerable: true,
23256
- get: function () { return chunkE66UVONV_cjs.renderFormField; }
23561
+ get: function () { return chunkOUBUS74I_cjs.renderFormField; }
23257
23562
  });
23258
23563
  Object.defineProperty(exports, "renderPagination", {
23259
23564
  enumerable: true,
23260
- get: function () { return chunkE66UVONV_cjs.renderPagination; }
23565
+ get: function () { return chunkOUBUS74I_cjs.renderPagination; }
23261
23566
  });
23262
23567
  Object.defineProperty(exports, "renderTable", {
23263
23568
  enumerable: true,
23264
- get: function () { return chunkE66UVONV_cjs.renderTable; }
23569
+ get: function () { return chunkOUBUS74I_cjs.renderTable; }
23265
23570
  });
23266
23571
  Object.defineProperty(exports, "renderAdminLayoutCatalyst", {
23267
23572
  enumerable: true,
23268
- get: function () { return chunkUYJQDDEE_cjs.renderAdminLayoutCatalyst; }
23573
+ get: function () { return chunkMI2YXCK4_cjs.renderAdminLayoutCatalyst; }
23269
23574
  });
23270
23575
  Object.defineProperty(exports, "HookSystemImpl", {
23271
23576
  enumerable: true,
23272
- get: function () { return chunkQJUJNTIU_cjs.HookSystemImpl; }
23577
+ get: function () { return chunkA22RBHO7_cjs.HookSystemImpl; }
23273
23578
  });
23274
23579
  Object.defineProperty(exports, "HookUtils", {
23275
23580
  enumerable: true,
23276
- get: function () { return chunkQJUJNTIU_cjs.HookUtils; }
23581
+ get: function () { return chunkA22RBHO7_cjs.HookUtils; }
23277
23582
  });
23278
23583
  Object.defineProperty(exports, "PluginDependencyCycleError", {
23279
23584
  enumerable: true,
23280
- get: function () { return chunkQJUJNTIU_cjs.PluginDependencyCycleError; }
23585
+ get: function () { return chunkA22RBHO7_cjs.PluginDependencyCycleError; }
23281
23586
  });
23282
23587
  Object.defineProperty(exports, "PluginManagerClass", {
23283
23588
  enumerable: true,
23284
- get: function () { return chunkQJUJNTIU_cjs.PluginManager; }
23589
+ get: function () { return chunkA22RBHO7_cjs.PluginManager; }
23285
23590
  });
23286
23591
  Object.defineProperty(exports, "PluginRegistryImpl", {
23287
23592
  enumerable: true,
23288
- get: function () { return chunkQJUJNTIU_cjs.PluginRegistryImpl; }
23593
+ get: function () { return chunkA22RBHO7_cjs.PluginRegistryImpl; }
23289
23594
  });
23290
23595
  Object.defineProperty(exports, "PluginValidatorClass", {
23291
23596
  enumerable: true,
23292
- get: function () { return chunkQJUJNTIU_cjs.PluginValidator; }
23597
+ get: function () { return chunkA22RBHO7_cjs.PluginValidator; }
23293
23598
  });
23294
23599
  Object.defineProperty(exports, "RegisterPluginsError", {
23295
23600
  enumerable: true,
23296
- get: function () { return chunkQJUJNTIU_cjs.RegisterPluginsError; }
23601
+ get: function () { return chunkA22RBHO7_cjs.RegisterPluginsError; }
23297
23602
  });
23298
23603
  Object.defineProperty(exports, "ScopedHookSystemClass", {
23299
23604
  enumerable: true,
23300
- get: function () { return chunkQJUJNTIU_cjs.ScopedHookSystem; }
23605
+ get: function () { return chunkA22RBHO7_cjs.ScopedHookSystem; }
23301
23606
  });
23302
23607
  Object.defineProperty(exports, "collectCronSchedules", {
23303
23608
  enumerable: true,
23304
- get: function () { return chunkQJUJNTIU_cjs.collectCronSchedules; }
23609
+ get: function () { return chunkA22RBHO7_cjs.collectCronSchedules; }
23305
23610
  });
23306
23611
  Object.defineProperty(exports, "collectCrons", {
23307
23612
  enumerable: true,
23308
- get: function () { return chunkQJUJNTIU_cjs.collectCrons; }
23613
+ get: function () { return chunkA22RBHO7_cjs.collectCrons; }
23309
23614
  });
23310
23615
  Object.defineProperty(exports, "createScheduledHandler", {
23311
23616
  enumerable: true,
23312
- get: function () { return chunkQJUJNTIU_cjs.createScheduledHandler; }
23617
+ get: function () { return chunkA22RBHO7_cjs.createScheduledHandler; }
23313
23618
  });
23314
23619
  Object.defineProperty(exports, "dispatchCronTick", {
23315
23620
  enumerable: true,
23316
- get: function () { return chunkQJUJNTIU_cjs.dispatchCronTick; }
23621
+ get: function () { return chunkA22RBHO7_cjs.dispatchCronTick; }
23317
23622
  });
23318
23623
  Object.defineProperty(exports, "registerPlugins", {
23319
23624
  enumerable: true,
23320
- get: function () { return chunkQJUJNTIU_cjs.registerPlugins; }
23625
+ get: function () { return chunkA22RBHO7_cjs.registerPlugins; }
23321
23626
  });
23322
23627
  Object.defineProperty(exports, "topoSort", {
23323
23628
  enumerable: true,
23324
- get: function () { return chunkQJUJNTIU_cjs.topoSort; }
23629
+ get: function () { return chunkA22RBHO7_cjs.topoSort; }
23325
23630
  });
23326
23631
  Object.defineProperty(exports, "applySchemaDefaults", {
23327
23632
  enumerable: true,
23328
- get: function () { return chunkBP52BFIV_cjs.applySchemaDefaults; }
23633
+ get: function () { return chunkKWQNB6UM_cjs.applySchemaDefaults; }
23329
23634
  });
23330
23635
  Object.defineProperty(exports, "definePlugin", {
23331
23636
  enumerable: true,
23332
- get: function () { return chunkBP52BFIV_cjs.definePlugin; }
23637
+ get: function () { return chunkKWQNB6UM_cjs.definePlugin; }
23333
23638
  });
23334
23639
  Object.defineProperty(exports, "getPluginMenu", {
23335
23640
  enumerable: true,
23336
- get: function () { return chunkBP52BFIV_cjs.getPluginMenu; }
23641
+ get: function () { return chunkKWQNB6UM_cjs.getPluginMenu; }
23337
23642
  });
23338
23643
  Object.defineProperty(exports, "isDefinedPlugin", {
23339
23644
  enumerable: true,
23340
- get: function () { return chunkBP52BFIV_cjs.isDefinedPlugin; }
23645
+ get: function () { return chunkKWQNB6UM_cjs.isDefinedPlugin; }
23341
23646
  });
23342
23647
  Object.defineProperty(exports, "parseConfigSchema", {
23343
23648
  enumerable: true,
23344
- get: function () { return chunkBP52BFIV_cjs.parseConfigSchema; }
23649
+ get: function () { return chunkKWQNB6UM_cjs.parseConfigSchema; }
23345
23650
  });
23346
23651
  Object.defineProperty(exports, "parseFormDataToSettings", {
23347
23652
  enumerable: true,
23348
- get: function () { return chunkBP52BFIV_cjs.parseFormDataToSettings; }
23653
+ get: function () { return chunkKWQNB6UM_cjs.parseFormDataToSettings; }
23349
23654
  });
23350
23655
  Object.defineProperty(exports, "renderSchemaFields", {
23351
23656
  enumerable: true,
23352
- get: function () { return chunkBP52BFIV_cjs.renderSchemaFields; }
23657
+ get: function () { return chunkKWQNB6UM_cjs.renderSchemaFields; }
23353
23658
  });
23354
23659
  Object.defineProperty(exports, "resetPluginMenu", {
23355
23660
  enumerable: true,
23356
- get: function () { return chunkBP52BFIV_cjs.resetPluginMenu; }
23661
+ get: function () { return chunkKWQNB6UM_cjs.resetPluginMenu; }
23357
23662
  });
23358
23663
  Object.defineProperty(exports, "resolvePluginMenuItems", {
23359
23664
  enumerable: true,
23360
- get: function () { return chunkBP52BFIV_cjs.resolvePluginMenuItems; }
23665
+ get: function () { return chunkKWQNB6UM_cjs.resolvePluginMenuItems; }
23361
23666
  });
23362
23667
  Object.defineProperty(exports, "setPluginMenu", {
23363
23668
  enumerable: true,
23364
- get: function () { return chunkBP52BFIV_cjs.setPluginMenu; }
23669
+ get: function () { return chunkKWQNB6UM_cjs.setPluginMenu; }
23365
23670
  });
23366
23671
  Object.defineProperty(exports, "getHookSystem", {
23367
23672
  enumerable: true,
@@ -23385,23 +23690,23 @@ Object.defineProperty(exports, "setHookSystem", {
23385
23690
  });
23386
23691
  Object.defineProperty(exports, "QueryFilterBuilder", {
23387
23692
  enumerable: true,
23388
- get: function () { return chunkIXUHXTHW_cjs.QueryFilterBuilder; }
23693
+ get: function () { return chunkSFGYZUWU_cjs.QueryFilterBuilder; }
23389
23694
  });
23390
23695
  Object.defineProperty(exports, "TemplateRenderer", {
23391
23696
  enumerable: true,
23392
- get: function () { return chunkIXUHXTHW_cjs.TemplateRenderer; }
23697
+ get: function () { return chunkSFGYZUWU_cjs.TemplateRenderer; }
23393
23698
  });
23394
23699
  Object.defineProperty(exports, "buildQuery", {
23395
23700
  enumerable: true,
23396
- get: function () { return chunkIXUHXTHW_cjs.buildQuery; }
23701
+ get: function () { return chunkSFGYZUWU_cjs.buildQuery; }
23397
23702
  });
23398
23703
  Object.defineProperty(exports, "renderTemplate", {
23399
23704
  enumerable: true,
23400
- get: function () { return chunkIXUHXTHW_cjs.renderTemplate; }
23705
+ get: function () { return chunkSFGYZUWU_cjs.renderTemplate; }
23401
23706
  });
23402
23707
  Object.defineProperty(exports, "templateRenderer", {
23403
23708
  enumerable: true,
23404
- get: function () { return chunkIXUHXTHW_cjs.templateRenderer; }
23709
+ get: function () { return chunkSFGYZUWU_cjs.templateRenderer; }
23405
23710
  });
23406
23711
  Object.defineProperty(exports, "metricsTracker", {
23407
23712
  enumerable: true,
@@ -23409,11 +23714,11 @@ Object.defineProperty(exports, "metricsTracker", {
23409
23714
  });
23410
23715
  Object.defineProperty(exports, "SONICJS_VERSION", {
23411
23716
  enumerable: true,
23412
- get: function () { return chunkKKNEYIZJ_cjs.SONICJS_VERSION; }
23717
+ get: function () { return chunkXZUEGFXE_cjs.SONICJS_VERSION; }
23413
23718
  });
23414
23719
  Object.defineProperty(exports, "getCoreVersion", {
23415
23720
  enumerable: true,
23416
- get: function () { return chunkKKNEYIZJ_cjs.getCoreVersion; }
23721
+ get: function () { return chunkXZUEGFXE_cjs.getCoreVersion; }
23417
23722
  });
23418
23723
  Object.defineProperty(exports, "escapeHtml", {
23419
23724
  enumerable: true,
@@ -23441,6 +23746,7 @@ exports.createMcpPlugin = createMcpPlugin;
23441
23746
  exports.createOAuthProvidersPlugin = createOAuthProvidersPlugin;
23442
23747
  exports.createRedirectPlugin = createRedirectPlugin;
23443
23748
  exports.createSonicJSApp = createSonicJSApp;
23749
+ exports.demoLoginPlugin = demoLoginPlugin;
23444
23750
  exports.emailReconciliationPlugin = emailReconciliationPlugin;
23445
23751
  exports.generateTriggersComment = generateTriggersComment;
23446
23752
  exports.helloWorldPlugin = helloWorldPlugin;