adminizer 5.0.0-build.11 → 5.0.0-build.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/assets/{add-DQE53mIb.js → add-B_hn__Ba.js} +1 -1
  2. package/assets/{add-group-BsizwU4R.js → add-group-0SdYgiXZ.js} +1 -1
  3. package/assets/{add-user-BkSrCzw4.js → add-user-Bh1iqSem.js} +1 -1
  4. package/assets/ai-assistant/agent.es.js +5036 -4931
  5. package/assets/app.js +32 -32
  6. package/assets/{catalog-DPbsKvEY.js → catalog-DjK8r0Mn.js} +1 -1
  7. package/assets/controls/handsontable.es.js +11637 -11632
  8. package/assets/controls/jsoneditor.es.js +6308 -6297
  9. package/assets/controls/toast-ui.es.js +18 -17
  10. package/assets/{dashboard-DDbX6YWf.js → dashboard-CbJIK7ka.js} +1 -1
  11. package/assets/{history-DzHm8RJs.js → history-CZAJgVXP.js} +1 -1
  12. package/assets/{list-CMymFRqO.js → list-C6w_xDK2.js} +1 -1
  13. package/assets/manifest.json +24 -24
  14. package/assets/{module-DkFrKFpO.js → module-DvPjKyF_.js} +1 -1
  15. package/assets/{notification-ChERJE5c.js → notification-N_b-N0Zu.js} +1 -1
  16. package/assets/{user-filters-list-BytQFcmQ.js → user-filters-list-xbJoY_5_.js} +1 -1
  17. package/assets/{welcome-Daw8Hukl.js → welcome-BUkdkKa5.js} +1 -1
  18. package/assets/{with-app-layout-0iXcLqi5.js → with-app-layout-WhRyO5WK.js} +1 -1
  19. package/controllers/ai/AiAgentController.js +4 -1
  20. package/controllers/view.js +1 -1
  21. package/helpers/configHelper.js +12 -17
  22. package/helpers/controllerHelper.d.ts +1 -0
  23. package/helpers/controllerHelper.js +25 -15
  24. package/helpers/fieldsHelper.js +3 -3
  25. package/helpers/inertiaAddHelper.js +1 -1
  26. package/helpers/inertiaMenuHelper.d.ts +0 -1
  27. package/helpers/inertiaMenuHelper.js +3 -26
  28. package/helpers/modelResourceHelper.d.ts +9 -0
  29. package/helpers/modelResourceHelper.js +43 -0
  30. package/helpers/navigationAccessHelper.d.ts +13 -0
  31. package/helpers/navigationAccessHelper.js +40 -0
  32. package/index.d.ts +6 -0
  33. package/index.js +6 -0
  34. package/interfaces/adminpanelConfig.d.ts +6 -1
  35. package/interfaces/types.d.ts +40 -3
  36. package/lib/Adminizer.d.ts +6 -0
  37. package/lib/Adminizer.js +9 -0
  38. package/lib/DataAccessor.d.ts +1 -0
  39. package/lib/DataAccessor.js +45 -47
  40. package/lib/admin-links/AdminLinkHandler.d.ts +72 -0
  41. package/lib/admin-links/AdminLinkHandler.js +175 -0
  42. package/lib/ai-assistant/AbstractAiModelService.d.ts +44 -3
  43. package/lib/ai-assistant/AbstractAiModelService.js +61 -2
  44. package/lib/ai-assistant/AiAssistantAgentSkillHandler.d.ts +58 -0
  45. package/lib/ai-assistant/AiAssistantAgentSkillHandler.js +87 -0
  46. package/lib/ai-assistant/AiAssistantUiMethodHandler.d.ts +60 -0
  47. package/lib/ai-assistant/AiAssistantUiMethodHandler.js +138 -0
  48. package/lib/ai-assistant/builtinAgentSkills.d.ts +9 -0
  49. package/lib/ai-assistant/builtinAgentSkills.js +256 -0
  50. package/lib/ai-assistant/jsonSafe.d.ts +13 -0
  51. package/lib/ai-assistant/jsonSafe.js +81 -0
  52. package/lib/app-manager/AdminizerApp.d.ts +24 -0
  53. package/lib/app-manager/AppManager.js +39 -42
  54. package/lib/filters/FilterService.js +4 -3
  55. package/lib/history-actions/AbstractHistoryAdapter.js +11 -9
  56. package/lib/model/AbstractModel.d.ts +2 -0
  57. package/lib/model/ModelHandler.d.ts +47 -2
  58. package/lib/model/ModelHandler.js +107 -8
  59. package/package.json +1 -1
  60. package/system/bindAccessRights.js +2 -3
  61. package/system/buildInternalModelAccess.js +5 -2
  62. package/system/validateSystemModels.js +29 -9
