text: // This file is a part of stdlib. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
  import e from"./../../utils/define-nonenumerable-read-only-property.js";import t from"./../../vendor/process.js";import r from"./../../vendor/readable-stream.js";import i from"./../../assert/is-positive-number.js";import o from"./../../assert/is-error.js";import n from"./../../utils/copy.js";import s from"./../../utils/inherit.js";import a from"./../../utils/define-nonenumerable-property.js";import p from"./../../utils/define-read-only-accessor.js";import m from"./../../utils/define-read-write-accessor.js";import d from"./../base/chisquare.js";import u from"./../../buffer/from-string.js";import h from"./../../assert/is-plain-object.js";import g from"./../../assert/has-own-property.js";import f from"./../../assert/is-boolean.js";import c from"./../../assert/is-nonnegative-number.js";import l from"./../../assert/is-string.js";import b from"./../../assert/is-positive-integer.js";import y from"./../../assert/is-nonnegative-integer.js";import v from"./../../vendor/debug.js";var j=!1,_=null,w="\n",M=!0,E=1e308,O={objectMode:j,encoding:_,sep:w,copy:M,siter:E},T=h,P=g,k=f.isPrimitive,L=c.isPrimitive,W=l.isPrimitive,N=b.isPrimitive,S=y.isPrimitive;function V(e,t){return T(t)?P(t,"sep")&&(e.sep=t.sep,!W(e.sep))?new TypeError("invalid option. `sep` option must be a primitive string. Option: `"+e.sep+"`."):P(t,"objectMode")&&(e.objectMode=t.objectMode,!k(e.objectMode))?new TypeError("invalid option. `objectMode` option must be a primitive boolean. Option: `"+e.objectMode+"`."):P(t,"encoding")&&(e.encoding=t.encoding,!W(e.encoding)&&null!==e.encoding)?new TypeError("invalid option. `encoding` option must be a primitive string or null. Option: `"+e.encoding+"`."):P(t,"highWaterMark")&&(e.highWaterMark=t.highWaterMark,!L(e.highWaterMark))?new TypeError("invalid option. `highWaterMark` option must be a nonnegative number. Option: `"+e.highWaterMark+"`."):P(t,"iter")&&(e.iter=t.iter,!S(e.iter))?new TypeError("invalid option. `iter` option must be a nonnegative integer. Option: `"+e.iter+"`."):P(t,"siter")&&(e.siter=t.siter,!N(e.siter))?new TypeError("invalid option. `siter` option must be a positive integer. Option: `"+e.siter+"`."):(P(t,"prng")&&(e.prng=t.prng),P(t,"seed")&&(e.seed=t.seed),P(t,"state")&&(e.state=t.state),P(t,"copy")&&(e.copy=t.copy),null):new TypeError("invalid argument. Options must be an object. Value: `"+t+"`.")}var G=v,R=G("random:streams:chisquare"),q=r.Readable,x=i.isPrimitive,C=o,F=n,J=s,A=a,I=e,z=p,B=m,D=d.factory,H=u,K=O,Q=V,U=R;function X(){return this._prng.seed}function Y(){return this._prng.seedLength}function Z(){return this._prng.stateLength}function $(){return this._prng.byteLength}function ee(){return this._prng.state}function te(e){this._prng.state=e}function re(){var e,t;if(!this._destroyed)for(e=!0;e;){if(this._i+=1,this._i>this._iter)return U("Finished generating pseudorandom numbers."),this.push(null);t=this._prng(),U("Generated a new pseudorandom number. Value: %d. Iter: %d.",t,this._i),!1===this._objectMode&&(t=t.toString(),t=1===this._i?H(t):H(this._sep+t)),e=this.push(t),this._i%this._siter==0&&this.emit("state",this.state)}}function ie(e){var r;return this._destroyed?(U("Attempted to destroy an already destroyed stream."),this):(r=this,this._destroyed=!0,t.nextTick((function(){e&&(U("Stream was destroyed due to an error. Error: %s.",C(e)?e.message:JSON.stringify(e)),r.emit("error",e));U("Closing the stream..."),r.emit("close")})),this)}function oe(e,t){var r,i;if(!(this instanceof oe))return arguments.length>1?new oe(e,t):new oe(e);if(!x(e))throw new TypeError("invalid argument. First argument must be a positive number. Value: `"+e+"`.");if(r=F(K),arguments.length>1&&(i=Q(r,t)))throw i;return U("Creating a readable stream configured with the following options: %s.",JSON.stringify(r)),q.call(this,r),A(this,"_destroyed",!1),I(this,"_objectMode",r.objectMode),I(this,"_sep",r.sep),I(this,"_iter",r.iter),I(this,"_siter",r.siter),A(this,"_i",0),I(this,"_prng",D(e,r)),I(this,"PRNG",this._prng.PRNG),this}J(oe,q),z(oe.prototype,"seed",X),z(oe.prototype,"seedLength",Y),B(oe.prototype,"state",ee,te),z(oe.prototype,"stateLength",Z),z(oe.prototype,"byteLength",$),I(oe.prototype,"_read",re),I(oe.prototype,"destroy",ie);var ne=h,se=n,ae=oe;function pe(e,t){var r;if(arguments.length>1){if(!ne(r=t))throw new TypeError("invalid argument. Options must be an object. Value: `"+r+"`.");r=se(t,1)}else r={};return r.objectMode=!0,new ae(e,r)}var me=i.isPrimitive,de=n,ue=oe;function he(e,t){var r,i,o;return(r=arguments.length)>1?(o=s,i=de(t,1)):1===r?me(e)?(o=s,i={}):(i=de(e,1),o=n):(i={},o=n),o;function n(e){return new ue(e,i)}function s(){return new ue(e,i)}}var ge=e,fe=oe,ce=pe,le=he;ge(fe,"objectMode",ce),ge(fe,"factory",le);export default fe;
  //# sourceMappingURL=chisquare.js.map