@object-ui/console 3.1.0 → 3.1.2

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 (166) hide show
  1. package/dist/assets/{AdvancedChartImpl-Q6xhwCd2.js → AdvancedChartImpl-D711bBuO.js} +1 -1
  2. package/dist/assets/{AppManagementPage-Bqi2RIF_.js → AppManagementPage-CaWUYaXX.js} +1 -1
  3. package/dist/assets/{AuditLogPage-Bhvo34U0.js → AuditLogPage-CB1qkThp.js} +1 -1
  4. package/dist/assets/AuthPageLayout-9l5xWV_-.js +1 -0
  5. package/dist/assets/{ChartImpl-SceZDRuZ.js → ChartImpl-B9B4Fnbe.js} +1 -1
  6. package/dist/assets/CreateAppPage-DLRU3TEg.js +1 -0
  7. package/dist/assets/DashboardDesignPage-DGz-5xrK.js +1 -0
  8. package/dist/assets/{DashboardView-DxpkEpzI.js → DashboardView-v834XbaQ.js} +1 -1
  9. package/dist/assets/{EditAppPage-4REKKtym.js → EditAppPage-DocDqKMS.js} +1 -1
  10. package/dist/assets/ForgotPasswordPage-8ypvh4-X.js +1 -0
  11. package/dist/assets/{KanbanEnhanced-Cy_rTBDD.js → KanbanEnhanced-Cw4oddBv.js} +1 -1
  12. package/dist/assets/{KanbanImpl-BNUeFn31.js → KanbanImpl-D6ggfmB0.js} +1 -1
  13. package/dist/assets/LoginPage-XakThPoT.js +1 -0
  14. package/dist/assets/{MarkdownImpl-DQVBgcsA.js → MarkdownImpl-C0wRapHT.js} +1 -1
  15. package/dist/assets/{OrgManagementPage-9aUMu-3n.js → OrgManagementPage-Df5167oO.js} +1 -1
  16. package/dist/assets/{PageDesignPage-bfUbiZI-.js → PageDesignPage-BzM4EsXt.js} +1 -1
  17. package/dist/assets/PageView-CpIQvLmr.js +2 -0
  18. package/dist/assets/{PermissionManagementPage-CfKXMrSe.js → PermissionManagementPage-CZH3URJU.js} +1 -1
  19. package/dist/assets/{ProfilePage-aGYrzo6-.js → ProfilePage-BvIbbebc.js} +1 -1
  20. package/dist/assets/RecordDetailView-BNnPf0DG.js +1 -0
  21. package/dist/assets/RegisterPage-CIeFN9rY.js +1 -0
  22. package/dist/assets/{ReportView-DYDYKXxz.js → ReportView-DYhXezmy.js} +1 -1
  23. package/dist/assets/{RoleManagementPage-DvuObd50.js → RoleManagementPage-D0X7HlqJ.js} +1 -1
  24. package/dist/assets/{SearchResultsPage-BXv9faGO.js → SearchResultsPage-CoMB32KW.js} +1 -1
  25. package/dist/assets/{SystemHubPage-DInbGUIC.js → SystemHubPage-Cvl3VKcV.js} +1 -1
  26. package/dist/assets/{UserManagementPage-DfN7rtzx.js → UserManagementPage-5k8BQxT1.js} +1 -1
  27. package/dist/assets/data-adapter-Bif-TtZA.js +1 -0
  28. package/dist/assets/framework-52FGgFF6.js +10 -0
  29. package/dist/assets/index-D5i0wk-G.js +1 -0
  30. package/dist/assets/index-fjkakZm9.js +9 -0
  31. package/dist/assets/index-h9Jznm67.css +1 -0
  32. package/dist/assets/infrastructure-Dn7jNPwf.js +1 -0
  33. package/dist/assets/{maplibre-gl-Hx2FX3ON.js → maplibre-gl-DVmJFhI2.js} +1 -1
  34. package/dist/assets/plugins-core-CP8uPw4p.js +8 -0
  35. package/dist/assets/plugins-views-DZCu8Ex3.js +62 -0
  36. package/dist/assets/ui-components-BE4yvyhE.js +36 -0
  37. package/dist/assets/ui-components-CxztIKgM.css +1 -0
  38. package/dist/assets/ui-layout-CYnH69Z2.js +1 -0
  39. package/dist/assets/{vendor-charts-BbkZFaMp.js → vendor-charts-BLNOCZWl.js} +1 -1
  40. package/dist/assets/{vendor-dndkit-D1_B-HIy.js → vendor-dndkit-CX1oDZqy.js} +1 -1
  41. package/dist/assets/{vendor-i18n-CikIh7Op.js → vendor-i18n-E3-WitRV.js} +1 -1
  42. package/dist/assets/{vendor-icons-CsQ20zph.js → vendor-icons-ndICq8DC.js} +2 -2
  43. package/dist/assets/vendor-objectstack-CatrkstC.js +34 -0
  44. package/dist/assets/{vendor-radix-CWYRmupg.js → vendor-radix-C6qchjxv.js} +1 -1
  45. package/dist/assets/{vendor-react-BEJ2LWyF.js → vendor-react-9M-xu2bR.js} +7 -7
  46. package/dist/assets/{vendor-ui-utils-tMfURc0Z.js → vendor-ui-utils-3tkeUVaX.js} +1 -1
  47. package/dist/assets/{vendor-zod-DxQVy2_o.js → vendor-zod-C5j6C2CQ.js} +1 -1
  48. package/dist/index.html +23 -23
  49. package/package.json +36 -36
  50. package/plugin.d.ts +1 -2
  51. package/plugin.js +1 -2
  52. package/plugin.ts +1 -2
  53. package/dist/assets/AdvancedChartImpl-Q6xhwCd2.js.br +0 -0
  54. package/dist/assets/AdvancedChartImpl-Q6xhwCd2.js.gz +0 -0
  55. package/dist/assets/AppManagementPage-Bqi2RIF_.js.br +0 -0
  56. package/dist/assets/AppManagementPage-Bqi2RIF_.js.gz +0 -0
  57. package/dist/assets/AuditLogPage-Bhvo34U0.js.br +0 -0
  58. package/dist/assets/AuditLogPage-Bhvo34U0.js.gz +0 -0
  59. package/dist/assets/ChartImpl-SceZDRuZ.js.br +0 -0
  60. package/dist/assets/ChartImpl-SceZDRuZ.js.gz +0 -0
  61. package/dist/assets/CreateAppPage-BBV1-x1E.js +0 -1
  62. package/dist/assets/CreateAppPage-BBV1-x1E.js.br +0 -0
  63. package/dist/assets/CreateAppPage-BBV1-x1E.js.gz +0 -0
  64. package/dist/assets/DashboardDesignPage-Dsve6QAo.js +0 -1
  65. package/dist/assets/DashboardDesignPage-Dsve6QAo.js.br +0 -0
  66. package/dist/assets/DashboardDesignPage-Dsve6QAo.js.gz +0 -0
  67. package/dist/assets/DashboardView-DxpkEpzI.js.br +0 -0
  68. package/dist/assets/DashboardView-DxpkEpzI.js.gz +0 -0
  69. package/dist/assets/EditAppPage-4REKKtym.js.br +0 -0
  70. package/dist/assets/EditAppPage-4REKKtym.js.gz +0 -0
  71. package/dist/assets/ForgotPasswordPage-_rDOa2Zl.js +0 -1
  72. package/dist/assets/KanbanEnhanced-Cy_rTBDD.js.br +0 -0
  73. package/dist/assets/KanbanEnhanced-Cy_rTBDD.js.gz +0 -0
  74. package/dist/assets/KanbanImpl-BNUeFn31.js.br +0 -0
  75. package/dist/assets/KanbanImpl-BNUeFn31.js.gz +0 -0
  76. package/dist/assets/LoginPage-BXP5VJhw.js +0 -1
  77. package/dist/assets/MarkdownImpl-DQVBgcsA.js.br +0 -0
  78. package/dist/assets/MarkdownImpl-DQVBgcsA.js.gz +0 -0
  79. package/dist/assets/OrgManagementPage-9aUMu-3n.js.br +0 -0
  80. package/dist/assets/OrgManagementPage-9aUMu-3n.js.gz +0 -0
  81. package/dist/assets/PageDesignPage-bfUbiZI-.js.br +0 -0
  82. package/dist/assets/PageDesignPage-bfUbiZI-.js.gz +0 -0
  83. package/dist/assets/PageView-BNyUOHBp.js +0 -2
  84. package/dist/assets/PageView-BNyUOHBp.js.br +0 -0
  85. package/dist/assets/PageView-BNyUOHBp.js.gz +0 -0
  86. package/dist/assets/PermissionManagementPage-CfKXMrSe.js.br +0 -0
  87. package/dist/assets/PermissionManagementPage-CfKXMrSe.js.gz +0 -0
  88. package/dist/assets/ProfilePage-aGYrzo6-.js.br +0 -0
  89. package/dist/assets/ProfilePage-aGYrzo6-.js.gz +0 -0
  90. package/dist/assets/RecordDetailView-Cbo06TgT.js +0 -1
  91. package/dist/assets/RecordDetailView-Cbo06TgT.js.br +0 -0
  92. package/dist/assets/RecordDetailView-Cbo06TgT.js.gz +0 -0
  93. package/dist/assets/RegisterPage-By5Xlwoy.js +0 -1
  94. package/dist/assets/ReportView-DYDYKXxz.js.br +0 -0
  95. package/dist/assets/ReportView-DYDYKXxz.js.gz +0 -0
  96. package/dist/assets/RoleManagementPage-DvuObd50.js.br +0 -0
  97. package/dist/assets/RoleManagementPage-DvuObd50.js.gz +0 -0
  98. package/dist/assets/SearchResultsPage-BXv9faGO.js.br +0 -0
  99. package/dist/assets/SearchResultsPage-BXv9faGO.js.gz +0 -0
  100. package/dist/assets/SystemHubPage-DInbGUIC.js.br +0 -0
  101. package/dist/assets/SystemHubPage-DInbGUIC.js.gz +0 -0
  102. package/dist/assets/UserManagementPage-DfN7rtzx.js.br +0 -0
  103. package/dist/assets/UserManagementPage-DfN7rtzx.js.gz +0 -0
  104. package/dist/assets/data-adapter-Cnk_Mp2r.js +0 -1
  105. package/dist/assets/data-adapter-Cnk_Mp2r.js.br +0 -0
  106. package/dist/assets/data-adapter-Cnk_Mp2r.js.gz +0 -0
  107. package/dist/assets/framework-0M39ZRTM.js +0 -10
  108. package/dist/assets/framework-0M39ZRTM.js.br +0 -0
  109. package/dist/assets/framework-0M39ZRTM.js.gz +0 -0
  110. package/dist/assets/index-B5fEfHjB.css +0 -1
  111. package/dist/assets/index-B5fEfHjB.css.br +0 -0
  112. package/dist/assets/index-B5fEfHjB.css.gz +0 -0
  113. package/dist/assets/index-BlrxLcAr.js +0 -1
  114. package/dist/assets/index-BlrxLcAr.js.br +0 -0
  115. package/dist/assets/index-BlrxLcAr.js.gz +0 -0
  116. package/dist/assets/index-o38_J709.js +0 -9
  117. package/dist/assets/index-o38_J709.js.br +0 -0
  118. package/dist/assets/index-o38_J709.js.gz +0 -0
  119. package/dist/assets/infrastructure-CShH4S9_.js +0 -1
  120. package/dist/assets/infrastructure-CShH4S9_.js.br +0 -0
  121. package/dist/assets/infrastructure-CShH4S9_.js.gz +0 -0
  122. package/dist/assets/maplibre-gl-Hx2FX3ON.js.br +0 -0
  123. package/dist/assets/maplibre-gl-Hx2FX3ON.js.gz +0 -0
  124. package/dist/assets/plugins-core-DBl14Uqc.js +0 -8
  125. package/dist/assets/plugins-core-DBl14Uqc.js.br +0 -0
  126. package/dist/assets/plugins-core-DBl14Uqc.js.gz +0 -0
  127. package/dist/assets/plugins-views-P3eB-els.css.br +0 -0
  128. package/dist/assets/plugins-views-P3eB-els.css.gz +0 -0
  129. package/dist/assets/plugins-views-g4Cu3W3w.js +0 -62
  130. package/dist/assets/plugins-views-g4Cu3W3w.js.br +0 -0
  131. package/dist/assets/plugins-views-g4Cu3W3w.js.gz +0 -0
  132. package/dist/assets/systemObjects-DSpePIIy.js.br +0 -2
  133. package/dist/assets/systemObjects-DSpePIIy.js.gz +0 -0
  134. package/dist/assets/ui-components-BuNW5g1I.js +0 -36
  135. package/dist/assets/ui-components-BuNW5g1I.js.br +0 -0
  136. package/dist/assets/ui-components-BuNW5g1I.js.gz +0 -0
  137. package/dist/assets/ui-components-D5YXsttd.css +0 -1
  138. package/dist/assets/ui-components-D5YXsttd.css.br +0 -0
  139. package/dist/assets/ui-components-D5YXsttd.css.gz +0 -0
  140. package/dist/assets/ui-layout-BSKYz8QD.js +0 -1
  141. package/dist/assets/ui-layout-BSKYz8QD.js.br +0 -0
  142. package/dist/assets/ui-layout-BSKYz8QD.js.gz +0 -0
  143. package/dist/assets/vendor-charts-BbkZFaMp.js.br +0 -0
  144. package/dist/assets/vendor-charts-BbkZFaMp.js.gz +0 -0
  145. package/dist/assets/vendor-dndkit-D1_B-HIy.js.br +0 -0
  146. package/dist/assets/vendor-dndkit-D1_B-HIy.js.gz +0 -0
  147. package/dist/assets/vendor-i18n-CikIh7Op.js.br +0 -0
  148. package/dist/assets/vendor-i18n-CikIh7Op.js.gz +0 -0
  149. package/dist/assets/vendor-icons-CsQ20zph.js.br +0 -0
  150. package/dist/assets/vendor-icons-CsQ20zph.js.gz +0 -0
  151. package/dist/assets/vendor-objectstack-aMKO1xRi.js +0 -34
  152. package/dist/assets/vendor-objectstack-aMKO1xRi.js.br +0 -0
  153. package/dist/assets/vendor-objectstack-aMKO1xRi.js.gz +0 -0
  154. package/dist/assets/vendor-radix-CWYRmupg.js.br +0 -0
  155. package/dist/assets/vendor-radix-CWYRmupg.js.gz +0 -0
  156. package/dist/assets/vendor-react-BEJ2LWyF.js.br +0 -0
  157. package/dist/assets/vendor-react-BEJ2LWyF.js.gz +0 -0
  158. package/dist/assets/vendor-ui-utils-tMfURc0Z.js.br +0 -0
  159. package/dist/assets/vendor-ui-utils-tMfURc0Z.js.gz +0 -0
  160. package/dist/assets/vendor-zod-DxQVy2_o.js.br +0 -0
  161. package/dist/assets/vendor-zod-DxQVy2_o.js.gz +0 -0
  162. package/dist/index.html.br +0 -0
  163. package/dist/index.html.gz +0 -0
  164. package/dist/mockServiceWorker.js.br +0 -0
  165. package/dist/mockServiceWorker.js.gz +0 -0
  166. package/dist/stats.html +0 -4950
package/dist/index.html CHANGED
@@ -19,30 +19,30 @@
19
19
  <script>
20
20
  window.process = window.process || { env: { NODE_ENV: 'development' }, version: '', platform: 'browser' };
21
21
  </script>
22
- <script type="module" crossorigin src="/console/assets/index-o38_J709.js"></script>
23
- <link rel="modulepreload" crossorigin href="/console/assets/vendor-react-BEJ2LWyF.js">
24
- <link rel="modulepreload" crossorigin href="/console/assets/vendor-zod-DxQVy2_o.js">
25
- <link rel="modulepreload" crossorigin href="/console/assets/vendor-objectstack-aMKO1xRi.js">
26
- <link rel="modulepreload" crossorigin href="/console/assets/framework-0M39ZRTM.js">
27
- <link rel="modulepreload" crossorigin href="/console/assets/vendor-ui-utils-tMfURc0Z.js">
28
- <link rel="modulepreload" crossorigin href="/console/assets/vendor-icons-CsQ20zph.js">
29
- <link rel="modulepreload" crossorigin href="/console/assets/vendor-i18n-CikIh7Op.js">
30
- <link rel="modulepreload" crossorigin href="/console/assets/vendor-radix-CWYRmupg.js">
31
- <link rel="modulepreload" crossorigin href="/console/assets/vendor-charts-BbkZFaMp.js">
32
- <link rel="modulepreload" crossorigin href="/console/assets/infrastructure-CShH4S9_.js">
33
- <link rel="modulepreload" crossorigin href="/console/assets/ui-components-BuNW5g1I.js">
34
- <link rel="modulepreload" crossorigin href="/console/assets/vendor-dndkit-D1_B-HIy.js">
35
- <link rel="modulepreload" crossorigin href="/console/assets/plugins-views-g4Cu3W3w.js">
36
- <link rel="modulepreload" crossorigin href="/console/assets/plugins-core-DBl14Uqc.js">
37
- <link rel="modulepreload" crossorigin href="/console/assets/data-adapter-Cnk_Mp2r.js">
38
- <link rel="modulepreload" crossorigin href="/console/assets/ui-layout-BSKYz8QD.js">
39
- <link rel="stylesheet" crossorigin href="/console/assets/ui-components-D5YXsttd.css">
22
+ <script type="module" crossorigin src="/console/assets/index-fjkakZm9.js"></script>
23
+ <link rel="modulepreload" crossorigin href="/console/assets/vendor-react-9M-xu2bR.js">
24
+ <link rel="modulepreload" crossorigin href="/console/assets/vendor-zod-C5j6C2CQ.js">
25
+ <link rel="modulepreload" crossorigin href="/console/assets/vendor-objectstack-CatrkstC.js">
26
+ <link rel="modulepreload" crossorigin href="/console/assets/framework-52FGgFF6.js">
27
+ <link rel="modulepreload" crossorigin href="/console/assets/vendor-ui-utils-3tkeUVaX.js">
28
+ <link rel="modulepreload" crossorigin href="/console/assets/vendor-icons-ndICq8DC.js">
29
+ <link rel="modulepreload" crossorigin href="/console/assets/vendor-i18n-E3-WitRV.js">
30
+ <link rel="modulepreload" crossorigin href="/console/assets/vendor-radix-C6qchjxv.js">
31
+ <link rel="modulepreload" crossorigin href="/console/assets/vendor-charts-BLNOCZWl.js">
32
+ <link rel="modulepreload" crossorigin href="/console/assets/infrastructure-Dn7jNPwf.js">
33
+ <link rel="modulepreload" crossorigin href="/console/assets/ui-components-BE4yvyhE.js">
34
+ <link rel="modulepreload" crossorigin href="/console/assets/vendor-dndkit-CX1oDZqy.js">
35
+ <link rel="modulepreload" crossorigin href="/console/assets/plugins-views-DZCu8Ex3.js">
36
+ <link rel="modulepreload" crossorigin href="/console/assets/plugins-core-CP8uPw4p.js">
37
+ <link rel="modulepreload" crossorigin href="/console/assets/data-adapter-Bif-TtZA.js">
38
+ <link rel="modulepreload" crossorigin href="/console/assets/ui-layout-CYnH69Z2.js">
39
+ <link rel="stylesheet" crossorigin href="/console/assets/ui-components-CxztIKgM.css">
40
40
  <link rel="stylesheet" crossorigin href="/console/assets/plugins-views-P3eB-els.css">
