@arcgis/core 4.30.0-next.20240521 → 4.30.0-next.20240522

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 (54) hide show
  1. package/WebMap.js +1 -1
  2. package/assets/components/assets/icon/developerCredentials16.json +1 -0
  3. package/assets/components/assets/icon/developerCredentials24.json +1 -0
  4. package/assets/components/assets/icon/developerCredentials32.json +1 -0
  5. package/assets/esri/core/workers/RemoteClient.js +1 -1
  6. package/assets/esri/core/workers/chunks/01927419855947110cc1.js.LICENSE.txt +1 -1
  7. package/assets/esri/core/workers/chunks/158c05b16372d8ed33ea.js.LICENSE.txt +1 -1
  8. package/assets/esri/core/workers/chunks/190913c221964292333b.js.LICENSE.txt +1 -1
  9. package/assets/esri/core/workers/chunks/4268373bf374b2a6252a.js.LICENSE.txt +1 -1
  10. package/assets/esri/core/workers/chunks/59b193d42e8abf9d4088.js.LICENSE.txt +1 -1
  11. package/assets/esri/core/workers/chunks/{eac4ec8c410eaf9e621c.js → 606f8b907166190a8b65.js} +2 -2
  12. package/assets/esri/core/workers/chunks/{eac4ec8c410eaf9e621c.js.LICENSE.txt → 606f8b907166190a8b65.js.LICENSE.txt} +1 -1
  13. package/assets/esri/core/workers/chunks/{3716015ccf0888c0a21d.js → 724f221680849db03104.js} +1 -1
  14. package/assets/esri/core/workers/chunks/88c7d84a1fde246ca71f.js +1 -0
  15. package/assets/esri/core/workers/chunks/9b04a666726b5d2ff3c5.js.LICENSE.txt +1 -1
  16. package/assets/esri/core/workers/chunks/9c75837b7e75f0f38dc0.js.LICENSE.txt +1 -1
  17. package/assets/esri/core/workers/chunks/{bd0545bb100b3393fd85.js → bbec62f8792520993909.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{4f3a87586e334c52d0bf.js → caffbaa8b0a67d117f34.js} +1 -1
  19. package/assets/esri/core/workers/chunks/dde183c6bb1710ff16df.js.LICENSE.txt +1 -1
  20. package/assets/esri/images/portal/knowledgegraphlayer16.png +0 -0
  21. package/assets/esri/themes/dark/main.css +1 -1
  22. package/assets/esri/themes/light/main.css +1 -1
  23. package/assets/esri/themes/light/view.css +1 -1
  24. package/chunks/LineSeries.js +1 -1
  25. package/chunks/Theme.js +1 -1
  26. package/chunks/Tooltip.js +1 -1
  27. package/chunks/chartUtilsAm5.js +1 -1
  28. package/interfaces.d.ts +12 -4
  29. package/layers/ImageryTileLayer.js +1 -1
  30. package/layers/support/editableLayers.js +1 -1
  31. package/package.json +2 -2
  32. package/portal/PortalItem.js +1 -1
  33. package/rest/knowledgeGraph/wasmInterface/updateToWasmEncodedFactories.js +1 -1
  34. package/support/revision.js +1 -1
  35. package/views/2d/GoToManager.js +1 -1
  36. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  37. package/views/3d/interactive/editingTools/ManipulatedObject3DGraphic.js +1 -1
  38. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  39. package/views/3d/interactive/editingTools/reshape/reshapeTooltipUtils.js +1 -1
  40. package/views/3d/interactive/editingTools/tooltipUtils3D.js +1 -1
  41. package/views/3d/interactive/editingTools/transform/ScaleRotateMeshAdapter.js +1 -1
  42. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  43. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  44. package/views/3d/interactive/editingTools/undoRecords.js +5 -0
  45. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  46. package/views/layers/ImageryTileLayerView.js +1 -1
  47. package/widgets/DirectionalPad/DirectionalPadViewModel.js +1 -1
  48. package/widgets/FeatureTable/support/FeatureStore.js +1 -1
  49. package/widgets/LayerList/ListItemPanel.js +1 -1
  50. package/widgets/LayerList/support/layerListUtils.js +1 -1
  51. package/widgets/Sketch/SketchViewModel.js +1 -1
  52. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
  53. package/assets/esri/core/workers/chunks/0753c636c2801f067235.js +0 -1
  54. package/views/3d/interactive/editingTools/transform/undoRecords.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as a}from"../../../../../core/colorUtils.js";import{cyclicalPI as o}from"../../../../../core/Cyclical.js";import i from"../../../../../core/Evented.js";import"../../../../../core/has.js";import{clamp as s,rad2deg as n}from"../../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{createAngle as l,createScalar as c,createLength as p}from"../../../../../core/quantityUtils.js";import{when as h,initial as d,watch as u}from"../../../../../core/reactiveUtils.js";import{addFrameTask as m}from"../../../../../core/scheduling.js";import{createScreenPointArray as g}from"../../../../../core/screenUtils.js";import{property as f}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as _}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as v,fromScaling as b,multiply as D,scale as S,rotate as M}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as y}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as T,f as j,l as w,a as R,b as I,g as k}from"../../../../../chunks/vec32.js";import{clone as E,fromValues as O}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromPositionAndNormal as A,create as F,getNormal as C}from"../../../../../geometry/support/plane.js";import{wrap as P,distance2 as U}from"../../../../../geometry/support/ray.js";import{sv3d as x,sm4d as L}from"../../../../../geometry/support/vectorStacks.js";import{Manipulator3D as z}from"../../Manipulator3D.js";import{calculateInputRotationTransform as N}from"../../manipulatorUtils.js";import{RenderObject as H}from"../../RenderObject.js";import{screenToRenderPlane as G}from"../dragEventPipeline3D.js";import{ManipulatorType as V}from"../ManipulatorType.js";import{ringIndicatorDelayMs as q,rotateIndicatorDirectionBuffer as B,scaleIndicatorDirectionBuffer as J,rotateIndicatorArrowPlacementPercentage as K,ringThickness as Q,dragThresholdPx as W,ringRadius as X,innerIndicatorRadius as Y,outerIndicatorRadius as Z,ringHeight as $,rotateIndicatorArrowTipRadius as tt,rotateIndicatorArrowTipLength as et,scaleIndicatorOffset1 as at,scaleIndicatorOffset2 as ot,indicatorThickness as it,geometrySegments as st,rotateIndicatorArcLength as nt,ringResetAnimationSpeedFactor as rt,scaleIndicatorArcLength as lt}from"../manipulations/config.js";import{CullFaceOptions as ct}from"../../../webgl-engine/lib/basicInterfaces.js";import{createExtrudedTriangle as pt,transformInPlace as ht,createPathExtrusionGeometry as dt}from"../../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as ut}from"../../../webgl-engine/lib/Material.js";import{ColorMaterial as mt}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as gt}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as ft,ManipulatorStateFlags as _t}from"../../../../interactive/interfaces.js";import{Tooltip as vt}from"../../../../interactive/tooltip/Tooltip.js";import{TransformAbsoluteTooltipInfo as bt}from"../../../../interactive/tooltip/infos/TransformAbsoluteTooltipInfo.js";import{TransformRotateTooltipInfo as Dt}from"../../../../interactive/tooltip/infos/TransformRotateTooltipInfo.js";import{TransformScaleTooltipInfo as St}from"../../../../interactive/tooltip/infos/TransformScaleTooltipInfo.js";var Mt;!function(t){t.ScaleIn=ft.Custom2,t.ScaleOut=ft.Custom3,t.RotateLeft=ft.Custom4,t.RotateRight=ft.Custom5,t.Unlocked=ft.Custom7,t.DelayedFocused=ft.Custom8,t.TouchInput=ft.Custom12}(Mt||(Mt={}));let yt=class extends e{get angle(){return this.adapter.angle}get scale(){return this.adapter.scale}set location(t){this._ringManipulator.location=t}set elevationAlignedLocation(t){this._ringManipulator.elevationAlignedLocation=t}get grabbing(){return this._ringManipulator.grabbing}set interactive(t){this._ringManipulator.interactive=t}get updating(){return!!this._activeAnimation}get tooltipEffectiveEnabled(){return this.sketchOptions.tooltips.effectiveEnabled&&this.tooltipEnabled}constructor(t){super(t),this.mode=null,this.tooltipEnabled=!0,this._scaleRotateDragData=null,this._activeAnimation=null,this._ringIndicatorDelayMs=q,this._absoluteTooltipInfo=null,this._scaleTooltipInfo=null,this._rotateTooltipInfo=null,this.events=new i,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>"scale"===this._scaleRotateDragData?.mode?this.adapter.scale:1}initialize(){this.tooltip=new vt({view:this.tool.view}),this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this.addHandles([h((()=>!this.tooltipEffectiveEnabled),(()=>this.tooltip.clear()),d),u((()=>{const{adapter:t}=this,{info:e}=this.tooltip;return e===this._absoluteTooltipInfo&&this.getFocused()?[e,t.size,t.orientationClockwise]:[null]}),(([t])=>{t&&this._updateFocusTooltip()}))])}destroy(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=null,this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null,this.tooltip=r(this.tooltip)}startAnimation(t){this.cancelActiveAnimation(),t.start();const e=m({update:({deltaTime:e})=>{t.update(e)&&this.cancelActiveAnimation()}});this._activeAnimation={...t,frameTask:e}}cancelActiveAnimation(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=r(this._activeAnimation)}forEachManipulator(t){t(this._ringManipulator,V.SCALE_ROTATE)}_createManipulator(){const t=this._createRingManipulator();this._ringManipulator=t,this.tool.manipulators.add(t);const e=this.tool.object,a=gt(t,((t,a,i)=>{this._scaleRotateDragData=null;const r=this.adapter.startInteraction(),l={mode:"none",origin:E(t.renderLocation),initialAngle:this.adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=l,this._updateDragState();const c=x.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(t.renderLocation,c),a.next(G(this.tool.view,A(t.renderLocation,c,F()))).next((t=>{const a=C(t.plane),i=N(t.renderStart,t.renderEnd,l.origin,a),c=o.shortestSignedDiff(l.angle,i);l.angleDir=s(l.angleDir+c,-B,B),l.angle=i;const p=Tt(l,t),h=p-this.adapter.scale;if(l.scaleDir=s(l.scaleDir+h,-J,J),this._onScaleChanged(),"none"===l.mode){const a=this.mode||jt(t,t.plane,l.origin,this.tool.view.state.camera);if(null!=a){switch(a){case"rotate":this.tool.events.emit("rotate-start",{object:e,angle:0}),this.tool.events.emit("record-undo",{record:this.adapter.createUndoRecord()});break;case"scale":this.tool.events.emit("scale-start",{object:e,xScale:1,yScale:1}),this.tool.events.emit("record-undo",{record:this.adapter.createUndoRecord()})}l.mode=a}}switch(l.mode){case"rotate":r.state.angle=l.initialAngle+i;break;case"scale":r.state.scale=p,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),t.action){case"start":case"update":switch(l.mode){case"rotate":this.tool.events.emit("rotate",{object:e,angle:n(l.angle)});break;case"scale":this.tool.events.emit("scale",{object:e,xScale:p,yScale:p})}break;case"end":switch(l.mode){case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:n(l.angle)});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:p,yScale:p})}}return"end"===t.action&&(this.startAnimation(It(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState(),r.done()),t})).next(this._updateTooltipPipelineStep(l)),i.next((()=>{if(r.cancel(),null!=this._scaleRotateDragData){switch(this._scaleRotateDragData.mode){case"none":break;case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:0});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:1,yScale:1})}this.startAnimation(It(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState()}this._updateFocusTooltip()}))}));this.addHandles([a,t.events.on("focus-changed",(t=>{"focus"===t.action?this.startAnimation(kt(this,(()=>this._updateDelayedFocusedState()),{delayMs:this._ringIndicatorDelayMs})):this._updateDelayedFocusedState()})),t.events.on("immediate-click",(t=>{t.stopPropagation()})),u((()=>this.tool.object.visible),(t=>this._ringManipulator.available=t),d)])}_updateTooltipPipelineStep(t){return e=>{const{sketchOptions:a}=this,{visualVariables:o}=a.tooltips;if(!this.tooltipEffectiveEnabled)return e;if("end"===e.action)return this._updateFocusTooltip(),e;const{tooltip:i}=this;switch(t.mode){case"scale":{i.info=this._scaleTooltipInfo??=new St({sketchOptions:a});const{size:t,scale:e}=this.adapter,s=o?.size,n=i.info;n.sketchOptions=a,n.scale=c(e),n.size=null!=t?p(t,"meters"):void 0,n.sizePrecision=Et(s?.valueType),n.sizeUnit=s?.unit;break}case"rotate":{i.info=this._rotateTooltipInfo??=new Dt({sketchOptions:a});const{orientationClockwise:t,relativeAngleClockwise:e}=this.adapter,s=o?.rotation,n=Et(s?.valueType),r=i.info;r.sketchOptions=a,r.rotation=null!=e?l(e,"radians","geographic"):void 0,r.rotationPrecision=n,r.rotationType=s?.rotationType??"geographic",r.orientation=null!=t?l(t,"radians","geographic"):void 0,r.orientationPrecision=n;break}}return e}}_updateFocusTooltip(){const{sketchOptions:t,tooltip:e}=this,{visualVariables:a}=t.tooltips;if(!this.tooltipEffectiveEnabled)return;if(this.getFocused()){const o=a?.rotation,i=a?.size,s=this.mode,{size:n,orientationClockwise:r}=this.adapter,c=null!=r&&(null==s||"rotate"===s),h=null!=n&&(null==s||"scale"===s);e.info=this._absoluteTooltipInfo??=new bt({sketchOptions:t});const d=e.info;d.sketchOptions=t,d.orientation=c?l(r,"radians","geographic"):void 0,d.orientationPrecision=Et(o?.valueType),d.rotationType=o?.rotationType??"geographic",d.size=h?p(n,"meters"):void 0,d.sizeUnit=i?.unit,d.sizePrecision=Et(i?.valueType)}else e.clear()}_onScaleChanged(){this.events.emit("scale-changed"),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(Mt.DelayedFocused,this.getFocused()),this._updateFocusTooltip()}_updateDragState(){if(this._ringManipulator.updateStateEnabled(Mt.Unlocked,!(null!=this._scaleRotateDragData&&"none"!==this._scaleRotateDragData?.mode)),null!=this._scaleRotateDragData)switch(this._scaleRotateDragData.mode){case"rotate":this._ringManipulator.updateStateEnabled(Mt.ScaleIn|Mt.ScaleOut,!1),this._ringManipulator.updateStateEnabled(Mt.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(Mt.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case"scale":this._ringManipulator.updateStateEnabled(Mt.RotateLeft|Mt.RotateRight,!1),this._ringManipulator.updateStateEnabled(Mt.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(Mt.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(Mt.ScaleIn|Mt.ScaleOut|Mt.RotateLeft|Mt.RotateRight,!1)}_updateManipulatorTransform(){const t=v(L.get(),this.adapter.angle,O(0,0,1));if(null==t)return;const e=this.getScale(),a=b(L.get(),T(x.get(),e,e,e));this._ringManipulator.modelTransform=D(L.get(),a,t)}_createRingManipulator(){const t=(t,e,a)=>{const o=[],i=Math.ceil(st*(e-t)/(2*Math.PI));for(let s=0;s<i+1;s++){const n=t+s*(e-t)/i;o.push(O(a*Math.cos(n),a*Math.sin(n),0))}return o},e=e=>t(0,2*Math.PI,e),a=t=>[[-t/2,0],[t/2,0],[t/2,$/2],[-t/2,$/2]],o=this._createMaterial(1),i=(t,e,i=o)=>dt(i,a(e),t,[],[],!1),s=e(X),n=i(s,Q),r={left:new Array,right:new Array},l=[];for(let w=0;w<2;w++){const e=w*Math.PI-Math.PI/4,a=Math.PI/2-nt,s=e+a,n=e+Math.PI/2-a,c=t(s,n,Y),p=i(c,it);l.push(c),l.push(t(s,n,Z-Q/2)),r.left.push(p),r.right.push(p.instantiate());for(let t=0;t<2;t++){const e=0===t,a=y();if(e){S(a,a,[1,-1,1]),M(a,a,-s,[0,0,1]);const t=Math.round(K*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}else{M(a,a,n,[0,0,1]);const t=Math.round((1-K)*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}const i=pt(o,et,0,tt,$);ht(i,a),(e?r.left:r.right).push(i)}}const c=[];for(let S=0;S<2;S++){const e=S*Math.PI-Math.PI/4,a=Math.PI/2-lt,o=e+a,s=e+Math.PI/2-a,n=t(o,s,Z);c.push(i(n,it))}const p=this._createMaterial(.66),h=this._createMaterial(.5),d=this._createMaterial(.33),u=e(X+at),m=e(X+ot),g=i(u,it,p),f=i(m,it,d),_=e(X-at),v=e(X-ot),b=i(_,it,p),D=i(v,it,d);let T=[new H(n,Mt.DelayedFocused),new H(n.instantiate({material:h}),_t.None)];this.mode&&"scale"!==this.mode||(T=T.concat([...c.map((t=>new H(t,Mt.DelayedFocused|Mt.Unlocked))),new H(g,Mt.DelayedFocused|Mt.ScaleIn),new H(f,Mt.DelayedFocused|Mt.ScaleIn),new H(b,Mt.DelayedFocused|Mt.ScaleOut),new H(D,Mt.DelayedFocused|Mt.ScaleOut)])),this.mode&&"rotate"!==this.mode||(T=T.concat([...r.right.map((t=>new H(t.instantiate(),Mt.DelayedFocused|Mt.Unlocked))),...r.left.map((t=>new H(t,Mt.DelayedFocused|Mt.RotateLeft))),...r.right.map((t=>new H(t,Mt.DelayedFocused|Mt.RotateRight)))]));const j=[s,...l];return new z({view:this.tool.view,renderObjects:T,autoScaleRenderObjects:!1,worldOriented:!0,radius:Q,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:this.tool.object.elevationInfo,collisionType:{type:"ribbon",paths:j,direction:O(0,0,1)}})}_createMaterial(t){const e=new mt({cullFace:ct.Back,renderOccluded:ut.Transparent,isDecoration:!0});return this.addHandles(u((()=>({color:a(this.tool.view.effectiveTheme.accentColor,t)})),(t=>e.setParameters(t)),d)),e}get test(){}};function Tt(t,e){const a=j(x.get(),e.renderStart,t.origin),o=j(x.get(),e.renderEnd,t.origin),i=w(a),s=w(o);return 0===i?0:s/i}function jt(t,e,a,o){const{renderStart:i,renderEnd:s}=t,n=wt(i,o,x.get()),r=wt(s,o,x.get());if(R(n,r)<W*W)return null;const l=j(x.get(),i,a),c=I(x.get(),l,C(e)),p=i,h=k(x.get(),p,c),d=wt(a,o,x.get()),u=n,m=wt(h,o,x.get()),g=j(x.get(),m,u),f=j(x.get(),n,d),_=P(u,g),v=P(d,f);return U(_,r)<U(v,r)?"rotate":"scale"}function wt(t,e,a){return e.projectToScreen(t,Ot),T(a,Ot[0],Ot[1],0)}var Rt;function It(t,e){let a=null,o=1;const i=()=>o;return{start:()=>{o=t.getScale(),a=t.getScale,t.getScale=i,e()},update:t=>(o+=((o+1)/2-o)*Math.min(t*rt,1),e(),Math.abs(o-1)<.01?Rt.STOP:Rt.CONTINUE),destroy:()=>{a&&(t.getScale=a),e()}}}function kt(t,e,a){let o=0,i=null;const s=()=>!1;return{start:()=>{i=t.getFocused,t.getFocused=s,o=0,e()},update:t=>(o+=t,!i?.()||o>=a.delayMs?Rt.STOP:Rt.CONTINUE),destroy:()=>{i&&(t.getFocused=i),e()}}}function Et(t){switch(t){case"integer":case"long":return 0;default:return null}}t([f({constructOnly:!0})],yt.prototype,"tool",void 0),t([f({constructOnly:!0})],yt.prototype,"adapter",void 0),t([f({constructOnly:!0})],yt.prototype,"sketchOptions",void 0),t([f()],yt.prototype,"mode",void 0),t([f()],yt.prototype,"tooltipEnabled",void 0),t([f()],yt.prototype,"_activeAnimation",void 0),t([f()],yt.prototype,"updating",null),t([f()],yt.prototype,"tooltipEffectiveEnabled",null),yt=t([_("esri.views.3d.interactive.editingTools.transform.ScaleRotateTransform")],yt),function(t){t[t.CONTINUE=0]="CONTINUE",t[t.STOP=1]="STOP"}(Rt||(Rt={}));const Ot=g();export{yt as ScaleRotateTransform};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Accessor.js";import{multiplyOpacityToUnitRGBA as a}from"../../../../../core/colorUtils.js";import{cyclicalPI as o}from"../../../../../core/Cyclical.js";import i from"../../../../../core/Evented.js";import"../../../../../core/has.js";import{clamp as s,rad2deg as n}from"../../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{createAngle as l,createScalar as c,createLength as p}from"../../../../../core/quantityUtils.js";import{when as h,initial as u,watch as d}from"../../../../../core/reactiveUtils.js";import{addFrameTask as m}from"../../../../../core/scheduling.js";import{createScreenPointArray as g}from"../../../../../core/screenUtils.js";import{property as f}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as _}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromRotation as v,fromScaling as b,multiply as D,scale as S,rotate as M}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as y}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as T,f as j,l as w,a as R,b as I,g as k}from"../../../../../chunks/vec32.js";import{clone as E,fromValues as O}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromPositionAndNormal as A,create as F,getNormal as C}from"../../../../../geometry/support/plane.js";import{wrap as P,distance2 as U}from"../../../../../geometry/support/ray.js";import{sv3d as x,sm4d as L}from"../../../../../geometry/support/vectorStacks.js";import{Manipulator3D as z}from"../../Manipulator3D.js";import{calculateInputRotationTransform as N}from"../../manipulatorUtils.js";import{RenderObject as H}from"../../RenderObject.js";import{screenToRenderPlane as G}from"../dragEventPipeline3D.js";import{ManipulatorType as V}from"../ManipulatorType.js";import{ringIndicatorDelayMs as q,rotateIndicatorDirectionBuffer as B,scaleIndicatorDirectionBuffer as J,rotateIndicatorArrowPlacementPercentage as K,ringThickness as Q,dragThresholdPx as W,ringRadius as X,innerIndicatorRadius as Y,outerIndicatorRadius as Z,ringHeight as $,rotateIndicatorArrowTipRadius as tt,rotateIndicatorArrowTipLength as et,scaleIndicatorOffset1 as at,scaleIndicatorOffset2 as ot,indicatorThickness as it,geometrySegments as st,rotateIndicatorArcLength as nt,ringResetAnimationSpeedFactor as rt,scaleIndicatorArcLength as lt}from"../manipulations/config.js";import{CullFaceOptions as ct}from"../../../webgl-engine/lib/basicInterfaces.js";import{createExtrudedTriangle as pt,transformInPlace as ht,createPathExtrusionGeometry as ut}from"../../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as dt}from"../../../webgl-engine/lib/Material.js";import{ColorMaterial as mt}from"../../../webgl-engine/materials/ColorMaterial.js";import{createManipulatorDragEventPipeline as gt}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateCustomFlags as ft,ManipulatorStateFlags as _t}from"../../../../interactive/interfaces.js";import{Tooltip as vt}from"../../../../interactive/tooltip/Tooltip.js";import{TransformAbsoluteTooltipInfo as bt}from"../../../../interactive/tooltip/infos/TransformAbsoluteTooltipInfo.js";import{TransformRotateTooltipInfo as Dt}from"../../../../interactive/tooltip/infos/TransformRotateTooltipInfo.js";import{TransformScaleTooltipInfo as St}from"../../../../interactive/tooltip/infos/TransformScaleTooltipInfo.js";var Mt;!function(t){t.ScaleIn=ft.Custom2,t.ScaleOut=ft.Custom3,t.RotateLeft=ft.Custom4,t.RotateRight=ft.Custom5,t.Unlocked=ft.Custom7,t.DelayedFocused=ft.Custom8,t.TouchInput=ft.Custom12}(Mt||(Mt={}));let yt=class extends e{get angle(){return this.adapter.angle}get scale(){return this.adapter.scale}set location(t){this._ringManipulator.location=t}set elevationAlignedLocation(t){this._ringManipulator.elevationAlignedLocation=t}get grabbing(){return this._ringManipulator.grabbing}set interactive(t){this._ringManipulator.interactive=t}get updating(){return!!this._activeAnimation}get tooltipEffectiveEnabled(){return this.sketchOptions.tooltips.effectiveEnabled&&this.tooltipEnabled}constructor(t){super(t),this.mode=null,this.tooltipEnabled=!0,this._scaleRotateDragData=null,this._activeAnimation=null,this._ringIndicatorDelayMs=q,this._absoluteTooltipInfo=null,this._scaleTooltipInfo=null,this._rotateTooltipInfo=null,this.events=new i,this.getFocused=()=>this._ringManipulator.focused,this.getScale=()=>"scale"===this._scaleRotateDragData?.mode?this.adapter.scale:1}initialize(){this.tooltip=new vt({view:this.tool.view}),this._createManipulator(),this._updateDragState(),this._updateManipulatorTransform(),this.addHandles([h((()=>!this.tooltipEffectiveEnabled),(()=>this.tooltip.clear()),u),d((()=>{const{adapter:t}=this,{info:e}=this.tooltip;return e===this._absoluteTooltipInfo&&this.getFocused()?[e,t.size,t.orientationClockwise]:[null]}),(([t])=>{t&&this._updateFocusTooltip()}))])}destroy(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=null,this.tool.manipulators.remove(this._ringManipulator),this._ringManipulator=null,this.tooltip=r(this.tooltip)}startAnimation(t){this.cancelActiveAnimation(),t.start();const e=m({update:({deltaTime:e})=>{t.update(e)&&this.cancelActiveAnimation()}});this._activeAnimation={...t,frameTask:e}}cancelActiveAnimation(){this._activeAnimation?.frameTask.remove(),this._activeAnimation=r(this._activeAnimation)}forEachManipulator(t){t(this._ringManipulator,V.SCALE_ROTATE)}_createManipulator(){const t=this._createRingManipulator();this._ringManipulator=t,this.tool.manipulators.add(t);const e=this.tool.object,a=gt(t,((t,a,i)=>{this._scaleRotateDragData=null;const r=this.adapter.startInteraction(),l={mode:"none",origin:E(t.renderLocation),initialAngle:this.adapter.angle,angle:0,angleDir:0,scaleDir:0};this._scaleRotateDragData=l,this._updateDragState();const c=x.get();this.tool.view.renderCoordsHelper.worldUpAtPosition(t.renderLocation,c),a.next(G(this.tool.view,A(t.renderLocation,c,F()))).next((t=>{const a=C(t.plane),i=N(t.renderStart,t.renderEnd,l.origin,a),c=o.shortestSignedDiff(l.angle,i);l.angleDir=s(l.angleDir+c,-B,B),l.angle=i;const p=Tt(l,t),h=p-this.adapter.scale;if(l.scaleDir=s(l.scaleDir+h,-J,J),this._onScaleChanged(),"none"===l.mode){const a=this.mode||jt(t,t.plane,l.origin,this.tool.view.state.camera);if(null!=a){switch(a){case"rotate":this.tool.events.emit("rotate-start",{object:e,angle:0}),this.tool.events.emit("record-undo",{updates:[this.adapter.createUndoRecord()]});break;case"scale":this.tool.events.emit("scale-start",{object:e,xScale:1,yScale:1}),this.tool.events.emit("record-undo",{updates:[this.adapter.createUndoRecord()]})}l.mode=a}}switch(l.mode){case"rotate":r.state.angle=l.initialAngle+i;break;case"scale":r.state.scale=p,this._onScaleChanged()}switch(this._updateDragState(),this._updateManipulatorTransform(),t.action){case"start":case"update":switch(l.mode){case"rotate":this.tool.events.emit("rotate",{object:e,angle:n(l.angle)});break;case"scale":this.tool.events.emit("scale",{object:e,xScale:p,yScale:p})}break;case"end":switch(l.mode){case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:n(l.angle)});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:p,yScale:p})}}return"end"===t.action&&(this.startAnimation(It(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState(),r.done()),t})).next(this._updateTooltipPipelineStep(l)),i.next((()=>{if(r.cancel(),null!=this._scaleRotateDragData){switch(this._scaleRotateDragData.mode){case"none":break;case"rotate":this.tool.events.emit("rotate-stop",{object:e,angle:0});break;case"scale":this.tool.events.emit("scale-stop",{object:e,xScale:1,yScale:1})}this.startAnimation(It(this,(()=>this._onScaleChanged()))),this._scaleRotateDragData=null,this._updateDragState()}this._updateFocusTooltip()}))}));this.addHandles([a,t.events.on("focus-changed",(t=>{"focus"===t.action?this.startAnimation(kt(this,(()=>this._updateDelayedFocusedState()),{delayMs:this._ringIndicatorDelayMs})):this._updateDelayedFocusedState()})),t.events.on("immediate-click",(t=>{t.stopPropagation()})),d((()=>this.tool.object.visible),(t=>this._ringManipulator.available=t),u)])}_updateTooltipPipelineStep(t){return e=>{const{sketchOptions:a}=this,{visualVariables:o}=a.tooltips;if(!this.tooltipEffectiveEnabled)return e;if("end"===e.action)return this._updateFocusTooltip(),e;const{tooltip:i}=this;switch(t.mode){case"scale":{i.info=this._scaleTooltipInfo??=new St({sketchOptions:a});const{size:t,scale:e}=this.adapter,s=o?.size,n=i.info;n.sketchOptions=a,n.scale=c(e),n.size=null!=t?p(t,"meters"):void 0,n.sizePrecision=Et(s?.valueType),n.sizeUnit=s?.unit;break}case"rotate":{i.info=this._rotateTooltipInfo??=new Dt({sketchOptions:a});const{orientationClockwise:t,relativeAngleClockwise:e}=this.adapter,s=o?.rotation,n=Et(s?.valueType),r=i.info;r.sketchOptions=a,r.rotation=null!=e?l(e,"radians","geographic"):void 0,r.rotationPrecision=n,r.rotationType=s?.rotationType??"geographic",r.orientation=null!=t?l(t,"radians","geographic"):void 0,r.orientationPrecision=n;break}}return e}}_updateFocusTooltip(){const{sketchOptions:t,tooltip:e}=this,{visualVariables:a}=t.tooltips;if(!this.tooltipEffectiveEnabled)return;if(this.getFocused()){const o=a?.rotation,i=a?.size,s=this.mode,{size:n,orientationClockwise:r}=this.adapter,c=null!=r&&(null==s||"rotate"===s),h=null!=n&&(null==s||"scale"===s);e.info=this._absoluteTooltipInfo??=new bt({sketchOptions:t});const u=e.info;u.sketchOptions=t,u.orientation=c?l(r,"radians","geographic"):void 0,u.orientationPrecision=Et(o?.valueType),u.rotationType=o?.rotationType??"geographic",u.size=h?p(n,"meters"):void 0,u.sizeUnit=i?.unit,u.sizePrecision=Et(i?.valueType)}else e.clear()}_onScaleChanged(){this.events.emit("scale-changed"),this._updateManipulatorTransform()}_updateDelayedFocusedState(){this._ringManipulator.updateStateEnabled(Mt.DelayedFocused,this.getFocused()),this._updateFocusTooltip()}_updateDragState(){if(this._ringManipulator.updateStateEnabled(Mt.Unlocked,!(null!=this._scaleRotateDragData&&"none"!==this._scaleRotateDragData?.mode)),null!=this._scaleRotateDragData)switch(this._scaleRotateDragData.mode){case"rotate":this._ringManipulator.updateStateEnabled(Mt.ScaleIn|Mt.ScaleOut,!1),this._ringManipulator.updateStateEnabled(Mt.RotateLeft,this._scaleRotateDragData.angleDir<0),this._ringManipulator.updateStateEnabled(Mt.RotateRight,this._scaleRotateDragData.angleDir>=0);break;case"scale":this._ringManipulator.updateStateEnabled(Mt.RotateLeft|Mt.RotateRight,!1),this._ringManipulator.updateStateEnabled(Mt.ScaleIn,this._scaleRotateDragData.scaleDir<0),this._ringManipulator.updateStateEnabled(Mt.ScaleOut,this._scaleRotateDragData.scaleDir>=0)}else this._ringManipulator.updateStateEnabled(Mt.ScaleIn|Mt.ScaleOut|Mt.RotateLeft|Mt.RotateRight,!1)}_updateManipulatorTransform(){const t=v(L.get(),this.adapter.angle,O(0,0,1));if(null==t)return;const e=this.getScale(),a=b(L.get(),T(x.get(),e,e,e));this._ringManipulator.modelTransform=D(L.get(),a,t)}_createRingManipulator(){const t=(t,e,a)=>{const o=[],i=Math.ceil(st*(e-t)/(2*Math.PI));for(let s=0;s<i+1;s++){const n=t+s*(e-t)/i;o.push(O(a*Math.cos(n),a*Math.sin(n),0))}return o},e=e=>t(0,2*Math.PI,e),a=t=>[[-t/2,0],[t/2,0],[t/2,$/2],[-t/2,$/2]],o=this._createMaterial(1),i=(t,e,i=o)=>ut(i,a(e),t,[],[],!1),s=e(X),n=i(s,Q),r={left:new Array,right:new Array},l=[];for(let w=0;w<2;w++){const e=w*Math.PI-Math.PI/4,a=Math.PI/2-nt,s=e+a,n=e+Math.PI/2-a,c=t(s,n,Y),p=i(c,it);l.push(c),l.push(t(s,n,Z-Q/2)),r.left.push(p),r.right.push(p.instantiate());for(let t=0;t<2;t++){const e=0===t,a=y();if(e){S(a,a,[1,-1,1]),M(a,a,-s,[0,0,1]);const t=Math.round(K*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}else{M(a,a,n,[0,0,1]);const t=Math.round((1-K)*(c.length-1));a[12]=c[t][0],a[13]=c[t][1],a[14]=c[t][2]}const i=pt(o,et,0,tt,$);ht(i,a),(e?r.left:r.right).push(i)}}const c=[];for(let S=0;S<2;S++){const e=S*Math.PI-Math.PI/4,a=Math.PI/2-lt,o=e+a,s=e+Math.PI/2-a,n=t(o,s,Z);c.push(i(n,it))}const p=this._createMaterial(.66),h=this._createMaterial(.5),u=this._createMaterial(.33),d=e(X+at),m=e(X+ot),g=i(d,it,p),f=i(m,it,u),_=e(X-at),v=e(X-ot),b=i(_,it,p),D=i(v,it,u);let T=[new H(n,Mt.DelayedFocused),new H(n.instantiate({material:h}),_t.None)];this.mode&&"scale"!==this.mode||(T=T.concat([...c.map((t=>new H(t,Mt.DelayedFocused|Mt.Unlocked))),new H(g,Mt.DelayedFocused|Mt.ScaleIn),new H(f,Mt.DelayedFocused|Mt.ScaleIn),new H(b,Mt.DelayedFocused|Mt.ScaleOut),new H(D,Mt.DelayedFocused|Mt.ScaleOut)])),this.mode&&"rotate"!==this.mode||(T=T.concat([...r.right.map((t=>new H(t.instantiate(),Mt.DelayedFocused|Mt.Unlocked))),...r.left.map((t=>new H(t,Mt.DelayedFocused|Mt.RotateLeft))),...r.right.map((t=>new H(t,Mt.DelayedFocused|Mt.RotateRight)))]));const j=[s,...l];return new z({view:this.tool.view,renderObjects:T,autoScaleRenderObjects:!1,worldOriented:!0,radius:Q,focusMultiplier:1,touchMultiplier:1.5,elevationInfo:this.tool.object.elevationInfo,collisionType:{type:"ribbon",paths:j,direction:O(0,0,1)}})}_createMaterial(t){const e=new mt({cullFace:ct.Back,renderOccluded:dt.Transparent,isDecoration:!0});return this.addHandles(d((()=>({color:a(this.tool.view.effectiveTheme.accentColor,t)})),(t=>e.setParameters(t)),u)),e}get test(){}};function Tt(t,e){const a=j(x.get(),e.renderStart,t.origin),o=j(x.get(),e.renderEnd,t.origin),i=w(a),s=w(o);return 0===i?0:s/i}function jt(t,e,a,o){const{renderStart:i,renderEnd:s}=t,n=wt(i,o,x.get()),r=wt(s,o,x.get());if(R(n,r)<W*W)return null;const l=j(x.get(),i,a),c=I(x.get(),l,C(e)),p=i,h=k(x.get(),p,c),u=wt(a,o,x.get()),d=n,m=wt(h,o,x.get()),g=j(x.get(),m,d),f=j(x.get(),n,u),_=P(d,g),v=P(u,f);return U(_,r)<U(v,r)?"rotate":"scale"}function wt(t,e,a){return e.projectToScreen(t,Ot),T(a,Ot[0],Ot[1],0)}var Rt;function It(t,e){let a=null,o=1;const i=()=>o;return{start:()=>{o=t.getScale(),a=t.getScale,t.getScale=i,e()},update:t=>(o+=((o+1)/2-o)*Math.min(t*rt,1),e(),Math.abs(o-1)<.01?Rt.STOP:Rt.CONTINUE),destroy:()=>{a&&(t.getScale=a),e()}}}function kt(t,e,a){let o=0,i=null;const s=()=>!1;return{start:()=>{i=t.getFocused,t.getFocused=s,o=0,e()},update:t=>(o+=t,!i?.()||o>=a.delayMs?Rt.STOP:Rt.CONTINUE),destroy:()=>{i&&(t.getFocused=i),e()}}}function Et(t){switch(t){case"integer":case"long":return 0;default:return null}}t([f({constructOnly:!0})],yt.prototype,"tool",void 0),t([f({constructOnly:!0})],yt.prototype,"adapter",void 0),t([f({constructOnly:!0})],yt.prototype,"sketchOptions",void 0),t([f()],yt.prototype,"mode",void 0),t([f()],yt.prototype,"tooltipEnabled",void 0),t([f()],yt.prototype,"_activeAnimation",void 0),t([f()],yt.prototype,"updating",null),t([f()],yt.prototype,"tooltipEffectiveEnabled",null),yt=t([_("esri.views.3d.interactive.editingTools.transform.ScaleRotateTransform")],yt),function(t){t[t.CONTINUE=0]="CONTINUE",t[t.STOP=1]="STOP"}(Rt||(Rt={}));const Ot=g();export{yt as ScaleRotateTransform};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../../../chunks/tslib.es6.js";import{isSome as e}from"../../../../../core/arrayUtils.js";import o from"../../../../../core/Evented.js";import{makeHandle as i}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{watch as n}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as l}from"../../../../../core/support/UpdatingHandles.js";import p from"../../../../../geometry/Point.js";import{ViewingMode as c}from"../../../../ViewingMode.js";import{Manipulator3D as h}from"../../Manipulator3D.js";import{placeAtObject as m}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as d}from"../../SnappingVisualizer3D.js";import{manipulatedObjectGeometry as u}from"../manipulatedObjectUtils.js";import{canMoveZOperations as v}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as f}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as g}from"../tooltipUtils3D.js";import{createVisualElements as _}from"../visualElementUtils.js";import{alignArrowsScaleThreshold as b}from"../manipulations/config.js";import{MoveManipulation as j,ManipulationType as y}from"../manipulations/MoveManipulation.js";import{ScaleRotateMeshAdapter as S}from"./ScaleRotateMeshAdapter.js";import{ScaleRotateObjectSymbol3DAdapter as M}from"./ScaleRotateObjectSymbol3DAdapter.js";import{ScaleRotateTransform as R}from"./ScaleRotateTransform.js";import{createGraphicGeometryUndoRecord as w}from"./undoRecords.js";import{sceneSnappingAtProjectedLocation as T}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as A}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as O}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import x from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as I}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as k}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as U}from"../../../../interactive/tooltip/Tooltip.js";import{enterInputModeIfAvailable as E}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{TransformMeshTooltipInfo as H}from"../../../../interactive/tooltip/infos/TransformMeshTooltipInfo.js";import{TransformPointTooltipInfo as z}from"../../../../interactive/tooltip/infos/TransformPointTooltipInfo.js";let C=class extends A{constructor(t){super(t),this.events=new o,this.enableZ=!0,this.enableRotation=!0,this.enableScaling=!0,this.sketchOptions=new x,this.type="transform-3d",this._updatingHandles=new l,this._scaleRotate=null}initialize(){const{events:t,object:o,view:a}=this;this.tooltip=new U({view:a}),this._moveManipulation=new j({tool:this,view:a,snapToScene:this.snapToScene,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZ&&v(o.operations,o.elevationInfo),radius:j.radiusForSymbol(o.graphic?.symbol)}),this._moveManipulation.forEachManipulator((e=>this.addHandles(e.events.on("immediate-click",(e=>{t.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()})))));const s=o.elevationInfo;if(this._moveManipulation.elevationInfo=s,this.addHandles(f(o)),this._moveManipulation.createManipulatedObjectDragPipeline(((t,e,i,n,r)=>{if(t===y.XY){const{snappingStep:t,cancelSnapping:e}=k({snappingContext:new I({elevationInfo:s,pointer:r,editGeometryOperations:O.fromGeometry(new p({spatialReference:o.operations?.data.spatialReference}),a.state.viewingMode),visualizer:new d,excludeFeature:o.graphic}),snappingManager:this.snappingManager,updatingHandles:this._updatingHandles,useZ:!1});n=n.next(e),i=i.next(T(this.view,s)).next(...t)}return{steps:i,cancel:n}}),o,(e=>{const{action:o,object:i,dxScreen:a,dyScreen:n}=e,s={object:i,dxScreen:a,dyScreen:n};switch(o){case"start":t.emit("translate-start",s),this._emitRecordUndo();break;case"update":t.emit("translate",s);break;case"end":t.emit("translate-stop",s)}})),this._moveManipulation.angle=null!=this._scaleRotate?this._scaleRotate.angle:0,this._scaleRotateAdapter=this._createScaleRotateAdapter(),this.addHandles(n((()=>this._scaleRotateAdapter.angle),(()=>this._updateMoveAngle()))),this.enableScaling||this.enableRotation){const t=this.enableScaling&&this.enableRotation?null:this.enableScaling?"scale":"rotate";this._scaleRotate=new R({tool:this,mode:t,adapter:this._scaleRotateAdapter,sketchOptions:this.sketchOptions,tooltipEnabled:"mesh"!==u(o)?.type}),this.addHandles(this._scaleRotate.events.on("scale-changed",(()=>this._onScaleChanged())))}this.addHandles([_({view:this.view,object:o,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>i()}),o.on("committed",(()=>this._onGeometryChanged())),this._hideManipulatorsForObjectState(),n((()=>a.scale),(()=>this._updateMoveAngle()))].filter(e)),this._onGeometryChanged(),this._updateMoveAngle(),this._forEachManipulator((t=>{t instanceof h&&this.addHandles(t.events.on("grab-changed",(()=>this._updateManipulatorsInteractive())))}));const r=a?.type,{sketchOptions:l}=this;this._meshTooltipInfo=new H({viewType:r,sketchOptions:l}),this._pointTooltipInfo=new z({viewType:r,sketchOptions:l});const c={object:o,dxScreen:0,dyScreen:0},m={onMoveStart:()=>{this._emitRecordUndo(),t.emit("translate-start",{...c})},onMove:()=>t.emit("translate",{...c}),onMoveStop:()=>t.emit("translate-stop",{...c}),onRotateStart:e=>{this._emitRecordUndo(),t.emit("rotate-start",{object:o,angle:e})},onRotate:e=>t.emit("rotate",{object:o,angle:e}),onRotateStop:e=>t.emit("rotate-stop",{object:o,angle:e}),onScaleStart:(e,i)=>{this._emitRecordUndo(),t.emit("scale-start",{object:o,xScale:e,yScale:i})},onScale:(e,i)=>t.emit("scale",{object:o,xScale:e,yScale:i}),onScaleStop:(e,i)=>t.emit("scale-stop",{object:o,xScale:e,yScale:i})};this.addHandles(g(this.tooltip,this.object,(()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this.activeTooltipInfo,callbacks:m})))),this.finishToolCreation()}destroy(){this.tooltip.destroy(),this._moveManipulation.destroy(),this._scaleRotate=a(this._scaleRotate),this._scaleRotateAdapter=a(this._scaleRotateAdapter),this._updatingHandles.destroy(),this._set("view",null),this._set("object",null)}onInputEvent(t){if(!this.destroyed&&!E(t,this.tooltip))return super.onInputEvent(t)}_updateManipulatorsInteractive(){null!=this._scaleRotate&&(this._scaleRotate.interactive=!this._moveManipulation.grabbing,this._moveManipulation.interactive=!this._scaleRotate.grabbing)}_createScaleRotateAdapter(){const t=u(this.object);return"mesh"===t?.type?new S({object:this.object,geometry:t,viewingMode:this.view.state.viewingMode}):new M({graphic:this.object.graphic,sizeFilter:t=>this._enforceNonZeroSize(t),findLayerView:()=>this.view.allLayerViews.find((t=>t.layer===this.object.graphic?.layer)),sizeAxis:this.sketchOptions?.tooltips?.visualVariables?.size?.axis??null})}_forEachManipulator(t){this._moveManipulation?.forEachManipulator(t),this._scaleRotate?.forEachManipulator(t)}_hideManipulatorsForObjectState(){return n((()=>this.object.visible),(t=>{this._forEachManipulator((e=>e.available=t)),this._moveManipulation.zManipulation.available=t&&this.enableZ&&v(this.object.operations,this.object.elevationInfo)}))}_emitRecordUndo(){this.events.emit("record-undo",{record:w(this.object)})}set snapToScene(t){this._moveManipulation&&(this._moveManipulation.snapToScene=t),this._set("snapToScene",t)}get updating(){return this._updatingHandles.updating||!!this._scaleRotate?.updating}get activeTooltipInfo(){return null!=this._scaleRotate?.tooltip?.info?null:"mesh"===u(this.object)?.type?this._meshTooltipInfo:this._pointTooltipInfo}set location(t){this._moveManipulation.location=t,this._scaleRotate&&(this._scaleRotate.location=t)}set elevationAlignedLocation(t){this._moveManipulation.elevationAlignedLocation=t,this._scaleRotate&&(this._scaleRotate.elevationAlignedLocation=t)}reset(){}onHide(){this._scaleRotate?.cancelActiveAnimation()}_onScaleChanged(){null!=this._scaleRotate&&(this._moveManipulation.displayScale=this._scaleRotate.getScale())}_updateMoveAngle(){const{view:t}=this,e=t.state.viewingMode===c.Local||t.scale<b;this._moveManipulation.angle=e?this._scaleRotateAdapter.angle:0}_onGeometryChanged(){m(this,this.object)}_enforceNonZeroSize(t){return t||this.view.state.camera.computeRenderPixelSizeAt(this._moveManipulation.renderLocation)}get test(){}};t([s({constructOnly:!0,nonNullable:!0})],C.prototype,"view",void 0),t([s({constructOnly:!0,nonNullable:!0})],C.prototype,"object",void 0),t([s({constructOnly:!0,nonNullable:!0})],C.prototype,"enableZ",void 0),t([s()],C.prototype,"enableRotation",void 0),t([s()],C.prototype,"enableScaling",void 0),t([s({constructOnly:!0,type:x})],C.prototype,"sketchOptions",void 0),t([s({value:!1})],C.prototype,"snapToScene",null),t([s({constructOnly:!0})],C.prototype,"snappingManager",void 0),t([s({readOnly:!0})],C.prototype,"type",void 0),t([s({readOnly:!0})],C.prototype,"updating",null),t([s()],C.prototype,"activeTooltipInfo",null),C=t([r("esri.views.3d.interactive.editingTools.transform.TransformTool3D")],C);export{C as TransformTool3D};
