export function getDefaultSanitizedTags() {
    return ['a', 'p', 'span', 'br', 'strong', 'em', 'ul', 'ol', 'li'];
}
export function getDefaultSanitizedSchemes() {
    return ['http', 'https'];
}
export function getDefaultSanitizedHrefAttributes() {
    return ['href', 'class', 'target', 'rel'];
}
export function getDefaultSanitizeOptions() {
    return {
        allowedTags: getDefaultSanitizedTags(),
        allowedSchemes: getDefaultSanitizedSchemes(),
        allowedAttributes: {
            'a': getDefaultSanitizedHrefAttributes(),
            '*': ['data-*']
        },
        transformTags: {
            a: (tagName, attribs) => {
                let rel = 'noopener noreferrer';
                if (attribs.rel === 'me')
                    rel += ' me';
                return {
                    tagName,
                    attribs: Object.assign(attribs, {
                        target: '_blank',
                        rel
                    })
                };
            }
        }
    };
}
export function getMailHtmlSanitizeOptions() {
    return {
        allowedTags: ['a', 'strong'],
        allowedSchemes: getDefaultSanitizedSchemes(),
        allowedAttributes: {
            a: ['href', 'title']
        }
    };
}
export function getTextOnlySanitizeOptions() {
    return {
        allowedTags: []
    };
}
export function getSanitizeSVGOptions() {
    return {
        allowedTags: [
            'svg',
            'g',
            'defs',
            'symbol',
            'use',
            'switch',
            'title',
            'desc',
            'metadata',
            'path',
            'rect',
            'circle',
            'ellipse',
            'line',
            'polyline',
            'polygon',
            'text',
            'tspan',
            'textPath',
            'linearGradient',
            'radialGradient',
            'stop',
            'clipPath',
            'mask',
            'pattern',
            'marker',
            'image',
            'filter',
            'feBlend',
            'feColorMatrix',
            'feComponentTransfer',
            'feComposite',
            'feConvolveMatrix',
            'feDiffuseLighting',
            'feDisplacementMap',
            'feDistantLight',
            'feDropShadow',
            'feFlood',
            'feFuncA',
            'feFuncB',
            'feFuncG',
            'feFuncR',
            'feGaussianBlur',
            'feImage',
            'feMerge',
            'feMergeNode',
            'feMorphology',
            'feOffset',
            'fePointLight',
            'feSpecularLighting',
            'feSpotLight',
            'feTile',
            'feTurbulence'
        ],
        allowedAttributes: {
            '*': [
                'id',
                'class',
                'style',
                'lang',
                'href',
                'xlink:href',
                'xlink:title',
                'xmlns',
                'xmlns:xlink',
                'version',
                'xml:space',
                'xml:lang',
                'baseProfile',
                'x',
                'y',
                'x1',
                'y1',
                'x2',
                'y2',
                'cx',
                'cy',
                'r',
                'rx',
                'ry',
                'd',
                'points',
                'width',
                'height',
                'dx',
                'dy',
                'rotate',
                'pathLength',
                'transform',
                'gradientTransform',
                'patternTransform',
                'viewBox',
                'preserveAspectRatio',
                'offset',
                'fill',
                'fill-opacity',
                'fill-rule',
                'clip-path',
                'clip-rule',
                'mask',
                'filter',
                'stroke',
                'stroke-width',
                'stroke-linecap',
                'stroke-linejoin',
                'stroke-dasharray',
                'stroke-dashoffset',
                'stroke-opacity',
                'stroke-miterlimit',
                'opacity',
                'color',
                'display',
                'visibility',
                'overflow',
                'vector-effect',
                'stop-color',
                'stop-opacity',
                'paint-order',
                'shape-rendering',
                'image-rendering',
                'color-interpolation',
                'color-interpolation-filters',
                'font-family',
                'font-size',
                'font-weight',
                'font-style',
                'text-anchor',
                'text-decoration',
                'letter-spacing',
                'word-spacing',
                'dominant-baseline',
                'alignment-baseline',
                'baseline-shift',
                'direction',
                'writing-mode',
                'gradientUnits',
                'patternUnits',
                'patternContentUnits',
                'clipPathUnits',
                'maskUnits',
                'maskContentUnits',
                'markerUnits',
                'filterUnits',
                'primitiveUnits',
                'spreadMethod',
                'markerWidth',
                'markerHeight',
                'refX',
                'refY',
                'orient',
                'in',
                'in2',
                'result',
                'stdDeviation',
                'mode',
                'type',
                'values',
                'operator',
                'k1',
                'k2',
                'k3',
                'k4',
                'radius',
                'flood-color',
                'flood-opacity',
                'edgeMode',
                'tableValues',
                'slope',
                'intercept',
                'amplitude',
                'exponent',
                'baseFrequency',
                'numOctaves',
                'seed',
                'stitchTiles',
                'scale',
                'xChannelSelector',
                'yChannelSelector',
                'order',
                'kernelMatrix',
                'divisor',
                'bias',
                'targetX',
                'targetY',
                'preserveAlpha',
                'surfaceScale',
                'diffuseConstant',
                'specularConstant',
                'specularExponent',
                'azimuth',
                'elevation',
                'limitingConeAngle',
                'pointsAtX',
                'pointsAtY',
                'pointsAtZ',
                'z'
            ]
        },
        allowedSchemes: getDefaultSanitizedSchemes(),
        allowedSchemesAppliedToAttributes: ['href', 'xlink:href'],
        parser: {
            lowerCaseTags: false,
            lowerCaseAttributeNames: false,
            recognizeSelfClosing: true
        }
    };
}
export function escapeHTML(stringParam) {
    if (!stringParam)
        return '';
    const entityMap = {
        '&': '&amp;',
        '<': '&lt;',
        '>': '&gt;',
        '"': '&quot;',
        '\'': '&#39;',
        '/': '&#x2F;',
        '`': '&#x60;',
        '=': '&#x3D;'
    };
    return String(stringParam).replace(/[&<>"'`=/]/g, s => entityMap[s]);
}
export function escapeAttribute(value) {
    if (!value)
        return '';
    return String(value).replace(/"/g, '&quot;');
}
export function escapeHtmlJSONStr(jsonStr) {
    if (!jsonStr)
        return '';
    return jsonStr
        .replace(/</g, '\\u003c')
        .replace(/>/g, '\\u003e')
        .replace(/&/g, '\\u0026')
        .replace(/\u2028/g, '\\u2028')
        .replace(/\u2029/g, '\\u2029');
}
//# sourceMappingURL=html.js.map