import * as i0 from '@angular/core';
import { SecurityContext, Pipe, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import * as i1 from '@angular/platform-browser';

class BsOrdinalNumberPipe {
    constructor(domSanitizer) {
        this.domSanitizer = domSanitizer;
    }
    transform(value, ...args) {
        const sanitizeRgx = new RegExp(`[^A-Za-z]`, 'gm');
        const countWords = args.map(w => w.replace(sanitizeRgx, '')).join('|');
        const rgx = new RegExp(`\\b(?<num>[0-9]+)(?<tel>${countWords})\\b`, 'gm');
        const safeValue = this.domSanitizer.sanitize(SecurityContext.HTML, value);
        if (!safeValue)
            return '';
        const result = safeValue.replace(rgx, "$<num><sup>$<tel></sup>");
        const safeResult = this.domSanitizer.bypassSecurityTrustHtml(result);
        return safeResult;
    }
}
BsOrdinalNumberPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: BsOrdinalNumberPipe, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Pipe });
BsOrdinalNumberPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.0.4", ngImport: i0, type: BsOrdinalNumberPipe, name: "ordinalNumber" });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: BsOrdinalNumberPipe, decorators: [{
            type: Pipe,
            args: [{
                    name: 'ordinalNumber'
                }]
        }], ctorParameters: function () { return [{ type: i1.DomSanitizer }]; } });

class BsOrdinalNumberModule {
}
BsOrdinalNumberModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: BsOrdinalNumberModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
BsOrdinalNumberModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.4", ngImport: i0, type: BsOrdinalNumberModule, declarations: [BsOrdinalNumberPipe], imports: [CommonModule], exports: [BsOrdinalNumberPipe] });
BsOrdinalNumberModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: BsOrdinalNumberModule, imports: [CommonModule] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: BsOrdinalNumberModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [
                        BsOrdinalNumberPipe
                    ],
                    imports: [
                        CommonModule
                    ],
                    exports: [
                        BsOrdinalNumberPipe
                    ]
                }]
        }] });

/**
 * Generated bundle index. Do not edit.
 */

export { BsOrdinalNumberModule, BsOrdinalNumberPipe };
//# sourceMappingURL=mintplayer-ng-bootstrap-ordinal-number.mjs.map
