'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var core = require('@tiptap/core');

const emDash = core.textInputRule({
    find: /--$/,
    replace: '—',
});
const ellipsis = core.textInputRule({
    find: /\.\.\.$/,
    replace: '…',
});
const openDoubleQuote = core.textInputRule({
    find: /(?:^|[\s{[(<'"\u2018\u201C])(")$/,
    replace: '“',
});
const closeDoubleQuote = core.textInputRule({
    find: /"$/,
    replace: '”',
});
const openSingleQuote = core.textInputRule({
    find: /(?:^|[\s{[(<'"\u2018\u201C])(')$/,
    replace: '‘',
});
const closeSingleQuote = core.textInputRule({
    find: /'$/,
    replace: '’',
});
const leftArrow = core.textInputRule({
    find: /<-$/,
    replace: '←',
});
const rightArrow = core.textInputRule({
    find: /->$/,
    replace: '→',
});
const copyright = core.textInputRule({
    find: /\(c\)$/,
    replace: '©',
});
const trademark = core.textInputRule({
    find: /\(tm\)$/,
    replace: '™',
});
const servicemark = core.textInputRule({
    find: /\(sm\)$/,
    replace: '℠',
});
const registeredTrademark = core.textInputRule({
    find: /\(r\)$/,
    replace: '®',
});
const oneHalf = core.textInputRule({
    find: /1\/2$/,
    replace: '½',
});
const plusMinus = core.textInputRule({
    find: /\+\/-$/,
    replace: '±',
});
const notEqual = core.textInputRule({
    find: /!=$/,
    replace: '≠',
});
const laquo = core.textInputRule({
    find: /<<$/,
    replace: '«',
});
const raquo = core.textInputRule({
    find: />>$/,
    replace: '»',
});
const multiplication = core.textInputRule({
    find: /\d+\s?([*x])\s?\d+$/,
    replace: '×',
});
const superscriptTwo = core.textInputRule({
    find: /\^2$/,
    replace: '²',
});
const superscriptThree = core.textInputRule({
    find: /\^3$/,
    replace: '³',
});
const oneQuarter = core.textInputRule({
    find: /1\/4$/,
    replace: '¼',
});
const threeQuarters = core.textInputRule({
    find: /3\/4$/,
    replace: '¾',
});
const Typography = core.Extension.create({
    name: 'typography',
    addInputRules() {
        const rules = [];
        if (this.options.emDash !== false) {
            rules.push(emDash);
        }
        if (this.options.ellipsis !== false) {
            rules.push(ellipsis);
        }
        if (this.options.openDoubleQuote !== false) {
            rules.push(openDoubleQuote);
        }
        if (this.options.closeDoubleQuote !== false) {
            rules.push(closeDoubleQuote);
        }
        if (this.options.openSingleQuote !== false) {
            rules.push(openSingleQuote);
        }
        if (this.options.closeSingleQuote !== false) {
            rules.push(closeSingleQuote);
        }
        if (this.options.leftArrow !== false) {
            rules.push(leftArrow);
        }
        if (this.options.rightArrow !== false) {
            rules.push(rightArrow);
        }
        if (this.options.copyright !== false) {
            rules.push(copyright);
        }
        if (this.options.trademark !== false) {
            rules.push(trademark);
        }
        if (this.options.servicemark !== false) {
            rules.push(servicemark);
        }
        if (this.options.registeredTrademark !== false) {
            rules.push(registeredTrademark);
        }
        if (this.options.oneHalf !== false) {
            rules.push(oneHalf);
        }
        if (this.options.plusMinus !== false) {
            rules.push(plusMinus);
        }
        if (this.options.notEqual !== false) {
            rules.push(notEqual);
        }
        if (this.options.laquo !== false) {
            rules.push(laquo);
        }
        if (this.options.raquo !== false) {
            rules.push(raquo);
        }
        if (this.options.multiplication !== false) {
            rules.push(multiplication);
        }
        if (this.options.superscriptTwo !== false) {
            rules.push(superscriptTwo);
        }
        if (this.options.superscriptThree !== false) {
            rules.push(superscriptThree);
        }
        if (this.options.oneQuarter !== false) {
            rules.push(oneQuarter);
        }
        if (this.options.threeQuarters !== false) {
            rules.push(threeQuarters);
        }
        return rules;
    },
});

exports.Typography = Typography;
exports.closeDoubleQuote = closeDoubleQuote;
exports.closeSingleQuote = closeSingleQuote;
exports.copyright = copyright;
exports["default"] = Typography;
exports.ellipsis = ellipsis;
exports.emDash = emDash;
exports.laquo = laquo;
exports.leftArrow = leftArrow;
exports.multiplication = multiplication;
exports.notEqual = notEqual;
exports.oneHalf = oneHalf;
exports.oneQuarter = oneQuarter;
exports.openDoubleQuote = openDoubleQuote;
exports.openSingleQuote = openSingleQuote;
exports.plusMinus = plusMinus;
exports.raquo = raquo;
exports.registeredTrademark = registeredTrademark;
exports.rightArrow = rightArrow;
exports.servicemark = servicemark;
exports.superscriptThree = superscriptThree;
exports.superscriptTwo = superscriptTwo;
exports.threeQuarters = threeQuarters;
exports.trademark = trademark;
//# sourceMappingURL=tiptap-extension-typography.cjs.map
