{"version":3,"file":"keycloakify-angular-account-pages-applications.mjs","names":[],"sources":["../../src/account/pages/applications/applications.component.ts","../../src/account/pages/applications/applications.component.html"],"sourcesContent":["import { KeyValuePipe } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, forwardRef, inject } from '@angular/core';\nimport { ComponentReference } from '@keycloakify/angular/account/classes/component-reference';\nimport { KcClassDirective } from '@keycloakify/angular/account/directives/kc-class';\nimport type { I18n } from '@keycloakify/angular/account/i18n';\nimport type { KcContext } from '@keycloakify/angular/account/KcContext';\nimport { ACCOUNT_CLASSES } from '@keycloakify/angular/account/tokens/classes';\nimport { ACCOUNT_I18N } from '@keycloakify/angular/account/tokens/i18n';\nimport { KC_ACCOUNT_CONTEXT } from '@keycloakify/angular/account/tokens/kc-context';\nimport { IsArrayWithEmptyObjectPipe } from '@keycloakify/angular/lib/pipes/is-array-with-empty-object';\nimport { USE_DEFAULT_CSS } from '@keycloakify/angular/lib/tokens/use-default-css';\nimport type { ClassKey } from 'keycloakify/account/lib/kcClsx';\n\n@Component({\n    imports: [KcClassDirective, KeyValuePipe, IsArrayWithEmptyObjectPipe],\n    selector: 'kc-applications',\n    templateUrl: 'applications.component.html',\n    changeDetection: ChangeDetectionStrategy.OnPush,\n    providers: [\n        {\n            provide: ComponentReference,\n            useExisting: forwardRef(() => ApplicationsComponent)\n        }\n    ]\n})\nexport class ApplicationsComponent extends ComponentReference {\n    i18n = inject<I18n>(ACCOUNT_I18N);\n    kcContext = inject<Extract<KcContext, { pageId: 'applications.ftl' }>>(KC_ACCOUNT_CONTEXT);\n    override doUseDefaultCss = inject<boolean>(USE_DEFAULT_CSS);\n    override classes = inject<Partial<Record<ClassKey, string>>>(ACCOUNT_CLASSES);\n    active = 'applications';\n}\n","@let url = kcContext.url;\n@let stateChecker = kcContext.stateChecker;\n@let applications = kcContext.applications.applications;\n\n<div class=\"row\">\n    <div class=\"col-md-10\">\n        <h2>{{ i18n.msgStr('applicationsHtmlTitle') }}</h2>\n    </div>\n\n    <form\n        method=\"post\"\n        [action]=\"url.applicationsUrl\"\n    >\n        <input\n            type=\"hidden\"\n            id=\"stateChecker\"\n            name=\"stateChecker\"\n            [value]=\"stateChecker\"\n        />\n        <input\n            type=\"hidden\"\n            id=\"referrer\"\n            name=\"referrer\"\n            [value]=\"stateChecker\"\n        />\n\n        <table class=\"table table-striped table-bordered\">\n            <thead>\n                <tr>\n                    <td>{{ i18n.msgStr('application') }}</td>\n                    <td>{{ i18n.msgStr('availableRoles') }}</td>\n                    <td>{{ i18n.msgStr('grantedPermissions') }}</td>\n                    <td>{{ i18n.msgStr('additionalGrants') }}</td>\n                    <td>{{ i18n.msgStr('action') }}</td>\n                </tr>\n            </thead>\n\n            <tbody>\n                @for (application of applications ?? []; track application) {\n                    <tr>\n                        <td>\n                            @if (application.effectiveUrl) {\n                                <a [href]=\"application.effectiveUrl\">\n                                    @if (application.client.name) {\n                                        {{ i18n.advancedMsgStr(application.client.name) }}\n                                    } @else {\n                                        {{ application.client.clientId }}\n                                    }\n                                </a>\n                            } @else {\n                                @if (application.client.name) {\n                                    {{ i18n.advancedMsgStr(application.client.name) }}\n                                } @else {\n                                    {{ application.client.clientId }}\n                                }\n                            }\n                        </td>\n\n                        <td>\n                            @if (!(application.realmRolesAvailable | isArrayWithEmptyObject)) {\n                                @for (role of application.realmRolesAvailable; track role; let last = $last) {\n                                    <span>\n                                        @if (role.description) {\n                                            {{ i18n.advancedMsgStr(role.description) }}\n                                        } @else {\n                                            {{ i18n.advancedMsgStr(role.name) }}\n                                        }\n                                        @if (!last) {\n                                            ,&nbsp;\n                                        }\n                                    </span>\n                                }\n                            }\n                            @if (application.resourceRolesAvailable) {\n                                @for (resource of application.resourceRolesAvailable | keyvalue; track resource.key) {\n                                    <span>\n                                        @if (!(application.realmRolesAvailable | isArrayWithEmptyObject)) {\n                                            ,&nbsp;\n                                        }\n                                        @for (\n                                            clientRole of application.resourceRolesAvailable[resource.key];\n                                            track clientRole;\n                                            let roleLast = $last\n                                        ) {\n                                            <span>\n                                                {{\n                                                    i18n.advancedMsgStr(clientRole.roleDescription ? clientRole.roleDescription : clientRole.roleName)\n                                                }}\n                                                {{ i18n.msgStr('inResource') }}\n                                                <strong>\n                                                    {{\n                                                        clientRole.clientName ? i18n.advancedMsgStr(clientRole.clientName) : clientRole.clientId\n                                                    }}</strong\n                                                >\n                                                @if (!roleLast) {\n                                                    ,&nbsp;\n                                                }\n                                            </span>\n                                        }\n                                    </span>\n                                }\n                            }\n                        </td>\n\n                        <td>\n                            @if (application.client.consentRequired) {\n                                @for (claim of application.clientScopesGranted; track claim; let last = $last) {\n                                    {{ i18n.advancedMsgStr(claim) }}\n                                    @if (!last) {\n                                        ,&nbsp;\n                                    }\n                                }\n                            } @else {\n                                <strong>{{ i18n.msgStr('fullAccess') }}</strong>\n                            }\n                        </td>\n\n                        <td>\n                            @for (grant of application.additionalGrants; track grant; let last = $last) {\n                                {{ i18n.advancedMsgStr(grant) }}\n                                @if (!last) {\n                                    ,&nbsp;\n                                }\n                            }\n                        </td>\n\n                        <td>\n                            @if (\n                                (application.client.consentRequired && application.clientScopesGranted.length > 0) ||\n                                application.additionalGrants.length > 0\n                            ) {\n                                <button\n                                    type=\"submit\"\n                                    name=\"clientId\"\n                                    [kcClass]=\"['kcButtonPrimaryClass', 'kcButtonClass']\"\n                                    [id]=\"'revoke-' + application.client.clientId\"\n                                    [value]=\"application.client.id\"\n                                >\n                                    {{ i18n.msgStr('revoke') }}\n                                </button>\n                            }\n                        </td>\n                    </tr>\n                }\n            </tbody>\n        </table>\n    </form>\n</div>\n"],"mappings":";;;;;;;;;;AAyBA,IAAa,wBAAb,MAAa,8BAA8B,mBAAkB;CAZ7D,cAAA;;EAaI,KAAA,OAAO,OAAa,YAAY;EAChC,KAAA,YAAY,OAA2D,kBAAkB;EAChF,KAAA,kBAAkB,OAAgB,eAAe;EACjD,KAAA,UAAU,OAA0C,eAAe;EAC5E,KAAA,SAAS;CACZ;CANY;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAqB,MAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAArB;EAAA,KAAA,OAAA,GAAA,qBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,MAAA;GAAqB,cAAA;GAAA,UAAA;GAAA,WAPnB,CACP;IACI,SAAS;IACT,aAAa,iBAAiB,qBAAqB;GACtD,CACJ;GAAA,iBAAA;GAAA,UAAA;GAAA,UCvBL;GAoJA,cAAA;IAAA;KAAA,MAAA;KAAA,MDtIc;KAAgB,UAAA;KAAA,QAAA;MAAA;MAAA;MAAA;KAAA;IAAA;IAAA;KAAA,MAAA;KAAA,MAAE;KAAY,MAAA;IAAA;IAAA;KAAA,MAAA;KAAA,MAAE;KAA0B,MAAA;IAAA;GAAA;GAAA,iBAAA,GAAA,wBAAA;EAAA,CAAA;CAAA;;AAW3D,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAqB,YAAA,CAAA;EAZjC,MAAA;EACY,MAAA,CAAA;GAAA,SAAA;IAAC;IAAkB;IAAc;GAA0B;GAAC,UAC3D;GAAiB,iBAEV,wBAAwB;GAAM,WACpC,CACP;IACI,SAAS;IACT,aAAa,iBAAgB,qBAAsB;GACtD,CACJ;GAAA,UAAA;EAAA,CAAA"}