@arcgis/core 4.34.0-next.102 → 4.34.0-next.103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/analysis/VolumeMeasurement/volumeMeasurementConfiguration.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/087973e7c4fea5fcfa5e.js +1 -0
  4. package/assets/esri/core/workers/chunks/374831c7e3d88bc473b8.js +1 -0
  5. package/assets/esri/core/workers/chunks/9afdc3ac5cf99cf431e4.js +1 -0
  6. package/assets/esri/themes/base/widgets/_UtilityNetworkTrace.scss +14 -4
  7. package/assets/esri/themes/dark/main.css +1 -1
  8. package/assets/esri/themes/light/main.css +1 -1
  9. package/assets/esri/themes/light/view.css +1 -1
  10. package/config.js +1 -1
  11. package/editing/sharedTemplates/executor/support/createFeatureServiceEdit.js +1 -1
  12. package/interfaces.d.ts +18 -2
  13. package/kernel.js +1 -1
  14. package/layers/support/fieldUtils.js +1 -1
  15. package/package.json +3 -3
  16. package/support/revision.js +1 -1
  17. package/symbols/cim/effects/EffectTaperedPolygon.js +1 -1
  18. package/undoredo/support/Services.js +1 -1
  19. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  20. package/views/3d/layers/FlowSubView3D.js +1 -1
  21. package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
  22. package/views/3d/layers/i3s/I3SOverrides.js +1 -1
  23. package/views/3d/layers/support/ImageHighlightHelper3D.js +1 -1
  24. package/views/3d/support/flow/FlowSubViewExtent3D.js +1 -1
  25. package/views/3d/support/flow/StreamlineResources3DOverlay.js +1 -1
  26. package/views/3d/support/flow/StreamlineResources3DShape.js +1 -1
  27. package/views/3d/terrain/OverlayRenderer.js +1 -1
  28. package/views/analysis/ElevationProfile/constants.js +1 -1
  29. package/widgets/Attachments/AttachmentsViewModel.js +1 -1
  30. package/widgets/FeatureTable/Grid/GridViewModel.js +1 -1
  31. package/widgets/Search/LayerSearchSource.js +1 -1
  32. package/widgets/UtilityNetworkTrace.js +1 -1
  33. package/assets/esri/core/workers/chunks/0366b78b0ccf4ed5f6ac.js +0 -1
  34. package/assets/esri/core/workers/chunks/59e916249db1355bb139.js +0 -1
  35. package/assets/esri/core/workers/chunks/ca4f41c5c6dda7c1b88d.js +0 -1
