arcadeUtils-2BWT2KOE.js 157 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570
  1. import {
  2. A as A2,
  3. E as E2,
  4. I,
  5. N as N2,
  6. O as O2,
  7. P as P2,
  8. S,
  9. b,
  10. d as d3,
  11. f,
  12. h as h2,
  13. m as m4,
  14. o,
  15. p as p2,
  16. r,
  17. u,
  18. y
  19. } from "./chunk-IT2TKXNZ.js";
  20. import {
  21. d as d2,
  22. s
  23. } from "./chunk-YYN5W6FL.js";
  24. import {
  25. e
  26. } from "./chunk-L5OAV75Q.js";
  27. import "./chunk-YQQTFR2M.js";
  28. import {
  29. d
  30. } from "./chunk-R5LRKX5A.js";
  31. import {
  32. z as z2
  33. } from "./chunk-NLNXEWKQ.js";
  34. import "./chunk-HEFAWVPH.js";
  35. import "./chunk-PJ6KSXOD.js";
  36. import "./chunk-FYNVVMWY.js";
  37. import "./chunk-Q52DVFYK.js";
  38. import "./chunk-HBMVUVZX.js";
  39. import {
  40. A,
  41. Ce,
  42. D2 as D,
  43. E,
  44. G,
  45. J,
  46. L,
  47. M as M2,
  48. N,
  49. Ne,
  50. O,
  51. P2 as P,
  52. Q,
  53. R,
  54. W,
  55. X,
  56. Y,
  57. _,
  58. h,
  59. i,
  60. j as j2,
  61. k as k3,
  62. ne,
  63. t2 as t,
  64. v2,
  65. w,
  66. z
  67. } from "./chunk-25BNEBXZ.js";
  68. import "./chunk-3ZFH4KQV.js";
  69. import {
  70. e as e2
  71. } from "./chunk-5NKYXKIA.js";
  72. import "./chunk-BJHM4JNS.js";
  73. import "./chunk-F6A2QQ26.js";
  74. import "./chunk-7ZIDBK7B.js";
  75. import "./chunk-O4FY3ITT.js";
  76. import "./chunk-UXF37FQ4.js";
  77. import "./chunk-ZOEK6QHJ.js";
  78. import "./chunk-2Z6LERTI.js";
  79. import {
  80. m as m2,
  81. m2 as m3,
  82. v2 as v
  83. } from "./chunk-OWVBLVP3.js";
  84. import "./chunk-XH7RUGVZ.js";
  85. import "./chunk-R5IG2D6H.js";
  86. import "./chunk-VBRY5KJM.js";
  87. import "./chunk-PDKDCAAD.js";
  88. import {
  89. M2 as M,
  90. j2 as j,
  91. p
  92. } from "./chunk-ECW2QABR.js";
  93. import "./chunk-GCDJLKH4.js";
  94. import {
  95. k2
  96. } from "./chunk-MRJEICT6.js";
  97. import "./chunk-Y3WMVFTW.js";
  98. import "./chunk-SAS7RONY.js";
  99. import "./chunk-WSRBH7BF.js";
  100. import "./chunk-IHXECKQQ.js";
  101. import {
  102. k
  103. } from "./chunk-ULGDPLM2.js";
  104. import "./chunk-EMJ4ZSM2.js";
  105. import {
  106. m
  107. } from "./chunk-IKP3YN53.js";
  108. import {
  109. a
  110. } from "./chunk-GZT4BVFP.js";
  111. import "./chunk-A5ICIBVI.js";
  112. // node_modules/@arcgis/core/arcade/arcadeCompiler.js
  113. function ee(e8, t2, n3) {
  114. try {
  115. return n3(e8, null, t2.arguments);
  116. } catch (r7) {
  117. throw r7;
  118. }
  119. }
  120. function te(e8, t2) {
  121. try {
  122. switch (t2.type) {
  123. case "EmptyStatement":
  124. return "lc.voidOperation";
  125. case "VariableDeclarator":
  126. return ge(e8, t2);
  127. case "VariableDeclaration":
  128. return he(e8, t2);
  129. case "BlockStatement":
  130. return pe(e8, t2);
  131. case "FunctionDeclaration":
  132. return me(e8, t2);
  133. case "ReturnStatement":
  134. return fe(e8, t2);
  135. case "IfStatement":
  136. return ue(e8, t2);
  137. case "ExpressionStatement":
  138. return ie(e8, t2);
  139. case "AssignmentExpression":
  140. return se2(e8, t2);
  141. case "UpdateExpression":
  142. return le(e8, t2);
  143. case "BreakStatement":
  144. return "break";
  145. case "ContinueStatement":
  146. return "continue";
  147. case "TemplateLiteral":
  148. return Ee(e8, t2);
  149. case "TemplateElement":
  150. return JSON.stringify(t2.value ? t2.value.cooked : "");
  151. case "ForStatement":
  152. return ae(e8, t2);
  153. case "ForInStatement":
  154. return oe(e8, t2);
  155. case "Identifier":
  156. return Me(e8, t2);
  157. case "MemberExpression":
  158. return Se(e8, t2);
  159. case "Literal":
  160. return t2.value === null || t2.value === void 0 ? "null" : JSON.stringify(t2.value);
  161. case "ThisExpression":
  162. case "ConditionalExpression":
  163. case "Array":
  164. throw new Error(b(t2, "RUNTIME", "NOTSUPPORTED"));
  165. case "CallExpression":
  166. return Ie(e8, t2);
  167. case "UnaryExpression":
  168. return we(e8, t2);
  169. case "BinaryExpression":
  170. return ve(e8, t2);
  171. case "LogicalExpression":
  172. return Ne2(e8, t2);
  173. case "ArrayExpression":
  174. return be(e8, t2);
  175. case "ObjectExpression":
  176. return ne2(e8, t2);
  177. case "Property":
  178. return re(e8, t2);
  179. default:
  180. throw new Error(b(t2, "RUNTIME", "UNREOGNISED"));
  181. }
  182. } catch (n3) {
  183. throw n3;
  184. }
  185. }
  186. function ne2(e8, t2) {
  187. let n3 = "lang.dictionary([";
  188. for (let r7 = 0; r7 < t2.properties.length; r7++) {
  189. const o4 = t2.properties[r7];
  190. r7 > 0 && (n3 += ","), n3 += "lang.strCheck(" + (o4.key.type === "Identifier" ? "'" + o4.key.name + "'" : te(e8, o4.key)) + ",'ObjectExpression'),lang.aCheck(" + te(e8, o4.value) + ", 'ObjectExpression')";
  191. }
  192. return n3 += "])", n3;
  193. }
  194. function re(e8, t2) {
  195. throw new Error("Should not get here");
  196. }
  197. function oe(e8, t2) {
  198. const n3 = Pe(e8), r7 = Pe(e8), o4 = Pe(e8);
  199. let a4 = "var " + n3 + " = " + te(e8, t2.right) + ";\n";
  200. t2.left.type === "VariableDeclaration" && (a4 += te(e8, t2.left));
  201. let l3 = t2.left.type === "VariableDeclaration" ? t2.left.declarations[0].id.name : t2.left.name;
  202. l3 = l3.toLowerCase();
  203. let s4 = "";
  204. return e8.localScope !== null && (e8.localScope[l3] !== void 0 ? s4 = "lscope['" + l3 + "']" : e8.localScope._SymbolsMap[l3] !== void 0 && (s4 = "lscope['" + e8.localScope._SymbolsMap[l3] + "']")), s4 === "" && (e8.globalScope[l3] !== void 0 ? s4 = "gscope['" + l3 + "']" : e8.globalScope._SymbolsMap[l3] !== void 0 && (s4 = "gscope['" + e8.globalScope._SymbolsMap[l3] + "']")), a4 += "if (" + n3 + "===null) { lastStatement = lc.voidOperation; }\n ", a4 += "else if (lc.isArray(" + n3 + ") || lc.isString(" + n3 + ")) {", a4 += "var " + r7 + "=" + n3 + ".length; \n", a4 += "for(var " + o4 + "=0; " + o4 + "<" + r7 + "; " + o4 + "++) {\n", a4 += s4 + "=" + o4 + ";\n", a4 += te(e8, t2.body), a4 += "\n}\n", a4 += " lastStatement = lc.voidOperation; \n", a4 += " \n}\n", a4 += "else if (lc.isImmutableArray(" + n3 + ")) {", a4 += "var " + r7 + "=" + n3 + ".length(); \n", a4 += "for(var " + o4 + "=0; " + o4 + "<" + r7 + "; " + o4 + "++) {\n", a4 += s4 + "=" + o4 + ";\n", a4 += te(e8, t2.body), a4 += "\n}\n", a4 += " lastStatement = lc.voidOperation; \n", a4 += " \n}\n", a4 += "else if (( " + n3 + " instanceof lang.Dictionary) || ( " + n3 + " instanceof lang.Feature)) {", a4 += "var " + r7 + "=" + n3 + ".keys(); \n", a4 += "for(var " + o4 + "=0; " + o4 + "<" + r7 + ".length; " + o4 + "++) {\n", a4 += s4 + "=" + r7 + "[" + o4 + "];\n", a4 += te(e8, t2.body), a4 += "\n}\n", a4 += " lastStatement = lc.voidOperation; \n", a4 += " \n}\n", e8.isAsync && (a4 += "else if (lc.isFeatureSet(" + n3 + ")) {", a4 += "var " + r7 + "=" + n3 + ".iterator(runtimeCtx.abortSignal); \n", a4 += "for(var " + o4 + "=lang. graphicToFeature( yield " + r7 + ".next()," + n3 + "); " + o4 + "!=null; " + o4 + "=lang. graphicToFeature( yield " + r7 + ".next()," + n3 + ")) {\n", a4 += s4 + "=" + o4 + ";\n", a4 += te(e8, t2.body), a4 += "\n}\n", a4 += " lastStatement = lc.voidOperation; \n", a4 += " \n}\n"), a4 += "else { lastStatement = lc.voidOperation; } \n", a4;
  205. }
  206. function ae(e8, t2) {
  207. let n3 = "lastStatement = lc.voidOperation; \n";
  208. t2.init !== null && (n3 += te(e8, t2.init) + "; ");
  209. const r7 = Pe(e8), o4 = Pe(e8);
  210. return n3 += "var " + r7 + " = true; ", n3 += "\n do { ", t2.update !== null && (n3 += " if (" + r7 + "===false) {\n " + te(e8, t2.update) + " \n}\n " + r7 + "=false; \n"), t2.test !== null && (n3 += "var " + o4 + " = " + te(e8, t2.test) + "; ", n3 += "if (" + o4 + "===false) { break; } else if (" + o4 + "!==true) { lang.error({type: '" + t2.type + "'},'RUNTIME','CANNOT_USE_NONBOOLEAN_IN_CONDITION'); }\n"), n3 += te(e8, t2.body), t2.update !== null && (n3 += "\n " + te(e8, t2.update)), n3 += "\n" + r7 + " = true; \n} while(true); lastStatement = lc.voidOperation; ", n3;
  211. }
  212. function le(e8, t2) {
  213. let n3 = null, r7 = "";
  214. if (t2.argument.type === "MemberExpression")
  215. return n3 = te(e8, t2.argument.object), r7 = t2.argument.computed === true ? te(e8, t2.argument.property) : "'" + t2.argument.property.name + "'", "lang.memberupdate(" + n3 + "," + r7 + ",'" + t2.operator + "'," + t2.prefix + ")";
  216. if (n3 = t2.argument.name.toLowerCase(), e8.localScope !== null) {
  217. if (e8.localScope[n3] !== void 0)
  218. return "lang.update(lscope, '" + n3 + "','" + t2.operator + "'," + t2.prefix + ")";
  219. if (e8.localScope._SymbolsMap[n3] !== void 0)
  220. return "lang.update(lscope, '" + e8.localScope._SymbolsMap[n3] + "','" + t2.operator + "'," + t2.prefix + ")";
  221. }
  222. if (e8.globalScope[n3] !== void 0)
  223. return "lang.update(gscope, '" + n3 + "','" + t2.operator + "'," + t2.prefix + ")";
  224. if (e8.globalScope._SymbolsMap[n3] !== void 0)
  225. return "lang.update(gscope, '" + e8.globalScope._SymbolsMap[n3] + "','" + t2.operator + "'," + t2.prefix + ")";
  226. throw new Error("Variable not recognised");
  227. }
  228. function se2(e8, t2) {
  229. const n3 = te(e8, t2.right);
  230. let r7 = null, o4 = "";
  231. if (t2.left.type === "MemberExpression")
  232. return r7 = te(e8, t2.left.object), o4 = t2.left.computed === true ? te(e8, t2.left.property) : "'" + t2.left.property.name + "'", "lang.assignmember(" + r7 + "," + o4 + ",'" + t2.operator + "'," + n3 + ")";
  233. if (r7 = t2.left.name.toLowerCase(), e8.localScope !== null) {
  234. if (e8.localScope[r7] !== void 0)
  235. return "lscope['" + r7 + "']=lang.assign(" + n3 + ",'" + t2.operator + "', lscope['" + r7 + "'])";
  236. if (e8.localScope._SymbolsMap[r7] !== void 0)
  237. return "lscope['" + e8.localScope._SymbolsMap[r7] + "']=lang.assign(" + n3 + ",'" + t2.operator + "', lscope['" + e8.localScope._SymbolsMap[r7] + "'])";
  238. }
  239. if (e8.globalScope[r7] !== void 0)
  240. return "gscope['" + r7 + "']=lang.assign(" + n3 + ",'" + t2.operator + "', gscope['" + r7 + "'])";
  241. if (e8.globalScope._SymbolsMap[r7] !== void 0)
  242. return "gscope['" + e8.globalScope._SymbolsMap[r7] + "']=lang.assign(" + n3 + ",'" + t2.operator + "', gscope['" + e8.globalScope._SymbolsMap[r7] + "'])";
  243. throw new Error("Variable not recognised");
  244. }
  245. function ie(e8, t2) {
  246. return t2.expression.type === "AssignmentExpression" ? "lastStatement = lc.voidOperation; " + te(e8, t2.expression) + "; \n " : (t2.expression.type, "lastStatement = " + te(e8, t2.expression) + "; ");
  247. }
  248. function ce(e8, t2) {
  249. return t2.type === "BlockStatement" ? te(e8, t2) : t2.type === "ReturnStatement" || t2.type === "BreakStatement" || t2.type === "ContinueStatement" ? te(e8, t2) + "; " : t2.type === "UpdateExpression" ? "lastStatement = " + te(e8, t2) + "; " : t2.type === "ExpressionStatement" ? te(e8, t2) : t2.type === "ObjectExpression" ? "lastStatement = " + te(e8, t2) + "; " : te(e8, t2) + "; ";
  250. }
  251. function ue(e8, t2) {
  252. if (t2.test.type === "AssignmentExpression" || t2.test.type === "UpdateExpression")
  253. throw new Error(b(t2.test, "RUNTIME", "CANNOT_USE_ASSIGNMENT_IN_CONDITION"));
  254. const n3 = te(e8, t2.test), r7 = Pe(e8);
  255. let o4 = "var " + r7 + " = " + n3 + ";\n if (" + r7 + " === true) {\n" + ce(e8, t2.consequent) + "\n }\n";
  256. return t2.alternate !== null ? o4 += "else if (" + r7 + "===false) { \n" + ce(e8, t2.alternate) + "}\n" : o4 += "else if (" + r7 + "===false) { \n lastStatement = lc.voidOperation;\n }\n", o4 += "else { lang.error({type: '" + t2.type + "'},'RUNTIME','CANNOT_USE_NONBOOLEAN_IN_CONDITION'); \n}\n", o4;
  257. }
  258. function pe(e8, t2) {
  259. let n3 = "";
  260. for (let r7 = 0; r7 < t2.body.length; r7++)
  261. t2.body[r7].type === "ReturnStatement" || t2.body[r7].type === "BreakStatement" || t2.body[r7].type === "ContinueStatement" ? n3 += te(e8, t2.body[r7]) + "; \n" : t2.body[r7].type === "UpdateExpression" || t2.body[r7].type === "ObjectExpression" ? n3 += "lastStatement = " + te(e8, t2.body[r7]) + "; \n" : n3 += te(e8, t2.body[r7]) + " \n";
  262. return n3;
  263. }
  264. function fe(e8, t2) {
  265. if (t2.argument === null)
  266. return "return lc.voidOperation";
  267. return "return " + te(e8, t2.argument);
  268. }
  269. function me(e8, t2) {
  270. const n3 = t2.id.name.toLowerCase(), r7 = { isAsync: e8.isAsync, spatialReference: e8.spatialReference, console: e8.console, lrucache: e8.lrucache, interceptor: e8.interceptor, services: e8.services, symbols: e8.symbols, mangleMap: e8.mangleMap, localScope: { _SymbolsMap: {} }, depthCounter: e8.depthCounter + 1, globalScope: e8.globalScope };
  271. if (r7.depthCounter > 64)
  272. throw new Error("Exceeded maximum function depth");
  273. let o4 = "new lc.SizzleFunction( lang.functionDepthchecker(function() { var lastStatement = lc.voidOperation; \n var lscope = runtimeCtx.localStack[runtimeCtx.localStack.length-1];\n";
  274. for (let a4 = 0; a4 < t2.params.length; a4++) {
  275. const n4 = t2.params[a4].name.toLowerCase(), l3 = Fe(e8);
  276. r7.localScope._SymbolsMap[n4] = l3, r7.mangleMap[n4] = l3, o4 += "lscope['" + l3 + "']=arguments[" + a4.toString() + "];\n";
  277. }
  278. if (e8.isAsync === true ? (o4 += "return lang.__awaiter(this, void 0, void 0, function* () {\n", o4 += pe(r7, t2.body) + "\n return lastStatement; ", o4 += "}); }", o4 += ", runtimeCtx)," + t2.params.length + ")", o4 += "\n lastStatement = lc.voidOperation; \n") : (o4 += pe(r7, t2.body) + "\n return lastStatement; }, runtimeCtx)," + t2.params.length + ")", o4 += "\n lastStatement = lc.voidOperation; \n"), e8.globalScope[n3] !== void 0)
  279. return "gscope['" + n3 + "']=" + o4;
  280. if (e8.globalScope._SymbolsMap[n3] !== void 0)
  281. return "gscope['" + e8.globalScope._SymbolsMap[n3] + "']=" + o4;
  282. {
  283. const t3 = Fe(e8);
  284. return e8.globalScope._SymbolsMap[n3] = t3, e8.mangleMap[n3] = t3, "gscope['" + t3 + "']=" + o4;
  285. }
  286. }
  287. function he(e8, t2) {
  288. const n3 = [];
  289. for (let r7 = 0; r7 < t2.declarations.length; r7++)
  290. n3.push(te(e8, t2.declarations[r7]));
  291. return n3.join("\n") + " \n lastStatement= lc.voidOperation; \n";
  292. }
  293. function ge(e8, t2) {
  294. let n3 = t2.init === null ? null : te(e8, t2.init);
  295. n3 === j2 && (n3 = null);
  296. const r7 = t2.id.name.toLowerCase();
  297. if (e8.localScope !== null) {
  298. if (e8.localScope[r7] !== void 0)
  299. return "lscope['" + r7 + "']=" + n3 + "; ";
  300. if (e8.localScope._SymbolsMap[r7] !== void 0)
  301. return "lscope['" + e8.localScope._SymbolsMap[r7] + "']=" + n3 + "; ";
  302. {
  303. const t3 = Fe(e8);
  304. return e8.localScope._SymbolsMap[r7] = t3, e8.mangleMap[r7] = t3, "lscope['" + t3 + "']=" + n3 + "; ";
  305. }
  306. }
  307. if (e8.globalScope[r7] !== void 0)
  308. return "gscope['" + r7 + "']=" + n3 + "; ";
  309. if (e8.globalScope._SymbolsMap[r7] !== void 0)
  310. return "gscope['" + e8.globalScope._SymbolsMap[r7] + "']=" + n3 + "; ";
  311. {
  312. const t3 = Fe(e8);
  313. return e8.globalScope._SymbolsMap[r7] = t3, e8.mangleMap[r7] = t3, "gscope['" + t3 + "']=" + n3 + "; ";
  314. }
  315. }
  316. var ye = 0;
  317. function de(e8, t2, r7) {
  318. let l3;
  319. switch (t2 = t2.toLowerCase()) {
  320. case "hasz": {
  321. const t3 = e8.hasZ;
  322. return t3 !== void 0 && t3;
  323. }
  324. case "hasm": {
  325. const t3 = e8.hasM;
  326. return t3 !== void 0 && t3;
  327. }
  328. case "spatialreference": {
  329. let t3 = e8.spatialReference._arcadeCacheId;
  330. if (t3 === void 0) {
  331. let n3 = true;
  332. Object.freeze && Object.isFrozen(e8.spatialReference) && (n3 = false), n3 && (ye++, e8.spatialReference._arcadeCacheId = ye, t3 = ye);
  333. }
  334. const r8 = new d({ wkt: e8.spatialReference.wkt, wkid: e8.spatialReference.wkid });
  335. return t3 !== void 0 && (r8._arcadeCacheId = "SPREF" + t3.toString()), r8;
  336. }
  337. }
  338. switch (e8.type) {
  339. case "extent":
  340. switch (t2) {
  341. case "xmin":
  342. case "xmax":
  343. case "ymin":
  344. case "ymax":
  345. case "zmin":
  346. case "zmax":
  347. case "mmin":
  348. case "mmax": {
  349. const n3 = e8[t2];
  350. return n3 !== void 0 ? n3 : null;
  351. }
  352. case "type":
  353. return "Extent";
  354. }
  355. break;
  356. case "polygon":
  357. switch (t2) {
  358. case "rings":
  359. l3 = e8.cache._arcadeCacheId, l3 === void 0 && (ye++, l3 = ye, e8.cache._arcadeCacheId = l3);
  360. return new h(e8.rings, e8.spatialReference, e8.hasZ === true, e8.hasM === true, l3);
  361. case "type":
  362. return "Polygon";
  363. }
  364. break;
  365. case "point":
  366. switch (t2) {
  367. case "x":
  368. case "y":
  369. case "z":
  370. case "m":
  371. return e8[t2] !== void 0 ? e8[t2] : null;
  372. case "type":
  373. return "Point";
  374. }
  375. break;
  376. case "polyline":
  377. switch (t2) {
  378. case "paths":
  379. l3 = e8.cache._arcadeCacheId, l3 === void 0 && (ye++, l3 = ye, e8.cache._arcadeCacheId = l3);
  380. return new h(e8.paths, e8.spatialReference, e8.hasZ === true, e8.hasM === true, l3);
  381. case "type":
  382. return "Polyline";
  383. }
  384. break;
  385. case "multipoint":
  386. switch (t2) {
  387. case "points":
  388. l3 = e8.cache._arcadeCacheId, l3 === void 0 && (ye++, l3 = ye, e8.cache._arcadeCacheId = l3);
  389. return new i(e8.points, e8.spatialReference, e8.hasZ === true, e8.hasM === true, l3, 1);
  390. case "type":
  391. return "Multipoint";
  392. }
  393. }
  394. throw new Error(b(r7, "RUNTIME", "PROPERTYNOTFOUND"));
  395. }
  396. function Se(e8, t2) {
  397. try {
  398. let n3;
  399. return n3 = t2.computed === true ? te(e8, t2.property) : "'" + t2.property.name + "'", "lang.member(" + te(e8, t2.object) + "," + n3 + ")";
  400. } catch (n3) {
  401. throw n3;
  402. }
  403. }
  404. function we(e8, t2) {
  405. try {
  406. return "lang.unary(" + te(e8, t2.argument) + ",'" + t2.operator + "')";
  407. } catch (n3) {
  408. throw n3;
  409. }
  410. }
  411. function be(e8, t2) {
  412. try {
  413. const n3 = [];
  414. for (let r7 = 0; r7 < t2.elements.length; r7++)
  415. t2.elements[r7].type === "Literal" ? n3.push(te(e8, t2.elements[r7])) : n3.push("lang.aCheck(" + te(e8, t2.elements[r7]) + ",'ArrayExpression')");
  416. return "[" + n3.join(",") + "]";
  417. } catch (n3) {
  418. throw n3;
  419. }
  420. }
  421. function Ee(e8, t2) {
  422. try {
  423. const n3 = [];
  424. let r7 = 0;
  425. for (const o4 of t2.quasis)
  426. n3.push(o4.value ? JSON.stringify(o4.value.cooked) : JSON.stringify("")), o4.tail === false && (n3.push(t2.expressions[r7] ? "lang.castString(lang.aCheck(" + te(e8, t2.expressions[r7]) + ", 'TemplateLiteral'))" : ""), r7++);
  427. return "([" + n3.join(",") + "]).join('')";
  428. } catch (n3) {
  429. throw n3;
  430. }
  431. }
  432. function ve(e8, t2) {
  433. try {
  434. return "lang.binary(" + te(e8, t2.left) + "," + te(e8, t2.right) + ",'" + t2.operator + "')";
  435. } catch (n3) {
  436. throw n3;
  437. }
  438. }
  439. function Ne2(e8, t2) {
  440. try {
  441. if (t2.left.type === "AssignmentExpression" || t2.left.type === "UpdateExpression")
  442. throw new Error(b(t2.left, "RUNTIME", "CANNOT_USE_ASSIGNMENT_IN_CONDITION"));
  443. if (t2.right.type === "AssignmentExpression" || t2.right.type === "UpdateExpression")
  444. throw new Error(b(t2.right, "RUNTIME", "CANNOT_USE_ASSIGNMENT_IN_CONDITION"));
  445. if (t2.operator === "&&" || t2.operator === "||")
  446. return "(lang.logicalCheck(" + te(e8, t2.left) + ") " + t2.operator + " lang.logicalCheck(" + te(e8, t2.right) + "))";
  447. throw new Error(b(t2, "RUNTIME", "ONLYORORAND"));
  448. } catch (n3) {
  449. throw n3;
  450. }
  451. }
  452. function Me(e8, t2) {
  453. try {
  454. const n3 = t2.name.toLowerCase();
  455. if (e8.localScope !== null) {
  456. if (e8.localScope[n3] !== void 0)
  457. return "lscope['" + n3 + "']";
  458. if (e8.localScope._SymbolsMap[n3] !== void 0)
  459. return "lscope['" + e8.localScope._SymbolsMap[n3] + "']";
  460. }
  461. if (e8.globalScope[n3] !== void 0)
  462. return "gscope['" + n3 + "']";
  463. if (e8.globalScope._SymbolsMap[n3] !== void 0)
  464. return "gscope['" + e8.globalScope._SymbolsMap[n3] + "']";
  465. throw new Error(b(t2, "RUNTIME", "VARIABLENOTFOUND"));
  466. } catch (n3) {
  467. throw n3;
  468. }
  469. }
  470. function Ie(e8, t2) {
  471. try {
  472. if (t2.callee.type !== "Identifier")
  473. throw new Error(b(t2, "RUNTIME", "ONLYNODESSUPPORTED"));
  474. const n3 = t2.callee.name.toLowerCase();
  475. let r7 = "";
  476. if (e8.localScope !== null && (e8.localScope[n3] !== void 0 ? r7 = "lscope['" + n3 + "']" : e8.localScope._SymbolsMap[n3] !== void 0 && (r7 = "lscope['" + e8.localScope._SymbolsMap[n3] + "']")), r7 === "" && (e8.globalScope[n3] !== void 0 ? r7 = "gscope['" + n3 + "']" : e8.globalScope._SymbolsMap[n3] !== void 0 && (r7 = "gscope['" + e8.globalScope._SymbolsMap[n3] + "']")), r7 !== "") {
  477. let n4 = "[";
  478. for (let r8 = 0; r8 < t2.arguments.length; r8++)
  479. r8 > 0 && (n4 += ", "), n4 += te(e8, t2.arguments[r8]);
  480. return n4 += "]", e8.isAsync ? "(yield lang.callfunc(" + r7 + "," + n4 + ",runtimeCtx) )" : "lang.callfunc(" + r7 + "," + n4 + ",runtimeCtx)";
  481. }
  482. throw new Error(b(t2, "RUNTIME", "NOTFOUND"));
  483. } catch (n3) {
  484. throw n3;
  485. }
  486. }
  487. var Oe = {};
  488. function xe(r7) {
  489. return r7 === null ? "" : L(r7) || E(r7) ? "Array" : z(r7) ? "Date" : w(r7) ? "String" : _(r7) ? "Boolean" : O(r7) ? "Number" : r7 instanceof e ? "Attachment" : r7 instanceof s ? "Portal" : r7 instanceof d ? "Dictionary" : Y(r7) ? "Feature" : r7 instanceof j ? "Point" : r7 instanceof v ? "Polygon" : r7 instanceof m3 ? "Polyline" : r7 instanceof m2 ? "Multipoint" : r7 instanceof M ? "Extent" : v2(r7) ? "Function" : J(r7) ? "FeatureSet" : P(r7) ? "FeatureSetCollection" : r7 === j2 ? "" : typeof r7 == "number" && isNaN(r7) ? "Number" : "Unrecognised Type";
  490. }
  491. function Te(e8, t2, n3, r7) {
  492. try {
  493. const o4 = t2[n3];
  494. if (Q(o4, r7))
  495. return t2[n3 + 1];
  496. {
  497. const o5 = t2.length - n3;
  498. return o5 === 1 ? t2[n3] : o5 === 2 ? null : o5 === 3 ? t2[n3 + 2] : Te(e8, t2, n3 + 2, r7);
  499. }
  500. } catch (o4) {
  501. throw o4;
  502. }
  503. }
  504. function _e(e8, t2, n3, r7) {
  505. try {
  506. if (r7 === true)
  507. return t2[n3 + 1];
  508. if (t2.length - n3 === 3)
  509. return t2[n3 + 2];
  510. {
  511. const r8 = t2[n3 + 2];
  512. if (_(r8) === false)
  513. throw new Error("WHEN needs boolean test conditions");
  514. return _e(e8, t2, n3 + 2, r8);
  515. }
  516. } catch (o4) {
  517. throw o4;
  518. }
  519. }
  520. function Ce2(e8, t2) {
  521. const n3 = e8.length, r7 = Math.floor(n3 / 2);
  522. return n3 === 0 ? [] : n3 === 1 ? [e8[0]] : Re(Ce2(e8.slice(0, r7), t2), Ce2(e8.slice(r7, n3), t2), t2);
  523. }
  524. function Re(e8, t2, n3) {
  525. const r7 = [];
  526. for (; e8.length > 0 || t2.length > 0; )
  527. if (e8.length > 0 && t2.length > 0) {
  528. let o4 = n3(e8[0], t2[0]);
  529. isNaN(o4) && (o4 = 0), o4 <= 0 ? (r7.push(e8[0]), e8 = e8.slice(1)) : (r7.push(t2[0]), t2 = t2.slice(1));
  530. } else
  531. e8.length > 0 ? (r7.push(e8[0]), e8 = e8.slice(1)) : t2.length > 0 && (r7.push(t2[0]), t2 = t2.slice(1));
  532. return r7;
  533. }
  534. async function Ae(e8, t2) {
  535. const n3 = e8.length, r7 = Math.floor(n3 / 2);
  536. if (n3 === 0)
  537. return [];
  538. if (n3 === 1)
  539. return [e8[0]];
  540. const o4 = [await Ae(e8.slice(0, r7), t2), await Ae(e8.slice(r7, n3), t2)];
  541. return Ue(o4[0], o4[1], t2, []);
  542. }
  543. async function Ue(e8, t2, n3, r7) {
  544. const o4 = r7;
  545. if (!(e8.length > 0 || t2.length > 0))
  546. return r7;
  547. if (e8.length > 0 && t2.length > 0) {
  548. let a4 = await n3(e8[0], t2[0]);
  549. return isNaN(a4) && (a4 = 1), a4 <= 0 ? (o4.push(e8[0]), e8 = e8.slice(1)) : (o4.push(t2[0]), t2 = t2.slice(1)), Ue(e8, t2, n3, r7);
  550. }
  551. return e8.length > 0 ? (o4.push(e8[0]), Ue(e8 = e8.slice(1), t2, n3, r7)) : t2.length > 0 ? (o4.push(t2[0]), Ue(e8, t2 = t2.slice(1), n3, r7)) : void 0;
  552. }
  553. function Fe(e8) {
  554. return e8.symbols.symbolCounter++, "_T" + e8.symbols.symbolCounter.toString();
  555. }
  556. function Pe(e8) {
  557. return e8.symbols.symbolCounter++, "_Tvar" + e8.symbols.symbolCounter.toString();
  558. }
  559. y(Oe, ee), O2(Oe, ee), N2(Oe, ee), P2(Oe, ee), o(Oe, ee), Oe.typeof = function(e8, t2) {
  560. return ee(e8, t2, function(e9, t3, n3) {
  561. G(n3, 1, 1);
  562. const r7 = xe(n3[0]);
  563. if (r7 === "Unrecognised Type")
  564. throw new Error("Unrecognised Type");
  565. return r7;
  566. });
  567. }, Oe.iif = function(e8, t2) {
  568. try {
  569. return ee(e8, t2, function(e9, t3, n3) {
  570. if (G(n3, 3, 3), _(n3[0]) === false)
  571. throw new Error("IF Function must have a boolean test condition");
  572. return n3[0] ? n3[1] : n3[2];
  573. });
  574. } catch (n3) {
  575. throw n3;
  576. }
  577. }, Oe.decode = function(e8, t2) {
  578. try {
  579. return ee(e8, t2, function(t3, n3, r7) {
  580. if (r7.length < 2)
  581. throw new Error("Missing Parameters");
  582. if (r7.length === 2)
  583. return r7[1];
  584. {
  585. if ((r7.length - 1) % 2 == 0)
  586. throw new Error("Must have a default value result.");
  587. const t4 = r7[0];
  588. return Te(e8, r7, 1, t4);
  589. }
  590. });
  591. } catch (n3) {
  592. throw n3;
  593. }
  594. }, Oe.when = function(e8, t2) {
  595. try {
  596. return ee(e8, t2, function(t3, n3, r7) {
  597. if (r7.length < 3)
  598. throw new Error("Missing Parameters");
  599. if (r7.length % 2 == 0)
  600. throw new Error("Must have a default value result.");
  601. const o4 = r7[0];
  602. if (_(o4) === false)
  603. throw new Error("WHEN needs boolean test conditions");
  604. return _e(e8, r7, 0, o4);
  605. });
  606. } catch (n3) {
  607. throw n3;
  608. }
  609. }, Oe.top = function(e8, t2) {
  610. return ee(e8, t2, function(e9, t3, n3) {
  611. if (G(n3, 2, 2), L(n3[0]))
  612. return ne(n3[1]) >= n3[0].length ? n3[0].slice(0) : n3[0].slice(0, ne(n3[1]));
  613. if (E(n3[0]))
  614. return ne(n3[1]) >= n3[0].length() ? n3[0].slice(0) : n3[0].slice(0, ne(n3[1]));
  615. throw new Error("Top cannot accept this parameter type");
  616. });
  617. }, Oe.first = function(e8, t2) {
  618. return ee(e8, t2, function(e9, t3, n3) {
  619. return G(n3, 1, 1), L(n3[0]) ? n3[0].length === 0 ? null : n3[0][0] : E(n3[0]) ? n3[0].length() === 0 ? null : n3[0].get(0) : null;
  620. });
  621. }, Oe.sort = function(e8, t2) {
  622. return ee(e8, t2, function(t3, n3, r7) {
  623. G(r7, 1, 2);
  624. let o4 = r7[0];
  625. if (E(o4) && (o4 = o4.toArray()), L(o4) === false)
  626. throw new Error("Illegal Argument");
  627. if (r7.length > 1) {
  628. if (v2(r7[1]) === false)
  629. throw new Error("Illegal Argument");
  630. let n4 = o4;
  631. const a4 = function(e9, n5) {
  632. return Xe.callfunc(r7[1], [e9, n5], t3);
  633. };
  634. return e8.isAsync ? Ae(n4, a4) : (n4 = Ce2(n4, function(e9, t4) {
  635. return a4(e9, t4);
  636. }), n4);
  637. }
  638. {
  639. let e9 = o4;
  640. if (e9.length === 0)
  641. return [];
  642. const t4 = {};
  643. for (let o5 = 0; o5 < e9.length; o5++) {
  644. const n5 = xe(e9[o5]);
  645. n5 !== "" && (t4[n5] = true);
  646. }
  647. if (t4.Array === true || t4.Dictionary === true || t4.Feature === true || t4.Point === true || t4.Polygon === true || t4.Polyline === true || t4.Multipoint === true || t4.Extent === true || t4.Function === true)
  648. return e9.slice(0);
  649. let n4 = 0, r8 = "";
  650. for (const o5 in t4)
  651. n4++, r8 = o5;
  652. return e9 = n4 > 1 || r8 === "String" ? Ce2(e9, function(e10, t5) {
  653. if (e10 == null || e10 === j2)
  654. return t5 == null || t5 === j2 ? 0 : 1;
  655. if (t5 == null || t5 === j2)
  656. return -1;
  657. const n5 = X(e10), r9 = X(t5);
  658. return n5 < r9 ? -1 : n5 === r9 ? 0 : 1;
  659. }) : r8 === "Number" ? Ce2(e9, function(e10, t5) {
  660. return e10 - t5;
  661. }) : r8 === "Boolean" ? Ce2(e9, function(e10, t5) {
  662. return e10 === t5 ? 0 : t5 ? -1 : 1;
  663. }) : r8 === "Date" ? Ce2(e9, function(e10, t5) {
  664. return t5 - e10;
  665. }) : e9.slice(0), e9;
  666. }
  667. });
  668. };
  669. var ke = {};
  670. for (const tt in Oe)
  671. ke[tt] = new N(Oe[tt]);
  672. z2(Oe, ee);
  673. for (const tt in Oe)
  674. Oe[tt] = new N(Oe[tt]);
  675. var je = function() {
  676. };
  677. je.prototype = Oe;
  678. var De = function() {
  679. };
  680. function Le(e8, t2, n3) {
  681. const r7 = {};
  682. e8 || (e8 = {}), n3 || (n3 = {}), r7._SymbolsMap = {}, r7.textformatting = 1, r7.infinity = 1, r7.pi = 1;
  683. for (const o4 in t2)
  684. r7[o4] = 1;
  685. for (const o4 in n3)
  686. r7[o4] = 1;
  687. for (const o4 in e8)
  688. r7[o4] = 1;
  689. return r7;
  690. }
  691. function Be(e8, t2, o4) {
  692. const a4 = o4 ? new De() : new je();
  693. e8 || (e8 = {}), t2 || (t2 = {});
  694. const l3 = new d({ newline: "\n", tab: " ", singlequote: "'", doublequote: '"', forwardslash: "/", backwardslash: "\\" });
  695. l3.immutable = false, a4._SymbolsMap = { textformatting: 1, infinity: 1, pi: 1 }, a4.textformatting = l3, a4.infinity = Number.POSITIVE_INFINITY, a4.pi = Math.PI;
  696. for (const n3 in t2)
  697. a4[n3] = t2[n3], a4._SymbolsMap[n3] = 1;
  698. for (const n3 in e8)
  699. a4._SymbolsMap[n3] = 1, e8[n3] && e8[n3].declaredClass === "esri.Graphic" ? a4[n3] = d2.createFromGraphic(e8[n3]) : a4[n3] = e8[n3];
  700. return a4;
  701. }
  702. De.prototype = ke;
  703. function Ve(e8, t2) {
  704. const n3 = { mode: t2, compiled: true, functions: {}, signatures: [], standardFunction: ee, standardFunctionAsync: ee, evaluateIdentifier: We };
  705. for (let r7 = 0; r7 < e8.length; r7++)
  706. e8[r7].registerFunctions(n3);
  707. if (t2 === "sync") {
  708. for (const e9 in n3.functions)
  709. Oe[e9] = new N(n3.functions[e9]), je.prototype[e9] = Oe[e9];
  710. for (let e9 = 0; e9 < n3.signatures.length; e9++)
  711. r(n3.signatures[e9], "sync");
  712. } else {
  713. for (const e9 in n3.functions)
  714. ke[e9] = new N(n3.functions[e9]), De.prototype[e9] = ke[e9];
  715. for (let e9 = 0; e9 < n3.signatures.length; e9++)
  716. r(n3.signatures[e9], "async");
  717. }
  718. }
  719. function We(e8, t2) {
  720. const n3 = t2.name;
  721. if (n3 === "_SymbolsMap")
  722. throw new Error("Illegal");
  723. if (e8.localStack.length > 0) {
  724. if (n3.substr(0, 2).toLowerCase() !== "_t" && e8.localStack[e8.localStack.length - 1][n3] !== void 0)
  725. return e8.localStack[e8.localStack.length - 1][n3];
  726. const t3 = e8.mangleMap[n3];
  727. if (t3 !== void 0 && e8.localStack[e8.localStack.length - 1][t3] !== void 0)
  728. return e8.localStack[e8.localStack.length - 1][t3];
  729. }
  730. if (n3.substr(0, 2).toLowerCase() !== "_t" && e8.globalScope[n3] !== void 0)
  731. return e8.globalScope[n3];
  732. if (e8.globalScope._SymbolsMap[n3] === 1)
  733. return e8.globalScope[n3];
  734. const r7 = e8.mangleMap[n3];
  735. return r7 !== void 0 ? e8.globalScope[r7] : void 0;
  736. }
  737. Ve([m4], "sync"), Ve([m4], "async");
  738. var Ke = 0;
  739. var Xe = { error(e8, t2, n3) {
  740. throw new Error(b(e8, t2, n3));
  741. }, __awaiter: (e8, t2, n3, r7) => new Promise((n4, o4) => {
  742. function a4(e9) {
  743. try {
  744. s4(r7.next(e9));
  745. } catch (t3) {
  746. o4(t3);
  747. }
  748. }
  749. function l3(e9) {
  750. try {
  751. s4(r7.throw(e9));
  752. } catch (t3) {
  753. o4(t3);
  754. }
  755. }
  756. function s4(e9) {
  757. e9.done ? n4(e9.value) : e9.value && e9.value.then ? e9.value.then(a4, l3) : (Ke++, Ke % 100 == 0 ? setTimeout(() => {
  758. Ke = 0, a4(e9.value);
  759. }, 0) : a4(e9.value));
  760. }
  761. s4((r7 = r7.apply(e8, t2 || [])).next());
  762. }), functionDepthchecker: (e8, t2) => function() {
  763. if (t2.depthCounter++, t2.localStack.push([]), t2.depthCounter > 64)
  764. throw new Error("Exceeded maximum function depth");
  765. const n3 = e8.apply(this, arguments);
  766. return k(n3) ? n3.then((e9) => (t2.depthCounter--, t2.localStack.length = t2.localStack.length - 1, e9)) : (t2.depthCounter--, t2.localStack.length = t2.localStack.length - 1, n3);
  767. }, castString: (e8) => X(e8), aCheck(e8, t2) {
  768. if (v2(e8))
  769. throw new Error(b({ type: t2 }, "RUNTIME", "FUNCTIONCONTEXTILLEGAL"));
  770. return e8 === j2 ? null : e8;
  771. }, Dictionary: d, Feature: d2, dictionary(e8) {
  772. const t2 = {};
  773. for (let n3 = 0; n3 < e8.length; n3 += 2) {
  774. if (v2(e8[n3 + 1]))
  775. throw new Error("Illegal Argument");
  776. if (w(e8[n3]) === false)
  777. throw new Error("Illegal Argument");
  778. e8[n3 + 1] === j2 ? t2[e8[n3].toString()] = null : t2[e8[n3].toString()] = e8[n3 + 1];
  779. }
  780. const r7 = new d(t2);
  781. return r7.immutable = false, r7;
  782. }, strCheck(e8) {
  783. if (w(e8) === false)
  784. throw new Error("Illegal Argument");
  785. return e8;
  786. }, unary(e8, t2) {
  787. if (_(e8)) {
  788. if (t2 === "!")
  789. return !e8;
  790. if (t2 === "-")
  791. return -1 * ne(e8);
  792. if (t2 === "+")
  793. return 1 * ne(e8);
  794. if (t2 === "~")
  795. return ~ne(e8);
  796. throw new Error(b({ type: "UnaryExpression", operator: t2, prefix: null, argument: null }, "RUNTIME", "NOTSUPPORTEDUNARYOPERATOR"));
  797. }
  798. if (t2 === "-")
  799. return -1 * ne(e8);
  800. if (t2 === "+")
  801. return 1 * ne(e8);
  802. if (t2 === "~")
  803. return ~ne(e8);
  804. throw new Error(b({ type: "UnaryExpression", operator: t2, prefix: null, argument: null }, "RUNTIME", "NOTSUPPORTEDUNARYOPERATOR"));
  805. }, logicalCheck(e8) {
  806. if (_(e8) === false) {
  807. throw new Error(b({ type: "LogicalExpression", operator: null, left: null, right: null }, "RUNTIME", "ONLYORORAND"));
  808. }
  809. return e8;
  810. }, logical(e8, t2, n3) {
  811. if (_(e8) && _(t2))
  812. switch (n3) {
  813. case "||":
  814. return e8 || t2;
  815. case "&&":
  816. return e8 && t2;
  817. default:
  818. throw new Error(b({ type: "LogicalExpression", operator: null, left: null, right: null }, "RUNTIME", "ONLYORORAND"));
  819. }
  820. throw new Error(b({ type: "LogicalExpression", operator: null, left: null, right: null }, "RUNTIME", "ONLYORORAND"));
  821. }, binary(e8, t2, n3) {
  822. switch (n3) {
  823. case "|":
  824. case "<<":
  825. case ">>":
  826. case ">>>":
  827. case "^":
  828. case "&":
  829. return Ne(ne(e8), ne(t2), n3);
  830. case "==":
  831. case "=":
  832. return Q(e8, t2);
  833. case "!=":
  834. return !Q(e8, t2);
  835. case "<":
  836. case ">":
  837. case "<=":
  838. case ">=":
  839. return W(e8, t2, n3);
  840. case "+":
  841. return w(e8) || w(t2) ? X(e8) + X(t2) : ne(e8) + ne(t2);
  842. case "-":
  843. return ne(e8) - ne(t2);
  844. case "*":
  845. return ne(e8) * ne(t2);
  846. case "/":
  847. return ne(e8) / ne(t2);
  848. case "%":
  849. return ne(e8) % ne(t2);
  850. default:
  851. throw new Error(b({ type: "BinaryExpression", operator: n3, left: e8, right: t2 }, "RUNTIME", "OPERATORNOTRECOGNISED"));
  852. }
  853. }, assign(e8, t2, n3) {
  854. switch (t2) {
  855. case "=":
  856. return e8 === j2 ? null : e8;
  857. case "/=":
  858. return ne(n3) / ne(e8);
  859. case "*=":
  860. return ne(n3) * ne(e8);
  861. case "-=":
  862. return ne(n3) - ne(e8);
  863. case "+=":
  864. return w(n3) || w(e8) ? X(n3) + X(e8) : ne(n3) + ne(e8);
  865. case "%=":
  866. return ne(n3) % ne(e8);
  867. default:
  868. throw new Error(b({ type: "AssignmentExpression", operator: t2, left: null, right: null }, "RUNTIME", "OPERATORNOTRECOGNISED"));
  869. }
  870. }, update(e8, t2, n3, r7) {
  871. const o4 = ne(e8[t2]);
  872. return e8[t2] = n3 === "++" ? o4 + 1 : o4 - 1, r7 === false ? o4 : n3 === "++" ? o4 + 1 : o4 - 1;
  873. }, graphicToFeature: (e8, t2) => e8 === null ? null : d2.createFromGraphicLikeObject(e8.geometry, e8.attributes, t2), memberupdate(e8, t2, r7, o4) {
  874. let a4;
  875. if (L(e8)) {
  876. if (!O(t2))
  877. throw new Error("Invalid Parameter");
  878. if (t2 < 0 && (t2 = e8.length + t2), t2 < 0 || t2 >= e8.length)
  879. throw new Error("Assignment outside of array bounds");
  880. a4 = ne(e8[t2]), e8[t2] = r7 === "++" ? a4 + 1 : a4 - 1;
  881. } else if (e8 instanceof d) {
  882. if (w(t2) === false)
  883. throw new Error("Dictionary accessor must be a string");
  884. if (e8.hasField(t2) !== true)
  885. throw new Error("Invalid Parameter");
  886. a4 = ne(e8.field(t2)), e8.setField(t2, r7 === "++" ? a4 + 1 : a4 - 1);
  887. } else {
  888. if (!Y(e8))
  889. throw E(e8) ? new Error("Array is Immutable") : new Error("Invalid Parameter");
  890. if (w(t2) === false)
  891. throw new Error("Feature accessor must be a string");
  892. if (e8.hasField(t2) !== true)
  893. throw new Error("Invalid Parameter");
  894. a4 = ne(e8.field(t2)), e8.setField(t2, r7 === "++" ? a4 + 1 : a4 - 1);
  895. }
  896. return o4 === false ? a4 : r7 === "++" ? a4 + 1 : a4 - 1;
  897. }, assignmember(e8, t2, r7, o4) {
  898. if (L(e8)) {
  899. if (!O(t2))
  900. throw new Error("Invalid Parameter");
  901. if (t2 < 0 && (t2 = e8.length + t2), t2 < 0 || t2 > e8.length)
  902. throw new Error("Assignment outside of array bounds");
  903. if (t2 === e8.length) {
  904. if (r7 !== "=")
  905. throw new Error("Invalid Parameter");
  906. e8[t2] = this.assign(o4, r7, e8[t2]);
  907. } else
  908. e8[t2] = this.assign(o4, r7, e8[t2]);
  909. } else if (e8 instanceof d) {
  910. if (w(t2) === false)
  911. throw new Error("Dictionary accessor must be a string");
  912. if (e8.hasField(t2) === true)
  913. e8.setField(t2, this.assign(o4, r7, e8.field(t2)));
  914. else {
  915. if (r7 !== "=")
  916. throw new Error("Invalid Parameter");
  917. e8.setField(t2, this.assign(o4, r7, null));
  918. }
  919. } else {
  920. if (!Y(e8))
  921. throw E(e8) ? new Error("Array is Immutable") : new Error("Invalid Parameter");
  922. if (w(t2) === false)
  923. throw new Error("Feature accessor must be a string");
  924. if (e8.hasField(t2) === true)
  925. e8.setField(t2, this.assign(o4, r7, e8.field(t2)));
  926. else {
  927. if (r7 !== "=")
  928. throw new Error("Invalid Parameter");
  929. e8.setField(t2, this.assign(o4, r7, null));
  930. }
  931. }
  932. }, member(e8, t2) {
  933. if (e8 === null) {
  934. throw new Error(b({ type: "MemberExpression", object: null, property: null, computed: null }, "RUNTIME", "NOTFOUND"));
  935. }
  936. if (e8 instanceof d || Y(e8)) {
  937. if (w(t2))
  938. return e8.field(t2);
  939. throw new Error(b({ type: "MemberExpression", object: null, property: null, computed: null }, "RUNTIME", "INVALIDTYPE"));
  940. }
  941. if (e8 instanceof p) {
  942. if (w(t2))
  943. return de(e8, t2, "MemberExpression");
  944. throw new Error(b({ type: "MemberExpression", object: null, property: null, computed: null }, "RUNTIME", "INVALIDTYPE"));
  945. }
  946. if (L(e8)) {
  947. if (O(t2) && isFinite(t2) && Math.floor(t2) === t2) {
  948. if (t2 < 0 && (t2 = e8.length + t2), t2 >= e8.length || t2 < 0) {
  949. throw new Error(b({ type: "MemberExpression", object: null, property: null, computed: null }, "RUNTIME", "OUTOFBOUNDS"));
  950. }
  951. return e8[t2];
  952. }
  953. throw new Error(b({ type: "MemberExpression", object: null, property: null, computed: null }, "RUNTIME", "INVALIDTYPE"));
  954. }
  955. if (w(e8)) {
  956. if (O(t2) && isFinite(t2) && Math.floor(t2) === t2) {
  957. if (t2 < 0 && (t2 = e8.length + t2), t2 >= e8.length || t2 < 0) {
  958. throw new Error(b({ type: "MemberExpression", object: null, property: null, computed: null }, "RUNTIME", "OUTOFBOUNDS"));
  959. }
  960. return e8[t2];
  961. }
  962. throw new Error(b({ type: "MemberExpression", object: null, property: null, computed: null }, "RUNTIME", "INVALIDTYPE"));
  963. }
  964. if (E(e8)) {
  965. if (O(t2) && isFinite(t2) && Math.floor(t2) === t2) {
  966. if (t2 < 0 && (t2 = e8.length() + t2), t2 >= e8.length() || t2 < 0) {
  967. throw new Error(b({ type: "MemberExpression", object: null, property: null, computed: null }, "RUNTIME", "OUTOFBOUNDS"));
  968. }
  969. return e8.get(t2);
  970. }
  971. throw new Error(b({ type: "MemberExpression", object: null, property: null, computed: null }, "RUNTIME", "INVALIDTYPE"));
  972. }
  973. throw new Error(b({ type: "MemberExpression", object: null, property: null, computed: null }, "RUNTIME", "INVALIDTYPE"));
  974. }, callfunc(e8, t2, n3) {
  975. return e8 instanceof N ? e8.fn(n3, { arguments: t2, preparsed: true }) : e8 instanceof M2 ? e8.fn.apply(this, t2) : e8.apply(this, t2);
  976. } };
  977. function Qe(e8) {
  978. console.log(e8);
  979. }
  980. function $e(e8, t2 = null, n3 = false) {
  981. t2 === null && (t2 = { vars: {}, customfunctions: {} });
  982. const r7 = { isAsync: n3, globalScope: Le(t2.vars, n3 ? ke : Oe, t2.customfunctions), localScope: null, mangleMap: {}, console: Qe, lrucache: t2.lrucache, interceptor: t2.interceptor, services: t2.services, symbols: { symbolCounter: 0 } };
  983. let o4 = te(r7, e8.body[0].body);
  984. o4 === "" && (o4 = "lc.voidOperation; ");
  985. let a4 = "";
  986. a4 = n3 ? "var runtimeCtx=this.prepare(context, true);\n var lc = this.lc; var lang = this.lang; var gscope=runtimeCtx.globalScope; \nreturn lang.__awaiter(this, void 0, void 0, function* () {\n\n function mainBody() {\n var lastStatement=lc.voidOperation;\n return lang.__awaiter(this, void 0, void 0, function* () {\n" + o4 + "\n return lastStatement; }); } \n return this.postProcess(yield mainBody()); }); " : "var runtimeCtx=this.prepare(context, false);\n var lc = this.lc; var lang = this.lang; var gscope=runtimeCtx.globalScope; \n function mainBody() {\n var lastStatement=lc.voidOperation;\n " + o4 + "\n return lastStatement; } \n return this.postProcess(mainBody()); ";
  987. const l3 = { lc: Ce, lang: Xe, mangles: r7.mangleMap, postProcess(e9) {
  988. if (e9 instanceof D && (e9 = e9.value), e9 instanceof k3 && (e9 = e9.value), e9 === j2 && (e9 = null), e9 === A)
  989. throw new Error("Cannot return BREAK");
  990. if (e9 === R)
  991. throw new Error("Cannot return CONTINUE");
  992. if (v2(e9))
  993. throw new Error("Cannot return FUNCTION");
  994. return e9;
  995. }, prepare(e9, t3) {
  996. let n4 = e9.spatialReference;
  997. n4 == null && (n4 = new k2({ wkid: 102100 }));
  998. const r8 = Be(e9.vars, e9.customfunctions, t3);
  999. return { localStack: [], isAsync: t3, mangleMap: this.mangles, spatialReference: n4, globalScope: r8, abortSignal: e9.abortSignal === void 0 || e9.abortSignal === null ? { aborted: false } : e9.abortSignal, localScope: null, services: e9.services, console: e9.console ? e9.console : Qe, lrucache: e9.lrucache, interceptor: e9.interceptor, symbols: { symbolCounter: 0 }, depthCounter: 1 };
  1000. } };
  1001. return new Function("context", "spatialReference", a4).bind(l3);
  1002. }
  1003. async function et() {
  1004. return Ve([await import("./geomasync-ZNTEL7VX.js")], "async"), true;
  1005. }
  1006. // node_modules/@arcgis/core/arcade/arcadeRuntime.js
  1007. function Q2(e8, r7) {
  1008. const t2 = [];
  1009. for (let n3 = 0; n3 < r7.arguments.length; n3++)
  1010. t2.push(ee2(e8, r7.arguments[n3]));
  1011. return t2;
  1012. }
  1013. function $(e8, r7, t2) {
  1014. try {
  1015. return r7.preparsed === true ? t2(e8, null, r7.arguments) : t2(e8, r7, Q2(e8, r7));
  1016. } catch (n3) {
  1017. throw n3;
  1018. }
  1019. }
  1020. function ee2(e8, r7) {
  1021. try {
  1022. switch (r7.type) {
  1023. case "EmptyStatement":
  1024. return j2;
  1025. case "VariableDeclarator":
  1026. return me2(e8, r7);
  1027. case "VariableDeclaration":
  1028. return we2(e8, r7);
  1029. case "BlockStatement":
  1030. return fe2(e8, r7);
  1031. case "FunctionDeclaration":
  1032. return he2(e8, r7);
  1033. case "ReturnStatement":
  1034. return pe2(e8, r7);
  1035. case "IfStatement":
  1036. return ue2(e8, r7);
  1037. case "ExpressionStatement":
  1038. return ce2(e8, r7);
  1039. case "AssignmentExpression":
  1040. return le2(e8, r7);
  1041. case "UpdateExpression":
  1042. return ie2(e8, r7);
  1043. case "BreakStatement":
  1044. return A;
  1045. case "ContinueStatement":
  1046. return R;
  1047. case "TemplateElement":
  1048. return Te2(e8, r7);
  1049. case "TemplateLiteral":
  1050. return Re2(e8, r7);
  1051. case "ForStatement":
  1052. return oe2(e8, r7);
  1053. case "ForInStatement":
  1054. return ne3(e8, r7);
  1055. case "Identifier":
  1056. return Oe2(e8, r7);
  1057. case "MemberExpression":
  1058. return ge2(e8, r7);
  1059. case "Literal":
  1060. return r7.value;
  1061. case "CallExpression":
  1062. return Se2(e8, r7);
  1063. case "UnaryExpression":
  1064. return Ne3(e8, r7);
  1065. case "BinaryExpression":
  1066. return Ie2(e8, r7);
  1067. case "LogicalExpression":
  1068. return ve2(e8, r7);
  1069. case "ArrayExpression":
  1070. return ye2(e8, r7);
  1071. case "ObjectExpression":
  1072. return re2(e8, r7);
  1073. case "Property":
  1074. return te2(e8, r7);
  1075. default:
  1076. throw new Error(b(r7, "RUNTIME", "UNREOGNISED"));
  1077. }
  1078. } catch (t2) {
  1079. throw t2;
  1080. }
  1081. }
  1082. function re2(e8, r7) {
  1083. const n3 = {};
  1084. for (let t2 = 0; t2 < r7.properties.length; t2++) {
  1085. const o5 = ee2(e8, r7.properties[t2]);
  1086. if (v2(o5.value))
  1087. throw new Error("Illegal Argument");
  1088. if (w(o5.key) === false)
  1089. throw new Error("Illegal Argument");
  1090. o5.value === j2 ? n3[o5.key.toString()] = null : n3[o5.key.toString()] = o5.value;
  1091. }
  1092. const o4 = new d(n3);
  1093. return o4.immutable = false, o4;
  1094. }
  1095. function te2(e8, r7) {
  1096. return { key: r7.key.type === "Identifier" ? r7.key.name : ee2(e8, r7.key), value: ee2(e8, r7.value) };
  1097. }
  1098. function ne3(e8, r7) {
  1099. const n3 = ee2(e8, r7.right);
  1100. r7.left.type === "VariableDeclaration" && ee2(e8, r7.left);
  1101. let o4 = null, a4 = "";
  1102. if (r7.left.type === "VariableDeclaration") {
  1103. const e9 = r7.left.declarations[0].id;
  1104. e9.type === "Identifier" && (a4 = e9.name);
  1105. } else
  1106. r7.left.type === "Identifier" && (a4 = r7.left.name);
  1107. if (!a4)
  1108. throw new Error(b(r7, "RUNTIME", "INVALIDVARIABLE"));
  1109. if (a4 = a4.toLowerCase(), e8.localScope !== null && e8.localScope[a4] !== void 0 && (o4 = e8.localScope[a4]), o4 === null && e8.globalScope[a4] !== void 0 && (o4 = e8.globalScope[a4]), o4 === null)
  1110. throw new Error(b(r7, "RUNTIME", "VARIABLENOTDECLARED"));
  1111. if (L(n3) || w(n3)) {
  1112. const t2 = n3.length;
  1113. for (let n4 = 0; n4 < t2; n4++) {
  1114. o4.value = n4;
  1115. const t3 = ee2(e8, r7.body);
  1116. if (t3 === A)
  1117. break;
  1118. if (t3 instanceof D)
  1119. return t3;
  1120. }
  1121. return j2;
  1122. }
  1123. if (E(n3)) {
  1124. for (let t2 = 0; t2 < n3.length(); t2++) {
  1125. o4.value = t2;
  1126. const n4 = ee2(e8, r7.body);
  1127. if (n4 === A)
  1128. break;
  1129. if (n4 instanceof D)
  1130. return n4;
  1131. }
  1132. return j2;
  1133. }
  1134. if (!(n3 instanceof d || Y(n3)))
  1135. return j2;
  1136. {
  1137. const t2 = n3.keys();
  1138. for (let n4 = 0; n4 < t2.length; n4++) {
  1139. o4.value = t2[n4];
  1140. const a5 = ee2(e8, r7.body);
  1141. if (a5 === A)
  1142. break;
  1143. if (a5 instanceof D)
  1144. return a5;
  1145. }
  1146. }
  1147. }
  1148. function oe2(e8, r7) {
  1149. r7.init !== null && ee2(e8, r7.init);
  1150. const t2 = { testResult: true, lastAction: j2 };
  1151. do {
  1152. ae2(e8, r7, t2);
  1153. } while (t2.testResult === true);
  1154. return t2.lastAction instanceof D ? t2.lastAction : j2;
  1155. }
  1156. function ae2(e8, r7, t2) {
  1157. if (r7.test !== null) {
  1158. if (t2.testResult = ee2(e8, r7.test), t2.testResult === false)
  1159. return;
  1160. if (t2.testResult !== true)
  1161. throw new Error(b(r7, "RUNTIME", "CANNOT_USE_NONBOOLEAN_IN_CONDITION"));
  1162. }
  1163. t2.lastAction = ee2(e8, r7.body), t2.lastAction !== A ? t2.lastAction instanceof D ? t2.testResult = false : r7.update !== null && ee2(e8, r7.update) : t2.testResult = false;
  1164. }
  1165. function ie2(e8, r7) {
  1166. let n3, o4 = null, a4 = "";
  1167. if (r7.argument.type === "MemberExpression") {
  1168. if (o4 = ee2(e8, r7.argument.object), r7.argument.computed === true ? a4 = ee2(e8, r7.argument.property) : r7.argument.property.type === "Identifier" && (a4 = r7.argument.property.name), L(o4)) {
  1169. if (!O(a4))
  1170. throw new Error("Invalid Parameter");
  1171. if (a4 < 0 && (a4 = o4.length + a4), a4 < 0 || a4 >= o4.length)
  1172. throw new Error("Assignment outside of array bounds");
  1173. n3 = ne(o4[a4]), o4[a4] = r7.operator === "++" ? n3 + 1 : n3 - 1;
  1174. } else if (o4 instanceof d) {
  1175. if (w(a4) === false)
  1176. throw new Error("Dictionary accessor must be a string");
  1177. if (o4.hasField(a4) !== true)
  1178. throw new Error("Invalid Parameter");
  1179. n3 = ne(o4.field(a4)), o4.setField(a4, r7.operator === "++" ? n3 + 1 : n3 - 1);
  1180. } else {
  1181. if (!Y(o4))
  1182. throw E(o4) ? new Error("Array is Immutable") : new Error("Invalid Parameter");
  1183. if (w(a4) === false)
  1184. throw new Error("Feature accessor must be a string");
  1185. if (o4.hasField(a4) !== true)
  1186. throw new Error("Invalid Parameter");
  1187. n3 = ne(o4.field(a4)), o4.setField(a4, r7.operator === "++" ? n3 + 1 : n3 - 1);
  1188. }
  1189. return r7.prefix === false ? n3 : r7.operator === "++" ? n3 + 1 : n3 - 1;
  1190. }
  1191. if (o4 = r7.argument.type === "Identifier" ? r7.argument.name.toLowerCase() : "", !o4)
  1192. throw new Error("Invalid identifier");
  1193. if (e8.localScope !== null && e8.localScope[o4] !== void 0)
  1194. return n3 = ne(e8.localScope[o4].value), e8.localScope[o4] = { value: r7.operator === "++" ? n3 + 1 : n3 - 1, valueset: true, node: r7 }, r7.prefix === false ? n3 : r7.operator === "++" ? n3 + 1 : n3 - 1;
  1195. if (e8.globalScope[o4] !== void 0)
  1196. return n3 = ne(e8.globalScope[o4].value), e8.globalScope[o4] = { value: r7.operator === "++" ? n3 + 1 : n3 - 1, valueset: true, node: r7 }, r7.prefix === false ? n3 : r7.operator === "++" ? n3 + 1 : n3 - 1;
  1197. throw new Error("Variable not recognised");
  1198. }
  1199. function se3(e8, r7, t2, n3) {
  1200. switch (r7) {
  1201. case "=":
  1202. return e8 === j2 ? null : e8;
  1203. case "/=":
  1204. return ne(t2) / ne(e8);
  1205. case "*=":
  1206. return ne(t2) * ne(e8);
  1207. case "-=":
  1208. return ne(t2) - ne(e8);
  1209. case "+=":
  1210. return w(t2) || w(e8) ? X(t2) + X(e8) : ne(t2) + ne(e8);
  1211. case "%=":
  1212. return ne(t2) % ne(e8);
  1213. default:
  1214. throw new Error(b(n3, "RUNTIME", "OPERATORNOTRECOGNISED"));
  1215. }
  1216. }
  1217. function le2(e8, r7) {
  1218. const n3 = ee2(e8, r7.right);
  1219. let o4 = null, a4 = "";
  1220. if (r7.left.type === "MemberExpression") {
  1221. if (o4 = ee2(e8, r7.left.object), r7.left.computed === true ? a4 = ee2(e8, r7.left.property) : r7.left.property.type === "Identifier" && (a4 = r7.left.property.name), L(o4)) {
  1222. if (!O(a4))
  1223. throw new Error("Invalid Parameter");
  1224. if (a4 < 0 && (a4 = o4.length + a4), a4 < 0 || a4 > o4.length)
  1225. throw new Error("Assignment outside of array bounds");
  1226. if (a4 === o4.length) {
  1227. if (r7.operator !== "=")
  1228. throw new Error("Invalid Parameter");
  1229. o4[a4] = se3(n3, r7.operator, o4[a4], r7);
  1230. } else
  1231. o4[a4] = se3(n3, r7.operator, o4[a4], r7);
  1232. } else if (o4 instanceof d) {
  1233. if (w(a4) === false)
  1234. throw new Error("Dictionary accessor must be a string");
  1235. if (o4.hasField(a4) === true)
  1236. o4.setField(a4, se3(n3, r7.operator, o4.field(a4), r7));
  1237. else {
  1238. if (r7.operator !== "=")
  1239. throw new Error("Invalid Parameter");
  1240. o4.setField(a4, se3(n3, r7.operator, null, r7));
  1241. }
  1242. } else {
  1243. if (!Y(o4))
  1244. throw E(o4) ? new Error("Array is Immutable") : new Error("Invalid Parameter");
  1245. if (w(a4) === false)
  1246. throw new Error("Feature accessor must be a string");
  1247. if (o4.hasField(a4) === true)
  1248. o4.setField(a4, se3(n3, r7.operator, o4.field(a4), r7));
  1249. else {
  1250. if (r7.operator !== "=")
  1251. throw new Error("Invalid Parameter");
  1252. o4.setField(a4, se3(n3, r7.operator, null, r7));
  1253. }
  1254. }
  1255. return j2;
  1256. }
  1257. if (o4 = r7.left.name.toLowerCase(), e8.localScope !== null && e8.localScope[o4] !== void 0)
  1258. return e8.localScope[o4] = { value: se3(n3, r7.operator, e8.localScope[o4].value, r7), valueset: true, node: r7.right }, j2;
  1259. if (e8.globalScope[o4] !== void 0)
  1260. return e8.globalScope[o4] = { value: se3(n3, r7.operator, e8.globalScope[o4].value, r7), valueset: true, node: r7.right }, j2;
  1261. throw new Error("Variable not recognised");
  1262. }
  1263. function ce2(e8, r7) {
  1264. if (r7.expression.type === "AssignmentExpression" || r7.expression.type === "UpdateExpression")
  1265. return ee2(e8, r7.expression);
  1266. if (r7.expression.type === "CallExpression") {
  1267. const t2 = ee2(e8, r7.expression);
  1268. return t2 === j2 ? j2 : new k3(t2);
  1269. }
  1270. {
  1271. const t2 = ee2(e8, r7.expression);
  1272. return t2 === j2 ? j2 : new k3(t2);
  1273. }
  1274. }
  1275. function ue2(e8, r7) {
  1276. if (r7.test.type === "AssignmentExpression" || r7.test.type === "UpdateExpression")
  1277. throw new Error(b(r7.test, "RUNTIME", "CANNOT_USE_ASSIGNMENT_IN_CONDITION"));
  1278. const t2 = ee2(e8, r7.test);
  1279. if (t2 === true)
  1280. return ee2(e8, r7.consequent);
  1281. if (t2 === false)
  1282. return r7.alternate !== null ? ee2(e8, r7.alternate) : j2;
  1283. throw new Error(b(r7, "RUNTIME", "CANNOT_USE_NONBOOLEAN_IN_CONDITION"));
  1284. }
  1285. function fe2(e8, r7) {
  1286. let t2 = j2;
  1287. for (let n3 = 0; n3 < r7.body.length; n3++)
  1288. if (t2 = ee2(e8, r7.body[n3]), t2 instanceof D || t2 === A || t2 === R)
  1289. return t2;
  1290. return t2;
  1291. }
  1292. function pe2(e8, r7) {
  1293. if (r7.argument === null)
  1294. return new D(j2);
  1295. const t2 = ee2(e8, r7.argument);
  1296. return new D(t2);
  1297. }
  1298. function he2(e8, r7) {
  1299. const t2 = r7.id.name.toLowerCase();
  1300. return e8.globalScope[t2] = { valueset: true, node: null, value: new t(r7, e8) }, j2;
  1301. }
  1302. function we2(e8, r7) {
  1303. for (let t2 = 0; t2 < r7.declarations.length; t2++)
  1304. ee2(e8, r7.declarations[t2]);
  1305. return j2;
  1306. }
  1307. function me2(e8, r7) {
  1308. let t2 = r7.init === null ? null : ee2(e8, r7.init);
  1309. if (t2 === j2 && (t2 = null), r7.id.type !== "Identifier")
  1310. throw new Error("Can only assign a regular variable");
  1311. const n3 = r7.id.name.toLowerCase();
  1312. return e8.localScope !== null ? e8.localScope[n3] = { value: t2, valueset: true, node: r7.init } : e8.globalScope[n3] = { value: t2, valueset: true, node: r7.init }, j2;
  1313. }
  1314. var Ee2 = 0;
  1315. function de2(e8, r7, n3) {
  1316. let o4;
  1317. switch (r7 = r7.toLowerCase()) {
  1318. case "hasz": {
  1319. const r8 = e8.hasZ;
  1320. return r8 !== void 0 && r8;
  1321. }
  1322. case "hasm": {
  1323. const r8 = e8.hasM;
  1324. return r8 !== void 0 && r8;
  1325. }
  1326. case "spatialreference": {
  1327. let r8 = e8.spatialReference._arcadeCacheId;
  1328. if (r8 === void 0) {
  1329. let t2 = true;
  1330. Object.freeze && Object.isFrozen(e8.spatialReference) && (t2 = false), t2 && (Ee2++, e8.spatialReference._arcadeCacheId = Ee2, r8 = Ee2);
  1331. }
  1332. const n4 = new d({ wkt: e8.spatialReference.wkt, wkid: e8.spatialReference.wkid });
  1333. return r8 !== void 0 && (n4._arcadeCacheId = "SPREF" + r8.toString()), n4;
  1334. }
  1335. }
  1336. switch (e8.type) {
  1337. case "extent":
  1338. switch (r7) {
  1339. case "xmin":
  1340. case "xmax":
  1341. case "ymin":
  1342. case "ymax":
  1343. case "zmin":
  1344. case "zmax":
  1345. case "mmin":
  1346. case "mmax": {
  1347. const t2 = e8[r7];
  1348. return t2 !== void 0 ? t2 : null;
  1349. }
  1350. case "type":
  1351. return "Extent";
  1352. }
  1353. break;
  1354. case "polygon":
  1355. switch (r7) {
  1356. case "rings":
  1357. o4 = e8.cache._arcadeCacheId, o4 === void 0 && (Ee2++, o4 = Ee2, e8.cache._arcadeCacheId = o4);
  1358. return new h(e8.rings, e8.spatialReference, e8.hasZ === true, e8.hasM === true, o4);
  1359. case "type":
  1360. return "Polygon";
  1361. }
  1362. break;
  1363. case "point":
  1364. switch (r7) {
  1365. case "x":
  1366. case "y":
  1367. case "z":
  1368. case "m":
  1369. return e8[r7] !== void 0 ? e8[r7] : null;
  1370. case "type":
  1371. return "Point";
  1372. }
  1373. break;
  1374. case "polyline":
  1375. switch (r7) {
  1376. case "paths":
  1377. o4 = e8.cache._arcadeCacheId, o4 === void 0 && (Ee2++, o4 = Ee2, e8.cache._arcadeCacheId = o4);
  1378. return new h(e8.paths, e8.spatialReference, e8.hasZ === true, e8.hasM === true, o4);
  1379. case "type":
  1380. return "Polyline";
  1381. }
  1382. break;
  1383. case "multipoint":
  1384. switch (r7) {
  1385. case "points":
  1386. o4 = e8.cache._arcadeCacheId, o4 === void 0 && (Ee2++, o4 = Ee2, e8.cache._arcadeCacheId = o4);
  1387. return new i(e8.points, e8.spatialReference, e8.hasZ === true, e8.hasM === true, o4, 1);
  1388. case "type":
  1389. return "Multipoint";
  1390. }
  1391. }
  1392. throw new Error(b(n3, "RUNTIME", "PROPERTYNOTFOUND"));
  1393. }
  1394. function ge2(e8, r7) {
  1395. try {
  1396. const n3 = ee2(e8, r7.object);
  1397. if (n3 === null)
  1398. throw new Error(b(r7, "RUNTIME", "NOTFOUND"));
  1399. if (r7.computed === false) {
  1400. if (r7.property.type === "Identifier") {
  1401. if (n3 instanceof d || Y(n3))
  1402. return n3.field(r7.property.name);
  1403. if (n3 instanceof p)
  1404. return de2(n3, r7.property.name, r7);
  1405. }
  1406. throw new Error(b(r7, "RUNTIME", "INVALIDTYPE"));
  1407. }
  1408. {
  1409. let o4 = ee2(e8, r7.property);
  1410. if (n3 instanceof d || Y(n3)) {
  1411. if (w(o4))
  1412. return n3.field(o4);
  1413. throw new Error(b(r7, "RUNTIME", "INVALIDTYPE"));
  1414. }
  1415. if (n3 instanceof p) {
  1416. if (w(o4))
  1417. return de2(n3, o4, r7);
  1418. throw new Error(b(r7, "RUNTIME", "INVALIDTYPE"));
  1419. }
  1420. if (L(n3)) {
  1421. if (O(o4) && isFinite(o4) && Math.floor(o4) === o4) {
  1422. if (o4 < 0 && (o4 = n3.length + o4), o4 >= n3.length || o4 < 0)
  1423. throw new Error(b(r7, "RUNTIME", "OUTOFBOUNDS"));
  1424. return n3[o4];
  1425. }
  1426. throw new Error(b(r7, "RUNTIME", "INVALIDTYPE"));
  1427. }
  1428. if (w(n3)) {
  1429. if (O(o4) && isFinite(o4) && Math.floor(o4) === o4) {
  1430. if (o4 < 0 && (o4 = n3.length + o4), o4 >= n3.length || o4 < 0)
  1431. throw new Error(b(r7, "RUNTIME", "OUTOFBOUNDS"));
  1432. return n3[o4];
  1433. }
  1434. throw new Error(b(r7, "RUNTIME", "INVALIDTYPE"));
  1435. }
  1436. if (E(n3)) {
  1437. if (O(o4) && isFinite(o4) && Math.floor(o4) === o4) {
  1438. if (o4 < 0 && (o4 = n3.length() + o4), o4 >= n3.length() || o4 < 0)
  1439. throw new Error(b(r7, "RUNTIME", "OUTOFBOUNDS"));
  1440. return n3.get(o4);
  1441. }
  1442. throw new Error(b(r7, "RUNTIME", "INVALIDTYPE"));
  1443. }
  1444. throw new Error(b(r7, "RUNTIME", "INVALIDTYPE"));
  1445. }
  1446. } catch (n3) {
  1447. throw n3;
  1448. }
  1449. }
  1450. function Ne3(e8, r7) {
  1451. try {
  1452. const t2 = ee2(e8, r7.argument);
  1453. if (_(t2)) {
  1454. if (r7.operator === "!")
  1455. return !t2;
  1456. if (r7.operator === "-")
  1457. return -1 * ne(t2);
  1458. if (r7.operator === "+")
  1459. return 1 * ne(t2);
  1460. if (r7.operator === "~")
  1461. return ~ne(t2);
  1462. throw new Error(b(r7, "RUNTIME", "NOTSUPPORTEDUNARYOPERATOR"));
  1463. }
  1464. if (r7.operator === "~")
  1465. return ~ne(t2);
  1466. if (r7.operator === "-")
  1467. return -1 * ne(t2);
  1468. if (r7.operator === "+")
  1469. return 1 * ne(t2);
  1470. throw new Error(b(r7, "RUNTIME", "NOTSUPPORTEDUNARYOPERATOR"));
  1471. } catch (t2) {
  1472. throw t2;
  1473. }
  1474. }
  1475. function ye2(e8, r7) {
  1476. try {
  1477. const t2 = [];
  1478. for (let n3 = 0; n3 < r7.elements.length; n3++) {
  1479. const o4 = ee2(e8, r7.elements[n3]);
  1480. if (v2(o4))
  1481. throw new Error(b(r7, "RUNTIME", "FUNCTIONCONTEXTILLEGAL"));
  1482. o4 === j2 ? t2.push(null) : t2.push(o4);
  1483. }
  1484. return t2;
  1485. } catch (t2) {
  1486. throw t2;
  1487. }
  1488. }
  1489. function Ie2(e8, r7) {
  1490. try {
  1491. const t2 = [ee2(e8, r7.left), ee2(e8, r7.right)], n3 = t2[0], o4 = t2[1];
  1492. switch (r7.operator) {
  1493. case "|":
  1494. case "<<":
  1495. case ">>":
  1496. case ">>>":
  1497. case "^":
  1498. case "&":
  1499. return Ne(ne(n3), ne(o4), r7.operator);
  1500. case "==":
  1501. return Q(n3, o4);
  1502. case "!=":
  1503. return !Q(n3, o4);
  1504. case "<":
  1505. case ">":
  1506. case "<=":
  1507. case ">=":
  1508. return W(n3, o4, r7.operator);
  1509. case "+":
  1510. return w(n3) || w(o4) ? X(n3) + X(o4) : ne(n3) + ne(o4);
  1511. case "-":
  1512. return ne(n3) - ne(o4);
  1513. case "*":
  1514. return ne(n3) * ne(o4);
  1515. case "/":
  1516. return ne(n3) / ne(o4);
  1517. case "%":
  1518. return ne(n3) % ne(o4);
  1519. default:
  1520. throw new Error(b(r7, "RUNTIME", "OPERATORNOTRECOGNISED"));
  1521. }
  1522. } catch (t2) {
  1523. throw t2;
  1524. }
  1525. }
  1526. function ve2(e8, r7) {
  1527. try {
  1528. if (r7.left.type === "AssignmentExpression" || r7.left.type === "UpdateExpression")
  1529. throw new Error(b(r7.left, "RUNTIME", "CANNOT_USE_ASSIGNMENT_IN_CONDITION"));
  1530. if (r7.right.type === "AssignmentExpression" || r7.right.type === "UpdateExpression")
  1531. throw new Error(b(r7.right, "RUNTIME", "CANNOT_USE_ASSIGNMENT_IN_CONDITION"));
  1532. const t2 = ee2(e8, r7.left);
  1533. if (_(t2))
  1534. switch (r7.operator) {
  1535. case "||":
  1536. if (t2 === true)
  1537. return t2;
  1538. {
  1539. const t3 = ee2(e8, r7.right);
  1540. if (_(t3))
  1541. return t3;
  1542. throw new Error(b(r7, "RUNTIME", "ONLYORORAND"));
  1543. }
  1544. case "&&":
  1545. if (t2 === false)
  1546. return t2;
  1547. {
  1548. const t3 = ee2(e8, r7.right);
  1549. if (_(t3))
  1550. return t3;
  1551. throw new Error(b(r7, "RUNTIME", "ONLYORORAND"));
  1552. }
  1553. default:
  1554. throw new Error(b(r7, "RUNTIME", "ONLYORORAND"));
  1555. }
  1556. throw new Error(b(r7, "RUNTIME", "ONLYBOOLEAN"));
  1557. } catch (t2) {
  1558. throw t2;
  1559. }
  1560. }
  1561. function Te2(e8, r7) {
  1562. return r7.value ? r7.value.cooked : "";
  1563. }
  1564. function Re2(e8, r7) {
  1565. let t2 = "", n3 = 0;
  1566. for (const o4 of r7.quasis)
  1567. if (t2 += o4.value ? o4.value.cooked : "", o4.tail === false) {
  1568. t2 += r7.expressions[n3] ? X(ee2(e8, r7.expressions[n3])) : "", n3++;
  1569. }
  1570. return t2;
  1571. }
  1572. function Oe2(e8, r7) {
  1573. let t2;
  1574. try {
  1575. const n3 = r7.name.toLowerCase();
  1576. if (e8.localScope !== null && e8.localScope[n3] !== void 0)
  1577. return t2 = e8.localScope[n3], t2.valueset === true || (t2.value = ee2(e8, t2.node), t2.valueset = true), t2.value;
  1578. if (e8.globalScope[n3] !== void 0)
  1579. return t2 = e8.globalScope[n3], t2.valueset === true || (t2.value = ee2(e8, t2.node), t2.valueset = true), t2.value;
  1580. throw new Error(b(r7, "RUNTIME", "VARIABLENOTFOUND"));
  1581. } catch (n3) {
  1582. throw n3;
  1583. }
  1584. }
  1585. function Se2(e8, r7) {
  1586. try {
  1587. if (r7.callee.type !== "Identifier")
  1588. throw new Error(b(r7, "RUNTIME", "ONLYNODESSUPPORTED"));
  1589. if (e8.localScope !== null && e8.localScope[r7.callee.name.toLowerCase()] !== void 0) {
  1590. const t2 = e8.localScope[r7.callee.name.toLowerCase()];
  1591. if (t2.value instanceof N)
  1592. return t2.value.fn(e8, r7);
  1593. if (t2.value instanceof t)
  1594. return Pe2(e8, r7, t2.value.definition);
  1595. throw new Error(b(r7, "RUNTIME", "NOTAFUNCTION"));
  1596. }
  1597. if (e8.globalScope[r7.callee.name.toLowerCase()] !== void 0) {
  1598. const t2 = e8.globalScope[r7.callee.name.toLowerCase()];
  1599. if (t2.value instanceof N)
  1600. return t2.value.fn(e8, r7);
  1601. if (t2.value instanceof t)
  1602. return Pe2(e8, r7, t2.value.definition);
  1603. throw new Error(b(r7, "RUNTIME", "NOTAFUNCTION"));
  1604. }
  1605. throw new Error(b(r7, "RUNTIME", "NOTFOUND"));
  1606. } catch (t2) {
  1607. throw t2;
  1608. }
  1609. }
  1610. var be2 = {};
  1611. function Ae2(n3) {
  1612. return n3 == null ? "" : L(n3) || E(n3) ? "Array" : z(n3) ? "Date" : w(n3) ? "String" : _(n3) ? "Boolean" : O(n3) ? "Number" : n3 instanceof e ? "Attachment" : n3 instanceof s ? "Portal" : n3 instanceof d ? "Dictionary" : Y(n3) ? "Feature" : n3 instanceof j ? "Point" : n3 instanceof v ? "Polygon" : n3 instanceof m3 ? "Polyline" : n3 instanceof m2 ? "Multipoint" : n3 instanceof M ? "Extent" : v2(n3) ? "Function" : J(n3) ? "FeatureSet" : P(n3) ? "FeatureSetCollection" : n3 === j2 ? "" : typeof n3 == "number" && isNaN(n3) ? "Number" : "Unrecognised Type";
  1613. }
  1614. function Ue2(e8, r7, t2, n3) {
  1615. try {
  1616. const o4 = ee2(e8, r7.arguments[t2]);
  1617. if (Q(o4, n3))
  1618. return ee2(e8, r7.arguments[t2 + 1]);
  1619. {
  1620. const o5 = r7.arguments.length - t2;
  1621. return o5 === 1 ? ee2(e8, r7.arguments[t2]) : o5 === 2 ? null : o5 === 3 ? ee2(e8, r7.arguments[t2 + 2]) : Ue2(e8, r7, t2 + 2, n3);
  1622. }
  1623. } catch (o4) {
  1624. throw o4;
  1625. }
  1626. }
  1627. function Ce3(e8, r7, t2, n3) {
  1628. try {
  1629. if (n3 === true)
  1630. return ee2(e8, r7.arguments[t2 + 1]);
  1631. if (r7.arguments.length - t2 === 3)
  1632. return ee2(e8, r7.arguments[t2 + 2]);
  1633. {
  1634. const n4 = ee2(e8, r7.arguments[t2 + 2]);
  1635. if (_(n4) === false)
  1636. throw new Error("WHEN needs boolean test conditions");
  1637. return Ce3(e8, r7, t2 + 2, n4);
  1638. }
  1639. } catch (o4) {
  1640. throw o4;
  1641. }
  1642. }
  1643. function xe2(e8, r7) {
  1644. const t2 = e8.length, n3 = Math.floor(t2 / 2);
  1645. return t2 === 0 ? [] : t2 === 1 ? [e8[0]] : Me2(xe2(e8.slice(0, n3), r7), xe2(e8.slice(n3, t2), r7), r7);
  1646. }
  1647. function Me2(e8, r7, t2) {
  1648. const n3 = [];
  1649. for (; e8.length > 0 || r7.length > 0; )
  1650. if (e8.length > 0 && r7.length > 0) {
  1651. let o4 = t2(e8[0], r7[0]);
  1652. isNaN(o4) && (o4 = 0), o4 <= 0 ? (n3.push(e8[0]), e8 = e8.slice(1)) : (n3.push(r7[0]), r7 = r7.slice(1));
  1653. } else
  1654. e8.length > 0 ? (n3.push(e8[0]), e8 = e8.slice(1)) : r7.length > 0 && (n3.push(r7[0]), r7 = r7.slice(1));
  1655. return n3;
  1656. }
  1657. function Fe2(e8, r7, t2) {
  1658. try {
  1659. const n3 = e8.body;
  1660. if (t2.length !== e8.params.length)
  1661. throw new Error("Invalid Parameter calls to function.");
  1662. for (let a4 = 0; a4 < t2.length; a4++)
  1663. r7.localScope[e8.params[a4].name.toLowerCase()] = { value: t2[a4], valueset: true, node: null };
  1664. const o4 = ee2(r7, n3);
  1665. if (o4 instanceof D)
  1666. return o4.value;
  1667. if (o4 === A)
  1668. throw new Error("Cannot Break from a Function");
  1669. if (o4 === R)
  1670. throw new Error("Cannot Continue from a Function");
  1671. return o4 instanceof k3 ? o4.value : o4;
  1672. } catch (n3) {
  1673. throw n3;
  1674. }
  1675. }
  1676. function Pe2(e8, r7, t2) {
  1677. return $(e8, r7, function(r8, n3, o4) {
  1678. const a4 = { spatialReference: e8.spatialReference, globalScope: e8.globalScope, depthCounter: e8.depthCounter + 1, console: e8.console, lrucache: e8.lrucache, interceptor: e8.interceptor, localScope: {} };
  1679. if (a4.depthCounter > 64)
  1680. throw new Error("Exceeded maximum function depth");
  1681. return Fe2(t2, a4, o4);
  1682. });
  1683. }
  1684. function De2(e8) {
  1685. const r7 = function() {
  1686. const r8 = { spatialReference: e8.context.spatialReference, console: e8.context.console, lrucache: e8.context.lrucache, interceptor: e8.context.interceptor, localScope: {}, depthCounter: e8.context.depthCounter + 1, globalScope: e8.context.globalScope };
  1687. if (r8.depthCounter > 64)
  1688. throw new Error("Exceeded maximum function depth");
  1689. return Fe2(e8.definition, r8, arguments);
  1690. };
  1691. return r7;
  1692. }
  1693. y(be2, $), O2(be2, $), N2(be2, $), P2(be2, $), o(be2, $), z2(be2, $), be2.typeof = function(e8, r7) {
  1694. return $(e8, r7, function(e9, r8, t2) {
  1695. G(t2, 1, 1);
  1696. const n3 = Ae2(t2[0]);
  1697. if (n3 === "Unrecognised Type")
  1698. throw new Error("Unrecognised Type");
  1699. return n3;
  1700. });
  1701. }, be2.iif = function(e8, r7) {
  1702. try {
  1703. G(r7.arguments === null ? [] : r7.arguments, 3, 3);
  1704. const t2 = ee2(e8, r7.arguments[0]);
  1705. if (_(t2) === false)
  1706. throw new Error("IF Function must have a boolean test condition");
  1707. const n3 = ee2(e8, r7.arguments[1]), o4 = ee2(e8, r7.arguments[2]);
  1708. return t2 === true ? n3 : o4;
  1709. } catch (t2) {
  1710. throw t2;
  1711. }
  1712. }, be2.decode = function(e8, r7) {
  1713. try {
  1714. if (r7.arguments.length < 2)
  1715. throw new Error("Missing Parameters");
  1716. if (r7.arguments.length === 2)
  1717. return ee2(e8, r7.arguments[1]);
  1718. {
  1719. if ((r7.arguments.length - 1) % 2 == 0)
  1720. throw new Error("Must have a default value result.");
  1721. const t2 = ee2(e8, r7.arguments[0]);
  1722. return Ue2(e8, r7, 1, t2);
  1723. }
  1724. } catch (t2) {
  1725. throw t2;
  1726. }
  1727. }, be2.when = function(e8, r7) {
  1728. try {
  1729. if (r7.arguments.length < 3)
  1730. throw new Error("Missing Parameters");
  1731. if (r7.arguments.length % 2 == 0)
  1732. throw new Error("Must have a default value result.");
  1733. const t2 = ee2(e8, r7.arguments[0]);
  1734. if (_(t2) === false)
  1735. throw new Error("WHEN needs boolean test conditions");
  1736. return Ce3(e8, r7, 0, t2);
  1737. } catch (t2) {
  1738. throw t2;
  1739. }
  1740. }, be2.top = function(e8, r7) {
  1741. return $(e8, r7, function(e9, r8, t2) {
  1742. if (G(t2, 2, 2), L(t2[0]))
  1743. return ne(t2[1]) >= t2[0].length ? t2[0].slice(0) : t2[0].slice(0, ne(t2[1]));
  1744. if (E(t2[0]))
  1745. return ne(t2[1]) >= t2[0].length() ? t2[0].slice(0) : t2[0].slice(0, ne(t2[1]));
  1746. throw new Error("Top cannot accept this parameter type");
  1747. });
  1748. }, be2.first = function(e8, r7) {
  1749. return $(e8, r7, function(e9, r8, t2) {
  1750. return G(t2, 1, 1), L(t2[0]) ? t2[0].length === 0 ? null : t2[0][0] : E(t2[0]) ? t2[0].length() === 0 ? null : t2[0].get(0) : null;
  1751. });
  1752. }, be2.sort = function(e8, r7) {
  1753. return $(e8, r7, function(e9, r8, t2) {
  1754. G(t2, 1, 2);
  1755. let n3 = t2[0];
  1756. if (E(n3) && (n3 = n3.toArray()), L(n3) === false)
  1757. throw new Error("Illegal Argument");
  1758. if (t2.length > 1) {
  1759. if (v2(t2[1]) === false)
  1760. throw new Error("Illegal Argument");
  1761. let e10 = n3;
  1762. const r9 = De2(t2[1]);
  1763. return e10 = xe2(e10, function(e11, t3) {
  1764. return r9(e11, t3);
  1765. }), e10;
  1766. }
  1767. {
  1768. let e10 = n3;
  1769. if (e10.length === 0)
  1770. return [];
  1771. const r9 = {};
  1772. for (let n4 = 0; n4 < e10.length; n4++) {
  1773. const t4 = Ae2(e10[n4]);
  1774. t4 !== "" && (r9[t4] = true);
  1775. }
  1776. if (r9.Array === true || r9.Dictionary === true || r9.Feature === true || r9.Point === true || r9.Polygon === true || r9.Polyline === true || r9.Multipoint === true || r9.Extent === true || r9.Function === true)
  1777. return e10.slice(0);
  1778. let t3 = 0, o4 = "";
  1779. for (const n4 in r9)
  1780. t3++, o4 = n4;
  1781. return e10 = t3 > 1 || o4 === "String" ? xe2(e10, function(e11, r10) {
  1782. if (e11 == null || e11 === j2)
  1783. return r10 == null || r10 === j2 ? 0 : 1;
  1784. if (r10 == null || r10 === j2)
  1785. return -1;
  1786. const t4 = X(e11), n4 = X(r10);
  1787. return t4 < n4 ? -1 : t4 === n4 ? 0 : 1;
  1788. }) : o4 === "Number" ? xe2(e10, function(e11, r10) {
  1789. return e11 - r10;
  1790. }) : o4 === "Boolean" ? xe2(e10, function(e11, r10) {
  1791. return e11 === r10 ? 0 : r10 ? -1 : 1;
  1792. }) : o4 === "Date" ? xe2(e10, function(e11, r10) {
  1793. return r10 - e11;
  1794. }) : e10.slice(0), e10;
  1795. }
  1796. });
  1797. };
  1798. for (const We2 in be2)
  1799. be2[We2] = { value: new N(be2[We2]), valueset: true, node: null };
  1800. var Le2 = function() {
  1801. };
  1802. function je2(e8, r7) {
  1803. const o4 = new Le2();
  1804. e8 || (e8 = {}), r7 || (r7 = {});
  1805. const a4 = new d({ newline: "\n", tab: " ", singlequote: "'", doublequote: '"', forwardslash: "/", backwardslash: "\\" });
  1806. a4.immutable = false, o4.textformatting = { value: a4, valueset: true, node: null };
  1807. for (const t2 in r7)
  1808. o4[t2] = { value: new N(r7[t2]), native: true, valueset: true, node: null };
  1809. for (const t2 in e8)
  1810. e8[t2] && e8[t2].declaredClass === "esri.Graphic" ? o4[t2] = { value: d2.createFromGraphic(e8[t2]), valueset: true, node: null } : o4[t2] = { value: e8[t2], valueset: true, node: null };
  1811. return o4;
  1812. }
  1813. Le2.prototype = be2, Le2.prototype.infinity = { value: Number.POSITIVE_INFINITY, valueset: true, node: null }, Le2.prototype.pi = { value: Math.PI, valueset: true, node: null };
  1814. function ke2(e8) {
  1815. console.log(e8);
  1816. }
  1817. function Ve2(e8) {
  1818. const r7 = { mode: "sync", compiled: false, functions: {}, signatures: [], standardFunction: $, evaluateIdentifier: Oe2, arcadeCustomFunctionHandler: De2 };
  1819. for (let t2 = 0; t2 < e8.length; t2++)
  1820. e8[t2].registerFunctions(r7);
  1821. for (const t2 in r7.functions)
  1822. be2[t2] = { value: new N(r7.functions[t2]), valueset: true, node: null }, Le2.prototype[t2] = be2[t2];
  1823. for (let t2 = 0; t2 < r7.signatures.length; t2++)
  1824. r(r7.signatures[t2], "async");
  1825. }
  1826. function Be2(e8, r7) {
  1827. let t2 = r7.spatialReference;
  1828. t2 == null && (t2 = new k2({ wkid: 102100 }));
  1829. let n3 = ee2({ spatialReference: t2, globalScope: je2(r7.vars, r7.customfunctions), localScope: null, console: r7.console ? r7.console : ke2, lrucache: r7.lrucache, interceptor: r7.interceptor, depthCounter: 1 }, e8.body[0].body);
  1830. if (n3 instanceof D && (n3 = n3.value), n3 instanceof k3 && (n3 = n3.value), n3 === j2 && (n3 = null), n3 === A)
  1831. throw new Error("Cannot return BREAK");
  1832. if (n3 === R)
  1833. throw new Error("Cannot return CONTINUE");
  1834. if (n3 instanceof t)
  1835. throw new Error("Cannot return FUNCTION");
  1836. if (n3 instanceof N)
  1837. throw new Error("Cannot return FUNCTION");
  1838. return n3;
  1839. }
  1840. function qe(e8, r7) {
  1841. return p2(e8, r7);
  1842. }
  1843. function Ze(e8, r7) {
  1844. return u(e8, r7);
  1845. }
  1846. Ve2([m4]);
  1847. // node_modules/@arcgis/core/arcade/lib/syntax.js
  1848. var e3 = { AssignmentExpression: "AssignmentExpression", ArrayExpression: "ArrayExpression", BlockStatement: "BlockStatement", BinaryExpression: "BinaryExpression", BreakStatement: "BreakStatement", CallExpression: "CallExpression", ContinueStatement: "ContinueStatement", EmptyStatement: "EmptyStatement", ExpressionStatement: "ExpressionStatement", ForStatement: "ForStatement", ForInStatement: "ForInStatement", FunctionDeclaration: "FunctionDeclaration", FunctionExpression: "FunctionExpression", Identifier: "Identifier", IfStatement: "IfStatement", Literal: "Literal", LogicalExpression: "LogicalExpression", MemberExpression: "MemberExpression", ObjectExpression: "ObjectExpression", Program: "Program", Property: "Property", ReturnStatement: "ReturnStatement", TemplateElement: "TemplateElement", TemplateLiteral: "TemplateLiteral", UnaryExpression: "UnaryExpression", UpdateExpression: "UpdateExpression", VariableDeclaration: "VariableDeclaration", VariableDeclarator: "VariableDeclarator" };
  1849. // node_modules/@arcgis/core/arcade/lib/comment-handler.js
  1850. var e4 = class {
  1851. constructor() {
  1852. this.attach = false, this.comments = [], this.stack = [], this.leading = [], this.trailing = [];
  1853. }
  1854. insertInnerComments(e8, n3) {
  1855. if (e8.type === e3.BlockStatement && e8.body.length === 0) {
  1856. const t2 = [];
  1857. for (let e9 = this.leading.length - 1; e9 >= 0; --e9) {
  1858. const s4 = this.leading[e9];
  1859. n3.end.offset >= s4.start && (t2.unshift(s4.comment), this.leading.splice(e9, 1), this.trailing.splice(e9, 1));
  1860. }
  1861. t2.length && (e8.innerComments = t2);
  1862. }
  1863. }
  1864. findTrailingComments(t2) {
  1865. let e8 = [];
  1866. if (this.trailing.length > 0) {
  1867. for (let n4 = this.trailing.length - 1; n4 >= 0; --n4) {
  1868. const s4 = this.trailing[n4];
  1869. s4.start >= t2.end.offset && e8.unshift(s4.comment);
  1870. }
  1871. return this.trailing.length = 0, e8;
  1872. }
  1873. const n3 = this.stack[this.stack.length - 1];
  1874. if (n3 && n3.node.trailingComments) {
  1875. const s4 = n3.node.trailingComments[0];
  1876. s4 && s4.range[0] >= t2.end.offset && (e8 = n3.node.trailingComments, delete n3.node.trailingComments);
  1877. }
  1878. return e8;
  1879. }
  1880. findLeadingComments(t2) {
  1881. const e8 = [];
  1882. let n3;
  1883. for (; this.stack.length > 0; ) {
  1884. const e9 = this.stack[this.stack.length - 1];
  1885. if (!(e9 && e9.start >= t2.start.offset))
  1886. break;
  1887. n3 = e9.node, this.stack.pop();
  1888. }
  1889. if (n3) {
  1890. for (let s4 = (n3.leadingComments ? n3.leadingComments.length : 0) - 1; s4 >= 0; --s4) {
  1891. const i3 = n3.leadingComments[s4];
  1892. i3.range[1] <= t2.start.offset && (e8.unshift(i3), n3.leadingComments.splice(s4, 1));
  1893. }
  1894. return n3.leadingComments && n3.leadingComments.length === 0 && delete n3.leadingComments, e8;
  1895. }
  1896. for (let s4 = this.leading.length - 1; s4 >= 0; --s4) {
  1897. const n4 = this.leading[s4];
  1898. n4.start <= t2.start.offset && (e8.unshift(n4.comment), this.leading.splice(s4, 1));
  1899. }
  1900. return e8;
  1901. }
  1902. visitNode(e8, n3) {
  1903. if (e8.type === e3.Program && e8.body.length > 0)
  1904. return;
  1905. this.insertInnerComments(e8, n3);
  1906. const s4 = this.findTrailingComments(n3), i3 = this.findLeadingComments(n3);
  1907. i3.length > 0 && (e8.leadingComments = i3), s4.length > 0 && (e8.trailingComments = s4), this.stack.push({ node: e8, start: n3.start.offset });
  1908. }
  1909. visitComment(t2, e8) {
  1910. if (this.comments.push(t2), this.attach) {
  1911. const n3 = { comment: { type: t2.type, value: t2.value, range: [e8.start.offset, e8.end.offset] }, start: e8.start.offset };
  1912. t2.loc && (n3.comment.loc = t2.loc), this.leading.push(n3), this.trailing.push(n3);
  1913. }
  1914. }
  1915. visit(t2, e8) {
  1916. t2.type === "Line" || t2.type === "Block" ? this.visitComment(t2, e8) : this.attach && this.visitNode(t2, e8);
  1917. }
  1918. };
  1919. // node_modules/@arcgis/core/arcade/lib/assert.js
  1920. function r2(r7, o4) {
  1921. if (!r7)
  1922. throw new Error("ASSERT: " + o4);
  1923. }
  1924. // node_modules/@arcgis/core/arcade/lib/error-handler.js
  1925. var r3 = class {
  1926. constructor() {
  1927. this.errors = [], this.tolerant = false;
  1928. }
  1929. recordError(r7) {
  1930. this.errors.push(r7);
  1931. }
  1932. tolerate(r7) {
  1933. if (!this.tolerant)
  1934. throw r7;
  1935. this.recordError(r7);
  1936. }
  1937. constructError(r7, t2) {
  1938. let e8 = new Error(r7);
  1939. try {
  1940. throw e8;
  1941. } catch (o4) {
  1942. Object.create && Object.defineProperty && (e8 = Object.create(o4), Object.defineProperty(e8, "column", { value: t2 }));
  1943. }
  1944. return e8;
  1945. }
  1946. createError(r7, t2, e8, o4) {
  1947. const c2 = "Line " + t2 + ": " + o4, s4 = this.constructError(c2, e8);
  1948. return s4.index = r7, s4.lineNumber = t2, s4.description = o4, s4;
  1949. }
  1950. throwError(r7, t2, e8, o4) {
  1951. throw this.createError(r7, t2, e8, o4);
  1952. }
  1953. tolerateError(r7, t2, e8, o4) {
  1954. const c2 = this.createError(r7, t2, e8, o4);
  1955. if (!this.tolerant)
  1956. throw c2;
  1957. this.recordError(c2);
  1958. }
  1959. };
  1960. // node_modules/@arcgis/core/arcade/lib/messages.js
  1961. var e5 = { ForInOfLoopInitializer: "%0 loop variable declaration may not have an initializer", GeneratorInLegacyContext: "Generator declarations are not allowed in legacy contexts", IllegalBreak: "Illegal break statement", IllegalContinue: "Illegal continue statement", IllegalExportDeclaration: "Unexpected token", IllegalImportDeclaration: "Unexpected token", IllegalReturn: "Illegal return statement", InvalidEscapedReservedWord: "Keyword must not contain escaped characters", InvalidHexEscapeSequence: "Invalid hexadecimal escape sequence", InvalidLHSInAssignment: "Invalid left-hand side in assignment", InvalidLHSInForIn: "Invalid left-hand side in for-in", InvalidRegExp: "Invalid regular expression", Redeclaration: "%0 '%1' has already been declared", StaticPrototype: "Classes may not have static property named prototype", StrictParamDupe: "Strict mode function may not have duplicate parameter names", TemplateOctalLiteral: "Octal literals are not allowed in template strings.", UnexpectedEOS: "Unexpected end of input", UnexpectedIdentifier: "Unexpected identifier", UnexpectedNumber: "Unexpected number", UnexpectedString: "Unexpected string", UnexpectedTemplate: "Unexpected quasi %0", UnexpectedToken: "Unexpected token %0", UnexpectedTokenIllegal: "Unexpected token ILLEGAL", UnterminatedRegExp: "Invalid regular expression: missing /", IdentiferExpected: "Identifier expected" };
  1962. // node_modules/@arcgis/core/arcade/lib/nodes.js
  1963. var s2 = class {
  1964. };
  1965. var e6 = class extends s2 {
  1966. constructor(t2, s4) {
  1967. super(), this.type = t2, this.value = s4;
  1968. }
  1969. };
  1970. var r4 = class extends s2 {
  1971. constructor(s4) {
  1972. super(), this.elements = s4, this.type = e3.ArrayExpression;
  1973. }
  1974. };
  1975. var i2 = ["=", "/=", "*=", "%=", "+=", "-="];
  1976. var n = class extends s2 {
  1977. constructor(s4, e8, r7) {
  1978. super(), this.operator = s4, this.left = e8, this.right = r7, this.type = e3.AssignmentExpression;
  1979. }
  1980. };
  1981. var o2 = ["||", "&&"];
  1982. var h3 = class extends s2 {
  1983. constructor(s4, e8, r7) {
  1984. super(), this.operator = s4, this.left = e8, this.right = r7, this.type = o2.includes(s4) ? e3.LogicalExpression : e3.BinaryExpression;
  1985. }
  1986. };
  1987. var p3 = class extends s2 {
  1988. constructor(s4) {
  1989. super(), this.body = s4, this.type = e3.BlockStatement;
  1990. }
  1991. };
  1992. var a2 = class extends s2 {
  1993. constructor() {
  1994. super(...arguments), this.type = e3.BreakStatement;
  1995. }
  1996. };
  1997. var u2 = class extends s2 {
  1998. constructor(s4, e8) {
  1999. super(), this.callee = s4, this.args = e8, this.type = e3.CallExpression, this.arguments = e8;
  2000. }
  2001. };
  2002. var l = class extends s2 {
  2003. constructor(s4, e8) {
  2004. super(), this.object = s4, this.property = e8, this.type = e3.MemberExpression, this.computed = true;
  2005. }
  2006. };
  2007. var d4 = class extends s2 {
  2008. constructor(s4, e8) {
  2009. super(), this.object = s4, this.property = e8, this.type = e3.MemberExpression, this.computed = false;
  2010. }
  2011. };
  2012. var x = class extends s2 {
  2013. constructor() {
  2014. super(...arguments), this.type = e3.ContinueStatement;
  2015. }
  2016. };
  2017. var y2 = class extends s2 {
  2018. constructor() {
  2019. super(...arguments), this.type = e3.EmptyStatement;
  2020. }
  2021. };
  2022. var m5 = class extends s2 {
  2023. constructor(s4) {
  2024. super(), this.expression = s4, this.type = e3.ExpressionStatement;
  2025. }
  2026. };
  2027. var E3 = class extends s2 {
  2028. constructor(s4, e8, r7) {
  2029. super(), this.left = s4, this.right = e8, this.body = r7, this.type = e3.ForInStatement, this.each = false;
  2030. }
  2031. };
  2032. var b2 = class extends s2 {
  2033. constructor(s4, e8, r7, i3) {
  2034. super(), this.init = s4, this.test = e8, this.update = r7, this.body = i3, this.type = e3.ForStatement;
  2035. }
  2036. };
  2037. var g = class extends s2 {
  2038. constructor(s4, e8, r7) {
  2039. super(), this.id = s4, this.params = e8, this.body = r7, this.type = e3.FunctionDeclaration, this.generator = false, this.expression = false, this.async = false;
  2040. }
  2041. };
  2042. var S2 = class extends s2 {
  2043. constructor(s4) {
  2044. super(), this.name = s4, this.type = e3.Identifier;
  2045. }
  2046. };
  2047. var f2 = class extends s2 {
  2048. constructor(s4, e8, r7) {
  2049. super(), this.test = s4, this.consequent = e8, this.alternate = r7, this.type = e3.IfStatement;
  2050. }
  2051. };
  2052. var k4 = class extends s2 {
  2053. constructor(s4, e8) {
  2054. super(), this.value = s4, this.raw = e8, this.type = e3.Literal;
  2055. }
  2056. };
  2057. var j3 = class extends s2 {
  2058. constructor(s4) {
  2059. super(), this.properties = s4, this.type = e3.ObjectExpression;
  2060. }
  2061. };
  2062. var v3 = class extends s2 {
  2063. constructor(s4, e8, r7, i3, n3, o4) {
  2064. super(), this.kind = s4, this.key = e8, this.computed = r7, this.value = i3, this.method = n3, this.shorthand = o4, this.type = e3.Property;
  2065. }
  2066. };
  2067. var B = class extends s2 {
  2068. constructor(s4) {
  2069. super(), this.argument = s4, this.type = e3.ReturnStatement;
  2070. }
  2071. };
  2072. var D2 = class extends s2 {
  2073. constructor(s4) {
  2074. super(), this.body = s4, this.type = e3.Program;
  2075. }
  2076. };
  2077. var F = class extends s2 {
  2078. constructor(s4, e8) {
  2079. super(), this.value = s4, this.tail = e8, this.type = e3.TemplateElement;
  2080. }
  2081. };
  2082. var I2 = class extends s2 {
  2083. constructor(s4, e8) {
  2084. super(), this.quasis = s4, this.expressions = e8, this.type = e3.TemplateLiteral;
  2085. }
  2086. };
  2087. var q = class extends s2 {
  2088. constructor(s4, e8) {
  2089. super(), this.operator = s4, this.argument = e8, this.type = e3.UnaryExpression, this.prefix = true;
  2090. }
  2091. };
  2092. var C = class extends s2 {
  2093. constructor(s4, e8, r7) {
  2094. super(), this.operator = s4, this.argument = e8, this.prefix = r7, this.type = e3.UpdateExpression;
  2095. }
  2096. };
  2097. var M3 = class extends s2 {
  2098. constructor(s4, e8) {
  2099. super(), this.declarations = s4, this.kind = e8, this.type = e3.VariableDeclaration;
  2100. }
  2101. };
  2102. var P3 = class extends s2 {
  2103. constructor(s4, e8) {
  2104. super(), this.id = s4, this.init = e8, this.type = e3.VariableDeclarator;
  2105. }
  2106. };
  2107. // node_modules/@arcgis/core/arcade/lib/character.js
  2108. var u3 = { NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1878\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD23\uDF00-\uDF1C\uDF27\uDF30-\uDF45\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD44\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC5F\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDEB8\uDF00-\uDF1A]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCDF\uDCFF\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDEE0-\uDEF2]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD4E\uDEC0-\uDEEB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43\uDD4B]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/, NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u07FD\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D3-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u09FE\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CD0-\u1CD2\u1CD4-\u1CFA\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEF\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7C6\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB67\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDD00-\uDD27\uDD30-\uDD39\uDF00-\uDF1C\uDF27\uDF30-\uDF50\uDFE0-\uDFF6]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD44-\uDD46\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDC9-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3B-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC5E\uDC5F\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDC00-\uDC3A\uDCA0-\uDCE9\uDCFF\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDE1\uDDE3\uDDE4\uDE00-\uDE3E\uDE47\uDE50-\uDE99\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF6]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE7F\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD00-\uDD2C\uDD30-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4B\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/ };
  2109. var D3 = { fromCodePoint: (u4) => u4 < 65536 ? String.fromCharCode(u4) : String.fromCharCode(55296 + (u4 - 65536 >> 10)) + String.fromCharCode(56320 + (u4 - 65536 & 1023)), isWhiteSpace: (u4) => u4 === 32 || u4 === 9 || u4 === 11 || u4 === 12 || u4 === 160 || u4 >= 5760 && [5760, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279].includes(u4), isLineTerminator: (u4) => u4 === 10 || u4 === 13 || u4 === 8232 || u4 === 8233, isIdentifierStart: (F3) => F3 === 36 || F3 === 95 || F3 >= 65 && F3 <= 90 || F3 >= 97 && F3 <= 122 || F3 === 92 || F3 >= 128 && u3.NonAsciiIdentifierStart.test(D3.fromCodePoint(F3)), isIdentifierPart: (F3) => F3 === 36 || F3 === 95 || F3 >= 65 && F3 <= 90 || F3 >= 97 && F3 <= 122 || F3 >= 48 && F3 <= 57 || F3 === 92 || F3 >= 128 && u3.NonAsciiIdentifierPart.test(D3.fromCodePoint(F3)), isDecimalDigit: (u4) => u4 >= 48 && u4 <= 57, isHexDigit: (u4) => u4 >= 48 && u4 <= 57 || u4 >= 65 && u4 <= 70 || u4 >= 97 && u4 <= 102, isOctalDigit: (u4) => u4 >= 48 && u4 <= 55 };
  2110. // node_modules/@arcgis/core/arcade/lib/token.js
  2111. var e7;
  2112. !function(e8) {
  2113. e8[e8.BooleanLiteral = 1] = "BooleanLiteral", e8[e8.EOF = 2] = "EOF", e8[e8.Identifier = 3] = "Identifier", e8[e8.Keyword = 4] = "Keyword", e8[e8.NullLiteral = 5] = "NullLiteral", e8[e8.NumericLiteral = 6] = "NumericLiteral", e8[e8.Punctuator = 7] = "Punctuator", e8[e8.StringLiteral = 8] = "StringLiteral", e8[e8.RegularExpression = 9] = "RegularExpression", e8[e8.Template = 10] = "Template";
  2114. }(e7 || (e7 = {}));
  2115. var r5 = {};
  2116. r5[e7.BooleanLiteral] = "Boolean", r5[e7.EOF] = "<end>", r5[e7.Identifier] = "Identifier", r5[e7.Keyword] = "Keyword", r5[e7.NullLiteral] = "Null", r5[e7.NumericLiteral] = "Numeric", r5[e7.Punctuator] = "Punctuator", r5[e7.StringLiteral] = "String", r5[e7.RegularExpression] = "RegularExpression", r5[e7.Template] = "Template";
  2117. // node_modules/@arcgis/core/arcade/lib/scanner.js
  2118. function n2(e8) {
  2119. return "0123456789abcdef".indexOf(e8.toLowerCase());
  2120. }
  2121. function r6(e8) {
  2122. return "01234567".indexOf(e8);
  2123. }
  2124. var h4 = class {
  2125. constructor(e8, t2) {
  2126. this.source = e8, this.errorHandler = t2, this.trackComment = false, this.isModule = false, this.length = e8.length, this.index = 0, this.lineNumber = e8.length > 0 ? 1 : 0, this.lineStart = 0, this.curlyStack = [];
  2127. }
  2128. saveState() {
  2129. return { index: this.index, lineNumber: this.lineNumber, lineStart: this.lineStart, curlyStack: this.curlyStack.slice() };
  2130. }
  2131. restoreState(e8) {
  2132. this.index = e8.index, this.lineNumber = e8.lineNumber, this.lineStart = e8.lineStart, this.curlyStack = e8.curlyStack;
  2133. }
  2134. eof() {
  2135. return this.index >= this.length;
  2136. }
  2137. throwUnexpectedToken(e8 = e5.UnexpectedTokenIllegal) {
  2138. return this.errorHandler.throwError(this.index, this.lineNumber, this.index - this.lineStart + 1, e8);
  2139. }
  2140. _tolerateUnexpectedToken(e8 = e5.UnexpectedTokenIllegal) {
  2141. this.errorHandler.tolerateError(this.index, this.lineNumber, this.index - this.lineStart + 1, e8);
  2142. }
  2143. _skipSingleLineComment(e8) {
  2144. let i3 = [], s4 = 0, n3 = null;
  2145. for (this.trackComment && (i3 = [], s4 = this.index - e8, n3 = { start: { line: this.lineNumber, column: this.index - this.lineStart - e8 }, end: { line: 0, column: 0 } }); !this.eof(); ) {
  2146. const r7 = this.source.charCodeAt(this.index);
  2147. if (++this.index, D3.isLineTerminator(r7)) {
  2148. if (n3) {
  2149. n3.end = { line: this.lineNumber, column: this.index - this.lineStart - 1 };
  2150. const t2 = { multiLine: false, slice: [s4 + e8, this.index - 1], range: [s4, this.index - 1], loc: n3 };
  2151. i3.push(t2);
  2152. }
  2153. return r7 === 13 && this.source.charCodeAt(this.index) === 10 && ++this.index, ++this.lineNumber, this.lineStart = this.index, i3;
  2154. }
  2155. }
  2156. if (n3) {
  2157. n3.end = { line: this.lineNumber, column: this.index - this.lineStart };
  2158. const t2 = { multiLine: false, slice: [s4 + e8, this.index], range: [s4, this.index], loc: n3 };
  2159. i3.push(t2);
  2160. }
  2161. return i3;
  2162. }
  2163. _skipMultiLineComment() {
  2164. const e8 = [];
  2165. let i3 = 0, s4 = null;
  2166. for (this.trackComment && (i3 = this.index - 2, s4 = { start: { line: this.lineNumber, column: this.index - this.lineStart - 2 }, end: { line: 0, column: 0 } }); !this.eof(); ) {
  2167. const n3 = this.source.charCodeAt(this.index);
  2168. if (D3.isLineTerminator(n3))
  2169. n3 === 13 && this.source.charCodeAt(this.index + 1) === 10 && ++this.index, ++this.lineNumber, ++this.index, this.lineStart = this.index;
  2170. else if (n3 === 42) {
  2171. if (this.source.charCodeAt(this.index + 1) === 47) {
  2172. if (this.index += 2, s4) {
  2173. s4.end = { line: this.lineNumber, column: this.index - this.lineStart };
  2174. const t2 = { multiLine: true, slice: [i3 + 2, this.index - 2], range: [i3, this.index], loc: s4 };
  2175. e8.push(t2);
  2176. }
  2177. return e8;
  2178. }
  2179. ++this.index;
  2180. } else
  2181. ++this.index;
  2182. }
  2183. if (s4) {
  2184. s4.end = { line: this.lineNumber, column: this.index - this.lineStart };
  2185. const t2 = { multiLine: true, slice: [i3 + 2, this.index], range: [i3, this.index], loc: s4 };
  2186. e8.push(t2);
  2187. }
  2188. return this._tolerateUnexpectedToken(), e8;
  2189. }
  2190. scanComments() {
  2191. let e8 = null;
  2192. this.trackComment && (e8 = []);
  2193. let i3 = this.index === 0;
  2194. for (; !this.eof(); ) {
  2195. let s4 = this.source.charCodeAt(this.index);
  2196. if (D3.isWhiteSpace(s4))
  2197. ++this.index;
  2198. else if (D3.isLineTerminator(s4))
  2199. ++this.index, s4 === 13 && this.source.charCodeAt(this.index) === 10 && ++this.index, ++this.lineNumber, this.lineStart = this.index, i3 = true;
  2200. else if (s4 === 47)
  2201. if (s4 = this.source.charCodeAt(this.index + 1), s4 === 47) {
  2202. this.index += 2;
  2203. const t2 = this._skipSingleLineComment(2);
  2204. e8 && (e8 = e8.concat(t2)), i3 = true;
  2205. } else {
  2206. if (s4 !== 42)
  2207. break;
  2208. {
  2209. this.index += 2;
  2210. const t2 = this._skipMultiLineComment();
  2211. e8 && (e8 = e8.concat(t2));
  2212. }
  2213. }
  2214. else if (i3 && s4 === 45) {
  2215. if (this.source.charCodeAt(this.index + 1) !== 45 || this.source.charCodeAt(this.index + 2) !== 62)
  2216. break;
  2217. {
  2218. this.index += 3;
  2219. const t2 = this._skipSingleLineComment(3);
  2220. e8 && (e8 = e8.concat(t2));
  2221. }
  2222. } else {
  2223. if (s4 !== 60 || this.isModule)
  2224. break;
  2225. if (this.source.slice(this.index + 1, this.index + 4) !== "!--")
  2226. break;
  2227. {
  2228. this.index += 4;
  2229. const t2 = this._skipSingleLineComment(4);
  2230. e8 && (e8 = e8.concat(t2));
  2231. }
  2232. }
  2233. }
  2234. return e8;
  2235. }
  2236. _isKeyword(e8) {
  2237. switch ((e8 = e8.toLowerCase()).length) {
  2238. case 2:
  2239. return e8 === "if" || e8 === "in";
  2240. case 3:
  2241. return e8 === "var" || e8 === "for";
  2242. case 4:
  2243. return e8 === "else";
  2244. case 5:
  2245. return e8 === "break";
  2246. case 6:
  2247. return e8 === "return";
  2248. case 8:
  2249. return e8 === "function" || e8 === "continue";
  2250. default:
  2251. return false;
  2252. }
  2253. }
  2254. _codePointAt(e8) {
  2255. let t2 = this.source.charCodeAt(e8);
  2256. if (t2 >= 55296 && t2 <= 56319) {
  2257. const i3 = this.source.charCodeAt(e8 + 1);
  2258. if (i3 >= 56320 && i3 <= 57343) {
  2259. t2 = 1024 * (t2 - 55296) + i3 - 56320 + 65536;
  2260. }
  2261. }
  2262. return t2;
  2263. }
  2264. _scanHexEscape(e8) {
  2265. const i3 = e8 === "u" ? 4 : 2;
  2266. let s4 = 0;
  2267. for (let r7 = 0; r7 < i3; ++r7) {
  2268. if (this.eof() || !D3.isHexDigit(this.source.charCodeAt(this.index)))
  2269. return null;
  2270. s4 = 16 * s4 + n2(this.source[this.index++]);
  2271. }
  2272. return String.fromCharCode(s4);
  2273. }
  2274. _scanUnicodeCodePointEscape() {
  2275. let e8 = this.source[this.index], i3 = 0;
  2276. for (e8 === "}" && this.throwUnexpectedToken(); !this.eof() && (e8 = this.source[this.index++], D3.isHexDigit(e8.charCodeAt(0))); )
  2277. i3 = 16 * i3 + n2(e8);
  2278. return (i3 > 1114111 || e8 !== "}") && this.throwUnexpectedToken(), D3.fromCodePoint(i3);
  2279. }
  2280. _getIdentifier() {
  2281. const e8 = this.index++;
  2282. for (; !this.eof(); ) {
  2283. const i3 = this.source.charCodeAt(this.index);
  2284. if (i3 === 92)
  2285. return this.index = e8, this._getComplexIdentifier();
  2286. if (i3 >= 55296 && i3 < 57343)
  2287. return this.index = e8, this._getComplexIdentifier();
  2288. if (!D3.isIdentifierPart(i3))
  2289. break;
  2290. ++this.index;
  2291. }
  2292. return this.source.slice(e8, this.index);
  2293. }
  2294. _getComplexIdentifier() {
  2295. let e8, i3 = this._codePointAt(this.index), s4 = D3.fromCodePoint(i3);
  2296. for (this.index += s4.length, i3 === 92 && (this.source.charCodeAt(this.index) !== 117 && this.throwUnexpectedToken(), ++this.index, this.source[this.index] === "{" ? (++this.index, e8 = this._scanUnicodeCodePointEscape()) : (e8 = this._scanHexEscape("u"), e8 !== null && e8 !== "\\" && D3.isIdentifierStart(e8.charCodeAt(0)) || this.throwUnexpectedToken()), s4 = e8); !this.eof() && (i3 = this._codePointAt(this.index), D3.isIdentifierPart(i3)); )
  2297. e8 = D3.fromCodePoint(i3), s4 += e8, this.index += e8.length, i3 === 92 && (s4 = s4.substr(0, s4.length - 1), this.source.charCodeAt(this.index) !== 117 && this.throwUnexpectedToken(), ++this.index, this.source[this.index] === "{" ? (++this.index, e8 = this._scanUnicodeCodePointEscape()) : (e8 = this._scanHexEscape("u"), e8 !== null && e8 !== "\\" && D3.isIdentifierPart(e8.charCodeAt(0)) || this.throwUnexpectedToken()), s4 += e8);
  2298. return s4;
  2299. }
  2300. _octalToDecimal(e8) {
  2301. let i3 = e8 !== "0", s4 = r6(e8);
  2302. return !this.eof() && D3.isOctalDigit(this.source.charCodeAt(this.index)) && (i3 = true, s4 = 8 * s4 + r6(this.source[this.index++]), "0123".includes(e8) && !this.eof() && D3.isOctalDigit(this.source.charCodeAt(this.index)) && (s4 = 8 * s4 + r6(this.source[this.index++]))), { code: s4, octal: i3 };
  2303. }
  2304. _scanIdentifier() {
  2305. let e8;
  2306. const t2 = this.index, n3 = this.source.charCodeAt(t2) === 92 ? this._getComplexIdentifier() : this._getIdentifier();
  2307. if (e8 = n3.length === 1 ? e7.Identifier : this._isKeyword(n3) ? e7.Keyword : n3.toLowerCase() === "null" ? e7.NullLiteral : n3.toLowerCase() === "true" || n3.toLowerCase() === "false" ? e7.BooleanLiteral : e7.Identifier, e8 !== e7.Identifier && t2 + n3.length !== this.index) {
  2308. const e9 = this.index;
  2309. this.index = t2, this._tolerateUnexpectedToken(e5.InvalidEscapedReservedWord), this.index = e9;
  2310. }
  2311. return { type: e8, value: n3, lineNumber: this.lineNumber, lineStart: this.lineStart, start: t2, end: this.index };
  2312. }
  2313. _scanPunctuator() {
  2314. const e8 = this.index;
  2315. let t2 = this.source[this.index];
  2316. switch (t2) {
  2317. case "(":
  2318. case "{":
  2319. t2 === "{" && this.curlyStack.push("{"), ++this.index;
  2320. break;
  2321. case ".":
  2322. case ")":
  2323. case ";":
  2324. case ",":
  2325. case "[":
  2326. case "]":
  2327. case ":":
  2328. case "?":
  2329. case "~":
  2330. ++this.index;
  2331. break;
  2332. case "}":
  2333. ++this.index, this.curlyStack.pop();
  2334. break;
  2335. default:
  2336. t2 = this.source.substr(this.index, 4), t2 === ">>>=" ? this.index += 4 : (t2 = t2.substr(0, 3), t2 === "===" || t2 === "!==" || t2 === ">>>" || t2 === "<<=" || t2 === ">>=" || t2 === "**=" ? this.index += 3 : (t2 = t2.substr(0, 2), t2 === "&&" || t2 === "||" || t2 === "==" || t2 === "!=" || t2 === "+=" || t2 === "-=" || t2 === "*=" || t2 === "/=" || t2 === "++" || t2 === "--" || t2 === "<<" || t2 === ">>" || t2 === "&=" || t2 === "|=" || t2 === "^=" || t2 === "%=" || t2 === "<=" || t2 === ">=" || t2 === "=>" || t2 === "**" ? this.index += 2 : (t2 = this.source[this.index], "<>=!+-*%&|^/".includes(t2) && ++this.index)));
  2337. }
  2338. return this.index === e8 && this.throwUnexpectedToken(), { type: e7.Punctuator, value: t2, lineNumber: this.lineNumber, lineStart: this.lineStart, start: e8, end: this.index };
  2339. }
  2340. _scanHexLiteral(e8) {
  2341. let i3 = "";
  2342. for (; !this.eof() && D3.isHexDigit(this.source.charCodeAt(this.index)); )
  2343. i3 += this.source[this.index++];
  2344. return i3.length === 0 && this.throwUnexpectedToken(), D3.isIdentifierStart(this.source.charCodeAt(this.index)) && this.throwUnexpectedToken(), { type: e7.NumericLiteral, value: parseInt("0x" + i3, 16), lineNumber: this.lineNumber, lineStart: this.lineStart, start: e8, end: this.index };
  2345. }
  2346. _scanBinaryLiteral(e8) {
  2347. let i3 = "";
  2348. for (; !this.eof(); ) {
  2349. const e9 = this.source[this.index];
  2350. if (e9 !== "0" && e9 !== "1")
  2351. break;
  2352. i3 += this.source[this.index++];
  2353. }
  2354. if (i3.length === 0 && this.throwUnexpectedToken(), !this.eof()) {
  2355. const e9 = this.source.charCodeAt(this.index);
  2356. (D3.isIdentifierStart(e9) || D3.isDecimalDigit(e9)) && this.throwUnexpectedToken();
  2357. }
  2358. return { type: e7.NumericLiteral, value: parseInt(i3, 2), lineNumber: this.lineNumber, lineStart: this.lineStart, start: e8, end: this.index };
  2359. }
  2360. _scanOctalLiteral(e8, i3) {
  2361. let n3 = "", r7 = false;
  2362. for (D3.isOctalDigit(e8.charCodeAt(0)) ? (r7 = true, n3 = "0" + this.source[this.index++]) : ++this.index; !this.eof() && D3.isOctalDigit(this.source.charCodeAt(this.index)); )
  2363. n3 += this.source[this.index++];
  2364. return r7 || n3.length !== 0 || this.throwUnexpectedToken(), (D3.isIdentifierStart(this.source.charCodeAt(this.index)) || D3.isDecimalDigit(this.source.charCodeAt(this.index))) && this.throwUnexpectedToken(), { type: e7.NumericLiteral, value: parseInt(n3, 8), octal: r7, lineNumber: this.lineNumber, lineStart: this.lineStart, start: i3, end: this.index };
  2365. }
  2366. _scanNumericLiteral() {
  2367. const i3 = this.index;
  2368. let n3 = this.source[i3];
  2369. r2(D3.isDecimalDigit(n3.charCodeAt(0)) || n3 === ".", "Numeric literal must start with a decimal digit or a decimal point");
  2370. let r7 = "";
  2371. if (n3 !== ".") {
  2372. if (r7 = this.source[this.index++], n3 = this.source[this.index], r7 === "0") {
  2373. if (n3 === "x" || n3 === "X")
  2374. return ++this.index, this._scanHexLiteral(i3);
  2375. if (n3 === "b" || n3 === "B")
  2376. return ++this.index, this._scanBinaryLiteral(i3);
  2377. if (n3 === "o" || n3 === "O")
  2378. return this._scanOctalLiteral(n3, i3);
  2379. }
  2380. for (; D3.isDecimalDigit(this.source.charCodeAt(this.index)); )
  2381. r7 += this.source[this.index++];
  2382. n3 = this.source[this.index];
  2383. }
  2384. if (n3 === ".") {
  2385. for (r7 += this.source[this.index++]; D3.isDecimalDigit(this.source.charCodeAt(this.index)); )
  2386. r7 += this.source[this.index++];
  2387. n3 = this.source[this.index];
  2388. }
  2389. if (n3 === "e" || n3 === "E")
  2390. if (r7 += this.source[this.index++], n3 = this.source[this.index], n3 !== "+" && n3 !== "-" || (r7 += this.source[this.index++]), D3.isDecimalDigit(this.source.charCodeAt(this.index)))
  2391. for (; D3.isDecimalDigit(this.source.charCodeAt(this.index)); )
  2392. r7 += this.source[this.index++];
  2393. else
  2394. this.throwUnexpectedToken();
  2395. return D3.isIdentifierStart(this.source.charCodeAt(this.index)) && this.throwUnexpectedToken(), { type: e7.NumericLiteral, value: parseFloat(r7), lineNumber: this.lineNumber, lineStart: this.lineStart, start: i3, end: this.index };
  2396. }
  2397. _scanStringLiteral() {
  2398. const n3 = this.index;
  2399. let r7 = this.source[n3];
  2400. r2(r7 === "'" || r7 === '"', "String literal must starts with a quote"), ++this.index;
  2401. let h7 = false, c2 = "";
  2402. for (; !this.eof(); ) {
  2403. let e8 = this.source[this.index++];
  2404. if (e8 === r7) {
  2405. r7 = "";
  2406. break;
  2407. }
  2408. if (e8 === "\\")
  2409. if (e8 = this.source[this.index++], e8 && D3.isLineTerminator(e8.charCodeAt(0)))
  2410. ++this.lineNumber, e8 === "\r" && this.source[this.index] === "\n" && ++this.index, this.lineStart = this.index;
  2411. else
  2412. switch (e8) {
  2413. case "u":
  2414. if (this.source[this.index] === "{")
  2415. ++this.index, c2 += this._scanUnicodeCodePointEscape();
  2416. else {
  2417. const t2 = this._scanHexEscape(e8);
  2418. t2 === null && this.throwUnexpectedToken(), c2 += t2;
  2419. }
  2420. break;
  2421. case "x": {
  2422. const t2 = this._scanHexEscape(e8);
  2423. t2 === null && this.throwUnexpectedToken(e5.InvalidHexEscapeSequence), c2 += t2;
  2424. break;
  2425. }
  2426. case "n":
  2427. c2 += "\n";
  2428. break;
  2429. case "r":
  2430. c2 += "\r";
  2431. break;
  2432. case "t":
  2433. c2 += " ";
  2434. break;
  2435. case "b":
  2436. c2 += "\b";
  2437. break;
  2438. case "f":
  2439. c2 += "\f";
  2440. break;
  2441. case "v":
  2442. c2 += "\v";
  2443. break;
  2444. case "8":
  2445. case "9":
  2446. c2 += e8, this._tolerateUnexpectedToken();
  2447. break;
  2448. default:
  2449. if (e8 && D3.isOctalDigit(e8.charCodeAt(0))) {
  2450. const t2 = this._octalToDecimal(e8);
  2451. h7 = t2.octal || h7, c2 += String.fromCharCode(t2.code);
  2452. } else
  2453. c2 += e8;
  2454. }
  2455. else {
  2456. if (D3.isLineTerminator(e8.charCodeAt(0)))
  2457. break;
  2458. c2 += e8;
  2459. }
  2460. }
  2461. return r7 !== "" && (this.index = n3, this.throwUnexpectedToken()), { type: e7.StringLiteral, value: c2, octal: h7, lineNumber: this.lineNumber, lineStart: this.lineStart, start: n3, end: this.index };
  2462. }
  2463. _scanTemplate() {
  2464. let e8 = "", n3 = false;
  2465. const r7 = this.index, h7 = this.source[r7] === "`";
  2466. let c2 = false, o4 = 2;
  2467. for (++this.index; !this.eof(); ) {
  2468. let s4 = this.source[this.index++];
  2469. if (s4 === "`") {
  2470. o4 = 1, c2 = true, n3 = true;
  2471. break;
  2472. }
  2473. if (s4 === "$") {
  2474. if (this.source[this.index] === "{") {
  2475. this.curlyStack.push("${"), ++this.index, n3 = true;
  2476. break;
  2477. }
  2478. e8 += s4;
  2479. } else if (s4 === "\\")
  2480. if (s4 = this.source[this.index++], D3.isLineTerminator(s4.charCodeAt(0)))
  2481. ++this.lineNumber, s4 === "\r" && this.source[this.index] === "\n" && ++this.index, this.lineStart = this.index;
  2482. else
  2483. switch (s4) {
  2484. case "n":
  2485. e8 += "\n";
  2486. break;
  2487. case "r":
  2488. e8 += "\r";
  2489. break;
  2490. case "t":
  2491. e8 += " ";
  2492. break;
  2493. case "u":
  2494. if (this.source[this.index] === "{")
  2495. ++this.index, e8 += this._scanUnicodeCodePointEscape();
  2496. else {
  2497. const t2 = this.index, i3 = this._scanHexEscape(s4);
  2498. i3 !== null ? e8 += i3 : (this.index = t2, e8 += s4);
  2499. }
  2500. break;
  2501. case "x": {
  2502. const t2 = this._scanHexEscape(s4);
  2503. t2 === null && this.throwUnexpectedToken(e5.InvalidHexEscapeSequence), e8 += t2;
  2504. break;
  2505. }
  2506. case "b":
  2507. e8 += "\b";
  2508. break;
  2509. case "f":
  2510. e8 += "\f";
  2511. break;
  2512. case "v":
  2513. e8 += "\v";
  2514. break;
  2515. default:
  2516. s4 === "0" ? (D3.isDecimalDigit(this.source.charCodeAt(this.index)) && this.throwUnexpectedToken(e5.TemplateOctalLiteral), e8 += "\0") : D3.isOctalDigit(s4.charCodeAt(0)) ? this.throwUnexpectedToken(e5.TemplateOctalLiteral) : e8 += s4;
  2517. }
  2518. else
  2519. D3.isLineTerminator(s4.charCodeAt(0)) ? (++this.lineNumber, s4 === "\r" && this.source[this.index] === "\n" && ++this.index, this.lineStart = this.index, e8 += "\n") : e8 += s4;
  2520. }
  2521. return n3 || this.throwUnexpectedToken(), h7 || this.curlyStack.pop(), { type: e7.Template, value: this.source.slice(r7 + 1, this.index - o4), cooked: e8, head: h7, tail: c2, lineNumber: this.lineNumber, lineStart: this.lineStart, start: r7, end: this.index };
  2522. }
  2523. _testRegExp(e8, t2) {
  2524. const s4 = "\uFFFF";
  2525. let n3 = e8;
  2526. t2.includes("u") && (n3 = n3.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g, (e9, t3, n4) => {
  2527. const r7 = parseInt(t3 || n4, 16);
  2528. return r7 > 1114111 && this.throwUnexpectedToken(e5.InvalidRegExp), r7 <= 65535 ? String.fromCharCode(r7) : s4;
  2529. }).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, s4));
  2530. try {
  2531. RegExp(n3);
  2532. } catch (r7) {
  2533. this.throwUnexpectedToken(e5.InvalidRegExp);
  2534. }
  2535. try {
  2536. return new RegExp(e8, t2);
  2537. } catch (h7) {
  2538. return null;
  2539. }
  2540. }
  2541. _scanRegExpBody() {
  2542. let s4 = this.source[this.index];
  2543. r2(s4 === "/", "Regular expression literal must start with a slash");
  2544. let n3 = this.source[this.index++], r7 = false, h7 = false;
  2545. for (; !this.eof(); )
  2546. if (s4 = this.source[this.index++], n3 += s4, s4 === "\\")
  2547. s4 = this.source[this.index++], D3.isLineTerminator(s4.charCodeAt(0)) && this.throwUnexpectedToken(e5.UnterminatedRegExp), n3 += s4;
  2548. else if (D3.isLineTerminator(s4.charCodeAt(0)))
  2549. this.throwUnexpectedToken(e5.UnterminatedRegExp);
  2550. else if (r7)
  2551. s4 === "]" && (r7 = false);
  2552. else {
  2553. if (s4 === "/") {
  2554. h7 = true;
  2555. break;
  2556. }
  2557. s4 === "[" && (r7 = true);
  2558. }
  2559. return h7 || this.throwUnexpectedToken(e5.UnterminatedRegExp), n3.substr(1, n3.length - 2);
  2560. }
  2561. _scanRegExpFlags() {
  2562. let e8 = "", i3 = "";
  2563. for (; !this.eof(); ) {
  2564. let s4 = this.source[this.index];
  2565. if (!D3.isIdentifierPart(s4.charCodeAt(0)))
  2566. break;
  2567. if (++this.index, s4 !== "\\" || this.eof())
  2568. i3 += s4, e8 += s4;
  2569. else if (s4 = this.source[this.index], s4 === "u") {
  2570. ++this.index;
  2571. let t2 = this.index;
  2572. const s5 = this._scanHexEscape("u");
  2573. if (s5 !== null)
  2574. for (i3 += s5, e8 += "\\u"; t2 < this.index; ++t2)
  2575. e8 += this.source[t2];
  2576. else
  2577. this.index = t2, i3 += "u", e8 += "\\u";
  2578. this._tolerateUnexpectedToken();
  2579. } else
  2580. e8 += "\\", this._tolerateUnexpectedToken();
  2581. }
  2582. return i3;
  2583. }
  2584. scanRegExp() {
  2585. const e8 = this.index, t2 = this._scanRegExpBody(), i3 = this._scanRegExpFlags(), n3 = this._testRegExp(t2, i3);
  2586. return { type: e7.RegularExpression, value: "", pattern: t2, flags: i3, regex: n3, lineNumber: this.lineNumber, lineStart: this.lineStart, start: e8, end: this.index };
  2587. }
  2588. lex() {
  2589. if (this.eof())
  2590. return { type: e7.EOF, value: "", lineNumber: this.lineNumber, lineStart: this.lineStart, start: this.index, end: this.index };
  2591. const e8 = this.source.charCodeAt(this.index);
  2592. return D3.isIdentifierStart(e8) ? this._scanIdentifier() : e8 === 40 || e8 === 41 || e8 === 59 ? this._scanPunctuator() : e8 === 39 || e8 === 34 ? this._scanStringLiteral() : e8 === 46 ? D3.isDecimalDigit(this.source.charCodeAt(this.index + 1)) ? this._scanNumericLiteral() : this._scanPunctuator() : D3.isDecimalDigit(e8) ? this._scanNumericLiteral() : e8 === 96 || e8 === 125 && this.curlyStack[this.curlyStack.length - 1] === "${" ? this._scanTemplate() : e8 >= 55296 && e8 < 57343 && D3.isIdentifierStart(this._codePointAt(this.index)) ? this._scanIdentifier() : this._scanPunctuator();
  2593. }
  2594. };
  2595. // node_modules/@arcgis/core/arcade/lib/parser.js
  2596. var O3 = class {
  2597. constructor(e8, i3 = {}, s4) {
  2598. this.config = { range: typeof i3.range == "boolean" && i3.range, loc: typeof i3.loc == "boolean" && i3.loc, source: null, tokens: typeof i3.tokens == "boolean" && i3.tokens, comment: typeof i3.comment == "boolean" && i3.comment, tolerant: typeof i3.tolerant == "boolean" && i3.tolerant, globalReturn: !!i3.globalReturn }, this.config.loc && i3.source && i3.source !== null && (this.config.source = String(i3.source)), this.delegate = s4, this.errorHandler = new r3(), this.errorHandler.tolerant = this.config.tolerant, this.scanner = new h4(e8, this.errorHandler), this.scanner.trackComment = this.config.comment, this.operatorPrecedence = { ")": 0, ";": 0, ",": 0, "=": 0, "]": 0, "||": 1, "&&": 2, "|": 3, "^": 4, "&": 5, "==": 6, "!=": 6, "===": 6, "!==": 6, "<": 7, ">": 7, "<=": 7, ">=": 7, "<<": 8, ">>": 8, ">>>": 8, "+": 9, "-": 9, "*": 11, "/": 11, "%": 11 }, this.lookahead = { type: e7.EOF, value: "", lineNumber: this.scanner.lineNumber, lineStart: 0, start: 0, end: 0 }, this.hasLineTerminator = false, this.context = { allowIn: true, firstCoverInitializedNameError: null, isAssignmentTarget: false, isBindingElement: false, inFunctionBody: false, inIteration: false, curlyParsing: "asObject" }, this.tokens = [], this.startMarker = { index: 0, line: this.scanner.lineNumber, column: 0 }, this.lastMarker = { index: 0, line: this.scanner.lineNumber, column: 0 }, this.nextToken(), this.lastMarker = { index: this.scanner.index, line: this.scanner.lineNumber, column: this.scanner.index - this.scanner.lineStart };
  2599. }
  2600. tolerateError(t2, ...i3) {
  2601. const s4 = i3.slice(), n3 = t2.replace(/%(\d)/g, (t3, i4) => (r2(i4 < s4.length, "Message reference must be in range"), s4[i4])), r7 = this.lastMarker.index, a4 = this.scanner.lineNumber, o4 = this.lastMarker.column + 1;
  2602. this.errorHandler.tolerateError(r7, a4, o4, n3);
  2603. }
  2604. unexpectedTokenError(e8, t2) {
  2605. let s4, n3 = t2 || e5.UnexpectedToken;
  2606. if (e8 ? (t2 || (n3 = e8.type === e7.EOF ? e5.UnexpectedEOS : e8.type === e7.Identifier ? e5.UnexpectedIdentifier : e8.type === e7.NumericLiteral ? e5.UnexpectedNumber : e8.type === e7.StringLiteral ? e5.UnexpectedString : e8.type === e7.Template ? e5.UnexpectedTemplate : e5.UnexpectedToken), s4 = e8.value.toString()) : s4 = "ILLEGAL", n3 = n3.replace("%0", s4), e8 && typeof e8.lineNumber == "number") {
  2607. const t3 = e8.start, i3 = e8.lineNumber, s5 = this.lastMarker.index - this.lastMarker.column, r8 = e8.start - s5 + 1;
  2608. return this.errorHandler.createError(t3, i3, r8, n3);
  2609. }
  2610. const r7 = this.lastMarker.index, a4 = this.lastMarker.line, o4 = this.lastMarker.column + 1;
  2611. return this.errorHandler.createError(r7, a4, o4, n3);
  2612. }
  2613. throwUnexpectedToken(e8, t2) {
  2614. throw this.unexpectedTokenError(e8, t2);
  2615. }
  2616. tolerateUnexpectedToken(e8, t2) {
  2617. this.errorHandler.tolerate(this.unexpectedTokenError(e8, t2));
  2618. }
  2619. collectComments() {
  2620. if (this.config.comment) {
  2621. const e8 = this.scanner.scanComments();
  2622. if (e8 && e8.length > 0 && this.delegate)
  2623. for (let t2 = 0; t2 < e8.length; ++t2) {
  2624. const i3 = e8[t2], n3 = new e6(i3.multiLine ? "Block" : "Line", this.scanner.source.slice(i3.slice[0], i3.slice[1]));
  2625. this.config.range && (n3.range = i3.range), this.config.loc && (n3.loc = i3.loc);
  2626. const r7 = { start: { line: i3.loc.start.line, column: i3.loc.start.column, offset: i3.range[0] }, end: { line: i3.loc.end.line, column: i3.loc.end.column, offset: i3.range[1] } };
  2627. this.delegate(n3, r7);
  2628. }
  2629. } else
  2630. this.scanner.scanComments();
  2631. }
  2632. peekAhead(e8) {
  2633. const t2 = () => (this.scanner.scanComments(), this.scanner.lex()), i3 = this.scanner.saveState();
  2634. e8.call(this, t2), this.scanner.restoreState(i3);
  2635. }
  2636. getTokenRaw(e8) {
  2637. return this.scanner.source.slice(e8.start, e8.end);
  2638. }
  2639. convertToken(e8) {
  2640. const t2 = { type: r5[e8.type], value: this.getTokenRaw(e8) };
  2641. if (this.config.range && (t2.range = [e8.start, e8.end]), this.config.loc && (t2.loc = { start: { line: this.startMarker.line, column: this.startMarker.column }, end: { line: this.scanner.lineNumber, column: this.scanner.index - this.scanner.lineStart } }), e8.type === e7.RegularExpression) {
  2642. const i3 = e8.pattern, s4 = e8.flags;
  2643. t2.regex = { pattern: i3, flags: s4 };
  2644. }
  2645. return t2;
  2646. }
  2647. nextToken() {
  2648. const e8 = this.lookahead;
  2649. this.lastMarker.index = this.scanner.index, this.lastMarker.line = this.scanner.lineNumber, this.lastMarker.column = this.scanner.index - this.scanner.lineStart, this.collectComments(), this.scanner.index !== this.startMarker.index && (this.startMarker.index = this.scanner.index, this.startMarker.line = this.scanner.lineNumber, this.startMarker.column = this.scanner.index - this.scanner.lineStart);
  2650. const t2 = this.scanner.lex();
  2651. return this.hasLineTerminator = e8.lineNumber !== t2.lineNumber, this.lookahead = t2, this.config.tokens && t2.type !== e7.EOF && this.tokens.push(this.convertToken(t2)), e8;
  2652. }
  2653. createNode() {
  2654. return { index: this.startMarker.index, line: this.startMarker.line, column: this.startMarker.column };
  2655. }
  2656. startNode(e8, t2 = 0) {
  2657. let i3 = e8.start - e8.lineStart, s4 = e8.lineNumber;
  2658. return i3 < 0 && (i3 += t2, s4--), { index: e8.start, line: s4, column: i3 };
  2659. }
  2660. finalize(e8, t2) {
  2661. if (this.config.range && (t2.range = [e8.index, this.lastMarker.index]), this.config.loc && (t2.loc = { start: { line: e8.line, column: e8.column }, end: { line: this.lastMarker.line, column: this.lastMarker.column } }, this.config.source && (t2.loc.source = this.config.source)), this.delegate) {
  2662. const i3 = { start: { line: e8.line, column: e8.column, offset: e8.index }, end: { line: this.lastMarker.line, column: this.lastMarker.column, offset: this.lastMarker.index } };
  2663. this.delegate(t2, i3);
  2664. }
  2665. return t2;
  2666. }
  2667. expect(e8) {
  2668. const t2 = this.nextToken();
  2669. t2.type === e7.Punctuator && t2.value === e8 || this.throwUnexpectedToken(t2);
  2670. }
  2671. expectCommaSeparator() {
  2672. if (this.config.tolerant) {
  2673. const e8 = this.lookahead;
  2674. e8.type === e7.Punctuator && e8.value === "," ? this.nextToken() : e8.type === e7.Punctuator && e8.value === ";" ? (this.nextToken(), this.tolerateUnexpectedToken(e8)) : this.tolerateUnexpectedToken(e8, e5.UnexpectedToken);
  2675. } else
  2676. this.expect(",");
  2677. }
  2678. expectKeyword(e8) {
  2679. const t2 = this.nextToken();
  2680. t2.type === e7.Keyword && t2.value.toString().toLowerCase() === e8.toLowerCase() || this.throwUnexpectedToken(t2);
  2681. }
  2682. match(e8) {
  2683. return this.lookahead.type === e7.Punctuator && this.lookahead.value === e8;
  2684. }
  2685. matchKeyword(e8) {
  2686. return this.lookahead.type === e7.Keyword && this.lookahead.value.toLowerCase() === e8.toLowerCase();
  2687. }
  2688. matchContextualKeyword(e8) {
  2689. return this.lookahead.type === e7.Identifier && this.lookahead.value === e8;
  2690. }
  2691. matchAssign() {
  2692. if (this.lookahead.type !== e7.Punctuator)
  2693. return false;
  2694. const e8 = this.lookahead.value;
  2695. return i2.includes(e8);
  2696. }
  2697. isolateCoverGrammar(e8) {
  2698. const t2 = this.context.isBindingElement, i3 = this.context.isAssignmentTarget, s4 = this.context.firstCoverInitializedNameError;
  2699. this.context.isBindingElement = true, this.context.isAssignmentTarget = true, this.context.firstCoverInitializedNameError = null;
  2700. const n3 = e8.call(this);
  2701. return this.context.firstCoverInitializedNameError !== null && this.throwUnexpectedToken(this.context.firstCoverInitializedNameError), this.context.isBindingElement = t2, this.context.isAssignmentTarget = i3, this.context.firstCoverInitializedNameError = s4, n3;
  2702. }
  2703. inheritCoverGrammar(e8) {
  2704. const t2 = this.context.isBindingElement, i3 = this.context.isAssignmentTarget, s4 = this.context.firstCoverInitializedNameError;
  2705. this.context.isBindingElement = true, this.context.isAssignmentTarget = true, this.context.firstCoverInitializedNameError = null;
  2706. const n3 = e8.call(this);
  2707. return this.context.isBindingElement = this.context.isBindingElement && t2, this.context.isAssignmentTarget = this.context.isAssignmentTarget && i3, this.context.firstCoverInitializedNameError = s4 || this.context.firstCoverInitializedNameError, n3;
  2708. }
  2709. consumeSemicolon() {
  2710. this.match(";") ? this.nextToken() : this.hasLineTerminator || (this.lookahead.type === e7.EOF || this.match("}") || this.throwUnexpectedToken(this.lookahead), this.lastMarker.index = this.startMarker.index, this.lastMarker.line = this.startMarker.line, this.lastMarker.column = this.startMarker.column);
  2711. }
  2712. parsePrimaryExpression() {
  2713. const e8 = this.createNode();
  2714. let t2, i3, s4;
  2715. switch (this.lookahead.type) {
  2716. case e7.Identifier:
  2717. t2 = this.finalize(e8, new S2(this.nextToken().value));
  2718. break;
  2719. case e7.NumericLiteral:
  2720. case e7.StringLiteral:
  2721. this.context.isAssignmentTarget = false, this.context.isBindingElement = false, i3 = this.nextToken(), s4 = this.getTokenRaw(i3), t2 = this.finalize(e8, new k4(i3.value, s4));
  2722. break;
  2723. case e7.BooleanLiteral:
  2724. this.context.isAssignmentTarget = false, this.context.isBindingElement = false, i3 = this.nextToken(), s4 = this.getTokenRaw(i3), t2 = this.finalize(e8, new k4(i3.value.toString().toLowerCase() === "true", s4));
  2725. break;
  2726. case e7.NullLiteral:
  2727. this.context.isAssignmentTarget = false, this.context.isBindingElement = false, i3 = this.nextToken(), s4 = this.getTokenRaw(i3), t2 = this.finalize(e8, new k4(null, s4));
  2728. break;
  2729. case e7.Template:
  2730. t2 = this.parseTemplateLiteral();
  2731. break;
  2732. case e7.Punctuator:
  2733. switch (this.lookahead.value) {
  2734. case "(":
  2735. this.context.isBindingElement = false, t2 = this.inheritCoverGrammar(this.parseGroupExpression);
  2736. break;
  2737. case "[":
  2738. t2 = this.inheritCoverGrammar(this.parseArrayInitializer);
  2739. break;
  2740. case "{":
  2741. t2 = this.inheritCoverGrammar(this.parseObjectInitializer);
  2742. break;
  2743. default:
  2744. t2 = this.throwUnexpectedToken(this.nextToken());
  2745. }
  2746. break;
  2747. case e7.Keyword:
  2748. this.context.isAssignmentTarget = false, this.context.isBindingElement = false, t2 = this.throwUnexpectedToken(this.nextToken());
  2749. break;
  2750. default:
  2751. t2 = this.throwUnexpectedToken(this.nextToken());
  2752. }
  2753. return t2;
  2754. }
  2755. parseArrayInitializer() {
  2756. const e8 = this.createNode(), t2 = [];
  2757. for (this.expect("["); !this.match("]"); )
  2758. this.match(",") ? (this.nextToken(), t2.push(null)) : (t2.push(this.inheritCoverGrammar(this.parseAssignmentExpression)), this.match("]") || this.expect(","));
  2759. return this.expect("]"), this.finalize(e8, new r4(t2));
  2760. }
  2761. parseObjectPropertyKey() {
  2762. const e8 = this.createNode(), t2 = this.nextToken();
  2763. let i3;
  2764. switch (t2.type) {
  2765. case e7.StringLiteral:
  2766. case e7.NumericLiteral:
  2767. i3 = this.finalize(e8, new k4(t2.value, this.getTokenRaw(t2)));
  2768. break;
  2769. case e7.Identifier:
  2770. case e7.BooleanLiteral:
  2771. case e7.NullLiteral:
  2772. case e7.Keyword:
  2773. i3 = this.finalize(e8, new S2(t2.value));
  2774. break;
  2775. default:
  2776. i3 = this.throwUnexpectedToken(t2);
  2777. }
  2778. return i3;
  2779. }
  2780. parseObjectProperty() {
  2781. const e8 = this.createNode(), t2 = this.lookahead;
  2782. let i3 = false;
  2783. const s4 = false;
  2784. let n3 = false, r7 = null;
  2785. if (t2.type === e7.Identifier) {
  2786. const s5 = t2.value;
  2787. this.nextToken(), i3 = this.match("["), r7 = this.finalize(e8, new S2(s5));
  2788. } else
  2789. this.match("*") ? this.nextToken() : (i3 = this.match("["), r7 = this.parseObjectPropertyKey());
  2790. r7 || this.throwUnexpectedToken(this.lookahead);
  2791. let o4 = null;
  2792. const c2 = "init";
  2793. if (this.match(":"))
  2794. this.nextToken(), o4 = this.inheritCoverGrammar(this.parseAssignmentExpression);
  2795. else if (t2.type === e7.Identifier) {
  2796. n3 = true, o4 = this.finalize(e8, new S2(t2.value));
  2797. } else
  2798. this.throwUnexpectedToken(this.nextToken());
  2799. return this.finalize(e8, new v3(c2, r7, i3, o4, s4, n3));
  2800. }
  2801. parseObjectInitializer() {
  2802. const e8 = this.createNode();
  2803. this.expect("{");
  2804. const t2 = [];
  2805. for (; !this.match("}"); )
  2806. t2.push(this.parseObjectProperty()), this.match("}") || this.expectCommaSeparator();
  2807. return this.expect("}"), this.finalize(e8, new j3(t2));
  2808. }
  2809. parseTemplateHead() {
  2810. r2(this.lookahead.head, "Template literal must start with a template head");
  2811. const t2 = this.createNode(), i3 = this.nextToken(), s4 = i3.value, n3 = i3.cooked;
  2812. return this.finalize(t2, new F({ raw: s4, cooked: n3 }, i3.tail));
  2813. }
  2814. parseTemplateElement() {
  2815. this.lookahead.type !== e7.Template && this.throwUnexpectedToken();
  2816. const e8 = this.createNode(), t2 = this.nextToken(), i3 = t2.value, s4 = t2.cooked;
  2817. return this.finalize(e8, new F({ raw: i3, cooked: s4 }, t2.tail));
  2818. }
  2819. parseTemplateLiteral() {
  2820. const e8 = this.createNode(), t2 = [], i3 = [];
  2821. let s4 = this.parseTemplateHead();
  2822. for (i3.push(s4); !s4.tail; )
  2823. t2.push(this.parseExpression()), s4 = this.parseTemplateElement(), i3.push(s4);
  2824. return this.finalize(e8, new I2(i3, t2));
  2825. }
  2826. parseGroupExpression() {
  2827. this.expect("("), this.context.isBindingElement = true;
  2828. const e8 = this.inheritCoverGrammar(this.parseAssignmentExpression);
  2829. return this.expect(")"), this.context.isBindingElement = false, e8;
  2830. }
  2831. parseArguments() {
  2832. this.expect("(");
  2833. const e8 = [];
  2834. if (!this.match(")"))
  2835. for (; ; ) {
  2836. const t2 = this.isolateCoverGrammar(this.parseAssignmentExpression);
  2837. if (e8.push(t2), this.match(")"))
  2838. break;
  2839. if (this.expectCommaSeparator(), this.match(")"))
  2840. break;
  2841. }
  2842. return this.expect(")"), e8;
  2843. }
  2844. isIdentifierName(e8) {
  2845. return e8.type === e7.Identifier || e8.type === e7.Keyword || e8.type === e7.BooleanLiteral || e8.type === e7.NullLiteral;
  2846. }
  2847. parseIdentifierName() {
  2848. const e8 = this.createNode(), t2 = this.nextToken();
  2849. return this.isIdentifierName(t2) || this.throwUnexpectedToken(t2), this.finalize(e8, new S2(t2.value));
  2850. }
  2851. parseLeftHandSideExpressionAllowCall() {
  2852. const e8 = this.lookahead, t2 = this.context.allowIn;
  2853. this.context.allowIn = true;
  2854. let i3 = this.inheritCoverGrammar(this.parsePrimaryExpression);
  2855. for (; ; )
  2856. if (this.match("(")) {
  2857. this.context.isBindingElement = false, this.context.isAssignmentTarget = false;
  2858. const t3 = this.parseArguments();
  2859. i3 = this.finalize(this.startNode(e8), new u2(i3, t3));
  2860. } else if (this.match("[")) {
  2861. this.context.isBindingElement = false, this.context.isAssignmentTarget = true, this.expect("[");
  2862. const t3 = this.isolateCoverGrammar(this.parseExpression);
  2863. this.expect("]"), i3 = this.finalize(this.startNode(e8), new l(i3, t3));
  2864. } else {
  2865. if (!this.match("."))
  2866. break;
  2867. {
  2868. this.context.isBindingElement = false, this.context.isAssignmentTarget = true, this.expect(".");
  2869. const t3 = this.parseIdentifierName();
  2870. i3 = this.finalize(this.startNode(e8), new d4(i3, t3));
  2871. }
  2872. }
  2873. return this.context.allowIn = t2, i3;
  2874. }
  2875. parseLeftHandSideExpression() {
  2876. r2(this.context.allowIn, "callee of new expression always allow in keyword.");
  2877. const t2 = this.startNode(this.lookahead);
  2878. let i3 = this.inheritCoverGrammar(this.parsePrimaryExpression);
  2879. for (; ; )
  2880. if (this.match("[")) {
  2881. this.context.isBindingElement = false, this.context.isAssignmentTarget = true, this.expect("[");
  2882. const e8 = this.isolateCoverGrammar(this.parseExpression);
  2883. this.expect("]"), i3 = this.finalize(t2, new l(i3, e8));
  2884. } else {
  2885. if (!this.match("."))
  2886. break;
  2887. {
  2888. this.context.isBindingElement = false, this.context.isAssignmentTarget = true, this.expect(".");
  2889. const e8 = this.parseIdentifierName();
  2890. i3 = this.finalize(t2, new d4(i3, e8));
  2891. }
  2892. }
  2893. return i3;
  2894. }
  2895. parseUpdateExpression() {
  2896. let e8;
  2897. const t2 = this.lookahead;
  2898. if (this.match("++") || this.match("--")) {
  2899. const s4 = this.startNode(t2), n3 = this.nextToken();
  2900. e8 = this.inheritCoverGrammar(this.parseUnaryExpression), this.context.isAssignmentTarget || this.tolerateError(e5.InvalidLHSInAssignment);
  2901. const r7 = true;
  2902. e8 = this.finalize(s4, new C(n3.value, e8, r7)), this.context.isAssignmentTarget = false, this.context.isBindingElement = false;
  2903. } else if (e8 = this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall), !this.hasLineTerminator && this.lookahead.type === e7.Punctuator && (this.match("++") || this.match("--"))) {
  2904. this.context.isAssignmentTarget || this.tolerateError(e5.InvalidLHSInAssignment), this.context.isAssignmentTarget = false, this.context.isBindingElement = false;
  2905. const s4 = this.nextToken().value, n3 = false;
  2906. e8 = this.finalize(this.startNode(t2), new C(s4, e8, n3));
  2907. }
  2908. return e8;
  2909. }
  2910. parseUnaryExpression() {
  2911. let e8;
  2912. if (this.match("+") || this.match("-") || this.match("~") || this.match("!")) {
  2913. const t2 = this.startNode(this.lookahead), i3 = this.nextToken();
  2914. e8 = this.inheritCoverGrammar(this.parseUnaryExpression), e8 = this.finalize(t2, new q(i3.value, e8)), this.context.isAssignmentTarget = false, this.context.isBindingElement = false;
  2915. } else
  2916. e8 = this.parseUpdateExpression();
  2917. return e8;
  2918. }
  2919. binaryPrecedence(e8) {
  2920. const t2 = e8.value;
  2921. let i3;
  2922. return i3 = e8.type === e7.Punctuator ? this.operatorPrecedence[t2] || 0 : e8.type === e7.Keyword && this.context.allowIn && t2 === "in" ? 12 : 0, i3;
  2923. }
  2924. parseBinaryExpression() {
  2925. const e8 = this.lookahead;
  2926. let t2 = this.inheritCoverGrammar(this.parseUnaryExpression);
  2927. const i3 = this.lookahead;
  2928. let s4 = this.binaryPrecedence(i3);
  2929. if (s4 > 0) {
  2930. this.nextToken(), this.context.isAssignmentTarget = false, this.context.isBindingElement = false;
  2931. const n3 = [e8, this.lookahead];
  2932. let r7 = t2, a4 = this.inheritCoverGrammar(this.parseUnaryExpression);
  2933. const o4 = [r7, i3.value, a4], h7 = [s4];
  2934. for (; s4 = this.binaryPrecedence(this.lookahead), !(s4 <= 0); ) {
  2935. for (; o4.length > 2 && s4 <= h7[h7.length - 1]; ) {
  2936. a4 = o4.pop();
  2937. const e9 = o4.pop();
  2938. h7.pop(), r7 = o4.pop(), n3.pop();
  2939. const t3 = n3[n3.length - 1], i4 = this.startNode(t3, t3.lineStart);
  2940. o4.push(this.finalize(i4, new h3(e9, r7, a4)));
  2941. }
  2942. o4.push(this.nextToken().value), h7.push(s4), n3.push(this.lookahead), o4.push(this.inheritCoverGrammar(this.parseUnaryExpression));
  2943. }
  2944. let c2 = o4.length - 1;
  2945. t2 = o4[c2];
  2946. let l3 = n3.pop();
  2947. for (; c2 > 1; ) {
  2948. const e9 = n3.pop();
  2949. if (!e9)
  2950. break;
  2951. const i4 = l3 && l3.lineStart, s5 = this.startNode(e9, i4), r8 = o4[c2 - 1];
  2952. t2 = this.finalize(s5, new h3(r8, o4[c2 - 2], t2)), c2 -= 2, l3 = e9;
  2953. }
  2954. }
  2955. return t2;
  2956. }
  2957. parseAssignmentExpression() {
  2958. const e8 = this.lookahead;
  2959. let t2 = e8, s4 = this.inheritCoverGrammar(this.parseBinaryExpression);
  2960. if (this.matchAssign()) {
  2961. this.context.isAssignmentTarget || this.tolerateError(e5.InvalidLHSInAssignment), this.match("=") || (this.context.isAssignmentTarget = false, this.context.isBindingElement = false), t2 = this.nextToken();
  2962. const n3 = t2.value, r7 = this.isolateCoverGrammar(this.parseAssignmentExpression);
  2963. s4 = this.finalize(this.startNode(e8), new n(n3, s4, r7)), this.context.firstCoverInitializedNameError = null;
  2964. }
  2965. return s4;
  2966. }
  2967. parseExpression() {
  2968. return this.isolateCoverGrammar(this.parseAssignmentExpression);
  2969. }
  2970. parseStatementListItem() {
  2971. let e8;
  2972. if (this.context.isAssignmentTarget = true, this.context.isBindingElement = true, this.lookahead.type === e7.Keyword)
  2973. if (this.lookahead.value === "function")
  2974. e8 = this.parseFunctionDeclaration();
  2975. else
  2976. e8 = this.parseStatement();
  2977. else
  2978. e8 = this.parseStatement();
  2979. return e8;
  2980. }
  2981. parseBlock() {
  2982. const e8 = this.createNode();
  2983. this.expect("{");
  2984. const t2 = [];
  2985. for (; !this.match("}"); )
  2986. t2.push(this.parseStatementListItem());
  2987. return this.expect("}"), this.finalize(e8, new p3(t2));
  2988. }
  2989. parseObjectStatement() {
  2990. const e8 = this.createNode(), t2 = this.parseObjectInitializer();
  2991. return this.finalize(e8, new m5(t2));
  2992. }
  2993. parseBlockOrObjectStatement() {
  2994. let e8 = this.context.curlyParsing === "asObject";
  2995. return this.context.curlyParsing === "asObjectOrBlock" && this.peekAhead((t2) => {
  2996. let i3 = t2();
  2997. i3.type !== e7.Identifier && i3.type !== e7.StringLiteral || (i3 = t2(), i3.type === e7.Punctuator && i3.value === ":" && (e8 = true));
  2998. }), e8 ? this.parseObjectStatement() : this.parseBlock();
  2999. }
  3000. parseVariableIdentifier() {
  3001. const e8 = this.createNode(), t2 = this.nextToken();
  3002. return t2.type !== e7.Identifier && this.throwUnexpectedToken(t2, e5.IdentiferExpected), this.finalize(e8, new S2(t2.value));
  3003. }
  3004. parseVariableDeclaration(e8) {
  3005. const t2 = this.createNode(), i3 = this.parseVariableIdentifier();
  3006. let s4 = null;
  3007. return this.match("=") ? (this.nextToken(), s4 = this.isolateCoverGrammar(this.parseAssignmentExpression)) : i3.type === e3.Identifier || e8.inFor || this.expect("="), this.finalize(t2, new P3(i3, s4));
  3008. }
  3009. parseVariableDeclarationList(e8) {
  3010. const t2 = [this.parseVariableDeclaration(e8)];
  3011. for (; this.match(","); )
  3012. this.nextToken(), t2.push(this.parseVariableDeclaration(e8));
  3013. return t2;
  3014. }
  3015. parseVariableStatement() {
  3016. const e8 = this.createNode();
  3017. this.expectKeyword("var");
  3018. const t2 = this.parseVariableDeclarationList({ inFor: false });
  3019. return this.consumeSemicolon(), this.finalize(e8, new M3(t2, "var"));
  3020. }
  3021. parseEmptyStatement() {
  3022. const e8 = this.createNode();
  3023. return this.expect(";"), this.finalize(e8, new y2());
  3024. }
  3025. parseExpressionStatement() {
  3026. const e8 = this.createNode(), t2 = this.parseExpression();
  3027. return this.consumeSemicolon(), this.finalize(e8, new m5(t2));
  3028. }
  3029. parseIfClause() {
  3030. const e8 = this.context.curlyParsing;
  3031. this.context.curlyParsing = "asObjectOrBlock";
  3032. const t2 = this.parseStatement();
  3033. return this.context.curlyParsing = e8, t2;
  3034. }
  3035. parseIfStatement() {
  3036. const e8 = this.createNode();
  3037. let t2, i3 = null;
  3038. this.expectKeyword("if"), this.expect("(");
  3039. const s4 = this.parseExpression();
  3040. return !this.match(")") && this.config.tolerant ? (this.tolerateUnexpectedToken(this.nextToken()), t2 = this.finalize(this.createNode(), new y2())) : (this.expect(")"), t2 = this.parseIfClause(), this.matchKeyword("else") && (this.nextToken(), i3 = this.parseIfClause())), this.finalize(e8, new f2(s4, t2, i3));
  3041. }
  3042. parseForStatement() {
  3043. let e8 = null, t2 = null, s4 = null, n3 = null, r7 = null;
  3044. const a4 = this.createNode();
  3045. if (this.expectKeyword("for"), this.expect("("), this.match(";"))
  3046. this.nextToken();
  3047. else if (this.matchKeyword("var")) {
  3048. const t3 = this.createNode();
  3049. this.nextToken();
  3050. const s5 = this.context.allowIn;
  3051. this.context.allowIn = false;
  3052. const a5 = this.parseVariableDeclarationList({ inFor: true });
  3053. if (this.context.allowIn = s5, a5.length === 1 && this.matchKeyword("in")) {
  3054. a5[0].init && this.tolerateError(e5.ForInOfLoopInitializer, "for-in"), n3 = this.finalize(t3, new M3(a5, "var")), this.nextToken(), r7 = this.parseExpression();
  3055. } else
  3056. e8 = this.finalize(t3, new M3(a5, "var")), this.expect(";");
  3057. } else {
  3058. const t3 = this.context.isBindingElement, s5 = this.context.isAssignmentTarget, a5 = this.context.firstCoverInitializedNameError, o5 = this.context.allowIn;
  3059. this.context.allowIn = false, e8 = this.inheritCoverGrammar(this.parseAssignmentExpression), this.context.allowIn = o5, this.matchKeyword("in") ? (this.context.isAssignmentTarget && e8.type !== e3.AssignmentExpression || this.tolerateError(e5.InvalidLHSInForIn), this.nextToken(), n3 = e8, r7 = this.parseExpression(), e8 = null) : (this.context.isBindingElement = t3, this.context.isAssignmentTarget = s5, this.context.firstCoverInitializedNameError = a5, this.expect(";"));
  3060. }
  3061. let o4;
  3062. if (n3 || (this.match(";") || (t2 = this.isolateCoverGrammar(this.parseExpression)), this.expect(";"), this.match(")") || (s4 = this.isolateCoverGrammar(this.parseExpression))), !this.match(")") && this.config.tolerant)
  3063. this.tolerateUnexpectedToken(this.nextToken()), o4 = this.finalize(this.createNode(), new y2());
  3064. else {
  3065. this.expect(")");
  3066. const e9 = this.context.inIteration, t3 = this.context.curlyParsing;
  3067. this.context.inIteration = true, this.context.curlyParsing = "asObjectOrBlock", o4 = this.isolateCoverGrammar(this.parseStatement), this.context.curlyParsing = t3, this.context.inIteration = e9;
  3068. }
  3069. return n3 && r7 ? this.finalize(a4, new E3(n3, r7, o4)) : this.finalize(a4, new b2(e8, t2, s4, o4));
  3070. }
  3071. parseContinueStatement() {
  3072. const e8 = this.createNode();
  3073. return this.expectKeyword("continue"), this.consumeSemicolon(), this.finalize(e8, new x());
  3074. }
  3075. parseBreakStatement() {
  3076. const e8 = this.createNode();
  3077. return this.expectKeyword("break"), this.consumeSemicolon(), this.finalize(e8, new a2());
  3078. }
  3079. parseReturnStatement() {
  3080. this.config.globalReturn || this.context.inFunctionBody || this.tolerateError(e5.IllegalReturn);
  3081. const e8 = this.createNode();
  3082. this.expectKeyword("return");
  3083. const t2 = !this.match(";") && !this.match("}") && !this.hasLineTerminator && this.lookahead.type !== e7.EOF || this.lookahead.type === e7.StringLiteral || this.lookahead.type === e7.Template ? this.parseExpression() : null;
  3084. return this.consumeSemicolon(), this.finalize(e8, new B(t2));
  3085. }
  3086. parseStatement() {
  3087. let e8;
  3088. switch (this.lookahead.type) {
  3089. case e7.BooleanLiteral:
  3090. case e7.NullLiteral:
  3091. case e7.NumericLiteral:
  3092. case e7.StringLiteral:
  3093. case e7.Template:
  3094. case e7.Identifier:
  3095. e8 = this.parseExpressionStatement();
  3096. break;
  3097. case e7.Punctuator: {
  3098. const t2 = this.lookahead.value;
  3099. e8 = t2 === "{" ? this.parseBlockOrObjectStatement() : t2 === "(" ? this.parseExpressionStatement() : t2 === ";" ? this.parseEmptyStatement() : this.parseExpressionStatement();
  3100. break;
  3101. }
  3102. case e7.Keyword:
  3103. switch (this.lookahead.value.toLowerCase()) {
  3104. case "break":
  3105. e8 = this.parseBreakStatement();
  3106. break;
  3107. case "continue":
  3108. e8 = this.parseContinueStatement();
  3109. break;
  3110. case "for":
  3111. e8 = this.parseForStatement();
  3112. break;
  3113. case "function":
  3114. e8 = this.parseFunctionDeclaration();
  3115. break;
  3116. case "if":
  3117. e8 = this.parseIfStatement();
  3118. break;
  3119. case "return":
  3120. e8 = this.parseReturnStatement();
  3121. break;
  3122. case "var":
  3123. e8 = this.parseVariableStatement();
  3124. break;
  3125. default:
  3126. e8 = this.parseExpressionStatement();
  3127. }
  3128. break;
  3129. default:
  3130. e8 = this.throwUnexpectedToken(this.lookahead);
  3131. }
  3132. return e8;
  3133. }
  3134. parseFunctionSourceElements() {
  3135. const e8 = this.createNode();
  3136. this.expect("{");
  3137. const t2 = this.context.inIteration, i3 = this.context.inFunctionBody;
  3138. this.context.inIteration = false, this.context.inFunctionBody = true;
  3139. const s4 = [];
  3140. for (; this.lookahead.type !== e7.EOF && !this.match("}"); )
  3141. s4.push(this.parseStatementListItem());
  3142. return this.expect("}"), this.context.inIteration = t2, this.context.inFunctionBody = i3, this.finalize(e8, new p3(s4));
  3143. }
  3144. parseFormalParameters() {
  3145. const e8 = [];
  3146. if (this.expect("("), !this.match(")"))
  3147. for (; this.lookahead.type !== e7.EOF && (e8.push(this.parseVariableIdentifier()), !this.match(")")) && (this.expect(","), !this.match(")")); )
  3148. ;
  3149. return this.expect(")"), e8;
  3150. }
  3151. parseFunctionDeclaration() {
  3152. const e8 = this.createNode();
  3153. this.expectKeyword("function");
  3154. const t2 = this.parseVariableIdentifier(), i3 = this.parseFormalParameters(), s4 = this.parseFunctionSourceElements();
  3155. return this.finalize(e8, new g(t2, i3, s4));
  3156. }
  3157. parseScript() {
  3158. const e8 = this.createNode(), t2 = [];
  3159. for (; this.lookahead.type !== e7.EOF; )
  3160. t2.push(this.parseStatementListItem());
  3161. return this.finalize(e8, new D2(t2));
  3162. }
  3163. };
  3164. // node_modules/@arcgis/core/arcade/lib/arcade-parser.js
  3165. function o3(r7, o4, n3) {
  3166. let a4 = null;
  3167. const s4 = (e8, t2) => {
  3168. n3 && n3(e8, t2), a4 && a4.visit(e8, t2);
  3169. };
  3170. let m6 = typeof n3 == "function" ? s4 : void 0, i3 = false;
  3171. if (o4) {
  3172. i3 = typeof o4.comment == "boolean" && o4.comment;
  3173. const t2 = typeof o4.attachComment == "boolean" && o4.attachComment;
  3174. (i3 || t2) && (a4 = new e4(), a4.attach = t2, o4.comment = true, m6 = s4);
  3175. }
  3176. const p4 = new O3(r7, o4, m6), c2 = p4.parseScript();
  3177. return i3 && a4 && (c2.comments = a4.comments), p4.config.tokens && (c2.tokens = p4.tokens), p4.config.tolerant && (c2.errors = p4.errorHandler.errors), c2;
  3178. }
  3179. // node_modules/@arcgis/core/arcade/parser.js
  3180. function a3(r7, t2 = []) {
  3181. const o4 = o3("function _() { " + r7 + "\n}");
  3182. if (o4.body === null || o4.body === void 0)
  3183. throw new Error("No formula provided.");
  3184. if (o4.body.length === 0)
  3185. throw new Error("No formula provided.");
  3186. if (o4.body.length === 0)
  3187. throw new Error("No formula provided.");
  3188. if (o4.body[0].body.type !== "BlockStatement")
  3189. throw new Error("Invalid formula content.");
  3190. const i3 = E2(o4);
  3191. if (i3 !== "")
  3192. throw new Error(i3);
  3193. return h2(o4, t2), o4;
  3194. }
  3195. function s3(n3, e8, t2, o4, i3) {
  3196. const c2 = [], l3 = "function _() { \n".length - 1, a4 = "function _() { \n" + n3 + "\n}";
  3197. try {
  3198. const n4 = o3(a4, { tolerant: true, loc: true, range: true }), s4 = n4.errors;
  3199. if (s4.length > 0)
  3200. for (let e9 = 0; e9 < s4.length; e9++)
  3201. c2.push({ line: s4[e9].lineNumber - 2, character: s4[e9].column, reason: s4[e9].description });
  3202. const f4 = A2(n4, e8, t2, o4, i3);
  3203. for (let e9 = 0; e9 < f4.length; e9++)
  3204. f4[e9].line = f4[e9].line - 2, f4[e9].range && (f4[e9].range = [f4[e9][0] - l3, f4[e9][1] - l3]), f4[e9].loc && (f4[e9].loc.start.line = f4[e9].loc.start.line - 2, f4[e9].loc.end.line = f4[e9].loc.end.line - 2), c2.push(f4[e9]);
  3205. } catch (s4) {
  3206. try {
  3207. if (s4.description === "Unexpected token }") {
  3208. const n4 = a4.split("\n").length;
  3209. s4.lineNumber === n4 ? (s4.index = a4.length - 1, c2.push({ line: s4.lineNumber - 4, character: s4.column, reason: "Unexpected end of script" })) : (s4.index = a4.length - 1, c2.push({ line: s4.lineNumber - 2, character: s4.column, reason: "Unexpected end of script" }));
  3210. } else
  3211. c2.push({ line: s4.lineNumber - 2, character: s4.column, reason: s4.description });
  3212. } catch (f4) {
  3213. }
  3214. }
  3215. return c2;
  3216. }
  3217. function f3(n3, e8) {
  3218. return f(n3);
  3219. }
  3220. function d5(n3, e8, r7) {
  3221. return S(n3, e8, r7);
  3222. }
  3223. function h5(n3) {
  3224. return d3(n3);
  3225. }
  3226. // node_modules/@arcgis/core/chunks/arcade.js
  3227. var y3 = ["feature", "angle", "bearing", "centroid", "envelopeintersects", "extent", "geometry", "isselfintersecting", "ringisclockwise"];
  3228. function S3() {
  3229. return true;
  3230. }
  3231. var b3 = S3();
  3232. var x2 = false;
  3233. var A4 = false;
  3234. var g2 = null;
  3235. var j4 = [];
  3236. function h6(t2, r7) {
  3237. if (r7.useAsync === true || t2.isAsync === true)
  3238. return w2(t2, r7);
  3239. if (a("esri-csp-restrictions")) {
  3240. return function(e8) {
  3241. return Be2(t2, e8);
  3242. };
  3243. }
  3244. return $e(t2, r7);
  3245. }
  3246. function w2(t2, r7) {
  3247. if (g2 === null)
  3248. throw new Error("Async Arcade must be enabled for this script");
  3249. if (a("esri-csp-restrictions") || b3 === false) {
  3250. return function(e8) {
  3251. return g2.executeScript(t2, e8);
  3252. };
  3253. }
  3254. return $e(t2, r7, true);
  3255. }
  3256. function F2(e8) {
  3257. Ve2(e8), Ve(e8, "sync"), g2 === null ? j4.push(e8) : (Ve(e8, "async"), g2.extend(e8));
  3258. }
  3259. function E4(e8, t2 = []) {
  3260. return a3(e8, t2);
  3261. }
  3262. function v4(e8, t2, r7 = "") {
  3263. return d5(e8, t2, r7);
  3264. }
  3265. function G2(e8, t2, r7, n3 = "") {
  3266. return s3(e8, t2, r7, n3);
  3267. }
  3268. function k5(e8, t2, r7 = []) {
  3269. return I3(a3(e8, r7), t2);
  3270. }
  3271. function I3(e8, t2) {
  3272. if (t2.useAsync === true || e8.isAsync === true) {
  3273. if (g2 === null)
  3274. throw new Error("Async Arcade must be enabled for this script");
  3275. return g2.executeScript(e8, t2);
  3276. }
  3277. return Be2(e8, t2);
  3278. }
  3279. function L3(e8, t2) {
  3280. return qe(e8, t2);
  3281. }
  3282. function P4(e8, t2) {
  3283. return Ze(e8, t2);
  3284. }
  3285. function U(e8, t2 = false) {
  3286. return f3(e8);
  3287. }
  3288. function _2(e8) {
  3289. return h5(e8);
  3290. }
  3291. function C2(e8, t2 = []) {
  3292. return e8.usesGeometry === void 0 && h2(e8, t2), e8.usesGeometry === true;
  3293. }
  3294. var M4 = null;
  3295. function z3() {
  3296. return M4 || (M4 = O4(), M4);
  3297. }
  3298. async function O4() {
  3299. const [e8, t2] = await Promise.all([import("./geometryEngine-YQFWO722.js"), import("./geomsync-KCD6CT2V.js")]);
  3300. return A4 = true, t2.setGeometryEngine(e8), true;
  3301. }
  3302. var R2 = null;
  3303. function T() {
  3304. return R2 !== null || (R2 = q2()), R2;
  3305. }
  3306. async function q2() {
  3307. await et(), g2 = await import("./arcadeAsyncRuntime-QOSTXEAK.js");
  3308. for (const e8 of j4)
  3309. g2.extend(e8), Ve(e8, "async");
  3310. return j4 = null, true;
  3311. }
  3312. function D4() {
  3313. return x2;
  3314. }
  3315. function B2() {
  3316. return !!g2;
  3317. }
  3318. function H() {
  3319. return A4;
  3320. }
  3321. var J2 = null;
  3322. function K() {
  3323. return J2 || (J2 = N3(), J2);
  3324. }
  3325. async function N3() {
  3326. await T();
  3327. const [e8, r7, n3, s4, i3] = await Promise.all([import("./featureSetUtils-ACRO3AK6.js"), import("./featuresetbase-YGJZOO37.js"), import("./featuresetgeom-JWYFLOHU.js"), import("./featuresetstats-3XKBEKZS.js"), import("./featuresetstring-RP6DTLWZ.js")]);
  3328. return Z = e8, g2.extend([r7, n3, s4, i3]), Ve([r7, n3, s4, i3], "async"), x2 = true, true;
  3329. }
  3330. function Q3(e8, t2 = []) {
  3331. return e8.usesFeatureSet === void 0 && h2(e8, t2), e8.usesFeatureSet === true;
  3332. }
  3333. function V(e8, t2 = []) {
  3334. return e8.isAsync === void 0 && h2(e8, t2), e8.isAsync === true;
  3335. }
  3336. function W2(e8, t2) {
  3337. if (t2) {
  3338. for (const r7 of t2)
  3339. if (L3(e8, r7))
  3340. return true;
  3341. return false;
  3342. }
  3343. return false;
  3344. }
  3345. async function X2(e8, t2, r7 = [], n3 = false) {
  3346. const s4 = typeof e8 == "string" ? E4(e8) : e8, i3 = [];
  3347. return s4 && (H() === false && (C2(s4) || n3) && i3.push(z3()), B2() === false && (s4.isAsync === true || t2) && i3.push(T()), D4() === false && (Q3(s4) || W2(s4, r7)) && i3.push(K())), !i3.length || (await Promise.all(i3), true);
  3348. }
  3349. function Y2(e8) {
  3350. if (C2(e8))
  3351. return true;
  3352. const t2 = I(e8);
  3353. let r7 = false;
  3354. for (let n3 = 0; n3 < t2.length; n3++)
  3355. if (y3.includes(t2[n3])) {
  3356. r7 = true;
  3357. break;
  3358. }
  3359. return r7;
  3360. }
  3361. var Z = null;
  3362. function $2() {
  3363. return Z;
  3364. }
  3365. var ee3 = Object.freeze(Object.defineProperty({ __proto__: null, compileScript: h6, extend: F2, parseScript: E4, validateScript: v4, scriptCheck: G2, parseAndExecuteScript: k5, executeScript: I3, referencesMember: L3, referencesFunction: P4, extractFieldLiterals: U, extractExpectedFieldLiterals: _2, scriptUsesGeometryEngine: C2, enableGeometrySupport: z3, enableGeometrySupportImpl: O4, enableAsyncSupport: T, enableAsyncSupportImpl: q2, isFeatureSetSupportEnabled: D4, isAsyncEnabled: B2, isGeometryEnabled: H, enableFeatureSetSupport: K, enableFeatureSetSupportImpl: N3, scriptUsesFeatureSet: Q3, scriptIsAsync: V, loadScriptDependencies: X2, scriptTouchesGeometry: Y2, featureSetUtils: $2 }, Symbol.toStringTag, { value: "Module" }));
  3366. // node_modules/@arcgis/core/support/arcadeUtils.js
  3367. var M5 = /^\$(feature|aggregatedFeatures)\./i;
  3368. var P5 = { vars: { $feature: "any", $view: "any" }, spatialReference: null };
  3369. function k6(e8) {
  3370. return e8.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&");
  3371. }
  3372. function I4(e8) {
  3373. return e8 == null ? null : L(e8) || E(e8) ? "array" : z(e8) ? "date" : w(e8) ? "text" : _(e8) ? "boolean" : O(e8) ? "number" : e8 instanceof d ? "dictionary" : Y(e8) ? "feature" : e8 instanceof j ? "point" : e8 instanceof v ? "polygon" : e8 instanceof m3 ? "polyline" : e8 instanceof m2 ? "multipoint" : e8 instanceof M ? "extent" : J(e8) ? "featureSet" : P(e8) ? "featureSetCollection" : null;
  3374. }
  3375. function A5(r7) {
  3376. if (!r7)
  3377. return null;
  3378. try {
  3379. return E4(r7);
  3380. } catch (n3) {
  3381. }
  3382. return null;
  3383. }
  3384. function D5(e8, n3) {
  3385. const t2 = typeof e8 == "string" ? A5(e8) : e8;
  3386. if (!t2)
  3387. return null;
  3388. try {
  3389. return n3 = n3 || m(P5), h6(t2, n3);
  3390. } catch (o4) {
  3391. }
  3392. return null;
  3393. }
  3394. function G3(e8, r7) {
  3395. return { vars: { $feature: e8 == null ? new d2() : d2.createFromGraphic(e8), $view: r7 && r7.view }, spatialReference: r7 && r7.sr };
  3396. }
  3397. function V2(e8, r7, n3) {
  3398. return d2.createFromGraphicLikeObject(r7, e8, n3);
  3399. }
  3400. function L4(e8, r7) {
  3401. e8.vars.$feature = r7;
  3402. }
  3403. function U2(e8, r7) {
  3404. let t2;
  3405. try {
  3406. t2 = I3(e8, r7);
  3407. } catch (o4) {
  3408. t2 = null;
  3409. }
  3410. return t2;
  3411. }
  3412. function q3(e8, r7) {
  3413. let n3;
  3414. try {
  3415. n3 = e8 ? e8(r7) : null;
  3416. } catch (t2) {
  3417. n3 = null;
  3418. }
  3419. return n3;
  3420. }
  3421. function O5(e8, r7) {
  3422. try {
  3423. return e8 ? e8(r7) : Promise.resolve(null);
  3424. } catch (n3) {
  3425. return Promise.resolve(null);
  3426. }
  3427. }
  3428. function T2(e8, r7) {
  3429. if (!e8)
  3430. return [];
  3431. const n3 = typeof e8 == "string" ? A5(e8) : e8;
  3432. if (!n3)
  3433. return [];
  3434. const o4 = _2(n3);
  3435. let i3 = new Array();
  3436. o4.forEach((e9) => {
  3437. M5.test(e9) && (e9 = e9.replace(M5, ""), i3.push(e9));
  3438. });
  3439. const s4 = i3.filter((e9) => e9.includes("*"));
  3440. return i3 = i3.filter((e9) => !s4.includes(e9)), r7 && s4.forEach((e9) => {
  3441. const n4 = new RegExp(`^${e9.split(/\*+/).map(k6).join(".*")}$`, "i");
  3442. r7.forEach((e10) => n4.test(e10) ? i3.push(e10) : null);
  3443. }), [...new Set(i3.sort())];
  3444. }
  3445. function B3(e8) {
  3446. return L3(e8, "$view");
  3447. }
  3448. function H2(e8, r7) {
  3449. return !!e8 && L3(e8, r7);
  3450. }
  3451. function J3(e8) {
  3452. if (!e8 || e8.spatialReference == null && (e8.scale == null || e8.viewingMode == null))
  3453. return;
  3454. return { view: e8.viewingMode && e8.scale != null ? new d({ viewingMode: e8.viewingMode, scale: e8.scale }) : null, sr: e8.spatialReference };
  3455. }
  3456. function K2({ url: e8, spatialReference: r7, lrucache: n3, interceptor: t2 }) {
  3457. const o4 = $2();
  3458. return o4 ? o4.createFeatureSetCollectionFromService(e8, r7, n3, t2) : null;
  3459. }
  3460. function N4({ layer: e8, spatialReference: r7, outFields: n3, returnGeometry: t2, lrucache: o4, interceptor: i3 }) {
  3461. if (e8 === null)
  3462. return null;
  3463. const s4 = $2();
  3464. return s4 ? s4.constructFeatureSet(e8, r7, n3, t2 ?? true, o4, i3) : null;
  3465. }
  3466. function Q4(e8) {
  3467. if (e8?.map === null)
  3468. return null;
  3469. const r7 = $2();
  3470. return r7 ? r7.createFeatureSetCollectionFromMap(e8.map, e8.spatialReference, e8.lrucache, e8.interceptor) : null;
  3471. }
  3472. function W3(e8, r7, n3 = []) {
  3473. return X2(e8, r7, n3);
  3474. }
  3475. function X3() {
  3476. return z3();
  3477. }
  3478. function Y3() {
  3479. return K();
  3480. }
  3481. function Z2(e8) {
  3482. return e8.type === "simple" || e8.type === "class-breaks" || e8.type === "unique-value" || e8.type === "dot-density" || e8.type === "dictionary" || e8.type === "pie-chart";
  3483. }
  3484. function _3(e8) {
  3485. return e8.declaredClass === "esri.layers.support.LabelClass";
  3486. }
  3487. function ee4(e8) {
  3488. return e8.declaredClass === "esri.PopupTemplate";
  3489. }
  3490. function re3(e8, r7) {
  3491. if (!e8)
  3492. return false;
  3493. if (typeof e8 == "string")
  3494. return r7(e8);
  3495. const n3 = e8;
  3496. if (Z2(n3)) {
  3497. if (n3.type === "dot-density") {
  3498. const e10 = n3.attributes.some((e11) => r7(e11.valueExpression));
  3499. if (e10)
  3500. return e10;
  3501. }
  3502. const e9 = n3.visualVariables, t2 = !!e9 && e9.some((e10) => {
  3503. let n4 = r7(e10.valueExpression);
  3504. return e10.type === "size" && (e2(e10.minSize) && (n4 = n4 || r7(e10.minSize.valueExpression)), e2(e10.maxSize) && (n4 = n4 || r7(e10.maxSize.valueExpression))), n4;
  3505. });
  3506. return !(!("valueExpression" in n3) || !r7(n3.valueExpression)) || t2;
  3507. }
  3508. if (_3(n3)) {
  3509. const e9 = n3.labelExpressionInfo && n3.labelExpressionInfo.expression;
  3510. return !(!e9 || !r7(e9)) || false;
  3511. }
  3512. return !!ee4(n3) && (!!n3.expressionInfos && n3.expressionInfos.some((e9) => r7(e9.expression)) || Array.isArray(n3.content) && n3.content.some((e9) => e9.type === "expression" && r7(e9.expressionInfo?.expression)));
  3513. }
  3514. function ne4(e8) {
  3515. const r7 = A5(e8);
  3516. return !!r7 && Y2(r7);
  3517. }
  3518. function te3(e8) {
  3519. return re3(e8, ne4);
  3520. }
  3521. function oe3(e8) {
  3522. const r7 = A5(e8);
  3523. return !!r7 && C2(r7);
  3524. }
  3525. function ie3(e8) {
  3526. return re3(e8, oe3);
  3527. }
  3528. export {
  3529. d as Dictionary,
  3530. ee3 as arcade,
  3531. d2 as arcadeFeature,
  3532. N4 as convertFeatureLayerToFeatureSet,
  3533. Q4 as convertMapToFeatureSetCollection,
  3534. K2 as convertServiceUrlToWorkspace,
  3535. G3 as createExecContext,
  3536. V2 as createFeature,
  3537. D5 as createFunction,
  3538. A5 as createSyntaxTree,
  3539. B3 as dependsOnView,
  3540. Y3 as enableFeatureSetOperations,
  3541. X3 as enableGeometryOperations,
  3542. U2 as evalSyntaxTree,
  3543. O5 as executeAsyncFunction,
  3544. q3 as executeFunction,
  3545. T2 as extractFieldNames,
  3546. I4 as getArcadeType,
  3547. J3 as getViewInfo,
  3548. te3 as hasGeometryFunctions,
  3549. ie3 as hasGeometryOperations,
  3550. H2 as hasVariable,
  3551. W3 as loadScriptDependencies,
  3552. L4 as updateExecContext
  3553. };
  3554. //# sourceMappingURL=arcadeUtils-2BWT2KOE.js.map