@@ -1 +1 @@
1
- import{u as e,r as a,t,j as r,q as c,A as u}from"./app.js";import{w as p}from"./with-app-layout-0iXcLqi5.js";import"./use-appearance-_EbbjHTh.js";const f=[];function n(){const o=e();return a.useEffect(()=>{const s=o.props.flash;s&&(s.success&&t.success(s.success),s.error&&t.error(s.error))},[o.props.flash]),r.jsxs(r.Fragment,{children:[r.jsx(c,{position:"top-center",richColors:!0,closeButton:!0}),r.jsx(u,{page:o,catalog:!1})]})}const d=p(n,{breadcrumbs:f,className:"overflow-auto h-[calc(100svh-16px)]"});export{d as default};
1
+ import{u as e,r as a,t,j as r,q as c,A as u}from"./app.js";import{w as p}from"./with-app-layout-WhRyO5WK.js";import"./use-appearance-_EbbjHTh.js";const f=[];function n(){const o=e();return a.useEffect(()=>{const s=o.props.flash;s&&(s.success&&t.success(s.success),s.error&&t.error(s.error))},[o.props.flash]),r.jsxs(r.Fragment,{children:[r.jsx(c,{position:"top-center",richColors:!0,closeButton:!0}),r.jsx(u,{page:o,catalog:!1})]})}const d=p(n,{breadcrumbs:f,className:"overflow-auto h-[calc(100svh-16px)]"});export{d as default};
@@ -1 +1 @@
1
- import{u as N,a as C,r as x,j as e,B as u,L as k,I as b,M as w,b as F,c as h,d as j,C as T,T as y,e as L,f as E,g as I,h as B}from"./app.js";import{w as D}from"./with-app-layout-0iXcLqi5.js";import"./use-appearance-_EbbjHTh.js";const g=x.memo(({field:s,disabled:p,value:c,onCheckedChange:i,tooltip:t})=>{const m=x.useCallback(l=>{i(s.name,l)},[s.name,i]);return e.jsxs("div",{className:"flex gap-3 items-center",children:[e.jsx(T,{id:s.name,className:"cursor-pointer size-5",disabled:p,checked:c,onCheckedChange:m}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(h,{className:"cursor-pointer",htmlFor:s.name,children:s.label}),t&&e.jsx(y,{children:e.jsxs(L,{children:[e.jsx(E,{onClick:l=>l.preventDefault(),children:e.jsx(b,{iconNode:I,className:"text-primary w-5 h-5 cursor-pointer"})}),e.jsx(B,{align:"center",side:"top",children:e.jsx("p",{children:s.tooltip})})]})})]})]})});function A(){const s=N(),{fields:p,groupedTokens:c,users:i}=s.props,{data:t,setData:m,clearErrors:l,post:v,processing:o}=C({...Object.fromEntries(p.map(a=>[a.name,a.value])),...Object.fromEntries(i.map(a=>[a.name,a.value])),...Object.fromEntries(c.flatMap(a=>a.fields.map(n=>[n.name,n.value])))}),r=a=>s.props.fields.find(n=>n.name===a),d=x.useCallback((a,n)=>{l(),m(a,n)},[]),f=a=>{a.preventDefault(),v(s.props.postLink)};return e.jsxs("div",{className:"flex h-full flex-1 flex-col gap-4 rounded-xl p-4",children:[e.jsxs("div",{className:"w-full sticky z-[1001] py-4 pb-8 top-0 h-fit bg-background flex gap-4",children:[e.jsx(u,{className:"mb-3 w-fit",asChild:!0,children:e.jsxs(k,{href:s.props.btnBack.link,children:[e.jsx(b,{iconNode:w}),s.props.btnBack.title]})}),e.jsxs(u,{variant:"green",type:"submit",className:"w-fit",form:"addUserForm",disabled:o||s.props.view,children:[o&&e.jsx(F,{className:"h-4 w-4 animate-spin"}),s.props.btnSave.title]})]}),e.jsx("form",{id:"addUserForm",onSubmit:f,className:`${s.props.view?"cursor-not-allowed":""}`,children:e.jsxs("div",{className:"flex flex-col gap-6 max-w-[1144px]",children:[e.jsx("h2",{className:"font-bold text-xl",children:s.props.head}),e.jsxs("div",{className:"grid gap-4",children:[e.jsx(h,{htmlFor:r("name")?.name,children:r("name")?.label}),e.jsx(j,{id:r("name")?.name,type:"text",required:!0,tabIndex:1,autoComplete:r("name")?.name,value:t.name,onChange:a=>d("name",a.target.value),disabled:o||s.props.view,placeholder:r("name")?.label})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsx(h,{htmlFor:r("description")?.name,children:r("description")?.label}),e.jsx(j,{id:r("description")?.name,type:"text",required:!0,tabIndex:1,autoComplete:r("description")?.name,value:t.description,onChange:a=>d("description",a.target.value),disabled:o||s.props.view,placeholder:r("description")?.label})]}),s.props.users.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-bold text-xl",children:s.props.userHead}),s.props.users.map(a=>e.jsx(g,{field:a,disabled:o||s.props.view,value:t[a.name],onCheckedChange:d},a.name))]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 xl:grid-cols-4 gap-4",children:s.props.groupedTokens?.length>0&&s.props.groupedTokens.map(a=>e.jsxs("div",{className:"grid gap-4 content-start justify-between",children:[e.jsx("h2",{className:"font-bold text-xl mt-3",children:a.header}),a.fields.map(n=>e.jsx(g,{field:n,disabled:o||s.props.view,value:t[n.name],onCheckedChange:d,tooltip:!0},n.name))]},a.header))})]})})]})}const G=[];function M(){return e.jsx(A,{})}const P=D(M,{breadcrumbs:G});export{P as default};
1
+ import{u as N,a as C,r as x,j as e,B as u,L as k,I as b,M as w,b as F,c as h,d as j,C as T,T as y,e as L,f as E,g as I,h as B}from"./app.js";import{w as D}from"./with-app-layout-WhRyO5WK.js";import"./use-appearance-_EbbjHTh.js";const g=x.memo(({field:s,disabled:p,value:c,onCheckedChange:i,tooltip:t})=>{const m=x.useCallback(l=>{i(s.name,l)},[s.name,i]);return e.jsxs("div",{className:"flex gap-3 items-center",children:[e.jsx(T,{id:s.name,className:"cursor-pointer size-5",disabled:p,checked:c,onCheckedChange:m}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx(h,{className:"cursor-pointer",htmlFor:s.name,children:s.label}),t&&e.jsx(y,{children:e.jsxs(L,{children:[e.jsx(E,{onClick:l=>l.preventDefault(),children:e.jsx(b,{iconNode:I,className:"text-primary w-5 h-5 cursor-pointer"})}),e.jsx(B,{align:"center",side:"top",children:e.jsx("p",{children:s.tooltip})})]})})]})]})});function A(){const s=N(),{fields:p,groupedTokens:c,users:i}=s.props,{data:t,setData:m,clearErrors:l,post:v,processing:o}=C({...Object.fromEntries(p.map(a=>[a.name,a.value])),...Object.fromEntries(i.map(a=>[a.name,a.value])),...Object.fromEntries(c.flatMap(a=>a.fields.map(n=>[n.name,n.value])))}),r=a=>s.props.fields.find(n=>n.name===a),d=x.useCallback((a,n)=>{l(),m(a,n)},[]),f=a=>{a.preventDefault(),v(s.props.postLink)};return e.jsxs("div",{className:"flex h-full flex-1 flex-col gap-4 rounded-xl p-4",children:[e.jsxs("div",{className:"w-full sticky z-[1001] py-4 pb-8 top-0 h-fit bg-background flex gap-4",children:[e.jsx(u,{className:"mb-3 w-fit",asChild:!0,children:e.jsxs(k,{href:s.props.btnBack.link,children:[e.jsx(b,{iconNode:w}),s.props.btnBack.title]})}),e.jsxs(u,{variant:"green",type:"submit",className:"w-fit",form:"addUserForm",disabled:o||s.props.view,children:[o&&e.jsx(F,{className:"h-4 w-4 animate-spin"}),s.props.btnSave.title]})]}),e.jsx("form",{id:"addUserForm",onSubmit:f,className:`${s.props.view?"cursor-not-allowed":""}`,children:e.jsxs("div",{className:"flex flex-col gap-6 max-w-[1144px]",children:[e.jsx("h2",{className:"font-bold text-xl",children:s.props.head}),e.jsxs("div",{className:"grid gap-4",children:[e.jsx(h,{htmlFor:r("name")?.name,children:r("name")?.label}),e.jsx(j,{id:r("name")?.name,type:"text",required:!0,tabIndex:1,autoComplete:r("name")?.name,value:t.name,onChange:a=>d("name",a.target.value),disabled:o||s.props.view,placeholder:r("name")?.label})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsx(h,{htmlFor:r("description")?.name,children:r("description")?.label}),e.jsx(j,{id:r("description")?.name,type:"text",required:!0,tabIndex:1,autoComplete:r("description")?.name,value:t.description,onChange:a=>d("description",a.target.value),disabled:o||s.props.view,placeholder:r("description")?.label})]}),s.props.users.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-bold text-xl",children:s.props.userHead}),s.props.users.map(a=>e.jsx(g,{field:a,disabled:o||s.props.view,value:t[a.name],onCheckedChange:d},a.name))]}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 xl:grid-cols-4 gap-4",children:s.props.groupedTokens?.length>0&&s.props.groupedTokens.map(a=>e.jsxs("div",{className:"grid gap-4 content-start justify-between",children:[e.jsx("h2",{className:"font-bold text-xl mt-3",children:a.header}),a.fields.map(n=>e.jsx(g,{field:n,disabled:o||s.props.view,value:t[n.name],onCheckedChange:d,tooltip:!0},n.name))]},a.header))})]})})]})}const G=[];function M(){return e.jsx(A,{})}const P=D(M,{breadcrumbs:G});export{P as default};
@@ -1 +1 @@
1
- import{u as B,r as m,a as M,j as e,B as d,L as j,I as f,M as H,b as O,c as n,d as c,S as w,i as b,k as v,l as N,m as y,C as g,T as Y,e as $,f as _,g as G,h as J,n as Q,K as W,o as X,R as Z,p as C,t as h}from"./app.js";import{M as ee,w as se}from"./with-app-layout-0iXcLqi5.js";import"./use-appearance-_EbbjHTh.js";function ae(){const l=B(),[k,P]=m.useState(),{fields:A,groups:F,auth:I}=l.props,[p,U]=m.useState(!1),[x,z]=m.useState(l.props.apiKey),[K,u]=m.useState(!1),{data:r,setData:S,errors:R,setError:T,clearErrors:L,post:E,processing:i}=M({...Object.fromEntries(A.map(s=>[s.name,s.value])),...Object.fromEntries(F.map(s=>[s.name,s.value]))});m.useEffect(()=>{(async()=>{const o=await C.get(`${window.routePrefix}/get-timezones`);P(o.data.timezones)})()},[]);const a=s=>l.props.fields.find(o=>o.name===s),D=s=>{if(s.preventDefault(),r.userPassword!==r.repeatUserPassword){T("repeatUserPassword",l.props.passwordError);return}E(l.props.postLink)},t=(s,o)=>{L(),S(s,o)},q=async()=>{try{const s=await C.post(`${window.routePrefix}/api/user-key/regenerate`);z(s.data.apiKey),h.success("User API key regenerated")}catch(s){console.error("Failed to regenerate user API key:",s),h.error("Failed to regenerate user API key")}u(!1)},V=async()=>{if(x)try{await navigator.clipboard.writeText(x),h.success("API key copied to clipboard")}catch{h.error("Failed to copy")}};return e.jsxs("div",{className:"flex h-full flex-1 flex-col gap-4 rounded-xl p-4",children:[e.jsxs("div",{className:"w-full sticky z-[1001] py-4 pb-8 top-0 h-fit bg-background flex gap-4",children:[e.jsx(d,{className:"mb-3 w-fit",asChild:!0,children:e.jsxs(j,{href:l.props.btnBack.link,children:[e.jsx(f,{iconNode:H}),l.props.btnBack.title]})}),e.jsxs(d,{variant:"green",type:"submit",className:"w-fit",form:"addUserForm",disabled:i||l.props.view,children:[i&&e.jsx(O,{className:"h-4 w-4 animate-spin"}),l.props.btnSave.title]})]}),e.jsx("form",{id:"addUserForm",onSubmit:D,className:l.props.view?"cursor-not-allowed":"",children:e.jsxs("div",{className:"flex flex-col gap-10 max-w-[1144px]",children:[e.jsx("h2",{className:"font-bold text-xl",children:l.props.head}),e.jsxs("div",{className:"flex-col xl:flex-row flex gap-16",children:[e.jsxs("div",{className:"basis-1/2 flex flex-col gap-6",children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsx(n,{htmlFor:a("login")?.name,children:a("login")?.label}),e.jsx(c,{id:a("login")?.name,type:"text",required:!0,tabIndex:1,autoComplete:"username",value:r.login,onChange:s=>t("login",s.target.value),disabled:i||l.props.view,placeholder:a("login")?.label})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsx(n,{htmlFor:a("fullName")?.name,children:a("fullName")?.label}),e.jsx(c,{id:a("fullName")?.name,type:"text",required:!0,tabIndex:1,autoComplete:"additional-name",value:r.fullName,onChange:s=>t("fullName",s.target.value),disabled:i||l.props.view,placeholder:a("fullName")?.label})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsx(n,{htmlFor:a("email")?.name,children:a("email")?.label}),e.jsx(c,{id:a("email")?.name,type:"email",required:!0,tabIndex:1,autoComplete:"email",value:r.email,onChange:s=>t("email",s.target.value),disabled:i||l.props.view,placeholder:a("email")?.label})]})]}),e.jsxs("div",{className:"basis-1/2 flex flex-col gap-6",children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsx(n,{htmlFor:a("timezone")?.name,children:a("timezone")?.label}),e.jsxs(w,{onValueChange:s=>t("timezone",s),defaultValue:r.timezone,disabled:i||l.props.view,children:[e.jsx(b,{className:"w-full cursor-pointer",children:e.jsx(v,{placeholder:a("timezone")?.name})}),e.jsx(N,{children:(k??[]).map(s=>e.jsx(y,{value:s.value,children:s.label},s.value))})]})]}),e.jsxs("div",{className:"flex flex-col md:flex-row justify-start gap-4 xl:justify-between items-start md:items-center",children:[a("date")&&e.jsxs("div",{className:"grid gap-4",children:[e.jsx(n,{htmlFor:a("date")?.name,children:a("date")?.label}),e.jsx(c,{id:a("date")?.name,type:"date",className:"max-w-fit",tabIndex:1,value:r.date,onChange:s=>t("date",s.target.value),disabled:i})]}),e.jsxs("div",{className:"flex gap-6",children:[a("isAdmin")&&e.jsxs("div",{className:"grid gap-4",children:[e.jsx(n,{className:"cursor-pointer",htmlFor:a("isAdmin")?.name,children:a("isAdmin")?.label}),e.jsx(g,{id:a("isAdmin")?.name,className:"cursor-pointer size-5",disabled:i||l.props.view,checked:r.isAdmin,onCheckedChange:s=>t("isAdmin",s)})]}),a("isConfirmed")&&e.jsxs("div",{className:"grid gap-4",children:[e.jsx(n,{className:"cursor-pointer",htmlFor:a("isConfirmed")?.name,children:a("isConfirmed")?.label}),e.jsx(g,{id:a("isConfirmed")?.name,className:"cursor-pointer size-5",disabled:i||l.props.view,checked:r.isConfirmed,onCheckedChange:s=>t("isConfirmed",s)})]})]})]}),a("locale")&&e.jsxs("div",{className:"grid gap-4",children:[e.jsx(n,{htmlFor:a("locale")?.name,children:a("locale")?.label}),e.jsxs(w,{onValueChange:s=>t("locale",s),defaultValue:r.locale,disabled:i||l.props.view,children:[e.jsx(b,{className:"w-full cursor-pointer",children:e.jsx(v,{placeholder:a("locale")?.name})}),e.jsx(N,{children:(l.props.locales??[]).map(s=>e.jsx(y,{value:s.value,children:s.label},s.value))})]})]})]})]}),I.user.isAdministrator&&e.jsx(d,{className:"w-fit",asChild:!0,variant:"outline",children:e.jsxs(j,{href:l.props.userPretend.postLink,method:"post",data:{login:r.login,pretend:!0},children:[e.jsx(ee,{name:"masks",className:"!text-[18px]"}),l.props.userPretend.label]})}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("label",{className:"font-bold text-xl",children:a("userPassword")?.label}),e.jsx(Y,{children:e.jsxs($,{children:[e.jsx(_,{onClick:s=>s.preventDefault(),children:e.jsx(f,{iconNode:G,className:"text-primary w-5 h-5 cursor-pointer"})}),e.jsx(J,{align:"center",side:"top",children:e.jsx("p",{children:a("userPassword")?.tooltip})})]})})]}),e.jsxs("div",{className:"grid grid-col-1 lg:grid-cols-2 grid-rows-2 gap-x-16 gap-y-6",children:[e.jsxs("div",{className:"grid gap-4 col-span-1",children:[e.jsx(n,{htmlFor:a("userPassword")?.name,children:a("userPassword")?.label}),e.jsx(c,{id:a("userPassword")?.name,type:"password",required:!l.props.edit,tabIndex:1,autoComplete:"new-password",value:r.password,onChange:s=>t("userPassword",s.target.value),disabled:i||l.props.view,placeholder:a("userPassword")?.label})]}),e.jsxs("div",{className:"grid gap-4 col-span-1 col-start-1",children:[e.jsx(n,{htmlFor:a("repeatUserPassword")?.name,children:a("repeatUserPassword")?.label}),e.jsx(c,{id:a("repeatUserPassword")?.name,type:"password",required:!l.props.edit,tabIndex:1,autoComplete:"new-password",value:r.repeatUserPassword,onChange:s=>t("repeatUserPassword",s.target.value),disabled:i||l.props.view,placeholder:a("repeatUserPassword")?.label}),e.jsx(Q,{message:R.repeatUserPassword})]})]}),l.props.groups.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-bold text-xl",children:l.props.groupHead}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-5 xl:grid-cols-6 gap-4",children:l.props.groups.map(s=>e.jsxs("div",{className:"grid gap-4",children:[e.jsx(n,{className:"cursor-pointer",htmlFor:s.name,children:s.label}),e.jsx(g,{id:s.name,disabled:i||l.props.view,className:"cursor-pointer size-5",checked:r[s.name],onCheckedChange:o=>t(s.name,o)})]},s.name))})]}),l.props.edit&&!l.props.view&&e.jsxs(e.Fragment,{children:[e.jsxs("h2",{className:"font-bold text-xl flex items-center gap-2",children:[e.jsx(W,{className:"w-5 h-5"}),"User API Key (for feeds)"]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[x&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 text-sm bg-muted px-3 py-2 rounded font-mono truncate",children:p?x:"••••••••••••••••••••••••"}),e.jsx(d,{variant:"outline",size:"sm",type:"button",onClick:()=>U(!p),children:p?"Hide":"Show"}),p&&e.jsx(d,{variant:"outline",size:"sm",type:"button",onClick:V,children:e.jsx(X,{className:"w-4 h-4"})})]}),e.jsxs(d,{variant:"outline",size:"sm",type:"button",className:"w-fit",onClick:()=>u(!0),children:[e.jsx(Z,{className:"w-4 h-4 mr-2"}),"Regenerate User API Key"]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Regenerating this key will invalidate all existing feed URLs. You will need to update the ",e.jsx("code",{className:"bg-muted px-1 text-xs",children:"?userKey="})," parameter in all feed links."]})]})]}),K&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-background rounded-lg shadow-lg max-w-md w-full p-6",children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Regenerate User API Key"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"This will invalidate all existing feed URLs. You will need to update them with the new userKey."}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(d,{variant:"outline",type:"button",onClick:()=>u(!1),children:"Cancel"}),e.jsx(d,{variant:"destructive",type:"button",onClick:q,children:"Regenerate"})]})]})})]})})]})}const le=[];function re(){return e.jsx(ae,{})}const de=se(re,{breadcrumbs:le});export{de as default};
1
+ import{u as B,r as m,a as M,j as e,B as d,L as j,I as f,M as H,b as O,c as n,d as c,S as w,i as b,k as v,l as N,m as y,C as g,T as Y,e as $,f as _,g as G,h as J,n as Q,K as W,o as X,R as Z,p as C,t as h}from"./app.js";import{M as ee,w as se}from"./with-app-layout-WhRyO5WK.js";import"./use-appearance-_EbbjHTh.js";function ae(){const l=B(),[k,P]=m.useState(),{fields:A,groups:F,auth:I}=l.props,[p,U]=m.useState(!1),[x,z]=m.useState(l.props.apiKey),[K,u]=m.useState(!1),{data:r,setData:S,errors:R,setError:T,clearErrors:L,post:E,processing:i}=M({...Object.fromEntries(A.map(s=>[s.name,s.value])),...Object.fromEntries(F.map(s=>[s.name,s.value]))});m.useEffect(()=>{(async()=>{const o=await C.get(`${window.routePrefix}/get-timezones`);P(o.data.timezones)})()},[]);const a=s=>l.props.fields.find(o=>o.name===s),D=s=>{if(s.preventDefault(),r.userPassword!==r.repeatUserPassword){T("repeatUserPassword",l.props.passwordError);return}E(l.props.postLink)},t=(s,o)=>{L(),S(s,o)},q=async()=>{try{const s=await C.post(`${window.routePrefix}/api/user-key/regenerate`);z(s.data.apiKey),h.success("User API key regenerated")}catch(s){console.error("Failed to regenerate user API key:",s),h.error("Failed to regenerate user API key")}u(!1)},V=async()=>{if(x)try{await navigator.clipboard.writeText(x),h.success("API key copied to clipboard")}catch{h.error("Failed to copy")}};return e.jsxs("div",{className:"flex h-full flex-1 flex-col gap-4 rounded-xl p-4",children:[e.jsxs("div",{className:"w-full sticky z-[1001] py-4 pb-8 top-0 h-fit bg-background flex gap-4",children:[e.jsx(d,{className:"mb-3 w-fit",asChild:!0,children:e.jsxs(j,{href:l.props.btnBack.link,children:[e.jsx(f,{iconNode:H}),l.props.btnBack.title]})}),e.jsxs(d,{variant:"green",type:"submit",className:"w-fit",form:"addUserForm",disabled:i||l.props.view,children:[i&&e.jsx(O,{className:"h-4 w-4 animate-spin"}),l.props.btnSave.title]})]}),e.jsx("form",{id:"addUserForm",onSubmit:D,className:l.props.view?"cursor-not-allowed":"",children:e.jsxs("div",{className:"flex flex-col gap-10 max-w-[1144px]",children:[e.jsx("h2",{className:"font-bold text-xl",children:l.props.head}),e.jsxs("div",{className:"flex-col xl:flex-row flex gap-16",children:[e.jsxs("div",{className:"basis-1/2 flex flex-col gap-6",children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsx(n,{htmlFor:a("login")?.name,children:a("login")?.label}),e.jsx(c,{id:a("login")?.name,type:"text",required:!0,tabIndex:1,autoComplete:"username",value:r.login,onChange:s=>t("login",s.target.value),disabled:i||l.props.view,placeholder:a("login")?.label})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsx(n,{htmlFor:a("fullName")?.name,children:a("fullName")?.label}),e.jsx(c,{id:a("fullName")?.name,type:"text",required:!0,tabIndex:1,autoComplete:"additional-name",value:r.fullName,onChange:s=>t("fullName",s.target.value),disabled:i||l.props.view,placeholder:a("fullName")?.label})]}),e.jsxs("div",{className:"grid gap-4",children:[e.jsx(n,{htmlFor:a("email")?.name,children:a("email")?.label}),e.jsx(c,{id:a("email")?.name,type:"email",required:!0,tabIndex:1,autoComplete:"email",value:r.email,onChange:s=>t("email",s.target.value),disabled:i||l.props.view,placeholder:a("email")?.label})]})]}),e.jsxs("div",{className:"basis-1/2 flex flex-col gap-6",children:[e.jsxs("div",{className:"grid gap-4",children:[e.jsx(n,{htmlFor:a("timezone")?.name,children:a("timezone")?.label}),e.jsxs(w,{onValueChange:s=>t("timezone",s),defaultValue:r.timezone,disabled:i||l.props.view,children:[e.jsx(b,{className:"w-full cursor-pointer",children:e.jsx(v,{placeholder:a("timezone")?.name})}),e.jsx(N,{children:(k??[]).map(s=>e.jsx(y,{value:s.value,children:s.label},s.value))})]})]}),e.jsxs("div",{className:"flex flex-col md:flex-row justify-start gap-4 xl:justify-between items-start md:items-center",children:[a("date")&&e.jsxs("div",{className:"grid gap-4",children:[e.jsx(n,{htmlFor:a("date")?.name,children:a("date")?.label}),e.jsx(c,{id:a("date")?.name,type:"date",className:"max-w-fit",tabIndex:1,value:r.date,onChange:s=>t("date",s.target.value),disabled:i})]}),e.jsxs("div",{className:"flex gap-6",children:[a("isAdmin")&&e.jsxs("div",{className:"grid gap-4",children:[e.jsx(n,{className:"cursor-pointer",htmlFor:a("isAdmin")?.name,children:a("isAdmin")?.label}),e.jsx(g,{id:a("isAdmin")?.name,className:"cursor-pointer size-5",disabled:i||l.props.view,checked:r.isAdmin,onCheckedChange:s=>t("isAdmin",s)})]}),a("isConfirmed")&&e.jsxs("div",{className:"grid gap-4",children:[e.jsx(n,{className:"cursor-pointer",htmlFor:a("isConfirmed")?.name,children:a("isConfirmed")?.label}),e.jsx(g,{id:a("isConfirmed")?.name,className:"cursor-pointer size-5",disabled:i||l.props.view,checked:r.isConfirmed,onCheckedChange:s=>t("isConfirmed",s)})]})]})]}),a("locale")&&e.jsxs("div",{className:"grid gap-4",children:[e.jsx(n,{htmlFor:a("locale")?.name,children:a("locale")?.label}),e.jsxs(w,{onValueChange:s=>t("locale",s),defaultValue:r.locale,disabled:i||l.props.view,children:[e.jsx(b,{className:"w-full cursor-pointer",children:e.jsx(v,{placeholder:a("locale")?.name})}),e.jsx(N,{children:(l.props.locales??[]).map(s=>e.jsx(y,{value:s.value,children:s.label},s.value))})]})]})]})]}),I.user.isAdministrator&&e.jsx(d,{className:"w-fit",asChild:!0,variant:"outline",children:e.jsxs(j,{href:l.props.userPretend.postLink,method:"post",data:{login:r.login,pretend:!0},children:[e.jsx(ee,{name:"masks",className:"!text-[18px]"}),l.props.userPretend.label]})}),e.jsxs("div",{className:"flex gap-3",children:[e.jsx("label",{className:"font-bold text-xl",children:a("userPassword")?.label}),e.jsx(Y,{children:e.jsxs($,{children:[e.jsx(_,{onClick:s=>s.preventDefault(),children:e.jsx(f,{iconNode:G,className:"text-primary w-5 h-5 cursor-pointer"})}),e.jsx(J,{align:"center",side:"top",children:e.jsx("p",{children:a("userPassword")?.tooltip})})]})})]}),e.jsxs("div",{className:"grid grid-col-1 lg:grid-cols-2 grid-rows-2 gap-x-16 gap-y-6",children:[e.jsxs("div",{className:"grid gap-4 col-span-1",children:[e.jsx(n,{htmlFor:a("userPassword")?.name,children:a("userPassword")?.label}),e.jsx(c,{id:a("userPassword")?.name,type:"password",required:!l.props.edit,tabIndex:1,autoComplete:"new-password",value:r.password,onChange:s=>t("userPassword",s.target.value),disabled:i||l.props.view,placeholder:a("userPassword")?.label})]}),e.jsxs("div",{className:"grid gap-4 col-span-1 col-start-1",children:[e.jsx(n,{htmlFor:a("repeatUserPassword")?.name,children:a("repeatUserPassword")?.label}),e.jsx(c,{id:a("repeatUserPassword")?.name,type:"password",required:!l.props.edit,tabIndex:1,autoComplete:"new-password",value:r.repeatUserPassword,onChange:s=>t("repeatUserPassword",s.target.value),disabled:i||l.props.view,placeholder:a("repeatUserPassword")?.label}),e.jsx(Q,{message:R.repeatUserPassword})]})]}),l.props.groups.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"font-bold text-xl",children:l.props.groupHead}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-5 xl:grid-cols-6 gap-4",children:l.props.groups.map(s=>e.jsxs("div",{className:"grid gap-4",children:[e.jsx(n,{className:"cursor-pointer",htmlFor:s.name,children:s.label}),e.jsx(g,{id:s.name,disabled:i||l.props.view,className:"cursor-pointer size-5",checked:r[s.name],onCheckedChange:o=>t(s.name,o)})]},s.name))})]}),l.props.edit&&!l.props.view&&e.jsxs(e.Fragment,{children:[e.jsxs("h2",{className:"font-bold text-xl flex items-center gap-2",children:[e.jsx(W,{className:"w-5 h-5"}),"User API Key (for feeds)"]}),e.jsxs("div",{className:"flex flex-col gap-4",children:[x&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 text-sm bg-muted px-3 py-2 rounded font-mono truncate",children:p?x:"••••••••••••••••••••••••"}),e.jsx(d,{variant:"outline",size:"sm",type:"button",onClick:()=>U(!p),children:p?"Hide":"Show"}),p&&e.jsx(d,{variant:"outline",size:"sm",type:"button",onClick:V,children:e.jsx(X,{className:"w-4 h-4"})})]}),e.jsxs(d,{variant:"outline",size:"sm",type:"button",className:"w-fit",onClick:()=>u(!0),children:[e.jsx(Z,{className:"w-4 h-4 mr-2"}),"Regenerate User API Key"]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Regenerating this key will invalidate all existing feed URLs. You will need to update the ",e.jsx("code",{className:"bg-muted px-1 text-xs",children:"?userKey="})," parameter in all feed links."]})]})]}),K&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-background rounded-lg shadow-lg max-w-md w-full p-6",children:[e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Regenerate User API Key"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"This will invalidate all existing feed URLs. You will need to update them with the new userKey."}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(d,{variant:"outline",type:"button",onClick:()=>u(!1),children:"Cancel"}),e.jsx(d,{variant:"destructive",type:"button",onClick:q,children:"Regenerate"})]})]})})]})})]})}const le=[];function re(){return e.jsx(ae,{})}const de=se(re,{breadcrumbs:le});export{de as default};