UNPKG

@arcgis/coding-components

Version:
2 lines 4.26 kB
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */ export default $arcgis.t(([{createArcadeDebugExecutor:C,createArcadeExecutor:b},w])=>{var _="https://developers.arcgis.com/arcade/",q=100,D=100;function R(e){return!!e&&typeof e=="object"&&"declaredRootClass"in e&&typeof e.declaredRootClass=="string"&&e.declaredRootClass==="esri.arcade.featureset.support.FeatureSet"}function j(e){return!!e&&typeof e=="object"&&"arcadeDeclaredClass"in e&&typeof e.arcadeDeclaredClass=="string"&&e.arcadeDeclaredClass==="esri.arcade.Feature"}function A(e){return!!e&&typeof e=="object"&&"declaredClass"in e&&typeof e.declaredClass=="string"&&e.declaredClass==="esri.arcade.Dictionary"}function h(e){return!!e&&typeof e=="object"&&"declaredClass"in e&&typeof e.declaredClass=="string"&&e.declaredClass.startsWith("esri.geometry.")}function x(e){return!!e&&typeof e=="object"&&"declaredClass"in e&&typeof e.declaredClass=="string"&&e.declaredClass.startsWith("esri.rest.knowledgeGraph.KnowledgeGraph")}function k(e){return!!e&&typeof e=="object"&&"declaredClass"in e&&typeof e.declaredClass=="string"&&e.declaredClass==="esri.arcade.Portal"}function S(e){return!!e&&typeof e=="object"&&"declaredClass"in e&&typeof e.declaredClass=="string"&&e.declaredClass==="esri.arcade.Attachment"}function F(e){return!!e&&typeof e=="object"&&"declaredRootClass"in e&&typeof e.declaredRootClass=="string"&&e.declaredRootClass==="esri.arcade.arcadedate"}function T(e){return!!e&&typeof e=="object"&&"declaredRootClass"in e&&typeof e.declaredRootClass=="string"&&e.declaredRootClass==="esri.core.sql.dateonly"}function Z(e){return!!e&&typeof e=="object"&&"declaredRootClass"in e&&typeof e.declaredRootClass=="string"&&e.declaredRootClass==="esri.core.sql.timeonly"}function E(e){return!!e&&typeof e=="object"&&"arcadeDeclaredClass"in e&&typeof e.arcadeDeclaredClass=="string"&&e.arcadeDeclaredClass==="esri.arcade.Pixel"}function P(e){return!!e&&typeof e=="object"&&"length"in e&&typeof e.length=="function"&&"get"in e&&typeof e.get=="function"&&"toArray"in e&&typeof e.toArray=="function"&&"_elements"in e&&Array.isArray(e._elements)}function G(e){return e==null?{type:"null"}:Array.isArray(e)?{type:"array",value:e}:P(e)?{type:"array",value:e.toArray()}:e instanceof Date?{type:"date",value:e}:typeof e=="string"?{type:"text",value:e}:typeof e=="number"?{type:"number",value:e}:typeof e=="boolean"?{type:"boolean",value:e}:typeof e!="object"?{type:"unknown"}:F(e)?{type:"date",value:e}:T(e)?{type:"dateOnly",value:e}:Z(e)?{type:"time",value:e}:S(e)?{type:"attachment",value:e}:k(e)?{type:"portal",value:e}:R(e)?{type:"featureSet",value:e,features:[],iterator:null}:j(e)?{type:"feature",value:e}:E(e)?{type:"pixel",value:e}:A(e)?{type:"dictionary",value:e}:h(e)?{type:"geometry",value:e}:x(e)?{type:"knowledgeGraph",value:e}:{type:"unknown"}}function B(e,a="en"){return e.value instanceof Date?new Intl.DateTimeFormat(a,{dateStyle:"medium",timeStyle:"long"}).format(e.value):e.value.toDateTime().setLocale(a).toFormat(e.value.isUnknownTimeZone?"FF":"FF ZZZZZ")}function K(e){return e.value.toString()}function L(e){return e.value.toString()}async function I(e,a="system"){let t=G(e);return t.type!=="featureSet"||(await t.value.load(),t.iterator=t.value.iterator({aborted:!1}),t.features=await t.iterator.nextBatchAsArcadeFeatures(D,a)??[]),t}function V(e){return"compilationTime"in e||"executionTime"in e||"timeStamp"in e}async function W(e,a,t,r={}){let l=new Date,i=r.mode??"run";r.console??=()=>{};try{let o=performance.now(),n=a??"",c={variables:e?.variables??[]},y=i==="debug"?await C(n,c,{services:{debugger:r.onDebugPause?{pause:r.onDebugPause}:void 0},breakpoints:r.breakpoints}):await b(n,c),u=performance.now(),{profileVariableInstances:f,spatialReference:m,timeZone:d,services:g}=t,v={spatialReference:new w({wkid:m?.wkid??3857}),timeZone:d,console:r.console,services:g,rawOutput:!0},p=await y.executeAsync(f,v);if(i==="debug")return p;let s=await I(p,d);return s.timeStamp=l,s.compilationTime=u-o,s.executionTime=performance.now()-u,s}catch(o){let n="Unknown Error";return o instanceof Error&&(n=o.message),{type:"error",value:n,error:o,timeStamp:l,compilationTime:0,executionTime:0}}}return{a:_,b:q,c:D,d:G,e:B,f:K,g:L,h:V,i:W}},"arcade","geometry/SpatialReference")