@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 5.75 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import{p as e,c as n,e as r,a as t,r as o,l as a,b as l,d as i,f as u,s,g as c}from"../chunks/arcade.js";export{h as arcade}from"../chunks/arcade.js";import{ArcadeDate as f}from"../arcade/ArcadeDate.js";import{toSymbolId as p}from"../arcade/arcadeEnvironment.js";import m from"../arcade/Dictionary.js";import d from"../arcade/Feature.js";import{j as y,e as v,k as x,m as g,l as j}from"../chunks/languageUtils.js";export{Voxel}from"../arcade/Voxel.js";import{clone as S}from"../core/lang.js";import{DateOnly as w}from"../core/sql/DateOnly.js";import{TimeOnly as $}from"../core/sql/TimeOnly.js";import b from"../geometry/Extent.js";import E from"../geometry/Multipoint.js";import A from"../geometry/Point.js";import F from"../geometry/Polygon.js";import P from"../geometry/Polyline.js";import{isArray as C,isString as _,isBoolean as D,isNumber as I}from"./guards.js";const M={vars:{$feature:"any",$view:"any"}};function R(e){return e.replaceAll(/[|\\{}()[\]^$+*?.]/g,"\\$&")}function T(e){return null==e?null:C(e)||y(e)?"array":v(e)?"date":_(e)?"text":D(e)?"boolean":I(e)?"number":e instanceof m?"dictionary":x(e)?"feature":e instanceof A?"point":e instanceof F?"polygon":e instanceof P?"polyline":e instanceof E?"multipoint":e instanceof b?"extent":e instanceof w?"dateOnly":e instanceof $?"time":g(e)?"featureSet":j(e)?"featureSetCollection":null}function k(n){if(!n)return null;try{return e(n)}catch(r){}return null}function z(e,r){const t="string"==typeof e?k(e):e;if(!t)return null;try{return r=r||S(M),n(t,r)}catch(o){}return null}function J(e,n,r){return{vars:{$feature:null==e?new d:d.createFromGraphic(e,r),$view:n?.view},spatialReference:n?.sr,timeZone:r??null}}function V(e,n,r){return d.createFromGraphicLikeObject(n,e,r,null)}function O(e,n){null!=e.vars&&(e.vars.$feature=n)}function Z(e,n){let t;try{t=r(e,n)}catch(o){t=null}return t}function q(e,n){let r;try{r=e?e(n):null}catch(t){r=null}return r}function G(e,n){try{return e?e(n):Promise.resolve(null)}catch(r){return Promise.resolve(null)}}const L=new Set(["$feature","$aggregatedFeatures","$voxel"].map((e=>p(e))));function N(e,n){if(!e)return[];const r="string"==typeof e?k(e):e;if(!r)return[];const o=t(r).filter((({varId:e})=>L.has(e))).map((({memberNamePattern:e})=>e)).flatMap((e=>{if(e.includes("*")){if(null==n)return[];const r=new RegExp(`^${e.split(/\*+/).map(R).join(".*")}$`,"i");return n.filter((e=>r.test(e)))}return e.toLowerCase()}));return[...new Set(o.sort())]}function U(e){return o(e,"$view")}function B(e,n){return!!e&&o(e,n)}function H(e){if(!e||null==e.spatialReference&&(null==e.scale||null==e.viewingMode))return;let n,r;const{timeProperties:t,timeZone:o}=e;if(null!=t){const{currentStart:e,currentEnd:a}=t;null!=o?(n=null!=e?f.dateJSAndZoneToArcadeDate(e,o):null,r=null!=a?f.dateJSAndZoneToArcadeDate(a,o):null):(n=null!=e?f.dateJSToArcadeDate(e):null,r=null!=a?f.dateJSToArcadeDate(a):null)}return{view:e.viewingMode&&null!=e.scale?new m({__proto__:null,viewingMode:e.viewingMode,scale:e.scale,timeProperties:null!=n||null!=r?new m({__proto__:null,currentStart:n,currentEnd:r,startIncluded:!0,endIncluded:!0}):null}):null,sr:e.spatialReference}}function K({url:e,spatialReference:n,lrucache:r,interceptor:t}){const o=u();return o?o.createFeatureSetCollectionFromService(e,n,r,t):null}function Q({layer:e,spatialReference:n,outFields:r,returnGeometry:t,lrucache:o,interceptor:a}){if(null===e)return null;const l=u();return l?l.constructFeatureSet(e,n,r,t??!0,o,a):null}function W(e){if(null===e?.map)return null;const n=u();return n?n.createFeatureSetCollectionFromMap(e.map,e.spatialReference,e.lrucache,e.interceptor):null}function X(e,n){return m.convertJsonToArcade(e,n)}function Y(e,n,r=[]){return a(e,n,r)}function ee(){return l()}function ne(){return i()}function re(e){return"type"in e&&("class-breaks"===e.type||"dictionary"===e.type||"dot-density"===e.type||"pie-chart"===e.type||"simple"===e.type||"unique-value"===e.type)}function te(e){return"esri.layers.support.LabelClass"===e.declaredClass}function oe(e){return"esri.PopupTemplate"===e.declaredClass}function ae(e,n){if(!e)return!1;if("string"==typeof e)return n(e);const r=e;if(re(r)){if("dot-density"===r.type){const e=r.attributes?.some((e=>n(e.valueExpression)));if(e)return e}const e=r.visualVariables,t=!!e&&e.some((e=>{let r=n(e.valueExpression);return"size"===e.type&&(ce(e.minSize)&&(r=r||n(e.minSize.valueExpression)),ce(e.maxSize)&&(r=r||n(e.maxSize.valueExpression))),r}));return!(!("valueExpression"in r)||!n(r.valueExpression))||t}if(te(r)){const e=r.labelExpressionInfo?.expression;return!(!e||!n(e))||!1}return!!oe(r)&&(!!r.expressionInfos&&r.expressionInfos.some((e=>n(e.expression)))||Array.isArray(r.content)&&r.content.some((e=>"expression"===e.type&&n(e.expressionInfo?.expression))))}function le(e){const n=k(e);return!!n&&s(n)}function ie(e){return ae(e,le)}function ue(e){const n=k(e);return!!n&&c(n)}function se(e){return ae(e,ue)}function ce(e){return e&&"esri.renderers.visualVariables.SizeVariable"===e.declaredClass}export{m as Dictionary,d as arcadeFeature,Q as convertFeatureLayerToFeatureSet,X as convertJsonToArcade,W as convertMapToFeatureSetCollection,K as convertServiceUrlToWorkspace,J as createExecContext,V as createFeature,z as createFunction,k as createSyntaxTree,U as dependsOnView,ne as enableFeatureSetOperations,ee as enableGeometryOperations,Z as evalSyntaxTree,G as executeAsyncFunction,q as executeFunction,N as extractFieldNames,T as getArcadeType,H as getViewInfo,ie as hasGeometryFunctions,se as hasGeometryOperations,B as hasVariable,Y as loadScriptDependencies,O as updateExecContext};