chunk-MDR3KRG4.js 59 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548
  1. import {
  2. F,
  3. K,
  4. M,
  5. O,
  6. R,
  7. S as S2,
  8. W,
  9. b,
  10. h,
  11. m as m2,
  12. p,
  13. x
  14. } from "./chunk-DVIKBNBZ.js";
  15. import {
  16. f as f3
  17. } from "./chunk-4GGDRIJK.js";
  18. import {
  19. DateTime,
  20. S,
  21. c2 as c,
  22. d,
  23. f as f2,
  24. i,
  25. i3 as i2,
  26. l2 as l,
  27. m,
  28. o,
  29. t3 as t,
  30. v,
  31. y
  32. } from "./chunk-FT2BCPUP.js";
  33. import {
  34. r
  35. } from "./chunk-JLSNMUQJ.js";
  36. import {
  37. k2 as k
  38. } from "./chunk-PQFTYGF5.js";
  39. import {
  40. C
  41. } from "./chunk-V6P2MAQQ.js";
  42. import {
  43. f
  44. } from "./chunk-YXWMMD76.js";
  45. // node_modules/@arcgis/core/arcade/featureset/support/errorsupport.js
  46. var t2;
  47. !function(e2) {
  48. e2.InvalidFunctionParameters = "InvalidFunctionParameters", e2.UnsupportedSqlFunction = "UnsupportedSqlFunction", e2.UnsupportedOperator = "UnsupportedOperator", e2.UnsupportedSyntax = "UnsupportedSyntax", e2.UnsupportedIsRhs = "UnsupportedIsRhs", e2.UnsupportedIsLhs = "UnsupportedIsLhs", e2.MissingStatisticParameters = "MissingStatisticParameters";
  49. }(t2 || (t2 = {}));
  50. var r2 = { [t2.MissingStatisticParameters]: "Statistic does not have 1 or 0 Parameters", [t2.InvalidFunctionParameters]: "Invalid parameters for call to {function}", [t2.UnsupportedIsLhs]: "Unsupported left hand expression in is statement", [t2.UnsupportedIsRhs]: "Unsupported right hand expression in is statement", [t2.UnsupportedOperator]: "Unsupported operator - {operator}", [t2.UnsupportedSyntax]: "Unsupported syntax - {node}", [t2.UnsupportedSqlFunction]: "Sql function not found = {function}" };
  51. var s = class extends Error {
  52. constructor(t4, n2) {
  53. super(i(r2[t4], n2)), this.declaredRootClass = "esri.arcade.featureset.support.sqlerror", Error.captureStackTrace && Error.captureStackTrace(this, s);
  54. }
  55. };
  56. var n;
  57. !function(e2) {
  58. e2.NeverReach = "NeverReach", e2.NotImplemented = "NotImplemented", e2.Cancelled = "Cancelled", e2.InvalidStatResponse = "InvalidStatResponse", e2.InvalidRequest = "InvalidRequest", e2.RequestFailed = "RequestFailed", e2.MissingFeatures = "MissingFeatures", e2.AggregationFieldNotFound = "AggregationFieldNotFound", e2.DataElementsNotFound = "DataElementsNotFound";
  59. }(n || (n = {}));
  60. var a = { [n.Cancelled]: "Cancelled", [n.InvalidStatResponse]: "Invalid statistics response from service", [n.InvalidRequest]: "Invalid request", [n.RequestFailed]: "Request failed - {reason}", [n.MissingFeatures]: "Missing features", [n.AggregationFieldNotFound]: "Aggregation field not found", [n.DataElementsNotFound]: "Data elements not found on service", [n.NeverReach]: "Encountered unreachable logic", [n.NotImplemented]: "Not implemented" };
  61. var o2 = class extends Error {
  62. constructor(t4, r3) {
  63. super(i(a[t4], r3)), this.declaredRootClass = "esri.arcade.featureset.support.featureseterror", Error.captureStackTrace && Error.captureStackTrace(this, o2);
  64. }
  65. };
  66. // node_modules/@arcgis/core/arcade/featureset/support/cache.js
  67. var a2 = class {
  68. constructor() {
  69. this._databaseTypeMetaData = {}, this._layerInfo = {};
  70. }
  71. clearDatabaseType(a3) {
  72. void 0 === this._databaseTypeMetaData[a3] && delete this._databaseTypeMetaData[a3];
  73. }
  74. getDatabaseType(a3) {
  75. return "MUSTBESET" === a3 || void 0 === this._databaseTypeMetaData[a3] ? null : this._databaseTypeMetaData[a3];
  76. }
  77. setDatabaseType(a3, e2) {
  78. this._databaseTypeMetaData[a3] = e2;
  79. }
  80. getLayerInfo(a3) {
  81. return void 0 === this._layerInfo[a3] ? null : this._layerInfo[a3];
  82. }
  83. setLayerInfo(a3, e2) {
  84. this._layerInfo[a3] = e2;
  85. }
  86. clearLayerInfo(a3) {
  87. void 0 !== this._layerInfo[a3] && delete this._layerInfo[a3];
  88. }
  89. };
  90. a2.applicationCache = null;
  91. // node_modules/@arcgis/core/arcade/featureset/support/sqlUtils.js
  92. function s2(e2, r3) {
  93. return u(e2 == null ? void 0 : e2.parseTree, r3, e2 == null ? void 0 : e2.parameters);
  94. }
  95. function o3(e2, r3, t4) {
  96. return u(e2, r3, t4);
  97. }
  98. function c2(t4, n2, a3, s4) {
  99. return f3.create(u(t4.parseTree, t.Standardised, t4.parameters, n2, a3), s4);
  100. }
  101. function i3(t4, n2, a3 = "AND") {
  102. return f3.create("((" + s2(t4, t.Standardised) + ")" + a3 + "(" + s2(n2, t.Standardised) + "))", t4.fieldsIndex);
  103. }
  104. function u(e2, r3, a3, s4 = null, o5 = null) {
  105. let c3, i5, p4, g3;
  106. switch (e2.type) {
  107. case "interval":
  108. return N(u(e2.value, r3, a3, s4, o5), e2.qualifier, e2.op);
  109. case "case-expression": {
  110. let t4 = " CASE ";
  111. "simple" === e2.format && (t4 += u(e2.operand, r3, a3, s4, o5));
  112. for (let n2 = 0; n2 < e2.clauses.length; n2++)
  113. t4 += " WHEN " + u(e2.clauses[n2].operand, r3, a3, s4, o5) + " THEN " + u(e2.clauses[n2].value, r3, a3, s4, o5);
  114. return null !== e2.else && (t4 += " ELSE " + u(e2.else, r3, a3, s4, o5)), t4 += " END ", t4;
  115. }
  116. case "parameter": {
  117. const t4 = a3[e2.value.toLowerCase()];
  118. if ("string" == typeof t4) {
  119. return "'" + a3[e2.value.toLowerCase()].toString().replace(/'/g, "''") + "'";
  120. }
  121. if (t4 instanceof Date)
  122. return f4(t4, r3);
  123. if (t4 instanceof Array) {
  124. const e3 = [];
  125. for (let n2 = 0; n2 < t4.length; n2++)
  126. "string" == typeof t4[n2] ? e3.push("'" + t4[n2].toString().replace(/'/g, "''") + "'") : t4[n2] instanceof Date ? e3.push(f4(t4[n2], r3)) : e3.push(t4[n2].toString());
  127. return e3;
  128. }
  129. return t4.toString();
  130. }
  131. case "expression-list":
  132. i5 = [];
  133. for (const t4 of e2.value)
  134. i5.push(u(t4, r3, a3, s4, o5));
  135. return i5;
  136. case "unary-expression":
  137. return " ( NOT " + u(e2.expr, r3, a3, s4, o5) + " ) ";
  138. case "binary-expression":
  139. switch (e2.operator) {
  140. case "AND":
  141. return " (" + u(e2.left, r3, a3, s4, o5) + " AND " + u(e2.right, r3, a3, s4, o5) + ") ";
  142. case "OR":
  143. return " (" + u(e2.left, r3, a3, s4, o5) + " OR " + u(e2.right, r3, a3, s4, o5) + ") ";
  144. case "IS":
  145. if ("null" !== e2.right.type)
  146. throw new s(t2.UnsupportedIsRhs);
  147. return " (" + u(e2.left, r3, a3, s4, o5) + " IS NULL )";
  148. case "ISNOT":
  149. if ("null" !== e2.right.type)
  150. throw new s(t2.UnsupportedIsRhs);
  151. return " (" + u(e2.left, r3, a3, s4, o5) + " IS NOT NULL )";
  152. case "IN":
  153. return c3 = [], "expression-list" === e2.right.type ? (c3 = u(e2.right, r3, a3, s4, o5), " (" + u(e2.left, r3, a3, s4, o5) + " IN (" + c3.join(",") + ")) ") : (g3 = u(e2.right, r3, a3, s4, o5), g3 instanceof Array ? " (" + u(e2.left, r3, a3, s4, o5) + " IN (" + g3.join(",") + ")) " : " (" + u(e2.left, r3, a3, s4, o5) + " IN (" + g3 + ")) ");
  154. case "NOT IN":
  155. return c3 = [], "expression-list" === e2.right.type ? (c3 = u(e2.right, r3, a3, s4, o5), " (" + u(e2.left, r3, a3, s4, o5) + " NOT IN (" + c3.join(",") + ")) ") : (g3 = u(e2.right, r3, a3, s4, o5), g3 instanceof Array ? " (" + u(e2.left, r3, a3, s4, o5) + " NOT IN (" + g3.join(",") + ")) " : " (" + u(e2.left, r3, a3, s4, o5) + " NOT IN (" + g3 + ")) ");
  156. case "BETWEEN":
  157. return p4 = u(e2.right, r3, a3, s4, o5), " (" + u(e2.left, r3, a3, s4, o5) + " BETWEEN " + p4[0] + " AND " + p4[1] + " ) ";
  158. case "NOTBETWEEN":
  159. return p4 = u(e2.right, r3, a3, s4, o5), " (" + u(e2.left, r3, a3, s4, o5) + " NOT BETWEEN " + p4[0] + " AND " + p4[1] + " ) ";
  160. case "LIKE":
  161. return "" !== e2.escape ? " (" + u(e2.left, r3, a3, s4, o5) + " LIKE " + u(e2.right, r3, a3, s4, o5) + " ESCAPE '" + e2.escape + "') " : " (" + u(e2.left, r3, a3, s4, o5) + " LIKE " + u(e2.right, r3, a3, s4, o5) + ") ";
  162. case "NOT LIKE":
  163. return "" !== e2.escape ? " (" + u(e2.left, r3, a3, s4, o5) + " NOT LIKE " + u(e2.right, r3, a3, s4, o5) + " ESCAPE '" + e2.escape + "') " : " (" + u(e2.left, r3, a3, s4, o5) + " NOT LIKE " + u(e2.right, r3, a3, s4, o5) + ") ";
  164. case "<>":
  165. case "<":
  166. case ">":
  167. case ">=":
  168. case "<=":
  169. case "=":
  170. case "*":
  171. case "-":
  172. case "+":
  173. case "/":
  174. return " (" + u(e2.left, r3, a3, s4, o5) + " " + e2.operator + " " + u(e2.right, r3, a3, s4, o5) + ") ";
  175. }
  176. throw new s(t2.UnsupportedOperator, { operator: e2.operator });
  177. case "null":
  178. return "null";
  179. case "boolean":
  180. return true === e2.value ? "1" : "0";
  181. case "string":
  182. return "'" + e2.value.toString().replace(/'/g, "''") + "'";
  183. case "timestamp":
  184. case "date":
  185. return f4(e2.value, r3);
  186. case "number":
  187. return e2.value.toString();
  188. case "current-time":
  189. return d2("date" === e2.mode, r3);
  190. case "column-reference":
  191. return s4 && s4.toLowerCase() === e2.column.toLowerCase() ? "(" + o5 + ")" : e2.column;
  192. case "function": {
  193. const t4 = u(e2.args, r3, a3, s4, o5);
  194. return l2(e2.name, t4, r3);
  195. }
  196. }
  197. throw new s(t2.UnsupportedSyntax, { node: e2.type });
  198. }
  199. function l2(r3, a3, s4) {
  200. switch (r3.toLowerCase().trim()) {
  201. case "abs":
  202. if (1 !== a3.length)
  203. throw new s(t2.InvalidFunctionParameters, { function: "abs" });
  204. return "abs(" + a3[0] + ")";
  205. case "ceiling":
  206. case "ceil":
  207. if (1 !== a3.length)
  208. throw new s(t2.InvalidFunctionParameters, { function: "ceiling" });
  209. switch (s4) {
  210. case t.Standardised:
  211. case t.StandardisedNoInterval:
  212. }
  213. return "CEILING(" + a3[0] + ")";
  214. case "floor":
  215. if (1 !== a3.length)
  216. throw new s(t2.InvalidFunctionParameters, { function: "floor" });
  217. return "FLOOR(" + a3[0] + ")";
  218. case "log":
  219. if (1 !== a3.length)
  220. throw new s(t2.InvalidFunctionParameters, { function: "log" });
  221. return "LOG(" + a3[0] + ")";
  222. case "log10":
  223. if (1 !== a3.length)
  224. throw new s(t2.InvalidFunctionParameters, { function: "log10" });
  225. return "LOG10(" + a3[0] + ")";
  226. case "power":
  227. if (2 !== a3.length)
  228. throw new s(t2.InvalidFunctionParameters, { function: "power" });
  229. return "POWER(" + a3[0] + "," + a3[1] + ")";
  230. case "round":
  231. if (2 === a3.length)
  232. return "ROUND(" + a3[0] + "," + a3[1] + ")";
  233. if (1 === a3.length)
  234. return "ROUND(" + a3[0] + ")";
  235. throw new s(t2.InvalidFunctionParameters, { function: "round" });
  236. case "truncate":
  237. if (a3.length < 1 || a3.length > 2)
  238. throw new s(t2.InvalidFunctionParameters, { function: "truncate" });
  239. return s4 === t.SqlServer ? "ROUND(" + a3[0] + (1 === a3.length ? "0" : "," + a3[1]) + ",1)" : "TRUNCATE(" + a3[0] + (1 === a3.length ? ")" : "," + a3[1] + ")");
  240. case "char_length":
  241. case "len":
  242. if (1 !== a3.length)
  243. throw new s(t2.InvalidFunctionParameters, { function: "char_length" });
  244. switch (s4) {
  245. case t.SqlServer:
  246. return "LEN(" + a3[0] + ")";
  247. case t.Oracle:
  248. return "LENGTH(" + a3[0] + ")";
  249. default:
  250. return "CHAR_LENGTH(" + a3[0] + ")";
  251. }
  252. case "concat":
  253. if (a3.length < 1)
  254. throw new s(t2.InvalidFunctionParameters, { function: "concat" });
  255. {
  256. let e2 = "CONCAT(";
  257. for (let r4 = 0; r4 < a3.length; r4++)
  258. 0 !== r4 && (e2 += ","), e2 += a3[r4];
  259. return e2 += ")", e2;
  260. }
  261. case "lower":
  262. case "lcase":
  263. if (1 !== a3.length)
  264. throw new s(t2.InvalidFunctionParameters, { function: "lower" });
  265. return "LOWER(" + a3[0] + ")";
  266. case "upper":
  267. case "ucase":
  268. if (1 !== a3.length)
  269. throw new s(t2.InvalidFunctionParameters, { function: "upper" });
  270. return "UPPER(" + a3[0] + ")";
  271. case "substring": {
  272. let r4 = "";
  273. switch (s4) {
  274. case t.Oracle:
  275. return r4 = "SUBSTR(" + a3[0] + "," + a3[1], 3 === a3.length && (r4 += "," + a3[2]), r4 += ")", r4;
  276. case t.SqlServer:
  277. return r4 = 3 === a3.length ? "SUBSTRING(" + a3[0] + "," + a3[1] + "," + a3[2] + ")" : "SUBSTRING(" + a3[0] + ", " + a3[1] + ", LEN(" + a3[0] + ") - " + a3[1] + ")", r4;
  278. default:
  279. return r4 = "SUBSTRING(" + a3[0] + " FROM " + a3[1], 3 === a3.length && (r4 += " FOR " + a3[2]), r4 += ")", r4;
  280. }
  281. }
  282. case "extract":
  283. return "EXTRACT(" + a3[0].replace(/\'/g, "") + " FROM " + a3[1] + ")";
  284. }
  285. throw new s(t2.InvalidFunctionParameters, { function: r3 });
  286. }
  287. function f4(r3, t4) {
  288. const n2 = r3 instanceof Date ? DateTime.fromJSDate(r3) : DateTime.fromSQL(r3), s4 = 0 === n2.hour && 0 === n2.minute && 0 === n2.second && 0 === n2.millisecond;
  289. switch (t4) {
  290. case t.FILEGDB:
  291. case t.Standardised:
  292. case t.StandardisedNoInterval:
  293. return s4 ? `date '${n2.toFormat("yyyy-LL-dd")}'` : `date '${n2.toFormat("yyyy-LL-dd HH:mm:ss")}'`;
  294. case t.Oracle:
  295. return s4 ? `TO_DATE('${n2.toFormat("yyyy-LL-dd")}','YYYY-MM-DD')` : `TO_DATE('${n2.toFormat("yyyy-LL-dd HH:mm:ss")}','YYYY-MM-DD HH24:MI:SS')`;
  296. case t.SqlServer:
  297. return `'${n2.toFormat(s4 ? "yyyy-LL-dd" : "yyyy-LL-dd HH:mm:ss")}'`;
  298. case t.PGDB:
  299. return `#${n2.toFormat(s4 ? "LL-dd-yyyy" : "LL-dd-yyyy HH:mm:ss")}#`;
  300. case t.Postgres:
  301. return `TIMESTAMP '${n2.toFormat(s4 ? "yyyy-LL-dd" : "yyyy-LL-dd HH:mm:ss")}'`;
  302. default:
  303. return `date '${n2.toFormat("yyyy-LL-dd HH:mm:ss")}'`;
  304. }
  305. }
  306. function d2(r3, t4) {
  307. switch (t4) {
  308. case t.FILEGDB:
  309. case t.Standardised:
  310. case t.StandardisedNoInterval:
  311. case t.Oracle:
  312. return r3 ? "CURRENT_DATE" : "CURRENT_TIMESTAMP";
  313. case t.SqlServer:
  314. return r3 ? "CAST(GETDATE() AS DATE)" : "GETDATE()";
  315. case t.PGDB:
  316. case t.Postgres:
  317. default:
  318. return r3 ? "CURRENT_DATE" : "CURRENT_TIMESTAMP";
  319. }
  320. }
  321. function p2(e2, r3, t4 = {}) {
  322. const n2 = {}, a3 = {}, s4 = { esriFieldTypeSmallInteger: "integer", esriFieldTypeInteger: "integer", esriFieldTypeSingle: "double", esriFieldTypeDouble: "double", esriFieldTypeString: "string", esriFieldTypeDate: "date", esriFieldTypeOID: "integer", oid: "integer", long: "integer", "small-integer": "integer", integer: "integer", single: "double", double: "double", date: "date", string: "string" };
  323. for (const o5 of r3) {
  324. const e3 = o5.type ? s4[o5.type] : void 0;
  325. n2[o5.name.toLowerCase()] = void 0 === e3 ? "" : e3;
  326. }
  327. for (const o5 in t4) {
  328. const e3 = s4[t4[o5]];
  329. a3[o5.toLowerCase()] = void 0 === e3 ? "" : e3;
  330. }
  331. switch (g(n2, e2.parseTree, e2.parameters, a3)) {
  332. case "double":
  333. return "double";
  334. case "integer":
  335. return "integer";
  336. case "date":
  337. return "date";
  338. case "string":
  339. return "string";
  340. }
  341. return "";
  342. }
  343. function g(e2, r3, a3, s4) {
  344. let o5;
  345. switch (r3.type) {
  346. case "interval":
  347. return "integer";
  348. case "case-expression": {
  349. const t4 = [];
  350. if ("simple" === r3.format) {
  351. for (let n2 = 0; n2 < r3.clauses.length; n2++)
  352. t4.push(g(e2, r3.clauses[n2].value, a3, s4));
  353. null !== r3.else && t4.push(g(e2, r3.else, a3, s4));
  354. } else {
  355. for (let n2 = 0; n2 < r3.clauses.length; n2++)
  356. t4.push(g(e2, r3.else, a3, s4));
  357. null !== r3.else && t4.push(g(e2, r3.else, a3, s4));
  358. }
  359. return m3(t4);
  360. }
  361. case "parameter": {
  362. const e3 = s4[r3.value.toLowerCase()];
  363. if (void 0 === e3 && a3) {
  364. const e4 = a3[r3.value.toLowerCase()];
  365. if (void 0 === e4)
  366. return "";
  367. if (null === e4)
  368. return "";
  369. if ("string" == typeof e4 || e4 instanceof String)
  370. return "string";
  371. if ("boolean" == typeof e4)
  372. return "boolean";
  373. if (e4 instanceof Date)
  374. return "date";
  375. if ("number" == typeof e4)
  376. return e4 % 1 == 0 ? "integer" : "double";
  377. }
  378. return void 0 === e3 ? "" : e3;
  379. }
  380. case "expression-list": {
  381. const t4 = [];
  382. for (const n2 of r3.value)
  383. t4.push(g(e2, n2, a3, s4));
  384. return t4;
  385. }
  386. case "unary-expression":
  387. return "boolean";
  388. case "binary-expression":
  389. switch (r3.operator) {
  390. case "AND":
  391. case "OR":
  392. case "IN":
  393. case "NOT IN":
  394. case "BETWEEN":
  395. case "NOTBETWEEN":
  396. case "LIKE":
  397. case "NOT LIKE":
  398. case "<>":
  399. case "<":
  400. case ">":
  401. case ">=":
  402. case "<=":
  403. case "=":
  404. return "boolean";
  405. case "IS":
  406. case "ISNOT":
  407. if ("null" !== r3.right.type)
  408. throw new s(t2.UnsupportedIsRhs);
  409. return "boolean";
  410. case "*":
  411. case "-":
  412. case "+":
  413. case "/":
  414. return m3([g(e2, r3.left, a3, s4), g(e2, r3.right, a3, s4)]);
  415. default:
  416. throw new s(t2.UnsupportedOperator, { operator: r3.operator });
  417. }
  418. case "null":
  419. return "";
  420. case "boolean":
  421. return "boolean";
  422. case "string":
  423. return "string";
  424. case "number":
  425. return null === r3.value ? "" : r3.value % 1 == 0 ? "integer" : "double";
  426. case "date":
  427. case "timestamp":
  428. case "current-time":
  429. return "date";
  430. case "column-reference": {
  431. const t4 = e2[r3.column.toLowerCase()];
  432. return void 0 === t4 ? "" : t4;
  433. }
  434. case "function":
  435. switch (r3.name.toLowerCase()) {
  436. case "position":
  437. case "extract":
  438. case "char_length":
  439. return "integer";
  440. case "round":
  441. return o5 = g(e2, r3.args, a3, s4), o5 instanceof Array ? o5.length > 0 ? o5[0] : "" : o5;
  442. case "sign":
  443. return o5 = g(e2, r3.args, a3, s4), o5 instanceof Array && (o5 = m3(o5)), "integer" === o5 || "double" === o5 ? o5 : "double";
  444. case "ceiling":
  445. case "floor":
  446. case "abs": {
  447. const t4 = g(e2, r3.args, a3, s4);
  448. return t4 instanceof Array ? m3(t4) : t4;
  449. }
  450. case "area":
  451. case "length":
  452. case "log":
  453. case "log10":
  454. case "sin":
  455. case "cos":
  456. case "tan":
  457. case "asin":
  458. case "acos":
  459. case "atan":
  460. case "power":
  461. case "truncate":
  462. return "double";
  463. case "substring":
  464. case "trim":
  465. case "concat":
  466. case "lower":
  467. case "upper":
  468. return "string";
  469. }
  470. return "";
  471. }
  472. throw new s(t2.UnsupportedSyntax, { node: r3.type });
  473. }
  474. var h2 = { boolean: 1, string: 2, integer: 3, double: 4, date: 5 };
  475. function m3(e2) {
  476. if (e2) {
  477. let r3 = "";
  478. for (const t4 of e2)
  479. "" !== t4 && (r3 = "" === r3 || h2[r3] < h2[t4] ? t4 : r3);
  480. return r3;
  481. }
  482. return "";
  483. }
  484. function y2(e2, r3) {
  485. return T(e2.parseTree, r3);
  486. }
  487. function w(e2) {
  488. return "column-reference" === (e2 == null ? void 0 : e2.parseTree.type);
  489. }
  490. function T(e2, r3) {
  491. if (null == e2)
  492. return false;
  493. switch (e2.type) {
  494. case "when-clause":
  495. return T(e2.operand, r3) || T(e2.value, r3);
  496. case "case-expression":
  497. for (const t4 of e2.clauses)
  498. if (T(t4, r3))
  499. return true;
  500. return !("simple" !== e2.format || !T(e2.operand, r3)) || !(null === e2.else || !T(e2.else, r3));
  501. case "parameter":
  502. case "null":
  503. case "boolean":
  504. case "date":
  505. case "timestamp":
  506. case "string":
  507. case "number":
  508. return false;
  509. case "expression-list":
  510. for (const t4 of e2.value)
  511. if (T(t4, r3))
  512. return true;
  513. return false;
  514. case "unary-expression":
  515. return T(e2.expr, r3);
  516. case "binary-expression":
  517. return T(e2.left, r3) || T(e2.right, r3);
  518. case "column-reference":
  519. return r3.toLowerCase() === e2.column.toLowerCase();
  520. case "function":
  521. return T(e2.args, r3);
  522. }
  523. return false;
  524. }
  525. function E(e2) {
  526. let r3 = "";
  527. return r3 += e2.period.toUpperCase(), r3;
  528. }
  529. function N(e2, r3, t4) {
  530. let n2 = "";
  531. return n2 = "interval-period" === r3.type ? E(r3) : E(r3.start) + " TO " + E(r3.end), "INTERVAL " + t4 + " " + e2 + " " + n2;
  532. }
  533. // node_modules/@arcgis/core/arcade/featureset/support/FeatureSetIterator.js
  534. var e = class {
  535. constructor(t4, e2) {
  536. this._lastId = -1, this._progress = e2, this._parent = t4;
  537. }
  538. reset() {
  539. this._lastId = -1;
  540. }
  541. nextBatch(e2) {
  542. if (null !== this._parent._mainSetInUse)
  543. return this._parent._mainSetInUse.then((t4) => this.nextBatch(e2), (t4) => this.nextBatch(e2));
  544. const n2 = { returnpromise: null, hasset: false }, s4 = [];
  545. return n2.returnpromise = new Promise((a3, i5) => {
  546. this._parent._getSet(this._progress).then((r3) => {
  547. const h4 = f(r3._known, "known");
  548. let _ = h4.length - 1;
  549. if ("GETPAGES" === h4[h4.length - 1] && (_ -= 1), this._lastId + e2 > _ && h4.length > 0 && "GETPAGES" === h4[h4.length - 1])
  550. return void this._parent._expandPagedSet(r3, this._parent._maxQueryRate(), 0, 0, this._progress).then((t4) => {
  551. n2.hasset = true, this._parent._mainSetInUse = null, this.nextBatch(e2).then(a3, i5);
  552. }, (t4) => {
  553. n2.hasset = true, this._parent._mainSetInUse = null, i5(t4);
  554. });
  555. const l4 = f(r3._candidates, "candidates");
  556. if (_ >= this._lastId + e2 || 0 === l4.length) {
  557. for (let t4 = 0; t4 < e2; t4++) {
  558. const e3 = t4 + this._lastId + 1;
  559. if (e3 >= h4.length)
  560. break;
  561. s4[t4] = h4[e3];
  562. }
  563. return this._lastId += s4.length, 0 === s4.length && (n2.hasset = true, this._parent._mainSetInUse = null, a3([])), void this._parent._getFeatureBatch(s4, this._progress).then((t4) => {
  564. n2.hasset = true, this._parent._mainSetInUse = null, a3(t4);
  565. }, (t4) => {
  566. n2.hasset = true, this._parent._mainSetInUse = null, i5(t4);
  567. });
  568. }
  569. this._parent._refineSetBlock(r3, this._parent._maxProcessingRate(), this._progress).then(() => {
  570. n2.hasset = true, this._parent._mainSetInUse = null, this.nextBatch(e2).then(a3, i5);
  571. }, (t4) => {
  572. n2.hasset = true, this._parent._mainSetInUse = null, i5(t4);
  573. });
  574. }, (t4) => {
  575. n2.hasset = true, this._parent._mainSetInUse = null, i5(t4);
  576. });
  577. }), false === n2.hasset && (this._parent._mainSetInUse = n2.returnpromise, n2.hasset = true), n2.returnpromise;
  578. }
  579. next() {
  580. if (null !== this._parent._mainSetInUse)
  581. return this._parent._mainSetInUse.then((t4) => this.next(), (t4) => this.next());
  582. const e2 = { returnpromise: null, hasset: false };
  583. return e2.returnpromise = new Promise((n2, s4) => {
  584. this._parent._getSet(this._progress).then((a3) => {
  585. const i5 = f(a3._known, "known");
  586. if (this._lastId < i5.length - 1)
  587. "GETPAGES" === i5[this._lastId + 1] ? this._parent._expandPagedSet(a3, this._parent._maxQueryRate(), 0, 0, this._progress).then((t4) => (e2.hasset = true, this._parent._mainSetInUse = null, this.next())).then(n2, s4) : (this._lastId += 1, this._parent._getFeature(a3, i5[this._lastId], this._progress).then((t4) => {
  588. e2.hasset = true, this._parent._mainSetInUse = null, n2(t4);
  589. }, (t4) => {
  590. e2.hasset = true, this._parent._mainSetInUse = null, s4(t4);
  591. }));
  592. else {
  593. f(a3._candidates, "candidates").length > 0 ? this._parent._refineSetBlock(a3, this._parent._maxProcessingRate(), this._progress).then(() => {
  594. e2.hasset = true, this._parent._mainSetInUse = null, this.next().then(n2, s4);
  595. }, (t4) => {
  596. e2.hasset = true, this._parent._mainSetInUse = null, s4(t4);
  597. }) : (e2.hasset = true, this._parent._mainSetInUse = null, n2(null));
  598. }
  599. }, (t4) => {
  600. e2.hasset = true, this._parent._mainSetInUse = null, s4(t4);
  601. });
  602. }), false === e2.hasset && (this._parent._mainSetInUse = e2.returnpromise, e2.hasset = true), e2.returnpromise;
  603. }
  604. async count() {
  605. if (-1 !== this._parent._totalCount)
  606. return this._parent._totalCount;
  607. const t4 = await this._parent._getSet(this._progress), e2 = await this._refineAllSets(t4);
  608. return this._parent._totalCount = e2._known.length, this._parent._totalCount;
  609. }
  610. async _refineAllSets(t4) {
  611. if (t4._known.length > 0 && "GETPAGES" === t4._known[t4._known.length - 1])
  612. return await this._parent._expandPagedSet(t4, this._parent._maxQueryRate(), 0, 1, this._progress), this._refineAllSets(t4);
  613. if (t4._candidates.length > 0) {
  614. if ("GETPAGES" === t4._known[t4._candidates.length - 1])
  615. return await this._parent._expandPagedSet(t4, this._parent._maxQueryRate(), 0, 2, this._progress), this._refineAllSets(t4);
  616. const e2 = await this._parent._refineSetBlock(t4, this._parent._maxProcessingRate(), this._progress);
  617. return e2._candidates.length > 0 ? this._refineAllSets(e2) : e2;
  618. }
  619. return t4;
  620. }
  621. };
  622. // node_modules/@arcgis/core/arcade/featureset/support/IdSet.js
  623. var t3 = class {
  624. constructor(t4, s4, e2, i5) {
  625. this._lastFetchedIndex = 0, this._ordered = false, this.pagesDefinition = null, this._candidates = t4, this._known = s4, this._ordered = e2, this.pagesDefinition = i5;
  626. }
  627. };
  628. // node_modules/@arcgis/core/arcade/featureset/support/stats.js
  629. function s3(t4) {
  630. return t4 = +t4, isFinite(t4) ? t4 - t4 % 1 || (t4 < 0 ? -0 : 0 === t4 ? t4 : 0) : t4;
  631. }
  632. function i4(t4) {
  633. let n2 = 0;
  634. for (let e2 = 0; e2 < t4.length; e2++)
  635. n2 += t4[e2];
  636. return n2 / t4.length;
  637. }
  638. function l3(t4) {
  639. const n2 = i4(t4);
  640. let e2 = 0;
  641. for (let r3 = 0; r3 < t4.length; r3++)
  642. e2 += (n2 - t4[r3]) ** 2;
  643. return e2 / t4.length;
  644. }
  645. function o4(t4) {
  646. const n2 = i4(t4);
  647. let e2 = 0;
  648. for (let r3 = 0; r3 < t4.length; r3++)
  649. e2 += (n2 - t4[r3]) ** 2;
  650. return e2 / (t4.length - 1);
  651. }
  652. function h3(t4) {
  653. let n2 = 0;
  654. for (let e2 = 0; e2 < t4.length; e2++)
  655. n2 += t4[e2];
  656. return n2;
  657. }
  658. function f5(t4, n2) {
  659. const c3 = [], u3 = {}, s4 = [];
  660. for (let i5 = 0; i5 < t4.length; i5++) {
  661. if (void 0 !== t4[i5] && null !== t4[i5]) {
  662. const n3 = t4[i5];
  663. if (y(n3) || l(n3))
  664. void 0 === u3[n3] && (c3.push(n3), u3[n3] = 1);
  665. else {
  666. let t5 = false;
  667. for (let e2 = 0; e2 < s4.length; e2++)
  668. true === c(s4[e2], n3) && (t5 = true);
  669. false === t5 && (s4.push(n3), c3.push(n3));
  670. }
  671. }
  672. if (c3.length >= n2 && -1 !== n2)
  673. return c3;
  674. }
  675. return c3;
  676. }
  677. function m4(t4) {
  678. switch (t4.toLowerCase()) {
  679. case "distinct":
  680. return "distinct";
  681. case "avg":
  682. case "mean":
  683. return "avg";
  684. case "min":
  685. return "min";
  686. case "sum":
  687. return "sum";
  688. case "max":
  689. return "max";
  690. case "stdev":
  691. case "stddev":
  692. return "stddev";
  693. case "var":
  694. case "variance":
  695. return "var";
  696. case "count":
  697. return "count";
  698. }
  699. return "";
  700. }
  701. function g2(t4, n2, e2 = 1e3) {
  702. switch (t4.toLowerCase()) {
  703. case "distinct":
  704. return f5(n2, e2);
  705. case "avg":
  706. case "mean":
  707. return i4(n2);
  708. case "min":
  709. return Math.min.apply(Math, n2);
  710. case "sum":
  711. return h3(n2);
  712. case "max":
  713. return Math.max.apply(Math, n2);
  714. case "stdev":
  715. case "stddev":
  716. return Math.sqrt(l3(n2));
  717. case "var":
  718. case "variance":
  719. return l3(n2);
  720. case "count":
  721. return n2.length;
  722. }
  723. return 0;
  724. }
  725. async function w2(t4, n2, e2) {
  726. const r3 = await k2(t4, n2, e2, true);
  727. return 0 === r3.length ? null : Math.min.apply(Math, r3);
  728. }
  729. async function d3(t4, n2, e2) {
  730. const r3 = await k2(t4, n2, e2, true);
  731. return 0 === r3.length ? null : Math.max.apply(Math, r3);
  732. }
  733. async function p3(t4, n2, e2) {
  734. let r3 = "";
  735. n2 && !w(n2) && (r3 = p2(n2, t4.fields));
  736. const a3 = await k2(t4, n2, e2, true);
  737. if (0 === a3.length)
  738. return null;
  739. const l4 = i4(a3);
  740. return null === l4 ? l4 : "integer" === r3 ? s3(l4) : l4;
  741. }
  742. async function v2(t4, n2, e2) {
  743. const r3 = await k2(t4, n2, e2, true);
  744. return 0 === r3.length ? null : o4(r3);
  745. }
  746. async function y3(t4, n2, e2) {
  747. const r3 = await k2(t4, n2, e2, true);
  748. return 0 === r3.length ? null : Math.sqrt(o4(r3));
  749. }
  750. async function x2(t4, n2, e2) {
  751. const r3 = await k2(t4, n2, e2, true);
  752. return 0 === r3.length ? null : h3(r3);
  753. }
  754. async function M2(t4, n2) {
  755. return t4.iterator(n2).count();
  756. }
  757. async function k2(e2, r3, a3, c3 = false) {
  758. const u3 = e2.iterator(a3), s4 = [], i5 = { ticker: 0 };
  759. let l4 = await u3.next();
  760. for (; null !== l4; ) {
  761. if (i5.ticker++, a3.aborted)
  762. throw new o2(n.Cancelled);
  763. i5.ticker % 100 == 0 && (i5.ticker = 0, await new Promise((t4) => {
  764. setTimeout(t4, 0);
  765. }));
  766. const e3 = r3 == null ? void 0 : r3.calculateValue(l4);
  767. null === e3 ? false === c3 && (s4[s4.length] = e3) : s4[s4.length] = e3, l4 = await u3.next();
  768. }
  769. return s4;
  770. }
  771. async function C2(e2, r3, a3 = 1e3, c3 = null) {
  772. const u3 = e2.iterator(c3), s4 = [], i5 = {}, l4 = { ticker: 0 };
  773. let o5 = await u3.next();
  774. for (; null !== o5; ) {
  775. if (l4.ticker++, c3 && c3.aborted)
  776. throw new o2(n.Cancelled);
  777. l4.ticker % 100 == 0 && (l4.ticker = 0, await new Promise((t4) => {
  778. setTimeout(t4, 0);
  779. }));
  780. const e3 = r3 == null ? void 0 : r3.calculateValue(o5);
  781. if (null != e3 && void 0 === i5[e3] && (s4.push(e3), i5[e3] = 1), s4.length >= a3 && -1 !== a3)
  782. return s4;
  783. o5 = await u3.next();
  784. }
  785. return s4;
  786. }
  787. // node_modules/@arcgis/core/arcade/featureset/support/FeatureSet.js
  788. var C3 = class {
  789. constructor(e2) {
  790. this.recentlyUsedQueries = null, this.featureSetQueryInterceptor = null, this._idstates = [], this._parent = null, this._wset = null, this._mainSetInUse = null, this._maxProcessing = 200, this._maxQuery = 500, this._totalCount = -1, this._databaseType = t.NotEvaluated, this._databaseTypeProbed = null, this.declaredRootClass = "esri.arcade.featureset.support.FeatureSet", this._featureCache = [], this.typeIdField = null, this.types = null, this.fields = null, this.geometryType = "", this.objectIdField = "", this.globalIdField = "", this.spatialReference = null, this.hasM = false, this.hasZ = false, this._transparent = false, this.loaded = false, this._loadPromise = null, this._fieldsIndex = null, e2 && e2.lrucache && (this.recentlyUsedQueries = e2.lrucache), e2 && e2.interceptor && (this.featureSetQueryInterceptor = e2.interceptor);
  791. }
  792. optimisePagingFeatureQueries(e2) {
  793. this._parent && this._parent.optimisePagingFeatureQueries(e2);
  794. }
  795. _hasMemorySource() {
  796. return true;
  797. }
  798. prop(e2, t4) {
  799. return void 0 === t4 ? this[e2] : (void 0 !== this[e2] && (this[e2] = t4), this);
  800. }
  801. end() {
  802. return null !== this._parent && true === this._parent._transparent ? this._parent.end() : this._parent;
  803. }
  804. _ensureLoaded() {
  805. return this.load();
  806. }
  807. load() {
  808. return null === this._loadPromise && (this._loadPromise = this.loadImpl()), this._loadPromise;
  809. }
  810. async loadImpl() {
  811. var _a, _b;
  812. return true === ((_a = this._parent) == null ? void 0 : _a.loaded) ? (this._initialiseFeatureSet(), this) : (await ((_b = this._parent) == null ? void 0 : _b.load()), this._initialiseFeatureSet(), this);
  813. }
  814. _initialiseFeatureSet() {
  815. null !== this._parent ? (this.fields = this._parent.fields.slice(0), this.geometryType = this._parent.geometryType, this.objectIdField = this._parent.objectIdField, this.globalIdField = this._parent.globalIdField, this.spatialReference = this._parent.spatialReference, this.hasM = this._parent.hasM, this.hasZ = this._parent.hasZ, this.typeIdField = this._parent.typeIdField, this.types = this._parent.types) : (this.fields = [], this.typeIdField = "", this.objectIdField = "", this.globalIdField = "", this.spatialReference = new k({ wkid: 4326 }), this.geometryType = S.point);
  816. }
  817. getField(e2, t4) {
  818. let s4;
  819. return (t4 = t4 || this.fields) && (e2 = e2.toLowerCase(), t4.some((t5) => (t5 && t5.name.toLowerCase() === e2 && (s4 = t5), !!s4))), s4;
  820. }
  821. getFieldsIndex() {
  822. return null === this._fieldsIndex && (this._fieldsIndex = new r(this.fields)), this._fieldsIndex;
  823. }
  824. _maxProcessingRate() {
  825. return null !== this._parent ? Math.min(this._maxProcessing, this._parent._maxProcessingRate()) : Math.min(this._maxProcessing, this._maxQueryRate());
  826. }
  827. _maxQueryRate() {
  828. return null !== this._parent ? Math.max(this._maxQuery, this._parent._maxQueryRate()) : this._maxQuery;
  829. }
  830. _checkCancelled(e2) {
  831. if (null != e2 && e2.aborted)
  832. throw new o2(n.Cancelled);
  833. }
  834. nativeCapabilities() {
  835. return this._parent.nativeCapabilities();
  836. }
  837. async _canDoAggregates(e2, t4, s4, a3, r3) {
  838. return null !== this._parent && this._parent._canDoAggregates(e2, t4, s4, a3, r3);
  839. }
  840. async _getAggregatePagesDataSourceDefinition(e2, a3, r3, n2, i5, l4, u3) {
  841. if (null === this._parent)
  842. throw new o2(n.NeverReach);
  843. return this._parent._getAggregatePagesDataSourceDefinition(e2, a3, r3, n2, i5, l4, u3);
  844. }
  845. async _getAgregagtePhysicalPage(e2, a3, r3) {
  846. if (null === this._parent)
  847. throw new o2(n.NeverReach);
  848. return this._parent._getAgregagtePhysicalPage(e2, a3, r3);
  849. }
  850. async databaseType() {
  851. if (this._databaseType === t.NotEvaluated) {
  852. if (null !== a2.applicationCache) {
  853. const t4 = a2.applicationCache.getDatabaseType(this._cacheableFeatureSetSourceKey());
  854. if (null !== t4)
  855. return t4;
  856. }
  857. if (null !== this._databaseTypeProbed)
  858. return this._databaseTypeProbed;
  859. try {
  860. this._databaseTypeProbed = this._getDatabaseTypeImpl(), null !== a2.applicationCache && a2.applicationCache.setDatabaseType(this._cacheableFeatureSetSourceKey(), this._databaseTypeProbed);
  861. } catch (t4) {
  862. throw null !== a2.applicationCache && a2.applicationCache.clearDatabaseType(this._cacheableFeatureSetSourceKey()), t4;
  863. }
  864. return this._databaseTypeProbed;
  865. }
  866. return this._databaseType;
  867. }
  868. async _getDatabaseTypeImpl() {
  869. const e2 = [{ thetype: t.SqlServer, testwhere: "(CAST( '2015-01-01' as DATETIME) = CAST( '2015-01-01' as DATETIME)) AND OBJECTID<0" }, { thetype: t.Oracle, testwhere: "(TO_DATE('2003-11-18','YYYY-MM-DD') = TO_DATE('2003-11-18','YYYY-MM-DD')) AND OBJECTID<0" }, { thetype: t.StandardisedNoInterval, testwhere: "(date '2015-01-01 10:10:10' = date '2015-01-01 10:10:10') AND OBJECTID<0" }];
  870. for (const t4 of e2) {
  871. if (true === await this._runDatabaseProbe(t4.testwhere))
  872. return t4.thetype;
  873. }
  874. return t.StandardisedNoInterval;
  875. }
  876. _cacheableFeatureSetSourceKey() {
  877. return "MUSTBESET";
  878. }
  879. async _runDatabaseProbe(e2) {
  880. if (null !== this._parent)
  881. return this._parent._runDatabaseProbe(e2);
  882. throw new o2(n.NotImplemented);
  883. }
  884. isTable() {
  885. var _a, _b;
  886. return (_b = (_a = this._parent) == null ? void 0 : _a.isTable()) != null ? _b : false;
  887. }
  888. _featureFromCache(e2) {
  889. if (void 0 !== this._featureCache[e2])
  890. return this._featureCache[e2];
  891. }
  892. _isInFeatureSet(e2) {
  893. return i2.Unknown;
  894. }
  895. _getSet(e2) {
  896. throw new o2(n.NotImplemented);
  897. }
  898. async _getFeature(e2, a3, r3) {
  899. if (this._checkCancelled(r3), void 0 !== this._featureFromCache(a3))
  900. return this._featureFromCache(a3);
  901. if (await this._getFeatures(e2, a3, this._maxProcessingRate(), r3), this._checkCancelled(r3), void 0 !== this._featureFromCache(a3))
  902. return this._featureFromCache(a3);
  903. throw new o2(n.MissingFeatures);
  904. }
  905. async _getFeatureBatch(e2, t4) {
  906. this._checkCancelled(t4);
  907. const s4 = new t3([], e2, false, null), a3 = [];
  908. await this._getFeatures(s4, -1, e2.length, t4), this._checkCancelled(t4);
  909. for (const r3 of e2)
  910. void 0 !== this._featureFromCache(r3) && a3.push(this._featureFromCache(r3));
  911. return a3;
  912. }
  913. async _getFeatures(e2, t4, s4, a3) {
  914. return "success";
  915. }
  916. _getFilteredSet(e2, a3, r3, n2, i5) {
  917. throw new o2(n.NotImplemented);
  918. }
  919. async _refineSetBlock(e2, t4, s4) {
  920. if (true === this._checkIfNeedToExpandCandidatePage(e2, this._maxQueryRate()))
  921. return await this._expandPagedSet(e2, this._maxQueryRate(), 0, 0, s4), this._refineSetBlock(e2, t4, s4);
  922. this._checkCancelled(s4);
  923. const a3 = e2._candidates.length;
  924. this._refineKnowns(e2, t4);
  925. let r3 = a3 - e2._candidates.length;
  926. if (0 === e2._candidates.length)
  927. return e2;
  928. if (r3 >= t4)
  929. return e2;
  930. if (await this._refineIfParentKnown(e2, t4 - r3, s4), this._checkCancelled(s4), this._refineKnowns(e2, t4 - r3), r3 = a3 - e2._candidates.length, r3 < t4 && e2._candidates.length > 0) {
  931. const a4 = t4 - r3, n2 = this._prepareFetchAndRefineSet(e2._candidates);
  932. return await this._fetchAndRefineFeatures(n2, n2.length > a4 ? a4 : e2._candidates.length, s4), this._checkCancelled(s4), this._refineKnowns(e2, t4 - r3), e2;
  933. }
  934. return e2;
  935. }
  936. _fetchAndRefineFeatures(e2, t4, s4) {
  937. return null;
  938. }
  939. _prepareFetchAndRefineSet(e2) {
  940. const t4 = [];
  941. for (let s4 = 0; s4 < e2.length; s4++)
  942. this._isPhysicalFeature(e2[s4]) && t4.push(e2[s4]);
  943. return t4;
  944. }
  945. _isPhysicalFeature(e2) {
  946. return null === this._parent || this._parent._isPhysicalFeature(e2);
  947. }
  948. _refineKnowns(e2, t4) {
  949. let s4 = 0, a3 = null;
  950. const r3 = [];
  951. t4 = this._maxQueryRate();
  952. for (let n2 = 0; n2 < e2._candidates.length && "GETPAGES" !== e2._candidates[n2]; n2++) {
  953. let i5 = false;
  954. const u3 = this._candidateIdTransform(e2._candidates[n2]);
  955. u3 !== e2._candidates[n2] && (i5 = true);
  956. const h4 = this._isInFeatureSet(u3);
  957. if (h4 === i2.InFeatureSet)
  958. true === i5 ? e2._known.includes(u3) || (e2._known.push(u3), s4 += 1) : (e2._known.push(e2._candidates[n2]), s4 += 1), null === a3 ? a3 = { start: n2, end: n2 } : a3.end === n2 - 1 ? a3.end = n2 : (r3.push(a3), a3 = { start: n2, end: n2 });
  959. else if (h4 === i2.NotInFeatureSet)
  960. null === a3 ? a3 = { start: n2, end: n2 } : a3.end === n2 - 1 ? a3.end = n2 : (r3.push(a3), a3 = { start: n2, end: n2 }), s4 += 1;
  961. else if (h4 === i2.Unknown && (s4 += 1, true === e2._ordered))
  962. break;
  963. if (s4 >= t4)
  964. break;
  965. }
  966. null !== a3 && r3.push(a3);
  967. for (let n2 = r3.length - 1; n2 >= 0; n2--)
  968. e2._candidates.splice(r3[n2].start, r3[n2].end - r3[n2].start + 1);
  969. }
  970. _refineIfParentKnown(e2, t4, s4) {
  971. const a3 = new t3([], [], e2._ordered, null);
  972. return a3._candidates = e2._candidates.slice(0), this._parent._refineSetBlock(a3, t4, s4);
  973. }
  974. _candidateIdTransform(e2) {
  975. return this._parent._candidateIdTransform(e2);
  976. }
  977. _checkIfNeedToExpandKnownPage(e2, t4) {
  978. if (null === e2.pagesDefinition)
  979. return false;
  980. let s4 = 0;
  981. for (let a3 = e2._lastFetchedIndex; a3 < e2._known.length; a3++) {
  982. if ("GETPAGES" === e2._known[a3])
  983. return true;
  984. if (void 0 === this._featureCache[e2._known[a3]] && (s4 += 1, s4 >= t4))
  985. break;
  986. }
  987. return false;
  988. }
  989. _checkIfNeedToExpandCandidatePage(e2, t4) {
  990. if (null === e2.pagesDefinition)
  991. return false;
  992. let s4 = 0;
  993. for (let a3 = 0; a3 < e2._candidates.length; a3++) {
  994. if ("GETPAGES" === e2._candidates[a3])
  995. return true;
  996. if (s4 += 1, s4 >= t4)
  997. break;
  998. }
  999. return false;
  1000. }
  1001. async _expandPagedSet(e2, a3, r3, n2, i5) {
  1002. if (null === this._parent)
  1003. throw new o2(n.NotImplemented);
  1004. return this._parent._expandPagedSet(e2, a3, r3, n2, i5);
  1005. }
  1006. async _expandPagedSetFeatureSet(e2, t4, s4, a3, r3) {
  1007. if (e2._known.length > 0 && "GETPAGES" === e2._known[e2._known.length - 1] && (a3 = 1), 0 === a3 && e2._candidates.length > 0 && "GETPAGES" === e2._candidates[e2._candidates.length - 1] && (a3 = 2), 0 === a3)
  1008. return "finished";
  1009. const n2 = await this._getPage(e2, a3, r3);
  1010. return s4 + n2 < t4 ? this._expandPagedSet(e2, t4, s4 + n2, 0, r3) : "success";
  1011. }
  1012. async _getPage(e2, t4, s4) {
  1013. const a3 = 1 === t4 ? e2._known : e2._candidates;
  1014. if (e2.pagesDefinition.internal.set.length > e2.pagesDefinition.resultOffset || true === e2.pagesDefinition.internal.fullyResolved) {
  1015. a3.length = a3.length - 1;
  1016. let t5 = 0;
  1017. for (let r3 = 0; r3 < e2.pagesDefinition.resultRecordCount && !(e2.pagesDefinition.resultOffset + r3 >= e2.pagesDefinition.internal.set.length); r3++)
  1018. a3[a3.length] = e2.pagesDefinition.internal.set[e2.pagesDefinition.resultOffset + r3], t5++;
  1019. e2.pagesDefinition.resultOffset += t5;
  1020. let s5 = false;
  1021. return true === e2.pagesDefinition.internal.fullyResolved && e2.pagesDefinition.internal.set.length <= e2.pagesDefinition.resultOffset && (s5 = true), false === s5 && a3.push("GETPAGES"), t5;
  1022. }
  1023. return await this._getPhysicalPage(e2, t4, s4), this._getPage(e2, t4, s4);
  1024. }
  1025. _getPhysicalPage(e2, t4, s4) {
  1026. return null;
  1027. }
  1028. _clonePageDefinition(e2) {
  1029. return null === this._parent ? null : this._parent._clonePageDefinition(e2);
  1030. }
  1031. _first(e2) {
  1032. return this.iterator(e2).next();
  1033. }
  1034. first(e2) {
  1035. return this._first(e2);
  1036. }
  1037. async calculateStatistic(e2, t4, s4, a3) {
  1038. await this._ensureLoaded();
  1039. let r3 = await this._stat(e2, t4, "", null, null, s4, a3);
  1040. return false === r3.calculated && (r3 = await this._manualStat(e2, t4, s4, a3)), r3.result;
  1041. }
  1042. async _manualStat(e2, t4, s4, a3) {
  1043. let r3 = null;
  1044. switch (e2.toLowerCase()) {
  1045. case "count":
  1046. return r3 = await M2(this, a3), { calculated: true, result: r3 };
  1047. case "distinct":
  1048. return r3 = await C2(this, t4, s4, a3), { calculated: true, result: r3 };
  1049. case "avg":
  1050. case "mean":
  1051. return r3 = await p3(this, t4, a3), { calculated: true, result: r3 };
  1052. case "stdev":
  1053. return r3 = await y3(this, t4, a3), { calculated: true, result: r3 };
  1054. case "variance":
  1055. return r3 = await v2(this, t4, a3), { calculated: true, result: r3 };
  1056. case "sum":
  1057. return r3 = await x2(this, t4, a3), { calculated: true, result: r3 };
  1058. case "min":
  1059. return r3 = await w2(this, t4, a3), { calculated: true, result: r3 };
  1060. case "max":
  1061. return r3 = await d3(this, t4, a3), { calculated: true, result: r3 };
  1062. default:
  1063. return { calculated: true, result: 0 };
  1064. }
  1065. }
  1066. async _stat(e2, t4, s4, a3, r3, n2, i5) {
  1067. const l4 = await this._parent._stat(e2, t4, s4, a3, r3, n2, i5);
  1068. return false === l4.calculated ? null === r3 && "" === s4 && null === a3 ? this._manualStat(e2, t4, n2, i5) : { calculated: false } : l4;
  1069. }
  1070. _unionAllGeomSelf(e2) {
  1071. const t4 = this.iterator(this._defaultTracker(e2)), s4 = [];
  1072. return new Promise((e3, a3) => {
  1073. this._unionShapeInBatches(s4, t4, e3, a3);
  1074. });
  1075. }
  1076. _unionAllGeom(e2) {
  1077. return new Promise((t4, s4) => {
  1078. const a3 = this.iterator(this._defaultTracker(e2)), r3 = [];
  1079. this._unionShapeInBatches(r3, a3, t4, s4);
  1080. });
  1081. }
  1082. _unionShapeInBatches(e2, t4, s4, a3) {
  1083. t4.next().then((r3) => {
  1084. try {
  1085. null !== r3 && null !== r3.geometry && e2.push(r3.geometry), e2.length > 30 || null === r3 && e2.length > 1 ? b(e2).then((n2) => {
  1086. try {
  1087. null === r3 ? s4(n2) : (e2 = [n2], this._unionShapeInBatches(e2, t4, s4, a3));
  1088. } catch (i5) {
  1089. a3(i5);
  1090. }
  1091. }, a3) : null === r3 ? 1 === e2.length ? s4(e2[0]) : s4(null) : this._unionShapeInBatches(e2, t4, s4, a3);
  1092. } catch (n2) {
  1093. a3(n2);
  1094. }
  1095. }, a3);
  1096. }
  1097. iterator(e2) {
  1098. return new e(this, e2);
  1099. }
  1100. intersection(e2, t4 = false) {
  1101. return C3._featuresetFunctions.intersection.bind(this)(e2, t4);
  1102. }
  1103. difference(e2, t4 = false, s4 = true) {
  1104. return C3._featuresetFunctions.difference.bind(this)(e2, t4, s4);
  1105. }
  1106. symmetricDifference(e2, t4 = false, s4 = true) {
  1107. return C3._featuresetFunctions.symmetricDifference.bind(this)(e2, t4, s4);
  1108. }
  1109. morphShape(e2, t4, s4 = "unknown", a3 = null) {
  1110. return C3._featuresetFunctions.morphShape.bind(this)(e2, t4, s4, a3);
  1111. }
  1112. morphShapeAndAttributes(e2, t4, s4 = "unknown") {
  1113. return C3._featuresetFunctions.morphShapeAndAttributes.bind(this)(e2, t4, s4);
  1114. }
  1115. union(e2, t4 = false) {
  1116. return C3._featuresetFunctions.union.bind(this)(e2, t4);
  1117. }
  1118. intersects(e2) {
  1119. return C3._featuresetFunctions.intersects.bind(this)(e2);
  1120. }
  1121. envelopeIntersects(e2) {
  1122. return C3._featuresetFunctions.envelopeIntersects.bind(this)(e2);
  1123. }
  1124. contains(e2) {
  1125. return C3._featuresetFunctions.contains.bind(this)(e2);
  1126. }
  1127. overlaps(e2) {
  1128. return C3._featuresetFunctions.overlaps.bind(this)(e2);
  1129. }
  1130. relate(e2, t4) {
  1131. return C3._featuresetFunctions.relate.bind(this)(e2, t4);
  1132. }
  1133. within(e2) {
  1134. return C3._featuresetFunctions.within.bind(this)(e2);
  1135. }
  1136. touches(e2) {
  1137. return C3._featuresetFunctions.touches.bind(this)(e2);
  1138. }
  1139. top(e2) {
  1140. return C3._featuresetFunctions.top.bind(this)(e2);
  1141. }
  1142. crosses(e2) {
  1143. return C3._featuresetFunctions.crosses.bind(this)(e2);
  1144. }
  1145. buffer(e2, t4, s4, a3 = true) {
  1146. return C3._featuresetFunctions.buffer.bind(this)(e2, t4, s4, a3);
  1147. }
  1148. filter(e2, t4 = null) {
  1149. return C3._featuresetFunctions.filter.bind(this)(e2, t4);
  1150. }
  1151. orderBy(e2) {
  1152. return C3._featuresetFunctions.orderBy.bind(this)(e2);
  1153. }
  1154. dissolve(e2, t4) {
  1155. return C3._featuresetFunctions.dissolve.bind(this)(e2, t4);
  1156. }
  1157. groupby(e2, t4) {
  1158. return C3._featuresetFunctions.groupby.bind(this)(e2, t4);
  1159. }
  1160. reduce(e2, t4 = null, s4) {
  1161. return new Promise((a3, r3) => {
  1162. this._reduceImpl(this.iterator(this._defaultTracker(s4)), e2, t4, 0, a3, r3, 0);
  1163. });
  1164. }
  1165. _reduceImpl(e2, t4, s4, a3, r3, n2, i5) {
  1166. try {
  1167. if (++i5 > 1e3)
  1168. return void setTimeout(() => {
  1169. i5 = 0, this._reduceImpl(e2, t4, s4, a3, r3, n2, i5);
  1170. });
  1171. e2.next().then((l4) => {
  1172. try {
  1173. if (null === l4)
  1174. r3(s4);
  1175. else {
  1176. const u3 = t4(s4, l4, a3, this);
  1177. C(u3) ? u3.then((s5) => {
  1178. this._reduceImpl(e2, t4, s5, a3 + 1, r3, n2, i5);
  1179. }, n2) : this._reduceImpl(e2, t4, u3, a3 + 1, r3, n2, i5);
  1180. }
  1181. } catch (u3) {
  1182. n2(u3);
  1183. }
  1184. }, n2);
  1185. } catch (l4) {
  1186. n2(l4);
  1187. }
  1188. }
  1189. removeField(e2) {
  1190. return C3._featuresetFunctions.removeField.bind(this)(e2);
  1191. }
  1192. addField(e2, t4, s4 = null) {
  1193. return C3._featuresetFunctions.addField.bind(this)(e2, t4, s4);
  1194. }
  1195. sumArea(e2, t4 = false, s4) {
  1196. const a3 = m(e2);
  1197. return this.reduce((e3, s5) => null === s5.geometry ? 0 : t4 ? K(s5.geometry, a3).then((t5) => e3 + t5) : W(s5.geometry, a3).then((t5) => e3 + t5), 0, s4);
  1198. }
  1199. sumLength(e2, t4 = false, s4) {
  1200. const a3 = d(e2);
  1201. return this.reduce((e3, s5) => null === s5.geometry ? 0 : t4 ? M(s5.geometry, a3).then((t5) => e3 + t5) : F(s5.geometry, a3).then((t5) => e3 + t5), 0, s4);
  1202. }
  1203. _substituteVars(e2, t4) {
  1204. if (null !== t4) {
  1205. const s4 = {};
  1206. for (const e3 in t4)
  1207. s4[e3.toLowerCase()] = t4[e3];
  1208. e2.parameters = s4;
  1209. }
  1210. }
  1211. async distinct(e2, t4 = 1e3, s4 = null, a3) {
  1212. await this.load();
  1213. const r3 = f3.create(e2, this.getFieldsIndex());
  1214. return this._substituteVars(r3, s4), this.calculateStatistic("distinct", r3, t4, this._defaultTracker(a3));
  1215. }
  1216. async min(e2, t4 = null, s4) {
  1217. await this.load();
  1218. const a3 = f3.create(e2, this.getFieldsIndex());
  1219. return this._substituteVars(a3, t4), this.calculateStatistic("min", a3, -1, this._defaultTracker(s4));
  1220. }
  1221. async max(e2, t4 = null, s4) {
  1222. await this.load();
  1223. const a3 = f3.create(e2, this.getFieldsIndex());
  1224. return this._substituteVars(a3, t4), this.calculateStatistic("max", a3, -1, this._defaultTracker(s4));
  1225. }
  1226. async avg(e2, t4 = null, s4) {
  1227. await this.load();
  1228. const a3 = f3.create(e2, this.getFieldsIndex());
  1229. return this._substituteVars(a3, t4), this.calculateStatistic("avg", a3, -1, this._defaultTracker(s4));
  1230. }
  1231. async sum(e2, t4 = null, s4) {
  1232. await this.load();
  1233. const a3 = f3.create(e2, this.getFieldsIndex());
  1234. return this._substituteVars(a3, t4), this.calculateStatistic("sum", a3, -1, this._defaultTracker(s4));
  1235. }
  1236. async stdev(e2, t4 = null, s4) {
  1237. await this.load();
  1238. const a3 = f3.create(e2, this.getFieldsIndex());
  1239. return this._substituteVars(a3, t4), this.calculateStatistic("stdev", a3, -1, this._defaultTracker(s4));
  1240. }
  1241. async variance(e2, t4 = null, s4) {
  1242. await this.load();
  1243. const a3 = f3.create(e2, this.getFieldsIndex());
  1244. return this._substituteVars(a3, t4), this.calculateStatistic("variance", a3, -1, this._defaultTracker(s4));
  1245. }
  1246. async count(e2) {
  1247. return await this.load(), this.calculateStatistic("count", f3.create("1", this.getFieldsIndex()), -1, this._defaultTracker(e2));
  1248. }
  1249. _defaultTracker(e2) {
  1250. return e2 || { aborted: false };
  1251. }
  1252. forEach(e2, t4) {
  1253. return new Promise((s4, a3) => {
  1254. this._forEachImpl(this.iterator(this._defaultTracker(t4)), e2, this, s4, a3, 0);
  1255. });
  1256. }
  1257. _forEachImpl(e2, t4, s4, a3, r3, n2) {
  1258. try {
  1259. if (++n2 > 1e3)
  1260. return void setTimeout(() => {
  1261. n2 = 0, this._forEachImpl(e2, t4, s4, a3, r3, n2);
  1262. }, 0);
  1263. e2.next().then((i5) => {
  1264. try {
  1265. if (null === i5)
  1266. a3(s4);
  1267. else {
  1268. const l4 = t4(i5);
  1269. null == l4 ? this._forEachImpl(e2, t4, s4, a3, r3, n2) : C(l4) ? l4.then(() => {
  1270. try {
  1271. this._forEachImpl(e2, t4, s4, a3, r3, n2);
  1272. } catch (i6) {
  1273. r3(i6);
  1274. }
  1275. }, r3) : this._forEachImpl(e2, t4, s4, a3, r3, n2);
  1276. }
  1277. } catch (l4) {
  1278. r3(l4);
  1279. }
  1280. }, r3);
  1281. } catch (i5) {
  1282. r3(i5);
  1283. }
  1284. }
  1285. convertToJSON(e2) {
  1286. const t4 = { layerDefinition: { geometryType: this.geometryType, fields: [] }, featureSet: { features: [], geometryType: this.geometryType } };
  1287. for (let s4 = 0; s4 < this.fields.length; s4++)
  1288. t4.layerDefinition.fields.push(o(this.fields[s4]));
  1289. return this.reduce((e3, s4) => {
  1290. const a3 = { geometry: s4.geometry && s4.geometry.toJSON(), attributes: {} };
  1291. for (const t5 in s4.attributes)
  1292. a3.attributes[t5] = s4.attributes[t5];
  1293. return t4.featureSet.features.push(a3), 1;
  1294. }, 0, e2).then(() => t4);
  1295. }
  1296. castToText(e2 = false) {
  1297. return "object, FeatureSet";
  1298. }
  1299. queryAttachments(e2, t4, s4, a3, r3) {
  1300. return this._parent.queryAttachments(e2, t4, s4, a3, r3);
  1301. }
  1302. serviceUrl() {
  1303. return this._parent.serviceUrl();
  1304. }
  1305. subtypes() {
  1306. return this.typeIdField ? { subtypeField: this.typeIdField, subtypes: this.types ? this.types.map((e2) => ({ name: e2.name, code: e2.id })) : [] } : null;
  1307. }
  1308. relationshipMetaData() {
  1309. return this._parent.relationshipMetaData();
  1310. }
  1311. get gdbVersion() {
  1312. return this._parent ? this._parent.gdbVersion : "";
  1313. }
  1314. schema() {
  1315. const e2 = [];
  1316. for (const t4 of this.fields)
  1317. e2.push(o(t4));
  1318. return { objectIdField: this.objectIdField, globalIdField: this.globalIdField, geometryType: void 0 === v[this.geometryType] ? "" : v[this.geometryType], fields: e2 };
  1319. }
  1320. async convertToText(e2, t4) {
  1321. if ("schema" === e2)
  1322. return await this._ensureLoaded(), JSON.stringify(this.schema());
  1323. if ("featureset" === e2) {
  1324. await this._ensureLoaded();
  1325. const e3 = [];
  1326. await this.reduce((t5, s5) => {
  1327. const a3 = { geometry: s5.geometry ? s5.geometry.toJSON() : null, attributes: s5.attributes };
  1328. return null !== a3.geometry && a3.geometry.spatialReference && delete a3.geometry.spatialReference, e3.push(a3), 1;
  1329. }, 0, t4);
  1330. const s4 = this.schema();
  1331. return s4.features = e3, s4.spatialReference = this.spatialReference.toJSON(), JSON.stringify(s4);
  1332. }
  1333. return this.castToText();
  1334. }
  1335. getFeatureByObjectId(e2, t4) {
  1336. return this._parent.getFeatureByObjectId(e2, t4);
  1337. }
  1338. getOwningSystemUrl() {
  1339. return this._parent.getOwningSystemUrl();
  1340. }
  1341. getIdentityUser() {
  1342. return this._parent.getIdentityUser();
  1343. }
  1344. getRootFeatureSet() {
  1345. return null !== this._parent ? this._parent.getRootFeatureSet() : this;
  1346. }
  1347. getDataSourceFeatureSet() {
  1348. return null !== this._parent ? this._parent.getDataSourceFeatureSet() : this;
  1349. }
  1350. castAsJson(e2 = null) {
  1351. return "keeptype" === (e2 == null ? void 0 : e2.featureset) ? this : "none" === (e2 == null ? void 0 : e2.featureset) ? null : { type: "FeatureSet" };
  1352. }
  1353. async castAsJsonAsync(e2 = null, t4 = null) {
  1354. var _a;
  1355. if ("keeptype" === (t4 == null ? void 0 : t4.featureset))
  1356. return this;
  1357. if ("schema" === (t4 == null ? void 0 : t4.featureset))
  1358. return await this._ensureLoaded(), JSON.parse(JSON.stringify(this.schema()));
  1359. if ("none" === (t4 == null ? void 0 : t4.featureset))
  1360. return null;
  1361. await this._ensureLoaded();
  1362. const s4 = [];
  1363. await this.reduce((e3, a4) => {
  1364. const r3 = { geometry: a4.geometry ? true === (t4 == null ? void 0 : t4.keepGeometryType) ? a4.geometry : a4.geometry.toJSON() : null, attributes: a4.attributes };
  1365. return null !== r3.geometry && r3.geometry.spatialReference && true !== (t4 == null ? void 0 : t4.keepGeometryType) && delete r3.geometry.spatialReference, s4.push(r3), 1;
  1366. }, 0, e2);
  1367. const a3 = this.schema();
  1368. return a3.features = s4, a3.spatialReference = true === (t4 == null ? void 0 : t4.keepGeometryType) ? this.spatialReference : (_a = this.spatialReference) == null ? void 0 : _a.toJSON(), a3;
  1369. }
  1370. };
  1371. C3._featuresetFunctions = {};
  1372. // node_modules/@arcgis/core/arcade/featureset/sources/Empty.js
  1373. var u2 = class extends C3 {
  1374. constructor(e2) {
  1375. super(e2), this.declaredClass = "esri.layers.featureset.sources.Empty", this._maxProcessing = 1e3, this._wset = new t3([], [], false, null), this._parent = e2.parentfeatureset, this._databaseType = t.Standardised;
  1376. }
  1377. async _getSet() {
  1378. return this._wset;
  1379. }
  1380. optimisePagingFeatureQueries() {
  1381. }
  1382. _isInFeatureSet() {
  1383. return i2.NotInFeatureSet;
  1384. }
  1385. async _getFeature() {
  1386. throw new o2(n.NeverReach);
  1387. }
  1388. async queryAttachments() {
  1389. return [];
  1390. }
  1391. async _getFeatures() {
  1392. return "success";
  1393. }
  1394. _featureFromCache() {
  1395. return null;
  1396. }
  1397. async _fetchAndRefineFeatures() {
  1398. throw new o2(n.NeverReach);
  1399. }
  1400. async _getFilteredSet() {
  1401. return new t3([], [], false, null);
  1402. }
  1403. _stat(e2, t4, r3, s4, a3, n2, u3) {
  1404. return this._manualStat(e2, t4, n2, u3);
  1405. }
  1406. async _canDoAggregates() {
  1407. return false;
  1408. }
  1409. };
  1410. // node_modules/@arcgis/core/arcade/featureset/actions/SpatialFilter.js
  1411. var f6 = class extends C3 {
  1412. constructor(e2) {
  1413. super(e2), this._relation = "", this._relationGeom = null, this._relationString = "", this.declaredClass = "esri.arcade.featureset.actions.SpatialFilter", this._relationString = e2.relationString, this._parent = e2.parentfeatureset, this._maxProcessing = 40, this._relation = e2.relation, this._relationGeom = e2.relationGeom;
  1414. }
  1415. async _getSet(e2) {
  1416. if (null === this._wset) {
  1417. await this._ensureLoaded();
  1418. const t4 = await this._parent._getFilteredSet("esriSpatialRelRelation" !== this._relation ? this._relation : this._relation + ":" + this._relationString, this._relationGeom, null, null, e2);
  1419. return this._checkCancelled(e2), this._wset = new t3(t4._candidates.slice(0), t4._known.slice(0), t4._ordered, this._clonePageDefinition(t4.pagesDefinition)), this._wset;
  1420. }
  1421. return this._wset;
  1422. }
  1423. _isInFeatureSet(e2) {
  1424. let t4 = this._parent._isInFeatureSet(e2);
  1425. return t4 === i2.NotInFeatureSet ? t4 : (t4 = this._idstates[e2], void 0 === t4 ? i2.Unknown : t4);
  1426. }
  1427. _getFeature(e2, t4, i5) {
  1428. return this._parent._getFeature(e2, t4, i5);
  1429. }
  1430. _getFeatures(e2, t4, i5, r3) {
  1431. return this._parent._getFeatures(e2, t4, i5, r3);
  1432. }
  1433. _featureFromCache(e2) {
  1434. return this._parent._featureFromCache(e2);
  1435. }
  1436. async executeSpatialRelationTest(e2) {
  1437. var _a;
  1438. if (null === e2.geometry)
  1439. return false;
  1440. switch (this._relation) {
  1441. case "esriSpatialRelEnvelopeIntersects": {
  1442. const t4 = f2(this._relationGeom), i5 = f2(e2.geometry);
  1443. return h(t4, i5);
  1444. }
  1445. case "esriSpatialRelIntersects":
  1446. return h(this._relationGeom, e2.geometry);
  1447. case "esriSpatialRelContains":
  1448. return p(this._relationGeom, e2.geometry);
  1449. case "esriSpatialRelOverlaps":
  1450. return O(this._relationGeom, e2.geometry);
  1451. case "esriSpatialRelWithin":
  1452. return x(this._relationGeom, e2.geometry);
  1453. case "esriSpatialRelTouches":
  1454. return S2(this._relationGeom, e2.geometry);
  1455. case "esriSpatialRelCrosses":
  1456. return m2(this._relationGeom, e2.geometry);
  1457. case "esriSpatialRelRelation":
  1458. return R(this._relationGeom, e2.geometry, (_a = this._relationString) != null ? _a : "");
  1459. }
  1460. }
  1461. async _fetchAndRefineFeatures(e2, t4, i5) {
  1462. var _a;
  1463. const r3 = new t3([], e2, false, null), s4 = Math.min(t4, e2.length);
  1464. await ((_a = this._parent) == null ? void 0 : _a._getFeatures(r3, -1, s4, i5)), this._checkCancelled(i5);
  1465. const o5 = [];
  1466. for (let n2 = 0; n2 < s4; n2++) {
  1467. const t5 = this._parent._featureFromCache(e2[n2]);
  1468. o5.push(await this.executeSpatialRelationTest(t5));
  1469. }
  1470. for (let n2 = 0; n2 < t4; n2++)
  1471. true === o5[n2] ? this._idstates[e2[n2]] = i2.InFeatureSet : this._idstates[e2[n2]] = i2.NotInFeatureSet;
  1472. return "success";
  1473. }
  1474. async _getFilteredSet(e2, t4, i5, r3, a3) {
  1475. await this._ensureLoaded();
  1476. const s4 = await this._parent._getFilteredSet("esriSpatialRelRelation" !== this._relation ? this._relation : this._relation + ":" + this._relationString, this._relationGeom, i5, r3, a3);
  1477. let o5;
  1478. return this._checkCancelled(a3), o5 = null !== t4 ? new t3(s4._candidates.slice(0).concat(s4._known.slice(0)), [], s4._ordered, this._clonePageDefinition(s4.pagesDefinition)) : new t3(s4._candidates.slice(0), s4._known.slice(0), s4._ordered, this._clonePageDefinition(s4.pagesDefinition)), o5;
  1479. }
  1480. async _stat(e2, t4, i5, r3, n2, a3, s4) {
  1481. if ("" !== i5)
  1482. return { calculated: false };
  1483. const o5 = await this._parent._stat(e2, t4, "esriSpatialRelRelation" !== this._relation ? this._relation : this._relation + ":" + this._relationString, this._relationGeom, n2, a3, s4);
  1484. return false === o5.calculated ? null === n2 && "" === i5 && null === r3 ? this._manualStat(e2, t4, a3, s4) : { calculated: false } : o5;
  1485. }
  1486. async _canDoAggregates(e2, t4, i5, r3, n2) {
  1487. return "" === i5 && null === r3 && (null !== this._parent && this._parent._canDoAggregates(e2, t4, "esriSpatialRelRelation" !== this._relation ? this._relation : this._relation + ":" + this._relationString, this._relationGeom, n2));
  1488. }
  1489. async _getAggregatePagesDataSourceDefinition(e2, r3, n2, a3, s4, o5, l4) {
  1490. if (null === this._parent)
  1491. throw new o2(n.NeverReach);
  1492. return this._parent._getAggregatePagesDataSourceDefinition(e2, r3, "esriSpatialRelRelation" !== this._relation ? this._relation : this._relation + ":" + this._relationString, this._relationGeom, s4, o5, l4);
  1493. }
  1494. static registerAction() {
  1495. C3._featuresetFunctions.intersects = function(t4) {
  1496. return null == t4 ? new u2({ parentfeatureset: this }) : new f6({ parentfeatureset: this, relation: "esriSpatialRelIntersects", relationGeom: t4 });
  1497. }, C3._featuresetFunctions.envelopeIntersects = function(t4) {
  1498. return null == t4 ? new u2({ parentfeatureset: this }) : new f6({ parentfeatureset: this, relation: "esriSpatialRelEnvelopeIntersects", relationGeom: t4 });
  1499. }, C3._featuresetFunctions.contains = function(t4) {
  1500. return null == t4 ? new u2({ parentfeatureset: this }) : new f6({ parentfeatureset: this, relation: "esriSpatialRelContains", relationGeom: t4 });
  1501. }, C3._featuresetFunctions.overlaps = function(t4) {
  1502. return null == t4 ? new u2({ parentfeatureset: this }) : new f6({ parentfeatureset: this, relation: "esriSpatialRelOverlaps", relationGeom: t4 });
  1503. }, C3._featuresetFunctions.within = function(t4) {
  1504. return null == t4 ? new u2({ parentfeatureset: this }) : new f6({ parentfeatureset: this, relation: "esriSpatialRelWithin", relationGeom: t4 });
  1505. }, C3._featuresetFunctions.touches = function(t4) {
  1506. return null == t4 ? new u2({ parentfeatureset: this }) : new f6({ parentfeatureset: this, relation: "esriSpatialRelTouches", relationGeom: t4 });
  1507. }, C3._featuresetFunctions.crosses = function(t4) {
  1508. return null == t4 ? new u2({ parentfeatureset: this }) : new f6({ parentfeatureset: this, relation: "esriSpatialRelCrosses", relationGeom: t4 });
  1509. }, C3._featuresetFunctions.relate = function(t4, i5) {
  1510. return null == t4 ? new u2({ parentfeatureset: this }) : new f6({ parentfeatureset: this, relation: "esriSpatialRelRelation", relationGeom: t4, relationString: i5 });
  1511. };
  1512. }
  1513. };
  1514. export {
  1515. t2 as t,
  1516. s,
  1517. n,
  1518. o2 as o,
  1519. a2 as a,
  1520. t3 as t2,
  1521. s2,
  1522. o3 as o2,
  1523. c2 as c,
  1524. i3 as i,
  1525. l2 as l,
  1526. f4 as f,
  1527. d2 as d,
  1528. p2 as p,
  1529. y2 as y,
  1530. w,
  1531. N,
  1532. m4 as m,
  1533. g2 as g,
  1534. C3 as C,
  1535. u2 as u,
  1536. f6 as f2
  1537. };
  1538. //# sourceMappingURL=chunk-MDR3KRG4.js.map