41
- <link rel="stylesheet" crossorigin href="/console/assets/index-B5fEfHjB.css">
42
- <link rel="modulepreload" href="/console/assets/vendor-react-BEJ2LWyF.js" />
43
- <link rel="modulepreload" href="/console/assets/framework-0M39ZRTM.js" />
44
- <link rel="modulepreload" href="/console/assets/ui-components-BuNW5g1I.js" />
45
- <link rel="modulepreload" href="/console/assets/vendor-radix-CWYRmupg.js" />
41
+ <link rel="stylesheet" crossorigin href="/console/assets/index-h9Jznm67.css">
42
+ <link rel="modulepreload" href="/console/assets/vendor-react-9M-xu2bR.js" />
43
+ <link rel="modulepreload" href="/console/assets/framework-52FGgFF6.js" />
44
+ <link rel="modulepreload" href="/console/assets/ui-components-BE4yvyhE.js" />
45
+ <link rel="modulepreload" href="/console/assets/vendor-radix-C6qchjxv.js" />
46
46
  </head>
47
47
  <body>
48
48
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/console",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "ObjectStack Console - The standard runtime UI for ObjectStack applications",
5
5
  "type": "module",
6
6
  "main": "./plugin.js",
@@ -22,13 +22,13 @@
22
22
  "@dnd-kit/core": "^6.3.1",
23
23
  "@dnd-kit/sortable": "^10.0.0",
24
24
  "@dnd-kit/utilities": "^3.2.2",
25
- "@objectstack/cli": "^3.2.0",
26
- "@objectstack/client": "^3.2.0",
27
- "@objectstack/driver-memory": "^3.2.0",
28
- "@objectstack/objectql": "^3.2.0",
29
- "@objectstack/plugin-msw": "^3.2.0",
30
- "@objectstack/runtime": "^3.2.0",
31
- "@objectstack/spec": "^3.2.0",
25
+ "@objectstack/cli": "^3.2.1",
26
+ "@objectstack/client": "^3.2.1",
27
+ "@objectstack/driver-memory": "^3.2.1",
28
+ "@objectstack/objectql": "^3.2.1",
29
+ "@objectstack/plugin-msw": "^3.2.1",
30
+ "@objectstack/runtime": "^3.2.1",
31
+ "@objectstack/spec": "^3.2.1",
32
32
  "@tailwindcss/postcss": "^4.2.1",
33
33
  "@testing-library/jest-dom": "^6.9.1",
34
34
  "@testing-library/react": "^16.3.2",
@@ -51,36 +51,36 @@
51
51
  "typescript": "^5.9.3",
52
52
  "vite": "^6.4.1",
53
53
  "vitest": "^4.0.18",
54
- "@object-ui/auth": "3.1.0",
55
- "@object-ui/collaboration": "3.1.0",
56
- "@object-ui/components": "3.1.0",
57
- "@object-ui/core": "3.1.0",
58
- "@object-ui/data-objectstack": "3.1.0",
59
- "@object-ui/example-crm": "3.1.0",
54
+ "@object-ui/collaboration": "3.1.2",
55
+ "@object-ui/auth": "3.1.2",
56
+ "@object-ui/components": "3.1.2",
57
+ "@object-ui/core": "3.1.2",
58
+ "@object-ui/data-objectstack": "3.1.2",
60
59
  "@object-ui/example-kitchen-sink": "3.1.0",
61
60
  "@object-ui/example-todo": "3.1.0",
62
- "@object-ui/fields": "3.1.0",
63
- "@object-ui/i18n": "3.1.0",
64
- "@object-ui/layout": "3.1.0",
65
- "@object-ui/mobile": "3.1.0",
66
- "@object-ui/permissions": "3.1.0",
67
- "@object-ui/plugin-calendar": "3.1.0",
68
- "@object-ui/plugin-charts": "3.1.0",
69
- "@object-ui/plugin-dashboard": "3.1.0",
70
- "@object-ui/plugin-designer": "3.1.0",
71
- "@object-ui/plugin-detail": "3.1.0",
72
- "@object-ui/plugin-form": "3.1.0",
73
- "@object-ui/plugin-gantt": "3.1.0",
74
- "@object-ui/plugin-grid": "3.1.0",
75
- "@object-ui/plugin-kanban": "3.1.0",
76
- "@object-ui/plugin-list": "3.1.0",
77
- "@object-ui/plugin-map": "3.1.0",
78
- "@object-ui/plugin-markdown": "3.1.0",
79
- "@object-ui/plugin-report": "3.1.0",
80
- "@object-ui/plugin-timeline": "3.1.0",
81
- "@object-ui/plugin-view": "3.1.0",
82
- "@object-ui/react": "3.1.0",
83
- "@object-ui/types": "3.1.0"
61
+ "@object-ui/example-crm": "3.1.0",
62
+ "@object-ui/fields": "3.1.2",
63
+ "@object-ui/i18n": "3.1.2",
64
+ "@object-ui/mobile": "3.1.2",
65
+ "@object-ui/layout": "3.1.2",
66
+ "@object-ui/permissions": "3.1.2",
67
+ "@object-ui/plugin-calendar": "3.1.2",
68
+ "@object-ui/plugin-charts": "3.1.2",
69
+ "@object-ui/plugin-dashboard": "3.1.2",
70
+ "@object-ui/plugin-designer": "3.1.2",
71
+ "@object-ui/plugin-detail": "3.1.2",
72
+ "@object-ui/plugin-form": "3.1.2",
73
+ "@object-ui/plugin-gantt": "3.1.2",
74
+ "@object-ui/plugin-grid": "3.1.2",
75
+ "@object-ui/plugin-kanban": "3.1.2",
76
+ "@object-ui/plugin-list": "3.1.2",
77
+ "@object-ui/plugin-map": "3.1.2",
78
+ "@object-ui/plugin-markdown": "3.1.2",
79
+ "@object-ui/plugin-report": "3.1.2",
80
+ "@object-ui/plugin-timeline": "3.1.2",
81
+ "@object-ui/plugin-view": "3.1.2",
82
+ "@object-ui/react": "3.1.2",
83
+ "@object-ui/types": "3.1.2"
84
84
  },
