System.register(["__unresolved_0", "__unresolved_1", "__unresolved_2", "__unresolved_3", "__unresolved_4", "__unresolved_5", "__unresolved_6", "__unresolved_7", "__unresolved_8", "__unresolved_9", "__unresolved_10", "__unresolved_11", "__unresolved_12", "__unresolved_13", "__unresolved_14", "__unresolved_15", "__unresolved_16", "__unresolved_17", "__unresolved_18", "__unresolved_19", "__unresolved_20", "__unresolved_21"], function (_export, _context) {
  "use strict";

  var _req, _req2, _req3, _req4, _req5, _req6, _req7, _req8, _req9, _req10, _req11, _req12, _req13, _req14, _req15, _req16, _req17, _req18, _req19, _req20, _req21, _loader, _cjsExports, __cjsMetaURL;

  _export("default", void 0);

  return {
    setters: [function (_unresolved_) {
      _req = _unresolved_.__cjsMetaURL;
    }, function (_unresolved_2) {
      _req2 = _unresolved_2.__cjsMetaURL;
    }, function (_unresolved_3) {
      _req3 = _unresolved_3.__cjsMetaURL;
    }, function (_unresolved_4) {
      _req4 = _unresolved_4.__cjsMetaURL;
    }, function (_unresolved_5) {
      _req5 = _unresolved_5.__cjsMetaURL;
    }, function (_unresolved_6) {
      _req6 = _unresolved_6.__cjsMetaURL;
    }, function (_unresolved_7) {
      _req7 = _unresolved_7.__cjsMetaURL;
    }, function (_unresolved_8) {
      _req8 = _unresolved_8.__cjsMetaURL;
    }, function (_unresolved_9) {
      _req9 = _unresolved_9.__cjsMetaURL;
    }, function (_unresolved_10) {
      _req10 = _unresolved_10.__cjsMetaURL;
    }, function (_unresolved_11) {
      _req11 = _unresolved_11.__cjsMetaURL;
    }, function (_unresolved_12) {
      _req12 = _unresolved_12.__cjsMetaURL;
    }, function (_unresolved_13) {
      _req13 = _unresolved_13.__cjsMetaURL;
    }, function (_unresolved_14) {
      _req14 = _unresolved_14.__cjsMetaURL;
    }, function (_unresolved_15) {
      _req15 = _unresolved_15.__cjsMetaURL;
    }, function (_unresolved_16) {
      _req16 = _unresolved_16.__cjsMetaURL;
    }, function (_unresolved_17) {
      _req17 = _unresolved_17.__cjsMetaURL;
    }, function (_unresolved_18) {
      _req18 = _unresolved_18.__cjsMetaURL;
    }, function (_unresolved_19) {
      _req19 = _unresolved_19.__cjsMetaURL;
    }, function (_unresolved_20) {
      _req20 = _unresolved_20.__cjsMetaURL;
    }, function (_unresolved_21) {
      _req21 = _unresolved_21.__cjsMetaURL;
    }, function (_unresolved_22) {
      _loader = _unresolved_22.default;
    }],
    execute: function () {
      _loader.define(_context.meta.url, function (exports, _require, module, __filename, __dirname) {
        let require = _loader.createRequireWithReqMap({
          "../internals/descriptors": _req,
          "../internals/global": _req2,
          "../internals/function-uncurry-this": _req3,
          "../internals/is-forced": _req4,
          "../internals/inherit-if-required": _req5,
          "../internals/create-non-enumerable-property": _req6,
          "../internals/object-define-property": _req7,
          "../internals/object-get-own-property-names": _req8,
          "../internals/object-is-prototype-of": _req9,
          "../internals/is-regexp": _req10,
          "../internals/to-string": _req11,
          "../internals/regexp-flags": _req12,
          "../internals/regexp-sticky-helpers": _req13,
          "../internals/redefine": _req14,
          "../internals/fails": _req15,
          "../internals/has-own-property": _req16,
          "../internals/internal-state": _req17,
          "../internals/set-species": _req18,
          "../internals/well-known-symbol": _req19,
          "../internals/regexp-unsupported-dot-all": _req20,
          "../internals/regexp-unsupported-ncg": _req21
        }, _require);

        (function () {
          var DESCRIPTORS = require('../internals/descriptors');

          var global = require('../internals/global');

          var uncurryThis = require('../internals/function-uncurry-this');

          var isForced = require('../internals/is-forced');

          var inheritIfRequired = require('../internals/inherit-if-required');

          var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');

          var defineProperty = require('../internals/object-define-property').f;

          var getOwnPropertyNames = require('../internals/object-get-own-property-names').f;

          var isPrototypeOf = require('../internals/object-is-prototype-of');

          var isRegExp = require('../internals/is-regexp');

          var toString = require('../internals/to-string');

          var regExpFlags = require('../internals/regexp-flags');

          var stickyHelpers = require('../internals/regexp-sticky-helpers');

          var redefine = require('../internals/redefine');

          var fails = require('../internals/fails');

          var hasOwn = require('../internals/has-own-property');

          var enforceInternalState = require('../internals/internal-state').enforce;

          var setSpecies = require('../internals/set-species');

          var wellKnownSymbol = require('../internals/well-known-symbol');

          var UNSUPPORTED_DOT_ALL = require('../internals/regexp-unsupported-dot-all');

          var UNSUPPORTED_NCG = require('../internals/regexp-unsupported-ncg');

          var MATCH = wellKnownSymbol('match');
          var NativeRegExp = global.RegExp;
          var RegExpPrototype = NativeRegExp.prototype;
          var SyntaxError = global.SyntaxError;
          var getFlags = uncurryThis(regExpFlags);
          var exec = uncurryThis(RegExpPrototype.exec);
          var charAt = uncurryThis(''.charAt);
          var replace = uncurryThis(''.replace);
          var stringIndexOf = uncurryThis(''.indexOf);
          var stringSlice = uncurryThis(''.slice); // TODO: Use only propper RegExpIdentifierName

          var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/;
          var re1 = /a/g;
          var re2 = /a/g; // "new" should create a new object, old webkit bug

          var CORRECT_NEW = new NativeRegExp(re1) !== re1;
          var MISSED_STICKY = stickyHelpers.MISSED_STICKY;
          var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y;
          var BASE_FORCED = DESCRIPTORS && (!CORRECT_NEW || MISSED_STICKY || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG || fails(function () {
            re2[MATCH] = false; // RegExp constructor can alter flags and IsRegExp works correct with @@match

            return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i';
          }));

          var handleDotAll = function (string) {
            var length = string.length;
            var index = 0;
            var result = '';
            var brackets = false;
            var chr;

            for (; index <= length; index++) {
              chr = charAt(string, index);

              if (chr === '\\') {
                result += chr + charAt(string, ++index);
                continue;
              }

              if (!brackets && chr === '.') {
                result += '[\\s\\S]';
              } else {
                if (chr === '[') {
                  brackets = true;
                } else if (chr === ']') {
                  brackets = false;
                }

                result += chr;
              }
            }

            return result;
          };

          var handleNCG = function (string) {
            var length = string.length;
            var index = 0;
            var result = '';
            var named = [];
            var names = {};
            var brackets = false;
            var ncg = false;
            var groupid = 0;
            var groupname = '';
            var chr;

            for (; index <= length; index++) {
              chr = charAt(string, index);

              if (chr === '\\') {
                chr = chr + charAt(string, ++index);
              } else if (chr === ']') {
                brackets = false;
              } else if (!brackets) switch (true) {
                case chr === '[':
                  brackets = true;
                  break;

                case chr === '(':
                  if (exec(IS_NCG, stringSlice(string, index + 1))) {
                    index += 2;
                    ncg = true;
                  }

                  result += chr;
                  groupid++;
                  continue;

                case chr === '>' && ncg:
                  if (groupname === '' || hasOwn(names, groupname)) {
                    throw new SyntaxError('Invalid capture group name');
                  }

                  names[groupname] = true;
                  named[named.length] = [groupname, groupid];
                  ncg = false;
                  groupname = '';
                  continue;
              }

              if (ncg) groupname += chr;else result += chr;
            }

            return [result, named];
          }; // `RegExp` constructor
          // https://tc39.es/ecma262/#sec-regexp-constructor


          if (isForced('RegExp', BASE_FORCED)) {
            var RegExpWrapper = function RegExp(pattern, flags) {
              var thisIsRegExp = isPrototypeOf(RegExpPrototype, this);
              var patternIsRegExp = isRegExp(pattern);
              var flagsAreUndefined = flags === undefined;
              var groups = [];
              var rawPattern = pattern;
              var rawFlags, dotAll, sticky, handled, result, state;

              if (!thisIsRegExp && patternIsRegExp && flagsAreUndefined && pattern.constructor === RegExpWrapper) {
                return pattern;
              }

              if (patternIsRegExp || isPrototypeOf(RegExpPrototype, pattern)) {
                pattern = pattern.source;
                if (flagsAreUndefined) flags = 'flags' in rawPattern ? rawPattern.flags : getFlags(rawPattern);
              }

              pattern = pattern === undefined ? '' : toString(pattern);
              flags = flags === undefined ? '' : toString(flags);
              rawPattern = pattern;

              if (UNSUPPORTED_DOT_ALL && 'dotAll' in re1) {
                dotAll = !!flags && stringIndexOf(flags, 's') > -1;
                if (dotAll) flags = replace(flags, /s/g, '');
              }

              rawFlags = flags;

              if (MISSED_STICKY && 'sticky' in re1) {
                sticky = !!flags && stringIndexOf(flags, 'y') > -1;
                if (sticky && UNSUPPORTED_Y) flags = replace(flags, /y/g, '');
              }

              if (UNSUPPORTED_NCG) {
                handled = handleNCG(pattern);
                pattern = handled[0];
                groups = handled[1];
              }

              result = inheritIfRequired(NativeRegExp(pattern, flags), thisIsRegExp ? this : RegExpPrototype, RegExpWrapper);

              if (dotAll || sticky || groups.length) {
                state = enforceInternalState(result);

                if (dotAll) {
                  state.dotAll = true;
                  state.raw = RegExpWrapper(handleDotAll(pattern), rawFlags);
                }

                if (sticky) state.sticky = true;
                if (groups.length) state.groups = groups;
              }

              if (pattern !== rawPattern) try {
                // fails in old engines, but we have no alternatives for unsupported regex syntax
                createNonEnumerableProperty(result, 'source', rawPattern === '' ? '(?:)' : rawPattern);
              } catch (error) {
                /* empty */
              }
              return result;
            };

            var proxy = function (key) {
              key in RegExpWrapper || defineProperty(RegExpWrapper, key, {
                configurable: true,
                get: function () {
                  return NativeRegExp[key];
                },
                set: function (it) {
                  NativeRegExp[key] = it;
                }
              });
            };

            for (var keys = getOwnPropertyNames(NativeRegExp), index = 0; keys.length > index;) {
              proxy(keys[index++]);
            }

            RegExpPrototype.constructor = RegExpWrapper;
            RegExpWrapper.prototype = RegExpPrototype;
            redefine(global, 'RegExp', RegExpWrapper);
          } // https://tc39.es/ecma262/#sec-get-regexp-@@species


          setSpecies('RegExp');
        })();

        _export("default", _cjsExports = module.exports);
      });

      _export("__cjsMetaURL", __cjsMetaURL = _context.meta.url);
    }
  };
});
//# sourceMappingURL=es.regexp.constructor.js.map