const samlIdpMap = {
    generic: {
        displayName: 'Custom SAML',
        copyToOrFromIdpDisplayName: 'your IdP',
        setupOrder: [
            'copyToIdp',
            'attributeMapping',
            'copyFromIdp'
        ],
        idpValueOrder: [
            'ssoUrl',
            'entityId',
            'certificate'
        ],
        acsUrlLabel: 'ACS URL (Reply URL)',
        audienceUriLabel: 'Audience URI (SP Entity ID)',
        idpSsoUrlLabel: 'IdP Sign-on URL',
        idpEntityIdLabel: 'IdP Entity ID',
        x509CertificateLabel: 'x509 Certificate (PEM Format)',
        metadataUrlLabel: 'Metadata URL',
        nameIdFormatLabel: 'Name ID Format',
        nameIdFormatValue: 'Primary Email Address',
        attributeMappingLabel: 'Attribute Mapping'
    },
    'microsoft-entra': {
        displayName: 'Entra SAML',
        copyToOrFromIdpDisplayName: 'Entra',
        setupOrder: [
            'createApplication',
            'copyToIdp',
            'attributeMapping',
            'copyFromIdp'
        ],
        idpValueOrder: [
            'ssoUrl',
            'entityId',
            'certificate'
        ],
        acsUrlLabel: 'Reply URL (Assertion Consumer Service URL)',
        audienceUriLabel: 'Identifier (Entity ID)',
        idpSsoUrlLabel: 'Login Url',
        idpEntityIdLabel: 'Microsoft Entra Identifier',
        x509CertificateLabel: 'PEM Certificate',
        metadataUrlLabel: 'App Federation Metadata Url',
        nameIdFormatLabel: 'Unique User Identifier (Name ID) Format',
        nameIdFormatValue: 'user.primaryauthoritativeemail',
        attributeMappingLabel: 'Claim Names'
    },
    okta: {
        displayName: 'Okta SAML',
        copyToOrFromIdpDisplayName: 'Okta',
        setupOrder: [
            'createApplication',
            'copyToIdp',
            'attributeMapping',
            'copyFromIdp'
        ],
        idpValueOrder: [
            'ssoUrl',
            'entityId',
            'certificate'
        ],
        acsUrlLabel: 'Single sign-on URL',
        audienceUriLabel: 'Audience URI (SP Entity ID)',
        idpSsoUrlLabel: 'Sign-on URL',
        idpEntityIdLabel: 'Issuer',
        x509CertificateLabel: 'Signing Certificate',
        metadataUrlLabel: 'Metadata URL',
        nameIdFormatLabel: 'Name ID Format',
        nameIdFormatValue: 'EmailAddress',
        attributeMappingLabel: 'Attribute Statements'
    },
    'google-workspace': {
        displayName: 'Google SAML',
        copyToOrFromIdpDisplayName: 'Google',
        setupOrder: [
            'createApplication',
            'copyFromIdp',
            'copyToIdp',
            'attributeMapping'
        ],
        idpValueOrder: [
            'entityId',
            'ssoUrl',
            'certificate'
        ],
        acsUrlLabel: 'ACS URL',
        audienceUriLabel: 'Entity ID',
        idpSsoUrlLabel: 'SSO URL',
        idpEntityIdLabel: 'Entity ID',
        x509CertificateLabel: 'Certificate',
        metadataUrlLabel: false,
        nameIdFormatLabel: 'NameID Format',
        nameIdFormatValue: 'EMAIL; Basic Information > Primary email',
        attributeMappingLabel: 'Attribute Mapping'
    }
};
const oidcIdpMap = {
    generic: {
        displayName: 'Custom OIDC',
        copyToOrFromIdpDisplayName: 'your IdP',
        setupOrder: [
            'copyToIdp',
            'copyFromIdp'
        ],
        redirectUrlLabel: 'Redirect URI',
        clientIdLabel: 'Client ID',
        clientSecretLabel: 'Client Secret',
        issuerLabel: 'Issuer'
    },
    'microsoft-entra': {
        displayName: 'Entra OIDC',
        copyToOrFromIdpDisplayName: 'Entra',
        setupOrder: [
            'createApplication',
            'copyToIdp',
            'copyFromIdp'
        ],
        redirectUrlLabel: 'Redirect URI',
        clientIdLabel: 'Application (Client) ID',
        clientSecretLabel: 'Client Secret',
        issuerLabel: 'Issuer',
        issuerDerivedLabel: 'Directory (tenant) ID',
        extractIssuerFromInput: (input)=>{
            const match = input.match(/^https:\/\/login\.microsoftonline\.com\/(.+)\/v2\.0$/);
            return match?.[1];
        },
        transformInputToIssuer: (id)=>`https://login.microsoftonline.com/${id}/v2.0`
    },
    okta: {
        displayName: 'Okta OIDC',
        copyToOrFromIdpDisplayName: 'Okta',
        setupOrder: [
            'createApplication',
            'copyToIdp',
            'copyFromIdp'
        ],
        redirectUrlLabel: 'Sign-in Redirect URI',
        clientIdLabel: 'Client ID',
        clientSecretLabel: 'Client Secret',
        issuerLabel: 'Okta URL (Issuer)'
    }
};
const getIdpInfo = (idp, type)=>{
    if (type === 'saml') {
        const idpKey = idp in samlIdpMap ? idp : 'generic';
        return {
            idp: samlIdpMap[idpKey],
            type
        };
    } else {
        const idpKey = idp in oidcIdpMap ? idp : 'generic';
        return {
            idp: oidcIdpMap[idpKey],
            type
        };
    }
};
const getIdpAndConnectionInfo = (connection)=>{
    if (connection.connectionType === 'external') {
        return {
            idp: undefined,
            type: 'external',
            connection: connection
        };
    }
    return {
        ...getIdpInfo(connection.identity_provider, connection.connectionType),
        connection
    };
};
const typeToUserFriendlyName = (type)=>{
    if (type === 'saml') {
        return 'SAML';
    } else if (type === 'oidc') {
        return 'OIDC';
    } else {
        return 'External';
    }
};

export { getIdpAndConnectionInfo, getIdpInfo, oidcIdpMap, samlIdpMap, typeToUserFriendlyName };
//# sourceMappingURL=IdpInfo.mjs.map