85
85
  "msw": {
86
86
  "workerDirectory": [
package/plugin.d.ts CHANGED
@@ -5,8 +5,7 @@
5
5
  * HonoServerPlugin auto-discovers this plugin via `type: 'ui-plugin'`
6
6
  * and mounts it at `/<slug>` (i.e. `/console`).
7
7
  *
8
- * The SPA must be built with the matching base path:
9
- * VITE_BASE_PATH=/console/ pnpm build
8
+ * The SPA is built with base path '/'.
10
9
  *
11
10
  * Usage in any ObjectStack application:
12
11
  *
package/plugin.js CHANGED
@@ -5,8 +5,7 @@
5
5
  * HonoServerPlugin auto-discovers this plugin via `type: 'ui-plugin'`
6
6
  * and mounts it at `/<slug>` (i.e. `/console`).
7
7
  *
8
- * The SPA must be built with the matching base path:
9
- * VITE_BASE_PATH=/console/ pnpm build
8
+ * The SPA is built with base path '/'.
10
9
  *
11
10
  * Usage in any ObjectStack application:
12
11
  *
package/plugin.ts CHANGED
@@ -5,8 +5,7 @@
5
5
  * HonoServerPlugin auto-discovers this plugin via `type: 'ui-plugin'`
6
6
  * and mounts it at `/<slug>` (i.e. `/console`).
7
7
  *
8
- * The SPA must be built with the matching base path:
9
- * VITE_BASE_PATH=/console/ pnpm build
8
+ * The SPA is built with base path '/'.
10
9
  *
11
10
  * Usage in any ObjectStack application:
12
11
  *
@@ -1 +0,0 @@
1
- import{f as C,h as v,r as e,j as n}from"./vendor-react-BEJ2LWyF.js";import{AppCreationWizard as x}from"./index-BlrxLcAr.js";import{z as S}from"./framework-0M39ZRTM.js";import"./vendor-objectstack-aMKO1xRi.js";import{b,a as y}from"./index-o38_J709.js";import{b as s}from"./vendor-ui-utils-tMfURc0Z.js";import"./vendor-icons-CsQ20zph.js";import"./vendor-zod-DxQVy2_o.js";import"./ui-components-BuNW5g1I.js";import"./vendor-radix-CWYRmupg.js";import"./vendor-i18n-CikIh7Op.js";import"./vendor-charts-BbkZFaMp.js";import"./infrastructure-CShH4S9_.js";import"./plugins-core-DBl14Uqc.js";import"./vendor-dndkit-D1_B-HIy.js";import"./plugins-views-g4Cu3W3w.js";import"./data-adapter-Cnk_Mp2r.js";import"./ui-layout-BSKYz8QD.js";const p="objectui-app-wizard-draft";function K(){const t=C(),{appName:r}=v(),{objects:l,refresh:i}=b(),c=y(),f=(l||[]).map(a=>({name:a.name,label:a.label||a.name,icon:a.icon,selected:!1})),u=e.useCallback(()=>{try{const a=localStorage.getItem(p);if(a)return JSON.parse(a)}catch{}},[]),d=e.useCallback(async a=>{try{const o=S(a),m=c?.getClient();m&&await m.meta.saveItem("app",a.name,o),localStorage.removeItem(p),s.success(`Application "${a.title}" created successfully`),await i?.(),t(`/apps/${a.name}`)}catch(o){s.error(o?.message||"Failed to create application")}},[t,i,c]),g=e.useCallback(()=>{t(r?`/apps/${r}`:"/")},[t,r]),h=e.useCallback(a=>{try{localStorage.setItem(p,JSON.stringify(a)),s.info("Draft saved")}catch{}},[]);return n.jsx("div",{className:"mx-auto max-w-4xl py-8 px-4","data-testid":"create-app-page",children:n.jsx(x,{availableObjects:f,initialDraft:u(),onComplete:d,onCancel:g,onSaveDraft:h})})}export{K as CreateAppPage};
@@ -1 +0,0 @@
1
- import{f as j,h as v,r as s,j as a}from"./vendor-react-BEJ2LWyF.js";import{DashboardEditor as w}from"./index-BlrxLcAr.js";import{b as h}from"./vendor-ui-utils-tMfURc0Z.js";import{a as k,b as D}from"./index-o38_J709.js";import{A as E}from"./vendor-icons-CsQ20zph.js";import"./framework-0M39ZRTM.js";import"./vendor-objectstack-aMKO1xRi.js";import"./vendor-zod-DxQVy2_o.js";import"./ui-components-BuNW5g1I.js";import"./vendor-radix-CWYRmupg.js";import"./vendor-i18n-CikIh7Op.js";import"./vendor-charts-BbkZFaMp.js";import"./infrastructure-CShH4S9_.js";import"./plugins-core-DBl14Uqc.js";import"./vendor-dndkit-D1_B-HIy.js";import"./plugins-views-g4Cu3W3w.js";import"./data-adapter-Cnk_Mp2r.js";import"./ui-layout-BSKYz8QD.js";function z(){const f=j(),{dashboardName:t}=v(),d=k(),{dashboards:b,refresh:u}=D(),o=b?.find(e=>e.name===t),[i,x]=s.useState(()=>o||{type:"dashboard",name:t??"",title:t??"",columns:2,widgets:[]}),p=s.useRef(i);p.current=i;const n=s.useCallback(async e=>{try{if(d)return await d.update("sys_dashboard",t,e),u().catch(()=>{}),!0}catch{}return!1},[d,t,u]),l=s.useCallback(async e=>{x(e),await n(e)},[n]);s.useEffect(()=>{const e=r=>{(r.ctrlKey||r.metaKey)&&r.key==="s"&&(r.preventDefault(),n(p.current).then(c=>{c&&h.success("Dashboard saved")}))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[n]);const g=s.useCallback(e=>{const r=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),c=URL.createObjectURL(r),m=document.createElement("a");m.href=c,m.download=`${t||"dashboard"}.json`,m.click(),URL.revokeObjectURL(c),h.success("Dashboard schema exported")},[t]),y=s.useCallback(e=>{h.success("Dashboard schema imported"),l(e)},[l]);return o?a.jsxs("div",{className:"h-full flex flex-col","data-testid":"dashboard-design-page",children:[a.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-3 sm:px-6",children:[a.jsx("button",{type:"button",onClick:()=>f(-1),className:"rounded p-1.5 text-muted-foreground hover:text-foreground","aria-label":"Go back","data-testid":"dashboard-design-back",children:a.jsx(E,{className:"h-4 w-4"})}),a.jsxs("h1",{className:"text-lg font-semibold tracking-tight truncate",children:["Edit Dashboard: ",o.label||o.title||t]})]}),a.jsx("div",{className:"flex-1 overflow-auto p-4 sm:p-6",children:a.jsx(w,{schema:i,onChange:l,onExport:g,onImport:y})})]}):a.jsxs("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:['Dashboard "',t,'" not found']})}export{z as DashboardDesignPage};
@@ -1 +0,0 @@
1
- import{j as r}from"./vendor-react-BEJ2LWyF.js";import{F as o}from"./infrastructure-CShH4S9_.js";import"./vendor-i18n-CikIh7Op.js";function i(){return r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background px-4 py-8",children:r.jsx(o,{loginUrl:"/login"})})}export{i as ForgotPasswordPage};
@@ -1 +0,0 @@
1
- import{f as s,j as r}from"./vendor-react-BEJ2LWyF.js";import{L as o}from"./infrastructure-CShH4S9_.js";import"./vendor-i18n-CikIh7Op.js";function a(){const e=s();return r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background px-4 py-8",children:r.jsx(o,{onSuccess:()=>e("/"),registerUrl:"/register",forgotPasswordUrl:"/forgot-password"})})}export{a as LoginPage};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BlrxLcAr.js","assets/framework-0M39ZRTM.js","assets/vendor-react-BEJ2LWyF.js","assets/vendor-objectstack-aMKO1xRi.js","assets/vendor-zod-DxQVy2_o.js","assets/ui-components-BuNW5g1I.js","assets/vendor-ui-utils-tMfURc0Z.js","assets/vendor-icons-CsQ20zph.js","assets/vendor-radix-CWYRmupg.js","assets/vendor-i18n-CikIh7Op.js","assets/vendor-charts-BbkZFaMp.js","assets/infrastructure-CShH4S9_.js","assets/ui-components-D5YXsttd.css"])))=>i.map(i=>d[i]);
2
- import{S as w,h as v,i as j,j as b,k as y,b7 as S,b8 as E,b9 as N,ap as k}from"./ui-components-BuNW5g1I.js";import{r,j as e,h as D,i as P}from"./vendor-react-BEJ2LWyF.js";import{S as C}from"./framework-0M39ZRTM.js";import{b as _}from"./vendor-ui-utils-tMfURc0Z.js";import{a as O,u as R,b as T,M as L}from"./index-o38_J709.js";import{ak as M,at as $}from"./vendor-icons-CsQ20zph.js";import"./vendor-radix-CWYRmupg.js";import"./vendor-i18n-CikIh7Op.js";import"./vendor-charts-BbkZFaMp.js";import"./infrastructure-CShH4S9_.js";import"./vendor-objectstack-aMKO1xRi.js";import"./vendor-zod-DxQVy2_o.js";import"./plugins-core-DBl14Uqc.js";import"./vendor-dndkit-D1_B-HIy.js";import"./plugins-views-g4Cu3W3w.js";import"./data-adapter-Cnk_Mp2r.js";import"./ui-layout-BSKYz8QD.js";function A({open:a,onOpenChange:x,title:o,description:m,schema:i,onSchemaChange:p,collection:s,recordName:l,children:h}){const u=O(),f=r.useRef(i);f.current=i;const c=r.useCallback(async t=>{try{if(u)return await u.update(s,l,t),!0}catch(n){console.warn("[DesignDrawer] Auto-save failed:",n)}return!1},[u,s,l]),d=r.useCallback(async t=>{p(t),await c(t)},[p,c]);return r.useEffect(()=>{if(!a)return;const t=n=>{(n.ctrlKey||n.metaKey)&&n.key==="s"&&(n.preventDefault(),c(f.current).then(g=>{g&&_.success(`${o} saved`)}))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[a,c,o]),e.jsx(w,{open:a,onOpenChange:x,modal:!1,children:e.jsxs(v,{side:"right",hideOverlay:!0,className:"w-full sm:w-[540px] sm:max-w-[540px] lg:w-[640px] lg:max-w-[640px] p-0 flex flex-col","data-testid":"design-drawer",children:[e.jsxs(j,{className:"px-4 py-3 border-b shrink-0",children:[e.jsx(b,{children:o}),e.jsx(y,{className:m?"":"sr-only",children:m||`Visual editor — configure and preview ${o}`})]}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:h(i,d)})]})})}const I=r.lazy(()=>k(()=>import("./index-BlrxLcAr.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(a=>({default:a.PageCanvasEditor})));function ae(){const{pageName:a}=D(),[x]=P(),{showDebug:o}=R(),[m,i]=r.useState(!1),{pages:p}=T(),s=p?.find(t=>t.name===a),[l,h]=r.useState(null),u=r.useCallback(()=>{h(s),i(!0)},[s]),f=r.useCallback(t=>{i(t)},[]);if(!s)return e.jsx("div",{className:"h-full flex items-center justify-center p-8",children:e.jsxs(S,{children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:e.jsx(M,{className:"h-6 w-6 text-muted-foreground"})}),e.jsx(E,{children:"Page Not Found"}),e.jsxs(N,{children:['The page "',a,'" could not be found. It may have been removed or renamed.']})]})});const c=Object.fromEntries(x.entries()),d=m&&l?l:s;return e.jsxs("div",{className:"flex flex-row h-full w-full overflow-hidden relative",children:[e.jsxs("div",{className:"flex-1 overflow-auto h-full relative group",children:[e.jsx("div",{className:`absolute top-1.5 sm:top-2 right-1.5 sm:right-2 z-50 flex items-center gap-1.5 transition-opacity ${o?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:e.jsxs("button",{type:"button",onClick:u,className:"inline-flex items-center gap-1.5 rounded-md border border-input bg-background px-2.5 py-1.5 text-xs font-medium text-muted-foreground shadow-sm hover:bg-accent hover:text-accent-foreground","data-testid":"page-edit-button",children:[e.jsx($,{className:"h-3.5 w-3.5"}),"Edit"]})}),e.jsx(C,{schema:{...d,type:d.type||"page",context:{...d.context,params:c}}})]}),e.jsx(L,{open:o,sections:[{title:"Page Configuration",data:d}]}),e.jsx(A,{open:m,onOpenChange:f,title:`Edit Page: ${s.label||s.title||a}`,schema:l||s,onSchemaChange:h,collection:"sys_page",recordName:a,children:(t,n)=>e.jsx(r.Suspense,{fallback:e.jsx("div",{className:"p-4 text-muted-foreground",children:"Loading editor…"}),children:e.jsx(I,{schema:t,onChange:n})})})]})}export{ae as PageView};
Binary file
Binary file
@@ -1 +0,0 @@
1
- import{j as e,h as V,r as u}from"./vendor-react-BEJ2LWyF.js";import{D as F,R as P}from"./plugins-views-g4Cu3W3w.js";import{p as o,b7 as L,b8 as M,b9 as T}from"./ui-components-BuNW5g1I.js";import"./framework-0M39ZRTM.js";import"./vendor-ui-utils-tMfURc0Z.js";import{u as q,P as B,M as z}from"./index-o38_J709.js";import{c as S}from"./infrastructure-CShH4S9_.js";import{aQ as H,b4 as K}from"./vendor-icons-CsQ20zph.js";import"./vendor-charts-BbkZFaMp.js";import"./vendor-i18n-CikIh7Op.js";import"./vendor-radix-CWYRmupg.js";import"./vendor-objectstack-aMKO1xRi.js";import"./vendor-zod-DxQVy2_o.js";import"./plugins-core-DBl14Uqc.js";import"./vendor-dndkit-D1_B-HIy.js";import"./data-adapter-Cnk_Mp2r.js";import"./ui-layout-BSKYz8QD.js";function Q({fields:n=8,columns:j=2}){return e.jsxs("div",{className:"w-full space-y-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(o,{className:"h-8 w-8 rounded"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{className:"h-6 w-48"}),e.jsx(o,{className:"h-4 w-32"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(o,{className:"h-9 w-20"}),e.jsx(o,{className:"h-9 w-20"})]})]}),e.jsx(o,{className:"h-5 w-24"}),e.jsx("div",{className:`grid grid-cols-1 ${j===2?"md:grid-cols-2":""} gap-4`,children:Array.from({length:n}).map((y,c)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(o,{className:"h-4 w-24"}),e.jsx(o,{className:"h-9 w-full"})]},`field-${c}`))}),e.jsxs("div",{className:"space-y-3 pt-4 border-t",children:[e.jsx(o,{className:"h-5 w-32"}),e.jsx("div",{className:"space-y-2",children:Array.from({length:3}).map((y,c)=>e.jsxs("div",{className:"flex items-center gap-3 py-2",children:[e.jsx(o,{className:"h-8 w-8 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(o,{className:"h-4 w-40"}),e.jsx(o,{className:"h-3 w-24"})]})]},`related-${c}`))})]})]})}const G={id:"current-user",name:"Demo User"};function fe({dataSource:n,objects:j,onEdit:y}){const{objectName:c,recordId:g}=V(),{showDebug:_}=q(),{user:h}=S(),[I,v]=u.useState(!0),[D,x]=u.useState([]),[w,$]=u.useState([]),l=j.find(s=>s.name===c),d=g,i=h?{id:h.id,name:h.name,avatar:h.image}:G;u.useEffect(()=>{if(!n||!c||!d)return;const s=`${c}:${d}`;n.find("sys_presence",{$filter:`recordId eq '${d}'`}).then(t=>{t.data?.length&&$(t.data)}).catch(()=>{}),n.find("sys_comment",{$filter:`threadId eq '${s}'`,$orderby:"createdAt asc"}).then(t=>{t.data?.length&&x(t.data.map(a=>({id:a.id,type:"comment",actor:a.author?.name??"Unknown",actorAvatarUrl:a.author?.avatar,body:a.content,createdAt:a.createdAt,updatedAt:a.updatedAt,parentId:a.parentId,reactions:a.reactions?Object.entries(a.reactions).map(([r,m])=>({emoji:r,count:m.length,reacted:m.includes(i.id)})):void 0})))}).catch(()=>{})},[n,c,d,i]);const R=u.useCallback(async s=>{const t={id:crypto.randomUUID(),type:"comment",actor:i.name,actorAvatarUrl:"avatar"in i?i.avatar:void 0,body:s,createdAt:new Date().toISOString()};if(x(a=>[...a,t]),n){const a=`${c}:${d}`;n.create("sys_comment",{id:t.id,threadId:a,author:i,content:s,mentions:[],createdAt:t.createdAt}).catch(()=>{})}},[i,n,c,d]),C=u.useCallback(async(s,t)=>{const a={id:crypto.randomUUID(),type:"comment",actor:i.name,actorAvatarUrl:"avatar"in i?i.avatar:void 0,body:t,createdAt:new Date().toISOString(),parentId:s};if(x(r=>[...r,a].map(f=>f.id===s?{...f,replyCount:(f.replyCount??0)+1}:f)),n){const r=`${c}:${d}`;n.create("sys_comment",{id:a.id,threadId:r,author:i,content:t,mentions:[],createdAt:a.createdAt,parentId:s}).catch(()=>{})}},[i,n,c,d]),U=u.useCallback((s,t)=>{x(a=>a.map(r=>{if(r.id!==s)return r;const m=[...r.reactions??[]],f=m.findIndex(p=>p.emoji===t);if(f>=0){const p=m[f];p.reacted?p.count<=1?m.splice(f,1):m[f]={...p,count:p.count-1,reacted:!1}:m[f]={...p,count:p.count+1,reacted:!0}}else m.push({emoji:t,count:1,reacted:!0});const O={...r,reactions:m};return n&&n.update("sys_comment",String(s),{$toggleReaction:{emoji:t,userId:i.id}}).catch(()=>{}),O}))},[i.id,n]);if(u.useEffect(()=>{v(!0),queueMicrotask(()=>v(!1))},[c,g]),I)return e.jsx(Q,{});if(!l)return e.jsx("div",{className:"flex h-full items-center justify-center p-4",children:e.jsxs(L,{children:[e.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:e.jsx(H,{className:"h-6 w-6 text-muted-foreground"})}),e.jsx(M,{children:"Object Not Found"}),e.jsxs(T,{children:['Object "',c,'" definition missing. Check your configuration or navigate back to select a valid object.']})]})});const k=l.primaryField||Object.keys(l.fields||{}).find(s=>s==="name"||s==="title"),b=l.views?.form?.sections,E=b&&b.length>0?b.map(s=>({title:s.title,collapsible:s.collapsible,defaultCollapsed:s.defaultCollapsed,fields:(s.fields||[]).map(t=>{const a=typeof t=="string"?t:t.name,r=l.fields[a];return r?{name:a,label:r.label||a,type:r.type||"text",...r.options&&{options:r.options},...r.reference_to&&{reference_to:r.reference_to},...r.reference_field&&{reference_field:r.reference_field},...r.currency&&{currency:r.currency}}:(console.warn(`[RecordDetailView] Field "${a}" not found in ${l.name} definition`),{name:a,label:a})})})):[{title:"Details",fields:Object.keys(l.fields||{}).map(s=>{const t=l.fields[s];return{name:s,label:t.label||s,type:t.type||"text",...t.options&&{options:t.options},...t.reference_to&&{reference_to:t.reference_to},...t.reference_field&&{reference_field:t.reference_field},...t.currency&&{currency:t.currency}}})}],N=(l.actions||[]).filter(s=>s.locations?.includes("record_header")),A={type:"detail-view",objectName:l.name,resourceId:d,showBack:!0,onBack:"history",showEdit:!0,title:l.label,primaryField:k,sections:E,...N.length>0&&{actions:[{type:"action:bar",location:"record_header",actions:N}]}};return e.jsxs("div",{className:"h-full bg-background overflow-hidden flex flex-col relative",children:[e.jsx("div",{className:"absolute top-2 sm:top-4 right-2 sm:right-4 z-50 flex items-center gap-2",children:w.length>0&&e.jsxs("div",{className:"flex items-center gap-1.5",title:"Users viewing this record",children:[e.jsx(K,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx(B,{users:w,size:"sm",maxVisible:4,showStatus:!0})]})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-row",children:[e.jsxs("div",{className:"flex-1 overflow-auto p-3 sm:p-4 lg:p-6 scroll-pb-48",children:[e.jsx(F,{schema:A,dataSource:n,onEdit:()=>{y({_id:d,id:d})}}),e.jsx("div",{className:"mt-6 border-t pt-6",children:e.jsx(P,{config:{position:"bottom",collapsible:!1,feed:{enableReactions:!0,enableThreading:!0,showCommentInput:!0}},items:D,onAddComment:R,onAddReply:C,onToggleReaction:U})})]}),e.jsx(z,{open:_,sections:[{title:"View Schema",data:A}]})]})]})}export{fe as RecordDetailView};
@@ -1 +0,0 @@
1
- import{f as s,j as e}from"./vendor-react-BEJ2LWyF.js";import{R as t}from"./infrastructure-CShH4S9_.js";import"./vendor-i18n-CikIh7Op.js";function a(){const r=s();return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background px-4 py-8",children:e.jsx(t,{onSuccess:()=>r("/"),loginUrl:"/login"})})}export{a as RegisterPage};
@@ -1 +0,0 @@
1
- import{O as S}from"./vendor-objectstack-aMKO1xRi.js";import{j as A}from"./framework-0M39ZRTM.js";class O{cache;maxSize;ttl;stats;constructor(t={}){this.cache=new Map,this.maxSize=t.maxSize||100,this.ttl=t.ttl||300*1e3,this.stats={hits:0,misses:0,evictions:0}}async get(t,e){const s=Date.now(),n=this.cache.get(t);if(n){if(s-n.timestamp<this.ttl)return n.accessCount++,n.lastAccessed=s,this.stats.hits++,this.cache.delete(t),this.cache.set(t,n),n.data;this.cache.delete(t)}this.stats.misses++;const r=await e();return this.set(t,r),r}set(t,e){const s=Date.now();this.cache.size>=this.maxSize&&!this.cache.has(t)&&this.evictLRU(),this.cache.set(t,{data:e,timestamp:s,accessCount:1,lastAccessed:s})}evictLRU(){const t=this.cache.keys().next().value;t!==void 0&&(this.cache.delete(t),this.stats.evictions++)}invalidate(t){t?this.cache.delete(t):this.cache.clear()}clear(){this.cache.clear(),this.stats={hits:0,misses:0,evictions:0}}getStats(){const t=this.stats.hits+this.stats.misses,e=t>0?this.stats.hits/t:0;return{size:this.cache.size,maxSize:this.maxSize,hits:this.stats.hits,misses:this.stats.misses,evictions:this.stats.evictions,hitRate:e}}getCachedSync(t){const e=this.cache.get(t);if(e){if(this.ttl>0&&Date.now()-e.timestamp>this.ttl){this.cache.delete(t);return}return this.cache.delete(t),this.cache.set(t,e),this.stats.hits++,e.data}}has(t){const e=this.cache.get(t);return e?Date.now()-e.timestamp>=this.ttl?(this.cache.delete(t),!1):!0:!1}}class g extends Error{constructor(t,e,s,n){super(t),this.code=e,this.statusCode=s,this.details=n,this.name="ObjectStackError",Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toJSON(){return{name:this.name,message:this.message,code:this.code,statusCode:this.statusCode,details:this.details,stack:this.stack}}}class $ extends g{constructor(t,e){super(`Metadata not found for object: ${t}`,"METADATA_NOT_FOUND",404,{objectName:t,...e}),this.name="MetadataNotFoundError"}}class m extends g{constructor(t,e,s,n,r){super(`Bulk ${t} operation failed: ${e} succeeded, ${s} failed`,"BULK_OPERATION_ERROR",500,{operation:t,successCount:e,failureCount:s,errors:n,...r}),this.successCount=e,this.failureCount=s,this.errors=n,this.name="BulkOperationError"}getSummary(){const t=this.successCount+this.failureCount,e=t>0?this.failureCount/t:0;return{operation:this.details?.operation,total:t,successful:this.successCount,failed:this.failureCount,failureRate:e,errors:this.errors}}}class y extends g{constructor(t,e,s,n){super(`Connection error: ${t}`,"CONNECTION_ERROR",n||503,{url:e,...s}),this.url=e,this.name="ConnectionError"}}class p extends g{constructor(t="Authentication failed",e,s){super(t,"AUTHENTICATION_ERROR",s||401,e),this.name="AuthenticationError"}}class b extends g{constructor(t,e,s,n){super(t,"VALIDATION_ERROR",400,{field:e,validationErrors:s,...n}),this.field=e,this.validationErrors=s,this.name="ValidationError"}getValidationErrors(){return this.validationErrors||[]}}function C(u,t){const e=u?.status||u?.statusCode||500,s=u?.message||u?.statusText||"Unknown error",n={context:t,response:{status:e,data:u?.data,headers:u?.headers}};switch(e){case 401:return new p(s,n,401);case 403:return new p(s,n,403);case 404:if(t?.includes("metadata")||t?.includes("schema")||t?.includes("getObjectSchema")){const r=R(t);return new $(r,n)}return new g(s,"NOT_FOUND",404,n);case 400:return new b(s,void 0,u?.data?.errors,n);case 503:return new y(s,u?.config?.url,n,503);case 504:return new y(s,u?.config?.url,n,504);default:return new g(s,"UNKNOWN_ERROR",e,n)}}function R(u){if(!u)return"unknown";const t=u.match(/\(([^)]+)\)/);return t?t[1]:"unknown"}class k{client;connected=!1;metadataCache;connectionState="disconnected";connectionStateListeners=[];batchProgressListeners=[];autoReconnect;maxReconnectAttempts;reconnectDelay;reconnectAttempts=0;baseUrl;token;fetchImpl;constructor(t){this.client=new S(t),this.metadataCache=new O(t.cache),this.autoReconnect=t.autoReconnect??!0,this.maxReconnectAttempts=t.maxReconnectAttempts??3,this.reconnectDelay=t.reconnectDelay??1e3,this.baseUrl=t.baseUrl,this.token=t.token,this.fetchImpl=t.fetch||globalThis.fetch.bind(globalThis)}async connect(){if(!this.connected){this.setConnectionState("connecting");try{await this.client.connect(),this.connected=!0,this.reconnectAttempts=0,this.setConnectionState("connected")}catch(t){const e=t instanceof Error?t.message:"Failed to connect to ObjectStack server",s=new y(e,void 0,{originalError:t});if(this.setConnectionState("error",s),this.autoReconnect&&this.reconnectAttempts<this.maxReconnectAttempts)await this.attemptReconnect();else throw s}}}async attemptReconnect(){this.reconnectAttempts++,this.setConnectionState("reconnecting");const t=this.reconnectDelay*Math.pow(2,this.reconnectAttempts-1);await new Promise(e=>setTimeout(e,t)),this.connected=!1,await this.connect()}getConnectionState(){return this.connectionState}isConnected(){return this.connected&&this.connectionState==="connected"}onConnectionStateChange(t){return this.connectionStateListeners.push(t),()=>{const e=this.connectionStateListeners.indexOf(t);e>-1&&this.connectionStateListeners.splice(e,1)}}onBatchProgress(t){return this.batchProgressListeners.push(t),()=>{const e=this.batchProgressListeners.indexOf(t);e>-1&&this.batchProgressListeners.splice(e,1)}}setConnectionState(t,e){this.connectionState=t;const s={state:t,timestamp:Date.now(),error:e};this.connectionStateListeners.forEach(n=>{try{n(s)}catch(r){console.error("Error in connection state listener:",r)}})}emitBatchProgress(t){this.batchProgressListeners.forEach(e=>{try{e(t)}catch(s){console.error("Error in batch progress listener:",s)}})}async find(t,e){if(await this.connect(),e?.$expand&&e.$expand.length>0){const r=await this.rawFindWithPopulate(t,e);return this.normalizeQueryResult(r,e)}const s=this.convertQueryParams(e),n=await this.client.data.find(t,s);return this.normalizeQueryResult(n,e)}async findOne(t,e,s){if(await this.connect(),s?.$expand&&s.$expand.length>0)try{const n={...s,$filter:{_id:String(e)},$top:1},r=await this.rawFindWithPopulate(t,n);if(Array.isArray(r))return r[0]||null;const a=r;return(a.records||a.value||[])[0]||null}catch(n){if(n?.status===404)return null;throw n}try{return(await this.client.data.get(t,String(e))).record}catch(n){if(n?.status===404)return null;throw n}}async create(t,e){return await this.connect(),(await this.client.data.create(t,e)).record}async update(t,e,s){return await this.connect(),(await this.client.data.update(t,String(e),s)).record}async delete(t,e){return await this.connect(),(await this.client.data.delete(t,String(e))).deleted}async bulk(t,e,s){if(await this.connect(),!s||s.length===0)return[];const n=s.length;let r=0,a=0;const c=()=>{this.emitBatchProgress({operation:e,total:n,completed:r,failed:a,percentage:n>0?(r+a)/n*100:0})};try{switch(e){case"create":{c();const i=await this.client.data.createMany(t,s);return r=i.length,a=n-r,c(),i}case"delete":{const i=s.map(h=>h.id).filter(Boolean);if(i.length===0){const h=s.map((o,l)=>({index:l,error:`Missing ID for item at index ${l}`}));throw a=s.length,c(),new m("delete",0,s.length,h)}return c(),await this.client.data.deleteMany(t,i),r=i.length,a=n-r,c(),[]}case"update":{if(typeof this.client.data.updateMany=="function")try{c();const o=this.client.data.updateMany,l=await o(t,s);return r=l.length,a=n-r,c(),l}catch{}const i=[],h=[];for(let o=0;o<s.length;o++){const l=s[o],f=l.id;if(!f){h.push({index:o,error:"Missing ID"}),a++,c();continue}try{const d=await this.client.data.update(t,String(f),l);i.push(d.record),r++,c()}catch(d){const w=d instanceof Error?d.message:String(d);h.push({index:o,error:w}),a++,c()}}if(h.length>0)throw new m("update",i.length,h.length,h,{resource:t,totalRecords:s.length});return i}default:throw new g(`Unsupported bulk operation: ${e}`,"UNSUPPORTED_OPERATION",400)}}catch(i){if(c(),i instanceof m||i instanceof g)throw i;const h=i instanceof Error?i.message:String(i),o=s.map((l,f)=>({index:f,error:h}));throw new m(e,0,s.length,o,{resource:t,originalError:i})}}normalizeQueryResult(t,e){if(Array.isArray(t))return{data:t,total:t.length,page:1,pageSize:t.length,hasMore:!1};const s=t,n=s.records||s.value||[],r=s.total??s.count??n.length;return{data:n,total:r,page:e?.$skip&&e.$top?Math.floor(e.$skip/e.$top)+1:1,pageSize:e?.$top,hasMore:e?.$top?n.length===e.$top:!1}}async rawFindWithPopulate(t,e){const s=new URLSearchParams;if(e.$expand&&e.$expand.length>0&&s.set("populate",e.$expand.join(",")),e.$top!==void 0&&s.set("top",String(e.$top)),e.$skip!==void 0&&s.set("skip",String(e.$skip)),e.$select&&e.$select.length>0&&s.set("select",e.$select.join(",")),e.$orderby)if(Array.isArray(e.$orderby)){const f=e.$orderby.map(d=>{if(typeof d=="string")return d;const w=d.field;return(d.order||"asc")==="desc"?`-${w}`:w}).join(",");s.set("sort",f)}else{const f=Object.entries(e.$orderby).map(([d,w])=>w==="desc"?`-${d}`:d).join(",");s.set("sort",f)}e.$filter&&s.set("filter",JSON.stringify(e.$filter));const n=this.baseUrl.replace(/\/$/,""),r=s.toString(),c=/\/api\/v\d+$/i.test(n)?"/data":"/api/v1/data",i=`${n}${c}/${t}${r?`?${r}`:""}`,h={"Content-Type":"application/json"};this.token&&(h.Authorization=`Bearer ${this.token}`);const o=await this.fetchImpl(i,{method:"GET",headers:h});if(!o.ok){const f=await o.json().catch(()=>({message:o.statusText})),d=new Error(f?.error?.message||f?.message||o.statusText);throw d.status=o.status,d}const l=await o.json();return l&&typeof l.success=="boolean"&&"data"in l?l.data:l}convertQueryParams(t){if(!t)return{};const e={};if(t.$select&&(e.select=t.$select),t.$filter&&(Array.isArray(t.$filter)?e.filters=t.$filter:e.filters=A(t.$filter)),t.$orderby)if(Array.isArray(t.$orderby))e.sort=t.$orderby.map(s=>{if(typeof s=="string")return s;const n=s.field;return(s.order||"asc")==="desc"?`-${n}`:n});else{const s=Object.entries(t.$orderby).map(([n,r])=>r==="desc"?`-${n}`:n);e.sort=s}return t.$skip!==void 0&&(e.skip=t.$skip),t.$top!==void 0&&(e.top=t.$top),e}async getObjectSchema(t){await this.connect();try{return await this.metadataCache.get(t,async()=>{const s=await this.client.meta.getItem("object",t);return s&&s.item?s.item:s})}catch(e){const s=e;throw s?.status===404||s?.statusCode===404?new $(t,{originalError:e}):e instanceof g?e:C(s,`getObjectSchema(${t})`)}}getClient(){return this.client}async getDiscovery(){try{return await this.connect(),this.client.discoveryInfo||null}catch{return null}}async getView(t,e){await this.connect();try{const s=`view:${t}:${e}`;return await this.metadataCache.get(s,async()=>{const n=await this.client.meta.getItem(t,`views/${e}`);return n&&n.item?n.item:n??null})}catch{return null}}async getApp(t){await this.connect();try{const e=`app:${t}`;return await this.metadataCache.get(e,async()=>{const s=await this.client.meta.getItem("apps",t);return s&&s.item?s.item:s??null})}catch{return null}}async getPage(t){await this.connect();try{const e=`page:${t}`;return await this.metadataCache.get(e,async()=>{const s=await this.client.meta.getItem("pages",t);return s&&s.item?s.item:s??null})}catch{return null}}async aggregate(t,e){await this.connect();try{const s={object:t,measures:[{field:e.field,function:e.function}],dimensions:[e.groupBy]};e.filter&&(s.filters=e.filter);const n=await this.client.analytics.query(s);return Array.isArray(n)?n:n?.data&&Array.isArray(n.data)?n.data:n?.results&&Array.isArray(n.results)?n.results:[]}catch{const n=(await this.find(t)).data||[];return n.length===0?[]:this.aggregateClientSide(n,e)}}aggregateClientSide(t,e){const{field:s,function:n,groupBy:r}=e,a={};for(const c of t){const i=String(c[r]??"Unknown");a[i]||(a[i]=[]),a[i].push(c)}return Object.entries(a).map(([c,i])=>{const h=i.map(l=>Number(l[s])||0);let o;switch(n){case"count":o=i.length;break;case"avg":o=h.length>0?h.reduce((l,f)=>l+f,0)/h.length:0;break;case"min":o=h.length>0?Math.min(...h):0;break;case"max":o=h.length>0?Math.max(...h):0;break;case"sum":default:o=h.reduce((l,f)=>l+f,0);break}return{[r]:c,[s]:o}})}async getItems(t,e){return await this.connect(),await Promise.all(e.map(async n=>{const r=`${t}:${n}`;return this.metadataCache.get(r,async()=>{const a=await this.client.meta.getItem(t,n);return a&&a.item?a.item:a})}))}getCached(t){return this.metadataCache.getCachedSync(t)}getCacheStats(){return this.metadataCache.getStats()}invalidateCache(t){this.metadataCache.invalidate(t)}clearCache(){this.metadataCache.clear()}async uploadFile(t,e,s){await this.connect();const n=new FormData;n.append("file",e),s?.recordId&&n.append("recordId",s.recordId),s?.fieldName&&n.append("fieldName",s.fieldName),s?.metadata&&n.append("metadata",JSON.stringify(s.metadata));const r=`${this.baseUrl}/api/data/${encodeURIComponent(t)}/upload`,a=await fetch(r,{method:"POST",body:n,headers:{...this.getAuthHeaders()}});if(!a.ok){const c=await a.json().catch(()=>({message:a.statusText}));throw new g(c.message||`Upload failed with status ${a.status}`,"UPLOAD_ERROR",a.status)}return a.json()}async uploadFiles(t,e,s){await this.connect();const n=new FormData;e.forEach((c,i)=>{n.append("files",c,c.name||`file-${i}`)}),s?.recordId&&n.append("recordId",s.recordId),s?.fieldName&&n.append("fieldName",s.fieldName),s?.metadata&&n.append("metadata",JSON.stringify(s.metadata));const r=`${this.baseUrl}/api/data/${encodeURIComponent(t)}/upload`,a=await fetch(r,{method:"POST",body:n,headers:{...this.getAuthHeaders()}});if(!a.ok){const c=await a.json().catch(()=>({message:a.statusText}));throw new g(c.message||`Upload failed with status ${a.status}`,"UPLOAD_ERROR",a.status)}return a.json()}getAuthHeaders(){const t={};return this.token&&(t.Authorization=`Bearer ${this.token}`),t}}export{k as O};
@@ -1,10 +0,0 @@
1
- import{r as v,j as Q,B as C}from"./vendor-react-BEJ2LWyF.js";import"./vendor-objectstack-aMKO1xRi.js";class er{components=new Map;register(e,t,s){const n=s?.namespace?`${s.namespace}:${e}`:e;s?.namespace||console.warn(`Registering component "${e}" without a namespace is deprecated. Please provide a namespace in the meta parameter.
2
-
3
- Migration:
4
- // Before (deprecated):
5
- registry.register('${e}', MyComponent);
6
-
7
- // After:
8
- registry.register('${e}', MyComponent, { namespace: 'my-plugin' });
9
-
10
- See: https://github.com/objectstack-ai/objectui/blob/main/MIGRATION_GUIDE.md`),this.components.has(n),this.components.set(n,{type:n,component:t,...s}),s?.namespace&&!s?.skipFallback&&this.components.set(e,{type:n,component:t,...s})}get(e,t){if(t){const s=`${t}:${e}`;return this.components.get(s)?.component}return this.components.get(e)?.component}getConfig(e,t){if(t){const s=`${t}:${e}`;return this.components.get(s)}return this.components.get(e)}has(e,t){if(t){const s=`${t}:${e}`;return this.components.has(s)}return this.components.has(e)}getAllTypes(){return Array.from(this.components.keys())}getAllConfigs(){return Array.from(this.components.values())}getNamespaceComponents(e){return Array.from(this.components.values()).filter(t=>t.namespace===e)}}const tr=new er;function rr(r){return{$eq:"=",$ne:"!=",$gt:">",$gte:">=",$lt:"<",$lte:"<=",$in:"in",$nin:"notin",$notin:"notin",$contains:"contains",$startswith:"startswith",$between:"between"}[r]||null}function es(r){const e=[];for(const[t,s]of Object.entries(r))if(s!=null)if(typeof s=="object"&&!Array.isArray(s))for(const[n,i]of Object.entries(s)){if(n==="$regex"){console.warn(`[ObjectUI] Warning: $regex operator is not fully supported. Converting to 'contains' which only supports substring matching, not regex patterns. Field: '${t}', Value: ${JSON.stringify(i)}. Consider using $contains or $startswith instead.`),e.push([t,"contains",i]);continue}const o=rr(n);if(o)e.push([t,o,i]);else throw new Error(`[ObjectUI] Unknown filter operator '${n}' for field '${t}'. Supported operators: $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $contains, $startswith, $between. If you need exact object matching, use the value directly without an operator.`)}else e.push([t,"=",s]);return e.length===0?r:e.length===1?e[0]:["and",...e]}function sr(r){switch(r){case"equals":case"eq":return"=";case"notEquals":case"ne":case"neq":return"!=";case"contains":return"contains";case"notContains":return"notcontains";case"greaterThan":case"gt":return">";case"greaterOrEqual":case"gte":return">=";case"lessThan":case"lt":return"<";case"lessOrEqual":case"lte":return"<=";case"in":return"in";case"notIn":return"not in";case"before":return"<";case"after":return">";default:return r}}function nr(r){if("id"in r&&"filters"in r&&r.label&&Array.isArray(r.filters))return r;if("field"in r&&"operator"in r){const e=sr(r.operator);return{id:`${r.field}-${r.operator}-${String(r.value??"")}`,label:r.label||`${r.field} ${r.operator} ${String(r.value??"")}`,filters:[[r.field,e,r.value]],icon:r.icon,defaultActive:r.defaultActive}}return r}function ts(r){if(!(!r||r.length===0))return r.map(nr)}function rs(r){if(Array.isArray(r))return r;if(r&&typeof r=="object"){if(Array.isArray(r.records))return r.records;if(Array.isArray(r.data))return r.data;if(Array.isArray(r.value))return r.value}return[]}function ss(r,e){if(!r||typeof r!="object")return[];const t=[];for(const[s,n]of Object.entries(r))n&&typeof n=="object"&&(n.type==="lookup"||n.type==="master_detail")&&t.push(s);if(t.length===0)return[];if(e&&Array.isArray(e)&&e.length>0){const s=new Set;for(const n of e)if(typeof n=="string")s.add(n);else if(n&&typeof n=="object"){const i=n.field??n.name??n.fieldName;i&&s.add(i)}return t.filter(n=>s.has(n))}return t}class Ae{scopes=[];constructor(e={}){this.scopes.push(new Map(Object.entries(e)))}pushScope(e){this.scopes.push(new Map(Object.entries(e)))}popScope(){this.scopes.length>1&&this.scopes.pop()}get(e){const t=e.split("."),s=t[0];for(let n=this.scopes.length-1;n>=0;n--)if(this.scopes[n].has(s)){let i=this.scopes[n].get(s);for(let o=1;o<t.length;o++)if(i&&typeof i=="object")i=i[t[o]];else return;return i}}set(e,t){this.scopes.length>0&&this.scopes[this.scopes.length-1].set(e,t)}has(e){const t=e.split(".")[0];for(let s=this.scopes.length-1;s>=0;s--)if(this.scopes[s].has(t))return!0;return!1}toObject(){const e={};for(const t of this.scopes)for(const[s,n]of t.entries())e[s]=n;return e}createChild(e={}){const t=new Ae;return t.scopes=[...this.scopes,new Map(Object.entries(e))],t}}class kt{cache=new Map;maxSize;constructor(e=1e3){this.maxSize=e}compile(e,t){const s=`${e}::${t.join(",")}`;if(this.cache.has(s)){const o=this.cache.get(s);return o.hitCount++,o}this.cache.size>=this.maxSize&&this.evictLFU();const i={fn:this.compileExpression(e,t),varNames:[...t],expression:e,compiledAt:Date.now(),hitCount:1};return this.cache.set(s,i),i}compileExpression(e,t){return new Function(...t,`"use strict"; return (${e});`)}evictLFU(){let e=null,t=1/0,s=1/0;for(const[n,i]of this.cache.entries())(i.hitCount<s||i.hitCount===s&&i.compiledAt<t)&&(e=n,t=i.compiledAt,s=i.hitCount);e&&this.cache.delete(e)}has(e,t){const s=`${e}::${t.join(",")}`;return this.cache.has(s)}clear(){this.cache.clear()}getStats(){let e=0;const t=[];for(const s of this.cache.values())e+=s.hitCount,t.push({expression:s.expression,hitCount:s.hitCount});return{size:this.cache.size,maxSize:this.maxSize,totalHits:e,entries:t.sort((s,n)=>n.hitCount-s.hitCount)}}}class Et{functions=new Map;constructor(){this.registerDefaults()}register(e,t){this.functions.set(e.toUpperCase(),t)}get(e){return this.functions.get(e.toUpperCase())}has(e){return this.functions.has(e.toUpperCase())}getNames(){return Array.from(this.functions.keys())}toObject(){const e={};for(const[t,s]of this.functions)e[t]=s;return e}registerDefaults(){this.registerAggregationFunctions(),this.registerDateFunctions(),this.registerLogicFunctions(),this.registerStringFunctions(),this.registerStringSearchFunctions(),this.registerStatisticalFunctions()}registerAggregationFunctions(){this.register("SUM",(...e)=>ae(e).reduce((s,n)=>s+n,0)),this.register("AVG",(...e)=>{const t=ae(e);return t.length===0?0:t.reduce((s,n)=>s+n,0)/t.length}),this.register("COUNT",(...e)=>Ft(e).filter(s=>s!=null).length),this.register("MIN",(...e)=>{const t=ae(e);return t.length===0?0:Math.min(...t)}),this.register("MAX",(...e)=>{const t=ae(e);return t.length===0?0:Math.max(...t)})}registerDateFunctions(){this.register("TODAY",()=>new Date().toISOString().split("T")[0]),this.register("NOW",()=>new Date().toISOString()),this.register("DATEADD",(e,t,s)=>{const n=new Date(e);if(isNaN(n.getTime()))throw new Error(`DATEADD: Invalid date "${e}"`);switch(String(s).toLowerCase()){case"day":case"days":n.setDate(n.getDate()+t);break;case"month":case"months":n.setMonth(n.getMonth()+t);break;case"year":case"years":n.setFullYear(n.getFullYear()+t);break;case"hour":case"hours":n.setHours(n.getHours()+t);break;case"minute":case"minutes":n.setMinutes(n.getMinutes()+t);break;default:throw new Error(`DATEADD: Unsupported unit "${s}"`)}return n.toISOString()}),this.register("DATEDIFF",(e,t,s)=>{const n=new Date(e),i=new Date(t);if(isNaN(n.getTime()))throw new Error(`DATEDIFF: Invalid date "${e}"`);if(isNaN(i.getTime()))throw new Error(`DATEDIFF: Invalid date "${t}"`);const o=i.getTime()-n.getTime();switch(String(s).toLowerCase()){case"day":case"days":return Math.floor(o/(1e3*60*60*24));case"month":case"months":return(i.getFullYear()-n.getFullYear())*12+(i.getMonth()-n.getMonth());case"year":case"years":return i.getFullYear()-n.getFullYear();case"hour":case"hours":return Math.floor(o/(1e3*60*60));case"minute":case"minutes":return Math.floor(o/(1e3*60));default:throw new Error(`DATEDIFF: Unsupported unit "${s}"`)}}),this.register("DATEFORMAT",(e,t)=>{const s=new Date(e);if(isNaN(s.getTime()))throw new Error(`DATEFORMAT: Invalid date "${e}"`);const n=(i,o=2)=>String(i).padStart(o,"0");return t.replace("YYYY",String(s.getFullYear())).replace("YY",String(s.getFullYear()).slice(-2)).replace("MM",n(s.getMonth()+1)).replace("DD",n(s.getDate())).replace("HH",n(s.getHours())).replace("mm",n(s.getMinutes())).replace("ss",n(s.getSeconds()))})}registerLogicFunctions(){this.register("IF",(e,t,s)=>e?t:s),this.register("AND",(...e)=>e.every(Boolean)),this.register("OR",(...e)=>e.some(Boolean)),this.register("NOT",e=>!e),this.register("SWITCH",(e,...t)=>{for(let s=0;s<t.length-1;s+=2)if(e===t[s])return t[s+1];if(t.length%2===1)return t[t.length-1]})}registerStringFunctions(){this.register("CONCAT",(...e)=>e.map(t=>String(t??"")).join("")),this.register("LEFT",(e,t)=>String(e??"").substring(0,t)),this.register("RIGHT",(e,t)=>{const s=String(e??"");return s.substring(Math.max(0,s.length-t))}),this.register("TRIM",e=>String(e??"").trim()),this.register("UPPER",e=>String(e??"").toUpperCase()),this.register("LOWER",e=>String(e??"").toLowerCase())}registerStringSearchFunctions(){this.register("FIND",(e,t,s)=>String(t??"").indexOf(String(e??""),s??0)),this.register("REPLACE",(e,t,s)=>String(e??"").split(String(t??"")).join(String(s??""))),this.register("SUBSTRING",(e,t,s)=>{const n=String(e??"");return s!==void 0?n.substring(t,t+s):n.substring(t)}),this.register("REGEX",(e,t,s)=>{const n=String(e??"");return new RegExp(t,s).test(n)}),this.register("LEN",e=>String(e??"").length)}registerStatisticalFunctions(){this.register("MEDIAN",(...e)=>{const t=ae(e).sort((n,i)=>n-i);if(t.length===0)return 0;const s=Math.floor(t.length/2);return t.length%2!==0?t[s]:(t[s-1]+t[s])/2}),this.register("STDEV",(...e)=>{const t=ae(e);if(t.length<2)return 0;const s=t.reduce((o,l)=>o+l,0)/t.length,i=t.map(o=>(o-s)**2).reduce((o,l)=>o+l,0)/(t.length-1);return Math.sqrt(i)}),this.register("VARIANCE",(...e)=>{const t=ae(e);if(t.length<2)return 0;const s=t.reduce((i,o)=>i+o,0)/t.length;return t.map(i=>(i-s)**2).reduce((i,o)=>i+o,0)/(t.length-1)}),this.register("PERCENTILE",(e,...t)=>{const s=ae(t).sort((y,A)=>y-A);if(s.length===0)return 0;const i=Math.max(0,Math.min(100,e))/100*(s.length-1),o=Math.floor(i),l=Math.ceil(i);if(o===l)return s[o];const g=i-o;return s[o]+g*(s[l]-s[o])})}}function ae(r){const e=[];for(const t of r)if(Array.isArray(t))e.push(...ae(t));else{const s=Number(t);isNaN(s)||e.push(s)}return e}function Ft(r){const e=[];for(const t of r)Array.isArray(t)?e.push(...Ft(t)):e.push(t);return e}class ye{context;cache;formulas;constructor(e,t,s){e instanceof Ae?this.context=e:this.context=new Ae(e||{}),this.cache=t||new kt,this.formulas=s||new Et}evaluate(e,t={}){if(typeof e!="string")return e;const{defaultValue:s,throwOnError:n=!1,sanitize:i=!0}=t;try{if(!e.includes("${"))return e;const l=e.match(/^\$\{([^}]+)\}$/);return l?this.evaluateExpression(l[1].trim(),{sanitize:i}):e.replace(/\$\{([^}]+)\}/g,(g,y)=>{try{const A=this.evaluateExpression(y.trim(),{sanitize:i});return String(A??"")}catch(A){if(n)throw A;return console.warn(`Expression evaluation failed for: ${y}`,A),g}})}catch(o){if(n)throw o;return console.warn(`Failed to evaluate expression: ${e}`,o),s??e}}evaluateExpression(e,t={}){const{sanitize:s=!0}=t;if(!(!e||e.trim()==="")){if(s&&this.isDangerous(e))throw new Error(`Potentially dangerous expression detected: ${e}`);try{const n=this.context.toObject(),o={...this.formulas.toObject(),...n},l=Object.keys(o),g=Object.values(o);return this.cache.compile(e,l).fn(...g)}catch(n){throw new Error(`Failed to evaluate expression "${e}": ${n.message}`)}}}isDangerous(e){return[/eval\s*\(/i,/Function\s*\(/i,/setTimeout\s*\(/i,/setInterval\s*\(/i,/import\s*\(/i,/require\s*\(/i,/process\./i,/global\./i,/window\./i,/document\./i,/__proto__/i,/constructor\s*\(/i,/prototype\./i].some(s=>s.test(e))}evaluateCondition(e,t={}){return typeof e=="boolean"?e:e?!!this.evaluate(e,t):!0}updateContext(e){Object.entries(e).forEach(([t,s])=>{this.context.set(t,s)})}getContext(){return this.context}withContext(e){return new ye(this.context.createChild(e),this.cache,this.formulas)}getCacheStats(){return this.cache.getStats()}clearCache(){this.cache.clear()}getFormulas(){return this.formulas}registerFunction(e,t){this.formulas.register(e,t)}}const ir=new kt,ar=new Et;function ns(r,e){const t=new ye({...e,data:e},ir,ar);try{return(/\$\{/.test(r)?t.evaluate(r,{throwOnError:!0}):t.evaluateExpression(r))===!0}catch{return!1}}class Vt{handlers=new Map;evaluator;context;confirmHandler;toastHandler;modalHandler;navigationHandler;paramCollectionHandler;constructor(e={}){this.context=e,this.evaluator=new ye(e),this.confirmHandler=async t=>window.confirm(t),this.toastHandler=null,this.modalHandler=null,this.navigationHandler=null,this.paramCollectionHandler=null}setConfirmHandler(e){this.confirmHandler=e}setToastHandler(e){this.toastHandler=e}setModalHandler(e){this.modalHandler=e}setNavigationHandler(e){this.navigationHandler=e}setParamCollectionHandler(e){this.paramCollectionHandler=e}registerHandler(e,t){this.handlers.set(e,t)}unregisterHandler(e){this.handlers.delete(e)}async execute(e){try{const t=e.type||e.actionType||e.name||"";if(e.condition&&!this.evaluator.evaluateCondition(e.condition))return{success:!1,error:"Action condition not met"};if(e.disabled&&(typeof e.disabled=="string"?this.evaluator.evaluateCondition(e.disabled):e.disabled))return{success:!1,error:"Action is disabled"};const s=e.confirm?.message||e.confirmText;if(s&&!await this.confirmHandler(this.evaluator.evaluate(s),e.confirm?{title:e.confirm.title,confirmText:e.confirm.confirmText,cancelText:e.confirm.cancelText}:void 0))return{success:!1,error:"Action cancelled by user"};if(e.actionParams&&Array.isArray(e.actionParams)&&e.actionParams.length>0&&this.paramCollectionHandler){const i=await this.paramCollectionHandler(e.actionParams);if(i===null)return{success:!1,error:"Action cancelled by user (params)"};e.params={...e.params||{},...i}}if(t&&this.handlers.has(t)){const o=await this.handlers.get(t)(e,this.context);return await this.handlePostExecution(e,o),o}let n;switch(t){case"script":n=await this.executeScript(e);break;case"url":n=await this.executeUrl(e);break;case"modal":n=await this.executeModal(e);break;case"flow":n=await this.executeFlow(e);break;case"api":n=await this.executeAPI(e);break;case"navigation":n=await this.executeNavigation(e);break;default:e.navigate?n=await this.executeNavigation(e):e.api||e.endpoint?n=await this.executeAPI(e):e.onClick?(await e.onClick(),n={success:!0}):n=await this.executeActionSchema(e)}return await this.handlePostExecution(e,n),n}catch(t){const s={success:!1,error:t.message};return await this.handlePostExecution(e,s),s}}async executeChain(e,t="sequential"){if(e.length===0)return{success:!0};if(t==="parallel"){const n=await Promise.allSettled(e.map(l=>this.execute(l)));if(n.filter(l=>l.status==="rejected"||l.status==="fulfilled"&&!l.value.success).length>0)return{success:!1,error:n.find(g=>g.status==="fulfilled"&&!g.value.success)?.value?.error||"One or more parallel actions failed"};const o=n[n.length-1];return o.status==="fulfilled"?o.value:{success:!1,error:"Action failed"}}let s={success:!0};for(const n of e)if(s=await this.execute(n),!s.success)return s;return s}async handlePostExecution(e,t){if(this.toastHandler){const s=e.toast??{showOnSuccess:!0,showOnError:!0},n=e.toast?.duration;if(t.success&&s.showOnSuccess!==!1){const i=e.successMessage||"Action completed successfully";this.toastHandler(i,{type:"success",duration:n})}if(!t.success&&s.showOnError!==!1&&t.error){const i=e.errorMessage||t.error;this.toastHandler(i,{type:"error",duration:n})}}if(e.refreshAfter&&t.success&&(t.reload=!0),e.chain&&e.chain.length>0&&t.success){const s=await this.executeChain(e.chain,e.chainMode||"sequential");s.success||(t.success=!1,t.error=s.error),s.data&&(t.data=s.data),s.redirect&&(t.redirect=s.redirect),s.reload&&(t.reload=!0)}if(t.success&&e.onSuccess){const s=Array.isArray(e.onSuccess)?e.onSuccess:[e.onSuccess];await this.executeChain(s,"sequential")}if(!t.success&&e.onFailure){const s=Array.isArray(e.onFailure)?e.onFailure:[e.onFailure];await this.executeChain(s,"sequential")}}async executeScript(e){const t=e.execute||e.target;if(!t)return{success:!1,error:"No script provided for script action"};try{return{success:!0,data:this.evaluator.evaluate(`\${${t}}`)}}catch(s){return{success:!1,error:`Script execution failed: ${s.message}`}}}async executeUrl(e){const t=e.target||e.redirect;if(!t)return{success:!1,error:"No URL provided for url action"};const s=this.evaluator.evaluate(t);if(!this.isValidUrl(s))return{success:!1,error:"Invalid URL scheme. Only http://, https://, and relative URLs are allowed."};const n=s.startsWith("http://")||s.startsWith("https://"),i=e.params?.newTab??n;if(this.navigationHandler)return this.navigationHandler(s,{external:n,newTab:i}),{success:!0};if(i)window.open(s,"_blank","noopener,noreferrer");else return{success:!0,redirect:s};return{success:!0}}async executeModal(e){const t=e.modal||e.target||e.params?.schema;return t?this.modalHandler?await this.modalHandler(t,this.context):{success:!0,modal:t}:{success:!1,error:"No modal schema or target provided for modal action"}}async executeFlow(e){const t=e.target||e.name;return t?this.handlers.has("flow")?await this.handlers.get("flow")(e,this.context):{success:!1,error:`Flow handler not registered. Cannot execute flow: ${t}`}:{success:!1,error:"No flow target provided for flow action"}}async executeActionSchema(e){const t={success:!0};if(e.api||e.endpoint){const s=await this.executeAPI(e);if(!s.success)return s;t.data=s.data}return e.onClick&&await e.onClick(),t.reload=e.reload!==!1,t.close=e.close!==!1,e.redirect&&(t.redirect=this.evaluator.evaluate(e.redirect)),t}async executeNavigation(e){const t=e.navigate||e,s=this.evaluator.evaluate(t.to||t.target);if(!this.isValidUrl(s))return{success:!1,error:"Invalid URL scheme. Only http://, https://, and relative URLs are allowed."};const n=t.external||typeof s=="string"&&(s.startsWith("http://")||s.startsWith("https://"));if(this.navigationHandler)return this.navigationHandler(s,{external:n,newTab:t.newTab??n,replace:t.replace}),{success:!0};if(n)window.open(s,"_blank","noopener,noreferrer");else return{success:!0,redirect:s};return{success:!0}}async executeAPI(e){const t=e.api||e.endpoint||e.target;if(!t)return{success:!1,error:"No API endpoint provided"};try{let s,n,i={"Content-Type":"application/json"},o,l="json";if(typeof t=="string")s=t,n=e.method||"POST",o=JSON.stringify(e.params||this.context.data||{});else{const p=t;if(s=p.url,n=p.method||e.method||"POST",i={...i,...p.headers},l=p.responseType||"json",p.queryParams){const _=new URLSearchParams(p.queryParams);s=`${s}${s.includes("?")?"&":"?"}${_.toString()}`}p.body?o=typeof p.body=="string"?p.body:JSON.stringify(p.body):n!=="GET"&&n!=="HEAD"&&(o=JSON.stringify(e.params||this.context.data||{}))}const g={method:n,headers:i};o&&n!=="GET"&&n!=="HEAD"&&(g.body=o);const y=await fetch(s,g);if(!y.ok)throw new Error(`HTTP ${y.status}: ${y.statusText}`);let A;switch(l){case"text":A=await y.text();break;case"blob":A=await y.blob();break;default:A=await y.json()}return{success:!0,data:A}}catch(s){return{success:!1,error:s.message}}}isValidUrl(e){return typeof e=="string"&&(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")||e.startsWith("./"))}updateContext(e){this.context={...this.context,...e},this.evaluator.updateContext(e)}getContext(){return this.context}getEvaluator(){return this.evaluator}}function ct(r){if(typeof r!="object"||r===null)return!1;const e=r;return typeof e.id=="string"&&typeof e.type=="string"&&typeof e.objectName=="string"&&typeof e.recordId=="string"&&typeof e.timestamp=="number"}class ke{undoStack=[];redoStack=[];maxHistory;listeners=new Set;constructor(e){this.maxHistory=e?.maxHistory??50}push(e){this.undoStack.push(e),this.undoStack.length>this.maxHistory&&this.undoStack.shift(),this.redoStack=[],this.notify()}peekUndo(){return this.undoStack[this.undoStack.length-1]}peekRedo(){return this.redoStack[this.redoStack.length-1]}popUndo(){const e=this.undoStack.pop();return e&&(this.redoStack.push(e),this.notify()),e}popRedo(){const e=this.redoStack.pop();return e&&(this.undoStack.push(e),this.notify()),e}clear(){this.undoStack=[],this.redoStack=[],this.notify()}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}get undoCount(){return this.undoStack.length}get redoCount(){return this.redoStack.length}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}getHistory(){return[...this.undoStack]}getRedoHistory(){return[...this.redoStack]}pushBatch(e){e.length!==0&&(this.undoStack.push(...e),this.undoStack.length>this.maxHistory&&this.undoStack.splice(0,this.undoStack.length-this.maxHistory),this.redoStack=[],this.notify())}popUndoBatch(e){const t=Math.min(e,this.undoStack.length);if(t===0)return[];const s=this.undoStack.splice(this.undoStack.length-t,t);return this.redoStack.push(...s),this.notify(),s}popRedoBatch(e){const t=Math.min(e,this.redoStack.length);if(t===0)return[];const s=this.redoStack.splice(this.redoStack.length-t,t);return this.undoStack.push(...s),this.notify(),s}static STORAGE_KEY="objectui:undo-history";saveToStorage(){try{const e=JSON.stringify({undoStack:this.undoStack,redoStack:this.redoStack});localStorage.setItem(ke.STORAGE_KEY,e)}catch{}}loadFromStorage(){try{if(typeof localStorage>"u")return;const e=localStorage.getItem(ke.STORAGE_KEY);if(!e)return;const t=JSON.parse(e);Array.isArray(t.undoStack)&&(this.undoStack=t.undoStack.filter(ct)),Array.isArray(t.redoStack)&&(this.redoStack=t.redoStack.filter(ct)),this.undoStack.length>this.maxHistory&&this.undoStack.splice(0,this.undoStack.length-this.maxHistory),this.notify()}catch{}}notify(){this.listeners.forEach(e=>e())}}const ue=new ke;var or={};const ce="__debug";function ur(r){let e=r;if(e===void 0)try{e=typeof window<"u"?window.location.search:""}catch{e=""}const t=new URLSearchParams(e),s=t.has(ce),n=t.has(`${ce}_schema`),i=t.has(`${ce}_perf`),o=t.has(`${ce}_data`),l=t.has(`${ce}_expr`),g=t.has(`${ce}_events`),y=t.has(`${ce}_registry`);return{enabled:s||(n||i||o||l||g||y),...n&&{schema:n},...i&&{perf:i},...o&&{data:o},...l&&{expr:l},...g&&{events:g},...y&&{registry:y}}}function Be(){try{if(typeof window<"u")try{if(ur(window.location.search).enabled)return!0}catch{}const r=typeof globalThis<"u"&&globalThis.OBJECTUI_DEBUG;return r===!0||r==="true"||typeof process<"u"&&or?.OBJECTUI_DEBUG==="true"}catch{return!1}}function dt(r,e,t){Be()&&(t!==void 0?console.log(`[ObjectUI Debug][${r}] ${e}`,t):console.log(`[ObjectUI Debug][${r}] ${e}`))}const Pe=new Map;function lr(r){Be()&&Pe.set(r,performance.now())}function cr(r){if(!Be())return;const e=Pe.get(r);if(e!==void 0){const t=(performance.now()-e).toFixed(2);console.log(`[ObjectUI Debug][perf] ${r}: ${t}ms`),Pe.delete(r)}}const ft=200;class de{static instance=null;entries=[];subscribers=new Set;static getInstance(){return de.instance||(de.instance=new de),de.instance}static resetInstance(){de.instance=null}addPerf(e){this.push({kind:"perf",data:e})}addExpr(e){this.push({kind:"expr",data:e})}addEvent(e){this.push({kind:"event",data:e})}getEntries(e){return e?this.entries.filter(t=>t.kind===e):this.entries.slice()}clear(){this.entries=[]}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}push(e){this.entries.push(e),this.entries.length>ft&&(this.entries=this.entries.slice(-ft));for(const t of this.subscribers)try{t(e)}catch{}}}const De=v.createContext(null),is=({children:r,dataSource:e,debug:t,debugFlags:s})=>{const n=v.useMemo(()=>({dataSource:e,debug:t,debugFlags:s}),[e,t,s]);return Q.jsx(De.Provider,{value:n,children:r})},as=()=>{const r=v.useContext(De);if(!r)throw new Error("useSchemaContext must be used within a SchemaRendererProvider");return r},os=r=>{const t=v.useContext(De)?.dataSource;if(r&&t)return r.split(".").reduce((s,n)=>s&&s[n],t)};function dr(r){if(r!=null)return typeof r=="string"?r:r.defaultValue||r.key}function fr(r){const e={};return r.ariaLabel&&(e["aria-label"]=dr(r.ariaLabel)),r.ariaDescribedBy&&(e["aria-describedby"]=r.ariaDescribedBy),r.role&&(e.role=r.role),e}class hr extends v.Component{state={hasError:!1,error:null};static getDerivedStateFromError(e){return{hasError:!0,error:e}}handleRetry=()=>{this.setState({hasError:!1,error:null})};render(){if(this.state.hasError&&this.state.error){const e=this.state.error;return Q.jsxs("div",{className:"p-4 border border-orange-400 rounded bg-orange-50 text-orange-700 my-2",role:"alert",children:[Q.jsxs("p",{className:"font-medium",children:["Component",this.props.componentType?` "${this.props.componentType}"`:""," failed to render"]}),Q.jsx("p",{className:"text-sm mt-1",children:e.message}),!1,Q.jsx("button",{onClick:this.handleRetry,className:"mt-2 text-sm underline hover:no-underline",children:"Retry"})]})}return this.props.children}}const gr=v.forwardRef(({schema:r,...e},t)=>{const s=v.useContext(De),n=s?.dataSource||{},i=v.useMemo(()=>{if(!r||typeof r=="string")return r;const P=new ye({data:n}),V={...r};if(V.properties&&Object.assign(V,V.properties),typeof V.content=="string"&&(V.content=P.evaluate(V.content)),V.props){const O={...V.props};for(const[H,z]of Object.entries(O))O[H]=P.evaluate(z);V.props=O}return(V.visible!==void 0?!P.evaluateCondition(V.visible):V.visibleOn!==void 0?!P.evaluateCondition(V.visibleOn):V.hidden!==void 0?P.evaluateCondition(V.hidden):V.hiddenOn!==void 0?P.evaluateCondition(V.hiddenOn):!1)&&(V._hidden=!0),(V.disabled!==void 0?P.evaluateCondition(V.disabled):V.disabledOn!==void 0?P.evaluateCondition(V.disabledOn):!1)&&(V._disabled=!0),V},[r,n]);if(!i||i?._hidden)return null;if(typeof i=="string")return Q.jsx(Q.Fragment,{children:i});dt("schema","Rendering schema node",{type:i.type,id:i.id});const o=tr.get(i.type);if(!o)return dt("schema","Component not found in registry",{type:i.type}),Q.jsxs("div",{className:"p-4 border border-red-500 rounded text-red-500 bg-red-50 my-2",role:"alert",children:[Q.jsxs("p",{className:"font-medium",children:["Unknown component type: ",Q.jsx("strong",{children:i.type})]}),!1,Q.jsx("pre",{className:"text-xs mt-2 overflow-auto",children:JSON.stringify(i,null,2)})]});const{type:l,children:g,body:y,schema:A,visible:p,visibleOn:_,hidden:b,hiddenOn:$,disabled:T,disabledOn:x,_hidden:k,_disabled:S,...R}=i,E=fr(i),F=s?.debug||s?.debugFlags?.enabled,q={};F&&(q["data-debug-type"]=i.type,i.id&&(q["data-debug-id"]=i.id)),lr(`render:${i.type}:${i.id??"anon"}`);const ee=F?performance.now():0,te=Q.jsx(hr,{componentType:i.type,children:C.createElement(o,{schema:i,...R,...i.props||{},...E,...q,disabled:S||void 0,className:i.className,"data-obj-id":i.id,"data-obj-type":i.type,...e})});if(cr(`render:${i.type}:${i.id??"anon"}`),F&&ee){const P=performance.now()-ee;de.getInstance().addPerf({type:i.type,id:i.id,durationMs:P,timestamp:Date.now()})}return te});gr.displayName="SchemaRenderer";function us(r,e={}){return v.useMemo(()=>new ye(e).evaluateCondition(r),[r,e])}function ls(r={}){const e="context"in r?r:{context:r},{context:t={},onConfirm:s,onToast:n,onModal:i,onNavigate:o}=e,[l,g]=v.useState(!1),[y,A]=v.useState(null),[p,_]=v.useState(null),b=v.useMemo(()=>{const x=new Vt(t);return s&&x.setConfirmHandler(s),n&&x.setToastHandler(n),i&&x.setModalHandler(i),o&&x.setNavigationHandler(o),x},[JSON.stringify(t)]),$=v.useCallback(async x=>{g(!0),A(null),_(null);try{const k=await b.execute(x);return _(k),k.success||A(k.error||"Action failed"),k}catch(k){const S=k.message;A(S);const R={success:!1,error:S};return _(R),R}finally{g(!1)}},[b]),T=v.useCallback(x=>{b.updateContext(x)},[b]);return{execute:$,loading:l,error:y,result:p,updateContext:T,runner:b}}function cs(r){const{navigation:e,objectName:t,onNavigate:s,onRowClick:n}=r,[i,o]=v.useState(!1),[l,g]=v.useState(null),y=e?.mode??"page",A=e?.width,p=e?.view,_=y==="drawer"||y==="modal"||y==="split"||y==="popover",b=v.useCallback(()=>{o(!1),g(null)},[]),$=v.useCallback(x=>{g(x),o(!0)},[]),T=v.useCallback(x=>{if(n){n(x);return}if(!e){const k=x._id||x.id;s&&k!=null&&s(k,p??"view");return}if(!(y==="none"||e.preventNavigation)){if(y==="new_window"||e.openNewTab){const k=x._id||x.id;if(s&&k!=null){s(k,"new_window");return}const S=p?`/${p}`:"",R=t?`/${t}/${k}${S}`:`/${k}${S}`;window.open(R,"_blank");return}if(y==="page"){const k=x._id||x.id;s&&k!=null&&s(k,p??"view");return}if(_){g(x),o(!0);return}}},[n,e,y,t,s,_]);return v.useMemo(()=>({isOpen:i,selectedRecord:l,mode:y,close:b,open:$,setIsOpen:o,handleClick:T,width:A,view:p,isOverlay:_}),[i,l,y,b,$,T,A,p,_])}const yr=v.createContext(null);function ht(r){if(!r||r.length===0)return{};const e={};for(const t of r)if(t.defaultValue!==void 0)e[t.name]=t.defaultValue;else switch(t.type){case"number":e[t.name]=0;break;case"boolean":e[t.name]=!1;break;case"object":e[t.name]={};break;case"array":e[t.name]=[];break;case"string":default:e[t.name]="";break}return e}const pr=({definitions:r,children:e})=>{const[t,s]=v.useState(()=>ht(r)),n=v.useCallback((g,y)=>{s(A=>({...A,[g]:y}))},[]),i=v.useCallback(g=>{s(y=>({...y,...g}))},[]),o=v.useCallback(()=>{s(ht(r))},[r]),l=v.useMemo(()=>({variables:t,setVariable:n,setVariables:i,resetVariables:o}),[t,n,i,o]);return Q.jsx(yr.Provider,{value:l,children:e})};pr.displayName="PageVariablesProvider";const mr={compact:32,comfortable:40,spacious:52},br={compact:"py-1 px-2",comfortable:"py-2 px-3",spacious:"py-3 px-4"},vr={compact:"text-xs",comfortable:"text-sm",spacious:"text-base"},Ie=["compact","comfortable","spacious"];function ds(r="comfortable",e){const[t,s]=v.useState(r),n=mr,i=br,o=vr,l=v.useCallback(()=>{s(g=>{const y=Ie.indexOf(g);return Ie[(y+1)%Ie.length]})},[]);return v.useMemo(()=>({mode:t,setMode:s,cycle:l,rowHeight:n[t],paddingClass:i[t],fontSizeClass:o[t]}),[t,l,n,i,o])}v.createContext(null);function wr(r){return typeof window>"u"?()=>{}:(window.addEventListener("online",r),window.addEventListener("offline",r),()=>{window.removeEventListener("online",r),window.removeEventListener("offline",r)})}function Sr(){return typeof navigator<"u"?navigator.onLine:!0}function xr(){return!0}const Dt="objectui-offline-queue";function _r(){if(typeof localStorage>"u")return[];try{const r=localStorage.getItem(Dt);return r?JSON.parse(r):[]}catch{return[]}}function Cr(r){if(!(typeof localStorage>"u"))try{localStorage.setItem(Dt,JSON.stringify(r))}catch{}}let gt=0;function Ar(){return gt+=1,`mut_${Date.now()}_${gt}`}const we={enabled:!0,strategy:"network_first",offlineIndicator:!0,offlineMessage:"You are currently offline. Changes will be synced when reconnected.",queueMaxSize:100};function fs(r={}){const{enabled:e=we.enabled,strategy:t=we.strategy,offlineIndicator:s=we.offlineIndicator,offlineMessage:n=we.offlineMessage,queueMaxSize:i=we.queueMaxSize,sync:o}=r,l=v.useSyncExternalStore(wr,Sr,xr),[g,y]=v.useState(_r),[A,p]=v.useState("idle"),_=v.useRef(o);_.current=o,v.useEffect(()=>{Cr(g)},[g]),v.useEffect(()=>{e&&(l?A==="offline"&&p("idle"):p("offline"))},[l,e,A]);const b=v.useCallback(x=>{e&&y(k=>{const S={...x,id:Ar(),timestamp:Date.now()},R=[...k,S];return R.length>i?R.slice(R.length-i):R})},[e,i]),$=v.useCallback(()=>{y([])},[]),T=v.useCallback(async()=>{if(!(!e||g.length===0)){p("syncing");try{const x=_.current?.batchSize??g.length,k=g.slice(0,x);await new Promise(S=>setTimeout(S,0)),y(S=>S.filter(R=>!k.some(E=>E.id===R.id))),p("idle")}catch{p("error")}}},[e,g]);return v.useEffect(()=>{if(!e||!l||g.length===0)return;const x=setTimeout(()=>{T()},100);return()=>clearTimeout(x)},[l,e]),v.useMemo(()=>({isOnline:l,enabled:e,syncState:A,strategy:t,pendingCount:g.length,queueMutation:b,sync:T,clearQueue:$,showIndicator:s&&!l,offlineMessage:n}),[l,e,A,t,g.length,b,T,$,s,n])}function Ot(){return{canUndo:ue.canUndo,canRedo:ue.canRedo,undoDescription:ue.peekUndo()?.description,redoDescription:ue.peekRedo()?.description,history:ue.getHistory()}}function kr(){return{canUndo:!1,canRedo:!1,undoDescription:void 0,redoDescription:void 0,history:[]}}let Tt=Ot();function Er(r){return ue.subscribe(()=>{Tt=Ot(),r()})}function Fr(){return Tt}function hs(r={}){const e=v.useRef(r);e.current=r;const t=v.useSyncExternalStore(Er,Fr,kr),s=v.useCallback(async(o,l,g)=>{const y=e.current.dataSource;if(!y)return;const A=g==="undo"?{create:"delete",update:"update",delete:"create"}[o.type]:o.type;A==="delete"?await y.delete(o.objectName,o.recordId):A==="update"?await y.update(o.objectName,o.recordId,l):await y.create(o.objectName,l)},[]),n=v.useCallback(async()=>{const o=ue.popUndo();o&&(await s(o,o.undoData,"undo"),e.current.onUndo?.(o))},[s]),i=v.useCallback(async()=>{const o=ue.popRedo();o&&(await s(o,o.redoData,"redo"),e.current.onRedo?.(o))},[s]);return v.useEffect(()=>{const o=l=>{!(l.ctrlKey||l.metaKey)||l.key.toLowerCase()!=="z"||(l.preventDefault(),l.shiftKey?i():n())};return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[n,i]),v.useMemo(()=>({...t,undo:n,redo:i}),[t,n,i])}const Vr=v.createContext(null);function gs(){const r=v.useContext(Vr);if(!r){const e=new Vt;return{execute:t=>e.execute(t),executeChain:(t,s)=>e.executeChain(t,s),loading:!1,error:null,result:null,runner:e,updateContext:t=>e.updateContext(t)}}return r}v.createContext(null);const Rt=v.createContext(null);function ys(){const r=v.useContext(Rt);if(!r)throw new Error("useDnd must be used within a <DndProvider>. Wrap your app with <DndProvider> to use the drag and drop system.");return r}function ps(){return v.useContext(Rt)!==null}var Ce=r=>r.type==="checkbox",fe=r=>r instanceof Date,J=r=>r==null;const Mt=r=>typeof r=="object";var B=r=>!J(r)&&!Array.isArray(r)&&Mt(r)&&!fe(r),Nt=r=>B(r)&&r.target?Ce(r.target)?r.target.checked:r.target.value:r,Dr=r=>r.substring(0,r.search(/\.\d+(\.|$)/))||r,$t=(r,e)=>r.has(Dr(e)),Or=r=>{const e=r.constructor&&r.constructor.prototype;return B(e)&&e.hasOwnProperty("isPrototypeOf")},qe=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function L(r){if(r instanceof Date)return new Date(r);const e=typeof FileList<"u"&&r instanceof FileList;if(qe&&(r instanceof Blob||e))return r;const t=Array.isArray(r);if(!t&&!(B(r)&&Or(r)))return r;const s=t?[]:Object.create(Object.getPrototypeOf(r));for(const n in r)Object.prototype.hasOwnProperty.call(r,n)&&(s[n]=L(r[n]));return s}var Oe=r=>/^\w*$/.test(r),U=r=>r===void 0,ze=r=>Array.isArray(r)?r.filter(Boolean):[],We=r=>ze(r.replace(/["|']|\]/g,"").split(/\.|\[/)),h=(r,e,t)=>{if(!e||!B(r))return t;const s=(Oe(e)?[e]:We(e)).reduce((n,i)=>J(n)?n:n[i],r);return U(s)||s===r?U(r[e])?t:r[e]:s},X=r=>typeof r=="boolean",G=r=>typeof r=="function",I=(r,e,t)=>{let s=-1;const n=Oe(e)?[e]:We(e),i=n.length,o=i-1;for(;++s<i;){const l=n[s];let g=t;if(s!==o){const y=r[l];g=B(y)||Array.isArray(y)?y:isNaN(+n[s+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;r[l]=g,r=r[l]}};const Ee={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},se={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ie={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Ye=C.createContext(null);Ye.displayName="HookFormControlContext";const Ge=()=>C.useContext(Ye);var It=(r,e,t,s=!0)=>{const n={defaultValues:e._defaultValues};for(const i in r)Object.defineProperty(n,i,{get:()=>{const o=i;return e._proxyFormState[o]!==se.all&&(e._proxyFormState[o]=!s||se.all),t&&(t[o]=!0),r[o]}});return n};const Je=typeof window<"u"?C.useLayoutEffect:C.useEffect;function Tr(r){const e=Ge(),{control:t=e,disabled:s,name:n,exact:i}=r||{},[o,l]=C.useState(t._formState),g=C.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Je(()=>t._subscribe({name:n,formState:g.current,exact:i,callback:y=>{!s&&l({...t._formState,...y})}}),[n,s,i]),C.useEffect(()=>{g.current.isValid&&t._setValid(!0)},[t]),C.useMemo(()=>It(o,t,g.current,!1),[o,t])}var Z=r=>typeof r=="string",He=(r,e,t,s,n)=>Z(r)?(s&&e.watch.add(r),h(t,r,n)):Array.isArray(r)?r.map(i=>(s&&e.watch.add(i),h(t,i))):(s&&(e.watchAll=!0),t),Le=r=>J(r)||!Mt(r);function ne(r,e,t=new WeakSet){if(Le(r)||Le(e))return Object.is(r,e);if(fe(r)&&fe(e))return Object.is(r.getTime(),e.getTime());const s=Object.keys(r),n=Object.keys(e);if(s.length!==n.length)return!1;if(t.has(r)||t.has(e))return!0;t.add(r),t.add(e);for(const i of s){const o=r[i];if(!n.includes(i))return!1;if(i!=="ref"){const l=e[i];if(fe(o)&&fe(l)||B(o)&&B(l)||Array.isArray(o)&&Array.isArray(l)?!ne(o,l,t):!Object.is(o,l))return!1}}return!0}function Rr(r){const e=Ge(),{control:t=e,name:s,defaultValue:n,disabled:i,exact:o,compute:l}=r||{},g=C.useRef(n),y=C.useRef(l),A=C.useRef(void 0),p=C.useRef(t),_=C.useRef(s);y.current=l;const[b,$]=C.useState(()=>{const E=t._getWatch(s,g.current);return y.current?y.current(E):E}),T=C.useCallback(E=>{const F=He(s,t._names,E||t._formValues,!1,g.current);return y.current?y.current(F):F},[t._formValues,t._names,s]),x=C.useCallback(E=>{if(!i){const F=He(s,t._names,E||t._formValues,!1,g.current);if(y.current){const q=y.current(F);ne(q,A.current)||($(q),A.current=q)}else $(F)}},[t._formValues,t._names,i,s]);Je(()=>((p.current!==t||!ne(_.current,s))&&(p.current=t,_.current=s,x()),t._subscribe({name:s,formState:{values:!0},exact:o,callback:E=>{x(E.values)}})),[t,o,s,x]),C.useEffect(()=>t._removeUnmounted());const k=p.current!==t,S=_.current,R=C.useMemo(()=>{if(i)return null;const E=!k&&!ne(S,s);return k||E?T():null},[i,k,s,S,T]);return R!==null?R:b}function Mr(r){const e=Ge(),{name:t,disabled:s,control:n=e,shouldUnregister:i,defaultValue:o,exact:l=!0}=r,g=$t(n._names.array,t),y=C.useMemo(()=>h(n._formValues,t,h(n._defaultValues,t,o)),[n,t,o]),A=Rr({control:n,name:t,defaultValue:y,exact:l}),p=Tr({control:n,name:t,exact:l}),_=C.useRef(r),b=C.useRef(void 0),$=C.useRef(n.register(t,{...r.rules,value:A,...X(r.disabled)?{disabled:r.disabled}:{}}));_.current=r;const T=C.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!h(p.errors,t)},isDirty:{enumerable:!0,get:()=>!!h(p.dirtyFields,t)},isTouched:{enumerable:!0,get:()=>!!h(p.touchedFields,t)},isValidating:{enumerable:!0,get:()=>!!h(p.validatingFields,t)},error:{enumerable:!0,get:()=>h(p.errors,t)}}),[p,t]),x=C.useCallback(E=>$.current.onChange({target:{value:Nt(E),name:t},type:Ee.CHANGE}),[t]),k=C.useCallback(()=>$.current.onBlur({target:{value:h(n._formValues,t),name:t},type:Ee.BLUR}),[t,n._formValues]),S=C.useCallback(E=>{const F=h(n._fields,t);F&&F._f&&E&&(F._f.ref={focus:()=>G(E.focus)&&E.focus(),select:()=>G(E.select)&&E.select(),setCustomValidity:q=>G(E.setCustomValidity)&&E.setCustomValidity(q),reportValidity:()=>G(E.reportValidity)&&E.reportValidity()})},[n._fields,t]),R=C.useMemo(()=>({name:t,value:A,...X(s)||p.disabled?{disabled:p.disabled||s}:{},onChange:x,onBlur:k,ref:S}),[t,s,p.disabled,x,k,S,A]);return C.useEffect(()=>{const E=n._options.shouldUnregister||i,F=b.current;F&&F!==t&&!g&&n.unregister(F),n.register(t,{..._.current.rules,...X(_.current.disabled)?{disabled:_.current.disabled}:{}});const q=(ee,te)=>{const P=h(n._fields,ee);P&&P._f&&(P._f.mount=te)};if(q(t,!0),E){const ee=L(h(n._options.defaultValues,t,_.current.defaultValue));I(n._defaultValues,t,ee),U(h(n._formValues,t))&&I(n._formValues,t,ee)}return!g&&n.register(t),b.current=t,()=>{(g?E&&!n._state.action:E)?n.unregister(t):q(t,!1)}},[t,n,g,i]),C.useEffect(()=>{n._setDisabledField({disabled:s,name:t})},[s,t,n]),C.useMemo(()=>({field:R,formState:p,fieldState:T}),[R,p,T])}const ms=r=>r.render(Mr(r)),Ke=C.createContext(null);Ke.displayName="HookFormContext";const bs=()=>C.useContext(Ke),vs=r=>{const{children:e,watch:t,getValues:s,getFieldState:n,setError:i,clearErrors:o,setValue:l,trigger:g,formState:y,resetField:A,reset:p,handleSubmit:_,unregister:b,control:$,register:T,setFocus:x,subscribe:k}=r;return C.createElement(Ke.Provider,{value:C.useMemo(()=>({watch:t,getValues:s,getFieldState:n,setError:i,clearErrors:o,setValue:l,trigger:g,formState:y,resetField:A,reset:p,handleSubmit:_,unregister:b,control:$,register:T,setFocus:x,subscribe:k}),[o,$,y,n,s,_,T,p,A,i,x,l,k,g,b,t])},C.createElement(Ye.Provider,{value:$},e))};var Nr=(r,e,t,s,n)=>e?{...t[r],types:{...t[r]&&t[r].types?t[r].types:{},[s]:n||!0}}:{},xe=r=>Array.isArray(r)?r:[r],yt=()=>{let r=[];return{get observers(){return r},next:n=>{for(const i of r)i.next&&i.next(n)},subscribe:n=>(r.push(n),{unsubscribe:()=>{r=r.filter(i=>i!==n)}}),unsubscribe:()=>{r=[]}}};function Ut(r,e){const t={};for(const s in r)if(r.hasOwnProperty(s)){const n=r[s],i=e[s];if(n&&B(n)&&i){const o=Ut(n,i);B(o)&&(t[s]=o)}else r[s]&&(t[s]=i)}return t}var Y=r=>B(r)&&!Object.keys(r).length,Qe=r=>r.type==="file",Fe=r=>{if(!qe)return!1;const e=r?r.ownerDocument:0;return r instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},Pt=r=>r.type==="select-multiple",Xe=r=>r.type==="radio",$r=r=>Xe(r)||Ce(r),Ue=r=>Fe(r)&&r.isConnected;function Ir(r,e){const t=e.slice(0,-1).length;let s=0;for(;s<t;)r=U(r)?s++:r[e[s++]];return r}function Ur(r){for(const e in r)if(r.hasOwnProperty(e)&&!U(r[e]))return!1;return!0}function j(r,e){const t=Array.isArray(e)?e:Oe(e)?[e]:We(e),s=t.length===1?r:Ir(r,t),n=t.length-1,i=t[n];return s&&delete s[i],n!==0&&(B(s)&&Y(s)||Array.isArray(s)&&Ur(s))&&j(r,t.slice(0,-1)),r}var Pr=r=>{for(const e in r)if(G(r[e]))return!0;return!1};function Ht(r){return Array.isArray(r)||B(r)&&!Pr(r)}function je(r,e={}){for(const t in r){const s=r[t];Ht(s)?(e[t]=Array.isArray(s)?[]:{},je(s,e[t])):U(s)||(e[t]=!0)}return e}function ge(r,e,t){t||(t=je(e));for(const s in r){const n=r[s];if(Ht(n))U(e)||Le(t[s])?t[s]=je(n,Array.isArray(n)?[]:{}):ge(n,J(e)?{}:e[s],t[s]);else{const i=e[s];t[s]=!ne(n,i)}}return t}const pt={value:!1,isValid:!1},mt={value:!0,isValid:!0};var Lt=r=>{if(Array.isArray(r)){if(r.length>1){const e=r.filter(t=>t&&t.checked&&!t.disabled).map(t=>t.value);return{value:e,isValid:!!e.length}}return r[0].checked&&!r[0].disabled?r[0].attributes&&!U(r[0].attributes.value)?U(r[0].value)||r[0].value===""?mt:{value:r[0].value,isValid:!0}:mt:pt}return pt},jt=(r,{valueAsNumber:e,valueAsDate:t,setValueAs:s})=>U(r)?r:e?r===""?NaN:r&&+r:t&&Z(r)?new Date(r):s?s(r):r;const bt={isValid:!1,value:null};var Bt=r=>Array.isArray(r)?r.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,bt):bt;function vt(r){const e=r.ref;return Qe(e)?e.files:Xe(e)?Bt(r.refs).value:Pt(e)?[...e.selectedOptions].map(({value:t})=>t):Ce(e)?Lt(r.refs).value:jt(U(e.value)?r.ref.value:e.value,r)}var Hr=(r,e,t,s)=>{const n={};for(const i of r){const o=h(e,i);o&&I(n,i,o._f)}return{criteriaMode:t,names:[...r],fields:n,shouldUseNativeValidation:s}},Ve=r=>r instanceof RegExp,Se=r=>U(r)?r:Ve(r)?r.source:B(r)?Ve(r.value)?r.value.source:r.value:r,wt=r=>({isOnSubmit:!r||r===se.onSubmit,isOnBlur:r===se.onBlur,isOnChange:r===se.onChange,isOnAll:r===se.all,isOnTouch:r===se.onTouched});const St="AsyncFunction";var Lr=r=>!!r&&!!r.validate&&!!(G(r.validate)&&r.validate.constructor.name===St||B(r.validate)&&Object.values(r.validate).find(e=>e.constructor.name===St)),jr=r=>r.mount&&(r.required||r.min||r.max||r.maxLength||r.minLength||r.pattern||r.validate),xt=(r,e,t)=>!t&&(e.watchAll||e.watch.has(r)||[...e.watch].some(s=>r.startsWith(s)&&/^\.\w+/.test(r.slice(s.length))));const _e=(r,e,t,s)=>{for(const n of t||Object.keys(r)){const i=h(r,n);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&e(o.refs[0],n)&&!s)return!0;if(o.ref&&e(o.ref,o.name)&&!s)return!0;if(_e(l,e))break}else if(B(l)&&_e(l,e))break}}};function _t(r,e,t){const s=h(r,t);if(s||Oe(t))return{error:s,name:t};const n=t.split(".");for(;n.length;){const i=n.join("."),o=h(e,i),l=h(r,i);if(o&&!Array.isArray(o)&&t!==i)return{name:t};if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};n.pop()}return{name:t}}var Br=(r,e,t,s)=>{t(r);const{name:n,...i}=r;return Y(i)||Object.keys(i).length>=Object.keys(e).length||Object.keys(i).find(o=>e[o]===(!s||se.all))},qr=(r,e,t)=>!r||!e||r===e||xe(r).some(s=>s&&(t?s===e:s.startsWith(e)||e.startsWith(s))),zr=(r,e,t,s,n)=>n.isOnAll?!1:!t&&n.isOnTouch?!(e||r):(t?s.isOnBlur:n.isOnBlur)?!r:(t?s.isOnChange:n.isOnChange)?r:!0,Wr=(r,e)=>!ze(h(r,e)).length&&j(r,e),Yr=(r,e,t)=>{const s=xe(h(r,t));return I(s,"root",e[t]),I(r,t,s),r};function Ct(r,e,t="validate"){if(Z(r)||Array.isArray(r)&&r.every(Z)||X(r)&&!r)return{type:t,message:Z(r)?r:"",ref:e}}var he=r=>B(r)&&!Ve(r)?r:{value:r,message:""},At=async(r,e,t,s,n,i)=>{const{ref:o,refs:l,required:g,maxLength:y,minLength:A,min:p,max:_,pattern:b,validate:$,name:T,valueAsNumber:x,mount:k}=r._f,S=h(t,T);if(!k||e.has(T))return{};const R=l?l[0]:o,E=D=>{n&&R.reportValidity&&(R.setCustomValidity(X(D)?"":D||""),R.reportValidity())},F={},q=Xe(o),ee=Ce(o),te=q||ee,P=(x||Qe(o))&&U(o.value)&&U(S)||Fe(o)&&o.value===""||S===""||Array.isArray(S)&&!S.length,V=Nr.bind(null,T,s,F),pe=(D,O,H,z=ie.maxLength,re=ie.minLength)=>{const K=D?O:H;F[T]={type:D?z:re,message:K,ref:o,...V(D?z:re,K)}};if(i?!Array.isArray(S)||!S.length:g&&(!te&&(P||J(S))||X(S)&&!S||ee&&!Lt(l).isValid||q&&!Bt(l).isValid)){const{value:D,message:O}=Z(g)?{value:!!g,message:g}:he(g);if(D&&(F[T]={type:ie.required,message:O,ref:R,...V(ie.required,O)},!s))return E(O),F}if(!P&&(!J(p)||!J(_))){let D,O;const H=he(_),z=he(p);if(!J(S)&&!isNaN(S)){const re=o.valueAsNumber||S&&+S;J(H.value)||(D=re>H.value),J(z.value)||(O=re<z.value)}else{const re=o.valueAsDate||new Date(S),K=ve=>new Date(new Date().toDateString()+" "+ve),me=o.type=="time",be=o.type=="week";Z(H.value)&&S&&(D=me?K(S)>K(H.value):be?S>H.value:re>new Date(H.value)),Z(z.value)&&S&&(O=me?K(S)<K(z.value):be?S<z.value:re<new Date(z.value))}if((D||O)&&(pe(!!D,H.message,z.message,ie.max,ie.min),!s))return E(F[T].message),F}if((y||A)&&!P&&(Z(S)||i&&Array.isArray(S))){const D=he(y),O=he(A),H=!J(D.value)&&S.length>+D.value,z=!J(O.value)&&S.length<+O.value;if((H||z)&&(pe(H,D.message,O.message),!s))return E(F[T].message),F}if(b&&!P&&Z(S)){const{value:D,message:O}=he(b);if(Ve(D)&&!S.match(D)&&(F[T]={type:ie.pattern,message:O,ref:o,...V(ie.pattern,O)},!s))return E(O),F}if($){if(G($)){const D=await $(S,t),O=Ct(D,R);if(O&&(F[T]={...O,...V(ie.validate,O.message)},!s))return E(O.message),F}else if(B($)){let D={};for(const O in $){if(!Y(D)&&!s)break;const H=Ct(await $[O](S,t),R,O);H&&(D={...H,...V(O,H.message)},E(H.message),s&&(F[T]=D))}if(!Y(D)&&(F[T]={ref:R,...D},!s))return F}}return E(!0),F};const Gr={mode:se.onSubmit,reValidateMode:se.onChange,shouldFocusError:!0};function Jr(r={}){let e={...Gr,...r},t={submitCount:0,isDirty:!1,isReady:!1,isLoading:G(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},s={},n=B(e.defaultValues)||B(e.values)?L(e.defaultValues||e.values)||{}:{},i=e.shouldUnregister?{}:L(n),o={action:!1,mount:!1,watch:!1,keepIsValid:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},g,y=0;const A={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},p={...A};let _={...p};const b={array:yt(),state:yt()},$=e.criteriaMode===se.all,T=a=>u=>{clearTimeout(y),y=setTimeout(a,u)},x=async a=>{if(!o.keepIsValid&&!e.disabled&&(p.isValid||_.isValid||a)){let u;e.resolver?(u=Y((await te()).errors),k()):u=await V(s,!0),u!==t.isValid&&b.state.next({isValid:u})}},k=(a,u)=>{!e.disabled&&(p.isValidating||p.validatingFields||_.isValidating||_.validatingFields)&&((a||Array.from(l.mount)).forEach(c=>{c&&(u?I(t.validatingFields,c,u):j(t.validatingFields,c))}),b.state.next({validatingFields:t.validatingFields,isValidating:!Y(t.validatingFields)}))},S=(a,u=[],c,m,f=!0,d=!0)=>{if(m&&c&&!e.disabled){if(o.action=!0,d&&Array.isArray(h(s,a))){const w=c(h(s,a),m.argA,m.argB);f&&I(s,a,w)}if(d&&Array.isArray(h(t.errors,a))){const w=c(h(t.errors,a),m.argA,m.argB);f&&I(t.errors,a,w),Wr(t.errors,a)}if((p.touchedFields||_.touchedFields)&&d&&Array.isArray(h(t.touchedFields,a))){const w=c(h(t.touchedFields,a),m.argA,m.argB);f&&I(t.touchedFields,a,w)}(p.dirtyFields||_.dirtyFields)&&(t.dirtyFields=ge(n,i)),b.state.next({name:a,isDirty:D(a,u),dirtyFields:t.dirtyFields,errors:t.errors,isValid:t.isValid})}else I(i,a,u)},R=(a,u)=>{I(t.errors,a,u),b.state.next({errors:t.errors})},E=a=>{t.errors=a,b.state.next({errors:t.errors,isValid:!1})},F=(a,u,c,m)=>{const f=h(s,a);if(f){const d=h(i,a,U(c)?h(n,a):c);U(d)||m&&m.defaultChecked||u?I(i,a,u?d:vt(f._f)):z(a,d),o.mount&&!o.action&&x()}},q=(a,u,c,m,f)=>{let d=!1,w=!1;const M={name:a};if(!e.disabled){if(!c||m){(p.isDirty||_.isDirty)&&(w=t.isDirty,t.isDirty=M.isDirty=D(),d=w!==M.isDirty);const N=ne(h(n,a),u);w=!!h(t.dirtyFields,a),N?j(t.dirtyFields,a):I(t.dirtyFields,a,!0),M.dirtyFields=t.dirtyFields,d=d||(p.dirtyFields||_.dirtyFields)&&w!==!N}if(c){const N=h(t.touchedFields,a);N||(I(t.touchedFields,a,c),M.touchedFields=t.touchedFields,d=d||(p.touchedFields||_.touchedFields)&&N!==c)}d&&f&&b.state.next(M)}return d?M:{}},ee=(a,u,c,m)=>{const f=h(t.errors,a),d=(p.isValid||_.isValid)&&X(u)&&t.isValid!==u;if(e.delayError&&c?(g=T(()=>R(a,c)),g(e.delayError)):(clearTimeout(y),g=null,c?I(t.errors,a,c):j(t.errors,a)),(c?!ne(f,c):f)||!Y(m)||d){const w={...m,...d&&X(u)?{isValid:u}:{},errors:t.errors,name:a};t={...t,...w},b.state.next(w)}},te=async a=>(k(a,!0),await e.resolver(i,e.context,Hr(a||l.mount,s,e.criteriaMode,e.shouldUseNativeValidation))),P=async a=>{const{errors:u}=await te(a);if(k(a),a)for(const c of a){const m=h(u,c);m?I(t.errors,c,m):j(t.errors,c)}else t.errors=u;return u},V=async(a,u,c={valid:!0})=>{for(const m in a){const f=a[m];if(f){const{_f:d,...w}=f;if(d){const M=l.array.has(d.name),N=f._f&&Lr(f._f);N&&p.validatingFields&&k([d.name],!0);const W=await At(f,l.disabled,i,$,e.shouldUseNativeValidation&&!u,M);if(N&&p.validatingFields&&k([d.name]),W[d.name]&&(c.valid=!1,u||r.shouldUseNativeValidation))break;!u&&(h(W,d.name)?M?Yr(t.errors,W,d.name):I(t.errors,d.name,W[d.name]):j(t.errors,d.name))}!Y(w)&&await V(w,u,c)}}return c.valid},pe=()=>{for(const a of l.unMount){const u=h(s,a);u&&(u._f.refs?u._f.refs.every(c=>!Ue(c)):!Ue(u._f.ref))&&Te(a)}l.unMount=new Set},D=(a,u)=>!e.disabled&&(a&&u&&I(i,a,u),!ne(Ze(),n)),O=(a,u,c)=>He(a,l,{...o.mount?i:U(u)?n:Z(a)?{[a]:u}:u},c,u),H=a=>ze(h(o.mount?i:n,a,e.shouldUnregister?h(n,a,[]):[])),z=(a,u,c={})=>{const m=h(s,a);let f=u;if(m){const d=m._f;d&&(!d.disabled&&I(i,a,jt(u,d)),f=Fe(d.ref)&&J(u)?"":u,Pt(d.ref)?[...d.ref.options].forEach(w=>w.selected=f.includes(w.value)):d.refs?Ce(d.ref)?d.refs.forEach(w=>{(!w.defaultChecked||!w.disabled)&&(Array.isArray(f)?w.checked=!!f.find(M=>M===w.value):w.checked=f===w.value||!!f)}):d.refs.forEach(w=>w.checked=w.value===f):Qe(d.ref)?d.ref.value="":(d.ref.value=f,d.ref.type||b.state.next({name:a,values:L(i)})))}(c.shouldDirty||c.shouldTouch)&&q(a,f,c.shouldTouch,c.shouldDirty,!0),c.shouldValidate&&ve(a)},re=(a,u,c)=>{for(const m in u){if(!u.hasOwnProperty(m))return;const f=u[m],d=a+"."+m,w=h(s,d);(l.array.has(a)||B(f)||w&&!w._f)&&!fe(f)?re(d,f,c):z(d,f,c)}},K=(a,u,c={})=>{const m=h(s,a),f=l.array.has(a),d=L(u);I(i,a,d),f?(b.array.next({name:a,values:L(i)}),(p.isDirty||p.dirtyFields||_.isDirty||_.dirtyFields)&&c.shouldDirty&&b.state.next({name:a,dirtyFields:ge(n,i),isDirty:D(a,d)})):m&&!m._f&&!J(d)?re(a,d,c):z(a,d,c),xt(a,l)?b.state.next({...t,name:a,values:L(i)}):b.state.next({name:o.mount?a:void 0,values:L(i)})},me=async a=>{o.mount=!0;const u=a.target;let c=u.name,m=!0;const f=h(s,c),d=N=>{m=Number.isNaN(N)||fe(N)&&isNaN(N.getTime())||ne(N,h(i,c,N))},w=wt(e.mode),M=wt(e.reValidateMode);if(f){let N,W;const le=u.type?vt(f._f):Nt(a),oe=a.type===Ee.BLUR||a.type===Ee.FOCUS_OUT,Qt=!jr(f._f)&&!e.resolver&&!h(t.errors,c)&&!f._f.deps||zr(oe,h(t.touchedFields,c),t.isSubmitted,M,w),Ne=xt(c,l,oe);I(i,c,le),oe?(!u||!u.readOnly)&&(f._f.onBlur&&f._f.onBlur(a),g&&g(0)):f._f.onChange&&f._f.onChange(a);const $e=q(c,le,oe),Xt=!Y($e)||Ne;if(!oe&&b.state.next({name:c,type:a.type,values:L(i)}),Qt)return(p.isValid||_.isValid)&&(e.mode==="onBlur"?oe&&x():oe||x()),Xt&&b.state.next({name:c,...Ne?{}:$e});if(!oe&&Ne&&b.state.next({...t}),e.resolver){const{errors:ut}=await te([c]);if(k([c]),d(le),m){const Zt=_t(t.errors,s,c),lt=_t(ut,s,Zt.name||c);N=lt.error,c=lt.name,W=Y(ut)}}else k([c],!0),N=(await At(f,l.disabled,i,$,e.shouldUseNativeValidation))[c],k([c]),d(le),m&&(N?W=!1:(p.isValid||_.isValid)&&(W=await V(s,!0)));m&&(f._f.deps&&(!Array.isArray(f._f.deps)||f._f.deps.length>0)&&ve(f._f.deps),ee(c,W,N,$e))}},be=(a,u)=>{if(h(t.errors,u)&&a.focus)return a.focus(),1},ve=async(a,u={})=>{let c,m;const f=xe(a);if(e.resolver){const d=await P(U(a)?a:f);c=Y(d),m=a?!f.some(w=>h(d,w)):c}else a?(m=(await Promise.all(f.map(async d=>{const w=h(s,d);return await V(w&&w._f?{[d]:w}:w)}))).every(Boolean),!(!m&&!t.isValid)&&x()):m=c=await V(s);return b.state.next({...!Z(a)||(p.isValid||_.isValid)&&c!==t.isValid?{}:{name:a},...e.resolver||!a?{isValid:c}:{},errors:t.errors}),u.shouldFocus&&!m&&_e(s,be,a?f:l.mount),m},Ze=(a,u)=>{let c={...o.mount?i:n};return u&&(c=Ut(u.dirtyFields?t.dirtyFields:t.touchedFields,c)),U(a)?c:Z(a)?h(c,a):a.map(m=>h(c,m))},et=(a,u)=>({invalid:!!h((u||t).errors,a),isDirty:!!h((u||t).dirtyFields,a),error:h((u||t).errors,a),isValidating:!!h(t.validatingFields,a),isTouched:!!h((u||t).touchedFields,a)}),qt=a=>{const u=a?xe(a):void 0;u?.forEach(c=>j(t.errors,c)),u?u.forEach(c=>{b.state.next({name:c,errors:t.errors})}):b.state.next({errors:{}})},tt=(a,u,c)=>{const m=(h(s,a,{_f:{}})._f||{}).ref,f=h(t.errors,a)||{},{ref:d,message:w,type:M,...N}=f;I(t.errors,a,{...N,...u,ref:m}),b.state.next({name:a,errors:t.errors,isValid:!1}),c&&c.shouldFocus&&m&&m.focus&&m.focus()},zt=(a,u)=>G(a)?b.state.subscribe({next:c=>"values"in c&&a(O(void 0,u),c)}):O(a,u,!0),rt=a=>b.state.subscribe({next:u=>{qr(a.name,u.name,a.exact)&&Br(u,a.formState||p,Kt,a.reRenderRoot)&&a.callback({values:{...i},...t,...u,defaultValues:n})}}).unsubscribe,Wt=a=>(o.mount=!0,_={..._,...a.formState},rt({...a,formState:{...A,...a.formState}})),Te=(a,u={})=>{for(const c of a?xe(a):l.mount)l.mount.delete(c),l.array.delete(c),u.keepValue||(j(s,c),j(i,c)),!u.keepError&&j(t.errors,c),!u.keepDirty&&j(t.dirtyFields,c),!u.keepTouched&&j(t.touchedFields,c),!u.keepIsValidating&&j(t.validatingFields,c),!e.shouldUnregister&&!u.keepDefaultValue&&j(n,c);b.state.next({values:L(i)}),b.state.next({...t,...u.keepDirty?{isDirty:D()}:{}}),!u.keepIsValid&&x()},st=({disabled:a,name:u})=>{if(X(a)&&o.mount||a||l.disabled.has(u)){const f=l.disabled.has(u)!==!!a;a?l.disabled.add(u):l.disabled.delete(u),f&&o.mount&&!o.action&&x()}},Re=(a,u={})=>{let c=h(s,a);const m=X(u.disabled)||X(e.disabled);return I(s,a,{...c||{},_f:{...c&&c._f?c._f:{ref:{name:a}},name:a,mount:!0,...u}}),l.mount.add(a),c?st({disabled:X(u.disabled)?u.disabled:e.disabled,name:a}):F(a,!0,u.value),{...m?{disabled:u.disabled||e.disabled}:{},...e.progressive?{required:!!u.required,min:Se(u.min),max:Se(u.max),minLength:Se(u.minLength),maxLength:Se(u.maxLength),pattern:Se(u.pattern)}:{},name:a,onChange:me,onBlur:me,ref:f=>{if(f){Re(a,u),c=h(s,a);const d=U(f.value)&&f.querySelectorAll&&f.querySelectorAll("input,select,textarea")[0]||f,w=$r(d),M=c._f.refs||[];if(w?M.find(N=>N===d):d===c._f.ref)return;I(s,a,{_f:{...c._f,...w?{refs:[...M.filter(Ue),d,...Array.isArray(h(n,a))?[{}]:[]],ref:{type:d.type,name:a}}:{ref:d}}}),F(a,!1,void 0,d)}else c=h(s,a,{}),c._f&&(c._f.mount=!1),(e.shouldUnregister||u.shouldUnregister)&&!($t(l.array,a)&&o.action)&&l.unMount.add(a)}}},Me=()=>e.shouldFocusError&&_e(s,be,l.mount),Yt=a=>{X(a)&&(b.state.next({disabled:a}),_e(s,(u,c)=>{const m=h(s,c);m&&(u.disabled=m._f.disabled||a,Array.isArray(m._f.refs)&&m._f.refs.forEach(f=>{f.disabled=m._f.disabled||a}))},0,!1))},nt=(a,u)=>async c=>{let m;c&&(c.preventDefault&&c.preventDefault(),c.persist&&c.persist());let f=L(i);if(b.state.next({isSubmitting:!0}),e.resolver){const{errors:d,values:w}=await te();k(),t.errors=d,f=L(w)}else await V(s);if(l.disabled.size)for(const d of l.disabled)j(f,d);if(j(t.errors,"root"),Y(t.errors)){b.state.next({errors:{}});try{await a(f,c)}catch(d){m=d}}else u&&await u({...t.errors},c),Me(),setTimeout(Me);if(b.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Y(t.errors)&&!m,submitCount:t.submitCount+1,errors:t.errors}),m)throw m},Gt=(a,u={})=>{h(s,a)&&(U(u.defaultValue)?K(a,L(h(n,a))):(K(a,u.defaultValue),I(n,a,L(u.defaultValue))),u.keepTouched||j(t.touchedFields,a),u.keepDirty||(j(t.dirtyFields,a),t.isDirty=u.defaultValue?D(a,L(h(n,a))):D()),u.keepError||(j(t.errors,a),p.isValid&&x()),b.state.next({...t}))},it=(a,u={})=>{const c=a?L(a):n,m=L(c),f=Y(a),d=f?n:m;if(u.keepDefaultValues||(n=c),!u.keepValues){if(u.keepDirtyValues){const w=new Set([...l.mount,...Object.keys(ge(n,i))]);for(const M of Array.from(w)){const N=h(t.dirtyFields,M),W=h(i,M),le=h(d,M);N&&!U(W)?I(d,M,W):!N&&!U(le)&&K(M,le)}}else{if(qe&&U(a))for(const w of l.mount){const M=h(s,w);if(M&&M._f){const N=Array.isArray(M._f.refs)?M._f.refs[0]:M._f.ref;if(Fe(N)){const W=N.closest("form");if(W){W.reset();break}}}}if(u.keepFieldsRef)for(const w of l.mount)K(w,h(d,w));else s={}}i=e.shouldUnregister?u.keepDefaultValues?L(n):{}:L(d),b.array.next({values:{...d}}),b.state.next({values:{...d}})}l={mount:u.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!p.isValid||!!u.keepIsValid||!!u.keepDirtyValues||!e.shouldUnregister&&!Y(d),o.watch=!!e.shouldUnregister,o.keepIsValid=!!u.keepIsValid,o.action=!1,u.keepErrors||(t.errors={}),b.state.next({submitCount:u.keepSubmitCount?t.submitCount:0,isDirty:f?!1:u.keepDirty?t.isDirty:!!(u.keepDefaultValues&&!ne(a,n)),isSubmitted:u.keepIsSubmitted?t.isSubmitted:!1,dirtyFields:f?{}:u.keepDirtyValues?u.keepDefaultValues&&i?ge(n,i):t.dirtyFields:u.keepDefaultValues&&a?ge(n,a):u.keepDirty?t.dirtyFields:{},touchedFields:u.keepTouched?t.touchedFields:{},errors:u.keepErrors?t.errors:{},isSubmitSuccessful:u.keepIsSubmitSuccessful?t.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:n})},at=(a,u)=>it(G(a)?a(i):a,{...e.resetOptions,...u}),Jt=(a,u={})=>{const c=h(s,a),m=c&&c._f;if(m){const f=m.refs?m.refs[0]:m.ref;f.focus&&setTimeout(()=>{f.focus(),u.shouldSelect&&G(f.select)&&f.select()})}},Kt=a=>{t={...t,...a}},ot={control:{register:Re,unregister:Te,getFieldState:et,handleSubmit:nt,setError:tt,_subscribe:rt,_runSchema:te,_updateIsValidating:k,_focusError:Me,_getWatch:O,_getDirty:D,_setValid:x,_setFieldArray:S,_setDisabledField:st,_setErrors:E,_getFieldArray:H,_reset:it,_resetDefaultValues:()=>G(e.defaultValues)&&e.defaultValues().then(a=>{at(a,e.resetOptions),b.state.next({isLoading:!1})}),_removeUnmounted:pe,_disableForm:Yt,_subjects:b,_proxyFormState:p,get _fields(){return s},get _formValues(){return i},get _state(){return o},set _state(a){o=a},get _defaultValues(){return n},get _names(){return l},set _names(a){l=a},get _formState(){return t},get _options(){return e},set _options(a){e={...e,...a}}},subscribe:Wt,trigger:ve,register:Re,handleSubmit:nt,watch:zt,setValue:K,getValues:Ze,reset:at,resetField:Gt,clearErrors:qt,unregister:Te,setError:tt,setFocus:Jt,getFieldState:et};return{...ot,formControl:ot}}function ws(r={}){const e=C.useRef(void 0),t=C.useRef(void 0),[s,n]=C.useState({isDirty:!1,isValidating:!1,isLoading:G(r.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:r.errors||{},disabled:r.disabled||!1,isReady:!1,defaultValues:G(r.defaultValues)?void 0:r.defaultValues});if(!e.current)if(r.formControl)e.current={...r.formControl,formState:s},r.defaultValues&&!G(r.defaultValues)&&r.formControl.reset(r.defaultValues,r.resetOptions);else{const{formControl:o,...l}=Jr(r);e.current={...l,formState:s}}const i=e.current.control;return i._options=r,Je(()=>{const o=i._subscribe({formState:i._proxyFormState,callback:()=>n({...i._formState}),reRenderRoot:!0});return n(l=>({...l,isReady:!0})),i._formState.isReady=!0,o},[i]),C.useEffect(()=>i._disableForm(r.disabled),[i,r.disabled]),C.useEffect(()=>{r.mode&&(i._options.mode=r.mode),r.reValidateMode&&(i._options.reValidateMode=r.reValidateMode)},[i,r.mode,r.reValidateMode]),C.useEffect(()=>{r.errors&&(i._setErrors(r.errors),i._focusError())},[i,r.errors]),C.useEffect(()=>{r.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,r.shouldUnregister]),C.useEffect(()=>{if(i._proxyFormState.isDirty){const o=i._getDirty();o!==s.isDirty&&i._subjects.state.next({isDirty:o})}},[i,s.isDirty]),C.useEffect(()=>{var o;r.values&&!ne(r.values,t.current)?(i._reset(r.values,{keepFieldsRef:!0,...i._options.resetOptions}),!((o=i._options.resetOptions)===null||o===void 0)&&o.keepIsValid||i._setValid(),t.current=r.values,n(l=>({...l}))):i._resetDefaultValues()},[i,r.values]),C.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),e.current.formState=C.useMemo(()=>It(s,i),[i,s]),e.current}function Kr(r,e=0){const t=`migrated_${e}`;return r.type==="separator"?{id:t,type:"separator",label:r.label||""}:r.type==="group"?{id:t,type:"group",label:r.label||"",icon:r.icon,children:(r.children||[]).map((s,n)=>Kr(s,e*100+n)),visible:r.hidden!==void 0?!r.hidden:void 0,badge:r.badge,defaultOpen:!0}:r.href?{id:t,type:"url",label:r.label||"",icon:r.icon,url:r.href,target:"_blank",visible:r.hidden!==void 0?!r.hidden:void 0,badge:r.badge}:{id:t,type:"page",label:r.label||"",icon:r.icon,pageName:r.path||"",visible:r.hidden!==void 0?!r.hidden:void 0,badge:r.badge}}function Ss(r){return/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/.test(r)}function xs(r){return{type:"app",name:r.name,title:r.title,label:r.title,description:r.description,icon:r.icon,logo:r.branding.logo,favicon:r.branding.favicon,branding:r.branding,layout:r.layout,navigation:r.navigation}}export{Ss as A,tr as C,ye as E,vs as F,pr as P,gr as S,ms as a,ws as b,os as c,gs as d,us as e,cs as f,ns as g,ss as h,as as i,es as j,ts as k,ds as l,Kr as m,nr as n,De as o,ps as p,ys as q,dr as r,rs as s,fs as t,bs as u,ur as v,ls as w,hs as x,is as y,xs as z};