@arcgis/core 5.2.0-next.127 → 5.2.0-next.128

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 (132) hide show
  1. package/WebScene.js +1 -1
  2. package/applications/SceneViewer/sceneViewerUtils.d.ts +14 -1
  3. package/applications/SceneViewer/sceneViewerUtils.js +1 -1
  4. package/applications/WebEditor/sketchUtils.js +1 -1
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/038d2b80d96237c25b6f.js +1 -0
  7. package/assets/esri/core/workers/chunks/3f045f09ac95e7f22a97.js +1 -0
  8. package/assets/esri/core/workers/chunks/500f6d6f0ffa235cae85.js +1 -0
  9. package/assets/esri/core/workers/chunks/{e6637f9176566382ed3e.js → 606cca69eaea84bfcdc6.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{26995de0c18bef8db590.js → 6267a1fe1603daa399b4.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{2c7fc24649d91552e68a.js → 67fd2cdb2e6834bfa710.js} +1 -1
  12. package/assets/esri/core/workers/chunks/{50c29d10ec53f0e48e8a.js → 75294f515c7f8393181c.js} +1 -1
  13. package/assets/esri/core/workers/chunks/761ea719ec1b4d562db2.js +1 -0
  14. package/assets/esri/core/workers/chunks/89dad6c1bfd81e4d7f8e.js +1 -0
  15. package/assets/esri/core/workers/chunks/{8daed13400d9e63e65ae.js → 8a842cde240aef12e417.js} +1 -1
  16. package/assets/esri/core/workers/chunks/92509dd25996c6390a31.js +1 -0
  17. package/assets/esri/core/workers/chunks/9ccc2c8f7416943cc373.js +29 -0
  18. package/assets/esri/core/workers/chunks/a0a9c41400ae98df1912.js +1 -0
  19. package/assets/esri/core/workers/chunks/d1187ad6cc4959683819.js +1 -0
  20. package/assets/esri/core/workers/chunks/d94a2b3b2ef49af9c2e3.js +1 -0
  21. package/assets/esri/core/workers/chunks/ec187933b42fe65594b7.js +1 -0
  22. package/assets/esri/core/workers/chunks/eec5a93dbc258a90b6de.js +1 -0
  23. package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-arabic.woff2 +0 -0
  24. package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-cyrillic.woff2 +0 -0
  25. package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-ext.woff2 +0 -0
  26. package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-georgian.woff2 +0 -0
  27. package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-greek.woff2 +0 -0
  28. package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-hebrew.woff2 +0 -0
  29. package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-math.woff2 +0 -0
  30. package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-thai.woff2 +0 -0
  31. package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02-vietnamese.woff2 +0 -0
  32. package/assets/esri/themes/base/fonts/fonts/09ab0626-bb45-4650-acc8-0182d693df02.woff2 +0 -0
  33. package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-arabic.woff2 +0 -0
  34. package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-cyrillic.woff2 +0 -0
  35. package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-ext.woff2 +0 -0
  36. package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-georgian.woff2 +0 -0
  37. package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-greek.woff2 +0 -0
  38. package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-hebrew.woff2 +0 -0
  39. package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-math.woff2 +0 -0
  40. package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-thai.woff2 +0 -0
  41. package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7-vietnamese.woff2 +0 -0
  42. package/assets/esri/themes/base/fonts/fonts/0c8a5d21-8a14-4451-8145-695071809cb7.woff2 +0 -0
  43. package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-arabic.woff2 +0 -0
  44. package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-cyrillic.woff2 +0 -0
  45. package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-ext.woff2 +0 -0
  46. package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-georgian.woff2 +0 -0
  47. package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-greek.woff2 +0 -0
  48. package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-hebrew.woff2 +0 -0
  49. package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-math.woff2 +0 -0
  50. package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-thai.woff2 +0 -0
  51. package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688-vietnamese.woff2 +0 -0
  52. package/assets/esri/themes/base/fonts/fonts/12f4c786-0bef-4a48-b7c0-eebaa7591688.woff2 +0 -0
  53. package/assets/esri/themes/base/fonts/fonts/3ae1e25e-3aa6-4061-a016-a079159f9d65.woff2 +0 -0
  54. package/assets/esri/themes/base/fonts/fonts/41331c3c-3759-4462-8695-33c9a21b6a5b.woff2 +0 -0
  55. package/assets/esri/themes/base/fonts/fonts/94aa531e-7746-4df0-bb6e-349891f2eda5.woff2 +0 -0
  56. package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-arabic.woff2 +0 -0
  57. package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-cyrillic.woff2 +0 -0
  58. package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-ext.woff2 +0 -0
  59. package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-georgian.woff2 +0 -0
  60. package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-greek.woff2 +0 -0
  61. package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-hebrew.woff2 +0 -0
  62. package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-math.woff2 +0 -0
  63. package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-thai.woff2 +0 -0
  64. package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939-vietnamese.woff2 +0 -0
  65. package/assets/esri/themes/base/fonts/fonts/b8b15cdf-85d1-4120-8daa-48863d803939.woff2 +0 -0
  66. package/assets/esri/themes/base/fonts/fonts/b9c5b839-db56-4419-8fcb-6ab661babb1d-cyrillic.woff2 +0 -0
  67. package/assets/esri/themes/base/fonts/fonts/b9c5b839-db56-4419-8fcb-6ab661babb1d-ext.woff2 +0 -0
  68. package/assets/esri/themes/base/fonts/fonts/b9c5b839-db56-4419-8fcb-6ab661babb1d-greek.woff2 +0 -0
  69. package/assets/esri/themes/base/fonts/fonts/b9c5b839-db56-4419-8fcb-6ab661babb1d-hebrew.woff2 +0 -0
  70. package/assets/esri/themes/base/fonts/fonts/b9c5b839-db56-4419-8fcb-6ab661babb1d-math.woff2 +0 -0
  71. package/assets/esri/themes/base/fonts/fonts/b9c5b839-db56-4419-8fcb-6ab661babb1d-vietnamese.woff2 +0 -0
  72. package/assets/esri/themes/base/fonts/fonts/b9c5b839-db56-4419-8fcb-6ab661babb1d.woff2 +0 -0
  73. package/assets/esri/themes/base/fonts/fonts.scss +0 -0
  74. package/assets/esri/themes/base/widgets/_Tooltip.scss +5 -3
  75. package/assets/esri/themes/dark/main.css +1 -1
  76. package/assets/esri/themes/light/main.css +1 -1
  77. package/assets/esri/themes/light/view.css +1 -1
  78. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.en.json +1 -1
  79. package/config.js +1 -1
  80. package/core/units.js +1 -1
  81. package/geometry/HeightModelInfo.js +1 -1
  82. package/geometry/ellipsoidUtils.js +1 -1
  83. package/geometry/support/heightModelInfoUtils.js +1 -1
  84. package/interfaces.d.ts +1 -0
  85. package/kernel.js +1 -1
  86. package/layers/ElevationLayer.js +1 -1
  87. package/layers/OrientedImageryLayer.js +1 -1
  88. package/layers/graphics/dehydratedFeatures.js +1 -1
  89. package/layers/graphics/transferFeatures.js +2 -0
  90. package/layers/mixins/FeatureLayerBase.js +1 -1
  91. package/layers/mixins/HeightModelInfoMixin.js +2 -0
  92. package/layers/mixins/SceneService.js +1 -1
  93. package/layers/orientedImagery/core/ExposurePoint.js +1 -1
  94. package/layers/raster/datasets/RasterFactory.js +1 -1
  95. package/package.json +2 -2
  96. package/rest/query/operations/pbfDehydratedFeatureSet.js +1 -1
  97. package/rest/query/operations/pbfFeatureServiceParser.js +1 -1
  98. package/support/revision.js +1 -1
  99. package/views/3d/camera/constraintUtils/surfaceCollision.js +1 -1
  100. package/views/3d/camera/intersectionUtils.js +1 -1
  101. package/views/3d/layers/I3SMeshView3D.js +1 -1
  102. package/views/3d/layers/i3s/I3SClientMaterialUtil.js +1 -1
  103. package/views/3d/layers/support/featureReference.js +1 -1
  104. package/views/3d/navigation/modes/GroundNavigationMode3D.js +1 -1
  105. package/views/3d/state/Constraints.js +1 -1
  106. package/views/3d/state/utils/groundNavigationUtils.js +1 -1
  107. package/views/3d/support/PBFDecoder.js +1 -1
  108. package/views/3d/support/PBFDecoderWorker.js +1 -1
  109. package/views/3d/support/QualityProfile.js +1 -1
  110. package/views/3d/terrain/TerrainRenderer.js +1 -1
  111. package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
  112. package/views/SceneView.js +1 -1
  113. package/views/ToolViewManager.js +1 -1
  114. package/views/interactive/options/TooltipVisibleElements.d.ts +11 -1
  115. package/views/interactive/options/TooltipVisibleElements.js +1 -1
  116. package/views/interactive/tooltip/components/TooltipEditableField.js +1 -1
  117. package/widgets/BatchAttributeForm/inputs/support/DynamicChoiceController.js +1 -1
  118. package/widgets/BatchAttributeForm.js +1 -1
  119. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  120. package/widgets/OrientedImageryViewer/utils.js +1 -1
  121. package/assets/esri/core/workers/chunks/0a2b7c691a577cb3d189.js +0 -1
  122. package/assets/esri/core/workers/chunks/2146c25c01c9fc11b16c.js +0 -1
  123. package/assets/esri/core/workers/chunks/4678a8170d8a3ccd1a7b.js +0 -1
  124. package/assets/esri/core/workers/chunks/56e97b98dcb8a3f2bcb7.js +0 -1
  125. package/assets/esri/core/workers/chunks/6e75f09fb9452bd5f9fb.js +0 -1
  126. package/assets/esri/core/workers/chunks/7441d121f00ce747c08e.js +0 -1
  127. package/assets/esri/core/workers/chunks/76548469fe1b9c3b2051.js +0 -1
  128. package/assets/esri/core/workers/chunks/82ce034b5ba54de9b970.js +0 -29
  129. package/assets/esri/core/workers/chunks/ba435cc73956d9c64a11.js +0 -1
  130. package/assets/esri/core/workers/chunks/c77496c350004ee66eb2.js +0 -1
  131. package/assets/esri/core/workers/chunks/d371d9279b30548efa02.js +0 -1
  132. package/assets/esri/core/workers/chunks/e5ee64e2fb5bfcb716d8.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../core/Logger.js";import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{distance as n,normalize as r,cross as o,add as i,crossAndNormalize as a,subtract as s,dot as c,scaleAndAdd as l,scale as u,copy as m,length as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as f}from"../../../../geometry/ellipsoidUtils.js";import{create as g,fromPositionAndNormal as h,distance as w,projectPoint as y,projectVector as P}from"../../../../geometry/support/plane.js";import{create as j}from"../../../../geometry/support/ray.js";import{Sphere as S}from"../../../../geometry/support/sphere.js";import{fromRenderCamera as v}from"../../webgl.js";import{getVoxelWasm as I}from"../../layers/VoxelWasm.js";import{pickPointAndInitSphere as b,searchAreaSize as M,sphereOrPlanePointFromScreenPoint as z,intersectPlaneFromScreenPoint as x}from"./navigationUtils.js";import{OffsetCorrectionController as H}from"./OffsetCorrectionController.js";import{fromScreenAtEye as T}from"../../support/geometryUtils/ray.js";import k from"../../webgl/RenderCamera.js";import{Intersector as C}from"../../webgl-engine/lib/Intersector.js";const A=1.5,F={xSpeedMultiplier:A,ySpeedMultiplier:A,maxElevation:1e4,relativeHorizonPadding:.1,minimumHorizonPadding:12},O=2,G=.25,N=p(),R=p(),q=t(),U=p(),Y=g(),D=p(),E=p(),L=p(),V=p(),_=p(),W=p(),B=p(),J=p(),K=p(),Q=p(),X=t(),Z=j(),$=new S,ee=p(),te=g(),ne=p(),re=p();function oe(e,t){return P(t,e.viewForward,N),i(R,e.eye,N),e.projectToScreen(R,q),q[1]}function ie(e,t,m){const d=e.eye;if(n(t.center,d)<t.radius)return r(_,d),o(W,_,e.viewRight),i(R,d,W),e.projectToScreen(R,X),X[1];const p=e.up;T(e,m,Z);const f=t.radius;if(a(U,p,Z.direction),h(d,U,Y),w(Y,t.center)>f)return null;y(Y,t.center,D);const g=n(t.center,D),P=Math.sqrt(f**2-g**2);s(E,d,D),r(L,E),a(V,U,L);const j=c(E,L),S=c(E,V),v=Math.sqrt(j**2+S**2),I=P**2/v**2,b=P/v**2*Math.sqrt(v**2-P**2),M=I*j,z=b*-S,x=I*S,H=b*j,k=M-z,C=x+H,A=x-H;i(B,D,l(B,u(B,L,M+z),V,C)),i(J,D,l(J,u(J,L,k),V,A)),s(K,B,d),r(K,K),s(Q,J,d),r(Q,Q);return c(e.viewForward,K)>=c(e.viewForward,Q)?e.projectToScreen(B,X):e.projectToScreen(J,X),X[1]}function ae(e,t,n=!0){return n?e<t:e<=t}function se(e,t,n=!0){return n?e>t:e>=t}function ce(e,t,n){return t?e>n:e<n}function le(e,t){const n=e.fullHeight/e.pixelRatio,r=Math.max(t,n-t);return Math.max(F.minimumHorizonPadding,F.relativeHorizonPadding*r)}function ue(e,t){return[me(e,t),de(e,t)]}function me(e,t){const n=e.fullHeight/e.pixelRatio;return Math.min(n,t+le(e,t))}function de(e,t){return Math.max(0,t-le(e,t))}function pe(e,t,n){const r={translation:e,location:t};return n&&(r.normal=n),r}function fe(e){const{view:t}=e;return"global"===t.viewingMode?ge(e):he(e)}function ge(e){const{view:t,originalScreenPoint:o,horizonY:i,horizonPadding:a,outTranslation:s,outGrabLocation:c,outGrabNormal:l,intersectionOptions:u,depthSearchSize:d}=e,p=t.state.camera,g=pe(s,c,l);$.radius=f(t.spatialReference).radius;const h=b(t,p,o,$.radius,1,u);if(null==h.scenePickPoint)return!1;const w=h.hasGeometryIntersection;m(ee,h.scenePickPoint),m(g.location,ee);const y=h.sphere;g.normal&&h.normal&&m(g.normal,h.normal);const P=ye(o,i,a,w),j=w?n(ee,p.eye):Number.POSITIVE_INFINITY;if(P.wasAdjusted){je({view:t,screenAdjustment:P,intersector:Pe(t),fallbackCheck:(e,t,n)=>{const o=z(y,p,e,t);return o&&n&&r(n,t),o},output:g,intersectionOptions:u})}return ve({view:t,screenPoint:P.adjustedScreenPoint,camera:p,initialDistance:j,depthSearchSize:d??M,output:g}),!0}function he(e){const{view:t,originalScreenPoint:o,horizonY:i,horizonPadding:a,outTranslation:s,outGrabLocation:c,outGrabNormal:u,intersectionOptions:d,depthSearchSize:p}=e,f=t.sceneIntersectionHelper,g=t.state.camera,w=Pe(t),y=pe(s,c,u);f.intersectIntersectorScreen(o,w,d);const P=w.results.min.getIntersectionPoint(ee),j=P?n(ee,g.eye):Number.POSITIVE_INFINITY;P&&(m(y.location,ee),y.normal&&m(y.normal,w.results.min.normal)),t.renderCoordsHelper.worldUpAtPosition(g.eye,_),l(ne,g.eye,_,-g.relativeElevation),h(ne,_,te);const S=ye(o,i,a,P);if(S.wasAdjusted){je({view:t,screenAdjustment:S,intersector:w,fallbackCheck:(e,t,n)=>{const o=x(te,g,e,t);return o&&n&&r(n,_),o},output:y,intersectionOptions:d})}return ve({view:t,screenPoint:S.adjustedScreenPoint,camera:g,initialDistance:j,depthSearchSize:p??M,output:y}),!0}function we(e,t,n,r){return!r&&ae(e,t)||r&&ce(e,!1,n[0])?n[0]:!r&&se(e,t,!1)?n[1]:null}function ye(e,n,r,o){const i=we(e[1],n,r,o);return{originalScreenPoint:e,adjustedScreenPoint:t(e[0],i??e[1]),horizonY:n,horizonPadding:r,wasAdjusted:null!==i}}function Pe(e){const t=new C(e.state.viewingMode);return t.options.selectionMode=!0,t.options.store=0,t.options.hud=!1,t.options.normalRequired=!0,t}function je(e){const{view:t,screenAdjustment:n,fallbackCheck:r,intersector:o,output:i,intersectionOptions:a}=e,s=t.sceneIntersectionHelper;s.intersectIntersectorScreen(n.adjustedScreenPoint,o,{...a,requiresGroundFeedback:!0});let c=o.results.min.getIntersectionPoint(i.location);if(c)return void(i.normal&&m(i.normal,o.results.min.normal));const l=Se(n);s.intersectIntersectorScreen(l,o,{...a,requiresGroundFeedback:!0}),c=o.results.min.getIntersectionPoint(i.location),c?i.normal&&m(i.normal,o.results.min.normal):(c=r(n.adjustedScreenPoint,i.location,i.normal),c||r(l,i.location,i.normal))}function Se(e){const{originalScreenPoint:n,adjustedScreenPoint:r,horizonY:o,horizonPadding:i}=e,a=se(r[1],o)?Math.min(i[1],n[1]):Math.max(i[0],n[1]);return t(r[0],a)}function ve(e){const{view:t,screenPoint:n,camera:o,initialDistance:a,depthSearchSize:c,output:l}=e,m=c>0?t.stage.renderView.getMinimalDepthForArea(I(t),n[0],n[1],o,c):null;s(l.translation,l.location,o.eye);let p=Math.min(d(l.translation),a);m&&m<=p&&(p=m),r(l.translation,l.translation),u(l.translation,l.translation,p),i(l.location,l.translation,o.eye)}async function Ie(t,r){if("ground"!==t.navigation.mode.type)return void e.getLogger("esri").warn("Can only advance while in ground navigation mode!");const{camera:o}=t.state;t.renderCoordsHelper.worldUpAtPosition(o.eye,_);const c=t.sceneIntersectionHelper,l=Pe(t),p=a(N,_,o.viewRight);m(Z.origin,o.eye),u(Z.direction,p,r);const f=c.intersectRay(Z,l,ee),g=(new k).copyFrom(o),h=s(re,o.center,o.eye);if(!f||n(ee,o.eye)>r)g.eye=i(N,Z.origin,Z.direction);else{s(N,ee,o.eye);d(N)>O&&(be(N,N,G,O),g.eye=i(N,o.eye,N))}g.center=i(N,g.eye,h);return new H(t).immediatelyCorrectGroundElevation(g,100),t.goTo(v(t,g),{duration:500,liftOffDisabled:!0})}function be(e,t,n,r){const o=d(e),i=Math.min(n,Math.max(o-r,0)/o);u(t,e,i)}export{le as computeHorizonPadding,ue as computeHorizonPaddingLimits,fe as findGroundNavigationGrabLocation,oe as findPlaneHorizonY,ie as findSphereHorizonY,Ie as groundNavigationAdvance,F as groundNavigationConstants,ae as isAboveHorizon,se as isBelowHorizon,be as shortenTranslation,ce as shouldClampScreenY};
2
+ import e from"../../../../core/Logger.js";import{createScreenPointArray as t}from"../../../../core/screenUtils.js";import{distance as n,normalize as o,cross as r,add as i,crossAndNormalize as a,subtract as s,dot as c,scaleAndAdd as l,scale as u,copy as m,length as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as f}from"../../../../geometry/ellipsoidUtils.js";import{create as g,fromPositionAndNormal as h,distance as y,projectPoint as w,projectVector as P,intersectLine as v}from"../../../../geometry/support/plane.js";import{create as j}from"../../../../geometry/support/ray.js";import{Sphere as S}from"../../../../geometry/support/sphere.js";import{fromRenderCamera as I}from"../../webgl.js";import{getVoxelWasm as b}from"../../layers/VoxelWasm.js";import{pickPointAndInitSphere as M,sphereOrPlanePointFromScreenPoint as z,intersectPlaneFromScreenPoint as x,searchAreaSize as H}from"./navigationUtils.js";import{OffsetCorrectionController as C}from"./OffsetCorrectionController.js";import{fromScreenAtEye as T}from"../../support/geometryUtils/ray.js";import k from"../../webgl/RenderCamera.js";import{Intersector as A}from"../../webgl-engine/lib/Intersector.js";const F=1.5,O={xSpeedMultiplier:F,ySpeedMultiplier:F,maxElevation:1e4,relativeHorizonPadding:.1,minimumHorizonPadding:12},G=2,N=.25,R=p(),U=p(),q=t(),Y=p(),D=g(),E=p(),L=p(),V=p(),_=p(),W=p(),B=p(),J=p(),K=p(),Q=p(),X=p(),Z=t(),$=j(),ee=new S,te=p(),ne=g(),oe=p(),re=p();function ie(e,t){return P(t,e.viewForward,R),i(U,e.eye,R),e.projectToScreen(U,q),q[1]}function ae(e,t,m){const d=e.eye;if(n(t.center,d)<t.radius)return o(W,d),r(B,W,e.viewRight),i(U,d,B),e.projectToScreen(U,Z),Z[1];const p=e.up;T(e,m,$);const f=t.radius;if(a(Y,p,$.direction),h(d,Y,D),y(D,t.center)>f)return null;w(D,t.center,E);const g=n(t.center,E),P=Math.sqrt(f**2-g**2);s(L,d,E),o(V,L),a(_,Y,V);const v=c(L,V),j=c(L,_),S=Math.sqrt(v**2+j**2),I=P**2/S**2,b=P/S**2*Math.sqrt(S**2-P**2),M=I*v,z=b*-j,x=I*j,H=b*v,C=M-z,k=x+H,A=x-H;i(J,E,l(J,u(J,V,M+z),_,k)),i(K,E,l(K,u(K,V,C),_,A)),s(Q,J,d),o(Q,Q),s(X,K,d),o(X,X);return c(e.viewForward,Q)>=c(e.viewForward,X)?e.projectToScreen(J,Z):e.projectToScreen(K,Z),Z[1]}function se(e,t,n=!0){return n?e<t:e<=t}function ce(e,t,n=!0){return n?e>t:e>=t}function le(e,t,n){return t?e>n:e<n}function ue(e,t){const n=e.fullHeight/e.pixelRatio,o=Math.max(t,n-t);return Math.max(O.minimumHorizonPadding,O.relativeHorizonPadding*o)}function me(e,t){return[de(e,t),pe(e,t)]}function de(e,t){const n=e.fullHeight/e.pixelRatio;return Math.min(n,t+ue(e,t))}function pe(e,t){return Math.max(0,t-ue(e,t))}function fe(e,t,n){const o={translation:e,location:t};return n&&(o.normal=n),o}function ge(e){const{view:t}=e;return"global"===t.viewingMode?he(e):ye(e)}function he(e){const{view:t,originalScreenPoint:r,horizonY:i,horizonPadding:a,outTranslation:s,outGrabLocation:c,outGrabNormal:l,intersectionOptions:u,depthSearchSize:d}=e,p=t.state.camera,g=fe(s,c,l);ee.radius=f(t.spatialReference).radius;const h=M(t,p,r,ee.radius,1,u);if(null==h.scenePickPoint)return!1;const y=h.hasGeometryIntersection;m(te,h.scenePickPoint),m(g.location,te);const w=h.sphere;g.normal&&h.normal&&m(g.normal,h.normal);const P=Pe(r,i,a,y),v=y?n(te,p.eye):Number.POSITIVE_INFINITY;if(P.wasAdjusted){je({view:t,screenAdjustment:P,intersector:ve(t),fallbackCheck:(e,t,n)=>{const r=z(w,p,e,t);return r&&n&&o(n,t),r},output:g,intersectionOptions:u})}return Ie({view:t,screenPoint:P.adjustedScreenPoint,camera:p,initialDistance:v,depthSearchSize:d??H,output:g}),!0}function ye(e){const{view:t,originalScreenPoint:r,horizonY:i,horizonPadding:a,outTranslation:s,outGrabLocation:c,outGrabNormal:u,intersectionOptions:d,depthSearchSize:p}=e,f=t.sceneIntersectionHelper,g=t.state.camera,y=ve(t),w=fe(s,c,u);f.intersectIntersectorScreen(r,y,d);const P=y.results.min.getIntersectionPoint(te),v=P?n(te,g.eye):Number.POSITIVE_INFINITY;P&&(m(w.location,te),w.normal&&m(w.normal,y.results.min.normal)),t.renderCoordsHelper.worldUpAtPosition(g.eye,W),l(oe,g.eye,W,-g.relativeElevation),h(oe,W,ne);const j=Pe(r,i,a,P);if(j.wasAdjusted){je({view:t,screenAdjustment:j,intersector:y,fallbackCheck:(e,t,n)=>{const r=x(ne,g,e,t);return r&&n&&o(n,W),r},output:w,intersectionOptions:d})}return Ie({view:t,screenPoint:j.adjustedScreenPoint,camera:g,initialDistance:v,depthSearchSize:p??H,output:w}),!0}function we(e,t,n,o){return!o&&se(e,t)||o&&le(e,!1,n[0])?n[0]:!o&&ce(e,t,!1)?n[1]:null}function Pe(e,n,o,r){const i=we(e[1],n,o,r);return{originalScreenPoint:e,adjustedScreenPoint:t(e[0],i??e[1]),horizonY:n,horizonPadding:o,wasAdjusted:null!==i}}function ve(e){const t=new A(e.state.viewingMode);return t.options.selectionMode=!0,t.options.store=0,t.options.hud=!1,t.options.normalRequired=!0,t}function je(e){const{view:t,screenAdjustment:n,fallbackCheck:o,intersector:r,output:i,intersectionOptions:a}=e,s=t.sceneIntersectionHelper;s.intersectIntersectorScreen(n.adjustedScreenPoint,r,{...a,requiresGroundFeedback:!0});let c=r.results.min.getIntersectionPoint(i.location);if(c)return void(i.normal&&m(i.normal,r.results.min.normal));const l=Se(n);s.intersectIntersectorScreen(l,r,{...a,requiresGroundFeedback:!0}),c=r.results.min.getIntersectionPoint(i.location),c?i.normal&&m(i.normal,r.results.min.normal):(c=o(n.adjustedScreenPoint,i.location,i.normal),c||o(l,i.location,i.normal))}function Se(e){const{originalScreenPoint:n,adjustedScreenPoint:o,horizonY:r,horizonPadding:i}=e,a=ce(o[1],r)?Math.min(i[1],n[1]):Math.max(i[0],n[1]);return t(o[0],a)}function Ie(e){be(e),Me(e)}function be(e){const{view:t,camera:n,output:o}=e,{offset:r}=t.navigation.mode;if(!r)return;const{translation:i,location:a}=o;t.renderCoordsHelper.worldUpAtPosition(n.eye,W),l(oe,n.eye,W,-r),h(oe,W,D);v(D,n.eye,a,oe)&&(m(a,oe),s(i,a,n.eye))}function Me(e){const{view:t,screenPoint:n,camera:r,initialDistance:a,depthSearchSize:c,output:l}=e,m=c>0?t.stage.renderView.getMinimalDepthForArea(b(t),n[0],n[1],r,c):null;s(l.translation,l.location,r.eye);let p=Math.min(d(l.translation),a);m&&m<=p&&(p=m),o(l.translation,l.translation),u(l.translation,l.translation,p),i(l.location,l.translation,r.eye)}async function ze(t,o){if("ground"!==t.navigation.mode.type)return void e.getLogger("esri").warn("Can only advance while in ground navigation mode!");const{camera:r}=t.state;t.renderCoordsHelper.worldUpAtPosition(r.eye,W);const c=t.sceneIntersectionHelper,l=ve(t),p=a(R,W,r.viewRight);m($.origin,r.eye),u($.direction,p,o);const f=c.intersectRay($,l,te),g=(new k).copyFrom(r),h=s(re,r.center,r.eye);if(!f||n(te,r.eye)>o)g.eye=i(R,$.origin,$.direction);else{s(R,te,r.eye);d(R)>G&&(xe(R,R,N,G),g.eye=i(R,r.eye,R))}g.center=i(R,g.eye,h);return new C(t).immediatelyCorrectGroundElevation(g,100),t.goTo(I(t,g),{duration:500,liftOffDisabled:!0})}function xe(e,t,n,o){const r=d(e),i=Math.min(n,Math.max(r-o,0)/r);u(t,e,i)}export{ue as computeHorizonPadding,me as computeHorizonPaddingLimits,ge as findGroundNavigationGrabLocation,ie as findPlaneHorizonY,ae as findSphereHorizonY,ze as groundNavigationAdvance,O as groundNavigationConstants,se as isAboveHorizon,ce as isBelowHorizon,xe as shortenTranslation,le as shouldClampScreenY};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{generateUID as e}from"../../../core/uid.js";import{WorkerHandle as r}from"../../../core/workers/WorkerHandle.js";import s from"../../../geometry/SpatialReference.js";import t from"../../../layers/support/Field.js";class a{constructor(e){this._controller=e,this._handle=new n(r=>e.schedule(r))}destroy(){this._handle.destroy()}async invoke(r,a){if(!r.buffer||0===r.buffer.byteLength)return null;r.options.sourceSpatialReference&&r.options.sourceSpatialReference instanceof s&&(r.options={...r.options,sourceSpatialReference:r.options.sourceSpatialReference.toJSON()});const n=await this._handle.invoke(r,a);return await this._controller.scheduleGenerator(function*(r){const a=s.fromJSON(n.spatialReference);n.spatialReference=a;const i=n.fields;if(i)for(let e=0;e<i.length;++e)i[e]=t.fromJSON(i[e]),r.madeProgress()&&(r=yield);const p=n.features;for(let s=0;s<p.length;++s){const t=p[s];t.uid=e();const n=t.geometry;null!=n&&(n.spatialReference=a,o(n),r.madeProgress()&&(r=yield))}return n})}}function o(e){switch(e.type){case"polyline":e.paths=e.hasZ&&e.hasM?e.paths.map(e=>e.map(e=>[e[0],e[1],e[2],e[3]])):e.hasZ||e.hasM?e.paths.map(e=>e.map(e=>[e[0],e[1],e[2]])):e.paths.map(e=>e.map(e=>[e[0],e[1]]));break;case"polygon":e.rings=e.hasZ&&e.hasM?e.rings.map(e=>e.map(e=>[e[0],e[1],e[2],e[3]])):e.hasZ||e.hasM?e.rings.map(e=>e.map(e=>[e[0],e[1],e[2]])):e.rings.map(e=>e.map(e=>[e[0],e[1]]))}}class n extends r{constructor(e){super("PBFDecoderWorker","_parseFeatureQuery",{_parseFeatureQuery:e=>[e.buffer]},e)}}export{a as PBFDecoder};
2
+ import{throwIfAborted as e}from"../../../core/promiseUtils.js";import{generateUID as r}from"../../../core/uid.js";import{WorkerHandle as o}from"../../../core/workers/WorkerHandle.js";import t from"../../../geometry/SpatialReference.js";import{toDehydratedGeometry as s}from"../../../layers/graphics/transferFeatures.js";import n from"../../../layers/support/Field.js";class a{constructor(e){this._controller=e,this._abortController=new AbortController,this._handle=new i((r,o)=>e.schedule(r,o))}destroy(){this._abortController.abort(),this._handle.destroy()}async invoke(o,a){if(a=AbortSignal.any([a,this._abortController.signal]),e(a),!o.buffer||0===o.buffer.byteLength)return null;o.options.sourceSpatialReference&&o.options.sourceSpatialReference instanceof t&&(o.options={...o.options,sourceSpatialReference:o.options.sourceSpatialReference.toJSON()});const{featureSet:i,coordinates:l,queryGeometry:c,queryCoordinates:f}=await this._handle.invoke(o,a);return await this._controller.scheduleGenerator(function*(e){const o=t.fromJSON(i.spatialReference),a=[];for(let r=0;r<i.fields.length;++r)a.push(n.fromJSON(i.fields[r])),e.madeProgress()&&(e=yield);const u=i.features;for(let t=0;t<u.length;++t){const n=u[t];n.geometry=s(n.geometry,l[t],o),n.uid=r(),n.centroid&&(n.centroid.spatialReference=o),l[t]=null,e.madeProgress()&&(e=yield)}return Object.assign(i,{spatialReference:o,fields:a,queryGeometry:s(c,f,o)})},a)}}class i extends o{constructor(e){super("PBFDecoderWorker","parseFeatureQuery",{parseFeatureQuery:e=>[e.buffer]},e)}}export{a as PBFDecoder};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{DehydratedFeatureSetParserContext as e}from"../../../rest/query/operations/pbfDehydratedFeatureSet.js";import{parsePBFFeatureQuery as r}from"../../../rest/query/operations/pbfQueryUtils.js";class t{_parseFeatureQuery(t){const s=new e(t.options),i=r(t.buffer,s),o={...i,spatialReference:i.spatialReference?.toJSON(),fields:i.fields?i.fields.map(e=>e.toJSON()):void 0,missingAttributes:s.missingAttributes};return Promise.resolve(o)}}function s(){return new t}export{s as default};
2
+ import{DehydratedFeatureSetParserContext as e}from"../../../rest/query/operations/pbfDehydratedFeatureSet.js";import{parsePBFFeatureQuery as r}from"../../../rest/query/operations/pbfQueryUtils.js";class t{parseFeatureQuery(t){const s=new e(t.options),o=r(t.buffer,s);o.missingAttributes=s.missingAttributes;const n={featureSet:o,coordinates:s.coordinates,queryGeometry:s.queryGeometry()??null,queryCoordinates:s.queryCoordinates()??null};return Promise.resolve({result:n,transferList:s.transferList})}}function s(){return new t}export{s as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"../../../core/has.js";import{Milliseconds as e}from"../../../core/time.js";function a(e){return l[e]}function i(){return has("esri-iPhone")?"low":"medium"}const o={reset(){const e=m();for(const a of Object.keys(e))l[a]=e[a]}},t={IPhone12Pro:120,GalaxyS20:200,FullHD:240,SurfacePro7:300,FullHDRetina:430},l=m();function m(){const a=!!has("esri-mobile"),i=!!has("ios"),o=e(400);return{low:{graphics3D:{maxTotalNumberOfFeatures:5e4,maxNumberOfDrawCalls:8e3,maxTotalNumberOfVertices:255e4,polygonLodFactor:.5,polylineLodFactor:1,snapshotAvailable:!1,skipHighSymbolLods:!0},heatmap:{pixelRatio:.125},sceneService:{objectLoDFactor:.2,pointLoDFactor:1,meshLoDFactor:.6,pointCloudLoDFactor:.5},gaussianSplat:{minimumPixelRadius:2,minimumOpacity:0,maximumNumberOfGaussians:1e6},flow:{maxTotalNumberOfStreamlines:5e3,maxTracingResolution:1024,transitionEnabled:!1},tiledSurface:{lodBias:-1,angledSplitBias:.5,vtlContentZoom:.75,elevationLevelDelta:3,reduceTileLevelDifferences:!0},fadeDuration:e(0),physicallyBasedRenderingEnabled:!1,maxTexturePixels:a?1048576:4194304,memoryLimit:200+t.IPhone12Pro,additionalCacheMemory:0,frameRate:0,maximumPixelRatio:1},medium:{graphics3D:{maxTotalNumberOfFeatures:15e4,maxNumberOfDrawCalls:17e3,maxTotalNumberOfVertices:625e4,polygonLodFactor:a?.8:1,polylineLodFactor:a?1.2:1.5,snapshotAvailable:!i,skipHighSymbolLods:!1},heatmap:{pixelRatio:.25},sceneService:{objectLoDFactor:1,pointLoDFactor:1,meshLoDFactor:1,pointCloudLoDFactor:1},gaussianSplat:{minimumPixelRadius:1,minimumOpacity:1,maximumNumberOfGaussians:3e6},flow:{maxTotalNumberOfStreamlines:2e4,maxTracingResolution:2048,transitionEnabled:!0},tiledSurface:{lodBias:0,angledSplitBias:1,vtlContentZoom:1.5,elevationLevelDelta:3,reduceTileLevelDifferences:!0},fadeDuration:o,physicallyBasedRenderingEnabled:!0,maxTexturePixels:a?4194304:4096**2,memoryLimit:a?600+t.GalaxyS20:750+t.FullHD,additionalCacheMemory:a?-100:150,frameRate:0,maximumPixelRatio:1},high:{graphics3D:{maxTotalNumberOfFeatures:3e5,maxNumberOfDrawCalls:17e3,maxTotalNumberOfVertices:125e5,polygonLodFactor:a?1.2:2,polylineLodFactor:a?1.2:2,snapshotAvailable:!i,skipHighSymbolLods:!1},heatmap:{pixelRatio:.5},sceneService:{objectLoDFactor:1,pointLoDFactor:1,meshLoDFactor:1,pointCloudLoDFactor:1},gaussianSplat:{minimumPixelRadius:.5,minimumOpacity:2,maximumNumberOfGaussians:6e6},flow:{maxTotalNumberOfStreamlines:2e4,maxTracingResolution:2048,transitionEnabled:!0},tiledSurface:{lodBias:0,angledSplitBias:1,vtlContentZoom:1.5,elevationLevelDelta:2,reduceTileLevelDifferences:!0},fadeDuration:o,physicallyBasedRenderingEnabled:!0,maxTexturePixels:a?4096**2:1/0,memoryLimit:a?900+t.SurfacePro7:1500+t.FullHDRetina,additionalCacheMemory:a?-150:0,frameRate:0,maximumPixelRatio:a?1:1/0}}}export{o as QualityProfileTest,i as getDefaultQualityProfileName,a as getQualityProfileSettings};
2
+ import has from"../../../core/has.js";import{Milliseconds as e}from"../../../core/time.js";function a(e){return l[e]}function i(){return has("esri-iPhone")?"low":"medium"}const o={reset(){const e=m();for(const a of Object.keys(e))l[a]=e[a]}},t={IPhone12Pro:120,GalaxyS20:200,FullHD:240,SurfacePro7:300,FullHDRetina:430},l=m();function m(){const a=!!has("esri-mobile"),i=!!has("ios"),o=e(400);return{low:{graphics3D:{maxTotalNumberOfFeatures:5e4,maxNumberOfDrawCalls:8e3,maxTotalNumberOfVertices:255e4,polygonLodFactor:.5,polylineLodFactor:1,snapshotAvailable:!1,skipHighSymbolLods:!0},heatmap:{pixelRatio:.125},sceneService:{objectLoDFactor:.2,pointLoDFactor:1,meshLoDFactor:.6,pointCloudLoDFactor:.5},gaussianSplat:{minimumPixelRadius:2,minimumOpacity:0,maximumNumberOfGaussians:1e6},flow:{maxTotalNumberOfStreamlines:5e3,maxTracingResolution:1024,transitionEnabled:!1},tiledSurface:{lodBias:-1,angledSplitBias:.5,vtlContentZoom:.75,elevationLevelDelta:3,reduceTileLevelDifferences:!0},fadeDuration:e(0),physicallyBasedRenderingEnabled:!1,maxTexturePixels:a?1048576:4194304,memoryLimit:200+t.IPhone12Pro,additionalCacheMemory:0,frameRate:0,maximumPixelRatio:1},medium:{graphics3D:{maxTotalNumberOfFeatures:15e4,maxNumberOfDrawCalls:17e3,maxTotalNumberOfVertices:625e4,polygonLodFactor:a?.8:1,polylineLodFactor:a?1.2:1.5,snapshotAvailable:!i,skipHighSymbolLods:!1},heatmap:{pixelRatio:.25},sceneService:{objectLoDFactor:1,pointLoDFactor:1,meshLoDFactor:1,pointCloudLoDFactor:1},gaussianSplat:{minimumPixelRadius:1,minimumOpacity:1,maximumNumberOfGaussians:a?1e6:3e6},flow:{maxTotalNumberOfStreamlines:2e4,maxTracingResolution:2048,transitionEnabled:!0},tiledSurface:{lodBias:0,angledSplitBias:1,vtlContentZoom:1.5,elevationLevelDelta:3,reduceTileLevelDifferences:!0},fadeDuration:o,physicallyBasedRenderingEnabled:!0,maxTexturePixels:a?4194304:4096**2,memoryLimit:a?600+t.GalaxyS20:750+t.FullHD,additionalCacheMemory:a?-100:150,frameRate:0,maximumPixelRatio:1},high:{graphics3D:{maxTotalNumberOfFeatures:3e5,maxNumberOfDrawCalls:17e3,maxTotalNumberOfVertices:125e5,polygonLodFactor:a?1.2:2,polylineLodFactor:a?1.2:2,snapshotAvailable:!i,skipHighSymbolLods:!1},heatmap:{pixelRatio:.5},sceneService:{objectLoDFactor:1,pointLoDFactor:1,meshLoDFactor:1,pointCloudLoDFactor:1},gaussianSplat:{minimumPixelRadius:.5,minimumOpacity:2,maximumNumberOfGaussians:6e6},flow:{maxTotalNumberOfStreamlines:2e4,maxTracingResolution:2048,transitionEnabled:!0},tiledSurface:{lodBias:0,angledSplitBias:1,vtlContentZoom:1.5,elevationLevelDelta:2,reduceTileLevelDifferences:!0},fadeDuration:o,physicallyBasedRenderingEnabled:!0,maxTexturePixels:a?4096**2:1/0,memoryLimit:a?900+t.SurfacePro7:1500+t.FullHDRetina,additionalCacheMemory:a?-150:0,frameRate:0,maximumPixelRatio:a?1:1/0}}}export{o as QualityProfileTest,i as getDefaultQualityProfileName,a as getQualityProfileSettings};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import i from"../../../core/ObjectPool.js";import{watch as s,sync as n}from"../../../core/reactiveUtils.js";import{property as a,subclass as l}from"../../../core/accessorSupport/decorators.js";import{subtract as o,set as c,dot as h}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as d,fromValues as u,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as g,ZEROS as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as p,set as m}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as b}from"./OverlayRenderer.js";import{PatchRenderData as x}from"./PatchRenderData.js";import{TerrainAttributesCache as T}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as R}from"./terrainUtils.js";import{TileRenderer as v}from"./TileRenderer.js";import{IteratorPreorder as P,fallsWithinLayerView as w,sortTiles as O,compareTiles as D}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as S}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as B}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as E}from"../webgl-engine/lib/Attribute.js";import{IntersectorResultRay as F}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as j,MeshIntersectionOptions as q,intersectTriangles as C}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as A}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as M,getVerticalOffsetTerrain as G}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as I}from"../webgl-engine/materials/DrawParameters.js";import{hasShadowHighlights as U}from"../webgl-engine/shaders/ReceiveShadowsConfiguration.js";import{T as k}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as N}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as L}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as V}from"../../webgl/enums.js";const H=7,z=10,Q=200,W=p();let Z=class extends B{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return 1===this._stage.viewingMode}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,s,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=s,this._compressionTracker=n,this.type=7,this.isGround=!0,this._passParameters=new k,this._drawParameters=new I,this._renderDataPool=new i(()=>new x),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new P,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>1===this._desiredSlot],[7,()=>7===this._desiredSlot],[9,()=>this._produces()&&this.renderOccludedFlags===b]]),this._tileSize=256,this._configuration=new L(1===t.viewingMode),this._tileTextureCache=new r((e,t)=>a.newCache(e,t),"TileTexture"),this.tileGeometryCache=new T(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(s(()=>this._overlayRenderer.renderOccludedFlags,()=>this.setNeedsRender(),n))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get layerViewUid(){return M}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){const{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;const r=g(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,r)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;const{layerInfo:r,surface:i}=t;for(let s=0;s<r[1].length;s++){const r=i.layerViewByIndex(s,1);if(w(e,r)!==w(t,r))return!1}return!0}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,32===t?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const r of e.layerInfo[0])r.pendingUpdates&=-9;e.resetPendingUpdate(8);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=z-H,r=Math.max(0,Math.floor((e.level-t)/H)*H);if(this._isGlobal&&0===r)return d;for(;e.parent&&e.level>r;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new v(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersectRay(e,t,r,i){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&0!==this.transparency)return;const s=J,n=K;o(s,i,r),c(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,l=e.results.max,d=e.results.ground,u=0===e.options.store,_=!!e.results.ground.target,g=G(e.verticalOffset),f=e.tolerance;let p,b=u&&null!=a.distance?a.distance:1/0;const x=e.options,T=x.normalRequired||!x.backfacesTerrain,R=new q(f,!1,T),v=c=>{const _=c.renderData;if(!_?.vao)return;const v=_.geometry;m(W,v.boundingBox);const P=_.localOrigin;null!=g&&(g.localOrigin=P,g.applyToAabb(W));const w=W;if(X[0]=r[0]-P[0],X[1]=r[1]-P[1],X[2]=r[2]-P[2],!j(w,X,n,f,b))return;const O=(e,t,r,i)=>{e.set(this.type,c,t,r,i),b=u&&null!=a.renderDistance?a.renderDistance:1/0},D=(n,o,c)=>{if((!T||null!=c)&&o>=0&&(x.backfacesTerrain||h(c,s)<0)&&(x.invisibleTerrain||!x.selectionMode||null==t||t(r,i,o))){if((null==d.renderDistance||o<d.renderDistance)&&O(d,n,o,c),x.isFiltered)return;2===x.store&&(null==p?(p=new F(e.ray),O(p,n,o,c),e.results.all.push(p)):o<p.renderDistance&&O(p,n,o,c)),(null==a.renderDistance||o<a.renderDistance)&&O(a,n,o,c),0!==x.store&&(null==l.renderDistance||o>l.renderDistance)&&O(l,n,o,c)}},S=Y;o(S,i,P);const{indices:B,indexCount:q}=v,M=v.vertexAttributes,G=M.getField("position",y),I=new E(G.typedBuffer,3,M.stride/4),U=q/3;if(!g&&U>Q){const e=c.renderData;e.intersectionData??=new A(B,U,I),e.intersectionData.intersectRay(X,S,R,D)}else{C(X,S,0,U,(e,t)=>G.getVec(B[t],e),g,R,D)}},P=this._rootTiles;if(null!=P){(()=>{const t=this._tileIterator;t.reset(P);const i=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||i&&e.intersectsClippingArea)||null==g&&!e.intersectsRay(r,s,f,b)||_&&this._useStencilForTile(e)?t.skipSubtree():v(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const r of t)null!=r.renderData?.textureReference&&e.queriesForTile(r);e.process(),t.madeProgress()}}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return 7;case 3:case 4:return null}}acquireTechniques(e){const{shadowMap:t,viewshedEnabled:r,cutFillComputationEnabled:i,slot:s,hasEmission:n,useFloatBlend:a}=e.bind,l=!!has("enable-feature:terrain-shadows")&&t.enabled;if(l!==this._castShadows&&(this._castShadows=l,this._patchesByOriginDirty=!0),this._inViewshed!==r&&(this._inViewshed=r,this._patchesByOriginDirty=!0),this._cutFillEnabled!==i&&(this._cutFillEnabled=i,this._patchesByOriginDirty=!0),3===this.transparency)return null;if(9===s){if(0===(e.renderOccludedMask&b))return null}else if(s!==this._desiredSlot)return null;const o=this._configuration;switch(o.screenSpaceReflections=o.cloudReflections=o.receiveShadows=o.hasShadowHighlights=o.receiveAmbientOcclusion=o.renderOccluded=o.hasHighlightMixTexture=!1,o.hasEmission=n,o.overlayMode=this._overlayRenderer.mode,o.useFloatBlend=a.value,e.output){case 0:case 1:case 2:{const r=e.bind;o.screenSpaceReflections=r.hasScreenSpaceReflections,o.cloudReflections=null!=r.clouds.data;const i=9===s;return o.receiveShadows=t.ready&&!i,o.hasShadowHighlights=U(o,e.bind),o.renderOccluded=i,o.receiveAmbientOcclusion=!i&&null!=r.ssao,o.receiveGlobalIllumination=!i&&r.globalIlluminationEnabled,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:return this._acquireTechnique(e.output);case 11:return this._acquireTechnique(11);case 10:return o.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),this._passParameters.useStencil=!1,this._passParameters.overlayContent=S(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{const r=e.bind.highlight?.name;r&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(r)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const t=this._tileRenderer;let r;if(null!=e){const t=e.toUnitRGBA();r=u(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(r),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:null!=t.backgroundColor?1:0,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const r of e)O(r,t);e.sort((e,t)=>D(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange("visibleTiles"),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness("render-patch-groups"),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),r=e.renderData;if(!r){this._numTilesCulled++;continue}const i=r.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(i);t||(t=[],this._allPatchesByOrigin.set(i,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(i);s||(s=[],this._visiblePatchesByOrigin.set(i,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,r){const{rctx:i,bind:s}=e;i.bindTechnique(t,s,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach(r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(s,this._passParameters,this._drawParameters);for(let i=0;i<r.length;i++)this._renderPatch(e,t,r[i],V.TRIANGLES,n,null===this._passParameters.overlayContent)}),i.bindVAO(null)}_renderMaterialPass(e,t){const{rctx:r,bind:i}=e,s=r.bindTechnique(t,i,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const n=9===i.slot;n&&(s.bindTexture("tex",r.emptyTexture),s.setUniform3fv("textureOpacities",d),s.setUniform4fv("texOffsetAndScale",f));const a=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:d;1===this._configuration.tileBlendInput&&s.setUniform3fv("backgroundColor",a);const l=this._stencilEnabledLayerExtents.length>0,o=this.wireframe?V.LINES:V.TRIANGLES;this._configuration.textureFadingEnabled&&s.bindTexture("texNext",r.emptyTexture);const c=this._visiblePatchesByOrigin;for(const h of c.values()){const r=h[0].renderData.localOrigin;this._drawParameters.origin=r,t.program.bindDraw(i,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const i of h){const r=i.renderData,a=r.textureReference;if(null!=a){if(!n){s.setUniform4fv("texOffsetAndScale",a.offsetAndScale),s.bindTexture("tex",a.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(2),s.setUniform3fv("textureOpacities",a.opacities)}this._renderPatch(e,t,i,o,l),i.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}r.bindVAO(null)}_renderPatch(e,t,r,i,s,n=!1){const a=r.renderData,l=a.vao,o=l?.indexBuffer;if(!l||null==o)return void(R&&console.error("Rendered tile with no indices: ",r.lij," : ",a));const c=t.program;n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay);const{rctx:h,bind:d}=e;s&&(this._passParameters.useStencil=this._useStencilForTile(r),h.setPipelineState(t.getPipeline(d,this._passParameters)));const u=a.geometry.indexCount;h.bindVAO(l),c.assertCompatibleVertexAttributeLocations(l),h.drawElements(i,u,o.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(N,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([a({readOnly:!0})],Z.prototype,"visibleTiles",null),e([a({readOnly:!0})],Z.prototype,"_isGlobal",null),e([a()],Z.prototype,"renderOccludedFlags",null),e([a({value:!1})],Z.prototype,"renderingDisabled",null),e([a({value:!0})],Z.prototype,"visible",null),e([a()],Z.prototype,"renderPatchBorders",null),e([a()],Z.prototype,"wireframe",null),Z=e([l("esri.views.3d.terrain.TerrainRenderer")],Z);const J=_(),K=_(),X=_(),Y=_();export{Z as TerrainRenderer};
2
+ import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import i from"../../../core/ObjectPool.js";import{watch as s,sync as n}from"../../../core/reactiveUtils.js";import{property as a,subclass as l}from"../../../core/accessorSupport/decorators.js";import{subtract as o,set as c,dot as d}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as h,fromValues as u,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as g,ZEROS as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as p,set as m}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as b}from"./OverlayRenderer.js";import{PatchRenderData as x}from"./PatchRenderData.js";import{TerrainAttributesCache as T}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as R}from"./terrainUtils.js";import{TileRenderer as v}from"./TileRenderer.js";import{IteratorPreorder as P,fallsWithinLayerView as w,sortTiles as O,compareTiles as D}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as S}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as B}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as E}from"../webgl-engine/lib/Attribute.js";import{IntersectorResultRay as F}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as j,MeshIntersectionOptions as C,intersectTriangles as q}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as A}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as M,getVerticalOffsetTerrain as G}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as I}from"../webgl-engine/materials/DrawParameters.js";import{hasShadowHighlights as U}from"../webgl-engine/shaders/ReceiveShadowsConfiguration.js";import{T as k}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as N}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as L}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as V}from"../../webgl/enums.js";const H=7,z=10,Q=200,W=p();let Z=class extends B{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return 1===this._stage.viewingMode}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,s,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=s,this._compressionTracker=n,this.type=7,this.isGround=!0,this._passParameters=new k,this._drawParameters=new I,this._renderDataPool=new i(()=>new x),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new P,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>1===this._desiredSlot],[7,()=>7===this._desiredSlot],[9,()=>this._produces()&&this.renderOccludedFlags===b]]),this._tileSize=256,this._configuration=new L(1===t.viewingMode),this._tileTextureCache=new r((e,t)=>a.newCache(e,t),"TileTexture"),this.tileGeometryCache=new T(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(s(()=>this._overlayRenderer.renderOccludedFlags,()=>this.setNeedsRender(),n))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get layerViewUid(){return M}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){const{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;const r=g(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,r)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;const{layerInfo:r,surface:i}=t;for(let s=0;s<r[1].length;s++){const r=i.layerViewByIndex(s,1);if(w(e,r)!==w(t,r))return!1}return!0}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,32===t?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const r of e.layerInfo[0])r.pendingUpdates&=-9;e.resetPendingUpdate(8);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=z-H,r=Math.max(0,Math.floor((e.level-t)/H)*H);if(this._isGlobal&&0===r)return h;for(;e.parent&&e.level>r;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new v(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersectRay(e,t,r,i){const s=this._rootTiles;if(!s||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&0!==this.transparency)return;const n=J,a=K;o(n,i,r),c(a,1/n[0],1/n[1],1/n[2]);const l=e.results.min,h=e.results.max,u=e.results.ground,_=0===e.options.store,g=!!e.results.ground.target,f=G(e.verticalOffset),p=e.tolerance;let b,x=_&&null!=l.distance?l.distance:1/0;const T=e.options,R=T.normalRequired||!T.backfacesTerrain,v=new C(p,!1,R),P=s=>{const c=s.renderData;if(!c?.vao)return;const g=c.geometry;m(W,g.boundingBox);const P=c.localOrigin;if(null!=f&&(f.localOrigin=P,f.applyToAabb(W)),X[0]=r[0]-P[0],X[1]=r[1]-P[1],X[2]=r[2]-P[2],!j(W,X,a,p,x))return;const w=(e,t,r,i)=>{e.set(this.type,s,t,r,i),x=_&&null!=l.renderDistance?l.renderDistance:1/0},O=(s,a,o)=>{(!R||null!=o)&&a>=0&&(T.backfacesTerrain||d(o,n)<0)&&(T.invisibleTerrain||!T.selectionMode||null==t||t(r,i,a))&&((null==u.renderDistance||a<u.renderDistance)&&w(u,s,a,o),T.isFiltered||(2===T.store&&(null==b?(b=new F(e.ray),w(b,s,a,o),e.results.all.push(b)):a<b.renderDistance&&w(b,s,a,o)),(null==l.renderDistance||a<l.renderDistance)&&w(l,s,a,o),0!==T.store&&(null==h.renderDistance||a>h.renderDistance)&&w(h,s,a,o)))},D=Y;o(D,i,P);const{indices:S,indexCount:B}=g,C=g.vertexAttributes,M=C.getField("position",y),G=new E(M.typedBuffer,3,C.stride/4),I=B/3;if(!f&&I>Q)c.intersectionData??=new A(S,I,G),c.intersectionData.intersectRay(X,D,v,O);else{q(X,D,0,I,(e,t)=>M.getVec(S[t],e),f,v,O)}},w=this._tileIterator;w.reset(s);const O=e.options.invisibleTerrain;for(let o=w.next();o;o=w.next())!(o.visible||O&&o.intersectsClippingArea)||null==f&&!o.intersectsRay(r,n,p,x)||g&&this._useStencilForTile(o)?w.skipSubtree():P(o)}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const r of t)null!=r.renderData?.textureReference&&e.queriesForTile(r);e.process(),t.madeProgress()}}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return 7;case 3:case 4:return null}}acquireTechniques(e){const{shadowMap:t,viewshedEnabled:r,cutFillComputationEnabled:i,slot:s,hasEmission:n,useFloatBlend:a}=e.bind,l=!!has("enable-feature:terrain-shadows")&&t.enabled;if(l!==this._castShadows&&(this._castShadows=l,this._patchesByOriginDirty=!0),this._inViewshed!==r&&(this._inViewshed=r,this._patchesByOriginDirty=!0),this._cutFillEnabled!==i&&(this._cutFillEnabled=i,this._patchesByOriginDirty=!0),3===this.transparency)return null;if(9===s){if(0===(e.renderOccludedMask&b))return null}else if(s!==this._desiredSlot)return null;const o=this._configuration;switch(o.screenSpaceReflections=o.cloudReflections=o.receiveShadows=o.hasShadowHighlights=o.receiveAmbientOcclusion=o.renderOccluded=o.hasHighlightMixTexture=!1,o.hasEmission=n,o.overlayMode=this._overlayRenderer.mode,o.useFloatBlend=a.value,e.output){case 0:case 1:case 2:{const r=e.bind;o.screenSpaceReflections=r.hasScreenSpaceReflections,o.cloudReflections=null!=r.clouds.data;const i=9===s;return o.receiveShadows=t.ready&&!i,o.hasShadowHighlights=U(o,e.bind),o.renderOccluded=i,o.receiveAmbientOcclusion=!i&&null!=r.ssao,o.receiveGlobalIllumination=!i&&r.globalIlluminationEnabled,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:case 11:return this._acquireTechnique(e.output);case 10:return o.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),this._passParameters.useStencil=!1,this._passParameters.overlayContent=S(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{const r=e.bind.highlight?.name;r&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(r)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const t=this._tileRenderer;let r;if(null!=e){const t=e.toUnitRGBA();r=u(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(r),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:null!=t.backgroundColor?1:0,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const r of e)O(r,t);e.sort((e,t)=>D(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange("visibleTiles"),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness("render-patch-groups"),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),r=e.renderData;if(!r){this._numTilesCulled++;continue}const i=r.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(i);t||(t=[],this._allPatchesByOrigin.set(i,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(i);s||(s=[],this._visiblePatchesByOrigin.set(i,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,r){const{rctx:i,bind:s}=e;i.bindTechnique(t,s,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach(r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(s,this._passParameters,this._drawParameters);for(let i=0;i<r.length;i++)this._renderPatch(e,t,r[i],V.TRIANGLES,n,null===this._passParameters.overlayContent)}),i.bindVAO(null)}_renderMaterialPass(e,t){const{rctx:r,bind:i}=e,s=r.bindTechnique(t,i,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const n=9===i.slot;n&&(s.bindTexture("tex",r.emptyTexture),s.setUniform3fv("textureOpacities",h),s.setUniform4fv("texOffsetAndScale",f));const a=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:h;1===this._configuration.tileBlendInput&&s.setUniform3fv("backgroundColor",a);const l=this._stencilEnabledLayerExtents.length>0,o=this.wireframe?V.LINES:V.TRIANGLES;this._configuration.textureFadingEnabled&&s.bindTexture("texNext",r.emptyTexture);for(const c of this._visiblePatchesByOrigin.values()){this._drawParameters.origin=c[0].renderData.localOrigin,t.program.bindDraw(i,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const r of c){const i=r.renderData,a=i.textureReference;if(null!=a){if(!n){s.setUniform4fv("texOffsetAndScale",a.offsetAndScale),s.bindTexture("tex",a.texture.texture);const e=i.textureFadeFactor,t=e<1?i.nextTextureReference:null;this._configuration.textureFadingEnabled&&t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),i.textureIsFading&&this.setNeedsRender(2),s.setUniform3fv("textureOpacities",a.opacities)}this._renderPatch(e,t,r,o,l),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}r.bindVAO(null)}_renderPatch(e,t,r,i,s,n=!1){const a=r.renderData,l=a.vao,o=l?.indexBuffer;if(!l||null==o)return void(R&&console.error("Rendered tile with no indices: ",r.lij," : ",a));const c=t.program;n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay);const{rctx:d,bind:h}=e;s&&(this._passParameters.useStencil=this._useStencilForTile(r),d.setPipelineState(t.getPipeline(h,this._passParameters)));const u=a.geometry.indexCount;d.bindVAO(l),c.assertCompatibleVertexAttributeLocations(l),d.drawElements(i,u,o.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(N,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([a({readOnly:!0})],Z.prototype,"visibleTiles",null),e([a({readOnly:!0})],Z.prototype,"_isGlobal",null),e([a()],Z.prototype,"renderOccludedFlags",null),e([a({value:!1})],Z.prototype,"renderingDisabled",null),e([a({value:!0})],Z.prototype,"visible",null),e([a()],Z.prototype,"renderPatchBorders",null),e([a()],Z.prototype,"wireframe",null),Z=e([l("esri.views.3d.terrain.TerrainRenderer")],Z);const J=_(),K=_(),X=_(),Y=_();export{Z as TerrainRenderer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clamp as t}from"../../../../core/mathUtils.js";import{estimateNumberArrayMemory as e}from"../../../../core/memoryEstimations.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as r,copy as s,nan as o,fromValues as i}from"../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as a}from"../../../../geometry/support/frustumPlanes.js";import{newContinuousIndexArray as c}from"../../../../geometry/support/Indices.js";import{createPositionReader as l}from"./PositionReader.js";import{MeshIntersectionOptions as h,intersectRayTriangles as g}from"./RayIntersections.js";import{forEachTriangleRangeScreenPolygonHit as m}from"./screenPolygonTriangleIntersections.js";const d=40,u=.8,y=10,_=1e-6;class p{constructor(e,r,s){this.globalTriangleVertexIndices=e,this.numTriangles=r,this.positions=s,this._rayDirection=n(),this._callback=M,this._intersectionOptions=T,this._screenPolygonCallback=R,this._screenPolygonDisplacement=null,this._screenPolygonIntersector=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this.bspNodeTree=new Array,this.triangleIndexMap=c(r),this._readPosition=l(s.data,e,s.stride);const o=b(e,r,s.data,s.stride),i=t(Math.log2(r/d),2,y),a=(t,e,n)=>{const r=x(this.triangleIndexMap,o,t,e),s=e-t;if(s<=d){const n=new P(r,void 0,0,t,e);return this.bspNodeTree.push(n),n}const{axis:c,midValue:l}=I(r),h=f(this.triangleIndexMap,o,t,e,c,l),g=(t,e)=>{if(n>i)return;const r=e-t;return r<d||r>=u*s?void 0:a(t,e,n+1)},m=new P(r,c,l,h.next,h.mid);return this.bspNodeTree.push(m),m.leftNode=g(t,h.next),m.rightNode=g(h.mid,e),m};a(0,r,0)}intersectRayTriangleRange(t,e){if(t>=e)return;const{data:n,stride:r}=this.positions;g(this._rayFrom,this._rayDirection,t,e,this.globalTriangleVertexIndices,n,r,this._intersectionOptions.normalRequired,this._callback,this.triangleIndexMap),p.numFacesTested+=e-t}forEachScreenPolygonHit(t,e,n,r,s){null!=t.camera&&0!==this.bspNodeTree.length&&(this._screenPolygonIntersector=t,this._screenPolygonTransformation=e,this._screenPolygonQuery=n,this._screenPolygonDisplacement=r,this._screenPolygonCallback=s,this._intersectScreenPolygonBSP(this.bspNodeTree[0],0,this.triangleIndexMap.length),this._screenPolygonCallback=R,this._screenPolygonDisplacement=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._screenPolygonIntersector=null)}intersectRay(t,e,n,r){p.numFacesTested=0;const s=t,o=e,i=o[0]-s[0],a=o[1]-s[1],c=o[2]-s[2];if(i*i+a*a+c*c<_)return;this._rayFrom=s;const l=this._rayDirection;l[0]=i,l[1]=a,l[2]=c;const h=this.triangleIndexMap.length;this._callback=r,this._intersectionOptions=n,this.intersectRayBSP(this.bspNodeTree[0],0,h),this._callback=M,this._intersectionOptions=T}intersectRayBSP(t,e,n){const r=this._rayFrom,s=this._rayDirection;this._traverseBSP(t,e,n,t=>S(t.aabb,r,s),t=>{const e=t.axis;return r[e]<t.d||s[e]<0},t=>{const e=t.axis;return r[e]>t.d||s[e]>0},(t,e)=>this.intersectRayTriangleRange(t,e))}_intersectScreenPolygonTriangleRange(t,e){if(t>=e)return;const n=this._screenPolygonIntersector,r=this._screenPolygonQuery;if(null!=n&&null!=r)for(const s of m(n,this._screenPolygonTransformation,r,t,e,this._readPosition,this._screenPolygonDisplacement,this.triangleIndexMap))this._screenPolygonCallback(s.distance,s.primitiveIndex,s.point)}_intersectScreenPolygonBSP(t,e,n){const r=this._screenPolygonIntersector,s=this._screenPolygonQuery;null!=r?.camera&&null!=s&&this._traverseBSP(t,e,n,t=>this._nodeIntersectsScreenPolygonBroadPhase(t.aabb),()=>!0,()=>!0,(t,e)=>this._intersectScreenPolygonTriangleRange(t,e))}_traverseBSP(t,e,n,r,s,o,i){const a=[{node:t,rangeStart:e,rangeEnd:n}];for(;a.length>0;){const{node:t,rangeStart:e,rangeEnd:n}=a.pop();r(t)&&(s(t)&&this._traverseBSPRange(a,t.leftNode,e,t.midStartIndex,i),i(t.midStartIndex,t.rightStartIndex),o(t)&&this._traverseBSPRange(a,t.rightNode,t.rightStartIndex,n,i))}}_traverseBSPRange(t,e,n,r,s){n>=r||(void 0!==e?t.push({node:e,rangeStart:n,rangeEnd:r}):s(n,r))}_nodeIntersectsScreenPolygonBroadPhase(t){const e=this._screenPolygonQuery;if(null==e)return!1;const n=this._screenPolygonDisplacement,r=n?n.applyToAabb(s(B,t)):t;return a(e.broadPhaseFrustum,r,this._screenPolygonTransformation)}static{this.numFacesTested=0}get estimatedMemoryUsage(){return e(this.triangleIndexMap)}}class P{constructor(t,e,n,r,s){this.aabb=t,this.axis=e,this.d=n,this.midStartIndex=r,this.rightStartIndex=s}}function f(t,e,n,r,s,o){const i=s+3;let a=n,c=n,l=r;for(;c<l;){const n=t[c],r=6*n;e[r+i]<=o?(t[c]=t[a],t[a]=n,++a,++c):e[r+s]>=o?(--l,t[c]=t[l],t[l]=n):++c}return{next:a,mid:l}}function x(t,e,n,r){if(r<=n)return o;let s=6*t[n],a=e[s++],c=e[s++],l=e[s++],h=e[s++],g=e[s++],m=e[s];for(let o=n+1;o<r;++o)s=6*t[o],a=Math.min(a,e[s++]),c=Math.min(c,e[s++]),l=Math.min(l,e[s++]),h=Math.max(h,e[s++]),g=Math.max(g,e[s++]),m=Math.max(m,e[s]);return i(a,c,l,h,g,m)}function I(t){const e=t[3]-t[0],n=t[4]-t[1],r=t[5]-t[2],s=e>n?e>r?0:n>r?1:2:n>r?1:r>e?2:0;return{axis:s,midValue:(t[s]+t[s+3])/2}}function b(t,e,n,r){const s=new Float64Array(6*e);for(let o=0;o<e;++o){const e=3*o,i=t[e]*r,a=t[e+1]*r,c=t[e+2]*r;for(let t=0;t<3;++t){const e=n[i+t],r=n[a+t],l=n[c+t];s[6*o+t]=Math.min(e,r,l),s[6*o+3+t]=Math.max(e,r,l)}}return s}function S(t,e,n){const r=e,s=n;let o=0,i=1/0;for(let a=0;a<3;++a){{const e=t[a];if(r[a]<e){if(s[a]<=_)return!1;const t=(e-r[a])/s[a];o=Math.max(o,t)}else if(s[a]<=-_){const t=(e-r[a])/s[a];i=Math.min(i,t)}if(o>i)return!1}{const e=t[a+3];if(r[a]>e){if(s[a]>=-_)return!1;const t=(e-r[a])/s[a];o=Math.max(o,t)}else if(s[a]>=_){const t=(e-r[a])/s[a];i=Math.min(i,t)}if(o>i)return!1}}return!0}const T=new h,M=()=>{},R=()=>{},B=r();export{p as TriangleIntersectionData};
2
+ import{clamp as t}from"../../../../core/mathUtils.js";import{estimateNumberArrayMemory as e}from"../../../../core/memoryEstimations.js";import{isFloat32Array as n}from"../../../../core/typedArrayUtil.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as s,copy as o,nan as i,fromValues as a}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as c}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{intersectsTransformedAabb as h}from"../../../../geometry/support/frustumPlanes.js";import{newContinuousIndexArray as g}from"../../../../geometry/support/Indices.js";import{createPositionReader as m}from"./PositionReader.js";import{MeshIntersectionOptions as d,intersectRayTriangles as u}from"./RayIntersections.js";import{forEachTriangleRangeScreenPolygonHit as y}from"./screenPolygonTriangleIntersections.js";const p=40,_=.8,f=10,P=1e-6;class x{constructor(e,n,s){this.globalTriangleVertexIndices=e,this.numTriangles=n,this.positions=s,this._rayDirection=r(),this._callback=j,this._intersectionOptions=B,this._screenPolygonCallback=v,this._screenPolygonDisplacement=null,this._screenPolygonIntersector=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this.bspNodeTree=new Array,this.triangleIndexMap=g(n),this._readPosition=m(s.data,e,s.stride);const o=M(e,n,s.data,s.stride),i=t(Math.log2(n/p),2,f),a=(t,e,n)=>{const r=S(this.triangleIndexMap,o,t,e),s=e-t;if(s<=p){const n=new b(r,void 0,0,t,e);return this.bspNodeTree.push(n),n}const{axis:c,midValue:l}=T(r),h=I(this.triangleIndexMap,o,t,e,c,l),g=(t,e)=>{if(n>i)return;const r=e-t;return r<p||r>=_*s?void 0:a(t,e,n+1)},m=new b(r,c,l,h.next,h.mid);return this.bspNodeTree.push(m),m.leftNode=g(t,h.next),m.rightNode=g(h.mid,e),m};a(0,n,0)}intersectRayTriangleRange(t,e){if(t>=e)return;const{data:n,stride:r}=this.positions;u(this._rayFrom,this._rayDirection,t,e,this.globalTriangleVertexIndices,n,r,this._intersectionOptions.normalRequired,this._callback,this.triangleIndexMap),x.numFacesTested+=e-t}forEachScreenPolygonHit(t,e,n,r,s){null!=t.camera&&0!==this.bspNodeTree.length&&(this._screenPolygonIntersector=t,this._screenPolygonTransformation=e,this._screenPolygonQuery=n,this._screenPolygonDisplacement=r,this._screenPolygonCallback=s,this._intersectScreenPolygonBSP(this.bspNodeTree[0],0,this.triangleIndexMap.length),this._screenPolygonCallback=v,this._screenPolygonDisplacement=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._screenPolygonIntersector=null)}intersectRay(t,e,n,r){x.numFacesTested=0;const s=t,o=e,i=o[0]-s[0],a=o[1]-s[1],c=o[2]-s[2];if(i*i+a*a+c*c<P)return;this._rayFrom=s;const l=this._rayDirection;l[0]=i,l[1]=a,l[2]=c;const h=this.triangleIndexMap.length;this._callback=r,this._intersectionOptions=n,this.intersectRayBSP(this.bspNodeTree[0],0,h),this._callback=j,this._intersectionOptions=B}intersectRayBSP(t,e,n){const r=this._rayFrom,s=this._rayDirection;this._traverseBSP(t,e,n,t=>R(t.aabb,r,s),t=>{const e=t.axis;return r[e]<t.d||s[e]<0},t=>{const e=t.axis;return r[e]>t.d||s[e]>0},(t,e)=>this.intersectRayTriangleRange(t,e))}_intersectScreenPolygonTriangleRange(t,e){if(t>=e)return;const n=this._screenPolygonIntersector,r=this._screenPolygonQuery;if(null!=n&&null!=r)for(const s of y(n,this._screenPolygonTransformation,r,t,e,this._readPosition,this._screenPolygonDisplacement,this.triangleIndexMap))this._screenPolygonCallback(s.distance,s.primitiveIndex,s.point)}_intersectScreenPolygonBSP(t,e,n){const r=this._screenPolygonIntersector,s=this._screenPolygonQuery;null!=r?.camera&&null!=s&&this._traverseBSP(t,e,n,t=>this._nodeIntersectsScreenPolygonBroadPhase(t.aabb),()=>!0,()=>!0,(t,e)=>this._intersectScreenPolygonTriangleRange(t,e))}_traverseBSP(t,e,n,r,s,o,i){const a=[{node:t,rangeStart:e,rangeEnd:n}];for(;a.length>0;){const{node:t,rangeStart:e,rangeEnd:n}=a.pop();r(t)&&(s(t)&&this._traverseBSPRange(a,t.leftNode,e,t.midStartIndex,i),i(t.midStartIndex,t.rightStartIndex),o(t)&&this._traverseBSPRange(a,t.rightNode,t.rightStartIndex,n,i))}}_traverseBSPRange(t,e,n,r,s){n>=r||(void 0!==e?t.push({node:e,rangeStart:n,rangeEnd:r}):s(n,r))}_nodeIntersectsScreenPolygonBroadPhase(t){const e=this._screenPolygonQuery;if(null==e)return!1;const n=this._screenPolygonDisplacement,r=n?n.applyToAabb(o(D,t)):t;return h(e.broadPhaseFrustum,r,this._screenPolygonTransformation)}static{this.numFacesTested=0}get estimatedMemoryUsage(){return e(this.triangleIndexMap)}}class b{constructor(t,e,n,r,s){this.aabb=t,this.axis=e,this.d=n,this.midStartIndex=r,this.rightStartIndex=s}}function I(t,e,n,r,s,o){const i=s+3;let a=n,c=n,l=r;for(;c<l;){const n=t[c],r=6*n;e[r+i]<=o?(t[c]=t[a],t[a]=n,++a,++c):e[r+s]>=o?(--l,t[c]=t[l],t[l]=n):++c}return{next:a,mid:l}}function S(t,e,n,r){if(r<=n)return i;let s=6*t[n],o=e[s++],c=e[s++],l=e[s++],h=e[s++],g=e[s++],m=e[s];for(let i=n+1;i<r;++i)s=6*t[i],o=Math.min(o,e[s++]),c=Math.min(c,e[s++]),l=Math.min(l,e[s++]),h=Math.max(h,e[s++]),g=Math.max(g,e[s++]),m=Math.max(m,e[s]);return a(o,c,l,h,g,m)}function T(t){const e=t[3]-t[0],n=t[4]-t[1],r=t[5]-t[2],s=e>n?e>r?0:n>r?1:2:n>r?1:r>e?2:0;return{axis:s,midValue:(t[s]+t[s+3])/2}}function M(t,e,r,s){const o=n(r)?l(6*e,!0):c(6*e);for(let n=0;n<e;++n){const e=3*n,i=t[e]*s,a=t[e+1]*s,c=t[e+2]*s;for(let t=0;t<3;++t){const e=r[i+t],s=r[a+t],l=r[c+t];o[6*n+t]=Math.min(e,s,l),o[6*n+3+t]=Math.max(e,s,l)}}return o}function R(t,e,n){const r=e,s=n;let o=0,i=1/0;for(let a=0;a<3;++a){{const e=t[a];if(r[a]<e){if(s[a]<=P)return!1;const t=(e-r[a])/s[a];o=Math.max(o,t)}else if(s[a]<=-P){const t=(e-r[a])/s[a];i=Math.min(i,t)}if(o>i)return!1}{const e=t[a+3];if(r[a]>e){if(s[a]>=-P)return!1;const t=(e-r[a])/s[a];o=Math.max(o,t)}else if(s[a]>=P){const t=(e-r[a])/s[a];i=Math.min(i,t)}if(o>i)return!1}}return!0}const B=new d,j=()=>{},v=()=>{},D=s();export{x as TriangleIntersectionData};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../Camera.js";import i from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as s}from"../core/domUtils.js";import n from"../core/Error.js";import{on as a}from"../core/events.js";import{destroyHandle as o,makeHandle as l}from"../core/handleUtils.js";import has from"../core/has.js";import p from"../core/Logger.js";import{mapCollectionAsync as h}from"../core/mapCollectionUtils.js";import{destroyMaybe as d,maybeProperty as u}from"../core/maybe.js";import{throwIfDestroyed as c,throwIfAborted as g,createAbortError as m}from"../core/promiseUtils.js";import y from"../core/ReactiveSet.js";import{on as f,watch as w,initial as v,sync as _,whenOnce as b,syncAndInitial as M}from"../core/reactiveUtils.js";import{setFrameDuration as S,cleanupScheduling as V}from"../core/scheduling.js";import{createScreenPoint as j,createScreenPointArray as C}from"../core/screenUtils.js";import{cleanupWhereClauseCache as T}from"../core/sql.js";import{getMetersPerUnitForSR as R}from"../core/units.js";import{property as x,cast as A,subclass as O}from"../core/accessorSupport/decorators.js";import{ensureType as E,ensureClass as L}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as I}from"../core/accessorSupport/overrideDefaultsFrom.js";import{runUntracked as H}from"../core/accessorSupport/tracking.js";import{drainNotificationQueue as P}from"../core/accessorSupport/trackingUtils.js";import{create as D}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{cleanupPooledRBush as F}from"../core/libs/rbush/PooledRBush.js";import{initialize as U}from"../core/workers/workers.js";import G from"../geometry/Extent.js";import W from"../geometry/HeightModelInfo.js";import z from"../geometry/Point.js";import{project as q,canProjectWithoutEngine as k}from"../geometry/projectionUtils.js";import B from"../geometry/SpatialReference.js";import{cleanupSpatialReferenceEllipsoidUtils as N}from"../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingRect as Z}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as Q}from"../geometry/projection/projectPointToVector.js";import{toExtent as Y,create as $}from"../geometry/support/aaBoundingRect.js";import{renderSRFromViewSR as J}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as K}from"../geometry/support/scaleUtils.js";import{wgs84 as X,webMercator as ee}from"../geometry/support/spatialReferenceUtils.js";import{makeDehydratedPoint as te}from"../layers/graphics/dehydratedPoint.js";import{isImageryTileLayer as ie,isTiledLayer as re,isVoxelLayer as se,isIntegratedMeshLayer as ne,isGaussianSplatLayer as ae}from"../layers/support/layerUtils.js";import{TilemapCache as oe}from"../layers/support/TilemapCache.js";import{clearDefaultPortalInstance as le}from"../portal/portalDefault.js";import{WebSceneTag as pe}from"../support/tagSymbols.js";import{BreakpointsOwner as he}from"./BreakpointsOwner.js";import{DOMContainer as de}from"./DOMContainer.js";import{PopupView as ue}from"./PopupView.js";import ce from"./View.js";import ge from"./ViewAnimation.js";import{stringFromViewingMode as me,viewingModeFromString as ye}from"./ViewingMode.js";import{GroundView3D as fe}from"./3d/GroundView3D.js";import{layerView3DImporter as we}from"./3d/layerViewModuleImportUtils.js";import{importAnalysisViewModule as ve}from"./3d/analysis/analysisViewModuleImportUtils.js";import{cleanupIntersectionUtils as _e}from"./3d/camera/intersectionUtils.js";import be from"./3d/constraints/Constraints.js";import Me from"./3d/environment/Environment.js";import{EnvironmentManager as Se}from"./3d/environment/EnvironmentManager.js";import Ve from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as je}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as Ce}from"./3d/layers/graphics/Labeler.js";import Te from"./3d/layers/i3s/I3SLodHandling.js";import{Navigation3D as Re}from"./3d/navigation/Navigation3D.js";import{ScreenSizePerspective as xe}from"./3d/state/ScreenSizePerspective.js";import Ae from"./3d/state/ViewState.js";import{ViewStateManager as Oe,cleanupViewStateManager as Ee}from"./3d/state/ViewStateManager.js";import{cleanupPointToPointAnimationController as Le}from"./3d/state/controllers/PointToPointAnimationController.js";import{SceneIntersectionHelper as Ie}from"./3d/state/helpers/SceneIntersectionHelper.js";import{cleanupNavigationUtils as He}from"./3d/state/utils/navigationUtils.js";import Pe from"./3d/support/Attribution3D.js";import{CombinedElevationProvider as De}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as Fe}from"./3d/support/debugFlags.js";import{getElevationAtPoint as Ue}from"./3d/support/ElevationProvider.js";import{GroundAndIMSurface as Ge}from"./3d/support/GroundAndIMSurface.js";import{toMap as We,hitTest as ze}from"./3d/support/hitTest.js";import{popupHitTest as qe}from"./3d/support/popupHitTest.js";import{getDefaultQualityProfileName as ke,getQualityProfileSettings as Be}from"./3d/support/QualityProfile.js";import Ne from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as Ze}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Qe}from"./3d/support/ResourceController.js";import Ye from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as $e}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as Je}from"./3d/support/ViewSlice.js";import{PointsOfInterest as Ke}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import Xe from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as et,getTiledLayerInfo as tt,checkIfTileInfoSupportedForView as it}from"./3d/terrain/terrainUtils.js";import{clearTilePerLayerInfo as rt}from"./3d/terrain/TilePerLayerInfo.js";import{cleanupTileRenderer as st}from"./3d/terrain/TileRenderer.js";import{Stage as nt}from"./3d/webgl-engine/Stage.js";import{olidEnabled as at}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{cleanupRenderOccluded as ot}from"./3d/webgl-engine/effects/geometry/RenderOccluded.js";import{defaultTolerance as lt}from"./3d/webgl-engine/lib/Intersector.js";import{cleanupShadowmap as pt}from"./3d/webgl-engine/lib/ShadowMap.js";import{terrainId as ht}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{cleanupEdgeProcessing as dt}from"./3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js";import ut from"./interactive/options/ViewOptions.js";import ct from"./support/AnalysisViewManager.js";import{cleanupDrapedUtils as gt}from"./support/drapedUtils.js";import{occludeesSupported as mt}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as yt,createScreenPointFromSupportedEvent as ft}from"./support/screenUtils.js";import{isSpatialReferenceSupported as wt}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as vt,destroyTextureCompressionWorker as _t}from"./support/TextureCompressionHelper.js";import bt from"./ui/DefaultUI.js";import Mt from"./ui/3d/DefaultUI3D.js";import St from"../webscene/Environment.js";import{clearVNodeCache as Vt}from"../widgets/support/vnodeCache.js";var jt;const Ct=Symbol(),Tt=Symbol();function Rt(e){const t=L(ut,e);return t!==e&&null==e.snapping?.enabled&&(t.snapping.enabled=!0),t}let xt=class extends(he(ue(de(ce)))){static{jt=this}get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this.options=new ut({snapping:{enabled:!0}}),this._userClippingArea=null,this._clippingArea=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=Qe(this),this.deconflictor=new je({view:this}),this.attribution3D=new Pe({view:this}),this.labeler=new Ce({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.navigation=new Re({view:this}),this.basemapTerrain=null,this.elevationProvider=new De({view:this}),this._canvas=null,this.constraints=new be,this._environment=new Me,this.environmentManager=new Se,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new ct({importAnalysisViewModule:e=>ve(e),view:this}),this.groundView=null,this.groundAndIMSurface=null,this.map=null,this._featureTileTreeClients=new y,this._featureTiles=null,this._featureTreeDebugger=null,this.state=new Ae({view:this}),this.slice=new Je,this.spatialReference=null,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new Mt,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,U();const t=()=>this._updatingChanged();this.addHandles(o(h(()=>this.map?.allLayers,async e=>{try{await e.when()}catch{}finally{t()}}))),this.addHandles([f(()=>this.map?.allLayers,"after-changes",t,{onListenerAdd:t,onListenerRemove:t,sync:!0}),this.allLayerViews.on("after-changes",e=>this._updateUpdatingMonitors(e)),w(()=>this.scene,e=>e?.load().catch(()=>{}))]),this.inputManager=new Ve({view:this}),this.stateManager=new Oe({view:this}),this.screenSizePerspective=new xe({view:this})}initialize(){if(has("enable-feature:esri-compress-textures")&&has("wasm-simd")){const e=vt(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new fe({view:this}),this.groundAndIMSurface=new Ge({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add(()=>this.qualitySettings.memoryLimit,e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)},v),this.updatingHandles.add(()=>this.qualitySettings.additionalCacheMemory,e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)},v),this.updatingHandles.add(()=>this.qualitySettings.frameRate??0,e=>S(e>0?1e3/Math.ceil(e):0),v),this.addHandles([w(()=>this.spatialReference,()=>this.notifyChange("clippingArea"),_),w(()=>({plane:this.slice.plane,isDecoration:this.slice.isDecoration}),()=>this._updateSlice(),_)])}destroy(){this.destroyed||(_t(this),this.updatingHandles.removeAll(),this.basemapTerrain?.clearHandles(),this.elevationProvider.destroy(),this.ui.removeAllHandles(),this.layerViewManager.clearHandles(),this.invalidate(),this.layerViewManager.clear(),this._set("analysisViewManager",d(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this.sharedSymbolResources=d(this.sharedSymbolResources),this._set("labeler",d(this.labeler)),this._set("deconflictor",d(this.deconflictor)),this._resourceController=d(this._resourceController),this._set("stateManager",d(this.stateManager)),this._set("inputManager",d(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",d(this.environmentManager)),this._set("environment",d(this.environment)),this.groundView=d(this.groundView),this.groundAndIMSurface.destroy(),this.slice.destroy(),this._updatingObjectsWithProgress.length=0,this._updatingObjects.length=0,this.ui?.destroy(),this._set("ui",null),this._set("renderCanvas",null),this._set("canvas",null),this._canvas=null,this.screenSizePerspective.destroy(),this.attribution3D.destroy())}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get groundSpatialReference(){return this.groundView?.spatialReference}get analyses(){return super.analyses}set analyses(e){super.analyses=e}get animation(){return this.state?.animation}get overlayManager(){return this.basemapTerrain?.overlayManager}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get canvas(){return this._canvas}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=E(z,e))}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||u(e,"clippingArea");return!this._userClippingArea&&!u(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof G?this.spatialReference&&(t=At(t,this.spatialReference),null==t)?(p.getLogger(this).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(t=t.clone(),null==t.intersection(this._groundAndLayersExtent)&&(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(p.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?p.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(1===this.state.viewingMode)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:At(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||B.WGS84,i=At(this.clippingArea,t);null!=i&&(e=null!=e?e.intersection(i):i);const r=this._get("dataExtent");return null!=e&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||B.WGS84;let t;const i=i=>{const r=At(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},{groundView:r}=this,s=r?.spatialReference,n=r?.fullGroundExtent;s&&n&&i(new G({xmin:n[0],ymin:n[1],zmin:0,xmax:n[2],ymax:n[3],zmax:0,spatialReference:s}));const a=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};if(this.map?.allLayers.forEach(e=>a(e)),null==t)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);const o=this._get("_groundAndLayersExtent");return t.equals(o)?o:t}get environment(){return this._environment}set environment(e){if(this._environment===e)return;const{_environment:t}=this;this._environment=null,t?.destroy(),this._environment=e,this.notifyChange("environment")}castEnvironment(e){return e?e instanceof Me?e:e instanceof St?this.environment?.cloneWithWebsceneEnvironment(e)??Me.fromWebsceneEnvironment(e):E(Me,e):new Me}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get _layerToLayerviewMapping(){return jt._layerToLayerview}static{this._layerToLayerview=ce._layerToLayerview.concat([["view.map.ground.layers","view.groundView.layerViews"]])}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get scene(){return this.map&&pe in this.map?this.map:null}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get featureTiles(){return this._featureTiles}set qualityProfile(e){const t=Be(e);t&&this._get("qualityProfile")!==e&&(this.qualitySettings=new Ne(t),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||ke()}_updateSlice(){null!=this.stage&&(this.stage.renderer.slice=this.slice)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){const{scale:e,spatialReference:t}=this;return t?H(()=>K(e,t)):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get terrainLevel(){const e=this.basemapTerrain?.tilingScheme,t=this.scale;if(!e||!t)return null;const i=e.levelAtScale(t)+this.qualitySettings.tiledSurface.lodBias,r=e.getMaxLod();return i<=0?null:Math.max(0,Math.min(i,r||1/0))}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();return null!=e?W.deriveUnitFromSR(e,this.spatialReference):null}get alphaCompositingEnabled(){return this._get("alphaCompositingEnabled")}set alphaCompositingEnabled(e){this._stage&&p.getLogger(this).warn("alphaCompositingEnabled cannot be changed after the view has become ready"),this._set("alphaCompositingEnabled",e)}get updating(){if(this.destroying||this.destroyed)return!1;if(!this.initialized)return!0;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach(r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||et(r))return;++i,e+=r.updatingProgress}}else++i});const r=.1;for(const n of this._updatingObjects)n?.updating&&(i+=r,e+=.5*r);for(const n of this._updatingObjectsWithProgress)n?.updating&&(++i,e+=n.updatingProgress);const s=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||s||this._importControllers.size>0||this.inputManager?.updating||this.map?.allLayers?.some(e=>!e.isFulfilled())),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return Fe.UPDATING&&console.log("Updating:",this._updatingObjectsToDebug.filter(e=>null!=e&&e.updating).map(({declaredClass:e})=>e)),t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this.stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager,this.focusAreasView]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get _updatingObjectsToDebug(){return Fe.UPDATING?this._updatingObjects.concat(this._updatingObjectsWithProgress).concat(this.allLayerViews.toArray()):[]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return me(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?me(this.defaultsFromMap.viewingMode):wt(t,1)?"global":"local":"global"}set viewingMode(e){this.ready?p.getLogger(this).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new Ye(this)}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return p.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=yt(e)?ft(this,e):e;return We(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return p.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;let t=e;return null==e.z&&(t=It,t.x=e.x,t.y=e.y,t.z=Ue(this.elevationProvider,e)??0,t.spatialReference=e.spatialReference),Q(t,Ot,this.renderSpatialReference),this.state.camera.projectToScreen(Ot,Et),j(Et[0],Et[1])}pixelSizeAt(e,t){if(!this.ready)return p.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null;if(!e)return 0;const i=this.renderSpatialReference;Q(e,Ot,i);const r=this.state.camera.computeScreenPixelSizeAt(Ot);return t&&i!==t?r*R(i)/R(t):r}overlayPixelSizeInMapUnits(e){return this.overlayManager?.overlayPixelSizeInMapUnits(e,()=>this.pixelSizeAt(e))??1}hitTest(e,t){if(!this.ready)return p.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=yt(e)?ft(this,e):e;return ze(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return qe(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async zoomIn(){if(this.canZoomIn)return this.navigation.zoom(!0)}async zoomOut(){if(this.canZoomOut)return this.navigation.zoom(!1)}async whenAnalysisView(e){if(null==e.parent)throw new n("view:no-analysisview-for-analysis","The analysis does not exist in view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":case"viewshed":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=(await this.stage.renderView.takeScreenshot(t))[0];return(await(import("./support/screenshotUtils.js"))).encode(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=(await this.stage.renderView.takeScreenshot(t))[0];return(await(import("./support/screenshotUtils.js"))).encodeData(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=await this._completeSettings(e);t.olidColor=!0,await this.whenReady();const i=await this.stage.renderView.takeScreenshot(t),{encodeData:r}=await(import("./support/screenshotUtils.js"));return[r(i[0],this._pixelFormat()),r(i[1],this._pixelFormat())]}async _completeSettings(e){const{toRenderSettings:t,screenshotSuperSampleSettings:i}=await(import("./support/screenshotUtils.js")),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,i(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this.stage?.renderView.getAlpha()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!at())throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true");const{encode:t}=await(import("./support/screenshotUtils.js")),i=await this._completeSettings(e);i.olidColor=!0,await this.whenReady();const r=await this.stage.renderView.takeScreenshot(i),s=t(r[0],i,this._pixelFormat()),a=await this._completeSettings(e);a.format="png";return[s,t(r[1],a,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){const e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true")}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}getAttributionItems(){return super.getAttributionItems().concat(this.attribution3D.attributionItems)}importLayerView(e){return we.importLayerView(e)}hasLayerViewModule(e){return we.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getWebDocumentSpatialReference(){return this.scene?.initialViewProperties?.spatialReference}getDefaultTimeZone(){return this.scene?.initialViewProperties?.timeZone??null}getSurface(){return this.surface}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):this.scene?.initialViewProperties?.viewingMode;return null!=e?ye(e):null}getSpatialReferenceSupport(e,t){const i=this._predeterminedViewingMode,r=r=>this._validateSpatialReferenceForViewingMode(e,t,r)?this._makeSpatialReferenceConstraints(e,t,r,i):null,s=i?r(i):[...r(1)??[],...r(2)??[]];return s?.length?{constraints:s}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!wt(e,i)&&(null==t||(!!ie(t)||(!re(t)||null!=tt(t,e,i))&&(!se(t)||1!==i)))}_makeSpatialReferenceConstraints(e,t,i,r){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:s,isWGS84:n,vcsWkid:a,latestVcsWkid:o}=e,l=()=>null==a?s?B.WGS84:B.WebMercator:new B({...s?X:ee,vcsWkid:a,latestVcsWkid:o});if(ie(t)&&(s||n)){return!n||2===r||null===it(t.tileInfo,t.fullExtent,e,1)?[{spatialReference:e,viewingMode:i},{spatialReference:l(),viewingMode:i}]:[{spatialReference:l(),viewingMode:i}]}return re(t)||se(t)||!s&&!n?re(t)&&s&&1!==i?[{spatialReference:e,viewingMode:i},{spatialReference:l(),viewingMode:2}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:l(),viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?p.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${me(i)} viewing mode.`):e.isGeographic&&p.getLogger(this).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}trackGraphicState(e){if(!e.graphic)return p.getLogger(this).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&null!=t&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return null!=t?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then(e=>s(e),()=>{}).catch(()=>{}),l(()=>{r=!0,null!=i&&(i.remove(),i=null)})}maskOccludee(e){if(!e)return p.getLogger(this).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&null!=t&&mt(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then(e=>s(e),()=>{}).catch(()=>{}),l(()=>{r=!0,null!=i&&(i.remove(),i=null)})}getViewForGraphic(e){return e.layer===this?this.graphicsView:e.layer?this.allLayerViews.filter(e=>"media-3d"!==e.type).find(t=>t.layer===e.layer):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await b(()=>this.graphicsView),this.graphicsView):e.layer&&this.map?t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise((t,i)=>{const r=this.map.allLayers.on("change",s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))})}):this.whenLayerView(e.layer):null}enableFeatureTiles(){const e=Symbol();return this._featureTileTreeClients.add(e),l(()=>this._featureTileTreeClients.delete(e))}async _importModule(e,t){const i=new AbortController;this._importControllers.set(e,i),this._updatingChanged();try{const r=await Ht[e]();if(t&&(c(this),g(i.signal),await t(i.signal)),this.destroyed)throw m();return g(i.signal),r}catch{return null}finally{this._importControllers.delete(e),this._updatingChanged()}}_abortImport(e){this._importControllers.get(e)?.abort(),this._importControllers.delete(e),this._updatingChanged()}_initBasemapTerrain(){this._set("basemapTerrain",new Xe({view:this})),this.elevationProvider.register(0,this.basemapTerrain)}_exitBasemapTerrain(){const{basemapTerrain:e,elevationProvider:t}=this;e&&(this._set("basemapTerrain",null),t.unregister(e),e.destroy())}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new Ke({view:this})),this.addHandles([this.updatingHandles.add(()=>Fe.FEATURE_TILE_TREE_SHOW_TILES,e=>{e&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then(({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&Fe.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))}):e||(this._featureTreeDebugger=d(this._featureTreeDebugger))},M),this.updatingHandles.add(()=>({basemapExtent:this.groundView?.groundExtent,basemapSpatialReference:this.groundView?.spatialReference,clippingArea:this.clippingArea,featureTiles:this._featureTiles}),({basemapExtent:e,basemapSpatialReference:t,clippingArea:i,featureTiles:r})=>{if(!r)return;const s=!!e;if(i||s)if(s&&t){const s=e&&t?q(Y(e,t),this.spatialReference):null;r.filterExtent=i?i.intersection(s):s}else r.filterExtent=i;else r.filterExtent=null},M),this.updatingHandles.add(()=>this._featureTileTreeClients.size>0,e=>{e?this.updatingHandles.consumePromise(this._ensureFeatureTileTree()):this._featureTiles=d(this._featureTiles)},_)],Ct),this.stateManager.init()}async _ensureFeatureTileTree(){if(this._featureTiles||this._importControllers.has("FeatureTileTree3D"))return;const e=(await this.updatingHandles.addPromise(this._importModule("FeatureTileTree3D")))?.FeatureTileTree3D;e&&(this._featureTiles=new e({renderCoordsHelper:this.renderCoordsHelper,pointsOfInterest:this.pointsOfInterest,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}),this._updatingChanged())}_exitTerrain(){this.stateManager.exit(),this.removeHandles(Tt),this.removeHandles(Ct),this._featureTiles=d(this.featureTiles),this._set("pointsOfInterest",d(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem()}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=J(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",Ze.create(this.state.viewingMode,i)),t||this.addHandles(w(()=>this.groundView?.groundExtent,e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!Z(e,this.groundView.spatialReference,Lt,t)||(this.renderCoordsHelper.extent=Lt)},_),Tt),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(lt/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles(Tt),this._set("renderCoordsHelper",null)}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&4===e.type||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach(e=>{e.destroyed||(this.addHandles(w(()=>[e.updating,e.updatingProgress],()=>this._updatingChanged(),_),"updatingMonitors"),e.when(()=>this._updatingChanged(),()=>this._updatingChanged()))}),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,i){if(!this.overlay||!this.overlay.hasVisibleItems)return i;const r=e.getContext("2d",{willReadFrequently:!0});return r.putImageData(i,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,i.width,i.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,i)=>this._renderScreenshotOverlay(e,t,i)}},t=new Ie(this.state.viewingMode,e=>this.stage.layers.forEach(e),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new nt({view:this,options:e,container:i}),this.notifyChange("stage"),this._updateSlice(),this.addHandles([this.on("pointer-move",()=>this.stage?.renderer.resetAnimation()),a(this.stage.renderView.canvas,"webglcontextlost",e=>{this.fatalError=new n("webgl-context-lost",e.statusMessage||"WebGL context lost")})],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(lt/this.renderCoordsHelper.unitInMeters),this._set("canvas",this.stage.renderView.canvas)}_exitStage(){this.sceneIntersectionHelper?.destroy(),this._set("sceneIntersectionHelper",null),this._stage=d(this.stage),this._set("stage",null),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new $e({view:this,resourceController:this._resourceController})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitTerrain(),this._exitStage())}async _ensureGraphicsView(){if(this.graphicsView||this._importControllers.has("GraphicsView3D")||0===this.graphics.length)return;this.removeHandles("GraphicsView3D");const e=(await this.updatingHandles.addPromise(this._importModule("GraphicsView3D",e=>b(()=>this.groundView?.ready,e))))?.default;e&&this._set("graphicsView",new e({view:this,getGraphics:()=>this.graphics})),this._updatingChanged()}_disposeGraphicsView(){this._abortImport("GraphicsView3D"),this.removeHandles("GraphicsView3D"),this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_disposeFocusAreasView(){this._abortImport("FocusAreasView"),this.removeHandles("FocusAreasView"),this.focusAreasView=d(this.focusAreasView)}async _ensureFocusAreasView(e){if(this.focusAreasView||this._importControllers.has("FocusAreasView")||0===e)return;this.removeHandles("FocusAreasView");const t=(await this.updatingHandles.addPromise(this._importModule("FocusAreasView")))?.FocusAreasView;t&&(this.focusAreasView=new t({view:this})),this._updatingChanged()}_startup(){1===ye(this.viewingMode)&&(this._clippingArea=null),this._initSurface(),this._set("ready",!0),this.addHandles(f(()=>this.graphics,"after-changes",()=>this._ensureGraphicsView()),"GraphicsView3D"),this._ensureGraphicsView(),this.addHandles(this.updatingHandles.add(()=>this.map?.focusAreas?.areas.length??0,e=>this._ensureFocusAreasView(e),{initial:!0}),"FocusAreasView");const e=this.scene?.initialViewProperties??null,t=e?.environment;t&&(this._overrideDefaultEnvironmentOnly?I(this.environment,t):this.environment=this.environment.cloneWithWebsceneEnvironment(t)),this.timeExtent=e?.timeExtent,e?.analyses.applyTo(this),this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const i=this._resolveWhenReady;this._resolveWhenReady=[],i.forEach(e=>e(this))}_teardown(){this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this._exitSurface(),this._set("ready",!1)}get _defaultToMapOptions(){const e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(ht);for(const t of this.allLayerViews)(ne(t.layer)&&(!has("enable-feature:im-as-ground")||t.layer.isUsedAsGroundLayer)||ae(t.layer))&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){const e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(ht);for(const t of this.allLayerViews)(has("enable-feature:im-as-ground")?ne(t.layer)&&t.layer.isUsedAsGroundLayer:ne(t.layer))&&t.fullOpacity<1&&e.exclude.add(t.uid);return e}static{this.type="3d"}static clearStatics(){Vt(),P(),T(),dt(),Ee(),_e(),N(),gt(),le(),st(),pt(),Le(),He(),F(),V(),ot(),rt(),Te.cleanupI3SLodHandling(),oe.cleanupTilemapCache(),Ae.cleanupViewstate(),Xe.cleanupTerrainSurface()}};function At(e,t){return null!=e&&k(e.spatialReference,t)?q(e,t):null}e([x({nonNullable:!0}),A(Rt)],xt.prototype,"options",void 0),e([x()],xt.prototype,"_userClippingArea",void 0),e([x()],xt.prototype,"_resourceController",void 0),e([x()],xt.prototype,"stage",null),e([x({readOnly:!0})],xt.prototype,"deconflictor",void 0),e([x({readOnly:!0})],xt.prototype,"labeler",void 0),e([x()],xt.prototype,"navigation",void 0),e([x({type:ge,readOnly:!0})],xt.prototype,"animation",null),e([x({readOnly:!0})],xt.prototype,"basemapTerrain",void 0),e([x({readOnly:!0})],xt.prototype,"overlayManager",null),e([x({readOnly:!0})],xt.prototype,"elevationProvider",void 0),e([x()],xt.prototype,"camera",null),e([x({type:t})],xt.prototype,"contentCamera",null),e([x({readOnly:!0})],xt.prototype,"canvas",null),e([x({type:z,useTypeForAutocast:!1})],xt.prototype,"center",null),e([x({type:G})],xt.prototype,"clippingArea",null),e([x({type:be,nonNullable:!0})],xt.prototype,"constraints",void 0),e([x({type:G,readOnly:!0})],xt.prototype,"renderDataExtent",null),e([x({readOnly:!0})],xt.prototype,"tileInfo",null),e([x({type:G,readOnly:!0})],xt.prototype,"dataExtent",null),e([x({type:G,readOnly:!0})],xt.prototype,"_groundAndLayersExtent",null),e([x({type:Me})],xt.prototype,"environment",null),e([A("environment")],xt.prototype,"castEnvironment",null),e([x({readOnly:!0})],xt.prototype,"environmentManager",void 0),e([x({type:G})],xt.prototype,"extent",null),e([x({type:r})],xt.prototype,"floors",void 0),e([x()],xt.prototype,"screenCenter",null),e([x()],xt.prototype,"frustum",null),e([x({type:Number,readOnly:!0})],xt.prototype,"fullOpacity",void 0),e([x({readOnly:!0})],xt.prototype,"graphicsView",void 0),e([x()],xt.prototype,"analysisViewManager",void 0),e([x()],xt.prototype,"groundView",void 0),e([x({readOnly:!0})],xt.prototype,"layerviewCollections",null),e([x({type:Boolean})],xt.prototype,"initialExtentRequired",null),e([x()],xt.prototype,"defaultsFromMapSettings",null),e([x()],xt.prototype,"interacting",null),e([x()],xt.prototype,"stationary",null),e([x()],xt.prototype,"navigating",null),e([x()],xt.prototype,"map",void 0),e([x()],xt.prototype,"padding",null),e([x({type:Ke,readOnly:!0})],xt.prototype,"pointsOfInterest",void 0),e([x()],xt.prototype,"_featureTiles",void 0),e([x()],xt.prototype,"featureTiles",null),e([x()],xt.prototype,"_featureTreeDebugger",void 0),e([x({constructOnly:!0})],xt.prototype,"deactivatedWebGLExtensions",void 0),e([x({constructOnly:!0})],xt.prototype,"debugWebGLExtensions",void 0),e([x({constructOnly:!0})],xt.prototype,"renderCanvas",void 0),e([x({constructOnly:!0})],xt.prototype,"state",void 0),e([x()],xt.prototype,"screenSizePerspective",void 0),e([x({readOnly:!0})],xt.prototype,"inputManager",void 0),e([x({readOnly:!0})],xt.prototype,"stateManager",void 0),e([x({type:["low","medium","high"]})],xt.prototype,"qualityProfile",null),e([x({type:Ne,get(){let e=this._get("qualitySettings");if(!e){const t=Be(this.qualityProfile);e=new Ne(t)}return e}})],xt.prototype,"qualitySettings",void 0),e([x()],xt.prototype,"slice",void 0),e([x({readOnly:!0})],xt.prototype,"typeSpecificPreconditionsReady",null),e([x({readOnly:!0})],xt.prototype,"renderCoordsHelper",void 0),e([x({readOnly:!0})],xt.prototype,"sceneIntersectionHelper",void 0),e([x({type:Number,readOnly:!0})],xt.prototype,"resolution",null),e([x({type:Number})],xt.prototype,"scale",null),e([x({readOnly:!0,type:Number})],xt.prototype,"terrainLevel",null),e([x()],xt.prototype,"heightModelInfo",null),e([x({type:B})],xt.prototype,"spatialReference",void 0),e([x({type:Boolean,value:!1})],xt.prototype,"alphaCompositingEnabled",null),e([x({constructOnly:!0})],xt.prototype,"preserveDrawingBufferEnabled",void 0),e([x({type:Boolean})],xt.prototype,"supersampleScreenshotsEnabled",void 0),e([x({readOnly:!0})],xt.prototype,"type",void 0),e([x(),A(e=>e instanceof bt?e:L(Mt,e))],xt.prototype,"ui",void 0),e([x({type:Boolean,readOnly:!0})],xt.prototype,"updating",null),e([x()],xt.prototype,"_updatingObjects",null),e([x()],xt.prototype,"_updatingObjectsWithProgress",null),e([x()],xt.prototype,"_updatingObjectsToDebug",null),e([x({type:Number,readOnly:!0})],xt.prototype,"updatingProgress",void 0),e([x({type:["global","local"]})],xt.prototype,"viewingMode",null),e([x({type:i})],xt.prototype,"viewpoint",null),e([x({readOnly:!0})],xt.prototype,"visibleArea",null),e([x({type:Number})],xt.prototype,"zoom",null),e([x({readOnly:!0})],xt.prototype,"quality",null),e([x({readOnly:!0})],xt.prototype,"resolutionScale",null),e([x()],xt.prototype,"focusAreasView",void 0),e([x()],xt.prototype,"_defaultToMapOptions",null),e([x()],xt.prototype,"_defaultHitTestOptions",null),xt=jt=e([O("esri.views.SceneView")],xt);const Ot=D(),Et=C(),Lt=$(),It=te(0,0,0,B.WebMercator),Ht={GraphicsView3D:()=>import("./3d/layers/GraphicsView3D.js"),FocusAreasView:()=>import("./3d/FocusAreasView.js"),FeatureTileTree3D:()=>import("./3d/layers/support/FeatureTileTree3D.js")},Pt=xt;export{Pt as default};
2
+ import{__decorate as e}from"tslib";import t from"../Camera.js";import i from"../Viewpoint.js";import r from"../core/Collection.js";import{byId as s}from"../core/domUtils.js";import n from"../core/Error.js";import{on as a}from"../core/events.js";import{destroyHandle as o,makeHandle as l}from"../core/handleUtils.js";import has from"../core/has.js";import p from"../core/Logger.js";import{mapCollectionAsync as h}from"../core/mapCollectionUtils.js";import{destroyMaybe as d,maybeProperty as u}from"../core/maybe.js";import{throwIfDestroyed as c,throwIfAborted as g,createAbortError as m}from"../core/promiseUtils.js";import y from"../core/ReactiveSet.js";import{on as f,watch as w,initial as v,sync as _,whenOnce as b,syncAndInitial as M}from"../core/reactiveUtils.js";import{setFrameDuration as S,cleanupScheduling as V}from"../core/scheduling.js";import{createScreenPoint as j,createScreenPointArray as C}from"../core/screenUtils.js";import{cleanupWhereClauseCache as T}from"../core/sql.js";import{getDefaultVerticalUnitStringForSR as R,getMetersPerUnitForSR as x}from"../core/units.js";import{property as A,cast as O,subclass as E}from"../core/accessorSupport/decorators.js";import{ensureType as L,ensureClass as I}from"../core/accessorSupport/ensureType.js";import{overrideDefaultsFrom as H}from"../core/accessorSupport/overrideDefaultsFrom.js";import{runUntracked as P}from"../core/accessorSupport/tracking.js";import{drainNotificationQueue as D}from"../core/accessorSupport/trackingUtils.js";import{create as F}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{cleanupPooledRBush as U}from"../core/libs/rbush/PooledRBush.js";import{initialize as G}from"../core/workers/workers.js";import W from"../geometry/Extent.js";import z from"../geometry/HeightModelInfo.js";import q from"../geometry/Point.js";import{project as k,canProjectWithoutEngine as B}from"../geometry/projectionUtils.js";import N from"../geometry/SpatialReference.js";import{cleanupSpatialReferenceEllipsoidUtils as Z}from"../geometry/spatialReferenceEllipsoidUtils.js";import{projectBoundingRect as Q}from"../geometry/projection/projectBoundingRect.js";import{projectPointToVector as Y}from"../geometry/projection/projectPointToVector.js";import{toExtent as $,create as J}from"../geometry/support/aaBoundingRect.js";import{renderSRFromViewSR as K}from"../geometry/support/coordinateSystem.js";import{getResolutionForScale as X}from"../geometry/support/scaleUtils.js";import{wgs84 as ee,webMercator as te}from"../geometry/support/spatialReferenceUtils.js";import{makeDehydratedPoint as ie}from"../layers/graphics/dehydratedPoint.js";import{isImageryTileLayer as re,isTiledLayer as se,isVoxelLayer as ne,isIntegratedMeshLayer as ae,isGaussianSplatLayer as oe}from"../layers/support/layerUtils.js";import{TilemapCache as le}from"../layers/support/TilemapCache.js";import{clearDefaultPortalInstance as pe}from"../portal/portalDefault.js";import{WebSceneTag as he}from"../support/tagSymbols.js";import{BreakpointsOwner as de}from"./BreakpointsOwner.js";import{DOMContainer as ue}from"./DOMContainer.js";import{PopupView as ce}from"./PopupView.js";import ge from"./View.js";import me from"./ViewAnimation.js";import{stringFromViewingMode as ye,viewingModeFromString as fe}from"./ViewingMode.js";import{GroundView3D as we}from"./3d/GroundView3D.js";import{layerView3DImporter as ve}from"./3d/layerViewModuleImportUtils.js";import{importAnalysisViewModule as _e}from"./3d/analysis/analysisViewModuleImportUtils.js";import{cleanupIntersectionUtils as be}from"./3d/camera/intersectionUtils.js";import Me from"./3d/constraints/Constraints.js";import Se from"./3d/environment/Environment.js";import{EnvironmentManager as Ve}from"./3d/environment/EnvironmentManager.js";import je from"./3d/input/SceneInputManager.js";import{GraphicsDeconflictor as Ce}from"./3d/layers/graphics/GraphicsDeconflictor.js";import{Labeler as Te}from"./3d/layers/graphics/Labeler.js";import Re from"./3d/layers/i3s/I3SLodHandling.js";import{Navigation3D as xe}from"./3d/navigation/Navigation3D.js";import{ScreenSizePerspective as Ae}from"./3d/state/ScreenSizePerspective.js";import Oe from"./3d/state/ViewState.js";import{ViewStateManager as Ee,cleanupViewStateManager as Le}from"./3d/state/ViewStateManager.js";import{cleanupPointToPointAnimationController as Ie}from"./3d/state/controllers/PointToPointAnimationController.js";import{SceneIntersectionHelper as He}from"./3d/state/helpers/SceneIntersectionHelper.js";import{cleanupNavigationUtils as Pe}from"./3d/state/utils/navigationUtils.js";import De from"./3d/support/Attribution3D.js";import{CombinedElevationProvider as Fe}from"./3d/support/CombinedElevationProvider.js";import{debugFlags as Ue}from"./3d/support/debugFlags.js";import{getElevationAtPoint as Ge}from"./3d/support/ElevationProvider.js";import{GroundAndIMSurface as We}from"./3d/support/GroundAndIMSurface.js";import{toMap as ze,hitTest as qe}from"./3d/support/hitTest.js";import{popupHitTest as ke}from"./3d/support/popupHitTest.js";import{getDefaultQualityProfileName as Be,getQualityProfileSettings as Ne}from"./3d/support/QualityProfile.js";import Ze from"./3d/support/QualitySettings.js";import{RenderCoordsHelper as Qe}from"./3d/support/RenderCoordsHelper.js";import{newResourceController as Ye}from"./3d/support/ResourceController.js";import $e from"./3d/support/SceneViewPerformanceInfo.js";import{SharedSymbolResources as Je}from"./3d/support/SharedSymbolResources.js";import{ViewSlice as Ke}from"./3d/support/ViewSlice.js";import{PointsOfInterest as Xe}from"./3d/support/pointsOfInterest/PointsOfInterest.js";import et from"./3d/terrain/TerrainSurface.js";import{isSurfaceLayerView as tt,getTiledLayerInfo as it,checkIfTileInfoSupportedForView as rt}from"./3d/terrain/terrainUtils.js";import{clearTilePerLayerInfo as st}from"./3d/terrain/TilePerLayerInfo.js";import{cleanupTileRenderer as nt}from"./3d/terrain/TileRenderer.js";import{Stage as at}from"./3d/webgl-engine/Stage.js";import{olidEnabled as ot}from"./3d/webgl-engine/effects/geometry/olidUtils.js";import{cleanupRenderOccluded as lt}from"./3d/webgl-engine/effects/geometry/RenderOccluded.js";import{defaultTolerance as pt}from"./3d/webgl-engine/lib/Intersector.js";import{cleanupShadowmap as ht}from"./3d/webgl-engine/lib/ShadowMap.js";import{terrainId as dt}from"./3d/webgl-engine/lib/verticalOffsetUtils.js";import{cleanupEdgeProcessing as ut}from"./3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js";import ct from"./interactive/options/ViewOptions.js";import gt from"./support/AnalysisViewManager.js";import{cleanupDrapedUtils as mt}from"./support/drapedUtils.js";import{occludeesSupported as yt}from"./support/layerViewUtils.js";import{isSupportedScreenPointEvent as ft,createScreenPointFromSupportedEvent as wt}from"./support/screenUtils.js";import{isSpatialReferenceSupported as vt}from"./support/spatialReferenceSupport.js";import{initializeTextureCompressionWorker as _t,destroyTextureCompressionWorker as bt}from"./support/TextureCompressionHelper.js";import Mt from"./ui/DefaultUI.js";import St from"./ui/3d/DefaultUI3D.js";import Vt from"../webscene/Environment.js";import{clearVNodeCache as jt}from"../widgets/support/vnodeCache.js";var Ct;const Tt=Symbol(),Rt=Symbol();function xt(e){const t=I(ct,e);return t!==e&&null==e.snapping?.enabled&&(t.snapping.enabled=!0),t}let At=class extends(de(ce(ue(ge)))){static{Ct=this}get timeZone(){return super.timeZone}set timeZone(e){super.timeZone=e}constructor(e){super(e),this.options=new ct({snapping:{enabled:!0}}),this._userClippingArea=null,this._clippingArea=null,this._overrideDefaultEnvironmentOnly=!0,this._resolveWhenReady=[],this._resourceController=Ye(this),this.deconflictor=new Ce({view:this}),this.attribution3D=new De({view:this}),this.labeler=new Te({view:this,deconflictor:this.deconflictor.labels}),this.sharedSymbolResources=null,this.navigation=new xe({view:this}),this.basemapTerrain=null,this.elevationProvider=new Fe({view:this}),this._canvas=null,this.constraints=new Me,this._environment=new Se,this.environmentManager=new Ve,this.floors=new r,this.fullOpacity=1,this.graphicsView=null,this.analysisViewManager=new gt({importAnalysisViewModule:e=>_e(e),view:this}),this.groundView=null,this.groundAndIMSurface=null,this.map=null,this._featureTileTreeClients=new y,this._featureTiles=null,this._featureTreeDebugger=null,this.state=new Oe({view:this}),this.slice=new Ke,this.spatialReference=null,this.preserveDrawingBufferEnabled=!1,this.supersampleScreenshotsEnabled=!0,this.type="3d",this.ui=new St,this._numUpdating=0,this._lastUpdateTime=0,this.updatingProgress=.5,this._importControllers=new Map,G();const t=()=>this._updatingChanged();this.addHandles(o(h(()=>this.map?.allLayers,async e=>{try{await e.when()}catch{}finally{t()}}))),this.addHandles([f(()=>this.map?.allLayers,"after-changes",t,{onListenerAdd:t,onListenerRemove:t,sync:!0}),this.allLayerViews.on("after-changes",e=>this._updateUpdatingMonitors(e)),w(()=>this.scene,e=>e?.load().catch(()=>{}))]),this.inputManager=new je({view:this}),this.stateManager=new Ee({view:this}),this.screenSizePerspective=new Ae({view:this})}initialize(){if(has("enable-feature:esri-compress-textures")&&has("wasm-simd")){const e=_t(this,this.resourceController);this.addResolvingPromise(e.promise)}this.groundView=new we({view:this}),this.groundAndIMSurface=new We({view:this}),this._updateUpdatingMonitors(),this.updatingHandles.add(()=>this.qualitySettings.memoryLimit,e=>{this.resourceController&&(this.resourceController.memoryController.maxMemory=e)},v),this.updatingHandles.add(()=>this.qualitySettings.additionalCacheMemory,e=>{this.resourceController&&(this.resourceController.memoryController.additionalCacheMemory=e)},v),this.updatingHandles.add(()=>this.qualitySettings.frameRate??0,e=>S(e>0?1e3/Math.ceil(e):0),v),this.addHandles([w(()=>this.spatialReference,()=>this.notifyChange("clippingArea"),_),w(()=>({plane:this.slice.plane,isDecoration:this.slice.isDecoration}),()=>this._updateSlice(),_)])}destroy(){this.destroyed||(bt(this),this.updatingHandles.removeAll(),this.basemapTerrain?.clearHandles(),this.elevationProvider.destroy(),this.ui.removeAllHandles(),this.layerViewManager.clearHandles(),this.invalidate(),this.layerViewManager.clear(),this._set("analysisViewManager",d(this.analysisViewManager)),this._exitSurface(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this.sharedSymbolResources=d(this.sharedSymbolResources),this._set("labeler",d(this.labeler)),this._set("deconflictor",d(this.deconflictor)),this._resourceController=d(this._resourceController),this._set("stateManager",d(this.stateManager)),this._set("inputManager",d(this.inputManager)),this.state.destroy(),this.highlights.destroy(),this.removeHandles("updatingMonitors"),this._set("environmentManager",d(this.environmentManager)),this._set("environment",d(this.environment)),this.groundView=d(this.groundView),this.groundAndIMSurface.destroy(),this.slice.destroy(),this._updatingObjectsWithProgress.length=0,this._updatingObjects.length=0,this.ui?.destroy(),this._set("ui",null),this._set("renderCanvas",null),this._set("canvas",null),this._canvas=null,this.screenSizePerspective.destroy(),this.attribution3D.destroy())}get stage(){return this._stage}get renderSpatialReference(){return this.renderCoordsHelper?.spatialReference}get groundSpatialReference(){return this.groundView?.spatialReference}get analyses(){return super.analyses}set analyses(e){super.analyses=e}get animation(){return this.state?.animation}get overlayManager(){return this.basemapTerrain?.overlayManager}get camera(){return this.stateManager?.camera}set camera(e){this.stateManager&&(this.stateManager.camera=e)}get contentCamera(){return this.stateManager?.contentCamera}set contentCamera(e){this.stateManager&&(this.stateManager.contentCamera=e)}installContentCameraReset(e={sticky:!1}){return this.stateManager.installContentCameraReset(e)}get canvas(){return this._canvas}get center(){return this.stateManager?.center}set center(e){this.stateManager&&(this.stateManager.center=L(q,e))}get clippingArea(){if("global"===this.viewingMode)return null;const e=this.map;let t=this._userClippingArea||u(e,"clippingArea");return!this._userClippingArea&&!u(e,"clippingEnabled")||null==t?(this._clippingArea=null,null):t instanceof W?this.spatialReference&&(t=Ot(t,this.spatialReference),null==t)?(p.getLogger(this).error("#clippingArea","setting clippingArea with incompatible SpatialReference"),this._clippingArea):(t=t.clone(),null==t.intersection(this._groundAndLayersExtent)&&(t.xmin=t.xmax,t.ymin=t.ymax),t.zmin=void 0,t.zmax=void 0,t.equals(this._clippingArea)||(this._clippingArea=t),this._clippingArea):(p.getLogger(this).error("#clippingArea","only clippingArea geometries of type Extent are supported"),this._clippingArea)}set clippingArea(e){this.ready&&"global"===this.viewingMode&&null!=e?p.getLogger(this).error("#clippingArea=","Clipping area is only supported in local viewingMode"):this._userClippingArea=e}get renderDataExtent(){if(1===this.state.viewingMode)return null;const e=this.renderSpatialReference,t=this.dataExtent;return null==t||null==e||t.spatialReference.equals(e)?t:Ot(t,e)}get tileInfo(){return this.basemapTerrain?.tilingScheme?.toTileInfo()}get dataExtent(){let e=this._groundAndLayersExtent;const t=this.spatialReference||N.WGS84,i=Ot(this.clippingArea,t);null!=i&&(e=null!=e?e.intersection(i):i);const r=this._get("dataExtent");return null!=e&&e.equals(r)?r:e}get _groundAndLayersExtent(){const e=this.spatialReference||N.WGS84;let t;const i=i=>{const r=Ot(i,e);null!=r&&(null!=t?t.union(r):t=r.clone())},{groundView:r}=this,s=r?.spatialReference,n=r?.fullGroundExtent;s&&n&&i(new W({xmin:n[0],ymin:n[1],zmin:0,xmax:n[2],ymax:n[3],zmax:0,spatialReference:s}));const a=e=>{null==e.fullExtent||"graphics"===e.type&&e.internal||i(e.fullExtent)};if(this.map?.allLayers.forEach(e=>a(e)),null==t)return null;t.hasZ?(t.zmin=Math.min(0,t.zmin??0),t.zmax=Math.max(0,t.zmax??0)):(t.zmin=0,t.zmax=0);const o=this._get("_groundAndLayersExtent");return t.equals(o)?o:t}get environment(){return this._environment}set environment(e){if(this._environment===e)return;const{_environment:t}=this;this._environment=null,t?.destroy(),this._environment=e,this.notifyChange("environment")}castEnvironment(e){return e?e instanceof Se?e:e instanceof Vt?this.environment?.cloneWithWebsceneEnvironment(e)??Se.fromWebsceneEnvironment(e):L(Se,e):new Se}get extent(){return this.stateManager?.extent}set extent(e){this.stateManager&&(this.stateManager.extent=e)}get screenCenter(){return this.stateManager?.screenCenter}get frustum(){return this.stateManager?.frustum}get layerviewCollections(){return[this.basemapView?.baseLayerViews,this.basemapView?.groundLayerViews,this.groundView?.layerViews,this.layerViews,this.basemapView?.referenceLayerViews]}get _layerToLayerviewMapping(){return Ct._layerToLayerview}static{this._layerToLayerview=ge._layerToLayerview.concat([["view.map.ground.layers","view.groundView.layerViews"]])}get initialExtentRequired(){return this.stateManager&&!this.stateManager.hasInitialView}get defaultsFromMapSettings(){return{required:{tileInfo:!1,heightModelInfo:!0,extent:!1}}}get interacting(){return this.navigating||(this.toolViewManager?.interacting??!1)}get stationary(){return!this.animation&&!this.resizing&&(this.state?.stationary??!0)}get navigating(){return this.state?.navigating??!1}get scene(){return this.map&&he in this.map?this.map:null}get padding(){return this.stateManager?.padding}set padding(e){this.stateManager&&(this.stateManager.padding=e)}get featureTiles(){return this._featureTiles}set qualityProfile(e){const t=Ne(e);t&&this._get("qualityProfile")!==e&&(this.qualitySettings=new Ze(t),this.stage?.renderView.updateQualitySettings(this.qualitySettings),this._set("qualityProfile",e))}get qualityProfile(){return this._get("qualityProfile")||Be()}_updateSlice(){null!=this.stage&&(this.stage.renderer.slice=this.slice)}get typeSpecificPreconditionsReady(){return!!this.viewingMode&&!!this.stateManager?.preinit(this.spatialReference)}get resolution(){const{scale:e,spatialReference:t}=this;return t?P(()=>X(e,t)):0}get scale(){return this.stateManager?.scale}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get terrainLevel(){const e=this.basemapTerrain?.tilingScheme,t=this.scale;if(!e||!t)return null;const i=e.levelAtScale(t)+this.qualitySettings.tiledSurface.lodBias,r=e.getMaxLod();return i<=0?null:Math.max(0,Math.min(i,r||1/0))}get heightModelInfo(){const e=this.getDefaultHeightModelInfo();if(!e)return null;const t=R(this.spatialReference);return t&&e.heightUnit!==t?new z({heightModel:e.heightModel,heightUnit:t,vertCRS:e.vertCRS}):e}get alphaCompositingEnabled(){return this._get("alphaCompositingEnabled")}set alphaCompositingEnabled(e){this._stage&&p.getLogger(this).warn("alphaCompositingEnabled cannot be changed after the view has become ready"),this._set("alphaCompositingEnabled",e)}get updating(){if(this.destroying||this.destroyed)return!1;if(!this.initialized)return!0;let e=0,t=this.layerViewManager.updating,i=t?this.layerViewManager.updatingRemaining:0;this.allLayerViews.forEach(r=>{if(r.isFulfilled()){if(r.updating){if(t=!0,r.suspended||tt(r))return;++i,e+=r.updatingProgress}}else++i});const r=.1;for(const n of this._updatingObjects)n?.updating&&(i+=r,e+=.5*r);for(const n of this._updatingObjectsWithProgress)n?.updating&&(++i,e+=n.updatingProgress);const s=!this.stateManager.test.updatingIgnoreRenderState&&this.state.updating;if(t=!!(t||i>0||this.updatingHandles.updating||!this.ready||!this.stationary||s||this._importControllers.size>0||this.inputManager?.updating||this.map?.allLayers?.some(e=>!e.isFulfilled())),t?(this._numUpdating=Math.max(i,this._numUpdating),e+=this._numUpdating-i):this._numUpdating=0,this._numUpdating>0?e/=this._numUpdating:e=t?0:1,this._get("updatingProgress")!==e){const i=performance.now();if(e<1){const t=Math.min((i-this._lastUpdateTime)/2e3,1);e=this.updatingProgress*(1-t)+e*t}this._set("updatingProgress",e),this._lastUpdateTime=t&&e<1?i:0}return Ue.UPDATING&&console.log("Updating:",this._updatingObjectsToDebug.filter(e=>null!=e&&e.updating).map(({declaredClass:e})=>e)),t}get _updatingObjects(){return[this.graphicsView,this.basemapView,this._resourceController,this.stage,this.featureTiles,this.pointsOfInterest,this.environmentManager,this.overlay,this._featureTreeDebugger,this.toolViewManager,this.analysisViewManager,this.focusAreasView]}get _updatingObjectsWithProgress(){return[this.deconflictor,this.labeler,this.basemapTerrain]}get _updatingObjectsToDebug(){return Ue.UPDATING?this._updatingObjects.concat(this._updatingObjectsWithProgress).concat(this.allLayerViews.toArray()):[]}get viewingMode(){const e=this._predeterminedViewingMode;if(null!=e)return ye(e);const t=this.spatialReference;return t?null!=this.defaultsFromMap?.viewingMode&&t.equals(this.defaultsFromMap.spatialReference)?ye(this.defaultsFromMap.viewingMode):vt(t,1)?"global":"local":"global"}set viewingMode(e){this.ready?p.getLogger(this).error("#viewingMode","viewingMode cannot be set once view is ready"):this._overrideIfSome("viewingMode",e)}get viewpoint(){return this.stateManager?.viewpoint}set viewpoint(e){this.stateManager&&(this.stateManager.viewpoint=e)}get visibleArea(){return this.stateManager?.visibleArea}get zoom(){return this.stateManager.zoom}set zoom(e){this.stateManager&&(this.stateManager.zoom=e)}get resourceController(){return this._resourceController}get quality(){return this._resourceController?.memoryController?.memoryFactor??1}get resolutionScale(){return Math.sqrt(Math.min(1,this.quality/.75))}get performanceInfo(){return new $e(this)}on(e,t,i,r){const s=this.viewEvents.on(e,t,i,r);return s||super.on(e,t)}hasEventListener(e){return super.hasEventListener(e)||this.viewEvents.hasHandler(e)}toMap(e,t){if(!this.ready)return p.getLogger(this).error("#toMap()","Scene view cannot be used before it is ready"),null;const i=ft(e)?wt(this,e):e;return ze(this,i,t,this._defaultToMapOptions)}toScreen(e){if(!this.ready)return p.getLogger(this).error("#toScreen()","Scene view cannot be used before it is ready"),null;let t=e;return null==e.z&&(t=Ht,t.x=e.x,t.y=e.y,t.z=Ge(this.elevationProvider,e)??0,t.spatialReference=e.spatialReference),Y(t,Et,this.renderSpatialReference),this.state.camera.projectToScreen(Et,Lt),j(Lt[0],Lt[1])}pixelSizeAt(e,t){if(!this.ready)return p.getLogger(this).error("#pixelSizeAt()","Scene view cannot be used before it is ready"),null;if(!e)return 0;const i=this.renderSpatialReference;Y(e,Et,i);const r=this.state.camera.computeScreenPixelSizeAt(Et);return t&&i!==t?r*x(i)/x(t):r}overlayPixelSizeInMapUnits(e){return this.overlayManager?.overlayPixelSizeInMapUnits(e,()=>this.pixelSizeAt(e))??1}hitTest(e,t){if(!this.ready)return p.getLogger(this).error("#hitTest()","Scene view cannot be used before it is ready"),null;const i=ft(e)?wt(this,e):e;return qe(this,i,t,this._defaultHitTestOptions)}async popupHitTest(e){return ke(this,e)}goTo(e,t){return this.updatingHandles.addPromise(this.stateManager.goTo(e,t))}async zoomIn(){if(this.canZoomIn)return this.navigation.zoom(!0)}async zoomOut(){if(this.canZoomOut)return this.navigation.zoom(!1)}async whenAnalysisView(e){if(null==e.parent)throw new n("view:no-analysisview-for-analysis","The analysis does not exist in view.analyses",{analysis:e});switch(e.parent.type){case"line-of-sight":case"dimension":case"viewshed":return(await this.whenLayerView(e.parent)).whenAnalysisView();default:return this.analysisViewManager.whenAnalysisView(e)}}whenLayerView(e){return super.whenLayerView(e)}async takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=(await this.stage.renderView.takeScreenshot(t))[0];return(await(import("./support/screenshotUtils.js"))).encode(i,t,this._pixelFormat())}async _takeScreenshot(e){const t=await this._completeSettings(e);await this.whenReady();const i=(await this.stage.renderView.takeScreenshot(t))[0];return(await(import("./support/screenshotUtils.js"))).encodeData(i,this._pixelFormat())}async _takeScreenshotWithObjectAndLayerId(e){const t=await this._completeSettings(e);t.olidColor=!0,await this.whenReady();const i=await this.stage.renderView.takeScreenshot(t),{encodeData:r}=await(import("./support/screenshotUtils.js"));return[r(i[0],this._pixelFormat()),r(i[1],this._pixelFormat())]}async _completeSettings(e){const{toRenderSettings:t,screenshotSuperSampleSettings:i}=await(import("./support/screenshotUtils.js")),r=t(e,this);return r.pixelRatio/=this.state.pixelRatio,i(r,this.supersampleScreenshotsEnabled,this.padding)}_pixelFormat(){return{flipY:!0,premultipliedAlpha:this.stage?.renderView.getAlpha()??!1}}get test(){}async takeScreenshotWithObjectAndLayerId(e){if(!ot())throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true");const{encode:t}=await(import("./support/screenshotUtils.js")),i=await this._completeSettings(e);i.olidColor=!0,await this.whenReady();const r=await this.stage.renderView.takeScreenshot(i),s=t(r[0],i,this._pixelFormat()),a=await this._completeSettings(e);a.format="png";return[s,t(r[1],a,this._pixelFormat())]}getColorToObjectAndLayerIdMapping(){const e=this.stage.renderView.olidRenderHelper;if(e)return e.getColorToObjectAndLayerIdMapping();throw new n("360vr:objectAndLayerId-rendering-disabled","has enable-feature:objectAndLayerId-rendering must be true")}addUpdatingPromise(e){return this.updatingHandles.addPromise(e)}getAttributionItems(){return super.getAttributionItems().concat(this.attribution3D.attributionItems)}importLayerView(e){return ve.importLayerView(e)}hasLayerViewModule(e){return ve.hasLayerViewModule(e)}forceDOMReadyCycle(){this.forceReadyCycle()}getWebDocumentSpatialReference(){return this.scene?.initialViewProperties?.spatialReference}getDefaultTimeZone(){return this.scene?.initialViewProperties?.timeZone??null}getSurface(){return this.surface}get _predeterminedViewingMode(){const e=this._isOverridden("viewingMode")?this._get("viewingMode"):this.scene?.initialViewProperties?.viewingMode;return null!=e?fe(e):null}getSpatialReferenceSupport(e,t){const i=this._predeterminedViewingMode,r=r=>this._validateSpatialReferenceForViewingMode(e,t,r)?this._makeSpatialReferenceConstraints(e,t,r,i):null,s=i?r(i):[...r(1)??[],...r(2)??[]];return s?.length?{constraints:s}:null}_validateSpatialReferenceForViewingMode(e,t,i){return!!vt(e,i)&&(null==t||(!!re(t)||(!se(t)||null!=it(t,e,i))&&(!ne(t)||1!==i)))}_makeSpatialReferenceConstraints(e,t,i,r){if(null==t)return[{spatialReference:e,viewingMode:i}];const{isWebMercator:s,isWGS84:n,vcsWkid:a,latestVcsWkid:o}=e,l=()=>null==a?s?N.WGS84:N.WebMercator:new N({...s?ee:te,vcsWkid:a,latestVcsWkid:o});if(re(t)&&(s||n)){return!n||2===r||null===rt(t.tileInfo,t.fullExtent,e,1)?[{spatialReference:e,viewingMode:i},{spatialReference:l(),viewingMode:i}]:[{spatialReference:l(),viewingMode:i}]}return se(t)||ne(t)||!s&&!n?se(t)&&s&&1!==i?[{spatialReference:e,viewingMode:i},{spatialReference:l(),viewingMode:2}]:[{spatialReference:e,viewingMode:i}]:[{spatialReference:e,viewingMode:i},{spatialReference:l(),viewingMode:i}]}_validateSpatialReference(e){const t=null!=this.getSpatialReferenceSupport(e),i=this._predeterminedViewingMode;return t||(null!=i?p.getLogger(this).warnOnce(`Spatial reference defined on view not supported in ${ye(i)} viewing mode.`):e.isGeographic&&p.getLogger(this).warnOnce("Spatial reference is geographic but not supported.")),t}whenReady(){return new Promise(e=>{this.ready?e(this):this._resolveWhenReady.push(e)})}trackGraphicState(e){if(!e.graphic)return p.getLogger(this).error("trackGraphicState","GraphicState.graphic must not be null or undefined to start tracking"),null;const t=this.getViewForGraphic(e.graphic);let i=null,r=!1;const s=t=>{!r&&null!=t&&"processor"in t&&"graphics-3d"===t.processor?.type&&t.processor.graphicsCore&&(i=t.processor.graphicsCore.trackGraphicState(e))};return null!=t?s(t):this.whenViewForGraphic(e.graphic,{waitForLayer:!0}).then(e=>s(e),()=>{}).catch(()=>{}),l(()=>{r=!0,null!=i&&(i.remove(),i=null)})}maskOccludee(e){if(!e)return p.getLogger(this).error("maskOccludee","GraphicState.graphic must not be null or undefined to mask an occludee"),null;const t=this.getViewForGraphic(e);let i=null,r=!1;const s=t=>{!r&&null!=t&&yt(t)&&(i=t.maskOccludee(e))};return null!=t?s(t):this.whenViewForGraphic(e,{waitForLayer:!0}).then(e=>s(e),()=>{}).catch(()=>{}),l(()=>{r=!0,null!=i&&(i.remove(),i=null)})}getViewForGraphic(e){return e.layer===this?this.graphicsView:e.layer?this.allLayerViews.filter(e=>"media-3d"!==e.type).find(t=>t.layer===e.layer):null}graphicChanged(e){null!=this.graphicsView&&this.graphicsView.graphicChanged(e)}async whenViewForGraphic(e,t){return e.layer===this?(await b(()=>this.graphicsView),this.graphicsView):e.layer&&this.map?t&&t.waitForLayer&&!this.map.allLayers.includes(e.layer)?new Promise((t,i)=>{const r=this.map.allLayers.on("change",s=>{s.added.includes(e.layer)&&(r.remove(),this.whenLayerView(e.layer).then(t,i))})}):this.whenLayerView(e.layer):null}enableFeatureTiles(){const e=Symbol();return this._featureTileTreeClients.add(e),l(()=>this._featureTileTreeClients.delete(e))}async _importModule(e,t){const i=new AbortController;this._importControllers.set(e,i),this._updatingChanged();try{const r=await Pt[e]();if(t&&(c(this),g(i.signal),await t(i.signal)),this.destroyed)throw m();return g(i.signal),r}catch{return null}finally{this._importControllers.delete(e),this._updatingChanged()}}_abortImport(e){this._importControllers.get(e)?.abort(),this._importControllers.delete(e),this._updatingChanged()}_initBasemapTerrain(){this._set("basemapTerrain",new et({view:this})),this.elevationProvider.register(0,this.basemapTerrain)}_exitBasemapTerrain(){const{basemapTerrain:e,elevationProvider:t}=this;e&&(this._set("basemapTerrain",null),t.unregister(e),e.destroy())}_initGlobe(){this._initCoordinateSystem(),this.state.createInitialCamera(),this._initBasemapTerrain(),this._set("pointsOfInterest",new Xe({view:this})),this.addHandles([this.updatingHandles.add(()=>Ue.FEATURE_TILE_TREE_SHOW_TILES,e=>{e&&!this._featureTreeDebugger?this.updatingHandles.addPromise(import("./3d/layers/support/FeatureTileTree3DDebugger.js")).then(({FeatureTileTree3DDebugger:e})=>{!this._featureTreeDebugger&&Ue.FEATURE_TILE_TREE_SHOW_TILES&&(this._featureTreeDebugger=new e({view:this}))}):e||(this._featureTreeDebugger=d(this._featureTreeDebugger))},M),this.updatingHandles.add(()=>({basemapExtent:this.groundView?.groundExtent,basemapSpatialReference:this.groundView?.spatialReference,clippingArea:this.clippingArea,featureTiles:this._featureTiles}),({basemapExtent:e,basemapSpatialReference:t,clippingArea:i,featureTiles:r})=>{if(!r)return;const s=!!e;if(i||s)if(s&&t){const s=e&&t?k($(e,t),this.spatialReference):null;r.filterExtent=i?i.intersection(s):s}else r.filterExtent=i;else r.filterExtent=null},M),this.updatingHandles.add(()=>this._featureTileTreeClients.size>0,e=>{e?this.updatingHandles.consumePromise(this._ensureFeatureTileTree()):this._featureTiles=d(this._featureTiles)},_)],Tt),this.stateManager.init()}async _ensureFeatureTileTree(){if(this._featureTiles||this._importControllers.has("FeatureTileTree3D"))return;const e=(await this.updatingHandles.addPromise(this._importModule("FeatureTileTree3D")))?.FeatureTileTree3D;e&&(this._featureTiles=new e({renderCoordsHelper:this.renderCoordsHelper,pointsOfInterest:this.pointsOfInterest,viewState:this.state,scheduler:this._resourceController.scheduler,terrain:this.basemapTerrain}),this._updatingChanged())}_exitTerrain(){this.stateManager.exit(),this.removeHandles(Rt),this.removeHandles(Tt),this._featureTiles=d(this.featureTiles),this._set("pointsOfInterest",d(this.pointsOfInterest)),this._exitBasemapTerrain(),this.state.reset(),this._exitCoordinateSystem()}_initCoordinateSystem(){if(this.spatialReference){const e=this.spatialReference,t=this.state.isGlobal,i=K(t,e);i!==this.renderSpatialReference&&(this._set("renderCoordsHelper",Qe.create(this.state.viewingMode,i)),t||this.addHandles(w(()=>this.groundView?.groundExtent,e=>{const t=this.renderCoordsHelper.spatialReference;null==e||0===e[0]&&0===e[1]&&0===e[2]&&0===e[3]||!Q(e,this.groundView.spatialReference,It,t)||(this.renderCoordsHelper.extent=It)},_),Rt),this.sceneIntersectionHelper&&this.sceneIntersectionHelper.setTolerance(pt/this.renderCoordsHelper.unitInMeters))}else this._set("renderCoordsHelper",null)}_exitCoordinateSystem(){this.removeHandles(Rt),this._set("renderCoordsHelper",null)}_updatingChanged(){this.notifyChange("updating")}_updateUpdatingMonitors(e=null){null!=e&&4===e.type||(this.removeHandles("updatingMonitors"),this.allLayerViews.forEach(e=>{e.destroyed||(this.addHandles(w(()=>[e.updating,e.updatingProgress],()=>this._updatingChanged(),_),"updatingMonitors"),e.when(()=>this._updatingChanged(),()=>this._updatingChanged()))}),this._updatingChanged())}async _prepareScreenshotOverlay(){this.overlay&&await this.overlay.prepare()}_renderScreenshotOverlay(e,t,i){if(!this.overlay||!this.overlay.hasVisibleItems)return i;const r=e.getContext("2d",{willReadFrequently:!0});return r.putImageData(i,0,0),this.overlay.renderCanvas(e,{disableDecorations:t}),r.getImageData(0,0,i.width,i.height)}_initStage(){const e={deactivatedWebGLExtensions:this.deactivatedWebGLExtensions,debugWebGLExtensions:this.debugWebGLExtensions,alpha:this.alphaCompositingEnabled,preserveDrawingBuffer:this.preserveDrawingBufferEnabled,canvas:this.renderCanvas,screenshot:{prepareOverlay:()=>this._prepareScreenshotOverlay(),renderOverlay:(e,t,i)=>this._renderScreenshotOverlay(e,t,i)}},t=new He(this.state.viewingMode,e=>this.stage.layers.forEach(e),this);this._set("sceneIntersectionHelper",t);const i=s(this.surface);this._stage=new at({view:this,options:e,container:i}),this.notifyChange("stage"),this._updateSlice(),this.addHandles([this.on("pointer-move",()=>this.stage?.renderer.resetAnimation()),a(this.stage.renderView.canvas,"webglcontextlost",e=>{this.fatalError=new n("webgl-context-lost",e.statusMessage||"WebGL context lost")})],"stage"),this.renderCoordsHelper&&this.sceneIntersectionHelper.setTolerance(pt/this.renderCoordsHelper.unitInMeters),this._set("canvas",this.stage.renderView.canvas)}_exitStage(){this.sceneIntersectionHelper?.destroy(),this._set("sceneIntersectionHelper",null),this._stage=d(this.stage),this._set("stage",null),this.removeHandles("stage"),this._set("canvas",null)}_initSurface(){this._exitSurface(),this._initStage(),this._initGlobe(),this.sharedSymbolResources=new Je({view:this,resourceController:this._resourceController})}_exitSurface(){this.sharedSymbolResources&&(this.sharedSymbolResources.objectResourceCache.destroy(),this.sharedSymbolResources.destroy(),this.sharedSymbolResources=null,this._exitTerrain(),this._exitStage())}async _ensureGraphicsView(){if(this.graphicsView||this._importControllers.has("GraphicsView3D")||0===this.graphics.length)return;this.removeHandles("GraphicsView3D");const e=(await this.updatingHandles.addPromise(this._importModule("GraphicsView3D",e=>b(()=>this.groundView?.ready,e))))?.default;e&&this._set("graphicsView",new e({view:this,getGraphics:()=>this.graphics})),this._updatingChanged()}_disposeGraphicsView(){this._abortImport("GraphicsView3D"),this.removeHandles("GraphicsView3D"),this.graphicsView&&(this.removeHandles(this.graphicsView.processor.layer.id),this.graphicsView.destroy(),this._set("graphicsView",null))}_disposeFocusAreasView(){this._abortImport("FocusAreasView"),this.removeHandles("FocusAreasView"),this.focusAreasView=d(this.focusAreasView)}async _ensureFocusAreasView(e){if(this.focusAreasView||this._importControllers.has("FocusAreasView")||0===e)return;this.removeHandles("FocusAreasView");const t=(await this.updatingHandles.addPromise(this._importModule("FocusAreasView")))?.FocusAreasView;t&&(this.focusAreasView=new t({view:this})),this._updatingChanged()}_startup(){1===fe(this.viewingMode)&&(this._clippingArea=null),this._initSurface(),this._set("ready",!0),this.addHandles(f(()=>this.graphics,"after-changes",()=>this._ensureGraphicsView()),"GraphicsView3D"),this._ensureGraphicsView(),this.addHandles(this.updatingHandles.add(()=>this.map?.focusAreas?.areas.length??0,e=>this._ensureFocusAreasView(e),{initial:!0}),"FocusAreasView");const e=this.scene?.initialViewProperties??null,t=e?.environment;t&&(this._overrideDefaultEnvironmentOnly?H(this.environment,t):this.environment=this.environment.cloneWithWebsceneEnvironment(t)),this.timeExtent=e?.timeExtent,e?.analyses.applyTo(this),this.labeler.setup(),this.environmentManager.connectView(this),this.inputManager.connect();const i=this._resolveWhenReady;this._resolveWhenReady=[],i.forEach(e=>e(this))}_teardown(){this.inputManager.disconnect(),this.environmentManager.disconnectView(),this._overrideDefaultEnvironmentOnly=!1,this.labeler.dispose(),this._disposeGraphicsView(),this._disposeFocusAreasView(),this._exitSurface(),this._set("ready",!1)}get _defaultToMapOptions(){const e={include:new Set};if(!this.map)return e;this.map.ground&&e.include.add(dt);for(const t of this.allLayerViews)(ae(t.layer)&&(!has("enable-feature:im-as-ground")||t.layer.isUsedAsGroundLayer)||oe(t.layer))&&e.include.add(t.uid);return e}get _defaultHitTestOptions(){const e={exclude:new Set};if(!this.map)return e;this.map.ground&&this.map.ground.opacity<1&&e.exclude.add(dt);for(const t of this.allLayerViews)(has("enable-feature:im-as-ground")?ae(t.layer)&&t.layer.isUsedAsGroundLayer:ae(t.layer))&&t.fullOpacity<1&&e.exclude.add(t.uid);return e}static{this.type="3d"}static clearStatics(){jt(),D(),T(),ut(),Le(),be(),Z(),mt(),pe(),nt(),ht(),Ie(),Pe(),U(),V(),lt(),st(),Re.cleanupI3SLodHandling(),le.cleanupTilemapCache(),Oe.cleanupViewstate(),et.cleanupTerrainSurface()}};function Ot(e,t){return null!=e&&B(e.spatialReference,t)?k(e,t):null}e([A({nonNullable:!0}),O(xt)],At.prototype,"options",void 0),e([A()],At.prototype,"_userClippingArea",void 0),e([A()],At.prototype,"_resourceController",void 0),e([A()],At.prototype,"stage",null),e([A({readOnly:!0})],At.prototype,"deconflictor",void 0),e([A({readOnly:!0})],At.prototype,"labeler",void 0),e([A()],At.prototype,"navigation",void 0),e([A({type:me,readOnly:!0})],At.prototype,"animation",null),e([A({readOnly:!0})],At.prototype,"basemapTerrain",void 0),e([A({readOnly:!0})],At.prototype,"overlayManager",null),e([A({readOnly:!0})],At.prototype,"elevationProvider",void 0),e([A()],At.prototype,"camera",null),e([A({type:t})],At.prototype,"contentCamera",null),e([A({readOnly:!0})],At.prototype,"canvas",null),e([A({type:q,useTypeForAutocast:!1})],At.prototype,"center",null),e([A({type:W})],At.prototype,"clippingArea",null),e([A({type:Me,nonNullable:!0})],At.prototype,"constraints",void 0),e([A({type:W,readOnly:!0})],At.prototype,"renderDataExtent",null),e([A({readOnly:!0})],At.prototype,"tileInfo",null),e([A({type:W,readOnly:!0})],At.prototype,"dataExtent",null),e([A({type:W,readOnly:!0})],At.prototype,"_groundAndLayersExtent",null),e([A({type:Se})],At.prototype,"environment",null),e([O("environment")],At.prototype,"castEnvironment",null),e([A({readOnly:!0})],At.prototype,"environmentManager",void 0),e([A({type:W})],At.prototype,"extent",null),e([A({type:r})],At.prototype,"floors",void 0),e([A()],At.prototype,"screenCenter",null),e([A()],At.prototype,"frustum",null),e([A({type:Number,readOnly:!0})],At.prototype,"fullOpacity",void 0),e([A({readOnly:!0})],At.prototype,"graphicsView",void 0),e([A()],At.prototype,"analysisViewManager",void 0),e([A()],At.prototype,"groundView",void 0),e([A({readOnly:!0})],At.prototype,"layerviewCollections",null),e([A({type:Boolean})],At.prototype,"initialExtentRequired",null),e([A()],At.prototype,"defaultsFromMapSettings",null),e([A()],At.prototype,"interacting",null),e([A()],At.prototype,"stationary",null),e([A()],At.prototype,"navigating",null),e([A()],At.prototype,"map",void 0),e([A()],At.prototype,"padding",null),e([A({type:Xe,readOnly:!0})],At.prototype,"pointsOfInterest",void 0),e([A()],At.prototype,"_featureTiles",void 0),e([A()],At.prototype,"featureTiles",null),e([A()],At.prototype,"_featureTreeDebugger",void 0),e([A({constructOnly:!0})],At.prototype,"deactivatedWebGLExtensions",void 0),e([A({constructOnly:!0})],At.prototype,"debugWebGLExtensions",void 0),e([A({constructOnly:!0})],At.prototype,"renderCanvas",void 0),e([A({constructOnly:!0})],At.prototype,"state",void 0),e([A()],At.prototype,"screenSizePerspective",void 0),e([A({readOnly:!0})],At.prototype,"inputManager",void 0),e([A({readOnly:!0})],At.prototype,"stateManager",void 0),e([A({type:["low","medium","high"]})],At.prototype,"qualityProfile",null),e([A({type:Ze,get(){let e=this._get("qualitySettings");if(!e){const t=Ne(this.qualityProfile);e=new Ze(t)}return e}})],At.prototype,"qualitySettings",void 0),e([A()],At.prototype,"slice",void 0),e([A({readOnly:!0})],At.prototype,"typeSpecificPreconditionsReady",null),e([A({readOnly:!0})],At.prototype,"renderCoordsHelper",void 0),e([A({readOnly:!0})],At.prototype,"sceneIntersectionHelper",void 0),e([A({type:Number,readOnly:!0})],At.prototype,"resolution",null),e([A({type:Number})],At.prototype,"scale",null),e([A({readOnly:!0,type:Number})],At.prototype,"terrainLevel",null),e([A()],At.prototype,"heightModelInfo",null),e([A({type:N})],At.prototype,"spatialReference",void 0),e([A({type:Boolean,value:!1})],At.prototype,"alphaCompositingEnabled",null),e([A({constructOnly:!0})],At.prototype,"preserveDrawingBufferEnabled",void 0),e([A({type:Boolean})],At.prototype,"supersampleScreenshotsEnabled",void 0),e([A({readOnly:!0})],At.prototype,"type",void 0),e([A(),O(e=>e instanceof Mt?e:I(St,e))],At.prototype,"ui",void 0),e([A({type:Boolean,readOnly:!0})],At.prototype,"updating",null),e([A()],At.prototype,"_updatingObjects",null),e([A()],At.prototype,"_updatingObjectsWithProgress",null),e([A()],At.prototype,"_updatingObjectsToDebug",null),e([A({type:Number,readOnly:!0})],At.prototype,"updatingProgress",void 0),e([A({type:["global","local"]})],At.prototype,"viewingMode",null),e([A({type:i})],At.prototype,"viewpoint",null),e([A({readOnly:!0})],At.prototype,"visibleArea",null),e([A({type:Number})],At.prototype,"zoom",null),e([A({readOnly:!0})],At.prototype,"quality",null),e([A({readOnly:!0})],At.prototype,"resolutionScale",null),e([A()],At.prototype,"focusAreasView",void 0),e([A()],At.prototype,"_defaultToMapOptions",null),e([A()],At.prototype,"_defaultHitTestOptions",null),At=Ct=e([E("esri.views.SceneView")],At);const Et=F(),Lt=C(),It=J(),Ht=ie(0,0,0,N.WebMercator),Pt={GraphicsView3D:()=>import("./3d/layers/GraphicsView3D.js"),FocusAreasView:()=>import("./3d/FocusAreasView.js"),FeatureTileTree3D:()=>import("./3d/layers/support/FeatureTileTree3D.js")},Dt=At;export{Dt as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../core/Accessor.js";import{clock as o}from"../core/clock.js";import i from"../core/Collection.js";import"../core/has.js";import a from"../core/Logger.js";import{removeMaybe as n}from"../core/maybe.js";import{watch as s}from"../core/reactiveUtils.js";import{property as r,subclass as l}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../core/support/UpdatingHandles.js";import{ViewEventPriorities as h}from"./input/InputManager.js";import{eventTypes as u}from"./input/ViewEvents.js";import{getToolCollectionHandles as p,areToolManipulatorsEditable as m,isCancelEvent as v}from"./interactive/interactiveToolUtils.js";import{ToolViewManagerManipulatorState as d}from"./interactive/ToolViewManagerManipulatorState.js";const g="attached",_="tools",T=1e3;let f=class extends e{constructor(t){super(t),this._updatingHandles=new c,this._clock=o,this._manipulatorState=new d,this.tools=new i,this._interacting=!1,this._interactingTimeout=T,this._interactingTimeoutHandle=null}initialize(){this.addHandles([this.view.on(u,t=>{this._handleInputEvent(t)},h.TOOL),...p(this.tools),this.tools.on("before-add",({item:t})=>{this._updateToolEditableFlag(t)}),this.tools.on("before-remove",({item:t})=>{this._manipulatorState.clearPointers(t,this._manipulatorStateEventArgs)}),this.tools.on("change",()=>{this._refreshToolWatchers()})])}destroy(){this.activeTool=null,this.tools.drain(t=>t.destroy()),this._clearInteractingTimeout(),this._interacting=!1,this._updatingHandles.destroy(),this._manipulatorState.destroy()}get _manipulatorStateEventArgs(){return{tools:this.tools,activeTool:this.activeTool,setActiveTool:t=>{this.activeTool=t},view:this.view,multiTouchActive:this.view.inputManager?.multiTouchActive}}set activeTool(t){if(null!=t&&!this.view.ready)return void a.getLogger(this).error("Cannot set active tool while view is not ready.");if(t===this.activeTool)return;const e=this.activeTool;this._set("activeTool",t),null!=e&&e.deactivate(),null!=t&&t.activate(),this._removeIncompleteTools(t);for(const o of this.tools){this._updateToolEditableFlag(o);const t=m(o);null!=this.activeTool&&t||this._manipulatorState.clearPointers(o,this._manipulatorStateEventArgs,!t)}}get cursor(){const t=this._manipulatorState.cursor;if(null!=t)return t;for(const e of this.tools)if(e.visible&&null!=e.cursor)return e.cursor;return null}get updating(){return this._updatingHandles.updating||this.tools.some(t=>t.updating)}get interacting(){return this._interacting}_clearInteractingTimeout(){this._interactingTimeoutHandle=n(this._interactingTimeoutHandle)}_startInteractingTimeout(){this._clearInteractingTimeout(),this._interactingTimeoutHandle=this._clock.setTimeout(()=>this._interacting=!1,this._interactingTimeout)}attach(){"3d"===this.view.type?this.addHandles([s(()=>{const{state:t}=this.view;return"camera"in t&&t.camera},()=>this._forEachManipulator(t=>t.onViewChange())),this.view.elevationProvider.on("elevation-change",t=>this._forEachManipulator(e=>e.onElevationChange(t)))],g):this.addHandles(s(()=>this.view.extent,()=>this._forEachManipulator(t=>t.onViewChange())))}detach(){this.activeTool=null,this.tools.removeAll(),this.removeHandles(g),this._clearInteractingTimeout(),this._interacting=!1}_forEachManipulator(t){for(const e of this.tools)e.manipulators&&e.manipulators.forEach(({manipulator:o})=>t(o,e))}_handleInputEvent(t){let e=!1;const o={...t,stopPropagation:()=>{e=!0,t.stopPropagation()}};if(null!=this.activeTool)this.activeTool.handleInputEvent&&this.activeTool.handleInputEvent(o);else for(const i of this.tools)!e&&i.visible&&i.handleInputEvent(o);!e&&v(t)&&this.activeTool&&(t.stopPropagation(),t.preventDefault(),this.activeTool.cancel(),this.activeTool=null),this._manipulatorState.handleInputEvent(o,this._manipulatorStateEventArgs),e||null==this.activeTool||this.activeTool.handleInputEventAfter(o),this._manipulatorState.handleHoverEvent(o,this.tools),"pointer-move"===t.type&&(this._manipulatorState.hasFocusedManipulators||this.activeTool)&&(this._interacting=!0,this._startInteractingTimeout())}_refreshToolWatchers(){this.removeHandles(_);for(const t of this.tools){if(t instanceof e){const e=s(()=>[t.cursor,t.visible,t.editable],()=>{m(t)||this._manipulatorState.clearPointers(t,this._manipulatorStateEventArgs)});this.addHandles(e,_)}t.manipulators&&this.addHandles([t.manipulators.on("after-remove",e=>{this._manipulatorState.clearPointers(t,this._manipulatorStateEventArgs,!0,e.item.manipulator)}),t.manipulators.on("change",()=>{this._manipulatorState.updateHoveredStateFromKnownPointers(this.tools)})],_)}this._manipulatorState.updateHoveredStateFromKnownPointers(this.tools)}_updateToolEditableFlag(t){t.setEditableFlag?.(1,null==this.activeTool||t===this.activeTool)}_removeIncompleteTools(t){this.tools.filter(e=>(null==t||e!==t)&&!e.created&&e.removeIncompleteOnCancel).forEach(t=>{this.tools.remove(t)})}get test(){if("test"!==process.env.NODE_ENV)return;const t=this;return{setClock:t=>this._clock=t,set interactingTimeoutEnabled(e){t._interactingTimeout=e?T:0},get interactingTimeoutEnabled(){return 0!==t._interactingTimeout}}}};t([r({constructOnly:!0,nonNullable:!0})],f.prototype,"view",void 0),t([r({value:null})],f.prototype,"activeTool",null),t([r({readOnly:!0,type:i})],f.prototype,"tools",void 0),t([r()],f.prototype,"cursor",null),t([r({readOnly:!0})],f.prototype,"updating",null),t([r()],f.prototype,"_interacting",void 0),t([r({readOnly:!0})],f.prototype,"interacting",null),f=t([l("esri.views.ToolViewManager")],f);export{f as ToolViewManager,T as interactingTimeout};
2
+ import{__decorate as t}from"tslib";import e from"../core/Accessor.js";import{clock as o}from"../core/clock.js";import i from"../core/Collection.js";import"../core/has.js";import a from"../core/Logger.js";import{removeMaybe as n}from"../core/maybe.js";import{watch as s}from"../core/reactiveUtils.js";import{property as r,subclass as l}from"../core/accessorSupport/decorators.js";import{UpdatingHandles as c}from"../core/support/UpdatingHandles.js";import{ViewEventPriorities as h}from"./input/InputManager.js";import{eventTypes as u}from"./input/ViewEvents.js";import{getToolCollectionHandles as p,areToolManipulatorsEditable as m,isCancelEvent as v}from"./interactive/interactiveToolUtils.js";import{ToolViewManagerManipulatorState as d}from"./interactive/ToolViewManagerManipulatorState.js";const g="attached",_="tools",T=1e3;let f=class extends e{constructor(t){super(t),this._updatingHandles=new c,this._clock=o,this._manipulatorState=new d,this.tools=new i,this._interacting=!1,this._interactingTimeout=T,this._interactingTimeoutHandle=null}initialize(){this.addHandles([this.view.on(u,t=>{this._handleInputEvent(t)},h.TOOL),...p(this.tools),this.tools.on("before-add",({item:t})=>{this._updateToolEditableFlag(t)}),this.tools.on("before-remove",({item:t})=>{this._manipulatorState.clearPointers(t,this._manipulatorStateEventArgs)}),this.tools.on("change",()=>{this._refreshToolWatchers()})])}destroy(){this.activeTool=null,this.tools.drain(t=>t.destroy()),this._clearInteractingTimeout(),this._interacting=!1,this._updatingHandles.destroy(),this._manipulatorState.destroy()}get _manipulatorStateEventArgs(){return{tools:this.tools,activeTool:this.activeTool,setActiveTool:t=>{this.activeTool=t},view:this.view,multiTouchActive:this.view.inputManager?.multiTouchActive}}set activeTool(t){if(null!=t&&!this.view.ready)return void a.getLogger(this).error("Cannot set active tool while view is not ready.");if(t===this.activeTool)return;const e=this.activeTool;this._set("activeTool",t),null!=e&&e.deactivate(),null!=t&&t.activate(),this._removeIncompleteTools(t);for(const o of this.tools){this._updateToolEditableFlag(o);const t=m(o);null!=this.activeTool&&t||this._manipulatorState.clearPointers(o,this._manipulatorStateEventArgs,!t)}}get cursor(){const t=this._manipulatorState.cursor;if(null!=t)return t;for(const e of this.tools)if(e.visible&&null!=e.cursor)return e.cursor;return null}get updating(){return this._updatingHandles.updating||this.tools.some(t=>t.updating)}get interacting(){return this._interacting}_clearInteractingTimeout(){this._interactingTimeoutHandle=n(this._interactingTimeoutHandle)}_startInteractingTimeout(){this._clearInteractingTimeout(),this._interactingTimeoutHandle=this._clock.setTimeout(()=>this._interacting=!1,this._interactingTimeout)}attach(){"3d"===this.view.type?this.addHandles([s(()=>{const{state:t}=this.view;return"camera"in t&&t.camera},()=>this._forEachManipulator(t=>t.onViewChange())),this.view.elevationProvider.on("elevation-change",t=>this._forEachManipulator(e=>e.onElevationChange(t)))],g):this.addHandles(s(()=>this.view.extent,()=>this._forEachManipulator(t=>t.onViewChange())))}detach(){this.activeTool=null,this.tools.removeAll(),this.removeHandles(g),this._clearInteractingTimeout(),this._interacting=!1}_forEachManipulator(t){for(const e of this.tools)e.manipulators&&e.manipulators.forEach(({manipulator:o})=>t(o,e))}_handleInputEvent(t){let e=!1;v(t)&&this.activeTool&&t.preventDefault();const o={...t,stopPropagation:()=>{e=!0,t.stopPropagation()}};if(null!=this.activeTool)this.activeTool.handleInputEvent&&this.activeTool.handleInputEvent(o);else for(const i of this.tools)!e&&i.visible&&i.handleInputEvent(o);!e&&v(t)&&this.activeTool&&(t.stopPropagation(),this.activeTool.cancel(),this.activeTool=null),this._manipulatorState.handleInputEvent(o,this._manipulatorStateEventArgs),e||null==this.activeTool||this.activeTool.handleInputEventAfter(o),this._manipulatorState.handleHoverEvent(o,this.tools),"pointer-move"===t.type&&(this._manipulatorState.hasFocusedManipulators||this.activeTool)&&(this._interacting=!0,this._startInteractingTimeout())}_refreshToolWatchers(){this.removeHandles(_);for(const t of this.tools){if(t instanceof e){const e=s(()=>[t.cursor,t.visible,t.editable],()=>{m(t)||this._manipulatorState.clearPointers(t,this._manipulatorStateEventArgs)});this.addHandles(e,_)}t.manipulators&&this.addHandles([t.manipulators.on("after-remove",e=>{this._manipulatorState.clearPointers(t,this._manipulatorStateEventArgs,!0,e.item.manipulator)}),t.manipulators.on("change",()=>{this._manipulatorState.updateHoveredStateFromKnownPointers(this.tools)})],_)}this._manipulatorState.updateHoveredStateFromKnownPointers(this.tools)}_updateToolEditableFlag(t){t.setEditableFlag?.(1,null==this.activeTool||t===this.activeTool)}_removeIncompleteTools(t){this.tools.filter(e=>(null==t||e!==t)&&!e.created&&e.removeIncompleteOnCancel).forEach(t=>{this.tools.remove(t)})}get test(){if("test"!==process.env.NODE_ENV)return;const t=this;return{setClock:t=>this._clock=t,set interactingTimeoutEnabled(e){t._interactingTimeout=e?T:0},get interactingTimeoutEnabled(){return 0!==t._interactingTimeout}}}};t([r({constructOnly:!0,nonNullable:!0})],f.prototype,"view",void 0),t([r({value:null})],f.prototype,"activeTool",null),t([r({readOnly:!0,type:i})],f.prototype,"tools",void 0),t([r()],f.prototype,"cursor",null),t([r({readOnly:!0})],f.prototype,"updating",null),t([r()],f.prototype,"_interacting",void 0),t([r({readOnly:!0})],f.prototype,"interacting",null),f=t([l("esri.views.ToolViewManager")],f);export{f as ToolViewManager,T as interactingTimeout};
@@ -1,7 +1,7 @@
1
1
  import type Accessor from "../../../core/Accessor.js";
2
2
 
3
3
  /** @since 5.2 */
4
- export interface TooltipVisibleElementsProperties extends Partial<Pick<TooltipVisibleElements, "area" | "coordinates" | "direction" | "distance" | "elevation" | "header" | "helpMessage" | "orientation" | "radius" | "rotation" | "scale" | "size" | "totalLength">> {}
4
+ export interface TooltipVisibleElementsProperties extends Partial<Pick<TooltipVisibleElements, "area" | "coordinates" | "direction" | "distance" | "elevation" | "elevationMode" | "header" | "helpMessage" | "orientation" | "radius" | "rotation" | "scale" | "size" | "totalLength">> {}
5
5
 
6
6
  /**
7
7
  * The elements that are displayed within the tooltip while sketching, editing or placing analyses.
@@ -46,6 +46,16 @@ export default class TooltipVisibleElements extends Accessor {
46
46
  * @since 5.2
47
47
  */
48
48
  accessor elevation: boolean;
49
+ /**
50
+ * When set to `false`, the elevation mode icon and input control are not shown in the tooltip.
51
+ *
52
+ * > [!WARNING]
53
+ * > Setting `elevationMode` to `true` on the Editor and Sketch components has no effect.
54
+ *
55
+ * @default true
56
+ * @since 5.2
57
+ */
58
+ accessor elevationMode: boolean;
49
59
  /**
50
60
  * When set to `false`, the header at the top of the tooltip is not shown, when in input mode.
51
61
  *
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as o}from"tslib";import e from"../../../core/Accessor.js";import{property as t,subclass as l}from"../../../core/accessorSupport/decorators.js";let n=class extends e{constructor(o){super(o),this.area=!0,this.coordinates=!0,this.direction=!0,this.distance=!0,this.elevation=!0,this.header=!0,this.helpMessage=!1,this.orientation=!0,this.radius=!0,this.rotation=!0,this.scale=!0,this.size=!0,this.totalLength=!0}};o([t({type:Boolean,nonNullable:!0})],n.prototype,"area",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"coordinates",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"direction",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"distance",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"elevation",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"header",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"helpMessage",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"orientation",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"radius",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"rotation",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"scale",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"size",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"totalLength",void 0),n=o([l("esri.views.interactive.options.TooltipVisibleElements")],n);const i=n;export{i as default};
2
+ import{__decorate as o}from"tslib";import e from"../../../core/Accessor.js";import{property as t,subclass as l}from"../../../core/accessorSupport/decorators.js";let n=class extends e{constructor(o){super(o),this.area=!0,this.coordinates=!0,this.direction=!0,this.distance=!0,this.elevation=!0,this.elevationMode=!0,this.header=!0,this.helpMessage=!1,this.orientation=!0,this.radius=!0,this.rotation=!0,this.scale=!0,this.size=!0,this.totalLength=!0}};o([t({type:Boolean,nonNullable:!0})],n.prototype,"area",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"coordinates",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"direction",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"distance",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"elevation",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"elevationMode",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"header",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"helpMessage",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"orientation",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"radius",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"rotation",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"scale",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"size",void 0),o([t({type:Boolean,nonNullable:!0})],n.prototype,"totalLength",void 0),n=o([l("esri.views.interactive.options.TooltipVisibleElements")],n);const i=n;export{i as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{watch as e}from"../../../../core/reactiveUtils.js";import{waitAnimationFrame as i}from"../../../../core/scheduling.js";import{property as n,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{tooltipKeys as s}from"../../keybindings.js";import{notAvailableString as l}from"../constants.js";import{base as a}from"../css.js";import{ElevationModeSelect as r}from"./ElevationModeSelect.js";import c from"../../../../widgets/Widget.js";import{loadCalciteComponents as u}from"../../../../widgets/support/componentsUtils.js";import{tsx as d,tsxFragment as p}from"../../../../widgets/support/widget.js";const h=`${a}-editable-field`,_={base:h,inputMode:`${h}--input`,feedbackMode:`${h}--feedback`,readOnly:`${h}--read-only`,locked:`${h}--locked`,title:`${h}__title`,value:`${h}__value`,valueContent:`${h}__value__content`,valueContentReadOnly:`${h}__value__content--read-only`,lockIcon:`${h}__lock-icon`,input:`${h}__input`,inputWrapper:`${h}__input-wrapper`,inputAction:`${h}__input-action`,inputMessage:`${h}__input-message`,inputSuffix:`${h}__input-suffix`,button:`${h}__button`},m={lock:"lock",unlock:"unlock"};let f=class extends c{constructor(){super(...arguments),this._input=null,this._lock=null,this._onLockClick=()=>{this.field.toggleLock(this.context)},this._onLockAfterCreate=t=>{this._lock=t},this._onLockAfterRemoved=()=>{this._lock=null},this._onKeyDown=t=>{t.key===s.discard&&"input"===this.mode&&this._input&&this.context.onDiscard(this._input)},this._onInputKeyDown=t=>{const e=this._input;if(e&&t.target===e)switch(t.key){case s.commit:return this.field.onCommit("commit-and-exit",e,this.context);case s.next:{t.preventDefault(),t.stopPropagation();const i=t.shiftKey?"commit-and-previous":"commit-and-next";return this.field.onCommit(i,e,this.context)}}},this._onInput=t=>{this.field.onInput(t.currentTarget.value)},this._onInputBlur=t=>{const e=this._input;e&&t.relatedTarget!==this._lock&&this.field.onCommit("commit-on-blur",e,this.context)},this._selectText=()=>{const t=()=>{this._input!==document.activeElement&&this._input!==document.activeElement?.shadowRoot?.activeElement||this._input?.selectText()};t(),i().then(t)},this._onAfterCreate=t=>{this._input=t,t.addEventListener("paste",this._onPaste),t.addEventListener("beforeinput",this._onBeforeInput)},this._onAfterRemoved=t=>{t.removeEventListener("paste",this._onPaste),t.removeEventListener("beforeinput",this._onBeforeInput),this._input===t&&(this._input=null)},this._onPaste=t=>{const e=t.clipboardData?.getData("text");if(!e)return;null!=this.field.parse(e,this.context)&&(t.stopPropagation(),this.field.onInput(e))},this._onBeforeInput=t=>{("historyUndo"===t.inputType||"historyRedo"===t.inputType)&&!this.field.dirty&&t.preventDefault()}}initialize(){this.addHandles(e(()=>this._rawDisplayValue,()=>{const{committed:t,inputValue:e}=this.field;t||e||this._input!==document.activeElement||this._selectText()}))}loadDependencies(){return u({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message")})}render(){const{field:t,mode:e}=this,i="input"===e;return d("div",{class:this.classes({[_.base]:!0,[_.feedbackMode]:"feedback"===e,[_.inputMode]:"input"===e,[_.locked]:t.locked,[_.readOnly]:t.readOnly})},d("div",{class:_.title,key:"title"},this._title),d("div",{class:_.value,key:"value",onkeydown:this._onKeyDown},i?this._renderValueInputMode():this._renderValueFeedbackMode()))}get _formattedValue(){return this.field.getFormattedValue(this.context)||l}get _rawDisplayValue(){return this.field.getRawDisplayValue(this.context)}get _suffix(){return this.field.getSuffix(this.context)}get _title(){const{title:t}=this.field;return"string"==typeof t?t:t(this.context)}get _messages(){return this.context?.messages.sketch??{}}get _elevationModeSelect(){return"elevation"===this.field.name&&this.context.elevationModeContext?d(r,{context:this.context,key:"elevation-mode",mode:this.mode}):null}_renderValueFeedbackMode(){return d(p,null,d("div",{class:_.valueContent,key:"value-feedback"},this._formattedValue,this._elevationModeSelect),this.field.locked&&"input"!==this.mode?d("calcite-icon",{class:_.lockIcon,icon:m.lock,key:"icon",scale:"s"}):null)}_renderValueInputMode(){return this.field.readOnly?this._renderValueReadOnly():this._renderValueWritable()}_renderValueReadOnly(){return d("div",{class:this.classes(_.valueContent,_.valueContentReadOnly),key:"value-read-only"},this._formattedValue,this._elevationModeSelect)}_renderValueWritable(){const{field:t}=this,e=this._messages,{name:i}=t,n=t.invalid;return d(p,null,d("div",{class:_.inputWrapper,key:"value-input"},d("calcite-input",{afterCreate:this._onAfterCreate,afterRemoved:this._onAfterRemoved,class:_.input,"data-field-id":t.id,"data-field-name":i,"data-testid":`tooltip-field-${i}`,key:"input",scale:"s",status:n?"invalid":"idle",type:"text",value:this._rawDisplayValue??l,onblur:this._onInputBlur,onCalciteInputInput:this._onInput,onfocus:this._selectText,onkeydown:this._onInputKeyDown},this._elevationModeSelect?d("div",{class:_.inputAction,slot:"action"},this._elevationModeSelect):null),n?d("calcite-input-message",{class:_.inputMessage,scale:"s",status:"invalid"},e.invalidValue):null),d("div",{class:_.inputSuffix,key:"suffix"},this._suffix),this._renderedLockButton)}get _renderedLockButton(){const{lockDisabled:t,locked:e,lockable:i,name:n}=this.field;if(!i)return d("div",{key:"no-lock-button"});const o=this._messages,s=e?o.unlockConstraint:o.lockConstraint;return d("calcite-button",{afterCreate:this._onLockAfterCreate,afterRemoved:this._onLockAfterRemoved,alignment:"center",appearance:"transparent",class:_.button,"data-testid":`tooltip-field-${n}-lock`,disabled:t,iconStart:e?m.lock:m.unlock,key:"lock-button",kind:"neutral",label:s,scale:"s",tabIndex:-1,title:s,onclick:this._onLockClick})}};t([n()],f.prototype,"field",void 0),t([n()],f.prototype,"context",void 0),t([n()],f.prototype,"mode",void 0),t([n()],f.prototype,"_input",void 0),t([n()],f.prototype,"_lock",void 0),t([n()],f.prototype,"_formattedValue",null),t([n()],f.prototype,"_rawDisplayValue",null),t([n()],f.prototype,"_suffix",null),t([n()],f.prototype,"_title",null),t([n()],f.prototype,"_messages",null),t([n()],f.prototype,"_elevationModeSelect",null),t([n()],f.prototype,"_renderedLockButton",null),f=t([o("esri.views.interactive.tooltip.components.TooltipEditableField")],f);export{f as TooltipEditableField};
2
+ import{__decorate as t}from"tslib";import{watch as e}from"../../../../core/reactiveUtils.js";import{waitAnimationFrame as i}from"../../../../core/scheduling.js";import{property as o,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{tooltipKeys as s}from"../../keybindings.js";import{notAvailableString as l}from"../constants.js";import{base as a}from"../css.js";import{ElevationModeSelect as r}from"./ElevationModeSelect.js";import c from"../../../../widgets/Widget.js";import{loadCalciteComponents as u}from"../../../../widgets/support/componentsUtils.js";import{tsx as d,tsxFragment as p}from"../../../../widgets/support/widget.js";const h=`${a}-editable-field`,_={base:h,inputMode:`${h}--input`,feedbackMode:`${h}--feedback`,readOnly:`${h}--read-only`,locked:`${h}--locked`,title:`${h}__title`,value:`${h}__value`,valueContent:`${h}__value__content`,valueContentReadOnly:`${h}__value__content--read-only`,lockIcon:`${h}__lock-icon`,input:`${h}__input`,inputWrapper:`${h}__input-wrapper`,inputAction:`${h}__input-action`,inputMessage:`${h}__input-message`,inputSuffix:`${h}__input-suffix`,button:`${h}__button`},m={lock:"lock",unlock:"unlock"};let f=class extends c{constructor(){super(...arguments),this._input=null,this._lock=null,this._onLockClick=()=>{this.field.toggleLock(this.context)},this._onLockAfterCreate=t=>{this._lock=t},this._onLockAfterRemoved=()=>{this._lock=null},this._onKeyDown=t=>{t.key===s.discard&&"input"===this.mode&&this._input&&this.context.onDiscard(this._input)},this._onInputKeyDown=t=>{const e=this._input;if(e&&t.target===e)switch(t.key){case s.commit:return this.field.onCommit("commit-and-exit",e,this.context);case s.next:{t.preventDefault(),t.stopPropagation();const i=t.shiftKey?"commit-and-previous":"commit-and-next";return this.field.onCommit(i,e,this.context)}}},this._onInput=t=>{this.field.onInput(t.currentTarget.value)},this._onInputBlur=t=>{const e=this._input;e&&t.relatedTarget!==this._lock&&this.field.onCommit("commit-on-blur",e,this.context)},this._selectText=()=>{const t=()=>{this._input!==document.activeElement&&this._input!==document.activeElement?.shadowRoot?.activeElement||this._input?.selectText()};t(),i().then(t)},this._onAfterCreate=t=>{this._input=t,t.addEventListener("paste",this._onPaste),t.addEventListener("beforeinput",this._onBeforeInput)},this._onAfterRemoved=t=>{t.removeEventListener("paste",this._onPaste),t.removeEventListener("beforeinput",this._onBeforeInput),this._input===t&&(this._input=null)},this._onPaste=t=>{const e=t.clipboardData?.getData("text");if(!e)return;null!=this.field.parse(e,this.context)&&(t.stopPropagation(),this.field.onInput(e))},this._onBeforeInput=t=>{("historyUndo"===t.inputType||"historyRedo"===t.inputType)&&!this.field.dirty&&t.preventDefault()}}initialize(){this.addHandles(e(()=>this._rawDisplayValue,()=>{const{committed:t,inputValue:e}=this.field;t||e||this._input!==document.activeElement||this._selectText()}))}loadDependencies(){return u({button:()=>import("@esri/calcite-components/dist/components/calcite-button"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon"),input:()=>import("@esri/calcite-components/dist/components/calcite-input"),"input-message":()=>import("@esri/calcite-components/dist/components/calcite-input-message")})}render(){const{field:t,mode:e}=this,i="input"===e;return d("div",{class:this.classes({[_.base]:!0,[_.feedbackMode]:"feedback"===e,[_.inputMode]:"input"===e,[_.locked]:t.locked,[_.readOnly]:t.readOnly})},d("div",{class:_.title,key:"title"},this._title),d("div",{class:_.value,key:"value",onkeydown:this._onKeyDown},i?this._renderValueInputMode():this._renderValueFeedbackMode()))}get _formattedValue(){return this.field.getFormattedValue(this.context)||l}get _rawDisplayValue(){return this.field.getRawDisplayValue(this.context)}get _suffix(){return this.field.getSuffix(this.context)}get _title(){const{title:t}=this.field;return"string"==typeof t?t:t(this.context)}get _messages(){return this.context?.messages.sketch??{}}get _elevationModeSelect(){return"elevation"===this.field.name&&this.context.elevationModeContext&&this.context.toolOptions.tooltips.visibleElements.elevationMode?d(r,{context:this.context,key:"elevation-mode",mode:this.mode}):null}_renderValueFeedbackMode(){return d(p,null,d("div",{class:_.valueContent,key:"value-feedback"},this._formattedValue,this._elevationModeSelect),this.field.locked&&"input"!==this.mode?d("calcite-icon",{class:_.lockIcon,icon:m.lock,key:"icon",scale:"s"}):null)}_renderValueInputMode(){return this.field.readOnly?this._renderValueReadOnly():this._renderValueWritable()}_renderValueReadOnly(){return d("div",{class:this.classes(_.valueContent,_.valueContentReadOnly),key:"value-read-only"},this._formattedValue,this._elevationModeSelect)}_renderValueWritable(){const{field:t}=this,e=this._messages,{name:i}=t,o=t.invalid;return d(p,null,d("div",{class:_.inputWrapper,key:"value-input"},d("calcite-input",{afterCreate:this._onAfterCreate,afterRemoved:this._onAfterRemoved,class:_.input,"data-field-id":t.id,"data-field-name":i,"data-testid":`tooltip-field-${i}`,key:"input",scale:"s",status:o?"invalid":"idle",type:"text",value:this._rawDisplayValue??l,onblur:this._onInputBlur,onCalciteInputInput:this._onInput,onfocus:this._selectText,onkeydown:this._onInputKeyDown},this._elevationModeSelect?d("div",{class:_.inputAction,slot:"action"},this._elevationModeSelect):null),o?d("calcite-input-message",{class:_.inputMessage,scale:"s",status:"invalid"},e.invalidValue):null),d("div",{class:_.inputSuffix,key:"suffix"},this._suffix),this._renderedLockButton)}get _renderedLockButton(){const{lockDisabled:t,locked:e,lockable:i,name:o}=this.field;if(!i)return d("div",{key:"no-lock-button"});const n=this._messages,s=e?n.unlockConstraint:n.lockConstraint;return d("calcite-button",{afterCreate:this._onLockAfterCreate,afterRemoved:this._onLockAfterRemoved,alignment:"center",appearance:"transparent",class:_.button,"data-testid":`tooltip-field-${o}-lock`,disabled:t,iconStart:e?m.lock:m.unlock,key:"lock-button",kind:"neutral",label:s,scale:"s",tabIndex:-1,title:s,onclick:this._onLockClick})}};t([o()],f.prototype,"field",void 0),t([o()],f.prototype,"context",void 0),t([o()],f.prototype,"mode",void 0),t([o()],f.prototype,"_input",void 0),t([o()],f.prototype,"_lock",void 0),t([o()],f.prototype,"_formattedValue",null),t([o()],f.prototype,"_rawDisplayValue",null),t([o()],f.prototype,"_suffix",null),t([o()],f.prototype,"_title",null),t([o()],f.prototype,"_messages",null),t([o()],f.prototype,"_elevationModeSelect",null),t([o()],f.prototype,"_renderedLockButton",null),f=t([n("esri.views.interactive.tooltip.components.TooltipEditableField")],f);export{f as TooltipEditableField};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{createTask as i}from"../../../../core/asyncUtils.js";import o from"../../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../../core/MapUtils.js";import{abortMaybe as r}from"../../../../core/maybe.js";import{ignoreAbortErrors as n,throwIfAborted as a}from"../../../../core/promiseUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import{validateDomainValue as p}from"../../../../layers/support/domainUtils.js";import{makeArcadeContext as h,castArcadeValue as d}from"../../expressions/expressionUtils.js";let f=class extends t{constructor(e){super(e),this.filterValue="",this._choices=[],this._choicesByCode=new Map,this._expressionTask=null,this._interactionActive=!1,this._updatingHandles=new u}destroy(){r(this._expressionTask),this._updatingHandles.destroy()}get arcadeContextInfo(){return this.fieldInput.expressionsManager.arcadeContext}get choices(){return this._choices}get evaluating(){return this._updatingHandles.updating}get inputValue(){if(this._interactionActive)return this.filterValue;const e=this.fieldInput.value;return null==e?"":this.getLabel(e)}get features(){return this.fieldInput.features}get filteredChoices(){const e=this.choices,t=this.filterValue.trim().toLocaleLowerCase();return t?e.filter((e,i)=>this._normalizedChoiceNames[i].includes(t)):e}get input(){return this.fieldInput.input}get _normalizedChoiceNames(){return this._choices.map(({code:e,name:t})=>`${t}\n${this.getLabel(e)}`.toLocaleLowerCase())}beginInteraction(){this._interactionActive||(this._interactionActive=!0,this.filterValue="",this.evaluateChoiceExpression())}getChoice(e){return this._choicesByCode.get(e)}getLabel(e){const t=this.fieldInput.domain;return"coded-value"===t?.type?t.getName(e)??this.getChoice(e)?.name??String(e):this.getChoice(e)?.name??String(e)}endInteraction(){this._interactionActive=!1,this.filterValue=""}async evaluateChoiceExpression(){this._expressionTask=r(this._expressionTask);const e=i(e=>this._evaluateChoiceExpression(e));this._expressionTask=e;try{return await n(this._updatingHandles.addPromise(e.promise))??this.choices}finally{this._expressionTask===e&&(this._expressionTask=null)}}async _evaluateChoiceExpression(e){const t=await(import("../../../../arcade/languageUtils.js"));a(e);const i=this.arcadeContextInfo,o=this.fieldInput.field,r=new Array(this.features.length),n=new Map;let c;this.features.forEach((t,o)=>{const a=this.fieldInput.template.getExpressionExecutorsForLayer(t.layer)?.choiceExpression;if(!a)return void(r[o]=[]);const l=h(i,t,e);c||(c=l.executeContext),s(n,a,()=>[]).push({index:o,variables:l.variables})});for(const[s,p]of n){const n=await s.executeAsyncBatch(p,({variables:e})=>e,c);a(e);for(let e=0;e<n.length;e++){const s=n[e];"rejected"!==s.status?r[p[e].index]=this._parseChoices(s.value,i,o,t):r[p[e].index]=[]}}const l=this.fieldInput.domain,u=y(g(r)).filter(({code:e})=>null===p(o,e,l));return this._choicesByCode=new Map(u.map(e=>[e.code,e])),this._choices=u,u}_parseChoices(e,t,i,o){if(!_(e,o))return C(this),[];const s=x(e,"choices"),r=o.isImmutableArray(s)?s.toArray():Array.isArray(s)?s:[],n=[];for(const a of r){if(!_(a,o)){C(this);continue}const e=x(a,"name"),s=x(a,"code");if("string"!=typeof e||void 0===s||o.isVoid(s)||o.isFunctionParameter(s)){C(this);continue}const r=d(s,i,t.timeZone,o);null!=r&&n.push({name:e,code:r})}return n}};e([c()],f.prototype,"arcadeContextInfo",null),e([c()],f.prototype,"choices",null),e([c()],f.prototype,"evaluating",null),e([c()],f.prototype,"inputValue",null),e([c()],f.prototype,"features",null),e([c({constructOnly:!0})],f.prototype,"fieldInput",void 0),e([c()],f.prototype,"filteredChoices",null),e([c()],f.prototype,"filterValue",void 0),e([c()],f.prototype,"input",null),e([c()],f.prototype,"_choices",void 0),e([c()],f.prototype,"_interactionActive",void 0),e([c()],f.prototype,"_normalizedChoiceNames",null),f=e([l("esri.widgets.BatchAttributeForm.inputs.support.DynamicChoiceController")],f);const m=f;function g(e){const[t,...i]=e;if(!t)return[];let o=t;for(const r of i.sort((e,t)=>e.length-t.length)){if(!r.length)return[];const e=new Map;for(const{code:t,name:i}of r)s(e,t,()=>new Set).add(i);if(o=o.filter(({code:t,name:i})=>e.get(t)?.has(i)),!o.length)break}return o}function y(e){const t=new Set;return e.filter(({code:e})=>!t.has(e)&&(t.add(e),!0))}function _(e,t){return t.isDictionary(e)&&"function"==typeof e.field&&"function"==typeof e.keys}function x(e,t){const i=e.keys().find(e=>e.toLowerCase()===t);return null==i?void 0:e.field(i)}function C(e){o.getLogger(e).error("Value returned by choice expression does not conform to specification.")}export{m as default};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{createTask as i}from"../../../../core/asyncUtils.js";import o from"../../../../core/Logger.js";import{getOrCreateMapValue as s}from"../../../../core/MapUtils.js";import{abortMaybe as r}from"../../../../core/maybe.js";import{ignoreAbortErrors as n,throwIfAborted as a}from"../../../../core/promiseUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as u}from"../../../../core/support/UpdatingHandles.js";import{validateDomainValue as p}from"../../../../layers/support/domainUtils.js";import{makeArcadeContext as h,castArcadeValue as d}from"../../expressions/expressionUtils.js";let f=class extends t{constructor(e){super(e),this.filterValue="",this._choices=[],this._evaluated=!1,this._choicesByCode=new Map,this._expressionTask=null,this._interactionActive=!1,this._updatingHandles=new u}destroy(){r(this._expressionTask),this._updatingHandles.destroy()}get arcadeContextInfo(){return this.fieldInput.expressionsManager.arcadeContext}get choices(){return this._choices}get evaluating(){return this._updatingHandles.updating}get evaluated(){return this._evaluated}get inputValue(){if(this._interactionActive)return this.filterValue;const e=this.fieldInput.value;return null==e?"":this.getLabel(e)}get features(){return this.fieldInput.features}get filteredChoices(){const e=this.choices,t=this.filterValue.trim().toLocaleLowerCase();return t?e.filter((e,i)=>this._normalizedChoiceNames[i].includes(t)):e}get input(){return this.fieldInput.input}get _normalizedChoiceNames(){return this._choices.map(({code:e,name:t})=>`${t}\n${this.getLabel(e)}`.toLocaleLowerCase())}beginInteraction(){this._interactionActive||(this._interactionActive=!0,this.filterValue="",this.evaluateChoiceExpression())}getChoice(e){return this._choicesByCode.get(e)}getLabel(e){const t=this.fieldInput.domain;return"coded-value"===t?.type?t.getName(e)??this.getChoice(e)?.name??String(e):this.getChoice(e)?.name??String(e)}endInteraction(){this._interactionActive=!1,this.filterValue=""}async evaluateChoiceExpression(){this._expressionTask=r(this._expressionTask);const e=i(e=>this._evaluateChoiceExpression(e));this._expressionTask=e;try{return await n(this._updatingHandles.addPromise(e.promise))??this.choices}finally{this._expressionTask===e&&(this._expressionTask=null)}}async _evaluateChoiceExpression(e){const t=await(import("../../../../arcade/languageUtils.js"));a(e);const i=this.arcadeContextInfo,o=this.fieldInput.field,r=new Array(this.features.length),n=new Map;let c;this.features.forEach((t,o)=>{const a=this.fieldInput.template.getExpressionExecutorsForLayer(t.layer)?.choiceExpression;if(!a)return void(r[o]=[]);const l=h(i,t,e);c||(c=l.executeContext),s(n,a,()=>[]).push({index:o,variables:l.variables})});for(const[s,p]of n){const n=await s.executeAsyncBatch(p,({variables:e})=>e,c);a(e);for(let e=0;e<n.length;e++){const s=n[e];"rejected"!==s.status?r[p[e].index]=this._parseChoices(s.value,i,o,t):r[p[e].index]=[]}}const l=this.fieldInput.domain,u=y(g(r)).filter(({code:e})=>null===p(o,e,l));return this._choicesByCode=new Map(u.map(e=>[e.code,e])),this._choices=u,this._evaluated=!0,u}_parseChoices(e,t,i,o){if(!_(e,o))return x(this),[];const s=v(e,"choices"),r=o.isImmutableArray(s)?s.toArray():Array.isArray(s)?s:[],n=[];for(const a of r){if(!_(a,o)){x(this);continue}const e=v(a,"name"),s=v(a,"code");if("string"!=typeof e||void 0===s||o.isVoid(s)||o.isFunctionParameter(s)){x(this);continue}const r=d(s,i,t.timeZone,o);null!=r&&n.push({name:e,code:r})}return n}};e([c()],f.prototype,"arcadeContextInfo",null),e([c()],f.prototype,"choices",null),e([c()],f.prototype,"evaluating",null),e([c()],f.prototype,"evaluated",null),e([c()],f.prototype,"inputValue",null),e([c()],f.prototype,"features",null),e([c({constructOnly:!0})],f.prototype,"fieldInput",void 0),e([c()],f.prototype,"filteredChoices",null),e([c()],f.prototype,"filterValue",void 0),e([c()],f.prototype,"input",null),e([c()],f.prototype,"_choices",void 0),e([c()],f.prototype,"_evaluated",void 0),e([c()],f.prototype,"_interactionActive",void 0),e([c()],f.prototype,"_normalizedChoiceNames",null),f=e([l("esri.widgets.BatchAttributeForm.inputs.support.DynamicChoiceController")],f);const m=f;function g(e){const[t,...i]=e;if(!t)return[];let o=t;for(const r of i.sort((e,t)=>e.length-t.length)){if(!r.length)return[];const e=new Map;for(const{code:t,name:i}of r)s(e,t,()=>new Set).add(i);if(o=o.filter(({code:t,name:i})=>e.get(t)?.has(i)),!o.length)break}return o}function y(e){const t=new Set;return e.filter(({code:e})=>!t.has(e)&&(t.add(e),!0))}function _(e,t){return t.isDictionary(e)&&"function"==typeof e.field&&"function"==typeof e.keys}function v(e,t){const i=e.keys().find(e=>e.toLowerCase()===t);return null==i?void 0:e.field(i)}function x(e){o.getLogger(e).error("Value returned by choice expression does not conform to specification.")}export{m as default};