@object-ui/console 3.0.3 → 3.1.1

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 (168) hide show
  1. package/README.md +1 -1
  2. package/dist/assets/AdvancedChartImpl-D711bBuO.js +7 -0
  3. package/dist/assets/AppManagementPage-D_71FpIH.js +1 -0
  4. package/dist/assets/AuditLogPage-D3g_VEdE.js +1 -0
  5. package/dist/assets/AuthPageLayout-9l5xWV_-.js +1 -0
  6. package/dist/assets/{ChartImpl-2ivTljUi.js → ChartImpl-B9B4Fnbe.js} +1 -1
  7. package/dist/assets/CreateAppPage-mqt5j4rK.js +1 -0
  8. package/dist/assets/DashboardDesignPage-Cijb3jeF.js +1 -0
  9. package/dist/assets/DashboardView-DjhlMHLV.js +1 -0
  10. package/dist/assets/EditAppPage-BiK_DWcO.js +1 -0
  11. package/dist/assets/ForgotPasswordPage-Bzady8r_.js +1 -0
  12. package/dist/assets/KanbanEnhanced-OvdpYe81.js +1 -0
  13. package/dist/assets/KanbanImpl-EcxwmGw7.js +1 -0
  14. package/dist/assets/LoginPage-valW4Wu1.js +1 -0
  15. package/dist/assets/{MarkdownImpl-BshtTFK2.js → MarkdownImpl-C0wRapHT.js} +2 -2
  16. package/dist/assets/OrgManagementPage-D0d52PdP.js +1 -0
  17. package/dist/assets/PageDesignPage-hpFLdWCR.js +1 -0
  18. package/dist/assets/PageView-DxIAf-SB.js +2 -0
  19. package/dist/assets/PermissionManagementPage-ELCC8HyK.js +1 -0
  20. package/dist/assets/ProfilePage-Dj1N0mY3.js +1 -0
  21. package/dist/assets/RecordDetailView-DS9tEr5f.js +1 -0
  22. package/dist/assets/RegisterPage-DqUU8oW-.js +1 -0
  23. package/dist/assets/ReportView-CNi0A66t.js +1 -0
  24. package/dist/assets/RoleManagementPage-DRvuG53j.js +1 -0
  25. package/dist/assets/SearchResultsPage-nMlMQCb8.js +1 -0
  26. package/dist/assets/SystemHubPage-CAY-YvG2.js +1 -0
  27. package/dist/assets/UserManagementPage-fzvfJxav.js +1 -0
  28. package/dist/assets/data-adapter-rvE3xy2B.js +1 -0
  29. package/dist/assets/framework-BM176iet.js +10 -0
  30. package/dist/assets/index-B6cpm7bF.css +1 -0
  31. package/dist/assets/index-CTBPkbPG.js +9 -0
  32. package/dist/assets/index-Dv78M4Xq.js +1 -0
  33. package/dist/assets/infrastructure-n1j_TN6w.js +1 -0
  34. package/dist/assets/maplibre-gl-DVmJFhI2.js +811 -0
  35. package/dist/assets/plugins-core-qwgXbAqa.js +8 -0
  36. package/dist/assets/plugins-views-CveFN6PV.js +62 -0
  37. package/dist/assets/ui-components-BxvihT61.js +36 -0
  38. package/dist/assets/ui-components-CRV2BvKI.css +1 -0
  39. package/dist/assets/ui-layout-C6KWQtRO.js +1 -0
  40. package/dist/assets/{vendor-charts-CSvoW-yB.js → vendor-charts-BLNOCZWl.js} +2 -2
  41. package/dist/assets/vendor-dndkit-CX1oDZqy.js +5 -0
  42. package/dist/assets/vendor-i18n-E3-WitRV.js +9 -0
  43. package/dist/assets/{vendor-icons-CQ8b-fGy.js → vendor-icons-ndICq8DC.js} +3425 -3535
  44. package/dist/assets/vendor-objectstack-YKtcdalX.js +34 -0
  45. package/dist/assets/{vendor-radix-BbeYj_o4.js → vendor-radix-C6qchjxv.js} +1 -1
  46. package/dist/assets/vendor-react-9M-xu2bR.js +60 -0
  47. package/dist/assets/vendor-ui-utils-3tkeUVaX.js +1 -0
  48. package/dist/assets/vendor-zod-DxQVy2_o.js +39 -0
  49. package/dist/index.html +23 -22
  50. package/package.json +49 -46
  51. package/plugin.d.ts +1 -2
  52. package/plugin.js +1 -2
  53. package/plugin.ts +1 -2
  54. package/dist/assets/AdvancedChartImpl-DAS1mU9o.js +0 -7
  55. package/dist/assets/AdvancedChartImpl-DAS1mU9o.js.br +0 -0
  56. package/dist/assets/AdvancedChartImpl-DAS1mU9o.js.gz +0 -0
  57. package/dist/assets/AuditLogPage-CyY7VZJW.js +0 -1
  58. package/dist/assets/AuditLogPage-CyY7VZJW.js.br +0 -0
  59. package/dist/assets/AuditLogPage-CyY7VZJW.js.gz +0 -0
  60. package/dist/assets/ChartImpl-2ivTljUi.js.br +0 -0
  61. package/dist/assets/ChartImpl-2ivTljUi.js.gz +0 -0
  62. package/dist/assets/DashboardView-DSh9LYBb.js +0 -1
  63. package/dist/assets/DashboardView-DSh9LYBb.js.br +0 -0
  64. package/dist/assets/DashboardView-DSh9LYBb.js.gz +0 -0
  65. package/dist/assets/ForgotPasswordPage-DUfjj-wh.js +0 -1
  66. package/dist/assets/KanbanEnhanced-ZOndyXyg.js +0 -1
  67. package/dist/assets/KanbanEnhanced-ZOndyXyg.js.br +0 -0
  68. package/dist/assets/KanbanEnhanced-ZOndyXyg.js.gz +0 -0
  69. package/dist/assets/KanbanImpl-BsMtStI7.js +0 -1
  70. package/dist/assets/KanbanImpl-BsMtStI7.js.br +0 -0
  71. package/dist/assets/KanbanImpl-BsMtStI7.js.gz +0 -0
  72. package/dist/assets/LoginPage-2CoFvwsL.js +0 -1
  73. package/dist/assets/MarkdownImpl-BshtTFK2.js.br +0 -0
  74. package/dist/assets/MarkdownImpl-BshtTFK2.js.gz +0 -0
  75. package/dist/assets/OrgManagementPage-BJt5Iiun.js +0 -1
  76. package/dist/assets/OrgManagementPage-BJt5Iiun.js.br +0 -0
  77. package/dist/assets/OrgManagementPage-BJt5Iiun.js.gz +0 -0
  78. package/dist/assets/PageView-bHvRhycc.js +0 -1
  79. package/dist/assets/PageView-bHvRhycc.js.br +0 -0
  80. package/dist/assets/PageView-bHvRhycc.js.gz +0 -0
  81. package/dist/assets/ProfilePage-MVUfKMrp.js +0 -1
  82. package/dist/assets/ProfilePage-MVUfKMrp.js.br +0 -0
  83. package/dist/assets/ProfilePage-MVUfKMrp.js.gz +0 -0
  84. package/dist/assets/RecordDetailView-Sm8_iQw_.js +0 -1
  85. package/dist/assets/RecordDetailView-Sm8_iQw_.js.br +0 -0
  86. package/dist/assets/RecordDetailView-Sm8_iQw_.js.gz +0 -0
  87. package/dist/assets/RegisterPage-B9itUVYp.js +0 -1
  88. package/dist/assets/ReportView-B0D9jx4v.js +0 -1
  89. package/dist/assets/ReportView-B0D9jx4v.js.br +0 -0
  90. package/dist/assets/ReportView-B0D9jx4v.js.gz +0 -0
  91. package/dist/assets/RoleManagementPage-BRqaeF_L.js +0 -1
  92. package/dist/assets/RoleManagementPage-BRqaeF_L.js.br +0 -0
  93. package/dist/assets/RoleManagementPage-BRqaeF_L.js.gz +0 -0
  94. package/dist/assets/SearchResultsPage-wlC0eLLr.js +0 -1
  95. package/dist/assets/SearchResultsPage-wlC0eLLr.js.br +0 -0
  96. package/dist/assets/SearchResultsPage-wlC0eLLr.js.gz +0 -0
  97. package/dist/assets/UserManagementPage-DOH6ql6-.js +0 -1
  98. package/dist/assets/UserManagementPage-DOH6ql6-.js.br +0 -0
  99. package/dist/assets/UserManagementPage-DOH6ql6-.js.gz +0 -0
  100. package/dist/assets/ViewDesignerPage-TCaXYb43.js +0 -1
  101. package/dist/assets/ViewDesignerPage-TCaXYb43.js.br +0 -0
  102. package/dist/assets/ViewDesignerPage-TCaXYb43.js.gz +0 -0
  103. package/dist/assets/data-adapter-D15yh-pb.js +0 -1
  104. package/dist/assets/data-adapter-D15yh-pb.js.br +0 -0
  105. package/dist/assets/data-adapter-D15yh-pb.js.gz +0 -0
  106. package/dist/assets/framework-mHWN965c.js +0 -10
  107. package/dist/assets/framework-mHWN965c.js.br +0 -0
  108. package/dist/assets/framework-mHWN965c.js.gz +0 -0
  109. package/dist/assets/index-CUnVdETN.css +0 -1
  110. package/dist/assets/index-CUnVdETN.css.br +0 -0
  111. package/dist/assets/index-CUnVdETN.css.gz +0 -0
  112. package/dist/assets/index-RAPqkKVL.js +0 -9
  113. package/dist/assets/index-RAPqkKVL.js.br +0 -0
  114. package/dist/assets/index-RAPqkKVL.js.gz +0 -0
  115. package/dist/assets/infrastructure-Di0WqY4l.js +0 -1
  116. package/dist/assets/infrastructure-Di0WqY4l.js.br +0 -0
  117. package/dist/assets/infrastructure-Di0WqY4l.js.gz +0 -0
  118. package/dist/assets/maplibre-gl-D2AsLM0J.js +0 -811
  119. package/dist/assets/maplibre-gl-D2AsLM0J.js.br +0 -0
  120. package/dist/assets/maplibre-gl-D2AsLM0J.js.gz +0 -0
  121. package/dist/assets/plugins-core-Cv2TPt86.js +0 -4
  122. package/dist/assets/plugins-core-Cv2TPt86.js.br +0 -0
  123. package/dist/assets/plugins-core-Cv2TPt86.js.gz +0 -0
  124. package/dist/assets/plugins-views-P3eB-els.css.br +0 -0
  125. package/dist/assets/plugins-views-P3eB-els.css.gz +0 -0
  126. package/dist/assets/plugins-views-divN-xXs.js +0 -60
  127. package/dist/assets/plugins-views-divN-xXs.js.br +0 -0
  128. package/dist/assets/plugins-views-divN-xXs.js.gz +0 -0
  129. package/dist/assets/systemObjects-DSpePIIy.js.br +0 -2
  130. package/dist/assets/systemObjects-DSpePIIy.js.gz +0 -0
  131. package/dist/assets/ui-components-CseD2Dpn.js +0 -31
  132. package/dist/assets/ui-components-CseD2Dpn.js.br +0 -0
  133. package/dist/assets/ui-components-CseD2Dpn.js.gz +0 -0
  134. package/dist/assets/ui-components-GrNdJOi1.css +0 -1
  135. package/dist/assets/ui-components-GrNdJOi1.css.br +0 -0
  136. package/dist/assets/ui-components-GrNdJOi1.css.gz +0 -0
  137. package/dist/assets/ui-layout-CF_1bNSv.js +0 -1
  138. package/dist/assets/ui-layout-CF_1bNSv.js.br +0 -0
  139. package/dist/assets/ui-layout-CF_1bNSv.js.gz +0 -0
  140. package/dist/assets/vendor-charts-CSvoW-yB.js.br +0 -0
  141. package/dist/assets/vendor-charts-CSvoW-yB.js.gz +0 -0
  142. package/dist/assets/vendor-dndkit-DRGpK6sP.js +0 -5
  143. package/dist/assets/vendor-dndkit-DRGpK6sP.js.br +0 -0
  144. package/dist/assets/vendor-dndkit-DRGpK6sP.js.gz +0 -0
  145. package/dist/assets/vendor-i18n-D5KbMT7w.js +0 -9
  146. package/dist/assets/vendor-i18n-D5KbMT7w.js.br +0 -0
  147. package/dist/assets/vendor-i18n-D5KbMT7w.js.gz +0 -0
  148. package/dist/assets/vendor-icons-CQ8b-fGy.js.br +0 -0
  149. package/dist/assets/vendor-icons-CQ8b-fGy.js.gz +0 -0
  150. package/dist/assets/vendor-objectstack-Bifvxvds.js +0 -1
  151. package/dist/assets/vendor-objectstack-Bifvxvds.js.br +0 -0
  152. package/dist/assets/vendor-objectstack-Bifvxvds.js.gz +0 -0
  153. package/dist/assets/vendor-radix-BbeYj_o4.js.br +0 -0
  154. package/dist/assets/vendor-radix-BbeYj_o4.js.gz +0 -0
  155. package/dist/assets/vendor-react-Dy_xkBQQ.js +0 -60
  156. package/dist/assets/vendor-react-Dy_xkBQQ.js.br +0 -0
  157. package/dist/assets/vendor-react-Dy_xkBQQ.js.gz +0 -0
  158. package/dist/assets/vendor-ui-utils-h6yAcIi9.js +0 -1
  159. package/dist/assets/vendor-ui-utils-h6yAcIi9.js.br +0 -0
  160. package/dist/assets/vendor-ui-utils-h6yAcIi9.js.gz +0 -0
  161. package/dist/assets/vendor-zod-UZPqlszj.js +0 -39
  162. package/dist/assets/vendor-zod-UZPqlszj.js.br +0 -0
  163. package/dist/assets/vendor-zod-UZPqlszj.js.gz +0 -0
  164. package/dist/index.html.br +0 -0
  165. package/dist/index.html.gz +0 -0
  166. package/dist/mockServiceWorker.js.br +0 -0
  167. package/dist/mockServiceWorker.js.gz +0 -0
  168. package/dist/stats.html +0 -4949
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,7 +0,0 @@
1
- import{r as g,j as e}from"./vendor-react-Dy_xkBQQ.js";import{T,L as W,a as H,P as R,c as F,d as G,e as E,f as X,g as Y,h as Z,i as q,S as M,C as N,X as O,Y as D,Z as U,j as J,A as Q,k as V,B as z,b as ee,l as te,m as ne}from"./vendor-charts-CSvoW-yB.js";import"./vendor-ui-utils-h6yAcIi9.js";import"./vendor-i18n-D5KbMT7w.js";const j=(...a)=>a.filter(Boolean).join(" "),re={light:"",dark:".dark"},I=g.createContext(null);function B(){const a=g.useContext(I);if(!a)throw new Error("useChart must be used within a <ChartContainer />");return a}function y({id:a,className:t,children:n,config:r,...l}){const c=g.useId(),o=`chart-${a||c.replace(/:/g,"")}`;return e.jsx(I.Provider,{value:{config:r},children:e.jsxs("div",{"data-slot":"chart","data-chart":o,className:j("flex w-full h-[350px] justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground",t),...l,children:[e.jsx(ae,{id:o,config:r}),e.jsx(H,{width:"100%",height:"100%",children:n})]})})}const ae=({id:a,config:t})=>{const n=Object.entries(t).filter(([,r])=>r.theme||r.color);return n.length?e.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(re).map(([r,l])=>`
2
- ${l} [data-chart=${a}] {
3
- ${n.map(([c,o])=>{const u=o.theme?.[r]||o.color;return u?` --color-${c}: ${u};`:null}).join(`
4
- `)}
5
- }
6
- `).join(`
7
- `)}}):null},C=T;function w({active:a,payload:t,className:n,indicator:r="dot",hideLabel:l=!1,hideIndicator:c=!1,label:o,labelFormatter:u,labelClassName:h,formatter:m,color:s,nameKey:d,labelKey:f}){const{config:x}=B(),v=g.useMemo(()=>{if(l||!t?.length)return null;const[i]=t,k=`${f||i?.dataKey||i?.name||"value"}`,P=$(x,i,k),p=!f&&typeof o=="string"?x[o]?.label||o:P?.label;return u?e.jsx("div",{className:j("font-medium",h),children:u(p,t)}):p?e.jsx("div",{className:j("font-medium",h),children:p}):null},[o,u,t,l,h,x,f]);if(!a||!t?.length)return null;const b=t.length===1&&r!=="dot";return e.jsxs("div",{className:j("border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl",n),children:[b?null:v,e.jsx("div",{className:"grid gap-1.5",children:t.filter(i=>i.type!=="none").map((i,k)=>{const P=`${d||i.name||i.dataKey||"value"}`,p=$(x,i,P),A=s||i.payload.fill||i.color;return e.jsx("div",{className:j("[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5",r==="dot"?"items-center":""),children:m&&i?.value!==void 0&&i.name?m(i.value,i.name,i,k,i.payload):e.jsxs(e.Fragment,{children:[p?.icon?e.jsx(p.icon,{}):!c&&e.jsx("div",{className:j("shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",r==="dot"?"h-2.5 w-2.5":"",r==="line"?"w-1":"",r==="dashed"?"w-0 border-[1.5px] border-dashed bg-transparent":"",b&&r==="dashed"?"my-0.5":""),style:{"--color-bg":A,"--color-border":A}}),e.jsxs("div",{className:j("flex flex-1 justify-between leading-none",b?"items-end":"items-center"),children:[e.jsxs("div",{className:"grid gap-1.5",children:[b?v:null,e.jsx("span",{className:"text-muted-foreground",children:p?.label||i.name})]}),i.value&&e.jsx("span",{className:"text-foreground font-mono font-medium tabular-nums",children:i.value.toLocaleString()})]})]})},i.dataKey)})})]})}const K=W;function L({className:a,hideIcon:t=!1,payload:n,verticalAlign:r="bottom",nameKey:l}){const{config:c}=B();return n?.length?e.jsx("div",{className:j("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",a),children:n.filter(o=>o.type!=="none").map(o=>{const u=`${l||o.dataKey||"value"}`,h=$(c,o,u);return e.jsxs("div",{className:j("[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3"),children:[h?.icon&&!t?e.jsx(h.icon,{}):e.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:o.color}}),h?.label]},o.value)})}):null}function $(a,t,n){if(typeof t!="object"||t===null)return;const r="payload"in t&&typeof t.payload=="object"&&t.payload!==null?t.payload:void 0;let l=n;return n in t&&typeof t[n]=="string"?l=t[n]:r&&n in r&&typeof r[n]=="string"&&(l=r[n]),l in a?a[l]:a[n]}const _="hsl(var(--primary))",se={slate:"#64748b",gray:"#6b7280",zinc:"#71717a",neutral:"#737373",stone:"#78716c",red:"#ef4444",orange:"#f97316",amber:"#f59e0b",yellow:"#eab308",lime:"#84cc16",green:"#22c55e",emerald:"#10b981",teal:"#14b8a6",cyan:"#06b6d4",sky:"#0ea5e9",blue:"#3b82f6",indigo:"#6366f1",violet:"#8b5cf6",purple:"#a855f7",fuchsia:"#d946ef",pink:"#ec4899",rose:"#f43f5e"},S=a=>se[a]||a;function ce({chartType:a="bar",data:t=[],config:n={},xAxisKey:r="name",series:l=[],className:c=""}){const[o,u]=g.useState(!1);g.useEffect(()=>{const s=()=>u(window.innerWidth<640);return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]);const h={bar:z,line:V,area:Q,pie:R,donut:R,radar:E,scatter:M}[a]||z;console.log("📈 Rendering Chart:",{chartType:a,dataLength:t.length,config:n,series:l,xAxisKey:r});const m=()=>["hsl(var(--chart-1))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))"];if(a==="pie"||a==="donut"){const s=a==="donut"?60:0;return e.jsx(y,{config:n,className:c,children:e.jsxs(R,{children:[e.jsx(C,{cursor:!1,content:e.jsx(w,{hideLabel:!0})}),e.jsx(F,{data:t,dataKey:l[0]?.dataKey||"value",nameKey:r||"name",innerRadius:s,strokeWidth:5,paddingAngle:2,outerRadius:80,children:t.map((d,f)=>{let x=n[d[r]]?.color;if(!x){const v=m();x=v[f%v.length]}return e.jsx(G,{fill:S(x)},`cell-${f}`)})}),e.jsx(K,{content:e.jsx(L,{nameKey:r}),...o&&{verticalAlign:"bottom",wrapperStyle:{fontSize:"11px",paddingTop:"8px"}}})]})})}return a==="radar"?e.jsx(y,{config:n,className:c,children:e.jsxs(E,{data:t,children:[e.jsx(X,{}),e.jsx(Y,{dataKey:r}),e.jsx(Z,{}),e.jsx(C,{content:e.jsx(w,{})}),e.jsx(K,{content:e.jsx(L,{}),...o&&{verticalAlign:"bottom",wrapperStyle:{fontSize:"11px",paddingTop:"8px"}}}),l.map(s=>{const d=S(n[s.dataKey]?.color||_);return e.jsx(q,{dataKey:s.dataKey,stroke:d,fill:d,fillOpacity:.6},s.dataKey)})]})}):a==="scatter"?e.jsx(y,{config:n,className:c,children:e.jsxs(M,{children:[e.jsx(N,{vertical:!1}),e.jsx(O,{type:"number",dataKey:r,name:String(n[r]?.label||r),tickLine:!1,axisLine:!1,interval:o?Math.ceil(t.length/5):0}),e.jsx(D,{type:"number",dataKey:l[0]?.dataKey||"value",name:String(n[l[0]?.dataKey]?.label||l[0]?.dataKey),tickLine:!1,axisLine:!1}),e.jsx(U,{type:"number",range:[60,400]}),e.jsx(C,{content:e.jsx(w,{})}),e.jsx(K,{content:e.jsx(L,{}),...o&&{verticalAlign:"bottom",wrapperStyle:{fontSize:"11px",paddingTop:"8px"}}}),l.map((s,d)=>{const f=m(),x=S(n[s.dataKey]?.color||f[d%f.length]);return e.jsx(J,{name:n[s.dataKey]?.label||s.dataKey,data:t,fill:x},s.dataKey)})]})}):e.jsx(y,{config:n,className:c,children:e.jsxs(h,{data:t,children:[e.jsx(N,{vertical:!1}),e.jsx(O,{dataKey:r,tickLine:!1,tickMargin:10,axisLine:!1,interval:o?Math.ceil(t.length/5):0,tickFormatter:s=>s&&typeof s=="string"?s.slice(0,3):s}),e.jsx(C,{content:e.jsx(w,{})}),e.jsx(K,{content:e.jsx(L,{}),...o&&{verticalAlign:"bottom",wrapperStyle:{fontSize:"11px",paddingTop:"8px"}}}),l.map(s=>{const d=S(n[s.dataKey]?.color||_);return a==="bar"?e.jsx(ee,{dataKey:s.dataKey,fill:d,radius:4},s.dataKey):a==="line"?e.jsx(te,{type:"monotone",dataKey:s.dataKey,stroke:d,strokeWidth:2,dot:!1},s.dataKey):a==="area"?e.jsx(ne,{type:"monotone",dataKey:s.dataKey,fill:d,stroke:d,fillOpacity:.4},s.dataKey):null})]})})}export{ce as default};
@@ -1 +0,0 @@
1
- import{j as e}from"./vendor-react-Dy_xkBQQ.js";import{Y as l,Z as m,a1 as d}from"./ui-components-CseD2Dpn.js";import"./framework-mHWN965c.js";import"./vendor-ui-utils-h6yAcIi9.js";import{s as n}from"./systemObjects-DSpePIIy.js";import{bx as a}from"./vendor-icons-CQ8b-fGy.js";import"./vendor-radix-BbeYj_o4.js";import"./vendor-i18n-D5KbMT7w.js";import"./vendor-charts-CSvoW-yB.js";const t=n.find(s=>s.name==="sys_audit_log");function N(){return e.jsxs("div",{className:"flex flex-col gap-4 sm:gap-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"bg-primary/10 p-2 rounded-md shrink-0",children:e.jsx(a,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Audit Log"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"View system activity and user actions"})]})]}),e.jsx(l,{children:e.jsx(m,{className:"p-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsx("tr",{className:"border-b bg-muted/50",children:t.views[0].columns.map(s=>{const r=t.fields.find(i=>i.name===s);return e.jsx("th",{className:"h-10 px-3 sm:px-4 text-left font-medium text-muted-foreground whitespace-nowrap",children:r?.label??s},s)})})}),e.jsx("tbody",{children:e.jsx("tr",{children:e.jsx("td",{className:"p-4 sm:p-6 text-center text-sm text-muted-foreground",colSpan:t.views[0].columns.length,children:e.jsxs("div",{className:"flex flex-col items-center gap-2 py-4",children:[e.jsx(a,{className:"h-8 w-8 text-muted-foreground/50"}),e.jsx("p",{children:"Connect to ObjectStack server to load audit logs."}),e.jsx(d,{variant:"secondary",className:"text-xs",children:"Read-only"})]})})})})]})})})})]})}export{N as AuditLogPage};
@@ -1 +0,0 @@
1
- import{j as s,h,r as i}from"./vendor-react-Dy_xkBQQ.js";import{a as p}from"./plugins-views-divN-xXs.js";import{a9 as e,aH as f,aI as u,aJ as j}from"./ui-components-CseD2Dpn.js";import"./framework-mHWN965c.js";import"./vendor-ui-utils-h6yAcIi9.js";import{u as g,b as N,r as d,M as b,a as w}from"./index-RAPqkKVL.js";import{aD as v}from"./vendor-icons-CQ8b-fGy.js";import"./vendor-charts-CSvoW-yB.js";import"./vendor-i18n-D5KbMT7w.js";import"./vendor-radix-BbeYj_o4.js";import"./plugins-core-Cv2TPt86.js";import"./infrastructure-Di0WqY4l.js";import"./data-adapter-D15yh-pb.js";import"./vendor-objectstack-Bifvxvds.js";import"./vendor-zod-UZPqlszj.js";import"./ui-layout-CF_1bNSv.js";function y({cards:l=6}){return s.jsxs("div",{className:"w-full space-y-6 p-4 sm:p-6",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(e,{className:"h-7 w-56"}),s.jsx(e,{className:"h-4 w-80"})]}),s.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:Array.from({length:4}).map((t,r)=>s.jsxs("div",{className:"rounded-lg border p-4 space-y-2",children:[s.jsx(e,{className:"h-4 w-20"}),s.jsx(e,{className:"h-8 w-24"}),s.jsx(e,{className:"h-3 w-16"})]},`stat-${r}`))}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:l}).map((t,r)=>s.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(e,{className:"h-5 w-32"}),s.jsx(e,{className:"h-5 w-5 rounded-full"})]}),s.jsx(e,{className:"h-40 w-full"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(e,{className:"h-3 w-16"}),s.jsx(e,{className:"h-3 w-12"})]})]},`widget-${r}`))})]})}function H({dataSource:l}){const{dashboardName:t}=h(),{showDebug:r,toggleDebug:m}=g(),[c,o]=i.useState(!0);i.useEffect(()=>{o(!0),queueMicrotask(()=>o(!1))},[t]);const{dashboards:n}=N(),a=n?.find(x=>x.name===t);return c?s.jsx(y,{}):a?s.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[s.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-3 sm:gap-4 p-4 sm:p-6 border-b shrink-0",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h1",{className:"text-lg sm:text-xl md:text-2xl font-bold tracking-tight truncate",children:d(a.label)||a.name}),a.description&&s.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:d(a.description)})]}),s.jsx("div",{className:"shrink-0",children:s.jsx(b,{open:r,onToggle:m})})]}),s.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col sm:flex-row relative",children:[s.jsx("div",{className:"flex-1 overflow-auto p-4 sm:p-6",children:s.jsx(p,{schema:a,dataSource:l})}),s.jsx(w,{open:r,sections:[{title:"Dashboard Configuration",data:a}]})]})]}):s.jsx("div",{className:"h-full flex items-center justify-center p-8",children:s.jsxs(f,{children:[s.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-muted",children:s.jsx(v,{className:"h-6 w-6 text-muted-foreground"})}),s.jsx(u,{children:"Dashboard Not Found"}),s.jsxs(j,{children:['The dashboard "',t,'" could not be found. It may have been removed or renamed.']})]})})}export{H as DashboardView};
@@ -1 +0,0 @@
1
- import{j as r}from"./vendor-react-Dy_xkBQQ.js";import{F as o}from"./infrastructure-Di0WqY4l.js";import"./vendor-i18n-D5KbMT7w.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{r as c,j as e}from"./vendor-react-Dy_xkBQQ.js";import{u as F}from"./plugins-core-Cv2TPt86.js";import{u as H,a as K,D as P,c as Y,b as M,d as U,P as Z,e as z,S as q,v as G,C as J}from"./vendor-dndkit-DRGpK6sP.js";import{B as Q,a1 as I,Y as W,$ as X,a0 as _,ab as ee,Z as se}from"./ui-components-CseD2Dpn.js";import"./framework-mHWN965c.js";import"./vendor-ui-utils-h6yAcIi9.js";import{a as te,C as re,T as ae}from"./vendor-icons-CQ8b-fGy.js";import"./plugins-views-divN-xXs.js";import"./vendor-charts-CSvoW-yB.js";import"./vendor-i18n-D5KbMT7w.js";import"./vendor-radix-BbeYj_o4.js";const k=(...s)=>s.filter(Boolean).join(" ");function E({card:s}){const{attributes:x,listeners:o,setNodeRef:m,transform:r,transition:g,isDragging:v}=z({id:s.id}),f={transform:J.Transform.toString(r),transition:g,opacity:v?.5:void 0};return e.jsx("div",{ref:m,style:f,...x,...o,children:e.jsxs(W,{className:"mb-2 cursor-grab active:cursor-grabbing border-border bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group",children:[e.jsxs(X,{className:"p-4",children:[e.jsx(_,{className:"text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:s.title}),s.description&&e.jsx(ee,{className:"text-xs text-muted-foreground font-mono",children:s.description})]}),s.badges&&s.badges.length>0&&e.jsx(se,{className:"p-4 pt-0",children:e.jsx("div",{className:"flex flex-wrap gap-1",children:s.badges.map((l,a)=>e.jsx(I,{variant:l.variant||"default",className:"text-xs",children:l.label},a))})})]})})}function ie({cards:s,parentRef:x}){const o=F({count:s.length,getScrollElement:()=>x.current,estimateSize:()=>120,overscan:5});return e.jsx("div",{style:{height:`${o.getTotalSize()}px`,width:"100%",position:"relative"},children:o.getVirtualItems().map(m=>{const r=s[m.index];return e.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${m.start}px)`},children:e.jsx(E,{card:r})},r.id)})})}function ne({column:s,cards:x,onToggle:o,enableVirtual:m}){const r=x||[],g=c.useRef(null),{setNodeRef:v}=z({id:s.id,data:{type:"column"}}),f=s.limit&&r.length>=s.limit,l=s.limit&&r.length>=s.limit*.8;return e.jsxs("div",{ref:v,className:k("flex flex-col flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl transition-all",s.collapsed?"w-16":"w-80",s.className),children:[e.jsxs("div",{className:"p-4 border-b border-border/50 bg-muted/20 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e.jsx(Q,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>o(!s.collapsed),children:s.collapsed?e.jsx(te,{className:"h-4 w-4"}):e.jsx(re,{className:"h-4 w-4"})}),!s.collapsed&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"font-mono text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:k("font-mono text-xs",f?"text-destructive":l?"text-yellow-500":"text-muted-foreground"),children:[r.length,s.limit&&` / ${s.limit}`]}),f&&e.jsx(I,{variant:"destructive",className:"text-xs",children:"Full"}),l&&!f&&e.jsx(ae,{className:"h-3 w-3 text-yellow-500"})]})]})]}),s.collapsed&&e.jsxs("div",{className:"flex flex-col items-center gap-1",children:[e.jsx("span",{className:"font-mono text-xs font-bold text-primary/90 [writing-mode:vertical-rl] rotate-180",children:s.title}),e.jsx(I,{variant:"secondary",className:"text-xs",children:r.length})]})]}),!s.collapsed&&e.jsx("div",{ref:g,className:"flex-1 p-4 overflow-y-auto",style:{maxHeight:"600px"},children:e.jsx(q,{items:r.map(a=>a.id),strategy:G,children:m?e.jsx(ie,{cards:r,parentRef:g}):e.jsx("div",{className:"space-y-2",children:r.map(a=>e.jsx(E,{card:a},a.id))})})})]})}function ve({columns:s,onCardMove:x,onColumnToggle:o,enableVirtualScrolling:m=!1,virtualScrollThreshold:r=50,className:g}){const[v,f]=c.useState(null),l=c.useMemo(()=>(s||[]).map(t=>({...t,cards:t.cards||[]})),[s]),[a,S]=c.useState(l);c.useEffect(()=>{S(l)},[l]);const T=H(K(Z,{activationConstraint:{distance:8}})),V=t=>{const{active:i}=t,n=$(i.id);f(n)},L=t=>{const{active:i,over:n}=t;if(f(null),!n)return;const d=i.id,b=n.id;if(d===b)return;const u=B(d),j=B(b)||O(b);if(!(!u||!j))if(u.id===j.id){const h=[...u.cards],C=h.findIndex(p=>p.id===d),D=h.findIndex(p=>p.id===b),R=U(h,C,D);S(p=>p.map(N=>N.id===u.id?{...N,cards:R}:N))}else{const h=[...u.cards],C=[...j.cards],D=h.findIndex(w=>w.id===d),p=b===j.id?C.length:C.findIndex(w=>w.id===b),[N]=h.splice(D,1);C.splice(p,0,N),S(w=>w.map(y=>y.id===u.id?{...y,cards:h}:y.id===j.id?{...y,cards:C}:y)),x&&x(d,u.id,j.id,p)}},$=c.useCallback(t=>{for(const i of a){const n=i.cards.find(d=>d.id===t);if(n)return n}return null},[a]),B=c.useCallback(t=>a.find(i=>i.cards.some(n=>n.id===t))||null,[a]),O=c.useCallback(t=>a.find(i=>i.id===t)||null,[a]),A=c.useCallback((t,i)=>{S(n=>n.map(d=>d.id===t?{...d,collapsed:i}:d)),o?.(t,i)},[o]);return e.jsxs(P,{sensors:T,collisionDetection:Y,onDragStart:V,onDragEnd:L,children:[e.jsx("div",{className:k("flex gap-4 overflow-x-auto p-4",g),children:a.map(t=>{const i=m&&t.cards.length>r;return e.jsx(ne,{column:t,cards:t.cards,onToggle:n=>A(t.id,n),enableVirtual:i},t.id)})}),e.jsx(M,{children:v?e.jsx(E,{card:v}):null})]})}export{ve as KanbanEnhanced,ve as default};
@@ -1 +0,0 @@
1
- import{j as e,r as h}from"./vendor-react-Dy_xkBQQ.js";import{u as H,a as B,D as L,c as Y,b as Z,d as q,T as z,P as G,e as E,S as J,v as M,C as Q}from"./vendor-dndkit-DRGpK6sP.js";import{a1 as K,aP as U,Y as V,$ as W,a0 as X,ab as _,Z as ee}from"./ui-components-CseD2Dpn.js";import{i as se,j as re}from"./framework-mHWN965c.js";import"./vendor-ui-utils-h6yAcIi9.js";import"./vendor-icons-CQ8b-fGy.js";import"./vendor-radix-BbeYj_o4.js";import"./vendor-i18n-D5KbMT7w.js";import"./vendor-charts-CSvoW-yB.js";const P=(...s)=>s.filter(Boolean).join(" ");function T({card:s,onCardClick:i}){const{attributes:x,listeners:n,setNodeRef:a,transform:o,transition:c,isDragging:C}=E({id:s.id}),d={transform:Q.Transform.toString(o),transition:c,opacity:C?.5:void 0};return e.jsx("div",{ref:a,style:d,...x,...n,role:"listitem","aria-label":s.title,onClick:()=>i?.(s),children:e.jsxs(V,{className:"mb-2 cursor-grab active:cursor-grabbing border-border bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group touch-manipulation",children:[e.jsxs(W,{className:"p-2 sm:p-4",children:[e.jsx(X,{className:"text-xs sm:text-sm font-medium font-mono tracking-tight text-foreground group-hover:text-primary transition-colors",children:s.title}),s.description&&e.jsx(_,{className:"text-xs text-muted-foreground font-mono line-clamp-2 sm:line-clamp-none",children:s.description})]}),s.badges&&s.badges.length>0&&e.jsx(ee,{className:"p-2 sm:p-4 pt-0",children:e.jsx("div",{className:"flex flex-wrap gap-1",children:s.badges.map((b,S)=>e.jsx(K,{variant:b.variant||"default",className:"text-xs",children:b.label},S))})})]})})}function ae({column:s,cards:i,onCardClick:x}){const n=i||[],{setNodeRef:a}=E({id:s.id,data:{type:"column"}}),o=s.limit&&n.length>=s.limit;return e.jsxs("div",{ref:a,role:"group","aria-label":s.title,className:P("flex flex-col w-[85vw] sm:w-80 flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl snap-start",s.className),children:[e.jsx("div",{className:"p-3 sm:p-4 border-b border-border/50 bg-muted/20",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{id:`kanban-col-${s.id}`,className:"font-mono text-xs sm:text-sm font-semibold tracking-wider text-primary/90 uppercase truncate",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-mono text-xs text-muted-foreground","aria-label":`${n.length} cards${s.limit?` of ${s.limit} maximum`:""}`,children:[n.length,s.limit&&` / ${s.limit}`]}),o&&e.jsx(K,{variant:"destructive",className:"text-xs",children:"Full"})]})]})}),e.jsx(U,{className:"flex-1 p-4",children:e.jsx(J,{items:n.map(c=>c.id),strategy:M,children:e.jsx("div",{className:"space-y-2",role:"list","aria-label":`${s.title} cards`,children:n.map(c=>e.jsx(T,{card:c,onCardClick:x},c.id))})})})]})}function te({children:s}){const i=re();return e.jsx(e.Fragment,{children:s(i)})}function ue({columns:s,onCardMove:i,onCardClick:x,className:n}){return se()?e.jsx(te,{children:o=>e.jsx($,{columns:s,onCardMove:i,onCardClick:x,className:n,dnd:o})}):e.jsx($,{columns:s,onCardMove:i,onCardClick:x,className:n,dnd:null})}function $({columns:s,onCardMove:i,onCardClick:x,className:n,dnd:a}){const[o,c]=h.useState(null),C=h.useMemo(()=>(s||[]).map(r=>({...r,cards:r.cards||[]})),[s]),[d,b]=h.useState(C);h.useEffect(()=>{b(C)},[C]);const S=H(B(G,{activationConstraint:{distance:5}}),B(z,{activationConstraint:{delay:200,tolerance:5}})),O=r=>{const{active:m}=r,t=A(m.id);if(c(t),a&&t){const l=w(t.id);l&&a.startDrag({id:t.id,type:"kanban-card",data:t,sourceId:l.id})}},R=r=>{const{active:m,over:t}=r;if(c(null),!t){a&&a.endDrag();return}const l=m.id,v=t.id;if(l===v){a&&a.endDrag();return}const u=w(l),p=w(v)||F(v);if(!u||!p){a&&a.endDrag();return}if(u.id===p.id){const g=[...u.cards],j=g.findIndex(f=>f.id===l),I=g.findIndex(f=>f.id===v),k=q(g,j,I);b(f=>f.map(D=>D.id===u.id?{...D,cards:k}:D))}else{const g=[...u.cards],j=[...p.cards],I=g.findIndex(N=>N.id===l),f=v===p.id?j.length:j.findIndex(N=>N.id===v),[D]=g.splice(I,1);j.splice(f,0,D),b(N=>N.map(y=>y.id===u.id?{...y,cards:g}:y.id===p.id?{...y,cards:j}:y)),i&&i(l,u.id,p.id,f)}a&&a.endDrag(p.id)},A=h.useCallback(r=>{for(const m of d){const t=m.cards.find(l=>l.id===r);if(t)return t}return null},[d]),w=h.useCallback(r=>d.find(m=>m.cards.some(t=>t.id===r))||null,[d]),F=h.useCallback(r=>d.find(m=>m.id===r)||null,[d]);return e.jsxs(L,{sensors:S,collisionDetection:Y,onDragStart:O,onDragEnd:R,children:[e.jsxs("div",{className:"flex sm:hidden items-center justify-between px-3 pb-2 text-xs text-muted-foreground",children:[e.jsxs("span",{children:[d.length," columns"]}),e.jsx("span",{children:"← Swipe to navigate →"})]}),e.jsx("div",{className:P("flex gap-3 sm:gap-4 overflow-x-auto snap-x snap-mandatory p-2 sm:p-4 [-webkit-overflow-scrolling:touch]",n),role:"region","aria-label":"Kanban board",children:d.map(r=>e.jsx(ae,{column:r,cards:r.cards,onCardClick:x},r.id))}),e.jsx(Z,{children:e.jsx("div",{"aria-live":"assertive","aria-label":o?`Dragging ${o.title}`:void 0,children:o?e.jsx(T,{card:o}):null})})]})}export{ue as default};
@@ -1 +0,0 @@
1
- import{i as s,j as r}from"./vendor-react-Dy_xkBQQ.js";import{L as o}from"./infrastructure-Di0WqY4l.js";import"./vendor-i18n-D5KbMT7w.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 +0,0 @@
1
- import{j as e}from"./vendor-react-Dy_xkBQQ.js";import{u as l}from"./infrastructure-Di0WqY4l.js";import{B as d,Y as c,Z as o,a1 as x}from"./ui-components-CseD2Dpn.js";import"./framework-mHWN965c.js";import"./vendor-ui-utils-h6yAcIi9.js";import{s as p}from"./systemObjects-DSpePIIy.js";import{bv as r,m as h}from"./vendor-icons-CQ8b-fGy.js";import"./vendor-i18n-D5KbMT7w.js";import"./vendor-radix-BbeYj_o4.js";import"./vendor-charts-CSvoW-yB.js";const a=p.find(s=>s.name==="sys_org");function z(){const{user:s}=l(),n=s?.role==="admin";return e.jsxs("div",{className:"flex flex-col gap-4 sm:gap-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"bg-primary/10 p-2 rounded-md shrink-0",children:e.jsx(r,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Organization Management"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Manage organizations and their members"})]})]}),n&&e.jsxs(d,{size:"sm",className:"shrink-0 gap-2",children:[e.jsx(h,{className:"h-4 w-4"}),"Add Organization"]})]}),e.jsx(c,{children:e.jsx(o,{className:"p-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsx("tr",{className:"border-b bg-muted/50",children:a.views[0].columns.map(t=>{const i=a.fields.find(m=>m.name===t);return e.jsx("th",{className:"h-10 px-3 sm:px-4 text-left font-medium text-muted-foreground whitespace-nowrap",children:i?.label??t},t)})})}),e.jsx("tbody",{children:e.jsx("tr",{children:e.jsx("td",{className:"p-4 sm:p-6 text-center text-sm text-muted-foreground",colSpan:a.views[0].columns.length,children:e.jsxs("div",{className:"flex flex-col items-center gap-2 py-4",children:[e.jsx(r,{className:"h-8 w-8 text-muted-foreground/50"}),e.jsx("p",{children:"Connect to ObjectStack server to load organizations."}),e.jsx(x,{variant:"secondary",className:"text-xs",children:"plugin-grid powered"})]})})})})]})})})})]})}export{z as OrgManagementPage};
@@ -1 +0,0 @@
1
- import{h as l,k as p,j as e}from"./vendor-react-Dy_xkBQQ.js";import{S as c}from"./framework-mHWN965c.js";import{aH as d,aI as u,aJ as f}from"./ui-components-CseD2Dpn.js";import"./vendor-ui-utils-h6yAcIi9.js";import{u as h,b as x,M as g,a as j}from"./index-RAPqkKVL.js";import{a1 as v}from"./vendor-icons-CQ8b-fGy.js";import"./vendor-radix-BbeYj_o4.js";import"./vendor-i18n-D5KbMT7w.js";import"./vendor-charts-CSvoW-yB.js";import"./plugins-core-Cv2TPt86.js";import"./plugins-views-divN-xXs.js";import"./infrastructure-Di0WqY4l.js";import"./data-adapter-D15yh-pb.js";import"./vendor-objectstack-Bifvxvds.js";import"./vendor-zod-UZPqlszj.js";import"./ui-layout-CF_1bNSv.js";function H(){const{pageName:s}=l(),[o]=p(),{showDebug:a,toggleDebug:r}=h(),{pages:i}=x(),t=i?.find(n=>n.name===s);if(!t)return e.jsx("div",{className:"h-full flex items-center justify-center p-8",children:e.jsxs(d,{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(v,{className:"h-6 w-6 text-muted-foreground"})}),e.jsx(u,{children:"Page Not Found"}),e.jsxs(f,{children:['The page "',s,'" could not be found. It may have been removed or renamed.']})]})});const m=Object.fromEntries(o.entries());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 transition-opacity ${a?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:e.jsx(g,{open:a,onToggle:r})}),e.jsx(c,{schema:{...t,type:t.type||"page",context:{...t.context,params:m}}})]}),e.jsx(j,{open:a,sections:[{title:"Page Configuration",data:t}]})]})}export{H as PageView};
Binary file
Binary file
@@ -1 +0,0 @@
1
- import{r as l,j as e}from"./vendor-react-Dy_xkBQQ.js";import{u as w,g as C}from"./infrastructure-Di0WqY4l.js";import{Y as i,Z as u,ap as S,aq as A,ar as E,a1 as P,$ as h,a0 as p,ab as j,aN as g,aO as f,L as n,M as c,B as U}from"./ui-components-CseD2Dpn.js";import"./framework-mHWN965c.js";import"./vendor-ui-utils-h6yAcIi9.js";import{by as k,h as I,g as L,bz as B}from"./vendor-icons-CQ8b-fGy.js";import"./vendor-i18n-D5KbMT7w.js";import"./vendor-radix-BbeYj_o4.js";import"./vendor-charts-CSvoW-yB.js";function Y(){const{user:s,updateUser:N,isLoading:a}=w(),[d,v]=l.useState(s?.name??""),[b,m]=l.useState(!1),[o,x]=l.useState(null),y=async t=>{t.preventDefault(),x(null),m(!1);try{await N({name:d}),m(!0)}catch(r){x(r instanceof Error?r.message:String(r))}};return s?e.jsxs("div",{className:"flex flex-col gap-4 sm:gap-6 p-4 sm:p-6 max-w-2xl",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Profile"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Manage your account settings"})]}),e.jsx(i,{children:e.jsx(u,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(S,{className:"h-16 w-16",children:[e.jsx(A,{src:s.image??void 0,alt:s.name??"User"}),e.jsx(E,{className:"text-lg bg-primary text-primary-foreground",children:C(s)})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-lg font-semibold truncate",children:s.name??"User"}),e.jsx("p",{className:"text-sm text-muted-foreground truncate",children:s.email}),e.jsx(P,{variant:"secondary",className:"mt-1",children:s.role??"member"})]})]})})}),e.jsxs(i,{children:[e.jsxs(h,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(k,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(p,{className:"text-base sm:text-lg",children:"Personal Information"})]}),e.jsx(j,{children:"Update your name and view account details"})]}),e.jsx(u,{children:e.jsxs("form",{onSubmit:y,className:"space-y-4",children:[o&&e.jsxs(g,{variant:"destructive",children:[e.jsx(I,{className:"h-4 w-4"}),e.jsx(f,{children:o})]}),b&&e.jsxs(g,{children:[e.jsx(L,{className:"h-4 w-4 text-green-600"}),e.jsx(f,{className:"text-green-800 dark:text-green-400",children:"Profile updated successfully."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"profile-name",children:"Name"}),e.jsx(c,{id:"profile-name",type:"text",value:d,onChange:t=>v(t.target.value),required:!0,disabled:a})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{htmlFor:"profile-email",children:"Email"}),e.jsx(c,{id:"profile-email",type:"email",value:s.email,disabled:!0,className:"bg-muted text-muted-foreground"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Email cannot be changed."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(n,{children:"Role"}),e.jsx(c,{type:"text",value:s.role??"member",disabled:!0,className:"bg-muted text-muted-foreground"})]}),e.jsx(U,{type:"submit",disabled:a,className:"w-full sm:w-auto",children:a?"Saving...":"Save Changes"})]})})]}),e.jsx(i,{children:e.jsxs(h,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(B,{className:"h-4 w-4 text-muted-foreground"}),e.jsx(p,{className:"text-base sm:text-lg",children:"Change Password"})]}),e.jsx(j,{children:"To change your password, use the password reset flow from the login page."})]})})]}):null}export{Y as ProfilePage};
@@ -1 +0,0 @@
1
- import{j as e,h as f,r as x}from"./vendor-react-Dy_xkBQQ.js";import{D as j}from"./plugins-views-divN-xXs.js";import{a9 as s,aH as u,aI as N,aJ as g}from"./ui-components-CseD2Dpn.js";import"./framework-mHWN965c.js";import"./vendor-ui-utils-h6yAcIi9.js";import{u as w,M as v,a as b}from"./index-RAPqkKVL.js";import{as as y}from"./vendor-icons-CQ8b-fGy.js";import"./vendor-charts-CSvoW-yB.js";import"./vendor-i18n-D5KbMT7w.js";import"./vendor-radix-BbeYj_o4.js";import"./plugins-core-Cv2TPt86.js";import"./infrastructure-Di0WqY4l.js";import"./data-adapter-D15yh-pb.js";import"./vendor-objectstack-Bifvxvds.js";import"./vendor-zod-UZPqlszj.js";import"./ui-layout-CF_1bNSv.js";function D({fields:r=8,columns:c=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(s,{className:"h-8 w-8 rounded"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(s,{className:"h-6 w-48"}),e.jsx(s,{className:"h-4 w-32"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s,{className:"h-9 w-20"}),e.jsx(s,{className:"h-9 w-20"})]})]}),e.jsx(s,{className:"h-5 w-24"}),e.jsx("div",{className:`grid grid-cols-1 ${c===2?"md:grid-cols-2":""} gap-4`,children:Array.from({length:r}).map((o,a)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(s,{className:"h-4 w-24"}),e.jsx(s,{className:"h-9 w-full"})]},`field-${a}`))}),e.jsxs("div",{className:"space-y-3 pt-4 border-t",children:[e.jsx(s,{className:"h-5 w-32"}),e.jsx("div",{className:"space-y-2",children:Array.from({length:3}).map((o,a)=>e.jsxs("div",{className:"flex items-center gap-3 py-2",children:[e.jsx(s,{className:"h-8 w-8 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsx(s,{className:"h-4 w-40"}),e.jsx(s,{className:"h-3 w-24"})]})]},`related-${a}`))})]})]})}function z({dataSource:r,objects:c,onEdit:o}){const{objectName:a,recordId:i}=f(),{showDebug:m,toggleDebug:p}=w(),[h,d]=x.useState(!0),t=c.find(l=>l.name===a);if(x.useEffect(()=>{d(!0),queueMicrotask(()=>d(!1))},[a,i]),h)return e.jsx(D,{});if(!t)return e.jsx("div",{className:"flex h-full items-center justify-center p-4",children:e.jsxs(u,{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(y,{className:"h-6 w-6 text-muted-foreground"})}),e.jsx(N,{children:"Object Not Found"}),e.jsxs(g,{children:['Object "',a,'" definition missing. Check your configuration or navigate back to select a valid object.']})]})});const n={type:"detail-view",objectName:t.name,resourceId:i,showBack:!0,onBack:"history",showEdit:!0,title:t.label,sections:[{title:"Details",fields:Object.keys(t.fields||{}).map(l=>({name:l,label:t.fields[l].label||l,type:t.fields[l].type||"text"})),columns:2}]};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",children:e.jsx(v,{open:m,onToggle:p})}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-row",children:[e.jsx("div",{className:"flex-1 overflow-auto p-3 sm:p-4 lg:p-6 scroll-pb-48",children:e.jsx(j,{schema:n,dataSource:r,onEdit:()=>o({_id:i,id:i})})}),e.jsx(b,{open:m,sections:[{title:"View Schema",data:n}]})]})]})}export{z as RecordDetailView};
@@ -1 +0,0 @@
1
- import{i as s,j as e}from"./vendor-react-Dy_xkBQQ.js";import{R as i}from"./infrastructure-Di0WqY4l.js";import"./vendor-i18n-D5KbMT7w.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(i,{onSuccess:()=>r("/"),loginUrl:"/login"})})}export{a as RegisterPage};
@@ -1 +0,0 @@
1
- import{h as f,r as n,j as e}from"./vendor-react-Dy_xkBQQ.js";import{R as g,b}from"./plugins-views-divN-xXs.js";import{aH as j,aI as v,aJ as N,B as m}from"./ui-components-CseD2Dpn.js";import"./framework-mHWN965c.js";import"./vendor-ui-utils-h6yAcIi9.js";import{u as w,b as y,M as R,a as E}from"./index-RAPqkKVL.js";import{L as S,aE as k,b as C,aP as M}from"./vendor-icons-CQ8b-fGy.js";import"./vendor-charts-CSvoW-yB.js";import"./vendor-i18n-D5KbMT7w.js";import"./vendor-radix-BbeYj_o4.js";import"./plugins-core-Cv2TPt86.js";import"./infrastructure-Di0WqY4l.js";import"./data-adapter-D15yh-pb.js";import"./vendor-objectstack-Bifvxvds.js";import"./vendor-zod-UZPqlszj.js";import"./ui-layout-CF_1bNSv.js";const B=[{name:"month",label:"Month",type:"string"},{name:"revenue",label:"Revenue",type:"number"},{name:"count",label:"Count",type:"number"},{name:"region",label:"Region",type:"string"},{name:"product",label:"Product",type:"string"},{name:"source",label:"Lead Source",type:"string"},{name:"stage",label:"Stage",type:"string"},{name:"amount",label:"Amount",type:"currency"}];function U({dataSource:D}){const{reportName:o}=f(),{showDebug:l,toggleDebug:d}=w(),[c,t]=n.useState(!1),{reports:u,loading:p}=y(),a=u?.find(r=>r.name===o),[s,i]=n.useState(a);if(n.useEffect(()=>{i(a)},[a]),p)return e.jsx("div",{className:"h-full flex items-center justify-center p-8",children:e.jsx(S,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(!a)return e.jsx("div",{className:"h-full flex items-center justify-center p-8",children:e.jsxs(j,{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(k,{className:"h-6 w-6 text-muted-foreground"})}),e.jsx(v,{children:"Report Not Found"}),e.jsxs(N,{children:['The report "',o,'" could not be found. It may have been removed or renamed.']})]})});const x=r=>{console.log("Saving report:",r),i(r),t(!1)};if(c)return e.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[e.jsxs("div",{className:"flex items-center p-3 sm:p-4 border-b bg-muted/10 gap-2",children:[e.jsxs(m,{variant:"ghost",size:"sm",onClick:()=>t(!1),className:"shrink-0",children:[e.jsx(C,{className:"h-4 w-4 mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"Back to View"}),e.jsx("span",{className:"sm:hidden",children:"Back"})]}),e.jsxs("div",{className:"font-medium truncate",children:["Edit Report: ",s.title]})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsx(g,{schema:{title:"Report Builder",report:s,availableFields:B,onSave:x,onCancel:()=>t(!1)}})})]});const h={type:"report-viewer",report:s,showToolbar:!0,allowExport:!0};return e.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between sm:items-center gap-3 sm:gap-4 p-4 sm:p-6 border-b shrink-0 bg-muted/10",children:[e.jsx("div",{className:"min-w-0",children:e.jsx("h1",{className:"text-base sm:text-lg font-medium text-muted-foreground truncate",children:s.title||"Report Viewer"})}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs(m,{variant:"outline",size:"sm",onClick:()=>t(!0),className:"h-8",children:[e.jsx(M,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit Report"})]}),e.jsx(R,{open:l,onToggle:d})]})]}),e.jsxs("div",{className:"flex-1 overflow-hidden flex flex-row relative",children:[e.jsx("div",{className:"flex-1 overflow-auto p-4 sm:p-6 lg:p-8 bg-muted/5",children:e.jsx("div",{className:"max-w-5xl mx-auto shadow-sm border rounded-lg sm:rounded-xl bg-background overflow-hidden min-h-150",children:e.jsx(b,{schema:h})})}),e.jsx(E,{open:l,sections:[{title:"Report Configuration",data:s}]})]})]})}export{U as ReportView};
@@ -1 +0,0 @@
1
- import{j as e}from"./vendor-react-Dy_xkBQQ.js";import{u as i}from"./infrastructure-Di0WqY4l.js";import{B as d,Y as c,Z as o,a1 as x}from"./ui-components-CseD2Dpn.js";import"./framework-mHWN965c.js";import"./vendor-ui-utils-h6yAcIi9.js";import{s as p}from"./systemObjects-DSpePIIy.js";import{bw as a,m as h}from"./vendor-icons-CQ8b-fGy.js";import"./vendor-i18n-D5KbMT7w.js";import"./vendor-radix-BbeYj_o4.js";import"./vendor-charts-CSvoW-yB.js";const r=p.find(s=>s.name==="sys_role");function C(){const{user:s}=i(),l=s?.role==="admin";return e.jsxs("div",{className:"flex flex-col gap-4 sm:gap-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"bg-primary/10 p-2 rounded-md shrink-0",children:e.jsx(a,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"Role Management"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Define roles and assign permissions"})]})]}),l&&e.jsxs(d,{size:"sm",className:"shrink-0 gap-2",children:[e.jsx(h,{className:"h-4 w-4"}),"Add Role"]})]}),e.jsx(c,{children:e.jsx(o,{className:"p-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsx("tr",{className:"border-b bg-muted/50",children:r.views[0].columns.map(t=>{const m=r.fields.find(n=>n.name===t);return e.jsx("th",{className:"h-10 px-3 sm:px-4 text-left font-medium text-muted-foreground whitespace-nowrap",children:m?.label??t},t)})})}),e.jsx("tbody",{children:e.jsx("tr",{children:e.jsx("td",{className:"p-4 sm:p-6 text-center text-sm text-muted-foreground",colSpan:r.views[0].columns.length,children:e.jsxs("div",{className:"flex flex-col items-center gap-2 py-4",children:[e.jsx(a,{className:"h-8 w-8 text-muted-foreground/50"}),e.jsx("p",{children:"Connect to ObjectStack server to load roles."}),e.jsx(x,{variant:"secondary",className:"text-xs",children:"plugin-grid powered"})]})})})})]})})})})]})}export{C as RoleManagementPage};
@@ -1 +0,0 @@
1
- import{h as S,k as L,r as m,j as s,L as g}from"./vendor-react-Dy_xkBQQ.js";import{M as I,a1 as f,Y as P,Z as A}from"./ui-components-CseD2Dpn.js";import"./framework-mHWN965c.js";import"./vendor-ui-utils-h6yAcIi9.js";import{b as E}from"./index-RAPqkKVL.js";import{A as M,S as b,aE as T,a1 as q,aD as O,as as x}from"./vendor-icons-CQ8b-fGy.js";import"./vendor-radix-BbeYj_o4.js";import"./vendor-i18n-D5KbMT7w.js";import"./vendor-charts-CSvoW-yB.js";import"./plugins-core-Cv2TPt86.js";import"./plugins-views-divN-xXs.js";import"./infrastructure-Di0WqY4l.js";import"./data-adapter-D15yh-pb.js";import"./vendor-objectstack-Bifvxvds.js";import"./vendor-zod-UZPqlszj.js";import"./ui-layout-CF_1bNSv.js";function N(p){const l=[];for(const o of p)o.type==="group"&&o.children?l.push(...N(o.children)):l.push(o);return l}const j={object:x,dashboard:O,page:q,report:T},D={object:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",dashboard:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",page:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",report:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200"};function ee(){const{appName:p}=S(),[l,o]=L(),y=l.get("q")||"",[n,v]=m.useState(y),{apps:w}=E(),h=w||[],u=h.find(t=>t.name===p)||h[0],c=`/apps/${p}`,i=m.useMemo(()=>u?N(u.navigation||[]).map(e=>{let a="#";return e.type==="object"?a=`${c}/${e.objectName}`:e.type==="dashboard"?a=`${c}/dashboard/${e.dashboardName}`:e.type==="page"?a=`${c}/page/${e.pageName}`:e.type==="report"&&(a=`${c}/report/${e.reportName}`),{id:e.id,label:e.label||e.objectName||e.dashboardName||e.pageName||e.reportName||"",href:a,type:e.type,description:e.description}}).filter(e=>e.href!=="#"):[],[u,c]),d=m.useMemo(()=>{if(!n.trim())return i;const t=n.toLowerCase();return i.filter(e=>e.label.toLowerCase().includes(t)||e.type.toLowerCase().includes(t)||e.description&&e.description.toLowerCase().includes(t))},[i,n]),$=t=>{v(t),o(t?{q:t}:{})},C=m.useMemo(()=>{const t={};for(const e of d)(t[e.type]||=[]).push(e);return t},[d]);return s.jsxs("div",{className:"flex flex-col gap-6 p-4 sm:p-6 max-w-4xl mx-auto",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs(g,{to:c,className:"flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx(M,{className:"h-4 w-4"}),"Back"]}),s.jsx("h1",{className:"text-xl font-semibold",children:"Search"})]}),s.jsxs("div",{className:"relative",children:[s.jsx(b,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(I,{value:n,onChange:t=>$(t.target.value),placeholder:"Search objects, dashboards, pages, reports...",className:"pl-10 h-11 text-base",autoFocus:!0})]}),s.jsx("div",{className:"text-sm text-muted-foreground",children:n.trim()?`${d.length} result${d.length!==1?"s":""} for "${n}"`:`${i.length} items available`}),d.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(b,{className:"h-12 w-12 text-muted-foreground/30 mb-4"}),s.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"No results found"}),s.jsx("p",{className:"text-sm text-muted-foreground/80 mt-1",children:"Try adjusting your search terms"})]}):s.jsx("div",{className:"space-y-6",children:Object.entries(C).map(([t,e])=>{const a=j[t]||x;return s.jsxs("div",{children:[s.jsxs("h2",{className:"text-sm font-medium text-muted-foreground mb-2 flex items-center gap-1.5",children:[s.jsx(a,{className:"h-4 w-4"}),t.charAt(0).toUpperCase()+t.slice(1),"s",s.jsx(f,{variant:"secondary",className:"ml-1 text-xs",children:e.length})]}),s.jsx("div",{className:"grid gap-2",children:e.map(r=>{const k=j[r.type]||x;return s.jsx(g,{to:r.href,children:s.jsx(P,{className:"hover:bg-accent/50 transition-colors cursor-pointer",children:s.jsxs(A,{className:"flex items-center gap-3 p-3",children:[s.jsx("div",{className:`flex h-8 w-8 items-center justify-center rounded ${D[r.type]||""}`,children:s.jsx(k,{className:"h-4 w-4"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:r.label}),r.description&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:r.description})]}),s.jsx(f,{variant:"outline",className:"text-xs shrink-0",children:r.type})]})})},r.id)})})]},t)})})]})}export{ee as SearchResultsPage};
@@ -1 +0,0 @@
1
- import{j as e}from"./vendor-react-Dy_xkBQQ.js";import{u as i}from"./infrastructure-Di0WqY4l.js";import{B as c,Y as d,Z as o,a1 as x}from"./ui-components-CseD2Dpn.js";import"./framework-mHWN965c.js";import"./vendor-ui-utils-h6yAcIi9.js";import{s as p}from"./systemObjects-DSpePIIy.js";import{bu as a,m as h}from"./vendor-icons-CQ8b-fGy.js";import"./vendor-i18n-D5KbMT7w.js";import"./vendor-radix-BbeYj_o4.js";import"./vendor-charts-CSvoW-yB.js";const r=p.find(s=>s.name==="sys_user");function k(){const{user:s}=i(),m=s?.role==="admin";return e.jsxs("div",{className:"flex flex-col gap-4 sm:gap-6 p-4 sm:p-6",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"bg-primary/10 p-2 rounded-md shrink-0",children:e.jsx(a,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight",children:"User Management"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Manage system users and their roles"})]})]}),m&&e.jsxs(c,{size:"sm",className:"shrink-0 gap-2",children:[e.jsx(h,{className:"h-4 w-4"}),"Add User"]})]}),e.jsx(d,{children:e.jsx(o,{className:"p-0",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsx("tr",{className:"border-b bg-muted/50",children:r.views[0].columns.map(t=>{const n=r.fields.find(l=>l.name===t);return e.jsx("th",{className:"h-10 px-3 sm:px-4 text-left font-medium text-muted-foreground whitespace-nowrap",children:n?.label??t},t)})})}),e.jsx("tbody",{children:e.jsx("tr",{children:e.jsx("td",{className:"p-4 sm:p-6 text-center text-sm text-muted-foreground",colSpan:r.views[0].columns.length,children:e.jsxs("div",{className:"flex flex-col items-center gap-2 py-4",children:[e.jsx(a,{className:"h-8 w-8 text-muted-foreground/50"}),e.jsx("p",{children:"Connect to ObjectStack server to load users."}),e.jsx(x,{variant:"secondary",className:"text-xs",children:"plugin-grid powered"})]})})})})]})})})})]})}export{k as UserManagementPage};
@@ -1 +0,0 @@
1
- import{r as l,i as it,h as ot,j as Ae}from"./vendor-react-Dy_xkBQQ.js";import{C as we}from"./framework-mHWN965c.js";import{d as ue,c as pe,b as dt}from"./vendor-ui-utils-h6yAcIi9.js";import{aQ as ct,aR as je,aS as Ne,aT as Ce,aU as ke,aV as ut,ar as pt,ap as ce,aW as mt,aX as xt,aY as Be,aj as ht,ak as bt,aZ as gt,a_ as qe,a$ as ft,b0 as _e,b1 as yt,b2 as vt,b3 as Je,b4 as wt,aq as de,b5 as jt,b6 as Nt,b7 as Ct,b8 as kt,b9 as Ue,an as St,ba as He,bb as Qe,bc as et,bd as tt,be as Dt,bf as Tt,bg as Ft,bh as Re,bi as Ge,bj as It,bk as Pt,bl as Et,bm as $t,bn as Ve,bo as Ot,bp as zt,bq as At,br as Mt,bs as Rt,bt as Gt}from"./vendor-icons-CQ8b-fGy.js";var Xe={exports:{}},ye={},Ke;function Ut(){if(Ke)return ye;Ke=1;var o=Symbol.for("react.transitional.element"),A=Symbol.for("react.fragment");function F(C,b,$){var f=null;if($!==void 0&&(f=""+$),b.key!==void 0&&(f=""+b.key),"key"in b){$={};for(var g in b)g!=="key"&&($[g]=b[g])}else $=b;return b=$.ref,{$$typeof:o,type:C,key:f,ref:b!==void 0?b:null,props:$}}return ye.Fragment=A,ye.jsx=F,ye.jsxs=F,ye}var Ye;function Lt(){return Ye||(Ye=1,Xe.exports=Ut()),Xe.exports}var e=Lt();function Se(o,A={}){const{maxHistory:F=50}=A,[C,b]=l.useState(o),$=l.useRef([]),f=l.useRef([]),g=l.useCallback(c=>{b(d=>($.current=[...$.current.slice(-(F-1)),d],f.current=[],c))},[F]),v=l.useCallback(()=>{$.current.length!==0&&b(c=>{const d=[...$.current],j=d.pop();return $.current=d,f.current=[c,...f.current],j})},[]),s=l.useCallback(()=>{f.current.length!==0&&b(c=>{const d=[...f.current],j=d.shift();return f.current=d,$.current=[...$.current,c],j})},[]),y=l.useCallback(c=>{$.current=[],f.current=[],b(c)},[]);return{current:C,canUndo:$.current.length>0,canRedo:f.current.length>0,undoCount:$.current.length,redoCount:f.current.length,push:g,undo:v,redo:s,reset:y}}function De(){const[o,A]=l.useState(!1),[F,C]=l.useState(""),[b,$]=l.useState(""),f=l.useRef(null),g=l.useCallback((y,c)=>(C(y),$(c),A(!0),new Promise(d=>{f.current=d})),[]),v=l.useCallback(()=>{A(!1),f.current?.(!0),f.current=null},[]),s=l.useCallback(()=>{A(!1),f.current?.(!1),f.current=null},[]);return{isOpen:o,title:F,message:b,confirm:g,onConfirm:v,onCancel:s}}function $e(){const[o,A]=l.useState(new Set),F=l.useCallback((g,v=!1)=>{A(s=>{const y=new Set(v?s:[]);return s.has(g)&&v?y.delete(g):y.add(g),y})},[]),C=l.useCallback(g=>{A(new Set([g]))},[]),b=l.useCallback(g=>{A(new Set(g))},[]),$=l.useCallback(()=>{A(new Set)},[]),f=l.useCallback(g=>o.has(g),[o]);return{selectedIds:o,toggle:F,selectOne:C,selectMany:b,clearSelection:$,isSelected:f,count:o.size}}function Te(){const[o,A]=l.useState(null),F=l.useCallback(b=>{A(structuredClone(b))},[]),C=l.useCallback(()=>o?structuredClone(o):null,[o]);return{clipboard:o,copy:F,paste:C,hasContent:o!==null}}function Le(o={}){const{minZoom:A=.25,maxZoom:F=3,zoomStep:C=.1,initialZoom:b=1}=o,[$,f]=l.useState(b),[g,v]=l.useState({x:0,y:0}),s=l.useRef(!1),y=l.useRef({x:0,y:0}),c=l.useCallback(k=>Math.min(F,Math.max(A,+k.toFixed(2))),[A,F]),d=l.useCallback(()=>f(k=>c(k+C)),[c,C]),j=l.useCallback(()=>f(k=>c(k-C)),[c,C]),p=l.useCallback(()=>{f(1),v({x:0,y:0})},[]),x=l.useCallback(k=>f(c(k)),[c]),I=l.useCallback(k=>{if(k.ctrlKey||k.metaKey){k.preventDefault();const E=k.deltaY>0?-C:C;f(N=>c(N+E))}},[c,C]),P=l.useCallback(k=>{if(k.button===1||k.button===0&&k.altKey){k.preventDefault(),s.current=!0,y.current={x:k.clientX,y:k.clientY};const E=L=>{if(!s.current)return;const H=L.clientX-y.current.x,G=L.clientY-y.current.y;y.current={x:L.clientX,y:L.clientY},v(Z=>({x:Z.x+H,y:Z.y+G}))},N=()=>{s.current=!1,document.removeEventListener("mousemove",E),document.removeEventListener("mouseup",N)};document.addEventListener("mousemove",E),document.addEventListener("mouseup",N)}},[]),O={transform:`translate(${g.x}px, ${g.y}px) scale(${$})`,transformOrigin:"0 0"};return{zoom:$,panOffset:g,zoomIn:d,zoomOut:j,resetZoom:p,setZoom:x,handleWheel:I,startPan:P,transformStyle:O}}function Zt(...o){return ue(pe(o))}function Fe({isOpen:o,title:A,message:F,confirmLabel:C="Delete",cancelLabel:b="Cancel",destructive:$=!0,onConfirm:f,onCancel:g}){const v=l.useRef(null);return l.useEffect(()=>{const s=v.current;s&&(o&&!s.open?s.showModal():!o&&s.open&&s.close())},[o]),o?e.jsx("dialog",{ref:v,className:"fixed inset-0 z-50 m-auto rounded-lg border bg-background p-0 shadow-lg backdrop:bg-black/50",onClose:g,"aria-labelledby":"confirm-title","aria-describedby":"confirm-message",children:e.jsxs("div",{className:"w-80 p-6",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[$&&e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-destructive/10",children:e.jsx(jt,{className:"h-5 w-5 text-destructive"})}),e.jsx("h2",{id:"confirm-title",className:"text-lg font-semibold",children:A})]}),e.jsx("p",{id:"confirm-message",className:"text-sm text-muted-foreground mb-6",children:F}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:g,className:"px-4 py-2 text-sm rounded-md border hover:bg-accent",children:b}),e.jsx("button",{onClick:f,className:Zt("px-4 py-2 text-sm rounded-md font-medium",$?"bg-destructive text-destructive-foreground hover:bg-destructive/90":"bg-primary text-primary-foreground hover:bg-primary/90"),autoFocus:!0,children:C})]})]})}):null}function Ht(...o){return ue(pe(o))}function Oe({title:o="Properties",fields:A,onChange:F,className:C}){const[b,$]=l.useState(new Set),f=l.useCallback(v=>{$(s=>{const y=new Set(s);return y.has(v)?y.delete(v):y.add(v),y})},[]),g=A.reduce((v,s)=>{const y=s.group??"General";return v[y]||(v[y]=[]),v[y].push(s),v},{});return e.jsxs("div",{className:Ht("flex flex-col",C),role:"region","aria-label":o,children:[e.jsx("div",{className:"p-3 border-b font-medium text-sm",children:o}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[Object.entries(g).map(([v,s])=>e.jsxs("div",{className:"border-b last:border-b-0",children:[e.jsxs("button",{onClick:()=>f(v),className:"w-full flex items-center gap-1 px-3 py-2 text-xs font-medium text-muted-foreground hover:bg-accent/50",children:[b.has(v)?e.jsx(Ge,{className:"h-3 w-3"}):e.jsx(Re,{className:"h-3 w-3"}),v]}),!b.has(v)&&e.jsx("div",{className:"px-3 pb-2 space-y-2",children:s.map(y=>e.jsx(Vt,{field:y,onChange:F},y.name))})]},v)),A.length===0&&e.jsx("div",{className:"p-3 text-xs text-muted-foreground text-center",children:"Select an element to edit its properties"})]})]})}function Vt({field:o,onChange:A}){const F=C=>{A(o.name,C)};return e.jsxs("div",{className:"space-y-1",children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:o.label}),o.type==="text"&&e.jsx("input",{type:"text",value:String(o.value??""),onChange:C=>F(C.target.value),className:"w-full px-2 py-1 text-xs border rounded bg-background"}),o.type==="number"&&e.jsx("input",{type:"number",value:Number(o.value??0),onChange:C=>F(Number(C.target.value)),className:"w-full px-2 py-1 text-xs border rounded bg-background"}),o.type==="boolean"&&e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:!!o.value,onChange:C=>F(C.target.checked),className:"rounded"}),e.jsx("span",{className:"text-xs",children:o.value?"Yes":"No"})]}),o.type==="select"&&e.jsx("select",{value:String(o.value??""),onChange:C=>F(C.target.value),className:"w-full px-2 py-1 text-xs border rounded bg-background",children:o.options?.map(C=>e.jsx("option",{value:C.value,children:C.label},C.value))}),o.type==="color"&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"color",value:String(o.value??"#000000"),onChange:C=>F(C.target.value),className:"h-6 w-6 rounded border cursor-pointer"}),e.jsx("span",{className:"text-xs font-mono",children:String(o.value??"#000000")})]}),o.type==="textarea"&&e.jsx("textarea",{value:String(o.value??""),onChange:C=>F(C.target.value),className:"w-full px-2 py-1 text-xs border rounded bg-background resize-y",rows:3}),o.description&&e.jsx("p",{className:"text-[0.65rem] text-muted-foreground/70",children:o.description})]})}function Xt(...o){return ue(pe(o))}function Ze({items:o,canvasWidth:A,canvasHeight:F,position:C="bottom-right",size:b=150,className:$}){const f=Math.min(b/A,b/F),g=A*f,v=F*f,s={"top-left":"top-2 left-2","top-right":"top-2 right-2","bottom-left":"bottom-2 left-2","bottom-right":"bottom-2 right-2"};return e.jsx("div",{className:Xt("absolute border rounded bg-background/90 shadow-sm overflow-hidden",s[C],$),role:"img","aria-label":"Canvas minimap",children:e.jsxs("svg",{width:g,height:v,viewBox:`0 0 ${A} ${F}`,children:[e.jsx("rect",{width:A,height:F,fill:"hsl(var(--muted))",opacity:"0.3"}),o.map(y=>e.jsx("rect",{x:y.x,y:y.y,width:y.width,height:y.height,fill:y.selected?"hsl(var(--primary))":y.color??"hsl(var(--foreground) / 0.3)",rx:"2"},y.id))]})})}const at=l.createContext(null);at.displayName="CollaborationContext";function Ie(){return l.useContext(at)}function te(...o){return ue(pe(o))}function Kt({canvas:o={width:1200,height:800,gridSize:8,showGrid:!0,snapToGrid:!0},components:A=[],palette:F=Yt,showComponentTree:C=!0,undoRedo:b=!0,propertyEditor:$=!0,readOnly:f=!1,showMinimap:g=!1,onChange:v,className:s}){const y=Se(A),c=y.current,d=l.useCallback(n=>{y.push(n),v?.(n)},[y,v]),j=Le({initialZoom:o.zoom??1}),{zoom:p}=j,x=$e(),I=l.useMemo(()=>{const n=Array.from(x.selectedIds);return n.length>0?n[0]:null},[x.selectedIds]),P=l.useMemo(()=>c.find(n=>n.id===I),[c,I]),O=Te(),k=De(),E=Ie(),N=l.useCallback(n=>{E&&E.sendOperation({...n,userId:E.currentUserId??""})},[E]),[L,H]=l.useState(!0),[G,Z]=l.useState(!0),[Q,Y]=l.useState(g),V=l.useRef(null),q=l.useRef(null),J=l.useCallback(n=>!o.snapToGrid||!o.gridSize?n:Math.round(n/o.gridSize)*o.gridSize,[o.snapToGrid,o.gridSize]),ae=l.useCallback((n,a)=>{if(f)return;const r=F.flatMap(T=>T.items).find(T=>T.type===n),t=r?.defaultSize,i={id:`comp-${Date.now()}`,type:n,label:a,position:{x:100,y:100,width:t?.width??200,height:t?.height??100},props:r?.defaultProps??{}},h=[...c,i];d(h),x.selectOne(i.id),N({type:"insert",elementId:i.id,data:{component:i}})},[c,f,F,d,x,N]),ee=l.useCallback(n=>{if(f)return;const a=c.filter(r=>r.id!==n);d(a),x.isSelected(n)&&x.clearSelection(),N({type:"delete",elementId:n,data:{}})},[c,f,d,x,N]),B=l.useCallback(async()=>{if(f||x.count===0||!await k.confirm("Delete components",`Are you sure you want to delete ${x.count} component${x.count>1?"s":""}?`))return;const n=x.selectedIds,a=c.filter(r=>!n.has(r.id));d(a),x.clearSelection(),n.forEach(r=>{N({type:"delete",elementId:r,data:{}})})},[f,x,k,c,d,N]),le=l.useCallback((n,a)=>{if(f||!I)return;const r=c.map(t=>t.id!==I?t:n==="label"?{...t,label:String(a)}:n==="x"?{...t,position:{...t.position,x:Number(a)}}:n==="y"?{...t,position:{...t.position,y:Number(a)}}:n==="width"?{...t,position:{...t.position,width:Number(a)}}:n==="height"?{...t,position:{...t.position,height:Number(a)}}:{...t,props:{...t.props,[n]:a}});d(r),N({type:"update",elementId:I,data:{[n]:a}})},[f,I,c,d,N]),se=l.useCallback(()=>{const n=x.selectedIds;if(n.size===0)return;const a=c.filter(r=>n.has(r.id));O.copy(a)},[x,c,O]),_=l.useCallback(()=>{if(f)return;const n=O.paste();if(!n||n.length===0)return;let a=0;const r=n.map(i=>({...i,id:`comp-${Date.now()}-${++a}-${Math.random().toString(36).slice(2,7)}`,position:{...i.position,x:i.position.x+20,y:i.position.y+20}})),t=[...c,...r];d(t),x.selectMany(r.map(i=>i.id)),r.forEach(i=>{N({type:"insert",elementId:i.id,data:{component:i}})})},[f,O,c,d,x,N]),ne=l.useCallback((n,a)=>{f||(V.current={id:a.id,startX:n.clientX,startY:n.clientY},n.dataTransfer.effectAllowed="move",n.dataTransfer.setData("text/plain",a.id))},[f]),re=l.useCallback(n=>{n.preventDefault(),n.dataTransfer.dropEffect="move"},[]),w=l.useCallback(n=>{n.preventDefault();const a=V.current;if(!a||f)return;const r=(n.clientX-a.startX)/p,t=(n.clientY-a.startY)/p,i=c.map(h=>h.id!==a.id?h:{...h,position:{...h.position,x:J(h.position.x+r),y:J(h.position.y+t)}});d(i),N({type:"move",elementId:a.id,data:{}}),V.current=null},[f,p,c,d,J,N]),M=l.useMemo(()=>P?[{name:"label",label:"Label",type:"text",value:P.label??"",group:"General"},{name:"x",label:"X",type:"number",value:P.position.x,group:"Position"},{name:"y",label:"Y",type:"number",value:P.position.y,group:"Position"},{name:"width",label:"Width",type:"number",value:P.position.width,group:"Size"},{name:"height",label:"Height",type:"number",value:P.position.height,group:"Size"}]:[],[P]),m=l.useMemo(()=>c.map(n=>({id:n.id,x:n.position.x,y:n.position.y,width:typeof n.position.width=="number"?n.position.width:100,height:typeof n.position.height=="number"?n.position.height:50,selected:x.isSelected(n.id)})),[c,x]);return l.useEffect(()=>{const n=q.current;if(!n)return;const a=r=>{const t=["INPUT","TEXTAREA","SELECT"].includes(r.target.tagName),i=r.ctrlKey||r.metaKey;if((r.key==="Delete"||r.key==="Backspace")&&x.count>0&&!t){r.preventDefault(),B();return}if(r.key==="Escape"){x.clearSelection();return}if(!t){if(i&&r.key==="z"&&!r.shiftKey&&b&&!f){r.preventDefault(),y.undo();return}if(i&&(r.key==="z"&&r.shiftKey||r.key==="y")&&b&&!f){r.preventDefault(),y.redo();return}if(i&&r.key==="c"){r.preventDefault(),se();return}if(i&&r.key==="v"&&!f){r.preventDefault(),_();return}if(i&&r.key==="a"){r.preventDefault(),x.selectMany(c.map(h=>h.id));return}}};return n.addEventListener("keydown",a),()=>n.removeEventListener("keydown",a)},[x,B,b,f,y,se,_,c]),e.jsxs("div",{ref:q,tabIndex:0,className:te("flex h-full w-full border rounded-lg overflow-hidden bg-background",s),children:[!f&&e.jsx("div",{className:te("border-r bg-muted/30 flex flex-col transition-[width] duration-200",L?"w-60":"w-0 overflow-hidden"),role:"region","aria-label":"Component palette",children:L&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-3 border-b font-medium text-sm",children:"Components"}),e.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:F.map(n=>e.jsxs("div",{className:"mb-3",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground px-2 py-1 uppercase",children:n.label}),n.items.map(a=>e.jsxs("button",{onClick:()=>ae(a.type,a.label),className:"w-full flex items-center gap-2 px-2 py-1.5 text-sm rounded hover:bg-accent text-left",children:[e.jsx(ce,{className:"h-3 w-3"}),a.label]},a.type))]},n.name))})]})}),e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 p-2 border-b bg-muted/20",role:"toolbar","aria-label":"Designer toolbar",children:[!f&&e.jsx("button",{className:"p-1.5 rounded hover:bg-accent",title:L?"Collapse palette":"Expand palette","aria-label":L?"Collapse palette":"Expand palette",onClick:()=>H(n=>!n),children:e.jsx(Nt,{className:te("h-4 w-4",!L&&"rotate-180")})}),b&&!f&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-5 bg-border mx-1"}),e.jsx("button",{className:te("p-1.5 rounded hover:bg-accent",!y.canUndo&&"opacity-40 pointer-events-none"),title:"Undo (Ctrl+Z)","aria-label":"Undo",disabled:!y.canUndo,onClick:()=>y.undo(),children:e.jsx(je,{className:"h-4 w-4"})}),e.jsx("button",{className:te("p-1.5 rounded hover:bg-accent",!y.canRedo&&"opacity-40 pointer-events-none"),title:"Redo (Ctrl+Shift+Z)","aria-label":"Redo",disabled:!y.canRedo,onClick:()=>y.redo(),children:e.jsx(Ne,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-5 bg-border mx-1"})]}),!f&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:te("p-1.5 rounded hover:bg-accent",x.count===0&&"opacity-40 pointer-events-none"),title:"Copy (Ctrl+C)","aria-label":"Copy",disabled:x.count===0,onClick:se,children:e.jsx(Ce,{className:"h-4 w-4"})}),e.jsx("button",{className:te("p-1.5 rounded hover:bg-accent",!O.hasContent&&"opacity-40 pointer-events-none"),title:"Paste (Ctrl+V)","aria-label":"Paste",disabled:!O.hasContent,onClick:_,children:e.jsx(ke,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-5 bg-border mx-1"})]}),!f&&e.jsx("button",{className:te("p-1.5 rounded hover:bg-accent",x.count===0&&"opacity-40 pointer-events-none"),title:"Delete selected","aria-label":"Delete selected",disabled:x.count===0,onClick:B,children:e.jsx(de,{className:"h-4 w-4"})}),e.jsx("button",{className:"p-1.5 rounded hover:bg-accent",title:"Preview","aria-label":"Preview",children:e.jsx(Je,{className:"h-4 w-4"})}),e.jsx("button",{className:te("p-1.5 rounded hover:bg-accent",Q&&"bg-accent"),title:"Toggle minimap","aria-label":"Toggle minimap",onClick:()=>Y(n=>!n),children:e.jsx(qe,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{className:"p-1 rounded hover:bg-accent text-xs","aria-label":"Zoom out",onClick:j.zoomOut,children:e.jsx(Ct,{className:"h-3 w-3"})}),e.jsxs("span",{className:"text-xs text-muted-foreground w-10 text-center",children:[Math.round(p*100),"%"]}),e.jsx("button",{className:"p-1 rounded hover:bg-accent text-xs","aria-label":"Zoom in",onClick:j.zoomIn,children:e.jsx(ce,{className:"h-3 w-3"})}),e.jsx("button",{className:"p-1 rounded hover:bg-accent text-xs","aria-label":"Reset zoom",onClick:j.resetZoom,children:e.jsx(kt,{className:"h-3 w-3"})})]}),C&&e.jsx("button",{className:"p-1.5 rounded hover:bg-accent",title:G?"Collapse panel":"Expand panel","aria-label":G?"Collapse panel":"Expand panel",onClick:()=>Z(n=>!n),children:e.jsx(Ue,{className:te("h-4 w-4",!G&&"rotate-180")})})]}),e.jsx("div",{className:"flex-1 overflow-auto bg-muted/10 p-4 relative",role:"region","aria-label":"Design canvas",onWheel:j.handleWheel,onMouseDown:j.startPan,onDragOver:re,onDrop:w,children:e.jsxs("div",{className:"relative bg-background border rounded shadow-sm mx-auto",style:{width:o.width*p,height:o.height*p,transform:`translate(${j.panOffset.x}px, ${j.panOffset.y}px)`,backgroundImage:o.showGrid?"radial-gradient(circle, hsl(var(--border)) 1px, transparent 1px)":void 0,backgroundSize:o.showGrid&&o.gridSize?`${o.gridSize*p}px ${o.gridSize*p}px`:void 0},children:[c.map(n=>{const a=x.isSelected(n.id);return e.jsxs("div",{draggable:!f,onDragStart:r=>ne(r,n),className:te("absolute border rounded cursor-move select-none transition-shadow",a?"border-primary ring-2 ring-primary/20 shadow-md":"border-border hover:border-primary/50"),style:{left:n.position.x*p,top:n.position.y*p,width:typeof n.position.width=="number"?n.position.width*p:n.position.width,height:typeof n.position.height=="number"?n.position.height*p:n.position.height},onClick:r=>x.toggle(n.id,r.shiftKey),children:[e.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 bg-muted/50 text-xs border-b",children:[e.jsx(_e,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("span",{className:"truncate",children:n.label??n.type}),!f&&e.jsx("button",{onClick:r=>{r.stopPropagation(),ee(n.id)},className:"ml-auto p-0.5 rounded hover:bg-destructive/10","aria-label":`Delete ${n.label??n.type}`,children:e.jsx(de,{className:"h-3 w-3 text-destructive"})})]}),e.jsx("div",{className:"p-2 text-xs text-muted-foreground",children:n.type})]},n.id)}),Q&&e.jsx(Ze,{items:m,canvasWidth:o.width,canvasHeight:o.height})]})})]}),C&&e.jsx("div",{className:te("border-l bg-muted/30 flex flex-col transition-[width] duration-200",G?"w-60":"w-0 overflow-hidden"),role:"region","aria-label":"Component tree",children:G&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"p-3 border-b font-medium text-sm flex items-center gap-2",children:[e.jsx(St,{className:"h-4 w-4"}),"Component Tree"]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:c.length===0?e.jsx("div",{className:"text-xs text-muted-foreground text-center py-4",children:"No components added yet. Click a component in the palette to add it to the canvas."}):c.map(n=>e.jsx("button",{onClick:a=>x.toggle(n.id,a.shiftKey),className:te("w-full flex items-center gap-2 px-2 py-1.5 text-sm rounded text-left",x.isSelected(n.id)?"bg-accent":"hover:bg-accent/50"),children:e.jsx("span",{className:"truncate",children:n.label??n.type})},n.id))}),$&&P?e.jsx("div",{className:"border-t",children:e.jsx(Oe,{title:`Properties – ${P.label??P.type}`,fields:M,onChange:le})}):P&&e.jsxs("div",{className:"border-t p-3",children:[e.jsx("div",{className:"text-xs font-medium mb-2",children:"Properties"}),e.jsxs("div",{className:"text-xs text-muted-foreground space-y-1",children:[e.jsxs("div",{children:["Type: ",P.type]}),e.jsxs("div",{children:["ID: ",P.id]}),e.jsxs("div",{children:["Position: ",P.position.x,","," ",P.position.y]}),e.jsxs("div",{children:["Size: ",P.position.width," ×"," ",P.position.height]})]})]})]})}),e.jsx(Fe,{isOpen:k.isOpen,title:k.title,message:k.message,onConfirm:k.onConfirm,onCancel:k.onCancel})]})}const Yt=[{name:"layout",label:"Layout",items:[{type:"container",label:"Container",defaultSize:{width:400,height:300}},{type:"flex",label:"Flex",defaultSize:{width:400,height:200}},{type:"grid",label:"Grid",defaultSize:{width:400,height:300}},{type:"card",label:"Card",defaultSize:{width:300,height:200}},{type:"tabs",label:"Tabs",defaultSize:{width:400,height:300}}]},{name:"form",label:"Form",items:[{type:"input",label:"Input",defaultSize:{width:300,height:60}},{type:"textarea",label:"Textarea",defaultSize:{width:300,height:120}},{type:"select",label:"Select",defaultSize:{width:300,height:60}},{type:"checkbox",label:"Checkbox",defaultSize:{width:200,height:40}},{type:"button",label:"Button",defaultSize:{width:120,height:40}}]},{name:"data",label:"Data",items:[{type:"table",label:"Table",defaultSize:{width:600,height:400}},{type:"chart",label:"Chart",defaultSize:{width:400,height:300}},{type:"list",label:"List",defaultSize:{width:300,height:400}},{type:"statistic",label:"Statistic",defaultSize:{width:200,height:100}}]}];function Me(...o){return ue(pe(o))}function Wt(o,A=4,F=280,C=250,b=50,$=50){return o.map((f,g)=>({...f,position:{x:b+g%A*F,y:$+Math.floor(g/A)*C}}))}function Bt({entities:o=[],relationships:A=[],canvas:F={width:1200,height:800,showGrid:!0},showRelationshipLabels:C=!0,readOnly:b=!1,onEntitiesChange:$,onRelationshipsChange:f,className:g}){const v=l.useRef(null),s=Se({entities:o,relationships:A},{maxHistory:50}),{entities:y,relationships:c}=s.current,d=l.useCallback(t=>{s.push(t),$?.(t.entities),f?.(t.relationships)},[s,$,f]),j=De(),p=$e(),x=p.count>0?Array.from(p.selectedIds)[0]:null,I=Te(),P=Le({minZoom:.25,maxZoom:3,zoomStep:.1}),O=Ie(),[k,E]=l.useState(!0),[N,L]=l.useState(!0),[H,G]=l.useState(null),[Z,Q]=l.useState(""),Y=l.useRef(null),V=l.useCallback(()=>{if(b)return;const t=s.current,i={id:`entity-${Date.now()}`,name:`new_entity_${t.entities.length+1}`,label:`New Entity ${t.entities.length+1}`,fields:[{name:"id",type:"uuid",primaryKey:!0,required:!0},{name:"created_at",type:"datetime",required:!0},{name:"updated_at",type:"datetime",required:!0}],position:{x:50+t.entities.length%4*280,y:50+Math.floor(t.entities.length/4)*250}},h={entities:[...t.entities,i],relationships:t.relationships};d(h),p.selectOne(i.id),O?.sendOperation({type:"insert",userId:O?.currentUserId??"",elementId:i.id,data:{name:i.name,label:i.label}})},[b,s,d,p,O]),q=l.useCallback(async t=>{if(b)return;const i=y.find(R=>R.id===t);if(!await j.confirm("Delete Entity",`Are you sure you want to delete "${i?.label??t}"? This action cannot be undone.`))return;const h=s.current,T={entities:h.entities.filter(R=>R.id!==t),relationships:h.relationships.filter(R=>R.sourceEntity!==t&&R.targetEntity!==t)};d(T),p.isSelected(t)&&p.clearSelection(),O?.sendOperation({type:"delete",userId:O?.currentUserId??"",elementId:t,data:{}})},[b,y,j,s,d,p,O]),J=l.useCallback(async()=>{if(b||p.count===0)return;const t=Array.from(p.selectedIds);if(!await j.confirm("Delete Entities",`Are you sure you want to delete ${t.length} selected entity(s)? This action cannot be undone.`))return;const i=s.current,h=new Set(t),T={entities:i.entities.filter(R=>!h.has(R.id)),relationships:i.relationships.filter(R=>!h.has(R.sourceEntity)&&!h.has(R.targetEntity))};d(T),p.clearSelection()},[b,p,j,s,d]),ae=l.useCallback(()=>{if(b)return;const t=s.current,i={entities:Wt(t.entities),relationships:t.relationships};d(i)},[b,s,d]),ee=l.useCallback(()=>{const t=y.filter(i=>p.isSelected(i.id));t.length>0&&I.copy(t)},[y,p,I]),B=l.useCallback(()=>{if(b)return;const t=I.paste();if(!t||t.length===0)return;const i=s.current,h=t.map((R,ie)=>({...R,id:`entity-${Date.now()}-${ie}`,name:`${R.name}_copy`,label:`${R.label} (Copy)`,position:{x:R.position.x+30,y:R.position.y+30}})),T={entities:[...i.entities,...h],relationships:i.relationships};d(T),p.selectMany(h.map(R=>R.id))},[b,I,s,d,p]),le=l.useCallback(t=>{if(b)return;const i=s.current,h={entities:i.entities.map(T=>{if(T.id!==t)return T;const R={name:`field_${T.fields.length+1}`,type:"text",required:!1};return{...T,fields:[...T.fields,R]}}),relationships:i.relationships};d(h)},[b,s,d]),se=l.useCallback((t,i,h)=>{b||(G({entityId:t,fieldIndex:i}),Q(h))},[b]),_=l.useCallback(()=>{if(!H)return;const t=Z.trim();if(t===""){G(null);return}const i=s.current,h={entities:i.entities.map(T=>{if(T.id!==H.entityId)return T;const R=T.fields.map((ie,ge)=>ge===H.fieldIndex?{...ie,name:t}:ie);return{...T,fields:R}}),relationships:i.relationships};d(h),G(null)},[H,Z,s,d]),ne=l.useCallback(()=>{G(null)},[]),re=l.useCallback((t,i)=>{if(b||!y.find(T=>T.id===i))return;const h=t.target.getBoundingClientRect();Y.current={entityId:i,offsetX:t.clientX-h.left,offsetY:t.clientY-h.top},t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",i)},[b,y]),w=l.useCallback(t=>{t.preventDefault(),t.dataTransfer.dropEffect="move"},[]),M=l.useCallback(t=>{if(t.preventDefault(),!Y.current)return;const i=t.currentTarget.getBoundingClientRect(),h=P.zoom,T=(t.clientX-i.left-P.panOffset.x)/h-Y.current.offsetX,R=(t.clientY-i.top-P.panOffset.y)/h-Y.current.offsetY,ie=s.current,ge={entities:ie.entities.map(fe=>fe.id===Y.current.entityId?{...fe,position:{x:Math.max(0,Math.round(T)),y:Math.max(0,Math.round(R))}}:fe),relationships:ie.relationships};d(ge),Y.current=null},[P.zoom,P.panOffset,s,d]),m=x?y.find(t=>t.id===x):null,n=m?[{name:"name",label:"Name",type:"text",value:m.name,group:"General"},{name:"label",label:"Label",type:"text",value:m.label,group:"General"},{name:"description",label:"Description",type:"textarea",value:m.description??"",group:"General"},{name:"color",label:"Color",type:"color",value:m.color??"#3b82f6",group:"Appearance"},{name:"position.x",label:"X Position",type:"number",value:m.position.x,group:"Position"},{name:"position.y",label:"Y Position",type:"number",value:m.position.y,group:"Position"}]:[],a=l.useCallback((t,i)=>{if(!x)return;const h=s.current,T={entities:h.entities.map(R=>R.id!==x?R:t==="position.x"?{...R,position:{...R.position,x:Number(i)}}:t==="position.y"?{...R,position:{...R.position,y:Number(i)}}:{...R,[t]:i}),relationships:h.relationships};d(T)},[x,s,d]);l.useEffect(()=>{const t=v.current;if(!t)return;const i=h=>{const T=h.target.tagName;if(T==="INPUT"||T==="TEXTAREA"||T==="SELECT")return;const R=h.ctrlKey||h.metaKey;R&&h.key==="z"?(h.preventDefault(),s.undo()):R&&(h.key==="y"||h.shiftKey&&h.key==="Z")?(h.preventDefault(),s.redo()):R&&h.key==="c"?(h.preventDefault(),ee()):R&&h.key==="v"?(h.preventDefault(),B()):(h.key==="Delete"||h.key==="Backspace")&&p.count>0?(h.preventDefault(),J()):h.key==="Escape"&&(p.clearSelection(),G(null))};return t.addEventListener("keydown",i),()=>t.removeEventListener("keydown",i)},[s,ee,B,J,p]);const r=y.map(t=>({id:t.id,x:t.position.x,y:t.position.y,width:240,height:40+t.fields.length*24,color:t.color,selected:p.isSelected(t.id)}));return e.jsxs("div",{ref:v,tabIndex:0,className:Me("flex h-full w-full border rounded-lg overflow-hidden bg-background",g),children:[e.jsxs("div",{className:"flex flex-col flex-1 min-w-0",children:[e.jsxs("div",{role:"toolbar","aria-label":"Designer toolbar",className:"flex items-center gap-2 p-2 border-b bg-muted/20 flex-wrap",children:[e.jsx(He,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium text-sm",children:"Data Model Designer"}),e.jsxs("div",{className:"flex items-center gap-1 ml-2 border-l pl-2",children:[e.jsx("button",{onClick:()=>s.undo(),disabled:!s.canUndo,"aria-label":"Undo",title:"Undo (Ctrl+Z)",className:"p-1 rounded hover:bg-accent disabled:opacity-40",children:e.jsx(je,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:()=>s.redo(),disabled:!s.canRedo,"aria-label":"Redo",title:"Redo (Ctrl+Y)",className:"p-1 rounded hover:bg-accent disabled:opacity-40",children:e.jsx(Ne,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"flex items-center gap-1 border-l pl-2",children:[e.jsx("button",{onClick:P.zoomOut,"aria-label":"Zoom Out",title:"Zoom Out",className:"p-1 rounded hover:bg-accent",children:e.jsx(Qe,{className:"h-3.5 w-3.5"})}),e.jsxs("span",{className:"text-xs tabular-nums w-10 text-center",children:[Math.round(P.zoom*100),"%"]}),e.jsx("button",{onClick:P.zoomIn,"aria-label":"Zoom In",title:"Zoom In",className:"p-1 rounded hover:bg-accent",children:e.jsx(et,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:P.resetZoom,"aria-label":"Reset Zoom",title:"Reset Zoom",className:"p-1 rounded hover:bg-accent",children:e.jsx(tt,{className:"h-3 w-3"})})]}),!b&&e.jsxs("div",{className:"flex items-center gap-1 border-l pl-2",children:[e.jsx("button",{onClick:ee,disabled:p.count===0,"aria-label":"Copy",title:"Copy (Ctrl+C)",className:"p-1 rounded hover:bg-accent disabled:opacity-40",children:e.jsx(Ce,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:B,disabled:!I.hasContent,"aria-label":"Paste",title:"Paste (Ctrl+V)",className:"p-1 rounded hover:bg-accent disabled:opacity-40",children:e.jsx(ke,{className:"h-3.5 w-3.5"})})]}),!b&&e.jsxs("button",{onClick:ae,"aria-label":"Auto Layout",title:"Auto Layout",className:"flex items-center gap-1 px-2 py-1 text-xs rounded border hover:bg-accent",children:[e.jsx(Dt,{className:"h-3 w-3"})," Auto Layout"]}),e.jsx("div",{className:"flex-1"}),O?.isConnected&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",role:"status","aria-label":"Collaboration active",children:[e.jsx(Tt,{className:"h-3 w-3"}),e.jsxs("span",{children:[O.users.length," user",O.users.length!==1?"s":""]})]}),p.count>1&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[p.count," selected"]}),!b&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:V,"aria-label":"Add Entity",className:"flex items-center gap-1 px-2 py-1 text-xs rounded bg-primary text-primary-foreground hover:bg-primary/90",children:[e.jsx(ce,{className:"h-3 w-3"})," Add Entity"]}),e.jsxs("button",{"aria-label":"Add Relationship",title:"Add Relationship (coming soon)",className:"flex items-center gap-1 px-2 py-1 text-xs rounded bg-secondary text-secondary-foreground hover:bg-secondary/80",children:[e.jsx(Ft,{className:"h-3 w-3"})," Add Relationship"]})]})]}),e.jsxs("div",{role:"region","aria-label":"Canvas",className:"flex-1 overflow-auto bg-muted/10 p-4 relative",onWheel:P.handleWheel,onMouseDown:P.startPan,onDragOver:w,onDrop:M,children:[e.jsxs("div",{className:"relative",style:{width:F.width,minHeight:F.height,...P.transformStyle,backgroundImage:F.showGrid?"radial-gradient(circle, hsl(var(--border)) 1px, transparent 1px)":void 0,backgroundSize:F.showGrid?"20px 20px":void 0},children:[e.jsx("svg",{className:"absolute inset-0 pointer-events-none",width:F.width,height:F.height,children:c.map(t=>{const i=y.find(T=>T.id===t.sourceEntity),h=y.find(T=>T.id===t.targetEntity);return!i||!h?null:e.jsxs("g",{children:[e.jsx("line",{x1:i.position.x+120,y1:i.position.y+50,x2:h.position.x+120,y2:h.position.y+50,stroke:"hsl(var(--primary))",strokeWidth:"2",strokeDasharray:t.type==="many-to-many"?"5,5":void 0}),C&&t.label&&e.jsx("text",{x:(i.position.x+h.position.x)/2+120,y:(i.position.y+h.position.y)/2+50-8,textAnchor:"middle",className:"text-xs fill-muted-foreground",children:t.label})]},t.id)})}),y.length===0&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground text-sm",children:"No entities in the model. Click 'Add Entity' to create your first entity."}),y.map(t=>e.jsxs("div",{role:"group","aria-label":t.label,draggable:!b,onDragStart:i=>re(i,t.id),className:Me("absolute rounded-lg border-2 bg-background shadow-sm w-60 select-none cursor-grab active:cursor-grabbing",p.isSelected(t.id)?"border-primary ring-2 ring-primary/20":"border-border hover:border-primary/50"),style:{left:t.position.x,top:t.position.y},onClick:i=>p.toggle(t.id,i.shiftKey),children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-t-lg font-medium text-sm",style:{backgroundColor:t.color??"hsl(var(--primary) / 0.1)"},children:[e.jsx(He,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"truncate",children:t.label}),!b&&e.jsx("button",{onClick:i=>{i.stopPropagation(),q(t.id)},"aria-label":`Delete ${t.label}`,className:"ml-auto p-0.5 rounded hover:bg-destructive/20",children:e.jsx(de,{className:"h-3 w-3 text-destructive"})})]}),e.jsx("div",{className:"px-3 py-1 divide-y",children:t.fields.map((i,h)=>e.jsxs("div",{className:"flex items-center gap-2 py-1 text-xs",children:[H&&H.entityId===t.id&&H.fieldIndex===h?e.jsx("input",{type:"text",value:Z,onChange:T=>Q(T.target.value),onBlur:_,onKeyDown:T=>{T.key==="Enter"&&_(),T.key==="Escape"&&ne()},className:"font-mono text-xs px-1 py-0 border rounded bg-background w-24 focus:outline-none focus:ring-1 focus:ring-primary",autoFocus:!0,onClick:T=>T.stopPropagation()}):e.jsxs("span",{className:Me("font-mono cursor-text",i.primaryKey&&"font-bold text-primary"),onClick:T=>{T.stopPropagation(),se(t.id,h,i.name)},title:"Click to edit field name",children:[i.primaryKey&&e.jsx("span",{className:"text-[0.65rem] font-semibold text-primary mr-0.5",children:"PK"}),i.name]}),e.jsx("span",{className:"text-muted-foreground ml-auto",children:i.type}),i.required&&e.jsx("span",{className:"text-destructive",children:"*"})]},`${i.name}-${h}`))}),!b&&e.jsx("div",{className:"px-3 py-1 border-t",children:e.jsxs("button",{onClick:i=>{i.stopPropagation(),le(t.id)},"aria-label":`Add field to ${t.label}`,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground w-full py-0.5",children:[e.jsx(ce,{className:"h-3 w-3"})," Add Field"]})})]},t.id))]}),N&&y.length>0&&e.jsx(Ze,{items:r,canvasWidth:F.width,canvasHeight:F.height,position:"bottom-right",size:150})]})]}),e.jsxs("div",{className:"w-64 border-l flex flex-col bg-background shrink-0",children:[e.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[e.jsxs("button",{onClick:()=>E(t=>!t),className:"flex items-center gap-1 px-3 py-2 text-xs font-medium text-muted-foreground hover:bg-accent/50 border-b","aria-expanded":k,"aria-controls":"property-editor-panel",children:[k?e.jsx(Re,{className:"h-3 w-3"}):e.jsx(Ge,{className:"h-3 w-3"}),"Properties"]}),k&&e.jsx("div",{id:"property-editor-panel",className:"flex-1 overflow-y-auto",children:e.jsx(Oe,{title:m?m.label:"Properties",fields:n,onChange:a})})]}),e.jsx("div",{className:"border-t",children:e.jsxs("button",{onClick:()=>L(t=>!t),className:"flex items-center gap-1 px-3 py-2 text-xs font-medium text-muted-foreground hover:bg-accent/50 w-full","aria-expanded":N,children:[N?e.jsx(Re,{className:"h-3 w-3"}):e.jsx(Ge,{className:"h-3 w-3"}),"Minimap"]})})]}),e.jsx(Fe,{isOpen:j.isOpen,title:j.title,message:j.message,onConfirm:j.onConfirm,onCancel:j.onCancel,destructive:!0})]})}function Pe(...o){return ue(pe(o))}const be=120,ve=50;function qt(o,A){if(o.length===0)return o;const F=200,C=100,b=new Map,$=new Map;for(const c of o)b.set(c.id,0),$.set(c.id,[]);for(const c of A)b.set(c.target,(b.get(c.target)??0)+1),$.get(c.source)?.push(c.target);const f=[],g=new Set;let v=o.filter(c=>(b.get(c.id)??0)===0).map(c=>c.id);for(v.length===0&&(v=[o[0].id]);v.length>0;){f.push(v);for(const d of v)g.add(d);const c=new Set;for(const d of v)for(const j of $.get(d)??[])g.has(j)||c.add(j);v=Array.from(c)}const s=o.filter(c=>!g.has(c.id)).map(c=>c.id);s.length>0&&f.push(s);const y=new Map;for(let c=0;c<f.length;c++){const d=f[c];for(let j=0;j<d.length;j++)y.set(d[j],{x:80+c*F,y:80+j*C})}return o.map(c=>({...c,position:y.get(c.id)??c.position}))}function _t({processName:o="New Process",nodes:A=[],edges:F=[],lanes:C,canvas:b={width:1400,height:800,showGrid:!0},showMinimap:$=!0,showToolbar:f=!0,readOnly:g=!1,onNodesChange:v,onEdgesChange:s,className:y}){const c=Se({nodes:A,edges:F},{maxHistory:50}),d=c.current.nodes,j=c.current.edges,p=l.useCallback((u,U)=>{c.push({nodes:u,edges:U}),v?.(u),s?.(U)},[c,v,s]),x=De(),I=$e(),P=Te(),O=Le({initialZoom:1}),k=Ie(),[E,N]=l.useState(null),[L,H]=l.useState(!1),[G,Z]=l.useState(null),[Q,Y]=l.useState(null),[V,q]=l.useState(!0),[J,ae]=l.useState(null),[ee,B]=l.useState({x:0,y:0}),le=l.useRef(null),se=l.useRef(v),_=l.useRef(s);se.current=v,_.current=s,l.useEffect(()=>{se.current?.(d),_.current?.(j)},[c.current]);const ne=l.useCallback((u,U)=>{if(g)return;const z={id:`node-${Date.now()}`,type:u,label:U,position:{x:200+d.length*160,y:200}},X=[...d,z];p(X,j),N(z.id),I.selectOne(z.id),k?.sendOperation({type:"insert",elementId:z.id,data:{label:U},userId:k.currentUserId??""})},[d,j,g,p,I,k]),re=l.useCallback(async u=>{if(g)return;const U=d.find(K=>K.id===u);if(!await x.confirm("Delete Node",`Are you sure you want to delete "${U?.label??u}"? This will also remove all connected edges.`))return;const z=d.filter(K=>K.id!==u),X=j.filter(K=>K.source!==u&&K.target!==u);p(z,X),E===u&&N(null),I.clearSelection(),k?.sendOperation({type:"delete",elementId:u,data:{},userId:k.currentUserId??""})},[d,j,E,g,p,x,I,k]),w=l.useCallback(async()=>{if(g||I.count===0||!await x.confirm("Delete Selected Nodes",`Are you sure you want to delete ${I.count} selected node(s) and their connected edges?`))return;const u=I.selectedIds,U=d.filter(X=>!u.has(X.id)),z=j.filter(X=>!u.has(X.source)&&!u.has(X.target));p(U,z),N(null),I.clearSelection()},[d,j,g,p,x,I]),M=l.useCallback(()=>{const u=I.count>0?I.selectedIds:E?new Set([E]):new Set;if(u.size===0)return;const U=d.filter(z=>u.has(z.id));P.copy(U)},[d,E,I,P]),m=l.useCallback(()=>{if(g)return;const u=P.paste();if(!u||u.length===0)return;const U=40,z=u.map(K=>({...K,id:`node-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,position:{x:K.position.x+U,y:K.position.y+U}})),X=[...d,...z];p(X,j),I.selectMany(z.map(K=>K.id)),N(z[0].id)},[g,d,j,P,p,I]),n=l.useCallback(()=>{H(u=>u?(Z(null),!1):!0)},[]),a=l.useCallback(u=>{if(!L)return!1;if(!G)return Z(u),!0;if(G===u)return!0;const U={id:`edge-${Date.now()}`,source:G,target:u},z=[...j,U];return p(d,z),Z(null),H(!1),k?.sendOperation({type:"insert",elementId:U.id,data:{source:G,target:u},userId:k.currentUserId??""}),!0},[L,G,d,j,p,k]),r=l.useCallback(()=>{if(g||d.length===0)return;const u=qt(d,j);p(u,j)},[d,j,g,p]),t=l.useCallback((u,U)=>{if(g||!d.find(X=>X.id===U))return;ae(U);const z=u.target.getBoundingClientRect();B({x:u.clientX-z.left,y:u.clientY-z.top}),u.dataTransfer.effectAllowed="move",u.dataTransfer.setData("text/plain",U)},[g,d]),i=l.useCallback(u=>{if(u.preventDefault(),g||!J)return;const U=u.currentTarget.getBoundingClientRect(),z=O.zoom,X=(u.clientX-U.left-O.panOffset.x)/z-ee.x,K=(u.clientY-U.top-O.panOffset.y)/z-ee.y,W=Math.max(0,Math.round(X/20)*20),xe=Math.max(0,Math.round(K/20)*20),he=d.map(me=>me.id===J?{...me,position:{x:W,y:xe}}:me);p(he,j),ae(null)},[g,J,ee,d,j,O.zoom,O.panOffset,p]),h=l.useCallback(u=>{u.preventDefault(),u.dataTransfer.dropEffect="move"},[]),T=l.useMemo(()=>d.find(u=>u.id===E)??null,[d,E]),R=l.useMemo(()=>T?[{name:"label",label:"Name",type:"text",value:T.label,group:"General"},{name:"type",label:"Type",type:"select",value:T.type,options:[{label:"Start Event",value:"start-event"},{label:"End Event",value:"end-event"},{label:"User Task",value:"user-task"},{label:"Service Task",value:"service-task"},{label:"Script Task",value:"script-task"},{label:"Exclusive Gateway",value:"exclusive-gateway"},{label:"Parallel Gateway",value:"parallel-gateway"},{label:"Inclusive Gateway",value:"inclusive-gateway"}],group:"General"},{name:"description",label:"Description",type:"textarea",value:T.description??"",group:"General"}]:[],[T]),ie=l.useCallback((u,U)=>{if(g||!E)return;const z=d.map(X=>X.id===E?{...X,[u]:U}:X);p(z,j)},[g,E,d,j,p]),ge=u=>{switch(u){case"start-event":return"rounded-full bg-green-100 border-green-500 text-green-700";case"end-event":return"rounded-full bg-red-100 border-red-500 text-red-700";case"exclusive-gateway":case"parallel-gateway":case"inclusive-gateway":case"event-based-gateway":return"rotate-45 bg-yellow-100 border-yellow-500 text-yellow-700";case"user-task":return"rounded bg-blue-100 border-blue-500 text-blue-700";case"service-task":case"script-task":return"rounded bg-purple-100 border-purple-500 text-purple-700";default:return"rounded bg-gray-100 border-gray-500 text-gray-700"}},fe=l.useMemo(()=>d.map(u=>({id:u.id,x:u.position.x,y:u.position.y,width:be,height:ve,selected:I.isSelected(u.id)||u.id===E})),[d,I,E]);l.useEffect(()=>{const u=le.current;if(!u)return;const U=z=>{const X=z.target?.tagName;if(X==="INPUT"||X==="TEXTAREA"||X==="SELECT")return;const K=z.ctrlKey||z.metaKey;if(K&&z.key==="z"&&!z.shiftKey){z.preventDefault(),c.undo();return}if(K&&z.key==="y"||K&&z.key==="z"&&z.shiftKey){z.preventDefault(),c.redo();return}if(K&&z.key==="c"){z.preventDefault(),M();return}if(K&&z.key==="v"){z.preventDefault(),m();return}if(z.key==="Delete"||z.key==="Backspace"){I.count>0?(z.preventDefault(),w()):E&&(z.preventDefault(),re(E));return}if(z.key==="Escape"){L?(H(!1),Z(null)):(N(null),I.clearSelection());return}};return u.addEventListener("keydown",U),()=>u.removeEventListener("keydown",U)},[E,L,I,c,M,m,re,w]);const st=l.useCallback(u=>{u.target===u.currentTarget&&(N(null),I.clearSelection(),L&&(H(!1),Z(null)))},[L,I]);return e.jsxs("div",{ref:le,tabIndex:0,className:Pe("flex flex-col h-full w-full border rounded-lg overflow-hidden bg-background",y),children:[e.jsx(Fe,{isOpen:x.isOpen,title:x.title,message:x.message,onConfirm:x.onConfirm,onCancel:x.onCancel,destructive:!0}),f&&e.jsxs("div",{className:"flex items-center gap-2 p-2 border-b bg-muted/20",role:"toolbar","aria-label":"Process toolbar",children:[e.jsx(It,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium text-sm","aria-label":"Process name",children:o}),k?.isConnected&&e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",role:"status","aria-label":"Collaboration active",children:[e.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-green-500"}),k.users.length," user",k.users.length!==1?"s":""]}),e.jsx("div",{className:"flex-1"}),!g&&e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>c.undo(),disabled:!c.canUndo,className:"flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent disabled:opacity-40",title:"Undo (Ctrl+Z)","aria-label":"Undo",children:e.jsx(je,{className:"h-3 w-3"})}),e.jsx("button",{onClick:()=>c.redo(),disabled:!c.canRedo,className:"flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent disabled:opacity-40",title:"Redo (Ctrl+Y)","aria-label":"Redo",children:e.jsx(Ne,{className:"h-3 w-3"})}),e.jsx("div",{className:"w-px h-4 bg-border mx-1"}),e.jsx("button",{onClick:M,disabled:I.count===0&&!E,className:"flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent disabled:opacity-40",title:"Copy (Ctrl+C)","aria-label":"Copy",children:e.jsx(Ce,{className:"h-3 w-3"})}),e.jsx("button",{onClick:m,disabled:!P.hasContent,className:"flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent disabled:opacity-40",title:"Paste (Ctrl+V)","aria-label":"Paste",children:e.jsx(ke,{className:"h-3 w-3"})}),e.jsx("div",{className:"w-px h-4 bg-border mx-1"}),e.jsxs("button",{onClick:n,className:Pe("flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent",L&&"bg-primary text-primary-foreground"),title:"Connect nodes","aria-label":"Connect nodes","aria-pressed":L,children:[e.jsx(Pt,{className:"h-3 w-3"})," Connect"]}),e.jsxs("button",{onClick:r,className:"flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent",title:"Auto layout","aria-label":"Auto layout",children:[e.jsx(Et,{className:"h-3 w-3"})," Layout"]}),e.jsx("div",{className:"w-px h-4 bg-border mx-1"}),e.jsx("button",{onClick:O.zoomIn,className:"flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent",title:"Zoom in","aria-label":"Zoom in",children:e.jsx(et,{className:"h-3 w-3"})}),e.jsxs("span",{className:"text-xs tabular-nums min-w-[3ch] text-center","aria-label":"Zoom level",children:[Math.round(O.zoom*100),"%"]}),e.jsx("button",{onClick:O.zoomOut,className:"flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent",title:"Zoom out","aria-label":"Zoom out",children:e.jsx(Qe,{className:"h-3 w-3"})}),e.jsx("button",{onClick:O.resetZoom,className:"flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent",title:"Reset zoom","aria-label":"Reset zoom",children:e.jsx(tt,{className:"h-3 w-3"})}),e.jsx("div",{className:"w-px h-4 bg-border mx-1"}),e.jsxs("button",{onClick:()=>ne("start-event","Start"),className:"flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent",title:"Add Start Event","aria-label":"Add Start Event",children:[e.jsx($t,{className:"h-3 w-3 text-green-600"})," Start"]}),e.jsxs("button",{onClick:()=>ne("user-task","User Task"),className:"flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent",title:"Add User Task","aria-label":"Add User Task",children:[e.jsx(Ve,{className:"h-3 w-3 text-blue-600"})," Task"]}),e.jsxs("button",{onClick:()=>ne("exclusive-gateway","Decision"),className:"flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent",title:"Add Gateway","aria-label":"Add Gateway",children:[e.jsx(Ot,{className:"h-3 w-3 text-yellow-600"})," Gateway"]}),e.jsxs("button",{onClick:()=>ne("end-event","End"),className:"flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent",title:"Add End Event","aria-label":"Add End Event",children:[e.jsx(Ve,{className:"h-3 w-3 text-red-600"})," End"]}),e.jsx("div",{className:"w-px h-4 bg-border mx-1"}),e.jsx("button",{onClick:()=>q(u=>!u),className:"flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent",title:V?"Hide properties":"Show properties","aria-label":V?"Hide property panel":"Show property panel","aria-expanded":V,children:V?e.jsx(Ue,{className:"h-3 w-3"}):e.jsx(zt,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsx("div",{className:"flex-1 overflow-auto bg-muted/10 p-4",role:"region","aria-label":"Process canvas",onWheel:O.handleWheel,onMouseDown:O.startPan,children:e.jsxs("div",{className:"relative",style:{...O.transformStyle,width:b.width,minHeight:b.height,backgroundImage:b.showGrid?"radial-gradient(circle, hsl(var(--border)) 1px, transparent 1px)":void 0,backgroundSize:b.showGrid?"20px 20px":void 0},onClick:st,onDrop:i,onDragOver:h,children:[e.jsxs("svg",{className:"absolute inset-0 pointer-events-none",width:b.width,height:b.height,children:[e.jsx("defs",{children:e.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"7",refX:"10",refY:"3.5",orient:"auto",children:e.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"hsl(var(--foreground))"})})}),j.map(u=>{const U=d.find(ze=>ze.id===u.source),z=d.find(ze=>ze.id===u.target);if(!U||!z)return null;U.position.x+be/2;const X=U.position.y+ve/2;z.position.x+be/2;const K=z.position.y+ve/2,W=U.position.x+be,xe=X,he=z.position.x,me=K,nt=(W+he)/2,rt=`M ${W} ${xe} Q ${nt} ${xe}, ${(W+he)/2} ${(xe+me)/2} T ${he} ${me}`;return e.jsxs("g",{children:[e.jsx("path",{d:rt,fill:"none",stroke:"hsl(var(--foreground) / 0.5)",strokeWidth:"2",markerEnd:"url(#arrowhead)"}),u.label&&e.jsx("text",{x:(W+he)/2,y:(xe+me)/2-8,textAnchor:"middle",className:"text-[10px] fill-muted-foreground",children:u.label})]},u.id)})]}),d.length===0&&e.jsx("div",{className:"flex items-center justify-center h-full min-h-[200px] text-muted-foreground text-sm",children:"No nodes in the process. Use the toolbar buttons to add start events, tasks, gateways, and end events."}),d.map(u=>{const U=I.isSelected(u.id)||E===u.id,z=G===u.id,X=Q===u.id,K=L||X;return e.jsxs("div",{className:"absolute select-none",style:{left:u.position.x,top:u.position.y},role:"group","aria-label":u.label,draggable:!g&&!L,onDragStart:W=>t(W,u.id),onMouseEnter:()=>Y(u.id),onMouseLeave:()=>Y(null),onClick:W=>{a(u.id)||(W.shiftKey?I.toggle(u.id,!0):(N(u.id),I.selectOne(u.id)))},children:[e.jsx("div",{className:Pe("flex items-center justify-center border-2 min-w-[120px] min-h-[50px] px-3 py-2 transition-shadow",ge(u.type),U&&"ring-2 ring-primary shadow-md",z&&"ring-2 ring-blue-400 shadow-lg",L&&!z&&"cursor-crosshair"),children:e.jsx("span",{className:Pe("text-xs font-medium",(u.type==="exclusive-gateway"||u.type==="parallel-gateway"||u.type==="inclusive-gateway"||u.type==="event-based-gateway")&&"-rotate-45"),children:u.label})}),K&&!g&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"absolute w-3 h-3 rounded-full bg-blue-500 border-2 border-white shadow cursor-crosshair",style:{left:-6,top:ve/2-6},title:"Input port",onClick:W=>{W.stopPropagation(),a(u.id)}}),e.jsx("div",{className:"absolute w-3 h-3 rounded-full bg-blue-500 border-2 border-white shadow cursor-crosshair",style:{right:-6,top:ve/2-6},title:"Output port",onClick:W=>{W.stopPropagation(),L?a(u.id):(H(!0),Z(u.id))}}),e.jsx("div",{className:"absolute w-3 h-3 rounded-full bg-blue-400 border-2 border-white shadow cursor-crosshair",style:{left:be/2-6,top:-6},title:"Port",onClick:W=>{W.stopPropagation(),a(u.id)}}),e.jsx("div",{className:"absolute w-3 h-3 rounded-full bg-blue-400 border-2 border-white shadow cursor-crosshair",style:{left:be/2-6,bottom:-6},title:"Port",onClick:W=>{W.stopPropagation(),a(u.id)}})]}),!g&&U&&!L&&e.jsx("button",{onClick:W=>{W.stopPropagation(),re(u.id)},className:"absolute -top-2 -right-2 p-0.5 rounded-full bg-destructive text-destructive-foreground shadow","aria-label":"Delete node",children:e.jsx(de,{className:"h-3 w-3"})})]},u.id)}),$&&d.length>0&&e.jsx(Ze,{items:fe,canvasWidth:b.width??1400,canvasHeight:b.height??800,position:"bottom-right"})]})}),V&&!g&&e.jsx("div",{className:"w-64 border-l bg-background overflow-y-auto flex-shrink-0",role:"complementary","aria-label":"Property panel",children:e.jsx(Oe,{title:T?`Properties: ${T.label}`:"Properties",fields:R,onChange:ie})})]})]})}function oe(...o){return ue(pe(o))}const S={untitledReport:"Untitled Report",reportCanvas:"Report canvas",properties:"Properties",propertiesPanel:"Properties panel",designerToolbar:"Report designer toolbar",selectElementPrompt:"Select an element to edit its properties",addElementsPrompt:"Add elements using the buttons above",addText:"Add Text",addField:"Add Field",addImage:"Add Image",addChart:"Add Chart",addTable:"Add Table",undo:"Undo",undoShortcut:"Undo (Ctrl+Z)",redo:"Redo",redoShortcut:"Redo (Ctrl+Shift+Z)",copy:"Copy",copyShortcut:"Copy (Ctrl+C)",paste:"Paste",pasteShortcut:"Paste (Ctrl+V)",deleteSelected:"Delete selected",deleteElement:"Delete element",deleteElementsTitle:"Delete elements",deleteElementMessage:o=>`Are you sure you want to delete ${o} element${o>1?"s":""}?`,collapsePanel:"Collapse panel",expandPanel:"Expand panel",collaborationConnected:"Connected",sectionHeader:"Report Header",sectionPageHeader:"Page Header",sectionGroupHeader:"Group Header",sectionDetail:"Detail",sectionGroupFooter:"Group Footer",sectionPageFooter:"Page Footer",sectionFooter:"Report Footer",elementText:"Text",elementImage:"🖼 Image",elementChart:"📊 Chart",elementTable:"📋 Table",propLabel:"Label",propX:"X",propY:"Y",propWidth:"Width",propHeight:"Height",propText:"Text",propField:"Field",groupPosition:"Position",groupSize:"Size",groupContent:"Content",groupGeneral:"General"},Jt={A4:{width:595,height:842},A3:{width:842,height:1191},Letter:{width:612,height:792},Legal:{width:612,height:1008},Tabloid:{width:792,height:1224}},Qt=[{type:"header",height:80,elements:[]},{type:"detail",height:400,elements:[],repeat:!0},{type:"footer",height:60,elements:[]}];function ea({reportName:o=S.untitledReport,objectName:A,pageSize:F="A4",orientation:C="portrait",margins:b={top:40,right:40,bottom:40,left:40},sections:$=[],showToolbar:f=!0,showPropertyPanel:g=!0,readOnly:v=!1,onSectionsChange:s,className:y}){const c=Se($.length>0?$:Qt),d=c.current,j=l.useCallback(w=>{c.push(w),s?.(w)},[c,s]),p=$e(),x=l.useMemo(()=>{const w=Array.from(p.selectedIds);return w.length>0?w[0]:null},[p.selectedIds]),I=Te(),P=De(),O=Ie(),k=l.useCallback(w=>{O&&O.sendOperation({...w,userId:O.currentUserId??""})},[O]),[E,N]=l.useState(!0),L=l.useRef(null),H=l.useRef(null),G=Jt[F],Z=C==="landscape"?G.height:G.width,Q=C==="landscape"?G.width:G.height,Y=w=>{switch(w){case"header":return S.sectionHeader;case"page-header":return S.sectionPageHeader;case"group-header":return S.sectionGroupHeader;case"detail":return S.sectionDetail;case"group-footer":return S.sectionGroupFooter;case"page-footer":return S.sectionPageFooter;case"footer":return S.sectionFooter;default:return w}},V=l.useMemo(()=>x?d.flatMap(w=>w.elements).find(w=>w.id===x):null,[x,d]),q=l.useCallback((w,M)=>{if(v)return;const m={id:`elem-${Date.now()}`,type:M,position:{x:b.left,y:10,width:200,height:30},properties:{text:M==="text"?"New Text":void 0,field:M==="field"?"field_name":void 0}},n=d.map((a,r)=>r===w?{...a,elements:[...a.elements,m]}:a);j(n),p.selectOne(m.id),k({type:"insert",elementId:m.id,data:{element:m}})},[d,b.left,v,j,p,k]),J=l.useCallback(w=>{if(v)return;const M=d.map(m=>({...m,elements:m.elements.filter(n=>n.id!==w)}));j(M),p.isSelected(w)&&p.clearSelection(),k({type:"delete",elementId:w,data:{}})},[d,v,j,p,k]),ae=l.useCallback(async()=>{if(v||p.count===0||!await P.confirm(S.deleteElementsTitle,S.deleteElementMessage(p.count)))return;const w=p.selectedIds,M=d.map(m=>({...m,elements:m.elements.filter(n=>!w.has(n.id))}));j(M),p.clearSelection(),w.forEach(m=>{k({type:"delete",elementId:m,data:{}})})},[v,p,P,d,j,k]),ee=l.useCallback((w,M)=>{if(v||!x)return;const m=d.map(n=>({...n,elements:n.elements.map(a=>a.id!==x?a:w==="x"?{...a,position:{...a.position,x:Number(M)}}:w==="y"?{...a,position:{...a.position,y:Number(M)}}:w==="width"?{...a,position:{...a.position,width:Number(M)}}:w==="height"?{...a,position:{...a.position,height:Number(M)}}:{...a,properties:{...a.properties,[w]:M}})}));j(m),k({type:"update",elementId:x,data:{[w]:M}})},[v,x,d,j,k]),B=l.useCallback(()=>{const w=p.selectedIds;if(w.size===0)return;const M=d.flatMap(m=>m.elements).filter(m=>w.has(m.id));I.copy(M)},[p,d,I]),le=l.useCallback(()=>{if(v)return;const w=I.paste();if(!w||w.length===0)return;let M=0;const m=w.map(t=>({...t,id:`elem-${Date.now()}-${++M}-${Math.random().toString(36).slice(2,7)}`,position:{...t.position,x:t.position.x+20,y:t.position.y+20}})),n=d.findIndex(t=>t.type==="detail"),a=n>=0?n:0,r=d.map((t,i)=>i===a?{...t,elements:[...t.elements,...m]}:t);j(r),p.selectMany(m.map(t=>t.id)),m.forEach(t=>{k({type:"insert",elementId:t.id,data:{element:t}})})},[v,I,d,j,p,k]),se=l.useCallback((w,M,m)=>{v||(L.current={id:M.id,sectionIndex:m,startX:w.clientX,startY:w.clientY},w.dataTransfer.effectAllowed="move",w.dataTransfer.setData("text/plain",M.id))},[v]),_=l.useCallback(w=>{w.preventDefault(),w.dataTransfer.dropEffect="move"},[]),ne=l.useCallback((w,M)=>{w.preventDefault();const m=L.current;if(!m||v)return;const n=w.clientX-m.startX,a=w.clientY-m.startY;if(m.sectionIndex===M){const r=d.map((t,i)=>i!==M?t:{...t,elements:t.elements.map(h=>h.id!==m.id?h:{...h,position:{...h.position,x:Math.max(0,h.position.x+n),y:Math.max(0,(typeof h.position.y=="number"?h.position.y:0)+a)}})});j(r)}else{let r=null;const t=d.map((i,h)=>{if(h!==m.sectionIndex)return i;const T=i.elements.find(R=>R.id===m.id);return T&&(r={...T,position:{...T.position,x:Math.max(0,T.position.x+n),y:Math.max(0,10)}}),{...i,elements:i.elements.filter(R=>R.id!==m.id)}});if(r){const i=t.map((h,T)=>T!==M?h:{...h,elements:[...h.elements,r]});j(i)}}k({type:"move",elementId:m.id,data:{}}),L.current=null},[v,d,j,k]),re=l.useMemo(()=>{if(!V)return[];const w=[{name:"x",label:S.propX,type:"number",value:V.position.x,group:S.groupPosition},{name:"y",label:S.propY,type:"number",value:V.position.y,group:S.groupPosition},{name:"width",label:S.propWidth,type:"number",value:V.position.width,group:S.groupSize},{name:"height",label:S.propHeight,type:"number",value:V.position.height,group:S.groupSize}];return V.type==="text"&&w.push({name:"text",label:S.propText,type:"text",value:V.properties.text??"",group:S.groupContent}),V.type==="field"&&w.push({name:"field",label:S.propField,type:"text",value:V.properties.field??"",group:S.groupContent}),w},[V]);return l.useEffect(()=>{const w=H.current;if(!w)return;const M=m=>{const n=["INPUT","TEXTAREA","SELECT"].includes(m.target.tagName),a=m.ctrlKey||m.metaKey;if((m.key==="Delete"||m.key==="Backspace")&&p.count>0&&!n){m.preventDefault(),ae();return}if(m.key==="Escape"){p.clearSelection();return}if(!n){if(a&&m.key==="z"&&!m.shiftKey&&!v){m.preventDefault(),c.undo();return}if(a&&(m.key==="z"&&m.shiftKey||m.key==="y")&&!v){m.preventDefault(),c.redo();return}if(a&&m.key==="c"){m.preventDefault(),B();return}if(a&&m.key==="v"&&!v){m.preventDefault(),le();return}if(a&&m.key==="a"){m.preventDefault();const r=d.flatMap(t=>t.elements).map(t=>t.id);p.selectMany(r);return}}};return w.addEventListener("keydown",M),()=>w.removeEventListener("keydown",M)},[p,ae,v,c,B,le,d]),e.jsxs("div",{ref:H,tabIndex:0,className:oe("flex h-full w-full border rounded-lg overflow-hidden bg-background",y),children:[e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[f&&e.jsxs("div",{role:"toolbar","aria-label":S.designerToolbar,className:"flex items-center gap-2 p-2 border-b bg-muted/20",children:[e.jsx(At,{className:"h-4 w-4"}),e.jsx("span",{className:"font-medium text-sm",children:o}),A&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",A,")"]}),!v&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-5 bg-border mx-1"}),e.jsx("button",{className:oe("p-1.5 rounded hover:bg-accent",!c.canUndo&&"opacity-40 pointer-events-none"),title:S.undoShortcut,"aria-label":S.undo,disabled:!c.canUndo,onClick:()=>c.undo(),children:e.jsx(je,{className:"h-4 w-4"})}),e.jsx("button",{className:oe("p-1.5 rounded hover:bg-accent",!c.canRedo&&"opacity-40 pointer-events-none"),title:S.redoShortcut,"aria-label":S.redo,disabled:!c.canRedo,onClick:()=>c.redo(),children:e.jsx(Ne,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-5 bg-border mx-1"})]}),!v&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:oe("p-1.5 rounded hover:bg-accent",p.count===0&&"opacity-40 pointer-events-none"),title:S.copyShortcut,"aria-label":S.copy,disabled:p.count===0,onClick:B,children:e.jsx(Ce,{className:"h-4 w-4"})}),e.jsx("button",{className:oe("p-1.5 rounded hover:bg-accent",!I.hasContent&&"opacity-40 pointer-events-none"),title:S.pasteShortcut,"aria-label":S.paste,disabled:!I.hasContent,onClick:le,children:e.jsx(ke,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-px h-5 bg-border mx-1"})]}),!v&&e.jsx("button",{className:oe("p-1.5 rounded hover:bg-accent",p.count===0&&"opacity-40 pointer-events-none"),title:S.deleteSelected,"aria-label":S.deleteSelected,disabled:p.count===0,onClick:ae,children:e.jsx(de,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex-1"}),O?.isConnected&&e.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-green-500"}),S.collaborationConnected,O.users.length>1&&` (${O.users.length})`]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[F," ",C]}),g&&e.jsx("button",{className:"p-1.5 rounded hover:bg-accent",title:E?S.collapsePanel:S.expandPanel,"aria-label":E?S.collapsePanel:S.expandPanel,onClick:()=>N(w=>!w),children:e.jsx(Ue,{className:oe("h-4 w-4",!E&&"rotate-180")})})]}),e.jsx("div",{role:"region","aria-label":S.reportCanvas,className:"flex-1 overflow-auto bg-muted/10 p-4 flex justify-center",children:e.jsx("div",{className:"bg-white shadow-lg border",style:{width:Z,minHeight:Q},children:d.map((w,M)=>e.jsxs("div",{className:"relative border-b border-dashed border-gray-300",style:{minHeight:w.height},onDragOver:_,onDrop:m=>ne(m,M),children:[e.jsxs("div",{className:"absolute left-0 top-0 px-2 py-0.5 bg-muted text-xs text-muted-foreground border-r border-b rounded-br",children:[Y(w.type),w.repeat&&" ↻"]}),!v&&e.jsxs("div",{className:"absolute right-1 top-0 flex items-center gap-0.5",children:[e.jsx("button",{onClick:()=>q(M,"text"),className:"p-0.5 rounded hover:bg-accent",title:S.addText,"aria-label":S.addText,children:e.jsx(Mt,{className:"h-3 w-3"})}),e.jsx("button",{onClick:()=>q(M,"field"),className:"p-0.5 rounded hover:bg-accent",title:S.addField,"aria-label":S.addField,children:e.jsx(ce,{className:"h-3 w-3"})}),e.jsx("button",{onClick:()=>q(M,"image"),className:"p-0.5 rounded hover:bg-accent",title:S.addImage,"aria-label":S.addImage,children:e.jsx(Be,{className:"h-3 w-3"})}),e.jsx("button",{onClick:()=>q(M,"chart"),className:"p-0.5 rounded hover:bg-accent",title:S.addChart,"aria-label":S.addChart,children:e.jsx(Rt,{className:"h-3 w-3"})}),e.jsx("button",{onClick:()=>q(M,"table"),className:"p-0.5 rounded hover:bg-accent",title:S.addTable,"aria-label":S.addTable,children:e.jsx(Gt,{className:"h-3 w-3"})})]}),e.jsxs("div",{className:"relative",style:{minHeight:w.height,paddingTop:24},children:[w.elements.length===0&&e.jsx("div",{className:"text-xs text-muted-foreground text-center pt-4",children:S.addElementsPrompt}),w.elements.map(m=>{const n=p.isSelected(m.id);return e.jsxs("div",{draggable:!v,onDragStart:a=>se(a,m,M),className:oe("absolute border rounded px-2 py-1 text-xs cursor-pointer",n?"border-primary ring-1 ring-primary/30 bg-primary/5":"border-dashed border-gray-400 hover:border-primary/50"),style:{left:m.position.x,top:(typeof m.position.y=="number"?m.position.y:0)+24,width:m.position.width,height:m.position.height},onClick:a=>p.toggle(m.id,a.shiftKey),children:[e.jsxs("span",{className:"text-muted-foreground",children:[m.type==="text"&&(m.properties.text??S.elementText),m.type==="field"&&`{${m.properties.field??"field"}}`,m.type==="image"&&S.elementImage,m.type==="chart"&&S.elementChart,m.type==="table"&&S.elementTable]}),!v&&n&&e.jsx("button",{onClick:a=>{a.stopPropagation(),J(m.id)},className:"absolute -top-2 -right-2 p-0.5 rounded-full bg-destructive text-destructive-foreground shadow","aria-label":S.deleteElement,children:e.jsx(de,{className:"h-2.5 w-2.5"})})]},m.id)})]})]},`${w.type}-${M}`))})})]}),g&&e.jsx("div",{role:"region","aria-label":S.propertiesPanel,className:oe("border-l bg-muted/30 flex flex-col transition-[width] duration-200",E?"w-56":"w-0 overflow-hidden"),children:E&&(x&&V?e.jsx(Oe,{title:`${S.properties} – ${V.type}`,fields:re,onChange:ee}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"p-3 border-b font-medium text-sm",children:S.properties}),e.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:e.jsx("div",{className:"text-xs text-muted-foreground text-center py-4",children:S.selectElementPrompt})})]}))}),e.jsx(Fe,{isOpen:P.isOpen,title:P.title,message:P.message,onConfirm:P.onConfirm,onCancel:P.onCancel})]})}function Ee(...o){return ue(pe(o))}const D={title:"View Designer",saveView:"Save View",cancel:"Cancel",availableFields:"Available Fields",allFieldsAdded:"All fields added",noColumnsTitle:"No columns added yet. Select fields from the palette to add columns.",columnsCount:o=>`Columns (${o})`,viewType:"View Type",viewName:"View Name",viewNamePlaceholder:"Enter view name...",columnProperties:"Column Properties",selectColumnPrompt:"Select a column to edit its properties",labelField:"Label",widthField:"Width",widthPlaceholder:"auto",fieldLabel:"Field:",addFilter:"Add Filter",addSort:"Add Sort",valuePlaceholder:"Value",asc:"Asc",desc:"Desc",selectField:"Select field...",moveUp:"Move up",moveDown:"Move down",moveColumnUp:"Move column up",moveColumnDown:"Move column down",hideColumn:"Hide column",showColumn:"Show column",toggleVisibility:"Toggle column visibility",removeColumn:"Remove column",copyColumn:"Copy column",pasteColumn:"Paste column",deleteColumnTitle:"Delete Column",deleteColumnMessage:o=>`Are you sure you want to delete the column "${o}"? This action cannot be undone.`,undo:"Undo (Ctrl+Z)",redo:"Redo (Ctrl+Y)",gridOptionsHint:"Grid view uses the columns configured above.",groupByField:"Group By Field",startDateField:"Start Date Field",titleField:"Title Field",latitudeField:"Latitude Field",longitudeField:"Longitude Field",imageField:"Image Field",dateField:"Date Field"},We=[{type:"grid",label:"Grid",icon:mt},{type:"kanban",label:"Kanban",icon:xt},{type:"gallery",label:"Gallery",icon:Be},{type:"calendar",label:"Calendar",icon:ht},{type:"timeline",label:"Timeline",icon:bt},{type:"gantt",label:"Gantt",icon:gt},{type:"map",label:"Map",icon:qe}],ta=[{value:"equals",label:"="},{value:"contains",label:"Contains"},{value:"startsWith",label:"Starts with"},{value:"gt",label:">"},{value:"lt",label:"<"},{value:"gte",label:">="},{value:"lte",label:"<="},{value:"ne",label:"!="}];function lt({objectName:o,viewId:A,viewLabel:F="",viewType:C="grid",columns:b=[],filters:$=[],sort:f=[],availableFields:g=[],options:v={},readOnly:s=!1,onSave:y,onCancel:c,className:d}){const j=l.useRef(null),p=Se({columns:b,filters:$,sort:f,viewType:C,viewLabel:F,options:v}),{columns:x,filters:I,sort:P,viewType:O,viewLabel:k,options:E}=p.current,N=l.useCallback(a=>{p.push({...p.current,...a})},[p]),L=Te(),H=De(),G=Ie(),[Z,Q]=l.useState(null),[Y,V]=l.useState("columns"),q=l.useMemo(()=>{const a=new Set(x.map(r=>r.field));return g.filter(r=>!a.has(r.name))},[g,x]),J=l.useCallback(a=>{if(s)return;const r=g.find(i=>i.name===a),t={field:a,label:r?.label??a,visible:!0,order:x.length};N({columns:[...x,t]}),G?.sendOperation({type:"insert",userId:G.currentUserId??"",elementId:a,data:{column:t}})},[g,x,s,N,G]),ae=l.useCallback(async a=>{if(s)return;const r=x[a];!r||!await H.confirm(D.deleteColumnTitle,D.deleteColumnMessage(r.label||r.field))||(N({columns:x.filter((t,i)=>i!==a)}),Z===a&&Q(null),G?.sendOperation({type:"delete",userId:G.currentUserId??"",elementId:r.field,data:{}}))},[s,x,H,N,Z,G]),ee=l.useCallback(a=>{s||N({columns:x.map((r,t)=>t===a?{...r,visible:!r.visible}:r)})},[s,x,N]),B=l.useCallback((a,r)=>{if(s)return;const t=r==="up"?a-1:a+1;if(t<0||t>=x.length)return;const i=[...x],h=i[a];i[a]=i[t],i[t]=h,N({columns:i}),Q(t)},[s,x,N]),le=l.useCallback(()=>{s||g.length===0||N({filters:[...I,{field:g[0].name,operator:"equals",value:""}]})},[s,g,I,N]),se=l.useCallback(a=>{s||N({filters:I.filter((r,t)=>t!==a)})},[s,I,N]),_=l.useCallback((a,r)=>{s||N({filters:I.map((t,i)=>i===a?{...t,...r}:t)})},[s,I,N]),ne=l.useCallback(()=>{s||g.length===0||N({sort:[...P,{field:g[0].name,direction:"asc"}]})},[s,g,P,N]),re=l.useCallback(a=>{s||N({sort:P.filter((r,t)=>t!==a)})},[s,P,N]),w=l.useCallback((a,r)=>{s||N({sort:P.map((t,i)=>i===a?{...t,...r}:t)})},[s,P,N]),M=l.useCallback(()=>{Z===null||!x[Z]||L.copy(x[Z])},[Z,x,L]),m=l.useCallback(()=>{if(s)return;const a=L.paste();if(!a)return;const r={...a,field:`${a.field}_copy`,label:`${a.label||a.field} (Copy)`,order:x.length};N({columns:[...x,r]})},[s,L,x,N]),n=l.useCallback(()=>{y?.({viewId:A,viewLabel:k||`${o} View`,viewType:O,columns:x,filters:I,sort:P,options:E})},[y,A,k,o,O,x,I,P,E]);return l.useEffect(()=>{const a=j.current;if(!a)return;const r=t=>{const i=["INPUT","TEXTAREA","SELECT"].includes(t.target.tagName),h=t.ctrlKey||t.metaKey;if(!i){if(h&&t.key==="z"&&!t.shiftKey&&!s){t.preventDefault(),p.undo();return}if(h&&(t.key==="z"&&t.shiftKey||t.key==="y")&&!s){t.preventDefault(),p.redo();return}if(h&&t.key==="c"){t.preventDefault(),M();return}if(h&&t.key==="v"&&!s){t.preventDefault(),m();return}}};return a.addEventListener("keydown",r),()=>a.removeEventListener("keydown",r)},[s,p,M,m]),e.jsxs("div",{ref:j,tabIndex:-1,className:Ee("flex flex-col h-full w-full border rounded-lg overflow-hidden bg-background",d),children:[e.jsxs("div",{className:"flex items-center gap-2 p-2 border-b bg-muted/20 shrink-0",role:"toolbar",children:[e.jsx(ct,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium text-sm",children:D.title}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",o]}),G?.isConnected&&G.users.length>1&&e.jsxs("div",{className:"flex items-center gap-1 ml-2",role:"status","aria-label":"Active collaborators",children:[G.users.slice(0,3).map(a=>e.jsx("div",{className:"h-5 w-5 rounded-full text-[10px] font-bold flex items-center justify-center text-white",style:{backgroundColor:a.color},title:a.userName,children:a.userName.charAt(0).toUpperCase()},a.userId)),G.users.length>3&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["+",G.users.length-3]})]}),e.jsx("div",{className:"flex-1"}),!s&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:p.undo,disabled:!p.canUndo,className:"p-1.5 rounded hover:bg-accent disabled:opacity-30",title:D.undo,"aria-label":D.undo,"data-testid":"view-designer-undo",children:e.jsx(je,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:p.redo,disabled:!p.canRedo,className:"p-1.5 rounded hover:bg-accent disabled:opacity-30",title:D.redo,"aria-label":D.redo,"data-testid":"view-designer-redo",children:e.jsx(Ne,{className:"h-3.5 w-3.5"})}),e.jsx("div",{className:"w-px h-4 bg-border mx-1"})]}),!s&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:M,disabled:Z===null,className:"p-1.5 rounded hover:bg-accent disabled:opacity-30",title:D.copyColumn,"aria-label":D.copyColumn,"data-testid":"view-designer-copy",children:e.jsx(Ce,{className:"h-3.5 w-3.5"})}),e.jsx("button",{onClick:m,disabled:!L.hasContent,className:"p-1.5 rounded hover:bg-accent disabled:opacity-30",title:D.pasteColumn,"aria-label":D.pasteColumn,"data-testid":"view-designer-paste",children:e.jsx(ke,{className:"h-3.5 w-3.5"})}),e.jsx("div",{className:"w-px h-4 bg-border mx-1"})]}),!s&&e.jsxs(e.Fragment,{children:[c&&e.jsxs("button",{onClick:c,className:"flex items-center gap-1 px-3 py-1.5 text-xs rounded border border-border hover:bg-accent","data-testid":"view-designer-cancel",children:[e.jsx(ut,{className:"h-3 w-3"})," ",D.cancel]}),e.jsxs("button",{onClick:n,className:"flex items-center gap-1 px-3 py-1.5 text-xs rounded bg-primary text-primary-foreground hover:bg-primary/90","data-testid":"view-designer-save",children:[e.jsx(pt,{className:"h-3 w-3"})," ",D.saveView]})]})]}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[!s&&e.jsxs("div",{className:"w-56 border-r bg-muted/30 flex flex-col shrink-0",children:[e.jsx("div",{className:"p-3 border-b font-medium text-sm",children:D.availableFields}),e.jsx("div",{className:"flex-1 overflow-y-auto p-2",children:q.length===0?e.jsx("div",{className:"text-xs text-muted-foreground text-center py-4",children:D.allFieldsAdded}):q.map(a=>e.jsxs("button",{onClick:()=>J(a.name),className:"w-full flex items-center gap-2 px-2 py-1.5 text-sm rounded hover:bg-accent text-left","data-testid":`field-${a.name}`,children:[e.jsx(ce,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("span",{className:"truncate",children:a.label||a.name}),e.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:a.type})]},a.name))})]}),e.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-3 border-b space-y-3 shrink-0 bg-muted/10",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-xs font-semibold text-foreground",children:D.viewType}),e.jsx("div",{className:"flex gap-2 flex-wrap",children:We.map(({type:a,label:r,icon:t})=>e.jsxs("button",{onClick:()=>!s&&N({viewType:a}),className:Ee("flex items-center gap-2 px-3 py-2 text-sm rounded-md border-2 transition-all font-medium",O===a?"border-primary bg-primary text-primary-foreground shadow-sm":"border-border bg-background hover:border-primary/50 hover:bg-accent"),"data-testid":`view-type-${a}`,children:[e.jsx(t,{className:"h-4 w-4"}),r]},a))})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("label",{className:"text-xs font-semibold text-foreground",children:D.viewName}),e.jsx("input",{type:"text",value:k,onChange:a=>!s&&N({viewLabel:a.target.value}),placeholder:D.viewNamePlaceholder,className:"px-3 py-2 text-sm border-2 rounded-md bg-background focus:outline-none focus:ring-2 focus:ring-primary focus:border-primary",readOnly:s,"data-testid":"view-label-input"})]})]}),e.jsx("div",{className:"flex-1 overflow-auto p-3",children:x.length===0?e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:e.jsxs("div",{className:"text-center",children:[e.jsx(ft,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:D.noColumnsTitle})]})}):e.jsxs("div",{className:"space-y-1",children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground mb-2",children:D.columnsCount(x.length)}),x.map((a,r)=>e.jsxs("div",{className:Ee("flex items-center gap-2 px-3 py-2 rounded border transition-colors cursor-pointer",Z===r?"border-primary bg-primary/5 ring-1 ring-primary/20":"border-border hover:border-primary/50",!a.visible&&"opacity-50"),onClick:()=>Q(r),"data-testid":`column-${a.field}`,children:[e.jsx(_e,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),e.jsx("span",{className:"text-sm font-medium truncate flex-1",children:a.label||a.field}),e.jsx("span",{className:"text-xs text-muted-foreground",children:a.field}),!s&&e.jsxs("div",{className:"flex items-center gap-0.5 shrink-0",children:[e.jsx("button",{onClick:t=>{t.stopPropagation(),B(r,"up")},disabled:r===0,className:"p-0.5 rounded hover:bg-accent disabled:opacity-30",title:D.moveUp,"aria-label":D.moveColumnUp,children:e.jsx(yt,{className:"h-3 w-3"})}),e.jsx("button",{onClick:t=>{t.stopPropagation(),B(r,"down")},disabled:r===x.length-1,className:"p-0.5 rounded hover:bg-accent disabled:opacity-30",title:D.moveDown,"aria-label":D.moveColumnDown,children:e.jsx(vt,{className:"h-3 w-3"})}),e.jsx("button",{onClick:t=>{t.stopPropagation(),ee(r)},className:"p-0.5 rounded hover:bg-accent",title:a.visible!==!1?D.hideColumn:D.showColumn,"aria-label":D.toggleVisibility,children:a.visible!==!1?e.jsx(Je,{className:"h-3 w-3"}):e.jsx(wt,{className:"h-3 w-3"})}),e.jsx("button",{onClick:t=>{t.stopPropagation(),ae(r)},className:"p-0.5 rounded hover:bg-destructive/10",title:D.removeColumn,"aria-label":D.removeColumn,children:e.jsx(de,{className:"h-3 w-3 text-destructive"})})]})]},`${a.field}-${r}`))]})})]}),e.jsxs("div",{className:"w-64 border-l bg-muted/30 flex flex-col shrink-0",children:[e.jsx("div",{className:"flex border-b shrink-0",role:"tablist",children:["columns","filters","sort","options"].map(a=>e.jsx("button",{onClick:()=>V(a),role:"tab","aria-selected":Y===a,className:Ee("flex-1 px-2 py-2 text-xs font-medium capitalize transition-colors",Y===a?"border-b-2 border-primary text-primary":"text-muted-foreground hover:text-foreground"),children:a},a))}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-3",children:[Y==="columns"&&e.jsx("div",{children:Z!==null&&x[Z]?e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"text-xs font-medium",children:D.columnProperties}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:D.labelField}),e.jsx("input",{type:"text",value:x[Z].label??"",onChange:a=>{if(s)return;const r=Z;N({columns:x.map((t,i)=>i===r?{...t,label:a.target.value}:t)})},className:"w-full px-2 py-1 text-sm border rounded bg-background mt-1",readOnly:s,"data-testid":"column-label-input"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:D.widthField}),e.jsx("input",{type:"text",value:x[Z].width??"",onChange:a=>{if(s)return;const r=Z,t=a.target.value;N({columns:x.map((i,h)=>h===r?{...i,width:/^\d+$/.test(t)?Number(t):t}:i)})},placeholder:D.widthPlaceholder,className:"w-full px-2 py-1 text-sm border rounded bg-background mt-1",readOnly:s,"data-testid":"column-width-input"})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:[D.fieldLabel," ",e.jsx("span",{className:"font-mono",children:x[Z].field})]})]}):e.jsx("div",{className:"text-xs text-muted-foreground text-center py-4",children:D.selectColumnPrompt})}),Y==="filters"&&e.jsxs("div",{className:"space-y-2",children:[I.map((a,r)=>e.jsxs("div",{className:"space-y-1 p-2 border rounded bg-background","data-testid":`filter-${r}`,children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("select",{value:a.field,onChange:t=>_(r,{field:t.target.value}),className:"flex-1 px-1 py-0.5 text-xs border rounded bg-background",disabled:s,children:g.map(t=>e.jsx("option",{value:t.name,children:t.label||t.name},t.name))}),!s&&e.jsx("button",{onClick:()=>se(r),className:"p-0.5 rounded hover:bg-destructive/10",children:e.jsx(de,{className:"h-3 w-3 text-destructive"})})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("select",{value:a.operator,onChange:t=>_(r,{operator:t.target.value}),className:"w-24 px-1 py-0.5 text-xs border rounded bg-background",disabled:s,children:ta.map(t=>e.jsx("option",{value:t.value,children:t.label},t.value))}),e.jsx("input",{type:"text",value:a.value??"",onChange:t=>_(r,{value:t.target.value}),placeholder:D.valuePlaceholder,className:"flex-1 px-1 py-0.5 text-xs border rounded bg-background",readOnly:s})]})]},r)),!s&&e.jsxs("button",{onClick:le,className:"w-full flex items-center justify-center gap-1 px-2 py-1.5 text-xs rounded border border-dashed border-border hover:bg-accent","data-testid":"add-filter","aria-label":D.addFilter,children:[e.jsx(ce,{className:"h-3 w-3"})," ",D.addFilter]})]}),Y==="sort"&&e.jsxs("div",{className:"space-y-2",children:[P.map((a,r)=>e.jsxs("div",{className:"flex items-center gap-1 p-2 border rounded bg-background","data-testid":`sort-${r}`,children:[e.jsx("select",{value:a.field,onChange:t=>w(r,{field:t.target.value}),className:"flex-1 px-1 py-0.5 text-xs border rounded bg-background",disabled:s,children:g.map(t=>e.jsx("option",{value:t.name,children:t.label||t.name},t.name))}),e.jsxs("select",{value:a.direction,onChange:t=>w(r,{direction:t.target.value}),className:"w-16 px-1 py-0.5 text-xs border rounded bg-background",disabled:s,children:[e.jsx("option",{value:"asc",children:D.asc}),e.jsx("option",{value:"desc",children:D.desc})]}),!s&&e.jsx("button",{onClick:()=>re(r),className:"p-0.5 rounded hover:bg-destructive/10",children:e.jsx(de,{className:"h-3 w-3 text-destructive"})})]},r)),!s&&e.jsxs("button",{onClick:ne,className:"w-full flex items-center justify-center gap-1 px-2 py-1.5 text-xs rounded border border-dashed border-border hover:bg-accent","data-testid":"add-sort","aria-label":D.addSort,children:[e.jsx(ce,{className:"h-3 w-3"})," ",D.addSort]})]}),Y==="options"&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"text-xs font-medium",children:[We.find(a=>a.type===O)?.label??O," Options"]}),O==="kanban"&&e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:D.groupByField}),e.jsxs("select",{value:E.groupBy??"",onChange:a=>!s&&N({options:{...E,groupBy:a.target.value}}),className:"w-full px-2 py-1 text-sm border rounded bg-background mt-1",disabled:s,"data-testid":"kanban-group-by",children:[e.jsx("option",{value:"",children:D.selectField}),g.map(a=>e.jsx("option",{value:a.name,children:a.label||a.name},a.name))]})]}),O==="calendar"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:D.startDateField}),e.jsxs("select",{value:E.startDateField??"",onChange:a=>!s&&N({options:{...E,startDateField:a.target.value}}),className:"w-full px-2 py-1 text-sm border rounded bg-background mt-1",disabled:s,"data-testid":"calendar-start-date",children:[e.jsx("option",{value:"",children:D.selectField}),g.map(a=>e.jsx("option",{value:a.name,children:a.label||a.name},a.name))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:D.titleField}),e.jsxs("select",{value:E.titleField??"",onChange:a=>!s&&N({options:{...E,titleField:a.target.value}}),className:"w-full px-2 py-1 text-sm border rounded bg-background mt-1",disabled:s,"data-testid":"calendar-title-field",children:[e.jsx("option",{value:"",children:D.selectField}),g.map(a=>e.jsx("option",{value:a.name,children:a.label||a.name},a.name))]})]})]}),O==="map"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:D.latitudeField}),e.jsxs("select",{value:E.latitudeField??"",onChange:a=>!s&&N({options:{...E,latitudeField:a.target.value}}),className:"w-full px-2 py-1 text-sm border rounded bg-background mt-1",disabled:s,children:[e.jsx("option",{value:"",children:D.selectField}),g.map(a=>e.jsx("option",{value:a.name,children:a.label||a.name},a.name))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:D.longitudeField}),e.jsxs("select",{value:E.longitudeField??"",onChange:a=>!s&&N({options:{...E,longitudeField:a.target.value}}),className:"w-full px-2 py-1 text-sm border rounded bg-background mt-1",disabled:s,children:[e.jsx("option",{value:"",children:D.selectField}),g.map(a=>e.jsx("option",{value:a.name,children:a.label||a.name},a.name))]})]})]}),O==="gallery"&&e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:D.imageField}),e.jsxs("select",{value:E.imageField??"",onChange:a=>!s&&N({options:{...E,imageField:a.target.value}}),className:"w-full px-2 py-1 text-sm border rounded bg-background mt-1",disabled:s,children:[e.jsx("option",{value:"",children:D.selectField}),g.map(a=>e.jsx("option",{value:a.name,children:a.label||a.name},a.name))]})]}),(O==="timeline"||O==="gantt")&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:D.dateField}),e.jsxs("select",{value:E.dateField??E.startDateField??"",onChange:a=>!s&&N({options:{...E,dateField:a.target.value,startDateField:a.target.value}}),className:"w-full px-2 py-1 text-sm border rounded bg-background mt-1",disabled:s,children:[e.jsx("option",{value:"",children:D.selectField}),g.map(a=>e.jsx("option",{value:a.name,children:a.label||a.name},a.name))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted-foreground",children:D.titleField}),e.jsxs("select",{value:E.titleField??"",onChange:a=>!s&&N({options:{...E,titleField:a.target.value}}),className:"w-full px-2 py-1 text-sm border rounded bg-background mt-1",disabled:s,children:[e.jsx("option",{value:"",children:D.selectField}),g.map(a=>e.jsx("option",{value:a.name,children:a.label||a.name},a.name))]})]})]}),O==="grid"&&e.jsx("div",{className:"text-xs text-muted-foreground text-center py-2",children:D.gridOptionsHint})]})]})]})]}),e.jsx(Fe,{isOpen:H.isOpen,title:H.title,message:H.message,onConfirm:H.onConfirm,onCancel:H.onCancel})]})}we.register("page-designer",Kt,{label:"Page Designer",category:"Designer",inputs:[{name:"canvas",type:"code",label:"Canvas Configuration"},{name:"components",type:"code",label:"Components"},{name:"showComponentTree",type:"boolean",label:"Show Component Tree",defaultValue:!0},{name:"undoRedo",type:"boolean",label:"Undo/Redo",defaultValue:!0},{name:"readOnly",type:"boolean",label:"Read Only",defaultValue:!1}]});we.register("data-model-designer",Bt,{label:"Data Model Designer",category:"Designer",inputs:[{name:"entities",type:"code",label:"Entities"},{name:"relationships",type:"code",label:"Relationships"},{name:"autoLayout",type:"boolean",label:"Auto Layout",defaultValue:!1},{name:"readOnly",type:"boolean",label:"Read Only",defaultValue:!1}]});we.register("process-designer",_t,{label:"Process Designer (BPMN)",category:"Designer",inputs:[{name:"processName",type:"string",label:"Process Name"},{name:"nodes",type:"code",label:"Nodes"},{name:"edges",type:"code",label:"Edges"},{name:"showMinimap",type:"boolean",label:"Show Minimap",defaultValue:!1},{name:"showToolbar",type:"boolean",label:"Show Toolbar",defaultValue:!0},{name:"readOnly",type:"boolean",label:"Read Only",defaultValue:!1}]});we.register("report-designer",ea,{label:"Report Designer",category:"Designer",inputs:[{name:"reportName",type:"string",label:"Report Name"},{name:"objectName",type:"string",label:"Data Source Object"},{name:"sections",type:"code",label:"Sections"},{name:"showToolbar",type:"boolean",label:"Show Toolbar",defaultValue:!0},{name:"showPropertyPanel",type:"boolean",label:"Show Property Panel",defaultValue:!0},{name:"readOnly",type:"boolean",label:"Read Only",defaultValue:!1}]});we.register("view-designer",lt,{label:"View Designer",category:"Designer",inputs:[{name:"objectName",type:"string",label:"Object Name"},{name:"viewId",type:"string",label:"View ID"},{name:"viewLabel",type:"string",label:"View Label"},{name:"viewType",type:"string",label:"View Type",defaultValue:"grid"},{name:"readOnly",type:"boolean",label:"Read Only",defaultValue:!1}]});function ra({objects:o}){const A=it(),{objectName:F,viewId:C}=ot(),b=o.find(s=>s.name===F),$=l.useMemo(()=>{if(!b?.fields)return[];const s=b.fields;return Array.isArray(s)?s.map(y=>typeof y=="string"?{name:y,label:y,type:"text"}:{name:y.name,label:y.label||y.name,type:y.type||"text"}):Object.entries(s).map(([y,c])=>({name:y,label:c.label||y,type:c.type||"text"}))},[b]),f=l.useMemo(()=>{if(!C||C==="new")return null;const s=b?.listViews||b?.list_views;return s&&s[C]||null},[C,b]),g=l.useCallback(s=>{console.log("[ViewDesigner] Save view config:",s),dt.success(f?`View "${s.viewLabel}" updated`:`View "${s.viewLabel}" created`),A(-1)},[f,A]),v=l.useCallback(()=>{A(-1)},[A]);return b?Ae.jsx("div",{className:"h-full flex flex-col",children:Ae.jsx(lt,{objectName:b.name,viewId:C==="new"?void 0:C,viewLabel:f?.label??"",viewType:f?.type??"grid",columns:f?.columns?f.columns.map((s,y)=>({field:s,label:$.find(c=>c.name===s)?.label??s,visible:!0,order:y})):[],filters:f?.filter??[],sort:f?.sort?.map(s=>({field:s.field,direction:s.order||s.direction||"asc"}))??[],availableFields:$,options:f?.options??{},onSave:g,onCancel:v,className:"flex-1"})}):Ae.jsxs("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:['Object "',F,'" not found']})}export{ra as ViewDesignerPage};
@@ -1 +0,0 @@
1
- import{O}from"./vendor-objectstack-Bifvxvds.js";import{h as C}from"./framework-mHWN965c.js";class ${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 a=await e();return this.set(t,a),a}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 h 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 y extends h{constructor(t,e){super(`Metadata not found for object: ${t}`,"METADATA_NOT_FOUND",404,{objectName:t,...e}),this.name="MetadataNotFoundError"}}class g extends h{constructor(t,e,s,n,a){super(`Bulk ${t} operation failed: ${e} succeeded, ${s} failed`,"BULK_OPERATION_ERROR",500,{operation:t,successCount:e,failureCount:s,errors:n,...a}),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 w extends h{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 h{constructor(t="Authentication failed",e,s){super(t,"AUTHENTICATION_ERROR",s||401,e),this.name="AuthenticationError"}}class E extends h{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 R(i,t){const e=i?.status||i?.statusCode||500,s=i?.message||i?.statusText||"Unknown error",n={context:t,response:{status:e,data:i?.data,headers:i?.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 a=A(t);return new y(a,n)}return new h(s,"NOT_FOUND",404,n);case 400:return new E(s,void 0,i?.data?.errors,n);case 503:return new w(s,i?.config?.url,n,503);case 504:return new w(s,i?.config?.url,n,504);default:return new h(s,"UNKNOWN_ERROR",e,n)}}function A(i){if(!i)return"unknown";const t=i.match(/\(([^)]+)\)/);return t?t[1]:"unknown"}class N{client;connected=!1;metadataCache;connectionState="disconnected";connectionStateListeners=[];batchProgressListeners=[];autoReconnect;maxReconnectAttempts;reconnectDelay;reconnectAttempts=0;baseUrl;token;constructor(t){this.client=new O(t),this.metadataCache=new $(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}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 w(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(a){console.error("Error in connection state listener:",a)}})}emitBatchProgress(t){this.batchProgressListeners.forEach(e=>{try{e(t)}catch(s){console.error("Error in batch progress listener:",s)}})}async find(t,e){await this.connect();const s=this.convertQueryParams(e),n=await this.client.data.find(t,s);if(Array.isArray(n))return{data:n,total:n.length,page:1,pageSize:n.length,hasMore:!1};const a=n,r=a.records||a.value||[],o=a.total??a.count??r.length;return{data:r,total:o,page:e?.$skip&&e.$top?Math.floor(e.$skip/e.$top)+1:1,pageSize:e?.$top,hasMore:e?.$top?r.length===e.$top:!1}}async findOne(t,e,s){await this.connect();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 a=0,r=0;const o=()=>{this.emitBatchProgress({operation:e,total:n,completed:a,failed:r,percentage:n>0?(a+r)/n*100:0})};try{switch(e){case"create":{o();const c=await this.client.data.createMany(t,s);return a=c.length,r=n-a,o(),c}case"delete":{const c=s.map(l=>l.id).filter(Boolean);if(c.length===0){const l=s.map((u,d)=>({index:d,error:`Missing ID for item at index ${d}`}));throw r=s.length,o(),new g("delete",0,s.length,l)}return o(),await this.client.data.deleteMany(t,c),a=c.length,r=n-a,o(),[]}case"update":{if(typeof this.client.data.updateMany=="function")try{o();const u=this.client.data.updateMany,d=await u(t,s);return a=d.length,r=n-a,o(),d}catch{}const c=[],l=[];for(let u=0;u<s.length;u++){const d=s[u],m=d.id;if(!m){l.push({index:u,error:"Missing ID"}),r++,o();continue}try{const f=await this.client.data.update(t,String(m),d);c.push(f.record),a++,o()}catch(f){const S=f instanceof Error?f.message:String(f);l.push({index:u,error:S}),r++,o()}}if(l.length>0)throw new g("update",c.length,l.length,l,{resource:t,totalRecords:s.length});return c}default:throw new h(`Unsupported bulk operation: ${e}`,"UNSUPPORTED_OPERATION",400)}}catch(c){if(o(),c instanceof g||c instanceof h)throw c;const l=c instanceof Error?c.message:String(c),u=s.map((d,m)=>({index:m,error:l}));throw new g(e,0,s.length,u,{resource:t,originalError:c})}}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=C(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,a])=>a==="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 y(t,{originalError:e}):e instanceof h?e:R(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 getItems(t,e){return await this.connect(),await Promise.all(e.map(async n=>{const a=`${t}:${n}`;return this.metadataCache.get(a,async()=>{const r=await this.client.meta.getItem(t,n);return r&&r.item?r.item:r})}))}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 a=`${this.baseUrl}/api/data/${encodeURIComponent(t)}/upload`,r=await fetch(a,{method:"POST",body:n,headers:{...this.getAuthHeaders()}});if(!r.ok){const o=await r.json().catch(()=>({message:r.statusText}));throw new h(o.message||`Upload failed with status ${r.status}`,"UPLOAD_ERROR",r.status)}return r.json()}async uploadFiles(t,e,s){await this.connect();const n=new FormData;e.forEach((o,c)=>{n.append("files",o,o.name||`file-${c}`)}),s?.recordId&&n.append("recordId",s.recordId),s?.fieldName&&n.append("fieldName",s.fieldName),s?.metadata&&n.append("metadata",JSON.stringify(s.metadata));const a=`${this.baseUrl}/api/data/${encodeURIComponent(t)}/upload`,r=await fetch(a,{method:"POST",body:n,headers:{...this.getAuthHeaders()}});if(!r.ok){const o=await r.json().catch(()=>({message:r.statusText}));throw new h(o.message||`Upload failed with status ${r.status}`,"UPLOAD_ERROR",r.status)}return r.json()}getAuthHeaders(){const t={};return this.token&&(t.Authorization=`Bearer ${this.token}`),t}}export{N as O};