pts 0.10.3 → 0.10.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es5.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * pts.js 0.10.3 - Copyright © 2017-2021 William Ngan and contributors.
2
+ * pts.js 0.10.7 - Copyright © 2017-2021 William Ngan and contributors.
3
3
  * Licensed under Apache 2.0 License.
4
4
  * See https://github.com/williamngan/pts for details.
5
5
  */
@@ -211,7 +211,7 @@ var CanvasSpace = function (_Space_1$MultiTouchSp) {
211
211
  }, {
212
212
  key: "setup",
213
213
  value: function setup(opt) {
214
- if (opt.bgcolor) this._bgcolor = opt.bgcolor;
214
+ this._bgcolor = opt.bgcolor ? opt.bgcolor : "transparent";
215
215
  this.autoResize = opt.resize != undefined ? opt.resize : false;
216
216
  if (opt.retina !== false) {
217
217
  var r1 = window ? window.devicePixelRatio || 1 : 1;
@@ -225,6 +225,9 @@ var CanvasSpace = function (_Space_1$MultiTouchSp) {
225
225
  } else {
226
226
  this._offscreen = false;
227
227
  }
228
+ if (opt.pixelDensity) {
229
+ this._pixelScale = opt.pixelDensity;
230
+ }
228
231
  return this;
229
232
  }
230
233
  }, {
@@ -276,16 +279,14 @@ var CanvasSpace = function (_Space_1$MultiTouchSp) {
276
279
  value: function clear(bg) {
277
280
  if (bg) this._bgcolor = bg;
278
281
  var lastColor = this._ctx.fillStyle;
279
- if (this._bgcolor) {
280
- if (this._bgcolor === "transparent") {
282
+ if (!this._bgcolor || this._bgcolor === "transparent") {
283
+ this._ctx.clearRect(-1, -1, this._canvas.width + 1, this._canvas.height + 1);
284
+ } else {
285
+ if (this._bgcolor.indexOf("rgba") === 0 || this._bgcolor.length === 9 && this._bgcolor.indexOf("#") === 0) {
281
286
  this._ctx.clearRect(-1, -1, this._canvas.width + 1, this._canvas.height + 1);
282
- } else {
283
- if (this._bgcolor.indexOf("rgba") === 0 || this._bgcolor.length === 9 && this._bgcolor.indexOf("#") === 0) {
284
- this._ctx.clearRect(-1, -1, this._canvas.width + 1, this._canvas.height + 1);
285
- }
286
- this._ctx.fillStyle = this._bgcolor;
287
- this._ctx.fillRect(-1, -1, this._canvas.width + 1, this._canvas.height + 1);
288
287
  }
288
+ this._ctx.fillStyle = this._bgcolor;
289
+ this._ctx.fillRect(-1, -1, this._canvas.width + 1, this._canvas.height + 1);
289
290
  }
290
291
  this._ctx.fillStyle = lastColor;
291
292
  return this;
@@ -324,6 +325,28 @@ var CanvasSpace = function (_Space_1$MultiTouchSp) {
324
325
  this.removeAll();
325
326
  return this;
326
327
  }
328
+ }, {
329
+ key: "recorder",
330
+ value: function recorder(downloadOrCallback) {
331
+ var filetype = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "webm";
332
+ var bitrate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 15000000;
333
+
334
+ var stream = this._canvas.captureStream();
335
+ var recorder = new MediaRecorder(stream, { mimeType: "video/" + filetype, bitsPerSecond: bitrate });
336
+ recorder.ondataavailable = function (d) {
337
+ var url = URL.createObjectURL(new Blob([d.data], { type: "video/" + filetype }));
338
+ if (typeof downloadOrCallback === "function") {
339
+ downloadOrCallback(url);
340
+ } else if (downloadOrCallback) {
341
+ var a = document.createElement("a");
342
+ a.href = url;
343
+ a.download = "canvas_video." + filetype;
344
+ a.click();
345
+ a.remove();
346
+ }
347
+ };
348
+ return recorder;
349
+ }
327
350
  }, {
328
351
  key: "autoResize",
329
352
  set: function set(auto) {
@@ -397,6 +420,8 @@ var CanvasForm = function (_Form_1$VisualForm) {
397
420
  _inherits(CanvasForm, _Form_1$VisualForm);
398
421
 
399
422
  function CanvasForm(space) {
423
+ var _ret;
424
+
400
425
  _classCallCheck(this, CanvasForm);
401
426
 
402
427
  var _this2 = _possibleConstructorReturn(this, (CanvasForm.__proto__ || Object.getPrototypeOf(CanvasForm)).call(this));
@@ -406,15 +431,23 @@ var CanvasForm = function (_Form_1$VisualForm) {
406
431
  lineWidth: 1, lineJoin: "bevel", lineCap: "butt",
407
432
  globalAlpha: 1
408
433
  };
409
- _this2._space = space;
410
- _this2._space.add({ start: function start() {
411
- _this2._ctx = _this2._space.ctx;
412
- _this2._ctx.fillStyle = _this2._style.fillStyle;
413
- _this2._ctx.strokeStyle = _this2._style.strokeStyle;
414
- _this2._ctx.lineJoin = "bevel";
415
- _this2._ctx.font = _this2._font.value;
416
- _this2._ready = true;
417
- } });
434
+ if (!space) return _ret = _this2, _possibleConstructorReturn(_this2, _ret);
435
+ var _setup = function _setup(ctx) {
436
+ _this2._ctx = ctx;
437
+ _this2._ctx.fillStyle = _this2._style.fillStyle;
438
+ _this2._ctx.strokeStyle = _this2._style.strokeStyle;
439
+ _this2._ctx.lineJoin = "bevel";
440
+ _this2._ctx.font = _this2._font.value;
441
+ _this2._ready = true;
442
+ };
443
+ if (space instanceof CanvasRenderingContext2D) {
444
+ _setup(space);
445
+ } else {
446
+ _this2._space = space;
447
+ _this2._space.add({ start: function start() {
448
+ _setup(_this2._space.ctx);
449
+ } });
450
+ }
418
451
  return _this2;
419
452
  }
420
453
 
@@ -800,16 +833,6 @@ var CanvasForm = function (_Form_1$VisualForm) {
800
833
  return this._space.ctx;
801
834
  }
802
835
  }], [{
803
- key: "paint",
804
- value: function paint(ctx, fn, fill, stroke, strokeWidth) {
805
- if (fill) ctx.fillStyle = fill;
806
- if (stroke) ctx.strokeStyle = stroke;
807
- if (strokeWidth) ctx.lineWidth = strokeWidth;
808
- fn(ctx);
809
- ctx.fill();
810
- ctx.stroke();
811
- }
812
- }, {
813
836
  key: "point",
814
837
  value: function point(ctx, p) {
815
838
  var radius = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 5;
@@ -1067,9 +1090,9 @@ var Color = function (_Pt_1$Pt) {
1067
1090
  };
1068
1091
  return "#" + _hex(this[0]) + _hex(this[1]) + _hex(this[2]);
1069
1092
  } else if (format == "rgba") {
1070
- return "rgba(" + Math.floor(this[0]) + "," + Math.floor(this[1]) + "," + Math.floor(this[2]) + "," + this.alpha;
1093
+ return "rgba(" + Math.floor(this[0]) + "," + Math.floor(this[1]) + "," + Math.floor(this[2]) + "," + this.alpha + ")";
1071
1094
  } else if (format == "rgb") {
1072
- return "rgb(" + Math.floor(this[0]) + "," + Math.floor(this[1]) + "," + Math.floor(this[2]);
1095
+ return "rgb(" + Math.floor(this[0]) + "," + Math.floor(this[1]) + "," + Math.floor(this[2]) + ")";
1073
1096
  } else {
1074
1097
  return this._mode + "(" + this[0] + "," + this[1] + "," + this[2] + "," + this.alpha + ")";
1075
1098
  }
@@ -1460,9 +1483,9 @@ var Color = function (_Pt_1$Pt) {
1460
1483
  y = _ref7[1],
1461
1484
  z = _ref7[2];
1462
1485
 
1463
- var rgb = [x * 3.2404542 + y * -1.5371385 + z * -0.4985314, x * -0.9692660 + y * 1.8760108 + z * 0.0415560, x * 0.0556434 + y * -0.2040259 + z * 1.0572252];
1486
+ var rgb = [x * 3.2406254773200533 + y * -1.5372079722103187 + z * -0.4986285986982479, x * -0.9689307147293197 + y * 1.8757560608852415 + z * 0.041517523842953964, x * 0.055710120445510616 + y * -0.2040210505984867 + z * 1.0569959422543882];
1464
1487
  for (var i = 0; i < 3; i++) {
1465
- rgb[i] = rgb[i] < 0 ? 0 : rgb[i] > 0.0031308 ? 1.055 * Math.pow(rgb[i], 1 / 2.4) - 0.055 : 12.92 * rgb[i];
1488
+ rgb[i] = rgb[i] > 0.0031308 ? 1.055 * Math.pow(rgb[i], 1 / 2.4) - 0.055 : 12.92 * rgb[i];
1466
1489
  rgb[i] = Math.max(0, Math.min(1, rgb[i]));
1467
1490
  if (!normalizedOutput) rgb[i] = Math.round(rgb[i] * 255);
1468
1491
  }
@@ -1476,9 +1499,11 @@ var Color = function (_Pt_1$Pt) {
1476
1499
  var normalizedOutput = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
1477
1500
 
1478
1501
  var c = normalizedInput ? xyz.$normalize(false) : xyz.clone();
1502
+ var eps = 0.00885645167;
1503
+ var kap = 903.296296296;
1479
1504
  c.divide(Color.D65);
1480
1505
  var fn = function fn(n) {
1481
- return n > 0.008856 ? Math.pow(n, 1 / 3) : 7.787 * n + 16 / 116;
1506
+ return n > eps ? Math.pow(n, 1 / 3) : (kap * n + 16) / 116;
1482
1507
  };
1483
1508
  var cy = fn(c[1]);
1484
1509
  var cc = Color.lab(116 * cy - 16, 500 * (fn(c[0]) - cy), 200 * (cy - fn(c[2])), xyz.alpha);
@@ -1494,12 +1519,12 @@ var Color = function (_Pt_1$Pt) {
1494
1519
  var y = (c[0] + 16) / 116;
1495
1520
  var x = c[1] / 500 + y;
1496
1521
  var z = y - c[2] / 200;
1497
- var fn = function fn(n) {
1498
- var nnn = n * n * n;
1499
- return nnn > 0.008856 ? nnn : (n - 16 / 116) / 7.787;
1500
- };
1522
+ var eps = 0.00885645167;
1523
+ var kap = 903.296296296;
1501
1524
  var d = Color.D65;
1502
- var cc = Color.xyz(Math.max(0, d[0] * fn(x)), Math.max(0, d[1] * fn(y)), Math.max(0, d[2] * fn(z)), lab.alpha);
1525
+ var xxx = Math.pow(x, 3);
1526
+ var zzz = Math.pow(z, 3);
1527
+ var cc = Color.xyz(d[0] * (xxx > eps ? xxx : (116 * x - 16) / kap), d[1] * (c[0] > kap * eps ? Math.pow((c[0] + 16) / 116, 3) : c[0] / kap), d[2] * (zzz > eps ? zzz : (116 * z - 16) / kap), lab.alpha);
1503
1528
  return normalizedOutput ? cc.normalize() : cc;
1504
1529
  }
1505
1530
  }, {
@@ -1625,9 +1650,9 @@ var Create = function () {
1625
1650
 
1626
1651
  var pts = new Pt_1.Group();
1627
1652
  for (var i = 0; i < count; i++) {
1628
- var p = [bound.x + Math.random() * bound.width];
1629
- if (dimensions > 1) p.push(bound.y + Math.random() * bound.height);
1630
- if (dimensions > 2) p.push(bound.z + Math.random() * bound.depth);
1653
+ var p = [bound.x + Num_1.Num.random() * bound.width];
1654
+ if (dimensions > 1) p.push(bound.y + Num_1.Num.random() * bound.height);
1655
+ if (dimensions > 2) p.push(bound.z + Num_1.Num.random() * bound.depth);
1631
1656
  pts.push(new Pt_1.Pt(p));
1632
1657
  }
1633
1658
  return pts;
@@ -1690,7 +1715,7 @@ var Create = function () {
1690
1715
  var rows = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
1691
1716
  var columns = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
1692
1717
 
1693
- var seed = Math.random();
1718
+ var seed = Num_1.Num.random();
1694
1719
  var g = new Pt_1.Group();
1695
1720
  var i = 0;
1696
1721
  var _iteratorNormalCompletion = true;
@@ -2819,6 +2844,7 @@ var Img = function () {
2819
2844
  function Img() {
2820
2845
  var editable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
2821
2846
  var pixelScale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
2847
+ var crossOrigin = arguments[2];
2822
2848
 
2823
2849
  _classCallCheck(this, Img);
2824
2850
 
@@ -2827,6 +2853,7 @@ var Img = function () {
2827
2853
  this._editable = editable;
2828
2854
  this._scale = pixelScale;
2829
2855
  this._img = new Image();
2856
+ if (crossOrigin) this._img.crossOrigin = "Anonymous";
2830
2857
  }
2831
2858
 
2832
2859
  _createClass(Img, [{
@@ -2911,13 +2938,33 @@ var Img = function () {
2911
2938
  key: "filter",
2912
2939
  value: function filter(css) {
2913
2940
  this._ctx.filter = css;
2941
+ this._ctx.drawImage(this._cv, 0, 0);
2942
+ this._ctx.filter = "none";
2914
2943
  return this;
2915
2944
  }
2945
+ }, {
2946
+ key: "cleanup",
2947
+ value: function cleanup() {
2948
+ if (this._cv) this._cv.remove();
2949
+ if (this._img) this._img.remove();
2950
+ this._data = null;
2951
+ }
2916
2952
  }, {
2917
2953
  key: "toBase64",
2918
2954
  value: function toBase64() {
2919
2955
  return this._cv.toDataURL();
2920
2956
  }
2957
+ }, {
2958
+ key: "toBlob",
2959
+ value: function toBlob() {
2960
+ var _this3 = this;
2961
+
2962
+ return new Promise(function (resolve) {
2963
+ _this3._cv.toBlob(function (blob) {
2964
+ return resolve(blob);
2965
+ });
2966
+ });
2967
+ }
2921
2968
  }, {
2922
2969
  key: "current",
2923
2970
  get: function get() {
@@ -2990,9 +3037,24 @@ var Img = function () {
2990
3037
  key: "fromBlob",
2991
3038
  value: function fromBlob(blob) {
2992
3039
  var editable = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3040
+ var pixelScale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
2993
3041
 
2994
3042
  var url = URL.createObjectURL(blob);
2995
- return new Img(editable).load(url);
3043
+ return new Img(editable, pixelScale).load(url);
3044
+ }
3045
+ }, {
3046
+ key: "imageDataToBlob",
3047
+ value: function imageDataToBlob(data) {
3048
+ return new Promise(function (resolve) {
3049
+ var cv = document.createElement("canvas");
3050
+ cv.width = data.width;
3051
+ cv.height = data.height;
3052
+ cv.getContext("2d").putImageData(data, 0, 0);
3053
+ cv.toBlob(function (blob) {
3054
+ resolve(blob);
3055
+ cv.remove();
3056
+ });
3057
+ });
2996
3058
  }
2997
3059
  }]);
2998
3060
 
@@ -3371,6 +3433,7 @@ var Util_1 = __webpack_require__(/*! ./Util */ "./src/Util.ts");
3371
3433
  var Op_1 = __webpack_require__(/*! ./Op */ "./src/Op.ts");
3372
3434
  var Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
3373
3435
  var LinearAlgebra_1 = __webpack_require__(/*! ./LinearAlgebra */ "./src/LinearAlgebra.ts");
3436
+ var uheprng_1 = __webpack_require__(/*! ./uheprng */ "./src/uheprng.ts");
3374
3437
 
3375
3438
  var Num = function () {
3376
3439
  function Num() {
@@ -3413,7 +3476,7 @@ var Num = function () {
3413
3476
  var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3414
3477
 
3415
3478
  var r = a > b ? a - b : b - a;
3416
- return a + Math.random() * r;
3479
+ return a + Num.random() * r;
3417
3480
  }
3418
3481
  }, {
3419
3482
  key: "randomPt",
@@ -3422,7 +3485,7 @@ var Num = function () {
3422
3485
  var range = b ? LinearAlgebra_1.Vec.subtract(b, a) : a;
3423
3486
  var start = b ? a : new Pt_1.Pt(a.length).fill(0);
3424
3487
  for (var i = 0, len = p.length; i < len; i++) {
3425
- p[i] = Math.random() * range[i] + start[i];
3488
+ p[i] = Num.random() * range[i] + start[i];
3426
3489
  }
3427
3490
  return p;
3428
3491
  }
@@ -3464,6 +3527,16 @@ var Num = function () {
3464
3527
  var max = Math.max(targetA, targetB);
3465
3528
  return Num.normalizeValue(n, currA, currB) * (max - min) + min;
3466
3529
  }
3530
+ }, {
3531
+ key: "seed",
3532
+ value: function seed(_seed) {
3533
+ this.generator = uheprng_1.default(_seed);
3534
+ }
3535
+ }, {
3536
+ key: "random",
3537
+ value: function random() {
3538
+ return this.generator ? this.generator.random() : Math.random();
3539
+ }
3467
3540
  }]);
3468
3541
 
3469
3542
  return Num;
@@ -7161,7 +7234,7 @@ var Pt = function (_extendableBuiltin2) {
7161
7234
  if (defaultValue) p.fill(defaultValue);
7162
7235
  if (randomize) {
7163
7236
  for (var i = 0, len = p.length; i < len; i++) {
7164
- p[i] = p[i] * Math.random();
7237
+ p[i] = p[i] * Num_1.Num.random();
7165
7238
  }
7166
7239
  }
7167
7240
  return new Pt(p);
@@ -7944,7 +8017,9 @@ var MultiTouchSpace = function (_Space) {
7944
8017
  }, {
7945
8018
  key: "unbindCanvas",
7946
8019
  value: function unbindCanvas(evt, callback) {
7947
- this._canvas.removeEventListener(evt, callback);
8020
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
8021
+
8022
+ this._canvas.removeEventListener(evt, callback, options);
7948
8023
  }
7949
8024
  }, {
7950
8025
  key: "bindMouse",
@@ -7975,18 +8050,19 @@ var MultiTouchSpace = function (_Space) {
7975
8050
  }, {
7976
8051
  key: "bindTouch",
7977
8052
  value: function bindTouch() {
7978
- var _bind = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
8053
+ var bind = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
8054
+ var passive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
7979
8055
 
7980
- if (_bind) {
7981
- this.bindCanvas("touchstart", this._touchStart.bind(this), { passive: true });
8056
+ if (bind) {
8057
+ this.bindCanvas("touchstart", this._touchStart.bind(this), { passive: passive });
7982
8058
  this.bindCanvas("touchend", this._mouseUp.bind(this));
7983
- this.bindCanvas("touchmove", this._touchMove.bind(this), { passive: true });
8059
+ this.bindCanvas("touchmove", this._touchMove.bind(this), { passive: passive });
7984
8060
  this.bindCanvas("touchcancel", this._mouseOut.bind(this));
7985
8061
  this._hasTouch = true;
7986
8062
  } else {
7987
- this.unbindCanvas("touchstart", this._touchStart.bind(this));
8063
+ this.unbindCanvas("touchstart", this._touchStart.bind(this), { passive: passive });
7988
8064
  this.unbindCanvas("touchend", this._mouseUp.bind(this));
7989
- this.unbindCanvas("touchmove", this._touchMove.bind(this));
8065
+ this.unbindCanvas("touchmove", this._touchMove.bind(this), { passive: passive });
7990
8066
  this.unbindCanvas("touchcancel", this._mouseOut.bind(this));
7991
8067
  this._hasTouch = false;
7992
8068
  }
@@ -9125,6 +9201,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
9125
9201
 
9126
9202
  Object.defineProperty(exports, "__esModule", { value: true });
9127
9203
  exports.Util = exports.Const = void 0;
9204
+ var Num_1 = __webpack_require__(/*! ./Num */ "./src/Num.ts");
9128
9205
  var Pt_1 = __webpack_require__(/*! ./Pt */ "./src/Pt.ts");
9129
9206
  exports.Const = {
9130
9207
  xy: "xy",
@@ -9209,7 +9286,7 @@ var Util = function () {
9209
9286
  var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
9210
9287
 
9211
9288
  Util.warn("Util.randomInt is deprecated. Please use `Num.randomRange`");
9212
- return Math.floor(Math.random() * range) + start;
9289
+ return Math.floor(Num_1.Num.random() * range) + start;
9213
9290
  }
9214
9291
  }, {
9215
9292
  key: "split",
@@ -9405,6 +9482,87 @@ __exportStar(__webpack_require__(/*! ./Typography */ "./src/Typography.ts"), exp
9405
9482
  __exportStar(__webpack_require__(/*! ./Physics */ "./src/Physics.ts"), exports);
9406
9483
  __exportStar(__webpack_require__(/*! ./Play */ "./src/Play.ts"), exports);
9407
9484
  __exportStar(__webpack_require__(/*! ./UI */ "./src/UI.ts"), exports);
9485
+ __exportStar(__webpack_require__(/*! ./Image */ "./src/Image.ts"), exports);
9486
+
9487
+ /***/ }),
9488
+
9489
+ /***/ "./src/uheprng.ts":
9490
+ /*!************************!*\
9491
+ !*** ./src/uheprng.ts ***!
9492
+ \************************/
9493
+ /*! no static exports found */
9494
+ /***/ (function(module, exports, __webpack_require__) {
9495
+
9496
+ "use strict";
9497
+
9498
+
9499
+ Object.defineProperty(exports, "__esModule", { value: true });
9500
+ function Mash() {
9501
+ var n = 0xefc8249d;
9502
+ var mash = function mash(data) {
9503
+ if (data) {
9504
+ data = data.toString();
9505
+ for (var i = 0; i < data.length; i++) {
9506
+ n += data.charCodeAt(i);
9507
+ var h = 0.02519603282416938 * n;
9508
+ n = h >>> 0;
9509
+ h -= n;
9510
+ h *= n;
9511
+ n = h >>> 0;
9512
+ h -= n;
9513
+ n += h * 0x100000000;
9514
+ }
9515
+ return (n >>> 0) * 2.3283064365386963e-10;
9516
+ } else n = 0xefc8249d;
9517
+ };
9518
+ return mash;
9519
+ }
9520
+ function default_1(seed) {
9521
+ var o = 48;
9522
+ var c = 1;
9523
+ var p = o;
9524
+ var s = new Array(o);
9525
+ var i,
9526
+ j,
9527
+ k = 0;
9528
+ var mash = Mash();
9529
+ for (i = 0; i < o; i++) {
9530
+ s[i] = mash(Math.random().toString());
9531
+ }function initState() {
9532
+ mash();
9533
+ for (i = 0; i < o; i++) {
9534
+ s[i] = mash(' ');
9535
+ }c = 1;
9536
+ p = o;
9537
+ }
9538
+ function cleanString(inStr) {
9539
+ inStr = inStr.replace(/(^\s*)|(\s*$)/gi, '');
9540
+ inStr = inStr.replace(/[\x00-\x1F]/gi, '');
9541
+ inStr = inStr.replace(/\n /, '\n');
9542
+ return inStr;
9543
+ }
9544
+ function hashString(inStr) {
9545
+ inStr = cleanString(inStr);
9546
+ mash(inStr);
9547
+ for (i = 0; i < inStr.length; i++) {
9548
+ k = inStr.charCodeAt(i);
9549
+ for (j = 0; j < o; j++) {
9550
+ s[j] -= mash(k.toString());
9551
+ if (s[j] < 0) s[j] += 1;
9552
+ }
9553
+ }
9554
+ }
9555
+ initState();
9556
+ hashString(seed);
9557
+ return {
9558
+ random: function random() {
9559
+ if (++p >= o) p = 0;
9560
+ var t = 1768863 * s[p] + c * 2.3283064365386963e-10;
9561
+ return s[p] = t - (c = t | 0);
9562
+ }
9563
+ };
9564
+ }
9565
+ exports.default = default_1;
9408
9566
 
9409
9567
  /***/ })
9410
9568