CSVSourceWorker-5ZFKL2LA.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. import {
  2. i,
  3. o
  4. } from "./chunk-A6WD5XTM.js";
  5. import {
  6. u
  7. } from "./chunk-5X5UDWFV.js";
  8. import {
  9. Y
  10. } from "./chunk-3EZOER4E.js";
  11. import "./chunk-XCIRV7CO.js";
  12. import "./chunk-DMVKVC5I.js";
  13. import "./chunk-EL3V6S4N.js";
  14. import "./chunk-NFN2M2QU.js";
  15. import {
  16. f
  17. } from "./chunk-3ZJXLJLL.js";
  18. import "./chunk-OP2HNSVZ.js";
  19. import "./chunk-4GGDRIJK.js";
  20. import "./chunk-MZG75XMA.js";
  21. import {
  22. a
  23. } from "./chunk-5JZ72JAQ.js";
  24. import "./chunk-REMBDESU.js";
  25. import "./chunk-CKZZYAPN.js";
  26. import "./chunk-AFVJXEUJ.js";
  27. import {
  28. t as t2
  29. } from "./chunk-FZSI6IGI.js";
  30. import "./chunk-SJGY5U4Q.js";
  31. import "./chunk-27XWQUQA.js";
  32. import "./chunk-NX2NCBAF.js";
  33. import "./chunk-4VZNS7N2.js";
  34. import "./chunk-IIAN3QNN.js";
  35. import {
  36. ln
  37. } from "./chunk-VYQHMPYW.js";
  38. import "./chunk-WXUHXYJK.js";
  39. import "./chunk-NTERQTPO.js";
  40. import "./chunk-EDHROVWI.js";
  41. import {
  42. s as s3,
  43. t
  44. } from "./chunk-3IRT3YKJ.js";
  45. import "./chunk-SOSOZIX6.js";
  46. import "./chunk-ZSW35JPD.js";
  47. import {
  48. r
  49. } from "./chunk-DAWQAVQO.js";
  50. import "./chunk-73AMYZFU.js";
  51. import "./chunk-NKMX5M3L.js";
  52. import "./chunk-SQ2SY4BX.js";
  53. import "./chunk-VLG7MMVR.js";
  54. import "./chunk-BWATQC2Y.js";
  55. import {
  56. M
  57. } from "./chunk-47NSA4T4.js";
  58. import "./chunk-FUODOQDM.js";
  59. import "./chunk-CZBRZ6SU.js";
  60. import "./chunk-VGWC3IKZ.js";
  61. import "./chunk-SWMSD4RP.js";
  62. import "./chunk-UKEN2UNL.js";
  63. import "./chunk-X4SA4ELJ.js";
  64. import "./chunk-XJCUT65M.js";
  65. import {
  66. j as j2
  67. } from "./chunk-PIFOHNWC.js";
  68. import "./chunk-ZLNEXZAN.js";
  69. import "./chunk-5UVJ64RB.js";
  70. import "./chunk-ZYRIJWLX.js";
  71. import "./chunk-RYY6632W.js";
  72. import "./chunk-DW42UVIT.js";
  73. import "./chunk-TJNOJH33.js";
  74. import "./chunk-YAEIHDJH.js";
  75. import "./chunk-OSHI574D.js";
  76. import "./chunk-44GMIOGP.js";
  77. import "./chunk-75U5LM2V.js";
  78. import "./chunk-ZHRAUKVQ.js";
  79. import "./chunk-RZK6A2GY.js";
  80. import "./chunk-X4LLOW7U.js";
  81. import "./chunk-Z4JTBD7M.js";
  82. import "./chunk-HZRKBTHJ.js";
  83. import {
  84. U
  85. } from "./chunk-5DMBXPN2.js";
  86. import "./chunk-QANZ6BFY.js";
  87. import {
  88. Ut,
  89. j as j3
  90. } from "./chunk-VEGAOVMY.js";
  91. import {
  92. y
  93. } from "./chunk-CXCDYJ5R.js";
  94. import "./chunk-GAOW3WRZ.js";
  95. import {
  96. E,
  97. c,
  98. k,
  99. k2
  100. } from "./chunk-QCKFNSN2.js";
  101. import "./chunk-6SOHRC7T.js";
  102. import "./chunk-U2XHEJM7.js";
  103. import "./chunk-SQOPWYIT.js";
  104. import "./chunk-6KZ2LTDA.js";
  105. import {
  106. j
  107. } from "./chunk-V6P2MAQQ.js";
  108. import {
  109. s2 as s,
  110. s3 as s2
  111. } from "./chunk-E5O6P5I2.js";
  112. import "./chunk-SPWQ3AWG.js";
  113. import "./chunk-2TIUKVZN.js";
  114. import "./chunk-YXWMMD76.js";
  115. import "./chunk-S5KM4IGW.js";
  116. // node_modules/@arcgis/core/layers/graphics/sources/csv/csv.js
  117. var t3 = /^\s*"([\S\s]*)"\s*$/;
  118. var n = /""/g;
  119. var i2 = "\n";
  120. var r2 = [",", " ", ";", "|", " "];
  121. function* l(e, t4, n2) {
  122. let i3 = 0;
  123. for (; i3 <= e.length; ) {
  124. const r3 = e.indexOf(t4, i3), l2 = e.substring(i3, r3 > -1 ? r3 : void 0);
  125. i3 += l2.length + t4.length, n2 && !l2.trim() || (yield l2);
  126. }
  127. }
  128. function o2(e) {
  129. const t4 = e.includes("\r\n") ? "\r\n" : i2;
  130. return l(e, t4, true);
  131. }
  132. function u2(e, t4) {
  133. return l(e, t4, false);
  134. }
  135. function s4(e, t4, n2) {
  136. var _a;
  137. e = e.trim(), t4 = t4 == null ? void 0 : t4.trim();
  138. const i3 = [], l2 = Array.from(/* @__PURE__ */ new Set([n2 == null ? void 0 : n2.delimiter, ...r2])).filter((e2) => null != e2);
  139. for (const r3 of l2) {
  140. const n3 = f2(e, r3).length, l3 = (_a = f2(t4, r3).length) != null ? _a : n3;
  141. n3 > 1 && i3.push({ weight: Math.min(n3, l3), delimiter: r3 });
  142. }
  143. const o3 = i3.sort(({ weight: e2 }, { weight: t5 }) => t5 - e2).map(({ delimiter: e2 }) => e2);
  144. for (const r3 of o3) {
  145. const t5 = g(a2(e, r3).names, n2 == null ? void 0 : n2.longitudeField, n2 == null ? void 0 : n2.latitudeField);
  146. if (t5.longitudeFieldName && t5.latitudeFieldName)
  147. return { delimiter: r3, locationInfo: t5 };
  148. }
  149. return { delimiter: o3[0], locationInfo: null };
  150. }
  151. function* c2(e, r3, l2, s5 = () => /* @__PURE__ */ Object.create(null)) {
  152. const c3 = o2(e);
  153. c3.next();
  154. let a3 = "", f3 = "", g2 = 0, m2 = s5(), p2 = 0;
  155. e:
  156. for (const o3 of c3) {
  157. const e2 = u2(o3, l2);
  158. for (const i3 of e2)
  159. if (a3 += f3 + i3, f3 = "", g2 += d(i3), g2 % 2 == 0) {
  160. if (g2 > 0) {
  161. const e3 = t3.exec(a3);
  162. if (!e3) {
  163. m2 = s5(), p2 = 0, a3 = "", g2 = 0;
  164. continue e;
  165. }
  166. m2[r3[p2]] = e3[1].replace(n, '"'), p2++;
  167. } else
  168. m2[r3[p2]] = a3, p2++;
  169. a3 = "", g2 = 0;
  170. } else
  171. f3 = l2;
  172. 0 === g2 ? (yield m2, m2 = s5(), p2 = 0) : f3 = i2;
  173. }
  174. }
  175. function a2(e, t4) {
  176. const n2 = f2(e, t4).filter((e2) => null != e2), i3 = n2.map((e2) => $(e2));
  177. for (let r3 = i3.length - 1; r3 >= 0; r3--)
  178. i3[r3] || (i3.splice(r3, 1), n2.splice(r3, 1));
  179. return { names: i3, aliases: n2 };
  180. }
  181. function f2(e, i3) {
  182. if (!(e == null ? void 0 : e.length))
  183. return [];
  184. const r3 = [];
  185. let l2 = "", o3 = "", s5 = 0;
  186. const c3 = u2(e, i3);
  187. for (const u3 of c3)
  188. if (l2 += o3 + u3, o3 = "", s5 += d(u3), s5 % 2 == 0) {
  189. if (s5 > 0) {
  190. const e2 = t3.exec(l2);
  191. e2 && r3.push(e2[1].replace(n, '"'));
  192. } else
  193. r3.push(l2);
  194. l2 = "", s5 = 0;
  195. } else
  196. o3 = i3;
  197. return r3;
  198. }
  199. function d(e) {
  200. let t4 = 0, n2 = 0;
  201. for (n2 = e.indexOf('"', n2); n2 >= 0; )
  202. t4++, n2 = e.indexOf('"', n2 + 1);
  203. return t4;
  204. }
  205. function g(e, t4, n2) {
  206. var _a, _b;
  207. t4 = (_a = $(t4)) == null ? void 0 : _a.toLowerCase(), n2 = (_b = $(n2)) == null ? void 0 : _b.toLowerCase();
  208. const i3 = e.map((e2) => e2.toLowerCase()), r3 = t4 ? e[i3.indexOf(t4)] : null, l2 = n2 ? e[i3.indexOf(n2)] : null;
  209. return { longitudeFieldName: r3 || e[i3.indexOf(F.find((e2) => i3.includes(e2)))], latitudeFieldName: l2 || e[i3.indexOf(y2.find((e2) => i3.includes(e2)))] };
  210. }
  211. function m(e, t4, n2, i3, r3) {
  212. const l2 = [], o3 = c2(e, n2, t4), u3 = [];
  213. for (const s5 of o3) {
  214. if (10 === u3.length)
  215. break;
  216. u3.push(s5);
  217. }
  218. for (let s5 = 0; s5 < n2.length; s5++) {
  219. const e2 = n2[s5], t5 = i3[s5];
  220. if (e2 === r3.longitudeFieldName || e2 === r3.latitudeFieldName)
  221. l2.push({ name: e2, type: "esriFieldTypeDouble", alias: t5 });
  222. else {
  223. let n3, i4;
  224. switch (p(u3.map((t6) => t6[e2]))) {
  225. case "integer":
  226. n3 = "esriFieldTypeInteger";
  227. break;
  228. case "double":
  229. n3 = "esriFieldTypeDouble";
  230. break;
  231. case "date":
  232. n3 = "esriFieldTypeDate", i4 = 36;
  233. break;
  234. default:
  235. n3 = "esriFieldTypeString", i4 = 255;
  236. }
  237. l2.push({ name: e2, type: n3, alias: t5, length: i4 });
  238. }
  239. }
  240. return l2;
  241. }
  242. function p(e) {
  243. if (!e.length)
  244. return "string";
  245. const t4 = /[^+-.,0-9]/;
  246. return e.map((e2) => {
  247. let n2 = false;
  248. if ("" !== e2) {
  249. if (t4.test(e2))
  250. n2 = true;
  251. else {
  252. let t5 = h(e2);
  253. if (!isNaN(t5))
  254. return /[.,]/.test(e2) || !Number.isInteger(t5) || t5 > 214783647 || t5 < -214783648 ? "double" : "integer";
  255. if (e2.includes("E")) {
  256. if (t5 = Number(e2), !isNaN(t5))
  257. return "double";
  258. if (e2.includes(",")) {
  259. if (e2 = e2.replace(",", "."), t5 = Number(e2), !isNaN(t5))
  260. return "double";
  261. n2 = true;
  262. } else
  263. n2 = true;
  264. } else
  265. n2 = true;
  266. }
  267. if (n2) {
  268. if (!/^[-]?\d*[.,]?\d*$/.test(e2)) {
  269. return b(new Date(e2), e2) ? "date" : "string";
  270. }
  271. return "string";
  272. }
  273. return "string";
  274. }
  275. }).reduce((e2, t5) => void 0 === e2 ? t5 : void 0 === t5 ? e2 : e2 === t5 ? t5 : "string" === e2 || "string" === t5 ? "string" : "double" === e2 || "double" === t5 ? "double" : void 0);
  276. }
  277. function b(e, t4) {
  278. if (!e || "[object Date]" !== Object.prototype.toString.call(e) || isNaN(e.getTime()))
  279. return false;
  280. let n2 = true;
  281. if (!x && /\d+\W*$/.test(t4)) {
  282. const e2 = t4.match(/[a-zA-Z]{2,}/);
  283. if (e2) {
  284. let t5 = false, i3 = 0;
  285. for (; !t5 && i3 <= e2.length; )
  286. t5 = !N.test(e2[i3]), i3++;
  287. n2 = !t5;
  288. }
  289. }
  290. return n2;
  291. }
  292. var h = function() {
  293. const t4 = a(), n2 = new RegExp("^" + t4.regexp + "$"), i3 = new RegExp("[" + t4.group + "\\s\\xa0]", "g"), r3 = t4.factor;
  294. return (e) => {
  295. const l2 = n2.exec(e);
  296. if (t4.factor = r3, !l2)
  297. return NaN;
  298. let o3 = l2[1];
  299. if (!l2[1]) {
  300. if (!l2[2])
  301. return NaN;
  302. o3 = l2[2], t4.factor *= -1;
  303. }
  304. return o3 = o3.replace(i3, "").replace(t4.decimal, "."), +o3 * t4.factor;
  305. };
  306. }();
  307. var N = /^((jan(uary)?)|(feb(ruary)?)|(mar(ch)?)|(apr(il)?)|(may)|(jun(e)?)|(jul(y)?)|(aug(ust)?)|(sep(tember)?)|(oct(ober)?)|(nov(ember)?)|(dec(ember)?)|(am)|(pm)|(gmt)|(utc))$/i;
  308. var x = Number.isNaN(new Date("technology 10").getTime());
  309. var y2 = ["lat", "latitude", "latitude83", "latdecdeg", "lat_dd", "y", "ycenter", "point_y"];
  310. var F = ["lon", "lng", "long", "longitude", "longitude83", "longdecdeg", "long_dd", "x", "xcenter", "point_x"];
  311. var w = /^([0-9])/;
  312. var _ = /[^A-Za-z0-9_\u0080-\uffff]/g;
  313. var O = /_{2,}/g;
  314. var j4 = /^_/;
  315. var T = /_$/;
  316. function $(e) {
  317. return e ? e.trim().replace(_, "_").replace(O, "_").replace(j4, "").replace(T, "").replace(w, "F$1") : null;
  318. }
  319. // node_modules/@arcgis/core/layers/graphics/sources/support/CSVSourceWorker.js
  320. var C = o("esriGeometryPoint");
  321. var v = ["csv"];
  322. var O2 = [0, 0];
  323. var D = class {
  324. constructor(e, t4) {
  325. this.x = e, this.y = t4;
  326. }
  327. };
  328. var k3 = class {
  329. constructor() {
  330. this._queryEngine = null, this._snapshotFeatures = async (e) => {
  331. const t4 = await this._fetch(e);
  332. return this._createFeatures(t4);
  333. };
  334. }
  335. destroy() {
  336. var _a;
  337. (_a = this._queryEngine) == null ? void 0 : _a.destroy(), this._queryEngine = null;
  338. }
  339. async load(e, t4 = {}) {
  340. var _a;
  341. this._loadOptions = e;
  342. const [i3] = await Promise.all([this._fetch(t4.signal), this._checkProjection((_a = e == null ? void 0 : e.parsingOptions) == null ? void 0 : _a.spatialReference)]), n2 = P(i3, e);
  343. this._locationInfo = n2.locationInfo, this._delimiter = n2.delimiter, this._queryEngine = this._createQueryEngine(n2);
  344. const r3 = await this._createFeatures(i3);
  345. if (this._queryEngine.featureStore.addMany(r3), n2.layerDefinition.extent = this._queryEngine.fullExtent, n2.layerDefinition.timeInfo) {
  346. const { start: e2, end: t5 } = this._queryEngine.timeExtent;
  347. n2.layerDefinition.timeInfo.timeExtent = [e2, t5];
  348. }
  349. return n2;
  350. }
  351. async applyEdits() {
  352. throw new s2("csv-layer:editing-not-supported", "applyEdits() is not supported on CSVLayer");
  353. }
  354. async queryFeatures(e = {}, t4 = {}) {
  355. return await this._waitSnapshotComplete(), this._queryEngine.executeQuery(e, t4.signal);
  356. }
  357. async queryFeatureCount(e = {}, t4 = {}) {
  358. return await this._waitSnapshotComplete(), this._queryEngine.executeQueryForCount(e, t4.signal);
  359. }
  360. async queryObjectIds(e = {}, t4 = {}) {
  361. return await this._waitSnapshotComplete(), this._queryEngine.executeQueryForIds(e, t4.signal);
  362. }
  363. async queryExtent(e = {}, t4 = {}) {
  364. return await this._waitSnapshotComplete(), this._queryEngine.executeQueryForExtent(e, t4.signal);
  365. }
  366. async querySnapping(e, t4 = {}) {
  367. return await this._waitSnapshotComplete(), this._queryEngine.executeQueryForSnapping(e, t4.signal);
  368. }
  369. async refresh(e) {
  370. var _a;
  371. return this._loadOptions.customParameters = e, (_a = this._snapshotTask) == null ? void 0 : _a.abort(), this._snapshotTask = j2(this._snapshotFeatures), this._snapshotTask.promise.then((e2) => {
  372. this._queryEngine.featureStore.clear(), e2 && this._queryEngine.featureStore.addMany(e2);
  373. }, (e2) => {
  374. this._queryEngine.featureStore.clear(), j(e2) || s.getLogger("esri.layers.CSVLayer").error(new s2("csv-layer:refresh", "An error occurred during refresh", { error: e2 }));
  375. }), await this._waitSnapshotComplete(), { extent: this._queryEngine.fullExtent, timeExtent: this._queryEngine.timeExtent };
  376. }
  377. async _waitSnapshotComplete() {
  378. if (this._snapshotTask && !this._snapshotTask.finished) {
  379. try {
  380. await this._snapshotTask.promise;
  381. } catch {
  382. }
  383. return this._waitSnapshotComplete();
  384. }
  385. }
  386. async _fetch(t4) {
  387. const { url: n2, customParameters: r3 } = this._loadOptions;
  388. if (!n2)
  389. throw new s2("csv-layer:invalid-source", "url not defined");
  390. const o3 = j3(n2);
  391. return (await U(o3.path, { query: { ...o3.query, ...r3 }, responseType: "text", signal: t4 })).data;
  392. }
  393. _createQueryEngine(e) {
  394. const { objectIdField: t4, fields: i3, extent: n2, timeInfo: r3 } = e.layerDefinition, s5 = new u({ geometryType: "esriGeometryPoint", hasM: false, hasZ: false });
  395. return new Y({ fields: i3, geometryType: "esriGeometryPoint", hasM: false, hasZ: false, timeInfo: r3, objectIdField: t4, spatialReference: n2.spatialReference || { wkid: 4326 }, cacheSpatialQueries: true, featureStore: s5 });
  396. }
  397. async _createFeatures(e) {
  398. const { latitudeFieldName: t4, longitudeFieldName: i3 } = this._locationInfo, { objectIdField: n2, fieldsIndex: r3, spatialReference: s5 } = this._queryEngine;
  399. let o3 = [];
  400. const u3 = [], y3 = r3.fields.filter((e2) => e2.name !== n2).map((e2) => e2.name);
  401. let h2 = 0;
  402. const g2 = {};
  403. for (const a3 of r3.fields)
  404. if ("esriFieldTypeOID" !== a3.type && "esriFieldTypeGlobalID" !== a3.type) {
  405. const e2 = M(a3);
  406. void 0 !== e2 && (g2[a3.name] = e2);
  407. }
  408. const w2 = c2(e, y3, this._delimiter, i(g2, n2));
  409. for (const a3 of w2) {
  410. const e2 = this._parseCoordinateValue(a3[t4]), s6 = this._parseCoordinateValue(a3[i3]);
  411. if (null != s6 && null != e2 && !isNaN(e2) && !isNaN(s6)) {
  412. a3[t4] = e2, a3[i3] = s6;
  413. for (const e3 in a3)
  414. if (e3 !== t4 && e3 !== i3) {
  415. if (r3.isDateField(e3)) {
  416. const t5 = new Date(a3[e3]);
  417. a3[e3] = b(t5, a3[e3]) ? t5.getTime() : null;
  418. } else if (r3.isNumericField(e3)) {
  419. const t5 = h(a3[e3]);
  420. isNaN(t5) ? a3[e3] = null : a3[e3] = t5;
  421. }
  422. }
  423. a3[n2] = h2, h2++, o3.push(new D(s6, e2)), u3.push(a3);
  424. }
  425. }
  426. if (!E({ wkid: 4326 }, s5))
  427. if (k(s5))
  428. for (const a3 of o3)
  429. [a3.x, a3.y] = y(a3.x, a3.y, O2);
  430. else
  431. o3 = ln(t2, o3, k2.WGS84, s5, null, null);
  432. const E2 = [];
  433. for (let a3 = 0; a3 < o3.length; a3++) {
  434. const { x: e2, y: t5 } = o3[a3], i4 = u3[a3];
  435. i4[n2] = a3 + 1, E2.push(new s3(new t([], [e2, t5]), i4, null, i4[n2]));
  436. }
  437. return E2;
  438. }
  439. _parseCoordinateValue(e) {
  440. if (null == e || "" === e)
  441. return null;
  442. let t4 = h(e);
  443. return (isNaN(t4) || Math.abs(t4) > 181) && (t4 = parseFloat(e)), t4;
  444. }
  445. async _checkProjection(e) {
  446. try {
  447. await f(c, e);
  448. } catch {
  449. throw new s2("csv-layer:projection-not-supported", "Projection not supported");
  450. }
  451. }
  452. };
  453. function P(e, t4) {
  454. var _a, _b, _c;
  455. const n2 = t4.parsingOptions || {}, r3 = { delimiter: n2.delimiter, layerDefinition: null, locationInfo: { latitudeFieldName: n2.latitudeField, longitudeFieldName: n2.longitudeField } }, s5 = r3.layerDefinition = { name: Ut(t4.url, v) || "csv", drawingInfo: C, geometryType: "esriGeometryPoint", objectIdField: null, fields: [], timeInfo: n2.timeInfo, extent: { xmin: Number.POSITIVE_INFINITY, ymin: Number.POSITIVE_INFINITY, xmax: Number.NEGATIVE_INFINITY, ymax: Number.NEGATIVE_INFINITY, spatialReference: n2.spatialReference || { wkid: 102100 } } }, a3 = o2(e), l2 = (_a = a3.next().value) == null ? void 0 : _a.trim(), c3 = (_b = a3.next().value) == null ? void 0 : _b.trim();
  456. if (!l2)
  457. throw new s2("csv-layer:empty-csv", "CSV is empty", { csv: e });
  458. const { delimiter: m2, locationInfo: u3 } = s4(l2, c3, n2);
  459. if (!m2)
  460. throw new s2("csv-layer:invalid-delimiter", "Unable to detect the delimiter from CSV", { firstLine: l2, secondLine: c3, parsingOptions: n2 });
  461. if (!u3)
  462. throw new s2("csv-layer:location-fields-not-found", "Unable to identify latitude and longitude fields from the CSV file", { firstLine: l2, secondLine: c3, parsingOptions: n2 });
  463. r3.locationInfo = u3, r3.delimiter = m2;
  464. const { names: d2, aliases: p2 } = a2(l2, m2), f3 = m(e, r3.delimiter, d2, p2, r3.locationInfo);
  465. if ((_c = n2.fields) == null ? void 0 : _c.length) {
  466. const e2 = new r(n2.fields);
  467. for (const t5 of f3) {
  468. const i3 = e2.get(t5.name);
  469. i3 && Object.assign(t5, i3);
  470. }
  471. }
  472. if (!f3.some((e2) => "esriFieldTypeOID" === e2.type && (s5.objectIdField = e2.name, true))) {
  473. const e2 = { name: "__OBJECTID", alias: "__OBJECTID", type: "esriFieldTypeOID", editable: false, nullable: false };
  474. s5.objectIdField = e2.name, f3.unshift(e2);
  475. }
  476. s5.fields = f3;
  477. const y3 = new r(s5.fields);
  478. if (r3.locationInfo && (r3.locationInfo.latitudeFieldName = y3.get(r3.locationInfo.latitudeFieldName).name, r3.locationInfo.longitudeFieldName = y3.get(r3.locationInfo.longitudeFieldName).name), s5.timeInfo) {
  479. const e2 = s5.timeInfo;
  480. if (e2.startTimeField) {
  481. const t5 = y3.get(e2.startTimeField);
  482. t5 ? (e2.startTimeField = t5.name, t5.type = "esriFieldTypeDate") : e2.startTimeField = null;
  483. }
  484. if (e2.endTimeField) {
  485. const t5 = y3.get(e2.endTimeField);
  486. t5 ? (e2.endTimeField = t5.name, t5.type = "esriFieldTypeDate") : e2.endTimeField = null;
  487. }
  488. if (e2.trackIdField) {
  489. const t5 = y3.get(e2.trackIdField);
  490. e2.trackIdField = t5 ? t5.name : null;
  491. }
  492. e2.startTimeField || e2.endTimeField || (s5.timeInfo = null);
  493. }
  494. return r3;
  495. }
  496. export {
  497. k3 as default
  498. };
  499. //# sourceMappingURL=CSVSourceWorker-5ZFKL2LA.js.map