!function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define(b):a.printStackTrace=b()}(this,function(){function a(b){b=b||{guess:!0};var c=b.e||null,d=!!b.guess,e=new a.implementation,f=e.run(c);return d?e.guessAnonymousFunctions(f):f}return a.implementation=function(){},a.implementation.prototype={run:function(a,b){return a=a||this.createException(),b=b||this.mode(a),"other"===b?this.other(arguments.callee):this[b](a)},createException:function(){try{this.undef()}catch(a){return a}},mode:function(a){return a.arguments&&a.stack?"chrome":a.stack&&a.sourceURL?"safari":a.stack&&a.number?"ie":a.stack&&a.fileName?"firefox":a.message&&a["opera#sourceloc"]?a.stacktrace?a.message.indexOf("\n")>-1&&a.message.split("\n").length>a.stacktrace.split("\n").length?"opera9":"opera10a":"opera9":a.message&&a.stack&&a.stacktrace?a.stacktrace.indexOf("called from line")<0?"opera10b":"opera11":a.stack&&!a.fileName?"chrome":"other"},instrumentFunction:function(b,c,d){b=b||window;var e=b[c];b[c]=function(){return d.call(this,a().slice(4)),b[c]._instrumented.apply(this,arguments)},b[c]._instrumented=e},deinstrumentFunction:function(a,b){a[b].constructor===Function&&a[b]._instrumented&&a[b]._instrumented.constructor===Function&&(a[b]=a[b]._instrumented)},chrome:function(a){return(a.stack+"\n").replace(/^[\s\S]+?\s+at\s+/," at ").replace(/^\s+(at eval )?at\s+/gm,"").replace(/^([^\(]+?)([\n$])/gm,"{anonymous}() ($1)$2").replace(/^Object.\s*\(([^\)]+)\)/gm,"{anonymous}() ($1)").replace(/^(.+) \((.+)\)$/gm,"$1@$2").split("\n").slice(0,-1)},safari:function(a){return a.stack.replace(/\[native code\]\n/m,"").replace(/^(?=\w+Error\:).*$\n/m,"").replace(/^@/gm,"{anonymous}()@").split("\n")},ie:function(a){return a.stack.replace(/^\s*at\s+(.*)$/gm,"$1").replace(/^Anonymous function\s+/gm,"{anonymous}() ").replace(/^(.+)\s+\((.+)\)$/gm,"$1@$2").split("\n").slice(1)},firefox:function(a){return a.stack.replace(/(?:\n@:0)?\s+$/m,"").replace(/^(?:\((\S*)\))?@/gm,"{anonymous}($1)@").split("\n")},opera11:function(a){for(var b="{anonymous}",c=/^.*line (\d+), column (\d+)(?: in (.+))? in (\S+):$/,d=a.stacktrace.split("\n"),e=[],f=0,g=d.length;g>f;f+=2){var h=c.exec(d[f]);if(h){var i=h[4]+":"+h[1]+":"+h[2],j=h[3]||"global code";j=j.replace(//,"$1").replace(//,b),e.push(j+"@"+i+" -- "+d[f+1].replace(/^\s+/,""))}}return e},opera10b:function(a){for(var b=/^(.*)@(.+):(\d+)$/,c=a.stacktrace.split("\n"),d=[],e=0,f=c.length;f>e;e++){var g=b.exec(c[e]);if(g){var h=g[1]?g[1]+"()":"global code";d.push(h+"@"+g[2]+":"+g[3])}}return d},opera10a:function(a){for(var b="{anonymous}",c=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,d=a.stacktrace.split("\n"),e=[],f=0,g=d.length;g>f;f+=2){var h=c.exec(d[f]);if(h){var i=h[3]||b;e.push(i+"()@"+h[2]+":"+h[1]+" -- "+d[f+1].replace(/^\s+/,""))}}return e},opera9:function(a){for(var b="{anonymous}",c=/Line (\d+).*script (?:in )?(\S+)/i,d=a.message.split("\n"),e=[],f=2,g=d.length;g>f;f+=2){var h=c.exec(d[f]);h&&e.push(b+"()@"+h[2]+":"+h[1]+" -- "+d[f+1].replace(/^\s+/,""))}return e},other:function(a){for(var e,f,b="{anonymous}",c=/function(?:\s+([\w$]+))?\s*\(/,d=[],g=10,h=Array.prototype.slice;a&&d.lengthk;++k)if(g=a[b-k-1],j=g.indexOf("//"),j>=0&&(g=g.substr(0,j)),g){if(f=g+f,i=d.exec(f),i&&i[1])return i[1];if(i=c.exec(f),i&&i[1])return i[1];if(i=e.exec(f),i&&i[1])return i[1]}return"(?)"}},a});