@coffre/ui 0.6.1 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/dist/chunks/{audit-sentence-CUUMshIp.js → audit-sentence-C1_gRxWW.js} +91 -26
  2. package/dist/chunks/audit-sentence-C1_gRxWW.js.map +1 -0
  3. package/dist/chunks/{connected-apps-DTpatjge.js → connected-apps-Bn5rEoV2.js} +4 -4
  4. package/dist/chunks/{connected-apps-DTpatjge.js.map → connected-apps-Bn5rEoV2.js.map} +1 -1
  5. package/dist/chunks/{delete-place-SOOYVt6A.js → delete-place-CQCDHkne.js} +4 -4
  6. package/dist/chunks/{delete-place-SOOYVt6A.js.map → delete-place-CQCDHkne.js.map} +1 -1
  7. package/dist/chunks/{directory-DrtdKny2.js → directory-BQNOdze_.js} +22 -19
  8. package/dist/chunks/directory-BQNOdze_.js.map +1 -0
  9. package/dist/chunks/{folders-hR2Lnk0k.js → folders-Dw240WMJ.js} +2 -2
  10. package/dist/chunks/{folders-hR2Lnk0k.js.map → folders-Dw240WMJ.js.map} +1 -1
  11. package/dist/chunks/{grants-DDBui9YD.js → grants-CJIBrkod.js} +5 -5
  12. package/dist/chunks/{grants-DDBui9YD.js.map → grants-CJIBrkod.js.map} +1 -1
  13. package/dist/chunks/multi-combobox-CsIXihuc.js +99 -0
  14. package/dist/chunks/multi-combobox-CsIXihuc.js.map +1 -0
  15. package/dist/chunks/{offboarding-C7ECW5o0.js → offboarding-CrgwaetA.js} +4 -4
  16. package/dist/chunks/offboarding-CrgwaetA.js.map +1 -0
  17. package/dist/chunks/personal-tokens-B8rkT-DI.js +138 -0
  18. package/dist/chunks/personal-tokens-B8rkT-DI.js.map +1 -0
  19. package/dist/chunks/{principal-page-CB6dAABC.js → principal-page-DDmmV1KQ.js} +37 -27
  20. package/dist/chunks/principal-page-DDmmV1KQ.js.map +1 -0
  21. package/dist/chunks/{project-page-BHNUvr2L.js → project-page-BI--vjt3.js} +2 -2
  22. package/dist/chunks/{project-page-BHNUvr2L.js.map → project-page-BI--vjt3.js.map} +1 -1
  23. package/dist/chunks/{queries-DgQo3mC-.js → queries-epz4MIuW.js} +103 -18
  24. package/dist/chunks/queries-epz4MIuW.js.map +1 -0
  25. package/dist/chunks/{references-BQc35Q9g.js → references-DImfw0cz.js} +4 -4
  26. package/dist/chunks/{references-BQc35Q9g.js.map → references-DImfw0cz.js.map} +1 -1
  27. package/dist/chunks/{role-field-BfWRCqzl.js → role-field-C1KhNaIR.js} +2 -2
  28. package/dist/chunks/{role-field-BfWRCqzl.js.map → role-field-C1KhNaIR.js.map} +1 -1
  29. package/dist/chunks/{row-state-Zf3kZVhd.js → row-state-BsIHspy4.js} +2 -2
  30. package/dist/chunks/{row-state-Zf3kZVhd.js.map → row-state-BsIHspy4.js.map} +1 -1
  31. package/dist/chunks/{theme-B6-V9JvY.js → theme-3b4DnCow.js} +2 -2
  32. package/dist/chunks/{theme-B6-V9JvY.js.map → theme-3b4DnCow.js.map} +1 -1
  33. package/dist/chunks/{ui-Br-dNUTc.js → ui-2kwXXfrX.js} +95 -22
  34. package/dist/chunks/ui-2kwXXfrX.js.map +1 -0
  35. package/dist/chunks/{use-action-DthL5hL8.js → use-action-BB-RcHo1.js} +2 -2
  36. package/dist/chunks/{use-action-DthL5hL8.js.map → use-action-BB-RcHo1.js.map} +1 -1
  37. package/dist/chunks/{use-change-By4cG8bT.js → use-change-CQyDpCqw.js} +323 -31
  38. package/dist/chunks/use-change-CQyDpCqw.js.map +1 -0
  39. package/dist/chunks/{use-shell-D6kjSPls.js → use-shell-C_NmvCt_.js} +2 -2
  40. package/dist/chunks/{use-shell-D6kjSPls.js.map → use-shell-C_NmvCt_.js.map} +1 -1
  41. package/dist/index.d.ts +46 -164
  42. package/dist/index.js +143 -129
  43. package/dist/index.js.map +1 -1
  44. package/dist/pages/account.d.ts +1 -1
  45. package/dist/pages/account.js +29 -12
  46. package/dist/pages/account.js.map +1 -1
  47. package/dist/pages/approval.js +1 -1
  48. package/dist/pages/audit.js +96 -90
  49. package/dist/pages/audit.js.map +1 -1
  50. package/dist/pages/device-login.js +1 -1
  51. package/dist/pages/environment.js +949 -412
  52. package/dist/pages/environment.js.map +1 -1
  53. package/dist/pages/login.js +2 -2
  54. package/dist/pages/oauth-authorize.js +1 -1
  55. package/dist/pages/project-access.js +9 -9
  56. package/dist/pages/project-access.js.map +1 -1
  57. package/dist/pages/project-environments.js +112 -64
  58. package/dist/pages/project-environments.js.map +1 -1
  59. package/dist/pages/project-settings.d.ts +1 -1
  60. package/dist/pages/project-settings.js +54 -75
  61. package/dist/pages/project-settings.js.map +1 -1
  62. package/dist/pages/project.js +3 -7
  63. package/dist/pages/project.js.map +1 -1
  64. package/dist/pages/projects.js +50 -77
  65. package/dist/pages/projects.js.map +1 -1
  66. package/dist/pages/service-account.js +284 -160
  67. package/dist/pages/service-account.js.map +1 -1
  68. package/dist/pages/service-accounts.js +4 -4
  69. package/dist/pages/settings.js +5 -5
  70. package/dist/pages/unregistered.js +1 -1
  71. package/dist/pages/user.js +5 -5
  72. package/dist/pages/users.js +4 -4
  73. package/package.json +3 -3
  74. package/src/components/actions-log.tsx +3 -2
  75. package/src/components/command-palette.tsx +4 -5
  76. package/src/components/directory.tsx +7 -14
  77. package/src/components/generate-value.tsx +15 -7
  78. package/src/components/missing.tsx +63 -67
  79. package/src/components/offboarding.tsx +1 -1
  80. package/src/components/personal-tokens.tsx +131 -0
  81. package/src/components/principal-page.tsx +30 -17
  82. package/src/components/regenerate.tsx +72 -0
  83. package/src/components/service-tokens.tsx +5 -14
  84. package/src/components/shell.tsx +79 -75
  85. package/src/components/trusted-workloads.tsx +179 -19
  86. package/src/components/ui.tsx +35 -25
  87. package/src/lib/audit-sentences.ts +100 -12
  88. package/src/lib/bindings.ts +41 -3
  89. package/src/lib/changes.ts +215 -29
  90. package/src/lib/clipboard.ts +40 -0
  91. package/src/lib/copy-attempts.ts +103 -0
  92. package/src/lib/dismissal.ts +24 -0
  93. package/src/lib/generate.ts +3 -146
  94. package/src/lib/optimistic.ts +3 -1
  95. package/src/lib/queries.ts +121 -17
  96. package/src/lib/recipes.ts +63 -0
  97. package/src/lib/reveal.ts +7 -1
  98. package/src/lib/row-reads.ts +64 -0
  99. package/src/lib/secret-edit-batch.ts +64 -5
  100. package/src/options.ts +43 -51
  101. package/src/pages/account.tsx +27 -5
  102. package/src/pages/audit.tsx +38 -31
  103. package/src/pages/environment.tsx +655 -121
  104. package/src/pages/project-access.tsx +1 -1
  105. package/src/pages/project-environments.tsx +92 -45
  106. package/src/pages/project-settings.tsx +9 -20
  107. package/src/pages/project.tsx +1 -5
  108. package/src/pages/projects.tsx +13 -28
  109. package/src/parity.ts +20 -4
  110. package/src/styles/globals.css +143 -131
  111. package/dist/chunks/audit-sentence-CUUMshIp.js.map +0 -1
  112. package/dist/chunks/directory-DrtdKny2.js.map +0 -1
  113. package/dist/chunks/offboarding-C7ECW5o0.js.map +0 -1
  114. package/dist/chunks/principal-page-CB6dAABC.js.map +0 -1
  115. package/dist/chunks/project-environments-lEzFHUt4.js +0 -11
  116. package/dist/chunks/project-environments-lEzFHUt4.js.map +0 -1
  117. package/dist/chunks/queries-DgQo3mC-.js.map +0 -1
  118. package/dist/chunks/ui-Br-dNUTc.js.map +0 -1
  119. package/dist/chunks/use-change-By4cG8bT.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directory-BQNOdze_.js","names":[],"sources":["../../src/components/directory.tsx"],"sourcesContent":["import { Fragment, useState } from 'react';\nimport { useQuery } from '@tanstack/react-query';\nimport { Menu } from '@base-ui/react/menu';\nimport { EVERYWHERE, INSTANCE_ROLES, scopeInWords, unscoped } from '@coffre/core/access';\nimport { changeRole, directoryList, invite, removeMember, type InviteVars, type RoleVars } from '../lib/changes';\nimport { memberRef, useCoffre } from '../lib/coffre';\nimport { scopeComplete } from '../lib/validation';\nimport { queries, waysFor } from '../lib/queries';\nimport { useShell } from '../lib/use-shell';\nimport { useChange, useChangeStatus } from '../lib/use-change';\nimport type { DirectoryPrincipal } from '../shared/models';\nimport { setByDeployment } from './affordances';\nimport { RowFailure, RowPending, rowClass } from './row-state';\nimport { ConfirmDialog, EmptyState, MenuPopup, Modal, Spinner, Timestamp, Toggletip } from './ui';\nimport { PrincipalLink } from './principal';\nimport { RoleField } from './role-field';\nimport { Clock, Folder, GitHub, Key, Link, Lock, MoreHorizontal, Pencil, Plus, ShieldCheck, User, X } from './icons';\n\n/**\n * The instance directory, shared by the Users and Service accounts pages.\n *\n * Both are rows in the same table on the server (principals, typed user or\n * service); the pages split them because people and machines are looked after\n * differently, not because the model does.\n */\n\ntype PrincipalType = DirectoryPrincipal['principalType'];\n\n/** How the directory, and its changes, name someone to the API: `user:…`, `token:…` (shown `service:…`). */\nexport const memberOf = (principal: Pick<DirectoryPrincipal, 'principalType' | 'principalId'>) =>\n memberRef(principal.principalType, principal.principalId);\n\n/** A new person's role: a Member, everywhere. */\nconst MEMBER: RoleVars = { role: 'member', scope: EVERYWHERE };\n\n/** The role a principal holds, as the role field edits it. */\nconst roleOf = (principal: DirectoryPrincipal): RoleVars => ({ role: principal.instanceRole, scope: principal.scope ?? EVERYWHERE });\n\n/** What each kind of principal is called in the interface. */\nexport const KIND: Record<PrincipalType, string> = {\n user: 'user',\n service: 'service account',\n};\n\nexport function DirectoryTable({\n principalType,\n principals,\n hasRemoved = false,\n}: {\n principalType: PrincipalType;\n principals: DirectoryPrincipal[];\n /** Whether some were removed, listed beneath, so an empty table is not \"yet\". */\n hasRemoved?: boolean;\n}) {\n const users = principalType === 'user';\n const columns = users ? 4 : 6;\n const { capabilities } = useShell();\n const { status, failedAdds, dismiss } = useChangeStatus(directoryList.queryKey);\n const refused = failedAdds<InviteVars>(principals.map(memberOf)).filter(\n ({ vars }) => vars.principalType === principalType,\n );\n return (\n <>\n <section className=\"card\" aria-label={users ? 'Users' : 'Service accounts'}>\n {principals.length === 0 && refused.length === 0 ? (\n <EmptyState\n title={\n hasRemoved\n ? `No active ${KIND[principalType]}s`\n : users\n ? 'Nobody is registered'\n : 'No service accounts yet'\n }\n >\n {hasRemoved ? `Add a ${KIND[principalType]}` : `Add the first ${KIND[principalType]}`}, then\n grant it project access from each project's page.\n </EmptyState>\n ) : (\n <div className=\"dt-wrap\">\n <table className={`dt directory directory-${principalType} stacks${users ? '' : ' stacks-inline'}`}>\n <thead>\n <tr>\n <th className=\"n\">#</th>\n <th className=\"col-principal\">\n <span className=\"th\">\n {users ? <User size={14} /> : <Key size={14} />}\n {users ? 'Email' : 'Name'}\n </span>\n </th>\n {users ? (\n <th className=\"col-role\">\n <span className=\"th\">\n <ShieldCheck size={14} />\n Role\n </span>\n </th>\n ) : (\n <>\n <th className=\"col-signin\">\n <span className=\"th\">\n <Link size={14} />\n Signs in with\n </span>\n </th>\n <th className=\"col-access\">\n <span className=\"th\">\n <Folder size={14} />\n Access\n </span>\n </th>\n <th className=\"col-used\">\n <span className=\"th\">\n <Clock size={14} />\n Last used\n </span>\n </th>\n </>\n )}\n <th className=\"col-actions\">\n <span className=\"visually-hidden\">Actions</span>\n </th>\n </tr>\n </thead>\n <tbody>\n {principals.map((principal, index) => {\n const state = status(memberOf(principal));\n return (\n <Fragment key={principal.principalId}>\n <tr className={`row-link ${rowClass(state)}`}>\n <td className=\"n\">{index + 1}</td>\n <td\n className=\"col-lead\"\n data-label={principal.principalType === 'user' ? 'Email' : 'Name'}\n >\n <PrincipalLink\n type={principal.principalType}\n id={principal.principalId}\n stretch\n />\n </td>\n {users ? (\n <td className=\"col-role\" data-label=\"Role\">\n <InstanceRole principal={principal} />\n </td>\n ) : (\n <ServiceCells principal={principal} adding={state.state === 'pending' && state.kind === 'saving'} />\n )}\n <td className=\"col-actions\">\n {state.state === 'pending' ? (\n <RowPending status={state} />\n ) : (\n <PrincipalActions principal={principal} />\n )}\n </td>\n </tr>\n <RowFailure\n status={state}\n columns={columns}\n onDismiss={() => state.state === 'failed' && dismiss(state.mutationId)}\n />\n </Fragment>\n );\n })}\n {refused.map(({ mutationId, vars, status: failed }) => (\n <RowFailure\n key={mutationId}\n status={failed}\n columns={columns}\n onDismiss={() => dismiss(mutationId)}\n >\n {vars.principalId} was not added.\n </RowFailure>\n ))}\n </tbody>\n </table>\n </div>\n )}\n </section>\n {(capabilities.runsInstance || (!users && capabilities.setsUpServices)) && (\n <div className=\"table-actions\">\n <AddPrincipal principalType={principalType} />\n </div>\n )}\n </>\n );\n}\n\nconst PLATFORM: Record<string, string> = {\n github: 'GitHub',\n 'github-reusable': 'GitHub',\n 'github-reusable-organization': 'GitHub',\n gitlab: 'GitLab',\n custom: 'OIDC',\n};\n\n/**\n * What someone scanning service accounts wants of each: how it signs in, where\n * it reaches, and whether it is still in use. Access comes with the list; the\n * bindings and tokens are read per row, as its own page reads them.\n */\nfunction ServiceCells({ principal, adding }: { principal: DirectoryPrincipal; adding: boolean }) {\n const client = useCoffre();\n const shell = useShell();\n const member = memberOf(principal);\n // As `loadServiceDirectory` read them, so these come from its cache; an account just added is yours.\n const ways = waysFor(shell, principal.managed !== false);\n // Not suspended: an account added here is shown at once, its facts once it is made, and not asked for before.\n const { data: bindings } = useQuery({ ...queries.bindings(client, member, ways.workloads), enabled: !adding });\n const { data: credentials } = useQuery({ ...queries.credentials(client, member, ways.tokens), enabled: !adding });\n\n const platforms = new Map<string, number>();\n const bindingList = bindings?.ok === true ? bindings.bindings : [];\n for (const binding of bindingList) {\n const platform = PLATFORM[binding.profile] ?? 'OIDC';\n platforms.set(platform, (platforms.get(platform) ?? 0) + 1);\n }\n const now = Date.now();\n const tokenList = credentials?.ok === true ? credentials.tokens : [];\n const activeTokens = tokenList.filter((token) => new Date(token.expiresAt).getTime() > now).length;\n const lastUsed = [...bindingList, ...tokenList]\n .map((credential) => credential.lastUsedAt)\n .filter((at): at is string => at !== null)\n .sort()\n .at(-1);\n\n const places = [\n ...new Set(\n (principal.grants ?? []).map(({ project, environment }) =>\n environment === null ? project : `${project}/${environment}`,\n ),\n ),\n ];\n const projects = new Set((principal.grants ?? []).map((grant) => grant.project));\n const loaded = bindings !== undefined && credentials !== undefined;\n\n return (\n <>\n <td className=\"col-signin\" data-label=\"Signs in with\">\n {!loaded ? null : platforms.size === 0 && activeTokens === 0 ? (\n <span className=\"cell-muted\">Nothing yet</span>\n ) : (\n <span className=\"signin-list\">\n {[...platforms].map(([platform, count]) => (\n <span key={platform} className=\"signin-item\">\n {platform === 'GitHub' && <GitHub size={12} />}\n {platform}\n {count > 1 && ` ×${count}`}\n </span>\n ))}\n {activeTokens > 0 && (\n <span className=\"signin-item\">\n <Key size={12} />\n {activeTokens} token{activeTokens === 1 ? '' : 's'}\n </span>\n )}\n </span>\n )}\n </td>\n <td className=\"col-access\" data-label=\"Access\" title={places.join(', ')}>\n {places.length === 0 ? (\n <span className=\"cell-muted\">None</span>\n ) : places.length <= 2 ? (\n <span className=\"mono\">{places.join(', ')}</span>\n ) : (\n `${projects.size} project${projects.size === 1 ? '' : 's'}`\n )}\n </td>\n <td className=\"col-used cell-muted\" data-label=\"Last used\">\n {!loaded ? null : lastUsed === undefined ? 'Never' : <Timestamp iso={lastUsed} display=\"relative\" />}\n </td>\n </>\n );\n}\n\n/**\n * A user's instance role. Service accounts have none worth showing: every one is a\n * plain member.\n */\nexport function InstanceRole({ principal }: { principal: DirectoryPrincipal }) {\n const { capabilities } = useShell();\n if (principal.tampered === true) {\n return (\n <Toggletip\n label={\n <>\n Their record was changed outside coffre, so the vault refuses them\n everything. To start over, remove them and add them again.\n </>\n }\n >\n <button type=\"button\" className=\"tag tag-red tag-button\">\n <Lock size={11} />\n Integrity check failed\n </button>\n </Toggletip>\n );\n }\n const name = INSTANCE_ROLES[principal.instanceRole].name;\n return (\n <>\n {setByDeployment(principal, capabilities) ? (\n <Toggletip label=\"Set by deployment\">\n <button type=\"button\" className=\"tag tag-button\" aria-label={`${name}, set by deployment`}>\n {name}\n </button>\n </Toggletip>\n ) : (\n <span className={`tag${principal.instanceRole === 'member' ? '' : ' tag-violet'}`}>{name}</span>\n )}\n {principal.instanceRole !== 'member' && principal.scope !== null && !unscoped(principal.scope) && (\n <span className=\"role-scope\">{scopeInWords(principal.scope)}</span>\n )}\n </>\n );\n}\n\n/**\n * Change role and Remove, behind one menu, for those who run the instance;\n * Remove, for a service account you manage. Nobody changes their own role\n * but an Owner of the whole instance, who alone changes or removes an\n * Owner: to anyone else, an Owner's row says so instead. Nobody changes or\n * removes an Owner the deployment names: their row says where they are named.\n */\nexport function PrincipalActions({\n principal,\n trigger = 'act act-quiet act-menu',\n}: {\n principal: DirectoryPrincipal;\n /** The menu button's classes: a row action in tables, a button in a page head. */\n trigger?: string;\n}) {\n const [editing, setEditing] = useState(false);\n const [confirming, setConfirming] = useState(false);\n const [role, setRole] = useState<RoleVars>(roleOf(principal));\n const { capabilities, principal: me } = useShell();\n const coffre = useCoffre();\n const saveRole = useChange(changeRole(coffre));\n const remove = useChange(removeMember(coffre));\n const { status } = useChangeStatus(directoryList.queryKey);\n const pending = status(memberOf(principal)).state === 'pending';\n const kind = KIND[principal.principalType];\n\n const self = me?.type === principal.principalType && me.id === principal.principalId;\n const yours = principal.principalType === 'service' && principal.managed === true;\n if (!(capabilities.runsInstance || yours)) return null;\n if (principal.declared === true) {\n return (\n <Toggletip label=\"Owner defined by the deployment configuration.\" align=\"end\">\n <button type=\"button\" className={trigger} aria-label={`Why ${principal.principalId} can't be changed`}>\n <Lock size={14} />\n </button>\n </Toggletip>\n );\n }\n if (principal.instanceRole === 'owner' && !capabilities.ownsInstance) {\n return (\n <Toggletip label=\"Only an Owner of the whole instance changes or removes an Owner.\" align=\"end\">\n <button type=\"button\" className={trigger} aria-label={`Why ${principal.principalId} can't be changed`}>\n <Lock size={14} />\n </button>\n </Toggletip>\n );\n }\n\n return (\n <>\n <Menu.Root>\n <Menu.Trigger\n className={trigger}\n aria-label={`Actions for ${principal.principalId}`}\n disabled={pending}\n >\n {pending ? <Spinner size={13} /> : <MoreHorizontal size={16} />}\n </Menu.Trigger>\n <MenuPopup align=\"end\">\n {principal.principalType === 'user' && (!self || capabilities.ownsInstance) && capabilities.runsInstance && (\n <>\n <Menu.Item\n className=\"menu-item\"\n onClick={() => {\n setRole(roleOf(principal));\n setEditing(true);\n }}\n >\n <Pencil size={14} />\n Change role\n </Menu.Item>\n <Menu.Separator className=\"menu-sep\" />\n </>\n )}\n <Menu.Item\n className=\"menu-item menu-item-danger\"\n onClick={() => setConfirming(true)}\n >\n <X size={14} />\n Remove {kind}…\n </Menu.Item>\n </MenuPopup>\n </Menu.Root>\n\n {principal.principalType === 'user' && (\n <Modal\n open={editing}\n onOpenChange={setEditing}\n title={\n <>\n Role of <span className=\"mono\">{principal.principalId}</span>\n </>\n }\n >\n <form\n className=\"form\"\n onSubmit={(event) => {\n event.preventDefault();\n // Shown in the list at once; the row says if the server refuses.\n saveRole({ principalId: principal.principalId, ...role });\n setEditing(false);\n }}\n >\n <RoleField value={role} onChange={setRole} />\n <div className=\"dialog-actions\">\n <button className=\"btn\" type=\"button\" onClick={() => setEditing(false)}>\n Cancel\n </button>\n <button className=\"btn btn-primary\" type=\"submit\" disabled={!scopeComplete(role)}>\n Save\n </button>\n </div>\n </form>\n </Modal>\n )}\n\n <ConfirmDialog\n open={confirming}\n onOpenChange={setConfirming}\n title={\n <>\n Remove <span className=\"mono\">{principal.principalId}</span>?\n </>\n }\n body={<RemovalPreview principal={principal} open={confirming} />}\n confirmLabel={`Remove ${kind}`}\n onConfirm={() => remove(principal)}\n />\n </>\n );\n}\n\nconst plural = (count: number, one: string) => `${count} ${one}${count === 1 ? '' : 's'}`;\n\n/**\n * What removing someone would do, read when its dialog opens, as `coffre\n * offboard` previews it before `--apply`: every way in it revokes, and what\n * they leave behind to rotate.\n */\nfunction RemovalPreview({ principal, open }: { principal: DirectoryPrincipal; open: boolean }) {\n const { capabilities, features } = useShell();\n const person = principal.principalType === 'user';\n const { data, isPending } = useQuery({\n ...queries.report(useCoffre(), memberOf(principal), capabilities.runsInstance),\n enabled: open,\n });\n const report = data?.ok === true ? data.report : null;\n if (isPending) {\n return (\n <>\n <Spinner size={13} /> Reading what {person ? 'they hold' : 'it holds'}…\n </>\n );\n }\n if (report === null) {\n return person\n ? 'They are signed out everywhere, and their sign-in accounts and project access are revoked at once.'\n : 'Its bearer tokens and trust bindings stop working, and its project access is revoked at once.';\n }\n const { live } = report;\n // Named, as an app's name is what its person knows it by: \"2 connected apps (Claude, Cursor)\".\n const apps = `${plural(live.apps, 'connected app')}${report.apps.length > 0 ? ` (${report.apps.map((app) => app.name).join(', ')})` : ''}`;\n const revokes = person\n ? [\n plural(live.grants, 'grant'),\n plural(live.sessions, 'session'),\n ...(live.tokens > 0 ? [plural(live.tokens, 'personal token')] : []),\n plural(live.identities, 'linked sign-in account'),\n ...(features.mcp ? [apps] : []),\n ]\n : [plural(live.grants, 'grant'), plural(live.tokens, 'bearer token')];\n return (\n <>\n Removing revokes {revokes.join(', ')} at once\n {person ? '' : ', and its trust bindings, including for anything running as it now'}.{' '}\n {report.exposed.length === 0\n ? `No value ${person ? 'they' : 'it'} saw is still current.`\n : `${plural(report.exposed.length, 'value')} ${person ? 'they' : 'it'} saw ${report.exposed.length === 1 ? 'is' : 'are'} still current: ${person ? 'their' : 'its'} page lists them, to rotate.`}\n {report.issuedTokens.length > 0 &&\n ` ${plural(report.issuedTokens.length, 'bearer token')} ${person ? 'they' : 'it'} issued still ${report.issuedTokens.length === 1 ? 'works' : 'work'}.`}{' '}\n {person ? 'Their' : 'Its'} past actions stay in the audit log.\n </>\n );\n}\n\nexport function AddPrincipal({ principalType }: { principalType: PrincipalType }) {\n const [open, setOpen] = useState(false);\n const [principalId, setPrincipalId] = useState('');\n const [role, setRole] = useState<RoleVars>(MEMBER);\n const add = useChange(invite(useCoffre()));\n const kind = KIND[principalType];\n\n function close() {\n setOpen(false);\n setPrincipalId('');\n setRole(MEMBER);\n }\n\n return (\n <>\n <button className=\"btn btn-primary\" onClick={() => setOpen(true)}>\n <Plus size={14} />\n Add {kind}\n </button>\n\n <Modal\n open={open}\n onOpenChange={(next) => (next ? setOpen(true) : close())}\n title={`Add a ${kind}`}\n description={\n principalType === 'user'\n ? undefined\n : 'This gives the service account no project access. Grant it afterwards, from its page or a project\\'s.'\n }\n >\n <form\n className=\"form\"\n onSubmit={(event) => {\n event.preventDefault();\n // Shown in the list at once; the list says if the server refuses.\n add({ principalType, principalId: principalId.trim(), ...role });\n close();\n }}\n >\n <label className=\"field\">\n <span className=\"label\">\n {principalType === 'user' ? 'Email' : 'Service account name'}\n </span>\n <input\n className=\"input input-mono\"\n autoFocus\n spellCheck={false}\n autoComplete=\"off\"\n value={principalId}\n placeholder={\n principalType === 'user' ? 'someone@acme.example' : 'ci-deploy'\n }\n onChange={(event) => setPrincipalId(event.target.value)}\n />\n </label>\n\n {principalType === 'user' && <RoleField value={role} onChange={setRole} />}\n\n <div className=\"dialog-actions\">\n <button className=\"btn\" type=\"button\" onClick={close}>\n Cancel\n </button>\n <button className=\"btn btn-primary\" type=\"submit\" disabled={principalId.trim() === '' || !scopeComplete(role)}>\n Add {kind}\n </button>\n </div>\n </form>\n </Modal>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA6BA,IAAa,YAAY,cACvB,UAAU,UAAU,eAAe,UAAU,WAAW;;AAG1D,IAAM,SAAmB;CAAE,MAAM;CAAU,OAAO;AAAW;;AAG7D,IAAM,UAAU,eAA6C;CAAE,MAAM,UAAU;CAAc,OAAO,UAAU,SAAS;AAAW;;AAGlI,IAAa,OAAsC;CACjD,MAAM;CACN,SAAS;AACX;AAEA,SAAgB,eAAe,EAC7B,eACA,YACA,aAAa,SAMZ;CACD,MAAM,QAAQ,kBAAkB;CAChC,MAAM,UAAU,QAAQ,IAAI;CAC5B,MAAM,EAAE,iBAAiB,SAAS;CAClC,MAAM,EAAE,QAAQ,YAAY,YAAY,gBAAgB,cAAc,QAAQ;CAC9E,MAAM,UAAU,WAAuB,WAAW,IAAI,QAAQ,CAAC,CAAC,CAAC,QAC9D,EAAE,WA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E,WAAU;MACV,WAAA;MACA,YAAY;MACZ,cAAa;MACb,OAAO;MACP,aACE,kBAAkB,SAAS,yBAAyB;MAEtD,WAAW,UAAU,eAAe,MAAM,OAAO,KAAK;KACvD,CAAA,CACI;;IAEN,kBAAkB,UAAU,oBAAC,WAAD;KAAW,OAAO;KAAM,UAAU;IAAU,CAAA;IAEzE,qBAAC,OAAD;KAAK,WAAU;eAAf,CACE,oBAAC,UAAD;MAAQ,WAAU;MAAM,MAAK;MAAS,SAAS;gBAAO;KAE9C,CAAA,GACR,qBAAC,UAAD;MAAQ,WAAU;MAAkB,MAAK;MAAS,UAAU,YAAY,KAAK,MAAM,MAAM,CAAC,cAAc,IAAI;gBAA5G,CAA+G,QACxG,IACC;OACL;;GACD;;CACD,CAAA,CACP,EAAA,CAAA;AAEN"}
@@ -1,4 +1,4 @@
1
- import { n as ConfirmDialog, o as MenuPopup, s as Modal } from "./ui-Br-dNUTc.js";
1
+ import { n as ConfirmDialog, o as MenuPopup, s as Modal } from "./ui-2kwXXfrX.js";
2
2
  import { E as Folder, H as MoreHorizontal, W as Pencil, st as X } from "./page-JTORvh-N.js";
3
3
  import { n as folderProblem } from "./validation-DiHIwZRA.js";
4
4
  import { useEffect, useId, useState } from "react";
@@ -204,4 +204,4 @@ function MoveToFolder({ open, onOpenChange, what, current, folders, onMove }) {
204
204
  //#endregion
205
205
  export { FolderRow as n, MoveToFolder as r, FolderMenu as t };
206
206
 
207
- //# sourceMappingURL=folders-hR2Lnk0k.js.map
207
+ //# sourceMappingURL=folders-Dw240WMJ.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"folders-hR2Lnk0k.js","names":[],"sources":["../../src/components/folders.tsx"],"sourcesContent":["import { useEffect, useId, useState, type ReactNode } from 'react';\nimport { Menu } from '@base-ui/react/menu';\n\nimport { folderProblem } from '../lib/validation';\nimport { Folder, MoreHorizontal, Pencil, X } from './icons';\nimport { ConfirmDialog, MenuPopup, Modal } from './ui';\n\n/**\n * A folder's heading row inside a table: the rows after it, up to the next\n * heading, are filed in it. Folders only arrange a list\n * (docs/design/environments.md).\n */\nexport function FolderRow({ folder, count, columns, actions }: { folder: string; count: number; columns: number; actions?: ReactNode }) {\n return (\n <tr className=\"folder-row\">\n <th colSpan={columns} scope=\"rowgroup\">\n <span className=\"folder-row-head\">\n <span className=\"th\">\n <Folder size={14} />\n {folder}\n <span className=\"count\">{count}</span>\n </span>\n {actions}\n </span>\n </th>\n </tr>\n );\n}\n\n/**\n * A folder heading's menu: rename it, which re-files everything in it, or\n * remove it, which takes everything out. A folder is only a label, so what\n * was in it stays where it is, and a rename onto a folder in use merges the\n * two.\n */\nexport function FolderMenu({\n folder,\n count,\n what,\n folders,\n onRename,\n onRemove,\n}: {\n folder: string;\n count: number;\n /** What it holds, as a sentence counts them: `project`, `key`. */\n what: string;\n /** The other folders in use beside it, offered as you type. */\n folders: readonly string[];\n onRename: (name: string) => void;\n onRemove: () => void;\n}) {\n const [renaming, setRenaming] = useState(false);\n const [removing, setRemoving] = useState(false);\n const [name, setName] = useState(folder);\n const listId = useId();\n useEffect(() => {\n if (renaming) setName(folder);\n }, [renaming, folder]);\n const problem = folderProblem(name);\n const merges = name !== folder && folders.includes(name);\n const items = `${count} ${what}${count === 1 ? '' : 's'}`;\n\n return (\n <>\n <Menu.Root>\n <Menu.Trigger className=\"act act-icon act-quiet folder-row-menu\" aria-label={`Actions for the folder ${folder}`}>\n <MoreHorizontal size={16} />\n </Menu.Trigger>\n <MenuPopup align=\"end\">\n <Menu.Item className=\"menu-item\" onClick={() => setRenaming(true)}>\n <Pencil size={14} />\n Rename folder…\n </Menu.Item>\n <Menu.Item className=\"menu-item menu-item-danger\" onClick={() => setRemoving(true)}>\n <X size={14} />\n Remove folder…\n </Menu.Item>\n </MenuPopup>\n </Menu.Root>\n\n <Modal\n open={renaming}\n onOpenChange={setRenaming}\n title={`Rename ${folder}`}\n description={`Its ${items} move with it. Nothing else changes.`}\n >\n <form\n className=\"form\"\n onSubmit={(event) => {\n event.preventDefault();\n if (problem !== null || name === '' || name === folder) return;\n onRename(name);\n setRenaming(false);\n }}\n >\n <label className=\"field\">\n <span className=\"label\">Name</span>\n <input\n className=\"input\"\n autoFocus\n spellCheck={false}\n autoComplete=\"off\"\n list={listId}\n value={name}\n aria-invalid={problem !== null}\n onChange={(event) => setName(event.target.value)}\n />\n <datalist id={listId}>\n {folders.filter((each) => each !== folder).map((each) => (\n <option key={each} value={each} />\n ))}\n </datalist>\n <span className={`hint${problem !== null ? ' edit-note-error' : ''}`}>\n {problem ?? (merges ? `${name} is in use: the two become one folder.` : 'One level: no slash.')}\n </span>\n </label>\n <div className=\"dialog-actions\">\n <button className=\"btn\" type=\"button\" onClick={() => setRenaming(false)}>\n Cancel\n </button>\n <button className=\"btn btn-primary\" type=\"submit\" disabled={problem !== null || name === '' || name === folder}>\n {merges ? 'Merge' : 'Rename'}\n </button>\n </div>\n </form>\n </Modal>\n\n <ConfirmDialog\n open={removing}\n onOpenChange={setRemoving}\n title={`Remove the folder ${folder}?`}\n body={`Its ${items} stay where they are, in no folder. Nothing else changes.`}\n confirmLabel=\"Remove folder\"\n onConfirm={onRemove}\n />\n </>\n );\n}\n\n/**\n * Where to file something: a folder by name, one already in use or a new\n * one, or none. Asked in a dialog, since it is one field and one decision.\n */\nexport function MoveToFolder({\n open,\n onOpenChange,\n what,\n current,\n folders,\n onMove,\n}: {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** What moves, as the title names it: \"STRIPE_KEY\". */\n what: string;\n current: string | null;\n /** The folders in use beside it, offered as you type. */\n folders: readonly string[];\n onMove: (folder: string | null) => void;\n}) {\n const [name, setName] = useState(current ?? '');\n const listId = useId();\n useEffect(() => {\n if (open) setName(current ?? '');\n }, [open, current]);\n const problem = folderProblem(name);\n const folder = name === '' ? null : name;\n\n return (\n <Modal\n open={open}\n onOpenChange={onOpenChange}\n title={`Move ${what} to a folder`}\n description=\"Folders only arrange the list: names, values and access stay as they are.\"\n >\n <form\n className=\"form\"\n onSubmit={(event) => {\n event.preventDefault();\n if (problem !== null) return;\n if (folder !== current) onMove(folder);\n onOpenChange(false);\n }}\n >\n <label className=\"field\">\n <span className=\"label\">Folder</span>\n <input\n className=\"input\"\n autoFocus\n spellCheck={false}\n autoComplete=\"off\"\n list={listId}\n placeholder=\"No folder\"\n value={name}\n aria-invalid={problem !== null}\n onChange={(event) => setName(event.target.value)}\n />\n <datalist id={listId}>\n {folders.map((each) => (\n <option key={each} value={each} />\n ))}\n </datalist>\n <span className={`hint${problem !== null ? ' edit-note-error' : ''}`}>\n {problem ?? 'Pick one in use, or name a new one. Empty for no folder.'}\n </span>\n </label>\n <div className=\"dialog-actions\">\n <button className=\"btn\" type=\"button\" onClick={() => onOpenChange(false)}>\n Cancel\n </button>\n <button className=\"btn btn-primary\" type=\"submit\" disabled={problem !== null || folder === current}>\n {folder === null && current !== null ? 'Take out of its folder' : 'Move'}\n </button>\n </div>\n </form>\n </Modal>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAYA,SAAgB,UAAU,EAAE,QAAQ,OAAO,SAAS,WAAoF;CACtI,OACE,oBAAC,MAAD;EAAI,WAAU;YACZ,oBAAC,MAAD;GAAI,SAAS;GAAS,OAAM;aAC1B,qBAAC,QAAD;IAAM,WAAU;cAAhB,CACE,qBAAC,QAAD;KAAM,WAAU;eAAhB;MACE,oBAAC,QAAD,EAAQ,MAAM,GAAK,CAAA;MAClB;MACD,oBAAC,QAAD;OAAM,WAAU;iBAAS;MAAY,CAAA;KACjC;QACL,OACG;;EACJ,CAAA;CACF,CAAA;AAER;;;;;;;AAQA,SAAgB,WAAW,EACzB,QACA,OACA,MACA,SACA,UACA,YAUC;CACD,MAAM,CAAC,UAAU,eAAe,SAAS,KAAK;CAC9C,MAAM,CAAC,UAAU,eAAe,SAAS,KAAK;CAC9C,MAAM,CAAC,MAAM,WAAW,SAAS,MAAM;CACvC,MAAM,SAAS,MAAM;CACrB,gBAAgB;EACd,IAAI,UAAU,QAAQ,MAAM;CAC9B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;MACE,WAAU;MACV,WAAA;MACA,YAAY;MACZ,cAAa;MACb,MAAM;MACN,aAAY;MACZ,OAAO;MACP,gBAAc,YAAY;MAC1B,WAAW,UAAU,QAAQ,MAAM,OAAO,KAAK;KAChD,CAAA;KACD,oBAAC,YAAD;MAAU,IAAI;gBACX,QAAQ,KAAK,SACZ,oBAAC,UAAD,EAAmB,OAAO,KAAO,GAApB,IAAoB,CAClC;KACO,CAAA;KACV,oBAAC,QAAD;MAAM,WAAW,OAAO,YAAY,OAAO,qBAAqB;gBAC7D,WAAW;KACR,CAAA;IACD;OACP,qBAAC,OAAD;IAAK,WAAU;cAAf,CACE,oBAAC,UAAD;KAAQ,WAAU;KAAM,MAAK;KAAS,eAAe,aAAa,KAAK;eAAG;IAElE,CAAA,GACR,oBAAC,UAAD;KAAQ,WAAU;KAAkB,MAAK;KAAS,UAAU,YAAY,QAAQ,WAAW;eACxF,WAAW,QAAQ,YAAY,OAAO,2BAA2B;IAC5D,CAAA,CACL;KACD;;CACD,CAAA;AAEX"}
1
+ {"version":3,"file":"folders-Dw240WMJ.js","names":[],"sources":["../../src/components/folders.tsx"],"sourcesContent":["import { useEffect, useId, useState, type ReactNode } from 'react';\nimport { Menu } from '@base-ui/react/menu';\n\nimport { folderProblem } from '../lib/validation';\nimport { Folder, MoreHorizontal, Pencil, X } from './icons';\nimport { ConfirmDialog, MenuPopup, Modal } from './ui';\n\n/**\n * A folder's heading row inside a table: the rows after it, up to the next\n * heading, are filed in it. Folders only arrange a list\n * (docs/design/environments.md).\n */\nexport function FolderRow({ folder, count, columns, actions }: { folder: string; count: number; columns: number; actions?: ReactNode }) {\n return (\n <tr className=\"folder-row\">\n <th colSpan={columns} scope=\"rowgroup\">\n <span className=\"folder-row-head\">\n <span className=\"th\">\n <Folder size={14} />\n {folder}\n <span className=\"count\">{count}</span>\n </span>\n {actions}\n </span>\n </th>\n </tr>\n );\n}\n\n/**\n * A folder heading's menu: rename it, which re-files everything in it, or\n * remove it, which takes everything out. A folder is only a label, so what\n * was in it stays where it is, and a rename onto a folder in use merges the\n * two.\n */\nexport function FolderMenu({\n folder,\n count,\n what,\n folders,\n onRename,\n onRemove,\n}: {\n folder: string;\n count: number;\n /** What it holds, as a sentence counts them: `project`, `key`. */\n what: string;\n /** The other folders in use beside it, offered as you type. */\n folders: readonly string[];\n onRename: (name: string) => void;\n onRemove: () => void;\n}) {\n const [renaming, setRenaming] = useState(false);\n const [removing, setRemoving] = useState(false);\n const [name, setName] = useState(folder);\n const listId = useId();\n useEffect(() => {\n if (renaming) setName(folder);\n }, [renaming, folder]);\n const problem = folderProblem(name);\n const merges = name !== folder && folders.includes(name);\n const items = `${count} ${what}${count === 1 ? '' : 's'}`;\n\n return (\n <>\n <Menu.Root>\n <Menu.Trigger className=\"act act-icon act-quiet folder-row-menu\" aria-label={`Actions for the folder ${folder}`}>\n <MoreHorizontal size={16} />\n </Menu.Trigger>\n <MenuPopup align=\"end\">\n <Menu.Item className=\"menu-item\" onClick={() => setRenaming(true)}>\n <Pencil size={14} />\n Rename folder…\n </Menu.Item>\n <Menu.Item className=\"menu-item menu-item-danger\" onClick={() => setRemoving(true)}>\n <X size={14} />\n Remove folder…\n </Menu.Item>\n </MenuPopup>\n </Menu.Root>\n\n <Modal\n open={renaming}\n onOpenChange={setRenaming}\n title={`Rename ${folder}`}\n description={`Its ${items} move with it. Nothing else changes.`}\n >\n <form\n className=\"form\"\n onSubmit={(event) => {\n event.preventDefault();\n if (problem !== null || name === '' || name === folder) return;\n onRename(name);\n setRenaming(false);\n }}\n >\n <label className=\"field\">\n <span className=\"label\">Name</span>\n <input\n className=\"input\"\n autoFocus\n spellCheck={false}\n autoComplete=\"off\"\n list={listId}\n value={name}\n aria-invalid={problem !== null}\n onChange={(event) => setName(event.target.value)}\n />\n <datalist id={listId}>\n {folders.filter((each) => each !== folder).map((each) => (\n <option key={each} value={each} />\n ))}\n </datalist>\n <span className={`hint${problem !== null ? ' edit-note-error' : ''}`}>\n {problem ?? (merges ? `${name} is in use: the two become one folder.` : 'One level: no slash.')}\n </span>\n </label>\n <div className=\"dialog-actions\">\n <button className=\"btn\" type=\"button\" onClick={() => setRenaming(false)}>\n Cancel\n </button>\n <button className=\"btn btn-primary\" type=\"submit\" disabled={problem !== null || name === '' || name === folder}>\n {merges ? 'Merge' : 'Rename'}\n </button>\n </div>\n </form>\n </Modal>\n\n <ConfirmDialog\n open={removing}\n onOpenChange={setRemoving}\n title={`Remove the folder ${folder}?`}\n body={`Its ${items} stay where they are, in no folder. Nothing else changes.`}\n confirmLabel=\"Remove folder\"\n onConfirm={onRemove}\n />\n </>\n );\n}\n\n/**\n * Where to file something: a folder by name, one already in use or a new\n * one, or none. Asked in a dialog, since it is one field and one decision.\n */\nexport function MoveToFolder({\n open,\n onOpenChange,\n what,\n current,\n folders,\n onMove,\n}: {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** What moves, as the title names it: \"STRIPE_KEY\". */\n what: string;\n current: string | null;\n /** The folders in use beside it, offered as you type. */\n folders: readonly string[];\n onMove: (folder: string | null) => void;\n}) {\n const [name, setName] = useState(current ?? '');\n const listId = useId();\n useEffect(() => {\n if (open) setName(current ?? '');\n }, [open, current]);\n const problem = folderProblem(name);\n const folder = name === '' ? null : name;\n\n return (\n <Modal\n open={open}\n onOpenChange={onOpenChange}\n title={`Move ${what} to a folder`}\n description=\"Folders only arrange the list: names, values and access stay as they are.\"\n >\n <form\n className=\"form\"\n onSubmit={(event) => {\n event.preventDefault();\n if (problem !== null) return;\n if (folder !== current) onMove(folder);\n onOpenChange(false);\n }}\n >\n <label className=\"field\">\n <span className=\"label\">Folder</span>\n <input\n className=\"input\"\n autoFocus\n spellCheck={false}\n autoComplete=\"off\"\n list={listId}\n placeholder=\"No folder\"\n value={name}\n aria-invalid={problem !== null}\n onChange={(event) => setName(event.target.value)}\n />\n <datalist id={listId}>\n {folders.map((each) => (\n <option key={each} value={each} />\n ))}\n </datalist>\n <span className={`hint${problem !== null ? ' edit-note-error' : ''}`}>\n {problem ?? 'Pick one in use, or name a new one. Empty for no folder.'}\n </span>\n </label>\n <div className=\"dialog-actions\">\n <button className=\"btn\" type=\"button\" onClick={() => onOpenChange(false)}>\n Cancel\n </button>\n <button className=\"btn btn-primary\" type=\"submit\" disabled={problem !== null || folder === current}>\n {folder === null && current !== null ? 'Take out of its folder' : 'Move'}\n </button>\n </div>\n </form>\n </Modal>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAYA,SAAgB,UAAU,EAAE,QAAQ,OAAO,SAAS,WAAoF;CACtI,OACE,oBAAC,MAAD;EAAI,WAAU;YACZ,oBAAC,MAAD;GAAI,SAAS;GAAS,OAAM;aAC1B,qBAAC,QAAD;IAAM,WAAU;cAAhB,CACE,qBAAC,QAAD;KAAM,WAAU;eAAhB;MACE,oBAAC,QAAD,EAAQ,MAAM,GAAK,CAAA;MAClB;MACD,oBAAC,QAAD;OAAM,WAAU;iBAAS;MAAY,CAAA;KACjC;QACL,OACG;;EACJ,CAAA;CACF,CAAA;AAER;;;;;;;AAQA,SAAgB,WAAW,EACzB,QACA,OACA,MACA,SACA,UACA,YAUC;CACD,MAAM,CAAC,UAAU,eAAe,SAAS,KAAK;CAC9C,MAAM,CAAC,UAAU,eAAe,SAAS,KAAK;CAC9C,MAAM,CAAC,MAAM,WAAW,SAAS,MAAM;CACvC,MAAM,SAAS,MAAM;CACrB,gBAAgB;EACd,IAAI,UAAU,QAAQ,MAAM;CAC9B,GAAG,CAAC,UAAU,MAAM,CAAC;CACrB,MAAM,UAAU,cAAc,IAAI;CAClC,MAAM,SAAS,SAAS,UAAU,QAAQ,SAAS,IAAI;CACvD,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,UAAU,IAAI,KAAK;CAEpD,OACE,qBAAA,YAAA,EAAA,UAAA;EACE,qBAAC,KAAK,MAAN,EAAA,UAAA,CACE,oBAAC,KAAK,SAAN;GAAc,WAAU;GAAyC,cAAY,0BAA0B;aACrG,oBAAC,gBAAD,EAAgB,MAAM,GAAK,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KACR,CAAA;IACD;OACP,qBAAC,OAAD;IAAK,WAAU;cAAf,CACE,oBAAC,UAAD;KAAQ,WAAU;KAAM,MAAK;KAAS,eAAe,aAAa,KAAK;eAAG;IAElE,CAAA,GACR,oBAAC,UAAD;KAAQ,WAAU;KAAkB,MAAK;KAAS,UAAU,YAAY,QAAQ,WAAW;eACxF,WAAW,QAAQ,YAAY,OAAO,2BAA2B;IAC5D,CAAA,CACL;KACD;;CACD,CAAA;AAEX"}
@@ -1,8 +1,8 @@
1
- import { t as ConfirmButton } from "./ui-Br-dNUTc.js";
1
+ import { i as keys } from "./queries-epz4MIuW.js";
2
+ import { t as ConfirmButton } from "./ui-2kwXXfrX.js";
2
3
  import { S as Clock, X as ShieldCheck, u as useCoffre } from "./page-JTORvh-N.js";
3
- import { a as rowClass, i as RowPending, r as RowFailure } from "./row-state-Zf3kZVhd.js";
4
- import { i as keys } from "./queries-DgQo3mC-.js";
5
- import { M as projectAccessLabel, h as grantId, n as useChangeStatus, t as useChange, w as revokeGrant } from "./use-change-By4cG8bT.js";
4
+ import { a as rowClass, i as RowPending, r as RowFailure } from "./row-state-BsIHspy4.js";
5
+ import { U as projectAccessLabel, j as revokeGrant, n as useChangeStatus, t as useChange, y as grantId } from "./use-change-CQyDpCqw.js";
6
6
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
7
  //#region src/components/grants.tsx
8
8
  /**
@@ -161,4 +161,4 @@ function useRefusedGrants(project, grants, principalType) {
161
161
  //#endregion
162
162
  export { useRefusedGrants as i, GrantsTable as n, RefusedGrants as r, GrantRowView as t };
163
163
 
164
- //# sourceMappingURL=grants-DDBui9YD.js.map
164
+ //# sourceMappingURL=grants-CJIBrkod.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"grants-DDBui9YD.js","names":[],"sources":["../../src/components/grants.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { grantId, revokeGrant, type GrantVars } from '../lib/changes';\nimport type { FailedAdd } from '../lib/optimistic';\nimport { useCoffre } from '../lib/coffre';\nimport { projectAccessLabel } from '../lib/project-access';\nimport { keys } from '../lib/queries';\nimport { useChange, useChangeStatus } from '../lib/use-change';\nimport type { GrantRow } from '../shared/models';\nimport { RowFailure, RowPending, rowClass } from './row-state';\nimport { ConfirmButton } from './ui';\nimport { Clock, ShieldCheck } from './icons';\n\n/**\n * Grants as a table: who or where in the first column, then the access, when\n * it lapses, and a revoke.\n *\n * A project's page leads each row with the principal; a user's page leads with\n * the project. Everything after the first column is the same grant either way.\n */\nexport function GrantsTable({ lead, children }: { lead: ReactNode; children: ReactNode }) {\n return (\n <div className=\"dt-wrap\">\n <table className=\"dt grants stacks\">\n <thead>\n <tr>\n <th className=\"n\">#</th>\n <th className=\"col-principal\">{lead}</th>\n <th>\n <span className=\"th\">\n <ShieldCheck size={14} />\n Permissions\n </span>\n </th>\n <th className=\"col-expires\">\n <span className=\"th\">\n <Clock size={14} />\n Expires\n </span>\n </th>\n <th className=\"col-actions\">\n <span className=\"visually-hidden\">Actions</span>\n </th>\n </tr>\n </thead>\n <tbody>{children}</tbody>\n </table>\n </div>\n );\n}\n\nexport function GrantRowView({\n number,\n project,\n grant,\n lead,\n leadLabel,\n}: {\n number: number;\n project: string;\n grant: GrantRow;\n lead: ReactNode;\n leadLabel: string;\n}) {\n const revoke = useChange(revokeGrant(useCoffre(), project));\n const { status, dismiss } = useChangeStatus(keys.grants(project));\n const state = status(grantId(grant));\n // Someone's instance role reaching the project is shown here, and changed on their page in Users.\n const byRole = grant.scope === 'instance-role';\n const label = byRole ? grant.roleName : projectAccessLabel(grant);\n const expired = grant.expiresAt !== null && new Date(grant.expiresAt).getTime() < Date.now();\n\n return (\n <>\n <tr className={rowClass(state)}>\n <td className=\"n\">{number}</td>\n <td className=\"col-lead\" data-label={leadLabel}>\n {lead}\n </td>\n <td className=\"col-access\" data-label=\"Permissions\">\n <span className={`tag${grant.role === 'owner' ? ' tag-violet' : ''}`}>{label}</span>\n {byRole && (\n <span className=\"role-scope\" title=\"Their instance role reaches this project. Change it on their page in Users.\">\n instance role\n </span>\n )}\n </td>\n <td\n className={`col-expires cell-mono cell-muted${grant.expiresAt === null ? ' is-never' : ''}`}\n data-label=\"Expires\"\n >\n {grant.expiresAt === null ? (\n 'Never'\n ) : (\n <>\n <span className=\"narrow-only\">Expires </span>\n {grant.expiresAt.slice(0, 10)}\n {expired && (\n <>\n {' '}\n <span className=\"tag tag-red\">Expired</span>\n </>\n )}\n </>\n )}\n </td>\n <td className=\"col-actions\">\n {state.state === 'pending' ? (\n <RowPending status={state} />\n ) : byRole ? null : (\n <ConfirmButton\n trigger={<button className=\"act act-danger\">Revoke</button>}\n title={\n <>\n Revoke {label} from <span className=\"mono\">{grant.principalId}</span>?\n </>\n }\n body={\n <>\n They lose <strong>{label}</strong> on <span className=\"mono\">{project}</span>{' '}\n immediately, including any process using it right now. Other grants they hold\n still apply.\n </>\n }\n confirmLabel=\"Revoke access\"\n onConfirm={() => revoke(grant)}\n />\n )}\n </td>\n </tr>\n <RowFailure\n status={state}\n columns={5}\n onDismiss={() => state.state === 'failed' && dismiss(state.mutationId)}\n />\n </>\n );\n}\n\n/**\n * Grants the server refused to give: rolled back, so no row of theirs is\n * left, and listed here, after the table's rows, saying why.\n */\nexport function RefusedGrants({ refused }: { refused: RefusedGrant[] }) {\n return refused.map(({ mutationId, vars, status, dismiss }) => (\n <RowFailure key={mutationId} status={status} columns={5} onDismiss={dismiss}>\n {vars.principalId} was not given {vars.roleName.toLowerCase()}.\n </RowFailure>\n ));\n}\n\ntype RefusedGrant = FailedAdd<GrantVars> & { dismiss: () => void };\n\n/** The grants of one kind the server refused to give in a project, still to be said. */\nexport function useRefusedGrants(project: string, grants: GrantRow[], principalType?: GrantRow['principalType']): RefusedGrant[] {\n const { failedAdds, dismiss } = useChangeStatus(keys.grants(project));\n return failedAdds<GrantVars>(grants.map(grantId))\n .filter(({ vars }) => principalType === undefined || vars.principalType === principalType)\n .map((refused) => ({ ...refused, dismiss: () => dismiss(refused.mut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ED,CAAA;EACF;KACJ,oBAAC,YAAD;EACE,QAAQ;EACR,SAAS;EACT,iBAAiB,MAAM,UAAU,YAAY,QAAQ,MAAM,UAAU;CACtE,CAAA,CACD,EAAA,CAAA;AAEN;;;;;AAMA,SAAgB,cAAc,EAAE,WAAwC;CACtE,OAAO,QAAQ,KAAK,EAAE,YAAY,MAAM,QAAQ,cAC9C,qBAAC,YAAD;EAAqC;EAAQ,SAAS;EAAG,WAAW;YAApE;GACG,KAAK;GAAY;GAAgB,KAAK,SAAS,YAAY;GAAE;EACpD;IAFK,UAEL,CACb;AACH;;AAKA,SAAgB,iBAAiB,SAAiB,QAAoB,eAA2D;CAC/H,MAAM,EAAE,YAAY,YAAY,gBAAgB,KAAK,OAAO,OAAO,CAAC;CACpE,OAAO,WAAsB,OAAO,IAAI,OAAO,CAAC,CAAC,CAC9C,QAAQ,EAAE,WAAW,kBAAkB,KAAA,KAAa,KAAK,kBAAkB,aAAa,CAAC,CACzF,KAAK,aAAa;EAAE,GAAG;EAAS,eAAe,QAAQ,QAAQ,UAAU;CAAE,EAAE;AAClF"}
1
+ {"version":3,"file":"grants-CJIBrkod.js","names":[],"sources":["../../src/components/grants.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { grantId, revokeGrant, type GrantVars } from '../lib/changes';\nimport type { FailedAdd } from '../lib/optimistic';\nimport { useCoffre } from '../lib/coffre';\nimport { projectAccessLabel } from '../lib/project-access';\nimport { keys } from '../lib/queries';\nimport { useChange, useChangeStatus } from '../lib/use-change';\nimport type { GrantRow } from '../shared/models';\nimport { RowFailure, RowPending, rowClass } from './row-state';\nimport { ConfirmButton } from './ui';\nimport { Clock, ShieldCheck } from './icons';\n\n/**\n * Grants as a table: who or where in the first column, then the access, when\n * it lapses, and a revoke.\n *\n * A project's page leads each row with the principal; a user's page leads with\n * the project. Everything after the first column is the same grant either way.\n */\nexport function GrantsTable({ lead, children }: { lead: ReactNode; children: ReactNode }) {\n return (\n <div className=\"dt-wrap\">\n <table className=\"dt grants stacks\">\n <thead>\n <tr>\n <th className=\"n\">#</th>\n <th className=\"col-principal\">{lead}</th>\n <th>\n <span className=\"th\">\n <ShieldCheck size={14} />\n Permissions\n </span>\n </th>\n <th className=\"col-expires\">\n <span className=\"th\">\n <Clock size={14} />\n Expires\n </span>\n </th>\n <th className=\"col-actions\">\n <span className=\"visually-hidden\">Actions</span>\n </th>\n </tr>\n </thead>\n <tbody>{children}</tbody>\n </table>\n </div>\n );\n}\n\nexport function GrantRowView({\n number,\n project,\n grant,\n lead,\n leadLabel,\n}: {\n number: number;\n project: string;\n grant: GrantRow;\n lead: ReactNode;\n leadLabel: string;\n}) {\n const revoke = useChange(revokeGrant(useCoffre(), project));\n const { status, dismiss } = useChangeStatus(keys.grants(project));\n const state = status(grantId(grant));\n // Someone's instance role reaching the project is shown here, and changed on their page in Users.\n const byRole = grant.scope === 'instance-role';\n const label = byRole ? grant.roleName : projectAccessLabel(grant);\n const expired = grant.expiresAt !== null && new Date(grant.expiresAt).getTime() < Date.now();\n\n return (\n <>\n <tr className={rowClass(state)}>\n <td className=\"n\">{number}</td>\n <td className=\"col-lead\" data-label={leadLabel}>\n {lead}\n </td>\n <td className=\"col-access\" data-label=\"Permissions\">\n <span className={`tag${grant.role === 'owner' ? ' tag-violet' : ''}`}>{label}</span>\n {byRole && (\n <span className=\"role-scope\" title=\"Their instance role reaches this project. Change it on their page in Users.\">\n instance role\n </span>\n )}\n </td>\n <td\n className={`col-expires cell-mono cell-muted${grant.expiresAt === null ? ' is-never' : ''}`}\n data-label=\"Expires\"\n >\n {grant.expiresAt === null ? (\n 'Never'\n ) : (\n <>\n <span className=\"narrow-only\">Expires </span>\n {grant.expiresAt.slice(0, 10)}\n {expired && (\n <>\n {' '}\n <span className=\"tag tag-red\">Expired</span>\n </>\n )}\n </>\n )}\n </td>\n <td className=\"col-actions\">\n {state.state === 'pending' ? (\n <RowPending status={state} />\n ) : byRole ? null : (\n <ConfirmButton\n trigger={<button className=\"act act-danger\">Revoke</button>}\n title={\n <>\n Revoke {label} from <span className=\"mono\">{grant.principalId}</span>?\n </>\n }\n body={\n <>\n They lose <strong>{label}</strong> on <span className=\"mono\">{project}</span>{' '}\n immediately, including any process using it right now. Other grants they hold\n still apply.\n </>\n }\n confirmLabel=\"Revoke access\"\n onConfirm={() => revoke(grant)}\n />\n )}\n </td>\n </tr>\n <RowFailure\n status={state}\n columns={5}\n onDismiss={() => state.state === 'failed' && dismiss(state.mutationId)}\n />\n </>\n );\n}\n\n/**\n * Grants the server refused to give: rolled back, so no row of theirs is\n * left, and listed here, after the table's rows, saying why.\n */\nexport function RefusedGrants({ refused }: { refused: RefusedGrant[] }) {\n return refused.map(({ mutationId, vars, status, dismiss }) => (\n <RowFailure key={mutationId} status={status} columns={5} onDismiss={dismiss}>\n {vars.principalId} was not given {vars.roleName.toLowerCase()}.\n </RowFailure>\n ));\n}\n\ntype RefusedGrant = FailedAdd<GrantVars> & { dismiss: () => void };\n\n/** The grants of one kind the server refused to give in a project, still to be said. */\nexport function useRefusedGrants(project: string, grants: GrantRow[], principalType?: GrantRow['principalType']): RefusedGrant[] {\n const { failedAdds, dismiss } = useChangeStatus(keys.grants(project));\n return failedAdds<GrantVars>(grants.map(grantId))\n .filter(({ vars }) => principalType === undefined || vars.principalType === principalType)\n .map((refused) => ({ ...refused, dismiss: () => dismiss(refused.mutationId) }));\n}\n"],"mappings":";;;;;;;;;;;;;;AAmBA,SAAgB,YAAY,EAAE,MAAM,YAAsD;CACxF,OACE,oBAAC,OAAD;EAAK,WAAU;YACb,qBAAC,SAAD;GAAO,WAAU;aAAjB,CACE,oBAAC,SAAD,EAAA,UACE,qBAAC,MAAD,EAAA,UAAA;IACE,oBAAC,MAAD;KAAI,WAAU;eAAI;IAAK,CAAA;IACvB,oBAAC,MAAD;KAAI,WAAU;eAAiB;IAAS,CAAA;IACxC,oBAAC,MAAD,EAAA,UACE,qBAAC,QAAD;KAAM,WAAU;eAAhB,CACE,oBAAC,aAAD,EAAa,MA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,QAAoB,eAA2D;CAC/H,MAAM,EAAE,YAAY,YAAY,gBAAgB,KAAK,OAAO,OAAO,CAAC;CACpE,OAAO,WAAsB,OAAO,IAAI,OAAO,CAAC,CAAC,CAC9C,QAAQ,EAAE,WAAW,kBAAkB,KAAA,KAAa,KAAK,kBAAkB,aAAa,CAAC,CACzF,KAAK,aAAa;EAAE,GAAG;EAAS,eAAe,QAAQ,QAAQ,UAAU;CAAE,EAAE;AAClF"}
@@ -0,0 +1,99 @@
1
+ import { x as usePreferences } from "./ui-2kwXXfrX.js";
2
+ import { _ as Check, st as X } from "./page-JTORvh-N.js";
3
+ import { useId } from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { Combobox } from "@base-ui/react/combobox";
6
+ //#region src/components/multi-combobox.tsx
7
+ /**
8
+ * Several of a fixed list, chosen by typing: each chosen one a chip in the
9
+ * field, the rest offered below as the text filters them. Base UI's
10
+ * combobox does the keyboard and ARIA: arrows move through the options,
11
+ * Enter takes one, Backspace in an empty field removes the last chip, and
12
+ * Left Arrow from the start of the field walks the chips.
13
+ *
14
+ * The value keeps the options' order, whatever order they were chosen in.
15
+ */
16
+ function MultiCombobox({ label, options, value, onChange, placeholder, hint, note, mono = false }) {
17
+ const { portal } = usePreferences();
18
+ const id = useId();
19
+ const labelId = useId();
20
+ const hintId = useId();
21
+ return /* @__PURE__ */ jsxs(Combobox.Root, {
22
+ items: options,
23
+ multiple: true,
24
+ value,
25
+ onValueChange: (next) => onChange(options.filter((option) => next.includes(option))),
26
+ children: [/* @__PURE__ */ jsxs("div", {
27
+ className: "field",
28
+ children: [
29
+ /* @__PURE__ */ jsx("label", {
30
+ className: "label",
31
+ htmlFor: id,
32
+ id: labelId,
33
+ children: label
34
+ }),
35
+ /* @__PURE__ */ jsx(Combobox.InputGroup, {
36
+ className: `combo${mono ? " combo-mono" : ""}`,
37
+ children: /* @__PURE__ */ jsxs(Combobox.Chips, {
38
+ className: "combo-chips",
39
+ "aria-label": value.length > 0 ? "Chosen" : void 0,
40
+ children: [value.map((option) => /* @__PURE__ */ jsxs(Combobox.Chip, {
41
+ className: "combo-chip",
42
+ "aria-label": option,
43
+ "aria-description": "Press Backspace or Delete to remove",
44
+ children: [option, /* @__PURE__ */ jsx(Combobox.ChipRemove, {
45
+ className: "combo-chip-remove",
46
+ "aria-label": `Remove ${option}`,
47
+ children: /* @__PURE__ */ jsx(X, { size: 12 })
48
+ })]
49
+ }, option)), /* @__PURE__ */ jsx(Combobox.Input, {
50
+ id,
51
+ "aria-labelledby": labelId,
52
+ className: "combo-input",
53
+ placeholder: value.length > 0 ? void 0 : placeholder,
54
+ "aria-describedby": hint === void 0 ? void 0 : hintId,
55
+ "aria-description": value.length > 0 ? `${value.length} chosen. From the start of the field, press Left Arrow to reach them` : void 0
56
+ })]
57
+ })
58
+ }),
59
+ hint !== void 0 && /* @__PURE__ */ jsx("span", {
60
+ className: "hint",
61
+ id: hintId,
62
+ children: hint
63
+ })
64
+ ]
65
+ }), /* @__PURE__ */ jsx(Combobox.Portal, {
66
+ container: portal,
67
+ children: /* @__PURE__ */ jsx(Combobox.Positioner, {
68
+ className: "menu-positioner",
69
+ sideOffset: 4,
70
+ align: "start",
71
+ children: /* @__PURE__ */ jsxs(Combobox.Popup, {
72
+ className: "menu combo-popup",
73
+ children: [/* @__PURE__ */ jsx(Combobox.Empty, {
74
+ className: "combo-empty",
75
+ children: "Nothing matches."
76
+ }), /* @__PURE__ */ jsx(Combobox.List, { children: (option) => /* @__PURE__ */ jsxs(Combobox.Item, {
77
+ value: option,
78
+ className: `menu-item${mono ? " mono" : ""}`,
79
+ children: [
80
+ /* @__PURE__ */ jsx("span", {
81
+ className: "combo-check",
82
+ children: /* @__PURE__ */ jsx(Combobox.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { size: 14 }) })
83
+ }),
84
+ /* @__PURE__ */ jsx("span", {
85
+ className: "combo-option",
86
+ children: option
87
+ }),
88
+ note?.(option)
89
+ ]
90
+ }, option) })]
91
+ })
92
+ })
93
+ })]
94
+ });
95
+ }
96
+ //#endregion
97
+ export { MultiCombobox as t };
98
+
99
+ //# sourceMappingURL=multi-combobox-CsIXihuc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multi-combobox-CsIXihuc.js","names":[],"sources":["../../src/components/multi-combobox.tsx"],"sourcesContent":["import { Combobox } from '@base-ui/react/combobox';\nimport { useId, type ReactNode } from 'react';\nimport { usePreferences } from '../lib/preferences';\nimport { Check, X } from './icons';\n\n/**\n * Several of a fixed list, chosen by typing: each chosen one a chip in the\n * field, the rest offered below as the text filters them. Base UI's\n * combobox does the keyboard and ARIA: arrows move through the options,\n * Enter takes one, Backspace in an empty field removes the last chip, and\n * Left Arrow from the start of the field walks the chips.\n *\n * The value keeps the options' order, whatever order they were chosen in.\n */\nexport function MultiCombobox({\n label,\n options,\n value,\n onChange,\n placeholder,\n hint,\n note,\n mono = false,\n}: {\n label: ReactNode;\n options: readonly string[];\n value: string[];\n onChange: (value: string[]) => void;\n placeholder?: string;\n hint?: ReactNode;\n /** A word beside an option in the list, such as what choosing it exposes. */\n note?: (option: string) => ReactNode;\n mono?: boolean;\n}) {\n const { portal } = usePreferences();\n const id = useId();\n const labelId = useId();\n const hintId = useId();\n return (\n <Combobox.Root items={options} multiple value={value} onValueChange={(next) => onChange(options.filter((option) => next.includes(option)))}>\n <div className=\"field\">\n <label className=\"label\" htmlFor={id} id={labelId}>\n {label}\n </label>\n <Combobox.InputGroup className={`combo${mono ? ' combo-mono' : ''}`}>\n <Combobox.Chips className=\"combo-chips\" aria-label={value.length > 0 ? 'Chosen' : undefined}>\n {value.map((option) => (\n <Combobox.Chip key={option} className=\"combo-chip\" aria-label={option} aria-description=\"Press Backspace or Delete to remove\">\n {option}\n <Combobox.ChipRemove className=\"combo-chip-remove\" aria-label={`Remove ${option}`}>\n <X size={12} />\n </Combobox.ChipRemove>\n </Combobox.Chip>\n ))}\n <Combobox.Input\n id={id}\n // Named by reference too: while the list is open, Base UI hides what lies outside it, the label included.\n aria-labelledby={labelId}\n className=\"combo-input\"\n placeholder={value.length > 0 ? undefined : placeholder}\n aria-describedby={hint === undefined ? undefined : hintId}\n aria-description={value.length > 0 ? `${value.length} chosen. From the start of the field, press Left Arrow to reach them` : undefined}\n />\n </Combobox.Chips>\n </Combobox.InputGroup>\n {hint !== undefined && (\n <span className=\"hint\" id={hintId}>\n {hint}\n </span>\n )}\n </div>\n <Combobox.Portal container={portal}>\n <Combobox.Positioner className=\"menu-positioner\" sideOffset={4} align=\"start\">\n <Combobox.Popup className=\"menu combo-popup\">\n <Combobox.Empty className=\"combo-empty\">Nothing matches.</Combobox.Empty>\n <Combobox.List>\n {(option: string) => (\n <Combobox.Item key={option} value={option} className={`menu-item${mono ? ' mono' : ''}`}>\n <span className=\"combo-check\">\n <Combobox.ItemIndicator>\n <Check size={14} />\n </Combobox.ItemIndicator>\n </span>\n <span className=\"combo-option\">{option}</span>\n {note?.(option)}\n </Combobox.Item>\n )}\n </Combobox.List>\n </Combobox.Popup>\n </Combobox.Positioner>\n </Combobox.Portal>\n </Combobox.Root>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,SAAgB,cAAc,EAC5B,OACA,SACA,OACA,UACA,aACA,MACA,MACA,OAAO,SAWN;CACD,MAAM,EAAE,WAAW,eAAe;CAClC,MAAM,KAAK,MAAM;CACjB,MAAM,UAAU,MAAM;CACtB,MAAM,SAAS,MAAM;CACrB,OACE,qBAAC,SAAS,MAAV;EAAe,OAAO;EAAS,UAAA;EAAgB;EAAO,gBAAgB,SAAS,SAAS,QAAQ,QAAQ,WAAW,KAAK,SAAS,MAAM,CAAC,CAAC;YAAzI,CACE,qBAAC,OAAD;GAAK,WAAU;aAAf;IACE,oBAAC,SAAD;KAAO,WAAU;KAAQ,SAAS;KAAI,IAAI;eACvC;IACI,CAAA;IACP,oBAAC,SAAS,YAAV;KAAqB,WAAW,QAAQ,OAAO,gBAAgB;eAC7D,qBAAC,SAAS,OAAV;MAAgB,WA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State, u as Timestamp } from "./ui-Br-dNUTc.js";
1
+ import { c as Notice, i as EmptyState, u as Timestamp } from "./ui-2kwXXfrX.js";
2
2
  import { M as Key, b as ChevronRight, it as User, t as Card } from "./page-JTORvh-N.js";
3
3
  import { n as PrincipalLink } from "./principal-DFBswTBr.js";
4
- import { s as referenceProblem } from "./references-BQc35Q9g.js";
4
+ import { s as referenceProblem } from "./references-DImfw0cz.js";
5
5
  import { Link } from "@tanstack/react-router";
6
6
  import { credentialScopeInWords } from "@coffre/core/access";
7
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -44,7 +44,7 @@ function RemovedNotice({ report }) {
44
44
  ] }),
