UNPKG

geo-extent

Version:

Simple, Modern Geospatial Bounding Boxes

1,448 lines (1,408 loc) 709 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // node_modules/preciso/compare_positive.js var require_compare_positive = __commonJS({ "node_modules/preciso/compare_positive.js"(exports2, module2) { "use strict"; function compare_positive(a, b) { const alen = a.length; const blen = b.length; const aidx = a.indexOf("."); const bidx = b.indexOf("."); const a_adjusted_dot_index = aidx === -1 ? alen : aidx; const b_adjusted_dot_index = bidx === -1 ? blen : bidx; const offset = a_adjusted_dot_index - b_adjusted_dot_index; let left = Math.max(a_adjusted_dot_index, b_adjusted_dot_index); let right = Math.max(alen - a_adjusted_dot_index, blen - b_adjusted_dot_index); let aoffset = offset < 0 ? -1 * offset : 0; let boffset = offset <= 0 ? 0 : offset; let imax = left + 1 + right - 1; let i = 0; while (i < imax) { const ai = i - aoffset; const achar = ai === a_adjusted_dot_index ? "." : a[ai] || "0"; const bi = i - boffset; const bchar = bi === b_adjusted_dot_index ? "." : b[bi] || "0"; if (achar !== bchar) { if (achar > bchar) return ">"; else if (achar < bchar) return "<"; } i++; } return "="; } module2.exports = compare_positive; module2.exports.default = compare_positive; } }); // node_modules/preciso/expand.js var require_expand = __commonJS({ "node_modules/preciso/expand.js"(exports2, module2) { "use strict"; function expand(n) { if (n[0] === "+") n = n.substring(1); const sign = n[0] === "-" ? "-" : ""; if (sign === "-") n = n.substring(1); const index_of_e = n.indexOf("e"); if (index_of_e === -1) return sign + n; let index_of_dot = n.indexOf("."); if (index_of_dot === -1) index_of_dot = index_of_e; const shift = Number(n.substring(index_of_e + 1)); const base = n.substring(0, index_of_e).replace(".", ""); const normshift = index_of_dot + shift; const baselen = base.length; if (normshift >= baselen) { const zct = normshift - baselen; let result = base; for (let i = 0; i < zct; i++) result += "0"; return sign + result; } else if (normshift < 0) { let result = "0."; for (let i = 0; i > normshift; i--) result += "0"; result += base; return sign + result; } else { return sign + base.substring(0, normshift) + "." + base.substring(normshift); } } module2.exports = expand; module2.exports.default = expand; } }); // node_modules/preciso/clean.js var require_clean = __commonJS({ "node_modules/preciso/clean.js"(exports2, module2) { "use strict"; var expand = require_expand(); module2.exports = function clean(n) { if (n[0] === "+") n = n.substring(1); n = expand(n); n = n.replace(/^0+(?=\d)/, ""); if (n.includes(".")) n = n.replace(/\.?0+$/, ""); if (n === "") n = "0"; if (n === "-0") n = "0"; return n; }; } }); // node_modules/preciso/constants/max_safe_integer.js var require_max_safe_integer = __commonJS({ "node_modules/preciso/constants/max_safe_integer.js"(exports2, module2) { "use strict"; var MAX_SAFE_INTEGER = 9007199254740991; module2.exports = { MAX_SAFE_INTEGER }; } }); // node_modules/preciso/constants/max_safe_integer_length.js var require_max_safe_integer_length = __commonJS({ "node_modules/preciso/constants/max_safe_integer_length.js"(exports2, module2) { "use strict"; var { MAX_SAFE_INTEGER } = require_max_safe_integer(); var MAX_SAFE_INTEGER_LENGTH = MAX_SAFE_INTEGER.toString().length - 1; module2.exports = { MAX_SAFE_INTEGER_LENGTH }; } }); // node_modules/preciso/long_addition.js var require_long_addition = __commonJS({ "node_modules/preciso/long_addition.js"(exports2, module2) { "use strict"; var { MAX_SAFE_INTEGER_LENGTH } = require_max_safe_integer_length(); function long_addition(a, b) { const alen = a.length; const blen = b.length; const aidx = a.indexOf("."); const bidx = b.indexOf("."); const a_adjusted_dot_index = aidx === -1 ? alen : aidx; const b_adjusted_dot_index = bidx === -1 ? blen : bidx; if (aidx === -1 && bidx === -1 && alen < MAX_SAFE_INTEGER_LENGTH && blen < MAX_SAFE_INTEGER_LENGTH) { return (Number(a) + Number(b)).toFixed(); } const offset = a_adjusted_dot_index - b_adjusted_dot_index; let left = Math.max(a_adjusted_dot_index, b_adjusted_dot_index); let right = Math.max(alen - a_adjusted_dot_index - 1, blen - b_adjusted_dot_index - 1); let aoffset = offset < 0 ? -1 * offset : 0; let boffset = offset <= 0 ? 0 : offset; let imax = left + 1 + right - 1; let result = ""; let carried = 0; let i = imax; if (right > 0) { while (i > imax - right) { const achar = a[i - aoffset] || "0"; const bchar = b[i - boffset] || "0"; let n = Number(achar) + Number(bchar) + carried; if (n >= 10) { n -= 10; carried = 1; } else { carried = 0; } if (result !== "" || n !== 0) { result = n + result; } i--; } if (result) result = "." + result; i--; } if (left > 0) { while (i >= 0) { const achar = a[i - aoffset] || "0"; const bchar = b[i - boffset] || "0"; let n = Number(achar) + Number(bchar) + carried; if (n >= 10) { n -= 10; carried = 1; } else { carried = 0; } result = n + result; i--; } } if (carried === 1) { result = carried + result; } if (result[0] === ".") result = "0" + result; return result; } module2.exports = long_addition; module2.exports.default = long_addition; } }); // node_modules/preciso/long_subtraction.js var require_long_subtraction = __commonJS({ "node_modules/preciso/long_subtraction.js"(exports2, module2) { "use strict"; var { MAX_SAFE_INTEGER_LENGTH } = require_max_safe_integer_length(); function long_subtraction(a, b) { const alen = a.length; const blen = b.length; const aidx = a.indexOf("."); const bidx = b.indexOf("."); const a_adjusted_dot_index = aidx === -1 ? alen : aidx; const b_adjusted_dot_index = bidx === -1 ? blen : bidx; if (aidx === -1 && bidx === -1 && alen < MAX_SAFE_INTEGER_LENGTH && blen < MAX_SAFE_INTEGER_LENGTH) { return (Number(a) - Number(b)).toFixed(); } const offset = a_adjusted_dot_index - b_adjusted_dot_index; let left = Math.max(a_adjusted_dot_index, b_adjusted_dot_index); let right = Math.max(alen - a_adjusted_dot_index - 1, blen - b_adjusted_dot_index - 1); let aoffset = offset < 0 ? -1 * offset : 0; let boffset = offset <= 0 ? 0 : offset; let imax = left + 1 + right - 1; let result = ""; let borrowed = 0; let i = imax; if (right > 0) { while (i > imax - right) { let top = a[i - aoffset] || "0"; let bottom = b[i - boffset] || "0"; top -= borrowed; borrowed = 0; let n = top - bottom; if (n < 0) { while (n < 0) { borrowed++; n += 10; } } else if (borrowed) { borrowed--; } if (result !== "" || n !== 0) { result = n + result; } i--; } if (result !== "") { result = "." + result; } i--; } if (left > 0) { while (i > 0) { let top = a[i - aoffset] || "0"; let bottom = b[i - boffset] || "0"; top -= borrowed; borrowed = 0; let n2 = top - bottom; if (n2 < 0) { while (n2 < 0) { borrowed++; n2 += 10; } } else if (borrowed) { borrowed--; } result = n2 + result; i--; } const achar = a[0 - aoffset] || "0"; const bchar = b[0 - boffset] || "0"; let n = Number(achar) - (borrowed > 0 ? 1 : 0) - Number(bchar); if (n !== 0) { result = n + result; } result = result.replace(/^0+/, ""); } if (result[0] === ".") result = "0" + result; return result; } module2.exports = long_subtraction; module2.exports.default = long_subtraction; } }); // node_modules/preciso/is_infinity.js var require_is_infinity = __commonJS({ "node_modules/preciso/is_infinity.js"(exports2, module2) { "use strict"; function is_infinity(n) { return !!n.match(/^(|-|\+)inf(inity)?$/i); } module2.exports = is_infinity; module2.exports.default = is_infinity; } }); // node_modules/preciso/add.js var require_add = __commonJS({ "node_modules/preciso/add.js"(exports2, module2) { "use strict"; var compare_positive = require_compare_positive(); var clean = require_clean(); var long_addition = require_long_addition(); var long_subtraction = require_long_subtraction(); var is_infinity = require_is_infinity(); function add2(a, b, { infinity_minus_infinity = "NaN" } = {}) { a = clean(a); b = clean(b); const apos = a[0] !== "-"; const bpos = b[0] !== "-"; const aneg = !apos; const bneg = !bpos; const ainf = is_infinity(a); const binf = is_infinity(b); if (ainf && binf) { if (apos && bpos) return "Infinity"; else if (aneg & bneg) return "-Infinity"; else return infinity_minus_infinity; } else if (ainf) { if (apos) return "Infinity"; else return "-Infinity"; } else if (binf) { if (bpos) return "Infinity"; else return "-Infinity"; } else if (apos && bpos) { return long_addition(a, b); } else if (aneg && bneg) { return "-" + long_addition(a.substring(1), b.substring(1)); } else if (aneg && bpos) { a = a.substring(1); switch (compare_positive(a, b)) { case "=": return "0"; case "<": return long_subtraction(b, a); case ">": return "-" + long_subtraction(a, b); } } else if (apos && !bpos) { b = b.substring(1); switch (compare_positive(a, b)) { case "=": return "0"; case "<": return "-" + long_subtraction(b, a); case ">": return long_subtraction(a, b); } } } module2.exports = add2; module2.exports.default = add2; } }); // node_modules/preciso/absolute.js var require_absolute = __commonJS({ "node_modules/preciso/absolute.js"(exports2, module2) { "use strict"; var clean = require_clean(); function absolute(n) { n = clean(n); if (n[0] === "-") return n.substring(1); else return n; } module2.exports = absolute; module2.exports.default = absolute; } }); // node_modules/preciso/subtract.js var require_subtract = __commonJS({ "node_modules/preciso/subtract.js"(exports2, module2) { "use strict"; var clean = require_clean(); var compare_positive = require_compare_positive(); var is_infinity = require_is_infinity(); var long_addition = require_long_addition(); var long_subtraction = require_long_subtraction(); function subtract2(a, b, { infinity_minus_infinity = "NaN" } = {}) { a = clean(a); b = clean(b); const a_is_negative = a[0] === "-"; const b_is_negative = b[0] === "-"; const a_is_positive = !a_is_negative; const b_is_positive = !b_is_negative; const ainf = is_infinity(a); const binf = is_infinity(b); if (ainf && binf) { if (a_is_positive === b_is_positive) { return infinity_minus_infinity; } else if (a_is_positive) { return "Infinity"; } else if (b_is_positive) { return "-Infinity"; } } else if (ainf) { return a; } else if (binf) { return b_is_positive ? "-Infinity" : "Infinity"; } if (a_is_positive) { if (b_is_positive) { const comparison = compare_positive(a, b); if (comparison === ">") { return long_subtraction(a, b); } else if (comparison === "<") { return "-" + long_subtraction(b, a); } else { return "0"; } } else { return long_addition(a, b.substring(1)); } } else if (b_is_positive) { return "-" + long_addition(a.substring(1), b); } else { a = a.substring(1); b = b.substring(1); const comparison = compare_positive(a, b); if (comparison === ">") { return "-" + long_subtraction(a, b); } else if (comparison === "<") { return long_subtraction(b, a); } else { return "0"; } } } module2.exports = subtract2; module2.exports.default = subtract2; } }); // node_modules/preciso/truncate_decimal.js var require_truncate_decimal = __commonJS({ "node_modules/preciso/truncate_decimal.js"(exports2, module2) { "use strict"; function truncate_decimal(n) { return n.substring(0, n.indexOf(".")); } module2.exports = truncate_decimal; module2.exports.default = truncate_decimal; } }); // node_modules/preciso/round_last_decimal.js var require_round_last_decimal = __commonJS({ "node_modules/preciso/round_last_decimal.js"(exports2, module2) { "use strict"; var add2 = require_add(); var truncate_decimal = require_truncate_decimal(); var up = ["5", "6", "7", "8", "9"]; function round_last_decimal(n) { if (n.match(/\.9+$/)) { return add2(truncate_decimal(n), "1"); } if (n[0] === "+") n = n.substring(1); const len = n.length; let result = ""; const last_char = n[n.length - 1]; if (up.includes(last_char)) { let i; for (i = len - 2; i >= 0; i--) { const char = n[i]; if (char === "." || char === "-") continue; const nchar = Number(char) + 1; if (nchar === 10) { result = "0" + result; } else { result = nchar + result; break; } } if (i > 0) result = n.substring(0, i) + result; } else { result = n.substring(0, len - 1); } if (result[result.length - 1] === ".") result = result.substring(0, result.length - 1); if (result.indexOf(".") > -1) result = result.replace(/0+$/, ""); return result; } module2.exports = round_last_decimal; module2.exports.default = round_last_decimal; } }); // node_modules/preciso/long_division.js var require_long_division = __commonJS({ "node_modules/preciso/long_division.js"(exports2, module2) { "use strict"; var compare_positive = require_compare_positive(); var add2 = require_add(); var subtract2 = require_subtract(); var round_last_decimal = require_round_last_decimal(); function long_division(dividend, divisor, { format = "string", max_decimal_digits = 100, ellipsis = false } = {}) { if (dividend[0] === "0") dividend = dividend.substring(1); if (divisor[0] === "0") divisor = divisor.substring(1); const dividend_index_of_dot = dividend.indexOf("."); const divisor_index_of_dot = divisor.indexOf("."); const adjusted_dividend_index_of_dot = dividend_index_of_dot === -1 ? dividend.length : dividend_index_of_dot; const divisor_num_decimal_places = divisor_index_of_dot === -1 ? 0 : divisor.length - 1 - divisor_index_of_dot; let repeating = false; dividend = dividend.replace(/\./, ""); divisor = divisor.replace(/\./, ""); const dividend_length = dividend.length; let current = ""; let quotient = ""; let comparison; let offset = -1 * divisor_num_decimal_places; let skip = 0; for (let i = 0; i < dividend_length; i++) { const char = dividend[i]; current += char; comparison = compare_positive(current, divisor); if (comparison === ">") { let times = 1; let product = add2(divisor, divisor); let passed_product = divisor; while (compare_positive(product, current) !== ">") { times++; passed_product = product; product = add2(product, divisor); } times = times.toString(); if (quotient !== "") { for (let i2 = times.length; i2 <= skip; i2++) quotient += "0"; } quotient += times; current = subtract2(current, passed_product); skip = 0; } else if (comparison === "<") { if (quotient === "") { offset++; } skip++; continue; } else if (comparison === "=") { if (quotient !== "") { for (let i2 = 0; i2 < skip; i2++) quotient += "0"; } quotient += "1"; current = "0"; skip = 0; } } if (current.match(/^0+$/g)) { if (comparison === "<") { quotient += current.substring(0, current.length - 1); } } else { const previous = {}; const idot2 = adjusted_dividend_index_of_dot - offset; const qlen2 = quotient.length; const imax = idot2 - qlen2 + max_decimal_digits + 1; if (quotient === "") { skip = 0; } for (let i = 0; i < imax; i++) { current += "0"; if (ellipsis) { if (current in previous) { previous[current]++; if (previous[current] > 3) { quotient += "..."; repeating = true; break; } } else { previous[current] = 1; } } const comparison2 = compare_positive(current, divisor); if (comparison2 === ">") { let times = 1; let product = add2(divisor, divisor); let passed_product = divisor; while (compare_positive(product, current) !== ">") { times++; passed_product = product; product = add2(product, divisor); } times = times.toString(); for (let i2 = times.length; i2 <= skip; i2++) quotient += "0"; quotient += times; current = subtract2(current, passed_product); if (current === "0") { break; } skip = 0; } else if (comparison2 === "<") { skip++; continue; } else if (comparison2 === "=") { for (let i2 = 0; i2 < skip; i2++) quotient += "0"; quotient += "1"; skip = 0; break; } } } const idot = adjusted_dividend_index_of_dot - offset; const qlen = quotient.length; let num_decimals; if (idot === qlen) { num_decimals = 0; } else if (idot < 0) { quotient = "0." + "0".repeat(Math.abs(idot)) + quotient; num_decimals = qlen - idot; } else if (idot > qlen) { for (let i = qlen; i < idot; i++) quotient += "0"; num_decimals = 0; } else if (idot < qlen) { quotient = quotient.substring(0, idot) + "." + quotient.substring(idot); num_decimals = qlen - idot; } else if (idot === 0) { quotient = "0." + quotient; num_decimals = qlen; } quotient = quotient.replace(/^0+/, ""); quotient = quotient.replace(/\.\d+0+$/, ""); const extra_decimals = num_decimals - max_decimal_digits; if (!repeating) { if (extra_decimals > 0) { quotient = round_last_decimal(quotient.substring(0, quotient.length - extra_decimals + 1)); } } if (quotient[0] === ".") quotient = "0" + quotient; if (format === "object") { return { quotient, extra_decimals }; } else { return quotient; } } module2.exports = long_division; module2.exports.default = long_division; } }); // node_modules/preciso/divide.js var require_divide = __commonJS({ "node_modules/preciso/divide.js"(exports2, module2) { "use strict"; var absolute = require_absolute(); var clean = require_clean(); var is_infinity = require_is_infinity(); var long_division = require_long_division(); function divide2(dividend, divisor, options) { dividend = clean(dividend); divisor = clean(divisor); const dividend_is_positive = dividend[0] !== "-"; const divisor_is_positive = divisor[0] !== "-"; const dividend_is_infinity = is_infinity(dividend); const divisor_is_infinity = is_infinity(divisor); if (dividend_is_infinity || divisor_is_infinity) { if (dividend_is_positive == divisor_is_positive) { return "Infinity"; } else { return "-Infinity"; } } if (divisor === "0") throw new Error("[preciso] division by zero"); if (dividend === "" || dividend === "0") return "0"; const out_sign = dividend_is_positive !== divisor_is_positive ? "-" : ""; if (!dividend_is_positive) dividend = absolute(dividend); if (!divisor_is_positive) divisor = absolute(divisor); return out_sign + long_division(dividend, divisor, options); } module2.exports = divide2; module2.exports.default = divide2; } }); // node_modules/preciso/is_imaginary.js var require_is_imaginary = __commonJS({ "node_modules/preciso/is_imaginary.js"(exports2, module2) { "use strict"; function is_imaginary(n) { return n.includes("i"); } module2.exports = is_imaginary; module2.exports.default = is_imaginary; } }); // node_modules/preciso/is_integer.js var require_is_integer = __commonJS({ "node_modules/preciso/is_integer.js"(exports2, module2) { "use strict"; var clean = require_clean(); var is_infinity = require_is_infinity(); function is_integer(n) { if (is_infinity(n)) return false; n = clean(n); return !n.includes(".") && !n.includes("/"); } module2.exports = is_integer; module2.exports.default = is_integer; } }); // node_modules/preciso/is_odd.js var require_is_odd = __commonJS({ "node_modules/preciso/is_odd.js"(exports2, module2) { var clean = require_clean(); var is_integer = require_is_integer(); function is_odd(n) { n = clean(n); if (!is_integer(n)) throw new Error("can't call is_odd on decimal"); return ["1", "3", "5", "7", "9"].includes(n.charAt(n.length - 1)); } module2.exports = is_odd; module2.exports.default = is_odd; } }); // node_modules/preciso/is_zero.js var require_is_zero = __commonJS({ "node_modules/preciso/is_zero.js"(exports2, module2) { "use strict"; function is_zero(n) { return /^[-+]?0(\.0+)?(e[\.\d]+)?$/.test(n); } module2.exports = is_zero; module2.exports.default = is_zero; } }); // node_modules/preciso/long_multiplication.js var require_long_multiplication = __commonJS({ "node_modules/preciso/long_multiplication.js"(exports2, module2) { "use strict"; var { MAX_SAFE_INTEGER_LENGTH } = require_max_safe_integer_length(); var CHUNK_SIZE = 15; function long_multiplication(a, b) { if (a === "0" || b === "0") return "0"; const top_index_of_dot = a.indexOf("."); const bottom_index_of_dot = b.indexOf("."); const a_num_integer_places = top_index_of_dot === -1 ? a.length : top_index_of_dot; const b_num_integer_places = bottom_index_of_dot === -1 ? b.length : bottom_index_of_dot; const max_total_num_integer_places = a_num_integer_places + b_num_integer_places; const a_num_decimal_places = top_index_of_dot === -1 ? 0 : a.length - 1 - top_index_of_dot; const b_num_decimal_places = bottom_index_of_dot === -1 ? 0 : b.length - 1 - bottom_index_of_dot; const out_num_decimal_places = a_num_decimal_places + b_num_decimal_places; if (out_num_decimal_places === 0 && max_total_num_integer_places < MAX_SAFE_INTEGER_LENGTH) { return (Number(a) * Number(b)).toFixed(0); } const aint = a.replace(".", ""); const bint = b.replace(".", ""); const alen = aint.length; const blen = bint.length; const chunks = []; let i = alen; while (i >= 0) { const end = i; const start = i -= CHUNK_SIZE; const str = aint.substring(start, end); chunks.push([Number(str), str.length]); } const partial_products = []; const partials = []; for (let i2 = 0, ireverse = blen - 1; ireverse >= 0; ireverse--, i2++) { const bstr = bint[ireverse]; const bnum = Number(bstr); let carried2 = 0; let partial = ""; const ichunklast = chunks.length - 1; chunks.forEach(([chunk, chunklen], c) => { const subpartial = carried2 + bnum * chunk; let subpartstr = subpartial.toString(); const subpartcharlen = subpartstr.length; if (subpartcharlen > chunklen && c !== ichunklast) { const islice = -1 * chunklen; partial = subpartstr.slice(islice) + partial; carried2 = Number(subpartstr.slice(0, islice)); } else { const imax = chunklen - subpartcharlen; for (let i3 = 0; i3 < imax; i3++) { subpartstr = "0" + subpartstr; } carried2 = 0; partial = subpartstr + partial; } }); partial += "0".repeat(i2); partial_products.push(partial); partials.push([Array.from(partial).map((char) => Number(char)), partial.length]); } const num_partials = partial_products.length; const number_of_columns = partials[partials.length - 1][1] + num_partials; let result = ""; let carried = 0; for (let icol = 0; icol < number_of_columns; icol++) { let sum = carried; const pmax = Math.min(icol, num_partials - 1); for (let p = 0; p <= pmax; p++) { const [pnums, plen] = partials[p]; const i2 = plen - 1 - icol; if (i2 >= 0) { sum += pnums[i2]; } } if (sum >= 10) { sum = sum.toString(); result = sum[sum.length - 1] + result; carried = Number(sum.slice(0, -1)); } else { result = sum + result; carried = 0; } } if (out_num_decimal_places === 0) { result = result.replace(/^0+/, ""); } else { const idot = result.length - out_num_decimal_places; result = result.substring(0, idot) + "." + result.substring(idot); result = result.replace(/^0+/, ""); result = result.replace(/\.?0+$/, ""); if (result[0] === ".") result = "0" + result; } return result; } module2.exports = long_multiplication; module2.exports.default = long_multiplication; } }); // node_modules/preciso/count_decimal_digits.js var require_count_decimal_digits = __commonJS({ "node_modules/preciso/count_decimal_digits.js"(exports2, module2) { "use strict"; var clean = require_clean(); function count_decimal_digits(n) { n = clean(n); const i = n.indexOf("."); if (i === -1) return "0"; return (n.length - i - 1).toString(); } module2.exports = count_decimal_digits; module2.exports.default = count_decimal_digits; } }); // node_modules/preciso/is_negative.js var require_is_negative = __commonJS({ "node_modules/preciso/is_negative.js"(exports2, module2) { "use strict"; var clean = require_clean(); function is_negative(n) { n = clean(n); return n[0] === "-"; } module2.exports = is_negative; module2.exports.default = is_negative; } }); // node_modules/preciso/round_rational.js var require_round_rational = __commonJS({ "node_modules/preciso/round_rational.js"(exports2, module2) { "use strict"; var clean = require_clean(); var count_decimal_digits = require_count_decimal_digits(); var absolute = require_absolute(); var is_negative = require_is_negative(); var round_last_decimal = require_round_last_decimal(); var UP = ["5", "6", "7", "8", "9"]; function round_rational(n, { digits = 0 } = { digits: 0 }) { n = clean(n); const orig = n; const sign = is_negative(n) ? "-" : ""; n = absolute(n); const idec = n.indexOf("."); if (idec === -1) return orig; if (count_decimal_digits(n) <= digits) return orig; const v = n[idec + digits + 1]; if (UP.includes(v)) { const clip = n.substring(0, idec + digits + 2); return sign + round_last_decimal(clip); } else if (digits === 0) { return sign + n.substring(0, idec); } else { const clip = n.substring(0, idec + digits + 1); return sign + clip; } } module2.exports = round_rational; module2.exports.default = round_rational; } }); // node_modules/preciso/round.js var require_round = __commonJS({ "node_modules/preciso/round.js"(exports2, module2) { "use strict"; var is_imaginary = require_is_imaginary(); var round_rational = require_round_rational(); function round(n, { digits = 0 } = {}) { digits = Number(digits); if (is_imaginary(n)) { return round_rational(n.substring(0, n.length - 1), { digits }) + "i"; } else { return round_rational(n, { digits }); } } module2.exports = round; module2.exports.default = round; } }); // node_modules/preciso/multiply_rational.js var require_multiply_rational = __commonJS({ "node_modules/preciso/multiply_rational.js"(exports2, module2) { "use strict"; var absolute = require_absolute(); var clean = require_clean(); var compare_positive = require_compare_positive(); var long_multiplication = require_long_multiplication(); var round = require_round(); function multiply_rational(nums, { max_decimal_digits } = {}) { let product = clean(nums[0]); let product_absolute = absolute(product); let product_sign = product[0] === "-" ? "-" : ""; const imax = nums.length; for (let i = 1; i < imax; i++) { const current = clean(nums[i]); const current_sign = current[0] === "-" ? "-" : ""; const current_absolute = absolute(current); product_sign = product_sign !== current_sign ? "-" : ""; const comparison = compare_positive(product_absolute, current_absolute); product_absolute = comparison === "<" ? long_multiplication(current_absolute, product_absolute) : long_multiplication(product_absolute, current_absolute); product = product_sign + product_absolute; } if (typeof max_decimal_digits === "number") product = round(product, { digits: max_decimal_digits }); return product; } module2.exports = multiply_rational; module2.exports.default = multiply_rational; } }); // node_modules/preciso/sign_nonzero.js var require_sign_nonzero = __commonJS({ "node_modules/preciso/sign_nonzero.js"(exports2, module2) { "use strict"; function sign_nonzero(n) { return n[0] === "-" ? "-" : "+"; } module2.exports = sign_nonzero; module2.exports.default = sign_nonzero; } }); // node_modules/preciso/multiply_array.js var require_multiply_array = __commonJS({ "node_modules/preciso/multiply_array.js"(exports2, module2) { "use strict"; var is_imaginary = require_is_imaginary(); var is_infinity = require_is_infinity(); var is_odd = require_is_odd(); var is_zero = require_is_zero(); var multiply_rational = require_multiply_rational(); var sign_nonzero = require_sign_nonzero(); function multiply_array(nums, { max_decimal_digits, infinity_times_zero = "NaN" } = {}) { const has_inf = nums.some((n) => is_infinity(n)); const has_zero = nums.some((n) => is_zero(n)); if (has_inf && has_zero) { return infinity_times_zero; } else if (has_inf) { const ct = nums.filter((n) => sign_nonzero(n) === "-").length; return ct % 2 === 0 ? "Infinity" : "-Infinity"; } else if (has_zero) { return "0"; } const imaginary = is_odd(nums.filter((n) => is_imaginary(n)).length.toString()); let product = multiply_rational( nums.map((n) => n.replace(/i$/, "")), { max_decimal_digits } ); if (imaginary) product += "i"; return product; } module2.exports = multiply_array; module2.exports.default = multiply_array; } }); // node_modules/preciso/multiply.js var require_multiply = __commonJS({ "node_modules/preciso/multiply.js"(exports2, module2) { "use strict"; var multiply_array = require_multiply_array(); function multiply2() { const args = Array.from(arguments); const options = typeof args[args.length - 1] === "object" ? args[args.length - 1] : void 0; const nums = Array.isArray(args[0]) ? args[0] : options ? args.slice(0, args.length - 1) : args; return multiply_array(nums, options); } module2.exports = multiply2; module2.exports.default = multiply2; } }); // node_modules/bbox-fns/bbox-array.js var require_bbox_array = __commonJS({ "node_modules/bbox-fns/bbox-array.js"(exports2, module2) { "use strict"; function bboxArray2(points, { nan_strategy = "throw" } = { nan_strategy: "throw" }) { const count = points.length; let xmin = null; let xmax = null; let ymin = null; let ymax = null; for (let i = 0; i < count; i++) { const [x, y] = points[i]; if (isNaN(x)) { if (nan_strategy === "throw") { throw new Error("[bbox-fns/bbox-array] encountered point with a NaN value: [" + x + ", " + y + "]"); } } else if (xmin === null) { xmin = x; xmax = x; } else { if (x < xmin) xmin = x; else if (x > xmax) xmax = x; } if (isNaN(y)) { if (nan_strategy === "throw") { throw new Error("[bbox-fns/bbox-array] encountered point with a NaN value: [" + x + ", " + y + "]"); } } else if (ymin === null) { ymin = y; ymax = y; } else { if (y < ymin) ymin = y; else if (y > ymax) ymax = y; } } return [xmin, ymin, xmax, ymax]; } module2.exports = bboxArray2; module2.exports.default = bboxArray2; } }); // node_modules/bbox-fns/boolean-contains.js var require_boolean_contains = __commonJS({ "node_modules/bbox-fns/boolean-contains.js"(exports2, module2) { "use_strict"; function booleanContains2([axmin, aymin, axmax, aymax], [bxmin, bymin, bxmax, bymax], { exclusive = false } = { exclusive: false }) { if (exclusive) { const xContained = bxmin > axmin && bxmax < axmax; const yContained = bymin > aymin && bymax < aymax; return xContained && yContained; } else { const xContained = bxmin >= axmin && bxmax <= axmax; const yContained = bymin >= aymin && bymax <= aymax; return xContained && yContained; } } module2.exports = booleanContains2; module2.exports.default = booleanContains2; } }); // node_modules/bbox-fns/boolean-intersects.js var require_boolean_intersects = __commonJS({ "node_modules/bbox-fns/boolean-intersects.js"(exports2, module2) { "use_strict"; function booleanIntersects2([axmin, aymin, axmax, aymax], [bxmin, bymin, bxmax, bymax]) { const yOverlaps = bymin <= aymax && bymax >= aymin; const xOverlaps = bxmin <= axmax && bxmax >= axmin; return xOverlaps && yOverlaps; } module2.exports = booleanIntersects2; module2.exports.default = booleanIntersects2; } }); // node_modules/bbox-fns/dense-polygon.js var require_dense_polygon = __commonJS({ "node_modules/bbox-fns/dense-polygon.js"(exports2, module2) { "use_strict"; function densePolygon2([xmin, ymin, xmax, ymax], { density = 0 } = { density: 0 }) { if (typeof density === "number") density = [density, density]; const [x_density, y_density] = density; const height = ymax - ymin; const width = xmax - xmin; const ring = []; const x_distance = width / (x_density + 1); const y_distance = height / (y_density + 1); ring.push([xmin, ymax]); for (let i = 1; i <= y_density; i++) ring.push([xmin, ymax - i * y_distance]); ring.push([xmin, ymin]); for (let i = 1; i <= x_density; i++) ring.push([xmin + i * x_distance, ymin]); ring.push([xmax, ymin]); for (let i = 1; i <= y_density; i++) ring.push([xmax, ymin + i * y_distance]); ring.push([xmax, ymax]); for (let i = 1; i <= x_density; i++) ring.push([xmax - i * x_distance, ymax]); ring.push([xmin, ymax]); return [ring]; } module2.exports = densePolygon2; module2.exports.default = densePolygon2; } }); // node_modules/bbox-fns/shift.js var require_shift = __commonJS({ "node_modules/bbox-fns/shift.js"(exports2, module2) { function shift([xmin, ymin, xmax, ymax], dist) { const x = Array.isArray(dist) && dist.length >= 1 ? dist[0] : typeof dist.x === "number" ? dist.x : 0; const y = Array.isArray(dist) && dist.length >= 2 ? dist[1] : typeof dist.y === "number" ? dist.y : 0; return [xmin + x, ymin + y, xmax + x, ymax + y]; } module2.exports = shift; module2.exports.default = shift; } }); // node_modules/bbox-fns/sort.js var require_sort = __commonJS({ "node_modules/bbox-fns/sort.js"(exports2, module2) { function sort(bboxes) { return bboxes.sort((a, b) => { const [axmin, aymin, axmax, aymax] = a; const [bxmin, bymin, bxmax, bymax] = b; if (axmin < bxmin) return -1; if (axmin > bxmin) return 1; if (aymin < bymin) return 1; if (aymin > bymin) return -1; return 0; }); } module2.exports = sort; module2.exports.default = sort; } }); // node_modules/bbox-fns/split.js var require_split = __commonJS({ "node_modules/bbox-fns/split.js"(exports2, module2) { "use strict"; function split(bbox, breakpoints) { const [xmin, ymin, xmax, ymax] = bbox; if (!breakpoints) throw new Error("[bbox-fns/split.js] missing breakpoints"); const xbrks = breakpoints.x || []; const ybrks = breakpoints.y || []; const xedges = [xmin].concat(xbrks.filter((x) => x > xmin && x < xmax)).concat([xmax]); const yedges = [ymin].concat(ybrks.filter((y) => y > ymin && y < ymax)).concat([ymax]); const bboxes = []; for (let i = 1; i < xedges.length; i++) { const xmin2 = xedges[i - 1]; const xmax2 = xedges[i]; for (let ii = 1; ii < yedges.length; ii++) { const ymin2 = yedges[ii - 1]; const ymax2 = yedges[ii]; bboxes.push([xmin2, ymin2, xmax2, ymax2]); } } return bboxes; } module2.exports = split; module2.exports.default = split; } }); // node_modules/bbox-fns/merge.js var require_merge = __commonJS({ "node_modules/bbox-fns/merge.js"(exports2, module2) { "use strict"; function merge(bboxes) { if (bboxes.length === 0) return; if (bboxes.length === 1) return bboxes[0]; let [xmin, ymin, xmax, ymax] = bboxes[0]; for (let i = 1; i < bboxes.length; i++) { const bbox = bboxes[i]; if (bbox[0] < xmin) xmin = bbox[0]; if (bbox[1] < ymin) ymin = bbox[1]; if (bbox[2] > xmax) xmax = bbox[2]; if (bbox[3] > ymax) ymax = bbox[3]; } return [xmin, ymin, xmax, ymax]; } module2.exports = merge; module2.exports.default = merge; } }); // node_modules/bbox-fns/union.js var require_union = __commonJS({ "node_modules/bbox-fns/union.js"(exports2, module2) { "use strict"; var booleanIntersects2 = require_boolean_intersects(); var merge = require_merge(); function union(bboxes) { if (bboxes.length === 0) return []; if (bboxes.length === 1) return [bboxes[0]]; let results = [bboxes[0]]; for (let i = 1; i < bboxes.length; i++) { const bbox = bboxes[i]; const matches = results.filter((it) => booleanIntersects2(bbox, it)); const merged = merge(matches.concat([bbox])); const unmatched = results.filter((it) => !matches.includes(it)); results = [merged].concat(unmatched); } return results; } module2.exports = union; module2.exports.default = union; } }); // node_modules/bbox-fns/unwrap.js var require_unwrap = __commonJS({ "node_modules/bbox-fns/unwrap.js"(exports2, module2) { "use_strict"; var shift = require_shift(); var sort = require_sort(); var split = require_split(); var union = require_union(); function unwrap2(bbox, container) { const [global_xmin, global_ymin, global_xmax, global_ymax] = container; const global_width = global_xmax - global_xmin; const global_height = global_ymax - global_ymin; const breakpoints = { x: [global_xmin - global_width, global_xmin, global_xmax, global_xmax + global_width], y: [global_ymin - global_height, global_ymin, global_ymax, global_ymax + global_height] }; let bboxes = split(bbox, breakpoints); bboxes = bboxes.map((b) => { const [xmin, ymin, xmax, ymax] = b; return shift(b, { x: Math.ceil((global_xmin - xmin) / global_width) * global_width, y: Math.ceil((global_ymin - ymin) / global_height) * global_height }); }); bboxes = union(bboxes); bboxes = sort(bboxes); return bboxes; } module2.exports = unwrap2; module2.exports.default = unwrap2; } }); // node_modules/get-epsg-code/dist/get-epsg-code.node.min.js var require_get_epsg_code_node_min = __commonJS({ "node_modules/get-epsg-code/dist/get-epsg-code.node.min.js"(exports2, module2) { var oe = Object.defineProperty; var s = (A, e) => oe(A, "name", { value: e, configurable: true }); var D = (A, e) => () => (e || A((e = { exports: {} }).exports, e), e.exports); var sA = D((rt, P) => { var B = {}; B.char2bits = { 0: "110100", 1: "110101", 2: "110110", 3: "110111", 4: "111000", 5: "111001", 6: "111010", 7: "111011", 8: "111100", 9: "111101", A: "000000", Q: "010000", g: "100000", w: "110000", B: "000001", R: "010001", h: "100001", x: "110001", C: "000010", S: "010010", i: "100010", y: "110010", D: "000011", T: "010011", j: "100011", z: "110011", E: "000100", U: "010100", k: "100100", F: "000101", V: "010101", l: "100101", G: "000110", W: "010110", m: "100110", H: "000111", X: "010111", n: "100111", I: "001000", Y: "011000", o: "101000", J: "001001", Z: "011001", p: "101001", K: "001010", a: "011010", q: "101010", L: "001011", b: "011011", r: "101011", M: "001100", c: "011100", s: "101100", N: "001101", d: "011101", t: "101101", O: "001110", e: "011110", u: "101110", "+": "111110", P: "001111", f: "011111", v: "101111", "/": "111111" }; B.toArrayBuffer = s(function(e) { var t = B.char2bits, r = 0; for (let f = e.length; f >= 0; f--) e[f] === "=" && r++; for (var o = e.length - r, g = Math.floor(0.75 * o), n = new Uint8Array(g), C = "", Q = 0; Q < o; Q++) { var i = e[Q]; if (i === "=") break; C += t[i], C.length >= 8 && (n[Math.floor(0.75 * Q)] = parseInt(C.substring(0, 8), 2), C = C.substring(8)); } return n.buffer; }, "toArrayBuffer"); B.toBase64String = s(function(e) { if (!B.bits2char) { B.bits2char = {}; for (let Q in B.char2bits) B.bits2char[B.char2bits[Q]] = Q; } for (var t = B.bits2char, r = new Uint8Array(e), o = "", g = "", n = 0; n < r.length; n++) { for (var C = r[n].toString(2); C.length < 8; ) C = "0" + C; for (g += C; g.length >= 6; ) o += t[g.substring(0, 6)], g = g.substring(6); } if (g.length > 0) { for (; g.length < 6; ) g += "0"; o += t[g]; } for (; o.length % 4 !== 0; ) o += "="; return o; }, "toBase64String"); typeof define == "function" && define.amd && define(function() { return B; }); typeof P == "object" && (P.exports = B); typeof window == "object" && (window.b64ab = B); typeof self == "object" && (self.b64ab = B); }); var nA = D((gt, L) => { function QA(A, e, t) { let o = new RegExp(e).exec(A.slice(t)); return o ? t + o.index : -1; } s(QA, "indexOfMatch"); L.exports = QA; L.exports.default = QA; }); var DA = D((st, T) => { function iA(A, e, t) { let o = new RegExp(e).exec(A.slice(t)); return o ? t + o.index + o[0].length - 1 : -1; } s(iA, "indexOfMatchEnd"); T.exports = iA; T.exports.default = iA; }); var aA = D((nt, K) => { function fA(A, e) { let t = new RegExp(e, "g"), r = A.match(t); return r ? r.length : 0; } s(fA, "countSubstring"); K.exports = fA; K.exports.default = fA; }); var U = D((Dt, y) => { var ge = nA(), m = DA(), BA = aA(); function EA(A, e, t) { let r = t && t.debug || false, o = !(t && typeof t.nested === false), g = t && t.startIndex || 0; r && console.log("[xml-utils] starting findTagByName with", e, " and ", t); let n = ge(A, `<${e}[ >/]`, g); if (r && console.log("[xml-utils] start:", n), n === -1) return; let C = A.slice(n + e.length), Q = m(C, "^[^<]*[ /]>", 0), i = Q !== -1 && C[Q - 1] === "/"; if (r && console.log("[xml-utils] selfClosing:", i), i === false) if (o) { let J = 0, oA = 1, gA = 0; for (; (Q = m(C, "[ /]" + e + ">", J)) !== -1; ) { let CA = C.substring(J, Q + 1); if (oA += BA(CA, "<" + e + `[ >]`), gA += BA(CA, "</" + e + ">"), gA >= oA) break; J = Q; } } else Q = m(C, "[ /]" + e + ">", 0); let f = n + e.length + Q + 1; if (r && console.log("[xml-utils] end:", f), f === -1) return; let a = A.slice(n, f), l; return i ? l = null : l = a.slice(a.indexOf(">") + 1, a.lastIndexOf("<")), { inner: l, outer: a, start: n, end: f }; } s(EA, "findTagByName"); y.exports = EA; y.exports.default = EA; }); var lA = D((at, S) => { var Ce = U(); function cA(A, e, t) { let r = [], o = t && t.debug || false, g = t && typeof t.nested == "boolean" ? t.nested : true, n = t && t.startIndex || 0, C; for (; C = Ce(A, e, { debug: o, startIndex: n }); ) g ? n = C.start + 1 + e.length : n = C.end, r.push(C); return o && console.log("findTagsByName found", r.length, "tags"), r; } s(cA, "findTagsByName"); S.exports = cA; S.exports.default = cA; }); var uA = D((Et, V) => { var wA = lA();