@aiquants/auth-react-router 0.12.0 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/admin.d.mts CHANGED
@@ -29,7 +29,6 @@ type UserAdminLabels = {
29
29
  * ここ 1 か所に置く。
30
30
  */
31
31
  common: {
32
- add: string;
33
32
  create: string;
34
33
  edit: string;
35
34
  delete: string;
@@ -111,6 +110,9 @@ type UserAdminLabels = {
111
110
  /** 所属人数。`{count}` を人数へ置換する。 */
112
111
  memberCountTemplate: string;
113
112
  confirmDelete: string;
113
+ /** 行ごとの読み上げ名。`{group}` をグループ名へ置換する。 */
114
+ editGroupAria: string;
115
+ deleteGroupAria: string;
114
116
  noDescription: string;
115
117
  groupKeyPlaceholder: string;
116
118
  namePlaceholder: string;
@@ -156,9 +158,6 @@ type UserAdminLabels = {
156
158
  };
157
159
  directoryView: {
158
160
  title: string;
159
- /** 出所列。ローカル管理か、どの上流かを示す。 */
160
- source: string;
161
- localSource: string;
162
161
  membershipMode: string;
163
162
  directMode: string;
164
163
  transitiveMode: string;
@@ -191,6 +190,7 @@ type UserAdminLabels = {
191
190
  notWiredNotice: string;
192
191
  /** 行ごとの読み上げ名。`{group}` をグループ名へ置換する。 */
193
192
  syncNowAria: string;
193
+ syncQueuedAria: string;
194
194
  pauseAria: string;
195
195
  resumeAria: string;
196
196
  allowGroupAria: string;
@@ -202,10 +202,6 @@ type UserAdminLabels = {
202
202
  unlink: string;
203
203
  externalKey: string;
204
204
  empty: string;
205
- /** 直近の同期が失敗したグループの見出し。件数だけでは何が起きたか判らない。 */
206
- erroredWarning: string;
207
- /** 同期有効なリンクのうち最も古い成功時刻。滞留の実際の深さを示す。 */
208
- oldestSyncedAt: string;
209
205
  /** 連携するグループを選ぶ欄。 */
210
206
  selectGroup: string;
211
207
  /** 上流グループのアドレス入力。 */
@@ -428,7 +424,7 @@ type UserAdminAppConfig = {
428
424
  declare function createUserAdminApp(config: UserAdminAppConfig): {
429
425
  loader: ({ request }: RouteArgs) => Promise<{
430
426
  resourceLabels: Record<string, string> | undefined;
431
- segment: string;
427
+ segment: "users" | "groups" | "allowlist" | "directory" | "group_members";
432
428
  users: AuthUser[];
433
429
  groups: AuthGroup[];
434
430
  groupMembers: AuthGroupMember[];
package/dist/admin.d.ts CHANGED
@@ -29,7 +29,6 @@ type UserAdminLabels = {
29
29
  * ここ 1 か所に置く。
30
30
  */
31
31
  common: {
32
- add: string;
33
32
  create: string;
34
33
  edit: string;
35
34
  delete: string;
@@ -111,6 +110,9 @@ type UserAdminLabels = {
111
110
  /** 所属人数。`{count}` を人数へ置換する。 */
112
111
  memberCountTemplate: string;
113
112
  confirmDelete: string;
113
+ /** 行ごとの読み上げ名。`{group}` をグループ名へ置換する。 */
114
+ editGroupAria: string;
115
+ deleteGroupAria: string;
114
116
  noDescription: string;
115
117
  groupKeyPlaceholder: string;
116
118
  namePlaceholder: string;
@@ -156,9 +158,6 @@ type UserAdminLabels = {
156
158
  };
157
159
  directoryView: {
158
160
  title: string;
159
- /** 出所列。ローカル管理か、どの上流かを示す。 */
160
- source: string;
161
- localSource: string;
162
161
  membershipMode: string;
163
162
  directMode: string;
164
163
  transitiveMode: string;
@@ -191,6 +190,7 @@ type UserAdminLabels = {
191
190
  notWiredNotice: string;
192
191
  /** 行ごとの読み上げ名。`{group}` をグループ名へ置換する。 */
193
192
  syncNowAria: string;
193
+ syncQueuedAria: string;
194
194
  pauseAria: string;
195
195
  resumeAria: string;
196
196
  allowGroupAria: string;
@@ -202,10 +202,6 @@ type UserAdminLabels = {
202
202
  unlink: string;
203
203
  externalKey: string;
204
204
  empty: string;
205
- /** 直近の同期が失敗したグループの見出し。件数だけでは何が起きたか判らない。 */
206
- erroredWarning: string;
207
- /** 同期有効なリンクのうち最も古い成功時刻。滞留の実際の深さを示す。 */
208
- oldestSyncedAt: string;
209
205
  /** 連携するグループを選ぶ欄。 */
210
206
  selectGroup: string;
211
207
  /** 上流グループのアドレス入力。 */
@@ -428,7 +424,7 @@ type UserAdminAppConfig = {
428
424
  declare function createUserAdminApp(config: UserAdminAppConfig): {
429
425
  loader: ({ request }: RouteArgs) => Promise<{
430
426
  resourceLabels: Record<string, string> | undefined;
431
- segment: string;
427
+ segment: "users" | "groups" | "allowlist" | "directory" | "group_members";
432
428
  users: AuthUser[];
433
429
  groups: AuthGroup[];
434
430
  groupMembers: AuthGroupMember[];
package/dist/admin.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var $=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var re=Object.getOwnPropertyNames;var te=Object.prototype.hasOwnProperty;var oe=(r,o)=>{for(var s in o)$(r,s,{get:o[s],enumerable:!0})},ie=(r,o,s,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of re(o))!te.call(r,t)&&t!==s&&$(r,t,{get:()=>o[t],enumerable:!(i=ee(o,t))||i.enumerable});return r};var ne=r=>ie($({},"__esModule",{value:!0}),r);var xe={};oe(xe,{AllowlistView:()=>_,AuthUserAdminAppView:()=>fe,DirectoryView:()=>Y,GroupMembersView:()=>H,GroupsView:()=>Z,UserAdminShell:()=>K,UsersView:()=>q,createInMemoryUserAdminStore:()=>ae,createUserAdminApp:()=>ce,defaultUserAdminLabels:()=>U,jaUserAdminLabels:()=>se,resolveUserAdminLabels:()=>B});module.exports=ne(xe);var U={title:"Users & Groups",locale:"en-US",timeZone:"UTC",heading:"\u{1F464} User administration",common:{add:"Add",create:"Create",edit:"Edit",delete:"Delete",save:"Save",cancel:"Cancel",actions:"Actions",status:"Status",id:"ID",readOnly:"Read-only",managedUpstream:"Managed upstream",idTemplate:"#{id}",none:"-"},errors:{forbidden:"You do not have permission for this operation."},permissions:{label:"Your permissions:",canWrite:"Editable",canRead:"Read only",none:"No access",unknown:"Unknown"},tabs:{users:"\u{1F464} Users",groups:"\u{1F465} Groups",groupMembers:"\u{1F517} Members",allowlist:"\u2709\uFE0F Allowlist",directory:"\u{1F504} Directory"},usersView:{title:"Users",searchPlaceholder:"Search by name or email...",searchLabel:"Search users",addUser:"\uFF0B Add user",editUser:"Edit user",displayName:"Name",email:"Email",active:"Active",inactive:"Inactive",activate:"Activate",deactivate:"Deactivate",editUserAria:"Edit {user}",activateAria:"Activate {user}",deactivateAria:"Deactivate {user}",confirmDeactivate:"Deactivate this user? They will no longer be able to sign in.",empty:"No matching users"},groupsView:{emptyFiltered:"No group matches this search",title:"Groups",searchPlaceholder:"Search by group name or key...",searchLabel:"Search groups",addGroup:"\uFF0B Add group",editGroup:"Edit group",groupKey:"Group key",name:"Name",description:"Description",memberCountTemplate:"{count} members",confirmDelete:"Delete this group?",noDescription:"No description",groupKeyPlaceholder:"e.g. dev-team",namePlaceholder:"e.g. Development team",empty:"No groups registered"},groupMembersView:{title:"Group members",selectGroup:"Select a group",selectPrompt:"Select a group to manage its members",actionAdd:"Add",actionRemove:"Remove",actionAddAria:"Add {user} to this group",actionRemoveAria:"Remove {user} from this group",upstreamNotice:"Membership of this group is owned by the upstream directory. Edit it there \u2014 a local change would be reverted at the next synchronization.",membersOfTemplate:"Members of {group}",groupKeyLabel:"Group key"},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",deploymentOwner:"Deployment-wide",confirmDelete:"Remove this allowlist entry? Anyone who could sign in only through it will be locked out.",deleteAria:"Remove the allowlist entry for {target}",empty:"No allowlist entries registered"},directoryView:{title:"Directory synchronization",source:"Source",localSource:"Local",membershipMode:"Membership",directMode:"Direct only",transitiveMode:"Nested expanded",lastSynced:"Last synced",neverSynced:"Never",unresolvedTemplate:"{count} 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.",pausedTemplate:"{paused} of {total} links are paused",erroredTemplate:"Last synchronization failed for {groups}",erroredItemTemplate:"{group}: {reason}",listSeparator:", ",oldestSyncedTemplate:"oldest successful sync: {at}",pendingTemplate:"{count} sync requests are queued",nothingToLink:"Every group is already linked to a directory.",notWiredNotice:"Directory synchronization is not wired for this deployment, so links cannot be created or changed here.",syncNowAria:"Synchronize {group} now",pauseAria:"Pause synchronization of {group}",resumeAria:"Resume synchronization of {group}",allowGroupAria:"Allow members of {group} to sign in",disallowGroupAria:"Stop allowing members of {group} to sign in",unlinkAria:"Unlink {group} from the directory",confirmDisallow:"Stop allowing this group to sign in? Anyone who could sign in only through it will be locked out.",link:"Link to a directory group",unlink:"Unlink",externalKey:"Upstream group",empty:"No groups are linked to a directory",erroredWarning:"Last synchronization failed for",oldestSyncedAt:"Oldest successful sync",selectGroup:"Group to link",externalKeyPlaceholder:"e.g. dev-team@example.com",confirmUnlink:"Unlink this group? Its member ledger and group-based sign-in permission are removed.",pause:"Pause",resume:"Resume",allowGroup:"Allow sign-in",disallowGroup:"Stop allowing sign-in",groupOptionTemplate:"{name} ({key})"}},se={title:"\u30E6\u30FC\u30B6\u30FC\u30FB\u30B0\u30EB\u30FC\u30D7\u7BA1\u7406",locale:"ja-JP",timeZone:"Asia/Tokyo",heading:"\u{1F464} \u30E6\u30FC\u30B6\u30FC\u7BA1\u7406",common:{add:"\u8FFD\u52A0",create:"\u4F5C\u6210",edit:"\u7DE8\u96C6",delete:"\u524A\u9664",save:"\u4FDD\u5B58",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",actions:"\u64CD\u4F5C",status:"\u72B6\u614B",id:"ID",readOnly:"\u5909\u66F4\u4E0D\u53EF",managedUpstream:"\u4E0A\u6D41\u304C\u6240\u6709",idTemplate:"#{id}",none:"-"},errors:{forbidden:"\u3053\u306E\u64CD\u4F5C\u3092\u884C\u3046\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002"},permissions:{label:"\u3042\u306A\u305F\u306E\u6A29\u9650:",canWrite:"\u7DE8\u96C6\u53EF",canRead:"\u95B2\u89A7\u306E\u307F",none:"\u6A29\u9650\u306A\u3057",unknown:"\u6A29\u9650\u4E0D\u660E"},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",directory:"\u{1F504} \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u9023\u643A"},usersView:{title:"\u30E6\u30FC\u30B6\u30FC\u7BA1\u7406",searchPlaceholder:"\u8868\u793A\u540D\u3084 Email \u3067\u691C\u7D22...",searchLabel:"\u30E6\u30FC\u30B6\u30FC\u3092\u691C\u7D22",addUser:"\uFF0B \u30E6\u30FC\u30B6\u30FC\u8FFD\u52A0",editUser:"\u30E6\u30FC\u30B6\u30FC\u7DE8\u96C6",displayName:"\u8868\u793A\u540D",email:"Email",active:"\u6709\u52B9",inactive:"\u7121\u52B9",activate:"\u6709\u52B9\u5316",deactivate:"\u7121\u52B9\u5316",editUserAria:"{user} \u3092\u7DE8\u96C6",activateAria:"{user} \u3092\u6709\u52B9\u5316",deactivateAria:"{user} \u3092\u7121\u52B9\u5316",confirmDeactivate:"\u3053\u306E\u30E6\u30FC\u30B6\u30FC\u3092\u7121\u52B9\u5316\u3057\u307E\u3059\u304B\uFF1F \u4EE5\u5F8C\u30B5\u30A4\u30F3\u30A4\u30F3\u3067\u304D\u306A\u304F\u306A\u308A\u307E\u3059\u3002",empty:"\u8A72\u5F53\u3059\u308B\u30E6\u30FC\u30B6\u30FC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093"},groupsView:{emptyFiltered:"\u691C\u7D22\u6761\u4EF6\u306B\u4E00\u81F4\u3059\u308B\u30B0\u30EB\u30FC\u30D7\u306F\u3042\u308A\u307E\u305B\u3093",title:"\u30E6\u30FC\u30B6\u30FC\u30B0\u30EB\u30FC\u30D7\u7BA1\u7406",searchPlaceholder:"\u30B0\u30EB\u30FC\u30D7\u540D\u3084\u30AD\u30FC\u3067\u691C\u7D22...",searchLabel:"\u30B0\u30EB\u30FC\u30D7\u3092\u691C\u7D22",addGroup:"\uFF0B \u30B0\u30EB\u30FC\u30D7\u8FFD\u52A0",editGroup:"\u30B0\u30EB\u30FC\u30D7\u7DE8\u96C6",groupKey:"\u30B0\u30EB\u30FC\u30D7\u30AD\u30FC",name:"\u540D\u79F0",description:"\u8AAC\u660E",memberCountTemplate:"\u6240\u5C5E {count} \u540D",confirmDelete:"\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u3092\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F",noDescription:"\u8AAC\u660E\u306A\u3057",groupKeyPlaceholder:"\u4F8B: dev-team",namePlaceholder:"\u4F8B: \u958B\u767A\u30C1\u30FC\u30E0",empty:"\u30E6\u30FC\u30B6\u30FC\u30B0\u30EB\u30FC\u30D7\u304C\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},groupMembersView:{title:"\u30B0\u30EB\u30FC\u30D7\u30E1\u30F3\u30D0\u30FC\u7BA1\u7406",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",actionAddAria:"{user} \u3092\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u3078\u8FFD\u52A0",actionRemoveAria:"{user} \u3092\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u304B\u3089\u9664\u5916",upstreamNotice:"\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u306E\u6240\u5C5E\u306F\u4E0A\u6D41\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u6240\u6709\u3057\u3066\u3044\u307E\u3059\u3002\u5909\u66F4\u306F\u4E0A\u6D41\u3067\u884C\u3063\u3066\u304F\u3060\u3055\u3044 (\u3053\u3053\u3067\u5909\u3048\u3066\u3082\u6B21\u306E\u540C\u671F\u3067\u5143\u306B\u623B\u308A\u307E\u3059)\u3002",membersOfTemplate:"{group} \u306E\u6240\u5C5E\u30E1\u30F3\u30D0\u30FC",groupKeyLabel:"\u30B0\u30EB\u30FC\u30D7\u30AD\u30FC"},allowlistView:{title:"\u30B5\u30A4\u30F3\u30A4\u30F3\u8A31\u53EF\u30EA\u30B9\u30C8",addEntry:"\uFF0B \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:"\u30E1\u30FC\u30EB",domainTypeShort:"\u30C9\u30E1\u30A4\u30F3",groupTypeShort:"\u30B0\u30EB\u30FC\u30D7",target:"\u5BFE\u8C61",description:"\u8AAC\u660E / \u5099\u8003",deploymentOwner:"\u914D\u5099\u5171\u901A",confirmDelete:"\u3053\u306E\u8A31\u53EF\u3092\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F \u3053\u308C\u3067\u3057\u304B\u30B5\u30A4\u30F3\u30A4\u30F3\u3067\u304D\u306A\u3044\u4EBA\u306F\u30ED\u30B0\u30A4\u30F3\u3067\u304D\u306A\u304F\u306A\u308A\u307E\u3059\u3002",deleteAria:"{target} \u306E\u8A31\u53EF\u3092\u524A\u9664",empty:"\u30A2\u30ED\u30EF\u30EA\u30B9\u30C8\u30A8\u30F3\u30C8\u30EA\u304C\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},directoryView:{title:"\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u540C\u671F",source:"\u51FA\u6240",localSource:"\u30ED\u30FC\u30AB\u30EB\u7BA1\u7406",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",unresolvedTemplate:"{count} \u4EF6\u304C\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",pausedTemplate:"\u9023\u643A {total} \u4EF6\u306E\u3046\u3061 {paused} \u4EF6\u304C\u505C\u6B62\u4E2D",erroredTemplate:"\u76F4\u8FD1\u306E\u540C\u671F\u306B\u5931\u6557\u3057\u305F\u30B0\u30EB\u30FC\u30D7: {groups}",erroredItemTemplate:"{group}: {reason}",listSeparator:" / ",oldestSyncedTemplate:"\u6700\u3082\u53E4\u3044\u540C\u671F\u6210\u529F: {at}",pendingTemplate:"{count} \u4EF6\u306E\u540C\u671F\u8981\u6C42\u304C\u672A\u51E6\u7406",nothingToLink:"\u3059\u3079\u3066\u306E\u30B0\u30EB\u30FC\u30D7\u304C\u65E2\u306B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3068\u9023\u643A\u3057\u3066\u3044\u307E\u3059\u3002",notWiredNotice:"\u3053\u306E\u914D\u5099\u3067\u306F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u540C\u671F\u304C\u7D50\u7DDA\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u3053\u3053\u304B\u3089\u9023\u643A\u306E\u4F5C\u6210\u30FB\u5909\u66F4\u306F\u3067\u304D\u307E\u305B\u3093\u3002",syncNowAria:"{group} \u3092\u4ECA\u3059\u3050\u540C\u671F",pauseAria:"{group} \u306E\u540C\u671F\u3092\u4E00\u6642\u505C\u6B62",resumeAria:"{group} \u306E\u540C\u671F\u3092\u518D\u958B",allowGroupAria:"{group} \u306E\u30E1\u30F3\u30D0\u30FC\u306E\u30B5\u30A4\u30F3\u30A4\u30F3\u3092\u8A31\u53EF",disallowGroupAria:"{group} \u306E\u30E1\u30F3\u30D0\u30FC\u306E\u30B5\u30A4\u30F3\u30A4\u30F3\u8A31\u53EF\u3092\u5916\u3059",unlinkAria:"{group} \u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u9023\u643A\u3092\u89E3\u9664",confirmDisallow:"\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u306E\u30B5\u30A4\u30F3\u30A4\u30F3\u8A31\u53EF\u3092\u5916\u3057\u307E\u3059\u304B\uFF1F \u3053\u308C\u3067\u3057\u304B\u30B5\u30A4\u30F3\u30A4\u30F3\u3067\u304D\u306A\u3044\u4EBA\u306F\u30ED\u30B0\u30A4\u30F3\u3067\u304D\u306A\u304F\u306A\u308A\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",erroredWarning:"\u76F4\u8FD1\u306E\u540C\u671F\u306B\u5931\u6557\u3057\u305F\u30B0\u30EB\u30FC\u30D7",oldestSyncedAt:"\u6700\u3082\u53E4\u3044\u540C\u671F\u6210\u529F",selectGroup:"\u9023\u643A\u3059\u308B\u30B0\u30EB\u30FC\u30D7",externalKeyPlaceholder:"\u4F8B: dev-team@example.com",confirmUnlink:"\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u306E\u9023\u643A\u3092\u89E3\u9664\u3057\u307E\u3059\u304B\uFF1F \u30E1\u30F3\u30D0\u30FC\u53F0\u5E33\u3068\u30B0\u30EB\u30FC\u30D7\u5358\u4F4D\u306E\u30B5\u30A4\u30F3\u30A4\u30F3\u8A31\u53EF\u304C\u5931\u308F\u308C\u307E\u3059\u3002",pause:"\u4E00\u6642\u505C\u6B62",resume:"\u518D\u958B",allowGroup:"\u30B5\u30A4\u30F3\u30A4\u30F3\u3092\u8A31\u53EF",disallowGroup:"\u30B5\u30A4\u30F3\u30A4\u30F3\u8A31\u53EF\u3092\u5916\u3059",groupOptionTemplate:"{name} ({key})"}};function B(r){let o=U;return r?{title:r.title??o.title,locale:r.locale??o.locale,timeZone:r.timeZone??o.timeZone,heading:r.heading??o.heading,common:{...o.common,...r.common},errors:{...o.errors,...r.errors},permissions:{...o.permissions,...r.permissions},tabs:{...o.tabs,...r.tabs},usersView:{...o.usersView,...r.usersView},groupsView:{...o.groupsView,...r.groupsView},groupMembersView:{...o.groupMembersView,...r.groupMembersView},allowlistView:{...o.allowlistView,...r.allowlistView},directoryView:{...o.directoryView,...r.directoryView}}:o}var j=require("react-router");function ae(r){let o=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}],s=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}],i=r?.groupMembers??[{id:1,groupId:1,userId:2},{id:2,groupId:2,userId:3}],t=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[...o]},async createUser(a){let n={id:Math.max(...o.map(d=>d.id),0)+1,email:a.email,displayName:a.displayName,isActive:!0};return o.push(n),n},async updateUser(a,n){let d=o.findIndex(l=>l.id===a);if(d===-1)throw new Error(`User not found: ${a}`);return o[d]={...o[d],displayName:n.displayName,email:n.email},o[d]},async toggleUserActive(a,n){let d=o.findIndex(l=>l.id===a);if(d===-1)throw new Error(`User not found: ${a}`);return o[d]={...o[d],isActive:n},o[d]},async listGroups(){return[...s]},async createGroup(a){let n={id:Math.max(...s.map(d=>d.id),0)+1,groupKey:a.groupKey,name:a.name,description:a.description,isActive:!0,readOnly:!1};return s.push(n),n},async updateGroup(a,n){let d=s.findIndex(l=>l.id===a);if(d===-1)throw new Error(`Group not found: ${a}`);return s[d]={...s[d],name:n.name,description:n.description},s[d]},async deleteGroup(a){s=s.filter(n=>n.id!==a),i=i.filter(n=>n.groupId!==a)},async listGroupMembers(){return[...i]},async addGroupMember(a,n){let d=i.find(m=>m.groupId===a&&m.userId===n);if(d)return d;let l={id:Math.max(...i.map(m=>m.id),0)+1,groupId:a,userId:n};return i.push(l),l},async removeGroupMember(a,n){i=i.filter(d=>!(d.groupId===a&&d.userId===n))},async listAllowlist(){return[...t]},async addAllowlistEntry(a){let n={id:Math.max(...t.map(d=>d.id),0)+1,pattern:a.pattern,type:a.type,description:a.description,owner:{kind:"tenant",tenantId:"default"},readOnly:!1};return t.push(n),n},async removeAllowlistEntry(a){t=t.filter(n=>n.id!==a)},async addAllowlistGroup(a,n){let d=s.find(l=>l.id===a);if(!d)throw new Error(`Group not found: ${a}`);t=[...t,{id:Math.max(...t.map(l=>l.id),0)+1,type:"group",groupId:a,groupKey:d.groupKey,groupName:d.name,description:n,owner:{kind:"tenant",tenantId:"default"},readOnly:!1}]},async removeAllowlistGroup(a){t=t.filter(n=>!(n.type==="group"&&n.id===a))},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,provider:"",linkedGroupCount:0,isStale:!1,pausedGroupCount:0,stalenessThresholdSec:0,erroredGroupIds:[],pendingRequestCount:0}}}}function de(r){return typeof r=="object"&&r!==null&&r.status===403}var le=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","create","delete"]],["unlinkDirectoryGroup",["update","delete"]],["setDirectorySyncEnabled",["update"]],["requestDirectorySync",["update"]]]);function S(r,o){let s=r.get(o),i=Number(s);if(s===null||String(s).trim()===""||!Number.isInteger(i)||i<=0)throw new Error(`Invalid or missing "${o}"`);return i}function R(r,o){let s=String(r.get(o)??"").trim();if(s==="")throw new Error(`Invalid or missing "${o}"`);return s}function pe(r,o){let s=String(r.get(o)??"");if(s!=="true"&&s!=="false")throw new Error(`Invalid or missing "${o}"`);return s==="true"}function ue(r){let o=String(r.get("membershipMode")??"");if(o!=="direct"&&o!=="transitive")throw new Error('Invalid or missing "membershipMode"');return o}function D(r,o){let s=String(r.get(o)??"").trim();return s===""?void 0:s}function ce(r){let o=B(r.labels);async function s({request:a}){await r.guards.requireAccess(a,{action:"read",intent:"loader"});let d=new URL(a.url).pathname.split("/").filter(Boolean),l=d[d.length-1]??"users",[m,g,b,v,f,u]=await Promise.all([r.store.listUsers(),r.store.listGroups(),r.store.listGroupMembers(),r.store.listAllowlist(),r.store.getDirectoryStatus(),r.getMyPermissions?r.getMyPermissions(a).catch(A=>(console.error("[@aiquants/auth-react-router] getMyPermissions failed; rendering the permission badge as unknown:",A),null)):Promise.resolve(null)]);return{resourceLabels:r.resourceLabels,segment:["groups","group_members","allowlist","directory"].includes(l)?l:"users",users:m,groups:g,groupMembers:b,allowlist:v,directoryStatus:f,myPermissions:u,labels:o}}async function i({request:a}){let n=await a.formData(),d=String(n.get("intent")??""),l=le.get(d);if(!l)return{ok:!1,error:`Unknown intent: ${d}`};try{for(let m of l)await r.guards.requireAccess(a,{action:m,intent:d})}catch(m){if(!de(m))throw m;return r.guards.onDenied?.({intent:d,actions:l,error:m}),(0,j.data)({ok:!1,error:o.errors.forbidden},{status:403})}try{return await t(d,n)}catch(m){if(m instanceof Response)throw m;return{ok:!1,error:m instanceof Error?m.message:String(m)}}}async function t(a,n){if(a==="createUser")return await r.store.createUser({displayName:R(n,"displayName"),email:R(n,"email")}),{ok:!0};if(a==="updateUser")return await r.store.updateUser(S(n,"userId"),{displayName:R(n,"displayName"),email:R(n,"email")}),{ok:!0};if(a==="toggleUserActive"){let d=String(n.get("isActive")??"");if(d!=="true"&&d!=="false")throw new Error('Invalid or missing "isActive"');return await r.store.toggleUserActive(S(n,"userId"),d==="true"),{ok:!0}}if(a==="createGroup")return await r.store.createGroup({groupKey:R(n,"groupKey"),name:R(n,"name"),description:D(n,"description")}),{ok:!0};if(a==="updateGroup")return await r.store.updateGroup(S(n,"groupId"),{name:R(n,"name"),description:D(n,"description")}),{ok:!0};if(a==="deleteGroup")return await r.store.deleteGroup(S(n,"groupId")),{ok:!0};if(a==="addGroupMember")return await r.store.addGroupMember(S(n,"groupId"),S(n,"userId")),{ok:!0};if(a==="removeGroupMember")return await r.store.removeGroupMember(S(n,"groupId"),S(n,"userId")),{ok:!0};if(a==="addAllowlistEntry"){let d=n.get("type")==="domain"?"domain":"email";return await r.store.addAllowlistEntry({pattern:R(n,"pattern"),type:d,description:D(n,"description")}),{ok:!0}}if(a==="addAllowlistGroup")return await r.store.addAllowlistGroup(S(n,"groupId"),D(n,"description")),{ok:!0};if(a==="removeAllowlistGroup")return await r.store.removeAllowlistGroup(S(n,"entryId")),{ok:!0};if(a==="linkDirectoryGroup")return await r.store.linkDirectoryGroup(S(n,"groupId"),{provider:R(n,"provider"),externalKey:R(n,"externalKey"),membershipMode:ue(n)}),{ok:!0};if(a==="unlinkDirectoryGroup")return await r.store.unlinkDirectoryGroup(S(n,"groupId")),{ok:!0};if(a==="setDirectorySyncEnabled")return await r.store.setDirectorySyncEnabled(S(n,"groupId"),pe(n,"isSyncEnabled")),{ok:!0};if(a==="requestDirectorySync"){let d=String(n.get("groupId")??"").trim();return await r.store.requestDirectorySync(d===""?null:S(n,"groupId")),{ok:!0}}return a==="removeAllowlistEntry"?(await r.store.removeAllowlistEntry(S(n,"entryId")),{ok:!0}):{ok:!1,error:`Unknown intent: ${a}`}}return{loader:s,action:i}}var N=require("react-router");function h(r,o){return Object.entries(o).reduce((s,[i,t])=>s.replaceAll(`{${i}}`,String(t)),r)}function P(r,o){return new Intl.DateTimeFormat(o.locale,{timeZone:o.timeZone,dateStyle:"medium",timeStyle:"short"}).format(new Date(r))}var w=require("react/jsx-runtime");function Q({label:r,summary:o}){return(0,w.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.18rem",fontSize:"0.65rem",padding:"0.08rem 0.35rem",borderRadius:"9999px",backgroundColor:o.bgColor,color:o.color,border:`1px solid ${o.borderColor}`,fontWeight:600,lineHeight:"1.2"},children:[(0,w.jsxs)("span",{children:[r,":"]}),(0,w.jsx)("span",{children:o.text})]})}function me({status:r,labels:o,groups:s}){if(!r||r.linkedGroupCount===0)return null;let i=o.directoryView,t=[];if(r.isEnabled||t.push({id:"disabled",text:i.disabledWarning}),r.pausedGroupCount>0&&t.push({id:"paused",text:h(i.pausedTemplate,{paused:r.pausedGroupCount,total:r.linkedGroupCount})}),r.isStale){let a=r.oldestSyncedAt?P(r.oldestSyncedAt,o):i.neverSynced;t.push({id:"stale",text:`${i.staleWarning} ${h(i.oldestSyncedTemplate,{at:a})}`})}if(r.erroredGroupIds.length>0){let a=r.erroredGroupIds.map(n=>{let d=s.find(m=>m.id===n);if(!d)return h(o.common.idTemplate,{id:n});let l=d.externalLink?.syncError;return l?h(i.erroredItemTemplate,{group:d.name,reason:l}):d.name});t.push({id:"errored",text:h(i.erroredTemplate,{groups:a.join(i.listSeparator)})})}return r.pendingRequestCount>0&&t.push({id:"pending",text:h(i.pendingTemplate,{count:r.pendingRequestCount})}),t.length===0?null:(0,w.jsxs)("section",{"aria-labelledby":"directory-sync-heading","data-testid":"directory-sync-banner",style:{display:"flex",flexDirection:"column",gap:"0.35rem",padding:"0.7rem 1rem",marginBottom:"1rem",borderRadius:"6px",border:"1px solid #fde68a",backgroundColor:"#fffbeb",color:"#92400e",fontSize:"0.85rem"},children:[(0,w.jsx)("h2",{id:"directory-sync-heading",style:{margin:0,fontSize:"0.9rem",fontWeight:700},children:i.title}),t.map(a=>(0,w.jsx)("span",{"data-directory-warning":a.id,children:a.text},a.id))]})}function K({children:r,renderHeader:o}){let s=(0,N.useLoaderData)(),i=s?.segment??"users",t=s?.labels??U,a=s?.myPermissions??null,n=s?.resourceLabels??{},d=f=>Object.hasOwn(n,f)?n[f]:f,l=[{key:"users",label:t.tabs.users,href:"/users"},{key:"groups",label:t.tabs.groups,href:"/users/groups"},{key:"group_members",label:t.tabs.groupMembers,href:"/users/group_members"},{key:"allowlist",label:t.tabs.allowlist,href:"/users/allowlist"}];s?.directoryStatus&&(s.directoryStatus.isEnabled||s.directoryStatus.linkedGroupCount>0)&&l.push({key:"directory",label:t.tabs.directory,href:"/users/directory"});let m=Object.entries(a??{}),g=f=>f?.canWrite?{text:t.permissions.canWrite,color:"#047857",bgColor:"#ecfdf5",borderColor:"#a7f3d0"}:f?.canRead?{text:t.permissions.canRead,color:"#1d4ed8",bgColor:"#eff6ff",borderColor:"#bfdbfe"}:{text:t.permissions.none,color:"#475569",bgColor:"#f1f5f9",borderColor:"#cbd5e1"},b={text:t.permissions.unknown,color:"#92400e",bgColor:"#fffbeb",borderColor:"#fde68a"},v=(0,w.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem"},"data-testid":"user-admin-header-annotation",children:[(0,w.jsx)("span",{style:{fontSize:"0.75rem",backgroundColor:"#e0f2fe",color:"#0369a1",padding:"2px 8px",borderRadius:"12px",fontWeight:600},children:t.heading}),(0,w.jsxs)("div",{style:{display:"inline-flex",alignItems:"center",gap:"0.25rem",fontSize:"0.68rem",color:"#475569"},"data-testid":"user-admin-permissions-badge",children:[(0,w.jsx)("span",{style:{fontWeight:600,color:"#334155"},children:t.permissions.label}),(0,w.jsx)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.18rem"},children:m.length===0?(0,w.jsx)("span",{"data-testid":"user-admin-permission-unavailable",children:(0,w.jsx)(Q,{label:t.heading,summary:b})}):m.map(([f,u])=>(0,w.jsx)(Q,{label:d(f),summary:g(u)},f))})]})]});return(0,w.jsxs)("div",{"data-testid":"user-admin-shell",style:{width:"100%",minHeight:"100vh",backgroundColor:"#f8fafc",padding:"1.5rem",boxSizing:"border-box"},children:[o?o({title:t.title,annotation:v}):(0,w.jsxs)("div",{style:{marginBottom:"1.5rem",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,w.jsx)("h1",{style:{margin:0,fontSize:"1.5rem",fontWeight:700,color:"#0f172a"},children:t.title}),v]}),(0,w.jsx)("nav",{"aria-label":t.title,style:{display:"flex",gap:"0.5rem",marginBottom:"1.2rem",borderBottom:"2px solid #e2e8f0",paddingBottom:"0.5rem"},children:l.map(f=>{let u=i===f.key;return(0,w.jsx)(N.Link,{to:f.href,"data-testid":`user-admin-tab-${f.key}`,"aria-current":u?"page":void 0,style:{padding:"0.5rem 1rem",borderRadius:"6px 6px 0 0",fontSize:"0.88rem",fontWeight:u?700:500,color:u?"#0284c7":"#64748b",backgroundColor:u?"#ffffff":"transparent",textDecoration:"none",borderBottom:u?"3px solid #0284c7":"3px solid transparent",transition:"all 0.15s ease"},children:f.label},f.key)})}),(0,w.jsx)(me,{status:s?.directoryStatus,labels:t,groups:s?.groups??[]}),(0,w.jsx)("main",{children:r})]})}var x=require("react"),k=require("react-router");var e=require("react/jsx-runtime");function V({fetcher:r,id:o}){let s=r.data;return s?.ok!==!1||!s.error?null:(0,e.jsx)("div",{id:o,"data-testid":"user-admin-action-error",role:"alert",style:{gridColumn:"1 / -1",padding:"0.7rem 1rem",borderRadius:"6px",border:"1px solid #fecaca",backgroundColor:"#fef2f2",color:"#b91c1c",fontSize:"0.85rem"},children:s.error})}function L(r){let o=(0,x.useRef)(null);return(0,x.useEffect)(()=>{if(r.state!=="idle"||r.data===void 0)return;let s=o.current;s&&(o.current=null,r.data.ok===!0&&s())},[r.state,r.data]),(s,i)=>{o.current=i??null,r.submit(s,{method:"post"})}}function W(r,o){let s=(0,x.useRef)(null),i=(0,x.useRef)(o);return i.current=o,(0,x.useEffect)(()=>{if(!r)return;let t=s.current,a=document.activeElement,n=()=>Array.from(t?.querySelectorAll('a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])')??[]);n()[0]?.focus();let d=l=>{if(l.key==="Escape"){l.preventDefault(),i.current();return}if(l.key!=="Tab")return;let m=n();if(m.length===0)return;let g=m[0],b=m[m.length-1],v=document.activeElement,f=!t?.contains(v);l.shiftKey&&(v===g||f)?(l.preventDefault(),b.focus()):!l.shiftKey&&(v===b||f)&&(l.preventDefault(),g.focus())};return document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d),a?.focus?.()}},[r]),s}function q(){let r=(0,k.useLoaderData)(),o=(0,k.useFetcher)(),s=L(o),i=r.labels??U,[t,a]=(0,x.useState)(""),[n,d]=(0,x.useState)(null),[l,m]=(0,x.useState)(!1),[g,b]=(0,x.useState)(""),[v,f]=(0,x.useState)(""),u=W(l,()=>m(!1)),A=W(n!==null,()=>d(null)),C=o.state!=="idle",M=r.users.filter(p=>p.displayName.toLowerCase().includes(t.toLowerCase())||p.email.toLowerCase().includes(t.toLowerCase())),E=p=>{p.isActive&&!window.confirm(i.usersView.confirmDeactivate)||s({intent:"toggleUserActive",userId:String(p.id),isActive:String(!p.isActive)})},I=p=>{p.preventDefault(),g&&v&&s({intent:"createUser",displayName:g,email:v},()=>{b(""),f(""),m(!1)})},c=p=>{p.preventDefault(),n&&s({intent:"updateUser",userId:String(n.id),displayName:n.displayName,email:n.email},()=>d(null))};return(0,e.jsxs)("section",{"data-testid":"users-view-section",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[(0,e.jsx)("h2",{style:z,children:i.usersView.title}),!(l||n)&&(0,e.jsx)(V,{fetcher:o}),(0,e.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[(0,e.jsx)("input",{type:"text","aria-label":i.usersView.searchLabel,placeholder:i.usersView.searchPlaceholder,value:t,onChange:p=>a(p.target.value),"data-testid":"users-search-input",style:{padding:"6px 12px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",width:"260px"}}),(0,e.jsx)("button",{type:"button",onClick:()=>m(!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:i.usersView.addUser})]}),(0,e.jsx)("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0",overflow:"hidden"},children:(0,e.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"0.85rem",textAlign:"left"},children:[(0,e.jsx)("thead",{children:(0,e.jsxs)("tr",{style:{backgroundColor:"#f8fafc",borderBottom:"1px solid #e2e8f0",color:"#475569"},children:[(0,e.jsx)("th",{style:{padding:"10px 14px"},children:i.common.id}),(0,e.jsx)("th",{style:{padding:"10px 14px"},children:i.usersView.displayName}),(0,e.jsx)("th",{style:{padding:"10px 14px"},children:i.usersView.email}),(0,e.jsx)("th",{style:{padding:"10px 14px"},children:i.common.status}),(0,e.jsx)("th",{style:{padding:"10px 14px",textAlign:"right"},children:i.common.actions})]})}),(0,e.jsxs)("tbody",{children:[M.map(p=>(0,e.jsxs)("tr",{style:{borderBottom:"1px solid #f1f5f9"},"data-testid":`user-row-${p.id}`,children:[(0,e.jsx)("td",{style:{padding:"10px 14px",color:"#475569"},children:h(i.common.idTemplate,{id:p.id})}),(0,e.jsx)("td",{style:{padding:"10px 14px",fontWeight:600,color:"#0f172a"},children:p.displayName}),(0,e.jsx)("td",{style:{padding:"10px 14px",color:"#475569"},children:p.email}),(0,e.jsx)("td",{style:{padding:"10px 14px"},children:(0,e.jsx)("span",{style:{fontSize:"0.75rem",padding:"2px 8px",borderRadius:"10px",backgroundColor:p.isActive?"#dcfce7":"#fee2e2",color:p.isActive?"#15803d":"#b91c1c",fontWeight:600},children:p.isActive?i.usersView.active:i.usersView.inactive})}),(0,e.jsxs)("td",{style:{padding:"10px 14px",textAlign:"right"},children:[(0,e.jsx)("button",{type:"button",onClick:()=>d(p),"aria-label":h(i.usersView.editUserAria,{user:p.displayName}),"data-testid":`edit-user-btn-${p.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"0.78rem",cursor:"pointer",marginRight:"6px"},children:i.common.edit}),(0,e.jsx)("button",{type:"button",onClick:()=>E(p),disabled:C,"aria-busy":C,"aria-label":h(p.isActive?i.usersView.deactivateAria:i.usersView.activateAria,{user:p.displayName}),"data-testid":`toggle-user-btn-${p.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"0.78rem",cursor:C?"default":"pointer",color:p.isActive?"#b91c1c":"#15803d"},children:p.isActive?i.usersView.deactivate:i.usersView.activate})]})]},p.id)),M.length===0&&(0,e.jsx)("tr",{children:(0,e.jsx)("td",{colSpan:5,style:{padding:"2rem",textAlign:"center",color:"#475569"},children:i.usersView.empty})})]})]})}),l&&(0,e.jsx)("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},children:(0,e.jsxs)("form",{ref:u,onSubmit:I,role:"dialog","aria-modal":"true","aria-labelledby":"create-user-title","aria-describedby":"create-user-error","data-testid":"user-create-modal",style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[(0,e.jsx)("h3",{id:"create-user-title",style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:i.usersView.addUser}),(0,e.jsx)(V,{fetcher:o,id:"create-user-error"}),(0,e.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,e.jsx)("label",{htmlFor:"create-user-display-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:i.usersView.displayName}),(0,e.jsx)("input",{id:"create-user-display-name-input",type:"text",value:g,onChange:p=>b(p.target.value),required:!0,"data-testid":"create-user-display-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),(0,e.jsxs)("div",{style:{marginBottom:"1.2rem"},children:[(0,e.jsx)("label",{htmlFor:"create-user-email-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:i.usersView.email}),(0,e.jsx)("input",{id:"create-user-email-input",type:"email",value:v,onChange:p=>f(p.target.value),required:!0,"data-testid":"create-user-email",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),(0,e.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[(0,e.jsx)("button",{type:"button",onClick:()=>m(!1),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:"\u30AD\u30E3\u30F3\u30BB\u30EB"}),(0,e.jsx)("button",{type:"submit","data-testid":"submit-create-user",disabled:C,"aria-busy":C,style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#0284c7",color:"#ffffff",border:"none",cursor:"pointer"},children:"\u4F5C\u6210"})]})]})}),n&&(0,e.jsx)("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},children:(0,e.jsxs)("form",{ref:A,onSubmit:c,role:"dialog","aria-modal":"true","aria-labelledby":"edit-user-title","aria-describedby":"edit-user-error","data-testid":"user-edit-modal",style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[(0,e.jsx)("h3",{id:"edit-user-title",style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:i.usersView.editUser}),(0,e.jsx)(V,{fetcher:o,id:"edit-user-error"}),(0,e.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,e.jsx)("label",{htmlFor:"edit-user-display-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:i.usersView.displayName}),(0,e.jsx)("input",{id:"edit-user-display-name-input",type:"text",value:n.displayName,onChange:p=>d({...n,displayName:p.target.value}),required:!0,"data-testid":"edit-user-display-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),(0,e.jsxs)("div",{style:{marginBottom:"1.2rem"},children:[(0,e.jsx)("label",{htmlFor:"edit-user-email-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:i.usersView.email}),(0,e.jsx)("input",{id:"edit-user-email-input",type:"email",value:n.email,onChange:p=>d({...n,email:p.target.value}),required:!0,"data-testid":"edit-user-email",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),(0,e.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[(0,e.jsx)("button",{type:"button",onClick:()=>d(null),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:i.common.cancel}),(0,e.jsx)("button",{type:"submit","data-testid":"submit-edit-user",disabled:C,"aria-busy":C,style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#0284c7",color:"#ffffff",border:"none",cursor:"pointer"},children:i.common.save})]})]})})]})}function Z(){let r=(0,k.useLoaderData)(),o=(0,k.useFetcher)(),s=L(o),i=r.labels??U,[t,a]=(0,x.useState)(""),[n,d]=(0,x.useState)(!1),[l,m]=(0,x.useState)(null),g=o.state!=="idle",[b,v]=(0,x.useState)(""),[f,u]=(0,x.useState)(""),[A,C]=(0,x.useState)(""),M=W(n,()=>d(!1)),E=W(l!==null,()=>m(null)),I=r.groups.filter(y=>y.name.toLowerCase().includes(t.toLowerCase())||y.groupKey.toLowerCase().includes(t.toLowerCase())),c=y=>{y.preventDefault(),b&&f&&s({intent:"createGroup",groupKey:b,name:f,description:A},()=>{v(""),u(""),C(""),d(!1)})},p=y=>{y.preventDefault(),l&&s({intent:"updateGroup",groupId:String(l.id),name:l.name,description:l.description??""},()=>m(null))},T=y=>{window.confirm(i.groupsView.confirmDelete)&&s({intent:"deleteGroup",groupId:String(y)})};return(0,e.jsxs)("section",{"data-testid":"groups-view-section",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[(0,e.jsx)("h2",{style:z,children:i.groupsView.title}),!(n||l)&&(0,e.jsx)(V,{fetcher:o}),(0,e.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[(0,e.jsx)("input",{type:"text","aria-label":i.groupsView.searchLabel,placeholder:i.groupsView.searchPlaceholder,value:t,onChange:y=>a(y.target.value),"data-testid":"groups-search-input",style:{padding:"6px 12px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",width:"260px"}}),(0,e.jsx)("button",{type:"button",onClick:()=>d(!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:i.groupsView.addGroup})]}),(0,e.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"1rem"},children:I.map(y=>{let J=r.groupMembers.filter(X=>X.groupId===y.id).length;return(0,e.jsxs)("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0",padding:"1rem",display:"flex",flexDirection:"column",justifyContent:"space-between"},"data-testid":`group-card-${y.id}`,"data-group-readonly":y.readOnly?"true":"false",children:[(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.5rem"},children:[(0,e.jsx)("h4",{style:{margin:0,fontSize:"1rem",color:"#0f172a"},children:y.name}),(0,e.jsx)("span",{style:{fontSize:"0.72rem",backgroundColor:"#e0e7ff",color:"#4338ca",padding:"2px 6px",borderRadius:"4px",fontFamily:"monospace"},children:y.groupKey})]}),(0,e.jsx)("p",{style:{margin:"0 0 0.8rem 0",fontSize:"0.82rem",color:"#64748b",minHeight:"2.4em"},children:y.description||i.groupsView.noDescription}),y.externalLink&&(0,e.jsxs)("div",{"data-testid":`group-source-${y.id}`,style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap",marginBottom:"0.6rem"},children:[(0,e.jsx)("span",{style:{fontSize:"0.72rem",padding:"2px 8px",borderRadius:"10px",backgroundColor:"#ede9fe",color:"#6d28d9",fontWeight:600},children:i.common.managedUpstream}),(0,e.jsx)("span",{style:{fontSize:"0.72rem",fontFamily:"monospace",color:"#64748b"},children:y.externalLink.externalKey}),y.externalLink.unresolvedCount>0&&(0,e.jsx)("span",{"data-testid":`group-unresolved-${y.id}`,style:{fontSize:"0.72rem",color:"#b45309"},children:h(i.directoryView.unresolvedTemplate,{count:y.externalLink.unresolvedCount})})]})]}),(0,e.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",borderTop:"1px solid #f1f5f9",paddingTop:"0.6rem"},children:[(0,e.jsx)("span",{style:{fontSize:"0.78rem",color:"#475569"},"data-testid":`group-member-count-${y.id}`,children:h(i.groupsView.memberCountTemplate,{count:J})}),y.readOnly?(0,e.jsx)("span",{"data-testid":`readonly-group-${y.id}`,style:{fontSize:"0.75rem",color:"#475569"},children:i.common.readOnly}):(0,e.jsxs)("div",{children:[(0,e.jsx)("button",{type:"button",onClick:()=>m(y),"data-testid":`edit-group-btn-${y.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"0.75rem",cursor:"pointer",marginRight:"4px"},children:i.common.edit}),(0,e.jsx)("button",{type:"button",onClick:()=>T(y.id),"data-testid":`delete-group-btn-${y.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #fee2e2",backgroundColor:"#fff5f5",color:"#b91c1c",fontSize:"0.75rem",cursor:"pointer"},children:i.common.delete})]})]})]},y.id)})}),I.length===0&&(0,e.jsx)("div",{"data-testid":"groups-empty",style:{padding:"2rem",textAlign:"center",color:"#475569",backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0"},children:r.groups.length===0?i.groupsView.empty:i.groupsView.emptyFiltered}),n&&(0,e.jsx)("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},children:(0,e.jsxs)("form",{ref:M,onSubmit:c,role:"dialog","aria-modal":"true","aria-labelledby":"create-group-title","aria-describedby":"create-group-error","data-testid":"group-create-modal",style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[(0,e.jsx)("h3",{id:"create-group-title",style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:i.groupsView.addGroup}),(0,e.jsx)(V,{fetcher:o,id:"create-group-error"}),(0,e.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,e.jsx)("label",{htmlFor:"create-group-key-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:i.groupsView.groupKey}),(0,e.jsx)("input",{id:"create-group-key-input",type:"text",value:b,onChange:y=>v(y.target.value),placeholder:i.groupsView.groupKeyPlaceholder,required:!0,"data-testid":"create-group-key",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),(0,e.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,e.jsx)("label",{htmlFor:"create-group-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:i.groupsView.name}),(0,e.jsx)("input",{id:"create-group-name-input",type:"text",value:f,onChange:y=>u(y.target.value),placeholder:i.groupsView.namePlaceholder,required:!0,"data-testid":"create-group-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),(0,e.jsxs)("div",{style:{marginBottom:"1.2rem"},children:[(0,e.jsx)("label",{htmlFor:"create-group-desc-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:i.groupsView.description}),(0,e.jsx)("textarea",{id:"create-group-desc-input",value:A,onChange:y=>C(y.target.value),"data-testid":"create-group-description",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box",height:"60px"}})]}),(0,e.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[(0,e.jsx)("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"}),(0,e.jsx)("button",{type:"submit","data-testid":"submit-create-group",disabled:g,"aria-busy":g,style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#4338ca",color:"#ffffff",border:"none",cursor:"pointer"},children:"\u4F5C\u6210"})]})]})}),l&&(0,e.jsx)("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},children:(0,e.jsxs)("form",{ref:E,onSubmit:p,role:"dialog","aria-modal":"true","aria-labelledby":"edit-group-title","aria-describedby":"edit-group-error","data-testid":"group-edit-modal",style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[(0,e.jsx)("h3",{id:"edit-group-title",style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:i.groupsView.editGroup}),(0,e.jsx)(V,{fetcher:o,id:"edit-group-error"}),(0,e.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,e.jsx)("label",{htmlFor:"edit-group-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:i.groupsView.name}),(0,e.jsx)("input",{id:"edit-group-name-input",type:"text",value:l.name,onChange:y=>m({...l,name:y.target.value}),required:!0,"data-testid":"edit-group-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),(0,e.jsxs)("div",{style:{marginBottom:"1.2rem"},children:[(0,e.jsx)("label",{htmlFor:"edit-group-desc-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:i.groupsView.description}),(0,e.jsx)("textarea",{id:"edit-group-desc-input",value:l.description??"",onChange:y=>m({...l,description:y.target.value}),"data-testid":"edit-group-description",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box",height:"60px"}})]}),(0,e.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[(0,e.jsx)("button",{type:"button",onClick:()=>m(null),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:i.common.cancel}),(0,e.jsx)("button",{type:"submit","data-testid":"submit-edit-group",disabled:g,"aria-busy":g,style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#4338ca",color:"#ffffff",border:"none",cursor:"pointer"},children:i.common.save})]})]})})]})}function H(){let r=(0,k.useLoaderData)(),o=(0,k.useFetcher)(),s=L(o),i=o.state!=="idle",t=r.labels??U,[a,n]=(0,x.useState)(r.groups[0]?.id??0),d=r.groups.find(g=>g.id===a),l=new Set(r.groupMembers.filter(g=>g.groupId===a).map(g=>g.userId)),m=(g,b)=>{s(b?{intent:"removeGroupMember",groupId:String(a),userId:String(g)}:{intent:"addGroupMember",groupId:String(a),userId:String(g)})};return(0,e.jsxs)("section",{"data-testid":"group-members-view-section",style:{display:"grid",gridTemplateColumns:"240px 1fr",gap:"1.2rem"},children:[(0,e.jsx)("h2",{style:{...z,gridColumn:"1 / -1"},children:t.groupMembersView.title}),(0,e.jsx)(V,{fetcher:o}),(0,e.jsxs)("div",{style:{backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[(0,e.jsx)("h4",{style:{margin:"0 0 0.8rem 0",fontSize:"0.9rem",color:"#475569"},children:t.groupMembersView.selectGroup}),(0,e.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"0.4rem"},children:r.groups.map(g=>{let b=g.id===a;return(0,e.jsxs)("button",{type:"button",onClick:()=>n(g.id),"data-testid":`select-group-btn-${g.id}`,style:{textAlign:"left",padding:"8px 10px",borderRadius:"6px",border:b?"1px solid #6366f1":"1px solid #e2e8f0",backgroundColor:b?"#e0e7ff":"#ffffff",color:b?"#3730a3":"#0f172a",cursor:"pointer",fontWeight:b?600:400,fontSize:"0.85rem"},children:[g.name,g.readOnly?(0,e.jsx)("span",{"data-testid":`group-upstream-marker-${g.id}`,style:{marginLeft:"6px",fontSize:"0.7rem",color:"#7c3aed"},children:t.common.managedUpstream}):null]},g.id)})})]}),(0,e.jsx)("div",{style:{backgroundColor:"#ffffff",padding:"1.2rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:d?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{style:{marginBottom:"1rem",borderBottom:"1px solid #e2e8f0",paddingBottom:"0.8rem"},children:[(0,e.jsx)("h3",{style:{margin:0,fontSize:"1.1rem",color:"#0f172a"},children:h(t.groupMembersView.membersOfTemplate,{group:d.name})}),(0,e.jsxs)("span",{style:{fontSize:"0.8rem",color:"#64748b"},children:[t.groupMembersView.groupKeyLabel,": ",d.groupKey]}),d.readOnly?(0,e.jsx)("div",{"data-testid":"group-members-upstream-notice",role:"note",style:{marginTop:"0.5rem",padding:"0.5rem 0.7rem",borderRadius:"6px",backgroundColor:"#f5f3ff",border:"1px solid #ddd6fe",color:"#5b21b6",fontSize:"0.8rem"},children:t.groupMembersView.upstreamNotice}):null]}),(0,e.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:r.users.map(g=>{let b=l.has(g.id);return(0,e.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 12px",borderRadius:"6px",border:"1px solid #f1f5f9",backgroundColor:b?"#f0fdf4":"#ffffff"},"data-testid":`member-row-${g.id}`,children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("span",{style:{fontWeight:600,fontSize:"0.88rem",color:"#0f172a",marginRight:"8px"},children:g.displayName}),(0,e.jsxs)("span",{style:{fontSize:"0.78rem",color:"#64748b"},children:["(",g.email,")"]})]}),d.readOnly?b?(0,e.jsx)("span",{"data-testid":`member-readonly-${g.id}`,style:{fontSize:"0.75rem",color:"#475569"},children:t.common.managedUpstream}):null:(0,e.jsx)("button",{type:"button",onClick:()=>m(g.id,b),disabled:i,"aria-busy":i,"aria-label":h(b?t.groupMembersView.actionRemoveAria:t.groupMembersView.actionAddAria,{user:g.displayName}),"data-testid":`toggle-member-btn-${g.id}`,style:{padding:"4px 12px",borderRadius:"4px",border:b?"1px solid #b91c1c":"1px solid #0284c7",backgroundColor:b?"#ffffff":"#0284c7",color:b?"#b91c1c":"#ffffff",fontSize:"0.78rem",fontWeight:600,cursor:"pointer"},children:b?t.groupMembersView.actionRemove:t.groupMembersView.actionAdd})]},g.id)})})]}):(0,e.jsx)("div",{style:{color:"#475569",textAlign:"center",padding:"2rem"},children:t.groupMembersView.selectPrompt})})]})}function ge(r){return r==="email"?{backgroundColor:"#e0f2fe",color:"#0369a1"}:r==="domain"?{backgroundColor:"#fef3c7",color:"#b45309"}:{backgroundColor:"#ede9fe",color:"#6d28d9"}}function ye(r,o){return r==="email"?o.allowlistView.emailTypeShort:r==="domain"?o.allowlistView.domainTypeShort:o.allowlistView.groupTypeShort}function _(){let r=(0,k.useLoaderData)(),o=(0,k.useFetcher)(),s=r.labels??U,i=L(o),t=o.state!=="idle",[a,n]=(0,x.useState)(""),[d,l]=(0,x.useState)("email"),[m,g]=(0,x.useState)(""),b=u=>{u.preventDefault(),a&&i({intent:"addAllowlistEntry",pattern:a,type:d,description:m},()=>{n(""),g("")})},v=u=>{i({intent:"removeAllowlistEntry",entryId:String(u)})},f=u=>{i({intent:"removeAllowlistGroup",entryId:String(u)})};return(0,e.jsxs)("section",{"data-testid":"allowlist-view-section",style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[(0,e.jsx)("h2",{style:z,children:s.allowlistView.title}),(0,e.jsx)(V,{fetcher:o}),(0,e.jsxs)("form",{onSubmit:b,style:{backgroundColor:"#ffffff",padding:"1.2rem",borderRadius:"8px",border:"1px solid #e2e8f0",display:"flex",flexWrap:"wrap",gap:"0.8rem",alignItems:"flex-end"},children:[(0,e.jsxs)("div",{style:{flex:2,minWidth:"220px"},children:[(0,e.jsx)("label",{htmlFor:"allowlist-pattern-input-field",style:{display:"block",fontSize:"0.78rem",color:"#475569",marginBottom:"4px"},children:s.allowlistView.pattern}),(0,e.jsx)("input",{id:"allowlist-pattern-input-field",type:"text",value:a,onChange:u=>n(u.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"}})]}),(0,e.jsxs)("div",{style:{flex:1,minWidth:"140px"},children:[(0,e.jsx)("label",{htmlFor:"allowlist-type-select-field",style:{display:"block",fontSize:"0.78rem",color:"#475569",marginBottom:"4px"},children:s.allowlistView.type}),(0,e.jsxs)("select",{id:"allowlist-type-select-field",value:d,onChange:u=>l(u.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:[(0,e.jsx)("option",{value:"email",children:s.allowlistView.emailType}),(0,e.jsx)("option",{value:"domain",children:s.allowlistView.domainType})]})]}),(0,e.jsxs)("div",{style:{flex:2,minWidth:"200px"},children:[(0,e.jsx)("label",{htmlFor:"allowlist-desc-input-field",style:{display:"block",fontSize:"0.78rem",color:"#475569",marginBottom:"4px"},children:s.allowlistView.description}),(0,e.jsx)("input",{id:"allowlist-desc-input-field",type:"text",value:m,onChange:u=>g(u.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"}})]}),(0,e.jsx)("button",{type:"submit","data-testid":"submit-allowlist-add",disabled:t,"aria-busy":t,style:{padding:"7px 16px",borderRadius:"6px",backgroundColor:"#047857",color:"#ffffff",border:"none",fontSize:"0.85rem",fontWeight:600,cursor:"pointer"},children:s.allowlistView.addEntry})]}),(0,e.jsx)("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0",overflow:"hidden"},children:(0,e.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"0.85rem",textAlign:"left"},children:[(0,e.jsx)("thead",{children:(0,e.jsxs)("tr",{style:{backgroundColor:"#f8fafc",borderBottom:"1px solid #e2e8f0",color:"#475569"},children:[(0,e.jsx)("th",{style:{padding:"10px 14px"},children:s.common.id}),(0,e.jsx)("th",{style:{padding:"10px 14px"},children:s.allowlistView.target}),(0,e.jsx)("th",{style:{padding:"10px 14px"},children:s.allowlistView.type}),(0,e.jsx)("th",{style:{padding:"10px 14px"},children:s.allowlistView.description}),(0,e.jsx)("th",{style:{padding:"10px 14px",textAlign:"right"},children:s.common.actions})]})}),(0,e.jsxs)("tbody",{children:[r.allowlist.map(u=>(0,e.jsxs)("tr",{style:{borderBottom:"1px solid #f1f5f9"},"data-testid":`allowlist-row-${u.type}-${u.id}`,"data-allowlist-type":u.type,children:[(0,e.jsx)("td",{style:{padding:"10px 14px",color:"#475569"},children:h(s.common.idTemplate,{id:u.id})}),(0,e.jsx)("td",{style:{padding:"10px 14px",fontWeight:600,color:"#0f172a"},children:u.type==="group"?(0,e.jsxs)("span",{"data-testid":`allowlist-group-${u.type}-${u.id}`,children:[u.groupName,(0,e.jsx)("span",{style:{marginLeft:"6px",fontFamily:"monospace",fontSize:"0.78rem",color:"#64748b"},children:u.groupKey})]}):(0,e.jsx)("span",{style:{fontFamily:"monospace"},children:u.pattern})}),(0,e.jsx)("td",{style:{padding:"10px 14px"},children:(0,e.jsx)("span",{style:{fontSize:"0.75rem",padding:"2px 8px",borderRadius:"10px",...ge(u.type),fontWeight:600},children:ye(u.type,s)})}),(0,e.jsxs)("td",{style:{padding:"10px 14px",color:"#475569"},children:[u.description||s.common.none,u.owner.kind==="deployment"&&(0,e.jsx)("span",{"data-testid":`allowlist-owner-${u.type}-${u.id}`,style:{marginLeft:"8px",fontSize:"0.72rem",color:"#475569"},children:s.allowlistView.deploymentOwner})]}),(0,e.jsx)("td",{style:{padding:"10px 14px",textAlign:"right"},children:u.readOnly?(0,e.jsx)("span",{"data-testid":`readonly-allowlist-${u.type}-${u.id}`,style:{fontSize:"0.75rem",color:"#475569"},children:s.common.readOnly}):(0,e.jsx)("button",{type:"button",onClick:()=>{window.confirm(s.allowlistView.confirmDelete)&&(u.type==="group"?f(u.id):v(u.id))},disabled:t,"aria-busy":t,"aria-label":h(s.allowlistView.deleteAria,{target:u.type==="group"?u.groupName:u.pattern}),"data-testid":`remove-allowlist-btn-${u.type}-${u.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #fee2e2",backgroundColor:"#fff5f5",color:"#b91c1c",fontSize:"0.78rem",cursor:"pointer"},children:s.common.delete})})]},`${u.type}-${u.id}`)),r.allowlist.length===0&&(0,e.jsx)("tr",{children:(0,e.jsx)("td",{colSpan:5,style:{padding:"2rem",textAlign:"center",color:"#475569"},children:s.allowlistView.empty})})]})]})})]})}function Y(){let r=(0,k.useLoaderData)(),o=(0,k.useFetcher)(),s=L(o),i=r.labels??U,t=i.directoryView,a=r.groups.filter(c=>!c.externalLink),[n,d]=(0,x.useState)(""),[l,m]=(0,x.useState)(""),[g,b]=(0,x.useState)("direct"),v=r.groups.filter(c=>c.externalLink),f=new Set(r.allowlist.filter(c=>c.type==="group").map(c=>c.groupId)),u=c=>r.allowlist.find(p=>p.type==="group"&&p.groupId===c),A=o.state!=="idle",[C,M]=(0,x.useState)(null),E=r.directoryStatus.isEnabled,I=c=>{c.preventDefault(),n&&l&&s({intent:"linkDirectoryGroup",groupId:n,provider:r.directoryStatus.provider,externalKey:l,membershipMode:g},()=>{m(""),d("")})};return(0,e.jsxs)("section",{"data-testid":"directory-view-section",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[(0,e.jsx)("h2",{style:z,children:t.title}),(0,e.jsx)(V,{fetcher:o}),!E&&(0,e.jsx)("p",{"data-testid":"directory-not-wired",style:{margin:0,padding:"0.7rem 1rem",borderRadius:"6px",border:"1px solid #e2e8f0",backgroundColor:"#f8fafc",color:"#475569",fontSize:"0.85rem"},children:t.notWiredNotice}),E&&a.length===0&&(0,e.jsx)("p",{"data-testid":"directory-nothing-to-link",style:{margin:0,padding:"0.7rem 1rem",borderRadius:"6px",border:"1px solid #e2e8f0",backgroundColor:"#f8fafc",color:"#475569",fontSize:"0.85rem"},children:t.nothingToLink}),E&&a.length>0&&(0,e.jsxs)("form",{onSubmit:I,"data-testid":"directory-link-form",style:{display:"flex",gap:"0.75rem",flexWrap:"wrap",alignItems:"flex-end",backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem"},children:[(0,e.jsx)("label",{htmlFor:"directory-group-select-input",style:O,children:t.selectGroup}),(0,e.jsxs)("select",{id:"directory-group-select-input","data-testid":"directory-group-select",value:n,onChange:c=>d(c.target.value),style:{padding:"0.5rem",borderRadius:"6px",border:"1px solid #cbd5e1"},children:[(0,e.jsx)("option",{value:"",children:t.selectGroup}),a.map(c=>(0,e.jsx)("option",{value:String(c.id),children:h(t.groupOptionTemplate,{name:c.name,key:c.groupKey})},c.id))]})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem",flex:1,minWidth:"220px"},children:[(0,e.jsx)("label",{htmlFor:"directory-external-key-input",style:O,children:t.externalKey}),(0,e.jsx)("input",{id:"directory-external-key-input",type:"email",required:!0,"data-testid":"directory-external-key",placeholder:t.externalKeyPlaceholder,value:l,onChange:c=>m(c.target.value),style:{padding:"0.5rem",borderRadius:"6px",border:"1px solid #cbd5e1"}})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem"},children:[(0,e.jsx)("label",{htmlFor:"directory-membership-mode-input",style:O,children:t.membershipMode}),(0,e.jsxs)("select",{id:"directory-membership-mode-input","data-testid":"directory-membership-mode",value:g,onChange:c=>b(c.target.value),style:{padding:"0.5rem",borderRadius:"6px",border:"1px solid #cbd5e1"},children:[(0,e.jsx)("option",{value:"direct",children:t.directMode}),(0,e.jsx)("option",{value:"transitive",children:t.transitiveMode})]})]}),(0,e.jsx)("button",{type:"submit","data-testid":"directory-link-submit",disabled:!(n&&l)||A,"aria-busy":A,style:{padding:"0.5rem 1rem",borderRadius:"6px",border:"none",backgroundColor:n&&l&&!A?"#2563eb":"#94a3b8",color:"#fff",fontWeight:600},children:t.link})]}),v.length===0?(0,e.jsx)("div",{"data-testid":"directory-empty",style:{padding:"2rem",textAlign:"center",color:"#64748b",backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0"},children:t.empty}):(0,e.jsxs)("table",{"data-testid":"directory-table",style:{width:"100%",borderCollapse:"collapse",backgroundColor:"#ffffff",borderRadius:"8px",overflow:"hidden",border:"1px solid #e2e8f0"},children:[(0,e.jsx)("thead",{children:(0,e.jsxs)("tr",{style:{backgroundColor:"#f8fafc",textAlign:"left"},children:[(0,e.jsx)("th",{style:G,children:i.groupsView.name}),(0,e.jsx)("th",{style:G,children:t.externalKey}),(0,e.jsx)("th",{style:G,children:t.membershipMode}),(0,e.jsx)("th",{style:G,children:t.lastSynced}),(0,e.jsx)("th",{style:G,children:i.common.status}),(0,e.jsx)("th",{style:G,children:i.common.actions})]})}),(0,e.jsx)("tbody",{children:v.map(c=>{let p=c.externalLink,T=f.has(c.id);return(0,e.jsxs)("tr",{"data-testid":`directory-row-${c.id}`,"data-sync-enabled":String(p.isSyncEnabled),style:{borderTop:"1px solid #e2e8f0"},children:[(0,e.jsxs)("td",{style:G,children:[c.name,(0,e.jsx)("div",{style:{fontSize:"0.75rem",color:"#64748b"},children:c.groupKey})]}),(0,e.jsx)("td",{style:G,"data-testid":`directory-external-${c.id}`,children:p.externalKey}),(0,e.jsx)("td",{style:G,children:p.membershipMode==="direct"?t.directMode:t.transitiveMode}),(0,e.jsxs)("td",{style:G,"data-testid":`directory-synced-${c.id}`,children:[p.syncedAt?P(p.syncedAt,i):t.neverSynced,p.unresolvedCount>0?(0,e.jsx)("div",{style:{fontSize:"0.75rem",color:"#b45309"},"data-testid":`directory-unresolved-${c.id}`,children:h(t.unresolvedTemplate,{count:p.unresolvedCount})}):null]}),(0,e.jsxs)("td",{style:G,children:[(0,e.jsx)("span",{"data-testid":`directory-status-${c.id}`,style:{fontSize:"0.75rem",padding:"2px 8px",borderRadius:"10px",backgroundColor:p.isSyncEnabled?"#dcfce7":"#fee2e2",color:p.isSyncEnabled?"#166534":"#b91c1c",fontWeight:600},children:p.isSyncEnabled?t.syncEnabled:t.syncPaused}),p.syncError?(0,e.jsx)("div",{style:{fontSize:"0.75rem",color:"#b91c1c",marginTop:"0.25rem"},"data-testid":`directory-error-${c.id}`,children:p.syncError}):null]}),(0,e.jsx)("td",{style:G,children:(0,e.jsxs)("div",{style:{display:"flex",gap:"0.35rem",flexWrap:"wrap"},children:[(0,e.jsx)("button",{type:"button","data-testid":`directory-sync-now-${c.id}`,disabled:A,"aria-busy":A,"aria-label":h(t.syncNowAria,{group:c.name}),onClick:()=>s({intent:"requestDirectorySync",groupId:String(c.id)},()=>M(c.id)),style:F,children:C===c.id?t.syncQueued:t.syncNow}),(0,e.jsx)("button",{type:"button","data-testid":`directory-toggle-sync-${c.id}`,disabled:A,"aria-busy":A,"aria-label":h(p.isSyncEnabled?t.pauseAria:t.resumeAria,{group:c.name}),onClick:()=>s({intent:"setDirectorySyncEnabled",groupId:String(c.id),isSyncEnabled:String(!p.isSyncEnabled)}),style:F,children:p.isSyncEnabled?t.pause:t.resume}),(0,e.jsx)("button",{type:"button","data-testid":`directory-allow-${c.id}`,disabled:A,"aria-busy":A,"aria-label":h(T?t.disallowGroupAria:t.allowGroupAria,{group:c.name}),onClick:()=>{let y=u(c.id);if(T&&y){if(!window.confirm(t.confirmDisallow))return;s({intent:"removeAllowlistGroup",entryId:String(y.id)})}else s({intent:"addAllowlistGroup",groupId:String(c.id)})},style:F,children:T?t.disallowGroup:t.allowGroup}),(0,e.jsx)("button",{type:"button","data-testid":`directory-unlink-${c.id}`,disabled:A,"aria-busy":A,"aria-label":h(t.unlinkAria,{group:c.name}),onClick:()=>{window.confirm(t.confirmUnlink)&&s({intent:"unlinkDirectoryGroup",groupId:String(c.id)})},style:{...F,color:"#b91c1c",borderColor:"#fecaca"},children:t.unlink})]})})]},c.id)})})]})]})}var O={fontSize:"0.78rem",color:"#475569",fontWeight:600},z={margin:0,fontSize:"1.05rem",fontWeight:700,color:"#0f172a"},G={padding:"0.6rem 0.75rem",fontSize:"0.85rem",verticalAlign:"top"},F={padding:"0.25rem 0.6rem",fontSize:"0.75rem",borderRadius:"6px",border:"1px solid #cbd5e1",backgroundColor:"#fff",cursor:"pointer"},be={users:q,groups:Z,group_members:H,allowlist:_,directory:Y};function fe({renderHeader:r}={}){let s=(0,k.useLoaderData)()?.segment??"users",i=be[s]??q;return(0,e.jsx)(K,{renderHeader:r,children:(0,e.jsx)(i,{})})}0&&(module.exports={AllowlistView,AuthUserAdminAppView,DirectoryView,GroupMembersView,GroupsView,UserAdminShell,UsersView,createInMemoryUserAdminStore,createUserAdminApp,defaultUserAdminLabels,jaUserAdminLabels,resolveUserAdminLabels});
1
+ "use strict";var Q=Object.defineProperty;var ne=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var ae=Object.prototype.hasOwnProperty;var de=(r,i)=>{for(var n in i)Q(r,n,{get:i[n],enumerable:!0})},le=(r,i,n,c)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of se(i))!ae.call(r,a)&&a!==n&&Q(r,a,{get:()=>i[a],enumerable:!(c=ne(i,a))||c.enumerable});return r};var pe=r=>le(Q({},"__esModule",{value:!0}),r);var Ge={};de(Ge,{AllowlistView:()=>ie,AuthUserAdminAppView:()=>Se,DirectoryView:()=>oe,GroupMembersView:()=>re,GroupsView:()=>te,UserAdminShell:()=>Z,UsersView:()=>J,createInMemoryUserAdminStore:()=>ce,createUserAdminApp:()=>we,defaultUserAdminLabels:()=>I,jaUserAdminLabels:()=>ue,resolveUserAdminLabels:()=>H});module.exports=pe(Ge);var I={title:"Users & Groups",locale:"en-US",timeZone:"UTC",heading:"\u{1F464} User administration",common:{create:"Create",edit:"Edit",delete:"Delete",save:"Save",cancel:"Cancel",actions:"Actions",status:"Status",id:"ID",readOnly:"Read-only",managedUpstream:"Managed upstream",idTemplate:"#{id}",none:"-"},errors:{forbidden:"You do not have permission for this operation."},permissions:{label:"Your permissions:",canWrite:"Editable",canRead:"Read only",none:"No access",unknown:"Unknown"},tabs:{users:"\u{1F464} Users",groups:"\u{1F465} Groups",groupMembers:"\u{1F517} Members",allowlist:"\u2709\uFE0F Allowlist",directory:"\u{1F504} Directory"},usersView:{title:"Users",searchPlaceholder:"Search by name or email...",searchLabel:"Search users",addUser:"\uFF0B Add user",editUser:"Edit user",displayName:"Name",email:"Email",active:"Active",inactive:"Inactive",activate:"Activate",deactivate:"Deactivate",editUserAria:"Edit {user}",activateAria:"Activate {user}",deactivateAria:"Deactivate {user}",confirmDeactivate:"Deactivate this user? They will no longer be able to sign in.",empty:"No matching users"},groupsView:{emptyFiltered:"No group matches this search",title:"Groups",searchPlaceholder:"Search by group name or key...",searchLabel:"Search groups",addGroup:"\uFF0B Add group",editGroup:"Edit group",groupKey:"Group key",name:"Name",description:"Description",memberCountTemplate:"{count} members",confirmDelete:"Delete this group?",editGroupAria:"Edit {group}",deleteGroupAria:"Delete {group}",noDescription:"No description",groupKeyPlaceholder:"e.g. dev-team",namePlaceholder:"e.g. Development team",empty:"No groups registered"},groupMembersView:{title:"Group members",selectGroup:"Select a group",selectPrompt:"Select a group to manage its members",actionAdd:"Add",actionRemove:"Remove",actionAddAria:"Add {user} to this group",actionRemoveAria:"Remove {user} from this group",upstreamNotice:"Membership of this group is owned by the upstream directory. Edit it there \u2014 a local change would be reverted at the next synchronization.",membersOfTemplate:"Members of {group}",groupKeyLabel:"Group key"},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",deploymentOwner:"Deployment-wide",confirmDelete:"Remove this allowlist entry? Anyone who could sign in only through it will be locked out.",deleteAria:"Remove the allowlist entry for {target}",empty:"No allowlist entries registered"},directoryView:{title:"Directory synchronization",membershipMode:"Membership",directMode:"Direct only",transitiveMode:"Nested expanded",lastSynced:"Last synced",neverSynced:"Never",unresolvedTemplate:"{count} 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.",pausedTemplate:"{paused} of {total} links are paused",erroredTemplate:"Last synchronization failed for {groups}",erroredItemTemplate:"{group}: {reason}",listSeparator:", ",oldestSyncedTemplate:"oldest successful sync: {at}",pendingTemplate:"{count} sync requests are queued",nothingToLink:"Every group is already linked to a directory.",notWiredNotice:"Directory synchronization is not wired for this deployment, so links cannot be created or changed here.",syncNowAria:"Synchronize {group} now",syncQueuedAria:"A synchronization of {group} is queued",pauseAria:"Pause synchronization of {group}",resumeAria:"Resume synchronization of {group}",allowGroupAria:"Allow members of {group} to sign in",disallowGroupAria:"Stop allowing members of {group} to sign in",unlinkAria:"Unlink {group} from the directory",confirmDisallow:"Stop allowing this group to sign in? Anyone who could sign in only through it will be locked out.",link:"Link to a directory group",unlink:"Unlink",externalKey:"Upstream group",empty:"No groups are linked to a directory",selectGroup:"Group to link",externalKeyPlaceholder:"e.g. dev-team@example.com",confirmUnlink:"Unlink this group? Its member ledger and group-based sign-in permission are removed.",pause:"Pause",resume:"Resume",allowGroup:"Allow sign-in",disallowGroup:"Stop allowing sign-in",groupOptionTemplate:"{name} ({key})"}},ue={title:"\u30E6\u30FC\u30B6\u30FC\u30FB\u30B0\u30EB\u30FC\u30D7\u7BA1\u7406",locale:"ja-JP",timeZone:"Asia/Tokyo",heading:"\u{1F464} \u30E6\u30FC\u30B6\u30FC\u7BA1\u7406",common:{create:"\u4F5C\u6210",edit:"\u7DE8\u96C6",delete:"\u524A\u9664",save:"\u4FDD\u5B58",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",actions:"\u64CD\u4F5C",status:"\u72B6\u614B",id:"ID",readOnly:"\u5909\u66F4\u4E0D\u53EF",managedUpstream:"\u4E0A\u6D41\u304C\u6240\u6709",idTemplate:"#{id}",none:"-"},errors:{forbidden:"\u3053\u306E\u64CD\u4F5C\u3092\u884C\u3046\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093\u3002"},permissions:{label:"\u3042\u306A\u305F\u306E\u6A29\u9650:",canWrite:"\u7DE8\u96C6\u53EF",canRead:"\u95B2\u89A7\u306E\u307F",none:"\u6A29\u9650\u306A\u3057",unknown:"\u6A29\u9650\u4E0D\u660E"},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",directory:"\u{1F504} \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u9023\u643A"},usersView:{title:"\u30E6\u30FC\u30B6\u30FC\u7BA1\u7406",searchPlaceholder:"\u8868\u793A\u540D\u3084 Email \u3067\u691C\u7D22...",searchLabel:"\u30E6\u30FC\u30B6\u30FC\u3092\u691C\u7D22",addUser:"\uFF0B \u30E6\u30FC\u30B6\u30FC\u8FFD\u52A0",editUser:"\u30E6\u30FC\u30B6\u30FC\u7DE8\u96C6",displayName:"\u8868\u793A\u540D",email:"Email",active:"\u6709\u52B9",inactive:"\u7121\u52B9",activate:"\u6709\u52B9\u5316",deactivate:"\u7121\u52B9\u5316",editUserAria:"{user} \u3092\u7DE8\u96C6",activateAria:"{user} \u3092\u6709\u52B9\u5316",deactivateAria:"{user} \u3092\u7121\u52B9\u5316",confirmDeactivate:"\u3053\u306E\u30E6\u30FC\u30B6\u30FC\u3092\u7121\u52B9\u5316\u3057\u307E\u3059\u304B\uFF1F \u4EE5\u5F8C\u30B5\u30A4\u30F3\u30A4\u30F3\u3067\u304D\u306A\u304F\u306A\u308A\u307E\u3059\u3002",empty:"\u8A72\u5F53\u3059\u308B\u30E6\u30FC\u30B6\u30FC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093"},groupsView:{emptyFiltered:"\u691C\u7D22\u6761\u4EF6\u306B\u4E00\u81F4\u3059\u308B\u30B0\u30EB\u30FC\u30D7\u306F\u3042\u308A\u307E\u305B\u3093",title:"\u30E6\u30FC\u30B6\u30FC\u30B0\u30EB\u30FC\u30D7\u7BA1\u7406",searchPlaceholder:"\u30B0\u30EB\u30FC\u30D7\u540D\u3084\u30AD\u30FC\u3067\u691C\u7D22...",searchLabel:"\u30B0\u30EB\u30FC\u30D7\u3092\u691C\u7D22",addGroup:"\uFF0B \u30B0\u30EB\u30FC\u30D7\u8FFD\u52A0",editGroup:"\u30B0\u30EB\u30FC\u30D7\u7DE8\u96C6",groupKey:"\u30B0\u30EB\u30FC\u30D7\u30AD\u30FC",name:"\u540D\u79F0",description:"\u8AAC\u660E",memberCountTemplate:"\u6240\u5C5E {count} \u540D",confirmDelete:"\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u3092\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F",editGroupAria:"{group} \u3092\u7DE8\u96C6",deleteGroupAria:"{group} \u3092\u524A\u9664",noDescription:"\u8AAC\u660E\u306A\u3057",groupKeyPlaceholder:"\u4F8B: dev-team",namePlaceholder:"\u4F8B: \u958B\u767A\u30C1\u30FC\u30E0",empty:"\u30E6\u30FC\u30B6\u30FC\u30B0\u30EB\u30FC\u30D7\u304C\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},groupMembersView:{title:"\u30B0\u30EB\u30FC\u30D7\u30E1\u30F3\u30D0\u30FC\u7BA1\u7406",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",actionAddAria:"{user} \u3092\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u3078\u8FFD\u52A0",actionRemoveAria:"{user} \u3092\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u304B\u3089\u9664\u5916",upstreamNotice:"\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u306E\u6240\u5C5E\u306F\u4E0A\u6D41\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u6240\u6709\u3057\u3066\u3044\u307E\u3059\u3002\u5909\u66F4\u306F\u4E0A\u6D41\u3067\u884C\u3063\u3066\u304F\u3060\u3055\u3044 (\u3053\u3053\u3067\u5909\u3048\u3066\u3082\u6B21\u306E\u540C\u671F\u3067\u5143\u306B\u623B\u308A\u307E\u3059)\u3002",membersOfTemplate:"{group} \u306E\u6240\u5C5E\u30E1\u30F3\u30D0\u30FC",groupKeyLabel:"\u30B0\u30EB\u30FC\u30D7\u30AD\u30FC"},allowlistView:{title:"\u30B5\u30A4\u30F3\u30A4\u30F3\u8A31\u53EF\u30EA\u30B9\u30C8",addEntry:"\uFF0B \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:"\u30E1\u30FC\u30EB",domainTypeShort:"\u30C9\u30E1\u30A4\u30F3",groupTypeShort:"\u30B0\u30EB\u30FC\u30D7",target:"\u5BFE\u8C61",description:"\u8AAC\u660E / \u5099\u8003",deploymentOwner:"\u914D\u5099\u5171\u901A",confirmDelete:"\u3053\u306E\u8A31\u53EF\u3092\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F \u3053\u308C\u3067\u3057\u304B\u30B5\u30A4\u30F3\u30A4\u30F3\u3067\u304D\u306A\u3044\u4EBA\u306F\u30ED\u30B0\u30A4\u30F3\u3067\u304D\u306A\u304F\u306A\u308A\u307E\u3059\u3002",deleteAria:"{target} \u306E\u8A31\u53EF\u3092\u524A\u9664",empty:"\u30A2\u30ED\u30EF\u30EA\u30B9\u30C8\u30A8\u30F3\u30C8\u30EA\u304C\u767B\u9332\u3055\u308C\u3066\u3044\u307E\u305B\u3093"},directoryView:{title:"\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u540C\u671F",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",unresolvedTemplate:"{count} \u4EF6\u304C\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",pausedTemplate:"\u9023\u643A {total} \u4EF6\u306E\u3046\u3061 {paused} \u4EF6\u304C\u505C\u6B62\u4E2D",erroredTemplate:"\u76F4\u8FD1\u306E\u540C\u671F\u306B\u5931\u6557\u3057\u305F\u30B0\u30EB\u30FC\u30D7: {groups}",erroredItemTemplate:"{group}: {reason}",listSeparator:" / ",oldestSyncedTemplate:"\u6700\u3082\u53E4\u3044\u540C\u671F\u6210\u529F: {at}",pendingTemplate:"{count} \u4EF6\u306E\u540C\u671F\u8981\u6C42\u304C\u672A\u51E6\u7406",nothingToLink:"\u3059\u3079\u3066\u306E\u30B0\u30EB\u30FC\u30D7\u304C\u65E2\u306B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3068\u9023\u643A\u3057\u3066\u3044\u307E\u3059\u3002",notWiredNotice:"\u3053\u306E\u914D\u5099\u3067\u306F\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u540C\u671F\u304C\u7D50\u7DDA\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u3053\u3053\u304B\u3089\u9023\u643A\u306E\u4F5C\u6210\u30FB\u5909\u66F4\u306F\u3067\u304D\u307E\u305B\u3093\u3002",syncNowAria:"{group} \u3092\u4ECA\u3059\u3050\u540C\u671F",syncQueuedAria:"{group} \u306E\u540C\u671F\u3092\u8981\u6C42\u6E08\u307F",pauseAria:"{group} \u306E\u540C\u671F\u3092\u4E00\u6642\u505C\u6B62",resumeAria:"{group} \u306E\u540C\u671F\u3092\u518D\u958B",allowGroupAria:"{group} \u306E\u30E1\u30F3\u30D0\u30FC\u306E\u30B5\u30A4\u30F3\u30A4\u30F3\u3092\u8A31\u53EF",disallowGroupAria:"{group} \u306E\u30E1\u30F3\u30D0\u30FC\u306E\u30B5\u30A4\u30F3\u30A4\u30F3\u8A31\u53EF\u3092\u5916\u3059",unlinkAria:"{group} \u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u9023\u643A\u3092\u89E3\u9664",confirmDisallow:"\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u306E\u30B5\u30A4\u30F3\u30A4\u30F3\u8A31\u53EF\u3092\u5916\u3057\u307E\u3059\u304B\uFF1F \u3053\u308C\u3067\u3057\u304B\u30B5\u30A4\u30F3\u30A4\u30F3\u3067\u304D\u306A\u3044\u4EBA\u306F\u30ED\u30B0\u30A4\u30F3\u3067\u304D\u306A\u304F\u306A\u308A\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",selectGroup:"\u9023\u643A\u3059\u308B\u30B0\u30EB\u30FC\u30D7",externalKeyPlaceholder:"\u4F8B: dev-team@example.com",confirmUnlink:"\u3053\u306E\u30B0\u30EB\u30FC\u30D7\u306E\u9023\u643A\u3092\u89E3\u9664\u3057\u307E\u3059\u304B\uFF1F \u30E1\u30F3\u30D0\u30FC\u53F0\u5E33\u3068\u30B0\u30EB\u30FC\u30D7\u5358\u4F4D\u306E\u30B5\u30A4\u30F3\u30A4\u30F3\u8A31\u53EF\u304C\u5931\u308F\u308C\u307E\u3059\u3002",pause:"\u4E00\u6642\u505C\u6B62",resume:"\u518D\u958B",allowGroup:"\u30B5\u30A4\u30F3\u30A4\u30F3\u3092\u8A31\u53EF",disallowGroup:"\u30B5\u30A4\u30F3\u30A4\u30F3\u8A31\u53EF\u3092\u5916\u3059",groupOptionTemplate:"{name} ({key})"}};function H(r){let i=I;return r?{title:r.title??i.title,locale:r.locale??i.locale,timeZone:r.timeZone??i.timeZone,heading:r.heading??i.heading,common:{...i.common,...r.common},errors:{...i.errors,...r.errors},permissions:{...i.permissions,...r.permissions},tabs:{...i.tabs,...r.tabs},usersView:{...i.usersView,...r.usersView},groupsView:{...i.groupsView,...r.groupsView},groupMembersView:{...i.groupMembersView,...r.groupMembersView},allowlistView:{...i.allowlistView,...r.allowlistView},directoryView:{...i.directoryView,...r.directoryView}}:i}var Y=require("react-router");function ce(r){let i=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}],n=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}],c=r?.groupMembers??[{id:1,groupId:1,userId:2},{id:2,groupId:2,userId:3}],a=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[...i]},async createUser(t){let o={id:Math.max(...i.map(s=>s.id),0)+1,email:t.email,displayName:t.displayName,isActive:!0};return i.push(o),o},async updateUser(t,o){let s=i.findIndex(m=>m.id===t);if(s===-1)throw new Error(`User not found: ${t}`);return i[s]={...i[s],displayName:o.displayName,email:o.email},i[s]},async toggleUserActive(t,o){let s=i.findIndex(m=>m.id===t);if(s===-1)throw new Error(`User not found: ${t}`);return i[s]={...i[s],isActive:o},i[s]},async listGroups(){return[...n]},async createGroup(t){let o={id:Math.max(...n.map(s=>s.id),0)+1,groupKey:t.groupKey,name:t.name,description:t.description,isActive:!0,readOnly:!1};return n.push(o),o},async updateGroup(t,o){let s=n.findIndex(m=>m.id===t);if(s===-1)throw new Error(`Group not found: ${t}`);return n[s]={...n[s],name:o.name,description:o.description},n[s]},async deleteGroup(t){n=n.filter(o=>o.id!==t),c=c.filter(o=>o.groupId!==t)},async listGroupMembers(){return[...c]},async addGroupMember(t,o){let s=c.find(u=>u.groupId===t&&u.userId===o);if(s)return s;let m={id:Math.max(...c.map(u=>u.id),0)+1,groupId:t,userId:o};return c.push(m),m},async removeGroupMember(t,o){c=c.filter(s=>!(s.groupId===t&&s.userId===o))},async listAllowlist(){return[...a]},async addAllowlistEntry(t){let o={id:Math.max(...a.map(s=>s.id),0)+1,pattern:t.pattern,type:t.type,description:t.description,owner:{kind:"tenant",tenantId:"default"},readOnly:!1};return a.push(o),o},async removeAllowlistEntry(t){a=a.filter(o=>o.id!==t)},async addAllowlistGroup(t,o){let s=n.find(m=>m.id===t);if(!s)throw new Error(`Group not found: ${t}`);a=[...a,{id:Math.max(...a.map(m=>m.id),0)+1,type:"group",groupId:t,groupKey:s.groupKey,groupName:s.name,description:o,owner:{kind:"tenant",tenantId:"default"},readOnly:!1}]},async removeAllowlistGroup(t){a=a.filter(o=>!(o.type==="group"&&o.id===t))},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,provider:"",linkedGroupCount:0,isStale:!1,pausedGroupCount:0,stalenessThresholdSec:0,erroredGroupIds:[],pendingRequestCount:0}}}}function me(r){return typeof r=="object"&&r!==null&&r.status===403}function ge(r){let i=String(r.get("type")??"");if(i==="email"||i==="domain")return i;throw new Error(`type \u306F "email" \u307E\u305F\u306F "domain" \u306E\u3044\u305A\u308C\u304B\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044 (\u53D7\u3051\u53D6\u3063\u305F\u5024: ${JSON.stringify(i)})`)}var ye=["users","groups","group_members","allowlist","directory"];function be(r){let i=r.replace(/\.data$/,"").split("/").filter(Boolean),n=i[i.length-1]??"";return ye.includes(n)?n:"users"}var fe=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","create","delete"]],["unlinkDirectoryGroup",["update","delete"]],["setDirectorySyncEnabled",["update"]],["requestDirectorySync",["update"]]]);function R(r,i){let n=r.get(i),c=Number(n);if(n===null||String(n).trim()===""||!Number.isInteger(c)||c<=0)throw new Error(`Invalid or missing "${i}"`);return c}function L(r,i){let n=String(r.get(i)??"").trim();if(n==="")throw new Error(`Invalid or missing "${i}"`);return n}function xe(r,i){let n=String(r.get(i)??"");if(n!=="true"&&n!=="false")throw new Error(`Invalid or missing "${i}"`);return n==="true"}function he(r){let i=String(r.get("membershipMode")??"");if(i!=="direct"&&i!=="transitive")throw new Error('Invalid or missing "membershipMode"');return i}function B(r,i){let n=String(r.get(i)??"").trim();return n===""?void 0:n}function we(r){let i=H(r.labels);async function n({request:t}){await r.guards.requireAccess(t,{action:"read",intent:"loader"});let o=be(new URL(t.url).pathname),[s,m,u,b,d,x]=await Promise.all([r.store.listUsers(),r.store.listGroups(),r.store.listGroupMembers(),r.store.listAllowlist(),r.store.getDirectoryStatus(),r.getMyPermissions?r.getMyPermissions(t).catch(S=>(console.error("[@aiquants/auth-react-router] getMyPermissions failed; rendering the permission badge as unknown:",S),null)):Promise.resolve(null)]);return{resourceLabels:r.resourceLabels,segment:o,users:s,groups:m,groupMembers:u,allowlist:b,directoryStatus:d,myPermissions:x,labels:i}}async function c({request:t}){let o=await t.formData(),s=String(o.get("intent")??""),m=fe.get(s);if(!m)return{ok:!1,error:`Unknown intent: ${s}`};let u=d=>me(d),b=d=>{try{r.guards.onDenied?.({intent:s,actions:m,error:d})}catch{}return(0,Y.data)({ok:!1,error:i.errors.forbidden},{status:403})};try{for(let d of m)await r.guards.requireAccess(t,{action:d,intent:s})}catch(d){if(!u(d))throw d;return b(d)}try{return await a(s,o)}catch(d){if(u(d))return b(d);if(d instanceof Response)throw d;return{ok:!1,error:d instanceof Error?d.message:String(d)}}}async function a(t,o){if(t==="createUser")return await r.store.createUser({displayName:L(o,"displayName"),email:L(o,"email")}),{ok:!0};if(t==="updateUser")return await r.store.updateUser(R(o,"userId"),{displayName:L(o,"displayName"),email:L(o,"email")}),{ok:!0};if(t==="toggleUserActive"){let s=String(o.get("isActive")??"");if(s!=="true"&&s!=="false")throw new Error('Invalid or missing "isActive"');return await r.store.toggleUserActive(R(o,"userId"),s==="true"),{ok:!0}}if(t==="createGroup")return await r.store.createGroup({groupKey:L(o,"groupKey"),name:L(o,"name"),description:B(o,"description")}),{ok:!0};if(t==="updateGroup")return await r.store.updateGroup(R(o,"groupId"),{name:L(o,"name"),description:B(o,"description")}),{ok:!0};if(t==="deleteGroup")return await r.store.deleteGroup(R(o,"groupId")),{ok:!0};if(t==="addGroupMember")return await r.store.addGroupMember(R(o,"groupId"),R(o,"userId")),{ok:!0};if(t==="removeGroupMember")return await r.store.removeGroupMember(R(o,"groupId"),R(o,"userId")),{ok:!0};if(t==="addAllowlistEntry"){let s=ge(o);return await r.store.addAllowlistEntry({pattern:L(o,"pattern"),type:s,description:B(o,"description")}),{ok:!0}}if(t==="addAllowlistGroup")return await r.store.addAllowlistGroup(R(o,"groupId"),B(o,"description")),{ok:!0};if(t==="removeAllowlistGroup")return await r.store.removeAllowlistGroup(R(o,"entryId")),{ok:!0};if(t==="linkDirectoryGroup")return await r.store.linkDirectoryGroup(R(o,"groupId"),{provider:L(o,"provider"),externalKey:L(o,"externalKey"),membershipMode:he(o)}),{ok:!0};if(t==="unlinkDirectoryGroup")return await r.store.unlinkDirectoryGroup(R(o,"groupId")),{ok:!0};if(t==="setDirectorySyncEnabled")return await r.store.setDirectorySyncEnabled(R(o,"groupId"),xe(o,"isSyncEnabled")),{ok:!0};if(t==="requestDirectorySync"){let s=String(o.get("groupId")??"").trim();return await r.store.requestDirectorySync(s===""?null:R(o,"groupId")),{ok:!0}}return t==="removeAllowlistEntry"?(await r.store.removeAllowlistEntry(R(o,"entryId")),{ok:!0}):{ok:!1,error:`Unknown intent: ${t}`}}return{loader:n,action:c}}var O=require("react-router");function v(r,i){return Object.entries(i).reduce((n,[c,a])=>n.replaceAll(`{${c}}`,String(a)),r)}function W(r,i){let n=/(?:Z|[+-]\d{2}:?\d{2})$/.test(r)?r:`${r}Z`;try{return new Intl.DateTimeFormat(i.locale,{timeZone:i.timeZone,dateStyle:"medium",timeStyle:"short"}).format(new Date(n))}catch{return r}}var k=require("react/jsx-runtime");function X({label:r,summary:i}){return(0,k.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.18rem",fontSize:"0.65rem",padding:"0.08rem 0.35rem",borderRadius:"9999px",backgroundColor:i.bgColor,color:i.color,border:`1px solid ${i.borderColor}`,fontWeight:600,lineHeight:"1.2"},children:[(0,k.jsxs)("span",{children:[r,":"]}),(0,k.jsx)("span",{children:i.text})]})}function ve({status:r,labels:i,groups:n}){if(!r||r.linkedGroupCount===0)return null;let c=i.directoryView,a=[];if(r.isEnabled||a.push({id:"disabled",text:c.disabledWarning}),r.pausedGroupCount>0&&a.push({id:"paused",text:v(c.pausedTemplate,{paused:r.pausedGroupCount,total:r.linkedGroupCount})}),r.isStale){let t=r.oldestSyncedAt?W(r.oldestSyncedAt,i):c.neverSynced;a.push({id:"stale",text:`${c.staleWarning} ${v(c.oldestSyncedTemplate,{at:t})}`})}if(r.erroredGroupIds.length>0){let t=r.erroredGroupIds.map(o=>{let s=n.find(u=>u.id===o);if(!s)return v(i.common.idTemplate,{id:o});let m=s.externalLink?.syncError;return m?v(c.erroredItemTemplate,{group:s.name,reason:m}):s.name});a.push({id:"errored",text:v(c.erroredTemplate,{groups:t.join(c.listSeparator)})})}return r.pendingRequestCount>0&&a.push({id:"pending",text:v(c.pendingTemplate,{count:r.pendingRequestCount})}),a.length===0?null:(0,k.jsxs)("section",{"aria-labelledby":"directory-sync-heading","data-testid":"directory-sync-banner",style:{display:"flex",flexDirection:"column",gap:"0.35rem",padding:"0.7rem 1rem",marginBottom:"1rem",borderRadius:"6px",border:"1px solid #fde68a",backgroundColor:"#fffbeb",color:"#92400e",fontSize:"0.85rem"},children:[(0,k.jsx)("h2",{id:"directory-sync-heading",style:{margin:0,fontSize:"0.9rem",fontWeight:700},children:c.title}),a.map(t=>(0,k.jsx)("span",{"data-directory-warning":t.id,children:t.text},t.id))]})}function Z({children:r,renderHeader:i}){let n=(0,O.useLoaderData)(),c=n?.segment??"users",a=n?.labels??I,t=n?.myPermissions??null,o=n?.resourceLabels??{},s=f=>Object.hasOwn(o,f)?o[f]:f,m=[{key:"users",label:a.tabs.users,href:"/users"},{key:"groups",label:a.tabs.groups,href:"/users/groups"},{key:"group_members",label:a.tabs.groupMembers,href:"/users/group_members"},{key:"allowlist",label:a.tabs.allowlist,href:"/users/allowlist"}],u=(n?.groups??[]).some(f=>f.externalLink);(n?.directoryStatus?.isEnabled||(n?.directoryStatus?.linkedGroupCount??0)>0||u)&&m.push({key:"directory",label:a.tabs.directory,href:"/users/directory"});let b=Object.entries(t??{}),d=f=>f?.canWrite?{text:a.permissions.canWrite,color:"#047857",bgColor:"#ecfdf5",borderColor:"#a7f3d0"}:f?.canRead?{text:a.permissions.canRead,color:"#1d4ed8",bgColor:"#eff6ff",borderColor:"#bfdbfe"}:{text:a.permissions.none,color:"#475569",bgColor:"#f1f5f9",borderColor:"#cbd5e1"},x={text:a.permissions.unknown,color:"#92400e",bgColor:"#fffbeb",borderColor:"#fde68a"},S=(0,k.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem"},"data-testid":"user-admin-header-annotation",children:[(0,k.jsx)("span",{style:{fontSize:"0.75rem",backgroundColor:"#e0f2fe",color:"#0369a1",padding:"2px 8px",borderRadius:"12px",fontWeight:600},children:a.heading}),(0,k.jsxs)("div",{style:{display:"inline-flex",alignItems:"center",gap:"0.25rem",fontSize:"0.68rem",color:"#475569"},"data-testid":"user-admin-permissions-badge",children:[(0,k.jsx)("span",{style:{fontWeight:600,color:"#334155"},children:a.permissions.label}),(0,k.jsx)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.18rem"},children:b.length===0?(0,k.jsx)("span",{"data-testid":"user-admin-permission-unavailable",children:(0,k.jsx)(X,{label:a.heading,summary:x})}):b.map(([f,l])=>(0,k.jsx)(X,{label:s(f),summary:d(l)},f))})]})]});return(0,k.jsxs)("div",{"data-testid":"user-admin-shell",style:{width:"100%",minHeight:"100vh",backgroundColor:"#f8fafc",padding:"1.5rem",boxSizing:"border-box"},children:[i?i({title:a.title,annotation:S}):(0,k.jsxs)("div",{style:{marginBottom:"1.5rem",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,k.jsx)("h1",{style:{margin:0,fontSize:"1.5rem",fontWeight:700,color:"#0f172a"},children:a.title}),S]}),(0,k.jsx)("nav",{"aria-label":a.title,style:{display:"flex",gap:"0.5rem",marginBottom:"1.2rem",borderBottom:"2px solid #e2e8f0",paddingBottom:"0.5rem"},children:m.map(f=>{let l=c===f.key;return(0,k.jsx)(O.Link,{to:f.href,"data-testid":`user-admin-tab-${f.key}`,"aria-current":l?"page":void 0,style:{padding:"0.5rem 1rem",borderRadius:"6px 6px 0 0",fontSize:"0.88rem",fontWeight:l?700:500,color:l?"#0284c7":"#64748b",backgroundColor:l?"#ffffff":"transparent",textDecoration:"none",borderBottom:l?"3px solid #0284c7":"3px solid transparent",transition:"all 0.15s ease"},children:f.label},f.key)})}),(0,k.jsx)(ve,{status:n?.directoryStatus,labels:a,groups:n?.groups??[]}),(0,k.jsx)("main",{children:r})]})}var h=require("react"),U=require("react-router");var e=require("react/jsx-runtime");function D({result:r,id:i}){let n=r;return n?.ok!==!1||!n.error?null:(0,e.jsx)("div",{id:i,"data-testid":"user-admin-action-error",role:"alert",style:{gridColumn:"1 / -1",padding:"0.7rem 1rem",borderRadius:"6px",border:"1px solid #fecaca",backgroundColor:"#fef2f2",color:"#b91c1c",fontSize:"0.85rem"},children:n.error})}function $(r){let i=(0,h.useRef)(null),[n,c]=(0,h.useState)(void 0),a=r.data===n?void 0:r.data;return(0,h.useEffect)(()=>{if(r.state!=="idle"||r.data===void 0)return;let s=i.current;s&&(i.current=null,r.data.ok===!0&&s())},[r.state,r.data]),{submit:(s,m)=>{i.current=m??null,c(void 0),r.submit(s,{method:"post"})},resetResult:()=>c(r.data),result:a}}function j(r,i,n){let c=(0,h.useRef)(null),a=(0,h.useRef)(i);return a.current=i,(0,h.useEffect)(()=>{if(!r)return;let t=c.current,o=n?.current??document.activeElement,s=()=>Array.from(t?.querySelectorAll('a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])')??[]);s()[0]?.focus();let m=u=>{if(u.key==="Escape"){if(u.isComposing||u.keyCode===229)return;u.preventDefault(),a.current();return}if(u.key!=="Tab")return;let b=s();if(b.length===0)return;let d=b[0],x=b[b.length-1],S=document.activeElement,f=!t?.contains(S);u.shiftKey&&(S===d||f)?(u.preventDefault(),x.focus()):!u.shiftKey&&(S===x||f)&&(u.preventDefault(),d.focus())};return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m),o?.focus?.()}},[r,n]),c}function J(){let r=(0,U.useLoaderData)(),i=(0,U.useFetcher)(),{submit:n,resetResult:c,result:a}=$(i),t=r.labels??I,[o,s]=(0,h.useState)(""),[m,u]=(0,h.useState)(null),b=m?.kind==="edit"?m.user:null,d=m?.kind==="create",x=(0,h.useRef)(null),S=(y,P)=>{x.current=P.currentTarget,c(),u(y)},[f,l]=(0,h.useState)(""),[A,C]=(0,h.useState)(""),N=j(d,()=>u(null),x),z=j(b!==null,()=>u(null),x),E=i.state!=="idle",p=r.users.filter(y=>y.displayName.toLowerCase().includes(o.toLowerCase())||y.email.toLowerCase().includes(o.toLowerCase())),w=y=>{y.isActive&&!window.confirm(t.usersView.confirmDeactivate)||n({intent:"toggleUserActive",userId:String(y.id),isActive:String(!y.isActive)})},T=y=>{if(y.preventDefault(),!(f&&A))return;let P=f,g=A;n({intent:"createUser",displayName:P,email:g},()=>{l(G=>G===P?"":G),C(G=>G===g?"":G),u(null)})},F=y=>{y.preventDefault(),b&&n({intent:"updateUser",userId:String(b.id),displayName:b.displayName,email:b.email},()=>u(null))};return(0,e.jsxs)("section",{"data-testid":"users-view-section",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[(0,e.jsx)("h2",{style:K,children:t.usersView.title}),!m&&(0,e.jsx)(D,{result:a}),(0,e.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[(0,e.jsx)("input",{type:"text","aria-label":t.usersView.searchLabel,placeholder:t.usersView.searchPlaceholder,value:o,onChange:y=>s(y.target.value),"data-testid":"users-search-input",style:{padding:"6px 12px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",width:"260px"}}),(0,e.jsx)("button",{type:"button",onClick:y=>S({kind:"create"},y),"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})]}),(0,e.jsx)("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0",overflow:"hidden"},children:(0,e.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"0.85rem",textAlign:"left"},children:[(0,e.jsx)("thead",{children:(0,e.jsxs)("tr",{style:{backgroundColor:"#f8fafc",borderBottom:"1px solid #e2e8f0",color:"#475569"},children:[(0,e.jsx)("th",{style:{padding:"10px 14px"},children:t.common.id}),(0,e.jsx)("th",{style:{padding:"10px 14px"},children:t.usersView.displayName}),(0,e.jsx)("th",{style:{padding:"10px 14px"},children:t.usersView.email}),(0,e.jsx)("th",{style:{padding:"10px 14px"},children:t.common.status}),(0,e.jsx)("th",{style:{padding:"10px 14px",textAlign:"right"},children:t.common.actions})]})}),(0,e.jsxs)("tbody",{children:[p.map(y=>(0,e.jsxs)("tr",{style:{borderBottom:"1px solid #f1f5f9"},"data-testid":`user-row-${y.id}`,children:[(0,e.jsx)("td",{style:{padding:"10px 14px",color:"#475569"},children:v(t.common.idTemplate,{id:y.id})}),(0,e.jsx)("td",{style:{padding:"10px 14px",fontWeight:600,color:"#0f172a"},children:y.displayName}),(0,e.jsx)("td",{style:{padding:"10px 14px",color:"#475569"},children:y.email}),(0,e.jsx)("td",{style:{padding:"10px 14px"},children:(0,e.jsx)("span",{style:{fontSize:"0.75rem",padding:"2px 8px",borderRadius:"10px",backgroundColor:y.isActive?"#dcfce7":"#fee2e2",color:y.isActive?"#15803d":"#b91c1c",fontWeight:600},children:y.isActive?t.usersView.active:t.usersView.inactive})}),(0,e.jsxs)("td",{style:{padding:"10px 14px",textAlign:"right"},children:[(0,e.jsx)("button",{type:"button",onClick:P=>S({kind:"edit",user:y},P),"aria-label":v(t.usersView.editUserAria,{user:y.displayName}),"data-testid":`edit-user-btn-${y.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"0.78rem",cursor:"pointer",marginRight:"6px"},children:t.common.edit}),(0,e.jsx)("button",{type:"button",onClick:()=>w(y),disabled:E,"aria-busy":E,"aria-label":v(y.isActive?t.usersView.deactivateAria:t.usersView.activateAria,{user:y.displayName}),"data-testid":`toggle-user-btn-${y.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"0.78rem",cursor:E?"default":"pointer",color:y.isActive?"#b91c1c":"#15803d"},children:y.isActive?t.usersView.deactivate:t.usersView.activate})]})]},y.id)),p.length===0&&(0,e.jsx)("tr",{children:(0,e.jsx)("td",{colSpan:5,style:{padding:"2rem",textAlign:"center",color:"#475569"},children:t.usersView.empty})})]})]})}),d&&(0,e.jsx)("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},children:(0,e.jsxs)("form",{ref:N,onSubmit:T,role:"dialog","aria-modal":"true","aria-labelledby":"create-user-title","aria-describedby":"create-user-error","data-testid":"user-create-modal",style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[(0,e.jsx)("h3",{id:"create-user-title",style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:t.usersView.addUser}),(0,e.jsx)(D,{result:a,id:"create-user-error"}),(0,e.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,e.jsx)("label",{htmlFor:"create-user-display-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.usersView.displayName}),(0,e.jsx)("input",{id:"create-user-display-name-input",type:"text",value:f,onChange:y=>l(y.target.value),required:!0,"data-testid":"create-user-display-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),(0,e.jsxs)("div",{style:{marginBottom:"1.2rem"},children:[(0,e.jsx)("label",{htmlFor:"create-user-email-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.usersView.email}),(0,e.jsx)("input",{id:"create-user-email-input",type:"email",value:A,onChange:y=>C(y.target.value),required:!0,"data-testid":"create-user-email",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),(0,e.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[(0,e.jsx)("button",{type:"button",onClick:()=>u(null),"data-testid":"cancel-create-user",style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:t.common.cancel}),(0,e.jsx)("button",{type:"submit","data-testid":"submit-create-user",disabled:E,"aria-busy":E,style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#0284c7",color:"#ffffff",border:"none",cursor:"pointer"},children:t.common.create})]})]})}),b&&(0,e.jsx)("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},children:(0,e.jsxs)("form",{ref:z,onSubmit:F,role:"dialog","aria-modal":"true","aria-labelledby":"edit-user-title","aria-describedby":"edit-user-error","data-testid":"user-edit-modal",style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[(0,e.jsx)("h3",{id:"edit-user-title",style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:t.usersView.editUser}),(0,e.jsx)(D,{result:a,id:"edit-user-error"}),(0,e.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,e.jsx)("label",{htmlFor:"edit-user-display-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.usersView.displayName}),(0,e.jsx)("input",{id:"edit-user-display-name-input",type:"text",value:b.displayName,onChange:y=>u({kind:"edit",user:{...b,displayName:y.target.value}}),required:!0,"data-testid":"edit-user-display-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),(0,e.jsxs)("div",{style:{marginBottom:"1.2rem"},children:[(0,e.jsx)("label",{htmlFor:"edit-user-email-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.usersView.email}),(0,e.jsx)("input",{id:"edit-user-email-input",type:"email",value:b.email,onChange:y=>u({kind:"edit",user:{...b,email:y.target.value}}),required:!0,"data-testid":"edit-user-email",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),(0,e.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[(0,e.jsx)("button",{type:"button",onClick:()=>u(null),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:t.common.cancel}),(0,e.jsx)("button",{type:"submit","data-testid":"submit-edit-user",disabled:E,"aria-busy":E,style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#0284c7",color:"#ffffff",border:"none",cursor:"pointer"},children:t.common.save})]})]})})]})}function te(){let r=(0,U.useLoaderData)(),i=(0,U.useFetcher)(),{submit:n,resetResult:c,result:a}=$(i),t=r.labels??I,[o,s]=(0,h.useState)(""),[m,u]=(0,h.useState)(null),b=m?.kind==="edit"?m.group:null,d=m?.kind==="create",x=(0,h.useRef)(null),S=(g,G)=>{x.current=G.currentTarget,c(),u(g)},f=i.state!=="idle",[l,A]=(0,h.useState)(""),[C,N]=(0,h.useState)(""),[z,E]=(0,h.useState)(""),p=j(d,()=>u(null),x),w=j(b!==null,()=>u(null),x),T=r.groups.filter(g=>g.name.toLowerCase().includes(o.toLowerCase())||g.groupKey.toLowerCase().includes(o.toLowerCase())),F=g=>{if(g.preventDefault(),!(l&&C))return;let G={key:l,name:C,description:z};n({intent:"createGroup",groupKey:G.key,name:G.name,description:G.description},()=>{A(M=>M===G.key?"":M),N(M=>M===G.name?"":M),E(M=>M===G.description?"":M),u(null)})},y=g=>{g.preventDefault(),b&&n({intent:"updateGroup",groupId:String(b.id),name:b.name,description:b.description??""},()=>u(null))},P=g=>{window.confirm(t.groupsView.confirmDelete)&&n({intent:"deleteGroup",groupId:String(g)})};return(0,e.jsxs)("section",{"data-testid":"groups-view-section",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[(0,e.jsx)("h2",{style:K,children:t.groupsView.title}),!m&&(0,e.jsx)(D,{result:a}),(0,e.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[(0,e.jsx)("input",{type:"text","aria-label":t.groupsView.searchLabel,placeholder:t.groupsView.searchPlaceholder,value:o,onChange:g=>s(g.target.value),"data-testid":"groups-search-input",style:{padding:"6px 12px",borderRadius:"6px",border:"1px solid #cbd5e1",fontSize:"0.85rem",width:"260px"}}),(0,e.jsx)("button",{type:"button",onClick:g=>S({kind:"create"},g),"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})]}),(0,e.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:"1rem"},children:T.map(g=>{let G=r.groupMembers.filter(M=>M.groupId===g.id).length;return(0,e.jsxs)("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0",padding:"1rem",display:"flex",flexDirection:"column",justifyContent:"space-between"},"data-testid":`group-card-${g.id}`,"data-group-readonly":g.readOnly?"true":"false",children:[(0,e.jsxs)("div",{children:[(0,e.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.5rem"},children:[(0,e.jsx)("h4",{style:{margin:0,fontSize:"1rem",color:"#0f172a"},children:g.name}),(0,e.jsx)("span",{style:{fontSize:"0.72rem",backgroundColor:"#e0e7ff",color:"#4338ca",padding:"2px 6px",borderRadius:"4px",fontFamily:"monospace"},children:g.groupKey})]}),(0,e.jsx)("p",{style:{margin:"0 0 0.8rem 0",fontSize:"0.82rem",color:"#64748b",minHeight:"2.4em"},children:g.description||t.groupsView.noDescription}),g.externalLink&&(0,e.jsxs)("div",{"data-testid":`group-source-${g.id}`,style:{display:"flex",alignItems:"center",gap:"6px",flexWrap:"wrap",marginBottom:"0.6rem"},children:[(0,e.jsx)("span",{style:{fontSize:"0.72rem",padding:"2px 8px",borderRadius:"10px",backgroundColor:"#ede9fe",color:"#6d28d9",fontWeight:600},children:t.common.managedUpstream}),(0,e.jsx)("span",{style:{fontSize:"0.72rem",fontFamily:"monospace",color:"#64748b"},children:g.externalLink.externalKey}),g.externalLink.unresolvedCount>0&&(0,e.jsx)("span",{"data-testid":`group-unresolved-${g.id}`,style:{fontSize:"0.72rem",color:"#b45309"},children:v(t.directoryView.unresolvedTemplate,{count:g.externalLink.unresolvedCount})})]})]}),(0,e.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",borderTop:"1px solid #f1f5f9",paddingTop:"0.6rem"},children:[(0,e.jsx)("span",{style:{fontSize:"0.78rem",color:"#475569"},"data-testid":`group-member-count-${g.id}`,children:v(t.groupsView.memberCountTemplate,{count:G})}),g.readOnly?(0,e.jsx)("span",{"data-testid":`readonly-group-${g.id}`,style:{fontSize:"0.75rem",color:"#475569"},children:t.common.readOnly}):(0,e.jsxs)("div",{children:[(0,e.jsx)("button",{type:"button",onClick:M=>S({kind:"edit",group:g},M),disabled:f,"aria-busy":f,"aria-label":v(t.groupsView.editGroupAria,{group:g.name}),"data-testid":`edit-group-btn-${g.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",fontSize:"0.75rem",cursor:"pointer",marginRight:"4px"},children:t.common.edit}),(0,e.jsx)("button",{type:"button",onClick:()=>P(g.id),disabled:f,"aria-busy":f,"aria-label":v(t.groupsView.deleteGroupAria,{group:g.name}),"data-testid":`delete-group-btn-${g.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #fee2e2",backgroundColor:"#fff5f5",color:"#b91c1c",fontSize:"0.75rem",cursor:"pointer"},children:t.common.delete})]})]})]},g.id)})}),T.length===0&&(0,e.jsx)("div",{"data-testid":"groups-empty",style:{padding:"2rem",textAlign:"center",color:"#475569",backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0"},children:r.groups.length===0?t.groupsView.empty:t.groupsView.emptyFiltered}),d&&(0,e.jsx)("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},children:(0,e.jsxs)("form",{ref:p,onSubmit:F,role:"dialog","aria-modal":"true","aria-labelledby":"create-group-title","aria-describedby":"create-group-error","data-testid":"group-create-modal",style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[(0,e.jsx)("h3",{id:"create-group-title",style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:t.groupsView.addGroup}),(0,e.jsx)(D,{result:a,id:"create-group-error"}),(0,e.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,e.jsx)("label",{htmlFor:"create-group-key-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.groupsView.groupKey}),(0,e.jsx)("input",{id:"create-group-key-input",type:"text",value:l,onChange:g=>A(g.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"}})]}),(0,e.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,e.jsx)("label",{htmlFor:"create-group-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.groupsView.name}),(0,e.jsx)("input",{id:"create-group-name-input",type:"text",value:C,onChange:g=>N(g.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"}})]}),(0,e.jsxs)("div",{style:{marginBottom:"1.2rem"},children:[(0,e.jsx)("label",{htmlFor:"create-group-desc-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.groupsView.description}),(0,e.jsx)("textarea",{id:"create-group-desc-input",value:z,onChange:g=>E(g.target.value),"data-testid":"create-group-description",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box",height:"60px"}})]}),(0,e.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[(0,e.jsx)("button",{type:"button",onClick:()=>u(null),"data-testid":"cancel-create-group",style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:t.common.cancel}),(0,e.jsx)("button",{type:"submit","data-testid":"submit-create-group",disabled:f,"aria-busy":f,style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#4338ca",color:"#ffffff",border:"none",cursor:"pointer"},children:t.common.create})]})]})}),b&&(0,e.jsx)("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.4)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:100},children:(0,e.jsxs)("form",{ref:w,onSubmit:y,role:"dialog","aria-modal":"true","aria-labelledby":"edit-group-title","aria-describedby":"edit-group-error","data-testid":"group-edit-modal",style:{backgroundColor:"#ffffff",padding:"1.5rem",borderRadius:"8px",width:"360px",boxShadow:"0 10px 25px rgba(0,0,0,0.15)"},children:[(0,e.jsx)("h3",{id:"edit-group-title",style:{margin:"0 0 1rem 0",fontSize:"1.1rem"},children:t.groupsView.editGroup}),(0,e.jsx)(D,{result:a,id:"edit-group-error"}),(0,e.jsxs)("div",{style:{marginBottom:"1rem"},children:[(0,e.jsx)("label",{htmlFor:"edit-group-name-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.groupsView.name}),(0,e.jsx)("input",{id:"edit-group-name-input",type:"text",value:b.name,onChange:g=>u({kind:"edit",group:{...b,name:g.target.value}}),required:!0,"data-testid":"edit-group-name",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box"}})]}),(0,e.jsxs)("div",{style:{marginBottom:"1.2rem"},children:[(0,e.jsx)("label",{htmlFor:"edit-group-desc-input",style:{display:"block",fontSize:"0.8rem",color:"#475569",marginBottom:"4px"},children:t.groupsView.description}),(0,e.jsx)("textarea",{id:"edit-group-desc-input",value:b.description??"",onChange:g=>u({kind:"edit",group:{...b,description:g.target.value}}),"data-testid":"edit-group-description",style:{width:"100%",padding:"6px",borderRadius:"4px",border:"1px solid #cbd5e1",boxSizing:"border-box",height:"60px"}})]}),(0,e.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[(0,e.jsx)("button",{type:"button",onClick:()=>u(null),style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid #cbd5e1",backgroundColor:"#ffffff",cursor:"pointer"},children:t.common.cancel}),(0,e.jsx)("button",{type:"submit","data-testid":"submit-edit-group",disabled:f,"aria-busy":f,style:{padding:"6px 12px",borderRadius:"4px",backgroundColor:"#4338ca",color:"#ffffff",border:"none",cursor:"pointer"},children:t.common.save})]})]})})]})}function re(){let r=(0,U.useLoaderData)(),i=(0,U.useFetcher)(),{submit:n,result:c}=$(i),a=i.state!=="idle",t=r.labels??I,[o,s]=(0,h.useState)(r.groups[0]?.id??0),m=r.groups.find(d=>d.id===o)??r.groups[0],u=new Set(r.groupMembers.filter(d=>d.groupId===o).map(d=>d.userId)),b=(d,x)=>{n(x?{intent:"removeGroupMember",groupId:String(o),userId:String(d)}:{intent:"addGroupMember",groupId:String(o),userId:String(d)})};return(0,e.jsxs)("section",{"data-testid":"group-members-view-section",style:{display:"grid",gridTemplateColumns:"240px 1fr",gap:"1.2rem"},children:[(0,e.jsx)("h2",{style:{...K,gridColumn:"1 / -1"},children:t.groupMembersView.title}),(0,e.jsx)(D,{result:c}),(0,e.jsxs)("div",{style:{backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[(0,e.jsx)("h4",{style:{margin:"0 0 0.8rem 0",fontSize:"0.9rem",color:"#475569"},children:t.groupMembersView.selectGroup}),(0,e.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"0.4rem"},children:r.groups.map(d=>{let x=d.id===o;return(0,e.jsxs)("button",{type:"button",onClick:()=>s(d.id),"data-testid":`select-group-btn-${d.id}`,style:{textAlign:"left",padding:"8px 10px",borderRadius:"6px",border:x?"1px solid #6366f1":"1px solid #e2e8f0",backgroundColor:x?"#e0e7ff":"#ffffff",color:x?"#3730a3":"#0f172a",cursor:"pointer",fontWeight:x?600:400,fontSize:"0.85rem"},children:[d.name,d.readOnly?(0,e.jsx)("span",{"data-testid":`group-upstream-marker-${d.id}`,style:{marginLeft:"6px",fontSize:"0.7rem",color:"#7c3aed"},children:t.common.managedUpstream}):null]},d.id)})})]}),(0,e.jsx)("div",{style:{backgroundColor:"#ffffff",padding:"1.2rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:m?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{style:{marginBottom:"1rem",borderBottom:"1px solid #e2e8f0",paddingBottom:"0.8rem"},children:[(0,e.jsx)("h3",{style:{margin:0,fontSize:"1.1rem",color:"#0f172a"},children:v(t.groupMembersView.membersOfTemplate,{group:m.name})}),(0,e.jsxs)("span",{style:{fontSize:"0.8rem",color:"#64748b"},children:[t.groupMembersView.groupKeyLabel,": ",m.groupKey]}),m.readOnly?(0,e.jsx)("div",{"data-testid":"group-members-upstream-notice",role:"note",style:{marginTop:"0.5rem",padding:"0.5rem 0.7rem",borderRadius:"6px",backgroundColor:"#f5f3ff",border:"1px solid #ddd6fe",color:"#5b21b6",fontSize:"0.8rem"},children:t.groupMembersView.upstreamNotice}):null]}),(0,e.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem"},children:r.users.map(d=>{let x=u.has(d.id);return(0,e.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 12px",borderRadius:"6px",border:"1px solid #f1f5f9",backgroundColor:x?"#f0fdf4":"#ffffff"},"data-testid":`member-row-${d.id}`,children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("span",{style:{fontWeight:600,fontSize:"0.88rem",color:"#0f172a",marginRight:"8px"},children:d.displayName}),(0,e.jsxs)("span",{style:{fontSize:"0.78rem",color:"#64748b"},children:["(",d.email,")"]})]}),m.readOnly?x?(0,e.jsx)("span",{"data-testid":`member-readonly-${d.id}`,style:{fontSize:"0.75rem",color:"#475569"},children:t.common.managedUpstream}):null:(0,e.jsx)("button",{type:"button",onClick:()=>b(d.id,x),disabled:a,"aria-busy":a,"aria-label":v(x?t.groupMembersView.actionRemoveAria:t.groupMembersView.actionAddAria,{user:d.displayName}),"data-testid":`toggle-member-btn-${d.id}`,style:{padding:"4px 12px",borderRadius:"4px",border:x?"1px solid #b91c1c":"1px solid #0284c7",backgroundColor:x?"#ffffff":"#0284c7",color:x?"#b91c1c":"#ffffff",fontSize:"0.78rem",fontWeight:600,cursor:"pointer"},children:x?t.groupMembersView.actionRemove:t.groupMembersView.actionAdd})]},d.id)})})]}):(0,e.jsx)("div",{style:{color:"#475569",textAlign:"center",padding:"2rem"},children:t.groupMembersView.selectPrompt})})]})}function Ae(r){return r==="email"?{backgroundColor:"#e0f2fe",color:"#0369a1"}:r==="domain"?{backgroundColor:"#fef3c7",color:"#b45309"}:{backgroundColor:"#ede9fe",color:"#6d28d9"}}function ke(r,i){return r==="email"?i.allowlistView.emailTypeShort:r==="domain"?i.allowlistView.domainTypeShort:i.allowlistView.groupTypeShort}function ie(){let r=(0,U.useLoaderData)(),i=(0,U.useFetcher)(),n=r.labels??I,{submit:c,result:a}=$(i),t=i.state!=="idle",[o,s]=(0,h.useState)(""),[m,u]=(0,h.useState)("email"),[b,d]=(0,h.useState)(""),x=l=>{if(l.preventDefault(),!o)return;let A={pattern:o,description:b};c({intent:"addAllowlistEntry",pattern:A.pattern,type:m,description:A.description},()=>{s(C=>C===A.pattern?"":C),d(C=>C===A.description?"":C)})},S=l=>{c({intent:"removeAllowlistEntry",entryId:String(l)})},f=l=>{c({intent:"removeAllowlistGroup",entryId:String(l)})};return(0,e.jsxs)("section",{"data-testid":"allowlist-view-section",style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[(0,e.jsx)("h2",{style:K,children:n.allowlistView.title}),(0,e.jsx)(D,{result:a}),(0,e.jsxs)("form",{onSubmit:x,style:{backgroundColor:"#ffffff",padding:"1.2rem",borderRadius:"8px",border:"1px solid #e2e8f0",display:"flex",flexWrap:"wrap",gap:"0.8rem",alignItems:"flex-end"},children:[(0,e.jsxs)("div",{style:{flex:2,minWidth:"220px"},children:[(0,e.jsx)("label",{htmlFor:"allowlist-pattern-input-field",style:{display:"block",fontSize:"0.78rem",color:"#475569",marginBottom:"4px"},children:n.allowlistView.pattern}),(0,e.jsx)("input",{id:"allowlist-pattern-input-field",type:"text",value:o,onChange:l=>s(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"}})]}),(0,e.jsxs)("div",{style:{flex:1,minWidth:"140px"},children:[(0,e.jsx)("label",{htmlFor:"allowlist-type-select-field",style:{display:"block",fontSize:"0.78rem",color:"#475569",marginBottom:"4px"},children:n.allowlistView.type}),(0,e.jsxs)("select",{id:"allowlist-type-select-field",value:m,onChange:l=>u(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:[(0,e.jsx)("option",{value:"email",children:n.allowlistView.emailType}),(0,e.jsx)("option",{value:"domain",children:n.allowlistView.domainType})]})]}),(0,e.jsxs)("div",{style:{flex:2,minWidth:"200px"},children:[(0,e.jsx)("label",{htmlFor:"allowlist-desc-input-field",style:{display:"block",fontSize:"0.78rem",color:"#475569",marginBottom:"4px"},children:n.allowlistView.description}),(0,e.jsx)("input",{id:"allowlist-desc-input-field",type:"text",value:b,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"}})]}),(0,e.jsx)("button",{type:"submit","data-testid":"submit-allowlist-add",disabled:t,"aria-busy":t,style:{padding:"7px 16px",borderRadius:"6px",backgroundColor:"#047857",color:"#ffffff",border:"none",fontSize:"0.85rem",fontWeight:600,cursor:"pointer"},children:n.allowlistView.addEntry})]}),(0,e.jsx)("div",{style:{backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0",overflow:"hidden"},children:(0,e.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"0.85rem",textAlign:"left"},children:[(0,e.jsx)("thead",{children:(0,e.jsxs)("tr",{style:{backgroundColor:"#f8fafc",borderBottom:"1px solid #e2e8f0",color:"#475569"},children:[(0,e.jsx)("th",{style:{padding:"10px 14px"},children:n.common.id}),(0,e.jsx)("th",{style:{padding:"10px 14px"},children:n.allowlistView.target}),(0,e.jsx)("th",{style:{padding:"10px 14px"},children:n.allowlistView.type}),(0,e.jsx)("th",{style:{padding:"10px 14px"},children:n.allowlistView.description}),(0,e.jsx)("th",{style:{padding:"10px 14px",textAlign:"right"},children:n.common.actions})]})}),(0,e.jsxs)("tbody",{children:[r.allowlist.map(l=>(0,e.jsxs)("tr",{style:{borderBottom:"1px solid #f1f5f9"},"data-testid":`allowlist-row-${l.type}-${l.id}`,"data-allowlist-type":l.type,children:[(0,e.jsx)("td",{style:{padding:"10px 14px",color:"#475569"},children:v(n.common.idTemplate,{id:l.id})}),(0,e.jsx)("td",{style:{padding:"10px 14px",fontWeight:600,color:"#0f172a"},children:l.type==="group"?(0,e.jsxs)("span",{"data-testid":`allowlist-group-${l.type}-${l.id}`,children:[l.groupName,(0,e.jsx)("span",{style:{marginLeft:"6px",fontFamily:"monospace",fontSize:"0.78rem",color:"#64748b"},children:l.groupKey})]}):(0,e.jsx)("span",{style:{fontFamily:"monospace"},children:l.pattern})}),(0,e.jsx)("td",{style:{padding:"10px 14px"},children:(0,e.jsx)("span",{style:{fontSize:"0.75rem",padding:"2px 8px",borderRadius:"10px",...Ae(l.type),fontWeight:600},children:ke(l.type,n)})}),(0,e.jsxs)("td",{style:{padding:"10px 14px",color:"#475569"},children:[l.description||n.common.none,l.owner.kind==="deployment"&&(0,e.jsx)("span",{"data-testid":`allowlist-owner-${l.type}-${l.id}`,style:{marginLeft:"8px",fontSize:"0.72rem",color:"#475569"},children:n.allowlistView.deploymentOwner})]}),(0,e.jsx)("td",{style:{padding:"10px 14px",textAlign:"right"},children:l.readOnly?(0,e.jsx)("span",{"data-testid":`readonly-allowlist-${l.type}-${l.id}`,style:{fontSize:"0.75rem",color:"#475569"},children:n.common.readOnly}):(0,e.jsx)("button",{type:"button",onClick:()=>{window.confirm(n.allowlistView.confirmDelete)&&(l.type==="group"?f(l.id):S(l.id))},disabled:t,"aria-busy":t,"aria-label":v(n.allowlistView.deleteAria,{target:l.type==="group"?l.groupName:l.pattern}),"data-testid":`remove-allowlist-btn-${l.type}-${l.id}`,style:{padding:"3px 8px",borderRadius:"4px",border:"1px solid #fee2e2",backgroundColor:"#fff5f5",color:"#b91c1c",fontSize:"0.78rem",cursor:"pointer"},children:n.common.delete})})]},`${l.type}-${l.id}`)),r.allowlist.length===0&&(0,e.jsx)("tr",{children:(0,e.jsx)("td",{colSpan:5,style:{padding:"2rem",textAlign:"center",color:"#475569"},children:n.allowlistView.empty})})]})]})})]})}function oe(){let r=(0,U.useLoaderData)(),i=(0,U.useFetcher)(),{submit:n,result:c}=$(i),a=r.labels??I,t=a.directoryView,o=r.groups.filter(p=>!p.externalLink),[s,m]=(0,h.useState)(""),[u,b]=(0,h.useState)(""),[d,x]=(0,h.useState)("direct"),S=r.groups.filter(p=>p.externalLink),f=new Set(r.allowlist.filter(p=>p.type==="group").map(p=>p.groupId)),l=p=>r.allowlist.find(w=>w.type==="group"&&w.groupId===p),A=i.state!=="idle",[C,N]=(0,h.useState)(null),z=r.directoryStatus.isEnabled&&r.directoryStatus.provider!=="",E=p=>{if(p.preventDefault(),!(s&&u))return;let w=u;n({intent:"linkDirectoryGroup",groupId:s,provider:r.directoryStatus.provider,externalKey:w,membershipMode:d},()=>{b(T=>T===w?"":T),m("")})};return(0,e.jsxs)("section",{"data-testid":"directory-view-section",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[(0,e.jsx)("h2",{style:K,children:t.title}),(0,e.jsx)(D,{result:c}),!z&&(0,e.jsx)("p",{"data-testid":"directory-not-wired",style:{margin:0,padding:"0.7rem 1rem",borderRadius:"6px",border:"1px solid #e2e8f0",backgroundColor:"#f8fafc",color:"#475569",fontSize:"0.85rem"},children:t.notWiredNotice}),z&&o.length===0&&(0,e.jsx)("p",{"data-testid":"directory-nothing-to-link",style:{margin:0,padding:"0.7rem 1rem",borderRadius:"6px",border:"1px solid #e2e8f0",backgroundColor:"#f8fafc",color:"#475569",fontSize:"0.85rem"},children:t.nothingToLink}),z&&o.length>0&&(0,e.jsxs)("form",{onSubmit:E,"data-testid":"directory-link-form",style:{display:"flex",gap:"0.75rem",flexWrap:"wrap",alignItems:"flex-end",backgroundColor:"#ffffff",padding:"1rem",borderRadius:"8px",border:"1px solid #e2e8f0"},children:[(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem"},children:[(0,e.jsx)("label",{htmlFor:"directory-group-select-input",style:_,children:t.selectGroup}),(0,e.jsxs)("select",{id:"directory-group-select-input","data-testid":"directory-group-select",value:s,onChange:p=>m(p.target.value),style:{padding:"0.5rem",borderRadius:"6px",border:"1px solid #cbd5e1"},children:[(0,e.jsx)("option",{value:"",children:t.selectGroup}),o.map(p=>(0,e.jsx)("option",{value:String(p.id),children:v(t.groupOptionTemplate,{name:p.name,key:p.groupKey})},p.id))]})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem",flex:1,minWidth:"220px"},children:[(0,e.jsx)("label",{htmlFor:"directory-external-key-input",style:_,children:t.externalKey}),(0,e.jsx)("input",{id:"directory-external-key-input",type:"email",required:!0,"data-testid":"directory-external-key",placeholder:t.externalKeyPlaceholder,value:u,onChange:p=>b(p.target.value),style:{padding:"0.5rem",borderRadius:"6px",border:"1px solid #cbd5e1"}})]}),(0,e.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem"},children:[(0,e.jsx)("label",{htmlFor:"directory-membership-mode-input",style:_,children:t.membershipMode}),(0,e.jsxs)("select",{id:"directory-membership-mode-input","data-testid":"directory-membership-mode",value:d,onChange:p=>x(p.target.value),style:{padding:"0.5rem",borderRadius:"6px",border:"1px solid #cbd5e1"},children:[(0,e.jsx)("option",{value:"direct",children:t.directMode}),(0,e.jsx)("option",{value:"transitive",children:t.transitiveMode})]})]}),(0,e.jsx)("button",{type:"submit","data-testid":"directory-link-submit",disabled:!(s&&u)||A,"aria-busy":A,style:{padding:"0.5rem 1rem",borderRadius:"6px",border:"none",backgroundColor:s&&u&&!A?"#2563eb":"#94a3b8",color:"#fff",fontWeight:600},children:t.link})]}),S.length===0?(0,e.jsx)("div",{"data-testid":"directory-empty",style:{padding:"2rem",textAlign:"center",color:"#64748b",backgroundColor:"#ffffff",borderRadius:"8px",border:"1px solid #e2e8f0"},children:t.empty}):(0,e.jsxs)("table",{"data-testid":"directory-table",style:{width:"100%",borderCollapse:"collapse",backgroundColor:"#ffffff",borderRadius:"8px",overflow:"hidden",border:"1px solid #e2e8f0"},children:[(0,e.jsx)("thead",{children:(0,e.jsxs)("tr",{style:{backgroundColor:"#f8fafc",textAlign:"left"},children:[(0,e.jsx)("th",{style:V,children:a.groupsView.name}),(0,e.jsx)("th",{style:V,children:t.externalKey}),(0,e.jsx)("th",{style:V,children:t.membershipMode}),(0,e.jsx)("th",{style:V,children:t.lastSynced}),(0,e.jsx)("th",{style:V,children:a.common.status}),(0,e.jsx)("th",{style:V,children:a.common.actions})]})}),(0,e.jsx)("tbody",{children:S.map(p=>{let w=p.externalLink,T=f.has(p.id);return(0,e.jsxs)("tr",{"data-testid":`directory-row-${p.id}`,"data-sync-enabled":String(w.isSyncEnabled),style:{borderTop:"1px solid #e2e8f0"},children:[(0,e.jsxs)("td",{style:V,children:[p.name,(0,e.jsx)("div",{style:{fontSize:"0.75rem",color:"#64748b"},children:p.groupKey})]}),(0,e.jsx)("td",{style:V,"data-testid":`directory-external-${p.id}`,children:w.externalKey}),(0,e.jsx)("td",{style:V,children:w.membershipMode==="direct"?t.directMode:t.transitiveMode}),(0,e.jsxs)("td",{style:V,"data-testid":`directory-synced-${p.id}`,children:[w.syncedAt?W(w.syncedAt,a):t.neverSynced,w.unresolvedCount>0?(0,e.jsx)("div",{style:{fontSize:"0.75rem",color:"#b45309"},"data-testid":`directory-unresolved-${p.id}`,children:v(t.unresolvedTemplate,{count:w.unresolvedCount})}):null]}),(0,e.jsxs)("td",{style:V,children:[(0,e.jsx)("span",{"data-testid":`directory-status-${p.id}`,style:{fontSize:"0.75rem",padding:"2px 8px",borderRadius:"10px",backgroundColor:w.isSyncEnabled?"#dcfce7":"#fee2e2",color:w.isSyncEnabled?"#166534":"#b91c1c",fontWeight:600},children:w.isSyncEnabled?t.syncEnabled:t.syncPaused}),w.syncError?(0,e.jsx)("div",{style:{fontSize:"0.75rem",color:"#b91c1c",marginTop:"0.25rem"},"data-testid":`directory-error-${p.id}`,children:w.syncError}):null]}),(0,e.jsx)("td",{style:V,children:(0,e.jsxs)("div",{style:{display:"flex",gap:"0.35rem",flexWrap:"wrap"},children:[(0,e.jsx)("button",{type:"button","data-testid":`directory-sync-now-${p.id}`,disabled:A,"aria-busy":A,"aria-label":v(C===p.id?t.syncQueuedAria:t.syncNowAria,{group:p.name}),onClick:()=>n({intent:"requestDirectorySync",groupId:String(p.id)},()=>N(p.id)),style:q,children:C===p.id?t.syncQueued:t.syncNow}),(0,e.jsx)("button",{type:"button","data-testid":`directory-toggle-sync-${p.id}`,disabled:A,"aria-busy":A,"aria-label":v(w.isSyncEnabled?t.pauseAria:t.resumeAria,{group:p.name}),onClick:()=>{N(null),n({intent:"setDirectorySyncEnabled",groupId:String(p.id),isSyncEnabled:String(!w.isSyncEnabled)})},style:q,children:w.isSyncEnabled?t.pause:t.resume}),(0,e.jsx)("button",{type:"button","data-testid":`directory-allow-${p.id}`,disabled:A,"aria-busy":A,"aria-label":v(T?t.disallowGroupAria:t.allowGroupAria,{group:p.name}),onClick:()=>{let F=l(p.id);if(T&&F){if(!window.confirm(t.confirmDisallow))return;n({intent:"removeAllowlistGroup",entryId:String(F.id)})}else n({intent:"addAllowlistGroup",groupId:String(p.id)})},style:q,children:T?t.disallowGroup:t.allowGroup}),(0,e.jsx)("button",{type:"button","data-testid":`directory-unlink-${p.id}`,disabled:A,"aria-busy":A,"aria-label":v(t.unlinkAria,{group:p.name}),onClick:()=>{window.confirm(t.confirmUnlink)&&n({intent:"unlinkDirectoryGroup",groupId:String(p.id)})},style:{...q,color:"#b91c1c",borderColor:"#fecaca"},children:t.unlink})]})})]},p.id)})})]})]})}var _={fontSize:"0.78rem",color:"#475569",fontWeight:600},K={margin:0,fontSize:"1.05rem",fontWeight:700,color:"#0f172a"},V={padding:"0.6rem 0.75rem",fontSize:"0.85rem",verticalAlign:"top"},q={padding:"0.25rem 0.6rem",fontSize:"0.75rem",borderRadius:"6px",border:"1px solid #cbd5e1",backgroundColor:"#fff",cursor:"pointer"},ee={users:J,groups:te,group_members:re,allowlist:ie,directory:oe};function Se({renderHeader:r}={}){let n=(0,U.useLoaderData)()?.segment??"users",c=Object.hasOwn(ee,n)?ee[n]:J;return(0,e.jsx)(Z,{renderHeader:r,children:(0,e.jsx)(c,{})})}0&&(module.exports={AllowlistView,AuthUserAdminAppView,DirectoryView,GroupMembersView,GroupsView,UserAdminShell,UsersView,createInMemoryUserAdminStore,createUserAdminApp,defaultUserAdminLabels,jaUserAdminLabels,resolveUserAdminLabels});
2
2
  //# sourceMappingURL=admin.js.map