45
45
  ".",
46
46
  " ",
47
- person ? "Their project access, sessions, CLI logins, linked sign-in accounts and connected apps were revoked, so adding them again starts from nothing." : "Its project access and every token issued to it were revoked, so adding it again starts from nothing."
47
+ person ? "Their project access, sessions, CLI logins, personal tokens, linked sign-in accounts and connected apps were revoked, so adding them again starts from nothing." : "Its project access and every token issued to it were revoked, so adding it again starts from nothing."
48
48
  ] })
49
49
  });
50
50
  }
@@ -306,4 +306,4 @@ function IssuedTokens({ report }) {
306
306
  //#endregion
307
307
  export { RemovedList as n, RemovedNotice as r, PrincipalReportCards as t };
308
308
 
309
- //# sourceMappingURL=offboarding-C7ECW5o0.js.map
309
+ //# sourceMappingURL=offboarding-CrgwaetA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"offboarding-CrgwaetA.js","names":[],"sources":["../../src/components/offboarding.tsx"],"sourcesContent":["import { Link } from '@tanstack/react-router';\nimport { credentialScopeInWords } from '@coffre/core/access';\nimport type { PrincipalReport, RemovedPrincipal } from '../shared/models';\nimport { Card } from './page';\nimport { EmptyState, Notice, Timestamp } from './ui';\nimport { PrincipalLink } from './principal';\nimport { referenceProblem } from './references';\nimport { ChevronRight, Key, User } from './icons';\nimport { serviceName } from '@coffre/client';\n\n/**\n * The part of a user's or token's page that answers \"what do we change now\n * they have left?\". Owners only. Once someone is removed everything that let\n * them in is gone, but what they saw is not, nor tokens they issued.\n */\nexport function PrincipalReportCards({ report }: { report: PrincipalReport }) {\n const person = report.principalType === 'user';\n return (\n <>\n {report.status === 'removed' && <ConsiderRotating report={report} person={person} />}\n {report.issuedTokens.length > 0 && <IssuedTokens report={report} />}\n {report.references.length > 0 && <MadeReferences report={report} />}\n </>\n );\n}\n\nexport function RemovedNotice({ report }: { report: PrincipalReport }) {\n const person = report.principalType === 'user';\n return (\n <div className=\"report-notice\">\n <Notice>\n Removed\n {report.removedBy !== null && (\n <>\n {' '}by <span className=\"mono\">{report.removedBy}</span>\n </>\n )}\n {report.removedAt !== null && (\n <>\n {' '}on <Timestamp iso={report.removedAt} />\n </>\n )}\n .{' '}\n {person\n ? 'Their project access, sessions, CLI logins, personal tokens, linked sign-in accounts and connected apps were revoked, so adding them again starts from nothing.'\n : 'Its project access and every token issued to it were revoked, so adding it again starts from nothing.'}\n </Notice>\n </div>\n );\n}\n\n/**\n * The people or service accounts removed from the directory, under the live ones.\n * Removal ends their access but not the work it leaves, so they stay one click\n * away until every value they saw has been rotated.\n */\nexport function RemovedList({\n principalType,\n removed,\n}: {\n principalType: RemovedPrincipal['principalType'];\n removed: RemovedPrincipal[];\n}) {\n const users = principalType === 'user';\n const rows = removed.filter((principal) => principal.principalType === principalType);\n if (rows.length === 0) return null;\n return (\n <>\n <h2 className=\"section-title\">Removed</h2>\n <section className=\"card\" aria-label={users ? 'Removed users' : 'Removed service accounts'}>\n <div className=\"dt-wrap\">\n <table className=\"dt directory stacks\">\n <thead>\n <tr>\n <th className=\"n\">#</th>\n <th className=\"col-principal\">\n <span className=\"th\">\n {users ? <User size={14} /> : <Key size={14} />}\n {users ? 'Email' : 'Name'}\n </span>\n </th>\n <th className=\"col-role\">Consider rotating</th>\n <th className=\"col-actions\">\n <span className=\"visually-hidden\">Report</span>\n </th>\n </tr>\n </thead>\n <tbody>\n {rows.map((principal, index) => (\n <tr key={principal.principalId} className=\"row-link\">\n <td className=\"n\">{index + 1}</td>\n <td className=\"col-lead\" data-label={users ? 'Email' : 'Name'}>\n <PrincipalLink type={principal.principalType} id={principal.principalId} stretch />\n </td>\n <td className=\"col-role\" data-label=\"Consider rotating\">\n {principal.toRotate === 0 ? (\n <span className=\"cell-muted\">Nothing</span>\n ) : (\n `${principal.toRotate} ${principal.toRotate === 1 ? 'value' : 'values'}`\n )}\n </td>\n {/* The row opens the report; the chevron says it does. */}\n <td className=\"col-actions col-open cell-muted\" aria-hidden=\"true\">\n <ChevronRight size={16} />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </section>\n </>\n );\n}\n\n/** Values a removed member saw that nobody has changed since. */\nfunction ConsiderRotating({ report, person }: { report: PrincipalReport; person: boolean }) {\n const they = person ? 'they' : 'it';\n return (\n <Card\n labelledBy=\"seen-values\"\n title=\"Consider rotating\"\n description={`Values ${they} read or wrote that nobody has changed since. Rotate each at its source, such as a new API key or database password, then save the new value here.`}\n actions={\n report.rotated > 0 && (\n <span className=\"card-aside\">{report.rotated} already rotated</span>\n )\n }\n >\n {report.exposed.length === 0 ? (\n <EmptyState title=\"Nothing left to rotate\">\n {report.rotated > 0\n ? `Every value ${they} saw has had a new version since.`\n : `${person ? 'They have' : 'It has'} not read or written a value that is still current.`}\n </EmptyState>\n ) : (\n <div className=\"dt-wrap\">\n <table className=\"dt report-values\">\n <thead>\n <tr>\n <th>Secret</th>\n <th className=\"col-shrink\">Version</th>\n <th className=\"col-shrink\">Last seen</th>\n </tr>\n </thead>\n <tbody>\n {report.exposed.map((secret) => (\n <tr key={`${secret.project}/${secret.environment}/${secret.key}`}>\n <td>\n <Link\n className=\"cell-link mono\"\n to=\"/projects/$project/$environment\"\n params={{ project: secret.project, environment: secret.environment }}\n search={{ filter: secret.key }}\n >\n <span className=\"report-path\">\n {secret.project}/{secret.environment}/\n </span>\n {secret.key}\n </Link>\n </td>\n <td className=\"col-shrink cell-mono cell-muted\">v{secret.version}</td>\n <td className=\"col-shrink nowrap\">\n {secret.how === 'wrote' ? 'Wrote' : 'Read'}{' '}\n <Timestamp iso={secret.at} display=\"relative\" />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )}\n </Card>\n );\n}\n\n/**\n * References they made, as the log names them: each belongs to the\n * environment that holds it, like a value, not to them (D46), so their\n * leaving ends none. Listed to review.\n */\nfunction MadeReferences({ report }: { report: PrincipalReport }) {\n return (\n <Card\n labelledBy=\"made-references\"\n title=\"References they made\"\n description=\"These stay after they leave, and whoever reads a reference's environment reads its source through it. Review them: the source's access managers, or whoever writes where one is held, can break it.\"\n >\n <div className=\"dt-wrap\">\n <table className=\"dt stacks\">\n <thead>\n <tr>\n <th>Reference</th>\n <th>Reads</th>\n <th className=\"col-shrink\">Made</th>\n </tr>\n </thead>\n <tbody>\n {report.references.map((reference) => (\n <tr key={reference.id}>\n <td className=\"mono\" data-label=\"Reference\">{reference.holder}</td>\n <td data-label=\"Reads\">\n <span className=\"mono\">{reference.source}</span>\n {reference.state !== 'live' && <span className=\"cell-muted\"> · {referenceProblem(reference.state)}</span>}\n </td>\n <td className=\"col-shrink nowrap\" data-label=\"Made\">\n <Timestamp iso={reference.createdAt} display=\"relative\" />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </Card>\n );\n}\n\nfunction IssuedTokens({ report }: { report: PrincipalReport }) {\n return (\n <Card\n labelledBy=\"issued-tokens\"\n title=\"Bearer tokens they issued\"\n description=\"These still work, and they saw each one when it was issued. Revoke any they may have kept.\"\n >\n <div className=\"dt-wrap\">\n <table className=\"dt report-tokens\">\n <thead>\n <tr>\n <th>Token</th>\n <th className=\"col-shrink\">Expires</th>\n <th className=\"col-shrink col-hide-narrow\">Last used</th>\n </tr>\n </thead>\n <tbody>\n {report.issuedTokens.map((token) => (\n <tr key={token.id}>\n <td>\n <span className=\"cell-stack\">\n <Link className=\"cell-link mono\" to=\"/service-accounts/$account\" params={{ account: serviceName(token.service) }}>\n service:{serviceName(token.service)}\n </Link>\n <small>\n {token.label ?? 'No label'} · <span className=\"mono\">{token.hint}</span> · reaches{' '}\n {token.scope === null ? 'all its account holds' : credentialScopeInWords(token.scope)}\n </small>\n </span>\n </td>\n <td className=\"col-shrink nowrap\">\n <Timestamp iso={token.expiresAt} display=\"relative\" />\n </td>\n <td className=\"col-shrink col-hide-narrow nowrap\">\n {token.lastUsedAt === null ? (\n <span className=\"cell-muted\">Never</span>\n ) : (\n <Timestamp iso={token.lastUsedAt} display=\"relative\" />\n )}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </Card>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAeA,SAAgB,qBAAqB,EAAE,UAAuC;CAC5E,MAAM,SAAS,OAAO,kBAAkB;CACxC,OACE,qBAAA,UAAA,EAAA,UAAA;EACG,OAAO,WAAW,aAAa,oBAAC,kBAAD;GAA0B;GAAgB;EAAS,CAAA;EAClF,OAAO,aAAa,SAAS,KAAK,oBAAC,cAAD,EAAsB,OAAS,CAAA;EACjE,OAAO,WAAW,SAAS,KAAK,oBAAC,gBAAD,EAAwB,OAAS,CAAA;CAClE,EAAA,CAAA;AAEN;AAEA,SAAgB,cAAc,EAAE,UAAuC;CACrE,MAAM,SAAS,OAAO,kBAAkB;CACxC,OACE,oBAAC,OAAD;EAAK,WAAU;YACb,qBAAC,QAAD,EAAA,UAAA;GAAQ;GAEL,OAAO,cAAc,QACpB,qBAAA,UAAA,EAAA,UAAA;IACG;IAAI;IAAG,oBAAC,QAAD;KAAM,WAAU;eAAQ,OAAO;IAAgB,CAAA;GACvD,EAAA,CAAA;GAEH,OAAO,cAAc,QACpB,qBAAA,UAAA,EAAA,UAAA;IACG;IAAI;IAAG,oBAAC,WAAD,EAAW,KAAK,OAAO,UAAY,CAAA;GAC3C,EAAA,CAAA;GACF;GACA;GACD,SACG,oKACA;EACE,EAAA,CAAA;CACL,CAAA;AAET;;;;;;AAOA,SAAgB,YAAY,EAC1B,eACA,WAIC;CACD,MAAM,QAAQ,kBAAkB;CAChC,M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AAM,EAsBX,CACL,EACI,CAAA,CACF;;EACJ,CAAA;CACD,CAAA;AAEV"}
@@ -0,0 +1,138 @@
1
+ import { a as ErrorLine, i as EmptyState, t as ConfirmButton, u as Timestamp } from "./ui-2kwXXfrX.js";
2
+ import { M as Key, st as X, t as Card } from "./page-JTORvh-N.js";
3
+ import { a as rowClass, i as RowPending, r as RowFailure } from "./row-state-BsIHspy4.js";
4
+ import { n as useChangeStatus, t as useChange } from "./use-change-CQyDpCqw.js";
5
+ import { Fragment } from "react";
6
+ import { credentialScopeInWords } from "@coffre/core/access";
7
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
+ //#region src/components/personal-tokens.tsx
9
+ /**
10
+ * Personal tokens, which act as their person within what each reaches:
11
+ * your own on your account page, or a person's on theirs, for whoever runs
12
+ * the instance. Each row says what it is called, what it reaches and when
13
+ * it ends; Revoke stops it at its next request.
14
+ */
15
+ function PersonalTokensCard({ tokens, change, description, empty, emptyActions }) {
16
+ const revoke = useChange(change);
17
+ const { status, dismiss } = useChangeStatus(change.list.queryKey);
18
+ return /* @__PURE__ */ jsx(Card, {
19
+ labelledBy: "personal-tokens",
20
+ title: "Personal tokens",
21
+ description,
22
+ children: "error" in tokens ? /* @__PURE__ */ jsx("div", {
23
+ className: "card-body",
24
+ children: /* @__PURE__ */ jsx(ErrorLine, { error: tokens.error })
25
+ }) : tokens.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
26
+ title: "No personal tokens",
27
+ actions: emptyActions,
28
+ children: empty
29
+ }) : /* @__PURE__ */ jsx("div", {
30
+ className: "dt-wrap",
31
+ children: /* @__PURE__ */ jsxs("table", {
32
+ className: "dt stacks stacks-inline",
33
+ children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
34
+ /* @__PURE__ */ jsx("th", { children: "Token" }),
35
+ /* @__PURE__ */ jsx("th", { children: "Reaches" }),
36
+ /* @__PURE__ */ jsx("th", {
37
+ className: "col-shrink",
38
+ children: "Last used"
39
+ }),
40
+ /* @__PURE__ */ jsx("th", {
41
+ className: "col-shrink",
42
+ children: "Expires"
43
+ }),
44
+ /* @__PURE__ */ jsx("th", {
45
+ className: "col-actions",
46
+ children: /* @__PURE__ */ jsx("span", {
47
+ className: "visually-hidden",
48
+ children: "Actions"
49
+ })
50
+ })
51
+ ] }) }), /* @__PURE__ */ jsx("tbody", { children: tokens.map((token) => {
52
+ const state = status(token.id);
53
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("tr", {
54
+ className: rowClass(state),
55
+ children: [
56
+ /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsxs("span", {
57
+ className: "cell-account",
58
+ children: [/* @__PURE__ */ jsx(Key, { size: 15 }), /* @__PURE__ */ jsxs("span", {
59
+ className: "cell-stack",
60
+ children: [/* @__PURE__ */ jsx("span", { children: token.label }), /* @__PURE__ */ jsxs("small", { children: [
61
+ /* @__PURE__ */ jsx("span", {
62
+ className: "mono",
63
+ children: token.hint
64
+ }),
65
+ " · made ",
66
+ /* @__PURE__ */ jsx(Timestamp, {
67
+ iso: token.createdAt,
68
+ display: "relative"
69
+ })
70
+ ] })]
71
+ })]
72
+ }) }),
73
+ /* @__PURE__ */ jsx("td", {
74
+ "data-label": "Reaches",
75
+ children: credentialScopeInWords(token.scope ?? {})
76
+ }),
77
+ /* @__PURE__ */ jsx("td", {
78
+ className: "nowrap cell-muted",
79
+ "data-label": "Last used",
80
+ children: token.lastUsedAt === null ? "Never" : /* @__PURE__ */ jsxs("span", {
81
+ className: "cell-stack",
82
+ children: [/* @__PURE__ */ jsx(Timestamp, {
83
+ iso: token.lastUsedAt,
84
+ display: "relative"
85
+ }), token.lastUsedIp !== null && /* @__PURE__ */ jsx("small", {
86
+ className: "mono",
87
+ children: token.lastUsedIp
88
+ })]
89
+ })
90
+ }),
91
+ /* @__PURE__ */ jsx("td", {
92
+ className: "nowrap cell-muted",
93
+ "data-label": "Expires",
94
+ children: /* @__PURE__ */ jsx(Timestamp, {
95
+ iso: token.expiresAt,
96
+ display: "relative"
97
+ })
98
+ }),
99
+ /* @__PURE__ */ jsx("td", {
100
+ className: "col-actions",
101
+ children: state.state === "pending" ? /* @__PURE__ */ jsx(RowPending, { status: state }) : /* @__PURE__ */ jsx(ConfirmButton, {
102
+ trigger: /* @__PURE__ */ jsxs("button", {
103
+ className: "act",
104
+ children: [/* @__PURE__ */ jsx(X, { size: 13 }), "Revoke"]
105
+ }),
106
+ title: `Revoke “${token.label}”?`,
107
+ body: /* @__PURE__ */ jsxs(Fragment$1, { children: [
108
+ /* @__PURE__ */ jsx("span", {
109
+ className: "mono",
110
+ children: token.hint
111
+ }),
112
+ ", last used",
113
+ " ",
114
+ token.lastUsedAt === null ? "never" : /* @__PURE__ */ jsx(Timestamp, {
115
+ iso: token.lastUsedAt,
116
+ display: "relative"
117
+ }),
118
+ ". Whatever uses it is refused at once."
119
+ ] }),
120
+ confirmLabel: "Revoke token",
121
+ onConfirm: () => revoke(token)
122
+ })
123
+ })
124
+ ]
125
+ }), /* @__PURE__ */ jsx(RowFailure, {
126
+ status: state,
127
+ columns: 5,
128
+ onDismiss: () => state.state === "failed" && dismiss(state.mutationId)
129
+ })] }, token.id);
130
+ }) })]
131
+ })
132
+ })
133
+ });
134
+ }
135
+ //#endregion
136
+ export { PersonalTokensCard as t };
137
+
138
+ //# sourceMappingURL=personal-tokens-B8rkT-DI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"personal-tokens-B8rkT-DI.js","names":[],"sources":["../../src/components/personal-tokens.tsx"],"sourcesContent":["import type { TokenRow } from '@coffre/client';\nimport { credentialScopeInWords } from '@coffre/core/access';\nimport { Fragment, type ReactNode } from 'react';\n\nimport type { Change } from '../lib/optimistic';\nimport { useChange, useChangeStatus } from '../lib/use-change';\nimport { Key, X } from './icons';\nimport { Card } from './page';\nimport { RowFailure, RowPending, rowClass } from './row-state';\nimport { ConfirmButton, EmptyState, ErrorLine, Timestamp } from './ui';\n\n/**\n * Personal tokens, which act as their person within what each reaches:\n * your own on your account page, or a person's on theirs, for whoever runs\n * the instance. Each row says what it is called, what it reaches and when\n * it ends; Revoke stops it at its next request.\n */\nexport function PersonalTokensCard<TData>({\n tokens,\n change,\n description,\n empty,\n emptyActions,\n}: {\n tokens: TokenRow[] | { error: string };\n change: Change<TData, TokenRow, TokenRow, unknown>;\n description: ReactNode;\n /** Said when there is none: phrasing, inside the empty state's paragraph. */\n empty?: ReactNode;\n /** Beneath it, what to do about it. */\n emptyActions?: ReactNode;\n}) {\n const revoke = useChange(change);\n const { status, dismiss } = useChangeStatus(change.list.queryKey);\n return (\n <Card labelledBy=\"personal-tokens\" title=\"Personal tokens\" description={description}>\n {'error' in tokens ? (\n <div className=\"card-body\">\n <ErrorLine error={tokens.error} />\n </div>\n ) : tokens.length === 0 ? (\n <EmptyState title=\"No personal tokens\" actions={emptyActions}>\n {empty}\n </EmptyState>\n ) : (\n <div className=\"dt-wrap\">\n <table className=\"dt stacks stacks-inline\">\n <thead>\n <tr>\n <th>Token</th>\n <th>Reaches</th>\n <th className=\"col-shrink\">Last used</th>\n <th className=\"col-shrink\">Expires</th>\n <th className=\"col-actions\">\n <span className=\"visually-hidden\">Actions</span>\n </th>\n </tr>\n </thead>\n <tbody>\n {tokens.map((token) => {\n const state = status(token.id);\n return (\n <Fragment key={token.id}>\n <tr className={rowClass(state)}>\n <td>\n <span className=\"cell-account\">\n <Key size={15} />\n <span className=\"cell-stack\">\n <span>{token.label}</span>\n <small>\n <span className=\"mono\">{token.hint}</span>\n {' · made '}\n <Timestamp iso={token.createdAt} display=\"relative\" />\n </small>\n </span>\n </span>\n </td>\n <td data-label=\"Reaches\">{credentialScopeInWords(token.scope ?? {})}</td>\n <td className=\"nowrap cell-muted\" data-label=\"Last used\">\n {token.lastUsedAt === null ? (\n 'Never'\n ) : (\n <span className=\"cell-stack\">\n <Timestamp iso={token.lastUsedAt} display=\"relative\" />\n {token.lastUsedIp !== null && <small className=\"mono\">{token.lastUsedIp}</small>}\n </span>\n )}\n </td>\n <td className=\"nowrap cell-muted\" data-label=\"Expires\">\n <Timestamp iso={token.expiresAt} display=\"relative\" />\n </td>\n <td className=\"col-actions\">\n {state.state === 'pending' ? (\n <RowPending status={state} />\n ) : (\n <ConfirmButton\n trigger={\n <button className=\"act\">\n <X size={13} />\n Revoke\n </button>\n }\n title={`Revoke “${token.label}”?`}\n body={\n <>\n <span className=\"mono\">{token.hint}</span>, last used{' '}\n {token.lastUsedAt === null ? 'never' : <Timestamp iso={token.lastUsedAt} display=\"relative\" />}.\n Whatever uses it is refused at once.\n </>\n }\n confirmLabel=\"Revoke token\"\n onConfirm={() => revoke(token)}\n />\n )}\n </td>\n </tr>\n <RowFailure\n status={state}\n columns={5}\n onDismiss={() => state.state === 'failed' && dismiss(state.mutationId)}\n />\n </Fragment>\n );\n })}\n </tbody>\n </table>\n </div>\n )}\n </Card>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAiBA,SAAgB,mBAA0B,EACxC,QACA,QACA,aACA,OACA,gBASC;CACD,MAAM,SAAS,UAAU,MAAM;CAC/B,MAAM,EAAE,QAAQ,YAAY,gBAAgB,OAAO,KAAK,QAAQ;CAChE,OACE,oBAAC,MAAD;EAAM,YAAW;EAAkB,OAAM;EAA+B;YACrE,WAAW,SACV,oBAAC,OAAD;GAAK,WAAU;aACb,oBAAC,WAAD,EAAW,OAAO,OAAO,MAAQ,CAAA;EAC9B,CAAA,IACH,OAAO,WAAW,IACpB,oBAAC,YAAD;GAAY,OAAM;GAAqB,SAAS;aAC7C;EACS,CAAA,IAEZ,oBAAC,OAAD;GAAK,WAAU;aACb,qBAAC,SAAD;IAAO,WAAU;cAAjB,CACE,oBAAC,SAAD,EAAA,UACE,qBAAC,MAAD,EAAA,UAAA;KACE,oBAAC,MAAD,EAAA,UAAI,QAAS,CAAA;KACb,oBAAC,MAAD,EAAA,UAAI,UAAW,CAAA;KACf,oBAAC,MAAD;MAAI,WAAU;gBAAa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