@arcgis/core 4.28.0-next.20230912 → 4.28.0-next.20230913

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 (47) hide show
  1. package/arcade/featureset/support/errorsupport.js +1 -1
  2. package/arcade.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/{aa78ca83a4b582b6c2b6.js → 6d94b358e8d1cf79bba3.js} +1 -1
  5. package/assets/esri/core/workers/chunks/8aa7e994b74f66522c37.js +1 -0
  6. package/assets/esri/core/workers/chunks/a047fcf3c7307a69b63c.js +1 -0
  7. package/assets/esri/core/workers/chunks/c51233ad51823cb98c35.js +1 -0
  8. package/assets/esri/core/workers/chunks/dbf343d1fb746f99bb6e.js +1 -0
  9. package/assets/esri/core/workers/chunks/{271ec1d1666bf6dc3dda.js → dc74b4ec85e8e3de5b27.js} +1 -1
  10. package/assets/esri/themes/base/widgets/_Sketch.scss +0 -5
  11. package/assets/esri/themes/base/widgets/_SketchTooltipControls.scss +0 -5
  12. package/assets/esri/themes/dark/main.css +1 -1
  13. package/assets/esri/themes/light/main.css +1 -1
  14. package/assets/esri/themes/light/view.css +1 -1
  15. package/core/promiseUtils.js +1 -1
  16. package/core/sql/DateOnly.js +1 -1
  17. package/core/sql/TimeOnly.js +1 -1
  18. package/interfaces.d.ts +190 -144
  19. package/layers/SceneLayer.js +1 -1
  20. package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
  21. package/layers/support/FetchAssociatedFeatureLayer.js +1 -1
  22. package/layers/support/TilemapCache.js +1 -1
  23. package/layers/support/rasterDatasets/BaseRaster.js +1 -1
  24. package/layers/video/VideoController.js +1 -1
  25. package/package.json +1 -1
  26. package/support/revision.js +1 -1
  27. package/views/2d/engine/webgl/DisplayId.js +1 -1
  28. package/views/2d/engine/webgl/Utils.js +1 -1
  29. package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
  30. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  31. package/views/3d/analysis/Dimension/LengthDimensionVisualization.js +1 -1
  32. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  33. package/views/3d/analysis/Dimension/settings.js +1 -1
  34. package/views/3d/interactive/editingTools/originGraphicVisualElementUtils.js +1 -1
  35. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  36. package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
  37. package/views/animation/easing.js +1 -1
  38. package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
  39. package/widgets/Feature/FeatureMedia.js +1 -1
  40. package/widgets/Features.js +1 -1
  41. package/widgets/support/SketchTooltipControls/SketchTooltipControlsViewModel.js +1 -1
  42. package/widgets/support/SketchTooltipControls.js +1 -1
  43. package/widgets/support/SnappingControls.js +1 -1
  44. package/assets/esri/core/workers/chunks/15056f91d87f11b00bcc.js +0 -1
  45. package/assets/esri/core/workers/chunks/877302d6e39a0d530aab.js +0 -1
  46. package/assets/esri/core/workers/chunks/aedb1f944b332b098933.js +0 -1
  47. package/assets/esri/core/workers/chunks/c8dd21a332559c99815c.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "4.28.0-next.20230912",
