@aiquants/auth-react-router 0.9.0 → 0.11.0

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/admin.mjs CHANGED
@@ -1,2 +1,2 @@
1
- var A={title:"Users & Groups",heading:"\u{1F464} User administration",tabs:{users:"\u{1F464} Users",groups:"\u{1F465} Groups",groupMembers:"\u{1F517} Members",allowlist:"\u2709\uFE0F Allowlist"},usersView:{title:"Users",searchPlaceholder:"Search by name or email...",addUser:"\uFF0B Add user",editUser:"Edit user",id:"ID",displayName:"Name",email:"Email",status:"Status",active:"Active",inactive:"Inactive",actions:"Actions",edit:"Edit",activate:"Activate",deactivate:"Deactivate",empty:"No matching users",save:"Save",cancel:"Cancel"},groupsView:{title:"Groups",searchPlaceholder:"Search by group name or key...",addGroup:"\uFF0B Add group",editGroup:"Edit group",id:"ID",groupKey:"Group key",name:"Name",description:"Description",memberCount:"Members",status:"Status",actions:"Actions",edit:"Edit",delete:"Delete",confirmDelete:"Delete this group?",noDescription:"No description",groupKeyPlaceholder:"e.g. dev-team",namePlaceholder:"e.g. Development team",empty:"No groups registered",save:"Save",cancel:"Cancel"},groupMembersView:{selectGroup:"Select a group",selectPrompt:"Select a group to manage its members",actionAdd:"Add",actionRemove:"Remove"},allowlistView:{title:"Sign-in allowlist",addEntry:"\uFF0B Add pattern",pattern:"Pattern (e.g. @example.com or user@example.com)",type:"Type",emailType:"Exact email match",domainType:"Domain match",emailTypeShort:"Email",domainTypeShort:"Domain",description:"Description",actions:"Actions",readOnly:"Read-only",delete:"Delete",empty:"No allowlist entries registered",save:"Add",cancel:"Cancel"}},O={title:"\u30E6\u30FC\u30B6\u30FC\u30FB\u30B0\u30EB\u30FC\u30D7\u7BA1\u7406",heading:"\u{1F464} \u30E6\u30FC\u30B6\u30FC\u7BA1\u7406",tabs:{users:"\u{1F464} \u30E6\u30FC\u30B6\u30FC\u4E00\u89A7",groups:"\u{1F465} \u30E6\u30FC\u30B6\u30FC\u30B0\u30EB\u30FC\u30D7",groupMembers:"\u{1F517} \u30B0\u30EB\u30FC\u30D7\u30E1\u30F3\u30D0\u30FC",allowlist:"\u2709\uFE0F \u30A2\u30AF\u30BB\u30B9\u8A31\u53EF\u30EA\u30B9\u30C8"},usersView:{title:"\u30E6\u30FC\u30B6\u30FC\u7BA1\u7406",searchPlaceholder:"\u8868\u793A\u540D\u3084 Email \u3067\u691C\u7D22...",addUser:"\uFF0B \u30E6\u30FC\u30B6\u30FC\u8FFD\u52A0",editUser:"\u30E6\u30FC\u30B6\u30FC\u306E\u7DE8\u96C6",id:"ID",displayName:"\u8868\u793A\u540D",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",status:"\u30B9\u30C6\u30FC\u30BF\u30B9",active:"\u6709\u52B9",inactive:"\u7121\u52B9",actions:"\u64CD\u4F5C",edit:"\u7DE8\u96C6",activate:"\u6709\u52B9\u5316",deactivate:"\u7121\u52B9\u5316",empty:"\u8A72\u5F53\u3059\u308B\u30E6\u30FC\u30B6\u30FC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",save:"\u4FDD\u5B58",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB"},groupsView:{title:"\u30E6\u30FC\u30B6\u30FC\u30B0\u30EB\u30FC\u30D7\u7BA1\u7406",searchPlaceholder:"\u30B0\u30EB\u30FC\u30D7\u540D\u3084\u30AD\u30FC\u3067\u691C\u7D22...",addGroup:"\uFF0B \u30B0\u30EB\u30FC\u30D7\u4F5C\u6210",editGroup:"\u30B0\u30EB\u30FC\u30D7\u306E\u7DE8\u96C6",id:"ID",groupKey:"\u30B0\u30EB\u30FC\u30D7\u30AD\u30FC",name:"\u30B0\u30EB\u30FC\u30D7\u540D",description:"\u8AAC\u660E",memberCount:"\u30E1\u30F3\u30D0\u30FC\u6570",status:"\u30B9\u30C6\u30FC\u30BF\u30B9",actions:"\u64CD\u4F5C",edit:"\u7DE8\u96C6",delete:"\u524A\u9664",confirmDelete:"\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u3092\u524A\u9664\u3057\u3066\u3082\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F",noDescription:"\u8AAC\u660E\u306A\u3057",groupKeyPlaceholder:"\u4F8B: dev-team",namePlaceholder:"\u4F8B: \u958B\u767A\u30C1\u30FC\u30E0",empty:"\u30B0\u30EB\u30FC\u30D7\u304C\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093",save:"\u4FDD\u5B58",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB"},groupMembersView:{selectGroup:"\u30B0\u30EB\u30FC\u30D7\u9078\u629E",selectPrompt:"\u30B0\u30EB\u30FC\u30D7\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",actionAdd:"\u8FFD\u52A0",actionRemove:"\u9664\u5916"},allowlistView:{title:"\u30A2\u30AF\u30BB\u30B9\u8A31\u53EF\u30EA\u30B9\u30C8 (Allowlist)",addEntry:"\uFF0B \u8A31\u53EF\u30D1\u30BF\u30FC\u30F3\u8FFD\u52A0",pattern:"\u30D1\u30BF\u30FC\u30F3 (\u4F8B: @example.com \u307E\u305F\u306F user@example.com)",type:"\u7A2E\u5225",emailType:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u5B8C\u5168\u4E00\u81F4",domainType:"\u30C9\u30E1\u30A4\u30F3\u4E00\u81F4",emailTypeShort:"Email \u5B8C\u5168\u4E00\u81F4",domainTypeShort:"\u30C9\u30E1\u30A4\u30F3\u4E00\u81F4",description:"\u8AAC\u660E / \u5099\u8003",actions:"\u64CD\u4F5C",readOnly:"\u5909\u66F4\u4E0D\u53EF",delete:"\u524A\u9664",empty:"\u30A2\u30ED\u30EF\u30EA\u30B9\u30C8\u30A8\u30F3\u30C8\u30EA\u304C\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093",save:"\u767B\u9332",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB"}};function P(o){let s=A;return o?{title:o.title??s.title,heading:o.heading??s.heading,tabs:{...s.tabs,...o.tabs},usersView:{...s.usersView,...o.usersView},groupsView:{...s.groupsView,...o.groupsView},groupMembersView:{...s.groupMembersView,...o.groupMembersView},allowlistView:{...s.allowlistView,...o.allowlistView}}:s}function Q(o){let s=o?.users??[{id:1,email:"admin@example.com",displayName:"\u30B7\u30B9\u30C6\u30E0\u7BA1\u7406\u8005",isActive:!0},{id:2,email:"user1@example.com",displayName:"\u958B\u767A \u592A\u90CE",isActive:!0},{id:3,email:"user2@example.com",displayName:"\u55B6\u696D \u82B1\u5B50",isActive:!0}],t=o?.groups??[{id:1,groupKey:"dev-team",name:"\u958B\u767A\u30C1\u30FC\u30E0",description:"\u30B7\u30B9\u30C6\u30E0\u958B\u767A\u62C5\u5F53\u30B0\u30EB\u30FC\u30D7",isActive:!0},{id:2,groupKey:"sales-dept",name:"\u55B6\u696D\u90E8",description:"\u55B6\u696D\u30BD\u30EA\u30E5\u30FC\u30B7\u30E7\u30F3\u62C5\u5F53",isActive:!0}],p=o?.groupMembers??[{id:1,groupId:1,userId:2},{id:2,groupId:2,userId:3}],g=o?.allowlist??[{id:1,pattern:"admin@example.com",type:"email",description:"\u521D\u671F\u7BA1\u7406\u8005"},{id:2,pattern:"@example.com",type:"domain",description:"\u793E\u5185\u30C9\u30E1\u30A4\u30F3"}];return{async listUsers(){return[...s]},async createUser(i){let r={id:Math.max(...s.map(n=>n.id),0)+1,email:i.email,displayName:i.displayName,isActive:!0};return s.push(r),r},async updateUser(i,r){let n=s.findIndex(d=>d.id===i);if(n===-1)throw new Error(`User not found: ${i}`);return s[n]={...s[n],displayName:r.displayName,email:r.email},s[n]},async toggleUserActive(i,r){let n=s.findIndex(d=>d.id===i);if(n===-1)throw new Error(`User not found: ${i}`);return s[n]={...s[n],isActive:r},s[n]},async listGroups(){return[...t]},async createGroup(i){let r={id:Math.max(...t.map(n=>n.id),0)+1,groupKey:i.groupKey,name:i.name,description:i.description,isActive:!0};return t.push(r),r},async updateGroup(i,r){let n=t.findIndex(d=>d.id===i);if(n===-1)throw new Error(`Group not found: ${i}`);return t[n]={...t[n],name:r.name,description:r.description},t[n]},async deleteGroup(i){t=t.filter(r=>r.id!==i),p=p.filter(r=>r.groupId!==i)},async listGroupMembers(){return[...p]},async addGroupMember(i,r){let n=p.find(l=>l.groupId===i&&l.userId===r);if(n)return n;let d={id:Math.max(...p.map(l=>l.id),0)+1,groupId:i,userId:r};return p.push(d),d},async removeGroupMember(i,r){p=p.filter(n=>!(n.groupId===i&&n.userId===r))},async listAllowlist(){return[...g]},async addAllowlistEntry(i){let r={id:Math.max(...g.map(n=>n.id),0)+1,pattern:i.pattern,type:i.type,description:i.description};return g.push(r),r},async removeAllowlistEntry(i){g=g.filter(r=>r.id!==i)}}}var D=new Map([["createUser","create"],["updateUser","update"],["toggleUserActive","update"],["createGroup","create"],["updateGroup","update"],["deleteGroup","delete"],["addGroupMember","create"],["removeGroupMember","delete"],["addAllowlistEntry","create"],["removeAllowlistEntry","delete"]]);function v(o,s){let t=o.get(s),p=Number(t);if(t===null||String(t).trim()===""||!Number.isInteger(p)||p<=0)throw new Error(`Invalid or missing "${s}"`);return p}function S(o,s){let t=String(o.get(s)??"").trim();if(t==="")throw new Error(`Invalid or missing "${s}"`);return t}function I(o,s){let t=String(o.get(s)??"").trim();return t===""?void 0:t}function J(o){let s=P(o.labels);async function t({request:i}){await o.guards.requireAccess(i,{action:"read",intent:"loader"});let n=new URL(i.url).pathname.split("/").filter(Boolean),d=n[n.length-1]??"users",[l,x,m,w,b]=await Promise.all([o.store.listUsers(),o.store.listGroups(),o.store.listGroupMembers(),o.store.listAllowlist(),o.getMyPermissions?o.getMyPermissions(i).catch(y=>(console.error("[@aiquants/auth-react-router] getMyPermissions failed; rendering the permission badge as unknown:",y),null)):Promise.resolve(null)]);return{resourceLabels:o.resourceLabels,segment:["groups","group_members","allowlist"].includes(d)?d:"users",users:l,groups:x,groupMembers:m,allowlist:w,myPermissions:b,labels:s}}async function p({request:i}){let r=await i.formData(),n=String(r.get("intent")??""),d=D.get(n);if(!d)return{ok:!1,error:`Unknown intent: ${n}`};await o.guards.requireAccess(i,{action:d,intent:n});try{return await g(n,r)}catch(l){if(l instanceof Response)throw l;return{ok:!1,error:l instanceof Error?l.message:String(l)}}}async function g(i,r){if(i==="createUser")return await o.store.createUser({displayName:S(r,"displayName"),email:S(r,"email")}),{ok:!0};if(i==="updateUser")return await o.store.updateUser(v(r,"userId"),{displayName:S(r,"displayName"),email:S(r,"email")}),{ok:!0};if(i==="toggleUserActive"){let n=String(r.get("isActive")??"");if(n!=="true"&&n!=="false")throw new Error('Invalid or missing "isActive"');return await o.store.toggleUserActive(v(r,"userId"),n==="true"),{ok:!0}}if(i==="createGroup")return await o.store.createGroup({groupKey:S(r,"groupKey"),name:S(r,"name"),description:I(r,"description")}),{ok:!0};if(i==="updateGroup")return await o.store.updateGroup(v(r,"groupId"),{name:S(r,"name"),description:I(r,"description")}),{ok:!0};if(i==="deleteGroup")return await o.store.deleteGroup(v(r,"groupId")),{ok:!0};if(i==="addGroupMember")return await o.store.addGroupMember(v(r,"groupId"),v(r,"userId")),{ok:!0};if(i==="removeGroupMember")return await o.store.removeGroupMember(v(r,"groupId"),v(r,"userId")),{ok:!0};if(i==="addAllowlistEntry"){let n=r.get("type")==="domain"?"domain":"email";return await o.store.addAllowlistEntry({pattern:S(r,"pattern"),type:n,description:I(r,"description")}),{ok:!0}}return i==="removeAllowlistEntry"?(await o.store.removeAllowlistEntry(v(r,"entryId")),{ok:!0}):{ok:!1,error:`Unknown intent: ${i}`}}return{loader:t,action:p}}import{Link as T,useLoaderData as F}from"react-router";import{jsx as h,jsxs as C}from"react/jsx-runtime";function z({label:o,summary:s}){return C("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.18rem",fontSize:"0.65rem",padding:"0.08rem 0.35rem",borderRadius:"9999px",backgroundColor:s.bgColor,color:s.color,border:`1px solid ${s.borderColor}`,fontWeight:600,lineHeight:"1.2"},children:[C("span",{children:[o,":"]}),h("span",{children:s.text})]})}function M({children:o,renderHeader:s}){let t=F(),p=t?.segment??"users",g=t?.labels??A,i=t?.myPermissions??null,r=t?.resourceLabels??{},n=b=>Object.hasOwn(r,b)?r[b]:b,d=[{key:"users",label:g.tabs.users,href:"/users"},{key:"groups",label:g.tabs.groups,href:"/users/groups"},{key:"group_members",label:g.tabs.groupMembers,href:"/users/group_members"},{key:"allowlist",label:g.tabs.allowlist,href:"/users/allowlist"}],l=Object.entries(i??{}),x=b=>b?.canWrite?{text:"\u7DE8\u96C6\u53EF",color:"#047857",bgColor:"#ecfdf5",borderColor:"#a7f3d0"}:b?.canRead?{text:"\u95B2\u89A7\u306E\u307F",color:"#1d4ed8",bgColor:"#eff6ff",borderColor:"#bfdbfe"}:{text:"\u6A29\u9650\u306A\u3057",color:"#64748b",bgColor:"#f1f5f9",borderColor:"#cbd5e1"},m={text:"\u6A29\u9650\u4E0D\u660E",color:"#92400e",bgColor:"#fffbeb",borderColor:"#fde68a"},w=C("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem"},"data-testid":"user-admin-header-annotation",children:[h("span",{style:{fontSize:"0.75rem",backgroundColor:"#e0f2fe",color:"#0369a1",padding:"2px 8px",borderRadius:"12px",fontWeight:600},children:g.heading}),C("div",{style:{display:"inline-flex",alignItems:"center",gap:"0.25rem",fontSize:"0.68rem",color:"#475569"},"data-testid":"user-admin-permissions-badge",children:[h("span",{style:{fontWeight:600,color:"#334155"},children:"\u3042\u306A\u305F\u306E\u6A29\u9650:"}),h("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.18rem"},children:l.length===0?h("span",{"data-testid":"user-admin-permission-unavailable",children:h(z,{label:g.heading,summary:m})}):l.map(([b,y])=>h(z,{label:n(b),summary:x(y)},b))})]})]});return C("div",{"data-testid":"user-admin-shell",style:{width:"100%",minHeight:"100vh",backgroundColor:"#f8fafc",padding:"1.5rem",boxSizing:"border-box"},children:[s?s({title:g.title,annotation:w}):C("div",{style:{marginBottom:"1.5rem",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[h("h1",{style:{margin:0,fontSize:"1.5rem",fontWeight:700,color:"#0f172a"},children:g.title}),w]}),h("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"1.2rem",borderBottom:"2px solid #e2e8f0",paddingBottom:"0.5rem"},children:d.map(b=>{let y=p===b.key;return h(T,{to:b.href,"data-testid":`user-admin-tab-${b.key}`,style:{padding:"0.5rem 1rem",borderRadius:"6px 6px 0 0",fontSize:"0.88rem",fontWeight:y?700:500,color:y?"#0284c7":"#64748b",backgroundColor:y?"#ffffff":"transparent",textDecoration:"none",borderBottom:y?"3px solid #0284c7":"3px solid transparent",transition:"all 0.15s ease"},children:b.label},b.key)})}),h("main",{children:o})]})}import{useState as f}from"react";import{useFetcher as k,useLoaderData as U}from"react-router";import{Fragment as j,jsx as e,jsxs as a}from"react/jsx-runtime";function V({fetcher:o}){let s=o.data;return s?.ok!==!1||!s.error?null:e("div",{"data-testid":"user-admin-action-error",role:"alert",style:{padding:"0.7rem 1rem",borderRadius:"6px",border:"1px solid #fecaca",backgroundColor:"#fef2f2",color:"#b91c1c",fontSize:"0.85rem"},children:s.error})}function E(){let o=U(),s=k(),t=o.labels??A,[p,g]=f(""),[i,r]=f(null),[n,d]=f(!1),[l,x]=f(""),[m,w]=f(""),b=o.users.filter(u=>u.displayName.toLowerCase().includes(p.toLowerCase())||u.email.toLowerCase().includes(p.toLowerCase())),y=u=>{s.submit({intent:"toggleUserActive",userId:String(u.id),isActive:String(!u.isActive)},{method:"post"})},R=u=>{u.preventDefault(),l&&m&&(s.submit({intent:"createUser",displayName:l,email:m},{method:"post"}),x(""),w(""),d(!1))},G=u=>{u.preventDefault(),i&&(s.submit({intent:"updateUser",userId:String(i.id),displayName:i.displayName,email:i.email},{method:"post"}),r(null))};return a("section",{"data-testid":"users-view-section",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[e(V,{fetcher:s}),a("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[e("input",{type:"text",placeholder:t.usersView.searchPlaceholder,value:p,onChange:u=>g(u.target.value),"data-testid":"users-search-input",style:{padding:"6px 12px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",width:"260px"}}),e("button",{type:"button",onClick:()=>d(!0),"data-testid":"users-add-button",style:{padding:"6px 14px",borderRadius:"6px",backgroundColor:"#0284c7",color:"#ffffff",border:"none",fontSize:"0.85rem",fontWeight:600,cursor:"pointer"},children:t.usersView.addUser})]}),e("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0",overflow:"hidden"},children:a("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"0.85rem",textAlign:"left"},children:[e("thead",{children:a("tr",{style:{backgroundColor:"#f8fafc",borderBottom:"1px solid #e2e8f0",color:"#475569"},children:[e("th",{style:{padding:"10px 14px"},children:t.usersView.id}),e("th",{style:{padding:"10px 14px"},children:t.usersView.displayName}),e("th",{style:{padding:"10px 14px"},children:t.usersView.email}),e("th",{style:{padding:"10px 14px"},children:t.usersView.status}),e("th",{style:{padding:"10px 14px",textAlign:"right"},children:t.usersView.actions})]})}),a("tbody",{children:[b.map(u=>a("tr",{style:{borderBottom:"1px solid #f1f5f9"},"data-testid":`user-row-${u.id}`,children:[a("td",{style:{padding:"10px 14px",color:"#64748b"},children:["#",u.id]}),e("td",{style:{padding:"10px 14px",fontWeight:600,color:"#0f172a"},children:u.displayName}),e("td",{style:{padding:"10px 14px",color:"#475569"},children:u.email}),e("td",{style:{padding:"10px 14px"},children:e("span",{style:{fontSize:"0.75rem",padding:"2px 8px",borderRadius:"10px",backgroundColor:u.isActive?"#dcfce7":"#fee2e2",color:u.isActive?"#15803d":"#b91c1c",fontWeight:600},children:u.isActive?t.usersView.active:t.usersView.inactive})}),a("td",{style:{padding:"10px 14px",textAlign:"right"},children:[e("button",{type:"button",onClick:()=>r(u),"data-testid":`edit-user-btn-${u.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"0.78rem",cursor:"pointer",marginRight:"6px"},children:t.usersView.edit}),e("button",{type:"button",onClick:()=>y(u),"data-testid":`toggle-user-btn-${u.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"0.78rem",cursor:"pointer",color:u.isActive?"#b91c1c":"#15803d"},children:u.isActive?t.usersView.deactivate:t.usersView.activate})]})]},u.id)),b.length===0&&e("tr",{children:e("td",{colSpan:5,style:{padding:"2rem",textAlign:"center",color:"#94a3b8"},children:t.usersView.empty})})]})]})}),n&&e("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},"data-testid":"user-create-modal",children:a("form",{onSubmit:R,style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[e("h3",{style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:t.usersView.addUser}),a("div",{style:{marginBottom:"1rem"},children:[e("label",{htmlFor:"create-user-display-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.usersView.displayName}),e("input",{id:"create-user-display-name-input",type:"text",value:l,onChange:u=>x(u.target.value),required:!0,"data-testid":"create-user-display-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),a("div",{style:{marginBottom:"1.2rem"},children:[e("label",{htmlFor:"create-user-email-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.usersView.email}),e("input",{id:"create-user-email-input",type:"email",value:m,onChange:u=>w(u.target.value),required:!0,"data-testid":"create-user-email",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),a("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[e("button",{type:"button",onClick:()=>d(!1),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:"\u30AD\u30E3\u30F3\u30BB\u30EB"}),e("button",{type:"submit","data-testid":"submit-create-user",style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#0284c7",color:"#ffffff",border:"none",cursor:"pointer"},children:"\u4F5C\u6210"})]})]})}),i&&e("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},"data-testid":"user-edit-modal",children:a("form",{onSubmit:G,style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[e("h3",{style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:t.usersView.editUser}),a("div",{style:{marginBottom:"1rem"},children:[e("label",{htmlFor:"edit-user-display-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.usersView.displayName}),e("input",{id:"edit-user-display-name-input",type:"text",value:i.displayName,onChange:u=>r({...i,displayName:u.target.value}),required:!0,"data-testid":"edit-user-display-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),a("div",{style:{marginBottom:"1.2rem"},children:[e("label",{htmlFor:"edit-user-email-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.usersView.email}),e("input",{id:"edit-user-email-input",type:"email",value:i.email,onChange:u=>r({...i,email:u.target.value}),required:!0,"data-testid":"edit-user-email",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),a("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[e("button",{type:"button",onClick:()=>r(null),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:t.usersView.cancel}),e("button",{type:"submit","data-testid":"submit-edit-user",style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#0284c7",color:"#ffffff",border:"none",cursor:"pointer"},children:t.usersView.save})]})]})})]})}function W(){let o=U(),s=k(),t=o.labels??A,[p,g]=f(""),[i,r]=f(!1),[n,d]=f(null),[l,x]=f(""),[m,w]=f(""),[b,y]=f(""),R=o.groups.filter(c=>c.name.toLowerCase().includes(p.toLowerCase())||c.groupKey.toLowerCase().includes(p.toLowerCase())),G=c=>{c.preventDefault(),l&&m&&(s.submit({intent:"createGroup",groupKey:l,name:m,description:b},{method:"post"}),x(""),w(""),y(""),r(!1))},u=c=>{c.preventDefault(),n&&(s.submit({intent:"updateGroup",groupId:String(n.id),name:n.name,description:n.description??""},{method:"post"}),d(null))},N=c=>{window.confirm(t.groupsView.confirmDelete)&&s.submit({intent:"deleteGroup",groupId:String(c)},{method:"post"})};return a("section",{"data-testid":"groups-view-section",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[e(V,{fetcher:s}),a("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[e("input",{type:"text",placeholder:t.groupsView.searchPlaceholder,value:p,onChange:c=>g(c.target.value),"data-testid":"groups-search-input",style:{padding:"6px 12px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",width:"260px"}}),e("button",{type:"button",onClick:()=>r(!0),"data-testid":"groups-add-button",style:{padding:"6px 14px",borderRadius:"6px",backgroundColor:"#4338ca",color:"#ffffff",border:"none",fontSize:"0.85rem",fontWeight:600,cursor:"pointer"},children:t.groupsView.addGroup})]}),e("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"1rem"},children:R.map(c=>{let L=o.groupMembers.filter(B=>B.groupId===c.id).length;return a("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0",padding:"1rem",display:"flex",flexDirection:"column",justifyContent:"space-between"},"data-testid":`group-card-${c.id}`,children:[a("div",{children:[a("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.5rem"},children:[e("h4",{style:{margin:0,fontSize:"1rem",color:"#0f172a"},children:c.name}),e("span",{style:{fontSize:"0.72rem",backgroundColor:"#e0e7ff",color:"#4338ca",padding:"2px 6px",borderRadius:"4px",fontFamily:"monospace"},children:c.groupKey})]}),e("p",{style:{margin:"0 0 0.8rem 0",fontSize:"0.82rem",color:"#64748b",minHeight:"2.4em"},children:c.description||t.groupsView.noDescription})]}),a("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",borderTop:"1px solid #f1f5f9",paddingTop:"0.6rem"},children:[a("span",{style:{fontSize:"0.78rem",color:"#475569"},children:["\u{1F465} \u30E1\u30F3\u30D0\u30FC: ",e("strong",{children:L})," \u4EBA"]}),a("div",{children:[e("button",{type:"button",onClick:()=>d(c),"data-testid":`edit-group-btn-${c.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"0.75rem",cursor:"pointer",marginRight:"4px"},children:t.usersView.edit}),e("button",{type:"button",onClick:()=>N(c.id),"data-testid":`delete-group-btn-${c.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #fee2e2",backgroundColor:"#fff5f5",color:"#b91c1c",fontSize:"0.75rem",cursor:"pointer"},children:"\u524A\u9664"})]})]})]},c.id)})}),i&&e("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},"data-testid":"group-create-modal",children:a("form",{onSubmit:G,style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[e("h3",{style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:t.groupsView.addGroup}),a("div",{style:{marginBottom:"1rem"},children:[e("label",{htmlFor:"create-group-key-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.groupsView.groupKey}),e("input",{id:"create-group-key-input",type:"text",value:l,onChange:c=>x(c.target.value),placeholder:t.groupsView.groupKeyPlaceholder,required:!0,"data-testid":"create-group-key",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),a("div",{style:{marginBottom:"1rem"},children:[e("label",{htmlFor:"create-group-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.groupsView.name}),e("input",{id:"create-group-name-input",type:"text",value:m,onChange:c=>w(c.target.value),placeholder:t.groupsView.namePlaceholder,required:!0,"data-testid":"create-group-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),a("div",{style:{marginBottom:"1.2rem"},children:[e("label",{htmlFor:"create-group-desc-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.groupsView.description}),e("textarea",{id:"create-group-desc-input",value:b,onChange:c=>y(c.target.value),"data-testid":"create-group-description",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box",height:"60px"}})]}),a("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[e("button",{type:"button",onClick:()=>r(!1),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:"\u30AD\u30E3\u30F3\u30BB\u30EB"}),e("button",{type:"submit","data-testid":"submit-create-group",style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#4338ca",color:"#ffffff",border:"none",cursor:"pointer"},children:"\u4F5C\u6210"})]})]})}),n&&e("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},"data-testid":"group-edit-modal",children:a("form",{onSubmit:u,style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[e("h3",{style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:t.groupsView.editGroup}),a("div",{style:{marginBottom:"1rem"},children:[e("label",{htmlFor:"edit-group-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.groupsView.name}),e("input",{id:"edit-group-name-input",type:"text",value:n.name,onChange:c=>d({...n,name:c.target.value}),required:!0,"data-testid":"edit-group-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),a("div",{style:{marginBottom:"1.2rem"},children:[e("label",{htmlFor:"edit-group-desc-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.groupsView.description}),e("textarea",{id:"edit-group-desc-input",value:n.description??"",onChange:c=>d({...n,description:c.target.value}),"data-testid":"edit-group-description",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box",height:"60px"}})]}),a("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[e("button",{type:"button",onClick:()=>d(null),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:t.groupsView.cancel}),e("button",{type:"submit","data-testid":"submit-edit-group",style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#4338ca",color:"#ffffff",border:"none",cursor:"pointer"},children:t.groupsView.save})]})]})})]})}function $(){let o=U(),s=k(),t=o.labels??A,[p,g]=f(o.groups[0]?.id??0),i=o.groups.find(d=>d.id===p),r=new Set(o.groupMembers.filter(d=>d.groupId===p).map(d=>d.userId)),n=(d,l)=>{l?s.submit({intent:"removeGroupMember",groupId:String(p),userId:String(d)},{method:"post"}):s.submit({intent:"addGroupMember",groupId:String(p),userId:String(d)},{method:"post"})};return a("section",{"data-testid":"group-members-view-section",style:{display:"grid",gridTemplateColumns:"240px 1fr",gap:"1.2rem"},children:[e(V,{fetcher:s}),a("div",{style:{backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[e("h4",{style:{margin:"0 0 0.8rem 0",fontSize:"0.9rem",color:"#475569"},children:t.groupMembersView.selectGroup}),e("div",{style:{display:"flex",flexDirection:"column",gap:"0.4rem"},children:o.groups.map(d=>{let l=d.id===p;return e("button",{type:"button",onClick:()=>g(d.id),"data-testid":`select-group-btn-${d.id}`,style:{textAlign:"left",padding:"8px 10px",borderRadius:"6px",border:l?"1px solid #6366f1":"1px solid #e2e8f0",backgroundColor:l?"#e0e7ff":"#ffffff",color:l?"#3730a3":"#0f172a",cursor:"pointer",fontWeight:l?600:400,fontSize:"0.85rem"},children:d.name},d.id)})})]}),e("div",{style:{backgroundColor:"#ffffff",padding:"1.2rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:i?a(j,{children:[a("div",{style:{marginBottom:"1rem",borderBottom:"1px solid #e2e8f0",paddingBottom:"0.8rem"},children:[a("h3",{style:{margin:0,fontSize:"1.1rem",color:"#0f172a"},children:[i.name," \u306E\u6240\u5C5E\u30E1\u30F3\u30D0\u30FC"]}),a("span",{style:{fontSize:"0.8rem",color:"#64748b"},children:["\u30B0\u30EB\u30FC\u30D7\u30AD\u30FC: ",i.groupKey]})]}),e("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:o.users.map(d=>{let l=r.has(d.id);return a("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 12px",borderRadius:"6px",border:"1px solid #f1f5f9",backgroundColor:l?"#f0fdf4":"#ffffff"},"data-testid":`member-row-${d.id}`,children:[a("div",{children:[e("span",{style:{fontWeight:600,fontSize:"0.88rem",color:"#0f172a",marginRight:"8px"},children:d.displayName}),a("span",{style:{fontSize:"0.78rem",color:"#64748b"},children:["(",d.email,")"]})]}),e("button",{type:"button",onClick:()=>n(d.id,l),"data-testid":`toggle-member-btn-${d.id}`,style:{padding:"4px 12px",borderRadius:"4px",border:l?"1px solid #b91c1c":"1px solid #0284c7",backgroundColor:l?"#ffffff":"#0284c7",color:l?"#b91c1c":"#ffffff",fontSize:"0.78rem",fontWeight:600,cursor:"pointer"},children:l?t.groupMembersView.actionRemove:t.groupMembersView.actionAdd})]},d.id)})})]}):e("div",{style:{color:"#94a3b8",textAlign:"center",padding:"2rem"},children:t.groupMembersView.selectPrompt})})]})}function q(){let o=U(),s=k(),t=o.labels??A,[p,g]=f(""),[i,r]=f("email"),[n,d]=f(""),l=m=>{m.preventDefault(),p&&(s.submit({intent:"addAllowlistEntry",pattern:p,type:i,description:n},{method:"post"}),g(""),d(""))},x=m=>{s.submit({intent:"removeAllowlistEntry",entryId:String(m)},{method:"post"})};return a("section",{"data-testid":"allowlist-view-section",style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[e(V,{fetcher:s}),a("form",{onSubmit:l,style:{backgroundColor:"#ffffff",padding:"1.2rem",borderRadius:"8px",border:"1px solid #e2e8f0",display:"flex",flexWrap:"wrap",gap:"0.8rem",alignItems:"flex-end"},children:[a("div",{style:{flex:2,minWidth:"220px"},children:[e("label",{htmlFor:"allowlist-pattern-input-field",style:{display:"block",fontSize:"0.78rem",color:"#475569",marginBottom:"4px"},children:t.allowlistView.pattern}),e("input",{id:"allowlist-pattern-input-field",type:"text",value:p,onChange:m=>g(m.target.value),required:!0,"data-testid":"allowlist-pattern-input",style:{width:"100%",padding:"6px 10px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",boxSizing:"border-box"}})]}),a("div",{style:{flex:1,minWidth:"140px"},children:[e("label",{htmlFor:"allowlist-type-select-field",style:{display:"block",fontSize:"0.78rem",color:"#475569",marginBottom:"4px"},children:t.allowlistView.type}),a("select",{id:"allowlist-type-select-field",value:i,onChange:m=>r(m.target.value),"data-testid":"allowlist-type-select",style:{width:"100%",padding:"6px 10px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",boxSizing:"border-box"},children:[e("option",{value:"email",children:t.allowlistView.emailType}),e("option",{value:"domain",children:t.allowlistView.domainType})]})]}),a("div",{style:{flex:2,minWidth:"200px"},children:[e("label",{htmlFor:"allowlist-desc-input-field",style:{display:"block",fontSize:"0.78rem",color:"#475569",marginBottom:"4px"},children:t.allowlistView.description}),e("input",{id:"allowlist-desc-input-field",type:"text",value:n,onChange:m=>d(m.target.value),"data-testid":"allowlist-desc-input",style:{width:"100%",padding:"6px 10px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",boxSizing:"border-box"}})]}),e("button",{type:"submit","data-testid":"submit-allowlist-add",style:{padding:"7px 16px",borderRadius:"6px",backgroundColor:"#047857",color:"#ffffff",border:"none",fontSize:"0.85rem",fontWeight:600,cursor:"pointer"},children:t.allowlistView.addEntry})]}),e("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0",overflow:"hidden"},children:a("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"0.85rem",textAlign:"left"},children:[e("thead",{children:a("tr",{style:{backgroundColor:"#f8fafc",borderBottom:"1px solid #e2e8f0",color:"#475569"},children:[e("th",{style:{padding:"10px 14px"},children:"ID"}),e("th",{style:{padding:"10px 14px"},children:t.allowlistView.pattern}),e("th",{style:{padding:"10px 14px"},children:t.allowlistView.type}),e("th",{style:{padding:"10px 14px"},children:t.allowlistView.description}),e("th",{style:{padding:"10px 14px",textAlign:"right"},children:t.allowlistView.actions})]})}),a("tbody",{children:[o.allowlist.map(m=>a("tr",{style:{borderBottom:"1px solid #f1f5f9"},"data-testid":`allowlist-row-${m.id}`,children:[a("td",{style:{padding:"10px 14px",color:"#64748b"},children:["#",m.id]}),e("td",{style:{padding:"10px 14px",fontWeight:600,color:"#0f172a",fontFamily:"monospace"},children:m.pattern}),e("td",{style:{padding:"10px 14px"},children:e("span",{style:{fontSize:"0.75rem",padding:"2px 8px",borderRadius:"10px",backgroundColor:m.type==="email"?"#e0f2fe":"#fef3c7",color:m.type==="email"?"#0369a1":"#b45309",fontWeight:600},children:m.type==="email"?t.allowlistView.emailTypeShort:t.allowlistView.domainTypeShort})}),e("td",{style:{padding:"10px 14px",color:"#475569"},children:m.description||"-"}),e("td",{style:{padding:"10px 14px",textAlign:"right"},children:m.readOnly?e("span",{"data-testid":`readonly-allowlist-${m.id}`,style:{fontSize:"0.75rem",color:"#94a3b8"},children:t.allowlistView.readOnly}):e("button",{type:"button",onClick:()=>x(m.id),"data-testid":`remove-allowlist-btn-${m.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #fee2e2",backgroundColor:"#fff5f5",color:"#b91c1c",fontSize:"0.78rem",cursor:"pointer"},children:"\u524A\u9664"})})]},m.id)),o.allowlist.length===0&&e("tr",{children:e("td",{colSpan:5,style:{padding:"2rem",textAlign:"center",color:"#94a3b8"},children:t.allowlistView.empty})})]})]})})]})}var K={users:E,groups:W,group_members:$,allowlist:q};function ne({renderHeader:o}={}){let t=U()?.segment??"users",p=K[t]??E;return e(M,{renderHeader:o,children:e(p,{})})}export{q as AllowlistView,ne as AuthUserAdminAppView,$ as GroupMembersView,W as GroupsView,M as UserAdminShell,E as UsersView,Q as createInMemoryUserAdminStore,J as createUserAdminApp,A as defaultUserAdminLabels,O as jaUserAdminLabels,P as resolveUserAdminLabels};
1
+ var S={title:"Users & Groups",heading:"\u{1F464} User administration",tabs:{users:"\u{1F464} Users",groups:"\u{1F465} Groups",groupMembers:"\u{1F517} Members",allowlist:"\u2709\uFE0F Allowlist"},usersView:{title:"Users",searchPlaceholder:"Search by name or email...",addUser:"\uFF0B Add user",editUser:"Edit user",id:"ID",displayName:"Name",email:"Email",status:"Status",active:"Active",inactive:"Inactive",actions:"Actions",edit:"Edit",activate:"Activate",deactivate:"Deactivate",empty:"No matching users",save:"Save",cancel:"Cancel"},groupsView:{title:"Groups",searchPlaceholder:"Search by group name or key...",addGroup:"\uFF0B Add group",editGroup:"Edit group",id:"ID",groupKey:"Group key",name:"Name",description:"Description",memberCount:"Members",status:"Status",actions:"Actions",edit:"Edit",delete:"Delete",confirmDelete:"Delete this group?",noDescription:"No description",groupKeyPlaceholder:"e.g. dev-team",namePlaceholder:"e.g. Development team",empty:"No groups registered",save:"Save",cancel:"Cancel"},groupMembersView:{selectGroup:"Select a group",selectPrompt:"Select a group to manage its members",actionAdd:"Add",actionRemove:"Remove"},allowlistView:{title:"Sign-in allowlist",addEntry:"\uFF0B Add pattern",pattern:"Pattern (e.g. @example.com or user@example.com)",type:"Type",emailType:"Exact email match",domainType:"Domain match",emailTypeShort:"Email",domainTypeShort:"Domain",groupTypeShort:"Group",target:"Target",description:"Description",actions:"Actions",readOnly:"Read-only",deploymentOwner:"Deployment-wide",delete:"Delete",empty:"No allowlist entries registered",save:"Add",cancel:"Cancel"},directoryView:{title:"Directory synchronization",source:"Source",localSource:"Local",managedUpstream:"Managed upstream",membershipMode:"Membership",directMode:"Direct only",transitiveMode:"Nested expanded",lastSynced:"Last synced",neverSynced:"Never",unresolved:"unresolved",syncPaused:"Paused",syncEnabled:"Active",syncNow:"Sync now",syncQueued:"Queued",staleWarning:"Synchronization is overdue. Until it runs, people removed upstream keep their access.",disabledWarning:"Directory synchronization is not wired for this deployment. Existing memberships remain in force and are no longer being refreshed.",link:"Link to a directory group",unlink:"Unlink",externalKey:"Upstream group",empty:"No groups are linked to a directory"}},X={title:"\u30E6\u30FC\u30B6\u30FC\u30FB\u30B0\u30EB\u30FC\u30D7\u7BA1\u7406",heading:"\u{1F464} \u30E6\u30FC\u30B6\u30FC\u7BA1\u7406",tabs:{users:"\u{1F464} \u30E6\u30FC\u30B6\u30FC\u4E00\u89A7",groups:"\u{1F465} \u30E6\u30FC\u30B6\u30FC\u30B0\u30EB\u30FC\u30D7",groupMembers:"\u{1F517} \u30B0\u30EB\u30FC\u30D7\u30E1\u30F3\u30D0\u30FC",allowlist:"\u2709\uFE0F \u30A2\u30AF\u30BB\u30B9\u8A31\u53EF\u30EA\u30B9\u30C8"},usersView:{title:"\u30E6\u30FC\u30B6\u30FC\u7BA1\u7406",searchPlaceholder:"\u8868\u793A\u540D\u3084 Email \u3067\u691C\u7D22...",addUser:"\uFF0B \u30E6\u30FC\u30B6\u30FC\u8FFD\u52A0",editUser:"\u30E6\u30FC\u30B6\u30FC\u306E\u7DE8\u96C6",id:"ID",displayName:"\u8868\u793A\u540D",email:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",status:"\u30B9\u30C6\u30FC\u30BF\u30B9",active:"\u6709\u52B9",inactive:"\u7121\u52B9",actions:"\u64CD\u4F5C",edit:"\u7DE8\u96C6",activate:"\u6709\u52B9\u5316",deactivate:"\u7121\u52B9\u5316",empty:"\u8A72\u5F53\u3059\u308B\u30E6\u30FC\u30B6\u30FC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",save:"\u4FDD\u5B58",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB"},groupsView:{title:"\u30E6\u30FC\u30B6\u30FC\u30B0\u30EB\u30FC\u30D7\u7BA1\u7406",searchPlaceholder:"\u30B0\u30EB\u30FC\u30D7\u540D\u3084\u30AD\u30FC\u3067\u691C\u7D22...",addGroup:"\uFF0B \u30B0\u30EB\u30FC\u30D7\u4F5C\u6210",editGroup:"\u30B0\u30EB\u30FC\u30D7\u306E\u7DE8\u96C6",id:"ID",groupKey:"\u30B0\u30EB\u30FC\u30D7\u30AD\u30FC",name:"\u30B0\u30EB\u30FC\u30D7\u540D",description:"\u8AAC\u660E",memberCount:"\u30E1\u30F3\u30D0\u30FC\u6570",status:"\u30B9\u30C6\u30FC\u30BF\u30B9",actions:"\u64CD\u4F5C",edit:"\u7DE8\u96C6",delete:"\u524A\u9664",confirmDelete:"\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u3092\u524A\u9664\u3057\u3066\u3082\u3088\u308D\u3057\u3044\u3067\u3059\u304B\uFF1F",noDescription:"\u8AAC\u660E\u306A\u3057",groupKeyPlaceholder:"\u4F8B: dev-team",namePlaceholder:"\u4F8B: \u958B\u767A\u30C1\u30FC\u30E0",empty:"\u30B0\u30EB\u30FC\u30D7\u304C\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093",save:"\u4FDD\u5B58",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB"},groupMembersView:{selectGroup:"\u30B0\u30EB\u30FC\u30D7\u9078\u629E",selectPrompt:"\u30B0\u30EB\u30FC\u30D7\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",actionAdd:"\u8FFD\u52A0",actionRemove:"\u9664\u5916"},allowlistView:{title:"\u30A2\u30AF\u30BB\u30B9\u8A31\u53EF\u30EA\u30B9\u30C8 (Allowlist)",addEntry:"\uFF0B \u8A31\u53EF\u30D1\u30BF\u30FC\u30F3\u8FFD\u52A0",pattern:"\u30D1\u30BF\u30FC\u30F3 (\u4F8B: @example.com \u307E\u305F\u306F user@example.com)",type:"\u7A2E\u5225",emailType:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u5B8C\u5168\u4E00\u81F4",domainType:"\u30C9\u30E1\u30A4\u30F3\u4E00\u81F4",emailTypeShort:"Email \u5B8C\u5168\u4E00\u81F4",domainTypeShort:"\u30C9\u30E1\u30A4\u30F3\u4E00\u81F4",groupTypeShort:"\u30B0\u30EB\u30FC\u30D7",target:"\u5BFE\u8C61",description:"\u8AAC\u660E / \u5099\u8003",actions:"\u64CD\u4F5C",readOnly:"\u5909\u66F4\u4E0D\u53EF",deploymentOwner:"\u914D\u5099\u5171\u901A",delete:"\u524A\u9664",empty:"\u30A2\u30ED\u30EF\u30EA\u30B9\u30C8\u30A8\u30F3\u30C8\u30EA\u304C\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093",save:"\u767B\u9332",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB"},directoryView:{title:"\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u540C\u671F",source:"\u51FA\u6240",localSource:"\u30ED\u30FC\u30AB\u30EB\u7BA1\u7406",managedUpstream:"\u4E0A\u6D41\u304C\u6240\u6709",membershipMode:"\u6240\u5C5E\u306E\u5C55\u958B",directMode:"\u76F4\u63A5\u6240\u5C5E\u306E\u307F",transitiveMode:"\u5165\u308C\u5B50\u3092\u5C55\u958B",lastSynced:"\u6700\u7D42\u540C\u671F",neverSynced:"\u672A\u5B9F\u884C",unresolved:"\u4EF6 \u672A\u89E3\u6C7A",syncPaused:"\u505C\u6B62\u4E2D",syncEnabled:"\u6709\u52B9",syncNow:"\u4ECA\u3059\u3050\u540C\u671F",syncQueued:"\u540C\u671F\u3092\u8981\u6C42\u3057\u307E\u3057\u305F",staleWarning:"\u540C\u671F\u304C\u6EDE\u3063\u3066\u3044\u307E\u3059\u3002\u5B9F\u884C\u3055\u308C\u308B\u307E\u3067\u3001\u4E0A\u6D41\u304B\u3089\u5916\u308C\u305F\u4EBA\u306E\u30A2\u30AF\u30BB\u30B9\u306F\u6B8B\u308A\u7D9A\u3051\u307E\u3059\u3002",disabledWarning:"\u3053\u306E\u914D\u5099\u3067\u306F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u540C\u671F\u304C\u7D50\u7DDA\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\u65E2\u5B58\u306E\u6240\u5C5E\u306F\u305D\u306E\u307E\u307E\u6709\u52B9\u3067\u3001\u66F4\u65B0\u3060\u3051\u304C\u6B62\u307E\u3063\u3066\u3044\u307E\u3059\u3002",link:"\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30B0\u30EB\u30FC\u30D7\u3068\u9023\u643A\u3059\u308B",unlink:"\u9023\u643A\u3092\u89E3\u9664",externalKey:"\u4E0A\u6D41\u30B0\u30EB\u30FC\u30D7",empty:"\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3068\u9023\u643A\u3057\u3066\u3044\u308B\u30B0\u30EB\u30FC\u30D7\u306F\u3042\u308A\u307E\u305B\u3093"}};function M(r){let s=S;return r?{title:r.title??s.title,heading:r.heading??s.heading,tabs:{...s.tabs,...r.tabs},usersView:{...s.usersView,...r.usersView},groupsView:{...s.groupsView,...r.groupsView},groupMembersView:{...s.groupMembersView,...r.groupMembersView},allowlistView:{...s.allowlistView,...r.allowlistView},directoryView:{...s.directoryView,...r.directoryView}}:s}function ee(r){let s=r?.users??[{id:1,email:"admin@example.com",displayName:"\u30B7\u30B9\u30C6\u30E0\u7BA1\u7406\u8005",isActive:!0},{id:2,email:"user1@example.com",displayName:"\u958B\u767A \u592A\u90CE",isActive:!0},{id:3,email:"user2@example.com",displayName:"\u55B6\u696D \u82B1\u5B50",isActive:!0}],t=r?.groups??[{id:1,groupKey:"dev-team",name:"\u958B\u767A\u30C1\u30FC\u30E0",description:"\u30B7\u30B9\u30C6\u30E0\u958B\u767A\u62C5\u5F53\u30B0\u30EB\u30FC\u30D7",isActive:!0,readOnly:!1},{id:2,groupKey:"sales-dept",name:"\u55B6\u696D\u90E8",description:"\u55B6\u696D\u30BD\u30EA\u30E5\u30FC\u30B7\u30E7\u30F3\u62C5\u5F53",isActive:!0,readOnly:!1}],p=r?.groupMembers??[{id:1,groupId:1,userId:2},{id:2,groupId:2,userId:3}],g=r?.allowlist??[{id:1,pattern:"admin@example.com",type:"email",description:"\u521D\u671F\u7BA1\u7406\u8005",owner:{kind:"tenant",tenantId:"default"},readOnly:!1},{id:2,pattern:"@example.com",type:"domain",description:"\u793E\u5185\u30C9\u30E1\u30A4\u30F3",owner:{kind:"tenant",tenantId:"default"},readOnly:!1}];return{async listUsers(){return[...s]},async createUser(o){let i={id:Math.max(...s.map(n=>n.id),0)+1,email:o.email,displayName:o.displayName,isActive:!0};return s.push(i),i},async updateUser(o,i){let n=s.findIndex(d=>d.id===o);if(n===-1)throw new Error(`User not found: ${o}`);return s[n]={...s[n],displayName:i.displayName,email:i.email},s[n]},async toggleUserActive(o,i){let n=s.findIndex(d=>d.id===o);if(n===-1)throw new Error(`User not found: ${o}`);return s[n]={...s[n],isActive:i},s[n]},async listGroups(){return[...t]},async createGroup(o){let i={id:Math.max(...t.map(n=>n.id),0)+1,groupKey:o.groupKey,name:o.name,description:o.description,isActive:!0,readOnly:!1};return t.push(i),i},async updateGroup(o,i){let n=t.findIndex(d=>d.id===o);if(n===-1)throw new Error(`Group not found: ${o}`);return t[n]={...t[n],name:i.name,description:i.description},t[n]},async deleteGroup(o){t=t.filter(i=>i.id!==o),p=p.filter(i=>i.groupId!==o)},async listGroupMembers(){return[...p]},async addGroupMember(o,i){let n=p.find(c=>c.groupId===o&&c.userId===i);if(n)return n;let d={id:Math.max(...p.map(c=>c.id),0)+1,groupId:o,userId:i};return p.push(d),d},async removeGroupMember(o,i){p=p.filter(n=>!(n.groupId===o&&n.userId===i))},async listAllowlist(){return[...g]},async addAllowlistEntry(o){let i={id:Math.max(...g.map(n=>n.id),0)+1,pattern:o.pattern,type:o.type,description:o.description,owner:{kind:"tenant",tenantId:"default"},readOnly:!1};return g.push(i),i},async removeAllowlistEntry(o){g=g.filter(i=>i.id!==o)},async addAllowlistGroup(o,i){let n=t.find(d=>d.id===o);if(!n)throw new Error(`Group not found: ${o}`);g=[...g,{id:Math.max(...g.map(d=>d.id),0)+1,type:"group",groupId:o,groupKey:n.groupKey,groupName:n.name,description:i,owner:{kind:"tenant",tenantId:"default"},readOnly:!1}]},async removeAllowlistGroup(o){g=g.filter(i=>!(i.type==="group"&&i.id===o))},async linkDirectoryGroup(){throw new Error("This in-memory store has no upstream directory; inject a real store to link groups.")},async unlinkDirectoryGroup(){throw new Error("This in-memory store has no upstream directory; inject a real store to unlink groups.")},async setDirectorySyncEnabled(){throw new Error("This in-memory store has no upstream directory; inject a real store to pause synchronization.")},async requestDirectorySync(){throw new Error("This in-memory store has no upstream directory; inject a real store to request a sync.")},async getDirectoryStatus(){return{isEnabled:!1,linkedGroupCount:0,isStale:!1,pausedGroupCount:0,stalenessThresholdSec:0,erroredGroupIds:[],pendingRequestCount:0}}}}var T=new Map([["createUser","create"],["updateUser","update"],["toggleUserActive","update"],["createGroup","create"],["updateGroup","update"],["deleteGroup","delete"],["addGroupMember","create"],["removeGroupMember","delete"],["addAllowlistEntry","create"],["removeAllowlistEntry","delete"],["addAllowlistGroup","create"],["removeAllowlistGroup","delete"],["linkDirectoryGroup","update"],["unlinkDirectoryGroup","update"],["setDirectorySyncEnabled","update"],["requestDirectorySync","update"]]);function b(r,s){let t=r.get(s),p=Number(t);if(t===null||String(t).trim()===""||!Number.isInteger(p)||p<=0)throw new Error(`Invalid or missing "${s}"`);return p}function A(r,s){let t=String(r.get(s)??"").trim();if(t==="")throw new Error(`Invalid or missing "${s}"`);return t}function B(r,s){let t=String(r.get(s)??"");if(t!=="true"&&t!=="false")throw new Error(`Invalid or missing "${s}"`);return t==="true"}function $(r){let s=String(r.get("membershipMode")??"");if(s!=="direct"&&s!=="transitive")throw new Error('Invalid or missing "membershipMode"');return s}function G(r,s){let t=String(r.get(s)??"").trim();return t===""?void 0:t}function te(r){let s=M(r.labels);async function t({request:o}){await r.guards.requireAccess(o,{action:"read",intent:"loader"});let n=new URL(o.url).pathname.split("/").filter(Boolean),d=n[n.length-1]??"users",[c,w,x,l,y,h]=await Promise.all([r.store.listUsers(),r.store.listGroups(),r.store.listGroupMembers(),r.store.listAllowlist(),r.store.getDirectoryStatus(),r.getMyPermissions?r.getMyPermissions(o).catch(C=>(console.error("[@aiquants/auth-react-router] getMyPermissions failed; rendering the permission badge as unknown:",C),null)):Promise.resolve(null)]);return{resourceLabels:r.resourceLabels,segment:["groups","group_members","allowlist","directory"].includes(d)?d:"users",users:c,groups:w,groupMembers:x,allowlist:l,directoryStatus:y,myPermissions:h,labels:s}}async function p({request:o}){let i=await o.formData(),n=String(i.get("intent")??""),d=T.get(n);if(!d)return{ok:!1,error:`Unknown intent: ${n}`};await r.guards.requireAccess(o,{action:d,intent:n});try{return await g(n,i)}catch(c){if(c instanceof Response)throw c;return{ok:!1,error:c instanceof Error?c.message:String(c)}}}async function g(o,i){if(o==="createUser")return await r.store.createUser({displayName:A(i,"displayName"),email:A(i,"email")}),{ok:!0};if(o==="updateUser")return await r.store.updateUser(b(i,"userId"),{displayName:A(i,"displayName"),email:A(i,"email")}),{ok:!0};if(o==="toggleUserActive"){let n=String(i.get("isActive")??"");if(n!=="true"&&n!=="false")throw new Error('Invalid or missing "isActive"');return await r.store.toggleUserActive(b(i,"userId"),n==="true"),{ok:!0}}if(o==="createGroup")return await r.store.createGroup({groupKey:A(i,"groupKey"),name:A(i,"name"),description:G(i,"description")}),{ok:!0};if(o==="updateGroup")return await r.store.updateGroup(b(i,"groupId"),{name:A(i,"name"),description:G(i,"description")}),{ok:!0};if(o==="deleteGroup")return await r.store.deleteGroup(b(i,"groupId")),{ok:!0};if(o==="addGroupMember")return await r.store.addGroupMember(b(i,"groupId"),b(i,"userId")),{ok:!0};if(o==="removeGroupMember")return await r.store.removeGroupMember(b(i,"groupId"),b(i,"userId")),{ok:!0};if(o==="addAllowlistEntry"){let n=i.get("type")==="domain"?"domain":"email";return await r.store.addAllowlistEntry({pattern:A(i,"pattern"),type:n,description:G(i,"description")}),{ok:!0}}if(o==="addAllowlistGroup")return await r.store.addAllowlistGroup(b(i,"groupId"),G(i,"description")),{ok:!0};if(o==="removeAllowlistGroup")return await r.store.removeAllowlistGroup(b(i,"entryId")),{ok:!0};if(o==="linkDirectoryGroup")return await r.store.linkDirectoryGroup(b(i,"groupId"),{provider:A(i,"provider"),externalKey:A(i,"externalKey"),membershipMode:$(i)}),{ok:!0};if(o==="unlinkDirectoryGroup")return await r.store.unlinkDirectoryGroup(b(i,"groupId")),{ok:!0};if(o==="setDirectorySyncEnabled")return await r.store.setDirectorySyncEnabled(b(i,"groupId"),B(i,"isSyncEnabled")),{ok:!0};if(o==="requestDirectorySync"){let n=String(i.get("groupId")??"").trim();return await r.store.requestDirectorySync(n===""?null:b(i,"groupId")),{ok:!0}}return o==="removeAllowlistEntry"?(await r.store.removeAllowlistEntry(b(i,"entryId")),{ok:!0}):{ok:!1,error:`Unknown intent: ${o}`}}return{loader:t,action:p}}import{Link as W,useLoaderData as F}from"react-router";import{jsx as v,jsxs as k}from"react/jsx-runtime";function E({label:r,summary:s}){return k("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.18rem",fontSize:"0.65rem",padding:"0.08rem 0.35rem",borderRadius:"9999px",backgroundColor:s.bgColor,color:s.color,border:`1px solid ${s.borderColor}`,fontWeight:600,lineHeight:"1.2"},children:[k("span",{children:[r,":"]}),v("span",{children:s.text})]})}function P({children:r,renderHeader:s}){let t=F(),p=t?.segment??"users",g=t?.labels??S,o=t?.myPermissions??null,i=t?.resourceLabels??{},n=y=>Object.hasOwn(i,y)?i[y]:y,d=[{key:"users",label:g.tabs.users,href:"/users"},{key:"groups",label:g.tabs.groups,href:"/users/groups"},{key:"group_members",label:g.tabs.groupMembers,href:"/users/group_members"},{key:"allowlist",label:g.tabs.allowlist,href:"/users/allowlist"}],c=Object.entries(o??{}),w=y=>y?.canWrite?{text:"\u7DE8\u96C6\u53EF",color:"#047857",bgColor:"#ecfdf5",borderColor:"#a7f3d0"}:y?.canRead?{text:"\u95B2\u89A7\u306E\u307F",color:"#1d4ed8",bgColor:"#eff6ff",borderColor:"#bfdbfe"}:{text:"\u6A29\u9650\u306A\u3057",color:"#64748b",bgColor:"#f1f5f9",borderColor:"#cbd5e1"},x={text:"\u6A29\u9650\u4E0D\u660E",color:"#92400e",bgColor:"#fffbeb",borderColor:"#fde68a"},l=k("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem"},"data-testid":"user-admin-header-annotation",children:[v("span",{style:{fontSize:"0.75rem",backgroundColor:"#e0f2fe",color:"#0369a1",padding:"2px 8px",borderRadius:"12px",fontWeight:600},children:g.heading}),k("div",{style:{display:"inline-flex",alignItems:"center",gap:"0.25rem",fontSize:"0.68rem",color:"#475569"},"data-testid":"user-admin-permissions-badge",children:[v("span",{style:{fontWeight:600,color:"#334155"},children:"\u3042\u306A\u305F\u306E\u6A29\u9650:"}),v("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.18rem"},children:c.length===0?v("span",{"data-testid":"user-admin-permission-unavailable",children:v(E,{label:g.heading,summary:x})}):c.map(([y,h])=>v(E,{label:n(y),summary:w(h)},y))})]})]});return k("div",{"data-testid":"user-admin-shell",style:{width:"100%",minHeight:"100vh",backgroundColor:"#f8fafc",padding:"1.5rem",boxSizing:"border-box"},children:[s?s({title:g.title,annotation:l}):k("div",{style:{marginBottom:"1.5rem",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[v("h1",{style:{margin:0,fontSize:"1.5rem",fontWeight:700,color:"#0f172a"},children:g.title}),l]}),v("div",{style:{display:"flex",gap:"0.5rem",marginBottom:"1.2rem",borderBottom:"2px solid #e2e8f0",paddingBottom:"0.5rem"},children:d.map(y=>{let h=p===y.key;return v(W,{to:y.href,"data-testid":`user-admin-tab-${y.key}`,style:{padding:"0.5rem 1rem",borderRadius:"6px 6px 0 0",fontSize:"0.88rem",fontWeight:h?700:500,color:h?"#0284c7":"#64748b",backgroundColor:h?"#ffffff":"transparent",textDecoration:"none",borderBottom:h?"3px solid #0284c7":"3px solid transparent",transition:"all 0.15s ease"},children:y.label},y.key)})}),v("main",{children:r})]})}import{useState as f}from"react";import{useFetcher as V,useLoaderData as U}from"react-router";import{Fragment as J,jsx as e,jsxs as a}from"react/jsx-runtime";function R({fetcher:r}){let s=r.data;return s?.ok!==!1||!s.error?null:e("div",{"data-testid":"user-admin-action-error",role:"alert",style:{padding:"0.7rem 1rem",borderRadius:"6px",border:"1px solid #fecaca",backgroundColor:"#fef2f2",color:"#b91c1c",fontSize:"0.85rem"},children:s.error})}function z(){let r=U(),s=V(),t=r.labels??S,[p,g]=f(""),[o,i]=f(null),[n,d]=f(!1),[c,w]=f(""),[x,l]=f(""),y=r.users.filter(m=>m.displayName.toLowerCase().includes(p.toLowerCase())||m.email.toLowerCase().includes(p.toLowerCase())),h=m=>{s.submit({intent:"toggleUserActive",userId:String(m.id),isActive:String(!m.isActive)},{method:"post"})},C=m=>{m.preventDefault(),c&&x&&(s.submit({intent:"createUser",displayName:c,email:x},{method:"post"}),w(""),l(""),d(!1))},I=m=>{m.preventDefault(),o&&(s.submit({intent:"updateUser",userId:String(o.id),displayName:o.displayName,email:o.email},{method:"post"}),i(null))};return a("section",{"data-testid":"users-view-section",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[e(R,{fetcher:s}),a("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[e("input",{type:"text",placeholder:t.usersView.searchPlaceholder,value:p,onChange:m=>g(m.target.value),"data-testid":"users-search-input",style:{padding:"6px 12px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",width:"260px"}}),e("button",{type:"button",onClick:()=>d(!0),"data-testid":"users-add-button",style:{padding:"6px 14px",borderRadius:"6px",backgroundColor:"#0284c7",color:"#ffffff",border:"none",fontSize:"0.85rem",fontWeight:600,cursor:"pointer"},children:t.usersView.addUser})]}),e("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0",overflow:"hidden"},children:a("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"0.85rem",textAlign:"left"},children:[e("thead",{children:a("tr",{style:{backgroundColor:"#f8fafc",borderBottom:"1px solid #e2e8f0",color:"#475569"},children:[e("th",{style:{padding:"10px 14px"},children:t.usersView.id}),e("th",{style:{padding:"10px 14px"},children:t.usersView.displayName}),e("th",{style:{padding:"10px 14px"},children:t.usersView.email}),e("th",{style:{padding:"10px 14px"},children:t.usersView.status}),e("th",{style:{padding:"10px 14px",textAlign:"right"},children:t.usersView.actions})]})}),a("tbody",{children:[y.map(m=>a("tr",{style:{borderBottom:"1px solid #f1f5f9"},"data-testid":`user-row-${m.id}`,children:[a("td",{style:{padding:"10px 14px",color:"#64748b"},children:["#",m.id]}),e("td",{style:{padding:"10px 14px",fontWeight:600,color:"#0f172a"},children:m.displayName}),e("td",{style:{padding:"10px 14px",color:"#475569"},children:m.email}),e("td",{style:{padding:"10px 14px"},children:e("span",{style:{fontSize:"0.75rem",padding:"2px 8px",borderRadius:"10px",backgroundColor:m.isActive?"#dcfce7":"#fee2e2",color:m.isActive?"#15803d":"#b91c1c",fontWeight:600},children:m.isActive?t.usersView.active:t.usersView.inactive})}),a("td",{style:{padding:"10px 14px",textAlign:"right"},children:[e("button",{type:"button",onClick:()=>i(m),"data-testid":`edit-user-btn-${m.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"0.78rem",cursor:"pointer",marginRight:"6px"},children:t.usersView.edit}),e("button",{type:"button",onClick:()=>h(m),"data-testid":`toggle-user-btn-${m.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"0.78rem",cursor:"pointer",color:m.isActive?"#b91c1c":"#15803d"},children:m.isActive?t.usersView.deactivate:t.usersView.activate})]})]},m.id)),y.length===0&&e("tr",{children:e("td",{colSpan:5,style:{padding:"2rem",textAlign:"center",color:"#94a3b8"},children:t.usersView.empty})})]})]})}),n&&e("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},"data-testid":"user-create-modal",children:a("form",{onSubmit:C,style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[e("h3",{style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:t.usersView.addUser}),a("div",{style:{marginBottom:"1rem"},children:[e("label",{htmlFor:"create-user-display-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.usersView.displayName}),e("input",{id:"create-user-display-name-input",type:"text",value:c,onChange:m=>w(m.target.value),required:!0,"data-testid":"create-user-display-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),a("div",{style:{marginBottom:"1.2rem"},children:[e("label",{htmlFor:"create-user-email-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.usersView.email}),e("input",{id:"create-user-email-input",type:"email",value:x,onChange:m=>l(m.target.value),required:!0,"data-testid":"create-user-email",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),a("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[e("button",{type:"button",onClick:()=>d(!1),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:"\u30AD\u30E3\u30F3\u30BB\u30EB"}),e("button",{type:"submit","data-testid":"submit-create-user",style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#0284c7",color:"#ffffff",border:"none",cursor:"pointer"},children:"\u4F5C\u6210"})]})]})}),o&&e("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},"data-testid":"user-edit-modal",children:a("form",{onSubmit:I,style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[e("h3",{style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:t.usersView.editUser}),a("div",{style:{marginBottom:"1rem"},children:[e("label",{htmlFor:"edit-user-display-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.usersView.displayName}),e("input",{id:"edit-user-display-name-input",type:"text",value:o.displayName,onChange:m=>i({...o,displayName:m.target.value}),required:!0,"data-testid":"edit-user-display-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),a("div",{style:{marginBottom:"1.2rem"},children:[e("label",{htmlFor:"edit-user-email-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.usersView.email}),e("input",{id:"edit-user-email-input",type:"email",value:o.email,onChange:m=>i({...o,email:m.target.value}),required:!0,"data-testid":"edit-user-email",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),a("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[e("button",{type:"button",onClick:()=>i(null),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:t.usersView.cancel}),e("button",{type:"submit","data-testid":"submit-edit-user",style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#0284c7",color:"#ffffff",border:"none",cursor:"pointer"},children:t.usersView.save})]})]})})]})}function q({status:r,labels:s}){if(r.linkedGroupCount===0)return null;let t=[];return r.isEnabled||t.push({id:"disabled",text:s.directoryView.disabledWarning}),r.pausedGroupCount>0&&t.push({id:"paused",text:`${s.directoryView.syncPaused}: ${r.pausedGroupCount} / ${r.linkedGroupCount}`}),r.isStale&&t.push({id:"stale",text:s.directoryView.staleWarning}),r.erroredGroupIds.length>0&&t.push({id:"errored",text:`${s.directoryView.title}: ${r.erroredGroupIds.join(", ")}`}),t.length===0?null:e("div",{"data-testid":"directory-sync-banner",role:"status",style:{display:"flex",flexDirection:"column",gap:"0.35rem",padding:"0.7rem 1rem",borderRadius:"6px",border:"1px solid #fde68a",backgroundColor:"#fffbeb",color:"#92400e",fontSize:"0.85rem"},children:t.map(p=>e("span",{"data-directory-warning":p.id,children:p.text},p.id))})}function K(){let r=U(),s=V(),t=r.labels??S,[p,g]=f(""),[o,i]=f(!1),[n,d]=f(null),[c,w]=f(""),[x,l]=f(""),[y,h]=f(""),C=r.groups.filter(u=>u.name.toLowerCase().includes(p.toLowerCase())||u.groupKey.toLowerCase().includes(p.toLowerCase())),I=u=>{u.preventDefault(),c&&x&&(s.submit({intent:"createGroup",groupKey:c,name:x,description:y},{method:"post"}),w(""),l(""),h(""),i(!1))},m=u=>{u.preventDefault(),n&&(s.submit({intent:"updateGroup",groupId:String(n.id),name:n.name,description:n.description??""},{method:"post"}),d(null))},D=u=>{window.confirm(t.groupsView.confirmDelete)&&s.submit({intent:"deleteGroup",groupId:String(u)},{method:"post"})};return a("section",{"data-testid":"groups-view-section",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[e(R,{fetcher:s}),e(q,{status:r.directoryStatus,labels:t}),a("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[e("input",{type:"text",placeholder:t.groupsView.searchPlaceholder,value:p,onChange:u=>g(u.target.value),"data-testid":"groups-search-input",style:{padding:"6px 12px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",width:"260px"}}),e("button",{type:"button",onClick:()=>i(!0),"data-testid":"groups-add-button",style:{padding:"6px 14px",borderRadius:"6px",backgroundColor:"#4338ca",color:"#ffffff",border:"none",fontSize:"0.85rem",fontWeight:600,cursor:"pointer"},children:t.groupsView.addGroup})]}),e("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"1rem"},children:C.map(u=>{let L=r.groupMembers.filter(N=>N.groupId===u.id).length;return a("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0",padding:"1rem",display:"flex",flexDirection:"column",justifyContent:"space-between"},"data-testid":`group-card-${u.id}`,"data-group-readonly":u.readOnly?"true":"false",children:[a("div",{children:[a("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.5rem"},children:[e("h4",{style:{margin:0,fontSize:"1rem",color:"#0f172a"},children:u.name}),e("span",{style:{fontSize:"0.72rem",backgroundColor:"#e0e7ff",color:"#4338ca",padding:"2px 6px",borderRadius:"4px",fontFamily:"monospace"},children:u.groupKey})]}),e("p",{style:{margin:"0 0 0.8rem 0",fontSize:"0.82rem",color:"#64748b",minHeight:"2.4em"},children:u.description||t.groupsView.noDescription}),u.externalLink&&a("div",{"data-testid":`group-source-${u.id}`,style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap",marginBottom:"0.6rem"},children:[e("span",{style:{fontSize:"0.72rem",padding:"2px 8px",borderRadius:"10px",backgroundColor:"#ede9fe",color:"#6d28d9",fontWeight:600},children:t.directoryView.managedUpstream}),e("span",{style:{fontSize:"0.72rem",fontFamily:"monospace",color:"#64748b"},children:u.externalLink.externalKey}),u.externalLink.unresolvedCount>0&&a("span",{"data-testid":`group-unresolved-${u.id}`,style:{fontSize:"0.72rem",color:"#b45309"},children:[u.externalLink.unresolvedCount," ",t.directoryView.unresolved]})]})]}),a("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",borderTop:"1px solid #f1f5f9",paddingTop:"0.6rem"},children:[a("span",{style:{fontSize:"0.78rem",color:"#475569"},children:["\u{1F465} ",e("strong",{children:L})]}),u.readOnly?e("span",{"data-testid":`readonly-group-${u.id}`,style:{fontSize:"0.75rem",color:"#94a3b8"},children:t.allowlistView.readOnly}):a("div",{children:[e("button",{type:"button",onClick:()=>d(u),"data-testid":`edit-group-btn-${u.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"0.75rem",cursor:"pointer",marginRight:"4px"},children:t.usersView.edit}),e("button",{type:"button",onClick:()=>D(u.id),"data-testid":`delete-group-btn-${u.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #fee2e2",backgroundColor:"#fff5f5",color:"#b91c1c",fontSize:"0.75rem",cursor:"pointer"},children:t.allowlistView.delete})]})]})]},u.id)})}),o&&e("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},"data-testid":"group-create-modal",children:a("form",{onSubmit:I,style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[e("h3",{style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:t.groupsView.addGroup}),a("div",{style:{marginBottom:"1rem"},children:[e("label",{htmlFor:"create-group-key-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.groupsView.groupKey}),e("input",{id:"create-group-key-input",type:"text",value:c,onChange:u=>w(u.target.value),placeholder:t.groupsView.groupKeyPlaceholder,required:!0,"data-testid":"create-group-key",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),a("div",{style:{marginBottom:"1rem"},children:[e("label",{htmlFor:"create-group-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.groupsView.name}),e("input",{id:"create-group-name-input",type:"text",value:x,onChange:u=>l(u.target.value),placeholder:t.groupsView.namePlaceholder,required:!0,"data-testid":"create-group-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),a("div",{style:{marginBottom:"1.2rem"},children:[e("label",{htmlFor:"create-group-desc-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.groupsView.description}),e("textarea",{id:"create-group-desc-input",value:y,onChange:u=>h(u.target.value),"data-testid":"create-group-description",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box",height:"60px"}})]}),a("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[e("button",{type:"button",onClick:()=>i(!1),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:"\u30AD\u30E3\u30F3\u30BB\u30EB"}),e("button",{type:"submit","data-testid":"submit-create-group",style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#4338ca",color:"#ffffff",border:"none",cursor:"pointer"},children:"\u4F5C\u6210"})]})]})}),n&&e("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},"data-testid":"group-edit-modal",children:a("form",{onSubmit:m,style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[e("h3",{style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:t.groupsView.editGroup}),a("div",{style:{marginBottom:"1rem"},children:[e("label",{htmlFor:"edit-group-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.groupsView.name}),e("input",{id:"edit-group-name-input",type:"text",value:n.name,onChange:u=>d({...n,name:u.target.value}),required:!0,"data-testid":"edit-group-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),a("div",{style:{marginBottom:"1.2rem"},children:[e("label",{htmlFor:"edit-group-desc-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.groupsView.description}),e("textarea",{id:"edit-group-desc-input",value:n.description??"",onChange:u=>d({...n,description:u.target.value}),"data-testid":"edit-group-description",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box",height:"60px"}})]}),a("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[e("button",{type:"button",onClick:()=>d(null),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:t.groupsView.cancel}),e("button",{type:"submit","data-testid":"submit-edit-group",style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#4338ca",color:"#ffffff",border:"none",cursor:"pointer"},children:t.groupsView.save})]})]})})]})}function O(){let r=U(),s=V(),t=r.labels??S,[p,g]=f(r.groups[0]?.id??0),o=r.groups.find(d=>d.id===p),i=new Set(r.groupMembers.filter(d=>d.groupId===p).map(d=>d.userId)),n=(d,c)=>{c?s.submit({intent:"removeGroupMember",groupId:String(p),userId:String(d)},{method:"post"}):s.submit({intent:"addGroupMember",groupId:String(p),userId:String(d)},{method:"post"})};return a("section",{"data-testid":"group-members-view-section",style:{display:"grid",gridTemplateColumns:"240px 1fr",gap:"1.2rem"},children:[e(R,{fetcher:s}),a("div",{style:{backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[e("h4",{style:{margin:"0 0 0.8rem 0",fontSize:"0.9rem",color:"#475569"},children:t.groupMembersView.selectGroup}),e("div",{style:{display:"flex",flexDirection:"column",gap:"0.4rem"},children:r.groups.map(d=>{let c=d.id===p;return e("button",{type:"button",onClick:()=>g(d.id),"data-testid":`select-group-btn-${d.id}`,style:{textAlign:"left",padding:"8px 10px",borderRadius:"6px",border:c?"1px solid #6366f1":"1px solid #e2e8f0",backgroundColor:c?"#e0e7ff":"#ffffff",color:c?"#3730a3":"#0f172a",cursor:"pointer",fontWeight:c?600:400,fontSize:"0.85rem"},children:d.name},d.id)})})]}),e("div",{style:{backgroundColor:"#ffffff",padding:"1.2rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:o?a(J,{children:[a("div",{style:{marginBottom:"1rem",borderBottom:"1px solid #e2e8f0",paddingBottom:"0.8rem"},children:[a("h3",{style:{margin:0,fontSize:"1.1rem",color:"#0f172a"},children:[o.name," \u306E\u6240\u5C5E\u30E1\u30F3\u30D0\u30FC"]}),a("span",{style:{fontSize:"0.8rem",color:"#64748b"},children:["\u30B0\u30EB\u30FC\u30D7\u30AD\u30FC: ",o.groupKey]})]}),e("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:r.users.map(d=>{let c=i.has(d.id);return a("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 12px",borderRadius:"6px",border:"1px solid #f1f5f9",backgroundColor:c?"#f0fdf4":"#ffffff"},"data-testid":`member-row-${d.id}`,children:[a("div",{children:[e("span",{style:{fontWeight:600,fontSize:"0.88rem",color:"#0f172a",marginRight:"8px"},children:d.displayName}),a("span",{style:{fontSize:"0.78rem",color:"#64748b"},children:["(",d.email,")"]})]}),e("button",{type:"button",onClick:()=>n(d.id,c),"data-testid":`toggle-member-btn-${d.id}`,style:{padding:"4px 12px",borderRadius:"4px",border:c?"1px solid #b91c1c":"1px solid #0284c7",backgroundColor:c?"#ffffff":"#0284c7",color:c?"#b91c1c":"#ffffff",fontSize:"0.78rem",fontWeight:600,cursor:"pointer"},children:c?t.groupMembersView.actionRemove:t.groupMembersView.actionAdd})]},d.id)})})]}):e("div",{style:{color:"#94a3b8",textAlign:"center",padding:"2rem"},children:t.groupMembersView.selectPrompt})})]})}function j(r){return r==="email"?{backgroundColor:"#e0f2fe",color:"#0369a1"}:r==="domain"?{backgroundColor:"#fef3c7",color:"#b45309"}:{backgroundColor:"#ede9fe",color:"#6d28d9"}}function Q(r,s){return r==="email"?s.allowlistView.emailTypeShort:r==="domain"?s.allowlistView.domainTypeShort:s.allowlistView.groupTypeShort}function _(){let r=U(),s=V(),t=r.labels??S,[p,g]=f(""),[o,i]=f("email"),[n,d]=f(""),c=l=>{l.preventDefault(),p&&(s.submit({intent:"addAllowlistEntry",pattern:p,type:o,description:n},{method:"post"}),g(""),d(""))},w=l=>{s.submit({intent:"removeAllowlistEntry",entryId:String(l)},{method:"post"})},x=l=>{s.submit({intent:"removeAllowlistGroup",entryId:String(l)},{method:"post"})};return a("section",{"data-testid":"allowlist-view-section",style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[e(R,{fetcher:s}),a("form",{onSubmit:c,style:{backgroundColor:"#ffffff",padding:"1.2rem",borderRadius:"8px",border:"1px solid #e2e8f0",display:"flex",flexWrap:"wrap",gap:"0.8rem",alignItems:"flex-end"},children:[a("div",{style:{flex:2,minWidth:"220px"},children:[e("label",{htmlFor:"allowlist-pattern-input-field",style:{display:"block",fontSize:"0.78rem",color:"#475569",marginBottom:"4px"},children:t.allowlistView.pattern}),e("input",{id:"allowlist-pattern-input-field",type:"text",value:p,onChange:l=>g(l.target.value),required:!0,"data-testid":"allowlist-pattern-input",style:{width:"100%",padding:"6px 10px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",boxSizing:"border-box"}})]}),a("div",{style:{flex:1,minWidth:"140px"},children:[e("label",{htmlFor:"allowlist-type-select-field",style:{display:"block",fontSize:"0.78rem",color:"#475569",marginBottom:"4px"},children:t.allowlistView.type}),a("select",{id:"allowlist-type-select-field",value:o,onChange:l=>i(l.target.value),"data-testid":"allowlist-type-select",style:{width:"100%",padding:"6px 10px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",boxSizing:"border-box"},children:[e("option",{value:"email",children:t.allowlistView.emailType}),e("option",{value:"domain",children:t.allowlistView.domainType})]})]}),a("div",{style:{flex:2,minWidth:"200px"},children:[e("label",{htmlFor:"allowlist-desc-input-field",style:{display:"block",fontSize:"0.78rem",color:"#475569",marginBottom:"4px"},children:t.allowlistView.description}),e("input",{id:"allowlist-desc-input-field",type:"text",value:n,onChange:l=>d(l.target.value),"data-testid":"allowlist-desc-input",style:{width:"100%",padding:"6px 10px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",boxSizing:"border-box"}})]}),e("button",{type:"submit","data-testid":"submit-allowlist-add",style:{padding:"7px 16px",borderRadius:"6px",backgroundColor:"#047857",color:"#ffffff",border:"none",fontSize:"0.85rem",fontWeight:600,cursor:"pointer"},children:t.allowlistView.addEntry})]}),e("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0",overflow:"hidden"},children:a("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"0.85rem",textAlign:"left"},children:[e("thead",{children:a("tr",{style:{backgroundColor:"#f8fafc",borderBottom:"1px solid #e2e8f0",color:"#475569"},children:[e("th",{style:{padding:"10px 14px"},children:"ID"}),e("th",{style:{padding:"10px 14px"},children:t.allowlistView.target}),e("th",{style:{padding:"10px 14px"},children:t.allowlistView.type}),e("th",{style:{padding:"10px 14px"},children:t.allowlistView.description}),e("th",{style:{padding:"10px 14px",textAlign:"right"},children:t.allowlistView.actions})]})}),a("tbody",{children:[r.allowlist.map(l=>a("tr",{style:{borderBottom:"1px solid #f1f5f9"},"data-testid":`allowlist-row-${l.id}`,"data-allowlist-type":l.type,children:[a("td",{style:{padding:"10px 14px",color:"#64748b"},children:["#",l.id]}),e("td",{style:{padding:"10px 14px",fontWeight:600,color:"#0f172a"},children:l.type==="group"?a("span",{"data-testid":`allowlist-group-${l.id}`,children:[l.groupName,e("span",{style:{marginLeft:"6px",fontFamily:"monospace",fontSize:"0.78rem",color:"#64748b"},children:l.groupKey})]}):e("span",{style:{fontFamily:"monospace"},children:l.pattern})}),e("td",{style:{padding:"10px 14px"},children:e("span",{style:{fontSize:"0.75rem",padding:"2px 8px",borderRadius:"10px",...j(l.type),fontWeight:600},children:Q(l.type,t)})}),a("td",{style:{padding:"10px 14px",color:"#475569"},children:[l.description||"-",l.owner.kind==="deployment"&&e("span",{"data-testid":`allowlist-owner-${l.id}`,style:{marginLeft:"8px",fontSize:"0.72rem",color:"#94a3b8"},children:t.allowlistView.deploymentOwner})]}),e("td",{style:{padding:"10px 14px",textAlign:"right"},children:l.readOnly?e("span",{"data-testid":`readonly-allowlist-${l.id}`,style:{fontSize:"0.75rem",color:"#94a3b8"},children:t.allowlistView.readOnly}):e("button",{type:"button",onClick:()=>l.type==="group"?x(l.id):w(l.id),"data-testid":`remove-allowlist-btn-${l.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #fee2e2",backgroundColor:"#fff5f5",color:"#b91c1c",fontSize:"0.78rem",cursor:"pointer"},children:t.allowlistView.delete})})]},`${l.type}-${l.id}`)),r.allowlist.length===0&&e("tr",{children:e("td",{colSpan:5,style:{padding:"2rem",textAlign:"center",color:"#94a3b8"},children:t.allowlistView.empty})})]})]})})]})}var H={users:z,groups:K,group_members:O,allowlist:_};function ue({renderHeader:r}={}){let t=U()?.segment??"users",p=H[t]??z;return e(P,{renderHeader:r,children:e(p,{})})}export{_ as AllowlistView,ue as AuthUserAdminAppView,O as GroupMembersView,K as GroupsView,P as UserAdminShell,z as UsersView,ee as createInMemoryUserAdminStore,te as createUserAdminApp,S as defaultUserAdminLabels,X as jaUserAdminLabels,M as resolveUserAdminLabels};
2
2
  //# sourceMappingURL=admin.mjs.map