@baasix/baasix 0.1.62 → 0.1.64

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 (119) hide show
  1. package/dist/app/404/index.html +1 -1
  2. package/dist/app/404.html +1 -1
  3. package/dist/app/_next/static/chunks/2667-7993936698bf75a9.js +1 -0
  4. package/dist/app/_next/static/chunks/3233-ae028c73c510ebea.js +1 -0
  5. package/dist/app/_next/static/chunks/4033-ea89dd457b87cead.js +1 -0
  6. package/dist/app/_next/static/chunks/799-d4372ad380b0dec6.js +1 -0
  7. package/dist/app/_next/static/chunks/app/(authenticated)/activity-log/all-activity/{page-a7e9f0b39624b489.js → page-8e1f084e807ff5ee.js} +1 -1
  8. package/dist/app/_next/static/chunks/app/(authenticated)/activity-log/email-log/{page-40f2b9ecf73e74b5.js → page-4e08df2865fe9d0f.js} +1 -1
  9. package/dist/app/_next/static/chunks/app/(authenticated)/activity-log/notifications/{page-21fcdd2f0b3549db.js → page-3a5070a5088835ae.js} +1 -1
  10. package/dist/app/_next/static/chunks/app/(authenticated)/activity-log/sessions/{page-82662735f1ec476a.js → page-edfa379cab0d3ccb.js} +1 -1
  11. package/dist/app/_next/static/chunks/app/(authenticated)/activity-log/workflow-executions/{page-4a781c95e5fb25f0.js → page-d007890f17b60862.js} +1 -1
  12. package/dist/app/_next/static/chunks/app/(authenticated)/activity-log/workflow-logs/{page-70bf8d31074dcba0.js → page-976e9829706ac8f2.js} +1 -1
  13. package/dist/app/_next/static/chunks/app/(authenticated)/dashboard/page-9f47da86e0599eae.js +1 -0
  14. package/dist/app/_next/static/chunks/app/(authenticated)/data-browser/{page-d5715b9743d8dba4.js → page-fbb7a4d4f2a4353d.js} +1 -1
  15. package/dist/app/_next/static/chunks/app/(authenticated)/file-manager/{page-c008de2bcf6811b9.js → page-cea6a2c1670d4ef5.js} +1 -1
  16. package/dist/app/_next/static/chunks/app/(authenticated)/layout-b7f18737e4c308a4.js +1 -0
  17. package/dist/app/_next/static/chunks/app/(authenticated)/settings/migrations/page-505c3389890685b9.js +1 -0
  18. package/dist/app/_next/static/chunks/app/(authenticated)/settings/permissions/{page-2d3043500adcdb12.js → page-ed80f4bd5d81df95.js} +1 -1
  19. package/dist/app/_next/static/chunks/app/(authenticated)/settings/project/{page-6a58f15efb013e17.js → page-310b8ce72d0516ea.js} +1 -1
  20. package/dist/app/_next/static/chunks/app/(authenticated)/settings/roles/{page-00cf3e4483986407.js → page-fd62dc19ac88dd64.js} +1 -1
  21. package/dist/app/_next/static/chunks/app/(authenticated)/settings/schema/page-3d91124704c2e853.js +1 -0
  22. package/dist/app/_next/static/chunks/app/(authenticated)/settings/schema-diff/page-cae8772a7ae93b9a.js +1 -0
  23. package/dist/app/_next/static/chunks/app/(authenticated)/settings/tasks/{page-fa3c401992a2fb8f.js → page-1479604bbfc53a83.js} +1 -1
  24. package/dist/app/_next/static/chunks/app/(authenticated)/settings/templates/edit/{page-4ce715d527c717a8.js → page-a611195661ce22bd.js} +1 -1
  25. package/dist/app/_next/static/chunks/app/(authenticated)/settings/templates/{page-aafbfd4f12875738.js → page-6787b62a4960304f.js} +1 -1
  26. package/dist/app/_next/static/chunks/app/(authenticated)/settings/tenants/{page-f34d97ce6f68183b.js → page-856d4af5fbd76c8e.js} +1 -1
  27. package/dist/app/_next/static/chunks/app/(authenticated)/users/invites/{page-20dd05a8745b6283.js → page-ed5493d55f6c1db8.js} +1 -1
  28. package/dist/app/_next/static/chunks/app/(authenticated)/users/list/{page-479a164304f4de3f.js → page-02e6ef533bdc3bbc.js} +1 -1
  29. package/dist/app/_next/static/chunks/app/(authenticated)/users/{page-909d7be1b8d9800c.js → page-faf321b61a6fdeef.js} +1 -1
  30. package/dist/app/_next/static/chunks/app/(authenticated)/users/preferences/{page-e3fbcc425e1710e5.js → page-2116015e962a2ecc.js} +1 -1
  31. package/dist/app/_next/static/chunks/app/(authenticated)/users/user-roles/{page-3f654c69d79269f7.js → page-7d1bcbbfc8f0694b.js} +1 -1
  32. package/dist/app/_next/static/chunks/app/(authenticated)/workflows/edit/{page-753cf274fd329860.js → page-45c465caaa5679bd.js} +1 -1
  33. package/dist/app/_next/static/chunks/app/(authenticated)/workflows/{page-33c1c69678122839.js → page-7f9cb24aaa798f42.js} +1 -1
  34. package/dist/app/_next/static/chunks/{main-324e91f5a430cddf.js → main-8ffa7219a08e42cf.js} +1 -1
  35. package/dist/app/_next/static/chunks/{webpack-b29732cfe967a5f5.js → webpack-7a100cbf9402e7ea.js} +1 -1
  36. package/dist/app/_next/static/css/45276c37be155f45.css +3 -0
  37. package/dist/app/activity-log/all-activity/index.html +1 -1
  38. package/dist/app/activity-log/all-activity/index.txt +3 -3
  39. package/dist/app/activity-log/email-log/index.html +1 -1
  40. package/dist/app/activity-log/email-log/index.txt +3 -3
  41. package/dist/app/activity-log/index.html +1 -1
  42. package/dist/app/activity-log/index.txt +2 -2
  43. package/dist/app/activity-log/notifications/index.html +1 -1
  44. package/dist/app/activity-log/notifications/index.txt +3 -3
  45. package/dist/app/activity-log/sessions/index.html +1 -1
  46. package/dist/app/activity-log/sessions/index.txt +3 -3
  47. package/dist/app/activity-log/workflow-executions/index.html +1 -1
  48. package/dist/app/activity-log/workflow-executions/index.txt +3 -3
  49. package/dist/app/activity-log/workflow-logs/index.html +1 -1
  50. package/dist/app/activity-log/workflow-logs/index.txt +3 -3
  51. package/dist/app/change-password/index.html +1 -1
  52. package/dist/app/change-password/index.txt +2 -2
  53. package/dist/app/dashboard/index.html +1 -1
  54. package/dist/app/dashboard/index.txt +3 -3
  55. package/dist/app/data-browser/index.html +1 -1
  56. package/dist/app/data-browser/index.txt +3 -3
  57. package/dist/app/file-manager/index.html +1 -1
  58. package/dist/app/file-manager/index.txt +3 -3
  59. package/dist/app/forgot-password/index.html +1 -1
  60. package/dist/app/forgot-password/index.txt +1 -1
  61. package/dist/app/index.html +1 -1
  62. package/dist/app/index.txt +1 -1
  63. package/dist/app/login/index.html +1 -1
  64. package/dist/app/login/index.txt +1 -1
  65. package/dist/app/register/index.html +1 -1
  66. package/dist/app/register/index.txt +1 -1
  67. package/dist/app/settings/migrations/index.html +1 -1
  68. package/dist/app/settings/migrations/index.txt +3 -3
  69. package/dist/app/settings/permissions/index.html +1 -1
  70. package/dist/app/settings/permissions/index.txt +3 -3
  71. package/dist/app/settings/project/index.html +1 -1
  72. package/dist/app/settings/project/index.txt +3 -3
  73. package/dist/app/settings/roles/index.html +1 -1
  74. package/dist/app/settings/roles/index.txt +3 -3
  75. package/dist/app/settings/schema/index.html +1 -1
  76. package/dist/app/settings/schema/index.txt +3 -3
  77. package/dist/app/settings/schema-diff/index.html +1 -0
  78. package/dist/app/settings/schema-diff/index.txt +14 -0
  79. package/dist/app/settings/tasks/index.html +1 -1
  80. package/dist/app/settings/tasks/index.txt +3 -3
  81. package/dist/app/settings/templates/edit/index.html +1 -1
  82. package/dist/app/settings/templates/edit/index.txt +3 -3
  83. package/dist/app/settings/templates/index.html +1 -1
  84. package/dist/app/settings/templates/index.txt +3 -3
  85. package/dist/app/settings/tenants/index.html +1 -1
  86. package/dist/app/settings/tenants/index.txt +3 -3
  87. package/dist/app/users/index.html +1 -1
  88. package/dist/app/users/index.txt +3 -3
  89. package/dist/app/users/invites/index.html +1 -1
  90. package/dist/app/users/invites/index.txt +3 -3
  91. package/dist/app/users/list/index.html +1 -1
  92. package/dist/app/users/list/index.txt +3 -3
  93. package/dist/app/users/preferences/index.html +1 -1
  94. package/dist/app/users/preferences/index.txt +3 -3
  95. package/dist/app/users/user-roles/index.html +1 -1
  96. package/dist/app/users/user-roles/index.txt +3 -3
  97. package/dist/app/workflows/detail/index.html +1 -1
  98. package/dist/app/workflows/detail/index.txt +2 -2
  99. package/dist/app/workflows/edit/index.html +1 -1
  100. package/dist/app/workflows/edit/index.txt +3 -3
  101. package/dist/app/workflows/execution/index.html +1 -1
  102. package/dist/app/workflows/execution/index.txt +2 -2
  103. package/dist/app/workflows/index.html +1 -1
  104. package/dist/app/workflows/index.txt +3 -3
  105. package/dist/routes/schema-diff.route.d.ts +7 -0
  106. package/dist/routes/schema-diff.route.d.ts.map +1 -0
  107. package/dist/routes/schema-diff.route.js +320 -0
  108. package/dist/routes/schema-diff.route.js.map +1 -0
  109. package/package.json +1 -1
  110. package/dist/app/_next/static/chunks/2033-8355304f13887db5.js +0 -1
  111. package/dist/app/_next/static/chunks/4952-1b97320cf61f3f21.js +0 -1
  112. package/dist/app/_next/static/chunks/6547-1aaab011e6089042.js +0 -1
  113. package/dist/app/_next/static/chunks/app/(authenticated)/dashboard/page-1ceeac9e72997a8a.js +0 -1
  114. package/dist/app/_next/static/chunks/app/(authenticated)/layout-2a4b221af5cbbade.js +0 -1
  115. package/dist/app/_next/static/chunks/app/(authenticated)/settings/migrations/page-6681c14dd478cc9a.js +0 -1
  116. package/dist/app/_next/static/chunks/app/(authenticated)/settings/schema/page-e7f836d3a7f7c5d0.js +0 -1
  117. package/dist/app/_next/static/css/17a2e01c4184b106.css +0 -3
  118. /package/dist/app/_next/static/{ORfvBD2VaKIB_8_7O9AgQ → 0OAEQ9OeMefOQpSdB_tKL}/_buildManifest.js +0 -0
  119. /package/dist/app/_next/static/{ORfvBD2VaKIB_8_7O9AgQ → 0OAEQ9OeMefOQpSdB_tKL}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7598],{24654:function(){},79728:function(e,t,r){Promise.resolve().then(r.bind(r,97222))},97222:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return Z}});var o=r(57437),l=r(2265),n=r(72135),a=r(29696),i=r(79820),s=r(95805),c=r(14924),d=r(68113),u=r(84428),v=r(42488),h=r(70525),f=r(14438),m=r(12438),g=r(91436),p=r(14565),x=r(56933),b=r(93448);let y={light:"",dark:".dark"},j=l.createContext(null);function N(){let e=l.useContext(j);if(!e)throw Error("useChart must be used within a <ChartContainer />");return e}let k=l.forwardRef((e,t)=>{let{id:r,className:n,children:a,config:i,...s}=e,c=l.useId(),d="chart-".concat(r||c.replace(/:/g,""));return(0,o.jsx)(j.Provider,{value:{config:i},children:(0,o.jsxs)("div",{"data-chart":d,ref:t,className:(0,b.cn)("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",n),...s,children:[(0,o.jsx)(_,{id:d,config:i}),(0,o.jsx)(g.h,{children:a})]})})});k.displayName="Chart";let _=e=>{let{id:t,config:r}=e,l=Object.entries(r).filter(e=>{let[,t]=e;return t.theme||t.color});return l.length?(0,o.jsx)("style",{dangerouslySetInnerHTML:{__html:Object.entries(y).map(e=>{let[r,o]=e;return"\n".concat(o," [data-chart=").concat(t,"] {\n").concat(l.map(e=>{var t;let[o,l]=e,n=(null===(t=l.theme)||void 0===t?void 0:t[r])||l.color;return n?" --color-".concat(o,": ").concat(n,";"):null}).join("\n"),"\n}\n")}).join("\n")}}):null},w=p.u,C=l.forwardRef((e,t)=>{let{active:r,payload:n,className:a,indicator:i="dot",hideLabel:s=!1,hideIndicator:c=!1,label:d,labelFormatter:u,labelClassName:v,formatter:h,color:f,nameKey:m,labelKey:g}=e,{config:p}=N(),x=l.useMemo(()=>{var e;if(s||!(null==n?void 0:n.length))return null;let[t]=n,r="".concat(g||t.dataKey||t.name||"value"),l=L(p,t,r),a=g||"string"!=typeof d?null==l?void 0:l.label:(null===(e=p[d])||void 0===e?void 0:e.label)||d;return u?(0,o.jsx)("div",{className:(0,b.cn)("font-medium",v),children:u(a,n)}):a?(0,o.jsx)("div",{className:(0,b.cn)("font-medium",v),children:a}):null},[d,u,n,s,v,p,g]);if(!r||!(null==n?void 0:n.length))return null;let y=1===n.length&&"dot"!==i;return(0,o.jsxs)("div",{ref:t,className:(0,b.cn)("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",a),children:[y?null:x,(0,o.jsx)("div",{className:"grid gap-1.5",children:n.map((e,t)=>{var r;let l="".concat(m||e.name||e.dataKey||"value"),n=L(p,e,l),a=f||(null===(r=e.payload)||void 0===r?void 0:r.fill)||e.color;return(0,o.jsx)("div",{className:(0,b.cn)("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground","dot"===i&&"items-center"),children:h&&(null==e?void 0:e.value)!==void 0&&e.name?h(e.value,e.name,e,t,e.payload):(0,o.jsxs)(o.Fragment,{children:[(null==n?void 0:n.icon)?(0,o.jsx)(n.icon,{}):!c&&(0,o.jsx)("div",{className:(0,b.cn)("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":"dot"===i,"w-1":"line"===i,"w-0 border-[1.5px] border-dashed bg-transparent":"dashed"===i,"my-0.5":y&&"dashed"===i}),style:{"--color-bg":a,"--color-border":a}}),(0,o.jsxs)("div",{className:(0,b.cn)("flex flex-1 justify-between leading-none",y?"items-end":"items-center"),children:[(0,o.jsxs)("div",{className:"grid gap-1.5",children:[y?x:null,(0,o.jsx)("span",{className:"text-muted-foreground",children:(null==n?void 0:n.label)||e.name})]}),e.value&&(0,o.jsx)("span",{className:"font-mono font-medium tabular-nums text-foreground",children:e.value.toLocaleString()})]})]})},String(e.dataKey))})})]})});C.displayName="ChartTooltip";let A=x.D,S=l.forwardRef((e,t)=>{let{className:r,hideIcon:l=!1,payload:n,verticalAlign:a="bottom",nameKey:i}=e,{config:s}=N();return(null==n?void 0:n.length)?(0,o.jsx)("div",{ref:t,className:(0,b.cn)("flex items-center justify-center gap-4","top"===a?"pb-3":"pt-3",r),children:n.map(e=>{let t="".concat(i||e.dataKey||"value"),r=L(s,e,t);return(0,o.jsxs)("div",{className:(0,b.cn)("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[(null==r?void 0:r.icon)&&!l?(0,o.jsx)(r.icon,{}):(0,o.jsx)("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:e.color}}),null==r?void 0:r.label]},e.value)})}):null});function L(e,t,r){if("object"!=typeof t||null===t)return;let o="payload"in t&&"object"==typeof t.payload&&null!==t.payload?t.payload:void 0,l=r;return r in t&&"string"==typeof t[r]?l=t[r]:o&&r in o&&"string"==typeof o[r]&&(l=o[r]),l in e?e[l]:e[r]}S.displayName="ChartLegend";var T=r(31031),E=r(56940),M=r(97059),D=r(62994),H=r(9234);let O=e=>{let{title:t,value:r,icon:l,description:n}=e;return(0,o.jsxs)(i.Zb,{children:[(0,o.jsxs)(i.Ol,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[(0,o.jsx)(i.ll,{className:"text-sm font-medium",children:t}),(0,o.jsx)("div",{className:"h-4 w-4 text-muted-foreground",children:l})]}),(0,o.jsxs)(i.aY,{children:[(0,o.jsx)("div",{className:"text-2xl font-bold",children:"number"==typeof r?r.toLocaleString():r}),n&&(0,o.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:n})]})]})},F={create:"hsl(var(--chart-1))",update:"hsl(var(--chart-2))",delete:"hsl(var(--chart-3))",read:"hsl(var(--chart-4))",login:"hsl(var(--chart-5))",logout:"hsl(142, 76%, 36%)",upload:"hsl(262, 83%, 58%)",download:"hsl(24, 95%, 53%)"},R=e=>{if(0===e)return"0 B";let t=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,t)).toFixed(2))+" "+["B","KB","MB","GB","TB"][t]};var Z=()=>{var e,t,r,g;let p=(0,n.Ji)(),{schemas:x}=(0,a.I_)(),b=(0,l.useMemo)(()=>{let e=new Date;return e.setHours(e.getHours()-72),e.toISOString()},[]),{data:y,isLoading:j}=(0,n.EV)({url:"".concat(p,"/reports/stats"),method:"post",config:{payload:{stats:[{name:"total_users",collection:"baasix_User",query:{aggregate:{count:{function:"count",field:"id"}}}},{name:"total_files",collection:"baasix_File",query:{aggregate:{count:{function:"count",field:"id"}}}},{name:"total_storage",collection:"baasix_File",query:{aggregate:{totalSize:{function:"sum",field:"size"}}}},{name:"total_activities",collection:"baasix_AuditLog",query:{aggregate:{count:{function:"count",field:"id"}}}},{name:"activities_by_action",collection:"baasix_AuditLog",query:{groupBy:["action"],aggregate:{count:{function:"count",field:"id"}},filter:{createdAt:{gte:b}}}},{name:"activities_by_hour",collection:"baasix_AuditLog",query:{groupBy:["date:year:createdAt","date:month:createdAt","date:day:createdAt","date:hour:createdAt","action"],aggregate:{count:{function:"count",field:"id"}},filter:{createdAt:{gte:b}}}}]}}}),N=(0,l.useMemo)(()=>{var e,t,r,o,l,n,a,i,s,c,d,u,v,h,f;let m=null==y?void 0:null===(e=y.data)||void 0===e?void 0:e.data;if(!m)return null;let g=Number(null===(o=m.total_users)||void 0===o?void 0:null===(r=o.data)||void 0===r?void 0:null===(t=r[0])||void 0===t?void 0:t.count)||0,p=Number(null===(a=m.total_files)||void 0===a?void 0:null===(n=a.data)||void 0===n?void 0:null===(l=n[0])||void 0===l?void 0:l.count)||0,x=Number(null===(c=m.total_storage)||void 0===c?void 0:null===(s=c.data)||void 0===s?void 0:null===(i=s[0])||void 0===i?void 0:i.totalSize)||0,b=Number(null===(v=m.total_activities)||void 0===v?void 0:null===(u=v.data)||void 0===u?void 0:null===(d=u[0])||void 0===d?void 0:d.count)||0,j={};return null===(f=m.activities_by_action)||void 0===f||null===(h=f.data)||void 0===h||h.forEach(e=>{var t;let r=null===(t=e.action)||void 0===t?void 0:t.toLowerCase();r&&(j[r]=Number(e.count)||0)}),{totalUsers:g,totalFiles:p,totalStorage:x,totalActivities:b,actionBreakdown:j}},[y]),{chartConfig:_,uniqueActions:L}=(0,l.useMemo)(()=>{var e,t,r;let o=null==y?void 0:null===(r=y.data)||void 0===r?void 0:null===(t=r.data)||void 0===t?void 0:null===(e=t.activities_by_action)||void 0===e?void 0:e.data;if(!o)return{chartConfig:{},uniqueActions:[]};let l=o.map(e=>{var t;return null===(t=e.action)||void 0===t?void 0:t.toLowerCase()}).filter(Boolean),n={};return l.forEach((e,t)=>{n[e]={label:e.charAt(0).toUpperCase()+e.slice(1),color:F[e]||"hsl(".concat(47*t%360,", 70%, 50%)")}}),{chartConfig:n,uniqueActions:l}},[y]),Z=(0,l.useMemo)(()=>{var e,t,r;let o=null==y?void 0:null===(r=y.data)||void 0===r?void 0:null===(t=r.data)||void 0===t?void 0:null===(e=t.activities_by_hour)||void 0===e?void 0:e.data;if(!o||0===o.length)return[];let l=new Date;l.setMinutes(0,0,0);let n=[];for(let e=71;e>=0;e--){let t=new Date(l);t.setHours(t.getHours()-e);let r="";if(0===e)r="Now";else if(e<24)r="".concat(e,"h ago");else{let t=Math.floor(e/24),o=e%24;r=0===o?"".concat(t,"d ago"):"".concat(t,"d ").concat(o,"h")}n.push({hour:r,timestamp:t.getTime(),_year:t.getFullYear(),_month:t.getMonth()+1,_day:t.getDate(),_hour:t.getHours()})}return o.forEach(e=>{var t;let r=Number(e["date:year:createdAt"]),o=Number(e["date:month:createdAt"]),l=Number(e["date:day:createdAt"]),a=Number(e["date:hour:createdAt"]),i=null===(t=e.action)||void 0===t?void 0:t.toLowerCase(),s=Number(e.count)||0;if(!i)return;let c=new Date(Date.UTC(r,o-1,l,a)),d=c.getFullYear(),u=c.getMonth()+1,v=c.getDate(),h=c.getHours(),f=n.find(e=>e._year===d&&e._month===u&&e._day===v&&e._hour===h);f&&(f[i]=(f[i]||0)+s)}),n.map(e=>{let{_year:t,_month:r,_day:o,_hour:l,...n}=e;return n})},[y]),q=(0,l.useMemo)(()=>(null==x?void 0:x.filter(e=>{var t;return!(null===(t=e.collectionName)||void 0===t?void 0:t.startsWith("baasix_"))}).length)||0,[x]);return(0,l.useEffect)(()=>{let e=window.localStorage.getItem("token");if(e){let t=new m.$;return t.connect("/",e),t.subscribe("baasix_Notification",{create:e=>{var t,r;f.Am.success(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.title,{description:null==e?void 0:null===(r=e.data)||void 0===r?void 0:r.message})},update:e=>{var t,r;f.Am.info(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.title,{description:null==e?void 0:null===(r=e.data)||void 0===r?void 0:r.message})},delete:e=>{var t,r;f.Am.error(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.title,{description:null==e?void 0:null===(r=e.data)||void 0===r?void 0:r.message})}}).catch(e=>{console.error("Error subscribing to notification:",e)}),()=>{t.disconnect()}}},[]),(0,o.jsx)("div",{className:"flex-1 overflow-auto",children:(0,o.jsxs)("div",{className:"space-y-6 pb-6",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("h1",{className:"text-2xl font-bold",children:"Dashboard"}),(0,o.jsx)("p",{className:"text-muted-foreground",children:"Overview of your application"})]}),(0,o.jsxs)("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-5",children:[(0,o.jsx)(O,{title:"Total Users",value:null!==(e=null==N?void 0:N.totalUsers)&&void 0!==e?e:0,icon:(0,o.jsx)(s.Z,{className:"h-4 w-4"}),description:"Registered users"}),(0,o.jsx)(O,{title:"Collections",value:q,icon:(0,o.jsx)(c.Z,{className:"h-4 w-4"}),description:"".concat((null==x?void 0:x.length)||0," total (incl. system)")}),(0,o.jsx)(O,{title:"Total Files",value:null!==(t=null==N?void 0:N.totalFiles)&&void 0!==t?t:0,icon:(0,o.jsx)(d.Z,{className:"h-4 w-4"}),description:"Uploaded files"}),(0,o.jsx)(O,{title:"Storage Used",value:R(null!==(r=null==N?void 0:N.totalStorage)&&void 0!==r?r:0),icon:(0,o.jsx)(u.Z,{className:"h-4 w-4"}),description:"Total file storage"}),(0,o.jsx)(O,{title:"Total Activities",value:null!==(g=null==N?void 0:N.totalActivities)&&void 0!==g?g:0,icon:(0,o.jsx)(v.Z,{className:"h-4 w-4"}),description:"All time activities"})]}),(0,o.jsxs)(i.Zb,{children:[(0,o.jsxs)(i.Ol,{children:[(0,o.jsxs)(i.ll,{className:"flex items-center gap-2",children:[(0,o.jsx)(h.Z,{className:"h-5 w-5"}),"Activity Timeline"]}),(0,o.jsx)(i.SZ,{children:"Activity breakdown over the last 72 hours"})]}),(0,o.jsx)(i.aY,{children:!j&&L.length>0?(0,o.jsx)(k,{config:_,className:"h-[300px] w-full",children:(0,o.jsxs)(T.T,{data:Z,margin:{top:10,right:10,left:0,bottom:0},children:[(0,o.jsx)("defs",{children:L.map(e=>(0,o.jsxs)("linearGradient",{id:"fill-".concat(e),x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,o.jsx)("stop",{offset:"5%",stopColor:"var(--color-".concat(e,")"),stopOpacity:.8}),(0,o.jsx)("stop",{offset:"95%",stopColor:"var(--color-".concat(e,")"),stopOpacity:.1})]},e))}),(0,o.jsx)(E.q,{strokeDasharray:"3 3",vertical:!1}),(0,o.jsx)(M.K,{dataKey:"hour",tickLine:!1,axisLine:!1,tickMargin:8,interval:"preserveStartEnd",minTickGap:50}),(0,o.jsx)(D.B,{tickLine:!1,axisLine:!1,tickMargin:8,allowDecimals:!1}),(0,o.jsx)(w,{content:(0,o.jsx)(C,{})}),(0,o.jsx)(A,{content:(0,o.jsx)(S,{})}),L.map(e=>(0,o.jsx)(H.uN,{type:"monotone",dataKey:e,stackId:"1",stroke:"var(--color-".concat(e,")"),fill:"url(#fill-".concat(e,")")},e))]})}):(0,o.jsx)("div",{className:"flex items-center justify-center h-[300px] text-muted-foreground",children:j?"Loading activity data...":"No activity data available"})})]})]})})}},12438:function(e,t,r){"use strict";r.d(t,{$:function(){return l}});var o=r(68680);class l{connect(e,t){return this.socket=(0,o.io)(e,{auth:{token:t},path:"/realtime",reconnection:!0,reconnectionAttempts:5,reconnectionDelay:1e3,reconnectionDelayMax:5e3,transports:["websocket","polling"]}),this._setupListeners(),this}_setupListeners(){this.socket&&(this.socket.on("connect",()=>{console.log("Connected to socket server"),this.subscriptions.forEach(e=>{this._subscribe(e)})}),this.socket.on("connected",e=>{console.log("Socket authenticated:",e)}),this.socket.on("disconnect",e=>{console.log("Disconnected from socket server:",e)}),this.socket.on("connect_error",e=>{console.error("Socket connection error:",e)}))}_subscribe(e){this.socket&&this.socket.emit("subscribe",{collection:e})}async subscribe(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((r,o)=>{if(!this.socket){o(Error("Socket not connected"));return}this.socket.emit("subscribe",{collection:e},l=>{"success"===l.status?(this.subscriptions.add(e),["create","update","delete"].forEach(r=>{let o="".concat(e,":").concat(r),l=t[r];l&&(this.eventHandlers.has(o)&&this.socket.off(o,this.eventHandlers.get(o)),this.socket.on(o,l),this.eventHandlers.set(o,l))}),r()):o(Error(l.message))})})}async unsubscribe(e){return new Promise((t,r)=>{if(!this.socket){r(Error("Socket not connected"));return}this.socket.emit("unsubscribe",{collection:e},o=>{"success"===o.status?(this.subscriptions.delete(e),["create","update","delete"].forEach(t=>{let r="".concat(e,":").concat(t);this.eventHandlers.has(r)&&(this.socket.off(r,this.eventHandlers.get(r)),this.eventHandlers.delete(r))}),t()):r(Error(o.message))})})}disconnect(){this.socket&&(this.socket.disconnect(),this.subscriptions.clear(),this.eventHandlers.clear())}constructor(){this.socket=null,this.subscriptions=new Set,this.eventHandlers=new Map}}},79820:function(e,t,r){"use strict";r.d(t,{Ol:function(){return i},SZ:function(){return c},Zb:function(){return a},aY:function(){return d},eW:function(){return u},ll:function(){return s}});var o=r(57437),l=r(2265),n=r(93448);let a=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,o.jsx)("div",{ref:t,className:(0,n.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",r),...l})});a.displayName="Card";let i=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,o.jsx)("div",{ref:t,className:(0,n.cn)("flex flex-col space-y-1 p-4",r),...l})});i.displayName="CardHeader";let s=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,o.jsx)("h3",{ref:t,className:(0,n.cn)("text-lg font-semibold leading-none tracking-tight",r),...l})});s.displayName="CardTitle";let c=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,o.jsx)("p",{ref:t,className:(0,n.cn)("text-sm text-muted-foreground",r),...l})});c.displayName="CardDescription";let d=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,o.jsx)("div",{ref:t,className:(0,n.cn)("p-4 pt-0",r),...l})});d.displayName="CardContent";let u=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,o.jsx)("div",{ref:t,className:(0,n.cn)("flex items-center p-4 pt-0",r),...l})});u.displayName="CardFooter"},93448:function(e,t,r){"use strict";r.d(t,{cn:function(){return n}});var o=r(61994),l=r(53335);function n(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,l.m6)((0,o.W)(t))}},29696:function(e,t,r){"use strict";r.d(t,{A1:function(){return s},I_:function(){return i}});var o=r(57437),l=r(2265),n=r(72135);let a=(0,l.createContext)(void 0),i=()=>{let e=(0,l.useContext)(a);if(!e)throw Error("useSchema must be used within a SchemaProvider");return e};function s(e){let{children:t}=e,{data:r,isLoading:l,refetch:i}=(0,n.sm)({resource:"collections",queryOptions:{enabled:!0},sorters:[{field:"collectionName",order:"asc"}],pagination:{pageSize:500}}),s=(null==r?void 0:r.data)||[],c=e=>s.find(t=>t.collectionName===e),d=e=>{let t=c(e),r=null==t?void 0:t.schema.fields;if(r){let t={...r};for(let[e,r]of Object.entries(t))r.hidden&&delete t[e];return"baasix_Account"===e&&(delete t.password,delete t.accessToken,delete t.refreshToken,delete t.idToken),"baasix_Verification"===e&&delete t.value,"baasix_Sessions"===e&&delete t.token,t}return r},u=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(0===r)return[];let l=d(e);return l?Object.entries(l).map(e=>{let[l,n]=e,a=t?"".concat(t,".").concat(l):l,i=o?{title:n.relType?a+".*":a,value:n.relType?a+".*":a,key:n.relType?a+".*":a,isLeaf:!n.relType}:{title:a,value:a,key:a,isLeaf:!n.relType};return n.relType&&n.target&&(i.children=u(n.target,a,r-1,o)),i}):[]};return(0,o.jsx)(a.Provider,{value:{schemas:s,isLoading:l,refetch:i,getSchemaByName:c,getFieldsByCollection:d,getCollectionChoices:()=>s.map(e=>({label:e.schema.name,value:e.collectionName})),getTargetFields:e=>{let t=d(e);return t?Object.entries(t).map(e=>{let[t]=e;return{label:t,value:t}}):[]},formatRelationshipDisplay:(e,t)=>e&&t?null==t?void 0:t.split(",").map(t=>{let r=t.trim();return e[r]||r}).join(""):"",getNestedFields:e=>u(e),getPermissionFields:e=>[{title:"*",value:"*",key:"*",isLeaf:!0},...u(e,"",6,!0),{title:"*.*",value:"*.*",key:"*.*",isLeaf:!0},{title:"*.*.*",value:"*.*.*",key:"*.*.*",isLeaf:!0},{title:"*.*.*.*",value:"*.*.*.*",key:"*.*.*.*",isLeaf:!0}],isSortEnabled:e=>{var t;let r=c(e);return(null==r?void 0:null===(t=r.schema)||void 0===t?void 0:t.sortEnabled)===!0}},children:t})}}},function(e){e.O(0,[7999,5094,4438,4458,9090,2971,2117,1744],function(){return e(e.s=79728)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6142],{85972:function(e,t,n){Promise.resolve().then(n.bind(n,38299))},79205:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(2265);let l=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),u=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter((e,t,n)=>!!e&&n.indexOf(e)===t).join(" ")};var o={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let a=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:l=24,strokeWidth:a=2,absoluteStrokeWidth:i,className:s="",children:d,iconNode:c,...f}=e;return(0,r.createElement)("svg",{ref:t,...o,width:l,height:l,stroke:n,strokeWidth:i?24*Number(a)/Number(l):a,className:u("lucide",s),...f},[...c.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),i=(e,t)=>{let n=(0,r.forwardRef)((n,o)=>{let{className:i,...s}=n;return(0,r.createElement)(a,{ref:o,iconNode:t,className:u("lucide-".concat(l(e)),i),...s})});return n.displayName="".concat(e),n}},51817:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},30166:function(e,t,n){"use strict";n.d(t,{default:function(){return l.a}});var r=n(55775),l=n.n(r)},55775:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return u}});let r=n(47043);n(57437),n(2265);let l=r._(n(15602));function u(e,t){var n;let r={loading:e=>{let{error:t,isLoading:n,pastDelay:r}=e;return null}};"function"==typeof e&&(r.loader=e);let u={...r,...t};return(0,l.default)({...u,modules:null==(n=u.loadableGenerated)?void 0:n.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},81523:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return l}});let r=n(18993);function l(e){let{reason:t,children:n}=e;if("undefined"==typeof window)throw new r.BailoutToCSRError(t);return n}},15602:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return s}});let r=n(57437),l=n(2265),u=n(81523),o=n(70049);function a(e){return{default:e&&"default"in e?e.default:e}}let i={loader:()=>Promise.resolve(a(()=>null)),loading:null,ssr:!0},s=function(e){let t={...i,...e},n=(0,l.lazy)(()=>t.loader().then(a)),s=t.loading;function d(e){let a=s?(0,r.jsx)(s,{isLoading:!0,pastDelay:!0,error:null}):null,i=t.ssr?(0,r.jsxs)(r.Fragment,{children:["undefined"==typeof window?(0,r.jsx)(o.PreloadCss,{moduleIds:t.modules}):null,(0,r.jsx)(n,{...e})]}):(0,r.jsx)(u.BailoutToCSR,{reason:"next/dynamic",children:(0,r.jsx)(n,{...e})});return(0,r.jsx)(l.Suspense,{fallback:a,children:i})}return d.displayName="LoadableComponent",d}},70049:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadCss",{enumerable:!0,get:function(){return u}});let r=n(57437),l=n(20544);function u(e){let{moduleIds:t}=e;if("undefined"!=typeof window)return null;let n=(0,l.getExpectedRequestStore)("next/dynamic css"),u=[];if(n.reactLoadableManifest&&t){let e=n.reactLoadableManifest;for(let n of t){if(!e[n])continue;let t=e[n].files.filter(e=>e.endsWith(".css"));u.push(...t)}}return 0===u.length?null:(0,r.jsx)(r.Fragment,{children:u.map(e=>(0,r.jsx)("link",{precedence:"dynamic",rel:"stylesheet",href:n.assetPrefix+"/_next/"+encodeURI(e),as:"style"},e))})}},38299:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(57437);n(2265);var l=n(30166),u=n(51817);function o(){return(0,r.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,r.jsx)(u.Z,{className:"h-8 w-8 animate-spin"})})}let a=(0,l.default)(()=>Promise.all([n.e(7999),n.e(3572),n.e(7902),n.e(5094),n.e(4438),n.e(6530),n.e(6241),n.e(4475),n.e(926),n.e(600),n.e(1668),n.e(2676),n.e(1509),n.e(6869),n.e(9487),n.e(1783),n.e(9881),n.e(7324),n.e(9124),n.e(6712),n.e(6547),n.e(2033),n.e(7304),n.e(3817)]).then(n.bind(n,72337)).then(e=>e.DataBrowser),{loadableGenerated:{webpack:()=>[72337]},ssr:!1,loading:()=>(0,r.jsx)(o,{})});function i(){return(0,r.jsx)(a,{})}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=85972)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6142],{85972:function(e,t,n){Promise.resolve().then(n.bind(n,38299))},79205:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(2265);let l=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),u=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter((e,t,n)=>!!e&&n.indexOf(e)===t).join(" ")};var o={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let a=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:l=24,strokeWidth:a=2,absoluteStrokeWidth:i,className:s="",children:d,iconNode:c,...f}=e;return(0,r.createElement)("svg",{ref:t,...o,width:l,height:l,stroke:n,strokeWidth:i?24*Number(a)/Number(l):a,className:u("lucide",s),...f},[...c.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),i=(e,t)=>{let n=(0,r.forwardRef)((n,o)=>{let{className:i,...s}=n;return(0,r.createElement)(a,{ref:o,iconNode:t,className:u("lucide-".concat(l(e)),i),...s})});return n.displayName="".concat(e),n}},51817:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});let r=(0,n(79205).Z)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},30166:function(e,t,n){"use strict";n.d(t,{default:function(){return l.a}});var r=n(55775),l=n.n(r)},55775:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return u}});let r=n(47043);n(57437),n(2265);let l=r._(n(15602));function u(e,t){var n;let r={loading:e=>{let{error:t,isLoading:n,pastDelay:r}=e;return null}};"function"==typeof e&&(r.loader=e);let u={...r,...t};return(0,l.default)({...u,modules:null==(n=u.loadableGenerated)?void 0:n.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},81523:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return l}});let r=n(18993);function l(e){let{reason:t,children:n}=e;if("undefined"==typeof window)throw new r.BailoutToCSRError(t);return n}},15602:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return s}});let r=n(57437),l=n(2265),u=n(81523),o=n(70049);function a(e){return{default:e&&"default"in e?e.default:e}}let i={loader:()=>Promise.resolve(a(()=>null)),loading:null,ssr:!0},s=function(e){let t={...i,...e},n=(0,l.lazy)(()=>t.loader().then(a)),s=t.loading;function d(e){let a=s?(0,r.jsx)(s,{isLoading:!0,pastDelay:!0,error:null}):null,i=t.ssr?(0,r.jsxs)(r.Fragment,{children:["undefined"==typeof window?(0,r.jsx)(o.PreloadCss,{moduleIds:t.modules}):null,(0,r.jsx)(n,{...e})]}):(0,r.jsx)(u.BailoutToCSR,{reason:"next/dynamic",children:(0,r.jsx)(n,{...e})});return(0,r.jsx)(l.Suspense,{fallback:a,children:i})}return d.displayName="LoadableComponent",d}},70049:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadCss",{enumerable:!0,get:function(){return u}});let r=n(57437),l=n(20544);function u(e){let{moduleIds:t}=e;if("undefined"!=typeof window)return null;let n=(0,l.getExpectedRequestStore)("next/dynamic css"),u=[];if(n.reactLoadableManifest&&t){let e=n.reactLoadableManifest;for(let n of t){if(!e[n])continue;let t=e[n].files.filter(e=>e.endsWith(".css"));u.push(...t)}}return 0===u.length?null:(0,r.jsx)(r.Fragment,{children:u.map(e=>(0,r.jsx)("link",{precedence:"dynamic",rel:"stylesheet",href:n.assetPrefix+"/_next/"+encodeURI(e),as:"style"},e))})}},38299:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return i}});var r=n(57437);n(2265);var l=n(30166),u=n(51817);function o(){return(0,r.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,r.jsx)(u.Z,{className:"h-8 w-8 animate-spin"})})}let a=(0,l.default)(()=>Promise.all([n.e(7999),n.e(3572),n.e(7902),n.e(5094),n.e(4438),n.e(6530),n.e(4475),n.e(6241),n.e(926),n.e(600),n.e(1668),n.e(2676),n.e(1509),n.e(6869),n.e(9487),n.e(1783),n.e(9881),n.e(7324),n.e(9124),n.e(6712),n.e(2667),n.e(4033),n.e(7304),n.e(3817)]).then(n.bind(n,72337)).then(e=>e.DataBrowser),{loadableGenerated:{webpack:()=>[72337]},ssr:!1,loading:()=>(0,r.jsx)(o,{})});function i(){return(0,r.jsx)(a,{})}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=85972)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4850],{45330:function(e,s,t){Promise.resolve().then(t.bind(t,97015))},79205:function(e,s,t){"use strict";t.d(s,{Z:function(){return i}});var a=t(2265);let l=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),r=function(){for(var e=arguments.length,s=Array(e),t=0;t<e;t++)s[t]=arguments[t];return s.filter((e,s,t)=>!!e&&t.indexOf(e)===s).join(" ")};var n={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,a.forwardRef)((e,s)=>{let{color:t="currentColor",size:l=24,strokeWidth:c=2,absoluteStrokeWidth:i,className:o="",children:d,iconNode:u,...m}=e;return(0,a.createElement)("svg",{ref:s,...n,width:l,height:l,stroke:t,strokeWidth:i?24*Number(c)/Number(l):c,className:r("lucide",o),...m},[...u.map(e=>{let[s,t]=e;return(0,a.createElement)(s,t)}),...Array.isArray(d)?d:[d]])}),i=(e,s)=>{let t=(0,a.forwardRef)((t,n)=>{let{className:i,...o}=t;return(0,a.createElement)(c,{ref:n,iconNode:s,className:r("lucide-".concat(l(e)),i),...o})});return t.displayName="".concat(e),t}},51817:function(e,s,t){"use strict";t.d(s,{Z:function(){return a}});let a=(0,t(79205).Z)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},97015:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return _}});var a=t(57437),l=t(2265),r=t(72135),n=t(14438),c=t(12381),i=t(40279),o=t(69174),d=t(91032),u=t(75060),m=t(17168),h=t(53113);let x=(0,t(79205).Z)("FileVideo",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m10 11 5 3-5 3v-6Z",key:"7ntvm4"}]]);var f=t(48736),p=t(69658),j=t(42208),w=t(15868),g=t(92735),v=t(18930),N=t(17689),k=t(98335),y=t(32489),b=t(51817),C=t(71096),z=t.n(C),Z=t(72337);let F=e=>{if(0===e)return"0 B";let s=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,s)).toFixed(2))+" "+["B","KB","MB","GB"][s]},S=e=>(null==e?void 0:e.startsWith("image/"))||!1,A=e=>(null==e?void 0:e.startsWith("video/"))||!1,E=e=>S(e)?(0,a.jsx)(h.Z,{className:"h-4 w-4 text-blue-500"}):A(e)?(0,a.jsx)(x,{className:"h-4 w-4 text-purple-500"}):(null==e?void 0:e.includes("pdf"))||(null==e?void 0:e.includes("document"))?(0,a.jsx)(f.Z,{className:"h-4 w-4 text-orange-500"}):(0,a.jsx)(p.Z,{className:"h-4 w-4 text-gray-500"}),M=e=>{let{record:s,apiUrl:t,token:r,size:n="sm"}=e,[c,i]=(0,l.useState)(!1),o=S(s.type),d={sm:"h-8 w-8",md:"h-12 w-12",lg:"h-48 w-full max-w-md"};if(!o||c)return(0,a.jsx)("div",{className:"".concat(d[n]," flex items-center justify-center bg-muted rounded ").concat("lg"===n?"aspect-video":""),children:E(s.type)});let u="".concat(t,"/assets/").concat(s.id,"?access_token=").concat(r).concat("sm"===n?"&width=64&height=64&fit=contain":"md"===n?"&width=96&height=96&fit=contain":"");return(0,a.jsx)("img",{src:u,alt:s.title||"File thumbnail",className:"".concat(d[n]," object-contain rounded ").concat("lg"===n?"max-h-64":""),onError:()=>i(!0),loading:"lazy"})},R=()=>{let[e,s]=(0,l.useState)(!1),[t,n]=(0,l.useState)(0),i=(0,r.Ji)(),d=localStorage.getItem("token"),u=e=>{let s="".concat(i,"/assets/").concat(e.id,"?download=true&access_token=").concat(d);window.open(s,"_blank")},m=(0,a.jsx)(c.z,{size:"icon",onClick:()=>s(!0),title:"Upload File",children:(0,a.jsx)(N.Z,{className:"h-4 w-4"})});return(0,a.jsxs)("div",{className:"flex flex-col h-full overflow-hidden",children:[(0,a.jsx)(Z.DataBrowserInner,{selectedCollection:"baasix_File",title:"File Manager",enableSearch:!0,enableFilters:!0,enableCreate:!1,enableView:!0,enableFilePreview:!0,enableEdit:!0,enableDelete:!0,enableExport:!0,enableImport:!0,enableBulkSelect:!0,enableColumnSettings:!0,defaultSorters:[{field:"createdAt",order:"desc"}],defaultVisibleColumns:["title","type","size","createdAt"],headerActions:m,renderRowActions:e=>{let{record:s,onView:t,onEdit:l,onDelete:r}=e;return(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:t,title:"View",children:(0,a.jsx)(j.Z,{className:"h-4 w-4"})}),(0,a.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:l,title:"Edit",children:(0,a.jsx)(w.Z,{className:"h-4 w-4"})}),(0,a.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>u(s),title:"Download",children:(0,a.jsx)(g.Z,{className:"h-4 w-4"})}),(0,a.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",onClick:r,title:"Delete",children:(0,a.jsx)(v.Z,{className:"h-4 w-4"})})]})},customColumnRenderers:{title:(e,s)=>(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(M,{record:s,apiUrl:i,token:d,size:"sm"}),(0,a.jsx)("span",{className:"font-medium truncate max-w-xs",children:e})]}),type:e=>(0,a.jsx)(o.C,{variant:"secondary",className:"capitalize",children:e}),size:e=>(0,a.jsx)("span",{className:"text-muted-foreground",children:F(e||0)}),createdAt:e=>(0,a.jsx)("span",{className:"text-muted-foreground",children:e?z()(e).format("MMM D, YYYY h:mm A"):"-"})},onRefresh:()=>n(e=>e+1)},t),(0,a.jsx)(U,{open:e,onClose:()=>s(!1),onSuccess:()=>{n(e=>e+1),s(!1)}})]})},U=e=>{let{open:s,onClose:t,onSuccess:o}=e,[h,x]=(0,l.useState)("local"),[f,j]=(0,l.useState)([]),[w,g]=(0,l.useState)(""),[v,C]=(0,l.useState)(!1),z=(0,l.useRef)(null),{mutate:Z}=(0,r.RO)(),{mutate:S}=(0,r.uC)(),A=(0,l.useCallback)(e=>{e.preventDefault(),j(Array.from(e.dataTransfer.files))},[]),E=(0,l.useCallback)(e=>{e.preventDefault()},[]),M=e=>{j(f.filter((s,t)=>t!==e))},R=async()=>{C(!0);try{if("local"===h&&f.length>0){for(let e of f){let s=new FormData;s.append("file",e),await new Promise((t,a)=>{Z({resource:"files",values:s},{onSuccess:()=>{t()},onError:s=>{n.Am.error("Failed to upload ".concat(e.name,": ").concat(s.message)),a(s)}})})}n.Am.success("".concat(f.length," file(s) uploaded successfully")),j([]),o()}else"url"===h&&w&&S({url:"/files/upload-from-url",method:"post",values:{url:w}},{onSuccess:()=>{n.Am.success("File uploaded from URL successfully"),g(""),o()},onError:e=>{n.Am.error("Failed to upload from URL: ".concat(e.message))}})}catch(e){console.error("Upload error:",e)}finally{C(!1)}};return(0,a.jsx)(d.yo,{open:s,onOpenChange:e=>!e&&t(),children:(0,a.jsxs)(d.ue,{className:"w-[400px] sm:w-[450px]",children:[(0,a.jsx)(d.Tu,{children:(0,a.jsx)(d.bC,{children:"Upload Files"})}),(0,a.jsxs)("div",{className:"mt-6 space-y-6",children:[(0,a.jsxs)(m.mQ,{value:h,onValueChange:e=>x(e),children:[(0,a.jsxs)(m.dr,{className:"grid w-full grid-cols-2",children:[(0,a.jsxs)(m.SP,{value:"local",children:[(0,a.jsx)(N.Z,{className:"mr-2 h-4 w-4"}),"Local File"]}),(0,a.jsxs)(m.SP,{value:"url",children:[(0,a.jsx)(k.Z,{className:"mr-2 h-4 w-4"}),"From URL"]})]}),(0,a.jsxs)(m.nU,{value:"local",className:"mt-4 space-y-4",children:[(0,a.jsxs)("div",{className:"border-2 border-dashed rounded-lg p-8 text-center cursor-pointer hover:border-primary transition-colors",onClick:()=>{var e;return null===(e=z.current)||void 0===e?void 0:e.click()},onDrop:A,onDragOver:E,children:[(0,a.jsx)(N.Z,{className:"h-10 w-10 mx-auto mb-4 text-muted-foreground"}),(0,a.jsx)("p",{className:"text-sm font-medium",children:"Drag and drop files here"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"or click to browse"}),(0,a.jsx)("input",{ref:z,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&j(Array.from(e.target.files))}})]}),f.length>0&&(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(u._,{children:"Selected Files"}),(0,a.jsx)("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:f.map((e,s)=>(0,a.jsxs)("div",{className:"flex items-center justify-between p-2 bg-muted rounded",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 truncate",children:[(0,a.jsx)(p.Z,{className:"h-4 w-4 shrink-0"}),(0,a.jsx)("span",{className:"text-sm truncate",children:e.name}),(0,a.jsxs)("span",{className:"text-xs text-muted-foreground shrink-0",children:["(",F(e.size),")"]})]}),(0,a.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:()=>M(s),children:(0,a.jsx)(y.Z,{className:"h-3 w-3"})})]},s))})]})]}),(0,a.jsx)(m.nU,{value:"url",className:"mt-4 space-y-4",children:(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(u._,{htmlFor:"url",children:"File URL"}),(0,a.jsx)(i.I,{id:"url",placeholder:"https://example.com/file.pdf",value:w,onChange:e=>g(e.target.value)}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Enter the URL of the file you want to upload"})]})})]}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(c.z,{variant:"outline",onClick:t,children:"Cancel"}),(0,a.jsxs)(c.z,{onClick:R,disabled:v||"local"===h&&0===f.length||"url"===h&&!w,children:[v?(0,a.jsx)(b.Z,{className:"mr-2 h-4 w-4 animate-spin"}):(0,a.jsx)(N.Z,{className:"mr-2 h-4 w-4"}),"Upload"]})]})]})]})})};function _(){return(0,a.jsx)(R,{})}}},function(e){e.O(0,[7999,3572,7902,5094,4438,6530,6241,4475,926,600,1668,2676,1509,6869,9487,1783,9881,7324,9124,6712,6547,2033,7304,3817,2971,2117,1744],function(){return e(e.s=45330)}),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4850],{45330:function(e,s,t){Promise.resolve().then(t.bind(t,97015))},79205:function(e,s,t){"use strict";t.d(s,{Z:function(){return i}});var a=t(2265);let l=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),r=function(){for(var e=arguments.length,s=Array(e),t=0;t<e;t++)s[t]=arguments[t];return s.filter((e,s,t)=>!!e&&t.indexOf(e)===s).join(" ")};var n={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let c=(0,a.forwardRef)((e,s)=>{let{color:t="currentColor",size:l=24,strokeWidth:c=2,absoluteStrokeWidth:i,className:o="",children:d,iconNode:u,...m}=e;return(0,a.createElement)("svg",{ref:s,...n,width:l,height:l,stroke:t,strokeWidth:i?24*Number(c)/Number(l):c,className:r("lucide",o),...m},[...u.map(e=>{let[s,t]=e;return(0,a.createElement)(s,t)}),...Array.isArray(d)?d:[d]])}),i=(e,s)=>{let t=(0,a.forwardRef)((t,n)=>{let{className:i,...o}=t;return(0,a.createElement)(c,{ref:n,iconNode:s,className:r("lucide-".concat(l(e)),i),...o})});return t.displayName="".concat(e),t}},51817:function(e,s,t){"use strict";t.d(s,{Z:function(){return a}});let a=(0,t(79205).Z)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},97015:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return _}});var a=t(57437),l=t(2265),r=t(72135),n=t(14438),c=t(12381),i=t(40279),o=t(69174),d=t(91032),u=t(75060),m=t(17168),h=t(53113);let x=(0,t(79205).Z)("FileVideo",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m10 11 5 3-5 3v-6Z",key:"7ntvm4"}]]);var f=t(48736),p=t(69658),j=t(42208),w=t(15868),g=t(92735),v=t(18930),N=t(17689),k=t(98335),y=t(32489),b=t(51817),C=t(71096),z=t.n(C),Z=t(72337);let F=e=>{if(0===e)return"0 B";let s=Math.floor(Math.log(e)/Math.log(1024));return parseFloat((e/Math.pow(1024,s)).toFixed(2))+" "+["B","KB","MB","GB"][s]},S=e=>(null==e?void 0:e.startsWith("image/"))||!1,A=e=>(null==e?void 0:e.startsWith("video/"))||!1,E=e=>S(e)?(0,a.jsx)(h.Z,{className:"h-4 w-4 text-blue-500"}):A(e)?(0,a.jsx)(x,{className:"h-4 w-4 text-purple-500"}):(null==e?void 0:e.includes("pdf"))||(null==e?void 0:e.includes("document"))?(0,a.jsx)(f.Z,{className:"h-4 w-4 text-orange-500"}):(0,a.jsx)(p.Z,{className:"h-4 w-4 text-gray-500"}),M=e=>{let{record:s,apiUrl:t,token:r,size:n="sm"}=e,[c,i]=(0,l.useState)(!1),o=S(s.type),d={sm:"h-8 w-8",md:"h-12 w-12",lg:"h-48 w-full max-w-md"};if(!o||c)return(0,a.jsx)("div",{className:"".concat(d[n]," flex items-center justify-center bg-muted rounded ").concat("lg"===n?"aspect-video":""),children:E(s.type)});let u="".concat(t,"/assets/").concat(s.id,"?access_token=").concat(r).concat("sm"===n?"&width=64&height=64&fit=contain":"md"===n?"&width=96&height=96&fit=contain":"");return(0,a.jsx)("img",{src:u,alt:s.title||"File thumbnail",className:"".concat(d[n]," object-contain rounded ").concat("lg"===n?"max-h-64":""),onError:()=>i(!0),loading:"lazy"})},R=()=>{let[e,s]=(0,l.useState)(!1),[t,n]=(0,l.useState)(0),i=(0,r.Ji)(),d=localStorage.getItem("token"),u=e=>{let s="".concat(i,"/assets/").concat(e.id,"?download=true&access_token=").concat(d);window.open(s,"_blank")},m=(0,a.jsx)(c.z,{size:"icon",onClick:()=>s(!0),title:"Upload File",children:(0,a.jsx)(N.Z,{className:"h-4 w-4"})});return(0,a.jsxs)("div",{className:"flex flex-col h-full overflow-hidden",children:[(0,a.jsx)(Z.DataBrowserInner,{selectedCollection:"baasix_File",title:"File Manager",enableSearch:!0,enableFilters:!0,enableCreate:!1,enableView:!0,enableFilePreview:!0,enableEdit:!0,enableDelete:!0,enableExport:!0,enableImport:!0,enableBulkSelect:!0,enableColumnSettings:!0,defaultSorters:[{field:"createdAt",order:"desc"}],defaultVisibleColumns:["title","type","size","createdAt"],headerActions:m,renderRowActions:e=>{let{record:s,onView:t,onEdit:l,onDelete:r}=e;return(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:t,title:"View",children:(0,a.jsx)(j.Z,{className:"h-4 w-4"})}),(0,a.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:l,title:"Edit",children:(0,a.jsx)(w.Z,{className:"h-4 w-4"})}),(0,a.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>u(s),title:"Download",children:(0,a.jsx)(g.Z,{className:"h-4 w-4"})}),(0,a.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",onClick:r,title:"Delete",children:(0,a.jsx)(v.Z,{className:"h-4 w-4"})})]})},customColumnRenderers:{title:(e,s)=>(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(M,{record:s,apiUrl:i,token:d,size:"sm"}),(0,a.jsx)("span",{className:"font-medium truncate max-w-xs",children:e})]}),type:e=>(0,a.jsx)(o.C,{variant:"secondary",className:"capitalize",children:e}),size:e=>(0,a.jsx)("span",{className:"text-muted-foreground",children:F(e||0)}),createdAt:e=>(0,a.jsx)("span",{className:"text-muted-foreground",children:e?z()(e).format("MMM D, YYYY h:mm A"):"-"})},onRefresh:()=>n(e=>e+1)},t),(0,a.jsx)(U,{open:e,onClose:()=>s(!1),onSuccess:()=>{n(e=>e+1),s(!1)}})]})},U=e=>{let{open:s,onClose:t,onSuccess:o}=e,[h,x]=(0,l.useState)("local"),[f,j]=(0,l.useState)([]),[w,g]=(0,l.useState)(""),[v,C]=(0,l.useState)(!1),z=(0,l.useRef)(null),{mutate:Z}=(0,r.RO)(),{mutate:S}=(0,r.uC)(),A=(0,l.useCallback)(e=>{e.preventDefault(),j(Array.from(e.dataTransfer.files))},[]),E=(0,l.useCallback)(e=>{e.preventDefault()},[]),M=e=>{j(f.filter((s,t)=>t!==e))},R=async()=>{C(!0);try{if("local"===h&&f.length>0){for(let e of f){let s=new FormData;s.append("file",e),await new Promise((t,a)=>{Z({resource:"files",values:s},{onSuccess:()=>{t()},onError:s=>{n.Am.error("Failed to upload ".concat(e.name,": ").concat(s.message)),a(s)}})})}n.Am.success("".concat(f.length," file(s) uploaded successfully")),j([]),o()}else"url"===h&&w&&S({url:"/files/upload-from-url",method:"post",values:{url:w}},{onSuccess:()=>{n.Am.success("File uploaded from URL successfully"),g(""),o()},onError:e=>{n.Am.error("Failed to upload from URL: ".concat(e.message))}})}catch(e){console.error("Upload error:",e)}finally{C(!1)}};return(0,a.jsx)(d.yo,{open:s,onOpenChange:e=>!e&&t(),children:(0,a.jsxs)(d.ue,{className:"w-[400px] sm:w-[450px]",children:[(0,a.jsx)(d.Tu,{children:(0,a.jsx)(d.bC,{children:"Upload Files"})}),(0,a.jsxs)("div",{className:"mt-6 space-y-6",children:[(0,a.jsxs)(m.mQ,{value:h,onValueChange:e=>x(e),children:[(0,a.jsxs)(m.dr,{className:"grid w-full grid-cols-2",children:[(0,a.jsxs)(m.SP,{value:"local",children:[(0,a.jsx)(N.Z,{className:"mr-2 h-4 w-4"}),"Local File"]}),(0,a.jsxs)(m.SP,{value:"url",children:[(0,a.jsx)(k.Z,{className:"mr-2 h-4 w-4"}),"From URL"]})]}),(0,a.jsxs)(m.nU,{value:"local",className:"mt-4 space-y-4",children:[(0,a.jsxs)("div",{className:"border-2 border-dashed rounded-lg p-8 text-center cursor-pointer hover:border-primary transition-colors",onClick:()=>{var e;return null===(e=z.current)||void 0===e?void 0:e.click()},onDrop:A,onDragOver:E,children:[(0,a.jsx)(N.Z,{className:"h-10 w-10 mx-auto mb-4 text-muted-foreground"}),(0,a.jsx)("p",{className:"text-sm font-medium",children:"Drag and drop files here"}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"or click to browse"}),(0,a.jsx)("input",{ref:z,type:"file",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&j(Array.from(e.target.files))}})]}),f.length>0&&(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(u._,{children:"Selected Files"}),(0,a.jsx)("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:f.map((e,s)=>(0,a.jsxs)("div",{className:"flex items-center justify-between p-2 bg-muted rounded",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 truncate",children:[(0,a.jsx)(p.Z,{className:"h-4 w-4 shrink-0"}),(0,a.jsx)("span",{className:"text-sm truncate",children:e.name}),(0,a.jsxs)("span",{className:"text-xs text-muted-foreground shrink-0",children:["(",F(e.size),")"]})]}),(0,a.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:()=>M(s),children:(0,a.jsx)(y.Z,{className:"h-3 w-3"})})]},s))})]})]}),(0,a.jsx)(m.nU,{value:"url",className:"mt-4 space-y-4",children:(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(u._,{htmlFor:"url",children:"File URL"}),(0,a.jsx)(i.I,{id:"url",placeholder:"https://example.com/file.pdf",value:w,onChange:e=>g(e.target.value)}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"Enter the URL of the file you want to upload"})]})})]}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)(c.z,{variant:"outline",onClick:t,children:"Cancel"}),(0,a.jsxs)(c.z,{onClick:R,disabled:v||"local"===h&&0===f.length||"url"===h&&!w,children:[v?(0,a.jsx)(b.Z,{className:"mr-2 h-4 w-4 animate-spin"}):(0,a.jsx)(N.Z,{className:"mr-2 h-4 w-4"}),"Upload"]})]})]})]})})};function _(){return(0,a.jsx)(R,{})}}},function(e){e.O(0,[7999,3572,7902,5094,4438,6530,4475,6241,926,600,1668,2676,1509,6869,9487,1783,9881,7324,9124,6712,2667,4033,7304,3817,2971,2117,1744],function(){return e(e.s=45330)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2760],{24654:function(){},57166:function(e,t,r){Promise.resolve().then(r.bind(r,7915))},7915:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return en}});var s=r(57437),a=r(2265),n=r(72135),l=r(99376),i=r(12381),o=r(90641),d=r(96246),c=r(32060),u=r(71488),f=r(27648),m=r(45114),x=r(81853),p=r(25466),h=r(50091),g=r(95805),b=r(48736),y=r(13781),v=r(98728),j=r(65621),N=r(30755),w=r(54001),k=r(85929),P=r(97226),C=r(47692);let S=[{key:"dashboard",icon:p.Z,href:"/dashboard",label:"Dashboard"},{key:"data-browser",icon:h.Z,href:"/data-browser",label:"Data Browser"},{key:"users",icon:g.Z,href:"/users/list",label:"Users"},{key:"file-manager",icon:b.Z,href:"/file-manager",label:"File Manager"},{key:"workflows",icon:y.Z,href:"/workflows",label:"Workflows"},{key:"settings",icon:v.Z,href:"/settings/roles",label:"Settings"},{key:"activity-log",icon:j.Z,href:"/activity-log/all-activity",label:"Activity Log"}],D=e=>{var t,r,a,p,h,g;let{selectedMenu:b,setSelectedMenu:y,onToggleSidebarSheet:v,showSidebarToggle:j}=e,D=(0,l.useRouter)(),{data:R}=(0,n.kS)(),{mutate:E}=(0,n.aU)(),{setMode:z,mode:T}=(0,m.Fg)(),{projectSettings:A}=(0,x.PY)(),_=(0,n.Ji)(),M="".concat("/admin","/logo-icon.svg"),Z=(null==A?void 0:null===(t=A.branding)||void 0===t?void 0:t.icon)||(null==A?void 0:null===(r=A.branding)||void 0===r?void 0:r["logo-light"]),L=Z&&_&&"/"!==_?"".concat(_,"/assets/").concat(Z):_&&"/"!==_?"".concat(_,"/assets/project_icon"):M,F=(null==A?void 0:A.color)||"#663399",O=function(e){let t=e.replace("#",""),r=parseInt(t.substring(0,2),16);return(.299*r+.587*parseInt(t.substring(2,4),16)+.114*parseInt(t.substring(4,6),16))/255>.5}(F),V=O?"#1a1a2e":"#ffffff",I=O?"rgba(0, 0, 0, 0.1)":"rgba(255, 255, 255, 0.1)",Y=O?"rgba(0, 0, 0, 0.15)":"rgba(255, 255, 255, 0.2)",U=O?"rgba(0, 0, 0, 0.1)":"rgba(255, 255, 255, 0.1)";return(0,s.jsxs)("div",{className:"flex flex-col h-screen w-[60px] border-r fixed left-0 top-0 z-50",style:{backgroundColor:F,borderColor:U,color:V},children:[(0,s.jsx)("div",{className:"p-2 flex justify-center border-b",style:{borderColor:U},children:(0,s.jsx)(f.default,{href:"/",children:(0,s.jsx)("img",{alt:"logo",src:L,className:"w-10 h-10 object-contain",onError:e=>{e.target.src=M}})})}),j&&(0,s.jsx)("div",{className:"p-2 flex justify-center border-b md:hidden",style:{borderColor:U},children:(0,s.jsxs)(u.u,{children:[(0,s.jsx)(u.aJ,{asChild:!0,children:(0,s.jsx)(i.z,{variant:"ghost",size:"icon",className:"w-10 h-10",style:{color:V},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=I},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"},onClick:v,children:(0,s.jsx)(N.Z,{className:"h-5 w-5"})})}),(0,s.jsx)(u._v,{side:"right",children:(0,s.jsx)("p",{children:"Toggle Menu"})})]})}),(0,s.jsx)(o.x,{className:"flex-1 py-2",children:(0,s.jsx)("div",{className:"flex flex-col items-center gap-1",children:S.map(e=>(0,s.jsxs)(u.u,{children:[(0,s.jsx)(u.aJ,{asChild:!0,children:(0,s.jsx)(i.z,{variant:"ghost",size:"icon",className:"w-10 h-10",style:{color:V,backgroundColor:b===e.key?Y:"transparent"},onMouseEnter:t=>{b!==e.key&&(t.currentTarget.style.backgroundColor=I)},onMouseLeave:t=>{b!==e.key&&(t.currentTarget.style.backgroundColor="transparent")},onClick:()=>{y(e.key),D.push(e.href)},children:(0,s.jsx)(e.icon,{className:"h-5 w-5"})})}),(0,s.jsx)(u._v,{side:"right",children:(0,s.jsx)("p",{children:e.label})})]},e.key))})}),(0,s.jsx)("div",{className:"p-2 border-t flex justify-center",style:{borderColor:U},children:(0,s.jsxs)(c.h_,{children:[(0,s.jsx)(c.$F,{asChild:!0,children:(0,s.jsx)(i.z,{variant:"ghost",size:"icon",className:"rounded-full",style:{color:V},children:(0,s.jsxs)(d.qE,{className:"h-8 w-8",children:[(0,s.jsx)(d.F$,{src:null==R?void 0:R.avatar}),(0,s.jsxs)(d.Q5,{style:{backgroundColor:I,color:V},children:[null==R?void 0:null===(p=R.firstName)||void 0===p?void 0:null===(a=p.charAt(0))||void 0===a?void 0:a.toUpperCase(),null==R?void 0:null===(g=R.lastName)||void 0===g?void 0:null===(h=g.charAt(0))||void 0===h?void 0:h.toUpperCase()]})]})})}),(0,s.jsxs)(c.AW,{align:"end",side:"right",className:"w-56",children:[(0,s.jsx)(c.Ju,{children:(null==R?void 0:R.fullName)||"".concat((null==R?void 0:R.firstName)||""," ").concat((null==R?void 0:R.lastName)||"").trim()}),(0,s.jsx)(c.VD,{}),(0,s.jsx)(c.Xi,{asChild:!0,children:(0,s.jsxs)(f.default,{href:"/change-password",children:[(0,s.jsx)(w.Z,{className:"mr-2 h-4 w-4"}),"Change Password"]})}),(0,s.jsx)(c.Xi,{onClick:()=>z(),children:"dark"===T?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(k.Z,{className:"mr-2 h-4 w-4"}),"Light Mode"]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(P.Z,{className:"mr-2 h-4 w-4"}),"Dark Mode"]})}),(0,s.jsx)(c.VD,{}),(0,s.jsxs)(c.Xi,{onClick:()=>E(),children:[(0,s.jsx)(C.Z,{className:"mr-2 h-4 w-4"}),"Logout"]})]})]})})]})};var R=r(93448),E=r(40279),z=r(29696),T=r(73247);let A=e=>{let{selectedMenu:t,selectedSubMenu:r,onSelectSubMenu:n}=e,d=(0,l.useRouter)(),{schemas:c}=(0,z.I_)(),{isMultiTenant:u}=(0,x.PY)(),[f,m]=(0,a.useState)("");a.useEffect(()=>{m("")},[t]);let p=(0,a.useMemo)(()=>{let e=c||[],t=f.toLowerCase().trim();return e.filter(e=>{var t;return!(null===(t=e.collectionName)||void 0===t?void 0:t.startsWith("baasix_"))}).filter(e=>{var r,s,a;if(!t)return!0;let n=(null==e?void 0:null===(s=e.schema)||void 0===s?void 0:null===(r=s.name)||void 0===r?void 0:r.toLowerCase())||"",l=(null==e?void 0:null===(a=e.collectionName)||void 0===a?void 0:a.toLowerCase())||"";return n.includes(t)||l.includes(t)})},[c,f]),h=(e,r)=>{switch(n(e),t){case"data-browser":d.push("/data-browser/?collection=".concat(e,"&schema=").concat(encodeURIComponent(r||"")));break;case"users":d.push("/users/".concat(e,"/"));break;case"file-manager":d.push("/file-manager/".concat(e,"/"));break;case"settings":d.push("/settings/".concat(e,"/"));break;case"activity-log":d.push("/activity-log/".concat(e,"/"))}},g=e=>(0,s.jsx)(i.z,{variant:r===e.collectionName?"secondary":"ghost",className:(0,R.cn)("w-full justify-start text-sm",r===e.collectionName&&"bg-accent"),onClick:()=>{var t;return h(e.collectionName,null===(t=e.schema)||void 0===t?void 0:t.name)},children:e.collectionName},e.collectionName);return(0,s.jsx)("div",{className:"flex flex-col h-full w-full border-r bg-sidebar overflow-hidden",children:(()=>{switch(t){case"data-browser":return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"p-2 border-b",children:(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(T.Z,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),(0,s.jsx)(E.I,{placeholder:"Search collections...",value:f,onChange:e=>m(e.target.value),className:"pl-8"})]})}),(0,s.jsx)(o.x,{className:"flex-1",children:(0,s.jsx)("div",{className:"p-2 space-y-1",children:p.length>0?p.map(g):(0,s.jsx)("p",{className:"text-sm text-muted-foreground px-2 py-1",children:"No collections found"})})})]});case"users":return(0,s.jsx)(o.x,{className:"flex-1",children:(0,s.jsx)("div",{className:"p-2 space-y-1",children:[{key:"list",label:"Users List"},{key:"invites",label:"Invites"},{key:"user-roles",label:"User Roles"},{key:"preferences",label:"Preferences"}].map(e=>(0,s.jsx)(i.z,{variant:r===e.key?"secondary":"ghost",className:(0,R.cn)("w-full justify-start text-sm",r===e.key&&"bg-accent"),onClick:()=>h(e.key),children:e.label},e.key))})});case"settings":let e=[{key:"roles",label:"Roles"},{key:"permissions",label:"Permissions"},{key:"schema",label:"Collections"},{key:"tasks",label:"Tasks"},{key:"migrations",label:"Migrations"},{key:"schema-diff",label:"Schema Diff"},{key:"templates",label:"Email Templates"}];return u&&e.push({key:"tenants",label:"Tenants"}),e.push({key:"project",label:"Project Settings"}),(0,s.jsx)(o.x,{className:"flex-1",children:(0,s.jsx)("div",{className:"p-2 space-y-1",children:e.map(e=>(0,s.jsx)(i.z,{variant:r===e.key?"secondary":"ghost",className:(0,R.cn)("w-full justify-start text-sm",r===e.key&&"bg-accent"),onClick:()=>h(e.key),children:e.label},e.key))})});case"activity-log":return(0,s.jsx)(o.x,{className:"flex-1",children:(0,s.jsx)("div",{className:"p-2 space-y-1",children:[{key:"all-activity",label:"All Activity"},{key:"email-log",label:"Email Log"},{key:"notifications",label:"Notifications"},{key:"sessions",label:"Sessions"},{key:"workflow-executions",label:"Workflow Executions"},{key:"workflow-logs",label:"Workflow Logs"}].map(e=>(0,s.jsx)(i.z,{variant:r===e.key?"secondary":"ghost",className:(0,R.cn)("w-full justify-start text-sm",r===e.key&&"bg-accent"),onClick:()=>h(e.key),children:e.label},e.key))})});default:return null}})()})};var _=r(82809),M=r(91032);let Z=e=>{let{children:t}=e,r=(0,l.usePathname)(),n=(0,l.useSearchParams)(),[i,o]=(0,a.useState)("data-browser"),[d,c]=(0,a.useState)(""),[u,f]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e=r.split("/").filter(Boolean);if(e.length>0){if(o(e[0]),"data-browser"===e[0]){let e=n.get("collection");e?c(e):c("")}else e.length>1?c(e[1]):c("")}},[r,n]);let m=e=>{c(e),f(!1)},x=r.startsWith("/settings/templates/edit"),p="file-manager"!==i&&"dashboard"!==i&&"workflows"!==i&&"change-password"!==i&&!x;return(0,s.jsxs)("div",{className:"h-screen flex flex-col",children:[(0,s.jsx)(D,{selectedMenu:i,setSelectedMenu:e=>{o(e),c("")},onToggleSidebarSheet:()=>f(!0),showSidebarToggle:p}),(0,s.jsx)("div",{className:"ml-[60px] flex-1 flex flex-col overflow-hidden",children:p?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"hidden md:flex flex-1 overflow-hidden",children:(0,s.jsxs)(_.pO,{direction:"horizontal",className:"flex-1",children:[(0,s.jsx)(_.ee,{defaultSize:15,minSize:10,maxSize:25,className:"flex flex-col",children:(0,s.jsx)(A,{selectedMenu:i,selectedSubMenu:d,onSelectSubMenu:m})}),(0,s.jsx)(_.Dp,{withHandle:!0}),(0,s.jsx)(_.ee,{defaultSize:85,className:"flex flex-col",children:(0,s.jsx)("main",{className:"p-4 flex-1 overflow-hidden flex flex-col",children:t})})]})}),(0,s.jsx)(M.yo,{open:u,onOpenChange:f,children:(0,s.jsxs)(M.ue,{side:"left",className:"w-[280px] p-0 left-[60px]",children:[(0,s.jsx)(M.bC,{className:"sr-only",children:"Navigation Menu"}),(0,s.jsx)(A,{selectedMenu:i,selectedSubMenu:d,onSelectSubMenu:m})]})}),(0,s.jsx)("main",{className:"p-4 flex-1 overflow-hidden flex flex-col md:hidden",children:t})]}):(0,s.jsx)("main",{className:"p-4 flex-1 overflow-hidden flex flex-col",children:t})})]})};var L=r(63751);let F=String.fromCharCode(104,116,116,112,115,58,47,47,119,119,119,46,98,97,97,115,105,120,46,99,111,109,47,97,112,105,47,118,101,114,105,102,121,45,108,105,99,101,110,115,101),O=(0,a.createContext)({status:"loading",subscriptionData:null,error:null,isLoading:!0,isValid:!1,refetch:async()=>{}}),V=()=>a.useContext(O)||(console.warn("useSubscription used outside of SubscriptionProvider, using defaults"),{status:"loading",subscriptionData:null,error:null,isLoading:!0,isValid:!1,refetch:async()=>{}}),I=e=>{let{children:t}=e,[r,n]=(0,a.useState)("loading"),[l,i]=(0,a.useState)(null),[o,d]=(0,a.useState)(null),c=(0,a.useCallback)(async()=>{var e,t,r,s,a;let l=window.location.hostname;"localhost"===l||"127.0.0.1"===l||"0.0.0.0"===l||l.endsWith(".local")||l.endsWith(".localhost"),n("loading"),d(null);try{let r=new AbortController,s=setTimeout(()=>r.abort(),15e3),a=await fetch(F,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:l}),signal:r.signal});if(clearTimeout(s),!a.ok){let e="Failed to verify subscription";try{e=(await a.json()).error||e}catch(e){}n("error"),d({type:"unknown",message:"Subscription verification failed",details:"Server responded with status ".concat(a.status,": ").concat(e)}),i(null);return}let o=await a.json();if(o.subscribed)n("valid"),i({subscribed:!0,domain:o.domain,plan:o.plan,expiresAt:o.expiresAt,inGracePeriod:o.inGracePeriod,gracePeriodDaysRemaining:o.gracePeriodDaysRemaining,message:o.message}),d(null);else{n("invalid"),i({subscribed:!1,domain:o.domain,plan:o.plan,expiresAt:o.expiresAt,message:o.message});let r="not_found";((null===(e=o.message)||void 0===e?void 0:e.toLowerCase().includes("expired"))||(null===(t=o.message)||void 0===t?void 0:t.toLowerCase().includes("grace period ended")))&&(r="expired"),d({type:r,message:o.message||"No active subscription found for this domain"})}}catch(e){n("error"),"AbortError"===e.name?d({type:"network",message:"Connection timed out",details:"The subscription verification request took too long to complete. Please check your internet connection and try again."}):(null===(r=e.message)||void 0===r?void 0:r.includes("Failed to fetch"))||(null===(s=e.message)||void 0===s?void 0:s.includes("NetworkError"))||(null===(a=e.message)||void 0===a?void 0:a.includes("Network request failed"))?d({type:"network",message:"Network error",details:"Unable to connect to the Baasix license server. Please check your internet connection and try again."}):d({type:"unknown",message:"Verification failed",details:e.message||"An unexpected error occurred while verifying the subscription."}),i(null)}},[]);return(0,a.useEffect)(()=>{c()},[c]),(0,s.jsx)(O.Provider,{value:{status:r,subscriptionData:l,error:o,isLoading:"loading"===r,isValid:"valid"===r,refetch:c},children:t})};var Y=r(75395),U=r(49322),q=r(91723),W=r(83578),B=r(99388),$=r(82431),G=r(96362);function J(e){let{status:t,error:r,subscriptionData:n,onRetry:l}=e,[i,o]=a.useState(!1),d=async()=>{o(!0),await l(),o(!1)};return(0,s.jsx)("div",{className:"min-h-screen bg-gradient-to-br from-slate-900 via-slate-800 to-slate-900 flex items-center justify-center p-4",children:(0,s.jsxs)("div",{className:"max-w-md w-full",children:[(0,s.jsxs)("div",{className:"bg-white dark:bg-slate-800 rounded-2xl shadow-2xl overflow-hidden",children:[(0,s.jsxs)("div",{className:"bg-gradient-to-r from-indigo-600 to-blue-600 px-6 py-8 text-center",children:[(0,s.jsx)("div",{className:"inline-flex items-center justify-center w-20 h-20 bg-white/20 rounded-full mb-4",children:(()=>{if("error"===t)return(null==r?void 0:r.type)==="network"?(0,s.jsx)(Y.Z,{className:"h-16 w-16 text-orange-500"}):(0,s.jsx)(U.Z,{className:"h-16 w-16 text-red-500"});switch(null==r?void 0:r.type){case"expired":return(0,s.jsx)(q.Z,{className:"h-16 w-16 text-amber-500"});case"not_found":return(0,s.jsx)(W.Z,{className:"h-16 w-16 text-red-500"});default:return(0,s.jsx)(B.Z,{className:"h-16 w-16 text-red-500"})}})()}),(0,s.jsx)("h1",{className:"text-2xl font-bold text-white",children:(()=>{if("error"===t)return(null==r?void 0:r.type)==="network"?"Connection Error":"Verification Error";switch(null==r?void 0:r.type){case"expired":return"Subscription Expired";case"not_found":return"No Active Subscription";default:return"Subscription Required"}})()})]}),(0,s.jsxs)("div",{className:"px-6 py-8",children:[(0,s.jsx)("p",{className:"text-slate-600 dark:text-slate-300 text-center mb-6",children:"error"===t&&(null==r?void 0:r.type)==="network"?"We couldn't connect to the Baasix license server to verify your subscription.":(null==r?void 0:r.type)==="expired"?"Your Baasix subscription has expired. Please renew to continue using the admin panel.":"A valid Baasix subscription is required to use this admin panel."}),r&&(0,s.jsxs)("div",{className:"bg-slate-100 dark:bg-slate-700/50 rounded-lg p-4 mb-6",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-slate-700 dark:text-slate-300 mb-2",children:"Error Details"}),(0,s.jsx)("p",{className:"text-sm text-slate-600 dark:text-slate-400",children:r.message}),r.details&&(0,s.jsx)("p",{className:"text-xs text-slate-500 dark:text-slate-500 mt-2",children:r.details})]}),(null==n?void 0:n.domain)&&(0,s.jsxs)("div",{className:"bg-slate-100 dark:bg-slate-700/50 rounded-lg p-4 mb-6",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)("span",{className:"text-sm text-slate-500 dark:text-slate-400",children:"Domain"}),(0,s.jsx)("span",{className:"text-sm font-mono text-slate-700 dark:text-slate-300",children:n.domain})]}),n.plan&&(0,s.jsxs)("div",{className:"flex justify-between items-center mt-2",children:[(0,s.jsx)("span",{className:"text-sm text-slate-500 dark:text-slate-400",children:"Previous Plan"}),(0,s.jsx)("span",{className:"text-sm font-medium text-slate-700 dark:text-slate-300 capitalize",children:n.plan})]}),n.expiresAt&&(0,s.jsxs)("div",{className:"flex justify-between items-center mt-2",children:[(0,s.jsx)("span",{className:"text-sm text-slate-500 dark:text-slate-400",children:"Expired On"}),(0,s.jsx)("span",{className:"text-sm text-slate-700 dark:text-slate-300",children:new Date(n.expiresAt).toLocaleDateString()})]})]}),(0,s.jsxs)("div",{className:"space-y-3",children:["error"===t&&(0,s.jsxs)("button",{onClick:d,disabled:i,className:"w-full flex items-center justify-center gap-2 bg-slate-100 dark:bg-slate-700 hover:bg-slate-200 dark:hover:bg-slate-600 text-slate-700 dark:text-slate-300 font-medium py-3 px-4 rounded-lg transition-colors disabled:opacity-50",children:[(0,s.jsx)($.Z,{className:"h-4 w-4 ".concat(i?"animate-spin":"")}),i?"Retrying...":"Try Again"]}),(0,s.jsxs)("a",{href:"https://www.baasix.com/#pricing",target:"_blank",rel:"noopener noreferrer",className:"w-full flex items-center justify-center gap-2 bg-gradient-to-r from-indigo-600 to-blue-600 hover:from-indigo-700 hover:to-blue-700 text-white font-medium py-3 px-4 rounded-lg transition-all shadow-lg shadow-indigo-500/25",children:[(null==r?void 0:r.type)==="expired"?"Renew Subscription":"Get Subscription",(0,s.jsx)(G.Z,{className:"h-4 w-4"})]}),(0,s.jsxs)("a",{href:"https://www.baasix.com",target:"_blank",rel:"noopener noreferrer",className:"w-full flex items-center justify-center gap-2 text-slate-500 dark:text-slate-400 hover:text-slate-700 dark:hover:text-slate-300 font-medium py-2 px-4 rounded-lg transition-colors",children:["Visit baasix.com",(0,s.jsx)(G.Z,{className:"h-4 w-4"})]})]})]}),(0,s.jsx)("div",{className:"bg-slate-50 dark:bg-slate-900/50 px-6 py-4 text-center border-t border-slate-200 dark:border-slate-700",children:(0,s.jsxs)("p",{className:"text-xs text-slate-500 dark:text-slate-400",children:["Need help?"," ",(0,s.jsx)("a",{href:"mailto:support@baasix.com",className:"text-indigo-600 dark:text-indigo-400 hover:underline",children:"Contact support"})]})})]}),(0,s.jsx)("div",{className:"mt-6 text-center",children:(0,s.jsxs)("p",{className:"text-slate-400 text-sm",children:["Starting at just"," ",(0,s.jsx)("span",{className:"text-white font-semibold",children:"$9.99/year"})," per domain"]})})]})})}var X=r(76865),H=r(30767);function Q(e){if(!e)return null;let t=new Date(e),r=new Date;return Math.ceil((t.getTime()-r.getTime())/864e5)}function K(){let e=new Date().toISOString().split("T")[0];return"".concat("baasix_subscription_warning_dismissed","_").concat(e)}function ee(e){let{subscriptionData:t}=e,[r,n]=(0,a.useState)(!1),[l,i]=(0,a.useState)(null);(0,a.useEffect)(()=>{if(!t||"development"===t.plan||"lifetime"===t.plan)return;let e=K();if("true"===sessionStorage.getItem(e))return;if(t.inGracePeriod){i("grace"),n(!0);return}let r=Q(t.expiresAt);null!==r&&r<=14&&(i("expiring"),n(!0))},[t]);let o=()=>{let e=K();sessionStorage.setItem(e,"true"),n(!1)};if(!t||!l)return null;let d=Q(t.expiresAt),c=t.gracePeriodDaysRemaining;return(0,s.jsx)(H.aR,{open:r,onOpenChange:n,children:(0,s.jsxs)(H._T,{className:"max-w-md",children:[(0,s.jsx)(H.fY,{children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:["grace"===l?(0,s.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30",children:(0,s.jsx)(X.Z,{className:"h-5 w-5 text-red-600 dark:text-red-400"})}):(0,s.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-amber-100 dark:bg-amber-900/30",children:(0,s.jsx)(q.Z,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"})}),(0,s.jsx)(H.f$,{className:"text-left",children:"grace"===l?"Subscription Expired - Grace Period ends in "+(c?" ".concat(c," ").concat(1===c?"day":"days"):""):"Subscription Expiring On"+(t.expiresAt?" ".concat(new Date(t.expiresAt).toLocaleDateString()):"")})]})}),(0,s.jsxs)("div",{className:"space-y-4 text-sm text-muted-foreground",children:["grace"===l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("p",{children:["Your Baasix subscription has expired. You are currently in the"," ",(0,s.jsx)("strong",{children:"grace period"}),"."]}),(0,s.jsxs)("div",{className:"rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 p-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-sm text-red-700 dark:text-red-300",children:"Grace period remaining"}),(0,s.jsxs)("span",{className:"text-lg font-bold text-red-600 dark:text-red-400",children:[c," ",1===c?"day":"days"]})]}),(0,s.jsx)("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:"After the grace period ends, you will lose access to the admin panel."})]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{children:"Your Baasix subscription will expire soon. Renew now to avoid any interruption in service."}),(0,s.jsxs)("div",{className:"rounded-lg bg-amber-50 dark:bg-amber-900/20 border border-amber-200 dark:border-amber-800 p-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-sm text-amber-700 dark:text-amber-300",children:"Days until expiry"}),(0,s.jsxs)("span",{className:"text-lg font-bold text-amber-600 dark:text-amber-400",children:[d," ",1===d?"day":"days"]})]}),t.expiresAt&&(0,s.jsxs)("p",{className:"mt-2 text-xs text-amber-600 dark:text-amber-400",children:["Expires on"," ",new Date(t.expiresAt).toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"})]})]})]}),(0,s.jsxs)("div",{className:"text-xs text-muted-foreground",children:["Domain: ",(0,s.jsx)("span",{className:"font-mono",children:t.domain})]})]}),(0,s.jsxs)(H.xo,{className:"flex-col sm:flex-row gap-2",children:[(0,s.jsx)(H.le,{onClick:o,className:"sm:order-1",children:"Remind Me Later"}),(0,s.jsxs)(H.OL,{onClick:()=>{window.open("https://www.baasix.com/#pricing","_blank"),o()},className:"grace"===l?"bg-red-600 hover:bg-red-700 sm:order-2":"bg-amber-600 hover:bg-amber-700 sm:order-2",children:["Renew Now",(0,s.jsx)(G.Z,{className:"ml-2 h-4 w-4"})]})]})]})})}function et(e){let{children:t}=e,{status:r,error:a,subscriptionData:n,isLoading:l,refetch:i}=V();return l?(0,s.jsx)("div",{className:"flex h-screen w-screen items-center justify-center bg-background",children:(0,s.jsxs)("div",{className:"text-center",children:[(0,s.jsx)("div",{className:"h-8 w-8 mx-auto animate-spin rounded-full border-4 border-primary border-t-transparent"}),(0,s.jsx)("p",{className:"mt-4 text-muted-foreground",children:"Verifying setup..."})]})}):"invalid"===r||"error"===r?(0,s.jsx)(J,{status:r,error:a,subscriptionData:n,onRetry:i}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ee,{subscriptionData:n}),t]})}function er(e){let{children:t}=e;return(0,s.jsx)(I,{children:(0,s.jsx)(et,{children:t})})}function es(){return(0,s.jsx)("div",{className:"flex h-screen w-screen items-center justify-center",children:(0,s.jsx)("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}function ea(e){let{children:t}=e,r=(0,l.useRouter)(),{data:i,isLoading:o}=(0,n.kq)();return((0,a.useEffect)(()=>{o||(null==i?void 0:i.authenticated)!==!1||r.replace("/login")},[o,i,r]),!o&&(null==i?void 0:i.authenticated))?(0,s.jsx)(er,{children:(0,s.jsx)(z.A1,{children:(0,s.jsx)(L.CE,{children:(0,s.jsx)(Z,{children:t})})})}):(0,s.jsx)(es,{})}function en(e){let{children:t}=e;return(0,s.jsx)(a.Suspense,{fallback:(0,s.jsx)(es,{}),children:(0,s.jsx)(ea,{children:t})})}},30767:function(e,t,r){"use strict";r.d(t,{OL:function(){return g},_T:function(){return f},aR:function(){return o},f$:function(){return p},fY:function(){return m},le:function(){return b},vW:function(){return d},xo:function(){return x},yT:function(){return h}});var s=r(57437),a=r(2265),n=r(16720),l=r(93448),i=r(12381);let o=n.fC,d=n.xz,c=n.h_,u=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.aV,{className:(0,l.cn)("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...a,ref:t})});u.displayName="AlertDialogOverlay";let f=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsxs)(c,{children:[(0,s.jsx)(u,{}),(0,s.jsx)(n.VY,{ref:t,className:(0,l.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg",r),...a})]})});f.displayName="AlertDialogContent";let m=e=>{let{className:t,...r}=e;return(0,s.jsx)("div",{className:(0,l.cn)("flex flex-col space-y-2 text-center sm:text-left",t),...r})};m.displayName="AlertDialogHeader";let x=e=>{let{className:t,...r}=e;return(0,s.jsx)("div",{className:(0,l.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r})};x.displayName="AlertDialogFooter";let p=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.Dx,{ref:t,className:(0,l.cn)("text-lg font-semibold",r),...a})});p.displayName="AlertDialogTitle";let h=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.dk,{ref:t,className:(0,l.cn)("text-sm text-muted-foreground",r),...a})});h.displayName="AlertDialogDescription";let g=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.aU,{ref:t,className:(0,l.cn)((0,i.d)(),r),...a})});g.displayName="AlertDialogAction";let b=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.$j,{ref:t,className:(0,l.cn)((0,i.d)({variant:"outline"}),"mt-2 sm:mt-0",r),...a})});b.displayName="AlertDialogCancel"},96246:function(e,t,r){"use strict";r.d(t,{F$:function(){return o},Q5:function(){return d},qE:function(){return i}});var s=r(57437),a=r(2265),n=r(27954),l=r(93448);let i=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.fC,{ref:t,className:(0,l.cn)("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",r),...a})});i.displayName=n.fC.displayName;let o=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.Ee,{ref:t,className:(0,l.cn)("aspect-square h-full w-full",r),...a})});o.displayName=n.Ee.displayName;let d=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.NY,{ref:t,className:(0,l.cn)("flex h-full w-full items-center justify-center rounded-full bg-muted",r),...a})});d.displayName=n.NY.displayName},12381:function(e,t,r){"use strict";r.d(t,{d:function(){return o},z:function(){return d}});var s=r(57437),a=r(2265),n=r(37053),l=r(90535),i=r(93448);let o=(0,l.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),d=a.forwardRef((e,t)=>{let{className:r,variant:a,size:l,asChild:d=!1,...c}=e,u=d?n.g7:"button";return(0,s.jsx)(u,{className:(0,i.cn)(o({variant:a,size:l,className:r})),ref:t,...c})});d.displayName="Button"},32060:function(e,t,r){"use strict";r.d(t,{$F:function(){return u},AW:function(){return f},Ju:function(){return x},VD:function(){return p},Xi:function(){return m},h_:function(){return c}});var s=r(57437),a=r(2265),n=r(28119),l=r(10407),i=r(30401),o=r(40519),d=r(93448);let c=n.fC,u=n.xz;n.ZA,n.Uv,n.Tr,n.Ee,a.forwardRef((e,t)=>{let{className:r,inset:a,children:i,...o}=e;return(0,s.jsxs)(n.fF,{ref:t,className:(0,d.cn)("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",a&&"pl-8",r),...o,children:[i,(0,s.jsx)(l.Z,{className:"ml-auto h-4 w-4"})]})}).displayName=n.fF.displayName,a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.tu,{ref:t,className:(0,d.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r),...a})}).displayName=n.tu.displayName;let f=a.forwardRef((e,t)=>{let{className:r,sideOffset:a=4,...l}=e;return(0,s.jsx)(n.Uv,{children:(0,s.jsx)(n.VY,{ref:t,sideOffset:a,className:(0,d.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r),...l})})});f.displayName=n.VY.displayName;let m=a.forwardRef((e,t)=>{let{className:r,inset:a,...l}=e;return(0,s.jsx)(n.ck,{ref:t,className:(0,d.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a&&"pl-8",r),...l})});m.displayName=n.ck.displayName,a.forwardRef((e,t)=>{let{className:r,children:a,checked:l,...o}=e;return(0,s.jsxs)(n.oC,{ref:t,className:(0,d.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),checked:l,...o,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(n.wU,{children:(0,s.jsx)(i.Z,{className:"h-4 w-4"})})}),a]})}).displayName=n.oC.displayName,a.forwardRef((e,t)=>{let{className:r,children:a,...l}=e;return(0,s.jsxs)(n.Rk,{ref:t,className:(0,d.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),...l,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(n.wU,{children:(0,s.jsx)(o.Z,{className:"h-2 w-2 fill-current"})})}),a]})}).displayName=n.Rk.displayName;let x=a.forwardRef((e,t)=>{let{className:r,inset:a,...l}=e;return(0,s.jsx)(n.__,{ref:t,className:(0,d.cn)("px-2 py-1.5 text-sm font-semibold",a&&"pl-8",r),...l})});x.displayName=n.__.displayName;let p=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.Z0,{ref:t,className:(0,d.cn)("-mx-1 my-1 h-px bg-muted",r),...a})});p.displayName=n.Z0.displayName},40279:function(e,t,r){"use strict";r.d(t,{I:function(){return l}});var s=r(57437),a=r(2265),n=r(93448);let l=a.forwardRef((e,t)=>{let{className:r,type:a,...l}=e;return(0,s.jsx)("input",{type:a,className:(0,n.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),ref:t,...l})});l.displayName="Input"},82809:function(e,t,r){"use strict";r.d(t,{Dp:function(){return d},ee:function(){return o},pO:function(){return i}});var s=r(57437),a=r(41905),n=r(23374),l=r(93448);let i=e=>{let{className:t,...r}=e;return(0,s.jsx)(n.eh,{className:(0,l.cn)("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",t),...r})},o=n.s_,d=e=>{let{withHandle:t,className:r,...i}=e;return(0,s.jsx)(n.OT,{className:(0,l.cn)("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",r),...i,children:t&&(0,s.jsx)("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:(0,s.jsx)(a.Z,{className:"h-2.5 w-2.5"})})})}},90641:function(e,t,r){"use strict";r.d(t,{x:function(){return i}});var s=r(57437),a=r(2265),n=r(43643),l=r(93448);let i=a.forwardRef((e,t)=>{let{className:r,children:a,...i}=e;return(0,s.jsxs)(n.fC,{ref:t,className:(0,l.cn)("relative overflow-hidden",r),...i,children:[(0,s.jsx)(n.l_,{className:"h-full w-full rounded-[inherit]",children:a}),(0,s.jsx)(o,{}),(0,s.jsx)(n.Ns,{})]})});i.displayName=n.fC.displayName;let o=a.forwardRef((e,t)=>{let{className:r,orientation:a="vertical",...i}=e;return(0,s.jsx)(n.gb,{ref:t,orientation:a,className:(0,l.cn)("flex touch-none select-none transition-colors","vertical"===a&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===a&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",r),...i,children:(0,s.jsx)(n.q4,{className:"relative flex-1 rounded-full bg-border"})})});o.displayName=n.gb.displayName},91032:function(e,t,r){"use strict";r.d(t,{Ei:function(){return b},FF:function(){return h},Tu:function(){return p},bC:function(){return g},sw:function(){return c},ue:function(){return x},yo:function(){return d}});var s=r(57437),a=r(2265),n=r(70001),l=r(90535),i=r(32489),o=r(93448);let d=n.fC;n.xz;let c=n.x8,u=n.h_,f=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.aV,{className:(0,o.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...a,ref:t})});f.displayName=n.aV.displayName;let m=(0,l.j)("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out overflow-hidden",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-full sm:w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-full sm:w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right"}},defaultVariants:{side:"right"}}),x=a.forwardRef((e,t)=>{let{side:r="right",className:a,children:l,hideDefaultClose:d=!1,...c}=e;return(0,s.jsxs)(u,{children:[(0,s.jsx)(f,{}),(0,s.jsxs)(n.VY,{ref:t,className:(0,o.cn)(m({side:r}),a),...c,children:[!d&&(0,s.jsxs)(n.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[(0,s.jsx)(i.Z,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"sr-only",children:"Close"})]}),l]})]})});x.displayName=n.VY.displayName;let p=e=>{let{className:t,...r}=e;return(0,s.jsx)("div",{className:(0,o.cn)("flex flex-col space-y-2 text-center sm:text-left",t),...r})};p.displayName="SheetHeader";let h=e=>{let{className:t,...r}=e;return(0,s.jsx)("div",{className:(0,o.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r})};h.displayName="SheetFooter";let g=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.Dx,{ref:t,className:(0,o.cn)("text-lg font-semibold text-foreground",r),...a})});g.displayName=n.Dx.displayName;let b=a.forwardRef((e,t)=>{let{className:r,...a}=e;return(0,s.jsx)(n.dk,{ref:t,className:(0,o.cn)("text-sm text-muted-foreground",r),...a})});b.displayName=n.dk.displayName},71488:function(e,t,r){"use strict";r.d(t,{_v:function(){return c},aJ:function(){return d},pn:function(){return i},u:function(){return o}});var s=r(57437),a=r(2265),n=r(91668),l=r(93448);let i=n.zt,o=n.fC,d=n.xz,c=a.forwardRef((e,t)=>{let{className:r,sideOffset:a=4,...i}=e;return(0,s.jsx)(n.VY,{ref:t,sideOffset:a,className:(0,l.cn)("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r),...i})});c.displayName=n.VY.displayName},93448:function(e,t,r){"use strict";r.d(t,{cn:function(){return n}});var s=r(61994),a=r(53335);function n(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,a.m6)((0,s.W)(t))}},63751:function(e,t,r){"use strict";r.d(t,{CE:function(){return d},Gn:function(){return o}});var s=r(57437),a=r(2265),n=r(72135),l=r(14438);let i=(0,a.createContext)(void 0),o=()=>{let e=(0,a.useContext)(i);if(!e)throw Error("usePreferences must be used within a PreferencesProvider");return e};function d(e){var t;let{children:r}=e,[o,d]=(0,a.useState)([]),[c,u]=(0,a.useState)(!1),{data:f}=(0,n.kS)(),m=(null==f?void 0:f.id)||(null==f?void 0:null===(t=f.user)||void 0===t?void 0:t.id)||null,{data:x,isLoading:p,refetch:h}=(0,n.sm)({resource:"baasix_UserPreference",queryOptions:{enabled:!!m},filters:m?[{field:"userId",operator:"eq",value:m}]:[],pagination:{pageSize:-1,mode:"off"}}),{mutate:g}=(0,n.RO)({resource:"baasix_UserPreference"}),{mutate:b}=(0,n.PQ)({resource:"baasix_UserPreference"});(0,a.useEffect)(()=>{(null==x?void 0:x.data)?(d(x.data),u(!0)):m&&!p&&(d([]),u(!0))},[x,m,p]);let y=(0,a.useMemo)(()=>{let e={};return o.forEach(t=>{t.isDefault&&(e[t.collectionName]||(e[t.collectionName]={}),e[t.collectionName][t.preferenceType]=t)}),e},[o]),v=(0,a.useCallback)((e,t)=>{var r;return(null===(r=y[e])||void 0===r?void 0:r[t])||null},[y]),j=(0,a.useCallback)(async(e,t,r)=>{if(!m){console.warn("No user ID available for saving preferences");return}let s=v(e,t),a={userId:m,collectionName:e,preferenceType:t,preferenceData:r,isDefault:!0};try{(null==s?void 0:s.id)?await new Promise((e,t)=>{b({id:s.id,values:a,successNotification:!1},{onSuccess:()=>{h(),e()},onError:e=>{console.error("Error updating preference:",e),t(e)}})}):await new Promise((e,t)=>{g({values:a,successNotification:!1},{onSuccess:()=>{h(),e()},onError:e=>{console.error("Error creating preference:",e),t(e)}})})}catch(e){throw l.Am.error("Failed to save preferences"),e}},[m,v,g,b,h]),N=(0,a.useCallback)(e=>{var t;let r=null===(t=y[e])||void 0===t?void 0:t.columns;return r?r.preferenceData:null},[y]),w=(0,a.useCallback)(async(e,t)=>{await j(e,"columns",t)},[j]),k=(0,a.useCallback)(e=>{var t;let r=null===(t=y[e])||void 0===t?void 0:t.filters;return r?r.preferenceData:null},[y]),P=(0,a.useCallback)(async(e,t)=>{await j(e,"filters",t)},[j]),C=(0,a.useCallback)(e=>{var t;let r=null===(t=y[e])||void 0===t?void 0:t.sorting;return r?r.preferenceData:null},[y]),S=(0,a.useCallback)(async(e,t)=>{await j(e,"sorting",t)},[j]),D=(0,a.useCallback)(e=>{var t;let r=null===(t=y[e])||void 0===t?void 0:t.pagination;return r?r.preferenceData:null},[y]),R=(0,a.useCallback)(async(e,t)=>{await j(e,"pagination",t)},[j]);return(0,s.jsx)(i.Provider,{value:{getColumnPreferences:N,saveColumnPreferences:w,getFilterPreferences:k,saveFilterPreferences:P,getSortingPreferences:C,saveSortingPreferences:S,getPaginationPreferences:D,savePaginationPreferences:R,isLoading:p,isInitialized:c,refetchPreferences:h},children:r})}},81853:function(e,t,r){"use strict";r.d(t,{Ml:function(){return i},PY:function(){return l}});var s=r(57437),a=r(2265);let n=(0,a.createContext)({projectSettings:null,isMultiTenant:!1,isLoading:!0,refetch:()=>{}}),l=()=>a.useContext(n)||(console.warn("useProject used outside of ProjectContextProvider, using defaults"),{projectSettings:null,isMultiTenant:!1,isLoading:!1,refetch:()=>{}}),i=e=>{let{children:t,baasixClient:r}=e,[l,i]=(0,a.useState)(null),[o,d]=(0,a.useState)(!0),c=(0,a.useCallback)(async()=>{try{d(!0);let e=await r.server.info();i(null==e?void 0:e.project)}catch(e){console.error("Failed to fetch project settings",e)}finally{d(!1)}},[r]);(0,a.useEffect)(()=>{c()},[c]);let u=(null==l?void 0:l.multitenant)===!0||(null==l?void 0:l.multitenant)==="true";return(0,s.jsx)(n.Provider,{value:{projectSettings:l,isMultiTenant:u,isLoading:o,refetch:c},children:t})}},29696:function(e,t,r){"use strict";r.d(t,{A1:function(){return o},I_:function(){return i}});var s=r(57437),a=r(2265),n=r(72135);let l=(0,a.createContext)(void 0),i=()=>{let e=(0,a.useContext)(l);if(!e)throw Error("useSchema must be used within a SchemaProvider");return e};function o(e){let{children:t}=e,{data:r,isLoading:a,refetch:i}=(0,n.sm)({resource:"collections",queryOptions:{enabled:!0},sorters:[{field:"collectionName",order:"asc"}],pagination:{pageSize:500}}),o=(null==r?void 0:r.data)||[],d=e=>o.find(t=>t.collectionName===e),c=e=>{let t=d(e),r=null==t?void 0:t.schema.fields;if(r){let t={...r};for(let[e,r]of Object.entries(t))r.hidden&&delete t[e];return"baasix_Account"===e&&(delete t.password,delete t.accessToken,delete t.refreshToken,delete t.idToken),"baasix_Verification"===e&&delete t.value,"baasix_Sessions"===e&&delete t.token,t}return r},u=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(0===r)return[];let a=c(e);return a?Object.entries(a).map(e=>{let[a,n]=e,l=t?"".concat(t,".").concat(a):a,i=s?{title:n.relType?l+".*":l,value:n.relType?l+".*":l,key:n.relType?l+".*":l,isLeaf:!n.relType}:{title:l,value:l,key:l,isLeaf:!n.relType};return n.relType&&n.target&&(i.children=u(n.target,l,r-1,s)),i}):[]};return(0,s.jsx)(l.Provider,{value:{schemas:o,isLoading:a,refetch:i,getSchemaByName:d,getFieldsByCollection:c,getCollectionChoices:()=>o.map(e=>({label:e.schema.name,value:e.collectionName})),getTargetFields:e=>{let t=c(e);return t?Object.entries(t).map(e=>{let[t]=e;return{label:t,value:t}}):[]},formatRelationshipDisplay:(e,t)=>e&&t?null==t?void 0:t.split(",").map(t=>{let r=t.trim();return e[r]||r}).join(""):"",getNestedFields:e=>u(e),getPermissionFields:e=>[{title:"*",value:"*",key:"*",isLeaf:!0},...u(e,"",6,!0),{title:"*.*",value:"*.*",key:"*.*",isLeaf:!0},{title:"*.*.*",value:"*.*.*",key:"*.*.*",isLeaf:!0},{title:"*.*.*.*",value:"*.*.*.*",key:"*.*.*.*",isLeaf:!0}],isSortEnabled:e=>{var t;let r=d(e);return(null==r?void 0:null===(t=r.schema)||void 0===t?void 0:t.sortEnabled)===!0}},children:t})}},45114:function(e,t,r){"use strict";r.d(t,{Fg:function(){return o},ze:function(){return f}});var s=r(57437),a=r(2265),n=r(25922),l=r(81853);let i=(0,a.createContext)({}),o=()=>{let e=a.useContext(i);if(!e)throw Error("useTheme must be used within a ThemeContextProvider");return e};function d(e,t,r){return"".concat(e," ").concat(t,"% ").concat(r,"%")}function c(e,t,r){return Math.min(Math.max(e,t),r)}let u=e=>{let{children:t,defaultMode:r="dark"}=e,{setTheme:o,resolvedTheme:u}=(0,n.F)(),{projectSettings:f}=(0,l.PY)(),[m,x]=(0,a.useState)(!1);return((0,a.useEffect)(()=>{x(!0)},[]),(0,a.useEffect)(()=>{m&&(null==f?void 0:f.color)&&function(e,t){let r=function(e){if(6!==(e=e.replace(/^#/,"")).length)return null;let t=parseInt(e.substring(0,2),16)/255,r=parseInt(e.substring(2,4),16)/255,s=parseInt(e.substring(4,6),16)/255,a=Math.max(t,r,s),n=Math.min(t,r,s),l=0,i=0,o=(a+n)/2;if(a!==n){let e=a-n;switch(i=o>.5?e/(2-a-n):e/(a+n),a){case t:l=((r-s)/e+(r<s?6:0))/6;break;case r:l=((s-t)/e+2)/6;break;case s:l=((t-r)/e+4)/6}}return{h:Math.round(360*l),s:Math.round(100*i),l:Math.round(100*o)}}(e);if(!r)return;let s=document.documentElement,{h:a,s:n,l}=r,i=d(a,n,l);s.style.setProperty("--primary",i);let o=l>50?d(a,c(n-10,0,100),10):d(a,c(n-10,0,100),98);if(s.style.setProperty("--primary-foreground",o),s.style.setProperty("--ring",i),t){let e=d(a,c(n-20,10,40),c(l-5,15,25));s.style.setProperty("--accent",e),s.style.setProperty("--accent-foreground",d(a,c(n-30,0,30),95));let t=d(a,c(n-25,5,35),c(l-10,15,22));s.style.setProperty("--muted",t),s.style.setProperty("--muted-foreground",d(a,c(n-30,5,25),65)),s.style.setProperty("--secondary",d(a,c(n-20,10,35),c(l-8,15,22))),s.style.setProperty("--secondary-foreground",d(a,c(n-30,0,30),95)),s.style.setProperty("--border",d(a,c(n-25,5,35),c(l-10,18,28))),s.style.setProperty("--input",d(a,c(n-25,5,35),c(l-10,18,28))),s.style.setProperty("--sidebar-background",d(a,c(n-30,5,20),8)),s.style.setProperty("--sidebar-foreground",d(a,c(n-30,5,20),92)),s.style.setProperty("--sidebar-primary",i),s.style.setProperty("--sidebar-primary-foreground",o),s.style.setProperty("--sidebar-accent",d(a,c(n-25,5,25),15)),s.style.setProperty("--sidebar-accent-foreground",d(a,c(n-30,5,20),92)),s.style.setProperty("--sidebar-border",d(a,c(n-30,5,20),15)),s.style.setProperty("--sidebar-ring",i),s.style.setProperty("--chart-1",d(a,70,50)),s.style.setProperty("--chart-2",d((a+60)%360,60,45)),s.style.setProperty("--chart-3",d((a+120)%360,80,55)),s.style.setProperty("--chart-4",d((a+180)%360,65,60)),s.style.setProperty("--chart-5",d((a+240)%360,75,55))}else{let e=d(a,c(n-10,20,50),c(l+30,90,97));s.style.setProperty("--accent",e),s.style.setProperty("--accent-foreground",d(a,c(n,30,60),15));let t=d(a,c(n-20,10,45),c(l+35,94,98));s.style.setProperty("--muted",t),s.style.setProperty("--muted-foreground",d(a,c(n-20,10,30),45)),s.style.setProperty("--secondary",d(a,c(n-15,15,45),c(l+32,92,97))),s.style.setProperty("--secondary-foreground",d(a,c(n,30,60),15)),s.style.setProperty("--border",d(a,c(n-20,10,35),88)),s.style.setProperty("--input",d(a,c(n-20,10,35),88)),s.style.setProperty("--sidebar-background",d(a,c(n-25,5,25),97)),s.style.setProperty("--sidebar-foreground",d(a,c(n-20,10,30),25)),s.style.setProperty("--sidebar-primary",i),s.style.setProperty("--sidebar-primary-foreground",o),s.style.setProperty("--sidebar-accent",d(a,c(n-15,10,40),93)),s.style.setProperty("--sidebar-accent-foreground",d(a,c(n-20,10,30),20)),s.style.setProperty("--sidebar-border",d(a,c(n-25,5,25),90)),s.style.setProperty("--sidebar-ring",i),s.style.setProperty("--chart-1",d(a,76,61)),s.style.setProperty("--chart-2",d((a+60)%360,58,39)),s.style.setProperty("--chart-3",d((a+120)%360,37,24)),s.style.setProperty("--chart-4",d((a+180)%360,74,66)),s.style.setProperty("--chart-5",d((a+240)%360,87,67))}}(f.color,"dark"===u)},[m,null==f?void 0:f.color,u]),m)?(0,s.jsx)(i.Provider,{value:{setMode:()=>{o("light"===u?"dark":"light")},mode:u||r,primaryColor:(null==f?void 0:f.color)||"#644152"},children:t}):null},f=e=>{let{children:t,defaultMode:r="dark"}=e;return(0,s.jsx)(n.f,{attribute:"class",defaultTheme:r,enableSystem:!0,children:(0,s.jsx)(u,{defaultMode:r,children:t})})}}},function(e){e.O(0,[7999,5094,4438,6530,4475,6241,926,600,1668,9124,3563,8473,478,6599,2971,2117,1744],function(){return e(e.s=57166)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3753],{55203:function(e,s,a){Promise.resolve().then(a.bind(a,36818))},36818:function(e,s,a){"use strict";a.r(s),a.d(s,{default:function(){return F}});var t=a(57437),l=a(2265),r=a(72135),n=a(14438),i=a(79820),c=a(12381),d=a(69174),o=a(40279),m=a(43368),x=a(75060),u=a(23675),h=a(17168),j=a(90641),f=a(69140),p=a(33804),g=a(30767),N=a(74291),v=a(15291),b=a(92934),w=a(91723),y=a(51817),k=a(99388),C=a(69076),Z=a(76865),S=a(16066),M=a(49322),A=a(50091),R=a(71947),_=a(82431),z=a(99397),O=a(33276),D=a(10866),T=a(65621),V=a(22135),E=a(40875),L=a(7598),B=a(27107);let U=e=>{let{status:s}=e,a={completed:{variant:"default",icon:(0,t.jsx)(b.Z,{className:"h-3 w-3 mr-1"}),label:"Completed"},pending:{variant:"secondary",icon:(0,t.jsx)(w.Z,{className:"h-3 w-3 mr-1"}),label:"Pending"},running:{variant:"outline",icon:(0,t.jsx)(y.Z,{className:"h-3 w-3 mr-1 animate-spin"}),label:"Running"},failed:{variant:"destructive",icon:(0,t.jsx)(k.Z,{className:"h-3 w-3 mr-1"}),label:"Failed"},rolled_back:{variant:"outline",icon:(0,t.jsx)(C.Z,{className:"h-3 w-3 mr-1"}),label:"Rolled Back"},skipped:{variant:"secondary",icon:(0,t.jsx)(Z.Z,{className:"h-3 w-3 mr-1"}),label:"Skipped"}}[s]||{variant:"secondary",icon:null,label:s};return(0,t.jsxs)(d.C,{variant:a.variant,className:"flex items-center",children:[a.icon,a.label]})},Y=e=>{let{type:s}=e,a={upgrade:{color:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",icon:(0,t.jsx)(S.Z,{className:"h-3 w-3 mr-1"})},hotfix:{color:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",icon:(0,t.jsx)(M.Z,{className:"h-3 w-3 mr-1"})},rollback:{color:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",icon:(0,t.jsx)(C.Z,{className:"h-3 w-3 mr-1"})},data:{color:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",icon:(0,t.jsx)(A.Z,{className:"h-3 w-3 mr-1"})},schema:{color:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",icon:(0,t.jsx)(R.Z,{className:"h-3 w-3 mr-1"})}}[s]||{color:"bg-gray-100 text-gray-800",icon:null};return(0,t.jsxs)(d.C,{variant:"outline",className:"flex items-center ".concat(a.color),children:[a.icon,s]})},P=()=>{var e,s,a;let k=(0,r.Ji)(),[S,M]=(0,l.useState)("status"),[R,P]=(0,l.useState)(""),[F,Q]=(0,l.useState)([]),[H,$]=(0,l.useState)(new Set),[q,I]=(0,l.useState)(!1),[W,G]=(0,l.useState)(!1),[J,K]=(0,l.useState)(!1),[X,ee]=(0,l.useState)(!1),[es,ea]=(0,l.useState)(!1),[et,el]=(0,l.useState)(null),[er,en]=(0,l.useState)({name:"",description:"",type:"upgrade"}),{data:ei,isLoading:ec,refetch:ed}=(0,r.EV)({url:"".concat(k,"/migrations/status"),method:"get",queryOptions:{refetchInterval:5e3}}),{data:eo,isLoading:em,refetch:ex}=(0,r.EV)({url:"".concat(k,"/migrations"),method:"get"}),{data:eu,isLoading:eh,refetch:ej}=(0,r.EV)({url:"".concat(k,"/migrations/pending"),method:"get"}),{mutate:ef,isLoading:ep}=(0,r.uC)(),{mutate:eg,isLoading:eN}=(0,r.uC)(),{mutate:ev,isLoading:eb}=(0,r.uC)(),{mutate:ew,isLoading:ey}=(0,r.uC)(),{mutate:ek,isLoading:eC}=(0,r.uC)(),{mutate:eZ,isLoading:eS}=(0,r.uC)(),eM=null==ei?void 0:null===(e=ei.data)||void 0===e?void 0:e.data,eA=(null==eo?void 0:null===(s=eo.data)||void 0===s?void 0:s.data)||[],eR=(null==eu?void 0:null===(a=eu.data)||void 0===a?void 0:a.data)||[],e_=(0,l.useMemo)(()=>{if(!R.trim())return eA;let e=R.toLowerCase();return eA.filter(s=>{var a;return s.version.toLowerCase().includes(e)||s.name.toLowerCase().includes(e)||(null===(a=s.description)||void 0===a?void 0:a.toLowerCase().includes(e))})},[eA,R]),ez=()=>{ed(),ex(),ej()},eO=e=>{eg({url:"".concat(k,"/migrations/rollback/").concat(encodeURIComponent(e)),method:"post",values:{}},{onSuccess:()=>{n.Am.success("Successfully rolled back migration ".concat(e)),G(!1),el(null),ez()},onError:e=>{n.Am.error("Failed to rollback: ".concat(e.message))}})},eD=e=>{eZ({url:"".concat(k,"/migrations/rollback-batch"),method:"post",values:{batch:e}},{onSuccess:s=>{var a,t;let l=null==s?void 0:null===(a=s.data)||void 0===a?void 0:a.data;n.Am.success("Successfully rolled back ".concat((null==l?void 0:null===(t=l.rolledBack)||void 0===t?void 0:t.length)||0," migration(s) from batch ").concat(e)),ez()},onError:e=>{n.Am.error("Failed to rollback batch: ".concat(e.message))}})},eT=e=>{ev({url:"".concat(k,"/migrations/mark-completed/").concat(encodeURIComponent(e)),method:"post",values:{}},{onSuccess:()=>{n.Am.success("Marked migration ".concat(e," as completed")),K(!1),ez()},onError:e=>{n.Am.error("Failed to mark as completed: ".concat(e.message))}})},eV=e=>{$(s=>{let a=new Set(s);return a.has(e)?a.delete(e):a.add(e),a})},eE=e=>{el(e),ea(!0)};return ec?(0,t.jsxs)("div",{className:"flex flex-col h-full overflow-hidden gap-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(f.O,{className:"h-8 w-48"}),(0,t.jsx)(f.O,{className:"h-10 w-32"})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[1,2,3,4].map(e=>(0,t.jsx)(f.O,{className:"h-24"},e))}),(0,t.jsx)(f.O,{className:"h-96"})]}):(0,t.jsxs)("div",{className:"flex flex-col h-full overflow-hidden gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-2 flex-shrink-0",children:[(0,t.jsx)("h1",{className:"text-lg font-semibold",children:"Database Migrations"}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(c.z,{variant:"outline",size:"icon",onClick:ez,children:(0,t.jsx)(_.Z,{className:"h-4 w-4"})}),(0,t.jsxs)(c.z,{variant:"outline",onClick:()=>ee(!0),children:[(0,t.jsx)(z.Z,{className:"mr-2 h-4 w-4"}),"Create Migration"]}),(0,t.jsxs)(c.z,{onClick:()=>I(!0),disabled:!eR.length||ep,children:[ep?(0,t.jsx)(y.Z,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(O.Z,{className:"mr-2 h-4 w-4"}),"Run Migrations"]})]})]}),(null==eM?void 0:eM.isSequelizeUpgrade)&&(0,t.jsx)(i.Zb,{className:"border-amber-500 bg-amber-50 dark:bg-amber-950",children:(0,t.jsx)(i.aY,{className:"py-4",children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(Z.Z,{className:"h-5 w-5 text-amber-600"}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-medium text-amber-800 dark:text-amber-200",children:"Sequelize to Drizzle Upgrade Detected"}),(0,t.jsx)("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:"Your database appears to be from an older Sequelize-based version. Please run the pending migrations to complete the upgrade."})]})]})})}),(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 flex-shrink-0",children:[(0,t.jsx)(i.Zb,{children:(0,t.jsxs)(i.Ol,{className:"pb-2",children:[(0,t.jsx)(i.SZ,{children:"Current Version"}),(0,t.jsx)(i.ll,{className:"text-2xl font-mono",children:(null==eM?void 0:eM.currentVersion)||"No migrations"})]})}),(0,t.jsx)(i.Zb,{children:(0,t.jsxs)(i.Ol,{className:"pb-2",children:[(0,t.jsx)(i.SZ,{children:"Applied Migrations"}),(0,t.jsx)(i.ll,{className:"text-2xl",children:(null==eM?void 0:eM.appliedCount)||0})]})}),(0,t.jsx)(i.Zb,{className:(null==eM?void 0:eM.pendingCount)?"border-amber-500":"",children:(0,t.jsxs)(i.Ol,{className:"pb-2",children:[(0,t.jsx)(i.SZ,{children:"Pending Migrations"}),(0,t.jsxs)(i.ll,{className:"text-2xl flex items-center gap-2",children:[(null==eM?void 0:eM.pendingCount)||0,(null==eM?void 0:eM.pendingCount)?(0,t.jsx)(Z.Z,{className:"h-5 w-5 text-amber-500"}):(0,t.jsx)(b.Z,{className:"h-5 w-5 text-green-500"})]})]})}),(0,t.jsx)(i.Zb,{children:(0,t.jsxs)(i.Ol,{className:"pb-2",children:[(0,t.jsx)(i.SZ,{children:"Last Batch"}),(0,t.jsxs)(i.ll,{className:"text-2xl",children:["#",(null==eM?void 0:eM.lastBatch)||0]})]})})]}),(0,t.jsxs)(h.mQ,{value:S,onValueChange:M,className:"flex-1 flex flex-col min-h-0",children:[(0,t.jsxs)(h.dr,{className:"grid w-full max-w-md grid-cols-3",children:[(0,t.jsxs)(h.SP,{value:"status",children:[(0,t.jsx)(D.Z,{className:"h-4 w-4 mr-2"}),"Status"]}),(0,t.jsxs)(h.SP,{value:"pending",children:[(0,t.jsx)(w.Z,{className:"h-4 w-4 mr-2"}),"Pending (",eR.length,")"]}),(0,t.jsxs)(h.SP,{value:"history",children:[(0,t.jsx)(T.Z,{className:"h-4 w-4 mr-2"}),"History"]})]}),(0,t.jsx)(h.nU,{value:"status",className:"flex-1 overflow-hidden",children:(0,t.jsxs)(i.Zb,{className:"h-full",children:[(0,t.jsxs)(i.Ol,{children:[(0,t.jsx)(i.ll,{children:"Migration Status"}),(0,t.jsx)(i.SZ,{children:"Overview of your database migration state"})]}),(0,t.jsxs)(i.aY,{className:"space-y-6",children:[(null==eM?void 0:eM.lastMigration)&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Last Applied Migration"}),(0,t.jsx)(i.Zb,{children:(0,t.jsx)(i.aY,{className:"py-4",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-mono font-medium",children:eM.lastMigration.version}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:eM.lastMigration.name})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(U,{status:eM.lastMigration.status}),eM.lastMigration.executedAt&&(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:(0,L.Q)(new Date(eM.lastMigration.executedAt),{addSuffix:!0})})]})]})})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"Quick Actions"}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxs)(c.z,{variant:"outline",onClick:()=>I(!0),disabled:!eR.length,children:[(0,t.jsx)(O.Z,{className:"h-4 w-4 mr-2"}),"Run All Pending"]}),(0,t.jsxs)(c.z,{variant:"outline",onClick:()=>{ew({url:"".concat(k,"/migrations/mark-all-completed"),method:"post",values:{}},{onSuccess:e=>{var s,a;let t=(null==e?void 0:null===(a=e.data)||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.markedCount)||0;n.Am.success("Marked ".concat(t," migration(s) as completed")),ez()},onError:e=>{n.Am.error("Failed to mark all as completed: ".concat(e.message))}})},disabled:ey||!eR.length,children:[ey?(0,t.jsx)(y.Z,{className:"h-4 w-4 mr-2 animate-spin"}):(0,t.jsx)(b.Z,{className:"h-4 w-4 mr-2"}),"Mark All as Completed"]}),(null==eM?void 0:eM.lastBatch)&&eM.lastBatch>0&&(0,t.jsxs)(c.z,{variant:"outline",onClick:()=>eD(eM.lastBatch),disabled:eS,children:[eS?(0,t.jsx)(y.Z,{className:"h-4 w-4 mr-2 animate-spin"}):(0,t.jsx)(C.Z,{className:"h-4 w-4 mr-2"}),"Rollback Batch #",eM.lastBatch]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-muted-foreground",children:"System Information"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Total Migrations:"}),(0,t.jsx)("span",{className:"ml-2 font-medium",children:(null==eM?void 0:eM.totalMigrations)||0})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"Status:"}),(0,t.jsx)("span",{className:"ml-2",children:(null==eM?void 0:eM.isUpToDate)?(0,t.jsxs)(d.C,{variant:"default",children:[(0,t.jsx)(b.Z,{className:"h-3 w-3 mr-1"}),"Up to Date"]}):(0,t.jsxs)(d.C,{variant:"secondary",children:[(0,t.jsx)(Z.Z,{className:"h-3 w-3 mr-1"}),"Updates Available"]})})]})]})]})]})]})}),(0,t.jsx)(h.nU,{value:"pending",className:"flex-1 overflow-hidden",children:(0,t.jsxs)(i.Zb,{className:"h-full flex flex-col",children:[(0,t.jsxs)(i.Ol,{children:[(0,t.jsx)(i.ll,{children:"Pending Migrations"}),(0,t.jsx)(i.SZ,{children:"Migrations waiting to be applied"})]}),(0,t.jsx)(i.aY,{className:"flex-1 overflow-hidden",children:eh?(0,t.jsx)("div",{className:"space-y-2",children:[1,2,3].map(e=>(0,t.jsx)(f.O,{className:"h-16"},e))}):0===eR.length?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground",children:[(0,t.jsx)(b.Z,{className:"h-12 w-12 mb-4 text-green-500"}),(0,t.jsx)("p",{className:"text-lg font-medium",children:"All migrations are up to date!"}),(0,t.jsx)("p",{className:"text-sm",children:"No pending migrations to run."})]}):(0,t.jsx)(j.x,{className:"h-full",children:(0,t.jsx)("div",{className:"space-y-2",children:eR.map((e,s)=>(0,t.jsx)(i.Zb,{children:(0,t.jsx)(i.aY,{className:"py-4",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsxs)("span",{className:"text-muted-foreground w-6",children:[s+1,"."]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"font-mono font-medium",children:e.version}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e.name}),e.description&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:e.description})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(Y,{type:e.type}),e.canRollback&&(0,t.jsx)(d.C,{variant:"outline",className:"text-xs",children:"Reversible"}),(0,t.jsx)(c.z,{size:"sm",variant:"outline",onClick:()=>eT(e.version),children:"Mark Done"})]})]})})},e.version))})})})]})}),(0,t.jsx)(h.nU,{value:"history",className:"flex-1 overflow-hidden",children:(0,t.jsxs)(i.Zb,{className:"h-full flex flex-col",children:[(0,t.jsx)(i.Ol,{className:"flex-shrink-0",children:(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(i.ll,{children:"Migration History"}),(0,t.jsx)(i.SZ,{children:"All applied migrations"})]}),(0,t.jsx)(m.t,{value:R,onChange:P,placeholder:"Search migrations...",expandedWidth:"w-64"})]})}),(0,t.jsx)(i.aY,{className:"flex-1 overflow-hidden p-0",children:em?(0,t.jsx)("div",{className:"p-6 space-y-2",children:[1,2,3,4,5].map(e=>(0,t.jsx)(f.O,{className:"h-12"},e))}):0===e_.length?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground",children:[(0,t.jsx)(A.Z,{className:"h-12 w-12 mb-4"}),(0,t.jsx)("p",{className:"text-lg font-medium",children:"No migrations found"}),(0,t.jsx)("p",{className:"text-sm",children:R?"Try a different search term":"No migrations have been run yet"})]}):(0,t.jsx)(j.x,{className:"h-full",children:(0,t.jsxs)(p.iA,{children:[(0,t.jsx)(p.xD,{className:"sticky top-0 bg-background",children:(0,t.jsxs)(p.SC,{children:[(0,t.jsx)(p.ss,{className:"w-8"}),(0,t.jsx)(p.ss,{children:"Version"}),(0,t.jsx)(p.ss,{children:"Name"}),(0,t.jsx)(p.ss,{children:"Type"}),(0,t.jsx)(p.ss,{children:"Status"}),(0,t.jsx)(p.ss,{children:"Batch"}),(0,t.jsx)(p.ss,{children:"Executed"}),(0,t.jsx)(p.ss,{children:"Duration"}),(0,t.jsx)(p.ss,{className:"w-24",children:"Actions"})]})}),(0,t.jsx)(p.RM,{children:e_.map(e=>(0,t.jsxs)(l.Fragment,{children:[(0,t.jsxs)(p.SC,{className:"failed"===e.status?"bg-red-50 dark:bg-red-950":"",children:[(0,t.jsx)(p.pj,{children:(e.errorMessage||e.description)&&(0,t.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>eV(e.id),children:H.has(e.id)?(0,t.jsx)(V.Z,{className:"h-4 w-4"}):(0,t.jsx)(E.Z,{className:"h-4 w-4"})})}),(0,t.jsx)(p.pj,{className:"font-mono text-sm",children:e.version}),(0,t.jsx)(p.pj,{children:e.name}),(0,t.jsx)(p.pj,{children:(0,t.jsx)(Y,{type:e.type})}),(0,t.jsx)(p.pj,{children:(0,t.jsx)(U,{status:e.status})}),(0,t.jsxs)(p.pj,{children:["#",e.batch||"-"]}),(0,t.jsx)(p.pj,{children:e.executedAt?(0,B.WU)(new Date(e.executedAt),"MMM d, yyyy HH:mm"):"-"}),(0,t.jsx)(p.pj,{children:e.executionTimeMs?"".concat(e.executionTimeMs,"ms"):"-"}),(0,t.jsx)(p.pj,{children:(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>eE(e),children:(0,t.jsx)(D.Z,{className:"h-4 w-4"})}),e.canRollback&&"completed"===e.status&&(0,t.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{el(e),G(!0)},children:(0,t.jsx)(C.Z,{className:"h-4 w-4"})})]})})]}),H.has(e.id)&&(0,t.jsx)(p.SC,{children:(0,t.jsxs)(p.pj,{colSpan:9,className:"bg-muted/50 p-4",children:[e.description&&(0,t.jsxs)("p",{className:"text-sm mb-2",children:[(0,t.jsx)("strong",{children:"Description:"})," ",e.description]}),e.errorMessage&&(0,t.jsxs)("div",{className:"text-sm text-red-600 dark:text-red-400",children:[(0,t.jsx)("strong",{children:"Error:"}),(0,t.jsx)("pre",{className:"mt-1 p-2 bg-red-100 dark:bg-red-900 rounded text-xs overflow-x-auto",children:e.errorMessage}),e.errorStack&&(0,t.jsxs)("details",{className:"mt-2",children:[(0,t.jsx)("summary",{className:"cursor-pointer text-xs",children:"Stack trace"}),(0,t.jsx)("pre",{className:"mt-1 p-2 bg-red-100 dark:bg-red-900 rounded text-xs overflow-x-auto",children:e.errorStack})]})]})]})})]},e.id))})]})})})]})})]}),(0,t.jsx)(g.aR,{open:q,onOpenChange:I,children:(0,t.jsxs)(g._T,{children:[(0,t.jsxs)(g.fY,{children:[(0,t.jsx)(g.f$,{children:"Run Pending Migrations?"}),(0,t.jsxs)(g.yT,{children:["This will execute ",eR.length," pending migration(s). Make sure you have a database backup before proceeding."]})]}),(0,t.jsx)("div",{className:"max-h-48 overflow-y-auto my-4",children:(0,t.jsx)("div",{className:"space-y-2",children:eR.map(e=>(0,t.jsxs)("div",{className:"text-sm p-2 bg-muted rounded flex items-center justify-between",children:[(0,t.jsx)("span",{className:"font-mono",children:e.version}),(0,t.jsx)(Y,{type:e.type})]},e.version))})}),(0,t.jsxs)(g.xo,{children:[(0,t.jsx)(g.le,{children:"Cancel"}),(0,t.jsxs)(g.OL,{onClick:()=>{ef({url:"".concat(k,"/migrations/run"),method:"post",values:{}},{onSuccess:e=>{var s,a,t;let l=null==e?void 0:null===(s=e.data)||void 0===s?void 0:s.data;(null==l?void 0:null===(a=l.applied)||void 0===a?void 0:a.length)>0?n.Am.success("Successfully ran ".concat(l.applied.length," migration(s)")):n.Am.info("No pending migrations to run"),(null==l?void 0:null===(t=l.failed)||void 0===t?void 0:t.length)>0&&n.Am.error("".concat(l.failed.length," migration(s) failed")),I(!1),ez()},onError:e=>{n.Am.error("Failed to run migrations: ".concat(e.message))}})},disabled:ep,className:"bg-primary",children:[ep?(0,t.jsx)(y.Z,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(O.Z,{className:"mr-2 h-4 w-4"}),"Run Migrations"]})]})]})}),(0,t.jsx)(g.aR,{open:W,onOpenChange:G,children:(0,t.jsxs)(g._T,{children:[(0,t.jsxs)(g.fY,{children:[(0,t.jsx)(g.f$,{children:"Rollback Migration?"}),(0,t.jsxs)(g.yT,{children:["This will rollback migration"," ",(0,t.jsx)("span",{className:"font-mono font-medium",children:null==et?void 0:et.version}),". This action may cause data loss. Are you sure?"]})]}),(0,t.jsxs)(g.xo,{children:[(0,t.jsx)(g.le,{children:"Cancel"}),(0,t.jsxs)(g.OL,{onClick:()=>et&&eO(et.version),disabled:eN,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[eN?(0,t.jsx)(y.Z,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(C.Z,{className:"mr-2 h-4 w-4"}),"Rollback"]})]})]})}),(0,t.jsx)(N.Vq,{open:X,onOpenChange:ee,children:(0,t.jsxs)(N.cZ,{children:[(0,t.jsxs)(N.fK,{children:[(0,t.jsx)(N.$N,{children:"Create New Migration"}),(0,t.jsx)(N.Be,{children:"Generate a new migration file in the migrations directory"})]}),(0,t.jsxs)("div",{className:"space-y-4 py-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(x._,{htmlFor:"name",children:"Migration Name"}),(0,t.jsx)(o.I,{id:"name",placeholder:"e.g., add_user_preferences",value:er.name,onChange:e=>en({...er,name:e.target.value})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(x._,{htmlFor:"type",children:"Type"}),(0,t.jsxs)(v.Ph,{value:er.type,onValueChange:e=>en({...er,type:e}),children:[(0,t.jsx)(v.i4,{children:(0,t.jsx)(v.ki,{})}),(0,t.jsxs)(v.Bw,{children:[(0,t.jsx)(v.Ql,{value:"upgrade",children:"Upgrade"}),(0,t.jsx)(v.Ql,{value:"hotfix",children:"Hotfix"}),(0,t.jsx)(v.Ql,{value:"data",children:"Data Migration"}),(0,t.jsx)(v.Ql,{value:"schema",children:"Schema Change"})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(x._,{htmlFor:"description",children:"Description (optional)"}),(0,t.jsx)(u.g,{id:"description",placeholder:"Describe what this migration does...",value:er.description,onChange:e=>en({...er,description:e.target.value})})]})]}),(0,t.jsxs)(N.cN,{children:[(0,t.jsx)(c.z,{variant:"outline",onClick:()=>ee(!1),children:"Cancel"}),(0,t.jsxs)(c.z,{onClick:()=>{if(!er.name.trim()){n.Am.error("Migration name is required");return}ek({url:"".concat(k,"/migrations/create"),method:"post",values:er},{onSuccess:e=>{var s,a;n.Am.success("Created migration: ".concat(null==e?void 0:null===(a=e.data)||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.filename)),ee(!1),en({name:"",description:"",type:"upgrade"}),ez()},onError:e=>{n.Am.error("Failed to create migration: ".concat(e.message))}})},disabled:eC,children:[eC?(0,t.jsx)(y.Z,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(z.Z,{className:"mr-2 h-4 w-4"}),"Create Migration"]})]})]})}),(0,t.jsx)(N.Vq,{open:es,onOpenChange:ea,children:(0,t.jsxs)(N.cZ,{className:"max-w-2xl",children:[(0,t.jsxs)(N.fK,{children:[(0,t.jsx)(N.$N,{children:"Migration Details"}),(0,t.jsxs)(N.Be,{children:[null==et?void 0:et.version," - ",null==et?void 0:et.name]})]}),et&&(0,t.jsx)("div",{className:"max-h-[60vh] overflow-y-auto pr-2",children:(0,t.jsxs)("div",{className:"space-y-4 py-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(x._,{className:"text-muted-foreground",children:"Version"}),(0,t.jsx)("p",{className:"font-mono",children:et.version})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x._,{className:"text-muted-foreground",children:"Name"}),(0,t.jsx)("p",{children:et.name})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x._,{className:"text-muted-foreground",children:"Type"}),(0,t.jsx)("div",{className:"mt-1",children:(0,t.jsx)(Y,{type:et.type})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x._,{className:"text-muted-foreground",children:"Status"}),(0,t.jsx)("div",{className:"mt-1",children:(0,t.jsx)(U,{status:et.status})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x._,{className:"text-muted-foreground",children:"Batch"}),(0,t.jsxs)("p",{children:["#",et.batch||"-"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x._,{className:"text-muted-foreground",children:"Execution Time"}),(0,t.jsxs)("p",{children:[et.executionTimeMs,"ms"]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x._,{className:"text-muted-foreground",children:"Executed At"}),(0,t.jsx)("p",{children:et.executedAt?(0,B.WU)(new Date(et.executedAt),"MMM d, yyyy HH:mm:ss"):"-"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(x._,{className:"text-muted-foreground",children:"Can Rollback"}),(0,t.jsx)("p",{children:et.canRollback?"Yes":"No"})]})]}),et.description&&(0,t.jsxs)("div",{children:[(0,t.jsx)(x._,{className:"text-muted-foreground",children:"Description"}),(0,t.jsx)("p",{className:"mt-1",children:et.description})]}),et.checksum&&(0,t.jsxs)("div",{children:[(0,t.jsx)(x._,{className:"text-muted-foreground",children:"Checksum"}),(0,t.jsx)("p",{className:"mt-1 font-mono text-xs break-all",children:et.checksum})]}),et.errorMessage&&(0,t.jsxs)("div",{children:[(0,t.jsx)(x._,{className:"text-muted-foreground text-red-600",children:"Error"}),(0,t.jsx)("pre",{className:"mt-1 p-3 bg-red-100 dark:bg-red-900 rounded text-sm whitespace-pre-wrap break-words text-red-700 dark:text-red-300",children:et.errorMessage})]}),et.metadata&&Object.keys(et.metadata).length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)(x._,{className:"text-muted-foreground",children:"Metadata"}),(0,t.jsx)("pre",{className:"mt-1 p-3 bg-muted rounded text-sm whitespace-pre-wrap break-words",children:JSON.stringify(et.metadata,null,2)})]})]})}),(0,t.jsxs)(N.cN,{children:[(0,t.jsx)(c.z,{variant:"outline",onClick:()=>ea(!1),children:"Close"}),(null==et?void 0:et.canRollback)&&(null==et?void 0:et.status)==="completed"&&(0,t.jsxs)(c.z,{variant:"destructive",onClick:()=>{ea(!1),G(!0)},children:[(0,t.jsx)(C.Z,{className:"mr-2 h-4 w-4"}),"Rollback"]})]})]})})]})};var F=()=>(0,t.jsx)(P,{})},30767:function(e,s,a){"use strict";a.d(s,{OL:function(){return p},_T:function(){return x},aR:function(){return c},f$:function(){return j},fY:function(){return u},le:function(){return g},vW:function(){return d},xo:function(){return h},yT:function(){return f}});var t=a(57437),l=a(2265),r=a(16720),n=a(93448),i=a(12381);let c=r.fC,d=r.xz,o=r.h_,m=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,t.jsx)(r.aV,{className:(0,n.cn)("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...l,ref:s})});m.displayName="AlertDialogOverlay";let x=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,t.jsxs)(o,{children:[(0,t.jsx)(m,{}),(0,t.jsx)(r.VY,{ref:s,className:(0,n.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg",a),...l})]})});x.displayName="AlertDialogContent";let u=e=>{let{className:s,...a}=e;return(0,t.jsx)("div",{className:(0,n.cn)("flex flex-col space-y-2 text-center sm:text-left",s),...a})};u.displayName="AlertDialogHeader";let h=e=>{let{className:s,...a}=e;return(0,t.jsx)("div",{className:(0,n.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...a})};h.displayName="AlertDialogFooter";let j=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,t.jsx)(r.Dx,{ref:s,className:(0,n.cn)("text-lg font-semibold",a),...l})});j.displayName="AlertDialogTitle";let f=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,t.jsx)(r.dk,{ref:s,className:(0,n.cn)("text-sm text-muted-foreground",a),...l})});f.displayName="AlertDialogDescription";let p=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,t.jsx)(r.aU,{ref:s,className:(0,n.cn)((0,i.d)(),a),...l})});p.displayName="AlertDialogAction";let g=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,t.jsx)(r.$j,{ref:s,className:(0,n.cn)((0,i.d)({variant:"outline"}),"mt-2 sm:mt-0",a),...l})});g.displayName="AlertDialogCancel"},75060:function(e,s,a){"use strict";a.d(s,{_:function(){return d}});var t=a(57437),l=a(2265),r=a(370),n=a(90535),i=a(93448);let c=(0,n.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,t.jsx)(r.f,{ref:s,className:(0,i.cn)(c(),a),...l})});d.displayName=r.f.displayName},15291:function(e,s,a){"use strict";a.d(s,{Bw:function(){return f},DI:function(){return m},Ph:function(){return o},Ql:function(){return g},i4:function(){return u},ki:function(){return x},n5:function(){return p}});var t=a(57437),l=a(2265),r=a(74797),n=a(40875),i=a(22135),c=a(30401),d=a(93448);let o=r.fC,m=r.ZA,x=r.B4,u=l.forwardRef((e,s)=>{let{className:a,children:l,...i}=e;return(0,t.jsxs)(r.xz,{ref:s,className:(0,d.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",a),...i,children:[l,(0,t.jsx)(r.JO,{asChild:!0,children:(0,t.jsx)(n.Z,{className:"h-4 w-4 opacity-50"})})]})});u.displayName=r.xz.displayName;let h=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,t.jsx)(r.u_,{ref:s,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",a),...l,children:(0,t.jsx)(i.Z,{className:"h-4 w-4"})})});h.displayName=r.u_.displayName;let j=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,t.jsx)(r.$G,{ref:s,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",a),...l,children:(0,t.jsx)(n.Z,{className:"h-4 w-4"})})});j.displayName=r.$G.displayName;let f=l.forwardRef((e,s)=>{let{className:a,children:l,position:n="popper",...i}=e;return(0,t.jsx)(r.h_,{children:(0,t.jsxs)(r.VY,{ref:s,className:(0,d.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:n,...i,children:[(0,t.jsx)(h,{}),(0,t.jsx)(r.l_,{className:(0,d.cn)("p-1 max-h-[300px] overflow-y-auto","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),style:{overscrollBehavior:"contain",touchAction:"pan-y",WebkitOverflowScrolling:"touch",willChange:"scroll-position",pointerEvents:"auto"},children:l}),(0,t.jsx)(j,{})]})})});f.displayName=r.VY.displayName;let p=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,t.jsx)(r.__,{ref:s,className:(0,d.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",a),...l})});p.displayName=r.__.displayName;let g=l.forwardRef((e,s)=>{let{className:a,children:l,...n}=e;return(0,t.jsxs)(r.ck,{ref:s,className:(0,d.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...n,children:[(0,t.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,t.jsx)(r.wU,{children:(0,t.jsx)(c.Z,{className:"h-4 w-4"})})}),(0,t.jsx)(r.eT,{children:l})]})});g.displayName=r.ck.displayName,l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,t.jsx)(r.Z0,{ref:s,className:(0,d.cn)("-mx-1 my-1 h-px bg-muted",a),...l})}).displayName=r.Z0.displayName},69140:function(e,s,a){"use strict";a.d(s,{O:function(){return r}});var t=a(57437),l=a(93448);function r(e){let{className:s,...a}=e;return(0,t.jsx)("div",{className:(0,l.cn)("animate-pulse rounded-md bg-muted",s),...a})}},17168:function(e,s,a){"use strict";a.d(s,{SP:function(){return d},dr:function(){return c},mQ:function(){return i},nU:function(){return o}});var t=a(57437),l=a(2265),r=a(20271),n=a(93448);let i=r.fC,c=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,t.jsx)(r.aV,{ref:s,className:(0,n.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",a),...l})});c.displayName=r.aV.displayName;let d=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,t.jsx)(r.xz,{ref:s,className:(0,n.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",a),...l})});d.displayName=r.xz.displayName;let o=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,t.jsx)(r.VY,{ref:s,className:(0,n.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",a),...l})});o.displayName=r.VY.displayName},23675:function(e,s,a){"use strict";a.d(s,{g:function(){return n}});var t=a(57437),l=a(2265),r=a(93448);let n=l.forwardRef((e,s)=>{let{className:a,...l}=e;return(0,t.jsx)("textarea",{className:(0,r.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",a),ref:s,...l})});n.displayName="Textarea"}},function(e){e.O(0,[7999,5094,4438,6530,4475,6241,926,600,1509,9487,3563,799,3233,2667,2971,2117,1744],function(){return e(e.s=55203)}),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8154],{80723:function(n,e,u){Promise.resolve().then(u.bind(u,64310))},64310:function(n,e,u){"use strict";u.r(e);var s=u(57437);u(2265);var t=u(24225);e.default=()=>(0,s.jsx)(t.HD,{})}},function(n){n.O(0,[7999,3572,7902,5094,4438,6530,6241,4475,926,600,1668,2676,1509,6869,9487,1783,9881,7324,9124,6712,5650,6547,2033,7304,3817,9599,2971,2117,1744],function(){return n(n.s=80723)}),_N_E=n.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8154],{80723:function(n,e,u){Promise.resolve().then(u.bind(u,64310))},64310:function(n,e,u){"use strict";u.r(e);var s=u(57437);u(2265);var t=u(24225);e.default=()=>(0,s.jsx)(t.HD,{})}},function(n){n.O(0,[7999,3572,7902,5094,4438,6530,4475,6241,926,600,1668,2676,1509,6869,9487,1783,9881,7324,9124,6712,5650,2667,4033,7304,3817,9599,2971,2117,1744],function(){return n(n.s=80723)}),_N_E=n.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6691],{57433:function(n,e,u){Promise.resolve().then(u.bind(u,67306))},67306:function(n,e,u){"use strict";u.r(e);var s=u(57437);u(2265);var t=u(24225);e.default=()=>(0,s.jsx)(t.iL,{})}},function(n){n.O(0,[7999,3572,7902,5094,4438,6530,6241,4475,926,600,1668,2676,1509,6869,9487,1783,9881,7324,9124,6712,5650,6547,2033,7304,3817,9599,2971,2117,1744],function(){return n(n.s=57433)}),_N_E=n.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6691],{57433:function(n,e,u){Promise.resolve().then(u.bind(u,67306))},67306:function(n,e,u){"use strict";u.r(e);var s=u(57437);u(2265);var t=u(24225);e.default=()=>(0,s.jsx)(t.iL,{})}},function(n){n.O(0,[7999,3572,7902,5094,4438,6530,4475,6241,926,600,1668,2676,1509,6869,9487,1783,9881,7324,9124,6712,5650,2667,4033,7304,3817,9599,2971,2117,1744],function(){return n(n.s=57433)}),_N_E=n.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9735],{38509:function(n,e,u){Promise.resolve().then(u.bind(u,83975))},83975:function(n,e,u){"use strict";u.r(e);var s=u(57437);u(2265);var t=u(24225);e.default=()=>(0,s.jsx)(t.kL,{})}},function(n){n.O(0,[7999,3572,7902,5094,4438,6530,6241,4475,926,600,1668,2676,1509,6869,9487,1783,9881,7324,9124,6712,5650,6547,2033,7304,3817,9599,2971,2117,1744],function(){return n(n.s=38509)}),_N_E=n.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9735],{38509:function(n,e,u){Promise.resolve().then(u.bind(u,83975))},83975:function(n,e,u){"use strict";u.r(e);var s=u(57437);u(2265);var t=u(24225);e.default=()=>(0,s.jsx)(t.kL,{})}},function(n){n.O(0,[7999,3572,7902,5094,4438,6530,4475,6241,926,600,1668,2676,1509,6869,9487,1783,9881,7324,9124,6712,5650,2667,4033,7304,3817,9599,2971,2117,1744],function(){return n(n.s=38509)}),_N_E=n.O()}]);