@arcgis/core 6.0.0-next.30 → 6.0.0-next.32

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 (147) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/0694c7bcfe71692e2ccf.js +1 -0
  3. package/assets/esri/core/workers/chunks/{e2c6cd8dac01e129ccfe.js → 0e445ec3523de9f2dfa2.js} +1 -1
  4. package/assets/esri/core/workers/chunks/0f6c0d42100c21367e5c.js +1 -0
  5. package/assets/esri/core/workers/chunks/{242a77066ac5cdb5b7d7.js → 14d81280807a3d3c1b7e.js} +1 -1
  6. package/assets/esri/core/workers/chunks/16cda273927ab0a39544.js +1 -0
  7. package/assets/esri/core/workers/chunks/1a3f71c4d97c36050030.js +1 -0
  8. package/assets/esri/core/workers/chunks/{ba4520ddcb6a49988da6.js → 1a8d8274df292d65f82e.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{0b4481b57a611b15f65c.js → 1eaf8bfdd3765a90ccc2.js} +1 -1
  10. package/assets/esri/core/workers/chunks/29cc6b1705418b1be5d7.js +1 -0
  11. package/assets/esri/core/workers/chunks/2de077c7b971f2c215a6.js +1 -0
  12. package/assets/esri/core/workers/chunks/{fefdd10bdd5a4c8d8ed0.js → 360c944c610efa2051fc.js} +3 -3
  13. package/assets/esri/core/workers/chunks/{8ca2bb3c0551bb1898b6.js → 3fdcc383bbd9cf0d274c.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{cc97e4fd0dacad970a23.js → 46453ebfee17b5421d9d.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{64b360625c68cb863a08.js → 487c46d5245cfb35c4bb.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{ad21757d78e372fa2ed6.js → 4a979fce1c971b614a18.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{b5eff28cf482d920b9ea.js → 4d18b48d4a282a0f341c.js} +1 -1
  18. package/assets/esri/core/workers/chunks/4d8833f48348cbbcc947.js +1 -0
  19. package/assets/esri/core/workers/chunks/52a0aa2d19a495e48ab1.js +1 -0
  20. package/assets/esri/core/workers/chunks/{865cebc5c982c040ab6f.js → 55a9eaeb152a3abada67.js} +1 -1
  21. package/assets/esri/core/workers/chunks/572aec57593a08b8045b.js +1 -0
  22. package/assets/esri/core/workers/chunks/{9d40786c5ceface786ba.js → 601e1d020b8115497944.js} +1 -1
  23. package/assets/esri/core/workers/chunks/6029773458ab98600f67.js +1 -0
  24. package/assets/esri/core/workers/chunks/6b5c073dddd89d06ed80.js +1 -0
  25. package/assets/esri/core/workers/chunks/{7030a4d0714a35995a58.js → 6bb191b19ce43a27f205.js} +1 -1
  26. package/assets/esri/core/workers/chunks/6f6d1873753a9c6994aa.js +1 -0
  27. package/assets/esri/core/workers/chunks/7084dd6e10c6c1393e92.js +1 -0
  28. package/assets/esri/core/workers/chunks/7cc9d7a88b64e25fce14.js +1 -0
  29. package/assets/esri/core/workers/chunks/7e211d8a8ad6c6a7cf3e.js +1 -0
  30. package/assets/esri/core/workers/chunks/853563c66ecf58d53d36.js +1 -0
  31. package/assets/esri/core/workers/chunks/{c90388932a7825d9d933.js → 85de980c5b296ec69323.js} +1 -1
  32. package/assets/esri/core/workers/chunks/89dc49e784f7ba3b93ea.js +1 -0
  33. package/assets/esri/core/workers/chunks/8da2a10318f49d0dc73a.js +1 -0
  34. package/assets/esri/core/workers/chunks/8e6276ddd8d094c61f08.js +1 -0
  35. package/assets/esri/core/workers/chunks/{71f792a20077aa739f87.js → a607541959169741a943.js} +1 -1
  36. package/assets/esri/core/workers/chunks/b2d6b1ac9fbb50c7c8ab.js +1 -0
  37. package/assets/esri/core/workers/chunks/b657363113f4a37e634b.js +1 -0
  38. package/assets/esri/core/workers/chunks/b9cb92858a576eb6aa06.js +1 -0
  39. package/assets/esri/core/workers/chunks/{12b84262dedc6b393136.js → d9a240a3c6bf85124474.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{8f008eedb11685ee2048.js → e096c1d9d53af74d3207.js} +1 -1
  41. package/assets/esri/core/workers/chunks/e4e2edfdc85dd14e66d4.js +1 -0
  42. package/assets/esri/core/workers/chunks/f4d91d470ca5fea0bd26.js +1 -0
  43. package/assets/esri/core/workers/chunks/f717005e14a7e9141df7.js +1 -0
  44. package/assets/esri/core/workers/chunks/f75eec2cbc541eec9712.js +1 -0
  45. package/assets/esri/core/workers/chunks/fcc3902d6d9eda6f09f5.js +1 -0
  46. package/assets/esri/core/workers/chunks/{28a821de9dbf10324033.js → fd031150d3a7f896e6b3.js} +1 -1
  47. package/config.js +1 -1
  48. package/core/scheduling.js +1 -1
  49. package/geometry/Mesh.d.ts +2 -125
  50. package/geometry/Mesh.js +1 -1
  51. package/geometry/support/GlobalCoordinateSystem.js +2 -0
  52. package/geometry/support/LocalCoordinateSystem.js +2 -0
  53. package/geometry/support/boundedPlane.js +1 -1
  54. package/geometry/support/coordinateSystem.js +1 -1
  55. package/geometry/support/meshErrors.js +1 -1
  56. package/geometry/support/plane.js +1 -1
  57. package/geometry/support/polygonUtils.js +1 -1
  58. package/geometry/support/ray.js +1 -1
  59. package/geometry/support/sphere.js +1 -1
  60. package/interfaces.d.ts +0 -3
  61. package/kernel.js +1 -1
  62. package/layers/SceneLayer.js +1 -1
  63. package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
  64. package/layers/knowledgeGraph/KnowledgeGraphLayerDataManager.js +1 -1
  65. package/layers/mixins/ArcGISImageService.js +1 -1
  66. package/layers/raster/functions/rasterProjectionHelper.js +1 -1
  67. package/layers/support/featureLayerUtils.js +1 -1
  68. package/package.json +2 -2
  69. package/support/arcadeUtils.js +1 -1
  70. package/views/2d/engine/webgl/SpriteMosaic.js +1 -1
  71. package/views/2d/interactive/editingTools/TransformTool.js +1 -1
  72. package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
  73. package/views/2d/layers/ImageryLayerView2D.js +1 -1
  74. package/views/3d/analysis/LineOfSight/LineOfSightConfiguration.js +1 -1
  75. package/views/3d/analysis/LineOfSight/LineOfSightEditTool.js +1 -1
  76. package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
  77. package/views/3d/analysis/LineOfSight/LineOfSightManipulators.js +1 -1
  78. package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
  79. package/views/3d/analysis/Slice/SliceController.js +1 -1
  80. package/views/3d/analysis/Slice/SliceTool.js +1 -1
  81. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  82. package/views/3d/analysis/Viewshed/ViewshedFieldOfViewManipulation.js +1 -1
  83. package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +1 -1
  84. package/views/3d/environment/SunLighting.d.ts +10 -8
  85. package/views/3d/environment/VirtualLighting.d.ts +10 -8
  86. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
  87. package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
  88. package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
  89. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  90. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  91. package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
  92. package/views/3d/state/ScreenSizePerspective.js +1 -1
  93. package/views/3d/support/RenderCoordsHelper.js +1 -1
  94. package/views/3d/support/ViewSlice.js +1 -1
  95. package/views/3d/support/hitTest.js +1 -1
  96. package/views/3d/support/renderInfoUtils/polygon.js +1 -1
  97. package/views/3d/terrain/PatchGeometryFactory.js +1 -1
  98. package/views/3d/terrain/PlanarPatch.js +1 -1
  99. package/views/3d/terrain/SphericalPatch.js +1 -1
  100. package/views/3d/webgl-engine/lib/Path.js +1 -1
  101. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  102. package/views/3d/webgl-engine/lib/PathExtruder.js +1 -1
  103. package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
  104. package/views/3d/webgl-engine/lib/SliceHelper.js +1 -1
  105. package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
  106. package/views/3d/webgl-engine/lib/pathGeometryUtils.js +1 -1
  107. package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
  108. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  109. package/views/interactive/snapping/featureSources/featureServiceSource/tileUtils.js +1 -1
  110. package/views/support/TextureCompressionWorker.js +1 -1
  111. package/views/webgl/Texture.js +1 -1
  112. package/webscene/Environment.d.ts +1 -1
  113. package/widgets/BatchAttributeForm/BatchAttributeFormViewModel.js +1 -1
  114. package/widgets/BatchAttributeForm/expressions/ExpressionsManager.js +1 -1
  115. package/widgets/BatchAttributeForm/inputs/RelationshipElementInput.js +1 -1
  116. package/widgets/BatchAttributeForm/inputs/support/createBatchFormInputs.js +1 -1
  117. package/widgets/BatchAttributeForm.js +1 -1
  118. package/widgets/FeatureForm.js +1 -1
  119. package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
  120. package/assets/esri/core/workers/chunks/02335385b1476fe322eb.js +0 -1
  121. package/assets/esri/core/workers/chunks/07b726a46864501b90a0.js +0 -1
  122. package/assets/esri/core/workers/chunks/189321d88026bd7e6d3e.js +0 -1
  123. package/assets/esri/core/workers/chunks/18d47ab571b613fbe719.js +0 -1
  124. package/assets/esri/core/workers/chunks/1967b9c96045a5802d08.js +0 -1
  125. package/assets/esri/core/workers/chunks/199a7f97916679e0257c.js +0 -1
  126. package/assets/esri/core/workers/chunks/1d96fbad881a7d14a950.js +0 -1
  127. package/assets/esri/core/workers/chunks/1dc6f093028530a492e6.js +0 -1
  128. package/assets/esri/core/workers/chunks/2cd60fd062d954322c1f.js +0 -1
  129. package/assets/esri/core/workers/chunks/2d3e0e4442dbc6ec6def.js +0 -1
  130. package/assets/esri/core/workers/chunks/2f5d014d6a72108b0b3a.js +0 -1
  131. package/assets/esri/core/workers/chunks/3105336a05f38a95ebea.js +0 -1
  132. package/assets/esri/core/workers/chunks/4419732baf3459a80e6d.js +0 -1
  133. package/assets/esri/core/workers/chunks/4fb2fcc95f852bf8f86c.js +0 -1
  134. package/assets/esri/core/workers/chunks/59bc55880e6fd8ce20c0.js +0 -1
  135. package/assets/esri/core/workers/chunks/5f787809b74eed7b9a91.js +0 -1
  136. package/assets/esri/core/workers/chunks/6a7de221cea4426cb490.js +0 -1
  137. package/assets/esri/core/workers/chunks/7a0b4dc0cda190367a39.js +0 -1
  138. package/assets/esri/core/workers/chunks/7d3f7940815fa5dc244e.js +0 -1
  139. package/assets/esri/core/workers/chunks/999c23da883eb11cb29e.js +0 -1
  140. package/assets/esri/core/workers/chunks/9bc3afe7013ef4ae737b.js +0 -1
  141. package/assets/esri/core/workers/chunks/bab1d010970d98c25470.js +0 -1
  142. package/assets/esri/core/workers/chunks/c4f78a481f43cfae7b63.js +0 -1
  143. package/assets/esri/core/workers/chunks/dcf6024dc19428ff2b9d.js +0 -1
  144. package/assets/esri/core/workers/chunks/e04fb83ab2634bc15cc7.js +0 -1
  145. package/assets/esri/core/workers/chunks/ee0dc906cc7979080329.js +0 -1
  146. package/assets/esri/core/workers/chunks/f0d0ed155275c2e6d3da.js +0 -1
  147. package/chunks/boundedPlane.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{id as e}from"../../kernel.js";import{isPopupTemplate as t}from"../../popupTemplateUtils.js";import{resultOrAbort as n}from"../../core/asyncUtils.js";import r from"../../core/Error.js";import{JSONMap as i}from"../../core/jsonMap.js";import a from"../../core/Logger.js";import{parseWhereClause as o}from"../../core/sql.js";import{normalizeGlobalID as s}from"../../core/uuid.js";import{createTypeReader as c}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import{isHostedAgolService as l}from"./arcgisLayerUrl.js";import u from"./CodedValue.js";import d from"./CodedValueDomain.js";import{queryAllJSON as f}from"./featureQueryAll.js";import{isStringField as p,isIntegerField as m}from"./fieldUtils.js";import{isLabelClass as h}from"./labelUtils.js";import{isLayerWithFeatureCapabilities as ee,getOwningPortalUrl as g}from"./layerUtils.js";import _ from"../../renderers/SimpleRenderer.js";import te from"../../renderers/UniqueValueRenderer.js";import{isSizeVariable as v}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import y from"../../rest/support/AttachmentQuery.js";import{normalizationTypeJsonMap as ne}from"../../rest/support/NormalizationBinParametersMixin.js";import b from"../../rest/support/Query.js";import x from"../../rest/support/RelationshipQuery.js";import{loadArcade as S}from"../../support/loadArcade.js";import{symbolTypesRenderer as C}from"../../symbols/support/typeUtils.js";const w=()=>a.getLogger(`esri.layers.support.featureLayerUtils`),T=new i({esriGeometryPoint:`point`,esriGeometryMultipoint:`multipoint`,esriGeometryPolyline:`polyline`,esriGeometryPolygon:`polygon`,esriGeometryMultiPatch:`multipatch`});async function E(e,t,n,i,a){let o=await U(e);if(await D(e,t,i),!o.addAttachment)throw new r(i,`Layer source does not support addAttachment capability`);return o.addAttachment(t,n,a)}function D(e,t,n){let{attributes:i}=t,{objectIdField:a}=e;return e.capabilities?.data?.supportsAttachment?t?i?!a||i[a]==null?Promise.reject(new r(n,`feature is missing the identifying attribute ${a}`)):Promise.resolve():Promise.reject(new r(n,`'attributes' are required on a feature to query attachments`)):Promise.reject(new r(n,`A feature is required to add/delete/update attachments`)):Promise.reject(new r(n,`this layer doesn't support attachments`))}async function re(e,t,n,i,a,o){let s=await U(e);if(await D(e,t,a),!s.updateAttachment)throw new r(a,`Layer source does not support updateAttachment capability`);return s.updateAttachment(t,n,i,o)}async function ie(e,t,n){let{applyEdits:r}=await import(`../graphics/editingSupport.js`),i=await e.load(),a=n,{url:o,type:s,globalIdField:c}=i;return s===`feature`&&l(o)&&i.infoFor3D&&t.deleteFeatures!=null&&c!=null&&(a={...a,globalIdToObjectId:await J(i,t.deleteFeatures,c)}),r(i,i.source,t,a)}async function ae(e,t,n){let{uploadAssets:r}=await import(`../graphics/editingSupport.js`),i=await e.load();return r(i,i.source,t,n)}async function oe(e,t,n,i,a){let o=await U(e);if(await D(e,t,i),!o.deleteAttachments)throw new r(i,`Layer source does not support deleteAttachments capability`);return o.deleteAttachments(t,n,a)}async function se(e,t,n){let i=(await e.load({signal:t?.signal})).source;if(!i.fetchRecomputedExtents)throw new r(n,`Layer source does not support fetchUpdates capability`);return i.fetchRecomputedExtents(t)}async function ce(e,t,n,i){let a=y.from(t),o=await e.load(),s=o.source,c=o.capabilities;if(!c?.data?.supportsAttachment)throw new r(i,`this layer doesn't support attachments`);let{attachmentTypes:l,objectIds:u,globalIds:d,num:f,size:p,start:m,where:h}=a;if(!c?.operations?.supportsQueryAttachments){let e=l?.length>0,t=d?.length>0,n=p?.length>0;if(e||t||n||f||m||h)throw new r(i,`when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported`,a)}if(!(u?.length||d?.length||h))throw new r(i,`'objectIds', 'globalIds', or 'where' are required to perform attachment query`,a);if(!s.queryAttachments)throw new r(i,`Layer source does not support queryAttachments capability`,a);return!c?.attachment?.supportsOrderByFields&&a.orderByFields?.length&&(a=a.clone(),a.orderByFields=null),s.queryAttachments(a)}async function le(e,t,n,i){let a=await U(e);if(!a.queryObjectIds)throw new r(i,`Layer source does not support queryObjectIds capability`);return a.queryObjectIds(b.from(t)??e.createQuery(),n)}async function O(e,t,n,i){let a=await U(e);if(!a.queryFeatureCount)throw new r(i,`Layer source does not support queryFeatureCount capability`);return a.queryFeatureCount(b.from(t)??e.createQuery(),n)}async function k(e,t,n,i){let a=await U(e);if(!a.queryExtent)throw new r(i,`Layer source does not support queryExtent capability`);return a.queryExtent(b.from(t)??e.createQuery(),n)}async function A(e,t,n,i){let a=await U(e);if(!a.queryRelatedFeatures)throw new r(i,`Layer source does not support queryRelatedFeatures capability`);return a.queryRelatedFeatures(x.from(t),n)}async function j(e,t,n,i){let a=await U(e);if(!a.queryRelatedFeaturesCount)throw new r(i,`Layer source does not support queryRelatedFeaturesCount capability`);return a.queryRelatedFeaturesCount(x.from(t),n)}async function M(e){let t=e.source;if(t?.refresh)try{let{dataChanged:n,updates:r}=await t.refresh();if(r!=null&&(e.sourceJSON={...e.sourceJSON,...r},e.read(r,{origin:`service`,url:e.parsedUrl})),n)return!0}catch{}if(e.definitionExpression)try{return(await o(e.definitionExpression,e.fieldsIndex)).hasDateFunctions}catch{}return!1}function N(e){let t=new b;t.historicMoment=e.historicMoment,t.gdbVersion=e.gdbVersion,t.returnGeometry=!0,t.outFields=[`*`],t.multipatchOption=e.geometryType===`multipatch`?`xyFootprint`:null;let n=e.capabilities?.query;n&&(t.compactGeometryEnabled=n.supportsCompactGeometry,t.defaultSpatialReferenceEnabled=n.supportsDefaultSpatialReference);let r=e.capabilities?.data;r?.supportsZ&&e.returnZ!=null&&(t.returnZ=e.returnZ),r?.supportsM&&e.returnM!=null&&(t.returnM=e.returnM);let{timeOffset:i,timeExtent:a}=e;return t.timeExtent=i!=null&&a!=null?a.offset(-i.value,i.unit):a||null,t}function P(e){let{globalIdField:t,fields:n}=e;if(t)return t;if(n){for(let e of n)if(e.type===`esriFieldTypeGlobalID`)return e.name}}function F(e){let{objectIdField:t,fields:n}=e;if(t)return t;if(n){for(let e of n)if(e.type===`esriFieldTypeOID`)return e.name}}function I(e){return e.currentVersion?e.currentVersion:e.hasOwnProperty(`capabilities`)||e.hasOwnProperty(`drawingInfo`)||e.hasOwnProperty(`hasAttachments`)||e.hasOwnProperty(`htmlPopupType`)||e.hasOwnProperty(`relationships`)||e.hasOwnProperty(`timeInfo`)||e.hasOwnProperty(`typeIdField`)||e.hasOwnProperty(`types`)?10:9.3}function L(e,t,n,r){let i=n?.feature,a=!!e.subtypes?.length;if(a&&!n?.excludeImpliedDomains){let n=z(e,t);if(n)return n}let o=a&&R(e,i);if(o){let e=o?.domains?.[t];return e?.type===`inherited`?r:e}let s=Y(e.types,e.typeIdField,i);if(s){let e=s.domains&&s.domains[t];if(e&&e?.type!==`inherited`)return e}if(r)return r;if(!n?.excludeImpliedDomains){let n=B(e,t);if(n)return n}return null}function R(e,t){let{subtypes:n,subtypeField:r}=e;if(!t?.attributes||!n?.length||!r)return null;let i=t.attributes[r];return i==null?null:n.find(e=>e.code===i)}function z(e,t){let{fieldsIndex:n,subtypeField:r}=e,{name:i,type:a}=n.get(t)??{};if(!i)return null;if((r&&n.get(r)?.name)===i&&e.subtypes?.length){let t=e.subtypes.map(e=>new u({code:H(e.code,a),name:e.name}));if(t?.length)return new d({codedValues:t})}return null}function B(e,t){let{fieldsIndex:n}=e,{name:r,type:i}=n.get(t)??{};if(!r)return null;if((`typeIdField`in e?n.get(e.typeIdField)?.name:null)===r&&`types`in e&&e.types?.length&&V(e.types)){let t=e.types?.map(e=>new u({code:H(e.id,i),name:e.name}));return new d({codedValues:t})}return null}function V(e){let t=new Set,n=new Set;for(let r of e){if(t.has(r.id)||n.has(r.name))return!1;t.add(r.id),n.add(r.name)}return!0}function H(e,t){return t?p({type:t})&&typeof e==`number`?`${e}`:m({type:t})&&typeof e==`string`?Number.parseInt(e,10):e:e}async function U(e){return(await e.load()).source}async function W(t,n){if(!e)return;let r=e.findCredential(t);if(r)return r.userId;let i;try{let r=await g(t,n);r&&(i=await e.checkSignInStatus(`${r}/sharing`))}catch{}return i?i.userId:null}async function G(t,n){if(!e||e.findCredential(t))return;let r;try{let i=await g(t,n);i&&(r=await e.checkSignInStatus(`${i}/sharing`))}catch{}if(r)try{let r=n==null?null:n.signal;await e.getCredential(t,{signal:r})}catch{}}async function ue(e,t,n){let r=e.parsedUrl?.path;r&&e.authenticationTriggerEvent===t&&await G(r,n)}async function de(e){let t=e.parsedUrl?.path;t&&fe(e)&&await G(t)}function fe(e){return pe(e)&&(`serviceDefinitionExpression`in e&&K(e.serviceDefinitionExpression)||`definitionExpression`in e&&K(e.definitionExpression))}function pe(e){return!!(ee(e)&&e.capabilities?.query.supportsCurrentUser)}function K(e){return!!e?.toLowerCase().includes(`current_user`)}function me(e){return X(e)?!1:e.userHasUpdateItemPrivileges||e.editingEnabled}const q=c({types:C});function he(e,t){if(e.defaultSymbol)return e.types?.length?new te({defaultSymbol:q(e.defaultSymbol,e,t),field:e.typeIdField,uniqueValueInfos:e.types.map(e=>({id:e.id,symbol:q(e.symbol,e,t)}))}):new _({symbol:q(e.defaultSymbol,e,t)})}function ge(e){let t=e.sourceJSON?.cacheMaxAge;if(!t)return!1;let n=e.editingInfo?.lastEditDate?.getTime();return n==null||(t*=1e3,Date.now()-n<t)}async function J(e,t,r){if(t==null)return null;let i=[],{objectIdField:a}=e;if(t.forEach(e=>{let t=null;if(`attributes`in e){let{attributes:n}=e;t={globalId:n[r],objectId:n[a]!=null&&n[a]!==-1?n[a]:null}}else t={globalId:e.globalId,objectId:e.objectId!=null&&e.objectId!==-1?e.objectId:null};t.globalId!=null&&(t.objectId==null||t.objectId===-1)&&i.push(t.globalId)}),i.length===0)return null;let o=e.createQuery();o.where=i.map(e=>`${r}='${e}'`).join(` OR `),o.returnGeometry=!1,o.outFields=[a,r],o.cacheHint=!1;let c=await n(f(e,o));if(!c.ok)return null;let l=new Map,u=c.value.features;for(let e of u){let t=e.attributes[r],n=e.attributes[a];t!=null&&n!=null&&n!==-1&&l.set(s(t),n)}return l}function Y(e,t,n){if(!t||!n||!e)return null;let r=n.getAttribute(t);if(r==null)return null;let i=e.filter(e=>{let{id:t}=e;return t!=null&&t.toString()===r.toString()});return i.length>1&&w().warn(`getFeatureType`,`Cannot unambiguously determine feature type because multiple types have the id ${r}.`),i[0]??null}function X(e){let t=e.sourceJSON;return t?.isMultiServicesView||t?.isReadOnly||_e(e)}function _e(e){return!!e.sourceJSON?.capabilities?.toLowerCase().split(`,`).map(e=>e.trim()).includes(`map`)}function ve(e,t,n){let i=t?.queryAttributeBins;if(!t?.operations?.supportsQueryBins||!i)throw new r(n,`Layer source does not support binning`);switch(e.binParameters?.type){case`auto-interval`:if(!i.supportsAutoInterval)throw new r(n,`Layer source does not support auto-interval binning`);if(e.binParameters.normalizationType&&!(i.supportsNormalization&&Z(e.binParameters.normalizationType,i.supportedNormalizationTypes)))throw new r(n,`Layer source does not support normalization binning`);break;case`date`:if(!i.supportsDate)throw new r(n,`Layer source does not support date binning`);if(e.binParameters.snapToData&&!i.supportsSnapToData)throw new r(n,`Layer source does not support snapToData binning`);if(e.binParameters.returnFullIntervalBin&&!i.supportsReturnFullIntervalBin)throw new r(n,`Layer source does not support returnFullIntervalBin binning`);break;case`fixed-boundaries`:if(!i.supportsFixedBoundaries)throw new r(n,`Layer source does not support fixed-boundaries binning`);break;case`fixed-interval`:if(!i.supportsFixedInterval)throw new r(n,`Layer source does not support fixed-interval binning`);if(e.binParameters.normalizationType&&!(i.supportsNormalization&&Z(e.binParameters.normalizationType,i.supportedNormalizationTypes)))throw new r(n,`Layer source does not support normalization binning`)}if(e.binParameters?.stackBy&&!i.supportsStackBy)throw new r(n,`Layer source does not support stackBy binning`);if(e.binParameters?.splitBy&&!i.supportsSplitBy)throw new r(n,`Layer source does not support splitBy binning`);if(e.binParameters?.firstDayOfWeek&&!i.supportsFirstDayOfWeek)throw new r(n,`Layer source does not support firstDayOfWeek binning`);let a=i?.supportedStatistics;if(e.outStatistics&&a){let t=new Map([[`count`,`count`],[`sum`,`sum`],[`min`,`min`],[`max`,`max`],[`avg`,`avg`],[`stddev`,`stddev`],[`var`,`var`],[`percentile-continuous`,`percentileContinuous`],[`percentile-discrete`,`percentileDiscrete`],[`centroid-aggregate`,`centroid`],[`convex-hull-aggregate`,`convexHull`],[`envelope-aggregate`,`envelope`]]);for(let{statisticType:i}of e.outStatistics){let e=t.get(i);if(e&&!a[e])throw new r(n,`Layer source does not support ${i} statistic type`)}}}function Z(e,t){return e!=null&&!!t?.[ne.toJSON(e)]}function Q(e){return h(e)?!!e.labelExpressionInfo?.expression:t(e)?e.expressionInfos?.some(e=>e.expression)?!0:Array.isArray(e.content)?e.content.some(e=>e.type===`expression`&&e.expressionInfo?.expression):!1:e.type===`dot-density`&&e.attributes?.some(e=>e.valueExpression)||`valueExpression`in e&&e.valueExpression?!0:`visualVariables`in e&&e.visualVariables!=null&&e.visualVariables.some(e=>e.valueExpression?!0:e.type===`size`?v(e.minSize)&&e.minSize.valueExpression||v(e.maxSize)&&e.maxSize.valueExpression:!1)}function ye(e){if(`renderer`in e&&e.renderer&&Q(e.renderer))return!0;if(`labelingInfo`in e&&e.labelingInfo){for(let t of e.labelingInfo)if(h(t)&&Q(t))return!0}return!1}async function be(e){let t=`returnZ`in e?e.returnZ:void 0,n=`returnM`in e?e.returnM:void 0;if(t!=null&&n!=null)return{returnZ:t,returnM:n};if(ye(e)){let{arcadeUtils:r}=await S();r.layerHasGeometryFunctions(e)&&(t??=!0,n??=!0)}if(`renderer`in e&&e.renderer?.symbols)for(let t of e.renderer.symbols)t.type===`cim`&&($??=(await import(`../../symbols/cim/CIMSymbolHelper.js`)).forEachSymbolLayer,$(t.data.symbol,e=>{switch(e.type){case`CIMPictureMarker`:case`CIMVectorMarker`:e.markerPlacement?.type===`CIMMarkerPlacementAtMeasuredUnits`&&(n??=!0)}}));return{returnZ:t,returnM:n}}let $;export{E as addAttachment,ie as applyEdits,de as checkServiceCurrentUserSupport,z as computeDomainFromSubtypes,B as computeDomainFromTypes,me as computeEffectiveEditingEnabled,he as createDefaultRenderer,N as createQuery,oe as deleteAttachments,G as ensureCredentialIfSignedIn,ue as ensureLayerCredential,se as fetchRecomputedExtents,T as geometryTypeKebabDict,R as getFeatureSubtype,Y as getFeatureType,L as getFieldDomain,J as getGlobalIdToObjectIdMap,W as getSignedInUser,K as hasCurrentUser,M as hasDataChanged,ge as isLayerCacheStale,be as layerRequiresGeometryZM,ce as queryAttachments,k as queryExtent,O as queryFeatureCount,le as queryObjectIds,A as queryRelatedFeatures,j as queryRelatedFeaturesCount,P as readGlobalIdField,F as readObjectIdField,I as readVersion,X as supportsQueryOnly,V as typesHaveUniqueIdsAndNames,re as updateAttachment,ae as uploadAssets,ve as validateBinsQuery};
2
+ import{id as e}from"../../kernel.js";import{isPopupTemplate as t}from"../../popupTemplateUtils.js";import{resultOrAbort as n}from"../../core/asyncUtils.js";import r from"../../core/Error.js";import{JSONMap as i}from"../../core/jsonMap.js";import a from"../../core/Logger.js";import{parseWhereClause as o}from"../../core/sql.js";import{normalizeGlobalID as s}from"../../core/uuid.js";import{createTypeReader as c}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import{isHostedAgolService as l}from"./arcgisLayerUrl.js";import u from"./CodedValue.js";import d from"./CodedValueDomain.js";import{queryAllJSON as f}from"./featureQueryAll.js";import{isStringField as p,isIntegerField as m}from"./fieldUtils.js";import{isLabelClass as h}from"./labelUtils.js";import{isLayerWithFeatureCapabilities as ee,getOwningPortalUrl as g}from"./layerUtils.js";import _ from"../../renderers/SimpleRenderer.js";import te from"../../renderers/UniqueValueRenderer.js";import{isSizeVariable as v}from"../../renderers/visualVariables/support/sizeVariableUtils.js";import y from"../../rest/support/AttachmentQuery.js";import{normalizationTypeJsonMap as ne}from"../../rest/support/NormalizationBinParametersMixin.js";import b from"../../rest/support/Query.js";import x from"../../rest/support/RelationshipQuery.js";import{loadArcade as S}from"../../support/loadArcade.js";import{symbolTypesRenderer as C}from"../../symbols/support/typeUtils.js";const w=()=>a.getLogger(`esri.layers.support.featureLayerUtils`),T=new i({esriGeometryPoint:`point`,esriGeometryMultipoint:`multipoint`,esriGeometryPolyline:`polyline`,esriGeometryPolygon:`polygon`,esriGeometryMultiPatch:`multipatch`});async function E(e,t,n,i,a){let o=await U(e);if(await D(e,t,i),!o.addAttachment)throw new r(i,`Layer source does not support addAttachment capability`);return o.addAttachment(t,n,a)}function D(e,t,n){let{attributes:i}=t,{objectIdField:a}=e;return e.capabilities?.data?.supportsAttachment?t?i?!a||i[a]==null?Promise.reject(new r(n,`feature is missing the identifying attribute ${a}`)):Promise.resolve():Promise.reject(new r(n,`'attributes' are required on a feature to query attachments`)):Promise.reject(new r(n,`A feature is required to add/delete/update attachments`)):Promise.reject(new r(n,`this layer doesn't support attachments`))}async function re(e,t,n,i,a,o){let s=await U(e);if(await D(e,t,a),!s.updateAttachment)throw new r(a,`Layer source does not support updateAttachment capability`);return s.updateAttachment(t,n,i,o)}async function ie(e,t,n){let{applyEdits:r}=await import(`../graphics/editingSupport.js`),i=await e.load(),a=n,{url:o,type:s,globalIdField:c}=i;return s===`feature`&&l(o)&&i.infoFor3D&&t.deleteFeatures!=null&&c!=null&&(a={...a,globalIdToObjectId:await J(i,t.deleteFeatures,c)}),r(i,i.source,t,a)}async function ae(e,t,n){let{uploadAssets:r}=await import(`../graphics/editingSupport.js`),i=await e.load();return r(i,i.source,t,n)}async function oe(e,t,n,i,a){let o=await U(e);if(await D(e,t,i),!o.deleteAttachments)throw new r(i,`Layer source does not support deleteAttachments capability`);return o.deleteAttachments(t,n,a)}async function se(e,t,n){let i=(await e.load({signal:t?.signal})).source;if(!i.fetchRecomputedExtents)throw new r(n,`Layer source does not support fetchUpdates capability`);return i.fetchRecomputedExtents(t)}async function ce(e,t,n,i){let a=y.from(t),o=await e.load(),s=o.source,c=o.capabilities;if(!c?.data?.supportsAttachment)throw new r(i,`this layer doesn't support attachments`);let{attachmentTypes:l,objectIds:u,globalIds:d,num:f,size:p,start:m,where:h}=a;if(!c?.operations?.supportsQueryAttachments){let e=l?.length>0,t=d?.length>0,n=p?.length>0;if(e||t||n||f||m||h)throw new r(i,`when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported`,a)}if(!(u?.length||d?.length||h))throw new r(i,`'objectIds', 'globalIds', or 'where' are required to perform attachment query`,a);if(!s.queryAttachments)throw new r(i,`Layer source does not support queryAttachments capability`,a);return!c?.attachment?.supportsOrderByFields&&a.orderByFields?.length&&(a=a.clone(),a.orderByFields=null),s.queryAttachments(a)}async function le(e,t,n,i){let a=await U(e);if(!a.queryObjectIds)throw new r(i,`Layer source does not support queryObjectIds capability`);return a.queryObjectIds(b.from(t)??e.createQuery(),n)}async function O(e,t,n,i){let a=await U(e);if(!a.queryFeatureCount)throw new r(i,`Layer source does not support queryFeatureCount capability`);return a.queryFeatureCount(b.from(t)??e.createQuery(),n)}async function k(e,t,n,i){let a=await U(e);if(!a.queryExtent)throw new r(i,`Layer source does not support queryExtent capability`);return a.queryExtent(b.from(t)??e.createQuery(),n)}async function A(e,t,n,i){let a=await U(e);if(!a.queryRelatedFeatures)throw new r(i,`Layer source does not support queryRelatedFeatures capability`);return a.queryRelatedFeatures(x.from(t),n)}async function j(e,t,n,i){let a=await U(e);if(!a.queryRelatedFeaturesCount)throw new r(i,`Layer source does not support queryRelatedFeaturesCount capability`);return a.queryRelatedFeaturesCount(x.from(t),n)}async function M(e){let t=e.source;if(t?.refresh)try{let{dataChanged:n,updates:r}=await t.refresh();if(r!=null&&(e.sourceJSON={...e.sourceJSON,...r},e.read(r,{origin:`service`,url:e.parsedUrl})),n)return!0}catch{}if(e.definitionExpression)try{return(await o(e.definitionExpression,e.fieldsIndex)).hasDateFunctions}catch{}return!1}function N(e){let t=new b;t.historicMoment=e.historicMoment,t.gdbVersion=e.gdbVersion,t.returnGeometry=!0,t.outFields=[`*`],t.multipatchOption=e.geometryType===`multipatch`?`xyFootprint`:null;let n=e.capabilities?.query;n&&(t.compactGeometryEnabled=n.supportsCompactGeometry,t.defaultSpatialReferenceEnabled=n.supportsDefaultSpatialReference);let r=e.capabilities?.data;r?.supportsZ&&e.returnZ!=null&&(t.returnZ=e.returnZ),r?.supportsM&&e.returnM!=null&&(t.returnM=e.returnM);let{timeOffset:i,timeExtent:a}=e;return t.timeExtent=i!=null&&a!=null?a.offset(-i.value,i.unit):a||null,t}function P(e){let{globalIdField:t,fields:n}=e;if(t)return t;if(n){for(let e of n)if(e.type===`esriFieldTypeGlobalID`)return e.name}}function F(e){let{objectIdField:t,fields:n}=e;if(t)return t;if(n){for(let e of n)if(e.type===`esriFieldTypeOID`)return e.name}}function I(e){return e.currentVersion?e.currentVersion:e.hasOwnProperty(`capabilities`)||e.hasOwnProperty(`drawingInfo`)||e.hasOwnProperty(`hasAttachments`)||e.hasOwnProperty(`htmlPopupType`)||e.hasOwnProperty(`relationships`)||e.hasOwnProperty(`timeInfo`)||e.hasOwnProperty(`typeIdField`)||e.hasOwnProperty(`types`)?10:9.3}function L(e,t,n,r){let i=n?.feature,a=!!e.subtypes?.length;if(a&&!n?.excludeImpliedDomains){let n=z(e,t);if(n)return n}let o=a&&R(e,i);if(o){let e=o?.domains?.[t];return e?.type===`inherited`?r:e}let s=Y(e.types,e.typeIdField,i);if(s){let e=s.domains&&s.domains[t];if(e&&e?.type!==`inherited`)return e}if(r)return r;if(!n?.excludeImpliedDomains){let n=B(e,t);if(n)return n}return null}function R(e,t){let{subtypes:n,subtypeField:r}=e;if(!t?.attributes||!n?.length||!r)return null;let i=t.attributes[r];return i==null?null:n.find(e=>e.code===i)}function z(e,t){let{fieldsIndex:n,subtypeField:r}=e,{name:i,type:a}=n.get(t)??{};if(!i)return null;if((r&&n.get(r)?.name)===i&&e.subtypes?.length){let t=e.subtypes.map(e=>new u({code:H(e.code,a),name:e.name}));if(t?.length)return new d({codedValues:t})}return null}function B(e,t){let{fieldsIndex:n}=e,{name:r,type:i}=n.get(t)??{};if(!r)return null;if((`typeIdField`in e?n.get(e.typeIdField)?.name:null)===r&&`types`in e&&e.types?.length&&V(e.types)){let t=e.types?.map(e=>new u({code:H(e.id,i),name:e.name}));return new d({codedValues:t})}return null}function V(e){let t=new Set,n=new Set;for(let r of e){if(t.has(r.id)||n.has(r.name))return!1;t.add(r.id),n.add(r.name)}return!0}function H(e,t){return t?p({type:t})&&typeof e==`number`?`${e}`:m({type:t})&&typeof e==`string`?Number.parseInt(e,10):e:e}async function U(e){return(await e.load()).source}async function W(t,n){if(!e)return;let r=e.findCredential(t);if(r)return r.userId;let i;try{let r=await g(t,n);r&&(i=await e.checkSignInStatus(`${r}/sharing`))}catch{}return i?i.userId:null}async function G(t,n){if(!e||e.findCredential(t))return;let r;try{let i=await g(t,n);i&&(r=await e.checkSignInStatus(`${i}/sharing`))}catch{}if(r)try{let r=n==null?null:n.signal;await e.getCredential(t,{signal:r})}catch{}}async function ue(e,t,n){let r=e.parsedUrl?.path;r&&e.authenticationTriggerEvent===t&&await G(r,n)}async function de(e){let t=e.parsedUrl?.path;t&&fe(e)&&await G(t)}function fe(e){return pe(e)&&(`serviceDefinitionExpression`in e&&K(e.serviceDefinitionExpression)||`definitionExpression`in e&&K(e.definitionExpression))}function pe(e){return!!(ee(e)&&e.capabilities?.query.supportsCurrentUser)}function K(e){return!!e?.toLowerCase().includes(`current_user`)}function me(e){return X(e)?!1:e.userHasUpdateItemPrivileges||e.editingEnabled}const q=c({types:C});function he(e,t){if(e.defaultSymbol)return e.types?.length?new te({defaultSymbol:q(e.defaultSymbol,e,t),field:e.typeIdField,uniqueValueInfos:e.types.map(e=>({id:e.id,symbol:q(e.symbol,e,t)}))}):new _({symbol:q(e.defaultSymbol,e,t)})}function ge(e){let t=e.sourceJSON?.cacheMaxAge;if(!t)return!1;let n=e.editingInfo?.lastEditDate?.getTime();return n==null||(t*=1e3,Date.now()-n<t)}async function J(e,t,r){if(t==null)return null;let i=[],{objectIdField:a}=e;if(t.forEach(e=>{let t=null;if(`attributes`in e){let{attributes:n}=e;t={globalId:n[r],objectId:n[a]!=null&&n[a]!==-1?n[a]:null}}else t={globalId:e.globalId,objectId:e.objectId!=null&&e.objectId!==-1?e.objectId:null};t.globalId!=null&&(t.objectId==null||t.objectId===-1)&&i.push(t.globalId)}),i.length===0)return null;let o=e.createQuery();o.where=i.map(e=>`${r}='${e}'`).join(` OR `),o.returnGeometry=!1,o.outFields=[a,r],o.cacheHint=!1;let c=await n(f(e,o));if(!c.ok)return null;let l=new Map,u=c.value.features;for(let e of u){let t=e.attributes[r],n=e.attributes[a];t!=null&&n!=null&&n!==-1&&l.set(s(t),n)}return l}function Y(e,t,n){if(!t||!n||!e)return null;let r=n.getAttribute(t);if(r==null)return null;let i=e.filter(e=>{let{id:t}=e;return t!=null&&t.toString()===r.toString()});return i.length>1&&w().warn(`getFeatureType`,`Cannot unambiguously determine feature type because multiple types have the id ${r}.`),i[0]??null}function X(e){let t=e.sourceJSON;return t?.isMultiServicesView||t?.isReadOnly||_e(e)}function _e(e){return!!e.sourceJSON?.capabilities?.toLowerCase().split(`,`).map(e=>e.trim()).includes(`map`)}function ve(e,t,n){let i=t?.queryAttributeBins;if(!t?.operations?.supportsQueryBins||!i)throw new r(n,`Layer source does not support binning`);switch(e.binParameters?.type){case`auto-interval`:if(!i.supportsAutoInterval)throw new r(n,`Layer source does not support auto-interval binning`);if(e.binParameters.normalizationType&&!(i.supportsNormalization&&Z(e.binParameters.normalizationType,i.supportedNormalizationTypes)))throw new r(n,`Layer source does not support normalization binning`);break;case`date`:if(!i.supportsDate)throw new r(n,`Layer source does not support date binning`);if(e.binParameters.snapToData&&!i.supportsSnapToData)throw new r(n,`Layer source does not support snapToData binning`);if(e.binParameters.returnFullIntervalBin&&!i.supportsReturnFullIntervalBin)throw new r(n,`Layer source does not support returnFullIntervalBin binning`);break;case`fixed-boundaries`:if(!i.supportsFixedBoundaries)throw new r(n,`Layer source does not support fixed-boundaries binning`);break;case`fixed-interval`:if(!i.supportsFixedInterval)throw new r(n,`Layer source does not support fixed-interval binning`);if(e.binParameters.normalizationType&&!(i.supportsNormalization&&Z(e.binParameters.normalizationType,i.supportedNormalizationTypes)))throw new r(n,`Layer source does not support normalization binning`)}if(e.binParameters?.stackBy&&!i.supportsStackBy)throw new r(n,`Layer source does not support stackBy binning`);if(e.binParameters?.splitBy&&!i.supportsSplitBy)throw new r(n,`Layer source does not support splitBy binning`);if(e.binParameters?.firstDayOfWeek&&!i.supportsFirstDayOfWeek)throw new r(n,`Layer source does not support firstDayOfWeek binning`);let a=i?.supportedStatistics;if(e.outStatistics&&a){let t=new Map([[`count`,`count`],[`sum`,`sum`],[`min`,`min`],[`max`,`max`],[`avg`,`avg`],[`stddev`,`stddev`],[`var`,`var`],[`percentile-continuous`,`percentileContinuous`],[`percentile-discrete`,`percentileDiscrete`],[`centroid-aggregate`,`centroid`],[`convex-hull-aggregate`,`convexHull`],[`envelope-aggregate`,`envelope`]]);for(let{statisticType:i}of e.outStatistics){let e=t.get(i);if(e&&!a[e])throw new r(n,`Layer source does not support ${i} statistic type`)}}}function Z(e,t){return e!=null&&!!t?.[ne.toJSON(e)]}function Q(e){return h(e)?!!e.labelExpressionInfo?.expression:t(e)?e.expressionInfos?.some(e=>e.expression)?!0:Array.isArray(e.content)?e.content.some(e=>e.type===`expression`&&e.expressionInfo?.expression):!1:e.type===`dot-density`&&e.attributes?.some(e=>e.valueExpression)||`valueExpression`in e&&e.valueExpression?!0:`visualVariables`in e&&e.visualVariables!=null&&e.visualVariables.some(e=>e.valueExpression?!0:e.type===`size`?v(e.minSize)&&e.minSize.valueExpression||v(e.maxSize)&&e.maxSize.valueExpression:!1)}function ye(e){if(`renderer`in e&&e.renderer&&Q(e.renderer))return!0;if(`labelingInfo`in e&&e.labelingInfo){for(let t of e.labelingInfo)if(h(t)&&Q(t))return!0}return!1}async function be(e){let t=`returnZ`in e?e.returnZ:void 0,n=`returnM`in e?e.returnM:void 0;if(ye(e)){let{arcadeUtils:r}=await S();r.layerHasGeometryFunctions(e)&&(t=!0,n=!0)}if(`renderer`in e&&e.renderer?.symbols)for(let t of e.renderer.symbols)t.type===`cim`&&($??=(await import(`../../symbols/cim/CIMSymbolHelper.js`)).forEachSymbolLayer,$(t.data.symbol,e=>{switch(e.type){case`CIMPictureMarker`:case`CIMVectorMarker`:n||=e.markerPlacement?.type===`CIMMarkerPlacementAtMeasuredUnits`}}));return{returnZ:t,returnM:n}}let $;export{E as addAttachment,ie as applyEdits,de as checkServiceCurrentUserSupport,z as computeDomainFromSubtypes,B as computeDomainFromTypes,me as computeEffectiveEditingEnabled,he as createDefaultRenderer,N as createQuery,oe as deleteAttachments,G as ensureCredentialIfSignedIn,ue as ensureLayerCredential,se as fetchRecomputedExtents,T as geometryTypeKebabDict,R as getFeatureSubtype,Y as getFeatureType,L as getFieldDomain,J as getGlobalIdToObjectIdMap,W as getSignedInUser,K as hasCurrentUser,M as hasDataChanged,ge as isLayerCacheStale,be as layerRequiresGeometryZM,ce as queryAttachments,k as queryExtent,O as queryFeatureCount,le as queryObjectIds,A as queryRelatedFeatures,j as queryRelatedFeaturesCount,P as readGlobalIdField,F as readObjectIdField,I as readVersion,X as supportsQueryOnly,V as typesHaveUniqueIdsAndNames,re as updateAttachment,ae as uploadAssets,ve as validateBinsQuery};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "6.0.0-next.30",
3
+ "version": "6.0.0-next.32",
4
4
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
5
5
  "keywords": [
6
6
  "ArcGIS",
@@ -20,7 +20,7 @@
20
20
  "license": "SEE LICENSE IN LICENSE.md",
21
21
  "dependencies": {
22
22
  "@amcharts/amcharts5": "~5.21.5",
23
- "@arcgis/toolkit": "6.0.0-next.30",
23
+ "@arcgis/toolkit": "6.0.0-next.32",
24
24
  "@esri/arcgis-html-sanitizer": "~4.2.0-next.2",
25
25
  "@esri/calcite-components": "^5.2.0",
26
26
  "@vaadin/grid": "~25.3.5",
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{isPopupTemplate as e}from"../popupTemplateUtils.js";import{c as t,p as n,r,e as i,a,b as o,d as s,l as c,f as l,s as u,g as d,h as f}from"../chunks/arcade.js";export{i as arcade}from"../chunks/arcade.js";import{ArcadeDate as p}from"../arcade/ArcadeDate.js";import{toSymbolId as m}from"../arcade/arcadeEnvironment.js";export{b as batchExec}from"../chunks/batchExec.js";import h from"../arcade/Dictionary.js";import{Feature as g}from"../arcade/Feature.js";export{s as languageUtils}from"../chunks/languageUtils.js";import{Pixel as _}from"../arcade/Pixel.js";import{Voxel as v}from"../arcade/Voxel.js";export{A as aiServices}from"../chunks/aiServices.js";import{clone as y}from"../core/lang.js";import{isLabelClass as b}from"../layers/support/labelUtils.js";import{isSizeVariable as x}from"../renderers/visualVariables/support/sizeVariableUtils.js";export{createArcadeGeometryFromAccessorGeometry}from"../arcade/geometry/adapters/accessor.js";export{createArcadeGeometryFromDehydratedGeometry}from"../arcade/geometry/adapters/dehydrated.js";const S={vars:{$feature:`any`,$view:`any`}};function C(e){return e.replaceAll(/[|\\{}()[\]^$+*?.]/g,`\\$&`)}function w(e){if(!e)return null;try{return n(e)}catch{}return null}function T(e,n){let r=typeof e==`string`?w(e):e;if(!r)return null;try{return n||=y(S),t(r,n)}catch{}return null}function E(e,t,n){return{vars:{$feature:e==null?null:g.createFromGraphic(e,n),$view:t?.view},spatialReference:t?.sr,timeZone:n??null}}function D(e,t){e.vars!=null&&(e.vars.$feature=t)}function O(e,t){let n;try{n=o(e,t)}catch{n=null}return n}function k(e,t){let n;try{n=e?e(t):null}catch{n=null}return n}function A(e,t){try{return e?e(t):Promise.resolve(null)}catch{return Promise.resolve(null)}}const j=[`$feature`,`$aggregatedFeatures`,`$voxel`].map(e=>m(e));function M(e,t){if(!e)return[];let n=typeof e==`string`?w(e):e;if(!n)return[];let r=new Map;if(Array.isArray(t)||t==null)for(let e of j)r.set(e,t);else for(let[e,n]of t)r.set(m(e),n);let i=s(n).flatMap(({varId:e,memberNamePattern:t})=>{if(!r.has(e))return[];if(t.includes(`*`)){let n=r.get(e);if(n==null)return[];let i=RegExp(`^${t.split(/\*+/).map(C).join(`.*`)}$`,`i`);return n.filter(e=>i.test(e))}return t.toLowerCase()});return[...new Set(i.sort())]}function N(e){return r(e,`$view`)}function P(e,t){return e?r(e,t):!1}function F(e){if(!e||e.spatialReference==null&&(e.scale==null||e.viewingMode==null))return;let t,n,{timeProperties:r,timeZone:i}=e;if(r!=null){let{currentStart:e,currentEnd:a}=r;i==null?(t=e==null?null:p.dateJSToArcadeDate(e),n=a==null?null:p.dateJSToArcadeDate(a)):(t=e==null?null:p.dateJSAndZoneToArcadeDate(e,i),n=a==null?null:p.dateJSAndZoneToArcadeDate(a,i))}return{view:e.viewingMode&&e.scale!=null?new h({__proto__:null,viewingMode:e.viewingMode,scale:e.scale,timeProperties:t!=null||n!=null?new h({__proto__:null,currentStart:t,currentEnd:n,startIncluded:!0,endIncluded:!0}):null}):null,sr:e.spatialReference}}function I({url:e,spatialReference:t,lrucache:n,interceptor:r}){let i=l();return i?i.createFeatureSetCollectionFromService(e,t,n,r):null}function L({layer:e,spatialReference:t,outFields:n,returnGeometry:r,lrucache:i,interceptor:a}){if(e===null)return null;let o=l();return o?o.constructFeatureSet(e,t,n,r??!0,i,a):null}function R(e){if(e?.map===null)return null;let t=l();return t?t.createFeatureSetCollectionFromMap(e.map,e.spatialReference,e.lrucache,e.interceptor):null}function z(e,t,n=[]){return c(e,t,n)}function B(){return a()}function V(){return i()}function H(e){return`type`in e&&(e.type===`class-breaks`||e.type===`dictionary`||e.type===`dot-density`||e.type===`pie-chart`||e.type===`simple`||e.type===`unique-value`)}function U(t,n){if(!t)return!1;if(typeof t==`string`)return n(t);let r=t;if(H(r)){if(r.type===`dot-density`){let e=r.attributes?.some(e=>n(e.valueExpression));if(e)return e}let e=r.visualVariables,t=!!e&&e.some(e=>{let t=n(e.valueExpression);return e.type===`size`&&(x(e.minSize)&&(t||=n(e.minSize.valueExpression)),x(e.maxSize)&&(t||=n(e.maxSize.valueExpression))),t});return`valueExpression`in r&&n(r.valueExpression)?!0:t}if(b(r)){let e=r.labelExpressionInfo?.expression;return!!(e&&n(e))||!1}return e(r)?!!r.expressionInfos&&r.expressionInfos.some(e=>n(e.expression))||Array.isArray(r.content)&&r.content.some(e=>e.type===`expression`&&n(e.expressionInfo?.expression)):!1}function W(e){let t=w(e);return!!t&&d(t)}function G(e){return U(e,W)}function K(e){if(`renderer`in e&&e.renderer&&G(e.renderer))return!0;if(`labelingInfo`in e&&e.labelingInfo){for(let t of e.labelingInfo)if(G(t))return!0}return!1}function q(e){let t=w(e);return!!t&&f(t)}function J(e){return U(e,q)}function Y(e){return U(e,e=>{let t=w(e);return!!t&&u(t)})}export{h as Dictionary,_ as Pixel,v as Voxel,g as arcadeFeature,L as convertFeatureLayerToFeatureSet,R as convertMapToFeatureSetCollection,I as convertServiceUrlToWorkspace,E as createExecContext,T as createFunction,w as createSyntaxTree,N as dependsOnView,V as enableFeatureSetOperations,B as enableGeometryOperations,O as evalSyntaxTree,A as executeAsyncFunction,k as executeFunction,M as extractFieldNames,F as getViewInfo,G as hasGeometryFunctions,J as hasGeometryOperations,P as hasVariable,K as layerHasGeometryFunctions,z as loadScriptDependencies,Y as requiresTrack,D as updateExecContext};
2
+ import{isPopupTemplate as e}from"../popupTemplateUtils.js";import{c as t,p as n,r,e as i,a,b as o,d as s,l as c,f as l,s as u,g as d,h as f}from"../chunks/arcade.js";export{i as arcade}from"../chunks/arcade.js";import{ArcadeDate as p}from"../arcade/ArcadeDate.js";import{toSymbolId as m}from"../arcade/arcadeEnvironment.js";export{b as batchExec}from"../chunks/batchExec.js";import h from"../arcade/Dictionary.js";import{Feature as g}from"../arcade/Feature.js";export{s as languageUtils}from"../chunks/languageUtils.js";import{Pixel as _}from"../arcade/Pixel.js";import{Voxel as v}from"../arcade/Voxel.js";export{A as aiServices}from"../chunks/aiServices.js";import{clone as y}from"../core/lang.js";import{isLabelClass as b}from"../layers/support/labelUtils.js";import{isSizeVariable as x}from"../renderers/visualVariables/support/sizeVariableUtils.js";export{createArcadeGeometryFromAccessorGeometry}from"../arcade/geometry/adapters/accessor.js";export{createArcadeGeometryFromDehydratedGeometry}from"../arcade/geometry/adapters/dehydrated.js";const S={vars:{$feature:`any`,$view:`any`}};function C(e){return e.replaceAll(/[|\\{}()[\]^$+*?.]/g,`\\$&`)}function w(e){if(!e)return null;try{return n(e)}catch{}return null}function T(e,n){let r=typeof e==`string`?w(e):e;if(!r)return null;try{return n||=y(S),t(r,n)}catch{}return null}function E(e,t,n){return{vars:{$feature:e==null?null:g.createFromGraphic(e,n),$view:t?.view},spatialReference:t?.sr,timeZone:n??null}}function D(e,t){e.vars!=null&&(e.vars.$feature=t)}function O(e,t){let n;try{n=o(e,t)}catch{n=null}return n}function k(e,t){let n;try{n=e?e(t):null}catch{n=null}return n}function A(e,t){try{return e?e(t):Promise.resolve(null)}catch{return Promise.resolve(null)}}const j=[`$feature`,`$aggregatedFeatures`,`$voxel`].map(e=>m(e));function M(e,t){if(!e)return[];let n=typeof e==`string`?w(e):e;if(!n)return[];let r=new Map;if(Array.isArray(t)||t==null)for(let e of j)r.set(e,t);else for(let[e,n]of t)r.set(m(e),n);let i=s(n).flatMap(({varId:e,memberNamePattern:t})=>{if(!r.has(e))return[];if(t.includes(`*`)){let n=r.get(e);if(n==null)return[];let i=RegExp(`^${t.split(/\*+/).map(C).join(`.*`)}$`,`i`);return n.filter(e=>i.test(e))}return t.toLowerCase()});return[...new Set(i.sort())]}function N(e){return r(e,`$view`)}function P(e,t){return e?r(e,t):!1}function F(e){if(!e||e.spatialReference==null&&(e.scale==null||e.viewingMode==null))return;let t,n,{timeProperties:r,timeZone:i}=e;if(r!=null){let{currentStart:e,currentEnd:a}=r;i==null?(t=e==null?null:p.dateJSToArcadeDate(e),n=a==null?null:p.dateJSToArcadeDate(a)):(t=e==null?null:p.dateJSAndZoneToArcadeDate(e,i),n=a==null?null:p.dateJSAndZoneToArcadeDate(a,i))}return{view:e.viewingMode&&e.scale!=null?new h({__proto__:null,viewingMode:e.viewingMode,scale:e.scale,timeProperties:t!=null||n!=null?new h({__proto__:null,currentStart:t,currentEnd:n,startIncluded:!0,endIncluded:!0}):null}):null,sr:e.spatialReference}}function I({url:e,spatialReference:t,lrucache:n,interceptor:r}){let i=l();return i?i.createFeatureSetCollectionFromService(e,t,n,r):null}function L({layer:e,spatialReference:t,outFields:n,returnGeometry:r,lrucache:i,interceptor:a}){if(e===null)return null;let o=l();return o?o.constructFeatureSet(e,t,n,r??!0,i,a):null}function R(e){if(e?.map===null)return null;let t=l();return t?t.createFeatureSetCollectionFromMap(e.map,e.spatialReference,e.lrucache,e.interceptor):null}function z(e,t,n=[]){return c(e,t,n)}function B(){return a()}function V(){return i()}function H(e){return`type`in e&&(e.type===`class-breaks`||e.type===`dictionary`||e.type===`dot-density`||e.type===`pie-chart`||e.type===`simple`||e.type===`unique-value`)}function U(t,n){if(!t)return!1;if(typeof t==`string`)return n(t);let r=t;if(H(r)){if(r.type===`dot-density`){let e=r.attributes?.some(e=>n(e.valueExpression));if(e)return e}let e=r.visualVariables,t=!!e&&e.some(e=>{let t=n(e.valueExpression);return e.type===`size`&&(x(e.minSize)&&(t||=n(e.minSize.valueExpression)),x(e.maxSize)&&(t||=n(e.maxSize.valueExpression))),t});return`valueExpression`in r&&n(r.valueExpression)?!0:t}if(b(r)){let e=r.labelExpressionInfo?.expression;return!!(e&&n(e))||!1}return e(r)?!!r.expressionInfos&&r.expressionInfos.some(e=>n(e.expression))||Array.isArray(r.content)&&r.content.some(e=>e.type===`expression`&&n(e.expressionInfo?.expression)):!1}function W(e){let t=w(e);return!!t&&d(t)}function G(e){return U(e,W)}function K(e){if(e.renderer&&G(e.renderer))return!0;for(let t of e.labelingInfo??[])if(G(t))return!0;return!1}function q(e){let t=w(e);return!!t&&f(t)}function J(e){return U(e,q)}function Y(e){return U(e,e=>{let t=w(e);return!!t&&u(t)})}export{h as Dictionary,_ as Pixel,v as Voxel,g as arcadeFeature,L as convertFeatureLayerToFeatureSet,R as convertMapToFeatureSetCollection,I as convertServiceUrlToWorkspace,E as createExecContext,T as createFunction,w as createSyntaxTree,N as dependsOnView,V as enableFeatureSetOperations,B as enableGeometryOperations,O as evalSyntaxTree,A as executeAsyncFunction,k as executeFunction,M as extractFieldNames,F as getViewInfo,G as hasGeometryFunctions,J as hasGeometryOperations,P as hasVariable,K as layerHasGeometryFunctions,z as loadScriptDependencies,Y as requiresTrack,D as updateExecContext};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{spritePadding as t}from"./definitions.js";import{log2 as n}from"./GeometryUtils.js";import r from"./Rect.js";import i from"./RectangleBinPack.js";import a from"../../../webgl/Texture.js";import{TextureDescriptor as o}from"../../../webgl/TextureDescriptor.js";function s(e){return e&&e.type===`static`}class c{constructor(e,t,n=0){this._mosaicPages=[],this._maxItemSize=0,this._currentPage=0,this._pageWidth=0,this._pageHeight=0,this._mosaicRects=new Map,this._pageWidth=e,this._pageHeight=t,n>0&&(this._maxItemSize=n),this._binPack=new i(this._pageWidth,this._pageHeight);let r=Math.floor(this._pageWidth),a=Math.floor(this._pageHeight);this._mosaicPages.push({mosaicsData:{type:`static`,data:new Uint32Array(r*a)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0})}getSize(e){return e>=this._mosaicPages.length?[0,0]:this._mosaicPages[e].size}has(e){return this._mosaicRects.has(e)}getSpriteItem(e){return this._mosaicRects.get(e)}addSpriteItem(e,n,i,a,o,c,l=1,u=`Linear`,d=.5,f=1){if(this._mosaicRects.has(e))return this._mosaicRects.get(e);let p,m,h;if(s(i)?[p,m,h]=this._allocateImage(n[0],n[1]):(p=new r(0,0,n[0],n[1]),m=this._mosaicPages.length,this._mosaicPages.push({mosaicsData:i,size:[n[0]+2*t,n[1]+2*t],dirty:!0,texture:void 0})),p.width<=0||p.height<=0)return null;let g={type:`sprite`,rect:p,width:n[0],height:n[1],sdf:o,simplePattern:c,rasterizationScale:l,samplingMode:u,sdfPaddingRatio:d,sdfDecodeCoeff:f,page:m};return this._mosaicRects.set(e,g),s(i)&&(has(`esri-mosaic-debug`)&&this._showDebugSprite(n,i.data),this._copy({rect:p,spriteSize:n,spriteData:i.data,page:m,pageSize:h,repeat:a,sdf:o})),g}getTexture(e,t=0){let{context:n}=e,r=this._mosaicPages[t],i=r.mosaicsData,a=r.texture;if(a||(a=u(n,r.size),r.texture=a),s(i))r.dirty&&(a.setData(new Uint8Array(i.data.buffer)),a.generateMipmap(),has(`esri-mosaic-debug`)&&this._showDebugPage(t));else{let t=i.data;t.update(e),t.hasFrameData&&(t.loadFrame(a),a.generateMipmap())}return r.dirty=!1,a}dispose(){this._binPack=null;for(let e of this._mosaicPages){let t=e.texture;t&&t.dispose();let n=e.mosaicsData;s(n)||n.data.destroy()}this._mosaicPages=null,this._mosaicRects.clear()}static _copyBits(e,t,n,r,i,a,o,s,c,l,u){let d=r*t+n,f=s*a+o;if(u){f-=a;for(let o=-1;o<=l;o++,d=((o+l)%l+r)*t+n,f+=a)for(let t=-1;t<=c;t++)i[f+t]=e[d+(t+c)%c]}else for(let n=0;n<l;n++){for(let t=0;t<c;t++)i[f+t]=e[d+t];d+=t,f+=a}}_copy(n){if(n.page>=this._mosaicPages.length)return;let r=this._mosaicPages[n.page],i=r.mosaicsData;if(!s(r.mosaicsData))throw new e(`mapview-invalid-resource`,`unsuitable data type!`);let a=n.spriteData,o=i.data;c._copyBits(a,n.spriteSize[0],0,0,o,n.pageSize[0],n.rect.x+t,n.rect.y+t,n.spriteSize[0],n.spriteSize[1],n.repeat),r.dirty=!0}_allocateImage(e,a){e+=2*t,a+=2*t;let o=Math.max(e,a);if(this._maxItemSize&&this._maxItemSize<o){let t=2**Math.ceil(n(e)),i=2**Math.ceil(n(a)),o=new r(0,0,e,a);return this._mosaicPages.push({mosaicsData:{type:`static`,data:new Uint32Array(t*i)},size:[t,i],dirty:!0,texture:void 0}),[o,this._mosaicPages.length-1,[t,i]]}let c=this._binPack.allocate(e,a);if(c.width<=0){let t=this._mosaicPages[this._currentPage];return!t.dirty&&s(t.mosaicsData)&&(t.mosaicsData.data=null),this._currentPage=this._mosaicPages.length,this._mosaicPages.push({mosaicsData:{type:`static`,data:new Uint32Array(this._pageWidth*this._pageHeight)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0}),this._binPack=new i(this._pageWidth,this._pageHeight),this._allocateImage(e,a)}return[c,this._currentPage,[this._pageWidth,this._pageHeight]]}_showDebugSprite([e,t],n){let r=document.createElement(`canvas`);r.width=e,r.height=t,r.setAttribute(`style`,`position: absolute; top: ${4+204*l++}px; right: 208px; width: 200px; height: 200px; border: 1px solid black;`);let i=r.getContext(`2d`),a=new ImageData(e,t);a.data.set(new Uint8Array(n.buffer)),i.putImageData(a,0,0),document.body.appendChild(r)}_showDebugPage(e){let{size:[t,n],mosaicsData:r}=this._mosaicPages[e];if(!s(r))return;let i=`mosaicDebugPage${e}`,a=document.getElementById(i)??document.createElement(`canvas`);a.id=i,a.width=t,a.height=n,a.setAttribute(`style`,`position: absolute; top: ${4+204*e}px; right: 4px; width: 200px; height: 200px; border: 1px solid black;`);let o=a.getContext(`2d`),c=new ImageData(t,n);c.data.set(new Uint8Array(r.data.buffer)),o.putImageData(c,0,0),document.body.appendChild(a)}}let l=0;function u(e,t){let n=new o(t[0],t[1]);return n.wrapMode=33071,new a(e,n,null)}export{c as default};
2
+ import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{spritePadding as t}from"./definitions.js";import{log2 as n}from"./GeometryUtils.js";import r from"./Rect.js";import i from"./RectangleBinPack.js";import a from"../../../webgl/Texture.js";import{TextureDescriptor as o}from"../../../webgl/TextureDescriptor.js";function s(e){return e&&e.type===`static`}class c{constructor(e,t,n=0){this._mosaicPages=[],this._maxItemSize=0,this._currentPage=0,this._pageWidth=0,this._pageHeight=0,this._mosaicRects=new Map,this._pageWidth=e,this._pageHeight=t,n>0&&(this._maxItemSize=n),this._binPack=new i(this._pageWidth,this._pageHeight);let r=Math.floor(this._pageWidth),a=Math.floor(this._pageHeight);this._mosaicPages.push({mosaicsData:{type:`static`,data:new Uint32Array(r*a)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0})}getSize(e){return e>=this._mosaicPages.length?[0,0]:this._mosaicPages[e].size}has(e){return this._mosaicRects.has(e)}getSpriteItem(e){return this._mosaicRects.get(e)}addSpriteItem(e,n,i,a,o,c,l=1,u=`Linear`,d=.5,f=1){if(this._mosaicRects.has(e))return this._mosaicRects.get(e);let p,m,h;if(s(i)?[p,m,h]=this._allocateImage(n[0],n[1]):(p=new r(0,0,n[0],n[1]),m=this._mosaicPages.length,this._mosaicPages.push({mosaicsData:i,size:[n[0]+2*t,n[1]+2*t],dirty:!0,texture:void 0})),p.width<=0||p.height<=0)return null;let g={type:`sprite`,rect:p,width:n[0],height:n[1],sdf:o,simplePattern:c,rasterizationScale:l,samplingMode:u,sdfPaddingRatio:d,sdfDecodeCoeff:f,page:m};return this._mosaicRects.set(e,g),s(i)&&(has(`esri-mosaic-debug`)&&this._showDebugSprite(n,i.data),this._copy({rect:p,spriteSize:n,spriteData:i.data,page:m,pageSize:h,repeat:a,sdf:o})),g}getTexture(e,t=0){let{context:n}=e,r=this._mosaicPages[t],i=r.mosaicsData,a=r.texture;if(a||(a=u(n,r.size),r.texture=a),s(i))r.dirty&&(a.setData(new Uint8Array(i.data.buffer)),a.generateMipmap(),has(`esri-mosaic-debug`)&&this._showDebugPage(t));else{let t=i.data;t.update(e),t.hasFrameData&&(t.loadFrame(a),a.generateMipmap())}return r.dirty=!1,a}dispose(){this._binPack=null;for(let e of this._mosaicPages){let t=e.texture;t&&t.dispose();let n=e.mosaicsData;s(n)||n.data.destroy()}this._mosaicPages=null,this._mosaicRects.clear()}static _copyBits(e,t,n,r,i,a,o,s,c,l,u){let d=r*t+n,f=s*a+o;if(u){f-=a;for(let o=-1;o<=l;o++,d=((o+l)%l+r)*t+n,f+=a)for(let t=-1;t<=c;t++)i[f+t]=e[d+(t+c)%c]}else for(let n=0;n<l;n++){for(let t=0;t<c;t++)i[f+t]=e[d+t];d+=t,f+=a}}_copy(n){if(n.page>=this._mosaicPages.length)return;let r=this._mosaicPages[n.page],i=r.mosaicsData;if(!s(r.mosaicsData))throw new e(`mapview-invalid-resource`,`unsuitable data type!`);let a=n.spriteData,o=i.data;c._copyBits(a,n.spriteSize[0],0,0,o,n.pageSize[0],n.rect.x+t,n.rect.y+t,n.spriteSize[0],n.spriteSize[1],n.repeat),r.dirty=!0}_allocateImage(e,a){e+=2*t,a+=2*t;let o=Math.max(e,a);if(this._maxItemSize&&this._maxItemSize<o){let t=2**Math.ceil(n(e)),i=2**Math.ceil(n(a)),o=new r(0,0,e,a);return this._mosaicPages.push({mosaicsData:{type:`static`,data:new Uint32Array(t*i)},size:[t,i],dirty:!0,texture:void 0}),[o,this._mosaicPages.length-1,[t,i]]}let c=this._binPack.allocate(e,a);if(c.width<=0){let t=this._mosaicPages[this._currentPage];return!t.dirty&&s(t.mosaicsData)&&(t.mosaicsData.data=null),this._currentPage=this._mosaicPages.length,this._mosaicPages.push({mosaicsData:{type:`static`,data:new Uint32Array(this._pageWidth*this._pageHeight)},size:[this._pageWidth,this._pageHeight],dirty:!0,texture:void 0}),this._binPack=new i(this._pageWidth,this._pageHeight),this._allocateImage(e,a)}return[c,this._currentPage,[this._pageWidth,this._pageHeight]]}_showDebugSprite([e,t],n){let r=document.createElement(`canvas`);r.width=e,r.height=t,r.setAttribute(`style`,`position: absolute; top: ${4+204*l++}px; right: 208px; width: 200px; height: 200px; border: 1px solid black;`);let i=r.getContext(`2d`),a=new ImageData(e,t);a.data.set(new Uint8Array(n.buffer)),i.putImageData(a,0,0),document.body.appendChild(r)}_showDebugPage(e){let{size:[t,n],mosaicsData:r}=this._mosaicPages[e];if(!s(r))return;let i=`mosaicDebugPage${e}`,a=document.getElementById(i)??document.createElement(`canvas`);a.id=i,a.width=t,a.height=n,a.setAttribute(`style`,`position: absolute; top: ${4+204*e}px; right: 4px; width: 200px; height: 200px; border: 1px solid black;`);let o=a.getContext(`2d`),c=new ImageData(t,n);c.data.set(new Uint8Array(r.data.buffer)),o.putImageData(c,0,0),document.body.appendChild(a)}}let l=0;function u(e,n){let r=new o(n[0],n[1]);return r.wrapMode=33071,r.maxMipLevel=Math.floor(Math.log2(t/2)),new a(e,r,null)}export{c as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import{getContrast as n}from"../../../../core/colorUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{watch as i}from"../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as a}from"../../../../core/units.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{subtract as c,normalize as l}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as u,UNIT_X as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scale as f,length as p,normalize as m,add as h,lerp as g,subtract as _}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import y from"../../../../geometry/Point.js";import b from"../../../../geometry/Polygon.js";import{project as x,initializeProjection as S}from"../../../../geometry/projectionUtils.js";import{c as C,a as w}from"../../../../chunks/boundedPlane.js";import{equals as T}from"../../../../geometry/support/spatialReferenceUtils.js";import E from"../../../../layers/GraphicsLayer.js";import D from"../../../../symbols/SimpleFillSymbol.js";import O from"../../../../symbols/SimpleMarkerSymbol.js";import{DragManipulation as k}from"./manipulations/DragManipulation.js";import{RotateManipulation as A}from"./manipulations/RotateManipulation.js";import{ScaleManipulation as j}from"./manipulations/ScaleManipulation.js";import{PreserveAspectRatio as M,SnapRotation as N}from"./manipulations/utils.js";import{InteractiveToolBase as P}from"../../../interactive/InteractiveToolBase.js";import{KeyBindings as F,mediaKeys as I}from"../../../interactive/keybindings.js";import{EditGeometry as L}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as R}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{calculateOrientedBounds as z}from"../../../interactive/editGeometry/support/editPlaneUtils.js";import{findFirstGraphicHit as B}from"../../../support/hitTestSelectUtils.js";import{createScreenPointFromEvent as V}from"../../../support/screenUtils.js";const H=[[1,1],[1,-1],[-1,-1],[-1,1],[1,0],[0,-1],[-1,0],[0,1]];let U=class extends P{constructor(e){super(e),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._planeCache=C(),this._displayPlaneCache=C(),this._mainAxisCache=u(),this._rotationHandleCache=v(),this._cornerA=v(),this._cornerB=v(),this._cornerC=v(),this._cornerD=v(),this._avgAB=v(),this._avgBC=v(),this._avgCD=v(),this._avgDA=v(),this._preserveAspectRatio=new M,this._snapRotation=new N,this._graphicsLayer=new E({internal:!0,listMode:`hide`,visible:!1,title:`TransformTool layer`}),this._sharedUndoStack=[],this._sharedRedoStack=[],this._isOpacityToggled=!1,this._factor=1,this.preserveAspectRatio=null,this.snapRotation=null,this.type=`transform`}initialize(){this._initialize()}destroy(){let{map:e}=this.view;this._dragManipulation.destroy(),this._rotateManipulation.destroy(),this._scaleManipulations.forEach(e=>e.destroy()),this._editGeometryOperations.destroy(),e.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=r(this._graphicsLayer),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._preserveAspectRatio=null,this._snapRotation=null,this._planeCache=null,this._displayPlaneCache=null,this._rotationHandleCache=null,this._mainAxisCache=null,this._cornerA=null,this._cornerB=null,this._cornerC=null,this._cornerD=null,this._avgAB=null,this._avgBC=null,this._avgCD=null,this._avgDA=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _plane(){let e=this._graphic.geometry;if(e==null)return null;let t=this._editGeometryOperations.data,n=t.parts[0].segments[0],r=c(this._mainAxisCache,n.leftVertex.pos,n.rightVertex.pos);l(r,r);let i=80*this.view.resolution,o=this.view.spatialReference;return T(o,e.spatialReference)&&(i*=a(o)/a(e.spatialReference)),z(r,t,i,this._planeCache)}get _displayPlane(){let e=this._plane;if(!e)return null;let t=this._displayPlaneCache;w(e,t);let n=10*this.view.resolution;return f(t.basis1,t.basis1,1+n/p(t.basis1)),f(t.basis2,t.basis2,1+n/p(t.basis2)),t}get _backgroundGraphicGeometry(){let e=this._displayPlane;if(!e)return null;let t=this.view.spatialReference;return this._updateDisplayPlaneConrers(e),new b({spatialReference:t,rings:[[this._cornerA,this._cornerB,this._cornerC,this._cornerD,this._cornerA]]})}get _rotateGraphicGeometry(){let e=this._plane;if(!e)return null;let t=this._rotationHandleCache;return m(t,e.basis1),f(t,t,30*this.view.resolution),h(t,t,e.origin),h(t,t,e.basis1),new y({x:t[0],y:t[1],spatialReference:this.view.spatialReference})}get _scaleGraphicGeometries(){let e=this._displayPlane;if(!e)return[];let t=this.view.spatialReference;this._updateDisplayPlaneConrers(e);let{_cornerA:n,_cornerB:r,_cornerC:i,_cornerD:a}=this,o=g(this._avgAB,n,r,.5),s=g(this._avgBC,r,i,.5),c=g(this._avgCD,i,a,.5),l=g(this._avgDA,a,n,.5);return[new y({x:n[0],y:n[1],spatialReference:t}),new y({x:r[0],y:r[1],spatialReference:t}),new y({x:i[0],y:i[1],spatialReference:t}),new y({x:a[0],y:a[1],spatialReference:t}),new y({x:o[0],y:o[1],spatialReference:t}),new y({x:s[0],y:s[1],spatialReference:t}),new y({x:c[0],y:c[1],spatialReference:t}),new y({x:l[0],y:l[1],spatialReference:t})]}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){return this._editGeometryOperations.canUndo}canRedo(){return this._editGeometryOperations.canRedo}undo(){this._editGeometryOperations.undo(),this.updateGraphics()}redo(){this._editGeometryOperations.redo(),this.updateGraphics()}refresh(){let{view:e,target:t}=this,n=`georeference`in t?t.georeference.coords:t.geometry,r=this._editGeometryOperations,i=r.data.parts[0].vertices,a=L.fromGeometry(x(n,e.spatialReference),2).parts[0].vertices;i.forEach((e,t)=>{r.setVertexPosition(e,a[t].pos)}),this.updateGraphics()}reset(){let{target:e}=this;if(`georeference`in e){let t=e.georeference;t.type===`control-points`&&(t.controlPoints=this._initialControlPoints)}else e.geometry=this._initialGeometry;this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){let e=this._editGeometryOperations.data.geometry;if(`georeference`in this.target){let t=this.target.georeference;t.coords=e}this._graphic.geometry=e,this._backgroundGraphic.geometry=this._backgroundGraphicGeometry,this._rotateGraphic.geometry=this._rotateGraphicGeometry,this._scaleGraphicGeometries.forEach((e,t)=>{this._scaleGraphics[t].geometry=e})}setSharedUndoStack(e){this._sharedUndoStack=e}setSharedRedoStack(e){this._sharedRedoStack=e}async _initialize(){let{view:e,target:r}=this;if(`georeference`in r){let e=r.georeference;this._graphic=new t({geometry:e.coords}),this._initialControlPoints=e.type===`control-points`?e.controlPoints:null}else this._graphic=r,this._initialGeometry=r.geometry;e.map.addMany([this._graphicsLayer]),e.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._editGeometryOperations=R.fromGeometry(x(this._graphic.geometry,e.spatialReference),2),this._backgroundGraphic=new t({symbol:new D({color:`transparent`,outline:{type:`simple-line`,color:e.effectiveTheme.accentColor,width:2}}),geometry:this._backgroundGraphicGeometry}),this._rotateGraphic=new t({symbol:new O({color:n(e.effectiveTheme.accentColor),outline:{type:`simple-line`,color:e.effectiveTheme.accentColor,width:1}}),geometry:this._rotateGraphicGeometry}),this._scaleGraphics=this._scaleGraphicGeometries.map(r=>new t({symbol:new O({size:6,style:`square`,color:n(e.effectiveTheme.accentColor),outline:{type:`simple-line`,color:e.effectiveTheme.accentColor,width:1}}),geometry:r})),this._graphicsLayer.graphics.addMany([this._backgroundGraphic,this._rotateGraphic,...this._scaleGraphics]),this._dragManipulation=new k({tool:this,view:e,graphic:this._graphic}),this._rotateManipulation=new A({tool:this,view:e,graphic:this._rotateGraphic,snapRotation:this._snapRotation}),this._scaleManipulations=this._scaleGraphics.map((t,n)=>new j({tool:this,view:e,graphic:t,direction:H[n],preserveAspectRatio:this._preserveAspectRatio})),this.addHandles([this._dragManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),this._rotateManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),...this._scaleManipulations.map(e=>e.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this))),i(()=>this.view.scale,()=>this.active?this.updateGraphics():null),e.on(`click`,async t=>{if(e.activeTool!=null&&e.activeTool!==this)return;let n=V(t),i=[];e.map.allLayers.forEach(e=>{(e.type===`vector-tile`||e.type===`imagery`)&&i.push(e)});let a=await this.view.hitTest(n,{exclude:i}),o=a.results;if(o.length===0)e.activeTool=null;else{let t=B(a.results),n=`georeference`in r,i=o.map(e=>e.type===`media`?e.element:null).filter(Boolean),s=new Set([...this._graphicsLayer.graphics,n?null:r].filter(Boolean));n&&i.includes(r)||t!=null&&s.has(t.graphic)?e.activeTool??=this:e.activeTool=null}})]);let a=e=>{this.addHandles(e.events.on(`grab-changed`,e=>{`georeference`in r&&(e.action===`start`?r.opacity*=.5:e.action===`end`&&(r.opacity*=2))}))};this._dragManipulation.forEachManipulator(a),this._rotateManipulation.forEachManipulator(a),this._scaleManipulations.forEach(e=>e.forEachManipulator(a));let o=new F;o.addToggle(I.preserveAspectRatio,()=>{this.preserveAspectRatio??(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled)}),o.addToggle(I.rotateIncrements,()=>{this.snapRotation??(this._snapRotation.enabled=!this._snapRotation.enabled)}),o.add(I.toggleOpacity,()=>{`georeference`in r&&(r.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled)}),o.addToggle(I.factorModifier,e=>this._factor=e.type===`key-down`?10:1),o.add(I.scaleUp,()=>this._scale(this._factor)),o.add(I.scaleDown,()=>this._scale(-this._factor)),o.add(I.moveUp,()=>this._move(0,this._factor)),o.add(I.moveDown,()=>this._move(0,-this._factor)),o.add(I.moveLeft,()=>this._move(-this._factor,0)),o.add(I.moveRight,()=>this._move(this._factor,0)),this.addHandles([e.on(`key-down`,t=>{e.activeTool===this&&o.dispatch(e.inputManager,t)}),e.on(`key-up`,t=>{e.activeTool===this&&o.dispatch(e.inputManager,t)})])}async _loadProjectionEngine(){let e=this._graphic.geometry;return S(e.spatialReference,this.view.spatialReference)}_updateDisplayPlaneConrers(e){let{basis1:t,basis2:n,origin:r}=e,i=this._cornerA;h(i,r,t),h(i,i,n);let a=this._cornerB;h(a,r,t),_(a,a,n);let o=this._cornerC;_(o,r,t),_(o,o,n);let s=this._cornerD;_(s,r,t),h(s,s,n)}_getInfo(){return{editGeometryOperations:this._editGeometryOperations,plane:this._plane,displayPlane:this._displayPlane}}_updateGraphics(e,t){e.action===`start`&&(this._sharedUndoStack.push({tool:this,operation:t}),this._sharedRedoStack.length=0),this.updateGraphics()}_scale(e){let t=this._editGeometryOperations,n=t.data.geometry.extent?.width,r=(n+e*this.view.resolution)/n,i=t.scale(this._plane.origin,d,r,r,0,1);this._sharedUndoStack.push({tool:this,operation:i}),this._sharedRedoStack.length=0,this.updateGraphics()}_move(e,t){let n=this._editGeometryOperations.move(e*this.view.resolution,t*this.view.resolution,0,0);this._sharedUndoStack.push({tool:this,operation:n}),this._sharedRedoStack.length=0,this.updateGraphics()}};e([o()],U.prototype,`_plane`,null),e([o()],U.prototype,`_backgroundGraphicGeometry`,null),e([o()],U.prototype,`_rotateGraphicGeometry`,null),e([o()],U.prototype,`_scaleGraphicGeometries`,null),e([o()],U.prototype,`preserveAspectRatio`,void 0),e([o()],U.prototype,`snapRotation`,void 0),e([o({constructOnly:!0,nonNullable:!0})],U.prototype,`target`,void 0),e([o({readOnly:!0})],U.prototype,`type`,void 0),e([o({constructOnly:!0})],U.prototype,`view`,void 0),U=e([s(`esri.views.2d.interactive.editingTools.TransformTool`)],U);export{U as TransformTool};
2
+ import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import{getContrast as n}from"../../../../core/colorUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{watch as i}from"../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as a}from"../../../../core/units.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{subtract as c,normalize as l}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as u,UNIT_X as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scale as f,length as p,normalize as m,add as h,lerp as g,subtract as _}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import y from"../../../../geometry/Point.js";import b from"../../../../geometry/Polygon.js";import{project as x,initializeProjection as S}from"../../../../geometry/projectionUtils.js";import{create as C,copy as w}from"../../../../geometry/support/boundedPlane.js";import{equals as T}from"../../../../geometry/support/spatialReferenceUtils.js";import E from"../../../../layers/GraphicsLayer.js";import D from"../../../../symbols/SimpleFillSymbol.js";import O from"../../../../symbols/SimpleMarkerSymbol.js";import{DragManipulation as k}from"./manipulations/DragManipulation.js";import{RotateManipulation as A}from"./manipulations/RotateManipulation.js";import{ScaleManipulation as j}from"./manipulations/ScaleManipulation.js";import{PreserveAspectRatio as M,SnapRotation as N}from"./manipulations/utils.js";import{InteractiveToolBase as P}from"../../../interactive/InteractiveToolBase.js";import{KeyBindings as F,mediaKeys as I}from"../../../interactive/keybindings.js";import{EditGeometry as L}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as R}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{calculateOrientedBounds as z}from"../../../interactive/editGeometry/support/editPlaneUtils.js";import{findFirstGraphicHit as B}from"../../../support/hitTestSelectUtils.js";import{createScreenPointFromEvent as V}from"../../../support/screenUtils.js";const H=[[1,1],[1,-1],[-1,-1],[-1,1],[1,0],[0,-1],[-1,0],[0,1]];let U=class extends P{constructor(e){super(e),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._planeCache=C(),this._displayPlaneCache=C(),this._mainAxisCache=u(),this._rotationHandleCache=v(),this._cornerA=v(),this._cornerB=v(),this._cornerC=v(),this._cornerD=v(),this._avgAB=v(),this._avgBC=v(),this._avgCD=v(),this._avgDA=v(),this._preserveAspectRatio=new M,this._snapRotation=new N,this._graphicsLayer=new E({internal:!0,listMode:`hide`,visible:!1,title:`TransformTool layer`}),this._sharedUndoStack=[],this._sharedRedoStack=[],this._isOpacityToggled=!1,this._factor=1,this.preserveAspectRatio=null,this.snapRotation=null,this.type=`transform`}initialize(){this._initialize()}destroy(){let{map:e}=this.view;this._dragManipulation.destroy(),this._rotateManipulation.destroy(),this._scaleManipulations.forEach(e=>e.destroy()),this._editGeometryOperations.destroy(),e.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=r(this._graphicsLayer),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._preserveAspectRatio=null,this._snapRotation=null,this._planeCache=null,this._displayPlaneCache=null,this._rotationHandleCache=null,this._mainAxisCache=null,this._cornerA=null,this._cornerB=null,this._cornerC=null,this._cornerD=null,this._avgAB=null,this._avgBC=null,this._avgCD=null,this._avgDA=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _plane(){let e=this._graphic.geometry;if(e==null)return null;let t=this._editGeometryOperations.data,n=t.parts[0].segments[0],r=c(this._mainAxisCache,n.leftVertex.pos,n.rightVertex.pos);l(r,r);let i=80*this.view.resolution,o=this.view.spatialReference;return T(o,e.spatialReference)&&(i*=a(o)/a(e.spatialReference)),z(r,t,i,this._planeCache)}get _displayPlane(){let e=this._plane;if(!e)return null;let t=this._displayPlaneCache;w(e,t);let n=10*this.view.resolution;return f(t.basis1,t.basis1,1+n/p(t.basis1)),f(t.basis2,t.basis2,1+n/p(t.basis2)),t}get _backgroundGraphicGeometry(){let e=this._displayPlane;if(!e)return null;let t=this.view.spatialReference;return this._updateDisplayPlaneConrers(e),new b({spatialReference:t,rings:[[this._cornerA,this._cornerB,this._cornerC,this._cornerD,this._cornerA]]})}get _rotateGraphicGeometry(){let e=this._plane;if(!e)return null;let t=this._rotationHandleCache;return m(t,e.basis1),f(t,t,30*this.view.resolution),h(t,t,e.origin),h(t,t,e.basis1),new y({x:t[0],y:t[1],spatialReference:this.view.spatialReference})}get _scaleGraphicGeometries(){let e=this._displayPlane;if(!e)return[];let t=this.view.spatialReference;this._updateDisplayPlaneConrers(e);let{_cornerA:n,_cornerB:r,_cornerC:i,_cornerD:a}=this,o=g(this._avgAB,n,r,.5),s=g(this._avgBC,r,i,.5),c=g(this._avgCD,i,a,.5),l=g(this._avgDA,a,n,.5);return[new y({x:n[0],y:n[1],spatialReference:t}),new y({x:r[0],y:r[1],spatialReference:t}),new y({x:i[0],y:i[1],spatialReference:t}),new y({x:a[0],y:a[1],spatialReference:t}),new y({x:o[0],y:o[1],spatialReference:t}),new y({x:s[0],y:s[1],spatialReference:t}),new y({x:c[0],y:c[1],spatialReference:t}),new y({x:l[0],y:l[1],spatialReference:t})]}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){return this._editGeometryOperations.canUndo}canRedo(){return this._editGeometryOperations.canRedo}undo(){this._editGeometryOperations.undo(),this.updateGraphics()}redo(){this._editGeometryOperations.redo(),this.updateGraphics()}refresh(){let{view:e,target:t}=this,n=`georeference`in t?t.georeference.coords:t.geometry,r=this._editGeometryOperations,i=r.data.parts[0].vertices,a=L.fromGeometry(x(n,e.spatialReference),2).parts[0].vertices;i.forEach((e,t)=>{r.setVertexPosition(e,a[t].pos)}),this.updateGraphics()}reset(){let{target:e}=this;if(`georeference`in e){let t=e.georeference;t.type===`control-points`&&(t.controlPoints=this._initialControlPoints)}else e.geometry=this._initialGeometry;this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){let e=this._editGeometryOperations.data.geometry;if(`georeference`in this.target){let t=this.target.georeference;t.coords=e}this._graphic.geometry=e,this._backgroundGraphic.geometry=this._backgroundGraphicGeometry,this._rotateGraphic.geometry=this._rotateGraphicGeometry,this._scaleGraphicGeometries.forEach((e,t)=>{this._scaleGraphics[t].geometry=e})}setSharedUndoStack(e){this._sharedUndoStack=e}setSharedRedoStack(e){this._sharedRedoStack=e}async _initialize(){let{view:e,target:r}=this;if(`georeference`in r){let e=r.georeference;this._graphic=new t({geometry:e.coords}),this._initialControlPoints=e.type===`control-points`?e.controlPoints:null}else this._graphic=r,this._initialGeometry=r.geometry;e.map.addMany([this._graphicsLayer]),e.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._editGeometryOperations=R.fromGeometry(x(this._graphic.geometry,e.spatialReference),2),this._backgroundGraphic=new t({symbol:new D({color:`transparent`,outline:{type:`simple-line`,color:e.effectiveTheme.accentColor,width:2}}),geometry:this._backgroundGraphicGeometry}),this._rotateGraphic=new t({symbol:new O({color:n(e.effectiveTheme.accentColor),outline:{type:`simple-line`,color:e.effectiveTheme.accentColor,width:1}}),geometry:this._rotateGraphicGeometry}),this._scaleGraphics=this._scaleGraphicGeometries.map(r=>new t({symbol:new O({size:6,style:`square`,color:n(e.effectiveTheme.accentColor),outline:{type:`simple-line`,color:e.effectiveTheme.accentColor,width:1}}),geometry:r})),this._graphicsLayer.graphics.addMany([this._backgroundGraphic,this._rotateGraphic,...this._scaleGraphics]),this._dragManipulation=new k({tool:this,view:e,graphic:this._graphic}),this._rotateManipulation=new A({tool:this,view:e,graphic:this._rotateGraphic,snapRotation:this._snapRotation}),this._scaleManipulations=this._scaleGraphics.map((t,n)=>new j({tool:this,view:e,graphic:t,direction:H[n],preserveAspectRatio:this._preserveAspectRatio})),this.addHandles([this._dragManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),this._rotateManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),...this._scaleManipulations.map(e=>e.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this))),i(()=>this.view.scale,()=>this.active?this.updateGraphics():null),e.on(`click`,async t=>{if(e.activeTool!=null&&e.activeTool!==this)return;let n=V(t),i=[];e.map.allLayers.forEach(e=>{(e.type===`vector-tile`||e.type===`imagery`)&&i.push(e)});let a=await this.view.hitTest(n,{exclude:i}),o=a.results;if(o.length===0)e.activeTool=null;else{let t=B(a.results),n=`georeference`in r,i=o.map(e=>e.type===`media`?e.element:null).filter(Boolean),s=new Set([...this._graphicsLayer.graphics,n?null:r].filter(Boolean));n&&i.includes(r)||t!=null&&s.has(t.graphic)?e.activeTool??=this:e.activeTool=null}})]);let a=e=>{this.addHandles(e.events.on(`grab-changed`,e=>{`georeference`in r&&(e.action===`start`?r.opacity*=.5:e.action===`end`&&(r.opacity*=2))}))};this._dragManipulation.forEachManipulator(a),this._rotateManipulation.forEachManipulator(a),this._scaleManipulations.forEach(e=>e.forEachManipulator(a));let o=new F;o.addToggle(I.preserveAspectRatio,()=>{this.preserveAspectRatio??(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled)}),o.addToggle(I.rotateIncrements,()=>{this.snapRotation??(this._snapRotation.enabled=!this._snapRotation.enabled)}),o.add(I.toggleOpacity,()=>{`georeference`in r&&(r.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled)}),o.addToggle(I.factorModifier,e=>this._factor=e.type===`key-down`?10:1),o.add(I.scaleUp,()=>this._scale(this._factor)),o.add(I.scaleDown,()=>this._scale(-this._factor)),o.add(I.moveUp,()=>this._move(0,this._factor)),o.add(I.moveDown,()=>this._move(0,-this._factor)),o.add(I.moveLeft,()=>this._move(-this._factor,0)),o.add(I.moveRight,()=>this._move(this._factor,0)),this.addHandles([e.on(`key-down`,t=>{e.activeTool===this&&o.dispatch(e.inputManager,t)}),e.on(`key-up`,t=>{e.activeTool===this&&o.dispatch(e.inputManager,t)})])}async _loadProjectionEngine(){let e=this._graphic.geometry;return S(e.spatialReference,this.view.spatialReference)}_updateDisplayPlaneConrers(e){let{basis1:t,basis2:n,origin:r}=e,i=this._cornerA;h(i,r,t),h(i,i,n);let a=this._cornerB;h(a,r,t),_(a,a,n);let o=this._cornerC;_(o,r,t),_(o,o,n);let s=this._cornerD;_(s,r,t),h(s,s,n)}_getInfo(){return{editGeometryOperations:this._editGeometryOperations,plane:this._plane,displayPlane:this._displayPlane}}_updateGraphics(e,t){e.action===`start`&&(this._sharedUndoStack.push({tool:this,operation:t}),this._sharedRedoStack.length=0),this.updateGraphics()}_scale(e){let t=this._editGeometryOperations,n=t.data.geometry.extent?.width,r=(n+e*this.view.resolution)/n,i=t.scale(this._plane.origin,d,r,r,0,1);this._sharedUndoStack.push({tool:this,operation:i}),this._sharedRedoStack.length=0,this.updateGraphics()}_move(e,t){let n=this._editGeometryOperations.move(e*this.view.resolution,t*this.view.resolution,0,0);this._sharedUndoStack.push({tool:this,operation:n}),this._sharedRedoStack.length=0,this.updateGraphics()}};e([o()],U.prototype,`_plane`,null),e([o()],U.prototype,`_backgroundGraphicGeometry`,null),e([o()],U.prototype,`_rotateGraphicGeometry`,null),e([o()],U.prototype,`_scaleGraphicGeometries`,null),e([o()],U.prototype,`preserveAspectRatio`,void 0),e([o()],U.prototype,`snapRotation`,void 0),e([o({constructOnly:!0,nonNullable:!0})],U.prototype,`target`,void 0),e([o({readOnly:!0})],U.prototype,`type`,void 0),e([o({constructOnly:!0})],U.prototype,`view`,void 0),U=e([s(`esri.views.2d.interactive.editingTools.TransformTool`)],U);export{U as TransformTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../../core/Handles.js";import{set as t,normalize as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as i,scaleAndAdd as a,subtract as o,length as s,dot as c}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as u,a as d}from"../../../../../chunks/boundedPlane.js";import{getClosestDenormalizedXToReference as f}from"../../../../../geometry/support/normalizeUtils.js";import{getInfo as p}from"../../../../../geometry/support/spatialReferenceUtils.js";import{Manipulation as m}from"./Manipulation.js";import{onGrabChangedHandle as h}from"./utils.js";import{createManipulatorDragEventPipeline as g,screenToMap as _}from"../../../../interactive/dragEventPipeline.js";import{GraphicManipulator as v}from"../../../../interactive/GraphicManipulator.js";import{apply as y}from"../../../../interactive/editGeometry/support/editPlaneUtils.js";const b=1e-6;function x(e){let t=s(e.basis1),n=s(e.basis2);return .3*Math.min(t,n)}class S extends m{constructor(t){super(),this._handles=new e,this._planeStart=u(),this._displayPlaneStart=u(),this._originCache=l(),this._axisCache=r(),this._renderStartCache=l(),this._renderEndCache=l(),this._resizeOriginCache=l(),this._view=t.view,this._tool=t.tool,this._graphic=t.graphic,this._direction=t.direction,this._preserveAspectRatio=t.preserveAspectRatio,this._manipulator=this._createManipulator(),this._handles.add([this._manipulator.events.on(`grab-changed`,e=>h(e,this._manipulator))]),this.forEachManipulator(e=>this._tool.manipulators.add(e))}destroy(){this._handles.destroy(),this.forEachManipulator(e=>{this._tool.manipulators.remove(e),e.destroy()}),this._tool=null,this._view=null,this._graphic=null,this._manipulator=null,this._direction=null,this._handles=null,this._planeStart=null,this._displayPlaneStart=null,this._originCache=null,this._axisCache=null,this._renderStartCache=null,this._renderEndCache=null,this._resizeOriginCache=null,this._preserveAspectRatio=null}forEachManipulator(e){e(this._manipulator,1)}createDragPipeline(e,r){let l=null,u=null,m=null,h=0,v=null,S=null,C=0,w=this._planeStart,T=this._displayPlaneStart,E=this._direction;return g(this._manipulator,(g,D)=>{D.next(t=>{if(t.action===`start`){g.cursor=`grabbing`;let t=e();l=t.plane,u=t.displayPlane,m=t.editGeometryOperations,h=10*this._view.resolution,d(l,w),d(u,T);let n=p(m.data.spatialReference);v=n?n.valid[1]-n.valid[0]-30*this._view.resolution:null}return t}).next(_(this._view)).next(e=>{if(e.action===`start`){let t=T.origin[0]+E[0]*T.basis1[0]+E[1]*T.basis2[0],n=m.data.spatialReference;C=f(e.mapStart.x,t,n)-e.mapStart.x}let t=i(this._renderStartCache,[e.mapStart.x+C,e.mapStart.y,0]),n=i(this._renderEndCache,[e.mapEnd.x+C,e.mapEnd.y,0]),r=i(this._resizeOriginCache,T.origin);a(r,r,T.basis1,-E[0]),a(r,r,T.basis2,-E[1]),o(n,n,r),o(t,t,r);let l=E[0]!==0&&E[1]!==0,d=x(T),p=x(u)/d,g=(e,r)=>{if(e===0)return 1;let i=s(r),a=.5*e*c(r,n)/i,o=a<0?-1:1;if(l){let n=i-.5*e*c(r,t)/i;a+=n*o*p}let u=i<h*1.5?1:b;return i=Math.max(i-h,b),o>0&&(a-=10*this._view.resolution),o*Math.max(a/i*o,u)},_=g(E[0],T.basis1),v=g(E[1],T.basis2);return{...e,direction:E,factor1:_,factor2:v}}).next(this._preserveAspectRatio.createDragEventPipelineStep(),this._preserveAspectRatio.next).next(e=>{let o=i(this._originCache,w.origin);a(o,o,w.basis1,-E[0]),a(o,o,w.basis2,-E[1]);let s=t(this._axisCache,w.basis1[0],w.basis1[1]);n(s,s);let c=m.data.allVerticesUnordered,u=e.action===`start`?0:1,f=m.scaleVertices(c,o,s,e.factor1,e.factor2,u,1);return v&&v<m.data.geometry.extent.width&&S?m.updateVertices(c,S):(d(w,l),y(f,l),S=f.operation,r(e,f)),e}).next(e=>(e.action===`end`&&(g.cursor=`grab`),e))})}_createManipulator(){return new v({view:this._view,graphic:this._graphic,selectable:!0,cursor:`grab`})}}export{S as ScaleManipulation,x as calculateDiagonalResizeHandleScale};
2
+ import e from"../../../../../core/Handles.js";import{set as t,normalize as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as i,scaleAndAdd as a,subtract as o,length as s,dot as c}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as u,copy as d}from"../../../../../geometry/support/boundedPlane.js";import{getClosestDenormalizedXToReference as f}from"../../../../../geometry/support/normalizeUtils.js";import{getInfo as p}from"../../../../../geometry/support/spatialReferenceUtils.js";import{Manipulation as m}from"./Manipulation.js";import{onGrabChangedHandle as h}from"./utils.js";import{createManipulatorDragEventPipeline as g,screenToMap as _}from"../../../../interactive/dragEventPipeline.js";import{GraphicManipulator as v}from"../../../../interactive/GraphicManipulator.js";import{apply as y}from"../../../../interactive/editGeometry/support/editPlaneUtils.js";const b=1e-6;function x(e){let t=s(e.basis1),n=s(e.basis2);return .3*Math.min(t,n)}class S extends m{constructor(t){super(),this._handles=new e,this._planeStart=u(),this._displayPlaneStart=u(),this._originCache=l(),this._axisCache=r(),this._renderStartCache=l(),this._renderEndCache=l(),this._resizeOriginCache=l(),this._view=t.view,this._tool=t.tool,this._graphic=t.graphic,this._direction=t.direction,this._preserveAspectRatio=t.preserveAspectRatio,this._manipulator=this._createManipulator(),this._handles.add([this._manipulator.events.on(`grab-changed`,e=>h(e,this._manipulator))]),this.forEachManipulator(e=>this._tool.manipulators.add(e))}destroy(){this._handles.destroy(),this.forEachManipulator(e=>{this._tool.manipulators.remove(e),e.destroy()}),this._tool=null,this._view=null,this._graphic=null,this._manipulator=null,this._direction=null,this._handles=null,this._planeStart=null,this._displayPlaneStart=null,this._originCache=null,this._axisCache=null,this._renderStartCache=null,this._renderEndCache=null,this._resizeOriginCache=null,this._preserveAspectRatio=null}forEachManipulator(e){e(this._manipulator,1)}createDragPipeline(e,r){let l=null,u=null,m=null,h=0,v=null,S=null,C=0,w=this._planeStart,T=this._displayPlaneStart,E=this._direction;return g(this._manipulator,(g,D)=>{D.next(t=>{if(t.action===`start`){g.cursor=`grabbing`;let t=e();l=t.plane,u=t.displayPlane,m=t.editGeometryOperations,h=10*this._view.resolution,d(l,w),d(u,T);let n=p(m.data.spatialReference);v=n?n.valid[1]-n.valid[0]-30*this._view.resolution:null}return t}).next(_(this._view)).next(e=>{if(e.action===`start`){let t=T.origin[0]+E[0]*T.basis1[0]+E[1]*T.basis2[0],n=m.data.spatialReference;C=f(e.mapStart.x,t,n)-e.mapStart.x}let t=i(this._renderStartCache,[e.mapStart.x+C,e.mapStart.y,0]),n=i(this._renderEndCache,[e.mapEnd.x+C,e.mapEnd.y,0]),r=i(this._resizeOriginCache,T.origin);a(r,r,T.basis1,-E[0]),a(r,r,T.basis2,-E[1]),o(n,n,r),o(t,t,r);let l=E[0]!==0&&E[1]!==0,d=x(T),p=x(u)/d,g=(e,r)=>{if(e===0)return 1;let i=s(r),a=.5*e*c(r,n)/i,o=a<0?-1:1;if(l){let n=i-.5*e*c(r,t)/i;a+=n*o*p}let u=i<h*1.5?1:b;return i=Math.max(i-h,b),o>0&&(a-=10*this._view.resolution),o*Math.max(a/i*o,u)},_=g(E[0],T.basis1),v=g(E[1],T.basis2);return{...e,direction:E,factor1:_,factor2:v}}).next(this._preserveAspectRatio.createDragEventPipelineStep(),this._preserveAspectRatio.next).next(e=>{let o=i(this._originCache,w.origin);a(o,o,w.basis1,-E[0]),a(o,o,w.basis2,-E[1]);let s=t(this._axisCache,w.basis1[0],w.basis1[1]);n(s,s);let c=m.data.allVerticesUnordered,u=e.action===`start`?0:1,f=m.scaleVertices(c,o,s,e.factor1,e.factor2,u,1);return v&&v<m.data.geometry.extent.width&&S?m.updateVertices(c,S):(d(w,l),y(f,l),S=f.operation,r(e,f)),e}).next(e=>(e.action===`end`&&(g.cursor=`grab`),e))})}_createManipulator(){return new v({view:this._view,graphic:this._graphic,selectable:!0,cursor:`grab`})}}export{S as ScaleManipulation,x as calculateDiagonalResizeHandleScale};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{isSome as n}from"../../../core/arrayUtils.js";import r from"../../../core/Collection.js";import{makeHandle as i}from"../../../core/handleUtils.js";import"../../../core/has.js";import{QueueProcessor as a}from"../../../core/QueueProcessor.js";import{watch as o,sync as s}from"../../../core/reactiveUtils.js";import{isScreenRect as c}from"../../../core/screenUtils.js";import{property as l,subclass as u}from"../../../core/accessorSupport/decorators.js";import{convertGeometryToMask as d}from"../../../layers/raster/functions/clipUtils.js";import f from"../../../layers/support/FeatureFilter.js";import{GraphicsCollection as p}from"../../../support/GraphicsCollection.js";import m from"../engine/flow/FlowView2D.js";import{LayerView2D as h}from"./LayerView2D.js";import g from"./graphics/GraphicsView2D.js";import _ from"./graphics/HighlightGraphicContainer.js";import v from"./imagery/ImageryView2D.js";import y from"./imagery/VectorFieldView2D.js";import b from"../../layers/ImageryLayerView.js";import{RefreshableLayerView as x}from"../../layers/RefreshableLayerView.js";import{isPixelHighlightTarget as S,isEmptyPixelRanges as C}from"../../layers/support/highlightUtils.js";import{defaultColor as w}from"../../support/HighlightDefaults.js";import{getHighlightName as T}from"../../support/highlightOptionsUtils.js";let E=class extends x(h(b)){constructor(){super(...arguments),this._exportImageVersion=-1,this._highlightGraphics=new p,this._highlightView=void 0,this._pixelHighlights=[],this.layer=null,this.subview=null}get pixelData(){let{subview:e}=this;return this.updating||!e?null:`getPixelData`in e?e.getPixelData():null}update(e){this.subview?.update(e)}attach(){this.layer.increaseRasterJobHandlerUsage(),this._setSubView(),this.view&&(this._highlightView=new g({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new _(this.view.featuresTilingScheme)}),this.container.addChild(this._highlightView.container)),this.addAttachHandles([o(()=>this.layer.exportImageServiceParameters.version,e=>{e&&this._exportImageVersion!==e&&(this._exportImageVersion=e,this.requestUpdate())},s),o(()=>this.timeExtent,e=>{let{subview:t}=this;t&&(t.timeExtent=e,`redraw`in t?this.requestUpdate():t.redrawOrRefetch())},s),this.layer.on(`redraw`,()=>{let{subview:e}=this;e&&(`redraw`in e?e.redraw():e.redrawOrRefetch())}),o(()=>this.layer.renderer,()=>this._setSubView()),o(()=>this.view?.highlights.items.map(({name:e,color:t})=>({name:e,color:t})),()=>this._updateHighlightOptions(this.subview))])}detach(){this.layer.decreaseRasterJobHandlerUsage(),this.container.removeAllChildren(),this._detachSubview(this.subview),this.subview?.destroy(),this.subview=null,this._highlightView?.destroy(),this._exportImageVersion=-1}viewChange(){}moveEnd(){this.requestUpdate()}async hitTest(e,t){let{layer:n,subview:r}=this;if(!n.loaded||!this.attached||!r?.attached)return null;c(t)&&(e=this.view.toMap({x:t.x+t.width/2,y:t.y+t.height/2}));let i=await r.hitTest(e);return i==null?null:[{type:`raster`,layer:n,mapPoint:e,...i}]}highlight(e,a){if(S(e))return C(e)?i():this._highlightPixels(e,a);if(typeof e==`number`||typeof e==`string`)return this._highlightByImageIds([e],a);let o=Array.isArray(e)||r.isCollection(e)?e.at(0):e;if(typeof o==`number`||typeof o==`string`)return this._highlightByImageIds(e,a);if(!(o instanceof t))return i();let s=[];if(Array.isArray(e)||r.isCollection(e)?s=e.map(e=>e.clone()):e instanceof t&&(s=[e.clone()]),!s?.filter(n)?.length)return i();let c=T(a),l=this._addHighlightGraphics(s,c);return i(()=>!this.destroyed&&this._removeHighlightGraphics(s,l))}_highlightByImageIds(e,t){let n=T(t),r=new AbortController,{signal:o}=r,s=this.layer.sourceJSON.maxRecordCount??1e3,c=Math.ceil(e.length/s),l=[],u=[],d=new a({concurrency:4,process:e=>this.layer.queryFeatures({objectIds:e.ids,returnGeometry:!0,outSpatialReference:this.view.spatialReference},{signal:o}).then(e=>u.push(...e.features)).catch(()=>{})});for(let t=0;t<c;t++)l.push(d.push({ids:e.slice(t*s,(t+1)*s)}));return Promise.allSettled(l).then(()=>{if(u.length&&!o.aborted){let e=this._addHighlightGraphics(u,n);o.addEventListener(`abort`,()=>{this._removeHighlightGraphics(u,e)})}}),i(()=>r.abort())}_highlightPixels(e,t){let n={target:e,options:t};return this._pixelHighlights.push(n),this._updateHighlightOptions(this.subview),i(()=>{let e=this._pixelHighlights.indexOf(n);e>-1&&(this._pixelHighlights.splice(e,1),this._updateHighlightOptions(this.subview))})}_addHighlightGraphics(e,t){return this._highlightGraphics.addMany(e),this._addHighlightFilter(new f({objectIds:e.map(e=>e.uid)}),t)}_removeHighlightGraphics(e,t){this._highlightGraphics.removeMany(e),this._removeHighlight(t)}async doRefresh(){this.requestUpdate()}isUpdating(){return!this.subview||this.subview.updating||!!this._highlightView?.updating}_onHighlightChange(){let e=this._getHighlightFilterGroups();this._highlightView?.setHighlightFilters(e)}_setSubView(){if(!this.view)return;let e=this.layer.renderer?.type,t=`imagery`;if(e===`vector-field`?t=`imageryVF`:e===`flow`&&(t=`flow`),this.subview){let{type:e}=this.subview;if(e===t){this._attachSubview(this.subview),e===`flow`?this.subview.redrawOrRefetch():e===`imagery`&&this.layer.format===`lerc`?this.subview.redraw():this.requestUpdate();return}this._detachSubview(this.subview),this.subview?.destroy()}t===`imagery`?(this.subview=new v({layer:this.layer,view:this.view,timeExtent:this.timeExtent,updatingHandles:this._updatingHandles}),this._updateHighlightOptions(this.subview)):this.subview=t===`imageryVF`?new y({layer:this.layer,view:this.view,timeExtent:this.timeExtent}):new m({layer:this.layer,layerView:this}),this._attachSubview(this.subview),this.requestUpdate()}_attachSubview(e){e&&!e.attached&&(e.attach(),e.attached=!0,this.container.addChildAt(e.container,0))}_detachSubview(e){e?.attached&&(this.container.removeChild(e.container),e.detach(),e.attached=!1)}_updateHighlightOptions(e){let t=this.view.highlights;this._pixelHighlights.sort((e,n)=>t.findIndex(({name:e})=>e===T(n.options))-t.findIndex(({name:t})=>t===T(e.options)));let r=this._pixelHighlights.map(({target:e,options:n})=>D(e,t,n)).filter(n);e?.type===`imagery`&&(e.pixelHighlights=r,e.attached&&(this.layer.format===`lerc`?e.redraw():this.requestUpdate()))}};e([l()],E.prototype,`pixelData`,null),e([l()],E.prototype,`subview`,void 0),E=e([u(`esri.views.2d.layers.ImageryLayerView2D`)],E);function D(e,t,n){let r=T(n),i=(t.find(e=>e.name===r)?.color??w).toArray(),{pixelRanges:a}=e;if(Array.isArray(a))return{ranges:a,bandId:e.bandId??0,color:i};let o=a.type===`extent`?a:a.extent;if(!o)return;let s=[o.xmin,o.xmax],c=[o.ymin,o.ymax],{xBandId:l,yBandId:u}=e,f=1024,p=1024;return{xBandId:l,yBandId:u,xBandRange:s,yBandRange:c,color:i,width:f,height:p,xyMask:a.type===`polygon`?d({srcExtent:o,geometry:a,size:[f,p]}):void 0}}const O=E;export{O as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../Graphic.js";import{isSome as n}from"../../../core/arrayUtils.js";import r from"../../../core/Collection.js";import{makeHandle as i}from"../../../core/handleUtils.js";import"../../../core/has.js";import{QueueProcessor as a}from"../../../core/QueueProcessor.js";import{watch as o,sync as s}from"../../../core/reactiveUtils.js";import{isScreenRect as c}from"../../../core/screenUtils.js";import{property as l,subclass as u}from"../../../core/accessorSupport/decorators.js";import{convertGeometryToMask as d}from"../../../layers/raster/functions/clipUtils.js";import f from"../../../layers/support/FeatureFilter.js";import{GraphicsCollection as p}from"../../../support/GraphicsCollection.js";import m from"../engine/flow/FlowView2D.js";import{LayerView2D as h}from"./LayerView2D.js";import g from"./graphics/GraphicsView2D.js";import _ from"./graphics/HighlightGraphicContainer.js";import v from"./imagery/ImageryView2D.js";import y from"./imagery/VectorFieldView2D.js";import b from"../../layers/ImageryLayerView.js";import{RefreshableLayerView as x}from"../../layers/RefreshableLayerView.js";import{isPixelHighlightTarget as S,isEmptyPixelRanges as C}from"../../layers/support/highlightUtils.js";import{defaultColor as w}from"../../support/HighlightDefaults.js";import{getHighlightName as T}from"../../support/highlightOptionsUtils.js";let E=class extends x(h(b)){constructor(){super(...arguments),this._exportImageVersion=-1,this._highlightGraphics=new p,this._highlightView=void 0,this._maxPixelSizePromise=null,this._pixelHighlights=[],this.layer=null,this.subview=null}get pixelData(){let{subview:e}=this;return this.updating||!e?null:`getPixelData`in e?e.getPixelData():null}update(e){this.subview?.update(e),this._highlightView?.processUpdate(e),this._updatingHandles.consumePromise(this._updateHighlightVisibility())}attach(){this.layer.increaseRasterJobHandlerUsage(),this._setSubView(),this.view&&(this._highlightView=new g({view:this.view,graphics:this._highlightGraphics,requestUpdateCallback:()=>this.requestUpdate(),container:new _(this.view.featuresTilingScheme)}),this.container.addChild(this._highlightView.container)),this.addAttachHandles([o(()=>this.layer.exportImageServiceParameters.version,e=>{e&&this._exportImageVersion!==e&&(this._exportImageVersion=e,this.requestUpdate())},s),o(()=>this.timeExtent,e=>{let{subview:t}=this;t&&(t.timeExtent=e,`redraw`in t?this.requestUpdate():t.redrawOrRefetch())},s),this.layer.on(`redraw`,()=>{let{subview:e}=this;e&&(`redraw`in e?e.redraw():e.redrawOrRefetch())}),o(()=>this.layer.renderer,()=>this._setSubView()),o(()=>this.view?.highlights.items.map(({name:e,color:t})=>({name:e,color:t})),()=>this._updateHighlightOptions(this.subview))])}detach(){this.layer.decreaseRasterJobHandlerUsage(),this.container.removeAllChildren(),this._detachSubview(this.subview),this.subview?.destroy(),this.subview=null,this._highlightView?.destroy(),this._exportImageVersion=-1}viewChange(){}moveEnd(){this.requestUpdate()}async hitTest(e,t){let{layer:n,subview:r}=this;if(!n.loaded||!this.attached||!r?.attached)return null;c(t)&&(e=this.view.toMap({x:t.x+t.width/2,y:t.y+t.height/2}));let i=await r.hitTest(e);return i==null?null:[{type:`raster`,layer:n,mapPoint:e,...i}]}highlight(e,a){if(S(e))return C(e)?i():this._highlightPixels(e,a);if(this.layer.sourceType===`mosaic-dataset`&&(this._maxPixelSizePromise??=this.layer.fetchMaxPixelSize(this.view.spatialReference).catch(()=>null)),typeof e==`number`||typeof e==`string`)return this._highlightByImageIds([e],a);let o=Array.isArray(e)||r.isCollection(e)?e.at(0):e;if(typeof o==`number`||typeof o==`string`)return this._highlightByImageIds(e,a);if(!(o instanceof t))return i();let s=[];if(Array.isArray(e)||r.isCollection(e)?s=e.map(e=>e.clone()):e instanceof t&&(s=[e.clone()]),!s?.filter(n)?.length)return i();let c=T(a),l=this._addHighlightGraphics(s,c);return i(()=>!this.destroyed&&this._removeHighlightGraphics(s,l))}_highlightByImageIds(e,t){let n=T(t),r=new AbortController,{signal:o}=r,s=this.layer.sourceJSON.maxRecordCount??1e3,c=Math.ceil(e.length/s),l=[],u=[],d=new a({concurrency:4,process:e=>this.layer.queryFeatures({objectIds:e.ids,returnGeometry:!0,outSpatialReference:this.view.spatialReference},{signal:o}).then(e=>u.push(...e.features)).catch(()=>{})});for(let t=0;t<c;t++)l.push(d.push({ids:e.slice(t*s,(t+1)*s)}));return Promise.allSettled(l).then(()=>{if(u.length&&!o.aborted){let e=this._addHighlightGraphics(u,n);o.addEventListener(`abort`,()=>{this._removeHighlightGraphics(u,e)})}}),i(()=>r.abort())}_highlightPixels(e,t){let n={target:e,options:t};return this._pixelHighlights.push(n),this._updateHighlightOptions(this.subview),i(()=>{let e=this._pixelHighlights.indexOf(n);e>-1&&(this._pixelHighlights.splice(e,1),this._updateHighlightOptions(this.subview))})}_addHighlightGraphics(e,t){return this._highlightGraphics.addMany(e),this._addHighlightFilter(new f({objectIds:e.map(e=>e.uid)}),t)}_removeHighlightGraphics(e,t){this._highlightGraphics.removeMany(e),this._removeHighlight(t)}async doRefresh(){this.requestUpdate()}isUpdating(){return!this.subview||this.subview.updating||!!this._highlightView?.updating}_onHighlightChange(){let e=this._getHighlightFilterGroups();this._highlightView?.setHighlightFilters(e)}_setSubView(){if(!this.view)return;let e=this.layer.renderer?.type,t=`imagery`;if(e===`vector-field`?t=`imageryVF`:e===`flow`&&(t=`flow`),this.subview){let{type:e}=this.subview;if(e===t){this._attachSubview(this.subview),e===`flow`?this.subview.redrawOrRefetch():e===`imagery`&&this.layer.format===`lerc`?this.subview.redraw():this.requestUpdate();return}this._detachSubview(this.subview),this.subview?.destroy()}t===`imagery`?(this.subview=new v({layer:this.layer,view:this.view,timeExtent:this.timeExtent,updatingHandles:this._updatingHandles}),this._updateHighlightOptions(this.subview)):this.subview=t===`imageryVF`?new y({layer:this.layer,view:this.view,timeExtent:this.timeExtent}):new m({layer:this.layer,layerView:this}),this._attachSubview(this.subview),this.requestUpdate()}_attachSubview(e){e&&!e.attached&&(e.attach(),e.attached=!0,this.container.addChildAt(e.container,0))}_detachSubview(e){e?.attached&&(this.container.removeChild(e.container),e.detach(),e.attached=!1)}async _updateHighlightVisibility(){let e=this._highlightView?.container;if(!e||this.suspended)return;if(this.layer.mosaicRule?.method===`lock-raster`){e.visible=!0;return}let t=await this._maxPixelSizePromise;t!=null&&(e.visible=(t.x+t.y)/2>this.view.resolution)}_updateHighlightOptions(e){let t=this.view.highlights;this._pixelHighlights.sort((e,n)=>t.findIndex(({name:e})=>e===T(n.options))-t.findIndex(({name:t})=>t===T(e.options)));let r=this._pixelHighlights.map(({target:e,options:n})=>D(e,t,n)).filter(n);e?.type===`imagery`&&(e.pixelHighlights=r,e.attached&&(this.layer.format===`lerc`?e.redraw():this.requestUpdate()))}};e([l()],E.prototype,`pixelData`,null),e([l()],E.prototype,`subview`,void 0),E=e([u(`esri.views.2d.layers.ImageryLayerView2D`)],E);function D(e,t,n){let r=T(n),i=(t.find(e=>e.name===r)?.color??w).toArray(),{pixelRanges:a}=e;if(Array.isArray(a))return{ranges:a,bandId:e.bandId??0,color:i};let o=a.type===`extent`?a:a.extent;if(!o)return;let s=[o.xmin,o.xmax],c=[o.ymin,o.ymax],{xBandId:l,yBandId:u}=e,f=1024,p=1024;return{xBandId:l,yBandId:u,xBandRange:s,yBandRange:c,color:i,width:f,height:p,xyMask:a.type===`polygon`?d({srcExtent:o,geometry:a,size:[f,p]}):void 0}}const O=E;export{O as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import e from"../../../../Color.js";import{getContrast as t,multiplyOpacityToUnitRGBA as n}from"../../../../core/colorUtils.js";class r{constructor(){this.glowWidth=8,this.innerWidth=.75}}const i=new r;function a(e){let n=e.accentColor;return{glowColor:n,innerColor:t(n),globalAlpha:n.a*.75}}class o{constructor(){this.size=.5}}const s=new o;function c(e){return n(e.accentColor,.75)}function l(e){return n(e.accentColor,.75)}const u={line:1,manipulator:2};class d{constructor(){this.size=.5,this.visibleColor=new e([3,252,111,.75]),this.occludedColor=new e([252,3,69,.75]),this.undefinedColor=new e([127,127,127,.75])}}const f=new d;class p{constructor(){this.innerWidth=2,this.outerWidth=8,this.visibleInnerColor=new e([3,252,111,1]),this.visibleOuterColor=new e([3,252,111,.15]),this.occludedInnerColor=new e([252,3,69,1]),this.occludedOuterColor=new e([252,3,69,.1]),this.undefinedInnerColor=new e([255,255,255,1]),this.undefinedOuterColor=new e([127,127,127,.2])}}const m=new p;export{l as getInteractiveTargetRGBA,a as getLaserLineColors,c as getObserverRGBA,i as laserLineConfiguration,m as lineOfSightConfiguration,u as lineOfSightTransparentRenderOrder,s as observerConfiguration,f as targetConfiguration};
2
+ import e from"../../../../Color.js";import{getContrast as t,multiplyOpacityToUnitRGBA as n}from"../../../../core/colorUtils.js";class r{constructor(){this.glowWidth=8,this.innerWidth=.75}}const i=new r;function a(e){let n=e.accentColor;return{glowColor:n,innerColor:t(n),globalAlpha:n.a*.75}}class o{constructor(){this.radius=5}}const s=new o;function c(e){return n(e.accentColor,.75)}function l(e){return n(e.accentColor,.75)}const u={line:1,manipulator:2};class d{constructor(){this.radius=5,this.visibleColor=new e([3,252,111,.75]),this.occludedColor=new e([252,3,69,.75]),this.undefinedColor=new e([127,127,127,.75])}}const f=new d;class p{constructor(){this.innerWidth=2,this.outerWidth=8,this.visibleInnerColor=new e([3,252,111,1]),this.visibleOuterColor=new e([3,252,111,.15]),this.occludedInnerColor=new e([252,3,69,1]),this.occludedOuterColor=new e([252,3,69,.1]),this.undefinedInnerColor=new e([255,255,255,1]),this.undefinedOuterColor=new e([127,127,127,.2])}}const m=new p;export{l as getInteractiveTargetRGBA,a as getLaserLineColors,c as getObserverRGBA,i as laserLineConfiguration,m as lineOfSightConfiguration,u as lineOfSightTransparentRenderOrder,s as observerConfiguration,f as targetConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{watch as n,syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{snapshotLineOfSightTargetState as o,restoreLineOfSightTargetState as s}from"./LineOfSightAuthoringUtils.js";import{LineOfSightItemManipulatedObject3D as c}from"./LineOfSightItemManipulatedObject3D.js";import{LineOfSightItemTool as l}from"./LineOfSightItemTool.js";import{discRadiusSmall as u}from"../../interactive/editingTools/manipulations/config.js";import{MoveTool3D as d}from"../../interactive/editingTools/move/MoveTool3D.js";import{bindViewToolOptions as f}from"../../../interactive/options/bindViewToolOptions.js";import p from"../../../interactive/options/InteractiveToolOptions.js";import{makeTooltip as m}from"../../../interactive/tooltip/tooltipCommonUtils.js";const h=Symbol(`inactiveMoveManipulatorDisplay`);let g=class extends t{get visible(){return this._get(`visible`)??!0}set visible(e){this._set(`visible`,e),this._itemTool.visible=e,this._moveTool.visible=e}get manipulatorsInteractive(){return this._get(`manipulatorsInteractive`)??!0}set manipulatorsInteractive(e){this._set(`manipulatorsInteractive`,e),this._itemTool.manipulatorsInteractive=e}constructor(e){super(e),this._selectedItem=null,this._objectByItem=new Map,this._undoStack=[],this._redoStack=[];let t=new p;this._tooltip=m(()=>({view:e.view,options:t.tooltips})),this._moveTool=new d({enableVisualElements:!1,manipulatorRadius:u,snappingManager:e.snappingManager,toolOptions:t,tooltip:this._tooltip,view:e.view}),this._itemTool=new l({analysisViewData:e.analysisViewData,snappingManager:e.snappingManager,tooltip:this._tooltip,view:e.view})}initialize(){this.view.tools.add(this._itemTool),this.view.tools.add(this._moveTool),this._itemTool.visible=this.visible,this._moveTool.visible=this.visible,this._itemTool.manipulatorsInteractive=this.manipulatorsInteractive;let e=e=>{let t=e.at(0);t!=null&&this._itemTool.showInteractionVisuals(t)},t=()=>this._itemTool.hideInteractionVisuals();this.addHandles([f(this._moveTool.toolOptions,()=>this.view.options),n(()=>({observer:this.analysis.observer,targets:this.analysis.targets.toArray()}),({observer:e,targets:t})=>this._syncObjects(e,t),r),this._itemTool.events.on(`select-item`,({item:e})=>this._setSelectedItem(e)),this._itemTool.events.on(`selection-cleared`,()=>{if(this._moveTool.hasFocusedManipulators){let e=this._selectedItem==null?null:this._objectByItem.get(this._selectedItem);this._itemTool.selectObject(e)}else this._setSelectedItem(null)}),this._itemTool.events.on(`delete-item`,({target:e})=>this._deleteTarget(e)),this._itemTool.events.on(`record-undo`,({record:e})=>this._recordHistory(_([e]))),this._moveTool.events.on(`record-undo`,({updates:e})=>this._recordHistory(_(e))),this._moveTool.events.on(`hold`,({objects:t})=>e(t)),this._moveTool.events.on(`move-start`,({objects:t})=>{this._itemTool.endDrag(),e(t)}),this._moveTool.events.on(`move-stop`,t),n(()=>({sphereGrabbed:this._itemTool.hasGrabbedManipulators,manipulators:this._moveTool.manipulators.toArray()}),({sphereGrabbed:e})=>{let t=[];e&&this._moveTool.manipulators.forEach(({manipulator:e})=>{t.push(e.disableDisplay())}),this.removeHandles(h),this.addHandles(t,h)},r),n(()=>this._moveTool.firstGrabbedManipulator,e=>{e??t()})])}destroy(){this.removeHandles(h),this.stop(),this.view.tools.remove(this._itemTool),this.view.tools.remove(this._moveTool),this._itemTool.destroy(),this._moveTool.destroy(),this._tooltip.destroy();for(let e of this._objectByItem.values())this.removeHandles(e),e.destroy();this._objectByItem.clear(),this._undoStack.length=0,this._redoStack.length=0}get active(){return this._itemTool.active||this._moveTool.active}get canRedo(){return this._redoStack.length>0}get canUndo(){return this._undoStack.length>0}get hasSelection(){return this._selectedItem!=null}get selectedItem(){return this._selectedItem}get updating(){return this._itemTool.updating||this._moveTool.updating}get laserLineVisualElement(){return this._itemTool.laserLineVisualElement}get verticalLineVisualElement(){return this._itemTool.verticalLineVisualElement}selectItem(e){return this._objectByItem.has(e)?(this._setSelectedItem(e),!0):!1}clearSelection(){return this.hasSelection?(this._setSelectedItem(null),!0):!1}deleteSelectedItem(){let e=this._selectedItem;if(e==null)return!1;let t=this.analysis.targets.find(t=>t===e);return t!=null&&this._deleteTarget(t)}getObserverManipulator(){let e=this.analysis.observer,t=e==null?null:this._itemTool.getManipulator(e);return t!=null&&v(t)?t:null}getTargetManipulator(e){let t=this._itemTool.getManipulator(e);return t!=null&&y(t)?t:null}hasManipulatorAt(e,t){return this._itemTool.hasManipulatorAt(e,t)}redo(){let e=this._redoStack.pop();e!=null&&(e.redo()?(this._undoStack.push(e),this._notifyHistoryChanged()):this._redoStack.push(e))}setEditableFlag(e,t){this._itemTool.setEditableFlag(e,t),this._moveTool.setEditableFlag(e,t)}stop(){(this.view.activeTool===this._itemTool||this.view.activeTool===this._moveTool)&&(this.view.activeTool=null),this._itemTool.hideInteractionVisuals(),this.snappingManager.doneSnapping(),this.clearSelection()}undo(){let e=this._undoStack.pop();e!=null&&(e.undo(),this._redoStack.push(e),this._notifyHistoryChanged())}_syncObjects(e,t){let n=new Set(e==null?t:[e,...t]);for(let[e,t]of this._objectByItem)n.has(e)||(this._selectedItem===e&&this._setSelectedItem(null),this.removeHandles(t),this._itemTool.removeObject(t),this._objectByItem.delete(e),t.destroy());e!=null&&this._ensureObject(e);for(let e of t)this._ensureObject(e);this._setSelectedItem(this._selectedItem)}_ensureObject(e){if(this._objectByItem.has(e))return;let t=new c({analysisViewData:this.analysisViewData,intersector:this.intersector,item:e,view:this.view});this._objectByItem.set(e,t),this._itemTool.addObject(t),this.addHandles(t.on(`modified-externally`,()=>{this._selectedItem===e&&this._setSelectedItem(e)}),t)}_setSelectedItem(e){let t=e==null?null:this._objectByItem.get(e);this._selectedItem=t==null?null:e,this._itemTool.selectObject(t),this._moveTool.objects.removeAll(),t!=null&&this._moveTool.objects.add(t),this._itemTool.interacting=this._selectedItem!=null}_deleteTarget(e){if(this.analysis.targets.length<=1)return!1;let t=this.analysis.targets.indexOf(e);if(t<0)return!1;let n=o(e),r=this._selectedItem===e;return this.analysis.targets.remove(e),this._recordHistory({undo:()=>{s(n,e),this.analysis.targets.add(e,Math.min(t,this.analysis.targets.length)),r&&this._setSelectedItem(e)},redo:()=>this.analysis.targets.includes(e)&&this.analysis.targets.length<=1?!1:(this.analysis.targets.remove(e),this._selectedItem===e&&this._setSelectedItem(null),!0)}),!0}_recordHistory(e){this._undoStack.push(e),this._redoStack.length=0,this._notifyHistoryChanged()}_notifyHistoryChanged(){this.notifyChange(`canUndo`),this.notifyChange(`canRedo`)}get testInfo(){return{moveTooltip:this._tooltip}}};e([i({constructOnly:!0})],g.prototype,`analysisViewData`,void 0),e([i({constructOnly:!0})],g.prototype,`analysis`,void 0),e([i({constructOnly:!0})],g.prototype,`intersector`,void 0),e([i({constructOnly:!0})],g.prototype,`snappingManager`,void 0),e([i({constructOnly:!0})],g.prototype,`view`,void 0),e([i()],g.prototype,`visible`,null),e([i()],g.prototype,`manipulatorsInteractive`,null),e([i()],g.prototype,`_selectedItem`,void 0),e([i()],g.prototype,`active`,null),e([i()],g.prototype,`canRedo`,null),e([i()],g.prototype,`canUndo`,null),e([i()],g.prototype,`selectedItem`,null),e([i()],g.prototype,`updating`,null),g=e([a(`esri.views.3d.analysis.LineOfSight.LineOfSightEditTool`)],g);function _(e){return{undo:()=>{for(let t=e.length-1;t>=0;t--)e[t].undo(null)},redo:()=>{for(let t of e)t.redo(null);return!0}}}function v(e){return e.metadata.type===`observer`}function y(e){return e.metadata.type===`target`}export{g as LineOfSightEditTool};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{watch as n,syncAndInitial as r}from"../../../../core/reactiveUtils.js";import{property as i,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{snapshotLineOfSightTargetState as o,restoreLineOfSightTargetState as s}from"./LineOfSightAuthoringUtils.js";import{LineOfSightItemManipulatedObject3D as c}from"./LineOfSightItemManipulatedObject3D.js";import{LineOfSightItemTool as l}from"./LineOfSightItemTool.js";import{discRadiusSmall as u}from"../../interactive/editingTools/manipulations/config.js";import{MoveTool3D as d}from"../../interactive/editingTools/move/MoveTool3D.js";import{bindViewToolOptions as f}from"../../../interactive/options/bindViewToolOptions.js";import p from"../../../interactive/options/InteractiveToolOptions.js";import{makeTooltip as m}from"../../../interactive/tooltip/tooltipCommonUtils.js";const h=Symbol(`inactiveMoveManipulatorDisplay`);let g=class extends t{get visible(){return this._get(`visible`)??!0}set visible(e){this._set(`visible`,e),this._itemTool.visible=e,this._moveTool.visible=e}get manipulatorsInteractive(){return this._get(`manipulatorsInteractive`)??!0}set manipulatorsInteractive(e){this._set(`manipulatorsInteractive`,e),this._itemTool.manipulatorsInteractive=e}constructor(e){super(e),this._selectedItem=null,this._objectByItem=new Map,this._undoStack=[],this._redoStack=[];let t=new p;this._tooltip=m(()=>({view:e.view,options:t.tooltips})),this._moveTool=new d({enableVisualElements:!1,manipulatorRadius:u,snappingManager:e.snappingManager,toolOptions:t,tooltip:this._tooltip,view:e.view}),this._itemTool=new l({analysisViewData:e.analysisViewData,moveTool:this._moveTool,snappingManager:e.snappingManager,tooltip:this._tooltip,view:e.view})}initialize(){this.view.tools.add(this._itemTool),this.view.tools.add(this._moveTool),this._itemTool.visible=this.visible,this._moveTool.visible=this.visible,this._itemTool.manipulatorsInteractive=this.manipulatorsInteractive;let e=e=>{let t=e.at(0);t!=null&&this._itemTool.showInteractionVisuals(t)},t=()=>this._itemTool.hideInteractionVisuals();this.addHandles([f(this._moveTool.toolOptions,()=>this.view.options),n(()=>({observer:this.analysis.observer,targets:this.analysis.targets.toArray()}),({observer:e,targets:t})=>this._syncObjects(e,t),r),this._itemTool.events.on(`select-item`,({item:e})=>this._setSelectedItem(e)),this._itemTool.events.on(`deselect-item`,()=>this.clearSelection()),this._itemTool.events.on(`delete-item`,({target:e})=>this._deleteTarget(e)),this._itemTool.events.on(`record-undo`,({record:e})=>this._recordHistory(_([e]))),this._moveTool.events.on(`record-undo`,({updates:e})=>this._recordHistory(_(e))),this._moveTool.events.on(`hold`,({objects:t})=>e(t)),this._moveTool.events.on(`move-start`,({objects:t})=>{this._itemTool.endDrag(),e(t)}),this._moveTool.events.on(`move-stop`,t),n(()=>({sphereGrabbed:this._itemTool.hasGrabbedManipulators,manipulators:this._moveTool.manipulators.toArray()}),({sphereGrabbed:e})=>{let t=[];e&&this._moveTool.manipulators.forEach(({manipulator:e})=>{t.push(e.disableDisplay())}),this.removeHandles(h),this.addHandles(t,h)},r),n(()=>this._moveTool.firstGrabbedManipulator,e=>{e??t()})])}destroy(){this.removeHandles(h),this.stop(),this.view.tools.remove(this._itemTool),this.view.tools.remove(this._moveTool),this._itemTool.destroy(),this._moveTool.destroy(),this._tooltip.destroy();for(let e of this._objectByItem.values())this.removeHandles(e),e.destroy();this._objectByItem.clear(),this._undoStack.length=0,this._redoStack.length=0}get active(){return this._itemTool.active||this._moveTool.active}get canRedo(){return this._redoStack.length>0}get canUndo(){return this._undoStack.length>0}get hasSelection(){return this._selectedItem!=null}get selectedItem(){return this._selectedItem}get updating(){return this._itemTool.updating||this._moveTool.updating}get laserLineVisualElement(){return this._itemTool.laserLineVisualElement}get verticalLineVisualElement(){return this._itemTool.verticalLineVisualElement}selectItem(e){return this._objectByItem.has(e)?(this._setSelectedItem(e),!0):!1}clearSelection(){return this.hasSelection?(this._setSelectedItem(null),!0):!1}deleteSelectedItem(){let e=this._selectedItem;if(e==null)return!1;let t=this.analysis.targets.find(t=>t===e);return t!=null&&this._deleteTarget(t)}getObserverManipulator(){let e=this.analysis.observer,t=e==null?null:this._itemTool.getManipulator(e);return t!=null&&v(t)?t:null}getTargetManipulator(e){let t=this._itemTool.getManipulator(e);return t!=null&&y(t)?t:null}hasManipulatorAt(e,t){return this._itemTool.hasManipulatorAt(e,t)}redo(){let e=this._redoStack.pop();e!=null&&(e.redo()?(this._undoStack.push(e),this._notifyHistoryChanged()):this._redoStack.push(e))}setEditableFlag(e,t){this._itemTool.setEditableFlag(e,t),this._moveTool.setEditableFlag(e,t)}stop(){(this.view.activeTool===this._itemTool||this.view.activeTool===this._moveTool)&&(this.view.activeTool=null),this._itemTool.hideInteractionVisuals(),this.snappingManager.doneSnapping(),this.clearSelection()}undo(){let e=this._undoStack.pop();e!=null&&(e.undo(),this._redoStack.push(e),this._notifyHistoryChanged())}_syncObjects(e,t){let n=new Set(e==null?t:[e,...t]);for(let[e,t]of this._objectByItem)n.has(e)||(this._selectedItem===e&&this._setSelectedItem(null),this.removeHandles(t),this._itemTool.removeObject(t),this._objectByItem.delete(e),t.destroy());e!=null&&this._ensureObject(e);for(let e of t)this._ensureObject(e);this._setSelectedItem(this._selectedItem)}_ensureObject(e){if(this._objectByItem.has(e))return;let t=new c({analysisViewData:this.analysisViewData,intersector:this.intersector,item:e,view:this.view});this._objectByItem.set(e,t),this._itemTool.addObject(t),this.addHandles(t.on(`modified-externally`,()=>{this._selectedItem===e&&this._setSelectedItem(e)}),t)}_setSelectedItem(e){let t=e==null?null:this._objectByItem.get(e);this._selectedItem=t==null?null:e,this._itemTool.selectObject(t),this._moveTool.objects.removeAll(),t!=null&&this._moveTool.objects.add(t),this._itemTool.interacting=this._selectedItem!=null}_deleteTarget(e){if(this.analysis.targets.length<=1)return!1;let t=this.analysis.targets.indexOf(e);if(t<0)return!1;let n=o(e),r=this._selectedItem===e;return this.analysis.targets.remove(e),this._recordHistory({undo:()=>{s(n,e),this.analysis.targets.add(e,Math.min(t,this.analysis.targets.length)),r&&this._setSelectedItem(e)},redo:()=>this.analysis.targets.includes(e)&&this.analysis.targets.length<=1?!1:(this.analysis.targets.remove(e),this._selectedItem===e&&this._setSelectedItem(null),!0)}),!0}_recordHistory(e){this._undoStack.push(e),this._redoStack.length=0,this._notifyHistoryChanged()}_notifyHistoryChanged(){this.notifyChange(`canUndo`),this.notifyChange(`canRedo`)}get testInfo(){return{moveTooltip:this._tooltip}}};e([i({constructOnly:!0})],g.prototype,`analysisViewData`,void 0),e([i({constructOnly:!0})],g.prototype,`analysis`,void 0),e([i({constructOnly:!0})],g.prototype,`intersector`,void 0),e([i({constructOnly:!0})],g.prototype,`snappingManager`,void 0),e([i({constructOnly:!0})],g.prototype,`view`,void 0),e([i()],g.prototype,`visible`,null),e([i()],g.prototype,`manipulatorsInteractive`,null),e([i()],g.prototype,`_selectedItem`,void 0),e([i()],g.prototype,`active`,null),e([i()],g.prototype,`canRedo`,null),e([i()],g.prototype,`canUndo`,null),e([i()],g.prototype,`selectedItem`,null),e([i()],g.prototype,`updating`,null),g=e([a(`esri.views.3d.analysis.LineOfSight.LineOfSightEditTool`)],g);function _(e){return{undo:()=>{for(let t=e.length-1;t>=0;t--)e[t].undo(null)},redo:()=>{for(let t of e)t.redo(null);return!0}}}function v(e){return e.metadata.type===`observer`}function y(e){return e.metadata.type===`target`}export{g as LineOfSightEditTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{EventEmitter as t}from"../../../../core/Evented.js";import{handlesGroup as n}from"../../../../core/handleUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import i from"../../../../core/ReactiveMap.js";import{initial as a,watch as o,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import{create as d,fromPoints as f}from"../../../../geometry/support/lineSegment.js";import{LineOfSightInteractionVisuals as p}from"./LineOfSightInteractionVisuals.js";import{LineOfSightObserverManipulator as m,LineOfSightTargetManipulator as h,LineOfSightTargetManipulatorState as g,getInteractiveLineOfSightTargetManipulatorState as _}from"./LineOfSightManipulators.js";import{SnappingVisualizer3D as v}from"../../interactive/SnappingVisualizer3D.js";import{screenToMapAtSceneSurface as y}from"../../interactive/editingTools/dragEventPipeline3D.js";import{mouseButtons as b}from"../../../input/mouseButtons.js";import{createManipulatorDragEventPipeline as x,dragAtLocation as S,sceneSnappingAtLocation as C,dragManipulatedObject as w}from"../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as T}from"../../../interactive/InteractiveToolBase.js";import{SnappingContext as E}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as D}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{enterInputModeIfAvailable as O}from"../../../interactive/tooltip/tooltipCommonUtils.js";const k=d(),A=Symbol(`inactiveManipulatorDisplay`);let j=class extends T{get _manipulatorsToHide(){let e=this._manipulatorByObject.values();return this.view.tools.some(e=>e.hasGrabbedManipulators)||e.some(e=>e.grabbing)?e.filter(e=>!e.grabbing).toArray():[]}constructor(e){super(e),this.events=new t,this.automaticManipulatorSelection=!1,this.removeIncompleteOnCancel=!1,this.interacting=!1,this.manipulatorsInteractive=!0,this._objectByItem=new Map,this._manipulatorByObject=new i,this._updatingHandles=new u,this._interactionVisuals=null,this._grabbedManipulator=null,this._visualsManipulator=null}initialize(){let{view:e}=this;this._interactionVisuals=new p({view:e}),this.addHandles([this._updatingHandles.add(()=>({analysisVisible:this.analysisViewData.visible,computations:this.analysisViewData.computations.toArray().map(e=>({isTargetVisible:e.computationResult.isTargetVisible,isValid:e.computationResult.isValid,target:e.target})),grabbedManipulator:this._grabbedManipulator,interacting:this.interacting,manipulatorsInteractive:this.manipulatorsInteractive,visible:this.visible}),()=>this._syncManipulators(),a),o(()=>this._manipulatorsToHide,e=>{let t=e.map(e=>e.disableDisplay());this.removeHandles(A),this.addHandles(t,A)},s)]),this.finishToolCreation()}destroy(){this.removeHandles(A),this._interactionVisuals=r(this._interactionVisuals),this._updatingHandles.destroy(),this._objectByItem.clear(),this._manipulatorByObject.clear(),super.destroy()}get updating(){return this._updatingHandles.updating||this.snappingManager.updating}get laserLineVisualElement(){return this._interactionVisuals?.laserLineVisualElement??null}get verticalLineVisualElement(){return this._interactionVisuals?.verticalLineVisualElement??null}showInteractionVisuals(e){this._visualsManipulator=this._manipulatorByObject.get(e),this._syncInteractionVisuals()}hideInteractionVisuals(){this._visualsManipulator=null,this._syncInteractionVisuals()}addObject(e){if(this._manipulatorByObject.has(e))return;let t=e.item.type===`observer`?new m(this.view,{deleting:!1,intersection:null,type:`observer`}):new h(this.view,{deleting:!1,target:e.item,type:`target`});t.cursor=`move`,this._objectByItem.set(e.item,e),this._manipulatorByObject.set(e,t),this.manipulators.add(t),this.addHandles(this._connectManipulator(e,t),e),this._syncManipulator(e,t)}removeObject(e){let t=this._manipulatorByObject.get(e);t!=null&&(this._grabbedManipulator===t&&(this._grabbedManipulator=null),this._visualsManipulator===t&&this.hideInteractionVisuals(),this.removeHandles(e),this._objectByItem.delete(e.item),this._manipulatorByObject.delete(e),this.manipulators.remove(t),t.destroy())}getManipulator(e){let t=this._objectByItem.get(e);return t==null?null:this._manipulatorByObject.get(t)}hasManipulatorAt(e,t){for(let n of this._manipulatorByObject.values())if(n.consumesClicks&&n.intersectionDistance(e,t)!=null)return!0;return!1}selectObject(e){let t=!1;for(let[n,r]of this._manipulatorByObject){let i=n===e;r.selected=i,t||=i}return this._syncManipulators(),t}onInputEvent(e){e.type===`hold`&&this._grabbedManipulator!=null&&(this._visualsManipulator=this._grabbedManipulator,this._syncInteractionVisuals()),O(e,this.tooltip)}onManipulatorSelectionChanged(){[...this._manipulatorByObject.values()].some(e=>e.selected)||this.events.emit(`selection-cleared`)}_connectManipulator(e,t){let r=()=>this._syncManipulator(e,t);return n([e.on(`committed`,r),e.on(`modified-externally`,r),t.events.on(`immediate-click`,n=>{this.events.emit(`select-item`,{item:e.item}),n.button===b.Right&&t.metadata.type===`target`&&this.events.emit(`delete-item`,{target:t.metadata.target}),n.stopPropagation()}),t.events.on(`grab-changed`,({action:n})=>{n===`start`?(this.events.emit(`select-item`,{item:e.item}),this._grabbedManipulator=t):this._grabbedManipulator===t&&(this._grabbedManipulator=null,this.hideInteractionVisuals()),this._manipulatorByObject.set(e,t)}),t.events.on(`drag`,t=>{e.updateDragIntersection(t),t.action===`start`&&this.showInteractionVisuals(e)}),t.events.on(`location-update`,()=>this._syncInteractionVisuals()),this._createDragHandle(e,t)])}_createDragHandle(e,t){return x(t,(n,r,i,a)=>{let o=e.operations;if(o==null)return;let s=null,{cancelSnapping:c,snappingStep:l}=D({snappingContext:new E({editGeometryOperations:o,elevationInfo:e.elevationInfo,pointer:a,visualizer:new v}),snappingManager:this.snappingManager,updatingHandles:this._updatingHandles,useZ:!0});i.next(e=>(s?.undo(null),s=null,e)).next(c);let u=o.data.allVerticesUnordered.at(0);r.next(t=>(t.action===`start`&&(s=e.createUndoRecord()),{...t,snapOrigin:u?.pos})).next(S(this.view,t.elevationAlignedLocation)).next(y(this.view,o.data.geometry,e.elevationInfo,o.data.spatialReference)).next(C(this.view,e.elevationInfo)).next(...l).next(w(e)).next(e=>(e.action===`end`&&s!=null&&(this.events.emit(`record-undo`,{record:s}),s=null),e))})}_syncManipulators(){for(let[e,t]of this._manipulatorByObject)this._syncManipulator(e,t);this._syncInteractionVisuals()}_syncManipulator(e,t){let n=e.origin;if(t.available=this.visible&&e.visible&&n!=null,t.interactive=this.manipulatorsInteractive&&(this._grabbedManipulator==null||this._grabbedManipulator===t),n!=null&&(t.elevationAlignedLocation=n),e.item.type!==`target`)return;let r=this.analysisViewData.computations.find(t=>t.target===e.item),i=r==null||!r.computationResult.isValid?g.undefined:r.computationResult.isTargetVisible?g.visible:g.occluded;t.state=this.interacting&&t.selected?_(i):i}_syncInteractionVisuals(){let e=this._interactionVisuals,t=this._visualsManipulator,n=this.visible&&this.analysisViewData.visible;if(e==null||t==null||!n){e?.hide();return}let r=[...this._manipulatorByObject.entries()].find(([e])=>e.item.type===`observer`)?.[1];if(r==null){e.hide();return}let i=t===r?null:f(r.renderLocation,t.renderLocation,k);e.update({target:t.renderLocation,lineVerticalPlaneSegment:i,visible:!0})}};e([c({constructOnly:!0})],j.prototype,`analysisViewData`,void 0),e([c({constructOnly:!0})],j.prototype,`snappingManager`,void 0),e([c({constructOnly:!0})],j.prototype,`view`,void 0),e([c({constructOnly:!0})],j.prototype,`tooltip`,void 0),e([c()],j.prototype,`automaticManipulatorSelection`,void 0),e([c()],j.prototype,`removeIncompleteOnCancel`,void 0),e([c()],j.prototype,`interacting`,void 0),e([c()],j.prototype,`manipulatorsInteractive`,void 0),e([c()],j.prototype,`_grabbedManipulator`,void 0),e([c()],j.prototype,`_manipulatorsToHide`,null),e([c()],j.prototype,`updating`,null),j=e([l(`esri.views.3d.analysis.LineOfSight.LineOfSightItemTool`)],j);export{j as LineOfSightItemTool};
2
+ import{__decorate as e}from"tslib";import{EventEmitter as t}from"../../../../core/Evented.js";import{handlesGroup as n}from"../../../../core/handleUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import i from"../../../../core/ReactiveMap.js";import{initial as a,watch as o,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import{create as d,fromPoints as f}from"../../../../geometry/support/lineSegment.js";import{LineOfSightInteractionVisuals as p}from"./LineOfSightInteractionVisuals.js";import{LineOfSightObserverManipulator as m,LineOfSightTargetManipulator as h,LineOfSightTargetManipulatorState as g,getInteractiveLineOfSightTargetManipulatorState as _}from"./LineOfSightManipulators.js";import{SnappingVisualizer3D as v}from"../../interactive/SnappingVisualizer3D.js";import{screenToMapAtSceneSurface as y}from"../../interactive/editingTools/dragEventPipeline3D.js";import{mouseButtons as b}from"../../../input/mouseButtons.js";import{createManipulatorDragEventPipeline as x,dragAtLocation as S,sceneSnappingAtLocation as C,dragManipulatedObject as w}from"../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as T}from"../../../interactive/InteractiveToolBase.js";import{areToolManipulatorsEditable as E}from"../../../interactive/interactiveToolUtils.js";import{SnappingContext as D}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as O}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{enterInputModeIfAvailable as k}from"../../../interactive/tooltip/tooltipCommonUtils.js";import{createScreenPointFromEvent as A}from"../../../support/screenUtils.js";const j=d(),M=Symbol(`inactiveManipulatorDisplay`);let N=class extends T{get _manipulatorsToHide(){let e=this._manipulatorByObject.values();return this.view.tools.some(e=>e.hasGrabbedManipulators)||e.some(e=>e.grabbing)?e.filter(e=>!e.grabbing).toArray():[]}constructor(e){super(e),this.events=new t,this.automaticManipulatorSelection=!1,this.removeIncompleteOnCancel=!1,this.interacting=!1,this.manipulatorsInteractive=!0,this._objectByItem=new Map,this._manipulatorByObject=new i,this._updatingHandles=new u,this._interactionVisuals=null,this._selectedManipulator=null,this._grabbedManipulator=null,this._visualsManipulator=null}initialize(){let{view:e}=this;this._interactionVisuals=new p({view:e}),this.addHandles([this._updatingHandles.add(()=>({analysisVisible:this.analysisViewData.visible,computations:this.analysisViewData.computations.toArray().map(e=>({isTargetVisible:e.computationResult.isTargetVisible,isValid:e.computationResult.isValid,target:e.target})),grabbedManipulator:this._grabbedManipulator,interacting:this.interacting,manipulatorsInteractive:this.manipulatorsInteractive,visible:this.visible}),()=>this._syncManipulators(),a),o(()=>this._manipulatorsToHide,e=>{let t=e.map(e=>e.disableDisplay());this.removeHandles(M),this.addHandles(t,M)},s)]),this.finishToolCreation()}destroy(){this.removeHandles(M),this._interactionVisuals=r(this._interactionVisuals),this._updatingHandles.destroy(),this._selectedManipulator=null,this._objectByItem.clear(),this._manipulatorByObject.clear(),super.destroy()}get updating(){return this._updatingHandles.updating||this.snappingManager.updating}get laserLineVisualElement(){return this._interactionVisuals?.laserLineVisualElement??null}get verticalLineVisualElement(){return this._interactionVisuals?.verticalLineVisualElement??null}showInteractionVisuals(e){this._visualsManipulator=this._manipulatorByObject.get(e),this._syncInteractionVisuals()}hideInteractionVisuals(){this._visualsManipulator=null,this._syncInteractionVisuals()}addObject(e){if(this._manipulatorByObject.has(e))return;let t=e.item.type===`observer`?new m(this.view,{deleting:!1,intersection:null,type:`observer`}):new h(this.view,{deleting:!1,target:e.item,type:`target`});t.cursor=`move`,this._objectByItem.set(e.item,e),this._manipulatorByObject.set(e,t),this.manipulators.add(t),this.addHandles(this._connectManipulator(e,t),e),this._syncManipulator(e,t)}removeObject(e){let t=this._manipulatorByObject.get(e);t!=null&&(this._grabbedManipulator===t&&(this._grabbedManipulator=null),this._selectedManipulator===t&&(this._selectedManipulator=null),this._visualsManipulator===t&&this.hideInteractionVisuals(),this.removeHandles(e),this._objectByItem.delete(e.item),this._manipulatorByObject.delete(e),this.manipulators.remove(t),t.destroy())}getManipulator(e){let t=this._objectByItem.get(e);return t==null?null:this._manipulatorByObject.get(t)}hasManipulatorAt(e,t){for(let n of this._manipulatorByObject.values())if(n.consumesClicks&&n.intersectionDistance(e,t)!=null)return!0;return!1}selectObject(e){this._selectedManipulator=e==null?null:this._manipulatorByObject.get(e);for(let e of this._manipulatorByObject.values())e.selected=e===this._selectedManipulator;return this._syncManipulators(),this._selectedManipulator!=null}onInputEvent(e){if(e.type===`immediate-click`&&!e.native.shiftKey&&this._selectedManipulator!=null){let t=A(e),n=this.view.tools.find(n=>E(n)&&n.manipulators.intersect(t,e.pointerType)!=null);n!==this&&n!==this.moveTool&&this.events.emit(`deselect-item`)}e.type===`hold`&&this._grabbedManipulator!=null&&(this._visualsManipulator=this._grabbedManipulator,this._syncInteractionVisuals()),k(e,this.tooltip)}onManipulatorSelectionChanged(){let e=this._selectedManipulator;e==null||e.selected||(this.view.activeTool==null||this.moveTool.active?(e.selected=!0,this._syncManipulators()):this.events.emit(`deselect-item`))}_connectManipulator(e,t){let r=()=>this._syncManipulator(e,t);return n([e.on(`committed`,r),e.on(`modified-externally`,r),t.events.on(`immediate-click`,n=>{this.events.emit(`select-item`,{item:e.item}),n.button===b.Right&&t.metadata.type===`target`&&this.events.emit(`delete-item`,{target:t.metadata.target}),n.stopPropagation()}),t.events.on(`grab-changed`,({action:n})=>{n===`start`?(this.events.emit(`select-item`,{item:e.item}),this._grabbedManipulator=t):this._grabbedManipulator===t&&(this._grabbedManipulator=null,this.hideInteractionVisuals()),this._manipulatorByObject.set(e,t)}),t.events.on(`drag`,t=>{e.updateDragIntersection(t),t.action===`start`&&this.showInteractionVisuals(e)}),t.events.on(`location-update`,()=>this._syncInteractionVisuals()),this._createDragHandle(e,t)])}_createDragHandle(e,t){return x(t,(n,r,i,a)=>{let o=e.operations;if(o==null)return;let s=null,{cancelSnapping:c,snappingStep:l}=O({snappingContext:new D({editGeometryOperations:o,elevationInfo:e.elevationInfo,pointer:a,visualizer:new v}),snappingManager:this.snappingManager,updatingHandles:this._updatingHandles,useZ:!0});i.next(e=>(s?.undo(null),s=null,e)).next(c);let u=o.data.allVerticesUnordered.at(0);r.next(t=>(t.action===`start`&&(s=e.createUndoRecord()),{...t,snapOrigin:u?.pos})).next(S(this.view,t.elevationAlignedLocation)).next(y(this.view,o.data.geometry,e.elevationInfo,o.data.spatialReference)).next(C(this.view,e.elevationInfo)).next(...l).next(w(e)).next(e=>(e.action===`end`&&s!=null&&(this.events.emit(`record-undo`,{record:s}),s=null),e))})}_syncManipulators(){for(let[e,t]of this._manipulatorByObject)this._syncManipulator(e,t);this._syncInteractionVisuals()}_syncManipulator(e,t){let n=e.origin;if(t.available=this.visible&&e.visible&&n!=null,t.interactive=this.manipulatorsInteractive&&(this._grabbedManipulator==null||this._grabbedManipulator===t),n!=null&&(t.elevationAlignedLocation=n),e.item.type!==`target`)return;let r=this.analysisViewData.computations.find(t=>t.target===e.item),i=r==null||!r.computationResult.isValid?g.undefined:r.computationResult.isTargetVisible?g.visible:g.occluded;t.state=this.interacting&&t.selected?_(i):i}_syncInteractionVisuals(){let e=this._interactionVisuals,t=this._visualsManipulator,n=this.visible&&this.analysisViewData.visible;if(e==null||t==null||!n){e?.hide();return}let r=[...this._manipulatorByObject.entries()].find(([e])=>e.item.type===`observer`)?.[1];if(r==null){e.hide();return}let i=t===r?null:f(r.renderLocation,t.renderLocation,j);e.update({target:t.renderLocation,lineVerticalPlaneSegment:i,visible:!0})}};e([c({constructOnly:!0})],N.prototype,`analysisViewData`,void 0),e([c({constructOnly:!0})],N.prototype,`moveTool`,void 0),e([c({constructOnly:!0})],N.prototype,`snappingManager`,void 0),e([c({constructOnly:!0})],N.prototype,`view`,void 0),e([c({constructOnly:!0})],N.prototype,`tooltip`,void 0),e([c()],N.prototype,`automaticManipulatorSelection`,void 0),e([c()],N.prototype,`removeIncompleteOnCancel`,void 0),e([c()],N.prototype,`interacting`,void 0),e([c()],N.prototype,`manipulatorsInteractive`,void 0),e([c()],N.prototype,`_grabbedManipulator`,void 0),e([c()],N.prototype,`_manipulatorsToHide`,null),e([c()],N.prototype,`updating`,null),N=e([l(`esri.views.3d.analysis.LineOfSight.LineOfSightItemTool`)],N);export{N as LineOfSightItemTool};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{watch as e}from"../../../../core/reactiveUtils.js";import{getObserverRGBA as t,observerConfiguration as n,targetConfiguration as r,getInteractiveTargetRGBA as i,lineOfSightTransparentRenderOrder as a}from"./LineOfSightConfiguration.js";import{Manipulator3D as o}from"../../interactive/Manipulator3D.js";import{createManipulatorMaterial as s}from"../../interactive/manipulatorUtils.js";import{RenderObject as c}from"../../interactive/RenderObject.js";import{createSphereGeometry as l}from"../../webgl-engine/lib/GeometryUtil.js";const u=1024;class d extends o{constructor(r,i){let a=g(t(r.effectiveTheme)),o=l(a,n.size,32,32),s=[new c(o)];super({view:r,renderObjects:s,metadata:i,elevationInfo:{mode:`absolute-height`,offset:0}}),this.themeHandle=e(()=>({color:t(r.effectiveTheme)}),e=>{a.setParameters(e)})}destroy(){this.themeHandle.remove(),super.destroy()}}class f extends o{constructor(t,n){let{size:a,visibleColor:o,occludedColor:s,undefinedColor:d}=r,f=g(i(t.effectiveTheme)),p=[new c(l(f,a,32,32),u),h(a,o,2176),h(a,s,2304),h(a,d,2560)];super({view:t,renderObjects:p,metadata:n,elevationInfo:{mode:`absolute-height`,offset:0}}),this.themeHandle=e(()=>({color:i(t.effectiveTheme)}),e=>{f.setParameters(e)})}destroy(){this.themeHandle.remove(),super.destroy()}}const p={visible:2176,occluded:2304,undefined:2560};function m(e){return e&-2049|u}function h(e,t,n){return new c(l(g(t.toUnitRGBA()),e,32,32),n)}function g(e){let t=s(e);return t.setParameters({testsTransparentRenderOrder:a.manipulator}),t}export{d as LineOfSightObserverManipulator,f as LineOfSightTargetManipulator,p as LineOfSightTargetManipulatorState,m as getInteractiveLineOfSightTargetManipulatorState};
2
+ import{watch as e}from"../../../../core/reactiveUtils.js";import{getObserverRGBA as t,observerConfiguration as n,targetConfiguration as r,getInteractiveTargetRGBA as i,lineOfSightTransparentRenderOrder as a}from"./LineOfSightConfiguration.js";import{Manipulator3D as o}from"../../interactive/Manipulator3D.js";import{createManipulatorMaterial as s}from"../../interactive/manipulatorUtils.js";import{RenderObject as c}from"../../interactive/RenderObject.js";import{createSphereGeometry as l}from"../../webgl-engine/lib/GeometryUtil.js";const u=1024;class d extends o{constructor(r,i){let a=g(t(r.effectiveTheme)),o=l(a,1,32,32),s=[new c(o)];super({view:r,renderObjects:s,metadata:i,radius:n.radius,elevationInfo:{mode:`absolute-height`,offset:0}}),this.themeHandle=e(()=>({color:t(r.effectiveTheme)}),e=>{a.setParameters(e)})}destroy(){this.themeHandle.remove(),super.destroy()}}class f extends o{constructor(t,n){let{radius:a,visibleColor:o,occludedColor:s,undefinedColor:d}=r,f=g(i(t.effectiveTheme)),p=[new c(l(f,1,32,32),u),h(o,2176),h(s,2304),h(d,2560)];super({view:t,renderObjects:p,metadata:n,radius:a,elevationInfo:{mode:`absolute-height`,offset:0}}),this.themeHandle=e(()=>({color:i(t.effectiveTheme)}),e=>{f.setParameters(e)})}destroy(){this.themeHandle.remove(),super.destroy()}}const p={visible:2176,occluded:2304,undefined:2560};function m(e){return e&-2049|u}function h(e,t){return new c(l(g(e.toUnitRGBA()),1,32,32),t)}function g(e){let t=s(e);return t.setParameters({testsTransparentRenderOrder:a.manipulator}),t}export{d as LineOfSightObserverManipulator,f as LineOfSightTargetManipulator,p as LineOfSightTargetManipulatorState,m as getInteractiveLineOfSightTargetManipulatorState};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{isSome as t,equals as n}from"../../../core/arrayUtils.js";import{createTask as r}from"../../../core/asyncUtils.js";import i from"../../../core/Error.js";import"../../../core/has.js";import a from"../../../core/Logger.js";import{abortMaybe as o,destroyMaybe as s}from"../../../core/maybe.js";import{after as c,throwIfAborted as l,isPromiseLike as u}from"../../../core/promiseUtils.js";import{watch as d,syncAndInitial as f}from"../../../core/reactiveUtils.js";import{createScreenPointArray as p,createRenderScreenPointArray as m}from"../../../core/screenUtils.js";import{convertTime as h,offsetDateUTC as g,createZonedDate as _}from"../../../core/timeUtils.js";import{property as v,subclass as y}from"../../../core/accessorSupport/decorators.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as x}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as S}from"../../../core/support/UpdatingHandles.js";import{projectAsync as C}from"../../../geometry/projectionUtils.js";import{containsExecute as w}from"../../../geometry/operators/containsOperator.js";import{g as T}from"../../../chunks/boundedPlane.js";import{polygonToVolume as E}from"../focusAreaUtils.js";import D from"./AnalysisView3D.js";import{registerAnalysisView as O,hideOtherAnalysisViews as k}from"./ShadowCast/analysisViewRegister.js";import{ShadowCastTooltip as A}from"./ShadowCast/ShadowCastTooltip.js";import{ElevationContext as j}from"../layers/graphics/ElevationContext.js";import{longitudeToTimezone as M}from"../support/earthUtils.js";import{computeDirectionsOverTime as N}from"../support/sunUtils.js";import{maxColorRampSize as P}from"../webgl-engine/shaders/colorRampParameters.js";import{breadthFirstBinaryPartitioning as F}from"../../../widgets/support/traversalUtils.js";let I=class extends D{constructor(e){super(e),this.type=`shadow-cast-view-3d`,this.analysis=null,this._updatingHandles=new S,this._stopPreviewingTask=null,this._updatedRecently=!1,this._tooltip=null,this._previousVolume=null}initialize(){this.addHandles([O(this.view,this),d(()=>({dependencies:this._previewDependencies,sceneUpdating:this._sceneUpdating}),()=>{o(this._stopPreviewingTask),this._updatedRecently=!0,this._stopPreviewingTask=r(async e=>{await c(U,e),l(e),this._updatedRecently=!1})},{sync:!0,initial:!0,equals:(e,t)=>V(e.dependencies,t.dependencies)&&(e.sceneUpdating===t.sceneUpdating||!e.sceneUpdating)}),d(()=>({renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t})=>{t&&k(this.view,this),e?.setParameters({shadowCast:{enabled:t}})},f),d(()=>({renderer:this._renderer,parameters:this._visualizationParameters,visible:this.visible}),({renderer:e,parameters:t,visible:n})=>{R(e,n,t)},f),d(()=>({renderer:this._renderer,lightDirections:this._lightDirections,lightDirectionsContext:this._lightDirectionsContext,visible:this.visible}),({renderer:e,lightDirections:t,lightDirectionsContext:n,visible:r})=>{R(e,r,{lightDirections:t,lightDirectionsContext:n})},f),d(()=>({renderer:this._renderer,previewing:this._previewing,visible:this.visible}),({renderer:e,previewing:t,visible:n})=>{R(e,n,{previewing:t})},{sync:!0,initial:!0,equals:()=>!1}),d(()=>({analysisVolume:this._analysisVolume,renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t,analysisVolume:n})=>{R(e,t,{analysisVolume:n})},f)]),this.interactive=!0,this._tooltip=new A({getDuration:(e,t)=>this._getDurationAtScreen(e,t),getMode:()=>this.analysis.mode,getShowsSeparateZeroBucketInHourlyMode:()=>this._showsSeparateZeroBucketInHourlyMode,getTotalDuration:()=>this._totalDuration,getTotalDurationMode:()=>this.analysis.totalDurationOptions.mode,getVisualizeSunlight:()=>this.analysis.visualizeSunlight,isVisible:()=>this.interactive&&this.visible,view:this.view})}destroy(){this.visible&&R(this._renderer,!0,{enabled:!1}),this._tooltip=s(this._tooltip),this._stopPreviewingTask=o(this._stopPreviewingTask),this._updatingHandles=s(this._updatingHandles)}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get updating(){return this._previewing||this._stopPreviewingTask!=null&&!this._stopPreviewingTask.finished||this._tooltip?.updating===!0||this._updatingHandles.updating}get visible(){return super.visible}set visible(e){super.visible=e}get _previewing(){let e=this._updatedRecently,t=this._sceneUpdating;return e||t}get _sceneUpdating(){let{view:e}=this;if(e?.allLayerViews==null)return!0;let{stationary:t,navigating:n,interacting:r,graphicsView:i}=e,a=!t||n||r,o=this._shadowLayerViews.some(e=>e.updating),s=!i?.suspended&&!!i?.updating;return a||o||s}get _effectiveUtcOffset(){return this.analysis.utcOffset??this._utcOffsetAuto}get _utcOffsetAuto(){let e=this._referencePosition;return e==null?0:M(e[0],!1)}get _dateUTCOffset(){let e=this.analysis.date;return e=g(e,-e.getTimezoneOffset(),`minutes`),e=g(e,-this._effectiveUtcOffset,`hours`),e}get _startDateTimeUTC(){return this._getDateTimeUTC(this.analysis.startTimeOfDay)}get _endDateTimeUTC(){return this._getDateTimeUTC(this.analysis.endTimeOfDay)}_getDateTimeUTC(e){let{date:t,timeZone:n}=this.analysis;if(n==null)return g(this._dateUTCOffset,e);let r=_({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()},h(e,`milliseconds`,`minutes`),n);if(r==null)throw RangeError(`Invalid shadow cast date or time zone`);return r}get _referencePosition(){return this.view?.environmentView?.referencePositionGeographic}get _totalDurationInterval(){return this._totalDuration>0?Math.floor(this._totalDuration/(W-1)):W}get _interval(){let e=this._totalDurationInterval;switch(this.analysis.mode){case`min-duration`:return this._totalDuration>0?e:0;case`total-duration`:return e;case`discrete`:return this.analysis.discreteOptions.interval||e}}get _intervalContext(){let{mode:e,minDurationOptions:t}=this.analysis;return e===`min-duration`&&t.contextEnabled?t.contextOptions.interval||this._totalDurationInterval:-1}get _totalDurationSampleCount(){return this._lightDirections.length}get _totalDuration(){return this._endDateTimeUTC.getTime()-this._startDateTimeUTC.getTime()}get _lightDirections(){return this._calculateLightDirections(this._interval)}get _lightDirectionsContext(){return this._calculateLightDirections(this._intervalContext)}_calculateLightDirections(e){let{view:t}=this;if(e<=0)return[];let n=t.viewingMode===`global`?G:this._referencePosition;if(n==null)return[];let r=N(this._startDateTimeUTC,this._endDateTimeUTC,e,n,t.state.viewingMode,W),i=r.length;K.length=0;let a=F(0,i,K),o=Array(i);for(let e=0;e<i;++e)o[e]=r[a[e]];return o}get _analysisVolume(){let{geometry:e}=this.analysis;if(e==null)return this._previousVolume=null,null;try{let t=E(e,this.view,q);return t==null?(this._previousVolume=null,null):u(t)?(this._updatingHandles.consumePromise(t),this._previousVolume):(this._previousVolume=t,t)}catch(t){return a.getLogger(this).error(new i(`shadowcastanalysisview3d:projection-failed`,`Failed to project analysis area geometry to view spatial reference`,{geometry:e,error:t})),null}}get _visualizationParameters(){if(!this.visible)return null;switch(this.analysis.mode){case`min-duration`:return this._minDurationVisualizationParameters;case`total-duration`:return this._durationVisualizationParameters;case`discrete`:return this._discreteVisualizationParameters}}get _minDurationVisualizationParameters(){let{color:e,minDuration:t}=this.analysis.minDurationOptions,n=this._totalDuration;return{rendersSunlight:this.analysis.visualizeSunlight,visualization:2,thresholdColor:e.toUnitRGBA(),threshold:n>0?t/this._totalDuration:0,...this._minDurationContextVisualizationParameters}}get _minDurationContextVisualizationParameters(){let{minDurationOptions:e,visualizeSunlight:t}=this.analysis;if(!e.contextEnabled||t)return{};let{color:n,colorStops:r}=e.contextOptions,i=1/this._lightDirectionsContext.length;return{visualization:3,gradientColorRamp:this._getEffectiveShadowCastColorRamp(n,r,i)}}get _durationVisualizationParameters(){let{color:e,colorStops:t,mode:n}=this.analysis.totalDurationOptions,r=this._totalDuration,i=r>0&&n===`hourly`?H/r:0,a=this._getEffectiveShadowCastColorRamp(e,t,1/r);return i===0?{...this._discreteVisualizationParameters,gradientColorRamp:a}:{rendersSunlight:this.analysis.visualizeSunlight,bandedGradientColorRamp:a,visualization:1,bandSize:i}}get _showsSeparateZeroBucketInHourlyMode(){let{colorStops:e}=this.analysis.totalDurationOptions;return e==null||e.length===0||e.reduce((e,t)=>Math.min(e,t.value),1/0)<=0}get _discreteVisualizationParameters(){let{color:e,colorStops:t}=this.analysis.discreteOptions,n=1/this._lightDirections.length;return{rendersSunlight:this.analysis.visualizeSunlight,gradientColorRamp:this._getEffectiveShadowCastColorRamp(e,t,n),visualization:0}}get _shadowLayerViews(){return this.view.allLayerViews.items.filter(B)}get _previewDependencies(){let{view:e}=this,n=e.slice.plane,r=this._shadowLayerViews,i=r.map(e=>e.layer).filter(t),a=r.map(e=>e.suspended),o=i.map(e=>e.visible),s=i.map(e=>e.opacity),c=!!e.graphicsView?.suspended,l=i.filter(e=>`definitionExpression`in e).map(e=>e.definitionExpression),u=r.filter(e=>`filter`in e).map(e=>e.filter);return{slicePlane:n,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewSuspended:a,graphicsViewSuspended:c,layerVisibilities:o,layerOpacities:s,filters:u,definitionExpressions:l}}get _renderer(){return this.view?.stage?.renderer}get testData(){}async getDurationAtScreen(e){return this._getDurationAtScreen(e)}async _getDurationAtScreen(e,t){if(!await this._isScreenPointInAnalysisArea(e,t))return-1;let{_renderer:n,_totalDurationSampleCount:r}=this;if(n==null||r===0)return 0;let i=this.view.state.camera.screenToRender(p(e.x,e.y),m()),a=n.readAccumulatedShadow(i);return(this.analysis.visualizeSunlight?1-a:a)*this._totalDuration}async _isScreenPointInAnalysisArea(e,t){let{geometry:n}=this.analysis;if(!n)return!0;let r=await this.view.hitTest(e);l(t);let i=r.results.find(e=>e.mapPoint)?.mapPoint??r?.ground?.mapPoint;if(!i)return!1;let a=await C(i,n.spatialReference,{signal:t});return l(t),a!=null&&w(n,a)}_getEffectiveShadowCastColorRamp(e,t,n){if(t!=null){t.length>P&&a.getLogger(this).warnOnce(`ShadowCastAnalysis supports at most 8 color stops`);let e=t.map(e=>[e.value*n,e.color.toUnitRGBA()]);return e.sort(([e],[t])=>e-t),e}return z(e)}};e([v({readOnly:!0,type:[`shadow-cast-view-3d`]})],I.prototype,`type`,void 0),e([v({constructOnly:!0,nonNullable:!0})],I.prototype,`analysis`,void 0),e([v({readOnly:!0})],I.prototype,`updating`,null),e([v()],I.prototype,`_stopPreviewingTask`,void 0),e([v()],I.prototype,`_updatedRecently`,void 0),e([v()],I.prototype,`_tooltip`,void 0),e([v()],I.prototype,`_sceneUpdating`,null),e([v()],I.prototype,`_effectiveUtcOffset`,null),e([v()],I.prototype,`_utcOffsetAuto`,null),e([v()],I.prototype,`_dateUTCOffset`,null),e([v()],I.prototype,`_startDateTimeUTC`,null),e([v()],I.prototype,`_endDateTimeUTC`,null),e([v()],I.prototype,`_referencePosition`,null),e([v()],I.prototype,`_interval`,null),e([v()],I.prototype,`_intervalContext`,null),e([v()],I.prototype,`_totalDurationSampleCount`,null),e([v()],I.prototype,`_totalDuration`,null),e([v()],I.prototype,`_lightDirections`,null),e([v()],I.prototype,`_lightDirectionsContext`,null),e([v()],I.prototype,`_analysisVolume`,null),e([v()],I.prototype,`_visualizationParameters`,null),e([v()],I.prototype,`_minDurationVisualizationParameters`,null),e([v()],I.prototype,`_minDurationContextVisualizationParameters`,null),e([v()],I.prototype,`_durationVisualizationParameters`,null),e([v()],I.prototype,`_showsSeparateZeroBucketInHourlyMode`,null),e([v()],I.prototype,`_discreteVisualizationParameters`,null),e([v()],I.prototype,`_shadowLayerViews`,null),e([v()],I.prototype,`_previewDependencies`,null),e([v()],I.prototype,`_renderer`,null),I=e([y(`esri.views.3d.analysis.ShadowCastAnalysisView3D`)],I);const L=I;function R(e,t,n){t&&n!=null&&e?.setParameters({shadowCast:n})}function z(e){let t=e.toUnitRGBA();return[[0,x(t[0],t[1],t[2],0)],[1,t]]}function B(e){if(e.suspended)return!1;switch(e.type){case`building-scene-3d`:case`csv-3d`:case`elevation-3d`:case`feature-3d`:case`gaussian-splat-3d`:case`geojson-3d`:case`integrated-mesh-3d`:case`integrated-mesh-3dtiles`:case`ogc-feature-3d`:case`route-3d`:case`scene-layer-3d`:case`scene-layer-graphics-3d`:case`stream-3d`:case`wms-3d`:case`catalog-footprint-3d`:return!0;case`base-dynamic-3d`:case`catalog-3d`:case`catalog-dynamic-group-3d`:case`dimension-3d`:case`imagery-3d`:case`imagery-tile-3d`:case`line-of-sight-3d`:case`map-image-3d`:case`point-cloud-3d`:case`tile-3d`:case`vector-tile-3d`:case`viewshed-3d`:case`voxel-3d`:case`wfs-3d`:case`wmts-3d`:case`media-3d`:return!1;case`group`:return!1;case`graphics-3d`:return e.layer.graphics.some(e=>{let{symbol:t}=e;return t==null||t.type!==`text`&&!(`symbolLayers`in t)||t.type!==`text`&&t.symbolLayers.some(e=>e.type!==`text`)});default:return!1}}function V(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;let r=T(e.slicePlane,t.slicePlane),i=e.startDateUTC.valueOf()===t.startDateUTC.valueOf()&&e.endDateUTC.valueOf()===t.endDateUTC.valueOf(),a=n(e.layerViewSuspended,t.layerViewSuspended)&&e.graphicsViewSuspended===t.graphicsViewSuspended,o=n(e.layerVisibilities,t.layerVisibilities),s=n(e.layerOpacities,t.layerOpacities),c=n(e.filters,t.filters),l=n(e.definitionExpressions,t.definitionExpressions);return r&&i&&a&&o&&s&&c&&l}const H=h(1,`hours`,`milliseconds`),U=500,W=255,G=b(),K=[],q=new j;export{L as default};
2
+ import{__decorate as e}from"tslib";import{isSome as t,equals as n}from"../../../core/arrayUtils.js";import{createTask as r}from"../../../core/asyncUtils.js";import i from"../../../core/Error.js";import"../../../core/has.js";import a from"../../../core/Logger.js";import{abortMaybe as o,destroyMaybe as s}from"../../../core/maybe.js";import{after as c,throwIfAborted as l,isPromiseLike as u}from"../../../core/promiseUtils.js";import{watch as d,syncAndInitial as f}from"../../../core/reactiveUtils.js";import{createScreenPointArray as p,createRenderScreenPointArray as m}from"../../../core/screenUtils.js";import{convertTime as h,offsetDateUTC as g,createZonedDate as _}from"../../../core/timeUtils.js";import{property as v,subclass as y}from"../../../core/accessorSupport/decorators.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as x}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as S}from"../../../core/support/UpdatingHandles.js";import{projectAsync as C}from"../../../geometry/projectionUtils.js";import{containsExecute as w}from"../../../geometry/operators/containsOperator.js";import{equals as T}from"../../../geometry/support/boundedPlane.js";import{polygonToVolume as E}from"../focusAreaUtils.js";import D from"./AnalysisView3D.js";import{registerAnalysisView as O,hideOtherAnalysisViews as k}from"./ShadowCast/analysisViewRegister.js";import{ShadowCastTooltip as A}from"./ShadowCast/ShadowCastTooltip.js";import{ElevationContext as j}from"../layers/graphics/ElevationContext.js";import{longitudeToTimezone as M}from"../support/earthUtils.js";import{computeDirectionsOverTime as N}from"../support/sunUtils.js";import{maxColorRampSize as P}from"../webgl-engine/shaders/colorRampParameters.js";import{breadthFirstBinaryPartitioning as F}from"../../../widgets/support/traversalUtils.js";let I=class extends D{constructor(e){super(e),this.type=`shadow-cast-view-3d`,this.analysis=null,this._updatingHandles=new S,this._stopPreviewingTask=null,this._updatedRecently=!1,this._tooltip=null,this._previousVolume=null}initialize(){this.addHandles([O(this.view,this),d(()=>({dependencies:this._previewDependencies,sceneUpdating:this._sceneUpdating}),()=>{o(this._stopPreviewingTask),this._updatedRecently=!0,this._stopPreviewingTask=r(async e=>{await c(U,e),l(e),this._updatedRecently=!1})},{sync:!0,initial:!0,equals:(e,t)=>V(e.dependencies,t.dependencies)&&(e.sceneUpdating===t.sceneUpdating||!e.sceneUpdating)}),d(()=>({renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t})=>{t&&k(this.view,this),e?.setParameters({shadowCast:{enabled:t}})},f),d(()=>({renderer:this._renderer,parameters:this._visualizationParameters,visible:this.visible}),({renderer:e,parameters:t,visible:n})=>{R(e,n,t)},f),d(()=>({renderer:this._renderer,lightDirections:this._lightDirections,lightDirectionsContext:this._lightDirectionsContext,visible:this.visible}),({renderer:e,lightDirections:t,lightDirectionsContext:n,visible:r})=>{R(e,r,{lightDirections:t,lightDirectionsContext:n})},f),d(()=>({renderer:this._renderer,previewing:this._previewing,visible:this.visible}),({renderer:e,previewing:t,visible:n})=>{R(e,n,{previewing:t})},{sync:!0,initial:!0,equals:()=>!1}),d(()=>({analysisVolume:this._analysisVolume,renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t,analysisVolume:n})=>{R(e,t,{analysisVolume:n})},f)]),this.interactive=!0,this._tooltip=new A({getDuration:(e,t)=>this._getDurationAtScreen(e,t),getMode:()=>this.analysis.mode,getShowsSeparateZeroBucketInHourlyMode:()=>this._showsSeparateZeroBucketInHourlyMode,getTotalDuration:()=>this._totalDuration,getTotalDurationMode:()=>this.analysis.totalDurationOptions.mode,getVisualizeSunlight:()=>this.analysis.visualizeSunlight,isVisible:()=>this.interactive&&this.visible,view:this.view})}destroy(){this.visible&&R(this._renderer,!0,{enabled:!1}),this._tooltip=s(this._tooltip),this._stopPreviewingTask=o(this._stopPreviewingTask),this._updatingHandles=s(this._updatingHandles)}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get updating(){return this._previewing||this._stopPreviewingTask!=null&&!this._stopPreviewingTask.finished||this._tooltip?.updating===!0||this._updatingHandles.updating}get visible(){return super.visible}set visible(e){super.visible=e}get _previewing(){let e=this._updatedRecently,t=this._sceneUpdating;return e||t}get _sceneUpdating(){let{view:e}=this;if(e?.allLayerViews==null)return!0;let{stationary:t,navigating:n,interacting:r,graphicsView:i}=e,a=!t||n||r,o=this._shadowLayerViews.some(e=>e.updating),s=!i?.suspended&&!!i?.updating;return a||o||s}get _effectiveUtcOffset(){return this.analysis.utcOffset??this._utcOffsetAuto}get _utcOffsetAuto(){let e=this._referencePosition;return e==null?0:M(e[0],!1)}get _dateUTCOffset(){let e=this.analysis.date;return e=g(e,-e.getTimezoneOffset(),`minutes`),e=g(e,-this._effectiveUtcOffset,`hours`),e}get _startDateTimeUTC(){return this._getDateTimeUTC(this.analysis.startTimeOfDay)}get _endDateTimeUTC(){return this._getDateTimeUTC(this.analysis.endTimeOfDay)}_getDateTimeUTC(e){let{date:t,timeZone:n}=this.analysis;if(n==null)return g(this._dateUTCOffset,e);let r=_({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()},h(e,`milliseconds`,`minutes`),n);if(r==null)throw RangeError(`Invalid shadow cast date or time zone`);return r}get _referencePosition(){return this.view?.environmentView?.referencePositionGeographic}get _totalDurationInterval(){return this._totalDuration>0?Math.floor(this._totalDuration/(W-1)):W}get _interval(){let e=this._totalDurationInterval;switch(this.analysis.mode){case`min-duration`:return this._totalDuration>0?e:0;case`total-duration`:return e;case`discrete`:return this.analysis.discreteOptions.interval||e}}get _intervalContext(){let{mode:e,minDurationOptions:t}=this.analysis;return e===`min-duration`&&t.contextEnabled?t.contextOptions.interval||this._totalDurationInterval:-1}get _totalDurationSampleCount(){return this._lightDirections.length}get _totalDuration(){return this._endDateTimeUTC.getTime()-this._startDateTimeUTC.getTime()}get _lightDirections(){return this._calculateLightDirections(this._interval)}get _lightDirectionsContext(){return this._calculateLightDirections(this._intervalContext)}_calculateLightDirections(e){let{view:t}=this;if(e<=0)return[];let n=t.viewingMode===`global`?G:this._referencePosition;if(n==null)return[];let r=N(this._startDateTimeUTC,this._endDateTimeUTC,e,n,t.state.viewingMode,W),i=r.length;K.length=0;let a=F(0,i,K),o=Array(i);for(let e=0;e<i;++e)o[e]=r[a[e]];return o}get _analysisVolume(){let{geometry:e}=this.analysis;if(e==null)return this._previousVolume=null,null;try{let t=E(e,this.view,q);return t==null?(this._previousVolume=null,null):u(t)?(this._updatingHandles.consumePromise(t),this._previousVolume):(this._previousVolume=t,t)}catch(t){return a.getLogger(this).error(new i(`shadowcastanalysisview3d:projection-failed`,`Failed to project analysis area geometry to view spatial reference`,{geometry:e,error:t})),null}}get _visualizationParameters(){if(!this.visible)return null;switch(this.analysis.mode){case`min-duration`:return this._minDurationVisualizationParameters;case`total-duration`:return this._durationVisualizationParameters;case`discrete`:return this._discreteVisualizationParameters}}get _minDurationVisualizationParameters(){let{color:e,minDuration:t}=this.analysis.minDurationOptions,n=this._totalDuration;return{rendersSunlight:this.analysis.visualizeSunlight,visualization:2,thresholdColor:e.toUnitRGBA(),threshold:n>0?t/this._totalDuration:0,...this._minDurationContextVisualizationParameters}}get _minDurationContextVisualizationParameters(){let{minDurationOptions:e,visualizeSunlight:t}=this.analysis;if(!e.contextEnabled||t)return{};let{color:n,colorStops:r}=e.contextOptions,i=1/this._lightDirectionsContext.length;return{visualization:3,gradientColorRamp:this._getEffectiveShadowCastColorRamp(n,r,i)}}get _durationVisualizationParameters(){let{color:e,colorStops:t,mode:n}=this.analysis.totalDurationOptions,r=this._totalDuration,i=r>0&&n===`hourly`?H/r:0,a=this._getEffectiveShadowCastColorRamp(e,t,1/r);return i===0?{...this._discreteVisualizationParameters,gradientColorRamp:a}:{rendersSunlight:this.analysis.visualizeSunlight,bandedGradientColorRamp:a,visualization:1,bandSize:i}}get _showsSeparateZeroBucketInHourlyMode(){let{colorStops:e}=this.analysis.totalDurationOptions;return e==null||e.length===0||e.reduce((e,t)=>Math.min(e,t.value),1/0)<=0}get _discreteVisualizationParameters(){let{color:e,colorStops:t}=this.analysis.discreteOptions,n=1/this._lightDirections.length;return{rendersSunlight:this.analysis.visualizeSunlight,gradientColorRamp:this._getEffectiveShadowCastColorRamp(e,t,n),visualization:0}}get _shadowLayerViews(){return this.view.allLayerViews.items.filter(B)}get _previewDependencies(){let{view:e}=this,n=e.slice.plane,r=this._shadowLayerViews,i=r.map(e=>e.layer).filter(t),a=r.map(e=>e.suspended),o=i.map(e=>e.visible),s=i.map(e=>e.opacity),c=!!e.graphicsView?.suspended,l=i.filter(e=>`definitionExpression`in e).map(e=>e.definitionExpression),u=r.filter(e=>`filter`in e).map(e=>e.filter);return{slicePlane:n,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewSuspended:a,graphicsViewSuspended:c,layerVisibilities:o,layerOpacities:s,filters:u,definitionExpressions:l}}get _renderer(){return this.view?.stage?.renderer}get testData(){}async getDurationAtScreen(e){return this._getDurationAtScreen(e)}async _getDurationAtScreen(e,t){if(!await this._isScreenPointInAnalysisArea(e,t))return-1;let{_renderer:n,_totalDurationSampleCount:r}=this;if(n==null||r===0)return 0;let i=this.view.state.camera.screenToRender(p(e.x,e.y),m()),a=n.readAccumulatedShadow(i);return(this.analysis.visualizeSunlight?1-a:a)*this._totalDuration}async _isScreenPointInAnalysisArea(e,t){let{geometry:n}=this.analysis;if(!n)return!0;let r=await this.view.hitTest(e);l(t);let i=r.results.find(e=>e.mapPoint)?.mapPoint??r?.ground?.mapPoint;if(!i)return!1;let a=await C(i,n.spatialReference,{signal:t});return l(t),a!=null&&w(n,a)}_getEffectiveShadowCastColorRamp(e,t,n){if(t!=null){t.length>P&&a.getLogger(this).warnOnce(`ShadowCastAnalysis supports at most 8 color stops`);let e=t.map(e=>[e.value*n,e.color.toUnitRGBA()]);return e.sort(([e],[t])=>e-t),e}return z(e)}};e([v({readOnly:!0,type:[`shadow-cast-view-3d`]})],I.prototype,`type`,void 0),e([v({constructOnly:!0,nonNullable:!0})],I.prototype,`analysis`,void 0),e([v({readOnly:!0})],I.prototype,`updating`,null),e([v()],I.prototype,`_stopPreviewingTask`,void 0),e([v()],I.prototype,`_updatedRecently`,void 0),e([v()],I.prototype,`_tooltip`,void 0),e([v()],I.prototype,`_sceneUpdating`,null),e([v()],I.prototype,`_effectiveUtcOffset`,null),e([v()],I.prototype,`_utcOffsetAuto`,null),e([v()],I.prototype,`_dateUTCOffset`,null),e([v()],I.prototype,`_startDateTimeUTC`,null),e([v()],I.prototype,`_endDateTimeUTC`,null),e([v()],I.prototype,`_referencePosition`,null),e([v()],I.prototype,`_interval`,null),e([v()],I.prototype,`_intervalContext`,null),e([v()],I.prototype,`_totalDurationSampleCount`,null),e([v()],I.prototype,`_totalDuration`,null),e([v()],I.prototype,`_lightDirections`,null),e([v()],I.prototype,`_lightDirectionsContext`,null),e([v()],I.prototype,`_analysisVolume`,null),e([v()],I.prototype,`_visualizationParameters`,null),e([v()],I.prototype,`_minDurationVisualizationParameters`,null),e([v()],I.prototype,`_minDurationContextVisualizationParameters`,null),e([v()],I.prototype,`_durationVisualizationParameters`,null),e([v()],I.prototype,`_showsSeparateZeroBucketInHourlyMode`,null),e([v()],I.prototype,`_discreteVisualizationParameters`,null),e([v()],I.prototype,`_shadowLayerViews`,null),e([v()],I.prototype,`_previewDependencies`,null),e([v()],I.prototype,`_renderer`,null),I=e([y(`esri.views.3d.analysis.ShadowCastAnalysisView3D`)],I);const L=I;function R(e,t,n){t&&n!=null&&e?.setParameters({shadowCast:n})}function z(e){let t=e.toUnitRGBA();return[[0,x(t[0],t[1],t[2],0)],[1,t]]}function B(e){if(e.suspended)return!1;switch(e.type){case`building-scene-3d`:case`csv-3d`:case`elevation-3d`:case`feature-3d`:case`gaussian-splat-3d`:case`geojson-3d`:case`integrated-mesh-3d`:case`integrated-mesh-3dtiles`:case`ogc-feature-3d`:case`route-3d`:case`scene-layer-3d`:case`scene-layer-graphics-3d`:case`stream-3d`:case`wms-3d`:case`catalog-footprint-3d`:return!0;case`base-dynamic-3d`:case`catalog-3d`:case`catalog-dynamic-group-3d`:case`dimension-3d`:case`imagery-3d`:case`imagery-tile-3d`:case`line-of-sight-3d`:case`map-image-3d`:case`point-cloud-3d`:case`tile-3d`:case`vector-tile-3d`:case`viewshed-3d`:case`voxel-3d`:case`wfs-3d`:case`wmts-3d`:case`media-3d`:return!1;case`group`:return!1;case`graphics-3d`:return e.layer.graphics.some(e=>{let{symbol:t}=e;return t==null||t.type!==`text`&&!(`symbolLayers`in t)||t.type!==`text`&&t.symbolLayers.some(e=>e.type!==`text`)});default:return!1}}function V(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;let r=T(e.slicePlane,t.slicePlane),i=e.startDateUTC.valueOf()===t.startDateUTC.valueOf()&&e.endDateUTC.valueOf()===t.endDateUTC.valueOf(),a=n(e.layerViewSuspended,t.layerViewSuspended)&&e.graphicsViewSuspended===t.graphicsViewSuspended,o=n(e.layerVisibilities,t.layerVisibilities),s=n(e.layerOpacities,t.layerOpacities),c=n(e.filters,t.filters),l=n(e.definitionExpressions,t.definitionExpressions);return r&&i&&a&&o&&s&&c&&l}const H=h(1,`hours`,`milliseconds`),U=500,W=255,G=b(),K=[],q=new j;export{L as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../analysis/SlicePlane.js";import n from"../../../../core/Accessor.js";import r from"../../../../core/Logger.js";import{watch as i,sync as a}from"../../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{c}from"../../../../chunks/boundedPlane.js";import l from"../../../../layers/Layer.js";import u from"../../../../layers/buildingSublayers/BuildingComponentSublayer.js";import{isBuildingSceneLayerView3D as d,projectAndElevationAlignShape as f,projectedShapeToPlane as p,planeToShape as m}from"./sliceToolUtils.js";import{logFailedGeometryProjectionError as h}from"../support/projectionUtils.js";import{isTerrainSurfaceLayer as g}from"../../terrain/isTerrainSurfaceLayer.js";let _=class extends n{constructor(e){super(e),this._internalChange=!1,this._currentSlicePlane=null}initialize(){this.addHandles(this.analysis.excludedLayers.on(`before-add`,e=>{let t=e.item;t!=null&&(t instanceof l||t instanceof u)?t instanceof l&&g(t)?(r.getLogger(this).error(`excludedLayers`,`Layer '${t.title}, id:${t.id}' of type '${t.type}' can not be individually excluded from slicing. Use 'excludeGroundSurface' instead.`),e.preventDefault()):this.analysis.excludedLayers.includes(t)&&e.preventDefault():(r.getLogger(this).error(`excludedLayers`,`Invalid layer type, layer must derive from Layer or BuildingComponentSublayer`),e.preventDefault())})),S(this.view,this),this.addHandles([i(()=>this.analysisViewData.plane,()=>{this._internalChange||this._updateSlicePlaneFromBoundedPlane(),this._updateLayerViews()},a),i(()=>this.analysis.excludeGroundSurface,()=>this._updateLayerViews(),a),this.analysis.excludedLayers.on(`change`,()=>this._updateLayerViews()),i(()=>[this.analysisViewData.active,this.analysisViewData.visible],()=>{this._updateActiveController(),this._updateViewSlicePlane(),this._updateViewSlicePlaneDecoration()},a),i(()=>this._allLayerAndSubLayerViews,()=>this._updateLayerViews())]),this.addHandles([i(()=>this.analysis.shape,()=>{this._internalChange||(this._updateBoundedPlaneFromSlicePlane(),this._updateViewSlicePlane())},a),i(()=>this.analysis.origin?.type!==`web-scene`,()=>this._updateViewSlicePlaneDecoration(),a)],`analysis`),this._updateActiveController(),this._updateBoundedPlaneFromSlicePlane(),this._updateViewSlicePlane(),this._updateViewSlicePlaneDecoration()}destroy(){this.analysisViewData.active&&(this.analysisViewData.active=!1,this.view.slice.plane=null,this._updateActiveController(),this._updateViewSlicePlane()),w(this.view,this),this.set(`view`,null)}get _allLayerAndSubLayerViews(){let e=this.view.allLayerViews.items;return e.concat(e.filter(d).flatMap(({sublayerViews:e})=>e.items))}_updateBoundedPlaneFromSlicePlane(){let e=this.analysis.shape,n=this._currentSlicePlane;if(n==null&&e==null||n!=null&&e!=null&&e.equals(n))return;let i=null,a=null;if(e?.position!=null){let n=e.position.spatialReference,o=f(e,this.view);o??h(this.analysis,n,r.getLogger(this)),i=p(o,this.view,{tiltEnabled:this.analysis.tiltEnabled},c()),i!=null&&(a=new t({heading:e.heading,tilt:e.tilt,position:e.position,width:e.width,height:e.height}))}this._currentSlicePlane=a,this._internalChange=!0,this.analysisViewData.plane=i,this._internalChange=!1}_updateSlicePlaneFromBoundedPlane(){let e=this.analysisViewData.plane,n=m(e,this.view,this.view.spatialReference,new t),r=null;n!=null&&(r=new t({heading:n.heading,tilt:n.tilt,position:n.position,width:n.width,height:n.height})),this._currentSlicePlane=r,this._internalChange=!0,this.analysis.shape=n,this._internalChange=!1,this._updateViewSlicePlane()}_updateActiveController(){if(y)return;let e=C(this.view);if(e){if(this.analysisViewData.active)e.activeController!=null&&e.activeController!==this?(y=!0,e.activeController.analysisViewData.active=!1,y=!1):e.activeController!=null&&e.activeController,this._updateLayerViews(),e.activeController=this;else{if(e.activeController!=null&&e.activeController!==this)return;e.activeController!=null&&e.activeController===this&&(e.activeController=null,this._updateLayerViews())}}}_updateViewSlicePlane(){b(this.view)}_updateViewSlicePlaneDecoration(){x(this.view)}_updateLayerViews(){let e=this.analysisViewData.plane!=null&&this.analysisViewData.visible&&this.analysisViewData.active,t=[],n=e=>{`layers`in e?e.layers.forEach(n):t.push(e)};this.analysis.excludedLayers.forEach(n),this.view.allLayerViews.forEach(n=>{n.destroyed||(`slicePlaneEnabled`in n&&(n.slicePlaneEnabled=e&&!t.includes(n.layer)),`sublayerViews`in n&&n.sublayerViews.forEach(n=>{n.slicePlaneEnabled=e&&!t.includes(n.sublayer)}))}),this.view.basemapTerrain!=null&&(this.view.basemapTerrain.slicePlaneEnabled=e&&!this.analysis.excludeGroundSurface)}};e([o()],_.prototype,`view`,void 0),e([o()],_.prototype,`analysis`,void 0),e([o()],_.prototype,`analysisViewData`,void 0),e([o()],_.prototype,`_allLayerAndSubLayerViews`,null),_=e([s(`esri.views.3d.analysis.Slice.SliceController`)],_);const v=new Map;let y=!1;function b(e){let t=C(e)?.activeController;t?.analysisViewData.plane!=null&&t.analysisViewData.visible?e.slice.plane=t.analysisViewData.plane:e.slice.plane=null}function x(e){let t=C(e)?.activeController;e.slice.isDecoration=t?.analysis.origin?.type!==`web-scene`}function S(e,t){v.has(e)||v.set(e,{all:[],activeController:null}),v.get(e)?.all.push(t)}function C(e){return v.get(e)}function w(e,t){if(!v.has(e))throw Error(`view expected in global slice register`);let n=v.get(e),r=n?.all.lastIndexOf(t)??-1;if(!n||r===-1)throw Error(`controller expected in global slice register`);n.all.splice(r,1),n.all.length===0&&v.delete(e)}export{_ as SliceController};
2
+ import{__decorate as e}from"tslib";import t from"../../../../analysis/SlicePlane.js";import n from"../../../../core/Accessor.js";import r from"../../../../core/Logger.js";import{watch as i,sync as a}from"../../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{create as c}from"../../../../geometry/support/boundedPlane.js";import l from"../../../../layers/Layer.js";import u from"../../../../layers/buildingSublayers/BuildingComponentSublayer.js";import{isBuildingSceneLayerView3D as d,projectAndElevationAlignShape as f,projectedShapeToPlane as p,planeToShape as m}from"./sliceToolUtils.js";import{logFailedGeometryProjectionError as h}from"../support/projectionUtils.js";import{isTerrainSurfaceLayer as g}from"../../terrain/isTerrainSurfaceLayer.js";let _=class extends n{constructor(e){super(e),this._internalChange=!1,this._currentSlicePlane=null}initialize(){this.addHandles(this.analysis.excludedLayers.on(`before-add`,e=>{let t=e.item;t!=null&&(t instanceof l||t instanceof u)?t instanceof l&&g(t)?(r.getLogger(this).error(`excludedLayers`,`Layer '${t.title}, id:${t.id}' of type '${t.type}' can not be individually excluded from slicing. Use 'excludeGroundSurface' instead.`),e.preventDefault()):this.analysis.excludedLayers.includes(t)&&e.preventDefault():(r.getLogger(this).error(`excludedLayers`,`Invalid layer type, layer must derive from Layer or BuildingComponentSublayer`),e.preventDefault())})),S(this.view,this),this.addHandles([i(()=>this.analysisViewData.plane,()=>{this._internalChange||this._updateSlicePlaneFromBoundedPlane(),this._updateLayerViews()},a),i(()=>this.analysis.excludeGroundSurface,()=>this._updateLayerViews(),a),this.analysis.excludedLayers.on(`change`,()=>this._updateLayerViews()),i(()=>[this.analysisViewData.active,this.analysisViewData.visible],()=>{this._updateActiveController(),this._updateViewSlicePlane(),this._updateViewSlicePlaneDecoration()},a),i(()=>this._allLayerAndSubLayerViews,()=>this._updateLayerViews())]),this.addHandles([i(()=>this.analysis.shape,()=>{this._internalChange||(this._updateBoundedPlaneFromSlicePlane(),this._updateViewSlicePlane())},a),i(()=>this.analysis.origin?.type!==`web-scene`,()=>this._updateViewSlicePlaneDecoration(),a)],`analysis`),this._updateActiveController(),this._updateBoundedPlaneFromSlicePlane(),this._updateViewSlicePlane(),this._updateViewSlicePlaneDecoration()}destroy(){this.analysisViewData.active&&(this.analysisViewData.active=!1,this.view.slice.plane=null,this._updateActiveController(),this._updateViewSlicePlane()),w(this.view,this),this.set(`view`,null)}get _allLayerAndSubLayerViews(){let e=this.view.allLayerViews.items;return e.concat(e.filter(d).flatMap(({sublayerViews:e})=>e.items))}_updateBoundedPlaneFromSlicePlane(){let e=this.analysis.shape,n=this._currentSlicePlane;if(n==null&&e==null||n!=null&&e!=null&&e.equals(n))return;let i=null,a=null;if(e?.position!=null){let n=e.position.spatialReference,o=f(e,this.view);o??h(this.analysis,n,r.getLogger(this)),i=p(o,this.view,{tiltEnabled:this.analysis.tiltEnabled},c()),i!=null&&(a=new t({heading:e.heading,tilt:e.tilt,position:e.position,width:e.width,height:e.height}))}this._currentSlicePlane=a,this._internalChange=!0,this.analysisViewData.plane=i,this._internalChange=!1}_updateSlicePlaneFromBoundedPlane(){let e=this.analysisViewData.plane,n=m(e,this.view,this.view.spatialReference,new t),r=null;n!=null&&(r=new t({heading:n.heading,tilt:n.tilt,position:n.position,width:n.width,height:n.height})),this._currentSlicePlane=r,this._internalChange=!0,this.analysis.shape=n,this._internalChange=!1,this._updateViewSlicePlane()}_updateActiveController(){if(y)return;let e=C(this.view);if(e){if(this.analysisViewData.active)e.activeController!=null&&e.activeController!==this?(y=!0,e.activeController.analysisViewData.active=!1,y=!1):e.activeController!=null&&e.activeController,this._updateLayerViews(),e.activeController=this;else{if(e.activeController!=null&&e.activeController!==this)return;e.activeController!=null&&e.activeController===this&&(e.activeController=null,this._updateLayerViews())}}}_updateViewSlicePlane(){b(this.view)}_updateViewSlicePlaneDecoration(){x(this.view)}_updateLayerViews(){let e=this.analysisViewData.plane!=null&&this.analysisViewData.visible&&this.analysisViewData.active,t=[],n=e=>{`layers`in e?e.layers.forEach(n):t.push(e)};this.analysis.excludedLayers.forEach(n),this.view.allLayerViews.forEach(n=>{n.destroyed||(`slicePlaneEnabled`in n&&(n.slicePlaneEnabled=e&&!t.includes(n.layer)),`sublayerViews`in n&&n.sublayerViews.forEach(n=>{n.slicePlaneEnabled=e&&!t.includes(n.sublayer)}))}),this.view.basemapTerrain!=null&&(this.view.basemapTerrain.slicePlaneEnabled=e&&!this.analysis.excludeGroundSurface)}};e([o()],_.prototype,`view`,void 0),e([o()],_.prototype,`analysis`,void 0),e([o()],_.prototype,`analysisViewData`,void 0),e([o()],_.prototype,`_allLayerAndSubLayerViews`,null),_=e([s(`esri.views.3d.analysis.Slice.SliceController`)],_);const v=new Map;let y=!1;function b(e){let t=C(e)?.activeController;t?.analysisViewData.plane!=null&&t.analysisViewData.visible?e.slice.plane=t.analysisViewData.plane:e.slice.plane=null}function x(e){let t=C(e)?.activeController;e.slice.isDecoration=t?.analysis.origin?.type!==`web-scene`}function S(e,t){v.has(e)||v.set(e,{all:[],activeController:null}),v.get(e)?.all.push(t)}function C(e){return v.get(e)}function w(e,t){if(!v.has(e))throw Error(`view expected in global slice register`);let n=v.get(e),r=n?.all.lastIndexOf(t)??-1;if(!n||r===-1)throw Error(`controller expected in global slice register`);n.all.splice(r,1),n.all.length===0&&v.delete(e)}export{_ as SliceController};