mapshaper 0.5.70 → 0.5.74

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.
@@ -1,8 +1,8 @@
1
1
  (function () {
2
2
 
3
- var utils$1 = /*#__PURE__*/Object.freeze({
3
+ var utils = /*#__PURE__*/Object.freeze({
4
4
  __proto__: null,
5
- get default () { return utils$1; },
5
+ get default () { return utils; },
6
6
  get getUniqueName () { return getUniqueName; },
7
7
  get isFunction () { return isFunction; },
8
8
  get isObject () { return isObject; },
@@ -95,15 +95,15 @@
95
95
 
96
96
  var api = window.mapshaper; // assuming mapshaper is in global scope
97
97
  var mapshaper = api,
98
- utils = api.utils,
98
+ utils$1 = api.utils,
99
99
  cli = api.cli,
100
- geom = api.geom,
100
+ geom$1 = api.geom,
101
101
  internal = api.internal,
102
- Bounds = internal.Bounds,
103
- UserError = internal.UserError,
104
- message = internal.message, // stop, error and message are overridden in gui-proxy.js
105
- stop = internal.stop,
106
- error = internal.error;
102
+ Bounds$1 = internal.Bounds,
103
+ UserError$1 = internal.UserError,
104
+ message$1 = internal.message, // stop, error and message are overridden in gui-proxy.js
105
+ stop$1 = internal.stop,
106
+ error$1 = internal.error;
107
107
 
108
108
  api.enableLogging();
109
109
 
@@ -139,7 +139,7 @@
139
139
 
140
140
  html = '<table>';
141
141
  if (catalog.title) {
142
- html += utils.format('<tr><th colspan="%d"><h4>%s</h4></th></tr>', cols, catalog.title);
142
+ html += utils$1.format('<tr><th colspan="%d"><h4>%s</h4></th></tr>', cols, catalog.title);
143
143
  }
144
144
  while (row < rows) {
145
145
  html += renderRow(items.slice(row * cols, row * cols + cols));
@@ -204,7 +204,7 @@
204
204
 
205
205
  function renderCell(item, i) {
206
206
  var template = '<td data-id="%d"><h4 class="title">%s</h4><div class="subtitle">%s</div></td>';
207
- return utils.format(template, i, item.title, item.subtitle || '');
207
+ return utils$1.format(template, i, item.title, item.subtitle || '');
208
208
  }
209
209
 
210
210
  }
@@ -317,7 +317,7 @@
317
317
  }
318
318
  parsed = internal.parseCommands(str);
319
319
  if (!parsed.length || parsed[0].name != cmd) {
320
- stop("Unable to parse command line options");
320
+ stop$1("Unable to parse command line options");
321
321
  }
322
322
  return parsed[0].options;
323
323
  };
@@ -386,7 +386,7 @@
386
386
  evt = new EventData(this.type);
387
387
  evt.target = this.target;
388
388
  } else if (evt.target != this.target || evt.type != this.type) {
389
- error("[Handler] event target/type have changed.");
389
+ error$1("[Handler] event target/type have changed.");
390
390
  }
391
391
  this.callback.call(this.listener, evt);
392
392
  };
@@ -395,7 +395,7 @@
395
395
  this.type = type;
396
396
  this.target = target;
397
397
  if (data) {
398
- utils.defaults(this, data);
398
+ utils$1.defaults(this, data);
399
399
  this.data = data;
400
400
  }
401
401
  }
@@ -624,12 +624,12 @@
624
624
  try {
625
625
  els = root.querySelectorAll(selector);
626
626
  } catch (e) {
627
- error("Invalid selector:", selector);
627
+ error$1("Invalid selector:", selector);
628
628
  }
629
629
  } else {
630
- error("This browser doesn't support CSS query selectors");
630
+ error$1("This browser doesn't support CSS query selectors");
631
631
  }
632
- return utils.toArray(els);
632
+ return utils$1.toArray(els);
633
633
  };
634
634
 
635
635
  // Converts dash-separated names (e.g. background-color) to camelCase (e.g. backgroundColor)
@@ -666,7 +666,7 @@
666
666
  };
667
667
 
668
668
  function El(ref) {
669
- if (!ref) error("Element() needs a reference");
669
+ if (!ref) error$1("Element() needs a reference");
670
670
  if (ref instanceof El) {
671
671
  return ref;
672
672
  }
@@ -675,7 +675,7 @@
675
675
  }
676
676
 
677
677
  var node;