3
+ "version": "4.28.0-next.20230913",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- const d="20230912",c="bd72dc6413a5527e79400d954dc85d63dc291945";export{d as buildDate,c as commitHash};
5
+ const a="20230913",e="1a1a887651a75a8ef744367d94f4aa732e521e9b";export{a as buildDate,e as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- const n=8388607,t=8388608,r=254,o=255,u=0,c=1,e=n=>(n&t)>>>23,f=t=>t&n,i=n=>e(n)===c?r:o;function p(n){return e(n)===c}function s(n,r){return((r?t:0)|n)>>>0}export{r as aggregateValidFiltersMask,s as createDisplayId,n as displayIdTexelMask,c as displayIdTypeAggregate,u as displayIdTypeFeature,t as displayIdTypeMask,i as getDisplayIdFilterMask,f as getDisplayIdTexel,e as getDisplayIdType,p as isAggregateId,o as nonaggregateValidFiltersMask};
5
+ const n=8388607,t=8388608,r=254,o=255,u=0,c=1,e=n=>(n&t)>>>23,f=t=>t&n,i=n=>e(n)===c?r:o;function p(n){return e(n)===c}function s(n,r){return((r?t:0)|n)>>>0}export{r as aggregateValidFiltersMask,s as createDisplayId,n as displayIdTexelMask,c as displayIdTypeAggregate,u as displayIdTypeFeature,t as displayIdTypeMask,i as getDisplayIdFilterMask,f as getDisplayIdTexel,e as getDisplayIdType,p as isAggregateId,o as nonAggregateValidFiltersMask};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Error.js";import t from"../../../../core/Logger.js";import{CapType as n,JoinType as r}from"../../../../symbols/cim/enums.js";import{WGLGeometryType as s,WGLSymbologyType as a,VVType as i}from"./enums.js";import{Usage as c,DataType as o,PixelType as u}from"../../../webgl/enums.js";import{VertexElementDescriptor as l}from"../../../webgl/VertexElementDescriptor.js";const f=t.getLogger("esri.views.2d.engine.webgl.Utils"),m="geometry",d=[{name:m,strideInBytes:12}],p=[{name:m,strideInBytes:36}],y=[{name:m,strideInBytes:24}],I=[{name:m,strideInBytes:12}],S=[{name:m,strideInBytes:40}],T=[{name:m,strideInBytes:36}],g=[{name:m,strideInBytes:36}];function w(e){const t={};for(const n of e)t[n.name]=n.strideInBytes;return t}const E=w([{name:m,strideInBytes:36}]),h=w(d),L=w(p),N=w(y),D=w(I),A=w(S),M=w(T),U=w(g);function R(e,t){switch(e){case s.MARKER:return t===a.HEATMAP?h:E;case s.FILL:switch(t){case a.DOT_DENSITY:return D;case a.SIMPLE:case a.OUTLINE_FILL_SIMPLE:return N;default:return L}case s.LINE:return A;case s.TEXT:return M;case s.LABEL:return U}}const _=[m],B=[m],O=[m],v=[m],C=[m];function b(e){switch(e){case s.MARKER:return _;case s.FILL:return B;case s.LINE:return O;case s.TEXT:return v;case s.LABEL:return C}}function F(e){switch(e%4){case 0:case 2:return 4;case 1:case 3:return 1}}function P(e,t){switch(t%4){case 0:case 2:return new Uint32Array(Math.floor(e*t/4));case 1:case 3:return new Uint8Array(e*t)}}function x(e,t){switch(t%4){case 0:case 2:return new Uint32Array(e);case 1:case 3:return new Uint8Array(e)}}function z(e){return null!=e}function $(e){return"number"==typeof e}function k(t){switch(t){case"butt":return n.BUTT;case"round":return n.ROUND;case"square":return n.SQUARE;default:return f.error(new e("mapview-invalid-type",`Cap type ${t} is not a valid option. Defaulting to round`)),n.ROUND}}function G(t){switch(t){case"miter":return r.MITER;case"bevel":return r.BEVEL;case"round":return r.ROUND;default:return f.error(new e("mapview-invalid-type",`Join type ${t} is not a valid option. Defaulting to round`)),r.ROUND}}function V(e){switch(e){case"opacity":return i.OPACITY;case"color":return i.COLOR;case"rotation":return i.ROTATION;case"size":return i.SIZE;default:return f.error(`Cannot interpret unknown vv: ${e}`),null}}function j(e,t,n,r,s,a,i){for(const c in a){const t=a[c].stride,r=F(t),i=a[c].data,o=n[c].data;if(null==i||null==o)continue;const u=t*s.vertexCount/r,l=t*e/r,f=t*s.vertexFrom/r;for(let e=0;e<u;++e)o[e+l]=i[e+f]}if(null!=i&&null!=r){const n=s.indexCount;for(let a=0;a<n;++a)r[a+t]=i[a+s.indexFrom]-s.vertexFrom+e}}const Y={[m]:c.STATIC_DRAW};function H(e,t){const n=[];for(let r=0;r<5;++r){const s=b(r),a={};for(const e of s)a[e]={data:t(r,e)};n.push({data:e(r),buffers:a})}return n}function q(e){switch(e){case o.BYTE:case o.UNSIGNED_BYTE:return 1;case o.SHORT:case o.UNSIGNED_SHORT:return 2;case o.FLOAT:case o.INT:case o.UNSIGNED_INT:return 4}}function K(t){switch(t){case u.UNSIGNED_BYTE:return 1;case u.UNSIGNED_SHORT_4_4_4_4:return 2;case u.FLOAT:return 4;default:return void f.error(new e("webgl-utils",`Unable to handle type ${t}`))}}function W(t){switch(t){case u.UNSIGNED_BYTE:return Uint8Array;case u.UNSIGNED_SHORT_4_4_4_4:return Uint16Array;case u.FLOAT:return Float32Array;default:return void f.error(new e("webgl-utils",`Unable to handle type ${t}`))}}function X(e){const t={};for(const n in e){const r=e[n];let s=0;t[n]=r.map((e=>{const t=new l(e.name,e.count,e.type,s,0,e.normalized||!1);return s+=e.count*q(e.type),t})),t[n]?.forEach((e=>e.stride=s))}return t}const J=e=>{const t=new Map;for(const n in e)for(const r of e[n])t.set(r.name,r.location);return t},Q=e=>{const t={};for(const n in e){const r=e[n];t[n]=r?.length?r[0].stride:0}return t},Z=new Map,ee=(e,t)=>{if(!Z.has(e)){const n=X(t),r={strides:Q(n),bufferLayouts:n,attributes:J(t)};Z.set(e,r)}return Z.get(e)};function te(e){e(s.FILL),e(s.LINE),e(s.MARKER),e(s.TEXT),e(s.LABEL)}const ne=e=>"path"in e&&pe(e.path),re=e=>"url"in e&&e.url||"imageData"in e&&e.imageData,se=e=>"imageData"in e&&e.imageData&&"contentType"in e&&e.contentType?`data:${e.contentType};base64,${e.imageData}`:"url"in e?e.url:null,ae=e=>null!=e&&e.startsWith("data:image/gif"),ie=e=>"url"in e&&e.url&&(e.url.includes(".gif")||ae(e.url))||"contentType"in e&&"image/gif"===e.contentType||"imageData"in e&&ae(e.imageData),ce=e=>null!=e&&e.startsWith("data:image/png"),oe=e=>"url"in e&&e.url&&(e.url.includes(".png")||ce(e.url))||"contentType"in e&&"image/png"===e.contentType||"imageData"in e&&ce(e.imageData),ue=e=>e.type&&e.type.toLowerCase().includes("3d");function le(e){switch(e.type){case"line":{const t=e;return"CIMSolidStroke"===t.cim.type&&!t.dashTemplate}case"fill":return"CIMSolidFill"===e.cim.type;case"esriSFS":return"esriSFSSolid"===e.style||"esriSFSNull"===e.style;case"esriSLS":return"esriSLSSolid"===e.style||"esriSLSNull"===e.style;default:return!1}}function fe(e){switch("cim"in e?e.cim.type:e.type){case"esriSMS":case"esriPMS":case"CIMPointSymbol":return!1;case"CIMVectorMarker":case"CIMCharacterMarker":case"CIMPictureMarker":return ye(e);default:return!0}}function me(e){const t="maxVVSize"in e&&e.maxVVSize,n="width"in e&&e.width||"size"in e&&e.size||0;return t||n}function de(e){const t=[];for(let n=0;n<e.length;n++)t.push(e.charCodeAt(n));return t}const pe=e=>!!e&&(e=e.trim(),!!(/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(e)&&/[\dz]$/i.test(e)&&e.length>4)),ye=e=>"fill"===e.type&&"CIMMarkerPlacementInsidePolygon"===e?.cim?.markerPlacement?.type;export{P as allocateTypedArrayBuffer,x as allocateTypedArrayBufferwithData,Y as cVboInfo,de as charCodes,j as copyMeshData,H as createGeometryData,ee as createProgramDescriptor,te as forEachGeometryType,q as getBytes,k as getCapType,G as getJoinType,b as getNamedBuffers,me as getPMSResourceSize,W as getPixelArrayCtor,K as getPixelBytes,R as getStrides,se as getUrl,V as getVVType,ue as is3D,z as isDefined,ie as isGIF,ae as isGIFDataUri,re as isImageResource,ye as isMarkerPlacementInsidePolygon,$ as isNumber,oe as isPNG,ce as isPNGDataUri,ne as isSVGResource,le as isSimple,pe as isValidSVG,fe as shouldRepeat,F as strideToPackingFactor};
5
+ import e from"../../../../core/Error.js";import t from"../../../../core/Logger.js";import{CapType as n,JoinType as r}from"../../../../symbols/cim/enums.js";import{WGLGeometryType as s,WGLSymbologyType as a,VVType as i}from"./enums.js";import{Usage as c,DataType as o,PixelType as u}from"../../../webgl/enums.js";import{VertexElementDescriptor as l}from"../../../webgl/VertexElementDescriptor.js";const f=t.getLogger("esri.views.2d.engine.webgl.Utils"),m="geometry",d=[{name:m,strideInBytes:12}],p=[{name:m,strideInBytes:36}],y=[{name:m,strideInBytes:24}],I=[{name:m,strideInBytes:12}],S=[{name:m,strideInBytes:40}],T=[{name:m,strideInBytes:36}],g=[{name:m,strideInBytes:36}];function w(e){const t={};for(const n of e)t[n.name]=n.strideInBytes;return t}const E=w([{name:m,strideInBytes:36}]),h=w(d),L=w(p),N=w(y),D=w(I),A=w(S),M=w(T),U=w(g);function R(e,t){switch(e){case s.MARKER:return t===a.HEATMAP?h:E;case s.FILL:switch(t){case a.DOT_DENSITY:return D;case a.SIMPLE:case a.OUTLINE_FILL_SIMPLE:return N;default:return L}case s.LINE:return A;case s.TEXT:return M;case s.LABEL:return U}}const _=[m],B=[m],O=[m],v=[m],C=[m];function b(e){switch(e){case s.MARKER:return _;case s.FILL:return B;case s.LINE:return O;case s.TEXT:return v;case s.LABEL:return C}}function F(e){switch(e%4){case 0:case 2:return 4;case 1:case 3:return 1}}function P(e,t){switch(t%4){case 0:case 2:return new Uint32Array(Math.floor(e*t/4));case 1:case 3:return new Uint8Array(e*t)}}function x(e,t){switch(t%4){case 0:case 2:return new Uint32Array(e);case 1:case 3:return new Uint8Array(e)}}function z(e){return null!=e}function $(e){return"number"==typeof e}function k(t){switch(t){case"butt":return n.BUTT;case"round":return n.ROUND;case"square":return n.SQUARE;default:return f.error(new e("mapview-invalid-type",`Cap type ${t} is not a valid option. Defaulting to round`)),n.ROUND}}function G(t){switch(t){case"miter":return r.MITER;case"bevel":return r.BEVEL;case"round":return r.ROUND;default:return f.error(new e("mapview-invalid-type",`Join type ${t} is not a valid option. Defaulting to round`)),r.ROUND}}function V(e){switch(e){case"opacity":return i.OPACITY;case"color":return i.COLOR;case"rotation":return i.ROTATION;case"size":return i.SIZE;default:return f.error(`Cannot interpret unknown vv: ${e}`),null}}function j(e,t,n,r,s,a,i){for(const c in a){const t=a[c].stride,r=F(t),i=a[c].data,o=n[c].data;if(null==i||null==o)continue;const u=t*s.vertexCount/r,l=t*e/r,f=t*s.vertexFrom/r;for(let e=0;e<u;++e)o[e+l]=i[e+f]}if(null!=i&&null!=r){const n=s.indexCount;for(let a=0;a<n;++a)r[a+t]=i[a+s.indexFrom]-s.vertexFrom+e}}const Y={[m]:c.STATIC_DRAW};function H(e,t){const n=[];for(let r=0;r<5;++r){const s=b(r),a={};for(const e of s)a[e]={data:t(r,e)};n.push({data:e(r),buffers:a})}return n}function q(e){switch(e){case o.BYTE:case o.UNSIGNED_BYTE:return 1;case o.SHORT:case o.UNSIGNED_SHORT:return 2;case o.FLOAT:case o.INT:case o.UNSIGNED_INT:return 4}}function K(t){switch(t){case u.UNSIGNED_BYTE:return 1;case u.UNSIGNED_SHORT_4_4_4_4:return 2;case u.FLOAT:return 4;default:return void f.error(new e("webgl-utils",`Unable to handle type ${t}`))}}function W(t){switch(t){case u.UNSIGNED_BYTE:return Uint8Array;case u.UNSIGNED_SHORT_4_4_4_4:return Uint16Array;case u.FLOAT:return Float32Array;default:return void f.error(new e("webgl-utils",`Unable to handle type ${t}`))}}function X(e){const t={};for(const n in e){const r=e[n];let s=0;t[n]=r.map((e=>{const t=new l(e.name,e.count,e.type,s,0,e.normalized||!1);return s+=e.count*q(e.type),t})),t[n]?.forEach((e=>e.stride=s))}return t}const J=e=>{const t=new Map;for(const n in e)for(const r of e[n])t.set(r.name,r.location);return t},Q=e=>{const t={};for(const n in e){const r=e[n];t[n]=r?.length?r[0].stride:0}return t},Z=new Map,ee=(e,t)=>{if(!Z.has(e)){const n=X(t),r={strides:Q(n),bufferLayouts:n,attributes:J(t)};Z.set(e,r)}return Z.get(e)};function te(e){e(s.FILL),e(s.LINE),e(s.MARKER),e(s.TEXT),e(s.LABEL)}const ne=e=>"path"in e&&pe(e.path),re=e=>!(!("url"in e)||!e.url)||!(!("imageData"in e)||!e.imageData),se=e=>"imageData"in e&&e.imageData&&"contentType"in e&&e.contentType?`data:${e.contentType};base64,${e.imageData}`:"url"in e?e.url:null,ae=e=>null!=e&&e.startsWith("data:image/gif"),ie=e=>"url"in e&&e.url&&(e.url.includes(".gif")||ae(e.url))||"contentType"in e&&"image/gif"===e.contentType||"imageData"in e&&ae(e.imageData),ce=e=>null!=e&&e.startsWith("data:image/png"),oe=e=>"url"in e&&e.url&&(e.url.includes(".png")||ce(e.url))||"contentType"in e&&"image/png"===e.contentType||"imageData"in e&&ce(e.imageData),ue=e=>e.type&&e.type.toLowerCase().includes("3d");function le(e){switch(e.type){case"line":{const t=e;return"CIMSolidStroke"===t.cim.type&&!t.dashTemplate}case"fill":return"CIMSolidFill"===e.cim.type;case"esriSFS":return"esriSFSSolid"===e.style||"esriSFSNull"===e.style;case"esriSLS":return"esriSLSSolid"===e.style||"esriSLSNull"===e.style;default:return!1}}function fe(e){switch("cim"in e?e.cim.type:e.type){case"esriSMS":case"esriPMS":case"CIMPointSymbol":return!1;case"CIMVectorMarker":case"CIMCharacterMarker":case"CIMPictureMarker":return ye(e);default:return!0}}function me(e){const t="maxVVSize"in e&&e.maxVVSize,n="width"in e&&e.width||"size"in e&&e.size||0;return t||n}function de(e){const t=[];for(let n=0;n<e.length;n++)t.push(e.charCodeAt(n));return t}const pe=e=>!!e&&(e=e.trim(),!!(/^[mzlhvcsqta]\s*[-+.0-9][^mlhvzcsqta]+/i.test(e)&&/[\dz]$/i.test(e)&&e.length>4)),ye=e=>"fill"===e.type&&"CIMMarkerPlacementInsidePolygon"===e?.cim?.markerPlacement?.type;export{P as allocateTypedArrayBuffer,x as allocateTypedArrayBufferwithData,Y as cVboInfo,de as charCodes,j as copyMeshData,H as createGeometryData,ee as createProgramDescriptor,te as forEachGeometryType,q as getBytes,k as getCapType,G as getJoinType,b as getNamedBuffers,me as getPMSResourceSize,W as getPixelArrayCtor,K as getPixelBytes,R as getStrides,se as getUrl,V as getVVType,ue as is3D,z as isDefined,ie as isGIF,ae as isGIFDataUri,re as isImageResource,ye as isMarkerPlacementInsidePolygon,$ as isNumber,oe as isPNG,ce as isPNGDataUri,ne as isSVGResource,le as isSimple,pe as isValidSVG,fe as shouldRepeat,F as strideToPackingFactor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../chunks/tslib.es6.js";import i from"../../../../Color.js";import"../../../../intl.js";import s from"../../../../core/Accessor.js";import{makeHandle as t,destroyHandle as a}from"../../../../core/handleUtils.js";import{mapCollection as r,watch as n,syncAndInitial as o,when as l,sync as m}from"../../../../core/reactiveUtils.js";import{pt2px as c}from"../../../../core/screenUtils.js";import{property as d}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{Z as p}from"../../../../chunks/vec4f64.js";import{LengthDimensionVisualization as u}from"./LengthDimensionVisualization.js";import{Settings as f}from"./settings.js";import{RenderOccludedFlag as g}from"../../webgl-engine/lib/Material.js";import{LineMarkerMaterial as M}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{createStipplePatternSimple as _}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as y}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{LineMarkerAnchor as w}from"../../webgl-engine/shaders/LineMarkerTechniqueConfiguration.js";import{onLocaleChange as v}from"../../../../intl/locale.js";import{fetchMessageBundle as L}from"../../../../intl/messages.js";let z=class extends s{get analysis(){return this.analysisViewData.analysis}get visible(){return this.analysisViewData.visible}constructor(e){super(e),this.loadingMessages=!1,this._messages=null}initialize(){this._settings=new f(this.view.effectiveTheme);const e=this.isDecoration;this._markerMaterial=new M({width:1,anchor:w.Tip,color:p,placement:"begin-end",worldSpace:!0,hideOnShortSegments:!0,hasTip:!0,renderOccluded:g.OccludeAndTransparent,markerPrimitive:"triangle",isDecoration:e}),this._dimensionLineMaterial=new y({width:1,color:p,renderOccluded:g.OccludeAndTransparent,markerParameters:this._markerMaterial.parameters,isDecoration:e}),this._offsetLineMaterial=new y({width:1,color:p,renderOccluded:g.OccludeAndTransparent,stipplePattern:_(5),isDecoration:e}),this._smallDimensionLineMaterial=new y({width:1,color:p,renderOccluded:g.OccludeAndTransparent,isDecoration:e}),this._smallOffsetLineMaterial=new y({width:1,color:p,renderOccluded:g.OccludeAndTransparent,stipplePattern:_(5),isDecoration:e});for(const i of this._lineMaterials())this.view._stage.add(i),this.addHandles(t((()=>{this.view._stage?.remove(i)})));const s=r((()=>this.analysisViewData.computations),(({computation:e})=>this._createVisualization(e)));this._dimensionVisualizations=s,this.addHandles([a(s),n((()=>i.toUnitRGBA(this.analysis.style.color)),(e=>{for(const i of this._lineMaterials())i.setParameters({color:e})}),o),n((()=>this.analysis.style.lineSize),(e=>{const i=c(e);this._markerMaterial.setParameters({width:i*this._settings.markers.lineSizeFraction}),this._dimensionLineMaterial.setParameters({width:i,markerParameters:this._markerMaterial.parameters});const s=Math.max(i*this._settings.offsetLine.lineSizeFraction,1);this._offsetLineMaterial.setParameters({width:s})}),o),n((()=>({camera:this.view.state.camera,style:j(this.analysis)})),(({camera:e,style:i})=>{for(const{visualization:s}of this._dimensionVisualizations)s.updateCameraDependentElements(e,s.computation.geometry,i),s.updateLabelStyle(i)})),n((()=>this.visible),(e=>{for(const{visualization:i}of this._dimensionVisualizations)i.visible=e}))]),this.addHandles([v((()=>this._updateMessageBundle())),l((()=>!this.loadingMessages),(()=>{for(const{visualization:e}of this._dimensionVisualizations)e.updateUnitsMessages(this._messages)}),m)]),this._updateMessageBundle()}get testInfo(){return{visualizations:this._dimensionVisualizations.items.map((({visualization:e})=>e)),disablePartialOcclusion:()=>{for(const e of this._lineMaterials())e.setParameters({renderOccluded:g.Occlude})}}}_createVisualization(e){const i=new u({analysis:this.analysis,computation:e,view:this.view,visible:this.visible,markerMaterial:this._markerMaterial,dimensionLineMaterial:this._dimensionLineMaterial,offsetLineMaterial:this._offsetLineMaterial,smallDimensionLineMaterial:this._smallDimensionLineMaterial,smallOffsetLineMaterial:this._smallOffsetLineMaterial,messages:this._messages,isDecoration:this.isDecoration});return{visualization:i,remove:()=>i.destroy()}}_lineMaterials(){return[this._markerMaterial,this._dimensionLineMaterial,this._offsetLineMaterial,this._smallDimensionLineMaterial,this._smallOffsetLineMaterial]}async _updateMessageBundle(){this.loadingMessages=!0;try{this._messages=await L("esri/core/t9n/Units")}finally{this.loadingMessages=!1}}};function j(e){const{fontSize:i,lineSize:s,textColor:t,textBackgroundColor:a}=e.style;return{fontSize:i,lineSize:s,textBackgroundColor:a.clone(),textColor:t.clone()}}e([d({constructOnly:!0})],z.prototype,"analysisViewData",void 0),e([d({constructOnly:!0,nonNullable:!0})],z.prototype,"view",void 0),e([d({constructOnly:!0})],z.prototype,"isDecoration",void 0),e([d()],z.prototype,"analysis",null),e([d()],z.prototype,"visible",null),e([d()],z.prototype,"loadingMessages",void 0),z=e([h("esri.views.3d.analysis.Dimension.DimensionVisualization")],z);export{z as DimensionVisualization};
5
+ import{_ as e}from"../../../../chunks/tslib.es6.js";import i from"../../../../Color.js";import"../../../../intl.js";import s from"../../../../core/Accessor.js";import{makeHandle as t,destroyHandle as a}from"../../../../core/handleUtils.js";import{mapCollection as r,watch as n,syncAndInitial as o,when as l,sync as m}from"../../../../core/reactiveUtils.js";import{pt2px as c}from"../../../../core/screenUtils.js";import{property as d}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as h}from"../../../../core/accessorSupport/decorators/subclass.js";import{Z as p}from"../../../../chunks/vec4f64.js";import{LengthDimensionVisualization as u}from"./LengthDimensionVisualization.js";import{markerLineSizeFraction as f,offsetLineSizeFraction as g}from"./settings.js";import{RenderOccludedFlag as M}from"../../webgl-engine/lib/Material.js";import{LineMarkerMaterial as _}from"../../webgl-engine/materials/LineMarkerMaterial.js";import{createStipplePatternSimple as y}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as w}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{LineMarkerAnchor as v}from"../../webgl-engine/shaders/LineMarkerTechniqueConfiguration.js";import{onLocaleChange as L}from"../../../../intl/locale.js";import{fetchMessageBundle as j}from"../../../../intl/messages.js";let b=class extends s{get analysis(){return this.analysisViewData.analysis}get visible(){return this.analysisViewData.visible}constructor(e){super(e),this.loadingMessages=!1,this._messages=null}initialize(){const e=this.isDecoration;this._markerMaterial=new _({width:1,anchor:v.Tip,color:p,placement:"begin-end",worldSpace:!0,hideOnShortSegments:!0,hasTip:!0,renderOccluded:M.OccludeAndTransparent,markerPrimitive:"triangle",isDecoration:e}),this._dimensionLineMaterial=new w({width:1,color:p,renderOccluded:M.OccludeAndTransparent,markerParameters:this._markerMaterial.parameters,isDecoration:e}),this._offsetLineMaterial=new w({width:1,color:p,renderOccluded:M.OccludeAndTransparent,stipplePattern:y(5),isDecoration:e}),this._smallDimensionLineMaterial=new w({width:1,color:p,renderOccluded:M.OccludeAndTransparent,isDecoration:e}),this._smallOffsetLineMaterial=new w({width:1,color:p,renderOccluded:M.OccludeAndTransparent,stipplePattern:y(5),isDecoration:e});for(const i of this._lineMaterials())this.view._stage.add(i),this.addHandles(t((()=>{this.view._stage?.remove(i)})));const s=r((()=>this.analysisViewData.computations),(({computation:e})=>this._createVisualization(e)));this._dimensionVisualizations=s,this.addHandles([a(s),n((()=>i.toUnitRGBA(this.analysis.style.color)),(e=>{for(const i of this._lineMaterials())i.setParameters({color:e})}),o),n((()=>this.analysis.style.lineSize),(e=>{const i=c(e);this._markerMaterial.setParameters({width:i*f}),this._dimensionLineMaterial.setParameters({width:i,markerParameters:this._markerMaterial.parameters});const s=Math.max(i*g,1);this._offsetLineMaterial.setParameters({width:s})}),o),n((()=>({camera:this.view.state.camera,style:z(this.analysis)})),(({camera:e,style:i})=>{for(const{visualization:s}of this._dimensionVisualizations)s.updateCameraDependentElements(e,s.computation.geometry,i),s.updateLabelStyle(i)})),n((()=>this.visible),(e=>{for(const{visualization:i}of this._dimensionVisualizations)i.visible=e}))]),this.addHandles([L((()=>this._updateMessageBundle())),l((()=>!this.loadingMessages),(()=>{for(const{visualization:e}of this._dimensionVisualizations)e.updateUnitsMessages(this._messages)}),m)]),this._updateMessageBundle()}get testInfo(){return{visualizations:this._dimensionVisualizations.items.map((({visualization:e})=>e)),disablePartialOcclusion:()=>{for(const e of this._lineMaterials())e.setParameters({renderOccluded:M.Occlude})}}}_createVisualization(e){const i=new u({analysis:this.analysis,computation:e,view:this.view,visible:this.visible,markerMaterial:this._markerMaterial,dimensionLineMaterial:this._dimensionLineMaterial,offsetLineMaterial:this._offsetLineMaterial,smallDimensionLineMaterial:this._smallDimensionLineMaterial,smallOffsetLineMaterial:this._smallOffsetLineMaterial,messages:this._messages,isDecoration:this.isDecoration});return{visualization:i,remove:()=>i.destroy()}}_lineMaterials(){return[this._markerMaterial,this._dimensionLineMaterial,this._offsetLineMaterial,this._smallDimensionLineMaterial,this._smallOffsetLineMaterial]}async _updateMessageBundle(){this.loadingMessages=!0;try{this._messages=await j("esri/core/t9n/Units")}finally{this.loadingMessages=!1}}};function z(e){const{fontSize:i,lineSize:s,textColor:t,textBackgroundColor:a}=e.style;return{fontSize:i,lineSize:s,textBackgroundColor:a.clone(),textColor:t.clone()}}e([d({constructOnly:!0})],b.prototype,"analysisViewData",void 0),e([d({constructOnly:!0,nonNullable:!0})],b.prototype,"view",void 0),e([d({constructOnly:!0})],b.prototype,"isDecoration",void 0),e([d()],b.prototype,"analysis",null),e([d()],b.prototype,"visible",null),e([d()],b.prototype,"loadingMessages",void 0),b=e([h("esri.views.3d.analysis.Dimension.DimensionVisualization")],b);export{b as DimensionVisualization};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Color.js";import"../../../../geometry.js";import{LengthDimensionMeasureType as i}from"../../../../analysis/dimensionUtils.js";import n from"../../../../analysis/LengthDimension.js";import a from"../../../../core/Accessor.js";import s from"../../../../core/Handles.js";import{destroyHandle as o}from"../../../../core/handleUtils.js";import{equals as r}from"../../../../core/lang.js";import{destroyMaybe as p}from"../../../../core/maybe.js";import{memoize as l}from"../../../../core/memoize.js";import{ignoreAbortErrors as u}from"../../../../core/promiseUtils.js";import{mapCollection as d,watch as c,sync as m,syncAndInitial as h,initial as g,when as f}from"../../../../core/reactiveUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as M}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as y}from"../../../../chunks/vec3f64.js";import{UpdatingHandles as v}from"../../../../core/support/UpdatingHandles.js";import{clonePoint as S}from"../../../../layers/graphics/hydratedFeatures.js";import{reapplyConstraint as C,LengthDimensionConstraint as w,applyConstraint as b,computeConstraint as D,constraintDependencies as O}from"./lengthDimensionConstraintUtils.js";import{LengthDimensionManipulators as P,createPointManipulator as j,pointManipulatorHandles as H,createOffsetManipulator as T,offsetManipulatorHandles as G,createOrientationManipulator as I,headingManipulatorHandles as z,rotationManipulatorHandles as x,createMeasureTypeManipulator as U,measureTypeManipulatorHandles as V,updateOffsetManipulatorTransform as R,updateHeadingManipulatorTransform as A,updateRotationManipulatorTransform as k,updateMeasureTypeManipulatorTransform as E,updateOrientationManipulator as F,unfocusedOffsetWidth as L,focusedOffsetWidth as q}from"./lengthDimensionManipulatorUtils.js";import{isValidComputation as B,arePointsVerticallyAligned as N,computeGeometryFromDimension as J,computationToGeometryDependencies as K}from"./lengthDimensionUtils.js";import{Settings as Q}from"./settings.js";import{getRotateHeadingTexture as W}from"../images/Factory.js";import{SnappingVisualizer3D as X}from"../../interactive/SnappingVisualizer3D.js";import{LineVisualElement as Y}from"../../interactive/visualElements/LineVisualElement.js";import{VerticesVisualElement as Z}from"../../interactive/visualElements/VerticesVisualElement.js";import{RenderOccludedFlag as $}from"../../webgl-engine/lib/Material.js";import{ImageMaterial as tt}from"../../webgl-engine/materials/ImageMaterial.js";import{createStipplePatternSimple as et}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as it}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createCoordinateHelper as nt}from"../../../interactive/coordinateHelper.js";import{EditGeometry as at}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as st}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{acquire as ot}from"../../../interactive/snapping/SceneSnappingManagerPool.js";import{SnappingContext as rt}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as pt}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as lt}from"../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as ut}from"../../../interactive/snapping/snappingUtils.js";import dt from"../../../../geometry/Point.js";let ct=class extends a{constructor(t){super(t),this._stagedDimension=null,this._computationManipulators=new Map,this._computationHandles=new s,this._updatingHandles=new v,this._getSnappingContext=l((t=>new rt({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new st(new at("point",nt(!0,!1,this.view.spatialReference))),visualizer:new X})));const{view:i}=t;this._settings=new Q(i.effectiveTheme),this._snappingManagerResult=ot(i),this.addHandles(this._snappingManagerResult),this._unfocusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._focusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial.setParameters({stipplePattern:et(2)}),this._constraintSnappingIndicator=new Y({view:i,attached:!0,width:1,color:e.toUnitRGBA(this._settings.constraint.color),renderOccluded:$.OccludeAndTransparent,stipplePattern:et(5),isDecoration:!0});const n=e.toUnitRGBA(this._settings.disabledPointIndicator.color);this._stagedStartIndicator=new Z({view:i,attached:!1,elevationInfo:{mode:"absolute-height",offset:0},spatialReference:t.view.renderCoordsHelper.spatialReference,color:n,size:2*this._settings.disabledPointIndicator.radius,outlineSize:0,renderOccluded:$.OccludeAndTransparent,isDecoration:!0})}initialize(){this._snappingOperation=new lt({view:this.view});const{color:t,contrastColor:e}=this._settings.orientationManipulator,i=!this.view._stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this._orientationManipulatorTexture=W(this.view.toolViewManager.textures,{accentColor:t,contrastColor:e,preMultiplyAlpha:i}),this._orientationManipulatorMaterial=new tt({transparent:!0,writeDepth:!1,textureId:this._orientationManipulatorTexture.texture.id,renderOccluded:$.Opaque,isDecoration:!0});const n=d((()=>this.analysisViewData.computations),(({computation:t})=>this._createManipulators(t)));this.addHandles(o(n)),this.addHandles([c((()=>({stagedPoint:this._snappingOperation.stagedPoint,stagedComputation:this._stagedComputation})),(({stagedPoint:t,stagedComputation:e})=>{if(null==e||null==t)return;const i=S(t,new dt);this._applyPointUpdate(e,{endPoint:i})}),m),c((()=>({stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator})),((t,e)=>{const{stagedDimension:i,selectedComputation:n,firstGrabbedManipulator:a}=t;if(i===e?.stagedDimension&&a===e?.firstGrabbedManipulator){for(const s of[n,e?.selectedComputation])if(null!=s){const e=this._computationManipulators.get(s);null!=e&&this._updateManipulators(s,e,t)}}else for(const[s,o]of this._computationManipulators)this._updateManipulators(s,o,t)}),h),c((()=>this.analysis.style.lineSize),(t=>{this._updateManipulatorStyle(t)}),g),c((()=>this.view.state.camera),(()=>{null!=this._stagedComputation&&this._updateStagedDimensionOffset(this._stagedComputation)})),c((()=>{const t=this._stagedComputation;if(!t)return null;const e=t.elevationAlignedStartPoint,i=y();return null!=e&&this.view.renderCoordsHelper.toRenderCoords(e,i)?i:null}),(t=>{null!=t?(this._stagedStartIndicator.vertices=[t],this._stagedStartIndicator.attached=!0):this._stagedStartIndicator.attached=!1}))]),this.addHandles(this._constraintHandles),this.addHandles(this._snappingIndicatorHandles),ut(this,(()=>{const t=this._activeComputation,e=this._stagedComputation;if(null==t||null!=e){const t=this.view.inputManager.latestPointerType??"mouse",e=this._getSnappingContext(t);this._updatingHandles.addPromise(u(this._snappingOperation.resnap(this._snappingManager,e)))}if(null!=t){const{start:e,end:i}=this._computationManipulators.get(t);if(e.grabbing||i.grabbing){const i=e.grabbing?"start":"end",n=this._computeConstraint(t);C(t,i,{constraint:n,view:this.view})}}}))}destroy(){this._snappingOperation=p(this._snappingOperation),this._computationHandles.destroy(),this._constraintSnappingIndicator.destroy(),this._stagedStartIndicator.destroy(),this._orientationManipulatorTexture.release()}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}get firstGrabbedManipulator(){return this.parentTool.firstGrabbedManipulator}get hasGrabbedManipulators(){return this.parentTool.hasGrabbedManipulators}get snappingOptions(){return this._snappingManager.options}get _snappingManager(){return this._snappingManagerResult.snappingManager}get _activeComputation(){if(null!=this._stagedComputation)return this._stagedComputation;const{selectedComputation:t}=this.analysisViewData;return this.hasGrabbedManipulators&&null!=t?t:null}get _stagedComputation(){const t=this._stagedDimension,e=this.analysisViewData.computations.at(-1)?.computation;return null==t||null==e||e.dimension!==t?null:e}get _constraintHandles(){return[f((()=>this.analysisViewData.selectedComputation),(t=>{t.previousConstraint=this._computeConstraint(t)}),{...h,equals:r}),c((()=>{const t=this._activeComputation;if(null==t)return null;const{measureType:e,orientation:i}=t.dimension;return{measureType:e,orientation:i,computation:t}}),((t,e)=>{if(null!=t&&null==e){const{measureType:e,orientation:n,computation:a}=t;switch(a.previousConstraint){case w.Horizontal:a.preConstraintProperties={measureType:i.Horizontal,orientation:0};break;case w.Vertical:a.preConstraintProperties={measureType:i.Vertical,orientation:0};break;case w.Direct:a.preConstraintProperties={measureType:i.Direct,orientation:n};break;default:a.preConstraintProperties={measureType:e,orientation:n}}}null==t&&null!=e&&(e.computation.preConstraintProperties=null)}),m)]}get _snappingIndicatorHandles(){const t="snapping-indicator-event-handles";return[c((()=>({stagedComputation:this._stagedComputation,activeComputation:this._activeComputation})),(({stagedComputation:e,activeComputation:i})=>{const n=this._constraintSnappingIndicator;if(this.removeHandles(t),null!=i)if(i===e)n.attached=!0;else{const{start:e,end:a}=this._computationManipulators.get(i),s=()=>{n.attached=e.grabbing||a.grabbing};s(),this.addHandles([e.events.on("grab-changed",s),a.events.on("grab-changed",s)],t)}else n.attached=!1})),c((()=>{const t=this._activeComputation;return null!=t?{geometry:t.geometry,constraint:t.previousConstraint}:{}}),(({geometry:t,constraint:e})=>{const i=this._constraintSnappingIndicator;null!=t&&null!=e&&e!==w.Direct?(i.visible=!0,i.setGeometryFromSegment(t.directSegment)):i.visible=!1}))]}removeStaged(){return null!=this._stagedDimension&&(this.analysis.dimensions.remove(this._stagedDimension),this._stagedDimension=null,!0)}onDeactivate(){this.removeStaged(),this._resetSnappingState()}onClick(t){const{_stagedDimension:e}=this;if(null==e){const e=this._onUnstagedClick(t);return this.analysis.dimensions.add(e),null}return this._onStagedClick(t),e}onPointerMove({mapPoint:t,pointerType:e}){if("touch"===e)return;const i=this._getSnappingContext(e);this._updatingHandles.addPromise(u(this._snappingOperation.snap({point:t},this._snappingManager,i)))}onManipulatorSelectionChanged(){if(null!=this.analysisViewData.selectedComputation){this._computationManipulators.get(this.analysisViewData.selectedComputation).offset.selected||(this.analysisViewData.selectedDimension=null)}}_onUnstagedClick({mapPoint:t,pointerType:e}){let a=t;if("mouse"===e){const i=this._getSnappingContext(e);a=this._snappingManager.update({point:t,context:i})}const s=new n({startPoint:S(a,new dt),endPoint:null,measureType:i.Horizontal});return this._stagedDimension=s,this._resetSnappingState(),s}_onStagedClick({mapPoint:t,pointerType:e}){const i=this._stagedComputation;if(null==i)return;let n=t;if("mouse"===e){const i=this._getSnappingContext(e);n=this._snappingManager.update({point:t,context:i})}const a=S(n,new dt);this._applyPointUpdate(i,{endPoint:a}),this._stagedDimension=null,this._resetSnappingState()}_resetSnappingState(){this._snappingManager.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}_createManipulators(t){const e=this._setupPointManipulator(t,{isStart:!0}),n=this._setupPointManipulator(t,{isStart:!1}),a=this._setupOffsetManipulator(t),s=this._setupHeadingManipulator(t),o=this._setupRotationManipulator(t),r=this._setupMeasureTypeManipulator(t,i.Direct),p=this._setupMeasureTypeManipulator(t,i.Horizontal),l=this._setupMeasureTypeManipulator(t,i.Vertical),u=new P({start:e,end:n,offset:a,heading:s,rotation:o,direct:r,horizontal:p,vertical:l});return this._setupComputationToManipulatorsSync(t,u),this._computationManipulators.set(t,u),this.manipulators.addMany(u.values()),{manipulators:u,remove:()=>{this._computationHandles.remove(t),this._computationManipulators.delete(t);for(const t of u.values())this.manipulators.remove(t)}}}_setupComputationToManipulatorsSync(t,e){this._computationHandles.add([c((()=>t.geometry),(()=>this._updateManipulators(t,e)),{...h,equals:r})],t)}_setupPointManipulator(t,e){const{view:i}=this,{dimension:n}=t,a=j(i,{metadata:n}),s=H(a,{isStart:e.isStart,createSnappingPipelineStep:t=>pt({snappingContext:this._getSnappingContext(t),snappingManager:this._snappingManager,updatingHandles:this._updatingHandles}),dimension:n,onUpdate:e=>this._applyPointUpdate(t,e),view:i});return this._computationHandles.add(s,t),a}_setupOffsetManipulator(t){const{view:e}=this,i=T(e,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,metadata:t.dimension}),n=G(i,{computation:t,view:e});return this._computationHandles.add(n,t),i}_setupHeadingManipulator(t){const{view:e}=this,i=I(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),n=z(i,{computation:t,view:e});return this._computationHandles.add(n,t),i}_setupRotationManipulator(t){const{view:e}=this,i=I(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),n=x(i,{computation:t,view:e});return this._computationHandles.add(n,t),i}_setupMeasureTypeManipulator(t,e){const{view:i}=this,n=U(i,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,thinOffsetManipulatorMaterial:this._thinOffsetManipulatorMaterial,metadata:t.dimension}),a=V(n,{computation:t,manipulatorMeasureType:e,view:i});return this._computationHandles.add(a,t),n}_updateManipulators(t,e,n={stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}){const{stagedDimension:a,selectedComputation:s,firstGrabbedManipulator:o}=n,{start:r,end:p,offset:l,heading:u,rotation:d}=e,c=s===t,m=B(t),{dimension:h}=t;for(const i of e.values()){const t=m&&null==a&&(null==o||i===o);i===l?(i.available=t,i.selected=c):i.available=t&&c}if(!m)return;null!=this._computeConstraint(t)?e.forEachMeasureTypeManipulator((t=>t.available=!1)):e.manipulatorForMeasureType(h.measureType).available=!1;for(const _ of[u,d])h.measureType===i.Direct&&0!==h.offset||(_.available=!1);N(t)?d.available=!1:u.available=!1;const{geometry:g}=t;r.renderLocation=g.directSegment.startRenderSpace,p.renderLocation=g.directSegment.endRenderSpace;const{renderCoordsHelper:f}=this.view;R(l,g,f),u.available&&A(u,t,f),d.available&&k(d,t,f),e.forEachMeasureTypeManipulator(((e,i)=>{e.available&&E(e,t,i,f)}))}_updateManipulatorStyle(t){const e=L(t),i=q(t),n={lineSizePt:t,material:this._orientationManipulatorMaterial};for(const{offset:a,heading:s,rotation:o}of this._computationManipulators.values())a.radius=i/2,F(this.view,s,n),F(this.view,o,n);this._unfocusedOffsetManipulatorMaterial.setParameters({width:e}),this._focusedOffsetManipulatorMaterial.setParameters({width:i})}_applyPointUpdate(t,e){const{view:i}=this,n=K(t);"startPoint"in e&&(n.elevationAlignedStartPoint=e.startPoint),"endPoint"in e&&(n.elevationAlignedEndPoint=e.endPoint);const a=J(n,i.renderCoordsHelper);if(null==a)return;const s=this._computeConstraint({...n,geometry:a});b(t,e,{...n,constraint:s,unconstrainedGeometry:a,view:i}),t===this._stagedComputation&&this._updateStagedDimensionOffset(t)}_updateStagedDimensionOffset(t){if(null==t.geometry)return;t.geometry.directSegment.eval(.5,mt);const e=this.view.state.camera.computeRenderPixelSizeAt(mt);t.dimension.offset=this._settings.initialOffsetPx*e}_computeConstraint(t){return D(O(t,this._snappingManager.options),this.view)}_createOffsetManipulatorMaterial(){const{color:t}=this._settings.offsetManipulator;return new it({color:e.toUnitRGBA(t),width:1,renderOccluded:$.OccludeAndTransparent,writeDepth:!1,hasPolygonOffset:!0,isDecoration:!0})}get testInfo(){const t=t=>this.analysisViewData.computations.find((({computation:e})=>e.dimension===t))?.computation;return{disableManipulatorPartialOcclusion:()=>{this._stagedStartIndicator.renderOccluded=$.Occlude,this.manipulators.forEach((({manipulator:t})=>{for(const{geometry:e}of t.renderObjects)e.material.setParameters({renderOccluded:$.Occlude})}))},getManipulatorsForDimension:e=>this._computationManipulators.get(t(e)),getComputationForDimension:e=>t(e),getConstraintForDimension:e=>{const i=t(e);return null!=i?this._computeConstraint(i):null},stagedDimension:this._stagedDimension,stagedStartIndicator:this._stagedStartIndicator,constraintSnappingIndicator:this._constraintSnappingIndicator,snappingManager:this._snappingManager}}};t([_({constructOnly:!0})],ct.prototype,"analysis",void 0),t([_({constructOnly:!0})],ct.prototype,"analysisViewData",void 0),t([_({constructOnly:!0})],ct.prototype,"manipulators",void 0),t([_({constructOnly:!0})],ct.prototype,"parentTool",void 0),t([_({constructOnly:!0,nonNullable:!0})],ct.prototype,"view",void 0),t([_({readOnly:!0})],ct.prototype,"updating",null),t([_()],ct.prototype,"firstGrabbedManipulator",null),t([_()],ct.prototype,"hasGrabbedManipulators",null),t([_()],ct.prototype,"snappingOptions",null),t([_()],ct.prototype,"_stagedDimension",void 0),t([_()],ct.prototype,"_activeComputation",null),t([_()],ct.prototype,"_stagedComputation",null),ct=t([M("esri.views.3d.analysis.Dimension.LengthDimensionSubTool")],ct);const mt=y();export{ct as LengthDimensionSubTool};
5
+ import{_ as t}from"../../../../chunks/tslib.es6.js";import e from"../../../../Color.js";import"../../../../geometry.js";import{LengthDimensionMeasureType as i}from"../../../../analysis/dimensionUtils.js";import a from"../../../../analysis/LengthDimension.js";import n from"../../../../core/Accessor.js";import s from"../../../../core/Handles.js";import{destroyHandle as o}from"../../../../core/handleUtils.js";import{equals as r}from"../../../../core/lang.js";import{destroyMaybe as p}from"../../../../core/maybe.js";import{memoize as l}from"../../../../core/memoize.js";import{ignoreAbortErrors as u}from"../../../../core/promiseUtils.js";import{watch as d,initial as c,mapCollection as m,sync as h,syncAndInitial as g,when as f}from"../../../../core/reactiveUtils.js";import{property as _}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import{subclass as M}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as y}from"../../../../chunks/vec3f64.js";import{UpdatingHandles as v}from"../../../../core/support/UpdatingHandles.js";import{clonePoint as C}from"../../../../layers/graphics/hydratedFeatures.js";import{reapplyConstraint as S,LengthDimensionConstraint as w,applyConstraint as b,computeConstraint as O,constraintDependencies as P}from"./lengthDimensionConstraintUtils.js";import{LengthDimensionManipulators as D,LengthDimensionPointManipulator as j,pointManipulatorHandles as H,createOffsetManipulator as T,offsetManipulatorHandles as G,LineOfSightOrientationManipulator as z,headingManipulatorHandles as I,rotationManipulatorHandles as x,createMeasureTypeManipulator as V,measureTypeManipulatorHandles as U,updateOffsetManipulatorTransform as R,updateHeadingManipulatorTransform as A,updateRotationManipulatorTransform as k,updateMeasureTypeManipulatorTransform as E,unfocusedOffsetWidth as F,focusedOffsetWidth as L}from"./lengthDimensionManipulatorUtils.js";import{isValidComputation as q,arePointsVerticallyAligned as B,computeGeometryFromDimension as N,computationToGeometryDependencies as J}from"./lengthDimensionUtils.js";import{disabledPointColor as K,pointRadius as Q,getTransparentAccentColor as W,getContrastColor as X,initialOffsetPx as Y}from"./settings.js";import{getRotateHeadingTexture as Z}from"../images/Factory.js";import{SnappingVisualizer3D as $}from"../../interactive/SnappingVisualizer3D.js";import{LineVisualElement as tt}from"../../interactive/visualElements/LineVisualElement.js";import{VerticesVisualElement as et}from"../../interactive/visualElements/VerticesVisualElement.js";import{RenderOccludedFlag as it}from"../../webgl-engine/lib/Material.js";import{ImageMaterial as at}from"../../webgl-engine/materials/ImageMaterial.js";import{createStipplePatternSimple as nt}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as st}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createCoordinateHelper as ot}from"../../../interactive/coordinateHelper.js";import{EditGeometry as rt}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as pt}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{acquire as lt}from"../../../interactive/snapping/SceneSnappingManagerPool.js";import{SnappingContext as ut}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as dt}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as ct}from"../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as mt}from"../../../interactive/snapping/snappingUtils.js";import ht from"../../../../geometry/Point.js";let gt=class extends n{constructor(t){super(t),this._stagedDimension=null,this._computationManipulators=new Map,this._computationHandles=new s,this._orientationManipulatorTexture=null,this._updatingHandles=new v,this._getSnappingContext=l((t=>new ut({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new pt(new rt("point",ot(!0,!1,this.view.spatialReference))),visualizer:new $})));const{view:i}=t;this._snappingManagerResult=lt(i),this.addHandles(this._snappingManagerResult),this._unfocusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._focusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(),this._thinOffsetManipulatorMaterial.setParameters({stipplePattern:nt(2)}),this._constraintSnappingIndicator=new tt({view:i,attached:!0,width:1,renderOccluded:it.OccludeAndTransparent,stipplePattern:nt(5),isDecoration:!0});const a=e.toUnitRGBA(K);this._stagedStartIndicator=new et({view:i,attached:!1,elevationInfo:{mode:"absolute-height",offset:0},spatialReference:t.view.renderCoordsHelper.spatialReference,color:a,size:2*Q,outlineSize:0,renderOccluded:it.OccludeAndTransparent,isDecoration:!0})}initialize(){const{view:t}=this;this._snappingOperation=new ct({view:t});const i=!t._stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this._orientationManipulatorMaterial=new at({transparent:!0,writeDepth:!1,renderOccluded:it.Opaque,isDecoration:!0}),this.addHandles(d((()=>({accentColor:W(t.effectiveTheme),contrastColor:X(t.effectiveTheme)})),(({accentColor:a,contrastColor:n})=>{const s=this._orientationManipulatorTexture,o=Z(t.toolViewManager.textures,{accentColor:a,contrastColor:n,preMultiplyAlpha:i});this._orientationManipulatorMaterial.setParameters({textureId:o.texture.id}),this._orientationManipulatorTexture=o,s?.release();const r=e.toUnitRGBA(a);this._unfocusedOffsetManipulatorMaterial.setParameters({color:r}),this._focusedOffsetManipulatorMaterial.setParameters({color:r}),this._thinOffsetManipulatorMaterial.setParameters({color:r}),this._constraintSnappingIndicator.color=r}),c));const a=m((()=>this.analysisViewData.computations),(({computation:t})=>this._createManipulators(t)));this.addHandles(o(a)),this.addHandles([d((()=>({stagedPoint:this._snappingOperation.stagedPoint,stagedComputation:this._stagedComputation})),(({stagedPoint:t,stagedComputation:e})=>{if(null==e||null==t)return;const i=C(t,new ht);this._applyPointUpdate(e,{endPoint:i})}),h),d((()=>({stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator})),((t,e)=>{const{stagedDimension:i,selectedComputation:a,firstGrabbedManipulator:n}=t;if(i===e?.stagedDimension&&n===e?.firstGrabbedManipulator){for(const s of[a,e?.selectedComputation])if(null!=s){const e=this._computationManipulators.get(s);null!=e&&this._updateManipulators(s,e,t)}}else for(const[s,o]of this._computationManipulators)this._updateManipulators(s,o,t)}),g),d((()=>this.analysis.style.lineSize),(t=>{this._updateManipulatorStyle(t)}),c),d((()=>this.view.state.camera),(()=>{null!=this._stagedComputation&&this._updateStagedDimensionOffset(this._stagedComputation)})),d((()=>{const t=this._stagedComputation;if(!t)return null;const e=t.elevationAlignedStartPoint,i=y();return null!=e&&this.view.renderCoordsHelper.toRenderCoords(e,i)?i:null}),(t=>{null!=t?(this._stagedStartIndicator.vertices=[t],this._stagedStartIndicator.attached=!0):this._stagedStartIndicator.attached=!1}))]),this.addHandles(this._constraintHandles),this.addHandles(this._snappingIndicatorHandles),mt(this,(()=>{const t=this._activeComputation,e=this._stagedComputation;if(null==t||null!=e){const t=this.view.inputManager.latestPointerType??"mouse",e=this._getSnappingContext(t);this._updatingHandles.addPromise(u(this._snappingOperation.resnap(this._snappingManager,e)))}if(null!=t){const{start:e,end:i}=this._computationManipulators.get(t);if(e.grabbing||i.grabbing){const i=e.grabbing?"start":"end",a=this._computeConstraint(t);S(t,i,{constraint:a,view:this.view})}}}))}destroy(){this._snappingOperation=p(this._snappingOperation),this._computationHandles.destroy(),this._constraintSnappingIndicator.destroy(),this._stagedStartIndicator.destroy(),this._orientationManipulatorTexture?.release()}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}get firstGrabbedManipulator(){return this.parentTool.firstGrabbedManipulator}get hasGrabbedManipulators(){return this.parentTool.hasGrabbedManipulators}get snappingOptions(){return this._snappingManager.options}get _snappingManager(){return this._snappingManagerResult.snappingManager}get _activeComputation(){if(null!=this._stagedComputation)return this._stagedComputation;const{selectedComputation:t}=this.analysisViewData;return this.hasGrabbedManipulators&&null!=t?t:null}get _stagedComputation(){const t=this._stagedDimension,e=this.analysisViewData.computations.at(-1)?.computation;return null==t||null==e||e.dimension!==t?null:e}get _constraintHandles(){return[f((()=>this.analysisViewData.selectedComputation),(t=>{t.previousConstraint=this._computeConstraint(t)}),{...g,equals:r}),d((()=>{const t=this._activeComputation;if(null==t)return null;const{measureType:e,orientation:i}=t.dimension;return{measureType:e,orientation:i,computation:t}}),((t,e)=>{if(null!=t&&null==e){const{measureType:e,orientation:a,computation:n}=t;switch(n.previousConstraint){case w.Horizontal:n.preConstraintProperties={measureType:i.Horizontal,orientation:0};break;case w.Vertical:n.preConstraintProperties={measureType:i.Vertical,orientation:0};break;case w.Direct:n.preConstraintProperties={measureType:i.Direct,orientation:a};break;default:n.preConstraintProperties={measureType:e,orientation:a}}}null==t&&null!=e&&(e.computation.preConstraintProperties=null)}),h)]}get _snappingIndicatorHandles(){const t="snapping-indicator-event-handles";return[d((()=>({stagedComputation:this._stagedComputation,activeComputation:this._activeComputation})),(({stagedComputation:e,activeComputation:i})=>{const a=this._constraintSnappingIndicator;if(this.removeHandles(t),null!=i)if(i===e)a.attached=!0;else{const{start:e,end:n}=this._computationManipulators.get(i),s=()=>{a.attached=e.grabbing||n.grabbing};s(),this.addHandles([e.events.on("grab-changed",s),n.events.on("grab-changed",s)],t)}else a.attached=!1})),d((()=>{const t=this._activeComputation;return null!=t?{geometry:t.geometry,constraint:t.previousConstraint}:{}}),(({geometry:t,constraint:e})=>{const i=this._constraintSnappingIndicator;null!=t&&null!=e&&e!==w.Direct?(i.visible=!0,i.setGeometryFromSegment(t.directSegment)):i.visible=!1}))]}removeStaged(){return null!=this._stagedDimension&&(this.analysis.dimensions.remove(this._stagedDimension),this._stagedDimension=null,!0)}onDeactivate(){this.removeStaged(),this._resetSnappingState()}onClick(t){const{_stagedDimension:e}=this;if(null==e){const e=this._onUnstagedClick(t);return this.analysis.dimensions.add(e),null}return this._onStagedClick(t),e}onPointerMove({mapPoint:t,pointerType:e}){if("touch"===e)return;const i=this._getSnappingContext(e);this._updatingHandles.addPromise(u(this._snappingOperation.snap({point:t},this._snappingManager,i)))}onManipulatorSelectionChanged(){if(null!=this.analysisViewData.selectedComputation){this._computationManipulators.get(this.analysisViewData.selectedComputation).offset.selected||(this.analysisViewData.selectedDimension=null)}}_onUnstagedClick({mapPoint:t,pointerType:e}){let n=t;if("mouse"===e){const i=this._getSnappingContext(e);n=this._snappingManager.update({point:t,context:i})}const s=new a({startPoint:C(n,new ht),endPoint:null,measureType:i.Horizontal});return this._stagedDimension=s,this._resetSnappingState(),s}_onStagedClick({mapPoint:t,pointerType:e}){const i=this._stagedComputation;if(null==i)return;let a=t;if("mouse"===e){const i=this._getSnappingContext(e);a=this._snappingManager.update({point:t,context:i})}const n=C(a,new ht);this._applyPointUpdate(i,{endPoint:n}),this._stagedDimension=null,this._resetSnappingState()}_resetSnappingState(){this._snappingManager.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}_createManipulators(t){const e=this._setupPointManipulator(t,{isStart:!0}),a=this._setupPointManipulator(t,{isStart:!1}),n=this._setupOffsetManipulator(t),s=this._setupHeadingManipulator(t),o=this._setupRotationManipulator(t),r=this._setupMeasureTypeManipulator(t,i.Direct),p=this._setupMeasureTypeManipulator(t,i.Horizontal),l=this._setupMeasureTypeManipulator(t,i.Vertical),u=new D({start:e,end:a,offset:n,heading:s,rotation:o,direct:r,horizontal:p,vertical:l});return this._setupComputationToManipulatorsSync(t,u),this._computationManipulators.set(t,u),this.manipulators.addMany(u.values()),{manipulators:u,remove:()=>{this._computationHandles.remove(t),this._computationManipulators.delete(t);for(const t of u.values())this.manipulators.remove(t)}}}_setupComputationToManipulatorsSync(t,e){this._computationHandles.add([d((()=>t.geometry),(()=>this._updateManipulators(t,e)),{...g,equals:r})],t)}_setupPointManipulator(t,e){const{view:i}=this,{dimension:a}=t,n=new j(i,{metadata:a}),s=H(n,{isStart:e.isStart,createSnappingPipelineStep:t=>dt({snappingContext:this._getSnappingContext(t),snappingManager:this._snappingManager,updatingHandles:this._updatingHandles}),dimension:a,onUpdate:e=>this._applyPointUpdate(t,e),view:i});return this._computationHandles.add(s,t),n}_setupOffsetManipulator(t){const{view:e}=this,i=T(e,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,metadata:t.dimension}),a=G(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupHeadingManipulator(t){const{view:e}=this,i=new z(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),a=I(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupRotationManipulator(t){const{view:e}=this,i=new z(e,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:t.dimension}),a=x(i,{computation:t,view:e});return this._computationHandles.add(a,t),i}_setupMeasureTypeManipulator(t,e){const{view:i}=this,a=V(i,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,thinOffsetManipulatorMaterial:this._thinOffsetManipulatorMaterial,metadata:t.dimension}),n=U(a,{computation:t,manipulatorMeasureType:e,view:i});return this._computationHandles.add(n,t),a}_updateManipulators(t,e,a={stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}){const{stagedDimension:n,selectedComputation:s,firstGrabbedManipulator:o}=a,{start:r,end:p,offset:l,heading:u,rotation:d}=e,c=s===t,m=q(t),{dimension:h}=t;for(const i of e.values()){const t=m&&null==n&&(null==o||i===o);i===l?(i.available=t,i.selected=c):i.available=t&&c}if(!m)return;null!=this._computeConstraint(t)?e.forEachMeasureTypeManipulator((t=>t.available=!1)):e.manipulatorForMeasureType(h.measureType).available=!1;for(const _ of[u,d])h.measureType===i.Direct&&0!==h.offset||(_.available=!1);B(t)?d.available=!1:u.available=!1;const{geometry:g}=t;r.renderLocation=g.directSegment.startRenderSpace,p.renderLocation=g.directSegment.endRenderSpace;const{renderCoordsHelper:f}=this.view;R(l,g,f),u.available&&A(u,t,f),d.available&&k(d,t,f),e.forEachMeasureTypeManipulator(((e,i)=>{e.available&&E(e,t,i,f)}))}_updateManipulatorStyle(t){const e=F(t),i=L(t),a={lineSizePt:t,material:this._orientationManipulatorMaterial};for(const{offset:n,heading:s,rotation:o}of this._computationManipulators.values())n.radius=i/2,s.update(a),o.update(a);this._unfocusedOffsetManipulatorMaterial.setParameters({width:e}),this._focusedOffsetManipulatorMaterial.setParameters({width:i})}_applyPointUpdate(t,e){const{view:i}=this,a=J(t);"startPoint"in e&&(a.elevationAlignedStartPoint=e.startPoint),"endPoint"in e&&(a.elevationAlignedEndPoint=e.endPoint);const n=N(a,i.renderCoordsHelper);if(null==n)return;const s=this._computeConstraint({...a,geometry:n});b(t,e,{...a,constraint:s,unconstrainedGeometry:n,view:i}),t===this._stagedComputation&&this._updateStagedDimensionOffset(t)}_updateStagedDimensionOffset(t){if(null==t.geometry)return;t.geometry.directSegment.eval(.5,ft);const e=this.view.state.camera.computeRenderPixelSizeAt(ft);t.dimension.offset=Y*e}_computeConstraint(t){return O(P(t,this._snappingManager.options),this.view)}_createOffsetManipulatorMaterial(){return new st({width:1,renderOccluded:it.OccludeAndTransparent,writeDepth:!1,hasPolygonOffset:!0,isDecoration:!0})}get testInfo(){const t=t=>this.analysisViewData.computations.find((({computation:e})=>e.dimension===t))?.computation;return{disableManipulatorPartialOcclusion:()=>{this._stagedStartIndicator.renderOccluded=it.Occlude,this.manipulators.forEach((({manipulator:t})=>{for(const{geometry:e}of t.renderObjects)e.material.setParameters({renderOccluded:it.Occlude})}))},getManipulatorsForDimension:e=>this._computationManipulators.get(t(e)),getComputationForDimension:e=>t(e),getConstraintForDimension:e=>{const i=t(e);return null!=i?this._computeConstraint(i):null},stagedDimension:this._stagedDimension,stagedStartIndicator:this._stagedStartIndicator,constraintSnappingIndicator:this._constraintSnappingIndicator,snappingManager:this._snappingManager}}};t([_({constructOnly:!0})],gt.prototype,"analysis",void 0),t([_({constructOnly:!0})],gt.prototype,"analysisViewData",void 0),t([_({constructOnly:!0})],gt.prototype,"manipulators",void 0),t([_({constructOnly:!0})],gt.prototype,"parentTool",void 0),t([_({constructOnly:!0,nonNullable:!0})],gt.prototype,"view",void 0),t([_({readOnly:!0})],gt.prototype,"updating",null),t([_()],gt.prototype,"firstGrabbedManipulator",null),t([_()],gt.prototype,"hasGrabbedManipulators",null),t([_()],gt.prototype,"snappingOptions",null),t([_()],gt.prototype,"_stagedDimension",void 0),t([_()],gt.prototype,"_activeComputation",null),t([_()],gt.prototype,"_stagedComputation",null),gt=t([M("esri.views.3d.analysis.Dimension.LengthDimensionSubTool")],gt);const ft=y();export{gt as LengthDimensionSubTool};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Handles.js";import{equals as t}from"../../../../core/lang.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{formatDecimal as i}from"../../../../core/quantityFormatUtils.js";import{watch as n,initial as l}from"../../../../core/reactiveUtils.js";import{pt2px as a}from"../../../../core/screenUtils.js";import{c as o}from"../../../../chunks/vec3f64.js";import{computeSpanningSegment as m,OffsetSegmentLocation as r,maxScreenLengthSquaredFromGeometry as f,offsetSegment as d}from"./lengthDimensionUtils.js";import{Settings as h}from"./settings.js";import{LabelVisualElement as c}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as u}from"../../interactive/visualElements/LineVisualElement.js";import{MarkerVisualElement as S}from"../../interactive/visualElements/MarkerVisualElement.js";import{EuclideanSegment as g}from"../../interactive/visualElements/support/Segment.js";class v{set visible(e){for(const t of this._visualElements.values())t.attached=e}constructor(s){this.destroyed=!1,this._handles=new e,this._messages=null,this._labelSegment=new g;const{analysis:i,computation:o,view:m,messages:r,isDecoration:f}=s;this.analysis=i,this.computation=o,this.view=m,this._messages=r,this._settings=new h(m.effectiveTheme);const d=s.visible,v={view:m,attached:d,isDecoration:f},{fontSize:b,textColor:p,textBackgroundColor:_}=i.style;this._visualElements=new O({marker:new S(v,s.markerMaterial),dimension:new u(v,s.dimensionLineMaterial),startOffset:new u(v,s.offsetLineMaterial),endOffset:new u(v,s.offsetLineMaterial),dimensionSmall:new u(v,s.smallDimensionLineMaterial),startOffsetSmall:new u(v,s.smallOffsetLineMaterial),endOffsetSmall:new u(v,s.smallOffsetLineMaterial),label:new c({view:m,attached:d,distance:0,geometry:{type:"segment",sampleLocation:"center",segment:this._labelSegment,callout:!1},fontSize:a(b),textColor:p.clone(),backgroundColor:_.clone(),isDecoration:f})}),this._handles.add([n((()=>o.geometry),(e=>{this.updateCameraDependentElements(m.state.camera,e,i.style),null!=o.geometry&&this._updateLines(o.geometry)}),{...l,equals:t}),n((()=>o.length),(e=>this._updateLabelContent(e)),l)])}destroy(){this.destroyed=!0,this._handles=s(this._handles);for(const e of this._visualElements.values())e.destroy()}get testInfo(){return{dimensionVisualElement:this._visualElements.dimension,label:this._visualElements.label}}_updateLines(e){const t=m(b,r.Start,e.directSegment,e.dimensionSegment),s=m(p,r.End,e.directSegment,e.dimensionSegment),i=this._visualElements;i.marker.setGeometryFromSegment(e.dimensionSegment,e.primaryOffsetAxis),i.dimension.setGeometryFromSegment(e.dimensionSegment),i.startOffset.setGeometryFromSegment(t),i.endOffset.setGeometryFromSegment(s),i.dimensionSmall.setGeometryFromSegment(e.dimensionSegment),i.startOffsetSmall.setGeometryFromSegment(t),i.endOffsetSmall.setGeometryFromSegment(s)}updateCameraDependentElements(e,t,s){const i=this._visualElements;if(null==t){for(const e of i.values())e.visible=!1;return}const n=e.computeScreenPixelSizeAt(t.dimensionSegment.eval(.5,_)),l=f(t,n),o=l<(a(s.lineSize)*this._settings.smallScreenLengthLineSizeFactor)**2,m=!o;i.marker.visible=m,i.dimension.visible=m,i.startOffset.visible=m,i.endOffset.visible=m,i.dimensionSmall.visible=o,i.startOffsetSmall.visible=o,i.endOffsetSmall.visible=o;const r=a(s.fontSize)*this._settings.labels.minScreenLengthFontSizeFactor,{label:h}=i;if(h.visible=l>=r**2,!h.visible)return;const{dimensionSegment:c,primaryOffsetAxis:u}=t,{offset:S}=this.computation.dimension,g=(Math.sign(S)>=0?1:-1)*this._labelOffsetPx(s)*n;d(this._labelSegment,c,u,g),h.updateLabelPosition()}updateLabelStyle(e){const{label:t}=this._visualElements;t.fontSize=a(e.fontSize),t.textColor=e.textColor,t.backgroundColor=e.textBackgroundColor}updateUnitsMessages(e){this._messages=e;const{length:t}=this.computation;this._updateLabelContent(t)}_updateLabelContent(e){const{label:t}=this._visualElements;null!=e&&null!=this._messages?t.text=i(this._messages,e,e.unit):t.text=""}_labelOffsetPx(e){return 1.5*a(e.fontSize)+this._settings.labels.marginPx+a(e.lineSize/2)}}const b=new g,p=new g,_=o();class O{constructor(e){this.marker=e.marker,this.dimension=e.dimension,this.startOffset=e.startOffset,this.endOffset=e.endOffset,this.dimensionSmall=e.dimensionSmall,this.startOffsetSmall=e.startOffsetSmall,this.endOffsetSmall=e.endOffsetSmall,this.label=e.label}values(){return[this.marker,this.dimension,this.startOffset,this.endOffset,this.dimensionSmall,this.startOffsetSmall,this.endOffsetSmall,this.label]}}export{O as LengthDimensionVisualElements,v as LengthDimensionVisualization};
5
+ import e from"../../../../core/Handles.js";import{equals as t}from"../../../../core/lang.js";import{destroyMaybe as s}from"../../../../core/maybe.js";import{formatDecimal as i}from"../../../../core/quantityFormatUtils.js";import{watch as n,initial as l}from"../../../../core/reactiveUtils.js";import{pt2px as a}from"../../../../core/screenUtils.js";import{c as o}from"../../../../chunks/vec3f64.js";import{computeSpanningSegment as m,OffsetSegmentLocation as r,maxScreenLengthSquaredFromGeometry as f,offsetSegment as d}from"./lengthDimensionUtils.js";import{smallScreenLengthLineSizeFactor as h,minScreenLengthFontSizeFactor as c,labelMarginPx as u}from"./settings.js";import{LabelVisualElement as S}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as g}from"../../interactive/visualElements/LineVisualElement.js";import{MarkerVisualElement as v}from"../../interactive/visualElements/MarkerVisualElement.js";import{EuclideanSegment as p}from"../../interactive/visualElements/support/Segment.js";class b{set visible(e){for(const t of this._visualElements.values())t.attached=e}constructor(s){this.destroyed=!1,this._handles=new e,this._messages=null,this._labelSegment=new p;const{analysis:i,computation:o,view:m,messages:r,isDecoration:f}=s;this.analysis=i,this.computation=o,this.view=m,this._messages=r;const d=s.visible,h={view:m,attached:d,isDecoration:f},{fontSize:c,textColor:u,textBackgroundColor:b}=i.style;this._visualElements=new E({marker:new v(h,s.markerMaterial),dimension:new g(h,s.dimensionLineMaterial),startOffset:new g(h,s.offsetLineMaterial),endOffset:new g(h,s.offsetLineMaterial),dimensionSmall:new g(h,s.smallDimensionLineMaterial),startOffsetSmall:new g(h,s.smallOffsetLineMaterial),endOffsetSmall:new g(h,s.smallOffsetLineMaterial),label:new S({view:m,attached:d,distance:0,geometry:{type:"segment",sampleLocation:"center",segment:this._labelSegment,callout:!1},fontSize:a(c),textColor:u.clone(),backgroundColor:b.clone(),isDecoration:f})}),this._handles.add([n((()=>o.geometry),(e=>{this.updateCameraDependentElements(m.state.camera,e,i.style),null!=o.geometry&&this._updateLines(o.geometry)}),{...l,equals:t}),n((()=>o.length),(e=>this._updateLabelContent(e)),l)])}destroy(){this.destroyed=!0,this._handles=s(this._handles);for(const e of this._visualElements.values())e.destroy()}get testInfo(){return{dimensionVisualElement:this._visualElements.dimension,label:this._visualElements.label}}_updateLines(e){const t=m(O,r.Start,e.directSegment,e.dimensionSegment),s=m(_,r.End,e.directSegment,e.dimensionSegment),i=this._visualElements;i.marker.setGeometryFromSegment(e.dimensionSegment,e.primaryOffsetAxis),i.dimension.setGeometryFromSegment(e.dimensionSegment),i.startOffset.setGeometryFromSegment(t),i.endOffset.setGeometryFromSegment(s),i.dimensionSmall.setGeometryFromSegment(e.dimensionSegment),i.startOffsetSmall.setGeometryFromSegment(t),i.endOffsetSmall.setGeometryFromSegment(s)}updateCameraDependentElements(e,t,s){const i=this._visualElements;if(null==t){for(const e of i.values())e.visible=!1;return}const n=e.computeScreenPixelSizeAt(t.dimensionSegment.eval(.5,y)),l=f(t,n),o=l<(a(s.lineSize)*h)**2,m=!o;i.marker.visible=m,i.dimension.visible=m,i.startOffset.visible=m,i.endOffset.visible=m,i.dimensionSmall.visible=o,i.startOffsetSmall.visible=o,i.endOffsetSmall.visible=o;const r=a(s.fontSize)*c,{label:u}=i;if(u.visible=l>=r**2,!u.visible)return;const{dimensionSegment:S,primaryOffsetAxis:g}=t,{offset:v}=this.computation.dimension,p=(Math.sign(v)>=0?1:-1)*this._labelOffsetPx(s)*n;d(this._labelSegment,S,g,p),u.updateLabelPosition()}updateLabelStyle(e){const{label:t}=this._visualElements;t.fontSize=a(e.fontSize),t.textColor=e.textColor,t.backgroundColor=e.textBackgroundColor}updateUnitsMessages(e){this._messages=e;const{length:t}=this.computation;this._updateLabelContent(t)}_updateLabelContent(e){const{label:t}=this._visualElements;null!=e&&null!=this._messages?t.text=i(this._messages,e,e.unit):t.text=""}_labelOffsetPx(e){return 1.5*a(e.fontSize)+u+a(e.lineSize/2)}}const O=new p,_=new p,y=o();class E{constructor(e){this.marker=e.marker,this.dimension=e.dimension,this.startOffset=e.startOffset,this.endOffset=e.endOffset,this.dimensionSmall=e.dimensionSmall,this.startOffsetSmall=e.startOffsetSmall,this.endOffsetSmall=e.endOffsetSmall,this.label=e.label}values(){return[this.marker,this.dimension,this.startOffset,this.endOffset,this.dimensionSmall,this.startOffsetSmall,this.endOffsetSmall,this.label]}}export{E as LengthDimensionVisualElements,b as LengthDimensionVisualization};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import"../../../../geometry.js";import{lengthDimensionMeasureType as t,LengthDimensionMeasureType as n}from"../../../../analysis/dimensionUtils.js";import{cyclicalDegrees as r}from"../../../../core/Cyclical.js";import{rad2deg as o}from"../../../../core/mathUtils.js";import{pt2px as i}from"../../../../core/screenUtils.js";import{g as a,b as s}from"../../../../chunks/mat4.js";import{a as c}from"../../../../chunks/mat4f64.js";import{i as m,c as d,f as u,b as l,j as f,h as p,l as g,s as h,r as v}from"../../../../chunks/vec3.js";import{c as y,Z as S,f as j}from"../../../../chunks/vec3f64.js";import{fromPositionAndNormal as w,create as x,signedDistance as H,normal as M}from"../../../../geometry/support/plane.js";import{sv3d as C}from"../../../../geometry/support/vectorStacks.js";import{clonePoint as P}from"../../../../layers/graphics/hydratedFeatures.js";import{isValidComputation as T,computeGeometryFromDimension as b,computationToGeometryDependencies as R,headingFromGeometry as U,computeOffsetForPoint as z,computeSegmentForMeasureType as O,computeOffsetAxis as k,directUp as D,directStartToEnd as E,dimensionStartToEnd as F}from"./lengthDimensionUtils.js";import{PointStyle as A,lengthFraction as L,orientationSnapThresholdDegrees as G,minLengthMeters as B,linePaddingPx as I,focusedLinePaddingPx as W,OrientationManipulatorStyle as N,MarkerStyle as V}from"./settings.js";import{Manipulator3D as Z}from"../../interactive/Manipulator3D.js";import{createSphereManipulator as q,worldScaledManipulatorSettings as J,createRotateManipulator as K,updateRotateManipulator as Q,calculateInputRotationTransform as X,calculateTranslateRotateFromBases as Y}from"../../interactive/manipulatorUtils.js";import{RenderObject as $}from"../../interactive/RenderObject.js";import{screenToMap3D as _,screenToRenderPlane as ee,hideManipulatorWhileDragging as te}from"../../interactive/editingTools/dragEventPipeline3D.js";import{EuclideanSegment as ne}from"../../interactive/visualElements/support/Segment.js";import{markerSizePerLineWidth as re}from"../../support/engineContent/marker.js";import{createPolylineGeometry as oe}from"../../webgl-engine/lib/GeometryUtil.js";import{createManipulatorDragEventPipeline as ie,resetProperties as ae,EventPipeline as se}from"../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as ce,ManipulatorStateFlags as me}from"../../../interactive/interfaces.js";import de from"../../../../geometry/Point.js";class ue{constructor(e){this.start=e.start,this.end=e.end,this.offset=e.offset,this.heading=e.heading,this.rotation=e.rotation,this.direct=e.direct,this.horizontal=e.horizontal,this.vertical=e.vertical}manipulatorName(e){return Object.keys(this).find((t=>this.hasOwnProperty(t)&&e===this[t]))}values(){return[this.start,this.end,this.offset,this.heading,this.rotation,this.direct,this.horizontal,this.vertical]}forEachMeasureTypeManipulator(e){for(const n of t)e(this.manipulatorForMeasureType(n),n)}manipulatorForMeasureType(e){switch(e){case n.Direct:return this.direct;case n.Horizontal:return this.horizontal;case n.Vertical:return this.vertical}}}function le(t,n){const r=new A(t.effectiveTheme),o=q(t,e.toUnitRGBA(r.color),We);return o.available=!1,o.grabCursor="crosshair",o.radius=r.radius,o.metadata=n.metadata,o.collisionPriority=1,o}function fe(e,t){const n=[j(-.5,0,0),j(.5,0,0)],r=oe(t.unfocusedMaterial,n.map((e=>m(y(),e,L)))),o=r.instantiate({material:t.focusedMaterial});return new Z({view:e,renderObjects:[new $(r,me.Unfocused|me.Selected|We),new $(o,me.Focused|We)],collisionType:{type:"line",paths:[n]},radius:Ie(t.lineSizePt)/2,metadata:t.metadata,available:!1,...J})}function pe(t,n,{lineSizePt:r,material:o}){const a=new N(t.effectiveTheme),{calloutOffsetPx:s,calloutWidth:c,discScale:m,focusMultiplier:d,color:u}=a,l=new V;return{calloutLength:.25*re*l.lineSizeFraction*i(r)+s,calloutColor:e.toUnitRGBA(u),calloutWidth:c,customStateMask:We,discScale:m,focusMultiplier:d,material:o,metadata:n}}function ge(e,t){return K(e,pe(e,t.metadata,t))}function he(e,t,n){Q(t,pe(e,t.metadata,n))}function ve(e,t){const n=[j(-.5,0,0),j(.5,0,0)],r=oe(t.thinOffsetManipulatorMaterial,n),o=oe(t.unfocusedMaterial,n.map((e=>m(y(),e,L)))),i=o.instantiate({material:t.focusedMaterial});return new Z({view:e,renderObjects:[new $(o,me.Unfocused|We),new $(i,me.Focused|We),new $(r,We)],collisionType:{type:"line",paths:[n]},radius:Ie(t.lineSizePt)/2,available:!1,metadata:t.metadata,...J})}function ye(e,{isStart:t,createSnappingPipelineStep:n,dimension:r,onUpdate:o,view:i}){const a=t?"startPoint":"endPoint",s=ie(e,((e,t,s,c)=>{const m=te(e),{snappingStep:d,cancelSnapping:u}=n(c);s=s.next(m).next(ae(r,[a,"measureType","orientation"])).next(u),t.next(m).next(_(i)).next(...d).next((e=>{const t=P(e.mapEnd,new de);o("startPoint"===a?{startPoint:t}:{endPoint:t})}))}));return[s]}function Se(e,{computation:t,view:n}){return[ie(e,((e,r,o)=>{if(!T(t)||!e.selected)return;const{geometry:i,dimension:a}=t,s=te(e);r.next(s).next(Pe(n,a,i.dimensionSegment,i.primaryOffsetAxis)),o.next(s).next(ae(a,["offset"]))}))]}function je(e,{computation:t,view:n}){return[ie(e,((e,r,o)=>{He({cancel:o,computation:t,settingHeading:!0,steps:r,view:n})}))]}function we(e,{computation:t,view:n}){return[ie(e,((e,r,o)=>{He({cancel:o,computation:t,settingHeading:!1,steps:r,view:n})})),e.events.on("immediate-click",(e=>{xe(e,t,n)}))]}function xe(e,t,n){const{dimension:o,geometry:i}=t;if(90===o.orientation||270===o.orientation)return o.orientation=0,void e.stopPropagation();if(null==i)return;const{renderCoordsHelper:a}=n,s=b({...R(t),orientation:90},a),c=b({...R(t),orientation:270},a);if(null==s||null==c)return;const m=U(s,a),d=U(c,a),u=Te(i,n),l=r.shortestSignedDiff(u,m),f=r.shortestSignedDiff(u,d);o.orientation=Math.abs(l)<Math.abs(f)?90:270,e.stopPropagation()}function He(e){const{cancel:t,computation:n,settingHeading:r,steps:i,view:a}=e;if(!T(n))return;const{renderCoordsHelper:s}=a,{dimension:c,geometry:m}=n,u=y(),l=Ee(y(),m,m.directSegment,s),f=Fe(C.get(),{forHeading:r,geometry:m,renderCoordsHelper:s}),p=w(l,f,x()),g=r?c.orientation??U(m,a.renderCoordsHelper):c.orientation??0;i.next(ee(a,p)).next((e=>{"start"===e.action&&d(u,e.renderStart);const t=M(p),n=X(u,e.renderEnd,l,t);let i=g-o(n);r||(i=Me(i)),c.orientation=i})),t.next(ae(c,["orientation"]))}function Me(e){const t=r.normalize(e)%90;return t<G?e-t:90-t<G?e+(90-t):e}function Ce(e,{computation:t,manipulatorMeasureType:r,view:o}){let i=n.Direct,a=0,s=0;return[e.events.on("grab-changed",(n=>{if("start"!==n.action||!T(t))return;const{dimension:c,geometry:m}=t;i=c.measureType,a=c.offset,s=c.orientation;const u=d(C.get(),e.renderLocation);c.measureType=r,c.offset=z(u,r,m,o.renderCoordsHelper),c.orientation=0})),ie(e,((e,n,c)=>{if(!T(t))return;const{geometry:m,dimension:d}=t,{renderCoordsHelper:u}=o,l=O(qe,r,t,u),f=k(C.get(),{measureType:r,directSegment:m.directSegment,renderCoordsHelper:u}),p=te(e);n.next(p).next(Pe(o,d,l,f)),c.next(p).next((e=>(d.measureType=i,d.offset=a,d.orientation=s,e)))}))]}function Pe(e,t,n,r){const o=u(C.get(),n.endRenderSpace,n.startRenderSpace);l(o,o,r);const i=w(n.startRenderSpace,o,x()),a=w(n.startRenderSpace,r,x()),s=t.offset;let c,m=0;const d=new se;return d.next(ee(e,i)).next((n=>{"start"===n.action&&(m=H(a,n.renderStart));const r=(H(a,n.renderEnd)-m)*e.renderCoordsHelper.unitInMeters;t.offset=s+r,c=n})),e=>(d.execute(e),c)}function Te(e,t){const{directSegment:n}=e,{renderCoordsHelper:r}=t,o=D(C.get(),e,r),i=E(C.get(),e),a=l(C.get(),i,o),{viewForward:s}=t.state.camera;f(a,s)>0&&m(a,a,-1);const c=n.eval(.5,C.get());return r.headingAtPosition(c,a)}function be(e,t,n){const{dimensionSegment:r,primaryOffsetAxis:o}=t,i=F(Ne,t),c=p(i,S)?a(Ze):Y(i,o,S,Ze),m=Math.max(g(i),B/n.unitInMeters);s(c,c,h(Ne,m,m,m)),e.modelTransform=c,e.renderLocation=r.eval(.5,Ne)}function Re(e,t,n){ze(e,t,n,{forHeading:!0})}function Ue(e,t,n){ze(e,t,n,{forHeading:!1})}function ze(e,t,n,{forHeading:r}){const{dimension:o,geometry:i}=t,{primaryOffsetAxis:a}=i,s=m(Oe,a,o.offset>=0?1:-1),c=Fe(ke,{forHeading:r,geometry:i,renderCoordsHelper:n});l(c,c,s);const d=Y(s,c,S,Ze);e.modelTransform=d,e.renderLocation=Ee(Ne,i,i.dimensionSegment,n)}const Oe=y(),ke=y();function De(e,t,n,r){const{geometry:o}=t,i=O(qe,n,t,r),a=k(Ne,{measureType:n,directSegment:o.directSegment,renderCoordsHelper:r}),c=v(Ve,i.endRenderSpace,i.startRenderSpace),m=Y(c,a,S,Ze),d=g(c);s(m,m,h(Ve,d,d,d)),e.modelTransform=m,e.renderLocation=i.eval(.5,Ve)}function Ee(e,t,n,r){const{startRenderSpace:o,endRenderSpace:i}=n,a=Ae(t,r)?o:i;return d(e,a)}function Fe(e,{forHeading:t,geometry:n,renderCoordsHelper:r}){return t?D(e,n,r):F(e,n,{invert:!0})}function Ae(e,t){const n=E(Le,e),r=D(Ge,e,t);return f(n,r)>0}const Le=y(),Ge=y();function Be(e){return i(e)+I}function Ie(e){return i(e)+W}const We=ce.Custom1,Ne=y(),Ve=y(),Ze=c(),qe=new ne;export{We as DidPointerMoveRecentlyFlag,ue as LengthDimensionManipulators,Te as automaticHeadingFromCamera,ve as createMeasureTypeManipulator,fe as createOffsetManipulator,ge as createOrientationManipulator,le as createPointManipulator,Ie as focusedOffsetWidth,je as headingManipulatorHandles,Ce as measureTypeManipulatorHandles,Se as offsetManipulatorHandles,ye as pointManipulatorHandles,we as rotationManipulatorHandles,Me as snapOrientationToNearestRightAngle,Be as unfocusedOffsetWidth,Re as updateHeadingManipulatorTransform,De as updateMeasureTypeManipulatorTransform,be as updateOffsetManipulatorTransform,he as updateOrientationManipulator,Ue as updateRotationManipulatorTransform};
5
+ import e from"../../../../Color.js";import"../../../../geometry.js";import{lengthDimensionMeasureType as t,LengthDimensionMeasureType as n}from"../../../../analysis/dimensionUtils.js";import{cyclicalDegrees as r}from"../../../../core/Cyclical.js";import{rad2deg as o}from"../../../../core/mathUtils.js";import{watch as i,initial as a}from"../../../../core/reactiveUtils.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{g as c,b as m}from"../../../../chunks/mat4.js";import{a as d}from"../../../../chunks/mat4f64.js";import{i as l,c as p,f as u,b as f,j as h,h as g,l as v,s as y,r as S}from"../../../../chunks/vec3.js";import{c as j,Z as w,f as x}from"../../../../chunks/vec3f64.js";import{c as H}from"../../../../chunks/vec4f64.js";import{fromPositionAndNormal as P,create as C,signedDistance as M,normal as T}from"../../../../geometry/support/plane.js";import{sv3d as b}from"../../../../geometry/support/vectorStacks.js";import{clonePoint as z}from"../../../../layers/graphics/hydratedFeatures.js";import{isValidComputation as R,computeGeometryFromDimension as U,computationToGeometryDependencies as O,headingFromGeometry as k,computeOffsetForPoint as _,computeSegmentForMeasureType as A,computeOffsetAxis as D,directUp as E,directStartToEnd as F,dimensionStartToEnd as L}from"./lengthDimensionUtils.js";import{getTransparentAccentColor as G,pointRadius as B,lengthFraction as I,markerLineSizeFraction as N,orientationCalloutOffsetPx as V,orientationCalloutWidth as W,orientationDiscScale as Z,orientationFocusMultiplier as q,orientationSnapThresholdDegrees as J,minLengthMeters as K,linePaddingPx as Q,focusedLinePaddingPx as X}from"./settings.js";import{Manipulator3D as Y}from"../../interactive/Manipulator3D.js";import{createManipulatorMaterial as $,worldScaledManipulatorSettings as ee,updateRotateManipulator as te,calculateInputRotationTransform as ne,calculateTranslateRotateFromBases as re}from"../../interactive/manipulatorUtils.js";import{RenderObject as oe}from"../../interactive/RenderObject.js";import{screenToMap3D as ie,screenToRenderPlane as ae,hideManipulatorWhileDragging as se}from"../../interactive/editingTools/dragEventPipeline3D.js";import{EuclideanSegment as ce}from"../../interactive/visualElements/support/Segment.js";import{markerSizePerLineWidth as me}from"../../support/engineContent/marker.js";import{createSphereGeometry as de,createPolylineGeometry as le}from"../../webgl-engine/lib/GeometryUtil.js";import{createManipulatorDragEventPipeline as pe,resetProperties as ue,EventPipeline as fe}from"../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as he,ManipulatorStateFlags as ge}from"../../../interactive/interfaces.js";import ve from"../../../../geometry/Point.js";class ye{constructor(e){this.start=e.start,this.end=e.end,this.offset=e.offset,this.heading=e.heading,this.rotation=e.rotation,this.direct=e.direct,this.horizontal=e.horizontal,this.vertical=e.vertical}manipulatorName(e){return Object.keys(this).find((t=>this.hasOwnProperty(t)&&e===this[t]))}values(){return[this.start,this.end,this.offset,this.heading,this.rotation,this.direct,this.horizontal,this.vertical]}forEachMeasureTypeManipulator(e){for(const n of t)e(this.manipulatorForMeasureType(n),n)}manipulatorForMeasureType(e){switch(e){case n.Direct:return this.direct;case n.Horizontal:return this.horizontal;case n.Vertical:return this.vertical}}}class Se extends Y{constructor(t,n){const r=$(e.toUnitRGBA(G(t.effectiveTheme))),o=[new oe(de(r,1,32,32),Je)];super({view:t,renderObjects:o,metadata:n.metadata,available:!1,grabCursor:"crosshair",radius:B,collisionPriority:1}),this._themeHandle=i((()=>({color:e.toUnitRGBA(G(t.effectiveTheme))})),(e=>{r.setParameters(e)}))}destroy(){this._themeHandle.remove(),super.destroy()}}function je(e,t){const n=[x(-.5,0,0),x(.5,0,0)],r=le(t.unfocusedMaterial,n.map((e=>l(j(),e,I)))),o=r.instantiate({material:t.focusedMaterial});return new Y({view:e,renderObjects:[new oe(r,ge.Unfocused|ge.Selected|Je),new oe(o,ge.Focused|Je)],collisionType:{type:"line",paths:[n]},radius:qe(t.lineSizePt)/2,metadata:t.metadata,available:!1,...ee})}class we extends Y{constructor(t,{lineSizePt:n,material:r,metadata:o}){super({view:t,autoScaleRenderObjects:!1,collisionPriority:1,metadata:o}),this._options={calloutColor:H(),lineSizePt:n,material:r},this._themeHandle=i((()=>e.toUnitRGBA(G(t.effectiveTheme))),(e=>{this._options.calloutColor=e,te(this,xe({...this._options,metadata:this.metadata}))}),a)}update({lineSizePt:e,material:t}){this._options.lineSizePt=e,this._options.material=t,te(this,xe({...this._options,metadata:this.metadata}))}destroy(){this._themeHandle.remove(),super.destroy()}}function xe({calloutColor:e,lineSizePt:t,material:n,metadata:r}){return{calloutLength:.25*me*N*s(t)+V,calloutColor:e,calloutWidth:W,customStateMask:Je,discScale:Z,focusMultiplier:q,material:n,metadata:r}}function He(e,t){const n=[x(-.5,0,0),x(.5,0,0)],r=le(t.thinOffsetManipulatorMaterial,n),o=le(t.unfocusedMaterial,n.map((e=>l(j(),e,I)))),i=o.instantiate({material:t.focusedMaterial});return new Y({view:e,renderObjects:[new oe(o,ge.Unfocused|Je),new oe(i,ge.Focused|Je),new oe(r,Je)],collisionType:{type:"line",paths:[n]},radius:qe(t.lineSizePt)/2,available:!1,metadata:t.metadata,...ee})}function Pe(e,{isStart:t,createSnappingPipelineStep:n,dimension:r,onUpdate:o,view:i}){const a=t?"startPoint":"endPoint",s=pe(e,((e,t,s,c)=>{const m=se(e),{snappingStep:d,cancelSnapping:l}=n(c);s=s.next(m).next(ue(r,[a,"measureType","orientation"])).next(l),t.next(m).next(ie(i)).next(...d).next((e=>{const t=z(e.mapEnd,new ve);o("startPoint"===a?{startPoint:t}:{endPoint:t})}))}));return[s]}function Ce(e,{computation:t,view:n}){return[pe(e,((e,r,o)=>{if(!R(t)||!e.selected)return;const{geometry:i,dimension:a}=t,s=se(e);r.next(s).next(Oe(n,a,i.dimensionSegment,i.primaryOffsetAxis)),o.next(s).next(ue(a,["offset"]))}))]}function Me(e,{computation:t,view:n}){return[pe(e,((e,r,o)=>{ze({cancel:o,computation:t,settingHeading:!0,steps:r,view:n})}))]}function Te(e,{computation:t,view:n}){return[pe(e,((e,r,o)=>{ze({cancel:o,computation:t,settingHeading:!1,steps:r,view:n})})),e.events.on("immediate-click",(e=>{be(e,t,n)}))]}function be(e,t,n){const{dimension:o,geometry:i}=t;if(90===o.orientation||270===o.orientation)return o.orientation=0,void e.stopPropagation();if(null==i)return;const{renderCoordsHelper:a}=n,s=U({...O(t),orientation:90},a),c=U({...O(t),orientation:270},a);if(null==s||null==c)return;const m=k(s,a),d=k(c,a),l=ke(i,n),p=r.shortestSignedDiff(l,m),u=r.shortestSignedDiff(l,d);o.orientation=Math.abs(p)<Math.abs(u)?90:270,e.stopPropagation()}function ze(e){const{cancel:t,computation:n,settingHeading:r,steps:i,view:a}=e;if(!R(n))return;const{renderCoordsHelper:s}=a,{dimension:c,geometry:m}=n,d=j(),l=Be(j(),m,m.directSegment,s),u=Ie(b.get(),{forHeading:r,geometry:m,renderCoordsHelper:s}),f=P(l,u,C()),h=r?c.orientation??k(m,a.renderCoordsHelper):c.orientation??0;i.next(ae(a,f)).next((e=>{"start"===e.action&&p(d,e.renderStart);const t=T(f),n=ne(d,e.renderEnd,l,t);let i=h-o(n);r||(i=Re(i)),c.orientation=i})),t.next(ue(c,["orientation"]))}function Re(e){const t=r.normalize(e)%90;return t<J?e-t:90-t<J?e+(90-t):e}function Ue(e,{computation:t,manipulatorMeasureType:r,view:o}){let i=n.Direct,a=0,s=0;return[e.events.on("grab-changed",(n=>{if("start"!==n.action||!R(t))return;const{dimension:c,geometry:m}=t;i=c.measureType,a=c.offset,s=c.orientation;const d=p(b.get(),e.renderLocation);c.measureType=r,c.offset=_(d,r,m,o.renderCoordsHelper),c.orientation=0})),pe(e,((e,n,c)=>{if(!R(t))return;const{geometry:m,dimension:d}=t,{renderCoordsHelper:l}=o,p=A(Ye,r,t,l),u=D(b.get(),{measureType:r,directSegment:m.directSegment,renderCoordsHelper:l}),f=se(e);n.next(f).next(Oe(o,d,p,u)),c.next(f).next((e=>(d.measureType=i,d.offset=a,d.orientation=s,e)))}))]}function Oe(e,t,n,r){const o=u(b.get(),n.endRenderSpace,n.startRenderSpace);f(o,o,r);const i=P(n.startRenderSpace,o,C()),a=P(n.startRenderSpace,r,C()),s=t.offset;let c,m=0;const d=new fe;return d.next(ae(e,i)).next((n=>{"start"===n.action&&(m=M(a,n.renderStart));const r=(M(a,n.renderEnd)-m)*e.renderCoordsHelper.unitInMeters;t.offset=s+r,c=n})),e=>(d.execute(e),c)}function ke(e,t){const{directSegment:n}=e,{renderCoordsHelper:r}=t,o=E(b.get(),e,r),i=F(b.get(),e),a=f(b.get(),i,o),{viewForward:s}=t.state.camera;h(a,s)>0&&l(a,a,-1);const c=n.eval(.5,b.get());return r.headingAtPosition(c,a)}function _e(e,t,n){const{dimensionSegment:r,primaryOffsetAxis:o}=t,i=L(Ke,t),a=g(i,w)?c(Xe):re(i,o,w,Xe),s=Math.max(v(i),K/n.unitInMeters);m(a,a,y(Ke,s,s,s)),e.modelTransform=a,e.renderLocation=r.eval(.5,Ke)}function Ae(e,t,n){Ee(e,t,n,{forHeading:!0})}function De(e,t,n){Ee(e,t,n,{forHeading:!1})}function Ee(e,t,n,{forHeading:r}){const{dimension:o,geometry:i}=t,{primaryOffsetAxis:a}=i,s=l(Fe,a,o.offset>=0?1:-1),c=Ie(Le,{forHeading:r,geometry:i,renderCoordsHelper:n});f(c,c,s);const m=re(s,c,w,Xe);e.modelTransform=m,e.renderLocation=Be(Ke,i,i.dimensionSegment,n)}const Fe=j(),Le=j();function Ge(e,t,n,r){const{geometry:o}=t,i=A(Ye,n,t,r),a=D(Ke,{measureType:n,directSegment:o.directSegment,renderCoordsHelper:r}),s=S(Qe,i.endRenderSpace,i.startRenderSpace),c=re(s,a,w,Xe),d=v(s);m(c,c,y(Qe,d,d,d)),e.modelTransform=c,e.renderLocation=i.eval(.5,Qe)}function Be(e,t,n,r){const{startRenderSpace:o,endRenderSpace:i}=n,a=Ne(t,r)?o:i;return p(e,a)}function Ie(e,{forHeading:t,geometry:n,renderCoordsHelper:r}){return t?E(e,n,r):L(e,n,{invert:!0})}function Ne(e,t){const n=F(Ve,e),r=E(We,e,t);return h(n,r)>0}const Ve=j(),We=j();function Ze(e){return s(e)+Q}function qe(e){return s(e)+X}const Je=he.Custom1,Ke=j(),Qe=j(),Xe=d(),Ye=new ce;export{Je as DidPointerMoveRecentlyFlag,ye as LengthDimensionManipulators,Se as LengthDimensionPointManipulator,we as LineOfSightOrientationManipulator,ke as automaticHeadingFromCamera,He as createMeasureTypeManipulator,je as createOffsetManipulator,qe as focusedOffsetWidth,Me as headingManipulatorHandles,Ue as measureTypeManipulatorHandles,Ce as offsetManipulatorHandles,Pe as pointManipulatorHandles,Te as rotationManipulatorHandles,Re as snapOrientationToNearestRightAngle,Ze as unfocusedOffsetWidth,Ae as updateHeadingManipulatorTransform,Ge as updateMeasureTypeManipulatorTransform,_e as updateOffsetManipulatorTransform,De as updateRotationManipulatorTransform};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import t from"../../../../Color.js";import{multiplyOpacity as s,getContrast as i}from"../../../../core/colorUtils.js";class o{constructor(t){this._theme=t,this.color=s(this._theme.accentColor,.5),this.radius=5}}class e{constructor(){this.color=new t([127,127,127,.5]),this.radius=5}}class c{constructor(){this.lineSizeFraction=.8}}const h=4,r=6,n=.1,l=.5;class a{constructor(t){this._theme=t,this.color=s(this._theme.accentColor,.5)}}class m{constructor(t){this._theme=t,this.calloutOffsetPx=18,this.calloutWidth=2,this.discScale=.3,this.focusMultiplier=2,this.color=s(this._theme.accentColor,.5),this.contrastColor=i(this._theme.accentColor)}}class u{constructor(){this.lineSizeFraction=.25}}class _{constructor(){this.marginPx=20,this.minScreenLengthFontSizeFactor=5}}class f{constructor(t){this._theme=t,this.color=s(this._theme.accentColor,.5)}}const w=5,p=10,d=2500;class C{constructor(t){this._theme=t,this.pointManipulators=new o(this._theme),this.offsetManipulator=new a(this._theme),this.orientationManipulator=new m(this._theme),this.markers=new c,this.labels=new _,this.offsetLine=new u,this.constraint=new f(this._theme),this.initialOffsetPx=50,this.disabledPointIndicator=new e,this.smallScreenLengthLineSizeFactor=2}}export{c as MarkerStyle,m as OrientationManipulatorStyle,o as PointStyle,C as Settings,p as constraintThresholdPx,r as focusedLinePaddingPx,l as lengthFraction,h as linePaddingPx,n as minLengthMeters,w as orientationSnapThresholdDegrees,d as pointerMoveTimeoutMs};
5
+ import o from"../../../../Color.js";import{multiplyOpacity as r,getContrast as t}from"../../../../core/colorUtils.js";function n(o){return r(o.accentColor,.5)}function c(o){return t(o.accentColor)}const e=5,i=new o([127,127,127,.5]),l=.8,f=4,m=6,s=.1,u=.5,p=18,C=2,a=.3,j=2,w=.25,x=20,U=5,b=5,d=10,g=2500,h=50,k=2;export{d as constraintThresholdPx,i as disabledPointColor,m as focusedLinePaddingPx,c as getContrastColor,n as getTransparentAccentColor,h as initialOffsetPx,x as labelMarginPx,u as lengthFraction,f as linePaddingPx,l as markerLineSizeFraction,s as minLengthMeters,U as minScreenLengthFontSizeFactor,w as offsetLineSizeFraction,p as orientationCalloutOffsetPx,C as orientationCalloutWidth,a as orientationDiscScale,j as orientationFocusMultiplier,b as orientationSnapThresholdDegrees,e as pointRadius,g as pointerMoveTimeoutMs,k as smallScreenLengthLineSizeFactor};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{removeHandles as e,destroyHandle as t,refHandle as n}from"../../../../core/handleUtils.js";import{deg2rad as o}from"../../../../core/mathUtils.js";import{watch as i,initial as r}from"../../../../core/reactiveUtils.js";import{s as a}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{projectPointToVector as l}from"../../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as p}from"../../../../geometry/projection/projectVectorToVector.js";import{create as c,empty as m,getMin as u}from"../../../../geometry/support/aaBoundingBox.js";import{containsXY as h}from"../../../../geometry/support/aaBoundingRect.js";import{getGraphicEffectiveElevationInfo as d}from"../../../../support/elevationInfoUtils.js";import{GrabbingState as f}from"./GrabbingState.js";import{ManipulatorState as g}from"./ManipulatorState.js";import{getSettings as v}from"./settings.js";import{ExtendedLineVisualElement as y}from"../visualElements/ExtendedLineVisualElement.js";import{LaserlineVisualElement as j}from"../visualElements/LaserlineVisualElement.js";import{PointVisualElement as E}from"../visualElements/PointVisualElement.js";import{evaluateElevationAlignmentAtPoint as w}from"../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as b}from"../../layers/graphics/ElevationContext.js";import{GraphicState as D}from"../../layers/graphics/GraphicState.js";import{RenderOccludedFlag as S}from"../../webgl-engine/lib/Material.js";function x(t){const{view:n,graphic:o}=t,i=new D({graphic:o}),r=[],a=T(t,i,r);return P(t,i,r,a),r.push(n.trackGraphicState(i)),{visualElement:a,remove:()=>e(r)}}function P(e,n,r,s){const{view:l,graphic:c}=e,h=v(l.effectiveTheme),E=new y({view:l,extensionType:h.visualElements.zVerticalLine.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:S.OccludeAndTransparent,isDecoration:!0});h.visualElements.zVerticalLine.apply(E);const D=new j({view:l,intersectsLineInfinite:!0,attached:!1,isDecoration:!0});h.visualElements.pointGraphics.shadowStyle.apply(D);const x=o(h.visualElements.heightPlaneAngleCutoff),P=new j({view:l,attached:!1,angleCutoff:x,isDecoration:!0});h.visualElements.heightPlane.apply(P);const T=d(e.graphic),A=b.fromElevationInfo(T),L="on-the-ground"===T.mode||!T.offset&&"absolute-height"!==T.mode,M=new g;let R=1,U=1;const B=()=>{M.update(e);const t=V(c),o=L&&(n.isDraped||null==t||!t.hasZ);let i=!0;if(o||null==t)i=!1;else{const e=w(t,l.elevationProvider,A,l.renderCoordsHelper);a(C,t.x,t.y,e),p(C,t.spatialReference,C,l.renderCoordsHelper.spatialReference),E.setStartEndFromWorldDownAtLocation(C),D.intersectsWorldUpAtLocation=C}const r=M.grabbingState&f.Z?h.visualElements.laserlineAlphaMultiplier:1;r!==R&&(R=r,h.visualElements.heightPlane.apply(P,r));const d=m(G);!o&&n.displaying&&s.calculateMapBounds(d)&&p(u(d,C),l.spatialReference,C,l.renderCoordsHelper.spatialReference)?(P.heightManifoldTarget=C,P.attached=!0):P.attached=!1;const g=M.grabbingState&f.XY?h.visualElements.laserlineAlphaMultiplier:1;g!==U&&(U=g,h.visualElements.pointGraphics.shadowStyle.apply(D,g));const v=i&&n.displaying&&!o;D.attached=v,E.attached=v};r.push(i((()=>[n.displaying,n.isDraped]),B),n.on("changed",B)),e.forEachManipulator((e=>{r.push(e.events.on("grab-changed",B))})),r.push(t(D)),r.push(t(E)),r.push(t(P)),B()}function T(e,n,o){const{view:i,graphic:r}=e,a=new E({view:i,geometry:V(r),elevationInfo:d(r),isDecoration:!0});return A(e,a,n,o),o.push(t(a)),a}function V(e){const t=e.geometry;return null==t?null:"point"===t.type?t:"mesh"===t.type?t.anchor.clone():null}function A(e,t,n,o){const a=()=>t.attached=n.displaying;L(e,t,n,o),v(e.view.effectiveTheme).visualElements.pointGraphics.outline.apply(t),o.push(i((()=>n.displaying),a,r))}function L(e,t,o,i){const{view:r,graphic:a}=e;let s=null;const l=e=>{null!=s&&(s.remove(),s=null),o.isDraped&&null!=e&&(s=M(r,e,(()=>{t.geometry=e})))},p=()=>{const e=V(a);l(e),t.geometry=e};i.push(o.on("changed",p),n((()=>s))),p()}function M(e,t,n){const o=e.elevationProvider.spatialReference;l(t,C,o);const i=C[0],r=C[1];return e.elevationProvider.on("elevation-change",(e=>{h(e.extent,i,r)&&n()}))}const C=s(),G=c();export{x as createVisualElements};
5
+ import{removeHandles as e,destroyHandle as t,refHandle as n}from"../../../../core/handleUtils.js";import{deg2rad as o}from"../../../../core/mathUtils.js";import{watch as i,initial as r}from"../../../../core/reactiveUtils.js";import{s as a}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{projectPointToVector as l}from"../../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as p}from"../../../../geometry/projection/projectVectorToVector.js";import{create as c,empty as m,getMin as u}from"../../../../geometry/support/aaBoundingBox.js";import{containsXY as h}from"../../../../geometry/support/aaBoundingRect.js";import{getGraphicEffectiveElevationInfo as d}from"../../../../support/elevationInfoUtils.js";import{GrabbingState as f}from"./GrabbingState.js";import{ManipulatorState as g}from"./ManipulatorState.js";import{getSettings as v}from"./settings.js";import{ExtendedLineVisualElement as y}from"../visualElements/ExtendedLineVisualElement.js";import{LaserlineVisualElement as j}from"../visualElements/LaserlineVisualElement.js";import{PointVisualElement as E}from"../visualElements/PointVisualElement.js";import{evaluateElevationAlignmentAtPoint as w}from"../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as b}from"../../layers/graphics/ElevationContext.js";import{GraphicState as D}from"../../layers/graphics/GraphicState.js";import{RenderOccludedFlag as S}from"../../webgl-engine/lib/Material.js";function x(t){const{view:n,graphic:o}=t,i=new D({graphic:o}),r=[],a=T(t,i,r);return P(t,i,r,a),r.push(n.trackGraphicState(i)),{visualElement:a,remove:()=>e(r)}}function P(e,n,r,s){const{view:l,graphic:c}=e,h=v(l.effectiveTheme),E=new y({view:l,extensionType:h.visualElements.zVerticalLine.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:S.OccludeAndTransparent,isDecoration:!0});h.visualElements.zVerticalLine.apply(E);const D=new j({view:l,intersectsLineInfinite:!0,attached:!1,isDecoration:!0});h.visualElements.pointGraphics.shadowStyle.apply(D);const x=o(h.visualElements.heightPlaneAngleCutoff),P=new j({view:l,attached:!1,angleCutoff:x,isDecoration:!0});h.visualElements.heightPlane.apply(P);const T=d(e.graphic),A=b.fromElevationInfo(T),L="on-the-ground"===T.mode||!T.offset&&"absolute-height"!==T.mode,M=new g;let R=1,U=1;const B=()=>{M.update(e);const t=V(c),o=L&&(n.isDraped||null==t||!t.hasZ);let i=!0;if(o||null==t)i=!1;else{const e=w(t,l.elevationProvider,A,l.renderCoordsHelper);a(C,t.x,t.y,e),p(C,t.spatialReference,C,l.renderCoordsHelper.spatialReference),E.setStartEndFromWorldDownAtLocation(C),D.intersectsWorldUpAtLocation=C}const r=M.grabbingState&f.Z?h.visualElements.laserlineAlphaMultiplier:1;r!==R&&(R=r,h.visualElements.heightPlane.apply(P,r));const d=m(G);!o&&n.displaying&&s.calculateMapBounds(d)&&p(u(d,C),l.spatialReference,C,l.renderCoordsHelper.spatialReference)?(P.heightManifoldTarget=C,P.attached=!0):P.attached=!1;const g=M.grabbingState&f.XY?h.visualElements.laserlineAlphaMultiplier:1;g!==U&&(U=g,h.visualElements.pointGraphics.shadowStyle.apply(D,g));const v=i&&n.displaying&&!o;D.attached=v,E.attached=v};r.push(i((()=>[n.displaying,n.isDraped]),B),n.on("changed",B)),e.forEachManipulator((e=>{r.push(e.events.on("grab-changed",B))})),r.push(t(D)),r.push(t(E)),r.push(t(P)),B()}function T(e,n,o){const{view:i,graphic:r}=e,a=new E({view:i,geometry:V(r),elevationInfo:d(r),isDecoration:!0});return A(e,a,n,o),o.push(t(a)),a}function V(e){const t=e.geometry;return null==t?null:"point"===t.type?t:"mesh"===t.type?t.anchor.clone():null}function A(e,t,n,o){const a=()=>{t.attached=n.displaying};L(e,t,n,o),v(e.view.effectiveTheme).visualElements.pointGraphics.outline.apply(t),o.push(i((()=>n.displaying),a,r))}function L(e,t,o,i){const{view:r,graphic:a}=e;let s=null;const l=e=>{null!=s&&(s.remove(),s=null),o.isDraped&&null!=e&&(s=M(r,e,(()=>{t.geometry=e})))},p=()=>{const e=V(a);l(e),t.geometry=e};i.push(o.on("changed",p),n((()=>s))),p()}function M(e,t,n){const o=e.elevationProvider.spatialReference;l(t,C,o);const i=C[0],r=C[1];return e.elevationProvider.on("elevation-change",(e=>{h(e.extent,i,r)&&n()}))}const C=s(),G=c();export{x as createVisualElements};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{releaseMaybe as e}from"../../../../core/maybe.js";import{MemCachePool as t}from"../../../../core/MemCachePool.js";import{PixelFormat as r,SizedPixelFormat as a,TextureWrapMode as o,PixelType as s,TextureSamplingMode as h,RenderbufferFormat as i}from"../../../webgl/enums.js";import{FramebufferObject as c}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as n}from"../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as p}from"../../../webgl/RenderbufferDescriptor.js";import{Texture as _}from"../../../webgl/Texture.js";import{TextureDescriptor as m}from"../../../webgl/TextureDescriptor.js";class l{constructor(e){this.rctx=e,this._peakMemoryUsage=0,this._allocatedMemory=new Set,this._cache=new t(e.newCache,"FBOCache"),this._depthCache=new t(e.newCache,"DepthTextureCache")}destroy(){this._cache.destroy(),this._depthCache.destroy()}resetPeakMemoryUsage(){this._peakMemoryUsage=Array.from(this._allocatedMemory.values()).reduce(((e,t)=>e+("colorTexture"in t?t.colorTexture?.gpuMemoryUsage??0:t.memoryUsage)),0)}get peakMemoryUsage(){return this._peakMemoryUsage}acquire(e,t,r){const a=T(e,t,r),o=this._cache.pop(a);if(o)return this.rctx.unbindTexture(o.fbo.colorTexture),this._trackHandle(o);const s=new d(new c(this.rctx,{...F[e],width:t,height:r}),(()=>{this._allocatedMemory.delete(s),s.releaseDepth(),this._cache.put(a,s)}),(e=>(s.releaseDepth(),s.depth=this._acquireDepth(e,s.fbo.width,s.fbo.height),s.fbo.attachDepthStencil(s.depth.attachment),s)));return this.rctx.unbindTexture(s.fbo.colorTexture),this._trackHandle(s)}acquireDepth(e,t,r){return this._acquireDepth(e,t,r)}_acquireDepth(e,t,r){const a=T(e,t,r),o=this._depthCache.pop(a);if(o)return this._trackHandle(o);const s=e===y.DEPTH_STENCIL_TEXTURE?new E(new _(this.rctx,{...P[e],width:t,height:r}),(()=>{this._allocatedMemory.delete(s),this._depthCache.put(a,s)})):new E(new n(this.rctx,{...P[e],width:t,height:r}),(()=>{this._allocatedMemory.delete(s),this._depthCache.put(a,s)}));return this._trackHandle(s)}_trackHandle(e){return this._allocatedMemory.add(e),this._peakMemoryUsage=Math.max(this._peakMemoryUsage,Array.from(this._allocatedMemory.values()).reduce(((e,t)=>e+("colorTexture"in t?t.colorTexture?.gpuMemoryUsage??0:t.memoryUsage)),0)),e}}class d{constructor(e,t,r){this.fbo=e,this.release=t,this.acquireDepth=r}dispose(){this.fbo.dispose()}releaseDepth(){this.fbo.detachDepthStencilTexture(),this.fbo.detachDepthStencilBuffer(),this.depth=e(this.depth)}detachDepth(){const e=this.depth;return this.depth=void 0,this.fbo.detachDepthStencilTexture(),this.fbo.detachDepthStencilBuffer(),e}attachDepth(e){return this.releaseDepth(),e&&(this.fbo.attachDepthStencil(e.attachment),this.depth=e),this}get colorTexture(){return this.fbo?.colorTexture}get memoryUsage(){return this.fbo.gpuMemoryUsage}}class E{constructor(e,t){this.attachment=e,this.release=t}dispose(){this.attachment.dispose()}get memoryUsage(){return this.attachment.gpuMemoryUsage}}function T(e,t,r){return`${e}x${t}x${r}`}var u;!function(e){e[e.RED=0]="RED",e[e.RG=1]="RG",e[e.RGBA4=2]="RGBA4",e[e.RGBA=3]="RGBA",e[e.RGBA_MIPMAP=4]="RGBA_MIPMAP",e[e.R16F=5]="R16F",e[e.RGBA16F=6]="RGBA16F"}(u||(u={}));const M=new m;M.pixelFormat=r.RED,M.internalFormat=a.R8,M.wrapMode=o.CLAMP_TO_EDGE;const R=new m;R.pixelFormat=r.RG,R.internalFormat=a.RG8,R.wrapMode=o.CLAMP_TO_EDGE;const D=new m;D.internalFormat=a.RGBA4,D.dataType=s.UNSIGNED_SHORT_4_4_4_4,D.wrapMode=o.CLAMP_TO_EDGE;const f=new m;f.wrapMode=o.CLAMP_TO_EDGE;const g=new m;g.wrapMode=o.CLAMP_TO_EDGE,g.samplingMode=h.LINEAR_MIPMAP_LINEAR,g.hasMipmap=!0,g.maxAnisotropy=8;const w=new m;w.pixelFormat=r.RED,w.dataType=s.HALF_FLOAT,w.internalFormat=a.R16F,w.samplingMode=h.NEAREST;const A=new m;A.dataType=s.HALF_FLOAT,A.internalFormat=a.RGBA16F,A.samplingMode=h.NEAREST;const F={[u.RED]:M,[u.RG]:R,[u.RGBA4]:D,[u.RGBA]:f,[u.RGBA_MIPMAP]:g,[u.R16F]:w,[u.RGBA16F]:A};var y;!function(e){e[e.DEPTH_STENCIL_TEXTURE=0]="DEPTH_STENCIL_TEXTURE",e[e.DEPTH24_BUFFER=1]="DEPTH24_BUFFER",e[e.DEPTH16_BUFFER=2]="DEPTH16_BUFFER"}(y||(y={}));const x=new m;x.pixelFormat=r.DEPTH_STENCIL,x.dataType=s.UNSIGNED_INT_24_8,x.samplingMode=h.NEAREST,x.wrapMode=o.CLAMP_TO_EDGE;const P={[y.DEPTH_STENCIL_TEXTURE]:x,[y.DEPTH24_BUFFER]:new p(i.DEPTH_COMPONENT24,4),[y.DEPTH16_BUFFER]:new p(i.DEPTH_COMPONENT16,4)};export{u as ColorFormat,y as DepthFormat,l as FBOCache};
5
+ import{releaseMaybe as e}from"../../../../core/maybe.js";import{MemCachePool as t}from"../../../../core/MemCachePool.js";import{PixelFormat as r,SizedPixelFormat as o,TextureWrapMode as a,PixelType as s,TextureSamplingMode as h,RenderbufferFormat as c,ColorAttachment as i}from"../../../webgl/enums.js";import{FramebufferObject as n}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as l}from"../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as p}from"../../../webgl/RenderbufferDescriptor.js";import{Texture as _}from"../../../webgl/Texture.js";import{TextureDescriptor as m}from"../../../webgl/TextureDescriptor.js";class u{constructor(e){this.rctx=e,this._peakMemoryUsage=0,this._allocatedMemory=new Set,this._cache=new t(e.newCache,"FBOCache"),this._depthCache=new t(e.newCache,"DepthAttachmentCache"),this._colorCache=new t(e.newCache,"ColorAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}resetPeakMemoryUsage(){this._peakMemoryUsage=this._accumulateMemory()}get peakMemoryUsage(){return this._peakMemoryUsage}acquire(e,t,r){const o=R(e,t,r),a=this._cache.pop(o);if(a)return this.rctx.unbindTexture(a.fbo.colorTexture),this._trackHandle(a);const s=new d(new n(this.rctx,{...y[e],width:t,height:r}),(()=>{this._allocatedMemory.delete(s),s.releaseDepth(),this._cache.put(o,s)}),(e=>(s.releaseDepth(),s.depth=this._acquireDepth(e,s.fbo.width,s.fbo.height),s.fbo.attachDepthStencil(s.depth.attachment),s)),((e,o)=>{const a=this._acquireColor(e,t,r);return s.colors??=new Map,s.colors.set(o,a),s.fbo.attachColorTexture(a.attachment,o),s}));return this.rctx.unbindTexture(s.fbo.colorTexture),this._trackHandle(s)}acquireDepth(e,t,r){return this._acquireDepth(e,t,r)}_acquireDepth(e,t,r){const o=R(e,t,r),a=this._depthCache.pop(o);if(a)return this._trackHandle(a);const s=e===P.DEPTH_STENCIL_TEXTURE?new E(new _(this.rctx,{...G[e],width:t,height:r}),(()=>{this._allocatedMemory.delete(s),this._depthCache.put(o,s)})):new E(new l(this.rctx,{...G[e],width:t,height:r}),(()=>{this._allocatedMemory.delete(s),this._depthCache.put(o,s)}));return this._trackHandle(s)}_acquireColor(e,t,r){const o=R(e,t,r),a=this._colorCache.pop(o);if(a)return this._trackHandle(a);const s=new M(new _(this.rctx,{...y[e],width:t,height:r}),(()=>{this._allocatedMemory.delete(s),this._colorCache.put(o,s)}));return this._trackHandle(s)}_trackHandle(e){return this._allocatedMemory.add(e),this._peakMemoryUsage=Math.max(this._peakMemoryUsage,this._accumulateMemory()),e}_accumulateMemory(){return Array.from(this._allocatedMemory.values()).reduce(((e,t)=>e+("colorTexture"in t?t.colorTexture?.gpuMemoryUsage??0:t.memoryUsage)),0)}}class d{constructor(e,t,r,o){this.fbo=e,this.release=t,this.acquireDepth=r,this.acquireColor=o}dispose(){this.fbo.dispose()}releaseDepth(){this.fbo.detachDepthStencilTexture(),this.fbo.detachDepthStencilBuffer(),this.depth=e(this.depth)}detachDepth(){const e=this.depth;return this.depth=void 0,this.fbo.detachDepthStencilTexture(),this.fbo.detachDepthStencilBuffer(),e}attachDepth(e){return this.releaseDepth(),e&&(this.fbo.attachDepthStencil(e.attachment),this.depth=e),this}releaseColor(t){this.fbo.detachColorTexture(t);const r=this.colors?.get(t);this.colors?.delete(t),e(r)}get colorTexture(){return this.fbo?.colorTexture}getColorTexture(e=i.COLOR_ATTACHMENT0){return this.fbo?.getColorTexture(e)}get memoryUsage(){return this.fbo.gpuMemoryUsage}}class T{constructor(e,t){this.attachment=e,this.release=t}dispose(){this.attachment.dispose()}get memoryUsage(){return this.attachment.gpuMemoryUsage}}class E extends T{}class M extends T{constructor(e,t){super(e,t),this.attachment=e,this.release=t}}function R(e,t,r){return`${e}x${t}x${r}`}var D;!function(e){e[e.RED=0]="RED",e[e.RG=1]="RG",e[e.RGBA4=2]="RGBA4",e[e.RGBA=3]="RGBA",e[e.RGBA_MIPMAP=4]="RGBA_MIPMAP",e[e.R16F=5]="R16F",e[e.RGBA16F=6]="RGBA16F"}(D||(D={}));const w=new m;w.pixelFormat=r.RED,w.internalFormat=o.R8,w.wrapMode=a.CLAMP_TO_EDGE;const f=new m;f.pixelFormat=r.RG,f.internalFormat=o.RG8,f.wrapMode=a.CLAMP_TO_EDGE;const C=new m;C.internalFormat=o.RGBA4,C.dataType=s.UNSIGNED_SHORT_4_4_4_4,C.wrapMode=a.CLAMP_TO_EDGE;const A=new m;A.wrapMode=a.CLAMP_TO_EDGE;const g=new m;g.wrapMode=a.CLAMP_TO_EDGE,g.samplingMode=h.LINEAR_MIPMAP_LINEAR,g.hasMipmap=!0,g.maxAnisotropy=8;const x=new m;x.pixelFormat=r.RED,x.dataType=s.HALF_FLOAT,x.internalFormat=o.R16F,x.samplingMode=h.NEAREST;const F=new m;F.dataType=s.HALF_FLOAT,F.internalFormat=o.RGBA16F,F.samplingMode=h.NEAREST;const y={[D.RED]:w,[D.RG]:f,[D.RGBA4]:C,[D.RGBA]:A,[D.RGBA_MIPMAP]:g,[D.R16F]:x,[D.RGBA16F]:F};var P;!function(e){e[e.DEPTH_STENCIL_TEXTURE=0]="DEPTH_STENCIL_TEXTURE",e[e.DEPTH24_BUFFER=1]="DEPTH24_BUFFER",e[e.DEPTH16_BUFFER=2]="DEPTH16_BUFFER"}(P||(P={}));const b=new m;b.pixelFormat=r.DEPTH_STENCIL,b.dataType=s.UNSIGNED_INT_24_8,b.samplingMode=h.NEAREST,b.wrapMode=a.CLAMP_TO_EDGE;const G={[P.DEPTH_STENCIL_TEXTURE]:b,[P.DEPTH24_BUFFER]:new p(c.DEPTH_COMPONENT24,4),[P.DEPTH16_BUFFER]:new p(c.DEPTH_COMPONENT16,4)};export{D as ColorFormat,P as DepthFormat,u as FBOCache};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{ColorFormat as e,DepthFormat as i}from"../core/FBOCache.js";import{TransparencyPassType as h}from"./TransparencyPassType.js";import{ClearBufferBit as r}from"../../../webgl/enums.js";import{ensureAttachmentMaxSize as s}from"../../../webgl/FramebufferObject.js";class o{constructor(t,e){this._fbos=t,this.compositingHelper=e,this._width=4,this._height=4}dispose(){this._color=t(this._color),this.releaseBuffers()}get framebuffer(){return this.color.detachDepth(),this.color.attachDepth(this.depth),this.color.fbo}get colorTexture(){return this.color.colorTexture}get depthTexture(){return this.depth.attachment}initializeFrame(t,e){const i=this._fbos.rctx;this._width=t.fullWidth,this._height=t.fullHeight,s(this,i.parameters.maxTextureSize);const h=this._color;return this._color=null,this.releaseBuffers(),this.bindFbo(),i.setClearStencil(0),i.setClearColor(e[0],e[1],e[2],e[3]),i.clearSafe(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT|r.STENCIL_BUFFER_BIT),h}releaseBuffers(){this._color?.detachDepth(),this._depth=t(this._depth)}renderHUDVisibility(t,i,h){return t?.fbo.width===this._width&&t?.fbo.height===this._height||(t?.release(),t=this._fbos.acquire(e.RGBA4,this._width,this._height)),t.attachDepth(h||this.depth),this._fbos.rctx.bindFramebuffer(t.fbo),this.renderToFBO(i,c),t.detachDepth(),t}compositeToHUDVisibility(t,e){this._fbos.rctx.bindFramebuffer(t.hudVisibility?.fbo),this.compositingHelper.compositeHUD(t,e)}renderOITPass(t,r,s){let o,c;switch(r){case h.Color:o=this._fbos.acquire(e.RGBA16F,this._width,this._height),c=[0,0,0,0];break;case h.Alpha:o=this._fbos.acquire(e.R16F,this._width,this._height),c=[1,1,1,1];break;case h.FrontFace:o=this._fbos.acquire(e.RGBA,this._width,this._height),c=[0,0,0,0]}return s?(o.acquireDepth(i.DEPTH16_BUFFER),this._fbos.rctx.bindFramebuffer(o.fbo),this.renderToFBO(t,c,!0,!0),o.releaseDepth()):(o.attachDepth(this.depth),this._fbos.rctx.bindFramebuffer(o.fbo),this.renderToFBO(t,c),o.detachDepth()),o}compositeToFramebuffer(t,e,i,h){this.bindFbo(),this.compositingHelper.composite(t,e,i,h)}compositeTransparentOntoOpaque(t,e,i,h,s){s?(this._fbos.rctx.bindFramebuffer(s.fbo),this._fbos.rctx.setClearColor(0,0,0,1e-13),this._fbos.rctx.clearSafe(r.COLOR_BUFFER_BIT)):this.bindFbo(),this.compositingHelper.compositeOIT(t,e.colorTexture,i.colorTexture,h.colorTexture)}renderDepthDetached(t){this._bindTarget(this.color),t(),this._bindTarget(this.color,this.depth)}renderToCachedFBO(h,r,s,o=e.RGBA,c=i.DEPTH16_BUFFER,a=this._width,_=this._height){return h?.fbo.width===a&&h?.fbo.height===_||(h=t(h)),h=h??this._fbos.acquire(o,a,_),null!=c&&h.acquireDepth(c),this._fbos.rctx.bindFramebuffer(h.fbo),this.renderToFBO(r,s,!0,!0),h}renderToFBO(t,e,i=!1,h=!1){const s=this._fbos.rctx;let o=0;if(e){const t=1e-13,i=Math.max(t,e[3]);s.setClearColor(e[0],e[1],e[2],i),o|=r.COLOR_BUFFER_BIT}i&&(o|=r.DEPTH_BUFFER_BIT),!1===h?h=0:(!0===h&&(h=255),o|=r.STENCIL_BUFFER_BIT),o&&s.clearSafe(o,h),t(),s.gl.flush()}renderToTargets(t,e,i,h,r=!1,s=!1){this._bindTarget(e,i),this.renderToFBO(t,h,r,s),e.detachDepth()}bindFbo(){this._bindTarget(this.color,this.depth)}_bindTarget(t,e){t.detachDepth(),t.attachDepth(e),this._fbos.rctx.bindFramebuffer(t.fbo)}get width(){return this._width}get height(){return this._height}get color(){return this._color||(this._color=this._fbos.acquire(e.RGBA,this._width,this._height)),this._color}get depth(){return this._depth||(this._depth=this._fbos.acquireDepth(i.DEPTH_STENCIL_TEXTURE,this._width,this._height)),this._depth}}const c=[0,1,0,1];export{o as OffscreenRendering};
5
+ import"../../../../core/has.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{ColorFormat as e,DepthFormat as i}from"../core/FBOCache.js";import{TransparencyPassType as h}from"./TransparencyPassType.js";import{ClearBufferBit as r}from"../../../webgl/enums.js";import{ensureAttachmentMaxSize as s}from"../../../webgl/FramebufferObject.js";class o{constructor(t,e){this._fbos=t,this.compositingHelper=e,this._width=4,this._height=4}dispose(){this._color=t(this._color),this.releaseBuffers()}get framebuffer(){return this.color.detachDepth(),this.color.attachDepth(this.depth),this.color.fbo}get colorTexture(){return this.color.colorTexture}get depthTexture(){return this.depth.attachment}initializeFrame(t,e){const i=this._fbos.rctx;this._width=t.fullWidth,this._height=t.fullHeight,s(this,i.parameters.maxTextureSize);const h=this._color;return this._color=null,this.releaseBuffers(),this.bindFbo(),i.setClearStencil(0),i.setClearColor(e[0],e[1],e[2],e[3]),i.clearSafe(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT|r.STENCIL_BUFFER_BIT),h}releaseBuffers(){this._color?.detachDepth(),this._depth=t(this._depth)}renderHUDVisibility(t,i,h){return t?.fbo.width===this._width&&t?.fbo.height===this._height||(t?.release(),t=this._fbos.acquire(e.RGBA4,this._width,this._height)),t.attachDepth(h||this.depth),this._fbos.rctx.bindFramebuffer(t.fbo),this.renderToFBO(i,c),t.detachDepth(),t}compositeToHUDVisibility(t,e){this._fbos.rctx.bindFramebuffer(t.hudVisibility?.fbo),this.compositingHelper.compositeHUD(t,e)}renderOITPass(t,r,s){let o,c;switch(r){case h.Color:o=this._fbos.acquire(e.RGBA16F,this._width,this._height),c=[0,0,0,0];break;case h.Alpha:o=this._fbos.acquire(e.R16F,this._width,this._height),c=[1,1,1,1];break;case h.FrontFace:o=this._fbos.acquire(e.RGBA,this._width,this._height),c=[0,0,0,0]}return s?(o.acquireDepth(i.DEPTH16_BUFFER),this._fbos.rctx.bindFramebuffer(o.fbo),this.renderToFBO(t,c,!0,!0),o.releaseDepth()):(o.attachDepth(this.depth),this._fbos.rctx.bindFramebuffer(o.fbo),this.renderToFBO(t,c),o.detachDepth()),o}compositeToFramebuffer(t,e,i,h){this.bindFbo(),this.compositingHelper.composite(t,e,i,h)}compositeTransparentOntoOpaque(t,e,i,h,s){s?(this._fbos.rctx.bindFramebuffer(s.fbo),this._fbos.rctx.setClearColor(0,0,0,1e-13),this._fbos.rctx.clearSafe(r.COLOR_BUFFER_BIT)):this.bindFbo(),this.compositingHelper.compositeOIT(t,e.colorTexture,i.colorTexture,h.colorTexture)}renderDepthDetached(t){this._bindTarget(this.color),t(),this._bindTarget(this.color,this.depth)}renderToCachedFBO(h,r,s,o=e.RGBA,c=i.DEPTH16_BUFFER,a=this._width,_=this._height,f=null){return h?.fbo.width===a&&h?.fbo.height===_||(h=t(h)),h=h??this._fbos.acquire(o,a,_),null!=c&&h.acquireDepth(c),f?.forEach((t=>{h.acquireColor(t.format,t.attachment)})),this._fbos.rctx.bindFramebuffer(h.fbo),this.renderToFBO(r,s,!0,!0),h}renderToFBO(t,e,i=!1,h=!1){const s=this._fbos.rctx;let o=0;if(e){const t=1e-13,i=Math.max(t,e[3]);s.setClearColor(e[0],e[1],e[2],i),o|=r.COLOR_BUFFER_BIT}i&&(o|=r.DEPTH_BUFFER_BIT),!1===h?h=0:(!0===h&&(h=255),o|=r.STENCIL_BUFFER_BIT),o&&s.clearSafe(o,h),t(),s.gl.flush()}renderToTargets(t,e,i,h,r=!1,s=!1){this._bindTarget(e,i),this.renderToFBO(t,h,r,s),e.detachDepth()}bindFbo(){this._bindTarget(this.color,this.depth)}_bindTarget(t,e){t.detachDepth(),t.attachDepth(e),this._fbos.rctx.bindFramebuffer(t.fbo)}get width(){return this._width}get height(){return this._height}get color(){return this._color||(this._color=this._fbos.acquire(e.RGBA,this._width,this._height)),this._color}get depth(){return this._depth||(this._depth=this._fbos.acquireDepth(i.DEPTH_STENCIL_TEXTURE,this._width,this._height)),this._depth}}const c=[0,1,0,1];export{o as OffscreenRendering};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- function t(t){return t}const u=t=>t*t,o=t=>1-u(1-t),i=t=>t<.5?u(2*t)/2:(o(2*(t-.5))+1)/2,n=t=>t*t*t,c=t=>1-n(1-t),a=t=>t<.5?n(2*t)/2:(c(2*(t-.5))+1)/2,s=t=>t*t*t*t,q=t=>1-s(1-t),r=t=>t<.5?s(2*t)/2:(q(2*(t-.5))+1)/2,e=t=>t*t*t*t*t,b=t=>1-e(1-t),d=t=>t<.5?e(2*t)/2:(b(2*(t-.5))+1)/2,h=t=>1-Math.cos(t*Math.PI/2),p=t=>1-h(1-t),x=t=>t<.5?h(2*t)/2:(p(2*(t-.5))+1)/2,M=t=>2**(10*(t-1)),f=t=>1-M(1-t),l=t=>t<.5?M(2*t)/2:(f(2*(t-.5))+1)/2,I=t=>-(Math.sqrt(1-t*t)-1),P=t=>1-I(1-t),g=t=>t<.5?I(2*t)/2:(P(2*(t-.5))+1)/2;function j(t){const u=2*(t-Math.sqrt((t-1)*t)),o=u/2/t;return i=>i<o?t*i*i:u*i-u+1}function k(t,u){return(o,i)=>o<u?u*t(o/u,i):1-t((1-o)/(1-u),i)*(1-u)}const m=k(j(1),1),v=k(j(1),0),w=k(j(1),.5),y=k(j(2),1),z=k(j(2),0),A=k(j(2),.5),B=k(j(3),1),C=k(j(3),0),D=k(j(3),.5),E=k(j(4),1),F=k(j(4),0),G=k(j(4),.5),H={linear:t,"in-quad":u,"out-quad":o,"in-out-quad":i,"in-coast-quad":m,"out-coast-quad":v,"in-out-coast-quad":w,"in-cubic":n,"out-cubic":c,"in-out-cubic":a,"in-coast-cubic":y,"out-coast-cubic":z,"in-out-coast-cubic":A,"in-quart":s,"out-quart":q,"in-out-quart":r,"in-coast-quart":B,"out-coast-quart":C,"in-out-coast-quart":D,"in-quint":e,"out-quint":b,"in-out-quint":d,"in-coast-quint":E,"out-coast-quint":F,"in-out-coast-quint":G,"in-sine":h,"out-sine":p,"in-out-sine":x,"in-expo":M,"out-expo":f,"in-out-expo":l,"in-circ":I,"out-circ":P,"in-out-circ":g};export{H as EasingFunctions,I as inCirc,y as inCoastCubic,m as inCoastQuad,B as inCoastQuart,E as inCoastQuint,n as inCubic,M as inExpo,g as inOutCirc,A as inOutCoastCubic,w as inOutCoastQuad,D as inOutCoastQuart,G as inOutCoastQuint,a as inOutCubic,l as inOutExpo,i as inOutQuad,r as inOutQuart,d as inOutQuint,x as inOutSine,u as inQuad,s as inQuart,e as inQuint,h as inSine,t as linear,P as outCirc,z as outCoastCubic,v as outCoastQuad,C as outCoastQuart,F as outCoastQuint,c as outCubic,f as outExpo,o as outQuad,q as outQuart,b as outQuint,p as outSine};
5
+ const t=t=>t,u=t=>t*t,o=t=>1-u(1-t),i=t=>t<.5?u(2*t)/2:(o(2*(t-.5))+1)/2,n=t=>t*t*t,c=t=>1-n(1-t),a=t=>t<.5?n(2*t)/2:(c(2*(t-.5))+1)/2,s=t=>t*t*t*t,q=t=>1-s(1-t),r=t=>t<.5?s(2*t)/2:(q(2*(t-.5))+1)/2,e=t=>t*t*t*t*t,b=t=>1-e(1-t),d=t=>t<.5?e(2*t)/2:(b(2*(t-.5))+1)/2,h=t=>1-Math.cos(t*Math.PI/2),p=t=>1-h(1-t),x=t=>t<.5?h(2*t)/2:(p(2*(t-.5))+1)/2,M=t=>2**(10*(t-1)),f=t=>1-M(1-t),l=t=>t<.5?M(2*t)/2:(f(2*(t-.5))+1)/2,I=t=>-(Math.sqrt(1-t*t)-1),P=t=>1-I(1-t),g=t=>t<.5?I(2*t)/2:(P(2*(t-.5))+1)/2;function j(t){const u=2*(t-Math.sqrt((t-1)*t)),o=u/2/t;return i=>i<o?t*i*i:u*i-u+1}function k(t,u){return(o,i)=>o<u?u*t(o/u,i):1-t((1-o)/(1-u),i)*(1-u)}const m=k(j(1),1),v=k(j(1),0),w=k(j(1),.5),y=k(j(2),1),z=k(j(2),0),A=k(j(2),.5),B=k(j(3),1),C=k(j(3),0),D=k(j(3),.5),E=k(j(4),1),F=k(j(4),0),G=k(j(4),.5),H={linear:t,"in-quad":u,"out-quad":o,"in-out-quad":i,"in-coast-quad":m,"out-coast-quad":v,"in-out-coast-quad":w,"in-cubic":n,"out-cubic":c,"in-out-cubic":a,"in-coast-cubic":y,"out-coast-cubic":z,"in-out-coast-cubic":A,"in-quart":s,"out-quart":q,"in-out-quart":r,"in-coast-quart":B,"out-coast-quart":C,"in-out-coast-quart":D,"in-quint":e,"out-quint":b,"in-out-quint":d,"in-coast-quint":E,"out-coast-quint":F,"in-out-coast-quint":G,"in-sine":h,"out-sine":p,"in-out-sine":x,"in-expo":M,"out-expo":f,"in-out-expo":l,"in-circ":I,"out-circ":P,"in-out-circ":g};export{H as EasingFunctions,I as inCirc,y as inCoastCubic,m as inCoastQuad,B as inCoastQuart,E as inCoastQuint,n as inCubic,M as inExpo,g as inOutCirc,A as inOutCoastCubic,w as inOutCoastQuad,D as inOutCoastQuart,G as inOutCoastQuint,a as inOutCubic,l as inOutExpo,i as inOutQuad,r as inOutQuart,d as inOutQuint,x as inOutSine,u as inQuad,s as inQuart,e as inQuint,h as inSine,t as linear,P as outCirc,z as outCoastCubic,v as outCoastQuad,C as outCoastQuart,F as outCoastQuint,c as outCubic,f as outExpo,o as outQuad,q as outQuart,b as outQuint,p as outSine};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Basemap.js";import s from"../../core/Collection.js";import i from"../../core/Loadable.js";import{watch as a,on as r,when as o}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import{cast as p}from"../../core/accessorSupport/decorators/cast.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{canProjectWithoutEngine as m,isLoaded as l,load as u}from"../../geometry/projection.js";import{equals as d}from"../../geometry/support/spatialReferenceUtils.js";import{contentEquals as h}from"../../support/basemapUtils.js";import{default3DCompatibility as f,default2DCompatibility as y}from"./support/basemapCompatibilityUtils.js";import v from"./support/BasemapGalleryItem.js";import b from"./support/LocalBasemapsSource.js";import B from"./support/PortalBasemapsSource.js";const g=s.ofType(v);function j(e){return e&&"esri.portal.Portal"===e.declaredClass}function w(e){return e&&!(e instanceof B)&&(!!e.portal||!!e.query)}function _(e){return e&&"basemaps"in e&&"state"in e&&"refresh"in e}let I=class extends i{constructor(e){super(e),this._loadingProjectionEngine=!1,this.includeCurrentBasemap=!1,this.items=new g,this.source=new B,this.view=null}initialize(){const e=()=>this._recreateItems();this.addHandles([a((()=>"ready"===this.state?this.compatibilityFunction:null),(()=>this._updateItems())),r((()=>this.source?.basemaps),"change",e,{onListenerAdd:e}),a((()=>this.includeCurrentBasemap),e),o((()=>this.items.every((e=>"loading"!==e.state))),e),o((()=>this.view),(()=>{this.source instanceof B&&(this.source.viewType=this.view?.type)}),{once:!0})])}destroy(){const e=this.source.basemaps.find((e=>e===this.activeBasemap));e&&this.source.basemaps.remove(e),this.source?.destroy()}get activeBasemap(){return this.view?.map?.basemap??null}set activeBasemap(e){const s=this.view;if(!s?.map)return;const i="string"==typeof e?t.fromId(e):e;if(!i||!s.ready)return s.map.basemap=i,void this._clearOverride("activeBasemap");const a=i.spatialReference||this.items?.find((e=>this.basemapEquals(i,e.basemap)))?.spatialReference;if(a&&"spatialReferenceLocked"in s&&!s.spatialReferenceLocked){const t=s.spatialReference;if(null!=a&&!d(t,a)&&!m(s.spatialReference,a)&&!l())return this._override("activeBasemap",i),this._loadingProjectionEngine=!0,void u().then((()=>{this._get("activeBasemap")===e&&(s.map.basemap=e,s.spatialReference=a,this._clearOverride("activeBasemap"))}),(()=>{})).then((()=>{this._loadingProjectionEngine=!1}));s.map.basemap=i,this._clearOverride("activeBasemap"),null==a||d(s.spatialReference,a)||(s.spatialReference=a)}else s.map.basemap=i,this._clearOverride("activeBasemap")}get activeBasemapIndex(){const{state:e,items:t,activeBasemap:s}=this;if("ready"!==e)return-1;const i=t.findIndex((e=>e.basemap===s));return-1===i?t.findIndex((e=>this.basemapEquals(e.basemap,s))):i}get compatibilityFunction(){return"3d"===this.view?.type?f:y}set compatibilityFunction(e){this._overrideIfSome("compatibilityFunction",e)}castSource(e){return Array.isArray(e)||s.isCollection(e)?new b({basemaps:e}):j(e)?new B({portal:e}):w(e)?new B(e):_(e)?e:null}get state(){return this.view?.ready&&this.source?this._loadingProjectionEngine?"loading":"ready":"disabled"}basemapEquals(e,t){return h(e,t)}refresh(){this._recreateItems()}load(e){return this.addResolvingPromise(i.isLoadable(this.source)?this.source.load(e):null),Promise.resolve(this)}_recreateItems(){const e=this.source?.basemaps,{view:t,compatibilityFunction:s}=this,i=new Map(this.items.map((e=>[e.basemap,e])));function a(e){const a=i.get(e);return a?(i.delete(e),a):new v({basemap:e,compatibilityFunction:s,view:t})}this.items.removeAll(),e&&this.items.addMany(e.map(a));const r=-1!==this.activeBasemapIndex;this.includeCurrentBasemap&&!r&&null!==this.activeBasemap&&this.items.unshift(a(this.activeBasemap)),i.forEach((e=>e.destroy()))}_updateItems(){for(const e of this.items)e.compatibilityFunction=this.compatibilityFunction,e.view=this.view}};e([n()],I.prototype,"_loadingProjectionEngine",void 0),e([n()],I.prototype,"activeBasemap",null),e([n({readOnly:!0})],I.prototype,"activeBasemapIndex",null),e([n()],I.prototype,"compatibilityFunction",null),e([n()],I.prototype,"includeCurrentBasemap",void 0),e([n({readOnly:!0,type:g})],I.prototype,"items",void 0),e([n()],I.prototype,"source",void 0),e([p("source")],I.prototype,"castSource",null),e([n({readOnly:!0})],I.prototype,"state",null),e([n()],I.prototype,"view",void 0),I=e([c("esri.widgets.BasemapGallery.BasemapGalleryViewModel")],I);const R=I;export{R as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Basemap.js";import i from"../../core/Collection.js";import s from"../../core/Loadable.js";import{watch as a,on as r,when as o}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import{cast as p}from"../../core/accessorSupport/decorators/cast.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as c}from"../../core/accessorSupport/decorators/subclass.js";import{canProjectWithoutEngine as m,isLoaded as l,load as u}from"../../geometry/projection.js";import{equals as d}from"../../geometry/support/spatialReferenceUtils.js";import{contentEquals as h}from"../../support/basemapUtils.js";import{default3DCompatibility as f,default2DCompatibility as v}from"./support/basemapCompatibilityUtils.js";import y from"./support/BasemapGalleryItem.js";import b from"./support/LocalBasemapsSource.js";import B from"./support/PortalBasemapsSource.js";const g=i.ofType(y);function _(e){return e&&"esri.portal.Portal"===e.declaredClass}function j(e){return e&&!(e instanceof B)&&(!!e.portal||!!e.query)}function w(e){return e&&"basemaps"in e&&"state"in e&&"refresh"in e}let I=class extends s{constructor(e){super(e),this._loadingProjectionEngine=!1,this._originalActiveBasemap=null,this.includeCurrentBasemap=!1,this.items=new g,this.source=new B,this.view=null}initialize(){const e=()=>this._recreateItems();this.addHandles([a((()=>this.view),(()=>{this._originalActiveBasemap=this.activeBasemap}),{initial:!0}),a((()=>"ready"===this.state?this.compatibilityFunction:null),(()=>this._updateItems())),r((()=>this.source?.basemaps),"change",e,{onListenerAdd:e}),a((()=>this.includeCurrentBasemap),e),o((()=>this.items.every((e=>"loading"!==e.state))),e),o((()=>this.view),(()=>{this.source instanceof B&&(this.source.viewType=this.view?.type)}),{once:!0})])}destroy(){const e=this.source.basemaps.find((e=>e===this.activeBasemap));e&&this.source.basemaps.remove(e),this.source?.destroy()}get activeBasemap(){return this.view?.map?.basemap??null}set activeBasemap(e){const i=this.view;if(!i?.map)return;const s="string"==typeof e?t.fromId(e):e;if(!s||!i.ready)return i.map.basemap=s,void this._clearOverride("activeBasemap");const a=s.spatialReference||this.items?.find((e=>this.basemapEquals(s,e.basemap)))?.spatialReference;if(a&&"spatialReferenceLocked"in i&&!i.spatialReferenceLocked){const t=i.spatialReference;if(null!=a&&!d(t,a)&&!m(i.spatialReference,a)&&!l())return this._override("activeBasemap",s),this._loadingProjectionEngine=!0,void u().then((()=>{this._get("activeBasemap")===e&&(i.map.basemap=e,i.spatialReference=a,this._clearOverride("activeBasemap"))}),(()=>{})).then((()=>{this._loadingProjectionEngine=!1}));i.map.basemap=s,this._clearOverride("activeBasemap"),null==a||d(i.spatialReference,a)||(i.spatialReference=a)}else i.map.basemap=s,this._clearOverride("activeBasemap")}get activeBasemapIndex(){const{state:e,activeBasemap:t}=this;return"ready"!==e?-1:this._findBasemapIndex(t)}get compatibilityFunction(){return"3d"===this.view?.type?f:v}set compatibilityFunction(e){this._overrideIfSome("compatibilityFunction",e)}castSource(e){return Array.isArray(e)||i.isCollection(e)?new b({basemaps:e}):_(e)?new B({portal:e}):j(e)?new B(e):w(e)?e:null}get state(){return this.view?.ready&&this.source?this._loadingProjectionEngine?"loading":"ready":"disabled"}basemapEquals(e,t){return h(e,t)}refresh(){this._recreateItems()}load(e){return this.addResolvingPromise(s.isLoadable(this.source)?this.source.load(e):null),Promise.resolve(this)}_findBasemapIndex(e){const{items:t}=this,i=t.findIndex((t=>t.basemap===e));return-1===i?t.findIndex((t=>this.basemapEquals(t.basemap,e))):i}_recreateItems(){const e=this.source?.basemaps,{view:t,compatibilityFunction:i}=this,s=new Map(this.items.map((e=>[e.basemap,e])));function a(e){const a=s.get(e);return a?(s.delete(e),a):new y({basemap:e,compatibilityFunction:i,view:t})}this.items.removeAll(),e&&this.items.addMany(e.map(a));const r=-1!==this._findBasemapIndex(this._originalActiveBasemap);this.includeCurrentBasemap&&!r&&null!=this._originalActiveBasemap&&this.items.unshift(a(this._originalActiveBasemap)),s.forEach((e=>e.destroy()))}_updateItems(){for(const e of this.items)e.compatibilityFunction=this.compatibilityFunction,e.view=this.view}};e([n()],I.prototype,"_loadingProjectionEngine",void 0),e([n()],I.prototype,"activeBasemap",null),e([n({readOnly:!0})],I.prototype,"activeBasemapIndex",null),e([n()],I.prototype,"compatibilityFunction",null),e([n()],I.prototype,"includeCurrentBasemap",void 0),e([n({readOnly:!0,type:g})],I.prototype,"items",void 0),e([n()],I.prototype,"source",void 0),e([p("source")],I.prototype,"castSource",null),e([n({readOnly:!0})],I.prototype,"state",null),e([n()],I.prototype,"view",void 0),I=e([c("esri.widgets.BasemapGallery.BasemapGalleryViewModel")],I);const R=I;export{R as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import{prefersReducedMotion as t}from"../../core/a11yUtils.js";import{eventKey as i}from"../../core/events.js";import{watch as r,initial as a}from"../../core/reactiveUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{getColorsFromRenderer as n}from"../../renderers/support/utils.js";import l from"../Widget.js";import d from"./FeatureMedia/FeatureMediaViewModel.js";import m from"./support/FeatureElementInfo.js";import{shouldOpenInNewTab as c}from"./support/featureUtils.js";import{loadCalciteComponents as p}from"../support/componentsUtils.js";import{isRTL as h}from"../support/widgetUtils.js";import{messageBundle as u}from"../support/decorators/messageBundle.js";import{tsx as f}from"../support/jsxFactory.js";import{isDarkTheme as _}from"../../support/themeUtils.js";import{substitute as v}from"../../intl/substitute.js";const M="esri-feature-media",g={base:M,mediaContainer:`${M}__container`,mediaItemContainer:`${M}__item-container`,mediaItem:`${M}__item`,mediaItemText:`${M}__item-text`,mediaItemTitle:`${M}__item-title`,mediaItemCaption:`${M}__item-caption`,mediaNavigation:`${M}__item-navigation`,mediaPagination:`${M}__pagination`,mediaPaginationText:`${M}__pagination-text`,mediaPrevious:`${M}__previous`,mediaPreviousIconLTR:`${M}__previous-icon`,mediaPreviousIconRTL:`${M}__previous-icon--rtl`,mediaNext:`${M}__next`,mediaNextIconLTR:`${M}__next-icon`,mediaNextIconRTL:`${M}__next-icon--rtl`,mediaChart:`${M}__chart`,mediaPaginationButton:`${M}__pagination-button`,mediaPaginationIcon:`${M}__pagination-icon`,mediaChartRendered:`${M}__chart--rendered`},w=15,I="category",A="value",y="rgba(50, 50, 50, 1)",C=250,x=500,T=200;let b=class extends l{constructor(e,t){super(e,t),this._refreshTimer=null,this._refreshIntervalInfo=null,this._featureElementInfo=null,this._chartRootMap=new WeakMap,this.viewModel=new d,this.messages=null,this._disposeChart=e=>{this._chartRootMap.get(e)?.dispose(),this._chartRootMap.delete(e)},this._createChart=async e=>{const{destroyed:t,viewModel:i}=this;if(t||!i||!e)return;const{createRoot:r}=await import("../support/chartUtilsAm5.js"),a=await r(e);this._chartRootMap.set(e,a),this._renderChart({mediaInfo:i.activeMediaInfo,root:a})}}initialize(){this._featureElementInfo=new m,this.addHandles([r((()=>[this.viewModel?.activeMediaInfo,this.viewModel?.activeMediaInfoIndex]),(()=>this._setupMediaRefreshTimer()),a),r((()=>[this.viewModel?.description,this.viewModel?.title]),(()=>this._setupFeatureElementInfo()),a)])}loadDependencies(){return p({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js")})}destroy(){this._clearMediaRefreshTimer(),this._featureElementInfo?.destroy()}get attributes(){return this.viewModel.attributes}set attributes(e){this.viewModel.attributes=e}get activeMediaInfoIndex(){return this.viewModel.activeMediaInfoIndex}set activeMediaInfoIndex(e){this.viewModel.activeMediaInfoIndex=e}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get fieldInfoMap(){return this.viewModel.fieldInfoMap}set fieldInfoMap(e){this.viewModel.fieldInfoMap=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get mediaInfos(){return this.viewModel.mediaInfos}set mediaInfos(e){this.viewModel.mediaInfos=e}get popupTemplate(){return this.viewModel.popupTemplate}set popupTemplate(e){this.viewModel.popupTemplate=e}get relatedInfos(){return this.viewModel.relatedInfos}set relatedInfos(e){this.viewModel.relatedInfos=e}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}render(){return f("div",{bind:this,class:g.base,onkeyup:this._handleMediaKeyup},this._featureElementInfo?.render(),this._renderMedia())}_renderMedia(){const{formattedMediaInfoCount:e,activeMediaInfoIndex:t}=this.viewModel,i=this._renderMediaText();return e?f("div",{key:"media-element-container",class:g.mediaContainer},this._renderMediaInfo(),f("div",{class:g.mediaNavigation},i,e>1?f("div",{class:g.mediaPagination},this._renderMediaPageButton("previous"),f("span",{class:g.mediaPaginationText},v(this.messages.pageText,{index:t+1,total:e})),this._renderMediaPageButton("next")):null)):null}_renderMediaText(){const{activeMediaInfo:e}=this.viewModel;if(!e)return null;const t=e&&e.title?f("div",{key:"media-title",class:g.mediaItemTitle,innerHTML:e.title}):null,i=e&&e.caption?f("div",{key:"media-caption",class:g.mediaItemCaption,innerHTML:e.caption}):null;return t||i?f("div",{key:"media-text",class:g.mediaItemText},t,i):null}_renderImageMediaInfo(e){const{_refreshIntervalInfo:t}=this,{activeMediaInfoIndex:i,formattedMediaInfoCount:r}=this.viewModel,{value:a,refreshInterval:s,altText:o,title:n,type:l}=e,{sourceURL:d,linkURL:m}=a,p=c(m??void 0)?"_blank":"_self",h="_blank"===p?"noreferrer":"",u=s?t:null,_=u?u.timestamp:0,v=u?u.sourceURL:d,M=f("img",{alt:o||n,key:`media-${l}-${i}-${r}-${_}`,src:v??void 0});return(m?f("a",{title:n,href:m,rel:h,target:p},M):null)??M}_renderChartMediaInfo(e){const{activeMediaInfoIndex:t,formattedMediaInfoCount:i}=this.viewModel;return f("div",{key:`media-${e.type}-${t}-${i}`,bind:this,class:g.mediaChart,afterCreate:this._createChart,afterRemoved:this._disposeChart})}_renderMediaInfoType(){const{activeMediaInfo:e}=this.viewModel;return e?"image"===e.type?this._renderImageMediaInfo(e):e.type.includes("chart")?this._renderChartMediaInfo(e):null:null}_renderMediaInfo(){const{activeMediaInfo:e}=this.viewModel;return e?f("div",{key:"media-container",class:g.mediaItemContainer},f("div",{key:"media-item-container",class:g.mediaItem},this._renderMediaInfoType())):null}_renderMediaPageButton(e){if(this.viewModel.formattedMediaInfoCount<2)return null;const t="previous"===e,i=t?this.messages.previous:this.messages.next,r=t?"chevron-left":"chevron-right",a=t?"media-previous":"media-next",s=t?this._previous:this._next;return f("button",{type:"button",key:a,title:i,"aria-label":i,tabIndex:0,class:g.mediaPaginationButton,bind:this,onclick:s},f("calcite-icon",{class:g.mediaPaginationIcon,scale:"s",icon:r}))}_setupFeatureElementInfo(){const{description:e,title:t}=this;this._featureElementInfo?.set({description:e,title:t})}_next(){this.viewModel.next()}_previous(){this.viewModel.previous()}_getRenderer(){if(!this.viewModel)return;const{isAggregate:e,layer:t}=this.viewModel;return e&&t?.featureReduction&&"renderer"in t.featureReduction?t.featureReduction.renderer:t?.renderer}async _getSeriesColors(e){const{colorAm5:t}=await import("./FeatureMedia/chartCommon.js"),i=new Map;return e.forEach((e=>{e.color&&i.set(e,t(e.color.toCss(!0)))})),i}async _getRendererColors(){const{colorAm5:e}=await import("./FeatureMedia/chartCommon.js"),t=new Map,i=this._getRenderer(),r="default";if(!i)return t;const a=await n(i);a.delete(r);return Array.from(a.values()).every((e=>1===e?.length))?(Array.from(a.keys()).forEach((i=>{const r=a.get(i)?.[0]?.toCss(!0);r&&t.set(i,e(r))})),t):t}_handleMediaKeyup(e){const t=i(e);"ArrowLeft"===t&&(e.stopPropagation(),this.viewModel.previous()),"ArrowRight"===t&&(e.stopPropagation(),this.viewModel.next())}_canAnimateChart(){return!!this.viewModel&&(!!this.viewModel.abilities.chartAnimation&&!t())}_getChartAnimationMS(){return this._canAnimateChart()?C:0}_getChartSeriesAnimationMS(){return this._canAnimateChart()?x:0}async _renderChart(e){const{root:t,mediaInfo:i}=e,{value:r,type:a}=i,{ResponsiveThemeAm5:s,DarkThemeAm5:o,AnimatedThemeAm5:n,ColorSetAm5:l,ThemeAm5:d,esriChartColorSet:m}=await import("./FeatureMedia/chartCommon.js"),c=d.new(t);c.rule("ColorSet").set("colors",m);const p=[s.new(t),c];_()&&p.push(o.new(t)),this._canAnimateChart()&&p.push(n.new(t)),t.setThemes(p);const h=await this._getRendererColors(),u=await this._getSeriesColors(r.series),f=l.new(t,{}),v=u.get(r.series[0]),M=v?{lineSettings:{stroke:v}}:void 0,g=r.series.map(((e,t)=>{const i=u.get(e)||h.get(e.fieldName)||f.getIndex(t);return{[I]:e.tooltip,[A]:e.value,columnSettings:{fill:i,stroke:i},...M}})).filter((e=>"pie-chart"!==a||null!=e.value&&e.value>0));"pie-chart"===a?this._createPieChart(e,g):this._createXYChart(e,g)}_getDirection(){return h(this.container)?"rtl":"ltr"}_isInversed(){return!!h(this.container)}async _customizeChartTooltip(e,t="horizontal"){const{colorAm5:i}=await import("./FeatureMedia/chartCommon.js");e.setAll({pointerOrientation:t}),e.get("background")?.setAll({stroke:i(y)}),e.label.setAll({direction:this._getDirection(),oversizedBehavior:"wrap",maxWidth:T})}async _createPieChart(e,t){const{TooltipAm5:i}=await import("./FeatureMedia/chartCommon.js"),{PieChartAm5:r,PieSeriesAm5:a}=await import("./FeatureMedia/pieChart.js"),{mediaInfo:s,root:o}=e,{title:n}=s,l=5,d=s?.altText||s?.title||"",m=o.container.children.push(r.new(o,{ariaLabel:d,focusable:!0,paddingBottom:l,paddingTop:l,paddingLeft:l,paddingRight:l})),c="{category}: {valuePercentTotal.formatNumber('0.00')}%\n ({value})",p=i.new(o,{labelText:c}),h=m.series.push(a.new(o,{name:n,valueField:A,categoryField:I,tooltip:p}));h.ticks.template.set("forceHidden",!0),h.labels.template.set("forceHidden",!0),h.slices.template.states.create("active",{shiftRadius:l}),this._customizeChartTooltip(p),h.slices.template.setAll({ariaLabel:c,focusable:!0,templateField:"columnSettings"}),h.data.setAll(t),h.appear(this._getChartSeriesAnimationMS()),m.appear(this._getChartAnimationMS()),m.root.dom.classList.toggle(g.mediaChartRendered,!0)}_getMinSeriesValue(e){let t=0;return e.forEach((e=>t=Math.min(e.value,t))),t}async _createColumnChart(e,t,i){const{TooltipAm5:r,ScrollbarAm5:a}=await import("./FeatureMedia/chartCommon.js"),{CategoryAxisAm5:s,AxisRendererXAm5:o,ValueAxisAm5:n,AxisRendererYAm5:l,ColumnSeriesAm5:d}=await import("./FeatureMedia/xyChart.js"),{mediaInfo:m,root:c}=t,{value:p,title:h}=m;e.setAll({wheelX:"panX",wheelY:"zoomX"});const u=e.xAxes.push(s.new(c,{renderer:o.new(c,{inversed:this._isInversed()}),categoryField:I}));u.get("renderer").labels.template.setAll({forceHidden:!0});const f=e.yAxes.push(n.new(c,{renderer:l.new(c,{inside:!1}),min:this._getMinSeriesValue(p.series)}));f.get("renderer").labels.template.setAll({direction:this._getDirection()});const _="{categoryX}",v=r.new(c,{labelText:_}),M=e.series.push(d.new(c,{name:h,xAxis:u,yAxis:f,valueYField:A,categoryXField:I,tooltip:v}));this._customizeChartTooltip(v),M.columns.template.setAll({ariaLabel:_,focusable:!0,templateField:"columnSettings"}),p.series.length>w&&e.set("scrollbarX",a.new(c,{orientation:"horizontal"})),u.data.setAll(i),M.data.setAll(i),M.appear(this._getChartSeriesAnimationMS()),e.appear(this._getChartAnimationMS())}async _createBarChart(e,t,i){const{TooltipAm5:r,ScrollbarAm5:a}=await import("./FeatureMedia/chartCommon.js"),{CategoryAxisAm5:s,AxisRendererXAm5:o,ValueAxisAm5:n,AxisRendererYAm5:l,ColumnSeriesAm5:d}=await import("./FeatureMedia/xyChart.js"),{mediaInfo:m,root:c}=t,{value:p,title:h}=m;e.setAll({wheelX:"panY",wheelY:"zoomY"});const u=e.yAxes.push(s.new(c,{renderer:l.new(c,{inversed:!0}),categoryField:I}));u.get("renderer").labels.template.setAll({forceHidden:!0});const f=e.xAxes.push(n.new(c,{renderer:o.new(c,{inside:!1,inversed:this._isInversed()}),min:this._getMinSeriesValue(p.series)}));f.get("renderer").labels.template.setAll({direction:this._getDirection()});const _="{categoryY}",v=r.new(c,{labelText:_}),M=e.series.push(d.new(c,{name:h,xAxis:f,yAxis:u,valueXField:A,categoryYField:I,tooltip:v}));this._customizeChartTooltip(v,"vertical"),M.columns.template.setAll({ariaLabel:_,focusable:!0,templateField:"columnSettings"}),p.series.length>w&&e.set("scrollbarY",a.new(c,{orientation:"vertical"})),u.data.setAll(i),M.data.setAll(i),M.appear(this._getChartSeriesAnimationMS()),e.appear(this._getChartAnimationMS())}async _createLineChart(e,t,i){const{TooltipAm5:r,ScrollbarAm5:a}=await import("./FeatureMedia/chartCommon.js"),{CategoryAxisAm5:s,AxisRendererXAm5:o,ValueAxisAm5:n,AxisRendererYAm5:l,LineSeriesAm5:d}=await import("./FeatureMedia/xyChart.js"),{root:m,mediaInfo:c}=t,{value:p,title:h}=c;e.setAll({wheelX:"panX",wheelY:"zoomX"});const u=e.xAxes.push(s.new(m,{renderer:o.new(m,{inversed:this._isInversed()}),categoryField:I}));u.get("renderer").labels.template.setAll({forceHidden:!0});const f=e.yAxes.push(n.new(m,{renderer:l.new(m,{inside:!1}),min:this._getMinSeriesValue(p.series)}));f.get("renderer").labels.template.setAll({direction:this._getDirection()});const _="{categoryX}",v=r.new(m,{labelText:_}),M=e.series.push(d.new(m,{name:h,xAxis:u,yAxis:f,valueYField:A,categoryXField:I,tooltip:v}));M.strokes.template.setAll({templateField:"lineSettings"}),this._customizeChartTooltip(v,"vertical"),p.series.length>w&&e.set("scrollbarX",a.new(m,{orientation:"horizontal"})),u.data.setAll(i),M.data.setAll(i),M.appear(this._getChartSeriesAnimationMS()),e.appear(this._getChartAnimationMS())}async _createXYChart(e,t){const{XYChartAm5:i,XYCursorAm5:r}=await import("./FeatureMedia/xyChart.js"),{root:a,mediaInfo:s}=e,{type:o}=s,n=s?.altText||s?.title||"",l=a.container.children.push(i.new(a,{ariaLabel:n,focusable:!0,panX:!0,panY:!0}));l.set("cursor",r.new(a,{})),"column-chart"===o&&await this._createColumnChart(l,e,t),"bar-chart"===o&&await this._createBarChart(l,e,t),"line-chart"===o&&await this._createLineChart(l,e,t),l.root.dom.classList.toggle(g.mediaChartRendered,!0)}_clearMediaRefreshTimer(){const{_refreshTimer:e}=this;e&&(clearTimeout(e),this._refreshTimer=null)}_updateMediaInfoTimestamp(e){const t=Date.now();this._refreshIntervalInfo={timestamp:t,sourceURL:e&&this._getImageSource(e,t)}}_setupMediaRefreshTimer(){this._clearMediaRefreshTimer();const{activeMediaInfo:e}=this.viewModel;e&&"image"===e.type&&e.refreshInterval&&this._setRefreshTimeout(e)}_setRefreshTimeout(e){const{refreshInterval:t,value:i}=e;if(!t)return;const r=6e4*t;this._updateMediaInfoTimestamp(i.sourceURL);const a=setInterval((()=>{this._updateMediaInfoTimestamp(i.sourceURL)}),r);this._refreshTimer=a}_getImageSource(e,t){const i=e.includes("?")?"&":"?",[r,a=""]=e.split("#");return`${r}${i}timestamp=${t}${a?"#":""}${a}`}};e([s()],b.prototype,"_refreshIntervalInfo",void 0),e([s()],b.prototype,"attributes",null),e([s()],b.prototype,"activeMediaInfoIndex",null),e([s()],b.prototype,"description",null),e([s()],b.prototype,"fieldInfoMap",null),e([s()],b.prototype,"layer",null),e([s()],b.prototype,"mediaInfos",null),e([s()],b.prototype,"popupTemplate",null),e([s()],b.prototype,"relatedInfos",null),e([s()],b.prototype,"title",null),e([s({type:d})],b.prototype,"viewModel",void 0),e([s(),u("esri/widgets/Feature/t9n/Feature")],b.prototype,"messages",void 0),b=e([o("esri.widgets.Feature.FeatureMedia")],b);const R=b;export{R as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import"../../intl.js";import{prefersReducedMotion as t}from"../../core/a11yUtils.js";import{eventKey as i}from"../../core/events.js";import{watch as r,initial as a}from"../../core/reactiveUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import{getColorsFromRenderer as n}from"../../renderers/support/utils.js";import l from"../Widget.js";import d from"./FeatureMedia/FeatureMediaViewModel.js";import m from"./support/FeatureElementInfo.js";import{shouldOpenInNewTab as c}from"./support/featureUtils.js";import{loadCalciteComponents as p}from"../support/componentsUtils.js";import{isRTL as h}from"../support/widgetUtils.js";import{messageBundle as u}from"../support/decorators/messageBundle.js";import{tsx as f}from"../support/jsxFactory.js";import{isDarkTheme as _}from"../../support/themeUtils.js";import{substitute as v}from"../../intl/substitute.js";const M="esri-feature-media",g={base:M,mediaContainer:`${M}__container`,mediaItemContainer:`${M}__item-container`,mediaItem:`${M}__item`,mediaItemText:`${M}__item-text`,mediaItemTitle:`${M}__item-title`,mediaItemCaption:`${M}__item-caption`,mediaNavigation:`${M}__item-navigation`,mediaPagination:`${M}__pagination`,mediaPaginationText:`${M}__pagination-text`,mediaPrevious:`${M}__previous`,mediaPreviousIconLTR:`${M}__previous-icon`,mediaPreviousIconRTL:`${M}__previous-icon--rtl`,mediaNext:`${M}__next`,mediaNextIconLTR:`${M}__next-icon`,mediaNextIconRTL:`${M}__next-icon--rtl`,mediaChart:`${M}__chart`,mediaPaginationButton:`${M}__pagination-button`,mediaPaginationIcon:`${M}__pagination-icon`,mediaChartRendered:`${M}__chart--rendered`},w=15,I="category",A="value",y="rgba(50, 50, 50, 1)",C=250,x=500,T=200;let b=class extends l{constructor(e,t){super(e,t),this._refreshTimer=null,this._refreshIntervalInfo=null,this._featureElementInfo=null,this._chartRootMap=new WeakMap,this.viewModel=new d,this.messages=null,this._disposeChart=e=>{this._chartRootMap.get(e)?.dispose(),this._chartRootMap.delete(e)},this._createChart=async e=>{const{destroyed:t,viewModel:i}=this;if(t||!i||!e)return;const{createRoot:r}=await import("../support/chartUtilsAm5.js"),a=await r(e);this._chartRootMap.set(e,a),this._renderChart({mediaInfo:i.activeMediaInfo,root:a})}}initialize(){this._featureElementInfo=new m,this.addHandles([r((()=>[this.viewModel?.activeMediaInfo,this.viewModel?.activeMediaInfoIndex]),(()=>this._setupMediaRefreshTimer()),a),r((()=>[this.viewModel?.description,this.viewModel?.title]),(()=>this._setupFeatureElementInfo()),a)])}loadDependencies(){return p({icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js")})}destroy(){this._clearMediaRefreshTimer(),this._featureElementInfo?.destroy()}get attributes(){return this.viewModel.attributes}set attributes(e){this.viewModel.attributes=e}get activeMediaInfoIndex(){return this.viewModel.activeMediaInfoIndex}set activeMediaInfoIndex(e){this.viewModel.activeMediaInfoIndex=e}get description(){return this.viewModel.description}set description(e){this.viewModel.description=e}get fieldInfoMap(){return this.viewModel.fieldInfoMap}set fieldInfoMap(e){this.viewModel.fieldInfoMap=e}get layer(){return this.viewModel.layer}set layer(e){this.viewModel.layer=e}get mediaInfos(){return this.viewModel.mediaInfos}set mediaInfos(e){this.viewModel.mediaInfos=e}get popupTemplate(){return this.viewModel.popupTemplate}set popupTemplate(e){this.viewModel.popupTemplate=e}get relatedInfos(){return this.viewModel.relatedInfos}set relatedInfos(e){this.viewModel.relatedInfos=e}get title(){return this.viewModel.title}set title(e){this.viewModel.title=e}render(){return f("div",{bind:this,class:g.base,onkeyup:this._handleMediaKeyup},this._featureElementInfo?.render(),this._renderMedia())}_renderMedia(){const{formattedMediaInfoCount:e,activeMediaInfoIndex:t}=this.viewModel,i=this._renderMediaText();return e?f("div",{key:"media-element-container",class:g.mediaContainer},this._renderMediaInfo(),f("div",{class:g.mediaNavigation},i,e>1?f("div",{class:g.mediaPagination},this._renderMediaPageButton("previous"),f("span",{class:g.mediaPaginationText},v(this.messages.pageText,{index:t+1,total:e})),this._renderMediaPageButton("next")):null)):null}_renderMediaText(){const{activeMediaInfo:e}=this.viewModel;if(!e)return null;const t=e&&e.title?f("div",{key:"media-title",class:g.mediaItemTitle,innerHTML:e.title}):null,i=e&&e.caption?f("div",{key:"media-caption",class:g.mediaItemCaption,innerHTML:e.caption}):null;return t||i?f("div",{key:"media-text",class:g.mediaItemText},t,i):null}_renderImageMediaInfo(e){const{_refreshIntervalInfo:t}=this,{activeMediaInfoIndex:i,formattedMediaInfoCount:r}=this.viewModel,{value:a,refreshInterval:s,altText:o,title:n,type:l}=e,{sourceURL:d,linkURL:m}=a,p=c(m??void 0)?"_blank":"_self",h="_blank"===p?"noreferrer":"",u=s?t:null,_=u?u.timestamp:0,v=u?u.sourceURL:d,M=f("img",{alt:o||n,key:`media-${l}-${i}-${r}-${_}`,src:v??void 0});return(m?f("a",{title:n,href:m,rel:h,target:p},M):null)??M}_renderChartMediaInfo(e){const{activeMediaInfoIndex:t,formattedMediaInfoCount:i}=this.viewModel;return f("div",{key:`media-${e.type}-${t}-${i}`,bind:this,class:g.mediaChart,afterCreate:this._createChart,afterRemoved:this._disposeChart})}_renderMediaInfoType(){const{activeMediaInfo:e}=this.viewModel;return e?"image"===e.type?this._renderImageMediaInfo(e):e.type.includes("chart")?this._renderChartMediaInfo(e):null:null}_renderMediaInfo(){const{activeMediaInfo:e}=this.viewModel;return e?f("div",{key:"media-container",class:g.mediaItemContainer},f("div",{key:"media-item-container",class:g.mediaItem},this._renderMediaInfoType())):null}_renderMediaPageButton(e){if(this.viewModel.formattedMediaInfoCount<2)return null;const t="previous"===e,i=t?this.messages.previous:this.messages.next,r=t?"chevron-left":"chevron-right",a=t?"media-previous":"media-next",s=t?this._previous:this._next;return f("button",{type:"button",key:a,title:i,"aria-label":i,tabIndex:0,class:g.mediaPaginationButton,bind:this,onclick:s},f("calcite-icon",{class:g.mediaPaginationIcon,scale:"s",icon:r}))}_setupFeatureElementInfo(){const{description:e,title:t}=this;this._featureElementInfo?.set({description:e,title:t})}_next(){this.viewModel.next()}_previous(){this.viewModel.previous()}_getRenderer(){if(!this.viewModel)return;const{isAggregate:e,layer:t}=this.viewModel;return e&&t?.featureReduction&&"renderer"in t.featureReduction?t.featureReduction.renderer:t?.renderer}async _getSeriesColors(e){const{colorAm5:t}=await import("./FeatureMedia/chartCommon.js"),i=new Map;return e.forEach((e=>{e.color&&i.set(e,t(e.color.toCss(!0)))})),i}async _getRendererColors(){const{colorAm5:e}=await import("./FeatureMedia/chartCommon.js"),t=new Map,i=this._getRenderer(),r="default";if(!i)return t;const a=await n(i);a.delete(r);return Array.from(a.values()).every((e=>1===e?.length))?(Array.from(a.keys()).forEach((i=>{const r=a.get(i)?.[0]?.toCss(!0);r&&t.set(i,e(r))})),t):t}_handleMediaKeyup(e){const t=i(e);"ArrowLeft"===t&&(e.stopPropagation(),this.viewModel.previous()),"ArrowRight"===t&&(e.stopPropagation(),this.viewModel.next())}_canAnimateChart(){return!!this.viewModel&&(!!this.viewModel.abilities.chartAnimation&&!t())}_getChartAnimationMS(){return this._canAnimateChart()?C:0}_getChartSeriesAnimationMS(){return this._canAnimateChart()?x:0}async _renderChart(e){const{root:t,mediaInfo:i}=e,{value:r,type:a}=i,{ResponsiveThemeAm5:s,DarkThemeAm5:o,AnimatedThemeAm5:n,ColorSetAm5:l,ThemeAm5:d,esriChartColorSet:m}=await import("./FeatureMedia/chartCommon.js"),c=d.new(t);c.rule("ColorSet").set("colors",m),c.rule("ColorSet").set("reuse",!0);const p=[s.new(t),c];_()&&p.push(o.new(t)),this._canAnimateChart()&&p.push(n.new(t)),t.setThemes(p);const h=await this._getRendererColors(),u=await this._getSeriesColors(r.series),f=l.new(t,{}),v=u.get(r.series[0]),M=v?{lineSettings:{stroke:v}}:void 0,g=r.series.map(((e,t)=>{const i=u.get(e)||h.get(e.fieldName)||f.getIndex(t);return{[I]:e.tooltip,[A]:e.value,columnSettings:{fill:i,stroke:i},...M}})).filter((e=>"pie-chart"!==a||null!=e.value&&e.value>0));"pie-chart"===a?this._createPieChart(e,g):this._createXYChart(e,g)}_getDirection(){return h(this.container)?"rtl":"ltr"}_isInversed(){return!!h(this.container)}async _customizeChartTooltip(e,t="horizontal"){const{colorAm5:i}=await import("./FeatureMedia/chartCommon.js");e.setAll({pointerOrientation:t}),e.get("background")?.setAll({stroke:i(y)}),e.label.setAll({direction:this._getDirection(),oversizedBehavior:"wrap",maxWidth:T})}async _createPieChart(e,t){const{TooltipAm5:i}=await import("./FeatureMedia/chartCommon.js"),{PieChartAm5:r,PieSeriesAm5:a}=await import("./FeatureMedia/pieChart.js"),{mediaInfo:s,root:o}=e,{title:n}=s,l=5,d=s?.altText||s?.title||"",m=o.container.children.push(r.new(o,{ariaLabel:d,focusable:!0,paddingBottom:l,paddingTop:l,paddingLeft:l,paddingRight:l})),c="{category}: {valuePercentTotal.formatNumber('0.00')}%\n ({value})",p=i.new(o,{labelText:c}),h=m.series.push(a.new(o,{name:n,valueField:A,categoryField:I,tooltip:p}));h.ticks.template.set("forceHidden",!0),h.labels.template.set("forceHidden",!0),h.slices.template.states.create("active",{shiftRadius:l}),this._customizeChartTooltip(p),h.slices.template.setAll({ariaLabel:c,focusable:!0,templateField:"columnSettings"}),h.data.setAll(t),h.appear(this._getChartSeriesAnimationMS()),m.appear(this._getChartAnimationMS()),m.root.dom.classList.toggle(g.mediaChartRendered,!0)}_getMinSeriesValue(e){let t=0;return e.forEach((e=>t=Math.min(e.value,t))),t}async _createColumnChart(e,t,i){const{TooltipAm5:r,ScrollbarAm5:a}=await import("./FeatureMedia/chartCommon.js"),{CategoryAxisAm5:s,AxisRendererXAm5:o,ValueAxisAm5:n,AxisRendererYAm5:l,ColumnSeriesAm5:d}=await import("./FeatureMedia/xyChart.js"),{mediaInfo:m,root:c}=t,{value:p,title:h}=m;e.setAll({wheelX:"panX",wheelY:"zoomX"});const u=e.xAxes.push(s.new(c,{renderer:o.new(c,{inversed:this._isInversed()}),categoryField:I}));u.get("renderer").labels.template.setAll({forceHidden:!0});const f=e.yAxes.push(n.new(c,{renderer:l.new(c,{inside:!1}),min:this._getMinSeriesValue(p.series)}));f.get("renderer").labels.template.setAll({direction:this._getDirection()});const _="{categoryX}",v=r.new(c,{labelText:_}),M=e.series.push(d.new(c,{name:h,xAxis:u,yAxis:f,valueYField:A,categoryXField:I,tooltip:v}));this._customizeChartTooltip(v),M.columns.template.setAll({ariaLabel:_,focusable:!0,templateField:"columnSettings"}),p.series.length>w&&e.set("scrollbarX",a.new(c,{orientation:"horizontal"})),u.data.setAll(i),M.data.setAll(i),M.appear(this._getChartSeriesAnimationMS()),e.appear(this._getChartAnimationMS())}async _createBarChart(e,t,i){const{TooltipAm5:r,ScrollbarAm5:a}=await import("./FeatureMedia/chartCommon.js"),{CategoryAxisAm5:s,AxisRendererXAm5:o,ValueAxisAm5:n,AxisRendererYAm5:l,ColumnSeriesAm5:d}=await import("./FeatureMedia/xyChart.js"),{mediaInfo:m,root:c}=t,{value:p,title:h}=m;e.setAll({wheelX:"panY",wheelY:"zoomY"});const u=e.yAxes.push(s.new(c,{renderer:l.new(c,{inversed:!0}),categoryField:I}));u.get("renderer").labels.template.setAll({forceHidden:!0});const f=e.xAxes.push(n.new(c,{renderer:o.new(c,{inside:!1,inversed:this._isInversed()}),min:this._getMinSeriesValue(p.series)}));f.get("renderer").labels.template.setAll({direction:this._getDirection()});const _="{categoryY}",v=r.new(c,{labelText:_}),M=e.series.push(d.new(c,{name:h,xAxis:f,yAxis:u,valueXField:A,categoryYField:I,tooltip:v}));this._customizeChartTooltip(v,"vertical"),M.columns.template.setAll({ariaLabel:_,focusable:!0,templateField:"columnSettings"}),p.series.length>w&&e.set("scrollbarY",a.new(c,{orientation:"vertical"})),u.data.setAll(i),M.data.setAll(i),M.appear(this._getChartSeriesAnimationMS()),e.appear(this._getChartAnimationMS())}async _createLineChart(e,t,i){const{TooltipAm5:r,ScrollbarAm5:a}=await import("./FeatureMedia/chartCommon.js"),{CategoryAxisAm5:s,AxisRendererXAm5:o,ValueAxisAm5:n,AxisRendererYAm5:l,LineSeriesAm5:d}=await import("./FeatureMedia/xyChart.js"),{root:m,mediaInfo:c}=t,{value:p,title:h}=c;e.setAll({wheelX:"panX",wheelY:"zoomX"});const u=e.xAxes.push(s.new(m,{renderer:o.new(m,{inversed:this._isInversed()}),categoryField:I}));u.get("renderer").labels.template.setAll({forceHidden:!0});const f=e.yAxes.push(n.new(m,{renderer:l.new(m,{inside:!1}),min:this._getMinSeriesValue(p.series)}));f.get("renderer").labels.template.setAll({direction:this._getDirection()});const _="{categoryX}",v=r.new(m,{labelText:_}),M=e.series.push(d.new(m,{name:h,xAxis:u,yAxis:f,valueYField:A,categoryXField:I,tooltip:v}));M.strokes.template.setAll({templateField:"lineSettings"}),this._customizeChartTooltip(v,"vertical"),p.series.length>w&&e.set("scrollbarX",a.new(m,{orientation:"horizontal"})),u.data.setAll(i),M.data.setAll(i),M.appear(this._getChartSeriesAnimationMS()),e.appear(this._getChartAnimationMS())}async _createXYChart(e,t){const{XYChartAm5:i,XYCursorAm5:r}=await import("./FeatureMedia/xyChart.js"),{root:a,mediaInfo:s}=e,{type:o}=s,n=s?.altText||s?.title||"",l=a.container.children.push(i.new(a,{ariaLabel:n,focusable:!0,panX:!0,panY:!0}));l.set("cursor",r.new(a,{})),"column-chart"===o&&await this._createColumnChart(l,e,t),"bar-chart"===o&&await this._createBarChart(l,e,t),"line-chart"===o&&await this._createLineChart(l,e,t),l.root.dom.classList.toggle(g.mediaChartRendered,!0)}_clearMediaRefreshTimer(){const{_refreshTimer:e}=this;e&&(clearTimeout(e),this._refreshTimer=null)}_updateMediaInfoTimestamp(e){const t=Date.now();this._refreshIntervalInfo={timestamp:t,sourceURL:e&&this._getImageSource(e,t)}}_setupMediaRefreshTimer(){this._clearMediaRefreshTimer();const{activeMediaInfo:e}=this.viewModel;e&&"image"===e.type&&e.refreshInterval&&this._setRefreshTimeout(e)}_setRefreshTimeout(e){const{refreshInterval:t,value:i}=e;if(!t)return;const r=6e4*t;this._updateMediaInfoTimestamp(i.sourceURL);const a=setInterval((()=>{this._updateMediaInfoTimestamp(i.sourceURL)}),r);this._refreshTimer=a}_getImageSource(e,t){const i=e.includes("?")?"&":"?",[r,a=""]=e.split("#");return`${r}${i}timestamp=${t}${a?"#":""}${a}`}};e([s()],b.prototype,"_refreshIntervalInfo",void 0),e([s()],b.prototype,"attributes",null),e([s()],b.prototype,"activeMediaInfoIndex",null),e([s()],b.prototype,"description",null),e([s()],b.prototype,"fieldInfoMap",null),e([s()],b.prototype,"layer",null),e([s()],b.prototype,"mediaInfos",null),e([s()],b.prototype,"popupTemplate",null),e([s()],b.prototype,"relatedInfos",null),e([s()],b.prototype,"title",null),e([s({type:d})],b.prototype,"viewModel",void 0),e([s(),u("esri/widgets/Feature/t9n/Feature")],b.prototype,"messages",void 0),b=e([o("esri.widgets.Feature.FeatureMedia")],b);const R=b;export{R as default};