mapshaper 0.5.117 → 0.6.2

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/www/mapshaper.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function () {
2
2
 
3
- var VERSION = "0.5.117";
3
+ var VERSION = "0.6.2";
4
4
 
5
5
 
6
6
  var utils = /*#__PURE__*/Object.freeze({
@@ -28,7 +28,7 @@
28
28
  get regexEscape () { return regexEscape; },
29
29
  get htmlEscape () { return htmlEscape; },
30
30
  get defaults () { return defaults; },
31
- get extend () { return extend; },
31
+ get extend () { return extend$1; },
32
32
  get inherit () { return inherit; },
33
33
  get reduceAsync () { return reduceAsync; },
34
34
  get merge () { return merge; },
@@ -132,7 +132,8 @@
132
132
  clearStash: clearStash
133
133
  });
134
134
 
135
- var Buffer = require('buffer').Buffer; // works with browserify
135
+ // Fall back to browserify's Buffer polyfill
136
+ var B$3 = typeof Buffer != 'undefined' ? Buffer : require('buffer').Buffer;
136
137
 
137
138
  var uniqCount = 0;
138
139
  function getUniqueName(prefix) {
@@ -257,7 +258,7 @@
257
258
  '/': '/'
258
259
  };
259
260
  function htmlEscape(s) {
260
- return String(s).replace(/[&<>"'\/]/g, function(s) {
261
+ return String(s).replace(/[&<>"'/]/g, function(s) {
261
262
  return entityMap[s];
262
263
  });
263
264
  }
@@ -274,7 +275,7 @@
274
275
  return dest;
275
276
  }
276
277
 
277
- function extend(o) {
278
+ function extend$1(o) {
278
279
  var dest = o || {},
279
280
  n = arguments.length,
280
281
  key, i, src;
@@ -311,7 +312,7 @@
311
312
  f.prototype = src.prototype || src; // added || src to allow inheriting from objects as well as functions
312
313
  // Extend targ prototype instead of wiping it out --
313
314
  // in case inherit() is called after targ.prototype = {stuff}; statement
314
- targ.prototype = extend(new f(), targ.prototype); //
315
+ targ.prototype = extend$1(new f(), targ.prototype); //
315
316
  targ.prototype.constructor = targ;
316
317
  targ.prototype.__super__ = f;
317
318
  }
@@ -900,8 +901,8 @@
900
901
  var type = matches[4];
901
902
  var isString = type == 's',
902
903
  isHex = type == 'x' || type == 'X',
903
- isInt = type == 'd' || type == 'i',
904
- isFloat = type == 'f',
904
+ // isInt = type == 'd' || type == 'i',
905
+ // isFloat = type == 'f',
905
906
  isNumber = !isString;
906
907
 
907
908
  var sign = "",
@@ -960,7 +961,7 @@
960
961
 
961
962
  // Get a function for interpolating formatted values into a string.
962
963
  function formatter(fmt) {
963
- var codeRxp = /%([\',+0]*)([1-9]?)((?:\.[1-9])?)([sdifxX%])/g;
964
+ var codeRxp = /%([',+0]*)([1-9]?)((?:\.[1-9])?)([sdifxX%])/g;
964
965
  var literals = [],
965
966
  formatCodes = [],
966
967
  startIdx = 0,
@@ -1004,10 +1005,10 @@
1004
1005
 
1005
1006
  function createBuffer(arg, arg2) {
1006
1007
  if (isInteger(arg)) {
1007
- return Buffer.allocUnsafe ? Buffer.allocUnsafe(arg) : new Buffer(arg);
1008
+ return B$3.allocUnsafe ? B$3.allocUnsafe(arg) : new B$3(arg);
1008
1009
  } else {
1009
1010
  // check allocUnsafe to make sure Buffer.from() will accept strings (it didn't before Node v5.10)
1010
- return Buffer.from && Buffer.allocUnsafe ? Buffer.from(arg, arg2) : new Buffer(arg, arg2);
1011
+ return B$3.from && B$3.allocUnsafe ? B$3.from(arg, arg2) : new B$3(arg, arg2);
1011
1012
  }
1012
1013
  }
1013
1014
 
@@ -3513,10 +3514,31 @@
3513
3514
  findMaxPartCount: findMaxPartCount
3514
3515
  });
3515
3516
 
3517
+ // Several dependencies are loaded via require() ... this module returns a
3518
+ // stub function when require() does not exist as a global function,
3519
+ // to avoid runtime errors (this should only happen in some tests when single
3520
+ // modules are imported)
3521
+ var f;
3522
+ if (typeof require == 'function') {
3523
+ f = require;
3524
+ } else {
3525
+ f = function() {
3526
+ // console.error('Unable to load module', name);
3527
+ };
3528
+ }
3529
+ var require$1 = f;
3530
+
3531
+ // import { createRequire } from "module";
3532
+
3533
+ var iconv = require$1('iconv-lite');
3534
+
3535
+ // import iconv from 'iconv-lite';
3536
+ // import * as iconv from 'iconv-lite';
3537
+ // import * as iconv from '../../node_modules/iconv-lite/lib/index.js';
3538
+
3516
3539
  // List of encodings supported by iconv-lite:
3517
3540
  // https://github.com/ashtuchkin/iconv-lite/wiki/Supported-Encodings
3518
3541
 
3519
- var iconv = require('iconv-lite');
3520
3542
  var toUtf8 = getNativeEncoder('utf8');
3521
3543
  var fromUtf8 = getNativeDecoder('utf8');
3522
3544
 
@@ -3587,7 +3609,7 @@
3587
3609
  }
3588
3610
  return function(str) {
3589
3611
  // Convert Uint8Array from encoder to Buffer (fix for issue #216)
3590
- return encoder ? Buffer.from(encoder.encode(str).buffer) : utils.createBuffer(str, enc);
3612
+ return encoder ? B$3.from(encoder.encode(str).buffer) : utils.createBuffer(str, enc);
3591
3613
  };
3592
3614
  }
3593
3615
 
@@ -4332,17 +4354,18 @@
4332
4354
  this.ty -= cy * (sy - 1);
4333
4355
  };
4334
4356
 
4357
+ var mproj$1 = require$1('mproj');
4358
+
4335
4359
  // A compound projection, consisting of a default projection and one or more rectangular frames
4336
4360
  // that are projected separately and affine transformed.
4337
4361
  // @mainParams: parameters for main projection, including:
4338
4362
  // proj: Proj string
4339
4363
  // bbox: lat-lon bounding box
4340
4364
  function MixedProjection(mainParams, options) {
4341
- var mproj = require('mproj');
4342
4365
  var mainFrame = initFrame(mainParams);
4343
4366
  var mainP = mainFrame.crs;
4344
4367
  var frames = [mainFrame];
4345
- var mixedP = initMixedProjection(mproj);
4368
+ var mixedP = initMixedProjection(mproj$1);
4346
4369
 
4347
4370
  // This CRS masquerades as the main projection... the version with
4348
4371
  // custom insets is exposed to savvy users
@@ -4386,7 +4409,7 @@
4386
4409
  function initFrame(params) {
4387
4410
  return {
4388
4411
  bounds: new Bounds(bboxToRadians(params.bbox)),
4389
- crs: mproj.pj_init(params.proj)
4412
+ crs: mproj$1.pj_init(params.proj)
4390
4413
  };
4391
4414
  }
4392
4415
 
@@ -4398,7 +4421,7 @@
4398
4421
  }
4399
4422
 
4400
4423
  function projectFrameOrigin(origin, P) {
4401
- var xy = mproj.pj_fwd_deg({lam: origin[0], phi: origin[1]}, P);
4424
+ var xy = mproj$1.pj_fwd_deg({lam: origin[0], phi: origin[1]}, P);
4402
4425
  return [xy.x, xy.y];
4403
4426
  }
4404
4427
 
@@ -4407,7 +4430,7 @@
4407
4430
  for (var i=0, n=frames.length; i<n; i++) {
4408
4431
  frame = frames[i];
4409
4432
  if (frame.bounds.containsPoint(lp.lam, lp.phi)) {
4410
- xy2 = mproj.pj_fwd(lp, frame.crs);
4433
+ xy2 = mproj$1.pj_fwd(lp, frame.crs);
4411
4434
  if (frame.matrix) {
4412
4435
  frame.matrix.transformXY(xy2.x, xy2.y, xy2);
4413
4436
  }
@@ -4610,13 +4633,15 @@
4610
4633
  getAntimeridian: getAntimeridian
4611
4634
  });
4612
4635
 
4636
+ var mproj = require$1('mproj');
4637
+
4613
4638
  var asyncLoader = null;
4614
4639
 
4615
4640
  var projectionAliases = {
4616
4641
  robinson: '+proj=robin +datum=WGS84',
4617
4642
  webmercator: '+proj=merc +a=6378137 +b=6378137',
4618
4643
  wgs84: '+proj=longlat +datum=WGS84',
4619
- albersusa: new AlbersUSA() // with default parameters
4644
+ albersusa: AlbersUSA
4620
4645
  };
4621
4646
 
4622
4647
  // This stub is replaced when loaded in GUI, which may need to load some files
@@ -4640,7 +4665,6 @@
4640
4665
  // if the transformation fails
4641
4666
  // src, dest: proj4 objects
4642
4667
  function getProjTransform(src, dest) {
4643
- var mproj = require('mproj');
4644
4668
  var clampSrc = isLatLngCRS(src);
4645
4669
  dest = dest.__mixed_crs || dest;
4646
4670
  return function(x, y) {
@@ -4659,8 +4683,7 @@
4659
4683
  // Same as getProjTransform(), but return null if projection fails
4660
4684
  // (also faster)
4661
4685
  function getProjTransform2(src, dest) {
4662
- var mproj = require('mproj'),
4663
- xx = [0],
4686
+ var xx = [0],
4664
4687
  yy = [0],
4665
4688
  preK = src.is_latlong ? mproj.internal.DEG_TO_RAD : 1,
4666
4689
  postK = dest.is_latlong ? mproj.internal.RAD_TO_DEG : 1,
@@ -4707,13 +4730,13 @@
4707
4730
  }
4708
4731
 
4709
4732
  function crsToProj4(P) {
4710
- return require('mproj').internal.get_proj_defn(P);
4733
+ return mproj.internal.get_proj_defn(P);
4711
4734
  }
4712
4735
 
4713
4736
  function crsToPrj(P) {
4714
4737
  var wkt;
4715
4738
  try {
4716
- wkt = require('mproj').internal.wkt_from_proj4(P);
4739
+ wkt = mproj.internal.wkt_from_proj4(P);
4717
4740
  } catch(e) {
4718
4741
  // console.log(e)
4719
4742
  }
@@ -4725,8 +4748,11 @@
4725
4748
  return !!str && str == crsToProj4(b);
4726
4749
  }
4727
4750
 
4751
+ function isProjAlias(str) {
4752
+ return str in projectionAliases;
4753
+ }
4754
+
4728
4755
  function getProjDefn(str) {
4729
- var mproj = require('mproj');
4730
4756
  var defn;
4731
4757
  // prepend '+proj=' to bare proj names
4732
4758
  str = str.replace(/(^| )([\w]+)($| )/, function(a, b, c, d) {
@@ -4737,8 +4763,11 @@
4737
4763
  });
4738
4764
  if (looksLikeProj4String(str)) {
4739
4765
  defn = str;
4740
- } else if (str in projectionAliases) {
4741
- defn = projectionAliases[str]; // defn is a function
4766
+ } else if (isProjAlias(str)) {
4767
+ defn = projectionAliases[str];
4768
+ if (utils.isFunction(defn)) {
4769
+ defn = defn();
4770
+ }
4742
4771
  } else if (looksLikeInitString(str)) {
4743
4772
  defn = '+init=' + str.toLowerCase();
4744
4773
  } else if (str in (getStashedVar('defs') || {})) {
@@ -4768,7 +4797,7 @@
4768
4797
  P = defn;
4769
4798
  } else {
4770
4799
  try {
4771
- P = require('mproj').pj_init(defn);
4800
+ P = mproj.pj_init(defn);
4772
4801
  } catch(e) {
4773
4802
  stop('Unable to use projection', defn, '(' + e.message + ')');
4774
4803
  }
@@ -4822,10 +4851,9 @@
4822
4851
  // x, y: a point location in projected coordinates
4823
4852
  // Returns k, the ratio of coordinate distance to distance on the ground
4824
4853
  function getScaleFactorAtXY(x, y, crs) {
4825
- var proj = require('mproj');
4826
4854
  var dist = 1;
4827
- var lp = proj.pj_inv_deg({x: x, y: y}, crs);
4828
- var lp2 = proj.pj_inv_deg({x: x + dist, y: y}, crs);
4855
+ var lp = mproj.pj_inv_deg({x: x, y: y}, crs);
4856
+ var lp2 = mproj.pj_inv_deg({x: x + dist, y: y}, crs);
4829
4857
  var k = dist / geom.greatCircleDistance(lp.lam, lp.phi, lp2.lam, lp2.phi);
4830
4858
  return k;
4831
4859
  }
@@ -4863,7 +4891,7 @@
4863
4891
  }
4864
4892
 
4865
4893
  function printProjections() {
4866
- var index = require('mproj').internal.pj_list;
4894
+ var index = mproj.internal.pj_list;
4867
4895
  var msg = 'Proj4 projections\n';
4868
4896
  Object.keys(index).sort().forEach(function(id) {
4869
4897
  msg += ' ' + utils.rpad(id, 7, ' ') + ' ' + index[id].name + '\n';
@@ -4878,7 +4906,7 @@
4878
4906
  function translatePrj(str) {
4879
4907
  var proj4;
4880
4908
  try {
4881
- proj4 = require('mproj').internal.wkt_to_proj4(str);
4909
+ proj4 = mproj.internal.wkt_to_proj4(str);
4882
4910
  } catch(e) {
4883
4911
  stop('Unusable .prj file (' + e.message + ')');
4884
4912
  }
@@ -4902,6 +4930,7 @@
4902
4930
  crsToProj4: crsToProj4,
4903
4931
  crsToPrj: crsToPrj,
4904
4932
  crsAreEqual: crsAreEqual,
4933
+ isProjAlias: isProjAlias,
4905
4934
  getProjDefn: getProjDefn,
4906
4935
  looksLikeProj4String: looksLikeProj4String,
4907
4936
  getCRS: getCRS,
@@ -6450,12 +6479,12 @@
6450
6479
  // Accessor function for arcs
6451
6480
  Object.defineProperty(this, 'arcs', {value: arcs});
6452
6481
 
6453
- var toArray = this.toArray = function() {
6482
+ this.toArray = function() {
6454
6483
  var chains = getNodeChains(),
6455
6484
  flags = new Uint8Array(chains.length),
6456
6485
  arr = [];
6457
6486
  utils.forEach(chains, function(nextIdx, thisIdx) {
6458
- var node, x, y, p;
6487
+ var node, p;
6459
6488
  if (flags[thisIdx] == 1) return;
6460
6489
  p = getEndpoint(thisIdx);
6461
6490
  if (!p) return; // endpoints of an excluded arc
@@ -7034,7 +7063,7 @@
7034
7063
  return typeof window !== 'undefined' && typeof window.document !== 'undefined';
7035
7064
  }
7036
7065
 
7037
- var State = /*#__PURE__*/Object.freeze({
7066
+ var Env = /*#__PURE__*/Object.freeze({
7038
7067
  __proto__: null,
7039
7068
  runningInBrowser: runningInBrowser
7040
7069
  });
@@ -7145,13 +7174,13 @@
7145
7174
  content = cache[fname];
7146
7175
  delete cache[fname];
7147
7176
  } else if (fname == '/dev/stdin') {
7148
- content = require('rw').readFileSync(fname);
7177
+ content = require$1('rw').readFileSync(fname);
7149
7178
  } else {
7150
7179
  // kludge to prevent overwriting of input files
7151
7180
  (getStashedVar('input_files') || []).push(fname);
7152
- content = require('fs').readFileSync(fname);
7181
+ content = require$1('fs').readFileSync(fname);
7153
7182
  }
7154
- if (encoding && Buffer.isBuffer(content)) {
7183
+ if (encoding && B$3.isBuffer(content)) {
7155
7184
  content = trimBOM(decodeString(content, encoding));
7156
7185
  }
7157
7186
  return content;
@@ -7161,7 +7190,7 @@
7161
7190
  var odir = parseLocalPath(fname).directory;
7162
7191
  if (!odir || cli.isDirectory(odir) || fname == '/dev/stdout') return;
7163
7192
  try {
7164
- require('fs').mkdirSync(odir, {recursive: true});
7193
+ require$1('fs').mkdirSync(odir, {recursive: true});
7165
7194
  message('Created output directory:', odir);
7166
7195
  } catch(e) {
7167
7196
  stop('Unable to create output directory:', odir);
@@ -7170,7 +7199,7 @@
7170
7199
 
7171
7200
  // content: Buffer or string
7172
7201
  cli.writeFile = function(fname, content, cb) {
7173
- var fs = require('rw');
7202
+ var fs = require$1('rw');
7174
7203
  cli.createDirIfNeeded(fname);
7175
7204
  if (cb) {
7176
7205
  fs.writeFile(fname, content, cb);
@@ -7198,8 +7227,8 @@
7198
7227
  files = [];
7199
7228
 
7200
7229
  try {
7201
- require('fs').readdirSync(dir).forEach(function(item) {
7202
- var path = require('path').join(dir, item);
7230
+ require$1('fs').readdirSync(dir).forEach(function(item) {
7231
+ var path = require$1('path').join(dir, item);
7203
7232
  if (rxp.test(item) && cli.isFile(path)) {
7204
7233
  files.push(path);
7205
7234
  }
@@ -7241,7 +7270,7 @@
7241
7270
  cli.statSync = function(fpath) {
7242
7271
  var obj = null;
7243
7272
  try {
7244
- obj = require('fs').statSync(fpath);
7273
+ obj = require$1('fs').statSync(fpath);
7245
7274
  } catch(e) {}
7246
7275
  return obj;
7247
7276
  };
@@ -7293,7 +7322,7 @@
7293
7322
  var odir = opts.directory;
7294
7323
  if (odir) {
7295
7324
  files = files.map(function(file) {
7296
- return require('path').join(odir, file);
7325
+ return require$1('path').join(odir, file);
7297
7326
  });
7298
7327
  }
7299
7328
  return files;
@@ -7315,7 +7344,7 @@
7315
7344
  // Unlike rbush, flatbush doesn't allow size 0 indexes; workaround
7316
7345
  return function() {return [];};
7317
7346
  }
7318
- Flatbush = require('flatbush');
7347
+ Flatbush = require$1('flatbush');
7319
7348
  index = new Flatbush(boxes.length);
7320
7349
  boxes.forEach(function(ring) {
7321
7350
  var b = ring.bounds;
@@ -8791,10 +8820,10 @@
8791
8820
 
8792
8821
  // Returns undefined if not found
8793
8822
  function lookupColorName(str) {
8794
- return colors[str.toLowerCase().replace(/[ -]+/g, '')];
8823
+ return colors$1[str.toLowerCase().replace(/[ -]+/g, '')];
8795
8824
  }
8796
8825
 
8797
- var colors = {
8826
+ var colors$1 = {
8798
8827
  aliceblue: '#f0f8ff',
8799
8828
  antiquewhite: '#faebd7',
8800
8829
  aqua: '#00ffff',
@@ -12030,10 +12059,6 @@
12030
12059
  // if point x,y falls on an endpoint
12031
12060
  // Assumes: i <= j
12032
12061
  function getCutPoint(x, y, i, j, xx, yy) {
12033
- var ix = xx[i],
12034
- iy = yy[i],
12035
- jx = xx[j],
12036
- jy = yy[j];
12037
12062
  if (j < i || j > i + 1) {
12038
12063
  error("Out-of-sequence arc ids:", i, j);
12039
12064
  }
@@ -13376,7 +13401,7 @@
13376
13401
  memo.push(buf);
13377
13402
  return memo;
13378
13403
  }, []);
13379
- return Buffer.concat(parts);
13404
+ return B$3.concat(parts);
13380
13405
  };
13381
13406
 
13382
13407
  // collection: an array of individual GeoJSON Features or geometries as strings or buffers
@@ -13398,7 +13423,7 @@
13398
13423
  return memo;
13399
13424
  }, [utils.createBuffer(head, 'utf8')]);
13400
13425
  parts.push(utils.createBuffer(tail, 'utf8'));
13401
- return Buffer.concat(parts);
13426
+ return B$3.concat(parts);
13402
13427
  };
13403
13428
 
13404
13429
  // export GeoJSON or TopoJSON point geometry
@@ -14019,18 +14044,18 @@
14019
14044
  // accept variations on type names (dot, dots, square, squares, hatch, hatches, hatched)
14020
14045
  if (first.startsWith('dot')) {
14021
14046
  parts[0] = 'dots';
14022
- obj = parseDots(parts, str);
14047
+ obj = parseDots(parts);
14023
14048
  } else if (first.startsWith('square')) {
14024
14049
  parts[0] = 'squares';
14025
- obj = parseDots(parts, str);
14050
+ obj = parseDots(parts);
14026
14051
  } else if (first.startsWith('hatch')) {
14027
14052
  parts[0] = 'hatches';
14028
- obj = parseHatches(parts, str);
14053
+ obj = parseHatches(parts);
14029
14054
  } else if (first.startsWith('dash')) {
14030
- obj = parseDashes(parts, str);
14055
+ obj = parseDashes(parts);
14031
14056
  } else if (!isNaN(parseFloat(first))) {
14032
14057
  parts.unshift('hatches');
14033
- obj = parseHatches(parts, str); // hatches is the default, name can be omitted
14058
+ obj = parseHatches(parts); // hatches is the default, name can be omitted
14034
14059
  }
14035
14060
  if (!obj) {
14036
14061
  // consider
@@ -14039,7 +14064,7 @@
14039
14064
  return obj;
14040
14065
  }
14041
14066
 
14042
- function parseDashes(parts, str) {
14067
+ function parseDashes(parts) {
14043
14068
  // format:
14044
14069
  // "dashes" dash-len dash-space width color1 [color2...] space bg-color
14045
14070
  // examples:
@@ -14080,7 +14105,7 @@
14080
14105
  };
14081
14106
  }
14082
14107
 
14083
- function parseHatches(parts, str) {
14108
+ function parseHatches(parts) {
14084
14109
  // format:
14085
14110
  // [hatches] [rotation] width1 color1 [width2 color2 ...]
14086
14111
  // examples:
@@ -14107,7 +14132,7 @@
14107
14132
  return parseInt(str) > 0;
14108
14133
  }
14109
14134
 
14110
- function parseDots(parts, str) {
14135
+ function parseDots(parts) {
14111
14136
  // format:
14112
14137
  // "dots"|"squares" [rotation] size color1 [color2 ...] spacing bg-color
14113
14138
  // examples:
@@ -14271,6 +14296,7 @@
14271
14296
  'stroke-opacity': 'number',
14272
14297
  'stroke-miterlimit': 'number',
14273
14298
  'fill-opacity': 'number',
14299
+ 'vector-effect': null,
14274
14300
  'text-anchor': null
14275
14301
  };
14276
14302
 
@@ -14300,7 +14326,7 @@
14300
14326
  effect: null // e.g. "fade"
14301
14327
  }, stylePropertyTypes);
14302
14328
 
14303
- var commonProperties = 'css,class,opacity,stroke,stroke-width,stroke-dasharray,stroke-opacity,fill-opacity'.split(',');
14329
+ var commonProperties = 'css,class,opacity,stroke,stroke-width,stroke-dasharray,stroke-opacity,fill-opacity,vector-effect'.split(',');
14304
14330
 
14305
14331
  var propertiesBySymbolType = {
14306
14332
  polygon: utils.arrayToIndex(commonProperties.concat('fill', 'fill-pattern')),
@@ -14380,7 +14406,7 @@
14380
14406
  function mightBeExpression(str, fields) {
14381
14407
  fields = fields || [];
14382
14408
  if (fields.indexOf(str.trim()) > -1) return true;
14383
- return /[(){}./*?:&|=\[+-]/.test(str);
14409
+ return /[(){}./*?:&|=[+-]/.test(str);
14384
14410
  }
14385
14411
 
14386
14412
  function getSymbolPropertyAccessor(val, svgName, lyr) {
@@ -14507,7 +14533,7 @@
14507
14533
 
14508
14534
  function importGeoJSONFeatures(features, opts) {
14509
14535
  opts = opts || {};
14510
- return features.map(function(obj, i) {
14536
+ return features.map(function(obj) {
14511
14537
  var geom = obj.type == 'Feature' ? obj.geometry : obj; // could be null
14512
14538
  var geomType = geom && geom.type;
14513
14539
  var msType = GeoJSON.translateGeoJSONType(geomType);
@@ -14823,7 +14849,7 @@
14823
14849
  }
14824
14850
 
14825
14851
  // polyline coords are like GeoJSON MultiLineString coords: an array of 0 or more paths
14826
- function polyline(d, x, y) {
14852
+ function polyline(d) {
14827
14853
  var coords = d.coordinates || [];
14828
14854
  var o = importMultiLineString(coords);
14829
14855
  applyStyleAttributes(o, 'polyline', d);
@@ -14831,7 +14857,7 @@
14831
14857
  }
14832
14858
 
14833
14859
  // polygon coords are an array of rings (and holes), like flattened MultiPolygon coords
14834
- function polygon(d, x, y) {
14860
+ function polygon(d) {
14835
14861
  var coords = d.coordinates || [];
14836
14862
  var o = importPolygon(coords);
14837
14863
  applyStyleAttributes(o, 'polygon', d);
@@ -15175,7 +15201,7 @@
15175
15201
  var cache = {};
15176
15202
  function fetchFileSync(url) {
15177
15203
  if (url in cache) return cache[url];
15178
- var res = require('sync-request')('GET', url, {timeout: 2000});
15204
+ var res = require$1('sync-request')('GET', url, {timeout: 2000});
15179
15205
  var content = res.getBody().toString();
15180
15206
  cache[url] = content;
15181
15207
  return content;
@@ -15246,8 +15272,8 @@
15246
15272
  var content;
15247
15273
  if (href.indexOf('http') === 0) {
15248
15274
  content = fetchFileSync(href);
15249
- } else if (require('fs').existsSync(href)) {
15250
- content = require('fs').readFileSync(href, 'utf8');
15275
+ } else if (require$1('fs').existsSync(href)) {
15276
+ content = require$1('fs').readFileSync(href, 'utf8');
15251
15277
  } else {
15252
15278
  stop("Invalid SVG location:", href);
15253
15279
  }
@@ -15378,7 +15404,6 @@ ${svg}
15378
15404
  var geojson = exportDatasetAsGeoJSON(d, opts);
15379
15405
  var features = geojson.features || geojson.geometries || (geojson.type ? [geojson] : []);
15380
15406
  var children = importGeoJSONFeatures(features, opts);
15381
- var data;
15382
15407
  if (opts.svg_data && lyr.data) {
15383
15408
  addDataAttributesToSVG(children, lyr.data, opts.svg_data);
15384
15409
  }
@@ -15558,12 +15583,13 @@ ${svg}
15558
15583
  function BinArray(buf, le) {
15559
15584
  if (utils.isNumber(buf)) {
15560
15585
  buf = new ArrayBuffer(buf);
15561
- } else if (typeof Buffer == 'function' && buf instanceof Buffer) {
15586
+ } else if (buf instanceof ArrayBuffer) {
15587
+ // we're good
15588
+ } else if (typeof B$3 == 'function' && buf instanceof B$3) {
15562
15589
  // Since node 0.10, DataView constructor doesn't accept Buffers,
15563
15590
  // so need to copy Buffer to ArrayBuffer
15564
15591
  buf = BinArray.toArrayBuffer(buf);
15565
- }
15566
- if (buf instanceof ArrayBuffer == false) {
15592
+ } else {
15567
15593
  error("BinArray constructor takes an integer, ArrayBuffer or Buffer argument");
15568
15594
  }
15569
15595
  this._buffer = buf;
@@ -16306,7 +16332,7 @@ ${svg}
16306
16332
  return readFixedWidthRecordsFromString(str, opts);
16307
16333
  }
16308
16334
 
16309
- function readFixedWidthRecordsFromString(str, ops) {
16335
+ function readFixedWidthRecordsFromString(str) {
16310
16336
  var fields = parseFixedWidthInfo(str.substring(0, 2000));
16311
16337
  if (!fields) return [];
16312
16338
  var lines = utils.splitLines(str);
@@ -16442,7 +16468,7 @@ ${svg}
16442
16468
  buffers.push(encodeString(str, encoding));
16443
16469
  }
16444
16470
  }
16445
- return Buffer.concat(buffers);
16471
+ return B$3.concat(buffers);
16446
16472
  }
16447
16473
 
16448
16474
  function formatHeader(fields, formatRow) {
@@ -16453,11 +16479,6 @@ ${svg}
16453
16479
  return formatRow(rec);
16454
16480
  }
16455
16481
 
16456
- function formatDelimHeader(fields, delim) {
16457
- var formatValue = getDelimValueFormatter(delim);
16458
- return fields.map(formatValue).join(delim);
16459
- }
16460
-
16461
16482
  function getDelimRowFormatter(fields, delim, opts) {
16462
16483
  var formatValue = getDelimValueFormatter(delim, opts);
16463
16484
  return function(rec) {
@@ -17215,7 +17236,7 @@ ${svg}
17215
17236
  function guessInputFileType(file) {
17216
17237
  var ext = getFileExtension(file || '').toLowerCase(),
17217
17238
  type = null;
17218
- if (ext == 'dbf' || ext == 'shp' || ext == 'prj' || ext == 'shx' || ext == 'kml') {
17239
+ if (ext == 'dbf' || ext == 'shp' || ext == 'prj' || ext == 'shx' || ext == 'kml' || ext == 'cpg') {
17219
17240
  type = ext;
17220
17241
  } else if (/json$/.test(ext)) {
17221
17242
  type = 'json';
@@ -17659,7 +17680,7 @@ ${svg}
17659
17680
  }
17660
17681
 
17661
17682
  function FileReader(path, opts) {
17662
- var fs = require('fs'),
17683
+ var fs = require$1('fs'),
17663
17684
  fileLen = fs.statSync(path).size,
17664
17685
  DEFAULT_CACHE_LEN = opts && opts.cacheSize || 0x1000000, // 16MB
17665
17686
  DEFAULT_BUFFER_LEN = opts && opts.bufferSize || 0x40000, // 256K
@@ -18140,8 +18161,7 @@ ${svg}
18140
18161
  // @chars String of chars to look for in @str
18141
18162
  function getCharScore(str, chars) {
18142
18163
  var index = {},
18143
- count = 0,
18144
- score;
18164
+ count = 0;
18145
18165
  str = str.toLowerCase();
18146
18166
  for (var i=0, n=chars.length; i<n; i++) {
18147
18167
  index[chars[i]] = 1;
@@ -18162,7 +18182,7 @@ ${svg}
18162
18182
  // TODO: remove duplication with importJSON()
18163
18183
  var readFromFile = !data.content && data.content !== '',
18164
18184
  content = data.content,
18165
- filter, reader, records, delimiter, table, encoding;
18185
+ reader, records, delimiter, table, encoding;
18166
18186
  opts = opts || {};
18167
18187
 
18168
18188
  // // read content of all but very large files into a buffer
@@ -18173,7 +18193,7 @@ ${svg}
18173
18193
 
18174
18194
  if (readFromFile) {
18175
18195
  reader = new FileReader(data.filename);
18176
- } else if (content instanceof ArrayBuffer || content instanceof Buffer) {
18196
+ } else if (content instanceof ArrayBuffer || content instanceof B$3) {
18177
18197
  // Web API may import as ArrayBuffer, to support larger files
18178
18198
  reader = new BufferReader(content);
18179
18199
  content = null;
@@ -18404,43 +18424,19 @@ ${svg}
18404
18424
  }
18405
18425
  }
18406
18426
 
18407
- // var intervalStr = o.interval;
18408
- // if (intervalStr) {
18409
- // o.interval = Number(intervalStr);
18410
- // if (o.interval >= 0 === false) {
18411
- // error(utils.format("Out-of-range interval value: %s", intervalStr));
18412
- // }
18413
- // }
18414
-
18415
18427
  if (!o.interval && !o.percentage && !o.resolution) {
18416
18428
  error("Command requires an interval, percentage or resolution parameter");
18417
18429
  }
18418
18430
  }
18419
18431
 
18420
18432
  function validateProjOpts(cmd) {
18421
- var _ = cmd._,
18422
- proj4 = [];
18433
+ var _ = cmd._;
18423
18434
 
18424
18435
  if (_.length > 0 && !cmd.options.crs) {
18425
18436
  cmd.options.crs = _.join(' ');
18426
18437
  _ = [];
18427
18438
  }
18428
18439
 
18429
- // separate proj4 options
18430
- // _ = _.filter(function(arg) {
18431
- // if (/^\+[a-z]/i.test(arg)) {
18432
- // proj4.push(arg);
18433
- // return false;
18434
- // }
18435
- // return true;
18436
- // });
18437
-
18438
- // if (proj4.length > 0) {
18439
- // cmd.options.crs = proj4.join(' ');
18440
- // } else if (_.length > 0) {
18441
- // cmd.options.crs = _.shift();
18442
- // }
18443
-
18444
18440
  if (_.length > 0) {
18445
18441
  error("Received one or more unexpected parameters: " + _.join(', '));
18446
18442
  }
@@ -18535,7 +18531,7 @@ ${svg}
18535
18531
  }
18536
18532
  }
18537
18533
 
18538
- var assignmentRxp = /^([a-z0-9_+-]+)=(?!\=)(.*)$/i; // exclude ==
18534
+ var assignmentRxp = /^([a-z0-9_+-]+)=(?!=)(.*)$/i; // exclude ==
18539
18535
 
18540
18536
  function splitShellTokens(str) {
18541
18537
  var BAREWORD = '([^\'"\\s])+';
@@ -20923,6 +20919,10 @@ ${svg}
20923
20919
  // describe: (0-1) inset grid shapes by a percentage
20924
20920
  type: 'number'
20925
20921
  })
20922
+ .option('aligned', {
20923
+ // describe: all grids of a given cell size will be aligned
20924
+ type: 'flag'
20925
+ })
20926
20926
  .option('calc', calcOpt)
20927
20927
  .option('name', nameOpt)
20928
20928
  .option('target', targetOpt)
@@ -21069,6 +21069,9 @@ ${svg}
21069
21069
  })
21070
21070
  .option('target', targetOpt);
21071
21071
 
21072
+ parser.command('stop')
21073
+ .describe('stop processing (skip remaining commands)');
21074
+
21072
21075
  parser.section('Informational commands');
21073
21076
 
21074
21077
  parser.command('calc')
@@ -21088,6 +21091,10 @@ ${svg}
21088
21091
  parser.command('colors')
21089
21092
  .describe('print list of color scheme names');
21090
21093
 
21094
+ parser.command('comment')
21095
+ .describe('add a comment to the sequence of commands')
21096
+ .flag('multi_arg');
21097
+
21091
21098
  parser.command('encodings')
21092
21099
  .describe('print list of supported text encodings (for .dbf import)');
21093
21100
 
@@ -21516,11 +21523,12 @@ ${svg}
21516
21523
 
21517
21524
  // Show a sample of decoded text if non-ascii-range text has been found
21518
21525
  if (encoding && samples.length > 0) {
21526
+ msg = "Detected DBF text encoding: " + encoding + (encoding in encodingNames ? " (" + encodingNames[encoding] + ")" : "");
21527
+ message(msg);
21519
21528
  msg = decodeSamples(encoding, samples);
21520
21529
  msg = formatStringsAsGrid(msg.split('\n'));
21521
21530
  msg = "\nSample text containing non-ascii characters:" + (msg.length > 60 ? '\n' : '') + msg;
21522
- msg = "Detected DBF text encoding: " + encoding + (encoding in encodingNames ? " (" + encodingNames[encoding] + ")" : "") + msg;
21523
- message(msg);
21531
+ verbose(msg);
21524
21532
  }
21525
21533
  return encoding;
21526
21534
  }
@@ -22725,7 +22733,6 @@ ${svg}
22725
22733
  shapes = [], // topological ids
22726
22734
  types = [],
22727
22735
  dataNulls = 0,
22728
- shapeNulls = 0,
22729
22736
  collectionType = null,
22730
22737
  shapeId;
22731
22738
 
@@ -22742,15 +22749,12 @@ ${svg}
22742
22749
  if (geom.type) {
22743
22750
  this.addShape(geom);
22744
22751
  }
22745
- if (shapes[shapeId] === null) {
22746
- shapeNulls++;
22747
- }
22748
22752
  };
22749
22753
 
22750
22754
  this.addShape = function(geom) {
22751
22755
  var curr = shapes[shapeId];
22752
22756
  var type = GeoJSON.translateGeoJSONType(geom.type);
22753
- var shape, importer;
22757
+ var shape;
22754
22758
  if (geom.type == "GeometryCollection") {
22755
22759
  geom.geometries.forEach(this.addShape, this);
22756
22760
  } else if (type) {
@@ -23510,8 +23514,8 @@ ${svg}
23510
23514
  });
23511
23515
 
23512
23516
  function importKML(str, opts) {
23513
- var togeojson = require("@tmcw/togeojson");
23514
- var Parser = typeof DOMParser == 'undefined' ? require("@xmldom/xmldom").DOMParser : DOMParser;
23517
+ var togeojson = require$1("@tmcw/togeojson");
23518
+ var Parser = typeof DOMParser == 'undefined' ? require$1("@xmldom/xmldom").DOMParser : DOMParser;
23515
23519
  var geojson = togeojson.kml(new Parser().parseFromString(str, "text/xml"));
23516
23520
  return importGeoJSON(geojson, opts || {});
23517
23521
  }
@@ -23612,6 +23616,10 @@ ${svg}
23612
23616
  if (obj.prj) {
23613
23617
  dataset.info.prj = obj.prj.content;
23614
23618
  }
23619
+ if (obj.cpg) {
23620
+ // TODO: consider using the input encoding as the default output encoding
23621
+ dataset.info.cpg = obj.cpg.content;
23622
+ }
23615
23623
  return dataset;
23616
23624
  }
23617
23625
 
@@ -24026,12 +24034,12 @@ ${svg}
24026
24034
  function Job(catalog) {
24027
24035
  var currentCmd;
24028
24036
 
24029
- var job = {
24037
+ var job = {
24030
24038
  catalog: catalog || new Catalog(),
24031
24039
  defs: {},
24032
24040
  settings: {},
24033
24041
  input_files: []
24034
- };
24042
+ };
24035
24043
 
24036
24044
  job.initSettings = function(o) {
24037
24045
  job.settings = o;
@@ -24061,6 +24069,7 @@ ${svg}
24061
24069
  clearStash(); // prevent errors from overwriting stash
24062
24070
  stashVar('current_command', cmd.name);
24063
24071
  stashVar('DEBUG', job.settings.DEBUG || cmd.debug);
24072
+ stashVar('VERBOSE', job.settings.VERBOSE || cmd.verbose);
24064
24073
  stashVar('QUIET', job.settings.QUIET || cmd.quiet);
24065
24074
  stashVar('defs', job.defs);
24066
24075
  stashVar('input_files', job.input_files);
@@ -24209,10 +24218,10 @@ ${svg}
24209
24218
  const ccwerrboundB = (2 + 12 * epsilon) * epsilon;
24210
24219
  const ccwerrboundC = (9 + 64 * epsilon) * epsilon * epsilon;
24211
24220
 
24212
- const B$1 = vec(4);
24221
+ const B$2 = vec(4);
24213
24222
  const C1 = vec(8);
24214
24223
  const C2 = vec(12);
24215
- const D = vec(16);
24224
+ const D$1 = vec(16);
24216
24225
  const u$2 = vec(4);
24217
24226
 
24218
24227
  function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) {
@@ -24242,19 +24251,19 @@ ${svg}
24242
24251
  t0 = alo * blo - (t1 - ahi * bhi - alo * bhi - ahi * blo);
24243
24252
  _i = s0 - t0;
24244
24253
  bvirt = s0 - _i;
24245
- B$1[0] = s0 - (_i + bvirt) + (bvirt - t0);
24254
+ B$2[0] = s0 - (_i + bvirt) + (bvirt - t0);
24246
24255
  _j = s1 + _i;
24247
24256
  bvirt = _j - s1;
24248
24257
  _0 = s1 - (_j - bvirt) + (_i - bvirt);
24249
24258
  _i = _0 - t1;
24250
24259
  bvirt = _0 - _i;
24251
- B$1[1] = _0 - (_i + bvirt) + (bvirt - t1);
24260
+ B$2[1] = _0 - (_i + bvirt) + (bvirt - t1);
24252
24261
  u3 = _j + _i;
24253
24262
  bvirt = u3 - _j;
24254
- B$1[2] = _j - (u3 - bvirt) + (_i - bvirt);
24255
- B$1[3] = u3;
24263
+ B$2[2] = _j - (u3 - bvirt) + (_i - bvirt);
24264
+ B$2[3] = u3;
24256
24265
 
24257
- let det = estimate(4, B$1);
24266
+ let det = estimate(4, B$2);
24258
24267
  let errbound = ccwerrboundB * detsum;
24259
24268
  if (det >= errbound || -det >= errbound) {
24260
24269
  return det;
@@ -24306,7 +24315,7 @@ ${svg}
24306
24315
  bvirt = u3 - _j;
24307
24316
  u$2[2] = _j - (u3 - bvirt) + (_i - bvirt);
24308
24317
  u$2[3] = u3;
24309
- const C1len = sum(4, B$1, 4, u$2, C1);
24318
+ const C1len = sum(4, B$2, 4, u$2, C1);
24310
24319
 
24311
24320
  s1 = acx * bcytail;
24312
24321
  c = splitter * acx;
@@ -24368,9 +24377,9 @@ ${svg}
24368
24377
  bvirt = u3 - _j;
24369
24378
  u$2[2] = _j - (u3 - bvirt) + (_i - bvirt);
24370
24379
  u$2[3] = u3;
24371
- const Dlen = sum(C2len, C2, 4, u$2, D);
24380
+ const Dlen = sum(C2len, C2, 4, u$2, D$1);
24372
24381
 
24373
- return D[Dlen - 1];
24382
+ return D$1[Dlen - 1];
24374
24383
  }
24375
24384
 
24376
24385
  function orient2d(ax, ay, bx, by, cx, cy) {
@@ -27085,10 +27094,6 @@ ${svg}
27085
27094
  // polyline output could be used for debugging
27086
27095
  var outputGeom = opts.output_geometry == 'polyline' ? 'polyline' : 'polygon';
27087
27096
 
27088
- function polygonCoords(ring) {
27089
- return [ring];
27090
- }
27091
-
27092
27097
  function pathBufferCoords(pathArcs, dist) {
27093
27098
  var pathCoords = maker(pathArcs, dist);
27094
27099
  var revPathArcs;
@@ -27118,13 +27123,9 @@ ${svg}
27118
27123
  var backtrackSteps = opts.backtrack >= 0 ? opts.backtrack : 50;
27119
27124
  var pathIter = new ShapeIter(arcs);
27120
27125
  var capStyle = opts.cap_style || 'round'; // expect 'round' or 'flat'
27121
- var tolerance;
27126
+ // var tolerance;
27122
27127
  // TODO: implement other join styles than round
27123
27128
 
27124
- function updateTolerance(dist) {
27125
-
27126
- }
27127
-
27128
27129
  function addRoundJoin(arr, x, y, startDir, angle, dist) {
27129
27130
  var increment = 10;
27130
27131
  var endDir = startDir + angle;
@@ -27135,15 +27136,15 @@ ${svg}
27135
27136
  }
27136
27137
  }
27137
27138
 
27138
- function addRoundJoin2(arr, x, y, startDir, angle, dist) {
27139
- var increment = 10;
27140
- var endDir = startDir + angle;
27141
- var dir = startDir + increment;
27142
- while (dir < endDir) {
27143
- addBufferVertex(arr, geod(x, y, dir, dist), backtrackSteps);
27144
- dir += increment;
27145
- }
27146
- }
27139
+ // function addRoundJoin2(arr, x, y, startDir, angle, dist) {
27140
+ // var increment = 10;
27141
+ // var endDir = startDir + angle;
27142
+ // var dir = startDir + increment;
27143
+ // while (dir < endDir) {
27144
+ // addBufferVertex(arr, geod(x, y, dir, dist), backtrackSteps);
27145
+ // dir += increment;
27146
+ // }
27147
+ // }
27147
27148
 
27148
27149
  // Test if two points are within a snapping tolerance
27149
27150
  // TODO: calculate the tolerance more sensibly
@@ -27390,15 +27391,14 @@ ${svg}
27390
27391
  function getPathBufferMaker2(arcs, geod, getBearing, opts) {
27391
27392
  var backtrackSteps = opts.backtrack >= 0 ? opts.backtrack : 50;
27392
27393
  var pathIter = new ShapeIter(arcs);
27393
- var capStyle = opts.cap_style || 'round'; // expect 'round' or 'flat'
27394
- var tolerance;
27394
+ // var capStyle = opts.cap_style || 'round'; // expect 'round' or 'flat'
27395
27395
  var partials, left, center;
27396
27396
  var bounds;
27397
27397
  // TODO: implement other join styles than round
27398
27398
 
27399
- function updateTolerance(dist) {
27399
+ // function updateTolerance(dist) {
27400
27400
 
27401
- }
27401
+ // }
27402
27402
 
27403
27403
  function addRoundJoin(x, y, startDir, angle, dist) {
27404
27404
  var increment = 10;
@@ -27442,24 +27442,24 @@ ${svg}
27442
27442
  }
27443
27443
  }
27444
27444
 
27445
- function makeCap(x, y, direction, dist) {
27446
- if (capStyle == 'flat') {
27447
- return [[x, y]];
27448
- }
27449
- return makeRoundCap(x, y, direction, dist);
27450
- }
27445
+ // function makeCap(x, y, direction, dist) {
27446
+ // if (capStyle == 'flat') {
27447
+ // return [[x, y]];
27448
+ // }
27449
+ // return makeRoundCap(x, y, direction, dist);
27450
+ // }
27451
27451
 
27452
- function makeRoundCap(x, y, segmentDir, dist) {
27453
- var points = [];
27454
- var increment = 10;
27455
- var startDir = segmentDir - 90;
27456
- var angle = increment;
27457
- while (angle < 180) {
27458
- points.push(geod(x, y, startDir + angle, dist));
27459
- angle += increment;
27460
- }
27461
- return points;
27462
- }
27452
+ // function makeRoundCap(x, y, segmentDir, dist) {
27453
+ // var points = [];
27454
+ // var increment = 10;
27455
+ // var startDir = segmentDir - 90;
27456
+ // var angle = increment;
27457
+ // while (angle < 180) {
27458
+ // points.push(geod(x, y, startDir + angle, dist));
27459
+ // angle += increment;
27460
+ // }
27461
+ // return points;
27462
+ // }
27463
27463
 
27464
27464
  // get angle between two extruded segments in degrees
27465
27465
  // positive angle means join in convex (range: 0-180 degrees)
@@ -27556,18 +27556,20 @@ ${svg}
27556
27556
  }
27557
27557
 
27558
27558
  return function(path, dist) {
27559
- var x0, y0, x1, y1, x2, y2;
27559
+ // var x0, y0;
27560
+ var x1, y1, x2, y2;
27560
27561
  var p1, p2;
27561
- var bearing, prevBearing, firstBearing, joinAngle;
27562
+ // var firstBearing;
27563
+ var bearing, prevBearing, joinAngle;
27562
27564
  partials = [];
27563
27565
  left = [];
27564
27566
  center = [];
27565
27567
  pathIter.init(path);
27566
27568
 
27567
- if (pathIter.hasNext()) {
27568
- x0 = x2 = pathIter.x;
27569
- y0 = y2 = pathIter.y;
27570
- }
27569
+ // if (pathIter.hasNext()) {
27570
+ // x0 = x2 = pathIter.x;
27571
+ // y0 = y2 = pathIter.y;
27572
+ // }
27571
27573
  while (pathIter.hasNext()) {
27572
27574
  // TODO: use a tolerance
27573
27575
  if (pathIter.x === x2 && pathIter.y === y2) continue; // skip duplicate points
@@ -27584,9 +27586,9 @@ ${svg}
27584
27586
 
27585
27587
  if (center.length === 0) {
27586
27588
  // first loop, second point in this partial
27587
- if (partials.length === 0) {
27588
- firstBearing = bearing;
27589
- }
27589
+ // if (partials.length === 0) {
27590
+ // firstBearing = bearing;
27591
+ // }
27590
27592
  left.push(p1, p2);
27591
27593
  center.push([x1, y1], [x2, y2]);
27592
27594
  } else {
@@ -27633,7 +27635,7 @@ ${svg}
27633
27635
  function getGeodesic(P) {
27634
27636
  if (!isLatLngCRS(P)) error('Expected an unprojected CRS');
27635
27637
  var f = P.es / (1 + Math.sqrt(P.one_es));
27636
- var GeographicLib = require('mproj').internal.GeographicLib;
27638
+ var GeographicLib = require$1('mproj').internal.GeographicLib;
27637
27639
  return new GeographicLib.Geodesic.Geodesic(P.a, f);
27638
27640
  }
27639
27641
 
@@ -27762,7 +27764,7 @@ ${svg}
27762
27764
  var e = 1e-10;
27763
27765
  var T = 90 - e;
27764
27766
  var L = -180 + e;
27765
- var B = -90 + e;
27767
+ var B$1 = -90 + e;
27766
27768
  var R = 180 - e;
27767
27769
 
27768
27770
  function lastEl(arr) {
@@ -27790,12 +27792,12 @@ ${svg}
27790
27792
  function snapToEdge(p) {
27791
27793
  if (p[0] <= L) p[0] = -180;
27792
27794
  if (p[0] >= R) p[0] = 180;
27793
- if (p[1] <= B) p[1] = -90;
27795
+ if (p[1] <= B$1) p[1] = -90;
27794
27796
  if (p[1] >= T) p[1] = 90;
27795
27797
  }
27796
27798
 
27797
27799
  function onPole(p) {
27798
- return p[1] >= T || p[1] <= B;
27800
+ return p[1] >= T || p[1] <= B$1;
27799
27801
  }
27800
27802
 
27801
27803
  function isWholeWorld(coords) {
@@ -27821,7 +27823,7 @@ ${svg}
27821
27823
  }
27822
27824
 
27823
27825
  function isEdgePoint(p) {
27824
- return p[1] <= B || p[1] >= T || p[0] <= L || p[0] >= R;
27826
+ return p[1] <= B$1 || p[1] >= T || p[0] <= L || p[0] >= R;
27825
27827
  }
27826
27828
 
27827
27829
  // Remove segments that belong solely to cut points
@@ -28167,7 +28169,7 @@ ${svg}
28167
28169
  rings.push([
28168
28170
  [[180, 90], [180, -90], [0, -90], [-180, -90], [-180, 90], [0, 90], [180, 90]],
28169
28171
  coords
28170
- ]);
28172
+ ]);
28171
28173
  } else {
28172
28174
  rings.push([coords]);
28173
28175
  }
@@ -28362,6 +28364,1120 @@ ${svg}
28362
28364
  return s;
28363
28365
  }
28364
28366
 
28367
+ function define(constructor, factory, prototype) {
28368
+ constructor.prototype = factory.prototype = prototype;
28369
+ prototype.constructor = constructor;
28370
+ }
28371
+
28372
+ function extend(parent, definition) {
28373
+ var prototype = Object.create(parent.prototype);
28374
+ for (var key in definition) prototype[key] = definition[key];
28375
+ return prototype;
28376
+ }
28377
+
28378
+ function Color() {}
28379
+
28380
+ var darker = 0.7;
28381
+ var brighter = 1 / darker;
28382
+
28383
+ var reI = "\\s*([+-]?\\d+)\\s*",
28384
+ reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",
28385
+ reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
28386
+ reHex = /^#([0-9a-f]{3,8})$/,
28387
+ reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"),
28388
+ reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"),
28389
+ reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"),
28390
+ reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"),
28391
+ reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"),
28392
+ reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$");
28393
+
28394
+ var named = {
28395
+ aliceblue: 0xf0f8ff,
28396
+ antiquewhite: 0xfaebd7,
28397
+ aqua: 0x00ffff,
28398
+ aquamarine: 0x7fffd4,
28399
+ azure: 0xf0ffff,
28400
+ beige: 0xf5f5dc,
28401
+ bisque: 0xffe4c4,
28402
+ black: 0x000000,
28403
+ blanchedalmond: 0xffebcd,
28404
+ blue: 0x0000ff,
28405
+ blueviolet: 0x8a2be2,
28406
+ brown: 0xa52a2a,
28407
+ burlywood: 0xdeb887,
28408
+ cadetblue: 0x5f9ea0,
28409
+ chartreuse: 0x7fff00,
28410
+ chocolate: 0xd2691e,
28411
+ coral: 0xff7f50,
28412
+ cornflowerblue: 0x6495ed,
28413
+ cornsilk: 0xfff8dc,
28414
+ crimson: 0xdc143c,
28415
+ cyan: 0x00ffff,
28416
+ darkblue: 0x00008b,
28417
+ darkcyan: 0x008b8b,
28418
+ darkgoldenrod: 0xb8860b,
28419
+ darkgray: 0xa9a9a9,
28420
+ darkgreen: 0x006400,
28421
+ darkgrey: 0xa9a9a9,
28422
+ darkkhaki: 0xbdb76b,
28423
+ darkmagenta: 0x8b008b,
28424
+ darkolivegreen: 0x556b2f,
28425
+ darkorange: 0xff8c00,
28426
+ darkorchid: 0x9932cc,
28427
+ darkred: 0x8b0000,
28428
+ darksalmon: 0xe9967a,
28429
+ darkseagreen: 0x8fbc8f,
28430
+ darkslateblue: 0x483d8b,
28431
+ darkslategray: 0x2f4f4f,
28432
+ darkslategrey: 0x2f4f4f,
28433
+ darkturquoise: 0x00ced1,
28434
+ darkviolet: 0x9400d3,
28435
+ deeppink: 0xff1493,
28436
+ deepskyblue: 0x00bfff,
28437
+ dimgray: 0x696969,
28438
+ dimgrey: 0x696969,
28439
+ dodgerblue: 0x1e90ff,
28440
+ firebrick: 0xb22222,
28441
+ floralwhite: 0xfffaf0,
28442
+ forestgreen: 0x228b22,
28443
+ fuchsia: 0xff00ff,
28444
+ gainsboro: 0xdcdcdc,
28445
+ ghostwhite: 0xf8f8ff,
28446
+ gold: 0xffd700,
28447
+ goldenrod: 0xdaa520,
28448
+ gray: 0x808080,
28449
+ green: 0x008000,
28450
+ greenyellow: 0xadff2f,
28451
+ grey: 0x808080,
28452
+ honeydew: 0xf0fff0,
28453
+ hotpink: 0xff69b4,
28454
+ indianred: 0xcd5c5c,
28455
+ indigo: 0x4b0082,
28456
+ ivory: 0xfffff0,
28457
+ khaki: 0xf0e68c,
28458
+ lavender: 0xe6e6fa,
28459
+ lavenderblush: 0xfff0f5,
28460
+ lawngreen: 0x7cfc00,
28461
+ lemonchiffon: 0xfffacd,
28462
+ lightblue: 0xadd8e6,
28463
+ lightcoral: 0xf08080,
28464
+ lightcyan: 0xe0ffff,
28465
+ lightgoldenrodyellow: 0xfafad2,
28466
+ lightgray: 0xd3d3d3,
28467
+ lightgreen: 0x90ee90,
28468
+ lightgrey: 0xd3d3d3,
28469
+ lightpink: 0xffb6c1,
28470
+ lightsalmon: 0xffa07a,
28471
+ lightseagreen: 0x20b2aa,
28472
+ lightskyblue: 0x87cefa,
28473
+ lightslategray: 0x778899,
28474
+ lightslategrey: 0x778899,
28475
+ lightsteelblue: 0xb0c4de,
28476
+ lightyellow: 0xffffe0,
28477
+ lime: 0x00ff00,
28478
+ limegreen: 0x32cd32,
28479
+ linen: 0xfaf0e6,
28480
+ magenta: 0xff00ff,
28481
+ maroon: 0x800000,
28482
+ mediumaquamarine: 0x66cdaa,
28483
+ mediumblue: 0x0000cd,
28484
+ mediumorchid: 0xba55d3,
28485
+ mediumpurple: 0x9370db,
28486
+ mediumseagreen: 0x3cb371,
28487
+ mediumslateblue: 0x7b68ee,
28488
+ mediumspringgreen: 0x00fa9a,
28489
+ mediumturquoise: 0x48d1cc,
28490
+ mediumvioletred: 0xc71585,
28491
+ midnightblue: 0x191970,
28492
+ mintcream: 0xf5fffa,
28493
+ mistyrose: 0xffe4e1,
28494
+ moccasin: 0xffe4b5,
28495
+ navajowhite: 0xffdead,
28496
+ navy: 0x000080,
28497
+ oldlace: 0xfdf5e6,
28498
+ olive: 0x808000,
28499
+ olivedrab: 0x6b8e23,
28500
+ orange: 0xffa500,
28501
+ orangered: 0xff4500,
28502
+ orchid: 0xda70d6,
28503
+ palegoldenrod: 0xeee8aa,
28504
+ palegreen: 0x98fb98,
28505
+ paleturquoise: 0xafeeee,
28506
+ palevioletred: 0xdb7093,
28507
+ papayawhip: 0xffefd5,
28508
+ peachpuff: 0xffdab9,
28509
+ peru: 0xcd853f,
28510
+ pink: 0xffc0cb,
28511
+ plum: 0xdda0dd,
28512
+ powderblue: 0xb0e0e6,
28513
+ purple: 0x800080,
28514
+ rebeccapurple: 0x663399,
28515
+ red: 0xff0000,
28516
+ rosybrown: 0xbc8f8f,
28517
+ royalblue: 0x4169e1,
28518
+ saddlebrown: 0x8b4513,
28519
+ salmon: 0xfa8072,
28520
+ sandybrown: 0xf4a460,
28521
+ seagreen: 0x2e8b57,
28522
+ seashell: 0xfff5ee,
28523
+ sienna: 0xa0522d,
28524
+ silver: 0xc0c0c0,
28525
+ skyblue: 0x87ceeb,
28526
+ slateblue: 0x6a5acd,
28527
+ slategray: 0x708090,
28528
+ slategrey: 0x708090,
28529
+ snow: 0xfffafa,
28530
+ springgreen: 0x00ff7f,
28531
+ steelblue: 0x4682b4,
28532
+ tan: 0xd2b48c,
28533
+ teal: 0x008080,
28534
+ thistle: 0xd8bfd8,
28535
+ tomato: 0xff6347,
28536
+ turquoise: 0x40e0d0,
28537
+ violet: 0xee82ee,
28538
+ wheat: 0xf5deb3,
28539
+ white: 0xffffff,
28540
+ whitesmoke: 0xf5f5f5,
28541
+ yellow: 0xffff00,
28542
+ yellowgreen: 0x9acd32
28543
+ };
28544
+
28545
+ define(Color, color, {
28546
+ copy: function(channels) {
28547
+ return Object.assign(new this.constructor, this, channels);
28548
+ },
28549
+ displayable: function() {
28550
+ return this.rgb().displayable();
28551
+ },
28552
+ hex: color_formatHex, // Deprecated! Use color.formatHex.
28553
+ formatHex: color_formatHex,
28554
+ formatHsl: color_formatHsl,
28555
+ formatRgb: color_formatRgb,
28556
+ toString: color_formatRgb
28557
+ });
28558
+
28559
+ function color_formatHex() {
28560
+ return this.rgb().formatHex();
28561
+ }
28562
+
28563
+ function color_formatHsl() {
28564
+ return hslConvert(this).formatHsl();
28565
+ }
28566
+
28567
+ function color_formatRgb() {
28568
+ return this.rgb().formatRgb();
28569
+ }
28570
+
28571
+ function color(format) {
28572
+ var m, l;
28573
+ format = (format + "").trim().toLowerCase();
28574
+ return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000
28575
+ : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00
28576
+ : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000
28577
+ : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000
28578
+ : null) // invalid hex
28579
+ : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0)
28580
+ : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%)
28581
+ : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1)
28582
+ : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1)
28583
+ : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%)
28584
+ : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1)
28585
+ : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins
28586
+ : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0)
28587
+ : null;
28588
+ }
28589
+
28590
+ function rgbn(n) {
28591
+ return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1);
28592
+ }
28593
+
28594
+ function rgba(r, g, b, a) {
28595
+ if (a <= 0) r = g = b = NaN;
28596
+ return new Rgb(r, g, b, a);
28597
+ }
28598
+
28599
+ function rgbConvert(o) {
28600
+ if (!(o instanceof Color)) o = color(o);
28601
+ if (!o) return new Rgb;
28602
+ o = o.rgb();
28603
+ return new Rgb(o.r, o.g, o.b, o.opacity);
28604
+ }
28605
+
28606
+ function rgb$1(r, g, b, opacity) {
28607
+ return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
28608
+ }
28609
+
28610
+ function Rgb(r, g, b, opacity) {
28611
+ this.r = +r;
28612
+ this.g = +g;
28613
+ this.b = +b;
28614
+ this.opacity = +opacity;
28615
+ }
28616
+
28617
+ define(Rgb, rgb$1, extend(Color, {
28618
+ brighter: function(k) {
28619
+ k = k == null ? brighter : Math.pow(brighter, k);
28620
+ return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
28621
+ },
28622
+ darker: function(k) {
28623
+ k = k == null ? darker : Math.pow(darker, k);
28624
+ return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
28625
+ },
28626
+ rgb: function() {
28627
+ return this;
28628
+ },
28629
+ displayable: function() {
28630
+ return (-0.5 <= this.r && this.r < 255.5)
28631
+ && (-0.5 <= this.g && this.g < 255.5)
28632
+ && (-0.5 <= this.b && this.b < 255.5)
28633
+ && (0 <= this.opacity && this.opacity <= 1);
28634
+ },
28635
+ hex: rgb_formatHex, // Deprecated! Use color.formatHex.
28636
+ formatHex: rgb_formatHex,
28637
+ formatRgb: rgb_formatRgb,
28638
+ toString: rgb_formatRgb
28639
+ }));
28640
+
28641
+ function rgb_formatHex() {
28642
+ return "#" + hex(this.r) + hex(this.g) + hex(this.b);
28643
+ }
28644
+
28645
+ function rgb_formatRgb() {
28646
+ var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
28647
+ return (a === 1 ? "rgb(" : "rgba(")
28648
+ + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", "
28649
+ + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", "
28650
+ + Math.max(0, Math.min(255, Math.round(this.b) || 0))
28651
+ + (a === 1 ? ")" : ", " + a + ")");
28652
+ }
28653
+
28654
+ function hex(value) {
28655
+ value = Math.max(0, Math.min(255, Math.round(value) || 0));
28656
+ return (value < 16 ? "0" : "") + value.toString(16);
28657
+ }
28658
+
28659
+ function hsla(h, s, l, a) {
28660
+ if (a <= 0) h = s = l = NaN;
28661
+ else if (l <= 0 || l >= 1) h = s = NaN;
28662
+ else if (s <= 0) h = NaN;
28663
+ return new Hsl(h, s, l, a);
28664
+ }
28665
+
28666
+ function hslConvert(o) {
28667
+ if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
28668
+ if (!(o instanceof Color)) o = color(o);
28669
+ if (!o) return new Hsl;
28670
+ if (o instanceof Hsl) return o;
28671
+ o = o.rgb();
28672
+ var r = o.r / 255,
28673
+ g = o.g / 255,
28674
+ b = o.b / 255,
28675
+ min = Math.min(r, g, b),
28676
+ max = Math.max(r, g, b),
28677
+ h = NaN,
28678
+ s = max - min,
28679
+ l = (max + min) / 2;
28680
+ if (s) {
28681
+ if (r === max) h = (g - b) / s + (g < b) * 6;
28682
+ else if (g === max) h = (b - r) / s + 2;
28683
+ else h = (r - g) / s + 4;
28684
+ s /= l < 0.5 ? max + min : 2 - max - min;
28685
+ h *= 60;
28686
+ } else {
28687
+ s = l > 0 && l < 1 ? 0 : h;
28688
+ }
28689
+ return new Hsl(h, s, l, o.opacity);
28690
+ }
28691
+
28692
+ function hsl$2(h, s, l, opacity) {
28693
+ return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
28694
+ }
28695
+
28696
+ function Hsl(h, s, l, opacity) {
28697
+ this.h = +h;
28698
+ this.s = +s;
28699
+ this.l = +l;
28700
+ this.opacity = +opacity;
28701
+ }
28702
+
28703
+ define(Hsl, hsl$2, extend(Color, {
28704
+ brighter: function(k) {
28705
+ k = k == null ? brighter : Math.pow(brighter, k);
28706
+ return new Hsl(this.h, this.s, this.l * k, this.opacity);
28707
+ },
28708
+ darker: function(k) {
28709
+ k = k == null ? darker : Math.pow(darker, k);
28710
+ return new Hsl(this.h, this.s, this.l * k, this.opacity);
28711
+ },
28712
+ rgb: function() {
28713
+ var h = this.h % 360 + (this.h < 0) * 360,
28714
+ s = isNaN(h) || isNaN(this.s) ? 0 : this.s,
28715
+ l = this.l,
28716
+ m2 = l + (l < 0.5 ? l : 1 - l) * s,
28717
+ m1 = 2 * l - m2;
28718
+ return new Rgb(
28719
+ hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
28720
+ hsl2rgb(h, m1, m2),
28721
+ hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
28722
+ this.opacity
28723
+ );
28724
+ },
28725
+ displayable: function() {
28726
+ return (0 <= this.s && this.s <= 1 || isNaN(this.s))
28727
+ && (0 <= this.l && this.l <= 1)
28728
+ && (0 <= this.opacity && this.opacity <= 1);
28729
+ },
28730
+ formatHsl: function() {
28731
+ var a = this.opacity; a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
28732
+ return (a === 1 ? "hsl(" : "hsla(")
28733
+ + (this.h || 0) + ", "
28734
+ + (this.s || 0) * 100 + "%, "
28735
+ + (this.l || 0) * 100 + "%"
28736
+ + (a === 1 ? ")" : ", " + a + ")");
28737
+ }
28738
+ }));
28739
+
28740
+ /* From FvD 13.37, CSS Color Module Level 3 */
28741
+ function hsl2rgb(h, m1, m2) {
28742
+ return (h < 60 ? m1 + (m2 - m1) * h / 60
28743
+ : h < 180 ? m2
28744
+ : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60
28745
+ : m1) * 255;
28746
+ }
28747
+
28748
+ const radians = Math.PI / 180;
28749
+ const degrees$1 = 180 / Math.PI;
28750
+
28751
+ // https://observablehq.com/@mbostock/lab-and-rgb
28752
+ const K = 18,
28753
+ Xn = 0.96422,
28754
+ Yn = 1,
28755
+ Zn = 0.82521,
28756
+ t0 = 4 / 29,
28757
+ t1 = 6 / 29,
28758
+ t2 = 3 * t1 * t1,
28759
+ t3 = t1 * t1 * t1;
28760
+
28761
+ function labConvert(o) {
28762
+ if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
28763
+ if (o instanceof Hcl) return hcl2lab(o);
28764
+ if (!(o instanceof Rgb)) o = rgbConvert(o);
28765
+ var r = rgb2lrgb(o.r),
28766
+ g = rgb2lrgb(o.g),
28767
+ b = rgb2lrgb(o.b),
28768
+ y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;
28769
+ if (r === g && g === b) x = z = y; else {
28770
+ x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);
28771
+ z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);
28772
+ }
28773
+ return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
28774
+ }
28775
+
28776
+ function gray(l, opacity) {
28777
+ return new Lab(l, 0, 0, opacity == null ? 1 : opacity);
28778
+ }
28779
+
28780
+ function lab$1(l, a, b, opacity) {
28781
+ return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
28782
+ }
28783
+
28784
+ function Lab(l, a, b, opacity) {
28785
+ this.l = +l;
28786
+ this.a = +a;
28787
+ this.b = +b;
28788
+ this.opacity = +opacity;
28789
+ }
28790
+
28791
+ define(Lab, lab$1, extend(Color, {
28792
+ brighter: function(k) {
28793
+ return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);
28794
+ },
28795
+ darker: function(k) {
28796
+ return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);
28797
+ },
28798
+ rgb: function() {
28799
+ var y = (this.l + 16) / 116,
28800
+ x = isNaN(this.a) ? y : y + this.a / 500,
28801
+ z = isNaN(this.b) ? y : y - this.b / 200;
28802
+ x = Xn * lab2xyz(x);
28803
+ y = Yn * lab2xyz(y);
28804
+ z = Zn * lab2xyz(z);
28805
+ return new Rgb(
28806
+ lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z),
28807
+ lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),
28808
+ lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z),
28809
+ this.opacity
28810
+ );
28811
+ }
28812
+ }));
28813
+
28814
+ function xyz2lab(t) {
28815
+ return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0;
28816
+ }
28817
+
28818
+ function lab2xyz(t) {
28819
+ return t > t1 ? t * t * t : t2 * (t - t0);
28820
+ }
28821
+
28822
+ function lrgb2rgb(x) {
28823
+ return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
28824
+ }
28825
+
28826
+ function rgb2lrgb(x) {
28827
+ return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
28828
+ }
28829
+
28830
+ function hclConvert(o) {
28831
+ if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
28832
+ if (!(o instanceof Lab)) o = labConvert(o);
28833
+ if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);
28834
+ var h = Math.atan2(o.b, o.a) * degrees$1;
28835
+ return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
28836
+ }
28837
+
28838
+ function lch(l, c, h, opacity) {
28839
+ return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
28840
+ }
28841
+
28842
+ function hcl$2(h, c, l, opacity) {
28843
+ return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
28844
+ }
28845
+
28846
+ function Hcl(h, c, l, opacity) {
28847
+ this.h = +h;
28848
+ this.c = +c;
28849
+ this.l = +l;
28850
+ this.opacity = +opacity;
28851
+ }
28852
+
28853
+ function hcl2lab(o) {
28854
+ if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);
28855
+ var h = o.h * radians;
28856
+ return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
28857
+ }
28858
+
28859
+ define(Hcl, hcl$2, extend(Color, {
28860
+ brighter: function(k) {
28861
+ return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);
28862
+ },
28863
+ darker: function(k) {
28864
+ return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);
28865
+ },
28866
+ rgb: function() {
28867
+ return hcl2lab(this).rgb();
28868
+ }
28869
+ }));
28870
+
28871
+ var A = -0.14861,
28872
+ B = +1.78277,
28873
+ C = -0.29227,
28874
+ D = -0.90649,
28875
+ E = +1.97294,
28876
+ ED = E * D,
28877
+ EB = E * B,
28878
+ BC_DA = B * C - D * A;
28879
+
28880
+ function cubehelixConvert(o) {
28881
+ if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
28882
+ if (!(o instanceof Rgb)) o = rgbConvert(o);
28883
+ var r = o.r / 255,
28884
+ g = o.g / 255,
28885
+ b = o.b / 255,
28886
+ l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB),
28887
+ bl = b - l,
28888
+ k = (E * (g - l) - C * bl) / D,
28889
+ s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), // NaN if l=0 or l=1
28890
+ h = s ? Math.atan2(k, bl) * degrees$1 - 120 : NaN;
28891
+ return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
28892
+ }
28893
+
28894
+ function cubehelix$3(h, s, l, opacity) {
28895
+ return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity);
28896
+ }
28897
+
28898
+ function Cubehelix(h, s, l, opacity) {
28899
+ this.h = +h;
28900
+ this.s = +s;
28901
+ this.l = +l;
28902
+ this.opacity = +opacity;
28903
+ }
28904
+
28905
+ define(Cubehelix, cubehelix$3, extend(Color, {
28906
+ brighter: function(k) {
28907
+ k = k == null ? brighter : Math.pow(brighter, k);
28908
+ return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
28909
+ },
28910
+ darker: function(k) {
28911
+ k = k == null ? darker : Math.pow(darker, k);
28912
+ return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
28913
+ },
28914
+ rgb: function() {
28915
+ var h = isNaN(this.h) ? 0 : (this.h + 120) * radians,
28916
+ l = +this.l,
28917
+ a = isNaN(this.s) ? 0 : this.s * l * (1 - l),
28918
+ cosh = Math.cos(h),
28919
+ sinh = Math.sin(h);
28920
+ return new Rgb(
28921
+ 255 * (l + a * (A * cosh + B * sinh)),
28922
+ 255 * (l + a * (C * cosh + D * sinh)),
28923
+ 255 * (l + a * (E * cosh)),
28924
+ this.opacity
28925
+ );
28926
+ }
28927
+ }));
28928
+
28929
+ function basis(t1, v0, v1, v2, v3) {
28930
+ var t2 = t1 * t1, t3 = t2 * t1;
28931
+ return ((1 - 3 * t1 + 3 * t2 - t3) * v0
28932
+ + (4 - 6 * t2 + 3 * t3) * v1
28933
+ + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2
28934
+ + t3 * v3) / 6;
28935
+ }
28936
+
28937
+ function basis$1(values) {
28938
+ var n = values.length - 1;
28939
+ return function(t) {
28940
+ var i = t <= 0 ? (t = 0) : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n),
28941
+ v1 = values[i],
28942
+ v2 = values[i + 1],
28943
+ v0 = i > 0 ? values[i - 1] : 2 * v1 - v2,
28944
+ v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
28945
+ return basis((t - i / n) * n, v0, v1, v2, v3);
28946
+ };
28947
+ }
28948
+
28949
+ function basisClosed(values) {
28950
+ var n = values.length;
28951
+ return function(t) {
28952
+ var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n),
28953
+ v0 = values[(i + n - 1) % n],
28954
+ v1 = values[i % n],
28955
+ v2 = values[(i + 1) % n],
28956
+ v3 = values[(i + 2) % n];
28957
+ return basis((t - i / n) * n, v0, v1, v2, v3);
28958
+ };
28959
+ }
28960
+
28961
+ var constant = x => () => x;
28962
+
28963
+ function linear(a, d) {
28964
+ return function(t) {
28965
+ return a + t * d;
28966
+ };
28967
+ }
28968
+
28969
+ function exponential(a, b, y) {
28970
+ return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
28971
+ return Math.pow(a + t * b, y);
28972
+ };
28973
+ }
28974
+
28975
+ function hue$1(a, b) {
28976
+ var d = b - a;
28977
+ return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a);
28978
+ }
28979
+
28980
+ function gamma(y) {
28981
+ return (y = +y) === 1 ? nogamma : function(a, b) {
28982
+ return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);
28983
+ };
28984
+ }
28985
+
28986
+ function nogamma(a, b) {
28987
+ var d = b - a;
28988
+ return d ? linear(a, d) : constant(isNaN(a) ? b : a);
28989
+ }
28990
+
28991
+ var rgb = (function rgbGamma(y) {
28992
+ var color = gamma(y);
28993
+
28994
+ function rgb(start, end) {
28995
+ var r = color((start = rgb$1(start)).r, (end = rgb$1(end)).r),
28996
+ g = color(start.g, end.g),
28997
+ b = color(start.b, end.b),
28998
+ opacity = nogamma(start.opacity, end.opacity);
28999
+ return function(t) {
29000
+ start.r = r(t);
29001
+ start.g = g(t);
29002
+ start.b = b(t);
29003
+ start.opacity = opacity(t);
29004
+ return start + "";
29005
+ };
29006
+ }
29007
+
29008
+ rgb.gamma = rgbGamma;
29009
+
29010
+ return rgb;
29011
+ })(1);
29012
+
29013
+ function rgbSpline(spline) {
29014
+ return function(colors) {
29015
+ var n = colors.length,
29016
+ r = new Array(n),
29017
+ g = new Array(n),
29018
+ b = new Array(n),
29019
+ i, color;
29020
+ for (i = 0; i < n; ++i) {
29021
+ color = rgb$1(colors[i]);
29022
+ r[i] = color.r || 0;
29023
+ g[i] = color.g || 0;
29024
+ b[i] = color.b || 0;
29025
+ }
29026
+ r = spline(r);
29027
+ g = spline(g);
29028
+ b = spline(b);
29029
+ color.opacity = 1;
29030
+ return function(t) {
29031
+ color.r = r(t);
29032
+ color.g = g(t);
29033
+ color.b = b(t);
29034
+ return color + "";
29035
+ };
29036
+ };
29037
+ }
29038
+
29039
+ var rgbBasis = rgbSpline(basis$1);
29040
+ var rgbBasisClosed = rgbSpline(basisClosed);
29041
+
29042
+ function numberArray(a, b) {
29043
+ if (!b) b = [];
29044
+ var n = a ? Math.min(b.length, a.length) : 0,
29045
+ c = b.slice(),
29046
+ i;
29047
+ return function(t) {
29048
+ for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t;
29049
+ return c;
29050
+ };
29051
+ }
29052
+
29053
+ function isNumberArray(x) {
29054
+ return ArrayBuffer.isView(x) && !(x instanceof DataView);
29055
+ }
29056
+
29057
+ function array(a, b) {
29058
+ return (isNumberArray(b) ? numberArray : genericArray)(a, b);
29059
+ }
29060
+
29061
+ function genericArray(a, b) {
29062
+ var nb = b ? b.length : 0,
29063
+ na = a ? Math.min(nb, a.length) : 0,
29064
+ x = new Array(na),
29065
+ c = new Array(nb),
29066
+ i;
29067
+
29068
+ for (i = 0; i < na; ++i) x[i] = d3_interpolate(a[i], b[i]);
29069
+ for (; i < nb; ++i) c[i] = b[i];
29070
+
29071
+ return function(t) {
29072
+ for (i = 0; i < na; ++i) c[i] = x[i](t);
29073
+ return c;
29074
+ };
29075
+ }
29076
+
29077
+ function date(a, b) {
29078
+ var d = new Date;
29079
+ return a = +a, b = +b, function(t) {
29080
+ return d.setTime(a * (1 - t) + b * t), d;
29081
+ };
29082
+ }
29083
+
29084
+ function number(a, b) {
29085
+ return a = +a, b = +b, function(t) {
29086
+ return a * (1 - t) + b * t;
29087
+ };
29088
+ }
29089
+
29090
+ function object(a, b) {
29091
+ var i = {},
29092
+ c = {},
29093
+ k;
29094
+
29095
+ if (a === null || typeof a !== "object") a = {};
29096
+ if (b === null || typeof b !== "object") b = {};
29097
+
29098
+ for (k in b) {
29099
+ if (k in a) {
29100
+ i[k] = d3_interpolate(a[k], b[k]);
29101
+ } else {
29102
+ c[k] = b[k];
29103
+ }
29104
+ }
29105
+
29106
+ return function(t) {
29107
+ for (k in i) c[k] = i[k](t);
29108
+ return c;
29109
+ };
29110
+ }
29111
+
29112
+ var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,
29113
+ reB = new RegExp(reA.source, "g");
29114
+
29115
+ function zero(b) {
29116
+ return function() {
29117
+ return b;
29118
+ };
29119
+ }
29120
+
29121
+ function one(b) {
29122
+ return function(t) {
29123
+ return b(t) + "";
29124
+ };
29125
+ }
29126
+
29127
+ function string(a, b) {
29128
+ var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b
29129
+ am, // current match in a
29130
+ bm, // current match in b
29131
+ bs, // string preceding current number in b, if any
29132
+ i = -1, // index in s
29133
+ s = [], // string constants and placeholders
29134
+ q = []; // number interpolators
29135
+
29136
+ // Coerce inputs to strings.
29137
+ a = a + "", b = b + "";
29138
+
29139
+ // Interpolate pairs of numbers in a & b.
29140
+ while ((am = reA.exec(a))
29141
+ && (bm = reB.exec(b))) {
29142
+ if ((bs = bm.index) > bi) { // a string precedes the next number in b
29143
+ bs = b.slice(bi, bs);
29144
+ if (s[i]) s[i] += bs; // coalesce with previous string
29145
+ else s[++i] = bs;
29146
+ }
29147
+ if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match
29148
+ if (s[i]) s[i] += bm; // coalesce with previous string
29149
+ else s[++i] = bm;
29150
+ } else { // interpolate non-matching numbers
29151
+ s[++i] = null;
29152
+ q.push({i: i, x: number(am, bm)});
29153
+ }
29154
+ bi = reB.lastIndex;
29155
+ }
29156
+
29157
+ // Add remains of b.
29158
+ if (bi < b.length) {
29159
+ bs = b.slice(bi);
29160
+ if (s[i]) s[i] += bs; // coalesce with previous string
29161
+ else s[++i] = bs;
29162
+ }
29163
+
29164
+ // Special optimization for only a single match.
29165
+ // Otherwise, interpolate each of the numbers and rejoin the string.
29166
+ return s.length < 2 ? (q[0]
29167
+ ? one(q[0].x)
29168
+ : zero(b))
29169
+ : (b = q.length, function(t) {
29170
+ for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t);
29171
+ return s.join("");
29172
+ });
29173
+ }
29174
+
29175
+ function d3_interpolate(a, b) {
29176
+ var t = typeof b, c;
29177
+ return b == null || t === "boolean" ? constant(b)
29178
+ : (t === "number" ? number
29179
+ : t === "string" ? ((c = color(b)) ? (b = c, rgb) : string)
29180
+ : b instanceof color ? rgb
29181
+ : b instanceof Date ? date
29182
+ : isNumberArray(b) ? numberArray
29183
+ : Array.isArray(b) ? genericArray
29184
+ : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object
29185
+ : number)(a, b);
29186
+ }
29187
+
29188
+ function discrete(range) {
29189
+ var n = range.length;
29190
+ return function(t) {
29191
+ return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
29192
+ };
29193
+ }
29194
+
29195
+ function hue(a, b) {
29196
+ var i = hue$1(+a, +b);
29197
+ return function(t) {
29198
+ var x = i(t);
29199
+ return x - 360 * Math.floor(x / 360);
29200
+ };
29201
+ }
29202
+
29203
+ function round(a, b) {
29204
+ return a = +a, b = +b, function(t) {
29205
+ return Math.round(a * (1 - t) + b * t);
29206
+ };
29207
+ }
29208
+
29209
+ var degrees = 180 / Math.PI;
29210
+
29211
+ var identity = {
29212
+ translateX: 0,
29213
+ translateY: 0,
29214
+ rotate: 0,
29215
+ skewX: 0,
29216
+ scaleX: 1,
29217
+ scaleY: 1
29218
+ };
29219
+
29220
+ function decompose(a, b, c, d, e, f) {
29221
+ var scaleX, scaleY, skewX;
29222
+ if (scaleX = Math.sqrt(a * a + b * b)) a /= scaleX, b /= scaleX;
29223
+ if (skewX = a * c + b * d) c -= a * skewX, d -= b * skewX;
29224
+ if (scaleY = Math.sqrt(c * c + d * d)) c /= scaleY, d /= scaleY, skewX /= scaleY;
29225
+ if (a * d < b * c) a = -a, b = -b, skewX = -skewX, scaleX = -scaleX;
29226
+ return {
29227
+ translateX: e,
29228
+ translateY: f,
29229
+ rotate: Math.atan2(b, a) * degrees,
29230
+ skewX: Math.atan(skewX) * degrees,
29231
+ scaleX: scaleX,
29232
+ scaleY: scaleY
29233
+ };
29234
+ }
29235
+
29236
+ var svgNode;
29237
+
29238
+ /* eslint-disable no-undef */
29239
+ function parseCss(value) {
29240
+ const m = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + "");
29241
+ return m.isIdentity ? identity : decompose(m.a, m.b, m.c, m.d, m.e, m.f);
29242
+ }
29243
+
29244
+ function parseSvg(value) {
29245
+ if (value == null) return identity;
29246
+ if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g");
29247
+ svgNode.setAttribute("transform", value);
29248
+ if (!(value = svgNode.transform.baseVal.consolidate())) return identity;
29249
+ value = value.matrix;
29250
+ return decompose(value.a, value.b, value.c, value.d, value.e, value.f);
29251
+ }
29252
+
29253
+ function interpolateTransform(parse, pxComma, pxParen, degParen) {
29254
+
29255
+ function pop(s) {
29256
+ return s.length ? s.pop() + " " : "";
29257
+ }
29258
+
29259
+ function translate(xa, ya, xb, yb, s, q) {
29260
+ if (xa !== xb || ya !== yb) {
29261
+ var i = s.push("translate(", null, pxComma, null, pxParen);
29262
+ q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});
29263
+ } else if (xb || yb) {
29264
+ s.push("translate(" + xb + pxComma + yb + pxParen);
29265
+ }
29266
+ }
29267
+
29268
+ function rotate(a, b, s, q) {
29269
+ if (a !== b) {
29270
+ if (a - b > 180) b += 360; else if (b - a > 180) a += 360; // shortest path
29271
+ q.push({i: s.push(pop(s) + "rotate(", null, degParen) - 2, x: number(a, b)});
29272
+ } else if (b) {
29273
+ s.push(pop(s) + "rotate(" + b + degParen);
29274
+ }
29275
+ }
29276
+
29277
+ function skewX(a, b, s, q) {
29278
+ if (a !== b) {
29279
+ q.push({i: s.push(pop(s) + "skewX(", null, degParen) - 2, x: number(a, b)});
29280
+ } else if (b) {
29281
+ s.push(pop(s) + "skewX(" + b + degParen);
29282
+ }
29283
+ }
29284
+
29285
+ function scale(xa, ya, xb, yb, s, q) {
29286
+ if (xa !== xb || ya !== yb) {
29287
+ var i = s.push(pop(s) + "scale(", null, ",", null, ")");
29288
+ q.push({i: i - 4, x: number(xa, xb)}, {i: i - 2, x: number(ya, yb)});
29289
+ } else if (xb !== 1 || yb !== 1) {
29290
+ s.push(pop(s) + "scale(" + xb + "," + yb + ")");
29291
+ }
29292
+ }
29293
+
29294
+ return function(a, b) {
29295
+ var s = [], // string constants and placeholders
29296
+ q = []; // number interpolators
29297
+ a = parse(a), b = parse(b);
29298
+ translate(a.translateX, a.translateY, b.translateX, b.translateY, s, q);
29299
+ rotate(a.rotate, b.rotate, s, q);
29300
+ skewX(a.skewX, b.skewX, s, q);
29301
+ scale(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q);
29302
+ a = b = null; // gc
29303
+ return function(t) {
29304
+ var i = -1, n = q.length, o;
29305
+ while (++i < n) s[(o = q[i]).i] = o.x(t);
29306
+ return s.join("");
29307
+ };
29308
+ };
29309
+ }
29310
+
29311
+ var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)");
29312
+ var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")");
29313
+
29314
+ var epsilon2 = 1e-12;
29315
+
29316
+ function cosh(x) {
29317
+ return ((x = Math.exp(x)) + 1 / x) / 2;
29318
+ }
29319
+
29320
+ function sinh(x) {
29321
+ return ((x = Math.exp(x)) - 1 / x) / 2;
29322
+ }
29323
+
29324
+ function tanh(x) {
29325
+ return ((x = Math.exp(2 * x)) - 1) / (x + 1);
29326
+ }
29327
+
29328
+ var zoom = (function zoomRho(rho, rho2, rho4) {
29329
+
29330
+ // p0 = [ux0, uy0, w0]
29331
+ // p1 = [ux1, uy1, w1]
29332
+ function zoom(p0, p1) {
29333
+ var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],
29334
+ ux1 = p1[0], uy1 = p1[1], w1 = p1[2],
29335
+ dx = ux1 - ux0,
29336
+ dy = uy1 - uy0,
29337
+ d2 = dx * dx + dy * dy,
29338
+ i,
29339
+ S;
29340
+
29341
+ // Special case for u0 ≅ u1.
29342
+ if (d2 < epsilon2) {
29343
+ S = Math.log(w1 / w0) / rho;
29344
+ i = function(t) {
29345
+ return [
29346
+ ux0 + t * dx,
29347
+ uy0 + t * dy,
29348
+ w0 * Math.exp(rho * t * S)
29349
+ ];
29350
+ };
29351
+ }
29352
+
29353
+ // General case.
29354
+ else {
29355
+ var d1 = Math.sqrt(d2),
29356
+ b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
29357
+ b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
29358
+ r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
29359
+ r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
29360
+ S = (r1 - r0) / rho;
29361
+ i = function(t) {
29362
+ var s = t * S,
29363
+ coshr0 = cosh(r0),
29364
+ u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
29365
+ return [
29366
+ ux0 + u * dx,
29367
+ uy0 + u * dy,
29368
+ w0 * coshr0 / cosh(rho * s + r0)
29369
+ ];
29370
+ };
29371
+ }
29372
+
29373
+ i.duration = S * 1000 * rho / Math.SQRT2;
29374
+
29375
+ return i;
29376
+ }
29377
+
29378
+ zoom.rho = function(_) {
29379
+ var _1 = Math.max(1e-3, +_), _2 = _1 * _1, _4 = _2 * _2;
29380
+ return zoomRho(_1, _2, _4);
29381
+ };
29382
+
29383
+ return zoom;
29384
+ })(Math.SQRT2, 2, 4);
29385
+
29386
+ function hsl(hue) {
29387
+ return function(start, end) {
29388
+ var h = hue((start = hsl$2(start)).h, (end = hsl$2(end)).h),
29389
+ s = nogamma(start.s, end.s),
29390
+ l = nogamma(start.l, end.l),
29391
+ opacity = nogamma(start.opacity, end.opacity);
29392
+ return function(t) {
29393
+ start.h = h(t);
29394
+ start.s = s(t);
29395
+ start.l = l(t);
29396
+ start.opacity = opacity(t);
29397
+ return start + "";
29398
+ };
29399
+ }
29400
+ }
29401
+
29402
+ var hsl$1 = hsl(hue$1);
29403
+ var hslLong = hsl(nogamma);
29404
+
29405
+ function lab(start, end) {
29406
+ var l = nogamma((start = lab$1(start)).l, (end = lab$1(end)).l),
29407
+ a = nogamma(start.a, end.a),
29408
+ b = nogamma(start.b, end.b),
29409
+ opacity = nogamma(start.opacity, end.opacity);
29410
+ return function(t) {
29411
+ start.l = l(t);
29412
+ start.a = a(t);
29413
+ start.b = b(t);
29414
+ start.opacity = opacity(t);
29415
+ return start + "";
29416
+ };
29417
+ }
29418
+
29419
+ function hcl(hue) {
29420
+ return function(start, end) {
29421
+ var h = hue((start = hcl$2(start)).h, (end = hcl$2(end)).h),
29422
+ c = nogamma(start.c, end.c),
29423
+ l = nogamma(start.l, end.l),
29424
+ opacity = nogamma(start.opacity, end.opacity);
29425
+ return function(t) {
29426
+ start.h = h(t);
29427
+ start.c = c(t);
29428
+ start.l = l(t);
29429
+ start.opacity = opacity(t);
29430
+ return start + "";
29431
+ };
29432
+ }
29433
+ }
29434
+
29435
+ var hcl$1 = hcl(hue$1);
29436
+ var hclLong = hcl(nogamma);
29437
+
29438
+ function cubehelix$1(hue) {
29439
+ return (function cubehelixGamma(y) {
29440
+ y = +y;
29441
+
29442
+ function cubehelix(start, end) {
29443
+ var h = hue((start = cubehelix$3(start)).h, (end = cubehelix$3(end)).h),
29444
+ s = nogamma(start.s, end.s),
29445
+ l = nogamma(start.l, end.l),
29446
+ opacity = nogamma(start.opacity, end.opacity);
29447
+ return function(t) {
29448
+ start.h = h(t);
29449
+ start.s = s(t);
29450
+ start.l = l(Math.pow(t, y));
29451
+ start.opacity = opacity(t);
29452
+ return start + "";
29453
+ };
29454
+ }
29455
+
29456
+ cubehelix.gamma = cubehelixGamma;
29457
+
29458
+ return cubehelix;
29459
+ })(1);
29460
+ }
29461
+
29462
+ var cubehelix$2 = cubehelix$1(hue$1);
29463
+ var cubehelixLong = cubehelix$1(nogamma);
29464
+
29465
+ function piecewise(interpolate, values) {
29466
+ if (values === undefined) values = interpolate, interpolate = d3_interpolate;
29467
+ var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n);
29468
+ while (i < n) I[i] = interpolate(v, v = values[++i]);
29469
+ return function(t) {
29470
+ var i = Math.max(0, Math.min(n - 1, Math.floor(t *= n)));
29471
+ return I[i](t - i);
29472
+ };
29473
+ }
29474
+
29475
+ function quantize(interpolator, n) {
29476
+ var samples = new Array(n);
29477
+ for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));
29478
+ return samples;
29479
+ }
29480
+
28365
29481
  // TODO: support three or more stops