5
+ import{_ as t}from"../../../../../chunks/tslib.es6.js";import{isSome as e}from"../../../../../core/arrayUtils.js";import o from"../../../../../core/Evented.js";import{makeHandle as i}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{watch as n}from"../../../../../core/reactiveUtils.js";import{property as s}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as l}from"../../../../../core/support/UpdatingHandles.js";import p from"../../../../../geometry/Point.js";import{ViewingMode as c}from"../../../../ViewingMode.js";import{Manipulator3D as h}from"../../Manipulator3D.js";import{placeAtObject as m}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as d}from"../../SnappingVisualizer3D.js";import{manipulatedObjectGeometry as u}from"../manipulatedObjectUtils.js";import{canMoveZOperations as v}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as g}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as _}from"../tooltipUtils3D.js";import{createVisualElements as f}from"../visualElementUtils.js";import{alignArrowsScaleThreshold as b}from"../manipulations/config.js";import{MoveManipulation as j,ManipulationType as y}from"../manipulations/MoveManipulation.js";import{ScaleRotateMeshAdapter as S}from"./ScaleRotateMeshAdapter.js";import{ScaleRotateObjectSymbol3DAdapter as M}from"./ScaleRotateObjectSymbol3DAdapter.js";import{ScaleRotateTransform as R}from"./ScaleRotateTransform.js";import{sceneSnappingAtProjectedLocation as w}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as T}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as A}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import O from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as x}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as I}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as k}from"../../../../interactive/tooltip/Tooltip.js";import{enterInputModeIfAvailable as U}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{TransformMeshTooltipInfo as E}from"../../../../interactive/tooltip/infos/TransformMeshTooltipInfo.js";import{TransformPointTooltipInfo as H}from"../../../../interactive/tooltip/infos/TransformPointTooltipInfo.js";let z=class extends T{constructor(t){super(t),this.events=new o,this.enableZ=!0,this.enableRotation=!0,this.enableScaling=!0,this.sketchOptions=new O,this.type="transform-3d",this._updatingHandles=new l,this._scaleRotate=null}initialize(){const{events:t,object:o,view:a}=this;this.tooltip=new k({view:a}),this._moveManipulation=new j({tool:this,view:a,snapToScene:this.snapToScene,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZ&&v(o.operations,o.elevationInfo),radius:j.radiusForSymbol(o.graphic?.symbol)}),this._moveManipulation.forEachManipulator((e=>this.addHandles(e.events.on("immediate-click",(e=>{t.emit("immediate-click",{...e,object:this.object}),e.stopPropagation()})))));const s=o.elevationInfo;if(this._moveManipulation.elevationInfo=s,this.addHandles(g(o)),this._moveManipulation.createManipulatedObjectDragPipeline(((t,e,i,n,r)=>{if(t===y.XY){const{snappingStep:t,cancelSnapping:e}=I({snappingContext:new x({elevationInfo:s,pointer:r,editGeometryOperations:A.fromGeometry(new p({spatialReference:o.operations?.data.spatialReference}),a.state.viewingMode),visualizer:new d,excludeFeature:o.graphic}),snappingManager:this.snappingManager,updatingHandles:this._updatingHandles,useZ:!1});n=n.next(e),i=i.next(w(this.view,s)).next(...t)}return{steps:i,cancel:n}}),o,(e=>{const{action:o,object:i,dxScreen:a,dyScreen:n}=e,s={object:i,dxScreen:a,dyScreen:n};switch(o){case"start":this._emitRecordUndo(),t.emit("translate-start",s);break;case"update":t.emit("translate",s);break;case"end":t.emit("translate-stop",s)}})),this._moveManipulation.angle=null!=this._scaleRotate?this._scaleRotate.angle:0,this._scaleRotateAdapter=this._createScaleRotateAdapter(),this.addHandles(n((()=>this._scaleRotateAdapter.angle),(()=>this._updateMoveAngle()))),this.enableScaling||this.enableRotation){const t=this.enableScaling&&this.enableRotation?null:this.enableScaling?"scale":"rotate";this._scaleRotate=new R({tool:this,mode:t,adapter:this._scaleRotateAdapter,sketchOptions:this.sketchOptions,tooltipEnabled:"mesh"!==u(o)?.type}),this.addHandles(this._scaleRotate.events.on("scale-changed",(()=>this._onScaleChanged())))}this.addHandles([f({view:this.view,object:o,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>i()}),o.on("committed",(()=>this._onGeometryChanged())),this._hideManipulatorsForObjectState(),n((()=>a.scale),(()=>this._updateMoveAngle()))].filter(e)),this._onGeometryChanged(),this._updateMoveAngle(),this._forEachManipulator((t=>{t instanceof h&&this.addHandles(t.events.on("grab-changed",(()=>this._updateManipulatorsInteractive())))}));const r=a?.type,{sketchOptions:l}=this;this._meshTooltipInfo=new E({viewType:r,sketchOptions:l}),this._pointTooltipInfo=new H({viewType:r,sketchOptions:l});const c={object:o,dxScreen:0,dyScreen:0},m={onMoveStart:()=>{this._emitRecordUndo(),t.emit("translate-start",{...c})},onMove:()=>t.emit("translate",{...c}),onMoveStop:()=>t.emit("translate-stop",{...c}),onRotateStart:e=>{this._emitRecordUndo(),t.emit("rotate-start",{object:o,angle:e})},onRotate:e=>t.emit("rotate",{object:o,angle:e}),onRotateStop:e=>t.emit("rotate-stop",{object:o,angle:e}),onScaleStart:(e,i)=>{this._emitRecordUndo(),t.emit("scale-start",{object:o,xScale:e,yScale:i})},onScale:(e,i)=>t.emit("scale",{object:o,xScale:e,yScale:i}),onScaleStop:(e,i)=>t.emit("scale-stop",{object:o,xScale:e,yScale:i})};this.addHandles(_(this.tooltip,this.object,(()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this.activeTooltipInfo,callbacks:m})))),this.finishToolCreation()}destroy(){this.tooltip.destroy(),this._moveManipulation.destroy(),this._scaleRotate=a(this._scaleRotate),this._scaleRotateAdapter=a(this._scaleRotateAdapter),this._updatingHandles.destroy(),this._set("view",null),this._set("object",null)}onInputEvent(t){if(!this.destroyed&&!U(t,this.tooltip))return super.onInputEvent(t)}_updateManipulatorsInteractive(){null!=this._scaleRotate&&(this._scaleRotate.interactive=!this._moveManipulation.grabbing,this._moveManipulation.interactive=!this._scaleRotate.grabbing)}_createScaleRotateAdapter(){const t=u(this.object);return"mesh"===t?.type?new S({object:this.object,geometry:t,viewingMode:this.view.state.viewingMode}):new M({graphic:this.object.graphic,sizeFilter:t=>this._enforceNonZeroSize(t),findLayerView:()=>this.view.allLayerViews.find((t=>t.layer===this.object.graphic?.layer)),sizeAxis:this.sketchOptions?.tooltips?.visualVariables?.size?.axis??null})}_forEachManipulator(t){this._moveManipulation?.forEachManipulator(t),this._scaleRotate?.forEachManipulator(t)}_hideManipulatorsForObjectState(){return n((()=>this.object.visible),(t=>{this._forEachManipulator((e=>e.available=t)),this._moveManipulation.zManipulation.available=t&&this.enableZ&&v(this.object.operations,this.object.elevationInfo)}))}_emitRecordUndo(){this.events.emit("record-undo",{updates:[this.object.createUndoRecord()]})}set snapToScene(t){this._moveManipulation&&(this._moveManipulation.snapToScene=t),this._set("snapToScene",t)}get updating(){return this._updatingHandles.updating||!!this._scaleRotate?.updating}get activeTooltipInfo(){return null!=this._scaleRotate?.tooltip?.info?null:"mesh"===u(this.object)?.type?this._meshTooltipInfo:this._pointTooltipInfo}set location(t){this._moveManipulation.location=t,this._scaleRotate&&(this._scaleRotate.location=t)}set elevationAlignedLocation(t){this._moveManipulation.elevationAlignedLocation=t,this._scaleRotate&&(this._scaleRotate.elevationAlignedLocation=t)}reset(){}onHide(){this._scaleRotate?.cancelActiveAnimation()}_onScaleChanged(){null!=this._scaleRotate&&(this._moveManipulation.displayScale=this._scaleRotate.getScale())}_updateMoveAngle(){const{view:t}=this,e=t.state.viewingMode===c.Local||t.scale<b;this._moveManipulation.angle=e?this._scaleRotateAdapter.angle:0}_onGeometryChanged(){m(this,this.object)}_enforceNonZeroSize(t){return t||this.view.state.camera.computeRenderPixelSizeAt(this._moveManipulation.renderLocation)}get test(){}};t([s({constructOnly:!0,nonNullable:!0})],z.prototype,"view",void 0),t([s({constructOnly:!0,nonNullable:!0})],z.prototype,"object",void 0),t([s({constructOnly:!0,nonNullable:!0})],z.prototype,"enableZ",void 0),t([s()],z.prototype,"enableRotation",void 0),t([s()],z.prototype,"enableScaling",void 0),t([s({constructOnly:!0,type:O})],z.prototype,"sketchOptions",void 0),t([s({value:!1})],z.prototype,"snapToScene",null),t([s({constructOnly:!0})],z.prototype,"snappingManager",void 0),t([s({readOnly:!0})],z.prototype,"type",void 0),t([s({readOnly:!0})],z.prototype,"updating",null),t([s()],z.prototype,"activeTooltipInfo",null),z=t([r("esri.views.3d.interactive.editingTools.transform.TransformTool3D")],z);export{z as TransformTool3D};
@@ -0,0 +1,5 @@
1
+ /*
2
+ All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
+ See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
+ */
5
+ import{clone as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isRelativeVertexSpace as t}from"../../../../geometry/support/meshVertexSpaceUtils.js";function r(e){return null!=e&&"mesh"===e.type?o(e):n(e)}function o(e){return t(e.vertexSpace)?i(e,e.transform,e.vertexSpace):l(e)}function n(e){let t=e,r=null;return{undo(e){r=e.geometry,e.geometry=t},redo(e){t=e.geometry,e.geometry=r}}}function i(t,r,o){let n=r?.clone(),i=e(o.origin),l=null,u=null;return{undo:()=>{l=t.transform?.clone(),u=e(o.origin),t.transform=n,t.vertexSpace.origin=i},redo:()=>{n=t.transform?.clone(),i=e(o.origin),t.transform=l,t.vertexSpace.origin=u}}}function l(e){let t,r=e.vertexAttributes.clonePositional();return{undo:()=>{t=e.vertexAttributes.clonePositional(),e.vertexAttributes=r},redo:()=>{r=e.vertexAttributes.clonePositional(),e.vertexAttributes=t}}}export{r as createGraphicGeometryUndoRecord};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{createTask as t}from"../../../core/asyncUtils.js";import{handlesGroup as e,makeHandle as o}from"../../../core/handleUtils.js";import{floatEqualUlp as n}from"../../../core/mathUtils.js";import{createAngle as r,createScalar as a,valueInUnit as l}from"../../../core/quantityUtils.js";import{verticalLengthUnitFromSpatialReference as i}from"../../../core/unitUtils.js";import{k as s,j as u,E as c}from"../../../chunks/vec32.js";import{clone as p,ONES as f,create as m,UNIT_Z as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isLoaded as g,load as d}from"../../../geometry/coordinateFormatter.js";import v from"../../../geometry/Point.js";import x from"../../../geometry/support/MeshTransform.js";import{isRelativeVertexSpace as j}from"../../../geometry/support/meshVertexSpaceUtils.js";import{isWebMercator as b}from"../../../geometry/support/spatialReferenceUtils.js";import{lngLatToXY as S}from"../../../geometry/support/webMercatorUtils.js";import{tooltipKeys as h}from"../keybindings.js";import{parseLatitudeLongitude as U,parseXY as M}from"./fields/parsingAndFormattingUtils.js";import{getDegreesArithmetic as z,getDegreesGeographic as A}from"../../support/angularMeasurementUtils.js";function R(t,e){const o=j(e.vertexSpace),{scale:n,orientation:l}=t,{transform:i}=e,s=F(i);o&&null!=s?(l.actual=r(s,"degrees","arithmetic"),l.visible=!0):(l.actual=null,l.visible=!1),o?(n.actual=a(O(i)),n.visible=!0):(n.actual=null,n.visible=!1)}function k(t,e,o){V(t,e,o),"orientation"in t&&"scale"in t&&w(t,e,o)}function w(t,e,o){if(!e||!j(e.vertexSpace))return;const n=e.transform??=new x,{rotationAngle:r,rotationAxis:a}=n,l=z(t.orientation.actual),i=I(a);if(null!=l&&null!=i&&l!==r){o?.onRotateStart?.(r);const t=l*i;n.rotationAngle=t,o?.onRotate?.(t),o?.onRotateStop?.(t)}const s=t.scale.actual?.value,c=O(n);if(null!=s&&s!==c){const{scale:t}=n;let e;if(o?.onScaleStart?.(t[0],t[1],t[2]),0===c)e=p(f);else{const o=s/c;e=u(m(),t,o)}n.scale=e,o?.onScale?.(e[0],e[1],e[2]),o?.onScaleStop?.(e[0],e[1],e[2])}}function V(t,e,o){if(!e||!j(e.vertexSpace))return;const{origin:n,spatialReference:r}=e,{x:a,y:l,z:i}=P(t,r),{dx:s,dy:u,dz:c}=D(t,n);0===s&&0===u&&0===c||(o.onMoveStart?.(),e.centerAt(new v({x:a??n.x,y:l??n.y,z:i??n.z,spatialReference:r})),o.onMove?.(s,u,c),o.onMoveStop?.())}function D(t,e){const{x:o,y:r,z:a}=e,{x:l,y:i,z:s}=P(t,e.spatialReference);return{dx:null==l||n(l,o)?0:l-o,dy:null==i||n(i,r)?0:i-r,dz:null==s||null==a||n(s,a)?0:s-a}}function P(t,e){let o,n,r;if(t.geographic){o=A(t.longitude.actual),n=A(t.latitude.actual),b(e)&&(null!=o&&null!=n?[o,n]=S(o,n,E):null!=o?o=S(o,0,E)[0]:null!=n&&(n=S(0,n,E)[1]));const a=t.elevation.actual,s=i(e);r=null!=s&&null!=a?l(a,s):void 0}else o=t.x.actual?.value,n=t.y.actual?.value,r=t.elevation.actual?.value;return{x:o,y:n,z:r}}const E=[0,0];function F(t){if(!t)return 0;const e=I(t.rotationAxis);return null!=e?e*t.rotationAngle:null}function I(t){return c(t,y)?1:c(t,q)?-1:null}const q=s(m(),y);function O(t){return t?Math.max(...t.scale):1}function T(t,e){return!("key-down"!==t.type||t.key!==h.enterInputMode||!e||!B(e.info))&&(e.enterInputMode(),t.stopPropagation(),!0)}function B(t){const e=t?.sketchOptions;if(!e)return!1;const{inputEnabled:o,visibleElements:n}=e.tooltips;return o&&!0===t.editableFields.some((({name:t})=>"x"===t||"y"===t?n.coordinates:n[t]))}function C(n){let r=null;return e([n.on("paste",(async e=>{r?.abort(),r=t((async()=>{g()||await d(),G(e,n.info)}))})),t((()=>d())),o((()=>r?.abort()))])}function G(t,e){if(!e||!("geographic"in e))return;const o=t.clipboardData?.getData("text");if(o)if(e.geographic){const n=U(o);n&&(e.longitude.applyValue(n.longitude),e.latitude.applyValue(n.latitude),t.stopPropagation(),t.preventDefault())}else{const n=M(o);n&&(e.x.applyValue(n.x),e.y.applyValue(n.y),t.stopPropagation(),t.preventDefault())}}export{C as connectPasteEvent,T as enterInputModeIfAvailable,D as getXYZDeltasFromTooltipInfo,G as pasteLocation,k as updateMeshFromTooltipInfo,V as updateMeshOriginFromTooltipInfo,w as updateMeshTransformFromTooltipInfo,R as updateTooltipInfoFromMeshTransform};
5
+ import{createTask as t}from"../../../core/asyncUtils.js";import{handlesGroup as e,makeHandle as o}from"../../../core/handleUtils.js";import{floatEqualUlp as n}from"../../../core/mathUtils.js";import{createAngle as r,createScalar as a,valueInUnit as l}from"../../../core/quantityUtils.js";import{verticalLengthUnitFromSpatialReference as i}from"../../../core/unitUtils.js";import{k as s,j as u,E as c}from"../../../chunks/vec32.js";import{clone as p,ONES as f,create as m,UNIT_Z as y}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{isLoaded as g,load as d}from"../../../geometry/coordinateFormatter.js";import v from"../../../geometry/Point.js";import x from"../../../geometry/support/MeshTransform.js";import{isRelativeVertexSpace as j}from"../../../geometry/support/meshVertexSpaceUtils.js";import{isWebMercator as b}from"../../../geometry/support/spatialReferenceUtils.js";import{lngLatToXY as S}from"../../../geometry/support/webMercatorUtils.js";import{tooltipKeys as h}from"../keybindings.js";import{parseLatitudeLongitude as U,parseXY as M}from"./fields/parsingAndFormattingUtils.js";import{getDegreesArithmetic as z,getDegreesGeographic as A}from"../../support/angularMeasurementUtils.js";function R(t,e){const o=j(e.vertexSpace),{scale:n,orientation:l}=t,{transform:i}=e,s=E(i);o&&null!=s?(l.actual=r(s,"degrees","arithmetic"),l.visible=!0):(l.actual=null,l.visible=!1),o?(n.actual=a(q(i)),n.visible=!0):(n.actual=null,n.visible=!1)}function k(t,e,o){if(!e||!j(e.vertexSpace))return;const n=e.transform??=new x,{rotationAngle:r,rotationAxis:a}=n,l=z(t.orientation.actual),i=F(a);if(null!=l&&null!=i&&l!==r){o?.onRotateStart?.(r);const t=l*i;n.rotationAngle=t,o?.onRotate?.(t),o?.onRotateStop?.(t)}const s=t.scale.actual?.value,c=q(n);if(null!=s&&s!==c){const{scale:t}=n;let e;if(o?.onScaleStart?.(t[0],t[1],t[2]),0===c)e=p(f);else{const o=s/c;e=u(m(),t,o)}n.scale=e,o?.onScale?.(e[0],e[1],e[2]),o?.onScaleStop?.(e[0],e[1],e[2])}}function w(t,e,o){if(!e||!j(e.vertexSpace))return;const{origin:n,spatialReference:r}=e,{x:a,y:l,z:i}=D(t,r),{dx:s,dy:u,dz:c}=V(t,n);0===s&&0===u&&0===c||(o.onMoveStart?.(),e.centerAt(new v({x:a??n.x,y:l??n.y,z:i??n.z,spatialReference:r})),o.onMove?.(s,u,c),o.onMoveStop?.())}function V(t,e){const{x:o,y:r,z:a}=e,{x:l,y:i,z:s}=D(t,e.spatialReference);return{dx:null==l||n(l,o)?0:l-o,dy:null==i||n(i,r)?0:i-r,dz:null==s||null==a||n(s,a)?0:s-a}}function D(t,e){let o,n,r;if(t.geographic){o=A(t.longitude.actual),n=A(t.latitude.actual),b(e)&&(null!=o&&null!=n?[o,n]=S(o,n,P):null!=o?o=S(o,0,P)[0]:null!=n&&(n=S(0,n,P)[1]));const a=t.elevation.actual,s=i(e);r=null!=s&&null!=a?l(a,s):void 0}else o=t.x.actual?.value,n=t.y.actual?.value,r=t.elevation.actual?.value;return{x:o,y:n,z:r}}const P=[0,0];function E(t){if(!t)return 0;const e=F(t.rotationAxis);return null!=e?e*t.rotationAngle:null}function F(t){return c(t,y)?1:c(t,I)?-1:null}const I=s(m(),y);function q(t){return t?Math.max(...t.scale):1}function O(t,e){return!("key-down"!==t.type||t.key!==h.enterInputMode||!e||!T(e.info))&&(e.enterInputMode(),t.stopPropagation(),!0)}function T(t){const e=t?.sketchOptions;if(!e)return!1;const{inputEnabled:o,visibleElements:n}=e.tooltips;return o&&!0===t.editableFields.some((({name:t})=>"x"===t||"y"===t?n.coordinates:n[t]))}function B(n){let r=null;return e([n.on("paste",(async e=>{r?.abort(),r=t((async()=>{g()||await d(),C(e,n.info)}))})),t((()=>d())),o((()=>r?.abort()))])}function C(t,e){if(!e||!("geographic"in e))return;const o=t.clipboardData?.getData("text");if(o)if(e.geographic){const n=U(o);n&&(e.longitude.applyValue(n.longitude),e.latitude.applyValue(n.latitude),t.stopPropagation(),t.preventDefault())}else{const n=M(o);n&&(e.x.applyValue(n.x),e.y.applyValue(n.y),t.stopPropagation(),t.preventDefault())}}export{B as connectPasteEvent,O as enterInputModeIfAvailable,V as getXYZDeltasFromTooltipInfo,C as pasteLocation,w as updateMeshOriginFromTooltipInfo,k as updateMeshTransformFromTooltipInfo,R as updateTooltipInfoFromMeshTransform};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import r from"../../core/Error.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{combineTimeExtent as a}from"../../layers/support/timeSupport.js";import{getDefaultDatumTransformationForDataset as o,projectDatasetExtent as n}from"../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{getFetchPopupTemplate as l}from"./support/popupUtils.js";const u=u=>{let p=class extends u{constructor(){super(...arguments),this._rasterFieldPrefix="Raster.",this.layer=null,this.view=null,this.tileInfo=null}get fullExtent(){return this._getfullExtent()}get timeExtent(){return a(this.layer,this.view?.timeExtent,this._get("timeExtent"))}get hasTilingEffects(){return!!(this.layer.renderer&&"dynamicRangeAdjustment"in this.layer.renderer&&this.layer.renderer.dynamicRangeAdjustment)}get datumTransformation(){return o(this.layer.fullExtent,this.view.spatialReference,!0)}supportsSpatialReference(e){return!!n(this.layer.serviceRasterInfo,e)}async fetchPopupFeaturesAtLocation(e,i){const{layer:s}=this;if(!e)throw new r("imageryTileLayerView:fetchPopupFeatures","Nothing to fetch without area",{layer:s});const{popupEnabled:a}=s,o=l(s,i);if(!a||null==o)return[];const n=[],{value:u,magdirValue:p,processedValue:c}=await s.identify(e,{timeExtent:this.timeExtent,signal:i?.signal});let m="";if(u?.length){m="imagery-tile"===s.type&&s.hasStandardTime()&&null!=u[0]?u.map((e=>s.getStandardTimeValue(e))).join(", "):u.join(", ");const e={ObjectId:0},r="Raster.ServicePixelValue";e[r]="imagery-tile"===s.type&&"Function"===s.raster.datasetFormat?c?.join(", "):m,e[r+".Raw"]=m;const i=s.serviceRasterInfo?.attributeTable;if(null!=i){const{fields:t,features:r}=i,s=t.find((({name:e})=>"value"===e.toLowerCase())),a=s?r.find((e=>String(e.attributes[s.name])===m)):null;if(a)for(const i in a.attributes)if(a.attributes.hasOwnProperty(i)){e[this._rasterFieldPrefix+i]=a.attributes[i]}}const a=s.serviceRasterInfo?.dataType;"vector-magdir"!==a&&"vector-uv"!==a||(e["Raster.Magnitude"]=p?.[0],e["Raster.Direction"]=p?.[1]);const o=new t({geometry:this.fullExtent.clone(),attributes:e,layer:s,sourceLayer:s});n.push(o)}return n}_getfullExtent(){return n(this.layer.serviceRasterInfo,this.view.spatialReference)}};return e([i()],p.prototype,"fullExtent",null),e([i()],p.prototype,"layer",void 0),e([i({readOnly:!0})],p.prototype,"timeExtent",null),e([i()],p.prototype,"view",void 0),e([i()],p.prototype,"tileInfo",void 0),e([i({readOnly:!0})],p.prototype,"hasTilingEffects",null),e([i()],p.prototype,"datumTransformation",null),p=e([s("esri.views.layers.ImageryTileLayerView")],p),p};export{u as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import r from"../../core/Error.js";import{property as i}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import{combineTimeExtent as a}from"../../layers/support/timeSupport.js";import{getDefaultDatumTransformationForDataset as o,projectDatasetExtent as n}from"../../layers/support/rasterFunctions/rasterProjectionHelper.js";import{getFetchPopupTemplate as l}from"./support/popupUtils.js";const u=u=>{let p=class extends u{constructor(){super(...arguments),this._rasterFieldPrefix="Raster.",this.layer=null,this.view=null,this.tileInfo=null}get fullExtent(){return this._getfullExtent()}get timeExtent(){return a(this.layer,this.view?.timeExtent,this._get("timeExtent"))}get hasTilingEffects(){return!!(this.layer.renderer&&"dynamicRangeAdjustment"in this.layer.renderer&&this.layer.renderer.dynamicRangeAdjustment)}get datumTransformation(){return o(this.layer.fullExtent,this.view.spatialReference,!0)}supportsSpatialReference(e){return!!n(this.layer.serviceRasterInfo,e)}async fetchPopupFeaturesAtLocation(e,i){const{layer:s}=this;if(!e)throw new r("imageryTileLayerView:fetchPopupFeatures","Nothing to fetch without area",{layer:s});const{popupEnabled:a}=s,o=l(s,i);if(!a||null==o)return[];const n=[],{value:u,magdirValue:p,processedValue:c}=await s.identify(e,{timeExtent:this.timeExtent,signal:i?.signal});let m="";if(u?.length){m="imagery-tile"===s.type&&s.hasStandardTime()&&null!=u[0]?u.map((e=>s.getStandardTimeValue(e))).join(", "):u.join(", ");const e={ObjectId:0},r="Raster.ServicePixelValue";e[r]="imagery-tile"===s.type&&"Function"===s.raster.datasetFormat?c?.join(", "):m,e[r+".Raw"]=m;const i=s.raster?.rasterInfo??s.serviceRasterInfo,a=i?.attributeTable;if(null!=a){const{fields:t,features:i}=a,s=t.find((({name:e})=>"value"===e.toLowerCase())),o=e[r],n=s?i.find((e=>String(e.attributes[s.name])===o)):null;if(n)for(const r in n.attributes)if(n.attributes.hasOwnProperty(r)){e[this._rasterFieldPrefix+r]=n.attributes[r]}}const o=i?.dataType;"vector-magdir"!==o&&"vector-uv"!==o||(e["Raster.Magnitude"]=p?.[0],e["Raster.Direction"]=p?.[1]);const l=new t({geometry:this.fullExtent.clone(),attributes:e,layer:s,sourceLayer:s});n.push(l)}return n}_getfullExtent(){return n(this.layer.serviceRasterInfo,this.view.spatialReference)}};return e([i()],p.prototype,"fullExtent",null),e([i()],p.prototype,"layer",void 0),e([i({readOnly:!0})],p.prototype,"timeExtent",null),e([i()],p.prototype,"view",void 0),e([i()],p.prototype,"tileInfo",void 0),e([i({readOnly:!0})],p.prototype,"hasTilingEffects",null),e([i()],p.prototype,"datumTransformation",null),p=e([s("esri.views.layers.ImageryTileLayerView")],p),p};export{u as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Evented.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{directionalPadMoveOnceDuration as s}from"./constants.js";import{css as n}from"./css.js";import{angleToUnitVector as r,toUnitVector as v,vectorToClosestAngle as m}from"./utils.js";import{GoToMixin as a}from"../support/GoTo.js";let d=class extends(a(e.EventedAccessor)){constructor(t){super(t),this._initialAngle=void 0,this._movementVector=void 0,this._widgetCenter=void 0,this._anyAngleMovementEnabled=!1,this._movementTimeout=void 0,this._disabled=!1,this._moveOnceDuration=s,this.angle=void 0,this.speed=1,this.beginFollowingPointer=(t,e)=>{if(this.disabled)return;this._widgetCenter=e;const o=this._pointerLocationToVector(t);if(void 0===o)return;const i=this._resolveClosestAngle(t,o);void 0!==i&&(this._emitMove(r(i)),this.angle=i,this._initialAngle=i,this._setMovementTimeout((()=>{void 0===this._widgetCenter&&this._stopMovement()})),document.addEventListener("pointermove",this._onPointerMove,{passive:!0}),document.addEventListener("pointerup",this._onPointerUp,{passive:!0,once:!0}))},this.moveOnce=t=>{const e=r(t);this._emitMove(e),this._setMovementTimeout(this._stopMovement)},this._pointerLocationToVector=t=>{if(void 0===this._widgetCenter)return;const{x:e,y:o}=v(this._widgetCenter,t);return{x:e,y:-o}},this._resolveClosestAngle=(t,e)=>{const o=t.target,i=o?.getAttribute?.("data-angle"),s=o?.classList?.contains(n.compassButton);if(s)return;const r=Number.parseInt(i??"",10);return Number.isNaN(r)?m(e):r},this._onPointerMove=t=>{if(0===t.buttons)return void this._stopMovement();const e=this._pointerLocationToVector(t);if(void 0===e)return;this._setMovementTimeout(void 0);const o=this._resolveClosestAngle(t,e);if(void 0===o)return void this._emitStop();const i=r(o),s=null!=this._initialAngle&&this._initialAngle!==o;this._anyAngleMovementEnabled||=s;const n=this._anyAngleMovementEnabled?e:i;(n.x!==this._movementVector?.x||n.y!==this._movementVector?.y)&&(this.angle=o,this._emitMove(n))},this._onPointerUp=()=>{void 0===this._movementTimeout?this._stopMovement():this._widgetCenter=void 0},this._stopMovement=()=>{this._emitStop(),this._widgetCenter=void 0,this._initialAngle=void 0,this._anyAngleMovementEnabled=!1,document.removeEventListener("pointermove",this._onPointerMove),document.removeEventListener("pointerup",this._stopMovement),this._setMovementTimeout(void 0)},this.on("move-start",(()=>this.view?.mapViewNavigation.begin())),this.on("move-direction-change",(({vector:{x:t,y:e}})=>this.view?.mapViewNavigation.continuousPanVector({x:t*this.speed,y:e*this.speed}))),this.on("move-stop",(()=>this.view?.mapViewNavigation.stop()))}destroy(){this._stopMovement()}get disabled(){const{view:t,_disabled:e,supported:o}=this;return!1===t?.ready||e||!o}set disabled(t){this._disabled=t}get rotation(){return this.view?.rotation??this._get("rotation")??0}set rotation(t){this.view?this.view.constraints.rotationEnabled&&this.callGoTo({target:{rotation:t},options:{animate:0===t}}):this._set("rotation",t)}get supported(){return null==this.view||"2d"===this.view.type}get state(){const{disabled:t,angle:e}=this;return t?"disabled":null!=e?"moving":"ready"}_setMovementTimeout(t){clearTimeout(this._movementTimeout),this._movementTimeout=void 0===t?void 0:setTimeout((()=>{this._movementTimeout=void 0,t()}),this._moveOnceDuration)}_emitMove(t){null==this._movementVector&&this._emitMoveStartEvent({vector:t});const e=this._movementVector;this._movementVector=t,this._emitMoveDirectionChangeEvent({vector:t,oldVector:e})}_emitStop(){this.angle=void 0,void 0!==this._movementVector&&(this._emitMoveStopEvent({oldVector:this._movementVector}),this._movementVector=void 0)}_emitMoveStartEvent(t){this.emit("move-start",{...t,type:"move-start"})}_emitMoveDirectionChangeEvent(t){this.emit("move-direction-change",{...t,type:"move-direction-change"})}_emitMoveStopEvent(t){this.emit("move-stop",{...t,type:"move-stop"})}};t([o()],d.prototype,"_initialAngle",void 0),t([o()],d.prototype,"_movementVector",void 0),t([o()],d.prototype,"_widgetCenter",void 0),t([o()],d.prototype,"_anyAngleMovementEnabled",void 0),t([o()],d.prototype,"_movementTimeout",void 0),t([o()],d.prototype,"_disabled",void 0),t([o()],d.prototype,"_moveOnceDuration",void 0),t([o()],d.prototype,"disabled",null),t([o()],d.prototype,"angle",void 0),t([o({type:Number,range:{min:0,max:100}})],d.prototype,"speed",void 0),t([o()],d.prototype,"rotation",null),t([o()],d.prototype,"supported",null),t([o({readOnly:!0})],d.prototype,"state",null),t([o()],d.prototype,"view",void 0),d=t([i("esri.widgets.DirectionalPad.DirectionalPadViewModel")],d);const h=d;export{h as default};
5
+ import{_ as t}from"../../chunks/tslib.es6.js";import e from"../../core/Evented.js";import{property as o}from"../../core/accessorSupport/decorators/property.js";import{subclass as i}from"../../core/accessorSupport/decorators/subclass.js";import{directionalPadMoveOnceDuration as s}from"./constants.js";import{css as n}from"./css.js";import{angleToUnitVector as r,toUnitVector as v,vectorToClosestAngle as m}from"./utils.js";import{GoToMixin as a}from"../support/GoTo.js";let d=class extends(a(e.EventedAccessor)){constructor(t){super(t),this._initialAngle=void 0,this._movementVector=void 0,this._widgetCenter=void 0,this._anyAngleMovementEnabled=!1,this._movementTimeout=void 0,this._disabled=!1,this._moveOnceDuration=s,this.angle=void 0,this.speed=1,this.beginFollowingPointer=(t,e)=>{if(this.disabled)return;this._widgetCenter=e;const o=this._pointerLocationToVector(t);if(void 0===o)return;const i=this._resolveClosestAngle(t,o);void 0!==i&&(this._emitMove(r(i)),this.angle=i,this._initialAngle=i,this._setMovementTimeout((()=>{void 0===this._widgetCenter&&this._stopMovement()})),document.addEventListener("pointermove",this._onPointerMove,{passive:!0}),document.addEventListener("pointerup",this._onPointerUp,{passive:!0,once:!0}))},this.moveOnce=t=>{const e=r(t);this._emitMove(e),this._setMovementTimeout(this._stopMovement)},this._pointerLocationToVector=t=>{if(void 0===this._widgetCenter)return;const{x:e,y:o}=v(this._widgetCenter,t);return{x:e,y:-o}},this._resolveClosestAngle=(t,e)=>{const o=t.target,i=o?.getAttribute?.("data-angle"),s=o?.classList?.contains(n.compassButton);if(s)return;const r=Number.parseInt(i??"",10);return Number.isNaN(r)?m(e):r},this._onPointerMove=t=>{if(0===t.buttons)return void this._stopMovement();const e=this._pointerLocationToVector(t);if(void 0===e)return;this._setMovementTimeout(void 0);const o=this._resolveClosestAngle(t,e);if(void 0===o)return void this._emitStop();const i=r(o),s=null!=this._initialAngle&&this._initialAngle!==o;this._anyAngleMovementEnabled||=s;const n=this._anyAngleMovementEnabled?e:i;(n.x!==this._movementVector?.x||n.y!==this._movementVector?.y)&&(this.angle=o,this._emitMove(n))},this._onPointerUp=()=>{void 0===this._movementTimeout?this._stopMovement():this._widgetCenter=void 0},this._stopMovement=()=>{this._emitStop(),this._widgetCenter=void 0,this._initialAngle=void 0,this._anyAngleMovementEnabled=!1,document.removeEventListener("pointermove",this._onPointerMove),document.removeEventListener("pointerup",this._stopMovement),this._setMovementTimeout(void 0)},this.on("move-start",(()=>this.view?.mapViewNavigation.begin())),this.on("move-direction-change",(({vector:{x:t,y:e}})=>this.view?.mapViewNavigation.continuousPanVector({x:t*this.speed,y:e*this.speed}))),this.on("move-stop",(()=>this.view?.mapViewNavigation.stop()))}destroy(){this._stopMovement()}get disabled(){const{view:t,_disabled:e,supported:o}=this;return!1===t?.ready||e||!o}set disabled(t){this._disabled=t}get rotation(){return this.view?.rotation??this._get("rotation")??0}set rotation(t){this.view?this.view.constraints.rotationEnabled&&this.callGoTo({target:{rotation:t},options:{animate:0===t&&void 0}}):this._set("rotation",t)}get supported(){return null==this.view||"2d"===this.view.type}get state(){const{disabled:t,angle:e}=this;return t?"disabled":null!=e?"moving":"ready"}_setMovementTimeout(t){clearTimeout(this._movementTimeout),this._movementTimeout=void 0===t?void 0:setTimeout((()=>{this._movementTimeout=void 0,t()}),this._moveOnceDuration)}_emitMove(t){null==this._movementVector&&this._emitMoveStartEvent({vector:t});const e=this._movementVector;this._movementVector=t,this._emitMoveDirectionChangeEvent({vector:t,oldVector:e})}_emitStop(){this.angle=void 0,void 0!==this._movementVector&&(this._emitMoveStopEvent({oldVector:this._movementVector}),this._movementVector=void 0)}_emitMoveStartEvent(t){this.emit("move-start",{...t,type:"move-start"})}_emitMoveDirectionChangeEvent(t){this.emit("move-direction-change",{...t,type:"move-direction-change"})}_emitMoveStopEvent(t){this.emit("move-stop",{...t,type:"move-stop"})}};t([o()],d.prototype,"_initialAngle",void 0),t([o()],d.prototype,"_movementVector",void 0),t([o()],d.prototype,"_widgetCenter",void 0),t([o()],d.prototype,"_anyAngleMovementEnabled",void 0),t([o()],d.prototype,"_movementTimeout",void 0),t([o()],d.prototype,"_disabled",void 0),t([o()],d.prototype,"_moveOnceDuration",void 0),t([o()],d.prototype,"disabled",null),t([o()],d.prototype,"angle",void 0),t([o({type:Number,range:{min:0,max:100}})],d.prototype,"speed",void 0),t([o()],d.prototype,"rotation",null),t([o()],d.prototype,"supported",null),t([o({readOnly:!0})],d.prototype,"state",null),t([o()],d.prototype,"view",void 0),d=t([i("esri.widgets.DirectionalPad.DirectionalPadViewModel")],d);const h=d;export{h as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import r from"../../../core/Accessor.js";import{equals as s,isSome as i}from"../../../core/arrayUtils.js";import o from"../../../core/Collection.js";import a from"../../../core/Error.js";import{clone as n}from"../../../core/lang.js";import u from"../../../core/Logger.js";import{watch as l,when as p}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import c from"../../../rest/support/AttachmentQuery.js";import y from"../../../rest/support/RelationshipQuery.js";import{isIFeatureTableSupportedLayerWithAttachments as _,isIFeatureTableSupportedLayerWithEditing as m,isIFeatureTableSupportedLayerWithRelationships as f}from"./tableUtils.js";let g=class extends r{constructor(e){super(e),this._editOperationQueue=new o,this._hasStaleCache=!1,this._loaded=!1,this._loadError=!1,this._loading=!1,this._objectIdCache=new o,this._queryOperationQueue=new o,this.attachmentsEnabled=!1,this.count=0,this.failures=new o,this.filterGeometry=null,this.itemCache=new o,this.layer=null,this.objectIds=null,this.relationshipConfig=null,this.relatedRecordsEnabled=!1,this.returnGeometry=!1,this.timeExtent=null,this.where=null}initialize(){this.addHandles([l((()=>[this.filterGeometry,this.layer,this.objectIds,this.relationshipConfig,this.returnGeometry,this.timeExtent,this.where]),(()=>this._reset())),p((()=>this.attachmentsEnabled),(()=>this._reset())),p((()=>this.relatedRecordsEnabled),(()=>this._reset()))])}destroy(){this.layer=null,this.itemCache?.destroy(),this.failures?.destroy()}get _capabilities(){const{layer:e}=this;return e?.effectiveCapabilities??e?.capabilities}get _layerWithAttachments(){const{_capabilities:e,attachmentsEnabled:t,layer:r,supportsAttachments:s}=this;if(e&&r&&t&&s)return _(r)?r:null}get _layerWithEditing(){const e=this.layer;return m(e)&&this.supportsEditing?e:null}get _layerWithRelationships(){const e=this.layer;return f(e)&&this.supportsQueryRelated?e:null}get _relatedLayer(){return this.relationshipConfig?.relatedLayer}get _relatedLayerCapabilities(){const{_relatedLayer:e}=this;return e?.effectiveCapabilities??e?.capabilities}get _relatedLayerSupportsCacheHint(){return!!this._relatedLayerCapabilities?.queryRelated?.supportsCacheHint}get _relatedLayerSupportsQuery(){return!!this._relatedLayerCapabilities?.operations.supportsQuery}get _relatedLayerSupportsQueryRelated(){const{_relatedLayerCapabilities:e}=this;return!!e?.queryRelated?.supportsCount&&!!e?.queryRelated?.supportsPagination}get _canUseRelatedLayer(){return!(!this._relatedLayerSupportsQuery||!this._relatedLayerSupportsQueryRelated)}get canAddRelatedFeature(){const{state:e,relationship:t,supportsAdd:r,supportsEditing:s}=this;if("loaded"!==e||!t||!r||!s)return!1;const{count:i}=this,{cardinality:o,role:a}=t,n=i>0;return("one-to-one"!==o||!n)&&("one-to-many"!==o||"origin"!==a||!n)}get effectiveTimeExtent(){const{layer:e,timeExtent:t}=this;return t||e&&"timeExtent"in e&&e.timeExtent||null}get effectiveWhere(){return this.where||this.layer?.definitionExpression||"1=1"}get orderByFields(){return this._get("orderByFields")||[]}set orderByFields(e){const t=this.orderByFields;s(e,t)||(this.itemCache.removeAll(),this._hasStaleCache=!0,this._set("orderByFields",e))}get querying(){return this._queryOperationQueue.length>0}get relationship(){const{relationshipConfig:e}=this;return null==e?.relationshipId?null:this.relationships?.find((t=>t.id===e.relationshipId))}get relationshipIds(){return this.relationships?.map((e=>e.id))??[]}get relationships(){return this._layerWithRelationships?.relationships}get state(){const{layer:e,_loaded:t,_loadError:r,_loading:s}=this;return!e||e.destroyed?"disabled":r||e.loadError?"error":"loaded"===e.loadStatus&&t?"loaded":s?"loading":"ready"}get supportsAdd(){return!!this._capabilities?.operations.supportsAdd}get supportsAttachments(){const{_capabilities:e}=this;return!(!e?.data?.supportsAttachment||!e?.operations.supportsQueryAttachments)}get supportsCacheHint(){return!!this._capabilities?.query?.supportsCacheHint}get supportsCacheHintQueryRelated(){return!!this._capabilities?.queryRelated?.supportsCacheHint}get supportsDelete(){return!!this._capabilities?.operations.supportsDelete}get supportsEditing(){return!!this._capabilities?.operations.supportsEditing}get supportsOrderBy(){return!!this._capabilities?.query?.supportsOrderBy}get supportsPagination(){return!!this._capabilities?.query?.supportsPagination}get supportsQuery(){return!!this._capabilities?.operations.supportsQuery}get supportsQueryRelated(){const{_capabilities:e}=this;return!!e?.queryRelated?.supportsCount&&!!e?.queryRelated?.supportsPagination}get supportsUpdate(){return!!this._capabilities?.operations.supportsUpdate}get syncing(){return this._editOperationQueue.length>0}async load(){const{layer:e}=this;if(!this._loading&&!this._loaded&&e){this._reset(),this._loading=!0;try{await e.when(),await this._syncLayerInfo(),this._loaded=!0,this._loading=!1}catch(t){throw this._reset(),this._loadError=!0,this._logError("store:load-error","An error occurred."),t}}}async refreshLayerInfo(){return this._syncLayerInfo()}async addItems(e){}async fetchItems(e){const{page:t,pageSize:r}=e,s=t*r,i=s+r,{layer:o,state:a}=this;return o&&"loaded"===a?this._query({layer:o,start:s,num:i,page:t,pageSize:r}):[]}async verifyFeaturesByObjectId(e){const{layer:t,state:r}=this;if(!t||"loaded"!==r)return[];const{objectIdField:s}=t,{features:i}=await this._verifyFeaturesByObjectId(e);return e.map((e=>i.some((t=>{const r=t.getObjectId()??t.attributes[s];return e===r}))))}async query(e){const{state:t}=this;return this.supportsQuery&&"loaded"===t?this._query(e):[]}async removeItemAt(e){}async reset(){this._reset()}async updateItem(e){await this._update(e)}async deleteRowsByObjectId(e){const{_layerWithEditing:t}=this;if(!this.supportsDelete||!t)throw new a("store:delete-error","Delete is not supported.");const r=e.map((e=>this.getItemByObjectId(e)?.feature)).filter(i);return this._queueEditOperation((()=>t.applyEdits({deleteFeatures:r})))}getItemByObjectId(e){const{itemCache:t,layer:r}=this;if(!r)return;const s=r.objectIdField;return t.find((({feature:t})=>!!t&&(t.getObjectId()??t.attributes[s])===e))}getItemIndexByObjectId(e){const{itemCache:t,layer:r}=this;if(!r)return-1;const s=r.objectIdField;return t.findIndex((({feature:t})=>!!t&&(t.getObjectId()??t.attributes[s])===e))}getLocalItemAt(e){return this.itemCache.at(e)}at(e){return Promise.resolve(this.itemCache.at(e))}_reset(){this.itemCache.removeAll(),this.failures.removeAll(),this._editOperationQueue.removeAll(),this._queryOperationQueue.removeAll(),this._hasStaleCache=!1,this._loading=!1,this._loaded=!1,this._loadError=!1,this._set("count",0),this._objectIdCache.removeAll()}_getIdsFromFeatures(e,t){return e.map((e=>e.getObjectId()??e.attributes[t]))}_resultsToFeatureData(e){const{attachments:t,features:r,layer:s,relatedRecords:i}=e,o=s.objectIdField;return r.map((e=>{const{attributes:r}=e,a=e.getObjectId()??r[o],n=[];return e.layer||e.sourceLayer||(e.layer=s,e.sourceLayer=s),i.forEach(((e,t)=>{n.push({relationshipId:t,count:e[a]??0})})),{objectId:a,feature:e,attachments:t[a]??null,relatedRecords:n}}))}async _update(e){const{_layerWithEditing:r}=this;if(!this.supportsUpdate||!r)throw new a("store:update-error","Update is not supported.");const{index:s,name:i,value:o}=e,u=await this.at(s);if(!u?.feature)throw new a("store:update-error","Feature with provided 'objectId' not found.");const{feature:l}=u,p=n(l.attributes);p[i]=o;const d=new t({attributes:p}),h=r.applyEdits({updateFeatures:[d]}).then((e=>{const{updateFeatureResults:t}=e,r=t.find((e=>!!e.error));if(r)throw r.error;return t.length&&(l.attributes=p),e}));return this._queueEditOperation((()=>h))}async _query(e){const{refresh:t}=e;return!0===t?(this.itemCache.removeAll(),this._syncLayerInfo().then((()=>this._queryFeatureData(e)))):(this._hasStaleCache&&(await this._syncObjectIdCache(),this._hasStaleCache=!1),this._queryFeatureData(e))}async _queryFeatureData(e){const{layer:t}=e;return this._queueQueryOperation((async()=>{const r=await this._queryFeatures(e),s=this._getIdsFromFeatures(r,t.objectIdField),i=await this._queryAttachments(s),o=await this._queryRelatedCounts(s);return this._resultsToFeatureData({layer:t,features:r,attachments:i,relatedRecords:o})||[]}))}async _syncLayerInfo(){await this._syncCount(),await this._syncObjectIdCache()}async _syncCount(){await this._queryCount().then((e=>this._set("count",e)))}async _syncObjectIdCache(){if(this.supportsPagination)return;const e=await this._queryForObjectIds();this._objectIdCache.removeAll(),this._objectIdCache.addMany(e)}async _queryCount(){const{_relatedLayerSupportsCacheHint:e,layer:t,relationshipConfig:r,supportsCacheHint:s}=this;if(!t)return 0;if(r&&this._canUseRelatedLayer){const{objectId:t,relatedLayer:s,relationshipId:i}=r;return(await s.queryRelatedFeaturesCount(new y({cacheHint:e,relationshipId:i,objectIds:[t]})))[t]??0}const{effectiveTimeExtent:i,effectiveWhere:o,filterGeometry:a,objectIds:n}=this,u=t.createQuery();return u.geometry=a,u.returnGeometry=!1,u.where=o,u.timeExtent=i,u.objectIds=n,s&&(u.cacheHint=!0),t.queryFeatureCount(u)}async _queryRelatedCounts(e){const{_layerWithRelationships:t,relationshipIds:r,supportsCacheHintQueryRelated:s}=this,i=new Map;return t&&e?.length&&r.length?(await Promise.allSettled(r.map((async r=>{const o=await t.queryRelatedFeaturesCount(new y({cacheHint:s,relationshipId:r,objectIds:e}));i.set(r,o)}))),i):i}_queryForObjectIds(){const{effectiveTimeExtent:e,effectiveWhere:t,filterGeometry:r,layer:s,objectIds:i,orderByFields:o,supportsCacheHint:a,supportsOrderBy:n}=this;if(!s)return Promise.resolve([]);const u=s.createQuery();return u.geometry=r,u.outFields=[s.objectIdField],u.returnGeometry=!1,u.where=t,u.timeExtent=e,u.objectIds=i,n&&(u.orderByFields=o),a&&(u.cacheHint=!0),s.queryObjectIds(u)}async _queryFeatures(e){const{relationshipConfig:t}=this;if(t&&this._canUseRelatedLayer)return this._queryRelatedFeatures(e,t);const{effectiveTimeExtent:r,effectiveWhere:s,filterGeometry:i,objectIds:o,orderByFields:a,returnGeometry:n,supportsCacheHint:u,supportsOrderBy:l,supportsPagination:p}=this,{layer:d,start:h,pageSize:c}=e,y=d.createQuery();y.returnGeometry=n,p?(y.start=h,y.num=c,y.where=s,y.timeExtent=r,y.objectIds=o):y.objectIds=o||this._getObjectIdsForPage(h,c??0),l&&(y.orderByFields=a),i&&(y.geometry=i),u&&(y.cacheHint=!0);return(await d.queryFeatures(y)).features}async _queryRelatedFeatures(e,t){const{orderByFields:r,returnGeometry:s,supportsCacheHint:i}=this,{layer:o,start:a,pageSize:n}=e,{objectId:u,relatedLayer:l,relationshipId:p}=t,d=o.createQuery(),h=new y({cacheHint:i,num:n??0,objectIds:[u],orderByFields:r,outFields:["*"],relationshipId:p,returnGeometry:s,start:a,where:d.where??void 0}),c=await l.queryRelatedFeatures(h);return c[u]?.features||[]}async _verifyFeaturesByObjectId(e){const{layer:t}=this;if(!t||!this.supportsQuery)throw new a("store:query-error","Layer does not support query operation.");const{effectiveTimeExtent:r,effectiveWhere:s,orderByFields:i,supportsCacheHint:o,supportsOrderBy:n}=this,u=t.createQuery();return u.where=s,u.timeExtent=r,u.returnGeometry=!1,u.objectIds=e,u.outFields=[t.objectIdField],n&&(u.orderByFields=i),o&&(u.cacheHint=!0),t.queryFeatures(u)}_getObjectIdsForPage(e,t){const r=this._objectIdCache.toArray();return r.length>=e+t?r.slice(e,e+t):r.slice(e)}_queryAttachments(e){const{_layerWithAttachments:t,effectiveWhere:r}=this;return t?t.queryAttachments(new c({objectIds:e,where:r})):Promise.resolve({})}_syncLocalCache(e){const{layer:t}=this;if(!t)return;const{objectIdField:r}=t,{itemCache:s}=this;e.forEach((e=>{if(e?.feature){const{feature:t}=e,i=t.getObjectId()??t.attributes[r];if(null!=i){const t=this.getItemIndexByObjectId(i);-1===t?s.add(e):s.splice(t,1,e)}}}))}_queueQueryOperation(e){return this._queryOperationQueue.push(e),e().then((t=>this._queryOperationQueue.includes(e)?(this._syncLocalCache(t),t):[])).catch((t=>{this._logError("store:query-error","An error occurred.");const r={error:t,retry:()=>{this.failures.remove(r),this._queueQueryOperation(e)},cancel:()=>this.failures.remove(r)};return this.failures.add(r),[]})).then((t=>(this._queryOperationQueue.remove(e),t)))}_queueEditOperation(e){return this._editOperationQueue.push(e),e().then((t=>(this._editOperationQueue.remove(e),t))).catch((t=>{this._logError("store:edit-error","An error occurred.");const r={error:t,retry:()=>{this.failures.remove(r),this._queueEditOperation(e)},cancel:()=>this.failures.remove(r)};throw this.failures.add(r),this._editOperationQueue.remove(e),t}))}_logError(e,t){u.getLogger(this).error(e,t)}};e([d({readOnly:!0})],g.prototype,"_capabilities",null),e([d()],g.prototype,"_editOperationQueue",void 0),e([d()],g.prototype,"_hasStaleCache",void 0),e([d({readOnly:!0})],g.prototype,"_layerWithAttachments",null),e([d({readOnly:!0})],g.prototype,"_layerWithEditing",null),e([d({readOnly:!0})],g.prototype,"_layerWithRelationships",null),e([d()],g.prototype,"_loaded",void 0),e([d()],g.prototype,"_loadError",void 0),e([d()],g.prototype,"_loading",void 0),e([d()],g.prototype,"_objectIdCache",void 0),e([d()],g.prototype,"_queryOperationQueue",void 0),e([d({readOnly:!0})],g.prototype,"_relatedLayer",null),e([d({readOnly:!0})],g.prototype,"_relatedLayerCapabilities",null),e([d({readOnly:!0})],g.prototype,"_relatedLayerSupportsCacheHint",null),e([d()],g.prototype,"_relatedLayerSupportsQuery",null),e([d()],g.prototype,"_relatedLayerSupportsQueryRelated",null),e([d()],g.prototype,"_canUseRelatedLayer",null),e([d()],g.prototype,"attachmentsEnabled",void 0),e([d()],g.prototype,"canAddRelatedFeature",null),e([d({readOnly:!0})],g.prototype,"count",void 0),e([d()],g.prototype,"effectiveTimeExtent",null),e([d()],g.prototype,"effectiveWhere",null),e([d({readOnly:!0})],g.prototype,"failures",void 0),e([d()],g.prototype,"filterGeometry",void 0),e([d({readOnly:!0})],g.prototype,"itemCache",void 0),e([d()],g.prototype,"layer",void 0),e([d()],g.prototype,"objectIds",void 0),e([d()],g.prototype,"orderByFields",null),e([d({readOnly:!0})],g.prototype,"querying",null),e([d()],g.prototype,"relationship",null),e([d()],g.prototype,"relationshipConfig",void 0),e([d()],g.prototype,"relationshipIds",null),e([d()],g.prototype,"relationships",null),e([d()],g.prototype,"relatedRecordsEnabled",void 0),e([d()],g.prototype,"returnGeometry",void 0),e([d({readOnly:!0})],g.prototype,"state",null),e([d()],g.prototype,"supportsAdd",null),e([d()],g.prototype,"supportsAttachments",null),e([d()],g.prototype,"supportsCacheHint",null),e([d()],g.prototype,"supportsCacheHintQueryRelated",null),e([d()],g.prototype,"supportsDelete",null),e([d()],g.prototype,"supportsEditing",null),e([d()],g.prototype,"supportsOrderBy",null),e([d()],g.prototype,"supportsPagination",null),e([d()],g.prototype,"supportsQuery",null),e([d()],g.prototype,"supportsQueryRelated",null),e([d()],g.prototype,"supportsUpdate",null),e([d({readOnly:!0})],g.prototype,"syncing",null),e([d()],g.prototype,"timeExtent",void 0),e([d()],g.prototype,"where",void 0),g=e([h("esri.widgets.FeatureTable.support.FeatureStore")],g);const b=g;export{b as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import r from"../../../core/Accessor.js";import{equals as s,isSome as i}from"../../../core/arrayUtils.js";import o from"../../../core/Collection.js";import a from"../../../core/Error.js";import{clone as n}from"../../../core/lang.js";import u from"../../../core/Logger.js";import{watch as l,when as p}from"../../../core/reactiveUtils.js";import{property as d}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import{subclass as h}from"../../../core/accessorSupport/decorators/subclass.js";import c from"../../../rest/support/AttachmentQuery.js";import y from"../../../rest/support/RelationshipQuery.js";import{isIFeatureTableSupportedLayerWithAttachments as _,isIFeatureTableSupportedLayerWithEditing as m,isIFeatureTableSupportedLayerWithRelationships as f}from"./tableUtils.js";let g=class extends r{constructor(e){super(e),this._editOperationQueue=new o,this._hasStaleCache=!1,this._loaded=!1,this._loadError=!1,this._loading=!1,this._objectIdCache=new o,this._queryOperationQueue=new o,this.attachmentsEnabled=!1,this.count=0,this.failures=new o,this.filterGeometry=null,this.itemCache=new o,this.layer=null,this.objectIds=null,this.relationshipConfig=null,this.relatedRecordsEnabled=!1,this.returnGeometry=!1,this.timeExtent=null,this.where=null}initialize(){this.addHandles([l((()=>[this.filterGeometry,this.layer,this.objectIds,this.relationshipConfig,this.returnGeometry,this.timeExtent,this.where]),(()=>this._reset())),p((()=>this.attachmentsEnabled),(()=>this._reset())),p((()=>this.relatedRecordsEnabled),(()=>this._reset()))])}destroy(){this.layer=null,this.itemCache?.destroy(),this.failures?.destroy()}get _capabilities(){const{layer:e}=this;return e?.effectiveCapabilities??e?.capabilities}get _layerWithAttachments(){const{_capabilities:e,attachmentsEnabled:t,layer:r,supportsAttachments:s}=this;if(e&&r&&t&&s)return _(r)?r:null}get _layerWithEditing(){const e=this.layer;return m(e)&&this.supportsEditing?e:null}get _layerWithRelationships(){const e=this.layer;return f(e)&&this.supportsQueryRelated?e:null}get _relatedLayer(){return this.relationshipConfig?.relatedLayer}get _relatedLayerCapabilities(){const{_relatedLayer:e}=this;return e?.effectiveCapabilities??e?.capabilities}get _relatedLayerSupportsCacheHint(){return!!this._relatedLayerCapabilities?.queryRelated?.supportsCacheHint}get _relatedLayerSupportsQuery(){return!!this._relatedLayerCapabilities?.operations.supportsQuery}get _relatedLayerSupportsQueryRelated(){const{_relatedLayerCapabilities:e}=this;return!!e?.queryRelated?.supportsCount&&!!e?.queryRelated?.supportsPagination}get _canUseRelatedLayer(){return!(!this._relatedLayerSupportsQuery||!this._relatedLayerSupportsQueryRelated)}get canAddRelatedFeature(){const{state:e,relationship:t,supportsAdd:r,supportsEditing:s}=this;if("loaded"!==e||!t||!r||!s)return!1;const{count:i}=this,{cardinality:o,role:a}=t,n=i>0;return("one-to-one"!==o||!n)&&("one-to-many"!==o||"origin"!==a||!n)}get effectiveTimeExtent(){const{layer:e,timeExtent:t}=this;return t||e&&"timeExtent"in e&&e.timeExtent||null}get effectiveWhere(){return this.where||this.layer?.definitionExpression||"1=1"}get orderByFields(){return this._get("orderByFields")||[]}set orderByFields(e){const t=this.orderByFields;s(e,t)||(this.itemCache.removeAll(),this._hasStaleCache=!0,this._set("orderByFields",e))}get querying(){return this._queryOperationQueue.length>0}get relationship(){const{relationshipConfig:e}=this;return null==e?.relationshipId?null:this.relationships?.find((t=>t.id===e.relationshipId))}get relationshipIds(){return this.relationships?.map((e=>e.id))??[]}get relationships(){return this._layerWithRelationships?.relationships}get state(){const{layer:e,_loaded:t,_loadError:r,_loading:s}=this;return!e||e.destroyed?"disabled":r||e.loadError?"error":"loaded"===e.loadStatus&&t?"loaded":s?"loading":"ready"}get supportsAdd(){return!!this._capabilities?.operations.supportsAdd}get supportsAttachments(){const{_capabilities:e}=this;return!(!e?.data?.supportsAttachment||!e?.operations.supportsQueryAttachments)}get supportsCacheHint(){return!!this._capabilities?.query?.supportsCacheHint}get supportsCacheHintQueryRelated(){return!!this._capabilities?.queryRelated?.supportsCacheHint}get supportsDelete(){return!!this._capabilities?.operations.supportsDelete}get supportsEditing(){return!!this._capabilities?.operations.supportsEditing}get supportsOrderBy(){return!!this._capabilities?.query?.supportsOrderBy}get supportsPagination(){return!!this._capabilities?.query?.supportsPagination}get supportsQuery(){return!!this._capabilities?.operations.supportsQuery}get supportsQueryRelated(){const{_capabilities:e}=this;return!!e?.queryRelated?.supportsCount&&!!e?.queryRelated?.supportsPagination}get supportsUpdate(){return!!this._capabilities?.operations.supportsUpdate}get syncing(){return this._editOperationQueue.length>0}async load(){const{layer:e}=this;if(!this._loading&&!this._loaded&&e){this._reset(),this._loading=!0;try{await e.when(),await this._syncLayerInfo(),this._loaded=!0,this._loading=!1}catch(t){throw this._reset(),this._loadError=!0,this._logError("store:load-error","An error occurred."),t}}}async refreshLayerInfo(){return this._syncLayerInfo()}async addItems(e){}async fetchItems(e){const{page:t,pageSize:r}=e,s=t*r,i=s+r,{layer:o,state:a}=this;return o&&"loaded"===a?this._query({layer:o,start:s,num:i,page:t,pageSize:r}):[]}async verifyFeaturesByObjectId(e){const{layer:t,state:r}=this;if(!t||"loaded"!==r)return[];const{objectIdField:s}=t,{features:i}=await this._verifyFeaturesByObjectId(e);return e.map((e=>i.some((t=>{const r=t.getObjectId()??t.attributes[s];return e===r}))))}async query(e){const{state:t}=this;return this.supportsQuery&&"loaded"===t?this._query(e):[]}async removeItemAt(e){}async reset(){this._reset()}async updateItem(e){await this._update(e)}async deleteRowsByObjectId(e){const{_layerWithEditing:t}=this;if(!this.supportsDelete||!t)throw new a("store:delete-error","Delete is not supported.");const r=e.map((e=>this.getItemByObjectId(e)?.feature)).filter(i);return this._queueEditOperation((()=>t.applyEdits({deleteFeatures:r})))}getItemByObjectId(e){const{itemCache:t,layer:r}=this;if(!r)return;const s=r.objectIdField;return t.find((({feature:t})=>!!t&&(t.getObjectId()??t.attributes[s])===e))}getItemIndexByObjectId(e){const{itemCache:t,layer:r}=this;if(!r)return-1;const s=r.objectIdField;return t.findIndex((({feature:t})=>!!t&&(t.getObjectId()??t.attributes[s])===e))}getLocalItemAt(e){return this.itemCache.at(e)}at(e){return Promise.resolve(this.itemCache.at(e))}_reset(){this.itemCache.removeAll(),this.failures.removeAll(),this._editOperationQueue.removeAll(),this._queryOperationQueue.removeAll(),this._hasStaleCache=!1,this._loading=!1,this._loaded=!1,this._loadError=!1,this._set("count",0),this._objectIdCache.removeAll()}_getIdsFromFeatures(e,t){return e.map((e=>e.getObjectId()??e.attributes[t]))}_resultsToFeatureData(e){const{attachments:t,features:r,layer:s,relatedRecords:i}=e,o=s.objectIdField;return r.map((e=>{const{attributes:r}=e,a=e.getObjectId()??r[o],n=[];return e.layer||e.sourceLayer||(e.layer=s,e.sourceLayer=s),i.forEach(((e,t)=>{n.push({relationshipId:t,count:e[a]??0})})),{objectId:a,feature:e,attachments:t[a]??null,relatedRecords:n}}))}async _update(e){const{_layerWithEditing:r}=this;if(!this.supportsUpdate||!r)throw new a("store:update-error","Update is not supported.");const{index:s,name:i,value:o}=e,u=await this.at(s);if(!u?.feature)throw new a("store:update-error","Feature with provided 'objectId' not found.");const{feature:l}=u,p=n(l.attributes);p[i]=o;const d=new t({attributes:p}),h=r.applyEdits({updateFeatures:[d]}).then((e=>{const{updateFeatureResults:t}=e,r=t.find((e=>!!e.error));if(r)throw r.error;return t.length&&(l.attributes=p),e}));return this._queueEditOperation((()=>h))}async _query(e){const{refresh:t}=e;return!0===t?(this.itemCache.removeAll(),this._syncLayerInfo().then((()=>this._queryFeatureData(e)))):(this._hasStaleCache&&(await this._syncObjectIdCache(),this._hasStaleCache=!1),this._queryFeatureData(e))}async _queryFeatureData(e){const{layer:t}=e;return this._queueQueryOperation((async()=>{const r=await this._queryFeatures(e),s=this._getIdsFromFeatures(r,t.objectIdField),i=await this._queryAttachments(s),o=await this._queryRelatedCounts(s);return this._resultsToFeatureData({layer:t,features:r,attachments:i,relatedRecords:o})||[]}))}async _syncLayerInfo(){await this._syncCount(),await this._syncObjectIdCache()}async _syncCount(){await this._queryCount().then((e=>this._set("count",e)))}async _syncObjectIdCache(){if(this.supportsPagination)return;const e=await this._queryForObjectIds();this._objectIdCache.removeAll(),this._objectIdCache.addMany(e)}async _queryCount(){const{_relatedLayerSupportsCacheHint:e,layer:t,relationshipConfig:r,supportsCacheHint:s}=this;if(!t)return 0;if(r&&this._canUseRelatedLayer){const{objectId:t,relatedLayer:s,relationshipId:i}=r;return(await s.queryRelatedFeaturesCount(new y({cacheHint:e,relationshipId:i,objectIds:[t]})))[t]??0}const{effectiveTimeExtent:i,effectiveWhere:o,filterGeometry:a,objectIds:n}=this,u=t.createQuery();return u.geometry=a,u.returnGeometry=!1,u.where=o,u.timeExtent=i,u.objectIds=n?.length?n:void 0,s&&(u.cacheHint=!0),t.queryFeatureCount(u)}async _queryRelatedCounts(e){const{_layerWithRelationships:t,relationshipIds:r,supportsCacheHintQueryRelated:s}=this,i=new Map;return t&&e?.length&&r.length?(await Promise.allSettled(r.map((async r=>{const o=await t.queryRelatedFeaturesCount(new y({cacheHint:s,relationshipId:r,objectIds:e}));i.set(r,o)}))),i):i}_queryForObjectIds(){const{effectiveTimeExtent:e,effectiveWhere:t,filterGeometry:r,layer:s,objectIds:i,orderByFields:o,supportsCacheHint:a,supportsOrderBy:n}=this;if(!s)return Promise.resolve([]);const u=s.createQuery();return u.geometry=r,u.outFields=[s.objectIdField],u.returnGeometry=!1,u.where=t,u.timeExtent=e,u.objectIds=i?.length?i:void 0,n&&(u.orderByFields=o),a&&(u.cacheHint=!0),s.queryObjectIds(u)}async _queryFeatures(e){const{relationshipConfig:t}=this;if(t&&this._canUseRelatedLayer)return this._queryRelatedFeatures(e,t);const{effectiveTimeExtent:r,effectiveWhere:s,filterGeometry:i,objectIds:o,orderByFields:a,returnGeometry:n,supportsCacheHint:u,supportsOrderBy:l,supportsPagination:p}=this,{layer:d,start:h,pageSize:c}=e,y=o?.length,_=d.createQuery();_.returnGeometry=n,p?(_.start=h,_.num=c,_.where=s,_.timeExtent=r,_.objectIds=y?o:void 0):_.objectIds=y?o:this._getObjectIdsForPage(h,c??0),l&&(_.orderByFields=a),i&&(_.geometry=i),u&&(_.cacheHint=!0);return(await d.queryFeatures(_)).features}async _queryRelatedFeatures(e,t){const{orderByFields:r,returnGeometry:s,supportsCacheHint:i}=this,{layer:o,start:a,pageSize:n}=e,{objectId:u,relatedLayer:l,relationshipId:p}=t,d=o.createQuery(),h=new y({cacheHint:i,num:n??0,objectIds:[u],orderByFields:r,outFields:["*"],relationshipId:p,returnGeometry:s,start:a,where:d.where??void 0}),c=await l.queryRelatedFeatures(h);return c[u]?.features||[]}async _verifyFeaturesByObjectId(e){const{layer:t}=this;if(!t||!this.supportsQuery)throw new a("store:query-error","Layer does not support query operation.");const{effectiveTimeExtent:r,effectiveWhere:s,orderByFields:i,supportsCacheHint:o,supportsOrderBy:n}=this,u=t.createQuery();return u.where=s,u.timeExtent=r,u.returnGeometry=!1,u.objectIds=e.length?e:void 0,u.outFields=[t.objectIdField],n&&(u.orderByFields=i),o&&(u.cacheHint=!0),t.queryFeatures(u)}_getObjectIdsForPage(e,t){const r=this._objectIdCache.toArray();return r.length>=e+t?r.slice(e,e+t):r.slice(e)}_queryAttachments(e){const{_layerWithAttachments:t,effectiveWhere:r}=this;return t?t.queryAttachments(new c({objectIds:e,where:r})):Promise.resolve({})}_syncLocalCache(e){const{layer:t}=this;if(!t)return;const{objectIdField:r}=t,{itemCache:s}=this;e.forEach((e=>{if(e?.feature){const{feature:t}=e,i=t.getObjectId()??t.attributes[r];if(null!=i){const t=this.getItemIndexByObjectId(i);-1===t?s.add(e):s.splice(t,1,e)}}}))}_queueQueryOperation(e){return this._queryOperationQueue.push(e),e().then((t=>this._queryOperationQueue.includes(e)?(this._syncLocalCache(t),t):[])).catch((t=>{this._logError("store:query-error","An error occurred.");const r={error:t,retry:()=>{this.failures.remove(r),this._queueQueryOperation(e)},cancel:()=>this.failures.remove(r)};return this.failures.add(r),[]})).then((t=>(this._queryOperationQueue.remove(e),t)))}_queueEditOperation(e){return this._editOperationQueue.push(e),e().then((t=>(this._editOperationQueue.remove(e),t))).catch((t=>{this._logError("store:edit-error","An error occurred.");const r={error:t,retry:()=>{this.failures.remove(r),this._queueEditOperation(e)},cancel:()=>this.failures.remove(r)};throw this.failures.add(r),this._editOperationQueue.remove(e),t}))}_logError(e,t){u.getLogger(this).error(e,t)}};e([d({readOnly:!0})],g.prototype,"_capabilities",null),e([d()],g.prototype,"_editOperationQueue",void 0),e([d()],g.prototype,"_hasStaleCache",void 0),e([d({readOnly:!0})],g.prototype,"_layerWithAttachments",null),e([d({readOnly:!0})],g.prototype,"_layerWithEditing",null),e([d({readOnly:!0})],g.prototype,"_layerWithRelationships",null),e([d()],g.prototype,"_loaded",void 0),e([d()],g.prototype,"_loadError",void 0),e([d()],g.prototype,"_loading",void 0),e([d()],g.prototype,"_objectIdCache",void 0),e([d()],g.prototype,"_queryOperationQueue",void 0),e([d({readOnly:!0})],g.prototype,"_relatedLayer",null),e([d({readOnly:!0})],g.prototype,"_relatedLayerCapabilities",null),e([d({readOnly:!0})],g.prototype,"_relatedLayerSupportsCacheHint",null),e([d()],g.prototype,"_relatedLayerSupportsQuery",null),e([d()],g.prototype,"_relatedLayerSupportsQueryRelated",null),e([d()],g.prototype,"_canUseRelatedLayer",null),e([d()],g.prototype,"attachmentsEnabled",void 0),e([d()],g.prototype,"canAddRelatedFeature",null),e([d({readOnly:!0})],g.prototype,"count",void 0),e([d()],g.prototype,"effectiveTimeExtent",null),e([d()],g.prototype,"effectiveWhere",null),e([d({readOnly:!0})],g.prototype,"failures",void 0),e([d()],g.prototype,"filterGeometry",void 0),e([d({readOnly:!0})],g.prototype,"itemCache",void 0),e([d()],g.prototype,"layer",void 0),e([d()],g.prototype,"objectIds",void 0),e([d()],g.prototype,"orderByFields",null),e([d({readOnly:!0})],g.prototype,"querying",null),e([d()],g.prototype,"relationship",null),e([d()],g.prototype,"relationshipConfig",void 0),e([d()],g.prototype,"relationshipIds",null),e([d()],g.prototype,"relationships",null),e([d()],g.prototype,"relatedRecordsEnabled",void 0),e([d()],g.prototype,"returnGeometry",void 0),e([d({readOnly:!0})],g.prototype,"state",null),e([d()],g.prototype,"supportsAdd",null),e([d()],g.prototype,"supportsAttachments",null),e([d()],g.prototype,"supportsCacheHint",null),e([d()],g.prototype,"supportsCacheHintQueryRelated",null),e([d()],g.prototype,"supportsDelete",null),e([d()],g.prototype,"supportsEditing",null),e([d()],g.prototype,"supportsOrderBy",null),e([d()],g.prototype,"supportsPagination",null),e([d()],g.prototype,"supportsQuery",null),e([d()],g.prototype,"supportsQueryRelated",null),e([d()],g.prototype,"supportsUpdate",null),e([d({readOnly:!0})],g.prototype,"syncing",null),e([d()],g.prototype,"timeExtent",void 0),e([d()],g.prototype,"where",void 0),g=e([h("esri.widgets.FeatureTable.support.FeatureStore")],g);const b=g;export{b as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import{IdentifiableMixin as t}from"../../core/Identifiable.js";import{destroyMaybe as i}from"../../core/maybe.js";import{watch as s,initial as r}from"../../core/reactiveUtils.js";import{property as n}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import l from"../Widget.js";import{getLegendLayerInfo as d}from"./support/layerListUtils.js";import{isWidget as a}from"../support/widget.js";import{tsx as p}from"../support/jsxFactory.js";const c="legends";let g=class extends(t(l)){constructor(e,t){super(e,t),this._legend=null,this.className=null,this.content=null,this.flowEnabled=!1,this.image=null,this.listItem=null,this.open=!1,this.visible=!0}initialize(){this.addHandles(s((()=>this.content),(e=>this._createLegend(e)),r))}destroy(){this._legend=i(this._legend)}get disabled(){const{listItem:e,_legend:t,content:i}=this;return!e||!(Array.isArray(i)&&i.length>1)&&(!!t&&(!t.activeLayerInfos?.length||!e.visibleAtCurrentScale||!e.visible))}set disabled(e){this._overrideIfSome("disabled",e)}get icon(){const{image:e}=this,t=this._getFirstWidget();return this._get("icon")??(!e&&t?t.icon:null)}set icon(e){this._overrideIfSome("icon",e)}get title(){return this._get("title")||(this._getFirstWidget()?.label??"")}set title(e){this._override("title",e)}render(){return p("div",{class:"esri-list-item-panel"},this._renderContents())}_renderContent(e){const{_legend:t,disabled:i}=this;return!e||i?null:"legend"===e&&t?p("div",{key:"legend-widget"},t.render()):"string"==typeof e?p("div",{innerHTML:e,key:e}):a(e)?p("div",{key:"content-widget"},e.render()):e instanceof HTMLElement?p("div",{afterCreate:this._attachToNode,bind:e,key:"content-element"}):null}_renderContents(){const{content:e}=this;return Array.isArray(e)?e.map((e=>this._renderContent(e))):this._renderContent(e)}_getLegendOptions(){const{listItem:e}=this;if(!e)return{};const{layer:t,view:i}=e;return t&&i&&"subtype-sublayer"!==t.type?{view:i,layerInfos:[d(t)]}:{}}async _createLegend(e){if(!this._hasLegend(e)||this._legend)return;const{default:t}=await import("../Legend.js"),{listItem:i}=this,n=new t(this._getLegendOptions());this._legend=n,this.notifyChange("className"),this.notifyChange("title");const o=s((()=>[i?.view,i?.layer,i?.layer?.source,i?.layer?.parent]),(()=>this._updateLegend(n)),r);this.addHandles(o,c),this.scheduleRender()}_hasLegend(e){const t="legend";return e===t||null!=e&&!!Array.isArray(e)&&e.includes(t)}_attachToNode(e){e.appendChild(this)}_updateLegend(e){e.set(this._getLegendOptions()),this.scheduleRender()}_getWidget(e){return"legend"===e?this._legend:a(e)?e:null}_getFirstWidget(){const{content:e}=this;return Array.isArray(e)?e.map((e=>this._getWidget(e))).find((e=>e)):this._getWidget(e)}};e([n()],g.prototype,"_legend",void 0),e([n()],g.prototype,"className",void 0),e([n()],g.prototype,"content",void 0),e([n()],g.prototype,"disabled",null),e([n()],g.prototype,"flowEnabled",void 0),e([n()],g.prototype,"icon",null),e([n()],g.prototype,"image",void 0),e([n()],g.prototype,"listItem",void 0),e([n()],g.prototype,"open",void 0),e([n()],g.prototype,"title",null),e([n()],g.prototype,"visible",void 0),g=e([o("esri.widgets.LayerList.ListItemPanel")],g);const h=g;export{h as default};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import{IdentifiableMixin as t}from"../../core/Identifiable.js";import{destroyMaybe as i}from"../../core/maybe.js";import{watch as n,initial as r}from"../../core/reactiveUtils.js";import{property as s}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/Logger.js";import"../../core/RandomLCG.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import l from"../Widget.js";import{isSublayer as d}from"./support/layerListUtils.js";import{isWidget as a}from"../support/widget.js";import{tsx as p}from"../support/jsxFactory.js";let g=class extends(t(l)){constructor(e,t){super(e,t),this._legend=null,this.className=null,this.content=null,this.flowEnabled=!1,this.image=null,this.listItem=null,this.open=!1,this.visible=!0}initialize(){this.addHandles([n((()=>this._canCreateLegend),(()=>this._createLegend()),r),n((()=>[this._legend,this._legendOptions]),(()=>this._updateLegend()),r)])}destroy(){this._legend=i(this._legend)}get _canCreateLegend(){const{content:e,listItem:t}=this;if(!t)return!1;const i="legend";return e===i||null!=e&&!!Array.isArray(e)&&e.includes(i)}get _legendOptions(){const{listItem:e,_legendLayerInfo:t}=this,i=e?.view;return t&&i?{view:i,layerInfos:[t]}:{}}get _legendLayerInfo(){const e=this.listItem?.layer;if(!e||"subtype-sublayer"===e.type)return null;const t=d(e)?e:null,i=e?.parent,n=null!=i&&"type"in i&&"map-image"===i.type?t?.source:null,r="";return n&&i?{layer:i,title:r,sublayerIds:[n.mapLayerId]}:{layer:e,title:r}}get disabled(){const{listItem:e,_legend:t,content:i}=this;return!e||!(Array.isArray(i)&&i.length>1)&&(!!t&&(!t.activeLayerInfos?.length||!e.visibleAtCurrentScale||!e.visible))}set disabled(e){this._overrideIfSome("disabled",e)}get icon(){const{image:e}=this,t=this._getFirstWidget();return this._get("icon")??(!e&&t?t.icon:null)}set icon(e){this._overrideIfSome("icon",e)}get title(){return this._get("title")||(this._getFirstWidget()?.label??"")}set title(e){this._override("title",e)}render(){return p("div",{class:"esri-list-item-panel"},this._renderContents())}_renderContent(e){const{_legend:t,disabled:i}=this;return!e||i?null:"legend"===e&&t?p("div",{key:"legend-widget"},t.render()):"string"==typeof e?p("div",{innerHTML:e,key:e}):a(e)?p("div",{key:"content-widget"},e.render()):e instanceof HTMLElement?p("div",{afterCreate:this._attachToNode,bind:e,key:"content-element"}):null}_renderContents(){const{content:e}=this;return Array.isArray(e)?e.map((e=>this._renderContent(e))):this._renderContent(e)}async _createLegend(){if(i(this._legend),this._legend=null,!this._canCreateLegend)return;const{default:e}=await import("../Legend.js"),t=new e(this._legendOptions);this._legend=t}_attachToNode(e){e.appendChild(this)}_updateLegend(){const e=this._legend;e&&e.set(this._legendOptions)}_getWidget(e){return"legend"===e?this._legend:a(e)?e:null}_getFirstWidget(){const{content:e}=this;return Array.isArray(e)?e.map((e=>this._getWidget(e))).find((e=>e)):this._getWidget(e)}};e([s()],g.prototype,"_legend",void 0),e([s()],g.prototype,"_canCreateLegend",null),e([s()],g.prototype,"_legendOptions",null),e([s()],g.prototype,"_legendLayerInfo",null),e([s()],g.prototype,"className",void 0),e([s()],g.prototype,"content",void 0),e([s()],g.prototype,"disabled",null),e([s()],g.prototype,"flowEnabled",void 0),e([s()],g.prototype,"icon",null),e([s()],g.prototype,"image",void 0),e([s()],g.prototype,"listItem",void 0),e([s()],g.prototype,"open",void 0),e([s()],g.prototype,"title",null),e([s()],g.prototype,"visible",void 0),g=e([o("esri.widgets.LayerList.ListItemPanel")],g);const c=g;export{c as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.30/esri/copyright.txt for details.
4
4
  */
5
- const i={hide:"hide",hideChildren:"hide-children"},e=10,n=2;function t({exclusive:i,visible:e,visibilityAppearance:n}){const t="checkbox"===n;return e?i?"circle-f":t?"check-square-f":"view-visible":i?"circle":t?"square":"view-hide"}function r({connectionStatus:i,publishing:e}){return i?"connected"===i?"beacon":"offline":e?"square":"bullet-point"}function l(e){return e?.listMode===i.hideChildren}function u(i){return i?.listMode??void 0}function s(i){if(!i)return"inherited";const e=h(b(i)?i.layer:i);return null!=e?e?"independent":"inherited":"visibilityMode"in i&&null!=i.visibilityMode?i.visibilityMode:"independent"}function a(i){if(i&&(!("type"in i)||"wmts"!==i.type))return"sublayers"in i?"sublayers":"layers"in i?"layers":void 0}function o(i){const e=(i?.layer&&b(i.layer)?i.layer.layer:void 0)??i?.layer;return!!e&&("catalog"!==e.type&&(v(e)??!0))}function c(e){return u(e)!==i.hide}function y(i,e){i?.sort(((i,n)=>{const t="uid"in i?e.indexOf(i.uid):-1,r="uid"in n?e.indexOf(n.uid):-1;return t>r?-1:t<r?1:0}))}function d(i,e){const n=i?.layer;if(!n)return;const t=a(n);if(!t)return;let r;"layers"===t&&"layers"in n?r=n.layers:"sublayers"===t&&"sublayers"in n&&(r=n.sublayers),y(r,e)}function p(i){const e=i?.layer;return e&&"layers"in e?e.layers:null}function f(i){const e=b(i)?i:null,n=i?.parent,t=null!=n&&"type"in n&&"map-image"===n.type?e?.source:null,r="";return t&&n?{layer:n,title:r,sublayerIds:[t.mapLayerId]}:{layer:i,title:r}}function b(i){return null!=i&&"layer"in i&&null!=i.layer}function h(i){const e=m(i);return null!=e&&"supportsSublayerVisibility"in e?e.supportsSublayerVisibility:void 0}function v(i){const e=m(i);return null!=e&&"supportsDynamicLayers"in e?e.supportsDynamicLayers:void 0}function m(i){return i&&"capabilities"in i&&null!=i.capabilities&&"exportMap"in i.capabilities?i.capabilities.exportMap:void 0}function x(i){return i?.["data-item"]}function M(i){return i?.getAttribute("data-layer-type")}function g({children:i,error:e,incompatible:n}){return!!i?.filter((i=>!i.hidden)).length&&!e&&!n}export{l as areChildrenHidden,c as canDisplayLayer,o as canSortSublayers,u as findLayerListMode,s as findLayerVisibilityMode,x as getItem,p as getItemLayers,M as getLayerType,f as getLegendLayerInfo,a as getNormalizedChildLayerProperty,r as getStatusIcon,t as getVisibilityIcon,b as isSublayer,g as listItemHasChildren,n as minDragEnabledItems,e as minFilterItems,d as sortChildLayersToIds,y as sortLayersToIds};
5
+ const i={hide:"hide",hideChildren:"hide-children"},n=10,e=2;function t({exclusive:i,visible:n,visibilityAppearance:e}){const t="checkbox"===e;return n?i?"circle-f":t?"check-square-f":"view-visible":i?"circle":t?"square":"view-hide"}function r({connectionStatus:i,publishing:n}){return i?"connected"===i?"beacon":"offline":n?"square":"bullet-point"}function l(n){return n?.listMode===i.hideChildren}function u(i){return i?.listMode??void 0}function s(i){if(!i)return"inherited";const n=b(p(i)?i.layer:i);return null!=n?n?"independent":"inherited":"visibilityMode"in i&&null!=i.visibilityMode?i.visibilityMode:"independent"}function o(i){if(i&&(!("type"in i)||"wmts"!==i.type))return"sublayers"in i?"sublayers":"layers"in i?"layers":void 0}function a(i){const n=(i?.layer&&p(i.layer)?i.layer.layer:void 0)??i?.layer;return!!n&&("catalog"!==n.type&&(h(n)??!0))}function c(n){return u(n)!==i.hide}function d(i,n){i?.sort(((i,e)=>{const t="uid"in i?n.indexOf(i.uid):-1,r="uid"in e?n.indexOf(e.uid):-1;return t>r?-1:t<r?1:0}))}function y(i,n){const e=i?.layer;if(!e)return;const t=o(e);if(!t)return;let r;"layers"===t&&"layers"in e?r=e.layers:"sublayers"===t&&"sublayers"in e&&(r=e.sublayers),d(r,n)}function f(i){const n=i?.layer;return n&&"layers"in n?n.layers:null}function p(i){return null!=i&&"layer"in i&&null!=i.layer}function b(i){const n=v(i);return null!=n&&"supportsSublayerVisibility"in n?n.supportsSublayerVisibility:void 0}function h(i){const n=v(i);return null!=n&&"supportsDynamicLayers"in n?n.supportsDynamicLayers:void 0}function v(i){return i&&"capabilities"in i&&null!=i.capabilities&&"exportMap"in i.capabilities?i.capabilities.exportMap:void 0}function x(i){return i?.["data-item"]}function M(i){return i?.getAttribute("data-layer-type")}function m({children:i,error:n,incompatible:e}){return!!i?.filter((i=>!i.hidden)).length&&!n&&!e}export{l as areChildrenHidden,c as canDisplayLayer,a as canSortSublayers,u as findLayerListMode,s as findLayerVisibilityMode,x as getItem,f as getItemLayers,M as getLayerType,o as getNormalizedChildLayerProperty,r as getStatusIcon,t as getVisibilityIcon,p as isSublayer,m as listItemHasChildren,e as minDragEnabledItems,n as minFilterItems,y as sortChildLayersToIds,d as sortLayersToIds};