@bicharts/chart-host 0.5.89 → 0.5.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-NWMMNXH2.mjs → chunk-GUCTCDEO.mjs} +1797 -1146
- package/dist/index.mjs +300 -810
- package/dist/react.mjs +1 -1
- package/dist/types/colourSpread.d.ts +75 -0
- package/dist/types/host.d.ts +16 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -18,418 +18,418 @@ var require_papaparse_min = __commonJS({
|
|
|
18
18
|
https://github.com/mholt/PapaParse
|
|
19
19
|
License: MIT
|
|
20
20
|
*/
|
|
21
|
-
((
|
|
22
|
-
"function" == typeof define && define.amd ? define([],
|
|
23
|
-
})(exports, function
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
function
|
|
27
|
-
return 65279 ===
|
|
21
|
+
((e2, t2) => {
|
|
22
|
+
"function" == typeof define && define.amd ? define([], t2) : "object" == typeof module && "undefined" != typeof exports ? module.exports = t2() : e2.Papa = t2();
|
|
23
|
+
})(exports, function r2() {
|
|
24
|
+
var n2 = "undefined" != typeof self ? self : "undefined" != typeof window ? window : void 0 !== n2 ? n2 : {};
|
|
25
|
+
var d2, s4 = !n2.document && !!n2.postMessage, a5 = n2.IS_PAPA_WORKER || false, o2 = {}, h3 = 0, v4 = {};
|
|
26
|
+
function P5(e2) {
|
|
27
|
+
return 65279 === e2.charCodeAt(0) ? e2.slice(1) : e2;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
this._handle = null, this._finished = false, this._completed = false, this._halted = false, this._input = null, this._baseIndex = 0, this._partialLine = "", this._rowCount = 0, this._start = 0, this._nextChunk = null, this.isFirstChunk = true, this._completeResults = { data: [], errors: [], meta: {} }, function(
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
this._handle = new
|
|
34
|
-
}.call(this,
|
|
35
|
-
var
|
|
36
|
-
if (this.isFirstChunk && 0 <
|
|
37
|
-
let
|
|
38
|
-
|
|
29
|
+
function u5(e2) {
|
|
30
|
+
this._handle = null, this._finished = false, this._completed = false, this._halted = false, this._input = null, this._baseIndex = 0, this._partialLine = "", this._rowCount = 0, this._start = 0, this._nextChunk = null, this.isFirstChunk = true, this._completeResults = { data: [], errors: [], meta: {} }, function(e4) {
|
|
31
|
+
var t2 = b4(e4);
|
|
32
|
+
t2.chunkSize = parseInt(t2.chunkSize), e4.step || e4.chunk || (t2.chunkSize = null);
|
|
33
|
+
this._handle = new i4(t2), (this._handle.streamer = this)._config = t2;
|
|
34
|
+
}.call(this, e2), this.parseChunk = function(t2, e4) {
|
|
35
|
+
var i5 = parseInt(this._config.skipFirstNLines) || 0;
|
|
36
|
+
if (this.isFirstChunk && 0 < i5) {
|
|
37
|
+
let e5 = this._config.newline;
|
|
38
|
+
e5 || (r4 = this._config.quoteChar || '"', e5 = this._handle.guessLineEndings(t2, r4)), t2 = [...t2.split(e5).slice(i5)].join(e5);
|
|
39
39
|
}
|
|
40
|
-
this.isFirstChunk &&
|
|
41
|
-
var
|
|
40
|
+
this.isFirstChunk && q4(this._config.beforeFirstChunk) && void 0 !== (r4 = this._config.beforeFirstChunk(t2)) && (t2 = r4), this.isFirstChunk = false, this._halted = false;
|
|
41
|
+
var i5 = this._partialLine + t2, r4 = (this._partialLine = "", this._handle.parse(i5, this._baseIndex, !this._finished));
|
|
42
42
|
if (!this._handle.paused() && !this._handle.aborted()) {
|
|
43
|
-
|
|
44
|
-
if (
|
|
45
|
-
else if (
|
|
46
|
-
if (this._config.chunk(
|
|
47
|
-
this._completeResults =
|
|
43
|
+
t2 = r4.meta.cursor, i5 = (this._finished || (this._partialLine = i5.substring(t2 - this._baseIndex), this._baseIndex = t2), r4 && r4.data && (this._rowCount += r4.data.length), this._finished || this._config.preview && this._rowCount >= this._config.preview);
|
|
44
|
+
if (a5) n2.postMessage({ results: r4, workerId: v4.WORKER_ID, finished: i5 });
|
|
45
|
+
else if (q4(this._config.chunk) && !e4) {
|
|
46
|
+
if (this._config.chunk(r4, this._handle), this._handle.paused() || this._handle.aborted()) return void (this._halted = true);
|
|
47
|
+
this._completeResults = r4 = void 0;
|
|
48
48
|
}
|
|
49
|
-
return this._config.step || this._config.chunk || (this._completeResults.data = this._completeResults.data.concat(
|
|
49
|
+
return this._config.step || this._config.chunk || (this._completeResults.data = this._completeResults.data.concat(r4.data), this._completeResults.errors = this._completeResults.errors.concat(r4.errors), this._completeResults.meta = r4.meta), this._completed || !i5 || !q4(this._config.complete) || r4 && r4.meta.aborted || (this._config.complete(this._completeResults, this._input), this._completed = true), i5 || r4 && r4.meta.paused || this._nextChunk(), r4;
|
|
50
50
|
}
|
|
51
51
|
this._halted = true;
|
|
52
|
-
}, this._sendError = function(
|
|
53
|
-
|
|
52
|
+
}, this._sendError = function(e4) {
|
|
53
|
+
q4(this._config.error) ? this._config.error(e4) : a5 && this._config.error && n2.postMessage({ workerId: v4.WORKER_ID, error: e4, finished: false });
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
var
|
|
58
|
-
(
|
|
56
|
+
function f4(e2) {
|
|
57
|
+
var r4;
|
|
58
|
+
(e2 = e2 || {}).chunkSize || (e2.chunkSize = v4.RemoteChunkSize), u5.call(this, e2), this._nextChunk = s4 ? function() {
|
|
59
59
|
this._readChunk(), this._chunkLoaded();
|
|
60
60
|
} : function() {
|
|
61
61
|
this._readChunk();
|
|
62
|
-
}, this.stream = function(
|
|
63
|
-
this._input =
|
|
62
|
+
}, this.stream = function(e4) {
|
|
63
|
+
this._input = e4, this._nextChunk();
|
|
64
64
|
}, this._readChunk = function() {
|
|
65
65
|
if (this._finished) this._chunkLoaded();
|
|
66
66
|
else {
|
|
67
|
-
if (
|
|
68
|
-
var
|
|
69
|
-
for (
|
|
67
|
+
if (r4 = new XMLHttpRequest(), this._config.withCredentials && (r4.withCredentials = this._config.withCredentials), s4 || (r4.onload = y5(this._chunkLoaded, this), r4.onerror = y5(this._chunkError, this)), r4.open(this._config.downloadRequestBody ? "POST" : "GET", this._input, !s4), this._config.downloadRequestHeaders) {
|
|
68
|
+
var e4, t2 = this._config.downloadRequestHeaders;
|
|
69
|
+
for (e4 in t2) r4.setRequestHeader(e4, t2[e4]);
|
|
70
70
|
}
|
|
71
|
-
var
|
|
72
|
-
this._config.chunkSize && (
|
|
71
|
+
var i5;
|
|
72
|
+
this._config.chunkSize && (i5 = this._start + this._config.chunkSize - 1, r4.setRequestHeader("Range", "bytes=" + this._start + "-" + i5));
|
|
73
73
|
try {
|
|
74
|
-
|
|
75
|
-
} catch (
|
|
76
|
-
this._chunkError(
|
|
74
|
+
r4.send(this._config.downloadRequestBody);
|
|
75
|
+
} catch (e5) {
|
|
76
|
+
this._chunkError(e5.message);
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
s4 && 0 === r4.status && this._chunkError();
|
|
79
79
|
}
|
|
80
80
|
}, this._chunkLoaded = function() {
|
|
81
|
-
4 ===
|
|
82
|
-
}, this._chunkError = function(
|
|
83
|
-
|
|
84
|
-
this._sendError(new Error(
|
|
81
|
+
4 === r4.readyState && (r4.status < 200 || 400 <= r4.status ? this._chunkError() : (this._start += this._config.chunkSize || r4.responseText.length, this._finished = !this._config.chunkSize || this._start >= ((e4) => null !== (e4 = e4.getResponseHeader("Content-Range")) ? parseInt(e4.substring(e4.lastIndexOf("/") + 1)) : -1)(r4), this.parseChunk(r4.responseText)));
|
|
82
|
+
}, this._chunkError = function(e4) {
|
|
83
|
+
e4 = r4.statusText || e4;
|
|
84
|
+
this._sendError(new Error(e4));
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
(
|
|
89
|
-
var
|
|
90
|
-
this.stream = function(
|
|
91
|
-
this._input =
|
|
87
|
+
function l3(e2) {
|
|
88
|
+
(e2 = e2 || {}).chunkSize || (e2.chunkSize = v4.LocalChunkSize), u5.call(this, e2);
|
|
89
|
+
var i5, r4, n4 = "undefined" != typeof FileReader;
|
|
90
|
+
this.stream = function(e4) {
|
|
91
|
+
this._input = e4, r4 = e4.slice || e4.webkitSlice || e4.mozSlice, n4 ? ((i5 = new FileReader()).onload = y5(this._chunkLoaded, this), i5.onerror = y5(this._chunkError, this)) : i5 = new FileReaderSync(), this._nextChunk();
|
|
92
92
|
}, this._nextChunk = function() {
|
|
93
93
|
this._finished || this._config.preview && !(this._rowCount < this._config.preview) || this._readChunk();
|
|
94
94
|
}, this._readChunk = function() {
|
|
95
|
-
var
|
|
96
|
-
|
|
97
|
-
}, this._chunkLoaded = function(
|
|
98
|
-
this._start += this._config.chunkSize, this._finished = !this._config.chunkSize || this._start >= this._input.size, this.parseChunk(
|
|
95
|
+
var e4 = this._input, t2 = (this._config.chunkSize && (t2 = Math.min(this._start + this._config.chunkSize, this._input.size), e4 = r4.call(e4, this._start, t2)), i5.readAsText(e4, this._config.encoding));
|
|
96
|
+
n4 || this._chunkLoaded({ target: { result: t2 } });
|
|
97
|
+
}, this._chunkLoaded = function(e4) {
|
|
98
|
+
this._start += this._config.chunkSize, this._finished = !this._config.chunkSize || this._start >= this._input.size, this.parseChunk(e4.target.result);
|
|
99
99
|
}, this._chunkError = function() {
|
|
100
|
-
this._sendError(
|
|
100
|
+
this._sendError(i5.error);
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
-
function
|
|
104
|
-
var
|
|
105
|
-
|
|
106
|
-
return
|
|
103
|
+
function c4(e2) {
|
|
104
|
+
var i5;
|
|
105
|
+
u5.call(this, e2 = e2 || {}), this.stream = function(e4) {
|
|
106
|
+
return i5 = e4, this._nextChunk();
|
|
107
107
|
}, this._nextChunk = function() {
|
|
108
|
-
var
|
|
109
|
-
if (!this._finished) return
|
|
108
|
+
var e4, t2;
|
|
109
|
+
if (!this._finished) return e4 = this._config.chunkSize, i5 = e4 ? (t2 = i5.substring(0, e4), i5.substring(e4)) : (t2 = i5, ""), this._finished = !i5, this.parseChunk(t2);
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
|
|
114
|
-
var
|
|
112
|
+
function p4(e2) {
|
|
113
|
+
u5.call(this, e2 = e2 || {});
|
|
114
|
+
var t2 = [], i5 = true, r4 = false;
|
|
115
115
|
this.pause = function() {
|
|
116
|
-
|
|
116
|
+
u5.prototype.pause.apply(this, arguments), this._input.pause();
|
|
117
117
|
}, this.resume = function() {
|
|
118
|
-
|
|
119
|
-
}, this.stream = function(
|
|
120
|
-
this._input =
|
|
118
|
+
u5.prototype.resume.apply(this, arguments), this._input.resume();
|
|
119
|
+
}, this.stream = function(e4) {
|
|
120
|
+
this._input = e4, this._input.on("data", this._streamData), this._input.on("end", this._streamEnd), this._input.on("error", this._streamError);
|
|
121
121
|
}, this._checkIsFinished = function() {
|
|
122
|
-
|
|
122
|
+
r4 && 1 === t2.length && (this._finished = true);
|
|
123
123
|
}, this._nextChunk = function() {
|
|
124
|
-
this._checkIsFinished(),
|
|
125
|
-
}, this._streamData =
|
|
124
|
+
this._checkIsFinished(), t2.length ? this.parseChunk(t2.shift()) : i5 = true;
|
|
125
|
+
}, this._streamData = y5(function(e4) {
|
|
126
126
|
try {
|
|
127
|
-
|
|
128
|
-
} catch (
|
|
129
|
-
this._streamError(
|
|
127
|
+
t2.push("string" == typeof e4 ? e4 : e4.toString(this._config.encoding)), i5 && (i5 = false, this._checkIsFinished(), this.parseChunk(t2.shift()));
|
|
128
|
+
} catch (e5) {
|
|
129
|
+
this._streamError(e5);
|
|
130
130
|
}
|
|
131
|
-
}, this), this._streamError =
|
|
132
|
-
this._streamCleanUp(), this._sendError(
|
|
133
|
-
}, this), this._streamEnd =
|
|
134
|
-
this._streamCleanUp(),
|
|
135
|
-
}, this), this._streamCleanUp =
|
|
131
|
+
}, this), this._streamError = y5(function(e4) {
|
|
132
|
+
this._streamCleanUp(), this._sendError(e4);
|
|
133
|
+
}, this), this._streamEnd = y5(function() {
|
|
134
|
+
this._streamCleanUp(), r4 = true, this._streamData("");
|
|
135
|
+
}, this), this._streamCleanUp = y5(function() {
|
|
136
136
|
this._input.removeListener("data", this._streamData), this._input.removeListener("end", this._streamEnd), this._input.removeListener("error", this._streamError);
|
|
137
137
|
}, this);
|
|
138
138
|
}
|
|
139
|
-
function
|
|
140
|
-
var
|
|
141
|
-
function
|
|
142
|
-
return "greedy" ===
|
|
139
|
+
function i4(m4) {
|
|
140
|
+
var n4, s5, a6, t2, o4 = Math.pow(2, 53), h4 = -o4, u6 = /^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/, d3 = /^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/, i5 = this, r4 = 0, f5 = 0, l4 = false, e2 = false, c5 = [], p5 = { data: [], errors: [], meta: {} };
|
|
141
|
+
function y6(e4) {
|
|
142
|
+
return "greedy" === m4.skipEmptyLines ? "" === e4.join("").trim() : 1 === e4.length && 0 === e4[0].length;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
if (
|
|
146
|
-
return !
|
|
147
|
-
})),
|
|
148
|
-
let
|
|
149
|
-
|
|
144
|
+
function g5() {
|
|
145
|
+
if (p5 && a6 && (k3("Delimiter", "UndetectableDelimiter", "Unable to auto-detect delimiting character; defaulted to '" + v4.DefaultDelimiter + "'"), a6 = false), m4.skipEmptyLines && (p5.data = p5.data.filter(function(e5) {
|
|
146
|
+
return !y6(e5);
|
|
147
|
+
})), _4()) {
|
|
148
|
+
let t5 = function(e5, t6) {
|
|
149
|
+
e5 = P5(e5), q4(m4.transformHeader) && (e5 = m4.transformHeader(e5, t6)), c5.push(e5);
|
|
150
150
|
};
|
|
151
|
-
var
|
|
152
|
-
if (
|
|
153
|
-
for (var
|
|
154
|
-
|
|
155
|
-
} else
|
|
151
|
+
var t4 = t5;
|
|
152
|
+
if (p5) if (Array.isArray(p5.data[0])) {
|
|
153
|
+
for (var e4 = 0; _4() && e4 < p5.data.length; e4++) p5.data[e4].forEach(t5);
|
|
154
|
+
p5.data.splice(0, 1);
|
|
155
|
+
} else p5.data.forEach(t5);
|
|
156
156
|
}
|
|
157
|
-
function
|
|
158
|
-
for (var
|
|
159
|
-
var
|
|
160
|
-
if (
|
|
161
|
-
|
|
162
|
-
if (
|
|
157
|
+
function i6(e5, t5) {
|
|
158
|
+
for (var i7 = m4.header ? {} : [], r6 = 0; r6 < e5.length; r6++) {
|
|
159
|
+
var n5 = r6, s6 = e5[r6], s6 = ((e6, t6) => ((e7) => (m4.dynamicTypingFunction && void 0 === m4.dynamicTyping[e7] && (m4.dynamicTyping[e7] = m4.dynamicTypingFunction(e7)), true === (m4.dynamicTyping[e7] || m4.dynamicTyping)))(e6) ? "true" === t6 || "TRUE" === t6 || "false" !== t6 && "FALSE" !== t6 && (((e7) => {
|
|
160
|
+
if (u6.test(e7)) {
|
|
161
|
+
e7 = parseFloat(e7);
|
|
162
|
+
if (h4 < e7 && e7 < o4) return 1;
|
|
163
163
|
}
|
|
164
|
-
})(
|
|
165
|
-
"__parsed_extra" ===
|
|
164
|
+
})(t6) ? parseFloat(t6) : d3.test(t6) ? new Date(t6) : "" === t6 ? null : t6) : t6)(n5 = m4.header ? r6 >= c5.length ? "__parsed_extra" : c5[r6] : n5, s6 = m4.transform ? m4.transform(s6, n5) : s6);
|
|
165
|
+
"__parsed_extra" === n5 ? (i7[n5] = i7[n5] || [], i7[n5].push(s6)) : i7[n5] = s6;
|
|
166
166
|
}
|
|
167
|
-
return
|
|
167
|
+
return m4.header && (r6 > c5.length ? k3("FieldMismatch", "TooManyFields", "Too many fields: expected " + c5.length + " fields but parsed " + r6, f5 + t5) : r6 < c5.length && k3("FieldMismatch", "TooFewFields", "Too few fields: expected " + c5.length + " fields but parsed " + r6, f5 + t5)), i7;
|
|
168
168
|
}
|
|
169
|
-
var
|
|
170
|
-
|
|
169
|
+
var r5;
|
|
170
|
+
p5 && (m4.header || m4.dynamicTyping || m4.transform) && (r5 = 1, !p5.data.length || Array.isArray(p5.data[0]) ? (p5.data = p5.data.map(i6), r5 = p5.data.length) : p5.data = i6(p5.data, 0), m4.header && p5.meta && (p5.meta.fields = c5), f5 += r5);
|
|
171
171
|
}
|
|
172
|
-
function
|
|
173
|
-
return
|
|
172
|
+
function _4() {
|
|
173
|
+
return m4.header && 0 === c5.length;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
|
|
177
|
-
void 0 !==
|
|
175
|
+
function k3(e4, t4, i6, r5) {
|
|
176
|
+
e4 = { type: e4, code: t4, message: i6 };
|
|
177
|
+
void 0 !== r5 && (e4.row = r5), p5.errors.push(e4);
|
|
178
178
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}), this.parse = function(
|
|
182
|
-
var
|
|
183
|
-
var
|
|
184
|
-
|
|
185
|
-
for (var
|
|
186
|
-
for (var
|
|
187
|
-
0 <
|
|
179
|
+
q4(m4.step) && (t2 = m4.step, m4.step = function(e4) {
|
|
180
|
+
p5 = e4, _4() ? g5() : (g5(), 0 !== p5.data.length && (r4 += e4.data.length, m4.preview && r4 > m4.preview ? s5.abort() : (p5.data = p5.data[0], t2(p5, i5))));
|
|
181
|
+
}), this.parse = function(e4, t4, i6) {
|
|
182
|
+
var r5 = m4.quoteChar || '"', r5 = (m4.newline || (m4.newline = this.guessLineEndings(e4, r5)), a6 = false, m4.delimiter ? q4(m4.delimiter) && (m4.delimiter = m4.delimiter(e4), p5.meta.delimiter = m4.delimiter) : ((r5 = ((e5, t5, i7, r6, n5) => {
|
|
183
|
+
var s6, a7, o5, h5;
|
|
184
|
+
n5 = n5 || [",", " ", "|", ";", v4.RECORD_SEP, v4.UNIT_SEP];
|
|
185
|
+
for (var u7 = 0; u7 < n5.length; u7++) {
|
|
186
|
+
for (var d4, f6 = n5[u7], l5 = 0, c6 = 0, p6 = 0, g6 = (o5 = void 0, new E5({ comments: r6, delimiter: f6, newline: t5, preview: 10 }).parse(e5)), _5 = 0; _5 < g6.data.length; _5++) i7 && y6(g6.data[_5]) ? p6++ : (d4 = g6.data[_5].length, c6 += d4, void 0 === o5 ? o5 = d4 : 0 < d4 && (l5 += Math.abs(d4 - o5), o5 = d4));
|
|
187
|
+
0 < g6.data.length && (c6 /= g6.data.length - p6), (void 0 === a7 || l5 <= a7) && (void 0 === h5 || h5 < c6) && 1.99 < c6 && (a7 = l5, s6 = f6, h5 = c6);
|
|
188
188
|
}
|
|
189
|
-
return { successful: !!(
|
|
190
|
-
})(
|
|
191
|
-
return
|
|
189
|
+
return { successful: !!(m4.delimiter = s6), bestDelimiter: s6 };
|
|
190
|
+
})(e4, m4.newline, m4.skipEmptyLines, m4.comments, m4.delimitersToGuess)).successful ? m4.delimiter = r5.bestDelimiter : (a6 = true, m4.delimiter = v4.DefaultDelimiter), p5.meta.delimiter = m4.delimiter), b4(m4));
|
|
191
|
+
return m4.preview && m4.header && r5.preview++, n4 = e4, s5 = new E5(r5), p5 = s5.parse(n4, t4, i6), g5(), l4 ? { meta: { paused: true } } : p5 || { meta: { paused: false } };
|
|
192
192
|
}, this.paused = function() {
|
|
193
|
-
return
|
|
193
|
+
return l4;
|
|
194
194
|
}, this.pause = function() {
|
|
195
|
-
|
|
195
|
+
l4 = true, s5.abort(), n4 = q4(m4.chunk) ? "" : n4.substring(s5.getCharIndex());
|
|
196
196
|
}, this.resume = function() {
|
|
197
|
-
|
|
197
|
+
i5.streamer._halted ? (l4 = false, i5.streamer.parseChunk(n4, true)) : setTimeout(i5.resume, 3);
|
|
198
198
|
}, this.aborted = function() {
|
|
199
|
-
return
|
|
199
|
+
return e2;
|
|
200
200
|
}, this.abort = function() {
|
|
201
|
-
|
|
202
|
-
}, this.guessLineEndings = function(
|
|
203
|
-
|
|
204
|
-
var
|
|
205
|
-
if (1 ===
|
|
206
|
-
for (var
|
|
207
|
-
return
|
|
201
|
+
e2 = true, s5.abort(), p5.meta.aborted = true, q4(m4.complete) && m4.complete(p5), n4 = "";
|
|
202
|
+
}, this.guessLineEndings = function(e4, t4) {
|
|
203
|
+
e4 = e4.substring(0, 1048576);
|
|
204
|
+
var t4 = new RegExp(U4(t4) + "([^]*?)" + U4(t4), "gm"), i6 = (e4 = e4.replace(t4, "")).split("\r"), t4 = e4.split("\n"), e4 = 1 < t4.length && t4[0].length < i6[0].length;
|
|
205
|
+
if (1 === i6.length || e4) return "\n";
|
|
206
|
+
for (var r5 = 0, n5 = 0; n5 < i6.length; n5++) "\n" === i6[n5][0] && r5++;
|
|
207
|
+
return r5 >= i6.length / 2 ? "\r\n" : "\r";
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
|
-
function
|
|
211
|
-
return
|
|
210
|
+
function U4(e2) {
|
|
211
|
+
return e2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
212
212
|
}
|
|
213
|
-
function
|
|
214
|
-
var
|
|
215
|
-
if (void 0 !==
|
|
216
|
-
true ===
|
|
217
|
-
var
|
|
218
|
-
this.parse = function(
|
|
219
|
-
if ("string" != typeof
|
|
220
|
-
var
|
|
221
|
-
if (!
|
|
222
|
-
if (
|
|
223
|
-
for (var
|
|
224
|
-
if (
|
|
225
|
-
else if (
|
|
226
|
-
if (!
|
|
227
|
-
if (
|
|
228
|
-
if (
|
|
229
|
-
} else
|
|
230
|
-
if (
|
|
213
|
+
function E5(C3) {
|
|
214
|
+
var S2 = (C3 = C3 || {}).delimiter, O3 = C3.newline, x3 = C3.comments, I4 = C3.step, A2 = C3.preview, T4 = C3.fastMode, D4 = null, L4 = false, F5 = null == C3.quoteChar ? '"' : C3.quoteChar, j4 = F5;
|
|
215
|
+
if (void 0 !== C3.escapeChar && (j4 = C3.escapeChar), ("string" != typeof S2 || -1 < v4.BAD_DELIMITERS.indexOf(S2)) && (S2 = ","), x3 === S2) throw new Error("Comment character same as delimiter");
|
|
216
|
+
true === x3 ? x3 = "#" : ("string" != typeof x3 || -1 < v4.BAD_DELIMITERS.indexOf(x3)) && (x3 = false), "\n" !== O3 && "\r" !== O3 && "\r\n" !== O3 && (O3 = "\n");
|
|
217
|
+
var z4 = 0, M2 = false;
|
|
218
|
+
this.parse = function(i5, t2, r4) {
|
|
219
|
+
if ("string" != typeof i5) throw new Error("Input must be a string");
|
|
220
|
+
var n4 = i5.length, e2 = S2.length, s5 = O3.length, a6 = x3.length, o4 = q4(I4), h4 = [], u6 = [], d3 = [], f5 = z4 = 0;
|
|
221
|
+
if (!i5) return w3();
|
|
222
|
+
if (T4 || false !== T4 && -1 === i5.indexOf(F5)) {
|
|
223
|
+
for (var l4 = i5.split(O3), c5 = 0; c5 < l4.length; c5++) {
|
|
224
|
+
if (d3 = l4[c5], z4 += d3.length, c5 !== l4.length - 1) z4 += O3.length;
|
|
225
|
+
else if (r4) return w3();
|
|
226
|
+
if (!x3 || d3.substring(0, a6) !== x3) {
|
|
227
|
+
if (o4) {
|
|
228
|
+
if (h4 = [], k3(d3.split(S2)), R2(), M2) return w3();
|
|
229
|
+
} else k3(d3.split(S2));
|
|
230
|
+
if (A2 && A2 <= c5) return h4 = h4.slice(0, A2), w3(true);
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
return
|
|
233
|
+
return w3();
|
|
234
234
|
}
|
|
235
|
-
for (var
|
|
236
|
-
if (-1 === (
|
|
237
|
-
if (
|
|
238
|
-
if (
|
|
239
|
-
else if (
|
|
240
|
-
-1 !==
|
|
241
|
-
var
|
|
242
|
-
if (
|
|
243
|
-
|
|
235
|
+
for (var p5 = i5.indexOf(S2, z4), g5 = i5.indexOf(O3, z4), _4 = new RegExp(U4(j4) + U4(F5), "g"), m4 = i5.indexOf(F5, z4); ; ) if (i5[z4] === F5) for (m4 = z4, z4++; ; ) {
|
|
236
|
+
if (-1 === (m4 = i5.indexOf(F5, m4 + 1))) return r4 || u6.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: h4.length, index: z4 }), E6();
|
|
237
|
+
if (m4 === n4 - 1) return E6(i5.substring(z4, m4).replace(_4, F5));
|
|
238
|
+
if (F5 === j4 && i5[m4 + 1] === j4) m4++;
|
|
239
|
+
else if (F5 === j4 || 0 === m4 || i5[m4 - 1] !== j4) {
|
|
240
|
+
-1 !== p5 && p5 < m4 + 1 && (p5 = i5.indexOf(S2, m4 + 1));
|
|
241
|
+
var y6 = v5(-1 === (g5 = -1 !== g5 && g5 < m4 + 1 ? i5.indexOf(O3, m4 + 1) : g5) ? p5 : Math.min(p5, g5));
|
|
242
|
+
if (i5.substr(m4 + 1 + y6, e2) === S2) {
|
|
243
|
+
d3.push(i5.substring(z4, m4).replace(_4, F5)), i5[z4 = m4 + 1 + y6 + e2] !== F5 && (m4 = i5.indexOf(F5, z4)), p5 = i5.indexOf(S2, z4), g5 = i5.indexOf(O3, z4);
|
|
244
244
|
break;
|
|
245
245
|
}
|
|
246
|
-
|
|
247
|
-
if (
|
|
248
|
-
if (
|
|
249
|
-
if (
|
|
246
|
+
y6 = v5(g5);
|
|
247
|
+
if (i5.substring(m4 + 1 + y6, m4 + 1 + y6 + s5) === O3) {
|
|
248
|
+
if (d3.push(i5.substring(z4, m4).replace(_4, F5)), b5(m4 + 1 + y6 + s5), p5 = i5.indexOf(S2, z4), m4 = i5.indexOf(F5, z4), o4 && (R2(), M2)) return w3();
|
|
249
|
+
if (A2 && h4.length >= A2) return w3(true);
|
|
250
250
|
break;
|
|
251
251
|
}
|
|
252
|
-
|
|
252
|
+
u6.push({ type: "Quotes", code: "InvalidQuotes", message: "Trailing quote on quoted field is malformed", row: h4.length, index: z4 }), m4++;
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
else if (
|
|
256
|
-
if (-1 ===
|
|
257
|
-
|
|
258
|
-
} else if (-1 !==
|
|
255
|
+
else if (x3 && 0 === d3.length && i5.substring(z4, z4 + a6) === x3) {
|
|
256
|
+
if (-1 === g5) return w3();
|
|
257
|
+
z4 = g5 + s5, g5 = i5.indexOf(O3, z4), p5 = i5.indexOf(S2, z4);
|
|
258
|
+
} else if (-1 !== p5 && (p5 < g5 || -1 === g5)) d3.push(i5.substring(z4, p5)), z4 = p5 + e2, p5 = i5.indexOf(S2, z4);
|
|
259
259
|
else {
|
|
260
|
-
if (-1 ===
|
|
261
|
-
if (
|
|
262
|
-
if (
|
|
260
|
+
if (-1 === g5) break;
|
|
261
|
+
if (d3.push(i5.substring(z4, g5)), b5(g5 + s5), o4 && (R2(), M2)) return w3();
|
|
262
|
+
if (A2 && h4.length >= A2) return w3(true);
|
|
263
263
|
}
|
|
264
|
-
return
|
|
265
|
-
function
|
|
266
|
-
|
|
264
|
+
return E6();
|
|
265
|
+
function k3(e4) {
|
|
266
|
+
h4.push(e4), f5 = z4;
|
|
267
267
|
}
|
|
268
|
-
function
|
|
269
|
-
var
|
|
270
|
-
return
|
|
268
|
+
function v5(e4) {
|
|
269
|
+
var t4 = 0;
|
|
270
|
+
return t4 = -1 !== e4 && (e4 = i5.substring(m4 + 1, e4)) && "" === e4.trim() ? e4.length : t4;
|
|
271
271
|
}
|
|
272
|
-
function
|
|
273
|
-
return
|
|
272
|
+
function E6(e4) {
|
|
273
|
+
return r4 || (void 0 === e4 && (e4 = i5.substring(z4)), d3.push(e4), z4 = n4, k3(d3), o4 && R2()), w3();
|
|
274
274
|
}
|
|
275
|
-
function
|
|
276
|
-
|
|
275
|
+
function b5(e4) {
|
|
276
|
+
z4 = e4, k3(d3), d3 = [], g5 = i5.indexOf(O3, z4);
|
|
277
277
|
}
|
|
278
|
-
function
|
|
279
|
-
if (
|
|
280
|
-
var
|
|
281
|
-
let
|
|
282
|
-
for (let
|
|
283
|
-
let
|
|
284
|
-
if (
|
|
285
|
-
let
|
|
286
|
-
for (;
|
|
287
|
-
|
|
288
|
-
} else
|
|
289
|
-
|
|
278
|
+
function w3(e4) {
|
|
279
|
+
if (C3.header && !t2 && h4.length && !L4) {
|
|
280
|
+
var s6 = h4[0], a7 = /* @__PURE__ */ Object.create(null), o5 = new Set(s6);
|
|
281
|
+
let n5 = false;
|
|
282
|
+
for (let r5 = 0; r5 < s6.length; r5++) {
|
|
283
|
+
let i6 = P5(s6[r5]);
|
|
284
|
+
if (a7[i6 = q4(C3.transformHeader) ? C3.transformHeader(i6, r5) : i6]) {
|
|
285
|
+
let e5, t4 = a7[i6];
|
|
286
|
+
for (; e5 = i6 + "_" + t4, t4++, o5.has(e5); ) ;
|
|
287
|
+
o5.add(e5), s6[r5] = e5, a7[i6]++, n5 = true, (D4 = null === D4 ? {} : D4)[e5] = i6;
|
|
288
|
+
} else a7[i6] = 1, s6[r5] = i6;
|
|
289
|
+
o5.add(i6);
|
|
290
290
|
}
|
|
291
|
-
|
|
291
|
+
n5 && console.warn("Duplicate headers found and renamed."), L4 = true;
|
|
292
292
|
}
|
|
293
|
-
return { data:
|
|
293
|
+
return { data: h4, errors: u6, meta: { delimiter: S2, linebreak: O3, aborted: M2, truncated: !!e4, cursor: f5 + (t2 || 0), renamedHeaders: D4 } };
|
|
294
294
|
}
|
|
295
|
-
function
|
|
296
|
-
|
|
295
|
+
function R2() {
|
|
296
|
+
I4(w3()), h4 = [], u6 = [];
|
|
297
297
|
}
|
|
298
298
|
}, this.abort = function() {
|
|
299
|
-
|
|
299
|
+
M2 = true;
|
|
300
300
|
}, this.getCharIndex = function() {
|
|
301
|
-
return
|
|
301
|
+
return z4;
|
|
302
302
|
};
|
|
303
303
|
}
|
|
304
|
-
function
|
|
305
|
-
var
|
|
306
|
-
if (
|
|
307
|
-
else if (
|
|
308
|
-
var
|
|
309
|
-
|
|
310
|
-
}, pause:
|
|
311
|
-
if (
|
|
312
|
-
for (var
|
|
313
|
-
delete
|
|
314
|
-
} else
|
|
304
|
+
function g4(e2) {
|
|
305
|
+
var t2 = e2.data, i5 = o2[t2.workerId], r4 = false;
|
|
306
|
+
if (t2.error) i5.userError(t2.error, t2.file);
|
|
307
|
+
else if (t2.results && t2.results.data) {
|
|
308
|
+
var n4 = { abort: function() {
|
|
309
|
+
r4 = true, _3(t2.workerId, { data: [], errors: [], meta: { aborted: true } });
|
|
310
|
+
}, pause: m2, resume: m2 };
|
|
311
|
+
if (q4(i5.userStep)) {
|
|
312
|
+
for (var s5 = 0; s5 < t2.results.data.length && (i5.userStep({ data: t2.results.data[s5], errors: t2.results.errors, meta: t2.results.meta }, n4), !r4); s5++) ;
|
|
313
|
+
delete t2.results;
|
|
314
|
+
} else q4(i5.userChunk) && (i5.userChunk(t2.results, n4, t2.file), delete t2.results);
|
|
315
315
|
}
|
|
316
|
-
|
|
316
|
+
t2.finished && !r4 && _3(t2.workerId, t2.results);
|
|
317
317
|
}
|
|
318
|
-
function
|
|
319
|
-
var
|
|
320
|
-
|
|
318
|
+
function _3(e2, t2) {
|
|
319
|
+
var i5 = o2[e2];
|
|
320
|
+
q4(i5.userComplete) && i5.userComplete(t2), i5.terminate(), delete o2[e2];
|
|
321
321
|
}
|
|
322
|
-
function
|
|
322
|
+
function m2() {
|
|
323
323
|
throw new Error("Not implemented.");
|
|
324
324
|
}
|
|
325
|
-
function
|
|
326
|
-
if ("object" != typeof
|
|
327
|
-
var
|
|
328
|
-
for (
|
|
329
|
-
return
|
|
325
|
+
function b4(e2) {
|
|
326
|
+
if ("object" != typeof e2 || null === e2) return e2;
|
|
327
|
+
var t2, i5 = Array.isArray(e2) ? [] : {};
|
|
328
|
+
for (t2 in e2) i5[t2] = b4(e2[t2]);
|
|
329
|
+
return i5;
|
|
330
330
|
}
|
|
331
|
-
function
|
|
331
|
+
function y5(e2, t2) {
|
|
332
332
|
return function() {
|
|
333
|
-
|
|
333
|
+
e2.apply(t2, arguments);
|
|
334
334
|
};
|
|
335
335
|
}
|
|
336
|
-
function
|
|
337
|
-
return "function" == typeof
|
|
336
|
+
function q4(e2) {
|
|
337
|
+
return "function" == typeof e2;
|
|
338
338
|
}
|
|
339
|
-
return
|
|
340
|
-
var
|
|
341
|
-
|
|
342
|
-
if (
|
|
343
|
-
(
|
|
344
|
-
var
|
|
345
|
-
return !!
|
|
346
|
-
var
|
|
347
|
-
return
|
|
348
|
-
})(), (
|
|
349
|
-
})()).userStep =
|
|
350
|
-
},
|
|
351
|
-
var
|
|
352
|
-
if ("object" == typeof
|
|
353
|
-
if ("string" != typeof
|
|
354
|
-
return -1 !==
|
|
355
|
-
}).length || (
|
|
356
|
-
if (0 ===
|
|
357
|
-
|
|
339
|
+
return v4.parse = function(e2, t2) {
|
|
340
|
+
var i5 = (t2 = t2 || {}).dynamicTyping || false;
|
|
341
|
+
q4(i5) && (t2.dynamicTypingFunction = i5, i5 = {});
|
|
342
|
+
if (t2.dynamicTyping = i5, t2.transform = !!q4(t2.transform) && t2.transform, !t2.worker || !v4.WORKERS_SUPPORTED) return i5 = null, v4.NODE_STREAM_INPUT, "string" == typeof e2 ? (e2 = P5(e2), i5 = new (t2.download ? f4 : c4)(t2)) : true === e2.readable && q4(e2.read) && q4(e2.on) ? i5 = new p4(t2) : (n2.File && e2 instanceof File || e2 instanceof Object) && (i5 = new l3(t2)), i5.stream(e2);
|
|
343
|
+
(i5 = (() => {
|
|
344
|
+
var e4;
|
|
345
|
+
return !!v4.WORKERS_SUPPORTED && (e4 = (() => {
|
|
346
|
+
var e5 = n2.URL || n2.webkitURL || null, t4 = r2.toString();
|
|
347
|
+
return v4.BLOB_URL || (v4.BLOB_URL = e5.createObjectURL(new Blob(["var global = (function() { if (typeof self !== 'undefined') { return self; } if (typeof window !== 'undefined') { return window; } if (typeof global !== 'undefined') { return global; } return {}; })(); global.IS_PAPA_WORKER=true; ", "(", t4, ")();"], { type: "text/javascript" })));
|
|
348
|
+
})(), (e4 = new n2.Worker(e4)).onmessage = g4, e4.id = h3++, o2[e4.id] = e4);
|
|
349
|
+
})()).userStep = t2.step, i5.userChunk = t2.chunk, i5.userComplete = t2.complete, i5.userError = t2.error, t2.step = q4(t2.step), t2.chunk = q4(t2.chunk), t2.complete = q4(t2.complete), t2.error = q4(t2.error), delete t2.worker, i5.postMessage({ input: e2, config: t2, workerId: i5.id });
|
|
350
|
+
}, v4.unparse = function(e2, t2) {
|
|
351
|
+
var s5 = false, _4 = true, m4 = ",", y6 = "\r\n", a6 = '"', o4 = a6 + a6, i5 = false, r4 = null, h4 = false, u6 = ((() => {
|
|
352
|
+
if ("object" == typeof t2) {
|
|
353
|
+
if ("string" != typeof t2.delimiter || v4.BAD_DELIMITERS.filter(function(e4) {
|
|
354
|
+
return -1 !== t2.delimiter.indexOf(e4);
|
|
355
|
+
}).length || (m4 = t2.delimiter), "boolean" != typeof t2.quotes && "function" != typeof t2.quotes && !Array.isArray(t2.quotes) || (s5 = t2.quotes), "boolean" != typeof t2.skipEmptyLines && "string" != typeof t2.skipEmptyLines || (i5 = t2.skipEmptyLines), "string" == typeof t2.newline && (y6 = t2.newline), "string" == typeof t2.quoteChar && (a6 = t2.quoteChar, o4 = a6 + a6), "boolean" == typeof t2.header && (_4 = t2.header), Array.isArray(t2.columns)) {
|
|
356
|
+
if (0 === t2.columns.length) throw new Error("Option columns is empty");
|
|
357
|
+
r4 = t2.columns;
|
|
358
358
|
}
|
|
359
|
-
void 0 !==
|
|
359
|
+
void 0 !== t2.escapeChar && (o4 = t2.escapeChar + a6), t2.escapeFormulae instanceof RegExp ? h4 = t2.escapeFormulae : "boolean" == typeof t2.escapeFormulae && t2.escapeFormulae && (h4 = /^[=+\-@\t\r].*$/);
|
|
360
360
|
}
|
|
361
|
-
})(), new RegExp(
|
|
362
|
-
"string" == typeof
|
|
363
|
-
if (Array.isArray(
|
|
364
|
-
if (!
|
|
365
|
-
if ("object" == typeof
|
|
366
|
-
} else if ("object" == typeof
|
|
361
|
+
})(), new RegExp(U4(a6), "g"));
|
|
362
|
+
"string" == typeof e2 && (e2 = JSON.parse(e2));
|
|
363
|
+
if (Array.isArray(e2)) {
|
|
364
|
+
if (!e2.length || Array.isArray(e2[0])) return n4(null, e2, i5);
|
|
365
|
+
if ("object" == typeof e2[0]) return n4(r4 || Object.keys(e2[0]), e2, i5);
|
|
366
|
+
} else if ("object" == typeof e2) return "string" == typeof e2.data && (e2.data = JSON.parse(e2.data)), Array.isArray(e2.data) && (e2.fields || (e2.fields = e2.meta && e2.meta.fields || r4), e2.fields || (e2.fields = Array.isArray(e2.data[0]) ? e2.fields : "object" == typeof e2.data[0] ? Object.keys(e2.data[0]) : []), Array.isArray(e2.data[0]) || "object" == typeof e2.data[0] || (e2.data = [e2.data])), n4(e2.fields || [], e2.data || [], i5);
|
|
367
367
|
throw new Error("Unable to serialize unrecognized input");
|
|
368
|
-
function
|
|
369
|
-
var
|
|
370
|
-
if (
|
|
371
|
-
for (var
|
|
372
|
-
0 <
|
|
368
|
+
function n4(e4, t4, i6) {
|
|
369
|
+
var r5 = "", n5 = ("string" == typeof e4 && (e4 = JSON.parse(e4)), "string" == typeof t4 && (t4 = JSON.parse(t4)), Array.isArray(e4) && 0 < e4.length), s6 = !Array.isArray(t4[0]);
|
|
370
|
+
if (n5 && _4) {
|
|
371
|
+
for (var a7 = 0; a7 < e4.length; a7++) 0 < a7 && (r5 += m4), r5 += k3(e4[a7], a7);
|
|
372
|
+
0 < t4.length && (r5 += y6);
|
|
373
373
|
}
|
|
374
|
-
for (var
|
|
375
|
-
var
|
|
376
|
-
if (
|
|
377
|
-
for (var
|
|
378
|
-
var
|
|
379
|
-
|
|
374
|
+
for (var o5 = 0; o5 < t4.length; o5++) {
|
|
375
|
+
var h5 = (n5 ? e4 : t4[o5]).length, u7 = false, d3 = n5 ? 0 === Object.keys(t4[o5]).length : 0 === t4[o5].length;
|
|
376
|
+
if (i6 && !n5 && (u7 = "greedy" === i6 ? "" === t4[o5].join("").trim() : 1 === t4[o5].length && 0 === t4[o5][0].length), "greedy" === i6 && n5) {
|
|
377
|
+
for (var f5 = [], l4 = 0; l4 < h5; l4++) {
|
|
378
|
+
var c5 = s6 ? e4[l4] : l4;
|
|
379
|
+
f5.push(t4[o5][c5]);
|
|
380
380
|
}
|
|
381
|
-
|
|
381
|
+
u7 = "" === f5.join("").trim();
|
|
382
382
|
}
|
|
383
|
-
if (!
|
|
384
|
-
for (var
|
|
385
|
-
0 <
|
|
386
|
-
var
|
|
387
|
-
|
|
383
|
+
if (!u7) {
|
|
384
|
+
for (var p5 = 0; p5 < h5; p5++) {
|
|
385
|
+
0 < p5 && !d3 && (r5 += m4);
|
|
386
|
+
var g5 = n5 && s6 ? e4[p5] : p5;
|
|
387
|
+
r5 += k3(t4[o5][g5], p5);
|
|
388
388
|
}
|
|
389
|
-
|
|
389
|
+
o5 < t4.length - 1 && (!i6 || 0 < h5 && !d3) && (r5 += y6);
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
|
-
return
|
|
392
|
+
return r5;
|
|
393
393
|
}
|
|
394
|
-
function
|
|
395
|
-
var
|
|
396
|
-
return null ==
|
|
397
|
-
for (var
|
|
394
|
+
function k3(e4, t4) {
|
|
395
|
+
var i6, r5, n5;
|
|
396
|
+
return null == e4 ? "" : e4.constructor === Date ? JSON.stringify(e4).slice(1, 25) : (n5 = false, h4 && "string" == typeof e4 && h4.test(e4) && (e4 = "'" + e4, n5 = true), r5 = (i6 = e4.toString()).replace(u6, o4), (n5 = n5 || true === s5 || "function" == typeof s5 && s5(e4, t4) || Array.isArray(s5) && s5[t4] || ((e5, t5) => {
|
|
397
|
+
for (var i7 = 0; i7 < t5.length; i7++) if (-1 < e5.indexOf(t5[i7])) return true;
|
|
398
398
|
return false;
|
|
399
|
-
})(
|
|
399
|
+
})(r5, v4.BAD_DELIMITERS) || -1 < r5.indexOf(m4) || -1 < i6.indexOf(a6) || " " === r5.charAt(0) || " " === r5.charAt(r5.length - 1)) ? a6 + r5 + a6 : r5);
|
|
400
400
|
}
|
|
401
|
-
},
|
|
402
|
-
var
|
|
403
|
-
return this.each(function(
|
|
404
|
-
if (!("INPUT" ===
|
|
405
|
-
for (var
|
|
406
|
-
}),
|
|
407
|
-
function
|
|
408
|
-
if (0 ===
|
|
401
|
+
}, v4.RECORD_SEP = String.fromCharCode(30), v4.UNIT_SEP = String.fromCharCode(31), v4.BYTE_ORDER_MARK = "\uFEFF", v4.BAD_DELIMITERS = ["\r", "\n", '"', v4.BYTE_ORDER_MARK], v4.WORKERS_SUPPORTED = !s4 && !!n2.Worker, v4.NODE_STREAM_INPUT = 1, v4.LocalChunkSize = 10485760, v4.RemoteChunkSize = 5242880, v4.DefaultDelimiter = ",", v4.Parser = E5, v4.ParserHandle = i4, v4.NetworkStreamer = f4, v4.FileStreamer = l3, v4.StringStreamer = c4, v4.ReadableStreamStreamer = p4, n2.jQuery && ((d2 = n2.jQuery).fn.parse = function(o4) {
|
|
402
|
+
var i5 = o4.config || {}, h4 = [];
|
|
403
|
+
return this.each(function(e4) {
|
|
404
|
+
if (!("INPUT" === d2(this).prop("tagName").toUpperCase() && "file" === d2(this).attr("type").toLowerCase() && n2.FileReader) || !this.files || 0 === this.files.length) return true;
|
|
405
|
+
for (var t2 = 0; t2 < this.files.length; t2++) h4.push({ file: this.files[t2], inputElem: this, instanceConfig: d2.extend({}, i5) });
|
|
406
|
+
}), e2(), this;
|
|
407
|
+
function e2() {
|
|
408
|
+
if (0 === h4.length) q4(o4.complete) && o4.complete();
|
|
409
409
|
else {
|
|
410
|
-
var
|
|
411
|
-
if (
|
|
412
|
-
var
|
|
413
|
-
if ("object" == typeof
|
|
414
|
-
if ("abort" ===
|
|
415
|
-
if ("skip" ===
|
|
416
|
-
"object" == typeof
|
|
417
|
-
} else if ("skip" ===
|
|
410
|
+
var e4, t2, i6, r4, n4 = h4[0];
|
|
411
|
+
if (q4(o4.before)) {
|
|
412
|
+
var s5 = o4.before(n4.file, n4.inputElem);
|
|
413
|
+
if ("object" == typeof s5) {
|
|
414
|
+
if ("abort" === s5.action) return e4 = "AbortError", t2 = n4.file, i6 = n4.inputElem, r4 = s5.reason, void (q4(o4.error) && o4.error({ name: e4 }, t2, i6, r4));
|
|
415
|
+
if ("skip" === s5.action) return void u6();
|
|
416
|
+
"object" == typeof s5.config && (n4.instanceConfig = d2.extend(n4.instanceConfig, s5.config));
|
|
417
|
+
} else if ("skip" === s5) return void u6();
|
|
418
418
|
}
|
|
419
|
-
var
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
},
|
|
419
|
+
var a6 = n4.instanceConfig.complete;
|
|
420
|
+
n4.instanceConfig.complete = function(e5) {
|
|
421
|
+
q4(a6) && a6(e5, n4.file, n4.inputElem), u6();
|
|
422
|
+
}, v4.parse(n4.file, n4.instanceConfig);
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
|
-
function
|
|
426
|
-
|
|
425
|
+
function u6() {
|
|
426
|
+
h4.splice(0, 1), e2();
|
|
427
427
|
}
|
|
428
|
-
}),
|
|
429
|
-
|
|
430
|
-
void 0 ===
|
|
431
|
-
"string" == typeof
|
|
432
|
-
}), (
|
|
428
|
+
}), a5 && (n2.onmessage = function(e2) {
|
|
429
|
+
e2 = e2.data;
|
|
430
|
+
void 0 === v4.WORKER_ID && e2 && (v4.WORKER_ID = e2.workerId);
|
|
431
|
+
"string" == typeof e2.input ? n2.postMessage({ workerId: v4.WORKER_ID, results: v4.parse(e2.input, e2.config), finished: true }) : (n2.File && e2.input instanceof File || e2.input instanceof Object) && (e2 = v4.parse(e2.input, e2.config)) && n2.postMessage({ workerId: v4.WORKER_ID, results: e2, finished: true });
|
|
432
|
+
}), (f4.prototype = Object.create(u5.prototype)).constructor = f4, (l3.prototype = Object.create(u5.prototype)).constructor = l3, (c4.prototype = Object.create(c4.prototype)).constructor = c4, (p4.prototype = Object.create(u5.prototype)).constructor = p4, v4;
|
|
433
433
|
});
|
|
434
434
|
}
|
|
435
435
|
});
|
|
@@ -476,20 +476,20 @@ var VALUE_AXIS_BASELINE_DEFAULT = "fit";
|
|
|
476
476
|
var SEASONAL_MARKERS_DEFAULT = "auto";
|
|
477
477
|
|
|
478
478
|
// src/defaults.ts
|
|
479
|
-
var clamp = (
|
|
479
|
+
var clamp = (n2, lo, hi) => Math.max(lo, Math.min(hi, n2));
|
|
480
480
|
var numberOr = (raw, dflt) => {
|
|
481
|
-
const
|
|
482
|
-
return Number.isFinite(
|
|
481
|
+
const n2 = raw == null || raw === "" ? NaN : Number(raw);
|
|
482
|
+
return Number.isFinite(n2) ? n2 : dflt;
|
|
483
483
|
};
|
|
484
|
-
function resolveOptions(
|
|
484
|
+
function resolveOptions(p4) {
|
|
485
485
|
return {
|
|
486
486
|
// ---- host fields: pass through exactly as supplied ----
|
|
487
|
-
width:
|
|
488
|
-
height:
|
|
489
|
-
palette:
|
|
490
|
-
geoUnmatched:
|
|
491
|
-
geo:
|
|
492
|
-
geoPoint:
|
|
487
|
+
width: p4.width,
|
|
488
|
+
height: p4.height,
|
|
489
|
+
palette: p4.palette,
|
|
490
|
+
geoUnmatched: p4.geoUnmatched,
|
|
491
|
+
geo: p4.geo,
|
|
492
|
+
geoPoint: p4.geoPoint,
|
|
493
493
|
// THIRD AND FOURTH OCCURRENCES OF THE animLoopDelaySec OMISSION, found together by
|
|
494
494
|
// reading the contract against this list rather than by a bug report. geoPointDest is
|
|
495
495
|
// declared on RenderOptions, passed by the visual and read by the route archetypes, and
|
|
@@ -497,8 +497,8 @@ function resolveOptions(p2) {
|
|
|
497
497
|
// endpoint" never saw the destination end at all. The guard test at the bottom of
|
|
498
498
|
// tests/defaults.test.ts now compares the two lists, because four instances of one
|
|
499
499
|
// omission is a missing check, not four mistakes.
|
|
500
|
-
geoPointDest:
|
|
501
|
-
maxMapPoints:
|
|
500
|
+
geoPointDest: p4.geoPointDest,
|
|
501
|
+
maxMapPoints: p4.maxMapPoints,
|
|
502
502
|
// FIFTH AND SIXTH OCCURRENCES, and the two that argue hardest for the guard test: both
|
|
503
503
|
// were passed by the visual AND read by the charts, and neither was ever declared here or
|
|
504
504
|
// in the contract - so the contract-vs-whitelist check could not see them either. What
|
|
@@ -506,67 +506,67 @@ function resolveOptions(p2) {
|
|
|
506
506
|
// 0 is MEANINGFUL for both ("let the chart choose", "no paging"), so numberOr rather than
|
|
507
507
|
// `|| DEFAULT`, which would turn an explicit 0 into something else. Clamping stays
|
|
508
508
|
// chart-side for the same reason it does for flipIntervalMs.
|
|
509
|
-
geoPointRadiusPx: Math.max(0, numberOr(
|
|
510
|
-
pageSize: Math.max(0, numberOr(
|
|
511
|
-
uiState:
|
|
512
|
-
setUiState:
|
|
513
|
-
backgroundColor:
|
|
514
|
-
themeBg:
|
|
515
|
-
themeFg:
|
|
516
|
-
isHighContrast:
|
|
517
|
-
themeAccent:
|
|
518
|
-
cultureCode:
|
|
519
|
-
allowTooltips:
|
|
520
|
-
noDataText:
|
|
521
|
-
onSelect:
|
|
509
|
+
geoPointRadiusPx: Math.max(0, numberOr(p4.geoPointRadiusPx, 0)),
|
|
510
|
+
pageSize: Math.max(0, numberOr(p4.pageSize, 0)),
|
|
511
|
+
uiState: p4.uiState,
|
|
512
|
+
setUiState: p4.setUiState,
|
|
513
|
+
backgroundColor: p4.backgroundColor,
|
|
514
|
+
themeBg: p4.themeBg,
|
|
515
|
+
themeFg: p4.themeFg,
|
|
516
|
+
isHighContrast: p4.isHighContrast,
|
|
517
|
+
themeAccent: p4.themeAccent,
|
|
518
|
+
cultureCode: p4.cultureCode,
|
|
519
|
+
allowTooltips: p4.allowTooltips,
|
|
520
|
+
noDataText: p4.noDataText,
|
|
521
|
+
onSelect: p4.onSelect,
|
|
522
522
|
// ---- live-restyle knobs: `raw || undefined` / `.toString() || undefined` ----
|
|
523
|
-
colorScaleLow:
|
|
524
|
-
colorScaleHigh:
|
|
523
|
+
colorScaleLow: p4.colorScaleLow || void 0,
|
|
524
|
+
colorScaleHigh: p4.colorScaleHigh || void 0,
|
|
525
525
|
// "" (global, the default), "frame", or "self"; anything else fails open to global.
|
|
526
|
-
colorScaleScope:
|
|
526
|
+
colorScaleScope: p4.colorScaleScope === "frame" || p4.colorScaleScope === "self" ? p4.colorScaleScope : "",
|
|
527
527
|
// Math.max(50, Math.min(100, Number(raw) || 95)) — only meaningful under "self".
|
|
528
|
-
colorScaleSelfClampPct: clamp(Number(
|
|
528
|
+
colorScaleSelfClampPct: clamp(Number(p4.colorScaleSelfClampPct) || COLOR_SCALE_SELF_CLAMP_PCT_DEFAULT, COLOR_SCALE_SELF_CLAMP_PCT_MIN, COLOR_SCALE_SELF_CLAMP_PCT_MAX),
|
|
529
529
|
// Map fills: `raw || undefined` like the colour-scale endpoints. The no-data ->
|
|
530
530
|
// land cascade is left to the chart (so the fallback chain is visible in the
|
|
531
531
|
// generated code); HC substitution has already happened in the caller.
|
|
532
|
-
geoLandColor:
|
|
533
|
-
geoNoDataColor:
|
|
534
|
-
aggregation: (
|
|
532
|
+
geoLandColor: p4.geoLandColor || void 0,
|
|
533
|
+
geoNoDataColor: p4.geoNoDataColor || void 0,
|
|
534
|
+
aggregation: (p4.aggregation == null ? "" : String(p4.aggregation)) || void 0,
|
|
535
535
|
// A recognised value wins, anything else falls to the default: an unknown string must
|
|
536
536
|
// never reach a chart as a live mode. Both of these are read on EVERY render, so a
|
|
537
537
|
// reader can change their mind about a cached chart without regenerating it.
|
|
538
538
|
approximatePositions: (() => {
|
|
539
|
-
const
|
|
540
|
-
return
|
|
539
|
+
const v4 = (p4.approximatePositions == null ? "" : String(p4.approximatePositions)).toLowerCase();
|
|
540
|
+
return v4 === "mark" || v4 === "aggregate" || v4 === "skip" ? v4 : APPROXIMATE_POSITIONS_DEFAULT;
|
|
541
541
|
})(),
|
|
542
542
|
valueAxisBaseline: (() => {
|
|
543
|
-
const
|
|
544
|
-
return
|
|
543
|
+
const v4 = (p4.valueAxisBaseline == null ? "" : String(p4.valueAxisBaseline)).toLowerCase();
|
|
544
|
+
return v4 === "zero" || v4 === "fit" || v4 === "auto" ? v4 : VALUE_AXIS_BASELINE_DEFAULT;
|
|
545
545
|
})(),
|
|
546
546
|
// Same shape, and the same reason for it: an unrecognised string must never reach a chart
|
|
547
547
|
// as a live mode. Failing open to "auto" is the conservative direction here — "auto" is
|
|
548
548
|
// the setting that makes the chart PROVE the grid before it names a period, so a garbled
|
|
549
549
|
// value withdraws the claim rather than asserting one.
|
|
550
550
|
seasonalMarkers: (() => {
|
|
551
|
-
const
|
|
552
|
-
return
|
|
551
|
+
const v4 = (p4.seasonalMarkers == null ? "" : String(p4.seasonalMarkers)).toLowerCase();
|
|
552
|
+
return v4 === "auto" || v4 === "always" || v4 === "never" ? v4 : SEASONAL_MARKERS_DEFAULT;
|
|
553
553
|
})(),
|
|
554
554
|
// ---- animation: booleans, default+clamp numerics, "" default enum ----
|
|
555
|
-
animAutoPlay: !!
|
|
555
|
+
animAutoPlay: !!p4.animAutoPlay,
|
|
556
556
|
// Math.max(250, Math.min(5000, Number(raw) || 1000))
|
|
557
|
-
animPlaySpeedMs: clamp(Number(
|
|
557
|
+
animPlaySpeedMs: clamp(Number(p4.animPlaySpeedMs) || ANIM_PLAY_SPEED_DEFAULT, ANIM_PLAY_SPEED_MIN, ANIM_PLAY_SPEED_MAX),
|
|
558
558
|
// Loop-restart delay (seconds on the overview between auto-play passes).
|
|
559
559
|
// Floored at 0, deliberately NO upper clamp (huge = play once per viewing),
|
|
560
560
|
// and 0 must survive as 0 — hence numberOr, not `|| DEFAULT`. This field was
|
|
561
561
|
// MISSING from the resolve list when the assembly moved here, so callers
|
|
562
562
|
// that passed it saw it dropped: the scrubber read undefined -> 0 -> every
|
|
563
563
|
// pass restarted instantly and resumed-state auto-play lost its pacing.
|
|
564
|
-
animLoopDelaySec: Math.max(ANIM_LOOP_DELAY_MIN, numberOr(
|
|
564
|
+
animLoopDelaySec: Math.max(ANIM_LOOP_DELAY_MIN, numberOr(p4.animLoopDelaySec, ANIM_LOOP_DELAY_DEFAULT)),
|
|
565
565
|
// Math.max(3, Math.min(500, Number(raw) || 60))
|
|
566
|
-
animMaxIdealFrames: clamp(Number(
|
|
567
|
-
animStopAtEnd: !!
|
|
568
|
-
filtersDuringPlay: !!
|
|
569
|
-
animTimelineStyle: (
|
|
566
|
+
animMaxIdealFrames: clamp(Number(p4.animMaxIdealFrames) || ANIM_MAX_IDEAL_FRAMES_DEFAULT, ANIM_MAX_IDEAL_FRAMES_MIN, ANIM_MAX_IDEAL_FRAMES_MAX),
|
|
567
|
+
animStopAtEnd: !!p4.animStopAtEnd,
|
|
568
|
+
filtersDuringPlay: !!p4.filtersDuringPlay,
|
|
569
|
+
animTimelineStyle: (p4.animTimelineStyle || "").toString(),
|
|
570
570
|
// ---- card deck ----
|
|
571
571
|
// SECOND OCCURRENCE OF THE animLoopDelaySec BUG, six lines above (2026-08-13). The
|
|
572
572
|
// visual passed both of these, the generated code read both correctly, and this
|
|
@@ -579,7 +579,7 @@ function resolveOptions(p2) {
|
|
|
579
579
|
// flipSync DEFAULTS TRUE, so it cannot use `!!p.flipSync` — that would read a missing
|
|
580
580
|
// value as "independent" and hand every deck twelve control strips. Absent means
|
|
581
581
|
// synced; only an explicit false switches it.
|
|
582
|
-
flipSync:
|
|
582
|
+
flipSync: p4.flipSync === void 0 || p4.flipSync === null ? true : !!p4.flipSync,
|
|
583
583
|
// WHERE the controls live, which is a different question from whether the cards move
|
|
584
584
|
// together (2026-08-13: "the ability to flip individual cards shouldn't necessarily
|
|
585
585
|
// stop being able to flip all together too"). Resolution order matters and is the whole
|
|
@@ -592,22 +592,22 @@ function resolveOptions(p2) {
|
|
|
592
592
|
// because a newer client shipped, and "both" would have done exactly that to every deck
|
|
593
593
|
// already in a report.
|
|
594
594
|
flipMode: (() => {
|
|
595
|
-
const
|
|
596
|
-
if (
|
|
597
|
-
if (
|
|
598
|
-
if (
|
|
595
|
+
const m2 = (p4.flipMode == null ? "" : String(p4.flipMode)).toLowerCase();
|
|
596
|
+
if (m2 === "single" || m2 === "all" || m2 === "both") return m2;
|
|
597
|
+
if (p4.flipSync === false) return "single";
|
|
598
|
+
if (p4.flipSync === true) return "all";
|
|
599
599
|
return FLIP_MODE_DEFAULT;
|
|
600
600
|
})(),
|
|
601
601
|
// 0 is MEANINGFUL here (manual only) and is the default, so numberOr — not
|
|
602
602
|
// `|| DEFAULT` — for the same reason animLoopDelaySec uses it. Clamping stays
|
|
603
603
|
// chart-side: the archetype already clamps 500..120000 and two clamps in two
|
|
604
604
|
// repositories is how they end up disagreeing.
|
|
605
|
-
flipIntervalMs: Math.max(0, numberOr(
|
|
605
|
+
flipIntervalMs: Math.max(0, numberOr(p4.flipIntervalMs, 0)),
|
|
606
606
|
// `raw || undefined`, the same idiom as the colour-scale endpoints and the map fills:
|
|
607
607
|
// blank must arrive as ABSENT, not as an empty string, because the chart's fallback is
|
|
608
608
|
// `options.cardBackgroundColor || <its own choice>` and "" would satisfy a truthiness
|
|
609
609
|
// test in some hands while painting nothing in others.
|
|
610
|
-
cardBackgroundColor:
|
|
610
|
+
cardBackgroundColor: p4.cardBackgroundColor || void 0
|
|
611
611
|
};
|
|
612
612
|
}
|
|
613
613
|
|
|
@@ -617,12 +617,12 @@ var byAsset = /* @__PURE__ */ new Map();
|
|
|
617
617
|
var _na;
|
|
618
618
|
function geoAssetFor(geoKind) {
|
|
619
619
|
if (!geoKind) return null;
|
|
620
|
-
const
|
|
621
|
-
if (/^country/.test(
|
|
622
|
-
if (
|
|
623
|
-
if (
|
|
624
|
-
if (
|
|
625
|
-
if (
|
|
620
|
+
const k3 = geoKind.toLowerCase();
|
|
621
|
+
if (/^country/.test(k3)) return "world";
|
|
622
|
+
if (k3 === "north-america") return "world";
|
|
623
|
+
if (k3 === "world") return "world";
|
|
624
|
+
if (k3 === "us-state-code" || k3 === "us-state-name") return "us-states";
|
|
625
|
+
if (k3 === "us-zip5") return "us-zip3";
|
|
626
626
|
return null;
|
|
627
627
|
}
|
|
628
628
|
var _worldBase;
|
|
@@ -630,7 +630,7 @@ function worldBasemap(world) {
|
|
|
630
630
|
if (!_worldBase) {
|
|
631
631
|
_worldBase = {
|
|
632
632
|
type: "FeatureCollection",
|
|
633
|
-
features: world.features.filter((
|
|
633
|
+
features: world.features.filter((f4) => f4?.geometry && f4.geometry.type !== "Point")
|
|
634
634
|
};
|
|
635
635
|
}
|
|
636
636
|
return _worldBase;
|
|
@@ -639,7 +639,7 @@ function northAmerica(world) {
|
|
|
639
639
|
if (!_na) {
|
|
640
640
|
_na = {
|
|
641
641
|
type: "FeatureCollection",
|
|
642
|
-
features: world.features.filter((
|
|
642
|
+
features: world.features.filter((f4) => NA_ISO3.has(f4?.id) && f4?.geometry && f4.geometry.type !== "Point").map((f4) => clipFeatureToLat(f4, NA_LAT_MAX)).filter((f4) => f4 !== null)
|
|
643
643
|
};
|
|
644
644
|
}
|
|
645
645
|
return _na;
|
|
@@ -702,17 +702,17 @@ var H = "AB|CA|Alberta|-113.75|52.18,AK|US|Alaska|-148.32|61.29,AL|US|Alabama|-8
|
|
|
702
702
|
var X = "006|-66.84|18.26,007|-66.15|18.15,008|-64.74|17.74,009|-66.12|18.37,010|-72.6|42.26,011|-72.53|42.07,012|-73.21|42.37,013|-72.51|42.58,014|-71.81|42.59,015|-71.85|42.23,016|-71.84|42.28,017|-71.44|42.33,018|-71.21|42.64,019|-70.89|42.66,020|-71.28|42.12,021|-71.05|42.31,022|-71.04|42.35,023|-70.86|41.98,024|-71.22|42.37,025|-70.6|41.71,026|-70.2|41.73,027|-71.07|41.77,028|-71.62|41.69,029|-71.47|41.82,030|-71.51|42.9,031|-71.48|43,032|-71.65|43.57,033|-71.58|43.26,034|-72.19|42.91,035|-71.31|44.69,036|-72.32|43.17,037|-72.13|43.69,038|-71.1|43.56,039|-70.76|43.24,040|-70.6|43.78,041|-70.27|43.7,042|-70.49|44.38,043|-69.75|44.3,044|-68.83|45.45,045|-69.57|43.99,046|-67.8|44.79,047|-68.34|46.55,048|-69.17|44.2,049|-69.97|44.99,050|-72.43|43.85,051|-72.65|43.28,052|-73.14|43.03,053|-72.77|42.94,054|-72.98|44.58,056|-72.6|44.35,057|-73.04|43.69,058|-72.12|44.68,059|-71.7|44.79,060|-72.81|41.88,061|-72.69|41.74,062|-72.12|41.81,063|-72.03|41.5,064|-72.61|41.46,065|-72.94|41.36,066|-73.22|41.24,067|-73.24|41.68,068|-73.42|41.28,069|-73.57|41.14,070|-74.28|40.76,071|-74.2|40.74,072|-74.2|40.68,073|-74.08|40.71,074|-74.4|41.09,075|-74.17|40.92,076|-74.01|40.94,077|-74.17|40.28,078|-74.81|40.97,079|-74.55|40.74,080|-74.98|39.78,081|-75.07|39.94,082|-74.68|39.32,083|-75.04|39.45,084|-74.48|39.35,085|-74.62|40.25,086|-74.68|40.23,087|-74.22|39.96,088|-74.72|40.54,089|-74.48|40.45,100|-73.96|40.77,101|-73.95|40.78,102|-74.02|40.72,103|-74.15|40.58,104|-73.85|40.9,105|-73.75|41.27,106|-73.74|41.02,107|-73.84|40.96,108|-73.8|40.95,109|-74.27|41.3,110|-73.69|40.74,111|-73.93|40.76,112|-73.94|40.66,113|-73.84|40.73,114|-73.77|40.69,115|-73.62|40.71,116|-73.88|40.57,117|-73.23|40.82,118|-73.5|40.77,119|-72.53|40.95,120|-74.22|42.92,121|-74.4|43.46,122|-73.81|42.7,123|-73.96|42.82,124|-74.27|42.09,125|-73.7|41.89,126|-73.88|41.69,127|-74.75|41.74,128|-73.91|43.61,129|-74.03|44.53,130|-76.16|43.08,131|-76.46|43.27,132|-76.2|43.03,133|-75.07|43.45,134|-75.35|43.03,135|-75.15|43.14,136|-75.39|44.33,137|-75.2|42.21,138|-75.46|42.43,139|-75.88|42.12,140|-78.48|43.01,141|-78.7|42.49,142|-78.8|42.91,143|-78.96|43.12,144|-77.71|42.96,145|-77.17|43.14,146|-77.65|43.17,147|-78.84|42.21,148|-77.18|42.29,149|-76.78|42.09,150|-80.23|40.56,151|-80.18|40.53,152|-79.97|40.46,153|-80.24|40.01,154|-79.65|39.92,155|-78.8|39.95,156|-79.47|40.33,157|-79.02|40.71,158|-78.66|41.32,159|-78.84|40.35,160|-79.88|40.93,161|-80.3|41.19,162|-79.35|41.08,163|-79.58|41.59,164|-80|41.87,165|-80.04|42.1,166|-78.28|40.48,167|-78.47|41.76,168|-78|40.97,169|-77.37|41.8,170|-77.29|40.44,171|-76.78|40.33,172|-77.81|39.98,173|-76.93|39.89,174|-76.72|39.97,175|-76.24|40.05,176|-76.34|40.05,177|-77.22|41.34,178|-76.77|40.93,179|-76.27|40.69,180|-75.45|40.67,181|-75.47|40.6,182|-75.88|40.9,183|-75.19|41.12,184|-75.38|41.53,185|-75.68|41.37,186|-76.17|41.4,187|-75.86|41.22,188|-76.12|41.82,189|-75.14|40.36,190|-75.37|39.97,191|-75.15|40.01,193|-75.78|39.92,194|-75.46|40.19,195|-75.9|40.42,196|-75.95|40.34,197|-75.68|39.53,198|-75.58|39.77,199|-75.46|38.83,200|-77.02|38.9,201|-77.68|38.9,202|-77.03|38.89,203|-77.01|38.86,204|-77.05|38.89,205|-77.01|38.87,206|-76.76|38.45,207|-76.78|38.88,208|-77.23|39.15,209|-76.99|39.05,210|-76.32|39.53,211|-76.73|39.58,212|-76.58|39.31,214|-76.55|39,215|-79.08|39.56,216|-76.02|38.86,217|-77.5|39.52,218|-75.57|38.27,219|-75.94|39.57,220|-77.25|38.78,221|-77.25|38.92,222|-77.11|38.88,223|-77.13|38.79,224|-77.25|38.22,225|-77.51|38.09,226|-78.25|39.03,227|-78.05|38.49,228|-78.79|38.57,229|-78.55|38.02,230|-78.09|37.66,231|-76.96|37.55,232|-77.46|37.51,233|-76.3|36.68,234|-76.66|36.77,235|-76.26|36.87,236|-76.44|37.12,237|-76.38|36.85,238|-77.41|36.94,239|-78.39|37.03,240|-80.1|37.23,241|-79.89|36.9,242|-82.49|36.83,243|-81.13|36.86,244|-79.51|38.05,245|-79.11|37.15,246|-81.8|37.19,247|-81.14|37.39,248|-81.64|37.47,249|-80.32|37.95,250|-81.45|38.27,251|-81.89|38.64,252|-81.45|38.77,253|-81.64|38.42,254|-78.11|39.45,255|-82.19|38.25,256|-82.08|37.76,257|-82.41|38.4,258|-81.21|37.72,259|-80.89|37.83,260|-80.63|40.05,261|-81.27|39.2,262|-80.02|38.75,263|-80.23|39.27,264|-80.65|39.21,265|-80.05|39.59,266|-80.8|38.48,267|-78.98|39.33,268|-79.12|38.88,270|-80.45|36.24,271|-80.24|36.06,272|-79.82|35.86,273|-79.52|35.55,274|-79.81|36.09,275|-78.54|35.93,276|-78.65|35.81,277|-78.9|35.99,278|-77.32|35.88,279|-76.5|36.19,280|-81.2|35.4,281|-80.41|35.21,282|-80.83|35.22,283|-78.94|34.96,284|-78.23|34.39,285|-77.23|35.06,286|-81.36|36.06,287|-82.78|35.51,288|-82.55|35.6,289|-83.97|35.11,290|-80.88|34.19,291|-80.62|33.71,292|-80.96|34.04,293|-81.86|34.78,294|-80.08|33.05,295|-79.49|34.07,296|-82.57|34.61,297|-80.92|34.83,298|-81.74|33.51,299|-80.96|32.55,300|-84.08|33.85,301|-84.91|34.04,302|-84.55|33.25,303|-84.42|33.77,304|-82.11|32.48,305|-83.81|34.58,306|-83.14|33.86,307|-85.1|34.71,308|-82.34|33.35,309|-82.01|33.4,310|-83.42|32.64,312|-83.64|32.83,313|-81.49|31.68,314|-81.15|32.03,315|-82.21|31.4,316|-83.21|31.02,317|-83.87|31.48,318|-84.69|32.45,319|-84.95|32.47,320|-82.58|30.27,321|-81.48|29.39,322|-81.69|30.3,323|-84.25|30.29,324|-85.58|30.55,325|-87.03|30.76,326|-82.6|29.58,327|-81.28|28.79,328|-81.32|28.47,329|-80.67|27.96,330|-80.58|25.31,331|-80.38|25.74,333|-80.25|26.13,334|-81.01|26.64,335|-82.22|28.19,336|-82.47|28.01,337|-82.73|27.85,338|-81.64|27.72,339|-81.71|26.77,341|-81.32|26.11,342|-82.16|27.29,344|-82.35|29.01,346|-82.52|28.41,347|-81.4|28.29,349|-80.72|27.34,350|-86.8|34.05,351|-86.38|33.43,352|-86.77|33.5,354|-87.86|33.07,355|-87.71|33.96,356|-87.4|34.67,357|-86.26|34.75,358|-86.59|34.69,359|-85.94|34.27,360|-86.09|32.09,361|-86.27|32.31,362|-85.65|33.53,363|-85.56|31.34,364|-86.97|31.38,365|-88.14|31.32,366|-88.19|30.68,367|-87.34|32.33,368|-85.41|32.61,369|-88.25|32.12,370|-87.02|36.12,371|-86.23|35.75,372|-86.83|36.15,373|-85.36|35.32,374|-85.33|35.06,376|-82.3|36.36,377|-84.31|36.27,378|-83.35|36.3,379|-83.97|35.97,380|-89.43|35.55,381|-89.96|35.1,382|-88.68|36.29,383|-88.5|35.61,384|-87.36|35.34,385|-85.34|36.18,386|-89.76|34.57,387|-90.81|33.54,388|-88.63|34.36,389|-89.9|33.77,390|-90|32.53,391|-90.67|32.51,392|-90.22|32.32,393|-88.8|32.42,394|-89.26|31.23,395|-89|30.59,396|-90.67|31.32,397|-88.87|33.53,398|-84.67|31.32,400|-85.29|38.07,401|-86.2|37.85,402|-85.66|38.19,403|-84.2|38.06,404|-84.42|37.53,405|-84.45|38.04,406|-84.87|38.22,407|-84.12|36.95,408|-83.26|36.9,409|-83.74|36.95,410|-84.32|38.64,411|-83.06|38.38,412|-82.67|37.89,413|-83.48|37.58,414|-83.15|37.84,415|-82.39|37.46,416|-82.78|37.54,417|-83.25|37.23,418|-82.88|37.21,420|-88.57|36.9,421|-86.09|36.89,422|-87.11|36.95,423|-87.02|37.52,424|-87.7|37.47,425|-84.71|37.15,426|-84.82|36.81,427|-85.73|37.32,430|-82.9|40.21,431|-82.99|39.69,432|-82.97|39.98,433|-83.38|40.55,434|-83.3|41.42,435|-84.22|41.46,436|-83.54|41.67,437|-81.66|39.85,438|-81.88|40.27,439|-80.9|40.25,440|-80.97|41.64,441|-81.66|41.42,442|-81.6|41.13,443|-81.54|41.07,444|-80.77|41.09,445|-80.64|41.05,446|-81.53|40.65,447|-81.39|40.83,448|-82.77|41.02,449|-82.55|40.74,450|-84.48|39.43,451|-83.84|39.16,452|-84.48|39.18,453|-84.3|39.97,454|-84.18|39.74,455|-83.81|39.94,456|-82.86|38.99,457|-81.78|39.35,458|-84.23|40.83,460|-86.13|40.17,461|-86.18|39.62,462|-86.14|39.79,463|-87.05|41.41,464|-87.34|41.55,465|-86.08|41.44,466|-86.28|41.66,467|-85.21|41.17,468|-85.17|41.09,469|-86.14|40.76,470|-85.08|39.16,471|-86.02|38.43,472|-85.74|39.05,473|-85.15|40.09,474|-86.63|38.99,475|-87.03|38.46,476|-87.53|38.13,477|-87.58|38.03,478|-87.29|39.45,479|-87.11|40.5,480|-82.79|42.83,481|-83.62|42.2,482|-83.1|42.38,483|-83.35|42.66,484|-83.22|43.29,485|-83.69|43.03,486|-84.36|43.99,487|-83.67|44.45,488|-84.67|43.02,489|-84.59|42.74,490|-85.54|42.2,491|-86.36|41.87,492|-84.36|42.06,493|-85.57|43.33,494|-86.14|43.39,495|-85.66|42.96,496|-85.52|44.44,497|-84.37|45.17,498|-86.94|46.17,499|-88.93|46.6,500|-94.77|41.63,501|-92.79|41.84,502|-93.67|42.12,503|-93.63|41.59,504|-93.37|43.17,505|-94.45|42.77,506|-92.45|42.65,507|-92.31|42.49,508|-94.56|40.96,510|-95.91|42.6,511|-96.39|42.52,512|-96.06|43.28,513|-95.16|43.27,514|-95.08|42.11,515|-95.55|41.44,516|-95.37|40.74,520|-90.98|42.46,521|-91.73|43.2,522|-92.31|41.9,523|-91.66|41.87,524|-91.69|41.96,525|-92.46|40.95,526|-91.44|40.88,527|-90.88|41.64,528|-90.61|41.56,530|-88.24|43.51,531|-88.33|42.75,532|-87.98|43.06,534|-87.86|42.74,535|-89.66|42.95,537|-89.38|43.08,538|-90.73|42.88,539|-89.55|43.64,540|-92.46|45.08,541|-88.23|45.09,542|-87.6|44.52,543|-88.01|44.53,544|-89.85|44.93,545|-89.86|45.89,546|-90.87|43.93,547|-91.52|44.85,548|-91.63|46.04,549|-88.96|44.19,550|-92.98|45.17,551|-93.08|44.96,553|-94.06|44.99,554|-93.31|45.01,556|-91.03|47.67,557|-92.68|47.39,558|-92.08|46.96,559|-92.28|43.89,560|-94.04|44.02,561|-95.65|43.92,562|-95.75|45.08,563|-94.59|45.83,564|-94.5|46.63,565|-96.08|46.86,566|-94.31|47.88,567|-96.22|48.39,570|-97.07|43.48,571|-96.76|43.54,572|-97.18|45.04,573|-98.53|43.91,574|-98.93|45.36,575|-100.61|43.86,576|-101.59|45.43,577|-103.11|44.26,580|-97.39|46.66,581|-96.83|46.86,582|-97.72|48.25,583|-99.34|48.32,584|-99.12|46.88,585|-100.98|46.76,586|-102.99|46.75,587|-101.7|48.34,588|-103.48|48.2,590|-108.62|45.98,591|-108.45|45.69,592|-105.6|48.2,593|-105.58|46.4,594|-111.24|47.79,595|-109.12|48.38,596|-111.74|46.65,597|-112.31|45.48,598|-114.25|46.97,599|-114.57|48.37,600|-88.15|42.29,601|-88.47|42.01,602|-87.69|42.04,603|-87.79|41.89,604|-88.09|41.39,605|-88.55|41.69,606|-87.69|41.83,607|-87.82|42.03,608|-87.76|41.84,609|-87.92|40.8,610|-89.56|42.18,611|-89.08|42.28,612|-90.29|41.5,613|-89.16|41.34,614|-90.43|40.82,615|-89.68|40.71,616|-89.61|40.72,617|-88.89|40.52,618|-88.15|40.11,619|-88.19|39.66,620|-90.01|39.13,622|-89.72|38.41,623|-91.02|39.99,624|-88.19|39.04,625|-89.21|39.63,626|-90|39.86,627|-89.66|39.8,628|-88.65|38.35,629|-88.89|37.55,630|-90.83|38.35,631|-90.32|38.64,633|-91.11|39.02,634|-91.78|39.93,635|-92.61|40.2,636|-90.64|37.61,637|-89.81|37.37,638|-89.73|36.55,639|-90.62|36.84,640|-94.1|39.07,641|-94.58|39.14,644|-94.69|40.13,645|-94.83|39.75,646|-93.55|39.89,647|-94.15|38.06,648|-94.35|36.93,650|-92.23|38.45,651|-92.19|38.51,652|-92.38|39.21,653|-93.26|38.71,654|-92.03|37.93,655|-91.92|37.67,656|-93.08|36.76,657|-92.43|37.03,658|-93.3|37.22,660|-95.12|38.84,661|-94.73|39.11,662|-94.72|38.95,664|-96.15|39.64,665|-96.34|39.4,666|-95.76|39.06,667|-95.23|37.64,668|-96.39|38.36,669|-97.86|39.77,670|-98.49|37.33,671|-98.4|37.44,672|-97.33|37.7,673|-95.81|37.23,674|-97.79|38.98,675|-98.99|38.25,676|-99.47|39.34,677|-101.15|39.35,678|-100.82|37.91,679|-101.43|37.18,680|-96.46|41.55,681|-96.05|41.24,683|-96.93|40.39,684|-97.26|40.89,685|-96.69|40.82,686|-97.68|41.55,687|-98.16|42.43,688|-99.15|41.34,689|-98.9|40.34,690|-100.99|40.37,691|-101.59|41.42,692|-100.64|42.67,693|-102.84|42.29,700|-89.93|29.63,701|-89.93|30.02,703|-90.65|29.62,704|-90.27|30.66,705|-92.25|30.2,706|-93.21|30.34,707|-91.2|30.57,708|-91.1|30.45,710|-93.4|32.45,711|-93.75|32.47,712|-91.95|32.56,713|-91.86|31.43,714|-92.84|31.57,716|-91.75|33.61,717|-92.79|33.48,718|-93.84|33.66,719|-93.61|34.4,720|-91.9|34.92,721|-92.56|34.93,722|-92.37|34.7,723|-90.59|35.07,724|-90.76|36.04,725|-91.81|36.01,726|-92.93|36.15,727|-94.05|36.11,728|-93.33|35.3,729|-94.08|35.29,730|-97.83|35.31,731|-97.5|35.43,734|-97.14|34.21,735|-98.81|34.53,736|-99.33|35.52,737|-98.2|36.42,738|-99.54|36.5,739|-101.67|36.74,740|-96.19|36.34,741|-95.96|36.15,743|-95.02|36.55,744|-95.44|35.64,745|-95.65|34.66,746|-97.05|36.71,747|-95.41|34.02,748|-96.66|35.17,749|-94.69|35.23,750|-96.76|33.06,751|-96.32|32.48,752|-96.78|32.79,753|-96.84|32.81,754|-95.67|33.37,755|-94.45|33.3,756|-94.58|32.49,757|-95.37|32.24,758|-95.68|31.44,759|-94.29|31.29,760|-97.54|32.59,761|-97.38|32.77,762|-97.44|33.52,763|-98.87|33.73,764|-98.59|32.61,765|-97.62|31.11,766|-97.06|31.7,767|-97.15|31.57,768|-99.37|31.23,769|-100.88|31.03,770|-95.39|29.79,772|-95.37|29.77,773|-95.24|30.48,774|-96.02|29.38,775|-94.98|29.68,776|-94.16|30.27,777|-94.19|29.96,778|-96.32|30.67,779|-96.95|28.92,780|-99.01|28.67,781|-97.93|29.08,782|-98.53|29.47,783|-98.14|27.63,784|-97.44|27.73,785|-98.19|26.39,786|-98.1|30.27,787|-97.78|30.3,788|-100.26|29.44,789|-96.87|29.92,790|-101.63|35.48,791|-101.85|35.21,792|-100.57|34.25,793|-102.15|33.37,794|-101.88|33.58,795|-100.31|32.7,796|-99.72|32.46,797|-102.22|31.57,798|-104.17|30.53,799|-106.16|31.8,800|-105.11|39.91,801|-104.47|39.51,802|-104.93|39.78,803|-105.31|40.04,804|-106.16|39.98,805|-105.35|40.57,806|-104.49|40.38,807|-103.09|40.4,808|-103.16|39.12,809|-104.67|38.79,810|-103.58|37.77,811|-106.39|37.54,812|-106.39|38.46,813|-108.42|37.49,814|-108.02|38.43,815|-108.7|38.92,816|-107.86|39.99,820|-105.27|41.31,821|-110.51|44.57,822|-104.67|42.39,823|-107.03|41.75,824|-108.65|44.32,825|-108.91|43.14,826|-106.43|43.1,827|-105|44.2,828|-106.71|44.55,829|-109.71|42.82,830|-110.51|43.7,831|-110.53|42.6,832|-112.17|42.66,833|-114.23|42.81,834|-111.63|43.86,835|-115.77|46.07,836|-115.99|44,837|-116.04|43.58,838|-116.47|47.77,840|-110.86|40.53,841|-111.81|40.71,843|-112.18|41.67,844|-112.01|41.23,845|-109.72|38.09,846|-111.68|39.63,847|-112.82|37.61,850|-112.09|33.63,851|-111.41|33,852|-111.69|33.6,853|-113.44|33.49,855|-110.3|33.43,856|-110.59|32,857|-111.09|32.18,859|-109.81|34.23,860|-111.15|35.89,863|-112.57|34.85,864|-113.79|35.66,865|-109.55|36.03,870|-106.9|35.22,871|-106.72|35.12,873|-108.56|35.44,874|-108.23|36.59,875|-106.04|36.27,877|-104.68|36.06,878|-107.94|34,879|-107.48|33.2,880|-108.03|32.37,881|-103.81|34.26,882|-104.07|32.87,883|-105.48|33.62,884|-103.79|35.74,890|-114.84|37,891|-115.42|36.33,893|-116.96|39.5,894|-118.06|41.29,895|-119.72|39.9,897|-119.8|39.18,898|-115.71|40.95,900|-118.32|34.04,902|-118.76|34.07,903|-118.34|33.95,904|-118.48|34.02,905|-118.33|33.83,906|-118.03|33.93,907|-118.45|33.39,908|-118.18|33.8,910|-118.25|34.28,911|-118.13|34.15,912|-118.25|34.19,913|-118.55|34.36,914|-118.47|34.18,915|-118.33|34.19,916|-118.38|34.18,917|-117.78|34.14,918|-118.13|34.09,919|-116.62|32.73,920|-116.7|33.16,921|-117.14|32.85,922|-115.5|33.59,923|-117.14|34.66,924|-117.33|34.17,925|-117.06|33.68,926|-117.73|33.63,927|-117.85|33.74,928|-117.71|33.85,930|-119.12|34.39,931|-119.97|34.48,932|-119.07|35.98,933|-119.01|35.35,934|-120.5|35.38,935|-118.36|37.37,936|-119.72|36.95,937|-119.85|36.71,939|-121.42|36.34,940|-122.31|37.41,941|-122.44|37.77,943|-122.13|37.44,944|-122.32|37.53,945|-122.05|38.09,946|-122.19|37.78,947|-122.26|37.89,948|-122.3|37.97,949|-122.74|38.14,950|-121.42|36.85,951|-121.76|37.33,952|-120.79|38.14,953|-120.56|37.62,954|-123.15|39.08,955|-123.75|40.5,956|-121.34|38.62,957|-120.86|39.13,958|-121.44|38.58,959|-121.73|39.47,960|-122.42|41.06,961|-120.33|40.52,967|-155.53|19.6,968|-157.83|21.34,969|144.77|13.45,970|-121.45|45.3,971|-123.79|45.64,972|-122.74|45.57,973|-123.26|44.68,974|-123.46|43.61,975|-123.06|42.34,976|-120.4|42.67,977|-120.77|44.32,978|-118.59|45.21,979|-117.63|43.34,980|-121.78|47.42,981|-122.32|47.6,982|-121.79|48.39,983|-123.87|47.96,984|-122.46|47.18,985|-123.27|46.94,986|-122.15|45.99,988|-119.91|48,989|-120.57|46.71,990|-117.56|47.62,991|-118.13|47.91,992|-117.4|47.67,993|-118.82|46.4,994|-117.21|46.2,995|-156.93|60.89,996|-151.66|60.82,997|-146.69|65.19,998|-136.2|58.94,999|-131.24|55.86";
|
|
703
703
|
var k = "ABW|-70.02|12.54,AFG|68|34.63,AGO|14.24|-9.84,AIA|-63.06|18.22,ALA|19.93|60.1,ALB|19.81|41.14,AND|1.53|42.51,ARE|55.24|24.99,ARG|-61.28|-32.95,ARM|44.52|40.23,ASM|-170.7|-14.28,ATA|21.28|-80.52,ATF|70.22|-49.35,ATG|-61.84|17.12,AUS|144.91|-33.49,AUT|15.51|47.93,AZE|49.02|40.37,BDI|29.49|-3.34,BEL|4.37|50.89,BEN|2.33|7.65,BES|-68.27|12.15,BFA|-2.08|12.15,BGD|90.42|23.65,BGR|24.92|42.71,BHR|50.57|26.18,BHS|-77.34|25.06,BIH|17.97|44.18,BLM|-62.85|17.9,BLR|27.81|53.57,BLZ|-88.41|17.54,BMU|-64.78|32.29,BOL|-65.79|-17.39,BRA|-45.89|-17.51,BRB|-59.62|13.11,BRN|114.74|4.82,BTN|89.69|27.32,BWA|25.99|-23.43,CAF|18.32|4.94,CAN|-79.4|43.71,CCK|96.82|-12.16,CHE|7.96|47.07,CHL|-71.21|-33.72,CHN|114.44|32,CIV|-4.89|6.16,CMR|11.19|5.41,COD|20.23|-4.72,COG|14.18|-4.04,COK|-159.78|-21.21,COL|-74.85|5.93,COM|43.58|-11.89,CPV|-23.87|15.66,CRI|-84.14|9.99,CUB|-80.25|22.21,CUW|-68.88|12.12,CXR|105.68|-10.42,CYM|-81.38|19.32,CYP|33.31|35,CZE|15.44|49.89,DEU|9.65|51.24,DJI|43.15|11.59,DMA|-61.39|15.3,DNK|11.42|55.79,DOM|-70.07|18.75,DZA|3.55|35.62,ECU|-79.29|-1.4,EGY|31.22|29.84,ERI|38.84|15.25,ESH|-13.19|27.14,ESP|-2.91|39.69,EST|25.17|59.29,ETH|39.02|9.26,FIN|24.87|61.26,FJI|178.2|-17.85,FLK|-57.86|-51.69,FRA|2.87|47.28,FRO|-6.77|62.01,FSM|158.16|6.92,GAB|10.22|-0.06,GBR|-1.37|52.49,GEO|43.92|41.84,GGY|-2.54|49.46,GHA|-0.98|6.4,GIB|-5.35|36.14,GIN|-12.8|9.75,GLP|-61.53|16.23,GMB|-16.59|13.41,GNB|-15.48|11.9,GNQ|9.77|1.86,GRC|23.73|37.98,GRD|-61.75|12.05,GRL|-51.72|64.18,GTM|-90.71|14.73,GUF|-52.64|5.04,GUM|144.82|13.5,GUY|-58.11|6.63,HKG|114.15|22.33,HMD|73.5|-53.1,HND|-87.41|14.94,HRV|16.21|45.31,HTI|-72.34|18.54,HUN|19.21|47.39,IDN|106.85|-6.21,IMN|-4.48|54.15,IND|78.36|21,IOT|71.35|-6.19,IRL|-6.87|53.12,IRN|51.6|34.4,IRQ|44.78|33.65,ISL|-21.7|64.22,ISR|34.97|32.07,ITA|12|42.73,JAM|-76.91|18.03,JEY|-2.1|49.19,JOR|35.96|32.03,JPN|137.27|35.53,KAZ|70.17|47.24,KEN|36.81|-0.97,KGZ|73.96|41.94,KHM|104.7|11.75,KIR|172.98|1.33,KNA|-62.72|17.3,KOR|127.51|36.58,KWT|48.06|29.2,Kosovo|20.9|42.58,LAO|102.6|17.97,LBN|35.53|33.87,LBR|-10.39|6.36,LBY|13.19|32.89,LCA|-60.97|14.04,LIE|9.52|47.14,LKA|80.25|7.25,LSO|27.67|-29.38,LTU|24.18|55.04,LUX|6.08|49.56,LVA|24.13|56.85,MAC|113.55|22.19,MAF|-63.08|18.07,MAR|-6.65|33.43,MCO|7.42|43.74,MDA|28.82|47.09,MDG|47.46|-18.89,MDV|73.51|4.18,MEX|-100.65|21.59,MHL|171.38|7.09,MKD|21.47|41.8,MLI|-7.15|12.95,MLT|14.46|35.91,MMR|96.18|18.74,MNE|19.17|42.53,MNG|105.33|47.94,MNP|145.75|15.21,MOZ|32.58|-25.97,MRT|-14.58|18.01,MSR|-62.21|16.79,MTQ|-61.01|14.64,MUS|57.51|-20.23,MWI|34.34|-14.24,MYS|103.35|3.45,MYT|45.23|-12.77,N. Cyprus|33.56|35.27,NAM|17.19|-21.34,NCL|166.47|-22.26,NER|5.05|14.04,NFK|167.97|-29.05,NGA|5.91|7.87,NIC|-86.17|12.33,NIU|-169.92|-19.05,NLD|5.21|52.09,NOR|9.62|60.46,NPL|84.7|27.64,NRU|166.93|-0.55,NZL|174.54|-38.9,OMN|57.69|23.27,PAK|71.47|30.24,PAN|-79.83|8.98,PCN|-130.1|-25.07,PER|-76.4|-11.18,PHL|121.05|14.65,PLW|134.58|7.52,PNG|147.4|-7.71,POL|19.26|51.79,PRI|-66.24|18.35,PRK|126.54|39.52,PRT|-9.08|39.42,PRY|-57.15|-25.27,PSE|35.23|31.78,PYF|-149.59|-17.57,QAT|51.49|25.32,REU|55.45|-21.08,ROU|25.47|45.38,RUS|51.84|54.52,RWA|29.78|-1.98,SAU|43.01|23.76,SDN|31.67|14.67,SEN|-16.73|14.66,SGP|103.85|1.33,SGS|-36.51|-54.28,SHN|-5.72|-15.92,SJM|15.65|78.22,SLB|159.97|-9.44,SLE|-12.4|8.36,SLV|-89.08|13.7,SMR|12.45|43.94,SOM|44.96|4.91,SPM|-56.18|46.78,SRB|20.62|44.5,SSD|29.91|6.61,STP|6.73|0.34,SUR|-55.18|5.84,SVK|18.69|48.55,SVN|14.83|46.16,SWE|16.03|58.86,SWZ|31.28|-26.43,SXM|-63.05|18.03,SYC|55.46|-4.62,SYR|37.18|35.12,Somaliland|46.23|9.76,TCA|-72.1|21.74,TCD|16.57|11.53,TGO|1.16|6.8,THA|100.71|13.71,TJK|69.39|39.08,TKM|59.4|38.74,TLS|125.65|-8.67,TON|-175.2|-21.14,TTO|-61.4|10.5,TUN|10.23|35.87,TUR|32.1|39.5,TUV|179.19|-8.52,TWN|121.06|24.37,TZA|36.11|-5.88,UGA|32.23|0.59,UKR|32.8|48.99,URY|-56.28|-34.1,USA|-93.51|37.4,UZB|69.22|41.26,VAT|12.45|41.9,VCT|-61.21|13.14,VEN|-67.82|9.83,VGB|-64.62|18.43,VIR|-64.8|17.9,VNM|106.63|10.82,VUT|168.31|-17.74,WLF|-176.17|-13.28,WSM|-171.77|-13.83,YEM|44.62|14.36,ZAF|26.96|-28.33,ZMB|28.41|-13.86,ZWE|30.49|-18.56";
|
|
704
704
|
var W = { \u00F8: "o", \u0153: "oe", \u00E6: "ae", \u00DF: "ss", \u0142: "l", \u0111: "d", \u00F0: "d", \u00FE: "th", \u0131: "i", \u0127: "h", \u0167: "t", \u014B: "n", \u0138: "k", \u0259: "e", \u01DD: "e", \u0133: "ij", \u0140: "l", \u017F: "s" };
|
|
705
|
-
function u(
|
|
706
|
-
return
|
|
705
|
+
function u(n2) {
|
|
706
|
+
return n2.normalize("NFD").replace(/\p{Diacritic}/gu, "").toLowerCase().replace(/[øœæßłđðþıħŧŋəĸ]/g, (e2) => W[e2]).replace(/[^\p{L}\p{Nd}\s]/gu, " ").replace(/\s+/g, " ").trim();
|
|
707
707
|
}
|
|
708
708
|
var _ = "AD AND,AE ARE,AF AFG,AG ATG,AI AIA,AL ALB,AM ARM,AO AGO,AQ ATA,AR ARG,AS ASM,AT AUT,AU AUS,AW ABW,AX ALA,AZ AZE,BA BIH,BB BRB,BD BGD,BE BEL,BF BFA,BG BGR,BH BHR,BI BDI,BJ BEN,BL BLM,BM BMU,BN BRN,BO BOL,BQ BES,BR BRA,BS BHS,BT BTN,BV BVT,BW BWA,BY BLR,BZ BLZ,CA CAN,CC CCK,CD COD,CF CAF,CG COG,CH CHE,CI CIV,CK COK,CL CHL,CM CMR,CN CHN,CO COL,CR CRI,CU CUB,CV CPV,CW CUW,CX CXR,CY CYP,CZ CZE,DE DEU,DJ DJI,DK DNK,DM DMA,DO DOM,DZ DZA,EC ECU,EE EST,EG EGY,EH ESH,ER ERI,ES ESP,ET ETH,FI FIN,FJ FJI,FK FLK,FM FSM,FO FRO,FR FRA,GA GAB,GB GBR,GD GRD,GE GEO,GF GUF,GG GGY,GH GHA,GI GIB,GL GRL,GM GMB,GN GIN,GP GLP,GQ GNQ,GR GRC,GS SGS,GT GTM,GU GUM,GW GNB,GY GUY,HK HKG,HM HMD,HN HND,HR HRV,HT HTI,HU HUN,ID IDN,IE IRL,IL ISR,IM IMN,IN IND,IO IOT,IQ IRQ,IR IRN,IS ISL,IT ITA,JE JEY,JM JAM,JO JOR,JP JPN,KE KEN,KG KGZ,KH KHM,KI KIR,KM COM,KN KNA,KP PRK,KR KOR,KW KWT,KY CYM,KZ KAZ,LA LAO,LB LBN,LC LCA,LI LIE,LK LKA,LR LBR,LS LSO,LT LTU,LU LUX,LV LVA,LY LBY,MA MAR,MC MCO,MD MDA,ME MNE,MF MAF,MG MDG,MH MHL,MK MKD,ML MLI,MM MMR,MN MNG,MO MAC,MP MNP,MQ MTQ,MR MRT,MS MSR,MT MLT,MU MUS,MV MDV,MW MWI,MX MEX,MY MYS,MZ MOZ,NA NAM,NC NCL,NE NER,NF NFK,NG NGA,NI NIC,NL NLD,NO NOR,NP NPL,NR NRU,NU NIU,NZ NZL,OM OMN,PA PAN,PE PER,PF PYF,PG PNG,PH PHL,PK PAK,PL POL,PM SPM,PN PCN,PR PRI,PS PSE,PT PRT,PW PLW,PY PRY,QA QAT,RE REU,RO ROU,RS SRB,RU RUS,RW RWA,SA SAU,SB SLB,SC SYC,SD SDN,SE SWE,SG SGP,SH SHN,SI SVN,SJ SJM,SK SVK,SL SLE,SM SMR,SN SEN,SO SOM,SR SUR,SS SSD,ST STP,SV SLV,SX SXM,SY SYR,SZ SWZ,TC TCA,TD TCD,TF ATF,TG TGO,TH THA,TJ TJK,TK TKL,TL TLS,TM TKM,TN TUN,TO TON,TR TUR,TT TTO,TV TUV,TW TWN,TZ TZA,UA UKR,UG UGA,UM UMI,US USA,UY URY,UZ UZB,VA VAT,VC VCT,VE VEN,VG VGB,VI VIR,VN VNM,VU VUT,WF WLF,WS WSM,YE YEM,YT MYT,ZA ZAF,ZM ZMB,ZW ZWE";
|
|
709
709
|
var N = (() => {
|
|
710
|
-
let
|
|
711
|
-
for (let
|
|
712
|
-
let [
|
|
713
|
-
|
|
710
|
+
let n2 = /* @__PURE__ */ new Map();
|
|
711
|
+
for (let e2 of _.split(",")) {
|
|
712
|
+
let [t2, o2] = e2.split(" ");
|
|
713
|
+
t2 && o2 && n2.set(t2, o2);
|
|
714
714
|
}
|
|
715
|
-
return
|
|
715
|
+
return n2;
|
|
716
716
|
})();
|
|
717
717
|
var z = new Set(N.keys());
|
|
718
718
|
var J = new Set(N.values());
|
|
@@ -721,55 +721,55 @@ var Q = { usa: "USA", "u.s.": "USA", "u.s.a.": "USA", us: "USA", america: "USA",
|
|
|
721
721
|
var b = null;
|
|
722
722
|
function j() {
|
|
723
723
|
if (b) return b;
|
|
724
|
-
let
|
|
725
|
-
for (let
|
|
726
|
-
let
|
|
724
|
+
let n2 = /* @__PURE__ */ new Map(), e2 = ["en", ...v.filter((t2) => t2 !== "en")];
|
|
725
|
+
for (let t2 of e2) {
|
|
726
|
+
let o2 = null;
|
|
727
727
|
try {
|
|
728
|
-
|
|
728
|
+
o2 = new Intl.DisplayNames([t2], { type: "region" });
|
|
729
729
|
} catch {
|
|
730
730
|
continue;
|
|
731
731
|
}
|
|
732
|
-
for (let [
|
|
733
|
-
let
|
|
732
|
+
for (let [i4, r2] of N) {
|
|
733
|
+
let a5;
|
|
734
734
|
try {
|
|
735
|
-
|
|
735
|
+
a5 = o2.of(i4);
|
|
736
736
|
} catch {
|
|
737
|
-
|
|
737
|
+
a5 = void 0;
|
|
738
738
|
}
|
|
739
|
-
if (!
|
|
740
|
-
let
|
|
741
|
-
|
|
739
|
+
if (!a5 || a5 === i4) continue;
|
|
740
|
+
let s4 = u(a5);
|
|
741
|
+
s4 && !n2.has(s4) && n2.set(s4, r2);
|
|
742
742
|
}
|
|
743
743
|
}
|
|
744
|
-
for (let [
|
|
745
|
-
let
|
|
746
|
-
|
|
744
|
+
for (let [t2, o2] of Object.entries(Q)) {
|
|
745
|
+
let i4 = u(t2);
|
|
746
|
+
i4 && n2.set(i4, o2);
|
|
747
747
|
}
|
|
748
|
-
return b =
|
|
748
|
+
return b = n2, n2;
|
|
749
749
|
}
|
|
750
|
-
function T(
|
|
751
|
-
return N.get(String(
|
|
750
|
+
function T(n2) {
|
|
751
|
+
return N.get(String(n2 || "").trim().toUpperCase()) ?? null;
|
|
752
752
|
}
|
|
753
|
-
function E(
|
|
754
|
-
if (
|
|
755
|
-
let
|
|
756
|
-
if (!
|
|
757
|
-
let
|
|
758
|
-
return
|
|
753
|
+
function E(n2) {
|
|
754
|
+
if (n2 == null) return null;
|
|
755
|
+
let e2 = String(n2).trim();
|
|
756
|
+
if (!e2) return null;
|
|
757
|
+
let t2 = e2.toUpperCase();
|
|
758
|
+
return t2.length === 3 && J.has(t2) ? t2 : t2.length === 2 && z.has(t2) ? N.get(t2) ?? null : j().get(u(e2)) ?? null;
|
|
759
759
|
}
|
|
760
760
|
var $ = /* @__PURE__ */ new Set(["n a", "none", "null", "nil", "unknown", "not applicable", "not available", "not specified", "unspecified", "missing", "blank", "empty", "tbd", "to be determined"]);
|
|
761
|
-
function V(
|
|
762
|
-
return
|
|
761
|
+
function V(n2) {
|
|
762
|
+
return n2 ? $.has(n2) : true;
|
|
763
763
|
}
|
|
764
764
|
var m3 = 80;
|
|
765
765
|
var q = { "north-america": "N", world: "W" };
|
|
766
|
-
function F(
|
|
767
|
-
let
|
|
768
|
-
return
|
|
766
|
+
function F(n2, e2) {
|
|
767
|
+
let t2 = n2.filter((o2) => o2.row.kinds.includes(q[e2 || "north-america"]));
|
|
768
|
+
return t2.length ? t2 : (e2 || "north-america") === "world" ? n2 : t2;
|
|
769
769
|
}
|
|
770
770
|
var P = a;
|
|
771
|
-
function L3(
|
|
772
|
-
|
|
771
|
+
function L3(n2) {
|
|
772
|
+
n2 !== P && (P = n2 || "", U = null, L = null, I = null);
|
|
773
773
|
}
|
|
774
774
|
function n3() {
|
|
775
775
|
return P.length > 0;
|
|
@@ -778,212 +778,212 @@ var t3 = { US: "washington", CA: "ottawa", MX: "mexico city", GB: "london", FR:
|
|
|
778
778
|
var U = null;
|
|
779
779
|
function y() {
|
|
780
780
|
if (U) return U;
|
|
781
|
-
let
|
|
782
|
-
if (!
|
|
783
|
-
let
|
|
784
|
-
|
|
781
|
+
let n2 = /* @__PURE__ */ new Map(), e2 = P, t2 = (o2, i4, r2) => {
|
|
782
|
+
if (!o2) return;
|
|
783
|
+
let a5 = n2.get(o2);
|
|
784
|
+
a5 ? a5.some((s4) => s4.row === i4) || a5.push({ row: i4, primary: r2 }) : n2.set(o2, [{ row: i4, primary: r2 }]);
|
|
785
785
|
};
|
|
786
|
-
for (let
|
|
787
|
-
let
|
|
788
|
-
if (
|
|
789
|
-
let
|
|
790
|
-
|
|
791
|
-
let
|
|
792
|
-
if (
|
|
786
|
+
for (let o2 of e2.split(",")) {
|
|
787
|
+
let i4 = o2.split("|");
|
|
788
|
+
if (i4.length < 7) continue;
|
|
789
|
+
let r2 = { a1: i4[1], cc: i4[2], lon: +i4[3], lat: +i4[4], pop: +i4[5], kinds: i4[6] || "N" };
|
|
790
|
+
i4.length > 8 && i4[8] && (r2.tags = i4[8].split(";").filter(Boolean));
|
|
791
|
+
let a5 = t3[r2.cc];
|
|
792
|
+
if (a5 && u(i4[0]) === a5 && (r2.tags || (r2.tags = []), r2.tags.includes("capital") || r2.tags.push("capital")), t2(u(i4[0]), r2, true), i4.length > 7 && i4[7]) for (let s4 of i4[7].split(";")) t2(u(s4), r2, false);
|
|
793
793
|
}
|
|
794
|
-
for (let
|
|
795
|
-
return U =
|
|
794
|
+
for (let o2 of n2.values()) o2.sort((i4, r2) => r2.row.pop - i4.row.pop);
|
|
795
|
+
return U = n2, n2;
|
|
796
796
|
}
|
|
797
797
|
var e3 = 200;
|
|
798
798
|
var L = null;
|
|
799
799
|
function i3() {
|
|
800
800
|
if (L) return L;
|
|
801
|
-
let
|
|
802
|
-
for (let [
|
|
803
|
-
if (!
|
|
804
|
-
let
|
|
805
|
-
!
|
|
806
|
-
}
|
|
807
|
-
return L =
|
|
808
|
-
}
|
|
809
|
-
function O(
|
|
810
|
-
if (!
|
|
811
|
-
let
|
|
812
|
-
if (
|
|
813
|
-
let
|
|
814
|
-
if (!
|
|
815
|
-
let
|
|
816
|
-
return
|
|
801
|
+
let n2 = /* @__PURE__ */ new Map();
|
|
802
|
+
for (let [e2, t2] of y()) {
|
|
803
|
+
if (!e2.endsWith(" city")) continue;
|
|
804
|
+
let o2 = e2.slice(0, -5);
|
|
805
|
+
!o2 || y().get(o2)?.some((i4) => i4.primary) || t2[0].row.pop < e3 || n2.set(o2, t2);
|
|
806
|
+
}
|
|
807
|
+
return L = n2, n2;
|
|
808
|
+
}
|
|
809
|
+
function O(n2) {
|
|
810
|
+
if (!n2) return;
|
|
811
|
+
let e2 = y().get(n2);
|
|
812
|
+
if (e2?.some((i4) => i4.primary)) return e2;
|
|
813
|
+
let t2 = i3().get(n2);
|
|
814
|
+
if (!t2) return e2;
|
|
815
|
+
let o2 = t2.map((i4) => ({ row: i4.row, primary: true }));
|
|
816
|
+
return e2 ? [...o2, ...e2] : o2;
|
|
817
817
|
}
|
|
818
818
|
var I = null;
|
|
819
819
|
function o3() {
|
|
820
820
|
if (I) return I;
|
|
821
|
-
let
|
|
822
|
-
for (let
|
|
823
|
-
let
|
|
824
|
-
|
|
821
|
+
let n2 = /* @__PURE__ */ new Map();
|
|
822
|
+
for (let t2 of k.split(",")) {
|
|
823
|
+
let o2 = t2.split("|");
|
|
824
|
+
o2.length < 3 || n2.set(o2[0], { lon: +o2[1], lat: +o2[2] });
|
|
825
825
|
}
|
|
826
|
-
let
|
|
827
|
-
for (let
|
|
828
|
-
let
|
|
829
|
-
if (!
|
|
830
|
-
let
|
|
831
|
-
(
|
|
826
|
+
let e2 = /* @__PURE__ */ new Map();
|
|
827
|
+
for (let t2 of y().values()) for (let o2 of t2) {
|
|
828
|
+
let i4 = T(o2.row.cc);
|
|
829
|
+
if (!i4) continue;
|
|
830
|
+
let r2 = e2.get(i4);
|
|
831
|
+
(r2 === void 0 || o2.row.pop > r2) && (e2.set(i4, o2.row.pop), n2.set(i4, { lon: o2.row.lon, lat: o2.row.lat }));
|
|
832
832
|
}
|
|
833
|
-
return I =
|
|
833
|
+
return I = n2, n2;
|
|
834
834
|
}
|
|
835
835
|
var B = null;
|
|
836
836
|
function D() {
|
|
837
837
|
if (B) return B;
|
|
838
|
-
let
|
|
839
|
-
for (let
|
|
840
|
-
let
|
|
841
|
-
if (
|
|
842
|
-
let
|
|
843
|
-
|
|
844
|
-
let
|
|
845
|
-
|
|
838
|
+
let n2 = /* @__PURE__ */ new Map();
|
|
839
|
+
for (let e2 of H.split(",")) {
|
|
840
|
+
let t2 = e2.split("|");
|
|
841
|
+
if (t2.length < 5) continue;
|
|
842
|
+
let o2 = { key: t2[0], cc: t2[1], name: t2[2], lon: +t2[3], lat: +t2[4] };
|
|
843
|
+
n2.set(u(o2.key), o2);
|
|
844
|
+
let i4 = u(o2.name);
|
|
845
|
+
i4 === "mexico" && o2.cc === "MX" ? (n2.set("estado de mexico", o2), n2.set("edomex", o2)) : n2.set(i4, o2);
|
|
846
846
|
}
|
|
847
|
-
return B =
|
|
847
|
+
return B = n2, n2;
|
|
848
848
|
}
|
|
849
849
|
var h = null;
|
|
850
850
|
function a3() {
|
|
851
851
|
if (h) return h;
|
|
852
|
-
let
|
|
853
|
-
for (let
|
|
854
|
-
let
|
|
855
|
-
|
|
852
|
+
let n2 = /* @__PURE__ */ new Map();
|
|
853
|
+
for (let e2 of X.split(",")) {
|
|
854
|
+
let t2 = e2.split("|");
|
|
855
|
+
t2.length < 3 || n2.set(t2[0], { lon: +t2[1], lat: +t2[2] });
|
|
856
856
|
}
|
|
857
|
-
return h =
|
|
857
|
+
return h = n2, n2;
|
|
858
858
|
}
|
|
859
859
|
var r3 = /* @__PURE__ */ new Set(["USA", "PRI", "VIR", "GUM", "ASM", "MNP"]);
|
|
860
860
|
var s3 = /* @__PURE__ */ new Set(["USA", "CAN", "MEX"]);
|
|
861
|
-
function Y(
|
|
862
|
-
if (
|
|
863
|
-
let
|
|
864
|
-
return
|
|
865
|
-
}
|
|
866
|
-
function u3(
|
|
867
|
-
return D().get(u(
|
|
868
|
-
}
|
|
869
|
-
function c3(
|
|
870
|
-
let
|
|
871
|
-
return
|
|
872
|
-
}
|
|
873
|
-
function M3(
|
|
874
|
-
if (
|
|
875
|
-
let
|
|
876
|
-
if (!
|
|
877
|
-
let
|
|
878
|
-
return
|
|
879
|
-
}
|
|
880
|
-
function Z(
|
|
881
|
-
if (
|
|
882
|
-
let
|
|
883
|
-
if (!
|
|
884
|
-
if (/^\d{3}$/.test(
|
|
885
|
-
let
|
|
886
|
-
return
|
|
887
|
-
}
|
|
888
|
-
let
|
|
889
|
-
return
|
|
890
|
-
}
|
|
891
|
-
function S3(
|
|
892
|
-
return !!
|
|
893
|
-
}
|
|
894
|
-
function A3(
|
|
895
|
-
let
|
|
896
|
-
if (
|
|
897
|
-
let
|
|
898
|
-
if (isFinite(
|
|
899
|
-
else return { lat:
|
|
900
|
-
}
|
|
901
|
-
let
|
|
902
|
-
if (
|
|
903
|
-
let
|
|
904
|
-
if (
|
|
905
|
-
let
|
|
906
|
-
for (let
|
|
907
|
-
let
|
|
908
|
-
if (
|
|
861
|
+
function Y(n2) {
|
|
862
|
+
if (n2 == null) return null;
|
|
863
|
+
let e2 = u(String(n2));
|
|
864
|
+
return e2 ? D().get(e2)?.key ?? null : null;
|
|
865
|
+
}
|
|
866
|
+
function u3(n2) {
|
|
867
|
+
return D().get(u(n2))?.cc ?? null;
|
|
868
|
+
}
|
|
869
|
+
function c3(n2) {
|
|
870
|
+
let e2 = u3(n2);
|
|
871
|
+
return e2 ? T(e2) : null;
|
|
872
|
+
}
|
|
873
|
+
function M3(n2) {
|
|
874
|
+
if (n2 == null) return null;
|
|
875
|
+
let e2 = String(n2).trim().replace(/\.0+$/, "");
|
|
876
|
+
if (!e2) return null;
|
|
877
|
+
let t2 = /^(\d{5})(-\d{4})?$/.exec(e2);
|
|
878
|
+
return t2 ? t2[1] : /^\d{3,4}$/.test(e2) ? e2.padStart(5, "0") : null;
|
|
879
|
+
}
|
|
880
|
+
function Z(n2) {
|
|
881
|
+
if (n2 == null) return [];
|
|
882
|
+
let e2 = String(n2).trim().replace(/\.0+$/, "");
|
|
883
|
+
if (!e2) return [];
|
|
884
|
+
if (/^\d{3}$/.test(e2)) {
|
|
885
|
+
let o2 = e2.padStart(5, "0").slice(0, 3);
|
|
886
|
+
return o2 === e2 ? [e2] : [e2, o2];
|
|
887
|
+
}
|
|
888
|
+
let t2 = M3(e2);
|
|
889
|
+
return t2 ? [t2.slice(0, 3)] : [];
|
|
890
|
+
}
|
|
891
|
+
function S3(n2) {
|
|
892
|
+
return !!n2 && n2.ambiguous === true && !("precision" in n2);
|
|
893
|
+
}
|
|
894
|
+
function A3(n2) {
|
|
895
|
+
let e2 = null, t2 = typeof n2.lat == "string" ? n2.lat.trim() : n2.lat, o2 = typeof n2.lon == "string" ? n2.lon.trim() : n2.lon;
|
|
896
|
+
if (t2 != null && t2 !== "" && o2 !== void 0 && o2 !== null && o2 !== "") {
|
|
897
|
+
let a5 = +t2, s4 = +o2;
|
|
898
|
+
if (isFinite(a5) && isFinite(s4) && a5 >= -90 && a5 <= 90 && s4 >= -180 && s4 <= 180) if (a5 === 0 && s4 === 0) e2 = { lat: 0, lon: 0, precision: "latlon" };
|
|
899
|
+
else return { lat: a5, lon: s4, precision: "latlon" };
|
|
900
|
+
}
|
|
901
|
+
let i4 = E(n2.country), r2 = Y(n2.state);
|
|
902
|
+
if (r2 && i4 && c3(r2) !== i4 && (r2 = null), n2.city !== void 0 && n2.city !== null) {
|
|
903
|
+
let a5 = u(String(n2.city)), s4 = O(a5), f4 = s4 ? F(s4, n2.mapKind) : null;
|
|
904
|
+
if (f4 && f4.length) {
|
|
905
|
+
let d2 = n2.state === void 0 || n2.state === null ? "" : String(n2.state).trim(), R2 = d2 ? u(d2) : "", g4 = d2 ? Y(d2) : null, S2 = [], m2 = -1;
|
|
906
|
+
for (let c4 of f4) {
|
|
907
|
+
let l3 = c4.row, A2 = 0;
|
|
908
|
+
if (d2 && l3.a1 !== "") if (g4 && l3.a1 === g4 || u(l3.a1) === R2) A2++;
|
|
909
909
|
else continue;
|
|
910
|
-
if (
|
|
910
|
+
if (i4) if (T(l3.cc) === i4) A2++;
|
|
911
911
|
else continue;
|
|
912
|
-
|
|
912
|
+
A2 > m2 ? (m2 = A2, S2 = [c4]) : A2 === m2 && S2.push(c4);
|
|
913
913
|
}
|
|
914
|
-
|
|
915
|
-
let
|
|
916
|
-
for (let
|
|
917
|
-
if (
|
|
918
|
-
let
|
|
919
|
-
return { lat:
|
|
914
|
+
S2.some((c4) => c4.primary) && (S2 = S2.filter((c4) => c4.primary));
|
|
915
|
+
let p4 = /* @__PURE__ */ new Map();
|
|
916
|
+
for (let c4 of S2) p4.set(c4.row.lon.toFixed(2) + "," + c4.row.lat.toFixed(2), c4.row);
|
|
917
|
+
if (p4.size === 1) {
|
|
918
|
+
let c4 = S2[0].row;
|
|
919
|
+
return { lat: c4.lat, lon: c4.lon, precision: "city" };
|
|
920
920
|
}
|
|
921
|
-
if (
|
|
921
|
+
if (p4.size > 1) return { ambiguous: true, matches: p4.size };
|
|
922
922
|
}
|
|
923
923
|
}
|
|
924
|
-
if (!
|
|
925
|
-
let
|
|
926
|
-
if (
|
|
924
|
+
if (!i4 || r3.has(i4)) for (let a5 of Z(n2.zip)) {
|
|
925
|
+
let s4 = a3().get(a5);
|
|
926
|
+
if (s4) return { lat: s4.lat, lon: s4.lon, precision: "zip3" };
|
|
927
927
|
}
|
|
928
|
-
if (
|
|
929
|
-
let
|
|
930
|
-
if (
|
|
928
|
+
if (r2) {
|
|
929
|
+
let a5 = D().get(u(r2));
|
|
930
|
+
if (a5) return { lat: a5.lat, lon: a5.lon, precision: "state" };
|
|
931
931
|
}
|
|
932
|
-
if (
|
|
933
|
-
let
|
|
934
|
-
if (
|
|
932
|
+
if (i4 && (n2.mapKind !== "north-america" || s3.has(i4))) {
|
|
933
|
+
let a5 = o3().get(i4);
|
|
934
|
+
if (a5) return { lat: a5.lat, lon: a5.lon, precision: "country" };
|
|
935
935
|
}
|
|
936
|
-
return
|
|
936
|
+
return e2;
|
|
937
937
|
}
|
|
938
938
|
var G = { latlon: 0, city: 1, zip3: 2, state: 3, country: 4 };
|
|
939
939
|
var x = 8;
|
|
940
|
-
function y3(
|
|
941
|
-
let
|
|
942
|
-
for (let
|
|
943
|
-
let
|
|
944
|
-
if (S3(
|
|
945
|
-
|
|
946
|
-
let
|
|
947
|
-
|
|
948
|
-
} else if (
|
|
949
|
-
if (
|
|
950
|
-
let
|
|
951
|
-
|
|
940
|
+
function y3(n2, e2) {
|
|
941
|
+
let t2 = new Array(n2.length), o2 = new Array(n2.length), i4 = new Array(n2.length), r2 = /* @__PURE__ */ new Set(), a5 = [], s4 = /* @__PURE__ */ new Set(), f4 = [], d2 = /* @__PURE__ */ new Set(), R2 = [], g4 = { latlon: 0, city: 0, zip3: 0, state: 0, country: 0 }, S2 = 0, m2 = 0, p4 = null;
|
|
942
|
+
for (let l3 = 0; l3 < n2.length; ++l3) {
|
|
943
|
+
let A2 = n2[l3], C3 = A3({ ...A2, mapKind: e2 });
|
|
944
|
+
if (S3(C3)) {
|
|
945
|
+
t2[l3] = null, o2[l3] = null, i4[l3] = null, m2++;
|
|
946
|
+
let M2 = K(A2);
|
|
947
|
+
M2 && !d2.has(M2.toLowerCase()) && (d2.add(M2.toLowerCase()), R2.length < x && R2.push(M2));
|
|
948
|
+
} else if (C3) {
|
|
949
|
+
if (t2[l3] = C3.lat, o2[l3] = C3.lon, i4[l3] = C3.precision, S2++, g4[C3.precision]++, (p4 === null || G[C3.precision] > G[p4]) && (p4 = C3.precision), G[C3.precision] > G.city) {
|
|
950
|
+
let M2 = K(A2);
|
|
951
|
+
M2 && !s4.has(M2.toLowerCase()) && (s4.add(M2.toLowerCase()), f4.length < x && f4.push(M2));
|
|
952
952
|
}
|
|
953
953
|
} else {
|
|
954
|
-
|
|
955
|
-
let
|
|
956
|
-
|
|
954
|
+
t2[l3] = null, o2[l3] = null, i4[l3] = null;
|
|
955
|
+
let M2 = K(A2);
|
|
956
|
+
M2 && !r2.has(M2.toLowerCase()) && (r2.add(M2.toLowerCase()), a5.push(M2));
|
|
957
957
|
}
|
|
958
958
|
}
|
|
959
|
-
let
|
|
960
|
-
return { lat:
|
|
959
|
+
let c4 = !n3() && n2.some((l3) => l3.city !== null && l3.city !== void 0 && String(l3.city).trim() !== "");
|
|
960
|
+
return { lat: t2, lon: o2, precisions: i4, precision: p4, precisionCounts: g4, coarseExamples: f4, unmatched: a5, ambiguousRows: m2, ambiguousExamples: R2, matchedRows: S2, totalRows: n2.length, ...c4 ? { cityTableMissing: true } : {} };
|
|
961
961
|
}
|
|
962
|
-
function K(
|
|
963
|
-
let
|
|
964
|
-
return
|
|
962
|
+
function K(n2) {
|
|
963
|
+
let e2 = [n2.city, n2.state, n2.zip, n2.country].filter((t2) => t2 != null && String(t2).trim() !== "").map((t2) => String(t2).trim()).join(", ");
|
|
964
|
+
return e2 || (n2.label === null || n2.label === void 0 ? "" : String(n2.label).trim());
|
|
965
965
|
}
|
|
966
|
-
function p3(
|
|
967
|
-
if (!
|
|
968
|
-
let
|
|
969
|
-
return
|
|
966
|
+
function p3(n2, e2) {
|
|
967
|
+
if (!n2) return false;
|
|
968
|
+
let t2 = O(n2);
|
|
969
|
+
return t2 ? F(t2, e2).length > 0 : false;
|
|
970
970
|
}
|
|
971
971
|
|
|
972
972
|
// ../shape-core/dist/chunk-6NQENOVB.mjs
|
|
973
973
|
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
974
|
-
function s(
|
|
975
|
-
return
|
|
974
|
+
function s(t2) {
|
|
975
|
+
return t2 ? t2.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_\-./]+/g, " ").toLowerCase().split(/\s+/).filter((n2) => n2.length > 0) : [];
|
|
976
976
|
}
|
|
977
|
-
function p(
|
|
978
|
-
let
|
|
979
|
-
if (isNaN(
|
|
980
|
-
let
|
|
981
|
-
if (F2.test(
|
|
982
|
-
let
|
|
983
|
-
return
|
|
977
|
+
function p(t2) {
|
|
978
|
+
let n2 = Date.parse(t2);
|
|
979
|
+
if (isNaN(n2)) return null;
|
|
980
|
+
let e2 = new Date(n2);
|
|
981
|
+
if (F2.test(t2) || i.test(t2.trim()) || l.test(t2)) return e2;
|
|
982
|
+
let r2 = new Date(Date.UTC(e2.getFullYear(), e2.getMonth(), e2.getDate(), e2.getHours(), e2.getMinutes(), e2.getSeconds(), e2.getMilliseconds())), o2 = e2.getFullYear();
|
|
983
|
+
return o2 >= 0 && o2 < 100 && r2.setUTCFullYear(o2), r2;
|
|
984
984
|
}
|
|
985
|
-
function u2(
|
|
986
|
-
return !(
|
|
985
|
+
function u2(t2) {
|
|
986
|
+
return !(t2 instanceof Date) || isNaN(t2.getTime()) ? null : t2.getUTCHours() === 0 && t2.getUTCMinutes() === 0 && t2.getUTCSeconds() === 0 && t2.getUTCMilliseconds() === 0 ? "utc" : t2.getHours() === 0 && t2.getMinutes() === 0 && t2.getSeconds() === 0 && t2.getMilliseconds() === 0 ? "local" : null;
|
|
987
987
|
}
|
|
988
988
|
var F2 = /^\s*\d{4}(-\d{2}(-\d{2})?)?\s*$/;
|
|
989
989
|
var i = /(?:Z|[+-]\d{2}:?\d{2})$/i;
|
|
@@ -994,55 +994,55 @@ var l = /\b(?:GMT|UTC)\b/i;
|
|
|
994
994
|
var St = "006007008009010011012013014015016017018019020021022023024025026027028029030031032033034035036037038039040041042043044045046047048049050051052053054056057058059060061062063064065066067068069070071072073074075076077078079080081082083084085086087088089100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191193194195196197198199200201202203204205206207208209210211212214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310312313314315316317318319320321322323324325326327328329330331333334335336337338339341342344346347349350351352354355356357358359360361362363364365366367368369370371372373374376377378379380381382383384385386387388389390391392393394395396397398400401402403404405406407408409410411412413414415416417418420421422423424425426427430431432433434435436437438439440441442443444445446447448449450451452453454455456457458460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508510511512513514515516520521522523524525526527528530531532534535537538539540541542543544545546547548549550551553554556557558559560561562563564565566567570571572573574575576577580581582583584585586587588590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620622623624625626627628629630631633634635636637638639640641644645646647648650651652653654655656657658660661662664665666667668669670671672673674675676677678679680681683684685686687688689690691692693700701703704705706707708710711712713714716717718719720721722723724725726727728729730731734735736737738739740741743744745746747748749750751752753754755756757758759760761762763764765766767768769770772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816820821822823824825826827828829830831832833834835836837838840841843844845846847850851852853855856857859860863864865870871873874875877878879880881882883884890891893894895897898900902903904905906907908910911912913914915916917918919920921922923924925926927928930931932933934935936937939940941943944945946947948949950951952953954955956957958959960961967968969970971972973974975976977978979980981982983984985986988989990991992993994995996997998999";
|
|
995
995
|
var w = new Set(St.match(/.{3}/g) ?? []);
|
|
996
996
|
var at = [["AL", "Alabama"], ["AK", "Alaska"], ["AZ", "Arizona"], ["AR", "Arkansas"], ["CA", "California"], ["CO", "Colorado"], ["CT", "Connecticut"], ["DE", "Delaware"], ["FL", "Florida"], ["GA", "Georgia"], ["HI", "Hawaii"], ["ID", "Idaho"], ["IL", "Illinois"], ["IN", "Indiana"], ["IA", "Iowa"], ["KS", "Kansas"], ["KY", "Kentucky"], ["LA", "Louisiana"], ["ME", "Maine"], ["MD", "Maryland"], ["MA", "Massachusetts"], ["MI", "Michigan"], ["MN", "Minnesota"], ["MS", "Mississippi"], ["MO", "Missouri"], ["MT", "Montana"], ["NE", "Nebraska"], ["NV", "Nevada"], ["NH", "New Hampshire"], ["NJ", "New Jersey"], ["NM", "New Mexico"], ["NY", "New York"], ["NC", "North Carolina"], ["ND", "North Dakota"], ["OH", "Ohio"], ["OK", "Oklahoma"], ["OR", "Oregon"], ["PA", "Pennsylvania"], ["RI", "Rhode Island"], ["SC", "South Carolina"], ["SD", "South Dakota"], ["TN", "Tennessee"], ["TX", "Texas"], ["UT", "Utah"], ["VT", "Vermont"], ["VA", "Virginia"], ["WA", "Washington"], ["WV", "West Virginia"], ["WI", "Wisconsin"], ["WY", "Wyoming"], ["DC", "District of Columbia"], ["PR", "Puerto Rico"], ["GU", "Guam"], ["VI", "U.S. Virgin Islands"], ["AS", "American Samoa"], ["MP", "Northern Mariana Islands"]];
|
|
997
|
-
var ct = new Set(at.map((
|
|
997
|
+
var ct = new Set(at.map((n2) => n2[0]));
|
|
998
998
|
var yt = { "Ala.": "AL", "Alab.": "AL", "Ariz.": "AZ", "Ark.": "AR", "Calif.": "CA", "Cal.": "CA", "Colo.": "CO", "Col.": "CO", "Conn.": "CT", "Del.": "DE", "Fla.": "FL", "Flor.": "FL", "Ga.": "GA", "Ill.": "IL", "Ind.": "IN", "Kan.": "KS", "Kans.": "KS", "Ky.": "KY", "La.": "LA", "Md.": "MD", "Mass.": "MA", "Mich.": "MI", "Minn.": "MN", "Miss.": "MS", "Mo.": "MO", "Mont.": "MT", "Neb.": "NE", "Nebr.": "NE", "Nev.": "NV", "N.H.": "NH", "N.J.": "NJ", "N.M.": "NM", "N.Mex.": "NM", "N. Mex.": "NM", "N.Y.": "NY", "N.C.": "NC", "N.D.": "ND", "N.Dak.": "ND", "N. Dak.": "ND", "Okla.": "OK", "Ore.": "OR", "Oreg.": "OR", "Pa.": "PA", "Penn.": "PA", "Penna.": "PA", "R.I.": "RI", "S.C.": "SC", "S.D.": "SD", "S.Dak.": "SD", "S. Dak.": "SD", "Tenn.": "TN", "Tex.": "TX", "Vt.": "VT", "Va.": "VA", "Wash.": "WA", "W.Va.": "WV", "W. Va.": "WV", "Wis.": "WI", "Wisc.": "WI", "Wyo.": "WY", "D.C.": "DC", "Wash. D.C.": "DC", "Wash., D.C.": "DC", "P.R.": "PR", "V.I.": "VI" };
|
|
999
999
|
var ut = (() => {
|
|
1000
|
-
let
|
|
1001
|
-
for (let [
|
|
1002
|
-
|
|
1003
|
-
for (let [
|
|
1004
|
-
let
|
|
1005
|
-
|
|
1006
|
-
}
|
|
1007
|
-
return
|
|
1000
|
+
let n2 = /* @__PURE__ */ new Map();
|
|
1001
|
+
for (let [s4, i4] of at) n2.set(g(i4), s4);
|
|
1002
|
+
n2.set(g("Washington DC"), "DC"), n2.set(g("Washington D.C."), "DC"), n2.set(g("US Virgin Islands"), "VI");
|
|
1003
|
+
for (let [s4, i4] of Object.entries(yt)) {
|
|
1004
|
+
let r2 = g(s4);
|
|
1005
|
+
r2 && !n2.has(r2) && n2.set(r2, i4);
|
|
1006
|
+
}
|
|
1007
|
+
return n2;
|
|
1008
1008
|
})();
|
|
1009
1009
|
var lt = /* @__PURE__ */ new Set(["01", "02", "04", "05", "06", "08", "09", "10", "11", "12", "13", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "44", "45", "46", "47", "48", "49", "50", "51", "53", "54", "55", "56", "60", "66", "69", "72", "78"]);
|
|
1010
|
-
function ft(
|
|
1011
|
-
return
|
|
1010
|
+
function ft(n2) {
|
|
1011
|
+
return n2.trim().toUpperCase();
|
|
1012
1012
|
}
|
|
1013
|
-
function g(
|
|
1014
|
-
return u(
|
|
1013
|
+
function g(n2) {
|
|
1014
|
+
return u(n2);
|
|
1015
1015
|
}
|
|
1016
1016
|
var rt = /* @__PURE__ */ new Set(["zip", "zipcode", "postal", "postcode", "plz"]);
|
|
1017
|
-
function y2(
|
|
1018
|
-
if (!
|
|
1019
|
-
for (let
|
|
1017
|
+
function y2(n2, s4) {
|
|
1018
|
+
if (!n2) return false;
|
|
1019
|
+
for (let i4 of s(n2)) if (s4.has(i4)) return true;
|
|
1020
1020
|
return false;
|
|
1021
1021
|
}
|
|
1022
|
-
function Mt(
|
|
1023
|
-
if (
|
|
1024
|
-
let
|
|
1025
|
-
if (
|
|
1026
|
-
switch (
|
|
1022
|
+
function Mt(n2, s4) {
|
|
1023
|
+
if (n2 == null) return null;
|
|
1024
|
+
let i4 = String(n2).trim();
|
|
1025
|
+
if (i4.length === 0) return null;
|
|
1026
|
+
switch (s4) {
|
|
1027
1027
|
case "country-iso3":
|
|
1028
1028
|
case "country-iso2":
|
|
1029
1029
|
case "country-name":
|
|
1030
|
-
return E(
|
|
1030
|
+
return E(i4);
|
|
1031
1031
|
case "us-state-code":
|
|
1032
1032
|
case "us-state-name": {
|
|
1033
|
-
let
|
|
1034
|
-
return ct.has(
|
|
1033
|
+
let r2 = ft(i4);
|
|
1034
|
+
return ct.has(r2) ? r2 : ut.get(g(i4)) ?? null;
|
|
1035
1035
|
}
|
|
1036
1036
|
case "us-zip5":
|
|
1037
|
-
return M3(
|
|
1037
|
+
return M3(i4);
|
|
1038
1038
|
case "us-county-fips":
|
|
1039
|
-
return /^\d{5}$/.test(
|
|
1039
|
+
return /^\d{5}$/.test(i4) && lt.has(i4.slice(0, 2)) ? i4 : null;
|
|
1040
1040
|
default:
|
|
1041
1041
|
return null;
|
|
1042
1042
|
}
|
|
1043
1043
|
}
|
|
1044
|
-
function Gt(
|
|
1045
|
-
switch (
|
|
1044
|
+
function Gt(n2) {
|
|
1045
|
+
switch (n2) {
|
|
1046
1046
|
case "country-iso3":
|
|
1047
1047
|
case "country-iso2":
|
|
1048
1048
|
case "country-name":
|
|
@@ -1055,26 +1055,26 @@ function Gt(n) {
|
|
|
1055
1055
|
return false;
|
|
1056
1056
|
}
|
|
1057
1057
|
}
|
|
1058
|
-
function It(
|
|
1059
|
-
return
|
|
1058
|
+
function It(n2, s4) {
|
|
1059
|
+
return s4 === "us-zip5" ? w.has(n2.slice(0, 3)) : true;
|
|
1060
1060
|
}
|
|
1061
|
-
function Wt(
|
|
1062
|
-
let
|
|
1063
|
-
for (let
|
|
1064
|
-
let
|
|
1065
|
-
if (
|
|
1061
|
+
function Wt(n2, s4) {
|
|
1062
|
+
let i4 = new Array(n2.length), r2 = /* @__PURE__ */ new Set(), M2 = [], h3 = 0;
|
|
1063
|
+
for (let N3 = 0; N3 < n2.length; ++N3) {
|
|
1064
|
+
let I4 = Mt(n2[N3], s4), O3 = I4 !== null && It(I4, s4) ? I4 : null;
|
|
1065
|
+
if (i4[N3] = O3, O3 !== null) h3++;
|
|
1066
1066
|
else {
|
|
1067
|
-
let
|
|
1068
|
-
if (
|
|
1069
|
-
let
|
|
1070
|
-
if (
|
|
1071
|
-
let
|
|
1072
|
-
|
|
1067
|
+
let d2 = n2[N3];
|
|
1068
|
+
if (d2 != null) {
|
|
1069
|
+
let p4 = String(d2).trim();
|
|
1070
|
+
if (p4.length > 0) {
|
|
1071
|
+
let m2 = p4.toLowerCase();
|
|
1072
|
+
r2.has(m2) || (r2.add(m2), M2.push(p4));
|
|
1073
1073
|
}
|
|
1074
1074
|
}
|
|
1075
1075
|
}
|
|
1076
1076
|
}
|
|
1077
|
-
return { iso:
|
|
1077
|
+
return { iso: i4, unmatched: M2, matchedRows: h3, totalRows: n2.length };
|
|
1078
1078
|
}
|
|
1079
1079
|
|
|
1080
1080
|
// ../shape-core/dist/chunk-6W2GOB6U.mjs
|
|
@@ -1082,14 +1082,14 @@ var import_papaparse = __toESM(require_papaparse_min(), 1);
|
|
|
1082
1082
|
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
1083
1083
|
var yt2 = { "north-america": "AG AI AW BB BL BM BQ BS BZ CA CR CU CW DM DO GD GL GP GT HN HT JM KN KY LC MF MQ MS MX NI PA PM PR SV SX TC TT US VC VG VI", "south-america": "AR BO BR CL CO EC FK GF GY PE PY SR UY VE", europe: "AD AL AT AX BA BE BG BY CH CY CZ DE DK EE ES FI FO FR GB GG GI GR HR HU IE IM IS IT JE LI LT LU LV MC MD ME MK MT NL NO PL PT RO RS RU SE SI SJ SK SM UA VA", africa: "AO BF BI BJ BW CD CF CG CI CM CV DJ DZ EG EH ER ET GA GH GM GN GQ GW KE KM LR LS LY MA MG ML MR MU MW MZ NA NE NG RE RW SC SD SH SL SN SO SS ST SZ TD TG TN TZ UG YT ZA ZM ZW", asia: "AE AF AM AZ BD BH BN BT CC CN CX GE HK ID IL IN IO IQ IR JO JP KG KH KP KR KW KZ LA LB LK MM MN MO MV MY NP OM PH PK PS QA SA SG SY TH TJ TL TM TR TW UZ VN YE", oceania: "AS AU CK FJ FM GU KI MH MP NC NF NR NU NZ PF PG PN PW SB TK TO TV UM VU WF WS", antarctica: "AQ BV GS HM TF" };
|
|
1084
1084
|
var j2 = (() => {
|
|
1085
|
-
let
|
|
1086
|
-
for (let
|
|
1087
|
-
return
|
|
1085
|
+
let n2 = /* @__PURE__ */ new Map();
|
|
1086
|
+
for (let t2 of Object.keys(yt2)) for (let e2 of yt2[t2].split(/\s+/)) e2 && n2.set(e2, t2);
|
|
1087
|
+
return n2;
|
|
1088
1088
|
})();
|
|
1089
|
-
function Pt(
|
|
1090
|
-
for (let [
|
|
1091
|
-
let
|
|
1092
|
-
|
|
1089
|
+
function Pt(n2) {
|
|
1090
|
+
for (let [t2, e2] of n2) {
|
|
1091
|
+
let r2 = j2.get(t2);
|
|
1092
|
+
r2 && !j2.has(e2) && j2.set(e2, r2);
|
|
1093
1093
|
}
|
|
1094
1094
|
}
|
|
1095
1095
|
Pt(N);
|
|
@@ -1101,54 +1101,54 @@ var Ct = /^\s*(sum|count|count\s+distinct|distinct\s+count)\s+of\s+/i;
|
|
|
1101
1101
|
var kt = /(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Za-z])(?=[0-9])|(?<=[0-9])(?=[A-Za-z])/g;
|
|
1102
1102
|
var Bt = new RegExp("\\b(" + Gt2.join("|") + ")\\b|(" + Wt2.join("|") + ")$", "i");
|
|
1103
1103
|
var zt = new RegExp("\\b(" + Ft.join("|") + ")\\b|(" + Vt.join("|") + ")$", "i");
|
|
1104
|
-
function Mt2(
|
|
1105
|
-
return
|
|
1104
|
+
function Mt2(n2) {
|
|
1105
|
+
return n2 ? String(n2).replace(Ct, "").trim() : "";
|
|
1106
1106
|
}
|
|
1107
|
-
function Ut(
|
|
1108
|
-
return !!
|
|
1107
|
+
function Ut(n2) {
|
|
1108
|
+
return !!n2 && Ct.test(String(n2));
|
|
1109
1109
|
}
|
|
1110
1110
|
var Kt = ["count (distinct)", "count distinct", "distinct count", "standard deviation", "average", "variance", "median", "product", "stddev", "std dev", "count", "sum", "avg", "min", "minimum", "max", "maximum", "var"];
|
|
1111
|
-
var St2 = new RegExp("^\\s*(" + [...Kt].sort((
|
|
1112
|
-
function Ht(
|
|
1113
|
-
let
|
|
1114
|
-
return
|
|
1111
|
+
var St2 = new RegExp("^\\s*(" + [...Kt].sort((n2, t2) => t2.length - n2.length).map((n2) => n2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\s+/g, "\\s+")).join("|") + ")\\s+of\\s+", "i");
|
|
1112
|
+
function Ht(n2) {
|
|
1113
|
+
let t2 = Mt2(n2);
|
|
1114
|
+
return t2.length === 0 ? "" : t2.replace(kt, " ");
|
|
1115
1115
|
}
|
|
1116
|
-
function Tt(
|
|
1117
|
-
if (!
|
|
1118
|
-
let
|
|
1119
|
-
return
|
|
1116
|
+
function Tt(n2, t2) {
|
|
1117
|
+
if (!t2) return false;
|
|
1118
|
+
let e2 = Mt2(t2);
|
|
1119
|
+
return n2.test(Ht(t2)) || n2.test(e2) || n2.test(s(e2).join(" "));
|
|
1120
1120
|
}
|
|
1121
|
-
function Nt(
|
|
1122
|
-
return Tt(zt,
|
|
1121
|
+
function Nt(n2) {
|
|
1122
|
+
return Tt(zt, n2);
|
|
1123
1123
|
}
|
|
1124
|
-
function Yt(
|
|
1125
|
-
return Tt(Bt,
|
|
1124
|
+
function Yt(n2) {
|
|
1125
|
+
return Tt(Bt, n2) || Nt(n2);
|
|
1126
1126
|
}
|
|
1127
1127
|
var Rt = /int|double|decimal|single|float|number|currency|money/i;
|
|
1128
|
-
function Zt(
|
|
1129
|
-
let
|
|
1130
|
-
return
|
|
1131
|
-
}
|
|
1132
|
-
function Xt(
|
|
1133
|
-
return
|
|
1134
|
-
}
|
|
1135
|
-
function vt(
|
|
1136
|
-
let
|
|
1137
|
-
if (
|
|
1138
|
-
if (Nt(
|
|
1139
|
-
let
|
|
1140
|
-
if (!(
|
|
1141
|
-
if (
|
|
1142
|
-
if (
|
|
1143
|
-
if (
|
|
1144
|
-
}
|
|
1145
|
-
return
|
|
1146
|
-
}
|
|
1147
|
-
function It2(
|
|
1148
|
-
let
|
|
1149
|
-
if (
|
|
1150
|
-
if (
|
|
1151
|
-
switch (
|
|
1128
|
+
function Zt(n2) {
|
|
1129
|
+
let t2 = String(n2?.valueNature ?? "").trim().toLowerCase();
|
|
1130
|
+
return t2 === "categorical" ? "Categorical" : t2 === "ordinal" ? "Ordinal" : t2 === "continuous" || n2?.isMeasure === true || Rt.test(String(n2?.dataType ?? "")) ? "Continuous" : "Categorical";
|
|
1131
|
+
}
|
|
1132
|
+
function Xt(n2) {
|
|
1133
|
+
return n2?.isMeasure === true || Rt.test(String(n2?.dataType ?? ""));
|
|
1134
|
+
}
|
|
1135
|
+
function vt(n2) {
|
|
1136
|
+
let t2 = n2 ?? {}, e2 = Zt(t2);
|
|
1137
|
+
if (e2 !== "Continuous") return { nature: e2, additivity: "unknown", basis: "role", suppressed: false };
|
|
1138
|
+
if (Nt(t2.name)) return { nature: e2, additivity: "positional", basis: "name", suppressed: true };
|
|
1139
|
+
let r2 = String(t2.additivity ?? "").trim().toLowerCase();
|
|
1140
|
+
if (!(r2 === "additive" && Ut(t2.name))) {
|
|
1141
|
+
if (r2 === "additive") return { nature: e2, additivity: "additive", basis: "measured", suppressed: false };
|
|
1142
|
+
if (r2 === "part_of_whole") return { nature: e2, additivity: "part_of_whole", basis: "measured", suppressed: false };
|
|
1143
|
+
if (r2 === "intensive_rate") return { nature: e2, additivity: "intensive_rate", basis: "measured", suppressed: false };
|
|
1144
|
+
}
|
|
1145
|
+
return t2.discourageAggregationAcrossGroups === true ? { nature: e2, additivity: "intensive_rate", basis: "host-flag", suppressed: false } : Yt(t2.name) ? { nature: e2, additivity: "intensive_rate", basis: "name", suppressed: false } : { nature: e2, additivity: "additive", basis: "default", suppressed: false };
|
|
1146
|
+
}
|
|
1147
|
+
function It2(n2) {
|
|
1148
|
+
let t2 = vt(n2), e2 = n2 ?? {};
|
|
1149
|
+
if (t2.nature === "Categorical") return ["first", "distinctcount", "count"];
|
|
1150
|
+
if (t2.nature === "Ordinal") return Xt(e2) ? ["median", "average", "min", "max", "first", "distinctcount", "count"] : ["first", "distinctcount", "count"];
|
|
1151
|
+
switch (t2.additivity) {
|
|
1152
1152
|
case "positional":
|
|
1153
1153
|
return ["min", "max", "count", "distinctcount", "first"];
|
|
1154
1154
|
case "intensive_rate":
|
|
@@ -1157,159 +1157,159 @@ function It2(n) {
|
|
|
1157
1157
|
return ["sum", "average", "median", "min", "max", "count", "distinctcount", "first"];
|
|
1158
1158
|
}
|
|
1159
1159
|
}
|
|
1160
|
-
function Me(
|
|
1161
|
-
return It2(
|
|
1160
|
+
function Me(n2) {
|
|
1161
|
+
return It2(n2)[0];
|
|
1162
1162
|
}
|
|
1163
|
-
function Te(
|
|
1164
|
-
if (
|
|
1165
|
-
if (
|
|
1166
|
-
let
|
|
1167
|
-
return
|
|
1163
|
+
function Te(n2, t2) {
|
|
1164
|
+
if (t2 !== "sum" && t2 !== "count") return false;
|
|
1165
|
+
if (t2 === "count") return true;
|
|
1166
|
+
let e2 = vt(n2);
|
|
1167
|
+
return e2.additivity === "additive" || e2.additivity === "part_of_whole" || e2.additivity === "unknown";
|
|
1168
1168
|
}
|
|
1169
1169
|
|
|
1170
1170
|
// ../shape-core/dist/index.mjs
|
|
1171
1171
|
/*! @bicharts/shape-core — Apache-2.0. Bundled reference data: GeoNames (https://www.geonames.org/) CC BY 4.0; US Census/TIGER (public domain). Full text: NOTICE in this package. */
|
|
1172
1172
|
var E2 = 2;
|
|
1173
1173
|
var U2 = 400;
|
|
1174
|
-
function G2(
|
|
1175
|
-
return !!E(
|
|
1176
|
-
}
|
|
1177
|
-
function C(
|
|
1178
|
-
let
|
|
1179
|
-
for (let
|
|
1180
|
-
if (
|
|
1181
|
-
let
|
|
1182
|
-
if (!V(
|
|
1183
|
-
}
|
|
1184
|
-
return Array.from(
|
|
1185
|
-
}
|
|
1186
|
-
function P2(
|
|
1187
|
-
let
|
|
1188
|
-
if (
|
|
1189
|
-
let
|
|
1190
|
-
return
|
|
1191
|
-
}
|
|
1192
|
-
function q2(
|
|
1193
|
-
if (!Y(
|
|
1194
|
-
let
|
|
1195
|
-
return
|
|
1196
|
-
}
|
|
1197
|
-
function $2(
|
|
1198
|
-
let
|
|
1199
|
-
if (
|
|
1200
|
-
let
|
|
1201
|
-
for (let
|
|
1202
|
-
return Math.round(
|
|
1203
|
-
}
|
|
1204
|
-
function v2(
|
|
1205
|
-
let
|
|
1206
|
-
if (
|
|
1207
|
-
let
|
|
1208
|
-
for (let
|
|
1209
|
-
return Math.round(
|
|
1210
|
-
}
|
|
1211
|
-
function F3(
|
|
1212
|
-
let
|
|
1213
|
-
for (let
|
|
1214
|
-
if (
|
|
1215
|
-
let
|
|
1216
|
-
if (!V(u(
|
|
1217
|
-
}
|
|
1218
|
-
return Array.from(
|
|
1219
|
-
}
|
|
1220
|
-
function D2(
|
|
1221
|
-
let
|
|
1222
|
-
if (
|
|
1223
|
-
let
|
|
1224
|
-
for (let
|
|
1225
|
-
return Math.round(
|
|
1226
|
-
}
|
|
1227
|
-
function Z2(
|
|
1228
|
-
return y2(
|
|
1229
|
-
}
|
|
1230
|
-
function ne(
|
|
1231
|
-
let
|
|
1232
|
-
if (
|
|
1233
|
-
let
|
|
1234
|
-
for (let
|
|
1235
|
-
return Math.round(
|
|
1236
|
-
}
|
|
1237
|
-
function z2(
|
|
1238
|
-
let
|
|
1239
|
-
for (let
|
|
1240
|
-
return
|
|
1241
|
-
}
|
|
1242
|
-
function oe(
|
|
1243
|
-
let
|
|
1244
|
-
for (let
|
|
1245
|
-
return
|
|
1246
|
-
}
|
|
1247
|
-
function ie(
|
|
1248
|
-
let
|
|
1249
|
-
for (let
|
|
1250
|
-
let
|
|
1251
|
-
|
|
1252
|
-
}
|
|
1253
|
-
let
|
|
1254
|
-
for (let
|
|
1255
|
-
let
|
|
1256
|
-
|
|
1257
|
-
}
|
|
1258
|
-
let
|
|
1259
|
-
if (
|
|
1260
|
-
let
|
|
1261
|
-
|
|
1262
|
-
}
|
|
1263
|
-
let
|
|
1264
|
-
if (
|
|
1265
|
-
let
|
|
1266
|
-
|
|
1267
|
-
}
|
|
1268
|
-
let
|
|
1269
|
-
if (!
|
|
1270
|
-
let
|
|
1271
|
-
for (let
|
|
1272
|
-
let
|
|
1273
|
-
if (P2(
|
|
1274
|
-
let
|
|
1275
|
-
if (
|
|
1276
|
-
let
|
|
1277
|
-
|
|
1174
|
+
function G2(r2) {
|
|
1175
|
+
return !!E(r2);
|
|
1176
|
+
}
|
|
1177
|
+
function C(r2) {
|
|
1178
|
+
let n2 = /* @__PURE__ */ new Set();
|
|
1179
|
+
for (let e2 of r2) {
|
|
1180
|
+
if (e2 == null) continue;
|
|
1181
|
+
let s4 = u(String(e2));
|
|
1182
|
+
if (!V(s4) && !n2.has(s4) && (n2.add(s4), n2.size >= U2)) break;
|
|
1183
|
+
}
|
|
1184
|
+
return Array.from(n2);
|
|
1185
|
+
}
|
|
1186
|
+
function P2(r2) {
|
|
1187
|
+
let n2 = C(r2);
|
|
1188
|
+
if (n2.length === 0 || $2(r2) < 95) return false;
|
|
1189
|
+
let e2 = n2.filter((c4) => G2(c4) && !Y(c4)).length, s4 = n2.filter((c4) => !G2(c4) && !!Y(c4)).length;
|
|
1190
|
+
return e2 >= 1 && e2 >= s4;
|
|
1191
|
+
}
|
|
1192
|
+
function q2(r2, n2) {
|
|
1193
|
+
if (!Y(r2)) return false;
|
|
1194
|
+
let e2 = E(r2);
|
|
1195
|
+
return e2 ? n2 === "world" ? true : s3.has(e2) : false;
|
|
1196
|
+
}
|
|
1197
|
+
function $2(r2) {
|
|
1198
|
+
let n2 = C(r2);
|
|
1199
|
+
if (n2.length === 0) return 0;
|
|
1200
|
+
let e2 = 0;
|
|
1201
|
+
for (let s4 of n2) G2(s4) && e2++;
|
|
1202
|
+
return Math.round(e2 / n2.length * 1e3) / 10;
|
|
1203
|
+
}
|
|
1204
|
+
function v2(r2) {
|
|
1205
|
+
let n2 = C(r2);
|
|
1206
|
+
if (n2.length === 0) return 0;
|
|
1207
|
+
let e2 = 0;
|
|
1208
|
+
for (let s4 of n2) Y(s4) && e2++;
|
|
1209
|
+
return Math.round(e2 / n2.length * 1e3) / 10;
|
|
1210
|
+
}
|
|
1211
|
+
function F3(r2) {
|
|
1212
|
+
let n2 = /* @__PURE__ */ new Set();
|
|
1213
|
+
for (let e2 of r2) {
|
|
1214
|
+
if (e2 == null) continue;
|
|
1215
|
+
let s4 = String(e2).trim();
|
|
1216
|
+
if (!V(u(s4)) && !n2.has(s4) && (n2.add(s4), n2.size >= U2)) break;
|
|
1217
|
+
}
|
|
1218
|
+
return Array.from(n2);
|
|
1219
|
+
}
|
|
1220
|
+
function D2(r2) {
|
|
1221
|
+
let n2 = F3(r2);
|
|
1222
|
+
if (n2.length === 0) return 0;
|
|
1223
|
+
let e2 = 0;
|
|
1224
|
+
for (let s4 of n2) Z(s4).length > 0 && e2++;
|
|
1225
|
+
return Math.round(e2 / n2.length * 1e3) / 10;
|
|
1226
|
+
}
|
|
1227
|
+
function Z2(r2, n2) {
|
|
1228
|
+
return y2(n2, rt) ? true : F3(r2).some((e2) => /^\d{5}(-\d{4})?$/.test(e2.replace(/\.0+$/, "")));
|
|
1229
|
+
}
|
|
1230
|
+
function ne(r2, n2) {
|
|
1231
|
+
let e2 = C(r2);
|
|
1232
|
+
if (e2.length === 0) return 0;
|
|
1233
|
+
let s4 = 0;
|
|
1234
|
+
for (let c4 of e2) p3(c4, n2) && s4++;
|
|
1235
|
+
return Math.round(s4 / e2.length * 1e3) / 10;
|
|
1236
|
+
}
|
|
1237
|
+
function z2(r2, n2) {
|
|
1238
|
+
let e2 = 0;
|
|
1239
|
+
for (let s4 of C(r2)) n2(s4) && e2++;
|
|
1240
|
+
return e2;
|
|
1241
|
+
}
|
|
1242
|
+
function oe(r2, n2) {
|
|
1243
|
+
let e2 = 0;
|
|
1244
|
+
for (let s4 of F3(r2)) n2(s4) && e2++;
|
|
1245
|
+
return e2;
|
|
1246
|
+
}
|
|
1247
|
+
function ie(r2, n2, e2, s4, c4) {
|
|
1248
|
+
let A2 = [], u5 = [], o2 = {}, M2 = {}, _3 = new Set(r2), l3 = (t2) => n2.map((i4) => i4[t2]);
|
|
1249
|
+
for (let t2 of ["city", "country"]) {
|
|
1250
|
+
let i4 = e2?.[t2];
|
|
1251
|
+
i4 && _3.has(i4) && (o2[t2] = i4);
|
|
1252
|
+
}
|
|
1253
|
+
let X3 = new Set(c4 ?? r2);
|
|
1254
|
+
for (let t2 of ["lat", "lon"]) {
|
|
1255
|
+
let i4 = e2?.[t2];
|
|
1256
|
+
i4 && X3.has(i4) && (o2[t2] = i4);
|
|
1257
|
+
}
|
|
1258
|
+
let g4 = e2?.zip;
|
|
1259
|
+
if (g4 && _3.has(g4)) {
|
|
1260
|
+
let t2 = l3(g4), i4 = D2(t2);
|
|
1261
|
+
i4 < 95 ? u5.push(`zip=${g4} (only ${i4}% of values read as ZIPs)`) : Z2(t2, g4) ? o2.zip = g4 : u5.push(`zip=${g4} (all values are 3-4 digits with nothing to say they are postal)`);
|
|
1262
|
+
}
|
|
1263
|
+
let p4 = e2?.state;
|
|
1264
|
+
if (p4 && _3.has(p4)) {
|
|
1265
|
+
let t2 = l3(p4), i4 = C(t2);
|
|
1266
|
+
i4.length > 0 && i4.every((a5) => q2(a5, s4)) ? u5.push(`state=${p4} (every value is "CA", which is both Canada and California)`) : P2(t2) ? (u5.push(`state=${p4} (every value is a country, not a state)`), o2.country || (o2.country = p4)) : v2(t2) < 95 ? u5.push(`state=${p4} (only ${v2(t2)}% of values are states/provinces)`) : o2.state = p4;
|
|
1267
|
+
}
|
|
1268
|
+
let d2 = new Set(Object.values(o2).filter(Boolean)), x3 = r2.filter((t2) => !d2.has(t2) && !t2.startsWith("__"));
|
|
1269
|
+
if (!o2.state) {
|
|
1270
|
+
let t2 = null;
|
|
1271
|
+
for (let i4 of x3) {
|
|
1272
|
+
let a5 = l3(i4);
|
|
1273
|
+
if (P2(a5)) continue;
|
|
1274
|
+
let f4 = v2(a5);
|
|
1275
|
+
if (f4 < 95) continue;
|
|
1276
|
+
let N3 = z2(a5, (S2) => !!Y(S2)), Y3 = z2(a5, (S2) => !!Y(S2) && !q2(S2, s4));
|
|
1277
|
+
N3 < E2 && Y3 < 1 || (!t2 || f4 > t2.pct) && (t2 = { name: i4, pct: f4 });
|
|
1278
1278
|
}
|
|
1279
|
-
|
|
1279
|
+
t2 && (o2.state = t2.name, d2.add(t2.name), A2.push(`state=${t2.name} (${t2.pct}% states/provinces)`));
|
|
1280
1280
|
}
|
|
1281
|
-
if (!
|
|
1282
|
-
if (
|
|
1283
|
-
let
|
|
1284
|
-
if (!(
|
|
1285
|
-
|
|
1281
|
+
if (!o2.zip) for (let t2 of x3) {
|
|
1282
|
+
if (d2.has(t2)) continue;
|
|
1283
|
+
let i4 = l3(t2), a5 = D2(i4);
|
|
1284
|
+
if (!(a5 < 95) && Z2(i4, t2) && !(oe(i4, (f4) => Z(f4).length > 0) < E2)) {
|
|
1285
|
+
o2.zip = t2, d2.add(t2), A2.push(`zip=${t2} (${a5}% ZIP codes)`);
|
|
1286
1286
|
break;
|
|
1287
1287
|
}
|
|
1288
1288
|
}
|
|
1289
|
-
let
|
|
1290
|
-
if (!
|
|
1291
|
-
let
|
|
1292
|
-
for (let
|
|
1293
|
-
if (
|
|
1294
|
-
let
|
|
1295
|
-
(!
|
|
1289
|
+
let h3 = o2.country;
|
|
1290
|
+
if (!h3 || !P2(l3(h3))) {
|
|
1291
|
+
let t2 = null;
|
|
1292
|
+
for (let i4 of x3) {
|
|
1293
|
+
if (d2.has(i4) || !P2(l3(i4))) continue;
|
|
1294
|
+
let a5 = $2(l3(i4));
|
|
1295
|
+
(!t2 || a5 > t2.pct) && (t2 = { name: i4, pct: a5 });
|
|
1296
1296
|
}
|
|
1297
|
-
|
|
1298
|
-
}
|
|
1299
|
-
if (!
|
|
1300
|
-
let
|
|
1301
|
-
for (let
|
|
1302
|
-
if (
|
|
1303
|
-
let
|
|
1304
|
-
|
|
1297
|
+
t2 && (h3 && (u5.push(`country=${h3} (only ${$2(l3(h3))}% of values are country identifiers; using ${t2.name} instead)`), M2.country = h3), o2.country = t2.name, d2.add(t2.name), A2.push(`country=${t2.name}`));
|
|
1298
|
+
}
|
|
1299
|
+
if (!o2.city) {
|
|
1300
|
+
let t2 = null;
|
|
1301
|
+
for (let i4 of x3) {
|
|
1302
|
+
if (d2.has(i4)) continue;
|
|
1303
|
+
let a5 = l3(i4), f4 = ne(a5, s4);
|
|
1304
|
+
f4 < m3 || z2(a5, (N3) => p3(N3, s4)) < E2 || (!t2 || f4 > t2.pct) && (t2 = { name: i4, pct: f4 });
|
|
1305
1305
|
}
|
|
1306
|
-
|
|
1306
|
+
t2 && (o2.city = t2.name, A2.push(`city=${t2.name} (${t2.pct}% known cities)`));
|
|
1307
1307
|
}
|
|
1308
|
-
let
|
|
1309
|
-
let
|
|
1310
|
-
return isFinite(
|
|
1308
|
+
let B3 = o2.country ? l3(o2.country) : [], k3 = !!o2.country && P2(B3), j4 = k3 ? new Set(B3.map((t2) => E(t2 == null ? null : String(t2))).filter(Boolean)).size : 0, K3 = k3 && j4 >= 2, L4 = !!(o2.lat && o2.lon) && n2.some((t2) => {
|
|
1309
|
+
let i4 = +String(t2[o2.lat] ?? "").trim(), a5 = +String(t2[o2.lon] ?? "").trim();
|
|
1310
|
+
return isFinite(i4) && isFinite(a5) && i4 >= -90 && i4 <= 90 && a5 >= -180 && a5 <= 180 && String(t2[o2.lat] ?? "").trim() !== "" && String(t2[o2.lon] ?? "").trim() !== "";
|
|
1311
1311
|
});
|
|
1312
|
-
return
|
|
1312
|
+
return o2.lat && o2.lon && !L4 && u5.push(`lat/lon=${o2.lat}/${o2.lon} (no row holds a usable coordinate pair)`), o2.country && !K3 && !(o2.city || o2.state || o2.zip || L4) && u5.push(k3 ? `country=${o2.country} (every row resolves to the same country - nothing to place apart)` : `country=${o2.country} (values are not country identifiers)`), { bind: !!(o2.city || o2.state || o2.zip || K3 || L4) ? o2 : null, backfilled: A2, refused: u5, ...Object.keys(M2).length ? { labelFallback: M2 } : {} };
|
|
1313
1313
|
}
|
|
1314
1314
|
|
|
1315
1315
|
// src/payload.ts
|
|
@@ -1323,8 +1323,8 @@ function resolvePointChannel(cols, rowObjs, point) {
|
|
|
1323
1323
|
let rolesRefused = [];
|
|
1324
1324
|
let labelCol;
|
|
1325
1325
|
if (bind) {
|
|
1326
|
-
const dims = cols.filter((
|
|
1327
|
-
const res = ie(dims, rowObjs, bind, point?.mapKind, cols.map((
|
|
1326
|
+
const dims = cols.filter((c4) => !c4.isMeasure).map((c4) => c4.name);
|
|
1327
|
+
const res = ie(dims, rowObjs, bind, point?.mapKind, cols.map((c4) => c4.name));
|
|
1328
1328
|
bind = res.bind;
|
|
1329
1329
|
rolesBackfilled = res.backfilled;
|
|
1330
1330
|
rolesRefused = res.refused;
|
|
@@ -1333,15 +1333,15 @@ function resolvePointChannel(cols, rowObjs, point) {
|
|
|
1333
1333
|
}
|
|
1334
1334
|
const hasPointBind = !!bind && !!(bind.city || bind.state || bind.zip || bind.country || bind.lat && bind.lon);
|
|
1335
1335
|
if (hasPointBind) {
|
|
1336
|
-
const
|
|
1337
|
-
const built = y3(rowObjs.map((
|
|
1338
|
-
lat:
|
|
1339
|
-
lon:
|
|
1340
|
-
city:
|
|
1341
|
-
state:
|
|
1342
|
-
zip:
|
|
1343
|
-
country:
|
|
1344
|
-
label: labelCol ?
|
|
1336
|
+
const p4 = bind;
|
|
1337
|
+
const built = y3(rowObjs.map((r2) => ({
|
|
1338
|
+
lat: p4.lat ? r2[p4.lat] : null,
|
|
1339
|
+
lon: p4.lon ? r2[p4.lon] : null,
|
|
1340
|
+
city: p4.city ? r2[p4.city] : null,
|
|
1341
|
+
state: p4.state ? r2[p4.state] : null,
|
|
1342
|
+
zip: p4.zip ? r2[p4.zip] : null,
|
|
1343
|
+
country: p4.country ? r2[p4.country] : null,
|
|
1344
|
+
label: labelCol ? r2[labelCol] : null
|
|
1345
1345
|
})), point?.mapKind);
|
|
1346
1346
|
pLat = built.lat;
|
|
1347
1347
|
pLon = built.lon;
|
|
@@ -1369,50 +1369,50 @@ function resolvePointChannel(cols, rowObjs, point) {
|
|
|
1369
1369
|
return { lat: pLat, lon: pLon, prec: pPrec, geoPoint, rolesRefused };
|
|
1370
1370
|
}
|
|
1371
1371
|
function buildRenderPayload(cols, rowObjs, geo, point, destination) {
|
|
1372
|
-
const colNames = cols.map((
|
|
1373
|
-
const
|
|
1374
|
-
const
|
|
1375
|
-
const pLat =
|
|
1376
|
-
const dLat =
|
|
1377
|
-
const geoPoint =
|
|
1378
|
-
const geoPointDest =
|
|
1379
|
-
const rolesRefused = [...
|
|
1372
|
+
const colNames = cols.map((c4) => c4.name);
|
|
1373
|
+
const o2 = resolvePointChannel(cols, rowObjs, point);
|
|
1374
|
+
const d2 = resolvePointChannel(cols, rowObjs, destination);
|
|
1375
|
+
const pLat = o2.lat, pLon = o2.lon, pPrec = o2.prec;
|
|
1376
|
+
const dLat = d2.lat, dLon = d2.lon, dPrec = d2.prec;
|
|
1377
|
+
const geoPoint = o2.geoPoint;
|
|
1378
|
+
const geoPointDest = d2.geoPoint;
|
|
1379
|
+
const rolesRefused = [...o2.rolesRefused, ...d2.rolesRefused.map((s4) => `destination: ${s4}`)];
|
|
1380
1380
|
let geoIso = null;
|
|
1381
1381
|
let geoUnmatched;
|
|
1382
1382
|
let geoUnmatchedDistinct;
|
|
1383
1383
|
if (geo && geo.column && geo.kind && Gt(geo.kind)) {
|
|
1384
|
-
const built = Wt(rowObjs.map((
|
|
1384
|
+
const built = Wt(rowObjs.map((r2) => r2[geo.column]), geo.kind);
|
|
1385
1385
|
geoIso = built.iso;
|
|
1386
1386
|
geoUnmatched = { count: built.totalRows - built.matchedRows, examples: built.unmatched.slice(0, 8) };
|
|
1387
1387
|
geoUnmatchedDistinct = built.unmatched.length;
|
|
1388
1388
|
}
|
|
1389
1389
|
const extra = 1 + (geoIso ? 1 : 0) + (pLat ? 3 : 0) + (dLat ? 3 : 0);
|
|
1390
1390
|
const out = new Array(rowObjs.length);
|
|
1391
|
-
for (let
|
|
1392
|
-
const row = rowObjs[
|
|
1393
|
-
const
|
|
1394
|
-
for (let
|
|
1395
|
-
const
|
|
1396
|
-
if (
|
|
1397
|
-
|
|
1391
|
+
for (let r2 = 0; r2 < rowObjs.length; r2++) {
|
|
1392
|
+
const row = rowObjs[r2];
|
|
1393
|
+
const a5 = new Array(cols.length + extra);
|
|
1394
|
+
for (let c4 = 0; c4 < cols.length; c4++) {
|
|
1395
|
+
const v4 = row[colNames[c4]];
|
|
1396
|
+
if (v4 instanceof Date) {
|
|
1397
|
+
a5[c4] = v4.toISOString();
|
|
1398
1398
|
} else {
|
|
1399
|
-
|
|
1399
|
+
a5[c4] = v4 ?? null;
|
|
1400
1400
|
}
|
|
1401
1401
|
}
|
|
1402
|
-
let
|
|
1403
|
-
|
|
1404
|
-
if (geoIso)
|
|
1402
|
+
let k3 = cols.length;
|
|
1403
|
+
a5[k3++] = r2;
|
|
1404
|
+
if (geoIso) a5[k3++] = geoIso[r2];
|
|
1405
1405
|
if (pLat && pLon) {
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1406
|
+
a5[k3++] = pLat[r2];
|
|
1407
|
+
a5[k3++] = pLon[r2];
|
|
1408
|
+
a5[k3++] = pPrec ? pPrec[r2] : null;
|
|
1409
1409
|
}
|
|
1410
1410
|
if (dLat && dLon) {
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1411
|
+
a5[k3++] = dLat[r2];
|
|
1412
|
+
a5[k3++] = dLon[r2];
|
|
1413
|
+
a5[k3++] = dPrec ? dPrec[r2] : null;
|
|
1414
1414
|
}
|
|
1415
|
-
out[
|
|
1415
|
+
out[r2] = a5;
|
|
1416
1416
|
}
|
|
1417
1417
|
const colsOut = [...cols, { name: "__rowIdx__", dataType: "Integer", isMeasure: false, modelDesc: "" }];
|
|
1418
1418
|
if (geoIso) colsOut.push({ name: "__geoIso__", dataType: "String", isMeasure: false, modelDesc: "" });
|
|
@@ -1447,47 +1447,47 @@ function buildRenderPayload(cols, rowObjs, geo, point, destination) {
|
|
|
1447
1447
|
// src/selection.ts
|
|
1448
1448
|
function createMarkResolver(env) {
|
|
1449
1449
|
const { root, doc, log } = env;
|
|
1450
|
-
const isElement = (
|
|
1451
|
-
const
|
|
1452
|
-
if (
|
|
1453
|
-
return !!
|
|
1450
|
+
const isElement = (t2) => {
|
|
1451
|
+
const E5 = doc?.defaultView?.Element ?? globalThis.Element;
|
|
1452
|
+
if (E5 && t2 instanceof E5) return true;
|
|
1453
|
+
return !!t2 && typeof t2.closest === "function" && typeof t2.getAttribute === "function";
|
|
1454
1454
|
};
|
|
1455
|
-
const viewStyle = (
|
|
1455
|
+
const viewStyle = (n2) => {
|
|
1456
1456
|
try {
|
|
1457
1457
|
const gcs = doc?.defaultView?.getComputedStyle ?? (typeof getComputedStyle === "function" ? getComputedStyle : null);
|
|
1458
|
-
return gcs ? gcs(
|
|
1458
|
+
return gcs ? gcs(n2).pointerEvents : "";
|
|
1459
1459
|
} catch {
|
|
1460
1460
|
return "";
|
|
1461
1461
|
}
|
|
1462
1462
|
};
|
|
1463
1463
|
const isInvisibleStrokePath = (el) => {
|
|
1464
1464
|
if (el.tagName.toLowerCase() !== "path") return false;
|
|
1465
|
-
const
|
|
1466
|
-
if (
|
|
1467
|
-
const
|
|
1465
|
+
const f4 = el.getAttribute("fill");
|
|
1466
|
+
if (f4 !== null && f4 !== "" && f4 !== "none" && f4 !== "transparent") return false;
|
|
1467
|
+
const s4 = (el.getAttribute("stroke") || "").trim().toLowerCase();
|
|
1468
1468
|
const so = parseFloat(el.getAttribute("stroke-opacity") || "1");
|
|
1469
|
-
return
|
|
1469
|
+
return s4 === "transparent" || s4 === "none" || so <= 0.01;
|
|
1470
1470
|
};
|
|
1471
|
-
const distToPathCenterline = (el,
|
|
1472
|
-
const
|
|
1473
|
-
if (!(
|
|
1474
|
-
const
|
|
1475
|
-
if (!
|
|
1471
|
+
const distToPathCenterline = (el, x3, y5) => {
|
|
1472
|
+
const L4 = el.getTotalLength();
|
|
1473
|
+
if (!(L4 > 0)) return Number.MAX_VALUE;
|
|
1474
|
+
const m2 = el.getScreenCTM();
|
|
1475
|
+
if (!m2) return Number.MAX_VALUE;
|
|
1476
1476
|
let best = Number.MAX_VALUE;
|
|
1477
|
-
const
|
|
1478
|
-
for (let
|
|
1479
|
-
const
|
|
1480
|
-
const dx =
|
|
1481
|
-
const dy =
|
|
1482
|
-
const
|
|
1483
|
-
if (
|
|
1477
|
+
const N3 = 64;
|
|
1478
|
+
for (let i4 = 0; i4 <= N3; i4++) {
|
|
1479
|
+
const pt2 = el.getPointAtLength(L4 * i4 / N3);
|
|
1480
|
+
const dx = m2.a * pt2.x + m2.c * pt2.y + m2.e - x3;
|
|
1481
|
+
const dy = m2.b * pt2.x + m2.d * pt2.y + m2.f - y5;
|
|
1482
|
+
const d2 = dx * dx + dy * dy;
|
|
1483
|
+
if (d2 < best) best = d2;
|
|
1484
1484
|
}
|
|
1485
1485
|
return Math.sqrt(best);
|
|
1486
1486
|
};
|
|
1487
|
-
const refineHitCorridor = (mark,
|
|
1487
|
+
const refineHitCorridor = (mark, x3, y5, sel) => {
|
|
1488
1488
|
try {
|
|
1489
1489
|
if (!mark || !isInvisibleStrokePath(mark) || !mark.getAttribute("data-row-idx")) return mark;
|
|
1490
|
-
const stack = doc.elementsFromPoint(
|
|
1490
|
+
const stack = doc.elementsFromPoint(x3, y5);
|
|
1491
1491
|
const candidates = [];
|
|
1492
1492
|
for (const el of stack) {
|
|
1493
1493
|
if (!root.contains(el)) continue;
|
|
@@ -1501,9 +1501,9 @@ function createMarkResolver(env) {
|
|
|
1501
1501
|
let best = mark;
|
|
1502
1502
|
let bestD = Number.MAX_VALUE;
|
|
1503
1503
|
for (const el of candidates) {
|
|
1504
|
-
const
|
|
1505
|
-
if (
|
|
1506
|
-
bestD =
|
|
1504
|
+
const d2 = distToPathCenterline(el, x3, y5);
|
|
1505
|
+
if (d2 < bestD) {
|
|
1506
|
+
bestD = d2;
|
|
1507
1507
|
best = el;
|
|
1508
1508
|
}
|
|
1509
1509
|
}
|
|
@@ -1523,9 +1523,9 @@ function createMarkResolver(env) {
|
|
|
1523
1523
|
const findMark = (target, sel = ".d3-mark", ev) => {
|
|
1524
1524
|
if (!isElement(target)) return null;
|
|
1525
1525
|
const el = target;
|
|
1526
|
-
const
|
|
1527
|
-
if (
|
|
1528
|
-
return
|
|
1526
|
+
const m2 = el.closest(sel);
|
|
1527
|
+
if (m2 && ev) return refineHitCorridor(m2, ev.clientX, ev.clientY, sel);
|
|
1528
|
+
return m2;
|
|
1529
1529
|
};
|
|
1530
1530
|
const rowIdxsFromMark = (el) => {
|
|
1531
1531
|
if (!el) return [];
|
|
@@ -1533,14 +1533,14 @@ function createMarkResolver(env) {
|
|
|
1533
1533
|
if (!raw) return [];
|
|
1534
1534
|
const out = [];
|
|
1535
1535
|
for (const tok of raw.split(",")) {
|
|
1536
|
-
const
|
|
1537
|
-
if (!isNaN(
|
|
1536
|
+
const n2 = parseInt(tok.trim(), 10);
|
|
1537
|
+
if (!isNaN(n2) && n2 >= 0) out.push(n2);
|
|
1538
1538
|
}
|
|
1539
1539
|
return out;
|
|
1540
1540
|
};
|
|
1541
|
-
const penetrateOverlayAt = (
|
|
1541
|
+
const penetrateOverlayAt = (x3, y5, sel) => {
|
|
1542
1542
|
try {
|
|
1543
|
-
const stack = doc.elementsFromPoint(
|
|
1543
|
+
const stack = doc.elementsFromPoint(x3, y5);
|
|
1544
1544
|
for (const el of stack) {
|
|
1545
1545
|
if (!root.contains(el) || !isElement(el)) continue;
|
|
1546
1546
|
const cand = el.matches(sel) ? el : el.closest(sel);
|
|
@@ -1552,17 +1552,17 @@ function createMarkResolver(env) {
|
|
|
1552
1552
|
}
|
|
1553
1553
|
return null;
|
|
1554
1554
|
};
|
|
1555
|
-
const resolveByGeometry = (
|
|
1555
|
+
const resolveByGeometry = (x3, y5, sel) => {
|
|
1556
1556
|
try {
|
|
1557
1557
|
const cands = root.querySelectorAll(sel);
|
|
1558
1558
|
let best = null, bestArea = Number.MAX_VALUE;
|
|
1559
1559
|
if (cands.length <= 600) {
|
|
1560
1560
|
for (const el of Array.from(cands)) {
|
|
1561
1561
|
if (!el.getAttribute("data-row-idx")) continue;
|
|
1562
|
-
const
|
|
1563
|
-
if (!
|
|
1564
|
-
if (
|
|
1565
|
-
const area =
|
|
1562
|
+
const r2 = el.getBoundingClientRect ? el.getBoundingClientRect() : null;
|
|
1563
|
+
if (!r2 || r2.width <= 0 || r2.height <= 0) continue;
|
|
1564
|
+
if (x3 < r2.left || x3 > r2.right || y5 < r2.top || y5 > r2.bottom) continue;
|
|
1565
|
+
const area = r2.width * r2.height;
|
|
1566
1566
|
if (area < bestArea) {
|
|
1567
1567
|
bestArea = area;
|
|
1568
1568
|
best = el;
|
|
@@ -1572,10 +1572,10 @@ function createMarkResolver(env) {
|
|
|
1572
1572
|
const hasHittableShape = (node) => {
|
|
1573
1573
|
const SHAPE = /^(rect|circle|ellipse|path|line|polygon|polyline|text|image|use)$/;
|
|
1574
1574
|
const all = [node, ...Array.from(node.querySelectorAll("*"))];
|
|
1575
|
-
for (const
|
|
1576
|
-
const tag = (
|
|
1575
|
+
for (const n2 of all) {
|
|
1576
|
+
const tag = (n2.tagName || "").toLowerCase();
|
|
1577
1577
|
if (!SHAPE.test(tag)) continue;
|
|
1578
|
-
const pe2 = viewStyle(
|
|
1578
|
+
const pe2 = viewStyle(n2);
|
|
1579
1579
|
if (pe2 && pe2 !== "none") return true;
|
|
1580
1580
|
}
|
|
1581
1581
|
return false;
|
|
@@ -1696,15 +1696,15 @@ function censusMarks(container) {
|
|
|
1696
1696
|
return EMPTY;
|
|
1697
1697
|
}
|
|
1698
1698
|
}
|
|
1699
|
-
function isBlankRender(
|
|
1700
|
-
if (
|
|
1701
|
-
if (
|
|
1702
|
-
if (
|
|
1703
|
-
if (!(
|
|
1704
|
-
return
|
|
1699
|
+
function isBlankRender(i4) {
|
|
1700
|
+
if (i4.contractUntagged) return false;
|
|
1701
|
+
if (i4.animated) return false;
|
|
1702
|
+
if (i4.authoredNoDataText) return false;
|
|
1703
|
+
if (!(i4.rows > 0)) return false;
|
|
1704
|
+
return i4.markCount === 0;
|
|
1705
1705
|
}
|
|
1706
1706
|
function blankRenderFlag(lang, cause) {
|
|
1707
|
-
const clean = (
|
|
1707
|
+
const clean = (s4) => String(s4 || "unknown").toLowerCase().replace(/[^a-z0-9-]+/g, "-");
|
|
1708
1708
|
return `blankrender:${clean(lang)}:${clean(cause)}`;
|
|
1709
1709
|
}
|
|
1710
1710
|
|
|
@@ -1728,20 +1728,20 @@ function styleOf(el, doc) {
|
|
|
1728
1728
|
}
|
|
1729
1729
|
}
|
|
1730
1730
|
function attrOrComputed(el, name, cs) {
|
|
1731
|
-
const
|
|
1732
|
-
if (
|
|
1733
|
-
const
|
|
1734
|
-
return
|
|
1731
|
+
const a5 = el.getAttribute?.(name);
|
|
1732
|
+
if (a5 !== null && a5 !== void 0 && String(a5).trim() !== "") return String(a5).trim();
|
|
1733
|
+
const c4 = cs?.[name === "stroke-width" ? "strokeWidth" : name];
|
|
1734
|
+
return c4 === null || c4 === void 0 ? "" : String(c4).trim();
|
|
1735
1735
|
}
|
|
1736
1736
|
function isUnfilled(fill) {
|
|
1737
|
-
const
|
|
1738
|
-
return
|
|
1737
|
+
const f4 = fill.toLowerCase();
|
|
1738
|
+
return f4 === "none" || f4 === "transparent" || f4 === "rgba(0, 0, 0, 0)" || f4 === "rgba(0,0,0,0)";
|
|
1739
1739
|
}
|
|
1740
1740
|
function widthPx(raw) {
|
|
1741
|
-
const
|
|
1742
|
-
if (!
|
|
1743
|
-
const
|
|
1744
|
-
return isFinite(
|
|
1741
|
+
const m2 = /^(-?\d+(?:\.\d+)?)\s*(px)?$/i.exec(raw);
|
|
1742
|
+
if (!m2) return NaN;
|
|
1743
|
+
const n2 = parseFloat(m2[1]);
|
|
1744
|
+
return isFinite(n2) ? n2 : NaN;
|
|
1745
1745
|
}
|
|
1746
1746
|
function censusHitBands(container, doc) {
|
|
1747
1747
|
if (!container || typeof container.querySelectorAll !== "function") return EMPTY2;
|
|
@@ -1758,25 +1758,25 @@ function censusHitBands(container, doc) {
|
|
|
1758
1758
|
if (!OPEN_TAGS.has(tag)) continue;
|
|
1759
1759
|
const cs = styleOf(el, ownerDoc);
|
|
1760
1760
|
const open = isUnfilled(attrOrComputed(el, "fill", cs));
|
|
1761
|
-
const
|
|
1761
|
+
const w3 = widthPx(attrOrComputed(el, "stroke-width", cs) || "1");
|
|
1762
1762
|
const geom = String(el.getAttribute?.("d") ?? "") || `${tag}#${String(el.getAttribute?.(ROW_IDX_ATTR) ?? "")}`;
|
|
1763
1763
|
const inert = String(cs?.pointerEvents ?? el.style?.pointerEvents ?? "") === "none";
|
|
1764
|
-
rows.push({ el, geom, w:
|
|
1765
|
-
if (isFinite(
|
|
1764
|
+
rows.push({ el, geom, w: w3, open, inert });
|
|
1765
|
+
if (isFinite(w3)) {
|
|
1766
1766
|
const prev = widestByGeom.get(geom);
|
|
1767
|
-
if (prev === void 0 ||
|
|
1767
|
+
if (prev === void 0 || w3 > prev) widestByGeom.set(geom, w3);
|
|
1768
1768
|
}
|
|
1769
1769
|
}
|
|
1770
1770
|
const out = { ...EMPTY2 };
|
|
1771
|
-
for (const
|
|
1772
|
-
if (!
|
|
1771
|
+
for (const r2 of rows) {
|
|
1772
|
+
if (!r2.open) continue;
|
|
1773
1773
|
out.openStrokes++;
|
|
1774
|
-
if (
|
|
1774
|
+
if (r2.inert) continue;
|
|
1775
1775
|
out.interactive++;
|
|
1776
|
-
if (isFinite(
|
|
1777
|
-
if (!(
|
|
1776
|
+
if (isFinite(r2.w) && r2.w > out.widestPx) out.widestPx = Math.round(r2.w);
|
|
1777
|
+
if (!(r2.w < MIN_HIT_BAND_PX)) continue;
|
|
1778
1778
|
out.hairline++;
|
|
1779
|
-
const best = widestByGeom.get(
|
|
1779
|
+
const best = widestByGeom.get(r2.geom);
|
|
1780
1780
|
if (best === void 0 || best < MIN_HIT_BAND_PX) out.uncovered++;
|
|
1781
1781
|
}
|
|
1782
1782
|
return out;
|
|
@@ -1784,9 +1784,649 @@ function censusHitBands(container, doc) {
|
|
|
1784
1784
|
return EMPTY2;
|
|
1785
1785
|
}
|
|
1786
1786
|
}
|
|
1787
|
-
function hitBandFlag(
|
|
1788
|
-
if (
|
|
1789
|
-
return
|
|
1787
|
+
function hitBandFlag(c4) {
|
|
1788
|
+
if (c4.interactive === 0) return "";
|
|
1789
|
+
return c4.uncovered > 0 ? "hitband:d3:thin" : "hitband:d3:ok";
|
|
1790
|
+
}
|
|
1791
|
+
|
|
1792
|
+
// ../../node_modules/colorsea/dist/index.esm.js
|
|
1793
|
+
function t(t2, r2, n2, e2) {
|
|
1794
|
+
var o2, i4 = arguments.length, a5 = i4 < 3 ? r2 : null === e2 ? e2 = Object.getOwnPropertyDescriptor(r2, n2) : e2;
|
|
1795
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) a5 = Reflect.decorate(t2, r2, n2, e2);
|
|
1796
|
+
else for (var u5 = t2.length - 1; u5 >= 0; u5--) (o2 = t2[u5]) && (a5 = (i4 < 3 ? o2(a5) : i4 > 3 ? o2(r2, n2, a5) : o2(r2, n2)) || a5);
|
|
1797
|
+
return i4 > 3 && a5 && Object.defineProperty(r2, n2, a5), a5;
|
|
1798
|
+
}
|
|
1799
|
+
function r(t2, r2, n2) {
|
|
1800
|
+
if (n2 || 2 === arguments.length) for (var e2, o2 = 0, i4 = r2.length; o2 < i4; o2++) !e2 && o2 in r2 || (e2 || (e2 = Array.prototype.slice.call(r2, 0, o2)), e2[o2] = r2[o2]);
|
|
1801
|
+
return t2.concat(e2 || Array.prototype.slice.call(r2));
|
|
1802
|
+
}
|
|
1803
|
+
var n = function(t2, r2, n2) {
|
|
1804
|
+
return [t2, r2, n2].map((function(t4) {
|
|
1805
|
+
return (t4 /= 255) > 0.04045 ? Math.pow((t4 + 0.055) / 1.055, 2.4) : t4 / 12.92;
|
|
1806
|
+
}));
|
|
1807
|
+
};
|
|
1808
|
+
var e = function(t2, r2, n2) {
|
|
1809
|
+
return [t2, r2, n2].map((function(t4) {
|
|
1810
|
+
return 255 * (t4 <= 304e-5 ? 12.92 * t4 : 1.055 * Math.pow(t4, 1 / 2.4) - 0.055);
|
|
1811
|
+
}));
|
|
1812
|
+
};
|
|
1813
|
+
var o = function(t2, r2, n2) {
|
|
1814
|
+
return Math.min(Math.max(t2, r2), n2);
|
|
1815
|
+
};
|
|
1816
|
+
var i2 = function(t2, r2) {
|
|
1817
|
+
return Math.round((t2 + Number.EPSILON) * Math.pow(10, r2)) / Math.pow(10, r2);
|
|
1818
|
+
};
|
|
1819
|
+
var a4 = function(t2, r2) {
|
|
1820
|
+
return Math.floor(Math.random() * (r2 - t2 + 1) - t2);
|
|
1821
|
+
};
|
|
1822
|
+
var u4 = function(t2, r2, n2, e2) {
|
|
1823
|
+
for (var i4, a5 = [t2, r2, n2], u5 = "#", h3 = 0; h3 < a5.length; h3++) u5 += (i4 = a5[h3], Math.round(o(i4, 0, 255)).toString(16).padStart(2, "0"));
|
|
1824
|
+
return null != e2 && (u5 += Math.round(o(e2, 0, 100) / 100 * 255).toString(16).padStart(2, "0")), u5;
|
|
1825
|
+
};
|
|
1826
|
+
var h2 = function(t2) {
|
|
1827
|
+
var n2 = t2.length, e2 = (t2 = (function(t4) {
|
|
1828
|
+
var r2 = (t4 = /^#/.test(t4) ? t4.slice(1) : t4).length;
|
|
1829
|
+
if (![3, 4, 6, 8].includes(r2)) return "000000";
|
|
1830
|
+
if (6 === r2 || 8 === r2) return t4;
|
|
1831
|
+
if (3 === r2 || 4 === r2) {
|
|
1832
|
+
for (var n4 = "", e4 = 0; e4 < r2; e4++) {
|
|
1833
|
+
var o4 = t4[e4];
|
|
1834
|
+
n4 += "" + o4 + o4;
|
|
1835
|
+
}
|
|
1836
|
+
return n4;
|
|
1837
|
+
}
|
|
1838
|
+
return "000000";
|
|
1839
|
+
})(t2).padEnd(8, "ff")).match(/.{2}/g);
|
|
1840
|
+
if (!e2) return [0, 0, 0, 1];
|
|
1841
|
+
var o2 = [0, 0, 0], i4 = false;
|
|
1842
|
+
return e2.forEach((function(t4, r2) {
|
|
1843
|
+
r2 < 3 ? o2[r2] = parseInt(t4, 16) : i4 = 100 * parseInt(t4, 16) / 255;
|
|
1844
|
+
})), false === i4 || n2 < 8 ? o2 : r(r([], o2, true), [i4], false);
|
|
1845
|
+
};
|
|
1846
|
+
var c2 = function(t2, r2, n2) {
|
|
1847
|
+
var e2;
|
|
1848
|
+
e2 = [t2, r2, n2].map((function(t4) {
|
|
1849
|
+
return t4 / 255;
|
|
1850
|
+
})), t2 = e2[0], r2 = e2[1], n2 = e2[2];
|
|
1851
|
+
var o2 = 1 - Math.max(t2, r2, n2), i4 = o2 < 1 ? 1 / (1 - o2) : 0;
|
|
1852
|
+
return [(1 - t2 - o2) * i4 * 100, (1 - r2 - o2) * i4 * 100, (1 - n2 - o2) * i4 * 100, 100 * o2];
|
|
1853
|
+
};
|
|
1854
|
+
var l2 = function(t2, r2, n2, e2) {
|
|
1855
|
+
return 100 === e2 ? [0, 0, 0] : (e2 /= 100, [t2, r2, n2].map((function(t4) {
|
|
1856
|
+
return (t4 /= 100) >= 1 ? 0 : 255 * (1 - t4) * (1 - e2);
|
|
1857
|
+
})));
|
|
1858
|
+
};
|
|
1859
|
+
function p2(t2, r2, n2, e2) {
|
|
1860
|
+
var o2;
|
|
1861
|
+
void 0 === e2 && (e2 = "l"), o2 = [t2, r2, n2].map((function(t4) {
|
|
1862
|
+
return t4 / 255;
|
|
1863
|
+
})), t2 = o2[0], r2 = o2[1], n2 = o2[2];
|
|
1864
|
+
var i4 = Math.max(t2, r2, n2), a5 = Math.min(t2, r2, n2), u5 = (function(t4, r4, n4, e4) {
|
|
1865
|
+
var o4;
|
|
1866
|
+
void 0 === e4 && (e4 = false), o4 = [t4, r4, n4].map((function(t5) {
|
|
1867
|
+
return t5 / 255;
|
|
1868
|
+
})), t4 = o4[0], r4 = o4[1], n4 = o4[2];
|
|
1869
|
+
var i5 = Math.max(t4, r4, n4), a6 = Math.min(t4, r4, n4), u6 = 0;
|
|
1870
|
+
if (i5 !== a6) if (e4) u6 = (t4 - r4 + (t4 - n4)) / 2, u6 /= Math.sqrt((t4 - r4) * (t4 - r4) + (t4 - n4) * (r4 - n4)), u6 = Math.acos(u6), n4 > r4 && (u6 = 2 * Math.PI - u6), u6 /= 2 * Math.PI;
|
|
1871
|
+
else {
|
|
1872
|
+
var h4 = i5 - a6;
|
|
1873
|
+
u6 = i5 === t4 ? (r4 - n4) / h4 + (r4 < n4 ? 6 : 0) : i5 === r4 ? (n4 - t4) / h4 + 2 : (t4 - r4) / h4 + 4, u6 /= 6;
|
|
1874
|
+
}
|
|
1875
|
+
else u6 = NaN;
|
|
1876
|
+
return 360 * u6;
|
|
1877
|
+
})(t2, r2, n2, "i" === e2), h3 = 0, c4 = (i4 + a5) / 2, l3 = i4 - a5, p4 = i4, f4 = (t2 + r2 + n2) / 3;
|
|
1878
|
+
return "v" === e2 && (h3 = 0 === i4 ? 0 : l3 / i4), i4 !== a5 && "l" === e2 && (h3 = c4 > 0.5 ? l3 / (2 - i4 - a5) : l3 / (i4 + a5)), "i" === e2 && (h3 = f4 > 0 ? 1 - a5 / f4 : 0), h3 *= 100, c4 *= 100, f4 *= 100, "l" === e2 ? [u5, h3, c4] : "v" === e2 ? [u5, h3, p4 *= 100] : [u5, h3, f4];
|
|
1879
|
+
}
|
|
1880
|
+
var f2 = function(t2, r2, n2) {
|
|
1881
|
+
return p2(t2, r2, n2, "l");
|
|
1882
|
+
};
|
|
1883
|
+
var s2 = function(t2, r2, n2) {
|
|
1884
|
+
var e2, i4, a5 = function(t4) {
|
|
1885
|
+
return 6 * (t4 = t4 < 0 ? t4 + 1 : t4 > 1 ? t4 - 1 : t4) < 1 ? e2 + (i4 - e2) * t4 * 6 : 2 * t4 < 1 ? i4 : 3 * t4 < 2 ? e2 + (i4 - e2) * (2 / 3 - t4) * 6 : e2;
|
|
1886
|
+
};
|
|
1887
|
+
return t2 = t2 % 360 / 360, r2 = o(r2 / 100, 0, 1), n2 = o(n2 / 100, 0, 1), e2 = 2 * n2 - (i4 = n2 <= 0.5 ? n2 * (r2 + 1) : n2 + r2 - n2 * r2), [255 * a5(t2 + 1 / 3), 255 * a5(t2), 255 * a5(t2 - 1 / 3)];
|
|
1888
|
+
};
|
|
1889
|
+
var v3 = function(t2, r2, n2) {
|
|
1890
|
+
return p2(t2, r2, n2, "v");
|
|
1891
|
+
};
|
|
1892
|
+
var b2 = function(t2, r2, n2) {
|
|
1893
|
+
var e2, o2, i4 = [n2 /= 100, n2 * (1 - (r2 /= 100)), n2 * (1 - (o2 = (t2 = t2 % 360 / 360 * 360) / 60 - (e2 = Math.floor(t2 / 60 % 6))) * r2), n2 * (1 - (1 - o2) * r2)], a5 = [[0, 3, 1], [2, 0, 1], [1, 0, 3], [1, 2, 0], [3, 1, 0], [0, 1, 2]];
|
|
1894
|
+
return [255 * i4[a5[e2][0]], 255 * i4[a5[e2][1]], 255 * i4[a5[e2][2]]];
|
|
1895
|
+
};
|
|
1896
|
+
var y4 = function(t2, r2, n2) {
|
|
1897
|
+
return p2(t2, r2, n2, "i");
|
|
1898
|
+
};
|
|
1899
|
+
var d = function(t2, r2, n2) {
|
|
1900
|
+
var e2, i4, a5, u5;
|
|
1901
|
+
r2 /= 100, n2 /= 100, isNaN(t2) && (t2 = 0), isNaN(r2) && (r2 = 0);
|
|
1902
|
+
var h3 = function(t4) {
|
|
1903
|
+
return (1 + r2 * Math.cos(2 * Math.PI * t4) / Math.cos(Math.PI / 3 - 2 * Math.PI * t4)) / 3;
|
|
1904
|
+
};
|
|
1905
|
+
return (t2 = (360 + t2) % 360 / 360) < 1 / 3 ? a5 = 1 - ((u5 = (1 - r2) / 3) + (i4 = h3(t2))) : t2 < 2 / 3 ? u5 = 1 - ((i4 = (1 - r2) / 3) + (a5 = h3(t2 -= 1 / 3))) : i4 = 1 - ((a5 = (1 - r2) / 3) + (u5 = h3(t2 -= 2 / 3))), e2 = [i4, a5, u5].map((function(t4) {
|
|
1906
|
+
return 255 * o(n2 * t4 * 3, 0, 1);
|
|
1907
|
+
})), [i4 = e2[0], a5 = e2[1], u5 = e2[2]];
|
|
1908
|
+
};
|
|
1909
|
+
var g3 = function(t2, r2, n2) {
|
|
1910
|
+
return [f2(t2, r2, n2)[0], 100 * (Math.min(t2, r2, n2) / 255), 100 * (1 - Math.max(t2, r2, n2) / 255)];
|
|
1911
|
+
};
|
|
1912
|
+
function w2(t2, r2, n2) {
|
|
1913
|
+
return r2 /= 100, n2 /= 100, s2(t2, 100, 50).map((function(t4) {
|
|
1914
|
+
return 255 * (t4 / 255 * (1 - r2 - n2) + r2);
|
|
1915
|
+
}));
|
|
1916
|
+
}
|
|
1917
|
+
var m = { x: [0.4124564, 0.3575761, 0.1804375], y: [0.2126729, 0.7151522, 0.072175], z: [0.0193339, 0.119192, 0.9503041] };
|
|
1918
|
+
var M = { r: [3.2404542, -1.5371385, -0.4985314], g: [-0.969266, 1.8760108, 0.041556], b: [0.0556434, -0.2040259, 1.0572252] };
|
|
1919
|
+
var x2 = 0.95047;
|
|
1920
|
+
var _2 = 1;
|
|
1921
|
+
var C2 = 1.08883;
|
|
1922
|
+
var I2 = 0.206896552;
|
|
1923
|
+
var k2 = 8856452e-9;
|
|
1924
|
+
var E4 = 24389 / 27;
|
|
1925
|
+
var z3 = function(t2, r2, e2) {
|
|
1926
|
+
var o2 = n(t2, r2, e2);
|
|
1927
|
+
return [100 * m.x.reduce((function(t4, r4, n2) {
|
|
1928
|
+
return t4 + r4 * o2[n2];
|
|
1929
|
+
}), 0), 100 * m.y.reduce((function(t4, r4, n2) {
|
|
1930
|
+
return t4 + r4 * o2[n2];
|
|
1931
|
+
}), 0), 100 * m.z.reduce((function(t4, r4, n2) {
|
|
1932
|
+
return t4 + r4 * o2[n2];
|
|
1933
|
+
}), 0)];
|
|
1934
|
+
};
|
|
1935
|
+
var N2 = function(t2, r2, n2) {
|
|
1936
|
+
var o2 = [t2, r2, n2], i4 = M.r.reduce((function(t4, r4, n4) {
|
|
1937
|
+
return t4 + r4 * o2[n4];
|
|
1938
|
+
}), 0) / 100, a5 = M.g.reduce((function(t4, r4, n4) {
|
|
1939
|
+
return t4 + r4 * o2[n4];
|
|
1940
|
+
}), 0) / 100, u5 = M.b.reduce((function(t4, r4, n4) {
|
|
1941
|
+
return t4 + r4 * o2[n4];
|
|
1942
|
+
}), 0) / 100;
|
|
1943
|
+
return e(i4, a5, u5);
|
|
1944
|
+
};
|
|
1945
|
+
var O2 = function(t2, r2, n2) {
|
|
1946
|
+
var e2;
|
|
1947
|
+
return e2 = [t2 = t2 / x2 / 100, r2 = r2 / _2 / 100, n2 = n2 / C2 / 100].map((function(t4) {
|
|
1948
|
+
return t4 > k2 ? Math.pow(t4, 1 / 3) : (E4 * t4 + 16) / 116;
|
|
1949
|
+
})), t2 = e2[0], r2 = e2[1], n2 = e2[2], [Math.max(0, 116 * r2 - 16), 500 * (t2 - r2), 200 * (r2 - n2)];
|
|
1950
|
+
};
|
|
1951
|
+
var P4 = function(t2, r2, n2) {
|
|
1952
|
+
var e2, o2 = (t2 + 16) / 116, i4 = isNaN(r2) ? o2 : o2 + r2 / 500, a5 = isNaN(n2) ? o2 : o2 - n2 / 200;
|
|
1953
|
+
return e2 = [i4, o2, a5].map((function(t4) {
|
|
1954
|
+
return t4 > I2 ? Math.pow(t4, 3) : (116 * t4 - 16) / E4;
|
|
1955
|
+
})), i4 = e2[0], o2 = e2[1], a5 = e2[2], [i4 * x2 * 100, o2 * _2 * 100, a5 * C2 * 100];
|
|
1956
|
+
};
|
|
1957
|
+
var j3 = function(t2, r2, n2) {
|
|
1958
|
+
return N2.apply(void 0, P4(t2, r2, n2));
|
|
1959
|
+
};
|
|
1960
|
+
var S = function(t2, r2, n2) {
|
|
1961
|
+
r2 = o(r2, -100, 100), n2 = o(n2, -100, 100);
|
|
1962
|
+
var e2 = Math.sqrt(r2 * r2 + n2 * n2), i4 = (180 * Math.atan2(n2, r2) / Math.PI + 360) % 360;
|
|
1963
|
+
return 0 === Math.round(1e4 * e2) && (i4 = Number.NaN), [t2, e2, i4];
|
|
1964
|
+
};
|
|
1965
|
+
var A = function(t2, r2, n2) {
|
|
1966
|
+
return isNaN(n2) && (n2 = 0), n2 *= Math.PI / 180, [t2, Math.cos(n2) * r2, Math.sin(n2) * r2];
|
|
1967
|
+
};
|
|
1968
|
+
var L2 = function(t2, r2, n2) {
|
|
1969
|
+
return P4.apply(void 0, A(t2, r2, n2));
|
|
1970
|
+
};
|
|
1971
|
+
var H2 = function(t2, r2, n2) {
|
|
1972
|
+
var e2 = t2 + r2 + n2, o2 = 0, i4 = 0;
|
|
1973
|
+
return e2 > 0 && (o2 = t2 / e2, i4 = r2 / e2), [o2, i4, r2];
|
|
1974
|
+
};
|
|
1975
|
+
var Y2 = Object.freeze({ __proto__: null, linear2rgb: e, rgb2linear: n, rgb2hex: u4, hex2rgb: h2, rgb2cmyk: c2, cmyk2rgb: l2, rgb2hsl: f2, hsl2rgb: s2, rgb2hsv: v3, hsv2rgb: b2, rgb2hsi: y4, hsi2rgb: d, rgb2hwb: g3, hwb2rgb: w2, rgb2xyz: z3, xyz2rgb: N2, xyz2lab: O2, lab2xyz: P4, rgb2lab: function(t2, r2, n2) {
|
|
1976
|
+
return O2.apply(void 0, z3(t2, r2, n2));
|
|
1977
|
+
}, lab2rgb: j3, lch2lab: A, lab2lch: S, xyz2lch: function(t2, r2, n2) {
|
|
1978
|
+
return S.apply(void 0, O2(t2, r2, n2));
|
|
1979
|
+
}, lch2xyz: L2, xyY2xyz: function(t2, r2, n2) {
|
|
1980
|
+
return 0 === r2 ? [0, 0, 0] : [t2 * (n2 / r2), n2, n2 / r2 * (1 - t2 - r2)];
|
|
1981
|
+
}, xyz2xyY: H2 });
|
|
1982
|
+
function R(t2, n2) {
|
|
1983
|
+
return void 0 === n2 && (n2 = false), function(e2, o2, i4) {
|
|
1984
|
+
var a5 = i4.value;
|
|
1985
|
+
i4.value = function() {
|
|
1986
|
+
for (var e4 = [], o4 = 0; o4 < arguments.length; o4++) e4[o4] = arguments[o4];
|
|
1987
|
+
if (e4.length > 0 && n2) {
|
|
1988
|
+
var i5 = JSON.stringify(e4);
|
|
1989
|
+
t2 += i5;
|
|
1990
|
+
}
|
|
1991
|
+
if (this.cache.has(t2)) return this.cache.get(t2);
|
|
1992
|
+
var u5 = a5.call.apply(a5, r([this], e4, false));
|
|
1993
|
+
return this.cache.set(t2, u5), u5;
|
|
1994
|
+
};
|
|
1995
|
+
};
|
|
1996
|
+
}
|
|
1997
|
+
function q3(t2, n2, e2, o2) {
|
|
1998
|
+
return void 0 === t2 && (t2 = [0, 2, 2]), void 0 === n2 && (n2 = 0), void 0 === e2 && (e2 = true), void 0 === o2 && (o2 = 0), function(a5, u5, h3) {
|
|
1999
|
+
var c4 = h3.value;
|
|
2000
|
+
h3.value = function() {
|
|
2001
|
+
for (var a6 = [], u6 = 0; u6 < arguments.length; u6++) a6[u6] = arguments[u6];
|
|
2002
|
+
var h4 = void 0 === a6[o2] ? e2 : a6[o2], l3 = c4.call.apply(c4, r([this], a6, false));
|
|
2003
|
+
if (false === h4) return l3;
|
|
2004
|
+
var p4 = "number" == typeof h4 ? Math.round(h4) : 0, f4 = "number" == typeof t2 ? new Array(l3.length).fill(t2) : t2, s4 = f4.map((function(t4) {
|
|
2005
|
+
return 1 === n2 ? "number" == typeof h4 ? p4 : t4 : t4 + p4;
|
|
2006
|
+
}));
|
|
2007
|
+
return l3.map((function(t4, r2) {
|
|
2008
|
+
return i2(t4, s4[r2]);
|
|
2009
|
+
}));
|
|
2010
|
+
};
|
|
2011
|
+
};
|
|
2012
|
+
}
|
|
2013
|
+
var D3 = function(t2, r2, n2) {
|
|
2014
|
+
var e2 = t2 instanceof ft2 ? t2 : new ft2(t2), i4 = r2 instanceof ft2 ? r2 : new ft2(r2), a5 = o(n2, 0, 100) / 100, u5 = 2 * a5 - 1, h3 = e2.alpha() - i4.alpha(), c4 = ((u5 * h3 == -1 ? u5 : (u5 + h3) / (1 + u5 * h3)) + 1) / 2, l3 = 1 - c4, p4 = [Math.round(o(e2.red() * c4 + i4.red() * l3, 0, 255)), Math.round(o(e2.green() * c4 + i4.green() * l3, 0, 255)), Math.round(o(e2.blue() * c4 + i4.blue() * l3, 0, 255))], f4 = e2.alpha() * a5 + i4.alpha() * (1 - a5);
|
|
2015
|
+
return new ft2(p4, f4);
|
|
2016
|
+
};
|
|
2017
|
+
var F4 = Math.sqrt;
|
|
2018
|
+
var U3 = Math.pow;
|
|
2019
|
+
var $3 = Math.cos;
|
|
2020
|
+
var J2 = Math.abs;
|
|
2021
|
+
var Z3 = Math.sin;
|
|
2022
|
+
var B2 = Math.exp;
|
|
2023
|
+
var G3 = Math.atan2;
|
|
2024
|
+
var K2 = Math.PI;
|
|
2025
|
+
var Q3 = function(t2) {
|
|
2026
|
+
return K2 * t2 / 180;
|
|
2027
|
+
};
|
|
2028
|
+
var T3 = function(t2, r2, n2) {
|
|
2029
|
+
void 0 === n2 && (n2 = true);
|
|
2030
|
+
var e2 = G3(r2, t2);
|
|
2031
|
+
return n2 && (e2 = (e2 = (e2 = 180 * e2 / K2) > 0 ? e2 : e2 + 360) > 360 ? e2 - 360 : e2), e2;
|
|
2032
|
+
};
|
|
2033
|
+
var V2 = function(t2, r2) {
|
|
2034
|
+
void 0 === r2 && (r2 = true);
|
|
2035
|
+
var n2 = t2.lab(false), e2 = n2[0], o2 = n2[1], i4 = n2[2];
|
|
2036
|
+
return [e2, F4(U3(o2, 2) + U3(i4, 2)), T3(o2, i4, r2), o2, i4];
|
|
2037
|
+
};
|
|
2038
|
+
var W2 = ["CMC", "CIE", "CIE2000", "CIE1994", "CIE1976"];
|
|
2039
|
+
var X2 = "CMC";
|
|
2040
|
+
var tt = "CIE2000";
|
|
2041
|
+
var rt2 = "CIE1994";
|
|
2042
|
+
var nt = "CIE1976";
|
|
2043
|
+
var et = function(t2, r2, n2, e2) {
|
|
2044
|
+
void 0 === n2 && (n2 = "CIE");
|
|
2045
|
+
var o2 = (function(t4) {
|
|
2046
|
+
var r4 = t4.toUpperCase();
|
|
2047
|
+
return W2.includes(r4) && "CIE" !== r4 ? r4 : tt;
|
|
2048
|
+
})(n2);
|
|
2049
|
+
if (e2 = e2 || {}, o2 === X2) {
|
|
2050
|
+
var i4 = Object.assign({}, { l: 1, c: 1 }, e2);
|
|
2051
|
+
return (function(t4, r4, n4, e4) {
|
|
2052
|
+
void 0 === n4 && (n4 = 1), void 0 === e4 && (e4 = 1);
|
|
2053
|
+
var o4 = V2(t4, true), i5 = o4[0], a6 = o4[1], u6 = o4[2], h4 = o4[3], c5 = o4[4], l3 = V2(r4), p4 = l3[0], f4 = l3[1], s4 = l3[3], v4 = a6 - f4, b4 = i5 - p4, y5 = c5 - l3[4], d2 = F4(U3(h4 - s4, 2) + U3(y5, 2) - U3(v4, 2)), g4 = i5 < 16 ? 0.511 : 0.040975 * i5 / (1 + 0.01765 * i5), w3 = 0.0638 * a6 / (1 + 0.0131 * a6) + 0.638, m2 = 164 <= u6 && u6 <= 345 ? 0.56 + J2(0.2 * $3(Q3(u6 + 168))) : 0.36 + J2(0.4 * $3(Q3(u6 + 35))), M2 = F4(U3(a6, 4) / (U3(a6, 4) + 1900)), x3 = w3 * (M2 * m2 + 1 - M2);
|
|
2054
|
+
return F4(U3(b4 / (n4 * g4), 2) + U3(v4 / (e4 * w3), 2) + U3(d2 / x3, 2));
|
|
2055
|
+
})(t2, r2, i4.l, i4.c);
|
|
2056
|
+
}
|
|
2057
|
+
if (o2 === rt2) {
|
|
2058
|
+
var a5 = { kL: 1, kC: 1, kH: 1, cate: "graphic" }, u5 = Object.assign({}, a5, e2);
|
|
2059
|
+
return (function(t4, r4, n4, e4, o4, i5) {
|
|
2060
|
+
void 0 === n4 && (n4 = 1), void 0 === e4 && (e4 = 1), void 0 === o4 && (o4 = 1), void 0 === i5 && (i5 = "graphic");
|
|
2061
|
+
var a6 = "textiles" === i5 ? 0.048 : 0.045, u6 = "textiles" === i5 ? 0.014 : 0.015;
|
|
2062
|
+
n4 = "textiles" === i5 ? 2 : n4;
|
|
2063
|
+
var h4 = V2(t4), c5 = h4[0], l3 = h4[1], p4 = h4[3], f4 = h4[4], s4 = V2(r4), v4 = s4[0], b4 = s4[1], y5 = s4[3], d2 = c5 - v4, g4 = l3 - b4, w3 = f4 - s4[4], m2 = 1 + a6 * l3, M2 = 1 + u6 * l3, x3 = F4(U3(p4 - y5, 2) + U3(w3, 2) - U3(g4, 2));
|
|
2064
|
+
return F4(U3(d2 / (1 * n4), 2) + U3(g4 / (e4 * m2), 2) + U3(x3 / (o4 * M2), 2));
|
|
2065
|
+
})(t2, r2, u5.kL, u5.kC, u5.kH, u5.cate);
|
|
2066
|
+
}
|
|
2067
|
+
if (o2 === nt) return (function(t4, r4) {
|
|
2068
|
+
var n4 = t4.lab(false), e4 = n4[0], o4 = n4[1], i5 = n4[2], a6 = r4.lab(false), u6 = a6[0], h4 = a6[1], c5 = a6[2];
|
|
2069
|
+
return F4(U3(e4 - u6, 2) + U3(o4 - h4, 2) + U3(i5 - c5, 2));
|
|
2070
|
+
})(t2, r2);
|
|
2071
|
+
var h3 = { kL: 1, kC: 1, kH: 1 }, c4 = Object.assign({}, h3, e2);
|
|
2072
|
+
return (function(t4, r4, n4, e4, o4) {
|
|
2073
|
+
void 0 === n4 && (n4 = 1), void 0 === e4 && (e4 = 1), void 0 === o4 && (o4 = 1);
|
|
2074
|
+
var i5 = V2(t4), a6 = i5[0], u6 = i5[1], h4 = i5[3], c5 = i5[4], l3 = V2(r4), p4 = l3[0], f4 = l3[1], s4 = l3[3], v4 = l3[4], b4 = (a6 + p4) / 2, y5 = (u6 + f4) / 2, d2 = (1 - F4(U3(y5, 7) / (U3(y5, 7) + U3(25, 7)))) / 2, g4 = h4 * (1 + d2), w3 = s4 * (1 + d2), m2 = F4(U3(g4, 2) + U3(c5, 2)), M2 = F4(U3(w3, 2) + U3(v4, 2)), x3 = T3(g4, c5, true), _3 = T3(w3, v4, true), C3 = (m2 + M2) / 2, I4 = J2(x3 - _3) > 180 ? (x3 + _3 + 360) / 2 : (x3 + _3) / 2, k3 = 1 - 0.17 * $3(Q3(I4 - 30)) + 0.24 * $3(Q3(2 * I4)) + 0.32 * $3(Q3(3 * I4 + 6)) - 0.2 * $3(Q3(4 * I4 - 63)), E5 = J2(_3 - x3) <= 180 ? _3 - x3 : J2(_3 - x3) > 180 && _3 <= x3 ? _3 - x3 + 360 : _3 - x3 - 360, z4 = p4 - a6, N3 = f4 - u6, O3 = 2 * F4(m2 * M2) * Z3(Q3(E5) / 2), P5 = 1 + 0.015 * U3(b4 - 50, 2) / F4(20 + U3(b4 - 50, 2)), j4 = 1 + 0.045 * C3, S2 = 1 + 0.015 * C3 * k3, A2 = 30 * B2(-U3((I4 - 275) / 25, 2)), L4 = -2 * F4(U3(C3, 7) / (U3(C3, 7) + U3(25, 7))) * Z3(2 * Q3(A2));
|
|
2075
|
+
return F4(U3(z4 / (n4 * P5), 2) + U3(N3 / (e4 * j4), 2) + U3(O3 / (o4 * S2), 2) + L4 * (N3 / (e4 * j4)) * (O3 / (o4 * S2)));
|
|
2076
|
+
})(t2, r2, c4.kL, c4.kC, c4.kH);
|
|
2077
|
+
};
|
|
2078
|
+
var ot = function(t2, r2, n2) {
|
|
2079
|
+
var e2 = Math.abs, o2 = Math.max, i4 = Math.min, a5 = t2 instanceof ft2 ? t2 : new ft2(t2), u5 = r2 instanceof ft2 ? r2 : new ft2(r2), h3 = Object.assign({}, { b: 125, c: 500 }, n2);
|
|
2080
|
+
return !(e2(255 * a5.brightness() / 100 - 255 * u5.brightness() / 100) <= h3.b) && !(o2(a5.red(), u5.red()) - i4(a5.red(), u5.red()) + (o2(a5.green(), u5.green()) - i4(a5.green(), u5.green())) + (o2(a5.blue(), u5.blue()) - i4(a5.blue(), u5.blue())) <= h3.c);
|
|
2081
|
+
};
|
|
2082
|
+
var it = function(t2, r2, n2) {
|
|
2083
|
+
var e2, i4 = function(t4) {
|
|
2084
|
+
return o(t4, 0, 100);
|
|
2085
|
+
}, a5 = function(t4) {
|
|
2086
|
+
return o(t4, 0, 255);
|
|
2087
|
+
}, u5 = { h: [0, function(t4) {
|
|
2088
|
+
return t4 % 360;
|
|
2089
|
+
}], s: [1, i4], l: [2, i4], r: [0, a5], g: [1, a5], b: [2, a5] }, h3 = u5[r2][0];
|
|
2090
|
+
if (["h", "s", "l"].includes(r2)) {
|
|
2091
|
+
var c4 = t2.hsl();
|
|
2092
|
+
if (void 0 === n2) return c4[h3];
|
|
2093
|
+
n2 = u5[r2][1](n2), c4[h3] = n2, e2 = s2.apply(void 0, c4);
|
|
2094
|
+
} else {
|
|
2095
|
+
if (e2 = t2.rgb(), void 0 === n2) return e2[h3];
|
|
2096
|
+
n2 = u5[r2][1](n2), e2[h3] = n2;
|
|
2097
|
+
}
|
|
2098
|
+
return new ft2(e2, t2.alpha());
|
|
2099
|
+
};
|
|
2100
|
+
var at2 = {};
|
|
2101
|
+
var ut2 = /* @__PURE__ */ new Set(["rgb", "rgba", "cmyk", "lab", "hsl", "hsla", "hsv", "hsva", "hsi", "hsia", "xyz", "lch", "hwb", "hwba"]);
|
|
2102
|
+
var ht = /^([a-zA-Z]+)\(([\s\S]+)\)$/;
|
|
2103
|
+
var ct2 = function(t2) {
|
|
2104
|
+
return "string" == typeof t2 ? -1 === t2.indexOf("%") ? ct2(Number(t2.trim())) : (t2 = t2.split("%")[0], (t2 = Number(t2.trim())) || 0) : Math.abs(t2) < 1 ? 100 * t2 : t2;
|
|
2105
|
+
};
|
|
2106
|
+
var lt2 = function(t2, r2) {
|
|
2107
|
+
void 0 === r2 && (r2 = /* @__PURE__ */ new Set());
|
|
2108
|
+
var n2 = "string" == typeof t2 ? t2 : t2.join(",");
|
|
2109
|
+
if (r2.has(n2)) throw new Error("Invalid Color");
|
|
2110
|
+
r2.add(n2);
|
|
2111
|
+
var e2 = "rgb", o2 = [0, 0, 0], i4 = 100;
|
|
2112
|
+
if (Array.isArray(t2)) {
|
|
2113
|
+
if (t2.length < 3) throw new Error("Invalid Color");
|
|
2114
|
+
for (var a5 = 0; a5 < t2.length; a5++) if (a5 < 3) o2[a5] = t2[a5];
|
|
2115
|
+
else {
|
|
2116
|
+
if (3 !== a5 || void 0 === t2[3]) break;
|
|
2117
|
+
i4 = t2[3];
|
|
2118
|
+
}
|
|
2119
|
+
} else {
|
|
2120
|
+
var u5 = false, c4 = t2.trim().match(ht);
|
|
2121
|
+
if (c4 || (u5 = true), c4) {
|
|
2122
|
+
var l3 = c4[1].toLocaleLowerCase();
|
|
2123
|
+
if (e2 = l3, ut2.has(l3) || (u5 = true), c4[2] && !u5) {
|
|
2124
|
+
var p4 = c4[2], f4 = -1 !== p4.indexOf(",") ? "," : " ", s4 = p4.split(f4);
|
|
2125
|
+
for (a5 = 0; a5 < 3; a5++) void 0 !== s4[a5] && (["lch", "lab"].includes(e2) && 0 === a5 || ["hsl", "hsla", "hsv", "hsva", "hwb", "hwba", "hsi", "hsia"].includes(e2) && a5 > 0 ? o2[a5] = ct2(s4[a5]) : o2[a5] = Number(s4[a5].trim()));
|
|
2126
|
+
["rgba", "hsla", "hsva", "hwba", "hsia"].includes(e2) ? (e2 = e2.slice(0, -1), void 0 !== s4[3] && (i4 = ct2(s4[3]))) : "cmyk" === e2 && o2.push(void 0 !== s4[3] ? ct2(s4[3]) : 0);
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
if (u5) {
|
|
2130
|
+
if (!/^#(([a-fA-F\d]{3}){1,2}|[a-fA-F\d]{8})$/.test(t2)) try {
|
|
2131
|
+
return t2 = (function(t4, r4) {
|
|
2132
|
+
if (void 0 === r4 && (r4 = false), t4 = t4.toLowerCase(), void 0 === at2[t4]) {
|
|
2133
|
+
if (r4) throw new Error("Unknown color name: ".concat(t4, ")"));
|
|
2134
|
+
return t4;
|
|
2135
|
+
}
|
|
2136
|
+
return at2[t4];
|
|
2137
|
+
})(t2, true), lt2(t2, r2);
|
|
2138
|
+
} catch (t4) {
|
|
2139
|
+
throw new Error("Invalid Color");
|
|
2140
|
+
}
|
|
2141
|
+
o2 = h2(t2);
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
return [e2, o2, i4];
|
|
2145
|
+
};
|
|
2146
|
+
var pt = { thowParseError: false };
|
|
2147
|
+
var ft2 = (function() {
|
|
2148
|
+
function n2(t2, r2, n4) {
|
|
2149
|
+
this.cache = /* @__PURE__ */ new Map(), this._rgb = [0, 0, 0], this._alpha = 100;
|
|
2150
|
+
var e2 = { thowParseError: pt.thowParseError }, i4 = Object.assign({}, e2, null != n4 ? n4 : {});
|
|
2151
|
+
try {
|
|
2152
|
+
var a5 = (function(t4) {
|
|
2153
|
+
var r4, n5 = { lab2rgb: j3, hsl2rgb: s2, hsv2rgb: b2, xyz2rgb: N2, hwb2rgb: w2, hsi2rgb: d }, e4 = lt2(t4), i5 = e4[0], a6 = e4[1], u6 = e4[2];
|
|
2154
|
+
if ("rgb" === i5) return [a6, u6];
|
|
2155
|
+
"lch" === i5 && (i5 = (r4 = ["xyz", L2(a6[0], a6[1], a6[2])])[0], a6 = r4[1]);
|
|
2156
|
+
var h4 = a6[0], c4 = a6[1], p4 = a6[2], f4 = a6[3];
|
|
2157
|
+
if ("cmyk" === i5) return [l2(h4, c4, p4, f4).map((function(t5) {
|
|
2158
|
+
return o(t5, 0, 255);
|
|
2159
|
+
})), u6];
|
|
2160
|
+
var v4 = "".concat(i5, "2rgb");
|
|
2161
|
+
if ("function" == typeof n5[v4]) return [n5[v4](h4, c4, p4).map((function(t5) {
|
|
2162
|
+
return o(t5, 0, 255);
|
|
2163
|
+
})), u6];
|
|
2164
|
+
throw new Error("Invalid color");
|
|
2165
|
+
})(t2), u5 = a5[0], h3 = a5[1];
|
|
2166
|
+
this._alpha = h3, this._rgb = u5;
|
|
2167
|
+
} catch (t4) {
|
|
2168
|
+
if (i4.thowParseError) throw t4;
|
|
2169
|
+
}
|
|
2170
|
+
void 0 !== r2 && (this._alpha = o(r2, 0, 100));
|
|
2171
|
+
}
|
|
2172
|
+
return n2.prototype.red = function(t2) {
|
|
2173
|
+
return it(this, "r", t2);
|
|
2174
|
+
}, n2.prototype.green = function(t2) {
|
|
2175
|
+
return it(this, "g", t2);
|
|
2176
|
+
}, n2.prototype.blue = function(t2) {
|
|
2177
|
+
return it(this, "b", t2);
|
|
2178
|
+
}, n2.prototype.alpha = function(t2) {
|
|
2179
|
+
return void 0 === t2 ? this._alpha : (t2 = o(t2, 0, 100), new n2(this.rgb(), t2));
|
|
2180
|
+
}, n2.prototype.fadeIn = function(t2, r2) {
|
|
2181
|
+
return void 0 === t2 && (t2 = 10), t2 = r2 && "relative" === r2 ? this._alpha * t2 / 100 : t2, new n2(this.rgb(), o(this._alpha + t2, 0, 100));
|
|
2182
|
+
}, n2.prototype.fadeOut = function(t2, r2) {
|
|
2183
|
+
return void 0 === t2 && (t2 = 10), t2 = r2 && "relative" === r2 ? this._alpha * t2 / 100 : t2, new n2(this.rgb(), o(this._alpha - t2, 0, 100));
|
|
2184
|
+
}, n2.prototype.opacify = function(t2, r2) {
|
|
2185
|
+
return void 0 === t2 && (t2 = 10), this.fadeIn(t2, r2);
|
|
2186
|
+
}, n2.prototype.transparentize = function(t2, r2) {
|
|
2187
|
+
return void 0 === t2 && (t2 = 10), this.fadeOut(t2, r2);
|
|
2188
|
+
}, n2.prototype.hue = function(t2) {
|
|
2189
|
+
return it(this, "h", t2);
|
|
2190
|
+
}, n2.prototype.saturation = function(t2) {
|
|
2191
|
+
return it(this, "s", t2);
|
|
2192
|
+
}, n2.prototype.lightness = function(t2) {
|
|
2193
|
+
return it(this, "l", t2);
|
|
2194
|
+
}, n2.prototype.rgb = function(t2) {
|
|
2195
|
+
return r([], this._rgb, true);
|
|
2196
|
+
}, n2.prototype.rgba = function(t2) {
|
|
2197
|
+
return r(r([], this.rgb(false), true), [this._alpha], false);
|
|
2198
|
+
}, n2.prototype.cmyk = function(t2) {
|
|
2199
|
+
return c2.apply(void 0, this._rgb);
|
|
2200
|
+
}, n2.prototype.hsl = function(t2) {
|
|
2201
|
+
return f2.apply(void 0, this._rgb);
|
|
2202
|
+
}, n2.prototype.hsla = function(t2) {
|
|
2203
|
+
return r(r([], this.hsl(false), true), [this._alpha], false);
|
|
2204
|
+
}, n2.prototype.hsv = function(t2) {
|
|
2205
|
+
return v3.apply(void 0, this._rgb);
|
|
2206
|
+
}, n2.prototype.hsi = function(t2) {
|
|
2207
|
+
return y4.apply(void 0, this._rgb);
|
|
2208
|
+
}, n2.prototype.hwb = function(t2) {
|
|
2209
|
+
return g3.apply(void 0, this._rgb);
|
|
2210
|
+
}, n2.prototype.xyz = function(t2) {
|
|
2211
|
+
return z3.apply(void 0, this._rgb);
|
|
2212
|
+
}, n2.prototype.lab = function(t2) {
|
|
2213
|
+
return O2.apply(void 0, this.xyz(false));
|
|
2214
|
+
}, n2.prototype.lch = function(t2) {
|
|
2215
|
+
return S.apply(void 0, this.lab(false));
|
|
2216
|
+
}, n2.prototype.xyY = function(t2) {
|
|
2217
|
+
return H2.apply(void 0, this.xyz(false));
|
|
2218
|
+
}, n2.prototype.hex = function(t2) {
|
|
2219
|
+
void 0 === t2 && (t2 = 2);
|
|
2220
|
+
var n4 = 0 === t2 ? void 0 : 1 === t2 ? this._alpha : 100 === this._alpha ? void 0 : this._alpha, e2 = "color:hex:param_".concat(t2);
|
|
2221
|
+
if (this.cache.has(e2)) return this.cache.get(e2);
|
|
2222
|
+
var o2 = u4.apply(void 0, r(r([], this._rgb, false), [n4], false));
|
|
2223
|
+
return this.cache.set(e2, o2), o2;
|
|
2224
|
+
}, n2.prototype.lighten = function(t2, r2) {
|
|
2225
|
+
void 0 === t2 && (t2 = 5);
|
|
2226
|
+
var e2 = this.hsl(false), i4 = e2[0], a5 = e2[1], u5 = e2[2];
|
|
2227
|
+
return u5 = o(u5 += void 0 !== r2 && "relative" === r2 ? u5 * (t2 / 100) : t2, 0, 100), new n2(s2(i4, a5, u5), this._alpha);
|
|
2228
|
+
}, n2.prototype.darken = function(t2, r2) {
|
|
2229
|
+
return void 0 === t2 && (t2 = 5), this.lighten(-t2, r2);
|
|
2230
|
+
}, n2.prototype.saturate = function(t2, r2) {
|
|
2231
|
+
void 0 === t2 && (t2 = 5);
|
|
2232
|
+
var e2 = this.hsl(false), i4 = e2[0], a5 = e2[1], u5 = e2[2];
|
|
2233
|
+
return a5 = o(a5 += void 0 !== r2 && "relative" === r2 ? a5 * (t2 / 100) : t2, 0, 100), new n2(s2(i4, a5, u5), this._alpha);
|
|
2234
|
+
}, n2.prototype.desaturate = function(t2, r2) {
|
|
2235
|
+
return void 0 === t2 && (t2 = 5), this.saturate(-t2, r2);
|
|
2236
|
+
}, n2.prototype.spin = function(t2) {
|
|
2237
|
+
var r2 = this.hsl(false), e2 = r2[0], o2 = r2[1], i4 = r2[2];
|
|
2238
|
+
return new n2(s2(e2 = (e2 + t2 % 360 + 360) % 360, o2, i4), this._alpha);
|
|
2239
|
+
}, n2.prototype.adjustHue = function(t2) {
|
|
2240
|
+
return this.spin(t2);
|
|
2241
|
+
}, n2.prototype.complement = function() {
|
|
2242
|
+
return this.spin(180);
|
|
2243
|
+
}, n2.prototype.invert = function() {
|
|
2244
|
+
var t2 = this._rgb.map((function(t4) {
|
|
2245
|
+
return 255 - t4;
|
|
2246
|
+
}));
|
|
2247
|
+
return new n2([t2[0], t2[1], t2[2]], this._alpha);
|
|
2248
|
+
}, n2.prototype.mix = function(t2, r2) {
|
|
2249
|
+
return void 0 === r2 && (r2 = 50), D3(this, t2, 100 - o(r2, 0, 100));
|
|
2250
|
+
}, n2.prototype.luma = function() {
|
|
2251
|
+
var t2 = this._rgb.map((function(t4) {
|
|
2252
|
+
return (t4 /= 255) <= 0.03928 ? t4 / 12.92 : Math.pow((t4 + 0.055) / 1.055, 2.4);
|
|
2253
|
+
}));
|
|
2254
|
+
return 0.2126 * t2[0] + 0.7152 * t2[1] + 0.0722 * t2[2];
|
|
2255
|
+
}, n2.prototype.brightness = function() {
|
|
2256
|
+
var t2 = this._rgb;
|
|
2257
|
+
return (function(t4, r2, n4) {
|
|
2258
|
+
return (299 * t4 + 587 * r2 + 114 * n4) / 1e3 / 255 * 100;
|
|
2259
|
+
})(t2[0], t2[1], t2[2]);
|
|
2260
|
+
}, n2.prototype.deltaE = function(t2, r2, n4) {
|
|
2261
|
+
return void 0 === r2 && (r2 = "CMC"), et(this, t2, r2, n4);
|
|
2262
|
+
}, n2.prototype.visibility = function(t2, r2) {
|
|
2263
|
+
return ot(this, t2, r2);
|
|
2264
|
+
}, t([q3(0, 1, true, 0), R("color:rgb")], n2.prototype, "rgb", null), t([q3(0, 1, true, 0)], n2.prototype, "rgba", null), t([q3(0, 1, true, 0), R("color:cmyk")], n2.prototype, "cmyk", null), t([q3(0, 1, true, 0), R("color:hsl")], n2.prototype, "hsl", null), t([q3(0, 1, true, 0)], n2.prototype, "hsla", null), t([q3(0, 1, true, 0), R("color:hsv")], n2.prototype, "hsv", null), t([q3(0, 1, true, 0), R("color:hsi")], n2.prototype, "hsi", null), t([q3(0, 1, true, 0), R("color: hwb")], n2.prototype, "hwb", null), t([q3(2, 1, true, 0), R("color:xyz")], n2.prototype, "xyz", null), t([q3(2, 1, true, 0), R("color:lab")], n2.prototype, "lab", null), t([q3(2, 1, true, 0), R("color:lch")], n2.prototype, "lch", null), t([q3(2, 1, true, 0), R("color:xyY")], n2.prototype, "xyY", null), t([R("color:luma")], n2.prototype, "luma", null), n2;
|
|
2265
|
+
})();
|
|
2266
|
+
var st = function(t2, r2, n2, e2) {
|
|
2267
|
+
return new ft2([t2, r2, n2], e2);
|
|
2268
|
+
};
|
|
2269
|
+
var vt2 = function(t2, r2, n2, e2) {
|
|
2270
|
+
return new ft2(s2(t2, r2, n2), e2);
|
|
2271
|
+
};
|
|
2272
|
+
var bt = function(t2, r2, n2, e2) {
|
|
2273
|
+
return new ft2(b2(t2, r2, n2), e2);
|
|
2274
|
+
};
|
|
2275
|
+
var yt3 = function(t2, r2, n2, e2) {
|
|
2276
|
+
return new ft2(d(t2, r2, n2), e2);
|
|
2277
|
+
};
|
|
2278
|
+
var dt = function(t2, r2, n2, e2) {
|
|
2279
|
+
return new ft2(w2(t2, r2, n2), e2);
|
|
2280
|
+
};
|
|
2281
|
+
var gt = function(t2, r2, n2, e2) {
|
|
2282
|
+
return new ft2(N2(t2, r2, n2), e2);
|
|
2283
|
+
};
|
|
2284
|
+
var wt2 = function(t2, r2, n2, e2) {
|
|
2285
|
+
return new ft2(j3(t2, r2, n2), e2);
|
|
2286
|
+
};
|
|
2287
|
+
var mt = function(t2, r2, n2, e2) {
|
|
2288
|
+
return new ft2(N2.apply(void 0, L2(t2, r2, n2)), e2);
|
|
2289
|
+
};
|
|
2290
|
+
function Mt3(t2, r2, n2) {
|
|
2291
|
+
return new ft2(t2, r2, n2);
|
|
2292
|
+
}
|
|
2293
|
+
Mt3.config = function(t2) {
|
|
2294
|
+
Object.assign(pt, t2);
|
|
2295
|
+
}, Mt3.random = function() {
|
|
2296
|
+
var t2 = a4(0, 255), r2 = a4(0, 255), n2 = a4(0, 255);
|
|
2297
|
+
return new ft2([t2, r2, n2]);
|
|
2298
|
+
}, Mt3.convertor = Y2, Mt3.Color = ft2, Mt3.rgb = st, Mt3.hsl = vt2, Mt3.hsv = bt, Mt3.hsi = yt3, Mt3.hwb = dt, Mt3.xyz = gt, Mt3.lab = wt2, Mt3.lch = mt, Mt3.mix = D3, Mt3.deltaE = et, Mt3.utils = { roundDecimal: i2, randomRange: a4 }, Mt3.useNames = function(t2, r2) {
|
|
2299
|
+
return (function(t4, r4) {
|
|
2300
|
+
if (void 0 !== r4 && "function" == typeof r4) {
|
|
2301
|
+
var n2 = {};
|
|
2302
|
+
for (var e2 in t4) {
|
|
2303
|
+
var o2 = r4(e2, t4[e2]), i4 = o2[0], a5 = o2[1];
|
|
2304
|
+
n2[i4] = a5;
|
|
2305
|
+
}
|
|
2306
|
+
Object.assign(at2, n2);
|
|
2307
|
+
} else Object.assign(at2, t4);
|
|
2308
|
+
})(t2, r2), Mt3;
|
|
2309
|
+
};
|
|
2310
|
+
|
|
2311
|
+
// src/colourSpread.ts
|
|
2312
|
+
var SAME_SHADE_DELTA_E = 5;
|
|
2313
|
+
var MIN_RAMP_FILLS = 4;
|
|
2314
|
+
var RAMP_SLACK_MAX = 0.15;
|
|
2315
|
+
var MIN_MARKS = 24;
|
|
2316
|
+
var ELEMENT_CAP3 = 5e3;
|
|
2317
|
+
var MAX_CELLS = 48;
|
|
2318
|
+
var CELL_STEP = 32;
|
|
2319
|
+
var EMPTY3 = { marks: 0, distinctFills: 0, crowdShare: 0, spanDeltaE: 0 };
|
|
2320
|
+
function styleOf2(el, doc) {
|
|
2321
|
+
try {
|
|
2322
|
+
const view = doc?.defaultView;
|
|
2323
|
+
return view?.getComputedStyle ? view.getComputedStyle(el) : null;
|
|
2324
|
+
} catch {
|
|
2325
|
+
return null;
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
function fillOf(el, cs) {
|
|
2329
|
+
const a5 = el.getAttribute?.("fill");
|
|
2330
|
+
if (a5 !== null && a5 !== void 0 && String(a5).trim() !== "") return String(a5).trim();
|
|
2331
|
+
const c4 = cs?.fill;
|
|
2332
|
+
return c4 === null || c4 === void 0 ? "" : String(c4).trim();
|
|
2333
|
+
}
|
|
2334
|
+
function toRgb(raw) {
|
|
2335
|
+
const s4 = raw.trim().toLowerCase();
|
|
2336
|
+
if (!s4 || s4 === "none" || s4 === "transparent") return null;
|
|
2337
|
+
const hex2 = /^#([0-9a-f]{3}|[0-9a-f]{6})$/.exec(s4);
|
|
2338
|
+
if (hex2) {
|
|
2339
|
+
const h3 = hex2[1];
|
|
2340
|
+
const full = h3.length === 3 ? h3[0] + h3[0] + h3[1] + h3[1] + h3[2] + h3[2] : h3;
|
|
2341
|
+
return [
|
|
2342
|
+
parseInt(full.slice(0, 2), 16),
|
|
2343
|
+
parseInt(full.slice(2, 4), 16),
|
|
2344
|
+
parseInt(full.slice(4, 6), 16)
|
|
2345
|
+
];
|
|
2346
|
+
}
|
|
2347
|
+
const m2 = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)\s*(?:[,/]\s*([\d.]+)\s*)?\)$/.exec(s4);
|
|
2348
|
+
if (!m2) return null;
|
|
2349
|
+
if (m2[4] !== void 0 && parseFloat(m2[4]) === 0) return null;
|
|
2350
|
+
return [Math.round(parseFloat(m2[1])), Math.round(parseFloat(m2[2])), Math.round(parseFloat(m2[3]))];
|
|
2351
|
+
}
|
|
2352
|
+
function cellKey(rgb) {
|
|
2353
|
+
return [
|
|
2354
|
+
Math.round(rgb[0] / CELL_STEP),
|
|
2355
|
+
Math.round(rgb[1] / CELL_STEP),
|
|
2356
|
+
Math.round(rgb[2] / CELL_STEP)
|
|
2357
|
+
].join(",");
|
|
2358
|
+
}
|
|
2359
|
+
function hex(rgb) {
|
|
2360
|
+
return "#" + rgb.map((v4) => Math.max(0, Math.min(255, v4)).toString(16).padStart(2, "0")).join("");
|
|
2361
|
+
}
|
|
2362
|
+
function censusColourSpread(container, doc) {
|
|
2363
|
+
if (!container || typeof container.querySelectorAll !== "function") return EMPTY3;
|
|
2364
|
+
try {
|
|
2365
|
+
const els = Array.from(
|
|
2366
|
+
container.querySelectorAll(`.${MARK_CLASS}, [${ROW_IDX_ATTR}]`)
|
|
2367
|
+
);
|
|
2368
|
+
if (els.length === 0 || els.length > ELEMENT_CAP3) return EMPTY3;
|
|
2369
|
+
const ownerDoc = doc ?? container.ownerDocument;
|
|
2370
|
+
const distinct = /* @__PURE__ */ new Set();
|
|
2371
|
+
const cells = /* @__PURE__ */ new Map();
|
|
2372
|
+
let marks = 0;
|
|
2373
|
+
for (const el of els) {
|
|
2374
|
+
const rgb = toRgb(fillOf(el, styleOf2(el, ownerDoc)));
|
|
2375
|
+
if (!rgb) continue;
|
|
2376
|
+
marks++;
|
|
2377
|
+
distinct.add(rgb.join(","));
|
|
2378
|
+
const k3 = cellKey(rgb);
|
|
2379
|
+
const cur = cells.get(k3);
|
|
2380
|
+
if (cur) cur.n++;
|
|
2381
|
+
else cells.set(k3, { rgb, n: 1 });
|
|
2382
|
+
}
|
|
2383
|
+
if (marks < MIN_MARKS || distinct.size < MIN_RAMP_FILLS) return EMPTY3;
|
|
2384
|
+
const top = [...cells.values()].sort((a5, b4) => b4.n - a5.n).slice(0, MAX_CELLS);
|
|
2385
|
+
const cs = top.map((c4) => Mt3(hex(c4.rgb)));
|
|
2386
|
+
if (cs.length < MIN_RAMP_FILLS) return EMPTY3;
|
|
2387
|
+
const d2 = cs.map(() => new Array(cs.length).fill(0));
|
|
2388
|
+
let span = 0, lo = 0, hi = 1;
|
|
2389
|
+
for (let i4 = 0; i4 < cs.length; i4++) {
|
|
2390
|
+
for (let j4 = i4 + 1; j4 < cs.length; j4++) {
|
|
2391
|
+
const v4 = cs[i4].deltaE(cs[j4], "CIE2000");
|
|
2392
|
+
d2[i4][j4] = v4;
|
|
2393
|
+
d2[j4][i4] = v4;
|
|
2394
|
+
if (v4 > span) {
|
|
2395
|
+
span = v4;
|
|
2396
|
+
lo = i4;
|
|
2397
|
+
hi = j4;
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
if (span <= 0) return EMPTY3;
|
|
2402
|
+
let slack = 0, interior = 0;
|
|
2403
|
+
for (let i4 = 0; i4 < cs.length; i4++) {
|
|
2404
|
+
if (i4 === lo || i4 === hi) continue;
|
|
2405
|
+
slack += (d2[lo][i4] + d2[i4][hi]) / span - 1;
|
|
2406
|
+
interior++;
|
|
2407
|
+
}
|
|
2408
|
+
if (interior < 2 || slack / interior > RAMP_SLACK_MAX) return EMPTY3;
|
|
2409
|
+
let crowd = 0;
|
|
2410
|
+
for (let i4 = 0; i4 < cs.length; i4++) {
|
|
2411
|
+
let n2 = 0;
|
|
2412
|
+
for (let j4 = 0; j4 < cs.length; j4++) {
|
|
2413
|
+
if (i4 === j4 || d2[i4][j4] <= SAME_SHADE_DELTA_E) n2 += top[j4].n;
|
|
2414
|
+
}
|
|
2415
|
+
if (n2 > crowd) crowd = n2;
|
|
2416
|
+
}
|
|
2417
|
+
return {
|
|
2418
|
+
marks,
|
|
2419
|
+
distinctFills: distinct.size,
|
|
2420
|
+
crowdShare: Math.round(crowd / marks * 100),
|
|
2421
|
+
spanDeltaE: Math.round(span)
|
|
2422
|
+
};
|
|
2423
|
+
} catch {
|
|
2424
|
+
return EMPTY3;
|
|
2425
|
+
}
|
|
2426
|
+
}
|
|
2427
|
+
function colourSpreadFlag(c4) {
|
|
2428
|
+
if (c4.marks === 0) return "";
|
|
2429
|
+
return "ramp:d3:crowd" + Math.min(80, Math.floor(c4.crowdShare / 20) * 20);
|
|
1790
2430
|
}
|
|
1791
2431
|
|
|
1792
2432
|
// src/fit.ts
|
|
@@ -1798,16 +2438,16 @@ function needsScroll(contentPx, viewportPx, slackPx = SCROLL_SLACK_PX) {
|
|
|
1798
2438
|
}
|
|
1799
2439
|
function contentExtentOf(boxes) {
|
|
1800
2440
|
if (!boxes || boxes.length === 0) return { w: 0, h: 0, source: "none" };
|
|
1801
|
-
const usable = boxes.filter((
|
|
2441
|
+
const usable = boxes.filter((b4) => b4 && isFinite(b4.right) && isFinite(b4.bottom) && (b4.right > 0 || b4.bottom > 0));
|
|
1802
2442
|
if (usable.length === 0) return { w: 0, h: 0, source: "none" };
|
|
1803
|
-
const inFlow = usable.filter((
|
|
2443
|
+
const inFlow = usable.filter((b4) => !b4.floating);
|
|
1804
2444
|
const counted = inFlow.length > 0 ? inFlow : usable;
|
|
1805
|
-
let
|
|
1806
|
-
for (const
|
|
1807
|
-
if (
|
|
1808
|
-
if (
|
|
2445
|
+
let w3 = 0, h3 = 0;
|
|
2446
|
+
for (const b4 of counted) {
|
|
2447
|
+
if (b4.right > w3) w3 = b4.right;
|
|
2448
|
+
if (b4.bottom > h3) h3 = b4.bottom;
|
|
1809
2449
|
}
|
|
1810
|
-
return { w:
|
|
2450
|
+
return { w: w3, h: h3, source: inFlow.length > 0 ? "in-flow" : "all-floating" };
|
|
1811
2451
|
}
|
|
1812
2452
|
function scrollFitFor(contentW, contentH, viewportW, viewportH, slackPx = SCROLL_SLACK_PX) {
|
|
1813
2453
|
return {
|
|
@@ -1817,8 +2457,8 @@ function scrollFitFor(contentW, contentH, viewportW, viewportH, slackPx = SCROLL
|
|
|
1817
2457
|
}
|
|
1818
2458
|
var FIT_CONTENT_SELECTOR = "text, .d3-mark, .d3-legend-mark";
|
|
1819
2459
|
var PHANTOM_FRACTION = 0.95;
|
|
1820
|
-
function isPhantomBox(
|
|
1821
|
-
return
|
|
2460
|
+
function isPhantomBox(w3, h3, refW, refH) {
|
|
2461
|
+
return w3 > refW * PHANTOM_FRACTION || h3 > refH * PHANTOM_FRACTION;
|
|
1822
2462
|
}
|
|
1823
2463
|
var MAX_FRAME_GROW_FACTOR = 20;
|
|
1824
2464
|
function planFrameGrow(inkBottomPx, elHeightPx, viewBoxH, ctmScale, slackPx = SCROLL_SLACK_PX, maxFactor = MAX_FRAME_GROW_FACTOR) {
|
|
@@ -1839,8 +2479,8 @@ var AXIS_PIN_TRACK_REACH_PX = 12;
|
|
|
1839
2479
|
function isHorizontalLabelRow(boxes) {
|
|
1840
2480
|
if (!boxes || boxes.length < 2) return false;
|
|
1841
2481
|
let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
|
|
1842
|
-
for (const
|
|
1843
|
-
const cx = (
|
|
2482
|
+
for (const b4 of boxes) {
|
|
2483
|
+
const cx = (b4.left + b4.right) / 2, cy = (b4.top + b4.bottom) / 2;
|
|
1844
2484
|
if (!isFinite(cx) || !isFinite(cy)) return false;
|
|
1845
2485
|
if (cx < minX) minX = cx;
|
|
1846
2486
|
if (cx > maxX) maxX = cx;
|
|
@@ -1852,18 +2492,18 @@ function isHorizontalLabelRow(boxes) {
|
|
|
1852
2492
|
function labelBand(boxes, tracks = [], pad = AXIS_PIN_BAND_PAD_PX, trackReach = AXIS_PIN_TRACK_REACH_PX) {
|
|
1853
2493
|
if (!boxes || boxes.length === 0) return null;
|
|
1854
2494
|
let top = Infinity, bottom = -Infinity;
|
|
1855
|
-
for (const
|
|
1856
|
-
if (!isFinite(
|
|
1857
|
-
if (
|
|
1858
|
-
if (
|
|
2495
|
+
for (const b4 of boxes) {
|
|
2496
|
+
if (!isFinite(b4.top) || !isFinite(b4.bottom)) continue;
|
|
2497
|
+
if (b4.top < top) top = b4.top;
|
|
2498
|
+
if (b4.bottom > bottom) bottom = b4.bottom;
|
|
1859
2499
|
}
|
|
1860
2500
|
if (!isFinite(top) || !isFinite(bottom) || bottom <= top) return null;
|
|
1861
|
-
for (const
|
|
1862
|
-
if (!isFinite(
|
|
1863
|
-
const gap =
|
|
2501
|
+
for (const t2 of tracks || []) {
|
|
2502
|
+
if (!isFinite(t2.top) || !isFinite(t2.bottom)) continue;
|
|
2503
|
+
const gap = t2.bottom < top ? top - t2.bottom : t2.top > bottom ? t2.top - bottom : 0;
|
|
1864
2504
|
if (gap > trackReach) continue;
|
|
1865
|
-
if (
|
|
1866
|
-
if (
|
|
2505
|
+
if (t2.top < top) top = t2.top;
|
|
2506
|
+
if (t2.bottom > bottom) bottom = t2.bottom;
|
|
1867
2507
|
}
|
|
1868
2508
|
return { top: top - pad, bottom: bottom + pad };
|
|
1869
2509
|
}
|
|
@@ -1871,11 +2511,11 @@ function planAxisPin(candidates, viewportH, minLabels = AXIS_PIN_MIN_LABELS, max
|
|
|
1871
2511
|
const none = (reason) => ({ pin: false, index: -1, band: null, reason });
|
|
1872
2512
|
if (!isFinite(viewportH) || viewportH <= 0) return none("unmeasurable");
|
|
1873
2513
|
let sawAxis = false, best = null;
|
|
1874
|
-
for (const
|
|
1875
|
-
if (!
|
|
2514
|
+
for (const c4 of candidates || []) {
|
|
2515
|
+
if (!c4 || !c4.labels || c4.labels.length < minLabels) continue;
|
|
1876
2516
|
sawAxis = true;
|
|
1877
|
-
if (!isHorizontalLabelRow(
|
|
1878
|
-
if (!best ||
|
|
2517
|
+
if (!isHorizontalLabelRow(c4.labels)) continue;
|
|
2518
|
+
if (!best || c4.labels.length > best.labels.length) best = c4;
|
|
1879
2519
|
}
|
|
1880
2520
|
if (!best) return none(sawAxis ? "vertical-only" : "no-axis");
|
|
1881
2521
|
const band = labelBand(best.labels, best.tracks || []);
|
|
@@ -1893,10 +2533,10 @@ function axisPinPlacement(band, scrollTop, viewportH) {
|
|
|
1893
2533
|
|
|
1894
2534
|
// src/fitDom.ts
|
|
1895
2535
|
var FIT_WALK_CAP = 8e3;
|
|
1896
|
-
function ctmScaleOf(
|
|
1897
|
-
if (!
|
|
1898
|
-
const
|
|
1899
|
-
return isFinite(
|
|
2536
|
+
function ctmScaleOf(m2) {
|
|
2537
|
+
if (!m2) return 0;
|
|
2538
|
+
const s4 = Math.hypot(m2.a, m2.b);
|
|
2539
|
+
return isFinite(s4) && s4 > 0 ? s4 : 0;
|
|
1900
2540
|
}
|
|
1901
2541
|
function svgInkReach(svg) {
|
|
1902
2542
|
try {
|
|
@@ -1904,13 +2544,13 @@ function svgInkReach(svg) {
|
|
|
1904
2544
|
if (!(box.width > 0) || !(box.height > 0)) return null;
|
|
1905
2545
|
const els = svg.querySelectorAll(FIT_CONTENT_SELECTOR);
|
|
1906
2546
|
let right = -Infinity, bottom = -Infinity, seen = 0;
|
|
1907
|
-
for (let
|
|
1908
|
-
const
|
|
1909
|
-
if (
|
|
1910
|
-
if (isPhantomBox(
|
|
2547
|
+
for (let i4 = 0; i4 < els.length && seen < FIT_WALK_CAP; i4++) {
|
|
2548
|
+
const r2 = els[i4].getBoundingClientRect();
|
|
2549
|
+
if (r2.width <= 0 && r2.height <= 0) continue;
|
|
2550
|
+
if (isPhantomBox(r2.width, r2.height, box.width, box.height)) continue;
|
|
1911
2551
|
seen++;
|
|
1912
|
-
if (
|
|
1913
|
-
if (
|
|
2552
|
+
if (r2.right > right) right = r2.right;
|
|
2553
|
+
if (r2.bottom > bottom) bottom = r2.bottom;
|
|
1914
2554
|
}
|
|
1915
2555
|
if (seen === 0) return null;
|
|
1916
2556
|
return { right: right - box.left, bottom: bottom - box.top };
|
|
@@ -1918,13 +2558,13 @@ function svgInkReach(svg) {
|
|
|
1918
2558
|
return null;
|
|
1919
2559
|
}
|
|
1920
2560
|
}
|
|
1921
|
-
function measureContainerBoxes(
|
|
2561
|
+
function measureContainerBoxes(c4, inkOf) {
|
|
1922
2562
|
const boxes = [];
|
|
1923
|
-
if (!
|
|
1924
|
-
const view =
|
|
1925
|
-
const cRect =
|
|
1926
|
-
for (let
|
|
1927
|
-
const el =
|
|
2563
|
+
if (!c4 || !c4.children) return boxes;
|
|
2564
|
+
const view = c4.ownerDocument && c4.ownerDocument.defaultView || globalThis;
|
|
2565
|
+
const cRect = c4.getBoundingClientRect();
|
|
2566
|
+
for (let i4 = 0; i4 < c4.children.length; i4++) {
|
|
2567
|
+
const el = c4.children[i4];
|
|
1928
2568
|
let floating = false;
|
|
1929
2569
|
try {
|
|
1930
2570
|
const cs = view.getComputedStyle(el);
|
|
@@ -1932,15 +2572,15 @@ function measureContainerBoxes(c2, inkOf) {
|
|
|
1932
2572
|
floating = cs.position === "absolute" || cs.position === "fixed";
|
|
1933
2573
|
} catch {
|
|
1934
2574
|
}
|
|
1935
|
-
const
|
|
1936
|
-
let right =
|
|
1937
|
-
let bottom =
|
|
2575
|
+
const r2 = el.getBoundingClientRect();
|
|
2576
|
+
let right = r2.right - cRect.left - c4.clientLeft + c4.scrollLeft;
|
|
2577
|
+
let bottom = r2.bottom - cRect.top - c4.clientTop + c4.scrollTop;
|
|
1938
2578
|
if (inkOf) {
|
|
1939
2579
|
try {
|
|
1940
2580
|
const ink = inkOf(el);
|
|
1941
2581
|
if (ink) {
|
|
1942
|
-
const originX =
|
|
1943
|
-
const originY =
|
|
2582
|
+
const originX = r2.left - cRect.left - c4.clientLeft + c4.scrollLeft;
|
|
2583
|
+
const originY = r2.top - cRect.top - c4.clientTop + c4.scrollTop;
|
|
1944
2584
|
if (isFinite(ink.right)) right = Math.max(right, originX + ink.right);
|
|
1945
2585
|
if (isFinite(ink.bottom)) bottom = Math.max(bottom, originY + ink.bottom);
|
|
1946
2586
|
}
|
|
@@ -1951,14 +2591,14 @@ function measureContainerBoxes(c2, inkOf) {
|
|
|
1951
2591
|
}
|
|
1952
2592
|
return boxes;
|
|
1953
2593
|
}
|
|
1954
|
-
function fitReadingFor(lane,
|
|
1955
|
-
if (!
|
|
1956
|
-
const viewW =
|
|
2594
|
+
function fitReadingFor(lane, c4, slackPx = SCROLL_SLACK_PX, inkOf) {
|
|
2595
|
+
if (!c4) return null;
|
|
2596
|
+
const viewW = c4.clientWidth, viewH = c4.clientHeight;
|
|
1957
2597
|
if (!(viewW > 0) || !(viewH > 0)) return null;
|
|
1958
|
-
const boxes = measureContainerBoxes(
|
|
2598
|
+
const boxes = measureContainerBoxes(c4, inkOf);
|
|
1959
2599
|
const extent = contentExtentOf(boxes);
|
|
1960
|
-
const contentW = extent.source === "none" ?
|
|
1961
|
-
const contentH = extent.source === "none" ?
|
|
2600
|
+
const contentW = extent.source === "none" ? c4.scrollWidth : extent.w;
|
|
2601
|
+
const contentH = extent.source === "none" ? c4.scrollHeight : extent.h;
|
|
1962
2602
|
if (!isFinite(contentW) || !isFinite(contentH)) return null;
|
|
1963
2603
|
return {
|
|
1964
2604
|
lane,
|
|
@@ -1970,9 +2610,9 @@ function fitReadingFor(lane, c2, slackPx = SCROLL_SLACK_PX, inkOf) {
|
|
|
1970
2610
|
overflowsY: needsScroll(contentH, viewH, slackPx),
|
|
1971
2611
|
extentSource: extent.source,
|
|
1972
2612
|
boxes: boxes.length,
|
|
1973
|
-
floating: boxes.filter((
|
|
1974
|
-
scrollW:
|
|
1975
|
-
scrollH:
|
|
2613
|
+
floating: boxes.filter((b4) => b4.floating).length,
|
|
2614
|
+
scrollW: c4.scrollWidth,
|
|
2615
|
+
scrollH: c4.scrollHeight
|
|
1976
2616
|
};
|
|
1977
2617
|
}
|
|
1978
2618
|
var noPin = (reason) => ({ pinned: false, reason, bandPx: 0, axisAt: "", labels: 0, carried: 0, edge: null });
|
|
@@ -1981,14 +2621,14 @@ var SVG_NS2 = "http://www.w3.org/2000/svg";
|
|
|
1981
2621
|
var AXIS_PIN_MAX_CARRIED = 12;
|
|
1982
2622
|
function unpinScrolledAxis(container) {
|
|
1983
2623
|
if (!container) return;
|
|
1984
|
-
const
|
|
1985
|
-
if (!
|
|
2624
|
+
const st2 = container[CONTAINER_SLOT_AXIS_PIN];
|
|
2625
|
+
if (!st2) return;
|
|
1986
2626
|
try {
|
|
1987
|
-
container.removeEventListener("scroll",
|
|
2627
|
+
container.removeEventListener("scroll", st2.onScroll);
|
|
1988
2628
|
} catch {
|
|
1989
2629
|
}
|
|
1990
2630
|
try {
|
|
1991
|
-
if (
|
|
2631
|
+
if (st2.overlay.parentNode) st2.overlay.parentNode.removeChild(st2.overlay);
|
|
1992
2632
|
} catch {
|
|
1993
2633
|
}
|
|
1994
2634
|
try {
|
|
@@ -1996,10 +2636,10 @@ function unpinScrolledAxis(container) {
|
|
|
1996
2636
|
} catch {
|
|
1997
2637
|
}
|
|
1998
2638
|
}
|
|
1999
|
-
function textHidden(
|
|
2000
|
-
if (
|
|
2639
|
+
function textHidden(t2, view) {
|
|
2640
|
+
if (t2.getAttribute("display") === "none" || t2.getAttribute("visibility") === "hidden") return true;
|
|
2001
2641
|
try {
|
|
2002
|
-
const cs = view.getComputedStyle(
|
|
2642
|
+
const cs = view.getComputedStyle(t2);
|
|
2003
2643
|
if (cs && (cs.display === "none" || cs.visibility === "hidden")) return true;
|
|
2004
2644
|
} catch {
|
|
2005
2645
|
}
|
|
@@ -2008,17 +2648,17 @@ function textHidden(t, view) {
|
|
|
2008
2648
|
function backdropFill(svg, container, view, svgBox) {
|
|
2009
2649
|
try {
|
|
2010
2650
|
const rects = svg.querySelectorAll("rect");
|
|
2011
|
-
for (let
|
|
2012
|
-
const
|
|
2013
|
-
if (
|
|
2014
|
-
const
|
|
2015
|
-
if (
|
|
2651
|
+
for (let i4 = 0; i4 < rects.length && i4 < 6; i4++) {
|
|
2652
|
+
const r2 = rects[i4];
|
|
2653
|
+
if (r2.closest(".d3-mark")) continue;
|
|
2654
|
+
const b4 = r2.getBoundingClientRect();
|
|
2655
|
+
if (b4.width >= svgBox.width * 0.9 && b4.height >= svgBox.height * 0.9) {
|
|
2016
2656
|
let fill = "";
|
|
2017
2657
|
try {
|
|
2018
|
-
fill = view.getComputedStyle(
|
|
2658
|
+
fill = view.getComputedStyle(r2).fill || "";
|
|
2019
2659
|
} catch {
|
|
2020
2660
|
}
|
|
2021
|
-
if (!fill || fill === "none") fill =
|
|
2661
|
+
if (!fill || fill === "none") fill = r2.getAttribute("fill") || "";
|
|
2022
2662
|
if (fill && fill !== "none" && fill !== "transparent") return fill;
|
|
2023
2663
|
break;
|
|
2024
2664
|
}
|
|
@@ -2037,20 +2677,20 @@ function backdropFill(svg, container, view, svgBox) {
|
|
|
2037
2677
|
}
|
|
2038
2678
|
function cloneWithChain(el, svg, root) {
|
|
2039
2679
|
const chain = [];
|
|
2040
|
-
let
|
|
2041
|
-
while (
|
|
2042
|
-
chain.unshift(
|
|
2043
|
-
|
|
2680
|
+
let n2 = el.parentElement;
|
|
2681
|
+
while (n2 && n2 !== svg) {
|
|
2682
|
+
chain.unshift(n2);
|
|
2683
|
+
n2 = n2.parentElement;
|
|
2044
2684
|
}
|
|
2045
2685
|
let parent = root;
|
|
2046
2686
|
for (const anc of chain) {
|
|
2047
|
-
const
|
|
2048
|
-
parent.appendChild(
|
|
2049
|
-
parent =
|
|
2687
|
+
const c4 = anc.cloneNode(false);
|
|
2688
|
+
parent.appendChild(c4);
|
|
2689
|
+
parent = c4;
|
|
2050
2690
|
}
|
|
2051
2691
|
parent.appendChild(el.cloneNode(true));
|
|
2052
2692
|
const ids = root.querySelectorAll("[id]");
|
|
2053
|
-
for (let
|
|
2693
|
+
for (let i4 = 0; i4 < ids.length; i4++) ids[i4].removeAttribute("id");
|
|
2054
2694
|
}
|
|
2055
2695
|
function pinScrolledAxis(container, svg) {
|
|
2056
2696
|
unpinScrolledAxis(container);
|
|
@@ -2061,21 +2701,21 @@ function pinScrolledAxis(container, svg) {
|
|
|
2061
2701
|
const view = doc && doc.defaultView || globalThis;
|
|
2062
2702
|
const svgBox = svg.getBoundingClientRect();
|
|
2063
2703
|
if (!(svgBox.width > 0) || !(svgBox.height > 0)) return noPin("unmeasurable");
|
|
2064
|
-
const
|
|
2065
|
-
if (!
|
|
2704
|
+
const m2 = typeof svg.getScreenCTM === "function" ? svg.getScreenCTM() : null;
|
|
2705
|
+
if (!m2 || !(m2.a > 0) || !(m2.d > 0) || !isFinite(m2.e) || !isFinite(m2.f)) return noPin("no-ctm");
|
|
2066
2706
|
const viewportH = container.clientHeight;
|
|
2067
2707
|
if (!(viewportH > 0)) return noPin("unmeasurable");
|
|
2068
|
-
const rel = (
|
|
2708
|
+
const rel = (r2) => ({ left: r2.left - svgBox.left, top: r2.top - svgBox.top, right: r2.right - svgBox.left, bottom: r2.bottom - svgBox.top });
|
|
2069
2709
|
const ticks = svg.querySelectorAll(".tick");
|
|
2070
2710
|
const byAxis = /* @__PURE__ */ new Map();
|
|
2071
|
-
for (let
|
|
2072
|
-
const
|
|
2073
|
-
if (
|
|
2074
|
-
const
|
|
2075
|
-
if (!
|
|
2076
|
-
const list = byAxis.get(
|
|
2077
|
-
if (list) list.push(
|
|
2078
|
-
else byAxis.set(
|
|
2711
|
+
for (let i4 = 0; i4 < ticks.length; i4++) {
|
|
2712
|
+
const t2 = ticks[i4];
|
|
2713
|
+
if (t2.closest("svg") !== svg) continue;
|
|
2714
|
+
const p4 = t2.parentElement;
|
|
2715
|
+
if (!p4) continue;
|
|
2716
|
+
const list = byAxis.get(p4);
|
|
2717
|
+
if (list) list.push(t2);
|
|
2718
|
+
else byAxis.set(p4, [t2]);
|
|
2079
2719
|
}
|
|
2080
2720
|
const axes = [];
|
|
2081
2721
|
const cands = [];
|
|
@@ -2084,16 +2724,16 @@ function pinScrolledAxis(container, svg) {
|
|
|
2084
2724
|
for (const tick of group) {
|
|
2085
2725
|
const txt = tick.querySelector("text");
|
|
2086
2726
|
if (!txt || textHidden(txt, view)) continue;
|
|
2087
|
-
const
|
|
2088
|
-
if (!(
|
|
2089
|
-
labels.push(rel(
|
|
2727
|
+
const r2 = txt.getBoundingClientRect();
|
|
2728
|
+
if (!(r2.width > 0) || !(r2.height > 0)) continue;
|
|
2729
|
+
labels.push(rel(r2));
|
|
2090
2730
|
}
|
|
2091
2731
|
const tracks = [];
|
|
2092
|
-
for (let
|
|
2093
|
-
const ch = axis2.children[
|
|
2732
|
+
for (let i4 = 0; i4 < axis2.children.length; i4++) {
|
|
2733
|
+
const ch = axis2.children[i4];
|
|
2094
2734
|
if (ch.tagName.toLowerCase() !== "path" || !(ch.getAttribute("class") || "").split(/\s+/).includes("domain")) continue;
|
|
2095
|
-
const
|
|
2096
|
-
if (
|
|
2735
|
+
const r2 = ch.getBoundingClientRect();
|
|
2736
|
+
if (r2.width > 0 && r2.height <= 4) tracks.push(rel(r2));
|
|
2097
2737
|
}
|
|
2098
2738
|
cands.push({ index: axes.length, labels, tracks });
|
|
2099
2739
|
axes.push(axis2);
|
|
@@ -2106,24 +2746,24 @@ function pinScrolledAxis(container, svg) {
|
|
|
2106
2746
|
if (!(bandPx > 0)) return noPin("unmeasurable");
|
|
2107
2747
|
const carried = [];
|
|
2108
2748
|
const texts = svg.querySelectorAll("text");
|
|
2109
|
-
for (let
|
|
2110
|
-
const
|
|
2111
|
-
if (
|
|
2112
|
-
if (
|
|
2113
|
-
if (axis.contains(
|
|
2114
|
-
const
|
|
2115
|
-
if (!(
|
|
2116
|
-
if (
|
|
2749
|
+
for (let i4 = 0; i4 < texts.length && carried.length < AXIS_PIN_MAX_CARRIED; i4++) {
|
|
2750
|
+
const t2 = texts[i4];
|
|
2751
|
+
if (t2.closest("svg") !== svg) continue;
|
|
2752
|
+
if (t2.closest(".tick") || t2.closest(".d3-mark") || t2.closest(".d3-legend-mark")) continue;
|
|
2753
|
+
if (axis.contains(t2) || textHidden(t2, view)) continue;
|
|
2754
|
+
const r2 = rel(t2.getBoundingClientRect());
|
|
2755
|
+
if (!(r2.right > r2.left) || !(r2.bottom > r2.top)) continue;
|
|
2756
|
+
if (r2.top >= band.top && r2.bottom <= band.bottom) carried.push(t2);
|
|
2117
2757
|
}
|
|
2118
2758
|
const pinSvg = doc.createElementNS(SVG_NS2, "svg");
|
|
2119
|
-
for (const
|
|
2120
|
-
const
|
|
2121
|
-
if (
|
|
2759
|
+
for (const a5 of ["font-family", "font-size", "font-weight", "font", "fill", "color", "text-rendering"]) {
|
|
2760
|
+
const v4 = svg.getAttribute(a5);
|
|
2761
|
+
if (v4) pinSvg.setAttribute(a5, v4);
|
|
2122
2762
|
}
|
|
2123
2763
|
const styles = svg.querySelectorAll("style");
|
|
2124
|
-
for (let
|
|
2125
|
-
const vbX = (svgBox.left -
|
|
2126
|
-
const vbW = svgBox.width /
|
|
2764
|
+
for (let i4 = 0; i4 < styles.length; i4++) pinSvg.appendChild(styles[i4].cloneNode(true));
|
|
2765
|
+
const vbX = (svgBox.left - m2.e) / m2.a, vbY = (svgBox.top + band.top - m2.f) / m2.d;
|
|
2766
|
+
const vbW = svgBox.width / m2.a, vbH = bandPx / m2.d;
|
|
2127
2767
|
pinSvg.setAttribute("viewBox", `${vbX} ${vbY} ${vbW} ${vbH}`);
|
|
2128
2768
|
pinSvg.setAttribute("preserveAspectRatio", "none");
|
|
2129
2769
|
pinSvg.setAttribute("width", String(svgBox.width));
|
|
@@ -2139,20 +2779,20 @@ function pinScrolledAxis(container, svg) {
|
|
|
2139
2779
|
back.setAttribute("fill", backdropFill(svg, container, view, svgBox));
|
|
2140
2780
|
pinSvg.appendChild(back);
|
|
2141
2781
|
cloneWithChain(axis, svg, pinSvg);
|
|
2142
|
-
for (const
|
|
2782
|
+
for (const t2 of carried) cloneWithChain(t2, svg, pinSvg);
|
|
2143
2783
|
const overlay = doc.createElement("div");
|
|
2144
2784
|
overlay.setAttribute("data-bic-axis-pin", "1");
|
|
2145
|
-
const
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2785
|
+
const o2 = overlay.style;
|
|
2786
|
+
o2.position = "absolute";
|
|
2787
|
+
o2.margin = "0";
|
|
2788
|
+
o2.padding = "0";
|
|
2789
|
+
o2.border = "0";
|
|
2790
|
+
o2.width = `${svgBox.width}px`;
|
|
2791
|
+
o2.height = `${bandPx}px`;
|
|
2792
|
+
o2.overflow = "hidden";
|
|
2793
|
+
o2.pointerEvents = "none";
|
|
2794
|
+
o2.zIndex = "3";
|
|
2795
|
+
o2.display = "none";
|
|
2156
2796
|
overlay.appendChild(pinSvg);
|
|
2157
2797
|
try {
|
|
2158
2798
|
const cs = view.getComputedStyle(container);
|
|
@@ -2166,15 +2806,15 @@ function pinScrolledAxis(container, svg) {
|
|
|
2166
2806
|
const svgTop = svgBox.top - cRect.top - container.clientTop + container.scrollTop;
|
|
2167
2807
|
const contentBand = { top: svgTop + band.top, bottom: svgTop + band.bottom };
|
|
2168
2808
|
const place = () => {
|
|
2169
|
-
const
|
|
2170
|
-
const edge2 = axisPinPlacement(contentBand,
|
|
2809
|
+
const st2 = container.scrollTop, vh = container.clientHeight;
|
|
2810
|
+
const edge2 = axisPinPlacement(contentBand, st2, vh);
|
|
2171
2811
|
if (!edge2) {
|
|
2172
|
-
|
|
2812
|
+
o2.display = "none";
|
|
2173
2813
|
return null;
|
|
2174
2814
|
}
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2815
|
+
o2.display = "block";
|
|
2816
|
+
o2.left = `${svgLeft}px`;
|
|
2817
|
+
o2.top = `${edge2 === "top" ? st2 : st2 + vh - bandPx}px`;
|
|
2178
2818
|
return edge2;
|
|
2179
2819
|
};
|
|
2180
2820
|
const onScroll = () => {
|
|
@@ -2221,8 +2861,8 @@ function fitRenderedChart(container, opts = {}) {
|
|
|
2221
2861
|
if (!container) return result;
|
|
2222
2862
|
try {
|
|
2223
2863
|
let svg = null;
|
|
2224
|
-
for (let
|
|
2225
|
-
const el = container.children[
|
|
2864
|
+
for (let i4 = 0; i4 < container.children.length && !svg; i4++) {
|
|
2865
|
+
const el = container.children[i4];
|
|
2226
2866
|
if (el.tagName && el.tagName.toLowerCase() === "svg") svg = el;
|
|
2227
2867
|
}
|
|
2228
2868
|
if (!svg) svg = container.querySelector("svg");
|
|
@@ -2251,8 +2891,8 @@ function fitRenderedChart(container, opts = {}) {
|
|
|
2251
2891
|
if (plan.grow) {
|
|
2252
2892
|
svg.setAttribute("height", String(plan.heightPx));
|
|
2253
2893
|
if (vb > 0) {
|
|
2254
|
-
const
|
|
2255
|
-
svg.setAttribute("viewBox", `${
|
|
2894
|
+
const b4 = svg.viewBox.baseVal;
|
|
2895
|
+
svg.setAttribute("viewBox", `${b4.x} ${b4.y} ${b4.width} ${plan.viewBoxH}`);
|
|
2256
2896
|
}
|
|
2257
2897
|
result.grew = true;
|
|
2258
2898
|
}
|
|
@@ -2294,15 +2934,15 @@ function fitRenderedChart(container, opts = {}) {
|
|
|
2294
2934
|
}
|
|
2295
2935
|
|
|
2296
2936
|
// src/labelContrast.ts
|
|
2297
|
-
function parseRGBA(
|
|
2298
|
-
if (typeof
|
|
2299
|
-
const
|
|
2300
|
-
const
|
|
2301
|
-
if (
|
|
2302
|
-
let
|
|
2303
|
-
if (
|
|
2304
|
-
if (
|
|
2305
|
-
return [parseInt(
|
|
2937
|
+
function parseRGBA(c4) {
|
|
2938
|
+
if (typeof c4 !== "string") return null;
|
|
2939
|
+
const s4 = c4.trim();
|
|
2940
|
+
const m2 = s4.match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*(?:,\s*([\d.]+)\s*)?\)$/i);
|
|
2941
|
+
if (m2) return [parseFloat(m2[1]), parseFloat(m2[2]), parseFloat(m2[3]), m2[4] !== void 0 ? parseFloat(m2[4]) : 1];
|
|
2942
|
+
let h3 = s4.replace(/^#/, "");
|
|
2943
|
+
if (h3.length === 3) h3 = h3.split("").map((ch) => ch + ch).join("");
|
|
2944
|
+
if (h3.length === 6 && /^[0-9a-fA-F]{6}$/.test(h3)) {
|
|
2945
|
+
return [parseInt(h3.slice(0, 2), 16), parseInt(h3.slice(2, 4), 16), parseInt(h3.slice(4, 6), 16), 1];
|
|
2306
2946
|
}
|
|
2307
2947
|
return null;
|
|
2308
2948
|
}
|
|
@@ -2313,8 +2953,8 @@ var WHITE_TEXT_BG_LUM = 0.5;
|
|
|
2313
2953
|
var PILL_MIN_ALPHA = 0.05;
|
|
2314
2954
|
var PILL_OPAQUE_ALPHA = 0.85;
|
|
2315
2955
|
var PAGE_MATCH_TOLERANCE = 2;
|
|
2316
|
-
function isPillBackdropAlpha(
|
|
2317
|
-
return
|
|
2956
|
+
function isPillBackdropAlpha(a5) {
|
|
2957
|
+
return a5 >= PILL_MIN_ALPHA && a5 < PILL_OPAQUE_ALPHA;
|
|
2318
2958
|
}
|
|
2319
2959
|
var PILL_MIN_COVERAGE = 0.6;
|
|
2320
2960
|
function pillBacksGlyph(overlapArea, glyphArea) {
|
|
@@ -2335,30 +2975,30 @@ var NAMED = {
|
|
|
2335
2975
|
none: [0, 0, 0, 0],
|
|
2336
2976
|
transparent: [0, 0, 0, 0]
|
|
2337
2977
|
};
|
|
2338
|
-
function toRGBA(
|
|
2339
|
-
if (typeof
|
|
2340
|
-
const
|
|
2341
|
-
if (
|
|
2342
|
-
return parseRGBA(
|
|
2978
|
+
function toRGBA(c4) {
|
|
2979
|
+
if (typeof c4 !== "string") return null;
|
|
2980
|
+
const k3 = c4.trim().toLowerCase();
|
|
2981
|
+
if (k3 in NAMED) return NAMED[k3];
|
|
2982
|
+
return parseRGBA(c4);
|
|
2343
2983
|
}
|
|
2344
2984
|
function compositeOver(fg, bg) {
|
|
2345
|
-
const
|
|
2985
|
+
const a5 = Math.max(0, Math.min(1, fg[3]));
|
|
2346
2986
|
return [
|
|
2347
|
-
Math.round(fg[0] *
|
|
2348
|
-
Math.round(fg[1] *
|
|
2349
|
-
Math.round(fg[2] *
|
|
2987
|
+
Math.round(fg[0] * a5 + bg[0] * (1 - a5)),
|
|
2988
|
+
Math.round(fg[1] * a5 + bg[1] * (1 - a5)),
|
|
2989
|
+
Math.round(fg[2] * a5 + bg[2] * (1 - a5))
|
|
2350
2990
|
];
|
|
2351
2991
|
}
|
|
2352
2992
|
function relativeLuminance(rgb) {
|
|
2353
|
-
const lin = rgb.map((
|
|
2354
|
-
const
|
|
2355
|
-
return
|
|
2993
|
+
const lin = rgb.map((v4) => {
|
|
2994
|
+
const s4 = v4 / 255;
|
|
2995
|
+
return s4 <= 0.03928 ? s4 / 12.92 : Math.pow((s4 + 0.055) / 1.055, 2.4);
|
|
2356
2996
|
});
|
|
2357
2997
|
return 0.2126 * lin[0] + 0.7152 * lin[1] + 0.0722 * lin[2];
|
|
2358
2998
|
}
|
|
2359
|
-
function contrastRatio(l1,
|
|
2360
|
-
const hi = Math.max(l1,
|
|
2361
|
-
const lo = Math.min(l1,
|
|
2999
|
+
function contrastRatio(l1, l22) {
|
|
3000
|
+
const hi = Math.max(l1, l22);
|
|
3001
|
+
const lo = Math.min(l1, l22);
|
|
2362
3002
|
return (hi + 0.05) / (lo + 0.05);
|
|
2363
3003
|
}
|
|
2364
3004
|
function decideLabelColor(textColor, fill, fillOpacity, pageBg, minContrast = MIN_CONTRAST, normalize = false) {
|
|
@@ -2385,48 +3025,48 @@ function decideLabelColor(textColor, fill, fillOpacity, pageBg, minContrast = MI
|
|
|
2385
3025
|
return useLight ? { fix: true, color: LIGHT_TEXT, reason: "fixed-light" } : { fix: true, color: DARK_TEXT, reason: "fixed-dark" };
|
|
2386
3026
|
}
|
|
2387
3027
|
var GLYPH_SAMPLE_N = 3;
|
|
2388
|
-
function glyphSampleGrid(box,
|
|
3028
|
+
function glyphSampleGrid(box, n2 = GLYPH_SAMPLE_N) {
|
|
2389
3029
|
const out = [];
|
|
2390
|
-
if (!box || !(box.width > 0) || !(box.height > 0) || !(
|
|
2391
|
-
const
|
|
2392
|
-
for (let
|
|
2393
|
-
for (let
|
|
3030
|
+
if (!box || !(box.width > 0) || !(box.height > 0) || !(n2 >= 1)) return out;
|
|
3031
|
+
const k3 = Math.floor(n2);
|
|
3032
|
+
for (let i4 = 0; i4 < k3; i4++) {
|
|
3033
|
+
for (let j4 = 0; j4 < k3; j4++) {
|
|
2394
3034
|
out.push({
|
|
2395
|
-
x: box.left + box.width * (
|
|
2396
|
-
y: box.top + box.height * (
|
|
3035
|
+
x: box.left + box.width * (i4 + 0.5) / k3,
|
|
3036
|
+
y: box.top + box.height * (j4 + 0.5) / k3
|
|
2397
3037
|
});
|
|
2398
3038
|
}
|
|
2399
3039
|
}
|
|
2400
3040
|
return out;
|
|
2401
3041
|
}
|
|
2402
|
-
function clamp01(
|
|
2403
|
-
if (typeof
|
|
2404
|
-
return Math.max(0, Math.min(1,
|
|
3042
|
+
function clamp01(v4) {
|
|
3043
|
+
if (typeof v4 !== "number" || !isFinite(v4)) return 1;
|
|
3044
|
+
return Math.max(0, Math.min(1, v4));
|
|
2405
3045
|
}
|
|
2406
|
-
function hexToRGB(
|
|
2407
|
-
const
|
|
2408
|
-
return [
|
|
3046
|
+
function hexToRGB(hex2) {
|
|
3047
|
+
const p4 = toRGBA(hex2);
|
|
3048
|
+
return [p4[0], p4[1], p4[2]];
|
|
2409
3049
|
}
|
|
2410
3050
|
|
|
2411
3051
|
// src/labelContrastDom.ts
|
|
2412
3052
|
var LABEL_CONTRAST_DONE_ATTR = "data-lch-contrast";
|
|
2413
3053
|
var LABEL_CONTRAST_CAP = 2e3;
|
|
2414
|
-
var
|
|
3054
|
+
var EMPTY4 = { rects: 0, scanned: 0, fixed: 0, pillsBoosted: 0, offFill: 0, pageMajority: 0 };
|
|
2415
3055
|
function backedSamples(el, pts) {
|
|
2416
3056
|
try {
|
|
2417
3057
|
const ge2 = el;
|
|
2418
3058
|
if (typeof ge2.isPointInFill !== "function" || typeof ge2.getScreenCTM !== "function") return null;
|
|
2419
|
-
const
|
|
3059
|
+
const m2 = ge2.getScreenCTM();
|
|
2420
3060
|
const svg = ge2.ownerSVGElement;
|
|
2421
|
-
if (!
|
|
3061
|
+
if (!m2 || !svg || typeof svg.createSVGPoint !== "function") return null;
|
|
2422
3062
|
if (pts.length === 0) return null;
|
|
2423
|
-
const inv =
|
|
3063
|
+
const inv = m2.inverse();
|
|
2424
3064
|
const hit = [];
|
|
2425
|
-
for (let
|
|
2426
|
-
const
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
hit.push(ge2.isPointInFill(
|
|
3065
|
+
for (let i4 = 0; i4 < pts.length; i4++) {
|
|
3066
|
+
const p4 = svg.createSVGPoint();
|
|
3067
|
+
p4.x = pts[i4].x;
|
|
3068
|
+
p4.y = pts[i4].y;
|
|
3069
|
+
hit.push(ge2.isPointInFill(p4.matrixTransform(inv)));
|
|
2430
3070
|
}
|
|
2431
3071
|
return hit;
|
|
2432
3072
|
} catch {
|
|
@@ -2434,7 +3074,7 @@ function backedSamples(el, pts) {
|
|
|
2434
3074
|
}
|
|
2435
3075
|
}
|
|
2436
3076
|
function applyLabelContrast(container, opts = {}) {
|
|
2437
|
-
const report = { ...
|
|
3077
|
+
const report = { ...EMPTY4 };
|
|
2438
3078
|
if (!container) {
|
|
2439
3079
|
report.skipped = "no-container";
|
|
2440
3080
|
return report;
|
|
@@ -2447,8 +3087,8 @@ function applyLabelContrast(container, opts = {}) {
|
|
|
2447
3087
|
const pushShape = (el) => {
|
|
2448
3088
|
const tag = el.tagName.toLowerCase();
|
|
2449
3089
|
if (tag !== "rect" && tag !== "path") return;
|
|
2450
|
-
const
|
|
2451
|
-
if (
|
|
3090
|
+
const r2 = el.getBoundingClientRect();
|
|
3091
|
+
if (r2.width <= 0 || r2.height <= 0) return;
|
|
2452
3092
|
let fill = el.getAttribute("fill") || "";
|
|
2453
3093
|
const win2 = container.ownerDocument?.defaultView;
|
|
2454
3094
|
if ((!fill || fill === "none") && win2 && typeof win2.getComputedStyle === "function") {
|
|
@@ -2457,7 +3097,7 @@ function applyLabelContrast(container, opts = {}) {
|
|
|
2457
3097
|
if (!fill || fill === "none") return;
|
|
2458
3098
|
const opAttr = el.getAttribute("fill-opacity");
|
|
2459
3099
|
const op = opAttr === null ? 1 : parseFloat(opAttr);
|
|
2460
|
-
rects.push({ r, fill, op: isFinite(op) ? op : 1, area:
|
|
3100
|
+
rects.push({ r: r2, fill, op: isFinite(op) ? op : 1, area: r2.width * r2.height, el, ord: ord++ });
|
|
2461
3101
|
};
|
|
2462
3102
|
const shapeEls = container.querySelectorAll("rect, path");
|
|
2463
3103
|
if (shapeEls.length === 0) {
|
|
@@ -2468,7 +3108,7 @@ function applyLabelContrast(container, opts = {}) {
|
|
|
2468
3108
|
report.skipped = "too-many-shapes";
|
|
2469
3109
|
return report;
|
|
2470
3110
|
}
|
|
2471
|
-
for (let
|
|
3111
|
+
for (let i4 = 0; i4 < shapeEls.length; i4++) pushShape(shapeEls[i4]);
|
|
2472
3112
|
if (rects.length === 0) {
|
|
2473
3113
|
report.skipped = "no-shapes";
|
|
2474
3114
|
return report;
|
|
@@ -2477,8 +3117,8 @@ function applyLabelContrast(container, opts = {}) {
|
|
|
2477
3117
|
const pageRGBA = toRGBA(pageBg) || [255, 255, 255, 1];
|
|
2478
3118
|
const pageRGB = [pageRGBA[0], pageRGBA[1], pageRGBA[2]];
|
|
2479
3119
|
const effAlpha = (mk) => {
|
|
2480
|
-
const
|
|
2481
|
-
return (
|
|
3120
|
+
const c4 = toRGBA(mk.fill);
|
|
3121
|
+
return (c4 ? c4[3] : 1) * mk.op;
|
|
2482
3122
|
};
|
|
2483
3123
|
const texts = container.querySelectorAll("text");
|
|
2484
3124
|
if (texts.length > CAP) {
|
|
@@ -2486,47 +3126,47 @@ function applyLabelContrast(container, opts = {}) {
|
|
|
2486
3126
|
return report;
|
|
2487
3127
|
}
|
|
2488
3128
|
const win = container.ownerDocument?.defaultView;
|
|
2489
|
-
for (let
|
|
2490
|
-
const tx = texts[
|
|
3129
|
+
for (let t2 = 0; t2 < texts.length; t2++) {
|
|
3130
|
+
const tx = texts[t2];
|
|
2491
3131
|
if (tx.getAttribute(LABEL_CONTRAST_DONE_ATTR) === "1") continue;
|
|
2492
3132
|
const tr = tx.getBoundingClientRect();
|
|
2493
3133
|
if (tr.width <= 0 || tr.height <= 0) continue;
|
|
2494
|
-
const ovArea = (
|
|
3134
|
+
const ovArea = (r2) => Math.max(0, Math.min(r2.right, tr.right) - Math.max(r2.left, tr.left)) * Math.max(0, Math.min(r2.bottom, tr.bottom) - Math.max(r2.top, tr.top));
|
|
2495
3135
|
const glyphArea = tr.width * tr.height;
|
|
2496
|
-
const boxed = rects.map((mk) => ({ mk, ov: ovArea(mk.r) })).filter((
|
|
3136
|
+
const boxed = rects.map((mk) => ({ mk, ov: ovArea(mk.r) })).filter((x3) => x3.ov > 0);
|
|
2497
3137
|
const pts = glyphSampleGrid({ left: tr.left, top: tr.top, width: tr.width, height: tr.height });
|
|
2498
3138
|
const painted = pts.map(() => false);
|
|
2499
3139
|
let unmeasured = 0;
|
|
2500
|
-
const under = boxed.map((
|
|
2501
|
-
const mask = backedSamples(
|
|
3140
|
+
const under = boxed.map((x3) => {
|
|
3141
|
+
const mask = backedSamples(x3.mk.el, pts);
|
|
2502
3142
|
if (mask === null) {
|
|
2503
3143
|
unmeasured++;
|
|
2504
|
-
return
|
|
3144
|
+
return x3;
|
|
2505
3145
|
}
|
|
2506
3146
|
let inside = 0;
|
|
2507
|
-
const paints = effAlpha(
|
|
2508
|
-
for (let
|
|
2509
|
-
if (!mask[
|
|
3147
|
+
const paints = effAlpha(x3.mk) >= PILL_MIN_ALPHA;
|
|
3148
|
+
for (let i4 = 0; i4 < mask.length; i4++) {
|
|
3149
|
+
if (!mask[i4]) continue;
|
|
2510
3150
|
inside++;
|
|
2511
|
-
if (paints) painted[
|
|
3151
|
+
if (paints) painted[i4] = true;
|
|
2512
3152
|
}
|
|
2513
|
-
return { mk:
|
|
2514
|
-
}).filter((
|
|
3153
|
+
return { mk: x3.mk, ov: glyphArea * (inside / mask.length) };
|
|
3154
|
+
}).filter((x3) => x3.ov > 0);
|
|
2515
3155
|
if (under.length === 0 && boxed.length > 0) report.offFill++;
|
|
2516
3156
|
if (under.length === 0) continue;
|
|
2517
3157
|
if (unmeasured === 0 && pts.length > 0) {
|
|
2518
3158
|
let held = 0;
|
|
2519
|
-
for (let
|
|
3159
|
+
for (let i4 = 0; i4 < painted.length; i4++) if (painted[i4]) held++;
|
|
2520
3160
|
if (!backingHoldsGlyph(glyphArea * (held / pts.length), glyphArea)) {
|
|
2521
3161
|
report.pageMajority++;
|
|
2522
3162
|
continue;
|
|
2523
3163
|
}
|
|
2524
3164
|
}
|
|
2525
3165
|
report.scanned++;
|
|
2526
|
-
const opaqueUnder = under.filter((
|
|
2527
|
-
const cellEntry = (opaqueUnder.length ? opaqueUnder : under).reduce((
|
|
3166
|
+
const opaqueUnder = under.filter((x3) => effAlpha(x3.mk) >= PILL_OPAQUE_ALPHA);
|
|
3167
|
+
const cellEntry = (opaqueUnder.length ? opaqueUnder : under).reduce((a5, b4) => b4.ov > a5.ov || b4.ov === a5.ov && b4.mk.ord > a5.mk.ord ? b4 : a5);
|
|
2528
3168
|
const cell = cellEntry.mk;
|
|
2529
|
-
const pill = under.find((
|
|
3169
|
+
const pill = under.find((x3) => x3.mk !== cell && isPillBackdropAlpha(effAlpha(x3.mk)) && x3.mk.ord > cell.ord && pillBacksGlyph(x3.ov, glyphArea))?.mk;
|
|
2530
3170
|
const cellRGBA = toRGBA(cell.fill);
|
|
2531
3171
|
let bgRGB = cellRGBA ? compositeOver([cellRGBA[0], cellRGBA[1], cellRGBA[2], cellRGBA[3] * cell.op], pageRGB) : pageRGB;
|
|
2532
3172
|
if (pill) {
|
|
@@ -2540,12 +3180,12 @@ function applyLabelContrast(container, opts = {}) {
|
|
|
2540
3180
|
}
|
|
2541
3181
|
const cur = tx.getAttribute("fill") || (win && typeof win.getComputedStyle === "function" ? win.getComputedStyle(tx).fill : "");
|
|
2542
3182
|
const normalize = !cellSuppressesNormalize(cell.el.getAttribute("class"));
|
|
2543
|
-
const
|
|
2544
|
-
if (
|
|
2545
|
-
tx.setAttribute("fill",
|
|
3183
|
+
const d2 = decideLabelColor(cur, `rgb(${bgRGB[0]}, ${bgRGB[1]}, ${bgRGB[2]})`, 1, pageBg, MIN_CONTRAST, normalize);
|
|
3184
|
+
if (d2.fix) {
|
|
3185
|
+
tx.setAttribute("fill", d2.color);
|
|
2546
3186
|
report.fixed++;
|
|
2547
3187
|
}
|
|
2548
|
-
if (pill ||
|
|
3188
|
+
if (pill || d2.fix) tx.setAttribute(LABEL_CONTRAST_DONE_ATTR, "1");
|
|
2549
3189
|
}
|
|
2550
3190
|
return report;
|
|
2551
3191
|
} catch {
|
|
@@ -2563,7 +3203,7 @@ function sessionViewStateProvider(container) {
|
|
|
2563
3203
|
load: () => store,
|
|
2564
3204
|
save: (next) => {
|
|
2565
3205
|
if (!next || typeof next !== "object") return;
|
|
2566
|
-
for (const
|
|
3206
|
+
for (const k3 of Object.keys(store)) delete store[k3];
|
|
2567
3207
|
Object.assign(store, next);
|
|
2568
3208
|
}
|
|
2569
3209
|
};
|
|
@@ -2572,7 +3212,7 @@ function noopViewStateProvider() {
|
|
|
2572
3212
|
return { load: () => ({}), save: () => {
|
|
2573
3213
|
} };
|
|
2574
3214
|
}
|
|
2575
|
-
var parseRowIdxs = (
|
|
3215
|
+
var parseRowIdxs = (s4) => (s4 || "").split(",").map((x3) => parseInt(x3, 10)).filter((n2) => Number.isFinite(n2));
|
|
2576
3216
|
var D3_PLUGIN_PACKAGES = {
|
|
2577
3217
|
sankey: "d3-sankey",
|
|
2578
3218
|
sankeyLinkHorizontal: "d3-sankey",
|
|
@@ -2587,8 +3227,8 @@ var D3_PLUGIN_PACKAGES = {
|
|
|
2587
3227
|
};
|
|
2588
3228
|
function requiredD3Plugins(code) {
|
|
2589
3229
|
const out = /* @__PURE__ */ new Set();
|
|
2590
|
-
for (const
|
|
2591
|
-
const pkg = D3_PLUGIN_PACKAGES[
|
|
3230
|
+
for (const m2 of String(code || "").matchAll(/\bd3\s*\.\s*(\w+)\s*\(/g)) {
|
|
3231
|
+
const pkg = D3_PLUGIN_PACKAGES[m2[1]];
|
|
2592
3232
|
if (pkg) out.add(pkg);
|
|
2593
3233
|
}
|
|
2594
3234
|
return [...out].sort();
|
|
@@ -2600,8 +3240,8 @@ function explainRenderFailure(err, d3) {
|
|
|
2600
3240
|
"[@bicharts/chart-host] no d3 was provided, so the generated chart could not run. Pass it explicitly \u2014 createChartHost(el, { d3 }) / <BicChart d3={d3} /> \u2014 or set window.d3. The chart needs D3 v7 (npm install d3@7). Original error: " + msg
|
|
2601
3241
|
);
|
|
2602
3242
|
}
|
|
2603
|
-
const
|
|
2604
|
-
const name =
|
|
3243
|
+
const m2 = /d3\.(\w+) is not a function|(\w+) is not a function/.exec(msg);
|
|
3244
|
+
const name = m2?.[1] ?? m2?.[2] ?? "";
|
|
2605
3245
|
const pkg = D3_PLUGIN_PACKAGES[name];
|
|
2606
3246
|
if (pkg) {
|
|
2607
3247
|
return new Error(
|
|
@@ -2625,8 +3265,8 @@ function compileRenderFn(code, win, doc, d3) {
|
|
|
2625
3265
|
let factory;
|
|
2626
3266
|
try {
|
|
2627
3267
|
factory = new Function("container", "data", "options", "window", "document", "d3", body);
|
|
2628
|
-
} catch (
|
|
2629
|
-
const msg = String(
|
|
3268
|
+
} catch (e2) {
|
|
3269
|
+
const msg = String(e2?.message ?? e2 ?? "");
|
|
2630
3270
|
const modular = /\bimport\b|\bexport\b/.test(String(code || ""));
|
|
2631
3271
|
throw new Error(
|
|
2632
3272
|
"[@bicharts/chart-host] the generated code could not be COMPILED, so nothing was drawn. This path evaluates the chart as a code string, which cannot contain ES-module syntax" + (modular ? " \u2014 and this code still has `import`/`export` in it after the export clause was stripped. Either request the plain form from the generator, or `import` the module yourself and pass the render function directly." : ".") + " Original error: " + msg
|
|
@@ -2643,7 +3283,7 @@ function createChartHost(container, config) {
|
|
|
2643
3283
|
let data = config.data;
|
|
2644
3284
|
{
|
|
2645
3285
|
const stamped = config.data?.meta?.hostContract;
|
|
2646
|
-
const major = (
|
|
3286
|
+
const major = (v4) => (v4 || "").split(".")[0];
|
|
2647
3287
|
if (stamped && major(stamped) !== major(HOST_CONTRACT_VERSION)) {
|
|
2648
3288
|
try {
|
|
2649
3289
|
(win?.console ?? console)?.warn(
|
|
@@ -2665,10 +3305,10 @@ function createChartHost(container, config) {
|
|
|
2665
3305
|
if (raw.uiState && typeof raw.uiState === "object" && Object.keys(bag).length === 0)
|
|
2666
3306
|
Object.assign(bag, raw.uiState);
|
|
2667
3307
|
raw.uiState = bag;
|
|
2668
|
-
raw.setUiState = (
|
|
2669
|
-
if (!
|
|
3308
|
+
raw.setUiState = (s4) => {
|
|
3309
|
+
if (!s4 || typeof s4 !== "object") return;
|
|
2670
3310
|
try {
|
|
2671
|
-
provider.save(
|
|
3311
|
+
provider.save(s4);
|
|
2672
3312
|
} catch {
|
|
2673
3313
|
}
|
|
2674
3314
|
};
|
|
@@ -2685,9 +3325,9 @@ function createChartHost(container, config) {
|
|
|
2685
3325
|
const ensureAffordanceStyles = () => {
|
|
2686
3326
|
try {
|
|
2687
3327
|
if (!doc || doc.getElementById("bic-chart-host-affordances")) return;
|
|
2688
|
-
const
|
|
2689
|
-
|
|
2690
|
-
|
|
3328
|
+
const st2 = doc.createElement("style");
|
|
3329
|
+
st2.id = "bic-chart-host-affordances";
|
|
3330
|
+
st2.textContent = `
|
|
2691
3331
|
/* TYPOGRAPHY FIREWALL. Generated charts set font-size but almost never line-height or
|
|
2692
3332
|
letter-spacing, so they INHERIT whatever the host page cascades in. A page with
|
|
2693
3333
|
\`:root { font: 18px/145% }\` (the stock Vite template does exactly this) hands every
|
|
@@ -2736,7 +3376,7 @@ function createChartHost(container, config) {
|
|
|
2736
3376
|
font-weight: 700 !important;
|
|
2737
3377
|
text-decoration: underline !important;
|
|
2738
3378
|
}`;
|
|
2739
|
-
(doc.head || doc.documentElement)?.appendChild(
|
|
3379
|
+
(doc.head || doc.documentElement)?.appendChild(st2);
|
|
2740
3380
|
} catch {
|
|
2741
3381
|
}
|
|
2742
3382
|
};
|
|
@@ -2747,15 +3387,15 @@ function createChartHost(container, config) {
|
|
|
2747
3387
|
const dim = active && !selectionIsPeriod;
|
|
2748
3388
|
container.classList?.[dim ? "add" : "remove"](SELECTION_ACTIVE_CLASS);
|
|
2749
3389
|
const lit = container.querySelectorAll(`.${ACTIVE_TICK_CLASS}`);
|
|
2750
|
-
for (const
|
|
3390
|
+
for (const t2 of Array.from(lit)) t2.classList?.remove(ACTIVE_TICK_CLASS);
|
|
2751
3391
|
const tickStillDrawn = !!activeTickEl && (typeof container.contains === "function" ? container.contains(activeTickEl) : activeTickEl.isConnected !== false);
|
|
2752
3392
|
if (active && tickStillDrawn) activeTickEl.classList?.add(ACTIVE_TICK_CLASS);
|
|
2753
3393
|
const wanted = new Set(sel ?? []);
|
|
2754
3394
|
const marks = container.querySelectorAll(`.${MARK_CLASS}[${ROW_IDX_ATTR}], .${LEGEND_MARK_CLASS}[${ROW_IDX_ATTR}]`);
|
|
2755
|
-
for (const
|
|
2756
|
-
const rows = parseRowIdxs(
|
|
2757
|
-
const on = active && rows.some((
|
|
2758
|
-
|
|
3395
|
+
for (const m2 of Array.from(marks)) {
|
|
3396
|
+
const rows = parseRowIdxs(m2.getAttribute(ROW_IDX_ATTR));
|
|
3397
|
+
const on = active && rows.some((r2) => wanted.has(r2));
|
|
3398
|
+
m2.classList?.[on ? "add" : "remove"](MARK_SELECTED_CLASS);
|
|
2759
3399
|
}
|
|
2760
3400
|
} catch {
|
|
2761
3401
|
}
|
|
@@ -2774,11 +3414,11 @@ function createChartHost(container, config) {
|
|
|
2774
3414
|
};
|
|
2775
3415
|
let xfAt = 0;
|
|
2776
3416
|
const XF_ECHO_MS = 150;
|
|
2777
|
-
const onXf = (
|
|
2778
|
-
const
|
|
3417
|
+
const onXf = (e2) => {
|
|
3418
|
+
const d2 = e2?.detail || {};
|
|
2779
3419
|
xfAt = Date.now();
|
|
2780
|
-
if (
|
|
2781
|
-
else if (
|
|
3420
|
+
if (d2.clear) notify([], d2.source || "chart");
|
|
3421
|
+
else if (d2.mark) notify(parseRowIdxs(d2.mark.getAttribute?.(ROW_IDX_ATTR)), d2.source || "chart", d2.mark);
|
|
2782
3422
|
};
|
|
2783
3423
|
const resolver = createMarkResolver({
|
|
2784
3424
|
root: container,
|
|
@@ -2787,11 +3427,11 @@ function createChartHost(container, config) {
|
|
|
2787
3427
|
}
|
|
2788
3428
|
});
|
|
2789
3429
|
const clickSel = `.${MARK_CLASS}[${ROW_IDX_ATTR}], .${LEGEND_MARK_CLASS}[${ROW_IDX_ATTR}], .${AXIS_FILTER_CLASS}[${ROW_IDX_ATTR}]`;
|
|
2790
|
-
const onClick = (
|
|
3430
|
+
const onClick = (e2) => {
|
|
2791
3431
|
if (Date.now() - xfAt < XF_ECHO_MS) return;
|
|
2792
|
-
let el = resolver.findMark(
|
|
2793
|
-
if (!el) el = resolver.penetrateOverlayAt(
|
|
2794
|
-
if (!el) el = resolver.resolveByGeometry(
|
|
3432
|
+
let el = resolver.findMark(e2?.target, clickSel, e2);
|
|
3433
|
+
if (!el) el = resolver.penetrateOverlayAt(e2?.clientX, e2?.clientY, clickSel);
|
|
3434
|
+
if (!el) el = resolver.resolveByGeometry(e2?.clientX, e2?.clientY, clickSel);
|
|
2795
3435
|
if (!el) {
|
|
2796
3436
|
if (current && current.length) notify([], "user");
|
|
2797
3437
|
return;
|
|
@@ -2799,16 +3439,16 @@ function createChartHost(container, config) {
|
|
|
2799
3439
|
const rows = parseRowIdxs(el.getAttribute(ROW_IDX_ATTR));
|
|
2800
3440
|
if (!rows.length) return;
|
|
2801
3441
|
const tick = el.classList?.contains?.(AXIS_FILTER_CLASS) ? el : null;
|
|
2802
|
-
if (
|
|
3442
|
+
if (e2?.ctrlKey || e2?.metaKey || e2?.shiftKey) {
|
|
2803
3443
|
const next = new Set(current ?? []);
|
|
2804
|
-
for (const
|
|
2805
|
-
if (next.has(
|
|
2806
|
-
else next.add(
|
|
3444
|
+
for (const r2 of rows) {
|
|
3445
|
+
if (next.has(r2)) next.delete(r2);
|
|
3446
|
+
else next.add(r2);
|
|
2807
3447
|
}
|
|
2808
3448
|
notify(Array.from(next), "user", tick);
|
|
2809
3449
|
return;
|
|
2810
3450
|
}
|
|
2811
|
-
const same = !!current && current.length === rows.length && rows.every((
|
|
3451
|
+
const same = !!current && current.length === rows.length && rows.every((r2) => current.includes(r2));
|
|
2812
3452
|
notify(same ? [] : rows, "user", same ? null : tick);
|
|
2813
3453
|
};
|
|
2814
3454
|
container.addEventListener(XFILTER_REFRESH_EVENT, onXf);
|
|
@@ -2818,10 +3458,10 @@ function createChartHost(container, config) {
|
|
|
2818
3458
|
const fitOpts = config.fit ?? true;
|
|
2819
3459
|
const labelContrastOpts = config.labelContrast ?? true;
|
|
2820
3460
|
const stopAnim = () => {
|
|
2821
|
-
const
|
|
2822
|
-
if (typeof
|
|
3461
|
+
const s4 = container[CONTAINER_SLOT_ANIM_STOP];
|
|
3462
|
+
if (typeof s4 === "function") {
|
|
2823
3463
|
try {
|
|
2824
|
-
|
|
3464
|
+
s4();
|
|
2825
3465
|
} catch {
|
|
2826
3466
|
}
|
|
2827
3467
|
}
|
|
@@ -2836,8 +3476,8 @@ function createChartHost(container, config) {
|
|
|
2836
3476
|
renderFn = compileRenderFn(config.code, win, doc, d3);
|
|
2837
3477
|
}
|
|
2838
3478
|
if (resolved.geo === void 0 && config.geoKind) {
|
|
2839
|
-
const
|
|
2840
|
-
if (
|
|
3479
|
+
const g4 = config.geoProvider?.(config.geoKind) ?? geoFromCache(config.geoKind);
|
|
3480
|
+
if (g4) resolved = { ...resolved, geo: g4 };
|
|
2841
3481
|
else if (!warnedGeo) {
|
|
2842
3482
|
warnedGeo = true;
|
|
2843
3483
|
try {
|
|
@@ -2863,8 +3503,8 @@ function createChartHost(container, config) {
|
|
|
2863
3503
|
const bg = resolved.backgroundColor ?? resolved.themeBg;
|
|
2864
3504
|
if (typeof bg === "string" && bg) lc.pageBg = bg;
|
|
2865
3505
|
}
|
|
2866
|
-
const
|
|
2867
|
-
config.onLabelContrast?.(
|
|
3506
|
+
const r2 = applyLabelContrast(container, lc);
|
|
3507
|
+
config.onLabelContrast?.(r2);
|
|
2868
3508
|
} catch {
|
|
2869
3509
|
}
|
|
2870
3510
|
}
|
|
@@ -2897,10 +3537,16 @@ function createChartHost(container, config) {
|
|
|
2897
3537
|
} catch {
|
|
2898
3538
|
}
|
|
2899
3539
|
}
|
|
3540
|
+
if (config.onColourSpreadCensus) {
|
|
3541
|
+
try {
|
|
3542
|
+
config.onColourSpreadCensus(censusColourSpread(container, doc));
|
|
3543
|
+
} catch {
|
|
3544
|
+
}
|
|
3545
|
+
}
|
|
2900
3546
|
if (fitOpts !== false) {
|
|
2901
3547
|
try {
|
|
2902
|
-
const
|
|
2903
|
-
config.onFit?.(
|
|
3548
|
+
const r2 = fitRenderedChart(container, fitOpts === true ? {} : fitOpts);
|
|
3549
|
+
config.onFit?.(r2);
|
|
2904
3550
|
} catch {
|
|
2905
3551
|
}
|
|
2906
3552
|
}
|
|
@@ -2923,10 +3569,10 @@ function createChartHost(container, config) {
|
|
|
2923
3569
|
return () => subs.delete(cb);
|
|
2924
3570
|
},
|
|
2925
3571
|
clear() {
|
|
2926
|
-
const
|
|
2927
|
-
if (typeof
|
|
3572
|
+
const s4 = container[CONTAINER_SLOT_XF_CLEAR];
|
|
3573
|
+
if (typeof s4 === "function") {
|
|
2928
3574
|
try {
|
|
2929
|
-
|
|
3575
|
+
s4();
|
|
2930
3576
|
} catch {
|
|
2931
3577
|
}
|
|
2932
3578
|
}
|
|
@@ -3016,6 +3662,11 @@ export {
|
|
|
3016
3662
|
MIN_HIT_BAND_PX,
|
|
3017
3663
|
censusHitBands,
|
|
3018
3664
|
hitBandFlag,
|
|
3665
|
+
Mt3 as Mt,
|
|
3666
|
+
SAME_SHADE_DELTA_E,
|
|
3667
|
+
MIN_RAMP_FILLS,
|
|
3668
|
+
censusColourSpread,
|
|
3669
|
+
colourSpreadFlag,
|
|
3019
3670
|
SCROLL_SLACK_PX,
|
|
3020
3671
|
needsScroll,
|
|
3021
3672
|
contentExtentOf,
|