@baasix/baasix 0.1.62 → 0.1.63
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.
- package/dist/app/404/index.html +1 -1
- package/dist/app/404.html +1 -1
- package/dist/app/_next/static/chunks/2667-7993936698bf75a9.js +1 -0
- package/dist/app/_next/static/chunks/3233-ae028c73c510ebea.js +1 -0
- package/dist/app/_next/static/chunks/4033-ea89dd457b87cead.js +1 -0
- package/dist/app/_next/static/chunks/799-d4372ad380b0dec6.js +1 -0
- package/dist/app/_next/static/chunks/app/(authenticated)/activity-log/all-activity/{page-a7e9f0b39624b489.js → page-8e1f084e807ff5ee.js} +1 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/activity-log/email-log/{page-40f2b9ecf73e74b5.js → page-4e08df2865fe9d0f.js} +1 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/activity-log/notifications/{page-21fcdd2f0b3549db.js → page-3a5070a5088835ae.js} +1 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/activity-log/sessions/{page-82662735f1ec476a.js → page-edfa379cab0d3ccb.js} +1 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/activity-log/workflow-executions/{page-4a781c95e5fb25f0.js → page-d007890f17b60862.js} +1 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/activity-log/workflow-logs/{page-70bf8d31074dcba0.js → page-976e9829706ac8f2.js} +1 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/dashboard/page-6bff6e8911fc5036.js +1 -0
- package/dist/app/_next/static/chunks/app/(authenticated)/data-browser/{page-d5715b9743d8dba4.js → page-fbb7a4d4f2a4353d.js} +1 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/file-manager/{page-c008de2bcf6811b9.js → page-cea6a2c1670d4ef5.js} +1 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/layout-b7f18737e4c308a4.js +1 -0
- package/dist/app/_next/static/chunks/app/(authenticated)/settings/migrations/page-505c3389890685b9.js +1 -0
- package/dist/app/_next/static/chunks/app/(authenticated)/settings/permissions/{page-2d3043500adcdb12.js → page-ed80f4bd5d81df95.js} +1 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/settings/project/{page-6a58f15efb013e17.js → page-310b8ce72d0516ea.js} +1 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/settings/roles/{page-00cf3e4483986407.js → page-fd62dc19ac88dd64.js} +1 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/settings/schema/page-3d91124704c2e853.js +1 -0
- package/dist/app/_next/static/chunks/app/(authenticated)/settings/schema-diff/page-cae8772a7ae93b9a.js +1 -0
- package/dist/app/_next/static/chunks/app/(authenticated)/settings/tasks/{page-fa3c401992a2fb8f.js → page-1479604bbfc53a83.js} +1 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/settings/templates/edit/{page-4ce715d527c717a8.js → page-a611195661ce22bd.js} +1 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/settings/templates/{page-aafbfd4f12875738.js → page-6787b62a4960304f.js} +1 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/settings/tenants/{page-f34d97ce6f68183b.js → page-856d4af5fbd76c8e.js} +1 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/users/invites/{page-20dd05a8745b6283.js → page-ed5493d55f6c1db8.js} +1 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/users/list/{page-479a164304f4de3f.js → page-02e6ef533bdc3bbc.js} +1 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/users/{page-909d7be1b8d9800c.js → page-faf321b61a6fdeef.js} +1 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/users/preferences/{page-e3fbcc425e1710e5.js → page-2116015e962a2ecc.js} +1 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/users/user-roles/{page-3f654c69d79269f7.js → page-7d1bcbbfc8f0694b.js} +1 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/workflows/edit/{page-753cf274fd329860.js → page-45c465caaa5679bd.js} +1 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/workflows/{page-33c1c69678122839.js → page-7f9cb24aaa798f42.js} +1 -1
- package/dist/app/_next/static/chunks/{main-324e91f5a430cddf.js → main-8ffa7219a08e42cf.js} +1 -1
- package/dist/app/_next/static/chunks/{webpack-b29732cfe967a5f5.js → webpack-7a100cbf9402e7ea.js} +1 -1
- package/dist/app/_next/static/css/45276c37be155f45.css +3 -0
- package/dist/app/activity-log/all-activity/index.html +1 -1
- package/dist/app/activity-log/all-activity/index.txt +3 -3
- package/dist/app/activity-log/email-log/index.html +1 -1
- package/dist/app/activity-log/email-log/index.txt +3 -3
- package/dist/app/activity-log/index.html +1 -1
- package/dist/app/activity-log/index.txt +2 -2
- package/dist/app/activity-log/notifications/index.html +1 -1
- package/dist/app/activity-log/notifications/index.txt +3 -3
- package/dist/app/activity-log/sessions/index.html +1 -1
- package/dist/app/activity-log/sessions/index.txt +3 -3
- package/dist/app/activity-log/workflow-executions/index.html +1 -1
- package/dist/app/activity-log/workflow-executions/index.txt +3 -3
- package/dist/app/activity-log/workflow-logs/index.html +1 -1
- package/dist/app/activity-log/workflow-logs/index.txt +3 -3
- package/dist/app/change-password/index.html +1 -1
- package/dist/app/change-password/index.txt +2 -2
- package/dist/app/dashboard/index.html +1 -1
- package/dist/app/dashboard/index.txt +3 -3
- package/dist/app/data-browser/index.html +1 -1
- package/dist/app/data-browser/index.txt +3 -3
- package/dist/app/file-manager/index.html +1 -1
- package/dist/app/file-manager/index.txt +3 -3
- package/dist/app/forgot-password/index.html +1 -1
- package/dist/app/forgot-password/index.txt +1 -1
- package/dist/app/index.html +1 -1
- package/dist/app/index.txt +1 -1
- package/dist/app/login/index.html +1 -1
- package/dist/app/login/index.txt +1 -1
- package/dist/app/register/index.html +1 -1
- package/dist/app/register/index.txt +1 -1
- package/dist/app/settings/migrations/index.html +1 -1
- package/dist/app/settings/migrations/index.txt +3 -3
- package/dist/app/settings/permissions/index.html +1 -1
- package/dist/app/settings/permissions/index.txt +3 -3
- package/dist/app/settings/project/index.html +1 -1
- package/dist/app/settings/project/index.txt +3 -3
- package/dist/app/settings/roles/index.html +1 -1
- package/dist/app/settings/roles/index.txt +3 -3
- package/dist/app/settings/schema/index.html +1 -1
- package/dist/app/settings/schema/index.txt +3 -3
- package/dist/app/settings/schema-diff/index.html +1 -0
- package/dist/app/settings/schema-diff/index.txt +14 -0
- package/dist/app/settings/tasks/index.html +1 -1
- package/dist/app/settings/tasks/index.txt +3 -3
- package/dist/app/settings/templates/edit/index.html +1 -1
- package/dist/app/settings/templates/edit/index.txt +3 -3
- package/dist/app/settings/templates/index.html +1 -1
- package/dist/app/settings/templates/index.txt +3 -3
- package/dist/app/settings/tenants/index.html +1 -1
- package/dist/app/settings/tenants/index.txt +3 -3
- package/dist/app/users/index.html +1 -1
- package/dist/app/users/index.txt +3 -3
- package/dist/app/users/invites/index.html +1 -1
- package/dist/app/users/invites/index.txt +3 -3
- package/dist/app/users/list/index.html +1 -1
- package/dist/app/users/list/index.txt +3 -3
- package/dist/app/users/preferences/index.html +1 -1
- package/dist/app/users/preferences/index.txt +3 -3
- package/dist/app/users/user-roles/index.html +1 -1
- package/dist/app/users/user-roles/index.txt +3 -3
- package/dist/app/workflows/detail/index.html +1 -1
- package/dist/app/workflows/detail/index.txt +2 -2
- package/dist/app/workflows/edit/index.html +1 -1
- package/dist/app/workflows/edit/index.txt +3 -3
- package/dist/app/workflows/execution/index.html +1 -1
- package/dist/app/workflows/execution/index.txt +2 -2
- package/dist/app/workflows/index.html +1 -1
- package/dist/app/workflows/index.txt +3 -3
- package/dist/routes/schema-diff.route.d.ts +7 -0
- package/dist/routes/schema-diff.route.d.ts.map +1 -0
- package/dist/routes/schema-diff.route.js +320 -0
- package/dist/routes/schema-diff.route.js.map +1 -0
- package/package.json +1 -1
- package/dist/app/_next/static/chunks/2033-8355304f13887db5.js +0 -1
- package/dist/app/_next/static/chunks/4952-1b97320cf61f3f21.js +0 -1
- package/dist/app/_next/static/chunks/6547-1aaab011e6089042.js +0 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/dashboard/page-1ceeac9e72997a8a.js +0 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/layout-2a4b221af5cbbade.js +0 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/settings/migrations/page-6681c14dd478cc9a.js +0 -1
- package/dist/app/_next/static/chunks/app/(authenticated)/settings/schema/page-e7f836d3a7f7c5d0.js +0 -1
- package/dist/app/_next/static/css/17a2e01c4184b106.css +0 -3
- /package/dist/app/_next/static/{ORfvBD2VaKIB_8_7O9AgQ → O6PA41CeUjDJQ4sma7vMH}/_buildManifest.js +0 -0
- /package/dist/app/_next/static/{ORfvBD2VaKIB_8_7O9AgQ → O6PA41CeUjDJQ4sma7vMH}/_ssgManifest.js +0 -0
package/dist/app/_next/static/chunks/app/(authenticated)/settings/schema/page-3d91124704c2e853.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[842],{49204:function(e,a,l){Promise.resolve().then(l.bind(l,80671))},79205:function(e,a,l){"use strict";l.d(a,{Z:function(){return d}});var s=l(2265);let t=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),n=function(){for(var e=arguments.length,a=Array(e),l=0;l<e;l++)a[l]=arguments[l];return a.filter((e,a,l)=>!!e&&l.indexOf(e)===a).join(" ")};var i={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 r=(0,s.forwardRef)((e,a)=>{let{color:l="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:d,className:c="",children:o,iconNode:u,...h}=e;return(0,s.createElement)("svg",{ref:a,...i,width:t,height:t,stroke:l,strokeWidth:d?24*Number(r)/Number(t):r,className:n("lucide",c),...h},[...u.map(e=>{let[a,l]=e;return(0,s.createElement)(a,l)}),...Array.isArray(o)?o:[o]])}),d=(e,a)=>{let l=(0,s.forwardRef)((l,i)=>{let{className:d,...c}=l;return(0,s.createElement)(r,{ref:i,iconNode:a,className:n("lucide-".concat(t(e)),d),...c})});return l.displayName="".concat(e),l}},41671:function(e,a,l){"use strict";l.d(a,{Z:function(){return s}});let s=(0,l(79205).Z)("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},33003:function(e,a,l){"use strict";l.d(a,{Z:function(){return s}});let s=(0,l(79205).Z)("Columns3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]])},54001:function(e,a,l){"use strict";l.d(a,{Z:function(){return s}});let s=(0,l(79205).Z)("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]])},51817:function(e,a,l){"use strict";l.d(a,{Z:function(){return s}});let s=(0,l(79205).Z)("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},80671:function(e,a,l){"use strict";l.r(a),l.d(a,{default:function(){return ed}});var s=l(57437),t=l(2265),n=l(72135),i=l(29696),r=l(14438),d=l(79820),c=l(12381),o=l(43368),u=l(69174),h=l(33804),m=l(30767),x=l(82431),p=l(99397),j=l(17689),v=l(92735),f=l(51817),g=l(50091),N=l(33003),y=l(54001),b=l(98728),w=l(18930),C=l(91032),S=l(40279),I=l(75060),A=l(94589),k=l(15291);let T=e=>{let{open:a,onClose:l,onSuccess:d}=e,[o,u]=(0,t.useState)(""),[h,m]=(0,t.useState)("id"),[x,p]=(0,t.useState)("UUID"),[j,v]=(0,t.useState)(!0),[g,N]=(0,t.useState)(!0),[y,b]=(0,t.useState)(!1),{mutate:w,isLoading:T}=(0,n.RO)(),{refetch:_}=(0,i.I_)(),D=()=>{u(""),m("id"),p("UUID"),v(!0),N(!0),b(!1)};return(0,s.jsx)(C.yo,{open:a,onOpenChange:e=>!e&&l(),children:(0,s.jsxs)(C.ue,{className:"w-[500px] sm:w-[600px] flex flex-col",children:[(0,s.jsx)(C.Tu,{children:(0,s.jsx)(C.bC,{children:"Create New Schema"})}),(0,s.jsxs)("form",{onSubmit:e=>{if(e.preventDefault(),!o.trim()){r.Am.error("Please enter a schema name");return}if(o.length>63){r.Am.error("Schema name must be 63 characters or less (PostgreSQL identifier limit)");return}w({resource:"collections",values:{collectionName:o.toLowerCase(),schema:{name:o,fields:{[h]:{type:x,primaryKey:!0,defaultValue:"UUID"===x?{type:"UUIDV4"}:"Integer"===x?{type:"AUTOINCREMENT"}:"SUID"===x?{type:"SUID"}:void 0}},timestamps:j,paranoid:y,usertrack:g}}},{onSuccess:()=>{r.Am.success("Schema created successfully"),_(),D(),d()},onError:e=>{r.Am.error("Error creating schema: ".concat(e.message))}})},className:"mt-6 space-y-6 flex-1 overflow-y-auto",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{htmlFor:"schemaName",children:"Schema Name"}),(0,s.jsx)(S.I,{id:"schemaName",placeholder:"Enter schema name",value:o,onChange:e=>u(e.target.value),maxLength:63,className:o.length>63?"border-red-500":"",required:!0}),(0,s.jsxs)("p",{className:"text-xs ".concat(o.length>63?"text-red-600":o.length>50?"text-yellow-600":"text-muted-foreground"),children:[o.length,"/63 characters",o.length>63&&" - Name too long for PostgreSQL!"]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{htmlFor:"primaryKeyName",children:"Primary Key Name"}),(0,s.jsx)(S.I,{id:"primaryKeyName",placeholder:"id",value:h,onChange:e=>m(e.target.value),required:!0})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{htmlFor:"primaryKeyType",children:"Primary Key Type"}),(0,s.jsxs)(k.Ph,{value:x,onValueChange:p,children:[(0,s.jsx)(k.i4,{children:(0,s.jsx)(k.ki,{placeholder:"Select type"})}),(0,s.jsxs)(k.Bw,{children:[(0,s.jsx)(k.Ql,{value:"UUID",children:"UUID"}),(0,s.jsx)(k.Ql,{value:"Integer",children:"Integer"}),(0,s.jsx)(k.Ql,{value:"String",children:"String"}),(0,s.jsx)(k.Ql,{value:"SUID",children:"Short UID"})]})]})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(I._,{children:"Timestamps"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Add createdAt and updatedAt fields"})]}),(0,s.jsx)(A.r,{checked:j,onCheckedChange:v})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(I._,{children:"Audit Logs"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Track user changes to records"})]}),(0,s.jsx)(A.r,{checked:g,onCheckedChange:N})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(I._,{children:"Soft Delete"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Mark records as deleted instead of removing them"})]}),(0,s.jsx)(A.r,{checked:y,onCheckedChange:b})]})]}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 pt-4",children:[(0,s.jsx)(c.z,{type:"button",variant:"outline",onClick:l,children:"Cancel"}),(0,s.jsxs)(c.z,{type:"submit",disabled:T,children:[T&&(0,s.jsx)(f.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Create Schema"]})]})]})]})})};var _=l(79205);let D=(0,_.Z)("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);var M=l(73247),E=l(45675),R=l(23675),O=l(68245),U=l(33245),L=l(32489),V=l(71488),Z=l(12749),z=l(93448),P=l(79622);let F=[{value:" - ",label:"Dash ( - )"},{value:" ",label:"Space ( )"},{value:", ",label:"Comma (, )"},{value:"_",label:"Underscore (_)"},{value:" & ",label:"Ampersand ( & )"},{value:" | ",label:"Pipe ( | )"},{value:" (",label:"Open Paren ( ()"},{value:") ",label:"Close Paren ( ))"},{value:"(",label:"Open Paren (()"},{value:")",label:"Close Paren ())"}],Q={text:[{value:"String",label:"String"},{value:"Text",label:"Text"},{value:"HTML",label:"HTML (Rich Text)"},{value:"CiText",label:"Text (Case Insensitive)"},{value:"ENUM",label:"ENUM"}],numeric:[{value:"Integer",label:"Integer"},{value:"BigInt",label:"BigInt"},{value:"Decimal",label:"Decimal"},{value:"Double",label:"Double"},{value:"Real",label:"Real"}],date:[{value:"DateTime",label:"DateTime (with timezone)"},{value:"DateTime_NO_TZ",label:"DateTime (no timezone)"},{value:"Date",label:"Date"},{value:"Time",label:"Time (with timezone)"},{value:"Time_NO_TZ",label:"Time (no timezone)"}],other:[{value:"Boolean",label:"Boolean"},{value:"UUID",label:"UUID"},{value:"SUID",label:"Short UID"},{value:"JSON",label:"JSON"},{value:"JSONB",label:"JSONB"},{value:"VIRTUAL",label:"Virtual"}],array:[{value:"Array_Integer",label:"Array Integer"},{value:"Array_String",label:"Array String"},{value:"Array_Double",label:"Array Double"},{value:"Array_Date",label:"Array Date"},{value:"Array_DateTime",label:"Array DateTime (with timezone)"},{value:"Array_DateTime_NO_TZ",label:"Array DateTime (no timezone)"},{value:"Array_Time",label:"Array Time (with timezone)"},{value:"Array_Time_NO_TZ",label:"Array Time (no timezone)"},{value:"Array_Boolean",label:"Array Boolean"}],range:[{value:"Range_Integer",label:"Range Integer"},{value:"Range_Double",label:"Range Double"},{value:"Range_Decimal",label:"Range Decimal"},{value:"Range_Date",label:"Range Date"},{value:"Range_DateTime",label:"Range DateTime (with timezone)"},{value:"Range_DateTime_NO_TZ",label:"Range DateTime (no timezone)"},{value:"Range_Time",label:"Range Time (with timezone)"},{value:"Range_Time_NO_TZ",label:"Range Time (no timezone)"}],geo:[{value:"Point",label:"Point"},{value:"Polygon",label:"Polygon"},{value:"LineString",label:"LineString"}]},B=[{value:"M2O",label:"Many-to-One"},{value:"O2O",label:"One-to-One"},{value:"M2M",label:"Many-to-Many"},{value:"M2A",label:"Many-to-Any"}],$=e=>["DateTime","DateTime_NO_TZ","Date","Time","Time_NO_TZ"].includes(e),W=e=>{var a,l,d,o,h;let{open:m,onClose:x,collectionName:p,fieldName:j,isRelationship:v,onSuccess:g}=e,[N,y]=(0,t.useState)({name:"",type:"",allowNull:!0,hidden:!1,defaultValue:"",values:[],stringLength:"",precision:"",scale:"",calculated:"",target:"",relType:"",onDelete:"CASCADE",onUpdate:"CASCADE",alias:"",through:"",tables:[],showAs:[],polymorphic:!1,description:"",validateMin:"",validateMax:"",validateIsInt:!1,validateNotEmpty:!1,validateIsEmail:!1,validateIsUrl:!1,validateMinLength:"",validateMaxLength:"",validatePattern:""}),[b,w]=(0,t.useState)([]),[T,_]=(0,t.useState)(!1),{getSchemaByName:D,getNestedFields:M,schemas:E,refetch:W}=(0,i.I_)(),J=(0,t.useMemo)(()=>m&&p?{data:D(p)}:null,[m,p,D]),q=(0,t.useMemo)(()=>(null==E?void 0:E.map(e=>({id:e.collectionName,name:e.collectionName})))||[],[E]),H=(0,t.useMemo)(()=>N.target&&(null==M?void 0:M(N.target))||[],[N.target,M]),{mutate:K,isLoading:X}=(0,n.PQ)(),{mutate:Y,isLoading:G}=(0,n.RO)(),ee=!!j,ea=X||G;(0,t.useEffect)(()=>{if(m&&(null==J?void 0:J.data)&&j){var e,a,l,s,t,n,i,r,d;let c=J.data.schema.fields[j]||{},o=c.values||[],u="",h="",m="";c.values&&"object"==typeof c.values&&!Array.isArray(c.values)&&(u=c.values.stringLength||"",h=c.values.precision||"",m=c.values.scale||"",o=[]);let x="",p=!1;c.defaultValue&&("object"==typeof c.defaultValue&&"NOW"===c.defaultValue.type?x="$NOW":"object"==typeof c.defaultValue&&"UUIDV4"===c.defaultValue.type?x="$UUIDV4":"object"==typeof c.defaultValue&&"SUID"===c.defaultValue.type?x="$SUID":"object"==typeof c.defaultValue&&"AUTOINCREMENT"===c.defaultValue.type?x="$AUTOINCREMENT":"boolean"==typeof c.defaultValue?x=c.defaultValue?"true":"false":(x=String(c.defaultValue),("Integer"===c.type||"BigInt"===c.type)&&""!==x&&(p=!0))),_(p);let f=c.validate||{},g=c.type||"";if(v&&c.relType){if("BelongsTo"===c.relType)g="M2O";else if("HasOne"===c.relType)g="O2O";else if("BelongsToMany"===c.relType)g="M2M";else if("HasMany"===c.relType){if(c.polymorphic)g="M2A";else{let e=D(c.target);g=(null==e?void 0:null===(l=e.schema)||void 0===l?void 0:l.isJunction)?"M2M":"O2M"}}}y({name:j,type:g,allowNull:null===(s=c.allowNull)||void 0===s||s,hidden:null!==(t=c.hidden)&&void 0!==t&&t,defaultValue:x,values:o,stringLength:u,precision:h,scale:m,calculated:c.calculated||"",target:c.target||"",relType:c.relType||"",onDelete:c.onDelete||"CASCADE",onUpdate:c.onUpdate||"CASCADE",alias:c.alias||"",through:c.through||"",tables:c.tables||[],showAs:c.showAs||[],polymorphic:c.polymorphic||!1,constraints:c.constraints,description:c.description||"",validateMin:void 0!==f.min?String(f.min):"",validateMax:void 0!==f.max?String(f.max):"",validateIsInt:null!==(n=f.isInt)&&void 0!==n&&n,validateNotEmpty:null!==(i=f.notEmpty)&&void 0!==i&&i,validateIsEmail:null!==(r=f.isEmail)&&void 0!==r&&r,validateIsUrl:null!==(d=f.isUrl)&&void 0!==d&&d,validateMinLength:(null===(e=f.len)||void 0===e?void 0:e[0])!==void 0?String(f.len[0]):"",validateMaxLength:(null===(a=f.len)||void 0===a?void 0:a[1])!==void 0?String(f.len[1]):"",validatePattern:f.is||f.matches||""}),c.showAs&&Array.isArray(c.showAs)?w(c.showAs):w([])}else m&&!j&&(y({name:"",type:"",allowNull:!0,hidden:!1,defaultValue:"",values:[],stringLength:"",precision:"",scale:"",calculated:"",target:"",relType:"",onDelete:"CASCADE",onUpdate:"CASCADE",alias:"",through:"",tables:[],showAs:[],polymorphic:!1,description:"",validateMin:"",validateMax:"",validateIsInt:!1,validateNotEmpty:!1,validateIsEmail:!1,validateIsUrl:!1,validateMinLength:"",validateMaxLength:"",validatePattern:""}),w([]),_(!1))},[m,J,j]),(0,t.useEffect)(()=>{if(!ee&&v&&("M2M"===N.type||"M2A"===N.type)){let e="";"M2M"===N.type&&N.target&&N.name?e="".concat(p,"_").concat(N.target,"_").concat(N.name,"_junction"):"M2A"===N.type&&N.name&&(e="".concat(p,"_").concat(N.name,"_junction")),e&&(!N.through||N.through.endsWith("_junction"))&&y(a=>({...a,through:e}))}},[N.type,N.target,N.name,p,ee,v]);let el=()=>{var e;let a={name:N.name,type:N.type,target:N.target};("M2O"===N.type||"O2O"===N.type)&&(a.onDelete=N.onDelete,a.onUpdate=N.onUpdate),N.alias&&(a.alias=N.alias),N.through&&("M2M"===N.type||"M2A"===N.type)&&(a.through=N.through),(null===(e=N.tables)||void 0===e?void 0:e.length)&&(a.tables=N.tables),(null==b?void 0:b.length)>0&&(a.showAs=b),(j?K:Y)({resource:"relationships",meta:{collectionName:p},values:a,...j&&{id:j}},{onSuccess:()=>{r.Am.success("Relationship ".concat(j?"updated":"created"," successfully")),W(),x(),g()},onError:e=>{r.Am.error("Error ".concat(j?"updating":"creating"," relationship: ").concat(e.message))}})},es=e=>["Integer","BigInt","Decimal","Double","Real","Array_Integer","Array_BigInt","Array_Double","Array_Decimal","Range_Integer","Range_BigInt","Range_Double","Range_Decimal"].includes(e),et=e=>["String","Text","CiText"].includes(e),en=()=>{var e,a;let l=D(p),s={...null==l?void 0:null===(e=l.schema)||void 0===e?void 0:e.fields},t={type:N.type,allowNull:N.allowNull};if(N.hidden&&(t.hidden=!0),N.defaultValue&&("$NOW"===N.defaultValue?t.defaultValue={type:"NOW"}:"$UUIDV4"===N.defaultValue?t.defaultValue={type:"UUIDV4"}:"$SUID"===N.defaultValue?t.defaultValue={type:"SUID"}:"$AUTOINCREMENT"===N.defaultValue?t.defaultValue={type:"AUTOINCREMENT"}:"Boolean"===N.type?t.defaultValue="true"===N.defaultValue:"Integer"!==N.type&&"BigInt"!==N.type||isNaN(Number(N.defaultValue))?t.defaultValue=N.defaultValue:t.defaultValue=parseInt(N.defaultValue,10)),"ENUM"===N.type&&(null===(a=N.values)||void 0===a?void 0:a.length)>0&&(t.values=N.values),"VIRTUAL"===N.type&&N.calculated&&(t.calculated=N.calculated),"String"===N.type&&N.stringLength&&(t.values={stringLength:N.stringLength}),"Decimal"===N.type&&(N.precision||N.scale)){let e={};N.precision&&(e.precision=parseInt(N.precision,10)),N.scale&&(e.scale=parseInt(N.scale,10)),t.values=e}if(es(N.type)){let e={};""!==N.validateMin&&null!==N.validateMin&&void 0!==N.validateMin&&(e.min=parseFloat(N.validateMin)),""!==N.validateMax&&null!==N.validateMax&&void 0!==N.validateMax&&(e.max=parseFloat(N.validateMax)),N.validateIsInt&&(e.isInt=!0),Object.keys(e).length>0&&(t.validate=e)}if(et(N.type)){let e={};N.validateNotEmpty&&(e.notEmpty=!0),N.validateIsEmail&&(e.isEmail=!0),N.validateIsUrl&&(e.isUrl=!0);let a=""!==N.validateMinLength?parseInt(N.validateMinLength,10):null,l=""!==N.validateMaxLength?parseInt(N.validateMaxLength,10):null;(null!==a||null!==l)&&(e.len=[null!=a?a:0,null!=l?l:999999]),N.validatePattern&&(e.is=N.validatePattern),Object.keys(e).length>0&&(t.validate=e)}if(ee){let e={...s[j]};e.hidden&&!N.hidden&&delete e.hidden,e.validate&&!t.validate&&delete e.validate,s[j]={...e,...t}}else s[N.name]=t;K({resource:"collections",id:p,values:{schema:{...null==l?void 0:l.schema,fields:s}}},{onSuccess:()=>{r.Am.success("Field ".concat(ee?"updated":"added"," successfully")),W(),x(),g()},onError:e=>{r.Am.error("Error ".concat(ee?"updating":"adding"," field: ").concat(e.message))}})},ei=(e,a)=>{y(l=>({...l,[e]:a}))};return(0,s.jsx)(C.yo,{open:m,onOpenChange:e=>!e&&x(),children:(0,s.jsxs)(C.ue,{className:"!w-full sm:!w-[600px] overflow-y-auto",children:[(0,s.jsx)(C.Tu,{children:(0,s.jsxs)(C.bC,{children:[ee?"Edit":"Create"," ",v?"Relationship":"Field"]})}),(0,s.jsxs)("form",{onSubmit:e=>{if(e.preventDefault(),!N.name){r.Am.error("Please enter a field name");return}if(!N.type){r.Am.error("Please select a field type");return}v?el():en()},className:"mt-6 space-y-5",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{htmlFor:"name",children:"Field Name"}),(0,s.jsx)(S.I,{id:"name",placeholder:"Enter field name",value:N.name,onChange:e=>ei("name",e.target.value),disabled:ee,required:!0})]}),v?(0,s.jsxs)(s.Fragment,{children:[ee&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{children:"Description"}),(0,s.jsx)(S.I,{value:N.description||"",disabled:!0})]}),!ee&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{children:"Relationship Type"}),(0,s.jsxs)(k.Ph,{value:N.type,onValueChange:e=>{ei("type",e),w([])},children:[(0,s.jsx)(k.i4,{children:(0,s.jsx)(k.ki,{placeholder:"Select relationship type"})}),(0,s.jsx)(k.Bw,{children:B.map(e=>(0,s.jsx)(k.Ql,{value:e.value,children:e.label},e.value))})]})]}),ee&&N.relType&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{children:"Relation Type"}),(0,s.jsxs)(k.Ph,{value:N.relType,disabled:!0,children:[(0,s.jsx)(k.i4,{children:(0,s.jsx)(k.ki,{})}),(0,s.jsxs)(k.Bw,{children:[(0,s.jsx)(k.Ql,{value:"BelongsTo",children:"BelongsTo"}),(0,s.jsx)(k.Ql,{value:"HasOne",children:"HasOne"}),(0,s.jsx)(k.Ql,{value:"HasMany",children:"HasMany"}),(0,s.jsx)(k.Ql,{value:"BelongsToMany",children:"BelongsToMany"})]})]})]}),"M2A"!==N.type&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{children:"Target Collection"}),(0,s.jsxs)(k.Ph,{value:N.target,onValueChange:e=>{ei("target",e),w([])},disabled:ee,children:[(0,s.jsx)(k.i4,{children:(0,s.jsx)(k.ki,{placeholder:"Select target collection"})}),(0,s.jsx)(k.Bw,{children:q.map(e=>(0,s.jsx)(k.Ql,{value:e.id,children:e.name},e.id))})]})]}),N.target&&"M2A"!==N.type&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)(I._,{children:"Display Format"}),(0,s.jsx)(V.pn,{children:(0,s.jsxs)(V.u,{children:[(0,s.jsx)(V.aJ,{asChild:!0,children:(0,s.jsx)(U.Z,{className:"h-3.5 w-3.5 text-muted-foreground cursor-help"})}),(0,s.jsx)(V._v,{children:(0,s.jsx)("p",{children:"Select fields to display for this relationship"})})]})})]}),(0,s.jsxs)(Z.J2,{children:[(0,s.jsx)(Z.xo,{asChild:!0,children:(0,s.jsx)(c.z,{variant:"outline",role:"combobox",className:"w-full justify-start font-normal h-auto min-h-10",children:b.length>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:b.map((e,a)=>(0,s.jsxs)(u.C,{variant:"secondary",className:"mr-1",children:[e,(0,s.jsx)("button",{type:"button",className:"ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",onClick:e=>{e.stopPropagation(),w(b.filter((e,l)=>l!==a))},children:(0,s.jsx)(L.Z,{className:"h-3 w-3"})})]},"".concat(e,"-").concat(a)))}):(0,s.jsx)("span",{className:"text-muted-foreground",children:"Select fields to display..."})})}),(0,s.jsxs)(Z.yk,{className:"w-[300px] p-0 overflow-hidden",align:"start",children:[(0,s.jsx)("div",{className:"px-2 py-1.5 border-b",children:(0,s.jsx)("div",{className:"text-sm font-medium",children:"Target Fields"})}),(0,s.jsx)("div",{className:"max-h-[200px] overflow-y-auto overflow-x-hidden p-1.5",style:{overscrollBehavior:"contain",touchAction:"pan-y",WebkitOverflowScrolling:"touch",willChange:"scroll-position",pointerEvents:"auto"},onWheel:e=>e.stopPropagation(),children:H.length>0?H.map(e=>(0,s.jsxs)("div",{className:"flex items-center space-x-2 py-1 px-2 hover:bg-muted rounded cursor-pointer",onClick:()=>{let a=e.value||e;b.includes(a)||w([...b,a])},children:[(0,s.jsx)(O.X,{checked:b.includes(e.value||e),onCheckedChange:a=>{let l=e.value||e;a?w([...b,l]):w(b.filter(e=>e!==l))}}),(0,s.jsx)("span",{className:"text-sm",children:e.title||e.value||e})]},e.value||e)):(0,s.jsx)("div",{className:"text-sm text-muted-foreground p-2",children:"No fields available"})}),(0,s.jsxs)("div",{className:"px-2 py-1.5 border-t",children:[(0,s.jsx)("div",{className:"text-xs font-medium mb-1",children:"Dividers"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-0.5",children:F.map(e=>(0,s.jsx)(c.z,{type:"button",variant:"outline",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>{w([...b,e.value])},children:e.label},e.value))})]})]})]})]}),!ee&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{htmlFor:"alias",children:"Target Alias (optional)"}),(0,s.jsx)(S.I,{id:"alias",placeholder:"Enter alias",value:N.alias,onChange:e=>ei("alias",e.target.value)})]}),!ee&&("M2M"===N.type||"M2A"===N.type)&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(I._,{htmlFor:"through",children:"Junction Table Name"}),(0,s.jsx)(V.pn,{children:(0,s.jsxs)(V.u,{children:[(0,s.jsx)(V.aJ,{asChild:!0,children:(0,s.jsx)(U.Z,{className:"h-4 w-4 text-muted-foreground cursor-help"})}),(0,s.jsx)(V._v,{className:"max-w-xs",children:(0,s.jsx)("p",{children:"Name for the junction table. PostgreSQL limits table names to 63 characters. Modify if the auto-generated name is too long."})})]})})]}),(0,s.jsx)(S.I,{id:"through",placeholder:"Enter junction table name",value:N.through,onChange:e=>ei("through",e.target.value),maxLength:63,className:N.through&&N.through.length>63?"border-red-500":""}),(0,s.jsxs)("p",{className:(0,z.cn)("text-xs",(null===(a=N.through)||void 0===a?void 0:a.length)>63?"text-red-600":(null===(l=N.through)||void 0===l?void 0:l.length)>50?"text-amber-600":"text-muted-foreground"),children:[(null===(d=N.through)||void 0===d?void 0:d.length)||0,"/63 characters",(null===(o=N.through)||void 0===o?void 0:o.length)>63&&" - Name too long!"]})]}),("M2A"===N.type||N.polymorphic)&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{children:"Tables (for Many-to-Any)"}),(0,s.jsxs)(Z.J2,{children:[(0,s.jsx)(Z.xo,{asChild:!0,children:(0,s.jsx)(c.z,{variant:"outline",role:"combobox",className:"w-full justify-start font-normal h-auto min-h-10",children:(null===(h=N.tables)||void 0===h?void 0:h.length)>0?(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:N.tables.map(e=>(0,s.jsxs)(u.C,{variant:"secondary",className:"mr-1",children:[e,(0,s.jsx)("button",{type:"button",className:"ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",onClick:a=>{a.stopPropagation(),ei("tables",N.tables.filter(a=>a!==e))},children:(0,s.jsx)(L.Z,{className:"h-3 w-3"})})]},e))}):(0,s.jsx)("span",{className:"text-muted-foreground",children:"Select tables..."})})}),(0,s.jsx)(Z.yk,{className:"w-[300px] p-0",align:"start",children:(0,s.jsx)("div",{className:"max-h-[200px] overflow-y-auto p-2",children:q.map(e=>{var a;return(0,s.jsxs)("div",{className:"flex items-center space-x-2 py-1.5 px-2 hover:bg-muted rounded cursor-pointer",onClick:()=>{let a=N.tables||[];a.includes(e.id)||ei("tables",[...a,e.id])},children:[(0,s.jsx)(O.X,{checked:null===(a=N.tables)||void 0===a?void 0:a.includes(e.id),onCheckedChange:a=>{let l=N.tables||[];a?ei("tables",[...l,e.id]):ei("tables",l.filter(a=>a!==e.id))}}),(0,s.jsx)("span",{className:"text-sm",children:e.name})]},e.id)})})})]})]}),("M2O"===N.type||"O2O"===N.type)&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(I._,{className:"flex items-center gap-2",children:["On Delete",(0,s.jsx)(V.pn,{children:(0,s.jsxs)(V.u,{children:[(0,s.jsx)(V.aJ,{asChild:!0,children:(0,s.jsx)(U.Z,{className:"h-4 w-4 text-muted-foreground cursor-help"})}),(0,s.jsx)(V._v,{side:"right",className:"max-w-xs",children:(0,s.jsxs)("p",{children:["Action when a record in ",(0,s.jsx)("strong",{children:N.target||"target"})," is deleted"]})})]})})]}),(0,s.jsxs)(k.Ph,{value:N.onDelete,onValueChange:e=>ei("onDelete",e),children:[(0,s.jsx)(k.i4,{className:"[&_span.text-muted-foreground]:hidden",children:(0,s.jsx)(k.ki,{})}),(0,s.jsxs)(k.Bw,{children:[(0,s.jsx)(k.Ql,{value:"CASCADE",children:(0,s.jsxs)("div",{className:"flex flex-col items-start",children:[(0,s.jsx)("span",{children:"CASCADE"}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"Delete related records"})]})}),(0,s.jsx)(k.Ql,{value:"SET NULL",children:(0,s.jsxs)("div",{className:"flex flex-col items-start",children:[(0,s.jsx)("span",{children:"SET NULL"}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"Set reference to null"})]})}),(0,s.jsx)(k.Ql,{value:"RESTRICT",children:(0,s.jsxs)("div",{className:"flex flex-col items-start",children:[(0,s.jsx)("span",{children:"RESTRICT"}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"Prevent delete if referenced"})]})}),(0,s.jsx)(k.Ql,{value:"NO ACTION",children:(0,s.jsxs)("div",{className:"flex flex-col items-start",children:[(0,s.jsx)("span",{children:"NO ACTION"}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"Like RESTRICT, checked at end of transaction"})]})})]})]})]}),("M2O"===N.type||"O2O"===N.type)&&!1!==N.constraints&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(I._,{className:"flex items-center gap-2",children:["On Update",(0,s.jsx)(V.pn,{children:(0,s.jsxs)(V.u,{children:[(0,s.jsx)(V.aJ,{asChild:!0,children:(0,s.jsx)(U.Z,{className:"h-4 w-4 text-muted-foreground cursor-help"})}),(0,s.jsx)(V._v,{side:"right",className:"max-w-xs",children:(0,s.jsxs)("p",{children:["Action when the primary key of ",(0,s.jsx)("strong",{children:N.target||"target"})," is updated"]})})]})})]}),(0,s.jsxs)(k.Ph,{value:N.onUpdate,onValueChange:e=>ei("onUpdate",e),children:[(0,s.jsx)(k.i4,{className:"[&_span.text-muted-foreground]:hidden",children:(0,s.jsx)(k.ki,{})}),(0,s.jsxs)(k.Bw,{children:[(0,s.jsx)(k.Ql,{value:"CASCADE",children:(0,s.jsxs)("div",{className:"flex flex-col items-start",children:[(0,s.jsx)("span",{children:"CASCADE"}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"Update reference automatically"})]})}),(0,s.jsx)(k.Ql,{value:"SET NULL",children:(0,s.jsxs)("div",{className:"flex flex-col items-start",children:[(0,s.jsx)("span",{children:"SET NULL"}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"Set reference to null"})]})}),(0,s.jsx)(k.Ql,{value:"RESTRICT",children:(0,s.jsxs)("div",{className:"flex flex-col items-start",children:[(0,s.jsx)("span",{children:"RESTRICT"}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"Prevent update if referenced"})]})}),(0,s.jsx)(k.Ql,{value:"NO ACTION",children:(0,s.jsxs)("div",{className:"flex flex-col items-start",children:[(0,s.jsx)("span",{children:"NO ACTION"}),(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"Like RESTRICT, checked at end of transaction"})]})})]})]})]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{children:"Field Type"}),(0,s.jsxs)(k.Ph,{value:N.type,onValueChange:e=>ei("type",e),disabled:ee,children:[(0,s.jsx)(k.i4,{children:(0,s.jsx)(k.ki,{placeholder:"Select field type"})}),(0,s.jsxs)(k.Bw,{children:[(0,s.jsxs)(k.DI,{children:[(0,s.jsx)(k.n5,{children:"Text Types"}),Q.text.map(e=>(0,s.jsx)(k.Ql,{value:e.value,children:e.label},e.value))]}),(0,s.jsxs)(k.DI,{children:[(0,s.jsx)(k.n5,{children:"Numeric Types"}),Q.numeric.map(e=>(0,s.jsx)(k.Ql,{value:e.value,children:e.label},e.value))]}),(0,s.jsxs)(k.DI,{children:[(0,s.jsx)(k.n5,{children:"Date Types"}),Q.date.map(e=>(0,s.jsx)(k.Ql,{value:e.value,children:e.label},e.value))]}),(0,s.jsxs)(k.DI,{children:[(0,s.jsx)(k.n5,{children:"Other Types"}),Q.other.map(e=>(0,s.jsx)(k.Ql,{value:e.value,children:e.label},e.value))]}),(0,s.jsxs)(k.DI,{children:[(0,s.jsx)(k.n5,{children:"Array Types"}),Q.array.map(e=>(0,s.jsx)(k.Ql,{value:e.value,children:e.label},e.value))]}),(0,s.jsxs)(k.DI,{children:[(0,s.jsx)(k.n5,{children:"Range Types"}),Q.range.map(e=>(0,s.jsx)(k.Ql,{value:e.value,children:e.label},e.value))]}),(0,s.jsxs)(k.DI,{children:[(0,s.jsx)(k.n5,{children:"Geo Types"}),Q.geo.map(e=>(0,s.jsx)(k.Ql,{value:e.value,children:e.label},e.value))]})]})]})]}),"VIRTUAL"===N.type?(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{htmlFor:"calculated",children:"Calculation String"}),(0,s.jsx)(R.g,{id:"calculated",placeholder:"${this.firstName} ${this.lastName}",value:N.calculated,onChange:e=>ei("calculated",e.target.value)}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Use $","{this.fieldName}"," syntax to reference other fields"]})]}):"ENUM"===N.type?(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{children:"Enum Values"}),(0,s.jsx)(P.OF,{value:N.values||[],onChange:e=>ei("values",e),itemType:"string",placeholder:"Type a value and press Enter"})]}):"String"===N.type?(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{htmlFor:"stringLength",children:"Maximum Length"}),(0,s.jsx)(S.I,{id:"stringLength",type:"number",placeholder:"255",value:N.stringLength||"",onChange:e=>ei("stringLength",e.target.value)})]}):"Decimal"===N.type?(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{htmlFor:"precision",children:"Precision (Total Digits)"}),(0,s.jsx)(S.I,{id:"precision",type:"number",placeholder:"e.g., 10",value:N.precision||"",onChange:e=>ei("precision",e.target.value)}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Total number of digits (before and after decimal point)"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{htmlFor:"scale",children:"Scale (Decimal Places)"}),(0,s.jsx)(S.I,{id:"scale",type:"number",placeholder:"e.g., 2",value:N.scale||"",onChange:e=>ei("scale",e.target.value)}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Number of digits after the decimal point"})]})]}):null,(0,s.jsxs)(s.Fragment,{children:[(()=>{if(!es(N.type))return null;let e=["Integer","BigInt","Array_Integer","Array_BigInt","Range_Integer","Range_BigInt"].includes(N.type),a=N.type.startsWith("Range_"),l=N.type.startsWith("Array_");return(0,s.jsxs)("div",{className:"space-y-4 pt-4 border-t",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(I._,{className:"text-sm font-medium",children:"Validation Rules"}),(0,s.jsx)(V.pn,{children:(0,s.jsxs)(V.u,{children:[(0,s.jsx)(V.aJ,{asChild:!0,children:(0,s.jsx)(U.Z,{className:"h-4 w-4 text-muted-foreground cursor-help"})}),(0,s.jsx)(V._v,{className:"max-w-xs",children:(0,s.jsx)("p",{children:a?"Min/max values apply to both lower and upper bounds of the range.":l?"Min/max values apply to each element in the array.":"Set minimum and maximum allowed values for this field."})})]})})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{htmlFor:"validateMin",children:"Minimum Value"}),(0,s.jsx)(S.I,{id:"validateMin",type:"number",step:e?"1":"any",placeholder:"No minimum",value:N.validateMin,onChange:e=>ei("validateMin",e.target.value)})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{htmlFor:"validateMax",children:"Maximum Value"}),(0,s.jsx)(S.I,{id:"validateMax",type:"number",step:e?"1":"any",placeholder:"No maximum",value:N.validateMax,onChange:e=>ei("validateMax",e.target.value)})]})]}),!e&&(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(O.X,{id:"validateIsInt",checked:N.validateIsInt,onCheckedChange:e=>ei("validateIsInt",!0===e)}),(0,s.jsx)(I._,{htmlFor:"validateIsInt",className:"text-sm font-normal cursor-pointer",children:"Require integer values (no decimals)"})]})]})})(),et(N.type)?(0,s.jsxs)("div",{className:"space-y-4 pt-4 border-t",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(I._,{className:"text-sm font-medium",children:"Validation Rules"}),(0,s.jsx)(V.pn,{children:(0,s.jsxs)(V.u,{children:[(0,s.jsx)(V.aJ,{asChild:!0,children:(0,s.jsx)(U.Z,{className:"h-4 w-4 text-muted-foreground cursor-help"})}),(0,s.jsx)(V._v,{className:"max-w-xs",children:(0,s.jsx)("p",{children:"Configure validation rules for string content and format."})})]})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{className:"text-sm text-muted-foreground",children:"Format Validation"}),(0,s.jsxs)(k.Ph,{value:N.validateIsEmail?"email":N.validateIsUrl?"url":N.validateNotEmpty?"notEmpty":"none",onValueChange:e=>{ei("validateNotEmpty","notEmpty"===e),ei("validateIsEmail","email"===e),ei("validateIsUrl","url"===e)},children:[(0,s.jsx)(k.i4,{children:(0,s.jsx)(k.ki,{placeholder:"No format validation"})}),(0,s.jsxs)(k.Bw,{children:[(0,s.jsx)(k.Ql,{value:"none",children:"No format validation"}),(0,s.jsx)(k.Ql,{value:"notEmpty",children:"Required (cannot be empty)"}),(0,s.jsx)(k.Ql,{value:"email",children:"Must be valid email format"}),(0,s.jsx)(k.Ql,{value:"url",children:"Must be valid URL format"})]})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{htmlFor:"validateMinLength",children:"Min Length"}),(0,s.jsx)(S.I,{id:"validateMinLength",type:"number",min:"0",placeholder:"No minimum",value:N.validateMinLength,onChange:e=>ei("validateMinLength",e.target.value)})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{htmlFor:"validateMaxLength",children:"Max Length"}),(0,s.jsx)(S.I,{id:"validateMaxLength",type:"number",min:"0",placeholder:"No maximum",value:N.validateMaxLength,onChange:e=>ei("validateMaxLength",e.target.value)})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{htmlFor:"validatePattern",children:"Regex Pattern"}),(0,s.jsx)(S.I,{id:"validatePattern",placeholder:"e.g., ^[A-Z]{2}\\\\d{4}$",value:N.validatePattern,onChange:e=>ei("validatePattern",e.target.value)}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Regular expression pattern the value must match"})]})]}):null]}),"VIRTUAL"!==N.type&&(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(I._,{children:"Nullable"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Allow null values for this field"})]}),(0,s.jsx)(A.r,{checked:N.allowNull,onCheckedChange:e=>ei("allowNull",e)})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(I._,{children:"Hidden"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Never return this field in API responses (for sensitive data like passwords)"})]}),(0,s.jsx)(A.r,{checked:N.hidden,onCheckedChange:e=>ei("hidden",e)})]}),"VIRTUAL"!==N.type&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{htmlFor:"defaultValue",children:"Default Value"}),$(N.type)?(0,s.jsxs)(k.Ph,{value:N.defaultValue||"_none_",onValueChange:e=>ei("defaultValue","_none_"===e?"":e),children:[(0,s.jsx)(k.i4,{children:(0,s.jsx)(k.ki,{placeholder:"Select default value"})}),(0,s.jsxs)(k.Bw,{children:[(0,s.jsx)(k.Ql,{value:"_none_",children:"No default"}),(0,s.jsx)(k.Ql,{value:"$NOW",children:"Current Date/Time"})]})]}):"UUID"===N.type?(0,s.jsxs)(k.Ph,{value:N.defaultValue||"_none_",onValueChange:e=>ei("defaultValue","_none_"===e?"":e),children:[(0,s.jsx)(k.i4,{children:(0,s.jsx)(k.ki,{placeholder:"Select default value"})}),(0,s.jsxs)(k.Bw,{children:[(0,s.jsx)(k.Ql,{value:"_none_",children:"No default"}),(0,s.jsx)(k.Ql,{value:"$UUIDV4",children:"Auto-generate UUID"})]})]}):"SUID"===N.type?(0,s.jsxs)(k.Ph,{value:N.defaultValue||"_none_",onValueChange:e=>ei("defaultValue","_none_"===e?"":e),children:[(0,s.jsx)(k.i4,{children:(0,s.jsx)(k.ki,{placeholder:"Select default value"})}),(0,s.jsxs)(k.Bw,{children:[(0,s.jsx)(k.Ql,{value:"_none_",children:"No default"}),(0,s.jsx)(k.Ql,{value:"$SUID",children:"Auto-generate Short UID"})]})]}):"Boolean"===N.type?(0,s.jsxs)(k.Ph,{value:""===N.defaultValue?"_none_":N.defaultValue,onValueChange:e=>ei("defaultValue","_none_"===e?"":e),children:[(0,s.jsx)(k.i4,{children:(0,s.jsx)(k.ki,{placeholder:"Select default value"})}),(0,s.jsxs)(k.Bw,{children:[(0,s.jsx)(k.Ql,{value:"_none_",children:"No default"}),(0,s.jsx)(k.Ql,{value:"true",children:"True"}),(0,s.jsx)(k.Ql,{value:"false",children:"False"})]})]}):"Integer"===N.type||"BigInt"===N.type?(0,s.jsxs)(k.Ph,{value:T?"$CUSTOM":N.defaultValue||"_none_",onValueChange:e=>{"$CUSTOM"===e?(_(!0),ei("defaultValue","")):(_(!1),ei("defaultValue","_none_"===e?"":e))},children:[(0,s.jsx)(k.i4,{children:(0,s.jsx)(k.ki,{placeholder:"Select default value"})}),(0,s.jsxs)(k.Bw,{children:[(0,s.jsx)(k.Ql,{value:"_none_",children:"No default"}),(0,s.jsx)(k.Ql,{value:"$AUTOINCREMENT",children:"Auto-increment"}),(0,s.jsx)(k.Ql,{value:"$CUSTOM",children:"Custom value..."})]})]}):(0,s.jsx)(S.I,{id:"defaultValue",placeholder:"Enter default value",value:N.defaultValue,onChange:e=>ei("defaultValue",e.target.value)}),("Integer"===N.type||"BigInt"===N.type)&&T&&(0,s.jsx)(S.I,{id:"defaultValueCustom",type:"number",placeholder:"Enter numeric default value",className:"mt-2",value:N.defaultValue,onChange:e=>{ei("defaultValue",e.target.value)}})]})]}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 pt-4",children:[(0,s.jsx)(c.z,{type:"button",variant:"outline",onClick:x,children:"Cancel"}),(0,s.jsxs)(c.z,{type:"submit",disabled:ea,children:[ea&&(0,s.jsx)(f.Z,{className:"mr-2 h-4 w-4 animate-spin"}),ee?"Update":"Create"," ",v?"Relationship":"Field"]})]})]})]})})},J=e=>{var a,l;let{open:d,onClose:o,collectionName:x,onSuccess:j}=e,[v,g]=(0,t.useState)(!1),[N,y]=(0,t.useState)(null),[b,I]=(0,t.useState)(!1),[A,k]=(0,t.useState)([]),[T,_]=(0,t.useState)(!1),[R,O]=(0,t.useState)(null),[U,L]=(0,t.useState)(""),{getSchemaByName:V,isLoading:Z,refetch:z}=(0,i.I_)(),P=(0,t.useMemo)(()=>d&&x?{data:V(x)}:null,[d,x,V]),F=(0,t.useMemo)(()=>A.filter(e=>e.name.toLowerCase().includes(U.toLowerCase())),[A,U]),{mutate:Q,isLoading:B}=(0,n.PQ)(),{mutate:$,isLoading:J}=(0,n.R2)();(0,t.useEffect)(()=>{var e,a;(null==P?void 0:null===(a=P.data)||void 0===a?void 0:null===(e=a.schema)||void 0===e?void 0:e.fields)&&k(Object.entries(P.data.schema.fields).map(e=>{let[a,l]=e;return{name:a,...l}}))},[P]);let q=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];y(null),I(e),g(!0)},H=e=>{let a=A.find(a=>a.name===e);y(e),I(!!(null==a?void 0:a.relType)),g(!0)},K=e=>{O(e),_(!0)},X=e=>e.relType?(0,s.jsxs)(u.C,{variant:"outline",className:"gap-1",children:[(0,s.jsx)(D,{className:"h-3 w-3"}),e.relType]}):(0,s.jsx)(u.C,{variant:"secondary",children:e.type});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(C.yo,{open:d,onOpenChange:e=>!e&&o(),children:(0,s.jsx)(C.ue,{className:"!w-full sm:!w-[800px] flex flex-col overflow-hidden p-0",children:(0,s.jsxs)("div",{className:"flex flex-col h-full overflow-hidden p-6",children:[(0,s.jsx)(C.Tu,{children:(0,s.jsxs)(C.bC,{className:"truncate max-w-[250px] sm:max-w-full",children:["Manage Fields - ",null==P?void 0:null===(l=P.data)||void 0===l?void 0:null===(a=l.schema)||void 0===a?void 0:a.name]})}),(0,s.jsxs)("div",{className:"mt-6 space-y-4 flex-1 flex flex-col min-h-0",children:[(0,s.jsxs)("div",{className:"flex gap-2 flex-wrap justify-between items-center",children:[(0,s.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[(0,s.jsxs)(c.z,{onClick:()=>q(!1),size:"sm",children:[(0,s.jsx)(p.Z,{className:"mr-2 h-4 w-4"}),"Add Field"]}),(0,s.jsxs)(c.z,{variant:"outline",size:"sm",onClick:()=>q(!0),children:[(0,s.jsx)(D,{className:"mr-2 h-4 w-4"}),"Add Relationship"]})]}),(0,s.jsxs)("div",{className:"relative w-full sm:w-auto",children:[(0,s.jsx)(M.Z,{className:"absolute left-2.5 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,s.jsx)(S.I,{placeholder:"Search fields...",value:U,onChange:e=>L(e.target.value),className:"pl-8 h-9 w-full sm:w-[200px]"})]})]}),(0,s.jsx)("div",{className:"flex-1 overflow-auto",children:(0,s.jsx)("div",{className:"min-w-[500px]",children:(0,s.jsxs)(h.iA,{children:[(0,s.jsx)(h.xD,{children:(0,s.jsxs)(h.SC,{children:[(0,s.jsx)(h.ss,{children:"Name"}),(0,s.jsx)(h.ss,{children:"Type"}),(0,s.jsx)(h.ss,{children:"Nullable"}),(0,s.jsx)(h.ss,{className:"w-28",children:"Actions"})]})}),(0,s.jsx)(h.RM,{children:Z?(0,s.jsx)(h.SC,{children:(0,s.jsx)(h.pj,{colSpan:4,className:"h-32 text-center",children:(0,s.jsx)(f.Z,{className:"h-6 w-6 animate-spin mx-auto"})})}):0===A.length?(0,s.jsx)(h.SC,{children:(0,s.jsx)(h.pj,{colSpan:4,className:"h-32 text-center text-muted-foreground",children:"No fields defined"})}):0===F.length?(0,s.jsx)(h.SC,{children:(0,s.jsx)(h.pj,{colSpan:4,className:"h-32 text-center text-muted-foreground",children:"No fields match your search"})}):F.map(e=>(0,s.jsxs)(h.SC,{children:[(0,s.jsx)(h.pj,{children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"font-medium",children:e.name}),e.primaryKey&&(0,s.jsx)(u.C,{variant:"default",className:"text-xs",children:"PK"}),e.SystemGenerated&&(0,s.jsx)(u.C,{variant:"outline",className:"text-xs",children:"System"})]})}),(0,s.jsx)(h.pj,{children:X(e)}),(0,s.jsx)(h.pj,{children:e.allowNull?(0,s.jsx)(u.C,{variant:"outline",children:"Yes"}):(0,s.jsx)(u.C,{variant:"secondary",children:"No"})}),(0,s.jsx)(h.pj,{children:(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>H(e.name),children:(0,s.jsx)(E.Z,{className:"h-4 w-4"})}),!e.SystemGenerated&&!e.primaryKey&&(0,s.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",onClick:()=>K(e),children:(0,s.jsx)(w.Z,{className:"h-4 w-4"})})]})})]},e.name))})]})})})]})]})})}),(0,s.jsx)(W,{open:v,onClose:()=>g(!1),collectionName:x,fieldName:N,isRelationship:b,onSuccess:()=>{g(!1),z(),j()}}),(0,s.jsx)(m.aR,{open:T,onOpenChange:_,children:(0,s.jsxs)(m._T,{children:[(0,s.jsxs)(m.fY,{children:[(0,s.jsx)(m.f$,{children:"Delete Field"}),(0,s.jsxs)(m.yT,{children:['Are you sure you want to delete the field "',null==R?void 0:R.name,'"? This action cannot be undone.']})]}),(0,s.jsxs)(m.xo,{children:[(0,s.jsx)(m.le,{children:"Cancel"}),(0,s.jsxs)(m.OL,{onClick:()=>{var e;if(!R)return;let a=V(x);if(!(null==a?void 0:null===(e=a.schema)||void 0===e?void 0:e.fields)||0===Object.keys(a.schema.fields).length){r.Am.error("Unable to get current schema data");return}if(R.relType)$({resource:"relationships",meta:{collectionName:x},id:R.name},{onSuccess:()=>{r.Am.success("Field deleted successfully"),z(),_(!1),O(null)},onError:e=>{r.Am.error("Error deleting field: ".concat(e.message))}});else{let e={...a.schema.fields};delete e[R.name],Q({resource:"collections",id:x,values:{schema:{...a.schema,fields:e}}},{onSuccess:()=>{r.Am.success("Field deleted successfully"),z(),j(),_(!1),O(null)},onError:e=>{r.Am.error("Error deleting field: ".concat(e.message))}})}},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[J||B?(0,s.jsx)(f.Z,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(w.Z,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]})})]})};var q=l(74291);let H=e=>{var a,l;let{open:d,onClose:o,collectionName:x}=e,[j,v]=(0,t.useState)(!1),[g,N]=(0,t.useState)(""),[b,A]=(0,t.useState)([]),[k,T]=(0,t.useState)(!1),[_,D]=(0,t.useState)(!1),[M,E]=(0,t.useState)(!1),[R,U]=(0,t.useState)(null),[L,V]=(0,t.useState)([]),{getSchemaByName:Z,isLoading:z,refetch:P}=(0,i.I_)(),F=(0,t.useMemo)(()=>d&&x?{data:Z(x)}:null,[d,x,Z]),Q=(0,t.useMemo)(()=>{var e,a;return(null==F?void 0:null===(a=F.data)||void 0===a?void 0:null===(e=a.schema)||void 0===e?void 0:e.fields)?Object.keys(F.data.schema.fields):[]},[F]);(0,t.useEffect)(()=>{var e,a;(null==F?void 0:null===(a=F.data)||void 0===a?void 0:null===(e=a.schema)||void 0===e?void 0:e.indexes)?V(F.data.schema.indexes):V([])},[F]);let{mutate:B,isLoading:$}=(0,n.RO)(),{mutate:W,isLoading:J}=(0,n.R2)(),H=()=>{N(""),A([]),T(!1),D(!1)},K=()=>{P()},X=e=>{U(e),E(!0)},Y=e=>{b.includes(e)?A(b.filter(a=>a!==e)):A([...b,e])};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(C.yo,{open:d,onOpenChange:e=>!e&&o(),children:(0,s.jsx)(C.ue,{className:"!w-full sm:!w-[700px] flex flex-col overflow-hidden p-0",children:(0,s.jsxs)("div",{className:"flex flex-col h-full overflow-hidden p-6",children:[(0,s.jsx)(C.Tu,{children:(0,s.jsxs)(C.bC,{className:"truncate max-w-[250px] sm:max-w-full",children:["Manage Indexes - ",null==F?void 0:null===(l=F.data)||void 0===l?void 0:null===(a=l.schema)||void 0===a?void 0:a.name]})}),(0,s.jsxs)("div",{className:"mt-6 space-y-4 flex-1 flex flex-col min-h-0",children:[(0,s.jsxs)(c.z,{onClick:()=>v(!0),size:"sm",children:[(0,s.jsx)(p.Z,{className:"mr-2 h-4 w-4"}),"Add Index"]}),(0,s.jsx)("div",{className:"flex-1 overflow-auto",children:(0,s.jsx)("div",{className:"min-w-[450px]",children:(0,s.jsxs)(h.iA,{children:[(0,s.jsx)(h.xD,{children:(0,s.jsxs)(h.SC,{children:[(0,s.jsx)(h.ss,{children:"Name"}),(0,s.jsx)(h.ss,{children:"Fields"}),(0,s.jsx)(h.ss,{children:"Type"}),(0,s.jsx)(h.ss,{className:"w-20",children:"Actions"})]})}),(0,s.jsx)(h.RM,{children:z?(0,s.jsx)(h.SC,{children:(0,s.jsx)(h.pj,{colSpan:4,className:"h-32 text-center",children:(0,s.jsx)(f.Z,{className:"h-6 w-6 animate-spin mx-auto"})})}):0===L.length?(0,s.jsx)(h.SC,{children:(0,s.jsxs)(h.pj,{colSpan:4,className:"h-32 text-center text-muted-foreground",children:[(0,s.jsx)(y.Z,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),(0,s.jsx)("p",{children:"No indexes defined"})]})}):L.map(e=>(0,s.jsxs)(h.SC,{children:[(0,s.jsx)(h.pj,{className:"font-medium",children:e.name||e.id}),(0,s.jsx)(h.pj,{children:(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:(e.fields||[]).map(e=>(0,s.jsx)(u.C,{variant:"secondary",children:e},e))})}),(0,s.jsx)(h.pj,{children:(0,s.jsxs)("div",{className:"flex items-center gap-1 flex-wrap",children:[e.unique?(0,s.jsx)(u.C,{variant:"default",children:"Unique"}):(0,s.jsx)(u.C,{variant:"outline",children:"Standard"}),e.nullsNotDistinct&&(0,s.jsx)(u.C,{variant:"secondary",className:"text-xs",children:"NULLS NOT DISTINCT"})]})}),(0,s.jsx)(h.pj,{children:(0,s.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",onClick:()=>X(e.name||e.id),children:(0,s.jsx)(w.Z,{className:"h-4 w-4"})})})]},e.name||e.id))})]})})})]})]})})}),(0,s.jsx)(q.Vq,{open:j,onOpenChange:v,children:(0,s.jsxs)(q.cZ,{children:[(0,s.jsx)(q.fK,{children:(0,s.jsx)(q.$N,{children:"Create Index"})}),(0,s.jsxs)("div",{className:"space-y-4 py-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{htmlFor:"indexName",children:"Index Name"}),(0,s.jsx)(S.I,{id:"indexName",placeholder:"Enter index name",value:g,onChange:e=>N(e.target.value)})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I._,{children:"Select Fields"}),(0,s.jsx)("div",{className:"border rounded-md p-3 space-y-2 max-h-48 overflow-y-auto",children:Q.map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(O.X,{id:e,checked:b.includes(e),onCheckedChange:()=>Y(e)}),(0,s.jsx)(I._,{htmlFor:e,className:"cursor-pointer",children:e})]},e))})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(O.X,{id:"unique",checked:k,onCheckedChange:e=>{T(e),e||D(!1)}}),(0,s.jsx)(I._,{htmlFor:"unique",className:"cursor-pointer",children:"Unique Index"})]}),k&&(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(O.X,{id:"nullsNotDistinct",checked:_,onCheckedChange:e=>D(e)}),(0,s.jsxs)(I._,{htmlFor:"nullsNotDistinct",className:"cursor-pointer flex items-center gap-1",children:["Nulls Not Distinct",(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"(treat NULLs as equal)"})]})]})]}),(0,s.jsxs)(q.cN,{children:[(0,s.jsx)(c.z,{variant:"outline",onClick:()=>{H(),v(!1)},children:"Cancel"}),(0,s.jsxs)(c.z,{onClick:()=>{if(!g.trim()){r.Am.error("Please enter an index name");return}if(0===b.length){r.Am.error("Please select at least one field");return}B({resource:"indexes",meta:{collectionName:x},values:{name:g,fields:b,unique:k,...k&&_?{nullsNotDistinct:!0}:{}}},{onSuccess:()=>{r.Am.success("Index created successfully"),H(),v(!1),K()},onError:e=>{r.Am.error("Error creating index: ".concat(e.message))}})},disabled:$,children:[$&&(0,s.jsx)(f.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Create Index"]})]})]})}),(0,s.jsx)(m.aR,{open:M,onOpenChange:E,children:(0,s.jsxs)(m._T,{children:[(0,s.jsxs)(m.fY,{children:[(0,s.jsx)(m.f$,{children:"Delete Index"}),(0,s.jsxs)(m.yT,{children:['Are you sure you want to delete the index "',R,'"? This action cannot be undone.']})]}),(0,s.jsxs)(m.xo,{children:[(0,s.jsx)(m.le,{children:"Cancel"}),(0,s.jsxs)(m.OL,{onClick:()=>{R&&W({resource:"indexes",meta:{collectionName:x},id:R},{onSuccess:()=>{r.Am.success("Index deleted successfully"),E(!1),U(null),K()},onError:e=>{r.Am.error("Error deleting index: ".concat(e.message))}})},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[J?(0,s.jsx)(f.Z,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(w.Z,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]})})]})};var K=l(95937),X=l(90641),Y=l(8227),G=l(40875),ee=l(10407);let ea=(0,_.Z)("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);var el=l(41671);let es=e=>{if(!e)return"disabled";if(!0===e)return"enabled (all actions)";if("object"==typeof e){if(!e.enabled)return"disabled";let a=e.actions||["insert","update","delete"];return"enabled (".concat(a.join(", "),")")}return"disabled"},et=e=>{let{open:a,onClose:l}=e,[d,o]=(0,t.useState)(null),[h,m]=(0,t.useState)(null),[x,v]=(0,t.useState)(["new","modified","deleted"]),[g,N]=(0,t.useState)(!1),y=(0,t.useRef)(null),b=(0,n.Ji)(),{refetch:S}=(0,i.I_)(),{mutate:I,isLoading:A}=(0,n.uC)(),{mutate:k,isLoading:T}=(0,n.uC)(),_=()=>{o(null),m(null),y.current&&(y.current.value="")},D=async e=>{if(!e||!e.name.endsWith(".json")){r.Am.error("Please select a valid JSON file");return}o(e),m(null);let a=new FormData;a.append("schema",e),I({url:"".concat(b,"/schemas-preview-import"),method:"post",values:a},{onSuccess:e=>{m(null==e?void 0:e.data)},onError:e=>{r.Am.error("Preview failed: ".concat(e.message||"Unknown error")),m(null)}})},M=async()=>{if(!d)return;let e=new FormData;e.append("schema",d),k({url:"".concat(b,"/schemas-import"),method:"post",values:e},{onSuccess:()=>{r.Am.success("Schemas imported successfully"),S(),_(),l()},onError:e=>{r.Am.error("Import failed: ".concat(e.message||"Unknown error"))}})},R=e=>{v(a=>a.includes(e)?a.filter(a=>a!==e):[...a,e])},O=function(e,a,l,t){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"default";if(!e||0===e.length)return null;let i=x.includes(t);return(0,s.jsxs)(Y.zF,{open:i,onOpenChange:()=>R(t),children:[(0,s.jsxs)(Y.wy,{className:"flex items-center justify-between w-full p-3 bg-muted/50 rounded-lg hover:bg-muted transition-colors",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[a,(0,s.jsx)("span",{className:"font-medium",children:l}),(0,s.jsx)(u.C,{variant:n,children:e.length})]}),i?(0,s.jsx)(G.Z,{className:"h-4 w-4"}):(0,s.jsx)(ee.Z,{className:"h-4 w-4"})]}),(0,s.jsx)(Y.Fw,{children:(0,s.jsx)("div",{className:"mt-2 space-y-2 pl-4",children:e.map((e,l)=>(0,s.jsxs)("div",{className:"p-2 rounded border bg-background",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[a,(0,s.jsx)("span",{children:"string"==typeof e?e:e.collectionName}),e.differences&&Object.keys(e.differences).length>0&&(0,s.jsxs)(u.C,{variant:"outline",className:"ml-auto",children:[Object.keys(e.differences).length," change(s)"]})]}),e.differences&&Object.keys(e.differences).length>0&&(0,s.jsx)("div",{className:"mt-2 pl-6 text-xs space-y-1",children:Object.entries(e.differences).map(e=>{let[a,l]=e;return(0,s.jsx)("div",{className:"flex items-start gap-2 text-muted-foreground",children:"realtime"===a?(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)(ea,{className:"h-3 w-3"}),(0,s.jsx)("span",{className:"font-medium",children:"Realtime:"}),(0,s.jsx)("span",{className:"text-red-500 line-through",children:es(l.from)}),(0,s.jsx)("span",{children:"→"}),(0,s.jsx)("span",{className:"text-green-500",children:es(l.to)})]}):(0,s.jsxs)("span",{children:[(0,s.jsxs)("span",{className:"font-medium",children:[a,":"]})," ","added"===l.type&&(0,s.jsx)("span",{className:"text-green-500",children:"added"}),"removed"===l.type&&(0,s.jsx)("span",{className:"text-red-500",children:"removed"}),"modified"===l.type&&(0,s.jsx)("span",{className:"text-yellow-500",children:"modified"})]})},a)})})]},l))})})]})},L=h&&(h.changes.new.length>0||h.changes.modified.length>0||h.changes.deleted.length>0);return(0,s.jsx)(C.yo,{open:a,onOpenChange:e=>{e||(_(),l())},children:(0,s.jsxs)(C.ue,{className:"w-[600px] sm:w-[700px] sm:max-w-[700px] flex flex-col",children:[(0,s.jsx)(C.Tu,{children:(0,s.jsx)(C.bC,{children:"Import Schema"})}),(0,s.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col mt-6",children:[(0,s.jsxs)("div",{className:"border-2 border-dashed rounded-lg p-8 text-center cursor-pointer transition-colors flex-shrink-0 ".concat(g?"border-primary bg-primary/5":"hover:border-primary"),onClick:()=>{var e;return null===(e=y.current)||void 0===e?void 0:e.click()},onDragOver:e=>{e.preventDefault(),N(!0)},onDragLeave:e=>{e.preventDefault(),N(!1)},onDrop:e=>{e.preventDefault(),N(!1);let a=e.dataTransfer.files[0];a&&D(a)},children:[(0,s.jsx)(j.Z,{className:"h-10 w-10 mx-auto mb-4 text-muted-foreground"}),d?(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-medium",children:d.name}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"Click or drag to select a different file"})]}):(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"font-medium",children:"Click or drag schema file to upload"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Support for single JSON file upload only"})]}),(0,s.jsx)("input",{ref:y,type:"file",accept:".json",className:"hidden",onChange:e=>{var a;let l=null===(a=e.target.files)||void 0===a?void 0:a[0];l&&D(l)}})]}),A&&(0,s.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,s.jsx)(f.Z,{className:"h-6 w-6 animate-spin mr-2"}),(0,s.jsx)("span",{children:"Analyzing schema changes..."})]}),h&&(0,s.jsx)(X.x,{className:"flex-1 mt-4",children:(0,s.jsxs)("div",{className:"space-y-4 pr-4",children:[(0,s.jsxs)(K.bZ,{children:[(0,s.jsx)(U.Z,{className:"h-4 w-4"}),(0,s.jsx)(K.Cd,{children:"Schema Analysis Complete"}),(0,s.jsxs)(K.X,{children:["Import version: ",h.importVersion," (",h.importTimestamp,")"]})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[O(h.changes.new,(0,s.jsx)(p.Z,{className:"h-4 w-4 text-green-500"}),"New Schemas","new","default"),O(h.changes.modified,(0,s.jsx)(E.Z,{className:"h-4 w-4 text-yellow-500"}),"Modified Schemas","modified","secondary"),O(h.changes.deleted,(0,s.jsx)(w.Z,{className:"h-4 w-4 text-red-500"}),"Deleted Schemas","deleted","destructive"),O(h.changes.unchanged,(0,s.jsx)(el.Z,{className:"h-4 w-4 text-green-500"}),"Unchanged Schemas","unchanged","outline")]}),!L&&(0,s.jsxs)(K.bZ,{children:[(0,s.jsx)(el.Z,{className:"h-4 w-4"}),(0,s.jsx)(K.X,{children:"No changes detected. All schemas are already up to date."})]})]})})]}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 pt-4 border-t mt-4 flex-shrink-0",children:[(0,s.jsx)(c.z,{variant:"outline",onClick:()=>{_(),l()},children:"Cancel"}),h&&(0,s.jsxs)(c.z,{onClick:M,disabled:T,children:[T&&(0,s.jsx)(f.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Confirm Import"]})]})]})})};var en=l(31593);let ei=e=>{let{open:a,onClose:l,onSuccess:d,schema:o,collectionName:u}=e,[h,m]=(0,t.useState)(!1),[x,p]=(0,t.useState)(!1),[j,v]=(0,t.useState)(!1),[g,N]=(0,t.useState)(!1),[y,w]=(0,t.useState)(!1),[S,k]=(0,t.useState)(["insert","update","delete"]),{getSchemaByName:T,refetch:_}=(0,i.I_)(),{mutate:D,isLoading:M}=(0,n.PQ)(),E=a?T(u):null,R=(null==E?void 0:E.schema)||o;(0,t.useEffect)(()=>{if(a&&R){let e=!0===R.timestamps,a=!0===R.usertrack,l=!0===R.paranoid,s=!0===R.sortEnabled,t=!1,n=["insert","update","delete"];!0===R.realtime?t=!0:"object"==typeof R.realtime&&null!==R.realtime&&(t=!0===R.realtime.enabled,n=R.realtime.actions||["insert","update","delete"]),console.log("Schema settings loaded:",{collectionName:u,timestamps:R.timestamps,usertrack:R.usertrack,paranoid:R.paranoid,sortEnabled:R.sortEnabled,realtime:R.realtime,parsed:{ts:e,ut:a,pn:l,se:s,rtEnabled:t,rtActions:n}}),m(e),p(a),v(l),N(s),w(t),k(n)}},[a,u,R]);let U=(e,a)=>{a?k(a=>[...a,e]):k(a=>a.filter(a=>a!==e))};return(0,s.jsx)(C.yo,{open:a,onOpenChange:e=>!e&&l(),children:(0,s.jsx)(C.ue,{className:"!w-full sm:!w-[500px] flex flex-col overflow-hidden p-0",children:(0,s.jsxs)("div",{className:"flex flex-col h-full overflow-hidden p-6",children:[(0,s.jsx)(C.Tu,{className:"flex-shrink-0",children:(0,s.jsxs)(C.bC,{className:"flex items-center gap-2",children:[(0,s.jsx)(b.Z,{className:"h-5 w-5 flex-shrink-0"}),"Schema Settings"]})}),(0,s.jsx)(X.x,{className:"flex-1 mt-6",children:(0,s.jsxs)("div",{className:"space-y-6 pr-4",children:[(0,s.jsxs)("div",{className:"p-4 rounded-lg bg-muted",children:[(0,s.jsx)("p",{className:"text-sm font-medium truncate max-w-[250px] sm:max-w-[400px]",title:null==R?void 0:R.name,children:null==R?void 0:R.name}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground truncate max-w-[250px] sm:max-w-[400px]",title:u,children:["Collection: ",u]})]}),(0,s.jsx)(en.Z,{}),(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(I._,{children:"Timestamps"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Add createdAt and updatedAt fields automatically"})]}),(0,s.jsx)(A.r,{checked:h,onCheckedChange:m})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(I._,{children:"User Tracking"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Track who created and modified records"})]}),(0,s.jsx)(A.r,{checked:x,onCheckedChange:p})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(I._,{children:"Sorting"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Enable sorting capabilities for this collection"})]}),(0,s.jsx)(A.r,{checked:g,onCheckedChange:N})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(I._,{children:"Soft Delete"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Mark records as deleted instead of removing them"}),(null==R?void 0:R.paranoid)&&(0,s.jsx)("p",{className:"text-xs text-amber-600",children:"⚠️ Cannot be disabled once enabled"})]}),(0,s.jsx)(A.r,{checked:j,onCheckedChange:v,disabled:null==R?void 0:R.paranoid})]}),(0,s.jsx)(en.Z,{}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsxs)(I._,{className:"flex items-center gap-2",children:[(0,s.jsx)(ea,{className:"h-4 w-4"}),"Realtime"]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:"Broadcast changes via WebSocket using PostgreSQL WAL"})]}),(0,s.jsx)(A.r,{checked:y,onCheckedChange:w})]}),y&&(0,s.jsxs)("div",{className:"pl-4 space-y-3 border-l-2 border-muted",children:[(0,s.jsx)(I._,{className:"text-xs text-muted-foreground",children:"Broadcast on:"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-4",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(O.X,{id:"rt-insert",checked:S.includes("insert"),onCheckedChange:e=>U("insert",e)}),(0,s.jsx)("label",{htmlFor:"rt-insert",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Insert"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(O.X,{id:"rt-update",checked:S.includes("update"),onCheckedChange:e=>U("update",e)}),(0,s.jsx)("label",{htmlFor:"rt-update",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Update"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,s.jsx)(O.X,{id:"rt-delete",checked:S.includes("delete"),onCheckedChange:e=>U("delete",e)}),(0,s.jsx)("label",{htmlFor:"rt-delete",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Delete"})]})]}),0===S.length&&(0,s.jsx)("p",{className:"text-xs text-amber-600",children:"⚠️ Select at least one action to broadcast"})]})]})]})]})}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 pt-4 border-t mt-4 flex-shrink-0",children:[(0,s.jsx)(c.z,{variant:"outline",onClick:l,children:"Cancel"}),(0,s.jsxs)(c.z,{onClick:()=>{let e=T(u),a=y?{enabled:!0,actions:S}:{enabled:!1,actions:[]};D({resource:"collections",id:u,values:{schema:{...null==e?void 0:e.schema,timestamps:h,usertrack:x,paranoid:j,sortEnabled:g,realtime:a}}},{onSuccess:()=>{r.Am.success("Schema settings updated successfully"),_(),d(),l()},onError:e=>{r.Am.error("Error updating settings: ".concat(e.message))}})},disabled:M,children:[M&&(0,s.jsx)(f.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Save Changes"]})]})]})})})},er=()=>{let[e,a]=(0,t.useState)(!1),[l,C]=(0,t.useState)(!1),[S,I]=(0,t.useState)(!1),[A,k]=(0,t.useState)(!1),[_,D]=(0,t.useState)(!1),[M,E]=(0,t.useState)(null),[R,O]=(0,t.useState)(null),[U,L]=(0,t.useState)(""),[V,Z]=(0,t.useState)(!1),[z,P]=(0,t.useState)(null),F=(0,n.Ji)(),{schemas:Q,isLoading:B,refetch:$}=(0,i.I_)(),{mutate:W,isLoading:q}=(0,n.R2)(),K=(0,t.useMemo)(()=>Q&&U.trim()?Q.filter(e=>{var a,l,s;let t=(null==e?void 0:null===(l=e.schema)||void 0===l?void 0:null===(a=l.name)||void 0===a?void 0:a.toLowerCase())||"",n=(null==e?void 0:null===(s=e.collectionName)||void 0===s?void 0:s.toLowerCase())||"",i=U.toLowerCase();return t.includes(i)||n.includes(i)}):Q||[],[Q,U]),X=e=>{E(e),C(!0)},Y=e=>{E(e),I(!0)},G=e=>{E(e.collectionName),O(e.schema),D(!0)},ee=e=>{P(e),Z(!0)},{refetch:ea}=(0,n.EV)({url:"".concat(F,"/schemas-export"),method:"get",queryOptions:{enabled:!1,retry:!1}}),el=async()=>{try{var e;let a=await ea(),l=null==a?void 0:a.data;if(!(null==l?void 0:l.data)){r.Am.error("No schemas found to export");return}let s=window.URL.createObjectURL(new Blob([JSON.stringify(l.data)])),t=document.createElement("a");t.href=s,t.setAttribute("download","schema-export-".concat((null===(e=l.data)||void 0===e?void 0:e.timestamp)||Date.now(),".json")),document.body.appendChild(t),t.click(),t.remove(),r.Am.success("Schemas exported successfully")}catch(e){r.Am.error("Error exporting schemas: ".concat(e.message))}},es=e=>Object.keys((null==e?void 0:e.fields)||{}).length;return(0,s.jsxs)("div",{className:"flex flex-col h-full overflow-hidden gap-2",children:[(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-2 flex-shrink-0",children:[(0,s.jsx)("h1",{className:"text-lg font-semibold",children:"Collections Management"}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)(o.t,{value:U,onChange:L,placeholder:"Search collections...",expandedWidth:"w-64"}),(0,s.jsx)(c.z,{variant:"outline",size:"icon",onClick:()=>$(),children:(0,s.jsx)(x.Z,{className:"h-4 w-4"})}),(0,s.jsxs)(c.z,{onClick:()=>a(!0),children:[(0,s.jsx)(p.Z,{className:"mr-2 h-4 w-4"}),"Create Schema"]}),(0,s.jsxs)(c.z,{variant:"outline",onClick:()=>k(!0),children:[(0,s.jsx)(j.Z,{className:"mr-2 h-4 w-4"}),"Import"]}),(0,s.jsxs)(c.z,{variant:"outline",onClick:el,children:[(0,s.jsx)(v.Z,{className:"mr-2 h-4 w-4"}),"Export"]})]})]}),(0,s.jsx)(d.Zb,{className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:(0,s.jsx)("div",{className:"flex-1 overflow-auto",children:(0,s.jsxs)("table",{className:"w-full min-w-max",children:[(0,s.jsx)("thead",{className:"sticky top-0 z-10 bg-background border-b",children:(0,s.jsxs)(h.SC,{children:[(0,s.jsx)(h.ss,{children:"Schema Name"}),(0,s.jsx)(h.ss,{children:"Fields"}),(0,s.jsx)(h.ss,{children:"Options"}),(0,s.jsx)(h.ss,{className:"w-64",children:"Actions"})]})}),(0,s.jsx)("tbody",{children:B?(0,s.jsx)(h.SC,{children:(0,s.jsx)(h.pj,{colSpan:4,className:"h-48 text-center",children:(0,s.jsx)(f.Z,{className:"h-8 w-8 animate-spin mx-auto"})})}):0===K.length?(0,s.jsx)(h.SC,{children:(0,s.jsxs)(h.pj,{colSpan:4,className:"h-48 text-center text-muted-foreground",children:[(0,s.jsx)(g.Z,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),(0,s.jsx)("p",{children:"No collections found"}),(0,s.jsxs)(c.z,{variant:"outline",className:"mt-4",onClick:()=>a(!0),children:[(0,s.jsx)(p.Z,{className:"mr-2 h-4 w-4"}),"Create your first collection"]})]})}):K.map(e=>{var a,l,t,n,i;return(0,s.jsxs)(h.SC,{children:[(0,s.jsx)(h.pj,{children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(g.Z,{className:"h-4 w-4 text-muted-foreground"}),(0,s.jsxs)("div",{className:"flex flex-col",children:[(0,s.jsx)("span",{className:"font-medium",children:null===(a=e.schema)||void 0===a?void 0:a.name}),(null===(l=e.schema)||void 0===l?void 0:l.name)!==e.collectionName&&(0,s.jsx)("code",{className:"text-xs text-muted-foreground bg-muted px-1 py-0.5 rounded w-fit",children:e.collectionName})]})]})}),(0,s.jsx)(h.pj,{children:(0,s.jsxs)(u.C,{variant:"secondary",children:[es(e.schema)," fields"]})}),(0,s.jsx)(h.pj,{children:(0,s.jsxs)("div",{className:"flex flex-wrap gap-1",children:[(null===(t=e.schema)||void 0===t?void 0:t.timestamps)&&(0,s.jsx)(u.C,{variant:"outline",className:"text-xs",children:"Timestamps"}),(null===(n=e.schema)||void 0===n?void 0:n.paranoid)&&(0,s.jsx)(u.C,{variant:"outline",className:"text-xs",children:"Soft Delete"}),(null===(i=e.schema)||void 0===i?void 0:i.usertrack)&&(0,s.jsx)(u.C,{variant:"outline",className:"text-xs",children:"Audit"})]})}),(0,s.jsx)(h.pj,{children:(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsxs)(c.z,{variant:"outline",size:"sm",onClick:()=>X(e.collectionName),children:[(0,s.jsx)(N.Z,{className:"mr-1 h-3 w-3"}),"Fields"]}),(0,s.jsxs)(c.z,{variant:"outline",size:"sm",onClick:()=>Y(e.collectionName),children:[(0,s.jsx)(y.Z,{className:"mr-1 h-3 w-3"}),"Indexes"]}),(0,s.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>G(e),children:(0,s.jsx)(b.Z,{className:"h-4 w-4"})}),!e.collectionName.includes("baasix_")&&(0,s.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",onClick:()=>ee(e.collectionName),children:(0,s.jsx)(w.Z,{className:"h-4 w-4"})})]})})]},e.collectionName)})})]})})}),(0,s.jsx)(T,{open:e,onClose:()=>a(!1),onSuccess:()=>{a(!1),$()}}),M&&(0,s.jsx)(J,{open:l,onClose:()=>C(!1),collectionName:M,onSuccess:()=>$()}),M&&(0,s.jsx)(H,{open:S,onClose:()=>I(!1),collectionName:M}),(0,s.jsx)(et,{open:A,onClose:()=>{k(!1),$()}}),M&&R&&(0,s.jsx)(ei,{open:_,onClose:()=>D(!1),onSuccess:()=>$(),schema:R,collectionName:M}),(0,s.jsx)(m.aR,{open:V,onOpenChange:Z,children:(0,s.jsxs)(m._T,{children:[(0,s.jsxs)(m.fY,{children:[(0,s.jsx)(m.f$,{children:"Delete Schema"}),(0,s.jsxs)(m.yT,{children:['Are you sure you want to delete the schema "',z,'"? This action cannot be undone and will remove all data in this collection.']})]}),(0,s.jsxs)(m.xo,{children:[(0,s.jsx)(m.le,{children:"Cancel"}),(0,s.jsxs)(m.OL,{onClick:()=>{z&&W({resource:"collections",id:z},{onSuccess:()=>{r.Am.success("Schema deleted successfully"),Z(!1),P(null),$()},onError:e=>{r.Am.error("Error deleting schema: ".concat(e.message))}})},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[q?(0,s.jsx)(f.Z,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(w.Z,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]})})]})};var ed=()=>(0,s.jsx)(er,{})},30767:function(e,a,l){"use strict";l.d(a,{OL:function(){return v},_T:function(){return h},aR:function(){return d},f$:function(){return p},fY:function(){return m},le:function(){return f},vW:function(){return c},xo:function(){return x},yT:function(){return j}});var s=l(57437),t=l(2265),n=l(16720),i=l(93448),r=l(12381);let d=n.fC,c=n.xz,o=n.h_,u=t.forwardRef((e,a)=>{let{className:l,...t}=e;return(0,s.jsx)(n.aV,{className:(0,i.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",l),...t,ref:a})});u.displayName="AlertDialogOverlay";let h=t.forwardRef((e,a)=>{let{className:l,...t}=e;return(0,s.jsxs)(o,{children:[(0,s.jsx)(u,{}),(0,s.jsx)(n.VY,{ref:a,className:(0,i.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",l),...t})]})});h.displayName="AlertDialogContent";let m=e=>{let{className:a,...l}=e;return(0,s.jsx)("div",{className:(0,i.cn)("flex flex-col space-y-2 text-center sm:text-left",a),...l})};m.displayName="AlertDialogHeader";let x=e=>{let{className:a,...l}=e;return(0,s.jsx)("div",{className:(0,i.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",a),...l})};x.displayName="AlertDialogFooter";let p=t.forwardRef((e,a)=>{let{className:l,...t}=e;return(0,s.jsx)(n.Dx,{ref:a,className:(0,i.cn)("text-lg font-semibold",l),...t})});p.displayName="AlertDialogTitle";let j=t.forwardRef((e,a)=>{let{className:l,...t}=e;return(0,s.jsx)(n.dk,{ref:a,className:(0,i.cn)("text-sm text-muted-foreground",l),...t})});j.displayName="AlertDialogDescription";let v=t.forwardRef((e,a)=>{let{className:l,...t}=e;return(0,s.jsx)(n.aU,{ref:a,className:(0,i.cn)((0,r.d)(),l),...t})});v.displayName="AlertDialogAction";let f=t.forwardRef((e,a)=>{let{className:l,...t}=e;return(0,s.jsx)(n.$j,{ref:a,className:(0,i.cn)((0,r.d)({variant:"outline"}),"mt-2 sm:mt-0",l),...t})});f.displayName="AlertDialogCancel"},8227:function(e,a,l){"use strict";l.d(a,{Fw:function(){return i},wy:function(){return n},zF:function(){return t}}),l(2265);var s=l(962);let t=s.fC,n=s.wy,i=s.Fw},31593:function(e,a,l){"use strict";l.d(a,{Z:function(){return r}});var s=l(57437),t=l(2265),n=l(90759),i=l(93448);let r=t.forwardRef((e,a)=>{let{className:l,orientation:t="horizontal",decorative:r=!0,...d}=e;return(0,s.jsx)(n.f,{ref:a,decorative:r,orientation:t,className:(0,i.cn)("shrink-0 bg-border","horizontal"===t?"h-[1px] w-full":"h-full w-[1px]",l),...d})});r.displayName=n.f.displayName},962:function(e,a,l){"use strict";l.d(a,{Fw:function(){return b},VY:function(){return A},fC:function(){return S},p_:function(){return p},wy:function(){return N},xz:function(){return I}});var s=l(2265),t=l(6741),n=l(73966),i=l(80886),r=l(61188),d=l(98575),c=l(82912),o=l(71599),u=l(99255),h=l(57437),m="Collapsible",[x,p]=(0,n.b)(m),[j,v]=x(m),f=s.forwardRef((e,a)=>{let{__scopeCollapsible:l,open:t,defaultOpen:n,disabled:r,onOpenChange:d,...o}=e,[x,p]=(0,i.T)({prop:t,defaultProp:null!=n&&n,onChange:d,caller:m});return(0,h.jsx)(j,{scope:l,disabled:r,contentId:(0,u.M)(),open:x,onOpenToggle:s.useCallback(()=>p(e=>!e),[p]),children:(0,h.jsx)(c.WV.div,{"data-state":C(x),"data-disabled":r?"":void 0,...o,ref:a})})});f.displayName=m;var g="CollapsibleTrigger",N=s.forwardRef((e,a)=>{let{__scopeCollapsible:l,...s}=e,n=v(g,l);return(0,h.jsx)(c.WV.button,{type:"button","aria-controls":n.contentId,"aria-expanded":n.open||!1,"data-state":C(n.open),"data-disabled":n.disabled?"":void 0,disabled:n.disabled,...s,ref:a,onClick:(0,t.Mj)(e.onClick,n.onOpenToggle)})});N.displayName=g;var y="CollapsibleContent",b=s.forwardRef((e,a)=>{let{forceMount:l,...s}=e,t=v(y,e.__scopeCollapsible);return(0,h.jsx)(o.z,{present:l||t.open,children:e=>{let{present:l}=e;return(0,h.jsx)(w,{...s,ref:a,present:l})}})});b.displayName=y;var w=s.forwardRef((e,a)=>{let{__scopeCollapsible:l,present:t,children:n,...i}=e,o=v(y,l),[u,m]=s.useState(t),x=s.useRef(null),p=(0,d.e)(a,x),j=s.useRef(0),f=j.current,g=s.useRef(0),N=g.current,b=o.open||u,w=s.useRef(b),S=s.useRef(void 0);return s.useEffect(()=>{let e=requestAnimationFrame(()=>w.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,r.b)(()=>{let e=x.current;if(e){S.current=S.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let a=e.getBoundingClientRect();j.current=a.height,g.current=a.width,w.current||(e.style.transitionDuration=S.current.transitionDuration,e.style.animationName=S.current.animationName),m(t)}},[o.open,t]),(0,h.jsx)(c.WV.div,{"data-state":C(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!b,...i,ref:p,style:{"--radix-collapsible-content-height":f?"".concat(f,"px"):void 0,"--radix-collapsible-content-width":N?"".concat(N,"px"):void 0,...e.style},children:b&&n})});function C(e){return e?"open":"closed"}var S=f,I=N,A=b},370:function(e,a,l){"use strict";l.d(a,{f:function(){return d}});var s=l(2265);l(54887);var t=l(37053),n=l(57437),i=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,a)=>{let l=(0,t.Z8)(`Primitive.${a}`),i=s.forwardRef((e,s)=>{let{asChild:t,...i}=e,r=t?l:a;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,n.jsx)(r,{...i,ref:s})});return i.displayName=`Primitive.${a}`,{...e,[a]:i}},{}),r=s.forwardRef((e,a)=>(0,n.jsx)(i.label,{...e,ref:a,onMouseDown:a=>{var l;a.target.closest("button, input, select, textarea")||(null===(l=e.onMouseDown)||void 0===l||l.call(e,a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));r.displayName="Label";var d=r},90759:function(e,a,l){"use strict";l.d(a,{f:function(){return o}});var s=l(2265);l(54887);var t=l(37053),n=l(57437),i=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,a)=>{let l=(0,t.Z8)(`Primitive.${a}`),i=s.forwardRef((e,s)=>{let{asChild:t,...i}=e,r=t?l:a;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,n.jsx)(r,{...i,ref:s})});return i.displayName=`Primitive.${a}`,{...e,[a]:i}},{}),r="horizontal",d=["horizontal","vertical"],c=s.forwardRef((e,a)=>{let{decorative:l,orientation:s=r,...t}=e,c=d.includes(s)?s:r;return(0,n.jsx)(i.div,{"data-orientation":c,...l?{role:"none"}:{"aria-orientation":"vertical"===c?c:void 0,role:"separator"},...t,ref:a})});c.displayName="Separator";var o=c}},function(e){e.O(0,[7999,3572,7902,5094,4438,6530,4475,6241,926,600,1668,1509,9487,1783,9881,7324,3563,2667,4033,2971,2117,1744],function(){return e(e.s=49204)}),_N_E=e.O()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8888],{87949:function(e,t,s){Promise.resolve().then(s.bind(s,99502))},40875:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(79205).Z)("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},10407:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(79205).Z)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},33003:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(79205).Z)("Columns3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]])},82431:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(79205).Z)("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]])},73247:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(79205).Z)("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]])},18930:function(e,t,s){"use strict";s.d(t,{Z:function(){return n}});let n=(0,s(79205).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},99502:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return I}});var n=s(57437),a=s(2265),l=s(72135),r=s(14438),i=s(79820),c=s(12381),o=s(69174),d=s(17168),m=s(90641),u=s(69140),h=s(33804),f=s(8227),x=s(30767),p=s(40875),j=s(10407),b=s(71947),v=s(50091),g=s(18930),y=s(51817),N=s(82431),w=s(76865),C=s(33003),D=s(92934);let k=(0,s(79205).Z)("TableProperties",[["path",{d:"M15 3v18",key:"14nvp0"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);var O=s(43368);let Z=e=>{let{label:t,value:s,variant:a="default",icon:l}=e;return(0,n.jsx)(i.Zb,{className:"".concat({default:"border-border",warning:s>0?"border-yellow-500/50 bg-yellow-500/5":"border-border",success:"border-green-500/50 bg-green-500/5"}[a]),children:(0,n.jsx)(i.aY,{className:"p-4",children:(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[(0,n.jsx)("div",{className:"text-muted-foreground",children:l}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-2xl font-bold",children:s}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:t})]})]})})})},S=e=>{let{diff:t,onDeleteField:s}=e,[l,r]=(0,a.useState)(!1);return(0,n.jsxs)(f.zF,{open:l,onOpenChange:r,children:[(0,n.jsx)(f.wy,{asChild:!0,children:(0,n.jsxs)("button",{className:"flex w-full items-center justify-between rounded-md border p-3 text-left hover:bg-accent transition-colors",children:[(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[l?(0,n.jsx)(p.Z,{className:"h-4 w-4 text-muted-foreground"}):(0,n.jsx)(j.Z,{className:"h-4 w-4 text-muted-foreground"}),(0,n.jsx)("span",{className:"font-medium",children:t.collection})]}),(0,n.jsxs)("div",{className:"flex gap-2",children:[t.fieldsOnlyInSchema.length>0&&(0,n.jsxs)(o.C,{variant:"outline",className:"bg-blue-500/10 text-blue-700 dark:text-blue-300 border-blue-500/30",children:[(0,n.jsx)(b.Z,{className:"h-3 w-3 mr-1"}),t.fieldsOnlyInSchema.length," only in schema"]}),t.fieldsOnlyInDb.length>0&&(0,n.jsxs)(o.C,{variant:"outline",className:"bg-orange-500/10 text-orange-700 dark:text-orange-300 border-orange-500/30",children:[(0,n.jsx)(v.Z,{className:"h-3 w-3 mr-1"}),t.fieldsOnlyInDb.length," only in DB"]})]})]})}),(0,n.jsx)(f.Fw,{children:(0,n.jsxs)("div",{className:"ml-7 mt-2 space-y-3 pb-2",children:[t.fieldsOnlyInSchema.length>0&&(0,n.jsxs)("div",{children:[(0,n.jsxs)("p",{className:"text-sm font-medium text-blue-700 dark:text-blue-300 mb-1 flex items-center gap-1",children:[(0,n.jsx)(b.Z,{className:"h-3.5 w-3.5"}),"In schema definition, missing from database"]}),(0,n.jsxs)(h.iA,{children:[(0,n.jsx)(h.xD,{children:(0,n.jsxs)(h.SC,{children:[(0,n.jsx)(h.ss,{className:"w-[200px]",children:"Column"}),(0,n.jsx)(h.ss,{className:"w-[120px]",children:"Type"}),(0,n.jsx)(h.ss,{children:"Source Field"}),(0,n.jsx)(h.ss,{className:"w-[80px] text-right",children:"Action"})]})}),(0,n.jsx)(h.RM,{children:t.fieldsOnlyInSchema.map(e=>(0,n.jsxs)(h.SC,{children:[(0,n.jsx)(h.pj,{className:"font-mono text-sm",children:e.column}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(o.C,{variant:"secondary",children:e.type})}),(0,n.jsx)(h.pj,{className:"text-muted-foreground text-sm",children:e.fromField}),(0,n.jsx)(h.pj,{className:"text-right",children:(0,n.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>s(t.collection,e.fromField,"schema"),title:"Remove from schema",children:(0,n.jsx)(g.Z,{className:"h-3.5 w-3.5"})})})]},e.column))})]})]}),t.fieldsOnlyInDb.length>0&&(0,n.jsxs)("div",{children:[(0,n.jsxs)("p",{className:"text-sm font-medium text-orange-700 dark:text-orange-300 mb-1 flex items-center gap-1",children:[(0,n.jsx)(v.Z,{className:"h-3.5 w-3.5"}),"In database, missing from schema definition"]}),(0,n.jsxs)(h.iA,{children:[(0,n.jsx)(h.xD,{children:(0,n.jsxs)(h.SC,{children:[(0,n.jsx)(h.ss,{className:"w-[200px]",children:"Column"}),(0,n.jsx)(h.ss,{className:"w-[120px]",children:"Data Type"}),(0,n.jsx)(h.ss,{className:"w-[100px]",children:"Nullable"}),(0,n.jsx)(h.ss,{children:"Default"}),(0,n.jsx)(h.ss,{className:"w-[80px] text-right",children:"Action"})]})}),(0,n.jsx)(h.RM,{children:t.fieldsOnlyInDb.map(e=>(0,n.jsxs)(h.SC,{children:[(0,n.jsx)(h.pj,{className:"font-mono text-sm",children:e.column}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(o.C,{variant:"secondary",children:e.dataType})}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(o.C,{variant:"YES"===e.isNullable?"outline":"default",children:"YES"===e.isNullable?"Yes":"No"})}),(0,n.jsx)(h.pj,{className:"text-muted-foreground text-sm font-mono max-w-[300px] truncate",children:e.columnDefault||"—"}),(0,n.jsx)(h.pj,{className:"text-right",children:(0,n.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>s(t.collection,e.column,"db"),title:"Drop from database",children:(0,n.jsx)(g.Z,{className:"h-3.5 w-3.5"})})})]},e.column))})]})]})]})})]})},R=()=>{var e;let t=(0,l.Ji)(),[s,h]=(0,a.useState)("overview"),[f,p]=(0,a.useState)(""),[j,R]=(0,a.useState)({open:!1,title:"",description:"",action:()=>{}}),{data:I,isLoading:T,refetch:A,isRefetching:F}=(0,l.EV)({url:"".concat(t,"/utils/schema-diff"),method:"get"}),{mutate:M,isLoading:z}=(0,l.uC)(),V=null==I?void 0:null===(e=I.data)||void 0===e?void 0:e.data,Y=e=>{R({open:!0,title:'Remove "'.concat(e,'" from schema?'),description:'This will remove the schema definition for "'.concat(e,'". The database table will NOT be affected. The collection will no longer be managed by baasix.'),action:()=>{M({url:"".concat(t,"/utils/schema-diff/table/schema/").concat(encodeURIComponent(e)),method:"delete",values:{}},{onSuccess:()=>{r.Am.success('Schema definition "'.concat(e,'" removed')),A()},onError:t=>{r.Am.error((null==t?void 0:t.message)||'Failed to remove schema "'.concat(e,'"'))}})}})},L=e=>{R({open:!0,title:'Drop table "'.concat(e,'" from database?'),description:'This will permanently DROP the table "'.concat(e,'" and all its data from the database. This action cannot be undone.'),action:()=>{M({url:"".concat(t,"/utils/schema-diff/table/db/").concat(encodeURIComponent(e)),method:"delete",values:{}},{onSuccess:()=>{r.Am.success('Table "'.concat(e,'" dropped from database')),A()},onError:t=>{r.Am.error((null==t?void 0:t.message)||'Failed to drop table "'.concat(e,'"'))}})}})},E=(e,s,n)=>{"schema"===n?R({open:!0,title:'Remove field "'.concat(s,'" from schema?'),description:'This will remove the field "'.concat(s,'" from the schema definition of "').concat(e,'". The database column will NOT be affected.'),action:()=>{M({url:"".concat(t,"/utils/schema-diff/field/schema/").concat(encodeURIComponent(e),"/").concat(encodeURIComponent(s)),method:"delete",values:{}},{onSuccess:()=>{r.Am.success('Field "'.concat(s,'" removed from schema of "').concat(e,'"')),A()},onError:e=>{r.Am.error((null==e?void 0:e.message)||'Failed to remove field "'.concat(s,'"'))}})}}):R({open:!0,title:'Drop column "'.concat(s,'" from database?'),description:'This will permanently DROP the column "'.concat(s,'" from table "').concat(e,'" in the database. All data in this column will be lost. This action cannot be undone.'),action:()=>{M({url:"".concat(t,"/utils/schema-diff/field/db/").concat(encodeURIComponent(e),"/").concat(encodeURIComponent(s)),method:"delete",values:{}},{onSuccess:()=>{r.Am.success('Column "'.concat(s,'" dropped from table "').concat(e,'"')),A()},onError:e=>{r.Am.error((null==e?void 0:e.message)||'Failed to drop column "'.concat(s,'"'))}})}})},_=(0,a.useMemo)(()=>{if(!(null==V?void 0:V.fieldDiffs))return[];if(!f)return V.fieldDiffs;let e=f.toLowerCase();return V.fieldDiffs.filter(t=>t.collection.toLowerCase().includes(e)||t.fieldsOnlyInSchema.some(t=>t.column.toLowerCase().includes(e))||t.fieldsOnlyInDb.some(t=>t.column.toLowerCase().includes(e)))},[null==V?void 0:V.fieldDiffs,f]),U=(0,a.useMemo)(()=>{if(!(null==V?void 0:V.tablesOnlyInSchema))return[];if(!f)return V.tablesOnlyInSchema;let e=f.toLowerCase();return V.tablesOnlyInSchema.filter(t=>t.toLowerCase().includes(e))},[null==V?void 0:V.tablesOnlyInSchema,f]),W=(0,a.useMemo)(()=>{if(!(null==V?void 0:V.tablesOnlyInDb))return[];if(!f)return V.tablesOnlyInDb;let e=f.toLowerCase();return V.tablesOnlyInDb.filter(t=>t.toLowerCase().includes(e))},[null==V?void 0:V.tablesOnlyInDb,f]),P=V&&(V.summary.tablesOnlyInSchemaCount>0||V.summary.tablesOnlyInDbCount>0||V.summary.collectionsWithFieldDiffs>0);return T?(0,n.jsxs)("div",{className:"p-6 space-y-4",children:[(0,n.jsx)(u.O,{className:"h-8 w-48"}),(0,n.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-3 lg:grid-cols-5 gap-4",children:Array.from({length:5}).map((e,t)=>(0,n.jsx)(u.O,{className:"h-20"},t))}),(0,n.jsx)(u.O,{className:"h-64"})]}):(0,n.jsxs)("div",{className:"p-6 space-y-6 overflow-auto flex-1",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:"Schema & Database Diff"}),(0,n.jsx)("p",{className:"text-muted-foreground text-sm mt-1",children:"Compare schema definitions with actual database structure to find inconsistencies."})]}),(0,n.jsxs)(c.z,{variant:"outline",size:"sm",onClick:()=>A(),disabled:F,children:[F?(0,n.jsx)(y.Z,{className:"h-4 w-4 mr-2 animate-spin"}):(0,n.jsx)(N.Z,{className:"h-4 w-4 mr-2"}),"Refresh"]})]}),V&&(0,n.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-4",children:[(0,n.jsx)(Z,{label:"Schema Collections",value:V.summary.totalSchemaCollections,icon:(0,n.jsx)(b.Z,{className:"h-5 w-5"})}),(0,n.jsx)(Z,{label:"Database Tables",value:V.summary.totalDbTables,icon:(0,n.jsx)(v.Z,{className:"h-5 w-5"})}),(0,n.jsx)(Z,{label:"Tables Only in Schema",value:V.summary.tablesOnlyInSchemaCount,variant:"warning",icon:(0,n.jsx)(w.Z,{className:"h-5 w-5"})}),(0,n.jsx)(Z,{label:"Tables Only in DB",value:V.summary.tablesOnlyInDbCount,variant:"warning",icon:(0,n.jsx)(w.Z,{className:"h-5 w-5"})}),(0,n.jsx)(Z,{label:"Field Mismatches",value:V.summary.collectionsWithFieldDiffs,variant:"warning",icon:(0,n.jsx)(C.Z,{className:"h-5 w-5"})})]}),V&&!P&&(0,n.jsx)(i.Zb,{className:"border-green-500/50 bg-green-500/5",children:(0,n.jsxs)(i.aY,{className:"p-4 flex items-center gap-3",children:[(0,n.jsx)(D.Z,{className:"h-5 w-5 text-green-600"}),(0,n.jsx)("p",{className:"text-sm font-medium text-green-700 dark:text-green-300",children:"Schema and database are fully in sync. No differences found."})]})}),V&&P&&(0,n.jsxs)(d.mQ,{value:s,onValueChange:h,children:[(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)(d.dr,{children:[(0,n.jsxs)(d.SP,{value:"overview",className:"flex items-center gap-1",children:[(0,n.jsx)(k,{className:"h-3.5 w-3.5"}),"Tables"]}),(0,n.jsxs)(d.SP,{value:"fields",className:"flex items-center gap-1",children:[(0,n.jsx)(C.Z,{className:"h-3.5 w-3.5"}),"Fields",V.summary.collectionsWithFieldDiffs>0&&(0,n.jsx)(o.C,{variant:"secondary",className:"ml-1 h-5 px-1.5",children:V.summary.collectionsWithFieldDiffs})]})]}),(0,n.jsx)(O.t,{value:f,onChange:p})]}),(0,n.jsx)(d.nU,{value:"overview",className:"space-y-4 mt-4",children:(0,n.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,n.jsxs)(i.Zb,{children:[(0,n.jsxs)(i.Ol,{className:"pb-3",children:[(0,n.jsxs)(i.ll,{className:"text-base flex items-center gap-2",children:[(0,n.jsx)(b.Z,{className:"h-4 w-4 text-blue-500"}),"Tables Only in Schema"]}),(0,n.jsx)(i.SZ,{children:"Defined in schema but no corresponding database table exists."})]}),(0,n.jsx)(i.aY,{children:0===U.length?(0,n.jsx)("p",{className:"text-sm text-muted-foreground py-4 text-center",children:0===V.summary.tablesOnlyInSchemaCount?"No mismatches":"No results match your search"}):(0,n.jsx)(m.x,{className:U.length>10?"h-[300px]":"",children:(0,n.jsx)("div",{className:"space-y-1",children:U.map(e=>(0,n.jsxs)("div",{className:"flex items-center justify-between rounded-md border px-3 py-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(k,{className:"h-4 w-4 text-muted-foreground"}),(0,n.jsx)("span",{className:"font-mono text-sm",children:e})]}),(0,n.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>Y(e),title:"Remove from schema",children:(0,n.jsx)(g.Z,{className:"h-3.5 w-3.5"})})]},e))})})})]}),(0,n.jsxs)(i.Zb,{children:[(0,n.jsxs)(i.Ol,{className:"pb-3",children:[(0,n.jsxs)(i.ll,{className:"text-base flex items-center gap-2",children:[(0,n.jsx)(v.Z,{className:"h-4 w-4 text-orange-500"}),"Tables Only in Database"]}),(0,n.jsx)(i.SZ,{children:"Exist in the database but have no schema definition."})]}),(0,n.jsx)(i.aY,{children:0===W.length?(0,n.jsx)("p",{className:"text-sm text-muted-foreground py-4 text-center",children:0===V.summary.tablesOnlyInDbCount?"No mismatches":"No results match your search"}):(0,n.jsx)(m.x,{className:W.length>10?"h-[300px]":"",children:(0,n.jsx)("div",{className:"space-y-1",children:W.map(e=>(0,n.jsxs)("div",{className:"flex items-center justify-between rounded-md border px-3 py-2",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(k,{className:"h-4 w-4 text-muted-foreground"}),(0,n.jsx)("span",{className:"font-mono text-sm",children:e})]}),(0,n.jsx)(c.z,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>L(e),title:"Drop from database",children:(0,n.jsx)(g.Z,{className:"h-3.5 w-3.5"})})]},e))})})})]})]})}),(0,n.jsx)(d.nU,{value:"fields",className:"space-y-3 mt-4",children:0===_.length?(0,n.jsx)(i.Zb,{children:(0,n.jsx)(i.aY,{className:"py-8 text-center text-sm text-muted-foreground",children:0===V.summary.collectionsWithFieldDiffs?"All fields are in sync across schema and database.":"No results match your search."})}):(0,n.jsx)("div",{className:"space-y-2",children:_.map(e=>(0,n.jsx)(S,{diff:e,onDeleteField:E},e.collection))})})]}),(0,n.jsx)(x.aR,{open:j.open,onOpenChange:e=>R(t=>({...t,open:e})),children:(0,n.jsxs)(x._T,{children:[(0,n.jsxs)(x.fY,{children:[(0,n.jsx)(x.f$,{children:j.title}),(0,n.jsx)(x.yT,{children:j.description})]}),(0,n.jsxs)(x.xo,{children:[(0,n.jsx)(x.le,{children:"Cancel"}),(0,n.jsxs)(x.OL,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{j.action(),R(e=>({...e,open:!1}))},disabled:z,children:[z?(0,n.jsx)(y.Z,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Confirm"]})]})]})})]})};var I=()=>(0,n.jsx)(R,{})},30767:function(e,t,s){"use strict";s.d(t,{OL:function(){return j},_T:function(){return u},aR:function(){return c},f$:function(){return x},fY:function(){return h},le:function(){return b},vW:function(){return o},xo:function(){return f},yT:function(){return p}});var n=s(57437),a=s(2265),l=s(16720),r=s(93448),i=s(12381);let c=l.fC,o=l.xz,d=l.h_,m=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)(l.aV,{className:(0,r.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",s),...a,ref:t})});m.displayName="AlertDialogOverlay";let u=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsxs)(d,{children:[(0,n.jsx)(m,{}),(0,n.jsx)(l.VY,{ref:t,className:(0,r.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",s),...a})]})});u.displayName="AlertDialogContent";let h=e=>{let{className:t,...s}=e;return(0,n.jsx)("div",{className:(0,r.cn)("flex flex-col space-y-2 text-center sm:text-left",t),...s})};h.displayName="AlertDialogHeader";let f=e=>{let{className:t,...s}=e;return(0,n.jsx)("div",{className:(0,r.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s})};f.displayName="AlertDialogFooter";let x=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)(l.Dx,{ref:t,className:(0,r.cn)("text-lg font-semibold",s),...a})});x.displayName="AlertDialogTitle";let p=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)(l.dk,{ref:t,className:(0,r.cn)("text-sm text-muted-foreground",s),...a})});p.displayName="AlertDialogDescription";let j=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)(l.aU,{ref:t,className:(0,r.cn)((0,i.d)(),s),...a})});j.displayName="AlertDialogAction";let b=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)(l.$j,{ref:t,className:(0,r.cn)((0,i.d)({variant:"outline"}),"mt-2 sm:mt-0",s),...a})});b.displayName="AlertDialogCancel"},8227:function(e,t,s){"use strict";s.d(t,{Fw:function(){return r},wy:function(){return l},zF:function(){return a}}),s(2265);var n=s(962);let a=n.fC,l=n.wy,r=n.Fw},69140:function(e,t,s){"use strict";s.d(t,{O:function(){return l}});var n=s(57437),a=s(93448);function l(e){let{className:t,...s}=e;return(0,n.jsx)("div",{className:(0,a.cn)("animate-pulse rounded-md bg-muted",t),...s})}},17168:function(e,t,s){"use strict";s.d(t,{SP:function(){return o},dr:function(){return c},mQ:function(){return i},nU:function(){return d}});var n=s(57437),a=s(2265),l=s(20271),r=s(93448);let i=l.fC,c=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)(l.aV,{ref:t,className:(0,r.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",s),...a})});c.displayName=l.aV.displayName;let o=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)(l.xz,{ref:t,className:(0,r.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",s),...a})});o.displayName=l.xz.displayName;let d=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,n.jsx)(l.VY,{ref:t,className:(0,r.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",s),...a})});d.displayName=l.VY.displayName},62484:function(e,t,s){"use strict";function n(e,[t,s]){return Math.min(s,Math.max(t,e))}s.d(t,{u:function(){return n}})},962:function(e,t,s){"use strict";s.d(t,{Fw:function(){return N},VY:function(){return O},fC:function(){return D},p_:function(){return x},wy:function(){return g},xz:function(){return k}});var n=s(2265),a=s(6741),l=s(73966),r=s(80886),i=s(61188),c=s(98575),o=s(82912),d=s(71599),m=s(99255),u=s(57437),h="Collapsible",[f,x]=(0,l.b)(h),[p,j]=f(h),b=n.forwardRef((e,t)=>{let{__scopeCollapsible:s,open:a,defaultOpen:l,disabled:i,onOpenChange:c,...d}=e,[f,x]=(0,r.T)({prop:a,defaultProp:null!=l&&l,onChange:c,caller:h});return(0,u.jsx)(p,{scope:s,disabled:i,contentId:(0,m.M)(),open:f,onOpenToggle:n.useCallback(()=>x(e=>!e),[x]),children:(0,u.jsx)(o.WV.div,{"data-state":C(f),"data-disabled":i?"":void 0,...d,ref:t})})});b.displayName=h;var v="CollapsibleTrigger",g=n.forwardRef((e,t)=>{let{__scopeCollapsible:s,...n}=e,l=j(v,s);return(0,u.jsx)(o.WV.button,{type:"button","aria-controls":l.contentId,"aria-expanded":l.open||!1,"data-state":C(l.open),"data-disabled":l.disabled?"":void 0,disabled:l.disabled,...n,ref:t,onClick:(0,a.Mj)(e.onClick,l.onOpenToggle)})});g.displayName=v;var y="CollapsibleContent",N=n.forwardRef((e,t)=>{let{forceMount:s,...n}=e,a=j(y,e.__scopeCollapsible);return(0,u.jsx)(d.z,{present:s||a.open,children:e=>{let{present:s}=e;return(0,u.jsx)(w,{...n,ref:t,present:s})}})});N.displayName=y;var w=n.forwardRef((e,t)=>{let{__scopeCollapsible:s,present:a,children:l,...r}=e,d=j(y,s),[m,h]=n.useState(a),f=n.useRef(null),x=(0,c.e)(t,f),p=n.useRef(0),b=p.current,v=n.useRef(0),g=v.current,N=d.open||m,w=n.useRef(N),D=n.useRef(void 0);return n.useEffect(()=>{let e=requestAnimationFrame(()=>w.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,i.b)(()=>{let e=f.current;if(e){D.current=D.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();p.current=t.height,v.current=t.width,w.current||(e.style.transitionDuration=D.current.transitionDuration,e.style.animationName=D.current.animationName),h(a)}},[d.open,a]),(0,u.jsx)(o.WV.div,{"data-state":C(d.open),"data-disabled":d.disabled?"":void 0,id:d.contentId,hidden:!N,...r,ref:x,style:{"--radix-collapsible-content-height":b?"".concat(b,"px"):void 0,"--radix-collapsible-content-width":g?"".concat(g,"px"):void 0,...e.style},children:N&&l})});function C(e){return e?"open":"closed"}var D=b,k=g,O=N}},function(e){e.O(0,[7999,5094,4438,6530,4475,926,600,3563,799,2667,2971,2117,1744],function(){return e(e.s=87949)}),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8344],{28439:function(e,t,n){Promise.resolve().then(n.bind(n,37161))},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))})}},37161: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(
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8344],{28439:function(e,t,n){Promise.resolve().then(n.bind(n,37161))},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))})}},37161: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.DataBrowserInner),{loadableGenerated:{webpack:()=>[72337]},ssr:!1,loading:()=>(0,r.jsx)(o,{})});function i(){return(0,r.jsx)(a,{selectedCollection:"baasix_Tasks",title:"Tasks",enableView:!0,defaultVisibleColumns:["type","task_status","scheduled_time","userCreated","createdAt"]})}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=28439)}),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1619],{24654:function(){},35191:function(e,t,a){Promise.resolve().then(a.bind(a,31836))},31836:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return L}});var n=a(57437),r=a(2265),i=a(99376),o=a(72135),s=a(12381),l=a(32660),c=a(51817),d=a(62883),u=a(83229),m=a(78867),f=a(82431),p=a(69174),x=a(71488),g=a(74291),h=a(82809),v=a(30166),j=a(69422),y=a(38436),b=a(39164),N=a(14438);let w=(0,v.default)(()=>a.e(2344).then(a.bind(a,32344)),{loadableGenerated:{webpack:()=>[null]},ssr:!1}),_=[{name:"First Name",value:"{{user.firstName}}",category:"User"},{name:"Last Name",value:"{{user.lastName}}",category:"User"},{name:"Full Name",value:"{{user.fullName}}",category:"User"},{name:"Email",value:"{{user.email}}",category:"User"},{name:"Magic Link",value:"{{magicLink}}",category:"Auth"},{name:"Magic Code",value:"{{magicCode}}",category:"Auth"},{name:"Reset Password Link",value:"{{resetPasswordLink}}",category:"Auth"},{name:"Verification Link",value:"{{verificationLink}}",category:"Auth"},{name:"Invite Link",value:"{{inviteLink}}",category:"Auth"},{name:"Login URL",value:"{{loginUrl}}",category:"Auth"},{name:"Project Name",value:"{{project_name}}",category:"Project"},{name:"Project Color",value:"{{project_color}}",category:"Project"},{name:"Project URL",value:"{{project_url}}",category:"Project"},{name:"App URL",value:"{{app_url}}",category:"Project"},{name:"Logo URL",value:"{{logo_url}}",category:"Project"},{name:"Tenant Name",value:"{{tenant.name}}",category:"Tenant"},{name:"Tenant Logo",value:"{{tenant.logo}}",category:"Tenant"},{name:"Notification Title",value:"{{notification_title}}",category:"Notification"},{name:"Notification Message",value:"{{notification_message}}",category:"Notification"},{name:"Action URL",value:"{{action_url}}",category:"Notification"},{name:"Action Text",value:"{{action_text}}",category:"Notification"},{name:"Inviter Name",value:"{{inviterName}}",category:"Invite"},{name:"Expiration Date",value:"{{expirationDate}}",category:"Invite"},{name:"Current Year",value:"{{currentYear}}",category:"DateTime"}];function k(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function C(e,t,a,n){var r,i,o;let s=new Date().getFullYear().toString(),l="",c=t.project_url||a;(null===(r=t.email_icon)||void 0===r?void 0:r.id)?l=n?"".concat(c,"/assets/").concat(t.email_icon.id):"".concat(c,"/assets/email_icon"):(null===(i=t.project_logo_light)||void 0===i?void 0:i.id)?l="".concat(c,"/assets/").concat(t.project_logo_light.id):(null===(o=t.project_logo_dark)||void 0===o?void 0:o.id)&&(l="".concat(c,"/assets/").concat(t.project_logo_dark.id));let d={project_name:t.project_name||"Your Company",project_color:t.project_color||"#0066cc",project_url:t.project_url||"",app_url:t.app_url||"",logo_url:l,email_signature:t.email_signature||"",currentYear:s,'"now" | date: "%Y"':s,name:"John Doe","user.firstName":"John","user.lastName":"Doe","user.fullName":"John Doe","user.email":"john@example.com",tenant:t.project_name||"Your Company","tenant.name":t.project_name||"Your Company","tenant.logo":l,magicLink:"#",magicLinkUrl:"#",magicCode:"123456",code:"123456",resetUrl:"#",resetPasswordLink:"#",verifyUrl:"#",verificationLink:"#",inviteLink:"#",loginUrl:"#",notification_title:"Notification Title",notification_message:"This is a sample notification message.",action_url:"#",action_text:"View Details",inviterName:"Admin User",expirationDate:new Date(Date.now()+6048e5).toLocaleDateString()},u=e;for(let[e,t]of Object.entries(d))for(let a of[RegExp("\\{\\{\\s*".concat(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s*\\}\\}"),"gi"),RegExp("\\{\\{\\s*".concat(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s*\\|[^}]*\\}\\}"),"gi")])u=u.replace(a,t);return(u=(u=(u=u.replace(/\{\{\s*(\w+)\s*\|\s*default:\s*['"]([^'"]+)['"]\s*\}\}/gi,(e,t,a)=>d[t.toLowerCase()]||d[t]||a)).replace(/\{%\s*if\s+\w+\s*%\}/gi,"")).replace(/\{%\s*endif\s*%\}/gi,"")).replace(/\{%\s*else\s*%\}/gi,"")}function z(){var e;let t=(0,i.useRouter)(),a=(0,i.useSearchParams)().get("id"),v=(0,o.Ji)(),[z,L]=(0,r.useState)(""),[D,P]=(0,r.useState)(!1),[A,S]=(0,r.useState)(0),{data:T,isLoading:U}=(0,o.rD)({resource:"baasix_Template",id:a||"",queryOptions:{enabled:!!a}}),{mutate:R}=(0,o.PQ)(),Y=null==T?void 0:T.data,{data:E}=(0,o.sm)({resource:"baasix_Settings",filters:(null==Y?void 0:Y.tenant_Id)?[{field:"tenant_Id",operator:"eq",value:Y.tenant_Id}]:[{field:"tenant_Id",operator:"null",value:!0}],meta:{fields:["*","email_icon.*","project_logo_light.*","project_logo_dark.*"]},pagination:{pageSize:1},queryOptions:{enabled:!!Y}}),V=(null==E?void 0:null===(e=E.data)||void 0===e?void 0:e[0])||{};(0,r.useEffect)(()=>{(null==Y?void 0:Y.body)&&Z(Y.body)},[Y]);let Z=async e=>{try{let t=await y.WU(e,{parser:"html",plugins:[b],printWidth:80,tabWidth:2});L(t)}catch(t){L(e)}},O=(0,r.useCallback)(async()=>{await Z(z),N.Am.success("Code formatted")},[z]),I=async()=>{if(null==Y?void 0:Y.id){P(!0);try{R({resource:"baasix_Template",id:Y.id,values:{body:z}},{onSuccess:()=>N.Am.success("Template saved successfully"),onError:e=>{console.error("Error saving template:",e),N.Am.error("Failed to save template")}})}finally{P(!1)}}},F=e=>{navigator.clipboard.writeText(e),N.Am.success("Copied ".concat(e))},J=(0,r.useMemo)(()=>{if(!z)return"";let e=!!(null==Y?void 0:Y.tenant_Id);return function(e,t,a,n,r){var i,o,s;let l=C(e.trim(),a,n,r),c=C(t,a,n,r),d=l.toLowerCase().startsWith("<!doctype"),u=/<html[\s>]/i.test(l);if(d||u)return l;if(/<body[^>]*style=/.test(l)&&(/<header/i.test(l)||/<footer/i.test(l)))return'<!DOCTYPE html>\n<html>\n<head>\n <meta charset="utf-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>'.concat(k(c),"</title>\n</head>\n").concat(l,"\n</html>");let m=/<style[^>]*>[\s\S]*?<\/style>/gi,f=(l.match(m)||[]).join("\n"),p=l.replace(m,"").trim(),x=/<body[\s>]/i.test(p),g=p;if(x){let e=p.match(/<body[^>]*>([\s\S]*)<\/body>/i);e&&(g=e[1].trim())}let h=a.project_name||"Your Company",v=a.project_color||"#0066cc",j="",y=a.project_url||n;(null===(i=a.email_icon)||void 0===i?void 0:i.id)?j=r?"".concat(y,"/assets/").concat(a.email_icon.id):"".concat(y,"/assets/email_icon"):(null===(o=a.project_logo_light)||void 0===o?void 0:o.id)?j="".concat(y,"/assets/").concat(a.project_logo_light.id):(null===(s=a.project_logo_dark)||void 0===s?void 0:s.id)&&(j="".concat(y,"/assets/").concat(a.project_logo_dark.id));let b=new Date().getFullYear();console.log("Logo URL for preview:",j);let N=j?'<img src="'.concat(j,'" alt="').concat(k(h),'" style="max-width: 200px;">'):'<h1 style="color: #fff; margin: 0; font-size: 24px;">'.concat(k(h),"</h1>");return'<!DOCTYPE html>\n<html>\n<head>\n <meta charset="utf-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>'.concat(k(c),"</title>\n ").concat(f,"\n</head>\n<body style=\"font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif; font-size: 16px; line-height: 1.6; color: #333; background-color: #f8f8f8; margin: 0; padding: 20px;\">\n <div style=\"max-width: 600px; margin: 0 auto; background-color: #fff; border: 1px solid #f0f0f0; border-radius: 5px; box-shadow: 0px 0px 10px 8px #e0e0e0;\">\n <header style=\"text-align: center; padding: 20px; background-color: ").concat(v,'; border-radius: 5px 5px 0 0;">\n ').concat(N,'\n </header>\n <main style="padding: 30px;">\n ').concat(g,'\n </main>\n <footer style="text-align: center; padding: 20px; font-size: 12px; color: #888; border-top: 1px solid #f0f0f0;">\n \xa9 ').concat(b," ").concat(k(h),". All rights reserved.\n </footer>\n </div>\n</body>\n</html>")}(z,(null==Y?void 0:Y.subject)||"Email Preview",V,v,e)},[z,null==Y?void 0:Y.subject,null==Y?void 0:Y.tenant_Id,V,v]);return a?U?(0,n.jsxs)("div",{className:"flex items-center justify-center h-screen",children:[(0,n.jsx)(c.Z,{className:"h-8 w-8 animate-spin text-primary"}),(0,n.jsx)("span",{className:"ml-2",children:"Loading..."})]}):(0,n.jsxs)("div",{className:"flex flex-col h-screen bg-background",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-card",children:[(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[(0,n.jsxs)(s.z,{variant:"ghost",size:"sm",onClick:()=>t.push("/settings/templates"),children:[(0,n.jsx)(l.Z,{className:"h-4 w-4 mr-2"}),"Back"]}),(0,n.jsx)("div",{className:"h-6 w-px bg-border"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"text-sm font-semibold",children:null==Y?void 0:Y.type}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:null==Y?void 0:Y.subject})]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsxs)(s.z,{variant:"outline",size:"sm",onClick:O,children:[(0,n.jsx)(d.Z,{className:"h-4 w-4 mr-2"}),"Format"]}),(0,n.jsx)("div",{className:"h-6 w-px bg-border"}),(0,n.jsxs)(s.z,{onClick:I,disabled:D,children:[D?(0,n.jsx)(c.Z,{className:"h-4 w-4 mr-2 animate-spin"}):(0,n.jsx)(u.Z,{className:"h-4 w-4 mr-2"}),"Save"]})]})]}),(0,n.jsxs)(h.pO,{direction:"horizontal",className:"flex-1",children:[(0,n.jsx)(h.ee,{defaultSize:50,minSize:30,children:(0,n.jsxs)("div",{className:"flex flex-col h-full",children:[(0,n.jsx)("div",{className:"p-2 border-b bg-muted/50 overflow-x-auto",children:(0,n.jsxs)("div",{className:"flex items-center gap-1 flex-wrap",children:[(0,n.jsx)("span",{className:"text-xs text-muted-foreground mr-2",children:"Variables:"}),(0,n.jsx)(x.pn,{children:_.slice(0,8).map(e=>(0,n.jsxs)(x.u,{children:[(0,n.jsx)(x.aJ,{asChild:!0,children:(0,n.jsx)(p.C,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80 text-xs",onClick:()=>F(e.value),children:e.name})}),(0,n.jsx)(x._v,{children:(0,n.jsxs)("p",{children:["Click to copy: ",e.value]})})]},e.value))}),(0,n.jsxs)(g.Vq,{children:[(0,n.jsx)(g.hg,{asChild:!0,children:(0,n.jsxs)(p.C,{variant:"outline",className:"text-xs cursor-pointer hover:bg-accent",children:["+",_.length-8," more"]})}),(0,n.jsxs)(g.cZ,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[(0,n.jsx)(g.fK,{children:(0,n.jsx)(g.$N,{children:"Template Variables"})}),(0,n.jsx)("div",{className:"space-y-4 pt-4",children:Array.from(new Set(_.map(e=>e.category))).map(e=>(0,n.jsxs)("div",{children:[(0,n.jsx)("h4",{className:"text-sm font-medium mb-2 text-muted-foreground",children:e}),(0,n.jsx)("div",{className:"flex flex-wrap gap-2",children:_.filter(t=>t.category===e).map(e=>(0,n.jsx)(x.pn,{children:(0,n.jsxs)(x.u,{children:[(0,n.jsx)(x.aJ,{asChild:!0,children:(0,n.jsxs)(p.C,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80",onClick:()=>F(e.value),children:[(0,n.jsx)(m.Z,{className:"h-3 w-3 mr-1"}),e.name]})}),(0,n.jsx)(x._v,{children:(0,n.jsxs)("p",{children:["Click to copy: ",(0,n.jsx)("code",{className:"text-xs",children:e.value})]})})]})},e.value))})]},e))}),(0,n.jsx)("div",{className:"mt-4 pt-4 border-t",children:(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"Click on any variable to copy it to clipboard. Paste it in the editor to use it in your template."})})]})]})]})}),(0,n.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,n.jsx)(w,{value:z,height:"100%",style:{height:"100%"},extensions:[(0,j.dy)()],onChange:e=>L(e),theme:"dark",basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightActiveLine:!0,foldGutter:!0,autocompletion:!0}})})]})}),(0,n.jsx)(h.Dp,{withHandle:!0}),(0,n.jsx)(h.ee,{defaultSize:50,minSize:30,children:(0,n.jsxs)("div",{className:"flex flex-col h-full",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between p-2 border-b bg-muted/50",children:[(0,n.jsx)("span",{className:"text-sm font-medium",children:"Preview"}),(0,n.jsx)(s.z,{variant:"ghost",size:"sm",onClick:()=>{S(e=>e+1)},children:(0,n.jsx)(f.Z,{className:"h-4 w-4"})})]}),(0,n.jsx)("div",{className:"flex-1 bg-white overflow-auto",children:(0,n.jsx)("iframe",{srcDoc:J,className:"w-full h-full border-0",title:"Email Preview",sandbox:"allow-same-origin"},A)})]})})]})]}):(0,n.jsx)("div",{className:"flex items-center justify-center h-screen",children:(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"No Template Selected"}),(0,n.jsx)("p",{className:"text-muted-foreground mb-4",children:"Please select a template to edit"}),(0,n.jsxs)(s.z,{onClick:()=>t.push("/settings/templates"),children:[(0,n.jsx)(l.Z,{className:"mr-2 h-4 w-4"}),"Back to Templates"]})]})})}function L(){return(0,n.jsx)(r.Suspense,{fallback:(0,n.jsx)("div",{className:"flex items-center justify-center h-screen",children:(0,n.jsx)(c.Z,{className:"h-8 w-8 animate-spin text-primary"})}),children:(0,n.jsx)(z,{})})}},69174:function(e,t,a){"use strict";a.d(t,{C:function(){return s}});var n=a(57437);a(2265);var r=a(90535),i=a(93448);let o=(0,r.j)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function s(e){let{className:t,variant:a,...r}=e;return(0,n.jsx)("div",{className:(0,i.cn)(o({variant:a}),t),...r})}},12381:function(e,t,a){"use strict";a.d(t,{d:function(){return l},z:function(){return c}});var n=a(57437),r=a(2265),i=a(37053),o=a(90535),s=a(93448);let l=(0,o.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"}}),c=r.forwardRef((e,t)=>{let{className:a,variant:r,size:o,asChild:c=!1,...d}=e,u=c?i.g7:"button";return(0,n.jsx)(u,{className:(0,s.cn)(l({variant:r,size:o,className:a})),ref:t,...d})});c.displayName="Button"},74291:function(e,t,a){"use strict";a.d(t,{$N:function(){return x},Be:function(){return g},Vq:function(){return l},cN:function(){return p},cZ:function(){return m},fK:function(){return f},hg:function(){return c}});var n=a(57437),r=a(2265),i=a(70001),o=a(32489),s=a(93448);let l=i.fC,c=i.xz,d=i.h_;i.x8;let u=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,n.jsx)(i.aV,{ref:t,className:(0,s.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",a),...r})});u.displayName=i.aV.displayName;let m=r.forwardRef((e,t)=>{let{className:a,children:r,...l}=e;return(0,n.jsxs)(d,{children:[(0,n.jsx)(u,{}),(0,n.jsxs)(i.VY,{ref:t,className:(0,s.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 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...l,children:[r,(0,n.jsxs)(i.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-accent data-[state=open]:text-muted-foreground",children:[(0,n.jsx)(o.Z,{className:"h-4 w-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});m.displayName=i.VY.displayName;let f=e=>{let{className:t,...a}=e;return(0,n.jsx)("div",{className:(0,s.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...a})};f.displayName="DialogHeader";let p=e=>{let{className:t,...a}=e;return(0,n.jsx)("div",{className:(0,s.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a})};p.displayName="DialogFooter";let x=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,n.jsx)(i.Dx,{ref:t,className:(0,s.cn)("text-lg font-semibold leading-none tracking-tight",a),...r})});x.displayName=i.Dx.displayName;let g=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,n.jsx)(i.dk,{ref:t,className:(0,s.cn)("text-sm text-muted-foreground",a),...r})});g.displayName=i.dk.displayName},82809:function(e,t,a){"use strict";a.d(t,{Dp:function(){return c},ee:function(){return l},pO:function(){return s}});var n=a(57437),r=a(41905),i=a(23374),o=a(93448);let s=e=>{let{className:t,...a}=e;return(0,n.jsx)(i.eh,{className:(0,o.cn)("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",t),...a})},l=i.s_,c=e=>{let{withHandle:t,className:a,...s}=e;return(0,n.jsx)(i.OT,{className:(0,o.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",a),...s,children:t&&(0,n.jsx)("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:(0,n.jsx)(r.Z,{className:"h-2.5 w-2.5"})})})}},71488:function(e,t,a){"use strict";a.d(t,{_v:function(){return d},aJ:function(){return c},pn:function(){return s},u:function(){return l}});var n=a(57437),r=a(2265),i=a(91668),o=a(93448);let s=i.zt,l=i.fC,c=i.xz,d=r.forwardRef((e,t)=>{let{className:a,sideOffset:r=4,...s}=e;return(0,n.jsx)(i.VY,{ref:t,sideOffset:r,className:(0,o.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",a),...s})});d.displayName=i.VY.displayName},93448:function(e,t,a){"use strict";a.d(t,{cn:function(){return i}});var n=a(61994),r=a(53335);function i(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return(0,r.m6)((0,n.W)(t))}}},function(e){e.O(0,[7999,8021,6401,5094,4438,6530,6241,4475,1668,478,224,2971,2117,1744],function(){return e(e.s=35191)}),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1619],{24654:function(){},35191:function(e,t,a){Promise.resolve().then(a.bind(a,31836))},31836:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return L}});var n=a(57437),r=a(2265),i=a(99376),o=a(72135),s=a(12381),l=a(32660),c=a(51817),d=a(62883),u=a(83229),m=a(78867),f=a(82431),p=a(69174),x=a(71488),g=a(74291),h=a(82809),v=a(30166),j=a(69422),y=a(38436),b=a(39164),N=a(14438);let w=(0,v.default)(()=>a.e(2344).then(a.bind(a,32344)),{loadableGenerated:{webpack:()=>[null]},ssr:!1}),_=[{name:"First Name",value:"{{user.firstName}}",category:"User"},{name:"Last Name",value:"{{user.lastName}}",category:"User"},{name:"Full Name",value:"{{user.fullName}}",category:"User"},{name:"Email",value:"{{user.email}}",category:"User"},{name:"Magic Link",value:"{{magicLink}}",category:"Auth"},{name:"Magic Code",value:"{{magicCode}}",category:"Auth"},{name:"Reset Password Link",value:"{{resetPasswordLink}}",category:"Auth"},{name:"Verification Link",value:"{{verificationLink}}",category:"Auth"},{name:"Invite Link",value:"{{inviteLink}}",category:"Auth"},{name:"Login URL",value:"{{loginUrl}}",category:"Auth"},{name:"Project Name",value:"{{project_name}}",category:"Project"},{name:"Project Color",value:"{{project_color}}",category:"Project"},{name:"Project URL",value:"{{project_url}}",category:"Project"},{name:"App URL",value:"{{app_url}}",category:"Project"},{name:"Logo URL",value:"{{logo_url}}",category:"Project"},{name:"Tenant Name",value:"{{tenant.name}}",category:"Tenant"},{name:"Tenant Logo",value:"{{tenant.logo}}",category:"Tenant"},{name:"Notification Title",value:"{{notification_title}}",category:"Notification"},{name:"Notification Message",value:"{{notification_message}}",category:"Notification"},{name:"Action URL",value:"{{action_url}}",category:"Notification"},{name:"Action Text",value:"{{action_text}}",category:"Notification"},{name:"Inviter Name",value:"{{inviterName}}",category:"Invite"},{name:"Expiration Date",value:"{{expirationDate}}",category:"Invite"},{name:"Current Year",value:"{{currentYear}}",category:"DateTime"}];function k(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function C(e,t,a,n){var r,i,o;let s=new Date().getFullYear().toString(),l="",c=t.project_url||a;(null===(r=t.email_icon)||void 0===r?void 0:r.id)?l=n?"".concat(c,"/assets/").concat(t.email_icon.id):"".concat(c,"/assets/email_icon"):(null===(i=t.project_logo_light)||void 0===i?void 0:i.id)?l="".concat(c,"/assets/").concat(t.project_logo_light.id):(null===(o=t.project_logo_dark)||void 0===o?void 0:o.id)&&(l="".concat(c,"/assets/").concat(t.project_logo_dark.id));let d={project_name:t.project_name||"Your Company",project_color:t.project_color||"#0066cc",project_url:t.project_url||"",app_url:t.app_url||"",logo_url:l,email_signature:t.email_signature||"",currentYear:s,'"now" | date: "%Y"':s,name:"John Doe","user.firstName":"John","user.lastName":"Doe","user.fullName":"John Doe","user.email":"john@example.com",tenant:t.project_name||"Your Company","tenant.name":t.project_name||"Your Company","tenant.logo":l,magicLink:"#",magicLinkUrl:"#",magicCode:"123456",code:"123456",resetUrl:"#",resetPasswordLink:"#",verifyUrl:"#",verificationLink:"#",inviteLink:"#",loginUrl:"#",notification_title:"Notification Title",notification_message:"This is a sample notification message.",action_url:"#",action_text:"View Details",inviterName:"Admin User",expirationDate:new Date(Date.now()+6048e5).toLocaleDateString()},u=e;for(let[e,t]of Object.entries(d))for(let a of[RegExp("\\{\\{\\s*".concat(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s*\\}\\}"),"gi"),RegExp("\\{\\{\\s*".concat(e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"\\s*\\|[^}]*\\}\\}"),"gi")])u=u.replace(a,t);return(u=(u=(u=u.replace(/\{\{\s*(\w+)\s*\|\s*default:\s*['"]([^'"]+)['"]\s*\}\}/gi,(e,t,a)=>d[t.toLowerCase()]||d[t]||a)).replace(/\{%\s*if\s+\w+\s*%\}/gi,"")).replace(/\{%\s*endif\s*%\}/gi,"")).replace(/\{%\s*else\s*%\}/gi,"")}function z(){var e;let t=(0,i.useRouter)(),a=(0,i.useSearchParams)().get("id"),v=(0,o.Ji)(),[z,L]=(0,r.useState)(""),[D,P]=(0,r.useState)(!1),[A,S]=(0,r.useState)(0),{data:T,isLoading:U}=(0,o.rD)({resource:"baasix_Template",id:a||"",queryOptions:{enabled:!!a}}),{mutate:R}=(0,o.PQ)(),Y=null==T?void 0:T.data,{data:E}=(0,o.sm)({resource:"baasix_Settings",filters:(null==Y?void 0:Y.tenant_Id)?[{field:"tenant_Id",operator:"eq",value:Y.tenant_Id}]:[{field:"tenant_Id",operator:"null",value:!0}],meta:{fields:["*","email_icon.*","project_logo_light.*","project_logo_dark.*"]},pagination:{pageSize:1},queryOptions:{enabled:!!Y}}),V=(null==E?void 0:null===(e=E.data)||void 0===e?void 0:e[0])||{};(0,r.useEffect)(()=>{(null==Y?void 0:Y.body)&&Z(Y.body)},[Y]);let Z=async e=>{try{let t=await y.WU(e,{parser:"html",plugins:[b],printWidth:80,tabWidth:2});L(t)}catch(t){L(e)}},O=(0,r.useCallback)(async()=>{await Z(z),N.Am.success("Code formatted")},[z]),I=async()=>{if(null==Y?void 0:Y.id){P(!0);try{R({resource:"baasix_Template",id:Y.id,values:{body:z}},{onSuccess:()=>N.Am.success("Template saved successfully"),onError:e=>{console.error("Error saving template:",e),N.Am.error("Failed to save template")}})}finally{P(!1)}}},F=e=>{navigator.clipboard.writeText(e),N.Am.success("Copied ".concat(e))},J=(0,r.useMemo)(()=>{if(!z)return"";let e=!!(null==Y?void 0:Y.tenant_Id);return function(e,t,a,n,r){var i,o,s;let l=C(e.trim(),a,n,r),c=C(t,a,n,r),d=l.toLowerCase().startsWith("<!doctype"),u=/<html[\s>]/i.test(l);if(d||u)return l;if(/<body[^>]*style=/.test(l)&&(/<header/i.test(l)||/<footer/i.test(l)))return'<!DOCTYPE html>\n<html>\n<head>\n <meta charset="utf-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>'.concat(k(c),"</title>\n</head>\n").concat(l,"\n</html>");let m=/<style[^>]*>[\s\S]*?<\/style>/gi,f=(l.match(m)||[]).join("\n"),p=l.replace(m,"").trim(),x=/<body[\s>]/i.test(p),g=p;if(x){let e=p.match(/<body[^>]*>([\s\S]*)<\/body>/i);e&&(g=e[1].trim())}let h=a.project_name||"Your Company",v=a.project_color||"#0066cc",j="",y=a.project_url||n;(null===(i=a.email_icon)||void 0===i?void 0:i.id)?j=r?"".concat(y,"/assets/").concat(a.email_icon.id):"".concat(y,"/assets/email_icon"):(null===(o=a.project_logo_light)||void 0===o?void 0:o.id)?j="".concat(y,"/assets/").concat(a.project_logo_light.id):(null===(s=a.project_logo_dark)||void 0===s?void 0:s.id)&&(j="".concat(y,"/assets/").concat(a.project_logo_dark.id));let b=new Date().getFullYear();console.log("Logo URL for preview:",j);let N=j?'<img src="'.concat(j,'" alt="').concat(k(h),'" style="max-width: 200px;">'):'<h1 style="color: #fff; margin: 0; font-size: 24px;">'.concat(k(h),"</h1>");return'<!DOCTYPE html>\n<html>\n<head>\n <meta charset="utf-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>'.concat(k(c),"</title>\n ").concat(f,"\n</head>\n<body style=\"font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif; font-size: 16px; line-height: 1.6; color: #333; background-color: #f8f8f8; margin: 0; padding: 20px;\">\n <div style=\"max-width: 600px; margin: 0 auto; background-color: #fff; border: 1px solid #f0f0f0; border-radius: 5px; box-shadow: 0px 0px 10px 8px #e0e0e0;\">\n <header style=\"text-align: center; padding: 20px; background-color: ").concat(v,'; border-radius: 5px 5px 0 0;">\n ').concat(N,'\n </header>\n <main style="padding: 30px;">\n ').concat(g,'\n </main>\n <footer style="text-align: center; padding: 20px; font-size: 12px; color: #888; border-top: 1px solid #f0f0f0;">\n \xa9 ').concat(b," ").concat(k(h),". All rights reserved.\n </footer>\n </div>\n</body>\n</html>")}(z,(null==Y?void 0:Y.subject)||"Email Preview",V,v,e)},[z,null==Y?void 0:Y.subject,null==Y?void 0:Y.tenant_Id,V,v]);return a?U?(0,n.jsxs)("div",{className:"flex items-center justify-center h-screen",children:[(0,n.jsx)(c.Z,{className:"h-8 w-8 animate-spin text-primary"}),(0,n.jsx)("span",{className:"ml-2",children:"Loading..."})]}):(0,n.jsxs)("div",{className:"flex flex-col h-screen bg-background",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 border-b bg-card",children:[(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[(0,n.jsxs)(s.z,{variant:"ghost",size:"sm",onClick:()=>t.push("/settings/templates"),children:[(0,n.jsx)(l.Z,{className:"h-4 w-4 mr-2"}),"Back"]}),(0,n.jsx)("div",{className:"h-6 w-px bg-border"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h1",{className:"text-sm font-semibold",children:null==Y?void 0:Y.type}),(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:null==Y?void 0:Y.subject})]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsxs)(s.z,{variant:"outline",size:"sm",onClick:O,children:[(0,n.jsx)(d.Z,{className:"h-4 w-4 mr-2"}),"Format"]}),(0,n.jsx)("div",{className:"h-6 w-px bg-border"}),(0,n.jsxs)(s.z,{onClick:I,disabled:D,children:[D?(0,n.jsx)(c.Z,{className:"h-4 w-4 mr-2 animate-spin"}):(0,n.jsx)(u.Z,{className:"h-4 w-4 mr-2"}),"Save"]})]})]}),(0,n.jsxs)(h.pO,{direction:"horizontal",className:"flex-1",children:[(0,n.jsx)(h.ee,{defaultSize:50,minSize:30,children:(0,n.jsxs)("div",{className:"flex flex-col h-full",children:[(0,n.jsx)("div",{className:"p-2 border-b bg-muted/50 overflow-x-auto",children:(0,n.jsxs)("div",{className:"flex items-center gap-1 flex-wrap",children:[(0,n.jsx)("span",{className:"text-xs text-muted-foreground mr-2",children:"Variables:"}),(0,n.jsx)(x.pn,{children:_.slice(0,8).map(e=>(0,n.jsxs)(x.u,{children:[(0,n.jsx)(x.aJ,{asChild:!0,children:(0,n.jsx)(p.C,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80 text-xs",onClick:()=>F(e.value),children:e.name})}),(0,n.jsx)(x._v,{children:(0,n.jsxs)("p",{children:["Click to copy: ",e.value]})})]},e.value))}),(0,n.jsxs)(g.Vq,{children:[(0,n.jsx)(g.hg,{asChild:!0,children:(0,n.jsxs)(p.C,{variant:"outline",className:"text-xs cursor-pointer hover:bg-accent",children:["+",_.length-8," more"]})}),(0,n.jsxs)(g.cZ,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[(0,n.jsx)(g.fK,{children:(0,n.jsx)(g.$N,{children:"Template Variables"})}),(0,n.jsx)("div",{className:"space-y-4 pt-4",children:Array.from(new Set(_.map(e=>e.category))).map(e=>(0,n.jsxs)("div",{children:[(0,n.jsx)("h4",{className:"text-sm font-medium mb-2 text-muted-foreground",children:e}),(0,n.jsx)("div",{className:"flex flex-wrap gap-2",children:_.filter(t=>t.category===e).map(e=>(0,n.jsx)(x.pn,{children:(0,n.jsxs)(x.u,{children:[(0,n.jsx)(x.aJ,{asChild:!0,children:(0,n.jsxs)(p.C,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80",onClick:()=>F(e.value),children:[(0,n.jsx)(m.Z,{className:"h-3 w-3 mr-1"}),e.name]})}),(0,n.jsx)(x._v,{children:(0,n.jsxs)("p",{children:["Click to copy: ",(0,n.jsx)("code",{className:"text-xs",children:e.value})]})})]})},e.value))})]},e))}),(0,n.jsx)("div",{className:"mt-4 pt-4 border-t",children:(0,n.jsx)("p",{className:"text-xs text-muted-foreground",children:"Click on any variable to copy it to clipboard. Paste it in the editor to use it in your template."})})]})]})]})}),(0,n.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,n.jsx)(w,{value:z,height:"100%",style:{height:"100%"},extensions:[(0,j.dy)()],onChange:e=>L(e),theme:"dark",basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightActiveLine:!0,foldGutter:!0,autocompletion:!0}})})]})}),(0,n.jsx)(h.Dp,{withHandle:!0}),(0,n.jsx)(h.ee,{defaultSize:50,minSize:30,children:(0,n.jsxs)("div",{className:"flex flex-col h-full",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between p-2 border-b bg-muted/50",children:[(0,n.jsx)("span",{className:"text-sm font-medium",children:"Preview"}),(0,n.jsx)(s.z,{variant:"ghost",size:"sm",onClick:()=>{S(e=>e+1)},children:(0,n.jsx)(f.Z,{className:"h-4 w-4"})})]}),(0,n.jsx)("div",{className:"flex-1 bg-white overflow-auto",children:(0,n.jsx)("iframe",{srcDoc:J,className:"w-full h-full border-0",title:"Email Preview",sandbox:"allow-same-origin"},A)})]})})]})]}):(0,n.jsx)("div",{className:"flex items-center justify-center h-screen",children:(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)("h2",{className:"text-xl font-semibold mb-2",children:"No Template Selected"}),(0,n.jsx)("p",{className:"text-muted-foreground mb-4",children:"Please select a template to edit"}),(0,n.jsxs)(s.z,{onClick:()=>t.push("/settings/templates"),children:[(0,n.jsx)(l.Z,{className:"mr-2 h-4 w-4"}),"Back to Templates"]})]})})}function L(){return(0,n.jsx)(r.Suspense,{fallback:(0,n.jsx)("div",{className:"flex items-center justify-center h-screen",children:(0,n.jsx)(c.Z,{className:"h-8 w-8 animate-spin text-primary"})}),children:(0,n.jsx)(z,{})})}},69174:function(e,t,a){"use strict";a.d(t,{C:function(){return s}});var n=a(57437);a(2265);var r=a(90535),i=a(93448);let o=(0,r.j)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function s(e){let{className:t,variant:a,...r}=e;return(0,n.jsx)("div",{className:(0,i.cn)(o({variant:a}),t),...r})}},12381:function(e,t,a){"use strict";a.d(t,{d:function(){return l},z:function(){return c}});var n=a(57437),r=a(2265),i=a(37053),o=a(90535),s=a(93448);let l=(0,o.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"}}),c=r.forwardRef((e,t)=>{let{className:a,variant:r,size:o,asChild:c=!1,...d}=e,u=c?i.g7:"button";return(0,n.jsx)(u,{className:(0,s.cn)(l({variant:r,size:o,className:a})),ref:t,...d})});c.displayName="Button"},74291:function(e,t,a){"use strict";a.d(t,{$N:function(){return x},Be:function(){return g},Vq:function(){return l},cN:function(){return p},cZ:function(){return m},fK:function(){return f},hg:function(){return c}});var n=a(57437),r=a(2265),i=a(70001),o=a(32489),s=a(93448);let l=i.fC,c=i.xz,d=i.h_;i.x8;let u=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,n.jsx)(i.aV,{ref:t,className:(0,s.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",a),...r})});u.displayName=i.aV.displayName;let m=r.forwardRef((e,t)=>{let{className:a,children:r,...l}=e;return(0,n.jsxs)(d,{children:[(0,n.jsx)(u,{}),(0,n.jsxs)(i.VY,{ref:t,className:(0,s.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 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...l,children:[r,(0,n.jsxs)(i.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-accent data-[state=open]:text-muted-foreground",children:[(0,n.jsx)(o.Z,{className:"h-4 w-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});m.displayName=i.VY.displayName;let f=e=>{let{className:t,...a}=e;return(0,n.jsx)("div",{className:(0,s.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...a})};f.displayName="DialogHeader";let p=e=>{let{className:t,...a}=e;return(0,n.jsx)("div",{className:(0,s.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a})};p.displayName="DialogFooter";let x=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,n.jsx)(i.Dx,{ref:t,className:(0,s.cn)("text-lg font-semibold leading-none tracking-tight",a),...r})});x.displayName=i.Dx.displayName;let g=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,n.jsx)(i.dk,{ref:t,className:(0,s.cn)("text-sm text-muted-foreground",a),...r})});g.displayName=i.dk.displayName},82809:function(e,t,a){"use strict";a.d(t,{Dp:function(){return c},ee:function(){return l},pO:function(){return s}});var n=a(57437),r=a(41905),i=a(23374),o=a(93448);let s=e=>{let{className:t,...a}=e;return(0,n.jsx)(i.eh,{className:(0,o.cn)("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",t),...a})},l=i.s_,c=e=>{let{withHandle:t,className:a,...s}=e;return(0,n.jsx)(i.OT,{className:(0,o.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",a),...s,children:t&&(0,n.jsx)("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:(0,n.jsx)(r.Z,{className:"h-2.5 w-2.5"})})})}},71488:function(e,t,a){"use strict";a.d(t,{_v:function(){return d},aJ:function(){return c},pn:function(){return s},u:function(){return l}});var n=a(57437),r=a(2265),i=a(91668),o=a(93448);let s=i.zt,l=i.fC,c=i.xz,d=r.forwardRef((e,t)=>{let{className:a,sideOffset:r=4,...s}=e;return(0,n.jsx)(i.VY,{ref:t,sideOffset:r,className:(0,o.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",a),...s})});d.displayName=i.VY.displayName},93448:function(e,t,a){"use strict";a.d(t,{cn:function(){return i}});var n=a(61994),r=a(53335);function i(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return(0,r.m6)((0,n.W)(t))}}},function(e){e.O(0,[7999,8021,6401,5094,4438,6530,4475,6241,1668,478,224,2971,2117,1744],function(){return e(e.s=35191)}),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4111],{30086:function(n,e,u){Promise.resolve().then(u.bind(u,15006))},15006: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.h2,{})}},function(n){n.O(0,[7999,3572,7902,5094,4438,6530,6241,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4111],{30086:function(n,e,u){Promise.resolve().then(u.bind(u,15006))},15006: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.h2,{})}},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=30086)}),_N_E=n.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5714],{51454:function(n,e,u){Promise.resolve().then(u.bind(u,77498))},77498: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.Xx,{})}},function(n){n.O(0,[7999,3572,7902,5094,4438,6530,6241,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5714],{51454:function(n,e,u){Promise.resolve().then(u.bind(u,77498))},77498: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.Xx,{})}},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=51454)}),_N_E=n.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1242],{58247:function(e,t,n){Promise.resolve().then(n.bind(n,55048))},79205:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});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 i=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:l=24,strokeWidth:i=2,absoluteStrokeWidth:a,className:s="",children:d,iconNode:c,...f}=e;return(0,r.createElement)("svg",{ref:t,...o,width:l,height:l,stroke:n,strokeWidth:a?24*Number(i)/Number(l):i,className:u("lucide",s),...f},[...c.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),a=(e,t)=>{let n=(0,r.forwardRef)((n,o)=>{let{className:a,...s}=n;return(0,r.createElement)(i,{ref:o,iconNode:t,className:u("lucide-".concat(l(e)),a),...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 i(e){return{default:e&&"default"in e?e.default:e}}let a={loader:()=>Promise.resolve(i(()=>null)),loading:null,ssr:!0},s=function(e){let t={...a,...e},n=(0,l.lazy)(()=>t.loader().then(i)),s=t.loading;function d(e){let i=s?(0,r.jsx)(s,{isLoading:!0,pastDelay:!0,error:null}):null,a=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:i,children:a})}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))})}},55048:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return a}});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 i=(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(
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1242],{58247:function(e,t,n){Promise.resolve().then(n.bind(n,55048))},79205:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});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 i=(0,r.forwardRef)((e,t)=>{let{color:n="currentColor",size:l=24,strokeWidth:i=2,absoluteStrokeWidth:a,className:s="",children:d,iconNode:c,...f}=e;return(0,r.createElement)("svg",{ref:t,...o,width:l,height:l,stroke:n,strokeWidth:a?24*Number(i)/Number(l):i,className:u("lucide",s),...f},[...c.map(e=>{let[t,n]=e;return(0,r.createElement)(t,n)}),...Array.isArray(d)?d:[d]])}),a=(e,t)=>{let n=(0,r.forwardRef)((n,o)=>{let{className:a,...s}=n;return(0,r.createElement)(i,{ref:o,iconNode:t,className:u("lucide-".concat(l(e)),a),...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 i(e){return{default:e&&"default"in e?e.default:e}}let a={loader:()=>Promise.resolve(i(()=>null)),loading:null,ssr:!0},s=function(e){let t={...a,...e},n=(0,l.lazy)(()=>t.loader().then(i)),s=t.loading;function d(e){let i=s?(0,r.jsx)(s,{isLoading:!0,pastDelay:!0,error:null}):null,a=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:i,children:a})}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))})}},55048:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return a}});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 i=(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.DataBrowserInner),{loadableGenerated:{webpack:()=>[72337]},ssr:!1,loading:()=>(0,r.jsx)(o,{})});function a(){return(0,r.jsx)(i,{selectedCollection:"baasix_Invite",title:"User Invites",enableView:!0,defaultVisibleColumns:["email","role","tenant","status","inviter","expiresAt","createdAt"]})}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=58247)}),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3353],{88752:function(n,t,u){Promise.resolve().then(u.bind(u,18407))},18407:function(n,t,u){"use strict";u.r(t),u.d(t,{default:function(){return c}});var e=u(57437),r=u(65422);function c(){return(0,e.jsx)(r.t,{})}}},function(n){n.O(0,[7999,3572,7902,5094,4438,6530,6241,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3353],{88752:function(n,t,u){Promise.resolve().then(u.bind(u,18407))},18407:function(n,t,u){"use strict";u.r(t),u.d(t,{default:function(){return c}});var e=u(57437),r=u(65422);function c(){return(0,e.jsx)(r.t,{})}}},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,2667,4033,7304,3817,7214,2971,2117,1744],function(){return n(n.s=88752)}),_N_E=n.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8800],{46393:function(n,t,u){Promise.resolve().then(u.bind(u,9565))},9565:function(n,t,u){"use strict";u.r(t),u.d(t,{default:function(){return c}});var e=u(57437),r=u(65422);function c(){return(0,e.jsx)(r.t,{})}}},function(n){n.O(0,[7999,3572,7902,5094,4438,6530,6241,
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8800],{46393:function(n,t,u){Promise.resolve().then(u.bind(u,9565))},9565:function(n,t,u){"use strict";u.r(t),u.d(t,{default:function(){return c}});var e=u(57437),r=u(65422);function c(){return(0,e.jsx)(r.t,{})}}},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,2667,4033,7304,3817,7214,2971,2117,1744],function(){return n(n.s=46393)}),_N_E=n.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7165],{37373:function(e,t,n){Promise.resolve().then(n.bind(n,544))},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))})}},544: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(
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7165],{37373:function(e,t,n){Promise.resolve().then(n.bind(n,544))},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))})}},544: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.DataBrowserInner),{loadableGenerated:{webpack:()=>[72337]},ssr:!1,loading:()=>(0,r.jsx)(o,{})});function i(){return(0,r.jsx)(a,{selectedCollection:"baasix_UserPreference",title:"User Preferences",enableView:!0,defaultVisibleColumns:["user","collectionName","preferenceType","isDefault","name","createdAt"]})}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=37373)}),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8615],{12874:function(e,t,n){Promise.resolve().then(n.bind(n,13345))},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))})}},13345: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(
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8615],{12874:function(e,t,n){Promise.resolve().then(n.bind(n,13345))},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))})}},13345: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.DataBrowserInner),{loadableGenerated:{webpack:()=>[72337]},ssr:!1,loading:()=>(0,r.jsx)(o,{})});function i(){return(0,r.jsx)(a,{selectedCollection:"baasix_UserRole",title:"User Roles",enableView:!0,defaultVisibleColumns:["user","role","tenant","createdAt"]})}}},function(e){e.O(0,[2971,2117,1744],function(){return e(e.s=12874)}),_N_E=e.O()}]);
|