featuresetbase-YGJZOO37.js 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783
  1. import {
  2. A,
  3. C,
  4. D,
  5. E as E3,
  6. I as I2,
  7. S,
  8. S2,
  9. b,
  10. e,
  11. e2,
  12. g,
  13. h,
  14. m as m2,
  15. q,
  16. s as s2,
  17. s2 as s3,
  18. v,
  19. w as w2,
  20. y as y2
  21. } from "./chunk-22GTG6HL.js";
  22. import "./chunk-UFOCENZS.js";
  23. import {
  24. E as E2,
  25. a3 as a
  26. } from "./chunk-6KWY7SN7.js";
  27. import {
  28. d as d2,
  29. s
  30. } from "./chunk-YYN5W6FL.js";
  31. import "./chunk-L5OAV75Q.js";
  32. import {
  33. l
  34. } from "./chunk-YQQTFR2M.js";
  35. import {
  36. d
  37. } from "./chunk-R5LRKX5A.js";
  38. import "./chunk-UDNYCFF2.js";
  39. import "./chunk-4JM5IOYA.js";
  40. import {
  41. m
  42. } from "./chunk-ETWBEEKL.js";
  43. import "./chunk-PJ6KSXOD.js";
  44. import "./chunk-MTFA4FTA.js";
  45. import "./chunk-YASLQAXE.js";
  46. import {
  47. Ke
  48. } from "./chunk-6NQ3AA2U.js";
  49. import "./chunk-524XACB7.js";
  50. import "./chunk-XKHC7KKF.js";
  51. import "./chunk-HGDNY7J3.js";
  52. import "./chunk-GD5TMIPM.js";
  53. import "./chunk-ZRX5UNQH.js";
  54. import "./chunk-VEAEIBHK.js";
  55. import "./chunk-6SASJ6IM.js";
  56. import "./chunk-3OHML7FO.js";
  57. import "./chunk-JGOAMEPM.js";
  58. import "./chunk-Z64YKYHD.js";
  59. import "./chunk-2VFJVI2I.js";
  60. import "./chunk-F37AVPUF.js";
  61. import "./chunk-GS2NUWMB.js";
  62. import "./chunk-FUEX356Y.js";
  63. import "./chunk-54AOZV5X.js";
  64. import "./chunk-PK35UGFJ.js";
  65. import "./chunk-P4UZNLD5.js";
  66. import "./chunk-FYNVVMWY.js";
  67. import "./chunk-Q52DVFYK.js";
  68. import "./chunk-HBMVUVZX.js";
  69. import "./chunk-TNLRDNTC.js";
  70. import "./chunk-OSNKP4CI.js";
  71. import "./chunk-435DJNTD.js";
  72. import "./chunk-T3EUPDKL.js";
  73. import "./chunk-2SJEIKRW.js";
  74. import {
  75. E,
  76. F2 as F,
  77. G,
  78. I,
  79. J,
  80. L,
  81. M,
  82. N,
  83. X,
  84. Y,
  85. n,
  86. ne,
  87. oe,
  88. t,
  89. t2,
  90. w,
  91. xe
  92. } from "./chunk-25BNEBXZ.js";
  93. import "./chunk-3ZFH4KQV.js";
  94. import "./chunk-PHRSJJ3U.js";
  95. import "./chunk-VVBOYBFX.js";
  96. import "./chunk-S7R5EXHN.js";
  97. import "./chunk-FMKGHOGD.js";
  98. import "./chunk-6URTNEGN.js";
  99. import "./chunk-KN7TOKVN.js";
  100. import "./chunk-RQJNTZAL.js";
  101. import "./chunk-QTOOFNRV.js";
  102. import "./chunk-7O56JPWQ.js";
  103. import "./chunk-6B2LQBKM.js";
  104. import "./chunk-MFI6BALW.js";
  105. import "./chunk-CIG5OHC7.js";
  106. import "./chunk-FUD7XO3N.js";
  107. import "./chunk-6EU7GFUT.js";
  108. import "./chunk-MFUAILAT.js";
  109. import "./chunk-HZJYXMI6.js";
  110. import "./chunk-27P5ZSC7.js";
  111. import "./chunk-UPD4MTCL.js";
  112. import "./chunk-GRBROWI6.js";
  113. import "./chunk-5NKYXKIA.js";
  114. import "./chunk-MPWGHCZG.js";
  115. import "./chunk-FTI5VP6T.js";
  116. import "./chunk-RZFGRBD7.js";
  117. import "./chunk-PUSPZYFZ.js";
  118. import "./chunk-EN7YGJWG.js";
  119. import "./chunk-VBNMTM7L.js";
  120. import "./chunk-3D3QEPRE.js";
  121. import "./chunk-JFNNSBWL.js";
  122. import "./chunk-UD63WBG3.js";
  123. import "./chunk-X7DBH4KK.js";
  124. import "./chunk-LY74KTXV.js";
  125. import "./chunk-EWE6EXPY.js";
  126. import "./chunk-KUXNUNAI.js";
  127. import "./chunk-KMAHKQ2G.js";
  128. import "./chunk-522WBHUO.js";
  129. import "./chunk-WNCU6BFU.js";
  130. import "./chunk-PIGRDDRG.js";
  131. import {
  132. y
  133. } from "./chunk-BJHM4JNS.js";
  134. import "./chunk-F6A2QQ26.js";
  135. import "./chunk-XLV7RUSE.js";
  136. import "./chunk-NTUXR253.js";
  137. import "./chunk-EOSZHC5H.js";
  138. import "./chunk-C43UE3Z5.js";
  139. import "./chunk-H2KDMZTR.js";
  140. import "./chunk-RMX2AZ4P.js";
  141. import "./chunk-NE3ESGA6.js";
  142. import "./chunk-YIS6BAC3.js";
  143. import "./chunk-7XXXCK2A.js";
  144. import "./chunk-7ZIDBK7B.js";
  145. import "./chunk-KHA63LLS.js";
  146. import "./chunk-FGKNEJKJ.js";
  147. import "./chunk-PSV473TI.js";
  148. import "./chunk-I3OBGWNS.js";
  149. import "./chunk-FONIFA5N.js";
  150. import "./chunk-EG5OI4V4.js";
  151. import "./chunk-65BYCSII.js";
  152. import "./chunk-WZQZRKNH.js";
  153. import "./chunk-LRDX4TO7.js";
  154. import "./chunk-6A4U74YA.js";
  155. import "./chunk-CYI7KFYB.js";
  156. import "./chunk-5LXROFTA.js";
  157. import "./chunk-GJXW4HL5.js";
  158. import "./chunk-WJW5DUN6.js";
  159. import "./chunk-W72F6AS3.js";
  160. import "./chunk-PJ7ZQ4VD.js";
  161. import "./chunk-WDLTDV2L.js";
  162. import "./chunk-TERAW6FT.js";
  163. import "./chunk-N2663GRX.js";
  164. import "./chunk-O4FY3ITT.js";
  165. import "./chunk-WEMIK25H.js";
  166. import "./chunk-4DDBH2K5.js";
  167. import "./chunk-7N4X6GF3.js";
  168. import "./chunk-JXW4QTJA.js";
  169. import "./chunk-UXF37FQ4.js";
  170. import "./chunk-ZOEK6QHJ.js";
  171. import "./chunk-XNLG7T2T.js";
  172. import "./chunk-IR4PV7VK.js";
  173. import "./chunk-2Z6LERTI.js";
  174. import "./chunk-OWVBLVP3.js";
  175. import "./chunk-AFZ7XSEW.js";
  176. import "./chunk-EGZW6HC3.js";
  177. import "./chunk-4NKD334K.js";
  178. import "./chunk-65K7LC56.js";
  179. import "./chunk-ATPLLI5W.js";
  180. import "./chunk-WJ3OEUD3.js";
  181. import "./chunk-MXB2XLKV.js";
  182. import "./chunk-XH7RUGVZ.js";
  183. import "./chunk-TBBTRX4O.js";
  184. import "./chunk-YBSUITLL.js";
  185. import "./chunk-ALDCDSPV.js";
  186. import "./chunk-DT6EAZQ5.js";
  187. import "./chunk-HNOZUNJ4.js";
  188. import "./chunk-VNFRAYHO.js";
  189. import "./chunk-R5IG2D6H.js";
  190. import "./chunk-VBRY5KJM.js";
  191. import "./chunk-PDKDCAAD.js";
  192. import "./chunk-ECW2QABR.js";
  193. import "./chunk-GCDJLKH4.js";
  194. import "./chunk-MRJEICT6.js";
  195. import "./chunk-Y3WMVFTW.js";
  196. import "./chunk-SAS7RONY.js";
  197. import "./chunk-WSRBH7BF.js";
  198. import "./chunk-IHXECKQQ.js";
  199. import {
  200. k
  201. } from "./chunk-ULGDPLM2.js";
  202. import "./chunk-EMJ4ZSM2.js";
  203. import "./chunk-IKP3YN53.js";
  204. import "./chunk-GZT4BVFP.js";
  205. import "./chunk-A5ICIBVI.js";
  206. // node_modules/@arcgis/core/arcade/functions/featuresetbase.js
  207. function _(e3, t3, n2, r) {
  208. if (r.length === 1) {
  209. if (L(r[0]))
  210. return l(e3, r[0], -1);
  211. if (E(r[0]))
  212. return l(e3, r[0].toArray(), -1);
  213. }
  214. return l(e3, r, -1);
  215. }
  216. async function J2(e3, t3, n2) {
  217. const r = e3.getVariables();
  218. if (r.length > 0) {
  219. const i = [];
  220. for (let e4 = 0; e4 < r.length; e4++) {
  221. const a3 = { name: r[e4] };
  222. i.push(await t3.evaluateIdentifier(n2, a3));
  223. }
  224. const a2 = {};
  225. for (let e4 = 0; e4 < r.length; e4++)
  226. a2[r[e4]] = i[e4];
  227. return e3.parameters = a2, e3;
  228. }
  229. return e3;
  230. }
  231. function q2(e3, t3, n2 = null) {
  232. for (const r in e3)
  233. if (r.toLowerCase() === t3.toLowerCase())
  234. return e3[r];
  235. return n2;
  236. }
  237. function K(e3) {
  238. if (e3 === null)
  239. return null;
  240. const t3 = { type: q2(e3, "type", ""), name: q2(e3, "name", "") };
  241. if (t3.type === "range")
  242. t3.range = q2(e3, "range", []);
  243. else {
  244. t3.codedValues = [];
  245. for (const n2 of q2(e3, "codedValues", []))
  246. t3.codedValues.push({ name: q2(n2, "name", ""), code: q2(n2, "code", null) });
  247. }
  248. return t3;
  249. }
  250. function Y2(e3) {
  251. if (e3 === null)
  252. return null;
  253. const t3 = {}, n2 = q2(e3, "wkt", null);
  254. n2 !== null && (t3.wkt = n2);
  255. const r = q2(e3, "wkid", null);
  256. return r !== null && (t3.wkid = r), t3;
  257. }
  258. function Z(e3) {
  259. if (e3 === null)
  260. return null;
  261. const t3 = { hasZ: q2(e3, "hasz", false), hasM: q2(e3, "hasm", false) }, n2 = q2(e3, "spatialreference", null);
  262. n2 && (t3.spatialReference = Y2(n2));
  263. const r = q2(e3, "x", null);
  264. if (r !== null)
  265. return t3.x = r, t3.y = q2(e3, "y", null), t3;
  266. const i = q2(e3, "rings", null);
  267. if (i !== null)
  268. return t3.rings = i, t3;
  269. const a2 = q2(e3, "paths", null);
  270. if (a2 !== null)
  271. return t3.paths = a2, t3;
  272. const s4 = q2(e3, "points", null);
  273. if (s4 !== null)
  274. return t3.points = s4, t3;
  275. for (const o of ["xmin", "xmax", "ymin", "ymax", "zmin", "zmax", "mmin", "mmax"]) {
  276. const n3 = q2(e3, o, null);
  277. n3 !== null && (t3[o] = n3);
  278. }
  279. return t3;
  280. }
  281. function Q(e3, t3) {
  282. for (const n2 of t3)
  283. if (n2 === e3)
  284. return true;
  285. return false;
  286. }
  287. function X2(e3) {
  288. return !!e3.layerDefinition && (!!e3.featureSet && (Q(e3.layerDefinition.geometryType, ["", "esriGeometryPoint", "esriGeometryPolyline", "esriGeometryPolygon", "esriGeometryMultipoint", "esriGeometryEnvelope"]) !== false && (e3.layerDefinition.objectIdField !== null && e3.layerDefinition.objectIdField !== "" && (L(e3.layerDefinition.fields) !== false && L(e3.featureSet.features) !== false))));
  289. }
  290. function ee(V) {
  291. V.mode === "async" && (V.functions.getuser = function(n2, r) {
  292. return V.standardFunctionAsync(n2, r, async (r2, s4, o) => {
  293. G(o, 1, 2);
  294. let l2 = I(o[1], ""), f = l2 === true;
  295. if (l2 = l2 === true || l2 === false ? "" : X(l2), o[0] instanceof s) {
  296. let e3 = null;
  297. n2.services && n2.services.portal && (e3 = n2.services.portal), e3 = E3(o[0], e3);
  298. const r3 = await b(e3, l2, f);
  299. if (r3) {
  300. const e4 = JSON.parse(JSON.stringify(r3));
  301. for (const t3 of ["lastLogin", "created", "modified"])
  302. e4[t3] !== void 0 && e4[t3] !== null && (e4[t3] = new Date(e4[t3]));
  303. return d.convertObjectToArcadeDictionary(e4);
  304. }
  305. return null;
  306. }
  307. let u = null;
  308. if (J(o[0]) && (u = o[0]), u) {
  309. if (f = false, l2)
  310. return null;
  311. await u.load();
  312. const r3 = await u.getOwningSystemUrl();
  313. if (!r3) {
  314. if (!l2) {
  315. const e3 = await u.getIdentityUser();
  316. return e3 ? d.convertObjectToArcadeDictionary({ username: e3 }) : null;
  317. }
  318. return null;
  319. }
  320. let s5 = null;
  321. n2.services && n2.services.portal && (s5 = n2.services.portal), s5 = E3(new s(r3), s5);
  322. const o2 = await b(s5, l2, f);
  323. if (o2) {
  324. const e3 = JSON.parse(JSON.stringify(o2));
  325. for (const t3 of ["lastLogin", "created", "modified"])
  326. e3[t3] !== void 0 && e3[t3] !== null && (e3[t3] = new Date(e3[t3]));
  327. return d.convertObjectToArcadeDictionary(e3);
  328. }
  329. return null;
  330. }
  331. throw new Error("Invalid Parameter");
  332. });
  333. }, V.signatures.push({ name: "getuser", min: "1", max: "2" }), V.functions.featuresetbyid = function(e3, t3) {
  334. return V.standardFunctionAsync(e3, t3, (e4, t4, n2) => {
  335. if (G(n2, 2, 4), n2[0] instanceof e) {
  336. const e5 = X(n2[1]);
  337. let t5 = I(n2[2], null);
  338. const r = oe(I(n2[3], true));
  339. if (t5 === null && (t5 = ["*"]), L(t5) === false)
  340. throw new Error("Invalid Parameter");
  341. return n2[0].featureSetById(e5, r, t5);
  342. }
  343. throw new Error("Invalid Parameter");
  344. });
  345. }, V.signatures.push({ name: "featuresetbyid", min: "2", max: "4" }), V.functions.getfeatureset = function(e3, t3) {
  346. return V.standardFunctionAsync(e3, t3, (t4, n2, r) => {
  347. if (G(r, 1, 2), Y(r[0])) {
  348. let t5 = I(r[1], "datasource");
  349. return t5 === null && (t5 = "datasource"), t5 = X(t5).toLowerCase(), D(r[0].fullSchema(), t5, e3.lrucache, e3.interceptor, e3.spatialReference);
  350. }
  351. throw new Error("Invalid Parameter");
  352. });
  353. }, V.signatures.push({ name: "getfeatureset", min: "1", max: "2" }), V.functions.featuresetbyportalitem = function(t3, n2) {
  354. return V.standardFunctionAsync(t3, n2, (n3, r, a2) => {
  355. if (G(a2, 2, 5), a2[0] === null)
  356. throw new Error("Portal is required");
  357. if (a2[0] instanceof s) {
  358. const e3 = X(a2[1]), n4 = X(a2[2]);
  359. let r2 = I(a2[3], null);
  360. const s5 = oe(I(a2[4], true));
  361. if (r2 === null && (r2 = ["*"]), L(r2) === false)
  362. throw new Error("Invalid Parameter");
  363. let l3 = null;
  364. return t3.services && t3.services.portal && (l3 = t3.services.portal), l3 = E3(a2[0], l3), q(e3, n4, t3.spatialReference, r2, s5, l3, t3.lrucache, t3.interceptor);
  365. }
  366. if (w(a2[0]) === false)
  367. throw new Error("Portal is required");
  368. const s4 = X(a2[0]), l2 = X(a2[1]);
  369. let f = I(a2[2], null);
  370. const u = oe(I(a2[3], true));
  371. if (f === null && (f = ["*"]), L(f) === false)
  372. throw new Error("Invalid Parameter");
  373. if (t3.services && t3.services.portal)
  374. return q(s4, l2, t3.spatialReference, f, u, t3.services.portal, t3.lrucache, t3.interceptor);
  375. throw new Error("Portal is required");
  376. });
  377. }, V.signatures.push({ name: "featuresetbyportalitem", min: "2", max: "5" }), V.functions.featuresetbyname = function(e3, t3) {
  378. return V.standardFunctionAsync(e3, t3, (e4, t4, n2) => {
  379. if (G(n2, 2, 4), n2[0] instanceof e) {
  380. const e5 = X(n2[1]);
  381. let t5 = I(n2[2], null);
  382. const r = oe(I(n2[3], true));
  383. if (t5 === null && (t5 = ["*"]), L(t5) === false)
  384. throw new Error("Invalid Parameter");
  385. return n2[0].featureSetByName(e5, r, t5);
  386. }
  387. throw new Error("Invalid Parameter");
  388. });
  389. }, V.signatures.push({ name: "featuresetbyname", min: "2", max: "4" }), V.functions.featureset = function(e3, n2) {
  390. return V.standardFunction(e3, n2, (n3, r, i) => {
  391. G(i, 1, 1);
  392. let a2 = i[0];
  393. const s4 = { layerDefinition: { geometryType: "", objectIdField: "", globalIdField: "", typeIdField: "", fields: [] }, featureSet: { geometryType: "", features: [] } };
  394. if (w(a2))
  395. a2 = JSON.parse(a2), a2.layerDefinition !== void 0 ? (s4.layerDefinition = a2.layerDefinition, s4.featureSet = a2.featureSet, a2.layerDefinition.spatialReference && (s4.layerDefinition.spatialReference = a2.layerDefinition.spatialReference)) : (s4.featureSet.features = a2.features, s4.featureSet.geometryType = a2.geometryType, s4.layerDefinition.geometryType = s4.featureSet.geometryType, s4.layerDefinition.objectIdField = a2.objectIdFieldName, s4.layerDefinition.typeIdField = a2.typeIdFieldName, s4.layerDefinition.globalIdField = a2.globalIdFieldName, s4.layerDefinition.fields = a2.fields, a2.spatialReference && (s4.layerDefinition.spatialReference = a2.spatialReference));
  396. else {
  397. if (!(i[0] instanceof d))
  398. throw new Error("Invalid Parameter");
  399. {
  400. a2 = JSON.parse(i[0].castToText());
  401. const e4 = q2(a2, "layerdefinition");
  402. if (e4 !== null) {
  403. s4.layerDefinition.geometryType = q2(e4, "geometrytype", ""), s4.featureSet.geometryType = s4.layerDefinition.geometryType, s4.layerDefinition.globalIdField = q2(e4, "globalidfield", ""), s4.layerDefinition.objectIdField = q2(e4, "objectidfield", ""), s4.layerDefinition.typeIdField = q2(e4, "typeidfield", "");
  404. const t3 = q2(e4, "spatialreference", null);
  405. t3 && (s4.layerDefinition.spatialReference = Y2(t3));
  406. for (const r2 of q2(e4, "fields", [])) {
  407. const e5 = { name: q2(r2, "name", ""), alias: q2(r2, "alias", ""), type: q2(r2, "type", ""), nullable: q2(r2, "nullable", true), editable: q2(r2, "editable", true), length: q2(r2, "length", null), domain: K(q2(r2, "domain")) };
  408. s4.layerDefinition.fields.push(e5);
  409. }
  410. const n4 = q2(a2, "featureset", null);
  411. if (n4) {
  412. const e5 = {};
  413. for (const t4 of s4.layerDefinition.fields)
  414. e5[t4.name.toLowerCase()] = t4.name;
  415. for (const t4 of q2(n4, "features", [])) {
  416. const n5 = {}, r2 = q2(t4, "attributes", {});
  417. for (const t5 in r2)
  418. n5[e5[t5.toLowerCase()]] = r2[t5];
  419. s4.featureSet.features.push({ attributes: n5, geometry: Z(q2(t4, "geometry", null)) });
  420. }
  421. }
  422. } else {
  423. s4.layerDefinition.geometryType = q2(a2, "geometrytype", ""), s4.featureSet.geometryType = s4.layerDefinition.geometryType, s4.layerDefinition.objectIdField = q2(a2, "objectidfieldname", ""), s4.layerDefinition.typeIdField = q2(a2, "typeidfieldname", "");
  424. const e5 = q2(a2, "spatialreference", null);
  425. e5 && (s4.layerDefinition.spatialReference = Y2(e5));
  426. for (const n4 of q2(a2, "fields", [])) {
  427. const e6 = { name: q2(n4, "name", ""), alias: q2(n4, "alias", ""), type: q2(n4, "type", ""), nullable: q2(n4, "nullable", true), editable: q2(n4, "editable", true), length: q2(n4, "length", null), domain: K(q2(n4, "domain")) };
  428. s4.layerDefinition.fields.push(e6);
  429. }
  430. const t3 = {};
  431. for (const n4 of s4.layerDefinition.fields)
  432. t3[n4.name.toLowerCase()] = n4.name;
  433. for (const n4 of q2(a2, "features", [])) {
  434. const e6 = {}, r2 = q2(n4, "attributes", {});
  435. for (const n5 in r2)
  436. e6[t3[n5.toLowerCase()]] = r2[n5];
  437. s4.featureSet.features.push({ attributes: e6, geometry: Z(q2(n4, "geometry", null)) });
  438. }
  439. }
  440. }
  441. }
  442. if (X2(s4) === false)
  443. throw new Error("Invalid Parameter");
  444. return y2.create(s4, e3.spatialReference);
  445. });
  446. }, V.signatures.push({ name: "featureset", min: "1", max: "1" }), V.functions.filter = function(e3, t3) {
  447. return V.standardFunctionAsync(e3, t3, async (t4, n2, r) => {
  448. if (G(r, 2, 2), L(r[0]) || E(r[0])) {
  449. const t5 = [];
  450. let n3 = r[0];
  451. n3 instanceof t && (n3 = n3.toArray());
  452. let i = null;
  453. if (r[1] instanceof t2)
  454. i = V.arcadeCustomFunctionHandler(r[1]);
  455. else if (r[1] instanceof N)
  456. i = (...t6) => r[1].fn(e3, { preparsed: true, arguments: t6 });
  457. else {
  458. if (!(r[1] instanceof M))
  459. throw new Error("Invalid Parameter");
  460. i = (...e4) => {
  461. if (e4.length !== r[1].paramCount)
  462. throw new Error("Invalid parameters");
  463. return r[1].fn(...e4);
  464. };
  465. }
  466. for (const e4 of n3) {
  467. const n4 = i(e4);
  468. k(n4) ? await n4 === true && t5.push(e4) : n4 === true && t5.push(e4);
  469. }
  470. return t5;
  471. }
  472. if (J(r[0])) {
  473. const t5 = await r[0].load(), n3 = m.create(r[1], t5.getFieldsIndex()), i = n3.getVariables();
  474. if (i.length > 0) {
  475. const t6 = [];
  476. for (let n4 = 0; n4 < i.length; n4++) {
  477. const r2 = { name: i[n4] };
  478. t6.push(await V.evaluateIdentifier(e3, r2));
  479. }
  480. const a2 = {};
  481. for (let e4 = 0; e4 < i.length; e4++)
  482. a2[i[e4]] = t6[e4];
  483. return n3.parameters = a2, new h({ parentfeatureset: r[0], whereclause: n3 });
  484. }
  485. return new h({ parentfeatureset: r[0], whereclause: n3 });
  486. }
  487. throw new Error("Filter cannot accept this parameter type");
  488. });
  489. }, V.signatures.push({ name: "filter", min: "2", max: "2" }), V.functions.orderby = function(e3, t3) {
  490. return V.standardFunctionAsync(e3, t3, async (e4, t4, n2) => {
  491. if (G(n2, 2, 2), J(n2[0])) {
  492. const e5 = new e2(n2[1]);
  493. return new s2({ parentfeatureset: n2[0], orderbyclause: e5 });
  494. }
  495. throw new Error("Order cannot accept this parameter type");
  496. });
  497. }, V.signatures.push({ name: "orderby", min: "2", max: "2" }), V.functions.top = function(e3, t3) {
  498. return V.standardFunctionAsync(e3, t3, async (e4, t4, n2) => {
  499. if (G(n2, 2, 2), J(n2[0]))
  500. return new s3({ parentfeatureset: n2[0], topnum: n2[1] });
  501. if (L(n2[0]))
  502. return ne(n2[1]) >= n2[0].length ? n2[0].slice(0) : n2[0].slice(0, ne(n2[1]));
  503. if (E(n2[0]))
  504. return ne(n2[1]) >= n2[0].length() ? n2[0].slice(0) : n2[0].slice(0, ne(n2[1]));
  505. throw new Error("Top cannot accept this parameter type");
  506. });
  507. }, V.signatures.push({ name: "top", min: "2", max: "2" }), V.functions.first = function(e3, t3) {
  508. return V.standardFunctionAsync(e3, t3, async (e4, t4, r) => {
  509. if (G(r, 1, 1), J(r[0])) {
  510. const t5 = await r[0].first(e4.abortSignal);
  511. if (t5 !== null) {
  512. const e5 = d2.createFromGraphicLikeObject(t5.geometry, t5.attributes, r[0]);
  513. return e5._underlyingGraphic = t5, e5;
  514. }
  515. return t5;
  516. }
  517. return L(r[0]) ? r[0].length === 0 ? null : r[0][0] : E(r[0]) ? r[0].length() === 0 ? null : r[0].get(0) : null;
  518. });
  519. }, V.signatures.push({ name: "first", min: "1", max: "1" }), V.functions.attachments = function(e3, n2) {
  520. return V.standardFunctionAsync(e3, n2, async (n3, r, i) => {
  521. G(i, 1, 2);
  522. const a2 = { minsize: -1, maxsize: -1, types: null, returnMetadata: false };
  523. if (i.length > 1) {
  524. if (i[1] instanceof d) {
  525. if (i[1].hasField("minsize") && (a2.minsize = ne(i[1].field("minsize"))), i[1].hasField("metadata") && (a2.returnMetadata = oe(i[1].field("metadata"))), i[1].hasField("maxsize") && (a2.maxsize = ne(i[1].field("maxsize"))), i[1].hasField("types")) {
  526. const e4 = xe(i[1].field("types"), false);
  527. e4.length > 0 && (a2.types = e4);
  528. }
  529. } else if (i[1] !== null)
  530. throw new Error("Invalid Parameter");
  531. }
  532. if (Y(i[0])) {
  533. let t3 = i[0]._layer;
  534. return t3 instanceof Ke && (t3 = S2(t3, e3.spatialReference, ["*"], true, e3.lrucache, e3.interceptor)), t3 === null ? [] : J(t3) === false ? [] : (await t3.load(), t3.queryAttachments(i[0].field(t3.objectIdField), a2.minsize, a2.maxsize, a2.types, a2.returnMetadata));
  535. }
  536. if (i[0] === null)
  537. return [];
  538. throw new Error("Invalid Parameter");
  539. });
  540. }, V.signatures.push({ name: "attachments", min: "1", max: "2" }), V.functions.featuresetbyrelationshipname = function(e3, t3) {
  541. return V.standardFunctionAsync(e3, t3, async (t4, n2, r) => {
  542. G(r, 2, 4);
  543. const i = r[0], a2 = X(r[1]);
  544. let s4 = I(r[2], null);
  545. const o = oe(I(r[3], true));
  546. if (s4 === null && (s4 = ["*"]), L(s4) === false)
  547. throw new Error("Invalid Parameter");
  548. if (r[0] === null)
  549. return null;
  550. if (!Y(r[0]))
  551. throw new Error("Invalid Parameter");
  552. let c = i._layer;
  553. if (c instanceof Ke && (c = S2(c, e3.spatialReference, ["*"], true, e3.lrucache, e3.interceptor)), c === null)
  554. return null;
  555. if (J(c) === false)
  556. return null;
  557. c = await c.load();
  558. const d3 = c.relationshipMetaData().filter((e4) => e4.name === a2);
  559. if (d3.length === 0)
  560. return null;
  561. if (d3[0].relationshipTableId !== void 0 && d3[0].relationshipTableId !== null && d3[0].relationshipTableId > -1)
  562. return A(c, d3[0], i.field(c.objectIdField), c.spatialReference, s4, o, e3.lrucache, e3.interceptor);
  563. let m3 = c.serviceUrl();
  564. if (!m3)
  565. return null;
  566. m3 = m3.charAt(m3.length - 1) === "/" ? m3 + d3[0].relatedTableId.toString() : m3 + "/" + d3[0].relatedTableId.toString();
  567. const I3 = await I2(m3, c.spatialReference, s4, o, e3.lrucache, e3.interceptor);
  568. await I3.load();
  569. let D2 = I3.relationshipMetaData();
  570. if (D2 = D2.filter((e4) => e4.id === d3[0].id), i.hasField(d3[0].keyField) === false || i.field(d3[0].keyField) === null) {
  571. const e4 = await c.getFeatureByObjectId(i.field(c.objectIdField), [d3[0].keyField]);
  572. if (e4) {
  573. const t5 = m.create(D2[0].keyField + "= @id", I3.getFieldsIndex());
  574. return t5.parameters = { id: e4.attributes[d3[0].keyField] }, I3.filter(t5);
  575. }
  576. return new a({ parentfeatureset: I3 });
  577. }
  578. const b2 = m.create(D2[0].keyField + "= @id", I3.getFieldsIndex());
  579. return b2.parameters = { id: i.field(d3[0].keyField) }, I3.filter(b2);
  580. });
  581. }, V.signatures.push({ name: "featuresetbyrelationshipname", min: "2", max: "4" }), V.functions.featuresetbyassociation = function(e3, t3) {
  582. return V.standardFunctionAsync(e3, t3, async (t4, n2, r) => {
  583. G(r, 2, 3);
  584. const i = r[0], a2 = X(I(r[1], "")).toLowerCase(), s4 = w(r[2]) ? X(r[2]) : null;
  585. if (r[0] === null)
  586. return null;
  587. if (!Y(r[0]))
  588. throw new Error("Invalid Parameter");
  589. let o = i._layer;
  590. if (o instanceof Ke && (o = S2(o, e3.spatialReference, ["*"], true, e3.lrucache, e3.interceptor)), o === null)
  591. return null;
  592. if (J(o) === false)
  593. return null;
  594. await o.load();
  595. const f = o.serviceUrl(), u = await g(f, e3.spatialReference);
  596. let d3 = null, m3 = null, h2 = false;
  597. if (s4 !== null && s4 !== "" && s4 !== void 0) {
  598. for (const e4 of u.terminals)
  599. e4.terminalName === s4 && (m3 = e4.terminalId);
  600. m3 === null && (h2 = true);
  601. }
  602. const E4 = u.associations.getFieldsIndex(), D2 = E4.get("TOGLOBALID").name, b2 = E4.get("FROMGLOBALID").name, A2 = E4.get("TOTERMINALID").name, N2 = E4.get("FROMTERMINALID").name, x = E4.get("FROMNETWORKSOURCEID").name, O = E4.get("TONETWORKSOURCEID").name, C2 = E4.get("ASSOCIATIONTYPE").name, R = E4.get("ISCONTENTVISIBLE").name, M2 = E4.get("OBJECTID").name;
  603. for (const e4 of o.fields)
  604. if (e4.type === "global-id") {
  605. d3 = i.field(e4.name);
  606. break;
  607. }
  608. let P = null, k2 = new v(new y({ name: "percentalong", alias: "percentalong", type: "double" }), m.create("0", u.associations.getFieldsIndex())), B = new v(new y({ name: "side", alias: "side", type: "string" }), m.create("''", u.associations.getFieldsIndex()));
  609. const V2 = "globalid", H = "globalId", _2 = {};
  610. for (const e4 in u.lkp)
  611. _2[e4] = u.lkp[e4].sourceId;
  612. const J3 = new m2(new y({ name: "classname", alias: "classname", type: "string" }), null, _2);
  613. let q3 = "";
  614. switch (a2) {
  615. case "midspan": {
  616. q3 = `((${D2}='${d3}') OR ( ${b2}='${d3}')) AND (${C2} IN (5))`, J3.codefield = m.create(`CASE WHEN (${D2}='${d3}') THEN ${x} ELSE ${O} END`, u.associations.getFieldsIndex());
  617. const e4 = n(C.findField(u.associations.fields, b2));
  618. e4.name = V2, e4.alias = V2, P = new v(e4, m.create(`CASE WHEN (${b2}='${d3}') THEN ${D2} ELSE ${b2} END`, u.associations.getFieldsIndex())), k2 = u.unVersion >= 4 ? new S(C.findField(u.associations.fields, E4.get("PERCENTALONG").name)) : new v(new y({ name: "percentalong", alias: "percentalong", type: "double" }), m.create("0", u.associations.getFieldsIndex()));
  619. break;
  620. }
  621. case "junctionedge": {
  622. q3 = `((${D2}='${d3}') OR ( ${b2}='${d3}')) AND (${C2} IN (4,6))`, J3.codefield = m.create(`CASE WHEN (${D2}='${d3}') THEN ${x} ELSE ${O} END`, u.associations.getFieldsIndex());
  623. const e4 = n(C.findField(u.associations.fields, b2));
  624. e4.name = V2, e4.alias = V2, P = new v(e4, m.create(`CASE WHEN (${b2}='${d3}') THEN ${D2} ELSE ${b2} END`, u.associations.getFieldsIndex())), B = new v(new y({ name: "side", alias: "side", type: "string" }), m.create(`CASE WHEN (${C2}=4) THEN 'from' ELSE 'to' END`, u.associations.getFieldsIndex()));
  625. break;
  626. }
  627. case "connected": {
  628. let e4 = `${D2}='@T'`, t5 = `${b2}='@T'`;
  629. m3 !== null && (e4 += ` AND ${A2}=@A`, t5 += ` AND ${N2}=@A`), q3 = "((" + e4 + ") OR (" + t5 + "))", q3 = F(q3, "@T", d3), e4 = F(e4, "@T", d3), m3 !== null && (e4 = F(e4, "@A", m3.toString()), q3 = F(q3, "@A", m3.toString())), J3.codefield = m.create("CASE WHEN " + e4 + ` THEN ${x} ELSE ${O} END`, u.associations.getFieldsIndex());
  630. const n3 = n(C.findField(u.associations.fields, b2));
  631. n3.name = V2, n3.alias = V2, P = new v(n3, m.create("CASE WHEN " + e4 + ` THEN ${b2} ELSE ${D2} END`, u.associations.getFieldsIndex()));
  632. break;
  633. }
  634. case "container":
  635. q3 = `${D2}='${d3}' AND ${C2} = 2`, m3 !== null && (q3 += ` AND ${A2} = ` + m3.toString()), J3.codefield = x, q3 = "( " + q3 + " )", P = new w2(C.findField(u.associations.fields, b2), V2, V2);
  636. case "content":
  637. q3 = `(${b2}='${d3}' AND ${C2} = 2)`, m3 !== null && (q3 += ` AND ${N2} = ` + m3.toString()), J3.codefield = O, q3 = "( " + q3 + " )", P = new w2(C.findField(u.associations.fields, D2), V2, V2);
  638. break;
  639. case "structure":
  640. q3 = `(${D2}='${d3}' AND ${C2} = 3)`, m3 !== null && (q3 += ` AND ${A2} = ` + m3.toString()), J3.codefield = x, q3 = "( " + q3 + " )", P = new w2(C.findField(u.associations.fields, b2), V2, H);
  641. break;
  642. case "attached":
  643. q3 = `(${b2}='${d3}' AND ${C2} = 3)`, m3 !== null && (q3 += ` AND ${N2} = ` + m3.toString()), J3.codefield = O, q3 = "( " + q3 + " )", P = new w2(C.findField(u.associations.fields, D2), V2, H);
  644. break;
  645. default:
  646. throw new Error("Invalid Parameter");
  647. }
  648. h2 && (q3 = "1 <> 1");
  649. return new C({ parentfeatureset: u.associations, adaptedFields: [new S(C.findField(u.associations.fields, M2)), new S(C.findField(u.associations.fields, R)), P, B, J3, k2], extraFilter: q3 ? m.create(q3, u.associations.getFieldsIndex()) : null });
  650. });
  651. }, V.signatures.push({ name: "featuresetbyassociation", min: "2", max: "6" }), V.functions.groupby = function(e3, n2) {
  652. return V.standardFunctionAsync(e3, n2, async (n3, r, i) => {
  653. if (G(i, 3, 3), !J(i[0]))
  654. throw new Error("Illegal Value: GroupBy");
  655. const a2 = await i[0].load(), s4 = [], o = [];
  656. let l2 = false, f = [];
  657. if (w(i[1]))
  658. f.push(i[1]);
  659. else if (i[1] instanceof d)
  660. f.push(i[1]);
  661. else if (L(i[1]))
  662. f = i[1];
  663. else {
  664. if (!E(i[1]))
  665. throw new Error("Illegal Value: GroupBy");
  666. f = i[1].toArray();
  667. }
  668. for (const e4 of f)
  669. if (w(e4)) {
  670. const t3 = m.create(X(e4), a2.getFieldsIndex()), n4 = E2(t3) === true ? X(e4) : "%%%%FIELDNAME";
  671. s4.push({ name: n4, expression: t3 }), n4 === "%%%%FIELDNAME" && (l2 = true);
  672. } else {
  673. if (!(e4 instanceof d))
  674. throw new Error("Illegal Value: GroupBy");
  675. {
  676. const t3 = e4.hasField("name") ? e4.field("name") : "%%%%FIELDNAME", n4 = e4.hasField("expression") ? e4.field("expression") : "";
  677. if (t3 === "%%%%FIELDNAME" && (l2 = true), !t3)
  678. throw new Error("Illegal Value: GroupBy");
  679. s4.push({ name: t3, expression: m.create(n4 || t3, a2.getFieldsIndex()) });
  680. }
  681. }
  682. if (f = [], w(i[2]))
  683. f.push(i[2]);
  684. else if (L(i[2]))
  685. f = i[2];
  686. else if (E(i[2]))
  687. f = i[2].toArray();
  688. else {
  689. if (!(i[2] instanceof d))
  690. throw new Error("Illegal Value: GroupBy");
  691. f.push(i[2]);
  692. }
  693. for (const e4 of f) {
  694. if (!(e4 instanceof d))
  695. throw new Error("Illegal Value: GroupBy");
  696. {
  697. const t3 = e4.hasField("name") ? e4.field("name") : "", n4 = e4.hasField("statistic") ? e4.field("statistic") : "", r2 = e4.hasField("expression") ? e4.field("expression") : "";
  698. if (!t3 || !n4 || !r2)
  699. throw new Error("Illegal Value: GroupBy");
  700. o.push({ name: t3, statistic: n4.toLowerCase(), expression: m.create(r2, a2.getFieldsIndex()) });
  701. }
  702. }
  703. if (l2) {
  704. const e4 = {};
  705. for (const n4 of a2.fields)
  706. e4[n4.name.toLowerCase()] = 1;
  707. for (const n4 of s4)
  708. n4.name !== "%%%%FIELDNAME" && (e4[n4.name.toLowerCase()] = 1);
  709. for (const n4 of o)
  710. n4.name !== "%%%%FIELDNAME" && (e4[n4.name.toLowerCase()] = 1);
  711. let t3 = 0;
  712. for (const n4 of s4)
  713. if (n4.name === "%%%%FIELDNAME") {
  714. for (; e4["field_" + t3.toString()] === 1; )
  715. t3++;
  716. e4["field_" + t3.toString()] = 1, n4.name = "FIELD_" + t3.toString();
  717. }
  718. }
  719. for (const t3 of s4)
  720. await J2(t3.expression, V, e3);
  721. for (const t3 of o)
  722. await J2(t3.expression, V, e3);
  723. return i[0].groupby(s4, o);
  724. });
  725. }, V.signatures.push({ name: "groupby", min: "3", max: "3" }), V.functions.distinct = function(e3, n2) {
  726. return V.standardFunctionAsync(e3, n2, async (n3, r, i) => {
  727. if (J(i[0])) {
  728. G(i, 2, 2);
  729. const n4 = await i[0].load(), r2 = [];
  730. let a2 = [];
  731. if (w(i[1]))
  732. a2.push(i[1]);
  733. else if (i[1] instanceof d)
  734. a2.push(i[1]);
  735. else if (L(i[1]))
  736. a2 = i[1];
  737. else {
  738. if (!E(i[1]))
  739. throw new Error("Illegal Value: GroupBy");
  740. a2 = i[1].toArray();
  741. }
  742. let s4 = false;
  743. for (const e4 of a2)
  744. if (w(e4)) {
  745. const t3 = m.create(X(e4), n4.getFieldsIndex()), i2 = E2(t3) === true ? X(e4) : "%%%%FIELDNAME";
  746. r2.push({ name: i2, expression: t3 }), i2 === "%%%%FIELDNAME" && (s4 = true);
  747. } else {
  748. if (!(e4 instanceof d))
  749. throw new Error("Illegal Value: GroupBy");
  750. {
  751. const t3 = e4.hasField("name") ? e4.field("name") : "%%%%FIELDNAME", i2 = e4.hasField("expression") ? e4.field("expression") : "";
  752. if (t3 === "%%%%FIELDNAME" && (s4 = true), !t3)
  753. throw new Error("Illegal Value: GroupBy");
  754. r2.push({ name: t3, expression: m.create(i2 || t3, n4.getFieldsIndex()) });
  755. }
  756. }
  757. if (s4) {
  758. const e4 = {};
  759. for (const r3 of n4.fields)
  760. e4[r3.name.toLowerCase()] = 1;
  761. for (const n5 of r2)
  762. n5.name !== "%%%%FIELDNAME" && (e4[n5.name.toLowerCase()] = 1);
  763. let t3 = 0;
  764. for (const n5 of r2)
  765. if (n5.name === "%%%%FIELDNAME") {
  766. for (; e4["field_" + t3.toString()] === 1; )
  767. t3++;
  768. e4["field_" + t3.toString()] = 1, n5.name = "FIELD_" + t3.toString();
  769. }
  770. }
  771. for (const t3 of r2)
  772. await J2(t3.expression, V, e3);
  773. return i[0].groupby(r2, []);
  774. }
  775. return _("distinct", n3, r, i);
  776. });
  777. });
  778. }
  779. export {
  780. ee as registerFunctions
  781. };
  782. //# sourceMappingURL=featuresetbase-YGJZOO37.js.map