@arcgis/core 4.21.0-next.20210916 → 4.21.0
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.
- package/EULA.pdf +0 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/836e8ed3f37b014670ec.js +1 -0
- package/assets/esri/core/workers/chunks/a1d5d196d14b194636ee.js +1 -0
- package/assets/esri/core/workers/chunks/dd33c0ef52ad555092bd.js +1 -0
- package/assets/esri/core/workers/chunks/ee32a34cce5d2f65d01c.js +1 -0
- package/assets/esri/core/workers/chunks/f57c8fc116d64723c16c.js +1 -0
- package/config.js +1 -1
- package/interfaces.d.ts +47 -123
- package/layers/ImageryTileLayer.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/layers/support/rasterDatasets/BaseRaster.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/FeatureLayerView2D.js +1 -1
- package/views/2d/layers/features/controllers/support/sourceAdapters.js +1 -1
- package/views/2d/layers/features/schemaUtils.js +1 -1
- package/views/2d/layers/features/sources/BaseFeatureSource.js +1 -1
- package/views/2d/layers/features/sources/DataTileSource.js +1 -1
- package/views/2d/layers/imagery/ImageryTileView2D.js +1 -1
- package/views/3d/layers/analysis/LineOfSight/LineOfSightController.js +1 -1
- package/views/3d/layers/i3s/I3SUtil.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/widgets/BasemapLayerList/BasemapLayerListViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Grid.js +1 -1
- package/widgets/ScaleRangeSlider/ScaleRangeSliderViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/05ad927ed6b27c8134b4.js +0 -1
- package/assets/esri/core/workers/chunks/42f1ea5f61521156e044.js +0 -1
- package/assets/esri/core/workers/chunks/5ec6930af98cbccc6a9a.js +0 -1
- package/assets/esri/core/workers/chunks/62f264baf3cbd76ecac6.js +0 -1
- package/assets/esri/core/workers/chunks/d4a77cf8f298d94879d6.js +0 -1
- package/views/2d/layers/features/controllers/support/sources.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.21/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../TimeExtent.js";import s from"../../../../../core/Evented.js";import t from"../../../../../core/has.js";import{isSome as
|
|
5
|
+
import e from"../../../../../TimeExtent.js";import s from"../../../../../core/Evented.js";import t from"../../../../../core/has.js";import{isSome as r}from"../../../../../core/maybe.js";import{createResolver as i,eachAlwaysValues as o,eachAlways as n}from"../../../../../core/promiseUtils.js";import{diff as c,hasDiff as u,hasDiffAny as a}from"../../../../../core/accessorSupport/diffUtils.js";import h from"../../../../../rest/support/Query.js";import{DataTileSubscription as d}from"./DataTileSubscription.js";function l(e,s){const t=new Set;return e&&e.forEach((e=>t.add(e))),s&&s.forEach((e=>t.add(e))),t.has("*")?["*"]:Array.from(t)}class m{constructor(e){this.events=new s,this._resolver=i(),this._didEdit=!1,this._subscriptions=new Map,this._outSR=e.outSR,this._serviceInfo=e.serviceInfo,this._onTileUpdateMessage=e.onMessage}destroy(){}async _onMessage(e){var s;const t=this._subscriptions.get(e.id);if(!t)return;const r={...e,remove:null!=(s=e.remove)?s:[],status:e.status};return this._onTileUpdateMessage(r,t.options)}update(s,r){var i;const o=r.fields.length;r.outFields=l(null==(i=this._schema)?void 0:i.outFields,r.outFields),r.outFields=r.outFields.length>=.75*o?["*"]:r.outFields,r.outFields.sort();const n=c(this._schema,r);if(!n)return;t("esri-2d-update-debug")&&console.debug("Applying Update - Source:",n);const h="orderByFields"in this._serviceInfo&&this._serviceInfo.orderByFields?this._serviceInfo.orderByFields:this._serviceInfo.objectIdField+" ASC",d={returnCentroid:t("esri-2d-query-centroid-enabled")&&"esriGeometryPolygon"===this._serviceInfo.geometryType,returnGeometry:!0,timeReferenceUnknownClient:"stream"!==this._serviceInfo.type&&this._serviceInfo.timeReferenceUnknownClient,outFields:r.outFields,outSpatialReference:this._outSR,orderByFields:[h],where:r.definitionExpression||"1=1",gdbVersion:r.gdbVersion,historicMoment:r.historicMoment,timeExtent:e.fromJSON(r.timeExtent),customParameters:r.customParameters},m=this._schema&&u(n,"outFields");this._schema&&a(n,["timeExtent","definitionExpression","gdbVersion","historicMoment","customParameters"])&&(s.why.mesh.push("Layer filter and/or custom parameters changed"),s.why.source.push("Layer filter and/or custom parameters changed"),s.mesh=!0,s.source=!0,s.queryFilter=!0),m&&(s.why.source.push("Layer required fields changed"),s.source=!0),c(d,this._queryInfo)&&(this._queryInfo=d),this._schema=r,this._resolver.resolve()}whenInitialized(){return this._resolver.promise}async applyUpdate(e){if(e.queryFilter||e.source&&this._didEdit)return this.refresh(),void(this._didEdit=!1);this._subscriptions.forEach((s=>s.applyUpdate(e))),await this.resend()}refresh(){for(const e of this._tiles())this.unsubscribe(e),this.subscribe(e)}subscribe(e){const s=new d(e);this._subscriptions.set(e.id,s)}unsubscribe(e){const s=this.get(e.id);r(s)&&s.abort(),this._subscriptions.delete(e.id)}createQuery(e={}){const s=this._queryInfo.historicMoment?new Date(this._queryInfo.historicMoment):null;return new h({...this._queryInfo,historicMoment:s,...e})}get(e){return this._subscriptions.has(e)?this._subscriptions.get(e):null}async queryLastEditDate(){throw new Error("Service does not support query type")}async query(e){throw new Error("Service does not support query")}*_tiles(){const e=Array.from(this._subscriptions.values());for(const s of e)yield s.tile}async edit(e,s){const t=Array.from(this._subscriptions.values()),r=t.map((({tile:e})=>e));for(const i of t)i.removeIds(s);if(e.length){const t=r.map((s=>{const t=this.createTileQuery(s);return t.objectIds=e,{tile:s,query:t}})).map((async({tile:e,query:s})=>({tile:e,result:await this.query(s),query:s}))),i=(await o(t)).map((async({tile:t,result:r})=>{if(!r.hasFeatures&&!s.length&&!e.length)return;const i=this._subscriptions.get(t.key.id);i&&i.edit(r,e)}));await n(i)}this._didEdit=!0}}export{m as DataTileSource};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.21/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{isSome as r}from"../../../../core/maybe.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/Logger.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{RasterTileContainer as s}from"../../engine/RasterTileContainer.js";import{BaseImageryTileSubView2D as i}from"./BaseImageryTileSubView2D.js";let
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{isSome as r}from"../../../../core/maybe.js";import{property as t}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/Logger.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{RasterTileContainer as s}from"../../engine/RasterTileContainer.js";import{BaseImageryTileSubView2D as i}from"./BaseImageryTileSubView2D.js";let l=class extends i{constructor(){super(...arguments),this.container=null,this.layer=null,this.tileSize=null,this.type="raster",this.useWebGLForProcessing=!0}canUseWebGLForProcessing(){return this.useWebGLForProcessing&&this.layer.symbolizer.canRenderInWebGL&&!("majority"===this.layer.interpolation&&this._canUseMajorityInterpolationOnDataSource())}fetchTile(e,r){return this.layer.fetchTile(e.level,e.row,e.col,r)}async updateTileSource(e,t){const{bandIds:o}=this.layer,s=this._getLayerInterpolation(),i=this.canUseWebGLForProcessing(),{source:l,symbolizerParams:a,globalSymbolizerParams:n,suspended:c,coords:p,resolution:u}=t,{bitmap:d}=e;if([d.x,d.y]=p,d.resolution=u,l&&r(l)&&r(l.pixelBlock)){const e={extent:l.extent,pixelBlock:l.pixelBlock};if(d.rawPixelData=e,i)d.source=l.pixelBlock,d.isRendereredSource=!1;else{const r=await this.layer.applyRenderer(e,"stretch"===(null==n?void 0:n.type)?n:null);d.source=r,d.isRendereredSource=!0}d.symbolizerParameters=i?a:null,i?d.transformGrid||(d.transformGrid=l.transformGrid):d.transformGrid=null}else{const e=this.createEmptyTilePixelBlock();d.source=e,d.symbolizerParameters=i?a:null,d.transformGrid=null}d.bandIds=i?o:null,d.width=this.tileSize[0],d.height=this.tileSize[1],d.interpolation=s,d.suspended=c,d.invalidateTexture()}async updateTileSymbolizerParameters(e,t){const{local:o,global:s}=t,{bandIds:i}=this.layer,l=this._getLayerInterpolation(),a=this.canUseWebGLForProcessing(),{bitmap:n}=e,{rawPixelData:c}=n;!a&&r(c)?(n.source=await this.layer.applyRenderer(c,"stretch"===(null==s?void 0:s.type)?s:null),n.isRendereredSource=!0):(n.isRendereredSource&&r(c)&&(n.source=c.pixelBlock),n.isRendereredSource=!1),n.symbolizerParameters=a?s||o:null,n.bandIds=a?i:null,n.interpolation=l,n.suspended=!1}install(e,r){this.container=new s(r.tileInfoView),this.container.isCustomTilingScheme=r.isCustomTilingScheme,e.addChild(this.container)}uninstall(){this.container.removeAllChildren(),this.container.remove()}_canUseMajorityInterpolationOnDataSource(){const{bandCount:e,attributeTable:r,colormap:t,pixelType:o}=this.layer.rasterInfo;return 1===e&&(null!=r||null!=t||"u8"===o||"s8"===o)}_getLayerInterpolation(){const e=this.layer.renderer.type;if("raster-colormap"===e||"unique-value"===e||"class-breaks"===e)return"nearest";const{interpolation:r}=this.layer,{renderer:t}=this.layer;return"raster-stretch"===t.type&&null!=t.colorRamp?"bilinear"===r||"cubic"===r?"bilinear":"nearest":r}};e([t()],l.prototype,"container",void 0),e([t()],l.prototype,"layer",void 0),e([t()],l.prototype,"tileSize",void 0),e([t()],l.prototype,"type",void 0),e([t()],l.prototype,"useWebGLForProcessing",void 0),l=e([o("esri.views.2d.layers.imagery.ImageryTileView2D")],l);var a=l;export{a 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.21/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../geometry.js";import t from"../../../../../core/Accessor.js";import s from"../../../../../core/Evented.js";import r from"../../../../../core/Handles.js";import{handlesGroup as n,makeHandle as i}from"../../../../../core/handleUtils.js";import{isSome as o,isNone as a,unwrapOr as l,abortMaybe as c,removeMaybe as h,none as p}from"../../../../../core/maybe.js";import{createTask as u,ignoreAbortErrors as g}from"../../../../../core/promiseUtils.js";import{property as d}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/Logger.js";import{subclass as y}from"../../../../../core/accessorSupport/decorators/subclass.js";import{reactionInit as m,reaction as _}from"../../../../../core/accessorSupport/trackingUtils.js";import{g as v,f,n as A,a as b,b as T,j as C,w as O}from"../../../../../chunks/vec3.js";import{a as E,c as w}from"../../../../../chunks/vec3f64.js";import{projectBoundingRect as j}from"../../../../../geometry/projection.js";import{containsPointObject as I,empty as S}from"../../../../../geometry/support/aaBoundingRect.js";import{fromPoints as L,create as P}from"../../../../../geometry/support/ray.js";import{LineOfSightAnalysis as R}from"./LineOfSightAnalysis.js";import{LineOfSightRayIntersector as V}from"./LineOfSightRayIntersector.js";import{LineOfSightResult as D}from"./LineOfSightResult.js";import{getElevationAtPoint as H}from"../../../support/ElevationProvider.js";import{toGraphic as x}from"../../../webgl-engine/lib/intersectorUtilsConversions.js";import{ImmediateTask as N,TaskPriority as k}from"../../../../support/Scheduler.js";import F from"../../../../../geometry/Point.js";let z=class extends(s.EventedMixin(t)){constructor(e){super(e),this._tasks=N,this._handles=new r,this._analysisHandles=new r}initialize(){var e;const t=null==(e=this.view.resourceController)?void 0:e.scheduler;t&&(this._tasks=t.registerTask(k.LINE_OF_SIGHT_TOOL));this._handles.add([this._connectObserver(),this._connectAnalyses(),this._connectTargets()]),this._intersector=new V({view:this.view})}destroy(){this._handles.destroy(),this._analysisHandles.destroy(),this._analyses.removeAll()}get updating(){return this._tasks.updating}get priority(){return this._tasks.priority}set priority(e){this._tasks.priority=e}get _analyses(){return this.layerViewData.analyses}get _observerEngineLocation(){return this.layerViewData.observerEngineLocation}set _observerEngineLocation(e){this.layerViewData.observerEngineLocation=e}get _screenPixelSize(){return this.view.state.camera.computeScreenPixelSizeAt(this._observerEngineLocation)}getLineOfSightComputationDependencies(e){const{inputPoints:t}=e;return{inputPoints:t}}computeAnalysis(e){const{analysis:t}=e,{inputPoints:s,computationResult:r}=t,{observerAdjusted:n,targetAdjusted:i}=s,{start:o,end:a}=r;v(o,n),v(a,i);this._canComputeAnalysis(t)?this._computeAnalysisIntersection(e):this._interpolateAnalysisIntersection(e),t.updateComputationResults()}_adjustStartEndPositions(e){const t=this._screenPixelSize,s=this.view,{inputPoints:r}=e,{observer:n,observerSurfaceNormal:i,target:a,targetSurfaceNormal:l,observerAdjusted:c,targetAdjusted:h}=r,p=U;o(i)?v(p,i):f(p,a,n);const u=t;A(p,p),b(p,p,Math.min(u,1)),T(c,n,p),o(l)?v(p,l):f(p,n,a);const g=s.state.camera.computeScreenPixelSizeAt(a);A(p,p),b(p,p,Math.min(g,1)),T(h,a,p)}_computeAnalysisIntersection({analysis:e,interpolationInfo:t}){const{view:s}=this,{sceneIntersectionHelper:r,renderCoordsHelper:n}=s;if(a(r))return;const i=this._intersector.intersector,{computationResult:l,inputPoints:c}=e,{observer:h,target:p}=c,{start:u,end:g}=l,d=L(u,g,B);r.intersectToolIntersectorRay(d,i);const y=l.intersection,m=U,_=!!i.results.min&&i.results.min.getIntersectionPoint(y);let f=!0;if(_){v(t.originalIntersection,y),v(t.originalObserver,u),v(t.originalTarget,g),n.fromRenderCoords(y,m,s.spatialReference);const e=1-C(g,p)/C(u,p);f=C(h,y)>=e*C(h,p)}const A=new F(m,s.spatialReference);{const{result:t,target:r}=e;o(t)?(t.target=r,t.intersectedGraphic=f?null:x(i.results.min,s),t.intersectedLocation=f?null:A,t.visible=!!_&&f):e.result=new D({target:r,elevationAlignedTargetLocation:e.elevationAlignedTargetLocation,intersectedGraphic:f?null:x(i.results.min,s),intersectedLocation:f?null:A,visible:!!_&&f}),this.emit("result-changed",{target:r,result:e.result})}l.isValid=c.isValid=!0,l.isTargetVisible=f}_interpolateAnalysisIntersection({analysis:e,interpolationInfo:t}){const{computationResult:s,inputPoints:r}=e,{start:n,end:i,intersection:o}=s,{originalIntersection:a,originalObserver:l,originalTarget:c}=t;if(v(o,a),r.isValid){const e=U,t=C(l,a)/C(l,c);O(e,n,l),b(e,e,1-t),T(o,o,e),O(e,i,c),b(e,e,t),T(o,o,e),s.isValid=!0}else e.result=new D,s.isValid=!1,s.isTargetVisible=!1}_canComputeAnalysis(e){const t=this.layerViewData.elevationAlignedObserver,s=this.view.frustum;if(a(t)||a(e.target)||a(s))return!1;const{observerAdjusted:r,targetAdjusted:n}=e.inputPoints,i=s.intersectsPoint(r),o=s.intersectsPoint(n);return i&&o}_onObserverChange(e){if(a(e))return this.layer.targets.removeAll(),void(this.layerViewData.elevationAlignedObserver=null);this.layerViewData.elevationAlignedObserver=this._applyElevationAlignment(e,this.layer.intersection);const t=w();this.view.renderCoordsHelper.toRenderCoords(this.layerViewData.elevationAlignedObserver,t),this._observerEngineLocation=t,this.priority=k.LINE_OF_SIGHT_TOOL_INTERACTIVE}_applyElevationAlignment(e,t){if(e.hasZ&&(a(t)||"Graphic"===t.type))return e;const s=e.clone();return s.z=l(H(this.view.elevationProvider,s),0),s}_onObserverChangeForAnalysis(e){e.inputPoints.isValid=!1}_onObserverEngineForAnalysis(e,t,s){const{inputPoints:r}=e;if(v(r.observer,t),o(s)){const e=this._intersector.updateFromIntersectionResult(s);o(e)&&this.view.renderCoordsHelper.toRenderCoords(e,r.observer),r.observerSurfaceNormal=E(s.normal)}else r.observerSurfaceNormal=null;this._adjustStartEndPositions(e),e.updateInputPoints(),this.priority=k.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onTargetLocationChange(e,t,s){const{inputPoints:r}=e;if(r.isValid=!1,o(t)){if(e.elevationAlignedTargetLocation=this._applyElevationAlignment(t,s),this.view.renderCoordsHelper.toRenderCoords(e.elevationAlignedTargetLocation,r.target),o(s)){const e=this._intersector.updateFromIntersectionResult(s);o(e)&&this.view.renderCoordsHelper.toRenderCoords(e,r.target),r.targetSurfaceNormal=E(s.normal)}else r.targetSurfaceNormal=null;this._adjustStartEndPositions(e),e.updateInputPoints()}this.priority=k.LINE_OF_SIGHT_TOOL_INTERACTIVE}_connectAnalysisToTarget(e){return m((()=>({analysis:e,targetLocation:e.target.location,targetIntersection:e.target.intersection})),(({analysis:e,targetLocation:t,targetIntersection:s})=>{o(t)&&this._onTargetLocationChange(e,t,s)}))}_connectAnalysisToObserver(e){return m((()=>({analysis:e,observer:this.layerViewData.elevationAlignedObserver})),(({analysis:e})=>{this._onObserverChangeForAnalysis(e)}))}_connectAnalysisToObserverEngine(e){return m((()=>({analysis:e,observer:this._observerEngineLocation,observerIntersection:this.layer.intersection})),(({analysis:e,observer:t,observerIntersection:s})=>{this._onObserverEngineForAnalysis(e,t,s)}))}_connectAnalysisToCamera(e){return _((()=>({camera:this.view.state.camera,isDirty:this._isCameraDirty})),(({isDirty:t})=>{e.inputPoints.isValid&&!t||e.updateInputPoints()}))}_connectAnalysisToElevation(e){return this.view.elevationProvider.on("elevation-change",(t=>{if(!this._canComputeAnalysis(e))return;const s=this.layer.observer;G(t.extent,t.spatialReference,s)&&this._onObserverChange(s);const r=e.target;o(r)&&G(t.extent,t.spatialReference,r.location)&&e.onElevationChange()}))}_connectAnalysisForCompute(e){let t=p;const s={analysis:e,interpolationInfo:{originalIntersection:w(),originalObserver:w(),originalTarget:w()}};return n([m((()=>this.getLineOfSightComputationDependencies(e)),(()=>{t=c(t),t=u((async e=>{await g(this._tasks.schedule((()=>this.computeAnalysis(s)),e))}))})),i((()=>t=c(t)))])}_connectAnalysis(e){const t=this._analysisHandles;t.has(e)||t.add([this._connectAnalysisToTarget(e),this._connectAnalysisToObserver(e),this._connectAnalysisToObserverEngine(e),this._connectAnalysisToCamera(e),this._connectAnalysisToElevation(e),this._connectAnalysisForCompute(e)])}_disconnectAnalysis(e){this._analysisHandles.remove(e)}_onAnalysesCollectionChange(e){e.added.forEach((e=>this._connectAnalysis(e))),e.removed.forEach((e=>this._disconnectAnalysis(e)))}_onTargetsChange(e){return this._analyses.removeAll(),e.items.length>0&&e.forEach((e=>this._addTarget(e))),e.on("change",(e=>this._onTargetCollectionChange(e)))}_onTargetCollectionChange(e){e.added.forEach((e=>this._addTarget(e))),e.removed.forEach((e=>this._removeTarget(e)))}_onCursorTargetChange(e,t){o(t)&&this._removeTarget(t),o(e)&&this._addTarget(e)}_addTarget(e){const t=this._analyses;t.some((t=>t.target===e))||t.add(new R({target:e}))}_removeTarget(e){const t=this._analyses,s=t.find((t=>t.target===e));t.remove(s)}_connectObserver(){return n([m((()=>this.layer.observer),(e=>this._onObserverChange(e)))])}_connectAnalyses(){let e=null;return n([m((()=>this._analyses),(t=>{e=h(e),e=t.on("change",(e=>this._onAnalysesCollectionChange(e))),t.forEach((e=>this._connectAnalysis(e)))})),i((()=>e=h(e)))])}_connectTargets(){let e=null;return n([m((()=>this.layer.targets),(t=>{e=h(e),e=this._onTargetsChange(t)})),m((()=>this.layerViewData.cursorTarget),((e,t)=>{this._onCursorTargetChange(e,t)})),i((()=>{e=h(e)}))])}get _isCameraDirty(){const e=this.layerViewData.elevationAlignedObserver,{view:t}=this,{renderCoordsHelper:s}=t;if(a(e)||a(s))return!1;const r=U;s.toRenderCoords(e,r);const n=t.state.camera.computeScreenPixelSizeAt(r);return Math.abs((n-this._screenPixelSize)/this._screenPixelSize)>M}};function G(e,t,s){return!a(s)&&(j(e,t,Z,s.spatialReference),I(Z,s))}e([d({constructOnly:!0})],z.prototype,"layer",void 0),e([d({constructOnly:!0})],z.prototype,"layerViewData",void 0),e([d({constructOnly:!0})],z.prototype,"view",void 0),e([d()],z.prototype,"updating",null),e([d()],z.prototype,"priority",null),e([d()],z.prototype,"_analyses",null),e([d()],z.prototype,"_observerEngineLocation",null),e([d()],z.prototype,"_screenPixelSize",null),e([d()],z.prototype,"_tasks",void 0),e([d()],z.prototype,"_isCameraDirty",null),z=e([y("esri.views.3d.layers.analysis.LineOfSight.LineOfSightController")],z);const M=.1,U=w(),B=P(),Z=S();export{z as LineOfSightController};
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../geometry.js";import t from"../../../../../core/Accessor.js";import s from"../../../../../core/Evented.js";import r from"../../../../../core/Handles.js";import{handlesGroup as n,makeHandle as i}from"../../../../../core/handleUtils.js";import{isSome as o,isNone as a,unwrapOr as l,abortMaybe as c,removeMaybe as h,none as p}from"../../../../../core/maybe.js";import{createTask as g,ignoreAbortErrors as u}from"../../../../../core/promiseUtils.js";import{property as d}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/Logger.js";import{subclass as y}from"../../../../../core/accessorSupport/decorators/subclass.js";import{reactionInit as m,reaction as _}from"../../../../../core/accessorSupport/trackingUtils.js";import{g as v,f,n as A,a as b,b as T,j as C,w as O}from"../../../../../chunks/vec3.js";import{a as E,c as w}from"../../../../../chunks/vec3f64.js";import{projectBoundingRect as j}from"../../../../../geometry/projection.js";import{containsPointObject as I,empty as S}from"../../../../../geometry/support/aaBoundingRect.js";import{fromPoints as L,create as P}from"../../../../../geometry/support/ray.js";import{LineOfSightAnalysis as R}from"./LineOfSightAnalysis.js";import{LineOfSightRayIntersector as V}from"./LineOfSightRayIntersector.js";import{LineOfSightResult as D}from"./LineOfSightResult.js";import{getElevationAtPoint as H}from"../../../support/ElevationProvider.js";import{toGraphic as x}from"../../../webgl-engine/lib/intersectorUtilsConversions.js";import{ImmediateTask as N,TaskPriority as k}from"../../../../support/Scheduler.js";import F from"../../../../../geometry/Point.js";let z=class extends(s.EventedMixin(t)){constructor(e){super(e),this._tasks=N,this._handles=new r,this._analysisHandles=new r}initialize(){var e;const t=null==(e=this.view.resourceController)?void 0:e.scheduler;t&&(this._tasks=t.registerTask(k.LINE_OF_SIGHT_TOOL));this._handles.add([this._connectObserver(),this._connectAnalyses(),this._connectTargets()]),this._intersector=new V({view:this.view})}destroy(){this._handles.destroy(),this._analysisHandles.destroy(),this._analyses.removeAll()}get updating(){return this._tasks.updating}get priority(){return this._tasks.priority}set priority(e){this._tasks.priority=e}get _analyses(){return this.layerViewData.analyses}get _observerEngineLocation(){return this.layerViewData.observerEngineLocation}set _observerEngineLocation(e){this.layerViewData.observerEngineLocation=e}get _screenPixelSize(){return this.view.state.camera.computeScreenPixelSizeAt(this._observerEngineLocation)}getLineOfSightComputationDependencies(e){const{inputPoints:t}=e;return{inputPoints:t}}computeAnalysis(e){const{analysis:t}=e,{inputPoints:s,computationResult:r}=t,{observerAdjusted:n,targetAdjusted:i}=s,{start:o,end:a}=r;v(o,n),v(a,i);this._canComputeAnalysis(t)?this._computeAnalysisIntersection(e):this._interpolateAnalysisIntersection(e),t.updateComputationResults(),this.emit("result-changed",{target:e.analysis.target,result:t.result})}_adjustStartEndPositions(e){const t=this._screenPixelSize,s=this.view,{inputPoints:r}=e,{observer:n,observerSurfaceNormal:i,target:a,targetSurfaceNormal:l,observerAdjusted:c,targetAdjusted:h}=r,p=U;o(i)?v(p,i):f(p,a,n);const g=t;A(p,p),b(p,p,Math.min(g,1)),T(c,n,p),o(l)?v(p,l):f(p,n,a);const u=s.state.camera.computeScreenPixelSizeAt(a);A(p,p),b(p,p,Math.min(u,1)),T(h,a,p)}_computeAnalysisIntersection({analysis:e,interpolationInfo:t}){const{view:s}=this,{sceneIntersectionHelper:r,renderCoordsHelper:n}=s;if(a(r))return;const i=this._intersector.intersector,{computationResult:l,inputPoints:c}=e,{observer:h,target:p}=c,{start:g,end:u}=l,d=L(g,u,B);r.intersectToolIntersectorRay(d,i);const y=l.intersection,m=U,_=!!i.results.min&&i.results.min.getIntersectionPoint(y);let f=!0;if(_){v(t.originalIntersection,y),v(t.originalObserver,g),v(t.originalTarget,u),n.fromRenderCoords(y,m,s.spatialReference);const e=1-C(u,p)/C(g,p);f=C(h,y)>=e*C(h,p)}const A=new F(m,s.spatialReference);{const{result:t,target:r}=e;o(t)?(t.target=r,t.intersectedGraphic=f?null:x(i.results.min,s),t.intersectedLocation=f?null:A,t.visible=!!_&&f):e.result=new D({target:r,elevationAlignedTargetLocation:e.elevationAlignedTargetLocation,intersectedGraphic:f?null:x(i.results.min,s),intersectedLocation:f?null:A,visible:!!_&&f})}l.isValid=c.isValid=!0,l.isTargetVisible=f}_interpolateAnalysisIntersection({analysis:e,interpolationInfo:t}){const{computationResult:s,inputPoints:r}=e,{start:n,end:i,intersection:o}=s,{originalIntersection:a,originalObserver:l,originalTarget:c}=t;if(v(o,a),r.isValid){const e=U,t=C(l,a)/C(l,c);O(e,n,l),b(e,e,1-t),T(o,o,e),O(e,i,c),b(e,e,t),T(o,o,e),s.isValid=!0}else e.result=new D,s.isValid=!1,s.isTargetVisible=!1}_canComputeAnalysis(e){const t=this.layerViewData.elevationAlignedObserver,s=this.view.frustum;if(a(t)||a(e.target)||a(s))return!1;const{observerAdjusted:r,targetAdjusted:n}=e.inputPoints,i=s.intersectsPoint(r),o=s.intersectsPoint(n);return i&&o}_onObserverChange(e){if(a(e))return this.layer.targets.removeAll(),void(this.layerViewData.elevationAlignedObserver=null);this.layerViewData.elevationAlignedObserver=this._applyElevationAlignment(e,this.layer.intersection);const t=w();this.view.renderCoordsHelper.toRenderCoords(this.layerViewData.elevationAlignedObserver,t),this._observerEngineLocation=t,this.priority=k.LINE_OF_SIGHT_TOOL_INTERACTIVE}_applyElevationAlignment(e,t){if(e.hasZ&&(a(t)||"Graphic"===t.type))return e;const s=e.clone();return s.z=l(H(this.view.elevationProvider,s),0),s}_onObserverChangeForAnalysis(e){e.inputPoints.isValid=!1}_onObserverEngineForAnalysis(e,t,s){const{inputPoints:r}=e;if(v(r.observer,t),o(s)){const e=this._intersector.updateFromIntersectionResult(s);o(e)&&this.view.renderCoordsHelper.toRenderCoords(e,r.observer),r.observerSurfaceNormal=E(s.normal)}else r.observerSurfaceNormal=null;this._adjustStartEndPositions(e),e.updateInputPoints(),this.priority=k.LINE_OF_SIGHT_TOOL_INTERACTIVE}_onTargetLocationChange(e,t,s){const{inputPoints:r}=e;if(r.isValid=!1,o(t)){if(e.elevationAlignedTargetLocation=this._applyElevationAlignment(t,s),this.view.renderCoordsHelper.toRenderCoords(e.elevationAlignedTargetLocation,r.target),o(s)){const e=this._intersector.updateFromIntersectionResult(s);o(e)&&this.view.renderCoordsHelper.toRenderCoords(e,r.target),r.targetSurfaceNormal=E(s.normal)}else r.targetSurfaceNormal=null;this._adjustStartEndPositions(e),e.updateInputPoints()}this.priority=k.LINE_OF_SIGHT_TOOL_INTERACTIVE}_connectAnalysisToTarget(e){return m((()=>({analysis:e,targetLocation:e.target.location,targetIntersection:e.target.intersection})),(({analysis:e,targetLocation:t,targetIntersection:s})=>{o(t)&&this._onTargetLocationChange(e,t,s)}))}_connectAnalysisToObserver(e){return m((()=>({analysis:e,observer:this.layerViewData.elevationAlignedObserver})),(({analysis:e})=>{this._onObserverChangeForAnalysis(e)}))}_connectAnalysisToObserverEngine(e){return m((()=>({analysis:e,observer:this._observerEngineLocation,observerIntersection:this.layer.intersection})),(({analysis:e,observer:t,observerIntersection:s})=>{this._onObserverEngineForAnalysis(e,t,s)}))}_connectAnalysisToCamera(e){return _((()=>({camera:this.view.state.camera,isDirty:this._isCameraDirty})),(({isDirty:t})=>{e.inputPoints.isValid&&!t||e.updateInputPoints()}))}_connectAnalysisToElevation(e){return this.view.elevationProvider.on("elevation-change",(t=>{if(!this._canComputeAnalysis(e))return;const s=this.layer.observer;G(t.extent,t.spatialReference,s)&&this._onObserverChange(s);const r=e.target;o(r)&&G(t.extent,t.spatialReference,r.location)&&e.onElevationChange()}))}_connectAnalysisForCompute(e){let t=p;const s={analysis:e,interpolationInfo:{originalIntersection:w(),originalObserver:w(),originalTarget:w()}};return n([m((()=>this.getLineOfSightComputationDependencies(e)),(()=>{t=c(t),t=g((async e=>{await u(this._tasks.schedule((()=>this.computeAnalysis(s)),e))}))})),i((()=>t=c(t)))])}_connectAnalysis(e){const t=this._analysisHandles;t.has(e)||t.add([this._connectAnalysisToTarget(e),this._connectAnalysisToObserver(e),this._connectAnalysisToObserverEngine(e),this._connectAnalysisToCamera(e),this._connectAnalysisToElevation(e),this._connectAnalysisForCompute(e)])}_disconnectAnalysis(e){this._analysisHandles.remove(e)}_onAnalysesCollectionChange(e){e.added.forEach((e=>this._connectAnalysis(e))),e.removed.forEach((e=>this._disconnectAnalysis(e)))}_onTargetsChange(e){return this._analyses.removeAll(),e.items.length>0&&e.forEach((e=>this._addTarget(e))),e.on("change",(e=>this._onTargetCollectionChange(e)))}_onTargetCollectionChange(e){e.added.forEach((e=>this._addTarget(e))),e.removed.forEach((e=>this._removeTarget(e)))}_onCursorTargetChange(e,t){o(t)&&this._removeTarget(t),o(e)&&this._addTarget(e)}_addTarget(e){const t=this._analyses;t.some((t=>t.target===e))||t.add(new R({target:e}))}_removeTarget(e){const t=this._analyses,s=t.find((t=>t.target===e));t.remove(s)}_connectObserver(){return n([m((()=>this.layer.observer),(e=>this._onObserverChange(e)))])}_connectAnalyses(){let e=null;return n([m((()=>this._analyses),(t=>{e=h(e),e=t.on("change",(e=>this._onAnalysesCollectionChange(e))),t.forEach((e=>this._connectAnalysis(e)))})),i((()=>e=h(e)))])}_connectTargets(){let e=null;return n([m((()=>this.layer.targets),(t=>{e=h(e),e=this._onTargetsChange(t)})),m((()=>this.layerViewData.cursorTarget),((e,t)=>{this._onCursorTargetChange(e,t)})),i((()=>{e=h(e)}))])}get _isCameraDirty(){const e=this.layerViewData.elevationAlignedObserver,{view:t}=this,{renderCoordsHelper:s}=t;if(a(e)||a(s))return!1;const r=U;s.toRenderCoords(e,r);const n=t.state.camera.computeScreenPixelSizeAt(r);return Math.abs((n-this._screenPixelSize)/this._screenPixelSize)>M}};function G(e,t,s){return!a(s)&&(j(e,t,Z,s.spatialReference),I(Z,s))}e([d({constructOnly:!0})],z.prototype,"layer",void 0),e([d({constructOnly:!0})],z.prototype,"layerViewData",void 0),e([d({constructOnly:!0})],z.prototype,"view",void 0),e([d()],z.prototype,"updating",null),e([d()],z.prototype,"priority",null),e([d()],z.prototype,"_analyses",null),e([d()],z.prototype,"_observerEngineLocation",null),e([d()],z.prototype,"_screenPixelSize",null),e([d()],z.prototype,"_tasks",void 0),e([d()],z.prototype,"_isCameraDirty",null),z=e([y("esri.views.3d.layers.analysis.LineOfSight.LineOfSightController")],z);const M=.1,U=w(),B=P(),Z=S();export{z as LineOfSightController};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.21/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../request.js";import{binaryIndexOf as t,flatten as r,splitIntoChunks as o}from"../../../../core/arrayUtils.js";import n from"../../../../core/Error.js";import a from"../../../../core/has.js";import{isSome as s,isNone as i}from"../../../../core/maybe.js";import{eachAlways as c}from"../../../../core/promiseUtils.js";import{isInt16Array as l,isInt32Array as f}from"../../../../core/typedArrayUtil.js";import{h as u}from"../../../../chunks/mat3.js";import{c as p}from"../../../../chunks/mat3f64.js";import{b as m}from"../../../../chunks/mat4.js";import{c as h}from"../../../../chunks/mat4f64.js";import{a as d,m as y,c as g}from"../../../../chunks/quat.js";import{b}from"../../../../chunks/quatf32.js";import{s as w,g as S,w as x,q as M,a as v,b as j,m as q}from"../../../../chunks/vec3.js";import{c as R}from"../../../../chunks/vec3f64.js";import{c as k}from"../../../../chunks/vec4f64.js";import{projectBoundingSphere as T,canProjectWithoutEngine as z,projectBuffer as F,computeTranslationToOriginAndRotation as A,projectVectorToVector as W}from"../../../../geometry/projection.js";import{getSphericalPCPF as I,getReferenceEllipsoid as C}from"../../../../geometry/projectionEllipsoid.js";import U from"../../../../geometry/SpatialReference.js";import{create as B}from"../../../../geometry/support/aaBoundingBox.js";import{create as K,empty as L,expandPointInPlace as G,intersects as E}from"../../../../geometry/support/aaBoundingRect.js";import{isPlateCarree as O}from"../../../../geometry/support/spatialReferenceUtils.js";import P from"../../../../rest/support/Query.js";import{readBinaryAttribute as $}from"./I3SBinaryReader.js";import{computeGlobalTransformation as Q}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as Z,createMaterialFromEdges as D}from"../support/edgeUtils.js";import{parseColorMixMode as H}from"../support/symbolColorUtils.js";import{create as J,compute as N,corners as V}from"../../support/orientedBoundingBox.js";function X(e){return e&&parseInt(e.substring(e.lastIndexOf("/")+1,e.length),10)}function Y(e){if(a("disable-feature:i3s-draco")||!e)return!1;for(const t of e)for(const e of t.geometryBuffers)if("draco"===e.compressedAttributes.encoding)return!0;return!1}function _(e,t,r,o,n,a){n.traverse(r,(r=>{let n=r.mbs;t!==o&&(n=ne,T(r.mbs,o,n,t));const s=ae(e,n);return 0!==s&&(a(r,s),!0)}))}function ee(e,t,r){let o=0,n=0;for(let a=0;a<t.length&&o<e.length;a++)e[o]===t[a]&&(r(a)&&(e[n]=e[o],n++),o++);e.length=n}function te(e,r,o){let n=0,a=0;for(;n<o.length;){t(e,o[n])>=0===r&&(o[a]=o[n],a++),n++}o.length=a}const re=B();function oe(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return re[0]=(e[0]-t.position[0])/t.rotationScale[0],re[1]=(e[1]-t.position[1])/t.rotationScale[4],re[2]=(e[2]-t.position[2])/t.rotationScale[8],re[3]=(e[3]-t.position[0])/t.rotationScale[0],re[4]=(e[4]-t.position[1])/t.rotationScale[4],re[5]=(e[5]-t.position[2])/t.rotationScale[8],re}const ne=k();function ae(e,t){const r=t[0],o=t[1],n=t[3],a=e[0]-r,s=r-e[2],i=e[1]-o,c=o-e[3],l=Math.max(a,s,0),f=Math.max(i,c,0),u=l*l+f*f;if(u>n*n)return 0;if(u>0)return 1;return-Math.max(a,s,i,c)>n?3:2}function se(e,t){const r=t[0],o=t[1],n=t[2],a=t[3],s=e[0]-r,i=r-e[3],c=e[1]-o,l=o-e[4],f=e[2]-n,u=n-e[5],p=Math.max(s,i,0),m=Math.max(c,l,0),h=Math.max(f,u,0),d=p*p+m*m+h*h;if(d>a*a)return 0;if(d>0)return 1;return-Math.max(s,i,c,l,f,u)>a?3:2}function ie(e,t,r){const o=[],n=r&&r.missingFields,a=r&&r.originalFields;for(const s of e){const e=s.toLowerCase();let r=!1;for(const n of t)if(e===n.name.toLowerCase()){o.push(n.name),r=!0,a&&a.push(s);break}!r&&n&&n.push(s)}return o}async function ce(e,t,o,a,c){if(0===t.length)return[];const l=e.attributeStorageInfo;if(s(e.associatedLayer))try{return await fe(e.associatedLayer,t,o,a)}catch(f){if(e.associatedLayer.loaded)throw f}if(l){const s=le(t,o,c);if(i(s))throw new n("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const f=e.parsedUrl.path,u=await Promise.all(s.map((e=>pe(f,l,e.node,e.indices,a).then((t=>{for(let r=0;r<e.graphics.length;r++){const o=e.graphics[r],n=t[r];if(o.attributes)for(const e in o.attributes)e in n||(n[e]=o.attributes[e]);o.attributes=n}return e.graphics})))));return r(u)}throw new n("scenelayer:no-attribute-source","This scene layer does not have a source for attributes available")}function le(e,t,r){const o=new Map,n=[],a=r();for(const s of e){const e=s.attributes[t];for(let t=0;t<a.length;t++){const r=a[t],i=r.featureIds.indexOf(e);if(i>=0){let e=o.get(r.node);e||(e={node:r.node,indices:[],graphics:[]},n.push(e),o.set(r.node,e)),e.indices.push(i),e.graphics.push(s);for(let r=t;r>0;r--)a[r]=a[r-1];a[0]=r;break}}}return n}async function fe(e,t,r,o){t.sort(((e,t)=>e.attributes[r]-t.attributes[r]));const n=t.map((e=>e.attributes[r])),a=[],s=ie(o,e.fields,{originalFields:a}),i=await ue(e,n,s);for(let c=0;c<t.length;c++){const e=t[c],r=i[c],o={};if(e.attributes)for(const t in e.attributes)o[t]=e.attributes[t];for(let t=0;t<a.length;t++)o[a[t]]=r[s[t]];e.attributes=o}return t}function ue(e,t,a){const s=e.capabilities.query.maxRecordCount;if(null!=s&&t.length>s){const n=o(t,s);return Promise.all(n.map((t=>ue(e,t,a)))).then(r)}const i=new P({objectIds:t,outFields:a,orderByFields:[e.objectIdField]});return e.queryFeatures(i).then((e=>{if(e&&e.features&&e.features.length===t.length)return e.features.map((e=>e.attributes));throw new n("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")}))}function pe(t,r,o,n,a){const s=[];for(const e of r)if(e&&-1!==a.indexOf(e.name)){const r=`${t}/nodes/${o.resources.attributes}/attributes/${e.key}/0`;s.push({url:r,storageInfo:e})}return c(s.map((t=>e(t.url,{responseType:"array-buffer"}).then((e=>$(t.storageInfo,e.data)))))).then((e=>{const t=[];for(const r of n){const o={};for(let t=0;t<e.length;t++)null!=e[t].value&&(o[s[t].storageInfo.name]=de(e[t].value,r));t.push(o)}return t}))}const me=-32768,he=-(2**31);function de(e,t){if(!e)return null;const r=e[t];if(l(e))return r===me?null:r;if(f(e))return r===he?null:r;return r!=r?null:r}function ye(e){const t=e.store.indexCRS||e.store.geographicCRS,r=void 0===t?e.store.indexWKT:void 0;if(r){if(!e.spatialReference)throw new n("layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference","Found indeWKT in the scene layer store but no layer spatial reference",{});if(r!==e.spatialReference.wkt)throw new n("layerview:store-spatial-reference-wkt-index-incompatible","The indeWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const o=t?new U(X(t)):e.spatialReference;return o.equals(e.spatialReference)?e.spatialReference:o}function ge(e){const t=e.store.vertexCRS||e.store.projectedCRS,r=void 0===t?e.store.vertexWKT:void 0;if(r){if(!e.spatialReference)throw new n("layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference","Found vertexWKT in the scene layer store but no layer spatial reference",{});if(r!==e.spatialReference.wkt)throw new n("layerview:store-spatial-reference-wkt-vertex-incompatible","The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const o=t?new U(X(t)):e.spatialReference;return o.equals(e.spatialReference)?e.spatialReference:o}function be(e,t){return i(t)?"@null":t===I(t)?"@ECEF":e.equals(t)?"":null!=t.wkid?"@"+t.wkid:null}function we(e,t,r){if(!z(e,t))throw new n("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});if("local"===r&&!Se(e,t))throw new n("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{})}function Se(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator}function xe(e,t,r){const o=ye(e),n=ge(e);we(o,t,r),we(n,t,r)}function Me(e){return(null==e.geometryType||"triangles"===e.geometryType)&&((null==e.topology||"PerAttributeArray"===e.topology)&&(null!=e.vertexAttributes&&null!=e.vertexAttributes.position))}function ve(e){if(null==e.store||null==e.store.defaultGeometrySchema||!Me(e.store.defaultGeometrySchema))throw new n("scenelayer:unsupported-geometry-schema","The geometry schema of this scene layer is not supported.",{url:e.parsedUrl.path})}function je(e,t){xe(e,t.spatialReference,t.viewingMode)}function qe(e){return null!=e.geometryType&&"points"===e.geometryType&&((null==e.topology||"PerAttributeArray"===e.topology)&&((null==e.encoding||""===e.encoding||"lepcc-xyz"===e.encoding)&&(null!=e.vertexAttributes&&null!=e.vertexAttributes.position)))}function Re(e){if(null==e.store||null==e.store.defaultGeometrySchema||!qe(e.store.defaultGeometrySchema))throw new n("pointcloud:unsupported-geometry-schema","The geometry schema of this point cloud scene layer is not supported.",{})}function ke(e,t){we(e.spatialReference,t.spatialReference,t.viewingMode)}function Te(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type}function ze(e){return"mesh-3d"===e.type}function Fe(e){if(null==e||!Te(e))return!0;if(("unique-value"===e.type||"class-breaks"===e.type)&&null==e.defaultSymbol)return!0;const t=e.getSymbols();if(0===t.length)return!0;for(const r of t){if(!ze(r)||0===r.symbolLayers.length)return!0;for(const e of r.symbolLayers.items)if("fill"!==e.type||i(e.material)||i(e.material.color)||"replace"!==e.material.colorMixMode)return!0}return!1}const Ae=Z({color:[0,0,0,0],opacity:0});class We{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function Ie(e){const t=new We;let r=!1,o=!1;for(const n of e.symbolLayers.items)if("fill"===n.type&&n.enabled){const e=n.material,a=n.edges;if(s(e)&&!r){const o=e.color,a=H(e.colorMixMode);s(o)?t.material={color:[o.r/255,o.g/255,o.b/255],alpha:o.a,colorMixMode:a}:t.material={color:[1,1,1],alpha:1,colorMixMode:1},t.castShadows=n.castShadows,r=!0}s(a)&&!o&&(t.edgeMaterial=D(a,{}),o=!0)}return t.material||(t.material={color:[1,1,1],alpha:1,colorMixMode:1}),t}function Ce(e,t){return(0|e)+(0|t)|0}function Ue(e,t,r,o,n=0){o===I(o)?t.isGeographic?$e(e,r,t,n):Pe(e,r,t,n):t.isWGS84&&(o.isWebMercator||O(o))?Be(t,e,o,r):e===r?(r.center[2]+=n,F(r.center,t,0,r.center,o,0,1)):(w(r.center,e.center[0],e.center[1],e.center[2]+n),F(r.center,t,0,r.center,o,0,1),d(r.quaternion,e.quaternion),S(r.halfSize,e.halfSize))}function Be(e,t,r,o){const n=u(Oe,t.quaternion),a=I(r);F(t.center,e,0,Ee,a,0,1);for(let s=0;s<8;++s){for(let e=0;e<3;++e)Ge[e]=t.halfSize[e]*(0!=(s&1<<e)?-1:1);for(let e=0;e<3;++e){let t=Ee[e];for(let r=0;r<3;++r)t+=Ge[r]*n[3*r+e];Ke[3*s+e]=t}}F(Ke,a,0,Ke,r,0,8),N(Le,o)}const Ke=new Float64Array(24),Le={data:Ke,size:3},Ge=R(),Ee=R(),Oe=p();function Pe(e,t,r,o){V(e,He),w(t.center,e.center[0],e.center[1],e.center[2]+o),A(r,t.center,Ze,I(r)),w(t.center,Ze[12],Ze[13],Ze[14]);const n=2*Math.sqrt(1+Ze[0]+Ze[5]+Ze[10]);De[0]=(Ze[6]-Ze[9])/n,De[1]=(Ze[8]-Ze[2])/n,De[2]=(Ze[1]-Ze[4])/n,De[3]=.25*n,y(t.quaternion,De,e.quaternion),g(De,t.quaternion);let a=0,s=0,i=0;for(const c of He)c[2]+=o,F(c,r,0,c,I(r),0,1),x(Xe,c,t.center),M(Xe,Xe,De),a=Math.max(a,Math.abs(Xe[0])),s=Math.max(s,Math.abs(Xe[1])),i=Math.max(i,Math.abs(Xe[2]));w(t.halfSize,a,s,i)}function $e(e,t,r,o){const n=C(r),a=1+Math.max(0,o)/(n.radius+e.center[2]);w(t.center,e.center[0],e.center[1],e.center[2]+o),F(t.center,r,0,t.center,I(r),0,1),d(t.quaternion,e.quaternion),g(De,e.quaternion),w(Xe,0,0,1),M(Xe,Xe,De),w(Xe,e.halfSize[0]*Math.abs(Xe[0]),e.halfSize[1]*Math.abs(Xe[1]),e.halfSize[2]*Math.abs(Xe[2])),v(Xe,Xe,n.inverseFlattening),j(t.halfSize,e.halfSize,Xe),v(t.halfSize,t.halfSize,a)}function Qe(e,t,r,o,n,a){if(!a||0===a.length||i(t))return null;const c=Q(e.mbs,n,r,t);let l;m(_e,c);const f=()=>{if(!l)if(l=He,L(Ne),s(e.serviceObb)){Ue(e.serviceObb,r,Ve,t,n),V(Ve,l);for(const e of l)q(e,e,_e),G(Ne,e)}else{const o=e.mbs,a=o[3];W(o,r,Xe,t),q(Xe,Xe,_e),Xe[2]+=n;for(let e=0;e<8;++e){const t=1&e?a:-a,r=2&e?a:-a,o=4&e?a:-a,n=l[e];S(n,[Xe[0]+t,Xe[1]+r,Xe[2]+o]),G(Ne,n)}}};let u=1/0,p=-1/0;const h=e=>{if("replace"!==e.type)return;const r=e.geometry;if(!r.hasZ)return;L(Je);const n=r.spatialReference||o,a=r.rings.reduce(((e,r)=>r.reduce(((e,r)=>(W(r,n,Xe,t),q(Xe,Xe,_e),G(Je,Xe),Math.min(Xe[2],e))),e)),1/0);f(),E(Ne,Je)&&(u=Math.min(u,a),p=Math.max(p,a))};if(a.forEach((e=>h(e))),u===1/0)return null;const d=(e,t,r)=>{q(Xe,r,c),e[t+0]=Xe[0],e[t+1]=Xe[1],e[t+2]=Xe[2],t+=24,r[2]=u,q(Xe,r,c),e[t+0]=Xe[0],e[t+1]=Xe[1],e[t+2]=Xe[2],t+=24,r[2]=p,q(Xe,r,c),e[t+0]=Xe[0],e[t+1]=Xe[1],e[t+2]=Xe[2]};for(let s=0;s<8;++s)d(Ye.data,3*s,l[s]);return N(Ye)}const Ze=h(),De=b(),He=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],Je=K(),Ne=K(),Ve=J(),Xe=[0,0,0],Ye={data:new Array(72),size:3},_e=h();export{We as SymbolInfo,Ce as addWraparound,ke as checkPointCloudLayerCompatibleWithView,Re as checkPointCloudLayerValid,je as checkSceneLayerCompatibleWithView,ve as checkSceneLayerValid,we as checkSpatialReference,xe as checkSpatialReferences,Qe as computeVisibilityObb,Y as containsDraco,X as extractWkid,ee as filterInPlace,ie as findFieldsCaseInsensitive,_ as findIntersectingNodes,be as getCacheKeySuffix,de as getCachedAttributeValue,oe as getClipAABB,ye as getIndexCrs,Ie as getSymbolInfo,ge as getVertexCrs,se as intersectBoundingBoxWithMbs,ae as intersectBoundingRectWithMbs,Se as isSupportedLocalModeProjection,te as objectIdFilter,Fe as rendererNeedsTextures,Ue as transformObb,Ae as transparentEdgeMaterial,ce as whenGraphicAttributes};
|
|
5
|
+
import e from"../../../../request.js";import{binaryIndexOf as t,flatten as r,splitIntoChunks as o}from"../../../../core/arrayUtils.js";import n from"../../../../core/Error.js";import a from"../../../../core/has.js";import{isSome as s,isNone as i}from"../../../../core/maybe.js";import{eachAlways as c}from"../../../../core/promiseUtils.js";import{isInt16Array as l,isInt32Array as f}from"../../../../core/typedArrayUtil.js";import{h as u}from"../../../../chunks/mat3.js";import{c as p}from"../../../../chunks/mat3f64.js";import{b as m}from"../../../../chunks/mat4.js";import{c as h}from"../../../../chunks/mat4f64.js";import{a as d,m as y,c as g}from"../../../../chunks/quat.js";import{b}from"../../../../chunks/quatf32.js";import{s as w,g as S,w as x,q as M,a as v,b as j,m as q}from"../../../../chunks/vec3.js";import{c as R}from"../../../../chunks/vec3f64.js";import{c as k}from"../../../../chunks/vec4f64.js";import{projectBoundingSphere as T,canProjectWithoutEngine as z,projectBuffer as F,computeTranslationToOriginAndRotation as A,projectVectorToVector as W}from"../../../../geometry/projection.js";import{getSphericalPCPF as I,getReferenceEllipsoid as C}from"../../../../geometry/projectionEllipsoid.js";import U from"../../../../geometry/SpatialReference.js";import{create as B}from"../../../../geometry/support/aaBoundingBox.js";import{create as K,empty as L,expandPointInPlace as G,intersects as E}from"../../../../geometry/support/aaBoundingRect.js";import{isPlateCarree as O}from"../../../../geometry/support/spatialReferenceUtils.js";import P from"../../../../rest/support/Query.js";import{readBinaryAttribute as $}from"./I3SBinaryReader.js";import{computeGlobalTransformation as Q}from"./I3SProjectionUtil.js";import{createSolidEdgeMaterial as Z,createMaterialFromEdges as D}from"../support/edgeUtils.js";import{parseColorMixMode as H}from"../support/symbolColorUtils.js";import{create as J,compute as N,corners as V}from"../../support/orientedBoundingBox.js";function X(e){return e&&parseInt(e.substring(e.lastIndexOf("/")+1,e.length),10)}function Y(e){if(a("disable-feature:i3s-draco")||!e)return!1;for(const t of e)for(const e of t.geometryBuffers)if("draco"===e.compressedAttributes.encoding)return!0;return!1}function _(e,t,r,o,n,a){n.traverse(r,(r=>{let n=r.mbs;t!==o&&(n=ne,T(r.mbs,o,n,t));const s=ae(e,n);return 0!==s&&(a(r,s),!0)}))}function ee(e,t,r){let o=0,n=0;for(let a=0;a<t.length&&o<e.length;a++)e[o]===t[a]&&(r(a)&&(e[n]=e[o],n++),o++);e.length=n}function te(e,r,o){let n=0,a=0;for(;n<o.length;){t(e,o[n])>=0===r&&(o[a]=o[n],a++),n++}o.length=a}const re=B();function oe(e,t){if(0===t.rotationScale[1]&&0===t.rotationScale[2]&&0===t.rotationScale[3]&&0===t.rotationScale[5]&&0===t.rotationScale[6]&&0===t.rotationScale[7])return re[0]=(e[0]-t.position[0])/t.rotationScale[0],re[1]=(e[1]-t.position[1])/t.rotationScale[4],re[2]=(e[2]-t.position[2])/t.rotationScale[8],re[3]=(e[3]-t.position[0])/t.rotationScale[0],re[4]=(e[4]-t.position[1])/t.rotationScale[4],re[5]=(e[5]-t.position[2])/t.rotationScale[8],re}const ne=k();function ae(e,t){const r=t[0],o=t[1],n=t[3],a=e[0]-r,s=r-e[2],i=e[1]-o,c=o-e[3],l=Math.max(a,s,0),f=Math.max(i,c,0),u=l*l+f*f;if(u>n*n)return 0;if(u>0)return 1;return-Math.max(a,s,i,c)>n?3:2}function se(e,t){const r=t[0],o=t[1],n=t[2],a=t[3],s=e[0]-r,i=r-e[3],c=e[1]-o,l=o-e[4],f=e[2]-n,u=n-e[5],p=Math.max(s,i,0),m=Math.max(c,l,0),h=Math.max(f,u,0),d=p*p+m*m+h*h;if(d>a*a)return 0;if(d>0)return 1;return-Math.max(s,i,c,l,f,u)>a?3:2}function ie(e,t,r){const o=[],n=r&&r.missingFields,a=r&&r.originalFields;for(const s of e){const e=s.toLowerCase();let r=!1;for(const n of t)if(e===n.name.toLowerCase()){o.push(n.name),r=!0,a&&a.push(s);break}!r&&n&&n.push(s)}return o}async function ce(e,t,o,a,c){if(0===t.length)return[];const l=e.attributeStorageInfo;if(s(e.associatedLayer))try{return await fe(e.associatedLayer,t,o,a)}catch(f){if(e.associatedLayer.loaded)throw f}if(l){const s=le(t,o,c);if(i(s))throw new n("scenelayer:features-not-loaded","Tried to query attributes for unloaded features");const f=e.parsedUrl.path,u=await Promise.all(s.map((e=>pe(f,l,e.node,e.indices,a).then((t=>{for(let r=0;r<e.graphics.length;r++){const o=e.graphics[r],n=t[r];if(o.attributes)for(const e in o.attributes)e in n||(n[e]=o.attributes[e]);o.attributes=n}return e.graphics})))));return r(u)}throw new n("scenelayer:no-attribute-source","This scene layer does not have a source for attributes available")}function le(e,t,r){const o=new Map,n=[],a=r();for(const s of e){const e=s.attributes[t];for(let t=0;t<a.length;t++){const r=a[t],i=r.featureIds.indexOf(e);if(i>=0){let e=o.get(r.node);e||(e={node:r.node,indices:[],graphics:[]},n.push(e),o.set(r.node,e)),e.indices.push(i),e.graphics.push(s);for(let r=t;r>0;r--)a[r]=a[r-1];a[0]=r;break}}}return n}async function fe(e,t,r,o){t.sort(((e,t)=>e.attributes[r]-t.attributes[r]));const n=t.map((e=>e.attributes[r])),a=[],s=ie(o,e.fields,{originalFields:a}),i=await ue(e,n,s);for(let c=0;c<t.length;c++){const e=t[c],r=i[c],o={};if(e.attributes)for(const t in e.attributes)o[t]=e.attributes[t];for(let t=0;t<a.length;t++)o[a[t]]=r[s[t]];e.attributes=o}return t}function ue(e,t,a){const s=e.capabilities.query.maxRecordCount;if(null!=s&&t.length>s){const n=o(t,s);return Promise.all(n.map((t=>ue(e,t,a)))).then(r)}const i=new P({objectIds:t,outFields:a,orderByFields:[e.objectIdField]});return e.queryFeatures(i).then((e=>{if(e&&e.features&&e.features.length===t.length)return e.features.map((e=>e.attributes));throw new n("scenelayer:feature-not-in-associated-layer","Feature not found in associated feature layer")}))}function pe(t,r,o,n,a){const s=[];for(const e of r)if(e&&-1!==a.indexOf(e.name)){const r=`${t}/nodes/${o.resources.attributes}/attributes/${e.key}/0`;s.push({url:r,storageInfo:e})}return c(s.map((t=>e(t.url,{responseType:"array-buffer"}).then((e=>$(t.storageInfo,e.data)))))).then((e=>{const t=[];for(const r of n){const o={};for(let t=0;t<e.length;t++)null!=e[t].value&&(o[s[t].storageInfo.name]=de(e[t].value,r));t.push(o)}return t}))}const me=-32768,he=-(2**31);function de(e,t){if(!e)return null;const r=e[t];if(l(e))return r===me?null:r;if(f(e))return r===he?null:r;return r!=r?null:r}function ye(e){const t=e.store.indexCRS||e.store.geographicCRS,r=void 0===t?e.store.indexWKT:void 0;if(r){if(!e.spatialReference)throw new n("layerview:no-store-spatial-reference-wkt-index-and-no-layer-spatial-reference","Found indeWKT in the scene layer store but no layer spatial reference",{});if(r!==e.spatialReference.wkt)throw new n("layerview:store-spatial-reference-wkt-index-incompatible","The indeWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const o=t?new U(X(t)):e.spatialReference;return o.equals(e.spatialReference)?e.spatialReference:o}function ge(e){const t=e.store.vertexCRS||e.store.projectedCRS,r=void 0===t?e.store.vertexWKT:void 0;if(r){if(!e.spatialReference)throw new n("layerview:no-store-spatial-reference-wkt-vertex-and-no-layer-spatial-reference","Found vertexWKT in the scene layer store but no layer spatial reference",{});if(r!==e.spatialReference.wkt)throw new n("layerview:store-spatial-reference-wkt-vertex-incompatible","The vertexWKT of the scene layer store does not match the WKT of the layer spatial reference",{})}const o=t?new U(X(t)):e.spatialReference;return o.equals(e.spatialReference)?e.spatialReference:o}function be(e,t){return i(t)?"@null":t===I(t)?"@ECEF":e.equals(t)?"":null!=t.wkid?"@"+t.wkid:null}function we(e,t,r){if(!z(e,t))throw new n("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});if("local"===r&&!Se(e,t))throw new n("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{})}function Se(e,t){return e.equals(t)||e.isWGS84&&t.isWebMercator}function xe(e,t,r){const o=ye(e),n=ge(e);we(o,t,r),we(n,t,r)}function Me(e){return(null==e.geometryType||"triangles"===e.geometryType)&&((null==e.topology||"PerAttributeArray"===e.topology)&&(null!=e.vertexAttributes&&null!=e.vertexAttributes.position))}function ve(e){if(null==e.store||null==e.store.defaultGeometrySchema||!Me(e.store.defaultGeometrySchema))throw new n("scenelayer:unsupported-geometry-schema","The geometry schema of this scene layer is not supported.",{url:e.parsedUrl.path})}function je(e,t){xe(e,t.spatialReference,t.viewingMode)}function qe(e){return null!=e.geometryType&&"points"===e.geometryType&&((null==e.topology||"PerAttributeArray"===e.topology)&&((null==e.encoding||""===e.encoding||"lepcc-xyz"===e.encoding)&&(null!=e.vertexAttributes&&null!=e.vertexAttributes.position)))}function Re(e){if(null==e.store||null==e.store.defaultGeometrySchema||!qe(e.store.defaultGeometrySchema))throw new n("pointcloud:unsupported-geometry-schema","The geometry schema of this point cloud scene layer is not supported.",{})}function ke(e,t){we(e.spatialReference,t.spatialReference,t.viewingMode)}function Te(e){return"simple"===e.type||"class-breaks"===e.type||"unique-value"===e.type}function ze(e){return"mesh-3d"===e.type}function Fe(e){if(null==e||!Te(e))return!0;if(("unique-value"===e.type||"class-breaks"===e.type)&&null==e.defaultSymbol)return!0;const t=e.getSymbols();if(0===t.length)return!0;for(const r of t){if(!ze(r)||0===r.symbolLayers.length)return!0;for(const e of r.symbolLayers.items)if("fill"!==e.type||i(e.material)||i(e.material.color)||"replace"!==e.material.colorMixMode)return!0}return!1}const Ae=Z({color:[0,0,0,0],opacity:0});class We{constructor(){this.edgeMaterial=null,this.material=null,this.castShadows=!0}}function Ie(e){const t=new We;let r=!1,o=!1;for(const n of e.symbolLayers.items)if("fill"===n.type&&n.enabled){const e=n.material,a=n.edges;if(s(e)&&!r){const o=e.color,a=H(e.colorMixMode);s(o)?t.material={color:[o.r/255,o.g/255,o.b/255],alpha:o.a,colorMixMode:a}:t.material={color:[1,1,1],alpha:1,colorMixMode:1},t.castShadows=n.castShadows,r=!0}s(a)&&!o&&(t.edgeMaterial=D(a,{}),o=!0)}return t.material||(t.material={color:[1,1,1],alpha:1,colorMixMode:1}),t}function Ce(e,t){return(0|e)+(0|t)|0}function Ue(e,t,r,o,n=0){o===I(o)?t.isGeographic?$e(e,r,t,n):Pe(e,r,t,n):t.isWGS84&&(o.isWebMercator||O(o))?Be(t,e,o,r,n):e===r?(r.center[2]+=n,F(r.center,t,0,r.center,o,0,1)):(w(r.center,e.center[0],e.center[1],e.center[2]+n),F(r.center,t,0,r.center,o,0,1),d(r.quaternion,e.quaternion),S(r.halfSize,e.halfSize))}function Be(e,t,r,o,n){const a=u(Oe,t.quaternion);S(Ee,t.center),Ee[2]+=n;const s=I(r);F(Ee,e,0,Ee,s,0,1);for(let i=0;i<8;++i){for(let e=0;e<3;++e)Ge[e]=t.halfSize[e]*(0!=(i&1<<e)?-1:1);for(let e=0;e<3;++e){let t=Ee[e];for(let r=0;r<3;++r)t+=Ge[r]*a[3*r+e];Ke[3*i+e]=t}}F(Ke,s,0,Ke,r,0,8),N(Le,o)}const Ke=new Float64Array(24),Le={data:Ke,size:3},Ge=R(),Ee=R(),Oe=p();function Pe(e,t,r,o){V(e,He),w(t.center,e.center[0],e.center[1],e.center[2]+o),A(r,t.center,Ze,I(r)),w(t.center,Ze[12],Ze[13],Ze[14]);const n=2*Math.sqrt(1+Ze[0]+Ze[5]+Ze[10]);De[0]=(Ze[6]-Ze[9])/n,De[1]=(Ze[8]-Ze[2])/n,De[2]=(Ze[1]-Ze[4])/n,De[3]=.25*n,y(t.quaternion,De,e.quaternion),g(De,t.quaternion);let a=0,s=0,i=0;for(const c of He)c[2]+=o,F(c,r,0,c,I(r),0,1),x(Xe,c,t.center),M(Xe,Xe,De),a=Math.max(a,Math.abs(Xe[0])),s=Math.max(s,Math.abs(Xe[1])),i=Math.max(i,Math.abs(Xe[2]));w(t.halfSize,a,s,i)}function $e(e,t,r,o){const n=C(r),a=1+Math.max(0,o)/(n.radius+e.center[2]);w(t.center,e.center[0],e.center[1],e.center[2]+o),F(t.center,r,0,t.center,I(r),0,1),d(t.quaternion,e.quaternion),g(De,e.quaternion),w(Xe,0,0,1),M(Xe,Xe,De),w(Xe,e.halfSize[0]*Math.abs(Xe[0]),e.halfSize[1]*Math.abs(Xe[1]),e.halfSize[2]*Math.abs(Xe[2])),v(Xe,Xe,n.inverseFlattening),j(t.halfSize,e.halfSize,Xe),v(t.halfSize,t.halfSize,a)}function Qe(e,t,r,o,n,a){if(!a||0===a.length||i(t))return null;const c=Q(e.mbs,n,r,t);let l;m(_e,c);const f=()=>{if(!l)if(l=He,L(Ne),s(e.serviceObb)){Ue(e.serviceObb,r,Ve,t,n),V(Ve,l);for(const e of l)q(e,e,_e),G(Ne,e)}else{const o=e.mbs,a=o[3];W(o,r,Xe,t),q(Xe,Xe,_e),Xe[2]+=n;for(let e=0;e<8;++e){const t=1&e?a:-a,r=2&e?a:-a,o=4&e?a:-a,n=l[e];S(n,[Xe[0]+t,Xe[1]+r,Xe[2]+o]),G(Ne,n)}}};let u=1/0,p=-1/0;const h=e=>{if("replace"!==e.type)return;const r=e.geometry;if(!r.hasZ)return;L(Je);const n=r.spatialReference||o,a=r.rings.reduce(((e,r)=>r.reduce(((e,r)=>(W(r,n,Xe,t),q(Xe,Xe,_e),G(Je,Xe),Math.min(Xe[2],e))),e)),1/0);f(),E(Ne,Je)&&(u=Math.min(u,a),p=Math.max(p,a))};if(a.forEach((e=>h(e))),u===1/0)return null;const d=(e,t,r)=>{q(Xe,r,c),e[t+0]=Xe[0],e[t+1]=Xe[1],e[t+2]=Xe[2],t+=24,r[2]=u,q(Xe,r,c),e[t+0]=Xe[0],e[t+1]=Xe[1],e[t+2]=Xe[2],t+=24,r[2]=p,q(Xe,r,c),e[t+0]=Xe[0],e[t+1]=Xe[1],e[t+2]=Xe[2]};for(let s=0;s<8;++s)d(Ye.data,3*s,l[s]);return N(Ye)}const Ze=h(),De=b(),He=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]],Je=K(),Ne=K(),Ve=J(),Xe=[0,0,0],Ye={data:new Array(72),size:3},_e=h();export{We as SymbolInfo,Ce as addWraparound,ke as checkPointCloudLayerCompatibleWithView,Re as checkPointCloudLayerValid,je as checkSceneLayerCompatibleWithView,ve as checkSceneLayerValid,we as checkSpatialReference,xe as checkSpatialReferences,Qe as computeVisibilityObb,Y as containsDraco,X as extractWkid,ee as filterInPlace,ie as findFieldsCaseInsensitive,_ as findIntersectingNodes,be as getCacheKeySuffix,de as getCachedAttributeValue,oe as getClipAABB,ye as getIndexCrs,Ie as getSymbolInfo,ge as getVertexCrs,se as intersectBoundingBoxWithMbs,ae as intersectBoundingRectWithMbs,Se as isSupportedLocalModeProjection,te as objectIdFilter,Fe as rendererNeedsTextures,Ue as transformObb,Ae as transparentEdgeMaterial,ce as whenGraphicAttributes};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.21/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../Graphic.js";import i from"../../../core/Collection.js";import s from"../../../core/Error.js";import o from"../../../core/Evented.js";import r from"../../../core/Handles.js";import n from"../../../core/Logger.js";import{destroyMaybe as a,isNone as h,isSome as c,abortMaybe as p,get as l}from"../../../core/maybe.js";import{createTask as d}from"../../../core/promiseUtils.js";import{whenOnce as m,pausable as v}from"../../../core/watchUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{geometryToCoordinates as g,getMidpoint as u}from"../../../geometry/support/coordsUtils.js";import x from"../../../layers/GraphicsLayer.js";import f from"../../../symbols/SimpleMarkerSymbol.js";import{SnappingVisualizer2D as G}from"../../2d/interactive/SnappingVisualizer2D.js";import{cloneMove as b}from"./drawUtils.js";import V from"./GraphicMover.js";import{addUniqueLayer as M}from"./layerUtils.js";import{settings as S}from"./settings.js";import{ViewEventPriorities as w}from"../../input/InputManager.js";import{SKETCH_KEYS as k}from"../../interactive/keybindings.js";import{EditGeometryOperations as E}from"../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as I}from"../../interactive/snapping/SnappingContext.js";import O from"../../../geometry/Polyline.js";import C from"../../../geometry/Point.js";class R{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-start"}}class j{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape"}}class H{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-stop"}}class A{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-start"}}class T{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move"}}class U{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-stop"}}class D{constructor(e){this.added=e,this.type="vertex-select"}}class F{constructor(e){this.removed=e,this.type="vertex-deselect"}}class z{constructor(e,t,i,s){this.added=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-add"}}class L{constructor(e,t,i,s){this.removed=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-remove"}}const P=S.reshapeGraphics,K={vertices:{default:new f({style:"circle",size:P.vertex.size,color:P.vertex.color,outline:{color:P.vertex.outlineColor,width:1}}),hover:new f({style:"circle",size:P.vertex.hoverSize,color:P.vertex.hoverColor,outline:{color:P.vertex.hoverOutlineColor,width:1}}),selected:new f({style:"circle",size:P.selected.size,color:P.selected.color,outline:{color:P.selected.outlineColor,width:1}})},midpoints:{default:new f({style:"circle",size:P.midpoint.size,color:P.midpoint.color,outline:{color:P.midpoint.outlineColor,width:1}}),hover:new f({style:"circle",size:P.midpoint.size,color:P.midpoint.color,outline:{color:P.midpoint.outlineColor,width:1}})}},N="esri.views.draw.support.Reshape",q=n.getLogger(N);let B=class extends o.EventedAccessor{constructor(e){super(e),this._activeOperationInfo=null,this._editGeometryOperations=null,this._handles=new r,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._snappingTask=null,this._stagedVertex=null,this._viewHandles=new r,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.enableMidpoints=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.vertexGraphics=new i,this.layer=null,this.midpointGraphics=new i,this.midpointSymbol=new f({style:"circle",size:6,color:[200,200,200],outline:{color:[100,100,100],width:1}}),this.selectedVertices=[],this.snappingManager=null,this.type="reshape",this.view=null}initialize(){this._setup(),this._handles.add([m(this,"view.ready",(()=>{const{layer:e,view:t}=this;M(t,e),this._viewHandles.add([t.on("key-down",(e=>this._keyDownHandler(e)),w.TOOL)])})),v(this,"graphic",(()=>this.refresh())),v(this,"layer",((e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()})),v(this,"enableMidpoints",(()=>{this.refresh()}))])}destroy(){var e;this._reset(),null==(e=this._mover)||e.destroy(),this._mover=null,this._handles=a(this._handles),this._viewHandles=a(this._viewHandles)}get state(){const e=!!this.get("view.ready"),t=!(!this.get("graphic")||!this.get("layer"));return e&&t?"active":e?"ready":"disabled"}set symbols(e){const{midpoints:t=K.midpoints,vertices:i=K.vertices}=e||{};this._set("symbols",{midpoints:t,vertices:i})}isUIGraphic(e){const t=[];return this.graphic&&t.push(this.graphic),t.concat(this.vertexGraphics.items,this.midpointGraphics.items),t.length&&t.includes(e)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_setup(){const{graphic:e,layer:t}=this;if(!t||!e||h(e.geometry))return;const i=e.geometry;"mesh"!==i.type&&"extent"!==i.type?(this._setupGraphics(),this._setupMover()):this._logGeometryTypeError()}_setUpGeometryHelper(){const e=this.graphic.geometry;if(h(e)||"mesh"===e.type||"extent"===e.type)return void this._logGeometryTypeError();const t="multipoint"===e.type?new O({paths:e.points,spatialReference:e.spatialReference}):e;this._editGeometryOperations=E.fromGeometry(t,2)}_saveSnappingContextForHandle(e,t){var i;this._snappingGraphicsLayer=new x({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer),this._snappingContext=new I({editGeometryOperations:this._editGeometryOperations,elevationInfo:{mode:"on-the-ground",offset:0},pointer:(null==(i=t.viewEvent)?void 0:i.pointerType)||"mouse",excludeFeature:this.graphic,visualizer:new G(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._resetGraphics(),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._mover&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_resetSnappingStateVars(){c(this.snappingManager)&&this.snappingManager.doneSnapping(),c(this._snappingGraphicsLayer)&&(this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._editGeometryOperations=a(this._editGeometryOperations),this._snappingTask=p(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(e){this._removeMidpointGraphics(e),this._removeVertexGraphics(e),this._set("selectedVertices",[])}_removeMidpointGraphics(e){const t=e||this.layer;t&&t.removeMany(this.midpointGraphics.items),this.midpointGraphics.items.forEach((e=>e.destroy())),this.midpointGraphics.removeAll()}_removeVertexGraphics(e){const t=e||this.layer;t&&t.removeMany(this.vertexGraphics.items),this.vertexGraphics.items.forEach((e=>e.destroy())),this.vertexGraphics.removeAll()}_getCoordinatesForUI(e){const t=g(e.clone());if("polygon"===e.type)for(const i of t){const e=i[i.length-1];i[0][0]===e[0]&&i[0][1]===e[1]&&i.length>2&&i.pop()}return t}_setupGraphics(){const e=this.graphic.geometry;if(c(e)&&("polyline"===e.type||"polygon"===e.type)){const t=this._getCoordinatesForUI(e);this.enableMidpoints&&this._setUpMidpointGraphics(t),this.enableVertices&&this._setUpVertexGraphics(t)}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();const t=this._createMidpointGraphics(e);this.midpointGraphics.addMany(t),this.layer.addMany(t)}_setUpVertexGraphics(e){this._removeVertexGraphics();const t=this._createVertexGraphics(e);this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}_createVertexGraphics(e){const{_graphicAttributes:i,symbols:s,view:{spatialReference:o}}=this,r=[];return null==e||e.forEach(((e,n)=>{e.forEach(((e,a)=>{var h;const[c,p]=e;r.push(new t({geometry:new C({x:c,y:p,spatialReference:o}),symbol:null==s||null==(h=s.vertices)?void 0:h.default,attributes:{...i,pathIndex:n,pointIndex:a}}))}))})),r}_createMidpointGraphics(e){const{_graphicAttributes:i,symbols:s,view:{spatialReference:o}}=this,r=[];return null==e||e.forEach(((e,n)=>{e.forEach(((a,h)=>{const[c,p]=a,d=e[h+1]?h+1:0;if("polygon"===l(this.graphic.geometry,"type")||0!==d){const[a,l]=e[d],[m,v]=u([c,p],[a,l]);r.push(new t({geometry:new C({x:m,y:v,spatialReference:o}),symbol:s.midpoints.default,attributes:{...i,pathIndex:n,pointIndexStart:h,pointIndexEnd:d}}))}}))})),r}_storeRelatedVertexIndices(){const e=this.vertexGraphics.items;if(!e)return;const t=e.map((({geometry:e})=>({x:e.x,y:e.y})));for(let i=0;i<t.length;i++){const s=[];for(let e=0;e<t.length;e++){if(i===e)continue;const o=t[i],r=t[e];o.x===r.x&&o.y===r.y&&s.push(e)}e[i].attributes.relatedGraphicIndices=s}}_setupMover(){const{enableMovement:e,graphic:t,midpointGraphics:i,vertexGraphics:s,view:o}=this,r=l(t.geometry,"type"),n="point"===r||"multipoint"===r,a=s.concat(i).items;e&&a.push(t),this._mover=new V({enableMoveAllGraphics:!1,indicatorsEnabled:n,graphics:a,view:o,callbacks:{onGraphicClick:e=>this._onGraphicClickCallback(e),onGraphicMoveStart:e=>this._onGraphicMoveStartCallback(e),onGraphicMove:e=>this._onGraphicMoveCallback(e),onGraphicMoveStop:e=>this._onGraphicMoveStopCallback(e),onGraphicPointerOver:e=>this._onGraphicPointerOverCallback(e),onGraphicPointerOut:e=>this._onGraphicPointerOutCallback(e)}})}_onGraphicClickCallback(e){e.viewEvent.stopPropagation();const t=e.graphic;if(t===this.graphic)this.clearSelection(),this.emit("graphic-click",e),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(e);else if(this._isMidpoint(t)){if(2===e.viewEvent.button)return;const i=this.graphic.clone(),s=this._createVertexFromMidpoint(t);this.refresh(),this._emitVertexAddEvent([t],i,s)}else if(this._isVertex(t))if(e.viewEvent.stopPropagation(),2===e.viewEvent.button)this._removeVertices(t);else{e.viewEvent.native.shiftKey||this._clearSelection(),this.selectedVertices.includes(t)?this._removeFromSelection(t,!0):this._addToSelection(t)}}_setUpOperation(e){const{graphic:t,dx:i,dy:s}=e,o=t===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(t,e),this._activeOperationInfo={target:this.graphic,mover:t,operationType:o?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(e){const t=e.graphic,{dx:i,dy:s}=e;if(t===this.graphic)return this._clearSelection(),this._resetGraphics(),this._setUpOperation(e),this._emitMoveStartEvent(i,s),void("point"===this._editGeometryOperations.data.type&&this._onHandleMove(t,i,s,e,(()=>this._emitMoveEvent(i,s))));if(!this.selectedVertices.includes(t)){if(this._clearSelection(),this._isMidpoint(t)){const e=this.graphic.clone(),i=this._createVertexFromMidpoint(t);this._emitVertexAddEvent([t],e,i)}this._addToSelection(t)}this._setUpOperation(e),this._emitReshapeStartEvent(t),this._onHandleMove(t,i,s,e,(()=>this._emitReshapeEvent(t)))}_onGraphicMoveCallback(e){const{graphic:t,dx:i,dy:s}=e;this._activeOperationInfo.totalDx+=i,this._activeOperationInfo.totalDy+=s;const{operationType:o}=this._activeOperationInfo;"move"===o?"point"===this._editGeometryOperations.data.type?this._onHandleMove(t,i,s,e,(()=>this._emitMoveEvent(i,s))):this._emitMoveEvent(i,s):this._onHandleMove(t,i,s,e,(()=>this._emitReshapeEvent(t)))}_onGraphicMoveStopCallback(e){const{graphic:t,dx:i,dy:s}=e;this._activeOperationInfo.totalDx+=i,this._activeOperationInfo.totalDy+=s,t===this.graphic?(this._emitMoveStopEvent(),this.refresh()):(this._onHandleMove(t,i,s,e,(()=>this._emitReshapeStopEvent(t))),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._isMidpoint(t)&&this.refresh())}_updateMidpointGraphicLocations(e){for(const t of this.midpointGraphics){const{pathIndex:i,pointIndexStart:s,pointIndexEnd:o}=t.attributes,[r,n]=e[i][s],[a,h]=e[i][o],[c,p]=u([r,n],[a,h]);t.geometry=new C({x:c,y:p,spatialReference:this.view.spatialReference})}}_getIndicesForVertexGraphic({attributes:e}){return[(null==e?void 0:e.pathIndex)||0,(null==e?void 0:e.pointIndex)||0]}_getVertexFromEditGeometry(e){const[t,i]=this._getIndicesForVertexGraphic(e);return this._editGeometryOperations.data.components[t].vertices[i]}_onHandleMove(e,t,i,s,o){p(this._snappingTask);const r=e.geometry,n="graphic-move-stop"===s.type;if(c(this.snappingManager)&&this.selectedVertices.length<2&&!n){const s=this.snappingManager;this._stagedVertex=s.update(r,this._snappingContext),this._syncGeometryAfterVertexMove(e,new C(this._stagedVertex),t,i,n),o(),this._snappingTask=d((async a=>{const h=await s.snap(r,this._snappingContext,a);h.valid&&(this._stagedVertex=h.apply(),this._syncGeometryAfterVertexMove(e,new C(this._stagedVertex),t,i,n),o())}))}else{const s=c(this._stagedVertex)?new C(this._stagedVertex):r;this._syncGeometryAfterVertexMove(e,s,t,i,n),o()}}async _syncGeometryAfterVertexMove(e,t,i,s,o=!1){const r=this._editGeometryOperations.data.geometry;if("point"===r.type)e.geometry=t;else{const{x:n,y:a}=t,[h,c]=this._getIndicesForVertexGraphic(e);let p=g(r);const l=p[h].length-1;p[h][c]=[n,a],"polygon"===r.type&&(0===c?p[h][l]=[n,a]:c===l&&(p[h][0]=[n,a])),this._isVertex(e)&&(p=this._moveRelatedCoordinates(p,e,n,a),p=this._moveSelectedHandleCoordinates(p,e,i,s,"polygon"===r.type),this._updateMidpointGraphicLocations(p)),this.graphic.geometry=r.clone();const d=this._getVertexFromEditGeometry(e),m=n-d.pos[0],v=a-d.pos[1];this._editGeometryOperations.moveVertices([d],m,v,0),o&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(e),t):e.geometry=t)}}_moveRelatedCoordinates(e,t,i,s){const{relatedGraphicIndices:o}=t.attributes;for(const r of o){const o=this.vertexGraphics.getItemAt(r),{pathIndex:n,pointIndex:a}=o.attributes;e[n][a]=[i,s],o.geometry=t.geometry}return e}_moveSelectedHandleCoordinates(e,t,i,s,o){for(const r of this.selectedVertices)if(r!==t){const{pathIndex:t,pointIndex:n,relatedGraphicIndices:a}=r.attributes,h=b(r.geometry,i,s,this.view),c=e[t].length-1;e[t][n]=[h.x,h.y],r.geometry=h,o&&(0===n?e[t][c]=[h.x,h.y]:n===c&&(e[t][0]=[h.x,h.y]));for(const i of a){const t=this.vertexGraphics.getItemAt(i),{pathIndex:s,pointIndex:o}=t.attributes;e[s][o]=[h.x,h.y],t.geometry=h}}return e}_onGraphicPointerOverCallback(e){const t=e.graphic;this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.hover),this._updateHoverCursor(t)}_onGraphicPointerOutCallback(e){const t=e.graphic;this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.default),this.view.cursor="default"}_createVertexFromMidpoint(e){const{_graphicAttributes:t,graphic:i}=this,s=i.geometry;if(h(s)||"polygon"!==s.type&&"polyline"!==s.type)return[];const o=s.clone(),r=[],{pathIndex:n,pointIndexStart:a,pointIndexEnd:c}=e.attributes,{x:p,y:l}=e.geometry,d=0===c?a+1:c,m=g(o);return m[n].splice(d,0,[p,l]),e.attributes={...t,pathIndex:n,pointIndex:d,relatedGraphicIndices:[]},r.push({coordinates:m[n][d],componentIndex:n,vertexIndex:d}),this.graphic.geometry=o,r}_addToSelection(e){e instanceof t&&(e=[e]);for(const t of e)t.symbol=this.symbols.vertices.selected;this._set("selectedVertices",this.selectedVertices.concat(e)),this._emitSelectEvent(e)}_removeFromSelection(e,i){const{vertices:s}=this.symbols,o=i?s.hover:s.default;e instanceof t&&(e=[e]);for(const t of e)this.selectedVertices.splice(this.selectedVertices.indexOf(t),1),this._set("selectedVertices",this.selectedVertices),t.set("symbol",o);this._emitDeselectEvent(e)}_clearSelection(){if(this.selectedVertices.length){const e=this.selectedVertices;for(const t of this.selectedVertices)t.set("symbol",this.symbols.vertices.default);this._set("selectedVertices",[]),this._emitDeselectEvent(e)}}_keyDownHandler(e){k.delete.includes(e.key)&&!e.repeat&&this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_removeVertices(e){const i=this.graphic.geometry;if(h(i)||"polygon"!==i.type&&"polyline"!==i.type)return;if("polygon"===i.type&&this.vertexGraphics.length<4||this.vertexGraphics.length<3)return;e instanceof t&&(e=[e]);const s=this.graphic.clone(),o=i.clone(),r=g(o),n=[];e instanceof t&&(e=[e]);for(const t of e){const{x:e,y:i}=t.geometry;for(let t=0;t<r.length;t++){const s=r[t];for(let o=0;o<s.length;o++){const[a,h]=s[o];e===a&&i===h&&(n.push({coordinates:r[t][o],componentIndex:t,vertexIndex:o}),r[t].splice(Number(o),1))}}}if("polygon"===o.type)for(const t of r){const[e,i]=t[0],[s,o]=t[t.length-1];(1===t.length||t.length<3&&e===s&&i===o)&&r.splice(r.indexOf(t),1),t.length>2&&(e!==s||i!==o)&&t.push(t[0])}else for(const t of r)1===t.length&&r.splice(r.indexOf(t),1);this.graphic.geometry=o,this.refresh(),this._emitVertexRemoveEvent(e,s,n)}_isVertex(e){return this.vertexGraphics.includes(e)}_isSelected(e){return this._isVertex(e)&&this.selectedVertices.includes(e)}_isMidpoint(e){return this.midpointGraphics.includes(e)}_updateHoverCursor(e){this.view.cursor=this._isMidpoint(e)?"copy":"move"}_emitMoveStartEvent(e,t){const i=new A(this.graphic,e,t);this.emit("move-start",i),this.callbacks.onMoveStart&&this.callbacks.onMoveStart(i)}_emitMoveEvent(e,t){const i=new T(this.graphic,e,t);this.emit("move",i),this.callbacks.onMove&&this.callbacks.onMove(i)}_emitMoveStopEvent(){const{totalDx:e,totalDy:t}=this._activeOperationInfo,i=new U(this.graphic,e,t);this.emit("move-stop",i),this.callbacks.onMoveStop&&this.callbacks.onMoveStop(i)}_emitReshapeStartEvent(e){const t=new R(this.graphic,e,this.selectedVertices);this.emit("reshape-start",t),this.callbacks.onReshapeStart&&this.callbacks.onReshapeStart(t)}_emitReshapeEvent(e){const t=new j(this.graphic,e,this.selectedVertices);this.emit("reshape",t),this.callbacks.onReshape&&this.callbacks.onReshape(t)}_emitReshapeStopEvent(e){const t=new H(this.graphic,e,this.selectedVertices);this.emit("reshape-stop",t),this.callbacks.onReshapeStop&&this.callbacks.onReshapeStop(t)}_emitSelectEvent(e){const t=new D(e);this.emit("select",t),this.callbacks.onVertexSelect&&this.callbacks.onVertexSelect(t)}_emitDeselectEvent(e){const t=new F(e);this.emit("deselect",t),this.callbacks.onVertexDeselect&&this.callbacks.onVertexDeselect(t)}_emitVertexAddEvent(e,t,i){const s=new z(e,this.graphic,t,i);this.emit("vertex-add",s),this.callbacks.onVertexAdd&&this.callbacks.onVertexAdd(s)}_emitVertexRemoveEvent(e,t,i){const s=new L(e,this.graphic,t,i);this.emit("vertex-remove",s),this.callbacks.onVertexRemove&&this.callbacks.onVertexRemove(s)}_logGeometryTypeError(){q.error(new s("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};e([y()],B.prototype,"callbacks",void 0),e([y()],B.prototype,"enableMidpoints",void 0),e([y()],B.prototype,"enableMovement",void 0),e([y()],B.prototype,"enableVertices",void 0),e([y()],B.prototype,"graphic",void 0),e([y({readOnly:!0})],B.prototype,"vertexGraphics",void 0),e([y()],B.prototype,"layer",void 0),e([y({readOnly:!0})],B.prototype,"midpointGraphics",void 0),e([y()],B.prototype,"midpointSymbol",void 0),e([y({readOnly:!0})],B.prototype,"selectedVertices",void 0),e([y()],B.prototype,"snappingManager",void 0),e([y({readOnly:!0})],B.prototype,"state",null),e([y({value:K})],B.prototype,"symbols",null),e([y({readOnly:!0})],B.prototype,"type",void 0),e([y()],B.prototype,"view",void 0),B=e([_(N)],B);var J=B;export{J as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import"../../../geometry.js";import t from"../../../Graphic.js";import i from"../../../core/Collection.js";import s from"../../../core/Error.js";import r from"../../../core/Evented.js";import o from"../../../core/Handles.js";import n from"../../../core/Logger.js";import{destroyMaybe as a,isNone as h,isSome as c,abortMaybe as p,get as l}from"../../../core/maybe.js";import{createTask as d}from"../../../core/promiseUtils.js";import{whenOnce as m,pausable as v}from"../../../core/watchUtils.js";import{property as y}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{geometryToCoordinates as g,getMidpoint as u}from"../../../geometry/support/coordsUtils.js";import x from"../../../layers/GraphicsLayer.js";import f from"../../../symbols/SimpleMarkerSymbol.js";import{SnappingVisualizer2D as G}from"../../2d/interactive/SnappingVisualizer2D.js";import{cloneMove as b}from"./drawUtils.js";import V from"./GraphicMover.js";import{addUniqueLayer as M}from"./layerUtils.js";import{settings as S}from"./settings.js";import{ViewEventPriorities as w}from"../../input/InputManager.js";import{SKETCH_KEYS as k}from"../../interactive/keybindings.js";import{EditGeometryOperations as E}from"../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as I}from"../../interactive/snapping/SnappingContext.js";import O from"../../../geometry/Polyline.js";import C from"../../../geometry/Point.js";class R{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-start"}}class j{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape"}}class H{constructor(e,t,i){this.graphic=e,this.mover=t,this.selected=i,this.type="reshape-stop"}}class A{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-start"}}class T{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move"}}class U{constructor(e,t,i){this.mover=e,this.dx=t,this.dy=i,this.type="move-stop"}}class D{constructor(e){this.added=e,this.type="vertex-select"}}class F{constructor(e){this.removed=e,this.type="vertex-deselect"}}class z{constructor(e,t,i,s){this.added=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-add"}}class L{constructor(e,t,i,s){this.removed=e,this.graphic=t,this.oldGraphic=i,this.vertices=s,this.type="vertex-remove"}}const P=S.reshapeGraphics,K={vertices:{default:new f({style:"circle",size:P.vertex.size,color:P.vertex.color,outline:{color:P.vertex.outlineColor,width:1}}),hover:new f({style:"circle",size:P.vertex.hoverSize,color:P.vertex.hoverColor,outline:{color:P.vertex.hoverOutlineColor,width:1}}),selected:new f({style:"circle",size:P.selected.size,color:P.selected.color,outline:{color:P.selected.outlineColor,width:1}})},midpoints:{default:new f({style:"circle",size:P.midpoint.size,color:P.midpoint.color,outline:{color:P.midpoint.outlineColor,width:1}}),hover:new f({style:"circle",size:P.midpoint.size,color:P.midpoint.color,outline:{color:P.midpoint.outlineColor,width:1}})}},N="esri.views.draw.support.Reshape",q=n.getLogger(N);let B=class extends r.EventedAccessor{constructor(e){super(e),this._activeOperationInfo=null,this._editGeometryOperations=null,this._handles=new o,this._graphicAttributes={esriSketchTool:"box"},this._mover=null,this._snappingTask=null,this._stagedVertex=null,this._viewHandles=new o,this.callbacks={onReshapeStart(){},onReshape(){},onReshapeStop(){},onMoveStart(){},onMove(){},onMoveStop(){},onGraphicClick(){}},this.enableMidpoints=!0,this.enableMovement=!0,this.enableVertices=!0,this.graphic=null,this.vertexGraphics=new i,this.layer=null,this.midpointGraphics=new i,this.midpointSymbol=new f({style:"circle",size:6,color:[200,200,200],outline:{color:[100,100,100],width:1}}),this.selectedVertices=[],this.snappingManager=null,this.type="reshape",this.view=null}initialize(){this._setup(),this._handles.add([m(this,"view.ready",(()=>{const{layer:e,view:t}=this;M(t,e),this._viewHandles.add([t.on("key-down",(e=>this._keyDownHandler(e)),w.TOOL)])})),v(this,"graphic",(()=>this.refresh())),v(this,"layer",((e,t)=>{t&&(this._clearSelection(),this._resetGraphics(t)),this.refresh()})),v(this,"enableMidpoints",(()=>{this.refresh()}))])}destroy(){var e;this._reset(),null==(e=this._mover)||e.destroy(),this._mover=null,this._handles=a(this._handles),this._viewHandles=a(this._viewHandles)}get state(){const e=!!this.get("view.ready"),t=!(!this.get("graphic")||!this.get("layer"));return e&&t?"active":e?"ready":"disabled"}set symbols(e){const{midpoints:t=K.midpoints,vertices:i=K.vertices}=e||{};this._set("symbols",{midpoints:t,vertices:i})}isUIGraphic(e){const t=[];return this.graphic&&t.push(this.graphic),t.concat(this.vertexGraphics.items,this.midpointGraphics.items),t.length&&t.includes(e)}refresh(){this._reset(),this._setup()}reset(){this.graphic=null}clearSelection(){this._clearSelection()}removeSelectedVertices(){this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_setup(){const{graphic:e,layer:t}=this;if(!t||!e||h(e.geometry))return;const i=e.geometry;"mesh"!==i.type&&"extent"!==i.type?(this._setupGraphics(),this._setupMover()):this._logGeometryTypeError()}_setUpGeometryHelper(){const e=this.graphic.geometry;if(h(e)||"mesh"===e.type||"extent"===e.type)return void this._logGeometryTypeError();const t="multipoint"===e.type?new O({paths:e.points,spatialReference:e.spatialReference}):e;this._editGeometryOperations=E.fromGeometry(t,2)}_saveSnappingContextForHandle(e,t){var i;this._snappingGraphicsLayer=new x({listMode:"hide",internal:!0,title:"Reshape snapping layer"}),this.view.map.layers.add(this._snappingGraphicsLayer),this._snappingContext=new I({editGeometryOperations:this._editGeometryOperations,elevationInfo:{mode:"on-the-ground",offset:0},pointer:(null==(i=t.viewEvent)?void 0:i.pointerType)||"mouse",excludeFeature:this.graphic,visualizer:new G(this._snappingGraphicsLayer),vertexHandle:this._getVertexFromEditGeometry(e)})}_reset(){this._clearSelection(),this._resetGraphics(),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._mover&&this._mover.destroy(),this._mover=null,this.view.cursor="default"}_resetSnappingStateVars(){c(this.snappingManager)&&this.snappingManager.doneSnapping(),c(this._snappingGraphicsLayer)&&(this.view.map.layers.remove(this._snappingGraphicsLayer),this._snappingGraphicsLayer.destroy()),this._editGeometryOperations=a(this._editGeometryOperations),this._snappingTask=p(this._snappingTask),this._snappingTask=null,this._snappingContext=null,this._stagedVertex=null}_resetGraphics(e){this._removeMidpointGraphics(e),this._removeVertexGraphics(e),this._set("selectedVertices",[])}_removeMidpointGraphics(e){const t=e||this.layer;t&&t.removeMany(this.midpointGraphics.items),this.midpointGraphics.items.forEach((e=>e.destroy())),this.midpointGraphics.removeAll()}_removeVertexGraphics(e){const t=e||this.layer;t&&t.removeMany(this.vertexGraphics.items),this.vertexGraphics.items.forEach((e=>e.destroy())),this.vertexGraphics.removeAll()}_getCoordinatesForUI(e){const t=g(e.clone());if("polygon"===e.type)for(const i of t){const e=i[i.length-1];i[0][0]===e[0]&&i[0][1]===e[1]&&i.length>2&&i.pop()}return t}_setupGraphics(){const e=this.graphic.geometry;if(c(e)&&("polyline"===e.type||"polygon"===e.type)){const t=this._getCoordinatesForUI(e);this.enableMidpoints&&this._setUpMidpointGraphics(t),this.enableVertices&&this._setUpVertexGraphics(t)}}_setUpMidpointGraphics(e){this._removeMidpointGraphics();const t=this._createMidpointGraphics(e);this.midpointGraphics.addMany(t),this.layer.addMany(t)}_setUpVertexGraphics(e){this._removeVertexGraphics();const t=this._createVertexGraphics(e);this.vertexGraphics.addMany(t),this._storeRelatedVertexIndices(),this.layer.addMany(t)}_createVertexGraphics(e){const{_graphicAttributes:i,symbols:s,view:{spatialReference:r}}=this,o=[];return null==e||e.forEach(((e,n)=>{e.forEach(((e,a)=>{var h;const[c,p]=e;o.push(new t({geometry:new C({x:c,y:p,spatialReference:r}),symbol:null==s||null==(h=s.vertices)?void 0:h.default,attributes:{...i,pathIndex:n,pointIndex:a}}))}))})),o}_createMidpointGraphics(e){const{_graphicAttributes:i,symbols:s,view:{spatialReference:r}}=this,o=[];return null==e||e.forEach(((e,n)=>{e.forEach(((a,h)=>{const[c,p]=a,d=e[h+1]?h+1:0;if("polygon"===l(this.graphic.geometry,"type")||0!==d){const[a,l]=e[d],[m,v]=u([c,p],[a,l]);o.push(new t({geometry:new C({x:m,y:v,spatialReference:r}),symbol:s.midpoints.default,attributes:{...i,pathIndex:n,pointIndexStart:h,pointIndexEnd:d}}))}}))})),o}_storeRelatedVertexIndices(){const e=this.vertexGraphics.items;if(!e)return;const t=e.map((({geometry:e})=>({x:e.x,y:e.y})));for(let i=0;i<t.length;i++){const s=[];for(let e=0;e<t.length;e++){if(i===e)continue;const r=t[i],o=t[e];r.x===o.x&&r.y===o.y&&s.push(e)}e[i].attributes.relatedGraphicIndices=s}}_setupMover(){const{enableMovement:e,graphic:t,midpointGraphics:i,vertexGraphics:s,view:r}=this,o=l(t.geometry,"type"),n="point"===o||"multipoint"===o,a=s.concat(i).items;e&&a.push(t),this._mover=new V({enableMoveAllGraphics:!1,indicatorsEnabled:n,graphics:a,view:r,callbacks:{onGraphicClick:e=>this._onGraphicClickCallback(e),onGraphicMoveStart:e=>this._onGraphicMoveStartCallback(e),onGraphicMove:e=>this._onGraphicMoveCallback(e),onGraphicMoveStop:e=>this._onGraphicMoveStopCallback(e),onGraphicPointerOver:e=>this._onGraphicPointerOverCallback(e),onGraphicPointerOut:e=>this._onGraphicPointerOutCallback(e)}})}_onGraphicClickCallback(e){e.viewEvent.stopPropagation();const t=e.graphic;if(t===this.graphic)this.clearSelection(),this.emit("graphic-click",e),this.callbacks.onGraphicClick&&this.callbacks.onGraphicClick(e);else if(this._isMidpoint(t)){if(2===e.viewEvent.button)return;const i=this.graphic.clone(),s=this._createVertexFromMidpoint(t);this.refresh(),this._emitVertexAddEvent([t],i,s)}else if(this._isVertex(t))if(e.viewEvent.stopPropagation(),2===e.viewEvent.button)this._removeVertices(t);else{e.viewEvent.native.shiftKey||this._clearSelection(),this.selectedVertices.includes(t)?this._removeFromSelection(t,!0):this._addToSelection(t)}}_setUpOperation(e){const{graphic:t,dx:i,dy:s}=e,r=t===this.graphic;this._resetSnappingStateVars(),this._setUpGeometryHelper(),this._saveSnappingContextForHandle(t,e),this._activeOperationInfo={target:this.graphic,mover:t,operationType:r?"move":"reshape",totalDx:i,totalDy:s}}_onGraphicMoveStartCallback(e){const t=e.graphic,{dx:i,dy:s}=e;if(t===this.graphic)return this._clearSelection(),this._resetGraphics(),this._setUpOperation(e),this._emitMoveStartEvent(i,s),void("point"===this._editGeometryOperations.data.type&&this._onHandleMove(t,i,s,e,(()=>this._emitMoveEvent(i,s))));if(!this.selectedVertices.includes(t)){if(this._clearSelection(),this._isMidpoint(t)){const e=this.graphic.clone(),i=this._createVertexFromMidpoint(t);this._emitVertexAddEvent([t],e,i)}this._addToSelection(t)}this._setUpOperation(e),this._emitReshapeStartEvent(t),this._onHandleMove(t,i,s,e,(()=>this._emitReshapeEvent(t)))}_onGraphicMoveCallback(e){const{graphic:t,dx:i,dy:s}=e;this._activeOperationInfo.totalDx+=i,this._activeOperationInfo.totalDy+=s;const{operationType:r}=this._activeOperationInfo;"move"===r?"point"===this._editGeometryOperations.data.type?this._onHandleMove(t,i,s,e,(()=>this._emitMoveEvent(i,s))):this._emitMoveEvent(i,s):this._onHandleMove(t,i,s,e,(()=>this._emitReshapeEvent(t)))}_onGraphicMoveStopCallback(e){const{graphic:t,dx:i,dy:s}=e;this._activeOperationInfo.totalDx+=i,this._activeOperationInfo.totalDy+=s,t===this.graphic?(this._emitMoveStopEvent(),this.refresh()):(this._onHandleMove(t,i,s,e,(()=>this._emitReshapeStopEvent(t))),this._resetSnappingStateVars(),this._activeOperationInfo=null,this._isMidpoint(t)&&this.refresh())}_updateMidpointGraphicLocations(e){for(const t of this.midpointGraphics){const{pathIndex:i,pointIndexStart:s,pointIndexEnd:r}=t.attributes,[o,n]=e[i][s],[a,h]=e[i][r],[c,p]=u([o,n],[a,h]);t.geometry=new C({x:c,y:p,spatialReference:this.view.spatialReference})}}_getIndicesForVertexGraphic({attributes:e}){return[(null==e?void 0:e.pathIndex)||0,(null==e?void 0:e.pointIndex)||0]}_getVertexFromEditGeometry(e){const[t,i]=this._getIndicesForVertexGraphic(e);return this._editGeometryOperations.data.components[t].vertices[i]}_onHandleMove(e,t,i,s,r){if(p(this._snappingTask),!this._snappingContext)return;const o=e.geometry,n="graphic-move-stop"===s.type;if(c(this.snappingManager)&&this.selectedVertices.length<2&&!n){const s=this.snappingManager;this._stagedVertex=s.update(o,this._snappingContext),this._syncGeometryAfterVertexMove(e,new C(this._stagedVertex),t,i,n),r(),this._snappingTask=d((async a=>{const h=await s.snap(o,this._snappingContext,a);h.valid&&(this._stagedVertex=h.apply(),this._syncGeometryAfterVertexMove(e,new C(this._stagedVertex),t,i,n),r())}))}else{const s=c(this._stagedVertex)?new C(this._stagedVertex):o;this._syncGeometryAfterVertexMove(e,s,t,i,n),r()}}async _syncGeometryAfterVertexMove(e,t,i,s,r=!1){const o=this._editGeometryOperations.data.geometry;if("point"===o.type)e.geometry=t;else{const{x:n,y:a}=t,[h,c]=this._getIndicesForVertexGraphic(e);let p=g(o);const l=p[h].length-1;p[h][c]=[n,a],"polygon"===o.type&&(0===c?p[h][l]=[n,a]:c===l&&(p[h][0]=[n,a])),this._isVertex(e)&&(p=this._moveRelatedCoordinates(p,e,n,a),p=this._moveSelectedHandleCoordinates(p,e,i,s,"polygon"===o.type),this._updateMidpointGraphicLocations(p)),this.graphic.geometry=o.clone();const d=this._getVertexFromEditGeometry(e),m=n-d.pos[0],v=a-d.pos[1];this._editGeometryOperations.moveVertices([d],m,v,0),r&&(this._mover?this._mover.updateGeometry(this._mover.graphics.indexOf(e),t):e.geometry=t)}}_moveRelatedCoordinates(e,t,i,s){const{relatedGraphicIndices:r}=t.attributes;for(const o of r){const r=this.vertexGraphics.getItemAt(o),{pathIndex:n,pointIndex:a}=r.attributes;e[n][a]=[i,s],r.geometry=t.geometry}return e}_moveSelectedHandleCoordinates(e,t,i,s,r){for(const o of this.selectedVertices)if(o!==t){const{pathIndex:t,pointIndex:n,relatedGraphicIndices:a}=o.attributes,h=b(o.geometry,i,s,this.view),c=e[t].length-1;e[t][n]=[h.x,h.y],o.geometry=h,r&&(0===n?e[t][c]=[h.x,h.y]:n===c&&(e[t][0]=[h.x,h.y]));for(const i of a){const t=this.vertexGraphics.getItemAt(i),{pathIndex:s,pointIndex:r}=t.attributes;e[s][r]=[h.x,h.y],t.geometry=h}}return e}_onGraphicPointerOverCallback(e){const t=e.graphic;this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.hover),this._updateHoverCursor(t)}_onGraphicPointerOutCallback(e){const t=e.graphic;this._isVertex(t)&&!this._isSelected(t)&&(t.symbol=this.symbols.vertices.default),this.view.cursor="default"}_createVertexFromMidpoint(e){const{_graphicAttributes:t,graphic:i}=this,s=i.geometry;if(h(s)||"polygon"!==s.type&&"polyline"!==s.type)return[];const r=s.clone(),o=[],{pathIndex:n,pointIndexStart:a,pointIndexEnd:c}=e.attributes,{x:p,y:l}=e.geometry,d=0===c?a+1:c,m=g(r);return m[n].splice(d,0,[p,l]),e.attributes={...t,pathIndex:n,pointIndex:d,relatedGraphicIndices:[]},o.push({coordinates:m[n][d],componentIndex:n,vertexIndex:d}),this.graphic.geometry=r,o}_addToSelection(e){e instanceof t&&(e=[e]);for(const t of e)t.symbol=this.symbols.vertices.selected;this._set("selectedVertices",this.selectedVertices.concat(e)),this._emitSelectEvent(e)}_removeFromSelection(e,i){const{vertices:s}=this.symbols,r=i?s.hover:s.default;e instanceof t&&(e=[e]);for(const t of e)this.selectedVertices.splice(this.selectedVertices.indexOf(t),1),this._set("selectedVertices",this.selectedVertices),t.set("symbol",r);this._emitDeselectEvent(e)}_clearSelection(){if(this.selectedVertices.length){const e=this.selectedVertices;for(const t of this.selectedVertices)t.set("symbol",this.symbols.vertices.default);this._set("selectedVertices",[]),this._emitDeselectEvent(e)}}_keyDownHandler(e){k.delete.includes(e.key)&&!e.repeat&&this.selectedVertices.length&&this._removeVertices(this.selectedVertices)}_removeVertices(e){const i=this.graphic.geometry;if(h(i)||"polygon"!==i.type&&"polyline"!==i.type)return;if("polygon"===i.type&&this.vertexGraphics.length<4||this.vertexGraphics.length<3)return;e instanceof t&&(e=[e]);const s=this.graphic.clone(),r=i.clone();let o=g(r);const n=[];e instanceof t&&(e=[e]);for(const t of e){const{x:e,y:i}=t.geometry;for(let t=0;t<o.length;t++){const s=o[t];for(let r=0;r<s.length;r++){const[a,h]=s[r];e===a&&i===h&&(n.push({coordinates:o[t][r],componentIndex:t,vertexIndex:r}),o[t].splice(Number(r),1))}}}if("polygon"===r.type)o=o.filter((e=>{if(e.length<2)return!1;const[t,i]=e[0],[s,r]=e[e.length-1];return(2!==e.length||t!==s||i!==r)&&(t===s&&i===r||e.push(e[0]),!0)})),r.rings=o;else{for(const e of o)1===e.length&&o.splice(o.indexOf(e),1);r.paths=o}this.graphic.geometry=r,this.refresh(),this._emitVertexRemoveEvent(e,s,n)}_isVertex(e){return this.vertexGraphics.includes(e)}_isSelected(e){return this._isVertex(e)&&this.selectedVertices.includes(e)}_isMidpoint(e){return this.midpointGraphics.includes(e)}_updateHoverCursor(e){this.view.cursor=this._isMidpoint(e)?"copy":"move"}_emitMoveStartEvent(e,t){const i=new A(this.graphic,e,t);this.emit("move-start",i),this.callbacks.onMoveStart&&this.callbacks.onMoveStart(i)}_emitMoveEvent(e,t){const i=new T(this.graphic,e,t);this.emit("move",i),this.callbacks.onMove&&this.callbacks.onMove(i)}_emitMoveStopEvent(){const{totalDx:e,totalDy:t}=this._activeOperationInfo,i=new U(this.graphic,e,t);this.emit("move-stop",i),this.callbacks.onMoveStop&&this.callbacks.onMoveStop(i)}_emitReshapeStartEvent(e){const t=new R(this.graphic,e,this.selectedVertices);this.emit("reshape-start",t),this.callbacks.onReshapeStart&&this.callbacks.onReshapeStart(t)}_emitReshapeEvent(e){const t=new j(this.graphic,e,this.selectedVertices);this.emit("reshape",t),this.callbacks.onReshape&&this.callbacks.onReshape(t)}_emitReshapeStopEvent(e){const t=new H(this.graphic,e,this.selectedVertices);this.emit("reshape-stop",t),this.callbacks.onReshapeStop&&this.callbacks.onReshapeStop(t)}_emitSelectEvent(e){const t=new D(e);this.emit("select",t),this.callbacks.onVertexSelect&&this.callbacks.onVertexSelect(t)}_emitDeselectEvent(e){const t=new F(e);this.emit("deselect",t),this.callbacks.onVertexDeselect&&this.callbacks.onVertexDeselect(t)}_emitVertexAddEvent(e,t,i){const s=new z(e,this.graphic,t,i);this.emit("vertex-add",s),this.callbacks.onVertexAdd&&this.callbacks.onVertexAdd(s)}_emitVertexRemoveEvent(e,t,i){const s=new L(e,this.graphic,t,i);this.emit("vertex-remove",s),this.callbacks.onVertexRemove&&this.callbacks.onVertexRemove(s)}_logGeometryTypeError(){q.error(new s("reshape:invalid-geometry","Reshape operation not supported for the provided graphic. The geometry type is not supported."))}};e([y()],B.prototype,"callbacks",void 0),e([y()],B.prototype,"enableMidpoints",void 0),e([y()],B.prototype,"enableMovement",void 0),e([y()],B.prototype,"enableVertices",void 0),e([y()],B.prototype,"graphic",void 0),e([y({readOnly:!0})],B.prototype,"vertexGraphics",void 0),e([y()],B.prototype,"layer",void 0),e([y({readOnly:!0})],B.prototype,"midpointGraphics",void 0),e([y()],B.prototype,"midpointSymbol",void 0),e([y({readOnly:!0})],B.prototype,"selectedVertices",void 0),e([y()],B.prototype,"snappingManager",void 0),e([y({readOnly:!0})],B.prototype,"state",null),e([y({value:K})],B.prototype,"symbols",null),e([y({readOnly:!0})],B.prototype,"type",void 0),e([y()],B.prototype,"view",void 0),B=e([_(N)],B);var J=B;export{J 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.21/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Collection.js";import s from"../../core/Evented.js";import{HandleOwnerMixin as i}from"../../core/HandleOwner.js";import{debounce as a,throwIfNotAbortError as r}from"../../core/promiseUtils.js";import{init as c,watch as
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Collection.js";import s from"../../core/Evented.js";import{HandleOwnerMixin as i}from"../../core/HandleOwner.js";import{debounce as a,throwIfNotAbortError as r}from"../../core/promiseUtils.js";import{init as c,watch as l}from"../../core/watchUtils.js";import{property as m}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import"../../core/Logger.js";import{subclass as o}from"../../core/accessorSupport/decorators/subclass.js";import n from"../LayerList/ListItem.js";const h=300,p={view:"view",basemap:"basemap",baseLayers:"base-layers",referenceLayers:"reference-layers",baseLayersListMode:"reference-layers-list-mode",referenceLayersListMode:"base-layers-list-mode",baseLayerViews:"base-layer-views",referenceLayerViews:"reference-layer-views"},d=t.ofType(n);let y=class extends(i(s.EventedAccessor)){constructor(e){super(e),this.baseItems=new d,this.baseListItemCreatedFunction=null,this.referenceListItemCreatedFunction=null,this.referenceItems=new d,this.view=null,this._callReferenceListItemsCreatedDebounced=a((async e=>this._callListItemsCreated({items:e,type:"reference"})),h),this._callBaseListItemsCreatedDebounced=a((async e=>this._callListItemsCreated({items:e,type:"base"})),h),this._compileBaseList=this._compileBaseList.bind(this),this._compileReferenceList=this._compileReferenceList.bind(this)}initialize(){this.handles.add(c(this,["view.map.basemap","view","view.ready","view.basemapView"],(()=>this._watchBasemapLayers())),p.view)}destroy(){this.view=null,this.baseItems.removeAll(),this.referenceItems.removeAll()}get basemapTitle(){return this.get("view.map.basemap.title")||null}set basemapTitle(e){void 0!==e?this._override("basemapTitle",e):this._clearOverride("basemapTitle")}get state(){return this.get("view.ready")?"ready":this.get("view")?"loading":"disabled"}triggerAction(e,t){e&&!e.disabled&&this.emit("trigger-action",{action:e,item:t})}transferListItem({listItem:e,from:t,to:s,newIndex:i}){const{referenceItems:a,baseItems:r}=this,{layer:c}=e,l=this.get("view.map.basemap.baseLayers"),m=this.get("view.map.basemap.referenceLayers");if(!l||!m||t===s)return;const o="reference"===s?a:r,n="reference"===t?m:l,h="reference"===s?m:l;("reference"===t?a:r).remove(e),n.remove(c),o.add(e,i),h.add(c,i)}_createItemChangeHandles({items:e,key:t,callback:s}){const{handles:i}=this;i.remove(t),s(),e&&i.add(e.on("change",(()=>s())),t)}_watchItemProperties({item:e,type:t}){this.handles.add([e.children.on("change",(()=>{this._callListItemCreatedChildren({type:t,childItems:e.children})}))],`children-change-${e.uid}`)}_callListItemCreatedChildren({childItems:e,type:t}){e.forEach((e=>this._callListItemCreated({type:t,item:e})))}_callListItemCreated({item:e,type:t}){const s={item:e};"base"===t&&"function"==typeof this.baseListItemCreatedFunction&&this.baseListItemCreatedFunction.call(null,s),"reference"===t&&"function"==typeof this.referenceListItemCreatedFunction&&this.referenceListItemCreatedFunction.call(null,s),this._callListItemCreatedChildren({type:t,childItems:e.children})}_createListItem({layer:e,type:t}){const{view:s}=this,i=new n({layer:e,view:s});return this._watchItemProperties({type:t,item:i}),i}_watchLayersListMode({layers:e,key:t,callback:s}){const{handles:i}=this;i.remove(t),e&&e.forEach((e=>{i.add(l(e,"listMode",(()=>s())),t)}))}_compileListItems({layers:e,items:t,key:s,type:i,callback:a}){this._watchLayersListMode({layers:e,key:s,callback:a}),this._createNewItems({type:i,items:t,layers:e}),this._removeItems({items:t,layers:e}),this._sortItems(t,e),this._beforeCallListItemsCreated({items:t,type:i})}async _beforeCallListItemsCreated({items:e,type:t}){return"reference"===t?this._callReferenceListItemsCreatedDebounced(e).catch(r):"base"===t?this._callBaseListItemsCreatedDebounced(e).catch(r):null}async _callListItemsCreated({items:e,type:t}){var s;await(null==(s=this.view)?void 0:s.when()),e.forEach((e=>this._callListItemCreated({type:t,item:e})))}_compileReferenceList(){const{referenceItems:e}=this,t=this.get("view.map.basemap.referenceLayers");this._compileListItems({type:"reference",layers:t,items:e,key:p.referenceLayersListMode,callback:this._compileReferenceList})}_compileBaseList(){const{baseItems:e}=this,t=this.get("view.map.basemap.baseLayers");this._compileListItems({type:"base",layers:t,items:e,key:p.baseLayersListMode,callback:this._compileBaseList})}_compileLists(){this._compileReferenceList(),this._compileBaseList()}_createNewItems({items:e,layers:t,type:s}){t&&t.forEach((t=>{e.find((e=>e.layer===t))||e.add(this._createListItem({type:s,layer:t}))}))}_removeItems({items:e,layers:t}){const{handles:s}=this;e&&e.forEach((i=>{if(!i)return;t&&t.find((e=>i.layer===e))||(s.remove(`children-change-${i.uid}`),e.remove(i))}))}_sortItems(e,t){e&&e.sort(((e,s)=>{const i=t.indexOf(e.layer),a=t.indexOf(s.layer);return i>a?-1:i<a?1:0}))}_watchBasemapLayers(){const{handles:e,view:t}=this;e.remove([p.baseLayers,p.referenceLayers,p.basemap,p.baseLayerViews,p.referenceLayerViews]),this._compileLists(),t&&t.ready&&e.add([c(this,"view.map.basemap.baseLayers",(e=>this._createItemChangeHandles({items:e,key:p.baseLayers,callback:this._compileBaseList}))),c(this,"view.map.basemap.referenceLayers",(e=>this._createItemChangeHandles({items:e,key:p.referenceLayers,callback:this._compileReferenceList}))),c(this,"view.basemapView.baseLayerViews",(e=>this._createItemChangeHandles({items:e,key:p.baseLayerViews,callback:this._compileBaseList}))),c(this,"view.basemapView.referenceLayerViews",(e=>this._createItemChangeHandles({items:e,key:p.referenceLayerViews,callback:this._compileReferenceList}))),c(this,"baseListItemCreatedFunction",(()=>this._compileBaseList())),c(this,"referenceListItemCreatedFunction",(()=>this._compileReferenceList()))],p.basemap)}};e([m({type:d})],y.prototype,"baseItems",void 0),e([m()],y.prototype,"basemapTitle",null),e([m()],y.prototype,"baseListItemCreatedFunction",void 0),e([m()],y.prototype,"referenceListItemCreatedFunction",void 0),e([m({type:d})],y.prototype,"referenceItems",void 0),e([m({readOnly:!0})],y.prototype,"state",null),e([m()],y.prototype,"view",void 0),e([m()],y.prototype,"transferListItem",null),y=e([o("esri.widgets.BasemapLayerList.BasemapLayerListViewModel")],y);var L=y;export{L as default};
|
|
@@ -956,4 +956,4 @@ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Col
|
|
|
956
956
|
<template class="header" id="headerTemplate">
|
|
957
957
|
<vaadin-grid-sorter path="[[path]]" direction="{{direction}}">[[_getHeader(header, path)]]</vaadin-grid-sorter>
|
|
958
958
|
</template>
|
|
959
|
-
`}static get is(){return"vaadin-grid-sort-column"}static get properties(){return{path:String,direction:{type:String,notify:!0}}}_prepareHeaderTemplate(){const e=this._prepareTemplatizer(this.$.headerTemplate);return e.templatizer.dataHost=this,e}_getHeader(e,t){return e||this._generateHeader(t)}}customElements.define(Ka.is,Ka);const Qa={selectionColumn:!0},el={base:"esri-grid",content:"esri-grid__content",grid:"esri-grid__grid",widget:"esri-widget"};let tl=class extends(s(c)){constructor(e,i){super(e,i),this._grid=null,this._headerStyles="display: flex; font-weight: 400;",this._hostStyles='font-family: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 1em; background-color: inherit; color: inherit;',this._rowHoverStyles="background-color: var(--lumo-row-background-hover);",this._columnElements=[],this.cellClassNameGenerator=null,this.columnReorderingEnabled=!0,this.dataProvider=null,this.itemIdPath=null,this.label=void 0,this.messages=null,this.pageSize=50,this.selectedItems=new t,this.size=null,this.rowDetailsRenderer=null,this.store=null,this.viewModel=new u,this.visibleElements={...Qa}}initialize(){this.handles.add([this.columns.on("change",(()=>this._syncColumnRenderers())),n(this,"viewModel.size",(()=>this._updateGridSize())),n(this,"store.state",((e,t)=>{"ready"!==e||"loaded"!==t&&"error"!==t||this.refreshCache()})),o(this,"_grid.$.table","scroll",(()=>{var e;null==(e=this.viewModel)||e.closeColumnMenus()}))])}destroy(){var e;this.handles.removeAll(),this.resetColumns(),null==(e=this.columns)||e.destroy()}resetColumns(){this.columns.items.forEach((e=>e.destroy())),this.columns.removeAll()}castVisibleElements(e){return{...Qa,...e}}render(){return m("div",{bind:this,class:this.classes(el.base,el.widget)},m("div",{bind:this,class:el.content},this.renderGrid()))}renderGrid(){return m("vaadin-grid",{...this.getGridProps()},this.renderAllColumns())}renderAllColumns(){if("disabled"!==this.viewModel.state&&this.columns&&this.columns.length)return[this.renderSelectionColumn(),this.renderColumns()]}renderSelectionColumn(){return m("vaadin-grid-selection-column",{_selectAllHidden:!0,selectAll:!1,bind:this,hidden:!this.visibleElements.selectionColumn,sortable:!1,frozen:!p(this.container)})}renderColumns(){return this.columns.items.map(((e,t)=>m("vaadin-grid-column",{...this.getColumnProps(e,t)})))}getGridProps(){const{columnReorderingEnabled:e,id:t,pageSize:i,size:s}=this;return{_safari:!1,class:el.grid,id:`${t}_grid`,theme:"compact column-borders",ref:"grid",bind:this,afterCreate:this._afterGridCreate,afterUpdate:this._afterGridUpdate,columnReorderingAllowed:e,pageSize:i,size:s}}getColumnProps(e,t){const{id:i}=this,{autoWidth:s,direction:n,flexGrow:o,frozen:a,header:l,hidden:d,path:h,resizable:c,textAlign:u,width:p}=e;return{autoWidth:s,direction:n,flexGrow:o,frozen:a,header:l,hidden:d,key:`${i}_${name}_${r(t)?t:h}`,path:h,resizable:c,"text-align":u,width:"number"==typeof p?`${p}px`:p,bind:this,afterCreate:this._afterColumnCreate,afterRemoved:this._afterColumnRemoved}}clearSelection(){this._clearSelection(),this.scheduleRender()}clearSort(){let e=!1;if(this._grid&&this._grid._sorters.length&&(this._grid._sorters=[],e=!0),this.columns.length){!!this.columns.find((e=>!!e.direction))&&(this.columns.forEach((e=>e.direction=null)),e=!0)}e&&this.scheduleRender()}deselectItem(e){this._deselectRowByItem(e)}deselectRow(e){const t=this.viewModel.getRowItemAt(e);t&&this._deselectRowByItem(t)}findColumn(){}generateCellClassNames(){var e;null==(e=this._grid)||e.generateCellClassNames()}getSlotElementByName(e){var t,i;return null==(t=this._grid)||null==(i=t.shadowRoot)?void 0:i.querySelector(`slot[name='${e}']`)}hideColumn(e){var t;null==(t=this.viewModel)||t.hideColumn(e),this.scheduleRender()}notifyResize(){var e;null==(e=this._grid)||e.notifyResize()}recalculateColumnWidths(){var e;null==(e=this._grid)||e.recalculateColumnWidths()}async refresh(){var e;this._clearSelection(),await(null==(e=this.store)?void 0:e.reset()),this.scrollToTop()}refreshCache(){var e;null==(e=this._grid)||e.clearCache()}selectRows(e){const t=this._grid.selectedItems.slice();e.forEach((e=>{t.findIndex((t=>t.objectId===e.objectId))<0&&this._grid.selectedItems.push(e)})),this._updateSelectionProps(),this._grid.render()}deselectRows(e){const t=this._grid.selectedItems.slice();e.forEach((e=>{const i=t.findIndex((t=>t.objectId===e.objectId));i>-1&&t.splice(i,1)})),this._grid.selectedItems=t,this._updateSelectionProps(),this._grid.render()}selectItem(e){this._selectRowByItem(e)}selectRow(e){const t=this.viewModel.getRowItemAt(e);t&&this._selectRowByItem(t)}showColumn(e){var t;null==(t=this.viewModel)||t.showColumn(e),this.scheduleRender()}sort({path:e,direction:t}){var i;null==(i=this.viewModel)||i.sortColumn(e,t)}scrollToIndex(e){var t;null==(t=this._grid)||t.scrollToIndex(e)}scrollToTop(){var e;null==(e=this._grid)||e.scrollToIndex(0)}_afterGridCreate(e){const{cellClassNameGenerator:t,dataProvider:i,itemIdPath:s,rowDetailsRenderer:r}=this;e.cellClassNameGenerator=t,e.dataProvider=i,e.rowDetailsRenderer=r,e.itemIdPath=s,this._grid=e,customElements.whenDefined("vaadin-grid").then((()=>{this._appendStyles(),this._addGridEventListeners()}))}_afterGridUpdate(e){this._grid||(this._grid=e)}_afterColumnCreate(e){this._applyRenderersToColumnElement(e),this._columnElements.push(e)}_afterColumnRemoved(e){const t=this._columnElements.indexOf(e,0);t>-1&&this._columnElements.splice(t,1)}_syncColumnRenderers(){this._columnElements.forEach((e=>this._applyRenderersToColumnElement(e)))}_appendStyles(){var e;const t=null==(e=this._grid)?void 0:e.shadowRoot,i=document.createElement("style");i.textContent=`\n :host { ${this._hostStyles} }\n [part~="header-cell"] ::slotted(vaadin-grid-cell-content) { ${this._headerStyles} }\n [part~="row"]:hover [part~="body-cell"] { ${this._rowHoverStyles} }\n `,null==t||t.appendChild(i)}_updateGridSize(){this._grid&&(this._grid.size=this.size||0,this.scheduleRender())}_addGridEventListeners(){const{_grid:e}=this;this.handles.add([i(e,"click",(e=>this._onRowClick(e))),i(e,"selected-items-changed",(e=>this._onSelectionChange(e)))])}_onRowClick(e){const{_grid:t}=this,i=t.getEventContext(event),{item:s,section:r}=i;s&&r&&"details"!==r&&"header"!==r&&this.emit("row-click",{context:i,native:e})}_selectRowByItem(e){var t;null==(t=this._grid)||t.selectItem(e)}_deselectRowByItem(e){var t;null==(t=this._grid)||t.deselectItem(e)}_clearSelection(){var e,t;null!=(e=this._grid)&&null!=(t=e.selectedItems)&&t.length&&(this._grid.selectedItems=[],this._updateSelectionProps(),this._grid.render())}_onSelectionChange(e){const t=e;if("selectedItems.splices"===t.detail.path){const{removed:e,index:i,object:s}=t.detail.value.indexSplices[0];this._updateSelectionProps(),this.emit("selection-change",{index:i,added:s,removed:e})}}_updateSelectionProps(){this.selectedItems.length&&this.selectedItems.removeAll(),this._grid&&this.selectedItems.addMany(this._grid.selectedItems)}_applyRenderersToColumnElement(e){const t=e.getAttribute("path"),i=this.viewModel.findColumn(t);if(i)try{i.renderFunction&&(e.renderer=(e,t,s)=>i.renderFunction({root:e,column:t,rowData:s})),i.footerRenderFunction&&(e.footerRenderer=(e,t)=>i.footerRenderFunction({root:e,column:t})),i.headerRenderFunction&&(e.headerRenderer=(e,t)=>i.headerRenderFunction({root:e,column:t}))}catch(s){}}};e([d()],tl.prototype,"_grid",void 0),e([a("viewModel.cellClassNameGenerator")],tl.prototype,"cellClassNameGenerator",void 0),e([a("viewModel.columns")],tl.prototype,"columns",void 0),e([a("viewModel.columnReorderingEnabled")],tl.prototype,"columnReorderingEnabled",void 0),e([a("viewModel.dataProvider")],tl.prototype,"dataProvider",void 0),e([d()],tl.prototype,"itemIdPath",void 0),e([d({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],tl.prototype,"label",void 0),e([d(),_("esri/widgets/FeatureTable/t9n/FeatureTable")],tl.prototype,"messages",void 0),e([a("viewModel.pageSize")],tl.prototype,"pageSize",void 0),e([d({readOnly:!0})],tl.prototype,"selectedItems",void 0),e([a("viewModel.size")],tl.prototype,"size",void 0),e([a("viewModel.rowDetailsRenderer")],tl.prototype,"rowDetailsRenderer",void 0),e([a("viewModel.store")],tl.prototype,"store",void 0),e([d()],tl.prototype,"viewModel",void 0),e([d()],tl.prototype,"visibleElements",void 0),e([l("visibleElements")],tl.prototype,"castVisibleElements",null),e([a("viewModel.findColumn")],tl.prototype,"findColumn",null),tl=e([h("esri.widgets.FeatureTable.Grid.Grid")],tl);var il=tl;export{il as default};
|
|
959
|
+
`}static get is(){return"vaadin-grid-sort-column"}static get properties(){return{path:String,direction:{type:String,notify:!0}}}_prepareHeaderTemplate(){const e=this._prepareTemplatizer(this.$.headerTemplate);return e.templatizer.dataHost=this,e}_getHeader(e,t){return e||this._generateHeader(t)}}customElements.define(Ka.is,Ka);const Qa={selectionColumn:!0},el={base:"esri-grid",content:"esri-grid__content",grid:"esri-grid__grid",widget:"esri-widget"};let tl=class extends(s(c)){constructor(e,i){super(e,i),this._grid=null,this._headerStyles="display: flex; font-weight: 400;",this._hostStyles='font-family: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 1em; background-color: inherit; color: inherit;',this._rowHoverStyles="background-color: var(--lumo-row-background-hover);",this._columnElements=[],this.cellClassNameGenerator=null,this.columnReorderingEnabled=!0,this.dataProvider=null,this.itemIdPath=null,this.label=void 0,this.messages=null,this.pageSize=50,this.selectedItems=new t,this.size=null,this.rowDetailsRenderer=null,this.store=null,this.viewModel=new u,this.visibleElements={...Qa}}initialize(){this.handles.add([this.columns.on("change",(()=>this._syncColumnRenderers())),n(this,"viewModel.size",(()=>this._updateGridSize())),n(this,"store.state",((e,t)=>{"ready"!==e||"loaded"!==t&&"error"!==t||this.refreshCache()})),o(this,"_grid.$.table","scroll",(()=>{var e;null==(e=this.viewModel)||e.closeColumnMenus()}))])}destroy(){var e;this.handles.removeAll(),this.resetColumns(),null==(e=this.columns)||e.destroy()}resetColumns(){this.columns.items.forEach((e=>e.destroy())),this.columns.removeAll()}castVisibleElements(e){return{...Qa,...e}}render(){return m("div",{bind:this,class:this.classes(el.base,el.widget)},m("div",{bind:this,class:el.content},this.renderGrid()))}renderGrid(){return m("vaadin-grid",{...this.getGridProps()},this.renderAllColumns())}renderAllColumns(){if("disabled"!==this.viewModel.state&&this.columns&&this.columns.length)return[this.renderSelectionColumn(),this.renderColumns()]}renderSelectionColumn(){return m("vaadin-grid-selection-column",{_selectAllHidden:!0,selectAll:!1,bind:this,hidden:!this.visibleElements.selectionColumn,sortable:!1,frozen:!p(this.container)})}renderColumns(){return this.columns.items.map(((e,t)=>m("vaadin-grid-column",{...this.getColumnProps(e,t)})))}getGridProps(){const{columnReorderingEnabled:e,id:t,pageSize:i,size:s}=this;return{_safari:!1,class:el.grid,id:`${t}_grid`,theme:"compact column-borders",ref:"grid",bind:this,afterCreate:this._afterGridCreate,afterUpdate:this._afterGridUpdate,columnReorderingAllowed:e,pageSize:i,size:s}}getColumnProps(e,t){const{id:i}=this,{autoWidth:s,direction:n,flexGrow:o,frozen:a,header:l,hidden:d,path:h,resizable:c,textAlign:u,width:p}=e;return{autoWidth:s,direction:n,flexGrow:o,frozen:a,header:l,hidden:d,key:`${i}_${name}_${r(t)?t:h}`,path:h,resizable:c,"text-align":u,width:"number"==typeof p?`${p}px`:p,bind:this,afterCreate:this._afterColumnCreate,afterRemoved:this._afterColumnRemoved}}clearSelection(){this._clearSelection(),this.scheduleRender()}clearSort(){let e=!1;if(this._grid&&this._grid._sorters&&this._grid._sorters.length&&(this._grid._sorters=[],e=!0),this.columns&&this.columns.length){!!this.columns.find((e=>!!e.direction))&&(this.columns.forEach((e=>e.direction=null)),e=!0)}e&&this.scheduleRender()}deselectItem(e){this._deselectRowByItem(e)}deselectRow(e){const t=this.viewModel.getRowItemAt(e);t&&this._deselectRowByItem(t)}findColumn(){}generateCellClassNames(){var e;null==(e=this._grid)||e.generateCellClassNames()}getSlotElementByName(e){var t,i;return null==(t=this._grid)||null==(i=t.shadowRoot)?void 0:i.querySelector(`slot[name='${e}']`)}hideColumn(e){var t;null==(t=this.viewModel)||t.hideColumn(e),this.scheduleRender()}notifyResize(){var e;null==(e=this._grid)||e.notifyResize()}recalculateColumnWidths(){var e;null==(e=this._grid)||e.recalculateColumnWidths()}async refresh(){var e;this._clearSelection(),await(null==(e=this.store)?void 0:e.reset()),this.scrollToTop()}refreshCache(){var e;null==(e=this._grid)||e.clearCache()}selectRows(e){const t=this._grid.selectedItems.slice();e.forEach((e=>{t.findIndex((t=>t.objectId===e.objectId))<0&&this._grid.selectedItems.push(e)})),this._updateSelectionProps(),this._grid.render()}deselectRows(e){const t=this._grid.selectedItems.slice();e.forEach((e=>{const i=t.findIndex((t=>t.objectId===e.objectId));i>-1&&t.splice(i,1)})),this._grid.selectedItems=t,this._updateSelectionProps(),this._grid.render()}selectItem(e){this._selectRowByItem(e)}selectRow(e){const t=this.viewModel.getRowItemAt(e);t&&this._selectRowByItem(t)}showColumn(e){var t;null==(t=this.viewModel)||t.showColumn(e),this.scheduleRender()}sort({path:e,direction:t}){var i;null==(i=this.viewModel)||i.sortColumn(e,t)}scrollToIndex(e){var t;null==(t=this._grid)||t.scrollToIndex(e)}scrollToTop(){var e;null==(e=this._grid)||e.scrollToIndex(0)}_afterGridCreate(e){const{cellClassNameGenerator:t,dataProvider:i,itemIdPath:s,rowDetailsRenderer:r}=this;e.cellClassNameGenerator=t,e.dataProvider=i,e.rowDetailsRenderer=r,e.itemIdPath=s,this._grid=e,customElements.whenDefined("vaadin-grid").then((()=>{this._appendStyles(),this._addGridEventListeners()}))}_afterGridUpdate(e){this._grid||(this._grid=e)}_afterColumnCreate(e){this._applyRenderersToColumnElement(e),this._columnElements.push(e)}_afterColumnRemoved(e){const t=this._columnElements.indexOf(e,0);t>-1&&this._columnElements.splice(t,1)}_syncColumnRenderers(){this._columnElements.forEach((e=>this._applyRenderersToColumnElement(e)))}_appendStyles(){var e;const t=null==(e=this._grid)?void 0:e.shadowRoot,i=document.createElement("style");i.textContent=`\n :host { ${this._hostStyles} }\n [part~="header-cell"] ::slotted(vaadin-grid-cell-content) { ${this._headerStyles} }\n [part~="row"]:hover [part~="body-cell"] { ${this._rowHoverStyles} }\n `,null==t||t.appendChild(i)}_updateGridSize(){this._grid&&(this._grid.size=this.size||0,this.scheduleRender())}_addGridEventListeners(){const{_grid:e}=this;this.handles.add([i(e,"click",(e=>this._onRowClick(e))),i(e,"selected-items-changed",(e=>this._onSelectionChange(e)))])}_onRowClick(e){const{_grid:t}=this,i=t.getEventContext(event),{item:s,section:r}=i;s&&r&&"details"!==r&&"header"!==r&&this.emit("row-click",{context:i,native:e})}_selectRowByItem(e){var t;null==(t=this._grid)||t.selectItem(e)}_deselectRowByItem(e){var t;null==(t=this._grid)||t.deselectItem(e)}_clearSelection(){var e,t;null!=(e=this._grid)&&null!=(t=e.selectedItems)&&t.length&&(this._grid.selectedItems=[],this._updateSelectionProps(),this._grid.render())}_onSelectionChange(e){const t=e;if("selectedItems.splices"===t.detail.path){const{removed:e,index:i,object:s}=t.detail.value.indexSplices[0];this._updateSelectionProps(),this.emit("selection-change",{index:i,added:s,removed:e})}}_updateSelectionProps(){this.selectedItems.length&&this.selectedItems.removeAll(),this._grid&&this.selectedItems.addMany(this._grid.selectedItems)}_applyRenderersToColumnElement(e){const t=e.getAttribute("path"),i=this.viewModel.findColumn(t);if(i)try{i.renderFunction&&(e.renderer=(e,t,s)=>i.renderFunction({root:e,column:t,rowData:s})),i.footerRenderFunction&&(e.footerRenderer=(e,t)=>i.footerRenderFunction({root:e,column:t})),i.headerRenderFunction&&(e.headerRenderer=(e,t)=>i.headerRenderFunction({root:e,column:t}))}catch(s){}}};e([d()],tl.prototype,"_grid",void 0),e([a("viewModel.cellClassNameGenerator")],tl.prototype,"cellClassNameGenerator",void 0),e([a("viewModel.columns")],tl.prototype,"columns",void 0),e([a("viewModel.columnReorderingEnabled")],tl.prototype,"columnReorderingEnabled",void 0),e([a("viewModel.dataProvider")],tl.prototype,"dataProvider",void 0),e([d()],tl.prototype,"itemIdPath",void 0),e([d({aliasOf:{source:"messages.widgetLabel",overridable:!0}})],tl.prototype,"label",void 0),e([d(),_("esri/widgets/FeatureTable/t9n/FeatureTable")],tl.prototype,"messages",void 0),e([a("viewModel.pageSize")],tl.prototype,"pageSize",void 0),e([d({readOnly:!0})],tl.prototype,"selectedItems",void 0),e([a("viewModel.size")],tl.prototype,"size",void 0),e([a("viewModel.rowDetailsRenderer")],tl.prototype,"rowDetailsRenderer",void 0),e([a("viewModel.store")],tl.prototype,"store",void 0),e([d()],tl.prototype,"viewModel",void 0),e([d()],tl.prototype,"visibleElements",void 0),e([l("visibleElements")],tl.prototype,"castVisibleElements",null),e([a("viewModel.findColumn")],tl.prototype,"findColumn",null),tl=e([h("esri.widgets.FeatureTable.Grid.Grid")],tl);var il=tl;export{il 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.21/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import a from"../../core/Accessor.js";import{HandleOwnerMixin as i}from"../../core/HandleOwner.js";import{init as t}from"../../core/watchUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import"../../core/Logger.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import r from"./ScaleRanges.js";import n from"../Slider/SliderViewModel.js";let c=class extends(i(a)){constructor(e){super(e),this.layer=null,this.scaleRanges=r.fromScaleRange({minScale:0,maxScale:0}),this.sliderViewModel=(()=>{const{max:e}=this._getSliderIndexRange(this.scaleRanges.length-1);return new n({precision:10,min:0,max:e,values:[0,e]})})()}initialize(){this.handles.add([t(this,"sliderViewModel.values",(()=>{if(!this._hasTiledLayer())return;const[e,a]=this.sliderViewModel.values,i=this.mapScaleToSlider(this._getTiledLayerMaxScale()),t=this.mapScaleToSlider(this._getTiledLayerMinScale());(a>i||e<t)&&(this.sliderViewModel.values=[Math.max(e,t),Math.min(a,i)])})),t(this,"layer.loaded",(async()=>{const{layer:e,view:a}=this;if(e)if(a&&await a.when(),await e.when(),"minScale"in e&&"maxScale"in e){const{minScale:a,maxScale:i}=e;this.set({minScale:a,maxScale:i})}else this.set({minScale:void 0,maxScale:void 0})}))])}get maxScale(){const e=this.mapSliderToScale(this.sliderViewModel.values[1]);return this.
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import a from"../../core/Accessor.js";import{HandleOwnerMixin as i}from"../../core/HandleOwner.js";import{init as t}from"../../core/watchUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/has.js";import"../../core/accessorSupport/ensureType.js";import"../../core/Logger.js";import{subclass as s}from"../../core/accessorSupport/decorators/subclass.js";import r from"./ScaleRanges.js";import n from"../Slider/SliderViewModel.js";let c=class extends(i(a)){constructor(e){super(e),this.layer=null,this.scaleRanges=r.fromScaleRange({minScale:0,maxScale:0}),this.sliderViewModel=(()=>{const{max:e}=this._getSliderIndexRange(this.scaleRanges.length-1);return new n({precision:10,min:0,max:e,values:[0,e]})})()}initialize(){this.handles.add([t(this,"sliderViewModel.values",(()=>{if(!this._hasTiledLayer())return;const[e,a]=this.sliderViewModel.values,i=this.mapScaleToSlider(this._getTiledLayerMaxScale()),t=this.mapScaleToSlider(this._getTiledLayerMinScale());(a>i||e<t)&&(this.sliderViewModel.values=[Math.max(e,t),Math.min(a,i)])})),t(this,"layer.loaded",(async()=>{const{layer:e,view:a}=this;if(e)if(a&&await a.when(),await e.when(),"minScale"in e&&"maxScale"in e){const{minScale:a,maxScale:i}=e;this.set({minScale:a,maxScale:i})}else this.set({minScale:void 0,maxScale:void 0})}))])}get maxScale(){const e=this.mapSliderToScale(this.sliderViewModel.values[1]);return this._normalizeScale("max",e)}set maxScale(e){this._setMaxScaleOnSlider(e)}get maxScaleLimit(){return this.mapSliderToScale(this.sliderViewModel.max)}set maxScaleLimit(e){this._setSliderRange({maxScale:e,minScale:this.minScaleLimit})}get minScale(){const e=this.mapSliderToScale(this.sliderViewModel.values[0]);return this._normalizeScale("min",e)}set minScale(e){this._setMinScaleOnSlider(e)}get minScaleLimit(){return this.mapSliderToScale(this.sliderViewModel.min)}set minScaleLimit(e){this._setSliderRange({maxScale:this.maxScaleLimit,minScale:e})}get state(){const{view:e,layer:a}=this;return!e&&!a||!e&&a&&a.loaded||!a&&e&&e.ready||e&&e.ready&&a&&a.loaded?"ready":"disabled"}set view(e){this._set("view",e)}mapScaleToSlider(e){const a=this.scaleRanges.scaleToRangeIndex(e),i=this.scaleRanges.findScaleRangeByIndex(a),{maxScale:t,minScale:l}=i,{max:s,min:r}=this._getSliderIndexRange(a);return this._mapToRange(e,l,t,r,s)}mapSliderToScale(e){const a=this.scaleRanges.findScaleRangeByIndex(e),{maxScale:i,minScale:t}=a,{max:l,min:s}=this._getSliderIndexRange(e);return this._mapToRange(e,s,l,t,i)}_setSliderRange(e){this.scaleRanges=r.fromScaleRange(e);const{max:a}=this._getSliderIndexRange(this.scaleRanges.length-1);this.sliderViewModel.max=a,this.sliderViewModel.min=0,this.notifyChange("maxScaleLimit"),this.notifyChange("minScaleLimit")}_getSliderIndexRange(e){const a=Math.floor(e);return{min:a,max:a+.99999}}_mapToRange(e,a,i,t,l){return t+(e-a)*(l-t)/(i-a)}_setMaxScaleOnSlider(e){const{scaleRanges:a,sliderViewModel:i}=this;if(void 0!==e){const t=this.mapScaleToSlider(this._constrainMaxScaleToLayer(a.clampMaxScale(e)));i.values=[i.values[0],t]}}_setMinScaleOnSlider(e){const{scaleRanges:a,sliderViewModel:i}=this;if(void 0!==e){const t=this.mapScaleToSlider(this._constrainMinScaleToLayer(a.clampMinScale(e)));i.values=[t,i.values[1]]}}_constrainMinScaleToLayer(e){const{scaleRanges:a}=this;if(this._hasTiledLayer()){const{firstRange:i}=a,t=this._getTiledLayerMinScale(),l=.85;e=this._mapToRange(e,i.maxScale,i.minScale,0,1)>l||e>t?t:e}return e}_constrainMaxScaleToLayer(e){if(this._hasTiledLayer()){const a=this._getTiledLayerMaxScale();e=e<a?a:e}return e}_normalizeScale(e,a){const i="max"===e?"maxScale":"minScale",t=this._hasTiledLayer()?"min"===e?this._getTiledLayerMinScale():this._getTiledLayerMaxScale():this.scaleRanges[i],l=1e-6,s=0===a||t===a||Math.abs(t-a)<=l;return Number((s?0:a).toFixed(6))}_getLayerLODS(){var e,a;return"imagery-tile"===(null==(e=this.layer)?void 0:e.type)&&"Raster"===(null==(a=this.layer.raster)?void 0:a.tileType)?null:this.get("layer.tileInfo.lods")}_getTiledLayerMinScale(){const e=this._getLayerLODS();return this.scaleRanges.clampMinScale(e[0].scale)}_getTiledLayerMaxScale(){const e=this._getLayerLODS();return e[e.length-1].scale}_hasTiledLayer(){return!!this._getLayerLODS()}};e([l()],c.prototype,"layer",void 0),e([l()],c.prototype,"maxScale",null),e([l()],c.prototype,"maxScaleLimit",null),e([l()],c.prototype,"minScale",null),e([l()],c.prototype,"minScaleLimit",null),e([l()],c.prototype,"scaleRanges",void 0),e([l()],c.prototype,"sliderViewModel",void 0),e([l({readOnly:!0})],c.prototype,"state",null),e([l()],c.prototype,"view",null),c=e([s("esri.widgets.ScaleRangeSlider.ScaleRangeSliderViewModel")],c);var o=c;export{o as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkRemoteClient=self.webpackChunkRemoteClient||[]).push([[2134,3172],{68773:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(16358),o=(r(80442),r(78286)),s=r(17202);const i={apiKey:void 0,applicationUrl:n.Z.location&&n.Z.location.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryService:null,geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",portalUrl:"https://www.arcgis.com",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],maxUrlLength:2e3,proxyRules:[],proxyUrl:null,timeout:6e4,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(n.Z.esriConfig&&((0,o.RH)(i,n.Z.esriConfig,!0),delete i.has),!i.assetsPath){const e="4.21.0";i.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}-next.${s.r}/assets`}i.baseUrl&&console.warn("[esri.config]","baseUrl has been replaced by assetsPath"),Object.defineProperty(i,"baseUrl",{set(){console.warn("[esri.config]","baseUrl has been replaced by assetsPath")}}),i.request.corsEnabledServers=[],i.request.corsEnabledServers.push=function(){return console.warn("[esri.config]","request.corsEnabledServers is not supported and will be removed in a future release. See http://esriurl.com/cors8664"),0}},20102:(e,t,r)=>{r.d(t,{Z:()=>i});var n=r(22974),o=r(92604),s=r(58896);class i extends s.Z{constructor(e,t,r){if(super(e,t,r),!(this instanceof i))return new i(e,t,r)}toJSON(){if(null!=this.details)try{return{name:this.name,message:this.message,details:JSON.parse(JSON.stringify(this.details,((e,t)=>{if(t&&"object"==typeof t&&"function"==typeof t.toJSON)return t;try{return(0,n.d9)(t)}catch(e){return"[object]"}})))}}catch(e){throw o.Z.getLogger("esri.core.Error").error(e),e}return{name:this.name,message:this.message,details:this.details}}static fromJSON(e){return new i(e.name,e.message,e.details)}}i.prototype.type="error"},92604:(e,t,r)=>{r.d(t,{Z:()=>a});var n=r(68773),o=(r(80442),r(70586)),s=r(19153);const i={info:0,warn:1,error:2,none:3};class a{constructor(e){this.level=null,this._module="",this._parent=null,this.writer=null,this._loggedMessages={error:new Map,warn:new Map,info:new Map},null!=e.level&&(this.level=e.level),null!=e.writer&&(this.writer=e.writer),this._module=e.module,a._loggers[this.module]=this;const t=this.module.lastIndexOf(".");-1!==t&&(this._parent=a.getLogger(this.module.slice(0,t)))}get module(){return this._module}get parent(){return this._parent}error(...e){this._log("error","always",...e)}warn(...e){this._log("warn","always",...e)}info(...e){this._log("info","always",...e)}errorOnce(...e){this._log("error","once",...e)}warnOnce(...e){this._log("warn","once",...e)}infoOnce(...e){this._log("info","once",...e)}errorOncePerTick(...e){this._log("error","oncePerTick",...e)}warnOncePerTick(...e){this._log("warn","oncePerTick",...e)}infoOncePerTick(...e){this._log("info","oncePerTick",...e)}get test(){const e=this;return{loggedMessages:e._loggedMessages,clearLoggedWarnings:()=>e._loggedMessages.warn.clear()}}static get testSingleton(){return{resetLoggers(e={}){const t=a._loggers;return a._loggers=e,t},set throttlingDisabled(e){a._throttlingDisabled=e}}}static getLogger(e){let t=a._loggers[e];return t||(t=new a({module:e})),t}_log(e,t,...r){if(this._matchLevel(e)){if("always"!==t&&!a._throttlingDisabled){const n=this._argsToKey(r),o=this._loggedMessages[e].get(n);if("once"===t&&null!=o||"oncePerTick"===t&&o&&o>=a._tickCounter)return;this._loggedMessages[e].set(n,a._tickCounter),a._scheduleTickCounterIncrement()}for(const t of n.Z.log.interceptors)if(t(e,this.module,...r))return;this._inheritedWriter()(e,this.module,...r)}}_parentWithMember(e,t){let r=this;for(;(0,o.pC)(r);){const t=r[e];if((0,o.pC)(t))return t;r=r.parent}return t}_inheritedWriter(){return this._parentWithMember("writer",this._consoleWriter)}_consoleWriter(e,t,...r){console[e](`[${t}]`,...r)}_matchLevel(e){const t=n.Z.log.level?n.Z.log.level:"warn";return i[this._parentWithMember("level",t)]<=i[e]}_argsToKey(...e){return(0,s.hP)(JSON.stringify(e,((e,t)=>"object"!=typeof t||Array.isArray(t)?t:"[Object]")))}static _scheduleTickCounterIncrement(){a._tickCounterScheduled||(a._tickCounterScheduled=!0,Promise.resolve().then((()=>{a._tickCounter++,a._tickCounterScheduled=!1})))}}a._loggers={},a._tickCounter=0,a._tickCounterScheduled=!1,a._throttlingDisabled=!1},58896:(e,t,r)=>{r.d(t,{Z:()=>o});var n=r(78286);class o{constructor(e,t,r){this.name=e,this.details=r,this.message=void 0,this instanceof o&&(this.message=t&&function(e,t){return e.replace(/\$\{([^\s\:\}]*)(?:\:([^\s\:\}]+))?\}/g,(function(e,r){if(""===r)return"$";const o=(0,n.hS)(r,t),s=null==o?"":o;if(void 0===s)throw new Error(`could not find key "${r}" in template`);return s.toString()}))}(t,r)||"")}toString(){return"["+this.name+"]: "+this.message}}},91460:(e,t,r)=>{function n(e){return e&&("function"==typeof e.on||"function"==typeof e.addEventListener)}function o(e,t,r){if(!n(e))throw new TypeError("target is not a Evented or EventTarget object");if("on"in e)return e.on(t,r);if(Array.isArray(t)){const n=t.slice();for(const t of n)e.addEventListener(t,r);return{remove(){for(const t of n)e.removeEventListener(t,r)}}}return e.addEventListener(t,r),{remove(){e.removeEventListener(t,r)}}}function s(e,t,r){if(!n(e))throw new TypeError("target is not a Evented or EventTarget object");if("once"in e)return e.once(t,r);const s=o(e,t,(t=>{s.remove(),r.call(e,t)}));return{remove(){s.remove()}}}r.d(t,{vT:()=>n,on:()=>o,IH:()=>s})},16358:(e,t,r)=>{r.d(t,{Z:()=>n});const n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0},80442:(e,t,r)=>{r.d(t,{Z:()=>u});var n,o,s=r(16358);let i;var a,c;function u(e){return"function"==typeof i[e]?i[e]=i[e](s.Z):i[e]}i=null!=(n=s.Z.dojoConfig)&&n.has||null!=(o=s.Z.esriConfig)&&o.has?{...null==(a=s.Z.dojoConfig)?void 0:a.has,...null==(c=s.Z.esriConfig)?void 0:c.has}:{},u.add=(e,t,r,n)=>((n||void 0===i[e])&&(i[e]=t),r&&u(e)),u.cache=i,u.add("esri-deprecation-warnings",!0),(()=>{u.add("host-webworker",void 0!==s.Z.WorkerGlobalScope&&self instanceof s.Z.WorkerGlobalScope);const e="undefined"!=typeof window&&"undefined"!=typeof location&&"undefined"!=typeof document&&window.location===location&&window.document===document;if(u.add("host-browser",e),u.add("host-node","object"==typeof s.Z.process&&s.Z.process.versions&&s.Z.process.versions.node&&s.Z.process.versions.v8),u.add("dom",e),u("host-browser")){const e=navigator,t=e.userAgent,r=e.appVersion,n=parseFloat(r);if(u.add("wp",parseFloat(t.split("Windows Phone")[1])||void 0),u.add("msapp",parseFloat(t.split("MSAppHost/")[1])||void 0),u.add("khtml",r.includes("Konqueror")?n:void 0),u.add("edge",parseFloat(t.split("Edge/")[1])||void 0),u.add("opr",parseFloat(t.split("OPR/")[1])||void 0),u.add("webkit",!u("wp")&&!u("edge")&&parseFloat(t.split("WebKit/")[1])||void 0),u.add("chrome",!u("edge")&&!u("opr")&&parseFloat(t.split("Chrome/")[1])||void 0),u.add("android",!u("wp")&&parseFloat(t.split("Android ")[1])||void 0),u.add("safari",!r.includes("Safari")||u("wp")||u("chrome")||u("android")||u("edge")||u("opr")?void 0:parseFloat(r.split("Version/")[1])),u.add("mac",r.includes("Macintosh")),!u("wp")&&t.match(/(iPhone|iPod|iPad)/)){const e=RegExp.$1.replace(/P/,"p"),r=t.match(/OS ([\d_]+)/)?RegExp.$1:"1",n=parseFloat(r.replace(/_/,".").replace(/_/g,""));u.add(e,n),u.add("ios",n)}u.add("trident",parseFloat(r.split("Trident/")[1])||void 0),u("webkit")||(!t.includes("Gecko")||u("wp")||u("khtml")||u("trident")||u("edge")||u.add("mozilla",n),u("mozilla")&&u.add("ff",parseFloat(t.split("Firefox/")[1]||t.split("Minefield/")[1])||void 0))}})(),(()=>{if(s.Z.navigator){const e=navigator.userAgent,t=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini|IEMobile/i.test(e),r=/iPhone/i.test(e);t&&u.add("esri-mobile",t),r&&u.add("esri-iPhone",r),u.add("esri-geolocation",!!navigator.geolocation)}u.add("esri-canvas-svg-support",!u("trident")),u.add("esri-wasm","WebAssembly"in s.Z),u.add("esri-shared-array-buffer",(()=>{const e="SharedArrayBuffer"in s.Z,t=!1===s.Z.crossOriginIsolated;return e&&!t})),u.add("esri-atomics","Atomics"in s.Z),u.add("esri-workers","Worker"in s.Z),u.add("esri-text-decoder","TextDecoder"in s.Z),u.add("esri-text-encoder","TextEncoder"in s.Z),u.add("web-feat:cache","caches"in s.Z),u.add("esri-workers-arraybuffer-transfer",!u("safari")||Number(u("safari"))>=12),u.add("featurelayer-snapshot-enabled",!0),u.add("featurelayer-snapshot-point-min-threshold",8e4),u.add("featurelayer-snapshot-point-max-threshold",4e5),u.add("featurelayer-snapshot-point-coverage",.1),u.add("featurelayer-advanced-symbols",!1),u.add("featurelayer-pbf",!0),u.add("featurelayer-pbf-statistics",!1),u.add("feature-layers-workers",!0),u.add("mapview-transitions-duration",200),u.add("mapserver-pbf-enabled",!1),u("host-webworker")||u("host-browser")&&(u.add("csp-restrictions",(()=>{try{new Function}catch{return!0}return!1})),u.add("esri-image-decode",(()=>{if("decode"in new Image){const e=new Image;return e.src='data:image/svg+xml;charset=UTF-8,<svg version="1.1" xmlns="http://www.w3.org/2000/svg"></svg>',void e.decode().then((()=>{u.add("esri-image-decode",!0,!0,!0)})).catch((()=>{u.add("esri-image-decode",!1,!0,!0)}))}return!1})),u.add("esri-url-encodes-apostrophe",(()=>{const e=s.Z.document.createElement("a");return e.href="?'",e.href.includes("?%27")})),u.add("vectortilelayer-max-buffers",u("ff")?160:Number.POSITIVE_INFINITY))})()},22974:(e,t,r)=>{r.d(t,{d9:()=>s,fS:()=>i,yd:()=>o}),r(80442);var n=r(1533);function o(e,t){let r;if(t)for(r in e)e.hasOwnProperty(r)&&(void 0===e[r]?delete e[r]:e[r]instanceof Object&&o(e[r],!0));else for(r in e)e.hasOwnProperty(r)&&void 0===e[r]&&delete e[r];return e}function s(e){if(!e||"object"!=typeof e||"function"==typeof e)return e;if((0,n.W0)(e)||(0,n.lq)(e)||(0,n.KZ)(e)||(0,n.z3)(e)||(0,n.Uc)(e)||(0,n.Hx)(e)||(0,n.ZY)(e)||(0,n.xZ)(e)||(0,n.fS)(e))return(0,n.tP)(e);if(e instanceof Date)return new Date(e.getTime());if(e instanceof ArrayBuffer)return e.slice(0,e.byteLength);if(e instanceof Map){const t=new Map;return e.forEach(((e,r)=>{t.set(r,s(e))})),t}if(e instanceof Set){const t=new Set;return e.forEach((e=>{t.add(s(e))})),t}let t;const r=e;if("function"==typeof r.clone)t=r.clone();else if("function"==typeof r.map&&"function"==typeof r.forEach)t=r.map(s);else if("function"==typeof r.notifyChange&&"function"==typeof r.watch)t=r.clone();else{t={};for(const r of Object.getOwnPropertyNames(e))t[r]=s(e[r])}return t}function i(e,t){return e===t||"number"==typeof e&&isNaN(e)&&"number"==typeof t&&isNaN(t)||"function"==typeof(e||{}).getTime&&"function"==typeof(t||{}).getTime&&e.getTime()===t.getTime()||!1}},70586:(e,t,r)=>{function n(e){return null!=e}function o(e){return null==e}function s(e){return void 0===e}function i(e,t){return n(e)?t(e):null}function a(e){return e}function c(e,t){if(o(e))throw new Error(t);return e}function u(e,t){return n(e)?e:"function"==typeof t?t():t}function l(e){return n(e)&&e.destroy(),null}function d(e){return n(e)&&e.dispose(),null}function f(e){return n(e)&&e.remove(),null}function h(e){return n(e)&&e.release(),null}function p(e){return null}function m(e,t){const r=new Array;for(const n of e)r.push(y(n,null,t));return r}function g(e,t){for(const r of e)y(r,null,t)}function y(e,t,r){return n(e)?r(e):t}function w(e,t){return n(e)?t(e):null}function b(e){return e.filter((e=>n(e)))}function v(e,...t){let r=e;for(let e=0;e<t.length&&r;++e)r=r[t[e]];return r}function O(e){return e}r.d(t,{Po:()=>w,yw:()=>i,j0:()=>O,SC:()=>l,O3:()=>d,lV:()=>b,JR:()=>g,U2:()=>v,Wi:()=>o,pC:()=>n,o8:()=>s,Fd:()=>m,R2:()=>y,Bd:()=>p,RY:()=>h,hw:()=>f,Wg:()=>a,Pt:()=>u,s3:()=>c})},78286:(e,t,r)=>{r.d(t,{RH:()=>o,hS:()=>s,RB:()=>i});var n=r(22974);function o(e,t,r=!1){return c(e,t,r)}function s(e,t){if(null!=t)return t[e]||a(e.split("."),!1,t)}function i(e,t,r){const n=e.split("."),o=n.pop(),s=a(n,!0,r);s&&o&&(s[o]=t)}function a(e,t,r){let n=r;for(const r of e){if(null==n)return;if(!(r in n)){if(!t)return;n[r]={}}n=n[r]}return n}function c(e,t,r){return t?Object.keys(t).reduce((function(e,o){let s=e[o],i=t[o];return s===i?e:void 0===s?(e[o]=(0,n.d9)(i),e):(Array.isArray(i)||Array.isArray(e)?(s=s?Array.isArray(s)?e[o]=s.concat():e[o]=[s]:e[o]=[],i&&(Array.isArray(i)||(i=[i]),r?i.forEach((e=>{-1===s.indexOf(e)&&s.push(e)})):e[o]=i.concat())):i&&"object"==typeof i?e[o]=c(s,i,r):e.hasOwnProperty(o)&&!t.hasOwnProperty(o)||(e[o]=i),e)}),e||{}):e}},95330:(e,t,r)=>{r.d(t,{e4:()=>P,$6:()=>c,Ue:()=>u,yi:()=>d,zE:()=>l,dD:()=>x,hh:()=>$,vr:()=>U,Ds:()=>_,as:()=>k,WW:()=>C,R8:()=>O,D_:()=>v,Hc:()=>p,tI:()=>Z,y8:()=>q,fu:()=>y,$F:()=>w,d1:()=>S,DB:()=>T,r9:()=>m,k_:()=>f,H9:()=>g,gx:()=>E,Hl:()=>b});var n,o=(n=r(16358).Z,{setTimeout:(e,t)=>{const r=n.setTimeout(e,t);return{remove:()=>n.clearTimeout(r)}}}),s=r(20102),i=r(91460),a=(r(92604),r(70586));function c(e){return Promise.all(e)}function u(e){return new Promise(((t,r)=>{try{e(t,r)}catch(e){Promise.resolve().then((()=>r(e)))}}))}function l(e="Aborted"){return new s.Z("AbortError",e)}function d(){return new AbortController}function f(e,t="Aborted"){if(p(e))throw l(t)}function h(e){return(0,a.pC)(e)?"aborted"in e?e:e.signal:e}function p(e){const t=h(e);return(0,a.pC)(t)&&t.aborted}function m(e){if(v(e))throw e}function g(e){if(!v(e))throw e}function y(e,t){const r=h(e);if(!(0,a.Wi)(r)){if(!r.aborted)return(0,i.IH)(r,"abort",(()=>t()));t()}}function w(e,t){const r=h(e);if(!(0,a.Wi)(r))return f(r),(0,i.IH)(r,"abort",(()=>t(l())))}function b(e,t){const r=h(t);return(0,a.Wi)(r)?e:new Promise(((r,n)=>{let o=y(t,(()=>n(l())));const s=()=>o=(0,a.hw)(o);e.then(s,s),e.then(r,n)}))}function v(e){return e&&"AbortError"===e.name}function O(e){return e.catch((e=>{if(!v(e))throw e}))}function x(){let e=null;const t=new Promise(((t,r)=>{e={promise:void 0,resolve:t,reject:r}}));return e.promise=t,e}function k(e){if(!e)return;if("function"!=typeof e.forEach){const t=Object.keys(e);return k(t.map((t=>e[t]))).then((e=>{const r={};return t.forEach(((t,n)=>r[t]=e[n])),r}))}const t=e;return u((e=>{const r=[];let n=t.length;0===n&&e(r),t.forEach((t=>{const o={promise:t||Promise.resolve(t)};r.push(o),o.promise.then((e=>{o.value=e})).catch((e=>{o.error=e})).then((()=>{--n,0===n&&e(r)}))}))}))}function C(e){return k(e).then((e=>e.filter((e=>!!e.value)).map((e=>e.value))))}function S(e){return Promise.reject(e)}function T(e){return Promise.resolve(e)}function P(e,t,r){const n=d();return y(r,(()=>n.abort())),new Promise(((r,o)=>{let s=setTimeout((()=>{s=0,r(t)}),e);y(n,(()=>{s&&(clearTimeout(s),o(l()))}))}))}function q(e){return e&&"function"==typeof e.then}function E(e){return Z(e)?e:Promise.resolve(e)}function Z(e){return e&&"object"==typeof e&&"then"in e&&"function"==typeof e.then}function _(e,t=-1){let r,n,o,s,i=null;const c=(...u)=>{if(r){n=u,s&&s.reject(l()),s=x();const e=(0,a.j0)(s.promise);if(i){const e=i;i=null,e.abort()}return e}if(o=s||x(),s=null,t>0){const n=d();r=E(e(...u,n.signal));const o=r;P(t).then((()=>{r===o&&(s?n.abort():i=n)}))}else r=1,r=E(e(...u));const f=()=>{const e=n;n=o=r=i=null,null!=e&&c(...e)},h=r,p=o;return h.then(f,f),h.then(p.resolve,p.reject),(0,a.j0)(p.promise)};return c}function $(){let e,t;const r=new Promise(((r,n)=>{e=r,t=n})),n=t=>{e(t)};return n.resolve=t=>e(t),n.reject=e=>t(e),n.timeout=(e,t)=>o.setTimeout((()=>n.reject(t)),e),n.promise=r,n}function U(e){let t=d();const r=e(t.signal);let n={promise:r,finished:!1,abort:()=>{t&&(t.abort(),t=null)}};const o=()=>{n&&(n.finished=!0,n=null),t=null};return r.then(o,o),n}},19153:(e,t,r)=>{r.d(t,{Qs:()=>a,hP:()=>c,gx:()=>i,Cb:()=>u});var n=r(78286);const o=/\{([^\}]+)\}/g;function s(e){return null==e?"":e}function i(e,t){return e.replace(o,"object"==typeof t?(e,r)=>s((0,n.hS)(r,t)):(e,r)=>s(t(r)))}function a(e,t){return e.replace(/([\.$?*|{}\(\)\[\]\\\/\+\-^])/g,(e=>t&&-1!==t.indexOf(e)?e:`\\${e}`))}function c(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return t}function u(e){return(new DOMParser).parseFromString(e||"","text/html").body.innerText||""}},1533:(e,t,r)=>{function n(e,t){if(e.forEach)e.forEach(t);else for(let r=0;r<e.length;r++)t(e[r],r,e)}function o(e,t,r){if(e.slice)return e.slice(t,r);void 0===t?t=0:(t<0&&(t+=e.length),t=Math.min(e.length,Math.max(0,t))),void 0===r?r=e.length:(r<0&&(r+=e.length),r=Math.min(e.length,Math.max(0,r)));const n=Math.max(0,r-t),o=new(0,e.constructor)(n);for(let r=0;r<n;r++)o[r]=e[t+r];return o}function s(e){return e instanceof ArrayBuffer||e&&e.constructor&&"ArrayBuffer"===e.constructor.name}function i(e){return e instanceof Int8Array||e&&e.constructor&&"Int8Array"===e.constructor.name}function a(e){return e instanceof Uint8Array||e&&e.constructor&&"Uint8Array"===e.constructor.name}function c(e){return e instanceof Uint8ClampedArray||e&&e.constructor&&"Uint8ClampedArray"===e.constructor.name}function u(e){return e instanceof Int16Array||e&&e.constructor&&"Int16Array"===e.constructor.name}function l(e){return e instanceof Uint16Array||e&&e.constructor&&"Uint16Array"===e.constructor.name}function d(e){return e instanceof Int32Array||e&&e.constructor&&"Int32Array"===e.constructor.name}function f(e){return e instanceof Uint32Array||e&&e.constructor&&"Uint32Array"===e.constructor.name}function h(e){return e instanceof Float32Array||e&&e.constructor&&"Float32Array"===e.constructor.name}function p(e){return e instanceof Float64Array||e&&e.constructor&&"Float64Array"===e.constructor.name}r.d(t,{Ed:()=>n,eP:()=>s,xZ:()=>h,fS:()=>p,z3:()=>u,Hx:()=>d,W0:()=>i,Uc:()=>l,ZY:()=>f,lq:()=>a,KZ:()=>c,tP:()=>o})},17452:(e,t,r)=>{r.d(t,{R9:()=>w,qg:()=>P,tD:()=>_,ZN:()=>ue,fl:()=>le,AX:()=>O,Gd:()=>b,Ie:()=>ie,sJ:()=>G,AH:()=>J,vt:()=>oe,oh:()=>j,P$:()=>N,Ml:()=>de,ed:()=>$,b7:()=>T,D6:()=>L,tm:()=>U,YP:()=>B,jc:()=>H,HK:()=>z,$U:()=>X,oC:()=>V,kl:()=>I,v_:()=>W,hF:()=>F,_l:()=>Y,PF:()=>M,Fv:()=>D,B7:()=>S,u0:()=>k,Yd:()=>ne,Hu:()=>ce,Qj:()=>se,hO:()=>ee,mN:()=>x});var n=r(68773),o=r(20102),s=(r(16358),r(92604)),i=r(70586);const a=s.Z.getLogger("esri.core.urlUtils"),c=n.Z.request,u="esri/config: esriConfig.request.proxyUrl is not set.",l=/^\s*[a-z][a-z0-9-+.]*:(?![0-9])/i,d=/^\s*http:/i,f=/^\s*https:/i,h=/^\s*file:/i,p=/:\d+$/,m=/^https?:\/\/[^/]+\.arcgis.com\/sharing(\/|$)/i,g=new RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"),y=new RegExp("^((([^\\[:]+):)?([^@]+)@)?(\\[([^\\]]+)\\]|([^\\[:]*))(:([0-9]+))?$");class w{constructor(e=""){this.uri=e,this.scheme=null,this.authority=null,this.path=null,this.query=null,this.fragment=null,this.user=null,this.password=null,this.host=null,this.port=null;let t=(0,i.j0)(this.uri.match(g));this.scheme=t[2]||(t[1]?"":null),this.authority=t[4]||(t[3]?"":null),this.path=t[5],this.query=t[7]||(t[6]?"":null),this.fragment=t[9]||(t[8]?"":null),null!=this.authority&&(t=(0,i.j0)(this.authority.match(y)),this.user=t[3]||null,this.password=t[4]||null,this.host=t[6]||t[7],this.port=t[9]||null)}toString(){return this.uri}}const b=new w(n.Z.applicationUrl),v={},O=(()=>{const e=(0,i.j0)(b.path),t=e.substring(0,e.lastIndexOf(e.split("/")[e.split("/").length-1]));return`${b.scheme}://${b.host}${null!=b.port?`:${b.port}`:""}${t}`})();function x(e){const t={path:null,query:null},r=new w(e),n=e.indexOf("?");return null===r.query?t.path=e:(t.path=e.substring(0,n),t.query=k(r.query)),r.fragment&&(t.hash=r.fragment,null===r.query&&(t.path=t.path.substring(0,t.path.length-(r.fragment.length+1)))),t}function k(e){const t=e.split("&"),r={};for(const e of t){if(!e)continue;const t=e.indexOf("=");let n,o;t<0?(n=decodeURIComponent(e),o=""):(n=decodeURIComponent(e.slice(0,t)),o=decodeURIComponent(e.slice(t+1)));let s=r[n];"string"==typeof s&&(s=r[n]=[s]),Array.isArray(s)?s.push(o):r[n]=o}return r}function C(e){return e&&"object"==typeof e&&"toJSON"in e&&"function"==typeof e.toJSON}function S(e,t){return e?t&&"function"==typeof t?Object.keys(e).map((r=>encodeURIComponent(r)+"="+encodeURIComponent(t(r,e[r])))).join("&"):Object.keys(e).map((r=>{const n=e[r];if(null==n)return"";const o=encodeURIComponent(r)+"=",s=t&&t[r];return s?o+encodeURIComponent(s(n)):Array.isArray(n)?n.map((e=>C(e)?o+encodeURIComponent(JSON.stringify(e)):o+encodeURIComponent(e))).join("&"):C(n)?o+encodeURIComponent(JSON.stringify(n)):o+encodeURIComponent(n)})).filter((e=>e)).join("&"):""}function T(e=!1){let t,r=c.proxyUrl;if("string"==typeof e){t=X(e);const n=$(e);n&&(r=n.proxyUrl)}else t=!!e;if(!r)throw a.warn(u),new o.Z("urlutils:proxy-not-set",u);return t&&te()&&(r=ee(r)),x(r)}function P(e){const t=$(e);let r,n;if(t){const e=E(t.proxyUrl);r=e.path,n=e.query?k(e.query):null}if(r){const t=x(e);e=r+"?"+t.path;const o=S({...n,...t.query});o&&(e=`${e}?${o}`)}return e}const q={path:"",query:""};function E(e){const t=e.indexOf("?");return-1!==t?(q.path=e.slice(0,t),q.query=e.slice(t+1)):(q.path=e,q.query=null),q}function Z(e){return(e=re(e=function(e){return e&&"/"===e[e.length-1]?e:`${e}/`}(e=E(e).path),!0)).toLowerCase()}function _(e){const t={proxyUrl:e.proxyUrl,urlPrefix:Z(e.urlPrefix)},r=c.proxyRules,n=t.urlPrefix;let o=r.length;for(let e=0;e<r.length;e++){const t=r[e].urlPrefix;if(0===n.indexOf(t)){if(n.length===t.length)return-1;o=e;break}0===t.indexOf(n)&&(o=e+1)}return r.splice(o,0,t),o}function $(e){const t=c.proxyRules,r=Z(e);for(let e=0;e<t.length;e++)if(0===r.indexOf(t[e].urlPrefix))return t[e]}function U(e,t){return e=A(e),t=A(t),re(e)===re(t)}function A(e){const t=(e=D(e)).indexOf("/sharing");return t>0?e.substring(0,t):e.replace(/\/+$/,"")}function j(e){const t=t=>null==t||t instanceof RegExp&&t.test(e)||"string"==typeof t&&e.startsWith(t),r=c.interceptors;if(r)for(const e of r)if(Array.isArray(e.urls)){if(e.urls.some(t))return e}else if(t(e.urls))return e;return null}function L(e,t,r=!1){const n=ae(e),o=ae(t);return!(!r&&n.scheme!==o.scheme)&&null!=n.host&&null!=o.host&&n.host.toLowerCase()===o.host.toLowerCase()&&n.port===o.port}function I(e){if("string"==typeof e){if(!B(e))return!0;e=ae(e)}if(L(e,b))return!0;const t=c.trustedServers||[];for(let r=0;r<t.length;r++){const n=R(t[r]);for(let t=0;t<n.length;t++)if(L(e,n[t]))return!0}return!1}function R(e){return v[e]||(Q(e)||V(e)?v[e]=[new w(F(e))]:v[e]=[new w(`http://${e}`),new w(`https://${e}`)]),v[e]}function F(e,t=O,r){return V(e)?r&&r.preserveProtocolRelative?e:"http"===b.scheme&&b.authority===N(e).slice(2)?`http:${e}`:`https:${e}`:Q(e)?e:(0,i.j0)(W("/"===e[0]?function(e){const t=e.indexOf("//"),r=e.indexOf("/",t+2);return-1===r?e:e.slice(0,r)}(t):t,e))}function M(e,t=O,r){if(!B(e))return e;const n=D(e),o=n.toLowerCase(),s=D(t).toLowerCase().replace(/\/+$/,""),i=r?D(r).toLowerCase().replace(/\/+$/,""):null;if(i&&0!==s.indexOf(i))return e;const a=(e,t,r)=>-1===(r=e.indexOf(t,r))?e.length:r;let c=a(o,"/",o.indexOf("//")+2),u=-1;for(;o.slice(0,c+1)===s.slice(0,c)+"/"&&(u=c+1,c!==o.length);)c=a(o,"/",c+1);if(-1===u)return e;if(i&&u<i.length)return e;e=n.slice(u);const l=s.slice(u-1).replace(/[^/]+/g,"").length;if(l>0)for(let t=0;t<l;t++)e=`../${e}`;else e=`./${e}`;return e}function D(e){return function(e){const t=c.httpsDomains;if(!function(e){return d.test(e)||"http"===b.scheme&&V(e)}(e))return e;const r=e.indexOf("/",7);let n;if(n=-1===r?e:e.slice(0,r),n=n.toLowerCase().slice(7),p.test(n)){if(!n.endsWith(":80"))return e;n=n.slice(0,-3),e=e.replace(":80","")}return"http"===b.scheme&&n===b.authority&&!m.test(e)||(te()&&n===b.authority||t&&t.some((e=>n===e||n.endsWith(`.${e}`)))||te()&&!$(e))&&(e=ee(e)),e}(e=function(e){return e.replace(/^(https?:\/\/)(arcgis\.com)/i,"$1www.$2")}(e=function(e){if(/^https?:\/\//i.test(e)){const t=E(e);e=(e=t.path.replace(/\/{2,}/g,"/")).replace("/","//"),t.query&&(e+=`?${t.query}`)}return e}(e=F(e=e.trim()))))}function W(...e){const t=e.filter(i.pC);if(!t||!t.length)return;const r=[];if(B(t[0])){const e=t[0],n=e.indexOf("//");-1!==n&&(r.push(e.slice(0,n+1)),function(e){return h.test(e)}(t[0])&&(r[0]+="/"),t[0]=e.slice(n+2))}else"/"===t[0][0]&&r.push("");const n=t.reduce(((e,t)=>t?e.concat(t.split("/")):e),[]);for(let e=0;e<n.length;e++){const t=n[e];".."===t&&r.length>0&&".."!==r[r.length-1]?r.pop():(!t&&e===n.length-1||t&&("."!==t||0===r.length))&&r.push(t)}return r.join("/")}function N(e,t=!1){if(H(e)||z(e))return null;let r=e.indexOf("://");if(-1===r&&V(e))r=2;else{if(-1===r)return null;r+=3}const n=e.indexOf("/",r);return-1!==n&&(e=e.slice(0,n)),t&&(e=re(e,!0)),e}function B(e){return V(e)||Q(e)}function H(e){return null!=e&&"blob:"===e.slice(0,5)}function z(e){return"data:"===e.slice(0,5)}function J(e){const t=G(e);if(!t||!t.isBase64)return null;const r=atob(t.data),n=new Uint8Array(r.length);for(let e=0;e<r.length;e++)n[e]=r.charCodeAt(e);return n.buffer}const K=/^data:(.*?)(;base64)?,(.*)$/;function G(e){const t=e.match(K);if(!t)return null;const[,r,n,o]=t;return{mediaType:r,isBase64:!!n,data:o}}function Y(e){return e.isBase64?`data:${e.mediaType};base64,${e.data}`:`data:${e.mediaType},${e.data}`}function V(e){return null!=e&&void 0!==e&&"/"===e[0]&&"/"===e[1]}function Q(e){return l.test(e)}function X(e){return f.test(e)||"https"===b.scheme&&V(e)}function ee(e){return V(e)?`https:${e}`:e.replace(d,"https:")}function te(){return"https"===b.scheme}function re(e,t=!1){return V(e)?e.slice(2):(e=e.replace(l,""),t&&e.length>1&&"/"===e[0]&&"/"===e[1]&&(e=e.slice(2)),e)}function ne(e){let t=0;if(B(e)){const r=e.indexOf("//");-1!==r&&(t=r+2)}const r=e.lastIndexOf("/");return r<t?e:e.slice(0,r+1)}function oe(e,t){if(!e)return"";const r=x(e).path.replace(/\/+$/,""),n=r.substring(r.lastIndexOf("/")+1);if(null==t||!t.length)return n;const o=new RegExp(`.(${t.join("|")})$`,"ig");return n.replace(o,"")}function se(e){return e.replace(/\/+$/,"")}function ie(e,t,r){if(!(t&&r&&e&&B(e)))return e;const n=e.indexOf("//"),o=e.indexOf("/",n+2),s=e.indexOf(":",n+2),i=Math.min(o<0?e.length:o,s<0?e.length:s);return e.slice(n+2,i).toLowerCase()!==t.toLowerCase()?e:`${e.slice(0,n+2)}${r}${e.slice(i)}`}function ae(e){return"string"==typeof e?new w(F(e)):(e.scheme||(e.scheme=b.scheme),e)}function ce(e,t){const r=x(e),n=Object.keys(r.query||{});return n.length>0&&t&&t.warn("removeQueryParameters()",`Url query parameters are not supported, the following parameters have been removed: ${n.join(", ")}.`),r.path}function ue(e,t,r){const n=x(e),o=n.query||{};return o[t]=String(r),`${n.path}?${S(o)}`}function le(e,t){const r=x(e),n=r.query||{};for(const e in t)n[e]=t[e];const o=S(n);return o?`${r.path}?${o}`:r.path}function de(e){if((0,i.Wi)(e))return null;const t=e.match(fe);return t?t[1]:null}const fe=/.*?\.([^\/]*)$/},40330:(e,t,r)=>{r.d(t,{Dp:()=>u,id:()=>a,qh:()=>c,i8:()=>s,Nv:()=>i});var n=r(80442),o=r(17452);const s="4.21",i={request(e,t){var n;const o=null==(n=e.options)?void 0:n.responseType;return r.e(3172).then(r.bind(r,3172)).then((({default:r})=>{const n=e.options||{};return n.responseType="native"===o||"native-request-init"===o?"native-request-init":"array-buffer",n.signal=null==t?void 0:t.signal,r(e.url,n)})).then((e=>{const t={data:e.data,ssl:e.ssl};return"native-request-init"===e.requestOptions.responseType?(delete t.data.signal,t):{result:t,transferList:[t.data]}}))}};let a;function c(e){a=e}function u(e){const t=a&&a.findCredential(e);return t&&t.token?(0,o.ZN)(e,"token",t.token):e}(0,n.Z)("host-webworker")||((0,n.Z)("edge")||(0,n.Z)("trident"))&&console.warn("Deprecated browser - see http://esriurl.com/oldbrowser")},3172:(e,t,r)=>{r.r(t),r.d(t,{default:()=>p});var n=r(68773),o=r(40330),s=r(20102),i=r(16358),a=r(80442),c=r(22974),u=r(70586),l=r(95330),d=r(17452),f=r(71058),h=r(85958);async function p(e,t){const c=(0,d.HK)(e),h=(0,d.jc)(e);h||c||(e=(0,d.Fv)(e));const w={url:e,requestOptions:{...(0,u.Wg)(t)}};let b=(0,d.oh)(e);if(b){const e=await async function(e,t){if(null!=e.responseData)return e.responseData;if(e.headers&&(t.requestOptions.headers={...t.requestOptions.headers,...e.headers}),e.query&&(t.requestOptions.query={...t.requestOptions.query,...e.query}),e.before){let r,n;try{n=await e.before(t)}catch(e){r=C("request:interceptor",e,t)}if((n instanceof Error||n instanceof s.Z)&&(r=C("request:interceptor",n,t)),r)throw e.error&&e.error(r),r;return n}}(b,w);if(null!=e)return{data:e,getHeader:O,requestOptions:w.requestOptions,url:w.url};b.after||b.error||(b=null)}if(e=w.url,"image"===(t=w.requestOptions).responseType){if((0,a.Z)("host-webworker")||(0,a.Z)("host-node"))throw C("request:invalid-parameters",new Error("responseType 'image' is not supported in Web Workers or Node environment"),w)}else if(c)throw C("request:invalid-parameters",new Error("Data URLs are not supported for responseType = "+t.responseType),w);if("head"===t.method){if(t.body)throw C("request:invalid-parameters",new Error("body parameter cannot be set when method is 'head'"),w);if(c||h)throw C("request:invalid-parameters",new Error("data and blob URLs are not supported for method 'head'"),w)}if(await async function(){(0,a.Z)("host-webworker")?m||(m=await r.e(9884).then(r.bind(r,29884))):p._abortableFetch||(p._abortableFetch=i.Z.fetch.bind(i.Z))}(),m)return m.execute(e,t);const v=(0,l.yi)();(0,l.fu)(t,(()=>v.abort()));const x={controller:v,credential:null,credentialToken:null,fetchOptions:null,hasToken:!1,interceptor:b,params:w,redoRequest:!1,useIdentity:g.useIdentity,useProxy:!1,useSSL:!1,withCredentials:!1},k=await async function(e){var t,r;let s,a;await async function(e){const t=e.params.url,r=e.params.requestOptions,s=e.controller.signal,a=r.body;let c=null,u=null,d=null;if(y&&"HTMLFormElement"in i.Z&&(a instanceof FormData?c=a:a instanceof HTMLFormElement&&(u=a,c=new FormData(u))),"string"==typeof a&&(d=a),e.fetchOptions={cache:r.cacheBust&&!p._abortableFetch.polyfill?"no-cache":"default",credentials:"same-origin",headers:r.headers||{},method:"head"===r.method?"HEAD":"GET",mode:"cors",redirect:"follow",signal:s},(c||d)&&(e.fetchOptions.body=c||d),"anonymous"===r.authMode&&(e.useIdentity=!1),e.hasToken=!!(/token=/i.test(t)||r.query&&r.query.token||c&&c.get&&c.get("token")||u&&u.elements.token),!e.hasToken&&n.Z.apiKey&&(0,f.r)(t)&&(r.query||(r.query={}),r.query.token=n.Z.apiKey,e.hasToken=!0),e.useIdentity&&!e.hasToken&&!e.credentialToken&&!T(t)&&!(0,l.Hc)(s)){let n;"immediate"===r.authMode?(await S(),n=await o.id.getCredential(t,{signal:s}),e.credential=n):"no-prompt"===r.authMode?(await S(),n=await o.id.getCredential(t,{prompt:!1,signal:s}).catch((()=>{})),e.credential=n):o.id&&(n=o.id.findCredential(t)),n&&(e.credentialToken=n.token,e.useSSL=!!n.ssl)}}(e);try{do{[s,a]=await P(e)}while(!await E(e,s,a))}catch(t){const r=C("request:server",t,e.params,s);throw r.details.ssl=e.useSSL,e.interceptor&&e.interceptor.error&&e.interceptor.error(r),r}const c=e.params.url;if(/\/sharing\/rest\/(accounts|portals)\/self/i.test(c)&&!e.hasToken&&!e.credentialToken&&null!=(t=a)&&null!=(r=t.user)&&r.username&&!(0,d.kl)(c)){const e=(0,d.P$)(c,!0);e&&g.trustedServers.push(e)}const u=e.credential;if(u&&o.id){const e=o.id.findServerInfo(u.server);let t=e&&e.owningSystemUrl;if(t){t=t.replace(/\/?$/,"/sharing");const e=o.id.findCredential(t,u.userId);e&&-1===o.id._getIdenticalSvcIdx(t,e)&&e.resources.unshift(t)}}return{data:a,getHeader:s?e=>s.headers.get(e):O,requestOptions:e.params.requestOptions,ssl:e.useSSL,url:e.params.url}}(x);return b&&b.after&&b.after(k),k}let m;const g=n.Z.request,y="FormData"in i.Z,w=[499,498,403,401],b=["COM_0056","COM_0057","SB_0008"],v=[/\/arcgis\/tokens/i,/\/sharing(\/rest)?\/generatetoken/i,/\/rest\/info/i],O=()=>null,x=Symbol();function k(e){const t=(0,d.P$)(e);return!t||t.endsWith(".arcgis.com")||p._corsServers.includes(t)||(0,d.kl)(t)}function C(e,t,r,n){let o="Error";const i={url:r.url,requestOptions:r.requestOptions,getHeader:O,ssl:!1};if(t instanceof s.Z)return t.details?(t.details=(0,c.d9)(t.details),t.details.url=r.url,t.details.requestOptions=r.requestOptions):t.details=i,t;if(t){const e=n&&(e=>n.headers.get(e)),r=n&&n.status,s=t.message;s&&(o=s),e&&(i.getHeader=e),i.httpStatus=(null!=t.httpCode?t.httpCode:t.code)||r||0,i.subCode=t.subcode,i.messageCode=t.messageCode,"string"==typeof t.details?i.messages=[t.details]:i.messages=t.details,i.raw=x in t?t[x]:t}return(0,l.D_)(t)?(0,l.zE)():new s.Z(e,o,i)}async function S(){o.id||await Promise.all([r.e(7824),r.e(7304),r.e(5472),r.e(9625)]).then(r.bind(r,79339))}function T(e){return v.some((t=>t.test(e)))}async function P(e){let t=e.params.url;const r=e.params.requestOptions,n=e.fetchOptions,s=(0,d.jc)(t)||(0,d.HK)(t),i=r.responseType||"json",c=s?0:null!=r.timeout?r.timeout:g.timeout;let u=!1;if(!s){e.useSSL&&(t=(0,d.hO)(t)),r.cacheBust&&"default"===n.cache&&(t=(0,d.ZN)(t,"request.preventCache",Date.now()));let s={...r.query};e.credentialToken&&(s.token=e.credentialToken);let i=(0,d.B7)(s);(0,a.Z)("esri-url-encodes-apostrophe")&&(i=i.replace(/'/g,"%27"));const c=t.length+1+i.length;let l;u="delete"===r.method||"post"===r.method||"put"===r.method||!!r.body||c>g.maxUrlLength;const f=r.useProxy||!!(0,d.ed)(t);if(f){const e=(0,d.b7)(t);l=e.path,!u&&l.length+1+c>g.maxUrlLength&&(u=!0),e.query&&(s={...e.query,...s})}if("HEAD"===n.method&&(u||f)){if(u){if(c>g.maxUrlLength)throw C("request:invalid-parameters",new Error("URL exceeds maximum length"),e.params);throw C("request:invalid-parameters",new Error("cannot use POST request when method is 'head'"),e.params)}if(f)throw C("request:invalid-parameters",new Error("cannot use proxy when method is 'head'"),e.params)}if(u?(n.method="delete"===r.method?"DELETE":"put"===r.method?"PUT":"POST",r.body?t=(0,d.fl)(t,s):(n.body=(0,d.B7)(s),n.headers["Content-Type"]="application/x-www-form-urlencoded")):t=(0,d.fl)(t,s),f&&(e.useProxy=!0,t=`${l}?${t}`),s.token&&y&&n.body instanceof FormData){const e=n.body;e.set?e.set("token",s.token):e.append("token",s.token)}if(r.hasOwnProperty("withCredentials"))e.withCredentials=r.withCredentials;else if(!(0,d.D6)(t,d.Gd))if((0,d.kl)(t))e.withCredentials=!0;else if(o.id){const r=o.id.findServerInfo(t);r&&r.webTierAuth&&(e.withCredentials=!0)}e.withCredentials&&(n.credentials="include")}let f,h,m=0,w=!1;c>0&&(m=setTimeout((()=>{w=!0,e.controller.abort()}),c));try{if("native-request-init"===r.responseType)h=n,h.url=t;else if("image"!==r.responseType||"default"!==n.cache||"GET"!==n.method||u||function(e){if(e)for(const t of Object.getOwnPropertyNames(e))if(e[t])return!0;return!1}(r.headers)||!s&&!e.useProxy&&g.proxyUrl&&!k(t)){if(f=await p._abortableFetch(t,n),e.useProxy||function(e){const t=(0,d.P$)(e);t&&!p._corsServers.includes(t)&&p._corsServers.push(t)}(t),"native"===r.responseType)h=f;else if("HEAD"!==n.method)if(f.ok){switch(i){case"array-buffer":h=await f.arrayBuffer();break;case"blob":case"image":h=await f.blob();break;default:h=await f.text()}if(m&&(clearTimeout(m),m=0),"json"===i||"xml"===i||"document"===i)if(h)switch(i){case"json":h=JSON.parse(h);break;case"xml":h=q(h,"application/xml");break;case"document":h=q(h,"text/html")}else h=null;if(h){if("array-buffer"===i||"blob"===i){const e=f.headers.get("Content-Type");if(/application\/json|text\/plain/i.test(e)&&h["blob"===i?"size":"byteLength"]<=750)try{const e=await new Response(h).json();e.error&&(h=e)}catch{}}"image"===i&&h instanceof Blob&&(h=await Z(URL.createObjectURL(h),e,!0))}}else h=await f.text()}else h=await Z(t,e)}catch(n){if("AbortError"===n.name){if(w)throw new Error("Timeout exceeded");throw(0,l.zE)("Request canceled")}if(!(!f&&n instanceof TypeError&&g.proxyUrl)||r.body||"delete"===r.method||"head"===r.method||"post"===r.method||"put"===r.method||e.useProxy||k(t))throw n;e.redoRequest=!0,(0,d.tD)({proxyUrl:g.proxyUrl,urlPrefix:(0,d.P$)(t)})}finally{m&&clearTimeout(m)}return[f,h]}function q(e,t){let r;try{r=(new DOMParser).parseFromString(e,t)}catch{}if(!r||r.getElementsByTagName("parsererror").length)throw new SyntaxError("XML Parse error");return r}async function E(e,t,r){if(e.redoRequest)return e.redoRequest=!1,!1;const n=e.params.requestOptions;if(!t||"native"===n.responseType||"native-request-init"===n.responseType)return!0;let s,i,a,c;if(!t.ok)throw s=new Error(`Unable to load ${t.url} status: ${t.status}`),s[x]=r,s;null!=r&&r.error&&(s=r.error),s&&(i=Number(s.code),a=s.hasOwnProperty("subcode")?Number(s.subcode):null,c=s.messageCode,c=c&&c.toUpperCase());const u=n.authMode;if(403===i&&(4===a||s.message&&s.message.toLowerCase().indexOf("ssl")>-1&&-1===s.message.toLowerCase().indexOf("permission"))){if(!e.useSSL)return e.useSSL=!0,!1}else if(!e.hasToken&&e.useIdentity&&("no-prompt"!==u||498===i)&&-1!==w.indexOf(i)&&!T(e.params.url)&&(403!==i||-1===b.indexOf(c)&&(null==a||2===a&&e.credentialToken))){await S();try{const t=await o.id.getCredential(e.params.url,{error:C("request:server",s,e.params),prompt:"no-prompt"!==u,signal:e.controller.signal,token:e.credentialToken});return e.credential=t,e.credentialToken=t.token,e.useSSL=e.useSSL||t.ssl,!1}catch(t){if("no-prompt"===u)return e.credential=null,e.credentialToken=null,!1;s=t}}if(s)throw s;return!0}function Z(e,t,r=!1){const n=t.controller.signal,o=new Image;return t.withCredentials?o.crossOrigin="use-credentials":o.crossOrigin="anonymous",o.alt="",o.src=e,(0,h.f)(o,e,r,n)}p._abortableFetch=null,p._corsServers=["https://server.arcgisonline.com","https://services.arcgisonline.com"]},71058:(e,t,r)=>{r.d(t,{r:()=>s});var n=r(17452);const o=["elevation3d.arcgis.com","js.arcgis.com","jsdev.arcgis.com","jsqa.arcgis.com","static.arcgis.com"];function s(e){const t=(0,n.P$)(e,!0);return t&&t.endsWith(".arcgis.com")&&!o.includes(t)&&!e.endsWith("/sharing/rest/generateToken")}},85958:(e,t,r)=>{r.d(t,{f:()=>i});var n=r(80442),o=r(70586),s=r(95330);function i(e,t,r=!1,i){return new Promise(((c,u)=>{if((0,s.Hc)(i))return void u(a());let l=()=>{h(),u(new Error(`Unable to load ${t}`))},d=()=>{const t=e;h(),c(t)},f=()=>{if(!e)return;const t=e;h(),t.src="",u(a())};const h=()=>{(0,n.Z)("esri-image-decode")||(e.removeEventListener("error",l),e.removeEventListener("load",d)),l=null,d=null,e=null,(0,o.pC)(i)&&i.removeEventListener("abort",f),f=null,r&&URL.revokeObjectURL(t)};(0,o.pC)(i)&&i.addEventListener("abort",f),(0,n.Z)("esri-image-decode")?e.decode().then(d,l):(e.addEventListener("error",l),e.addEventListener("load",d))}))}function a(){try{return new DOMException("Aborted","AbortError")}catch{const e=new Error;return e.name="AbortError",e}}},17202:(e,t,r)=>{r.d(t,{r:()=>n,$:()=>o});const n="20210916",o="7e6e1e4086272cbd3b40749349f028d8d15fcdc7"},42134:(e,t,r)=>{r.r(t),r.d(t,{clearBoundingBoxCache:()=>d,computeIconLayerResourceSize:()=>p,computeLayerResourceSize:()=>f,computeLayerSize:()=>h,computeObjectLayerResourceSize:()=>m});var n=r(3172),o=r(20102),s=r(74669),i=r(70586),a=r(60437),c=r(45119);let u=l();function l(){return new s.Z(50)}function d(){u=l()}function f(e,t){if("icon"===e.type)return p(e,t);if("object"===e.type)return m(e,t);throw new o.Z("symbol3d:unsupported-symbol-layer","computeLayerSize only works with symbol layers of type Icon and Object")}async function h(e,t){if("icon"===e.type)return function(e,t){return p(e,t).then((t=>{if(null==e.size)return t;const r=t[0]/t[1];return r>1?[e.size,e.size/r]:[e.size*r,e.size]}))}(e,t);if("object"===e.type)return async function(e,t){const r=await m(e,t);return(0,c.$K)(r,e)}(e,t);throw new o.Z("symbol3d:unsupported-symbol-layer","computeLayerSize only works with symbol layers of type Icon and Object")}async function p(e,t){if(e.resource.href)return(r=e.resource.href,(0,n.default)(r,{responseType:"image"}).then((e=>e.data))).then((e=>[e.width,e.height]));var r;if(e.resource.primitive)return(0,i.pC)(t)?[t,t]:[256,256];throw new o.Z("symbol3d:invalid-symbol-layer","symbol layers of type Icon must have either an href or a primitive resource")}function m(e,t){return async function(e,t){if(!e.isPrimitive){const t=e.resource.href,n=u.get(t);if(void 0!==n)return Promise.resolve(n);const o=await Promise.all([r.e(6481),r.e(1762),r.e(9044),r.e(1313)]).then(r.bind(r,21313)),s=await o.fetch(t,{disableTextures:!0});return u.put(t,s.referenceBoundingBox),s.referenceBoundingBox}let n=null;if(e.resource&&e.resource.primitive&&(n=(0,a.Ue)((0,c.Uz)(e.resource.primitive)),(0,i.pC)(t)))for(let e=0;e<n.length;e++)n[e]*=t;return n?Promise.resolve(n):Promise.reject(new o.Z("symbol:invalid-resource","The symbol does not have a valid resource"))}(e,t).then((e=>(0,a.dp)(e)))}}}]);
|