28366
29482
  function getGradientFunction(stops) {
28367
29483
  var min = stops[0] / 100,
@@ -28393,11 +29509,10 @@ ${svg}
28393
29509
 
28394
29510
  // convert a continuous index ([0, n-1], -1) to a corresponding interpolated value
28395
29511
  function getInterpolatedValueGetter(values, nullValue) {
28396
- var d3 = require('d3-interpolate');
28397
29512
  var interpolators = [];
28398
29513
  var tmax = values.length - 1;
28399
29514
  for (var i=1; i<values.length; i++) {
28400
- interpolators.push(d3.interpolate(values[i-1], values[i]));
29515
+ interpolators.push(d3_interpolate(values[i-1], values[i]));
28401
29516
  }
28402
29517
  return function(t) {
28403
29518
  if (t == -1) return nullValue;
@@ -28415,7 +29530,6 @@ ${svg}
28415
29530
  // (colors and numbers should work)
28416
29531
  function interpolateValuesToClasses(values, n, stops) {
28417
29532
  if (values.length == n && !stops) return values;
28418
- var d3 = require('d3-interpolate');
28419
29533
  var numPairs = values.length - 1;
28420
29534
  var output = [values[0]];
28421
29535
  var k, j, t, intVal;
@@ -28424,7 +29538,7 @@ ${svg}
28424
29538
  j = Math.floor(k);
28425
29539
  t = k - j;
28426
29540
  // if (convert) t = convert(t);
28427
- intVal = d3.interpolate(values[j], values[j+1])(t);
29541
+ intVal = d3_interpolate(values[j], values[j+1])(t);
28428
29542
  output.push(intVal);
28429
29543
  }
28430
29544
  output.push(values[values.length - 1]);
@@ -29365,6 +30479,518 @@ ${svg}
29365
30479
  return maxId + 1;
29366
30480
  }
29367
30481
 
30482
+ function colors(specifier) {
30483
+ var n = specifier.length / 6 | 0, colors = new Array(n), i = 0;
30484
+ while (i < n) colors[i] = "#" + specifier.slice(i * 6, ++i * 6);
30485
+ return colors;
30486
+ }
30487
+
30488
+ var category10 = colors("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");
30489
+
30490
+ var Accent = colors("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");
30491
+
30492
+ var Dark2 = colors("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");
30493
+
30494
+ var Paired = colors("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");
30495
+
30496
+ var Pastel1 = colors("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");
30497
+
30498
+ var Pastel2 = colors("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");
30499
+
30500
+ var Set1 = colors("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");
30501
+
30502
+ var Set2 = colors("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");
30503
+
30504
+ var Set3 = colors("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");
30505
+
30506
+ var Tableau10 = colors("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");
30507
+
30508
+ var ramp$1 = scheme => rgbBasis(scheme[scheme.length - 1]);
30509
+
30510
+ var scheme$q = new Array(3).concat(
30511
+ "d8b365f5f5f55ab4ac",
30512
+ "a6611adfc27d80cdc1018571",
30513
+ "a6611adfc27df5f5f580cdc1018571",
30514
+ "8c510ad8b365f6e8c3c7eae55ab4ac01665e",
30515
+ "8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e",
30516
+ "8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e",
30517
+ "8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e",
30518
+ "5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30",
30519
+ "5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30"
30520
+ ).map(colors);
30521
+
30522
+ var BrBG = ramp$1(scheme$q);
30523
+
30524
+ var scheme$p = new Array(3).concat(
30525
+ "af8dc3f7f7f77fbf7b",
30526
+ "7b3294c2a5cfa6dba0008837",
30527
+ "7b3294c2a5cff7f7f7a6dba0008837",
30528
+ "762a83af8dc3e7d4e8d9f0d37fbf7b1b7837",
30529
+ "762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837",
30530
+ "762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837",
30531
+ "762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837",
30532
+ "40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b",
30533
+ "40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b"
30534
+ ).map(colors);
30535
+
30536
+ var PRGn = ramp$1(scheme$p);
30537
+
30538
+ var scheme$o = new Array(3).concat(
30539
+ "e9a3c9f7f7f7a1d76a",
30540
+ "d01c8bf1b6dab8e1864dac26",
30541
+ "d01c8bf1b6daf7f7f7b8e1864dac26",
30542
+ "c51b7de9a3c9fde0efe6f5d0a1d76a4d9221",
30543
+ "c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221",
30544
+ "c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221",
30545
+ "c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221",
30546
+ "8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419",
30547
+ "8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419"
30548
+ ).map(colors);
30549
+
30550
+ var PiYG = ramp$1(scheme$o);
30551
+
30552
+ var scheme$n = new Array(3).concat(
30553
+ "998ec3f7f7f7f1a340",
30554
+ "5e3c99b2abd2fdb863e66101",
30555
+ "5e3c99b2abd2f7f7f7fdb863e66101",
30556
+ "542788998ec3d8daebfee0b6f1a340b35806",
30557
+ "542788998ec3d8daebf7f7f7fee0b6f1a340b35806",
30558
+ "5427888073acb2abd2d8daebfee0b6fdb863e08214b35806",
30559
+ "5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806",
30560
+ "2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08",
30561
+ "2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08"
30562
+ ).map(colors);
30563
+
30564
+ var PuOr = ramp$1(scheme$n);
30565
+
30566
+ var scheme$m = new Array(3).concat(
30567
+ "ef8a62f7f7f767a9cf",
30568
+ "ca0020f4a58292c5de0571b0",
30569
+ "ca0020f4a582f7f7f792c5de0571b0",
30570
+ "b2182bef8a62fddbc7d1e5f067a9cf2166ac",
30571
+ "b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac",
30572
+ "b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac",
30573
+ "b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac",
30574
+ "67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061",
30575
+ "67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061"
30576
+ ).map(colors);
30577
+
30578
+ var RdBu = ramp$1(scheme$m);
30579
+
30580
+ var scheme$l = new Array(3).concat(
30581
+ "ef8a62ffffff999999",
30582
+ "ca0020f4a582bababa404040",
30583
+ "ca0020f4a582ffffffbababa404040",
30584
+ "b2182bef8a62fddbc7e0e0e09999994d4d4d",
30585
+ "b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d",
30586
+ "b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d",
30587
+ "b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d",
30588
+ "67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a",
30589
+ "67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a"
30590
+ ).map(colors);
30591
+
30592
+ var RdGy = ramp$1(scheme$l);
30593
+
30594
+ var scheme$k = new Array(3).concat(
30595
+ "fc8d59ffffbf91bfdb",
30596
+ "d7191cfdae61abd9e92c7bb6",
30597
+ "d7191cfdae61ffffbfabd9e92c7bb6",
30598
+ "d73027fc8d59fee090e0f3f891bfdb4575b4",
30599
+ "d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4",
30600
+ "d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4",
30601
+ "d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4",
30602
+ "a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695",
30603
+ "a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695"
30604
+ ).map(colors);
30605
+
30606
+ var RdYlBu = ramp$1(scheme$k);
30607
+
30608
+ var scheme$j = new Array(3).concat(
30609
+ "fc8d59ffffbf91cf60",
30610
+ "d7191cfdae61a6d96a1a9641",
30611
+ "d7191cfdae61ffffbfa6d96a1a9641",
30612
+ "d73027fc8d59fee08bd9ef8b91cf601a9850",
30613
+ "d73027fc8d59fee08bffffbfd9ef8b91cf601a9850",
30614
+ "d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850",
30615
+ "d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850",
30616
+ "a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837",
30617
+ "a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837"
30618
+ ).map(colors);
30619
+
30620
+ var RdYlGn = ramp$1(scheme$j);
30621
+
30622
+ var scheme$i = new Array(3).concat(
30623
+ "fc8d59ffffbf99d594",
30624
+ "d7191cfdae61abdda42b83ba",
30625
+ "d7191cfdae61ffffbfabdda42b83ba",
30626
+ "d53e4ffc8d59fee08be6f59899d5943288bd",
30627
+ "d53e4ffc8d59fee08bffffbfe6f59899d5943288bd",
30628
+ "d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd",
30629
+ "d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd",
30630
+ "9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2",
30631
+ "9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2"
30632
+ ).map(colors);
30633
+
30634
+ var Spectral = ramp$1(scheme$i);
30635
+
30636
+ var scheme$h = new Array(3).concat(
30637
+ "e5f5f999d8c92ca25f",
30638
+ "edf8fbb2e2e266c2a4238b45",
30639
+ "edf8fbb2e2e266c2a42ca25f006d2c",
30640
+ "edf8fbccece699d8c966c2a42ca25f006d2c",
30641
+ "edf8fbccece699d8c966c2a441ae76238b45005824",
30642
+ "f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824",
30643
+ "f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b"
30644
+ ).map(colors);
30645
+
30646
+ var BuGn = ramp$1(scheme$h);
30647
+
30648
+ var scheme$g = new Array(3).concat(
30649
+ "e0ecf49ebcda8856a7",
30650
+ "edf8fbb3cde38c96c688419d",
30651
+ "edf8fbb3cde38c96c68856a7810f7c",
30652
+ "edf8fbbfd3e69ebcda8c96c68856a7810f7c",
30653
+ "edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b",
30654
+ "f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b",
30655
+ "f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b"
30656
+ ).map(colors);
30657
+
30658
+ var BuPu = ramp$1(scheme$g);
30659
+
30660
+ var scheme$f = new Array(3).concat(
30661
+ "e0f3dba8ddb543a2ca",
30662
+ "f0f9e8bae4bc7bccc42b8cbe",
30663
+ "f0f9e8bae4bc7bccc443a2ca0868ac",
30664
+ "f0f9e8ccebc5a8ddb57bccc443a2ca0868ac",
30665
+ "f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e",
30666
+ "f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e",
30667
+ "f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081"
30668
+ ).map(colors);
30669
+
30670
+ var GnBu = ramp$1(scheme$f);
30671
+
30672
+ var scheme$e = new Array(3).concat(
30673
+ "fee8c8fdbb84e34a33",
30674
+ "fef0d9fdcc8afc8d59d7301f",
30675
+ "fef0d9fdcc8afc8d59e34a33b30000",
30676
+ "fef0d9fdd49efdbb84fc8d59e34a33b30000",
30677
+ "fef0d9fdd49efdbb84fc8d59ef6548d7301f990000",
30678
+ "fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000",
30679
+ "fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000"
30680
+ ).map(colors);
30681
+
30682
+ var OrRd = ramp$1(scheme$e);
30683
+
30684
+ var scheme$d = new Array(3).concat(
30685
+ "ece2f0a6bddb1c9099",
30686
+ "f6eff7bdc9e167a9cf02818a",
30687
+ "f6eff7bdc9e167a9cf1c9099016c59",
30688
+ "f6eff7d0d1e6a6bddb67a9cf1c9099016c59",
30689
+ "f6eff7d0d1e6a6bddb67a9cf3690c002818a016450",
30690
+ "fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450",
30691
+ "fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636"
30692
+ ).map(colors);
30693
+
30694
+ var PuBuGn = ramp$1(scheme$d);
30695
+
30696
+ var scheme$c = new Array(3).concat(
30697
+ "ece7f2a6bddb2b8cbe",
30698
+ "f1eef6bdc9e174a9cf0570b0",
30699
+ "f1eef6bdc9e174a9cf2b8cbe045a8d",
30700
+ "f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d",
30701
+ "f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b",
30702
+ "fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b",
30703
+ "fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858"
30704
+ ).map(colors);
30705
+
30706
+ var PuBu = ramp$1(scheme$c);
30707
+
30708
+ var scheme$b = new Array(3).concat(
30709
+ "e7e1efc994c7dd1c77",
30710
+ "f1eef6d7b5d8df65b0ce1256",
30711
+ "f1eef6d7b5d8df65b0dd1c77980043",
30712
+ "f1eef6d4b9dac994c7df65b0dd1c77980043",
30713
+ "f1eef6d4b9dac994c7df65b0e7298ace125691003f",
30714
+ "f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f",
30715
+ "f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f"
30716
+ ).map(colors);
30717
+
30718
+ var PuRd = ramp$1(scheme$b);
30719
+
30720
+ var scheme$a = new Array(3).concat(
30721
+ "fde0ddfa9fb5c51b8a",
30722
+ "feebe2fbb4b9f768a1ae017e",
30723
+ "feebe2fbb4b9f768a1c51b8a7a0177",
30724
+ "feebe2fcc5c0fa9fb5f768a1c51b8a7a0177",
30725
+ "feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177",
30726
+ "fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177",
30727
+ "fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a"
30728
+ ).map(colors);
30729
+
30730
+ var RdPu = ramp$1(scheme$a);
30731
+
30732
+ var scheme$9 = new Array(3).concat(
30733
+ "edf8b17fcdbb2c7fb8",
30734
+ "ffffcca1dab441b6c4225ea8",
30735
+ "ffffcca1dab441b6c42c7fb8253494",
30736
+ "ffffccc7e9b47fcdbb41b6c42c7fb8253494",
30737
+ "ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84",
30738
+ "ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84",
30739
+ "ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58"
30740
+ ).map(colors);
30741
+
30742
+ var YlGnBu = ramp$1(scheme$9);
30743
+
30744
+ var scheme$8 = new Array(3).concat(
30745
+ "f7fcb9addd8e31a354",
30746
+ "ffffccc2e69978c679238443",
30747
+ "ffffccc2e69978c67931a354006837",
30748
+ "ffffccd9f0a3addd8e78c67931a354006837",
30749
+ "ffffccd9f0a3addd8e78c67941ab5d238443005a32",
30750
+ "ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32",
30751
+ "ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529"
30752
+ ).map(colors);
30753
+
30754
+ var YlGn = ramp$1(scheme$8);
30755
+
30756
+ var scheme$7 = new Array(3).concat(
30757
+ "fff7bcfec44fd95f0e",
30758
+ "ffffd4fed98efe9929cc4c02",
30759
+ "ffffd4fed98efe9929d95f0e993404",
30760
+ "ffffd4fee391fec44ffe9929d95f0e993404",
30761
+ "ffffd4fee391fec44ffe9929ec7014cc4c028c2d04",
30762
+ "ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04",
30763
+ "ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506"
30764
+ ).map(colors);
30765
+
30766
+ var YlOrBr = ramp$1(scheme$7);
30767
+
30768
+ var scheme$6 = new Array(3).concat(
30769
+ "ffeda0feb24cf03b20",
30770
+ "ffffb2fecc5cfd8d3ce31a1c",
30771
+ "ffffb2fecc5cfd8d3cf03b20bd0026",
30772
+ "ffffb2fed976feb24cfd8d3cf03b20bd0026",
30773
+ "ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026",
30774
+ "ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026",
30775
+ "ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026"
30776
+ ).map(colors);
30777
+
30778
+ var YlOrRd = ramp$1(scheme$6);
30779
+
30780
+ var scheme$5 = new Array(3).concat(
30781
+ "deebf79ecae13182bd",
30782
+ "eff3ffbdd7e76baed62171b5",
30783
+ "eff3ffbdd7e76baed63182bd08519c",
30784
+ "eff3ffc6dbef9ecae16baed63182bd08519c",
30785
+ "eff3ffc6dbef9ecae16baed64292c62171b5084594",
30786
+ "f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594",
30787
+ "f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b"
30788
+ ).map(colors);
30789
+
30790
+ var Blues = ramp$1(scheme$5);
30791
+
30792
+ var scheme$4 = new Array(3).concat(
30793
+ "e5f5e0a1d99b31a354",
30794
+ "edf8e9bae4b374c476238b45",
30795
+ "edf8e9bae4b374c47631a354006d2c",
30796
+ "edf8e9c7e9c0a1d99b74c47631a354006d2c",
30797
+ "edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32",
30798
+ "f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32",
30799
+ "f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b"
30800
+ ).map(colors);
30801
+
30802
+ var Greens = ramp$1(scheme$4);
30803
+
30804
+ var scheme$3 = new Array(3).concat(
30805
+ "f0f0f0bdbdbd636363",
30806
+ "f7f7f7cccccc969696525252",
30807
+ "f7f7f7cccccc969696636363252525",
30808
+ "f7f7f7d9d9d9bdbdbd969696636363252525",
30809
+ "f7f7f7d9d9d9bdbdbd969696737373525252252525",
30810
+ "fffffff0f0f0d9d9d9bdbdbd969696737373525252252525",
30811
+ "fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000"
30812
+ ).map(colors);
30813
+
30814
+ var Greys = ramp$1(scheme$3);
30815
+
30816
+ var scheme$2 = new Array(3).concat(
30817
+ "efedf5bcbddc756bb1",
30818
+ "f2f0f7cbc9e29e9ac86a51a3",
30819
+ "f2f0f7cbc9e29e9ac8756bb154278f",
30820
+ "f2f0f7dadaebbcbddc9e9ac8756bb154278f",
30821
+ "f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486",
30822
+ "fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486",
30823
+ "fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d"
30824
+ ).map(colors);
30825
+
30826
+ var Purples = ramp$1(scheme$2);
30827
+
30828
+ var scheme$1 = new Array(3).concat(
30829
+ "fee0d2fc9272de2d26",
30830
+ "fee5d9fcae91fb6a4acb181d",
30831
+ "fee5d9fcae91fb6a4ade2d26a50f15",
30832
+ "fee5d9fcbba1fc9272fb6a4ade2d26a50f15",
30833
+ "fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d",
30834
+ "fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d",
30835
+ "fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d"
30836
+ ).map(colors);
30837
+
30838
+ var Reds = ramp$1(scheme$1);
30839
+
30840
+ var scheme = new Array(3).concat(
30841
+ "fee6cefdae6be6550d",
30842
+ "feeddefdbe85fd8d3cd94701",
30843
+ "feeddefdbe85fd8d3ce6550da63603",
30844
+ "feeddefdd0a2fdae6bfd8d3ce6550da63603",
30845
+ "feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04",
30846
+ "fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04",
30847
+ "fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704"
30848
+ ).map(colors);
30849
+
30850
+ var Oranges = ramp$1(scheme);
30851
+
30852
+ function cividis(t) {
30853
+ t = Math.max(0, Math.min(1, t));
30854
+ return "rgb("
30855
+ + Math.max(0, Math.min(255, Math.round(-4.54 - t * (35.34 - t * (2381.73 - t * (6402.7 - t * (7024.72 - t * 2710.57))))))) + ", "
30856
+ + Math.max(0, Math.min(255, Math.round(32.49 + t * (170.73 + t * (52.82 - t * (131.46 - t * (176.58 - t * 67.37))))))) + ", "
30857
+ + Math.max(0, Math.min(255, Math.round(81.24 + t * (442.36 - t * (2482.43 - t * (6167.24 - t * (6614.94 - t * 2475.67)))))))
30858
+ + ")";
30859
+ }
30860
+
30861
+ var cubehelix = cubehelixLong(cubehelix$3(300, 0.5, 0.0), cubehelix$3(-240, 0.5, 1.0));
30862
+
30863
+ var warm = cubehelixLong(cubehelix$3(-100, 0.75, 0.35), cubehelix$3(80, 1.50, 0.8));
30864
+
30865
+ var cool = cubehelixLong(cubehelix$3(260, 0.75, 0.35), cubehelix$3(80, 1.50, 0.8));
30866
+
30867
+ var c$1 = cubehelix$3();
30868
+
30869
+ function rainbow(t) {
30870
+ if (t < 0 || t > 1) t -= Math.floor(t);
30871
+ var ts = Math.abs(t - 0.5);
30872
+ c$1.h = 360 * t - 100;
30873
+ c$1.s = 1.5 - 1.5 * ts;
30874
+ c$1.l = 0.8 - 0.9 * ts;
30875
+ return c$1 + "";
30876
+ }
30877
+
30878
+ var c = rgb$1(),
30879
+ pi_1_3 = Math.PI / 3,
30880
+ pi_2_3 = Math.PI * 2 / 3;
30881
+
30882
+ function sinebow(t) {
30883
+ var x;
30884
+ t = (0.5 - t) * Math.PI;
30885
+ c.r = 255 * (x = Math.sin(t)) * x;
30886
+ c.g = 255 * (x = Math.sin(t + pi_1_3)) * x;
30887
+ c.b = 255 * (x = Math.sin(t + pi_2_3)) * x;
30888
+ return c + "";
30889
+ }
30890
+
30891
+ function turbo(t) {
30892
+ t = Math.max(0, Math.min(1, t));
30893
+ return "rgb("
30894
+ + Math.max(0, Math.min(255, Math.round(34.61 + t * (1172.33 - t * (10793.56 - t * (33300.12 - t * (38394.49 - t * 14825.05))))))) + ", "
30895
+ + Math.max(0, Math.min(255, Math.round(23.31 + t * (557.33 + t * (1225.33 - t * (3574.96 - t * (1073.77 + t * 707.56))))))) + ", "
30896
+ + Math.max(0, Math.min(255, Math.round(27.2 + t * (3211.1 - t * (15327.97 - t * (27814 - t * (22569.18 - t * 6838.66)))))))
30897
+ + ")";
30898
+ }
30899
+
30900
+ function ramp(range) {
30901
+ var n = range.length;
30902
+ return function(t) {
30903
+ return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
30904
+ };
30905
+ }
30906
+
30907
+ var viridis = ramp(colors("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));
30908
+
30909
+ var magma = ramp(colors("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf"));
30910
+
30911
+ var inferno = ramp(colors("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4"));
30912
+
30913
+ var plasma = ramp(colors("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));
30914
+
30915
+ var lib = /*#__PURE__*/Object.freeze({
30916
+ __proto__: null,
30917
+ schemeCategory10: category10,
30918
+ schemeAccent: Accent,
30919
+ schemeDark2: Dark2,
30920
+ schemePaired: Paired,
30921
+ schemePastel1: Pastel1,
30922
+ schemePastel2: Pastel2,
30923
+ schemeSet1: Set1,
30924
+ schemeSet2: Set2,
30925
+ schemeSet3: Set3,
30926
+ schemeTableau10: Tableau10,
30927
+ interpolateBrBG: BrBG,
30928
+ schemeBrBG: scheme$q,
30929
+ interpolatePRGn: PRGn,
30930
+ schemePRGn: scheme$p,
30931
+ interpolatePiYG: PiYG,
30932
+ schemePiYG: scheme$o,
30933
+ interpolatePuOr: PuOr,
30934
+ schemePuOr: scheme$n,
30935
+ interpolateRdBu: RdBu,
30936
+ schemeRdBu: scheme$m,
30937
+ interpolateRdGy: RdGy,
30938
+ schemeRdGy: scheme$l,
30939
+ interpolateRdYlBu: RdYlBu,
30940
+ schemeRdYlBu: scheme$k,
30941
+ interpolateRdYlGn: RdYlGn,
30942
+ schemeRdYlGn: scheme$j,
30943
+ interpolateSpectral: Spectral,
30944
+ schemeSpectral: scheme$i,
30945
+ interpolateBuGn: BuGn,
30946
+ schemeBuGn: scheme$h,
30947
+ interpolateBuPu: BuPu,
30948
+ schemeBuPu: scheme$g,
30949
+ interpolateGnBu: GnBu,
30950
+ schemeGnBu: scheme$f,
30951
+ interpolateOrRd: OrRd,
30952
+ schemeOrRd: scheme$e,
30953
+ interpolatePuBuGn: PuBuGn,
30954
+ schemePuBuGn: scheme$d,
30955
+ interpolatePuBu: PuBu,
30956
+ schemePuBu: scheme$c,
30957
+ interpolatePuRd: PuRd,
30958
+ schemePuRd: scheme$b,
30959
+ interpolateRdPu: RdPu,
30960
+ schemeRdPu: scheme$a,
30961
+ interpolateYlGnBu: YlGnBu,
30962
+ schemeYlGnBu: scheme$9,
30963
+ interpolateYlGn: YlGn,
30964
+ schemeYlGn: scheme$8,
30965
+ interpolateYlOrBr: YlOrBr,
30966
+ schemeYlOrBr: scheme$7,
30967
+ interpolateYlOrRd: YlOrRd,
30968
+ schemeYlOrRd: scheme$6,
30969
+ interpolateBlues: Blues,
30970
+ schemeBlues: scheme$5,
30971
+ interpolateGreens: Greens,
30972
+ schemeGreens: scheme$4,
30973
+ interpolateGreys: Greys,
30974
+ schemeGreys: scheme$3,
30975
+ interpolatePurples: Purples,
30976
+ schemePurples: scheme$2,
30977
+ interpolateReds: Reds,
30978
+ schemeReds: scheme$1,
30979
+ interpolateOranges: Oranges,
30980
+ schemeOranges: scheme,
30981
+ interpolateCividis: cividis,
30982
+ interpolateCubehelixDefault: cubehelix,
30983
+ interpolateRainbow: rainbow,
30984
+ interpolateWarm: warm,
30985
+ interpolateCool: cool,
30986
+ interpolateSinebow: sinebow,
30987
+ interpolateTurbo: turbo,
30988
+ interpolateViridis: viridis,
30989
+ interpolateMagma: magma,
30990
+ interpolateInferno: inferno,
30991
+ interpolatePlasma: plasma
30992
+ });
30993
+
29368
30994
  var index = {
29369
30995
  categorical: [],
29370
30996
  sequential: [],
@@ -29514,7 +31140,7 @@ ${svg}
29514
31140
  function getColorRamp(name, n, stops) {
29515
31141
  initSchemes();
29516
31142
  name = standardName(name);
29517
- var lib = require('d3-scale-chromatic');
31143
+ // var lib = require('d3-scale-chromatic');
29518
31144
  var ramps = lib['scheme' + name];
29519
31145
  var interpolate = lib['interpolate' + name];
29520
31146
  var ramp;
@@ -29823,9 +31449,8 @@ ${svg}
29823
31449
  }
29824
31450
 
29825
31451
  function formatColorsAsHex(colors) {
29826
- var d3 = require('d3-color');
29827
31452
  return colors.map(function(col) {
29828
- var o = d3.color(col);
31453
+ var o = color(col);
29829
31454
  if (!o) stop('Unable to parse color:', col);
29830
31455
  return o.formatHex();
29831
31456
  });
@@ -30487,6 +32112,9 @@ ${svg}
30487
32112
  targetDataset.arcs = mergedDataset.arcs;
30488
32113
  // dissolve clip layer shapes (to remove overlaps and other topological issues
30489
32114
  // that might confuse the clipping function)
32115
+ // use a data-free copy of the clip lyr, so data records are not dissolved
32116
+ // (this avoids triggering an unnecessary and expensive DBF read operation in some cases).
32117
+ clipLyr = utils.defaults({data: null}, clipLyr);
30490
32118
  clipLyr = dissolvePolygonLayer2(clipLyr, mergedDataset, {quiet: true, silent: true});
30491
32119
 
30492
32120
  } else {
@@ -30888,6 +32516,8 @@ ${svg}
30888
32516
  getColorizerFunction: getColorizerFunction
30889
32517
  });
30890
32518
 
32519
+ cmd.comment = function() {}; // no-op, so -comment doesn't trigger a parsing error
32520
+
30891
32521
  function expressionUsesGeoJSON(exp) {
30892
32522
  return exp.includes('this.geojson');
30893
32523
  }
@@ -32634,10 +34264,10 @@ ${svg}
32634
34264
  moduleName = opts.module;
32635
34265
  }
32636
34266
  if (moduleFile) {
32637
- moduleFile = require('path').join(process.cwd(), moduleFile);
34267
+ moduleFile = require$1('path').join(process.cwd(), moduleFile);
32638
34268
  }
32639
34269
  try {
32640
- _module = require(moduleFile || moduleName);
34270
+ _module = require$1(moduleFile || moduleName);
32641
34271
  _module(coreAPI);
32642
34272
  } catch(e) {
32643
34273
  // stop(e);
@@ -33231,6 +34861,7 @@ ${svg}
33231
34861
  // }).join(",") + "}");
33232
34862
  // };
33233
34863
 
34864
+ // Removes points that are far from other points
33234
34865
  cmd.filterPoints = function(lyr, dataset, opts) {
33235
34866
  requireSinglePointLayer(lyr);
33236
34867
  if (opts.group_interval > 0 === false) {
@@ -33245,7 +34876,7 @@ ${svg}
33245
34876
  var index = new Uint8Array(points.length);
33246
34877
  var a, b, c, ai, bi, ci;
33247
34878
  for (var i=0, n=triangles.length; i<n; i+=3) {
33248
- // a, b, c: triangle verticies in CCW order
34879
+ // a, b, c: triangle vertices in CCW order
33249
34880
  ai = triangles[i];
33250
34881
  bi = triangles[i+1];
33251
34882
  ci = triangles[i+2];
@@ -34417,7 +36048,7 @@ ${svg}
34417
36048
  var arcId = o.arcId,
34418
36049
  key = classify(arcId),
34419
36050
  isContinuation, line;
34420
- if (!!key) {
36051
+ if (key) {
34421
36052
  line = key in index ? index[key] : null;
34422
36053
  isContinuation = key == prevKey && o.shapeId == prev.shapeId && o.partId == prev.partId;
34423
36054
  if (!line) {
@@ -34684,7 +36315,7 @@ ${svg}
34684
36315
  // TODO: add more projections
34685
36316
  //
34686
36317
  function expandProjDefn(str, dataset) {
34687
- var mproj = require('mproj');
36318
+ var mproj = require$1('mproj');
34688
36319
  var proj4, params, bbox, isConic2SP, isCentered, decimals;
34689
36320
  if (str in mproj.internal.pj_list === false) {
34690
36321
  // not a bare projection code -- assume valid projection string in other format
@@ -34726,6 +36357,13 @@ ${svg}
34726
36357
  return `+lon_0=${ cx.toFixed(decimals) } +lat_0=${ cy.toFixed(decimals) }`;
34727
36358
  }
34728
36359
 
36360
+ var ProjectionParams = /*#__PURE__*/Object.freeze({
36361
+ __proto__: null,
36362
+ expandProjDefn: expandProjDefn,
36363
+ getConicParams: getConicParams,
36364
+ getCenterParams: getCenterParams
36365
+ });
36366
+
34729
36367
  cmd.proj = function(dataset, catalog, opts) {
34730
36368
  var srcInfo, destInfo, destStr;
34731
36369
  if (opts.init) {
@@ -35090,6 +36728,14 @@ ${svg}
35090
36728
  job.control = null;
35091
36729
  }
35092
36730
 
36731
+ function stopJob(job) {
36732
+ getState(job).stopped = true;
36733
+ }
36734
+
36735
+ function jobIsStopped(job) {
36736
+ return getState(job).stopped === true;
36737
+ }
36738
+
35093
36739
  function inControlBlock(job) {
35094
36740
  return !!getState(job).inControlBlock;
35095
36741
  }
@@ -35158,6 +36804,7 @@ ${svg}
35158
36804
 
35159
36805
  function skipCommand(cmdName, job) {
35160
36806
  // allow all control commands to run
36807
+ if (jobIsStopped(job)) return true;
35161
36808
  if (isControlFlowCommand(cmdName)) return false;
35162
36809
  return inControlBlock(job) && !inActiveBranch(job);
35163
36810
  }
@@ -36560,7 +38207,7 @@ ${svg}
36560
38207
  requireSinglePointLayer(srcLyr);
36561
38208
  var points = getPointsInLayer(srcLyr);
36562
38209
  var maxDist = opts.max_distance ? convertDistanceParam(opts.max_distance, crs) : 1e-3;
36563
- var kdbush = require('kdbush');
38210
+ var kdbush = require$1('kdbush');
36564
38211
  var index = new kdbush(points);
36565
38212
  var lookup = getLookupFunction(index, crs, maxDist);
36566
38213
  var uniqIndex = new IdTestIndex(points.length);
@@ -37086,7 +38733,7 @@ ${svg}
37086
38733
  stop('Expected a non-negative interval parameter');
37087
38734
  }
37088
38735
  if (opts.radius > 0 === false) {
37089
- stop('Expected a non-negative radius parameter');
38736
+ // stop('Expected a non-negative radius parameter');
37090
38737
  }
37091
38738
  // var bbox = getLayerBounds(pointLyr).toArray();
37092
38739
  // Use target dataset, so grids are aligned between layers
@@ -37114,27 +38761,24 @@ ${svg}
37114
38761
  };
37115
38762
 
37116
38763
  function getPolygonDataset(pointLyr, gridBBox, opts) {
37117
- var interval = opts.interval;
37118
38764
  var points = getPointsInLayer(pointLyr);
37119
- var grid = getGridData(gridBBox, interval);
37120
- var lookup = getPointIndex(points, grid, opts.radius);
37121
- var n = grid.cells();
38765
+ var cellSize = opts.interval;
38766
+ var grid = getGridData(gridBBox, cellSize, opts);
38767
+ var pointCircleRadius = getPointCircleRadius(opts);
38768
+ var findPointIdsByCellId = getPointIndex(points, grid, pointCircleRadius);
37122
38769
  var geojson = {
37123
38770
  type: 'FeatureCollection',
37124
38771
  features: []
37125
38772
  };
37126
- var calc = null;
37127
- var cands, center, weight, d;
37128
- if (opts.calc) {
37129
- calc = getJoinCalc(pointLyr.data, opts.calc);
37130
- }
38773
+ var calc = opts.calc ? getJoinCalc(pointLyr.data, opts.calc) : null;
38774
+ var candidateIds, weights, center, weight, d;
37131
38775
 
37132
- for (var i=0; i<n; i++) {
37133
- cands = lookup(i);
37134
- if (!cands.length) continue;
38776
+ for (var i=0, n=grid.cells(); i<n; i++) {
38777
+ candidateIds = findPointIdsByCellId(i);
38778
+ if (!candidateIds.length) continue;
37135
38779
  center = grid.idxToPoint(i);
37136
- d = calcCellProperties(center, cands, points, calc, opts);
37137
- // weight = calcCellWeight(center, cands, points, opts);
38780
+ weights = calcWeights(center, cellSize, points, candidateIds, pointCircleRadius);
38781
+ d = calcCellProperties(candidateIds, weights, calc);
37138
38782
  if (d.weight > 0.05 === false) continue;
37139
38783
  d.id = i;
37140
38784
  geojson.features.push({
@@ -37143,44 +38787,43 @@ ${svg}
37143
38787
  geometry: makeCellPolygon(i, grid, opts)
37144
38788
  });
37145
38789
  }
37146
- var dataset = importGeoJSON(geojson, {});
37147
- return dataset;
38790
+ return importGeoJSON(geojson, {});
37148
38791
  }
37149
38792
 
37150
- function calcCellProperties(center, cands, points, calc, opts) {
37151
- // radius of circle with same area as the cell
37152
- var interval = opts.interval;
37153
- var radius = interval * Math.sqrt(1 / Math.PI);
37154
- var circleArea = Math.PI * opts.radius * opts.radius;
37155
- var cellArea = interval * interval;
37156
- var ids = [];
37157
- var totArea = 0;
37158
- var intersection;
37159
- for (var i=0; i<cands.length; i++) {
37160
- intersection = twoCircleIntersection(center, radius, points[cands[i]], opts.radius);
37161
- if (intersection > 0 === false) continue;
37162
- totArea += intersection;
37163
- ids.push(cands[i]);
37164
- }
37165
- var d = {weight: totArea / cellArea};
38793
+ function getPointCircleRadius(opts) {
38794
+ var cellRadius = opts.interval * Math.sqrt(1 / Math.PI);
38795
+ return opts.radius > 0 ? opts.radius : cellRadius;
38796
+ }
38797
+
38798
+ function calcCellProperties(pointIds, weights, calc) {
38799
+ var hitIds = [];
38800
+ var weight = 0;
38801
+ var partial;
38802
+ var d;
38803
+ for (var i=0; i<pointIds.length; i++) {
38804
+ partial = weights[i];
38805
+ if (partial > 0 === false) continue;
38806
+ weight += partial;
38807
+ hitIds.push(pointIds[i]);
38808
+ }
38809
+ d = {weight: weight};
37166
38810
  if (calc) {
37167
- calc(ids, d);
38811
+ calc(hitIds, d);
37168
38812
  }
37169
38813
  return d;
37170
38814
  }
37171
38815
 
37172
- // function calcCellWeight(center, ids, points, opts) {
37173
- // // radius of circle with same area as the cell
37174
- // var interval = opts.interval;
37175
- // var radius = interval * Math.sqrt(1 / Math.PI);
37176
- // var circleArea = Math.PI * opts.radius * opts.radius;
37177
- // var cellArea = interval * interval;
37178
- // var totArea = 0;
37179
- // for (var i=0; i<ids.length; i++) {
37180
- // totArea += twoCircleIntersection(center, radius, points[ids[i]], opts.radius);
37181
- // }
37182
- // return totArea / cellArea;
37183
- // }
38816
+ function calcWeights(cellCenter, cellSize, points, pointIds, pointRadius) {
38817
+ var weights = [];
38818
+ var cellRadius = cellSize * Math.sqrt(1 / Math.PI); // radius of circle with same area as cell
38819
+ var cellArea = cellSize * cellSize;
38820
+ var w;
38821
+ for (var i=0; i<pointIds.length; i++) {
38822
+ w = twoCircleIntersection(cellCenter, cellRadius, points[pointIds[i]], pointRadius) / cellArea;
38823
+ weights.push(w);
38824
+ }
38825
+ return weights;
38826
+ }
37184
38827
 
37185
38828
  // Source: https://diego.assencio.com/?index=8d6ca3d82151bad815f78addf9b5c1c6
37186
38829
  function twoCircleIntersection(c1, r1, c2, r2) {
@@ -37223,7 +38866,7 @@ ${svg}
37223
38866
  }
37224
38867
 
37225
38868
  function getPointIndex(points, grid, radius) {
37226
- var Flatbush = require('flatbush');
38869
+ var Flatbush = require$1('flatbush');
37227
38870
  var gridIndex = new IdTestIndex(grid.cells());
37228
38871
  var bboxIndex = new Flatbush(points.length);
37229
38872
  var empty = [];
@@ -37235,10 +38878,19 @@ ${svg}
37235
38878
  return function(i) {
37236
38879
  if (!gridIndex.hasId(i)) return empty;
37237
38880
  var bbox = grid.idxToBBox(i);
37238
- return bboxIndex.search.apply(bboxIndex, bbox);
38881
+ var indices = bboxIndex.search.apply(bboxIndex, bbox);
38882
+ return indices;
37239
38883
  };
37240
38884
  }
37241
38885
 
38886
+ function getPointsByIndex(points, indices) {
38887
+ var arr = [];
38888
+ for (var i=0; i<indices.length; i++) {
38889
+ arr.push(points[indices[i]]);
38890
+ }
38891
+ return arr;
38892
+ }
38893
+
37242
38894
  function addPointToGridIndex(p, index, grid) {
37243
38895
  var i = grid.pointToIdx(p);
37244
38896
  var c = grid.idxToCol(i);
@@ -37264,23 +38916,52 @@ ${svg}
37264
38916
  return [p[0] - radius, p[1] - radius, p[0] + radius, p[1] + radius];
37265
38917
  }
37266
38918
 
37267
- function getGridInterpolator(bbox, interval) {
37268
- var sparseArr = [];
37269
- var grid = getGridData(bbox, interval);
37270
-
37271
- }
37272
-
37273
- // TODO: put this in a separate file, use it for other grid-based commands
37274
- // like -dots
37275
- function getGridData(bbox, interval) {
37276
- var xmin = bbox[0] - interval;
37277
- var ymin = bbox[1] - interval;
37278
- var xmax = bbox[2] + interval;
37279
- var ymax = bbox[3] + interval;
37280
- var w = xmax - xmin;
37281
- var h = ymax - ymin;
37282
- var cols = Math.ceil(w / interval);
37283
- var rows = Math.ceil(h / interval);
38919
+ // grid boundaries includes the origin
38920
+ // (this way, grids calculated from different sets of points will all align)
38921
+ function getAlignedRange(minCoord, maxCoord, interval) {
38922
+ var idx = Math.floor(minCoord / interval) - 1;
38923
+ var idx2 = Math.ceil(maxCoord / interval) + 1;
38924
+ return [idx * interval, idx2 * interval];
38925
+ }
38926
+
38927
+ function getCenteredRange(minCoord, maxCoord, interval) {
38928
+ var w = maxCoord - minCoord;
38929
+ var w2 = Math.ceil(w / interval) * interval;
38930
+ var pad = (w2 - w) / 2 + interval;
38931
+ return [minCoord - pad, maxCoord + pad];
38932
+ }
38933
+
38934
+ function getAlignedGridBounds(bbox, interval) {
38935
+ var xx = getAlignedRange(bbox[0], bbox[2], interval);
38936
+ var yy = getAlignedRange(bbox[1], bbox[3], interval);
38937
+ return [xx[0], yy[0], xx[1], yy[1]];
38938
+ }
38939
+
38940
+ function getCenteredGridBounds(bbox, interval) {
38941
+ var xx = getCenteredRange(bbox[0], bbox[2], interval);
38942
+ var yy = getCenteredRange(bbox[1], bbox[3], interval);
38943
+ return [xx[0], yy[0], xx[1], yy[1]];
38944
+ }
38945
+
38946
+ // TODO: Use this function for other grid-based commands
38947
+ function getGridData(bbox, interval, opts) {
38948
+ var extent = opts && opts.aligned ?
38949
+ getAlignedGridBounds(bbox, interval) :
38950
+ getCenteredGridBounds(bbox, interval);
38951
+ var xmin = extent[0];
38952
+ var ymin = extent[1];
38953
+ var w = extent[2] - xmin;
38954
+ var h = extent[3] - ymin;
38955
+ var cols = Math.round(w / interval);
38956
+ var rows = Math.round(h / interval);
38957
+ // var xmin = bbox[0] - interval;
38958
+ // var ymin = bbox[1] - interval;
38959
+ // var xmax = bbox[2] + interval;
38960
+ // var ymax = bbox[3] + interval;
38961
+ // var w = xmax - xmin;
38962
+ // var h = ymax - ymin;
38963
+ // var cols = Math.ceil(w / interval);
38964
+ // var rows = Math.ceil(h / interval);
37284
38965
  function size() {
37285
38966
  return [cols, rows];
37286
38967
  }
@@ -37644,10 +39325,10 @@ ${svg}
37644
39325
  moduleName = opts.module;
37645
39326
  }
37646
39327
  if (moduleFile) {
37647
- moduleFile = require('path').join(process.cwd(), moduleFile);
39328
+ moduleFile = require$1('path').join(process.cwd(), moduleFile);
37648
39329
  }
37649
39330
  try {
37650
- mod = require(moduleFile || moduleName);
39331
+ mod = require$1(moduleFile || moduleName);
37651
39332
  } catch(e) {
37652
39333
  stop(e);
37653
39334
  }
@@ -38818,6 +40499,10 @@ ${svg}
38818
40499
  getSplitNameFunction: getSplitNameFunction
38819
40500
  });
38820
40501
 
40502
+ cmd.stop = function(job) {
40503
+ stopJob(job);
40504
+ };
40505
+
38821
40506
  cmd.svgStyle = function(lyr, dataset, opts) {
38822
40507
  var filter;
38823
40508
  if (!lyr.data) {
@@ -38963,10 +40648,10 @@ ${svg}
38963
40648
  dy = stemLen * Math.cos(theta / 2);
38964
40649
 
38965
40650
  if (stickArrow) {
38966
- stem = getCurvedStemCoords(-ax, -ay, dx, dy, theta);
40651
+ stem = getCurvedStemCoords(-ax, -ay, dx, dy);
38967
40652
  } else {
38968
- var leftStem = getCurvedStemCoords(-ax, -ay, -stemDx + dx, dy, theta);
38969
- var rightStem = getCurvedStemCoords(ax, ay, stemDx + dx, dy, theta);
40653
+ var leftStem = getCurvedStemCoords(-ax, -ay, -stemDx + dx, dy);
40654
+ var rightStem = getCurvedStemCoords(ax, ay, stemDx + dx, dy);
38970
40655
  stem = leftStem.concat(rightStem.reverse());
38971
40656
  }
38972
40657
 
@@ -39010,10 +40695,10 @@ ${svg}
39010
40695
  return coords;
39011
40696
  }
39012
40697
 
39013
- function calcStraightArrowCoords(stemLen, headLen, stemDx, headDx, baseDx) {
39014
- return [[baseDx, 0], [stemDx, stemLen], [headDx, stemLen], [0, stemLen + headLen],
39015
- [-headDx, stemLen], [-stemDx, stemLen], [-baseDx, 0], [baseDx, 0]];
39016
- }
40698
+ // function calcStraightArrowCoords(stemLen, headLen, stemDx, headDx, baseDx) {
40699
+ // return [[baseDx, 0], [stemDx, stemLen], [headDx, stemLen], [0, stemLen + headLen],
40700
+ // [-headDx, stemLen], [-stemDx, stemLen], [-baseDx, 0], [baseDx, 0]];
40701
+ // }
39017
40702
 
39018
40703
  function calcArrowSize(d, stickArrow) {
39019
40704
  // don't display arrows with negative length
@@ -39080,7 +40765,7 @@ ${svg}
39080
40765
 
39081
40766
  // ax, ay: point on the base
39082
40767
  // bx, by: point on the stem
39083
- function getCurvedStemCoords(ax, ay, bx, by, theta0) {
40768
+ function getCurvedStemCoords(ax, ay, bx, by) {
39084
40769
  // case: curved side intrudes into head (because stem is too short)
39085
40770
  if (ay > by) {
39086
40771
  return [[ax * by / ay, by]];
@@ -39802,8 +41487,8 @@ ${svg}
39802
41487
  function commandAcceptsEmptyTarget(name) {
39803
41488
  return name == 'graticule' || name == 'i' || name == 'help' ||
39804
41489
  name == 'point-grid' || name == 'shape' || name == 'rectangle' ||
39805
- name == 'include' || name == 'print' || name == 'if' || name == 'elif' ||
39806
- name == 'else' || name == 'endif';
41490
+ name == 'include' || name == 'print' || name == 'comment' || name == 'if' || name == 'elif' ||
41491
+ name == 'else' || name == 'endif' || name == 'stop';
39807
41492
  }
39808
41493
 
39809
41494
  function runCommand(command, job, cb) {
@@ -39910,6 +41595,9 @@ ${svg}
39910
41595
  } else if (name == 'colorizer') {
39911
41596
  outputLayers = cmd.colorizer(opts);
39912
41597
 
41598
+ } else if (name == 'comment') {
41599
+ // no-op
41600
+
39913
41601
  } else if (name == 'dashlines') {
39914
41602
  applyCommandToEachLayer(cmd.dashlines, targetLayers, targetDataset, opts);
39915
41603
 
@@ -40130,6 +41818,9 @@ ${svg}
40130
41818
  } else if (name == 'split') {
40131
41819
  outputLayers = applyCommandToEachLayer(cmd.splitLayer, targetLayers, opts.expression, opts);
40132
41820
 
41821
+ } else if (name == 'stop') {
41822
+ cmd.stop(job);
41823
+
40133
41824
  } else if (name == 'split-on-grid') {
40134
41825
  outputLayers = applyCommandToEachLayer(cmd.splitLayerOnGrid, targetLayers, arcs, opts);
40135
41826
 
@@ -40288,7 +41979,7 @@ ${svg}
40288
41979
  //
40289
41980
  function runCommandsXL(argv) {
40290
41981
  var opts = importRunArgs.apply(null, arguments);
40291
- var mapshaperScript = require('path').join(__dirname, 'bin/mapshaper');
41982
+ var mapshaperScript = require$1('path').join(__dirname, 'bin/mapshaper');
40292
41983
  var gb = parseFloat(opts.options.xl) || 8;
40293
41984
  var err;
40294
41985
  if (gb < 1 || gb > 64) {
@@ -40300,7 +41991,7 @@ ${svg}
40300
41991
  if (!loggingEnabled()) argv += ' -quiet'; // kludge to pass logging setting to subprocess
40301
41992
  var mb = Math.round(gb * 1000);
40302
41993
  var command = [process.execPath, '--max-old-space-size=' + mb, mapshaperScript, argv].join(' ');
40303
- var child = require('child_process').exec(command, {}, function(err, stdout, stderr) {
41994
+ var child = require$1('child_process').exec(command, {}, function(err, stdout, stderr) {
40304
41995
  opts.callback(err);
40305
41996
  });
40306
41997
  child.stdout.pipe(process.stdout);
@@ -40895,7 +42586,6 @@ ${svg}
40895
42586
  // so they can be run by tests and by the GUI.
40896
42587
  // TODO: rewrite tests to import functions directly from modules,
40897
42588
  // export only functions called by the GUI.
40898
-
40899
42589
  var internal = {};
40900
42590
 
40901
42591
  internal.svg = Object.assign({}, SvgStringify, SvgPathUtils, GeojsonToSvg, SvgLabels, SvgSymbols);
@@ -41011,6 +42701,7 @@ ${svg}
41011
42701
  PostSimplifyRepair,
41012
42702
  Proj,
41013
42703
  Projections,
42704
+ ProjectionParams,
41014
42705
  Rectangle,
41015
42706
  Rounding,
41016
42707
  RunCommands,
@@ -41028,7 +42719,7 @@ ${svg}
41028
42719
  Snapping,
41029
42720
  SourceUtils,
41030
42721
  Split,
41031
- State,
42722
+ Env,
41032
42723
  Stash,
41033
42724
  Stringify,
41034
42725
  Svg,
@@ -41044,10 +42735,10 @@ ${svg}
41044
42735
  );
41045
42736
 
41046
42737
  // The entry point for the core mapshaper module
42738
+
41047
42739
  var moduleAPI = Object.assign({
41048
- cli, geom, utils, internal,
41049
- importFile // Adding importFile() for compatibility with old tests; todo: rewrite tests
41050
- }, cmd, coreAPI); // Adding command functions to the top-level module API, for test compatibility
42740
+ cli, cmd, geom, utils, internal,
42741
+ }, coreAPI);
41051
42742
 
41052
42743
  if (typeof module === "object" && module.exports) {
41053
42744
  module.exports = moduleAPI;