678
- if (utils.isString(ref)) {
678
+ if (utils$1.isString(ref)) {
679
679
  if (ref[0] == '<') {
680
680
  var parent = El('div').html(ref).node();
681
681
  node = parent.childNodes.length == 1 ? parent.childNodes[0] : parent;
@@ -687,13 +687,13 @@
687
687
  } else if (ref.tagName) {
688
688
  node = ref;
689
689
  }
690
- if (!node) error("Unmatched element selector:", ref);
690
+ if (!node) error$1("Unmatched element selector:", ref);
691
691
  this.el = node;
692
692
  }
693
693
 
694
- utils.inherit(El, EventDispatcher);
694
+ utils$1.inherit(El, EventDispatcher);
695
695
 
696
- utils.extend(El.prototype, {
696
+ utils$1.extend(El.prototype, {
697
697
 
698
698
  clone: function() {
699
699
  var el = this.el.cloneNode(true);
@@ -702,7 +702,7 @@
702
702
  // can ...
703
703
  el = El('div').addClass(el.className).html(el.innerHTML).node();
704
704
  }
705
- el.id = utils.getUniqueName();
705
+ el.id = utils$1.getUniqueName();
706
706
  this.el = el;
707
707
  return this;
708
708
  },
@@ -732,11 +732,11 @@
732
732
  if (val != null) {
733
733
  El.setStyle(this.el, css, val);
734
734
  }
735
- else if (utils.isString(css)) {
735
+ else if (utils$1.isString(css)) {
736
736
  addCSS(this.el, css);
737
737
  }
738
- else if (utils.isObject(css)) {
739
- utils.forEachProperty(css, function(val, key) {
738
+ else if (utils$1.isObject(css)) {
739
+ utils$1.forEachProperty(css, function(val, key) {
740
740
  El.setStyle(this.el, key, val);
741
741
  }, this);
742
742
  }
@@ -744,7 +744,7 @@
744
744
  },
745
745
 
746
746
  attr: function(obj, value) {
747
- if (utils.isString(obj)) {
747
+ if (utils$1.isString(obj)) {
748
748
  if (arguments.length == 1) {
749
749
  return this.el.getAttribute(obj);
750
750
  }
@@ -828,7 +828,7 @@
828
828
  },
829
829
 
830
830
  text: function(str) {
831
- this.html(utils.htmlEscape(str));
831
+ this.html(utils$1.htmlEscape(str));
832
832
  return this;
833
833
  },
834
834
 
@@ -918,7 +918,7 @@
918
918
  El.prototype.__on = El.prototype.on;
919
919
  El.prototype.on = function(type, func, ctx) {
920
920
  if (ctx) {
921
- error("[El#on()] Third argument no longer supported.");
921
+ error$1("[El#on()] Third argument no longer supported.");
922
922
  }
923
923
  if (this.constructor == El) {
924
924
  this.el.addEventListener(type, func);
@@ -974,7 +974,7 @@
974
974
  }
975
975
 
976
976
  this.value = function(str) {
977
- if (utils.isString(str)) {
977
+ if (utils$1.isString(str)) {
978
978
  el.node().textContent = str;
979
979
  } else {
980
980
  return el.node().textContent;
@@ -982,7 +982,7 @@
982
982
  };
983
983
  }
984
984
 
985
- utils.inherit(ClickText2, EventDispatcher);
985
+ utils$1.inherit(ClickText2, EventDispatcher);
986
986
 
987
987
  // @ref reference to a text input element
988
988
  function ClickText(ref) {
@@ -1053,9 +1053,9 @@
1053
1053
  // return _parser ? _parser(valStr) : parseFloat(valStr);
1054
1054
  return _value;
1055
1055
  }
1056
- var val = utils.clamp(arg, _min, _max);
1056
+ var val = utils$1.clamp(arg, _min, _max);
1057
1057
  if (!_validator(val)) {
1058
- error("ClickText#value() invalid value:", arg);
1058
+ error$1("ClickText#value() invalid value:", arg);
1059
1059
  } else {
1060
1060
  _value = val;
1061
1061
  }
@@ -1064,14 +1064,14 @@
1064
1064
  };
1065
1065
  }
1066
1066
 
1067
- utils.inherit(ClickText, EventDispatcher);
1067
+ utils$1.inherit(ClickText, EventDispatcher);
1068
1068
 
1069
1069
 
1070
1070
  function Checkbox(ref) {
1071
1071
  var _el = El(ref);
1072
1072
  }
1073
1073
 
1074
- utils.inherit(Checkbox, EventDispatcher);
1074
+ utils$1.inherit(Checkbox, EventDispatcher);
1075
1075
 
1076
1076
  function SimpleButton(ref) {
1077
1077
  var _el = El(ref),
@@ -1100,14 +1100,15 @@
1100
1100
  }
1101
1101
  }
1102
1102
 
1103
- utils.inherit(SimpleButton, EventDispatcher);
1103
+ utils$1.inherit(SimpleButton, EventDispatcher);
1104
1104
 
1105
1105
  // @cb function(<FileList>)
1106
1106
  function DropControl(el, cb) {
1107
1107
  var area = El(el);
1108
1108
  area.on('dragleave', ondragleave)
1109
1109
  .on('dragover', ondragover)
1110
- .on('drop', ondrop);
1110
+ .on('drop', ondrop)
1111
+ .on('paste', onpaste);
1111
1112
  function ondragleave(e) {
1112
1113
  block(e);
1113
1114
  out();
@@ -1128,12 +1129,39 @@
1128
1129
  function out() {
1129
1130
  area.removeClass('dragover');
1130
1131
  }
1132
+ function onpaste(e) {
1133
+ var text, file;
1134
+ block(e);
1135
+ try {
1136
+ text = e.clipboardData.getData('text/plain').trim();
1137
+ file = text ? pastedTextToFile(text) : null;
1138
+ if (file) {
1139
+ cb([file]);
1140
+ }
1141
+ } catch(err) {
1142
+ console.error(err);
1143
+ }
1144
+ }
1131
1145
  function block(e) {
1132
1146
  e.preventDefault();
1133
1147
  e.stopPropagation();
1134
1148
  }
1135
1149
  }
1136
1150
 
1151
+ function pastedTextToFile(str) {
1152
+ var type = internal.guessInputContentType(str);
1153
+ var name;
1154
+ if (type == 'text') {
1155
+ name = 'pasted.txt';
1156
+ } else if (type == 'json') {
1157
+ name = 'pasted.json';
1158
+ } else {
1159
+ return null;
1160
+ }
1161
+ var blob = new Blob([str]);
1162
+ return new File([blob], name);
1163
+ }
1164
+
1137
1165
  // @el DOM element for select button
1138
1166
  // @cb function(<FileList>)
1139
1167
  function FileChooser(el, cb) {
@@ -1307,7 +1335,7 @@
1307
1335
 
1308
1336
  function receiveFiles(files) {
1309
1337
  var prevSize = queuedFiles.length;
1310
- files = handleZipFiles(utils.toArray(files));
1338
+ files = handleZipFiles(utils$1.toArray(files));
1311
1339
  addFilesToQueue(files);
1312
1340
  if (queuedFiles.length === 0) return;
1313
1341
  gui.enterMode('import');
@@ -1322,7 +1350,7 @@
1322
1350
  }
1323
1351
 
1324
1352
  function filesMayContainPaths(files) {
1325
- return utils.some(files, function(f) {
1353
+ return utils$1.some(files, function(f) {
1326
1354
  var type = internal.guessInputFileType(f.name);
1327
1355
  return type == 'shp' || type == 'json' || internal.isZipFile(f.name);
1328
1356
  });
@@ -1426,7 +1454,7 @@
1426
1454
  lyr = dataset.layers[0];
1427
1455
  lyr.data = new internal.ShapefileTable(content, importOpts.encoding);
1428
1456
  if (lyr.shapes && lyr.data.size() != lyr.shapes.length) {
1429
- stop("Different number of records in .shp and .dbf files");
1457
+ stop$1("Different number of records in .shp and .dbf files");
1430
1458
  }
1431
1459
  if (!lyr.geometry_type) {
1432
1460
  // kludge: trigger display of table cells if .shp has null geometry
@@ -1491,7 +1519,7 @@
1491
1519
  }
1492
1520
 
1493
1521
  function handleImportError(e, fileName) {
1494
- var msg = utils.isString(e) ? e : e.message;
1522
+ var msg = utils$1.isString(e) ? e : e.message;
1495
1523
  if (fileName) {
1496
1524
  msg = "Error importing <i>" + fileName + "</i><br>" + msg;
1497
1525
  }
@@ -1549,7 +1577,7 @@
1549
1577
 
1550
1578
  function downloadFiles(paths) {
1551
1579
  var items = prepFilesForDownload(paths);
1552
- utils.reduceAsync(items, [], downloadNextFile, function(err, files) {
1580
+ utils$1.reduceAsync(items, [], downloadNextFile, function(err, files) {
1553
1581
  if (err) {
1554
1582
  gui.alert(err);
1555
1583
  } else if (!files.length) {
@@ -1645,7 +1673,7 @@
1645
1673
  var defaults = {
1646
1674
  space: 7
1647
1675
  };
1648
- opts = utils.extend(defaults, opts);
1676
+ opts = utils$1.extend(defaults, opts);
1649
1677
 
1650
1678
  var _pct = 0;
1651
1679
  var _track,
@@ -1698,7 +1726,7 @@
1698
1726
  };
1699
1727
 
1700
1728
  function setHandlePos(x, fire) {
1701
- x = utils.clamp(x, 0, size());
1729
+ x = utils$1.clamp(x, 0, size());
1702
1730
  var pct = x / size();
1703
1731
  if (pct != _pct) {
1704
1732
  _pct = pct;
@@ -1713,7 +1741,7 @@
1713
1741
  }
1714
1742
  }
1715
1743
 
1716
- utils.inherit(Slider, EventDispatcher);
1744
+ utils$1.inherit(Slider, EventDispatcher);
1717
1745
 
1718
1746
  /*
1719
1747
  How changes in the simplify control should affect other components
@@ -1781,7 +1809,7 @@
1781
1809
  slider.on('change', function(e) {
1782
1810
  var pct = fromSliderPct(e.pct);
1783
1811
  text.value(pct);
1784
- pct = utils.parsePercent(text.text()); // use rounded value (for consistency w/ cli)
1812
+ pct = utils$1.parsePercent(text.text()); // use rounded value (for consistency w/ cli)
1785
1813
  onChange(pct);
1786
1814
  });
1787
1815
  slider.on('start', function(e) {
@@ -1802,7 +1830,7 @@
1802
1830
  else if (pct < 0.01) decimals = 3;
1803
1831
  else if (pct < 1) decimals = 2;
1804
1832
  else if (pct < 100) decimals = 1;
1805
- return utils.formatNumber(pct, decimals) + "%";
1833
+ return utils$1.formatNumber(pct, decimals) + "%";
1806
1834
  });
1807
1835
 
1808
1836
  text.parser(function(s) {
@@ -2054,7 +2082,7 @@
2054
2082
 
2055
2083
  // Replace error function in mapshaper lib
2056
2084
  var error = function() {
2057
- stop.apply(null, utils.toArray(arguments));
2085
+ stop.apply(null, utils$1.toArray(arguments));
2058
2086
  };
2059
2087
 
2060
2088
  var message = function() {
@@ -2068,11 +2096,11 @@
2068
2096
  // replace CLI version of writeFiles()
2069
2097
  internal.replaceWriteFiles(function(files, opts, done) {
2070
2098
  var filename;
2071
- if (!utils.isArray(files) || files.length === 0) {
2099
+ if (!utils$1.isArray(files) || files.length === 0) {
2072
2100
  done("Nothing to export");
2073
2101
  } else if (GUI.canSaveToServer() && !opts.save_to_download_folder) {
2074
- var paths = internal.getOutputPaths(utils.pluck(files, 'filename'), opts);
2075
- var data = utils.pluck(files, 'content');
2102
+ var paths = internal.getOutputPaths(utils$1.pluck(files, 'filename'), opts);
2103
+ var data = utils$1.pluck(files, 'content');
2076
2104
  saveFilesToServer(paths, data, function(err) {
2077
2105
  var msg;
2078
2106
  if (err) {
@@ -2091,7 +2119,7 @@
2091
2119
  } else if (files.length == 1) {
2092
2120
  saveBlobToDownloadFolder(files[0].filename, new Blob([files[0].content]), done);
2093
2121
  } else {
2094
- filename = internal.getCommonFileBase(utils.pluck(files, 'filename')) || "output";
2122
+ filename = internal.getCommonFileBase(utils$1.pluck(files, 'filename')) || "output";
2095
2123
  saveZipFile(filename + ".zip", files, done);
2096
2124
  }
2097
2125
  });
@@ -2113,10 +2141,10 @@
2113
2141
  // try to match import filename of this dataset
2114
2142
  if (d.info.input_files[0] == src) return d;
2115
2143
  // try to match name of a layer in this dataset
2116
- lyr = utils.find(d.layers, function(lyr) {return lyr.name == src;});
2144
+ lyr = utils$1.find(d.layers, function(lyr) {return lyr.name == src;});
2117
2145
  return lyr ? internal.isolateLayer(lyr, d) : null;
2118
2146
  }, null);
2119
- if (!retn) stop("Missing data layer [" + src + "]");
2147
+ if (!retn) stop$1("Missing data layer [" + src + "]");
2120
2148
  return retn;
2121
2149
  }
2122
2150
 
@@ -2125,7 +2153,7 @@
2125
2153
  // Return a copy with layers duplicated, so changes won't affect original layers
2126
2154
  // This makes an (unsafe) assumption that the dataset arcs won't be changed...
2127
2155
  // need to rethink this.
2128
- return utils.defaults({
2156
+ return utils$1.defaults({
2129
2157
  layers: dataset.layers.map(internal.copyLayer)
2130
2158
  }, dataset);
2131
2159
  });
@@ -2197,7 +2225,7 @@
2197
2225
  }
2198
2226
 
2199
2227
  function projectPointsForDisplay(lyr, src, dest) {
2200
- var copy = utils.extend({}, lyr);
2228
+ var copy = utils$1.extend({}, lyr);
2201
2229
  var proj = internal.getProjTransform2(src, dest);
2202
2230
  copy.shapes = internal.cloneShapes(lyr.shapes);
2203
2231
  internal.projectPointLayer(copy, proj);
@@ -2594,7 +2622,7 @@
2594
2622
  } else if (cmd == 'history') {
2595
2623
  toLog(gui.session.toCommandLineString());
2596
2624
  } else if (cmd == 'layers') {
2597
- message("Available layers:",
2625
+ message$1("Available layers:",
2598
2626
  internal.getFormattedLayerList(model));
2599
2627
  } else if (cmd == 'close' || cmd == 'exit' || cmd == 'quit') {
2600
2628
  turnOff();
@@ -2683,7 +2711,7 @@
2683
2711
  }
2684
2712
 
2685
2713
  function onError(err) {
2686
- if (utils.isString(err)) {
2714
+ if (utils$1.isString(err)) {
2687
2715
  consoleStop(err);
2688
2716
  } else if (err.name == 'UserError') {
2689
2717
  // stop() has already been called, don't need to log
@@ -2698,7 +2726,7 @@
2698
2726
  function consoleStop() {
2699
2727
  var msg = GUI.formatMessageArgs(arguments);
2700
2728
  consoleWarning(msg);
2701
- throw new UserError(msg);
2729
+ throw new UserError$1(msg);
2702
2730
  }
2703
2731
 
2704
2732
  function consoleWarning() {
@@ -2862,7 +2890,7 @@
2862
2890
  // console.log("first intersection:", internal.getIntersectionDebugData(XX[0], arcs));
2863
2891
  pointLyr = {geometry_type: 'point', shapes: [internal.getIntersectionPoints(XX)]};
2864
2892
  map.setIntersectionLayer(pointLyr, {layers:[pointLyr]});
2865
- readout.html(utils.format('<span class="icon"></span>%s line intersection%s <img class="close-btn" src="images/close.png">', n, utils.pluralSuffix(n)));
2893
+ readout.html(utils$1.format('<span class="icon"></span>%s line intersection%s <img class="close-btn" src="images/close.png">', n, utils$1.pluralSuffix(n)));
2866
2894
  readout.findChild('.close-btn').on('click', dismiss);
2867
2895
  } else {
2868
2896
  map.setIntersectionLayer(null);
@@ -2871,7 +2899,7 @@
2871
2899
  }
2872
2900
  }
2873
2901
 
2874
- utils.inherit(RepairControl, EventDispatcher);
2902
+ utils$1.inherit(RepairControl, EventDispatcher);
2875
2903
 
2876
2904
  function filterLayerByIds(lyr, ids) {
2877
2905
  var shapes;
@@ -2879,7 +2907,7 @@
2879
2907
  shapes = ids.map(function(id) {
2880
2908
  return lyr.shapes[id];
2881
2909
  });
2882
- return utils.defaults({shapes: shapes, data: null}, lyr);
2910
+ return utils$1.defaults({shapes: shapes, data: null}, lyr);
2883
2911
  }
2884
2912
  return lyr;
2885
2913
  }
@@ -2985,7 +3013,7 @@
2985
3013
  // Convert an array-like object to an Array, or make a copy if @obj is an Array
2986
3014
  function toArray(obj) {
2987
3015
  var arr;
2988
- if (!isArrayLike(obj)) error$1("toArray() requires an array-like object");
3016
+ if (!isArrayLike(obj)) error("toArray() requires an array-like object");
2989
3017
  try {
2990
3018
  arr = Array.prototype.slice.call(obj, 0); // breaks in ie8
2991
3019
  } catch(e) {
@@ -3124,7 +3152,7 @@
3124
3152
  // Append elements of @src array to @dest array
3125
3153
  function merge(dest, src) {
3126
3154
  if (!isArray(dest) || !isArray(src)) {
3127
- error$1("Usage: merge(destArray, srcArray);");
3155
+ error("Usage: merge(destArray, srcArray);");
3128
3156
  }
3129
3157
  for (var i=0, n=src.length; i<n; i++) {
3130
3158
  dest.push(src[i]);
@@ -3165,7 +3193,7 @@
3165
3193
  else if (isArrayLike(container)) {
3166
3194
  return indexOf(container, item) != -1;
3167
3195
  }
3168
- error$1("Expected Array or String argument");
3196
+ error("Expected Array or String argument");
3169
3197
  }
3170
3198
 
3171
3199
  function some(arr, test) {
@@ -3212,7 +3240,7 @@
3212
3240
  // Assumes: no other non-numeric objects in array
3213
3241
  //
3214
3242
  function sum(arr, info) {
3215
- if (!isArrayLike(arr)) error$1 ("sum() expects an array, received:", arr);
3243
+ if (!isArrayLike(arr)) error ("sum() expects an array, received:", arr);
3216
3244
  var tot = 0,
3217
3245
  nan = 0,
3218
3246
  val;
@@ -3477,7 +3505,7 @@
3477
3505
  var arr2 = [];
3478
3506
  for (var i=0; i<len; i++) {
3479
3507
  var idx = idxs[i];
3480
- if (idx < 0 || idx >= len) error$1("Out-of-bounds array idx");
3508
+ if (idx < 0 || idx >= len) error("Out-of-bounds array idx");
3481
3509
  arr2[i] = arr[idx];
3482
3510
  }
3483
3511
  replaceArray(arr, arr2);
@@ -3562,7 +3590,7 @@
3562
3590
  // Elements of @arr are reordered
3563
3591
  //
3564
3592
  function findValueByRank(arr, rank) {
3565
- if (!arr.length || rank < 1 || rank > arr.length) error$1("[findValueByRank()] invalid input");
3593
+ if (!arr.length || rank < 1 || rank > arr.length) error("[findValueByRank()] invalid input");
3566
3594
 
3567
3595
  rank = clamp(rank | 0, 1, arr.length);
3568
3596
  var k = rank - 1, // conv. rank to array index
@@ -3746,7 +3774,7 @@
3746
3774
  var str = literals[0],
3747
3775
  n = arguments.length;
3748
3776
  if (n != formatCodes.length) {
3749
- error$1("[format()] Data does not match format string; format:", fmt, "data:", arguments);
3777
+ error("[format()] Data does not match format string; format:", fmt, "data:", arguments);
3750
3778
  }
3751
3779
  for (var i=0; i<n; i++) {
3752
3780
  str += formatValue(arguments[i], formatCodes[i]) + literals[i+1];
@@ -3785,7 +3813,7 @@
3785
3813
  }
3786
3814
 
3787
3815
  function copyElements(src, i, dest, j, n, rev) {
3788
- if (src === dest && j > i) error$1 ("copy error");
3816
+ if (src === dest && j > i) error ("copy error");
3789
3817
  var inc = 1,
3790
3818
  offs = 0;
3791
3819
  if (rev) {
@@ -3831,7 +3859,7 @@
3831
3859
  pct = Number(str);
3832
3860
  }
3833
3861
  if (!(pct >= 0 && pct <= 1)) {
3834
- stop$1(format("Invalid percentage: %s", str));
3862
+ stop(format("Invalid percentage: %s", str));
3835
3863
  }
3836
3864
  return pct;
3837
3865
  }
@@ -3946,7 +3974,7 @@
3946
3974
  function createAsyncContext(cb) {
3947
3975
  context = createContext();
3948
3976
  return function() {
3949
- cb.apply(null, utils$1.toArray(arguments));
3977
+ cb.apply(null, utils.toArray(arguments));
3950
3978
  // clear context after cb(), so output/errors can be handled in current context
3951
3979
  context = createContext();
3952
3980
  };
@@ -3959,7 +3987,7 @@
3959
3987
  var ctx = context;
3960
3988
  return function() {
3961
3989
  context = ctx;
3962
- cb.apply(null, utils$1.toArray(arguments));
3990
+ cb.apply(null, utils.toArray(arguments));
3963
3991
  };
3964
3992
  }
3965
3993
 
@@ -3968,12 +3996,12 @@
3968
3996
 
3969
3997
  // These three functions can be reset by GUI using setLoggingFunctions();
3970
3998
  var _error = function() {
3971
- var msg = utils$1.toArray(arguments).join(' ');
3999
+ var msg = utils.toArray(arguments).join(' ');
3972
4000
  throw new Error(msg);
3973
4001
  };
3974
4002
 
3975
4003
  var _stop = function() {
3976
- throw new UserError$1(formatLogArgs(arguments));
4004
+ throw new UserError(formatLogArgs(arguments));
3977
4005
  };
3978
4006
 
3979
4007
  var _interrupt = function() {
@@ -3993,21 +4021,21 @@
3993
4021
  }
3994
4022
 
3995
4023
  // Handle an unexpected condition (internal error)
3996
- function error$1() {
3997
- _error.apply(null, utils$1.toArray(arguments));
4024
+ function error() {
4025
+ _error.apply(null, utils.toArray(arguments));
3998
4026
  }
3999
4027
 
4000
4028
  // Handle an error caused by invalid input or misuse of API
4001
- function stop$1() {
4002
- _stop.apply(null, utils$1.toArray(arguments));
4029
+ function stop() {
4030
+ _stop.apply(null, utils.toArray(arguments));
4003
4031
  }
4004
4032
 
4005
4033
  function interrupt() {
4006
- _interrupt.apply(null, utils$1.toArray(arguments));
4034
+ _interrupt.apply(null, utils.toArray(arguments));
4007
4035
  }
4008
4036
 
4009
4037
  // Print a status message
4010
- function message$1() {
4038
+ function message() {
4011
4039
  _message.apply(null, messageArgs(arguments));
4012
4040
  }
4013
4041
 
@@ -4022,14 +4050,14 @@
4022
4050
  // print a message to stdout
4023
4051
  function print() {
4024
4052
  STDOUT = true; // tell logArgs() to print to stdout, not stderr
4025
- message$1.apply(null, arguments);
4053
+ message.apply(null, arguments);
4026
4054
  STDOUT = false;
4027
4055
  }
4028
4056
 
4029
4057
  function verbose() {
4030
4058
  // verbose can be set globally with the -verbose command or separately for each command
4031
4059
  if (getStateVar('VERBOSE') || getStateVar('verbose')) {
4032
- message$1.apply(null, arguments);
4060
+ message.apply(null, arguments);
4033
4061
  }
4034
4062
  }
4035
4063
 
@@ -4042,8 +4070,8 @@
4042
4070
  function printError(err) {
4043
4071
  var msg;
4044
4072
  if (!LOGGING) return;
4045
- if (utils$1.isString(err)) {
4046
- err = new UserError$1(err);
4073
+ if (utils.isString(err)) {
4074
+ err = new UserError(err);
4047
4075
  }
4048
4076
  if (err.name == 'NonFatalError') {
4049
4077
  console.error(messageArgs([err.message]).join(' '));
@@ -4061,7 +4089,7 @@
4061
4089
  }
4062
4090
  }
4063
4091
 
4064
- function UserError$1(msg) {
4092
+ function UserError(msg) {
4065
4093
  var err = new Error(msg);
4066
4094
  err.name = 'UserError';
4067
4095
  return err;
@@ -4101,7 +4129,7 @@
4101
4129
  var col = i % perLine;
4102
4130
  if (i > 0 && col === 0) memo += '\n';
4103
4131
  if (col < perLine - 1) { // right-pad all but rightmost column
4104
- name = utils$1.rpad(name, colWidth - 2, ' ');
4132
+ name = utils.rpad(name, colWidth - 2, ' ');
4105
4133
  }
4106
4134
  return memo + ' ' + name;
4107
4135
  }, '');
@@ -4109,11 +4137,11 @@
4109
4137
 
4110
4138
  // expose so GUI can use it
4111
4139
  function formatLogArgs(args) {
4112
- return utils$1.toArray(args).join(' ');
4140
+ return utils.toArray(args).join(' ');
4113
4141
  }
4114
4142
 
4115
4143
  function messageArgs(args) {
4116
- var arr = utils$1.toArray(args);
4144
+ var arr = utils.toArray(args);
4117
4145
  var cmd = getStateVar('current_command');
4118
4146
  if (cmd && cmd != 'help') {
4119
4147
  arr.unshift('[' + cmd + ']');
@@ -4122,7 +4150,7 @@
4122
4150
  }
4123
4151
 
4124
4152
  function logArgs(args) {
4125
- if (LOGGING && !getStateVar('QUIET') && utils$1.isArrayLike(args)) {
4153
+ if (LOGGING && !getStateVar('QUIET') && utils.isArrayLike(args)) {
4126
4154
  (!STDOUT && console.error || console.log).call(console, formatLogArgs(args));
4127
4155
  }
4128
4156
  }
@@ -4193,14 +4221,14 @@
4193
4221
  }
4194
4222
  });
4195
4223
  if (throws && unmatchedIds.length) {
4196
- stop$1(utils$1.format('Missing layer%s: %s', unmatchedIds.length == 1 ? '' : 's', unmatchedIds.join(',')));
4224
+ stop(utils.format('Missing layer%s: %s', unmatchedIds.length == 1 ? '' : 's', unmatchedIds.join(',')));
4197
4225
  }
4198
4226
  return matchedLayers;
4199
4227
  }
4200
4228
 
4201
4229
  function getLayerMatch(pattern) {
4202
- var isIndex = utils$1.isInteger(Number(pattern));
4203
- var nameRxp = isIndex ? null : utils$1.wildcardToRegExp(pattern);
4230
+ var isIndex = utils.isInteger(Number(pattern));
4231
+ var nameRxp = isIndex ? null : utils.wildcardToRegExp(pattern);
4204
4232
  return function(lyr, i) {
4205
4233
  return isIndex ? String(i) == pattern : nameRxp.test(lyr.name || '');
4206
4234
  };
@@ -4222,7 +4250,7 @@
4222
4250
  if (lyr.name && o.layer.name == lyr.name) nameCount++;
4223
4251
  if (lyr == o.layer) id = String(i + 1);
4224
4252
  });
4225
- if (!id) error$1('Layer not found');
4253
+ if (!id) error('Layer not found');
4226
4254
  return nameCount == 1 ? lyr.name : id;
4227
4255
  }
4228
4256
 
@@ -4242,7 +4270,7 @@
4242
4270
  });
4243
4271
 
4244
4272
  internal.writeFiles = function() {
4245
- error(unsupportedMsg);
4273
+ error$1(unsupportedMsg);
4246
4274
  };
4247
4275
  } else {
4248
4276
  new SimpleButton(menu.findChild('.save-btn').addClass('default-btn')).on('click', onExportClick);
@@ -4278,7 +4306,7 @@
4278
4306
  setTimeout(function() {
4279
4307
  exportMenuSelection(layers, function(err) {
4280
4308
  if (err) {
4281
- if (utils.isString(err)) {
4309
+ if (utils$1.isString(err)) {
4282
4310
  gui.alert(err);
4283
4311
  } else {
4284
4312
  // stack seems to change if Error is logged directly
@@ -4325,7 +4353,7 @@
4325
4353
  // without changing its name elsewhere
4326
4354
  layer: Object.assign({}, o.layer)
4327
4355
  };
4328
- var html = utils.format(template, i + 1, target.layer.name || '[unnamed layer]');
4356
+ var html = utils$1.format(template, i + 1, target.layer.name || '[unnamed layer]');
4329
4357
  // return {layer: o.layer, html: html};
4330
4358
  var el = El('div').html(html).addClass('layer-item');
4331
4359
  var box = el.findChild('input').node();
@@ -4435,9 +4463,9 @@
4435
4463
 
4436
4464
  function initFormatMenu() {
4437
4465
  var defaults = ['shapefile', 'geojson', 'topojson', 'json', 'dsv', 'svg'];
4438
- var formats = utils.uniq(defaults.concat(getInputFormats()));
4466
+ var formats = utils$1.uniq(defaults.concat(getInputFormats()));
4439
4467
  var items = formats.map(function(fmt) {
4440
- return utils.format('<div><label><input type="radio" name="format" value="%s"' +
4468
+ return utils$1.format('<div><label><input type="radio" name="format" value="%s"' +
4441
4469
  ' class="radio">%s</label></div>', fmt, internal.getFormatName(fmt));
4442
4470
  });
4443
4471
  menu.findChild('.export-formats').html(items.join('\n'));
@@ -4600,7 +4628,7 @@
4600
4628
  // can be used as unique identifiers for caching rendered HTML, and as
4601
4629
  // an id for layer menu event handlers
4602
4630
  if (!lyr.menu_id || uniqIds[lyr.menu_id]) {
4603
- lyr.menu_id = utils.getUniqueName();
4631
+ lyr.menu_id = utils$1.getUniqueName();
4604
4632
  }
4605
4633
  uniqIds[lyr.menu_id] = true;
4606
4634
  if (isPinnable(lyr)) pinnableCount++;
@@ -4773,7 +4801,7 @@
4773
4801
  type = lyr.geometry_type + ' feature';
4774
4802
  }
4775
4803
  if (type) {
4776
- str = utils.format('%,d %s%s', n, type, utils.pluralSuffix(n));
4804
+ str = utils$1.format('%,d %s%s', n, type, utils$1.pluralSuffix(n));
4777
4805
  } else {
4778
4806
  str = "[empty]";
4779
4807
  }
@@ -4784,7 +4812,7 @@
4784
4812
  var file = internal.getLayerSourceFile(lyr, dataset);
4785
4813
  var missing = [];
4786
4814
  var msg;
4787
- if (utils.endsWith(file, '.shp') && lyr == dataset.layers[0]) {
4815
+ if (utils$1.endsWith(file, '.shp') && lyr == dataset.layers[0]) {
4788
4816
  if (!lyr.data) {
4789
4817
  missing.push('.dbf');
4790
4818
  }
@@ -4810,7 +4838,7 @@
4810
4838
 
4811
4839
 
4812
4840
  function rowHTML(c1, c2, cname) {
4813
- return utils.format('<div class="row%s"><div class="col1">%s</div>' +
4841
+ return utils$1.format('<div class="row%s"><div class="col1">%s</div>' +
4814
4842
  '<div class="col2">%s</div></div>', cname ? ' ' + cname : '', c1, c2);
4815
4843
  }
4816
4844
  }
@@ -5031,7 +5059,7 @@
5031
5059
  };
5032
5060
  }
5033
5061
 
5034
- utils.inherit(ModeSwitcher, EventDispatcher);
5062
+ utils$1.inherit(ModeSwitcher, EventDispatcher);
5035
5063
 
5036
5064
  function KeyboardEvents(gui) {
5037
5065
  var self = this;
@@ -5059,7 +5087,7 @@
5059
5087
  };
5060
5088
  }
5061
5089
 
5062
- utils.inherit(KeyboardEvents, EventDispatcher);
5090
+ utils$1.inherit(KeyboardEvents, EventDispatcher);
5063
5091
 
5064
5092
  function InteractionMode(gui) {
5065
5093
 
@@ -5275,7 +5303,7 @@
5275
5303
  function Model(gui) {
5276
5304
  var self = new internal.Catalog();
5277
5305
  var deleteLayer = self.deleteLayer;
5278
- utils.extend(self, EventDispatcher.prototype);
5306
+ utils$1.extend(self, EventDispatcher.prototype);
5279
5307
 
5280
5308
  // override Catalog method (so -drop command will work in web console)
5281
5309
  self.deleteLayer = function(lyr, dataset) {
@@ -5309,7 +5337,7 @@
5309
5337
  if (flags.select) {
5310
5338
  self.dispatchEvent('select', active);
5311
5339
  }
5312
- self.dispatchEvent('update', utils.extend({flags: flags}, active));
5340
+ self.dispatchEvent('update', utils$1.extend({flags: flags}, active));
5313
5341
  };
5314
5342
 
5315
5343
  self.selectLayer = function(lyr, dataset) {
@@ -5344,7 +5372,7 @@
5344
5372
  } else if (geoType == 'polygon') {
5345
5373
  test = polygonTest;
5346
5374
  } else {
5347
- error("Unexpected geometry type:", geoType);
5375
+ error$1("Unexpected geometry type:", geoType);
5348
5376
  }
5349
5377
  return test;
5350
5378
 
@@ -5370,7 +5398,7 @@
5370
5398
  cand, hitId;
5371
5399
  for (var i=0; i<cands.length; i++) {
5372
5400
  cand = cands[i];
5373
- if (geom.testPointInPolygon(x, y, cand.shape, displayLayer.arcs)) {
5401
+ if (geom$1.testPointInPolygon(x, y, cand.shape, displayLayer.arcs)) {
5374
5402
  hits.push(cand.id);
5375
5403
  }
5376
5404
  }
@@ -5409,9 +5437,9 @@
5409
5437
 
5410
5438
  function sortByDistance(x, y, cands, arcs) {
5411
5439
  for (var i=0; i<cands.length; i++) {
5412
- cands[i].dist = geom.getPointToShapeDistance(x, y, cands[i].shape, arcs);
5440
+ cands[i].dist = geom$1.getPointToShapeDistance(x, y, cands[i].shape, arcs);
5413
5441
  }
5414
- utils.sortOn(cands, 'dist');
5442
+ utils$1.sortOn(cands, 'dist');
5415
5443
  }
5416
5444
 
5417
5445
  function pointTest(x, y) {
@@ -5423,7 +5451,7 @@
5423
5451
  newThreshold = Infinity;
5424
5452
 
5425
5453
  internal.forEachPoint(displayLayer.layer.shapes, function(p, id) {
5426
- var dist = geom.distance2D(x, y, p[0], p[1]) * toPx;
5454
+ var dist = geom$1.distance2D(x, y, p[0], p[1]) * toPx;
5427
5455
  if (dist > hitThreshold) return;
5428
5456
  // got a hit
5429
5457
  if (dist < newThreshold) {
@@ -5437,7 +5465,7 @@
5437
5465
  }
5438
5466
  });
5439
5467
  // console.log(hitThreshold, bullseye);
5440
- return utils.uniq(hits); // multipoint features can register multiple hits
5468
+ return utils$1.uniq(hits); // multipoint features can register multiple hits
5441
5469
  }
5442
5470
 
5443
5471
  function getRadiusFunction(style) {
@@ -5460,7 +5488,7 @@
5460
5488
  hitRadius = 0,
5461
5489
  hitDist;
5462
5490
  internal.forEachPoint(displayLayer.layer.shapes, function(p, id) {
5463
- var distSq = geom.distanceSq(x, y, p[0], p[1]);
5491
+ var distSq = geom$1.distanceSq(x, y, p[0], p[1]);
5464
5492
  var isHit = false;
5465
5493
  var isOver, isNear, r, d, rpix;
5466
5494
  if (distSq > limit * limit) return;
@@ -5644,9 +5672,9 @@
5644
5672
  };
5645
5673
  var svgData = svgTest(e); // null or a data object
5646
5674
  if (svgData) { // mouse is over an SVG symbol
5647
- utils.extend(data, svgData);
5675
+ utils$1.extend(data, svgData);
5648
5676
  // placing symbol id in front of any other hits
5649
- data.ids = utils.uniq([svgData.targetId].concat(data.ids));
5677
+ data.ids = utils$1.uniq([svgData.targetId].concat(data.ids));
5650
5678
  }
5651
5679
  data.id = data.ids.length > 0 ? data.ids[0] : -1;
5652
5680
  return data;
@@ -5747,8 +5775,8 @@
5747
5775
 
5748
5776
  self.addSelectionIds = function(ids) {
5749
5777
  turnOn('selection');
5750
- selectionIds = utils.uniq(selectionIds.concat(ids));
5751
- ids = utils.uniq(storedData.ids.concat(ids));
5778
+ selectionIds = utils$1.uniq(selectionIds.concat(ids));
5779
+ ids = utils$1.uniq(storedData.ids.concat(ids));
5752
5780
  updateSelectionState({ids: ids});
5753
5781
  };
5754
5782
 
@@ -5906,7 +5934,7 @@
5906
5934
 
5907
5935
  function toggleId(id, ids) {
5908
5936
  if (ids.indexOf(id) > -1) {
5909
- return utils.difference(ids, [id]);
5937
+ return utils$1.difference(ids, [id]);
5910
5938
  }
5911
5939
  return [id].concat(ids);
5912
5940
  }
@@ -5958,9 +5986,9 @@
5958
5986
  // d: event data (may be a pointer event object, an ordinary object or null)
5959
5987
  function triggerHitEvent(type, d) {
5960
5988
  // Merge stored hit data into the event data
5961
- var eventData = utils.extend({mode: interactionMode}, d || {}, storedData);
5989
+ var eventData = utils$1.extend({mode: interactionMode}, d || {}, storedData);
5962
5990
  if (transientIds.length) {
5963
- eventData.ids = utils.uniq(transientIds.concat(eventData.ids || []));
5991
+ eventData.ids = utils$1.uniq(transientIds.concat(eventData.ids || []));
5964
5992
  }
5965
5993
  self.dispatchEvent(type, eventData);
5966
5994
  }
@@ -6094,7 +6122,7 @@
6094
6122
  }
6095
6123
  }
6096
6124
 
6097
- utils.inherit(Timer, EventDispatcher);
6125
+ utils$1.inherit(Timer, EventDispatcher);
6098
6126
 
6099
6127
  function Tween(ease) {
6100
6128
  var self = this,
@@ -6116,7 +6144,7 @@
6116
6144
  }
6117
6145
  }
6118
6146
 
6119
- utils.inherit(Tween, EventDispatcher);
6147
+ utils$1.inherit(Tween, EventDispatcher);
6120
6148
 
6121
6149
  Tween.sineInOut = function(n) {
6122
6150
  return 0.5 - Math.cos(n * Math.PI) / 2;
@@ -6184,7 +6212,7 @@
6184
6212
  update();
6185
6213
  }
6186
6214
 
6187
- utils.inherit(ElementPosition, EventDispatcher);
6215
+ utils$1.inherit(ElementPosition, EventDispatcher);
6188
6216
 
6189
6217
  function MouseWheelDirection() {
6190
6218
  var prevTime = 0;
@@ -6282,13 +6310,13 @@
6282
6310
  // Decelerate towards the end of the sustain interval (for smoother zooming)
6283
6311
  multiplier *= Tween.quadraticOut(1 - fadeFactor);
6284
6312
  }
6285
- obj = utils.extend({direction: wheelDirection, multiplier: multiplier}, mouse.mouseData());
6313
+ obj = utils$1.extend({direction: wheelDirection, multiplier: multiplier}, mouse.mouseData());
6286
6314
  self.dispatchEvent('mousewheel', obj);
6287
6315
  }
6288
6316
  }
6289
6317
  }
6290
6318
 
6291
- utils.inherit(MouseWheel, EventDispatcher);
6319
+ utils$1.inherit(MouseWheel, EventDispatcher);
6292
6320
 
6293
6321
 
6294
6322
  function MouseArea(element, pos) {
@@ -6342,7 +6370,7 @@
6342
6370
  };
6343
6371
 
6344
6372
  this.mouseData = function() {
6345
- return utils.extend({}, _prevEvt);
6373
+ return utils$1.extend({}, _prevEvt);
6346
6374
  };
6347
6375
 
6348
6376
  function onAreaDown(e) {
@@ -6401,7 +6429,7 @@
6401
6429
  dragX: evt.pageX - _downEvt.pageX,
6402
6430
  dragY: evt.pageY - _downEvt.pageY
6403
6431
  };
6404
- _self.dispatchEvent('drag', utils.extend(obj, evt));
6432
+ _self.dispatchEvent('drag', utils$1.extend(obj, evt));
6405
6433
  } else {
6406
6434
  _self.dispatchEvent('hover', evt);
6407
6435
  }
@@ -6433,7 +6461,7 @@
6433
6461
  }
6434
6462
  }
6435
6463
 
6436
- utils.inherit(MouseArea, EventDispatcher);
6464
+ utils$1.inherit(MouseArea, EventDispatcher);
6437
6465
 
6438
6466
  function initVariableClick(node, cb) {
6439
6467
  var downEvent = null;
@@ -6580,7 +6608,7 @@
6580
6608
  maxScale = 4,
6581
6609
  minTime = 100,
6582
6610
  maxTime = 800,
6583
- time = utils.clamp(clickTime || 200, minTime, maxTime),
6611
+ time = utils$1.clamp(clickTime || 200, minTime, maxTime),
6584
6612
  k = (time - minTime) / (maxTime - minTime),
6585
6613
  scale = minScale + k * (maxScale - minScale);
6586
6614
  return 1 + scale * zoomScaleMultiplier;
@@ -6588,7 +6616,7 @@
6588
6616
 
6589
6617
  // @box Bounds with pixels from t,l corner of map area.
6590
6618
  function zoomToBbox(bbox) {
6591
- var bounds = new Bounds(bbox),
6619
+ var bounds = new Bounds$1(bbox),
6592
6620
  pct = Math.max(bounds.width() / ext.width(), bounds.height() / ext.height()),
6593
6621
  fx = bounds.centerX() / ext.width() * (1 + pct) - pct / 2,
6594
6622
  fy = bounds.centerY() / ext.height() * (1 + pct) - pct / 2;
@@ -6808,7 +6836,7 @@
6808
6836
  rows = 0;
6809
6837
  // self.hide(); // clean up if panel is already open
6810
6838
  el.empty(); // clean up if panel is already open
6811
- utils.forEachProperty(rec, function(v, k) {
6839
+ utils$1.forEachProperty(rec, function(v, k) {
6812
6840
  var type;
6813
6841
  // missing GeoJSON fields are set to undefined on import; skip these
6814
6842
  if (v !== undefined) {
@@ -6836,7 +6864,7 @@
6836
6864
  // Some individual features can have undefined values for some or all of
6837
6865
  // their data properties (properties are set to undefined when an input JSON file
6838
6866
  // has inconsistent fields, or after force-merging layers with inconsistent fields).
6839
- el.html(utils.format('<div class="note">This %s is missing attribute data.</div>',
6867
+ el.html(utils$1.format('<div class="note">This %s is missing attribute data.</div>',
6840
6868
  table && table.getFields().length > 0 ? 'feature': 'layer'));
6841
6869
  }
6842
6870
  }
@@ -6847,7 +6875,7 @@
6847
6875
  var str = formatInspectorValue(val, type);
6848
6876
  var cell = El('tr')
6849
6877
  .appendTo(table)
6850
- .html(utils.format(rowHtml, key, utils.htmlEscape(str)))
6878
+ .html(utils$1.format(rowHtml, key, utils$1.htmlEscape(str)))
6851
6879
  .findChild('.value');
6852
6880
  setFieldClass(cell, val, type);
6853
6881
  if (editable) {
@@ -6856,7 +6884,7 @@
6856
6884
  }
6857
6885
 
6858
6886
  function setFieldClass(el, val, type) {
6859
- var isNum = type ? type == 'number' : utils.isNumber(val);
6887
+ var isNum = type ? type == 'number' : utils$1.isNumber(val);
6860
6888
  var isNully = val === undefined || val === null || val !== val;
6861
6889
  var isEmpty = val === '';
6862
6890
  el.classed('num-field', isNum);
@@ -6894,7 +6922,7 @@
6894
6922
  function formatInspectorValue(val, type) {
6895
6923
  var str;
6896
6924
  if (type == 'date') {
6897
- str = utils.formatDateISO(val);
6925
+ str = utils$1.formatDateISO(val);
6898
6926
  } else if (type == 'object') {
6899
6927
  str = val ? JSON.stringify(val) : "";
6900
6928
  } else {
@@ -7015,7 +7043,7 @@
7015
7043
  }
7016
7044
 
7017
7045
  function getBoundsIntersection(a, b) {
7018
- var c = new Bounds();
7046
+ var c = new Bounds$1();
7019
7047
  if (a.intersects(b)) {
7020
7048
  c.setBounds(Math.max(a.xmin, b.xmin), Math.max(a.ymin, b.ymin),
7021
7049
  Math.min(a.xmax, b.xmax), Math.min(a.ymax, b.ymax));
@@ -7093,7 +7121,7 @@
7093
7121
  // handle either numeric strings or numbers in fields
7094
7122
  function applyDelta(rec, key, delta) {
7095
7123
  var currVal = rec[key];
7096
- var isString = utils.isString(currVal);
7124
+ var isString = utils$1.isString(currVal);
7097
7125
  var newVal = (+currVal + delta) || 0;
7098
7126
  rec[key] = isString ? String(newVal) : newVal;
7099
7127
  }
@@ -7508,18 +7536,18 @@
7508
7536
  return JSON.stringify(Object.assign({}, this));
7509
7537
  };
7510
7538
 
7511
- function Bounds$1() {
7539
+ function Bounds() {
7512
7540
  if (arguments.length > 0) {
7513
7541
  this.setBounds.apply(this, arguments);
7514
7542
  }
7515
7543
  }
7516
7544
 
7517
- Bounds$1.from = function() {
7518
- var b = new Bounds$1();
7545
+ Bounds.from = function() {
7546
+ var b = new Bounds();
7519
7547
  return b.setBounds.apply(b, arguments);
7520
7548
  };
7521
7549
 
7522
- Bounds$1.prototype.toString = function() {
7550
+ Bounds.prototype.toString = function() {
7523
7551
  return JSON.stringify({
7524
7552
  xmin: this.xmin,
7525
7553
  xmax: this.xmax,
@@ -7528,41 +7556,41 @@
7528
7556
  });
7529
7557
  };
7530
7558
 
7531
- Bounds$1.prototype.toArray = function() {
7559
+ Bounds.prototype.toArray = function() {
7532
7560
  return this.hasBounds() ? [this.xmin, this.ymin, this.xmax, this.ymax] : [];
7533
7561
  };
7534
7562
 
7535
- Bounds$1.prototype.hasBounds = function() {
7563
+ Bounds.prototype.hasBounds = function() {
7536
7564
  return this.xmin <= this.xmax && this.ymin <= this.ymax;
7537
7565
  };
7538
7566
 
7539
- Bounds$1.prototype.sameBounds =
7540
- Bounds$1.prototype.equals = function(bb) {
7567
+ Bounds.prototype.sameBounds =
7568
+ Bounds.prototype.equals = function(bb) {
7541
7569
  return bb && this.xmin === bb.xmin && this.xmax === bb.xmax &&
7542
7570
  this.ymin === bb.ymin && this.ymax === bb.ymax;
7543
7571
  };
7544
7572
 
7545
- Bounds$1.prototype.width = function() {
7573
+ Bounds.prototype.width = function() {
7546
7574
  return (this.xmax - this.xmin) || 0;
7547
7575
  };
7548
7576
 
7549
- Bounds$1.prototype.height = function() {
7577
+ Bounds.prototype.height = function() {
7550
7578
  return (this.ymax - this.ymin) || 0;
7551
7579
  };
7552
7580
 
7553
- Bounds$1.prototype.area = function() {
7581
+ Bounds.prototype.area = function() {
7554
7582
  return this.width() * this.height() || 0;
7555
7583
  };
7556
7584
 
7557
- Bounds$1.prototype.empty = function() {
7585
+ Bounds.prototype.empty = function() {
7558
7586
  this.xmin = this.ymin = this.xmax = this.ymax = void 0;
7559
7587
  return this;
7560
7588
  };
7561
7589
 
7562
- Bounds$1.prototype.setBounds = function(a, b, c, d) {
7590
+ Bounds.prototype.setBounds = function(a, b, c, d) {
7563
7591
  if (arguments.length == 1) {
7564
7592
  // assume first arg is a Bounds or array
7565
- if (utils$1.isArrayLike(a)) {
7593
+ if (utils.isArrayLike(a)) {
7566
7594
  b = a[1];
7567
7595
  c = a[2];
7568
7596
  d = a[3];
@@ -7585,17 +7613,17 @@
7585
7613
  };
7586
7614
 
7587
7615
 
7588
- Bounds$1.prototype.centerX = function() {
7616
+ Bounds.prototype.centerX = function() {
7589
7617
  var x = (this.xmin + this.xmax) * 0.5;
7590
7618
  return x;
7591
7619
  };
7592
7620
 
7593
- Bounds$1.prototype.centerY = function() {
7621
+ Bounds.prototype.centerY = function() {
7594
7622
  var y = (this.ymax + this.ymin) * 0.5;
7595
7623
  return y;
7596
7624
  };
7597
7625
 
7598
- Bounds$1.prototype.containsPoint = function(x, y) {
7626
+ Bounds.prototype.containsPoint = function(x, y) {
7599
7627
  if (x >= this.xmin && x <= this.xmax &&
7600
7628
  y <= this.ymax && y >= this.ymin) {
7601
7629
  return true;
@@ -7605,8 +7633,8 @@
7605
7633
 
7606
7634
  // intended to speed up slightly bubble symbol detection; could use intersects() instead
7607
7635
  // TODO: fix false positive where circle is just outside a corner of the box
7608
- Bounds$1.prototype.containsBufferedPoint =
7609
- Bounds$1.prototype.containsCircle = function(x, y, buf) {
7636
+ Bounds.prototype.containsBufferedPoint =
7637
+ Bounds.prototype.containsCircle = function(x, y, buf) {
7610
7638
  if ( x + buf > this.xmin && x - buf < this.xmax ) {
7611
7639
  if ( y - buf < this.ymax && y + buf > this.ymin ) {
7612
7640
  return true;
@@ -7615,7 +7643,7 @@
7615
7643
  return false;
7616
7644
  };
7617
7645
 
7618
- Bounds$1.prototype.intersects = function(bb) {
7646
+ Bounds.prototype.intersects = function(bb) {
7619
7647
  if (bb.xmin <= this.xmax && bb.xmax >= this.xmin &&
7620
7648
  bb.ymax >= this.ymin && bb.ymin <= this.ymax) {
7621
7649
  return true;
@@ -7623,7 +7651,7 @@
7623
7651
  return false;
7624
7652
  };
7625
7653
 
7626
- Bounds$1.prototype.contains = function(bb) {
7654
+ Bounds.prototype.contains = function(bb) {
7627
7655
  if (bb.xmin >= this.xmin && bb.ymax <= this.ymax &&
7628
7656
  bb.xmax <= this.xmax && bb.ymin >= this.ymin) {
7629
7657
  return true;
@@ -7631,12 +7659,12 @@
7631
7659
  return false;
7632
7660
  };
7633
7661
 
7634
- Bounds$1.prototype.shift = function(x, y) {
7662
+ Bounds.prototype.shift = function(x, y) {
7635
7663
  this.setBounds(this.xmin + x,
7636
7664
  this.ymin + y, this.xmax + x, this.ymax + y);
7637
7665
  };
7638
7666
 
7639
- Bounds$1.prototype.padBounds = function(a, b, c, d) {
7667
+ Bounds.prototype.padBounds = function(a, b, c, d) {
7640
7668
  this.xmin -= a;
7641
7669
  this.ymin -= b;
7642
7670
  this.xmax += c;
@@ -7647,7 +7675,7 @@
7647
7675
  // @param {number} pct Fraction of original extents
7648
7676
  // @param {number} pctY Optional amount to scale Y
7649
7677
  //
7650
- Bounds$1.prototype.scale = function(pct, pctY) { /*, focusX, focusY*/
7678
+ Bounds.prototype.scale = function(pct, pctY) { /*, focusX, focusY*/
7651
7679
  var halfWidth = (this.xmax - this.xmin) * 0.5;
7652
7680
  var halfHeight = (this.ymax - this.ymin) * 0.5;
7653
7681
  var kx = pct - 1;
@@ -7659,16 +7687,16 @@
7659
7687
  };
7660
7688
 
7661
7689
  // Return a bounding box with the same extent as this one.
7662
- Bounds$1.prototype.cloneBounds = // alias so child classes can override clone()
7663
- Bounds$1.prototype.clone = function() {
7664
- return new Bounds$1(this.xmin, this.ymin, this.xmax, this.ymax);
7690
+ Bounds.prototype.cloneBounds = // alias so child classes can override clone()
7691
+ Bounds.prototype.clone = function() {
7692
+ return new Bounds(this.xmin, this.ymin, this.xmax, this.ymax);
7665
7693
  };
7666
7694
 
7667
- Bounds$1.prototype.clearBounds = function() {
7668
- this.setBounds(new Bounds$1());
7695
+ Bounds.prototype.clearBounds = function() {
7696
+ this.setBounds(new Bounds());
7669
7697
  };
7670
7698
 
7671
- Bounds$1.prototype.mergePoint = function(x, y) {
7699
+ Bounds.prototype.mergePoint = function(x, y) {
7672
7700
  if (this.xmin === void 0) {
7673
7701
  this.setBounds(x, y, x, y);
7674
7702
  } else {
@@ -7683,7 +7711,7 @@
7683
7711
 
7684
7712
  // expands either x or y dimension to match @aspect (width/height ratio)
7685
7713
  // @focusX, @focusY (optional): expansion focus, as a fraction of width and height
7686
- Bounds$1.prototype.fillOut = function(aspect, focusX, focusY) {
7714
+ Bounds.prototype.fillOut = function(aspect, focusX, focusY) {
7687
7715
  if (arguments.length < 3) {
7688
7716
  focusX = 0.5;
7689
7717
  focusY = 0.5;
@@ -7706,7 +7734,7 @@
7706
7734
  return this;
7707
7735
  };
7708
7736
 
7709
- Bounds$1.prototype.update = function() {
7737
+ Bounds.prototype.update = function() {
7710
7738
  var tmp;
7711
7739
  if (this.xmin > this.xmax) {
7712
7740
  tmp = this.xmin;
@@ -7720,7 +7748,7 @@
7720
7748
  }
7721
7749
  };
7722
7750
 
7723
- Bounds$1.prototype.transform = function(t) {
7751
+ Bounds.prototype.transform = function(t) {
7724
7752
  this.xmin = this.xmin * t.mx + t.bx;
7725
7753
  this.xmax = this.xmax * t.mx + t.bx;
7726
7754
  this.ymin = this.ymin * t.my + t.by;
@@ -7732,7 +7760,7 @@
7732
7760
  // Returns a Transform object for mapping this onto Bounds @b2
7733
7761
  // @flipY (optional) Flip y-axis coords, for converting to/from pixel coords
7734
7762
  //
7735
- Bounds$1.prototype.getTransform = function(b2, flipY) {
7763
+ Bounds.prototype.getTransform = function(b2, flipY) {
7736
7764
  var t = new Transform();
7737
7765
  t.mx = b2.width() / this.width() || 1; // TODO: better handling of 0 w,h
7738
7766
  t.bx = b2.xmin - t.mx * this.xmin;
@@ -7746,14 +7774,14 @@
7746
7774
  return t;
7747
7775
  };
7748
7776
 
7749
- Bounds$1.prototype.mergeCircle = function(x, y, r) {
7777
+ Bounds.prototype.mergeCircle = function(x, y, r) {
7750
7778
  if (r < 0) r = -r;
7751
7779
  this.mergeBounds([x - r, y - r, x + r, y + r]);
7752
7780
  };
7753
7781
 
7754
- Bounds$1.prototype.mergeBounds = function(bb) {
7782
+ Bounds.prototype.mergeBounds = function(bb) {
7755
7783
  var a, b, c, d;
7756
- if (bb instanceof Bounds$1) {
7784
+ if (bb instanceof Bounds) {
7757
7785
  a = bb.xmin;
7758
7786
  b = bb.ymin;
7759
7787
  c = bb.xmax;
@@ -7770,7 +7798,7 @@
7770
7798
  c = bb[2];
7771
7799
  d = bb[3];
7772
7800
  } else {
7773
- error$1("Bounds#mergeBounds() invalid argument:", bb);
7801
+ error("Bounds#mergeBounds() invalid argument:", bb);
7774
7802
  }
7775
7803
 
7776
7804
  if (this.xmin === void 0) {
@@ -7885,8 +7913,8 @@
7885
7913
  return count;
7886
7914
  }
7887
7915
 
7888
- function getPathBounds(points) {
7889
- var bounds = new Bounds$1();
7916
+ function getPathBounds$1(points) {
7917
+ var bounds = new Bounds();
7890
7918
  for (var i=0, n=points.length; i<n; i++) {
7891
7919
  bounds.mergePoint(points[i][0], points[i][1]);
7892
7920
  }
@@ -7902,7 +7930,7 @@
7902
7930
  // @spherical (optional bool) calculate great circle length in meters
7903
7931
  return function(path, arcs, spherical) {
7904
7932
  if (spherical && arcs.isPlanar()) {
7905
- error$1("Expected lat-long coordinates");
7933
+ error("Expected lat-long coordinates");
7906
7934
  }
7907
7935
  calcLen = spherical ? greatCircleDistance : distance2D;
7908
7936
  len = 0;
@@ -7922,7 +7950,7 @@
7922
7950
  getAvgPathXY: getAvgPathXY,
7923
7951
  getMaxPath: getMaxPath,
7924
7952
  countVerticesInPath: countVerticesInPath,
7925
- getPathBounds: getPathBounds,
7953
+ getPathBounds: getPathBounds$1,
7926
7954
  get calcPathLen () { return calcPathLen; }
7927
7955
  });
7928
7956
 
@@ -8035,7 +8063,7 @@
8035
8063
  var flags = new Uint8Array(n);
8036
8064
  forEachArcId(shapes, function(id) {
8037
8065
  var absId = absArcId(id);
8038
- if (absId < n === false) error$1('index error');
8066
+ if (absId < n === false) error('index error');
8039
8067
  flags[absId] |= id < 0 ? 2 : 1;
8040
8068
  });
8041
8069
  return function(arcId) {
@@ -8067,8 +8095,8 @@
8067
8095
  });
8068
8096
  }
8069
8097
 
8070
- function getPathBounds$1(shapes, arcs) {
8071
- var bounds = new Bounds$1();
8098
+ function getPathBounds(shapes, arcs) {
8099
+ var bounds = new Bounds();
8072
8100
  forEachArcId(shapes, function(id) {
8073
8101
  arcs.mergeArcBounds(id, bounds);
8074
8102
  });
@@ -8136,13 +8164,13 @@
8136
8164
  item = arr[i];
8137
8165
  if (item instanceof Array) {
8138
8166
  forEachArcId(item, cb);
8139
- } else if (utils$1.isInteger(item)) {
8167
+ } else if (utils.isInteger(item)) {
8140
8168
  var val = cb(item);
8141
8169
  if (val !== void 0) {
8142
8170
  arr[i] = val;
8143
8171
  }
8144
8172
  } else if (item) {
8145
- error$1("Non-integer arc id in:", arr);
8173
+ error("Non-integer arc id in:", arr);
8146
8174
  }
8147
8175
  }
8148
8176
  }
@@ -8229,7 +8257,7 @@
8229
8257
  ids = shape[i];
8230
8258
  data.push({
8231
8259
  ids: ids,
8232
- area: type == 'polygon' ? geom$1.getPlanarPathArea(ids, arcs) : 0,
8260
+ area: type == 'polygon' ? geom.getPlanarPathArea(ids, arcs) : 0,
8233
8261
  bounds: arcs.getSimpleShapeBounds(ids)
8234
8262
  });
8235
8263
  }
@@ -8243,7 +8271,7 @@
8243
8271
  // removed on export.
8244
8272
  //
8245
8273
  var bb1 = arcs.getBounds(),
8246
- bb2 = new Bounds$1(0, 0, quanta-1, quanta-1),
8274
+ bb2 = new Bounds(0, 0, quanta-1, quanta-1),
8247
8275
  fw = bb1.getTransform(bb2),
8248
8276
  inv = fw.invert();
8249
8277
 
@@ -8287,7 +8315,7 @@
8287
8315
 
8288
8316
  function getSphericalShapeArea(shp, arcs) {
8289
8317
  if (arcs.isPlanar()) {
8290
- error$1("[getSphericalShapeArea()] Function requires decimal degree coordinates");
8318
+ error("[getSphericalShapeArea()] Function requires decimal degree coordinates");
8291
8319
  }
8292
8320
  return (shp || []).reduce(function(area, ids) {
8293
8321
  return area + getSphericalPathArea(ids, arcs);
@@ -8488,7 +8516,7 @@
8488
8516
 
8489
8517
  function getSphericalShapePerimeter(shp, arcs) {
8490
8518
  if (arcs.isPlanar()) {
8491
- error$1("[getSphericalShapePerimeter()] Function requires decimal degree coordinates");
8519
+ error("[getSphericalShapePerimeter()] Function requires decimal degree coordinates");
8492
8520
  }
8493
8521
  return (shp || []).reduce(function(len, ids) {
8494
8522
  return len + getSphericalPathPerimeter(ids, arcs);
@@ -8547,11 +8575,11 @@
8547
8575
 
8548
8576
  if (threshold > 0) {
8549
8577
  snapDist = threshold;
8550
- message$1(utils$1.format("Applying snapping threshold of %s -- %.6f times avg. segment length", threshold, threshold / avgDist));
8578
+ message(utils.format("Applying snapping threshold of %s -- %.6f times avg. segment length", threshold, threshold / avgDist));
8551
8579
  }
8552
8580
  var snapCount = snapCoordsByInterval(arcs, snapDist);
8553
8581
  if (snapCount > 0) arcs.dedupCoords();
8554
- message$1(utils$1.format("Snapped %s point%s", snapCount, utils$1.pluralSuffix(snapCount)));
8582
+ message(utils.format("Snapped %s point%s", snapCount, utils.pluralSuffix(snapCount)));
8555
8583
  }
8556
8584
 
8557
8585
  // Snap together points within a small threshold
@@ -8928,7 +8956,7 @@
8928
8956
  segmentHit: segmentHit
8929
8957
  });
8930
8958
 
8931
- var geom$1 = Object.assign({}, Geom, PolygonGeom, PathGeom, SegmentGeom, PolygonCentroid);
8959
+ var geom = Object.assign({}, Geom, PolygonGeom, PathGeom, SegmentGeom, PolygonCentroid);
8932
8960
 
8933
8961
  // Find ids of vertices with identical coordinates to x,y in an ArcCollection
8934
8962
  // Caveat: does not exclude vertices that are not visible at the
@@ -8975,7 +9003,7 @@
8975
9003
  }
8976
9004
 
8977
9005
  function findNearestVertex(x, y, shp, arcs, spherical) {
8978
- var calcLen = spherical ? geom$1.greatCircleDistance : geom$1.distance2D,
9006
+ var calcLen = spherical ? geom.greatCircleDistance : geom.distance2D,
8979
9007
  minLen = Infinity,
8980
9008
  minX, minY, dist, iter;
8981
9009
  for (var i=0; i<shp.length; i++) {
@@ -9240,7 +9268,7 @@
9240
9268
  var textNode;
9241
9269
  if (!dragging) return;
9242
9270
  if (e.id != activeId) {
9243
- error("Mismatched hit ids:", e.id, activeId);
9271
+ error$1("Mismatched hit ids:", e.id, activeId);
9244
9272
  }
9245
9273
  applyDelta(activeRecord, 'dx', e.dx / scale);
9246
9274
  applyDelta(activeRecord, 'dy', e.dy / scale);
@@ -9489,15 +9517,15 @@
9489
9517
  }
9490
9518
 
9491
9519
  function getDefaultStyle(lyr, baseStyle) {
9492
- var style = utils.extend({}, baseStyle);
9520
+ var style = utils$1.extend({}, baseStyle);
9493
9521
  // reduce the dot size of large point layers
9494
9522
  if (lyr.geometry_type == 'point' && style.dotSize > 0) {
9495
- style.dotSize *= getDotScale(lyr);
9523
+ style.dotSize *= getDotScale$1(lyr);
9496
9524
  }
9497
9525
  return style;
9498
9526
  }
9499
9527
 
9500
- function getDotScale(lyr) {
9528
+ function getDotScale$1(lyr) {
9501
9529
  var topTier = 50000;
9502
9530
  var n = countPoints(lyr.shapes, topTier + 2); // short-circuit point counting above top threshold
9503
9531
  var k = n < 200 && 4 || n < 2500 && 3 || n < 10000 && 2 || 1;
@@ -9555,7 +9583,7 @@
9555
9583
  var topId = o.id; // pinned id (if pinned) or hover id
9556
9584
  var topIdx = -1;
9557
9585
  var styler = function(o, i) {
9558
- utils.extend(o, i === topIdx ? topStyle: baseStyle);
9586
+ utils$1.extend(o, i === topIdx ? topStyle: baseStyle);
9559
9587
  };
9560
9588
  var baseStyle = getDefaultStyle(lyr, selectionStyles[geomType]);
9561
9589
  var topStyle;
@@ -9668,7 +9696,7 @@
9668
9696
  if (lyr.geometry_type == 'point') {
9669
9697
  return fields.indexOf('r') > -1; // require 'r' field for point symbols
9670
9698
  }
9671
- return utils.difference(fields, ['opacity', 'class']).length > 0;
9699
+ return utils$1.difference(fields, ['opacity', 'class']).length > 0;
9672
9700
  }
9673
9701
 
9674
9702
 
@@ -9748,7 +9776,7 @@
9748
9776
  // Get params for converting geographic coords to pixel coords
9749
9777
  this.getTransform = function(pixScale) {
9750
9778
  // get transform (y-flipped);
9751
- var viewBounds = new Bounds(0, 0, _position.width(), _position.height());
9779
+ var viewBounds = new Bounds$1(0, 0, _position.width(), _position.height());
9752
9780
  if (pixScale) {
9753
9781
  viewBounds.xmax *= pixScale;
9754
9782
  viewBounds.ymax *= pixScale;
@@ -9758,7 +9786,7 @@
9758
9786
 
9759
9787
  // k scales the size of the bbox (used by gui to control fp error when zoomed very far)
9760
9788
  this.getBounds = function(k) {
9761
- if (!_contentBounds) return new Bounds();
9789
+ if (!_contentBounds) return new Bounds$1();
9762
9790
  return calcBounds(_cx, _cy, _scale / (k || 1));
9763
9791
  };
9764
9792
 
@@ -9789,7 +9817,7 @@
9789
9817
 
9790
9818
  this.getSymbolScale = function() {
9791
9819
  if (!_frame) return 0;
9792
- var bounds = new Bounds(_frame.bbox);
9820
+ var bounds = new Bounds$1(_frame.bbox);
9793
9821
  var bounds2 = bounds.clone().transform(this.getTransform());
9794
9822
  return bounds2.width() / _frame.width;
9795
9823
  };
@@ -9824,7 +9852,7 @@
9824
9852
  }
9825
9853
 
9826
9854
  function maxAbs() {
9827
- return Math.max.apply(null, utils.toArray(arguments).map(Math.abs));
9855
+ return Math.max.apply(null, utils$1.toArray(arguments).map(Math.abs));
9828
9856
  }
9829
9857
 
9830
9858
  function limitScale(scale) {
@@ -9840,12 +9868,12 @@
9840
9868
  }
9841
9869
  w = bounds.width() / scale;
9842
9870
  h = bounds.height() / scale;
9843
- return new Bounds(cx - w/2, cy - h/2, cx + w/2, cy + h/2);
9871
+ return new Bounds$1(cx - w/2, cy - h/2, cx + w/2, cy + h/2);
9844
9872
  }
9845
9873
 
9846
9874
  // Calculate viewport bounds from frame data
9847
9875
  function fillOutFrameBounds(frame) {
9848
- var bounds = new Bounds(frame.bbox);
9876
+ var bounds = new Bounds$1(frame.bbox);
9849
9877
  var kx = _position.width() / frame.width;
9850
9878
  var ky = _position.height() / frame.height;
9851
9879
  bounds.scale(kx, ky);
@@ -9857,7 +9885,7 @@
9857
9885
  hpix = _position.height() - 2 * margin,
9858
9886
  xpad, ypad, b2;
9859
9887
  if (wpix <= 0 || hpix <= 0) {
9860
- return new Bounds(0, 0, 0, 0);
9888
+ return new Bounds$1(0, 0, 0, 0);
9861
9889
  }
9862
9890
  b = b.clone();
9863
9891
  b2 = b.clone();
@@ -9878,10 +9906,7 @@
9878
9906
  }
9879
9907
  }
9880
9908
 
9881
- utils.inherit(MapExtent, EventDispatcher);
9882
-
9883
- var MIN_ARC_LEN = 0.1;
9884
- var MIN_PATH_LEN = 0.1;
9909
+ utils$1.inherit(MapExtent, EventDispatcher);
9885
9910
 
9886
9911
  // TODO: consider moving this upstream
9887
9912
  function getArcsForRendering(obj, ext) {
@@ -9942,6 +9967,7 @@
9942
9967
 
9943
9968
  // Return a function for testing if an arc should be drawn in the current view
9944
9969
  function getArcFilter(arcs, ext, usedFlag, arcCounts) {
9970
+ var MIN_PATH_LEN = 0.1;
9945
9971
  var minPathLen = ext.getPixelSize() * MIN_PATH_LEN, // * 0.5
9946
9972
  geoBounds = ext.getBounds(),
9947
9973
  geoBBox = geoBounds.toArray(),
@@ -9965,7 +9991,7 @@
9965
9991
  // Return a function for testing if a shape should be drawn in the current view
9966
9992
  function getShapeFilter(arcs, ext) {
9967
9993
  var viewBounds = ext.getBounds();
9968
- var bounds = new Bounds();
9994
+ var bounds = new Bounds$1();
9969
9995
  if (ext.scale() < 1.1) return null; // full or almost-full zoom: no filter
9970
9996
  return function(shape) {
9971
9997
  bounds.empty();
@@ -10041,7 +10067,7 @@
10041
10067
  key = getStyleKey(style);
10042
10068
  if (key in styleIndex === false) {
10043
10069
  styleIndex[key] = {
10044
- style: utils.defaults({}, style),
10070
+ style: utils$1.defaults({}, style),
10045
10071
  shapes: []
10046
10072
  };
10047
10073
  }
@@ -10068,7 +10094,7 @@
10068
10094
 
10069
10095
  _self.drawSquareDots = function(shapes, style) {
10070
10096
  var t = getScaledTransform(_ext),
10071
- scaleRatio = getDotScale$1(_ext),
10097
+ scaleRatio = getDotScale(_ext),
10072
10098
  size = Math.round((style.dotSize || 1) * scaleRatio),
10073
10099
  styler = style.styler || null,
10074
10100
  xmax = _canvas.width + size,
@@ -10194,7 +10220,8 @@
10194
10220
  startPath(ctx, style);
10195
10221
  }
10196
10222
  iter = protectIterForDrawing(arcs.getArcIter(i), _ext);
10197
- drawPath(iter, t, ctx, MIN_ARC_LEN);
10223
+ // drawPath(iter, t, ctx, 0.1);
10224
+ drawPath2(iter, t, ctx, roundToHalfPix);
10198
10225
  }
10199
10226
  endPath(ctx, style);
10200
10227
  };
@@ -10232,7 +10259,7 @@
10232
10259
  }
10233
10260
 
10234
10261
 
10235
- function getDotScale$1(ext) {
10262
+ function getDotScale(ext) {
10236
10263
  var smallSide = Math.min(ext.width(), ext.height());
10237
10264
  // reduce size on smaller screens
10238
10265
  var j = smallSide < 200 && 0.5 || smallSide < 400 && 0.75 || 1;
@@ -10281,6 +10308,9 @@
10281
10308
  }
10282
10309
  }
10283
10310
 
10311
+ // Draw a path, but skip vertices within a given pixel threshold from the prev. vertex
10312
+ // This optimization introduces visible gaps between filled polygons unless the
10313
+ // threshold is much smaller than a pixel, so switching to drawPath2.
10284
10314
  function drawPath(vec, t, ctx, minLen) {
10285
10315
  // copy to local variables because of odd performance regression in Chrome 80
10286
10316
  var mx = t.mx,
@@ -10289,7 +10319,6 @@
10289
10319
  by = t.by;
10290
10320
  var x, y, xp, yp;
10291
10321
  if (!vec.hasNext()) return;
10292
- minLen = utils.isNonNegNumber(minLen) ? minLen : 0.4;
10293
10322
  x = xp = vec.x * mx + bx;
10294
10323
  y = yp = vec.y * my + by;
10295
10324
  ctx.moveTo(x, y);
@@ -10304,6 +10333,39 @@
10304
10333
  }
10305
10334
  }
10306
10335
 
10336
+
10337
+ // Draw a path, optimized by snapping pixel coordinates and skipping
10338
+ // duplicate coords.
10339
+ function drawPath2(vec, t, ctx, round) {
10340
+ // copy to local variables because of odd performance regression in Chrome 80
10341
+ var mx = t.mx,
10342
+ my = t.my,
10343
+ bx = t.bx,
10344
+ by = t.by;
10345
+ var x, y, xp, yp;
10346
+ if (!vec.hasNext()) return;
10347
+ x = xp = round(vec.x * mx + bx);
10348
+ y = yp = round(vec.y * my + by);
10349
+ ctx.moveTo(x, y);
10350
+ while (vec.hasNext()) {
10351
+ x = round(vec.x * mx + bx);
10352
+ y = round(vec.y * my + by);
10353
+ if (x != xp || y != yp) {
10354
+ ctx.lineTo(x, y);
10355
+ xp = x;
10356
+ yp = y;
10357
+ }
10358
+ }
10359
+ }
10360
+
10361
+ function roundToPix(x) {
10362
+ return x + 0.5 | 0;
10363
+ }
10364
+
10365
+ function roundToHalfPix(x) {
10366
+ return (x * 2 | 0) / 2;
10367
+ }
10368
+
10307
10369
  function getShapePencil(arcs, ext) {
10308
10370
  var t = getScaledTransform(ext);
10309
10371
  var iter = new internal.ShapeIter(arcs);
@@ -10311,7 +10373,8 @@
10311
10373
  for (var i=0, n=shp ? shp.length : 0; i<n; i++) {
10312
10374
  iter.init(shp[i]);
10313
10375
  // 0.2 trades visible seams for performance
10314
- drawPath(protectIterForDrawing(iter, ext), t, ctx, 0.2);
10376
+ // drawPath(protectIterForDrawing(iter, ext), t, ctx, 0.2);
10377
+ drawPath2(protectIterForDrawing(iter, ext), t, ctx, roundToPix);
10315
10378
  }
10316
10379
  };
10317
10380
  }
@@ -10478,7 +10541,7 @@
10478
10541
  var frame = ext.getFrame(); // frame should be set if we're rendering a furniture layer
10479
10542
  var obj = internal.getEmptyLayerForSVG(lyr, {});
10480
10543
  if (!frame) {
10481
- stop('Missing map frame data');
10544
+ stop$1('Missing map frame data');
10482
10545
  }
10483
10546
  obj.properties.transform = getSvgFurnitureTransform(ext);
10484
10547
  obj.properties.class = 'mapshaper-svg-furniture';
@@ -10506,7 +10569,7 @@
10506
10569
  var html = '';
10507
10570
  // generate a unique id so layer can be identified when symbols are repositioned
10508
10571
  // use it as a class name to avoid id collisions
10509
- var id = utils.getUniqueName();
10572
+ var id = utils$1.getUniqueName();
10510
10573
  var classNames = [id, 'mapshaper-svg-layer', 'mapshaper-' + type + '-layer'];
10511
10574
  g.setAttribute('class', classNames.join(' '));
10512
10575
  target.svg_id = id;
@@ -10957,7 +11020,7 @@
10957
11020
  }
10958
11021
 
10959
11022
  if (obj.tabular) {
10960
- utils.extend(obj, getDisplayLayerForTable(layer.data));
11023
+ utils$1.extend(obj, getDisplayLayerForTable(layer.data));
10961
11024
  }
10962
11025
 
10963
11026
  // dynamic reprojection (arcs were already reprojected above)
@@ -10980,7 +11043,7 @@
10980
11043
 
10981
11044
 
10982
11045
  function getDisplayBounds(lyr, arcs) {
10983
- var arcBounds = arcs ? arcs.getBounds() : new Bounds(),
11046
+ var arcBounds = arcs ? arcs.getBounds() : new Bounds$1(),
10984
11047
  bounds = arcBounds, // default display extent: all arcs in the dataset
10985
11048
  lyrBounds;
10986
11049
 
@@ -10998,7 +11061,7 @@
10998
11061
  }
10999
11062
 
11000
11063
  if (!bounds || !bounds.hasBounds()) { // empty layer
11001
- bounds = new Bounds();
11064
+ bounds = new Bounds$1();
11002
11065
  }
11003
11066
  return bounds;
11004
11067
  }
@@ -11015,7 +11078,7 @@
11015
11078
  return ids;
11016
11079
  }
11017
11080
 
11018
- utils.inherit(MshpMap, EventDispatcher);
11081
+ utils$1.inherit(MshpMap, EventDispatcher);
11019
11082
 
11020
11083
  function MshpMap(gui) {
11021
11084
  var opts = gui.options,
@@ -11105,7 +11168,7 @@
11105
11168
  this.setDisplayCRS = function(crs) {
11106
11169
  // TODO: update bounds of frame layer, if there is a frame layer
11107
11170
  var oldCRS = this.getDisplayCRS();
11108
- var newCRS = utils.isString(crs) ? internal.getCRS(crs) : crs;
11171
+ var newCRS = utils$1.isString(crs) ? internal.getCRS(crs) : crs;
11109
11172
  // TODO: handle case that old and new CRS are the same
11110
11173
  _dynamicCRS = newCRS;
11111
11174
  if (!_activeLyr) return; // stop here if no layers have been selected
@@ -11237,7 +11300,7 @@
11237
11300
  function updateOverlayLayer(e) {
11238
11301
  var style = getOverlayStyle(_activeLyr.layer, e);
11239
11302
  if (style) {
11240
- _overlayLyr = utils.defaults({
11303
+ _overlayLyr = utils$1.defaults({
11241
11304
  layer: filterLayerByIds(_activeLyr.layer, style.ids),
11242
11305
  style: style
11243
11306
  }, _activeLyr);
@@ -11273,12 +11336,12 @@
11273
11336
  var cy = viewBounds.centerY();
11274
11337
  rec.bbox = [cx - w/2, cy - h/2, cx + w/2, cy + h/2];
11275
11338
  _ext.setFrame(getFrameData());
11276
- _ext.setBounds(new Bounds(rec.bbox));
11339
+ _ext.setBounds(new Bounds$1(rec.bbox));
11277
11340
  _ext.reset();
11278
11341
  }
11279
11342
 
11280
11343
  function getFullBounds() {
11281
- var b = new Bounds();
11344
+ var b = new Bounds$1();
11282
11345
  var marginPct = 0.025;
11283
11346
  var pad = 1e-4;
11284
11347
  if (isPreviewView()) {
@@ -11402,7 +11465,7 @@
11402
11465
  // kludge to hide ghosted layers when reference layers are present
11403
11466
  // TODO: consider never showing ghosted layers (which appear after
11404
11467
  // commands like dissolve and filter).
11405
- mapLayer.style = utils.defaults({
11468
+ mapLayer.style = utils$1.defaults({
11406
11469
  strokeColors: [null, mapLayer.style.strokeColors[1]]
11407
11470
  }, mapLayer.style);
11408
11471
  }
@@ -11458,7 +11521,7 @@
11458
11521
 
11459
11522
  function GuiInstance(container, opts) {
11460
11523
  var gui = new ModeSwitcher();
11461
- opts = utils.extend({
11524
+ opts = utils$1.extend({
11462
11525
  // defaults
11463
11526
  homeControl: true,
11464
11527
  zoomControl: true,
@@ -11606,4 +11669,4 @@
11606
11669
  });
11607
11670
  };
11608
11671
 
11609
- }());
11672
+ })();