@arcgis/core 4.33.0-next.20250304 → 4.33.0-next.20250306

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/arcade/arcadeCompiler.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{e99d7ecb80a9df9ead6d.js → 1e7a70a1871fea29169e.js} +3 -3
  4. package/assets/esri/core/workers/chunks/{618016fc1165bcfc2b0d.js → 42b862550c96cc1be956.js} +7 -9
  5. package/assets/esri/core/workers/chunks/4403b3f08907e88d0d91.js +1 -0
  6. package/assets/esri/core/workers/chunks/{0e2d9cd4e8ee5a62b05c.js → 45eee326f7a649c5a15b.js} +7 -9
  7. package/assets/esri/core/workers/chunks/7975ada96e4540a37c83.js +1 -0
  8. package/assets/esri/core/workers/chunks/e3e049311bced533c853.js +1 -0
  9. package/assets/esri/core/workers/chunks/{b464b7800a2ddd92b9a7.js → e8a19f9144df8f155e30.js} +1 -1
  10. package/assets/esri/core/workers/chunks/f4111bb5e5a4910b684a.js +1 -0
  11. package/assets/esri/libs/parquet/pkg/arcgis_parquet_bg.wasm +0 -0
  12. package/chunks/Clouds.glsl.js +19 -23
  13. package/chunks/ImageMaterial.glsl.js +1 -1
  14. package/core/Accessor.js +1 -1
  15. package/core/accessorSupport/decorators/subclass.js +1 -1
  16. package/core/accessorSupport/interfaces.js +1 -1
  17. package/interfaces.d.ts +8 -4
  18. package/layers/mixins/ArcGISImageService.js +1 -1
  19. package/layers/support/featureLayerUtils.js +1 -1
  20. package/libs/parquet/parquet.js +1 -1
  21. package/package.json +1 -1
  22. package/request.js +1 -1
  23. package/rest/support/IdentifyParameters.js +1 -1
  24. package/support/revision.js +1 -1
  25. package/views/3d/analysis/Dimension/DimensionTool.js +1 -1
  26. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  27. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  28. package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
  29. package/views/3d/environment/Clouds.glsl.js +1 -1
  30. package/views/3d/environment/CloudsParameters.js +1 -1
  31. package/views/3d/environment/CloudsRenderer.js +1 -1
  32. package/views/3d/layers/DynamicLayerView3D.js +1 -1
  33. package/views/3d/layers/MediaLayerView3D.js +1 -1
  34. package/views/3d/layers/support/FeatureTile.js +1 -1
  35. package/views/3d/layers/support/FeatureTileFetcher3D.js +1 -1
  36. package/views/3d/support/StreamTextureCollection.js +1 -1
  37. package/views/3d/support/TextureCollection.js +1 -1
  38. package/views/3d/terrain/TerrainRenderer.js +1 -1
  39. package/views/3d/terrain/TerrainSurface.js +1 -1
  40. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +7 -7
  41. package/views/3d/webgl-engine/core/shaderLibrary/util/DoublePrecision.glsl.js +5 -7
  42. package/views/3d/webgl-engine/core/shaderLibrary/util/LookupCloudsFromTextureArray.glsl.js +51 -0
  43. package/views/3d/webgl-engine/lib/GLMaterialParameters.js +5 -0
  44. package/views/3d/webgl-engine/lib/GLMaterialRepository.js +1 -1
  45. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  46. package/views/3d/webgl-engine/lib/TextTextureAtlas.js +1 -1
  47. package/views/3d/webgl-engine/lib/Texture.js +1 -1
  48. package/views/3d/webgl-engine/lib/TextureRepository.js +1 -1
  49. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  50. package/views/animation/pointToPoint/apex/planning.js +1 -1
  51. package/views/webgl/FramebufferObject.js +1 -1
  52. package/views/webgl/TextureDescriptor.js +1 -1
  53. package/widgets/FeatureForm/FieldInput.js +1 -1
  54. package/widgets/FeatureForm/UtilityNetworkAssociationAddAssociationViewModel.js +1 -1
  55. package/widgets/UtilityNetworkTraceAnalysis/UtilityNetworkTraceAnalysisViewModel.js +1 -1
  56. package/assets/esri/core/workers/chunks/04341d50082f864025aa.js +0 -1
  57. package/assets/esri/core/workers/chunks/10118666a5a5b141ece6.js +0 -1
  58. package/assets/esri/core/workers/chunks/64d3e683872791eb6ae9.js +0 -1
  59. package/assets/esri/core/workers/chunks/8b057b5a606ac3669a78.js +0 -1
  60. package/views/3d/webgl-engine/core/shaderLibrary/util/LookupCubemapFromTextureArray.glsl.js +0 -39
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{neverAbortedSignal as e,toSymbolId as n}from"./arcadeEnvironment.js";import{ArcadeModule as t}from"./ArcadeModule.js";import{ArcadeModuleLoader as l}from"./ArcadeModuleLoader.js";import{getGeometryKeys as o,geometryMember as r,getNestedOptionalValue as a}from"./containerUtils.js";import s from"./Dictionary.js";import{ArcadeExecutionError as i,ExecutionErrorCodes as c,ArcadeCompilationError as u,ArcadeUncompilableError as p}from"./executionError.js";import m from"./Feature.js";import{NativeFunction as g,ArcadeFunction as d,ScopeMarshalledFunction as f,wrapModuleScopedResponse as h}from"./FunctionWrapper.js";import{i as y,u as b,v as w,R as S,I as v,w as x,x as M,y as F,m as $,z as C,q as I,l as A,f as _,t as O,A as k,B as G,C as E,n as j}from"../chunks/languageUtils.js";import{addFunctionDeclaration as B}from"./treeAnalysis.js";import{A as N}from"../chunks/array.js";import{registerFunctions as R}from"./functions/date.js";import{registerFunctions as D}from"./functions/feature.js";import{registerFunctions as L}from"./functions/geometry.js";import{registerFunctions as U}from"./functions/geomsync.js";import{registerFunctions as K}from"./functions/maths.js";import{registerFunctions as P}from"./functions/stats.js";import{registerFunctions as W}from"./functions/string.js";import{isPromiseLike as T}from"../core/promiseUtils.js";import V from"../geometry/Geometry.js";import q from"../geometry/SpatialReference.js";import{isGraphic as Z,isNumber as z,isArray as J,isString as Y,isBoolean as H}from"../support/guards.js";class Q extends d{constructor(e,n){super(),this.paramCount=n,this.fn=e}createFunction(e){return(...n)=>{if(n.length!==this.paramCount)throw new i(e,c.WrongNumberOfParameters,null);return this.fn(...n)}}call(e,n){return this.fn(...n.arguments)}marshalledCall(e,n,t,l){return l(e,n,((n,o,r)=>{r=r.map((n=>!y(n)||n instanceof f?n:h(n,e,l)));const a=this.call(t,{arguments:r});return T(a)?a.then((e=>h(e,t,l))):a}))}}function X(e,n){const t=[];for(let l=0;l<n.arguments.length;l++)t.push(ne(e,n.arguments[l]));return t}function ee(e,n,t){try{return t(e,null,n.arguments)}catch(l){throw l}}function ne(e,n){switch(n.type){case"AssignmentExpression":return me(e,n);case"UpdateExpression":return ue(e,n);case"TemplateLiteral":return Ie(e,n);case"Identifier":return Oe(e,n);case"MemberExpression":return Fe(e,n);case"Literal":return null===n.value||void 0===n.value?"null":JSON.stringify(n.value);case"CallExpression":return ke(e,n);case"UnaryExpression":return $e(e,n);case"BinaryExpression":return Ae(e,n);case"LogicalExpression":return _e(e,n);case"ArrayExpression":return Ce(e,n);case"ObjectExpression":return le(e,n);default:throw new u(null,c.Unrecognized,n)}}function te(e,n){switch(n.type){case"EmptyStatement":return"lc.voidOperation";case"VariableDeclaration":return xe(e,n);case"BlockStatement":return he(e,n);case"FunctionDeclaration":return ve(e,n);case"ImportDeclaration":return be(e,n);case"ExportNamedDeclaration":return we(e,n);case"ReturnStatement":return ye(e,n);case"IfStatement":return fe(e,n);case"ExpressionStatement":return ge(e,n);case"BreakStatement":return"break";case"ContinueStatement":return"continue";case"ForStatement":return ce(e,n);case"ForInStatement":return se(e,n);case"ForOfStatement":return ie(e,n);case"WhileStatement":return pe(e,n);default:throw new u(null,c.Unrecognized,n)}}function le(e,n){let t="lang.dictionary([";for(let l=0;l<n.properties.length;l++){const o=n.properties[l];let r;"Identifier"===o.key.type?(Se(o.key.name),r="'"+o.key.name+"'"):r=ne(e,o.key);l>0&&(t+=","),t+="lang.strCheck("+r+",'ObjectExpression'),lang.aCheck("+ne(e,o.value)+", 'ObjectExpression')"}return t+="])",t}function oe(e,n,t,l,o=(e,n)=>`${e} = ${n}`){const r=De(e),a=De(e);return[`var ${r} = ${t};`,`for (var ${a} = 0; ${a} < ${r}; ${a}++) {`,` ${o(n,a)}`,` ${te(e,l)}`,"}","lastStatement = lc.voidOperation;"].join("\n")}function re(e,n,t,l,o=e=>e){const r=De(e),a=De(e);return[`var ${r} = ${t};`,`for (var ${a} of ${r}) {`,` ${n} = ${o(a)};`,` ${te(e,l)}`,"}","lastStatement = lc.voidOperation;"].join("\n")}function ae(e,n,t,l){const o=De(e);return[`var ${o} = ${t}.iterator(runtimeCtx.abortSignal);`,`while ((${n} = lang.graphicToFeature(yield ${o}.next(), ${t}, runtimeCtx)) != null) {`,` ${te(e,l)}`,"}","lastStatement = lc.voidOperation;"].join("\n")}function se(e,t){const l=De(e);let o="var "+l+" = "+ne(e,t.right)+";\n";"VariableDeclaration"===t.left.type&&(o+=te(e,t.left));const r=n("VariableDeclaration"===t.left.type?t.left.declarations[0].id:t.left);Se(r);let a="";null!==e.localScope&&(void 0!==e.localScope[r]?a="lscope['"+r+"']":void 0!==e.localScope._SymbolsMap[r]&&(a="lscope['"+e.localScope._SymbolsMap[r]+"']"));let s="";if(""===a)if(void 0!==e.globalScope[r])a="gscope['"+r+"']";else if(void 0!==e.globalScope._SymbolsMap[r])a="gscope['"+e.globalScope._SymbolsMap[r]+"']";else if(null!==e.localScope)if(e.undeclaredGlobalsInFunctions.has(r))a="gscope['"+e.undeclaredGlobalsInFunctions.get(r).manglename+"']",s=e.undeclaredGlobalsInFunctions.get(r).manglename;else{const n={manglename:Re(e),node:t.left};e.undeclaredGlobalsInFunctions.set(r,n),a="gscope['"+n.manglename+"']",s=n.manglename}return s&&(o+="lang.chkAssig('"+s+"',runtimeCtx); \n"),o+="if ("+l+"===null) { lastStatement = lc.voidOperation; }\n ",o+="else if (lc.isArray("+l+") || lc.isString("+l+")) {\n",o+=oe(e,a,`${l}.length`,t.body),o+="}\n",o+="else if (lc.isImmutableArray("+l+")) {\n",o+=oe(e,a,`${l}.length()`,t.body),o+="}\n",o+="else if (( "+l+" instanceof lang.Dictionary) || lc.isDictionaryLike("+l+")) {\n",o+=re(e,a,`${l}.keys()`,t.body),o+="}\n",e.isAsync&&(o+="else if (lc.isFeatureSet("+l+")) {\n",o+=ae(e,a,l,t.body),o+="}\n"),o+=`else if (lc.isGeometry(${l})) {\n`,o+=re(e,a,`lang.getGeometryKeys(${l})`,t.body),o+="}\n",o+="else { lastStatement = lc.voidOperation; } \n",o}function ie(e,t){const l=De(e);let o="var "+l+" = "+ne(e,t.right)+";\n";"VariableDeclaration"===t.left.type&&(o+=te(e,t.left));const r=n("VariableDeclaration"===t.left.type?t.left.declarations[0].id:t.left);Se(r);let a="";null!==e.localScope&&(void 0!==e.localScope[r]?a="lscope['"+r+"']":void 0!==e.localScope._SymbolsMap[r]&&(a="lscope['"+e.localScope._SymbolsMap[r]+"']"));let s="";if(""===a)if(void 0!==e.globalScope[r])a="gscope['"+r+"']";else if(void 0!==e.globalScope._SymbolsMap[r])a="gscope['"+e.globalScope._SymbolsMap[r]+"']";else if(null!==e.localScope)if(e.undeclaredGlobalsInFunctions.has(r))a="gscope['"+e.undeclaredGlobalsInFunctions.get(r).manglename+"']",s=e.undeclaredGlobalsInFunctions.get(r).manglename;else{const n={manglename:Re(e),node:t.left};e.undeclaredGlobalsInFunctions.set(r,n),a="gscope['"+n.manglename+"']",s=n.manglename}return s&&(o+="lang.chkAssig('"+s+"',runtimeCtx); \n"),o+="if ("+l+"===null) { lastStatement = lc.voidOperation; }\n ",o+="else if (lc.isArray("+l+") || lc.isString("+l+")) {\n",o+=oe(e,a,`${l}.length`,t.body,((e,n)=>[`if (${n} >= ${l}.length) {`,` lang.error('${c.OutOfBounds}');`,"}",`${e} = ${l}[${n}];`].join("\n"))),o+="}\n",o+="else if (lc.isImmutableArray("+l+")) {\n",o+=oe(e,a,`${l}.length()`,t.body,((e,n)=>`${e} = ${l}.get(${n});`)),o+="}\n",o+="else if (( "+l+" instanceof lang.Dictionary) || lc.isDictionaryLike("+l+")) {\n",o+=re(e,a,`${l}.keys()`,t.body,(e=>`lang.entry(${e}, ${l}.field(${e}))`)),o+="}\n",e.isAsync&&(o+="else if (lc.isFeatureSet("+l+")) {\n",o+=ae(e,a,l,t.body),o+="}\n"),o+=`else if (lc.isGeometry(${l})) {\n`,o+=re(e,a,`lang.getGeometryKeys(${l})`,t.body,(e=>`lang.entry(${e}, lang.geometryMember(${l}, ${e}, runtimeCtx, null, 1))`)),o+="}\n",o+="else { lastStatement = lc.voidOperation; } \n",o}function ce(e,n){let t="lastStatement = lc.voidOperation; \n";null!==n.init&&("VariableDeclaration"===n.init.type?t+=te(e,n.init):t+=ne(e,n.init)+"; ");const l=De(e),o=De(e);return t+="var "+l+" = true; ",t+="\n do { ",null!==n.update&&(t+=" if ("+l+"===false) {\n "+ne(e,n.update)+" \n}\n "+l+"=false; \n"),null!==n.test&&(t+="var "+o+" = "+ne(e,n.test)+"; ",t+="if ("+o+"===false) { break; } else if ("+o+"!==true) { lang.error('"+c.BooleanConditionRequired+"'); }\n"),t+=te(e,n.body),null!==n.update&&(t+="\n "+ne(e,n.update)),t+="\n"+l+" = true; \n} while(true); lastStatement = lc.voidOperation; ",t}function ue(e,t){if("CallExpression"===t.argument.type)throw new u(null,c.NeverReach,t);let l;if("MemberExpression"===t.argument.type){const n=ne(e,t.argument.object);return!0===t.argument.computed?l=ne(e,t.argument.property):(Se(t.argument.property.name),l="'"+t.argument.property.name+"'"),"lang.memberupdate("+n+","+l+",'"+t.operator+"',"+t.prefix+")"}const o=n(t.argument);if(Se(o),null!==e.localScope){if(void 0!==e.localScope[o])return"lang.update(lscope, '"+o+"','"+t.operator+"',"+t.prefix+")";if(void 0!==e.localScope._SymbolsMap[o])return"lang.update(lscope, '"+e.localScope._SymbolsMap[o]+"','"+t.operator+"',"+t.prefix+")"}if(void 0!==e.globalScope[o])return"lang.update(gscope, '"+o+"','"+t.operator+"',"+t.prefix+")";if(void 0!==e.globalScope._SymbolsMap[o])return"lang.update(gscope, '"+e.globalScope._SymbolsMap[o]+"','"+t.operator+"',"+t.prefix+")";if(null!==e.localScope){if(e.undeclaredGlobalsInFunctions.has(o))return"lang.update(gscope,lang.chkAssig( '"+e.undeclaredGlobalsInFunctions.get(o).manglename+"',runtimeCtx),'"+t.operator+"',"+t.prefix+")";const n={manglename:Re(e),node:t.argument};return e.undeclaredGlobalsInFunctions.set(o,n),"lang.update(gscope, lang.chkAssig('"+n.manglename+"',runtimeCtx),'"+t.operator+"',"+t.prefix+")"}throw new u(null,c.InvalidIdentifier,t)}function pe(e,n){let t="lastStatement = lc.voidOperation; \n";const l=De(e);return t+=`\n var ${l} = true;\n do {\n ${l} = ${ne(e,n.test)};\n if (${l}==false) {\n break;\n }\n if (${l}!==true) {\n lang.error('${c.BooleanConditionRequired}');\n }\n ${te(e,n.body)}\n }\n while (${l} !== false);\n lastStatement = lc.voidOperation;\n `,t}function me(e,t){const l=ne(e,t.right);if("MemberExpression"===t.left.type){let n;const o=ne(e,t.left.object);return!0===t.left.computed?n=ne(e,t.left.property):(n="'"+t.left.property.name+"'",Se(t.left.property.name)),"lang.assignmember("+o+","+n+",'"+t.operator+"',"+l+")"}const o=n(t.left);if(Se(o),null!==e.localScope){if(void 0!==e.localScope[o])return"lscope['"+o+"']=lang.assign("+l+",'"+t.operator+"', lscope['"+o+"'])";if(void 0!==e.localScope._SymbolsMap[o])return"lscope['"+e.localScope._SymbolsMap[o]+"']=lang.assign("+l+",'"+t.operator+"', lscope['"+e.localScope._SymbolsMap[o]+"'])"}if(void 0!==e.globalScope[o])return"gscope['"+o+"']=lang.assign("+l+",'"+t.operator+"', gscope['"+o+"'])";if(void 0!==e.globalScope._SymbolsMap[o])return"gscope['"+e.globalScope._SymbolsMap[o]+"']=lang.assign("+l+",'"+t.operator+"', gscope['"+e.globalScope._SymbolsMap[o]+"'])";if(null!==e.localScope){if(e.undeclaredGlobalsInFunctions.has(o))return"gscope[lang.chkAssig('"+e.undeclaredGlobalsInFunctions.get(o).manglename+"',runtimeCtx)]=lang.assign("+l+",'"+t.operator+"', gscope['"+e.undeclaredGlobalsInFunctions.get(o).manglename+"'])";const n={manglename:Re(e),node:t.left};return e.undeclaredGlobalsInFunctions.set(o,n),"gscope[lang.chkAssig('"+n.manglename+"',runtimeCtx)]=lang.assign("+l+",'"+t.operator+"', gscope['"+n.manglename+"'])"}throw new u(null,c.InvalidIdentifier,t)}function ge(e,n){return"AssignmentExpression"===n.expression.type?"lastStatement = lc.voidOperation; "+ne(e,n.expression)+"; \n ":"lastStatement = "+ne(e,n.expression)+"; "}function de(e,n){return"BlockStatement"===n.type?te(e,n):"ReturnStatement"===n.type||"BreakStatement"===n.type||"ContinueStatement"===n.type?te(e,n)+"; ":"ExpressionStatement"===n.type?te(e,n):te(e,n)+"; "}function fe(e,n){return`if (lang.mustBoolean(${ne(e,n.test)}, runtimeCtx) === true) {\n ${de(e,n.consequent)}\n } `+(null!==n.alternate?"IfStatement"===n.alternate.type?" else "+fe(e,n.alternate):` else {\n ${de(e,n.alternate)}\n }\n`:" else {\n lastStatement = lc.voidOperation;\n }\n")}function he(e,n){let t="";for(let l=0;l<n.body.length;l++)"EmptyStatement"!==n.body[l].type&&("ReturnStatement"===n.body[l].type||"BreakStatement"===n.body[l].type||"ContinueStatement"===n.body[l].type?t+=te(e,n.body[l])+"; \n":t+=te(e,n.body[l])+" \n");return t}function ye(e,n){if(null===n.argument)return"return lc.voidOperation";return"return "+ne(e,n.argument)}function be(e,t){const l=n(t.specifiers[0].local);Se(l);const o=e.libraryResolver?.loadLibrary(l),r=Re(e);void 0===e.moduleFactory[o.uri]&&(e.moduleFactory[o.uri]=en(o.syntax,{moduleFactory:e.moduleFactory,libraryResolver:e.libraryResolver},e.isAsync)),e.moduleFactoryMap[r]=o.uri;let a,s="";return s=e.isAsync?"(yield lang.loadModule('"+r+"', runtimeCtx) ); ":"lang.loadModule('"+r+"', runtimeCtx); ",void 0!==e.globalScope[l]?"gscope['"+l+"']="+s:void 0!==e.globalScope._SymbolsMap[l]?"gscope['"+e.globalScope._SymbolsMap[l]+"']="+s:(e.undeclaredGlobalsInFunctions.has(l)?(a=e.undeclaredGlobalsInFunctions.get(l).manglename,e.undeclaredGlobalsInFunctions.delete(l)):a=Re(e),e.globalScope._SymbolsMap[l]=a,e.mangleMap[l]=a,"gscope[lang.setAssig('"+a+"', runtimeCtx)]="+s)}function we(e,t){const l=te(e,t.declaration);if("FunctionDeclaration"===t.declaration.type)e.exports[n(t.declaration.id)]="function";else if("VariableDeclaration"===t.declaration.type)for(const o of t.declaration.declarations)e.exports[n(o.id)]="variable";return l}function Se(e){if("iif"===e)throw new p;if("decode"===e)throw new p;if("when"===e)throw new p;if("defaultvalue"===e)throw new p}function ve(e,t){const l=n(t.id);let o;Se(l);let r=!1;void 0!==e.globalScope[l]?o=l:void 0!==e.globalScope._SymbolsMap[l]?o=e.globalScope._SymbolsMap[l]:e.undeclaredGlobalsInFunctions.has(l)?(o=e.undeclaredGlobalsInFunctions.get(l).manglename,e.globalScope._SymbolsMap[l]=o,e.mangleMap[l]=o,e.undeclaredGlobalsInFunctions.delete(l),r=!0):(o=Re(e),e.globalScope._SymbolsMap[l]=o,e.mangleMap[l]=o);const a={isAsync:e.isAsync,exports:e.exports,undeclaredGlobalsInFunctions:e.undeclaredGlobalsInFunctions,moduleFactory:e.moduleFactory,moduleFactoryMap:e.moduleFactoryMap,libraryResolver:e.libraryResolver,symbols:e.symbols,mangleMap:e.mangleMap,localScope:{_SymbolsMap:{}},depthCounter:e.depthCounter,globalScope:e.globalScope};let s="new lang.UserDefinedCompiledFunction( lang.functionDepthchecker(function() { var lastStatement = lc.voidOperation; \n var lscope = runtimeCtx.localStack[runtimeCtx.localStack.length-1];\n";for(let i=0;i<t.params.length;i++){const l=n(t.params[i]);Se(l);const o=Re(e);a.localScope._SymbolsMap[l]=o,a.mangleMap[l]=o,s+="lscope['"+o+"']=arguments["+i.toString()+"];\n"}return!0===e.isAsync?(s+="return lang.__awaiter(this, void 0, void 0, function* () {\n",s+=he(a,t.body)+"\n return lastStatement; ",s+="}); }",s+=", runtimeCtx),"+t.params.length+")",s+="\n lastStatement = lc.voidOperation; \n"):(s+=he(a,t.body)+"\n return lastStatement; }, runtimeCtx),"+t.params.length+")",s+="\n lastStatement = lc.voidOperation; \n"),r?"gscope[lang.setAssig('"+o+"', runtimeCtx)]="+s:"gscope['"+o+"']="+s}function xe(e,n){const t=[];for(let l=0;l<n.declarations.length;l++)t.push(Me(e,n.declarations[l]));return t.join("\n")+" \n lastStatement= lc.voidOperation; \n"}function Me(e,t){const l=null===t.init?null:ne(e,t.init),o=n(t.id);if(Se(o),null!==e.localScope){if(void 0!==e.localScope[o])return"lscope['"+o+"']="+l+"; ";if(void 0!==e.localScope._SymbolsMap[o])return"lscope['"+e.localScope._SymbolsMap[o]+"']="+l+"; ";const n=Re(e);return e.localScope._SymbolsMap[o]=n,e.mangleMap[o]=n,"lscope['"+n+"']="+l+"; "}if(void 0!==e.globalScope[o])return"gscope['"+o+"']="+l+"; ";if(void 0!==e.globalScope._SymbolsMap[o])return"gscope['"+e.globalScope._SymbolsMap[o]+"']="+l+"; ";if(e.undeclaredGlobalsInFunctions.has(o)){const n=e.undeclaredGlobalsInFunctions.get(o).manglename;return e.globalScope._SymbolsMap[o]=n,e.mangleMap[o]=n,e.undeclaredGlobalsInFunctions.delete(o),"gscope[lang.setAssig('"+n+"', runtimeCtx)]="+l+"; "}const r=Re(e);return e.globalScope._SymbolsMap[o]=r,e.mangleMap[o]=r,"gscope['"+r+"']="+l+"; "}function Fe(e,n){try{let t;return!0===n.computed?t=ne(e,n.property):(Se(n.property.name),t="'"+n.property.name+"'"),"lang.member("+ne(e,n.object)+","+t+")"}catch(t){throw t}}function $e(e,n){try{return"lang.unary("+ne(e,n.argument)+",'"+n.operator+"')"}catch(t){throw t}}function Ce(e,n){try{const t=[];for(let l=0;l<n.elements.length;l++)"Literal"===n.elements[l].type?t.push(ne(e,n.elements[l])):t.push("lang.aCheck("+ne(e,n.elements[l])+",'ArrayExpression')");return"["+t.join(",")+"]"}catch(t){throw t}}function Ie(e,n){try{const t=[];let l=0;for(const o of n.quasis)t.push(o.value?JSON.stringify(o.value.cooked):JSON.stringify("")),!1===o.tail&&(t.push(n.expressions[l]?"lang.castString(lang.aCheck("+ne(e,n.expressions[l])+", 'TemplateLiteral'))":""),l++);return"(["+t.join(",")+"]).join('')"}catch(t){throw t}}function Ae(e,n){try{return"lang.binary("+ne(e,n.left)+","+ne(e,n.right)+",'"+n.operator+"')"}catch(t){throw t}}function _e(e,n){try{if("AssignmentExpression"===n.left.type||"UpdateExpression"===n.left.type)throw new u(null,c.LogicalExpressionOnlyBoolean,n);if("AssignmentExpression"===n.right.type||"UpdateExpression"===n.right.type)throw new u(null,c.LogicalExpressionOnlyBoolean,n);if("&&"===n.operator||"||"===n.operator)return"(lang.logicalCheck("+ne(e,n.left)+") "+n.operator+" lang.logicalCheck("+ne(e,n.right)+"))";throw new u(null,c.LogicExpressionOrAnd,null)}catch(t){throw t}}function Oe(e,t){try{const l=n(t);if(Se(l),null!==e.localScope){if(void 0!==e.localScope[l])return"lscope['"+l+"']";if(void 0!==e.localScope._SymbolsMap[l])return"lscope['"+e.localScope._SymbolsMap[l]+"']"}if(void 0!==e.globalScope[l])return"gscope['"+l+"']";if(void 0!==e.globalScope._SymbolsMap[l])return"gscope['"+e.globalScope._SymbolsMap[l]+"']";if(null!==e.localScope){if(e.undeclaredGlobalsInFunctions.has(l))return"gscope[lang.chkAssig('"+e.undeclaredGlobalsInFunctions.get(l).manglename+"',runtimeCtx)]";const n={manglename:Re(e),node:t};return e.undeclaredGlobalsInFunctions.set(l,n),"gscope[lang.chkAssig('"+n.manglename+"',runtimeCtx)]"}throw new u(null,c.InvalidIdentifier,t)}catch(l){throw l}}function ke(e,t){try{if("MemberExpression"===t.callee.type){let n;!0===t.callee.computed?n=ne(e,t.callee.property):(Se(t.callee.property.name),n="'"+t.callee.property.name+"'");let l="[";for(let o=0;o<t.arguments.length;o++)o>0&&(l+=", "),l+=ne(e,t.arguments[o]);return l+="]",e.isAsync?"(yield lang.callModuleFunction("+ne(e,t.callee.object)+","+l+","+n+",runtimeCtx))":"lang.callModuleFunction("+ne(e,t.callee.object)+","+l+","+n+",runtimeCtx)"}if("Identifier"!==t.callee.type)throw new u(null,c.FunctionNotFound,t);const l=n(t.callee);if("iif"===l)return Ge(e,t);if("when"===l)return je(e,t);if("defaultvalue"===l)return Ee(e,t);if("decode"===l)return Be(e,t);let o="";if(null!==e.localScope&&(void 0!==e.localScope[l]?o="lscope['"+l+"']":void 0!==e.localScope._SymbolsMap[l]&&(o="lscope['"+e.localScope._SymbolsMap[l]+"']")),""===o)if(void 0!==e.globalScope[l])o="gscope['"+l+"']";else if(void 0!==e.globalScope._SymbolsMap[l])o="gscope['"+e.globalScope._SymbolsMap[l]+"']";else if(null!==e.localScope)if(e.undeclaredGlobalsInFunctions.has(l))o="gscope[lang.chkAssig('"+e.undeclaredGlobalsInFunctions.get(l).manglename+"',runtimeCtx)]";else{const n={manglename:Re(e),node:t.callee};e.undeclaredGlobalsInFunctions.set(l,n),o="gscope[lang.chkAssig('"+n.manglename+"',runtimeCtx)]"}if(""!==o){let n="[";for(let l=0;l<t.arguments.length;l++)l>0&&(n+=", "),n+=ne(e,t.arguments[l]);return n+="]",e.isAsync?"(yield lang.callfunc("+o+","+n+",runtimeCtx) )":"lang.callfunc("+o+","+n+",runtimeCtx)"}throw new u(null,c.FunctionNotFound,t)}catch(l){throw l}}function Ge(e,n){try{if(3!==n.arguments.length)throw new u(null,c.WrongNumberOfParameters,n);const t=De(e);return`${e.isAsync?"(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {":"function() {"}\n var ${t} = ${ne(e,n.arguments[0])};\n\n if (${t} === true) {\n return ${ne(e,n.arguments[1])};\n }\n else if (${t} === false) {\n return ${ne(e,n.arguments[2])};\n }\n else {\n lang.error('ExecutionErrorCodes.BooleanConditionRequired');\n }\n ${e.isAsync?"})}()))":"}()"}`}catch(t){throw t}}function Ee(e,n){try{if(n.arguments.length<2||n.arguments.length>3)throw new u(null,c.WrongNumberOfParameters,n);const t=De(e),l=De(e);return 3===n.arguments.length?`${e.isAsync?"(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {":"function() {"}\n var ${t} = ${ne(e,n.arguments[0])};\n var ${l} = ${ne(e,n.arguments[1])};\n ${t} = lang.getNestedOptionalValue(${t}, ${l});\n return ${t} != null && ${t} !== "" ? ${t} : ${ne(e,n.arguments[2])};\n ${e.isAsync?"})}()))":"}()"}`:`${e.isAsync?"(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {":"function() {"}\n var ${t} = ${ne(e,n.arguments[0])};\n if (${t} === null) {\n return ${ne(e,n.arguments[1])};\n }\n if (${t} === "") {\n return ${ne(e,n.arguments[1])};\n }\n if (${t} === undefined) {\n return ${ne(e,n.arguments[1])};\n }\n return ${t};\n ${e.isAsync?"})}()))":"}()"}`}catch(t){throw t}}function je(e,n){try{if(n.arguments.length<3)throw new u(null,c.WrongNumberOfParameters,n);if(n.arguments.length%2==0)throw new u(null,c.WrongNumberOfParameters,n);const t=De(e);let l="var ";for(let o=0;o<n.arguments.length-1;o+=2)l+=`${t} = lang.mustBoolean(${ne(e,n.arguments[o])}, runtimeCtx);\n if (${t} === true ) {\n return ${ne(e,n.arguments[o+1])}\n }\n`;return`${e.isAsync?"(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {":"function() {"}\n ${l}\n return ${ne(e,n.arguments[n.arguments.length-1])}\n ${e.isAsync?"})}()))":"}()"}`}catch(t){throw t}}function Be(e,n){try{if(n.arguments.length<2)throw new u(null,c.WrongNumberOfParameters,n);if(2===n.arguments.length)return`(${ne(e,n.arguments[1])})`;if((n.arguments.length-1)%2==0)throw new u(null,c.WrongNumberOfParameters,n);const t=De(e),l=De(e);let o="var ";for(let r=1;r<n.arguments.length-1;r+=2)o+=`${l} = ${ne(e,n.arguments[r])};\n if (lang.binary(${l}, ${t}, "==") === true ) {\n return ${ne(e,n.arguments[r+1])}\n }\n`;return`${e.isAsync?"(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {":"function() {"}\n var ${t} = ${ne(e,n.arguments[0])};\n ${o}\n return ${ne(e,n.arguments[n.arguments.length-1])}\n ${e.isAsync?"})}()))":"}()"}`}catch(t){throw t}}const Ne={};function Re(e){return e.symbols.symbolCounter++,`_T${e.symbols.symbolCounter}`}function De(e){return e.symbols.symbolCounter++,`_Tvar${e.symbols.symbolCounter}`}R(Ne,ee),W(Ne,ee),D(Ne,ee,Ze),K(Ne,ee),L(Ne,ee),P(Ne,ee),Ne.iif=function(e,n){try{return ee(e,n,((t,l,o)=>{throw new i(e,c.Unrecognized,n)}))}catch(t){throw t}},Ne.decode=function(e,n){try{return ee(e,n,((t,l,o)=>{throw new i(e,c.Unrecognized,n)}))}catch(t){throw t}},Ne.when=function(e,n){try{return ee(e,n,((t,l,o)=>{throw new i(e,c.Unrecognized,n)}))}catch(t){throw t}},Ne.defaultvalue=function(e,n){try{return ee(e,n,((t,l,o)=>{throw new i(e,c.Unrecognized,n)}))}catch(t){throw t}};const Le={};for(const nn in Ne)Le[nn]=new g(Ne[nn]);U(Ne,ee);for(const nn in Ne)Ne[nn]=new g(Ne[nn]);const Ue=function(){};Ue.prototype=Ne;const Ke=function(){};function Pe(e,n,t){const l={_SymbolsMap:{}};e||(e={}),t||(t={}),l.textformatting=1,l.infinity=1,l.pi=1;for(const o in n)l[o]=1;for(const o in t)l[o]=1;for(const o in e)l[o]=1;return l}function We(e,n,t,l){const o=t?new Ke:new Ue;e||(e={}),n||(n={});const r=new s({newline:"\n",tab:"\t",singlequote:"'",doublequote:'"',forwardslash:"/",backwardslash:"\\"});r.immutable=!1,o._SymbolsMap={textformatting:1,infinity:1,pi:1},o.textformatting=r,o.infinity=Number.POSITIVE_INFINITY,o.pi=Math.PI;for(const a in n)o[a]=n[a],o._SymbolsMap[a]=1;for(const a in e){const n=e[a];o._SymbolsMap[a]=1,Z(n)?o[a]=m.createFromGraphic(n,l??null):o[a]=n}return o}Ke.prototype=Le;const Te={fixSpatialReference:b,parseArguments:X,standardFunction:ee};function Ve(e,n){const t={mode:n,compiled:!0,functions:{},signatures:[],standardFunction:ee,standardFunctionAsync:ee,evaluateIdentifier:Ze};for(let l=0;l<e.length;l++)e[l].registerFunctions(t);if("sync"===n){for(const e in t.functions)Ne[e]=new g(t.functions[e]),Ue.prototype[e]=Ne[e];for(let e=0;e<t.signatures.length;e++)B(t.signatures[e],"sync")}else{for(const e in t.functions)Le[e]=new g(t.functions[e]),Ke.prototype[e]=Le[e];for(let e=0;e<t.signatures.length;e++)B(t.signatures[e],"async")}}function qe(e,n){return e(n)}function Ze(e,n){const t=n.name;if("_SymbolsMap"===t)throw new i(e,c.InvalidIdentifier,null);if(e.localStack.length>0){const n=e.localStack[e.localStack.length-1];if(!t.toLowerCase().startsWith("_t")&&void 0!==n[t])return n[t];const l=e.mangleMap[t];if(void 0!==l&&void 0!==n[l])return n[l]}if(!t.toLowerCase().startsWith("_t")&&void 0!==e.globalScope[t])return e.globalScope[t];if(1===e.globalScope._SymbolsMap[t])return e.globalScope[t];const l=e.mangleMap[t];return void 0!==l?e.globalScope[l]:void 0}Ve([N],"sync"),Ve([N],"async");let ze=0;const Je={isNumber:e=>z(e),isArray:e=>J(e),isImmutableArray:e=>$(e),isDictionaryLike:e=>C(e),isString:e=>Y(e),isDictionary:e=>I(e),isGeometry:e=>A(e),getGeometryKeys:e=>o(e),geometryMember:(e,n,t,l,o=1)=>r(e,n,t,l,o),error(e){throw new i(null,e,null)},__awaiter:(e,n,t,l)=>new Promise(((t,o)=>{function r(e){try{s(l.next(e))}catch(n){o(n)}}function a(e){try{s(l.throw(e))}catch(n){o(n)}}function s(e){e.done?t(e.value):e.value?.then?e.value.then(r,a):(ze++,ze%100==0?setTimeout((()=>{ze=0,r(e.value)}),0):r(e.value))}s((l=l.apply(e,n||[])).next())})),functionDepthchecker:(e,n)=>function(){if(n.depthCounter.depth++,n.localStack.push({}),n.depthCounter.depth>64)throw new i(null,c.MaximumCallDepth,null);const t=e.apply(this,arguments);return T(t)?t.then((e=>(n.depthCounter.depth--,n.localStack.length=n.localStack.length-1,e))):(n.depthCounter.depth--,n.localStack.length=n.localStack.length-1,t)},chkAssig(e,n){if(void 0===n.gdefs[e])throw new i(n,c.InvalidIdentifier,null);return e},mustBoolean(e,n){if(!0===e||!1===e)return e;throw new i(n,c.BooleanConditionRequired,null)},setAssig:(e,n)=>(n.gdefs[e]=1,e),castString:e=>_(e),aCheck(e,n){if(y(e)){if("ArrayExpression"===n)throw new i(null,c.NoFunctionInArray,null);if("ObjectExpression"===n)throw new i(null,c.NoFunctionInDictionary,null);throw new i(null,c.NoFunctionInTemplateLiteral,null)}return e===x?null:e},Dictionary:s,Feature:m,UserDefinedCompiledFunction:Q,dictionary(e){const n={},t=new Map;for(let o=0;o<e.length;o+=2){if(y(e[o+1]))throw new i(null,c.NoFunctionInDictionary,null);if(!1===Y(e[o]))throw new i(null,c.KeyMustBeString,null);let l=e[o].toString();const r=l.toLowerCase();t.has(r)?l=t.get(r):t.set(r,l),e[o+1]===x?n[l]=null:n[l]=e[o+1]}const l=new s(n);return l.immutable=!1,l},entry:(e,n)=>new s({key:e,value:n}),strCheck(e){if(!1===Y(e))throw new i(null,c.KeyMustBeString,null);return e},unary(e,n){if(H(e)){if("!"===n)return!e;if("-"===n)return-1*O(e);if("+"===n)return 1*O(e);if("~"===n)return~O(e);throw new i(null,c.UnsupportedUnaryOperator,null)}if("-"===n)return-1*O(e);if("+"===n)return 1*O(e);if("~"===n)return~O(e);throw new i(null,c.UnsupportedUnaryOperator,null)},logicalCheck(e){if(!1===H(e))throw new i(null,c.LogicExpressionOrAnd,null);return e},logical(e,n,t){if(H(e)&&H(n))switch(t){case"||":return e||n;case"&&":return e&&n;default:throw new i(null,c.LogicExpressionOrAnd,null)}throw new i(null,c.LogicExpressionOrAnd,null)},binary(e,n,t){switch(t){case"|":case"<<":case">>":case">>>":case"^":case"&":return E(O(e),O(n),t);case"==":case"=":return G(e,n);case"!=":return!G(e,n);case"<":case">":case"<=":case">=":return k(e,n,t);case"+":return Y(e)||Y(n)?_(e)+_(n):O(e)+O(n);case"-":return O(e)-O(n);case"*":return O(e)*O(n);case"/":return O(e)/O(n);case"%":return O(e)%O(n);default:throw new i(null,c.UnsupportedOperator,null)}},assign(e,n,t){switch(n){case"=":return e===x?null:e;case"/=":return O(t)/O(e);case"*=":return O(t)*O(e);case"-=":return O(t)-O(e);case"+=":return Y(t)||Y(e)?_(t)+_(e):O(t)+O(e);case"%=":return O(t)%O(e);default:throw new i(null,c.UnsupportedOperator,null)}},update(e,n,t,l){const o=O(e[n]);return e[n]="++"===t?o+1:o-1,!1===l?o:"++"===t?o+1:o-1},graphicToFeature:(e,n,t)=>null===e?null:m.createFromGraphicLikeObject(e.geometry,e.attributes,n,t.timeZone),memberupdate(e,n,t,l){let o;if(J(e)){if(!z(n))throw new i(null,c.ArrayAccessorMustBeNumber,null);if(n<0&&(n=e.length+n),n<0||n>=e.length)throw new i(null,c.OutOfBounds,null);o=O(e[n]),e[n]="++"===t?o+1:o-1}else if(e instanceof s){if(!1===Y(n))throw new i(null,c.KeyAccessorMustBeString,null);if(!0!==e.hasField(n))throw new i(null,c.FieldNotFound,null,{key:n});o=O(e.field(n)),e.setField(n,"++"===t?o+1:o-1)}else if(j(e)){if(!1===Y(n))throw new i(null,c.KeyAccessorMustBeString,null);if(!0!==e.hasField(n))throw new i(null,c.FieldNotFound,null);o=O(e.field(n)),e.setField(n,"++"===t?o+1:o-1)}else{if($(e))throw new i(null,c.Immutable,null);if(!(e instanceof Xe))throw new i(null,c.InvalidIdentifier,null);if(!1===Y(n))throw new i(null,c.ModuleAccessorMustBeString,null);if(!0!==e.hasGlobal(n))throw new i(null,c.ModuleExportNotFound,null);o=O(e.global(n)),e.setGlobal(n,"++"===t?o+1:o-1)}return!1===l?o:"++"===t?o+1:o-1},assignmember(e,n,t,l){if(J(e)){if(!z(n))throw new i(null,c.ArrayAccessorMustBeNumber,null);if(n<0&&(n=e.length+n),n<0||n>e.length)throw new i(null,c.OutOfBounds,null);if(n===e.length){if("="!==t)throw new i(null,c.OutOfBounds,null);e[n]=this.assign(l,t,e[n])}else e[n]=this.assign(l,t,e[n])}else if(e instanceof s){if(!1===Y(n))throw new i(null,c.KeyAccessorMustBeString,null);if(!0===e.hasField(n))e.setField(n,this.assign(l,t,e.field(n)));else{if("="!==t)throw new i(null,c.FieldNotFound,null);e.setField(n,this.assign(l,t,null))}}else if(j(e)){if(!1===Y(n))throw new i(null,c.KeyAccessorMustBeString,null);if(!0===e.hasField(n))e.setField(n,this.assign(l,t,e.field(n)));else{if("="!==t)throw new i(null,c.FieldNotFound,null);e.setField(n,this.assign(l,t,null))}}else{if($(e))throw new i(null,c.Immutable,null);if(!(e instanceof Xe))throw new i(null,c.InvalidIdentifier,null);if(!1===Y(n))throw new i(null,c.ModuleAccessorMustBeString,null);if(!e.hasGlobal(n))throw new i(null,c.ModuleExportNotFound,null);e.setGlobal(n,this.assign(l,t,e.global(n)))}},member(e,n){if(null===e)throw new i(null,c.MemberOfNull,null);if(e instanceof s||C(e)){if(Y(n))return e.field(n);throw new i(null,c.InvalidMemberAccessKey,null)}if(e instanceof V){if(Y(n))return r(e,n,null,null);throw new i(null,c.InvalidMemberAccessKey,null)}if(J(e)){if(z(n)&&isFinite(n)&&Math.floor(n)===n){if(n<0&&(n=e.length+n),n>=e.length||n<0)throw new i(null,c.OutOfBounds,null);return e[n]}throw new i(null,c.InvalidMemberAccessKey,null)}if(Y(e)){if(z(n)&&isFinite(n)&&Math.floor(n)===n){if(n<0&&(n=e.length+n),n>=e.length||n<0)throw new i(null,c.OutOfBounds,null);return e[n]}throw new i(null,c.InvalidMemberAccessKey,null)}if($(e)){if(z(n)&&isFinite(n)&&Math.floor(n)===n){if(n<0&&(n=e.length()+n),n>=e.length()||n<0)throw new i(null,c.OutOfBounds,null);return e.get(n)}throw new i(null,c.InvalidMemberAccessKey,null)}if(e instanceof Xe){if(Y(n))return e.global(n);throw new i(null,c.InvalidMemberAccessKey,null)}throw new i(null,c.InvalidMemberAccessKey,null)},callfunc:(e,n,t)=>e.call(t,{arguments:n,preparsed:!0}),loadModule(e,n){const t=n.moduleFactoryMap[e];if(n.moduleSingletons[t])return n.moduleSingletons[t];const l=n.moduleFactory[t]({moduleSingletons:n.moduleSingletons,depthCounter:n.depthCounter,lrucache:n.lrucache,interceptor:n.interceptor,services:n.services,console:n.console,abortSignal:n.abortSignal,timeZone:n.timeZone??null,spatialReference:n.spatialReference});return n.moduleSingletons[t]=l,l},callModuleFunction(e,n,t,l){if(!(e instanceof Xe))throw new i(null,c.FunctionNotFound,null);const o=e.global(t);if(!1===y(o))throw new i(null,c.CallNonFunction,null);return o.call(l,{preparsed:!0,arguments:n})},getNestedOptionalValue:(e,n)=>a(e,n)};function Ye(e){console.log(e)}function He(n,t,o=!1){null==t&&(t={vars:{},customfunctions:{}});let r=null;n.usesModules&&(r=new l(null,n.loadedModules));const a={isAsync:o,globalScope:Pe(t.vars,o?Le:Ne,t.customfunctions),moduleFactory:{},moduleFactoryMap:{},undeclaredGlobalsInFunctions:new Map,libraryResolver:r,localScope:null,mangleMap:{},depthCounter:{depth:1},exports:{},symbols:{symbolCounter:0}};let s=he(a,n);""===s&&(s="lc.voidOperation; "),a.undeclaredGlobalsInFunctions.size>0&&a.undeclaredGlobalsInFunctions.forEach((e=>{throw new u(null,c.InvalidIdentifier,e.node)}));let p="";p=o?"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"+s+"\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 "+s+"\n return lastStatement; } \n return this.postProcess(mainBody()); ";const m=a.moduleFactory,g=a.moduleFactoryMap,d=a.exports,f={};let h;for(h in d)f[h]=a.mangleMap[h]??h;const b={lc:w,lang:Je,mangles:a.mangleMap,postProcess(e){if(e instanceof S&&(e=e.value),e instanceof v&&(e=e.value),e===x&&(e=null),e===M)throw new i(null,c.IllegalResult,null);if(e===F)throw new i(null,c.IllegalResult,null);if(y(e))throw new i(null,c.IllegalResult,null);return e},prepare(n,t){const l=n.spatialReference??q.WebMercator,o=We(n.vars,n.customfunctions,t,n.timeZone);return{localStack:[],moduleFactory:m,moduleFactoryMap:g,mangleMap:this.mangles,moduleSingletons:{},exports:d,gdefs:{},exportmangle:f,spatialReference:l,globalScope:o,abortSignal:n.abortSignal??e,services:n.services,console:n.console??Ye,lrucache:n.lrucache,timeZone:n.timeZone??null,interceptor:n.interceptor,depthCounter:{depth:1}}}};return new Function("context",p).bind(b)}async function Qe(){return Ve([await import("./functions/geomasync.js")],"async"),!0}class Xe extends t{constructor(e){super(),this.moduleContext=e}hasGlobal(e){return void 0===this.moduleContext.exports[e]&&(e=e.toLowerCase()),void 0!==this.moduleContext.exports[e]}setGlobal(e,n){const t=this.moduleContext.globalScope,l=e.toLowerCase();if(y(n))throw new i(null,c.AssignModuleFunction,null);t[this.moduleContext.exportmangle[l]]=n}global(e){const n=this.moduleContext.globalScope,t=e.toLowerCase(),l=n[this.moduleContext.exportmangle[t]];if(void 0===l)throw new i(null,c.InvalidIdentifier,null);if(y(l)&&!(l instanceof f)){const e=new f;return e.fn=l,e.parameterEvaluator=ee,e.context=this.moduleContext,n[this.moduleContext.exportmangle[t]]=e,e}return l}}function en(n,t,o){const r={isAsync:o,moduleFactory:t.moduleFactory,moduleFactoryMap:{},libraryResolver:new l(null,n.loadedModules),globalScope:Pe(null,o?Le:Ne,null),localScope:null,mangleMap:{},undeclaredGlobalsInFunctions:new Map,depthCounter:{depth:1},exports:{},symbols:{symbolCounter:0}};let a=he(r,n);""===a&&(a="lc.voidOperation; ");let s="";s=o?"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"+a+"\n return lastStatement; }); } \n yield mainBody(); \n return this.prepareModule(runtimeCtx); }); ":"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 "+a+"\n return lastStatement; } \n mainBody(); \n return this.prepareModule(runtimeCtx); ";const i=r.moduleFactory,c=r.moduleFactoryMap,u=r.exports,p={};let m;for(m in u)p[m]=r.mangleMap[m]??m;const g={lc:w,lang:Je,mangles:r.mangleMap,prepareModule:e=>new Xe(e),prepare(n,t){const l=n.spatialReference??q.WebMercator,o=We(null,null,t,n.timeZone);return{localStack:[],exports:u,exportmangle:p,gdefs:{},moduleFactory:i,moduleFactoryMap:c,moduleSingletons:n.moduleSingletons,mangleMap:this.mangles,spatialReference:l,globalScope:o,abortSignal:n.abortSignal??e,services:n.services,console:n.console??Ye,lrucache:n.lrucache,timeZone:n.timeZone??null,interceptor:n.interceptor,depthCounter:n.depthCounter}}};return new Function("context",s).bind(g)}export{Q as UserDefinedCompiledFunction,He as compileScript,Qe as enableAsyncSupport,qe as executeScript,Ve as extend,Te as functionHelper};
5
+ import{neverAbortedSignal as e,toSymbolId as n}from"./arcadeEnvironment.js";import{ArcadeModule as t}from"./ArcadeModule.js";import{ArcadeModuleLoader as l}from"./ArcadeModuleLoader.js";import{getGeometryKeys as o,geometryMember as r,getNestedOptionalValue as a}from"./containerUtils.js";import s from"./Dictionary.js";import{ArcadeExecutionError as i,ExecutionErrorCodes as c,ArcadeCompilationError as u,ArcadeUncompilableError as p}from"./executionError.js";import m from"./Feature.js";import{NativeFunction as g,ArcadeFunction as d,ScopeMarshalledFunction as f,wrapModuleScopedResponse as h}from"./FunctionWrapper.js";import{i as y,u as b,v as w,R as S,I as v,w as x,x as M,y as F,m as $,z as C,q as I,l as A,f as _,t as O,A as k,B as G,C as E,n as j}from"../chunks/languageUtils.js";import{addFunctionDeclaration as B}from"./treeAnalysis.js";import{A as N}from"../chunks/array.js";import{registerFunctions as R}from"./functions/date.js";import{registerFunctions as D}from"./functions/feature.js";import{registerFunctions as L}from"./functions/geometry.js";import{registerFunctions as U}from"./functions/geomsync.js";import{registerFunctions as K}from"./functions/maths.js";import{registerFunctions as P}from"./functions/stats.js";import{registerFunctions as W}from"./functions/string.js";import{isPromiseLike as V}from"../core/promiseUtils.js";import q from"../geometry/Geometry.js";import T from"../geometry/SpatialReference.js";import{isGraphic as Z,isNumber as z,isArray as J,isString as Y,isBoolean as H}from"../support/guards.js";class Q extends d{constructor(e,n){super(),this.paramCount=n,this.fn=e}createFunction(e){return(...n)=>{if(n.length!==this.paramCount)throw new i(e,c.WrongNumberOfParameters,null);return this.fn(...n)}}call(e,n){return this.fn(...n.arguments)}marshalledCall(e,n,t,l){return l(e,n,((n,o,r)=>{r=r.map((n=>!y(n)||n instanceof f?n:h(n,e,l)));const a=this.call(t,{arguments:r});return V(a)?a.then((e=>h(e,t,l))):a}))}}function X(e,n){const t=[];for(let l=0;l<n.arguments.length;l++)t.push(ne(e,n.arguments[l]));return t}function ee(e,n,t){try{return t(e,null,n.arguments)}catch(l){throw l}}function ne(e,n){switch(n.type){case"AssignmentExpression":return me(e,n);case"UpdateExpression":return ue(e,n);case"TemplateLiteral":return Ie(e,n);case"Identifier":return Oe(e,n);case"MemberExpression":return Fe(e,n);case"Literal":return null===n.value||void 0===n.value?"null":JSON.stringify(n.value);case"CallExpression":return ke(e,n);case"UnaryExpression":return $e(e,n);case"BinaryExpression":return Ae(e,n);case"LogicalExpression":return _e(e,n);case"ArrayExpression":return Ce(e,n);case"ObjectExpression":return le(e,n);default:throw new u(null,c.Unrecognized,n)}}function te(e,n){switch(n.type){case"EmptyStatement":return"lc.voidOperation";case"VariableDeclaration":return xe(e,n);case"BlockStatement":return he(e,n);case"FunctionDeclaration":return ve(e,n);case"ImportDeclaration":return be(e,n);case"ExportNamedDeclaration":return we(e,n);case"ReturnStatement":return ye(e,n);case"IfStatement":return fe(e,n);case"ExpressionStatement":return ge(e,n);case"BreakStatement":return"break";case"ContinueStatement":return"continue";case"ForStatement":return ce(e,n);case"ForInStatement":return se(e,n);case"ForOfStatement":return ie(e,n);case"WhileStatement":return pe(e,n);default:throw new u(null,c.Unrecognized,n)}}function le(e,n){let t="lang.dictionary([";for(let l=0;l<n.properties.length;l++){const o=n.properties[l];let r;"Identifier"===o.key.type?(Se(o.key.name),r="'"+o.key.name+"'"):r=ne(e,o.key);l>0&&(t+=","),t+="lang.strCheck("+r+",'ObjectExpression'),lang.aCheck("+ne(e,o.value)+", 'ObjectExpression')"}return t+="])",t}function oe(e,n,t,l,o=(e,n)=>`${e} = ${n}`){const r=De(e),a=De(e);return[`var ${r} = ${t};`,`for (var ${a} = 0; ${a} < ${r}; ${a}++) {`,` ${o(n,a)}`,` ${te(e,l)}`,"}","lastStatement = lc.voidOperation;"].join("\n")}function re(e,n,t,l,o=e=>e){const r=De(e),a=De(e);return[`var ${r} = ${t};`,`for (var ${a} of ${r}) {`,` ${n} = ${o(a)};`,` ${te(e,l)}`,"}","lastStatement = lc.voidOperation;"].join("\n")}function ae(e,n,t,l){const o=De(e);return[`var ${o} = ${t}.iterator(runtimeCtx.abortSignal);`,`while ((${n} = lang.graphicToFeature(yield ${o}.next(), ${t}, runtimeCtx)) != null) {`,` ${te(e,l)}`,"}","lastStatement = lc.voidOperation;"].join("\n")}function se(e,t){const l=De(e);let o="var "+l+" = "+ne(e,t.right)+";\n";"VariableDeclaration"===t.left.type&&(o+=te(e,t.left));const r=n("VariableDeclaration"===t.left.type?t.left.declarations[0].id:t.left);Se(r);let a="";null!==e.localScope&&(void 0!==e.localScope[r]?a="lscope['"+r+"']":void 0!==e.localScope._SymbolsMap[r]&&(a="lscope['"+e.localScope._SymbolsMap[r]+"']"));let s="";if(""===a)if(void 0!==e.globalScope[r])a="gscope['"+r+"']";else if(void 0!==e.globalScope._SymbolsMap[r])a="gscope['"+e.globalScope._SymbolsMap[r]+"']";else if(null!==e.localScope)if(e.undeclaredGlobalsInFunctions.has(r))a="gscope['"+e.undeclaredGlobalsInFunctions.get(r).manglename+"']",s=e.undeclaredGlobalsInFunctions.get(r).manglename;else{const n={manglename:Re(e),node:t.left};e.undeclaredGlobalsInFunctions.set(r,n),a="gscope['"+n.manglename+"']",s=n.manglename}return s&&(o+="lang.chkAssig('"+s+"',runtimeCtx); \n"),o+="if ("+l+"===null) { lastStatement = lc.voidOperation; }\n ",o+="else if (lc.isArray("+l+") || lc.isString("+l+")) {\n",o+=oe(e,a,`${l}.length`,t.body),o+="}\n",o+="else if (lc.isImmutableArray("+l+")) {\n",o+=oe(e,a,`${l}.length()`,t.body),o+="}\n",o+="else if (( "+l+" instanceof lang.Dictionary) || lc.isDictionaryLike("+l+")) {\n",o+=re(e,a,`${l}.keys()`,t.body),o+="}\n",e.isAsync&&(o+="else if (lc.isFeatureSet("+l+")) {\n",o+=ae(e,a,l,t.body),o+="}\n"),o+=`else if (lc.isGeometry(${l})) {\n`,o+=re(e,a,`lang.getGeometryKeys(${l})`,t.body),o+="}\n",o+="else { lastStatement = lc.voidOperation; } \n",o}function ie(e,t){const l=De(e);let o="var "+l+" = "+ne(e,t.right)+";\n";"VariableDeclaration"===t.left.type&&(o+=te(e,t.left));const r=n("VariableDeclaration"===t.left.type?t.left.declarations[0].id:t.left);Se(r);let a="";null!==e.localScope&&(void 0!==e.localScope[r]?a="lscope['"+r+"']":void 0!==e.localScope._SymbolsMap[r]&&(a="lscope['"+e.localScope._SymbolsMap[r]+"']"));let s="";if(""===a)if(void 0!==e.globalScope[r])a="gscope['"+r+"']";else if(void 0!==e.globalScope._SymbolsMap[r])a="gscope['"+e.globalScope._SymbolsMap[r]+"']";else if(null!==e.localScope)if(e.undeclaredGlobalsInFunctions.has(r))a="gscope['"+e.undeclaredGlobalsInFunctions.get(r).manglename+"']",s=e.undeclaredGlobalsInFunctions.get(r).manglename;else{const n={manglename:Re(e),node:t.left};e.undeclaredGlobalsInFunctions.set(r,n),a="gscope['"+n.manglename+"']",s=n.manglename}return s&&(o+="lang.chkAssig('"+s+"',runtimeCtx); \n"),o+="if ("+l+"===null) { lastStatement = lc.voidOperation; }\n ",o+="else if (lc.isArray("+l+") || lc.isString("+l+")) {\n",o+=oe(e,a,`${l}.length`,t.body,((e,n)=>[`if (${n} >= ${l}.length) {`,` lang.error('${c.OutOfBounds}');`,"}",`${e} = ${l}[${n}];`].join("\n"))),o+="}\n",o+="else if (lc.isImmutableArray("+l+")) {\n",o+=oe(e,a,`${l}.length()`,t.body,((e,n)=>`${e} = ${l}.get(${n});`)),o+="}\n",o+="else if (( "+l+" instanceof lang.Dictionary) || lc.isDictionaryLike("+l+")) {\n",o+=re(e,a,`${l}.keys()`,t.body,(e=>`lang.entry(${e}, ${l}.field(${e}))`)),o+="}\n",e.isAsync&&(o+="else if (lc.isFeatureSet("+l+")) {\n",o+=ae(e,a,l,t.body),o+="}\n"),o+=`else if (lc.isGeometry(${l})) {\n`,o+=re(e,a,`lang.getGeometryKeys(${l})`,t.body,(e=>`lang.entry(${e}, lang.geometryMember(${l}, ${e}, runtimeCtx, null, 1))`)),o+="}\n",o+="else { lastStatement = lc.voidOperation; } \n",o}function ce(e,n){let t="lastStatement = lc.voidOperation; \n";null!==n.init&&("VariableDeclaration"===n.init.type?t+=te(e,n.init):t+=ne(e,n.init)+"; ");const l=De(e),o=De(e);return t+="var "+l+" = true; ",t+="\n do { ",null!==n.update&&(t+=" if ("+l+"===false) {\n "+ne(e,n.update)+" \n}\n "+l+"=false; \n"),null!==n.test&&(t+="var "+o+" = "+ne(e,n.test)+"; ",t+="if ("+o+"===false) { break; } else if ("+o+"!==true) { lang.error('"+c.BooleanConditionRequired+"'); }\n"),t+=te(e,n.body),null!==n.update&&(t+="\n "+ne(e,n.update)),t+="\n"+l+" = true; \n} while(true); lastStatement = lc.voidOperation; ",t}function ue(e,t){if("CallExpression"===t.argument.type)throw new u(null,c.NeverReach,t);let l;if("MemberExpression"===t.argument.type){const n=ne(e,t.argument.object);return!0===t.argument.computed?l=ne(e,t.argument.property):(Se(t.argument.property.name),l="'"+t.argument.property.name+"'"),"lang.memberupdate("+n+","+l+",'"+t.operator+"',"+t.prefix+")"}const o=n(t.argument);if(Se(o),null!==e.localScope){if(void 0!==e.localScope[o])return"lang.update(lscope, '"+o+"','"+t.operator+"',"+t.prefix+")";if(void 0!==e.localScope._SymbolsMap[o])return"lang.update(lscope, '"+e.localScope._SymbolsMap[o]+"','"+t.operator+"',"+t.prefix+")"}if(void 0!==e.globalScope[o])return"lang.update(gscope, '"+o+"','"+t.operator+"',"+t.prefix+")";if(void 0!==e.globalScope._SymbolsMap[o])return"lang.update(gscope, '"+e.globalScope._SymbolsMap[o]+"','"+t.operator+"',"+t.prefix+")";if(null!==e.localScope){if(e.undeclaredGlobalsInFunctions.has(o))return"lang.update(gscope,lang.chkAssig( '"+e.undeclaredGlobalsInFunctions.get(o).manglename+"',runtimeCtx),'"+t.operator+"',"+t.prefix+")";const n={manglename:Re(e),node:t.argument};return e.undeclaredGlobalsInFunctions.set(o,n),"lang.update(gscope, lang.chkAssig('"+n.manglename+"',runtimeCtx),'"+t.operator+"',"+t.prefix+")"}throw new u(null,c.InvalidIdentifier,t)}function pe(e,n){let t="lastStatement = lc.voidOperation; \n";const l=De(e);return t+=`\n var ${l} = true;\n do {\n ${l} = ${ne(e,n.test)};\n if (${l}==false) {\n break;\n }\n if (${l}!==true) {\n lang.error('${c.BooleanConditionRequired}');\n }\n ${te(e,n.body)}\n }\n while (${l} !== false);\n lastStatement = lc.voidOperation;\n `,t}function me(e,t){const l=ne(e,t.right);if("MemberExpression"===t.left.type){let n;const o=ne(e,t.left.object);return!0===t.left.computed?n=ne(e,t.left.property):(n="'"+t.left.property.name+"'",Se(t.left.property.name)),"lang.assignmember("+o+","+n+",'"+t.operator+"',"+l+")"}const o=n(t.left);if(Se(o),null!==e.localScope){if(void 0!==e.localScope[o])return"lscope['"+o+"']=lang.assign("+l+",'"+t.operator+"', lscope['"+o+"'])";if(void 0!==e.localScope._SymbolsMap[o])return"lscope['"+e.localScope._SymbolsMap[o]+"']=lang.assign("+l+",'"+t.operator+"', lscope['"+e.localScope._SymbolsMap[o]+"'])"}if(void 0!==e.globalScope[o])return"gscope['"+o+"']=lang.assign("+l+",'"+t.operator+"', gscope['"+o+"'])";if(void 0!==e.globalScope._SymbolsMap[o])return"gscope['"+e.globalScope._SymbolsMap[o]+"']=lang.assign("+l+",'"+t.operator+"', gscope['"+e.globalScope._SymbolsMap[o]+"'])";if(null!==e.localScope){if(e.undeclaredGlobalsInFunctions.has(o))return"gscope[lang.chkAssig('"+e.undeclaredGlobalsInFunctions.get(o).manglename+"',runtimeCtx)]=lang.assign("+l+",'"+t.operator+"', gscope['"+e.undeclaredGlobalsInFunctions.get(o).manglename+"'])";const n={manglename:Re(e),node:t.left};return e.undeclaredGlobalsInFunctions.set(o,n),"gscope[lang.chkAssig('"+n.manglename+"',runtimeCtx)]=lang.assign("+l+",'"+t.operator+"', gscope['"+n.manglename+"'])"}throw new u(null,c.InvalidIdentifier,t)}function ge(e,n){return"AssignmentExpression"===n.expression.type?"lastStatement = lc.voidOperation; "+ne(e,n.expression)+"; \n ":"lastStatement = "+ne(e,n.expression)+"; "}function de(e,n){return"BlockStatement"===n.type?te(e,n):"ReturnStatement"===n.type||"BreakStatement"===n.type||"ContinueStatement"===n.type?te(e,n)+"; ":"ExpressionStatement"===n.type?te(e,n):te(e,n)+"; "}function fe(e,n){return`if (lang.mustBoolean(${ne(e,n.test)}, runtimeCtx) === true) {\n ${de(e,n.consequent)}\n } `+(null!==n.alternate?"IfStatement"===n.alternate.type?" else "+fe(e,n.alternate):` else {\n ${de(e,n.alternate)}\n }\n`:" else {\n lastStatement = lc.voidOperation;\n }\n")}function he(e,n){let t="";for(let l=0;l<n.body.length;l++)"EmptyStatement"!==n.body[l].type&&("ReturnStatement"===n.body[l].type||"BreakStatement"===n.body[l].type||"ContinueStatement"===n.body[l].type?t+=te(e,n.body[l])+"; \n":t+=te(e,n.body[l])+" \n");return t}function ye(e,n){if(null===n.argument)return"return lc.voidOperation";return"return "+ne(e,n.argument)}function be(e,t){const l=n(t.specifiers[0].local);Se(l);const o=e.libraryResolver?.loadLibrary(l),r=Re(e);void 0===e.moduleFactory[o.uri]&&(e.moduleFactory[o.uri]=Xe(o.syntax,{moduleFactory:e.moduleFactory,libraryResolver:e.libraryResolver},e.isAsync)),e.moduleFactoryMap[r]=o.uri;let a,s="";return s=e.isAsync?"(yield lang.loadModule('"+r+"', runtimeCtx) ); ":"lang.loadModule('"+r+"', runtimeCtx); ",void 0!==e.globalScope[l]?"gscope['"+l+"']="+s:void 0!==e.globalScope._SymbolsMap[l]?"gscope['"+e.globalScope._SymbolsMap[l]+"']="+s:(e.undeclaredGlobalsInFunctions.has(l)?(a=e.undeclaredGlobalsInFunctions.get(l).manglename,e.undeclaredGlobalsInFunctions.delete(l)):a=Re(e),e.globalScope._SymbolsMap[l]=a,e.mangleMap[l]=a,"gscope[lang.setAssig('"+a+"', runtimeCtx)]="+s)}function we(e,t){const l=te(e,t.declaration);if("FunctionDeclaration"===t.declaration.type)e.exports[n(t.declaration.id)]="function";else if("VariableDeclaration"===t.declaration.type)for(const o of t.declaration.declarations)e.exports[n(o.id)]="variable";return l}function Se(e){if("iif"===e)throw new p;if("decode"===e)throw new p;if("when"===e)throw new p;if("defaultvalue"===e)throw new p}function ve(e,t){const l=n(t.id);let o;Se(l);let r=!1;void 0!==e.globalScope[l]?o=l:void 0!==e.globalScope._SymbolsMap[l]?o=e.globalScope._SymbolsMap[l]:e.undeclaredGlobalsInFunctions.has(l)?(o=e.undeclaredGlobalsInFunctions.get(l).manglename,e.globalScope._SymbolsMap[l]=o,e.mangleMap[l]=o,e.undeclaredGlobalsInFunctions.delete(l),r=!0):(o=Re(e),e.globalScope._SymbolsMap[l]=o,e.mangleMap[l]=o);const a={isAsync:e.isAsync,exports:e.exports,undeclaredGlobalsInFunctions:e.undeclaredGlobalsInFunctions,moduleFactory:e.moduleFactory,moduleFactoryMap:e.moduleFactoryMap,libraryResolver:e.libraryResolver,symbols:e.symbols,mangleMap:e.mangleMap,localScope:{_SymbolsMap:{}},depthCounter:e.depthCounter,globalScope:e.globalScope};let s="new lang.UserDefinedCompiledFunction( lang.functionDepthchecker(function() { var lastStatement = lc.voidOperation; \n var lscope = runtimeCtx.localStack[runtimeCtx.localStack.length-1];\n";for(let i=0;i<t.params.length;i++){const l=n(t.params[i]);Se(l);const o=Re(e);a.localScope._SymbolsMap[l]=o,a.mangleMap[l]=o,s+="lscope['"+o+"']=arguments["+i.toString()+"];\n"}return!0===e.isAsync?(s+="return lang.__awaiter(this, void 0, void 0, function* () {\n",s+=he(a,t.body)+"\n return lastStatement; ",s+="}); }",s+=", runtimeCtx),"+t.params.length+")",s+="\n lastStatement = lc.voidOperation; \n"):(s+=he(a,t.body)+"\n return lastStatement; }, runtimeCtx),"+t.params.length+")",s+="\n lastStatement = lc.voidOperation; \n"),r?"gscope[lang.setAssig('"+o+"', runtimeCtx)]="+s:"gscope['"+o+"']="+s}function xe(e,n){const t=[];for(let l=0;l<n.declarations.length;l++)t.push(Me(e,n.declarations[l]));return t.join("\n")+" \n lastStatement= lc.voidOperation; \n"}function Me(e,t){const l=null===t.init?null:ne(e,t.init),o=n(t.id);if(Se(o),null!==e.localScope){if(void 0!==e.localScope[o])return"lscope['"+o+"']="+l+"; ";if(void 0!==e.localScope._SymbolsMap[o])return"lscope['"+e.localScope._SymbolsMap[o]+"']="+l+"; ";const n=Re(e);return e.localScope._SymbolsMap[o]=n,e.mangleMap[o]=n,"lscope['"+n+"']="+l+"; "}if(void 0!==e.globalScope[o])return"gscope['"+o+"']="+l+"; ";if(void 0!==e.globalScope._SymbolsMap[o])return"gscope['"+e.globalScope._SymbolsMap[o]+"']="+l+"; ";if(e.undeclaredGlobalsInFunctions.has(o)){const n=e.undeclaredGlobalsInFunctions.get(o).manglename;return e.globalScope._SymbolsMap[o]=n,e.mangleMap[o]=n,e.undeclaredGlobalsInFunctions.delete(o),"gscope[lang.setAssig('"+n+"', runtimeCtx)]="+l+"; "}const r=Re(e);return e.globalScope._SymbolsMap[o]=r,e.mangleMap[o]=r,"gscope['"+r+"']="+l+"; "}function Fe(e,n){try{let t;return!0===n.computed?t=ne(e,n.property):(Se(n.property.name),t="'"+n.property.name+"'"),"lang.member("+ne(e,n.object)+","+t+")"}catch(t){throw t}}function $e(e,n){try{return"lang.unary("+ne(e,n.argument)+",'"+n.operator+"')"}catch(t){throw t}}function Ce(e,n){try{const t=[];for(let l=0;l<n.elements.length;l++)"Literal"===n.elements[l].type?t.push(ne(e,n.elements[l])):t.push("lang.aCheck("+ne(e,n.elements[l])+",'ArrayExpression')");return"["+t.join(",")+"]"}catch(t){throw t}}function Ie(e,n){try{const t=[];let l=0;for(const o of n.quasis)t.push(o.value?JSON.stringify(o.value.cooked):JSON.stringify("")),!1===o.tail&&(t.push(n.expressions[l]?"lang.castString(lang.aCheck("+ne(e,n.expressions[l])+", 'TemplateLiteral'))":""),l++);return"(["+t.join(",")+"]).join('')"}catch(t){throw t}}function Ae(e,n){try{return"lang.binary("+ne(e,n.left)+","+ne(e,n.right)+",'"+n.operator+"')"}catch(t){throw t}}function _e(e,n){try{if("AssignmentExpression"===n.left.type||"UpdateExpression"===n.left.type)throw new u(null,c.LogicalExpressionOnlyBoolean,n);if("AssignmentExpression"===n.right.type||"UpdateExpression"===n.right.type)throw new u(null,c.LogicalExpressionOnlyBoolean,n);if("&&"===n.operator||"||"===n.operator)return"(lang.logicalCheck("+ne(e,n.left)+") "+n.operator+" lang.logicalCheck("+ne(e,n.right)+"))";throw new u(null,c.LogicExpressionOrAnd,null)}catch(t){throw t}}function Oe(e,t){try{const l=n(t);if(Se(l),null!==e.localScope){if(void 0!==e.localScope[l])return"lscope['"+l+"']";if(void 0!==e.localScope._SymbolsMap[l])return"lscope['"+e.localScope._SymbolsMap[l]+"']"}if(void 0!==e.globalScope[l])return"gscope['"+l+"']";if(void 0!==e.globalScope._SymbolsMap[l])return"gscope['"+e.globalScope._SymbolsMap[l]+"']";if(null!==e.localScope){if(e.undeclaredGlobalsInFunctions.has(l))return"gscope[lang.chkAssig('"+e.undeclaredGlobalsInFunctions.get(l).manglename+"',runtimeCtx)]";const n={manglename:Re(e),node:t};return e.undeclaredGlobalsInFunctions.set(l,n),"gscope[lang.chkAssig('"+n.manglename+"',runtimeCtx)]"}throw new u(null,c.InvalidIdentifier,t)}catch(l){throw l}}function ke(e,t){try{if("MemberExpression"===t.callee.type){let n;!0===t.callee.computed?n=ne(e,t.callee.property):(Se(t.callee.property.name),n="'"+t.callee.property.name+"'");let l="[";for(let o=0;o<t.arguments.length;o++)o>0&&(l+=", "),l+=ne(e,t.arguments[o]);return l+="]",e.isAsync?"(yield lang.callModuleFunction("+ne(e,t.callee.object)+","+l+","+n+",runtimeCtx))":"lang.callModuleFunction("+ne(e,t.callee.object)+","+l+","+n+",runtimeCtx)"}if("Identifier"!==t.callee.type)throw new u(null,c.FunctionNotFound,t);const l=n(t.callee);if("iif"===l)return Ge(e,t);if("when"===l)return je(e,t);if("defaultvalue"===l)return Ee(e,t);if("decode"===l)return Be(e,t);let o="";if(null!==e.localScope&&(void 0!==e.localScope[l]?o="lscope['"+l+"']":void 0!==e.localScope._SymbolsMap[l]&&(o="lscope['"+e.localScope._SymbolsMap[l]+"']")),""===o)if(void 0!==e.globalScope[l])o="gscope['"+l+"']";else if(void 0!==e.globalScope._SymbolsMap[l])o="gscope['"+e.globalScope._SymbolsMap[l]+"']";else if(null!==e.localScope)if(e.undeclaredGlobalsInFunctions.has(l))o="gscope[lang.chkAssig('"+e.undeclaredGlobalsInFunctions.get(l).manglename+"',runtimeCtx)]";else{const n={manglename:Re(e),node:t.callee};e.undeclaredGlobalsInFunctions.set(l,n),o="gscope[lang.chkAssig('"+n.manglename+"',runtimeCtx)]"}if(""!==o){let n="[";for(let l=0;l<t.arguments.length;l++)l>0&&(n+=", "),n+=ne(e,t.arguments[l]);return n+="]",e.isAsync?"(yield lang.callfunc("+o+","+n+",runtimeCtx) )":"lang.callfunc("+o+","+n+",runtimeCtx)"}throw new u(null,c.FunctionNotFound,t)}catch(l){throw l}}function Ge(e,n){try{if(3!==n.arguments.length)throw new u(null,c.WrongNumberOfParameters,n);const t=De(e);return`${e.isAsync?"(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {":"function() {"}\n var ${t} = ${ne(e,n.arguments[0])};\n\n if (${t} === true) {\n return ${ne(e,n.arguments[1])};\n }\n else if (${t} === false) {\n return ${ne(e,n.arguments[2])};\n }\n else {\n lang.error('ExecutionErrorCodes.BooleanConditionRequired');\n }\n ${e.isAsync?"})}()))":"}()"}`}catch(t){throw t}}function Ee(e,n){try{if(n.arguments.length<2||n.arguments.length>3)throw new u(null,c.WrongNumberOfParameters,n);const t=De(e),l=De(e);return 3===n.arguments.length?`${e.isAsync?"(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {":"function() {"}\n var ${t} = ${ne(e,n.arguments[0])};\n var ${l} = ${ne(e,n.arguments[1])};\n ${t} = lang.getNestedOptionalValue(${t}, ${l});\n return ${t} != null && ${t} !== "" ? ${t} : ${ne(e,n.arguments[2])};\n ${e.isAsync?"})}()))":"}()"}`:`${e.isAsync?"(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {":"function() {"}\n var ${t} = ${ne(e,n.arguments[0])};\n if (${t} === null) {\n return ${ne(e,n.arguments[1])};\n }\n if (${t} === "") {\n return ${ne(e,n.arguments[1])};\n }\n if (${t} === undefined) {\n return ${ne(e,n.arguments[1])};\n }\n return ${t};\n ${e.isAsync?"})}()))":"}()"}`}catch(t){throw t}}function je(e,n){try{if(n.arguments.length<3)throw new u(null,c.WrongNumberOfParameters,n);if(n.arguments.length%2==0)throw new u(null,c.WrongNumberOfParameters,n);const t=De(e);let l="var ";for(let o=0;o<n.arguments.length-1;o+=2)l+=`${t} = lang.mustBoolean(${ne(e,n.arguments[o])}, runtimeCtx);\n if (${t} === true ) {\n return ${ne(e,n.arguments[o+1])}\n }\n`;return`${e.isAsync?"(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {":"function() {"}\n ${l}\n return ${ne(e,n.arguments[n.arguments.length-1])}\n ${e.isAsync?"})}()))":"}()"}`}catch(t){throw t}}function Be(e,n){try{if(n.arguments.length<2)throw new u(null,c.WrongNumberOfParameters,n);if(2===n.arguments.length)return`(${ne(e,n.arguments[1])})`;if((n.arguments.length-1)%2==0)throw new u(null,c.WrongNumberOfParameters,n);const t=De(e),l=De(e);let o="var ";for(let r=1;r<n.arguments.length-1;r+=2)o+=`${l} = ${ne(e,n.arguments[r])};\n if (lang.binary(${l}, ${t}, "==") === true ) {\n return ${ne(e,n.arguments[r+1])}\n }\n`;return`${e.isAsync?"(yield (function() { \n return lang.__awaiter(this, void 0, void 0, function* () {":"function() {"}\n var ${t} = ${ne(e,n.arguments[0])};\n ${o}\n return ${ne(e,n.arguments[n.arguments.length-1])}\n ${e.isAsync?"})}()))":"}()"}`}catch(t){throw t}}const Ne={};function Re(e){return e.symbols.symbolCounter++,`_T${e.symbols.symbolCounter}`}function De(e){return e.symbols.symbolCounter++,`_Tvar${e.symbols.symbolCounter}`}R(Ne,ee),W(Ne,ee),D(Ne,ee,Ze),K(Ne,ee),L(Ne,ee),P(Ne,ee),Ne.iif=function(e,n){try{return ee(e,n,((t,l,o)=>{throw new i(e,c.Unrecognized,n)}))}catch(t){throw t}},Ne.decode=function(e,n){try{return ee(e,n,((t,l,o)=>{throw new i(e,c.Unrecognized,n)}))}catch(t){throw t}},Ne.when=function(e,n){try{return ee(e,n,((t,l,o)=>{throw new i(e,c.Unrecognized,n)}))}catch(t){throw t}},Ne.defaultvalue=function(e,n){try{return ee(e,n,((t,l,o)=>{throw new i(e,c.Unrecognized,n)}))}catch(t){throw t}};const Le={};for(const en in Ne)Le[en]=new g(Ne[en]);U(Ne,ee);for(const en in Ne)Ne[en]=new g(Ne[en]);const Ue=function(){};Ue.prototype=Ne;const Ke=function(){};function Pe(e,n,t){const l={_SymbolsMap:{}};e||(e={}),t||(t={}),l.textformatting=1,l.infinity=1,l.pi=1;for(const o in n)l[o]=1;for(const o in t)l[o]=1;for(const o in e)l[o]=1;return l}function We(e,n,t,l){const o=t?new Ke:new Ue;e||(e={}),n||(n={});const r=new s({newline:"\n",tab:"\t",singlequote:"'",doublequote:'"',forwardslash:"/",backwardslash:"\\"});r.immutable=!1,o._SymbolsMap={textformatting:1,infinity:1,pi:1},o.textformatting=r,o.infinity=Number.POSITIVE_INFINITY,o.pi=Math.PI;for(const a in n)o[a]=n[a],o._SymbolsMap[a]=1;for(const a in e){const n=e[a];o._SymbolsMap[a]=1,Z(n)?o[a]=m.createFromGraphic(n,l??null):o[a]=n}return o}Ke.prototype=Le;const Ve={fixSpatialReference:b,parseArguments:X,standardFunction:ee};function qe(e,n){const t={mode:n,compiled:!0,functions:{},signatures:[],standardFunction:ee,standardFunctionAsync:ee,evaluateIdentifier:Ze};for(let l=0;l<e.length;l++)e[l].registerFunctions(t);if("sync"===n){for(const e in t.functions)Ne[e]=new g(t.functions[e]),Ue.prototype[e]=Ne[e];for(let e=0;e<t.signatures.length;e++)B(t.signatures[e],"sync")}else{for(const e in t.functions)Le[e]=new g(t.functions[e]),Ke.prototype[e]=Le[e];for(let e=0;e<t.signatures.length;e++)B(t.signatures[e],"async")}}function Te(e,n){return e(n)}function Ze(e,n){const t=n.name;if("_SymbolsMap"===t)throw new i(e,c.InvalidIdentifier,null);if(e.localStack.length>0){const n=e.localStack[e.localStack.length-1];if(!t.toLowerCase().startsWith("_t")&&void 0!==n[t])return n[t];const l=e.mangleMap[t];if(void 0!==l&&void 0!==n[l])return n[l]}if(!t.toLowerCase().startsWith("_t")&&void 0!==e.globalScope[t])return e.globalScope[t];if(1===e.globalScope._SymbolsMap[t])return e.globalScope[t];const l=e.mangleMap[t];return void 0!==l?e.globalScope[l]:void 0}qe([N],"sync"),qe([N],"async");const ze={isNumber:e=>z(e),isArray:e=>J(e),isImmutableArray:e=>$(e),isDictionaryLike:e=>C(e),isString:e=>Y(e),isDictionary:e=>I(e),isGeometry:e=>A(e),getGeometryKeys:e=>o(e),geometryMember:(e,n,t,l,o=1)=>r(e,n,t,l,o),error(e){throw new i(null,e,null)},__awaiter(e,n,t,l){const o=l.apply(e,n||[]);let r=o.next();for(;!r.done&&!V(r.value);)r=o.next(r.value);return r.done?r.value:new Promise(((e,n)=>{function t(l){for(;!l.done;){if(V(l.value))return void Promise.resolve(l.value).then((e=>{try{t(o.next(e))}catch(l){n(l)}}),(e=>{try{t(o.throw(e))}catch(l){n(l)}}));try{l=o.next(l.value)}catch(r){return void n(r)}}e(l.value)}t(r)}))},functionDepthchecker:(e,n)=>function(){if(n.depthCounter.depth++,n.localStack.push({}),n.depthCounter.depth>64)throw new i(null,c.MaximumCallDepth,null);const t=e.apply(this,arguments);return V(t)?t.then((e=>(n.depthCounter.depth--,n.localStack.length=n.localStack.length-1,e))):(n.depthCounter.depth--,n.localStack.length=n.localStack.length-1,t)},chkAssig(e,n){if(void 0===n.gdefs[e])throw new i(n,c.InvalidIdentifier,null);return e},mustBoolean(e,n){if(!0===e||!1===e)return e;throw new i(n,c.BooleanConditionRequired,null)},setAssig:(e,n)=>(n.gdefs[e]=1,e),castString:e=>_(e),aCheck(e,n){if(y(e)){if("ArrayExpression"===n)throw new i(null,c.NoFunctionInArray,null);if("ObjectExpression"===n)throw new i(null,c.NoFunctionInDictionary,null);throw new i(null,c.NoFunctionInTemplateLiteral,null)}return e===x?null:e},Dictionary:s,Feature:m,UserDefinedCompiledFunction:Q,dictionary(e){const n={},t=new Map;for(let o=0;o<e.length;o+=2){if(y(e[o+1]))throw new i(null,c.NoFunctionInDictionary,null);if(!1===Y(e[o]))throw new i(null,c.KeyMustBeString,null);let l=e[o].toString();const r=l.toLowerCase();t.has(r)?l=t.get(r):t.set(r,l),e[o+1]===x?n[l]=null:n[l]=e[o+1]}const l=new s(n);return l.immutable=!1,l},entry:(e,n)=>new s({key:e,value:n}),strCheck(e){if(!1===Y(e))throw new i(null,c.KeyMustBeString,null);return e},unary(e,n){if(H(e)){if("!"===n)return!e;if("-"===n)return-1*O(e);if("+"===n)return 1*O(e);if("~"===n)return~O(e);throw new i(null,c.UnsupportedUnaryOperator,null)}if("-"===n)return-1*O(e);if("+"===n)return 1*O(e);if("~"===n)return~O(e);throw new i(null,c.UnsupportedUnaryOperator,null)},logicalCheck(e){if(!1===H(e))throw new i(null,c.LogicExpressionOrAnd,null);return e},logical(e,n,t){if(H(e)&&H(n))switch(t){case"||":return e||n;case"&&":return e&&n;default:throw new i(null,c.LogicExpressionOrAnd,null)}throw new i(null,c.LogicExpressionOrAnd,null)},binary(e,n,t){switch(t){case"|":case"<<":case">>":case">>>":case"^":case"&":return E(O(e),O(n),t);case"==":case"=":return G(e,n);case"!=":return!G(e,n);case"<":case">":case"<=":case">=":return k(e,n,t);case"+":return Y(e)||Y(n)?_(e)+_(n):O(e)+O(n);case"-":return O(e)-O(n);case"*":return O(e)*O(n);case"/":return O(e)/O(n);case"%":return O(e)%O(n);default:throw new i(null,c.UnsupportedOperator,null)}},assign(e,n,t){switch(n){case"=":return e===x?null:e;case"/=":return O(t)/O(e);case"*=":return O(t)*O(e);case"-=":return O(t)-O(e);case"+=":return Y(t)||Y(e)?_(t)+_(e):O(t)+O(e);case"%=":return O(t)%O(e);default:throw new i(null,c.UnsupportedOperator,null)}},update(e,n,t,l){const o=O(e[n]);return e[n]="++"===t?o+1:o-1,!1===l?o:"++"===t?o+1:o-1},graphicToFeature:(e,n,t)=>null===e?null:m.createFromGraphicLikeObject(e.geometry,e.attributes,n,t.timeZone),memberupdate(e,n,t,l){let o;if(J(e)){if(!z(n))throw new i(null,c.ArrayAccessorMustBeNumber,null);if(n<0&&(n=e.length+n),n<0||n>=e.length)throw new i(null,c.OutOfBounds,null);o=O(e[n]),e[n]="++"===t?o+1:o-1}else if(e instanceof s){if(!1===Y(n))throw new i(null,c.KeyAccessorMustBeString,null);if(!0!==e.hasField(n))throw new i(null,c.FieldNotFound,null,{key:n});o=O(e.field(n)),e.setField(n,"++"===t?o+1:o-1)}else if(j(e)){if(!1===Y(n))throw new i(null,c.KeyAccessorMustBeString,null);if(!0!==e.hasField(n))throw new i(null,c.FieldNotFound,null);o=O(e.field(n)),e.setField(n,"++"===t?o+1:o-1)}else{if($(e))throw new i(null,c.Immutable,null);if(!(e instanceof Qe))throw new i(null,c.InvalidIdentifier,null);if(!1===Y(n))throw new i(null,c.ModuleAccessorMustBeString,null);if(!0!==e.hasGlobal(n))throw new i(null,c.ModuleExportNotFound,null);o=O(e.global(n)),e.setGlobal(n,"++"===t?o+1:o-1)}return!1===l?o:"++"===t?o+1:o-1},assignmember(e,n,t,l){if(J(e)){if(!z(n))throw new i(null,c.ArrayAccessorMustBeNumber,null);if(n<0&&(n=e.length+n),n<0||n>e.length)throw new i(null,c.OutOfBounds,null);if(n===e.length){if("="!==t)throw new i(null,c.OutOfBounds,null);e[n]=this.assign(l,t,e[n])}else e[n]=this.assign(l,t,e[n])}else if(e instanceof s){if(!1===Y(n))throw new i(null,c.KeyAccessorMustBeString,null);if(!0===e.hasField(n))e.setField(n,this.assign(l,t,e.field(n)));else{if("="!==t)throw new i(null,c.FieldNotFound,null);e.setField(n,this.assign(l,t,null))}}else if(j(e)){if(!1===Y(n))throw new i(null,c.KeyAccessorMustBeString,null);if(!0===e.hasField(n))e.setField(n,this.assign(l,t,e.field(n)));else{if("="!==t)throw new i(null,c.FieldNotFound,null);e.setField(n,this.assign(l,t,null))}}else{if($(e))throw new i(null,c.Immutable,null);if(!(e instanceof Qe))throw new i(null,c.InvalidIdentifier,null);if(!1===Y(n))throw new i(null,c.ModuleAccessorMustBeString,null);if(!e.hasGlobal(n))throw new i(null,c.ModuleExportNotFound,null);e.setGlobal(n,this.assign(l,t,e.global(n)))}},member(e,n){if(null===e)throw new i(null,c.MemberOfNull,null);if(e instanceof s||C(e)){if(Y(n))return e.field(n);throw new i(null,c.InvalidMemberAccessKey,null)}if(e instanceof q){if(Y(n))return r(e,n,null,null);throw new i(null,c.InvalidMemberAccessKey,null)}if(J(e)){if(z(n)&&isFinite(n)&&Math.floor(n)===n){if(n<0&&(n=e.length+n),n>=e.length||n<0)throw new i(null,c.OutOfBounds,null);return e[n]}throw new i(null,c.InvalidMemberAccessKey,null)}if(Y(e)){if(z(n)&&isFinite(n)&&Math.floor(n)===n){if(n<0&&(n=e.length+n),n>=e.length||n<0)throw new i(null,c.OutOfBounds,null);return e[n]}throw new i(null,c.InvalidMemberAccessKey,null)}if($(e)){if(z(n)&&isFinite(n)&&Math.floor(n)===n){if(n<0&&(n=e.length()+n),n>=e.length()||n<0)throw new i(null,c.OutOfBounds,null);return e.get(n)}throw new i(null,c.InvalidMemberAccessKey,null)}if(e instanceof Qe){if(Y(n))return e.global(n);throw new i(null,c.InvalidMemberAccessKey,null)}throw new i(null,c.InvalidMemberAccessKey,null)},callfunc:(e,n,t)=>e.call(t,{arguments:n,preparsed:!0}),loadModule(e,n){const t=n.moduleFactoryMap[e];if(n.moduleSingletons[t])return n.moduleSingletons[t];const l=n.moduleFactory[t]({moduleSingletons:n.moduleSingletons,depthCounter:n.depthCounter,lrucache:n.lrucache,interceptor:n.interceptor,services:n.services,console:n.console,abortSignal:n.abortSignal,timeZone:n.timeZone??null,spatialReference:n.spatialReference});return n.moduleSingletons[t]=l,l},callModuleFunction(e,n,t,l){if(!(e instanceof Qe))throw new i(null,c.FunctionNotFound,null);const o=e.global(t);if(!1===y(o))throw new i(null,c.CallNonFunction,null);return o.call(l,{preparsed:!0,arguments:n})},getNestedOptionalValue:(e,n)=>a(e,n)};function Je(e){console.log(e)}function Ye(n,t,o=!1){null==t&&(t={vars:{},customfunctions:{}});let r=null;n.usesModules&&(r=new l(null,n.loadedModules));const a={isAsync:o,globalScope:Pe(t.vars,o?Le:Ne,t.customfunctions),moduleFactory:{},moduleFactoryMap:{},undeclaredGlobalsInFunctions:new Map,libraryResolver:r,localScope:null,mangleMap:{},depthCounter:{depth:1},exports:{},symbols:{symbolCounter:0}};let s=he(a,n);""===s&&(s="lc.voidOperation; "),a.undeclaredGlobalsInFunctions.size>0&&a.undeclaredGlobalsInFunctions.forEach((e=>{throw new u(null,c.InvalidIdentifier,e.node)}));let p="";p=o?"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"+s+"\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 "+s+"\n return lastStatement; } \n return this.postProcess(mainBody()); ";const m=a.moduleFactory,g=a.moduleFactoryMap,d=a.exports,f={};let h;for(h in d)f[h]=a.mangleMap[h]??h;const b={lc:w,lang:ze,mangles:a.mangleMap,postProcess(e){if(e instanceof S&&(e=e.value),e instanceof v&&(e=e.value),e===x&&(e=null),e===M)throw new i(null,c.IllegalResult,null);if(e===F)throw new i(null,c.IllegalResult,null);if(y(e))throw new i(null,c.IllegalResult,null);return e},prepare(n,t){const l=n.spatialReference??T.WebMercator,o=We(n.vars,n.customfunctions,t,n.timeZone);return{localStack:[],moduleFactory:m,moduleFactoryMap:g,mangleMap:this.mangles,moduleSingletons:{},exports:d,gdefs:{},exportmangle:f,spatialReference:l,globalScope:o,abortSignal:n.abortSignal??e,services:n.services,console:n.console??Je,lrucache:n.lrucache,timeZone:n.timeZone??null,interceptor:n.interceptor,depthCounter:{depth:1}}}};return new Function("context",p).bind(b)}async function He(){return qe([await import("./functions/geomasync.js")],"async"),!0}class Qe extends t{constructor(e){super(),this.moduleContext=e}hasGlobal(e){return void 0===this.moduleContext.exports[e]&&(e=e.toLowerCase()),void 0!==this.moduleContext.exports[e]}setGlobal(e,n){const t=this.moduleContext.globalScope,l=e.toLowerCase();if(y(n))throw new i(null,c.AssignModuleFunction,null);t[this.moduleContext.exportmangle[l]]=n}global(e){const n=this.moduleContext.globalScope,t=e.toLowerCase(),l=n[this.moduleContext.exportmangle[t]];if(void 0===l)throw new i(null,c.InvalidIdentifier,null);if(y(l)&&!(l instanceof f)){const e=new f;return e.fn=l,e.parameterEvaluator=ee,e.context=this.moduleContext,n[this.moduleContext.exportmangle[t]]=e,e}return l}}function Xe(n,t,o){const r={isAsync:o,moduleFactory:t.moduleFactory,moduleFactoryMap:{},libraryResolver:new l(null,n.loadedModules),globalScope:Pe(null,o?Le:Ne,null),localScope:null,mangleMap:{},undeclaredGlobalsInFunctions:new Map,depthCounter:{depth:1},exports:{},symbols:{symbolCounter:0}};let a=he(r,n);""===a&&(a="lc.voidOperation; ");let s="";s=o?"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"+a+"\n return lastStatement; }); } \n yield mainBody(); \n return this.prepareModule(runtimeCtx); }); ":"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 "+a+"\n return lastStatement; } \n mainBody(); \n return this.prepareModule(runtimeCtx); ";const i=r.moduleFactory,c=r.moduleFactoryMap,u=r.exports,p={};let m;for(m in u)p[m]=r.mangleMap[m]??m;const g={lc:w,lang:ze,mangles:r.mangleMap,prepareModule:e=>new Qe(e),prepare(n,t){const l=n.spatialReference??T.WebMercator,o=We(null,null,t,n.timeZone);return{localStack:[],exports:u,exportmangle:p,gdefs:{},moduleFactory:i,moduleFactoryMap:c,moduleSingletons:n.moduleSingletons,mangleMap:this.mangles,spatialReference:l,globalScope:o,abortSignal:n.abortSignal??e,services:n.services,console:n.console??Je,lrucache:n.lrucache,timeZone:n.timeZone??null,interceptor:n.interceptor,depthCounter:n.depthCounter}}};return new Function("context",s).bind(g)}export{Q as UserDefinedCompiledFunction,Ye as compileScript,He as enableAsyncSupport,Te as executeScript,qe as extend,Ve as functionHelper};