chunk-DVYEME2A.js 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. import {
  2. n as n2,
  3. o as o2
  4. } from "./chunk-YINMVLPI.js";
  5. import {
  6. s as s2
  7. } from "./chunk-JK76NUHI.js";
  8. import {
  9. _n,
  10. rn
  11. } from "./chunk-P24XEEHY.js";
  12. import {
  13. y
  14. } from "./chunk-JGBXYDGB.js";
  15. import {
  16. i
  17. } from "./chunk-75U5LM2V.js";
  18. import {
  19. U
  20. } from "./chunk-DVUG3KID.js";
  21. import {
  22. ht,
  23. mt,
  24. z
  25. } from "./chunk-VEGAOVMY.js";
  26. import {
  27. w2 as w
  28. } from "./chunk-6T6G6LCQ.js";
  29. import {
  30. E as E2,
  31. c,
  32. k2 as k
  33. } from "./chunk-PQFTYGF5.js";
  34. import {
  35. n,
  36. o
  37. } from "./chunk-2Z2TG5CU.js";
  38. import {
  39. E
  40. } from "./chunk-V6P2MAQQ.js";
  41. import {
  42. s3 as s
  43. } from "./chunk-E5O6P5I2.js";
  44. import {
  45. r,
  46. t
  47. } from "./chunk-YXWMMD76.js";
  48. // node_modules/@arcgis/core/layers/ogc/dateUtils.js
  49. function e(e2) {
  50. var _a;
  51. return (_a = t2(e2)) != null ? _a : n3(e2);
  52. }
  53. function n3(e2) {
  54. const n4 = new Date(e2).getTime();
  55. return Number.isNaN(n4) ? null : n4;
  56. }
  57. function t2(e2) {
  58. var _a, _b, _c, _d;
  59. const n4 = s3.exec(e2);
  60. if (!(n4 == null ? void 0 : n4.groups))
  61. return null;
  62. const t3 = n4.groups, u = +t3.year, o3 = +t3.month - 1, r2 = +t3.day, f = +((_a = t3.hours) != null ? _a : "0"), i2 = +((_b = t3.minutes) != null ? _b : "0"), d = +((_c = t3.seconds) != null ? _c : "0");
  63. if (f > 23)
  64. return null;
  65. if (i2 > 59)
  66. return null;
  67. if (d > 59)
  68. return null;
  69. const l = (_d = t3.ms) != null ? _d : "0", c2 = l ? +l.padEnd(3, "0").substring(0, 3) : 0;
  70. let a;
  71. if (t3.isUTC)
  72. a = Date.UTC(u, o3, r2, f, i2, d, c2);
  73. else if (t3.offsetSign) {
  74. const e3 = +t3.offsetHours, n5 = +t3.offsetMinutes;
  75. a = 6e4 * ("+" === t3.offsetSign ? -1 : 1) * (60 * e3 + n5) + Date.UTC(u, o3, r2, f, i2, d, c2);
  76. } else
  77. a = new Date(u, o3, r2, f, i2, d, c2).getTime();
  78. return Number.isNaN(a) ? null : a;
  79. }
  80. var s3 = /^(?:(?<year>-?\d{4,})-(?<month>\d{2})-(?<day>\d{2}))(?:T(?<hours>\d{2}):(?<minutes>\d{2}):(?<seconds>\d{2})(?:\.(?<ms>\d+))?)?(?:(?<isUTC>Z)|(?:(?<offsetSign>\+|-)(?<offsetHours>\d{2}):(?<offsetMinutes>\d{2})))?$/;
  81. // node_modules/@arcgis/core/layers/ogc/wfsUtils.js
  82. var S = "xlink:href";
  83. var x = "2.0.0";
  84. var C = "__esri_wfs_id__";
  85. var E3 = "wfs-layer:getWFSLayerTypeInfo-error";
  86. var N = "wfs-layer:empty-service";
  87. var P = "wfs-layer:feature-type-not-found";
  88. var R = "wfs-layer:geojson-not-supported";
  89. var j = "wfs-layer:kvp-encoding-not-supported";
  90. var A = "wfs-layer:malformed-json";
  91. var G = "wfs-layer:unknown-geometry-type";
  92. var k2 = "wfs-layer:unknown-field-type";
  93. var v = "wfs-layer:unsupported-spatial-reference";
  94. var U2 = "wfs-layer:unsupported-wfs-version";
  95. async function D(t3, r2) {
  96. const n4 = I((await U(t3, { responseType: "text", query: { SERVICE: "WFS", REQUEST: "GetCapabilities", VERSION: x, ...r2 == null ? void 0 : r2.customParameters }, signal: r2 == null ? void 0 : r2.signal })).data);
  97. return $(t3, n4), n4;
  98. }
  99. function I(e2) {
  100. const t3 = te(e2);
  101. ne(t3), ae(t3);
  102. const n4 = t3.firstElementChild, a = n(M(n4));
  103. return { operations: L(n4), get featureTypes() {
  104. return Array.from(a());
  105. }, readFeatureTypes: a };
  106. }
  107. var O = /* @__PURE__ */ new Set(["json", "application/json", "geojson", "application/json; subtype=geojson"]);
  108. function L(e2) {
  109. let r2 = false;
  110. const n4 = { GetCapabilities: { url: "" }, DescribeFeatureType: { url: "" }, GetFeature: { url: "", outputFormat: null, supportsPagination: false } };
  111. if (o2(e2, { OperationsMetadata: { Operation: (e3) => {
  112. switch (e3.getAttribute("name")) {
  113. case "GetCapabilities":
  114. return { DCP: { HTTP: { Get: (e4) => {
  115. n4.GetCapabilities.url = e4.getAttribute(S);
  116. } } } };
  117. case "DescribeFeatureType":
  118. return { DCP: { HTTP: { Get: (e4) => {
  119. n4.DescribeFeatureType.url = e4.getAttribute(S);
  120. } } } };
  121. case "GetFeature":
  122. return { DCP: { HTTP: { Get: (e4) => {
  123. n4.GetFeature.url = e4.getAttribute(S);
  124. } } }, Parameter: (e4) => {
  125. if ("outputFormat" === e4.getAttribute("name"))
  126. return { AllowedValues: { Value: (e5) => {
  127. const t3 = e5.textContent;
  128. t3 && O.has(t3.toLowerCase()) && (n4.GetFeature.outputFormat = t3);
  129. } } };
  130. } };
  131. }
  132. }, Constraint: (e3) => {
  133. switch (e3.getAttribute("name")) {
  134. case "KVPEncoding":
  135. return { DefaultValue: (e4) => {
  136. r2 = "true" === e4.textContent.toLowerCase();
  137. } };
  138. case "ImplementsResultPaging":
  139. return { DefaultValue: (e4) => {
  140. n4.GetFeature.supportsPagination = "true" === e4.textContent.toLowerCase();
  141. } };
  142. }
  143. } } }), !r2)
  144. throw new s(j, "WFS service doesn't support key/value pair (KVP) encoding");
  145. if (t(n4.GetFeature.outputFormat))
  146. throw new s(R, "WFS service doesn't support GeoJSON output format");
  147. return n4;
  148. }
  149. function $(e2, t3) {
  150. ht(e2) && (z(e2, t3.operations.DescribeFeatureType.url, true) && (t3.operations.DescribeFeatureType.url = mt(t3.operations.DescribeFeatureType.url)), z(e2, t3.operations.GetFeature.url, true) && (t3.operations.GetFeature.url = mt(t3.operations.GetFeature.url)));
  151. }
  152. function M(e2) {
  153. return n2(e2, { FeatureTypeList: { FeatureType: (e3) => {
  154. const t3 = { typeName: "undefined:undefined", name: "", title: "", description: "", extent: null, namespacePrefix: "", namespaceUri: "", supportedSpatialReferences: [] }, r2 = /* @__PURE__ */ new Set([4326]), n4 = (e4) => {
  155. var _a, _b, _c, _d;
  156. const t4 = parseInt((_d = (_c = (_b = (_a = e4.textContent) == null ? void 0 : _a.match(/(?<wkid>\d+$)/i)) == null ? void 0 : _b.groups) == null ? void 0 : _c.wkid) != null ? _d : "", 10);
  157. Number.isNaN(t4) || r2.add(t4);
  158. };
  159. return o2(e3, { Name: (e4) => {
  160. const { name: r3, prefix: n5 } = re(e4.textContent);
  161. t3.typeName = `${n5}:${r3}`, t3.name = r3, t3.namespacePrefix = n5, t3.namespaceUri = e4.lookupNamespaceURI(n5);
  162. }, Abstract: (e4) => {
  163. t3.description = e4.textContent;
  164. }, Title: (e4) => {
  165. t3.title = e4.textContent;
  166. }, WGS84BoundingBox: (e4) => {
  167. t3.extent = V(e4);
  168. }, DefaultSRS: n4, DefaultCRS: n4, OtherSRS: n4, OtherCRS: n4 }), t3.title || (t3.title = t3.name), t3.supportedSpatialReferences.push(...r2), t3;
  169. } } });
  170. }
  171. function V(e2) {
  172. let t3, r2, n4, a;
  173. for (const o3 of e2.children)
  174. switch (o3.localName) {
  175. case "LowerCorner":
  176. [t3, r2] = o3.textContent.split(" ").map((e3) => Number.parseFloat(e3));
  177. break;
  178. case "UpperCorner":
  179. [n4, a] = o3.textContent.split(" ").map((e3) => Number.parseFloat(e3));
  180. }
  181. return { xmin: t3, ymin: r2, xmax: n4, ymax: a, spatialReference: c };
  182. }
  183. function W(e2, t3, r2) {
  184. return o(e2, (e3) => r2 ? e3.name === t3 && e3.namespaceUri === r2 : e3.typeName === t3 || e3.name === t3);
  185. }
  186. async function X(e2, t3, r2, n4 = {}) {
  187. var _a;
  188. const { featureType: a, extent: o3 } = await Y(e2, t3, r2, n4), { fields: s4, geometryType: i2, swapXY: p, objectIdField: u, geometryField: c2 } = await q(e2, a.typeName, n4);
  189. return { url: e2.operations.GetCapabilities.url, name: a.name, namespaceUri: a.namespaceUri, fields: s4, geometryField: c2, geometryType: i2, objectIdField: u, spatialReference: (_a = n4.spatialReference) != null ? _a : k.WGS84, extent: o3, swapXY: p, wfsCapabilities: e2, customParameters: n4.customParameters };
  190. }
  191. async function Y(e2, r2, n4, o3 = {}) {
  192. const { spatialReference: s4 = k.WGS84 } = o3, i2 = e2.readFeatureTypes(), p = r2 ? W(i2, r2, n4) : i2.next().value;
  193. if (t(p))
  194. throw r2 ? new s(P, `The type '${r2}' could not be found in the service`) : new s(N, "The service is empty");
  195. let u = new w({ ...p.extent, spatialReference: s4 });
  196. if (!E2(s4, c))
  197. try {
  198. await _n(c, s4, void 0, o3), u = rn(u, c);
  199. } catch {
  200. throw new s(v, "Projection not supported");
  201. }
  202. return { extent: u, spatialReference: s4, featureType: p };
  203. }
  204. async function q(e2, r2, n4 = {}) {
  205. var _a, _b, _c, _d, _e;
  206. const [o3, i2] = await E([J(e2.operations.DescribeFeatureType.url, r2, n4), _(e2, r2, n4)]);
  207. if (o3.error || i2.error)
  208. throw new s(E3, `An error occurred while getting info about the feature type '${r2}'`, { error: o3.error || i2.error });
  209. const { fields: p, errors: u } = (_a = o3.value) != null ? _a : {}, c2 = ((_b = o3.value) == null ? void 0 : _b.geometryType) || ((_c = i2.value) == null ? void 0 : _c.geometryType), l = (_e = (_d = i2.value) == null ? void 0 : _d.swapXY) != null ? _e : false;
  210. if (t(c2))
  211. throw new s(G, `The geometry type could not be determined for type '${r2}`, { typeName: r2, geometryType: c2, fields: p, errors: u });
  212. return { ...z2(p != null ? p : []), geometryType: c2, swapXY: l };
  213. }
  214. function z2(e2) {
  215. var _a;
  216. const t3 = e2.find((e3) => "geometry" === e3.type);
  217. let r2 = e2.find((e3) => "oid" === e3.type);
  218. return e2 = e2.filter((e3) => "geometry" !== e3.type), r2 || (r2 = new y({ name: C, type: "oid", alias: C }), e2.unshift(r2)), { geometryField: (_a = t3 == null ? void 0 : t3.name) != null ? _a : null, objectIdField: r2.name, fields: e2 };
  219. }
  220. async function _(t3, r2, n4 = {}) {
  221. var _a;
  222. let a, o3 = false;
  223. const [s4, i2] = await Promise.all([K(t3.operations.GetFeature.url, r2, t3.operations.GetFeature.outputFormat, { ...n4, count: 1 }), U(t3.operations.GetFeature.url, { responseType: "text", query: Z(r2, void 0, { ...n4, count: 1 }), signal: n4 == null ? void 0 : n4.signal })]), p = "FeatureCollection" === s4.type && ((_a = s4.features[0]) == null ? void 0 : _a.geometry);
  224. if (p) {
  225. let e2;
  226. switch (a = i.fromJSON(s2(p.type)), p.type) {
  227. case "Point":
  228. e2 = p.coordinates;
  229. break;
  230. case "LineString":
  231. case "MultiPoint":
  232. e2 = p.coordinates[0];
  233. break;
  234. case "MultiLineString":
  235. case "Polygon":
  236. e2 = p.coordinates[0][0];
  237. break;
  238. case "MultiPolygon":
  239. e2 = p.coordinates[0][0][0];
  240. }
  241. const t4 = /<[^>]*pos[^>]*> *(-?\d+(?:\.\d+)?) (-?\d+(?:\.\d+)?)/.exec(i2.data);
  242. if (t4) {
  243. const r3 = e2[0].toFixed(3), n5 = e2[1].toFixed(3), a2 = parseFloat(t4[1]).toFixed(3);
  244. r3 === parseFloat(t4[2]).toFixed(3) && n5 === a2 && (o3 = true);
  245. }
  246. }
  247. return { geometryType: a, swapXY: o3 };
  248. }
  249. async function J(t3, r2, n4) {
  250. return Q(r2, (await U(t3, { responseType: "text", query: { SERVICE: "WFS", REQUEST: "DescribeFeatureType", VERSION: x, TYPENAME: r2, ...n4 == null ? void 0 : n4.customParameters }, signal: n4 == null ? void 0 : n4.signal })).data);
  251. }
  252. function Q(e2, r2) {
  253. const { name: a } = re(e2), s4 = te(r2);
  254. ae(s4);
  255. const i2 = o(n2(s4.firstElementChild, { element: (e3) => ({ name: e3.getAttribute("name"), typeName: re(e3.getAttribute("type")).name }) }), ({ name: e3 }) => e3 === a);
  256. if (r(i2)) {
  257. const e3 = o(n2(s4.firstElementChild, { complexType: (e4) => e4 }), (e4) => e4.getAttribute("name") === i2.typeName);
  258. if (r(e3))
  259. return B(e3);
  260. }
  261. throw new s(P, `Type '${e2}' not found in document`, { document: new XMLSerializer().serializeToString(s4) });
  262. }
  263. var H = /* @__PURE__ */ new Set(["objectid", "fid"]);
  264. function B(e2) {
  265. const r2 = [], n4 = [];
  266. let a;
  267. const o3 = n2(e2, { complexContent: { extension: { sequence: { element: (e3) => e3 } } } });
  268. for (const s4 of o3) {
  269. const o4 = s4.getAttribute("name");
  270. if (!o4)
  271. continue;
  272. let i2, p;
  273. if (s4.hasAttribute("type") ? i2 = re(s4.getAttribute("type")).name : o2(s4, { simpleType: { restriction: (e3) => (i2 = re(e3.getAttribute("base")).name, { maxLength: (e4) => {
  274. p = +e4.getAttribute("value");
  275. } }) } }), !i2)
  276. continue;
  277. const u = "true" === s4.getAttribute("nillable");
  278. let c2 = false;
  279. switch (i2.toLowerCase()) {
  280. case "integer":
  281. case "nonpositiveinteger":
  282. case "negativeinteger":
  283. case "long":
  284. case "int":
  285. case "short":
  286. case "byte":
  287. case "nonnegativeinteger":
  288. case "unsignedlong":
  289. case "unsignedint":
  290. case "unsignedshort":
  291. case "unsignedbyte":
  292. case "positiveinteger":
  293. n4.push(new y({ name: o4, alias: o4, type: "integer", nullable: u }));
  294. break;
  295. case "float":
  296. case "double":
  297. case "decimal":
  298. n4.push(new y({ name: o4, alias: o4, type: "double", nullable: u }));
  299. break;
  300. case "boolean":
  301. case "string":
  302. case "gyearmonth":
  303. case "gyear":
  304. case "gmonthday":
  305. case "gday":
  306. case "gmonth":
  307. case "anyuri":
  308. case "qname":
  309. case "notation":
  310. case "normalizedstring":
  311. case "token":
  312. case "language":
  313. case "idrefs":
  314. case "entities":
  315. case "nmtoken":
  316. case "nmtokens":
  317. case "name":
  318. case "ncname":
  319. case "id":
  320. case "idref":
  321. case "entity":
  322. case "duration":
  323. case "time":
  324. n4.push(new y({ name: o4, alias: o4, type: "string", nullable: u, length: p != null ? p : 255 }));
  325. break;
  326. case "datetime":
  327. case "date":
  328. n4.push(new y({ name: o4, alias: o4, type: "date", nullable: u, length: p != null ? p : 36 }));
  329. break;
  330. case "pointpropertytype":
  331. a = "point", c2 = true;
  332. break;
  333. case "multipointpropertytype":
  334. a = "multipoint", c2 = true;
  335. break;
  336. case "curvepropertytype":
  337. case "multicurvepropertytype":
  338. case "multilinestringpropertytype":
  339. a = "polyline", c2 = true;
  340. break;
  341. case "surfacepropertytype":
  342. case "multisurfacepropertytype":
  343. case "multipolygonpropertytype":
  344. a = "polygon", c2 = true;
  345. break;
  346. case "geometrypropertytype":
  347. case "multigeometrypropertytype":
  348. c2 = true, r2.push(new s(G, `geometry type '${i2}' is not supported`, { type: new XMLSerializer().serializeToString(e2) }));
  349. break;
  350. default:
  351. r2.push(new s(k2, `Unknown field type '${i2}'`, { type: new XMLSerializer().serializeToString(e2) }));
  352. }
  353. c2 && n4.push(new y({ name: o4, alias: o4, type: "geometry", nullable: u }));
  354. }
  355. for (const t3 of n4)
  356. if ("integer" === t3.type && !t3.nullable && H.has(t3.name.toLowerCase())) {
  357. t3.type = "oid";
  358. break;
  359. }
  360. return { geometryType: a, fields: n4, errors: r2 };
  361. }
  362. async function K(r2, n4, a, o3) {
  363. var _a;
  364. let { data: s4 } = await U(r2, { responseType: "text", query: Z(n4, a, o3), signal: o3 == null ? void 0 : o3.signal });
  365. s4 = s4.replace(/": +(-?\d+),(\d+)(,)?/g, '": $1.$2$3');
  366. try {
  367. if ((_a = o3 == null ? void 0 : o3.dateFields) == null ? void 0 : _a.length) {
  368. const e2 = new Set(o3.dateFields);
  369. return JSON.parse(s4, (t3, r3) => e2.has(t3) ? e(r3) : r3);
  370. }
  371. return JSON.parse(s4);
  372. } catch (i2) {
  373. throw new s(A, "Error while parsing the\xA0response", { response: s4, error: i2 });
  374. }
  375. }
  376. function Z(e2, t3, r2) {
  377. return { SERVICE: "WFS", REQUEST: "GetFeature", VERSION: x, TYPENAMES: e2, OUTPUTFORMAT: t3, SRSNAME: "EPSG:4326", STARTINDEX: r2 == null ? void 0 : r2.startIndex, COUNT: r2 == null ? void 0 : r2.count, ...r2 == null ? void 0 : r2.customParameters };
  378. }
  379. function te(e2) {
  380. return new DOMParser().parseFromString(e2.trim(), "text/xml");
  381. }
  382. function re(e2) {
  383. const [t3, r2] = e2.split(":");
  384. return { prefix: r2 ? t3 : "", name: r2 != null ? r2 : t3 };
  385. }
  386. function ne(e2) {
  387. var _a;
  388. const r2 = (_a = e2.firstElementChild) == null ? void 0 : _a.getAttribute("version");
  389. if (r2 && r2 !== x)
  390. throw new s(U2, `Unsupported WFS version ${r2}. Supported version: ${x}`);
  391. }
  392. function ae(e2) {
  393. let r2 = "", n4 = "";
  394. if (o2(e2.firstElementChild, { Exception: (e3) => (r2 = e3.getAttribute("exceptionCode"), { ExceptionText: (e4) => {
  395. n4 = e4.textContent;
  396. } }) }), r2)
  397. throw new s(`wfs-layer:${r2}`, n4);
  398. }
  399. export {
  400. C,
  401. D,
  402. W,
  403. X,
  404. z2 as z,
  405. K
  406. };
  407. //# sourceMappingURL=chunk-DVYEME2A.js.map