// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built require({cache:{"esri/chunks/arcade":function(){define("require exports ../arcade/arcadeCompiler ../arcade/ArcadeModuleResolver ../arcade/arcadeRuntime ../arcade/executionError ../arcade/parser ../arcade/treeAnalysis ../arcade/functions/geomsync ../core/has ../core/maybe".split(" "),function(D,O,E,c,y,b,q,F,d,k,w){function C(p,L){if(!0===L.useAsync||!0===p.isAsync)return M(p,L);if(k("esri-csp-restrictions"))return function(Q){return y.executeScript(p,Q)};try{return E.compileScript(p,L)}catch(Q){if("esri.arcade.arcadeuncompilableerror"=== Q.declaredRootClass)return function(Y){return y.executeScript(p,Y)};throw Q;}}function M(p,L){if(null===P)throw new b.ArcadeExecutionError(null,b.ExecutionErrorCodes.AsyncNotEnabled,null);if(k("esri-csp-restrictions"))return function(Q){return P.executeScript(p,Q)};try{return E.compileScript(p,L,!0)}catch(Q){if("esri.arcade.arcadeuncompilableerror"===Q.declaredRootClass)return function(Y){return P.executeScript(p,Y)};throw Q;}}function A(p){y.extend(p);E.extend(p,"sync");null===P?S.push(p):(E.extend(p, "async"),P.extend(p))}function f(p,L=[]){return q.parseScript(p,L)}function m(p,L,Q=[]){p=q.parseScript(p,Q);return r(p,L)}function r(p,L){if(!0===L.useAsync||!0===p.isAsync){if(null===P)throw new b.ArcadeExecutionError(null,b.ExecutionErrorCodes.AsyncNotEnabled,null);return P.executeScript(p,L)}return y.executeScript(p,L)}function n(p,L){return F.referencesMember(p,L)}function g(p,L){return F.referencesFunction(p,L)}function l(p,L=!1){void 0===L&&(L=!1);return F.findFieldLiterals(p)}function z(p){return F.findExpectedFieldLiterals(p)} function G(p,L=[]){void 0===p.usesGeometry&&F.findScriptDependencies(p,L);return!0===p.usesGeometry}function a(){return V?V:V=B()}async function B(){const p=await new Promise((L,Q)=>D(["../geometry/geometryEngine"],L,Q));u=!0;d.setGeometryEngine(p);return!0}function x(){return null!==ha?ha:ha=N()}async function N(){await E.enableAsyncSupport();P=await new Promise((p,L)=>D(["../arcade/arcadeAsyncRuntime"],p,L));for(const p of S)P.extend(p),E.extend(p,"async");S=null;return!0}function e(){return J} function Z(){return P?!0:!1}function t(){return u}function H(){return qa?qa:qa=R()}async function R(){await x();const [p,L,Q,Y,aa,ka]=await Promise.all([new Promise((fa,ja)=>D(["../arcade/featureSetUtils"],fa,ja)),new Promise((fa,ja)=>D(["../arcade/functions/featuresetbase"],fa,ja)),new Promise((fa,ja)=>D(["../arcade/functions/featuresetgeom"],fa,ja)),new Promise((fa,ja)=>D(["../arcade/functions/featuresetstats"],fa,ja)),new Promise((fa,ja)=>D(["../arcade/functions/featuresetstring"],fa,ja)),new Promise((fa, ja)=>D(["../arcade/functions/knowledgegraph"],fa,ja))]);ra=p;P.extend([L,Q,Y,aa,ka]);E.extend([L,Q,Y,aa,ka],"async");return J=!0}function U(p,L=[]){void 0===p.usesFeatureSet&&F.findScriptDependencies(p,L);return!0===p.usesFeatureSet}function X(p,L=[]){void 0===p.isAsync&&F.findScriptDependencies(p,L);return!0===p.isAsync}async function W(p,L,Q=[],Y=!1,aa=null){return ca(new Set,p,L,Q,Y,aa)}async function ca(p,L,Q,Y=[],aa=!1,ka=null){L="string"===typeof L?f(L):L;const fa=[];if(L&&(!1===u&&(G(L)||aa)&& fa.push(a()),!1===Z()&&(!0===L.isAsync||Q)&&fa.push(x()),!1===J)){var ja;if(!(ja=U(L)))a:{if(Y)for(const ia of Y)if(n(L,ia)){ja=!0;break a}ja=!1}ja&&fa.push(H())}fa.length&&await Promise.all(fa);await pa(p,L,ka,Q,aa);return!0}function wa(p,L=[]){void 0===p.usesModules&&F.findScriptDependencies(p,L);return!0===p.usesModules}async function pa(p,L,Q=null,Y=!1,aa=!1){var ka=F.findModuleImports(L);null===Q&&0p.arguments.length)throw new q.ArcadeCompilationError(h,q.ExecutionErrorCodes.WrongNumberOfParameters, p);if(0===p.arguments.length%2)throw new q.ArcadeCompilationError(h,q.ExecutionErrorCodes.WrongNumberOfParameters,p);const ma=W(h);Y="var ";for(var ka=0;kap.arguments.length||3p.arguments.length)throw new q.ArcadeCompilationError(h,q.ExecutionErrorCodes.WrongNumberOfParameters,p);if(2===p.arguments.length)Y=`(${a(h,p.arguments[1])})`;else{if(0===(p.arguments.length-1)%2)throw new q.ArcadeCompilationError(h,q.ExecutionErrorCodes.WrongNumberOfParameters,p);ka=W(h);var ja=W(h);Q="var ";for(L=1;L{if(p.length!==this.paramCount)throw new q.ArcadeExecutionError(h,q.ExecutionErrorCodes.WrongNumberOfParameters, null);return this.fn(...p)}}call(h,p){return this.fn(...p.arguments)}marshalledCall(h,p,L,Q){return Q(h,p,(Y,aa,ka)=>{ka=ka.map(fa=>!k.isFunctionParameter(fa)||fa instanceof d.ScopeMarshalledFunction?fa:d.wrapModuleScopedResponse(fa,h,Q));Y=this.call(L,{arguments:ka});return g.isPromiseLike(Y)?Y.then(fa=>d.wrapModuleScopedResponse(fa,L,Q)):Y})}}const u={};M.registerFunctions(u,G);n.registerFunctions(u,G);m.registerFunctions(u,G);A.registerFunctions(u,G);r.registerFunctions(u,G);u.iif=function(h,p){try{return G(h, p,(L,Q,Y)=>{throw new q.ArcadeExecutionError(h,q.ExecutionErrorCodes.Unrecognized,p);})}catch(L){throw L;}};u.decode=function(h,p){try{return G(h,p,(L,Q,Y)=>{throw new q.ArcadeExecutionError(h,q.ExecutionErrorCodes.Unrecognized,p);})}catch(L){throw L;}};u.when=function(h,p){try{return G(h,p,(L,Q,Y)=>{throw new q.ArcadeExecutionError(h,q.ExecutionErrorCodes.Unrecognized,p);})}catch(L){throw L;}};u.defaultvalue=function(h,p){try{return G(h,p,(L,Q,Y)=>{throw new q.ArcadeExecutionError(h,q.ExecutionErrorCodes.Unrecognized, p);})}catch(L){throw L;}};const P={};for(const h in u)P[h]=new d.NativeFunction(u[h]);f.registerFunctions(u,G);for(const h in u)u[h]=new d.NativeFunction(u[h]);const S=function(){};S.prototype=u;const V=function(){};V.prototype=P;M={fixSpatialReference:k.fixSpatialReference,parseArguments:function(h,p){const L=[];for(let Q=0;Q{function ka(ia){try{ja(Q.next(ia))}catch(ma){aa(ma)}}function fa(ia){try{ja(Q["throw"](ia))}catch(ma){aa(ma)}} function ja(ia){ia.done?Y(ia.value):ia.value?.then?ia.value.then(ka,fa):(ha++,0===ha%100?setTimeout(()=>{ha=0;ka(ia.value)},0):ka(ia.value))}ja((Q=Q.apply(h,p||[])).next())})},functionDepthchecker(h,p){return function(){p.depthCounter.depth++;p.localStack.push([]);if(64{p.depthCounter.depth--;--p.localStack.length;return Q}); p.depthCounter.depth--;--p.localStack.length;return L}},chkAssig(h,p){if(void 0===p.gdefs[h])throw new q.ArcadeExecutionError(p,q.ExecutionErrorCodes.InvalidIdentifier,null);return h},mustBoolean(h,p){if(!0===h||!1===h)return h;throw new q.ArcadeExecutionError(p,q.ExecutionErrorCodes.BooleanConditionRequired,null);},setAssig(h,p){p.gdefs[h]=1;return h},castString(h){return k.toString(h)},aCheck(h,p){if(k.isFunctionParameter(h)){if("ArrayExpression"===p)throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.NoFunctionInArray, null);if("ObjectExpression"===p)throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.NoFunctionInDictionary,null);throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.NoFunctionInTemplateLiteral,null);}return h===k.voidOperation?null:h},Dictionary:b,Feature:F,UserDefinedCompiledFunction:J,dictionary(h){const p={},L=new Map;for(let Q=0;Qp&&(p=h.length+p);if(0>p||p>=h.length)throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.OutOfBounds,null);Y=k.toNumber(h[p]);h[p]="++"===L?Y+1:Y-1}else throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.ArrayAccessorMustBeNumber,null);else if(h instanceof b){if(!1===k.isString(p))throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.KeyAccessorMustBeString,null);if(!0===h.hasField(p))Y=k.toNumber(h.field(p)), h.setField(p,"++"===L?Y+1:Y-1);else throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.FieldNotFound,null,{key:p});}else if(k.isFeature(h)){if(!1===k.isString(p))throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.KeyAccessorMustBeString,null);if(!0===h.hasField(p))Y=k.toNumber(h.field(p)),h.setField(p,"++"===L?Y+1:Y-1);else throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.FieldNotFound,null);}else{if(k.isImmutableArray(h))throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.Immutable, null);if(h instanceof ra){if(!1===k.isString(p))throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.ModuleAccessorMustBeString,null);if(!0===h.hasGlobal(p))Y=k.toNumber(h.global(p)),h.setGlobal(p,"++"===L?Y+1:Y-1);else throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.ModuleExportNotFound,null);}else throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.InvalidIdentifier,null);}return!1===Q?Y:"++"===L?Y+1:Y-1},assignmember(h,p,L,Q){if(k.isArray(h))if(k.isNumber(p)){0>p&&(p= h.length+p);if(0>p||p>h.length)throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.OutOfBounds,null);if(p===h.length&&"\x3d"!==L)throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.OutOfBounds,null);h[p]=this.assign(Q,L,h[p])}else throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.ArrayAccessorMustBeNumber,null);else if(h instanceof b){if(!1===k.isString(p))throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.KeyAccessorMustBeString,null);if(!0===h.hasField(p))h.setField(p, this.assign(Q,L,h.field(p)));else{if("\x3d"!==L)throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.FieldNotFound,null);h.setField(p,this.assign(Q,L,null))}}else if(k.isFeature(h)){if(!1===k.isString(p))throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.KeyAccessorMustBeString,null);if(!0===h.hasField(p))h.setField(p,this.assign(Q,L,h.field(p)));else{if("\x3d"!==L)throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.FieldNotFound,null);h.setField(p,this.assign(Q,L,null))}}else{if(k.isImmutableArray(h))throw new q.ArcadeExecutionError(null, q.ExecutionErrorCodes.Immutable,null);if(h instanceof ra){if(!1===k.isString(p))throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.ModuleAccessorMustBeString,null);if(h.hasGlobal(p))h.setGlobal(p,this.assign(Q,L,h.global(p)));else throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.ModuleExportNotFound,null);}else throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.InvalidIdentifier,null);}},member(h,p){if(null===h)throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.MemberOfNull, null);if(h instanceof b||k.isFeature(h)){if(k.isString(p))return h.field(p);throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.InvalidMemberAccessKey,null);}if(h instanceof l){if(k.isString(p))return y.geometryMember(h,p,null,null);throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.InvalidMemberAccessKey,null);}if(k.isArray(h)){if(k.isNumber(p)&&isFinite(p)&&Math.floor(p)===p){0>p&&(p=h.length+p);if(p>=h.length||0>p)throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.OutOfBounds, null);return h[p]}throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.InvalidMemberAccessKey,null);}if(k.isString(h)){if(k.isNumber(p)&&isFinite(p)&&Math.floor(p)===p){0>p&&(p=h.length+p);if(p>=h.length||0>p)throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.OutOfBounds,null);return h[p]}throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.InvalidMemberAccessKey,null);}if(k.isImmutableArray(h)){if(k.isNumber(p)&&isFinite(p)&&Math.floor(p)===p){0>p&&(p=h.length()+p);if(p>=h.length()|| 0>p)throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.OutOfBounds,null);return h.get(p)}throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.InvalidMemberAccessKey,null);}if(h instanceof ra&&k.isString(p))return h.global(p);throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.InvalidMemberAccessKey,null);},callfunc(h,p,L){return h.call(L,{arguments:p,preparsed:!0})},loadModule(h,p){h=p.moduleFactoryMap[h];if(p.moduleSingletons[h])return p.moduleSingletons[h];const L=p.moduleFactory[h]({vars:{}, moduleSingletons:p.moduleSingletons,depthCounter:p.depthCounter,console:p.console,abortSignal:p.abortSignal,isAsync:p.isAsync,services:p.services,lrucache:p.lrucache,timeZone:p.timeZone??null,interceptor:p.interceptor},p.spatialReference);return p.moduleSingletons[h]=L},callModuleFunction(h,p,L,Q){if(!(h instanceof ra))throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.FunctionNotFound,null);h=h.global(L);if(!1===k.isFunctionParameter(h))throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.CallNonFunction, null);return h.call(Q,{preparsed:!0,arguments:p})},getNestedOptionalValue(h,p){return y.getNestedOptionalValue(h,p)}};class ra extends E.ArcadeModule{constructor(h){super(null);this.moduleContext=h}hasGlobal(h){void 0===this.moduleContext.exports[h]&&(h=h.toLowerCase());return void 0!==this.moduleContext.exports[h]?!0:!1}setGlobal(h,p){const L=this.moduleContext.globalScope;h=h.toLowerCase();if(k.isFunctionParameter(p))throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.AssignModuleFunction, null);L[this.moduleContext.exportmangle[h]]=p}global(h){const p=this.moduleContext.globalScope;h=h.toLowerCase();const L=p[this.moduleContext.exportmangle[h]];if(void 0===L)throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.InvalidIdentifier,null);if(k.isFunctionParameter(L)&&!(L instanceof d.ScopeMarshalledFunction)){const Q=new d.ScopeMarshalledFunction;Q.fn=L;Q.parameterEvaluator=G;Q.context=this.moduleContext;return p[this.moduleContext.exportmangle[h]]=Q}return L}}O.UserDefinedCompiledFunction= J;O.compileScript=function(h,p,L=!1){null===p&&(p={vars:{},customfunctions:{}});var Q=null;h.usesModules&&(Q=new c.ArcadeModuleLoader(null,h.loadedModules));Q={isAsync:L,globalScope:ca(p.vars,L?P:u,p.customfunctions),moduleFactory:{},moduleFactoryMap:{},undeclaredGlobalsInFunctions:new Map,customfunctions:p.customfunctions,libraryResolver:Q,localScope:null,mangleMap:{},depthCounter:{depth:1},exports:{},console:sa,lrucache:p.lrucache,timeZone:p.timeZone??null,interceptor:p.interceptor,services:p.services, symbols:{symbolCounter:0}};h=a(Q,h);""===h&&(h="lc.voidOperation; ");0{throw new q.ArcadeCompilationError(p,q.ExecutionErrorCodes.InvalidIdentifier,ia.node);});const Y=Q.moduleFactory,aa=Q.moduleFactoryMap,ka=Q.exports,fa={};for(var ja in ka)fa[ja]=void 0!==Q.mangleMap[ja]?Q.mangleMap[ja]:ja;ja={lc:k.lc,lang:qa,mangles:Q.mangleMap,postProcess(ia){ia instanceof k.returnResult&&(ia=ia.value);ia instanceof k.implicitResult&& (ia=ia.value);ia===k.voidOperation&&(ia=null);if(ia===k.breakResult)throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.IllegalResult,null);if(ia===k.continueResult)throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.IllegalResult,null);if(k.isFunctionParameter(ia))throw new q.ArcadeExecutionError(null,q.ExecutionErrorCodes.IllegalResult,null);return ia},prepare(ia,ma){let ya=ia.spatialReference;if(null===ya||void 0===ya)ya=z.WebMercator;const ta=wa(ia.vars,ia.customfunctions,ma,ia.timeZone); return{localStack:[],isAsync:ma,moduleFactory:Y,moduleFactoryMap:aa,mangleMap:this.mangles,moduleSingletons:{},exports:ka,gdefs:{},exportmangle:fa,spatialReference:ya,globalScope:ta,abortSignal:void 0===ia.abortSignal||null===ia.abortSignal?{aborted:!1}:ia.abortSignal,localScope:null,services:ia.services,console:ia.console??sa,lrucache:ia.lrucache,timeZone:ia.timeZone??null,interceptor:ia.interceptor,symbols:{symbolCounter:0},depthCounter:{depth:1}}}};return(new Function("context","spatialReference", L?"var runtimeCtx\x3dthis.prepare(context, true);\n var lc \x3d this.lc; var lang \x3d this.lang; var gscope\x3druntimeCtx.globalScope; \nreturn lang.__awaiter(this, void 0, void 0, function* () {\n\n function mainBody() {\n var lastStatement\x3dlc.voidOperation;\n return lang.__awaiter(this, void 0, void 0, function* () {\n"+h+"\n return lastStatement; }); } \n return this.postProcess(yield mainBody()); }); ":"var runtimeCtx\x3dthis.prepare(context, false);\n var lc \x3d this.lc; var lang \x3d this.lang; var gscope\x3druntimeCtx.globalScope; \n function mainBody() {\n var lastStatement\x3dlc.voidOperation;\n "+ h+"\n return lastStatement; } \n return this.postProcess(mainBody()); ")).bind(ja)};O.enableAsyncSupport=async function(){const h=await new Promise((p,L)=>D(["./functions/geomasync"],p,L));pa([h],"async");return!0};O.executeScript=function(h,p){return h(p)};O.extend=pa;O.functionHelper=M;Object.defineProperty(O,Symbol.toStringTag,{value:"Module"})})},"esri/arcade/ArcadeModule":function(){define(["exports"],function(D){class O{constructor(E){this.source=E}}D.ArcadeModule=O;Object.defineProperty(D, Symbol.toStringTag,{value:"Module"})})},"esri/arcade/ArcadeModuleLoader":function(){define(["exports"],function(D){class O{constructor(E,c){this._moduleSingletons=E;this._syntaxModules=c}loadLibrary(E){return null==this._syntaxModules?null:(E=this._syntaxModules[E.toLowerCase()])?{syntax:E.script,uri:E.uri}:null}}D.ArcadeModuleLoader=O;Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})})},"esri/arcade/containerUtils":function(){define("exports ./Dictionary ./executionError ./ImmutablePathArray ./ImmutablePointArray ../chunks/languageUtils".split(" "), function(D,O,E,c,y,b){function q(d,k,w,C,M=1){k=k.toLowerCase();switch(k){case "hasz":return d=d.hasZ,void 0===d?!1:d;case "hasm":return d=d.hasM,void 0===d?!1:d;case "spatialreference":return k=d.spatialReference._arcadeCacheId,void 0===k&&(w=!0,Object.freeze&&Object.isFrozen(d.spatialReference)&&(w=!1),w&&(F++,k=d.spatialReference._arcadeCacheId=F)),d=new O({wkt:d.spatialReference.wkt,wkid:d.spatialReference.wkid}),void 0!==k&&(d._arcadeCacheId="SPREF"+k.toString()),d}switch(d.type){case "extent":switch(k){case "xmin":case "xmax":case "ymin":case "ymax":case "zmin":case "zmax":case "mmin":case "mmax":return d= d[k],void 0!==d?d:null;case "type":return"Extent"}break;case "polygon":switch(k){case "rings":return k=d.cache._arcadeCacheId,void 0===k&&(F++,k=F,d.cache._arcadeCacheId=k),new c(d.rings,d.spatialReference,!0===d.hasZ,!0===d.hasM,k);case "type":return"Polygon"}break;case "point":switch(k){case "x":case "y":case "z":case "m":return d[k]??null;case "type":return"Point"}break;case "polyline":switch(k){case "paths":return k=d.cache._arcadeCacheId,void 0===k&&(F++,k=F,d.cache._arcadeCacheId=k),new c(d.paths, d.spatialReference,!0===d.hasZ,!0===d.hasM,k);case "type":return"Polyline"}break;case "multipoint":switch(k){case "points":return k=d.cache._arcadeCacheId,void 0===k&&(F++,k=F,d.cache._arcadeCacheId=k),new y(d.points,d.spatialReference,!0===d.hasZ,!0===d.hasM,k,1);case "type":return"Multipoint"}}if(1===M)throw new E.ArcadeExecutionError(w,E.ExecutionErrorCodes.InvalidIdentifier,C);return 2===M?{keystate:"notfound"}:null}let F=0;D.geometryMember=q;D.getNestedOptionalValue=function(d,k){if(null==d)return null; if(!b.isArray(k))if(b.isImmutableArray(k))k=k.toArray();else if(null!=k)k=[k];else return null;for(const w of k){if(b.isFeature(d)){if(!1===b.isString(w)||!d.hasField(w))return null;d=d.field(w)}else if(b.isDictionary(d)){if(!1===b.isString(w)||!d.hasField(w))return null;d=d.field(w)}else if(b.isGeometry(d)){if(!1===b.isString(w))return null;d=q(d,w,null,null,0)}else if(b.isArray(d)){if(!1===b.isNumber(w))return null;d=0<=w?d[w]:d[d.length+w]}else if(b.isImmutableArray(d)){if(!1===b.isNumber(w))return null; d=0<=w?d.get(w):d.get(d.length()+w)}else return null;if(null==d)return null}return d};Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})})},"esri/arcade/Dictionary":function(){define("./ArcadeDate ./deepClone ./executionError ./ImmutableArray ../chunks/languageUtils ../geometry/Geometry".split(" "),function(D,O,E,c,y,b){function q(d,k,w=!1,C=!1){if(null===d||void 0===d)return null;if(y.isNumber(d))return y.toNumber(d);if(y.isBoolean(d))return y.toBoolean(d);if(y.isString(d))return y.toString(d); if(y.isDate(d))return y.toDate(d,k);if(y.isDateOnly(d)||y.isTime(d))return d;if(y.isArray(d)){var M=[];for(var A of d)M.push(q(A,k,w,C));return M}if(C&&y.isGeometry(d))return d;A=new F;A.immutable=!1;for(M of Object.keys(d)){const f=d[M];void 0!==f&&A.setField(M,q(f,k,w,C))}A.immutable=w;return A}class F{constructor(d){this.declaredClass="esri.arcade.Dictionary";this.attributes=null;this.plain=!1;this.immutable=!0;this.attributes=d instanceof F?d.attributes:void 0===d?{}:null===d?{}:d}field(d){const k= d.toLowerCase(),w=this.attributes[d];if(void 0!==w)return w;for(const C in this.attributes)if(C.toLowerCase()===k)return this.attributes[C];throw new E.ArcadeExecutionError(null,E.ExecutionErrorCodes.FieldNotFound,null,{key:d});}setField(d,k){if(this.immutable)throw new E.ArcadeExecutionError(null,E.ExecutionErrorCodes.Immutable,null);if(y.isFunctionParameter(k))throw new E.ArcadeExecutionError(null,E.ExecutionErrorCodes.NoFunctionInDictionary,null);const w=d.toLowerCase();k instanceof Date&&(k=D.ArcadeDate.dateJSToArcadeDate(k)); if(void 0===this.attributes[d])for(const C in this.attributes)if(C.toLowerCase()===w){this.attributes[C]=k;return}this.attributes[d]=k}hasField(d){const k=d.toLowerCase();if(void 0!==this.attributes[d])return!0;for(const w in this.attributes)if(w.toLowerCase()===k)return!0;return!1}keys(){let d=[];for(const k in this.attributes)d.push(k);return d=d.sort()}castToText(d=!1){let k="";for(const w in this.attributes){""!==k&&(k+=",");const C=this.attributes[w];null==C?k+=JSON.stringify(w)+":null":y.isBoolean(C)|| y.isNumber(C)||y.isString(C)?k+=JSON.stringify(w)+":"+JSON.stringify(C):C instanceof b?k+=JSON.stringify(w)+":"+y.toStringExplicit(C):C instanceof c?k+=JSON.stringify(w)+":"+y.toStringExplicit(C,null,d):Array.isArray(C)?k+=JSON.stringify(w)+":"+y.toStringExplicit(C,null,d):C instanceof D.ArcadeDate?k=d?k+(JSON.stringify(w)+":"+JSON.stringify(C.getTime())):k+(JSON.stringify(w)+":"+C.stringify()):null!==C&&"object"===typeof C&&void 0!==C.castToText&&(k+=JSON.stringify(w)+":"+C.castToText(d))}return"{"+ k+"}"}static convertObjectToArcadeDictionary(d,k,w=!0,C=!1){const M=new F;M.immutable=!1;for(const A in d){const f=d[A];void 0!==f&&M.setField(A.toString(),q(f,k,w,C))}M.immutable=w;return M}static convertJsonToArcade(d,k,w=!1,C=!1){return q(d,k,w,C)}castAsJson(d=null){const k={};for(let w in this.attributes){const C=this.attributes[w];void 0!==C&&(d?.keyTranslate&&(w=d.keyTranslate(w)),k[w]=y.castAsJson(C,d))}return k}async castDictionaryValueAsJsonAsync(d,k,w,C=null,M){w=await y.castAsJsonAsync(w, C,M);return d[k]=w}async castAsJsonAsync(d=null,k=null){const w={},C=[];for(let M in this.attributes){const A=this.attributes[M];k?.keyTranslate&&(M=k.keyTranslate(M));void 0!==A&&(y.isSimpleType(A)||A instanceof b||A instanceof D.ArcadeDate?w[M]=y.castAsJson(A,k):C.push(this.castDictionaryValueAsJsonAsync(w,M,A,d,k)))}0C?k-C:0}function b(k,w=!0){if(k instanceof c.Zone)return k;if("system"===k.toLowerCase())return"system";if("utc"===k.toLowerCase())return"UTC";if("unknown"===k.toLowerCase())return E.UnknownTimeZone.instance;if(/^[+-]?[0-9]{1,2}([:][0-9]{2})?$/.test(k)){const C=c.FixedOffsetZone.parseSpecifier("UTC"+(k.startsWith("+")||k.startsWith("-")?"":"+")+k);if(C)return C}k=c.IANAZone.create(k); if(!k.isValid){if(w)throw new F(D.ArcadeDateErrorCodes.TimeZoneNotRecognized);return null}return k}D.ArcadeDateErrorCodes=void 0;(D.ArcadeDateErrorCodes||(D.ArcadeDateErrorCodes={})).TimeZoneNotRecognized="TimeZoneNotRecognized";const q={[D.ArcadeDateErrorCodes.TimeZoneNotRecognized]:"Timezone identifier has not been recognized."};class F extends Error{constructor(k,w){super(O.replace(q[k],w));this.declaredRootClass="esri.arcade.arcadedate.dateerror";Error.captureStackTrace&&Error.captureStackTrace(this, F)}}class d{constructor(k){this._date=k;this.declaredRootClass="esri.arcade.arcadedate"}static fromParts(k=0,w=1,C=1,M=0,A=0,f=0,m=0,r){if(isNaN(k)||isNaN(w)||isNaN(C)||isNaN(M)||isNaN(A)||isNaN(f)||isNaN(m))return null;const n=c.DateTime.local(k,w).daysInMonth;k=c.DateTime.fromObject({day:1>C?1:C>n?n:C,year:k,month:1>w?1:12M?0:23A?0:59f?0:59m?0:999 c(q));if(E.isArray(b))return b.map(q=>c(q));if(E.isFeature(b))return y.createFromArcadeFeature(b);if(E.isFeatureSetCollection(b)||E.isFeatureSet(b))return b;if(E.isDictionary(b)||"esri.arcade.Attachment"===b?.declaredClass)return b.deepClone();if("esri.arcade.Portal"===b?.declaredClass||E.isKnowledgeGraph(b)||b instanceof O.ArcadeModule)return b;E.isFunctionParameter(b);return b}let y;D.configureDeepClone=function(b){y=b};D.deepClone=c;Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})})}, "esri/chunks/languageUtils":function(){define("exports ../config ../kernel ../arcade/ArcadeDate ../arcade/ArcadeModule ../arcade/executionError ../arcade/FunctionWrapper ../arcade/ImmutableArray ../arcade/ImmutablePathArray ../arcade/ImmutablePointArray ../arcade/featureset/support/shared ../core/number ../core/sql/DateOnly ../core/sql/TimeOnly ../geometry/Extent ../geometry/Geometry ../geometry/Multipoint ../geometry/Point ../geometry/Polygon ../geometry/Polyline ../geometry/SpatialReference ../geometry/support/coordsUtils ../geometry/support/jsonUtils ../intl/locale ./datetime".split(" "), function(D,O,E,c,y,b,q,F,d,k,w,C,M,A,f,m,r,n,g,l,z,G,a,B,x){function N(v,K,T){return""===K||null===K||void 0===K||K===T||K===T?v:v=v.split(K).join(T)}function e(v){return v instanceof q.ArcadeFunction}function Z(v){return v instanceof y.ArcadeModule}function t(v){return U(v)||W(v)||S(v)||V(v)||ha(v)||X(v)||null===v||v===za||"number"===typeof v?!0:!1}function H(v,K){return void 0===v?K:v}function R(v){return null==v?"":pa(v)||P(v)?"Array":S(v)?"Date":ha(v)?"Time":V(v)?"DateOnly":U(v)?"String":X(v)? "Boolean":W(v)?"Number":"esri.arcade.Attachment"===v?.declaredClass?"Attachment":"esri.arcade.Portal"===v?.declaredClass?"Portal":"esri.arcade.Dictionary"===v?.declaredClass?"Dictionary":u(v)?"KnowledgeGraph":v instanceof y.ArcadeModule?"Module":xa(v)?"Feature":v instanceof n?"Point":v instanceof g?"Polygon":v instanceof l?"Polyline":v instanceof r?"Multipoint":v instanceof f?"Extent":e(v)?"Function":sa(v)?"FeatureSet":J(v)?"FeatureSetCollection":v===za?"":"number"===typeof v&&isNaN(v)?"Number":"Unrecognized Type"} function U(v){return"string"===typeof v||v instanceof String}function X(v){return"boolean"===typeof v}function W(v){return"number"===typeof v}function ca(v){return"number"===typeof v&&isFinite(v)&&Math.floor(v)===v}function wa(v){return v instanceof m}function pa(v){return Array.isArray(v)}function xa(v){return"esri.arcade.Feature"===v?.arcadeDeclaredClass?!0:!1}function sa(v){return"esri.arcade.featureset.support.FeatureSet"===v?.declaredRootClass}function I(v){return"esri.arcade.Dictionary"===v?.declaredClass} function J(v){return"esri.arcade.featureSetCollection"===v?.declaredRootClass}function u(v){return"esri.rest.knowledgeGraph.KnowledgeGraph"===v?.declaredClass}function P(v){return v instanceof F}function S(v){return v instanceof c.ArcadeDate}function V(v){return v instanceof M.DateOnly}function ha(v){return v instanceof A.TimeOnly}function qa(v){return null!=v&&"object"===typeof v}function ra(v){return v instanceof Date}function h(v,K,T,ea,da){if(v.lengthT)throw new b.ArcadeExecutionError(ea, b.ExecutionErrorCodes.WrongNumberOfParameters,da);}function p(v){return 0>v?-Math.round(-v):Math.round(v)}function L(v,K){if(!isNaN(v)){if(void 0===K||null===K||""===K)return v.toString();K=N(K,"\u2030","");K=N(K,"\u00a4","");return C.format(v,{pattern:K})}return v.toString()}function Q(v,K){return void 0===K||null===K||""===K?v.toISOString(!0):v.toFormat(Y(K),{locale:B.getLocale(),numberingSystem:"latn"})}function Y(v,K=!1){v=v.replaceAll(/LTS|LT|L{1,4}|l{1,4}/g,"[$\x26]");let T="";const ea=/(\[[^[]*\])|(\\)?([Hh]mm(ss)?|Mo|M{1,4}|Do|DDDo|D{1,4}|d{2,4}|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|Z{1,5}|.)/g; for(const da of v.match(ea)||[])switch(da){case "D":T+="d";break;case "DD":T+="dd";break;case "DDD":T+="o";break;case "d":T+="c";break;case "ddd":T+="ccc";break;case "dddd":T+="cccc";break;case "M":T+="L";break;case "MM":T+="LL";break;case "MMM":T+="LLL";break;case "MMMM":T+="LLLL";break;case "YY":T+="yy";break;case "Y":case "YYYY":T+="yyyy";break;case "Q":T+="q";break;case "Z":T+="Z";break;case "ZZ":T+="ZZ";break;case "ZZZ":T+="ZZZ";break;case "ZZZZ":T=K?T+"[ZZZZ]":T+"ZZZZ";break;case "ZZZZZ":T= K?T+"[ZZZZZ]":T+"ZZZZZ";break;case "S":T+="'S'";break;case "SS":T+="'SS'";break;case "SSS":T+="u";break;case "A":case "a":T+="a";break;case "m":case "mm":case "h":case "hh":case "H":case "HH":case "s":case "ss":case "X":case "x":T+=da;break;default:T=2<=da.length&&"["===da.slice(0,1)&&"]"===da.slice(-1)?T+`'${da.slice(1,-1)}'`:T+`'${da}'`}return T}function aa(v,K,T){switch(T){case "\x3e":return v>K;case "\x3c":return v=K;case "\x3c\x3d":return v<=K}return!1}function ka(v, K,T){if(null===v){if(null===K||K===za)return aa(null,null,T);if(W(K))return aa(0,K,T);if(U(K)||X(K))return aa(0,ta(K),T);if(S(K))return aa(0,K.toNumber(),T);if(ha(K)||V(K))return aa(v,K.toNumber(),T)}if(v===za){if(null===K||K===za)return aa(null,null,T);if(W(K))return aa(0,K,T);if(U(K)||X(K))return aa(0,ta(K),T);if(S(K))return aa(0,K.toNumber(),T);if(ha(K)||V(K))return aa(v,K.toNumber(),T)}else if(W(v)){if(W(K))return aa(v,K,T);if(X(K))return aa(v,ta(K),T);if(null===K||K===za)return aa(v,0,T);if(U(K))return aa(v, ta(K),T);if(S(K)||ha(K)||V(K))return aa(v,K.toNumber(),T)}else if(U(v)){if(U(K))return aa(ja(v),ja(K),T);if(S(K)||ha(K)||V(K))return aa(ta(v),K.toNumber(),T);if(W(K))return aa(ta(v),K,T);if(null===K||K===za)return aa(ta(v),0,T);if(X(K))return aa(ta(v),ta(K),T)}else if(S(v)){if(S(K))return v.timeZone!==K.timeZone&&(v.isUnknownTimeZone?v=c.ArcadeDate.arcadeDateAndZoneToArcadeDate(v,K.timeZone):K.isUnknownTimeZone&&(K=c.ArcadeDate.arcadeDateAndZoneToArcadeDate(K,v.timeZone))),aa(v.toNumber(),K.toNumber(), T);if(null===K||K===za)return aa(v.toNumber(),0,T);if(W(K))return aa(v.toNumber(),K,T);if(X(K)||U(K))return aa(v.toNumber(),ta(K),T);if(ha(K))throw new b.ArcadeExecutionError(null,b.ExecutionErrorCodes.CannotCompareDateAndTime,null);if(V(K))return aa(v.toNumber(),K.toNumber(),T)}else if(X(v)){if(X(K))return aa(v,K,T);if(W(K))return aa(ta(v),ta(K),T);if(S(K)||ha(K)||V(K))return aa(ta(v),K.toNumber(),T);if(null===K||K===za)return aa(ta(v),0,T);if(U(K))return aa(ta(v),ta(K),T)}else if(V(v)){if(S(K))return aa(v.toNumber(), K.toNumber(),T);if(null===K||K===za)return aa(v.toNumber(),0,T);if(W(K))return aa(v.toNumber(),K,T);if(X(K)||U(K))return aa(v.toNumber(),ta(K),T);if(ha(K))throw new b.ArcadeExecutionError(null,b.ExecutionErrorCodes.CannotCompareDateAndTime,null);if(V(K))return aa(v.toNumber(),K.toNumber(),T)}else if(ha(v)){if(S(K))throw new b.ArcadeExecutionError(null,b.ExecutionErrorCodes.CannotCompareDateAndTime,null);if(null===K||K===za)return aa(v.toNumber(),0,T);if(W(K))return aa(v.toNumber(),K,T);if(X(K)||U(K))return aa(v.toNumber(), ta(K),T);if(ha(K))return aa(v.toNumber(),K.toNumber(),T);if(V(K))throw new b.ArcadeExecutionError(null,b.ExecutionErrorCodes.CannotCompareDateAndTime,null);}return!fa(v,K)||"\x3c\x3d"!==T&&"\x3e\x3d"!==T?!1:!0}function fa(v,K){if(v===K||null===v&&K===za||null===K&&v===za)return!0;if(S(v)&&S(K)||ha(v)&&ha(K)||V(v)&&V(K))return v.equals(K);if(v instanceof d||v instanceof k)return v.equalityTest(K);if(v instanceof n&&K instanceof n){const T=v.cache._arcadeCacheId,ea=K.cache._arcadeCacheId;if(void 0!== T&&null!==T)return T===ea}return qa(v)&&qa(K)&&(v._arcadeCacheId===K._arcadeCacheId&&void 0!==v._arcadeCacheId&&null!==v._arcadeCacheId||v._underlyingGraphic===K._underlyingGraphic&&void 0!==v._underlyingGraphic&&null!==v._underlyingGraphic)?!0:!1}function ja(v,K){if(U(v))return v;if(null===v)return"";if(W(v))return L(v,K);if(X(v))return v.toString();if(S(v))return Q(v,K);if(ha(v)||V(v))return v.toFormat(K);if(v instanceof m)return JSON.stringify(v.toJSON());if(pa(v)){K=[];for(var T=0;Tda.key=== na.key?0:"spatialReference"===da.key?1:"spatialReference"===na.key||da.keyna.key?1:0);if(pa(v)){K=[];for(var ea=0;eaJa[Ea]===ea?((Fa=Ja.domains?.[da.name])&&"inherited"===Fa.type&&(Fa=Ka(da.name,K),Ca=!0),!0):!1);Ca||Fa||(Fa=Ka(v,K));return{field:da,domain:Fa}}function Ka(v, K){let T;K.fields.some(ea=>{ea.name.toLowerCase()===v.toLowerCase()&&(T=ea.domain);return!!T});return T}function la(v,K){K||={};"function"===typeof K&&(K={cmp:K});const T="boolean"===typeof K.cycles?K.cycles:!1,ea=K.cmp&&function(na){return function(ua){return function(Fa,Ca){return na({key:Fa,value:ua[Fa]},{key:Ca,value:ua[Ca]})}}}(K.cmp),da=[];return function Fa(ua){ua?.toJSON&&"function"===typeof ua.toJSON&&(ua=ua.toJSON());if(void 0!==ua){if("number"===typeof ua)return isFinite(ua)?""+ua:"null"; if("object"!==typeof ua)return JSON.stringify(ua);var Ca;if(Array.isArray(ua)){var Ea="[";for(Ca=0;Ca{setTimeout(()=>{K(v)},0)})):v}function ab(v,K,T){switch(T){case "\x26":return v&K;case "|":return v|K;case "^":return v^K;case "\x3c\x3c":return v<> K;case "\x3e\x3e\x3e":return v>>>K}}function Na(v,K=null){if(null!=v){if(X(v)||W(v)||U(v))return v;if(v instanceof m)return!0===K?.keepGeometryType?v:v.toJSON();if(v instanceof F)return v.toArray().map(T=>Na(T,K));if(Array.isArray(v))return v.map(T=>Na(T,K));if(ra(v))return v;if(S(v))return v.toJSDate();if(ha(v))return v.toString();if(V(v))return v.toJSDate();if(null!==v&&"object"===typeof v&&void 0!==v.castAsJson)return v.castAsJson(K)}return null}async function nb(v,K,T,ea,da){v=await Qa(v,K,T); da[ea]=v}async function Qa(v,K=null,T=null){v instanceof F&&(v=v.toArray());if(null!=v){if(t(v)||v instanceof m||ra(v)||S(v))return Na(v,T);if(Array.isArray(v)){const ea=[],da=[];for(const na of v)null===na||t(na)||na instanceof m||ra(na)||S(na)?da.push(Na(na,T)):(da.push(null),ea.push(nb(na,K,T,da.length-1,da)));0({name:K.name,code:K.code})):[]}:v.typeIdField?{subtypeField:v.typeIdField, subtypes:v.types?v.types.map(K=>({name:K.name,code:K.id})):[]}:null:null}function eb(v,K,T,ea){const da=Oa(v.fullSchema());if(null===da||!da.fields)return null;ea=va(K,da,v,ea);if(void 0===T)try{T=v.field(K)}catch(na){return null}return ba(ea,T)}function fb(v,K,T,ea){const da=Oa(v.fullSchema());if(null===da||!da.fields)return null;if(void 0===T){try{T=v.field(K)}catch(na){return null}return T}v=va(K,da,v,ea);return oa(v,T)}function gb(v){return v?.timeZone??"system"}function hb(v){v=Oa(v.fullSchema()); if(null===v||!v.fields)return null;const K=[];for(const T of v.fields)K.push(w.esriFieldToJson(T));return{objectIdField:v.objectIdField,globalIdField:v.globalIdField??"",geometryType:void 0===w.layerGeometryEsriRestConstants[v.geometryType]?"":w.layerGeometryEsriRestConstants[v.geometryType],fields:K}}function ib(v,K){"system"===v&&(v=c.ArcadeDate.systemTimeZoneCanonicalName);return{version:"1.24",engineVersion:E.version,timeZone:v,spatialReference:K instanceof z?K.toJSON():K,application:O.applicationName?? "",engine:"web",locale:B.getLocale()}}class Sa{constructor(v){this.value=v}}class Ta{constructor(v){this.value=v}}const jb=Ta,kb=Sa,za={type:"VOID"},lb={type:"BREAK"},mb={type:"CONTINUE"};let Pa=0;const ob=Object.freeze(Object.defineProperty({__proto__:null,ImplicitResultE:Ta,ReturnResultE:Sa,absRound:p,arcadeVersion:"1.24",autoCastArrayOfPointsToMultiPoint:Ya,autoCastArrayOfPointsToPolygon:Wa,autoCastArrayOfPointsToPolyline:Xa,autoCastFeatureToGeometry:Da,binaryOperator:ab,breakResult:lb,castAsJson:Na, castAsJsonAsync:Qa,continueResult:mb,defaultExecutingContext:ib,defaultTimeZone:gb,defaultUndefined:H,equalityTest:fa,featureDomainCodeLookup:fb,featureDomainValueLookup:eb,featureFullDomain:cb,featureSchema:hb,featureSubtypes:db,fixNullGeometry:Ba,fixSpatialReference:Ha,formatDate:Q,formatNumber:L,getDomain:va,getDomainCode:oa,getDomainValue:ba,getType:R,greaterThanLessThan:ka,implicitResult:jb,isArray:pa,isBoolean:X,isDate:S,isDateOnly:V,isDictionary:I,isFeature:xa,isFeatureSet:sa,isFeatureSetCollection:J, isFunctionParameter:e,isGeometry:wa,isImmutableArray:P,isInteger:ca,isJsDate:ra,isKnowledgeGraph:u,isModule:Z,isNumber:W,isObject:qa,isSimpleType:t,isString:U,isSubtypeGrouplayer:bb,isSubtypeSublayer:Ra,isTime:ha,multiReplace:N,parseGeometryFromJson:Ia,pcCheck:h,returnResult:kb,stableStringify:la,standardiseDateFormat:Y,tick:$a,toBoolean:Ga,toDate:La,toNumber:ta,toNumberArray:ia,toString:ja,toStringArray:Za,toStringExplicit:ma,voidOperation:za},Symbol.toStringTag,{value:"Module"}));D.ImplicitResultE= Ta;D.ReturnResultE=Sa;D.absRound=p;D.arcadeVersion="1.24";D.autoCastArrayOfPointsToMultiPoint=Ya;D.autoCastArrayOfPointsToPolygon=Wa;D.autoCastArrayOfPointsToPolyline=Xa;D.autoCastFeatureToGeometry=Da;D.binaryOperator=ab;D.breakResult=lb;D.castAsJson=Na;D.castAsJsonAsync=Qa;D.continueResult=mb;D.defaultExecutingContext=ib;D.defaultTimeZone=gb;D.defaultUndefined=H;D.equalityTest=fa;D.featureDomainCodeLookup=fb;D.featureDomainValueLookup=eb;D.featureFullDomain=cb;D.featureSchema=hb;D.featureSubtypes= db;D.fixNullGeometry=Ba;D.fixSpatialReference=Ha;D.formatDate=Q;D.formatNumber=L;D.getDomain=va;D.getDomainCode=oa;D.getDomainValue=ba;D.getType=R;D.greaterThanLessThan=ka;D.implicitResult=jb;D.isArray=pa;D.isBoolean=X;D.isDate=S;D.isDateOnly=V;D.isDictionary=I;D.isFeature=xa;D.isFeatureSet=sa;D.isFeatureSetCollection=J;D.isFunctionParameter=e;D.isGeometry=wa;D.isImmutableArray=P;D.isInteger=ca;D.isJsDate=ra;D.isKnowledgeGraph=u;D.isModule=Z;D.isNumber=W;D.isObject=qa;D.isSimpleType=t;D.isString= U;D.isSubtypeGrouplayer=bb;D.isSubtypeSublayer=Ra;D.isTime=ha;D.lc=ob;D.multiReplace=N;D.parseGeometryFromJson=Ia;D.pcCheck=h;D.returnResult=kb;D.stableStringify=la;D.standardiseDateFormat=Y;D.tick=$a;D.toBoolean=Ga;D.toDate=La;D.toNumber=ta;D.toNumberArray=ia;D.toString=ja;D.toStringArray=Za;D.toStringExplicit=ma;D.voidOperation=za})},"esri/arcade/executionError":function(){define(["exports","../core/string"],function(D,O){function E(C){return C&&C.loc?`Line : ${C.loc.start?.line}, ${C.loc.start?.column}: `: ""}D.ExecutionErrorCodes=void 0;(function(C){C.AsyncNotEnabled="AsyncNotEnabled";C.ModulesNotSupported="ModulesNotSupported";C.CircularModules="CircularModules";C.CannotCompareDateAndTime="CannotCompareDateAndTime";C.NeverReach="NeverReach";C.UnsupportedHashType="UnsupportedHashType";C.InvalidParameter="InvalidParameter";C.FeatureSetDoesNotHaveSubtypes="FeatureSetDoesNotHaveSubtypes";C.UnexpectedToken="UnexpectedToken";C.Unrecognized="Unrecognized";C.UnrecognizedType="UnrecognizedType";C.MaximumCallDepth= "MaximumCallDepth";C.BooleanConditionRequired="BooleanConditionRequired";C.TypeNotAllowedInFeature="TypeNotAllowedInFeature";C.KeyMustBeString="KeyMustBeString";C.WrongNumberOfParameters="WrongNumberOfParameters";C.CallNonFunction="CallNonFunction";C.NoFunctionInTemplateLiteral="NoFunctionInTemplateLiteral";C.NoFunctionInDictionary="NoFunctionInDictionary";C.NoFunctionInArray="NoFunctionInArray";C.AssignModuleFunction="AssignModuleFunction";C.LogicExpressionOrAnd="LogicExpressionOrAnd";C.LogicalExpressionOnlyBoolean= "LogicalExpressionOnlyBoolean";C.FunctionNotFound="FunctionNotFound";C.InvalidMemberAccessKey="InvalidMemberAccessKey";C.UnsupportedUnaryOperator="UnsupportUnaryOperator";C.InvalidIdentifier="InvalidIdentifier";C.MemberOfNull="MemberOfNull";C.UnsupportedOperator="UnsupportedOperator";C.Cancelled="Cancelled";C.ModuleAccessorMustBeString="ModuleAccessorMustBeString";C.ModuleExportNotFound="ModuleExportNotFound";C.Immutable="Immutable";C.OutOfBounds="OutOfBounds";C.IllegalResult="IllegalResult";C.FieldNotFound= "FieldNotFound";C.PortalRequired="PortalRequired";C.LogicError="LogicError";C.ArrayAccessorMustBeNumber="ArrayAccessMustBeNumber";C.KeyAccessorMustBeString="KeyAccessorMustBeString";C.WrongSpatialReference="WrongSpatialReference";C.CannotChangeTimeZoneTime="CannotChangeTimeZoneTime";C.CannotChangeTimeZoneDateOnly="CannotChangeTimeZoneDateOnly"})(D.ExecutionErrorCodes||(D.ExecutionErrorCodes={}));const c={[D.ExecutionErrorCodes.TypeNotAllowedInFeature]:"Feature attributes only support dates, numbers, strings, guids.", [D.ExecutionErrorCodes.LogicError]:"Logic error - {reason}",[D.ExecutionErrorCodes.CannotCompareDateAndTime]:"Cannot compare date or dateonly with timeonly types",[D.ExecutionErrorCodes.NeverReach]:"Encountered unreachable logic",[D.ExecutionErrorCodes.AsyncNotEnabled]:"Async Arcade must be enabled for this script",[D.ExecutionErrorCodes.ModuleAccessorMustBeString]:"Module accessor must be a string",[D.ExecutionErrorCodes.ModuleExportNotFound]:"Module has no export with provided identifier",[D.ExecutionErrorCodes.ModulesNotSupported]:"Current profile does not support modules", [D.ExecutionErrorCodes.ArrayAccessorMustBeNumber]:"Array accessor must be a number",[D.ExecutionErrorCodes.FunctionNotFound]:"Function not found",[D.ExecutionErrorCodes.FieldNotFound]:"Key not found - {key}",[D.ExecutionErrorCodes.CircularModules]:"Circular module dependencies are not allowed",[D.ExecutionErrorCodes.Cancelled]:"Execution cancelled",[D.ExecutionErrorCodes.UnsupportedHashType]:"Type not supported in hash function",[D.ExecutionErrorCodes.IllegalResult]:"Value is not a supported return type", [D.ExecutionErrorCodes.PortalRequired]:"Portal is required",[D.ExecutionErrorCodes.InvalidParameter]:"Invalid parameter",[D.ExecutionErrorCodes.WrongNumberOfParameters]:"Call with wrong number of parameters",[D.ExecutionErrorCodes.Unrecognized]:"Unrecognized code structure",[D.ExecutionErrorCodes.UnrecognizedType]:"Unrecognized type",[D.ExecutionErrorCodes.WrongSpatialReference]:"Cannot work with geometry in this spatial reference. It is different to the execution spatial reference",[D.ExecutionErrorCodes.BooleanConditionRequired]:"Conditions must use booleans", [D.ExecutionErrorCodes.NoFunctionInDictionary]:"Dictionaries cannot contain functions.",[D.ExecutionErrorCodes.NoFunctionInArray]:"Arrays cannot contain functions.",[D.ExecutionErrorCodes.NoFunctionInTemplateLiteral]:"Template Literals do not expect functions by value.",[D.ExecutionErrorCodes.KeyAccessorMustBeString]:"Accessor must be a string",[D.ExecutionErrorCodes.KeyMustBeString]:"Object keys must be a string",[D.ExecutionErrorCodes.Immutable]:"Object is immutable",[D.ExecutionErrorCodes.UnexpectedToken]:"Unexpected token", [D.ExecutionErrorCodes.MemberOfNull]:"Cannot access property of null object",[D.ExecutionErrorCodes.MaximumCallDepth]:"Exceeded maximum function depth",[D.ExecutionErrorCodes.OutOfBounds]:"Out of bounds",[D.ExecutionErrorCodes.InvalidIdentifier]:"Identifier not recognized",[D.ExecutionErrorCodes.CallNonFunction]:"Expression is not a function",[D.ExecutionErrorCodes.InvalidMemberAccessKey]:"Cannot access value using a key of this type",[D.ExecutionErrorCodes.AssignModuleFunction]:"Cannot assign function to module variable", [D.ExecutionErrorCodes.UnsupportedUnaryOperator]:"Unsupported unary operator",[D.ExecutionErrorCodes.UnsupportedOperator]:"Unsupported operator",[D.ExecutionErrorCodes.LogicalExpressionOnlyBoolean]:"Logical expressions must be boolean",[D.ExecutionErrorCodes.LogicExpressionOrAnd]:"Logical expression can only be combined with || or \x26\x26",[D.ExecutionErrorCodes.CannotChangeTimeZoneTime]:"Cannot change the timezone of a Time",[D.ExecutionErrorCodes.CannotChangeTimeZoneDateOnly]:"Cannot change the timezone of a DateOnly", [D.ExecutionErrorCodes.FeatureSetDoesNotHaveSubtypes]:"FeatureSet does not have subtypes"};class y extends Error{constructor(...C){super(...C)}}class b extends y{constructor(C,M){super(E(M)+C.message,{cause:C});this.loc=null;Error.captureStackTrace&&Error.captureStackTrace(this,b);M?.loc&&(this.loc=M.loc)}}class q extends Error{constructor(C,M,A,f){super("Execution error - "+E(A)+O.replace(c[M],f));this.loc=null;this.declaredRootClass="esri.arcade.arcadeexecutionerror";Error.captureStackTrace&&Error.captureStackTrace(this, q);A?.loc&&(this.loc=A.loc)}}class F extends Error{constructor(C,M,A,f){super("Compilation error - "+E(A)+O.replace(c[M],f));this.loc=null;this.declaredRootClass="esri.arcade.arcadecompilationerror";Error.captureStackTrace&&Error.captureStackTrace(this,F);A?.loc&&(this.loc=A.loc)}}class d extends Error{constructor(){super("Uncompilable code structures");this.declaredRootClass="esri.arcade.arcadeuncompilableerror";Error.captureStackTrace&&Error.captureStackTrace(this,d)}}D.ModuleErrorCodes=void 0; (function(C){C.UnrecognizedUri="UnrecognizedUri";C.UnsupportedUriProtocol="UnsupportedUriProtocol"})(D.ModuleErrorCodes||(D.ModuleErrorCodes={}));const k={[D.ModuleErrorCodes.UnrecognizedUri]:"Unrecognized uri - {uri}",[D.ModuleErrorCodes.UnsupportedUriProtocol]:"Unrecognized uri protocol"};class w extends Error{constructor(C,M){super(O.replace(k[C],M));this.declaredRootClass="esri.arcade.arcademoduleerror";Error.captureStackTrace&&Error.captureStackTrace(this,w)}}D.ArcadeCompilationError=F;D.ArcadeExecutionError= q;D.ArcadeUncompilableError=d;D.ErrorWithCause=y;D.LocatableArcadeExecutionError=b;D.ModuleError=w;D.ensureArcadeExecutionError=function(C,M,A){return"esri.arcade.arcadeexecutionerror"===A.declaredRootClass||"esri.arcade.arcadecompilationerror"===A.declaredRootClass?null===A.loc&&M?.loc?new b(A,{cause:A}):A:M?.loc?new b(A,{cause:A}):A};D.executionErrorMessages=c;D.moduleErrorMessages=k;D.parsingValidationMessage=function(C,M,A){return"Parsing error - "+E(C)+O.replace(c[M],A)};Object.defineProperty(D, Symbol.toStringTag,{value:"Module"})})},"esri/arcade/FunctionWrapper":function(){define(["exports","../core/promiseUtils"],function(D,O){function E(q,F,d){if(q instanceof c&&!(q instanceof b)){const k=new b;k.fn=q;k.parameterEvaluator=d;k.context=F;return k}return q}class c{constructor(){}}class y extends c{constructor(q){super();this.fn=q}createFunction(q){return(...F)=>this.fn(q,{preparsed:!0,arguments:F})}call(q,F){return this.fn(q,F)}marshalledCall(q,F,d,k){return k(q,F,(w,C,M)=>{M=M.map(A=>A instanceof c&&!(A instanceof b)?E(A,q,k):A);w=this.call(d,{args:M});return O.isPromiseLike(w)?w.then(A=>E(A,d,k)):w})}}class b extends c{constructor(){super(...arguments);this.context=this.fn=null}createFunction(q){return this.fn.createFunction(this.context)}call(q,F){return this.fn.marshalledCall(q,F,this.context,this.parameterEvaluator)}marshalledCall(q,F,d){return this.fn.marshalledCall(q,F,this.context,this.parameterEvaluator)}}D.ArcadeFunction=c;D.NativeFunction=y;D.ScopeMarshalledFunction=b;D.wrapModuleScopedResponse= E;Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})})},"esri/arcade/ImmutableArray":function(){define(function(){class D{constructor(O=[]){this._elements=O}length(){return this._elements.length}get(O){return this._elements[O]}toArray(){return this.slice()}slice(O=0,E=this.length()){const c=[];for(;Othis.hour&&0<=this.minute&&60>this.minute&&0<=this.second&&60>this.second&&0<=this.millisecond&&1E3>this.millisecond}toString(){return`${this.hour.toString().padStart(2,"0")}:${this.minute.toString().padStart(2, "0")}:${this.second.toString().padStart(2,"0")}`+(0q?null:new b(Math.floor(q/36E5%24),Math.floor(q/6E4%60),Math.floor(q/1E3%60),Math.floor(q%1E3))}static fromDateJS(q){return new b(q.getHours(),q.getMinutes(),q.getSeconds(),q.getMilliseconds())}static fromDateTime(q){return new b(q.hour,q.minute,q.second,q.millisecond)}static fromSqlTimeStampOffset(q){return this.fromDateTime(q.toDateTime())}static fromString(q,F=null){if(""===q||null===q)return null;const d=[];if(F)(F=y(F))&&d.push(F);else if(null=== F||""===F)d.push("HH:mm:ss"),d.push("HH:mm:ss.SSS"),d.push("hh:mm:ss a"),d.push("hh:mm:ss.SSS a"),d.push("HH:mm"),d.push("hh:mm a"),d.push("H:mm"),d.push("h:mm a"),d.push("H:mm:ss"),d.push("h:mm:ss a"),d.push("H:mm:ss.SSS"),d.push("h:mm:ss.SSS a");for(const k of d)if(F=c.DateTime.fromFormat(q,k),F.isValid)return new b(F.hour,F.minute,F.second,F.millisecond);return null}plus(q,F){switch(q){case "days":case "years":case "months":return this.clone();case "hours":case "minutes":case "seconds":case "milliseconds":return b.fromDateTime(this.toUTCDateTime().plus({[q]:F}))}return null}toUTCDateTime(){return c.DateTime.utc(1970, 1,1,this.hour,this.minute,this.second,this.millisecond)}difference(q,F){switch(F.toLowerCase()){case "days":case "day":case "d":return this.toUTCDateTime().diff(q.toUTCDateTime(),"days").days;case "months":case "month":return this.toUTCDateTime().diff(q.toUTCDateTime(),"months").months;case "minutes":case "minute":case "m":return"M"===F?this.toUTCDateTime().diff(q.toUTCDateTime(),"months").months:this.toUTCDateTime().diff(q.toUTCDateTime(),"minutes").minutes;case "seconds":case "second":case "s":return this.toUTCDateTime().diff(q.toUTCDateTime(), "seconds").seconds;case "milliseconds":case "millisecond":case "ms":return this.toUTCDateTime().diff(q.toUTCDateTime(),"milliseconds").milliseconds;case "hours":case "hour":case "h":return this.toUTCDateTime().diff(q.toUTCDateTime(),"hours").hours;case "years":case "year":case "y":return this.toUTCDateTime().diff(q.toUTCDateTime(),"years").years;default:return this.toUTCDateTime().diff(q.toUTCDateTime(),"milliseconds").milliseconds}}}D.TimeOnly=b;D.standardizeTimeFormat=y;Object.defineProperty(D, Symbol.toStringTag,{value:"Module"})})},"esri/arcade/kernel":function(){define(["exports","../geometry/Extent"],function(D,O){D.cloneGeometry=function(E){if(null==E)return null;const c=E.clone();void 0!==E.cache._geVersion&&(c.cache._geVersion=E.cache._geVersion);return c};D.convertLinearUnitsToCode=function(E){if(null==E)return null;if("number"===typeof E)return E;E=E.toLowerCase();E=E.replaceAll(/\s/g,"");E=E.replaceAll("-","");switch(E){case "meters":case "meter":case "m":case "squaremeters":case "squaremeter":return 9001; case "miles":case "mile":case "squaremile":case "squaremiles":return 9093;case "kilometers":case "kilometer":case "squarekilometers":case "squarekilometer":case "km":return 9036;case "yard":case "yd":case "yards":case "squareyards":case "squareyard":return 9096;case "feet":case "ft":case "foot":case "squarefeet":case "squarefoot":return 9002;case "nmi":case "nauticalmile":case "nauticalmiles":case "squarenauticalmile":case "squarenauticalmiles":return 9030}return null};D.convertSquareUnitsToCode= function(E){if(null==E)return null;if("number"===typeof E)return E;E=E.toLowerCase();E=E.replaceAll(/\s/g,"");E=E.replaceAll("-","");switch(E){case "meters":case "meter":case "m":case "squaremeters":case "squaremeter":return 109404;case "miles":case "mile":case "squaremile":case "squaremiles":return 109439;case "kilometers":case "kilometer":case "squarekilometers":case "squarekilometer":case "km":return 109414;case "acres":case "acre":case "ac":return 109402;case "hectares":case "hectare":case "ha":return 109401; case "yard":case "yd":case "yards":case "squareyards":case "squareyard":return 109442;case "feet":case "ft":case "foot":case "squarefeet":case "squarefoot":return 109405;case "nmi":case "nauticalmile":case "nauticalmiles":case "squarenauticalmile":case "squarenauticalmiles":return 109409}return null};D.isInteger=function(E){return"number"===typeof E&&isFinite(E)&&Math.floor(E)===E};D.sameGeomType=function(E,c){return E===c||"point"===E&&"esriGeometryPoint"===c||"polyline"===E&&"esriGeometryPolyline"=== c||"polygon"===E&&"esriGeometryPolygon"===c||"extent"===E&&"esriGeometryEnvelope"===c||"multipoint"===E&&"esriGeometryMultipoint"===c||"point"===c&&"esriGeometryPoint"===E||"polyline"===c&&"esriGeometryPolyline"===E||"polygon"===c&&"esriGeometryPolygon"===E||"extent"===c&&"esriGeometryEnvelope"===E||"multipoint"===c&&"esriGeometryMultipoint"===E?!0:!1};D.shapeExtent=function(E){if(null==E)return null;switch(E.type){case "polygon":case "multipoint":case "polyline":return E.extent;case "point":return new O({xmin:E.x, ymin:E.y,xmax:E.x,ymax:E.y,spatialReference:E.spatialReference});case "extent":return E}return null};Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})})},"esri/core/number":function(){define(["exports","./string","../intl/locale"],function(D,O,E){function c(w=E.getLocale()){w=w.toLowerCase();let C=w in F;if(!C){const m=w.split("-");1{r="(?:"+O.escapeRegExpString(r,".")+")";return r.replace(d,n=>{const g={signed:!1,separator:w.strict?A:[A,""],fractional:w.fractional,decimal:f,exponent:!1};n=n.split(".");let l=w.places;1===n.length&&1!==m&&(n[1]="###");1===n.length||0===l?g.fractional= !1:(void 0===l&&(l=w.pattern?n[1].lastIndexOf("0")+1:Infinity),l&&null==w.fractional&&(g.fractional=!0),!w.places&&+l{let m="";f&&0!==w.places&&(m="\\"+w.decimal,m=Infinity===w.places?"(?:"+m+"\\d+)?":m+("\\d{"+w.places+"}"));return m},!0),A=k(w.exponent,f=>f?"([eE]"+q({signed:w.eSigned})+")":"");C+=M;M&&(C="(?:(?:"+C+")|(?:"+M+"))");return C+A}function q(w){w=w||{};"signed"in w||(w.signed=[!0,!1]);"separator"in w?"groupSize"in w||(w.groupSize=3):w.separator="";const C=k(w.signed,A=> A?"[-+]":"",!0),M=k(w.separator,A=>{if(!A)return"(?:\\d+)";A=O.escapeRegExpString(A);" "===A?A="\\s":"\u00a0"===A&&(A="\\s\\xa0");const f=w.groupSize,m=w.groupSize2;return m?(A="(?:0|[1-9]\\d{0,"+(m-1)+"}(?:["+A+"]\\d{"+m+"})*["+A+"]\\d{"+f+"})",0{if(!Array.isArray(w))return C(w);const A=[];for(let f=0;fA?1:0]||"-"+w; if(C.includes("%"))A*=100;else if(C.includes("\u2030"))A*=1E3;else{if(C.includes("\u00a4"))throw Error("currency notation not supported");if(C.includes("E"))throw Error("exponential notation not supported");}M=d;var n=w.match(M);if(!n)throw Error("unable to find a number expression in pattern: "+C);!1===f.fractional&&(f.places=0);w=C.replace;n=n[0];f=f={decimal:r,group:m,places:f.places,round:f.round};!0===f.places&&(f.places=0);Infinity===f.places&&(f.places=6);r=n.split(".");var g="string"===typeof f.places&& f.places.indexOf(",");n=f.places;g?n=f.places.substring(g+1):0<=+n||(n=(r[1]||[]).length);0>f.round||(A=Number(A.toFixed(Number(n))));m=String(Math.abs(A)).split(".");A=m[1]||"";r[1]||f.places?(g&&(f.places=f.places.substring(0,g)),g=void 0!==f.places?f.places:r[1]&&r[1].lastIndexOf("0")+1,+g>A.length&&(m[1]=A.padEnd(Number(g),"0")),+nm[0].length&&(m[0]=m[0].padStart(n,"0")),A.includes("#")|| (m[0]=m[0].substr(m[0].length-n)));A=r[0].lastIndexOf(",");let l;if(-1!==A){var z=r[0].length-A-1;r=r[0].substr(0,A);A=r.lastIndexOf(",");-1!==A&&(l=r.length-A-1)}r=[];for(A=m[0];A;)n=A.length-z,r.push(0{if(m)return!1;"Identifier"===n.type&&n.name&&n.name.toLowerCase()===r&&(m=!0);return!0});return m}function b(A){const f=[];c(A,m=>{"ImportDeclaration"===m.type&&m.source&&m.source.value&&f.push({libname:m.specifiers[0].local.name.toLowerCase(),source:m.source.value});return!0});return f}function q(A){const f=[];c(A,m=>{"CallExpression"=== m.type&&"Identifier"===m.callee.type&&f.push(m.callee.name.toLowerCase());return!0});return f}const F={all:{min:2,max:2},time:{min:0,max:4},dateonly:{min:0,max:3},getenvironment:{min:0,max:0},none:{min:2,max:2},any:{min:2,max:2},reduce:{min:2,max:3},map:{min:2,max:2},filter:{min:2,max:2},fromcodepoint:{min:1,max:-1},fromcharcode:{min:1,max:-1},tocodepoint:{min:1,max:2},tocharcode:{min:1,max:2},concatenate:{min:0,max:-1},expects:{min:1,max:-1},getfeatureset:{min:1,max:2},week:{min:1,max:2},fromjson:{min:1, max:1},length3d:{min:1,max:2},tohex:{min:1,max:1},hash:{min:1,max:1},timezone:{min:1,max:1},timezoneoffset:{min:1,max:1},changetimezone:{min:2,max:2},isoweek:{min:1,max:1},isoweekday:{min:1,max:1},hasvalue:{min:2,max:2},isomonth:{min:1,max:1},isoyear:{min:1,max:1},resize:{min:2,max:3},slice:{min:0,max:-1},splice:{min:0,max:-1},push:{min:2,max:2},pop:{min:1,max:1},includes:{min:2,max:2},array:{min:0,max:2},front:{min:1,max:1},back:{min:1,max:1},insert:{min:3,max:3},erase:{min:2,max:2},split:{min:2, max:4},guid:{min:0,max:1},standardizeguid:{min:2,max:2},today:{min:0,max:0},angle:{min:2,max:3},bearing:{min:2,max:3},urlencode:{min:1,max:1},now:{min:0,max:0},timestamp:{min:0,max:0},day:{min:1,max:1},month:{min:1,max:1},year:{min:1,max:1},hour:{min:1,max:1},second:{min:1,max:1},millisecond:{min:1,max:1},minute:{min:1,max:1},weekday:{min:1,max:1},toutc:{min:1,max:1},tolocal:{min:1,max:1},date:{min:0,max:8},datediff:{min:2,max:4},dateadd:{min:2,max:3},trim:{min:1,max:1},text:{min:1,max:2},left:{min:2, max:2},right:{min:2,max:2},mid:{min:2,max:3},upper:{min:1,max:1},proper:{min:1,max:2},lower:{min:1,max:1},find:{min:2,max:3},iif:{min:3,max:3},decode:{min:2,max:-1},when:{min:2,max:-1},defaultvalue:{min:2,max:3},isempty:{min:1,max:1},domaincode:{min:2,max:4},domainname:{min:2,max:4},polygon:{min:1,max:1},point:{min:1,max:1},polyline:{min:1,max:1},extent:{min:1,max:1},multipoint:{min:1,max:1},ringisclockwise:{min:1,max:1},geometry:{min:1,max:1},count:{min:0,max:-1},number:{min:1,max:2},acos:{min:1, max:1},asin:{min:1,max:1},atan:{min:1,max:1},atan2:{min:2,max:2},ceil:{min:1,max:2},floor:{min:1,max:2},round:{min:1,max:2},cos:{min:1,max:1},exp:{min:1,max:1},log:{min:1,max:1},min:{min:0,max:-1},constrain:{min:3,max:3},console:{min:0,max:-1},max:{min:0,max:-1},pow:{min:2,max:2},random:{min:0,max:0},sqrt:{min:1,max:1},sin:{min:1,max:1},tan:{min:1,max:1},abs:{min:1,max:1},isnan:{min:1,max:1},stdev:{min:0,max:-1},average:{min:0,max:-1},mean:{min:0,max:-1},sum:{min:0,max:-1},variance:{min:0,max:-1}, distinct:{min:0,max:-1},first:{min:1,max:1},top:{min:2,max:2},boolean:{min:1,max:1},dictionary:{min:0,max:-1},typeof:{min:1,max:1},reverse:{min:1,max:1},replace:{min:3,max:4},sort:{min:1,max:2},feature:{min:1,max:-1},haskey:{min:2,max:2},indexof:{min:2,max:2},disjoint:{min:2,max:2},intersects:{min:2,max:2},touches:{min:2,max:2},crosses:{min:2,max:2},within:{min:2,max:2},contains:{min:2,max:2},overlaps:{min:2,max:2},equals:{min:2,max:2},relate:{min:3,max:3},intersection:{min:2,max:2},union:{min:1, max:2},difference:{min:2,max:2},symmetricdifference:{min:2,max:2},clip:{min:2,max:2},cut:{min:2,max:2},area:{min:1,max:2},areageodetic:{min:1,max:2},length:{min:1,max:2},lengthgeodetic:{min:1,max:2},distancegeodetic:{min:2,max:3},distance:{min:2,max:3},densify:{min:2,max:3},densifygeodetic:{min:2,max:3},generalize:{min:2,max:4},buffer:{min:2,max:3},buffergeodetic:{min:2,max:3},offset:{min:2,max:6},rotate:{min:2,max:3},issimple:{min:1,max:1},simplify:{min:1,max:1},convexhull:{min:1,max:1},centroid:{min:1, max:1},nearestcoordinate:{min:2,max:2},nearestvertex:{min:2,max:2},isselfintersecting:{min:1,max:1},multiparttosinglepart:{min:1,max:1},setgeometry:{min:2,max:2},portal:{min:1,max:1},getuser:{min:0,max:2},subtypes:{min:1,max:1},subtypecode:{min:1,max:1},subtypename:{min:1,max:1},domain:{min:2,max:3},convertdirection:{min:3,max:3},sqltimestamp:{min:1,max:3},schema:{min:1,max:1},measuretocoordinate:{min:2,max:2},distancetocoordinate:{min:2,max:2},pointtocoordinate:{min:2,max:2}},d={functionDefinitions:new Map, constantDefinitions:new Map},k={functionDefinitions:new Map,constantDefinitions:new Map};for(var w of["pi","infinity"])k.constantDefinitions.set(w,{type:"constant"}),d.constantDefinitions.set(w,{type:"constant"});k.constantDefinitions.set("textformatting",{type:"namespace",key:"textformatting",members:[{key:"backwardslash",type:"constant"},{key:"doublequote",type:"constant"},{key:"forwardslash",type:"constant"},{key:"tab",type:"constant"},{key:"singlequote",type:"constant"},{key:"newline",type:"constant"}]}); d.constantDefinitions.set("textformatting",{type:"namespace",key:"textformatting",members:[{key:"backwardslash",type:"constant"},{key:"tab",type:"constant"},{key:"singlequote",type:"constant"},{key:"doublequote",type:"constant"},{key:"forwardslash",type:"constant"},{key:"newline",type:"constant"}]});for(const A in F)w=F[A],k.functionDefinitions.set(A,{overloads:[{type:"function",parametersInfo:{min:w.min,max:w.max}}]}),d.functionDefinitions.set(A,{overloads:[{type:"function",parametersInfo:{min:w.min, max:w.max}}]});const C=new Set("featureset featuresetbyid featuresetbyname featuresetbyassociation featuresetbyrelationshipname featuresetbyurl getfeatureset getuser attachments featuresetbyportalitem getfeaturesetinfo filterbysubtypecode knowledgegraphbyportalitem querygraph".split(" ")),M=new Set("disjoint intersects touches crosses within contains overlaps equals relate intersection nearestvertex nearestcoordinate union difference symmetricdifference clip cut area areageodetic length length3d lengthgeodetic distance distancegeodetic densify densifygeodetic generalize buffer buffergeodetic offset rotate issimple convexhull simplify multiparttosinglepart pointtocoordinate distancetocoordinate measuretocoordinate".split(" ")); D.addFunctionDeclaration=function(A,f){f="sync"===f?d:k;f.functionDefinitions.has(A.name.toLowerCase())?f.functionDefinitions.get(A.name.toLowerCase())?.overloads.push({type:"function",parametersInfo:{min:A.min,max:A.max}}):f.functionDefinitions.set(A.name.toLowerCase(),{overloads:[{type:"function",parametersInfo:{min:A.min,max:A.max}}]})};D.extractFunctionDeclaration=function(A,f){const m=[];if(void 0!==f.params&&null!==f.params)for(let r=0;r{if("CallExpression"===m.type){if("Identifier"===m.callee.type&&"expects"===m.callee.name.toLowerCase()){var r="";for(let n=0;n<(m.arguments||[]).length;n++)0===n?"Identifier"===m.arguments[n].type&&(r=m.arguments[n].name.toLowerCase()):r&&"Literal"===m.arguments[n].type&&O(m.arguments[n].value)&&f.push(r+"."+m.arguments[n].value.toLowerCase());return!1}if("Identifier"===m.callee.type&&["domainname","domaincode","domain","haskey"].includes(m.callee.name.toLowerCase())&& 2<=m.arguments.length)return r="","Identifier"===m.arguments[0].type&&(r=m.arguments[0].name.toLowerCase()),r&&"Literal"===m.arguments[1].type&&O(m.arguments[1].value)&&f.push(r+"."+m.arguments[1].value.toLowerCase()),!1}if("MemberExpression"!==m.type||"Identifier"!==m.object.type)return!0;!1===m.computed&&m.object&&m.object.name&&m.property&&"Identifier"===m.property.type&&m.property.name?f.push(m.object.name.toLowerCase()+"."+m.property.name.toLowerCase()):m.object&&m.object.name&&m.property&&"Literal"=== m.property.type&&"string"===typeof m.property.value&&f.push(m.object.name.toLowerCase()+"."+m.property.value?.toString().toLowerCase());return!1});return f};D.findFieldLiterals=function(A){const f=[];c(A,m=>{if("MemberExpression"!==m.type||"Identifier"!==m.object.type)return!0;!1===m.computed&&m.object&&m.object.name&&m.property&&"Identifier"===m.property.type&&m.property.name?f.push(m.object.name.toLowerCase()+"."+m.property.name.toLowerCase()):m.object&&m.object.name&&m.property&&"Literal"===m.property.type&& "string"===typeof m.property.value&&f.push(m.object.name.toLowerCase()+"."+m.property.value?.toString().toLowerCase());return!1});return f};D.findFunctionCalls=q;D.findModuleImports=b;D.findScriptDependencies=function(A,f=[]){let m=null;if(void 0===A.usesFeatureSet){null===m&&(m=q(A));A.usesFeatureSet=!1;for(let r=0;rm?!1:"CallExpression"===n.type&&"Identifier"===n.callee.type&&n.callee.name&&n.callee.name.toLowerCase()===r?(m=!0,!1):!0);return m};D.referencesMember=y;D.scriptUsesFeatureSet=function(A){A=q(A);for(let f=0;f< A.length;f++)if(C.has(A[f]))return!0;return!1};D.walk=c;Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})})},"esri/chunks/array":function(){define("exports ../arcade/deepClone ../arcade/executionError ../arcade/ImmutableArray ./languageUtils ../core/promiseUtils".split(" "),function(D,O,E,c,y,b){function q(d){function k(f,m,r){if(f instanceof c)return f.toArray();if(y.isArray(f))return f;throw new E.ArcadeExecutionError(m,E.ExecutionErrorCodes.InvalidParameter,r);}function w(f,m){var r= f.length,n=Math.floor(r/2);if(0===r)return[];if(1===r)return[f[0]];var g=w(f.slice(0,n),m);f=w(f.slice(n,r),m);for(r=[];0=n?(r.push(g[0]),g=g.slice(1)):(r.push(f[0]),f=f.slice(1))):0=g?(n.push(f[0]),f=f.slice(1)):(n.push(m[0]),m=m.slice(1));return M(f,m,r,n)}if(0z(G,a))}f=g;if(0===f.length)return[];r={};for(n=0;n{if(null===z||void 0===z||z===y.voidOperation)return null===G||void 0===G||G===y.voidOperation?0:1;if(null===G||void 0===G||G===y.voidOperation)return-1;z=y.toString(z);G=y.toString(G);return zz-G):"Boolean"===m?w(f,(z,G)=>z===G?0:G?-1:1):"Date"===m?w(f,(z,G)=>G-z):f.slice(0)}d.functions.array=function(f,m){return d.standardFunction(f,m,(r,n,g)=>{y.pcCheck(g,0,2,f,m);if(0===g.length||1===g.length&&null===g[0])return[];if(y.isArray(g[0])){if(2=== g.length&&!1===y.isBoolean(g[1]))throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.InvalidParameter,m);return!0===y.defaultUndefined(g[1],!1)?O.deepClone(g[0]):g[0].slice(0)}if(y.isImmutableArray(g[0])){if(2===g.length&&!1===y.isBoolean(g[1]))throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.InvalidParameter,m);return!0===y.defaultUndefined(g[1],!1)?O.deepClone(g[0]):g[0].toArray().slice(0)}r=y.toNumber(g[0]);if(isNaN(r)||!1===y.isInteger(r))throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.InvalidParameter, m);g=y.defaultUndefined(g[1],null);r=Array(r);r.fill(g);return r})};d.functions.front=function(f,m){return d.standardFunction(f,m,(r,n,g)=>{y.pcCheck(g,1,1,f,m);if(y.isImmutableArray(g[0])){if(0>=g[0].length())throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.OutOfBounds,m);return g[0].get(0)}if(y.isArray(g[0])){if(0>=g[0].length)throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.OutOfBounds,m);return g[0][0]}throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.InvalidParameter,m); })};d.functions.back=function(f,m){return d.standardFunction(f,m,(r,n,g)=>{y.pcCheck(g,1,1,f,m);if(y.isImmutableArray(g[0])){if(0>=g[0].length())throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.OutOfBounds,m);return g[0].get(g[0].length()-1)}if(y.isArray(g[0])){if(0>=g[0].length)throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.OutOfBounds,m);return g[0][g[0].length-1]}throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.InvalidParameter,m);})};d.functions.push=function(f,m){return d.standardFunction(f, m,(r,n,g)=>{y.pcCheck(g,1,2,f,m);if(y.isArray(g[0]))return g[0][g[0].length]=g[1],g[0].length;throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.InvalidParameter,m);})};d.functions.pop=function(f,m){return d.standardFunction(f,m,(r,n,g)=>{y.pcCheck(g,1,1,f,m);if(y.isArray(g[0])){if(0>=g[0].length)throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.OutOfBounds,m);r=g[0][g[0].length-1];--g[0].length;return r}throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.InvalidParameter,m);})}; d.functions.erase=function(f,m){return d.standardFunction(f,m,(r,n,g)=>{y.pcCheck(g,2,2,f,m);if(y.isArray(g[0])){r=y.toNumber(g[1]);if(isNaN(r)||!1===y.isInteger(r))throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.InvalidParameter,m);g=g[0];if(0>=g.length)throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.OutOfBounds,m);0>r&&(r=g.length+r);if(0>r)throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.OutOfBounds,m);if(r>=g.length)throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.OutOfBounds, m);g.splice(r,1);return y.voidOperation}throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.InvalidParameter,m);})};d.functions.insert=function(f,m){return d.standardFunction(f,m,(r,n,g)=>{y.pcCheck(g,3,3,f,m);if(y.isArray(g[0])){r=y.toNumber(g[1]);if(isNaN(r)||!1===y.isInteger(r))throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.InvalidParameter,m);n=g[2];g=g[0];if(r>g.length)throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.OutOfBounds,m);if(0>r&&r<-1*g.length)throw new E.ArcadeExecutionError(f, E.ExecutionErrorCodes.OutOfBounds,m);if(r===g.length)return g[r]=n,y.voidOperation;g.splice(r,0,n);return y.voidOperation}throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.InvalidParameter,m);})};d.functions.resize=function(f,m){return d.standardFunction(f,m,(r,n,g)=>{y.pcCheck(g,2,3,f,m);if(y.isArray(g[0])){n=y.toNumber(g[1]);if(isNaN(n)||!1===y.isInteger(n))throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.InvalidParameter,m);if(0>n)throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.InvalidParameter, m);r=y.defaultUndefined(g[2],null);g=g[0];if(g.length>=n)return g.length=n,y.voidOperation;const l=g.length;g.length=n;for(n=l;n{y.pcCheck(g,2,2,f,m);if(y.isArray(g[0])){const l=g[1];return-1y.equalityTest(z,l))?!0:!1}if(y.isImmutableArray(g[0])){const l=g[1];return-1 y.equalityTest(z,l))?!0:!1}throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.InvalidParameter,m);})};d.functions.slice=function(f,m){return d.standardFunction(f,m,(r,n,g)=>{y.pcCheck(g,1,3,f,m);if(y.isArray(g[0])){r=y.toNumber(y.defaultUndefined(g[1],0));n=y.toNumber(y.defaultUndefined(g[2],g[0].length));if(isNaN(r)||!1===y.isInteger(r))throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.InvalidParameter,m);if(isNaN(n)||!1===y.isInteger(n))throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.InvalidParameter, m);return g[0].slice(r,n)}if(y.isImmutableArray(g[0])){r=g[0];n=y.toNumber(y.defaultUndefined(g[1],0));g=y.toNumber(y.defaultUndefined(g[2],r.length()));if(isNaN(n)||!1===y.isInteger(n))throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.InvalidParameter,m);if(isNaN(g)||!1===y.isInteger(g))throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.InvalidParameter,m);return r.toArray().slice(n,g)}throw new E.ArcadeExecutionError(f,E.ExecutionErrorCodes.InvalidParameter,m);})};d.functions.splice= function(f,m){return d.standardFunction(f,m,(r,n,g)=>{r=[];for(n=0;n{y.pcCheck(g,2,2,f,m);if(y.isArray(g[0]))return y.toNumber(g[1])>=g[0].length?g[0].slice(0):g[0].slice(0,y.toNumber(g[1]));if(y.isImmutableArray(g[0]))return y.toNumber(g[1])>=g[0].length()?g[0].slice(0):g[0].slice(0,y.toNumber(g[1]));throw new E.ArcadeExecutionError(f, E.ExecutionErrorCodes.InvalidParameter,m);})};d.functions.first=function(f,m){return d.standardFunction(f,m,(r,n,g)=>{y.pcCheck(g,1,1,f,m);return y.isArray(g[0])?0===g[0].length?null:g[0][0]:y.isImmutableArray(g[0])?0===g[0].length()?null:g[0].get(0):null})};"sync"===d.mode&&(d.functions.sort=function(f,m){return d.standardFunction(f,m,(r,n,g)=>A(f,n,g,!1))},d.functions.any=function(f,m){return d.standardFunction(f,m,(r,n,g)=>{y.pcCheck(g,2,2,f,n);r=g[1].createFunction(f);n=k(g[0],f,n);for(const l of n)if(n= r(l),y.isBoolean(n)&&!0===n)return!0;return!1})},d.functions.all=function(f,m){return d.standardFunction(f,m,(r,n,g)=>{y.pcCheck(g,2,2,f,n);r=g[1].createFunction(f);n=k(g[0],f,n);for(const l of n)if(!0!==r(l))return!1;return!0})},d.functions.none=function(f,m){return d.standardFunction(f,m,(r,n,g)=>{y.pcCheck(g,2,2,f,n);r=g[1].createFunction(f);n=k(g[0],f,n);for(const l of n)if(!0===r(l))return!1;return!0})},d.functions.reduce=function(f,m){return d.standardFunction(f,m,(r,n,g)=>{y.pcCheck(g,2,3, f,n);const l=g[1].createFunction(f);r=k(g[0],f,n);return 2===g.length?0===r.length?null:r.reduce((z,G)=>{z=l(z,G);return z=void 0!==z&&z!==y.voidOperation?z:null}):r.reduce((z,G)=>{z=l(z,G);return z=void 0!==z&&z!==y.voidOperation?z:null},g[2])})},d.functions.map=function(f,m){return d.standardFunction(f,m,(r,n,g)=>{y.pcCheck(g,2,2,f,n);r=g[1].createFunction(f);g=k(g[0],f,n);n=[];for(const l of g)g=r(l),void 0!==g&&g!==y.voidOperation?n.push(g):n.push(null);return n})},d.functions.filter=function(f, m){return d.standardFunction(f,m,(r,n,g)=>{y.pcCheck(g,2,2,f,n);r=g[1].createFunction(f);n=k(g[0],f,n);g=[];for(const l of n)!0===r(l)&&g.push(l);return g})});"async"===d.mode&&(d.functions.sort=function(f,m){return d.standardFunctionAsync(f,m,async(r,n,g)=>A(f,n,g,!0))},d.functions.any=function(f,m){return d.standardFunctionAsync(f,m,async(r,n,g)=>{y.pcCheck(g,2,2,f,n);r=g[1].createFunction(f);n=k(g[0],f,n);for(const l of n)if(n=await r(l),g=null,g=b.isPromiseLike(g)?await n:n,y.isBoolean(g)&&!0=== g)return!0;return!1})},d.functions.all=function(f,m){return d.standardFunctionAsync(f,m,async(r,n,g)=>{y.pcCheck(g,2,2,f,n);r=g[1].createFunction(f);n=k(g[0],f,n);for(const l of n)if(n=await r(l),g=null,g=b.isPromiseLike(g)?await n:n,!0!==g)return!1;return!0})},d.functions.none=function(f,m){return d.standardFunctionAsync(f,m,async(r,n,g)=>{y.pcCheck(g,2,2,f,n);r=g[1].createFunction(f);n=k(g[0],f,n);for(const l of n)if(n=await r(l),g=null,g=b.isPromiseLike(g)?await n:n,!0===g)return!1;return!0})}, d.functions.filter=function(f,m){return d.standardFunctionAsync(f,m,async(r,n,g)=>{y.pcCheck(g,2,2,f,n);r=g[1].createFunction(f);g=k(g[0],f,n);n=[];for(const l of g){g=await r(l);let z=null;z=b.isPromiseLike(z)?await g:g;!0===z&&n.push(l)}return n})},d.functions.reduce=function(f,m){return d.standardFunctionAsync(f,m,async(r,n,g)=>{y.pcCheck(g,2,3,f,n);const l=g[1].createFunction(f);r=k(g[0],f,n);if(2{z=await z;if(void 0===z||z===y.voidOperation)z= null;return l(z,G)},Promise.resolve(g));else{if(0===r.length)return null;g=r.reduce(async(z,G,a)=>{if(1>=a)return l(z,G);z=await z;if(void 0===z||z===y.voidOperation)z=null;return l(z,G)})}return g.then(z=>void 0!==z&&z!==y.voidOperation?z:null)})},d.functions.map=function(f,m){return d.standardFunctionAsync(f,m,async(r,n,g)=>{y.pcCheck(g,2,2,f,n);r=g[1].createFunction(f);g=k(g[0],f,n);n=[];for(const l of g){g=await r(l);let z=null;z=b.isPromiseLike(z)?await g:g;void 0!==z&&z!==y.voidOperation?n.push(z): n.push(null)}return n})})}const F=Object.freeze(Object.defineProperty({__proto__:null,registerFunctions:q},Symbol.toStringTag,{value:"Module"}));D.ArrayFunctions=F;D.registerFunctions=q})},"esri/arcade/functions/date":function(){define("exports ../ArcadeDate ../executionError ../../chunks/languageUtils ../../core/sql/DateOnly ../../core/sql/TimeOnly ../../intl/locale ../../chunks/datetime".split(" "),function(D,O,E,c,y,b,q,F){function d(A){return null===A?A:!1===A.isValid?null:A}function k(A,f){return""=== A||"default"===A.toLowerCase().trim()?c.defaultTimeZone(f):"z"===A||"Z"===A?"UTC":A}function w(A,f){return c.isDateOnly(A)?A.toArcadeDate():c.toDate(A,c.defaultTimeZone(f))}const C=[0,31,59,90,120,151,181,212,243,273,304,334],M=[0,31,60,91,121,152,182,213,244,274,305,335];D.registerFunctions=function(A,f){A.today=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,0,0,m,r);n=new Date;n.setHours(0,0,0,0);return O.ArcadeDate.dateJSAndZoneToArcadeDate(n,c.defaultTimeZone(m))})};A.time=function(m,r){return f(m, r,(n,g,l)=>{c.pcCheck(l,0,4,m,r);switch(l.length){case 0:return n=O.ArcadeDate.nowToArcadeDate(c.defaultTimeZone(m)),new b.TimeOnly(n.hour,n.minute,n.second,n.millisecond);case 1:if(c.isTime(l[0]))return l[0].clone();if(c.isDate(l[0]))return new b.TimeOnly(l[0].hour,l[0].minute,l[0].second,l[0].millisecond);if(c.isDateOnly(l[0]))return new b.TimeOnly(0,0,0,0);if(c.isString(l[0]))return b.TimeOnly.fromString(l[0]);n=c.toNumber(l[0]);return!1===isNaN(n)?b.TimeOnly.fromMilliseconds(n):null;case 2:return c.isString(l[0])&& c.isString(l[1])?b.TimeOnly.fromString(l[0],l[1]):b.TimeOnly.fromParts(c.toNumber(l[0]),c.toNumber(l[1]),0,0);case 3:return b.TimeOnly.fromParts(c.toNumber(l[0]),c.toNumber(l[1]),c.toNumber(l[2]),0);case 4:return b.TimeOnly.fromParts(c.toNumber(l[0]),c.toNumber(l[1]),c.toNumber(l[2]),c.toNumber(l[3]))}throw new E.ArcadeExecutionError(m,E.ExecutionErrorCodes.InvalidParameter,r);})};A.dateonly=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,0,3,m,r);if(3===l.length)return y.DateOnly.fromParts(c.toNumber(l[0]), c.toNumber(l[1])+1,c.toNumber(l[2]));if(2===l.length)return n=c.toString(l[1]),""===n?null:"X"===n?y.DateOnly.fromSeconds(c.toNumber(l[0])):"x"===n?y.DateOnly.fromMilliseconds(c.toNumber(l[0])):y.DateOnly.fromString(c.toString(l[0]),n);if(1===l.length){if(c.isString(l[0])){if(""===l[0].replaceAll(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""))return null;if(!0===/^[0-9][0-9][0-9][0-9]$/.test(l[0]))return y.DateOnly.fromString(l[0]+"-01-01")}if(c.isDateOnly(l[0]))return l[0].clone();if(c.isDate(l[0]))return y.DateOnly.fromParts(l[0].year, l[0].monthJS+1,l[0].day);n=c.toNumber(l[0]);return!1===isNaN(n)?y.DateOnly.fromMilliseconds(n):c.isString(l[0])?y.DateOnly.fromString(l[0]):null}return 0===l.length?(l=O.ArcadeDate.nowToArcadeDate(c.defaultTimeZone(m)),!1===l.isValid?null:y.DateOnly.fromParts(l.year,l.monthJS+1,l.day)):null})};A.changetimezone=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,2,2,m,r);if(null===l[0])return null;if(c.isDateOnly(l[0]))throw new E.ArcadeExecutionError(m,E.ExecutionErrorCodes.CannotChangeTimeZoneDateOnly, r);if(c.isDateOnly(l[0]))throw new E.ArcadeExecutionError(m,E.ExecutionErrorCodes.CannotChangeTimeZoneTime,r);n=c.toDate(l[0],c.defaultTimeZone(m));if(null===n)throw new E.ArcadeExecutionError(m,E.ExecutionErrorCodes.InvalidParameter,r);l=O.createDateTimeZone(k(c.toString(l[1]),m),!1);if(null===l)return null;l=O.ArcadeDate.arcadeDateAndZoneToArcadeDate(n,l);return!1===l.isValid?null:l})};A.timezone=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,1,2,m,r);if(c.isTime(l[0])||c.isDateOnly(l[0]))return"Unknown"; n=c.toDate(l[0],c.defaultTimeZone(m));if(null===n)return null;n=n.timeZone;return"system"===n?O.ArcadeDate.systemTimeZoneCanonicalName:"utc"===n.toLowerCase()?"UTC":"unknown"===n.toLowerCase()?"Unknown":n})};A.timezoneoffset=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,1,1,m,r);n=c.toDate(l[0],c.defaultTimeZone(m));return null===n?null:6E4*n.timeZoneOffset})};A.now=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,0,0,m,r);n=O.ArcadeDate.nowToArcadeDate(c.defaultTimeZone(m));return!1===n.isValid? null:n})};A.timestamp=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,0,0,m,r);n=O.ArcadeDate.nowUTCToArcadeDate();return!1===n.isValid?null:n})};A.toutc=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,1,1,m,r);n=c.toDate(l[0],c.defaultTimeZone(m));return null===n?null:n.toUTC()})};A.tolocal=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,1,1,m,r);n=c.toDate(l[0],c.defaultTimeZone(m));return null===n?null:n.toLocal()})};A.day=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,1,1,m,r);n=w(l[0],c.defaultTimeZone(m)); return null===n?NaN:n.day})};A.month=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,1,1,m,r);n=w(l[0],c.defaultTimeZone(m));return null===n?NaN:n.monthJS})};A.year=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,1,1,m,r);n=w(l[0],c.defaultTimeZone(m));return null===n?NaN:n.year})};A.hour=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,1,1,m,r);if(c.isTime(l[0]))return l[0].hour;n=c.toDate(l[0],c.defaultTimeZone(m));return null===n?NaN:n.hour})};A.second=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l, 1,1,m,r);if(c.isTime(l[0]))return l[0].second;n=c.toDate(l[0],c.defaultTimeZone(m));return null===n?NaN:n.second})};A.millisecond=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,1,1,m,r);if(c.isTime(l[0]))return l[0].millisecond;n=c.toDate(l[0],c.defaultTimeZone(m));return null===n?NaN:n.millisecond})};A.minute=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,1,1,m,r);if(c.isTime(l[0]))return l[0].minute;n=c.toDate(l[0],c.defaultTimeZone(m));return null===n?NaN:n.minute})};A.week=function(m,r){return f(m, r,(n,g,l)=>{c.pcCheck(l,1,2,m,r);g=w(l[0],c.defaultTimeZone(m));if(null===g)return NaN;l=c.toNumber(c.defaultUndefined(l[1],0));if(0>l||6n-l?7:0){c.pcCheck(l,1,1,m,r);n=w(l[0],c.defaultTimeZone(m));return null===n?NaN:n.dayOfWeekJS})};A.isoweekday= function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,1,1,m,r);n=w(l[0],c.defaultTimeZone(m));return null===n?NaN:n.dayOfWeekISO})};A.isomonth=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,1,1,m,r);n=w(l[0],c.defaultTimeZone(m));return null===n?NaN:n.monthISO})};A.isoweek=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,1,1,m,r);n=w(l[0],c.defaultTimeZone(m));return null===n?NaN:n.weekISO})};A.isoyear=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,1,1,m,r);n=w(l[0],c.defaultTimeZone(m));return null=== n?NaN:n.yearISO})};A.date=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,0,8,m,r);if(3===l.length)return c.isDateOnly(l[0])&&c.isTime(l[1])&&c.isString(l[2])?(n=O.createDateTimeZone(k(c.toString(l[2])??"unknown",m),!1),null===n?null:d(O.ArcadeDate.fromParts(l[0].year,l[0].month,l[0].day,l[1].hour,l[1].minute,l[1].second,l[1].millisecond,n))):d(O.ArcadeDate.fromParts(c.toNumber(l[0]),c.toNumber(l[1])+1,c.toNumber(l[2]),0,0,0,0,c.defaultTimeZone(m)));if(4===l.length)return d(O.ArcadeDate.fromParts(c.toNumber(l[0]), c.toNumber(l[1])+1,c.toNumber(l[2]),c.toNumber(l[3]),0,0,0,c.defaultTimeZone(m)));if(5===l.length)return d(O.ArcadeDate.fromParts(c.toNumber(l[0]),c.toNumber(l[1])+1,c.toNumber(l[2]),c.toNumber(l[3]),c.toNumber(l[4]),0,0,c.defaultTimeZone(m)));if(6===l.length)return d(O.ArcadeDate.fromParts(c.toNumber(l[0]),c.toNumber(l[1])+1,c.toNumber(l[2]),c.toNumber(l[3]),c.toNumber(l[4]),c.toNumber(l[5]),0,c.defaultTimeZone(m)));if(7===l.length)return d(O.ArcadeDate.fromParts(c.toNumber(l[0]),c.toNumber(l[1])+ 1,c.toNumber(l[2]),c.toNumber(l[3]),c.toNumber(l[4]),c.toNumber(l[5]),c.toNumber(l[6]),c.defaultTimeZone(m)));if(8===l.length)return n=O.createDateTimeZone(k(c.toString(l[7])??"unknown",m),!1),null===n?null:d(O.ArcadeDate.fromParts(c.toNumber(l[0]),c.toNumber(l[1])+1,c.toNumber(l[2]),c.toNumber(l[3]),c.toNumber(l[4]),c.toNumber(l[5]),c.toNumber(l[6]),n));if(2===l.length){if(c.isDateOnly(l[0])&&c.isString(l[1]))return n=O.createDateTimeZone(k(c.toString(l[1])??"unknown",m),!1),null===n?null:d(O.ArcadeDate.fromParts(l[0].year, l[0].month,l[0].day,0,0,0,0,n));if(c.isDateOnly(l[0])&&c.isTime(l[1]))return d(O.ArcadeDate.fromParts(l[0].year,l[0].month,l[0].day,l[1].hour,l[1].minute,l[1].second,l[1].millisecond,"unknown"));n=c.toString(l[1]);if(""===n)return null;n=c.standardiseDateFormat(n,!0);l="X"===n?F.DateTime.fromSeconds(c.toNumber(l[0])):"x"===n?F.DateTime.fromMillis(c.toNumber(l[0])):F.DateTime.fromFormat(c.toString(l[0]),n,{locale:q.getLocale(),numberingSystem:"latn"});return l.isValid?O.ArcadeDate.dateTimeToArcadeDate(l): null}if(1===l.length){if(c.isDateOnly(l[0]))return d(O.ArcadeDate.fromParts(l[0].year,l[0].month,l[0].day,0,0,0,0,"unknown"));if(c.isString(l[0])){if(""===l[0].replaceAll(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""))return null;if(!0===/^[0-9][0-9][0-9][0-9]$/.test(l[0]))return c.toDate(l[0]+"-01-01",c.defaultTimeZone(m))}n=c.toNumber(l[0]);return!1===isNaN(n)?(l=F.DateTime.fromMillis(n),l.isValid?O.ArcadeDate.dateTimeAndZoneToArcadeDate(l,c.defaultTimeZone(m)):null):c.toDate(l[0],c.defaultTimeZone(m))}return 0=== l.length?O.ArcadeDate.nowToArcadeDate(c.defaultTimeZone(m)):null})};A.datediff=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,2,4,m,r);if(c.isTime(l[0]))return c.isTime(l[1])?l[0].difference(l[1],c.toString(l[2])):NaN;if(c.isTime(l[1]))return NaN;if(c.isDateOnly(l[0]))return c.isDateOnly(l[1])?l[0].difference(l[1],c.toString(l[2])):NaN;if(c.isDateOnly(l[1]))return NaN;n=c.toDate(l[0],c.defaultTimeZone(m));g=c.toDate(l[1],c.defaultTimeZone(m));if(null===n||null===g)return NaN;let z=c.defaultUndefined(l[3], "");""!==z&&null!==z?(z=k(c.toString(z),m),n=O.ArcadeDate.arcadeDateAndZoneToArcadeDate(n,z),g=O.ArcadeDate.arcadeDateAndZoneToArcadeDate(g,z)):n.timeZone!==g.timeZone&&(n.isUnknownTimeZone?n=O.ArcadeDate.arcadeDateAndZoneToArcadeDate(n,g.timeZone):g=O.ArcadeDate.arcadeDateAndZoneToArcadeDate(g,n.timeZone));switch(c.toString(l[2]).toLowerCase()){case "days":case "day":case "d":return n.diff(g,"days");case "months":case "month":return n.diff(g,"months");case "minutes":case "minute":case "m":return"M"=== l[2]?n.diff(g,"months"):n.diff(g,"minutes");case "seconds":case "second":case "s":return n.diff(g,"seconds");case "milliseconds":case "millisecond":case "ms":return n.diff(g);case "hours":case "hour":case "h":return n.diff(g,"hours");case "years":case "year":case "y":return n.diff(g,"years");default:return n.diff(g)}})};A.dateadd=function(m,r){return f(m,r,(n,g,l)=>{c.pcCheck(l,2,3,m,r);n=c.toNumber(l[1]);if(isNaN(n)||Infinity===n||-Infinity===n)return c.isTime(l[0])||c.isDateOnly(l[0])?l[0].clone(): c.toDate(l[0],c.defaultTimeZone(m));g="milliseconds";switch(c.toString(l[2]).toLowerCase()){case "days":case "day":case "d":g="days";n=c.isDateOnly(l[0])?n:c.absRound(n);break;case "months":case "month":g="months";n=c.isDateOnly(l[0])?n:c.absRound(n);break;case "minutes":case "minute":case "m":g="M"===l[2]?"months":"minutes";break;case "seconds":case "second":case "s":g="seconds";break;case "milliseconds":case "millisecond":case "ms":g="milliseconds";break;case "hours":case "hour":case "h":g="hours"; break;case "years":case "year":case "y":g="years"}if(c.isTime(l[0])||c.isDateOnly(l[0]))return l[0].plus(g,n);l=c.toDate(l[0],c.defaultTimeZone(m));return null===l?null:l.plus({[g]:n})})}};Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})})},"esri/arcade/functions/geometry":function(){define("exports ../containerUtils ../Dictionary ../executionError ../Feature ../ImmutablePointArray ../../chunks/languageUtils ./centroid ../../geometry/Extent ../../geometry/Geometry ../../geometry/Multipoint ../../geometry/Point ../../geometry/Polygon ../../geometry/Polyline ../../geometry/support/coordsUtils ../../geometry/support/jsonUtils".split(" "), function(D,O,E,c,y,b,q,F,d,k,w,C,M,A,f,m){D.registerFunctions=function(r,n){r.ringisclockwise=function(g,l){return n(g,l,(z,G,a)=>{q.pcCheck(a,1,1,g,l);z=[];if(null===a[0])return!1;if(q.isArray(a[0]))for(const B of a[0])if(B instanceof C)z.push(B.hasZ?B.hasM?[B.x,B.y,B.z,B.m]:[B.x,B.y,B.z]:[B.x,B.y]);else throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.InvalidParameter,l);else if(a[0]instanceof b)z=a[0]._elements;else if(q.isImmutableArray(a[0]))for(const B of a[0].toArray())if(B instanceof C)z.push(B.hasZ?B.hasM?[B.x,B.y,B.z,B.m]:[B.x,B.y,B.z]:[B.x,B.y]);else throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.InvalidParameter,l);else throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.InvalidParameter,l);return 3>z.length?!1:f.isClockwise(z)})};r.polygon=function(g,l){return n(g,l,(z,G,a)=>{q.pcCheck(a,1,1,g,l);if(a[0]instanceof E){if(z=q.fixSpatialReference(y.parseGeometryFromDictionary(a[0],g.spatialReference),g.spatialReference),!1===z instanceof M)throw new c.ArcadeExecutionError(g, c.ExecutionErrorCodes.InvalidParameter,l);}else a[0]instanceof M?z=m.fromJSON(a[0].toJSON()):((z=JSON.parse(a[0]))&&!z.spatialReference&&(z.spatialReference=g.spatialReference),z=q.fixSpatialReference(new M(z),g.spatialReference));if(null!==z&&!1===z.spatialReference.equals(g.spatialReference))throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.WrongSpatialReference,l);return q.fixNullGeometry(z)})};r.polyline=function(g,l){return n(g,l,(z,G,a)=>{q.pcCheck(a,1,1,g,l);if(a[0]instanceof E){if(z= q.fixSpatialReference(y.parseGeometryFromDictionary(a[0],g.spatialReference),g.spatialReference),!1===z instanceof A)throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.InvalidParameter,l);}else a[0]instanceof A?z=m.fromJSON(a[0].toJSON()):((z=JSON.parse(a[0]))&&!z.spatialReference&&(z.spatialReference=g.spatialReference),z=q.fixSpatialReference(new A(z),g.spatialReference));if(null!==z&&!1===z.spatialReference.equals(g.spatialReference))throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.WrongSpatialReference, l);return q.fixNullGeometry(z)})};r.point=function(g,l){return n(g,l,(z,G,a)=>{q.pcCheck(a,1,1,g,l);if(a[0]instanceof E){if(z=q.fixSpatialReference(y.parseGeometryFromDictionary(a[0],g.spatialReference),g.spatialReference),!1===z instanceof C)throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.InvalidParameter,l);}else a[0]instanceof C?z=m.fromJSON(a[0].toJSON()):((z=JSON.parse(a[0]))&&!z.spatialReference&&(z.spatialReference=g.spatialReference),z=q.fixSpatialReference(new C(z),g.spatialReference)); if(null!==z&&!1===z.spatialReference.equals(g.spatialReference))throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.WrongSpatialReference,l);return q.fixNullGeometry(z)})};r.multipoint=function(g,l){return n(g,l,(z,G,a)=>{q.pcCheck(a,1,1,g,l);if(a[0]instanceof E){if(z=q.fixSpatialReference(y.parseGeometryFromDictionary(a[0],g.spatialReference),g.spatialReference),!1===z instanceof w)throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.InvalidParameter,l);}else a[0]instanceof w?z=m.fromJSON(a[0].toJSON()): ((z=JSON.parse(a[0]))&&!z.spatialReference&&(z.spatialReference=g.spatialReference),z=q.fixSpatialReference(new w(z),g.spatialReference));if(null!==z&&!1===z.spatialReference.equals(g.spatialReference))throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.WrongSpatialReference,l);return q.fixNullGeometry(z)})};r.extent=function(g,l){return n(g,l,(z,G,a)=>{a=q.autoCastFeatureToGeometry(a);q.pcCheck(a,1,1,g,l);z=null;a[0]instanceof E?z=q.fixSpatialReference(y.parseGeometryFromDictionary(a[0],g.spatialReference), g.spatialReference):a[0]instanceof C?(z={xmin:a[0].x,ymin:a[0].y,xmax:a[0].x,ymax:a[0].y,spatialReference:a[0].spatialReference.toJSON()},a=a[0],a.hasZ?(z.zmin=a.z,z.zmax=a.z):a.hasM&&(z.mmin=a.m,z.mmax=a.m),z=m.fromJSON(z)):a[0]instanceof M?z=m.fromJSON(a[0].extent?.toJSON()):a[0]instanceof A?z=m.fromJSON(a[0].extent?.toJSON()):a[0]instanceof w?z=m.fromJSON(a[0].extent?.toJSON()):a[0]instanceof d?z=m.fromJSON(a[0].toJSON()):((a=JSON.parse(a[0]))&&!a.spatialReference&&(a.spatialReference=g.spatialReference), z=q.fixSpatialReference(new d(a),g.spatialReference));if(null!==z&&!1===z.spatialReference.equals(g.spatialReference))throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.WrongSpatialReference,l);return q.fixNullGeometry(z)})};r.geometry=function(g,l){return n(g,l,(z,G,a)=>{q.pcCheck(a,1,1,g,l);z=null;if(null===a[0])return null;q.isFeature(a[0])?z=q.fixSpatialReference(a[0].geometry(),g.spatialReference):a[0]instanceof E?z=q.fixSpatialReference(y.parseGeometryFromDictionary(a[0],g.spatialReference), g.spatialReference):((a=JSON.parse(a[0]))&&!a.spatialReference&&(a.spatialReference=g.spatialReference),z=q.fixSpatialReference(m.fromJSON(a),g.spatialReference));if(null!==z&&!1===z.spatialReference.equals(g.spatialReference))throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.WrongSpatialReference,l);return q.fixNullGeometry(z)})};r.setgeometry=function(g,l){return n(g,l,(z,G,a)=>{q.pcCheck(a,2,2,g,l);if(q.isFeature(a[0])){if(!0===a[0].immutable)throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.Immutable, l);if(a[1]instanceof k||null===a[1])a[0]._geometry=a[1];else throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.InvalidParameter,l);}else throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.InvalidParameter,l);return q.voidOperation})};r.feature=function(g,l){return n(g,l,(z,G,a)=>{if(0===a.length)throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.WrongNumberOfParameters,l);if(1===a.length)if(q.isString(a[0]))a=y.fromJson(JSON.parse(a[0]),g.timeZone);else if(q.isFeature(a[0]))a=y.createFromArcadeFeature(a[0]); else if(a[0]instanceof k)a=y.createFromGraphicLikeObject(a[0],null,null,g.timeZone);else if(a[0]instanceof E)z=a[0].hasField("geometry")?a[0].field("geometry"):null,a=a[0].hasField("attributes")?a[0].field("attributes"):null,null!==z&&z instanceof E&&(z=y.parseGeometryFromDictionary(z,g.spatialReference)),null!==a&&(a=y.parseAttributesFromDictionary(a)),a=y.createFromGraphicLikeObject(z,a,null,g.timeZone);else throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.InvalidParameter,l);else if(2=== a.length){G=z=null;if(null!==a[0])if(a[0]instanceof k)z=a[0];else if(z instanceof E)z=y.parseGeometryFromDictionary(a[0],g.spatialReference);else throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.InvalidParameter,l);if(null!==a[1])if(a[1]instanceof E)G=y.parseAttributesFromDictionary(a[1]);else throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.InvalidParameter,l);a=y.createFromGraphicLikeObject(z,G,null,g.timeZone)}else{z=null;G={};if(null!==a[0])if(a[0]instanceof k)z=a[0];else if(z instanceof E)z=y.parseGeometryFromDictionary(a[0],g.spatialReference);else throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.InvalidParameter,l);for(let B=1;B{if(0===a.length||1===a.length&&null===a[0])return a=new E,a.immutable=!1,a;if(1===a.length&&q.isString(a[0]))try{var B=JSON.parse(a[0]),x=E.convertObjectToArcadeDictionary(B,q.defaultTimeZone(g),!1);x.immutable=!1;return x}catch(N){throw new c.ArcadeExecutionError(g, c.ExecutionErrorCodes.InvalidParameter,l);}if(1===a.length&&a[0]instanceof k)try{const N=a[0].toJSON();N.hasZ=!0===a[0].hasZ;N.hasM=!0===a[0].hasM;const e=E.convertObjectToArcadeDictionary(N,q.defaultTimeZone(g),!1);e.immutable=!1;return e}catch(N){throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.InvalidParameter,l);}if(1===a.length&&q.isFeature(a[0]))try{const N=new E;N.immutable=!1;N.setField("geometry",a[0].geometry());const e=new E;e.immutable=!1;N.setField("attributes",e);for(const Z of a[0].keys())e.setField(Z, a[0].field(Z));return N}catch(N){throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.InvalidParameter,l);}if(1===a.length&&a[0]instanceof E)try{const N=new E;N.immutable=!1;for(const e of a[0].keys())N.setField(e,a[0].field(e));return N}catch(N){throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.InvalidParameter,l);}if(2===a.length&&a[0]instanceof E&&q.isBoolean(a[1]))try{if(!0!==a[1]){const N=new E;N.immutable=!1;for(const e of a[0].keys())N.setField(e,a[0].field(e));return N}return a[0].deepClone()}catch(N){throw new c.ArcadeExecutionError(g, c.ExecutionErrorCodes.InvalidParameter,l);}if(0!==a.length%2)throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.WrongNumberOfParameters,l);z={};for(G=0;G{q.pcCheck(a,2,2,g,l);z=q.toString(a[1]);if(q.isFeature(a[0])||a[0]instanceof E)return a[0].hasField(z);if(a[0]instanceof k)return(a=O.geometryMember(a[0],z,null,null,2))&&"notfound"===a.keystate?!1:!0;throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.InvalidParameter,l);})};r.hasvalue=function(g,l){return n(g,l,(z,G,a)=>{q.pcCheck(a,2,2,g,l);return null!=O.getNestedOptionalValue(a[0], a[1])})};r.indexof=function(g,l){return n(g,l,(z,G,a)=>{q.pcCheck(a,2,2,g,l);z=a[1];if(q.isArray(a[0])){for(G=0;G{a=q.autoCastFeatureToGeometry(a);q.pcCheck(a,2,3,g,l);if(!(a[0]instanceof C))throw new c.ArcadeExecutionError(g, c.ExecutionErrorCodes.InvalidParameter,l);if(!(a[1]instanceof C))throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.InvalidParameter,l);if(2{a=q.autoCastFeatureToGeometry(a);q.pcCheck(a,2,3,g,l);if(!(a[0]instanceof C))throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.InvalidParameter, l);if(!(a[1]instanceof C))throw new c.ArcadeExecutionError(g,c.ExecutionErrorCodes.InvalidParameter,l);if(2{a=q.autoCastFeatureToGeometry(a);q.pcCheck(a,1,1,g,l);z=a[0];if(z instanceof M)return z.isSelfIntersecting;if(z instanceof A)return F.pathsSelfIntersecting(z.paths); if(z instanceof w)for(G=z.points,a=0;a=f;)M-=A;return M}function F(M,A){return Math.atan2(A.y-M.y,A.x-M.x)}function d(M,A,f){var m=M.x-A.x;M=M.y-A.y;var r=f.x-A.x;A=f.y-A.y;return Math.atan2(m*A-r*M,m*r+M*A)}const k=[];for(const M of[[9002,56146130, 6131,6132,8050,8051,8228],[9003,5702,6358,6359,6360,8052,8053],[9095,5754]]){const A=M[0];for(let f=1;f=n.length){n=0;break a}let z=0;for(let G=1;Gm?m=0:1=m?[A[0]+(f[0]-A[0])*m,A[1]+(f[1]-A[1])*m]:[f[0]-(f[0]-A[0])*(1-m),f[1]-(f[1]-A[1])*(1-m)]};D.closestPointOnLineSegmentWithZ=function(M,A,f){var m=[f[0]-A[0],f[1]-A[1],f[2]-A[2]];M=[M[0]- A[0],M[1]-A[1],M[2]-A[2]];m=Math.max(0,Math.min(1,(m[0]*M[0]+m[1]*M[1]+m[2]*M[2])/(m[0]*m[0]+m[1]*m[1]+m[2]*m[2])));return[A[0]+(f[0]-A[0])*m,A[1]+(f[1]-A[1])*m,A[2]+(f[2]-A[2])*m]};D.getMetersPerVerticalUnitForSR=function(M){return M.vcsWkid&&void 0!==k[M.vcsWkid]?w[k[M.vcsWkid]]:M.latestVcsWkid&&void 0!==k[M.latestVcsWkid]?w[k[M.latestVcsWkid]]:1};D.pathsSelfIntersecting=function(M){for(let z=0;zA))for(f=0;f<=A-2;f++)for(m=G[f],r=G[f+1],n=f+2;n<=A-2;n++)if(g=G[n],l=G[n+1],c.segmentIntersects(m,r,g,l,C)&&!(C[0]===m[0]&&C[1]===m[1]||C[0]===g[0]&&C[1]===g[1]||C[0]===r[0]&&C[1]===r[1]||C[0]===l[0]&&C[1]===l[1]))return!0}return!1};D.segmentLength=b;D.segmentLength3d=function(M,A, f){return Math.sqrt((M[0]-A[0])**2+(M[1]-A[1])**2+(void 0!==M[2]&&void 0!==A[2]?(M[2]*f-A[2]*f)**2:0))};D.segmentLength3dSqr=function(M,A,f){return(M[0]-A[0])**2+(M[1]-A[1])**2+(void 0!==M[2]&&void 0!==A[2]?(M[2]*f-A[2]*f)**2:0)};D.segmentLengthSqr=function(M,A,f){const m=A[0]-M[0];M=A[1]-M[1];return f?(A=A[2]-A[2],m*m+M*M+A*A):m*m+M*M};Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})})},"esri/arcade/functions/geomsync":function(){define("exports ../../kernel ../Dictionary ../executionError ../kernel ../../chunks/languageUtils ./centroid ./measures ../../core/unitUtils ../../geometry/Extent ../../geometry/Geometry ../../geometry/Multipoint ../../geometry/Point ../../geometry/Polygon ../../geometry/Polyline ../../geometry/support/jsonUtils".split(" "), function(D,O,E,c,y,b,q,F,d,k,w,C,M,A,f,m){function r(l){return 0===O.version.indexOf("4.")?A.fromExtent(l):new A({spatialReference:l.spatialReference,rings:[[[l.xmin,l.ymin],[l.xmin,l.ymax],[l.xmax,l.ymax],[l.xmax,l.ymin],[l.xmin,l.ymin]]]})}function n(l,z){if("polygon"!==l.type&&"polyline"!==l.type&&"extent"!==l.type)return 0;var G=1;if(l.spatialReference.vcsWkid||l.spatialReference.latestVcsWkid){G=q.getMetersPerVerticalUnitForSR(l.spatialReference);var a=d.getMetersPerUnitForSR(l.spatialReference); G/=a}a=0;if("polyline"===l.type)for(var B of l.paths)for(var x=1;x{e=b.autoCastFeatureToGeometry(e);G(a,B,e);return null===e[0]||null===e[1]?!0:g.disjoint(e[0],e[1])})};l.intersects=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);G(a,B,e);return null===e[0]||null===e[1]?!1:g.intersects(e[0],e[1])})};l.touches=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);G(a,B,e);return null===e[0]||null===e[1]?!1:g.touches(e[0],e[1])})};l.crosses=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e); G(a,B,e);return null===e[0]||null===e[1]?!1:g.crosses(e[0],e[1])})};l.within=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);G(a,B,e);return null===e[0]||null===e[1]?!1:g.within(e[0],e[1])})};l.contains=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);G(a,B,e);return null===e[0]||null===e[1]?!1:g.contains(e[0],e[1])})};l.overlaps=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);G(a,B,e);return null===e[0]||null===e[1]?!1:g.overlaps(e[0], e[1])})};l.equals=function(a,B){return z(a,B,(x,N,e)=>{b.pcCheck(e,2,2,a,B);return e[0]===e[1]?!0:e[0]instanceof w&&e[1]instanceof w?g.equals(e[0],e[1]):b.isDate(e[0])&&b.isDate(e[1])||b.isTime(e[0])&&b.isTime(e[1])||b.isDateOnly(e[0])&&b.isDateOnly(e[1])?e[0].equals(e[1]):!1})};l.relate=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);b.pcCheck(e,3,3,a,B);if(e[0]instanceof w&&e[1]instanceof w)return g.relate(e[0],e[1],b.toString(e[2]));if(e[0]instanceof w&&null===e[1]||e[1]instanceof w&&null===e[0]||null===e[0]&&null===e[1])return!1;throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);})};l.intersection=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);G(a,B,e);return null===e[0]||null===e[1]?null:g.intersect(e[0],e[1])})};l.union=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);x=[];if(0===e.length)throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.WrongNumberOfParameters,B);if(1===e.length)if(b.isArray(e[0]))for(e= b.autoCastFeatureToGeometry(e[0]),N=0;N{e=b.autoCastFeatureToGeometry(e);G(a,B,e);return null===e[0]?null:null===e[1]?y.cloneGeometry(e[0]):g.difference(e[0],e[1])})};l.symmetricdifference=function(a, B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);G(a,B,e);return null===e[0]&&null===e[1]?null:null===e[0]?y.cloneGeometry(e[1]):null===e[1]?y.cloneGeometry(e[0]):g.symmetricDifference(e[0],e[1])})};l.clip=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);b.pcCheck(e,2,2,a,B);if(!(e[1]instanceof k)&&null!==e[1])throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);if(null===e[0])return null;if(!(e[0]instanceof w))throw new c.ArcadeExecutionError(a, c.ExecutionErrorCodes.InvalidParameter,B);return null===e[1]?null:g.clip(e[0],e[1])})};l.cut=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);b.pcCheck(e,2,2,a,B);if(!(e[1]instanceof f)&&null!==e[1])throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);if(null===e[0])return[];if(!(e[0]instanceof w))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);return null===e[1]?[y.cloneGeometry(e[0])]:g.cut(e[0],e[1])})};l.area=function(a, B){return z(a,B,(x,N,e)=>{b.pcCheck(e,1,2,a,B);e=b.autoCastFeatureToGeometry(e);if(null===e[0])return 0;if(b.isArray(e[0])||b.isImmutableArray(e[0]))return x=b.autoCastArrayOfPointsToPolygon(e[0],a.spatialReference),null===x?0:g.planarArea(x,y.convertSquareUnitsToCode(b.defaultUndefined(e[1],-1)));if(!(e[0]instanceof w))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);return g.planarArea(e[0],y.convertSquareUnitsToCode(b.defaultUndefined(e[1],-1)))})};l.areageodetic=function(a, B){return z(a,B,(x,N,e)=>{b.pcCheck(e,1,2,a,B);e=b.autoCastFeatureToGeometry(e);if(null===e[0])return 0;if(b.isArray(e[0])||b.isImmutableArray(e[0]))return x=b.autoCastArrayOfPointsToPolygon(e[0],a.spatialReference),null===x?0:g.geodesicArea(x,y.convertSquareUnitsToCode(b.defaultUndefined(e[1],-1)));if(!(e[0]instanceof w))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);return g.geodesicArea(e[0],y.convertSquareUnitsToCode(b.defaultUndefined(e[1],-1)))})};l.length=function(a, B){return z(a,B,(x,N,e)=>{b.pcCheck(e,1,2,a,B);e=b.autoCastFeatureToGeometry(e);if(null===e[0])return 0;if(b.isArray(e[0])||b.isImmutableArray(e[0]))return x=b.autoCastArrayOfPointsToPolyline(e[0],a.spatialReference),null===x?0:g.planarLength(x,y.convertLinearUnitsToCode(b.defaultUndefined(e[1],-1)));if(!(e[0]instanceof w))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);return g.planarLength(e[0],y.convertLinearUnitsToCode(b.defaultUndefined(e[1],-1)))})};l.length3d=function(a, B){return z(a,B,(x,N,e)=>{b.pcCheck(e,1,2,a,B);e=b.autoCastFeatureToGeometry(e);if(null===e[0])return 0;if(b.isArray(e[0])||b.isImmutableArray(e[0]))return x=b.autoCastArrayOfPointsToPolyline(e[0],a.spatialReference),null===x?0:!0===x.hasZ?n(x,y.convertLinearUnitsToCode(b.defaultUndefined(e[1],-1))):g.planarLength(x,y.convertLinearUnitsToCode(b.defaultUndefined(e[1],-1)));if(!(e[0]instanceof w))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);return!0===e[0].hasZ?n(e[0], y.convertLinearUnitsToCode(b.defaultUndefined(e[1],-1))):g.planarLength(e[0],y.convertLinearUnitsToCode(b.defaultUndefined(e[1],-1)))})};l.lengthgeodetic=function(a,B){return z(a,B,(x,N,e)=>{b.pcCheck(e,1,2,a,B);e=b.autoCastFeatureToGeometry(e);if(null===e[0])return 0;if(b.isArray(e[0])||b.isImmutableArray(e[0]))return x=b.autoCastArrayOfPointsToPolyline(e[0],a.spatialReference),null===x?0:g.geodesicLength(x,y.convertLinearUnitsToCode(b.defaultUndefined(e[1],-1)));if(!(e[0]instanceof w))throw new c.ArcadeExecutionError(a, c.ExecutionErrorCodes.InvalidParameter,B);return g.geodesicLength(e[0],y.convertLinearUnitsToCode(b.defaultUndefined(e[1],-1)))})};l.distance=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);b.pcCheck(e,2,3,a,B);x=e[0];if(b.isArray(e[0])||b.isImmutableArray(e[0]))x=b.autoCastArrayOfPointsToMultiPoint(e[0],a.spatialReference);N=e[1];if(b.isArray(e[1])||b.isImmutableArray(e[1]))N=b.autoCastArrayOfPointsToMultiPoint(e[1],a.spatialReference);if(!(x instanceof w))throw new c.ArcadeExecutionError(a, c.ExecutionErrorCodes.InvalidParameter,B);if(!(N instanceof w))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);return g.distance(x,N,y.convertLinearUnitsToCode(b.defaultUndefined(e[2],-1)))})};l.distancegeodetic=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);b.pcCheck(e,2,3,a,B);x=e[0];N=e[1];if(!(x instanceof M))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);if(!(N instanceof M))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter, B);const Z=new f({paths:[],spatialReference:x.spatialReference});Z.addPath([x,N]);return g.geodesicLength(Z,y.convertLinearUnitsToCode(b.defaultUndefined(e[2],-1)))})};l.densify=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);b.pcCheck(e,2,3,a,B);if(null===e[0])return null;if(!(e[0]instanceof w))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);x=b.toNumber(e[1]);if(isNaN(x))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter, B);if(0>=x)throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);return e[0]instanceof A||e[0]instanceof f?g.densify(e[0],x,y.convertLinearUnitsToCode(b.defaultUndefined(e[2],-1))):e[0]instanceof k?g.densify(r(e[0]),x,y.convertLinearUnitsToCode(b.defaultUndefined(e[2],-1))):e[0]})};l.densifygeodetic=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);b.pcCheck(e,2,3,a,B);if(null===e[0])return null;if(!(e[0]instanceof w))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter, B);x=b.toNumber(e[1]);if(isNaN(x))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);if(0>=x)throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);return e[0]instanceof A||e[0]instanceof f?g.geodesicDensify(e[0],x,y.convertLinearUnitsToCode(b.defaultUndefined(e[2],-1))):e[0]instanceof k?g.geodesicDensify(r(e[0]),x,y.convertLinearUnitsToCode(b.defaultUndefined(e[2],-1))):e[0]})};l.generalize=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e); b.pcCheck(e,2,4,a,B);if(null===e[0])return null;if(!(e[0]instanceof w))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);x=b.toNumber(e[1]);if(isNaN(x))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);return g.generalize(e[0],x,b.toBoolean(b.defaultUndefined(e[2],!0)),y.convertLinearUnitsToCode(b.defaultUndefined(e[3],-1)))})};l.buffer=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);b.pcCheck(e,2,3,a,B);if(null===e[0])return null; if(!(e[0]instanceof w))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);x=b.toNumber(e[1]);if(isNaN(x))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);return 0===x?y.cloneGeometry(e[0]):g.buffer(e[0],x,y.convertLinearUnitsToCode(b.defaultUndefined(e[2],-1)))})};l.buffergeodetic=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);b.pcCheck(e,2,3,a,B);if(null===e[0])return null;if(!(e[0]instanceof w))throw new c.ArcadeExecutionError(a, c.ExecutionErrorCodes.InvalidParameter,B);x=b.toNumber(e[1]);if(isNaN(x))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);return 0===x?y.cloneGeometry(e[0]):g.geodesicBuffer(e[0],x,y.convertLinearUnitsToCode(b.defaultUndefined(e[2],-1)))})};l.offset=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);b.pcCheck(e,2,6,a,B);if(null===e[0])return null;if(!(e[0]instanceof A||e[0]instanceof f))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter, B);x=b.toNumber(e[1]);if(isNaN(x))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);N=b.toNumber(b.defaultUndefined(e[4],10));if(isNaN(N))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);const Z=b.toNumber(b.defaultUndefined(e[5],0));if(isNaN(Z))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);return g.offset(e[0],x,y.convertLinearUnitsToCode(b.defaultUndefined(e[2],-1)),b.toString(b.defaultUndefined(e[3],"round")).toLowerCase(), N,Z)})};l.rotate=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);b.pcCheck(e,2,3,a,B);if(null===e[0])return null;if(!(e[0]instanceof w))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);x=e[0]instanceof k?A.fromExtent(e[0]):e[0];N=b.toNumber(e[1]);if(isNaN(N))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);e=b.defaultUndefined(e[2],null);if(null===e)return g.rotate(x,N);if(e instanceof M)return g.rotate(x,N,e);throw new c.ArcadeExecutionError(a, c.ExecutionErrorCodes.InvalidParameter,B);})};l.centroid=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);b.pcCheck(e,1,1,a,B);if(null===e[0])return null;x=e[0];if(b.isArray(e[0])||b.isImmutableArray(e[0]))x=b.autoCastArrayOfPointsToMultiPoint(e[0],a.spatialReference);if(null===x)return null;if(!(x instanceof w))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);return x instanceof M?b.fixSpatialReference(y.cloneGeometry(x),a.spatialReference):x instanceof A?x.centroid:x instanceof f?q.centroidPolyline(x):x instanceof C?q.centroidMultiPoint(x):x instanceof k?x.center:null})};l.measuretocoordinate=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);b.pcCheck(e,2,2,a,B);if(null===e[0])return null;x=e[0];if(b.isArray(e[0])||b.isImmutableArray(e[0]))x=b.autoCastArrayOfPointsToPolyline(e[0],a.spatialReference);if(null===x)return null;if(!(x instanceof w))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);if(!(x instanceof f))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);if(b.isNumber(!1===e[1]))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);return(e=F.measureToCoordinate(x,e[1]))?E.convertObjectToArcadeDictionary(e,b.defaultTimeZone(a),!1,!0):null})};l.pointtocoordinate=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);b.pcCheck(e,2,2,a,B);if(null===e[0])return null;x=e[0];if(b.isArray(e[0])||b.isImmutableArray(e[0]))x=b.autoCastArrayOfPointsToPolyline(e[0], a.spatialReference);if(null===x)return null;if(!(x instanceof w))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);if(!(x instanceof f))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);N=e[1];if(null===N)return null;if(!(N instanceof M))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);if(b.isNumber(!1===e[1]))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);return(e=F.pointToCoordinate(x, N))?E.convertObjectToArcadeDictionary(e,b.defaultTimeZone(a),!1,!0):null})};l.distancetocoordinate=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);b.pcCheck(e,2,2,a,B);if(null===e[0])return null;x=e[0];if(b.isArray(e[0])||b.isImmutableArray(e[0]))x=b.autoCastArrayOfPointsToPolyline(e[0],a.spatialReference);if(null===x)return null;if(!(x instanceof w))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);if(!(x instanceof f))throw new c.ArcadeExecutionError(a, c.ExecutionErrorCodes.InvalidParameter,B);if(b.isNumber(!1===e[1]))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);return(e=F.distanceToCoordinate(x,e[1]))?E.convertObjectToArcadeDictionary(e,b.defaultTimeZone(a),!1,!0):null})};l.multiparttosinglepart=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);b.pcCheck(e,1,1,a,B);if(null===e[0])return null;if(!(e[0]instanceof w))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);if(e[0]instanceof M||e[0]instanceof k)return[b.fixSpatialReference(y.cloneGeometry(e[0]),a.spatialReference)];x=g.simplify(e[0]);if(x instanceof A){e=[];N=[];for(var Z=0;Z{e=b.autoCastFeatureToGeometry(e);b.pcCheck(e,1,1,a,B);if(null===e[0])return!0;if(!(e[0]instanceof w))throw new c.ArcadeExecutionError(a, c.ExecutionErrorCodes.InvalidParameter,B);return g.isSimple(e[0])})};l.simplify=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);b.pcCheck(e,1,1,a,B);if(null===e[0])return null;if(!(e[0]instanceof w))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);return g.simplify(e[0])})};l.convexhull=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);b.pcCheck(e,1,1,a,B);if(null===e[0])return null;if(!(e[0]instanceof w))throw new c.ArcadeExecutionError(a, c.ExecutionErrorCodes.InvalidParameter,B);return g.convexHull(e[0])})};l.nearestcoordinate=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);b.pcCheck(e,2,2,a,B);if(!(e[0]instanceof w||null===e[0]))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);if(!(e[1]instanceof M||null===e[1]))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);if(null===e[0]||null===e[1])return null;x=g.nearestCoordinate(e[0],e[1]);return null===x||x.isEmpty? null:E.convertObjectToArcadeDictionary({coordinate:x.coordinate,distance:x.distance,sideOfLine:0===x.distance?"straddle":x.isRightSide?"right":"left"},b.defaultTimeZone(a),!1,!0)})};l.nearestvertex=function(a,B){return z(a,B,(x,N,e)=>{e=b.autoCastFeatureToGeometry(e);b.pcCheck(e,2,2,a,B);if(!(e[0]instanceof w||null===e[0]))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter,B);if(!(e[1]instanceof M||null===e[1]))throw new c.ArcadeExecutionError(a,c.ExecutionErrorCodes.InvalidParameter, B);if(null===e[0]||null===e[1])return null;x=g.nearestVertex(e[0],e[1]);return null===x||x.isEmpty?null:E.convertObjectToArcadeDictionary({coordinate:x.coordinate,distance:x.distance,sideOfLine:0===x.distance?"straddle":x.isRightSide?"right":"left"},b.defaultTimeZone(a),!1,!0)})}};D.setGeometryEngine=function(l){g=l};Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})})},"esri/arcade/functions/measures":function(){define(["exports","./centroid","../../core/unitUtils","../../geometry/Point", "../../geometry/Polygon"],function(D,O,E,c,y){function b(d,k,w){w=k[0]-d[0];d=k[1]-d[1];return Math.sqrt(w*w+d*d)}function q(d,k,w,C){k=[k[0]-d[0],k[1]-d[1],k[2]*C-d[2]*C];C=Math.sqrt(k[0]*k[0]+k[1]*k[1]+k[2]*k[2]);k=[k[0]/C,k[1]/C,k[2]/C];return[d[0]+k[0]*w,d[1]+k[1]*w,d[2]+k[2]*w]}function F(d,k,w){let C=k[0]-d[0];k=k[1]-d[1];const M=Math.sqrt(C*C+k*k);return[d[0]+C/M*w,d[1]+k/M*w]}D.distanceToCoordinate=function(d,k){if(!d)return null;switch(d.type){case "extent":case "multipoint":case "mesh":case "point":return null}var w= "polygon"===d.type?d.rings:d.paths;if(0>k)return null;var C=1;if(d.spatialReference.vcsWkid||d.spatialReference.latestVcsWkid){var M=O.getMetersPerVerticalUnitForSR(d.spatialReference),A=E.getMetersPerUnitForSR(d.spatialReference);C=M/A}let f=0;M=d.hasZ?3:2;var m=d.hasZ?O.segmentLength3d:b;A=-1;if(0===k)return 0===w.length||0===w[0].length?null:{partId:0,coordinate:new c({hasZ:d.hasZ,hasM:d.hasM,spatialReference:d.spatialReference,x:w[0][0][0],y:w[0][0][1],...(d.hasZ?{z:w[0][0][2]}:{}),...(d.hasM? {m:w[0][0][M]}:{})}),segmentId:0};for(const r of w){A++;w=-1;for(let n=1;nk)return C=d.hasZ?q(r[n-1],r[n],k-f,C):F(r[n-1],r[n],k-f),C=[...C],m=r[n-1][M],k=m+(r[n][M]-m)/g*(k-f),C=[...C,k],{partId:A,coordinate:new c({hasZ:d.hasZ,hasM:d.hasM,spatialReference:d.spatialReference, x:C[0],y:C[1],...(d.hasZ?{z:C[2]}:{}),...(d.hasM?{m:C[M]}:{})}),segmentId:w};f=l}}return null};D.measureToCoordinate=function(d,k){if(!d)return null;switch(d.type){case "extent":case "multipoint":case "mesh":case "point":return null}var w="polygon"===d.type?d.rings:d.paths,C=1;if(d.spatialReference.vcsWkid||d.spatialReference.latestVcsWkid){C=O.getMetersPerVerticalUnitForSR(d.spatialReference);var M=E.getMetersPerUnitForSR(d.spatialReference);C/=M}if(0===w.length||0===w[0].length||!1===d.hasM)return null; M=-1;let A=0;const f=d.hasZ?O.segmentLength3d:b,m=d.hasZ?3:2;for(const n of w){M++;if(0k&&k>n[g-1][m])return r*=(k-n[g-1][m])/l,r=d.hasZ?q(n[g-1],n[g],r,C):F(n[g-1],n[g],r),r=[...r,k],d=new c({hasZ:d.hasZ,hasM:d.hasM,spatialReference:d.spatialReference,x:r[0],y:r[1],...(d.hasZ?{z:r[2]}:{}),...(d.hasM?{m:r[m]}:{})}),{partId:M,distanceAlong:A+f(n[g-1],[d.x,d.y,...(d.hasZ?[d.z]:[]),...(d.hasM?[d.m]:[])],C),coordinate:d,segmentId:w};A+=r}}return null};D.pointToCoordinate=function(d,k){if(!d||!k)return null; if("extent"===d.type){var w=d;d=new y({spatialReference:d.spatialReference,rings:[[[w.xmin,w.ymin],[w.xmin,w.ymax],[w.xmax,w.ymax],[w.xmax,w.ymin],[w.xmin,w.ymin]]]})}switch(d.type){case "point":var C=d;if(C)if(k){d=1;if(k.spatialReference.vcsWkid||k.spatialReference.latestVcsWkid)d=O.getMetersPerVerticalUnitForSR(k.spatialReference),w=E.getMetersPerUnitForSR(k.spatialReference),d/=w;w=null;var M=0;w=C;M=C.hasZ&&k.hasZ?O.segmentLength3d([k.x,k.y,k.z],[C.x,C.y,C.z],d):O.segmentLength([k.x,k.y],[C.x, C.y],!1);k={coordinate:w,distance:M}}else k=null;else k=null;return k??null;case "multipoint":if(d&&k){w=1;if(k.spatialReference.vcsWkid||k.spatialReference.latestVcsWkid)w=O.getMetersPerVerticalUnitForSR(k.spatialReference),M=E.getMetersPerUnitForSR(k.spatialReference),w/=M;M=null;var A=0;A=Number.MAX_VALUE;var f=M=-1;for(C of d.points||[]){f++;var m=d.hasZ&&k.hasZ?O.segmentLength3dSqr([C[0],C[1],C[2]],[k.x,k.y,k.z],w):O.segmentLengthSqr([C[0],C[1]],[k.x,k.y],!1);mM?k=null:(M=d.getPoint(M), k={coordinate:M,distance:Math.sqrt(A)})}else k=null;return k??null;case "polygon":case "polyline":if((C=d)&&k){d="polygon"===C.type?C.rings:C.paths;w=1;if(k.spatialReference.vcsWkid||k.spatialReference.latestVcsWkid)w=O.getMetersPerVerticalUnitForSR(k.spatialReference),M=E.getMetersPerUnitForSR(k.spatialReference),w/=M;M=Number.MAX_VALUE;var r=A=-1;f=-1;m=C.hasZ&&k.hasZ;var n=null,g=m?[k.x,k.y,k.z]:[k.x,k.y];for(var l of d){r++;for(var z=1;zA)k=null;else{g=C.hasM&&C.hasZ?3:2;l=d[f][A];r=d[f][A+1];z=z=null;G=m?n[2]:null;if(C.hasM){z=l[g];a=m?O.segmentLength3d(l,r,w):O.segmentLength(l,r,!1);var B=m?O.segmentLength3d(l,n,w):O.segmentLength(l,n,!1);z+=(r[g]-z)/a*B}C.hasZ&&!1===k.hasZ&&(g=l[2],G=m?O.segmentLength3d(l,r,w):O.segmentLength(l,r,!1),a=m?O.segmentLength3d(l,n,w):O.segmentLength(l,n, !1),G=g+(r[2]-g)/G*a);z=new c({hasZ:m,hasM:C.hasM,spatialReference:k.spatialReference,x:n[0],y:n[1],...(C.hasZ?{z:G}:{}),...(C.hasM?{m:z}:{})});k=0;for(m=0;m<=f;m++)for(n=d[m],r=m===f?A:n.length-1,g=1;g<=r;g++)k+=C.hasZ?O.segmentLength3d(n[g-1],n[g],w):O.segmentLength([n[g-1][0],n[g-1][1]],[n[g][0],n[g][1]],!1);k+=C.hasZ?O.segmentLength3d(l,[z.x,z.y,z.z],w):O.segmentLength(l,[z.x,z.y],!1);k={partId:f,segmentId:A,coordinate:z,distance:Math.sqrt(M),distanceAlong:k}}}else k=null;return k??null;default:return null}}; Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})})},"esri/arcade/functions/maths":function(){define(["exports","../../chunks/languageUtils","../../core/number"],function(D,O,E){function c(y,b,q){if(void 0===q||0===+q)return Math[y](b);b=+b;q=+q;if(isNaN(b)||"number"!==typeof q||0!==q%1)return NaN;b=b.toString().split("e");b=Math[y](+(b[0]+"e"+(b[1]?+b[1]-q:-q)));b=b.toString().split("e");return+(b[0]+"e"+(b[1]?+b[1]+q:q))}D.registerFunctions=function(y,b){function q(F,d,k){F=O.toNumber(F); return isNaN(F)?F:isNaN(d)||isNaN(k)||d>k?NaN:Fk?k:F}y.number=function(F,d){return b(F,d,(k,w,C)=>{O.pcCheck(C,1,2,F,d);k=C[0];return O.isNumber(k)?k:null===k?0:O.isDate(k)||O.isTime(k)||O.isDateOnly(k)?k.toNumber():O.isBoolean(k)?Number(k):O.isArray(k)?NaN:""===k||void 0===k?Number(k):O.isString(k)?void 0!==C[1]?(C=O.multiReplace(C[1],"\u2030",""),C=O.multiReplace(C,"\u00a4",""),E.parse(k,{pattern:C})):Number(k.trim()):Number(k)})};y.abs=function(F,d){return b(F,d,(k,w,C)=>{O.pcCheck(C,1, 1,F,d);return Math.abs(O.toNumber(C[0]))})};y.acos=function(F,d){return b(F,d,(k,w,C)=>{O.pcCheck(C,1,1,F,d);return Math.acos(O.toNumber(C[0]))})};y.asin=function(F,d){return b(F,d,(k,w,C)=>{O.pcCheck(C,1,1,F,d);return Math.asin(O.toNumber(C[0]))})};y.atan=function(F,d){return b(F,d,(k,w,C)=>{O.pcCheck(C,1,1,F,d);return Math.atan(O.toNumber(C[0]))})};y.atan2=function(F,d){return b(F,d,(k,w,C)=>{O.pcCheck(C,2,2,F,d);return Math.atan2(O.toNumber(C[0]),O.toNumber(C[1]))})};y.ceil=function(F,d){return b(F, d,(k,w,C)=>{O.pcCheck(C,1,2,F,d);return 2===C.length?(k=O.toNumber(C[1]),isNaN(k)&&(k=0),c("ceil",O.toNumber(C[0]),-1*k)):Math.ceil(O.toNumber(C[0]))})};y.round=function(F,d){return b(F,d,(k,w,C)=>{O.pcCheck(C,1,2,F,d);return 2===C.length?(k=O.toNumber(C[1]),isNaN(k)&&(k=0),c("round",O.toNumber(C[0]),-1*k)):Math.round(O.toNumber(C[0]))})};y.floor=function(F,d){return b(F,d,(k,w,C)=>{O.pcCheck(C,1,2,F,d);return 2===C.length?(k=O.toNumber(C[1]),isNaN(k)&&(k=0),c("floor",O.toNumber(C[0]),-1*k)):Math.floor(O.toNumber(C[0]))})}; y.cos=function(F,d){return b(F,d,(k,w,C)=>{O.pcCheck(C,1,1,F,d);return Math.cos(O.toNumber(C[0]))})};y.isnan=function(F,d){return b(F,d,(k,w,C)=>{O.pcCheck(C,1,1,F,d);return"number"===typeof C[0]&&isNaN(C[0])})};y.exp=function(F,d){return b(F,d,(k,w,C)=>{O.pcCheck(C,1,1,F,d);return Math.exp(O.toNumber(C[0]))})};y.log=function(F,d){return b(F,d,(k,w,C)=>{O.pcCheck(C,1,1,F,d);return Math.log(O.toNumber(C[0]))})};y.pow=function(F,d){return b(F,d,(k,w,C)=>{O.pcCheck(C,2,2,F,d);return O.toNumber(C[0])** O.toNumber(C[1])})};y.random=function(F,d){return b(F,d,(k,w,C)=>{O.pcCheck(C,0,0,F,d);return Math.random()})};y.sin=function(F,d){return b(F,d,(k,w,C)=>{O.pcCheck(C,1,1,F,d);return Math.sin(O.toNumber(C[0]))})};y.sqrt=function(F,d){return b(F,d,(k,w,C)=>{O.pcCheck(C,1,1,F,d);return Math.sqrt(O.toNumber(C[0]))})};y.tan=function(F,d){return b(F,d,(k,w,C)=>{O.pcCheck(C,1,1,F,d);return Math.tan(O.toNumber(C[0]))})};y.isempty=function(F,d){return b(F,d,(k,w,C)=>{O.pcCheck(C,1,1,F,d);return null===C[0]|| ""===C[0]||void 0===C[0]||C[0]===O.voidOperation?!0:!1})};y.boolean=function(F,d){return b(F,d,(k,w,C)=>{O.pcCheck(C,1,1,F,d);return O.toBoolean(C[0])})};y.constrain=function(F,d){return b(F,d,(k,w,C)=>{O.pcCheck(C,3,3,F,d);k=O.toNumber(C[1]);w=O.toNumber(C[2]);if(O.isArray(C[0])){var M=[];for(var A of C[0])M.push(q(A,k,w));return M}if(O.isImmutableArray(C[0])){A=[];for(M=0;My("stdev",C))};b.variance=function(F,d){return q(F,d,(k,w,C)=>y("variance",C))};b.average=function(F, d){return q(F,d,(k,w,C)=>y("mean",C))};b.mean=function(F,d){return q(F,d,(k,w,C)=>y("mean",C))};b.sum=function(F,d){return q(F,d,(k,w,C)=>y("sum",C))};b.min=function(F,d){return q(F,d,(k,w,C)=>y("min",C))};b.max=function(F,d){return q(F,d,(k,w,C)=>y("max",C))};b.distinct=function(F,d){return q(F,d,(k,w,C)=>y("distinct",C))};b.count=function(F,d){return q(F,d,(k,w,C)=>{E.pcCheck(C,1,1,F,d);if(E.isArray(C[0])||E.isString(C[0]))return C[0].length;if(E.isImmutableArray(C[0]))return C[0].length();throw new O.ArcadeExecutionError(F, O.ExecutionErrorCodes.InvalidParameter,d);})}};Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})})},"esri/arcade/functions/fieldStats":function(){define(["exports","../../chunks/languageUtils"],function(D,O){function E(y){let b=0;for(let q=0;q=q&&-1!==q){b=y;break a}}b=y}return b;case "avg":case "mean":return E(O.toNumberArray(b));case "min":return Math.min.apply(Math,O.toNumberArray(b));case "sum":b=O.toNumberArray(b);q=0;for(y=0;y{b.pcCheck(e,1,1,a,B);return new O(b.toString(e[0]))})};z.typeof=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,1,1,a,B);x=b.getType(e[0]);if("Unrecognized Type"===x)throw new y.ArcadeExecutionError(a,y.ExecutionErrorCodes.UnrecognizedType,B);return x})}; z.trim=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,1,1,a,B);return b.toString(e[0]).trim()})};z.tohex=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,1,1,a,B);x=b.toNumber(e[0]);return isNaN(x)?x:x.toString(16)})};z.upper=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,1,1,a,B);return b.toString(e[0]).toUpperCase()})};z.proper=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,1,2,a,B);x=1;2===e.length&&"firstword"===b.toString(e[1]).toLowerCase()&&(x=2);N=/\s/;e=b.toString(e[0]);let Z="",t= !0;for(let H=0;H{b.pcCheck(e,1,1,a,B);return b.toString(e[0]).toLowerCase()})};z.guid=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,0,1,a,B);if(0{b.pcCheck(e,2,2,a,B);x=b.toString(e[0]);if(""===x||null===x)return"";x=/^(\{|\()?(?[0-9a-z]{8})(-?)(?[0-9a-z]{4})(-?)(?[0-9a-z]{4})(-?)(?[0-9a-z]{4})(-?)(?[0-9a-z]{12})(\}|\))?$/gim.exec(x);if(!x)return"";x=x.groups;x=x.partA+"-"+x.partB+"-"+x.partC+"-"+x.partD+"-"+x.partE;switch(b.toString(e[1]).toLowerCase()){case "digits":return x.replace("-", "").replace("-","").replace("-","").replace("-","");case "digits-hyphen":return x;case "digits-hyphen-parentheses":return"("+x+")"}return"{"+x+"}"})};z.console=function(a,B){return G(a,B,(x,N,e)=>{0!==e.length&&(1===e.length?a.console(b.toString(e[0])):a.console(b.toString(e)));return b.voidOperation})};z.mid=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,2,3,a,B);x=b.toNumber(e[1]);if(isNaN(x))return"";0>x&&(x=0);if(2===e.length)return b.toString(e[0]).substr(x);N=b.toNumber(e[2]);if(isNaN(N))return""; 0>N&&(N=0);return b.toString(e[0]).substr(x,N)})};z.find=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,2,3,a,B);x=0;if(2x&&(x=0)}return b.toString(e[1]).indexOf(b.toString(e[0]),x)})};z.left=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,2,2,a,B);x=b.toNumber(e[1]);if(isNaN(x))return"";0>x&&(x=0);return b.toString(e[0]).substr(0,x)})};z.right=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,2,2,a,B);x=b.toNumber(e[1]); if(isNaN(x))return"";0>x&&(x=0);return b.toString(e[0]).substr(-1*x,x)})};z.split=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,2,4,a,B);x=b.toNumber(b.defaultUndefined(e[2],-1));N=b.toBoolean(b.defaultUndefined(e[3],!1));-1===x||null===x||!0===N?e=b.toString(e[0]).split(b.toString(e[1])):(isNaN(x)&&(x=-1),-1>x&&(x=-1),e=b.toString(e[0]).split(b.toString(e[1]),x));if(!1===N)return e;N=[];for(let Z=0;Z=x);Z++)""!==e[Z]&&void 0!==e[Z]&&N.push(e[Z]);return N})};z.text= function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,1,2,a,B);return b.toStringExplicit(e[0],e[1])})};z.concatenate=function(a,B){return G(a,B,(x,N,e)=>{x=[];if(1>e.length)return"";if(b.isArray(e[0])){N=b.defaultUndefined(e[2],"");for(var Z=0;Z{b.pcCheck(e,1,1,a,B);if(b.isArray(e[0]))return x=e[0].slice(0),x.reverse(),x;if(b.isImmutableArray(e[0]))return x=e[0].toArray().slice(0),x.reverse(),x;throw new y.ArcadeExecutionError(a,y.ExecutionErrorCodes.InvalidParameter,B);})};z.replace=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,3,4,a,B);x=b.toString(e[0]);N=b.toString(e[1]);const Z=b.toString(e[2]);return(4===e.length?b.toBoolean(e[3]): 1)?b.multiReplace(x,N,Z):x.replace(N,Z)})};z.schema=function(a,B){return G(a,B,(x,N,e)=>{if(b.isFeature(e[0]))return(x=b.featureSchema(e[0]))?c.convertObjectToArcadeDictionary(x,b.defaultTimeZone(a)):null;throw new y.ArcadeExecutionError(a,y.ExecutionErrorCodes.InvalidParameter,B);})};z.subtypes=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,1,1,a,B);if(b.isFeature(e[0]))return(x=b.featureSubtypes(e[0]))?c.convertObjectToArcadeDictionary(x,b.defaultTimeZone(a)):null;throw new y.ArcadeExecutionError(a, y.ExecutionErrorCodes.InvalidParameter,B);})};z.subtypecode=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,1,1,a,B);if(b.isFeature(e[0])){x=b.featureSubtypes(e[0]);if(!x)return null;if(x.subtypeField&&e[0].hasField(x.subtypeField)){e=e[0].field(x.subtypeField);for(const Z of x.subtypes)if(Z.code===e)return Z.code}return null}throw new y.ArcadeExecutionError(a,y.ExecutionErrorCodes.InvalidParameter,B);})};z.subtypename=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,1,1,a,B);if(b.isFeature(e[0])){x= b.featureSubtypes(e[0]);if(!x)return"";if(x.subtypeField&&e[0].hasField(x.subtypeField)){e=e[0].field(x.subtypeField);for(const Z of x.subtypes)if(Z.code===e)return Z.name}return""}throw new y.ArcadeExecutionError(a,y.ExecutionErrorCodes.InvalidParameter,B);})};z.gdbversion=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,1,1,a,B);if(b.isFeature(e[0]))return e[0].gdbVersion();throw new y.ArcadeExecutionError(a,y.ExecutionErrorCodes.InvalidParameter,B);})};z.domain=function(a,B){return G(a,B,(x,N, e)=>{b.pcCheck(e,2,3,a,B);if(b.isFeature(e[0]))return(x=b.featureFullDomain(e[0],b.toString(e[1]),void 0===e[2]?void 0:e[2]))&&x.domain?"coded-value"===x.domain.type||"codedValue"===x.domain.type?c.convertObjectToArcadeDictionary({type:"codedValue",name:x.domain.name,dataType:q.layerFieldEsriConstants[x.field.type],codedValues:x.domain.codedValues.map(Z=>({name:Z.name,code:Z.code}))},b.defaultTimeZone(a)):c.convertObjectToArcadeDictionary({type:"range",name:x.domain.name,dataType:q.layerFieldEsriConstants[x.field.type], min:x.domain.minValue,max:x.domain.maxValue},b.defaultTimeZone(a)):null;throw new y.ArcadeExecutionError(a,y.ExecutionErrorCodes.InvalidParameter,B);})};z.domainname=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,2,4,a,B);if(b.isFeature(e[0]))return b.featureDomainValueLookup(e[0],b.toString(e[1]),e[2],void 0===e[3]?void 0:e[3]);throw new y.ArcadeExecutionError(a,y.ExecutionErrorCodes.InvalidParameter,B);})};z.domaincode=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,2,4,a,B);if(b.isFeature(e[0]))return b.featureDomainCodeLookup(e[0], b.toString(e[1]),e[2],void 0===e[3]?void 0:e[3]);throw new y.ArcadeExecutionError(a,y.ExecutionErrorCodes.InvalidParameter,B);})};z.urlencode=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,1,1,a,B);if(null===e[0])return"";if(e[0]instanceof c){x="";for(const Z of e[0].keys())N=e[0].field(Z),""!==x&&(x+="\x26"),x=null===N?x+(encodeURIComponent(Z)+"\x3d"):x+(encodeURIComponent(Z)+"\x3d"+encodeURIComponent(N));return x}return encodeURIComponent(b.toString(e[0]))})};z.hash=function(a,B){return G(a,B, (x,N,e)=>{b.pcCheck(e,1,1,a,B);x=new d.XXH(0);l(e[0],x,{context:a,node:B,map:new Map,currentLength:0});return x.digest()})};z.convertdirection=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,3,3,a,B);return F.convertDirection(e[0],e[1],e[2])})};z.fromjson=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,1,1,a,B);if(!1===b.isString(e[0]))throw new y.ArcadeExecutionError(a,y.ExecutionErrorCodes.InvalidParameter,B);return c.convertJsonToArcade(JSON.parse(b.toString(e[0])),b.defaultTimeZone(a))})};z.expects= function(a,B){return G(a,B,(x,N,e)=>{if(1>e.length)throw new y.ArcadeExecutionError(a,y.ExecutionErrorCodes.WrongNumberOfParameters,B);return b.voidOperation})};z.tocharcode=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,1,2,a,B);x=b.toNumber(b.defaultUndefined(e[1],0));N=b.toString(e[0]);if(0===N.length&&1===e.length)return null;if(N.length<=x||0>x)throw new y.ArcadeExecutionError(a,y.ExecutionErrorCodes.OutOfBounds,B);return N.charCodeAt(x)})};z.tocodepoint=function(a,B){return G(a,B,(x,N,e)=> {b.pcCheck(e,1,2,a,B);x=b.toNumber(b.defaultUndefined(e[1],0));N=b.toString(e[0]);if(0===N.length&&1===e.length)return null;if(N.length<=x||0>x)throw new y.ArcadeExecutionError(a,y.ExecutionErrorCodes.OutOfBounds,B);return N.codePointAt(x)})};z.fromcharcode=function(a,B){return G(a,B,(x,N,e)=>{if(1>e.length)throw new y.ArcadeExecutionError(a,y.ExecutionErrorCodes.WrongNumberOfParameters,B);x=e.map(Z=>Math.trunc(b.toNumber(Z))).filter(Z=>0<=Z&&65535>=Z);return 0===x.length?null:String.fromCharCode.apply(null, x)})};z.fromcodepoint=function(a,B){return G(a,B,(x,N,e)=>{if(1>e.length)throw new y.ArcadeExecutionError(a,y.ExecutionErrorCodes.WrongNumberOfParameters,B);let Z;try{Z=e.map(t=>Math.trunc(b.toNumber(t))).filter(t=>1114111>=t&&t>>>0===t)}catch(t){return null}return 0===Z.length?null:String.fromCodePoint.apply(null,Z)})};z.getuser=function(a,B){return G(a,B,(x,N,e)=>{b.pcCheck(e,0,2,a,B);x=b.defaultUndefined(e[1],"");x=!0===x||!1===x?"":b.toString(x);if(null!==x&&""!==x)return null;if(0===e.length|| e[0]instanceof O){N=null;N=a.services?.portal?a.services.portal:n.getDefault();if(0{b.pcCheck(e,0,0,a,B);return c.convertObjectToArcadeDictionary(b.defaultExecutingContext(b.defaultTimeZone(a),a.spatialReference),b.defaultTimeZone(a),!0)})}};Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})})},"esri/arcade/ArcadePortal":function(){define(["./Dictionary"],function(D){class O extends D{constructor(E){super();this.declaredClass="esri.arcade.Portal";this.immutable=!1;this.setField("url", E);this.immutable=!0}}return O})},"esri/arcade/Attachment":function(){define(["./Dictionary"],function(D){class O extends D{constructor(E,c,y,b,q,F,d){super();this.attachmentUrl=q;this.declaredClass="esri.arcade.Attachment";this.immutable=!1;this.setField("id",E);this.setField("name",c);this.setField("contenttype",y);this.setField("size",b);this.setField("exifinfo",F);this.setField("keywords",d);this.immutable=!0}deepClone(){return new O(this.field("id"),this.field("name"),this.field("contenttype"), this.field("size"),this.attachmentUrl,this.field("exifinfo")?.deepClone()??null,this.field("keywords"))}}return O})},"esri/arcade/functions/convertdirection":function(){define(["exports","../Dictionary","../executionError","../../chunks/languageUtils","../../core/maybe"],function(D,O,E,c,y){function b(u){if(!1===c.isString(u))throw new E.ArcadeExecutionError(null,E.ExecutionErrorCodes.InvalidParameter,null);return u}function q(u,P){P=10**P;return Math.round(u*P)/P}function F(u){const P=parseFloat(u.toString().replace(Math.trunc(u).toString(), "0"))*Math.sign(u);return 0>u?{fraction:P,integer:Math.ceil(u)}:{fraction:P,integer:Math.floor(u)}}function d(u,P){switch(u){case X.north:return"SHORT"===P?"N":"North";case X.east:return"SHORT"===P?"E":"East";case X.south:return"SHORT"===P?"S":"South";case X.west:return"SHORT"===P?"W":"West"}}function k(u,P){return u-Math.floor(u/P)*P}function w(u){switch(u){case W.truncated_degrees:case W.decimal_degrees:return 360;case W.radians:return H;case W.gradians:return 400;case W.seconds:return 1296E3;case W.fractional_degree_minutes:return 60; case W.fractional_minute_seconds:return 60;default:throw new E.ArcadeExecutionError(null,E.ExecutionErrorCodes.LogicError,null,{reason:"unsupported evaluations"});}}function C(u){switch(u.toUpperCase().trim()){case "NORTH":case "NORTHAZIMUTH":case "NORTH AZIMUTH":return ca.north_azimuth;case "POLAR":return ca.polar;case "QUADRANT":return ca.quadrant;case "SOUTH":case "SOUTHAZIMUTH":case "SOUTH AZIMUTH":return ca.south_azimuth}throw new E.ArcadeExecutionError(null,E.ExecutionErrorCodes.LogicError, null,{reason:"unsupported directionType"});}function M(u){switch(u.toUpperCase().trim()){case "D":case "DD":case "DECIMALDEGREE":case "DECIMAL DEGREE":case "DEGREE":case "DECIMALDEGREES":case "DECIMAL DEGREES":case "DEGREES":return W.decimal_degrees;case "DMS":case "DEGREESMINUTESSECONDS":case "DEGREES MINUTES SECONDS":return W.degrees_minutes_seconds;case "R":case "RAD":case "RADS":case "RADIAN":case "RADIANS":return W.radians;case "G":case "GON":case "GONS":case "GRAD":case "GRADS":case "GRADIAN":case "GRADIANS":return W.gradians}throw new E.ArcadeExecutionError(null, E.ExecutionErrorCodes.LogicError,null,{reason:"unsupported units"});}function A(u,P,S){let V=null;switch(P){case W.decimal_degrees:V=Z(u,3600);break;case W.seconds:V=u;break;case W.gradians:V=Z(u,3240);break;case W.radians:V=Z(u,R);break;default:throw new E.ArcadeExecutionError(null,E.ExecutionErrorCodes.LogicError,null,{reason:"unexpected evaluation"});}switch(S){case W.decimal_degrees:return t(V,3600);case W.seconds:return V;case W.gradians:return t(V,3240);case W.radians:return V/R;default:throw new E.ArcadeExecutionError(null, E.ExecutionErrorCodes.LogicError,null,{reason:"unexpected evaluation"});}}function f(u){y.assertIsSome(u);switch(u){case W.decimal_degrees:case W.truncated_degrees:case W.degrees_minutes_seconds:return W.decimal_degrees;case W.gradians:return W.gradians;case W.fractional_degree_minutes:return W.fractional_degree_minutes;case W.radians:return W.radians;case W.seconds:case W.fractional_minute_seconds:return W.seconds}}function m(u){switch(c.toNumber(u)){case 1:return{first:X.north,second:X.east};case 2:return{first:X.south, second:X.east};case 3:return{first:X.south,second:X.west};case 4:return{first:X.north,second:X.west}}return null}function r(u){switch(u.toUpperCase().trim()){case "N":case "NORTH":return X.north;case "E":case "EAST":return X.east;case "S":case "SOUTH":return X.south;case "W":case "WEST":return X.west}return null}function n(u){u=parseFloat(u);if(c.isNumber(u)){if(isNaN(u))throw new E.ArcadeExecutionError(null,E.ExecutionErrorCodes.LogicError,null,{reason:"invalid conversion"});return u}throw new E.ArcadeExecutionError(null, E.ExecutionErrorCodes.LogicError,null,{reason:"invalid conversion"});}function g(u,P,S){const V=S===ca.quadrant;let ha=null;var qa=null;let ra=0;var h=0;h=0;if(V){if(2>u.length)throw new E.ArcadeExecutionError(null,E.ExecutionErrorCodes.LogicError,null,{reason:"conversion error"});h=1;(qa=m(c.toString(u[u.length-1])))?(ha=qa.first,qa=qa.second):(ra=1,ha=r(c.toString(u[0])),qa=r(c.toString(u[u.length-1])));if(null===ha||null===qa)throw new E.ArcadeExecutionError(null,E.ExecutionErrorCodes.LogicError, null,{reason:"invalid conversion"});}switch(P){case W.decimal_degrees:case W.radians:case W.gradians:if(0===u.length)break;return V?sa.createFromAngleMeridianAndDirection(I.createFromAngleAndUnits(n(u[ra]),f(P)),ha,qa):sa.createFromAngleAndDirection(I.createFromAngleAndUnits(n(u[ra]),f(P)),S);case W.degrees_minutes_seconds:h=u.length-h-ra;if(3===h)return u=I.createFromDegreesMinutesSeconds(n(u[ra]),n(u[ra+1]),n(u[ra+2])),V?sa.createFromAngleMeridianAndDirection(u,ha,qa):sa.createFromAngleAndDirection(u, S);if(1===h)return u=n(u[ra]),u=pa.numberToDms(u),u=I.createFromDegreesMinutesSeconds(u.m_degrees,u.m_minutes,u.m_seconds),V?sa.createFromAngleMeridianAndDirection(u,ha,qa):sa.createFromAngleAndDirection(u,S)}throw new E.ArcadeExecutionError(null,E.ExecutionErrorCodes.LogicError,null,{reason:"invalid conversion"});}function l(u){const P=new Set([" ","-","/","'",'"',"\\","^","\u00b0",U,"\t","\r","\n","*"]);let S="";for(let V=0;V""!==V)}function z(u,P,S){const V={padding:0,rounding:0,newpos:P};let ha=!1;for(;P(P,S,V)=>{V=V||14;return+u(P,S).toFixed(V)},a=(u,P)=>u+P,B=(u,P)=>u-P,x=(u,P)=>u*P,N=(u,P)=>u/P,e=(u,P,S)=>G(a)(u,P,S),Z=(u,P,S)=>G(x)(u,P,S),t=(u,P,S)=>G(N)(u,P,S),H=2*Math.PI,R=648E3/Math.PI,U=String.fromCharCode(7501);var X;(function(u){u[u.north= 0]="north";u[u.east=1]="east";u[u.south=2]="south";u[u.west=3]="west"})(X||={});var W;(function(u){u[u.decimal_degrees=1]="decimal_degrees";u[u.seconds=2]="seconds";u[u.degrees_minutes_seconds=3]="degrees_minutes_seconds";u[u.radians=4]="radians";u[u.gradians=5]="gradians";u[u.truncated_degrees=6]="truncated_degrees";u[u.fractional_degree_minutes=7]="fractional_degree_minutes";u[u.fractional_minute_seconds=8]="fractional_minute_seconds"})(W||={});var ca;(function(u){u[u.north_azimuth=1]="north_azimuth"; u[u.polar=2]="polar";u[u.quadrant=3]="quadrant";u[u.south_azimuth=4]="south_azimuth"})(ca||={});var wa;(function(u){u[u.meridian=0]="meridian";u[u.direction=1]="direction"})(wa||={});class pa{constructor(u,P,S){this.m_degrees=u;this.m_minutes=P;this.m_seconds=S}getField(u){switch(u){case W.decimal_degrees:case W.truncated_degrees:return this.m_degrees;case W.fractional_degree_minutes:return this.m_minutes;case W.seconds:case W.fractional_minute_seconds:return this.m_seconds;default:throw new E.ArcadeExecutionError(null, E.ExecutionErrorCodes.LogicError,null,{reason:"unexpected evaluation"});}}static secondsToDMS(u){const P=F(u).fraction;u=F(u).integer;const S=Math.floor(u/3600);u-=3600*S;const V=Math.floor(u/60);return new pa(S,V,u-60*V+P)}static numberToDms(u){var P=F(u).fraction;u=F(u).integer;const S=Z(F(100*P).fraction,100);P=F(100*P).integer;return new pa(u,P,S)}format(u,P){P=q(this.m_seconds,P);let S=this.m_minutes,V=this.m_degrees;if(u===W.seconds||u===W.fractional_minute_seconds)60<=P&&(P-=60,++S),60<=S&& (S=0,++V),360<=V&&(V=0);else if(u===W.fractional_degree_minutes)P=0,S=30<=this.m_seconds?this.m_minutes+1:this.m_minutes,V=this.m_degrees,60<=S&&(S=0,++V),360<=V&&(V=0);else if(u===W.decimal_degrees||u===W.truncated_degrees)u=t(this.m_seconds,3600),P=t(this.m_minutes,60),V=Math.round(this.m_degrees+P+u),P=S=0;return new pa(V,S,P)}static dmsToSeconds(u,P,S){return 3600*u+60*P+S}}class xa{constructor(u,P,S){this.meridian=u;this.angle=P;this.direction=S}fetchAzimuth(u){return u===wa.meridian?this.meridian: this.direction}}class sa{constructor(u){this._angle=u}static createFromAngleAndDirection(u,P){return new sa(new I(sa._convertDirectionFormat(u.extractAngularUnits(W.seconds),P,ca.north_azimuth)))}getAngle(u){const P=this._angle.extractAngularUnits(W.seconds);switch(u){case ca.north_azimuth:case ca.south_azimuth:case ca.polar:return new I(sa._convertDirectionFormat(P,ca.north_azimuth,u));case ca.quadrant:return u=sa.secondsNorthAzimuthToQuadrant(P),new I(u.angle)}}getMeridian(u){const P=this._angle.extractAngularUnits(W.seconds); switch(u){case ca.north_azimuth:return X.north;case ca.south_azimuth:return X.south;case ca.polar:return X.east;case ca.quadrant:return sa.secondsNorthAzimuthToQuadrant(P).meridian}}getDirection(u){const P=this._angle.extractAngularUnits(W.seconds);switch(u){case ca.north_azimuth:return X.east;case ca.south_azimuth:return X.west;case ca.polar:return X.north;case ca.quadrant:return sa.secondsNorthAzimuthToQuadrant(P).direction}}static secondsNorthAzimuthToQuadrant(u){const P=324E3>=u||972E3<=u?X.north: X.south;return new xa(P,P===X.north?Math.min(1296E3-u,u):Math.abs(u-648E3),648E3u?1296E3+u:u}}class I{constructor(u){this._seconds=u}static createFromAngleAndUnits(u,P){return new I(A(u,P,W.seconds))}extractAngularUnits(u){return A(this._seconds, W.seconds,f(u))}static createFromDegreesMinutesSeconds(u,P,S){return new I(e(e(Z(u,3600),Z(P,60)),S))}}class J{constructor(u,P,S,V){this.view=u;this.angle=P;this.merdian=S;this.direction=V;this._formattedDms=this._dms=null}static createFromStringAndBearing(u,P,S){return new J(u,P.getAngle(S),P.getMeridian(S),P.getDirection(S))}fetchAngle(){return this.angle}fetchMeridian(){return this.merdian}fetchDirection(){return this.direction}fetchView(){return this.view}fetchDms(){null===this._dms&&this._calculateDms(); return this._dms}fetchFormattedDms(){null===this._formattedDms&&this._calculateDms();return this._formattedDms}_calculateDms(){var u=null;let P=W.truncated_degrees,S=0;for(u=0;uG(B)(u,P,S);D.preciseMultiply=Z;Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})})},"esri/arcade/functions/hash":function(){define(["exports"],function(D){function O(c){const y=[];for(let b=0,q=c.length;bF?y.push(F):2048>F?y.push(192|F>>6,128|F&63):55296>F||57344<=F?y.push(224|F>>12,128|F>>6&63,128|F&63):(b++,F=65536+((F&1023)<<10|c.charCodeAt(b)&1023),y.push(240|F>>18,128|F>>12&63,128| F>>6&63,128|F&63))}return new Uint8Array(y)}class E{constructor(c){this._seed=c;this._totallen=0;this._bufs=[];this.init()}init(){this._bufs=[];this._totallen=0;return this}updateFloatArray(c){const y=[];for(const b of c)isNaN(b)?y.push("NaN"):Infinity===b?y.push("Infinity"):-Infinity===b?y.push("-Infinity"):0===b?y.push("0"):y.push(b.toString(16));this.update(O(y.join("")))}updateIntArray(c){c=Int32Array.from(c);this.update(new Uint8Array(c.buffer))}updateUint8Array(c){this.update(Uint8Array.from(c))}updateWithString(c){return this.update(O(c))}update(c){this._bufs.push(c); this._totallen+=c.length;return this}digest(){const c=new Uint8Array(this._totallen);let y=0;for(const b of this._bufs)c.set(b,y),y+=b.length;this.init();return this._xxHash32(c,this._seed)}_xxHash32(c,y=0){var b=y+374761393&4294967295;let q=0;if(16<=c.length){b=[y+2654435761+2246822519&4294967295,y+2246822519&4294967295,y+0&4294967295,y-2654435761&4294967295];y=c.length-16;var F=0;for(q=0;(q&4294967280)<=y;q+=4){var d=q;d=b[F]+(2246822519*(c[d]+(c[d+1]<<8))+(2246822519*(c[d+2]+(c[d+3]<<8))<<16))& 4294967295;d=d<<13|d>>>19;b[F]=2654435761*(d&65535)+(2654435761*(d>>>16)<<16)&4294967295;F=F+1&3}b=(b[0]<<1|b[0]>>>31)+(b[1]<<7|b[1]>>>25)+(b[2]<<12|b[2]>>>20)+(b[3]<<18|b[3]>>>14)&4294967295}b=b+c.length&4294967295;for(y=c.length-4;q<=y;q+=4)F=q,b=b+(3266489917*(c[F]+(c[F+1]<<8))+(3266489917*(c[F+2]+(c[F+3]<<8))<<16))&4294967295,b=b<<17|b>>>15,b=668265263*(b&65535)+(668265263*(b>>>16)<<16)&4294967295;for(;q>>21,b=2654435761*(b&65535)+(2654435761*(b>>>16)<< 16)&4294967295;b^=b>>>15;b=(2246822519*(b&65535)&4294967295)+(2246822519*(b>>>16)<<16);b^=b>>>13;b=(3266489917*(b&65535)&4294967295)+(3266489917*(b>>>16)<<16);b^=b>>>16;return 0>b?b+4294967296:b}}D.XXH=E;Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})})},"esri/arcade/ArcadeModuleResolver":function(){define("exports ../request ./executionError ./parser ./featureset/support/RecentlyUsedCache ../portal/Portal".split(" "),function(D,O,E,c,y,b){class q{constructor(F){this.portalUri=F}normalizeModuleUri(F){const d= /^[a-z0-9A-Z]+(@[0-9]+\.[0-9]+\.[0-9]+)?([?|/].*)?$/gi;var k=/(?.+)\/home\/item\.html\?id=(?.+)$/gi;const w=/(?.+)\/sharing\/rest\/content\/users\/[a-zA-Z0-9]+\/items\/(?.+)$/gi,C=/(?.+)\/sharing\/rest\/content\/items\/(?.+)$/gi;var M=/(?.*)@(?[0-9]+\.[0-9]+\.[0-9]+)([?|/].*)?$/gi;if(F.startsWith("portal+")){let m=F.substring(7);var A="",f=m;let r=!1;for(const n of[k,C,w])if(k=n.exec(m),null!==k){A=k.groups;f=A.itemid; A=A.portalurl;r=!0;break}if(!1===r)if(d.test(m))f=m,A=this.portalUri;else throw new E.ModuleError(E.ModuleErrorCodes.UnsupportedUriProtocol,{uri:F});f.includes("/")&&(f=f.split("/")[0]);f.includes("?")&&(f=f.split("?")[0]);F="current";M=M.exec(f);null!==M&&(F=M.groups,f=F.itemid,F=F.versionstring);m=(new b({url:A})).restUrl+"/content/items/"+f+"/resources/"+F+".arc";return{url:m,scheme:"portal",uri:"PO:"+m}}if(F.startsWith("mock")){if("mock"===F)return{url:"",scheme:"mock",data:'\n export var hello \x3d 1;\n export function helloWorld() {\n return "Hello World " + hello;\n }\n ', uri:"mock"};f=F.replace("mock:","");if(void 0!==q.mocks[f])return{url:"",scheme:"mock",data:q.mocks[f],uri:F}}throw new E.ModuleError(E.ModuleErrorCodes.UnrecognizedUri,{uri:F});}async fetchModule(F){var d=q.cachedModules.getFromCache(F.uri);if(d)return d;d=this.fetchSource(F);q.cachedModules.addToCache(F.uri,d);let k=null;try{k=await d}catch(w){throw q.cachedModules.removeFromCache(F.uri),w;}return k}async fetchSource(F){if("portal"===F.scheme){const d=await O(F.url,{responseType:"text",query:{}}); if(d.data)return c.parseScript(d.data,[])}if("mock"===F.scheme)return c.parseScript(F.data??"",[]);throw new E.ModuleError(E.ModuleErrorCodes.UnsupportedUriProtocol);}static create(F){return new q(F)}static getDefault(){return this._default??(q._default=q._moduleResolverFactory())}static set moduleResolverClass(F){this._moduleResolverFactory=F;this._default=null}}q.mocks={};q.cachedModules=new y(30);q._default=null;q._moduleResolverFactory=()=>{const F=b.getDefault();return new q(F.url)};D.ArcadeModuleResolver= q;Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})})},"esri/arcade/parser":function(){define(["exports","../chunks/index","./treeAnalysis"],function(D,O,E){D.parseScript=function(c,y=[]){c=O.rt(c);if(null===c.body||void 0===c.body)throw new O.T({index:0,line:0,column:0,data:null,description:"",code:O.o.InvalidExpression});c.loadedModules={};E.findScriptDependencies(c,y);return c};Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})})},"esri/chunks/index":function(){define(["exports"], function(D){function O(t){return!!t&&"object"==typeof t&&"type"in t&&t.type===k.BlockStatement}function E(t){return!!t&&"object"==typeof t&&"type"in t&&t.type===k.EmptyStatement}function c(t,H){return H.loc.end.line===t.loc.start.line&&H.loc.end.column<=t.loc.start.column}function y(t,H){t=n[t];return H?t.replace(z,(R,U)=>H[U]?.toString()??""):t}function b(t,H=0){let R=t.start-t.lineStart,U=t.lineNumber;return 0>R&&(R+=H,--U),{index:t.start,line:U,column:R}}function q(t){return[{index:t.range[0], ...t.loc.start},{index:t.range[1],...t.loc.end}]}function F(t){return t in f?f[t]:0}var d={Break:"break",Continue:"continue",Else:"else",For:"for",From:"from",Function:"function",If:"if",Import:"import",Export:"export",In:"in",Return:"return",Var:"var",While:"while"},k={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",BlockComment:"BlockComment",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression", ContinueStatement:"ContinueStatement",EmptyStatement:"EmptyStatement",ExpressionStatement:"ExpressionStatement",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ForStatement:"ForStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",LineComment:"LineComment",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",WhileStatement:"WhileStatement"},w=["++","--"],C=["-","+","!","~"],M="\x3d /\x3d *\x3d %\x3d +\x3d -\x3d".split(" "),A=["||","\x26\x26"], f={"||":1,"\x26\x26":2,"|":3,"^":4,"\x26":5,"\x3d\x3d":6,"!\x3d":6,"\x3c":7,"\x3e":7,"\x3c\x3d":7,"\x3e\x3d":7,"\x3c\x3c":8,"\x3e\x3e":8,"\x3e\x3e\x3e":8,"+":9,"-":9,"*":10,"/":10,"%":10},m="Unknown Boolean \x3cend\x3e Identifier Keyword Null Numeric Punctuator String RegularExpression Template".split(" "),r={InvalidModuleUri:"InvalidModuleUri",ForInOfLoopInitializer:"ForInOfLoopInitializer",IdentiferExpected:"IdentiferExpected",InvalidEscapedReservedWord:"InvalidEscapedReservedWord",InvalidExpression:"InvalidExpression", InvalidFunctionIdentifier:"InvalidFunctionIdentifier",InvalidHexEscapeSequence:"InvalidHexEscapeSequence",InvalidLeftHandSideInAssignment:"InvalidLeftHandSideInAssignment",InvalidLeftHandSideInForIn:"InvalidLeftHandSideInForIn",InvalidTemplateHead:"InvalidTemplateHead",InvalidVariableAssignment:"InvalidVariableAssignment",KeyMustBeString:"KeyMustBeString",NoFunctionInsideBlock:"NoFunctionInsideBlock",NoFunctionInsideFunction:"NoFunctionInsideFunction",ModuleExportRootOnly:"ModuleExportRootOnly",ModuleImportRootOnly:"ModuleImportRootOnly", PunctuatorExpected:"PunctuatorExpected",TemplateOctalLiteral:"TemplateOctalLiteral",UnexpectedBoolean:"UnexpectedBoolean",UnexpectedEndOfScript:"UnexpectedEndOfScript",UnexpectedIdentifier:"UnexpectedIdentifier",UnexpectedKeyword:"UnexpectedKeyword",UnexpectedNull:"UnexpectedNull",UnexpectedNumber:"UnexpectedNumber",UnexpectedPunctuator:"UnexpectedPunctuator",UnexpectedString:"UnexpectedString",UnexpectedTemplate:"UnexpectedTemplate",UnexpectedToken:"UnexpectedToken"},n={[r.InvalidModuleUri]:"Module uri must be a text literal.", [r.ForInOfLoopInitializer]:"for-in loop variable declaration may not have an initializer.",[r.IdentiferExpected]:"'${value}' is an invalid identifier.",[r.InvalidEscapedReservedWord]:"Keyword cannot contain escaped characters.",[r.InvalidExpression]:"Invalid expression.",[r.InvalidFunctionIdentifier]:"'${value}' is an invalid function identifier.",[r.InvalidHexEscapeSequence]:"Invalid hexadecimal escape sequence.",[r.InvalidLeftHandSideInAssignment]:"Invalid left-hand side in assignment.",[r.InvalidLeftHandSideInForIn]:"Invalid left-hand side in for-in.", [r.InvalidTemplateHead]:"Invalid template structure.",[r.InvalidVariableAssignment]:"Invalid variable assignment.",[r.KeyMustBeString]:"Object property keys must be a word starting with a letter.",[r.NoFunctionInsideBlock]:"Functions cannot be declared inside of code blocks.",[r.NoFunctionInsideFunction]:"Functions cannot be declared inside another function.",[r.ModuleExportRootOnly]:"Module exports cannot be declared inside of code blocks.",[r.ModuleImportRootOnly]:"Module import cannot be declared inside of code blocks.", [r.PunctuatorExpected]:"'${value}' expected.",[r.TemplateOctalLiteral]:"Octal literals are not allowed in template literals.",[r.UnexpectedBoolean]:"Unexpected boolean literal.",[r.UnexpectedEndOfScript]:"Unexpected end of Arcade expression.",[r.UnexpectedIdentifier]:"Unexpected identifier.",[r.UnexpectedKeyword]:"Unexpected keyword.",[r.UnexpectedNull]:"Unexpected null literal.",[r.UnexpectedNumber]:"Unexpected number.",[r.UnexpectedPunctuator]:"Unexpected ponctuator.",[r.UnexpectedString]:"Unexpected text literal.", [r.UnexpectedTemplate]:"Unexpected quasi '${value}'.",[r.UnexpectedToken]:"Unexpected token '${value}'."},g=class t extends Error{constructor({code:H,index:R,line:U,column:X,len:W=0,description:ca,data:wa}){super(ca??H);this.declaredRootClass="esri.arcade.lib.diagnostic";this.name="ParsingError";this.code=H;this.index=R;this.line=U;this.column=X;this.len=W;this.data=wa;this.description=ca;this.range={start:{line:U,column:X-1},end:{line:U,column:X+W}};Error.captureStackTrace?.(this,t)}},l=class{constructor(){this.comments= [];this._nodeStack=[];this._newComments=[]}insertInnerComments(t){if(O(t)&&0===t.body.length){var H=[];for(let R=this._newComments.length-1;0<=R;R--){let U=this._newComments[R];t.range[1]>=U.range[0]&&(H.unshift(U),this._newComments.splice(R,1))}H.length&&(t.innerComments=H)}}attachTrailingComments(t){let H=this._nodeStack.at(-1);if(H){if(O(t)&&H.range[0]>=t.range[0]&&H.range[1]<=t.range[1])for(var R=this._newComments.length-1;0<=R;R--){var U=this._newComments[R];U.range[0]>=t.range[0]&&U.range[1]<= t.range[1]&&(H.trailingComments=[...(H.trailingComments??[]),U],this._newComments.splice(R,1))}R=[];if(0=W.range[1]?(R.unshift(W),H.leadingComments.splice(X,1)):t&&"object"==typeof t&&"type"in t&&t.type===k.VariableDeclarator&&!(W&&"object"==typeof W&&"type"in W&&W.type===k.BlockComment)&&(U.unshift(W),H.leadingComments.splice(X,1))}0=== H.leadingComments.length&&delete H.leadingComments;R.length&&(t.leadingComments=R);U.length&&(t.trailingComments=[...U,...(t.trailingComments??[])])}}else{for(H=this._newComments.length-1;0<=H;H--)U=this._newComments[H],t.range[0]>=U.range[0]&&(R.unshift(U),this._newComments.splice(H,1));R.length&&(t.leadingComments=R)}}attachComments(t){if(t&&"object"==typeof t&&"type"in t&&t.type===k.Program&&0t?String.fromCharCode(t):String.fromCharCode(55296+(t-65536>>10))+String.fromCharCode(56320+(t-65536&1023))},isWhiteSpace(t){return 32===t||9===t||11===t||12===t||160===t||5760<=t&&[5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(t)},isLineTerminator(t){return 10===t||13===t||8232===t||8233===t},isIdentifierStart(t){return 36===t||95===t||65<=t&&90>=t||97<=t&&122>=t||92===t||128<=t&&a.test(x.fromCodePoint(t))},isIdentifierPart(t){return 36=== t||95===t||65<=t&&90>=t||97<=t&&122>=t||48<=t&&57>=t||92===t||128<=t&&B.test(x.fromCodePoint(t))},isDecimalDigit(t){return 48<=t&&57>=t},isHexDigit(t){return 48<=t&&57>=t||65<=t&&70>=t||97<=t&&102>=t},isOctalDigit(t){return 48<=t&&55>=t}},N=[[],[],[]];w.forEach(t=>N[t.length-1]?.push(t));C.forEach(t=>N[t.length-1]?.push(t));A.forEach(t=>N[t.length-1]?.push(t));M.forEach(t=>N[t.length-1]?.push(t));"| \x26 \x3e\x3e \x3c\x3c \x3e\x3e\x3e ^ \x3d\x3d !\x3d \x3c \x3c\x3d \x3e \x3e\x3d + - * / %".split(" ").forEach(t=> N[t.length-1]?.push(t));var e=class{constructor(t,H){this.source=t;this.errorHandler=H;this._length=t.length;this.index=0;this.lineNumber=1;this.lineStart=0;this.curlyStack=[]}saveState(){return{index:this.index,lineNumber:this.lineNumber,lineStart:this.lineStart,curlyStack:this.curlyStack.slice()}}restoreState(t){this.index=t.index;this.lineNumber=t.lineNumber;this.lineStart=t.lineStart;this.curlyStack=t.curlyStack}eof(){return this.index>=this._length}throwUnexpectedToken(t=r.UnexpectedToken){this.errorHandler.throwError({code:t, index:this.index,line:this.lineNumber,column:this.index-this.lineStart+1,data:{value:this.source.charAt(this.index)}})}tolerateUnexpectedToken(t=r.UnexpectedToken){this.errorHandler.tolerateError({code:t,index:this.index,line:this.lineNumber,column:this.index-this.lineStart+1})}skipSingleLineComment(t){let H=[],R=this.index-t,U={start:{line:this.lineNumber,column:this.index-this.lineStart-t},end:{line:0,column:0}};for(;!this.eof();){let X=this.source.charCodeAt(this.index);if(this.index+=1,x.isLineTerminator(X))return U.end= {line:this.lineNumber,column:this.index-this.lineStart-1},H.push({multiLine:!1,start:R+t,end:this.index-1,range:[R,this.index-1],loc:U}),13===X&&10===this.source.charCodeAt(this.index)&&(this.index+=1),this.lineNumber+=1,this.lineStart=this.index,H}U.end={line:this.lineNumber,column:this.index-this.lineStart};return H.push({multiLine:!1,start:R+t,end:this.index,range:[R,this.index],loc:U}),H}skipMultiLineComment(){let t=[],H=this.index-2,R={start:{line:this.lineNumber,column:this.index-this.lineStart- 2},end:{line:0,column:0}};for(;!this.eof();){let U=this.source.charCodeAt(this.index);if(x.isLineTerminator(U))13===U&&10===this.source.charCodeAt(this.index+1)&&(this.index+=1),this.lineNumber+=1,this.lineStart=this.index+=1;else{if(42===U&&47===this.source.charCodeAt(this.index+1))return this.index+=2,R.end={line:this.lineNumber,column:this.index-this.lineStart},t.push({multiLine:!0,start:H+2,end:this.index-2,range:[H,this.index],loc:R}),t;this.index+=1}}R.end={line:this.lineNumber,column:this.index- this.lineStart};return t.push({multiLine:!0,start:H+2,end:this.index,range:[H,this.index],loc:R}),this.tolerateUnexpectedToken(),t}scanComments(){let t=[];for(;!this.eof();){var H=this.source.charCodeAt(this.index);if(x.isWhiteSpace(H))this.index+=1;else if(x.isLineTerminator(H))this.index+=1,13===H&&10===this.source.charCodeAt(this.index)&&(this.index+=1),this.lineNumber+=1,this.lineStart=this.index;else if(47===H)if(H=this.source.charCodeAt(this.index+1),47===H)this.index+=2,H=this.skipSingleLineComment(2), t=[...t,...H];else if(42===H)this.index+=2,H=this.skipMultiLineComment(),t=[...t,...H];else break;else break}return t}isKeyword(t){switch(t=t.toLowerCase(),t.length){case 2:return t===d.If||t===d.In;case 3:return t===d.Var||t===d.For;case 4:return t===d.Else;case 5:return t===d.Break||t===d.While;case 6:return t===d.Return||t===d.Import||t===d.Export;case 8:return t===d.Function||t===d.Continue;default:return!1}}codePointAt(t){let H=this.source.charCodeAt(t);55296<=H&&56319>=H&&(t=this.source.charCodeAt(t+ 1),56320<=t&&57343>=t&&(H=1024*(H-55296)+t-56320+65536));return H}scanHexEscape(t){t="u"===t?4:2;let H=0;for(let R=0;RH)return this.index=t,this.getComplexIdentifier();if(x.isIdentifierPart(H))this.index+=1;else break}return this.source.slice(t,this.index)}getComplexIdentifier(){let t=this.codePointAt(this.index),H=x.fromCodePoint(t);this.index+=H.length;let R; for(92===t&&(117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(),this.index+=1,"{"===this.source[this.index]?(this.index+=1,R=this.scanUnicodeCodePointEscape()):(R=this.scanHexEscape("u"),(null===R||"\\"===R||!x.isIdentifierStart(R.charCodeAt(0)))&&this.throwUnexpectedToken()),H=R);!this.eof()&&(t=this.codePointAt(this.index),x.isIdentifierPart(t));)R=x.fromCodePoint(t),H+=R,this.index+=R.length,92===t&&(H=H.substring(0,H.length-1),117!==this.source.charCodeAt(this.index)&&this.throwUnexpectedToken(), this.index+=1,"{"===this.source[this.index]?(this.index+=1,R=this.scanUnicodeCodePointEscape()):(R=this.scanHexEscape("u"),(null===R||"\\"===R||!x.isIdentifierPart(R.charCodeAt(0)))&&this.throwUnexpectedToken()),H+=R);return H}octalToDecimal(t){let H="0"!==t,R="01234567".indexOf(t);return!this.eof()&&x.isOctalDigit(this.source.charCodeAt(this.index))&&(H=!0,R=8*R+"01234567".indexOf(this.source[this.index]??""),this.index+=1,"0123".includes(t)&&!this.eof()&&x.isOctalDigit(this.source.charCodeAt(this.index))&& (R=8*R+"01234567".indexOf(this.source[this.index]??""),this.index+=1)),{code:R,octal:H}}scanIdentifier(){let t,H=this.index,R=92===this.source.charCodeAt(H)?this.getComplexIdentifier():this.getIdentifier();if(1===R.length?t=3:this.isKeyword(R)?t=4:"null"===R.toLowerCase()?t=5:"true"===R.toLowerCase()||"false"===R.toLowerCase()?t=1:t=3,3!==t&&H+R.length!==this.index){let U=this.index;this.index=H;this.tolerateUnexpectedToken(r.InvalidEscapedReservedWord);this.index=U}return{type:t,value:R,lineNumber:this.lineNumber, lineStart:this.lineStart,start:H,end:this.index}}scanPunctuator(){let t=this.index,H=this.source[this.index]??"";switch(H){case "(":case "{":"{"===H&&this.curlyStack.push("{");this.index+=1;break;case ".":this.index+=1;break;case "}":this.index+=1;this.curlyStack.pop();break;case ")":case ";":case ",":case "[":case "]":case ":":case "?":case "~":this.index+=1;break;default:for(let R=N.length;0t&&x.isIdentifierStart(this.codePointAt(this.index))?this.scanIdentifier():this.scanPunctuator()}},Z=class{constructor(t,H={},R){this.delegate=R;this.hasLineTerminator=!1;this.options={tokens:"boolean"==typeof H.tokens&&H.tokens,comments:"boolean"==typeof H.comments&&H.comments,tolerant:"boolean"==typeof H.tolerant&&H.tolerant};this.options.comments&&(this.commentHandler=new l);this.errorHandler=new G(this.options.tolerant);this.scanner=new e(t,this.errorHandler);this.context={isAssignmentTarget:!1, blockContext:0,curlyParsingType:0};this.rawToken={type:2,value:"",lineNumber:this.scanner.lineNumber,lineStart:0,start:0,end:0};this.tokens=[];this.startMarker={index:0,line:this.scanner.lineNumber,column:0};this.endMarker={index:0,line:this.scanner.lineNumber,column:0};this.readNextRawToken();this.endMarker={index:this.scanner.index,line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}throwIfInvalidType(t,H,{validTypes:R,invalidTypes:U}){R?.some(X=>t.type===X)||U?.some(X=> t.type===X)&&this.throwError(r.InvalidExpression,H)}throwError(t,H,R=this.endMarker){let {index:U,line:X,column:W}=H;this.errorHandler.throwError({code:t,index:U,line:X,column:W+1,len:R.index-U-1})}tolerateError(t,H){throw Error("######################################### !!!");}unexpectedTokenError(t={}){let {rawToken:H}=t,{code:R,data:U}=t;if(H){if(!R)switch(H.type){case 2:R=r.UnexpectedEndOfScript;break;case 3:R=r.UnexpectedIdentifier;break;case 6:R=r.UnexpectedNumber;break;case 8:R=r.UnexpectedString; break;case 10:R=r.UnexpectedTemplate}t=H.value.toString()}else t="ILLEGAL";R??=r.UnexpectedToken;U||={value:t};t=y(R,U);if(H)return new g({code:R,index:H.start,line:H.lineNumber,column:H.start-H.lineStart+1,len:H.end-H.start-1,data:U,description:t});let {index:X,line:W}=this.endMarker;return new g({code:R,index:X,line:W,column:this.endMarker.column+1,data:U,description:t})}throwUnexpectedToken(t={}){throw t.rawToken??(t.rawToken=this.rawToken),this.unexpectedTokenError(t);}collectComments(t){let {commentHandler:H}= this;H&&t.length&&t.forEach(R=>{R={type:R.multiLine?k.BlockComment:k.LineComment,value:this.getSourceValue(R),range:R.range,loc:R.loc};H.collectComment(R)})}peekAhead(t){let H=this.scanner.saveState();t=t.call(this,()=>(this.scanner.scanComments(),this.scanner.lex()));return this.scanner.restoreState(H),t}getSourceValue(t){return this.scanner.source.slice(t.start,t.end)}convertToToken(t){return{type:m[t.type],value:this.getSourceValue(t),range:[t.start,t.end],loc:{start:{line:this.startMarker.line, column:this.startMarker.column},end:{line:this.scanner.lineNumber,column:this.scanner.index-this.scanner.lineStart}}}}readNextRawToken(){this.endMarker.index=this.scanner.index;this.endMarker.line=this.scanner.lineNumber;this.endMarker.column=this.scanner.index-this.scanner.lineStart;let t=this.rawToken;this.collectComments(this.scanner.scanComments());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);this.rawToken=this.scanner.lex();this.hasLineTerminator=t.lineNumber!==this.rawToken.lineNumber;this.options.tokens&&2!==this.rawToken.type&&this.tokens.push(this.convertToToken(this.rawToken))}captureStartMarker(){return{index:this.startMarker.index,line:this.startMarker.line,column:this.startMarker.column}}getItemLocation(t){return{range:[t.index,this.endMarker.index],loc:{start:{line:t.line,column:t.column},end:{line:this.endMarker.line,column:this.endMarker.column}}}}finalize(t){return(this.delegate?? this.commentHandler)&&(this.commentHandler?.attachComments(t),this.delegate?.(t)),t}expectPunctuator(t){let H=this.rawToken;this.matchPunctuator(t)?this.readNextRawToken():this.throwUnexpectedToken({rawToken:H,code:r.PunctuatorExpected,data:{value:t}})}expectKeyword(t){4===this.rawToken.type&&this.rawToken.value.toLowerCase()===t.toString()?this.readNextRawToken():this.throwUnexpectedToken({rawToken:this.rawToken})}expectContextualKeyword(t){3===this.rawToken.type&&this.rawToken.value.toLowerCase()=== t?this.readNextRawToken():this.throwUnexpectedToken({rawToken:this.rawToken})}matchKeyword(t){return 4===this.rawToken.type&&this.rawToken.value.toLowerCase()===t}matchContextualKeyword(t){return 3===this.rawToken.type&&this.rawToken.value===t}matchPunctuator(t){return 7===this.rawToken.type&&this.rawToken.value===t}getMatchingPunctuator(t){if("string"==typeof t&&(t=t.split("")),7===this.rawToken.type&&t.length)return t.find(this.matchPunctuator.bind(this))}isolateCoverGrammar(t){let H=this.context.isAssignmentTarget; this.context.isAssignmentTarget=!0;t=t.call(this);return this.context.isAssignmentTarget=H,t}inheritCoverGrammar(t){var H;let R=this.context.isAssignmentTarget;this.context.isAssignmentTarget=!0;t=t.call(this);return(H=this.context).isAssignmentTarget&&(H.isAssignmentTarget=R),t}withBlockContext(t,H){let R=this.context.blockContext;this.context.blockContext|=t;t=this.context.curlyParsingType;this.context.curlyParsingType=1;H=H.call(this);return this.context.blockContext=R,this.context.curlyParsingType= t,H}consumeSemicolon(){this.matchPunctuator(";")?this.readNextRawToken():this.hasLineTerminator||(2===this.rawToken.type||this.matchPunctuator("}")?(this.endMarker.index=this.startMarker.index,this.endMarker.line=this.startMarker.line,this.endMarker.column=this.startMarker.column):this.throwUnexpectedToken({rawToken:this.rawToken}))}parsePrimaryExpression(){let t=this.captureStartMarker(),H=this.rawToken;switch(H.type){case 3:return this.readNextRawToken(),this.finalize({type:k.Identifier,name:H.value, ...this.getItemLocation(t)});case 6:case 8:return this.context.isAssignmentTarget=!1,this.readNextRawToken(),this.finalize({type:k.Literal,value:H.value,raw:this.getSourceValue(H),isString:"string"==typeof H.value,...this.getItemLocation(t)});case 1:return this.context.isAssignmentTarget=!1,this.readNextRawToken(),this.finalize({type:k.Literal,value:"true"===H.value.toLowerCase(),raw:this.getSourceValue(H),isString:!1,...this.getItemLocation(t)});case 5:return this.context.isAssignmentTarget=!1,this.readNextRawToken(), this.finalize({type:k.Literal,value:null,raw:this.getSourceValue(H),isString:!1,...this.getItemLocation(t)});case 10:return this.parseTemplateLiteral();case 7:switch(H.value){case "(":return this.inheritCoverGrammar(this.parseGroupExpression.bind(this));case "[":return this.inheritCoverGrammar(this.parseArrayInitializer.bind(this));case "{":return this.inheritCoverGrammar(this.parseObjectExpression.bind(this));default:return this.throwUnexpectedToken({rawToken:this.rawToken})}case 4:return this.context.isAssignmentTarget= !1,this.throwUnexpectedToken({rawToken:this.rawToken});default:return this.throwUnexpectedToken({rawToken:this.rawToken})}}parseArrayInitializer(){let t=this.captureStartMarker();this.expectPunctuator("[");let H=[];for(;!this.matchPunctuator("]");){let R=this.captureStartMarker();this.matchPunctuator(",")?(this.readNextRawToken(),this.throwError(r.InvalidExpression,R)):(H.push(this.inheritCoverGrammar(this.parseAssignmentExpression.bind(this))),this.matchPunctuator("]")||this.expectPunctuator(","))}return this.expectPunctuator("]"), this.finalize({type:k.ArrayExpression,elements:H,...this.getItemLocation(t)})}parseObjectPropertyKey(){let t=this.captureStartMarker(),H=this.rawToken;switch(H.type){case 8:return this.readNextRawToken(),this.finalize({type:k.Literal,value:H.value,raw:this.getSourceValue(H),isString:!0,...this.getItemLocation(t)});case 3:case 1:case 5:case 4:return this.readNextRawToken(),this.finalize({type:k.Identifier,name:H.value,...this.getItemLocation(t)});default:this.throwError(r.KeyMustBeString,t)}}parseObjectProperty(){let t= this.rawToken,H=this.captureStartMarker(),R=this.parseObjectPropertyKey(),U=!1,X=null;return this.matchPunctuator(":")?(this.readNextRawToken(),X=this.inheritCoverGrammar(this.parseAssignmentExpression.bind(this))):3===t.type?(U=!0,X=this.finalize({type:k.Identifier,name:t.value,...this.getItemLocation(H)})):this.throwUnexpectedToken({rawToken:this.rawToken}),this.finalize({type:k.Property,kind:"init",key:R,value:X,shorthand:U,...this.getItemLocation(H)})}parseObjectExpression(){let t=this.captureStartMarker(); this.expectPunctuator("{");let H=[];for(;!this.matchPunctuator("}");)H.push(this.parseObjectProperty()),this.matchPunctuator("}")||this.expectPunctuator(",");return this.expectPunctuator("}"),this.finalize({type:k.ObjectExpression,properties:H,...this.getItemLocation(t)})}parseTemplateElement(t=!1){var H=this.rawToken;10!==H.type&&this.throwUnexpectedToken({rawToken:H});t&&!H.head&&this.throwUnexpectedToken({code:r.InvalidTemplateHead,rawToken:H});t=this.captureStartMarker();this.readNextRawToken(); let {value:R,cooked:U,tail:X}=H;H=this.finalize({type:k.TemplateElement,value:{raw:R,cooked:U},tail:X,...this.getItemLocation(t)});return H.loc.start.column+=1,H.loc.end.column-=X?1:2,H}parseTemplateLiteral(){let t=this.captureStartMarker(),H=[],R=[],U=this.parseTemplateElement(!0);for(R.push(U);!U.tail;)H.push(this.parseExpression()),U=this.parseTemplateElement(),R.push(U);return this.finalize({type:k.TemplateLiteral,quasis:R,expressions:H,...this.getItemLocation(t)})}parseGroupExpression(){this.expectPunctuator("("); let t=this.inheritCoverGrammar(this.parseAssignmentExpression.bind(this));return this.expectPunctuator(")"),t}parseArguments(){this.expectPunctuator("(");let t=[];if(!this.matchPunctuator(")"))for(;;){let H=this.isolateCoverGrammar(this.parseAssignmentExpression.bind(this));if(t.push(H),this.matchPunctuator(")")||(this.expectPunctuator(","),this.matchPunctuator(")")))break}return this.expectPunctuator(")"),t}parseMemberName(){let t=this.rawToken,H=this.captureStartMarker();return this.readNextRawToken(), 5!==t.type&&3!==t.type&&4!==t.type&&1!==t.type&&this.throwUnexpectedToken({rawToken:t}),this.finalize({type:k.Identifier,name:t.value,...this.getItemLocation(H)})}parseLeftHandSideExpression(){let t=this.captureStartMarker(),H=this.inheritCoverGrammar(this.parsePrimaryExpression.bind(this)),R=this.captureStartMarker();for(var U;U=this.getMatchingPunctuator("([.");)switch(U){case "(":this.context.isAssignmentTarget=!1;H.type!==k.Identifier&&H.type!==k.MemberExpression&&this.throwError(r.IdentiferExpected, t,R);U=this.parseArguments();H=this.finalize({type:k.CallExpression,callee:H,arguments:U,...this.getItemLocation(t)});continue;case "[":this.context.isAssignmentTarget=!0;this.expectPunctuator("[");U=this.isolateCoverGrammar(()=>this.parseExpression());this.expectPunctuator("]");H=this.finalize({type:k.MemberExpression,computed:!0,object:H,property:U,...this.getItemLocation(t)});continue;case ".":this.context.isAssignmentTarget=!0,this.expectPunctuator("."),U=this.parseMemberName(),H=this.finalize({type:k.MemberExpression, computed:!1,object:H,property:U,...this.getItemLocation(t)})}return H}parseUpdateExpression(){let t=this.captureStartMarker(),H=this.getMatchingPunctuator(w);if(H){this.readNextRawToken();var R=this.captureStartMarker(),U=this.inheritCoverGrammar(this.parseUnaryExpression.bind(this));return U.type!==k.Identifier&&U.type!==k.MemberExpression&&U.type!==k.CallExpression&&this.throwError(r.InvalidExpression,R),this.context.isAssignmentTarget||this.tolerateError(r.InvalidLeftHandSideInAssignment,t),this.context.isAssignmentTarget= !1,this.finalize({type:k.UpdateExpression,operator:H,argument:U,prefix:!0,...this.getItemLocation(t)})}R=this.captureStartMarker();U=this.inheritCoverGrammar(this.parseLeftHandSideExpression.bind(this));let X=this.captureStartMarker();return this.hasLineTerminator||(H=this.getMatchingPunctuator(w),!H)?U:(U.type!==k.Identifier&&U.type!==k.MemberExpression&&this.throwError(r.InvalidExpression,R,X),this.context.isAssignmentTarget||this.tolerateError(r.InvalidLeftHandSideInAssignment,t),this.readNextRawToken(), this.context.isAssignmentTarget=!1,this.finalize({type:k.UpdateExpression,operator:H,argument:U,prefix:!1,...this.getItemLocation(t)}))}parseUnaryExpression(){let t=this.getMatchingPunctuator(C);if(t){let H=this.captureStartMarker();this.readNextRawToken();let R=this.inheritCoverGrammar(this.parseUnaryExpression.bind(this));return this.context.isAssignmentTarget=!1,this.finalize({type:k.UnaryExpression,operator:t,argument:R,prefix:!0,...this.getItemLocation(H)})}return this.parseUpdateExpression()}parseBinaryExpression(){var t= this.rawToken,H=this.inheritCoverGrammar(this.parseUnaryExpression.bind(this));if(7!==this.rawToken.type)return H;var R=this.rawToken.value,U=F(R);if(0===U)return H;this.readNextRawToken();this.context.isAssignmentTarget=!1;t=[t,this.rawToken];var X=this.inheritCoverGrammar(this.parseUnaryExpression.bind(this));R=[H,R,X];for(var W=[U];7===this.rawToken.type&&0<(U=F(this.rawToken.value));){for(;2{let H=t();return!(3!==H.type&&8!==H.type||(H=t(),7!==H.type||":"!==H.value))})?this.parseObjectStatement():this.parseBlock()}parseIdentifier(){let t= this.rawToken;if(3!==t.type)return null;let H=this.captureStartMarker();return this.readNextRawToken(),this.finalize({type:k.Identifier,name:t.value,...this.getItemLocation(H)})}parseVariableDeclarator(){let t=this.captureStartMarker(),H=this.parseIdentifier();H||this.throwUnexpectedToken({code:r.IdentiferExpected});let R=null;if(this.matchPunctuator("\x3d")){this.readNextRawToken();let U=this.rawToken;try{R=this.isolateCoverGrammar(this.parseAssignmentExpression.bind(this))}catch{this.throwUnexpectedToken({rawToken:U, code:r.InvalidVariableAssignment})}}return this.finalize({type:k.VariableDeclarator,id:H,init:R,...this.getItemLocation(t)})}parseVariableDeclarationList(){let t=[this.parseVariableDeclarator()];for(;this.matchPunctuator(",");)this.readNextRawToken(),t.push(this.parseVariableDeclarator());return t}parseVariableDeclaration(){let t=this.captureStartMarker();this.expectKeyword(d.Var);let H=this.parseVariableDeclarationList();return this.consumeSemicolon(),this.finalize({type:k.VariableDeclaration,declarations:H, kind:"var",...this.getItemLocation(t)})}parseEmptyStatement(){let t=this.captureStartMarker();return this.expectPunctuator(";"),this.finalize({type:k.EmptyStatement,...this.getItemLocation(t)})}parseExpressionStatement(){let t=this.captureStartMarker(),H=this.parseExpression();return this.consumeSemicolon(),this.finalize({type:k.ExpressionStatement,expression:H,...this.getItemLocation(t)})}parseIfClause(){return this.withBlockContext(2,this.parseStatement.bind(this))}parseIfStatement(){let t=this.captureStartMarker(); this.expectKeyword(d.If);this.expectPunctuator("(");var H=this.captureStartMarker();let R=this.parseExpression();var U=this.captureStartMarker();this.expectPunctuator(")");R.type!==k.AssignmentExpression&&R.type!==k.UpdateExpression||this.throwError(r.InvalidExpression,H,U);H=this.parseIfClause();U=null;return this.matchKeyword(d.Else)&&(this.readNextRawToken(),U=this.parseIfClause()),this.finalize({type:k.IfStatement,test:R,consequent:H,alternate:U,...this.getItemLocation(t)})}parseWhileStatement(){let t= this.captureStartMarker();this.expectKeyword(d.While);this.expectPunctuator("(");var H=this.captureStartMarker();let R=this.parseExpression(),U=this.captureStartMarker();this.expectPunctuator(")");R.type!==k.AssignmentExpression&&R.type!==k.UpdateExpression||this.throwError(r.InvalidExpression,H,U);H=this.withBlockContext(8,this.parseStatement.bind(this));return this.finalize({type:k.WhileStatement,test:R,body:H,...this.getItemLocation(t)})}parseForStatement(){let t=null,H=null,R=null,U=null,X=null, W=this.captureStartMarker();if(this.expectKeyword(d.For),this.expectPunctuator("("),this.matchPunctuator(";"))this.readNextRawToken();else if(this.matchKeyword(d.Var)){var ca=this.captureStartMarker();this.readNextRawToken();var wa=this.parseVariableDeclarationList();1===wa.length&&this.matchKeyword(d.In)?(wa[0].init&&this.throwError(r.ForInOfLoopInitializer,ca),U=this.finalize({type:k.VariableDeclaration,declarations:wa,kind:"var",...this.getItemLocation(ca)}),this.readNextRawToken(),X=this.parseExpression()): (this.matchKeyword(d.In)&&this.throwError(r.InvalidLeftHandSideInForIn,ca),t=this.finalize({type:k.VariableDeclaration,declarations:wa,kind:"var",...this.getItemLocation(ca)}),this.expectPunctuator(";"))}else ca=this.context.isAssignmentTarget,wa=this.captureStartMarker(),t=this.inheritCoverGrammar(this.parseAssignmentExpression.bind(this)),this.matchKeyword(d.In)?(this.context.isAssignmentTarget||this.tolerateError(r.InvalidLeftHandSideInForIn,wa),t.type!==k.Identifier&&this.throwError(r.InvalidLeftHandSideInForIn, wa),this.readNextRawToken(),U=t,X=this.parseExpression(),t=null):(this.context.isAssignmentTarget=ca,this.expectPunctuator(";"));U||(this.matchPunctuator(";")||(H=this.isolateCoverGrammar(this.parseExpression.bind(this))),this.expectPunctuator(";"),this.matchPunctuator(")")||(R=this.isolateCoverGrammar(this.parseExpression.bind(this))));this.expectPunctuator(")");ca=this.withBlockContext(4,()=>this.isolateCoverGrammar(this.parseStatement.bind(this)));return U&&X?this.finalize({type:k.ForInStatement, left:U,right:X,body:ca,...this.getItemLocation(W)}):this.finalize({type:k.ForStatement,init:t,test:H,update:R,body:ca,...this.getItemLocation(W)})}parseContinueStatement(){let t=this.captureStartMarker();return this.expectKeyword(d.Continue),this.consumeSemicolon(),this.finalize({type:k.ContinueStatement,...this.getItemLocation(t)})}parseBreakStatement(){let t=this.captureStartMarker();return this.expectKeyword(d.Break),this.consumeSemicolon(),this.finalize({type:k.BreakStatement,...this.getItemLocation(t)})}parseReturnStatement(){let t= this.captureStartMarker();this.expectKeyword(d.Return);let H=(this.matchPunctuator(";")||this.matchPunctuator("}")||this.hasLineTerminator||2===this.rawToken.type)&&8!==this.rawToken.type&&10!==this.rawToken.type?null:this.parseExpression();return this.consumeSemicolon(),this.finalize({type:k.ReturnStatement,argument:H,...this.getItemLocation(t)})}parseStatement(){switch(this.rawToken.type){case 1:case 5:case 6:case 8:case 10:case 3:return this.parseExpressionStatement();case 7:return"{"===this.rawToken.value? this.parseBlockOrObjectStatement():"("===this.rawToken.value?this.parseExpressionStatement():";"===this.rawToken.value?this.parseEmptyStatement():this.parseExpressionStatement();case 4:switch(this.rawToken.value.toLowerCase()){case d.Break:return this.parseBreakStatement();case d.Continue:return this.parseContinueStatement();case d.For:return this.parseForStatement();case d.Function:return this.parseFunctionDeclaration();case d.If:return this.parseIfStatement();case d.Return:return this.parseReturnStatement(); case d.Var:return this.parseVariableDeclaration();case d.While:return this.parseWhileStatement();default:return this.parseExpressionStatement()}default:return this.throwUnexpectedToken({rawToken:this.rawToken})}}parseFormalParameters(){let t=[];if(this.expectPunctuator("("),!this.matchPunctuator(")"))for(;2!==this.rawToken.type;){let H=this.parseIdentifier();if(H||this.throwUnexpectedToken({rawToken:this.rawToken,code:r.IdentiferExpected}),t.push(H),this.matchPunctuator(")")||(this.expectPunctuator(","), this.matchPunctuator(")")))break}return this.expectPunctuator(")"),t}parseFunctionDeclaration(){1===(this.context.blockContext&1)&&this.throwUnexpectedToken({code:r.NoFunctionInsideFunction});8!==(this.context.blockContext&8)&&2!==(this.context.blockContext&2)||this.throwUnexpectedToken({code:r.NoFunctionInsideBlock});let t=this.captureStartMarker();this.expectKeyword(d.Function);let H=this.parseIdentifier();H||this.throwUnexpectedToken({code:r.InvalidFunctionIdentifier});let R=this.parseFormalParameters(), U=this.context.blockContext;this.context.blockContext|=1;let X=this.parseBlock();return this.context.blockContext=U,this.finalize({type:k.FunctionDeclaration,id:H,params:R,body:X,...this.getItemLocation(t)})}parseScript(){var t=this.captureStartMarker();let H=this.parseStatements();t=this.finalize({type:k.Program,body:H,...this.getItemLocation(t)});return this.options.tokens&&(t.tokens=this.tokens),this.options.tolerant&&(t.errors=this.errorHandler.errors),t}parseExportDeclaration(){0!==this.context.blockContext&& this.throwUnexpectedToken({code:r.ModuleExportRootOnly});let t=null,H=this.captureStartMarker();return this.expectKeyword(d.Export),this.matchKeyword(d.Var)?t=this.parseVariableDeclaration():this.matchKeyword("function")?t=this.parseFunctionDeclaration():this.throwUnexpectedToken({code:r.InvalidExpression}),this.finalize({type:k.ExportNamedDeclaration,declaration:t,specifiers:[],source:null,...this.getItemLocation(H)})}parseModuleSpecifier(){let t=this.captureStartMarker(),H=this.rawToken;if(8=== H.type)return this.readNextRawToken(),this.finalize({type:k.Literal,value:H.value,raw:this.getSourceValue(H),isString:!0,...this.getItemLocation(t)});this.throwError(r.InvalidModuleUri,t)}parseDefaultSpecifier(){let t=this.captureStartMarker(),H=this.parseIdentifier();return H||this.throwUnexpectedToken({code:r.IdentiferExpected}),this.finalize({type:k.ImportDefaultSpecifier,local:H,...this.getItemLocation(t)})}parseImportDeclaration(){0!==this.context.blockContext&&this.throwUnexpectedToken({code:r.ModuleImportRootOnly}); let t=this.captureStartMarker();this.expectKeyword(d.Import);let H=this.parseDefaultSpecifier();this.expectContextualKeyword(d.From);let R=this.parseModuleSpecifier();return this.finalize({type:k.ImportDeclaration,specifiers:[H],source:R,...this.getItemLocation(t)})}};D.Ee=function(t){return!!t&&"object"==typeof t&&"type"in t&&t.type===k.VariableDeclaration};D.Q=E;D.T=g;D.i=k;D.j=O;D.ke=function(t){return!!t&&"object"==typeof t&&"type"in t&&t.type===k.Identifier};D.l=d;D.o=r;D.q=n;D.rt=function(t, H,R){return(new Z(t,H,R)).parseScript()}})},"esri/arcade/featureset/support/RecentlyUsedCache":function(){define(function(){class D{constructor(c){const y=this;y._keys=[];y._values=[];y.length=0;c&&c.forEach(b=>{y.set(b[0],b[1])})}entries(){return[].slice.call(this.keys().map((c,y)=>[c,this._values[y]]))}keys(){return[].slice.call(this._keys)}values(){return[].slice.call(this._values)}has(c){return this._keys.includes(c)}get(c){c=this._keys.indexOf(c);return-1null==b?null:q.length?y(b instanceof D?b.get(q[0]):b[q[0]],q.slice(1)):b;return y(this.get(c[0]),c.slice(1))}set(c,y){const b=this._keys.indexOf(c);-1this._keys[q])return this._keys.splice(q+1,0,c),this._values.splice(q+1,0,y),this;if(c=q)return this;F=b+Math.floor((q-b)/2);return cthis._keys[F]?this.sortedSet(c,y,F+1,q):this}size(){return this.length}clear(){this._keys.length=this.length=this._values.length=0;return this}delete(c){c=this._keys.indexOf(c);return-1{c(this._values[b],y,b)})}map(c){return this.keys().map((y,b)=>c(this._values[b],y,b))}filter(c){const y=this;y._keys.forEach((b,q)=>{!1===c(y._values[q],b,q)&&y.delete(b)});return this}clone(){return new D(this.entries())}}class O{constructor(c=20){this._maxEntries=c;this._values=new D}delete(c){this._values.has(c)&&this._values.delete(c)}get(c){let y=null;this._values.has(c)&&(y=this._values.get(c),this._values.delete(c), this._values.set(c,y));return y}put(c,y){if(this._values.size()>=this._maxEntries){const b=this._values.keys()[0];this._values.delete(b)}this._values.set(c,y)}}class E{constructor(c=20){this._maxEntries=c;this._cache=new O(this._maxEntries);this._layerMetadata=new O(this._maxEntries);this._serviceMetadata=new O(this._maxEntries);this._portalItems=new O(this._maxEntries)}clear(){this._cache=new O(this._maxEntries);this._layerMetadata=new O(this._maxEntries);this._serviceMetadata=new O(this._maxEntries); this._portalItems=new O(this._maxEntries)}addToCache(c,y){this._cache.put(c,y)}removeFromCache(c){this._cache.delete(c)}getFromCache(c){return this._cache.get(c)}getCachedLayerMetadata(c){return this._layerMetadata.get(c)}setCachedLayerMetadata(c,y){this._layerMetadata.put(c,y)}removeCachedLayerMetadata(c,y){this._layerMetadata.get(c)===y&&this._layerMetadata.delete(c)}getCachedServiceMetadata(c){return this._serviceMetadata.get(c)}setCachedServiceMetadata(c,y){this._serviceMetadata.put(c,y)}removeCachedServiceMetadata(c, y){this._serviceMetadata.get(c)===y&&this._serviceMetadata.delete(c)}getCachedPortalItem(c,y){return this._portalItems.get(`${y}:${c}`)}setCachedPortalItem(c,y,b){this._portalItems.put(`${y}:${c}`,b)}removeCachedPortalItem(c,y,b){c=`${y}:${c}`;this._portalItems.get(c)===b&&this._portalItems.delete(c)}}return E})},"esri/arcade/arcadeRuntime":function(){define("exports ./ArcadeModule ./ArcadeModuleLoader ./containerUtils ./Dictionary ./executionError ./Feature ./FunctionWrapper ../chunks/languageUtils ./treeAnalysis ../chunks/array ./functions/date ./functions/geometry ./functions/geomsync ./functions/maths ./functions/stats ./functions/string ../geometry/Geometry ../geometry/SpatialReference".split(" "), function(D,O,E,c,y,b,q,F,d,k,w,C,M,A,f,m,r,n,g){function l(I,J){const u=[];for(let P=0;Ph&&(h=u.length+h);if(0>h||h>u.length)throw new b.ArcadeExecutionError(I, b.ExecutionErrorCodes.OutOfBounds,J);if(h===u.length&&"\x3d"!==J.operator)throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.OutOfBounds,J);u[h]=B(ba,J.operator,u[h],J,I)}else throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.ArrayAccessorMustBeNumber,J);else if(u instanceof y){if(!1===d.isString(h))throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.KeyAccessorMustBeString,J);if(!0===u.hasField(h))u.setField(h,B(ba,J.operator,u.field(h),J,I));else{if("\x3d"!==J.operator)throw new b.ArcadeExecutionError(I, b.ExecutionErrorCodes.FieldNotFound,J,{key:h});u.setField(h,B(ba,J.operator,null,J,I))}}else if(d.isFeature(u)){if(!1===d.isString(h))throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.KeyAccessorMustBeString,J);if(!0===u.hasField(h))u.setField(h,B(ba,J.operator,u.field(h),J,I));else{if("\x3d"!==J.operator)throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.FieldNotFound,J,{key:h});u.setField(h,B(ba,J.operator,null,J,I))}}else{if(d.isImmutableArray(u))throw new b.ArcadeExecutionError(I, b.ExecutionErrorCodes.Immutable,J);if(u instanceof pa){if(!1===d.isString(h))throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.ModuleAccessorMustBeString,J);if(!0===u.hasGlobal(h))u.setGlobal(h,B(ba,J.operator,u.global(h),J,I));else throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.ModuleExportNotFound,J);}else throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.InvalidIdentifier,J);}var p=d.voidOperation}else{u=J.left.name.toLowerCase();var L=G(I,J.right);if(null!=I.localScope&& void 0!==I.localScope[u])I.localScope[u]={value:B(L,J.operator,I.localScope[u].value,J,I),valueset:!0,node:J.right},p=d.voidOperation;else if(void 0!==I.globalScope[u])I.globalScope[u]={value:B(L,J.operator,I.globalScope[u].value,J,I),valueset:!0,node:J.right},p=d.voidOperation;else throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.InvalidIdentifier,J);}return p;case "UpdateExpression":{let ba;u=null;h="";if("MemberExpression"===J.argument.type){u=G(I,J.argument.object);!0===J.argument.computed? h=G(I,J.argument.property):"Identifier"===J.argument.property.type&&(h=J.argument.property.name);if(d.isArray(u))if(d.isNumber(h)){0>h&&(h=u.length+h);if(0>h||h>=u.length)throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.OutOfBounds,J);ba=d.toNumber(u[h]);u[h]="++"===J.operator?ba+1:ba-1}else throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.ArrayAccessorMustBeNumber,J);else if(u instanceof y){if(!1===d.isString(h))throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.KeyAccessorMustBeString, J);if(!0===u.hasField(h))ba=d.toNumber(u.field(h)),u.setField(h,"++"===J.operator?ba+1:ba-1);else throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.FieldNotFound,J);}else if(d.isFeature(u)){if(!1===d.isString(h))throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.KeyAccessorMustBeString,J);if(!0===u.hasField(h))ba=d.toNumber(u.field(h)),u.setField(h,"++"===J.operator?ba+1:ba-1);else throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.FieldNotFound,J);}else{if(d.isImmutableArray(u))throw new b.ArcadeExecutionError(I, b.ExecutionErrorCodes.Immutable,J);if(u instanceof pa){if(!1===d.isString(h))throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.ModuleAccessorMustBeString,J);if(!0===u.hasGlobal(h))ba=d.toNumber(u.global(h)),u.setGlobal(h,"++"===J.operator?ba+1:ba-1);else throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.ModuleExportNotFound,J);}else throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.InvalidParameter,J);}var Q=!1===J.prefix?ba:"++"===J.operator?ba+1:ba-1}else{u="Identifier"===J.argument.type? J.argument.name.toLowerCase():"";if(!u)throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.InvalidIdentifier,J);if(null!=I.localScope&&void 0!==I.localScope[u])ba=d.toNumber(I.localScope[u].value),I.localScope[u]={value:"++"===J.operator?ba+1:ba-1,valueset:!0,node:J},Q=!1===J.prefix?ba:"++"===J.operator?ba+1:ba-1;else if(void 0!==I.globalScope[u])ba=d.toNumber(I.globalScope[u].value),I.globalScope[u]={value:"++"===J.operator?ba+1:ba-1,valueset:!0,node:J},Q=!1===J.prefix?ba:"++"===J.operator? ba+1:ba-1;else throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.InvalidIdentifier,J);}}return Q;case "BreakStatement":return d.breakResult;case "ContinueStatement":return d.continueResult;case "TemplateElement":return J.value?J.value.cooked:"";case "TemplateLiteral":L="";Q=0;for(const ba of J.quasis)if(L+=ba.value?ba.value.cooked:"",!1===ba.tail){if(J.expressions[Q]){var Y=d;h=Y.toString;var aa=G(I,J.expressions[Q]),ka=I;p=J;if(d.isFunctionParameter(aa))throw new b.ArcadeExecutionError(ka, b.ExecutionErrorCodes.NoFunctionInTemplateLiteral,p);u=h.call(Y,aa)}else u="";L+=u;Q++}return L;case "ForStatement":null!==J.init&&G(I,J.init);ka={testResult:!0,lastAction:d.voidOperation};do b:{u=I;h=J;aa=ka;if(null!==h.test){aa.testResult=G(u,h.test);if(!1===aa.testResult)break b;if(!0!==aa.testResult)throw new b.ArcadeExecutionError(u,b.ExecutionErrorCodes.BooleanConditionRequired,h);}aa.lastAction=G(u,h.body);aa.lastAction===d.breakResult?aa.testResult=!1:aa.lastAction instanceof d.returnResult? aa.testResult=!1:null!==h.update&&G(u,h.update)}while(!0===ka.testResult);Y=ka.lastAction instanceof d.returnResult?ka.lastAction:d.voidOperation;return Y;case "ForInStatement":return a(I,J);case "WhileStatement":u=!0;var fa=d.voidOperation;u=G(I,J.test);if(!1===u)var ja=d.voidOperation;else{if(!0!==u)throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.BooleanConditionRequired,J);for(;!0===u;){fa=G(I,J.body);if(fa===d.breakResult)break;if(fa instanceof d.returnResult)break;u=G(I,J.test);if(!0!== u&&!1!==u)throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.BooleanConditionRequired,J);}ja=fa instanceof d.returnResult?fa:d.voidOperation}return ja;case "Identifier":return t(I,J);case "MemberExpression":return x(I,J);case "Literal":return J.value;case "CallExpression":a:try{if("MemberExpression"===J.callee.type){const ba=G(I,J.callee.object);if(!(ba instanceof pa))throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.FunctionNotFound,J);const oa=!1===J.callee.computed?J.callee.property.name: G(I,J.callee.property);if(!ba.hasGlobal(oa))throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.FunctionNotFound,J);const va=ba.global(oa);if(!d.isFunctionParameter(va))throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.CallNonFunction,J);var ia=va.call(I,J)}else{if("Identifier"!==J.callee.type)throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.FunctionNotFound,J);if(null!=I.localScope&&void 0!==I.localScope[J.callee.name.toLowerCase()]){const ba=I.localScope[J.callee.name.toLowerCase()]; if(d.isFunctionParameter(ba.value)){ia=ba.value.call(I,J);break a}throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.CallNonFunction,J);}if(void 0!==I.globalScope[J.callee.name.toLowerCase()]){const ba=I.globalScope[J.callee.name.toLowerCase()];if(d.isFunctionParameter(ba.value)){ia=ba.value.call(I,J);break a}throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.CallNonFunction,J);}throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.FunctionNotFound,J);}}catch(ba){throw ba;}return ia; case "UnaryExpression":return N(I,J);case "BinaryExpression":return e(I,J);case "LogicalExpression":return Z(I,J);case "ArrayExpression":try{u=[];for(h=0;hP&&(P=u.length+P);if(P>=u.length||0>P)throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.OutOfBounds,J);return u[P]}throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.InvalidMemberAccessKey,J);}if(d.isString(u)){if(d.isNumber(P)&&isFinite(P)&&Math.floor(P)===P){0>P&&(P=u.length+P);if(P>=u.length||0>P)throw new b.ArcadeExecutionError(I, b.ExecutionErrorCodes.OutOfBounds,J);return u[P]}throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.InvalidMemberAccessKey,J);}if(d.isImmutableArray(u)&&d.isNumber(P)&&isFinite(P)&&Math.floor(P)===P){0>P&&(P=u.length()+P);if(P>=u.length()||0>P)throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.OutOfBounds,J);return u.get(P)}throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.InvalidMemberAccessKey,J);}catch(u){throw u;}}function N(I,J){try{const u=G(I,J.argument);if(d.isBoolean(u)){if("!"=== J.operator)return!u;if("-"===J.operator)return-1*d.toNumber(u);if("+"===J.operator)return 1*d.toNumber(u);if("~"===J.operator)return~d.toNumber(u);throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.UnsupportedUnaryOperator,J);}if("~"===J.operator)return~d.toNumber(u);if("-"===J.operator)return-1*d.toNumber(u);if("+"===J.operator)return 1*d.toNumber(u);throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.UnsupportedUnaryOperator,J);}catch(u){throw u;}}function e(I,J){try{const u=[G(I,J.left), G(I,J.right)],P=u[0],S=u[1];switch(J.operator){case "|":case "\x3c\x3c":case "\x3e\x3e":case "\x3e\x3e\x3e":case "^":case "\x26":return d.binaryOperator(d.toNumber(P),d.toNumber(S),J.operator);case "\x3d\x3d":return d.equalityTest(P,S);case "!\x3d":return!d.equalityTest(P,S);case "\x3c":return d.greaterThanLessThan(P,S,J.operator);case "\x3e":return d.greaterThanLessThan(P,S,J.operator);case "\x3c\x3d":return d.greaterThanLessThan(P,S,J.operator);case "\x3e\x3d":return d.greaterThanLessThan(P,S,J.operator); case "+":return d.isString(P)||d.isString(S)?d.toString(P)+d.toString(S):d.toNumber(P)+d.toNumber(S);case "-":return d.toNumber(P)-d.toNumber(S);case "*":return d.toNumber(P)*d.toNumber(S);case "/":return d.toNumber(P)/d.toNumber(S);case "%":return d.toNumber(P)%d.toNumber(S);default:throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.UnsupportedOperator,J);}}catch(u){throw u;}}function Z(I,J){try{const u=G(I,J.left);if(d.isBoolean(u))switch(J.operator){case "||":if(!0===u)return u;const P=G(I, J.right);if(d.isBoolean(P))return P;throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.LogicExpressionOrAnd,J);case "\x26\x26":if(!1===u)return u;const S=G(I,J.right);if(d.isBoolean(S))return S;throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.LogicExpressionOrAnd,J);default:throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.LogicExpressionOrAnd,J);}throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.LogicalExpressionOnlyBoolean,J);}catch(u){throw u;}}function t(I,J){let u; try{const P=J.name.toLowerCase();if(null!=I.localScope&&void 0!==I.localScope[P]){u=I.localScope[P];if(!0===u.valueset)return u.value;u.value=G(I,u.node);u.valueset=!0;return u.value}if(void 0!==I.globalScope[P]){u=I.globalScope[P];if(!0===u.valueset)return u.value;u.value=G(I,u.node);u.valueset=!0;return u.value}throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.InvalidIdentifier,J);}catch(P){throw P;}}function H(I,J,u,P){try{const S=J.arguments,V=G(I,S[u]);if(d.equalityTest(V,P))return G(I, S[u+1]);const ha=S.length-u;return 1===ha?G(I,S[u]):2===ha?null:3===ha?G(I,S[u+2]):H(I,J,u+2,P)}catch(S){throw S;}}function R(I,J,u,P){try{const S=J.arguments;if(!0===P)return G(I,S[u+1]);if(3===S.length-u)return G(I,S[u+2]);const V=G(I,S[u+2]);if(!1===d.isBoolean(V))throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.BooleanConditionRequired,S[u+2]);return R(I,J,u+2,V)}catch(S){throw S;}}function U(I,J,u,P){try{const S=I.body;if(u.length!==I.params.length)throw new b.ArcadeExecutionError(J, b.ExecutionErrorCodes.WrongNumberOfParameters,P);if(null!=J.localScope)for(let ha=0;ha {const u={spatialReference:this.context.spatialReference,console:this.context.console,services:this.context.services,timeZone:this.context.timeZone??null,lrucache:this.context.lrucache,exports:this.context.exports,libraryResolver:this.context.libraryResolver,interceptor:this.context.interceptor,localScope:{},depthCounter:{depth:I.depthCounter.depth+1},globalScope:this.context.globalScope};if(64{u={spatialReference:I.spatialReference,services:I.services,globalScope:I.globalScope,depthCounter:{depth:I.depthCounter.depth+1},libraryResolver:I.libraryResolver,exports:I.exports,timeZone:I.timeZone??null,console:I.console,lrucache:I.lrucache,interceptor:I.interceptor,localScope:{}};if(64{S={spatialReference:I.spatialReference,globalScope:u.globalScope,services:I.services,depthCounter:{depth:I.depthCounter.depth+1},libraryResolver:I.libraryResolver,exports:I.exports,console:I.console,timeZone:I.timeZone??null,lrucache:I.lrucache,interceptor:I.interceptor,localScope:{}};ha=ha.map(qa=>!d.isFunctionParameter(qa)||qa instanceof F.ScopeMarshalledFunction?qa:F.wrapModuleScopedResponse(qa,I,P));return F.wrapModuleScopedResponse(U(this.definition,S,ha,J),u,P)})}}class pa extends O.ArcadeModule{constructor(I){super(I)}global(I){I= this.executingContext.globalScope[I.toLowerCase()];I.valueset||(I.value=G(this.executingContext,I.node),I.valueset=!0);if(d.isFunctionParameter(I.value)&&!(I.value instanceof F.ScopeMarshalledFunction)){const J=new F.ScopeMarshalledFunction;J.fn=I.value;J.parameterEvaluator=z;J.context=this.executingContext;I.value=J}return I.value}setGlobal(I,J){if(d.isFunctionParameter(J))throw new b.ArcadeExecutionError(null,b.ExecutionErrorCodes.AssignModuleFunction,null);this.executingContext.globalScope[I.toLowerCase()]= {value:J,valueset:!0,node:null}}hasGlobal(I){void 0===this.executingContext.exports[I]&&(I=I.toLowerCase());return void 0!==this.executingContext.exports[I]?!0:!1}loadModule(I){let J=I.spatialReference;if(null===J||void 0===J)J=new g({wkid:102100});this.moduleScope=X({},I.customfunctions,I.timeZone);this.executingContext={spatialReference:J,globalScope:this.moduleScope,localScope:null,libraryResolver:new E.ArcadeModuleLoader(I.libraryResolver._moduleSingletons,this.source.syntax.loadedModules),exports:{}, services:I.services,console:I.console??W,timeZone:I.timeZone??null,lrucache:I.lrucache,interceptor:I.interceptor,depthCounter:{depth:1}};G(this.executingContext,this.source.syntax)}}const xa={};C.registerFunctions(xa,z);r.registerFunctions(xa,z);f.registerFunctions(xa,z);M.registerFunctions(xa,z);m.registerFunctions(xa,z);A.registerFunctions(xa,z);xa.iif=function(I,J){try{const u=J.arguments;d.pcCheck(null===u?[]:u,3,3,I,J);const P=G(I,u[0]);if(!1===d.isBoolean(P))throw new b.ArcadeExecutionError(I, b.ExecutionErrorCodes.BooleanConditionRequired,J);return!0===P?G(I,u[1]):G(I,u[2])}catch(u){throw u;}};xa.defaultvalue=function(I,J){try{const u=J.arguments;d.pcCheck(null===u?[]:u,2,3,I,J);const P=G(I,u[0]);if(3===u.length){const S=G(I,u[1]),V=c.getNestedOptionalValue(P,S);return null!=V&&""!==V?V:G(I,u[2])}return null===P||""===P||void 0===P?G(I,u[1]):P}catch(u){throw u;}};xa.decode=function(I,J){try{const u=J.arguments;if(2>u.length)throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.WrongNumberOfParameters, J);if(2===u.length)return G(I,u[1]);if(0===(u.length-1)%2)throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.WrongNumberOfParameters,J);const P=G(I,u[0]);return H(I,J,1,P)}catch(u){throw u;}};xa.when=function(I,J){try{const u=J.arguments;if(3>u.length)throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.WrongNumberOfParameters,J);if(0===u.length%2)throw new b.ArcadeExecutionError(I,b.ExecutionErrorCodes.WrongNumberOfParameters,J);const P=G(I,u[0]);if(!1===d.isBoolean(P))throw new b.ArcadeExecutionError(I, b.ExecutionErrorCodes.BooleanConditionRequired,u[0]);return R(I,J,0,P)}catch(u){throw u;}};for(const I in xa)xa[I]={value:new F.NativeFunction(xa[I]),valueset:!0,node:null};const sa=function(){};sa.prototype=xa;sa.prototype.infinity={value:Number.POSITIVE_INFINITY,valueset:!0,node:null};sa.prototype.pi={value:Math.PI,valueset:!0,node:null};O={fixSpatialReference:d.fixSpatialReference,parseArguments:l,standardFunction:z};ca([w.ArrayFunctions]);D.executeScript=function(I,J){let u=J.spatialReference; if(null===u||void 0===u)u=new g({wkid:102100});let P=null;I.usesModules&&(P=new E.ArcadeModuleLoader(new Map,I.loadedModules));const S=X(J.vars,J.customfunctions,J.timeZone);J={spatialReference:u,globalScope:S,localScope:null,services:J.services??null,exports:{},libraryResolver:P,console:J.console??W,timeZone:J.timeZone??null,lrucache:J.lrucache,interceptor:J.interceptor,depthCounter:{depth:1}};I=G(J,I);I instanceof d.returnResult&&(I=I.value);I instanceof d.implicitResult&&(I=I.value);I===d.voidOperation&& (I=null);if(I===d.breakResult)throw new b.ArcadeExecutionError(J,b.ExecutionErrorCodes.IllegalResult,null);if(I===d.continueResult)throw new b.ArcadeExecutionError(J,b.ExecutionErrorCodes.IllegalResult,null);if(d.isFunctionParameter(I))throw new b.ArcadeExecutionError(J,b.ExecutionErrorCodes.IllegalResult,null);return I};D.extend=ca;D.functionHelper=O;Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})})},"*noref":1}}); define("exports ../geometry ../chunks/arcade ../arcade/Dictionary ../arcade/Feature ../chunks/languageUtils ../core/lang ../core/sql/DateOnly ../core/sql/TimeOnly ../geometry/Point ../geometry/Polygon ../geometry/Polyline ../geometry/Multipoint ../geometry/Extent".split(" "),function(D,O,E,c,y,b,q,F,d,k,w,C,M,A){function f(a){return a.replaceAll(/[|\\{}()[\]^$+*?.]/g,"\\$\x26")}function m(a){if(!a)return null;try{return E.parseScript(a)}catch(B){}return null}function r(a,B){if(!a)return!1;if("string"=== typeof a)return B(a);if("simple"===a.type||"class-breaks"===a.type||"unique-value"===a.type||"dot-density"===a.type||"dictionary"===a.type||"pie-chart"===a.type){if("dot-density"===a.type){var x=a.attributes?.some(N=>B(N.valueExpression));if(x)return x}x=a.visualVariables;x=!!x&&x.some(N=>{let e=B(N.valueExpression);"size"===N.type&&(l(N.minSize)&&(e=e||B(N.minSize.valueExpression)),l(N.maxSize)&&(e=e||B(N.maxSize.valueExpression)));return e});return"valueExpression"in a&&B(a.valueExpression)?!0: x}return"esri.layers.support.LabelClass"===a.declaredClass?(a=a.labelExpressionInfo?.expression,!(!a||!B(a))||!1):"esri.PopupTemplate"===a.declaredClass?!!a.expressionInfos&&a.expressionInfos.some(N=>B(N.expression))||Array.isArray(a.content)&&a.content.some(N=>"expression"===N.type&&B(N.expressionInfo?.expression)):!1}function n(a){a=m(a);return!!a&&E.scriptTouchesGeometry(a)}function g(a){a=m(a);return!!a&&E.scriptUsesGeometryEngine(a)}function l(a){return a&&"esri.renderers.visualVariables.SizeVariable"=== a.declaredClass}const z=/^\$(feature|aggregatedFeatures)\./i,G={vars:{$feature:"any",$view:"any"},spatialReference:null};D.arcade=E.arcade;D.Dictionary=c;D.arcadeFeature=y;D.convertFeatureLayerToFeatureSet=function({layer:a,spatialReference:B,outFields:x,returnGeometry:N,lrucache:e,interceptor:Z}){if(null===a)return null;const t=E.featureSetUtils();return t?t.constructFeatureSet(a,B,x,N??!0,e,Z):null};D.convertJsonToArcade=function(a,B){return c.convertJsonToArcade(a,B)};D.convertMapToFeatureSetCollection= function(a){if(null===a?.map)return null;const B=E.featureSetUtils();return B?B.createFeatureSetCollectionFromMap(a.map,a.spatialReference,a.lrucache,a.interceptor):null};D.convertServiceUrlToWorkspace=function({url:a,spatialReference:B,lrucache:x,interceptor:N}){const e=E.featureSetUtils();return e?e.createFeatureSetCollectionFromService(a,B,x,N):null};D.createExecContext=function(a,B,x){return{vars:{$feature:null==a?new y:y.createFromGraphic(a,x),$view:B?.view},spatialReference:B?.sr,timeZone:x?? null}};D.createFeature=function(a,B,x){return y.createFromGraphicLikeObject(B,a,x,null)};D.createFunction=function(a,B){a="string"===typeof a?m(a):a;if(!a)return null;try{return B=B||q.clone(G),E.compileScript(a,B)}catch(x){}return null};D.createSyntaxTree=m;D.dependsOnView=function(a){return E.referencesMember(a,"$view")};D.enableFeatureSetOperations=function(){return E.enableFeatureSetSupport()};D.enableGeometryOperations=function(){return E.enableGeometrySupport()};D.evalSyntaxTree=function(a, B){let x;try{x=E.executeScript(a,B)}catch(N){x=null}return x};D.executeAsyncFunction=function(a,B){try{return a?a(B):Promise.resolve(null)}catch(x){return Promise.resolve(null)}};D.executeFunction=function(a,B){let x;try{x=a?a(B):null}catch(N){x=null}return x};D.extractFieldNames=function(a,B){if(!a)return[];a="string"===typeof a?m(a):a;if(!a)return[];let x=[];E.extractExpectedFieldLiterals(a).forEach(e=>{z.test(e)&&(e=e.replace(z,""),x.push(e))});const N=x.filter(e=>e.includes("*"));x=x.filter(e=> !N.includes(e));B&&N.forEach(e=>{const Z=new RegExp(`^${e.split(/\*+/).map(f).join(".*")}$`,"i");B.forEach(t=>Z.test(t)?x.push(t):null)});return[...(new Set(x.sort()))]};D.getArcadeType=function(a){return null==a?null:b.isArray(a)||b.isImmutableArray(a)?"array":b.isDate(a)?"date":b.isString(a)?"text":b.isBoolean(a)?"boolean":b.isNumber(a)?"number":a instanceof c?"dictionary":b.isFeature(a)?"feature":a instanceof k?"point":a instanceof w?"polygon":a instanceof C?"polyline":a instanceof M?"multipoint": a instanceof A?"extent":a instanceof F.DateOnly?"dateOnly":a instanceof d.TimeOnly?"time":b.isFeatureSet(a)?"featureSet":b.isFeatureSetCollection(a)?"featureSetCollection":null};D.getViewInfo=function(a){if(a&&(null!=a.spatialReference||null!=a.scale&&null!=a.viewingMode))return{view:a.viewingMode&&null!=a.scale?new c({viewingMode:a.viewingMode,scale:a.scale}):null,sr:a.spatialReference}};D.hasGeometryFunctions=function(a){return r(a,n)};D.hasGeometryOperations=function(a){return r(a,g)};D.hasVariable= function(a,B){return a?E.referencesMember(a,B):!1};D.loadScriptDependencies=function(a,B,x=[]){return E.loadScriptDependencies(a,B,x)};D.updateExecContext=function(a,B){null!=a.vars&&(a.vars.$feature=B)};Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})});