PageSourceSearch

https://mairie-savigny69.fr/typo3conf/ext/e_maps/Resources/Public/JavaScript/Leaflet/Omnivore.js?1790844362

js mairie-savigny69.fr collected 2026-10-02 16:47:45 UTC 103,220 bytes, 2,387 lines download raw bytes

1(function (f) { if (typeof exports === "object" && typeof module !== "undefined") { module.exports = f() } else if (typeof define === "function" && define.amd) { define([], f) } else { var g; if (typeof window !== "undefined") { g = window } else if (typeof global !== "undefined") { g = global } else if (typeof self !== "undefined") { g = self } else { g = this } g.omnivore = f() } })(function () {
2    var define, module, exports; return (function e(t, n, r) { function s(o, u) { if (!n[o]) { if (!t[o]) { var a = typeof require == "function" && require; if (!u && a) return a(o, !0); if (i) return i(o, !0); var f = new Error("Cannot find module '" + o + "'"); throw f.code = "MODULE_NOT_FOUND", f } var l = n[o] = { exports: {} }; t[o][0].call(l.exports, function (e) { var n = t[o][1][e]; return s(n ? n : e) }, l, l.exports, e, t, n, r) } return n[o].exports } var i = typeof require == "function" && require; for (var o = 0; o < r.length; o++)s(r[o]); return s })({
3        1: [function (require, module, exports) {
4            var xhr = require('corslite'),
5                csv2geojson = require('csv2geojson'),
6                wellknown = require('wellknown'),
7                polyline = require('polyline'),
8                topojson = require('topojson'),
9                toGeoJSON = require('togeojson');
10
11            module.exports.polyline = polylineLoad;
12            module.exports.polyline.parse = polylineParse;
13
14            module.exports.geojson = geojsonLoad;
15
16            module.exports.topojson = topojsonLoad;
17            module.exports.topojson.parse = topojsonParse;
18
19            module.exports.csv = csvLoad;
20            module.exports.csv.parse = csvParse;
21
22            module.exports.gpx = gpxLoad;
23            module.exports.gpx.parse = gpxParse;
24
25            module.exports.kml = kmlLoad;
26            module.exports.kml.parse = kmlParse;
27
28            module.exports.wkt = wktLoad;
29            module.exports.wkt.parse = wktParse;
30
31            function addData(l, d) {
32                if ('setGeoJSON' in l) {
33                    l.setGeoJSON(d);
34                } else if ('addData' in l) {
35                    l.addData(d);
36                }
37            }
38
39            /**
40             * Load a [GeoJSON](http://geojson.org/) document into a layer and return the layer.
41             *
42             * @param {string} url
43             * @param {object} options
44             * @param {object} customLayer
45             * @returns {object}
46             */
47            function geojsonLoad(url, options, customLayer) {
48                var layer = customLayer || L.geoJson();
49                xhr(url, function (err, response) {
50                    if (err) return layer.fire('error', { error: err });
51                    addData(layer, JSON.parse(response.responseText));
52                    layer.fire('ready');
53                });
54                return layer;
55            }
56
57            /**
58             * Load a [TopoJSON](https://github.com/mbostock/topojson) document into a layer and return the layer.
59             *
60             * @param {string} url
61             * @param {object} options
62             * @param {object} customLayer
63             * @returns {object}
64             */
65            function topojsonLoad(url, options, customLayer) {
66                var layer = customLayer || L.geoJson();
67                xhr(url, onload);
68                function onload(err, response) {
69                    if (err) return layer.fire('error', { error: err });
70                    topojsonParse(response.responseText, options, layer);
71                    layer.fire('ready');
72                }
73                return layer;
74            }
75
76            /**
77             * Load a CSV document into a layer and return the layer.
78             *
79             * @param {string} url
80             * @param {object} options
81             * @param {object} customLayer
82             * @returns {object}
83             */
84            function csvLoad(url, options, customLayer) {
85                var layer = customLayer || L.geoJson();
86                xhr(url, onload);
87                function onload(err, response) {
88                    var error;
89                    if (err) return layer.fire('error', { error: err });
90                    function avoidReady() {
91                        error = true;
92                    }
93                    layer.on('error', avoidReady);
94                    csvParse(response.responseText, options, layer);
95                    layer.off('error', avoidReady);
96                    if (!error) layer.fire('ready');
97                }
98                return layer;
99            }
100
101            /**
102             * Load a GPX document into a layer and return the layer.
103             *
104             * @param {string} url
105             * @param {object} options
106             * @param {object} customLayer
107             * @returns {object}
108             */
109            function gpxLoad(url, options, customLayer) {
110                var layer = customLayer || L.geoJson();
111                xhr(url, onload);
112                function onload(err, response) {
113                    var error;
114                    if (err) return layer.fire('error', { error: err });
115                    function avoidReady() {
116                        error = true;
117                    }
118                    layer.on('error', avoidReady);
119                    gpxParse(response.responseXML || response.responseText, options, layer);
120                    layer.off('error', avoidReady);
121                    if (!error) layer.fire('ready');
122                }
123                return layer;
124            }
125
126            /**
127             * Load a [KML](https://developers.google.com/kml/documentation/) document into a layer and return the layer.
128             *
129             * @param {string} url
130             * @param {object} options
131             * @param {object} customLayer
132             * @returns {object}
133             */
134            function kmlLoad(url, options, customLayer) {
135                var layer = customLayer || L.geoJson();
136                xhr(url, onload);
137                function onload(err, response) {
138                    var error;
139                    if (err) return layer.fire('error', { error: err });
140                    function avoidReady() {
141                        error = true;
142                    }
143                    layer.on('error', avoidReady);
144                    kmlParse(response.responseXML || response.responseText, options, layer);
145                    layer.off('error', avoidReady);
146                    if (!error) layer.fire('ready');
147                }
148                return layer;
149            }
150
151            /**
152             * Load a WKT (Well Known Text) string into a layer and return the layer
153             *
154             * @param {string} url
155             * @param {object} options
156             * @param {object} customLayer
157             * @returns {object}
158             */
159            function wktLoad(url, options, customLayer) {
160                var layer = customLayer || L.geoJson();
161                xhr(url, onload);
162                function onload(err, response) {
163                    if (err) return layer.fire('error', { error: err });
164                    wktParse(response.responseText, options, layer);
165                    layer.fire('ready');
166                }
167                return layer;
168            }
169
170            /**
171             * Load a polyline string into a layer and return the layer
172             *
173             * @param {string} url
174             * @param {object} options
175             * @param {object} customLayer
176             * @returns {object}
177             */
178            function polylineLoad(url, options, customLayer) {
179                var layer = customLayer || L.geoJson();
180                xhr(url, onload);
181                function onload(err, response) {
182                    if (err) return layer.fire('error', { error: err });
183                    polylineParse(response.responseText, options, layer);
184                    layer.fire('ready');
185                }
186                return layer;
187            }
188
189            function topojsonParse(data, options, layer) {
190                var o = typeof data === 'string' ?
191                    JSON.parse(data) : data;
192                layer = layer || L.geoJson();
193                for (var i in o.objects) {
194                    var ft = topojson.feature(o, o.objects[i]);
195                    if (ft.features) addData(layer, ft.features);
196                    else addData(layer, ft);
197                }
198                return layer;
199            }
200
201            function csvParse(csv, options, layer) {
202                layer = layer || L.geoJson();
203                options = options || {};
204                csv2geojson.csv2geojson(csv, options, onparse);
205                function onparse(err, geojson) {
206                    if (err) return layer.fire('error', { error: err });
207                    addData(layer, geojson);
208                }
209                return layer;
210            }
211
212            function gpxParse(gpx, options, layer) {
213                var xml = parseXML(gpx);
214                if (!xml) return layer.fire('error', {
215                    error: 'Could not parse GPX'
216                });
217                layer = layer || L.geoJson();
218                var geojson = toGeoJSON.gpx(xml);
219                addData(layer, geojson);
220                return layer;
221            }
222
223
224            function kmlParse(gpx, options, layer) {
225                var xml = parseXML(gpx);
226                if (!xml) return layer.fire('error', {
227                    error: 'Could not parse KML'
228                });
229                layer = layer || L.geoJson();
230                var geojson = toGeoJSON.kml(xml);
231                addData(layer, geojson);
232                return layer;
233            }
234
235            function polylineParse(txt, options, layer) {
236                layer = layer || L.geoJson();
237                options = options || {};
238                var coords = polyline.decode(txt, options.precision);
239                var geojson = { type: 'LineString', coordinates: [] };
240                for (var i = 0; i < coords.length; i++) {
241                    // polyline returns coords in lat, lng order, so flip for geojson
242                    geojson.coordinates[i] = [coords[i][1], coords[i][0]];
243                }
244                addData(layer, geojson);
245                return layer;
246            }
247
248            function wktParse(wkt, options, layer) {
249                layer = layer || L.geoJson();
250                var geojson = wellknown(wkt);
251                addData(layer, geojson);
252                return layer;
253            }
254
255            function parseXML(str) {
256                if (typeof str === 'string') {
257                    return (new DOMParser()).parseFromString(str, 'text/xml');
258                } else {
259                    return str;
260                }
261            }
262
263        }, { "corslite": 4, "csv2geojson": 5, "polyline": 8, "togeojson": 9, "topojson": 10, "wellknown": 11 }], 2: [function (require, module, exports) {
264
265        }, {}], 3: [function (require, module, exports) {
266            // shim for using process in browser
267            var process = module.exports = {};
268
269            // cached from whatever global is present so that test runners that stub it
270            // don't break things.  But we need to wrap it in a try catch in case it is
271            // wrapped in strict mode code which doesn't define any globals.  It's inside a
272            // function because try/catches deoptimize in certain engines.
273
274            var cachedSetTimeout;
275            var cachedClearTimeout;
276
277            function defaultSetTimout() {
278                throw new Error('setTimeout has not been defined');
279            }
280            function defaultClearTimeout() {
281                throw new Error('clearTimeout has not been defined');
282            }
283            (function () {
284                try {
285                    if (typeof setTimeout === 'function') {
286                        cachedSetTimeout = setTimeout;
287                    } else {
288                        cachedSetTimeout = defaultSetTimout;
289                    }
290                } catch (e) {
291                    cachedSetTimeout = defaultSetTimout;
292                }
293                try {
294                    if (typeof clearTimeout === 'function') {
295                        cachedClearTimeout = clearTimeout;
296                    } else {
297                        cachedClearTimeout = defaultClearTimeout;
298                    }
299                } catch (e) {
300                    cachedClearTimeout = defaultClearTimeout;
301                }
302            }())
303            function runTimeout(fun) {
304                if (cachedSetTimeout === setTimeout) {
305                    //normal enviroments in sane situations
306                    return setTimeout(fun, 0);
307                }
308                // if setTimeout wasn't available but was latter defined
309                if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
310                    cachedSetTimeout = setTimeout;
311                    return setTimeout(fun, 0);
312                }
313                try {
314                    // when when somebody has screwed with setTimeout but no I.E. maddness
315                    return cachedSetTimeout(fun, 0);
316                } catch (e) {
317                    try {
318                        // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
319                        return cachedSetTimeout.call(null, fun, 0);
320                    } catch (e) {
321                        // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
322                        return cachedSetTimeout.call(this, fun, 0);
323                    }
324                }
325
326
327            }
328            function runClearTimeout(marker) {
329                if (cachedClearTimeout === clearTimeout) {
330                    //normal enviroments in sane situations
331                    return clearTimeout(marker);
332                }
333                // if clearTimeout wasn't available but was latter defined
334                if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
335                    cachedClearTimeout = clearTimeout;
336                    return clearTimeout(marker);
337                }
338                try {
339                    // when when somebody has screwed with setTimeout but no I.E. maddness
340                    return cachedClearTimeout(marker);
341                } catch (e) {
342                    try {
343                        // When we are in I.E. but the script has been evaled so I.E. doesn't  trust the global object when called normally
344                        return cachedClearTimeout.call(null, marker);
345                    } catch (e) {
346                        // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
347                        // Some versions of I.E. have different rules for clearTimeout vs setTimeout
348                        return cachedClearTimeout.call(this, marker);
349                    }
350                }
351
352
353
354            }
355            var queue = [];
356            var draining = false;
357            var currentQueue;
358            var queueIndex = -1;
359
360            function cleanUpNextTick() {
361                if (!draining || !currentQueue) {
362                    return;
363                }
364                draining = false;
365                if (currentQueue.length) {
366                    queue = currentQueue.concat(queue);
367                } else {
368                    queueIndex = -1;
369                }
370                if (queue.length) {
371                    drainQueue();
372                }
373            }
374
375            function drainQueue() {
376                if (draining) {
377                    return;
378                }
379                var timeout = runTimeout(cleanUpNextTick);
380                draining = true;
381
382                var len = queue.length;
383                while (len) {
384                    currentQueue = queue;
385                    queue = [];
386                    while (++queueIndex < len) {
387                        if (currentQueue) {
388                            currentQueue[queueIndex].run();
389                        }
390                    }
391                    queueIndex = -1;
392                    len = queue.length;
393                }
394                currentQueue = null;
395                draining = false;
396                runClearTimeout(timeout);
397            }
398
399            process.nextTick = function (fun) {
400                var args = new Array(arguments.length - 1);
401                if (arguments.length > 1) {
402                    for (var i = 1; i < arguments.length; i++) {
403                        args[i - 1] = arguments[i];
404                    }
405                }
406                queue.push(new Item(fun, args));
407                if (queue.length === 1 && !draining) {
408                    runTimeout(drainQueue);
409                }
410            };
411
412            // v8 likes predictible objects
413            function Item(fun, array) {
414                this.fun = fun;
415                this.array = array;
416            }
417            Item.prototype.run = function () {
418                this.fun.apply(null, this.array);
419            };
420            process.title = 'browser';
421            process.browser = true;
422            process.env = {};
423            process.argv = [];
424            process.version = ''; // empty string to avoid regexp issues
425            process.versions = {};
426
427            function noop() { }
428
429            process.on = noop;
430            process.addListener = noop;
431            process.once = noop;
432            process.off = noop;
433            process.removeListener = noop;
434            process.removeAllListeners = noop;
435            process.emit = noop;
436
437            process.binding = function (name) {
438                throw new Error('process.binding is not supported');
439            };
440
441            process.cwd = function () { return '/' };
442            process.chdir = function (dir) {
443                throw new Error('process.chdir is not supported');
444            };
445            process.umask = function () { return 0; };
446
447        }, {}], 4: [function (require, module, exports) {
448            function corslite(url, callback, cors) {
449                var sent = false;
450
451                if (typeof window.XMLHttpRequest === 'undefined') {
452                    return callback(Error('Browser not supported'));
453                }
454
455                if (typeof cors === 'undefined') {
456                    var m = url.match(/^\s*https?:\/\/[^\/]*/);
457                    cors = m && (m[0] !== location.protocol + '//' + location.hostname +
458                        (location.port ? ':' + location.port : ''));
459                }
460
461                var x = new window.XMLHttpRequest();
462
463                function isSuccessful(status) {
464                    return status >= 200 && status < 300 || status === 304;
465                }
466
467                if (cors && !('withCredentials' in x)) {
468                    // IE8-9
469                    x = new window.XDomainRequest();
470
471                    // Ensure callback is never called synchronously, i.e., before
472                    // x.send() returns (this has been observed in the wild).
473                    // See https://github.com/mapbox/mapbox.js/issues/472
474                    var original = callback;
475                    callback = function () {
476                        if (sent) {
477                            original.apply(this, arguments);
478                        } else {
479                            var that = this, args = arguments;
480                            setTimeout(function () {
481                                original.apply(that, args);
482                            }, 0);
483                        }
484                    }
485                }
486
487                function loaded() {
488                    if (
489                        // XDomainRequest
490                        x.status === undefined ||
491                        // modern browsers
492                        isSuccessful(x.status)) callback.call(x, null, x);
493                    else callback.call(x, x, null);
494                }
495
496                // Both `onreadystatechange` and `onload` can fire. `onreadystatechange`
497                // has [been supported for longer](http://stackoverflow.com/a/9181508/229001).
498                if ('onload' in x) {
499                    x.onload = loaded;
500                } else {
501                    x.onreadystatechange = function readystate() {
502                        if (x.readyState === 4) {
503                            loaded();
504                        }
505                    };
506                }
507
508                // Call the callback with the XMLHttpRequest object as an error and prevent
509                // it from ever being called again by reassigning it to `noop`
510                x.onerror = function error(evt) {
511                    // XDomainRequest provides no evt parameter
512                    callback.call(this, evt || true, null);
513                    callback = function () { };
514                };
515
516                // IE9 must have onprogress be set to a unique function.
517                x.onprogress = function () { };
518
519                x.ontimeout = function (evt) {
520                    callback.call(this, evt, null);
521                    callback = function () { };
522                };
523
524                x.onabort = function (evt) {
525                    callback.call(this, evt, null);
526                    callback = function () { };
527                };
528
529                // GET is the only supported HTTP Verb by XDomainRequest and is the
530                // only one supported here.
531                x.open('GET', url, true);
532
533                // Send the request. Sending data is not supported.
534                x.send(null);
535                sent = true;
536
537                return x;
538            }
539
540            if (typeof module !== 'undefined') module.exports = corslite;
541
542        }, {}
542], 5: [function (require, module, exports) {
543            'use strict';
544
545            var dsv = require('d3-dsv'),
546                sexagesimal = require('sexagesimal');
547
548            var latRegex = /(Lat)(itude)?/gi,
549                lonRegex = /(L)(on|ng)(gitude)?/i;
550
551            function guessHeader(row, regexp) {
552                var name, match, score;
553                for (var f in row) {
554                    match = f.match(regexp);
555                    if (match && (!name || match[0].length / f.length > score)) {
556                        score = match[0].length / f.length;
557                        name = f;
558                    }
559                }
560                return name;
561            }
562
563            function guessLatHeader(row) { return guessHeader(row, latRegex); }
564            function guessLonHeader(row) { return guessHeader(row, lonRegex); }
565
566            function isLat(f) { return !!f.match(latRegex); }
567            function isLon(f) { return !!f.match(lonRegex); }
568
569            function keyCount(o) {
570                return (typeof o == 'object') ? Object.keys(o).length : 0;
571            }
572
573            function autoDelimiter(x) {
574                var delimiters = [',', ';', '\t', '|'];
575                var results = [];
576
577                delimiters.forEach(function (delimiter) {
578                    var res = dsv.dsvFormat(delimiter).parse(x);
579                    if (res.length >= 1) {
580                        var count = keyCount(res[0]);
581                        for (var i = 0; i < res.length; i++) {
582                            if (keyCount(res[i]) !== count) return;
583                        }
584                        results.push({
585                            delimiter: delimiter,
586                            arity: Object.keys(res[0]).length,
587                        });
588                    }
589                });
590
591                if (results.length) {
592                    return results.sort(function (a, b) {
593                        return b.arity - a.arity;
594                    })[0].delimiter;
595                } else {
596                    return null;
597                }
598            }
599
600            /**
601             * Silly stopgap for dsv to d3-dsv upgrade
602             *
603             * @param {Array} x dsv output
604             * @returns {Array} array without columns member
605             */
606            function deleteColumns(x) {
607                delete x.columns;
608                return x;
609            }
610
611            function auto(x) {
612                var delimiter = autoDelimiter(x);
613                if (!delimiter) return null;
614                return deleteColumns(dsv.dsvFormat(delimiter).parse(x));
615            }
616
617            function csv2geojson(x, options, callback) {
618
619                if (!callback) {
620                    callback = options;
621                    options = {};
622                }
623
624                options.delimiter = options.delimiter || ',';
625
626                var latfield = options.latfield || '',
627                    lonfield = options.lonfield || '',
628                    crs = options.crs || '';
629
630                var features = [],
631                    featurecollection = { type: 'FeatureCollection', features: features };
632
633                if (crs !== '') {
634                    featurecollection.crs = { type: 'name', properties: { name: crs } };
635                }
636
637                if (options.delimiter === 'auto' && typeof x == 'string') {
638                    options.delimiter = autoDelimiter(x);
639                    if (!options.delimiter) {
640                        callback({
641                            type: 'Error',
642                            message: 'Could not autodetect delimiter'
643                        });
644                        return;
645                    }
646                }
647
648                var parsed = (typeof x == 'string') ?
649                    dsv.dsvFormat(options.delimiter).parse(x) : x;
650
651                if (!parsed.length) {
652                    callback(null, featurecollection);
653                    return;
654                }
655
656                var errors = [];
657                var i;
658
659
660                if (!latfield) latfield = guessLatHeader(parsed[0]);
661                if (!lonfield) lonfield = guessLonHeader(parsed[0]);
662                var noGeometry = (!latfield || !lonfield);
663
664                if (noGeometry) {
665                    for (i = 0; i < parsed.length; i++) {
666                        features.push({
667                            type: 'Feature',
668                            properties: parsed[i],
669                            geometry: null
670                        });
671                    }
672                    callback(errors.length ? errors : null, featurecollection);
673                    return;
674                }
675
676                for (i = 0; i < parsed.length; i++) {
677                    if (parsed[i][lonfield] !== undefined &&
678                        parsed[i][latfield] !== undefined) {
679
680                        var lonk = parsed[i][lonfield],
681                            latk = parsed[i][latfield],
682                            lonf, latf,
683                            a;
684
685                        a = sexagesimal(lonk, 'EW');
686                        if (a) lonk = a;
687                        a = sexagesimal(latk, 'NS');
688                        if (a) latk = a;
689
690                        lonf = parseFloat(lonk);
691                        latf = parseFloat(latk);
692
693                        if (isNaN(lonf) ||
694                            isNaN(latf)) {
695                            errors.push({
696                                message: 'A row contained an invali
696d value for latitude or longitude',
697                                row: parsed[i],
698                                index: i
699                            });
700                        } else {
701                            if (!options.includeLatLon) {
702                                delete parsed[i][lonfield];
703                                delete parsed[i][latfield];
704                            }
705
706                            features.push({
707                                type: 'Feature',
708                                properties: parsed[i],
709                                geometry: {
710                                    type: 'Point',
711                                    coordinates: [
712                                        parseFloat(lonf),
713                                        parseFloat(latf)
714                                    ]
715                                }
716                            });
717                        }
718                    }
719                }
720
721                callback(errors.length ? errors : null, featurecollection);
722            }
723
724            function toLine(gj) {
725                var features = gj.features;
726                var line = {
727                    type: 'Feature',
728                    geometry: {
729                        type: 'LineString',
730                        coordinates: []
731                    }
732                };
733                for (var i = 0; i < features.length; i++) {
734                    line.geometry.coordinates.push(features[i].geometry.coordinates);
735                }
736                line.properties = features.reduce(function (aggregatedProperties, newFeature) {
737                    for (var key in newFeature.properties) {
738                        if (!aggregatedProperties[key]) {
739                            aggregatedProperties[key] = [];
740                        }
741                        aggregatedProperties[key].push(newFeature.properties[key]);
742                    }
743                    return aggregatedProperties;
744                }, {});
745                return {
746                    type: 'FeatureCollection',
747                    features: [line]
748                };
749            }
750
751            function toPolygon(gj) {
752                var features = gj.features;
753                var poly = {
754                    type: 'Feature',
755                    geometry: {
756                        type: 'Polygon',
757                        coordinates: [[]]
758                    }
759                };
760                for (var i = 0; i < features.length; i++) {
761                    poly.geometry.coordinates[0].push(features[i].geometry.coordinates);
762                }
763                poly.properties = features.reduce(function (aggregatedProperties, newFeature) {
764                    for (var key in newFeature.properties) {
765                        if (!aggregatedProperties[key]) {
766                            aggregatedProperties[key] = [];
767                        }
768                        aggregatedProperties[key].push(newFeature.properties[key]);
769                    }
770                    return aggregatedProperties;
771                }, {});
772                return {
773                    type: 'FeatureCollection',
774                    features: [poly]
775                };
776            }
777
778            module.exports = {
779                isLon: isLon,
780                isLat: isLat,
781                guessLatHeader: guessLatHeader,
782                guessLonHeader: guessLonHeader,
783                csv: dsv.csvParse,
784                tsv: dsv.tsvParse,
785                dsv: dsv,
786                auto: auto,
787                csv2geojson: csv2geojson,
788                toLine: toLine,
789                toPolygon: toPolygon
790            };
791
792        }, { "d3-dsv": 6, "sexagesimal": 7 }], 6: [function (require, module, exports) {
793            // https://d3js.org/d3-dsv/ Version 1.0.1. Copyright 2016 Mike Bostock.
794            (function (global, factory) {
795                typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
796                    typeof define === 'function' && define.amd ? define(['exports'], factory) :
797                        (factory((global.d3 = global.d3 || {})));
798            }(this, function (exports) {
799                'use strict';
800
801                function objectConverter(columns) {
802                    return new Function("d", "return {" + columns.map(function (name, i) {
803                        return JSON.stringify(name) + ": d[" + i + "]";
804                    }).join(",") + "}");
805                }
806
807                function customConverter(columns, f) {
808                    var object = objectConverter(columns);
809                    return function (row, i) {
810                        return f(object(row), i, columns);
811                    };
812                }
813
814                // Compute unique columns in order of discovery.
815                function inferColumns(rows) {
816                    var columnSet = Object.create(null),
817                        columns = [];
818
819                    rows.forEach(function (row) {
820                        for (var column in row) {
821                            if (!(column in columnSet)) {
822                                columns.push(columnSet[column] = column);
823                            }
824                        }
825                    });
826
827                    return columns;
828                }
829
830                function dsv(delimiter) {
831                    var reFormat = new RegExp("[\"" + delimiter + "\n]"),
832                        delimiterCode = delimiter.charCodeAt(0);
833
834                    function parse(text, f) {
835                        var convert, columns, rows = parseRows(text, function (row, i) {
836                            if (convert) return convert(row, i - 1);
837                            columns = row, convert = f ? customConverter(row, f) : objectConverter(row);
838                        });
839                        rows.columns = columns;
840                        return rows;
841                    }
842
843                    function parseRows(text, f) {
844                        var EOL = {}, // sentinel value for end-of-line
845                            EOF = {}, // sentinel value for end-of-file
846                            rows = [], // output rows
847                            N = text.length,
848                            I = 0, // current character index
849                            n = 0, // the current line number
850                            t, // the current token
851                            eol; // is the current token followed by EOL?
852
853                        function token() {
854                            if (I >= N) return EOF; // special case: end of file
855                            if (eol) return eol = false, EOL; // special case: end of line
856
857                            // special case: quotes
858                            var j = I, c;
859                            if (text.charCodeAt(j) === 34) {
860                                var i = j;
861                                while (i++ < N) {
862                                    if (text.charCodeAt(i) === 34) {
863                                        if (text.charCodeAt(i + 1) !== 34) break;
864                                        ++i;
865                                    }
866                                }
867                                I = i + 2;
868                                c = text.charCodeAt(i + 1);
869                                if (c === 13) {
870                                    eol = true;
871                                    if (text.charCodeAt(i + 2) === 10) ++I;
872                                } else if (c === 10) {
873                                    eol = true;
874                                }
875                                return text.slice(j + 1, i).replace(/""/g, "\"");
876                            }
877
878                            // common case: find next delimiter or newline
879                            while (I < N) {
880                                var k = 1;
881                                c = text.charCodeAt(I++);
882                                if (c === 10) eol = true; // \n
883                                else if (c === 13) { eol = true; if (text.charCodeAt(I) === 10) ++I, ++k; } // \r|\r\n
884                                else if (c !== delimiterCode) continue;
885                                return text.slice(j, I - k);
886                            }
887
888                            // special case: last token before EOF
889                            return text.slice(j);
890                        }
891
892                        while ((t = token()) !== EOF) {
893                            var a = [];
894                            while (t !== EOL && t !== EOF) {
895                                a.push(t);
896                                t = token();
897                            }
898                            if (f && (a = f(a, n++)) == null) continue;
899                            rows.push(a);
900                        }
901
902                        return rows;
903                    }
904
905                    function format(rows, columns) {
906                        if (columns == null) columns = inferColumns(rows);
907                        return [columns.map(formatValue).join(delimiter)].concat(rows.map(function (row) {
908                            return columns.map(function (column) {
909                                return formatValue(row[column]);
910                            }).join(delimiter);
911                        })).join("\n");
912                    }
913
914                    function formatRows(rows) {
915                        return rows.map(formatRow).join("\n");
916                    }
917
918                    function formatRow(row) {
919                        return row.map(formatValue).join(delimiter);
920                    }
921
922                    function formatValue(text) {
923                        return text == null ? ""
924                            : reFormat.test(text += "") ? "\"" + text.replace(/\"/g, "\"\"") + "\""
925                                : text;
926                    }
927
928                    return {
929                        parse: parse,
930                        parseRows: parseRows,
931                        format: format,
932                        formatRows: formatRows
933                    };
934                }
935
936                var csv = dsv(",");
937
938                var csvParse = csv.parse;
939                var csvParseRows = csv.parseRows;
940                var csvFormat = csv.format;
941                var csvFormatRows = csv.formatRows;
942
943                var tsv = dsv("\t");
944
945                var tsvParse = tsv.parse;
946                var tsvParseRows = tsv.parseRows;
947                var tsvFormat = tsv.format;
948                var tsvFormatRows = tsv.formatRows;
949
950                exports.dsvFormat = dsv;
951                exports.csvParse = csvParse;
952                exports.csvParseRows = csvParseRows;
953                exports.csvFormat = csvFormat;
954                exports.csvFormatRows = csvFormatRows;
955                exports.tsvParse = tsvParse;
956                exports.tsvParseRows = tsvParseRows;
957                exports.tsvFormat = tsvFormat;
958                exports.tsvFormatRows = tsvFormatRows;
959
960                Object.defineProperty(exports, '__esModule', { value: true });
961
962            }));
963        }, {}
963], 7: [function (require, module, exports) {
964            module.exports = element;
965            module.exports.pair = pair;
966            module.exports.format = format;
967            module.exports.formatPair = formatPair;
968            module.exports.coordToDMS = coordToDMS;
969
970            function element(x, dims) {
971                return search(x, dims).val;
972            }
973
974            function formatPair(x) {
975                return format(x.lat, 'lat') + ' ' + format(x.lon, 'lon');
976            }
977
978            // Is 0 North or South?
979            function format(x, dim) {
980                var dms = coordToDMS(x, dim);
981                return dms.whole + '° ' +
982                    (dms.minutes ? dms.minutes + '\' ' : '') +
983                    (dms.seconds ? dms.seconds + '" ' : '') + dms.dir;
984            }
985
986            function coordToDMS(x, dim) {
987                var dirs = {
988                    lat: ['N', 'S'],
989                    lon: ['E', 'W']
990                }[dim] || '',
991                    dir = dirs[x >= 0 ? 0 : 1],
992                    abs = Math.abs(x),
993                    whole = Math.floor(abs),
994                    fraction = abs - whole,
995                    fractionMinutes = fraction * 60,
996                    minutes = Math.floor(fractionMinutes),
997                    seconds = Math.floor((fractionMinutes - minutes) * 60);
998
999                return {
1000                    whole: whole,
1001                    minutes: minutes,
1002                    seconds: seconds,
1003                    dir: dir
1004                };
1005            }
1006
1007            function search(x, dims, r) {
1008                if (!dims) dims = 'NSEW';
1009                if (typeof x !== 'string') return { val: null, regex: r };
1010                r = r || /[\s\,]*([\-|\—|\―]?[0-9.]+)°? *(?:([0-9.]+)['’′‘] *)?(?:([0-9.]+)(?:''|"|”|″) *)?([NSEW])?/gi;
1011                var m = r.exec(x);
1012                if (!m) return { val: null, regex: r };
1013                else if (m[4] && dims.indexOf(m[4]) === -1) return { val: null, regex: r };
1014                else return {
1015                    val: (((m[1]) ? parseFloat(m[1]) : 0) +
1016                        ((m[2] ? parseFloat(m[2]) / 60 : 0)) +
1017                        ((m[3] ? parseFloat(m[3]) / 3600 : 0))) *
1018                        ((m[4] && m[4] === 'S' || m[4] === 'W') ? -1 : 1),
1019                    regex: r,
1020                    raw: m[0],
1021                    dim: m[4]
1022                };
1023            }
1024
1025            function pair(x, dims) {
1026                x = x.trim();
1027                var one = search(x, dims);
1028                if (one.val === null) return null;
1029                var two = search(x, dims, one.regex);
1030                if (two.val === null) return null;
1031                // null if one/two are not contiguous.
1032                if (one.raw + two.raw !== x) return null;
1033                if (one.dim) {
1034                    return swapdim(one.val, two.val, one.dim);
1035                } else {
1036                    return [one.val, two.val];
1037                }
1038            }
1039
1040            function swapdim(a, b, dim) {
1041                if (dim === 'N' || dim === 'S') return [a, b];
1042                if (dim === 'W' || dim === 'E') return [b, a];
1043            }
1044
1045        }, {}], 8: [function (require, module, exports) {
1046            'use strict';
1047
1048            /**
1049             * Based off of [the offical Google document](https://developers.google.com/maps/documentation/utilities/polylinealgorithm)
1050             *
1051             * Some parts from [this implementation](http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/PolylineEncoder.js)
1052             * by [Mark McClure](http://facstaff.unca.edu/mcmcclur/)
1053             *
1054             * @module polyline
1055             */
1056
1057            var polyline = {};
1058
1059            function encode(coordinate, factor) {
1060                coordinate = Math.round(coordinate * factor);
1061                coordinate <<= 1;
1062                if (coordinate < 0) {
1063                    coordinate = ~coordinate;
1064                }
1065                var output = '';
1066                while (coordinate >= 0x20) {
1067                    output += String.fromCharCode((0x20 | (coordinate & 0x1f)) + 63);
1068                    coordinate >>= 5;
1069                }
1070                output += String.fromCharCode(coordinate + 63);
1071                return output;
1072            }
1073
1074            /**
1075             * Decodes to a [latitude, longitude] coordinates array.
1076             *
1077             * This is adapted from the implementation in Project-OSRM.
1078             *
1079             * @param {String} str
1080             * @param {Number} precision
1081             * @returns {Array}
1082             *
1083             * @see https://github.com/Project-OSRM/osrm-frontend/blob/master/WebContent/routing/OSRM.RoutingGeometry.js
1084             */
1085            polyline.decode = function (str, precision) {
1086                var index = 0,
1087                    lat = 0,
1088                    lng = 0,
1089                    coordinates = [],
1090                    shift = 0,
1091                    result = 0,
1092                    byte = null,
1093                    latitude_change,
1094                    longitude_change,
1095                    factor = Math.pow(10, precision || 5);
1096
1097                // Coordinates have variable length when encoded, so just keep
1098                // track of whether we've hit the end of the string. In each
1099                // loop iteration, a single coordinate is decoded.
1100                while (index < str.length) {
1101
1102                    // Reset shift, result, and byte
1103                    byte = null;
1104                    shift = 0;
1105                    result = 0;
1106
1107                    do {
1108                        byte = str.charCodeAt(index++) - 63;
1109                        result |= (byte & 0x1f) << shift;
1110                        shift += 5;
1111                    } while (byte >= 0x20);
1112
1113                    latitude_change = ((result & 1) ? ~(result >> 1) : (result >> 1));
1114
1115                    shift = result = 0;
1116
1117                    do {
1118                        byte = str.charCodeAt(index++) - 63;
1119                        result |= (byte & 0x1f) << shift;
1120                        shift += 5;
1121                    } while (byte >= 0x20);
1122
1123                    longitude_change = ((result & 1) ? ~(result >> 1) : (result >> 1));
1124
1125                    lat += latitude_change;
1126                    lng += longitude_change;
1127
1128                    coordinates.push([lat / factor, lng / factor]);
1129                }
1130
1131                return coordinates;
1132            };
1133
1134            /**
1135             * Encodes the given [latitude, longitude] coordinates array.
1136             *
1137             * @param {Array.<Array.<Number>>} coordinates
1138             * @param {Number} precision
1139             * @returns {String}
1140             */
1141            polyline.encode = function (coordinates, precision) {
1142                if (!coordinates.length) { return ''; }
1143
1144                var factor = Math.pow(10, precision || 5),
1145                    output = encode(coordinates[0][0], factor) + encode(coordinates[0][1], factor);
1146
1147                for (var i = 1; i < coordinates.length; i++) {
1148                    var a = coordinates[i], b = coordinates[i - 1];
1149                    output += encode(a[0] - b[0], factor);
1150                    output += encode(a[1] - b[1], factor);
1151                }
1152
1153                return output;
1154            };
1155
1156            function flipped(coords) {
1157                var flipped = [];
1158                for (var i = 0; i < coords.length; i++) {
1159                    flipped.push(coords[i].slice().reverse());
1160                }
1161                return flipped;
1162            }
1163
1164            /**
1165             * Encodes a GeoJSON LineString feature/geometry.
1166             *
1167             * @param {Object} geojson
1168             * @param {Number} precision
1169             * @returns {String}
1170             */
1171            polyline.fromGeoJSON = function (geojson, precision) {
1172                if (geojson && geojson.type === 'Feature') {
1173                    geojson = geojson.geometry;
1174                }
1175                if (!geojson || geojson.type !== 'LineString') {
1176                    throw new Error('Input must be a GeoJSON LineString');
1177                }
1178                return polyline.encode(flipped(geojson.coordinates), precision);
1179            };
1180
1181            /**
1182             * Decodes to a GeoJSON LineString geometry.
1183             *
1184             * @param {String} str
1185             * @param {Number} precision
1186             * @returns {Object}
1187             */
1188            polyline.toGeoJSON = function (str, precision) {
1189                var coords = polyline.decode(str, precision);
1190                return {
1191                    type: 'LineString',
1192                    coordinates: flipped(coords)
1193                };
1194            };
1195
1196            if (typeof module === 'object' && module.exports) {
1197                module.exports = polyline;
1198            }
1199
1200        }, {}
vendor: 13,486 bytes, lines 1200-1423
1200], 9: [function (require, module, exports) {
1201            (function (process) {
1202                var toGeoJSON = (function () {
1203                    'use strict';
1204
1205                    var removeSpace = (/\s*/g),
1206                        trimSpace = (/^\s*|\s*$/g),
1207                        splitSpace = (/\s+/);
1208                    // generate a short, numeric hash of a string
1209                    function okhash(x) {
1210                        if (!x || !x.length) return 0;
1211                        for (var i = 0, h = 0; i < x.length; i++) {
1212                            h = ((h << 5) - h) + x.charCodeAt(i) | 0;
1213                        } return h;
1214                    }
1215                    // all Y children of X
1216                    function get(x, y) { return x.getElementsByTagName(y); }
1217                    function attr(x, y) { return x.getAttribute(y); }
1218                    function attrf(x, y) { return parseFloat(attr(x, y)); }
1219                    // one Y child of X, if any, otherwise null
1220                    function get1(x, y) { var n = get(x, y); return n.length ? n[0] : null; }
1221                    // https://developer.mozilla.org/en-US/docs/Web/API/Node.normalize
1222                    function norm(el) { if (el.normalize) { el.normalize(); } return el; }
1223                    // cast array x into numbers
1224                    function numarray(x) {
1225                        for (var j = 0, o = []; j < x.length; j++) { o[j] = parseFloat(x[j]); }
1226                        return o;
1227                    }
1228                    function clean(x) {
1229                        var o = {};
1230                        for (var i in x) { if (x[i]) { o[i] = x[i]; } }
1231                        return o;
1232                    }
1233                    // get the content of a text node, if any
1234                    function nodeVal(x) {
1235                        if (x) { norm(x); }
1236                        return (x && x.textContent) || '';
1237                    }
1238                    // get one coordinate from a coordinate array, if any
1239                    function coord1(v) { return numarray(v.replace(removeSpace, '').split(',')); }
1240                    // get all coordinates from a coordinate array as [[],[]]
1241                    function coord(v) {
1242                        var coords = v.replace(trimSpace, '').split(splitSpace),
1243                            o = [];
1244                        for (var i = 0; i < coords.length; i++) {
1245                            o.push(coord1(coords[i]));
1246                        }
1247                        return o;
1248                    }
1249                    function coordPair(x) {
1250                        var ll = [attrf(x, 'lon'), attrf(x, 'lat')],
1251                            ele = get1(x, 'ele'),
1252                            // handle namespaced attribute in browser
1253                            heartRate = get1(x, 'gpxtpx:hr') || get1(x, 'hr'),
1254                            time = get1(x, 'time'),
1255                            e;
1256                        if (ele) {
1257                            e = parseFloat(nodeVal(ele));
1258                            if (!isNaN(e)) {
1259                                ll.push(e);
1260                            }
1261                        }
1262                        return {
1263                            coordinates: ll,
1264                            time: time ? nodeVal(time) : null,
1265                            heartRate: heartRate ? parseFloat(nodeVal(heartRate)) : null
1266                        };
1267                    }
1268
1269                    // create a new feature collection parent object
1270                    function fc() {
1271                        return {
1272                            type: 'FeatureCollection',
1273                            features: []
1274                        };
1275                    }
1276
1277                    var serializer;
1278                    if (typeof XMLSerializer !== 'undefined') {
1279                        /* istanbul ignore next */
1280                        serializer = new XMLSerializer();
1281                        // only require xmldom in a node environment
1282                    } else if (typeof exports === 'object' && typeof process === 'object' && !process.browser) {
1283                        serializer = new (require('xmldom').XMLSerializer)();
1284                    }
1285                    function xml2str(str) {
1286                        // IE9 will create a new XMLSerializer but it'll crash immediately.
1287                        // This line is ignored because we don't run coverage tests in IE9
1288                        /* istanbul ignore next */
1289                        if (str.xml !== undefined) return str.xml;
1290                        return serializer.serializeToString(str);
1291                    }
1292
1293                    var t = {
1294                        kml: function (doc) {
1295
1296                            var gj = fc(),
1297                                // styleindex keeps track of hashed styles in order to match features
1298                                styleIndex = {},
1299                                // atomic geospatial types supported by KML - MultiGeometry is
1300                                // handled separately
1301                                geotypes = ['Polygon', 'LineString', 'Point', 'Track', 'gx:Track'],
1302                                // all root placemarks in the file
1303                                placemarks = get(doc, 'Placemark'),
1304                                styles = get(doc, 'Style'),
1305                                styleMaps = get(doc, 'StyleMap');
1306
1307                            for (var k = 0; k < styles.length; k++) {
1308                                styleIndex['#' + attr(styles[k], 'id')] = okhash(xml2str(styles[k])).toString(16);
1309                            }
1310                            for (var l = 0; l < styleMaps.length; l++) {
1311                                styleIndex['#' + attr(styleMaps[l], 'id')] = okhash(xml2str(styleMaps[l])).toString(16);
1312                            }
1313                            for (var j = 0; j < placemarks.length; j++) {
1314                                gj.features = gj.features.concat(getPlacemark(placemarks[j]));
1315                            }
1316                            function kmlColor(v) {
1317                                var color, opacity;
1318                                v = v || '';
1319                                if (v.substr(0, 1) === '#') { v = v.substr(1); }
1320                                if (v.length === 6 || v.length === 3) { color = v; }
1321                                if (v.length === 8) {
1322                                    opacity = parseInt(v.substr(0, 2), 16) / 255;
1323                                    color = '#' + v.substr(2);
1324                                }
1325                                return [color, isNaN(opacity) ? undefined : opacity];
1326                            }
1327                            function gxCoord(v) { return numarray(v.split(' ')); }
1328                            function gxCoords(root) {
1329                                var elems = get(root, 'coord', 'gx'), coords = [], times = [];
1330                                if (elems.length === 0) elems = get(root, 'gx:coord');
1331                                for (var i = 0; i < elems.length; i++) coords.push(gxCoord(nodeVal(elems[i])));
1332                                var timeElems = get(root, 'when');
1333                                for (var j = 0; j < timeElems.length; j++) times.push(nodeVal(timeElems[j]));
1334                                return {
1335                                    coords: coords,
1336                                    times: times
1337                                };
1338                            }
1339                            function getGeometry(root) {
1340                                var geomNode, geomNodes, i, j, k, geoms = [], coordTimes = [];
1341                                if (get1(root, 'MultiGeometry')) { return getGeometry(get1(root, 'MultiGeometry')); }
1342                                if (get1(root, 'MultiTrack')) { return getGeometry(get1(root, 'MultiTrack')); }
1343                                if (get1(root, 'gx:MultiTrack')) { return getGeometry(get1(root, 'gx:MultiTrack')); }
1344                                for (i = 0; i < geotypes.length; i++) {
1345                                    geomNodes = get(root, geotypes[i]);
1346                                    if (geomNodes) {
1347                                        for (j = 0; j < geomNodes.length; j++) {
1348                                            geomNode = geomNodes[j];
1349                                            if (geotypes[i] === 'Point') {
1350                                                geoms.push({
1351                                                    type: 'Point',
1352                                                    coordinates: coord1(nodeVal(get1(geomNode, 'coordinates')))
1353                                                });
1354                                            } else if (geotypes[i] === 'LineString') {
1355                                                geoms.push({
1356                                                    type: 'LineString',
1357                                                    coordinates: coord(nodeVal(get1(geomNode, 'coordinates')))
1358                                                });
1359                                            } else if (geotypes[i] === 'Polygon') {
1360                                                var rings = get(geomNode, 'LinearRing'),
1361                                                    coords = [];
1362                                                for (k = 0; k < rings.length; k++) {
1363                                                    coords.push(coord(nodeVal(get1(rings[k], 'coordinates'))));
1364                                                }
1365                                                geoms.push({
1366                                                    type: 'Polygon',
1367                                                    coordinates: coords
1368                                                });
1369                                            } else if (geotypes[i] === 'Track' ||
1370                                                geotypes[i] === 'gx:Track') {
1371                                                var track = gxCoords(geomNode);
1372                                                geoms.push({
1373                                                    type: 'LineString',
1374                                                    coordinates: track.coords
1375                                                });
1376                                                if (track.times.length) coordTimes.push(track.times);
1377                                            }
1378                                        }
1379                                    }
1380                                }
1381                                return {
1382                                    geoms: geoms,
1383                                    coordTimes: coordTimes
1384                                };
1385                            }
1386                            function getPlacemark(root) {
1387                                var geomsAndTimes = getGeometry(root), i, properties = {},
1388                                    name = nodeVal(get1(root, 'name')),
1389                                    styleUrl = nodeVal(get1(root, 'styleUrl')),
1390                                    description = nodeVal(get1(root, 'description')),
1391                                    timeSpan = get1(root, 'TimeSpan'),
1392                                    extendedData = get1(root, 'ExtendedData'),
1393                                    lineStyle = get1(root, 'LineStyle'),
1394                                    polyStyle = get1(root, 'PolyStyle');
1395
1396                                if (!geomsAndTimes.geoms.length) return [];
1397                                if (name) properties.name = name;
1398                                if (styleUrl[0] !== '#') {
1399                                    styleUrl = '#' + styleUrl;
1400                                }
1401                                if (styleUrl && styleIndex[styleUrl]) {
1402                                    properties.styleUrl = styleUrl;
1403                                    properties.styleHash = styleIndex[styleUrl];
1404                                }
1405                                if (description) properties.description = description;
1406                                if (timeSpan) {
1407                                    var begin = nodeVal(get1(timeSpan, 'begin'));
1408                                    var end = nodeVal(get1(timeSpan, 'end'));
1409                                    properties.timespan = { begin: begin, end: end };
1410                                }
1411                                if (lineStyle) {
1412                                    var linestyles = kmlColor(nodeVal(get1(lineStyle, 'color'))),
1413                                        color = linestyles[0],
1414                                        opacity = linestyles[1],
1415                                        width = parseFloat(nodeVal(get1(lineStyle, 'width')));
1416                                    if (color) properties.stroke = color;
1417                                    if (!isNaN(opacity)) properties['stroke-opacity'] = opacity;
1418                                    if (!isNaN(width)) properties['stroke-width'] = width;
1419                                }
1420                                if (polyStyle) {
1421                                    var polystyles = kmlColor(nodeVal(get1(polyStyle, 'color'))),
1422                                        pcolor = polystyles[0],
1423                                        popacity = polystyles[1],
1424                                        fill = nodeVal(get1(polyStyle, 'fill')),
1425                                        outline = nodeVal(get1(polyStyle, 'outline'));
1426                                    if (pcolor) properties.fill = pcolor;
1427                                    if (!isNaN(popacity)) properties['fill-opacity'] = popacity;
1428                                    if (fill) properties['fill-opacity'] = fill === '1' ? 1 : 0;
1429                                    if (outline) properties['stroke-opacity'] = outline === '1' ? 1 : 0;
1430                                }
1431                                if (extendedData) {
1432                                    var datas = get(extendedData, 'Data'),
1433                                        simpleDatas = get(extendedData, 'SimpleData');
1434
1435                                    for (i = 0; i < datas.length; i++) {
1436                                        properties[datas[i].getAttribute('name')] = nodeVal(get1(datas[i], 'value'));
1437                                    }
1438                                    for (i = 0; i < simpleDatas.length; i++) {
1439                                        properties[simpleDatas[i].getAttribute('name')] = nodeVal(simpleDatas[i]);
1440                                    }
1441                                }
1442                                if (geomsAndTimes.coordTimes.length) {
1443                                    properties.coordTimes = (geomsAndTimes.coordTimes.length === 1) ?
1444                                        geomsAndTimes.coordTimes[0] : geomsAndTimes.coordTimes;
1445                                }
1446                                var feature = {
1447                                    type: 'Feature',
1448                                    geometry: (geomsAndTimes.geoms.length === 1) ? geomsAndTimes.geoms[0] : {
1449                                        type: 'GeometryCollection',
1450                                        geometries: geomsAndTimes.geoms
1451                                    },
1452                                    properties: properties
1453                                };
1454                                if (attr(root, 'id')) feature.id = attr(root, 'id');
1455                                return [feature];
1456                            }
1457                            return gj;
1458                        },
1459                        gpx: function (doc) {
1460                            var i,
1461                                tracks = get(doc, 'trk'),
1462                                routes = get(doc, 'rte'),
1463                                waypoints = get(doc, 'wpt'),
1464                                // a feature collection
1465                                gj = fc(),
1466                                feature;
1467                            for (i = 0; i < tracks.length; i++) {
1468                                feature = getTrack(tracks[i]);
1469                                if (feature) gj.features.push(feature);
1470                            }
1471                            for (i = 0; i < routes.length; i++) {
1472                                feature = getRoute(routes[i]);
1473                                if (feature) gj.features.push(feature);
1474                            }
1475                            for (i = 0; i < waypoints.length; i++) {
1476                                gj.features.push(getPoint(waypoints[i]));
1477                            }
1478                            function getPoints(node, pointname) {
1479                                var pts = get(node, pointname),
1480                                    line = [],
1481                                    times = [],
1482                                    heartRates = [],
1483                                    l = pts.length;
1484                                if (l < 2) return {};  // Invalid line in GeoJSON
1485                                for (var i = 0; i < l; i++) {
1486                                    var c = coordPair(pts[i]);
1487                                    line.push(c.coordinates);
1488                                    if (c.time) times.push(c.time);
1489                                    if (c.heartRate) heartRates.push(c.heartRate);
1490                                }
1491                                return {
1492                                    line: line,
1493                                    times: times,
1494                                    heartRates: heartRates
1495                                };
1496                            }
1497                            function getTrack(node) {
1498                                var segments = get(node, 'trkseg'),
1499                                    track = [],
1500                                    times = [],
1501                                    heartRates = [],
1502                                    line;
1503                                for (var i = 0; i < segments.length; i++) {
1504                                    line = getPoints(segments[i], 'trkpt');
1505                                    if (line.line) track.push(line.line);
1506                                    if (line.times && line.times.length) times.push(line.times);
1507                                    if (line.heartRates && line.heartRates.length) heartRates.push(line.heartRates);
1508                                }
1509                                if (track.length === 0) return;
1510                                var properties = getProperties(node);
1511                                if (times.length) properties.coordTimes = track.length === 1 ? times[0] : times;
1512                                if (heartRates.length) properties.heartRates = track.length === 1 ? heartRates[0] : heartRates;
1513                                return {
1514                                    type: 'Feature',
1515                                    properties: properties,
1516                                    geometry: {
1517                                        type: track.length === 1 ? 'LineString' : 'MultiLineString',
1518                                        coordinates: track.length === 1 ? track[0] : track
1519                                    }
1520                                };
1521                            }
1522                            function getRoute(node) {
1523                                var line = getPoints(node, 'rtept');
1524                                if (!line.line) return;
1525                                var routeObj = {
1526                                    type: 'Feature',
1527                                    properties: getProperties(node),
1528                                    geometry: {
1529                                        type: 'LineString',
1530                                        coordinates: line.line
1531                                    }
1532                                };
1533                                return routeObj;
1534                            }
1535                            function getPoint(node) {
1536                                var prop = getProperties(node);
1537                                prop.sym = nodeVal(get1(node, 'sym'));
1538                                return {
1539                                    type: 'Feature',
1540                                    properties: prop,
1541                                    geometry: {
1542                                        type: 'Point',
1543                                        coordinates: coordPair(node).coordinates
1544                                    }
1545                                };
1546                            }
1547                            function getProperties(node) {
1548                                var meta = ['name', 'desc', 'author', 'copyright', 'link',
1549                                    'time', 'keywords'],
1550                                    prop = {},
1551                                    k;
1552                                for (k = 0; k < meta.length; k++) {
1553                                    prop[meta[k]] = nodeVal(get1(node, meta[k]));
1554                                }
1555                                return clean(prop);
1556                            }
1557                            return gj;
1558                        }
1559                    };
1560                    return t;
1561                })();
1562
1563                if (typeof module !== 'undefined') module.exports = toGeoJSON;
1564
1565            }).call(this, require('_process'))
1566        }, { "_process": 3, "xmldom": 2 }
1566], 10: [function (require, module, exports) {
1567            (function (global, factory) {
1568                typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
1569                    typeof define === 'function' && define.amd ? define(['exports'], factory) :
1570                        (factory((global.topojson = global.topojson || {})));
1571            }(this, function (exports) {
1572                'use strict';
1573
1574                function noop() { }
1575
1576                function transformAbsolute(transform) {
1577                    if (!transform) return noop;
1578                    var x0,
1579                        y0,
1580                        kx = transform.scale[0],
1581                        ky = transform.scale[1],
1582                        dx = transform.translate[0],
1583                        dy = transform.translate[1];
1584                    return function (point, i) {
1585                        if (!i) x0 = y0 = 0;
1586                        point[0] = (x0 += point[0]) * kx + dx;
1587                        point[1] = (y0 += point[1]) * ky + dy;
1588                    };
1589                }
1590
1591                function transformRelative(transform) {
1592                    if (!transform) return noop;
1593                    var x0,
1594                        y0,
1595                        kx = transform.scale[0],
1596                        ky = transform.scale[1],
1597                        dx = transform.translate[0],
1598                        dy = transform.translate[1];
1599                    return function (point, i) {
1600                        if (!i) x0 = y0 = 0;
1601                        var x1 = Math.round((point[0] - dx) / kx),
1602                            y1 = Math.round((point[1] - dy) / ky);
1603                        point[0] = x1 - x0;
1604                        point[1] = y1 - y0;
1605                        x0 = x1;
1606                        y0 = y1;
1607                    };
1608                }
1609
1610                function reverse(array, n) {
1611                    var t, j = array.length, i = j - n;
1612                    while (i < --j) t = array[i], array[i++] = array[j], array[j] = t;
1613                }
1614
1615                function bisect(a, x) {
1616                    var lo = 0, hi = a.length;
1617                    while (lo < hi) {
1618                        var mid = lo + hi >>> 1;
1619                        if (a[mid] < x) lo = mid + 1;
1620                        else hi = mid;
1621                    }
1622                    return lo;
1623                }
1624
1625                function feature(topology, o) {
1626                    return o.type === "GeometryCollection" ? {
1627                        type: "FeatureCollection",
1628                        features: o.geometries.map(function (o) { return feature$1(topology, o); })
1629                    } : feature$1(topology, o);
1630                }
1631
1632                function feature$1(topology, o) {
1633                    var f = {
1634                        type: "Feature",
1635                        id: o.id,
1636                        properties: o.properties || {},
1637                        geometry: object(topology, o)
1638                    };
1639                    if (o.id == null) delete f.id;
1640                    return f;
1641                }
1642
1643                function object(topology, o) {
1644                    var absolute = transformAbsolute(topology.transform),
1645                        arcs = topology.arcs;
1646
1647                    function arc(i, points) {
1648                        if (points.length) points.pop();
1649                        for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length, p; k < n; ++k) {
1650                            points.push(p = a[k].slice());
1651                            absolute(p, k);
1652                        }
1653                        if (i < 0) reverse(points, n);
1654                    }
1655
1656                    function point(p) {
1657                        p = p.slice();
1658                        absolute(p, 0);
1659                        return p;
1660                    }
1661
1662                    function line(arcs) {
1663                        var points = [];
1664                        for (var i = 0, n = arcs.length; i < n; ++i) arc(arcs[i], points);
1665                        if (points.length < 2) points.push(points[0].slice());
1666                        return points;
1667                    }
1668
1669                    function ring(arcs) {
1670                        var points = line(arcs);
1671                        while (points.length < 4) points.push(points[0].slice());
1672                        return points;
1673                    }
1674
1675                    function polygon(arcs) {
1676                        return arcs.map(ring);
1677                    }
1678
1679                    function geometry(o) {
1680                        var t = o.type;
1681                        return t === "GeometryCollection" ? { type: t, geometries: o.geometries.map(geometry) }
1682                            : t in geometryType ? { type: t, coordinates: geometryType[t](o) }
1683                                : null;
1684                    }
1685
1686                    var geometryType = {
1687                        Point: function (o) { return point(o.coordinates); },
1688                        MultiPoint: function (o) { return o.coordinates.map(point); },
1689                        LineString: function (o) { return line(o.arcs); },
1690                        MultiLineString: function (o) { return o.arcs.map(line); },
1691                        Polygon: function (o) { return polygon(o.arcs); },
1692                        MultiPolygon: function (o) { return o.arcs.map(polygon); }
1693                    };
1694
1695                    return geometry(o);
1696                }
1697
1698                function stitchArcs(topology, arcs) {
1699                    var stitchedArcs = {},
1700                        fragmentByStart = {},
1701                        fragmentByEnd = {},
1702                        fragments = [],
1703                        emptyIndex = -1;
1704
1705                    // Stitch empty arcs first, since they may be subsumed by other arcs.
1706                    arcs.forEach(function (i, j) {
1707                        var arc = topology.arcs[i < 0 ? ~i : i], t;
1708                        if (arc.length < 3 && !arc[1][0] && !arc[1][1]) {
1709                            t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t;
1710                        }
1711                    });
1712
1713                    arcs.forEach(function (i) {
1714                        var e = ends(i),
1715                            start = e[0],
1716                            end = e[1],
1717                            f, g;
1718
1719                        if (f = fragmentByEnd[start]) {
1720                            delete fragmentByEnd[f.end];
1721                            f.push(i);
1722                            f.end = end;
1723                            if (g = fragmentByStart[end]) {
1724                                delete fragmentByStart[g.start];
1725                                var fg = g === f ? f : f.concat(g);
1726                                fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg;
1727                            } else {
1728                                fragmentByStart[f.start] = fragmentByEnd[f.end] = f;
1729                            }
1730                        } else if (f = fragmentByStart[end]) {
1731                            delete fragmentByStart[f.start];
1732                            f.unshift(i);
1733                            f.start = start;
1734                            if (g = fragmentByEnd[start]) {
1735                                delete fragmentByEnd[g.end];
1736                                var gf = g === f ? f : g.concat(f);
1737                                fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf;
1738                            } else {
1739                                fragmentByStart[f.start] = fragmentByEnd[f.end] = f;
1740                            }
1741                        } else {
1742                            f = [i];
1743                            fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f;
1744                        }
1745                    });
1746
1747                    function ends(i) {
1748                        var arc = topology.arcs[i < 0 ? ~i : i], p0 = arc[0], p1;
1749                        if (topology.transform) p1 = [0, 0], arc.forEac
1749h(function (dp) { p1[0] += dp[0], p1[1] += dp[1]; });
1750                        else p1 = arc[arc.length - 1];
1751                        return i < 0 ? [p1, p0] : [p0, p1];
1752                    }
1753
1754                    function flush(fragmentByEnd, fragmentByStart) {
1755                        for (var k in fragmentByEnd) {
1756                            var f = fragmentByEnd[k];
1757                            delete fragmentByStart[f.start];
1758                            delete f.start;
1759                            delete f.end;
1760                            f.forEach(function (i) { stitchedArcs[i < 0 ? ~i : i] = 1; });
1761                            fragments.push(f);
1762                        }
1763                    }
1764
1765                    flush(fragmentByEnd, fragmentByStart);
1766                    flush(fragmentByStart, fragmentByEnd);
1767                    arcs.forEach(function (i) { if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); });
1768
1769                    return fragments;
1770                }
1771
1772                function mesh(topology) {
1773                    return object(topology, meshArcs.apply(this, arguments));
1774                }
1775
1776                function meshArcs(topology, o, filter) {
1777                    var arcs = [];
1778
1779                    function arc(i) {
1780                        var j = i < 0 ? ~i : i;
1781                        (geomsByArc[j] || (geomsByArc[j] = [])).push({ i: i, g: geom });
1782                    }
1783
1784                    function line(arcs) {
1785                        arcs.forEach(arc);
1786                    }
1787
1788                    function polygon(arcs) {
1789                        arcs.forEach(line);
1790                    }
1791
1792                    function geometry(o) {
1793                        if (o.type === "GeometryCollection") o.geometries.forEach(geometry);
1794                        else if (o.type in geometryType) geom = o, geometryType[o.type](o.arcs);
1795                    }
1796
1797                    if (arguments.length > 1) {
1798                        var geomsByArc = [],
1799                            geom;
1800
1801                        var geometryType = {
1802                            LineString: line,
1803                            MultiLineString: polygon,
1804                            Polygon: polygon,
1805                            MultiPolygon: function (arcs) { arcs.forEach(polygon); }
1806                        };
1807
1808                        geometry(o);
1809
1810                        geomsByArc.forEach(arguments.length < 3
1811                            ? function (geoms) { arcs.push(geoms[0].i); }
1812                            : function (geoms) { if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); });
1813                    } else {
1814                        for (var i = 0, n = topology.arcs.length; i < n; ++i) arcs.push(i);
1815                    }
1816
1817                    return { type: "MultiLineString", arcs: stitchArcs(topology, arcs) };
1818                }
1819
1820                function cartesianTriangleArea(triangle) {
1821                    var a = triangle[0], b = triangle[1], c = triangle[2];
1822                    return Math.abs((a[0] - c[0]) * (b[1] - a[1]) - (a[0] - b[0]) * (c[1] - a[1]));
1823                }
1824
1825                function ring(ring) {
1826                    var i = -1,
1827                        n = ring.length,
1828                        a,
1829                        b = ring[n - 1],
1830                        area = 0;
1831
1832                    while (++i < n) {
1833                        a = b;
1834                        b = ring[i];
1835                        area += a[0] * b[1] - a[1] * b[0];
1836                    }
1837
1838                    return area / 2;
1839                }
1840
1841                function merge(topology) {
1842                    return object(topology, mergeArcs.apply(this, arguments));
1843                }
1844
1845                function mergeArcs(topology, objects) {
1846                    var polygonsByArc = {},
1847                        polygons = [],
1848                        components = [];
1849
1850                    objects.forEach(function (o) {
1851                        if (o.type === "Polygon") register(o.arcs);
1852                        else if (o.type === "MultiPolygon") o.arcs.forEach(register);
1853                    });
1854
1855                    function register(polygon) {
1856                        polygon.forEach(function (ring$$) {
1857                            ring$$.forEach(function (arc) {
1858                                (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon);
1859                            });
1860                        });
1861                        polygons.push(polygon);
1862                    }
1863
1864                    function area(ring$$) {
1865                        return Math.abs(ring(object(topology, { type: "Polygon", arcs: [ring$$] }).coordinates[0]));
1866                    }
1867
1868                    polygons.forEach(function (polygon) {
1869                        if (!polygon._) {
1870                            var component = [],
1871                                neighbors = [polygon];
1872                            polygon._ = 1;
1873                            components.push(component);
1874                            while (polygon = neighbors.pop()) {
1875                                component.push(polygon);
1876                                polygon.forEach(function (ring$$) {
1877                                    ring$$.forEach(function (arc) {
1878                                        polygonsByArc[arc < 0 ? ~arc : arc].forEac
vendor: 4,506 bytes, lines 1878-1982
1878h(function (polygon) {
1879                                            if (!polygon._) {
1880                                                polygon._ = 1;
1881                                                neighbors.push(polygon);
1882                                            }
1883                                        });
1884                                    });
1885                                });
1886                            }
1887                        }
1888                    });
1889
1890                    polygons.forEach(function (polygon) {
1891                        delete polygon._;
1892                    });
1893
1894                    return {
1895                        type: "MultiPolygon",
1896                        arcs: components.map(function (polygons) {
1897                            var arcs = [], n;
1898
1899                            // Extract the exterior (unique) arcs.
1900                            polygons.forEach(function (polygon) {
1901                                polygon.forEach(function (ring$$) {
1902                                    ring$$.forEach(function (arc) {
1903                                        if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) {
1904                                            arcs.push(arc);
1905                                        }
1906                                    });
1907                                });
1908                            });
1909
1910                            // Stitch the arcs into one or more rings.
1911                            arcs = stitchArcs(topology, arcs);
1912
1913                            // If more than one ring is returned,
1914                            // at most one of these rings can be the exterior;
1915                            // choose the one with the greatest absolute area.
1916                            if ((n = arcs.length) > 1) {
1917                                for (var i = 1, k = area(arcs[0]), ki, t; i < n; ++i) {
1918                                    if ((ki = area(arcs[i])) > k) {
1919                                        t = arcs[0], arcs[0] = arcs[i], arcs[i] = t, k = ki;
1920                                    }
1921                                }
1922                            }
1923
1924                            return arcs;
1925                        })
1926                    };
1927                }
1928
1929                function neighbors(objects) {
1930                    var indexesByArc = {}, // arc index -> array of object indexes
1931                        neighbors = objects.map(function () { return []; });
1932
1933                    function line(arcs, i) {
1934                        arcs.forEach(function (a) {
1935                            if (a < 0) a = ~a;
1936                            var o = indexesByArc[a];
1937                            if (o) o.push(i);
1938                            else indexesByArc[a] = [i];
1939                        });
1940                    }
1941
1942                    function polygon(arcs, i) {
1943                        arcs.forEach(function (arc) { line(arc, i); });
1944                    }
1945
1946                    function geometry(o, i) {
1947                        if (o.type === "GeometryCollection") o.geometries.forEach(function (o) { geometry(o, i); });
1948                        else if (o.type in geometryType) geometryType[o.type](o.arcs, i);
1949                    }
1950
1951                    var geometryType = {
1952                        LineString: line,
1953                        MultiLineString: polygon,
1954                        Polygon: polygon,
1955                        MultiPolygon: function (arcs, i) { arcs.forEach(function (arc) { polygon(arc, i); }); }
1956                    };
1957
1958                    objects.forEach(geometry);
1959
1960                    for (var i in indexesByArc) {
1961                        for (var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j) {
1962                            for (var k = j + 1; k < m; ++k) {
1963                                var ij = indexes[j], ik = indexes[k], n;
1964                                if ((n = neighbors[ij])[i = bisect(n, ik)] !== ik) n.splice(i, 0, ik);
1965                                if ((n = neighbors[ik])[i = bisect(n, ij)] !== ij) n.splice(i, 0, ij);
1966                            }
1967                        }
1968                    }
1969
1970                    return neighbors;
1971                }
1972
1973                function compareArea(a, b) {
1974                    return a[1][2] - b[1][2];
1975                }
1976
1977                function minAreaHeap() {
1978                    var heap = {},
1979                        array = [],
1980                        size = 0;
1981
1982                    heap.push = function (object) {
1983                        up(array[object._ = size] = object, size++);
1984                        return size;
1985                    };
1986
1987                    heap.pop = function () {
1988                        if (size <= 0) return;
1989                        var removed = array[0], object;
1990                        if (--size > 0) object = array[size], down(array[object._ = 0] = object, 0);
1991                        return removed;
1992                    };
1993
1994                    heap.remove = function (removed) {
1995                        var i = removed._, object;
1996                        if (array[i] !== removed) return; // invalid request
1997                        if (i !== --size) object = array[size], (compareArea(object, removed) < 0 ? up : down)(array[object._ = i] = object, i);
1998                        return i;
1999                    };
2000
2001                    function up(object, i) {
2002                        while (i > 0) {
2003                            var j = ((i + 1) >> 1) - 1,
2004                                parent = array[j];
2005                            if (compareArea(object, parent) >= 0) break;
2006                            array[parent._ = i] = parent;
2007                            array[object._ = i = j] = object;
2008                        }
2009                    }
2010
2011                    function down(object, i) {
2012                        while (true) {
2013                            var r = (i + 1) << 1,
2014                                l = r - 1,
2015                                j = i,
2016                                child = array[j];
2017                            if (l < size && compareArea(array[l], child) < 0) child = array[j = l];
2018                            if (r < size && compareArea(array[r], child) < 0) child = array[j = r];
2019                            if (j === i) break;
2020                            array[child._ = i] = child;
2021                            array[object._ = i = j] = object;
2022                        }
2023                    }
2024
2025                    return heap;
2026                }
2027
2028                function presimplify(topology, triangleArea) {
2029                    var absolute = transformAbsolute(topology.transform),
2030                        relative = transformRelative(topology.transform),
2031                        heap = minAreaHeap();
2032
2033                    if (!triangleArea) triangleArea = cartesianTriangleArea;
2034
2035                    topology.arcs.forEach(function (arc) {
2036                        var triangles = [],
2037                            maxArea = 0,
2038                            triangle,
2039                            i,
2040                            n,
2041                            p;
2042
2043                        // To store each point’s effective area, we create a new array rather than
2044                        // extending the passed-in point to workaround a Chrome/V8 bug (getting
2045                        // stuck in smi mode). For midpoints, the initial effective area of
2046                        // Infinity will be computed in the next step.
2047                        for (i = 0, n = arc.length; i < n; ++i) {
2048                            p = arc[i];
2049                            absolute(arc[i] = [p[0], p[1], Infinity], i);
2050                        }
2051
2052                        for (i = 1, n = arc.length - 1; i < n; ++i) {
2053                            triangle = arc.slice(i - 1, i + 2);
2054                            triangle[1][2] = triangleArea(triangle);
2055                            triangles.push(triangle);
2056                            heap.push(triangle);
2057                        }
2058
2059                        for (i = 0, n = triangles.length; i < n; ++i) {
2060                            triangle = triangles[i];
2061                            triangle.previous = triangles[i - 1];
2062                            triangle.next = triangles[i + 1];
2063                        }
2064
2065                        while (triangle = heap.pop()) {
2066                            var previous = triangle.previous,
2067                                next = triangle.next;
2068
2069                            // If the area of the current point is less than that of the previous point
2070                            // to be eliminated, use the latter's area instead. This ensures that the
2071                            // current point cannot be eliminated without eliminating previously-
2072                            // eliminated points.
2073                            if (triangle[1][2] < maxArea) triangle[1][2] = maxArea;
2074                            else maxArea = triangle[1][2];
2075
2076                            if (previous) {
2077                                previous.next = next;
2078                                previous[2] = triangle[2];
2079                                update(previous);
2080                            }
2081
2082                            if (next) {
2083                                next.previous = previous;
2084                                next[0] = triangle[0];
2085                                update(next);
2086                            }
2087                        }
2088
2089                        arc.forEach(relative);
2090                    });
2091
2092                    function update(triangle) {
2093                        heap.remove(triangle);
2094                        triangle[1][2] = triangleArea(triangle);
2095                        heap.push(triangle);
2096                    }
2097
2098                    return topology;
2099                }
2100
2101                var version = "1.6.26";
2102
2103                exports.version = version;
2104                exports.mesh = mesh;
2105                exports.meshArcs = meshArcs;
2106                exports.merge = merge;
2107                exports.mergeArcs = mergeArcs;
2108                exports.feature = feature;
2109                exports.neighbors = neighbors;
2110                exports.presimplify = presimplify;
2111
2112            }));
2113        }, {}], 11: [function (require, module, exports) {
2114            /*eslint-disable no-cond-assign */
2115            module.exports = parse;
2116            module.exports.parse = parse;
2117            module.exports.stringify = stringify;
2118
2119            var numberRegexp = /[-+]?([0-9]*\.[0-9]+|[0-9]+)([eE][-+]?[0-9]+)?/;
2120            // Matches sequences like '100 100' or '100 100 100'.
2121            var tuples = new RegExp('^' + numberRegexp.source + '(\\s' + numberRegexp.source + '){1,}');
2122
2123            /*
2124             * Parse WKT and return GeoJSON.
2125             *
2126             * @param {string} _ A WKT geometry
2127             * @return {?Object} A GeoJSON geometry object
2128             */
2129            function parse(input) {
2130                var parts = input.split(';');
2131                var _ = parts.pop();
2132                var srid = (parts.shift() || '').split('=').pop();
2133
2134                var i = 0;
2135
2136                function $(re) {
2137                    var match = _.substring(i).match(re);
2138                    if (!match) return null;
2139                    else {
2140                        i += match[0].length;
2141                        return match[0];
2142                    }
2143                }
2144
2145                function crs(obj) {
2146                    if (obj && srid.match(/\d+/)) {
2147                        obj.crs = {
2148                            type: 'name',
2149                            properties: {
2150                                name: 'urn:ogc:def:crs:EPSG::' + srid
2151                            }
2152                        };
2153                    }
2154
2155                    return obj;
2156                }
2157
2158                function white() { $(/^\s*/); }
2159
2160                function multicoords() {
2161                    white();
2162                    var depth = 0;
2163                    var rings = [];
2164                    var stack = [rings];
2165                    var pointer = rings;
2166                    var elem;
2167
2168                    while (elem =
2169                        $(/^(\()/) ||
2170                        $(/^(\))/) ||
2171                        $(/^(\,)/) ||
2172                        $(tuples)) {
2173                        if (elem === '(') {
2174                            stack.push(pointer);
2175                            pointer = [];
2176                            stack[stack.length - 1].push(pointer);
2177                            depth++;
2178                        } else if (elem === ')') {
2179                            // For the case: Polygon(), ...
2180                            if (pointer.length === 0) return null;
2181
2182                            pointer = stack.pop();
2183                            // the stack was empty, input was malformed
2184                            if (!pointer) return null;
2185                            depth--;
2186                            if (depth === 0) break;
2187                        } else if (elem === ',') {
2188                            pointer = [];
2189                            stack[stack.length - 1].push(pointer);
2190                        } else if (!elem.split(/\s/g).some(isNaN)) {
2191                            Array.prototype.push.apply(pointer, elem.split(/\s/g).map(parseFloat));
2192                        } else {
2193                            return null;
2194                        }
2195                        white();
2196                    }
2197
2198                    if (depth !== 0) return null;
2199
2200                    return rings;
2201                }
2202
2203                function coords() {
2204                    var list = [];
2205                    var item;
2206                    var pt;
2207                    while (pt =
2208                        $(tuples) ||
2209                        $(/^(\,)/)) {
2210                        if (pt === ',') {
2211                            list.push(item);
2212                            item = [];
2213                        } else if (!pt.split(/\s/g).some(isNaN)) {
2214                            if (!item) item = [];
2215                            Array.prototype.push.apply(item, pt.split(/\s/g).map(parseFloat));
2216                        }
2217                        white();
2218                    }
2219
2220                    if (item) list.push(item);
2221                    else return null;
2222
2223                    return list.length ? list : null;
2224                }
2225
2226                function point() {
2227                    if (!$(/^(point)/i)) return null;
2228                    white();
2229                    if (!$(/^(\()/)) return null;
2230                    var c = coords();
2231                    if (!c) return null;
2232                    white();
2233                    if (!$(/^(\))/)) return null;
2234                    return {
2235                        type: 'Point',
2236                        coordinates: c[0]
2237                    };
2238                }
2239
2240                function multipoint() {
2241                    if (!$(/^(multipoint)/i)) return null;
2242                    white();
2243                    var newCoordsFormat = _
2244                        .substring(_.indexOf('(') + 1, _.length - 1)
2245                        .replace(/\(/g, '')
2246                        .replace(/\)/g, '');
2247                    _ = 'MULTIPOINT (' + newCoordsFormat + ')';
2248                    var c = multicoords();
2249                    if (!c) return null;
2250                    white();
2251                    return {
2252                        type: 'MultiPoint',
2253                        coordinates: c
2254                    };
2255                }
2256
2257                function multilinestring() {
2258                    if (!$(/^(multilinestring)/i)) return null;
2259                    white();
2260                    var c = multicoords();
2261                    if (!c) return null;
2262                    white();
2263                    return {
2264                        type: 'MultiLineString',
2265                        coordinates: c
2266                    };
2267                }
2268
2269                function linestring() {
2270                    if (!$(/^(linestring)/i)) return null;
2271                    white();
2272                    if (!$(/^(\()/)) return null;
2273                    var c = coords();
2274                    if (!c) return null;
2275                    if (!$(/^(\))/)) return null;
2276                    return {
2277                        type: 'LineString',
2278                        coordinates: c
2279                    };
2280                }
2281
2282                function polygon() {
2283                    if (!$(/^(polygon)/i)) return null;
2284                    white();
2285                    var c = multicoords();
2286                    if (!c) return null;
2287                    return {
2288                        type: 'Polygon',
2289                        coordinates: c
2290                    };
2291                }
2292
2293                function multipolygon() {
2294                    if (!$(/^(multipolygon)/i)) return null;
2295                    white();
2296                    var c = multicoords();
2297                    if (!c) return null;
2298                    return {
2299                        type: 'MultiPolygon',
2300                        coordinates: c
2301                    };
2302                }
2303
2304                function geometrycollection() {
2305                    var geometries = [];
2306                    var geometry;
2307
2308                    if (!$(/^(geometrycollection)/i)) return null;
2309                    white();
2310
2311                    if (!$(/^(\()/)) return null;
2312                    while (geometry = root()) {
2313                        geometries.push(geometry);
2314                        white();
2315                        $(/^(\,)/);
2316                        white();
2317                    }
2318                    if (!$(/^(\))/)) return null;
2319
2320                    return {
2321                        type: 'GeometryCollection',
2322                        geometries: geometries
2323                    };
2324                }
2325
2326                function root() {
2327                    return point() ||
2328                        linestring() ||
2329                        polygon() ||
2330                        multipoint() ||
2331                        multilinestring() ||
2332                        multipolygon() ||
2333                        geometrycollection();
2334                }
2335
2336                return crs(root());
2337            }
2338
2339            /**
2340             * Stringifies a GeoJSON object into WKT
2341             */
2342            function stringify(gj) {
2343                if (gj.type === 'Feature') {
2344                    gj = gj.geometry;
2345                }
2346
2347                function pairWKT(c) {
2348                    return c.join(' ');
2349                }
2350
2351                function ringWKT(r) {
2352                    return r.map(pairWKT).join(', ');
2353                }
2354
2355                function ringsWKT(r) {
2356                    return r.map(ringWKT).map(wrapParens).join(', ');
2357                }
2358
2359                function multiRingsWKT(r) {
2360                    return r.map(ringsWKT).map(wrapParens).join(', ');
2361                }
2362
2363                function wrapParens(s) { return '(' + s + ')'; }
2364
2365                switch (gj.type) {
2366                    case 'Point':
2367                        return 'POINT (' + pairWKT(gj.coordinates) + ')';
2368                    case 'LineString':
2369                        return 'LINESTRING (' + ringWKT(gj.coordinates) + ')';
2370                    case 'Polygon':
2371                        return 'POLYGON (' + ringsWKT(gj.coordinates) + ')';
2372                    case 'MultiPoint':
2373                        return 'MULTIPOINT (' + ringWKT(gj.coordinates) + ')';
2374                    case 'MultiPolygon':
2375                        return 'MULTIPOLYGON (' + multiRingsWKT(gj.coordinates) + ')';
2376                    case 'MultiLineString':
2377                        return 'MULTILINESTRING (' + ringsWKT(gj.coordinates) + ')';
2378                    case 'GeometryCollection':
2379                        return 'GEOMETRYCOLLECTION (' + gj.geometries.map(stringify).join(', ') + ')';
2380                    default:
2381                        throw new Error('stringify requires a valid GeoJSON Feature or geometry object as input');
2382                }
2383            }
2384
2385        }, {}]
2386    }, {}, [1])(1)
2387});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.