package/config.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="4.34.0-next.102";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
5
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="4.34.0-next.103";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Graphic.js";import t from"../../../../core/Error.js";import{generateBracedUUID as a}from"../../../../core/uuid.js";import{isLoadedSharedTemplate as s}from"../../../templateUtils.js";import{isRadial as r}from"./executorUtils.js";import i from"../../../../geometry/Multipoint.js";import o from"../../../../geometry/Point.js";import n from"../../../../geometry/Polygon.js";import l from"../../../../geometry/Polyline.js";import{isSubtypeGroupLayer as h}from"../../../../layers/support/layerUtils.js";function p({edits:i,geometry:o,relationships:n,tag:h="",template:f}){if(r(o)){const e=o.geometry.clone();for(const t of e.paths){p({geometry:new l({spatialReference:e.spatialReference,paths:[t],hasZ:e.hasZ,hasM:e.hasM}),template:f,edits:i,relationships:n,tag:h})}return}const{definition:c,layer:m}=f;o=u(o,m);const d=new e({attributes:c.defaultValues?{...c.defaultValues}:{},geometry:o,sourceLayer:m});if(y(d,m),m.globalIdField&&(d.attributes[m.globalIdField]=a()),i.push({id:m.layerId,graphic:d,tag:h,layer:m}),0!==c.relationships.length)for(const r of c.relationships||[]){const o=r.template;if(null==r.relationshipMetadata||!s(o))throw new t("shared-template:missing-relationship-metadata-or-definition","Relationship part must have metadata and a fully loaded template with definition");const{layer:l}=o,h=new e({attributes:{...c.defaultValues},sourceLayer:l});y(h,l),l.globalIdField&&(h.attributes[l.globalIdField]=a()),i.push({graphic:h,id:l.layerId,tag:"",layer:l}),n.push({...r.relationshipMetadata,sourceGraphic:d,destinationGraphic:h})}}function u(e,t){if(!e)return null;if(e.hasZ===t.hasZ&&e.hasM===t.hasM)return e;switch(e.type){case"point":return new o({spatialReference:e.spatialReference,x:e.x,y:e.y,...t.hasZ?e.hasZ?{z:e.z}:{z:m(t)}:{},...t.hasM?e.hasM?{m:e.m}:{m:d(t)}:{}});case"polygon":return new n({spatialReference:e.spatialReference,rings:f(e.rings,t.hasZ,t.hasM,m(t),d(t),e.hasM?e.hasZ?3:2:-1,e.hasZ?2:-1),hasZ:t.hasZ,hasM:t.hasM});case"polyline":return new l({spatialReference:e.spatialReference,paths:f(e.paths,t.hasZ,t.hasM,m(t),d(t),e.hasM?e.hasZ?3:2:-1,e.hasZ?2:-1),hasZ:t.hasZ,hasM:t.hasM});case"multipoint":return new i({spatialReference:e.spatialReference,hasZ:t.hasZ,hasM:t.hasM,points:c(e.points,t.hasZ,t.hasM,m(t),d(t),e.hasM?e.hasZ?3:2:-1,e.hasZ?2:-1)});default:return e}}function f(e,t,a,s,r,i,o){const n=[];for(const l of e)n.push(c(l,t,a,s,r,i,o));return n}function c(e,t,a,s,r,i,o){const n=[];for(const l of e){const e=[l[0],l[1]];t&&(e[2]=o>-1?l[2]:s),a&&(e[t?3:2]=i>-1?l[i]:r),n.push(e)}return n}function m(e){return e.capabilities.editing?.zDefault??0}function d(e){return e.capabilities.editing.supportsUpdateWithoutM?void 0:0}function y(e,t){h(t)&&(e.sourceLayer=t.findSublayerForFeature(e))}export{p as createFeatureServiceEdit};
5
+ import e from"../../../../Graphic.js";import t from"../../../../core/Error.js";import{generateBracedUUID as a}from"../../../../core/uuid.js";import{isLoadedSharedTemplate as s}from"../../../templateUtils.js";import{isRadial as r}from"./executorUtils.js";import i from"../../../../geometry/Multipoint.js";import o from"../../../../geometry/Point.js";import n from"../../../../geometry/Polygon.js";import l from"../../../../geometry/Polyline.js";import{isSubtypeGroupLayer as h}from"../../../../layers/support/layerUtils.js";function p({edits:i,geometry:o,relationships:n,tag:h="",template:f}){if(r(o)){const e=o.geometry.clone();for(const t of e.paths){p({geometry:new l({spatialReference:e.spatialReference,paths:[t],hasZ:e.hasZ,hasM:e.hasM}),template:f,edits:i,relationships:n,tag:h})}return}const{definition:c,layer:m}=f;o=u(o,m);const d=new e({attributes:c.defaultValues?{...c.defaultValues}:{},geometry:o,sourceLayer:m});if(y(d,m),m.globalIdField&&(d.attributes[m.globalIdField]=a()),i.push({id:m.layerId,graphic:d,tag:h,layer:m}),0!==c.relationships.length)for(const r of c.relationships||[]){const o=r.template;if(null==r.relationshipMetadata||!s(o))throw new t("shared-template:missing-relationship-metadata-or-definition","Relationship part must have metadata and a fully loaded template with definition");const{layer:l}=o,h=new e({attributes:{...c.defaultValues},sourceLayer:l});y(h,l),l.globalIdField&&(h.attributes[l.globalIdField]=a()),i.push({graphic:h,id:l.layerId,tag:"",layer:l}),n.push({...r.relationshipMetadata,sourceGraphic:d,destinationGraphic:h})}}function u(e,t){if(!e)return null;if(e.hasZ===t.hasZ&&e.hasM===t.hasM)return e;switch(e.type){case"point":return new o({spatialReference:e.spatialReference,x:e.x,y:e.y,...t.hasZ?e.hasZ?{z:e.z}:{z:m(t)}:{},...t.hasM?e.hasM?{m:e.m}:{m:d(t)??void 0}:{}});case"polygon":return new n({spatialReference:e.spatialReference,rings:f(e.rings,t.hasZ,t.hasM,m(t),d(t),e.hasM?e.hasZ?3:2:-1,e.hasZ?2:-1),hasZ:t.hasZ,hasM:t.hasM});case"polyline":return new l({spatialReference:e.spatialReference,paths:f(e.paths,t.hasZ,t.hasM,m(t),d(t),e.hasM?e.hasZ?3:2:-1,e.hasZ?2:-1),hasZ:t.hasZ,hasM:t.hasM});case"multipoint":return new i({spatialReference:e.spatialReference,hasZ:t.hasZ,hasM:t.hasM,points:c(e.points,t.hasZ,t.hasM,m(t),d(t),e.hasM?e.hasZ?3:2:-1,e.hasZ?2:-1)});default:return e}}function f(e,t,a,s,r,i,o){const n=[];for(const l of e)n.push(c(l,t,a,s,r,i,o));return n}function c(e,t,a,s,r,i,o){const n=[];for(const l of e){const e=[l[0],l[1]];t&&(e[2]=o>-1?l[2]:s),a&&(e[t?3:2]=i>-1?l[i]:r),n.push(e)}return n}function m(e){return e.capabilities.editing?.zDefault??0}function d(e){return e.capabilities.editing.supportsUpdateWithoutM?void 0:0}function y(e,t){h(t)&&(e.sourceLayer=t.findSublayerForFeature(e))}export{p as createFeatureServiceEdit};
package/interfaces.d.ts CHANGED
@@ -50943,8 +50943,6 @@ declare namespace __esri {
50943
50943
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-networks-Network.html#ValidateTopologyProps Read more...}
50944
50944
  */
50945
50945
  export interface ValidateTopologyProps {
50946
- gdbVersion?: string;
50947
- sessionID?: string;
50948
50946
  validateArea: Extent;
50949
50947
  validationSet?: ValidationSetItemJSON[];
50950
50948
  validationType?: "normal" | "rebuild" | "force-rebuild";
@@ -51810,6 +51808,15 @@ declare namespace __esri {
51810
51808
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-networks-UtilityNetwork.html#queryAssociations Read more...}
51811
51809
  */
51812
51810
  queryAssociations(props: QueryAssociationsParameters, options?: UtilityNetworkQueryAssociationsOptions): Promise<Association[]>;
51811
+ /**
51812
+ * Whenever the network is edited or modified, the network and its features become out of date in the [network topology]( https://pro.arcgis.com/en/pro-app/latest/help/data/utility-network/about-network-topology.htm).
51813
+ *
51814
+ * @param parameters The parameters that are used to validate the network topology.
51815
+ * @param options The request options specified by the user in the data request. See {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#RequestOptions RequestOptions} for available properties.
51816
+ *
51817
+ * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-networks-UtilityNetwork.html#submitTopologyValidationJob Read more...}
51818
+ */
51819
+ submitTopologyValidationJob(parameters: ValidateTopologyProps, options?: RequestOptions): Promise<TopologyValidationJobInfo | nullish>;
51813
51820
  /**
51814
51821
  * The submitTraceJob method takes a set of parameters, executes the asynchronous trace on the backend, and returns trace results.
51815
51822
  *
@@ -51834,6 +51841,15 @@ declare namespace __esri {
51834
51841
  * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-networks-UtilityNetwork.html#trace Read more...}
51835
51842
  */
51836
51843
  trace(props: UtilityNetworkTraceProps): Promise<TraceResult>;
51844
+ /**
51845
+ * Whenever the network is edited or modified, the network and its features become out of date in the [network topology]( https://pro.arcgis.com/en/pro-app/latest/help/data/utility-network/about-network-topology.htm).
51846
+ *
51847
+ * @param parameters The parameters that are used to validate the network topology.
51848
+ * @param options The request options specified by the user in the data request. See {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#RequestOptions RequestOptions} for available properties.
51849
+ *
51850
+ * {@link https://developers.arcgis.com/javascript/latest/api-reference/esri-networks-UtilityNetwork.html#validateTopology Read more...}
51851
+ */
51852
+ validateTopology(parameters: ValidateTopologyProps, options?: RequestOptions): Promise<ValidateNetworkTopologyResult>;
51837
51853
  static fromJSON(json: any): UtilityNetwork;
51838
51854
  }
51839
51855
 
package/kernel.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="4.34";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="4.34.0-next.102",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
5
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="4.34";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="4.34.0-next.103",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../core/Error.js";import{getDeepValue as n,setDeepValue as i}from"../../core/object.js";import{union as t}from"../../core/SetUtils.js";import{parseWhereClause as r}from"../../core/sql.js";import{getDomainRange as l}from"./domainUtils.js";import{getFieldNameFromSimpleExpression as o}from"../../support/arcadeExpressionUtils.js";import{isStringOrNull as s,isString as a}from"../../support/guards.js";import{loadArcade as u}from"../../support/loadArcade.js";const f=/^([0-9_])/,d=/[^a-z0-9_\u0080-\uffff]+/gi;function c(e){if(null==e)return null;return e.trim().replaceAll(d,"_").replace(f,"F$1")||null}const p=["field","field2","field3","normalizationField","rotationInfo.field","proportionalSymbolInfo.field","proportionalSymbolInfo.normalizationField","colorInfo.field","colorInfo.normalizationField"],m=["field","normalizationField"];function y(e,n){if(null!=e&&null!=n)for(const i of Array.isArray(e)?e:[e])if(g(p,i,n),"visualVariables"in i&&i.visualVariables)for(const e of i.visualVariables)g(m,e,n)}function g(e,t,r){if(e)for(const l of e){const e=n(l,t),o=e&&"function"!=typeof e&&r.get(e);o&&i(l,o.name,t)}}function F(e,n){if(null!=e&&n?.fields?.length)if("startField"in e){const i=n.get(e.startField),t=n.get(e.endField);e.startField=i?.name??null,e.endField=t?.name??null}else{const i=n.get(e.startTimeField),t=n.get(e.endTimeField);e.startTimeField=i?.name??null,e.endTimeField=t?.name??null}}const I=new Set;function b(e,n){return e&&n?(I.clear(),w(I,e,n),Array.from(I).sort()):[]}function w(e,n,i){if(i)if(n?.fields?.length)if(i.includes("*"))for(const{name:t}of n.fields)e.add(t);else for(const t of i)x(e,n,t);else{if(i.includes("*"))return e.clear(),void e.add("*");for(const n of i)null!=n&&e.add(n)}}function x(e,n,i){if("string"==typeof i)if(n){const t=n.get(i);t&&e.add(t.name)}else e.add(i)}function T(e,n){return null==n||null==e?[]:n.includes("*")?(e.fields??[]).map(e=>e.name):n}function h(e,n,i=1){if(!n||!e)return[];if(n.includes("*"))return["*"];const t=b(e,n);return t.length/e.fields.length>=i?["*"]:t}async function v(e,n,i,t){if(!t)return;const r=o(t);if(r)x(e,n,r);else{const{arcadeUtils:r}=await u(),l=r.extractFieldNames(t,i?.partitions??n?.fields?.map(e=>e.name));for(const t of l)x(e,i?.index??n,t)}}async function S(n,i,t){if(t&&"1=1"!==t){const l=await r(t,i);if(!l.isStandardized)throw new e("fieldUtils:collectFilterFields","Where clause is not standardized",{where:t});w(n,i,l.fieldNames)}}function E({displayField:e,fields:n}){return e||(n?.length?$(n,"name-or-title")||$(n,"unique-identifier")||$(n,"type-or-category")||A(n):null)}function A(e){for(const n of e){if(!n?.name)continue;const e=n.name.toLowerCase();if(e.includes("name")||e.includes("title"))return n.name}return null}function $(e,n){for(const i of e)if(i?.valueType&&i.valueType===n)return i.name;return null}async function _(e){if(!e)return[];const n=new Set;return await N(n,e),Array.from(n).sort()}async function N(e,n){if(!n)return;const i=n.elevationInfo?.featureExpressionInfo;return i?i.collectRequiredFields(e,n.fieldsIndex):void 0}function L(e,n,i){i.onStatisticExpression?v(e,n,null,i.onStatisticExpression.expression):e.add(i.onStatisticField)}async function M(e,n,i){if(!n||!i||!("fields"in i))return;const t=[],r=i.popupTemplate;t.push(D(e,n,r)),i.fields&&t.push(...i.fields.map(async i=>L(e,n.fieldsIndex,i))),await Promise.all(t)}async function j(e,n){const{fieldsIndex:i,trackInfo:t}=n;if(!n||!t||!i)return;const r=[t.latestObservations.renderer?.collectRequiredFields(e,i),t.previousObservations.renderer?.collectRequiredFields(e,i),t.trackLines.renderer?.collectRequiredFields(e,i)];t.popupTemplate&&r.push(D(e,n,t.popupTemplate));for(const l of[t.latestObservations.labelingInfo,t.previousObservations.labelingInfo,t.trackLines.labelingInfo])if(l)for(const n of l)r.push(Y(e,i,n));await Promise.all(r)}async function D(e,n,i){const t=[];i?.expressionInfos&&t.push(...i.expressionInfos.map(i=>v(e,n.fieldsIndex,null,i.expression)));const r=i?.content;if(Array.isArray(r))for(const l of r)"expression"===l.type&&l.expressionInfo&&t.push(v(e,n.fieldsIndex,null,l.expressionInfo.expression));await Promise.all(t)}async function O(e,n,i){n&&(n.timeInfo&&i?.timeExtent&&w(e,n.fieldsIndex,[n.timeInfo.startField,n.timeInfo.endField]),n.floorInfo&&w(e,n.fieldsIndex,[n.floorInfo.floorField]),null!=i?.where&&await S(e,n.fieldsIndex,i.where))}async function R(e,n,i){n&&i&&await Promise.all(i.map(i=>V(e,n,i)))}async function V(e,n,i){n&&i&&(i.valueExpression?await v(e,n.fieldsIndex,null,i.valueExpression):i.field&&x(e,n.fieldsIndex,i.field))}async function k(e){if(!e)return[];const n="timeInfo"in e&&e.timeInfo;return n?b(e.fieldsIndex,[e.trackIdField,n.startField,n.endField]):[]}function C(e){return e?b(e.fieldsIndex,G(e)):[]}function U(e){if(!e)return[];const n=e.geometryFieldsInfo;return n?b(e.fieldsIndex,[n.shapeAreaField,n.shapeLengthField]):[]}async function q(e,n,i){if(!n||!i)return;const t=n.fieldsIndex;await Promise.all(i.filters.map(n=>S(e,t,n.where)))}const X=new Set(["oid","global-id","guid"]),z=new Set(["oid","global-id"]),P=[/^fnode_$/i,/^tnode_$/i,/^lpoly_$/i,/^rpoly_$/i,/^poly_$/i,/^shape$/i,/^shape_$/i,/^subclass$/i,/^subclass_$/i,/^rings_ok$/i,/^rings_nok$/i,/objectid/i,/^perimeter_/i,/_perimeter$/i,/_i$/i];function B(e){const n=new Set;J(e).forEach(e=>n.add(e)),U(e).forEach(e=>n.add(e.toLowerCase()));const i=e&&"infoFor3D"in e?e.infoFor3D:void 0;return i&&(Object.values(i.assetMapFieldRoles).forEach(e=>n.add(e.toLowerCase())),Object.values(i.transformFieldRoles).forEach(e=>n.add(e.toLowerCase()))),Array.from(n)}function G(e){if(!e)return[];const n="editFieldsInfo"in e&&e.editFieldsInfo;if(!n)return[];const{creationDateField:i,creatorField:t,editDateField:r,editorField:l}=n;return[i,t,r,l].filter(Boolean)}function J(e){return G(e).map(e=>e.toLowerCase())}function W(e,n){return e.editable&&!X.has(e.type)&&!J(n).includes(e.name?.toLowerCase()??"")}function H(e,n){const i=e.name?.toLowerCase()??"";return!(null!=n?.objectIdField&&i===n.objectIdField.toLowerCase()||null!=n?.globalIdField&&i===n.globalIdField.toLowerCase()||B(n).includes(i)||z.has(e.type)||P.some(e=>e.test(i)))}async function K(e){if(!e)return[];const n=new Set;return await Q(n,e),Array.from(n).sort()}async function Q(e,n){const{labelingInfo:i,fieldsIndex:t}=n;i?.length&&await Promise.all(i.map(n=>Y(e,t,n)))}async function Y(e,n,i){if(!i)return;const t=i.getLabelExpression(),r=i.where;if("arcade"===t.type)await v(e,n,null,t.expression);else{const i=t.expression.match(/{[^}]*}/g);i&&i.forEach(i=>{x(e,n,i.slice(1,-1))})}await S(e,n,r)}function Z(e){const n=e.defaultValue;return void 0!==n&&le(e,n)?n:e.nullable?null:void 0}function ee(e){const n="string"==typeof e?{type:e}:e;return ge(n)?255:"esriFieldTypeDate"===n.type||"date"===n.type?8:void 0}function ne(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}function ie(e){return null===e||ne(e)}function te(e){return null===e||Number.isInteger(e)}function re(){return!0}function le(e,n){let i;switch(e.type){case"date":case"integer":case"long":case"small-integer":case"big-integer":case"esriFieldTypeDate":case"esriFieldTypeInteger":case"esriFieldTypeLong":case"esriFieldTypeSmallInteger":case"esriFieldTypeBigInteger":i=e.nullable?te:Number.isInteger;break;case"double":case"single":case"esriFieldTypeSingle":case"esriFieldTypeDouble":i=e.nullable?ie:ne;break;case"string":case"esriFieldTypeString":i=e.nullable?s:a;break;default:i=re}return 1===arguments.length?i:i(n)}const oe=["integer","small-integer","big-integer","long"],se=["single","double"],ae=[...oe,...se],ue=["esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeLong","esriFieldTypeBigInteger"],fe=["esriFieldTypeSingle","esriFieldTypeDouble"],de=new Set([...oe,...ue]),ce=new Set([...se,...fe]),pe=t(de,ce);function me(e){return null!=e&&de.has(e.type)}function ye(e){return null!=e&&pe.has(e.type)}function ge(e){return null!=e&&("string"===e.type||"esriFieldTypeString"===e.type)}function Fe(e){return null!=e&&("date"===e.type||"esriFieldTypeDate"===e.type)}function Ie(e){return null!=e&&("date-only"===e.type||"esriFieldTypeDateOnly"===e.type)}function be(e){return null!=e&&("timestamp-offset"===e.type||"esriFieldTypeTimestampOffset"===e.type)}function we(e){return null!=e&&("time-only"===e.type||"esriFieldTypeTimeOnly"===e.type)}function xe(e){return null!=e&&("oid"===e.type||"esriFieldTypeOID"===e.type)}function Te(e){return null!=e&&("global-id"===e.type||"esriFieldTypeGlobalID"===e.type)}function he(e,n){return null===Se(e,n)}function ve(e){return null==e||"number"==typeof e&&isNaN(e)?null:e}function Se(e,n){return null==e||e.nullable&&null===n?null:le(e,n)?ye(e)&&!Ee(e.type,Number(n))?"numeric-range-validation-error::out-of-range":null:"type-validation-error::invalid-type"}function Ee(e,n){const i="string"==typeof e?$e(e):e;if(!i)return!1;const t=i.min,r=i.max;return i.isInteger?Number.isInteger(n)&&n>=t&&n<=r:n>=t&&n<=r}function Ae(e,n){const i=l(e,n);return i||(ye(e)?$e(e.type):void 0)}function $e(e){switch(e){case"esriFieldTypeSmallInteger":case"small-integer":return Ne;case"esriFieldTypeInteger":case"esriFieldTypeLong":case"integer":case"long":return Le;case"esriFieldTypeBigInteger":case"big-integer":return Me;case"esriFieldTypeSingle":case"single":return je;case"esriFieldTypeDouble":case"double":return De}}function _e(e){if(!ne(e))return null;if(Number.isInteger(e)){if(e>=Ne.min&&e<=Ne.max)return"esriFieldTypeSmallInteger";if(e>=Le.min&&e<=Le.max)return"esriFieldTypeInteger";if(e>=Me.min&&e<=Me.max)return"esriFieldTypeBigInteger"}return e>=je.min&&e<=je.max?"esriFieldTypeSingle":"esriFieldTypeDouble"}const Ne={min:-32768,max:32767,isInteger:!0,rawMin:-32768,rawMax:32767},Le={min:-2147483648,max:2147483647,isInteger:!0,rawMin:-2147483648,rawMax:2147483647},Me={min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,isInteger:!0,rawMin:-Number.MAX_SAFE_INTEGER,rawMax:Number.MAX_SAFE_INTEGER},je={min:-34e37,max:12e37,isInteger:!1,rawMin:-34e37,rawMax:12e37},De={min:-Number.MAX_VALUE,max:Number.MAX_VALUE,isInteger:!1,rawMin:-Number.MAX_VALUE,rawMax:Number.MAX_VALUE};function Oe(e,n,i){switch(e){case"domain-validation-error::invalid-coded-value":return`Value ${i} is not in the coded domain - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case"domain-validation-error::value-out-of-range":return`Value ${i} is out of the range of valid values - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case"type-validation-error::invalid-type":return`Value ${i} is not a valid value for the field type - field: ${n.name}, type: ${n.type}, nullable: ${n.nullable}`;case"numeric-range-validation-error::out-of-range":{const{min:e,max:t}=$e(n.type);return`Value ${i} is out of range for the number type - field: ${n.name}, type: ${n.type}, value range is ${e} to ${t}`}}}function Re(e,n){return!Ve(e,n,null)}function Ve(e,n,i){if(!e?.attributes||!n){if(null!=i)for(const e of n??[])i.add(e);return!0}const t=new Set(Object.keys(e.attributes));let r=!1;for(const l of n)if(!t.has(l)){if(r=!0,null==i)break;i.add(l)}return r}async function ke(e,n){const i=new Set;for(const t of n)await v(i,e.fieldsIndex,null,t);return Array.from(i).sort()}function Ce(e){return!!e&&["raster.itempixelvalue","raster.servicepixelvalue"].some(n=>e.toLowerCase().startsWith(n))}async function Ue(e,n){const i=new Set;return e?.collectRequiredFields&&await e.collectRequiredFields(i,n),Array.from(i).sort()}function qe(e){const n=e?.match(/{[^}]+}/g);return n?n.map(e=>e.slice(1,-1).split(":")[0].trim()):[]}export{Me as bigIntegerRange,v as collectArcadeFieldNames,q as collectDisplayFilterFields,N as collectElevationFields,M as collectFeatureReductionFields,x as collectField,w as collectFields,O as collectFilterFields,Q as collectLabelingFields,R as collectOrderByInfos,D as collectPopupTemplateFields,S as collectSQLFieldNames,j as collectTrackInfoFields,De as doubleRange,qe as extractSubstitutionTemplatesFromString,Re as featureHasFields,b as fixFields,y as fixRendererFields,F as fixTimeInfoFields,fe as floatJSONTypes,se as floatTypes,E as getDisplayFieldName,G as getEditTrackingFields,_ as getElevationFields,ke as getExpressionFields,C as getFeatureEditFields,U as getFeatureGeometryFields,ee as getFieldDefaultLength,Z as getFieldDefaultValue,Ae as getFieldRange,K as getLabelingFields,B as getLowerCaseDefaultHiddenFields,J as getLowerCaseEditTrackingFields,_e as getNumericTypeForValue,Ue as getRendererFields,k as getTimeFields,ue as integerJSONTypes,Le as integerRange,oe as integerTypes,Fe as isDateField,Ie as isDateOnlyField,W as isFieldEditable,H as isFieldVisibleByDefault,Te as isGlobalIDField,me as isIntegerField,Ee as isNumberInRange,ye as isNumericField,xe as isObjectIDField,Ce as isRasterPixelValueField,ge as isStringField,we as isTimeOnlyField,be as isTimestampOffsetField,he as isValidFieldValue,le as isValueMatchingFieldType,c as normalizeFieldName,ae as numericTypes,h as packFields,Ve as populateMissingFields,p as rendererFields,ve as sanitizeNullFieldValue,je as singleRange,Ne as smallIntegerRange,T as unpackFieldNames,Se as validateFieldValue,Oe as validationErrorToString,m as visualVariableFields};
5
+ import e from"../../core/Error.js";import{getDeepValue as n,setDeepValue as i}from"../../core/object.js";import{union as t}from"../../core/SetUtils.js";import{parseWhereClause as r}from"../../core/sql.js";import{getDomainRange as l}from"./domainUtils.js";import{getFieldNameFromSimpleExpression as o}from"../../support/arcadeExpressionUtils.js";import{isStringOrNull as s,isString as a}from"../../support/guards.js";import{loadArcade as u}from"../../support/loadArcade.js";const f=/^([0-9_])/,d=/[^a-z0-9_\u0080-\uffff]+/gi;function c(e){if(null==e)return null;return e.trim().replaceAll(d,"_").replace(f,"F$1")||null}const p=["field","field2","field3","normalizationField","rotationInfo.field","proportionalSymbolInfo.field","proportionalSymbolInfo.normalizationField","colorInfo.field","colorInfo.normalizationField"],m=["field","normalizationField"];function y(e,n){if(null!=e&&null!=n)for(const i of Array.isArray(e)?e:[e])if(g(p,i,n),"visualVariables"in i&&i.visualVariables)for(const e of i.visualVariables)g(m,e,n)}function g(e,t,r){if(e)for(const l of e){const e=n(l,t),o=e&&"function"!=typeof e&&r.get(e);o&&i(l,o.name,t)}}function F(e,n){if(null!=e&&n?.fields?.length)if("startField"in e){const i=n.get(e.startField),t=n.get(e.endField);e.startField=i?.name??null,e.endField=t?.name??null}else{const i=n.get(e.startTimeField),t=n.get(e.endTimeField);e.startTimeField=i?.name??null,e.endTimeField=t?.name??null}}const I=new Set;function b(e,n){return e&&n?(I.clear(),w(I,e,n),Array.from(I).sort()):[]}function w(e,n,i){if(i)if(n?.fields?.length)if(i.includes("*"))for(const{name:t}of n.fields)e.add(t);else for(const t of i)x(e,n,t);else{if(i.includes("*"))return e.clear(),void e.add("*");for(const n of i)null!=n&&e.add(n)}}function x(e,n,i){if("string"==typeof i)if(n){const t=n.get(i);t&&e.add(t.name)}else e.add(i)}function T(e,n){return null==n||null==e?[]:n.includes("*")?(e.fields??[]).map(e=>e.name):n}function h(e,n,i=1){if(!n||!e)return[];if(n.includes("*"))return["*"];const t=b(e,n);return t.length/e.fields.length>=i?["*"]:t}async function v(e,n,i,t){if(!t)return;const r=o(t);if(r)x(e,n,r);else{const{arcadeUtils:r}=await u(),l=r.extractFieldNames(t,i?.partitions??n?.fields?.map(e=>e.name));for(const t of l)x(e,i?.index??n,t)}}async function S(n,i,t){if(t&&"1=1"!==t){const l=await r(t,i);if(!l.isStandardized)throw new e("fieldUtils:collectFilterFields","Where clause is not standardized",{where:t});w(n,i,l.fieldNames)}}function E({displayField:e,fields:n}){return e||(n?.length?$(n,"name-or-title")||$(n,"unique-identifier")||$(n,"type-or-category")||A(n):null)}function A(e){for(const n of e){if(!n?.name)continue;const e=n.name.toLowerCase();if(e.includes("name")||e.includes("title"))return n.name}return null}function $(e,n){for(const i of e)if(i?.valueType&&i.valueType===n)return i.name;return null}async function _(e){if(!e)return[];const n=new Set;return await N(n,e),Array.from(n).sort()}async function N(e,n){if(!n)return;const i=n.elevationInfo?.featureExpressionInfo;return i?i.collectRequiredFields(e,n.fieldsIndex):void 0}function L(e,n,i){i.onStatisticExpression?v(e,n,null,i.onStatisticExpression.expression):e.add(i.onStatisticField)}async function M(e,n,i){if(!n||!i||!("fields"in i))return;const t=[],r=i.popupTemplate;t.push(D(e,n,r)),i.fields&&t.push(...i.fields.map(async i=>L(e,n.fieldsIndex,i))),await Promise.all(t)}async function j(e,n){const{fieldsIndex:i,trackInfo:t}=n;if(!n||!t||!i)return;const r=[t.latestObservations.renderer?.collectRequiredFields(e,i),t.previousObservations.renderer?.collectRequiredFields(e,i),t.trackLines.renderer?.collectRequiredFields(e,i)];t.popupTemplate&&r.push(D(e,n,t.popupTemplate));for(const l of[t.latestObservations.labelingInfo,t.previousObservations.labelingInfo,t.trackLines.labelingInfo])if(l)for(const n of l)r.push(Y(e,i,n));await Promise.all(r)}async function D(e,n,i){const t=[];i?.expressionInfos&&t.push(...i.expressionInfos.map(i=>v(e,n.fieldsIndex,null,i.expression)));const r=i?.content;if(Array.isArray(r))for(const l of r)"expression"===l.type&&l.expressionInfo&&t.push(v(e,n.fieldsIndex,null,l.expressionInfo.expression));await Promise.all(t)}async function O(e,n,i){n&&(n.timeInfo&&i?.timeExtent&&w(e,n.fieldsIndex,[n.timeInfo.startField,n.timeInfo.endField]),n.floorInfo&&w(e,n.fieldsIndex,[n.floorInfo.floorField]),null!=i?.where&&await S(e,n.fieldsIndex,i.where))}async function R(e,n,i){n&&i&&await Promise.all(i.map(i=>V(e,n,i)))}async function V(e,n,i){n&&i&&(i.valueExpression?await v(e,n.fieldsIndex,null,i.valueExpression):i.field&&x(e,n.fieldsIndex,i.field))}async function k(e){if(!e)return[];const n="timeInfo"in e&&e.timeInfo;return n?b(e.fieldsIndex,[e.trackIdField,n.startField,n.endField]):[]}function C(e){return e?b(e.fieldsIndex,G(e)):[]}function U(e){if(!e)return[];const n=e.geometryFieldsInfo;return n?b(e.fieldsIndex,[n.shapeAreaField,n.shapeLengthField]):[]}async function q(e,n,i){if(!n||!i)return;const t=n.fieldsIndex;await Promise.all(i.filters.map(n=>S(e,t,n.where)))}const X=new Set(["oid","global-id","guid"]),z=new Set(["oid","global-id"]),P=[/^fnode_$/i,/^tnode_$/i,/^lpoly_$/i,/^rpoly_$/i,/^poly_$/i,/^shape$/i,/^shape_$/i,/^subclass$/i,/^subclass_$/i,/^rings_ok$/i,/^rings_nok$/i,/objectid/i,/^perimeter_/i,/_perimeter$/i,/_i$/i];function B(e){const n=new Set;J(e).forEach(e=>n.add(e)),U(e).forEach(e=>n.add(e.toLowerCase()));const i=e&&"infoFor3D"in e?e.infoFor3D:void 0;return i&&(Object.values(i.assetMapFieldRoles).forEach(e=>n.add(e.toLowerCase())),Object.values(i.transformFieldRoles).forEach(e=>n.add(e.toLowerCase()))),Array.from(n)}function G(e){if(!e)return[];const n="editFieldsInfo"in e&&e.editFieldsInfo;if(!n)return[];const{creationDateField:i,creatorField:t,editDateField:r,editorField:l}=n;return[i,t,r,l].filter(Boolean)}function J(e){return G(e).map(e=>e.toLowerCase())}function W(e,n){return e.editable&&!X.has(e.type)&&!J(n).includes(e.name?.toLowerCase()??"")}function H(e,n){const i=e.name?.toLowerCase()??"";return!(null!=n?.objectIdField&&i===n.objectIdField.toLowerCase()||null!=n?.globalIdField&&i===n.globalIdField.toLowerCase()||B(n).includes(i)||z.has(e.type)||P.some(e=>e.test(i)))}async function K(e){if(!e)return[];const n=new Set;return await Q(n,e),Array.from(n).sort()}async function Q(e,n){const{labelingInfo:i,fieldsIndex:t}=n;i?.length&&await Promise.all(i.map(n=>Y(e,t,n)))}async function Y(e,n,i){if(!i)return;const t=i.getLabelExpression(),r=i.where;if("arcade"===t.type)await v(e,n,null,t.expression);else{const i=t.expression.match(/{[^}]*}/g);i&&i.forEach(i=>{x(e,n,i.slice(1,-1))})}await S(e,n,r)}function Z(e){const n=e.defaultValue;return void 0!==n&&le(e,n)?n:e.nullable?null:void 0}function ee(e){const n="string"==typeof e?{type:e}:e;return ge(n)?255:"esriFieldTypeDate"===n.type||"date"===n.type?8:void 0}function ne(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}function ie(e){return null===e||ne(e)}function te(e){return null===e||Number.isInteger(e)}function re(){return!0}function le(e,n){let i;switch(e.type){case"date":case"integer":case"long":case"small-integer":case"big-integer":case"esriFieldTypeDate":case"esriFieldTypeInteger":case"esriFieldTypeLong":case"esriFieldTypeSmallInteger":case"esriFieldTypeBigInteger":i=e.nullable?te:Number.isInteger;break;case"double":case"single":case"esriFieldTypeSingle":case"esriFieldTypeDouble":i=e.nullable?ie:ne;break;case"string":case"esriFieldTypeString":i=e.nullable?s:a;break;default:i=re}return 1===arguments.length?i:i(n)}const oe=["integer","small-integer","big-integer","long"],se=["single","double"],ae=[...oe,...se],ue=["esriFieldTypeInteger","esriFieldTypeSmallInteger","esriFieldTypeLong","esriFieldTypeBigInteger"],fe=["esriFieldTypeSingle","esriFieldTypeDouble"],de=new Set([...oe,...ue]),ce=new Set([...se,...fe]),pe=t(de,ce);function me(e){return null!=e&&de.has(e.type)}function ye(e){return null!=e&&pe.has(e.type)}function ge(e){return null!=e&&("string"===e.type||"esriFieldTypeString"===e.type)}function Fe(e){return null!=e&&("date"===e.type||"esriFieldTypeDate"===e.type)}function Ie(e){return null!=e&&("date-only"===e.type||"esriFieldTypeDateOnly"===e.type)}function be(e){return null!=e&&("timestamp-offset"===e.type||"esriFieldTypeTimestampOffset"===e.type)}function we(e){return null!=e&&("time-only"===e.type||"esriFieldTypeTimeOnly"===e.type)}function xe(e){return null!=e&&("oid"===e.type||"esriFieldTypeOID"===e.type)}function Te(e){return null!=e&&("global-id"===e.type||"esriFieldTypeGlobalID"===e.type)}function he(e,n){return null===Se(e,n)}function ve(e){return null==e||"number"==typeof e&&isNaN(e)?null:e}function Se(e,n){return null==e||e.nullable&&null===n?null:le(e,n)?ye(e)&&!Ee(e.type,Number(n))?"numeric-range-validation-error::out-of-range":null:"type-validation-error::invalid-type"}function Ee(e,n){const i="string"==typeof e?$e(e):e;if(!i)return!1;const t=i.min,r=i.max;return i.isInteger?Number.isInteger(n)&&n>=t&&n<=r:n>=t&&n<=r}function Ae(e,n){const i=l(e,n);return i||(ye(e)?$e(e.type):void 0)}function $e(e){switch(e){case"esriFieldTypeSmallInteger":case"small-integer":return Ne;case"esriFieldTypeInteger":case"esriFieldTypeLong":case"integer":case"long":return Le;case"esriFieldTypeBigInteger":case"big-integer":return Me;case"esriFieldTypeSingle":case"single":return De;case"esriFieldTypeDouble":case"double":return Oe}}function _e(e){if(!ne(e))return null;if(Number.isInteger(e)){if(e>=Ne.min&&e<=Ne.max)return"esriFieldTypeSmallInteger";if(e>=Le.min&&e<=Le.max)return"esriFieldTypeInteger";if(e>=Me.min&&e<=Me.max)return"esriFieldTypeBigInteger"}return e>=De.min&&e<=De.max?"esriFieldTypeSingle":"esriFieldTypeDouble"}const Ne={min:-32768,max:32767,isInteger:!0,rawMin:-32768,rawMax:32767},Le={min:-2147483648,max:2147483647,isInteger:!0,rawMin:-2147483648,rawMax:2147483647},Me={min:-Number.MAX_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,isInteger:!0,rawMin:-Number.MAX_SAFE_INTEGER,rawMax:Number.MAX_SAFE_INTEGER},je=(2-2**-23)*2**127,De={min:-je,max:je,isInteger:!1,rawMin:-je,rawMax:je},Oe={min:-Number.MAX_VALUE,max:Number.MAX_VALUE,isInteger:!1,rawMin:-Number.MAX_VALUE,rawMax:Number.MAX_VALUE};function Re(e,n,i){switch(e){case"domain-validation-error::invalid-coded-value":return`Value ${i} is not in the coded domain - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case"domain-validation-error::value-out-of-range":return`Value ${i} is out of the range of valid values - field: ${n.name}, domain: ${JSON.stringify(n.domain)}`;case"type-validation-error::invalid-type":return`Value ${i} is not a valid value for the field type - field: ${n.name}, type: ${n.type}, nullable: ${n.nullable}`;case"numeric-range-validation-error::out-of-range":{const{min:e,max:t}=$e(n.type);return`Value ${i} is out of range for the number type - field: ${n.name}, type: ${n.type}, value range is ${e} to ${t}`}}}function Ve(e,n){return!ke(e,n,null)}function ke(e,n,i){if(!e?.attributes||!n){if(null!=i)for(const e of n??[])i.add(e);return!0}const t=new Set(Object.keys(e.attributes));let r=!1;for(const l of n)if(!t.has(l)){if(r=!0,null==i)break;i.add(l)}return r}async function Ce(e,n){const i=new Set;for(const t of n)await v(i,e.fieldsIndex,null,t);return Array.from(i).sort()}function Ue(e){return!!e&&["raster.itempixelvalue","raster.servicepixelvalue"].some(n=>e.toLowerCase().startsWith(n))}async function qe(e,n){const i=new Set;return e?.collectRequiredFields&&await e.collectRequiredFields(i,n),Array.from(i).sort()}function Xe(e){const n=e?.match(/{[^}]+}/g);return n?n.map(e=>e.slice(1,-1).split(":")[0].trim()):[]}export{Me as bigIntegerRange,v as collectArcadeFieldNames,q as collectDisplayFilterFields,N as collectElevationFields,M as collectFeatureReductionFields,x as collectField,w as collectFields,O as collectFilterFields,Q as collectLabelingFields,R as collectOrderByInfos,D as collectPopupTemplateFields,S as collectSQLFieldNames,j as collectTrackInfoFields,Oe as doubleRange,Xe as extractSubstitutionTemplatesFromString,Ve as featureHasFields,b as fixFields,y as fixRendererFields,F as fixTimeInfoFields,fe as floatJSONTypes,se as floatTypes,E as getDisplayFieldName,G as getEditTrackingFields,_ as getElevationFields,Ce as getExpressionFields,C as getFeatureEditFields,U as getFeatureGeometryFields,ee as getFieldDefaultLength,Z as getFieldDefaultValue,Ae as getFieldRange,K as getLabelingFields,B as getLowerCaseDefaultHiddenFields,J as getLowerCaseEditTrackingFields,_e as getNumericTypeForValue,qe as getRendererFields,k as getTimeFields,ue as integerJSONTypes,Le as integerRange,oe as integerTypes,Fe as isDateField,Ie as isDateOnlyField,W as isFieldEditable,H as isFieldVisibleByDefault,Te as isGlobalIDField,me as isIntegerField,Ee as isNumberInRange,ye as isNumericField,xe as isObjectIDField,Ue as isRasterPixelValueField,ge as isStringField,we as isTimeOnlyField,be as isTimestampOffsetField,he as isValidFieldValue,le as isValueMatchingFieldType,c as normalizeFieldName,ae as numericTypes,h as packFields,ke as populateMissingFields,p as rendererFields,ve as sanitizeNullFieldValue,De as singleRange,Ne as smallIntegerRange,T as unpackFieldNames,Se as validateFieldValue,Re as validationErrorToString,m as visualVariableFields};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.34.0-next.102",
3
+ "version": "4.34.0-next.103",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -19,11 +19,11 @@
19
19
  "license": "SEE LICENSE IN copyright.txt",
20
20
  "dependencies": {
21
21
  "@amcharts/amcharts5": "~5.14.1",
22
- "@arcgis/toolkit": "^4.34.0-next.151",
22
+ "@arcgis/toolkit": "^4.34.0-next.154",
23
23
  "@esri/arcgis-html-sanitizer": "~4.1.0",
24
24
  "@esri/calcite-components": "^3.3.1",
25
25
  "@vaadin/grid": "~24.9.1",
26
- "@zip.js/zip.js": "~2.8.3",
26
+ "@zip.js/zip.js": "~2.8.5",
27
27
  "luxon": "~3.7.2",
28
28
  "marked": "~16.3.0",
29
29
  "tslib": "^2.8.1"
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- const d="20251003",e="6d5ebd768b0a8742fd4b0a4e014dba89e80edf42";export{d as buildDate,e as commitHash};
5
+ const e="20251004",a="3e1dee76e4b38fa1a1e4cd44c384da50591a6a88";export{e as buildDate,a as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Error.js";import t from"../../../core/Logger.js";import{GeometryCursor as s}from"../../../geometry/GeometryCursor.js";import o from"../../../geometry/SpatialReference.js";import{isPolygon as i,isPolyline as l}from"../../../geometry/support/jsonUtils.js";import r from"../../../geometry/support/PolylineBuilder.js";import{Point as n}from"../../../geometry/support/TileClipper.js";import{PathEffectCursor as h}from"../CIMCursor.js";import{lazyGeneralizeOperator as a,lazyLengthOperator as c,lazySimplifyOperator as _}from"../CIMEffects.js";const p=()=>t.getLogger("esri.symbols.cim.effects.EffectTaperedPolygon");class y{static{this.instance=null}static local(){return null===y.instance&&(y.instance=new y),y.instance}execute(e,t,s){return new f(e,t,s)}}class f extends h{constructor(e,t,s){super(e,!1,!0),this._slopeS=0,this._slopeC=1,this._lastTangent1=new n(NaN,NaN),this._lastWidth=0,this._geomUnitsPerPoint=s,this._halfFromWidth=Math.abs(void 0!==t.fromWidth?t.fromWidth:0)*s*.5,this._halfToWidth=Math.abs(void 0!==t.toWidth?t.toWidth:1)*s*.5,this._originalLength=(void 0!==t.length?t.length:0)*s,this._length=0}processPath(t){if(t.totalSize<=0)return null;if(this._halfFromWidth<=0&&this._halfToWidth<=0){const e=s.createEmptyOptimizedCIM("esriGeometryPolygon",!1,!1,t.yFactor);for(t.seekPathEnd();t.prevPoint();)e.pushXY(t.x,t.y);for(t.seekPathStart();t.nextPoint();)e.pushXY(t.x,t.y);return e}const n=t.asJSON();t.seekPath(t.totalSize-1);const h=a.module.execute(n,.25*this._geomUnitsPerPoint,{removeDegenerateParts:!0}),y=null==h?null:i(h)?h.rings:l(h)?h.paths:null;if(!y)return p().error(new e("mapview-bad-resource","Unable to process geometry")),null;const f=c.module.execute(h);if((0===this._originalLength||this._originalLength>f)&&f>0){this._length=f;const e=(this._halfToWidth-this._halfFromWidth)/this._length;if(Math.abs(e)<1){const t=e*e;this._slopeC=Math.sqrt(1/(1+t)),this._slopeS=Math.sqrt(t/(1+t)),e<0&&(this._slopeS=-this._slopeS)}else this._slopeC=this._slopeS=.7071}else this._length=this._originalLength,this._slopeC=1,this._slopeS=0;const m=[];for(const e of y){const t=new r,s=new r;let o=0;this._setFromOffset(e.slice(0,2),t,s);for(let r=0,n=3;n<=e.length;++r,++n)o=this._setOffset(e.slice(r,n),o,t,s);this._setToOffset(e.slice(-2),o,t,s);const[i]=t.getGeometry(),[l]=s.getGeometry();m.push([...i,...l.reverse()])}const x={rings:m,spatialReference:{wkid:o.WebMercator.wkid}},d=_.module.execute(x);return s.fromJSONCIM(d)}_setFromOffset([[e,t],[s,o]],i,l){const r=this._halfFromWidth,h=new n(s-e,o-t).normalize().scale(r);i.beginPath([e-h.y,t+h.x]),l.beginPath([e+h.y,t-h.x])}_setToOffset([[e,t],[s,o]],i,l,r){let h;h=(i+=Math.sqrt((s-e)**2+(o-t)**2))>=this._length?this._halfToWidth:this._halfFromWidth+(this._halfToWidth-this._halfFromWidth)*i/this._length;const a=new n(s-e,o-t).normalize().scale(h);l.lineTo([s-a.y,o+a.x]),r.lineTo([s+a.y,o-a.x])}_setOffset([[t,s],[o,i],[l,r]],h,a,c){const _=Math.sqrt((o-t)**2+(i-s)**2);let y;y=h+_>=this._length?this._halfToWidth:this._halfFromWidth+(this._halfToWidth-this._halfFromWidth)*(h+_)/this._length,h+=_;const f=new n(o,i),m=new n(o-t,i-s).normalize(),x=new n(l-o,r-i).normalize(),d=n.sub(x,m),g=a.getPointCount(),u=c.getPointCount();m.leftPerpendicular(),x.leftPerpendicular();const T=m.x*x.x+m.y*x.y;if(T>.99){const e=n.add(m,x).scale(y/2),t=e.clone().rotate(this._slopeC,this._slopeS);a.lineTo([f.x+t.x,f.y+t.y]);const s=e.rotateReverse(this._slopeC,this._slopeS);c.lineTo([f.x-s.x,f.y-s.y])}else{const o=m.x*x.y-m.y*x.x;if(d.scale(1/o),o<0){d.scale(-y).rotateReverse(this._slopeC,this._slopeS);const t=c.getXY(u-1);t||p().error(new e("mapview-bad-resource","Unable to process geometry, index out of scope"));const s=n.add(f,d).sub(n.fromArray(t));if(m.x*s.y-m.y*s.x>0){const e=m.clone().scale(-y).rotateReverse(this._slopeC,this._slopeS),t=x.clone().scale(-y).rotateReverse(this._slopeC,this._slopeS);c.lineTo([f.x+e.x,f.y+e.y]),c.lineTo([f.x,f.y]),c.lineTo([f.x+t.x,f.y+t.y])}else c.lineTo([f.x+d.x,f.y+d.y])}else{d.scale(y).rotate(this._slopeC,this._slopeS);const t=a.getXY(g-1);t||p().error(new e("mapview-bad-resource","Unable to process geometry, index out of scope"));const s=n.add(f,d).sub(n.fromArray(t));if(m.x*s.y-m.y*s.x>0){const e=m.clone().scale(y).rotate(this._slopeC,this._slopeS),t=x.clone().scale(y).rotate(this._slopeC,this._slopeS);a.lineTo([f.x+e.x,f.y+e.y]),a.lineTo([f.x,f.y]),a.lineTo([f.x+t.x,f.y+t.y])}else a.lineTo([f.x+d.x,f.y+d.y])}const i=Math.acos(T);let l=1;if(y>.25){const e=2*Math.acos(1-.25/y);e<i&&(l=Math.round(i/e))}const r=Math.cos(i/l),h=Math.sin(i/l),_=m.clone();if(o<0){_.rotate(this._slopeC,this._slopeS);const o=a.getXY(g-1);o||p().error(new e("mapview-bad-resource","Unable to process geometry, index out of scope"));const i=n.add(f,_.clone().scale(this._lastWidth)),l=n.sub(i,n.fromArray(o)),r=m.x*l.y-m.y*l.x;if(!isNaN(this._lastTangent1.x)&&!isNaN(this._lastTangent1.y)&&r>0){const e=new n(t,s),o=this._lastTangent1.clone().scale(this._lastWidth);o.rotate(this._slopeC,this._slopeS);const i=m.clone().scale(this._lastWidth);i.rotate(this._slopeC,this._slopeS),a.lineTo([e.x+o.x,e.y+o.y]),a.lineTo([e.x,e.y]),a.lineTo([e.x+i.x,e.y+i.y])}}else{_.scale(-1).rotateReverse(this._slopeC,this._slopeS);const o=c.getXY(u-1);o||p().error(new e("mapview-bad-resource","Unable to process geometry, index out of scope"));const i=n.add(f,_.clone().scale(this._lastWidth)),l=n.sub(i,n.fromArray(o)),r=m.x*l.y-m.y*l.x;if(!isNaN(this._lastTangent1.x)&&!isNaN(this._lastTangent1.y)&&r>0){const e=new n(t,s),o=this._lastTangent1.clone().scale(-this._lastWidth);o.rotateReverse(this._slopeC,this._slopeS);const i=m.clone().scale(-this._lastWidth);i.rotateReverse(this._slopeC,this._slopeS),c.lineTo([e.x+o.x,e.y+o.y]),c.lineTo([e.x,e.y]),c.lineTo([e.x+i.x,e.y+i.y])}}_.scale(y);for(let e=0;e<=l;e++)o<0?(a.lineTo([f.x+_.x,f.y+_.y]),_.rotateReverse(r,h)):(c.lineTo([f.x+_.x,f.y+_.y]),_.rotate(r,h))}return this._lastTangent1.setCoords(m.x,m.y),this._lastWidth=y,h}}export{y as EffectTaperedPolygon};
5
+ import e from"../../../core/Error.js";import t from"../../../core/Logger.js";import{GeometryCursor as s}from"../../../geometry/GeometryCursor.js";import o from"../../../geometry/SpatialReference.js";import{isPolygon as i,isPolyline as l}from"../../../geometry/support/jsonUtils.js";import r from"../../../geometry/support/PolylineBuilder.js";import{Point as n}from"../../../geometry/support/TileClipper.js";import{PathEffectCursor as h}from"../CIMCursor.js";import{lazyGeneralizeOperator as a,lazyLengthOperator as c,lazySimplifyOperator as _}from"../CIMEffects.js";const p=()=>t.getLogger("esri.symbols.cim.effects.EffectTaperedPolygon");class y{static{this.instance=null}static local(){return null===y.instance&&(y.instance=new y),y.instance}execute(e,t,s){return new f(e,t,s)}}class f extends h{constructor(e,t,s){super(e,!1,!0),this._slopeS=0,this._slopeC=1,this._lastTangent1=new n(NaN,NaN),this._lastWidth=0,this._geomUnitsPerPoint=s,this._halfFromWidth=Math.abs(void 0!==t.fromWidth?t.fromWidth:0)*s*.5,this._halfToWidth=Math.abs(void 0!==t.toWidth?t.toWidth:1)*s*.5,this._originalLength=(void 0!==t.length?t.length:0)*s,this._length=0}processPath(t){if(t.totalSize<=0)return null;if(this._halfFromWidth<=0&&this._halfToWidth<=0){const e=s.createEmptyOptimizedCIM("esriGeometryPolygon",!1,!1,t.yFactor);for(t.seekPathEnd();t.prevPoint();)e.pushXY(t.x,t.y);for(t.seekPathStart();t.nextPoint();)e.pushXY(t.x,t.y);return e}const n=t.getCurrentPath().asJSON(),h=a.module.execute(n,.25*this._geomUnitsPerPoint,{removeDegenerateParts:!0}),y=null==h?null:i(h)?h.rings:l(h)?h.paths:null;if(!y)return p().error(new e("mapview-bad-resource","Unable to process geometry")),null;const f=c.module.execute(h);if((0===this._originalLength||this._originalLength>f)&&f>0){this._length=f;const e=(this._halfToWidth-this._halfFromWidth)/this._length;if(Math.abs(e)<1){const t=e*e;this._slopeC=Math.sqrt(1/(1+t)),this._slopeS=Math.sqrt(t/(1+t)),e<0&&(this._slopeS=-this._slopeS)}else this._slopeC=this._slopeS=.7071}else this._length=this._originalLength,this._slopeC=1,this._slopeS=0;const m=[];for(const e of y){const t=new r,s=new r;let o=0;this._setFromOffset(e.slice(0,2),t,s);for(let r=0,n=3;n<=e.length;++r,++n)o=this._setOffset(e.slice(r,n),o,t,s);this._setToOffset(e.slice(-2),o,t,s);const[i]=t.getGeometry(),[l]=s.getGeometry();m.push([...i,...l.reverse()])}const x={rings:m,spatialReference:{wkid:o.WebMercator.wkid}},d=_.module.execute(x);return s.fromJSONCIM(d)}_setFromOffset([[e,t],[s,o]],i,l){const r=this._halfFromWidth,h=new n(s-e,o-t).normalize().scale(r);i.beginPath([e-h.y,t+h.x]),l.beginPath([e+h.y,t-h.x])}_setToOffset([[e,t],[s,o]],i,l,r){let h;h=(i+=Math.sqrt((s-e)**2+(o-t)**2))>=this._length?this._halfToWidth:this._halfFromWidth+(this._halfToWidth-this._halfFromWidth)*i/this._length;const a=new n(s-e,o-t).normalize().scale(h);l.lineTo([s-a.y,o+a.x]),r.lineTo([s+a.y,o-a.x])}_setOffset([[t,s],[o,i],[l,r]],h,a,c){const _=Math.sqrt((o-t)**2+(i-s)**2);let y;y=h+_>=this._length?this._halfToWidth:this._halfFromWidth+(this._halfToWidth-this._halfFromWidth)*(h+_)/this._length,h+=_;const f=new n(o,i),m=new n(o-t,i-s).normalize(),x=new n(l-o,r-i).normalize(),d=n.sub(x,m),g=a.getPointCount(),u=c.getPointCount();m.leftPerpendicular(),x.leftPerpendicular();const T=m.x*x.x+m.y*x.y;if(T>.99){const e=n.add(m,x).scale(y/2),t=e.clone().rotate(this._slopeC,this._slopeS);a.lineTo([f.x+t.x,f.y+t.y]);const s=e.rotateReverse(this._slopeC,this._slopeS);c.lineTo([f.x-s.x,f.y-s.y])}else{const o=m.x*x.y-m.y*x.x;if(d.scale(1/o),o<0){d.scale(-y).rotateReverse(this._slopeC,this._slopeS);const t=c.getXY(u-1);t||p().error(new e("mapview-bad-resource","Unable to process geometry, index out of scope"));const s=n.add(f,d).sub(n.fromArray(t));if(m.x*s.y-m.y*s.x>0){const e=m.clone().scale(-y).rotateReverse(this._slopeC,this._slopeS),t=x.clone().scale(-y).rotateReverse(this._slopeC,this._slopeS);c.lineTo([f.x+e.x,f.y+e.y]),c.lineTo([f.x,f.y]),c.lineTo([f.x+t.x,f.y+t.y])}else c.lineTo([f.x+d.x,f.y+d.y])}else{d.scale(y).rotate(this._slopeC,this._slopeS);const t=a.getXY(g-1);t||p().error(new e("mapview-bad-resource","Unable to process geometry, index out of scope"));const s=n.add(f,d).sub(n.fromArray(t));if(m.x*s.y-m.y*s.x>0){const e=m.clone().scale(y).rotate(this._slopeC,this._slopeS),t=x.clone().scale(y).rotate(this._slopeC,this._slopeS);a.lineTo([f.x+e.x,f.y+e.y]),a.lineTo([f.x,f.y]),a.lineTo([f.x+t.x,f.y+t.y])}else a.lineTo([f.x+d.x,f.y+d.y])}const i=Math.acos(T);let l=1;if(y>.25){const e=2*Math.acos(1-.25/y);e<i&&(l=Math.round(i/e))}const r=Math.cos(i/l),h=Math.sin(i/l),_=m.clone();if(o<0){_.rotate(this._slopeC,this._slopeS);const o=a.getXY(g-1);o||p().error(new e("mapview-bad-resource","Unable to process geometry, index out of scope"));const i=n.add(f,_.clone().scale(this._lastWidth)),l=n.sub(i,n.fromArray(o)),r=m.x*l.y-m.y*l.x;if(!isNaN(this._lastTangent1.x)&&!isNaN(this._lastTangent1.y)&&r>0){const e=new n(t,s),o=this._lastTangent1.clone().scale(this._lastWidth);o.rotate(this._slopeC,this._slopeS);const i=m.clone().scale(this._lastWidth);i.rotate(this._slopeC,this._slopeS),a.lineTo([e.x+o.x,e.y+o.y]),a.lineTo([e.x,e.y]),a.lineTo([e.x+i.x,e.y+i.y])}}else{_.scale(-1).rotateReverse(this._slopeC,this._slopeS);const o=c.getXY(u-1);o||p().error(new e("mapview-bad-resource","Unable to process geometry, index out of scope"));const i=n.add(f,_.clone().scale(this._lastWidth)),l=n.sub(i,n.fromArray(o)),r=m.x*l.y-m.y*l.x;if(!isNaN(this._lastTangent1.x)&&!isNaN(this._lastTangent1.y)&&r>0){const e=new n(t,s),o=this._lastTangent1.clone().scale(-this._lastWidth);o.rotateReverse(this._slopeC,this._slopeS);const i=m.clone().scale(-this._lastWidth);i.rotateReverse(this._slopeC,this._slopeS),c.lineTo([e.x+o.x,e.y+o.y]),c.lineTo([e.x,e.y]),c.lineTo([e.x+i.x,e.y+i.y])}}_.scale(y);for(let e=0;e<=l;e++)o<0?(a.lineTo([f.x+_.x,f.y+_.y]),_.rotateReverse(r,h)):(c.lineTo([f.x+_.x,f.y+_.y]),_.rotate(r,h))}return this._lastTangent1.setCoords(m.x,m.y),this._lastWidth=y,h}}export{y as EffectTaperedPolygon};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{id as i}from"../../kernel.js";import r from"../../core/Collection.js";import s from"../../core/Error.js";import{EventedAccessor as n}from"../../core/Evented.js";import{LoadableMixin as t}from"../../core/Loadable.js";import o from"../../core/Logger.js";import{getOrCreateMapValue as a}from"../../core/MapUtils.js";import{EsriPromiseMixin as d}from"../../core/Promise.js";import{debounce as c,throwIfAborted as v}from"../../core/promiseUtils.js";import l from"../../core/ReactiveMap.js";import{whenOnce as p,watch as m}from"../../core/reactiveUtils.js";import{normalize as u}from"../../core/urlUtils.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as h}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as g}from"../../core/support/UpdatingHandles.js";import{parse as w}from"../../layers/support/arcgisLayerUrl.js";import{isSubtypeGroupLayer as y,isFeatureLayer as S}from"../../layers/support/layerUtils.js";import I from"../../portal/Portal.js";import{hasUserTypeExtension as _}from"../../portal/support/utils.js";import L from"../../rest/featureService/FeatureService.js";import{ServiceVersionInfo as b}from"./ServiceVersionInfo.js";function V(e){return!e||0===e.trim().length}const A=new Map;function U(e){return a(A,e,()=>{const i=new T({view:e});return e.addHandles({remove(){A.delete(e),i.destroy()}}),i.load().catch(e=>{o.getLogger("esri.views.Services").error("Failed to load service metadata",e)}),i})}let T=class extends(t(d(n))){constructor(e){super(e),this._updatingHandles=new g,this.items=new r,this.tablesAndLayersLookup=new l,this.additionalLayers=new r,this._debouncedCheckAndUpdateServiceInfos=c(async()=>{const e=[];for(const i of this.items){if(0===i.layersAndTables.length)continue;const r=i.layersAndTables.getItemAt(0);r?.gdbVersion!==i.versionInfo?.versionIdentifier.name&&e.push(i)}0!==e.length&&(await p(()=>!this.updating),await this._updateVersionInfos(e))}),this._debouncedLayersChanged=c(async()=>{const e=this._detectNewLayersAndTables();0!==e.length&&(await p(()=>!this._updatingHandles.updating),await this._updatingHandles.addPromise((async()=>{const i=new Set;for(const s of e)if("feature"===s.type||"subtype-group"===s.type){if(!s.url)continue;const e=w(s.url).url.path,n=this._findServiceInfo(e);if(n)this.tablesAndLayersLookup.set(s,n),s.isTable?n.tables.push(s):n.layers.push(s);else if(!i.has(e))try{await this._addServiceInfo(e,s)}catch(r){o.getLogger(this).error(`Failed to load feature service: ${e}`,r)}finally{i.add(e)}}})()))}),this._processed=new Set}destroy(){this._set("view",null),this.items.removeAll(),this.tablesAndLayersLookup.clear()}async load(e){return v(e),this.addHandles([m(()=>this.view.map,()=>{this._reset()}),m(()=>this._allLayersAndTables,()=>{this._debouncedLayersChanged().catch(e=>{o.getLogger(this).warn("Failed to update service info",e)})}),m(()=>this.items.map(e=>e.layersAndTables.map(e=>e.gdbVersion??"").join(",")),()=>{this.checkAndUpdateServiceInfos().catch(e=>{o.getLogger(this).warn("Failed to update service info",e)})})]),this.addResolvingPromise(this._debouncedLayersChanged()),this}get updating(){return"loading"===this.loadStatus||this._updatingHandles.updating}checkAndUpdateServiceInfos(){return this._debouncedCheckAndUpdateServiceInfos()}changeVersion(e,i,r){return this._updatingHandles.addPromise((async()=>{await this._changeVersionInternal(e,i,r)})())}createVersion(e){return this._updatingHandles.addPromise((async()=>{const i=e.featureServerUrl,r=this._findServiceInfo(i);if(!r?.versionService)throw new s("services:no-version-management-service","No version management service");const n=r.loggedInServiceUser.toUpperCase(),t=V(e.ownerName)?n:e.ownerName?.trim().toUpperCase();if(t!==n&&r.featureServiceVersion<=11.1)throw new s("services:versioning-api-error","Version management API too old");if("SDE"===t?.toUpperCase()&&"DEFAULT"===e.versionName.toUpperCase())throw new s("services:no-valid-version-name","No valid version name");{const i=await r.versionService.getVersionInfos();if(i?.find(i=>i.versionIdentifier.name.toUpperCase()===(t+"."+e.versionName).toUpperCase()||i.versionIdentifier.name.toUpperCase()===(n+"."+e.versionName).toUpperCase()))throw new s("services:no-valid-version-name","No valid version name")}const o=await r.versionService.createVersion({versionName:e.versionName,access:t!==n?"public":e.access,description:e.description});if(t!==n){const{guid:i,name:s}=o.versionIdentifier;await r.versionService.alterVersion({guid:i,name:s},{ownerName:t,access:e.access})}e.switchToVersion&&await this._changeVersionInternal(i,o.versionIdentifier.name,o.versionIdentifier.guid),this.emit("version-created",{versionIdentifier:o.versionIdentifier,versionManagementService:r.versionService})})())}deleteVersion(e,i,r){return this._updatingHandles.addPromise((async()=>{const n=this._findServiceInfo(e);if(!n?.versionService)throw new s("services:no-version-management-service","No version management service");if(n.featureServiceVersion<=11.1)throw new s("services:versioning-api-error","Version management API too old");const t={name:i,guid:r};await n.versionService.deleteVersion(t)&&(await this._updateVersionInfo(n),this.emit("version-deleted",{versionIdentifier:t,versionManagementService:n.versionService}))})())}startEditing(e){return this._updatingHandles.addPromise((async()=>{const i=this._findServiceInfo(e);if(!i?.versionService)throw new s("services:no-version-management-service","No version management service");const r=i.versionInfo?.versionIdentifier??{name:i.versionService.defaultVersionIdentifier.name,guid:i.versionService.defaultVersionIdentifier.guid};let n=!0;("none"!==i.versionService.getLockType(r)||(n=await i.versionService.startReading(r),n))&&(n=await i.versionService.startEditing(r),i.updateLockType())})())}finishEditing(e,i){return this._updatingHandles.addPromise((async()=>{const r=this._findServiceInfo(e);if(!r?.versionService)throw new s("services:no-version-management-service","No version management service");const n=r.versionInfo?.versionIdentifier??{name:r.versionService.defaultVersionIdentifier.name,guid:r.versionService.defaultVersionIdentifier.guid},t=r.versionService.getLockType(n);if("none"!==t)return"read"===t?(await r.versionService.stopReading(n),void r.updateLockType()):"edit"===t?(await r.versionService.stopEditing(n,i),await r.versionService.stopReading(n),void r.updateLockType()):void 0})())}async _changeVersionInternal(e,i,r){const n=this._findServiceInfo(e);if(!n?.versionService)throw new s("services:no-version-management-service","No version management service");const t=n.versionInfo?.versionIdentifier??{name:n.versionService.defaultVersionIdentifier.name,guid:n.versionService.defaultVersionIdentifier.guid},o={name:i,guid:r};await n.versionService.changeVersion(this.view?.map,t,o)&&await this._updateVersionInfo(n)}async _updateVersionInfo(e){const i=e.versionService;if(!i)return;if(0===e.layersAndTables.length)return;const r=e.layersAndTables.getItemAt(0)?.gdbVersion,s=r?await i.getVersionIdentifierFromName(r):i.defaultVersionIdentifier;e.versionInfo=await i.getVersionInfoExtended(s)}_findServiceInfo(e){return this.items.find(i=>i.featureService.url===e)??null}_removeFeatureService(e){this.items.remove(e)}_reset(){this.additionalLayers.removeAll(),this._processed.clear(),this.tablesAndLayersLookup.clear(),this.items.removeAll()}async _findPortal(e){const r=i?.findServerInfo(e??"");if(!r?.owningSystemUrl)return null;const s=`${r.owningSystemUrl}/sharing/rest`,n=I.getDefault();if(n?.loaded&&u(n.restUrl)===u(s))return n;return new I({authMode:"immediate",url:r.owningSystemUrl}).load()}_updateVersionInfos(e){return this._updatingHandles.addPromise((async()=>{for(const i of e)await this._updateVersionInfo(i).catch(e=>{o.getLogger(this).error("Failed to update version details",e)})})())}async _addServiceInfo(e,i){const s=new L({url:e});await s.load();const n=await this._findPortal(e),t=n?.user?.username;let o=!1;t&&(o=await _(n,t,"advediting"));let a=null;if(s.versionManagementServiceUrl){a=new(0,(await import("../../versionManagement/VersionManagementService.js")).default)({url:s.versionManagementServiceUrl}),await a.load()}const d=i.isTable?[]:[i],c=i.isTable?[i]:[],v=new b({loggedInServiceUser:t??"",hasAdvancedEditingUserTypeExtension:o,versionInfo:null,lockType:"none",canEditVersionedData:!0,canCreateVersion:!0,featureService:s,versionService:a,layers:new r(d),tables:new r(c)});return a&&await this._updateVersionInfo(v),this.items.push(v),this.tablesAndLayersLookup.set(i,v),i.isTable?v.tables.push(i):v.layers.push(i),v}get _allLayersAndTables(){return[...this.view.map?.allLayers??[],...this.view.map?.allTables??[],...this.additionalLayers]}_detectNewLayersAndTables(){const e=new Set(this._allLayersAndTables),i=[];for(const r of e)"feature"!==r.type&&"subtype-group"!==r.type||this._processed.has(r)||i.push(r);for(const r of this._processed)if(!e.has(r)&&(y(r)||S(r))){const e=this.tablesAndLayersLookup.get(r);if(!e)continue;this.tablesAndLayersLookup.delete(r),r.isTable?e.tables.remove(r):e.layers.remove(r),0===e.layersAndTables.length&&this._removeFeatureService(e)}return this._processed=e,i}};e([f({constructOnly:!0})],T.prototype,"view",void 0),e([f()],T.prototype,"items",void 0),e([f()],T.prototype,"tablesAndLayersLookup",void 0),e([f()],T.prototype,"additionalLayers",void 0),e([f()],T.prototype,"updating",null),e([f()],T.prototype,"_allLayersAndTables",null),T=e([h("esri.undoredo.support.Services")],T);export{T as Services,U as getServices};
5
+ import{__decorate as e}from"tslib";import{id as i}from"../../kernel.js";import r from"../../core/Collection.js";import s from"../../core/Error.js";import{EventedAccessor as n}from"../../core/Evented.js";import{LoadableMixin as t}from"../../core/Loadable.js";import o from"../../core/Logger.js";import{getOrCreateMapValue as a}from"../../core/MapUtils.js";import{EsriPromiseMixin as d}from"../../core/Promise.js";import{debounce as c,throwIfAborted as v,logOnError as l}from"../../core/promiseUtils.js";import p from"../../core/ReactiveMap.js";import{whenOnce as m,watch as u}from"../../core/reactiveUtils.js";import{normalize as f}from"../../core/urlUtils.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/RandomLCG.js";import{subclass as g}from"../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as w}from"../../core/support/UpdatingHandles.js";import{parse as y}from"../../layers/support/arcgisLayerUrl.js";import{isSubtypeGroupLayer as S,isFeatureLayer as I}from"../../layers/support/layerUtils.js";import _ from"../../portal/Portal.js";import{hasUserTypeExtension as L}from"../../portal/support/utils.js";import b from"../../rest/featureService/FeatureService.js";import{ServiceVersionInfo as V}from"./ServiceVersionInfo.js";function A(e){return!e||0===e.trim().length}const U=new Map;function T(e){return a(U,e,()=>{const i=new j({view:e});return e.addHandles({remove(){U.delete(e),i.destroy()}}),i.load().catch(e=>{o.getLogger("esri.views.Services").error("Failed to load service metadata",e)}),i})}let j=class extends(t(d(n))){constructor(e){super(e),this._updatingHandles=new w,this.items=new r,this.tablesAndLayersLookup=new p,this.additionalLayers=new r,this._debouncedCheckAndUpdateServiceInfos=c(async()=>{const e=[];for(const i of this.items){if(0===i.layersAndTables.length)continue;const r=i.layersAndTables.getItemAt(0);r?.gdbVersion!==i.versionInfo?.versionIdentifier.name&&e.push(i)}0!==e.length&&(await m(()=>!this.updating),await this._updateVersionInfos(e))}),this._debouncedLayersChanged=c(async()=>{const e=this._detectNewLayersAndTables();0!==e.length&&(await m(()=>!this._updatingHandles.updating),await this._updatingHandles.addPromise((async()=>{const i=new Set;for(const s of e)if("feature"===s.type||"subtype-group"===s.type){if(!s.url)continue;const e=y(s.url).url.path,n=this._findServiceInfo(e);if(n)this.tablesAndLayersLookup.set(s,n),s.isTable?n.tables.push(s):n.layers.push(s);else if(!i.has(e))try{await this._addServiceInfo(e,s)}catch(r){o.getLogger(this).error(`Failed to load feature service: ${e}`,r)}finally{i.add(e)}}})()))}),this._processed=new Set}destroy(){this._set("view",null),this.items.removeAll(),this.tablesAndLayersLookup.clear()}async load(e){return v(e),this.addHandles([u(()=>this.view.map,()=>{this._reset()}),u(()=>this._allLayersAndTables,()=>{this._debouncedLayersChanged().catch(e=>{o.getLogger(this).warn("Failed to update service info",e)})}),u(()=>this.items.map(e=>e.layersAndTables.map(e=>e.gdbVersion??"").join(",")),()=>{l(this.checkAndUpdateServiceInfos(),o.getLogger(this))})]),this.addResolvingPromise(this._debouncedLayersChanged()),this}get updating(){return"loading"===this.loadStatus||this._updatingHandles.updating}checkAndUpdateServiceInfos(){return this._debouncedCheckAndUpdateServiceInfos()}changeVersion(e,i,r){return this._updatingHandles.addPromise((async()=>{await this._changeVersionInternal(e,i,r)})())}createVersion(e){return this._updatingHandles.addPromise((async()=>{const i=e.featureServerUrl,r=this._findServiceInfo(i);if(!r?.versionService)throw new s("services:no-version-management-service","No version management service");const n=r.loggedInServiceUser.toUpperCase(),t=A(e.ownerName)?n:e.ownerName?.trim().toUpperCase();if(t!==n&&r.featureServiceVersion<=11.1)throw new s("services:versioning-api-error","Version management API too old");if("SDE"===t?.toUpperCase()&&"DEFAULT"===e.versionName.toUpperCase())throw new s("services:no-valid-version-name","No valid version name");{const i=await r.versionService.getVersionInfos();if(i?.find(i=>i.versionIdentifier.name.toUpperCase()===(t+"."+e.versionName).toUpperCase()||i.versionIdentifier.name.toUpperCase()===(n+"."+e.versionName).toUpperCase()))throw new s("services:no-valid-version-name","No valid version name")}const o=await r.versionService.createVersion({versionName:e.versionName,access:t!==n?"public":e.access,description:e.description});if(t!==n){const{guid:i,name:s}=o.versionIdentifier;await r.versionService.alterVersion({guid:i,name:s},{ownerName:t,access:e.access})}e.switchToVersion&&await this._changeVersionInternal(i,o.versionIdentifier.name,o.versionIdentifier.guid),this.emit("version-created",{versionIdentifier:o.versionIdentifier,versionManagementService:r.versionService})})())}deleteVersion(e,i,r){return this._updatingHandles.addPromise((async()=>{const n=this._findServiceInfo(e);if(!n?.versionService)throw new s("services:no-version-management-service","No version management service");if(n.featureServiceVersion<=11.1)throw new s("services:versioning-api-error","Version management API too old");const t={name:i,guid:r};await n.versionService.deleteVersion(t)&&(await this._updateVersionInfo(n),this.emit("version-deleted",{versionIdentifier:t,versionManagementService:n.versionService}))})())}startEditing(e){return this._updatingHandles.addPromise((async()=>{const i=this._findServiceInfo(e);if(!i?.versionService)throw new s("services:no-version-management-service","No version management service");const r=i.versionInfo?.versionIdentifier??{name:i.versionService.defaultVersionIdentifier.name,guid:i.versionService.defaultVersionIdentifier.guid};let n=!0;("none"!==i.versionService.getLockType(r)||(n=await i.versionService.startReading(r),n))&&(n=await i.versionService.startEditing(r),i.updateLockType())})())}finishEditing(e,i){return this._updatingHandles.addPromise((async()=>{const r=this._findServiceInfo(e);if(!r?.versionService)throw new s("services:no-version-management-service","No version management service");const n=r.versionInfo?.versionIdentifier??{name:r.versionService.defaultVersionIdentifier.name,guid:r.versionService.defaultVersionIdentifier.guid},t=r.versionService.getLockType(n);if("none"!==t)return"read"===t?(await r.versionService.stopReading(n),void r.updateLockType()):"edit"===t?(await r.versionService.stopEditing(n,i),await r.versionService.stopReading(n),void r.updateLockType()):void 0})())}async _changeVersionInternal(e,i,r){const n=this._findServiceInfo(e);if(!n?.versionService)throw new s("services:no-version-management-service","No version management service");const t=n.versionInfo?.versionIdentifier??{name:n.versionService.defaultVersionIdentifier.name,guid:n.versionService.defaultVersionIdentifier.guid},o={name:i,guid:r};await n.versionService.changeVersion(this.view?.map,t,o)&&await this._updateVersionInfo(n)}async _updateVersionInfo(e){const i=e.versionService;if(!i)return;if(0===e.layersAndTables.length)return;const r=e.layersAndTables.getItemAt(0)?.gdbVersion,s=r?await i.getVersionIdentifierFromName(r):i.defaultVersionIdentifier;e.versionInfo=await i.getVersionInfoExtended(s)}_findServiceInfo(e){return this.items.find(i=>i.featureService.url===e)??null}_removeFeatureService(e){this.items.remove(e)}_reset(){this.additionalLayers.removeAll(),this._processed.clear(),this.tablesAndLayersLookup.clear(),this.items.removeAll()}async _findPortal(e){const r=i?.findServerInfo(e??"");if(!r?.owningSystemUrl)return null;const s=`${r.owningSystemUrl}/sharing/rest`,n=_.getDefault();if(n?.loaded&&f(n.restUrl)===f(s))return n;return new _({authMode:"immediate",url:r.owningSystemUrl}).load()}_updateVersionInfos(e){return this._updatingHandles.addPromise((async()=>{for(const i of e)await this._updateVersionInfo(i).catch(e=>{o.getLogger(this).error("Failed to update version details",e)})})())}async _addServiceInfo(e,i){const s=new b({url:e});await s.load();const n=await this._findPortal(e),t=n?.user?.username;let o=!1;t&&(o=await L(n,t,"advediting"));let a=null;if(s.versionManagementServiceUrl){a=new(0,(await import("../../versionManagement/VersionManagementService.js")).default)({url:s.versionManagementServiceUrl}),await a.load()}const d=i.isTable?[]:[i],c=i.isTable?[i]:[],v=new V({loggedInServiceUser:t??"",hasAdvancedEditingUserTypeExtension:o,versionInfo:null,lockType:"none",canEditVersionedData:!0,canCreateVersion:!0,featureService:s,versionService:a,layers:new r(d),tables:new r(c)});return a&&await this._updateVersionInfo(v),this.items.push(v),this.tablesAndLayersLookup.set(i,v),i.isTable?v.tables.push(i):v.layers.push(i),v}get _allLayersAndTables(){return[...this.view.map?.allLayers??[],...this.view.map?.allTables??[],...this.additionalLayers]}_detectNewLayersAndTables(){const e=new Set(this._allLayersAndTables),i=[];for(const r of e)"feature"!==r.type&&"subtype-group"!==r.type||this._processed.has(r)||i.push(r);for(const r of this._processed)if(!e.has(r)&&(S(r)||I(r))){const e=this.tablesAndLayersLookup.get(r);if(!e)continue;this.tablesAndLayersLookup.delete(r),r.isTable?e.tables.remove(r):e.layers.remove(r),0===e.layersAndTables.length&&this._removeFeatureService(e)}return this._processed=e,i}};e([h({constructOnly:!0})],j.prototype,"view",void 0),e([h()],j.prototype,"items",void 0),e([h()],j.prototype,"tablesAndLayersLookup",void 0),e([h()],j.prototype,"additionalLayers",void 0),e([h()],j.prototype,"updating",null),e([h()],j.prototype,"_allLayersAndTables",null),j=e([g("esri.undoredo.support.Services")],j);export{j as Services,T as getServices};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../Color.js";import"../../../../intl.js";import{volumeMeasurementConfiguration as i}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import s from"../../../../core/Accessor.js";import{equals as o}from"../../../../core/arrayUtils.js";import{cyclicalPI as r}from"../../../../core/Cyclical.js";import{destroyMaybe as l}from"../../../../core/maybe.js";import{formatDecimal as n}from"../../../../core/quantityFormatUtils.js";import{watch as a,initial as c}from"../../../../core/reactiveUtils.js";import{adaptiveVolumeUnit as u}from"../../../../core/unitUtils.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{e as h}from"../../../../chunks/earcut.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{j as g,n as y,e as _,i as f,f as v}from"../../../../chunks/vec32.js";import{create as j,fromValues as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as L}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{newDoubleArray as C}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as w}from"../../../../geometry/support/Indices.js";import{angleAroundAxis as G}from"../../../../geometry/support/vector.js";import{t as P}from"../../../../chunks/vec3.js";import V from"../../../../symbols/support/ElevationInfo.js";import{LabelVisualElement as F}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as R}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as A}from"../../interactive/visualElements/OutlineVisualElement.js";import{EuclideanSegment as O}from"../../interactive/visualElements/support/Segment.js";import{ElevationContext as x}from"../../layers/graphics/ElevationContext.js";import{extrudePolygon as S}from"../../layers/graphics/Graphics3DExtrudeSymbolLayer.js";import{geometryToRenderInfo as D}from"../../support/renderInfoUtils/polygon.js";import{CutFillColor as M,VolumeGeometry as U}from"../../webgl-engine/lib/CutFillColor.js";import{createStipplePatternSimple as E}from"../../webgl-engine/materials/lineStippleUtils.js";import{onLocaleChange as B}from"../../../../intl/locale.js";import{fetchMessageBundle as H}from"../../../../intl/messages.js";import{substitute as N}from"../../../../intl/substitute.js";let T=class extends s{get visible(){return this.analysisViewData.visible&&null!=this.analysisViewData.elevationAlignedGeometry&&null!=this.analysisViewData.targetGeometry}get updating(){return this.loadingMessages}constructor(e){super(e),this.unitsMessages=null,this.messages=null,this.loadingMessages=!0,this._elevationContext=x.fromElevationInfo(new V({mode:"absolute-height"})),this._extrusionHeight=1e4,this._projectionLines=[]}initialize(){const{view:e}=this,s={view:e,isDecoration:!0},o=i,r={...s,width:o.geometryOutlineWidth};this._elevationAlignedGeometry=new A({...r,isDraped:!0,color:t.toUnitRGBA(o.geometryOutlineColor)}),this._targetGeometry=new A(r);const l={...s,attached:!0,width:o.projectionLineWidth,renderOccluded:4,polygonOffset:!0},n={...l,stipplePattern:E(o.projectionLineStippleSize)},u=t.toUnitRGBA(o.cutProjectionLineColor),m=t.toUnitRGBA(o.fillProjectionLineColor);this._cutProjectionLines=new R({...l,color:u}),this._occludedCutProjectionLines=new R({...n,color:u}),this._fillProjectionLines=new R({...l,color:m}),this._occludedFillProjectionLines=new R({...n,color:m});const d={...s,attached:!0};this._cutVolumeLabel=new F(d),this._fillVolumeLabel=new F(d),this._cutFillRenderNode=new M({view:e,cutColor:o.cutColor,fillColor:o.fillColor,borderColor:o.geometryOutlineColor}),this.addHandles([a(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry}),({elevationAlignedGeometry:e,targetGeometry:t})=>{this._elevationAlignedGeometry.geometry=e,this._targetGeometry.geometry=t},c),a(()=>({interactive:this.analysisViewData.interactive,measureType:this.analysis.measureType,visible:this.visible}),({visible:e,interactive:t,measureType:i})=>{this._elevationAlignedGeometry.visible=e&&!t,this._targetGeometry.visible=e&&"cut-fill"===i},c),a(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry,visible:this.visible}),({elevationAlignedGeometry:e,targetGeometry:t,visible:i})=>this._updateProjectionLines(e,t,i)),a(()=>({interactive:this.analysisViewData.interactive,accentColor:this.view.effectiveTheme.accentColor}),({interactive:e,accentColor:t})=>{this._updateColors(e,t)},c),a(()=>this.analysisViewData.targetGeometry,()=>this._updateCutFillGeometry(),c),a(()=>this.visible,()=>this._updateCutFillVisibility()),a(()=>{const{messages:e,unitsMessages:t,visible:i,analysisViewData:s}=this;return{labelAnchors:s.labelAnchors,effectiveDisplayUnits:s.effectiveDisplayUnits,messages:e,unitsMessages:t,result:s.result,visible:i}},e=>this._updateLabels(e)),a(()=>this.view.state.camera,e=>this._updateProjectionLineOcclusion(e)),B(()=>this._updateMessageBundle())]),this._updateMessageBundle()}destroy(){this._elevationAlignedGeometry=l(this._elevationAlignedGeometry),this._targetGeometry=l(this._targetGeometry),this._cutProjectionLines=l(this._cutProjectionLines),this._occludedCutProjectionLines=l(this._occludedCutProjectionLines),this._fillProjectionLines=l(this._fillProjectionLines),this._occludedFillProjectionLines=l(this._occludedFillProjectionLines),this._cutVolumeLabel=l(this._cutVolumeLabel),this._fillVolumeLabel=l(this._fillVolumeLabel),this._cutFillRenderNode.destroy()}_updateProjectionLines(e,t,i){if(this._cutProjectionLines.visible=i,this._occludedCutProjectionLines.visible=i,this._fillProjectionLines.visible=i,this._occludedFillProjectionLines.visible=i,!e||!t)return;const{renderCoordsHelper:s}=this.view,r=[],l=e.spatialReference,n=e.rings[0],a=n.length>1&&o(n[0],n[n.length-1]),c=n.length-(a?1:0);for(let o=0;o<c;++o){const e=n[o],i=g(j(),e[0],e[1],e[2]);s.toRenderCoords(i,l,i);const a=t.rings[0][o],c=g(j(),a[0],a[1],a[2]);s.toRenderCoords(c,l,c);const u=new O(i,c);r.push(u)}e.isClockwise(n)||r.reverse();const u=[],m=[],d=[],h=[],p=[],y=this.view.state.camera;for(let o=0;o<r.length;++o){const i=r[o],s=r[0===o?r.length-1:o-1],l=r[o===r.length-1?0:o+1],n=e.rings[0][o],a=t.rings[0][o],c=n[2]>a[2],g=new k(i,s,l,c);u.push(g),g.updateOccluded(y);const _=g.isOccluded;c?(_?d:m).push(i):(_?p:h).push(i)}this._projectionLines=u,this._cutProjectionLines.setGeometryFromSegments(m),this._occludedCutProjectionLines.setGeometryFromSegments(d),this._fillProjectionLines.setGeometryFromSegments(h),this._occludedFillProjectionLines.setGeometryFromSegments(p)}_updateProjectionLineOcclusion(e){const t=[],i=[],s=[],o=[];let r=!1,l=!1;for(const n of this._projectionLines){n.updateOccluded(e)&&(r||=n.isCut,l||=!n.isCut);const a=n.isOccluded;(n.isCut?a?i:t:a?o:s).push(n.segment)}l&&(this._fillProjectionLines.setGeometryFromSegments(s),this._occludedFillProjectionLines.setGeometryFromSegments(o)),r&&(this._cutProjectionLines.setGeometryFromSegments(t),this._occludedCutProjectionLines.setGeometryFromSegments(i))}_updateColors(e,s){const{geometryOutlineColor:o,cutProjectionLineColor:r,fillProjectionLineColor:l}=i;if(e){const e=t.toUnitRGBA(s);this._targetGeometry.color=e,this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e,this._fillProjectionLines.color=e,this._occludedFillProjectionLines.color=e,this._cutFillRenderNode.borderColor=s}else{this._targetGeometry.color=t.toUnitRGBA(o);const e=t.toUnitRGBA(r);this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e;const i=t.toUnitRGBA(l);this._fillProjectionLines.color=i,this._occludedFillProjectionLines.color=i,this._cutFillRenderNode.borderColor=o}}_updateLabels(e){const{labelDistance:t}=i,{effectiveDisplayUnits:s,labelAnchors:o,messages:r,unitsMessages:l,result:n,visible:a}=e;if(this._cutVolumeLabel.visible=a,this._fillVolumeLabel.visible=a,this._cutVolumeLabel.geometry=o.cut?{type:"point",point:o.cut,callout:{distance:t,offset:0}}:null,this._fillVolumeLabel.geometry=o.fill?{type:"point",point:o.fill,callout:{distance:-t,offset:0}}:null,null==n||null==r||null==l)return this._cutVolumeLabel.text="-",void(this._fillVolumeLabel.text="-");const c=s.volume,u=N(r.labels.cut,{volume:I(l,n.cutVolume,c)}),m=N(r.labels.fill,{volume:I(l,n.fillVolume,c)});this._cutVolumeLabel.text=u,this._fillVolumeLabel.text=m}_updateCutFillVisibility(){this.visible?this._cutFillRenderNode.enable():this._cutFillRenderNode.disable()}_updateCutFillGeometry(){const{renderCoordsHelper:e}=this.view,{targetGeometry:t}=this.analysisViewData;if(!t?.extent)return;const{center:i}=t.extent,s=b(i.x,i.y,0),o=j();e.toRenderCoords(s,t.spatialReference,o);const r=this._getExtrudedVolumes(t,this._extrusionHeight,s),l=this._getExtrudedVolumes(t,-this._extrusionHeight,s);this._cutFillRenderNode.updateGeometries(r,l,o)}_getExtrudedVolumes(e,t,i){const{renderCoordsHelper:s,spatialReference:o,elevationProvider:r}=this.view,l=j(),n=1===s.viewingMode;n||s.worldUpAtPosition([0,0,0],l);const a=D(e,r,s,this._elevationContext),{polygons:c,mapPositions:u,position:m}=a,d=c[0],g=d.count,y=h(d.mapPositions,d.holeIndices,3),_=y.length,f=6*g,v=w(f+_),b=w(_),G=C(3*f),V=C(3*f);S(m,u,y,d,G,null,V,null,v,b,t,l,n);const F=p(),R=p();return L(o,i,F,s.spatialReference),R[12]=-F[12],R[13]=-F[13],R[14]=-F[14],P(G,G,R),new U(G,b,v,V)}async _updateMessageBundle(){this.loadingMessages=!0;try{this.unitsMessages=await H("esri/core/t9n/Units"),this.messages=await H("esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis")}finally{this.loadingMessages=!1}}};function I(e,t,s){if(!t||!e)return null;const o=u(t.value,t.unit,s),r=i.labelPrecisions[o];return n(e,t,o,r)}e([m({constructOnly:!0})],T.prototype,"view",void 0),e([m({constructOnly:!0})],T.prototype,"analysis",void 0),e([m({constructOnly:!0})],T.prototype,"analysisViewData",void 0),e([m()],T.prototype,"unitsMessages",void 0),e([m()],T.prototype,"messages",void 0),e([m()],T.prototype,"loadingMessages",void 0),e([m({readOnly:!0})],T.prototype,"visible",null),e([m()],T.prototype,"updating",null),T=e([d("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillVisualization")],T);class k{constructor(e,t,i,s){this.segment=e,this.previous=t,this.next=i,this.isCut=s,this._isOccluded=!1,this._n1=j(),this._n2=j();const o=y(z,_(z,e.endRenderSpace,e.startRenderSpace));y(this._n1,f(this._n1,o,y(W,_(W,t.startRenderSpace,e.startRenderSpace)))),y(this._n2,f(this._n2,o,y(W,_(W,e.startRenderSpace,i.startRenderSpace)))),this._isConvex=r.normalize(G(this._n1,this._n2,o))<0}get isOccluded(){return this._isOccluded}updateOccluded(e){_(z,this.segment.startRenderSpace,e.eye);const t=v(this._n1,z)<0,i=v(this._n2,z)<0,s=this._isOccluded;return this._isOccluded=this._isConvex?t&&i:t||i,this._isOccluded!==s}}const z=j(),W=j();export{T as VolumeMeasurementCutFillVisualization};
5
+ import{__decorate as e}from"tslib";import t from"../../../../Color.js";import"../../../../intl.js";import{volumeMeasurementConfiguration as i}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import s from"../../../../core/Accessor.js";import{equals as o}from"../../../../core/arrayUtils.js";import{cyclicalPI as r}from"../../../../core/Cyclical.js";import{destroyMaybe as l}from"../../../../core/maybe.js";import{formatDecimal as n}from"../../../../core/quantityFormatUtils.js";import{watch as a,initial as c}from"../../../../core/reactiveUtils.js";import{adaptiveVolumeUnit as u}from"../../../../core/unitUtils.js";import{property as m}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{e as h}from"../../../../chunks/earcut.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{j as g,n as y,e as _,i as f,f as v}from"../../../../chunks/vec32.js";import{create as j,fromValues as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as L}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{newDoubleArray as C}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as w}from"../../../../geometry/support/Indices.js";import{angleAroundAxis as G}from"../../../../geometry/support/vector.js";import{t as P}from"../../../../chunks/vec3.js";import V from"../../../../symbols/support/ElevationInfo.js";import{LabelVisualElement as R}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as F}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as A}from"../../interactive/visualElements/OutlineVisualElement.js";import{EuclideanSegment as O}from"../../interactive/visualElements/support/Segment.js";import{ElevationContext as x}from"../../layers/graphics/ElevationContext.js";import{extrudePolygon as D}from"../../layers/graphics/Graphics3DExtrudeSymbolLayer.js";import{geometryToRenderInfo as M}from"../../support/renderInfoUtils/polygon.js";import{CutFillColor as S,VolumeGeometry as U}from"../../webgl-engine/lib/CutFillColor.js";import{createStipplePatternSimple as E}from"../../webgl-engine/materials/lineStippleUtils.js";import{onLocaleChange as B}from"../../../../intl/locale.js";import{fetchMessageBundle as N}from"../../../../intl/messages.js";import{substitute as H}from"../../../../intl/substitute.js";let T=class extends s{get visible(){return this.analysisViewData.visible&&null!=this.analysisViewData.elevationAlignedGeometry&&null!=this.analysisViewData.targetGeometry}get updating(){return this.loadingMessages}get hasUnsupportedError(){const{error:e}=this.analysisViewData;return!!e&&["unsupported-coordinate-system","unsupported-layer-transparency"].includes(e.name)}constructor(e){super(e),this.unitsMessages=null,this.messages=null,this.loadingMessages=!0,this._elevationContext=x.fromElevationInfo(new V({mode:"absolute-height"})),this._extrusionHeight=1e4,this._projectionLines=[]}initialize(){const{view:e}=this,s={view:e,isDecoration:!0},o=i,r={...s,width:o.geometryOutlineWidth};this._elevationAlignedGeometry=new A({...r,isDraped:!0,color:t.toUnitRGBA(o.geometryOutlineColor)}),this._targetGeometry=new A(r);const l={...s,attached:!0,width:o.projectionLineWidth,renderOccluded:4,polygonOffset:!0},n={...l,stipplePattern:E(o.projectionLineStippleSize)},u=t.toUnitRGBA(o.cutProjectionLineColor),m=t.toUnitRGBA(o.fillProjectionLineColor);this._cutProjectionLines=new F({...l,color:u}),this._occludedCutProjectionLines=new F({...n,color:u}),this._fillProjectionLines=new F({...l,color:m}),this._occludedFillProjectionLines=new F({...n,color:m});const d={...s,attached:!0};this._cutVolumeLabel=new R(d),this._fillVolumeLabel=new R(d),this._cutFillRenderNode=new S({view:e,cutColor:o.cutColor,fillColor:o.fillColor,borderColor:o.geometryOutlineColor}),this.addHandles([a(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry}),({elevationAlignedGeometry:e,targetGeometry:t})=>{this._elevationAlignedGeometry.geometry=e,this._targetGeometry.geometry=t},c),a(()=>({interactive:this.analysisViewData.interactive,measureType:this.analysis.measureType,visible:this.visible}),({visible:e,interactive:t,measureType:i})=>{this._elevationAlignedGeometry.visible=e&&!t,this._targetGeometry.visible=e&&"cut-fill"===i},c),a(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry,visible:this.visible}),({elevationAlignedGeometry:e,targetGeometry:t,visible:i})=>this._updateProjectionLines(e,t,i)),a(()=>({interactive:this.analysisViewData.interactive,accentColor:this.view.effectiveTheme.accentColor,hasResult:!!this.analysisViewData.result}),({interactive:e,accentColor:t,hasResult:i})=>{this._updateColors(e,t,i)},c),a(()=>this.analysisViewData.targetGeometry,()=>this._updateCutFillGeometry(),c),a(()=>this.visible&&!this.hasUnsupportedError,e=>this._updateCutFillVisibility(e),c),a(()=>{const{messages:e,unitsMessages:t,visible:i,analysisViewData:s}=this;return{labelAnchors:s.labelAnchors,effectiveDisplayUnits:s.effectiveDisplayUnits,messages:e,unitsMessages:t,result:s.result,visible:i&&!!s.result}},e=>this._updateLabels(e)),a(()=>this.view.state.camera,e=>this._updateProjectionLineOcclusion(e)),B(()=>this._updateMessageBundle())]),this._updateMessageBundle()}destroy(){this._elevationAlignedGeometry=l(this._elevationAlignedGeometry),this._targetGeometry=l(this._targetGeometry),this._cutProjectionLines=l(this._cutProjectionLines),this._occludedCutProjectionLines=l(this._occludedCutProjectionLines),this._fillProjectionLines=l(this._fillProjectionLines),this._occludedFillProjectionLines=l(this._occludedFillProjectionLines),this._cutVolumeLabel=l(this._cutVolumeLabel),this._fillVolumeLabel=l(this._fillVolumeLabel),this._cutFillRenderNode.destroy()}_updateProjectionLines(e,t,i){if(this._cutProjectionLines.visible=i,this._occludedCutProjectionLines.visible=i,this._fillProjectionLines.visible=i,this._occludedFillProjectionLines.visible=i,!e||!t)return;const{renderCoordsHelper:s}=this.view,r=[],l=e.spatialReference,n=e.rings[0],a=n.length>1&&o(n[0],n[n.length-1]),c=n.length-(a?1:0);for(let o=0;o<c;++o){const e=n[o],i=g(j(),e[0],e[1],e[2]);s.toRenderCoords(i,l,i);const a=t.rings[0][o],c=g(j(),a[0],a[1],a[2]);s.toRenderCoords(c,l,c);const u=new O(i,c);r.push(u)}e.isClockwise(n)||r.reverse();const u=[],m=[],d=[],h=[],p=[],y=this.view.state.camera;for(let o=0;o<r.length;++o){const i=r[o],s=r[0===o?r.length-1:o-1],l=r[o===r.length-1?0:o+1],n=e.rings[0][o],a=t.rings[0][o],c=n[2]>a[2],g=new k(i,s,l,c);u.push(g),g.updateOccluded(y);const _=g.isOccluded;c?(_?d:m).push(i):(_?p:h).push(i)}this._projectionLines=u,this._cutProjectionLines.setGeometryFromSegments(m),this._occludedCutProjectionLines.setGeometryFromSegments(d),this._fillProjectionLines.setGeometryFromSegments(h),this._occludedFillProjectionLines.setGeometryFromSegments(p)}_updateProjectionLineOcclusion(e){const t=[],i=[],s=[],o=[];let r=!1,l=!1;for(const n of this._projectionLines){n.updateOccluded(e)&&(r||=n.isCut,l||=!n.isCut);const a=n.isOccluded;(n.isCut?a?i:t:a?o:s).push(n.segment)}l&&(this._fillProjectionLines.setGeometryFromSegments(s),this._occludedFillProjectionLines.setGeometryFromSegments(o)),r&&(this._cutProjectionLines.setGeometryFromSegments(t),this._occludedCutProjectionLines.setGeometryFromSegments(i))}_updateColors(e,s,o){const{geometryOutlineColor:r,cutColor:l,fillColor:n,cutColorMuted:a,fillColorMuted:c,cutProjectionLineColor:u,fillProjectionLineColor:m}=i;if(this._cutFillRenderNode.cutColor=o?l:a,this._cutFillRenderNode.fillColor=o?n:c,e){const e=t.toUnitRGBA(s);this._targetGeometry.color=e,this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e,this._fillProjectionLines.color=e,this._occludedFillProjectionLines.color=e,this._cutFillRenderNode.borderColor=s}else{this._targetGeometry.color=t.toUnitRGBA(r);const e=t.toUnitRGBA(o?u:a);this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e;const i=t.toUnitRGBA(o?m:c);this._fillProjectionLines.color=i,this._occludedFillProjectionLines.color=i,this._cutFillRenderNode.borderColor=r}}_updateLabels(e){const{labelDistance:t}=i,{effectiveDisplayUnits:s,labelAnchors:o,messages:r,unitsMessages:l,result:n,visible:a}=e;if(this._cutVolumeLabel.visible=a,this._fillVolumeLabel.visible=a,this._cutVolumeLabel.geometry=o.cut?{type:"point",point:o.cut,callout:{distance:t,offset:0}}:null,this._fillVolumeLabel.geometry=o.fill?{type:"point",point:o.fill,callout:{distance:-t,offset:0}}:null,null==n||null==r||null==l)return this._cutVolumeLabel.text="-",void(this._fillVolumeLabel.text="-");const c=s.volume,u=H(r.labels.cut,{volume:I(l,n.cutVolume,c)}),m=H(r.labels.fill,{volume:I(l,n.fillVolume,c)});this._cutVolumeLabel.text=u,this._fillVolumeLabel.text=m}_updateCutFillVisibility(e){e?this._cutFillRenderNode.enable():this._cutFillRenderNode.disable()}_updateCutFillGeometry(){const{renderCoordsHelper:e}=this.view,{targetGeometry:t}=this.analysisViewData;if(!t?.extent)return;const{center:i}=t.extent,s=b(i.x,i.y,0),o=j();e.toRenderCoords(s,t.spatialReference,o);const r=this._getExtrudedVolumes(t,this._extrusionHeight,s),l=this._getExtrudedVolumes(t,-this._extrusionHeight,s);this._cutFillRenderNode.updateGeometries(r,l,o)}_getExtrudedVolumes(e,t,i){const{renderCoordsHelper:s,spatialReference:o,elevationProvider:r}=this.view,l=j(),n=1===s.viewingMode;n||s.worldUpAtPosition([0,0,0],l);const a=M(e,r,s,this._elevationContext),{polygons:c,mapPositions:u,position:m}=a,d=c[0],g=d.count,y=h(d.mapPositions,d.holeIndices,3),_=y.length,f=6*g,v=w(f+_),b=w(_),G=C(3*f),V=C(3*f);D(m,u,y,d,G,null,V,null,v,b,t,l,n);const R=p(),F=p();return L(o,i,R,s.spatialReference),F[12]=-R[12],F[13]=-R[13],F[14]=-R[14],P(G,G,F),new U(G,b,v,V)}async _updateMessageBundle(){this.loadingMessages=!0;try{this.unitsMessages=await N("esri/core/t9n/Units"),this.messages=await N("esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis")}finally{this.loadingMessages=!1}}};function I(e,t,s){if(!t||!e)return null;const o=u(t.value,t.unit,s),r=i.labelPrecisions[o];return n(e,t,o,r)}e([m({constructOnly:!0})],T.prototype,"view",void 0),e([m({constructOnly:!0})],T.prototype,"analysis",void 0),e([m({constructOnly:!0})],T.prototype,"analysisViewData",void 0),e([m()],T.prototype,"unitsMessages",void 0),e([m()],T.prototype,"messages",void 0),e([m()],T.prototype,"loadingMessages",void 0),e([m({readOnly:!0})],T.prototype,"visible",null),e([m()],T.prototype,"updating",null),e([m()],T.prototype,"hasUnsupportedError",null),T=e([d("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillVisualization")],T);class k{constructor(e,t,i,s){this.segment=e,this.previous=t,this.next=i,this.isCut=s,this._isOccluded=!1,this._n1=j(),this._n2=j();const o=y(z,_(z,e.endRenderSpace,e.startRenderSpace));y(this._n1,f(this._n1,o,y(W,_(W,t.startRenderSpace,e.startRenderSpace)))),y(this._n2,f(this._n2,o,y(W,_(W,e.startRenderSpace,i.startRenderSpace)))),this._isConvex=r.normalize(G(this._n1,this._n2,o))<0}get isOccluded(){return this._isOccluded}updateOccluded(e){_(z,this.segment.startRenderSpace,e.eye);const t=v(this._n1,z)<0,i=v(this._n2,z)<0,s=this._isOccluded;return this._isOccluded=this._isConvex?t&&i:t||i,this._isOccluded!==s}}const z=j(),W=j();export{T as VolumeMeasurementCutFillVisualization};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{removeMaybe as i,abortMaybe as r}from"../../../core/maybe.js";import{debounce as s,ignoreAbortErrors as o,throwIfAborted as a}from"../../../core/promiseUtils.js";import{watch as l,when as n,sync as u,whenOnce as d}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{Seconds as h,secondsFromMilliseconds as c}from"../../../core/time.js";import{getMetersPerVerticalUnitForSR as m}from"../../../core/unitUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as f}from"../../../geometry/ellipsoidUtils.js";import{projectOrLoad as y}from"../../../geometry/projectionUtils.js";import{fromExtent as v,intersection as w,toExtent as T,intersects as S}from"../../../geometry/support/aaBoundingRect.js";import{getInfo as b}from"../../../geometry/support/spatialReferenceUtils.js";import R from"../../../symbols/support/ElevationInfo.js";import{simulationSettingsEqual as j,getPositions as A,getFlowSimulationSettings as L}from"../../2d/engine/flow/utils.js";import U from"./SubView3D.js";import{makeScheduleFunction as x}from"./support/makeScheduleFunction.js";import{thresholdForLoadingAllTiles as P,fadeOutTime as E,fadeInTime as I,defaultTransitionDuration as M,transitionDurationFactor as q,seamlessTransitionEnabled as F,averageLoadingTimeSmoothingFactor as k}from"../support/flow/constants.js";import{isFullExtent as V,FlowQuery3D as B,wrappedWidth as C}from"../support/flow/FlowQuery3D.js";import{FlowWorkerHandle as W}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as z,createStreamlineGeometry as G}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as H}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as D}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as O}from"../support/flow/StreamlineResources3DShape.js";import{tilesAreRelated as N}from"../terrain/tileUtils.js";import{isScreenSizePerspectiveEnabled as Q}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{RibbonLineMaterial as J}from"../webgl-engine/materials/RibbonLineMaterial.js";import{isInEffectiveScaleRange as K,hasLayerBasedScaleVisibility as X}from"../../support/layerViewUtils.js";import{TaskPriority as Y}from"../../support/Scheduler.js";let Z=class extends U{constructor(e){super(e),this.type="flow",this.renderedTiles=null,this.requireLoad=!1,this.workerHandle=null,this.frameTask=null,this._averageLoadingTime=h(0),this._abortController=null,this._loadingState="ready-to-load",this._tilesUpdateIsWaiting=!1,this._debugAllowAutoLoading=!0,this.emissiveStrength=0,this._overrideMaterialParameters=null,this._overrideSimulationSettings=null,this._overrideTransitionEnabled=null,this._updateTask=null,this._debouncedTileUpdate=s(async()=>{const{allTiles:e}=this.surface,t=this._getTileFilterFunction(),i=new Set;function*r(r){for(let s=0;s<e.length;++s){const o=e.at(s);t(o)&&i.add(o),r.madeProgress(),r.done&&(r=yield)}}await this.frameTask.scheduleGenerator(r),this.renderedTiles=i})}initialize(){const{surface:e,view:t}=this,{resourceController:i}=t;this.workerHandle=new W(x(i)),this.frameTask=i.scheduler.registerTask(Y.FLOW_GENERATOR),this._updateTask=p({update:e=>this._update(e)}),this.addHandles([l(()=>this._simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>null==e&&null==t||null!=e&&null!=t&&j(e,t)}),l(()=>{const{elevationInfo:e}=this;return[this._clippingArea,this._visible,this._draped,this.view.state.contentPixelRatio,this.view.viewingMode,e?.mode,e?.offset,e?.unit]},()=>this.triggerLoad(),u),l(()=>this._materialParameters,e=>{this._resources?.setMaterialParameters(e),this._lastResources?.setMaterialParameters(e)}),e.on("tiles-changed",()=>{this.loadByTileTreesAllowed&&this._triggerTilesUpdate()}),t.enableFeatureTiles(),l(()=>[this._dataBounds,this._featureTilesBounds,this.loadAllTiles],()=>this._triggerTilesUpdate()),l(()=>this._flowRenderer,(e,t)=>{const i=t?.visualVariables??[],r=e?.visualVariables??[];r.length===i.length&&r.every((e,t)=>e.type===i[t].type)||this.clear()}),n(()=>!t.featureTiles?.updating,()=>{this.loadByTileTreesAllowed&&this._triggerTilesUpdate()})]),this._triggerTilesUpdate()}destroy(){this._updateTask=i(this._updateTask),this.abort(),this.clear()}abort(){this._abortController=r(this._abortController),this.requireLoad=!1}get _clippingArea(){const e=y(this.view.clippingArea,this.surface.spatialReference).geometry;return null==e?null:v(e)}get _dataBounds(){const e=y(this.layer.fullExtent,this.surface.spatialReference).geometry;return null==e?null:v(e)}get _draped(){return"on-the-ground"===this.elevationInfo.mode}get _ellipsoidRadius(){return f(this.view.spatialReference).radius}get loadAllTiles(){const{position:e}=this.view.camera,t=e.z;if(null==t)return!1;return t*m(e.spatialReference)/this._ellipsoidRadius>=P}get loadByTileTreesAllowed(){return!this.loadAllTiles||!this.loadRequirementsMet}get _featureTilesBounds(){const e=this.view.featureTiles?.filterExtent,t=y(e,this.surface.spatialReference).geometry;return null==t?null:v(t)}get _flowRenderer(){const e=this.layer.renderer;return"flow"!==e?.type?null:e}get _materialParameters(){return{...z(this._flowRenderer,this.layerView.fullOpacity,this.emissiveStrength),fadeInTime:I,fadeOutTime:E,...this._overrideMaterialParameters,hasSlicePlane:this.layerView.slicePlaneEnabled,screenSizePerspective:!this._draped&&Q(this.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}}get _opacity(){return this.layerView.fullOpacity}get _seamlessTransitionWaitingTime(){const{_averageLoadingTime:e}=this;return h(0===e?M:this._averageLoadingTime*q)}get _seamlessTransitionEnabled(){return null!=this._overrideTransitionEnabled?this._overrideTransitionEnabled:F}get _visible(){const e=this._flowRenderer?.color;return this.visibleAtCurrentScale&&this.layer.effectiveVisible&&this._opacity>0&&(null==e||e.a>0)}get elevationInfo(){return this.layer.elevationInfo??$}startPositions(e){if(!this._seamlessTransitionEnabled)return[];const{_flowRenderer:t,_resources:i}=this;return null==t||null==i?[]:A(i.streamlines,i.query,e,t.flowSpeed)}get needsMagnitude(){return this._flowRenderer?.hasVisualVariables()??!1}get spatialReferenceInfo(){return b(this.surface.spatialReference)}get layer(){return this.layerView.layer}get loadingState(){return this._loadingState}get loadRequirementsMet(){return null!=this.renderedTiles&&this.renderedTiles.size>0}getUpdating(){return this.updatingHandles.updating||this.requireLoad||"before-transition"===this._loadingState}get updating(){return this.getUpdating()}get visibleAtCurrentScale(){return!X()||K(this.layer.effectiveScaleRange,this.view.scale)}get _simulationSettings(){const{_flowRenderer:e,_overrideSimulationSettings:t}=this;if(null==e)return null;let i=L(e);return i.segmentLength=i.lineCollisionWidth/2,i.onlyForwardTracing=!1,null!=t&&(i={...i,...t}),i}getSimulationSettings(e){const{_simulationSettings:t,spatialReferenceInfo:i}=this;if(null==t)return null;const r="global"===this.view.viewingMode&&null!=i&&V(e.extent.xmin,e.extent.xmax,i);return{...t,wrapAround:r}}get surface(){return this.view.basemapTerrain}doRefresh(){this.triggerLoad()}clear(){this._resources?.detach(),this._resources=null,this._lastResources?.detach(),this._lastResources=null,this._loadingState="ready-to-load"}_update(e){const t=c(e.time);this._lastResources?.hasFadedOut(t)&&this._lastResources.detach();const i=this._nextStateForTransition(t);if(!this.requireLoad||this.updatingHandles.updating||"ready-to-load"!==i||!this.loadRequirementsMet)return void(this._loadingState=i);this._loadingState="loading";const r=async()=>{const e=performance.now(),i=this._seamlessTransitionEnabled&&null!=this._resources?h(t+this._seamlessTransitionWaitingTime):t;await this._load(this.renderedTiles,i);const r=h((performance.now()-e)/1e3);this._updateAverageLoadingTime(r)};this.updatingHandles.addPromise(o(r())),this.requireLoad=!1}_updateAverageLoadingTime(e){const t=k;this._averageLoadingTime=h(t*e+(1-t)*this._averageLoadingTime)}triggerLoad(){this._debugAllowAutoLoading&&(this.requireLoad=!0)}async _load(e,t){if(!this._visible)return this.clear(),void(this._loadingState="ready-to-load");const i=this._computeExtent(e);if(0===e.size||null==i)return void(this._loadingState="ready-to-load");const r=new B(i,this.layerView.timeExtent,this._viewSizeWithEqualRatio(i),this.view.state.contentPixelRatio,t);null==this._abortController&&(this._abortController=new AbortController);const s=this._abortController,o=await this._loadStreamlines(r,s.signal);if(a(s.signal),this._visible&&null!=o){this._lastResources?.detach(),this._lastResources=this._resources,this._resources=o;const e=performance.now()/1e3,i=e>t?e:t;null!=this._lastResources&&(this._lastResources.endTime=i),this._resources.startTime=i,await o.attach(),this._loadingState=this._seamlessTransitionEnabled?"before-transition":"transitioning"}else this._loadingState="ready-to-load"}async _loadStreamlines(e,t){const i=await this.fetchDataAndGenerateStreamlines(e,t);if(null==i)return null;const{geometries:r,material:s}=await this._createGeometry(e,i);return this._draped?new D(e,i,s,r,this.view.overlayManager):new O(e,i,s,r,this.view)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t){const i=new J(this._materialParameters,this.view.state.isGlobal),r=new Array,{elevationInfo:s,_draped:o,view:a}=this;function*l(l){for(let n=0;n<t.length;++n)r.push(G(a,e,t[n],s,i,o)),l.madeProgress(),l.done&&(l=yield)}return await this.frameTask.scheduleGenerator(l),{geometries:r,material:i}}_computeExtent(e){const{spatialReference:t}=this.surface;if(null==t)return null;const i=H(e,this.spatialReferenceInfo);return null==i?null:(w(i,this._clippingArea,i),T(i,t))}_triggerTilesUpdate(){if(this._tilesUpdateIsWaiting)return;this._tilesUpdateIsWaiting=!0;const e=async()=>{await d(()=>this.view.stationary),this._tilesUpdateIsWaiting=!1,await this._debouncedTileUpdate()};this.updatingHandles.addPromise(o(e()))}_getTileFilterFunction(){const{_dataBounds:e,view:i,_featureTilesBounds:r}=this;if(this.loadAllTiles)return t=>t.leaf&&ee(e,t.extent);const s=t=>t.rendered&&t.visible&&ee(e,t.extent),{featureTiles:o}=i;if(!o)return s;const a=o.tiles.filter(e=>e.measures.visible);return e=>s(e)&&ee(r,e.extent)&&a.some(({lij:i})=>t(i,e.lij)||N(i,e.lij))}_viewSizeWithEqualRatio(e){const t=C(e.xmin,e.xmax,this.spatialReferenceInfo?.valid)/(e.ymax-e.ymin),[i,r]=this.view.size;return i<r?[i,Math.floor(i/t)]:[Math.floor(r*t),r]}_nextStateForTransition(e){const{_resources:t}=this;if(null==this._flowRenderer||null==t||"ready-to-load"===this._loadingState||"loading"===this._loadingState)return this._loadingState;const i=t.startTime;return e<i?"before-transition":e<i+E?"transitioning":"ready-to-load"}get test(){}};e([g()],Z.prototype,"type",void 0),e([g()],Z.prototype,"renderedTiles",void 0),e([g()],Z.prototype,"_resources",void 0),e([g()],Z.prototype,"_lastResources",void 0),e([g()],Z.prototype,"requireLoad",void 0),e([g()],Z.prototype,"_averageLoadingTime",void 0),e([g()],Z.prototype,"_loadingState",void 0),e([g()],Z.prototype,"emissiveStrength",void 0),e([g()],Z.prototype,"_clippingArea",null),e([g()],Z.prototype,"_dataBounds",null),e([g()],Z.prototype,"_draped",null),e([g()],Z.prototype,"_ellipsoidRadius",null),e([g()],Z.prototype,"loadAllTiles",null),e([g()],Z.prototype,"_featureTilesBounds",null),e([g()],Z.prototype,"_flowRenderer",null),e([g()],Z.prototype,"_materialParameters",null),e([g()],Z.prototype,"_opacity",null),e([g()],Z.prototype,"_seamlessTransitionWaitingTime",null),e([g()],Z.prototype,"_seamlessTransitionEnabled",null),e([g()],Z.prototype,"_visible",null),e([g()],Z.prototype,"elevationInfo",null),e([g()],Z.prototype,"needsMagnitude",null),e([g()],Z.prototype,"spatialReferenceInfo",null),e([g()],Z.prototype,"layer",null),e([g()],Z.prototype,"loadingState",null),e([g()],Z.prototype,"updating",null),e([g()],Z.prototype,"visibleAtCurrentScale",null),e([g()],Z.prototype,"_overrideMaterialParameters",void 0),e([g()],Z.prototype,"_overrideSimulationSettings",void 0),e([g()],Z.prototype,"_overrideTransitionEnabled",void 0),e([g()],Z.prototype,"_simulationSettings",null),e([g()],Z.prototype,"surface",null),Z=e([_("esri.views.3d.layers.FlowSubView3D")],Z);const $=new R({mode:"on-the-ground"});function ee(e,t){return null==e||null==t||S(e,t)}export{Z as default};
5
+ import{__decorate as e}from"tslib";import{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{removeMaybe as i,abortMaybe as r}from"../../../core/maybe.js";import{debounce as s,ignoreAbortErrors as o,throwIfAborted as a}from"../../../core/promiseUtils.js";import{watch as l,when as n,sync as u,whenOnce as d}from"../../../core/reactiveUtils.js";import{addFrameTask as p}from"../../../core/scheduling.js";import{Seconds as h,secondsFromMilliseconds as c}from"../../../core/time.js";import{getMetersPerVerticalUnitForSR as m}from"../../../core/unitUtils.js";import{property as g}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{getReferenceEllipsoid as f}from"../../../geometry/ellipsoidUtils.js";import{projectOrLoad as y}from"../../../geometry/projectionUtils.js";import{fromExtent as v,intersection as w,toExtent as T,intersects as S}from"../../../geometry/support/aaBoundingRect.js";import{getInfo as b}from"../../../geometry/support/spatialReferenceUtils.js";import R from"../../../symbols/support/ElevationInfo.js";import{simulationSettingsEqual as j,getPositions as A,getFlowSimulationSettings as L}from"../../2d/engine/flow/utils.js";import U from"./SubView3D.js";import{makeScheduleFunction as x}from"./support/makeScheduleFunction.js";import{thresholdForLoadingAllTiles as P,fadeOutTime as E,fadeInTime as I,defaultTransitionDuration as M,transitionDurationFactor as q,seamlessTransitionEnabled as F,averageLoadingTimeSmoothingFactor as V}from"../support/flow/constants.js";import{isFullExtent as k,FlowQuery3D as B,wrappedWidth as C}from"../support/flow/FlowQuery3D.js";import{FlowWorkerHandle as W}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as z,createStreamlineGeometry as G}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as H}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as D}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as O}from"../support/flow/StreamlineResources3DShape.js";import{tilesAreRelated as N}from"../terrain/tileUtils.js";import{isScreenSizePerspectiveEnabled as Q}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{RibbonLineMaterial as J}from"../webgl-engine/materials/RibbonLineMaterial.js";import{isInEffectiveScaleRange as K,hasLayerBasedScaleVisibility as X}from"../../support/layerViewUtils.js";import{TaskPriority as Y}from"../../support/Scheduler.js";let Z=class extends U{constructor(e){super(e),this.type="flow",this.renderedTiles=null,this.requireLoad=!1,this.workerHandle=null,this.frameTask=null,this._averageLoadingTime=h(0),this._abortController=null,this._loadingState="ready-to-load",this._tilesUpdateIsWaiting=!1,this._debugAllowAutoLoading=!0,this.emissiveStrength=0,this._overrideMaterialParameters=null,this._overrideSimulationSettings=null,this._overrideTransitionEnabled=null,this._updateTask=null,this._debouncedTileUpdate=s(async()=>{const{allTiles:e}=this.surface,t=this._getTileFilterFunction(),i=new Set;function*r(r){for(let s=0;s<e.length;++s){const o=e.at(s);t(o)&&i.add(o),r.madeProgress(),r.done&&(r=yield)}}await this.frameTask.scheduleGenerator(r),this.renderedTiles=i})}initialize(){const{surface:e,view:t}=this,{resourceController:i}=t;this.workerHandle=new W(x(i)),this.frameTask=i.scheduler.registerTask(Y.FLOW_GENERATOR),this._updateTask=p({update:e=>this._update(e)}),this.addHandles([l(()=>this._simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>null==e&&null==t||null!=e&&null!=t&&j(e,t)}),l(()=>{const{elevationInfo:e}=this;return[this._clippingArea,this._visible,this._draped,this.view.state.contentPixelRatio,this.view.viewingMode,e?.mode,e?.offset,e?.unit]},()=>this.triggerLoad(),u),l(()=>this._materialParameters,e=>{this._resources?.setMaterialParameters(e),this._lastResources?.setMaterialParameters(e)}),e.on("tiles-changed",()=>{this.loadByTileTreesAllowed&&this._triggerTilesUpdate()}),t.enableFeatureTiles(),l(()=>[this._dataBounds,this._featureTilesBounds,this.loadAllTiles],()=>this._triggerTilesUpdate()),l(()=>this._flowRenderer,(e,t)=>{const i=t?.visualVariables??[],r=e?.visualVariables??[];r.length===i.length&&r.every((e,t)=>e.type===i[t].type)||this.clear()}),n(()=>!t.featureTiles?.updating,()=>{this.loadByTileTreesAllowed&&this._triggerTilesUpdate()})]),this._triggerTilesUpdate()}destroy(){this._updateTask=i(this._updateTask),this.abort(),this.clear()}abort(){this._abortController=r(this._abortController),this.requireLoad=!1}get _clippingArea(){const e=y(this.view.clippingArea,this.surface.spatialReference).geometry;return null==e?null:v(e)}get _dataBounds(){const e=y(this.layer.fullExtent,this.surface.spatialReference).geometry;return null==e?null:v(e)}get _draped(){return"on-the-ground"===this.elevationInfo.mode}get _ellipsoidRadius(){return f(this.view.spatialReference).radius}get loadAllTiles(){const{position:e}=this.view.camera,t=e.z;if(null==t)return!1;return t*m(e.spatialReference)/this._ellipsoidRadius>=P}get loadByTileTreesAllowed(){return!this.loadAllTiles||!this.loadRequirementsMet}get _featureTilesBounds(){const e=this.view.featureTiles?.filterExtent,t=y(e,this.surface.spatialReference).geometry;return null==t?null:v(t)}get _flowRenderer(){const e=this.layer.renderer;return"flow"!==e?.type?null:e}get _materialParameters(){return{...z(this._flowRenderer,this.layerView.fullOpacity,this.emissiveStrength),fadeInTime:I,fadeOutTime:E,...this._overrideMaterialParameters,hasSlicePlane:this.layerView.slicePlaneEnabled,screenSizePerspective:!this._draped&&Q(this.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}}get _opacity(){return this.layerView.fullOpacity}get _seamlessTransitionWaitingTime(){const{_averageLoadingTime:e}=this;return h(0===e?M:this._averageLoadingTime*q)}get _seamlessTransitionEnabled(){return null!=this._overrideTransitionEnabled?this._overrideTransitionEnabled:F}get _visible(){const e=this._flowRenderer?.color;return this.visibleAtCurrentScale&&this.layer.effectiveVisible&&this._opacity>0&&(null==e||e.a>0)}get elevationInfo(){return this.layer.elevationInfo??$}startPositions(e){if(!this._seamlessTransitionEnabled)return[];const{_flowRenderer:t,_resources:i}=this;return null==t||null==i?[]:A(i.streamlines,i.query,e,t.flowSpeed)}get needsMagnitude(){return this._flowRenderer?.hasVisualVariables()??!1}get spatialReferenceInfo(){return b(this.surface.spatialReference)}get layer(){return this.layerView.layer}get loadingState(){return this._loadingState}get loadRequirementsMet(){return null!=this.renderedTiles&&this.renderedTiles.size>0}getUpdating(){return this.updatingHandles.updating||this.requireLoad||"before-transition"===this._loadingState}get updating(){return this.getUpdating()}get visibleAtCurrentScale(){return!X()||K(this.layer.effectiveScaleRange,this.view.scale)}get _simulationSettings(){const{_flowRenderer:e,_overrideSimulationSettings:t}=this;if(null==e)return null;let i=L(e);return i.segmentLength=i.lineCollisionWidth/2,i.onlyForwardTracing=!1,null!=t&&(i={...i,...t}),i}getSimulationSettings(e){const{_simulationSettings:t,spatialReferenceInfo:i}=this;if(null==t)return null;const r="global"===this.view.viewingMode&&null!=i&&k(e.extent.xmin,e.extent.xmax,i);return{...t,wrapAround:r}}get surface(){return this.view.basemapTerrain}doRefresh(){this.triggerLoad()}clear(){this._resources?.detach(),this._resources=null,this._lastResources?.detach(),this._lastResources=null,this._loadingState="ready-to-load"}_update(e){const t=c(e.time);this._lastResources?.hasFadedOut(t)&&this._lastResources.detach();const i=this._nextStateForTransition(t);if(!this.requireLoad||this.updatingHandles.updating||"ready-to-load"!==i||!this.loadRequirementsMet)return void(this._loadingState=i);this._loadingState="loading";const r=async()=>{const e=performance.now(),i=this._seamlessTransitionEnabled&&null!=this._resources?h(t+this._seamlessTransitionWaitingTime):t;await this._load(this.renderedTiles,i);const r=h((performance.now()-e)/1e3);this._updateAverageLoadingTime(r)};this.updatingHandles.addPromise(o(r())),this.requireLoad=!1}_updateAverageLoadingTime(e){const t=V;this._averageLoadingTime=h(t*e+(1-t)*this._averageLoadingTime)}triggerLoad(){this._debugAllowAutoLoading&&(this.requireLoad=!0)}async _load(e,t){if(!this._visible)return this.clear(),void(this._loadingState="ready-to-load");const i=this._computeExtent(e);if(0===e.size||null==i)return void(this._loadingState="ready-to-load");const r=new B(i,this.layerView.timeExtent,this._viewSizeWithEqualRatio(i),this.view.state.contentPixelRatio,t);null==this._abortController&&(this._abortController=new AbortController);const s=this._abortController,o=await this._loadStreamlines(r,s.signal);if(a(s.signal),this._visible&&null!=o){this._lastResources?.detach(),this._lastResources=this._resources,this._resources=o;const e=performance.now()/1e3,i=e>t?e:t;null!=this._lastResources&&(this._lastResources.endTime=i),this._resources.startTime=i,await o.attach(),this._loadingState=this._seamlessTransitionEnabled?"before-transition":"transitioning"}else this._loadingState="ready-to-load"}async _loadStreamlines(e,t){const i=await this.fetchDataAndGenerateStreamlines(e,t);if(null==i)return null;const{geometries:r,material:s}=await this._createGeometry(e,i);return this._draped?new D(e,i,s,r,this.layerView):new O(e,i,s,r,this.view)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t){const i=new J(this._materialParameters,this.view.state.isGlobal),r=new Array,{elevationInfo:s,_draped:o,view:a}=this;function*l(l){for(let n=0;n<t.length;++n)r.push(G(a,e,t[n],s,i,o)),l.madeProgress(),l.done&&(l=yield)}return await this.frameTask.scheduleGenerator(l),{geometries:r,material:i}}_computeExtent(e){const{spatialReference:t}=this.surface;if(null==t)return null;const i=H(e,this.spatialReferenceInfo);return null==i?null:(w(i,this._clippingArea,i),T(i,t))}_triggerTilesUpdate(){if(this._tilesUpdateIsWaiting)return;this._tilesUpdateIsWaiting=!0;const e=async()=>{await d(()=>this.view.stationary),this._tilesUpdateIsWaiting=!1,await this._debouncedTileUpdate()};this.updatingHandles.addPromise(o(e()))}_getTileFilterFunction(){const{_dataBounds:e,view:i,_featureTilesBounds:r}=this;if(this.loadAllTiles)return t=>t.leaf&&ee(e,t.extent);const s=t=>t.rendered&&t.visible&&ee(e,t.extent),{featureTiles:o}=i;if(!o)return s;const a=o.tiles.filter(e=>e.measures.visible);return e=>s(e)&&ee(r,e.extent)&&a.some(({lij:i})=>t(i,e.lij)||N(i,e.lij))}_viewSizeWithEqualRatio(e){const t=C(e.xmin,e.xmax,this.spatialReferenceInfo?.valid)/(e.ymax-e.ymin),[i,r]=this.view.size;return i<r?[i,Math.floor(i/t)]:[Math.floor(r*t),r]}_nextStateForTransition(e){const{_resources:t}=this;if(null==this._flowRenderer||null==t||"ready-to-load"===this._loadingState||"loading"===this._loadingState)return this._loadingState;const i=t.startTime;return e<i?"before-transition":e<i+E?"transitioning":"ready-to-load"}get test(){}};e([g()],Z.prototype,"type",void 0),e([g()],Z.prototype,"renderedTiles",void 0),e([g()],Z.prototype,"_resources",void 0),e([g()],Z.prototype,"_lastResources",void 0),e([g()],Z.prototype,"requireLoad",void 0),e([g()],Z.prototype,"_averageLoadingTime",void 0),e([g()],Z.prototype,"_loadingState",void 0),e([g()],Z.prototype,"emissiveStrength",void 0),e([g()],Z.prototype,"_clippingArea",null),e([g()],Z.prototype,"_dataBounds",null),e([g()],Z.prototype,"_draped",null),e([g()],Z.prototype,"_ellipsoidRadius",null),e([g()],Z.prototype,"loadAllTiles",null),e([g()],Z.prototype,"_featureTilesBounds",null),e([g()],Z.prototype,"_flowRenderer",null),e([g()],Z.prototype,"_materialParameters",null),e([g()],Z.prototype,"_opacity",null),e([g()],Z.prototype,"_seamlessTransitionWaitingTime",null),e([g()],Z.prototype,"_seamlessTransitionEnabled",null),e([g()],Z.prototype,"_visible",null),e([g()],Z.prototype,"elevationInfo",null),e([g()],Z.prototype,"needsMagnitude",null),e([g()],Z.prototype,"spatialReferenceInfo",null),e([g()],Z.prototype,"layer",null),e([g()],Z.prototype,"loadingState",null),e([g()],Z.prototype,"updating",null),e([g()],Z.prototype,"visibleAtCurrentScale",null),e([g()],Z.prototype,"_overrideMaterialParameters",void 0),e([g()],Z.prototype,"_overrideSimulationSettings",void 0),e([g()],Z.prototype,"_overrideTransitionEnabled",void 0),e([g()],Z.prototype,"_simulationSettings",null),e([g()],Z.prototype,"surface",null),Z=e([_("esri.views.3d.layers.FlowSubView3D")],Z);const $=new R({mode:"on-the-ground"});function ee(e,t){return null==e||null==t||S(e,t)}export{Z as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import{EventEmitter as r}from"../../../../core/Evented.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{projectPoint as s}from"../../../../geometry/projectionUtils.js";import{create as a}from"../../../../geometry/support/aaBoundingBox.js";import{getObjectId as c}from"../../../../layers/graphics/dehydratedFeatures.js";import{OptimizedFeature as p}from"../../../../layers/graphics/OptimizedFeature.js";import n from"../../../../layers/graphics/OptimizedGeometry.js";import{optimizedFeatureQueryEngineAdapter as h}from"../../../../layers/graphics/data/optimizedFeatureQueryEngineAdapter.js";const d=a();let l=class extends e{constructor(t){super(t),this.events=new r,this.hasZ=null,this.hasM=null,this.objectIdField=null,this.featureAdapter={getAttribute:(t,e)=>"graphic"in t?t.graphic.attributes[e]:h.getAttribute(t,e),getAttributes:t=>"graphic"in t?t.graphic.attributes:h.getAttributes(t),getObjectId:t=>"graphic"in t?c(t.graphic,this.objectIdField)??void 0:h.getObjectId(t),getGeometry:t=>"graphic"in t?t.getAsOptimizedGeometry(this.hasZ,this.hasM):h.getGeometry(t),getCentroid:(t,e)=>{if("graphic"in t){let r=null;null!=t.centroid?r=t.centroid:"point"===t.graphic.geometry.type&&s(t.graphic.geometry,u,this.viewSpatialReference)&&(r=u);const o=new Array(2+(e.hasZ?1:0)+(e.hasM?1:0));return null==r?(o[0]=0,o[1]=0,o[2]=0,o[3]=0):(o[0]=r.x,o[1]=r.y,e.hasZ&&(o[2]=r.hasZ?r.z:0),e.hasM&&(o[e.hasZ?3:2]=r.hasM?r.m:0)),new n([],o)}return h.getCentroid(t,e)},cloneWithGeometry:(t,e)=>"graphic"in t?new p(e,this.featureAdapter.getAttributes(t),null,this.featureAdapter.getObjectId(t)):h.cloneWithGeometry(t,e)}}forEachInBounds(t,e){this.getSpatialIndex().forEachInBounds(t,e)}forEachBounds(t,e){const r=this.getSpatialIndex();for(const o of t){const t=this.featureAdapter.getObjectId(o);null!=r.getBounds(t,d)&&e(d)}}};t([o({constructOnly:!0})],l.prototype,"getSpatialIndex",void 0),t([o({constructOnly:!0})],l.prototype,"forEach",void 0),t([o({constructOnly:!0})],l.prototype,"hasZ",void 0),t([o({constructOnly:!0})],l.prototype,"hasM",void 0),t([o({constructOnly:!0})],l.prototype,"objectIdField",void 0),t([o({constructOnly:!0})],l.prototype,"viewSpatialReference",void 0),t([o({constructOnly:!0})],l.prototype,"featureSpatialReference",void 0),l=t([i("esri.views.3d.layers.graphics.Graphics3DFeatureStore")],l);const u={type:"point",x:0,y:0,hasZ:!1,hasM:!1,spatialReference:null};export{l as Graphics3DFeatureStore};
5
+ import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import{EventEmitter as r}from"../../../../core/Evented.js";import{property as o}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as i}from"../../../../core/accessorSupport/decorators/subclass.js";import{projectPoint as s}from"../../../../geometry/projectionUtils.js";import{create as a}from"../../../../geometry/support/aaBoundingBox.js";import{getObjectId as p}from"../../../../layers/graphics/dehydratedFeatures.js";import{OptimizedFeature as c}from"../../../../layers/graphics/OptimizedFeature.js";import n from"../../../../layers/graphics/OptimizedGeometry.js";import{optimizedFeatureQueryEngineAdapter as h}from"../../../../layers/graphics/data/optimizedFeatureQueryEngineAdapter.js";const u=a();let d=class extends e{constructor(t){super(t),this.events=new r,this.hasZ=null,this.hasM=null,this.objectIdField=null,this.featureAdapter={getAttribute:(t,e)=>"graphic"in t?t.graphic.attributes[e]:h.getAttribute(t,e),getAttributeAsTimestamp(t,e){const r=this.getAttribute(t,e);return"number"==typeof r?r:new Date(r).getTime()},getAttributes:t=>"graphic"in t?t.graphic.attributes:h.getAttributes(t),getObjectId:t=>"graphic"in t?p(t.graphic,this.objectIdField)??void 0:h.getObjectId(t),getGeometry:t=>"graphic"in t?t.getAsOptimizedGeometry(this.hasZ,this.hasM):h.getGeometry(t),getCentroid:(t,e)=>{if("graphic"in t){let r=null;null!=t.centroid?r=t.centroid:"point"===t.graphic.geometry.type&&s(t.graphic.geometry,l,this.viewSpatialReference)&&(r=l);const o=new Array(2+(e.hasZ?1:0)+(e.hasM?1:0));return null==r?(o[0]=0,o[1]=0,o[2]=0,o[3]=0):(o[0]=r.x,o[1]=r.y,e.hasZ&&(o[2]=r.hasZ?r.z:0),e.hasM&&(o[e.hasZ?3:2]=r.hasM?r.m:0)),new n([],o)}return h.getCentroid(t,e)},cloneWithGeometry:(t,e)=>"graphic"in t?new c(e,this.featureAdapter.getAttributes(t),null,this.featureAdapter.getObjectId(t)):h.cloneWithGeometry(t,e)}}forEachInBounds(t,e){this.getSpatialIndex().forEachInBounds(t,e)}forEachBounds(t,e){const r=this.getSpatialIndex();for(const o of t){const t=this.featureAdapter.getObjectId(o);null!=r.getBounds(t,u)&&e(u)}}};t([o({constructOnly:!0})],d.prototype,"getSpatialIndex",void 0),t([o({constructOnly:!0})],d.prototype,"forEach",void 0),t([o({constructOnly:!0})],d.prototype,"hasZ",void 0),t([o({constructOnly:!0})],d.prototype,"hasM",void 0),t([o({constructOnly:!0})],d.prototype,"objectIdField",void 0),t([o({constructOnly:!0})],d.prototype,"viewSpatialReference",void 0),t([o({constructOnly:!0})],d.prototype,"featureSpatialReference",void 0),d=t([i("esri.views.3d.layers.graphics.Graphics3DFeatureStore")],d);const l={type:"point",x:0,y:0,hasZ:!1,hasM:!1,spatialReference:null};export{d as Graphics3DFeatureStore};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../../../../request.js";import r from"../../../../core/Accessor.js";import{splitIntoChunks as s}from"../../../../core/arrayUtils.js";import{createTask as i,resultOrAbort as o,result as n}from"../../../../core/asyncUtils.js";import a from"../../../../core/Collection.js";import{makeHandle as d}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import c from"../../../../core/Logger.js";import{abortMaybe as h,destroyMaybe as l}from"../../../../core/maybe.js";import{estimateStringMemory as u,estimateNumberMemory as m}from"../../../../core/memoryEstimations.js";import{whenOrAbort as p,createResolver as g}from"../../../../core/promiseUtils.js";import y from"../../../../core/ReactiveSet.js";import{watch as f,sync as _}from"../../../../core/reactiveUtils.js";import{property as b}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as v}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as O}from"../../../../geometry/support/spatialReferenceUtils.js";import{formatNumber as j}from"../../../../intl/number.js";import{getMaximumQuerySize as C,queryAllJSON as w}from"../../../../layers/support/featureQueryAll.js";import{isTimeoutError as I}from"../../../../support/requestUtils.js";let F=class extends r{constructor(e){super(e),this._warnMaximumChangedObjectsExceeded=!1,this._maximumNumberOfEditOVerrides=E,this._definitionExpressionDirty=!0,this._interactiveEditingSessions=new a,this.geometryOverrides=new a,this._clientGeometryCache=new Map,this._attributeChangedObjectIds=new y,this._geometryChangedObjectIds=new y,this._pendingFetchChangedObjectIds=null,this._pendingFetchAbortController=new AbortController,this._applyGeometryOverridesTask=null,this._featureIdLocks=new Map}initialize(){this._memCache=new x(this.memoryController.newCache(`i3s-attribute-overrides-${this.layer.uid}`)),this.addHandles(f(()=>this.layer.definitionExpression,async()=>{this._definitionExpressionDirty=!0,this._pendingFetchChangedObjectIds||(this._applyGeometryOverridesTask=h(this._applyGeometryOverridesTask),this._applyGeometryOverridesTask=i(e=>this._queryAndAddGeometryOverrides(e)),await this._applyGeometryOverridesTask.promise)},_)),this._pendingFetchChangedObjectIds=this._fetchChangedObjectIds(this._pendingFetchAbortController?.signal),this._pendingFetchChangedObjectIds.finally(()=>{this._pendingFetchAbortController=null,this._pendingFetchChangedObjectIds=null})}destroy(){this._set("layer",null),this._memCache=l(this._memCache),this._pendingFetchAbortController=h(this._pendingFetchAbortController),this._pendingFetchChangedObjectIds=null,this._featureIdLocks.clear()}get is3DOFL(){return null!=this._associatedLayer?.infoFor3D}get sortedGeometryChangedObjectIds(){return this.is3DOFL?[...this._geometryChangedObjectIds].sort((e,t)=>e-t):[]}get _associatedLayer(){return null==this.layer?null:this.layer.associatedLayer}get hasGeometryChanges(){return this._geometryChangedObjectIds.size>0}get updating(){return!!this.is3DOFL&&!!(this._pendingFetchChangedObjectIds||this._applyGeometryOverridesTask&&!this._applyGeometryOverridesTask.finished)}get isEmpty(){return null==this._pendingFetchChangedObjectIds&&0===this._attributeChangedObjectIds.size&&0===this._geometryChangedObjectIds.size}featureHasGeometryChanges(e){return this._geometryChangedObjectIds.has(e)}featureHasAttributeChanges(e){return this._attributeChangedObjectIds.has(e)}createInteractiveEditSession(e){this._attributeChangedObjectIds.add(e);const t=this._interactiveEditingSessions,r=new A(e,()=>{t.remove(r)});return t.unshift(r),r}async applyAttributeOverrides(e,t,r,s=[]){if(this._pendingFetchChangedObjectIds&&await p(this._pendingFetchChangedObjectIds,r),null==t)return;const{attributeData:i,loadedAttributes:o}=t;if(null==o||null==i||0===this._attributeChangedObjectIds.size)return;const n=new Set;for(const d of o)n.add(d.index);for(const d of s)n.has(d.index)||(o.push(d),i[d.name]=new Array(e.length));const a=await this._lockFeatureIds(e);try{const t={attributeData:i,loadedAttributes:o},s=this._getOverridesFromCache(e,t,this._attributeChangedObjectIds),{objectIds:n,fieldNames:a}=s;if(0===n.length||0===a.length)return;const d=await this._queryAttributeOverridesFromAssociatedLayer(n,a,r);if(null==d)return;this._processOverridesFromAssociatedLayer(e,d,a,t)}finally{a.remove()}}updateGeometry(e,t){this._geometryChangedObjectIds.add(e);const r=this._clientGeometryCache.get(e);if(null!=r&&(this.geometryOverrides.remove(r),this._clientGeometryCache.delete(e)),null!=t){const r={oid:e,mesh:t};this.geometryOverrides.add(r),this._clientGeometryCache.set(e,r)}}updateAttributeValue(e,t,r){this._attributeChangedObjectIds.add(e),this._cacheAttributeValue(e,t,r)}featureAdded(e){this.is3DOFL&&this._geometryChangedObjectIds.add(e),this._attributeChangedObjectIds.add(e)}_cacheAttributeValue(e,t,r){this._memCache.put(e,t,r)}_getOverridesFromCache(e,{loadedAttributes:t,attributeData:r},s){const i=new Array;for(const a of t)i[a.index]=r[a.name];const o=new Set,n=new Set;for(let a=0;a<e.length;a++){const r=e[a];if(s.has(r))for(const e of t){const t=this._attributeFromCache(r,e.index);void 0===t?(o.add(r),n.add(e.name)):i[e.index][a]=t}}return{objectIds:Array.from(o),fieldNames:Array.from(n)}}_attributeFromCache(e,t){const r=this._fromInteractiveEditingSession(e,t);return void 0!==r?r:this._memCache.get(e,t)}_fromInteractiveEditingSession(e,t){if(null!=this._interactiveEditingSessions)for(const r of this._interactiveEditingSessions){if(r.objectId!==e)continue;const s=r.getAttribute(t);if(void 0!==s)return s}}async _queryAttributeOverridesFromAssociatedLayer(e,t,r){if(0===e.length)return null;this._logWarningIfMaximumObjectsExceeded();const{associatedLayer:s}=this.layer;if(null==s)return null;const i=s.createQuery(),{objectIdField:o}=s,n=[o,...t];i.where=this.layer.definitionExpression||"1=1",i.returnGeometry=!1,i.outFields=n,i.cacheHint=!0;const a=await this._executeBatchQuery(s,e,i,r),d=[];for(const c of a)if(c.ok)for(const e of c.value.features)d.push(e);return d}async _queryGeometryOverridesFromAssociatedLayer(e,t){if(0===e.length||!this.is3DOFL)return null;const r=this.layer.associatedLayer,s=r.infoFor3D,{spatialReference:i}=r,{state:{viewingMode:o},spatialReference:n}=this.view,a=1===o,d=i.isGeographic;if(a&&!d)return c.getLogger(this).warn("unsupported-pcs-edits-in-global-view",this.layer.title,S(i,n,this.view.viewingMode,0)),null;if(!a&&d)return c.getLogger(this).warn("unsupported-gcs-edits-in-local-view",this.layer.title,S(i,n,this.view.viewingMode,0)),null;if(!(O(i,n)||a&&n.isWebMercator&&i.isWGS84))return c.getLogger(this).warn("unsupported-mismatched-spatial-reference-edits",this.layer.title,S(i,n,this.view.viewingMode,1)),null;this._logWarningIfMaximumObjectsExceeded();const{objectIdField:h,globalIdField:l}=r,u=[h,...null!=l?[l]:[]],m=r.createQuery();m.where=this.layer.definitionExpression||"1=1",m.returnGeometry=!0,m.outFields=u,m.cacheHint=!0,m.returnZ=r.hasZ,m.returnM=r.hasM;const{assetMapFromAssetMapsJSON:p,extractMesh:g}=await import("../../../../rest/support/meshFeatureSet.js"),y=await this._executeBatchQuery(r,e,m,t),f=[];for(const c of y){if(!c.ok)continue;const e=c.value,{assetMaps:t,features:r,globalIdFieldName:o}=e;if(null==t)continue;const n=p(s,t);for(const a of r){const e=g(a,o,i,s,n),t=a;null!=e?(t.geometry=e,f.push(t)):t.geometry=null}}return f}_logWarningIfMaximumObjectsExceeded(){if(!this._warnMaximumChangedObjectsExceeded)return;this._warnMaximumChangedObjectsExceeded=!1;let e=`The number of edited objects that are not yet cached in the scene service exceeds the maximum limit. Attribute changes will only be available for the first ${j(this._maximumNumberOfEditOVerrides)} objects. Please consider re-caching the scene service`;const t=this.layer.portalItem;e+=t?.loaded?` (${t.portal.url}/home/item.html?id=${t.id}#settings)`:` (${this.layer.parsedUrl.path})`,c.getLogger(this).warn("#queryOverrides()",this.layer.title,`${e}.`)}async _executeBatchQuery(e,t,r,i){if(0===t.length)return[];const n=C(e);t=[...t].sort((e,t)=>e-t);const a=s(t,n).map(t=>{const s=r.clone();return s.objectIds=t,o(w(e,s,{signal:i}))});return Promise.all(a)}_processOverridesFromAssociatedLayer(e,t,r,{loadedAttributes:s,attributeData:i}){const o=this._associatedLayer;if(null==o)return;const n=o.objectIdField,a=r.map(t=>(t in i||(i[t]=new Array(e.length)),i[t])),d=new Map(s.map(e=>[e.name,e.index])),c=r.map(e=>d.get(e)),h=new Map(Array.from(e,(e,t)=>[e,t]));for(const l of t){const e=l.attributes[n];for(let t=0;t<r.length;t++){const s=c[t],i=h.get(e),o=l.attributes[r[t]];a[t][i]=o,this._cacheAttributeValue(e,s,o)}}}async _fetchChangedObjectIds(e){const r=this.layer;await r.load({signal:e}),this._geometryChangedObjectIds.clear(),this._attributeChangedObjectIds.clear();const{associatedLayer:s}=r;if(null==s||!s.capabilities?.operations?.supportsChangeTracking)return;const i=this._getFetchChangedObjectIdsServerGen();if(null==i)return;const o=s.layerId,a=this.is3DOFL,d={...s.customParameters,f:"json",returnIdsOnly:!0,layers:`[${o}]`,returnUpdates:!0,returnDeletes:a,returnInserts:a,layerServerGens:JSON.stringify([{id:o,serverGen:i}])};if(null!=s.apiKey&&(d.token=s.apiKey),a){const e=s.infoFor3D;d.fieldsToCompare=JSON.stringify({fields:[...Object.values(e.transformFieldRoles),e.sourceHashField]})}const h=await n(t(`${s.url}/extractChanges`,{method:"post",query:d,timeout:L,signal:e}));if(!h.ok&&I(h.error)){const e=this.layer.title;c.getLogger(this).warn("extractChanges:timeout",e,`${e} could not obtain edited features that are not cached in the scene service. Display of features may not be up to date with the latest edits. Consider re-caching the scene service.`)}if(h.ok&&1===h.value.data?.edits?.length){const t=h.value.data.edits[0],r=t?.objectIds,s=t?.fieldUpdates,i=r?.adds??[],o=r?.updates??[],n=r?.deletes??[],d=[...i,...o,...n],c=a?[...i,...s??o,...n]:[],l=Math.min(this._maximumNumberOfEditOVerrides,d.length);l<d.length&&(this._warnMaximumChangedObjectsExceeded=!0);const u=d.sort((e,t)=>e-t);for(let e=0;e<l;++e){const t=u[e];this._attributeChangedObjectIds.add(t)}for(const e of c)this._geometryChangedObjectIds.add(e);for(;this._definitionExpressionDirty;)await this._queryAndAddGeometryOverrides(e)}}async _queryAndAddGeometryOverrides(e){this._definitionExpressionDirty=!1;const t=this.layer,{associatedLayer:r}=t;if(null!=r&&r.capabilities?.operations?.supportsChangeTracking&&this.is3DOFL&&this._geometryChangedObjectIds.size>0){const t=await this._queryGeometryOverridesFromAssociatedLayer(Array.from(this._geometryChangedObjectIds),e);if(null!=t)for(const e of t)null!=e.geometry&&this.updateGeometry(e.attributes[r.objectIdField],e.geometry)}}_getFetchChangedObjectIdsServerGen(){const e=this.layer;if(null!=e.serviceUpdateTimeStamp?.lastUpdate)return e.serviceUpdateTimeStamp.lastUpdate;const t=e.associatedLayer;return null!=t?.serverGens?.minServerGen?t.serverGens.minServerGen:null}async _lockFeatureIds(e){const t=this._featureIdLocks;let r=!0;for(;r;){const s=new Array;for(const r of e){const e=t.get(r);e&&s.push(e)}0===s.length?r=!1:await Promise.all(s)}const s=g(),i=s.promise;for(const o of e)t.set(o,i);return d(()=>{for(const r of e)t.delete(r);s.resolve()})}get test(){}};e([b({constructOnly:!0})],F.prototype,"view",void 0),e([b({constructOnly:!0})],F.prototype,"layer",void 0),e([b({readOnly:!0})],F.prototype,"is3DOFL",null),e([b()],F.prototype,"_interactiveEditingSessions",void 0),e([b({readOnly:!0})],F.prototype,"sortedGeometryChangedObjectIds",null),e([b({readOnly:!0})],F.prototype,"geometryOverrides",void 0),e([b()],F.prototype,"_clientGeometryCache",void 0),e([b()],F.prototype,"_associatedLayer",null),e([b({constructOnly:!0})],F.prototype,"memoryController",void 0),e([b()],F.prototype,"_attributeChangedObjectIds",void 0),e([b()],F.prototype,"_geometryChangedObjectIds",void 0),e([b()],F.prototype,"hasGeometryChanges",null),e([b()],F.prototype,"_pendingFetchChangedObjectIds",void 0),e([b()],F.prototype,"_pendingFetchAbortController",void 0),e([b()],F.prototype,"_applyGeometryOverridesTask",void 0),e([b()],F.prototype,"updating",null),e([b()],F.prototype,"isEmpty",null),F=e([v("esri.views.3d.layers.i3s.I3SOverrides")],F);class A{constructor(e,t){this.objectId=e,this._remove=t,this._updates=new Map,this._isActive=!0}getAttribute(e){return this._updates.get(e)}setAttribute(e,t){this.isActive&&this._updates.set(e,t)}remove(){this.isActive&&(this._isActive=!1,this._remove())}get isActive(){return this._isActive}}class x{constructor(e){this._cache=e}destroy(){this._cache.destroy()}put(e,t,r){this._cache.put(this._getKey(e,t),new G(r))}get(e,t){return this._cache.get(this._getKey(e,t))?.value}_getKey(e,t){return`${e}-${t}`}}class G{constructor(e){this.value=e,this.usedMemory="string"==typeof e?u(e):m}}const L=1e4,E=5e4;function S(e,t,r,s){return`Displaying the edits of a SceneLayer with a${0===s?e.isGeographic?" geographic ":" projected ":" "}spatial reference (wkid:${e.wkid}) in ${r} viewing mode${1===s?` with spatial reference (wkid:${t.wkid}) `:" "}is not supported. No geometry edits will be displayed for this layer.\nPlease consider re-caching the scene service or changing the ${0===s?"viewing mode":"view spatial reference"} to display edits.`}export{F as I3SOverrides};
5
+ import{__decorate as e}from"tslib";import t from"../../../../request.js";import r from"../../../../core/Accessor.js";import{splitIntoChunks as s}from"../../../../core/arrayUtils.js";import{createTask as i,resultOrAbort as o,result as n}from"../../../../core/asyncUtils.js";import a from"../../../../core/Collection.js";import{makeHandle as d}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import c from"../../../../core/Logger.js";import{abortMaybe as h,destroyMaybe as l}from"../../../../core/maybe.js";import{estimateStringMemory as u,estimateNumberMemory as m}from"../../../../core/memoryEstimations.js";import{whenOrAbort as p,createResolver as g}from"../../../../core/promiseUtils.js";import y from"../../../../core/ReactiveSet.js";import{watch as f,sync as _}from"../../../../core/reactiveUtils.js";import{property as b}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as v}from"../../../../core/accessorSupport/decorators/subclass.js";import{equals as O}from"../../../../geometry/support/spatialReferenceUtils.js";import{formatNumber as j}from"../../../../intl/number.js";import{getMaximumQuerySize as C,queryAllJSON as w}from"../../../../layers/support/featureQueryAll.js";let I=class extends r{constructor(e){super(e),this._warnMaximumChangedObjectsExceeded=!1,this._maximumNumberOfEditOVerrides=L,this._definitionExpressionDirty=!0,this._interactiveEditingSessions=new a,this.geometryOverrides=new a,this._clientGeometryCache=new Map,this._attributeChangedObjectIds=new y,this._geometryChangedObjectIds=new y,this._pendingFetchChangedObjectIds=null,this._pendingFetchAbortController=new AbortController,this._applyGeometryOverridesTask=null,this._featureIdLocks=new Map}initialize(){this._memCache=new A(this.memoryController.newCache(`i3s-attribute-overrides-${this.layer.uid}`)),this.addHandles(f(()=>this.layer.definitionExpression,async()=>{this._definitionExpressionDirty=!0,this._pendingFetchChangedObjectIds||(this._applyGeometryOverridesTask=h(this._applyGeometryOverridesTask),this._applyGeometryOverridesTask=i(e=>this._queryAndAddGeometryOverrides(e)),await this._applyGeometryOverridesTask.promise)},_)),this._pendingFetchChangedObjectIds=this._fetchChangedObjectIds(this._pendingFetchAbortController?.signal),this._pendingFetchChangedObjectIds.finally(()=>{this._pendingFetchAbortController=null,this._pendingFetchChangedObjectIds=null})}destroy(){this._set("layer",null),this._memCache=l(this._memCache),this._pendingFetchAbortController=h(this._pendingFetchAbortController),this._pendingFetchChangedObjectIds=null,this._featureIdLocks.clear()}get is3DOFL(){return null!=this._associatedLayer?.infoFor3D}get sortedGeometryChangedObjectIds(){return this.is3DOFL?[...this._geometryChangedObjectIds].sort((e,t)=>e-t):[]}get _associatedLayer(){return null==this.layer?null:this.layer.associatedLayer}get hasGeometryChanges(){return this._geometryChangedObjectIds.size>0}get updating(){return!!this.is3DOFL&&!!(this._pendingFetchChangedObjectIds||this._applyGeometryOverridesTask&&!this._applyGeometryOverridesTask.finished)}get isEmpty(){return null==this._pendingFetchChangedObjectIds&&0===this._attributeChangedObjectIds.size&&0===this._geometryChangedObjectIds.size}featureHasGeometryChanges(e){return this._geometryChangedObjectIds.has(e)}featureHasAttributeChanges(e){return this._attributeChangedObjectIds.has(e)}createInteractiveEditSession(e){this._attributeChangedObjectIds.add(e);const t=this._interactiveEditingSessions,r=new F(e,()=>{t.remove(r)});return t.unshift(r),r}async applyAttributeOverrides(e,t,r,s=[]){if(this._pendingFetchChangedObjectIds&&await p(this._pendingFetchChangedObjectIds,r),null==t)return;const{attributeData:i,loadedAttributes:o}=t;if(null==o||null==i||0===this._attributeChangedObjectIds.size)return;const n=new Set;for(const d of o)n.add(d.index);for(const d of s)n.has(d.index)||(o.push(d),i[d.name]=new Array(e.length));const a=await this._lockFeatureIds(e);try{const t={attributeData:i,loadedAttributes:o},s=this._getOverridesFromCache(e,t,this._attributeChangedObjectIds),{objectIds:n,fieldNames:a}=s;if(0===n.length||0===a.length)return;const d=await this._queryAttributeOverridesFromAssociatedLayer(n,a,r);if(null==d)return;this._processOverridesFromAssociatedLayer(e,d,a,t)}finally{a.remove()}}updateGeometry(e,t){this._geometryChangedObjectIds.add(e);const r=this._clientGeometryCache.get(e);if(null!=r&&(this.geometryOverrides.remove(r),this._clientGeometryCache.delete(e)),null!=t){const r={oid:e,mesh:t};this.geometryOverrides.add(r),this._clientGeometryCache.set(e,r)}}updateAttributeValue(e,t,r){this._attributeChangedObjectIds.add(e),this._cacheAttributeValue(e,t,r)}featureAdded(e){this.is3DOFL&&this._geometryChangedObjectIds.add(e),this._attributeChangedObjectIds.add(e)}_cacheAttributeValue(e,t,r){this._memCache.put(e,t,r)}_getOverridesFromCache(e,{loadedAttributes:t,attributeData:r},s){const i=new Array;for(const a of t)i[a.index]=r[a.name];const o=new Set,n=new Set;for(let a=0;a<e.length;a++){const r=e[a];if(s.has(r))for(const e of t){const t=this._attributeFromCache(r,e.index);void 0===t?(o.add(r),n.add(e.name)):i[e.index][a]=t}}return{objectIds:Array.from(o),fieldNames:Array.from(n)}}_attributeFromCache(e,t){const r=this._fromInteractiveEditingSession(e,t);return void 0!==r?r:this._memCache.get(e,t)}_fromInteractiveEditingSession(e,t){if(null!=this._interactiveEditingSessions)for(const r of this._interactiveEditingSessions){if(r.objectId!==e)continue;const s=r.getAttribute(t);if(void 0!==s)return s}}async _queryAttributeOverridesFromAssociatedLayer(e,t,r){if(0===e.length)return null;this._logWarningIfMaximumObjectsExceeded();const{associatedLayer:s}=this.layer;if(null==s)return null;const i=s.createQuery(),{objectIdField:o}=s,n=[o,...t];i.where=this.layer.definitionExpression||"1=1",i.returnGeometry=!1,i.outFields=n,i.cacheHint=!0;const a=await this._executeBatchQuery(s,e,i,r),d=[];for(const c of a)if(c.ok)for(const e of c.value.features)d.push(e);return d}async _queryGeometryOverridesFromAssociatedLayer(e,t){if(0===e.length||!this.is3DOFL)return null;const r=this.layer.associatedLayer,s=r.infoFor3D,{spatialReference:i}=r,{state:{viewingMode:o},spatialReference:n}=this.view,a=1===o,d=i.isGeographic;if(a&&!d)return c.getLogger(this).warn("unsupported-pcs-edits-in-global-view",this.layer.title,E(i,n,this.view.viewingMode,0)),null;if(!a&&d)return c.getLogger(this).warn("unsupported-gcs-edits-in-local-view",this.layer.title,E(i,n,this.view.viewingMode,0)),null;if(!(O(i,n)||a&&n.isWebMercator&&i.isWGS84))return c.getLogger(this).warn("unsupported-mismatched-spatial-reference-edits",this.layer.title,E(i,n,this.view.viewingMode,1)),null;this._logWarningIfMaximumObjectsExceeded();const{objectIdField:h,globalIdField:l}=r,u=[h,...null!=l?[l]:[]],m=r.createQuery();m.where=this.layer.definitionExpression||"1=1",m.returnGeometry=!0,m.outFields=u,m.cacheHint=!0,m.returnZ=r.hasZ,m.returnM=r.hasM;const{assetMapFromAssetMapsJSON:p,extractMesh:g}=await import("../../../../rest/support/meshFeatureSet.js"),y=await this._executeBatchQuery(r,e,m,t),f=[];for(const c of y){if(!c.ok)continue;const e=c.value,{assetMaps:t,features:r,globalIdFieldName:o}=e;if(null==t)continue;const n=p(s,t);for(const a of r){const e=g(a,o,i,s,n),t=a;null!=e?(t.geometry=e,f.push(t)):t.geometry=null}}return f}_logWarningIfMaximumObjectsExceeded(){if(!this._warnMaximumChangedObjectsExceeded)return;this._warnMaximumChangedObjectsExceeded=!1;let e=`The number of edited objects that are not yet cached in the scene service exceeds the maximum limit. Attribute changes will only be available for the first ${j(this._maximumNumberOfEditOVerrides)} objects. Please consider re-caching the scene service`;const t=this.layer.portalItem;e+=t?.loaded?` (${t.portal.url}/home/item.html?id=${t.id}#settings)`:` (${this.layer.parsedUrl.path})`,c.getLogger(this).warn("#queryOverrides()",this.layer.title,`${e}.`)}async _executeBatchQuery(e,t,r,i){if(0===t.length)return[];const n=C(e);t=[...t].sort((e,t)=>e-t);const a=s(t,n).map(t=>{const s=r.clone();return s.objectIds=t,o(w(e,s,{signal:i}))});return Promise.all(a)}_processOverridesFromAssociatedLayer(e,t,r,{loadedAttributes:s,attributeData:i}){const o=this._associatedLayer;if(null==o)return;const n=o.objectIdField,a=r.map(t=>(t in i||(i[t]=new Array(e.length)),i[t])),d=new Map(s.map(e=>[e.name,e.index])),c=r.map(e=>d.get(e)),h=new Map(Array.from(e,(e,t)=>[e,t]));for(const l of t){const e=l.attributes[n];for(let t=0;t<r.length;t++){const s=c[t],i=h.get(e),o=l.attributes[r[t]];a[t][i]=o,this._cacheAttributeValue(e,s,o)}}}async _fetchChangedObjectIds(e){const r=this.layer;await r.load({signal:e}),this._geometryChangedObjectIds.clear(),this._attributeChangedObjectIds.clear();const{associatedLayer:s}=r;if(null==s||!s.capabilities?.operations?.supportsChangeTracking)return;const i=this._getFetchChangedObjectIdsServerGen();if(null==i)return;const o=s.layerId,a=this.is3DOFL,d={...s.customParameters,f:"json",returnIdsOnly:!0,layers:`[${o}]`,returnUpdates:!0,returnDeletes:a,returnInserts:a,layerServerGens:JSON.stringify([{id:o,serverGen:i}])};if(null!=s.apiKey&&(d.token=s.apiKey),a){const e=s.infoFor3D;d.fieldsToCompare=JSON.stringify({fields:[...Object.values(e.transformFieldRoles),e.sourceHashField]})}const h=await n(t(`${s.url}/extractChanges`,{method:"post",query:d,timeout:G,signal:e}));if(!h.ok){const e=this.layer.title;c.getLogger(this).warn("extractChanges:timeout",e,": could not obtain edited features that are not cached in the scene service. Display of features may not be up to date with the latest edits. Consider re-caching the scene service.")}if(h.ok&&1===h.value.data?.edits?.length){const t=h.value.data.edits[0],r=t?.objectIds,s=t?.fieldUpdates,i=r?.adds??[],o=r?.updates??[],n=r?.deletes??[],d=[...i,...o,...n],c=a?[...i,...s??o,...n]:[],l=Math.min(this._maximumNumberOfEditOVerrides,d.length);l<d.length&&(this._warnMaximumChangedObjectsExceeded=!0);const u=d.sort((e,t)=>e-t);for(let e=0;e<l;++e){const t=u[e];this._attributeChangedObjectIds.add(t)}for(const e of c)this._geometryChangedObjectIds.add(e);for(;this._definitionExpressionDirty;)await this._queryAndAddGeometryOverrides(e)}}async _queryAndAddGeometryOverrides(e){this._definitionExpressionDirty=!1;const t=this.layer,{associatedLayer:r}=t;if(null!=r&&r.capabilities?.operations?.supportsChangeTracking&&this.is3DOFL&&this._geometryChangedObjectIds.size>0){const t=await this._queryGeometryOverridesFromAssociatedLayer(Array.from(this._geometryChangedObjectIds),e);if(null!=t)for(const e of t)null!=e.geometry&&this.updateGeometry(e.attributes[r.objectIdField],e.geometry)}}_getFetchChangedObjectIdsServerGen(){const e=this.layer;if(null!=e.serviceUpdateTimeStamp?.lastUpdate)return e.serviceUpdateTimeStamp.lastUpdate;const t=e.associatedLayer;return null!=t?.serverGens?.minServerGen?t.serverGens.minServerGen:null}async _lockFeatureIds(e){const t=this._featureIdLocks;let r=!0;for(;r;){const s=new Array;for(const r of e){const e=t.get(r);e&&s.push(e)}0===s.length?r=!1:await Promise.all(s)}const s=g(),i=s.promise;for(const o of e)t.set(o,i);return d(()=>{for(const r of e)t.delete(r);s.resolve()})}get test(){}};e([b({constructOnly:!0})],I.prototype,"view",void 0),e([b({constructOnly:!0})],I.prototype,"layer",void 0),e([b({readOnly:!0})],I.prototype,"is3DOFL",null),e([b()],I.prototype,"_interactiveEditingSessions",void 0),e([b({readOnly:!0})],I.prototype,"sortedGeometryChangedObjectIds",null),e([b({readOnly:!0})],I.prototype,"geometryOverrides",void 0),e([b()],I.prototype,"_clientGeometryCache",void 0),e([b()],I.prototype,"_associatedLayer",null),e([b({constructOnly:!0})],I.prototype,"memoryController",void 0),e([b()],I.prototype,"_attributeChangedObjectIds",void 0),e([b()],I.prototype,"_geometryChangedObjectIds",void 0),e([b()],I.prototype,"hasGeometryChanges",null),e([b()],I.prototype,"_pendingFetchChangedObjectIds",void 0),e([b()],I.prototype,"_pendingFetchAbortController",void 0),e([b()],I.prototype,"_applyGeometryOverridesTask",void 0),e([b()],I.prototype,"updating",null),e([b()],I.prototype,"isEmpty",null),I=e([v("esri.views.3d.layers.i3s.I3SOverrides")],I);class F{constructor(e,t){this.objectId=e,this._remove=t,this._updates=new Map,this._isActive=!0}getAttribute(e){return this._updates.get(e)}setAttribute(e,t){this.isActive&&this._updates.set(e,t)}remove(){this.isActive&&(this._isActive=!1,this._remove())}get isActive(){return this._isActive}}class A{constructor(e){this._cache=e}destroy(){this._cache.destroy()}put(e,t,r){this._cache.put(this._getKey(e,t),new x(r))}get(e,t){return this._cache.get(this._getKey(e,t))?.value}_getKey(e,t){return`${e}-${t}`}}class x{constructor(e){this.value=e,this.usedMemory="string"==typeof e?u(e):m}}const G=1e4,L=5e4;function E(e,t,r,s){return`Displaying the edits of a SceneLayer with a${0===s?e.isGeographic?" geographic ":" projected ":" "}spatial reference (wkid:${e.wkid}) in ${r} viewing mode${1===s?` with spatial reference (wkid:${t.wkid}) `:" "}is not supported. No geometry edits will be displayed for this layer.\nPlease consider re-caching the scene service or changing the ${0===s?"viewing mode":"view spatial reference"} to display edits.`}export{I as I3SOverrides};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import i from"../../../../Color.js";import e from"../../../../core/Accessor.js";import{isSome as r}from"../../../../core/arrayUtils.js";import{makeHandle as s,destroyHandle as o}from"../../../../core/handleUtils.js";import{watch as h,syncAndInitial as p}from"../../../../core/reactiveUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{initializeProjection as c,project as n}from"../../../../geometry/projectionUtils.js";import{GraphicsCollection as g}from"../../../../support/GraphicsCollection.js";import m from"../../../../symbols/SimpleFillSymbol.js";import u from"../../../../symbols/SimpleLineSymbol.js";import d from"../../../../symbols/SimpleMarkerSymbol.js";import{getHighlightGraphics as y}from"../../../layers/support/highlightUtils.js";let w=class extends e{get updating(){return this.graphicsView?.updating??!1}constructor(t){super(t),this._highlightCounts=new Map,this._graphicsViewLoader=null,this.graphics=new g,this.graphicsView=null,this.suspended=!1;const e=new i([255,255,255,1/255]);this._symbols=new Map([["point",new d({size:"2px",style:"square",color:e})],["polyline",new u({width:"2px",color:e})],["polygon",new m({outline:null,color:e})]])}highlight(t,i){const e=y(t);if(0===e.length)return s();let r,o=!1;return this.updatingHandles.addPromise(Promise.all([this._createHighlightGraphics(e),this._ensureGraphicsView3D()]).then(([t,e])=>{!o&&e&&(r=this._addHighlightGraphics(e,t,i))})),s(()=>{o=!0,r?.remove()})}preload(){this._ensureGraphicsView3D()}_addHighlightGraphics(t,i,e){for(const s of i)this._highlightCounts.set(s,(this._highlightCounts.get(s)??0)+1);this.graphics.addMany(i);const r=t.highlight(i,e);return s(()=>{this._removeHighlightGraphics(i),r.remove()})}_removeHighlightGraphics(t){this.graphics.removeMany(t.filter(t=>{const i=Math.max(0,(this._highlightCounts.get(t)??0)-1);return 0===i?(this._highlightCounts.delete(t),!0):(this._highlightCounts.set(t,i),!1)}))}async _ensureGraphicsView3D(){if(this.graphicsView)return this.graphicsView;this._graphicsViewLoader||(this._graphicsViewLoader=import("../GraphicsView3D.js"));const{default:t}=await this._graphicsViewLoader;if(this.destroyed)return null;const i=new t({view:this.view,layer:this.layer,getGraphics:()=>this.graphics,drapeSourcePriorityOffset:.5});return this._set("graphicsView",i),this.addHandles([o(this.graphicsView),h(()=>this.suspended,t=>{i.suspended=t},p)]),i}async _createHighlightGraphics(t){const i=t.map(({geometry:t})=>t?.spatialReference).filter(r).reduce((t,i)=>(0!==t.length&&t.at(-1)?.equals(i)||t.push(i),t),[]),e=this.view.spatialReference,s=i.map(t=>({source:t,dest:e}));try{await c(s)}catch{return[]}return t.map(t=>{const{geometry:i}=t;try{const r=i?n(i,e):null,s=t.cloneShallow();return s.geometry=r,s.symbol=this._symbols.get(r?.type),s}catch{return t}})}};t([a()],w.prototype,"graphics",void 0),t([a()],w.prototype,"graphicsView",void 0),t([a()],w.prototype,"view",void 0),t([a()],w.prototype,"layer",void 0),t([a()],w.prototype,"updatingHandles",void 0),t([a()],w.prototype,"suspended",void 0),t([a()],w.prototype,"updating",null),w=t([l("esri.views.3d.layers.support.ImageHighlightHelper3D")],w);export{w as ImageHighlightHelper3D};
5
+ import{__decorate as i}from"tslib";import e from"../../../../Color.js";import t from"../../../../core/Accessor.js";import{isSome as r}from"../../../../core/arrayUtils.js";import{makeHandle as s,destroyHandle as o}from"../../../../core/handleUtils.js";import{watch as h,syncAndInitial as p}from"../../../../core/reactiveUtils.js";import{property as a}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import{subclass as l}from"../../../../core/accessorSupport/decorators/subclass.js";import{initializeProjection as n,project as c}from"../../../../geometry/projectionUtils.js";import{GraphicsCollection as g}from"../../../../support/GraphicsCollection.js";import m from"../../../../symbols/SimpleFillSymbol.js";import d from"../../../../symbols/SimpleLineSymbol.js";import u from"../../../../symbols/SimpleMarkerSymbol.js";import{getHighlightGraphics as y}from"../../../layers/support/highlightUtils.js";let w=class extends t{get updating(){return this.graphicsView?.updating??!1}constructor(i){super(i),this._highlightCounts=new Map,this._graphicsViewLoader=null,this.graphics=new g,this.graphicsView=null,this.suspended=!1;const t=new e([255,255,255,1/255]);this._symbols=new Map([["point",new u({size:"2px",style:"square",color:t})],["polyline",new d({width:"2px",color:t})],["polygon",new m({outline:null,color:t})]])}highlight(i,e){const t=y(i);if(0===t.length)return s();let r,o=!1;return this.updatingHandles.addPromise(Promise.all([this._createHighlightGraphics(t),this._ensureGraphicsView3D()]).then(([i,t])=>{!o&&t&&(r=this._addHighlightGraphics(t,i,e))})),s(()=>{o=!0,r?.remove()})}preload(){this._ensureGraphicsView3D()}_addHighlightGraphics(i,e,t){for(const s of e)this._highlightCounts.set(s,(this._highlightCounts.get(s)??0)+1);this.graphics.addMany(e);const r=i.highlight(e,t);return s(()=>{this._removeHighlightGraphics(e),r.remove()})}_removeHighlightGraphics(i){this.graphics.removeMany(i.filter(i=>{const e=Math.max(0,(this._highlightCounts.get(i)??0)-1);return 0===e?(this._highlightCounts.delete(i),!0):(this._highlightCounts.set(i,e),!1)}))}async _ensureGraphicsView3D(){if(this.graphicsView)return this.graphicsView;this._graphicsViewLoader||(this._graphicsViewLoader=import("../GraphicsView3D.js"));const{default:i}=await this._graphicsViewLoader;if(this.destroyed)return null;const e=new i({view:this.view,layer:{type:"graphics-view-3d-dummy",id:this.layer.id,uid:this.layer.uid,elevationInfo:{mode:"on-the-ground"}},getGraphics:()=>this.graphics,drapeSourcePriorityOffset:.5});return this._set("graphicsView",e),this.addHandles([o(this.graphicsView),h(()=>this.suspended,i=>{e.suspended=i},p)]),e}async _createHighlightGraphics(i){const e=i.map(({geometry:i})=>i?.spatialReference).filter(r).reduce((i,e)=>(0!==i.length&&i.at(-1)?.equals(e)||i.push(e),i),[]),t=this.view.spatialReference,s=e.map(i=>({source:i,dest:t}));try{await n(s)}catch{return[]}return i.map(i=>{const{geometry:e}=i;try{const r=e?c(e,t):null,s=i.cloneShallow();return s.geometry=r,s.symbol=this._symbols.get(r?.type),s}catch{return i}})}};i([a()],w.prototype,"graphics",void 0),i([a()],w.prototype,"graphicsView",void 0),i([a()],w.prototype,"view",void 0),i([a()],w.prototype,"layer",void 0),i([a()],w.prototype,"updatingHandles",void 0),i([a()],w.prototype,"suspended",void 0),i([a()],w.prototype,"updating",null),w=i([l("esri.views.3d.layers.support.ImageHighlightHelper3D")],w);export{w as ImageHighlightHelper3D};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as t}from"tslib";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{loadImagery as s}from"../../../2d/engine/flow/dataUtils.js";import r from"../../layers/FlowSubView3D.js";let i=class extends r{constructor(t){super(t)}initialize(){this.updatingHandles.add(()=>this.renderedTiles,()=>this.triggerLoad())}async fetchDataAndGenerateStreamlines(t,e){const{needsMagnitude:r,workerHandle:i}=this,o=this.getSimulationSettings(t),{size:n,extent:a,timeExtent:l}=t;if(null==o||null==i)return;const d=await s(this.layer,a,n[0],n[1],l,e);if(null==d)return null;const u={simulationSettings:o,flowExtentInfo:t.flowExtentInfo,flowData:d,needsMagnitude:r,startPositions:this.startPositions(t)},{streamlines:m}=await i.generateStreamlines(u,e);return m}};i=t([e("esri.views.3d.support.flow.FlowSubViewExtent3D")],i);export{i as default};
5
+ import{__decorate as e}from"tslib";import{makeHandle as t}from"../../../../core/handleUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{loadImagery as s}from"../../../2d/engine/flow/dataUtils.js";import o from"../../layers/FlowSubView3D.js";let i=class extends o{constructor(e){super(e)}initialize(){this.updatingHandles.add(()=>this.renderedTiles,()=>this.triggerLoad()),this.updatingHandles.add(()=>this.elevationInfo.mode,e=>this._updatePopupDrapeSource(e),{initial:!0})}_updatePopupDrapeSource(e){if("on-the-ground"===e)return void this.removeHandles(a);if(this.hasHandles(a))return;const r={destroyed:!1,drapeSourceType:2,updatePolicy:0,layer:this.layer},s=this.layerView.view.overlayManager;s.registerGeometryDrapeSource(r),this.addHandles(t(()=>s.unregisterDrapeSource(r)),a)}async fetchDataAndGenerateStreamlines(e,t){const{needsMagnitude:r,workerHandle:o}=this,i=this.getSimulationSettings(e),{size:a,extent:n,timeExtent:l}=e;if(null==i||null==o)return;const d=await s(this.layer,n,a[0],a[1],l,t);if(null==d)return null;const u={simulationSettings:i,flowExtentInfo:e.flowExtentInfo,flowData:d,needsMagnitude:r,startPositions:this.startPositions(e)},{streamlines:p}=await o.generateStreamlines(u,t);return p}};i=e([r("esri.views.3d.support.flow.FlowSubViewExtent3D")],i);const a=Symbol("popupDrapeSource");export{i as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.34/esri/copyright.txt for details.
4
4
  */
5
- import{destroyMaybe as e}from"../../../../core/maybe.js";import{StreamlineResources3D as r}from"./StreamlineResources3D.js";import{RenderGeometry as t}from"../../webgl-engine/lib/RenderGeometry.js";class a extends r{constructor(e,r,t,a,s){super(e,r,t,a),this._overlayManager=s,this._drapeRenderer=null,this.drapeSourceType=2,this.updatePolicy=0,this.renderGroup=0}get attached(){return null!=this._drapeRenderer}get destroyed(){return this.attached}async attach(){const{geometries:e}=this;null!=e&&(this.detach(),this._drapeRenderer=this._overlayManager.registerGeometryDrapeSource(this),this._drapeRenderer.addGeometries(e.map(e=>new t(e)),0))}detach(){this.attached&&(this._overlayManager.unregisterDrapeSource(this),this._drapeRenderer=e(this._drapeRenderer))}}export{a as StreamlineResources3DOverlay};
5
+ import{removeMaybe as e,destroyMaybe as r}from"../../../../core/maybe.js";import{streamlinGeometryBatchSize as t}from"./constants.js";import{StreamlineResources3D as s}from"./StreamlineResources3D.js";import{RenderGeometry as i}from"../../webgl-engine/lib/RenderGeometry.js";import{TaskPriority as a}from"../../../support/Scheduler.js";class h extends s{constructor(e,r,t,s,i){super(e,r,t,s),this._layerView=i,this._drapeRenderer=null,this.drapeSourceType=2,this.updatePolicy=0,this.renderGroup=0,this._frameTask=null,this._renderGeometries=[]}get _view(){return this._layerView.view}get layer(){return this._layerView.layer}get fullOpacity(){return this._layerView.fullOpacity}get attached(){return null!=this._drapeRenderer}get destroyed(){return this.attached}async attach(){const{geometries:e}=this;null!=e&&(this.detach(),this._frameTask=this._view.resourceController.scheduler.registerTask(a.FLOW_GENERATOR),await this._frameTask.scheduleGenerator(r=>this._addGeometryToOverlay(e,r)))}async*_addGeometryToOverlay(e,r){this._drapeRenderer=this._view.overlayManager.registerGeometryDrapeSource(this);for(let s=0;s<e.length;s+=t){const a=e.slice(s,s+t).map(e=>new i(e));this._drapeRenderer.addGeometries(a,0),this._renderGeometries.push(...a),this._drapeRenderer.commitChanges(),r.madeProgress(),r.done&&(r=yield)}}detach(){this._frameTask=e(this._frameTask),this._drapeRenderer&&(this._drapeRenderer.removeGeometries(this._renderGeometries,2),this._drapeRenderer.commitChanges(),this._renderGeometries.length=0),this.attached&&this._view.overlayManager.unregisterDrapeSource(this),this._drapeRenderer=r(this._drapeRenderer)}}export{h as StreamlineResources3DOverlay};