/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/stackvis@0.5.0/lib/stackvis.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
var mod_assert=require("assert"),mod_jsprim=require("jsprim");function readerLookup(t){return moduleLookup("input",t).reader}function writerLookup(t){return moduleLookup("output",t)}function moduleLookup(t,s){return require("./"+t+"-"+s)}function pipeStacks(t,s,o,e,r,n,c){"function"==typeof n&&(c=n,n={}),n=n||{},collapseStacks(new o(s,t),(function(s,o){if(s)t.error(s);else{var u=mod_jsprim.deepCopy(n);u.stacks=o,u.output=r,u.log=t,e.emit(u,(function(t){t||r._isStdio||r.end(),c(t)}))}}))}function collapseStacks(t,s){var o=new StackSet;t.on("stack",(function(t,s){o.addStack(t,s)})),t.on("end",(function(){s(null,o)}))}function StackSet(){this.ss_counts={},this.ss_stacks={}}exports.readerLookup=readerLookup,exports.writerLookup=writerLookup,exports.pipeStacks=pipeStacks,StackSet.prototype.addStack=function(t,s){mod_assert.ok(Array.isArray(t)),mod_assert.equal(typeof s,"number");var o=t.join(",");this.ss_counts.hasOwnProperty(o)||(this.ss_counts[o]=0,this.ss_stacks[o]=t),this.ss_counts[o]+=s},StackSet.prototype.eachStackByCount=function(t){var s=this,o=Object.keys(this.ss_stacks);o.sort((function(t,o){return s.ss_counts[o]-s.ss_counts[t]})),o.forEach((function(o){t(s.ss_stacks[o],s.ss_counts[o])}))},StackSet.prototype.eachStackByStack=function(t){var s=this;Object.keys(this.ss_stacks).sort().forEach((function(o){t(s.ss_stacks[o],s.ss_counts[o])}))};
//# sourceMappingURL=/sm/3efd80accfb3e15794a36a0cf8e04bf6579504f8b1a1c12a0bc5461c31a662f2.map