@bicharts/chart-host 0.5.90 → 0.5.92
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-GUCTCDEO.mjs → chunk-YIRWZUKN.mjs} +1241 -1693
- package/dist/index.mjs +824 -292
- package/dist/react.mjs +1 -1
- package/dist/types/deltaE.d.ts +24 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/summaryText.d.ts +7 -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
|
+
((e, t) => {
|
|
22
|
+
"function" == typeof define && define.amd ? define([], t) : "object" == typeof module && "undefined" != typeof exports ? module.exports = t() : e.Papa = t();
|
|
23
|
+
})(exports, function r() {
|
|
24
|
+
var n = "undefined" != typeof self ? self : "undefined" != typeof window ? window : void 0 !== n ? n : {};
|
|
25
|
+
var d, s2 = !n.document && !!n.postMessage, a4 = n.IS_PAPA_WORKER || false, o = {}, h2 = 0, v3 = {};
|
|
26
|
+
function P4(e) {
|
|
27
|
+
return 65279 === e.charCodeAt(0) ? e.slice(1) : e;
|
|
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 u4(e) {
|
|
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(e2) {
|
|
31
|
+
var t = b2(e2);
|
|
32
|
+
t.chunkSize = parseInt(t.chunkSize), e2.step || e2.chunk || (t.chunkSize = null);
|
|
33
|
+
this._handle = new i2(t), (this._handle.streamer = this)._config = t;
|
|
34
|
+
}.call(this, e), this.parseChunk = function(t, e2) {
|
|
35
|
+
var i4 = parseInt(this._config.skipFirstNLines) || 0;
|
|
36
|
+
if (this.isFirstChunk && 0 < i4) {
|
|
37
|
+
let e4 = this._config.newline;
|
|
38
|
+
e4 || (r2 = this._config.quoteChar || '"', e4 = this._handle.guessLineEndings(t, r2)), t = [...t.split(e4).slice(i4)].join(e4);
|
|
39
39
|
}
|
|
40
|
-
this.isFirstChunk &&
|
|
41
|
-
var
|
|
40
|
+
this.isFirstChunk && q3(this._config.beforeFirstChunk) && void 0 !== (r2 = this._config.beforeFirstChunk(t)) && (t = r2), this.isFirstChunk = false, this._halted = false;
|
|
41
|
+
var i4 = this._partialLine + t, r2 = (this._partialLine = "", this._handle.parse(i4, 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
|
+
t = r2.meta.cursor, i4 = (this._finished || (this._partialLine = i4.substring(t - this._baseIndex), this._baseIndex = t), r2 && r2.data && (this._rowCount += r2.data.length), this._finished || this._config.preview && this._rowCount >= this._config.preview);
|
|
44
|
+
if (a4) n.postMessage({ results: r2, workerId: v3.WORKER_ID, finished: i4 });
|
|
45
|
+
else if (q3(this._config.chunk) && !e2) {
|
|
46
|
+
if (this._config.chunk(r2, this._handle), this._handle.paused() || this._handle.aborted()) return void (this._halted = true);
|
|
47
|
+
this._completeResults = r2 = 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(r2.data), this._completeResults.errors = this._completeResults.errors.concat(r2.errors), this._completeResults.meta = r2.meta), this._completed || !i4 || !q3(this._config.complete) || r2 && r2.meta.aborted || (this._config.complete(this._completeResults, this._input), this._completed = true), i4 || r2 && r2.meta.paused || this._nextChunk(), r2;
|
|
50
50
|
}
|
|
51
51
|
this._halted = true;
|
|
52
|
-
}, this._sendError = function(
|
|
53
|
-
|
|
52
|
+
}, this._sendError = function(e2) {
|
|
53
|
+
q3(this._config.error) ? this._config.error(e2) : a4 && this._config.error && n.postMessage({ workerId: v3.WORKER_ID, error: e2, finished: false });
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
|
-
function f4(
|
|
57
|
-
var
|
|
58
|
-
(
|
|
56
|
+
function f4(e) {
|
|
57
|
+
var r2;
|
|
58
|
+
(e = e || {}).chunkSize || (e.chunkSize = v3.RemoteChunkSize), u4.call(this, e), this._nextChunk = s2 ? 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(e2) {
|
|
63
|
+
this._input = e2, 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 (r2 = new XMLHttpRequest(), this._config.withCredentials && (r2.withCredentials = this._config.withCredentials), s2 || (r2.onload = y4(this._chunkLoaded, this), r2.onerror = y4(this._chunkError, this)), r2.open(this._config.downloadRequestBody ? "POST" : "GET", this._input, !s2), this._config.downloadRequestHeaders) {
|
|
68
|
+
var e2, t = this._config.downloadRequestHeaders;
|
|
69
|
+
for (e2 in t) r2.setRequestHeader(e2, t[e2]);
|
|
70
70
|
}
|
|
71
|
-
var
|
|
72
|
-
this._config.chunkSize && (
|
|
71
|
+
var i4;
|
|
72
|
+
this._config.chunkSize && (i4 = this._start + this._config.chunkSize - 1, r2.setRequestHeader("Range", "bytes=" + this._start + "-" + i4));
|
|
73
73
|
try {
|
|
74
|
-
|
|
75
|
-
} catch (
|
|
76
|
-
this._chunkError(
|
|
74
|
+
r2.send(this._config.downloadRequestBody);
|
|
75
|
+
} catch (e4) {
|
|
76
|
+
this._chunkError(e4.message);
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
s2 && 0 === r2.status && this._chunkError();
|
|
79
79
|
}
|
|
80
80
|
}, this._chunkLoaded = function() {
|
|
81
|
-
4 ===
|
|
82
|
-
}, this._chunkError = function(
|
|
83
|
-
|
|
84
|
-
this._sendError(new Error(
|
|
81
|
+
4 === r2.readyState && (r2.status < 200 || 400 <= r2.status ? this._chunkError() : (this._start += this._config.chunkSize || r2.responseText.length, this._finished = !this._config.chunkSize || this._start >= ((e2) => null !== (e2 = e2.getResponseHeader("Content-Range")) ? parseInt(e2.substring(e2.lastIndexOf("/") + 1)) : -1)(r2), this.parseChunk(r2.responseText)));
|
|
82
|
+
}, this._chunkError = function(e2) {
|
|
83
|
+
e2 = r2.statusText || e2;
|
|
84
|
+
this._sendError(new Error(e2));
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
(
|
|
89
|
-
var
|
|
90
|
-
this.stream = function(
|
|
91
|
-
this._input =
|
|
87
|
+
function l2(e) {
|
|
88
|
+
(e = e || {}).chunkSize || (e.chunkSize = v3.LocalChunkSize), u4.call(this, e);
|
|
89
|
+
var i4, r2, n2 = "undefined" != typeof FileReader;
|
|
90
|
+
this.stream = function(e2) {
|
|
91
|
+
this._input = e2, r2 = e2.slice || e2.webkitSlice || e2.mozSlice, n2 ? ((i4 = new FileReader()).onload = y4(this._chunkLoaded, this), i4.onerror = y4(this._chunkError, this)) : i4 = 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 e2 = this._input, t = (this._config.chunkSize && (t = Math.min(this._start + this._config.chunkSize, this._input.size), e2 = r2.call(e2, this._start, t)), i4.readAsText(e2, this._config.encoding));
|
|
96
|
+
n2 || this._chunkLoaded({ target: { result: t } });
|
|
97
|
+
}, this._chunkLoaded = function(e2) {
|
|
98
|
+
this._start += this._config.chunkSize, this._finished = !this._config.chunkSize || this._start >= this._input.size, this.parseChunk(e2.target.result);
|
|
99
99
|
}, this._chunkError = function() {
|
|
100
|
-
this._sendError(
|
|
100
|
+
this._sendError(i4.error);
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
-
function
|
|
104
|
-
var
|
|
105
|
-
|
|
106
|
-
return
|
|
103
|
+
function c2(e) {
|
|
104
|
+
var i4;
|
|
105
|
+
u4.call(this, e = e || {}), this.stream = function(e2) {
|
|
106
|
+
return i4 = e2, this._nextChunk();
|
|
107
107
|
}, this._nextChunk = function() {
|
|
108
|
-
var
|
|
109
|
-
if (!this._finished) return
|
|
108
|
+
var e2, t;
|
|
109
|
+
if (!this._finished) return e2 = this._config.chunkSize, i4 = e2 ? (t = i4.substring(0, e2), i4.substring(e2)) : (t = i4, ""), this._finished = !i4, this.parseChunk(t);
|
|
110
110
|
};
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
|
|
114
|
-
var
|
|
112
|
+
function p2(e) {
|
|
113
|
+
u4.call(this, e = e || {});
|
|
114
|
+
var t = [], i4 = true, r2 = false;
|
|
115
115
|
this.pause = function() {
|
|
116
|
-
|
|
116
|
+
u4.prototype.pause.apply(this, arguments), this._input.pause();
|
|
117
117
|
}, this.resume = function() {
|
|
118
|
-
|
|
119
|
-
}, this.stream = function(
|
|
120
|
-
this._input =
|
|
118
|
+
u4.prototype.resume.apply(this, arguments), this._input.resume();
|
|
119
|
+
}, this.stream = function(e2) {
|
|
120
|
+
this._input = e2, 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
|
+
r2 && 1 === t.length && (this._finished = true);
|
|
123
123
|
}, this._nextChunk = function() {
|
|
124
|
-
this._checkIsFinished(),
|
|
125
|
-
}, this._streamData =
|
|
124
|
+
this._checkIsFinished(), t.length ? this.parseChunk(t.shift()) : i4 = true;
|
|
125
|
+
}, this._streamData = y4(function(e2) {
|
|
126
126
|
try {
|
|
127
|
-
|
|
128
|
-
} catch (
|
|
129
|
-
this._streamError(
|
|
127
|
+
t.push("string" == typeof e2 ? e2 : e2.toString(this._config.encoding)), i4 && (i4 = false, this._checkIsFinished(), this.parseChunk(t.shift()));
|
|
128
|
+
} catch (e4) {
|
|
129
|
+
this._streamError(e4);
|
|
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 = y4(function(e2) {
|
|
132
|
+
this._streamCleanUp(), this._sendError(e2);
|
|
133
|
+
}, this), this._streamEnd = y4(function() {
|
|
134
|
+
this._streamCleanUp(), r2 = true, this._streamData("");
|
|
135
|
+
}, this), this._streamCleanUp = y4(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 i2(m2) {
|
|
140
|
+
var n2, s4, a5, t, o2 = Math.pow(2, 53), h3 = -o2, u5 = /^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/, d2 = /^((\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)))$/, i4 = this, r2 = 0, f5 = 0, l3 = false, e = false, c4 = [], p4 = { data: [], errors: [], meta: {} };
|
|
141
|
+
function y5(e2) {
|
|
142
|
+
return "greedy" === m2.skipEmptyLines ? "" === e2.join("").trim() : 1 === e2.length && 0 === e2[0].length;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
145
|
-
if (
|
|
146
|
-
return !
|
|
147
|
-
})),
|
|
148
|
-
let
|
|
149
|
-
|
|
144
|
+
function g4() {
|
|
145
|
+
if (p4 && a5 && (k2("Delimiter", "UndetectableDelimiter", "Unable to auto-detect delimiting character; defaulted to '" + v3.DefaultDelimiter + "'"), a5 = false), m2.skipEmptyLines && (p4.data = p4.data.filter(function(e4) {
|
|
146
|
+
return !y5(e4);
|
|
147
|
+
})), _3()) {
|
|
148
|
+
let t4 = function(e4, t5) {
|
|
149
|
+
e4 = P4(e4), q3(m2.transformHeader) && (e4 = m2.transformHeader(e4, t5)), c4.push(e4);
|
|
150
150
|
};
|
|
151
|
-
var
|
|
152
|
-
if (
|
|
153
|
-
for (var
|
|
154
|
-
|
|
155
|
-
} else
|
|
151
|
+
var t2 = t4;
|
|
152
|
+
if (p4) if (Array.isArray(p4.data[0])) {
|
|
153
|
+
for (var e2 = 0; _3() && e2 < p4.data.length; e2++) p4.data[e2].forEach(t4);
|
|
154
|
+
p4.data.splice(0, 1);
|
|
155
|
+
} else p4.data.forEach(t4);
|
|
156
156
|
}
|
|
157
|
-
function
|
|
158
|
-
for (var
|
|
159
|
-
var
|
|
160
|
-
if (
|
|
161
|
-
|
|
162
|
-
if (
|
|
157
|
+
function i5(e4, t4) {
|
|
158
|
+
for (var i6 = m2.header ? {} : [], r5 = 0; r5 < e4.length; r5++) {
|
|
159
|
+
var n4 = r5, s5 = e4[r5], s5 = ((e5, t5) => ((e6) => (m2.dynamicTypingFunction && void 0 === m2.dynamicTyping[e6] && (m2.dynamicTyping[e6] = m2.dynamicTypingFunction(e6)), true === (m2.dynamicTyping[e6] || m2.dynamicTyping)))(e5) ? "true" === t5 || "TRUE" === t5 || "false" !== t5 && "FALSE" !== t5 && (((e6) => {
|
|
160
|
+
if (u5.test(e6)) {
|
|
161
|
+
e6 = parseFloat(e6);
|
|
162
|
+
if (h3 < e6 && e6 < o2) return 1;
|
|
163
163
|
}
|
|
164
|
-
})(
|
|
165
|
-
"__parsed_extra" ===
|
|
164
|
+
})(t5) ? parseFloat(t5) : d2.test(t5) ? new Date(t5) : "" === t5 ? null : t5) : t5)(n4 = m2.header ? r5 >= c4.length ? "__parsed_extra" : c4[r5] : n4, s5 = m2.transform ? m2.transform(s5, n4) : s5);
|
|
165
|
+
"__parsed_extra" === n4 ? (i6[n4] = i6[n4] || [], i6[n4].push(s5)) : i6[n4] = s5;
|
|
166
166
|
}
|
|
167
|
-
return
|
|
167
|
+
return m2.header && (r5 > c4.length ? k2("FieldMismatch", "TooManyFields", "Too many fields: expected " + c4.length + " fields but parsed " + r5, f5 + t4) : r5 < c4.length && k2("FieldMismatch", "TooFewFields", "Too few fields: expected " + c4.length + " fields but parsed " + r5, f5 + t4)), i6;
|
|
168
168
|
}
|
|
169
|
-
var
|
|
170
|
-
|
|
169
|
+
var r4;
|
|
170
|
+
p4 && (m2.header || m2.dynamicTyping || m2.transform) && (r4 = 1, !p4.data.length || Array.isArray(p4.data[0]) ? (p4.data = p4.data.map(i5), r4 = p4.data.length) : p4.data = i5(p4.data, 0), m2.header && p4.meta && (p4.meta.fields = c4), f5 += r4);
|
|
171
171
|
}
|
|
172
|
-
function
|
|
173
|
-
return
|
|
172
|
+
function _3() {
|
|
173
|
+
return m2.header && 0 === c4.length;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
|
|
177
|
-
void 0 !==
|
|
175
|
+
function k2(e2, t2, i5, r4) {
|
|
176
|
+
e2 = { type: e2, code: t2, message: i5 };
|
|
177
|
+
void 0 !== r4 && (e2.row = r4), p4.errors.push(e2);
|
|
178
178
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}), this.parse = function(
|
|
182
|
-
var
|
|
183
|
-
var
|
|
184
|
-
|
|
185
|
-
for (var
|
|
186
|
-
for (var
|
|
187
|
-
0 <
|
|
179
|
+
q3(m2.step) && (t = m2.step, m2.step = function(e2) {
|
|
180
|
+
p4 = e2, _3() ? g4() : (g4(), 0 !== p4.data.length && (r2 += e2.data.length, m2.preview && r2 > m2.preview ? s4.abort() : (p4.data = p4.data[0], t(p4, i4))));
|
|
181
|
+
}), this.parse = function(e2, t2, i5) {
|
|
182
|
+
var r4 = m2.quoteChar || '"', r4 = (m2.newline || (m2.newline = this.guessLineEndings(e2, r4)), a5 = false, m2.delimiter ? q3(m2.delimiter) && (m2.delimiter = m2.delimiter(e2), p4.meta.delimiter = m2.delimiter) : ((r4 = ((e4, t4, i6, r5, n4) => {
|
|
183
|
+
var s5, a6, o4, h4;
|
|
184
|
+
n4 = n4 || [",", " ", "|", ";", v3.RECORD_SEP, v3.UNIT_SEP];
|
|
185
|
+
for (var u6 = 0; u6 < n4.length; u6++) {
|
|
186
|
+
for (var d3, f6 = n4[u6], l4 = 0, c5 = 0, p5 = 0, g5 = (o4 = void 0, new E4({ comments: r5, delimiter: f6, newline: t4, preview: 10 }).parse(e4)), _4 = 0; _4 < g5.data.length; _4++) i6 && y5(g5.data[_4]) ? p5++ : (d3 = g5.data[_4].length, c5 += d3, void 0 === o4 ? o4 = d3 : 0 < d3 && (l4 += Math.abs(d3 - o4), o4 = d3));
|
|
187
|
+
0 < g5.data.length && (c5 /= g5.data.length - p5), (void 0 === a6 || l4 <= a6) && (void 0 === h4 || h4 < c5) && 1.99 < c5 && (a6 = l4, s5 = f6, h4 = c5);
|
|
188
188
|
}
|
|
189
|
-
return { successful: !!(
|
|
190
|
-
})(
|
|
191
|
-
return
|
|
189
|
+
return { successful: !!(m2.delimiter = s5), bestDelimiter: s5 };
|
|
190
|
+
})(e2, m2.newline, m2.skipEmptyLines, m2.comments, m2.delimitersToGuess)).successful ? m2.delimiter = r4.bestDelimiter : (a5 = true, m2.delimiter = v3.DefaultDelimiter), p4.meta.delimiter = m2.delimiter), b2(m2));
|
|
191
|
+
return m2.preview && m2.header && r4.preview++, n2 = e2, s4 = new E4(r4), p4 = s4.parse(n2, t2, i5), g4(), l3 ? { meta: { paused: true } } : p4 || { meta: { paused: false } };
|
|
192
192
|
}, this.paused = function() {
|
|
193
|
-
return
|
|
193
|
+
return l3;
|
|
194
194
|
}, this.pause = function() {
|
|
195
|
-
|
|
195
|
+
l3 = true, s4.abort(), n2 = q3(m2.chunk) ? "" : n2.substring(s4.getCharIndex());
|
|
196
196
|
}, this.resume = function() {
|
|
197
|
-
|
|
197
|
+
i4.streamer._halted ? (l3 = false, i4.streamer.parseChunk(n2, true)) : setTimeout(i4.resume, 3);
|
|
198
198
|
}, this.aborted = function() {
|
|
199
|
-
return
|
|
199
|
+
return e;
|
|
200
200
|
}, this.abort = function() {
|
|
201
|
-
|
|
202
|
-
}, this.guessLineEndings = function(
|
|
203
|
-
|
|
204
|
-
var
|
|
205
|
-
if (1 ===
|
|
206
|
-
for (var
|
|
207
|
-
return
|
|
201
|
+
e = true, s4.abort(), p4.meta.aborted = true, q3(m2.complete) && m2.complete(p4), n2 = "";
|
|
202
|
+
}, this.guessLineEndings = function(e2, t2) {
|
|
203
|
+
e2 = e2.substring(0, 1048576);
|
|
204
|
+
var t2 = new RegExp(U3(t2) + "([^]*?)" + U3(t2), "gm"), i5 = (e2 = e2.replace(t2, "")).split("\r"), t2 = e2.split("\n"), e2 = 1 < t2.length && t2[0].length < i5[0].length;
|
|
205
|
+
if (1 === i5.length || e2) return "\n";
|
|
206
|
+
for (var r4 = 0, n4 = 0; n4 < i5.length; n4++) "\n" === i5[n4][0] && r4++;
|
|
207
|
+
return r4 >= i5.length / 2 ? "\r\n" : "\r";
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
|
-
function
|
|
211
|
-
return
|
|
210
|
+
function U3(e) {
|
|
211
|
+
return e.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 E4(C2) {
|
|
214
|
+
var S = (C2 = C2 || {}).delimiter, O2 = C2.newline, x2 = C2.comments, I2 = C2.step, A = C2.preview, T3 = C2.fastMode, D3 = null, L2 = false, F4 = null == C2.quoteChar ? '"' : C2.quoteChar, j3 = F4;
|
|
215
|
+
if (void 0 !== C2.escapeChar && (j3 = C2.escapeChar), ("string" != typeof S || -1 < v3.BAD_DELIMITERS.indexOf(S)) && (S = ","), x2 === S) throw new Error("Comment character same as delimiter");
|
|
216
|
+
true === x2 ? x2 = "#" : ("string" != typeof x2 || -1 < v3.BAD_DELIMITERS.indexOf(x2)) && (x2 = false), "\n" !== O2 && "\r" !== O2 && "\r\n" !== O2 && (O2 = "\n");
|
|
217
|
+
var z3 = 0, M = false;
|
|
218
|
+
this.parse = function(i4, t, r2) {
|
|
219
|
+
if ("string" != typeof i4) throw new Error("Input must be a string");
|
|
220
|
+
var n2 = i4.length, e = S.length, s4 = O2.length, a5 = x2.length, o2 = q3(I2), h3 = [], u5 = [], d2 = [], f5 = z3 = 0;
|
|
221
|
+
if (!i4) return w2();
|
|
222
|
+
if (T3 || false !== T3 && -1 === i4.indexOf(F4)) {
|
|
223
|
+
for (var l3 = i4.split(O2), c4 = 0; c4 < l3.length; c4++) {
|
|
224
|
+
if (d2 = l3[c4], z3 += d2.length, c4 !== l3.length - 1) z3 += O2.length;
|
|
225
|
+
else if (r2) return w2();
|
|
226
|
+
if (!x2 || d2.substring(0, a5) !== x2) {
|
|
227
|
+
if (o2) {
|
|
228
|
+
if (h3 = [], k2(d2.split(S)), R(), M) return w2();
|
|
229
|
+
} else k2(d2.split(S));
|
|
230
|
+
if (A && A <= c4) return h3 = h3.slice(0, A), w2(true);
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
return
|
|
233
|
+
return w2();
|
|
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 p4 = i4.indexOf(S, z3), g4 = i4.indexOf(O2, z3), _3 = new RegExp(U3(j3) + U3(F4), "g"), m2 = i4.indexOf(F4, z3); ; ) if (i4[z3] === F4) for (m2 = z3, z3++; ; ) {
|
|
236
|
+
if (-1 === (m2 = i4.indexOf(F4, m2 + 1))) return r2 || u5.push({ type: "Quotes", code: "MissingQuotes", message: "Quoted field unterminated", row: h3.length, index: z3 }), E5();
|
|
237
|
+
if (m2 === n2 - 1) return E5(i4.substring(z3, m2).replace(_3, F4));
|
|
238
|
+
if (F4 === j3 && i4[m2 + 1] === j3) m2++;
|
|
239
|
+
else if (F4 === j3 || 0 === m2 || i4[m2 - 1] !== j3) {
|
|
240
|
+
-1 !== p4 && p4 < m2 + 1 && (p4 = i4.indexOf(S, m2 + 1));
|
|
241
|
+
var y5 = v4(-1 === (g4 = -1 !== g4 && g4 < m2 + 1 ? i4.indexOf(O2, m2 + 1) : g4) ? p4 : Math.min(p4, g4));
|
|
242
|
+
if (i4.substr(m2 + 1 + y5, e) === S) {
|
|
243
|
+
d2.push(i4.substring(z3, m2).replace(_3, F4)), i4[z3 = m2 + 1 + y5 + e] !== F4 && (m2 = i4.indexOf(F4, z3)), p4 = i4.indexOf(S, z3), g4 = i4.indexOf(O2, z3);
|
|
244
244
|
break;
|
|
245
245
|
}
|
|
246
|
-
|
|
247
|
-
if (
|
|
248
|
-
if (
|
|
249
|
-
if (
|
|
246
|
+
y5 = v4(g4);
|
|
247
|
+
if (i4.substring(m2 + 1 + y5, m2 + 1 + y5 + s4) === O2) {
|
|
248
|
+
if (d2.push(i4.substring(z3, m2).replace(_3, F4)), b4(m2 + 1 + y5 + s4), p4 = i4.indexOf(S, z3), m2 = i4.indexOf(F4, z3), o2 && (R(), M)) return w2();
|
|
249
|
+
if (A && h3.length >= A) return w2(true);
|
|
250
250
|
break;
|
|
251
251
|
}
|
|
252
|
-
|
|
252
|
+
u5.push({ type: "Quotes", code: "InvalidQuotes", message: "Trailing quote on quoted field is malformed", row: h3.length, index: z3 }), m2++;
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
|
-
else if (
|
|
256
|
-
if (-1 ===
|
|
257
|
-
|
|
258
|
-
} else if (-1 !==
|
|
255
|
+
else if (x2 && 0 === d2.length && i4.substring(z3, z3 + a5) === x2) {
|
|
256
|
+
if (-1 === g4) return w2();
|
|
257
|
+
z3 = g4 + s4, g4 = i4.indexOf(O2, z3), p4 = i4.indexOf(S, z3);
|
|
258
|
+
} else if (-1 !== p4 && (p4 < g4 || -1 === g4)) d2.push(i4.substring(z3, p4)), z3 = p4 + e, p4 = i4.indexOf(S, z3);
|
|
259
259
|
else {
|
|
260
|
-
if (-1 ===
|
|
261
|
-
if (
|
|
262
|
-
if (
|
|
260
|
+
if (-1 === g4) break;
|
|
261
|
+
if (d2.push(i4.substring(z3, g4)), b4(g4 + s4), o2 && (R(), M)) return w2();
|
|
262
|
+
if (A && h3.length >= A) return w2(true);
|
|
263
263
|
}
|
|
264
|
-
return
|
|
265
|
-
function
|
|
266
|
-
|
|
264
|
+
return E5();
|
|
265
|
+
function k2(e2) {
|
|
266
|
+
h3.push(e2), f5 = z3;
|
|
267
267
|
}
|
|
268
|
-
function
|
|
269
|
-
var
|
|
270
|
-
return
|
|
268
|
+
function v4(e2) {
|
|
269
|
+
var t2 = 0;
|
|
270
|
+
return t2 = -1 !== e2 && (e2 = i4.substring(m2 + 1, e2)) && "" === e2.trim() ? e2.length : t2;
|
|
271
271
|
}
|
|
272
|
-
function
|
|
273
|
-
return
|
|
272
|
+
function E5(e2) {
|
|
273
|
+
return r2 || (void 0 === e2 && (e2 = i4.substring(z3)), d2.push(e2), z3 = n2, k2(d2), o2 && R()), w2();
|
|
274
274
|
}
|
|
275
|
-
function
|
|
276
|
-
|
|
275
|
+
function b4(e2) {
|
|
276
|
+
z3 = e2, k2(d2), d2 = [], g4 = i4.indexOf(O2, z3);
|
|
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 w2(e2) {
|
|
279
|
+
if (C2.header && !t && h3.length && !L2) {
|
|
280
|
+
var s5 = h3[0], a6 = /* @__PURE__ */ Object.create(null), o4 = new Set(s5);
|
|
281
|
+
let n4 = false;
|
|
282
|
+
for (let r4 = 0; r4 < s5.length; r4++) {
|
|
283
|
+
let i5 = P4(s5[r4]);
|
|
284
|
+
if (a6[i5 = q3(C2.transformHeader) ? C2.transformHeader(i5, r4) : i5]) {
|
|
285
|
+
let e4, t2 = a6[i5];
|
|
286
|
+
for (; e4 = i5 + "_" + t2, t2++, o4.has(e4); ) ;
|
|
287
|
+
o4.add(e4), s5[r4] = e4, a6[i5]++, n4 = true, (D3 = null === D3 ? {} : D3)[e4] = i5;
|
|
288
|
+
} else a6[i5] = 1, s5[r4] = i5;
|
|
289
|
+
o4.add(i5);
|
|
290
290
|
}
|
|
291
|
-
|
|
291
|
+
n4 && console.warn("Duplicate headers found and renamed."), L2 = true;
|
|
292
292
|
}
|
|
293
|
-
return { data:
|
|
293
|
+
return { data: h3, errors: u5, meta: { delimiter: S, linebreak: O2, aborted: M, truncated: !!e2, cursor: f5 + (t || 0), renamedHeaders: D3 } };
|
|
294
294
|
}
|
|
295
|
-
function
|
|
296
|
-
|
|
295
|
+
function R() {
|
|
296
|
+
I2(w2()), h3 = [], u5 = [];
|
|
297
297
|
}
|
|
298
298
|
}, this.abort = function() {
|
|
299
|
-
|
|
299
|
+
M = true;
|
|
300
300
|
}, this.getCharIndex = function() {
|
|
301
|
-
return
|
|
301
|
+
return z3;
|
|
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 g3(e) {
|
|
305
|
+
var t = e.data, i4 = o[t.workerId], r2 = false;
|
|
306
|
+
if (t.error) i4.userError(t.error, t.file);
|
|
307
|
+
else if (t.results && t.results.data) {
|
|
308
|
+
var n2 = { abort: function() {
|
|
309
|
+
r2 = true, _2(t.workerId, { data: [], errors: [], meta: { aborted: true } });
|
|
310
|
+
}, pause: m, resume: m };
|
|
311
|
+
if (q3(i4.userStep)) {
|
|
312
|
+
for (var s4 = 0; s4 < t.results.data.length && (i4.userStep({ data: t.results.data[s4], errors: t.results.errors, meta: t.results.meta }, n2), !r2); s4++) ;
|
|
313
|
+
delete t.results;
|
|
314
|
+
} else q3(i4.userChunk) && (i4.userChunk(t.results, n2, t.file), delete t.results);
|
|
315
315
|
}
|
|
316
|
-
|
|
316
|
+
t.finished && !r2 && _2(t.workerId, t.results);
|
|
317
317
|
}
|
|
318
|
-
function
|
|
319
|
-
var
|
|
320
|
-
|
|
318
|
+
function _2(e, t) {
|
|
319
|
+
var i4 = o[e];
|
|
320
|
+
q3(i4.userComplete) && i4.userComplete(t), i4.terminate(), delete o[e];
|
|
321
321
|
}
|
|
322
|
-
function
|
|
322
|
+
function m() {
|
|
323
323
|
throw new Error("Not implemented.");
|
|
324
324
|
}
|
|
325
|
-
function
|
|
326
|
-
if ("object" != typeof
|
|
327
|
-
var
|
|
328
|
-
for (
|
|
329
|
-
return
|
|
325
|
+
function b2(e) {
|
|
326
|
+
if ("object" != typeof e || null === e) return e;
|
|
327
|
+
var t, i4 = Array.isArray(e) ? [] : {};
|
|
328
|
+
for (t in e) i4[t] = b2(e[t]);
|
|
329
|
+
return i4;
|
|
330
330
|
}
|
|
331
|
-
function
|
|
331
|
+
function y4(e, t) {
|
|
332
332
|
return function() {
|
|
333
|
-
|
|
333
|
+
e.apply(t, arguments);
|
|
334
334
|
};
|
|
335
335
|
}
|
|
336
|
-
function
|
|
337
|
-
return "function" == typeof
|
|
336
|
+
function q3(e) {
|
|
337
|
+
return "function" == typeof e;
|
|
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 v3.parse = function(e, t) {
|
|
340
|
+
var i4 = (t = t || {}).dynamicTyping || false;
|
|
341
|
+
q3(i4) && (t.dynamicTypingFunction = i4, i4 = {});
|
|
342
|
+
if (t.dynamicTyping = i4, t.transform = !!q3(t.transform) && t.transform, !t.worker || !v3.WORKERS_SUPPORTED) return i4 = null, v3.NODE_STREAM_INPUT, "string" == typeof e ? (e = P4(e), i4 = new (t.download ? f4 : c2)(t)) : true === e.readable && q3(e.read) && q3(e.on) ? i4 = new p2(t) : (n.File && e instanceof File || e instanceof Object) && (i4 = new l2(t)), i4.stream(e);
|
|
343
|
+
(i4 = (() => {
|
|
344
|
+
var e2;
|
|
345
|
+
return !!v3.WORKERS_SUPPORTED && (e2 = (() => {
|
|
346
|
+
var e4 = n.URL || n.webkitURL || null, t2 = r.toString();
|
|
347
|
+
return v3.BLOB_URL || (v3.BLOB_URL = e4.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; ", "(", t2, ")();"], { type: "text/javascript" })));
|
|
348
|
+
})(), (e2 = new n.Worker(e2)).onmessage = g3, e2.id = h2++, o[e2.id] = e2);
|
|
349
|
+
})()).userStep = t.step, i4.userChunk = t.chunk, i4.userComplete = t.complete, i4.userError = t.error, t.step = q3(t.step), t.chunk = q3(t.chunk), t.complete = q3(t.complete), t.error = q3(t.error), delete t.worker, i4.postMessage({ input: e, config: t, workerId: i4.id });
|
|
350
|
+
}, v3.unparse = function(e, t) {
|
|
351
|
+
var s4 = false, _3 = true, m2 = ",", y5 = "\r\n", a5 = '"', o2 = a5 + a5, i4 = false, r2 = null, h3 = false, u5 = ((() => {
|
|
352
|
+
if ("object" == typeof t) {
|
|
353
|
+
if ("string" != typeof t.delimiter || v3.BAD_DELIMITERS.filter(function(e2) {
|
|
354
|
+
return -1 !== t.delimiter.indexOf(e2);
|
|
355
|
+
}).length || (m2 = t.delimiter), "boolean" != typeof t.quotes && "function" != typeof t.quotes && !Array.isArray(t.quotes) || (s4 = t.quotes), "boolean" != typeof t.skipEmptyLines && "string" != typeof t.skipEmptyLines || (i4 = t.skipEmptyLines), "string" == typeof t.newline && (y5 = t.newline), "string" == typeof t.quoteChar && (a5 = t.quoteChar, o2 = a5 + a5), "boolean" == typeof t.header && (_3 = t.header), Array.isArray(t.columns)) {
|
|
356
|
+
if (0 === t.columns.length) throw new Error("Option columns is empty");
|
|
357
|
+
r2 = t.columns;
|
|
358
358
|
}
|
|
359
|
-
void 0 !==
|
|
359
|
+
void 0 !== t.escapeChar && (o2 = t.escapeChar + a5), t.escapeFormulae instanceof RegExp ? h3 = t.escapeFormulae : "boolean" == typeof t.escapeFormulae && t.escapeFormulae && (h3 = /^[=+\-@\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(U3(a5), "g"));
|
|
362
|
+
"string" == typeof e && (e = JSON.parse(e));
|
|
363
|
+
if (Array.isArray(e)) {
|
|
364
|
+
if (!e.length || Array.isArray(e[0])) return n2(null, e, i4);
|
|
365
|
+
if ("object" == typeof e[0]) return n2(r2 || Object.keys(e[0]), e, i4);
|
|
366
|
+
} else if ("object" == typeof e) return "string" == typeof e.data && (e.data = JSON.parse(e.data)), Array.isArray(e.data) && (e.fields || (e.fields = e.meta && e.meta.fields || r2), e.fields || (e.fields = Array.isArray(e.data[0]) ? e.fields : "object" == typeof e.data[0] ? Object.keys(e.data[0]) : []), Array.isArray(e.data[0]) || "object" == typeof e.data[0] || (e.data = [e.data])), n2(e.fields || [], e.data || [], i4);
|
|
367
367
|
throw new Error("Unable to serialize unrecognized input");
|
|
368
|
-
function
|
|
369
|
-
var
|
|
370
|
-
if (
|
|
371
|
-
for (var
|
|
372
|
-
0 <
|
|
368
|
+
function n2(e2, t2, i5) {
|
|
369
|
+
var r4 = "", n4 = ("string" == typeof e2 && (e2 = JSON.parse(e2)), "string" == typeof t2 && (t2 = JSON.parse(t2)), Array.isArray(e2) && 0 < e2.length), s5 = !Array.isArray(t2[0]);
|
|
370
|
+
if (n4 && _3) {
|
|
371
|
+
for (var a6 = 0; a6 < e2.length; a6++) 0 < a6 && (r4 += m2), r4 += k2(e2[a6], a6);
|
|
372
|
+
0 < t2.length && (r4 += y5);
|
|
373
373
|
}
|
|
374
|
-
for (var
|
|
375
|
-
var
|
|
376
|
-
if (
|
|
377
|
-
for (var f5 = [],
|
|
378
|
-
var
|
|
379
|
-
f5.push(
|
|
374
|
+
for (var o4 = 0; o4 < t2.length; o4++) {
|
|
375
|
+
var h4 = (n4 ? e2 : t2[o4]).length, u6 = false, d2 = n4 ? 0 === Object.keys(t2[o4]).length : 0 === t2[o4].length;
|
|
376
|
+
if (i5 && !n4 && (u6 = "greedy" === i5 ? "" === t2[o4].join("").trim() : 1 === t2[o4].length && 0 === t2[o4][0].length), "greedy" === i5 && n4) {
|
|
377
|
+
for (var f5 = [], l3 = 0; l3 < h4; l3++) {
|
|
378
|
+
var c4 = s5 ? e2[l3] : l3;
|
|
379
|
+
f5.push(t2[o4][c4]);
|
|
380
380
|
}
|
|
381
|
-
|
|
381
|
+
u6 = "" === f5.join("").trim();
|
|
382
382
|
}
|
|
383
|
-
if (!
|
|
384
|
-
for (var
|
|
385
|
-
0 <
|
|
386
|
-
var
|
|
387
|
-
|
|
383
|
+
if (!u6) {
|
|
384
|
+
for (var p4 = 0; p4 < h4; p4++) {
|
|
385
|
+
0 < p4 && !d2 && (r4 += m2);
|
|
386
|
+
var g4 = n4 && s5 ? e2[p4] : p4;
|
|
387
|
+
r4 += k2(t2[o4][g4], p4);
|
|
388
388
|
}
|
|
389
|
-
|
|
389
|
+
o4 < t2.length - 1 && (!i5 || 0 < h4 && !d2) && (r4 += y5);
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
|
-
return
|
|
392
|
+
return r4;
|
|
393
393
|
}
|
|
394
|
-
function
|
|
395
|
-
var
|
|
396
|
-
return null ==
|
|
397
|
-
for (var
|
|
394
|
+
function k2(e2, t2) {
|
|
395
|
+
var i5, r4, n4;
|
|
396
|
+
return null == e2 ? "" : e2.constructor === Date ? JSON.stringify(e2).slice(1, 25) : (n4 = false, h3 && "string" == typeof e2 && h3.test(e2) && (e2 = "'" + e2, n4 = true), r4 = (i5 = e2.toString()).replace(u5, o2), (n4 = n4 || true === s4 || "function" == typeof s4 && s4(e2, t2) || Array.isArray(s4) && s4[t2] || ((e4, t4) => {
|
|
397
|
+
for (var i6 = 0; i6 < t4.length; i6++) if (-1 < e4.indexOf(t4[i6])) return true;
|
|
398
398
|
return false;
|
|
399
|
-
})(
|
|
399
|
+
})(r4, v3.BAD_DELIMITERS) || -1 < r4.indexOf(m2) || -1 < i5.indexOf(a5) || " " === r4.charAt(0) || " " === r4.charAt(r4.length - 1)) ? a5 + r4 + a5 : r4);
|
|
400
400
|
}
|
|
401
|
-
},
|
|
402
|
-
var
|
|
403
|
-
return this.each(function(
|
|
404
|
-
if (!("INPUT" ===
|
|
405
|
-
for (var
|
|
406
|
-
}),
|
|
407
|
-
function
|
|
408
|
-
if (0 ===
|
|
401
|
+
}, v3.RECORD_SEP = String.fromCharCode(30), v3.UNIT_SEP = String.fromCharCode(31), v3.BYTE_ORDER_MARK = "\uFEFF", v3.BAD_DELIMITERS = ["\r", "\n", '"', v3.BYTE_ORDER_MARK], v3.WORKERS_SUPPORTED = !s2 && !!n.Worker, v3.NODE_STREAM_INPUT = 1, v3.LocalChunkSize = 10485760, v3.RemoteChunkSize = 5242880, v3.DefaultDelimiter = ",", v3.Parser = E4, v3.ParserHandle = i2, v3.NetworkStreamer = f4, v3.FileStreamer = l2, v3.StringStreamer = c2, v3.ReadableStreamStreamer = p2, n.jQuery && ((d = n.jQuery).fn.parse = function(o2) {
|
|
402
|
+
var i4 = o2.config || {}, h3 = [];
|
|
403
|
+
return this.each(function(e2) {
|
|
404
|
+
if (!("INPUT" === d(this).prop("tagName").toUpperCase() && "file" === d(this).attr("type").toLowerCase() && n.FileReader) || !this.files || 0 === this.files.length) return true;
|
|
405
|
+
for (var t = 0; t < this.files.length; t++) h3.push({ file: this.files[t], inputElem: this, instanceConfig: d.extend({}, i4) });
|
|
406
|
+
}), e(), this;
|
|
407
|
+
function e() {
|
|
408
|
+
if (0 === h3.length) q3(o2.complete) && o2.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 e2, t, i5, r2, n2 = h3[0];
|
|
411
|
+
if (q3(o2.before)) {
|
|
412
|
+
var s4 = o2.before(n2.file, n2.inputElem);
|
|
413
|
+
if ("object" == typeof s4) {
|
|
414
|
+
if ("abort" === s4.action) return e2 = "AbortError", t = n2.file, i5 = n2.inputElem, r2 = s4.reason, void (q3(o2.error) && o2.error({ name: e2 }, t, i5, r2));
|
|
415
|
+
if ("skip" === s4.action) return void u5();
|
|
416
|
+
"object" == typeof s4.config && (n2.instanceConfig = d.extend(n2.instanceConfig, s4.config));
|
|
417
|
+
} else if ("skip" === s4) return void u5();
|
|
418
418
|
}
|
|
419
|
-
var
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
},
|
|
419
|
+
var a5 = n2.instanceConfig.complete;
|
|
420
|
+
n2.instanceConfig.complete = function(e4) {
|
|
421
|
+
q3(a5) && a5(e4, n2.file, n2.inputElem), u5();
|
|
422
|
+
}, v3.parse(n2.file, n2.instanceConfig);
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
|
-
function
|
|
426
|
-
|
|
425
|
+
function u5() {
|
|
426
|
+
h3.splice(0, 1), e();
|
|
427
427
|
}
|
|
428
|
-
}),
|
|
429
|
-
|
|
430
|
-
void 0 ===
|
|
431
|
-
"string" == typeof
|
|
432
|
-
}), (f4.prototype = Object.create(
|
|
428
|
+
}), a4 && (n.onmessage = function(e) {
|
|
429
|
+
e = e.data;
|
|
430
|
+
void 0 === v3.WORKER_ID && e && (v3.WORKER_ID = e.workerId);
|
|
431
|
+
"string" == typeof e.input ? n.postMessage({ workerId: v3.WORKER_ID, results: v3.parse(e.input, e.config), finished: true }) : (n.File && e.input instanceof File || e.input instanceof Object) && (e = v3.parse(e.input, e.config)) && n.postMessage({ workerId: v3.WORKER_ID, results: e, finished: true });
|
|
432
|
+
}), (f4.prototype = Object.create(u4.prototype)).constructor = f4, (l2.prototype = Object.create(u4.prototype)).constructor = l2, (c2.prototype = Object.create(c2.prototype)).constructor = c2, (p2.prototype = Object.create(u4.prototype)).constructor = p2, v3;
|
|
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 = (n, lo, hi) => Math.max(lo, Math.min(hi, n));
|
|
480
480
|
var numberOr = (raw, dflt) => {
|
|
481
|
-
const
|
|
482
|
-
return Number.isFinite(
|
|
481
|
+
const n = raw == null || raw === "" ? NaN : Number(raw);
|
|
482
|
+
return Number.isFinite(n) ? n : dflt;
|
|
483
483
|
};
|
|
484
|
-
function resolveOptions(
|
|
484
|
+
function resolveOptions(p2) {
|
|
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: p2.width,
|
|
488
|
+
height: p2.height,
|
|
489
|
+
palette: p2.palette,
|
|
490
|
+
geoUnmatched: p2.geoUnmatched,
|
|
491
|
+
geo: p2.geo,
|
|
492
|
+
geoPoint: p2.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(p4) {
|
|
|
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: p2.geoPointDest,
|
|
501
|
+
maxMapPoints: p2.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(p4) {
|
|
|
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(p2.geoPointRadiusPx, 0)),
|
|
510
|
+
pageSize: Math.max(0, numberOr(p2.pageSize, 0)),
|
|
511
|
+
uiState: p2.uiState,
|
|
512
|
+
setUiState: p2.setUiState,
|
|
513
|
+
backgroundColor: p2.backgroundColor,
|
|
514
|
+
themeBg: p2.themeBg,
|
|
515
|
+
themeFg: p2.themeFg,
|
|
516
|
+
isHighContrast: p2.isHighContrast,
|
|
517
|
+
themeAccent: p2.themeAccent,
|
|
518
|
+
cultureCode: p2.cultureCode,
|
|
519
|
+
allowTooltips: p2.allowTooltips,
|
|
520
|
+
noDataText: p2.noDataText,
|
|
521
|
+
onSelect: p2.onSelect,
|
|
522
522
|
// ---- live-restyle knobs: `raw || undefined` / `.toString() || undefined` ----
|
|
523
|
-
colorScaleLow:
|
|
524
|
-
colorScaleHigh:
|
|
523
|
+
colorScaleLow: p2.colorScaleLow || void 0,
|
|
524
|
+
colorScaleHigh: p2.colorScaleHigh || void 0,
|
|
525
525
|
// "" (global, the default), "frame", or "self"; anything else fails open to global.
|
|
526
|
-
colorScaleScope:
|
|
526
|
+
colorScaleScope: p2.colorScaleScope === "frame" || p2.colorScaleScope === "self" ? p2.colorScaleScope : "",
|
|
527
527
|
// Math.max(50, Math.min(100, Number(raw) || 95)) — only meaningful under "self".
|
|
528
|
-
colorScaleSelfClampPct: clamp(Number(
|
|
528
|
+
colorScaleSelfClampPct: clamp(Number(p2.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: p2.geoLandColor || void 0,
|
|
533
|
+
geoNoDataColor: p2.geoNoDataColor || void 0,
|
|
534
|
+
aggregation: (p2.aggregation == null ? "" : String(p2.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 v3 = (p2.approximatePositions == null ? "" : String(p2.approximatePositions)).toLowerCase();
|
|
540
|
+
return v3 === "mark" || v3 === "aggregate" || v3 === "skip" ? v3 : APPROXIMATE_POSITIONS_DEFAULT;
|
|
541
541
|
})(),
|
|
542
542
|
valueAxisBaseline: (() => {
|
|
543
|
-
const
|
|
544
|
-
return
|
|
543
|
+
const v3 = (p2.valueAxisBaseline == null ? "" : String(p2.valueAxisBaseline)).toLowerCase();
|
|
544
|
+
return v3 === "zero" || v3 === "fit" || v3 === "auto" ? v3 : 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 v3 = (p2.seasonalMarkers == null ? "" : String(p2.seasonalMarkers)).toLowerCase();
|
|
552
|
+
return v3 === "auto" || v3 === "always" || v3 === "never" ? v3 : SEASONAL_MARKERS_DEFAULT;
|
|
553
553
|
})(),
|
|
554
554
|
// ---- animation: booleans, default+clamp numerics, "" default enum ----
|
|
555
|
-
animAutoPlay: !!
|
|
555
|
+
animAutoPlay: !!p2.animAutoPlay,
|
|
556
556
|
// Math.max(250, Math.min(5000, Number(raw) || 1000))
|
|
557
|
-
animPlaySpeedMs: clamp(Number(
|
|
557
|
+
animPlaySpeedMs: clamp(Number(p2.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(p2.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(p2.animMaxIdealFrames) || ANIM_MAX_IDEAL_FRAMES_DEFAULT, ANIM_MAX_IDEAL_FRAMES_MIN, ANIM_MAX_IDEAL_FRAMES_MAX),
|
|
567
|
+
animStopAtEnd: !!p2.animStopAtEnd,
|
|
568
|
+
filtersDuringPlay: !!p2.filtersDuringPlay,
|
|
569
|
+
animTimelineStyle: (p2.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(p4) {
|
|
|
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: p2.flipSync === void 0 || p2.flipSync === null ? true : !!p2.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(p4) {
|
|
|
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 m = (p2.flipMode == null ? "" : String(p2.flipMode)).toLowerCase();
|
|
596
|
+
if (m === "single" || m === "all" || m === "both") return m;
|
|
597
|
+
if (p2.flipSync === false) return "single";
|
|
598
|
+
if (p2.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(p2.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: p2.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 k2 = geoKind.toLowerCase();
|
|
621
|
+
if (/^country/.test(k2)) return "world";
|
|
622
|
+
if (k2 === "north-america") return "world";
|
|
623
|
+
if (k2 === "world") return "world";
|
|
624
|
+
if (k2 === "us-state-code" || k2 === "us-state-name") return "us-states";
|
|
625
|
+
if (k2 === "us-zip5") return "us-zip3";
|
|
626
626
|
return null;
|
|
627
627
|
}
|
|
628
628
|
var _worldBase;
|
|
@@ -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(n) {
|
|
706
|
+
return n.normalize("NFD").replace(/\p{Diacritic}/gu, "").toLowerCase().replace(/[øœæßłđðþıħŧŋəĸ]/g, (e) => W[e]).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 n = /* @__PURE__ */ new Map();
|
|
711
|
+
for (let e of _.split(",")) {
|
|
712
|
+
let [t, o] = e.split(" ");
|
|
713
|
+
t && o && n.set(t, o);
|
|
714
714
|
}
|
|
715
|
-
return
|
|
715
|
+
return n;
|
|
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 n = /* @__PURE__ */ new Map(), e = ["en", ...v.filter((t) => t !== "en")];
|
|
725
|
+
for (let t of e) {
|
|
726
|
+
let o = null;
|
|
727
727
|
try {
|
|
728
|
-
|
|
728
|
+
o = new Intl.DisplayNames([t], { type: "region" });
|
|
729
729
|
} catch {
|
|
730
730
|
continue;
|
|
731
731
|
}
|
|
732
|
-
for (let [
|
|
733
|
-
let
|
|
732
|
+
for (let [i2, r] of N) {
|
|
733
|
+
let a4;
|
|
734
734
|
try {
|
|
735
|
-
|
|
735
|
+
a4 = o.of(i2);
|
|
736
736
|
} catch {
|
|
737
|
-
|
|
737
|
+
a4 = void 0;
|
|
738
738
|
}
|
|
739
|
-
if (!
|
|
740
|
-
let
|
|
741
|
-
|
|
739
|
+
if (!a4 || a4 === i2) continue;
|
|
740
|
+
let s2 = u(a4);
|
|
741
|
+
s2 && !n.has(s2) && n.set(s2, r);
|
|
742
742
|
}
|
|
743
743
|
}
|
|
744
|
-
for (let [
|
|
745
|
-
let
|
|
746
|
-
|
|
744
|
+
for (let [t, o] of Object.entries(Q)) {
|
|
745
|
+
let i2 = u(t);
|
|
746
|
+
i2 && n.set(i2, o);
|
|
747
747
|
}
|
|
748
|
-
return b =
|
|
748
|
+
return b = n, n;
|
|
749
749
|
}
|
|
750
|
-
function T(
|
|
751
|
-
return N.get(String(
|
|
750
|
+
function T(n) {
|
|
751
|
+
return N.get(String(n || "").trim().toUpperCase()) ?? null;
|
|
752
752
|
}
|
|
753
|
-
function E(
|
|
754
|
-
if (
|
|
755
|
-
let
|
|
756
|
-
if (!
|
|
757
|
-
let
|
|
758
|
-
return
|
|
753
|
+
function E(n) {
|
|
754
|
+
if (n == null) return null;
|
|
755
|
+
let e = String(n).trim();
|
|
756
|
+
if (!e) return null;
|
|
757
|
+
let t = e.toUpperCase();
|
|
758
|
+
return t.length === 3 && J.has(t) ? t : t.length === 2 && z.has(t) ? N.get(t) ?? null : j().get(u(e)) ?? 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(n) {
|
|
762
|
+
return n ? $.has(n) : 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(n, e) {
|
|
767
|
+
let t = n.filter((o) => o.row.kinds.includes(q[e || "north-america"]));
|
|
768
|
+
return t.length ? t : (e || "north-america") === "world" ? n : t;
|
|
769
769
|
}
|
|
770
770
|
var P = a;
|
|
771
|
-
function L3(
|
|
772
|
-
|
|
771
|
+
function L3(n) {
|
|
772
|
+
n !== P && (P = n || "", 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 n = /* @__PURE__ */ new Map(), e = P, t = (o, i2, r) => {
|
|
782
|
+
if (!o) return;
|
|
783
|
+
let a4 = n.get(o);
|
|
784
|
+
a4 ? a4.some((s2) => s2.row === i2) || a4.push({ row: i2, primary: r }) : n.set(o, [{ row: i2, primary: r }]);
|
|
785
785
|
};
|
|
786
|
-
for (let
|
|
787
|
-
let
|
|
788
|
-
if (
|
|
789
|
-
let
|
|
790
|
-
|
|
791
|
-
let
|
|
792
|
-
if (
|
|
786
|
+
for (let o of e.split(",")) {
|
|
787
|
+
let i2 = o.split("|");
|
|
788
|
+
if (i2.length < 7) continue;
|
|
789
|
+
let r = { a1: i2[1], cc: i2[2], lon: +i2[3], lat: +i2[4], pop: +i2[5], kinds: i2[6] || "N" };
|
|
790
|
+
i2.length > 8 && i2[8] && (r.tags = i2[8].split(";").filter(Boolean));
|
|
791
|
+
let a4 = t3[r.cc];
|
|
792
|
+
if (a4 && u(i2[0]) === a4 && (r.tags || (r.tags = []), r.tags.includes("capital") || r.tags.push("capital")), t(u(i2[0]), r, true), i2.length > 7 && i2[7]) for (let s2 of i2[7].split(";")) t(u(s2), r, false);
|
|
793
793
|
}
|
|
794
|
-
for (let
|
|
795
|
-
return U =
|
|
794
|
+
for (let o of n.values()) o.sort((i2, r) => r.row.pop - i2.row.pop);
|
|
795
|
+
return U = n, n;
|
|
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 n = /* @__PURE__ */ new Map();
|
|
802
|
+
for (let [e, t] of y()) {
|
|
803
|
+
if (!e.endsWith(" city")) continue;
|
|
804
|
+
let o = e.slice(0, -5);
|
|
805
|
+
!o || y().get(o)?.some((i2) => i2.primary) || t[0].row.pop < e3 || n.set(o, t);
|
|
806
|
+
}
|
|
807
|
+
return L = n, n;
|
|
808
|
+
}
|
|
809
|
+
function O(n) {
|
|
810
|
+
if (!n) return;
|
|
811
|
+
let e = y().get(n);
|
|
812
|
+
if (e?.some((i2) => i2.primary)) return e;
|
|
813
|
+
let t = i3().get(n);
|
|
814
|
+
if (!t) return e;
|
|
815
|
+
let o = t.map((i2) => ({ row: i2.row, primary: true }));
|
|
816
|
+
return e ? [...o, ...e] : o;
|
|
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 n = /* @__PURE__ */ new Map();
|
|
822
|
+
for (let t of k.split(",")) {
|
|
823
|
+
let o = t.split("|");
|
|
824
|
+
o.length < 3 || n.set(o[0], { lon: +o[1], lat: +o[2] });
|
|
825
825
|
}
|
|
826
|
-
let
|
|
827
|
-
for (let
|
|
828
|
-
let
|
|
829
|
-
if (!
|
|
830
|
-
let
|
|
831
|
-
(
|
|
826
|
+
let e = /* @__PURE__ */ new Map();
|
|
827
|
+
for (let t of y().values()) for (let o of t) {
|
|
828
|
+
let i2 = T(o.row.cc);
|
|
829
|
+
if (!i2) continue;
|
|
830
|
+
let r = e.get(i2);
|
|
831
|
+
(r === void 0 || o.row.pop > r) && (e.set(i2, o.row.pop), n.set(i2, { lon: o.row.lon, lat: o.row.lat }));
|
|
832
832
|
}
|
|
833
|
-
return I =
|
|
833
|
+
return I = n, n;
|
|
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 n = /* @__PURE__ */ new Map();
|
|
839
|
+
for (let e of H.split(",")) {
|
|
840
|
+
let t = e.split("|");
|
|
841
|
+
if (t.length < 5) continue;
|
|
842
|
+
let o = { key: t[0], cc: t[1], name: t[2], lon: +t[3], lat: +t[4] };
|
|
843
|
+
n.set(u(o.key), o);
|
|
844
|
+
let i2 = u(o.name);
|
|
845
|
+
i2 === "mexico" && o.cc === "MX" ? (n.set("estado de mexico", o), n.set("edomex", o)) : n.set(i2, o);
|
|
846
846
|
}
|
|
847
|
-
return B =
|
|
847
|
+
return B = n, n;
|
|
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 n = /* @__PURE__ */ new Map();
|
|
853
|
+
for (let e of X.split(",")) {
|
|
854
|
+
let t = e.split("|");
|
|
855
|
+
t.length < 3 || n.set(t[0], { lon: +t[1], lat: +t[2] });
|
|
856
856
|
}
|
|
857
|
-
return h =
|
|
857
|
+
return h = n, n;
|
|
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
|
|
861
|
+
function Y(n) {
|
|
862
|
+
if (n == null) return null;
|
|
863
|
+
let e = u(String(n));
|
|
864
|
+
return e ? D().get(e)?.key ?? null : null;
|
|
865
|
+
}
|
|
866
|
+
function u3(n) {
|
|
867
|
+
return D().get(u(n))?.cc ?? null;
|
|
868
|
+
}
|
|
869
|
+
function c3(n) {
|
|
870
|
+
let e = u3(n);
|
|
871
|
+
return e ? T(e) : null;
|
|
872
|
+
}
|
|
873
|
+
function M3(n) {
|
|
874
|
+
if (n == null) return null;
|
|
875
|
+
let e = String(n).trim().replace(/\.0+$/, "");
|
|
876
|
+
if (!e) return null;
|
|
877
|
+
let t = /^(\d{5})(-\d{4})?$/.exec(e);
|
|
878
|
+
return t ? t[1] : /^\d{3,4}$/.test(e) ? e.padStart(5, "0") : null;
|
|
879
|
+
}
|
|
880
|
+
function Z(n) {
|
|
881
|
+
if (n == null) return [];
|
|
882
|
+
let e = String(n).trim().replace(/\.0+$/, "");
|
|
883
|
+
if (!e) return [];
|
|
884
|
+
if (/^\d{3}$/.test(e)) {
|
|
885
|
+
let o = e.padStart(5, "0").slice(0, 3);
|
|
886
|
+
return o === e ? [e] : [e, o];
|
|
887
|
+
}
|
|
888
|
+
let t = M3(e);
|
|
889
|
+
return t ? [t.slice(0, 3)] : [];
|
|
890
|
+
}
|
|
891
|
+
function S3(n) {
|
|
892
|
+
return !!n && n.ambiguous === true && !("precision" in n);
|
|
893
|
+
}
|
|
894
|
+
function A3(n) {
|
|
895
|
+
let e = null, t = typeof n.lat == "string" ? n.lat.trim() : n.lat, o = typeof n.lon == "string" ? n.lon.trim() : n.lon;
|
|
896
|
+
if (t != null && t !== "" && o !== void 0 && o !== null && o !== "") {
|
|
897
|
+
let a4 = +t, s2 = +o;
|
|
898
|
+
if (isFinite(a4) && isFinite(s2) && a4 >= -90 && a4 <= 90 && s2 >= -180 && s2 <= 180) if (a4 === 0 && s2 === 0) e = { lat: 0, lon: 0, precision: "latlon" };
|
|
899
|
+
else return { lat: a4, lon: s2, precision: "latlon" };
|
|
900
|
+
}
|
|
901
|
+
let i2 = E(n.country), r = Y(n.state);
|
|
902
|
+
if (r && i2 && c3(r) !== i2 && (r = null), n.city !== void 0 && n.city !== null) {
|
|
903
|
+
let a4 = u(String(n.city)), s2 = O(a4), f4 = s2 ? F(s2, n.mapKind) : null;
|
|
904
904
|
if (f4 && f4.length) {
|
|
905
|
-
let
|
|
906
|
-
for (let
|
|
907
|
-
let
|
|
908
|
-
if (
|
|
905
|
+
let d = n.state === void 0 || n.state === null ? "" : String(n.state).trim(), R = d ? u(d) : "", g3 = d ? Y(d) : null, S = [], m = -1;
|
|
906
|
+
for (let c2 of f4) {
|
|
907
|
+
let l2 = c2.row, A = 0;
|
|
908
|
+
if (d && l2.a1 !== "") if (g3 && l2.a1 === g3 || u(l2.a1) === R) A++;
|
|
909
909
|
else continue;
|
|
910
|
-
if (
|
|
910
|
+
if (i2) if (T(l2.cc) === i2) A++;
|
|
911
911
|
else continue;
|
|
912
|
-
|
|
912
|
+
A > m ? (m = A, S = [c2]) : A === m && S.push(c2);
|
|
913
913
|
}
|
|
914
|
-
|
|
915
|
-
let
|
|
916
|
-
for (let
|
|
917
|
-
if (
|
|
918
|
-
let
|
|
919
|
-
return { lat:
|
|
914
|
+
S.some((c2) => c2.primary) && (S = S.filter((c2) => c2.primary));
|
|
915
|
+
let p2 = /* @__PURE__ */ new Map();
|
|
916
|
+
for (let c2 of S) p2.set(c2.row.lon.toFixed(2) + "," + c2.row.lat.toFixed(2), c2.row);
|
|
917
|
+
if (p2.size === 1) {
|
|
918
|
+
let c2 = S[0].row;
|
|
919
|
+
return { lat: c2.lat, lon: c2.lon, precision: "city" };
|
|
920
920
|
}
|
|
921
|
-
if (
|
|
921
|
+
if (p2.size > 1) return { ambiguous: true, matches: p2.size };
|
|
922
922
|
}
|
|
923
923
|
}
|
|
924
|
-
if (!
|
|
925
|
-
let
|
|
926
|
-
if (
|
|
924
|
+
if (!i2 || r3.has(i2)) for (let a4 of Z(n.zip)) {
|
|
925
|
+
let s2 = a3().get(a4);
|
|
926
|
+
if (s2) return { lat: s2.lat, lon: s2.lon, precision: "zip3" };
|
|
927
927
|
}
|
|
928
|
-
if (
|
|
929
|
-
let
|
|
930
|
-
if (
|
|
928
|
+
if (r) {
|
|
929
|
+
let a4 = D().get(u(r));
|
|
930
|
+
if (a4) return { lat: a4.lat, lon: a4.lon, precision: "state" };
|
|
931
931
|
}
|
|
932
|
-
if (
|
|
933
|
-
let
|
|
934
|
-
if (
|
|
932
|
+
if (i2 && (n.mapKind !== "north-america" || s3.has(i2))) {
|
|
933
|
+
let a4 = o3().get(i2);
|
|
934
|
+
if (a4) return { lat: a4.lat, lon: a4.lon, precision: "country" };
|
|
935
935
|
}
|
|
936
|
-
return
|
|
936
|
+
return e;
|
|
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(n, e) {
|
|
941
|
+
let t = new Array(n.length), o = new Array(n.length), i2 = new Array(n.length), r = /* @__PURE__ */ new Set(), a4 = [], s2 = /* @__PURE__ */ new Set(), f4 = [], d = /* @__PURE__ */ new Set(), R = [], g3 = { latlon: 0, city: 0, zip3: 0, state: 0, country: 0 }, S = 0, m = 0, p2 = null;
|
|
942
|
+
for (let l2 = 0; l2 < n.length; ++l2) {
|
|
943
|
+
let A = n[l2], C2 = A3({ ...A, mapKind: e });
|
|
944
|
+
if (S3(C2)) {
|
|
945
|
+
t[l2] = null, o[l2] = null, i2[l2] = null, m++;
|
|
946
|
+
let M = K(A);
|
|
947
|
+
M && !d.has(M.toLowerCase()) && (d.add(M.toLowerCase()), R.length < x && R.push(M));
|
|
948
|
+
} else if (C2) {
|
|
949
|
+
if (t[l2] = C2.lat, o[l2] = C2.lon, i2[l2] = C2.precision, S++, g3[C2.precision]++, (p2 === null || G[C2.precision] > G[p2]) && (p2 = C2.precision), G[C2.precision] > G.city) {
|
|
950
|
+
let M = K(A);
|
|
951
|
+
M && !s2.has(M.toLowerCase()) && (s2.add(M.toLowerCase()), f4.length < x && f4.push(M));
|
|
952
952
|
}
|
|
953
953
|
} else {
|
|
954
|
-
|
|
955
|
-
let
|
|
956
|
-
|
|
954
|
+
t[l2] = null, o[l2] = null, i2[l2] = null;
|
|
955
|
+
let M = K(A);
|
|
956
|
+
M && !r.has(M.toLowerCase()) && (r.add(M.toLowerCase()), a4.push(M));
|
|
957
957
|
}
|
|
958
958
|
}
|
|
959
|
-
let
|
|
960
|
-
return { lat:
|
|
959
|
+
let c2 = !n3() && n.some((l2) => l2.city !== null && l2.city !== void 0 && String(l2.city).trim() !== "");
|
|
960
|
+
return { lat: t, lon: o, precisions: i2, precision: p2, precisionCounts: g3, coarseExamples: f4, unmatched: a4, ambiguousRows: m, ambiguousExamples: R, matchedRows: S, totalRows: n.length, ...c2 ? { cityTableMissing: true } : {} };
|
|
961
961
|
}
|
|
962
|
-
function K(
|
|
963
|
-
let
|
|
964
|
-
return
|
|
962
|
+
function K(n) {
|
|
963
|
+
let e = [n.city, n.state, n.zip, n.country].filter((t) => t != null && String(t).trim() !== "").map((t) => String(t).trim()).join(", ");
|
|
964
|
+
return e || (n.label === null || n.label === void 0 ? "" : String(n.label).trim());
|
|
965
965
|
}
|
|
966
|
-
function p3(
|
|
967
|
-
if (!
|
|
968
|
-
let
|
|
969
|
-
return
|
|
966
|
+
function p3(n, e) {
|
|
967
|
+
if (!n) return false;
|
|
968
|
+
let t = O(n);
|
|
969
|
+
return t ? F(t, e).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(t) {
|
|
975
|
+
return t ? t.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_\-./]+/g, " ").toLowerCase().split(/\s+/).filter((n) => n.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(t) {
|
|
978
|
+
let n = Date.parse(t);
|
|
979
|
+
if (isNaN(n)) return null;
|
|
980
|
+
let e = new Date(n);
|
|
981
|
+
if (F2.test(t) || i.test(t.trim()) || l.test(t)) return e;
|
|
982
|
+
let r = new Date(Date.UTC(e.getFullYear(), e.getMonth(), e.getDate(), e.getHours(), e.getMinutes(), e.getSeconds(), e.getMilliseconds())), o = e.getFullYear();
|
|
983
|
+
return o >= 0 && o < 100 && r.setUTCFullYear(o), r;
|
|
984
984
|
}
|
|
985
|
-
function u2(
|
|
986
|
-
return !(
|
|
985
|
+
function u2(t) {
|
|
986
|
+
return !(t instanceof Date) || isNaN(t.getTime()) ? null : t.getUTCHours() === 0 && t.getUTCMinutes() === 0 && t.getUTCSeconds() === 0 && t.getUTCMilliseconds() === 0 ? "utc" : t.getHours() === 0 && t.getMinutes() === 0 && t.getSeconds() === 0 && t.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((n) => n[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 n = /* @__PURE__ */ new Map();
|
|
1001
|
+
for (let [s2, i2] of at) n.set(g(i2), s2);
|
|
1002
|
+
n.set(g("Washington DC"), "DC"), n.set(g("Washington D.C."), "DC"), n.set(g("US Virgin Islands"), "VI");
|
|
1003
|
+
for (let [s2, i2] of Object.entries(yt)) {
|
|
1004
|
+
let r = g(s2);
|
|
1005
|
+
r && !n.has(r) && n.set(r, i2);
|
|
1006
|
+
}
|
|
1007
|
+
return n;
|
|
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(n) {
|
|
1011
|
+
return n.trim().toUpperCase();
|
|
1012
1012
|
}
|
|
1013
|
-
function g(
|
|
1014
|
-
return u(
|
|
1013
|
+
function g(n) {
|
|
1014
|
+
return u(n);
|
|
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(n, s2) {
|
|
1018
|
+
if (!n) return false;
|
|
1019
|
+
for (let i2 of s(n)) if (s2.has(i2)) return true;
|
|
1020
1020
|
return false;
|
|
1021
1021
|
}
|
|
1022
|
-
function Mt(
|
|
1023
|
-
if (
|
|
1024
|
-
let
|
|
1025
|
-
if (
|
|
1026
|
-
switch (
|
|
1022
|
+
function Mt(n, s2) {
|
|
1023
|
+
if (n == null) return null;
|
|
1024
|
+
let i2 = String(n).trim();
|
|
1025
|
+
if (i2.length === 0) return null;
|
|
1026
|
+
switch (s2) {
|
|
1027
1027
|
case "country-iso3":
|
|
1028
1028
|
case "country-iso2":
|
|
1029
1029
|
case "country-name":
|
|
1030
|
-
return E(
|
|
1030
|
+
return E(i2);
|
|
1031
1031
|
case "us-state-code":
|
|
1032
1032
|
case "us-state-name": {
|
|
1033
|
-
let
|
|
1034
|
-
return ct.has(
|
|
1033
|
+
let r = ft(i2);
|
|
1034
|
+
return ct.has(r) ? r : ut.get(g(i2)) ?? null;
|
|
1035
1035
|
}
|
|
1036
1036
|
case "us-zip5":
|
|
1037
|
-
return M3(
|
|
1037
|
+
return M3(i2);
|
|
1038
1038
|
case "us-county-fips":
|
|
1039
|
-
return /^\d{5}$/.test(
|
|
1039
|
+
return /^\d{5}$/.test(i2) && lt.has(i2.slice(0, 2)) ? i2 : null;
|
|
1040
1040
|
default:
|
|
1041
1041
|
return null;
|
|
1042
1042
|
}
|
|
1043
1043
|
}
|
|
1044
|
-
function Gt(
|
|
1045
|
-
switch (
|
|
1044
|
+
function Gt(n) {
|
|
1045
|
+
switch (n) {
|
|
1046
1046
|
case "country-iso3":
|
|
1047
1047
|
case "country-iso2":
|
|
1048
1048
|
case "country-name":
|
|
@@ -1055,26 +1055,26 @@ function Gt(n2) {
|
|
|
1055
1055
|
return false;
|
|
1056
1056
|
}
|
|
1057
1057
|
}
|
|
1058
|
-
function It(
|
|
1059
|
-
return
|
|
1058
|
+
function It(n, s2) {
|
|
1059
|
+
return s2 === "us-zip5" ? w.has(n.slice(0, 3)) : true;
|
|
1060
1060
|
}
|
|
1061
|
-
function Wt(
|
|
1062
|
-
let
|
|
1063
|
-
for (let
|
|
1064
|
-
let
|
|
1065
|
-
if (
|
|
1061
|
+
function Wt(n, s2) {
|
|
1062
|
+
let i2 = new Array(n.length), r = /* @__PURE__ */ new Set(), M = [], h2 = 0;
|
|
1063
|
+
for (let N2 = 0; N2 < n.length; ++N2) {
|
|
1064
|
+
let I2 = Mt(n[N2], s2), O2 = I2 !== null && It(I2, s2) ? I2 : null;
|
|
1065
|
+
if (i2[N2] = O2, O2 !== null) h2++;
|
|
1066
1066
|
else {
|
|
1067
|
-
let
|
|
1068
|
-
if (
|
|
1069
|
-
let
|
|
1070
|
-
if (
|
|
1071
|
-
let
|
|
1072
|
-
|
|
1067
|
+
let d = n[N2];
|
|
1068
|
+
if (d != null) {
|
|
1069
|
+
let p2 = String(d).trim();
|
|
1070
|
+
if (p2.length > 0) {
|
|
1071
|
+
let m = p2.toLowerCase();
|
|
1072
|
+
r.has(m) || (r.add(m), M.push(p2));
|
|
1073
1073
|
}
|
|
1074
1074
|
}
|
|
1075
1075
|
}
|
|
1076
1076
|
}
|
|
1077
|
-
return { iso:
|
|
1077
|
+
return { iso: i2, unmatched: M, matchedRows: h2, totalRows: n.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 n = /* @__PURE__ */ new Map();
|
|
1086
|
+
for (let t of Object.keys(yt2)) for (let e of yt2[t].split(/\s+/)) e && n.set(e, t);
|
|
1087
|
+
return n;
|
|
1088
1088
|
})();
|
|
1089
|
-
function Pt(
|
|
1090
|
-
for (let [
|
|
1091
|
-
let
|
|
1092
|
-
|
|
1089
|
+
function Pt(n) {
|
|
1090
|
+
for (let [t, e] of n) {
|
|
1091
|
+
let r = j2.get(t);
|
|
1092
|
+
r && !j2.has(e) && j2.set(e, r);
|
|
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(n) {
|
|
1105
|
+
return n ? String(n).replace(Ct, "").trim() : "";
|
|
1106
1106
|
}
|
|
1107
|
-
function Ut(
|
|
1108
|
-
return !!
|
|
1107
|
+
function Ut(n) {
|
|
1108
|
+
return !!n && Ct.test(String(n));
|
|
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((n, t) => t.length - n.length).map((n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\s+/g, "\\s+")).join("|") + ")\\s+of\\s+", "i");
|
|
1112
|
+
function Ht(n) {
|
|
1113
|
+
let t = Mt2(n);
|
|
1114
|
+
return t.length === 0 ? "" : t.replace(kt, " ");
|
|
1115
1115
|
}
|
|
1116
|
-
function Tt(
|
|
1117
|
-
if (!
|
|
1118
|
-
let
|
|
1119
|
-
return
|
|
1116
|
+
function Tt(n, t) {
|
|
1117
|
+
if (!t) return false;
|
|
1118
|
+
let e = Mt2(t);
|
|
1119
|
+
return n.test(Ht(t)) || n.test(e) || n.test(s(e).join(" "));
|
|
1120
1120
|
}
|
|
1121
|
-
function Nt(
|
|
1122
|
-
return Tt(zt,
|
|
1121
|
+
function Nt(n) {
|
|
1122
|
+
return Tt(zt, n);
|
|
1123
1123
|
}
|
|
1124
|
-
function Yt(
|
|
1125
|
-
return Tt(Bt,
|
|
1124
|
+
function Yt(n) {
|
|
1125
|
+
return Tt(Bt, n) || Nt(n);
|
|
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(n) {
|
|
1129
|
+
let t = String(n?.valueNature ?? "").trim().toLowerCase();
|
|
1130
|
+
return t === "categorical" ? "Categorical" : t === "ordinal" ? "Ordinal" : t === "continuous" || n?.isMeasure === true || Rt.test(String(n?.dataType ?? "")) ? "Continuous" : "Categorical";
|
|
1131
|
+
}
|
|
1132
|
+
function Xt(n) {
|
|
1133
|
+
return n?.isMeasure === true || Rt.test(String(n?.dataType ?? ""));
|
|
1134
|
+
}
|
|
1135
|
+
function vt(n) {
|
|
1136
|
+
let t = n ?? {}, e = Zt(t);
|
|
1137
|
+
if (e !== "Continuous") return { nature: e, additivity: "unknown", basis: "role", suppressed: false };
|
|
1138
|
+
if (Nt(t.name)) return { nature: e, additivity: "positional", basis: "name", suppressed: true };
|
|
1139
|
+
let r = String(t.additivity ?? "").trim().toLowerCase();
|
|
1140
|
+
if (!(r === "additive" && Ut(t.name))) {
|
|
1141
|
+
if (r === "additive") return { nature: e, additivity: "additive", basis: "measured", suppressed: false };
|
|
1142
|
+
if (r === "part_of_whole") return { nature: e, additivity: "part_of_whole", basis: "measured", suppressed: false };
|
|
1143
|
+
if (r === "intensive_rate") return { nature: e, additivity: "intensive_rate", basis: "measured", suppressed: false };
|
|
1144
|
+
}
|
|
1145
|
+
return t.discourageAggregationAcrossGroups === true ? { nature: e, additivity: "intensive_rate", basis: "host-flag", suppressed: false } : Yt(t.name) ? { nature: e, additivity: "intensive_rate", basis: "name", suppressed: false } : { nature: e, additivity: "additive", basis: "default", suppressed: false };
|
|
1146
|
+
}
|
|
1147
|
+
function It2(n) {
|
|
1148
|
+
let t = vt(n), e = n ?? {};
|
|
1149
|
+
if (t.nature === "Categorical") return ["first", "distinctcount", "count"];
|
|
1150
|
+
if (t.nature === "Ordinal") return Xt(e) ? ["median", "average", "min", "max", "first", "distinctcount", "count"] : ["first", "distinctcount", "count"];
|
|
1151
|
+
switch (t.additivity) {
|
|
1152
1152
|
case "positional":
|
|
1153
1153
|
return ["min", "max", "count", "distinctcount", "first"];
|
|
1154
1154
|
case "intensive_rate":
|
|
@@ -1157,159 +1157,159 @@ function It2(n2) {
|
|
|
1157
1157
|
return ["sum", "average", "median", "min", "max", "count", "distinctcount", "first"];
|
|
1158
1158
|
}
|
|
1159
1159
|
}
|
|
1160
|
-
function Me(
|
|
1161
|
-
return It2(
|
|
1160
|
+
function Me(n) {
|
|
1161
|
+
return It2(n)[0];
|
|
1162
1162
|
}
|
|
1163
|
-
function Te(
|
|
1164
|
-
if (
|
|
1165
|
-
if (
|
|
1166
|
-
let
|
|
1167
|
-
return
|
|
1163
|
+
function Te(n, t) {
|
|
1164
|
+
if (t !== "sum" && t !== "count") return false;
|
|
1165
|
+
if (t === "count") return true;
|
|
1166
|
+
let e = vt(n);
|
|
1167
|
+
return e.additivity === "additive" || e.additivity === "part_of_whole" || e.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 f4 = v2(
|
|
1174
|
+
function G2(r) {
|
|
1175
|
+
return !!E(r);
|
|
1176
|
+
}
|
|
1177
|
+
function C(r) {
|
|
1178
|
+
let n = /* @__PURE__ */ new Set();
|
|
1179
|
+
for (let e of r) {
|
|
1180
|
+
if (e == null) continue;
|
|
1181
|
+
let s2 = u(String(e));
|
|
1182
|
+
if (!V(s2) && !n.has(s2) && (n.add(s2), n.size >= U2)) break;
|
|
1183
|
+
}
|
|
1184
|
+
return Array.from(n);
|
|
1185
|
+
}
|
|
1186
|
+
function P2(r) {
|
|
1187
|
+
let n = C(r);
|
|
1188
|
+
if (n.length === 0 || $2(r) < 95) return false;
|
|
1189
|
+
let e = n.filter((c2) => G2(c2) && !Y(c2)).length, s2 = n.filter((c2) => !G2(c2) && !!Y(c2)).length;
|
|
1190
|
+
return e >= 1 && e >= s2;
|
|
1191
|
+
}
|
|
1192
|
+
function q2(r, n) {
|
|
1193
|
+
if (!Y(r)) return false;
|
|
1194
|
+
let e = E(r);
|
|
1195
|
+
return e ? n === "world" ? true : s3.has(e) : false;
|
|
1196
|
+
}
|
|
1197
|
+
function $2(r) {
|
|
1198
|
+
let n = C(r);
|
|
1199
|
+
if (n.length === 0) return 0;
|
|
1200
|
+
let e = 0;
|
|
1201
|
+
for (let s2 of n) G2(s2) && e++;
|
|
1202
|
+
return Math.round(e / n.length * 1e3) / 10;
|
|
1203
|
+
}
|
|
1204
|
+
function v2(r) {
|
|
1205
|
+
let n = C(r);
|
|
1206
|
+
if (n.length === 0) return 0;
|
|
1207
|
+
let e = 0;
|
|
1208
|
+
for (let s2 of n) Y(s2) && e++;
|
|
1209
|
+
return Math.round(e / n.length * 1e3) / 10;
|
|
1210
|
+
}
|
|
1211
|
+
function F3(r) {
|
|
1212
|
+
let n = /* @__PURE__ */ new Set();
|
|
1213
|
+
for (let e of r) {
|
|
1214
|
+
if (e == null) continue;
|
|
1215
|
+
let s2 = String(e).trim();
|
|
1216
|
+
if (!V(u(s2)) && !n.has(s2) && (n.add(s2), n.size >= U2)) break;
|
|
1217
|
+
}
|
|
1218
|
+
return Array.from(n);
|
|
1219
|
+
}
|
|
1220
|
+
function D2(r) {
|
|
1221
|
+
let n = F3(r);
|
|
1222
|
+
if (n.length === 0) return 0;
|
|
1223
|
+
let e = 0;
|
|
1224
|
+
for (let s2 of n) Z(s2).length > 0 && e++;
|
|
1225
|
+
return Math.round(e / n.length * 1e3) / 10;
|
|
1226
|
+
}
|
|
1227
|
+
function Z2(r, n) {
|
|
1228
|
+
return y2(n, rt) ? true : F3(r).some((e) => /^\d{5}(-\d{4})?$/.test(e.replace(/\.0+$/, "")));
|
|
1229
|
+
}
|
|
1230
|
+
function ne(r, n) {
|
|
1231
|
+
let e = C(r);
|
|
1232
|
+
if (e.length === 0) return 0;
|
|
1233
|
+
let s2 = 0;
|
|
1234
|
+
for (let c2 of e) p3(c2, n) && s2++;
|
|
1235
|
+
return Math.round(s2 / e.length * 1e3) / 10;
|
|
1236
|
+
}
|
|
1237
|
+
function z2(r, n) {
|
|
1238
|
+
let e = 0;
|
|
1239
|
+
for (let s2 of C(r)) n(s2) && e++;
|
|
1240
|
+
return e;
|
|
1241
|
+
}
|
|
1242
|
+
function oe(r, n) {
|
|
1243
|
+
let e = 0;
|
|
1244
|
+
for (let s2 of F3(r)) n(s2) && e++;
|
|
1245
|
+
return e;
|
|
1246
|
+
}
|
|
1247
|
+
function ie(r, n, e, s2, c2) {
|
|
1248
|
+
let A = [], u4 = [], o = {}, M = {}, _2 = new Set(r), l2 = (t) => n.map((i2) => i2[t]);
|
|
1249
|
+
for (let t of ["city", "country"]) {
|
|
1250
|
+
let i2 = e?.[t];
|
|
1251
|
+
i2 && _2.has(i2) && (o[t] = i2);
|
|
1252
|
+
}
|
|
1253
|
+
let X2 = new Set(c2 ?? r);
|
|
1254
|
+
for (let t of ["lat", "lon"]) {
|
|
1255
|
+
let i2 = e?.[t];
|
|
1256
|
+
i2 && X2.has(i2) && (o[t] = i2);
|
|
1257
|
+
}
|
|
1258
|
+
let g3 = e?.zip;
|
|
1259
|
+
if (g3 && _2.has(g3)) {
|
|
1260
|
+
let t = l2(g3), i2 = D2(t);
|
|
1261
|
+
i2 < 95 ? u4.push(`zip=${g3} (only ${i2}% of values read as ZIPs)`) : Z2(t, g3) ? o.zip = g3 : u4.push(`zip=${g3} (all values are 3-4 digits with nothing to say they are postal)`);
|
|
1262
|
+
}
|
|
1263
|
+
let p2 = e?.state;
|
|
1264
|
+
if (p2 && _2.has(p2)) {
|
|
1265
|
+
let t = l2(p2), i2 = C(t);
|
|
1266
|
+
i2.length > 0 && i2.every((a4) => q2(a4, s2)) ? u4.push(`state=${p2} (every value is "CA", which is both Canada and California)`) : P2(t) ? (u4.push(`state=${p2} (every value is a country, not a state)`), o.country || (o.country = p2)) : v2(t) < 95 ? u4.push(`state=${p2} (only ${v2(t)}% of values are states/provinces)`) : o.state = p2;
|
|
1267
|
+
}
|
|
1268
|
+
let d = new Set(Object.values(o).filter(Boolean)), x2 = r.filter((t) => !d.has(t) && !t.startsWith("__"));
|
|
1269
|
+
if (!o.state) {
|
|
1270
|
+
let t = null;
|
|
1271
|
+
for (let i2 of x2) {
|
|
1272
|
+
let a4 = l2(i2);
|
|
1273
|
+
if (P2(a4)) continue;
|
|
1274
|
+
let f4 = v2(a4);
|
|
1275
1275
|
if (f4 < 95) continue;
|
|
1276
|
-
let
|
|
1277
|
-
|
|
1276
|
+
let N2 = z2(a4, (S) => !!Y(S)), Y2 = z2(a4, (S) => !!Y(S) && !q2(S, s2));
|
|
1277
|
+
N2 < E2 && Y2 < 1 || (!t || f4 > t.pct) && (t = { name: i2, pct: f4 });
|
|
1278
1278
|
}
|
|
1279
|
-
|
|
1279
|
+
t && (o.state = t.name, d.add(t.name), A.push(`state=${t.name} (${t.pct}% states/provinces)`));
|
|
1280
1280
|
}
|
|
1281
|
-
if (!
|
|
1282
|
-
if (
|
|
1283
|
-
let
|
|
1284
|
-
if (!(
|
|
1285
|
-
|
|
1281
|
+
if (!o.zip) for (let t of x2) {
|
|
1282
|
+
if (d.has(t)) continue;
|
|
1283
|
+
let i2 = l2(t), a4 = D2(i2);
|
|
1284
|
+
if (!(a4 < 95) && Z2(i2, t) && !(oe(i2, (f4) => Z(f4).length > 0) < E2)) {
|
|
1285
|
+
o.zip = t, d.add(t), A.push(`zip=${t} (${a4}% 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 h2 = o.country;
|
|
1290
|
+
if (!h2 || !P2(l2(h2))) {
|
|
1291
|
+
let t = null;
|
|
1292
|
+
for (let i2 of x2) {
|
|
1293
|
+
if (d.has(i2) || !P2(l2(i2))) continue;
|
|
1294
|
+
let a4 = $2(l2(i2));
|
|
1295
|
+
(!t || a4 > t.pct) && (t = { name: i2, pct: a4 });
|
|
1296
1296
|
}
|
|
1297
|
-
|
|
1298
|
-
}
|
|
1299
|
-
if (!
|
|
1300
|
-
let
|
|
1301
|
-
for (let
|
|
1302
|
-
if (
|
|
1303
|
-
let
|
|
1304
|
-
f4 < m3 || z2(
|
|
1297
|
+
t && (h2 && (u4.push(`country=${h2} (only ${$2(l2(h2))}% of values are country identifiers; using ${t.name} instead)`), M.country = h2), o.country = t.name, d.add(t.name), A.push(`country=${t.name}`));
|
|
1298
|
+
}
|
|
1299
|
+
if (!o.city) {
|
|
1300
|
+
let t = null;
|
|
1301
|
+
for (let i2 of x2) {
|
|
1302
|
+
if (d.has(i2)) continue;
|
|
1303
|
+
let a4 = l2(i2), f4 = ne(a4, s2);
|
|
1304
|
+
f4 < m3 || z2(a4, (N2) => p3(N2, s2)) < E2 || (!t || f4 > t.pct) && (t = { name: i2, pct: f4 });
|
|
1305
1305
|
}
|
|
1306
|
-
|
|
1306
|
+
t && (o.city = t.name, A.push(`city=${t.name} (${t.pct}% known cities)`));
|
|
1307
1307
|
}
|
|
1308
|
-
let
|
|
1309
|
-
let
|
|
1310
|
-
return isFinite(
|
|
1308
|
+
let B2 = o.country ? l2(o.country) : [], k2 = !!o.country && P2(B2), j3 = k2 ? new Set(B2.map((t) => E(t == null ? null : String(t))).filter(Boolean)).size : 0, K2 = k2 && j3 >= 2, L2 = !!(o.lat && o.lon) && n.some((t) => {
|
|
1309
|
+
let i2 = +String(t[o.lat] ?? "").trim(), a4 = +String(t[o.lon] ?? "").trim();
|
|
1310
|
+
return isFinite(i2) && isFinite(a4) && i2 >= -90 && i2 <= 90 && a4 >= -180 && a4 <= 180 && String(t[o.lat] ?? "").trim() !== "" && String(t[o.lon] ?? "").trim() !== "";
|
|
1311
1311
|
});
|
|
1312
|
-
return
|
|
1312
|
+
return o.lat && o.lon && !L2 && u4.push(`lat/lon=${o.lat}/${o.lon} (no row holds a usable coordinate pair)`), o.country && !K2 && !(o.city || o.state || o.zip || L2) && u4.push(k2 ? `country=${o.country} (every row resolves to the same country - nothing to place apart)` : `country=${o.country} (values are not country identifiers)`), { bind: !!(o.city || o.state || o.zip || K2 || L2) ? o : null, backfilled: A, refused: u4, ...Object.keys(M).length ? { labelFallback: M } : {} };
|
|
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((c2) => !c2.isMeasure).map((c2) => c2.name);
|
|
1327
|
+
const res = ie(dims, rowObjs, bind, point?.mapKind, cols.map((c2) => c2.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 p2 = bind;
|
|
1337
|
+
const built = y3(rowObjs.map((r) => ({
|
|
1338
|
+
lat: p2.lat ? r[p2.lat] : null,
|
|
1339
|
+
lon: p2.lon ? r[p2.lon] : null,
|
|
1340
|
+
city: p2.city ? r[p2.city] : null,
|
|
1341
|
+
state: p2.state ? r[p2.state] : null,
|
|
1342
|
+
zip: p2.zip ? r[p2.zip] : null,
|
|
1343
|
+
country: p2.country ? r[p2.country] : null,
|
|
1344
|
+
label: labelCol ? r[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((c2) => c2.name);
|
|
1373
|
+
const o = resolvePointChannel(cols, rowObjs, point);
|
|
1374
|
+
const d = resolvePointChannel(cols, rowObjs, destination);
|
|
1375
|
+
const pLat = o.lat, pLon = o.lon, pPrec = o.prec;
|
|
1376
|
+
const dLat = d.lat, dLon = d.lon, dPrec = d.prec;
|
|
1377
|
+
const geoPoint = o.geoPoint;
|
|
1378
|
+
const geoPointDest = d.geoPoint;
|
|
1379
|
+
const rolesRefused = [...o.rolesRefused, ...d.rolesRefused.map((s2) => `destination: ${s2}`)];
|
|
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((r) => r[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 r = 0; r < rowObjs.length; r++) {
|
|
1392
|
+
const row = rowObjs[r];
|
|
1393
|
+
const a4 = new Array(cols.length + extra);
|
|
1394
|
+
for (let c2 = 0; c2 < cols.length; c2++) {
|
|
1395
|
+
const v3 = row[colNames[c2]];
|
|
1396
|
+
if (v3 instanceof Date) {
|
|
1397
|
+
a4[c2] = v3.toISOString();
|
|
1398
1398
|
} else {
|
|
1399
|
-
|
|
1399
|
+
a4[c2] = v3 ?? null;
|
|
1400
1400
|
}
|
|
1401
1401
|
}
|
|
1402
|
-
let
|
|
1403
|
-
|
|
1404
|
-
if (geoIso)
|
|
1402
|
+
let k2 = cols.length;
|
|
1403
|
+
a4[k2++] = r;
|
|
1404
|
+
if (geoIso) a4[k2++] = geoIso[r];
|
|
1405
1405
|
if (pLat && pLon) {
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1406
|
+
a4[k2++] = pLat[r];
|
|
1407
|
+
a4[k2++] = pLon[r];
|
|
1408
|
+
a4[k2++] = pPrec ? pPrec[r] : null;
|
|
1409
1409
|
}
|
|
1410
1410
|
if (dLat && dLon) {
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1411
|
+
a4[k2++] = dLat[r];
|
|
1412
|
+
a4[k2++] = dLon[r];
|
|
1413
|
+
a4[k2++] = dPrec ? dPrec[r] : null;
|
|
1414
1414
|
}
|
|
1415
|
-
out[
|
|
1415
|
+
out[r] = a4;
|
|
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,15 +1447,15 @@ 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 = (t) => {
|
|
1451
|
+
const E4 = doc?.defaultView?.Element ?? globalThis.Element;
|
|
1452
|
+
if (E4 && t instanceof E4) return true;
|
|
1453
|
+
return !!t && typeof t.closest === "function" && typeof t.getAttribute === "function";
|
|
1454
1454
|
};
|
|
1455
|
-
const viewStyle = (
|
|
1455
|
+
const viewStyle = (n) => {
|
|
1456
1456
|
try {
|
|
1457
1457
|
const gcs = doc?.defaultView?.getComputedStyle ?? (typeof getComputedStyle === "function" ? getComputedStyle : null);
|
|
1458
|
-
return gcs ? gcs(
|
|
1458
|
+
return gcs ? gcs(n).pointerEvents : "";
|
|
1459
1459
|
} catch {
|
|
1460
1460
|
return "";
|
|
1461
1461
|
}
|
|
@@ -1464,30 +1464,30 @@ function createMarkResolver(env) {
|
|
|
1464
1464
|
if (el.tagName.toLowerCase() !== "path") return false;
|
|
1465
1465
|
const f4 = el.getAttribute("fill");
|
|
1466
1466
|
if (f4 !== null && f4 !== "" && f4 !== "none" && f4 !== "transparent") return false;
|
|
1467
|
-
const
|
|
1467
|
+
const s2 = (el.getAttribute("stroke") || "").trim().toLowerCase();
|
|
1468
1468
|
const so = parseFloat(el.getAttribute("stroke-opacity") || "1");
|
|
1469
|
-
return
|
|
1469
|
+
return s2 === "transparent" || s2 === "none" || so <= 0.01;
|
|
1470
1470
|
};
|
|
1471
|
-
const distToPathCenterline = (el,
|
|
1472
|
-
const
|
|
1473
|
-
if (!(
|
|
1474
|
-
const
|
|
1475
|
-
if (!
|
|
1471
|
+
const distToPathCenterline = (el, x2, y4) => {
|
|
1472
|
+
const L2 = el.getTotalLength();
|
|
1473
|
+
if (!(L2 > 0)) return Number.MAX_VALUE;
|
|
1474
|
+
const m = el.getScreenCTM();
|
|
1475
|
+
if (!m) 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 N2 = 64;
|
|
1478
|
+
for (let i2 = 0; i2 <= N2; i2++) {
|
|
1479
|
+
const pt = el.getPointAtLength(L2 * i2 / N2);
|
|
1480
|
+
const dx = m.a * pt.x + m.c * pt.y + m.e - x2;
|
|
1481
|
+
const dy = m.b * pt.x + m.d * pt.y + m.f - y4;
|
|
1482
|
+
const d = dx * dx + dy * dy;
|
|
1483
|
+
if (d < best) best = d;
|
|
1484
1484
|
}
|
|
1485
1485
|
return Math.sqrt(best);
|
|
1486
1486
|
};
|
|
1487
|
-
const refineHitCorridor = (mark,
|
|
1487
|
+
const refineHitCorridor = (mark, x2, y4, 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(x2, y4);
|
|
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 d = distToPathCenterline(el, x2, y4);
|
|
1505
|
+
if (d < bestD) {
|
|
1506
|
+
bestD = d;
|
|
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 m = el.closest(sel);
|
|
1527
|
+
if (m && ev) return refineHitCorridor(m, ev.clientX, ev.clientY, sel);
|
|
1528
|
+
return m;
|
|
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 n = parseInt(tok.trim(), 10);
|
|
1537
|
+
if (!isNaN(n) && n >= 0) out.push(n);
|
|
1538
1538
|
}
|
|
1539
1539
|
return out;
|
|
1540
1540
|
};
|
|
1541
|
-
const penetrateOverlayAt = (
|
|
1541
|
+
const penetrateOverlayAt = (x2, y4, sel) => {
|
|
1542
1542
|
try {
|
|
1543
|
-
const stack = doc.elementsFromPoint(
|
|
1543
|
+
const stack = doc.elementsFromPoint(x2, y4);
|
|
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 = (x2, y4, 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 r = el.getBoundingClientRect ? el.getBoundingClientRect() : null;
|
|
1563
|
+
if (!r || r.width <= 0 || r.height <= 0) continue;
|
|
1564
|
+
if (x2 < r.left || x2 > r.right || y4 < r.top || y4 > r.bottom) continue;
|
|
1565
|
+
const area = r.width * r.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 n of all) {
|
|
1576
|
+
const tag = (n.tagName || "").toLowerCase();
|
|
1577
1577
|
if (!SHAPE.test(tag)) continue;
|
|
1578
|
-
const pe2 = viewStyle(
|
|
1578
|
+
const pe2 = viewStyle(n);
|
|
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(i2) {
|
|
1700
|
+
if (i2.contractUntagged) return false;
|
|
1701
|
+
if (i2.animated) return false;
|
|
1702
|
+
if (i2.authoredNoDataText) return false;
|
|
1703
|
+
if (!(i2.rows > 0)) return false;
|
|
1704
|
+
return i2.markCount === 0;
|
|
1705
1705
|
}
|
|
1706
1706
|
function blankRenderFlag(lang, cause) {
|
|
1707
|
-
const clean = (
|
|
1707
|
+
const clean = (s2) => String(s2 || "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 a4 = el.getAttribute?.(name);
|
|
1732
|
+
if (a4 !== null && a4 !== void 0 && String(a4).trim() !== "") return String(a4).trim();
|
|
1733
|
+
const c2 = cs?.[name === "stroke-width" ? "strokeWidth" : name];
|
|
1734
|
+
return c2 === null || c2 === void 0 ? "" : String(c2).trim();
|
|
1735
1735
|
}
|
|
1736
1736
|
function isUnfilled(fill) {
|
|
1737
1737
|
const f4 = fill.toLowerCase();
|
|
1738
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 m = /^(-?\d+(?:\.\d+)?)\s*(px)?$/i.exec(raw);
|
|
1742
|
+
if (!m) return NaN;
|
|
1743
|
+
const n = parseFloat(m[1]);
|
|
1744
|
+
return isFinite(n) ? n : 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 w2 = 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: w2, open, inert });
|
|
1765
|
+
if (isFinite(w2)) {
|
|
1766
1766
|
const prev = widestByGeom.get(geom);
|
|
1767
|
-
if (prev === void 0 ||
|
|
1767
|
+
if (prev === void 0 || w2 > prev) widestByGeom.set(geom, w2);
|
|
1768
1768
|
}
|
|
1769
1769
|
}
|
|
1770
1770
|
const out = { ...EMPTY2 };
|
|
1771
|
-
for (const
|
|
1772
|
-
if (!
|
|
1771
|
+
for (const r of rows) {
|
|
1772
|
+
if (!r.open) continue;
|
|
1773
1773
|
out.openStrokes++;
|
|
1774
|
-
if (
|
|
1774
|
+
if (r.inert) continue;
|
|
1775
1775
|
out.interactive++;
|
|
1776
|
-
if (isFinite(
|
|
1777
|
-
if (!(
|
|
1776
|
+
if (isFinite(r.w) && r.w > out.widestPx) out.widestPx = Math.round(r.w);
|
|
1777
|
+
if (!(r.w < MIN_HIT_BAND_PX)) continue;
|
|
1778
1778
|
out.hairline++;
|
|
1779
|
-
const best = widestByGeom.get(
|
|
1779
|
+
const best = widestByGeom.get(r.geom);
|
|
1780
1780
|
if (best === void 0 || best < MIN_HIT_BAND_PX) out.uncovered++;
|
|
1781
1781
|
}
|
|
1782
1782
|
return out;
|
|
@@ -1784,529 +1784,78 @@ function censusHitBands(container, doc) {
|
|
|
1784
1784
|
return EMPTY2;
|
|
1785
1785
|
}
|
|
1786
1786
|
}
|
|
1787
|
-
function hitBandFlag(
|
|
1788
|
-
if (
|
|
1789
|
-
return
|
|
1787
|
+
function hitBandFlag(c2) {
|
|
1788
|
+
if (c2.interactive === 0) return "";
|
|
1789
|
+
return c2.uncovered > 0 ? "hitband:d3:thin" : "hitband:d3:ok";
|
|
1790
1790
|
}
|
|
1791
1791
|
|
|
1792
|
-
//
|
|
1793
|
-
function
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
}
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
return
|
|
1818
|
-
}
|
|
1819
|
-
var
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
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
|
-
};
|
|
1792
|
+
// src/deltaE.ts
|
|
1793
|
+
function linearise(c2) {
|
|
1794
|
+
const v3 = c2 / 255;
|
|
1795
|
+
return v3 <= 0.04045 ? v3 / 12.92 : Math.pow((v3 + 0.055) / 1.055, 2.4);
|
|
1796
|
+
}
|
|
1797
|
+
var Xn = 0.95047;
|
|
1798
|
+
var Yn = 1;
|
|
1799
|
+
var Zn = 1.08883;
|
|
1800
|
+
var EPS = 216 / 24389;
|
|
1801
|
+
var KAPPA = 24389 / 27;
|
|
1802
|
+
function f2(t) {
|
|
1803
|
+
return t > EPS ? Math.cbrt(t) : (KAPPA * t + 16) / 116;
|
|
1804
|
+
}
|
|
1805
|
+
function rgbToLab(r, g3, b2) {
|
|
1806
|
+
const R = linearise(r), G3 = linearise(g3), B2 = linearise(b2);
|
|
1807
|
+
const X2 = 0.4124564 * R + 0.3575761 * G3 + 0.1804375 * B2;
|
|
1808
|
+
const Y2 = 0.2126729 * R + 0.7151522 * G3 + 0.072175 * B2;
|
|
1809
|
+
const Z3 = 0.0193339 * R + 0.119192 * G3 + 0.9503041 * B2;
|
|
1810
|
+
const fx = f2(X2 / Xn), fy = f2(Y2 / Yn), fz = f2(Z3 / Zn);
|
|
1811
|
+
return { L: 116 * fy - 16, a: 500 * (fx - fy), b: 200 * (fy - fz) };
|
|
1812
|
+
}
|
|
1813
|
+
function hexToLab(hex2) {
|
|
1814
|
+
const m = /^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(hex2.trim());
|
|
1815
|
+
if (!m) return null;
|
|
1816
|
+
const h2 = m[1].length === 3 ? m[1][0] + m[1][0] + m[1][1] + m[1][1] + m[1][2] + m[1][2] : m[1];
|
|
1817
|
+
return rgbToLab(parseInt(h2.slice(0, 2), 16), parseInt(h2.slice(2, 4), 16), parseInt(h2.slice(4, 6), 16));
|
|
1818
|
+
}
|
|
1819
|
+
var RAD = Math.PI / 180;
|
|
1820
|
+
var DEG = 180 / Math.PI;
|
|
1821
|
+
var NEUTRAL_CHROMA = 1e-4;
|
|
1822
|
+
function deltaE2000(c1, c2) {
|
|
1823
|
+
const C1 = Math.hypot(c1.a, c1.b), C2 = Math.hypot(c2.a, c2.b);
|
|
1824
|
+
const Cbar = (C1 + C2) / 2;
|
|
1825
|
+
const C7 = Math.pow(Cbar, 7);
|
|
1826
|
+
const G3 = 0.5 * (1 - Math.sqrt(C7 / (C7 + Math.pow(25, 7))));
|
|
1827
|
+
const a1p = (1 + G3) * c1.a, a2p = (1 + G3) * c2.a;
|
|
1828
|
+
const C1p = Math.hypot(a1p, c1.b), C2p = Math.hypot(a2p, c2.b);
|
|
1829
|
+
const neutral = C1p < NEUTRAL_CHROMA || C2p < NEUTRAL_CHROMA;
|
|
1830
|
+
const h1p = C1p < NEUTRAL_CHROMA ? 0 : (Math.atan2(c1.b, a1p) * DEG + 360) % 360;
|
|
1831
|
+
const h2p = C2p < NEUTRAL_CHROMA ? 0 : (Math.atan2(c2.b, a2p) * DEG + 360) % 360;
|
|
1832
|
+
const dLp = c2.L - c1.L;
|
|
1833
|
+
const dCp = C2p - C1p;
|
|
1834
|
+
let dhp;
|
|
1835
|
+
if (neutral) dhp = 0;
|
|
1836
|
+
else if (Math.abs(h2p - h1p) <= 180) dhp = h2p - h1p;
|
|
1837
|
+
else if (h2p - h1p > 180) dhp = h2p - h1p - 360;
|
|
1838
|
+
else dhp = h2p - h1p + 360;
|
|
1839
|
+
const dHp = 2 * Math.sqrt(C1p * C2p) * Math.sin(dhp / 2 * RAD);
|
|
1840
|
+
const Lbarp = (c1.L + c2.L) / 2;
|
|
1841
|
+
const Cbarp = (C1p + C2p) / 2;
|
|
1842
|
+
let hbarp;
|
|
1843
|
+
if (neutral) hbarp = h1p + h2p;
|
|
1844
|
+
else if (Math.abs(h1p - h2p) <= 180) hbarp = (h1p + h2p) / 2;
|
|
1845
|
+
else if (h1p + h2p < 360) hbarp = (h1p + h2p + 360) / 2;
|
|
1846
|
+
else hbarp = (h1p + h2p - 360) / 2;
|
|
1847
|
+
const T3 = 1 - 0.17 * Math.cos((hbarp - 30) * RAD) + 0.24 * Math.cos(2 * hbarp * RAD) + 0.32 * Math.cos((3 * hbarp + 6) * RAD) - 0.2 * Math.cos((4 * hbarp - 63) * RAD);
|
|
1848
|
+
const dTheta = 30 * Math.exp(-Math.pow((hbarp - 275) / 25, 2));
|
|
1849
|
+
const Cbarp7 = Math.pow(Cbarp, 7);
|
|
1850
|
+
const RC = 2 * Math.sqrt(Cbarp7 / (Cbarp7 + Math.pow(25, 7)));
|
|
1851
|
+
const RT = -RC * Math.sin(2 * dTheta * RAD);
|
|
1852
|
+
const Lm50 = Math.pow(Lbarp - 50, 2);
|
|
1853
|
+
const SL = 1 + 0.015 * Lm50 / Math.sqrt(20 + Lm50);
|
|
1854
|
+
const SC = 1 + 0.045 * Cbarp;
|
|
1855
|
+
const SH = 1 + 0.015 * Cbarp * T3;
|
|
1856
|
+
const tL = dLp / SL, tC = dCp / SC, tH = dHp / SH;
|
|
1857
|
+
return Math.sqrt(tL * tL + tC * tC + tH * tH + RT * tC * tH);
|
|
1996
1858
|
}
|
|
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
1859
|
|
|
2311
1860
|
// src/colourSpread.ts
|
|
2312
1861
|
var SAME_SHADE_DELTA_E = 5;
|
|
@@ -2326,28 +1875,28 @@ function styleOf2(el, doc) {
|
|
|
2326
1875
|
}
|
|
2327
1876
|
}
|
|
2328
1877
|
function fillOf(el, cs) {
|
|
2329
|
-
const
|
|
2330
|
-
if (
|
|
2331
|
-
const
|
|
2332
|
-
return
|
|
1878
|
+
const a4 = el.getAttribute?.("fill");
|
|
1879
|
+
if (a4 !== null && a4 !== void 0 && String(a4).trim() !== "") return String(a4).trim();
|
|
1880
|
+
const c2 = cs?.fill;
|
|
1881
|
+
return c2 === null || c2 === void 0 ? "" : String(c2).trim();
|
|
2333
1882
|
}
|
|
2334
1883
|
function toRgb(raw) {
|
|
2335
|
-
const
|
|
2336
|
-
if (!
|
|
2337
|
-
const hex2 = /^#([0-9a-f]{3}|[0-9a-f]{6})$/.exec(
|
|
1884
|
+
const s2 = raw.trim().toLowerCase();
|
|
1885
|
+
if (!s2 || s2 === "none" || s2 === "transparent") return null;
|
|
1886
|
+
const hex2 = /^#([0-9a-f]{3}|[0-9a-f]{6})$/.exec(s2);
|
|
2338
1887
|
if (hex2) {
|
|
2339
|
-
const
|
|
2340
|
-
const full =
|
|
1888
|
+
const h2 = hex2[1];
|
|
1889
|
+
const full = h2.length === 3 ? h2[0] + h2[0] + h2[1] + h2[1] + h2[2] + h2[2] : h2;
|
|
2341
1890
|
return [
|
|
2342
1891
|
parseInt(full.slice(0, 2), 16),
|
|
2343
1892
|
parseInt(full.slice(2, 4), 16),
|
|
2344
1893
|
parseInt(full.slice(4, 6), 16)
|
|
2345
1894
|
];
|
|
2346
1895
|
}
|
|
2347
|
-
const
|
|
2348
|
-
if (!
|
|
2349
|
-
if (
|
|
2350
|
-
return [Math.round(parseFloat(
|
|
1896
|
+
const m = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)\s*(?:[,/]\s*([\d.]+)\s*)?\)$/.exec(s2);
|
|
1897
|
+
if (!m) return null;
|
|
1898
|
+
if (m[4] !== void 0 && parseFloat(m[4]) === 0) return null;
|
|
1899
|
+
return [Math.round(parseFloat(m[1])), Math.round(parseFloat(m[2])), Math.round(parseFloat(m[3]))];
|
|
2351
1900
|
}
|
|
2352
1901
|
function cellKey(rgb) {
|
|
2353
1902
|
return [
|
|
@@ -2357,7 +1906,7 @@ function cellKey(rgb) {
|
|
|
2357
1906
|
].join(",");
|
|
2358
1907
|
}
|
|
2359
1908
|
function hex(rgb) {
|
|
2360
|
-
return "#" + rgb.map((
|
|
1909
|
+
return "#" + rgb.map((v3) => Math.max(0, Math.min(255, v3)).toString(16).padStart(2, "0")).join("");
|
|
2361
1910
|
}
|
|
2362
1911
|
function censusColourSpread(container, doc) {
|
|
2363
1912
|
if (!container || typeof container.querySelectorAll !== "function") return EMPTY3;
|
|
@@ -2375,44 +1924,44 @@ function censusColourSpread(container, doc) {
|
|
|
2375
1924
|
if (!rgb) continue;
|
|
2376
1925
|
marks++;
|
|
2377
1926
|
distinct.add(rgb.join(","));
|
|
2378
|
-
const
|
|
2379
|
-
const cur = cells.get(
|
|
1927
|
+
const k2 = cellKey(rgb);
|
|
1928
|
+
const cur = cells.get(k2);
|
|
2380
1929
|
if (cur) cur.n++;
|
|
2381
|
-
else cells.set(
|
|
1930
|
+
else cells.set(k2, { rgb, n: 1 });
|
|
2382
1931
|
}
|
|
2383
1932
|
if (marks < MIN_MARKS || distinct.size < MIN_RAMP_FILLS) return EMPTY3;
|
|
2384
|
-
const top = [...cells.values()].sort((
|
|
2385
|
-
const cs = top.map((
|
|
1933
|
+
const top = [...cells.values()].sort((a4, b2) => b2.n - a4.n).slice(0, MAX_CELLS);
|
|
1934
|
+
const cs = top.map((c2) => hexToLab(hex(c2.rgb))).filter((l2) => l2 !== null);
|
|
2386
1935
|
if (cs.length < MIN_RAMP_FILLS) return EMPTY3;
|
|
2387
|
-
const
|
|
1936
|
+
const d = cs.map(() => new Array(cs.length).fill(0));
|
|
2388
1937
|
let span = 0, lo = 0, hi = 1;
|
|
2389
|
-
for (let
|
|
2390
|
-
for (let
|
|
2391
|
-
const
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
if (
|
|
2395
|
-
span =
|
|
2396
|
-
lo =
|
|
2397
|
-
hi =
|
|
1938
|
+
for (let i2 = 0; i2 < cs.length; i2++) {
|
|
1939
|
+
for (let j3 = i2 + 1; j3 < cs.length; j3++) {
|
|
1940
|
+
const v3 = deltaE2000(cs[i2], cs[j3]);
|
|
1941
|
+
d[i2][j3] = v3;
|
|
1942
|
+
d[j3][i2] = v3;
|
|
1943
|
+
if (v3 > span) {
|
|
1944
|
+
span = v3;
|
|
1945
|
+
lo = i2;
|
|
1946
|
+
hi = j3;
|
|
2398
1947
|
}
|
|
2399
1948
|
}
|
|
2400
1949
|
}
|
|
2401
1950
|
if (span <= 0) return EMPTY3;
|
|
2402
1951
|
let slack = 0, interior = 0;
|
|
2403
|
-
for (let
|
|
2404
|
-
if (
|
|
2405
|
-
slack += (
|
|
1952
|
+
for (let i2 = 0; i2 < cs.length; i2++) {
|
|
1953
|
+
if (i2 === lo || i2 === hi) continue;
|
|
1954
|
+
slack += (d[lo][i2] + d[i2][hi]) / span - 1;
|
|
2406
1955
|
interior++;
|
|
2407
1956
|
}
|
|
2408
1957
|
if (interior < 2 || slack / interior > RAMP_SLACK_MAX) return EMPTY3;
|
|
2409
1958
|
let crowd = 0;
|
|
2410
|
-
for (let
|
|
2411
|
-
let
|
|
2412
|
-
for (let
|
|
2413
|
-
if (
|
|
1959
|
+
for (let i2 = 0; i2 < cs.length; i2++) {
|
|
1960
|
+
let n = 0;
|
|
1961
|
+
for (let j3 = 0; j3 < cs.length; j3++) {
|
|
1962
|
+
if (i2 === j3 || d[i2][j3] <= SAME_SHADE_DELTA_E) n += top[j3].n;
|
|
2414
1963
|
}
|
|
2415
|
-
if (
|
|
1964
|
+
if (n > crowd) crowd = n;
|
|
2416
1965
|
}
|
|
2417
1966
|
return {
|
|
2418
1967
|
marks,
|
|
@@ -2424,9 +1973,9 @@ function censusColourSpread(container, doc) {
|
|
|
2424
1973
|
return EMPTY3;
|
|
2425
1974
|
}
|
|
2426
1975
|
}
|
|
2427
|
-
function colourSpreadFlag(
|
|
2428
|
-
if (
|
|
2429
|
-
return "ramp:d3:crowd" + Math.min(80, Math.floor(
|
|
1976
|
+
function colourSpreadFlag(c2) {
|
|
1977
|
+
if (c2.marks === 0) return "";
|
|
1978
|
+
return "ramp:d3:crowd" + Math.min(80, Math.floor(c2.crowdShare / 20) * 20);
|
|
2430
1979
|
}
|
|
2431
1980
|
|
|
2432
1981
|
// src/fit.ts
|
|
@@ -2438,16 +1987,16 @@ function needsScroll(contentPx, viewportPx, slackPx = SCROLL_SLACK_PX) {
|
|
|
2438
1987
|
}
|
|
2439
1988
|
function contentExtentOf(boxes) {
|
|
2440
1989
|
if (!boxes || boxes.length === 0) return { w: 0, h: 0, source: "none" };
|
|
2441
|
-
const usable = boxes.filter((
|
|
1990
|
+
const usable = boxes.filter((b2) => b2 && isFinite(b2.right) && isFinite(b2.bottom) && (b2.right > 0 || b2.bottom > 0));
|
|
2442
1991
|
if (usable.length === 0) return { w: 0, h: 0, source: "none" };
|
|
2443
|
-
const inFlow = usable.filter((
|
|
1992
|
+
const inFlow = usable.filter((b2) => !b2.floating);
|
|
2444
1993
|
const counted = inFlow.length > 0 ? inFlow : usable;
|
|
2445
|
-
let
|
|
2446
|
-
for (const
|
|
2447
|
-
if (
|
|
2448
|
-
if (
|
|
1994
|
+
let w2 = 0, h2 = 0;
|
|
1995
|
+
for (const b2 of counted) {
|
|
1996
|
+
if (b2.right > w2) w2 = b2.right;
|
|
1997
|
+
if (b2.bottom > h2) h2 = b2.bottom;
|
|
2449
1998
|
}
|
|
2450
|
-
return { w:
|
|
1999
|
+
return { w: w2, h: h2, source: inFlow.length > 0 ? "in-flow" : "all-floating" };
|
|
2451
2000
|
}
|
|
2452
2001
|
function scrollFitFor(contentW, contentH, viewportW, viewportH, slackPx = SCROLL_SLACK_PX) {
|
|
2453
2002
|
return {
|
|
@@ -2457,8 +2006,8 @@ function scrollFitFor(contentW, contentH, viewportW, viewportH, slackPx = SCROLL
|
|
|
2457
2006
|
}
|
|
2458
2007
|
var FIT_CONTENT_SELECTOR = "text, .d3-mark, .d3-legend-mark";
|
|
2459
2008
|
var PHANTOM_FRACTION = 0.95;
|
|
2460
|
-
function isPhantomBox(
|
|
2461
|
-
return
|
|
2009
|
+
function isPhantomBox(w2, h2, refW, refH) {
|
|
2010
|
+
return w2 > refW * PHANTOM_FRACTION || h2 > refH * PHANTOM_FRACTION;
|
|
2462
2011
|
}
|
|
2463
2012
|
var MAX_FRAME_GROW_FACTOR = 20;
|
|
2464
2013
|
function planFrameGrow(inkBottomPx, elHeightPx, viewBoxH, ctmScale, slackPx = SCROLL_SLACK_PX, maxFactor = MAX_FRAME_GROW_FACTOR) {
|
|
@@ -2479,8 +2028,8 @@ var AXIS_PIN_TRACK_REACH_PX = 12;
|
|
|
2479
2028
|
function isHorizontalLabelRow(boxes) {
|
|
2480
2029
|
if (!boxes || boxes.length < 2) return false;
|
|
2481
2030
|
let minX = Infinity, maxX = -Infinity, minY = Infinity, maxY = -Infinity;
|
|
2482
|
-
for (const
|
|
2483
|
-
const cx = (
|
|
2031
|
+
for (const b2 of boxes) {
|
|
2032
|
+
const cx = (b2.left + b2.right) / 2, cy = (b2.top + b2.bottom) / 2;
|
|
2484
2033
|
if (!isFinite(cx) || !isFinite(cy)) return false;
|
|
2485
2034
|
if (cx < minX) minX = cx;
|
|
2486
2035
|
if (cx > maxX) maxX = cx;
|
|
@@ -2492,18 +2041,18 @@ function isHorizontalLabelRow(boxes) {
|
|
|
2492
2041
|
function labelBand(boxes, tracks = [], pad = AXIS_PIN_BAND_PAD_PX, trackReach = AXIS_PIN_TRACK_REACH_PX) {
|
|
2493
2042
|
if (!boxes || boxes.length === 0) return null;
|
|
2494
2043
|
let top = Infinity, bottom = -Infinity;
|
|
2495
|
-
for (const
|
|
2496
|
-
if (!isFinite(
|
|
2497
|
-
if (
|
|
2498
|
-
if (
|
|
2044
|
+
for (const b2 of boxes) {
|
|
2045
|
+
if (!isFinite(b2.top) || !isFinite(b2.bottom)) continue;
|
|
2046
|
+
if (b2.top < top) top = b2.top;
|
|
2047
|
+
if (b2.bottom > bottom) bottom = b2.bottom;
|
|
2499
2048
|
}
|
|
2500
2049
|
if (!isFinite(top) || !isFinite(bottom) || bottom <= top) return null;
|
|
2501
|
-
for (const
|
|
2502
|
-
if (!isFinite(
|
|
2503
|
-
const gap =
|
|
2050
|
+
for (const t of tracks || []) {
|
|
2051
|
+
if (!isFinite(t.top) || !isFinite(t.bottom)) continue;
|
|
2052
|
+
const gap = t.bottom < top ? top - t.bottom : t.top > bottom ? t.top - bottom : 0;
|
|
2504
2053
|
if (gap > trackReach) continue;
|
|
2505
|
-
if (
|
|
2506
|
-
if (
|
|
2054
|
+
if (t.top < top) top = t.top;
|
|
2055
|
+
if (t.bottom > bottom) bottom = t.bottom;
|
|
2507
2056
|
}
|
|
2508
2057
|
return { top: top - pad, bottom: bottom + pad };
|
|
2509
2058
|
}
|
|
@@ -2511,11 +2060,11 @@ function planAxisPin(candidates, viewportH, minLabels = AXIS_PIN_MIN_LABELS, max
|
|
|
2511
2060
|
const none = (reason) => ({ pin: false, index: -1, band: null, reason });
|
|
2512
2061
|
if (!isFinite(viewportH) || viewportH <= 0) return none("unmeasurable");
|
|
2513
2062
|
let sawAxis = false, best = null;
|
|
2514
|
-
for (const
|
|
2515
|
-
if (!
|
|
2063
|
+
for (const c2 of candidates || []) {
|
|
2064
|
+
if (!c2 || !c2.labels || c2.labels.length < minLabels) continue;
|
|
2516
2065
|
sawAxis = true;
|
|
2517
|
-
if (!isHorizontalLabelRow(
|
|
2518
|
-
if (!best ||
|
|
2066
|
+
if (!isHorizontalLabelRow(c2.labels)) continue;
|
|
2067
|
+
if (!best || c2.labels.length > best.labels.length) best = c2;
|
|
2519
2068
|
}
|
|
2520
2069
|
if (!best) return none(sawAxis ? "vertical-only" : "no-axis");
|
|
2521
2070
|
const band = labelBand(best.labels, best.tracks || []);
|
|
@@ -2533,10 +2082,10 @@ function axisPinPlacement(band, scrollTop, viewportH) {
|
|
|
2533
2082
|
|
|
2534
2083
|
// src/fitDom.ts
|
|
2535
2084
|
var FIT_WALK_CAP = 8e3;
|
|
2536
|
-
function ctmScaleOf(
|
|
2537
|
-
if (!
|
|
2538
|
-
const
|
|
2539
|
-
return isFinite(
|
|
2085
|
+
function ctmScaleOf(m) {
|
|
2086
|
+
if (!m) return 0;
|
|
2087
|
+
const s2 = Math.hypot(m.a, m.b);
|
|
2088
|
+
return isFinite(s2) && s2 > 0 ? s2 : 0;
|
|
2540
2089
|
}
|
|
2541
2090
|
function svgInkReach(svg) {
|
|
2542
2091
|
try {
|
|
@@ -2544,13 +2093,13 @@ function svgInkReach(svg) {
|
|
|
2544
2093
|
if (!(box.width > 0) || !(box.height > 0)) return null;
|
|
2545
2094
|
const els = svg.querySelectorAll(FIT_CONTENT_SELECTOR);
|
|
2546
2095
|
let right = -Infinity, bottom = -Infinity, seen = 0;
|
|
2547
|
-
for (let
|
|
2548
|
-
const
|
|
2549
|
-
if (
|
|
2550
|
-
if (isPhantomBox(
|
|
2096
|
+
for (let i2 = 0; i2 < els.length && seen < FIT_WALK_CAP; i2++) {
|
|
2097
|
+
const r = els[i2].getBoundingClientRect();
|
|
2098
|
+
if (r.width <= 0 && r.height <= 0) continue;
|
|
2099
|
+
if (isPhantomBox(r.width, r.height, box.width, box.height)) continue;
|
|
2551
2100
|
seen++;
|
|
2552
|
-
if (
|
|
2553
|
-
if (
|
|
2101
|
+
if (r.right > right) right = r.right;
|
|
2102
|
+
if (r.bottom > bottom) bottom = r.bottom;
|
|
2554
2103
|
}
|
|
2555
2104
|
if (seen === 0) return null;
|
|
2556
2105
|
return { right: right - box.left, bottom: bottom - box.top };
|
|
@@ -2558,13 +2107,13 @@ function svgInkReach(svg) {
|
|
|
2558
2107
|
return null;
|
|
2559
2108
|
}
|
|
2560
2109
|
}
|
|
2561
|
-
function measureContainerBoxes(
|
|
2110
|
+
function measureContainerBoxes(c2, inkOf) {
|
|
2562
2111
|
const boxes = [];
|
|
2563
|
-
if (!
|
|
2564
|
-
const view =
|
|
2565
|
-
const cRect =
|
|
2566
|
-
for (let
|
|
2567
|
-
const el =
|
|
2112
|
+
if (!c2 || !c2.children) return boxes;
|
|
2113
|
+
const view = c2.ownerDocument && c2.ownerDocument.defaultView || globalThis;
|
|
2114
|
+
const cRect = c2.getBoundingClientRect();
|
|
2115
|
+
for (let i2 = 0; i2 < c2.children.length; i2++) {
|
|
2116
|
+
const el = c2.children[i2];
|
|
2568
2117
|
let floating = false;
|
|
2569
2118
|
try {
|
|
2570
2119
|
const cs = view.getComputedStyle(el);
|
|
@@ -2572,15 +2121,15 @@ function measureContainerBoxes(c4, inkOf) {
|
|
|
2572
2121
|
floating = cs.position === "absolute" || cs.position === "fixed";
|
|
2573
2122
|
} catch {
|
|
2574
2123
|
}
|
|
2575
|
-
const
|
|
2576
|
-
let right =
|
|
2577
|
-
let bottom =
|
|
2124
|
+
const r = el.getBoundingClientRect();
|
|
2125
|
+
let right = r.right - cRect.left - c2.clientLeft + c2.scrollLeft;
|
|
2126
|
+
let bottom = r.bottom - cRect.top - c2.clientTop + c2.scrollTop;
|
|
2578
2127
|
if (inkOf) {
|
|
2579
2128
|
try {
|
|
2580
2129
|
const ink = inkOf(el);
|
|
2581
2130
|
if (ink) {
|
|
2582
|
-
const originX =
|
|
2583
|
-
const originY =
|
|
2131
|
+
const originX = r.left - cRect.left - c2.clientLeft + c2.scrollLeft;
|
|
2132
|
+
const originY = r.top - cRect.top - c2.clientTop + c2.scrollTop;
|
|
2584
2133
|
if (isFinite(ink.right)) right = Math.max(right, originX + ink.right);
|
|
2585
2134
|
if (isFinite(ink.bottom)) bottom = Math.max(bottom, originY + ink.bottom);
|
|
2586
2135
|
}
|
|
@@ -2591,14 +2140,14 @@ function measureContainerBoxes(c4, inkOf) {
|
|
|
2591
2140
|
}
|
|
2592
2141
|
return boxes;
|
|
2593
2142
|
}
|
|
2594
|
-
function fitReadingFor(lane,
|
|
2595
|
-
if (!
|
|
2596
|
-
const viewW =
|
|
2143
|
+
function fitReadingFor(lane, c2, slackPx = SCROLL_SLACK_PX, inkOf) {
|
|
2144
|
+
if (!c2) return null;
|
|
2145
|
+
const viewW = c2.clientWidth, viewH = c2.clientHeight;
|
|
2597
2146
|
if (!(viewW > 0) || !(viewH > 0)) return null;
|
|
2598
|
-
const boxes = measureContainerBoxes(
|
|
2147
|
+
const boxes = measureContainerBoxes(c2, inkOf);
|
|
2599
2148
|
const extent = contentExtentOf(boxes);
|
|
2600
|
-
const contentW = extent.source === "none" ?
|
|
2601
|
-
const contentH = extent.source === "none" ?
|
|
2149
|
+
const contentW = extent.source === "none" ? c2.scrollWidth : extent.w;
|
|
2150
|
+
const contentH = extent.source === "none" ? c2.scrollHeight : extent.h;
|
|
2602
2151
|
if (!isFinite(contentW) || !isFinite(contentH)) return null;
|
|
2603
2152
|
return {
|
|
2604
2153
|
lane,
|
|
@@ -2610,9 +2159,9 @@ function fitReadingFor(lane, c4, slackPx = SCROLL_SLACK_PX, inkOf) {
|
|
|
2610
2159
|
overflowsY: needsScroll(contentH, viewH, slackPx),
|
|
2611
2160
|
extentSource: extent.source,
|
|
2612
2161
|
boxes: boxes.length,
|
|
2613
|
-
floating: boxes.filter((
|
|
2614
|
-
scrollW:
|
|
2615
|
-
scrollH:
|
|
2162
|
+
floating: boxes.filter((b2) => b2.floating).length,
|
|
2163
|
+
scrollW: c2.scrollWidth,
|
|
2164
|
+
scrollH: c2.scrollHeight
|
|
2616
2165
|
};
|
|
2617
2166
|
}
|
|
2618
2167
|
var noPin = (reason) => ({ pinned: false, reason, bandPx: 0, axisAt: "", labels: 0, carried: 0, edge: null });
|
|
@@ -2621,14 +2170,14 @@ var SVG_NS2 = "http://www.w3.org/2000/svg";
|
|
|
2621
2170
|
var AXIS_PIN_MAX_CARRIED = 12;
|
|
2622
2171
|
function unpinScrolledAxis(container) {
|
|
2623
2172
|
if (!container) return;
|
|
2624
|
-
const
|
|
2625
|
-
if (!
|
|
2173
|
+
const st = container[CONTAINER_SLOT_AXIS_PIN];
|
|
2174
|
+
if (!st) return;
|
|
2626
2175
|
try {
|
|
2627
|
-
container.removeEventListener("scroll",
|
|
2176
|
+
container.removeEventListener("scroll", st.onScroll);
|
|
2628
2177
|
} catch {
|
|
2629
2178
|
}
|
|
2630
2179
|
try {
|
|
2631
|
-
if (
|
|
2180
|
+
if (st.overlay.parentNode) st.overlay.parentNode.removeChild(st.overlay);
|
|
2632
2181
|
} catch {
|
|
2633
2182
|
}
|
|
2634
2183
|
try {
|
|
@@ -2636,10 +2185,10 @@ function unpinScrolledAxis(container) {
|
|
|
2636
2185
|
} catch {
|
|
2637
2186
|
}
|
|
2638
2187
|
}
|
|
2639
|
-
function textHidden(
|
|
2640
|
-
if (
|
|
2188
|
+
function textHidden(t, view) {
|
|
2189
|
+
if (t.getAttribute("display") === "none" || t.getAttribute("visibility") === "hidden") return true;
|
|
2641
2190
|
try {
|
|
2642
|
-
const cs = view.getComputedStyle(
|
|
2191
|
+
const cs = view.getComputedStyle(t);
|
|
2643
2192
|
if (cs && (cs.display === "none" || cs.visibility === "hidden")) return true;
|
|
2644
2193
|
} catch {
|
|
2645
2194
|
}
|
|
@@ -2648,17 +2197,17 @@ function textHidden(t2, view) {
|
|
|
2648
2197
|
function backdropFill(svg, container, view, svgBox) {
|
|
2649
2198
|
try {
|
|
2650
2199
|
const rects = svg.querySelectorAll("rect");
|
|
2651
|
-
for (let
|
|
2652
|
-
const
|
|
2653
|
-
if (
|
|
2654
|
-
const
|
|
2655
|
-
if (
|
|
2200
|
+
for (let i2 = 0; i2 < rects.length && i2 < 6; i2++) {
|
|
2201
|
+
const r = rects[i2];
|
|
2202
|
+
if (r.closest(".d3-mark")) continue;
|
|
2203
|
+
const b2 = r.getBoundingClientRect();
|
|
2204
|
+
if (b2.width >= svgBox.width * 0.9 && b2.height >= svgBox.height * 0.9) {
|
|
2656
2205
|
let fill = "";
|
|
2657
2206
|
try {
|
|
2658
|
-
fill = view.getComputedStyle(
|
|
2207
|
+
fill = view.getComputedStyle(r).fill || "";
|
|
2659
2208
|
} catch {
|
|
2660
2209
|
}
|
|
2661
|
-
if (!fill || fill === "none") fill =
|
|
2210
|
+
if (!fill || fill === "none") fill = r.getAttribute("fill") || "";
|
|
2662
2211
|
if (fill && fill !== "none" && fill !== "transparent") return fill;
|
|
2663
2212
|
break;
|
|
2664
2213
|
}
|
|
@@ -2677,20 +2226,20 @@ function backdropFill(svg, container, view, svgBox) {
|
|
|
2677
2226
|
}
|
|
2678
2227
|
function cloneWithChain(el, svg, root) {
|
|
2679
2228
|
const chain = [];
|
|
2680
|
-
let
|
|
2681
|
-
while (
|
|
2682
|
-
chain.unshift(
|
|
2683
|
-
|
|
2229
|
+
let n = el.parentElement;
|
|
2230
|
+
while (n && n !== svg) {
|
|
2231
|
+
chain.unshift(n);
|
|
2232
|
+
n = n.parentElement;
|
|
2684
2233
|
}
|
|
2685
2234
|
let parent = root;
|
|
2686
2235
|
for (const anc of chain) {
|
|
2687
|
-
const
|
|
2688
|
-
parent.appendChild(
|
|
2689
|
-
parent =
|
|
2236
|
+
const c2 = anc.cloneNode(false);
|
|
2237
|
+
parent.appendChild(c2);
|
|
2238
|
+
parent = c2;
|
|
2690
2239
|
}
|
|
2691
2240
|
parent.appendChild(el.cloneNode(true));
|
|
2692
2241
|
const ids = root.querySelectorAll("[id]");
|
|
2693
|
-
for (let
|
|
2242
|
+
for (let i2 = 0; i2 < ids.length; i2++) ids[i2].removeAttribute("id");
|
|
2694
2243
|
}
|
|
2695
2244
|
function pinScrolledAxis(container, svg) {
|
|
2696
2245
|
unpinScrolledAxis(container);
|
|
@@ -2701,21 +2250,21 @@ function pinScrolledAxis(container, svg) {
|
|
|
2701
2250
|
const view = doc && doc.defaultView || globalThis;
|
|
2702
2251
|
const svgBox = svg.getBoundingClientRect();
|
|
2703
2252
|
if (!(svgBox.width > 0) || !(svgBox.height > 0)) return noPin("unmeasurable");
|
|
2704
|
-
const
|
|
2705
|
-
if (!
|
|
2253
|
+
const m = typeof svg.getScreenCTM === "function" ? svg.getScreenCTM() : null;
|
|
2254
|
+
if (!m || !(m.a > 0) || !(m.d > 0) || !isFinite(m.e) || !isFinite(m.f)) return noPin("no-ctm");
|
|
2706
2255
|
const viewportH = container.clientHeight;
|
|
2707
2256
|
if (!(viewportH > 0)) return noPin("unmeasurable");
|
|
2708
|
-
const rel = (
|
|
2257
|
+
const rel = (r) => ({ left: r.left - svgBox.left, top: r.top - svgBox.top, right: r.right - svgBox.left, bottom: r.bottom - svgBox.top });
|
|
2709
2258
|
const ticks = svg.querySelectorAll(".tick");
|
|
2710
2259
|
const byAxis = /* @__PURE__ */ new Map();
|
|
2711
|
-
for (let
|
|
2712
|
-
const
|
|
2713
|
-
if (
|
|
2714
|
-
const
|
|
2715
|
-
if (!
|
|
2716
|
-
const list = byAxis.get(
|
|
2717
|
-
if (list) list.push(
|
|
2718
|
-
else byAxis.set(
|
|
2260
|
+
for (let i2 = 0; i2 < ticks.length; i2++) {
|
|
2261
|
+
const t = ticks[i2];
|
|
2262
|
+
if (t.closest("svg") !== svg) continue;
|
|
2263
|
+
const p2 = t.parentElement;
|
|
2264
|
+
if (!p2) continue;
|
|
2265
|
+
const list = byAxis.get(p2);
|
|
2266
|
+
if (list) list.push(t);
|
|
2267
|
+
else byAxis.set(p2, [t]);
|
|
2719
2268
|
}
|
|
2720
2269
|
const axes = [];
|
|
2721
2270
|
const cands = [];
|
|
@@ -2724,16 +2273,16 @@ function pinScrolledAxis(container, svg) {
|
|
|
2724
2273
|
for (const tick of group) {
|
|
2725
2274
|
const txt = tick.querySelector("text");
|
|
2726
2275
|
if (!txt || textHidden(txt, view)) continue;
|
|
2727
|
-
const
|
|
2728
|
-
if (!(
|
|
2729
|
-
labels.push(rel(
|
|
2276
|
+
const r = txt.getBoundingClientRect();
|
|
2277
|
+
if (!(r.width > 0) || !(r.height > 0)) continue;
|
|
2278
|
+
labels.push(rel(r));
|
|
2730
2279
|
}
|
|
2731
2280
|
const tracks = [];
|
|
2732
|
-
for (let
|
|
2733
|
-
const ch = axis2.children[
|
|
2281
|
+
for (let i2 = 0; i2 < axis2.children.length; i2++) {
|
|
2282
|
+
const ch = axis2.children[i2];
|
|
2734
2283
|
if (ch.tagName.toLowerCase() !== "path" || !(ch.getAttribute("class") || "").split(/\s+/).includes("domain")) continue;
|
|
2735
|
-
const
|
|
2736
|
-
if (
|
|
2284
|
+
const r = ch.getBoundingClientRect();
|
|
2285
|
+
if (r.width > 0 && r.height <= 4) tracks.push(rel(r));
|
|
2737
2286
|
}
|
|
2738
2287
|
cands.push({ index: axes.length, labels, tracks });
|
|
2739
2288
|
axes.push(axis2);
|
|
@@ -2746,24 +2295,24 @@ function pinScrolledAxis(container, svg) {
|
|
|
2746
2295
|
if (!(bandPx > 0)) return noPin("unmeasurable");
|
|
2747
2296
|
const carried = [];
|
|
2748
2297
|
const texts = svg.querySelectorAll("text");
|
|
2749
|
-
for (let
|
|
2750
|
-
const
|
|
2751
|
-
if (
|
|
2752
|
-
if (
|
|
2753
|
-
if (axis.contains(
|
|
2754
|
-
const
|
|
2755
|
-
if (!(
|
|
2756
|
-
if (
|
|
2298
|
+
for (let i2 = 0; i2 < texts.length && carried.length < AXIS_PIN_MAX_CARRIED; i2++) {
|
|
2299
|
+
const t = texts[i2];
|
|
2300
|
+
if (t.closest("svg") !== svg) continue;
|
|
2301
|
+
if (t.closest(".tick") || t.closest(".d3-mark") || t.closest(".d3-legend-mark")) continue;
|
|
2302
|
+
if (axis.contains(t) || textHidden(t, view)) continue;
|
|
2303
|
+
const r = rel(t.getBoundingClientRect());
|
|
2304
|
+
if (!(r.right > r.left) || !(r.bottom > r.top)) continue;
|
|
2305
|
+
if (r.top >= band.top && r.bottom <= band.bottom) carried.push(t);
|
|
2757
2306
|
}
|
|
2758
2307
|
const pinSvg = doc.createElementNS(SVG_NS2, "svg");
|
|
2759
|
-
for (const
|
|
2760
|
-
const
|
|
2761
|
-
if (
|
|
2308
|
+
for (const a4 of ["font-family", "font-size", "font-weight", "font", "fill", "color", "text-rendering"]) {
|
|
2309
|
+
const v3 = svg.getAttribute(a4);
|
|
2310
|
+
if (v3) pinSvg.setAttribute(a4, v3);
|
|
2762
2311
|
}
|
|
2763
2312
|
const styles = svg.querySelectorAll("style");
|
|
2764
|
-
for (let
|
|
2765
|
-
const vbX = (svgBox.left -
|
|
2766
|
-
const vbW = svgBox.width /
|
|
2313
|
+
for (let i2 = 0; i2 < styles.length; i2++) pinSvg.appendChild(styles[i2].cloneNode(true));
|
|
2314
|
+
const vbX = (svgBox.left - m.e) / m.a, vbY = (svgBox.top + band.top - m.f) / m.d;
|
|
2315
|
+
const vbW = svgBox.width / m.a, vbH = bandPx / m.d;
|
|
2767
2316
|
pinSvg.setAttribute("viewBox", `${vbX} ${vbY} ${vbW} ${vbH}`);
|
|
2768
2317
|
pinSvg.setAttribute("preserveAspectRatio", "none");
|
|
2769
2318
|
pinSvg.setAttribute("width", String(svgBox.width));
|
|
@@ -2779,20 +2328,20 @@ function pinScrolledAxis(container, svg) {
|
|
|
2779
2328
|
back.setAttribute("fill", backdropFill(svg, container, view, svgBox));
|
|
2780
2329
|
pinSvg.appendChild(back);
|
|
2781
2330
|
cloneWithChain(axis, svg, pinSvg);
|
|
2782
|
-
for (const
|
|
2331
|
+
for (const t of carried) cloneWithChain(t, svg, pinSvg);
|
|
2783
2332
|
const overlay = doc.createElement("div");
|
|
2784
2333
|
overlay.setAttribute("data-bic-axis-pin", "1");
|
|
2785
|
-
const
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2334
|
+
const o = overlay.style;
|
|
2335
|
+
o.position = "absolute";
|
|
2336
|
+
o.margin = "0";
|
|
2337
|
+
o.padding = "0";
|
|
2338
|
+
o.border = "0";
|
|
2339
|
+
o.width = `${svgBox.width}px`;
|
|
2340
|
+
o.height = `${bandPx}px`;
|
|
2341
|
+
o.overflow = "hidden";
|
|
2342
|
+
o.pointerEvents = "none";
|
|
2343
|
+
o.zIndex = "3";
|
|
2344
|
+
o.display = "none";
|
|
2796
2345
|
overlay.appendChild(pinSvg);
|
|
2797
2346
|
try {
|
|
2798
2347
|
const cs = view.getComputedStyle(container);
|
|
@@ -2806,15 +2355,15 @@ function pinScrolledAxis(container, svg) {
|
|
|
2806
2355
|
const svgTop = svgBox.top - cRect.top - container.clientTop + container.scrollTop;
|
|
2807
2356
|
const contentBand = { top: svgTop + band.top, bottom: svgTop + band.bottom };
|
|
2808
2357
|
const place = () => {
|
|
2809
|
-
const
|
|
2810
|
-
const edge2 = axisPinPlacement(contentBand,
|
|
2358
|
+
const st = container.scrollTop, vh = container.clientHeight;
|
|
2359
|
+
const edge2 = axisPinPlacement(contentBand, st, vh);
|
|
2811
2360
|
if (!edge2) {
|
|
2812
|
-
|
|
2361
|
+
o.display = "none";
|
|
2813
2362
|
return null;
|
|
2814
2363
|
}
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2364
|
+
o.display = "block";
|
|
2365
|
+
o.left = `${svgLeft}px`;
|
|
2366
|
+
o.top = `${edge2 === "top" ? st : st + vh - bandPx}px`;
|
|
2818
2367
|
return edge2;
|
|
2819
2368
|
};
|
|
2820
2369
|
const onScroll = () => {
|
|
@@ -2861,8 +2410,8 @@ function fitRenderedChart(container, opts = {}) {
|
|
|
2861
2410
|
if (!container) return result;
|
|
2862
2411
|
try {
|
|
2863
2412
|
let svg = null;
|
|
2864
|
-
for (let
|
|
2865
|
-
const el = container.children[
|
|
2413
|
+
for (let i2 = 0; i2 < container.children.length && !svg; i2++) {
|
|
2414
|
+
const el = container.children[i2];
|
|
2866
2415
|
if (el.tagName && el.tagName.toLowerCase() === "svg") svg = el;
|
|
2867
2416
|
}
|
|
2868
2417
|
if (!svg) svg = container.querySelector("svg");
|
|
@@ -2891,8 +2440,8 @@ function fitRenderedChart(container, opts = {}) {
|
|
|
2891
2440
|
if (plan.grow) {
|
|
2892
2441
|
svg.setAttribute("height", String(plan.heightPx));
|
|
2893
2442
|
if (vb > 0) {
|
|
2894
|
-
const
|
|
2895
|
-
svg.setAttribute("viewBox", `${
|
|
2443
|
+
const b2 = svg.viewBox.baseVal;
|
|
2444
|
+
svg.setAttribute("viewBox", `${b2.x} ${b2.y} ${b2.width} ${plan.viewBoxH}`);
|
|
2896
2445
|
}
|
|
2897
2446
|
result.grew = true;
|
|
2898
2447
|
}
|
|
@@ -2934,15 +2483,15 @@ function fitRenderedChart(container, opts = {}) {
|
|
|
2934
2483
|
}
|
|
2935
2484
|
|
|
2936
2485
|
// src/labelContrast.ts
|
|
2937
|
-
function parseRGBA(
|
|
2938
|
-
if (typeof
|
|
2939
|
-
const
|
|
2940
|
-
const
|
|
2941
|
-
if (
|
|
2942
|
-
let
|
|
2943
|
-
if (
|
|
2944
|
-
if (
|
|
2945
|
-
return [parseInt(
|
|
2486
|
+
function parseRGBA(c2) {
|
|
2487
|
+
if (typeof c2 !== "string") return null;
|
|
2488
|
+
const s2 = c2.trim();
|
|
2489
|
+
const m = s2.match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*(?:,\s*([\d.]+)\s*)?\)$/i);
|
|
2490
|
+
if (m) return [parseFloat(m[1]), parseFloat(m[2]), parseFloat(m[3]), m[4] !== void 0 ? parseFloat(m[4]) : 1];
|
|
2491
|
+
let h2 = s2.replace(/^#/, "");
|
|
2492
|
+
if (h2.length === 3) h2 = h2.split("").map((ch) => ch + ch).join("");
|
|
2493
|
+
if (h2.length === 6 && /^[0-9a-fA-F]{6}$/.test(h2)) {
|
|
2494
|
+
return [parseInt(h2.slice(0, 2), 16), parseInt(h2.slice(2, 4), 16), parseInt(h2.slice(4, 6), 16), 1];
|
|
2946
2495
|
}
|
|
2947
2496
|
return null;
|
|
2948
2497
|
}
|
|
@@ -2953,8 +2502,8 @@ var WHITE_TEXT_BG_LUM = 0.5;
|
|
|
2953
2502
|
var PILL_MIN_ALPHA = 0.05;
|
|
2954
2503
|
var PILL_OPAQUE_ALPHA = 0.85;
|
|
2955
2504
|
var PAGE_MATCH_TOLERANCE = 2;
|
|
2956
|
-
function isPillBackdropAlpha(
|
|
2957
|
-
return
|
|
2505
|
+
function isPillBackdropAlpha(a4) {
|
|
2506
|
+
return a4 >= PILL_MIN_ALPHA && a4 < PILL_OPAQUE_ALPHA;
|
|
2958
2507
|
}
|
|
2959
2508
|
var PILL_MIN_COVERAGE = 0.6;
|
|
2960
2509
|
function pillBacksGlyph(overlapArea, glyphArea) {
|
|
@@ -2975,30 +2524,30 @@ var NAMED = {
|
|
|
2975
2524
|
none: [0, 0, 0, 0],
|
|
2976
2525
|
transparent: [0, 0, 0, 0]
|
|
2977
2526
|
};
|
|
2978
|
-
function toRGBA(
|
|
2979
|
-
if (typeof
|
|
2980
|
-
const
|
|
2981
|
-
if (
|
|
2982
|
-
return parseRGBA(
|
|
2527
|
+
function toRGBA(c2) {
|
|
2528
|
+
if (typeof c2 !== "string") return null;
|
|
2529
|
+
const k2 = c2.trim().toLowerCase();
|
|
2530
|
+
if (k2 in NAMED) return NAMED[k2];
|
|
2531
|
+
return parseRGBA(c2);
|
|
2983
2532
|
}
|
|
2984
2533
|
function compositeOver(fg, bg) {
|
|
2985
|
-
const
|
|
2534
|
+
const a4 = Math.max(0, Math.min(1, fg[3]));
|
|
2986
2535
|
return [
|
|
2987
|
-
Math.round(fg[0] *
|
|
2988
|
-
Math.round(fg[1] *
|
|
2989
|
-
Math.round(fg[2] *
|
|
2536
|
+
Math.round(fg[0] * a4 + bg[0] * (1 - a4)),
|
|
2537
|
+
Math.round(fg[1] * a4 + bg[1] * (1 - a4)),
|
|
2538
|
+
Math.round(fg[2] * a4 + bg[2] * (1 - a4))
|
|
2990
2539
|
];
|
|
2991
2540
|
}
|
|
2992
2541
|
function relativeLuminance(rgb) {
|
|
2993
|
-
const lin = rgb.map((
|
|
2994
|
-
const
|
|
2995
|
-
return
|
|
2542
|
+
const lin = rgb.map((v3) => {
|
|
2543
|
+
const s2 = v3 / 255;
|
|
2544
|
+
return s2 <= 0.03928 ? s2 / 12.92 : Math.pow((s2 + 0.055) / 1.055, 2.4);
|
|
2996
2545
|
});
|
|
2997
2546
|
return 0.2126 * lin[0] + 0.7152 * lin[1] + 0.0722 * lin[2];
|
|
2998
2547
|
}
|
|
2999
|
-
function contrastRatio(l1,
|
|
3000
|
-
const hi = Math.max(l1,
|
|
3001
|
-
const lo = Math.min(l1,
|
|
2548
|
+
function contrastRatio(l1, l2) {
|
|
2549
|
+
const hi = Math.max(l1, l2);
|
|
2550
|
+
const lo = Math.min(l1, l2);
|
|
3002
2551
|
return (hi + 0.05) / (lo + 0.05);
|
|
3003
2552
|
}
|
|
3004
2553
|
function decideLabelColor(textColor, fill, fillOpacity, pageBg, minContrast = MIN_CONTRAST, normalize = false) {
|
|
@@ -3025,27 +2574,27 @@ function decideLabelColor(textColor, fill, fillOpacity, pageBg, minContrast = MI
|
|
|
3025
2574
|
return useLight ? { fix: true, color: LIGHT_TEXT, reason: "fixed-light" } : { fix: true, color: DARK_TEXT, reason: "fixed-dark" };
|
|
3026
2575
|
}
|
|
3027
2576
|
var GLYPH_SAMPLE_N = 3;
|
|
3028
|
-
function glyphSampleGrid(box,
|
|
2577
|
+
function glyphSampleGrid(box, n = GLYPH_SAMPLE_N) {
|
|
3029
2578
|
const out = [];
|
|
3030
|
-
if (!box || !(box.width > 0) || !(box.height > 0) || !(
|
|
3031
|
-
const
|
|
3032
|
-
for (let
|
|
3033
|
-
for (let
|
|
2579
|
+
if (!box || !(box.width > 0) || !(box.height > 0) || !(n >= 1)) return out;
|
|
2580
|
+
const k2 = Math.floor(n);
|
|
2581
|
+
for (let i2 = 0; i2 < k2; i2++) {
|
|
2582
|
+
for (let j3 = 0; j3 < k2; j3++) {
|
|
3034
2583
|
out.push({
|
|
3035
|
-
x: box.left + box.width * (
|
|
3036
|
-
y: box.top + box.height * (
|
|
2584
|
+
x: box.left + box.width * (i2 + 0.5) / k2,
|
|
2585
|
+
y: box.top + box.height * (j3 + 0.5) / k2
|
|
3037
2586
|
});
|
|
3038
2587
|
}
|
|
3039
2588
|
}
|
|
3040
2589
|
return out;
|
|
3041
2590
|
}
|
|
3042
|
-
function clamp01(
|
|
3043
|
-
if (typeof
|
|
3044
|
-
return Math.max(0, Math.min(1,
|
|
2591
|
+
function clamp01(v3) {
|
|
2592
|
+
if (typeof v3 !== "number" || !isFinite(v3)) return 1;
|
|
2593
|
+
return Math.max(0, Math.min(1, v3));
|
|
3045
2594
|
}
|
|
3046
2595
|
function hexToRGB(hex2) {
|
|
3047
|
-
const
|
|
3048
|
-
return [
|
|
2596
|
+
const p2 = toRGBA(hex2);
|
|
2597
|
+
return [p2[0], p2[1], p2[2]];
|
|
3049
2598
|
}
|
|
3050
2599
|
|
|
3051
2600
|
// src/labelContrastDom.ts
|
|
@@ -3056,17 +2605,17 @@ function backedSamples(el, pts) {
|
|
|
3056
2605
|
try {
|
|
3057
2606
|
const ge2 = el;
|
|
3058
2607
|
if (typeof ge2.isPointInFill !== "function" || typeof ge2.getScreenCTM !== "function") return null;
|
|
3059
|
-
const
|
|
2608
|
+
const m = ge2.getScreenCTM();
|
|
3060
2609
|
const svg = ge2.ownerSVGElement;
|
|
3061
|
-
if (!
|
|
2610
|
+
if (!m || !svg || typeof svg.createSVGPoint !== "function") return null;
|
|
3062
2611
|
if (pts.length === 0) return null;
|
|
3063
|
-
const inv =
|
|
2612
|
+
const inv = m.inverse();
|
|
3064
2613
|
const hit = [];
|
|
3065
|
-
for (let
|
|
3066
|
-
const
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
hit.push(ge2.isPointInFill(
|
|
2614
|
+
for (let i2 = 0; i2 < pts.length; i2++) {
|
|
2615
|
+
const p2 = svg.createSVGPoint();
|
|
2616
|
+
p2.x = pts[i2].x;
|
|
2617
|
+
p2.y = pts[i2].y;
|
|
2618
|
+
hit.push(ge2.isPointInFill(p2.matrixTransform(inv)));
|
|
3070
2619
|
}
|
|
3071
2620
|
return hit;
|
|
3072
2621
|
} catch {
|
|
@@ -3087,8 +2636,8 @@ function applyLabelContrast(container, opts = {}) {
|
|
|
3087
2636
|
const pushShape = (el) => {
|
|
3088
2637
|
const tag = el.tagName.toLowerCase();
|
|
3089
2638
|
if (tag !== "rect" && tag !== "path") return;
|
|
3090
|
-
const
|
|
3091
|
-
if (
|
|
2639
|
+
const r = el.getBoundingClientRect();
|
|
2640
|
+
if (r.width <= 0 || r.height <= 0) return;
|
|
3092
2641
|
let fill = el.getAttribute("fill") || "";
|
|
3093
2642
|
const win2 = container.ownerDocument?.defaultView;
|
|
3094
2643
|
if ((!fill || fill === "none") && win2 && typeof win2.getComputedStyle === "function") {
|
|
@@ -3097,7 +2646,7 @@ function applyLabelContrast(container, opts = {}) {
|
|
|
3097
2646
|
if (!fill || fill === "none") return;
|
|
3098
2647
|
const opAttr = el.getAttribute("fill-opacity");
|
|
3099
2648
|
const op = opAttr === null ? 1 : parseFloat(opAttr);
|
|
3100
|
-
rects.push({ r
|
|
2649
|
+
rects.push({ r, fill, op: isFinite(op) ? op : 1, area: r.width * r.height, el, ord: ord++ });
|
|
3101
2650
|
};
|
|
3102
2651
|
const shapeEls = container.querySelectorAll("rect, path");
|
|
3103
2652
|
if (shapeEls.length === 0) {
|
|
@@ -3108,7 +2657,7 @@ function applyLabelContrast(container, opts = {}) {
|
|
|
3108
2657
|
report.skipped = "too-many-shapes";
|
|
3109
2658
|
return report;
|
|
3110
2659
|
}
|
|
3111
|
-
for (let
|
|
2660
|
+
for (let i2 = 0; i2 < shapeEls.length; i2++) pushShape(shapeEls[i2]);
|
|
3112
2661
|
if (rects.length === 0) {
|
|
3113
2662
|
report.skipped = "no-shapes";
|
|
3114
2663
|
return report;
|
|
@@ -3117,8 +2666,8 @@ function applyLabelContrast(container, opts = {}) {
|
|
|
3117
2666
|
const pageRGBA = toRGBA(pageBg) || [255, 255, 255, 1];
|
|
3118
2667
|
const pageRGB = [pageRGBA[0], pageRGBA[1], pageRGBA[2]];
|
|
3119
2668
|
const effAlpha = (mk) => {
|
|
3120
|
-
const
|
|
3121
|
-
return (
|
|
2669
|
+
const c2 = toRGBA(mk.fill);
|
|
2670
|
+
return (c2 ? c2[3] : 1) * mk.op;
|
|
3122
2671
|
};
|
|
3123
2672
|
const texts = container.querySelectorAll("text");
|
|
3124
2673
|
if (texts.length > CAP) {
|
|
@@ -3126,47 +2675,47 @@ function applyLabelContrast(container, opts = {}) {
|
|
|
3126
2675
|
return report;
|
|
3127
2676
|
}
|
|
3128
2677
|
const win = container.ownerDocument?.defaultView;
|
|
3129
|
-
for (let
|
|
3130
|
-
const tx = texts[
|
|
2678
|
+
for (let t = 0; t < texts.length; t++) {
|
|
2679
|
+
const tx = texts[t];
|
|
3131
2680
|
if (tx.getAttribute(LABEL_CONTRAST_DONE_ATTR) === "1") continue;
|
|
3132
2681
|
const tr = tx.getBoundingClientRect();
|
|
3133
2682
|
if (tr.width <= 0 || tr.height <= 0) continue;
|
|
3134
|
-
const ovArea = (
|
|
2683
|
+
const ovArea = (r) => Math.max(0, Math.min(r.right, tr.right) - Math.max(r.left, tr.left)) * Math.max(0, Math.min(r.bottom, tr.bottom) - Math.max(r.top, tr.top));
|
|
3135
2684
|
const glyphArea = tr.width * tr.height;
|
|
3136
|
-
const boxed = rects.map((mk) => ({ mk, ov: ovArea(mk.r) })).filter((
|
|
2685
|
+
const boxed = rects.map((mk) => ({ mk, ov: ovArea(mk.r) })).filter((x2) => x2.ov > 0);
|
|
3137
2686
|
const pts = glyphSampleGrid({ left: tr.left, top: tr.top, width: tr.width, height: tr.height });
|
|
3138
2687
|
const painted = pts.map(() => false);
|
|
3139
2688
|
let unmeasured = 0;
|
|
3140
|
-
const under = boxed.map((
|
|
3141
|
-
const mask = backedSamples(
|
|
2689
|
+
const under = boxed.map((x2) => {
|
|
2690
|
+
const mask = backedSamples(x2.mk.el, pts);
|
|
3142
2691
|
if (mask === null) {
|
|
3143
2692
|
unmeasured++;
|
|
3144
|
-
return
|
|
2693
|
+
return x2;
|
|
3145
2694
|
}
|
|
3146
2695
|
let inside = 0;
|
|
3147
|
-
const paints = effAlpha(
|
|
3148
|
-
for (let
|
|
3149
|
-
if (!mask[
|
|
2696
|
+
const paints = effAlpha(x2.mk) >= PILL_MIN_ALPHA;
|
|
2697
|
+
for (let i2 = 0; i2 < mask.length; i2++) {
|
|
2698
|
+
if (!mask[i2]) continue;
|
|
3150
2699
|
inside++;
|
|
3151
|
-
if (paints) painted[
|
|
2700
|
+
if (paints) painted[i2] = true;
|
|
3152
2701
|
}
|
|
3153
|
-
return { mk:
|
|
3154
|
-
}).filter((
|
|
2702
|
+
return { mk: x2.mk, ov: glyphArea * (inside / mask.length) };
|
|
2703
|
+
}).filter((x2) => x2.ov > 0);
|
|
3155
2704
|
if (under.length === 0 && boxed.length > 0) report.offFill++;
|
|
3156
2705
|
if (under.length === 0) continue;
|
|
3157
2706
|
if (unmeasured === 0 && pts.length > 0) {
|
|
3158
2707
|
let held = 0;
|
|
3159
|
-
for (let
|
|
2708
|
+
for (let i2 = 0; i2 < painted.length; i2++) if (painted[i2]) held++;
|
|
3160
2709
|
if (!backingHoldsGlyph(glyphArea * (held / pts.length), glyphArea)) {
|
|
3161
2710
|
report.pageMajority++;
|
|
3162
2711
|
continue;
|
|
3163
2712
|
}
|
|
3164
2713
|
}
|
|
3165
2714
|
report.scanned++;
|
|
3166
|
-
const opaqueUnder = under.filter((
|
|
3167
|
-
const cellEntry = (opaqueUnder.length ? opaqueUnder : under).reduce((
|
|
2715
|
+
const opaqueUnder = under.filter((x2) => effAlpha(x2.mk) >= PILL_OPAQUE_ALPHA);
|
|
2716
|
+
const cellEntry = (opaqueUnder.length ? opaqueUnder : under).reduce((a4, b2) => b2.ov > a4.ov || b2.ov === a4.ov && b2.mk.ord > a4.mk.ord ? b2 : a4);
|
|
3168
2717
|
const cell = cellEntry.mk;
|
|
3169
|
-
const pill = under.find((
|
|
2718
|
+
const pill = under.find((x2) => x2.mk !== cell && isPillBackdropAlpha(effAlpha(x2.mk)) && x2.mk.ord > cell.ord && pillBacksGlyph(x2.ov, glyphArea))?.mk;
|
|
3170
2719
|
const cellRGBA = toRGBA(cell.fill);
|
|
3171
2720
|
let bgRGB = cellRGBA ? compositeOver([cellRGBA[0], cellRGBA[1], cellRGBA[2], cellRGBA[3] * cell.op], pageRGB) : pageRGB;
|
|
3172
2721
|
if (pill) {
|
|
@@ -3180,12 +2729,12 @@ function applyLabelContrast(container, opts = {}) {
|
|
|
3180
2729
|
}
|
|
3181
2730
|
const cur = tx.getAttribute("fill") || (win && typeof win.getComputedStyle === "function" ? win.getComputedStyle(tx).fill : "");
|
|
3182
2731
|
const normalize = !cellSuppressesNormalize(cell.el.getAttribute("class"));
|
|
3183
|
-
const
|
|
3184
|
-
if (
|
|
3185
|
-
tx.setAttribute("fill",
|
|
2732
|
+
const d = decideLabelColor(cur, `rgb(${bgRGB[0]}, ${bgRGB[1]}, ${bgRGB[2]})`, 1, pageBg, MIN_CONTRAST, normalize);
|
|
2733
|
+
if (d.fix) {
|
|
2734
|
+
tx.setAttribute("fill", d.color);
|
|
3186
2735
|
report.fixed++;
|
|
3187
2736
|
}
|
|
3188
|
-
if (pill ||
|
|
2737
|
+
if (pill || d.fix) tx.setAttribute(LABEL_CONTRAST_DONE_ATTR, "1");
|
|
3189
2738
|
}
|
|
3190
2739
|
return report;
|
|
3191
2740
|
} catch {
|
|
@@ -3203,7 +2752,7 @@ function sessionViewStateProvider(container) {
|
|
|
3203
2752
|
load: () => store,
|
|
3204
2753
|
save: (next) => {
|
|
3205
2754
|
if (!next || typeof next !== "object") return;
|
|
3206
|
-
for (const
|
|
2755
|
+
for (const k2 of Object.keys(store)) delete store[k2];
|
|
3207
2756
|
Object.assign(store, next);
|
|
3208
2757
|
}
|
|
3209
2758
|
};
|
|
@@ -3212,7 +2761,7 @@ function noopViewStateProvider() {
|
|
|
3212
2761
|
return { load: () => ({}), save: () => {
|
|
3213
2762
|
} };
|
|
3214
2763
|
}
|
|
3215
|
-
var parseRowIdxs = (
|
|
2764
|
+
var parseRowIdxs = (s2) => (s2 || "").split(",").map((x2) => parseInt(x2, 10)).filter((n) => Number.isFinite(n));
|
|
3216
2765
|
var D3_PLUGIN_PACKAGES = {
|
|
3217
2766
|
sankey: "d3-sankey",
|
|
3218
2767
|
sankeyLinkHorizontal: "d3-sankey",
|
|
@@ -3227,8 +2776,8 @@ var D3_PLUGIN_PACKAGES = {
|
|
|
3227
2776
|
};
|
|
3228
2777
|
function requiredD3Plugins(code) {
|
|
3229
2778
|
const out = /* @__PURE__ */ new Set();
|
|
3230
|
-
for (const
|
|
3231
|
-
const pkg = D3_PLUGIN_PACKAGES[
|
|
2779
|
+
for (const m of String(code || "").matchAll(/\bd3\s*\.\s*(\w+)\s*\(/g)) {
|
|
2780
|
+
const pkg = D3_PLUGIN_PACKAGES[m[1]];
|
|
3232
2781
|
if (pkg) out.add(pkg);
|
|
3233
2782
|
}
|
|
3234
2783
|
return [...out].sort();
|
|
@@ -3240,8 +2789,8 @@ function explainRenderFailure(err, d3) {
|
|
|
3240
2789
|
"[@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
|
|
3241
2790
|
);
|
|
3242
2791
|
}
|
|
3243
|
-
const
|
|
3244
|
-
const name =
|
|
2792
|
+
const m = /d3\.(\w+) is not a function|(\w+) is not a function/.exec(msg);
|
|
2793
|
+
const name = m?.[1] ?? m?.[2] ?? "";
|
|
3245
2794
|
const pkg = D3_PLUGIN_PACKAGES[name];
|
|
3246
2795
|
if (pkg) {
|
|
3247
2796
|
return new Error(
|
|
@@ -3265,8 +2814,8 @@ function compileRenderFn(code, win, doc, d3) {
|
|
|
3265
2814
|
let factory;
|
|
3266
2815
|
try {
|
|
3267
2816
|
factory = new Function("container", "data", "options", "window", "document", "d3", body);
|
|
3268
|
-
} catch (
|
|
3269
|
-
const msg = String(
|
|
2817
|
+
} catch (e) {
|
|
2818
|
+
const msg = String(e?.message ?? e ?? "");
|
|
3270
2819
|
const modular = /\bimport\b|\bexport\b/.test(String(code || ""));
|
|
3271
2820
|
throw new Error(
|
|
3272
2821
|
"[@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
|
|
@@ -3283,7 +2832,7 @@ function createChartHost(container, config) {
|
|
|
3283
2832
|
let data = config.data;
|
|
3284
2833
|
{
|
|
3285
2834
|
const stamped = config.data?.meta?.hostContract;
|
|
3286
|
-
const major = (
|
|
2835
|
+
const major = (v3) => (v3 || "").split(".")[0];
|
|
3287
2836
|
if (stamped && major(stamped) !== major(HOST_CONTRACT_VERSION)) {
|
|
3288
2837
|
try {
|
|
3289
2838
|
(win?.console ?? console)?.warn(
|
|
@@ -3305,10 +2854,10 @@ function createChartHost(container, config) {
|
|
|
3305
2854
|
if (raw.uiState && typeof raw.uiState === "object" && Object.keys(bag).length === 0)
|
|
3306
2855
|
Object.assign(bag, raw.uiState);
|
|
3307
2856
|
raw.uiState = bag;
|
|
3308
|
-
raw.setUiState = (
|
|
3309
|
-
if (!
|
|
2857
|
+
raw.setUiState = (s2) => {
|
|
2858
|
+
if (!s2 || typeof s2 !== "object") return;
|
|
3310
2859
|
try {
|
|
3311
|
-
provider.save(
|
|
2860
|
+
provider.save(s2);
|
|
3312
2861
|
} catch {
|
|
3313
2862
|
}
|
|
3314
2863
|
};
|
|
@@ -3325,9 +2874,9 @@ function createChartHost(container, config) {
|
|
|
3325
2874
|
const ensureAffordanceStyles = () => {
|
|
3326
2875
|
try {
|
|
3327
2876
|
if (!doc || doc.getElementById("bic-chart-host-affordances")) return;
|
|
3328
|
-
const
|
|
3329
|
-
|
|
3330
|
-
|
|
2877
|
+
const st = doc.createElement("style");
|
|
2878
|
+
st.id = "bic-chart-host-affordances";
|
|
2879
|
+
st.textContent = `
|
|
3331
2880
|
/* TYPOGRAPHY FIREWALL. Generated charts set font-size but almost never line-height or
|
|
3332
2881
|
letter-spacing, so they INHERIT whatever the host page cascades in. A page with
|
|
3333
2882
|
\`:root { font: 18px/145% }\` (the stock Vite template does exactly this) hands every
|
|
@@ -3376,7 +2925,7 @@ function createChartHost(container, config) {
|
|
|
3376
2925
|
font-weight: 700 !important;
|
|
3377
2926
|
text-decoration: underline !important;
|
|
3378
2927
|
}`;
|
|
3379
|
-
(doc.head || doc.documentElement)?.appendChild(
|
|
2928
|
+
(doc.head || doc.documentElement)?.appendChild(st);
|
|
3380
2929
|
} catch {
|
|
3381
2930
|
}
|
|
3382
2931
|
};
|
|
@@ -3387,15 +2936,15 @@ function createChartHost(container, config) {
|
|
|
3387
2936
|
const dim = active && !selectionIsPeriod;
|
|
3388
2937
|
container.classList?.[dim ? "add" : "remove"](SELECTION_ACTIVE_CLASS);
|
|
3389
2938
|
const lit = container.querySelectorAll(`.${ACTIVE_TICK_CLASS}`);
|
|
3390
|
-
for (const
|
|
2939
|
+
for (const t of Array.from(lit)) t.classList?.remove(ACTIVE_TICK_CLASS);
|
|
3391
2940
|
const tickStillDrawn = !!activeTickEl && (typeof container.contains === "function" ? container.contains(activeTickEl) : activeTickEl.isConnected !== false);
|
|
3392
2941
|
if (active && tickStillDrawn) activeTickEl.classList?.add(ACTIVE_TICK_CLASS);
|
|
3393
2942
|
const wanted = new Set(sel ?? []);
|
|
3394
2943
|
const marks = container.querySelectorAll(`.${MARK_CLASS}[${ROW_IDX_ATTR}], .${LEGEND_MARK_CLASS}[${ROW_IDX_ATTR}]`);
|
|
3395
|
-
for (const
|
|
3396
|
-
const rows = parseRowIdxs(
|
|
3397
|
-
const on = active && rows.some((
|
|
3398
|
-
|
|
2944
|
+
for (const m of Array.from(marks)) {
|
|
2945
|
+
const rows = parseRowIdxs(m.getAttribute(ROW_IDX_ATTR));
|
|
2946
|
+
const on = active && rows.some((r) => wanted.has(r));
|
|
2947
|
+
m.classList?.[on ? "add" : "remove"](MARK_SELECTED_CLASS);
|
|
3399
2948
|
}
|
|
3400
2949
|
} catch {
|
|
3401
2950
|
}
|
|
@@ -3414,11 +2963,11 @@ function createChartHost(container, config) {
|
|
|
3414
2963
|
};
|
|
3415
2964
|
let xfAt = 0;
|
|
3416
2965
|
const XF_ECHO_MS = 150;
|
|
3417
|
-
const onXf = (
|
|
3418
|
-
const
|
|
2966
|
+
const onXf = (e) => {
|
|
2967
|
+
const d = e?.detail || {};
|
|
3419
2968
|
xfAt = Date.now();
|
|
3420
|
-
if (
|
|
3421
|
-
else if (
|
|
2969
|
+
if (d.clear) notify([], d.source || "chart");
|
|
2970
|
+
else if (d.mark) notify(parseRowIdxs(d.mark.getAttribute?.(ROW_IDX_ATTR)), d.source || "chart", d.mark);
|
|
3422
2971
|
};
|
|
3423
2972
|
const resolver = createMarkResolver({
|
|
3424
2973
|
root: container,
|
|
@@ -3427,11 +2976,11 @@ function createChartHost(container, config) {
|
|
|
3427
2976
|
}
|
|
3428
2977
|
});
|
|
3429
2978
|
const clickSel = `.${MARK_CLASS}[${ROW_IDX_ATTR}], .${LEGEND_MARK_CLASS}[${ROW_IDX_ATTR}], .${AXIS_FILTER_CLASS}[${ROW_IDX_ATTR}]`;
|
|
3430
|
-
const onClick = (
|
|
2979
|
+
const onClick = (e) => {
|
|
3431
2980
|
if (Date.now() - xfAt < XF_ECHO_MS) return;
|
|
3432
|
-
let el = resolver.findMark(
|
|
3433
|
-
if (!el) el = resolver.penetrateOverlayAt(
|
|
3434
|
-
if (!el) el = resolver.resolveByGeometry(
|
|
2981
|
+
let el = resolver.findMark(e?.target, clickSel, e);
|
|
2982
|
+
if (!el) el = resolver.penetrateOverlayAt(e?.clientX, e?.clientY, clickSel);
|
|
2983
|
+
if (!el) el = resolver.resolveByGeometry(e?.clientX, e?.clientY, clickSel);
|
|
3435
2984
|
if (!el) {
|
|
3436
2985
|
if (current && current.length) notify([], "user");
|
|
3437
2986
|
return;
|
|
@@ -3439,16 +2988,16 @@ function createChartHost(container, config) {
|
|
|
3439
2988
|
const rows = parseRowIdxs(el.getAttribute(ROW_IDX_ATTR));
|
|
3440
2989
|
if (!rows.length) return;
|
|
3441
2990
|
const tick = el.classList?.contains?.(AXIS_FILTER_CLASS) ? el : null;
|
|
3442
|
-
if (
|
|
2991
|
+
if (e?.ctrlKey || e?.metaKey || e?.shiftKey) {
|
|
3443
2992
|
const next = new Set(current ?? []);
|
|
3444
|
-
for (const
|
|
3445
|
-
if (next.has(
|
|
3446
|
-
else next.add(
|
|
2993
|
+
for (const r of rows) {
|
|
2994
|
+
if (next.has(r)) next.delete(r);
|
|
2995
|
+
else next.add(r);
|
|
3447
2996
|
}
|
|
3448
2997
|
notify(Array.from(next), "user", tick);
|
|
3449
2998
|
return;
|
|
3450
2999
|
}
|
|
3451
|
-
const same = !!current && current.length === rows.length && rows.every((
|
|
3000
|
+
const same = !!current && current.length === rows.length && rows.every((r) => current.includes(r));
|
|
3452
3001
|
notify(same ? [] : rows, "user", same ? null : tick);
|
|
3453
3002
|
};
|
|
3454
3003
|
container.addEventListener(XFILTER_REFRESH_EVENT, onXf);
|
|
@@ -3458,10 +3007,10 @@ function createChartHost(container, config) {
|
|
|
3458
3007
|
const fitOpts = config.fit ?? true;
|
|
3459
3008
|
const labelContrastOpts = config.labelContrast ?? true;
|
|
3460
3009
|
const stopAnim = () => {
|
|
3461
|
-
const
|
|
3462
|
-
if (typeof
|
|
3010
|
+
const s2 = container[CONTAINER_SLOT_ANIM_STOP];
|
|
3011
|
+
if (typeof s2 === "function") {
|
|
3463
3012
|
try {
|
|
3464
|
-
|
|
3013
|
+
s2();
|
|
3465
3014
|
} catch {
|
|
3466
3015
|
}
|
|
3467
3016
|
}
|
|
@@ -3476,8 +3025,8 @@ function createChartHost(container, config) {
|
|
|
3476
3025
|
renderFn = compileRenderFn(config.code, win, doc, d3);
|
|
3477
3026
|
}
|
|
3478
3027
|
if (resolved.geo === void 0 && config.geoKind) {
|
|
3479
|
-
const
|
|
3480
|
-
if (
|
|
3028
|
+
const g3 = config.geoProvider?.(config.geoKind) ?? geoFromCache(config.geoKind);
|
|
3029
|
+
if (g3) resolved = { ...resolved, geo: g3 };
|
|
3481
3030
|
else if (!warnedGeo) {
|
|
3482
3031
|
warnedGeo = true;
|
|
3483
3032
|
try {
|
|
@@ -3503,8 +3052,8 @@ function createChartHost(container, config) {
|
|
|
3503
3052
|
const bg = resolved.backgroundColor ?? resolved.themeBg;
|
|
3504
3053
|
if (typeof bg === "string" && bg) lc.pageBg = bg;
|
|
3505
3054
|
}
|
|
3506
|
-
const
|
|
3507
|
-
config.onLabelContrast?.(
|
|
3055
|
+
const r = applyLabelContrast(container, lc);
|
|
3056
|
+
config.onLabelContrast?.(r);
|
|
3508
3057
|
} catch {
|
|
3509
3058
|
}
|
|
3510
3059
|
}
|
|
@@ -3545,8 +3094,8 @@ function createChartHost(container, config) {
|
|
|
3545
3094
|
}
|
|
3546
3095
|
if (fitOpts !== false) {
|
|
3547
3096
|
try {
|
|
3548
|
-
const
|
|
3549
|
-
config.onFit?.(
|
|
3097
|
+
const r = fitRenderedChart(container, fitOpts === true ? {} : fitOpts);
|
|
3098
|
+
config.onFit?.(r);
|
|
3550
3099
|
} catch {
|
|
3551
3100
|
}
|
|
3552
3101
|
}
|
|
@@ -3569,10 +3118,10 @@ function createChartHost(container, config) {
|
|
|
3569
3118
|
return () => subs.delete(cb);
|
|
3570
3119
|
},
|
|
3571
3120
|
clear() {
|
|
3572
|
-
const
|
|
3573
|
-
if (typeof
|
|
3121
|
+
const s2 = container[CONTAINER_SLOT_XF_CLEAR];
|
|
3122
|
+
if (typeof s2 === "function") {
|
|
3574
3123
|
try {
|
|
3575
|
-
|
|
3124
|
+
s2();
|
|
3576
3125
|
} catch {
|
|
3577
3126
|
}
|
|
3578
3127
|
}
|
|
@@ -3662,7 +3211,6 @@ export {
|
|
|
3662
3211
|
MIN_HIT_BAND_PX,
|
|
3663
3212
|
censusHitBands,
|
|
3664
3213
|
hitBandFlag,
|
|
3665
|
-
Mt3 as Mt,
|
|
3666
3214
|
SAME_SHADE_DELTA_E,
|
|
3667
3215
|
MIN_RAMP_FILLS,
|
|
3668
3216
|
censusColourSpread,
|