"use strict";var _typeof=require("./typeof"),wrapNativeSuper=require("./wrapNativeSuper"),getPrototypeOf=require("./getPrototypeOf"),possibleConstructorReturn=require("./possibleConstructorReturn"),inherits=require("./inherits");function _wrapRegExp(e,r){module.exports=_wrapRegExp=function(e,r){return new o(e,void 0,r)};var t=wrapNativeSuper(RegExp),p=RegExp.prototype,n=new WeakMap;function o(e,r,p){var o=t.call(this,e,r);return n.set(o,p||n.get(e)),o}function i(e,r){var t=n.get(r);return Object.keys(t).reduce(function(r,p){return r[p]=e[t[p]],r},Object.create(null))}return inherits(o,t),o.prototype.exec=function(e){var r=p.exec.call(this,e);return r&&(r.groups=i(r,this)),r},o.prototype[Symbol.replace]=function(e,r){if("string"==typeof r){var t=n.get(this);return p[Symbol.replace].call(this,e,r.replace(/\$<([^>]+)>/g,function(e,r){return"$"+t[r]}))}if("function"==typeof r){var o=this;return p[Symbol.replace].call(this,e,function(){var e=[];return e.push.apply(e,arguments),"object"!==_typeof(e[e.length-1])&&e.push(i(e,o)),r.apply(this,e)})}return p[Symbol.replace].call(this,e,r)},_wrapRegExp.apply(this,arguments)}module.exports=_wrapRegExp;